autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 06/12] use a shell function for _AC_CHECK_HEADER_MONGREL


From: Paolo Bonzini
Subject: [PATCH 06/12] use a shell function for _AC_CHECK_HEADER_MONGREL
Date: Mon, 20 Oct 2008 15:35:32 +0200

I split AC_CHECK_HEADER functionization in two patches.  Here is the
first.

2008-10-12  Paolo Bonzini  <address@hidden>

        * lib/autoconf/general.m4 (_AC_CHECK_HEADER_MONGREL): Use a shell
        function.
---
 lib/autoconf/headers.m4 |   48 +++++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index 16b2737..7687393 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -103,47 +103,59 @@ AC_DEFUN([AC_CHECK_HEADER],
 # 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
+[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 INCLUDES],
+    [Tests whether HEADER exists, giving a warning if it cannot be compiled
+     using the include files in INCLUDES and setting a cache variable 
accordingly.])], [
+AS_LINENO_PUSH([$[]1])
+ac_header=[$]2
+ac_includes=[$]3
+AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$ac_header])dnl
 AS_VAR_SET_IF([ac_Header],
-             [AC_CACHE_CHECK([for $1], [ac_Header], [])],
+             [AC_CACHE_CHECK([for $ac_header], [ac_Header], [])],
              [# Is the header compilable?
-AC_MSG_CHECKING([$1 usability])
-AC_COMPILE_IFELSE([AC_LANG_SOURCE([AC_INCLUDES_DEFAULT([$4])
address@hidden:@include <$1>])],
+AC_MSG_CHECKING([$ac_header usability])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([$ac_includes
address@hidden:@include <$ac_header>])],
                  [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(address@hidden:@include <$1>])],
+AC_MSG_CHECKING([$ac_header presence])
+AC_PREPROC_IFELSE([AC_LANG_SOURCE(address@hidden:@include <$ac_header>])],
                  [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([$ac_header: accepted by the compiler, rejected by the 
preprocessor!])
+    AC_MSG_WARN([$ac_header: 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])
+    AC_MSG_WARN([$ac_header: present but cannot be compiled])
+    AC_MSG_WARN([$ac_header:     check for missing prerequisite headers?])
+    AC_MSG_WARN([$ac_header: see the Autoconf documentation])
+    AC_MSG_WARN([$ac_header:     section "Present But Cannot Be Compiled"])
+    AC_MSG_WARN([$ac_header: proceeding with the preprocessor's result])
+    AC_MSG_WARN([$ac_header: 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])
     ;;
 esac
-AC_CACHE_CHECK([for $1], [ac_Header],
+AC_CACHE_CHECK([for $ac_header], [ac_Header],
               [AS_VAR_SET([ac_Header], [$ac_header_preproc])])
 ])dnl ! set ac_HEADER
-AS_VAR_IF([ac_Header], [yes], [$2], [$3])[]dnl
+AS_LINENO_POP
+])dnl
+ac_func_[]_AC_LANG_ABBREV[]_check_header_mongrel "$LINENO" "$1" 
"AS_ESCAPE([AC_INCLUDES_DEFAULT([$4], ["])])"
+AS_VAR_PUSHDEF([ac_Header], [ac_cv_header_$1])dnl
+AS_VAR_IF([ac_Header], [yes], [$2], [$3])dnl
 AS_VAR_POPDEF([ac_Header])dnl
 ])# _AC_CHECK_HEADER_MONGREL
 
-- 
1.5.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]