.. to TestCommon as a preparation for cherry-picking changes that
need it.

The macro and the version detection will be removed in 2.14 where the
functionality is replaced with cabal.

Signed-off-by: Petr Pudlak <[email protected]>
---
 Makefile.am                       | 7 +++++++
 test/hs/Test/Ganeti/TestCommon.hs | 8 ++++++++
 2 files changed, 15 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 29c06d8..c9fd066 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1211,6 +1211,13 @@ hs-pkg-versions:
           -DMONAD_CONTROL_MAJOR=\1 -DMONAD_CONTROL_MINOR=\2 
-DMONAD_CONTROL_REV=\3/'\
          -e 's/^\s*//' \
        >> $@
+       ghc-pkg list --simple-output QuickCheck \
+       | sed -r -e '$$!d' \
+         -e 's/^QuickCheck-([0-9]+(\.[0-9]+)*)/\1 0 0 0/' \
+         -e 's/\./ /g' -e 's/([0-9]+) *([0-9]+) *([0-9]+) .*/\
+          -DQUICKCHECK_MAJOR=\1 -DQUICKCHECK_MINOR=\2 -DQUICKCHECK_REV=\3/'\
+         -e 's/^\s*//' \
+       >> $@
 
 HS_MAKEFILE_GHC_SRCS = $(HS_SRC_PROGS:%=%.hs)
 if WANT_HSTESTS
diff --git a/test/hs/Test/Ganeti/TestCommon.hs 
b/test/hs/Test/Ganeti/TestCommon.hs
index 015601f..0b8e83e 100644
--- a/test/hs/Test/Ganeti/TestCommon.hs
+++ b/test/hs/Test/Ganeti/TestCommon.hs
@@ -83,6 +83,14 @@ module Test.Ganeti.TestCommon
   , getTempFileName
   ) where
 
+-- The following macro is just a temporary solution for 2.12 and 2.13.
+-- Since 2.14 cabal creates proper macros for all dependencies.
+#define MIN_VERSION_QuickCheck(maj,min,rev) \
+  (((maj)<QUICKCHECK_MAJOR)|| \
+   (((maj)==QUICKCHECK_MAJOR)&&((min)<=QUICKCHECK_MINOR))|| \
+   (((maj)==QUICKCHECK_MAJOR)&&((min)==QUICKCHECK_MINOR)&& \
+    ((rev)<=QUICKCHECK_REV)))
+
 import Control.Applicative
 import Control.Exception (catchJust)
 import Control.Monad
-- 
2.4.3.573.g4eafbef

Reply via email to