[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Autogen-users] [Help-autogen] Integration of autogen with autoconf
From: |
Alexandre Duret-Lutz |
Subject: |
Re: [Autogen-users] [Help-autogen] Integration of autogen with autoconf |
Date: |
15 Nov 2001 10:11:10 +0100 |
User-agent: |
Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1 |
>>> "Bruce" == Bruce Korb <address@hidden> writes:
Bruce> Geoff Quelch wrote:
>>
>> Is there a web site anywhere that gives tips/suggestions for integrating
>> autogen with autoconf. Neither of these tools' web sites has anything on
>> this.
>> One fairly trivial example would be to the version string. It is set in
>> configure.in for autoconf and in the defs file for autogen, where they
>> really are the same value.
>> Thanks.
Bruce> For AutoGen, I solved this problem by putting it into a separate
Bruce> script that is sourced both by configure.in and in AutoGen's
Bruce> definition files, thus:
>> version = `
>> if test -z "$top_srcdir" || test ! -d "$top_srcdir"; then
>> top_srcdir=..
>> fi
>> if test ! -f $top_srcdir/VERSION ; then
>> echo "error $top_srcdir/VERSION file missing" >&2
>> kill -2 ${AG_pid}
>> exit 1
>> fi
>> . $top_srcdir/VERSION > /dev/null
>> echo $AG_VERSION`;
Bruce> But, you are also right, I should add a FAQ to AutoGen
Bruce> with such hints and suggestions. Thanks! - Bruce
There are some other ways that may be worth considering too.
(It's better if Autoconf knows these strings as litteral
values rather than shell variables: you can't --trace shell
variables.)
1) If you leave the version/package litteral strings
in the AC_INIT arguments in configure.(ac|in), there are
several ways to get them back from outside configure:
- In configure.ac, use AC_CONFIG_FILES([VERSION]) to create
VERSION from VERSION.in. VERSION may consists of just
two lines, if that's what you need:
address@hidden@
address@hidden@
Then you can source VERSION in your scripts.
- In fact the VERSION script is not really needed.
You can simply ask Autoconf for these values:
eval `autoconf --trace 'AC_INIT:VERSION=$2;PACKAGE=$1'`
However this is slower, and requires Autoconf.
2) If you don't want to modify configure.ac to change the
version, you can just `m4_define' version in a separate
file, say `version.m4', add `m4_include([version.m4])'
in configure.ac, and pass the m4_defined value to AC_INIT.
3) If you allow VERSION to print the version to stdout, you can
m4_esyscmd('VERSION') from configure.ac and define a
AG_VERSION with the result. This way it's still possible to
source VERSION from a shell script, but you also have its
value available as AG_VERSION in configure (tools can --trace
it). This seems in interesting solution to me.
--
Alexandre Duret-Lutz