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 (attached to this mail) 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=0; MINOR=0; RELEASE=3 ; RELEASE_DATE="Sunday, January 29, 2006"; m4_hiding_string="\ 0.0.3 dnl " 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. 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 configure.ac, to ensure one-time assignment and avoid multiple definition of the same value, which would be error-prone in my opinion. Am I missing something obvious ? Is there any way of writing such things : """ CEYLAN_MAJOR_VERSION=0 CEYLAN_MINOR_VERSION=3 CEYLAN_VERSION=$CEYLAN_MAJOR_VERSION.$CEYLAN_MINOR_VERSION CEYLAN_MAILING_LIST_SUPPORT="ceylan-support@xxxxxxxxxxxxxxxxxxxxx" CEYLAN_CONFIG_HEADER="code/CeylanConfig.h" AC_INIT([Ceylan],$CEYLAN_VERSION,$CEYLAN_MAILING_LIST_SUPPORT) AC_CONFIG_SRCDIR($CEYLAN_CONFIG_HEADER.in) AC_CONFIG_HEADERS($CEYLAN_CONFIG_HEADER) ...here reusing multiple times CEYLAN_MAJOR_VERSION, CEYLAN_MAILING_LIST_SUPPORT, etc. """ Please feel free to comment on it and propose improvements ! Regards, Olivier Boudeville.
#!/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 ; 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."
_______________________________________________ Autoconf mailing list Autoconf@xxxxxxx http://lists.gnu.org/mailman/listinfo/autoconf