scop.c: expr_extract_context: don't assume access is an affine expression
[pet.git] / m4 / ax_detect_git_head.m4
blobd585983510a8bdee5f6163f7f8028942a4ba73d1
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/HEAD; then
6                 GIT_HEAD="$srcdir/.git/index"
7                 GIT_REPO="$srcdir/.git"
8                 GIT_HEAD_ID=`GIT_DIR=$GIT_REPO git describe`
9         elif test -f $srcdir/GIT_HEAD_ID; then
10                 GIT_HEAD_ID=`cat $srcdir/GIT_HEAD_ID`
11         else
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
17                         GIT_HEAD_ID="$head"
18                 else
19                         GIT_HEAD_ID="UNKNOWN"
20                 fi
21         fi
22         if test -z "$GIT_REPO" ; then
23                 GIT_HEAD_VERSION="$GIT_HEAD_ID"
24         else
25             GIT_HEAD_VERSION="\`GIT_DIR=$GIT_REPO git describe\`"
26         fi