AX_DETECT_GIT_HEAD: detect git version with newer versions of git
authorSven Verdoolaege <skimo@kotnet.org>
Mon, 23 Dec 2013 09:12:10 +0000 (23 10:12 +0100)
committerSven Verdoolaege <skimo@kotnet.org>
Mon, 23 Dec 2013 09:58:01 +0000 (23 10:58 +0100)
In particular, if isl is used as a submodule, then in newer versions
of git, .git may be a file containing the path of the real directory
that has the repository.

Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>
m4/ax_detect_git_head.m4

index d585983..c332627 100644 (file)
@@ -2,7 +2,12 @@ AC_DEFUN([AX_DETECT_GIT_HEAD], [
        AC_SUBST(GIT_HEAD_ID)
        AC_SUBST(GIT_HEAD)
        AC_SUBST(GIT_HEAD_VERSION)
-       if test -f $srcdir/.git/HEAD; then
+       if test -f $srcdir/.git; then
+               gitdir=`GIT_DIR=$srcdir/.git git rev-parse --git-dir`
+               GIT_HEAD="$gitdir/index"
+               GIT_REPO="$gitdir"
+               GIT_HEAD_ID=`GIT_DIR=$GIT_REPO git describe`
+       elif test -f $srcdir/.git/HEAD; then
                GIT_HEAD="$srcdir/.git/index"
                GIT_REPO="$srcdir/.git"
                GIT_HEAD_ID=`GIT_DIR=$GIT_REPO git describe`