autoconf-patches
[Top][All Lists]
Advanced

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

Re: m4_defun_init


From: Ralf Wildenhues
Subject: Re: m4_defun_init
Date: Sat, 25 Oct 2008 11:11:05 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hi Eric,

* Eric Blake wrote on Fri, Oct 24, 2008 at 10:14:36PM CEST:
> > > I will probably do another followup for autoconf macros that do one-shot
> > > initialization (think _AC_*_IFELSE, for starters), for even more speedup.
> > 
> > Phooey.  _AC_*_IFELSE aren't currently one-shot (when you use multiple 
> > languages, they create multiple ac_func_*_try_* shell functions across 
> separate 
> > invocations).  But maybe AC_LANG_PUSH could be made to help out, by copying 
> the 
> > basic _AC_*_IFELSE implementation as part of AC_LANG(lang), so that each 
> > language gets its own one-shot initializer copy.  I'm still playing with 
> > it...
> 
> This works for creating multiple one-shot macros, one for each language.  
> However, run times before and after this patch are about the same (no huge 
> speedup), so I'm not sure I want to apply it.

FWIW, I'm not so sure either:

> --- a/lib/autoconf/c.m4
> +++ b/lib/autoconf/c.m4
> @@ -81,6 +81,7 @@
>  # AC_LANG(C)
>  # ----------
>  # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
> +_AC_LANG_PREP([C])
>  m4_define([AC_LANG(C)],

This does look a bit like making the code more prone to errors.

> -AC_DEFUN([_AC_PREPROC_IFELSE],
> +m4_defun_init([_AC_PREPROC_IFELSE()],
>  [AC_REQUIRE_SHELL_FN([ac_func_]_AC_LANG_ABBREV[_try_cpp],
>    [AS_FUNCTION_DESCRIBE([ac_func_]_AC_LANG_ABBREV[_try_cpp], [LINENO],
>      [Try to preprocess conftest.$ac_ext, and return whether this 
> succeeded.])],
> -  [$0_BODY])]dnl
> +  [_AC_PREPROC_IFELSE_BODY])],
>  [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])]dnl
>  [AS_IF([ac_func_[]_AC_LANG_ABBREV[]_try_cpp "$LINENO"], [$2], [$3])
>  rm -f conftest.err[]m4_ifval([$1], [ conftest.$ac_ext])[]dnl
> -])# _AC_PREPROC_IFELSE
> +])# _AC_PREPROC_IFELSE()
> +
> +# _AC_PREPROC_IFELSE(PROGRAM, [ACTION-IF-TRUE], [ACTION-IF-FALSE])
> +# ----------------------------------------------------------------
> +# Try to preprocess PROGRAM.  Defer to the language-specific copy.
> +m4_define([_AC_PREPROC_IFELSE],
> +[m4_indir([$0(]_AC_LANG[)], $@)])

Doesn't changing _AC_PREPROC_IFELSE from AC_DEFUN to m4_define have
impact upon the location for expansions of AC_REQUIRE calls within the
arguments of _AC_PREPROC_IFELSE?

Likewise for all the other macros that underwent this transformation,
in this and the other patch(es?).

Anyway, this bit, and the bit about fatal errors printing the location,
would be good to have covered in the testsuite (haven't checked if they
are already, sorry).

Cheers,
Ralf




reply via email to

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