ref: 50f933b57f078d7ad25a6c1fe0e8aa70c5c611bc
parent: 42eb9330c9a5f63b4f005e3a26b4fe3323e72736
author: Ralph Giles <[email protected]>
date: Tue Aug 2 05:34:55 EDT 2011
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.
--- a/configure.ac
+++ b/configure.ac
@@ -11,7 +11,17 @@
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 @@
VERSION=$OPUS_VERSION
PACKAGE=opus
+# For our version string
AC_SUBST(OPUS_VERSION)
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)