add isl_schedule_tree_band_intersect_domain
[isl.git] / m4 / ax_detect_git_head.m4
blob31a6fe32945ba4d6521fff12d7ac5d5a3f9b3ef0
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 --always`
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 --always`
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 --always\`"
31         fi