.. to the Makefile as well as to the Haskell modules where it will be
needed.

While at it, fix spacing so that command lines start with tabs, as they
should.

Signed-off-by: Petr Pudlak <[email protected]>
---
 Makefile.am                     | 15 +++++++++++----
 src/Ganeti/BasicTypes.hs        |  9 +++++++++
 src/Ganeti/Logging/WriterLog.hs | 10 +++++++++-
 src/Ganeti/THH/HsRPC.hs         | 10 +++++++++-
 src/Ganeti/WConfd/Monad.hs      | 20 ++++++++++++++------
 5 files changed, 52 insertions(+), 12 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index c63e61d..645577e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1177,11 +1177,18 @@ HS_SRCS = $(HS_LIBTESTBUILT_SRCS)
 hs-pkg-versions:
        ghc-pkg list --simple-output lens \
        | sed -r -e '$$!d' \
-    -e 's/^lens-([0-9]+(\.[0-9]+)*)/\1 0 0 0/' \
-    -e 's/\./ /g' -e 's/([0-9]+) *([0-9]+) *([0-9]+) .*/\
-        -DLENS_MAJOR=\1 -DLENS_MINOR=\2 -DLENS_REV=\3/' \
-    -e 's/^\s*//' \
+         -e 's/^lens-([0-9]+(\.[0-9]+)*)/\1 0 0 0/' \
+         -e 's/\./ /g' -e 's/([0-9]+) *([0-9]+) *([0-9]+) .*/\
+             -DLENS_MAJOR=\1 -DLENS_MINOR=\2 -DLENS_REV=\3/' \
+         -e 's/^\s*//' \
        > $@
+       ghc-pkg list --simple-output monad-control \
+       | sed -r -e '$$!d' \
+         -e 's/^monad-control-([0-9]+(\.[0-9]+)*)/\1 0 0 0/' \
+         -e 's/\./ /g' -e 's/([0-9]+) *([0-9]+) *([0-9]+) .*/\
+          -DMONAD_CONTROL_MAJOR=\1 -DMONAD_CONTROL_MINOR=\2 
-DMONAD_CONTROL_REV=\3/'\
+         -e 's/^\s*//' \
+       >> $@
 
 HS_MAKEFILE_GHC_SRCS = $(HS_SRC_PROGS:%=%.hs)
 if WANT_HSTESTS
diff --git a/src/Ganeti/BasicTypes.hs b/src/Ganeti/BasicTypes.hs
index e96d6dd..b07e11c 100644
--- a/src/Ganeti/BasicTypes.hs
+++ b/src/Ganeti/BasicTypes.hs
@@ -2,6 +2,7 @@
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE MultiParamTypeClasses #-}
 {-# LANGUAGE TypeFamilies #-}
+{-# LANGUAGE CPP #-}
 
 {-
 
@@ -73,6 +74,14 @@ module Ganeti.BasicTypes
   , emptyListSet
   ) 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_monad_control(maj,min,rev) \
+  (((maj)<MONAD_CONTROL_MAJOR)|| \
+   (((maj)==MONAD_CONTROL_MAJOR)&&((min)<=MONAD_CONTROL_MINOR))|| \
+   (((maj)==MONAD_CONTROL_MAJOR)&&((min)==MONAD_CONTROL_MINOR)&& \
+    ((rev)<=MONAD_CONTROL_REV)))
+
 import Control.Applicative
 import Control.Exception (try)
 import Control.Monad
diff --git a/src/Ganeti/Logging/WriterLog.hs b/src/Ganeti/Logging/WriterLog.hs
index 6869d6b..f4bf412 100644
--- a/src/Ganeti/Logging/WriterLog.hs
+++ b/src/Ganeti/Logging/WriterLog.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeFamilies,
-             MultiParamTypeClasses #-}
+             MultiParamTypeClasses, CPP #-}
 
 {-| A pure implementation of MonadLog using MonadWriter
 
@@ -45,6 +45,14 @@ module Ganeti.Logging.WriterLog
   , execWriterLog
   ) 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_monad_control(maj,min,rev) \
+  (((maj)<MONAD_CONTROL_MAJOR)|| \
+   (((maj)==MONAD_CONTROL_MAJOR)&&((min)<=MONAD_CONTROL_MINOR))|| \
+   (((maj)==MONAD_CONTROL_MAJOR)&&((min)==MONAD_CONTROL_MINOR)&& \
+    ((rev)<=MONAD_CONTROL_REV)))
+
 import Control.Applicative
 import Control.Monad
 import Control.Monad.Base
diff --git a/src/Ganeti/THH/HsRPC.hs b/src/Ganeti/THH/HsRPC.hs
index 53891eb..db3576b 100644
--- a/src/Ganeti/THH/HsRPC.hs
+++ b/src/Ganeti/THH/HsRPC.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE TemplateHaskell, FunctionalDependencies, FlexibleContexts #-}
+{-# LANGUAGE TemplateHaskell, FunctionalDependencies, FlexibleContexts, CPP #-}
 -- {-# OPTIONS_GHC -fno-warn-warnings-deprecations #-}
 
 {-| Creates a client out of list of RPC server components.
@@ -42,6 +42,14 @@ module Ganeti.THH.HsRPC
   , mkRpcCalls
   ) 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_monad_control(maj,min,rev) \
+  (((maj)<MONAD_CONTROL_MAJOR)|| \
+   (((maj)==MONAD_CONTROL_MAJOR)&&((min)<=MONAD_CONTROL_MINOR))|| \
+   (((maj)==MONAD_CONTROL_MAJOR)&&((min)==MONAD_CONTROL_MINOR)&& \
+    ((rev)<=MONAD_CONTROL_REV)))
+
 import Control.Applicative
 import Control.Monad
 import Control.Monad.Base
diff --git a/src/Ganeti/WConfd/Monad.hs b/src/Ganeti/WConfd/Monad.hs
index b7b7ec5..85c25dd 100644
--- a/src/Ganeti/WConfd/Monad.hs
+++ b/src/Ganeti/WConfd/Monad.hs
@@ -1,5 +1,5 @@
-{-# LANGUAGE MultiParamTypeClasses, TypeFamilies #-}
-{-# LANGUAGE TemplateHaskell #-}
+{-# LANGUAGE MultiParamTypeClasses, TypeFamilies,
+             TemplateHaskell, CPP #-}
 
 {-| All RPC calls are run within this monad.
 
@@ -65,6 +65,14 @@ module Ganeti.WConfd.Monad
   , readTempResState
   ) 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_monad_control(maj,min,rev) \
+  (((maj)<MONAD_CONTROL_MAJOR)|| \
+   (((maj)==MONAD_CONTROL_MAJOR)&&((min)<=MONAD_CONTROL_MINOR))|| \
+   (((maj)==MONAD_CONTROL_MAJOR)&&((min)==MONAD_CONTROL_MINOR)&& \
+    ((rev)<=MONAD_CONTROL_REV)))
+
 import Control.Applicative
 import Control.Arrow ((&&&), second)
 import Control.Monad
@@ -244,14 +252,14 @@ modifyConfigStateErr f = do
   when modified $ do
     if distSync
       then do
-        logDebug "Triggering config write\
-                 \ together with full synchronous distribution"
+        logDebug $ "Triggering config write" ++
+                   " together with full synchronous distribution"
         liftBase . triggerAndWait (Any True) . dhSaveConfigWorker $ dh
         logDebug "Config write and distribution finished"
       else do
         -- trigger the config. saving worker and wait for it
-        logDebug "Triggering config write\
-                 \ and asynchronous distribution"
+        logDebug $ "Triggering config write" ++
+                   " and asynchronous distribution"
         liftBase . triggerAndWait (Any False) . dhSaveConfigWorker $ dh
     return ()
   return r
-- 
2.2.0.rc0.207.ga3a616c

Reply via email to