Re: [PATCH 0/2] Modernize header checks

Eric Blake <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 05/31/2013 10:39 AM, Russ Allbery wrote:
> Zack Weinberg <[email protected]> writes:
> 
>> Second, it cleans up AC_INCLUDES_DEFAULT and all the other canned
>> tests so that they don't waste time checking for ISO C90 headers,
>> which are now ubiquitous (stddef.h, stdlib.h, string.h, wchar.h,
>> wctype.h, locale.h, time.h) and don't use pre-standard headers that
>> were replaced by C90 headers at all (memory.h and strings.h).
> 
> I *think* your patch would remove strings.h from the list of headers that
> are probed by default by Autoconf, and hence remove HAVE_STRINGS_H from
> the preprocessor directives set by Autoconf.
> 
> If so, note that removing strings.h from the list of headers that are
> probed by default will cause backwards compatibility issues.  One still
> must include strings.h (not string.h) according to POSIX in order to get
> strcasecmp and friends, and some operating systems (specifically at least
> some versions of FreeBSD) do actually enforce that and do not prototype
> those functions in string.h.  I'm quite sure there is code out there that
> assumes that Autoconf will probe for strings.h as a side effect of other
> probes and set HAVE_STRINGS_H, and therefore doesn't probe for it
> explicitly.  (I maintain some of it, in fact.)

Yes, there is a bunch of code that non-portably assumes they can use
strcasecmp or ffs without including <strings.h>.  On the other hand,
<strings.h> is available on pretty much ALL platforms that use free
software compilers (according to gnulib, only ancient Minix 3.1.8 and
non-free MSVC 9 have problems with assuming <strings.h> exists and is
self-contained; but mingw does not have this issue).  Thus, you
generally don't need to use HAVE_STRINGS_H, but can just blindly include
it, unless your package is trying to be portable to a rather unforgiving
toolchain.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 621 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCAAGBQJRqNjXAAoJEKeha0olJ0NqodcH/1TfwsNSCZAH5qO28Wm4zufO
tpop5+cEW1cAvSnbqZimKZlOVGkiTQzJGQsUA+qHsznAl0oX+MjdW0oxlc677UQH
91krjj6GYCWwvfumzjKCHGDbZ8DRRK1VMMr3euhkjyrUBeeJknEtbcXxcCumDwRd
6605CPlm5vP+N1qkW8xcPPNhRjzxI9qmdrRS1RjEbJ7UEHs40yPvuR57S+85RR1o
cfDERIgfK2WQ8tAXeAdne1w0PAGLKZc7bOtByhIC6imIMiSi08Y4og1pAOiFsIo9
5yONNYutMXgoxpEo38iSU5iYZmR8XC1fsxEORvAD9gPP7Imwaz1WqW2xTTCy7Mc=
=++Ak
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.