autoconf
[Top][All Lists]
Advanced

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

Re: How to dinamically set VERSION for AC_INIT


From: Eric Blake
Subject: Re: How to dinamically set VERSION for AC_INIT
Date: Fri, 14 Dec 2007 08:04:20 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Stefano Sabatini on 12/14/2007 7:45 AM:
> 
> |It is preferable that the arguments of `AC_INIT' be static, i.e.,
> |there should not be any shell computation, but they can be
> |computed by M4.
> 
> So my question is: how can I compute with M4 the value to put in the
> AC_INIT macro (sorry I'm an M4 newbie).

Use m4_esyscmd.  Here's how the latest autoconf (will become autoconf
2.62) does it:

AC_INIT([GNU Autoconf],
        m4_esyscmd([build-aux/git-version-gen . .version]),
        address@hidden)

where build-aux/git-version-gen is the script that computes a version
number based on how many commits in git have occurred since the last
baseline stored in .version.

> Also, do you think is this approach a sane way to assign the
> AC_PACKAGE_VERSION to an autoconfigured package?

It must be, if autoconf does so itself!  One thing to be aware of is build
dependencies - if the script will generate a different result after your
edits, you have to rerun autoconf to pick up the version change, and
propagating it through the entire compilation can be a bit time-consuming.
 Therefore, autoconf also has a GNUMakefile that guarantees that when
'make dist' is run, that the version is updated correctly, while avoiding
recompilation due to version changes during normal development.

And yes, we could probably document these tricks better in the manual.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHYpt084KuGfSFAYARAozoAJ9gmrnmwTk4vDkoHIFQhO2ugGLE5wCgjBUe
g0VYKinptypz6eH5/0nhofk=
=dtOq
-----END PGP SIGNATURE-----




reply via email to

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