octave-maintainers
[Top][All Lists]
Advanced

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

Re: AX_COMPARE_VERSION in configure.ac


From: Rik
Subject: Re: AX_COMPARE_VERSION in configure.ac
Date: Fri, 09 Nov 2012 11:59:50 -0800

On 11/09/2012 09:58 AM, Juan Pablo Carbajal wrote:
> 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.
True, but you would have to duplicate the code in each branch which could
produce some long and difficult to understand code.
>
> 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?
The autoconf-archive is the equivalent of our Octave-Forge.  The AX macros
have been contributed by various people, but are not in the official
Autoconf core nor in their documentation.  It doesn't mean that the code is
bad, it just isn't in the core.  Octave has been relying on several macros,
such as AX_LAPACK, for a long time. 

If you go to http://www.gnu.org/software/autoconf-archive/ you will land at
something of a home page.  I usually just search through the alphabetical
list of available macros to find what I want.  The macro names generally
keep to the Autoconf naming guidelines so AX_PROG is going to be equivalent
to AC_PROG and will check for an executable program.

Even though Autotools is enormously successful in helping to get software
building everywhere, I find working with m4, portable sh, and Autotools to
be really, really tedious.  The quoting rules, for example, are very
important and yet getting them right is also terrifically hard.  And I hate
having to write shell scripts as if it were the 1970's and using only a
super small fraction of shell commands that is common to all platforms.

I guess I would say that unless you have a powerful reason to dig into
Autotools, the subject is best avoided.  

--Rik


reply via email to

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