From cfd4e2c311e17bae644372f6c87da24446bf09f7 Mon Sep 17 00:00:00 2001 From: Ralph Giles <giles@mozilla.com> Date: Mon, 1 Oct 2012 11:30:41 -0700 Subject: [PATCH] Set the autoconf version from git. AC_INIT requires that the version string passed in be 'static' so we can't use the output of a shell invocation. However, it can be computed by an m4 shell invocation. This is what autoconf itself does to embed its git version number in PACKAGE_VERSION. Doing this necessitates the 'echo -n' in git-version.sh. Make is smart enough to strip the trailing newline, but AC_INIT is not. We must also add -f to autoreconf. Otherwise, autogen.sh will only update configure when configure.ac changes, even if the output of git-version.sh has changed. This is still not ideal, since it runs at autogen.sh time, not at 'make' time, which is what we want. This seems to be a limitation of an upcoming automake release, which removes the old style with PACKAGE and VERSION set by shell variables. --- autogen.sh | 2 +- configure.ac | 4 +++- doc/git-version.sh | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/autogen.sh b/autogen.sh index 58d140a..ed71bc6 100755 --- a/autogen.sh +++ b/autogen.sh @@ -13,4 +13,4 @@ test -z "$srcdir" && srcdir=. cd "$srcdir" echo "Updating build configuration files for $package, please wait...." -autoreconf -is +autoreconf -isf diff --git a/configure.ac b/configure.ac index e1f3d21..52c5210 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,6 @@ -AC_INIT([opusfile], [0.0]) +# autoconf source script for generating configure + +AC_INIT([opusfile], m4_esyscmd([doc/git-version.sh])) AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE diff --git a/doc/git-version.sh b/doc/git-version.sh index 4475454..f0d2576 100755 --- a/doc/git-version.sh +++ b/doc/git-version.sh @@ -9,4 +9,4 @@ else VERSION=${GIT_VERSION} fi -echo ${VERSION} +echo -n ${VERSION} -- GitLab