<div class="gmail_quote">On 30 January 2012 18:11, bls <span dir="ltr"><<a href="mailto:bizprac@orange.fr">bizprac@orange.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On 01/30/2012 07:18 AM, Adam D. Ruppe wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Monday, 30 January 2012 at 14:24:32 UTC, Manu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I want to know if a library is present, and automatically disable<br>
non-vital features if it isn't.<br>
</blockquote>
<br>
I'd like it too... here's what I tried. It doesn't<br>
work, though.<br>
</blockquote>
<br></div>
I am afraid I miss the point but shouldn't module ctors help.. f.i.<br>
<br>
module m;<br>
import std.file;<br>
static this()  // module ctor<br>
{<br>
        if ("/usr/share/include/my.lib".<u></u>isDir)<br>
                import my;<br>
        else<br>
                import other;<br>
                <br>
}<br>
<br>
Not tested!<br>
</blockquote></div><br><div>That looks like a runtime test, and would still require both libs being present to link. I'm talking about detection at compile time.</div><div><br></div><div>For example, I have a sound API here atm, the it supports mp3, vorbis, flac, wma, etc, but not all of those libraries are available for all platforms I build for.</div>
<div>What I need to do is know in advance what platforms have which libs available, and then do a bunch of platform checks to decide which should or shouldn't be present.</div><div>Further more, if a lib is *available* for a given platform, but I don't want to use it, or don't want to install/build the lib, I need to edit the code... If I could detect presence of the lib, I can just gracefully remove the feature.</div>