From: Jim Meyering Date: Sun, 11 Nov 2007 19:05:08 +0000 (+0100) Subject: Accommodate non-srcdir build-from-checkout. X-Git-Tag: v2.62~147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b793a96bb043a9ed2e7eea4544cfffcaac7aa3b;p=thirdparty%2Fautoconf.git Accommodate non-srcdir build-from-checkout. * build-aux/git-version-gen: Require an additional parameter: $srcdir. Use git's --git-dir=$srcdir/.git option. Add quotes, in case tarball_version_file contains shell meta-characters. * GNUmakefile (_curr-ver): Pass $(srcdir) to git-version-gen. * configure.ac: Pass "." to git-version-gen. --- diff --git a/ChangeLog b/ChangeLog index e590dc40..7bca9132 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2007-11-12 Jim Meyering + Accommodate non-srcdir build-from-checkout. + * build-aux/git-version-gen: Require an additional parameter: $srcdir. + Use git's --git-dir=$srcdir/.git option. + Add quotes, in case tarball_version_file contains shell meta-characters. + * GNUmakefile (_curr-ver): Pass $(srcdir) to git-version-gen. + * configure.ac: Pass "." to git-version-gen. + Avoid spurious test failures due to version skew. * GNUmakefile (dummy): Run $(MAKE) clean after autoreconf -i. diff --git a/GNUmakefile b/GNUmakefile index cace1601..cec6444a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -50,7 +50,7 @@ include Makefile ifeq (0,$(MAKELEVEL)) _is-dist-target = $(filter dist% alpha beta major,$(MAKECMDGOALS)) ifneq (,$(_is-dist-target)) - _curr-ver := $(shell build-aux/git-version-gen .version) + _curr-ver := $(shell build-aux/git-version-gen $(srcdir) .version) ifneq ($(_curr-ver),$(VERSION)) $(info INFO: running autoreconf for new version string: $(_curr-ver)) dummy := $(shell rm -rf autom4te.cache; autoreconf -i && $(MAKE) clean) diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen index 5f866258..20c759e7 100755 --- a/build-aux/git-version-gen +++ b/build-aux/git-version-gen @@ -1,6 +1,6 @@ #!/bin/sh # Print a version string. -scriptversion=2007-11-03.22 +scriptversion=2007-11-11.19 # Copyright (C) 2007 Free Software Foundation # @@ -24,14 +24,15 @@ scriptversion=2007-11-03.22 # - 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 .version". +# presumes this script is invoked like "./git-version-gen $srcdir .version". case $# in - 1) ;; - *) echo 1>&2 "Usage: $0 \$srcdir/.version"; exit 1;; + 2) ;; + *) echo 1>&2 "Usage: $0 \$srcdir .version"; exit 1;; esac -tarball_version_file=$1 +srcdir=$1 +tarball_version_file=$srcdir/$2 nl=' ' @@ -39,7 +40,7 @@ nl=' # 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]*) ;; @@ -52,8 +53,8 @@ fi if test -n "$v" then : # use $v -elif test -d .git \ - && v=`git describe --abbrev=4 HEAD 2>/dev/null` \ +elif test -d "$srcdir/.git" \ + && v=`git --git-dir="$srcdir/.git" describe --abbrev=4 HEAD 2>/dev/null` \ && case $v in v[0-9]*) ;; *) (exit 1) ;; diff --git a/configure.ac b/configure.ac index 3a793106..9adafa1b 100644 --- a/configure.ac +++ b/configure.ac @@ -20,7 +20,7 @@ # 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])