[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: AX_COMPARE_VERSION in configure.ac
From: |
Juan Pablo Carbajal |
Subject: |
Re: AX_COMPARE_VERSION in configure.ac |
Date: |
Fri, 9 Nov 2012 18:58:06 +0100 |
On Fri, Nov 9, 2012 at 6:45 PM, Rik <address@hidden> wrote:
> On 11/09/2012 09:16 AM, Juan Pablo Carbajal wrote:
>> Hi Rik,
>>
>> I noticed that (thx JordiGH for hg classes) you simplified
>> configure.ac with the m4 macro AX_COMPARE_VERSION
>> $ hg annotate configure.ac -ucdqv | grep AX_
>> rik a44ff4f0a20b Mon Aug 13 15:43:49 2012 -0700:
>> AX_COMPARE_VERSION([$gxx_version], [lt], [3.5],
>> rik a44ff4f0a20b Mon Aug 13 15:43:49 2012 -0700:
>> AX_COMPARE_VERSION([$gcc_version], [lt], [3],
>>
>> $ hg log -r a44ff4f0a20b
>> changeset: 15170:a44ff4f0a20b
>> user: Rik <address@hidden>
>> date: Mon Aug 13 15:43:49 2012 -0700
>> summary: Add AX_COMPARE_VERSION.m4 macro m4/ dir to make configure.ac
>> simple
>>
>>
>> I am learning autotools and I was trying to find out why... I couldn't
>> find that macro but on the gnu autoconf-archive documentation
>> http://www.gnu.org/software/autoconf-archive/ax_compare_version.html
>>
>> I found AS_VERSION_COMPARE in the autoconf manual
>> http://www.gnu.org/software/autoconf/manual/autoconf.html
>>
>> Should we change for this macro? The change is very simple (just
>> remove the [lt] parameter).
>>
>> Also the AX_ macro shouldn't not as it is used now (unless is wrongly
>> documented...though it doesn't work for me!) since it cannot take
>> variables only strings. The AS_ macro can resolve variables.
>>
> I think of the AX_ macros as the library that Autoconf should have had.
> Autoconf has many useful macros built-in, but a lot of testing still
> requires going beyond these and writing shell script fragments, m4 scripts,
> or nested Autoconf macros. The AX_ series helps cut down the number of
> times one has to go and write new macros.
>
> In this particular case, AX_COMPARE_VERSION is more powerful than
> AS_VERSION_COMPARE in that it supports a greater number of comparisons (not
> just the three <, >, =) and can compare against minor numbers only.
> Incidentally, AX_COMPARE_VERSION does resolve variables which is why the
> current code is working. The documentation may be a little difficult to
> understand, but what it is trying to say is that the operation argument OP
> cannot be a variable. This means I chose the less-than operation, [lt],
> when I wrote configure.ac. I can't write
>
> OP="lt"
> AX_COMPARE_VERSION([$VER1], [$OP], [$VER2])
>
> I think we should leave the code as it is.
>
> --Rik
Ok, I am haing troubles using AX_ to resolve variables, but maybe is a
diffrent iussue.
However, what other comparison does AX_ has that AS_ cannot emulate?
AS_VERSION_COMPARE (version-1, version-2, [action-if-less],
[action-if-equal], [action-if-greater])
By using if-less and if-equal you can have [lt] and [<=] implemented,
for example.
Also, why is AX_ no in the autoconf manual? (this is one of the major
reasons why I sent the e-mail!). If it doesn't really add something
super useful (which I may perfectly not know!!!! :D ), why choose the
darkest code?
Thx