# compile options
ARG_ENABL_SET([coverage], [enable lcov coverage report generation.])
+ARG_ENABL_SET([git-version], [use output of 'git describe' as version information in executables.])
ARG_ENABL_SET([leak-detective], [enable malloc hooks to find memory leaks.])
ARG_ENABL_SET([lock-profiler], [enable lock/mutex profiling code.])
ARG_ENABL_SET([log-thread-ids], [use thread ID, if available, instead of an incremented value starting from 1, to identify threads.])
fi
fi
+AC_MSG_CHECKING([version from Git repository])
+AC_SUBST(GIT_VERSION, [$($srcdir/scripts/git-version "$srcdir")])
+case "$GIT_VERSION" in
+ "$PACKAGE_VERSION"*)
+ AC_MSG_RESULT([$GIT_VERSION])
+ ;;
+ *)
+ AC_MSG_ERROR([$PACKAGE_VERSION is not a prefix of $GIT_VERSION, tag missing?])
+ ;;
+esac
+
+if test x$git_version = xtrue; then
+ AC_DEFINE_UNQUOTED(VERSION, ["$GIT_VERSION"])
+fi
+
# ===============================================
# collect plugin list for strongSwan components
# ===============================================
--- /dev/null
+#!/bin/sh
+
+SRCDIR=$1
+TARBALL=$SRCDIR/.tarball-git-version
+
+if test -f $TARBALL; then
+ V=$(cat $TARBALL)
+elif test -d $SRCDIR/.git; then
+ V=$(git -C $SRCDIR describe --tags HEAD 2>/dev/null)
+fi
+
+if test -z "$V"; then
+ V="UNKNOWN"
+fi
+
+echo $V