On 30 January 2012 19:30, Marco Leise <Marco.Leise@gmx.de> wrote:
Am 30.01.2012, 15:24 Uhr, schrieb Manu <turkeyman@gmail.com>:

Here's another one I'm endlessly wishing I had in C.
I want to know if a library is present, and automatically disable non-vital
features if it isn't.
It shits me to tears when I can't build something because a non-vital
dependant lib is not available for a given platform or just not wanted.

A library is some .dll/.so in this case ?
If you know it exists only on a certain platform: use version(Platform)
If it _may_ be there, then compile the feature in, but load and check the library at runtime like you would do with a plugin.

I'm talking about static libs, since you need to link the supporting code for DLL's anyway.

This sounds like what has been solved with configure scripts long ago. If you ever built e.g. GDC or most other Linux programs, they come with a little script that allows you to preconfigure your build process and takes care of linking to the different available libraries.

Configure scripts certainly don't 'solve' the problem, they make it worse... now my buildscript has twice as many steps, nobody can understand it, and it only works on linux.

       ./configure --disable-libDontUseMe

I never wrote one myself though...

Exactly, and nobody I've ever met has either. They just seem to exist, magically appeared out of nowhere in all major linux projects that have existed for 20 years or so. As far as I can tell, nobody ACTUALLY wrote them, they've just always been there... ;)