[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AM_COND_IF for earlier Automake
From: |
Dave Hart |
Subject: |
Re: AM_COND_IF for earlier Automake |
Date: |
Sun, 19 Dec 2010 13:47:58 +0000 |
On Sun, Dec 19, 2010 at 10:48 UTC, Ralf Wildenhues
<address@hidden> wrote:
> Hi Dave,
> * Dave Hart wrote on Sat, Dec 18, 2010 at 07:57:13PM CET:
>> m4_ifndef([AM_COND_IF], [AC_DEFUN([AM_COND_IF],
>> [m4_ifndef([$1_TRUE],
>> [m4_fatal([$0: no such condition "$1"])])dnl
>> if test -z "$$1_TRUE"; then :
>> m4_n([$2])[]dnl
>> m4_ifval([$3],
>> [else
>> $3
>> ])dnl
>> fi[]dnl
>> ])])
>
> Looks ok to me. If you experience problems later, please report back.
When tested as above, my AM_COND_IF replacement was occurring with
Automake 1.11, leading me to change the m4_fatal message to make it
clear it was coming from a AM_COND_IF imposter. Substituting
m4_define for AC_DEFUN cured the problem. Is it inappropriate to try
to conditionalize AC_DEFUN under m4_ifndef?
This seems to be doing the right thing on Automake 1.11. Not yet
tested with older Automake.
dnl AC_CONFIG_FILES conditionalization requires using AM_COND_IF, however
dnl AM_COND_IF is new to Automake 1.11. To use it on new Automake without
dnl requiring same, a fallback implementation for older Autoconf is provided.
dnl Note that disabling of AC_CONFIG_FILES requires Automake 1.11, this code
dnl is correct only in terms of m4sh generated script.
m4_ifndef([AM_COND_IF], [m4_define([AM_COND_IF],
[m4_ifndef([$1_TRUE],
[m4_fatal([$0 backport: no such condition "$1"])])dnl
if test -z "$$1_TRUE"; then :
m4_n([$2])[]dnl
m4_ifval([$3],
[else
$3
])dnl
fi[]dnl
])])
Thanks again,
Dave Hart