[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Workaround for external version numbers with AC_INIT
From: |
Olivier Boudeville |
Subject: |
Workaround for external version numbers with AC_INIT |
Date: |
Fri, 27 Jan 2006 23:26:49 +0100 |
User-agent: |
Mozilla Thunderbird 1.0.7 (X11/20051013) |
Hi all,
I do not know well the Autotools, but regarding the past thread 'AC_INIT
receiving PACKAGE_VERSION from outside', I wrote a little shell script
that allows to generate a version file that can be both sourced by shell
scripts and included by M4, as suggested by Alexandre Duret-Lutz
previously.
This is a work-around to hardcoded version numbers in AC_INIT.
For example, in one's configure.ac there could be :
# Unfortunately, the new syntax for AC_INIT does not allow for variable
# substitution. As it is way simpler to have the version information in only
# one place, this has been achieved thanks to the 'version.inc' file,
which can
# be sourced by shell scripts and included by M4 scripts.
# 'version.inc' can be generated thanks to the 'generateVersionFile.sh'
script.
AC_INIT([Ceylan, m4_normalize(m4_include([conf/build/version.inc])),
./generateVersionFile.sh 3 0 0
generates following version.inc file :
dnl="This rather convoluted file allows to centralize version numbers
while "
dnl="being able to be both sourced by shell scripts and included by M4."
dnl="It can be generated by the 'generateVersionFile.sh' script."
dnl=; MAJOR=3; MINOR=0; RELEASE=0 ; m4_hiding_string="\
3.0.0
dnl "
Here is generateVersionFile.sh :
"""
#!/bin/sh
VERSION_FILENAME="version.inc"
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
fi
echo "dnl=\"This rather convoluted file allows to centralize version
numbers while \"" > $VERSION_FILENAME
echo "dnl=\"being able to be both sourced by shell scripts and included
by M4.\"" >> $VERSION_FILENAME
echo "dnl=\"It can be generated by the 'generateVersionFile.sh'
script.\"" >> $VERSION_FILENAME
echo "dnl=; MAJOR=$1; MINOR=$2; RELEASE=$3 ; m4_hiding_string=\"\\" >>
$VERSION_FILENAME
echo "$1.$2.$3" >> $VERSION_FILENAME
echo "dnl \"" >> $VERSION_FILENAME
echo "'$VERSION_FILENAME' has been generated."
"""
Apparently sourcing it is ok and my autogen process generated
appropriate files with these settings.
No specific dependency is to be enforced, if I understood well.
Please feel free to comment on it and propose improvements !
(I cannot subscribe to this list, could you cc: me as well ?)
Regards,
Olivier Boudeville.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Workaround for external version numbers with AC_INIT,
Olivier Boudeville <=