autoconf
[Top][All Lists]
Advanced

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

Re: Strategy to specify major, minor, and patch versions


From: Zack Weinberg
Subject: Re: Strategy to specify major, minor, and patch versions
Date: Fri, 29 Aug 2014 16:15:46 -0400

On Fri, Aug 29, 2014 at 2:04 PM, Bob Friesenhahn
<address@hidden> wrote:
> All of these strategies are done in m4 and result in the configure script
> being re-generated, which seems senseless and annoying to me.

So, I wonder, does anything break if you do it in shell instead?  Just
take Shawn's strategy and make all the M4 macros into shell variables,
like this:

APP_MAJOR_VERSION=1
APP_MINOR_VERSION=0
APP_PATCH_VERSION=0

APP_VERSION=${APP_MAJOR_VERSION}.${APP_MINOR_VERSION}.${APP_PATCH_VERSION}
AC_SUBST([APP_VERSION])
AC_INIT([app], [${APP_VERSION}])
AC_CONFIG_SRCDIR([src/app.c])
AM_INIT_AUTOMAKE

(The braces and AC_SUBST increase the odds that everything will Just
Work should "${APP_VERSION}" wind up getting written verbatim into a
Makefile.  I've also corrected the AM_INIT_AUTOMAKE invocation per
https://www.gnu.org/software/automake/manual/html_node/Public-Macros.html
.)

If that works, you can then take the APP_{MAJOR,MINOR,PATCH}_VERSION=
lines and split them out to their own file, let's call it VERSION.sh,
and read it from configure.ac with ". $srcdir/VERSION.sh".  I *think*
$srcdir is set already at that point.

If that *doesn't* work, that is a concrete thing that we can try to
fix in Autoconf.

(Whether or not it works, perhaps this is a scenario that we should
try to make *less awkward* in Autoconf, but I think the first step
remains to find out whether that works.)



reply via email to

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