From f46b8f5d72e3e506507673aa3d2562f4b87d61da Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sat, 26 Jan 2008 17:27:44 +0000 Subject: [PATCH] Added detection of GHC's version number, and altered the GHC flags depending on the version --- Makefile.am | 7 ++++++- configure.ac | 19 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 7cbad0f..ed56311 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,11 +1,16 @@ GHC_OPTS = \ -fglasgow-exts \ - -fallow-undecidable-instances \ -fwarn-unused-binds \ -fwarn-unused-imports \ -fwarn-type-defaults \ -icommon -itransformations -ifrontends -ibackends +if GHC68 +GHC_OPTS += -XUndecidableInstances -fwarn-tabs +else +GHC_OPTS += -fallow-undecidable-instances +endif + tock$(EXEEXT): $(BUILT_SOURCES) $(tock_SOURCES) @MKDIR_P@ obj ghc $(GHC_OPTS) -o tock$(EXEEXT) --make Main -odir obj -hidir obj diff --git a/configure.ac b/configure.ac index 0737c99..97c8794 100644 --- a/configure.ac +++ b/configure.ac @@ -115,6 +115,25 @@ AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[ ]]), ) CFLAGS= +AC_MSG_CHECKING([Checking GHC version]) + +ghc_version=`ghc --numeric-version` +ghc_version_major=`echo $ghc_version | awk -F . '{print $1}'` +ghc_version_mid=`echo $ghc_version | awk -F . '{print $2}'` +ghc_version_minor=`echo $ghc_version | awk -F . '{print $3}'` + +AC_MSG_RESULT($ghc_version_major.$ghc_version_mid.$ghc_version_minor) + +AC_MSG_CHECKING([Checking that GHC version is at least 6.6.x]) + +if test $ghc_version_major -lt 6 -o $ghc_version_mid -lt 6; then + AC_MSG_ERROR([GHC of at least version 6.6.x is required]) +else + AC_MSG_RESULT([ok]) +fi + +AM_CONDITIONAL([GHC68],[test $ghc_version_major -ge 6 -a $ghc_version_mid -ge 8]) + AC_SUBST(gnu89_inline) AC_SUBST(ccsp_kroc_available) AC_SUBST(cppcsp_available)