1 AC_DEFUN([AX_DETECT_GIT_HEAD], [
4 AC_SUBST(GIT_HEAD_VERSION)
5 if test -f $srcdir/.git/HEAD; then
6 GIT_HEAD="$srcdir/.git/index"
7 GIT_REPO="$srcdir/.git"
8 GIT_HEAD_ID=`GIT_DIR=$GIT_REPO git describe --always`
9 elif test -f $srcdir/GIT_HEAD_ID; then
10 GIT_HEAD_ID=`cat $srcdir/GIT_HEAD_ID`
12 mysrcdir=`(cd $srcdir; pwd)`
13 head=`basename $mysrcdir | sed -e 's/.*-//'`
14 head2=`echo $head | sed -e 's/[^0-9a-f]//'`
15 head3=`echo $head2 | sed -e 's/........................................//'`
16 if test "x$head3" = "x" -a "x$head" = "x$head2"; then
22 if test -z "$GIT_REPO" ; then
23 GIT_HEAD_VERSION="$GIT_HEAD_ID"
25 GIT_HEAD_VERSION="\`GIT_DIR=$GIT_REPO git describe --always\`"