Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7dfceb33-b903-de2a-7abe-825f44512f0c@gmch.uk>
Date: Sun, 30 Jun 2019 12:48:55 +0100
From: Chris Hall <musl@...h.uk>
To: musl@...ts.openwall.com
Subject: Re: Detecting musl at compile and/or configure time

On 29/06/2019 14:58, Szabolcs Nagy wrote:
>> On 06/29/19 06:48, Chris Hall wrote:
>>>
>>> Is there a supported way of detecting that one is building against the
>>> musl libc ?
>>>
>>> At compile time I can, of course, detect glibc because it sets __GLIBC__
>>> etc.  For macOS I can see _DARWIN_FEATURE_xxx macros.  The BSDs mostly
>>> give themselves away.  But for musl I have not found anything :-(
...
> note that __GLIBC__ does not detect glibc: uclibc defines it too.

Happily it has the courtesy to also:

   #define __UCLIBC__ 1

> you really want to configure check for particular features
> instead of detecting the libc (which is a moving target,
> ppl can patch it or change it over time)

In the limit, yes.  I'm interested in how far one can get without the 
need for configure/cmake/etc. -- accepting that means being quite 
conservative in the choice of features to use (and assuming that the 
target system is reasonably up to date).

Of course, for major issues -- eg epoll vs kqueue or netlink vs routeing 
sockets -- it's the underlying OS that really matters.  Detecting the OS 
at compile time seems reasonably effective (also the compiler and the 
processor).  Detecting the libc feels like it should be a small step to 
complete the picture.

Chris

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.