Re: AC_INIT receiving PACKAGE_VERSION from outside

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

 



[...]
 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



_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
http://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux