summaryrefslogtreecommitdiff
path: root/config/gr_git.m4
diff options
context:
space:
mode:
Diffstat (limited to 'config/gr_git.m4')
-rw-r--r--config/gr_git.m423
1 files changed, 14 insertions, 9 deletions
diff --git a/config/gr_git.m4 b/config/gr_git.m4
index 5e8aa663b..c4f1ea0c0 100644
--- a/config/gr_git.m4
+++ b/config/gr_git.m4
@@ -30,18 +30,23 @@ AC_DEFUN([GR_GIT],[
AC_MSG_CHECKING([git description of current commit])
if (cd $srcdir && $GIT describe >/dev/null 2>&1); then
GIT_DESCRIBE=`cd $srcdir && $GIT describe --abbrev=8 --long`
- GIT_TAG=`echo $GIT_DESCRIBE | cut -f 1 -d '-'`
- GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 2 -d '-'`
- GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 3 -d '-' | cut -f 2- -d 'g'`
# Release candidate tags create an extra -rcX field
- if test x`echo $GIT_DESCRIBE | cut -f 1- -d '-' --output-delimiter=' ' | wc -w` = x4; then
- GIT_TAG=`echo $GIT_DESCRIBE | cut -f -2 -d '-'`
- GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 3 -d '-'`
- GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 4 -d '-' | cut -f 2- -d 'g'`
- fi
+ case $GIT_DESCRIBE in
+ *-*-*-*)
+ GIT_TAG=`echo $GIT_DESCRIBE | cut -f -2 -d '-'`
+ GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 3 -d '-'`
+ GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 4 -d '-' | cut -f 2- -d 'g'`
+ ;;
+ *-*-*)
+ GIT_TAG=`echo $GIT_DESCRIBE | cut -f 1 -d '-'`
+ GIT_SEQNO=`echo $GIT_DESCRIBE | cut -f 2 -d '-'`
+ GIT_COMMIT=`echo $GIT_DESCRIBE | cut -f 3 -d '-' | cut -f 2- -d 'g'`
+ ;;
+ esac
+
AC_MSG_RESULT([$GIT_DESCRIBE])
else
- AC_MSG_RESULT([unable to find, using current commit])
+ AC_MSG_RESULT([no tag in history, using current commit])
GIT_TAG=''
GIT_SEQNO=''
GIT_COMMIT=`cd $srcdir && $GIT describe --always --abbrev=8`