Hi Paul, > * 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.
While doing this, you overlooked that the expansion of gl_CHECK_NEXT_HEADERS tests the ac_cv_header_... variable. So, for example, for <locale.h>, it now tests $ac_cv_header_locale_h, but this shell variable is never set. As a consequence, when I take a testdir of locale fcntl-h signal stdlib and compile it on Solaris 8 with Sun cc, I previously got these definitions: $ grep NEXT_ config.status S["NEXT_AS_FIRST_DIRECTIVE_WCHAR_H"]="\"///usr/include/wchar.h\"" S["NEXT_WCHAR_H"]="\"///usr/include/wchar.h\"" S["NEXT_AS_FIRST_DIRECTIVE_UNISTD_H"]="\"///usr/include/unistd.h\"" S["NEXT_UNISTD_H"]="\"///usr/include/unistd.h\"" S["NEXT_AS_FIRST_DIRECTIVE_STDLIB_H"]="\"///usr/include/stdlib.h\"" S["NEXT_STDLIB_H"]="\"///usr/include/stdlib.h\"" S["NEXT_AS_FIRST_DIRECTIVE_STDINT_H"]="<stdint.h>" S["NEXT_STDINT_H"]="<stdint.h>" S["NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H"]="\"///usr/include/signal.h\"" S["NEXT_SIGNAL_H"]="\"///usr/include/signal.h\"" S["NEXT_AS_FIRST_DIRECTIVE_LOCALE_H"]="\"///usr/include/locale.h\"" S["NEXT_LOCALE_H"]="\"///usr/include/locale.h\"" S["NEXT_AS_FIRST_DIRECTIVE_STDDEF_H"]="" S["NEXT_STDDEF_H"]="" S["NEXT_AS_FIRST_DIRECTIVE_FCNTL_H"]="\"///usr/include/fcntl.h\"" S["NEXT_FCNTL_H"]="\"///usr/include/fcntl.h\"" S["INCLUDE_NEXT_AS_FIRST_DIRECTIVE"]="include" and now I get $ grep NEXT_ config.status S["NEXT_AS_FIRST_DIRECTIVE_WCHAR_H"]="\"///usr/include/wchar.h\"" S["NEXT_WCHAR_H"]="\"///usr/include/wchar.h\"" S["NEXT_AS_FIRST_DIRECTIVE_UNISTD_H"]="\"///usr/include/unistd.h\"" S["NEXT_UNISTD_H"]="\"///usr/include/unistd.h\"" S["NEXT_AS_FIRST_DIRECTIVE_STDLIB_H"]="\"///usr/include/stdlib.h\"" S["NEXT_STDLIB_H"]="\"///usr/include/stdlib.h\"" S["NEXT_AS_FIRST_DIRECTIVE_STDINT_H"]="<stdint.h>" S["NEXT_STDINT_H"]="<stdint.h>" S["NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H"]="<signal.h>" S["NEXT_SIGNAL_H"]="<signal.h>" S["NEXT_AS_FIRST_DIRECTIVE_LOCALE_H"]="<locale.h>" S["NEXT_LOCALE_H"]="<locale.h>" S["NEXT_AS_FIRST_DIRECTIVE_STDDEF_H"]="" S["NEXT_STDDEF_H"]="" S["NEXT_AS_FIRST_DIRECTIVE_FCNTL_H"]="<fcntl.h>" S["NEXT_FCNTL_H"]="<fcntl.h>" S["INCLUDE_NEXT_AS_FIRST_DIRECTIVE"]="include" I'm committing this fix, which restores the previous behaviour, by eliminating the test of the ac_cv_header_... variable. 2011-01-20 Bruno Haible <[email protected]> include_next: Fix bug introduced on 2011-01-18. * m4/include_next.m4 (gl_NEXT_HEADERS_INTERNAL): New macro, extracted from gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS. Omit test of ac_cv_header_... variable if the second argument is not 'check'. (gl_CHECK_NEXT_HEADERS, gl_NEXT_HEADERS): Invoke gl_NEXT_HEADERS_INTERNAL. *** m4/include_next.m4.orig Thu Jan 20 11:18:25 2011 --- m4/include_next.m4 Thu Jan 20 11:15:10 2011 *************** *** 149,156 **** # 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 ...) --- 149,155 ---- # provides some type/enum definitions or function/variable declarations. AC_DEFUN([gl_CHECK_NEXT_HEADERS], [ ! gl_NEXT_HEADERS_INTERNAL([$1], [check]) ]) # gl_NEXT_HEADERS(HEADER1 HEADER2 ...) *************** *** 160,168 **** --- 159,177 ---- # and therefore can be assumed to exist. AC_DEFUN([gl_NEXT_HEADERS], [ + gl_NEXT_HEADERS_INTERNAL([$1], [assume]) + ]) + + # The guts of gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS. + AC_DEFUN([gl_NEXT_HEADERS_INTERNAL], + [ AC_REQUIRE([gl_INCLUDE_NEXT]) AC_REQUIRE([AC_CANONICAL_HOST]) + m4_if([$2], [check], + [AC_CHECK_HEADERS_ONCE([$1]) + ]) + m4_foreach_w([gl_HEADER_NAME], [$1], [AS_VAR_PUSHDEF([gl_next_header], [gl_cv_next_]m4_defn([gl_HEADER_NAME])) *************** *** 172,210 **** AC_CACHE_CHECK( [absolute name of <]m4_defn([gl_HEADER_NAME])[>], m4_defn([gl_next_header]), ! [AS_VAR_PUSHDEF([gl_header_exists], ! [ac_cv_header_]m4_defn([gl_HEADER_NAME])) ! if test AS_VAR_GET(gl_header_exists) = yes; then ! AC_LANG_CONFTEST( ! [AC_LANG_SOURCE( ! [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] ! )]) ! dnl AIX "xlc -E" and "cc -E" omit #line directives for header files ! dnl that contain only a #include of other header files and no ! dnl non-comment tokens of their own. This leads to a failure to ! dnl detect the absolute name of <dirent.h>, <signal.h>, <poll.h> ! dnl and others. The workaround is to force preservation of comments ! dnl through option -C. This ensures all necessary #line directives ! dnl are present. GCC supports option -C as well. ! case "$host_os" in ! aix*) gl_absname_cpp="$ac_cpp -C" ;; ! *) gl_absname_cpp="$ac_cpp" ;; ! esac ! dnl eval is necessary to expand gl_absname_cpp. ! dnl Ultrix and Pyramid sh refuse to redirect output of eval, ! dnl so use subshell. ! AS_VAR_SET([gl_next_header], ! ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | ! sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ ! s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# ! s#^/[^/]#//&# ! p ! q ! }'`'"']) ! else ! AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) ! fi ! AS_VAR_POPDEF([gl_header_exists])]) fi AC_SUBST( AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), --- 181,224 ---- AC_CACHE_CHECK( [absolute name of <]m4_defn([gl_HEADER_NAME])[>], m4_defn([gl_next_header]), ! [m4_if([$2], [check], ! [AS_VAR_PUSHDEF([gl_header_exists], ! [ac_cv_header_]m4_defn([gl_HEADER_NAME])) ! if test AS_VAR_GET(gl_header_exists) = yes; then ! AS_VAR_POPDEF([gl_header_exists]) ! ]) ! AC_LANG_CONFTEST( ! [AC_LANG_SOURCE( ! [[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]] ! )]) ! dnl AIX "xlc -E" and "cc -E" omit #line directives for header ! dnl files that contain only a #include of other header files and ! dnl no non-comment tokens of their own. This leads to a failure ! dnl to detect the absolute name of <dirent.h>, <signal.h>, ! dnl <poll.h> and others. The workaround is to force preservation ! dnl of comments through option -C. This ensures all necessary ! dnl #line directives are present. GCC supports option -C as well. ! case "$host_os" in ! aix*) gl_absname_cpp="$ac_cpp -C" ;; ! *) gl_absname_cpp="$ac_cpp" ;; ! esac ! dnl eval is necessary to expand gl_absname_cpp. ! dnl Ultrix and Pyramid sh refuse to redirect output of eval, ! dnl so use subshell. ! AS_VAR_SET([gl_next_header], ! ['"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | ! sed -n '\#/]m4_defn([gl_HEADER_NAME])[#{ ! s#.*"\(.*/]m4_defn([gl_HEADER_NAME])[\)".*#\1# ! s#^/[^/]#//&# ! p ! q ! }'`'"']) ! m4_if([$2], [check], ! [else ! AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) ! fi ! ]) ! ]) fi AC_SUBST( AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])),
