[PATCH 3/3] 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 <c8ddafdf27dd54649114256b46bf0ea1010813fb.1378521830.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.
   (all of the above): Sprinkle dnl's around.

Signed-off-by: Zack Weinberg <[email protected]>
---
 lib/autoconf/headers.m4 |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)
0003-Use-AC_CHECK_HEADERS_ONCE-for-the-tests-done-by-AC_I.patch (text/x-patch, 2 KB)
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
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.