isl_union_map_card: rename "dim" variable to "space"
[barvinok.git] / m4 / ax_detect_git_head.m4
blob0c5a7512085b3dc36a62b6d0b5e2caf757c85968
1 AC_DEFUN([AX_DETECT_GIT_HEAD], [
2         AC_SUBST(GIT_HEAD_ID)
3         AC_SUBST(GIT_HEAD)
4         AC_SUBST(GIT_HEAD_VERSION)
5         if test -f $srcdir/.git; then
6                 gitdir=`GIT_DIR=$srcdir/.git git rev-parse --git-dir`
7                 GIT_HEAD="$gitdir/index"
8                 GIT_REPO="$gitdir"
9                 GIT_HEAD_ID=`GIT_DIR=$GIT_REPO git describe`
10         elif test -f $srcdir/.git/HEAD; then
11                 GIT_HEAD="$srcdir/.git/index"
12                 GIT_REPO="$srcdir/.git"
13                 GIT_HEAD_ID=`GIT_DIR=$GIT_REPO git describe`
14         elif test -f $srcdir/GIT_HEAD_ID; then
15                 GIT_HEAD_ID=`cat $srcdir/GIT_HEAD_ID`
16         else
17                 mysrcdir=`(cd $srcdir; pwd)`
18                 head=`basename $mysrcdir | sed -e 's/.*-//'`
19                 head2=`echo $head | sed -e 's/[^0-9a-f]//'`
20                 head3=`echo $head2 | sed -e 's/........................................//'`
21                 if test "x$head3" = "x" -a "x$head" = "x$head2"; then
22                         GIT_HEAD_ID="$head"
23                 else
24                         GIT_HEAD_ID="UNKNOWN"
25                 fi
26         fi
27         if test -z "$GIT_REPO" ; then
28                 GIT_HEAD_VERSION="$GIT_HEAD_ID"
29         else
30                 GIT_HEAD_VERSION="\`GIT_DIR=$GIT_REPO git describe\`"
31         fi