From 50f933b57f078d7ad25a6c1fe0e8aa70c5c611bc Mon Sep 17 00:00:00 2001 From: Ralph Giles <giles@thaumas.net> Date: Tue, 2 Aug 2011 09:34:55 -0700 Subject: [PATCH] Query git for the repository revision and use that for the version string. Rather than compiling in the fixed version number from the configure file, it's more helpful for testing and debugging to directly embed the repository's revision. We use 'git describe --tags' for this, since for tagged revisions it just returns the tag name, and in other cases is more readable than a raw commit id. If git isn't present or can't find a repository to query, we fall back to the static version number in the configure script. --- configure.ac | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 8c7a13252..747623dbf 100644 --- a/configure.ac +++ b/configure.ac @@ -11,7 +11,17 @@ OPUS_MAJOR_VERSION=0 OPUS_MINOR_VERSION=9 OPUS_MICRO_VERSION=6 OPUS_EXTRA_VERSION= -OPUS_VERSION=$OPUS_MAJOR_VERSION.$OPUS_MINOR_VERSION.$OPUS_MICRO_VERSION$OPUS_EXTRA_VERSION + +OPUS_VERSION="$OPUS_MAJOR_VERSION.$OPUS_MINOR_VERSION.$OPUS_MICRO_VERSION$OPUS_EXTRA_VERSION" +AC_MSG_CHECKING([git revision]) +GIT_VERSION=$(git describe --tags 2>/dev/null) +if test -z "$GIT_VERSION"; then + AC_MSG_RESULT([no]) +else + AC_MSG_RESULT([$GIT_VERSION]) + OPUS_VERSION="$GIT_VERSION" +fi + LIBOPUS_SUFFIX=0 OPUS_LT_CURRENT=0 @@ -27,6 +37,7 @@ AC_SUBST(LIBOPUS_SUFFIX) VERSION=$OPUS_VERSION PACKAGE=opus +# For our version string AC_SUBST(OPUS_VERSION) AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define) -- GitLab