bug-gnulib
[Top][All Lists]
Advanced

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

Re: use of AC_TRY_EVAL broken


From: Eric Blake
Subject: Re: use of AC_TRY_EVAL broken
Date: Sat, 01 Nov 2008 11:09:48 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 10/24/2008 3:28 PM:
> Ralf Wildenhues wrote:
>> a suggestion for a new name: AC_EVAL_IFELSE.
> 
> There's actually two cases to consider, if you want to make it easy to use
> for the developer:
>   - the case of a command that should be executed and logged,
>   - the case of a variable that contains a command that should be executed and
>     logged,
> 
> If the second one is AC_EVAL_IFELSE, what would be the name of the first one
> (without EVAL)?

The old (undocumented and unsafe) names are AC_TRY_EVAL and
AC_TRY_COMMAND.  Internally, the safe variants forward to either
_AC_DO_VAR(cmd) (expands to eval $cmd) or _AC_DO_TOKENS($cmd blah)
(equivalent to running $cmd blah).

One other thing to point out is that it AC_COMPILE_IFELSE and friends have
a (currently undocumented) feature that if the first argument is empty,
then it compiles the program previously built by AC_LANG_CONFTEST, and the
user is responsible for calling 'rm -f conftest.$ac_ext' after the macro
ends (hmm, we need to wrap that cleanup in a macro, rather than exposing
$ac_ext).  But that means you can build a program once, then pass it
through several compile attempts, which seems like it was one of the use
cases driving this conversation (for example, see my proposed patch for
AC_CHECK_TYPE,
http://thread.gmane.org/gmane.comp.sysutils.autoconf.patches/6073/focus=6169)

What if we create and document the following macro names:

AC_COMMAND_IFELSE(command with args, if-true, if-false)
AC_EVAL_IFELSE(variable, if-true, if-false)

where AC_EVAL_IFELSE([variable]) is shorthand for AC_COMMAND_IFELSE([eval
"$variable"])?  Does that solve the immediate need?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkMjVwACgkQ84KuGfSFAYDpqACeL3kV8L1A5tdWE2GC0sRDOnbp
NVUAoMB2hIZx3PlP3mbWZ2rA4R7hkjd8
=x8M4
-----END PGP SIGNATURE-----




reply via email to

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