summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-11-05 13:52:20 +0000
committerLRN <lrn1986@gmail.com>2013-11-05 13:52:20 +0000
commit93f8727807901fa03fef40f795a51842799e74ea (patch)
treee59bf397c33ca4d6d130774315fd95e88f9f995c /configure.ac
parente01f4bbf85a92eb6e5c12cdf5b978f9485032bdf (diff)
Beautify the version script
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac49
1 files changed, 32 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac
index d5c4e6c66..d9e09ae9a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1292,23 +1292,38 @@ AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
# version info
AC_PATH_PROG(svnversioncommand, svnversion)
AC_PATH_PROG(gitcommand, git)
-if test "X$svnversioncommand" = "X" || test `$svnversioncommand -n '.'` = "exported"
-then
- if test "X$gitcommand" = "X"
- then
- AC_DEFINE_UNQUOTED(VCS_VERSION, ["release"], [repository svn version])
- else
- gitver=$(git log -1 | grep "git-svn-id" | sed -e 's/.*@\([[0-9]]\+\) .*/\1/')
- if test "X$gitver" = "X"
- then
- AC_DEFINE_UNQUOTED(VCS_VERSION, ["release"], [repository svn version])
- else
- AC_DEFINE_UNQUOTED(VCS_VERSION, ["svn-$gitver"], [repository svn version])
- fi
- fi
-else
- AC_DEFINE_UNQUOTED(VCS_VERSION, ["svn-`svnversion -n`"], [repository svn version])
-fi
+AC_MSG_CHECKING(for source being under a VCS)
+svn_version=
+gitsvn_version=
+AS_IF([test ! "X$svnversioncommand" = "X"],
+[
+ svn_version=$(cd $srcdir ; $svnversioncommand -n 2>/dev/null)
+])
+AS_IF([test ! "X$gitcommand" = "X"],
+[
+ gitsvn_version=$(cd $srcdir ; git log -1 2>/dev/null | grep "git-svn-id" | sed -e 's/.*@\([[0-9]]\+\) .*/\1/')
+])
+AS_IF([test "X$svn_version" = "X" -o "X$svn_version" = "Xexported" -o "X$svn_version" = "XUnversioned directory"],
+[
+ AS_IF([test "X$gitsvn_version" = "X"],
+ [
+ vcs_name="no"
+ vcs_version="release"
+ ],
+ [
+ vcs_name="yes, git-svn"
+ vcs_version="svn-$gitsvn_version"
+ ])
+],
+[
+ vcs_name="yes, svn"
+ vcs_version="svn-$svn_version"
+])
+AC_MSG_RESULT($vcs_name)
+
+AC_MSG_CHECKING(VCS version)
+AC_MSG_RESULT($vcs_version)
+AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version])
AC_CONFIG_FILES([
Makefile