[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using AM_CONDITIONAL in m4 macros
From: |
Stefano Lattarini |
Subject: |
Re: Using AM_CONDITIONAL in m4 macros |
Date: |
Fri, 18 Jan 2013 22:58:35 +0100 |
On 01/18/2013 07:45 PM, Philipp Thomas wrote:
> * Nick Bowler (address@hidden) [20130118 17:17]:
>
>> If the package author(s) provided a script to bootstrap the build
>> system, then you should use that script. Someone made the effort to
>> write that script, and they presumably did not do so for no reason.
>
> I have no idea why they originally wrote that script. Fact is it failed to
> update the libtool configury correctly so that builing failed because of
> libtool version mismatches. I had (wrongly) assumed that running autoreconf
> instead would get me quicker to a building package.
>
>> You say that the provided script works, so that implies that a plain
>> autoreconf is not the correct way to bootstrap this package.
>
> That wasn't quite correct as I wrote above.
>
>> If you think this is a bug or limitation in autoreconf, could you
>> provide a small example package which demonstrates the problem?
>
> ATM I have no time for dol an example package but the scenario I encounterd
> goes something like this:
>
>
> In file swig.m4:
>
> AC_DEFUN([MLX_PROG_SWIG],[
>
> if test ! -z "$has_swig"; then
> SWIG_LIB=`$SWIG -swiglib`
> AM_CONDITIONAL(HAS_SWIG,[test 1])
> else
> AM_CONDITIONAL(HAS_SWIG,[test 0])
> fi
>
> ])
>
This is a user error; according to the POSIX standard, "test N"
evaluates to "true" for every N >= 0:
$ bash -c 'test 1' && echo TRUE
TRUE
$ bash -c 'test 0' && echo TRUE
TRUE
$ dash -c 'test 1' && echo TRUE
TRUE
$ dash -c 'test 0' && echo TRUE
TRUE
A correct usage would probably be something like (untested):
AM_CONDITIONAL([HAS_SWIG], [test x"$has_swig" != x])
test x"$has_swig" != x && SWIG_LIB=`$SWIG -swiglib`
> And autoreconf complains that there is no AM_CONDITIONAL for HAS_SWIG
> unless I directly m4_include swig.m4. Is that a suffient description?
>
As for this, it might be a bug or a limitation, since it doesn't seem
related to the user error above. Could you try to send a minimal and
correct reproducer for it?
Thanks,
Stefano