[Top][All Lists]

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


From: Bruce Korb
Subject: Re: Computed values in AC_INIT, AC_CONFIG_SRCDIR, AC_CONFIG_HEADERS, etc.
Date: Sun, 29 Jan 2006 10:41:03 -0800
User-agent: Mozilla Thunderbird 1.0.7 (X11/20050923)

Olivier Boudeville wrote:

After having tried this approach, I noticed that at least AC_INIT, 
AC_CONFIG_SRCDIR and AC_CONFIG_HEADERS do not seem to allow variable 
substitution ($A taken litterally instead of its value, am I wrong ?)
I think to using a template that could be filled with settings read from a file 
to generate the expected, to ensure one-time assignment and avoid 
multiple definition of the same value, which would be error-prone in my opinion.

Yep.  That's the way to do it:  a pre-autoreconf script.
It is very cute to construct it in a way that both shell
and m4 are happy, but it also adds a stiltedness that
makes things less clear.  You may as well construct
several files from the one script.  It's cleaner.
You can emit the "version.texi" doc file at the same time, too.



USAGE="Usage : "`basename $0`" <major> <minor> <release> : generates a file named 
'$VERSION_FILENAME' which can set version numbers both when sourced by a shell script (setting the MAJOR_VERSION, 
MINOR_VERSION and RELEASE variables appropriately) and included by a m4 script. This is useful as a workaround to 
Autoconf AC_INIT behaviour."

if test "$#" -ne 3 ; then
        echo $USAGE 1>&2
        exit 1
echo "dnl=\"This rather convoluted file allows to centralize version numbers while 

echo "dnl=\"being able to be both sourced by shell scripts and included by m4.\"" 

echo "dnl=\"It can be generated by the '' script.\"" >> 

echo "dnl=; MAJOR=$1; MINOR=$2; RELEASE=$3 ; RELEASE_DATE=\""`date '+%A, %B %e, %Y'`"\"; 
m4_hiding_string=\"\\" >> $VERSION_FILENAME

echo "$1.$2.$3" >> $VERSION_FILENAME
echo "dnl \"" >> $VERSION_FILENAME

echo "'$VERSION_FILENAME' has been generated."

Using a "here doc" is much more comprehensible:

        dnl=; MAJOR=$1; MINOR=$2; RELEASE=$3; RELEASE_DATE="`date`"
        dnl=; m4_hiding_string="
        dnl "

Also, as the author of "autogen", I'd suggest calling the thing, "bootstrap" :)

Cheers - Bruce

reply via email to

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