diff --git a/Makefile b/Makefile index b8c149853faaceb53ea2dbc33ab2de03d9b9caaa..b03289b105f31496abc12ae01055f549399d6acd 100644 --- a/Makefile +++ b/Makefile @@ -66,6 +66,11 @@ endif SUBDIRS = $(SUBDIRS_NOLIB) libraries +VERSION : + echo $(ProjectVersion) >VERSION + +all :: VERSION + # Sanity check that all the core libraries are in the tree, to catch # failure to run darcs-all. check-packages : @@ -417,7 +422,7 @@ SRC_DIST_DIRS += mk docs distrib $(filter-out docs distrib,$(SUBDIRS)) SRC_DIST_FILES += \ configure.ac config.guess config.sub configure \ aclocal.m4 README ANNOUNCE HACKING LICENSE Makefile install-sh \ - ghc.spec.in + ghc.spec.in VERSION # ----------------------------------------------------------------------------- # Source distributions @@ -506,6 +511,9 @@ DIST_CLEAN_FILES += config.cache config.status mk/config.h mk/stamp-h \ # don't clean config.mk: it's needed when cleaning stuff later on LATE_DIST_CLEAN_FILES += mk/config.mk +# VERSION is shipped in a source dist +MAINTAINER_CLEAN_FILES += VERSION + extraclean:: $(RM) -rf autom4te.cache diff --git a/aclocal.m4 b/aclocal.m4 index 36c0128b7b2e98ed7e7595dbba9aaeb2b47ba7e1..87149a7dc151547e1ff21e21607a75c04a66083e 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -969,7 +969,24 @@ fi]) # FP_SETUP_PROJECT_VERSION # --------------------- AC_DEFUN([FP_SETUP_PROJECT_VERSION], -[# Some renamings +[ +if test "$RELEASE" = "NO"; then + AC_MSG_CHECKING([for GHC version date]) + if test -d _darcs; then + changequote(, )dnl + ver_date=`darcs changes --last=100 --xml | grep 'date=' | sed "s/^.*date='\([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\).*$/\1/g" | sort -n | tail -1` + changequote([, ])dnl + PACKAGE_VERSION=${PACKAGE_VERSION}.$ver_date + AC_MSG_RESULT($PACKAGE_VERSION) + elif test -f VERSION; then + PACKAGE_VERSION=`cat VERSION` + AC_MSG_RESULT($PACKAGE_VERSION) + else + AC_MSG_ERROR([no version found]) + fi +fi + +# Some renamings AC_SUBST([ProjectName], [$PACKAGE_NAME]) AC_SUBST([ProjectVersion], [$PACKAGE_VERSION]) diff --git a/configure.ac b/configure.ac index eb64f4e853b4c81b90b793280f270a134ccf4065..a1a9861b8234054ecc6877577ccbd7a3af54457a 100644 --- a/configure.ac +++ b/configure.ac @@ -3,9 +3,9 @@ dnl (run "grep '^dnl \*' configure.ac | sed -e 's/dnl / /g; s/\*\*/ +/g;'" dnl (or some such) to see the outline of this file) dnl # -# (c) The AQUA Project, Glasgow University, 1994-2004 +# (c) The University of Glasgow 1994-2004 # -# Configure script template for the Glasgow functional programming tools +# Configure script template for GHC # # Process with 'autoreconf' to get a working configure script. # @@ -15,6 +15,17 @@ dnl AC_INIT([The Glorious Glasgow Haskell Compilation System], [6.7], [glasgow-haskell-bugs@haskell.org], [ghc]) +# Set this to YES for a released version, otherwise NO +RELEASE=NO + +# The primary version (e.g. 6.7, 6.6.1) is set in the AC_INIT line +# above. If this is not a released version, then we will append the +# date to the version number (e.g. 6.7.20070204). The date is +# constructed by finding the date of the most recent patch in the +# darcs repository. If this is a source distribution (not a darcs +# checkout), then we ship a file 'VERSION' containing the full version +# when the source distribution was created. + if test ! -f mk/config.h.in; then echo "mk/config.h.in doesn't exist: perhaps you haven't run 'autoreconf'?" exit 1