autoconf
[Top][All Lists]
Advanced

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

Re: AS_VAR_IF and the resulting shell code


From: NightStrike
Subject: Re: AS_VAR_IF and the resulting shell code
Date: Fri, 16 Oct 2009 14:54:58 -0400

On Fri, Oct 16, 2009 at 1:28 PM, Ralf Wildenhues <address@hidden> wrote:
> 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?

No bug in particular.  I just want to get rid of my hand-written tests
like this:

AS_IF([test "$enable_lib32" = no && test "$enable_lib64" = no],
        [],
      [test "$enable_libce" = yes],
        [AC_MSG_WARN([Building the runtime to use libce with lib32 or
lib64 is unsupported.])])


And make them less prone to my lack of knowledge of shell gotchas.

Ideally, I can use macros for everything.  That way, I don't have to
worry about getting tied up with "test x$ddd" stuff and quoting that I
don't understand.




reply via email to

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