[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 06/12] use a shell function for _AC_CHECK_HEADER_MONGREL
From: |
Eric Blake |
Subject: |
Re: [PATCH 06/12] use a shell function for _AC_CHECK_HEADER_MONGREL |
Date: |
Fri, 24 Oct 2008 22:22:37 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Paolo Bonzini <bonzini <at> gnu.org> writes:
>
> I split AC_CHECK_HEADER functionization in two patches. Here is the
> first.
>
> 2008-10-12 Paolo Bonzini <bonzini <at> gnu.org>
>
> * lib/autoconf/general.m4 (_AC_CHECK_HEADER_MONGREL): Use a shell
> function.
> +[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],
I'm going to repeat my trick from AC_CHECK_FUNC in passing the cache variable
name as an extra argument, so we don't need the AS_VAR_PUSHDEF in the function
body.
> + [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
Additionally, I don't like this - AC_CHECK_HEADERS invokes a shell for loop on
the variable ac_header, which it then reads after the expansion of
AC_CHECK_HEADER has executed; but here you are assigning into it (fortunately,
you are reassigning the value it already had). But what's wrong with using
$[]2 instead of $ac_header?
Meanwhile, before I actually work on this patch, I noticed a small optimization
that I will be applying soon:
diff --git a/ChangeLog b/ChangeLog
index 61b5f33..a485066 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-24 Eric Blake <address@hidden>
+
+ Speed up AC_CHECK_HEADER.
+ * lib/autoconf/headers.m4 (AC_CHECK_HEADER): Factor out address@hidden
+
2008-10-24 Paolo Bonzini <address@hidden>
and Eric Blake <address@hidden>
diff --git a/lib/autoconf/headers.m4 b/lib/autoconf/headers.m4
index 4012107..413be8c 100644
--- a/lib/autoconf/headers.m4
+++ b/lib/autoconf/headers.m4
@@ -84,11 +84,13 @@
#
# If INCLUDES is specified and different from `-', then use the new
# semantics only.
+#
+# The m4_indir allows for fewer expansions of address@hidden
AC_DEFUN([AC_CHECK_HEADER],
-[m4_case([$4],
- [], [_AC_CHECK_HEADER_MONGREL($@)],
- [-], [_AC_CHECK_HEADER_OLD($@)],
- [_AC_CHECK_HEADER_NEW($@)])
+[m4_indir(m4_case([$4],
+ [], [[_AC_CHECK_HEADER_MONGREL]],
+ [-], [[_AC_CHECK_HEADER_OLD]],
+ [[_AC_CHECK_HEADER_NEW]]), $@)
])# AC_CHECK_HEADER