On 03/17/2011 10:09 PM, Ralf Wildenhues wrote:
Hi Eric,
* Eric Blake wrote on Thu, Mar 17, 2011 at 05:57:48PM CET:
We have an existing use case that argues for unexpanded (automake's
desire to write tests for dummy packages that use arbitrary names that
happen to match m4 builtins that aren't in the m4_ reserved namespace).
My use case is to set the version number consistently inside of a
package (package suite) which consists of several sub-packages.
To achieve this, I have two aclocal *.m4s containing something similar
to this:
aclocal/version.m4:
AC_DEFUN([XXXX_VERSIONING],
m4_define([_XXXX_VERSION],[1.2.99.0]))
m4_define([_XXXX_API],[1.3])
aclocal/init.m4:
AC_DEFUN([XXXX_INIT],
[AC_REQUIRE([XXXX_VERSIONING
AC_PREFIX_DEFAULT([/opt/XXXX-][_XXXX_API])
])
... accompanied by this in configure.ac's:
AC_INIT([XXXX],[_XXXX_VERSION],[http://www.XXXX.org/bugzilla])
XXXX_INIT
... and this in Makefile.am's
ACLOCAL_AMFLAGS = -I <path-to-version.m4>
AC_INIT is very widely
used, by almost every package using Autoconf. There might be some
that rely on the current behavior, at least if it has been that way
for a long time. (And at some point in the past, the behavior might
have been consistent ...) Expanding user macros here can be useful.
What I do is one way to escape autoconf many years ago having stopped
allowing variables in AC_INIT.
It allows me to only change one file with version bumps, instead having
to modify many configure.ac's.
Ralf