autoconf
[Top][All Lists]
Advanced

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

Re: Strategy to specify major, minor, and patch versions


From: Eric Blake
Subject: Re: Strategy to specify major, minor, and patch versions
Date: Fri, 29 Aug 2014 07:02:43 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.7.0

On 08/29/2014 06:52 AM, Zé wrote:
> On 08/28/2014 11:28 AM, Eric Blake wrote:
>> Untested:
>>
>> # M4 macros, for use during autoconf time...
>> m4_define([MAJOR_VERSION], [1])
>> m4_define([MINOR_VERSION], [0])
>> m4_define([PATCH_VERSION], [0])
>> AC_INIT([foo], MAJOR_VERSION.MINOR_VERSION.PATCH_VERSION)

Note that in my version, I _specifically_ used the macros unquoted.
That is, I'm calling AC_INIT([foo], 1.0.0), since unquoted macros in
arguments are expanded prior to the outer macro being called.


> 
> AC_INIT(foo,[MAJOR_VERSION.MINOR_VERSION.PATCH_VERSION])

But you are calling AC_INIT([foo],
[MAJOR_VERSION.MINOR_VERSION.PATCH_VERSION]), with a literal string.
Those macros may be later expanded, depending on what AC_INIT expands
to, but it's harder to guarantee that you are not going to have any
situations where the macros are left unexpanded and you ended up with a
literal string name of the macro instead of its value.

> Two questiosn:
> 
> 1) is there anything wrong with the way this script has been set?

If it worked for you, that's the ultimate test.  But I would remove the
quoting, to make sure it works by design and not just by chance.

> 
> 2) I realize this is a very basic question, but here it goes: is there a
> way to list the MAJOR_VERSION, MINOR_VERSION and PATCH_VERSION variables
> in the config.h file?

anything similar to AC_DEFINE([varname], MAJOR_VERSION) should do the trick.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
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]