Mercurial > hg > octave-shane > gnulib-hg
changeset 12563:21ecefd9dc81
headers: make check of system header explicit
Exploiting knowledge of internal behavior of other macros can
be dangerous, especially since AC_CHECK_HEADERS_ONCE is designed
to be cheap on subsequent use.
* m4/netdb_h.m4 (gl_HEADER_NETDB): Don't exploit knowledge of
gl_CHECK_NEXT_HEADER internals, but call AC_CHECK_HEADERS_ONCE
ourselves.
* m4/search_h.m4 (gl_SEARCH_H): Likewise.
* m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
* m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_BODY): Likewise.
* m4/inttypes.m4 (gl_INTTYPES_H): Likewise, for gt_INTTYPES_PRI
internals.
* m4/wchar.m4 (gl_WCHAR_H): Skip followup test if header is
missing.
Suggested by Bruno Haible.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Thu, 31 Dec 2009 16:20:15 -0700 |
parents | 96af7c990143 |
children | 17d0fb5eeeeb |
files | ChangeLog m4/inttypes.m4 m4/netdb_h.m4 m4/search_h.m4 m4/sys_select_h.m4 m4/sys_time_h.m4 m4/wchar.m4 |
diffstat | 7 files changed, 43 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2010-01-01 Eric Blake <ebb9@byu.net> + + headers: make check of system header explicit + * m4/netdb_h.m4 (gl_HEADER_NETDB): Don't exploit knowledge of + gl_CHECK_NEXT_HEADER internals, but call AC_CHECK_HEADERS_ONCE + ourselves. + * m4/search_h.m4 (gl_SEARCH_H): Likewise. + * m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise. + * m4/sys_time_h.m4 (gl_HEADER_SYS_TIME_H_BODY): Likewise. + * m4/inttypes.m4 (gl_INTTYPES_H): Likewise, for gt_INTTYPES_PRI + internals. + * m4/wchar.m4 (gl_WCHAR_H): Skip followup test if header is + missing. + Suggested by Bruno Haible. + 2010-01-01 Jim Meyering <meyering@redhat.com> ChangeLog: tweak to eliminate unnecessary copyright line
--- a/m4/inttypes.m4 +++ b/m4/inttypes.m4 @@ -1,4 +1,4 @@ -# inttypes.m4 serial 15 +# inttypes.m4 serial 16 dnl Copyright (C) 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, @@ -11,6 +11,7 @@ [ AC_REQUIRE([gl_STDINT_H]) AC_REQUIRE([gt_INTTYPES_PRI]) + AC_CHECK_HEADERS_ONCE([inttypes.h]) AC_CHECK_DECLS_ONCE([imaxabs]) AC_CHECK_DECLS_ONCE([imaxdiv]) AC_CHECK_DECLS_ONCE([strtoimax])
--- a/m4/netdb_h.m4 +++ b/m4/netdb_h.m4 @@ -1,4 +1,4 @@ -# netdb_h.m4 serial 5 +# netdb_h.m4 serial 6 dnl Copyright (C) 2008, 2009, 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, @@ -7,6 +7,7 @@ AC_DEFUN([gl_HEADER_NETDB], [ AC_REQUIRE([gl_NETDB_H_DEFAULTS]) + AC_CHECK_HEADERS_ONCE([netdb.h]) gl_CHECK_NEXT_HEADERS([netdb.h]) if test $ac_cv_header_netdb_h = yes; then AC_COMPILE_IFELSE(
--- a/m4/search_h.m4 +++ b/m4/search_h.m4 @@ -1,4 +1,4 @@ -# search_h.m4 serial 3 +# search_h.m4 serial 4 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, @@ -7,6 +7,7 @@ AC_DEFUN([gl_SEARCH_H], [ AC_REQUIRE([gl_SEARCH_H_DEFAULTS]) + AC_CHECK_HEADERS_ONCE([search.h]) gl_CHECK_NEXT_HEADERS([search.h]) if test $ac_cv_header_search_h = yes; then HAVE_SEARCH_H=1
--- a/m4/sys_select_h.m4 +++ b/m4/sys_select_h.m4 @@ -1,4 +1,4 @@ -# sys_select_h.m4 serial 9 +# sys_select_h.m4 serial 10 dnl Copyright (C) 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, @@ -45,6 +45,7 @@ ]) fi ]) + AC_CHECK_HEADERS_ONCE([sys/select.h]) gl_CHECK_NEXT_HEADERS([sys/select.h]) if test $ac_cv_header_sys_select_h = yes; then HAVE_SYS_SELECT_H=1
--- a/m4/sys_time_h.m4 +++ b/m4/sys_time_h.m4 @@ -1,4 +1,5 @@ # Configure a replacement for <sys/time.h>. +# serial 2 # Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -18,6 +19,7 @@ AC_DEFUN([gl_HEADER_SYS_TIME_H_BODY], [ AC_REQUIRE([AC_C_RESTRICT]) + AC_CHECK_HEADERS_ONCE([sys/time.h]) gl_CHECK_NEXT_HEADERS([sys/time.h]) if test $ac_cv_header_sys_time_h = yes; then
--- a/m4/wchar.m4 +++ b/m4/wchar.m4 @@ -7,18 +7,30 @@ dnl Written by Eric Blake. -# wchar.m4 serial 28 +# wchar.m4 serial 29 AC_DEFUN([gl_WCHAR_H], [ AC_REQUIRE([gl_WCHAR_H_DEFAULTS]) AC_REQUIRE([gl_WCHAR_H_INLINE_OK]) - AC_CACHE_CHECK([whether <wchar.h> is standalone], - [gl_cv_header_wchar_h_standalone], - [AC_COMPILE_IFELSE([[#include <wchar.h> + dnl Prepare for creating substitute <wchar.h>. + dnl Check for <wchar.h> (missing in Linux uClibc when built without wide + dnl character support). + dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK. + AC_CHECK_HEADERS_ONCE([wchar.h]) + gl_CHECK_NEXT_HEADERS([wchar.h]) + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + AC_CACHE_CHECK([whether <wchar.h> is standalone], + [gl_cv_header_wchar_h_standalone], + [AC_COMPILE_IFELSE([[#include <wchar.h> wchar_t w;]], - [gl_cv_header_wchar_h_standalone=yes], - [gl_cv_header_wchar_h_standalone=no])]) + [gl_cv_header_wchar_h_standalone=yes], + [gl_cv_header_wchar_h_standalone=no])]) + else + HAVE_WCHAR_H=0 + fi + AC_SUBST([HAVE_WCHAR_H]) AC_REQUIRE([gt_TYPE_WINT_T]) if test $gt_cv_c_wint_t = yes; then @@ -27,20 +39,6 @@ HAVE_WINT_T=0 fi AC_SUBST([HAVE_WINT_T]) - - dnl Prepare for creating substitute <wchar.h>. - dnl Do it always: WCHAR_H may be empty here but can be set later. - dnl Check for <wchar.h> (missing in Linux uClibc when built without wide - dnl character support). - AC_CHECK_HEADERS_ONCE([wchar.h]) - if test $ac_cv_header_wchar_h = yes; then - HAVE_WCHAR_H=1 - else - HAVE_WCHAR_H=0 - fi - AC_SUBST([HAVE_WCHAR_H]) - dnl <wchar.h> is always overridden, because of GNULIB_POSIXCHECK. - gl_CHECK_NEXT_HEADERS([wchar.h]) ]) dnl Check whether <wchar.h> is usable at all.