#!/bin/sh
# Print a version string.
-scriptversion=2007-11-11.19
+scriptversion=2008-02-08.11
# Copyright (C) 2007 Free Software Foundation
#
# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.
# It may be run two ways:
-# - from a git repository in which the git-describe command below
+# - from a git repository in which the "git describe" command below
# produces useful output (thus requiring at least one signed tag)
# - from a non-git-repo directory containing a .version file, which
-# presumes this script is invoked like "./git-version-gen $srcdir .version".
+# presumes this script is invoked like "./git-version-gen .tarball-version".
case $# in
- 2) ;;
- *) echo 1>&2 "Usage: $0 \$srcdir .version"; exit 1;;
+ 1) ;;
+ *) echo 1>&2 "Usage: $0 \$srcdir/.version"; exit 1;;
esac
-srcdir=$1
-tarball_version_file=$srcdir/$2
+tarball_version_file=$1
nl='
'
# First see if there is a tarball-only version file.
-# then try git-describe, then default.
+# then try "git describe", then default.
if test -f $tarball_version_file
then
- v=`cat "$tarball_version_file"` || exit 1
+ v=`cat $tarball_version_file` || exit 1
case $v in
*$nl*) v= ;; # reject multi-line output
[0-9]*) ;;
if test -n "$v"
then
: # use $v
-elif test -d "$srcdir/.git" \
- && v=`git --git-dir="$srcdir/.git" describe --abbrev=4 HEAD 2>/dev/null` \
+elif test -d .git \
+ && v=`git describe --abbrev=4 HEAD 2>/dev/null` \
&& case $v in
v[0-9]*) ;;
*) (exit 1) ;;
esac
then
+ # Is this a new git that lists number of commits since the last
+ # tag or the previous older version that did not?
+ # Newer: v6.10-77-g0f8faeb
+ # Older: v6.10-g0f8faeb
+ case $v in
+ *-*-*) : git describe is okay three part flavor ;;
+ *-*)
+ : git describe is older two part flavor
+ # Recreate the number of commits and rewrite such that the
+ # result is the same as if we were using the newer version
+ # of git describe.
+ vtag=`echo "$v" | sed 's/-.*//'`
+ numcommits=`git rev-list "$vtag"..HEAD | wc -l`
+ v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
+ ;;
+ esac
+
# Change the first '-' to a '.', so version-comparing tools work properly.
- # Remove the "g" in git-describe's output string, to save a byte.
+ # Remove the "g" in git describe's output string, to save a byte.
v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
else
v=UNKNOWN
v=`echo "$v" |sed 's/^v//'`
# Don't declare a version "dirty" merely because a time stamp has changed.
-git-status > /dev/null 2>&1
+git status > /dev/null 2>&1
dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty=
case "$dirty" in
# Process this file with autoconf to produce a configure script.
# Copyright (C) 1992, 1993, 1994, 1995, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+# 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# We need AC_CONFIG_TESTDIR, AC_PROG_SED, AC_PROG_GREP.
AC_PREREQ([2.60])
-AC_INIT([GNU Autoconf], m4_esyscmd([build-aux/git-version-gen . .version]),
+AC_INIT([GNU Autoconf], m4_esyscmd([build-aux/git-version-gen .version]),
[bug-autoconf@gnu.org])
AC_SUBST([PACKAGE_NAME])dnl
AC_CONFIG_SRCDIR([ChangeLog])