[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Faster AC_CHECK_{HEADERS,FUNCS}
From: |
Paolo Bonzini |
Subject: |
Re: Faster AC_CHECK_{HEADERS,FUNCS} |
Date: |
Fri, 14 Nov 2008 08:59:31 +0100 |
User-agent: |
Thunderbird 2.0.0.17 (Macintosh/20080914) |
Eric Blake wrote:
> It is amazing how often people use AC_CHECK_{HEADERS,FUNCS} with a single
> argument (because it provides an automatic AC_DEFINE not present with with
> singular version). This low-hanging fruit makes autoconf run slightly
> faster,
> shaves off 10k of coreutils' configure size, and produces 4 fewer forks per
> single-argument loop in the output file; an all-around win. I intentinally
> left the for loop still in place in the shell, so as not to cripple any
> existing users where ACTION-IF-PASS or ACTION-IF-FAIL used break or the
> undocumented $ac_{header,func}. I'm pushing this now.
>
> From: Eric Blake <address@hidden>
> Date: Thu, 13 Nov 2008 14:02:51 -0700
> Subject: [PATCH] Optimize single-argument loop.
>
> * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Avoid forks when
> loop only has one argument.
> * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Likewise.
>
> Signed-off-by: Eric Blake <address@hidden>
> ---
> ChangeLog | 7 +++++++
> lib/autoconf/functions.m4 | 8 +++++---
> lib/autoconf/headers.m4 | 8 +++++---
> 3 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/ChangeLog b/ChangeLog
> index 3e9a701..31dd4f2 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,5 +1,12 @@
> 2008-11-13 Eric Blake <address@hidden>
>
> + Optimize single-argument loop.
> + * lib/autoconf/functions.m4 (AC_CHECK_FUNCS): Avoid forks when
> + loop only has one argument.
> + * lib/autoconf/headers.m4 (AC_CHECK_HEADERS): Likewise.
> +
> +2008-11-13 Eric Blake <address@hidden>
> +
> Fix AS_ESCAPE usage bugs.
> * lib/m4sugar/m4sh.m4 (_AS_VAR_APPEND_PREPARE)
> (_AS_VAR_ARITH_PREPARE): Expand macros prior to adding shell
> diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4
> index 23c6348..da39fb1 100644
> --- a/lib/autoconf/functions.m4
> +++ b/lib/autoconf/functions.m4
> @@ -108,13 +108,15 @@ m4_define([_AH_CHECK_FUNC],
> # `break' to stop the search.
> AC_DEFUN([AC_CHECK_FUNCS],
> [m4_map_args_w([$1], [_AH_CHECK_FUNC(], [)])]dnl
> +[m4_pushdef([AC_func], m4_if(m4_index(m4_translit([$1], [ ][
> +$`], [ ]), [ ]), [-1], [[$1]], [[$ac_func]]))]dnl
Maybe a
m4_defun([AS_FOREACH], [
[m4_pushdef([_AS_VAR_$1], m4_quote(m4_tolower([$1]))
m4_pushdef([$1], m4_if(m4_index(m4_translit([$2], [ ][
$`], [ ]), [ ]), [-1], [[$2]], [[$_AS_VAR_$1])]]))]dnl
for _AS_VAR_$1] in $2; do
$3
done
_m4_popdef([_AS_VAR_$1])
could help (untested and probably wrong)? Also, could you factor the
m4_index(m4_translit(...)) to a m4_strbrk macro?
Paolo