From b2e33d4db3e9bd913786dedbc64f1ddd5570eb55 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 20 Nov 2010 23:46:16 +0100 Subject: [PATCH] Ensure that is included before __GLIBC__ is tested. * lib/printf-parse.h: Include . * m4/vasnprintf.m4 (gl_PREREQ_PRINTF_PARSE): Require gl_FEATURES_H. * lib/wchar.in.h: Include . * m4/wchar_h.m4 (gl_WCHAR_H): Require gl_FEATURES_H. * modules/wchar (Makefile.am): Substitute HAVE_FEATURES_H. * lib/arpa_inet.in.h: Include . * m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Require gl_FEATURES_H. * modules/arpa_inet (Makefile.am): Substitute HAVE_FEATURES_H. * build-aux/link-warning.h: Include . * modules/link-warning (configure.ac): Require gl_FEATURES_H. (Makefile.am): Substitute HAVE_FEATURES_H into link-warning.h. * m4/gnulib-common.m4 (gl_FEATURES_H): New macro. Reported by Mike Frysinger . --- ChangeLog | 29 +++++++++++++++++++++++++++++ build-aux/link-warning.h | 4 ++++ lib/arpa_inet.in.h | 4 ++++ lib/printf-parse.h | 4 ++++ lib/wchar.in.h | 4 ++++ m4/arpa_inet_h.m4 | 4 +++- m4/gnulib-common.m4 | 15 ++++++++++++++- m4/vasnprintf.m4 | 3 ++- m4/wchar_h.m4 | 4 +++- modules/arpa_inet | 1 + modules/link-warning | 4 +++- modules/wchar | 1 + 12 files changed, 72 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6770d43f6..c9c1e9cdd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,34 @@ 2010-11-20 Bruno Haible + Ensure that is included before __GLIBC__ is tested. + * lib/printf-parse.h: Include . + * m4/vasnprintf.m4 (gl_PREREQ_PRINTF_PARSE): Require gl_FEATURES_H. + Reported by Mike Frysinger . + + Ensure that is included before __GLIBC__ is tested. + * lib/wchar.in.h: Include . + * m4/wchar_h.m4 (gl_WCHAR_H): Require gl_FEATURES_H. + * modules/wchar (Makefile.am): Substitute HAVE_FEATURES_H. + Reported by Mike Frysinger . + + Ensure that is included before __GLIBC__ is tested. + * lib/arpa_inet.in.h: Include . + * 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 . + + Ensure that is included before __GLIBC__ is tested. + * build-aux/link-warning.h: Include . + * modules/link-warning (configure.ac): Require gl_FEATURES_H. + (Makefile.am): Substitute HAVE_FEATURES_H into link-warning.h. + Reported by Mike Frysinger . + + Ensure that is included before __GLIBC__ is tested. + * m4/gnulib-common.m4 (gl_FEATURES_H): New macro. + Reported by Mike Frysinger . + +2010-11-20 Bruno Haible + memmem: Fix autoconf test. * m4/memmem.m4 (gl_FUNC_MEMMEM): Test HAVE_DECL_MEMMEM, not HAVE_MEMMEM. diff --git a/build-aux/link-warning.h b/build-aux/link-warning.h index cd01b50e9..27abfd95a 100644 --- a/build-aux/link-warning.h +++ b/build-aux/link-warning.h @@ -15,6 +15,10 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +#if @HAVE_FEATURES_H@ +# include /* 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 diff --git a/lib/arpa_inet.in.h b/lib/arpa_inet.in.h index 2932f8ef5..fbf084252 100644 --- a/lib/arpa_inet.in.h +++ b/lib/arpa_inet.in.h @@ -23,6 +23,10 @@ #endif @PRAGMA_COLUMNS@ +#if @HAVE_FEATURES_H@ +# include /* 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. */ diff --git a/lib/printf-parse.h b/lib/printf-parse.h index 6bd11dfa1..eb5480b68 100644 --- a/lib/printf-parse.h +++ b/lib/printf-parse.h @@ -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 /* for __GLIBC__, __UCLIBC__ */ +#endif + #include "printf-args.h" diff --git a/lib/wchar.in.h b/lib/wchar.in.h index 3b57f0034..a38026ca9 100644 --- a/lib/wchar.in.h +++ b/lib/wchar.in.h @@ -53,6 +53,10 @@ #define _GL_ALREADY_INCLUDING_WCHAR_H +#if @HAVE_FEATURES_H@ +# include /* for __GLIBC__ */ +#endif + /* Tru64 with Desktop Toolkit C has a bug: must be included before . BSD/OS 4.0.1 has a bug: , and must be diff --git a/m4/arpa_inet_h.m4 b/m4/arpa_inet_h.m4 index 490a005ad..80fdb406b 100644 --- a/m4/arpa_inet_h.m4 +++ b/m4/arpa_inet_h.m4 @@ -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 @@ AC_DEFUN([gl_HEADER_ARPA_INET], dnl 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([[ diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index 4c7ac30d0..d0c8b6628 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -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 @@ AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], [Define to 1 when the gnulib module $1 should be tested.]) ]) +# Test whether 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. diff --git a/m4/vasnprintf.m4 b/m4/vasnprintf.m4 index ebe3c52cd..9c0452024 100644 --- a/m4/vasnprintf.m4 +++ b/m4/vasnprintf.m4 @@ -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 @@ AC_DEFUN([gl_PREREQ_PRINTF_ARGS], # 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]) diff --git a/m4/wchar_h.m4 b/m4/wchar_h.m4 index c1fc30488..8c8fad96d 100644 --- a/m4/wchar_h.m4 +++ b/m4/wchar_h.m4 @@ -7,7 +7,7 @@ dnl with or without modifications, as long as this notice is preserved. dnl Written by Eric Blake. -# wchar_h.m4 serial 34 +# wchar_h.m4 serial 35 AC_DEFUN([gl_WCHAR_H], [ @@ -26,6 +26,8 @@ AC_DEFUN([gl_WCHAR_H], 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 diff --git a/modules/arpa_inet b/modules/arpa_inet index d75187380..cec5d6c85 100644 --- a/modules/arpa_inet +++ b/modules/arpa_inet @@ -27,6 +27,7 @@ arpa/inet.h: arpa_inet.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) 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' \ diff --git a/modules/link-warning b/modules/link-warning index 935f66a39..06f3675cb 100644 --- a/modules/link-warning +++ b/modules/link-warning @@ -10,6 +10,7 @@ build-aux/link-warning.h 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 @@ BUILT_SOURCES += link-warning.h # 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 diff --git a/modules/wchar b/modules/wchar index c9d5c46c3..f67737d9d 100644 --- a/modules/wchar +++ b/modules/wchar @@ -27,6 +27,7 @@ wchar.h: wchar.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) 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' \ -- 2.11.0