From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14307 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Chris Hall Newsgroups: gmane.linux.lib.musl.general Subject: Re: Detecting musl at compile and/or configure time Date: Sun, 30 Jun 2019 12:48:55 +0100 Message-ID: <7dfceb33-b903-de2a-7abe-825f44512f0c@gmch.uk> References: <1561802993.8028.ezmlm@lists.openwall.com> <8c2d963e-1fcf-df2e-2a52-614f0250b594@gmch.uk> <20425c39-b411-b9bb-1e83-bf26dbcd7d4d@adelielinux.org> <20190629135859.GA21055@port70.net> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="151257"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 To: musl@lists.openwall.com Original-X-From: musl-return-14323-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jun 30 13:49:13 2019 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.89) (envelope-from ) id 1hhYKW-000dG3-FM for gllmg-musl@m.gmane.org; Sun, 30 Jun 2019 13:49:12 +0200 Original-Received: (qmail 7594 invoked by uid 550); 30 Jun 2019 11:49:08 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7562 invoked from network); 30 Jun 2019 11:49:07 -0000 In-Reply-To: <20190629135859.GA21055@port70.net> Content-Language: en-GB Xref: news.gmane.org gmane.linux.lib.musl.general:14307 Archived-At: 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