[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AS_VAR_IF and the resulting shell code
From: |
Ralf Wildenhues |
Subject: |
Re: AS_VAR_IF and the resulting shell code |
Date: |
Fri, 16 Oct 2009 19:28:51 +0200 |
User-agent: |
Mutt/1.5.20 (2009-08-09) |
Hello,
* NightStrike wrote on Fri, Oct 16, 2009 at 06:45:57PM CEST:
> xx=yes
> AS_VAR_IF([xx],[yes],[echo equal],[echo not equal])
> results in this:
>
> xx=yes
> if test "x$xx" = x""yes; then
> echo equal
> else
> echo not equal
> fi
> with autoconf 2.63.
>
> How come the right hand side of the test is x""yes, as in, with two
> double quotes between the x and the yes? Why isn't it just "xyes", or
> just xyesy?
It's not "xyes", because I think the quoting of the second argument to
AS_VAR_IF was to be the user's responsibility. (FYI, if you pass a
nonliteral as first argument, then autoconf will expand different code.
xyesy would have been a problem if you pass $foo as second argument.
The two double quotes look a bit ugly in the output, but are not really
problematic. They are not really needed for the shell, if I remember
correctly, but so that M4 splitting/macro expansion works as expected.
Hope that helps. Is there an actual bug you've encountered with this
code?
Thanks,
Ralf