Use Gnulib's `git-version-gen'.
authorLudovic Courtès <ludo@gnu.org>
Sat, 29 May 2010 22:14:02 +0000 (00:14 +0200)
committerLudovic Courtès <ludo@gnu.org>
Sat, 29 May 2010 22:14:02 +0000 (00:14 +0200)
* GUILE-VERSION (GUILE_VERSION): Remove.

* Makefile.am (dist-hook): Depend on `gen-tarball-version'.
  (BUILT_SOURCES): New variable.
  ($(top_srcdir)/.version, gen-tarball-version): New targets.

* cfg.mk (git-version-gen-tag-sed-script): New variable.

* configure.ac: Use `build-aux/git-version-gen' to generate the VERSION
  argument of `AC_INIT'.  Initialize Automake without `check-news'.
  Define $GUILE_VERSION as an alias for $PACKAGE_VERSION.

GUILE-VERSION
Makefile.am
cfg.mk
configure.ac

index 250ebed..28039b7 100644 (file)
@@ -1,11 +1,12 @@
 # -*-shell-script-*-
 
+# Note: `GUILE_VERSION' is defined in `configure.ac' using `git-version-gen'.
 GUILE_MAJOR_VERSION=1
 GUILE_MINOR_VERSION=9
 GUILE_MICRO_VERSION=10
 
 GUILE_EFFECTIVE_VERSION=2.0
-GUILE_VERSION=${GUILE_MAJOR_VERSION}.${GUILE_MINOR_VERSION}.${GUILE_MICRO_VERSION}
+
 
 # All of the shared lib versioning info.  Right now, for this to work
 # properly, you'll also need to add AC_SUBST calls to the right place
index 9ece841..663f45e 100644 (file)
@@ -43,7 +43,7 @@ DISTCLEANFILES = check-guile.log
 
 DISTCHECK_CONFIGURE_FLAGS = --enable-error-on-warning
 
-dist-hook: gen-ChangeLog
+dist-hook: gen-ChangeLog gen-tarball-version
 
 clean-local:
        rm -rf cache/
@@ -60,4 +60,10 @@ gen-ChangeLog:
          mv $(distdir)/cl-t $(distdir)/ChangeLog;                      \
        fi
 
+BUILT_SOURCES = $(top_srcdir)/.version
+$(top_srcdir)/.version:
+       echo $(VERSION) > $@-t && mv $@-t $@
+gen-tarball-version:
+       echo $(VERSION) > $(distdir)/.tarball-version
+
 # Makefile.am ends here
diff --git a/cfg.mk b/cfg.mk
index dba616c..4b24711 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -1 +1,3 @@
 old_NEWS_hash = d41d8cd98f00b204e9800998ecf8427e
+git-version-gen-tag-sed-script :=                                      \
+  's/^release_\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)-/v\1.\2\.\3-/g'
index 31ebad3..35f4a69 100644 (file)
@@ -27,25 +27,22 @@ Floor, Boston, MA 02110-1301, USA.
 
 AC_PREREQ(2.61)
 
-dnl  `patsubst' here deletes the newline which "echo" prints.  We can't use
-dnl  "echo -n" since -n is not portable (see autoconf manual "Limitations of
-dnl  Builtins"), in particular on solaris it results in a literal "-n" in
-dnl  the output.
-dnl
 AC_INIT([GNU Guile],
-        patsubst(m4_esyscmd(. ./GUILE-VERSION && echo ${GUILE_VERSION}),[
-]),
+        m4_esyscmd([build-aux/git-version-gen                                  \
+          .tarball-version                                                     \
+          's/^release_\([0-9]\+\)-\([0-9]\+\)-\([0-9]\+\)-/v\1.\2\.\3-/g']),
         [bug-guile@gnu.org])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_SRCDIR(GUILE-VERSION)
 
-AM_INIT_AUTOMAKE([gnu no-define check-news -Wall -Wno-override])
+AM_INIT_AUTOMAKE([gnu no-define -Wall -Wno-override])
 
 AC_COPYRIGHT(GUILE_CONFIGURE_COPYRIGHT)
 AC_CONFIG_SRCDIR([GUILE-VERSION])
 
 . $srcdir/GUILE-VERSION
+GUILE_VERSION="$PACKAGE_VERSION"
 
 AC_CONFIG_HEADERS([config.h])
 AH_TOP(/*GUILE_CONFIGURE_COPYRIGHT*/)