bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] include_next: do not check for standard headers like stddef.h


From: Paul Eggert
Subject: [PATCH] include_next: do not check for standard headers like stddef.h
Date: Tue, 18 Jan 2011 22:40:01 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

I found this problem when modifying Emacs to use gnulib.
I noticed that it added HAVE_STDDEF_H to config.h, even though
gnulib always assumes <stddef.h> exists as per README and this
symbol is unnecessary.
* m4/include_next.m4 (gl_NEXT_HEADERS): New macro, which does not
use AC_CHECK_HEADERS_ONCE, but which otherwise contains what
gl_CHECK_NEXT_HEADERS used to contain.  This makes 'configure' run
faster for headers like stddef.h that are known to exist.
(gl_CHECK_NEXT_HEADERS): Use it.
* m4/float_h.m4 (gl_FLOAT_H): For float.h, use gl_NEXT_HEADERS
rather than gl_CHECK_NEXT_HEADERS.
* m4/stdarg.m4 (gl_STDARG_H): Likewise, for stdarg.h.
* m4/stddef_h.m4 (gl_STDDEF_H): Likewise, for stddef.h.
---
 ChangeLog          |   18 ++++++++++++++++++
 m4/float_h.m4      |    4 ++--
 m4/include_next.m4 |   14 ++++++++++++--
 m4/stdarg.m4       |    4 ++--
 m4/stddef_h.m4     |    4 ++--
 5 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9188fb7..a210b20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2011-01-18  Paul Eggert  <address@hidden>
+
+       include_next: do not check for standard headers like stddef.h
+
+       I found this problem when modifying Emacs to use gnulib.
+       I noticed that it added HAVE_STDDEF_H to config.h, even though
+       gnulib always assumes <stddef.h> exists as per README and this
+       symbol is unnecessary.
+       * m4/include_next.m4 (gl_NEXT_HEADERS): New macro, which does not
+       use AC_CHECK_HEADERS_ONCE, but which otherwise contains what
+       gl_CHECK_NEXT_HEADERS used to contain.  This makes 'configure' run
+       faster for headers like stddef.h that are known to exist.
+       (gl_CHECK_NEXT_HEADERS): Use it.
+       * m4/float_h.m4 (gl_FLOAT_H): For float.h, use gl_NEXT_HEADERS
+       rather than gl_CHECK_NEXT_HEADERS.
+       * m4/stdarg.m4 (gl_STDARG_H): Likewise, for stdarg.h.
+       * m4/stddef_h.m4 (gl_STDDEF_H): Likewise, for stddef.h.
+
 2011-01-18  Eric Blake  <address@hidden>
 
        ansi-c++-opt: skip C++ dependency style if C++ is unused
diff --git a/m4/float_h.m4 b/m4/float_h.m4
index 7f19434..265a4c1 100644
--- a/m4/float_h.m4
+++ b/m4/float_h.m4
@@ -1,4 +1,4 @@
-# float_h.m4 serial 4
+# float_h.m4 serial 5
 dnl Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,7 +12,7 @@ AC_DEFUN([gl_FLOAT_H],
   case "$host_os" in
     beos* | openbsd* | mirbsd*)
       FLOAT_H=float.h
-      gl_CHECK_NEXT_HEADERS([float.h])
+      gl_NEXT_HEADERS([float.h])
       ;;
   esac
   AC_SUBST([FLOAT_H])
diff --git a/m4/include_next.m4 b/m4/include_next.m4
index ed05e1d..4f1cd6d 100644
--- a/m4/include_next.m4
+++ b/m4/include_next.m4
@@ -1,4 +1,4 @@
-# include_next.m4 serial 16
+# include_next.m4 serial 17
 dnl Copyright (C) 2006-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -149,9 +149,19 @@ choke me
 # provides some type/enum definitions or function/variable declarations.
 AC_DEFUN([gl_CHECK_NEXT_HEADERS],
 [
+  AC_CHECK_HEADERS_ONCE([$1])
+  gl_NEXT_HEADERS([$1])
+])
+
+# gl_NEXT_HEADERS(HEADER1 HEADER2 ...)
+# ------------------------------------
+# Like gl_CHECK_NEXT_HEADERS, except do not check whether the headers exist.
+# This is suitable for headers like <stddef.h> that are standardized by C89
+# and therefore can be assumed to exist.
+AC_DEFUN([gl_NEXT_HEADERS],
+[
   AC_REQUIRE([gl_INCLUDE_NEXT])
   AC_REQUIRE([AC_CANONICAL_HOST])
-  AC_CHECK_HEADERS_ONCE([$1])
 
   m4_foreach_w([gl_HEADER_NAME], [$1],
     [AS_VAR_PUSHDEF([gl_next_header],
diff --git a/m4/stdarg.m4 b/m4/stdarg.m4
index 02d73be..a1ef178 100644
--- a/m4/stdarg.m4
+++ b/m4/stdarg.m4
@@ -1,4 +1,4 @@
-# stdarg.m4 serial 4
+# stdarg.m4 serial 5
 dnl Copyright (C) 2006, 2008-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -41,7 +41,7 @@ void (*func) (va_list, va_list) = va_copy;
     if test $gl_aixcc = yes; then
       dnl Provide a substitute <stdarg.h> file.
       STDARG_H=stdarg.h
-      gl_CHECK_NEXT_HEADERS([stdarg.h])
+      gl_NEXT_HEADERS([stdarg.h])
       dnl Fallback for the case when <stdarg.h> contains only macro 
definitions.
       if test "$gl_cv_next_stdarg_h" = '""'; then
         gl_cv_next_stdarg_h='"///usr/include/stdarg.h"'
diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4
index 3a5ecc5..1942b6a 100644
--- a/m4/stddef_h.m4
+++ b/m4/stddef_h.m4
@@ -1,5 +1,5 @@
 dnl A placeholder for POSIX 2008 <stddef.h>, for platforms that have issues.
-# stddef_h.m4 serial 2
+# stddef_h.m4 serial 3
 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -25,7 +25,7 @@ AC_DEFUN([gl_STDDEF_H],
     STDDEF_H=stddef.h
   fi
   if test -n "$STDDEF_H"; then
-    gl_CHECK_NEXT_HEADERS([stddef.h])
+    gl_NEXT_HEADERS([stddef.h])
   fi
 ])
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]