[PATCH 4/6] Use AC_CHECK_HEADERS_ONCE for the tests done by AC_INCLUDES_DEFAULT.

Zack Weinberg <[email protected]>
Newsgroups gmane.comp.sysutils.autoconf.patches
Message-ID <bb955d4b9c9547f2afceb579731bd21d31ae4fcb.1379280620.git.zackw@panix.com>
 * 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.

Signed-off-by: Zack Weinberg <[email protected]>
---
 lib/autoconf/headers.m4 |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
0004-Use-AC_CHECK_HEADERS_ONCE-for-the-tests-done-by-AC_I.patch (text/x-patch, 1.3 KB)
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index 634cf45..eb3aec8 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -204,14 +204,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
 ])
 
 
@@ -256,7 +262,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 ])]dnl
-[AC_CHECK_HEADERS(
+[_AC_CHECK_HEADERS_ONCE(
   [sys/types.h sys/stat.h strings.h inttypes.h stdint.h unistd.h],
   [], [], [$ac_includes_default])]dnl
 dnl For backward compatibility, provide unconditional AC_DEFINEs of
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.