From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/14309 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Samuel Holland Newsgroups: gmane.linux.lib.musl.general Subject: Re: Detecting musl at compile and/or configure time Date: Sun, 30 Jun 2019 07:28:48 -0500 Message-ID: References: <26f5537f-a876-209c-a27c-cd2619f5c834@gmch.uk> <3767f116-4a52-e9ef-a2ee-df1c23719e34@gmch.uk> Reply-To: musl@lists.openwall.com Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="37677"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 To: musl@lists.openwall.com, Chris Hall Original-X-From: musl-return-14325-gllmg-musl=m.gmane.org@lists.openwall.com Sun Jun 30 14:29:07 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 1hhYx7-0009Yt-MK for gllmg-musl@m.gmane.org; Sun, 30 Jun 2019 14:29:06 +0200 Original-Received: (qmail 15922 invoked by uid 550); 30 Jun 2019 12:29:02 -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 15901 invoked from network); 30 Jun 2019 12:29:02 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sholland.org; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=5 eMlks8rO+BrAGSm0c5eNkfBf6bORGrXxY69Hhg6OKo=; b=HKIGcanxzwmvTHzJ8 QOPkn/bDJPqkdc1+tNWG6uqQXiTmYNk4WAsNjutx9iSRMe+sP4vX8a9hXgHKVNsu Gd5FXS1iq3fDnUzXq7pZ7sx3NkRPyKORGNAeXuAJ8EG58Qy0HwDK0PPBOJhOF0oQ bfzrm4l2TbkB04v6ILGyxW4SiyiOqbCQa01UzOuyPbU5Nz4Wd4bgAjJZEkVJl9rg NTD8OMOFwIdGMjvJcSzMgYd19WbrJQcbllbv1NyrCUfFF7QXRp3oyvs0ar8jKjIH UZc0c+75lLcUx5C7YMJCglvhh32iJ5vIgABUO15nQMT/OuvsBzDMYo26zrVTFYNu BDXdQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=5eMlks8rO+BrAGSm0c5eNkfBf6bORGrXxY69Hhg6O Ko=; b=RkcdjWYJAPrRMFxuXPgp+25ox6kA5nKG78hbZAYAr5kHbTsz1zLum1Jcj TBuYgO7ccQmzUuctzsWCSfVdklxVznPkShH0MbvbrkF8QRY8s2l10n4TjyhgbkHV ZQSEimXDgjRKNRdRKPbn/xPYBsY4c+KickTkg6EuYnllQ0osJ1QeVQH/OW3osI+v b3h9K/gQvSr+APbkmymEoNW3+fk25hUWw7lJhyW6JXTIRHg2juUMbw69dbMtrCWL Z07/Sw9o2RdmG85f+4qKEsNNRD3yf3lWx14pC1VTus0TKgTyB0mFJVNjpn+Jyibv VIgUwslTpLBzRKbOUYare/EynMyLw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrvdeggdehvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvfhfhkffffgggjggtgfesthekre dttdefjeenucfhrhhomhepufgrmhhuvghlucfjohhllhgrnhguuceoshgrmhhuvghlsehs hhholhhlrghnugdrohhrgheqnecuffhomhgrihhnpehophgvnhhgrhhouhhprdhorhhgne cukfhppeejtddrudefhedrudegkedrudehudenucfrrghrrghmpehmrghilhhfrhhomhep shgrmhhuvghlsehshhholhhlrghnugdrohhrghenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: In-Reply-To: <3767f116-4a52-e9ef-a2ee-df1c23719e34@gmch.uk> Content-Language: en-US Xref: news.gmane.org gmane.linux.lib.musl.general:14309 Archived-At: Hi, On 6/30/19 7:03 AM, Chris Hall wrote: > I have a little build system which tries to detect the "usual suspects" > automatically, even without a full configure/cmake/etc. step.  If the detection > process fails, it generates a warning and the user must (at least) add a '-Dxxx' > to suppress that. > > I confess I have only recently stumbled across musl.  Perhaps systems which > default to musl are so rare that I can, as a practical matter, ignore them ?  > The question then is whether to add a '-DqLIB_MUSL' gizmo to my build stuff -- > so that "musl-gcc -DqLIB_MUSL" will do the trick. The fundamental problem with that is that you're not really checking for musl. You're checking for "the supported version (and options) of POSIX", "the supported version of the Linux UAPI", and "the set of extensions currently supported by musl", which all change over time. And some of them depend on who's distributing musl, as they may add their own customizations. For POSIX, you should declare which version of the standard you follow with _POSIX_C_SOURCE, which you can verify is supported with _POSIX_VERSION, or for optional parts, the other macros in unistd.h[1]. The Linux UAPI is stable, so you can use whatever features you want as long as you gracefully handle ENOSYS/EINVAL (or document a minimum supported version). Extensions (anything not specified by POSIX or in the UAPI) must be detected individually, because they may appear (or disappear! like sys/sysmacros.h) at any time. If you know which extensions you rely on, and have fallbacks as possible/needed, then it doesn't matter what the libc is named, or what it's version number is. And it will be much easier to port your application to a new environment. [1]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/unistd.h.html > Thanks, > > Chris > Cheers, Samuel