[gpm] problems with git and AC_PACKAGE_VERSION
Nico Schottelius
nico-gpm@schottelius.org
Thu Jun 19 07:47:58 CEST 2008
Good morning Mike, dear list,
Mike Frysinger [Wed, Jun 18, 2008 at 09:20:16PM -0400]:
> current git fails to run autotools.
Strangely no problem here, autogen runs without problems
and mostly creates the correct output. I've
version 2.61 here.
> this is because .gitversion.m4 defines
> AC_PACKAGE_VERSION to a date stamp, but the configure.ac does
> AC_SUBST(AC_PACKAGE_VERSION). since the former did a define() instead of
> declaring it a shell variable, it becomes:
> AC_SUBST(1.20.5 2008....)
> which obviously fails
You are absolutely right, the AC_SUBST call is a relict from my fight
with autotools and is now removed as of commit 11fd4f6.
> i dont know what the intention was here, so i'm not going to try and fix it.
To explain what happened:
My very simple aim was to include the version string produced by git
(git-describe) into gpm.
So my very first idea was to do this:
AC_INIT([gpm],["$revgit"],[http://unix.schottelius.org/gpm/])
which resulted in this warning:
configure.ac:7: warning: AC_INIT: not a literal: "$revgit"
Then I tried to define it via m4, still depending on a shell variable:
revgit="`cat $srcdir/.gitversion`"
m4_define([AC_PACKAGE_VERSION], [$revgit])
When AC_PACKAGE_VERSION is set before AC_INIT runs, AC_INIT will not
overwrite it (see autoconf m4 files). But this did not work, as it was
expanded to
PACKAGE_VERSION='$revgit'
Interestingly another variable seems not to depend on it:
PACKAGE_STRING='gpm "version-set-in-.gitversion-via-acinclude.m4"'
The later part should obviously also be $revgit, but well, I don't
use PACKAGE_STRING, so I ignored it.
Then I tried the m4 include() macro, which looked pretty nice for me:
m4_define([AC_PACKAGE_VERSION], include(.gitversion))
Strangely it seems include() was not called by m4, thus this results in
PACKAGE_VERSION='include(.gitversion)'
So the final step was to pregenerate an m4 macro that contains the
version and include that:
echo "define([AC_PACKAGE_VERSION], [${version} ${date}])" > .gitversion.m4
Sincerly,
Nico
--
Think about Free and Open Source Software (FOSS).
http://nico.schottelius.org/documentations/foss/the-term-foss/
PGP: BFE4 C736 ABE5 406F 8F42 F7CF B8BE F92A 9885 188C
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.linux.it/pipermail/gpm/attachments/20080619/3c5ee4af/attachment.pgp
More information about the gpm
mailing list