Mike Frysinger wrote: > --- a/lib/printf-parse.h > +++ b/lib/printf-parse.h > @@ -25,6 +25,9 @@ > > #include "printf-args.h" > > +#ifdef HAVE_FEATURES_H > +# include <features.h> /* for __GLIBC__ */ > +#endif > > /* Flags */ > #define FLAG_GROUP 1 /* ' flag */
The same problem - __GLIBC__ being tested without a guarantee that <features.h> has been included - exists also in a couple of other places. I'm fixing them like this: 2010-11-20 Bruno Haible <br...@clisp.org> Ensure that <features.h> is included before __GLIBC__ is tested. * lib/printf-parse.h: Include <features.h>. * m4/vasnprintf.m4 (gl_PREREQ_PRINTF_PARSE): Require gl_FEATURES_H. Reported by Mike Frysinger <vap...@gentoo.org>. Ensure that <features.h> is included before __GLIBC__ is tested. * lib/wchar.in.h: Include <features.h>. * m4/wchar_h.m4 (gl_WCHAR_H): Require gl_FEATURES_H. * modules/wchar (Makefile.am): Substitute HAVE_FEATURES_H. Reported by Mike Frysinger <vap...@gentoo.org>. Ensure that <features.h> is included before __GLIBC__ is tested. * lib/arpa_inet.in.h: Include <features.h>. * m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Require gl_FEATURES_H. * modules/arpa_inet (Makefile.am): Substitute HAVE_FEATURES_H. Reported by Mike Frysinger <vap...@gentoo.org>. Ensure that <features.h> is included before __GLIBC__ is tested. * build-aux/link-warning.h: Include <features.h>. * modules/link-warning (configure.ac): Require gl_FEATURES_H. (Makefile.am): Substitute HAVE_FEATURES_H into link-warning.h. Reported by Mike Frysinger <vap...@gentoo.org>. Ensure that <features.h> is included before __GLIBC__ is tested. * m4/gnulib-common.m4 (gl_FEATURES_H): New macro. Reported by Mike Frysinger <vap...@gentoo.org>. --- build-aux/link-warning.h.orig Sat Nov 20 23:37:01 2010 +++ build-aux/link-warning.h Sat Nov 20 22:56:43 2010 @@ -15,6 +15,10 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#if @HAVE_FEATURES_H@ +# include <features.h> /* for __GLIBC__, __UCLIBC__ */ +#endif + /* GL_LINK_WARNING("literal string") arranges to emit the literal string as a linker warning on most glibc systems. We use a linker warning rather than a preprocessor warning, because --- lib/arpa_inet.in.h.orig Sat Nov 20 23:37:01 2010 +++ lib/arpa_inet.in.h Sat Nov 20 23:16:16 2010 @@ -23,6 +23,10 @@ #endif @PRAGMA_COLUMNS@ +#if @HAVE_FEATURES_H@ +# include <features.h> /* for __GLIBC__ */ +#endif + /* Gnulib's sys/socket.h is responsible for pulling in winsock2.h etc under MinGW. But avoid namespace pollution on glibc systems. */ --- lib/printf-parse.h.orig Sat Nov 20 23:37:01 2010 +++ lib/printf-parse.h Sat Nov 20 23:27:54 2010 @@ -23,6 +23,10 @@ ENABLE_UNISTDIO Set to 1 to enable the unistdio extensions. STATIC Set to 'static' to declare the function static. */ +#if HAVE_FEATURES_H +# include <features.h> /* for __GLIBC__, __UCLIBC__ */ +#endif + #include "printf-args.h" --- lib/wchar.in.h.orig Sat Nov 20 23:37:01 2010 +++ lib/wchar.in.h Sat Nov 20 23:08:10 2010 @@ -53,6 +53,10 @@ #define _GL_ALREADY_INCLUDING_WCHAR_H +#if @HAVE_FEATURES_H@ +# include <features.h> /* for __GLIBC__ */ +#endif + /* Tru64 with Desktop Toolkit C has a bug: <stdio.h> must be included before <wchar.h>. BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be --- m4/arpa_inet_h.m4.orig Sat Nov 20 23:37:01 2010 +++ m4/arpa_inet_h.m4 Sat Nov 20 23:16:45 2010 @@ -1,4 +1,4 @@ -# arpa_inet_h.m4 serial 9 +# arpa_inet_h.m4 serial 10 dnl Copyright (C) 2006, 2008-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -22,6 +22,8 @@ dnl <arpa/inet.h> is always overridden, because of GNULIB_POSIXCHECK. gl_CHECK_NEXT_HEADERS([arpa/inet.h]) + AC_REQUIRE([gl_FEATURES_H]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use. gl_WARN_ON_USE_PREPARE([[ --- m4/gnulib-common.m4.orig Sat Nov 20 23:37:01 2010 +++ m4/gnulib-common.m4 Sat Nov 20 22:55:11 2010 @@ -1,4 +1,4 @@ -# gnulib-common.m4 serial 20 +# gnulib-common.m4 serial 21 dnl Copyright (C) 2007-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -102,6 +102,19 @@ [Define to 1 when the gnulib module $1 should be tested.]) ]) +# Test whether <features.h> exists. +# Set HAVE_FEATURES_H. +AC_DEFUN([gl_FEATURES_H], +[ + AC_CHECK_HEADERS_ONCE([features.h]) + if test $ac_cv_header_features_h = yes; then + HAVE_FEATURES_H=1 + else + HAVE_FEATURES_H=0 + fi + AC_SUBST([HAVE_FEATURES_H]) +]) + # m4_foreach_w # is a backport of autoconf-2.59c's m4_foreach_w. # Remove this macro when we can assume autoconf >= 2.60. --- m4/vasnprintf.m4.orig Sat Nov 20 23:37:01 2010 +++ m4/vasnprintf.m4 Sat Nov 20 23:28:09 2010 @@ -1,4 +1,4 @@ -# vasnprintf.m4 serial 31 +# vasnprintf.m4 serial 32 dnl Copyright (C) 2002-2004, 2006-2010 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -40,6 +40,7 @@ # Prequisites of lib/printf-parse.h, lib/printf-parse.c. AC_DEFUN([gl_PREREQ_PRINTF_PARSE], [ + AC_REQUIRE([gl_FEATURES_H]) AC_REQUIRE([AC_TYPE_LONG_LONG_INT]) AC_REQUIRE([gt_TYPE_WCHAR_T]) AC_REQUIRE([gt_TYPE_WINT_T]) --- m4/wchar_h.m4.orig Sat Nov 20 23:37:01 2010 +++ m4/wchar_h.m4 Sat Nov 20 23:10:20 2010 @@ -7,7 +7,7 @@ dnl Written by Eric Blake. -# wchar_h.m4 serial 34 +# wchar_h.m4 serial 35 AC_DEFUN([gl_WCHAR_H], [ @@ -26,6 +26,8 @@ fi AC_SUBST([HAVE_WCHAR_H]) + AC_REQUIRE([gl_FEATURES_H]) + AC_REQUIRE([gt_TYPE_WINT_T]) if test $gt_cv_c_wint_t = yes; then HAVE_WINT_T=1 --- modules/arpa_inet.orig Sat Nov 20 23:37:01 2010 +++ modules/arpa_inet Sat Nov 20 23:31:05 2010 @@ -27,6 +27,7 @@ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_ARPA_INET_H''@|$(NEXT_ARPA_INET_H)|g' \ -e 's|@''HAVE_ARPA_INET_H''@|$(HAVE_ARPA_INET_H)|g' \ -e 's|@''GNULIB_INET_NTOP''@|$(GNULIB_INET_NTOP)|g' \ --- modules/link-warning.orig Sat Nov 20 23:37:01 2010 +++ modules/link-warning Sat Nov 20 23:00:19 2010 @@ -10,6 +10,7 @@ Depends-on: configure.ac: +AC_REQUIRE([gl_FEATURES_H]) Makefile.am: # The BUILT_SOURCES created by this Makefile snippet are not used via #include @@ -22,8 +23,9 @@ # build-aux/link-warning.h, except that it has the copyright header cut off. link-warning.h: $(top_srcdir)/build-aux/link-warning.h $(AM_V_GEN)rm -f $...@-t $@ && \ - sed -n -e '/GL_LINK_WARNING/,$$p' \ + sed -n -e '/HAVE_FEATURES_H/,$$p' \ < $(top_srcdir)/build-aux/link-warning.h \ + | sed -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ > $...@-t && \ mv $...@-t $@ MOSTLYCLEANFILES += link-warning.h link-warning.h-t --- modules/wchar.orig Sat Nov 20 23:37:01 2010 +++ modules/wchar Sat Nov 20 23:31:49 2010 @@ -27,6 +27,7 @@ sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''HAVE_FEATURES_H''@|$(HAVE_FEATURES_H)|g' \ -e 's|@''NEXT_WCHAR_H''@|$(NEXT_WCHAR_H)|g' \ -e 's|@''HAVE_WCHAR_H''@|$(HAVE_WCHAR_H)|g' \ -e 's|@''GNULIB_BTOWC''@|$(GNULIB_BTOWC)|g' \