# HG changeset patch # User Paul Eggert # Date 1360219268 28800 # Node ID 896204e6fbfcbac104c7f0047b2df071812038f7 # Parent 2c4826afb7aa5b2013495afd97239999a74cd9e6 extensions: port better to MINUX 3, HP-UX, autoheader 2.62 Some of these changes are merged in from git Autoconf. * m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): When deciding whether to define _XOPEN_SOURCE, inspect the preprocessor macro __hpux instead of the more-heavyweight operation of requiring AC_CANONICAL_HOST. Define _NETBSD_HOST on MINUX, for MINUX 3. Use USE_SYSTEM_EXTENSIONS, not __EXTENSIONS__, as the key for __EXTENSIONS__. diff -r 2c4826afb7aa -r 896204e6fbfc ChangeLog --- a/ChangeLog Wed Feb 06 16:11:07 2013 -0800 +++ b/ChangeLog Wed Feb 06 22:41:08 2013 -0800 @@ -1,5 +1,14 @@ 2013-02-06 Paul Eggert + extensions: port better to MINUX 3, HP-UX, autoheader 2.62 + Some of these changes are merged in from git Autoconf. + * m4/extensions.m4 (AC_USE_SYSTEM_EXTENSIONS): + When deciding whether to define _XOPEN_SOURCE, inspect the + preprocessor macro __hpux instead of the more-heavyweight + operation of requiring AC_CANONICAL_HOST. Define _NETBSD_HOST on + MINUX, for MINUX 3. Use USE_SYSTEM_EXTENSIONS, not __EXTENSIONS__, + as the key for __EXTENSIONS__. + unistd: avoid namespace pollution on non-glibc systems * lib/unistd.in.h: #define __need_getopt before including . This avoids namespace pollution on non-glibc systems, by causing diff -r 2c4826afb7aa -r 896204e6fbfc m4/extensions.m4 --- a/m4/extensions.m4 Wed Feb 06 16:11:07 2013 -0800 +++ b/m4/extensions.m4 Wed Feb 06 22:41:08 2013 -0800 @@ -1,4 +1,4 @@ -# serial 12 -*- Autoconf -*- +# serial 13 -*- Autoconf -*- # Enable extensions on systems that normally disable them. # Copyright (C) 2003, 2006-2013 Free Software Foundation, Inc. @@ -30,6 +30,7 @@ # ------------------------ # Enable extensions on systems that normally disable them, # typically due to standards-conformance issues. +# # Remember that #undef in AH_VERBATIM gets replaced with #define by # AC_DEFINE. The goal here is to define all known feature-enabling # macros, then, if reports of conflicts are made, disable macros that @@ -38,8 +39,6 @@ [AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl AC_BEFORE([$0], [AC_RUN_IFELSE])dnl - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_CHECK_HEADER([minix/config.h], [MINIX=yes], [MINIX=]) if test "$MINIX" = yes; then AC_DEFINE([_POSIX_SOURCE], [1], @@ -50,24 +49,18 @@ except with this defined.]) AC_DEFINE([_MINIX], [1], [Define to 1 if on MINIX.]) + AC_DEFINE([_NETBSD_SOURCE], [1], + [Define to 1 to make NetBSD features available. MINIX 3 needs this.]) fi - dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, - dnl regardless of whether the flags -Ae or _D_HPUX_SOURCE=1 are already - dnl provided. - case "$host_os" in - hpux*) - AC_DEFINE([_XOPEN_SOURCE], [500], - [Define to 500 only on HP-UX.]) - ;; - esac - - AH_VERBATIM([__EXTENSIONS__], +dnl Use a different key than __EXTENSIONS__, as that name broke existing +dnl configure.ac when using autoheader 2.62. + AH_VERBATIM([USE_SYSTEM_EXTENSIONS], [/* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif -/* Enable general extensions on Mac OS X. */ +/* Enable general extensions on OS X. */ #ifndef _DARWIN_C_SOURCE # undef _DARWIN_C_SOURCE #endif @@ -75,6 +68,11 @@ #ifndef _GNU_SOURCE # undef _GNU_SOURCE #endif +/* HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to 500, + regardless of whether compiling with -Ae or -D_HPUX_SOURCE=1. */ +#ifdef __hpux +# define _XOPEN_SOURCE 500 +#endif /* Enable threading extensions on Solaris. */ #ifndef _POSIX_PTHREAD_SEMANTICS # undef _POSIX_PTHREAD_SEMANTICS