ppcg_kernel: keep track of gpu_prog
[ppcg.git] / m4 / ax_detect_git_head.m4
blob5657da8f4ad0a389ec5fea9c52083e9d43b36bda
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 --always`
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 --always\`"
26         fi