* lib/autoconf/headers.m4 (AC_CHECK_HEADERS_ONCE): Divide into a public
   macro that AC_REQUIREs _AC_INCLUDES_DEFAULT_REQUIREMENTS, and ...
   (_AC_CHECK_HEADERS_ONCE): ... a private macro, that doesn't.
   (_AC_HEADERS_EXPANSION): Use $ac_includes_default, not AC_INCLUDES_DEFAULT.
   (_AC_INCLUDES_DEFAULT_REQUIREMENTS): Use AC_CHECK_HEADERS_ONCE.
   (all of the above): Sprinkle dnl's around.

Signed-off-by: Zack Weinberg <za...@panix.com>
---
 lib/autoconf/headers.m4 |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index 6fe1380..8f2272a 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -203,14 +203,20 @@ _AC_HEADERS_EXPANSION])AC_REQUIRE([_AC_Header_]m4_translit([[$1]],
 # -------------------------------------
 # Add each whitespace-separated name in HEADER-FILE to the list of
 # headers to check once.
+# Note: has intimate knowledge of how AC_INCLUDES_DEFAULT works,
+# and vice versa.
+
 AC_DEFUN([AC_CHECK_HEADERS_ONCE],
+[AC_REQUIRE([_AC_INCLUDES_DEFAULT_REQUIREMENTS])dnl
+_AC_CHECK_HEADERS_ONCE([$1])])
+AC_DEFUN([_AC_CHECK_HEADERS_ONCE],
 [m4_map_args_w([$1], [_AC_CHECK_HEADER_ONCE(], [)])])
 
 m4_define([_AC_HEADERS_EXPANSION],
-[
-  m4_divert_text([DEFAULTS], [ac_header_list=])
-  AC_CHECK_HEADERS([$ac_header_list], [], [], [AC_INCLUDES_DEFAULT])
-  m4_define([_AC_HEADERS_EXPANSION], [])
+[dnl
+  m4_divert_text([DEFAULTS], [ac_header_list=])dnl
+  AC_CHECK_HEADERS([$ac_header_list], [], [], [$ac_includes_default])dnl
+  m4_define([_AC_HEADERS_EXPANSION], [])dnl
 ])
 
 
@@ -255,19 +261,19 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 ])dnl
-AC_CHECK_HEADERS([sys/types.h sys/stat.h strings.h inttypes.h stdint.h unistd.h],
-                 [], [], [$ac_includes_default])
+_AC_CHECK_HEADERS_ONCE([sys/types.h sys/stat.h strings.h inttypes.h stdint.h
+                        unistd.h])dnl
 dnl For backward compatibility, provide unconditional AC_DEFINEs of
 dnl HAVE_STDLIB_H, HAVE_STRING_H, and STDC_HEADERS.
 AC_DEFINE(HAVE_STDLIB_H, 1,
   [Always define to 1, for backward compatibility.
-   You can assume <stdlib.h> exists.])
+   You can assume <stdlib.h> exists.])dnl
 AC_DEFINE(HAVE_STRING_H, 1,
   [Always define to 1, for backward compatibility.
-   You can assume <string.h> exists.])
+   You can assume <string.h> exists.])dnl
 AC_DEFINE(STDC_HEADERS, 1,
   [Always define to 1, for backward compatibility.
-   You can assume the C90 standard headers exist.])
+   You can assume the C90 standard headers exist.])dnl
 ])# _AC_INCLUDES_DEFAULT_REQUIREMENTS
 
 

Reply via email to