automake-patches
[Top][All Lists]
Advanced

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

Re: Avoid syntax error if IF-TRUE part of AM_COND_IF is empty.


From: Eric Blake
Subject: Re: Avoid syntax error if IF-TRUE part of AM_COND_IF is empty.
Date: Tue, 27 Jul 2010 14:33:03 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.1.1

On 07/27/2010 01:33 PM, Ralf Wildenhues wrote:
> Adding this patch to maint to fix the glitch at least for the IF-TRUE
> case.  It's unfortunately not fixable as nicely in the IF-FALSE case
> since we don't want to override $? there.
> 
> @@ -27,8 +27,8 @@ AC_DEFUN([AM_COND_IF],
>  [m4_ifndef([_AM_COND_VALUE_$1],
>          [m4_fatal([$0: no such condition "$1"])])dnl
>  _AM_COND_IF([$1])dnl
> -if _AM_COND_VALUE_$1; then
> -  m4_default([$2], [:])
> +if _AM_COND_VALUE_$1; then :
> +  m4_n([$2])[]dnl

Rather than open-coding the shell if, why not use:

AS_IF([_AM_COND_VALUE_$1],
[m4_n([$2])[]dnl
  m4_ifval([$3], [_AM_COND_ELSE([$1])],
[body of else])

which (should) take care of an empty else for you as well, if AS_IF is
up to par (and if not, report that on the autoconf list).

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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