From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9739 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Why there's no __MUSL__ macro question Date: Wed, 23 Mar 2016 11:05:53 -0400 Message-ID: <20160323150553.GL21636@brightrain.aerifal.cx> References: <20160323132840.GD69755@wopr.sciops.net> <23DC04DE-6EB0-49A1-BEEE-3A57C3E099DC@shiz.me> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1458745571 22074 80.91.229.3 (23 Mar 2016 15:06:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 23 Mar 2016 15:06:11 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-9752-gllmg-musl=m.gmane.org@lists.openwall.com Wed Mar 23 16:06:10 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aikMJ-00088S-QY for gllmg-musl@m.gmane.org; Wed, 23 Mar 2016 16:06:07 +0100 Original-Received: (qmail 17683 invoked by uid 550); 23 Mar 2016 15:06:06 -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 17665 invoked from network); 23 Mar 2016 15:06:05 -0000 Content-Disposition: inline In-Reply-To: <23DC04DE-6EB0-49A1-BEEE-3A57C3E099DC@shiz.me> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:9739 Archived-At: On Wed, Mar 23, 2016 at 03:17:58PM +0100, Shiz wrote: > > > On 23 Mar 2016, at 14:28, Kurt H Maier wrote: > > > > On Wed, Mar 23, 2016 at 01:08:16PM +0000, Sirgio Marques wrote: > >> > >> How are we expected to solve this kind of problem if not by using the > >> __MUSL__ macro? > > > > The recommended solution is to fix the code to be portable, instead of > > installing yet another special-case workaround. > > > > In this case, wrapping the "#include " line in an > > #ifdef __GLIBC__ would be more appropriate than special-casing for musl, > > since musl is not the only environment that lacks execinfo.h. I suspect > > this code would also fail to build on cygwin, for instance. > > > > If there existed a __MUSL__ macro, the maintainers of software like this > > would just use it instead of writing portable code. By refusing to > > implement a __MUSL__ macro, musl is helping to urge projects in the > > right direction. > > Alternatively, a better approach would be the detection of ’s > existence by something like ./configure and defining a HAVE_EXECINFO_H macro > as a result that the file can use. That way you’re not cluttering the source > files with platform-specific information. Indeed, hard-coding __GLIBC__ is not really a lot better. One of the biggest problems with a hypothetical __MUSL__ is hard-coding assumptions that "musl lacks X" (which can become false in the future). A better approach is testing the the interface you want to use. This can be done purely with makefile logic if you don't like autotools. Rich