Detect the snapshot version number using darcs
[ghc-hetmet.git] / aclocal.m4
index 9d1e1ca..87149a7 100644 (file)
@@ -168,6 +168,10 @@ case $HostPlatform in
 alpha-dec-osf*) fptools_cv_leading_underscore=no;;
 *cygwin32) fptools_cv_leading_underscore=yes;;
 *mingw32) fptools_cv_leading_underscore=yes;;
+
+    # HACK: Apple doesn't seem to provide nlist in the 64-bit-libraries
+x86_64-apple-darwin*) fptools_cv_leading_underscore=yes;;
+
 *) AC_RUN_IFELSE([AC_LANG_SOURCE([[#ifdef HAVE_NLIST_H
 #include <nlist.h>
 struct nlist xYzzY1[] = {{"xYzzY1", 0},{0}};
@@ -950,10 +954,39 @@ if test "$fp_cv_gcc_has_no_unit_at_a_time" = "yes"; then
    AC_DEFINE([HAVE_GCC_HAS_NO_UNIT_AT_A_TIME], [1], [Define to 1 if gcc supports -fno-unit-at-a-time.])
 fi])
 
+# FP_GCC_HAS_WRAPV
+# --------------------------
+AC_DEFUN([FP_GCC_HAS_WRAPV],
+[AC_REQUIRE([FP_HAVE_GCC])
+AC_CACHE_CHECK([whether gcc has -fwrapv], [fp_cv_gcc_has_wrapv],
+[FP_COMPARE_VERSIONS([$fp_gcc_version], [-ge], [3.4],
+  [fp_cv_gcc_has_wrapv=yes],
+  [fp_cv_gcc_has_wrapv=no])])
+if test "$fp_cv_gcc_has_wrapv" = "yes"; then
+   AC_DEFINE([HAVE_GCC_HAS_WRAPV], [1], [Define to 1 if gcc supports -fwrapv.])
+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])