*.log
*~
.#*
+.version
CVS
Makefile
Makefile.in
+2007-10-28 Jim Meyering <meyering@redhat.com>
+
+ Make inter-release --version output more useful.
+
+ Now, each unofficial build has a version "number" like 2.61a-19-58dd,
+ which indicates that it is built using the 19th change set
+ (in _some_ repository) following the "v2.61a" tag, and that 58dd
+ is a prefix of the commit SHA1.
+ * build-aux/git-version-gen: New file.
+ * configure.ac: Run it to set the version.
+ (AM_INIT_AUTOMAKE): Don't check NEWS here.
+ * Makefile.am (dist-hook): Arrange so that .version appears only
+ in distribution tarballs, never in a checked-out repository.
+ * .gitignore: Add .version here, too. Just in case.
+ * tests/Makefile.am ($(srcdir)/package.m4): Depend on Makefile,
+ not configure.ac, now that the version number changes automatically.
+
+ Ensure that $(VERSION) is up to date for dist-related targets.
+ * GNUmakefile: Arrange to rerun autoconf, if the version reported by
+ git-version-gen doesn't match $(VERSION), but only for dist targets.
+
2007-10-27 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Fix `Deep Package' failure with a configure script early in PATH
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
include Makefile
+
+# Ensure that $(VERSION) is up to date for dist-related targets, but not
+# for others: rerunning autoconf and recompiling everything isn't cheap.
+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)
+ ifneq ($(_curr-ver),$(VERSION))
+ $(info INFO: rerunning autoconf for new version string: $(_curr-ver))
+ dummy := $(shell rm -rf autom4te.cache; $(AUTOCONF))
+ endif
+ endif
+endif
+
include $(srcdir)/Makefile.cfg
include $(srcdir)/Makefile.maint
for file in $(autom4te_files); do \
$(move_if_change) Fetchdir/$$file $(srcdir)/lib/$$file || exit; \
done
+
+# Arrange so that .version appears only in distribution tarballs,
+# never in a checked-out repository.
+dist-hook:
+ echo $(VERSION) > $(distdir)/.version
The next step is to generate files like configure and Makefile.in:
+ $ cd autoconf
$ aclocal -I m4
$ automake
$ autoconf
--- /dev/null
+#!/bin/sh
+# Print a version string.
+# 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
+# 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".
+
+case $# in
+ 1) ;;
+ *) echo 1>&2 "Usage: $0 \$srcdir/.version"; exit 1;;
+esac
+
+tarball_version_file=$1
+nl='
+'
+
+# First see if there is a tarball-only version file.
+# then try git-describe, then default.
+if test -f $tarball_version_file
+then
+ v=`cat $tarball_version_file` || exit 1
+ case $v in
+ *$nl*) v= ;; # reject multi-line output
+ [0-9]*) ;;
+ *) v= ;;
+ esac
+ test -z "$v" \
+ && echo "$0: WARNING: $tarball_version_file seems to be damaged" 1>&2
+fi
+
+if test -n "$v"
+then
+ : # use $v
+elif test -d .git \
+ && v=`git describe --abbrev=4 HEAD 2>/dev/null` \
+ && case $v in
+ # FIXME: remove this after v6.10.
+ COREUTILS-[0-9]*) v=`echo "$v" | sed 's/^COREUTILS-//;s/_/./g'` ;;
+ v[0-9]*) ;;
+ *) (exit 1) ;;
+ esac
+then
+ # Remove the "g" in git-describe's output string.
+ v=`echo "$v" | sed 's/\(.*\)-g/\1-/'`;
+else
+ v=UNKNOWN
+fi
+
+v=`echo "$v" |sed 's/^v//'`
+
+git-status > /dev/null 2>&1
+dirty=`sh -c 'git diff-index --name-only HEAD' 2>/dev/null` || dirty=
+case "$dirty" in
+ '') ;;
+ *) # Append the suffix only if there isn't one already.
+ case $v in
+ *-dirty) ;;
+ *) v="$v-dirty" ;;
+ esac ;;
+esac
+
+# Omit the trailing newline, so that m4_esyscmd can use the result directly.
+echo "$v" | tr -d '\012'
# We need AC_CONFIG_TESTDIR.
AC_PREREQ([2.59])
-AC_INIT([GNU Autoconf], [2.61b], [bug-autoconf@gnu.org])
+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])
AC_CONFIG_AUX_DIR([build-aux])
-AM_INIT_AUTOMAKE([check-news 1.7.9 dist-bzip2 readme-alpha])
+AM_INIT_AUTOMAKE([1.7.9 dist-bzip2 readme-alpha])
# We use `/bin/sh -n script' to check that there are no syntax errors
# in the scripts. Although incredible, there are /bin/sh that go into
## package.m4. ##
## ------------ ##
-$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+$(srcdir)/package.m4: Makefile
{ \
echo '# Signature of the current package.'; \
echo 'm4_define([AT_PACKAGE_NAME], [$(PACKAGE_NAME)])'; \