autoconf
[Top][All Lists]
Advanced

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

Empty else part in AS_IF


From: Julien ÉLIE
Subject: Empty else part in AS_IF
Date: Wed, 09 Oct 2013 21:18:50 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8

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
else

fi

which is not a valid syntax.
(Here, I do not have automake, so AM_CONDITIONAL is undefined.)


Running configure returns:

./configure: line 23581: syntax error near unexpected token `fi'
./configure: line 23581: `fi'



Is it the expected behaviour of AS_IF when the else part is empty?



A possible workaround I found out to work is to add a no-op [:] else part to m4_ifdef:

 AS_IF([test x"$var" != xfalse],
     [$test=1],
     [m4_ifdef([AM_CONDITIONAL],
         [AM_CONDITIONAL([TEST], [false])],
         [:])])

which gives:

 if test x"$var" != xfalse; then :
  $test=1
else
  :
fi




Is it the right thing to do?  What would you otherwise suggest?
Is there something I am missing?


Thanks beforehand,

--
Julien ÉLIE

« S.M.I.G. : Sesterce Minimum d'Intérêt Gaulois. » (Astérix)



reply via email to

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