From: Paolo Bonzini Date: Mon, 20 Oct 2008 13:35:32 +0000 (+0200) Subject: Use a shell function for _AC_CHECK_HEADER_MONGREL. X-Git-Tag: v2.63b~193 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57079f4e33bf6140172a31820c9eb33e07de2de3;p=thirdparty%2Fautoconf.git Use a shell function for _AC_CHECK_HEADER_MONGREL. * lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL_BODY): New macro. (_AC_CHECK_HEADER_MONGREL): Use a shell function. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index dab6a6eaf..85088e531 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2008-10-25 Paolo Bonzini + and Eric Blake + + Use a shell function for _AC_CHECK_HEADER_MONGREL. + * lib/autoconf/headers.m4 (_AC_CHECK_HEADER_MONGREL_BODY): New + macro. + (_AC_CHECK_HEADER_MONGREL): Use a shell function. + 2008-10-25 Eric Blake Simplify _AS_PREPARE handling of functions. diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4 index 413be8c15..4c588caab 100644 --- a/lib/autoconf/headers.m4 +++ b/lib/autoconf/headers.m4 @@ -94,60 +94,75 @@ AC_DEFUN([AC_CHECK_HEADER], ])# AC_CHECK_HEADER -# _AC_CHECK_HEADER_MONGREL(HEADER-FILE, -# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], -# [INCLUDES = DEFAULT-INCLUDES]) -# ------------------------------------------------------------------ -# Check using both the compiler and the preprocessor. If they disagree, -# warn, and the preproc wins. -# -# This is not based on _AC_CHECK_HEADER_NEW and _AC_CHECK_HEADER_OLD -# because it obfuscate the code to try to factor everything, in particular -# because of the cache variables, and the `checking...' messages. -m4_define([_AC_CHECK_HEADER_MONGREL], -[AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl -AS_VAR_SET_IF([ac_Header], - [AC_CACHE_CHECK([for $1], [ac_Header], [])], - [# Is the header compilable? -AC_MSG_CHECKING([$1 usability]) -AC_COMPILE_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT([$4]) -@%:@include <$1>])], +# _AC_CHECK_HEADER_MONGREL_BODY +# ----------------------------- +# Shell function body for _AC_CHECK_HEADER_MONGREL +m4_define([_AC_CHECK_HEADER_MONGREL_BODY], +[ AS_LINENO_PUSH([$[]1]) + AS_VAR_SET_IF([$[]3], + [AC_CACHE_CHECK([for $[]2], [$[]3], [])], + [# Is the header compilable? +AC_MSG_CHECKING([$[]2 usability]) +AC_COMPILE_IFELSE([AC_LANG_SOURCE([$[]4 +@%:@include <$[]2>])], [ac_header_compiler=yes], [ac_header_compiler=no]) AC_MSG_RESULT([$ac_header_compiler]) # Is the header present? -AC_MSG_CHECKING([$1 presence]) -AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include <$1>])], +AC_MSG_CHECKING([$[]2 presence]) +AC_PREPROC_IFELSE([AC_LANG_SOURCE([@%:@include <$[]2>])], [ac_header_preproc=yes], [ac_header_preproc=no]) AC_MSG_RESULT([$ac_header_preproc]) # So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in +case $ac_header_compiler:$ac_header_preproc:$ac_[]_AC_LANG_ABBREV[]_preproc_warn_flag in #(( yes:no: ) - AC_MSG_WARN([$1: accepted by the compiler, rejected by the preprocessor!]) - AC_MSG_WARN([$1: proceeding with the compiler's result]) + AC_MSG_WARN([$[]2: accepted by the compiler, rejected by the preprocessor!]) + AC_MSG_WARN([$[]2: proceeding with the compiler's result]) ac_header_preproc=yes ;; no:yes:* ) - AC_MSG_WARN([$1: present but cannot be compiled]) - AC_MSG_WARN([$1: check for missing prerequisite headers?]) - AC_MSG_WARN([$1: see the Autoconf documentation]) - AC_MSG_WARN([$1: section "Present But Cannot Be Compiled"]) - AC_MSG_WARN([$1: proceeding with the preprocessor's result]) - AC_MSG_WARN([$1: in the future, the compiler will take precedence]) - m4_ifset([AC_PACKAGE_BUGREPORT], - [( AS_BOX([Report this to ]AC_PACKAGE_BUGREPORT) - ) | sed "s/^/$as_me: WARNING: /" >&2]) + AC_MSG_WARN([$[]2: present but cannot be compiled]) + AC_MSG_WARN([$[]2: check for missing prerequisite headers?]) + AC_MSG_WARN([$[]2: see the Autoconf documentation]) + AC_MSG_WARN([$[]2: section "Present But Cannot Be Compiled"]) + AC_MSG_WARN([$[]2: proceeding with the preprocessor's result]) + AC_MSG_WARN([$[]2: in the future, the compiler will take precedence]) +m4_ifset([AC_PACKAGE_BUGREPORT], +[m4_n([( AS_BOX([Report this to ]AC_PACKAGE_BUGREPORT) + ) | sed "s/^/$as_me: WARNING: /" >&2])])dnl ;; esac -AC_CACHE_CHECK([for $1], [ac_Header], - [AS_VAR_SET([ac_Header], [$ac_header_preproc])])[]dnl -]) + AC_CACHE_CHECK([for $[]2], [$[]3], + [AS_VAR_SET([$[]3], [$ac_header_preproc])])]) + AS_LINENO_POP +])#_AC_CHECK_HEADER_MONGREL_BODY + +# _AC_CHECK_HEADER_MONGREL(HEADER-FILE, +# [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], +# [INCLUDES = DEFAULT-INCLUDES]) +# ------------------------------------------------------------------ +# Check using both the compiler and the preprocessor. If they disagree, +# warn, and the preproc wins. +# +# This is not based on _AC_CHECK_HEADER_NEW and _AC_CHECK_HEADER_OLD +# because it obfuscate the code to try to factor everything, in particular +# because of the cache variables, and the `checking...' messages. +m4_define([_AC_CHECK_HEADER_MONGREL], +[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_check_header_mongrel], + [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_check_header_mongrel], + [LINENO FUNC VAR INCLUDES], + [Tests whether HEADER exists, giving a warning if it cannot be compiled + using the include files in INCLUDES and setting the cache variable VAR + accordingly.])], + [$0_BODY])]dnl +[AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])]dnl +[ac_func_[]_AC_LANG_ABBREV[]_check_header_mongrel ]dnl +["$LINENO" "$1" "ac_Header" "AS_ESCAPE([AC_INCLUDES_DEFAULT([$4], [""])])" AS_VAR_IF([ac_Header], [yes], [$2], [$3]) -AS_VAR_POPDEF([ac_Header])dnl -])# _AC_CHECK_HEADER_MONGREL +AS_VAR_POPDEF([ac_Header])])# _AC_CHECK_HEADER_MONGREL # _AC_CHECK_HEADER_NEW(HEADER-FILE,