autoconf
[Top][All Lists]
Advanced

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

Re: AC_INIT receiving PACKAGE_VERSION from outside


From: Sam Steingold
Subject: Re: AC_INIT receiving PACKAGE_VERSION from outside
Date: Fri, 11 Mar 2005 09:21:24 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (windows-nt)

> * Stepan Kasal <address@hidden> [2005-03-11 09:48:42 +0100]:
>
> On Thu, Mar 10, 2005 at 01:13:47PM -0500, Sam Steingold wrote:
>> Is there a way to keep the package version outside of
>> configure.ac:AC_INIT?
> ...
>> . ./version.sh
>> AC_INIT(my package, ${myversion})
>
> this solution doesn't work, as AC_INIT expects that it's arguments are
> known when m4 runs (ie. when configure is created).

so, it is impossible for configure to get the version information from
outside, it must be hard coded in the shell script.
why was this design decision made?
I (and apparently at least two more other people) consider this
behavior a bug, not a feature.
Is there a chance this will be eventually fixed?

> gnumeric uses the following solution:
>
> m4_define([gnumeric_version_epoch], [1])
> m4_define([gnumeric_version_major], [5])
> m4_define([gnumeric_version_minor], [1])
> m4_define([gnumeric_version_extra], [])
> m4_define([gnumeric_full_version],
>     
> [gnumeric_version_epoch.gnumeric_version_major.gnumeric_version_minor[]gnumeric_version_extra])
>
> AC_INIT([gnumeric], [gnumeric_full_version],
>         [http://bugzilla.gnome.org/enter_bug.cgi?product=gnumeric])
>
> Of course, this can be simplified:
>
> m4_define([gnumeric_full_version], 1.5.1)
> AC_INIT([gnumeric], [gnumeric_full_version],
>         [http://bugzilla.gnome.org/enter_bug.cgi?product=gnumeric])
>
> In your case, you would put the defines in a separate file, and include it
> like this
>
> m4_include([m4/version.m4])
> AC_INIT([gnumeric], [gnumeric_full_version],
>         [http://bugzilla.gnome.org/enter_bug.cgi?product=gnumeric])

this is no solution - it just adds a level of indirection.
still, configure will depend on m4/version.m4 (which will in turn depend
on version.sh) and will have to be regenerated on each modification of
version.sh. Yuk.

> OTOH, I'm not sure why you need this.
> According to my experience, it's easy to set the source so that
> configure.ac is the only place where the version number is present.

version can be more complex than "1.5.1".
CLISP version usually looks something like "2.34 (2005-03-11)",
while tar files look like clisp-2.34.tar.gz &c.
it is easier to have a file
--- version.sh ---
# Version number and release date.
VERSION_NUMBER=2.33.82
RELEASE_DATE=2005-03-10      # in "date +%Y-%m-%d" format
--- version.sh ---
and in configure.ac
AC_INIT(GNU CLISP, [${VERSION_NUMBER} (${RELEASE_DATE})], clisp)
than parse "configure --version" every time the VERSION_NUMBER is needed.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.memri.org/> <http://www.dhimmi.com/> <http://www.camera.org>
<http://www.mideasttruth.com/> <http://www.jihadwatch.org/>
Apathy Club meeting this Friday.  If you want to come, you're not invited.





reply via email to

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