autoconf-patches
[Top][All Lists]
Advanced

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

[PATCH 09/12] use a shell function for AC_CHECK_TYPE


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

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

        * lib/autoconf/general.m4 (_AC_CHECK_TYPE_NEW): Use a shell function.
---
 lib/autoconf/types.m4 |   27 ++++++++++++++++++++-------
 1 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/lib/autoconf/types.m4 b/lib/autoconf/types.m4
index 0ab85a5..3acb988 100644
--- a/lib/autoconf/types.m4
+++ b/lib/autoconf/types.m4
@@ -146,20 +146,33 @@
 # C++ disallows defining types inside `sizeof ()', but that's OK,
 # since we don't want to consider unnamed structs to be types for C++,
 # precisely because they don't work in cases like that.
-m4_define([_AC_CHECK_TYPE_NEW],
-[AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
-AC_CACHE_CHECK([for $1], [ac_Type],
+AC_DEFUN([_AC_CHECK_TYPE_NEW],
+[AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_check_type],
+  [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_check_type],
+    [LINENO TYPE INCLUDES],
+    [Tests whether TYPE exists after having included INCLUDES, setting a
+     cache variable accordingly.])], [
+AS_LINENO_PUSH([$[]1])
+ac_type=[$]2
+ac_includes=[$]3
+AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$ac_type])dnl
+AC_CACHE_CHECK([for $ac_type], [ac_Type],
 [AS_VAR_SET([ac_Type], [no])
 AC_COMPILE_IFELSE(
-  [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
-     [if (sizeof ($1))
+  [AC_LANG_PROGRAM([$ac_includes],
+     [if (sizeof ($ac_type))
        return 0;])],
   [AC_COMPILE_IFELSE(
-     [AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT([$4])],
-       [if (sizeof (($1)))
+     [AC_LANG_PROGRAM([$ac_includes],
+       [if (sizeof (($ac_type)))
          return 0;])],
      [],
      [AS_VAR_SET([ac_Type], [yes])])])])
+AS_VAR_POPDEF([ac_Type])dnl
+AS_LINENO_POP
+])dnl
+ac_func_[]_AC_LANG_ABBREV[]_check_type "$LINENO" "$1" 
"AS_ESCAPE([AC_INCLUDES_DEFAULT([$4], ["])])"
+AS_VAR_PUSHDEF([ac_Type], [ac_cv_type_$1])dnl
 AS_VAR_IF([ac_Type], [yes], [$2], [$3])[]dnl
 AS_VAR_POPDEF([ac_Type])dnl
 ])# _AC_CHECK_TYPE_NEW
-- 
1.5.5





reply via email to

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