On 10/09/2013 01:18 PM, Julien ÉLIE wrote: > Hi, > > The following piece of code: > > AS_IF([test x"$var" != xfalse], > [$test=1], > [m4_ifdef([AM_CONDITIONAL], > [AM_CONDITIONAL([TEST], [false])])]) > > gives the following configure code with autoconf 2.69: > > if test x"$var" != xfalse; then : > $test=1 That's unusual shell syntax (it does NOT do a variable assignment; did you mean 'test=1' instead of trying to execute the program whose name is the expansion of $test concatenated with '=1'?) > else > > fi > > which is not a valid syntax. Indeed. The problem is that autoconf cannot tell if a non-empty literal will expand to empty text (m4_ifdef results in no output). You'll have to workaround it yourself: AS_IF([test x"$var" != xfalse], [$test=1], [: m4_ifdef(...)]) > > Is it the expected behaviour of AS_IF when the else part is empty? Yes, it's expected that autoconf can't predict which macros expand to nothing. It's a dark corner case, where it costs far more m4 time to try and work around it (and probably get things wrong in the process) than it does to just say "don't do that". > A possible workaround I found out to work is to add a no-op [:] else > part to m4_ifdef: Yep. > > Is it the right thing to do? What would you otherwise suggest? > Is there something I am missing? Nope, your analysis was spot on for what you need to do. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
Attachment:
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf