configure: Optionally use version information obtained from Git in executables

The variable GIT_VERSION is always defined, either obtained from Git or
a file that is embedded in tarballs when they are built.  Optionally,
that version is declared as VERSION in config.h so it will be used e.g. in
the daemons when they print the version number.

There is a check that should catch missing tags (i.e. if the version number
in AC_INIT() isn't a prefix of the version obtained via Git).
This commit is contained in:
Tobias Brunner
2020-07-20 14:10:52 +02:00
parent f77e8c171c
commit 2e522952c7
4 changed files with 37 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
#!/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