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: Bruno Haible
Subject: Re: AC_INIT receiving PACKAGE_VERSION from outside
Date: Fri, 11 Mar 2005 16:20:29 +0100
User-agent: KMail/1.5

Stepan Kasal wrote:
> > . ./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).

But this one works:

  AC_INIT
  AC_CONFIG_SRCDIR(foo.c)
  . $srcdir/version.sh
  AM_INIT_AUTOMAKE(my package, $VERSION_NUMBER)

> OTOH, I'm not sure why you need this.

I need it for three purposes:

1) In GNU gettext, I generate the man pages using help2man from programs.
   The version number that the programs have becomes the version number in
   the manpages. Initially automake provided no dependency information that
   the programs should be rebuilt when the configure.ac file changes. So
   before a release, after I changed the version number in configure.ac
   and did "make", the manpages were rebuilt with the _previous_ version
   number. So I changed the Makefiles so that all programs need to be
   rebuilt when configure.ac or configure changes. You can imagine that
   this hampers usual development...

2) In GNU gettext I would have to store the version number in three
   different locations:
      gettext/configure.ac
      gettext/gettext-runtime/configure.ac
      gettext/gettext-tools/configure.ac
   This is against the "single source" principle.

3) In GNU clisp, we need the version number also for building the
   infrastructure (such as documentation and Makefiles for exotic platforms),
   a task that is performed in the source directory, not the build directory.
   (When this task runs, there is no config.status anywhere.) So we
   extracted the version number from the configure.ac using 'grep'. (Could
   be using autom4te as well, doesn't matter.) So the version number ended
   up being copied and transformed in various steps:

       configure.ac  -->  configure  -->  config.status  --> Makefile
       configure.ac  -->  src/VERSION  -->  doc/impnotes.html

   At some point this jungle of dependencies was missing a dependency
   somewhere, and the dependency on configure.ac caused too many rebuilds.
   It was just too much copying around of information that should be
   centralized in a single place.

autoconf is made for putting platform/configuration dependent information
in many places. But for static information like a version number it is
more reliable to store it in a single place outside configure.ac.

> 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 would work, but now I need 'm4' or 'autoconf --trace' to retrieve
the version number from version.m4. Which is not an improvement over
'grep'. A small shell script is more handsome.

Bruno


Bruno





reply via email to

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