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: Alexandre Duret-Lutz
Subject: Re: AC_INIT receiving PACKAGE_VERSION from outside
Date: Thu, 17 Mar 2005 23:52:14 +0100
User-agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux)

[...]
 Stepan> In your case, you would put the defines in a separate
 Stepan> file, and include it like this
 Stepan> 
 Stepan> m4_include([m4/version.m4])
 Stepan> AC_INIT([gnumeric], [gnumeric_full_version],
 Stepan> [http://bugzilla.gnome.org/enter_bug.cgi?product=gnumeric])

 Bruno> This would work, but now I need 'm4' or 'autoconf --trace' to retrieve
 Bruno> the version number from version.m4. Which is not an improvement over
 Bruno> 'grep'. 

AC_INIT([foobar], m4_normalize(m4_include([version])))

And write down your version string in the `version' file.
(m4_normalize strips extra spaces and new lines.)

Then 
  1) neither grep nor M4 are needed to read the version (cat is enough)
  2) you don't break `autoconf --trace AC_INIT' so any build tool can 
     retrieve your version without knowing where it is stored.
  3) automake keeps track of the dependency for you
  4) the version is put in the generated configure script
     (impossible to do if the version is not a literal)

Writing the above `version', or `m4/version.m4' so that they
can *also* be sourced by a shell script is left as an exercise
to the reader...

 Bruno> A small shell script is more handsome.

Beware that sourced shell scripts add hidden dependency to
./config.status.  You have to make sure config.status is rebuilt
(and then rerun) whenever a file sourced by configure changes.
This is error-prone.  Almost no configure.ac I have seen
sourcing a version script do define CONFIG_STATUS_DEPENDENCIES
as they should.
-- 
Alexandre Duret-Lutz





reply via email to

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