Add "Attoparsec" to the optional haskell packages
authorMichele Tartara <mtartara@google.com>
Fri, 9 Nov 2012 15:46:05 +0000 (16:46 +0100)
committerIustin Pop <iustin@google.com>
Tue, 13 Nov 2012 09:42:11 +0000 (10:42 +0100)
This will be needed for the data collectors of the monitoring agent.

* Detection of the library
* Creation of the appropriate variables
* Update to the installation documentation

Signed-off-by: Michele Tartara <mtartara@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

INSTALL
configure.ac

diff --git a/INSTALL b/INSTALL
index 0087e53..44088b6 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -168,9 +168,9 @@ Haskell optional features
 
 Optionally, more functionality can be enabled if your build machine has
 a few more Haskell libraries enabled: RAPI access to remote cluster from
-htools (``--enable-htools-rapi``) and enabling the ``ganeti-confd``
-daemon (``--enable-confd``). The list of extra dependencies for these
-is:
+htools (``--enable-htools-rapi``), the ``ganeti-confd``
+daemon (``--enable-confd``) and the monitoring agent
+(``--enable-monitoring``). The list of extra dependencies for these is:
 
 - `curl <http://hackage.haskell.org/package/curl>`_, tested with
   versions 1.3.4 and above
@@ -182,16 +182,19 @@ is:
 - `hinotify <http://hackage.haskell.org/package/hinotify>`_
 - `regex-pcre <http://hackage.haskell.org/package/regex-pcre>`_,
   bindings for the ``pcre`` library
+- `attoparsec <http://hackage.haskell.org/package/attoparsec>`_
 
 These libraries are available in Debian Wheezy (but not in Squeeze, with
 the exception of curl), so you can use either apt::
 
   $ apt-get install libghc-hslogger-dev libghc-crypto-dev libghc-text-dev \
-                    libghc-hinotify-dev libghc-regex-pcre-dev libghc-curl-dev
+                    libghc-hinotify-dev libghc-regex-pcre-dev libghc-curl-dev \
+                    libghc-attoparsec-dev
 
 or ``cabal``::
 
-  $ cabal install hslogger Crypto text hinotify regex-pcre curl
+  $ cabal install hslogger Crypto text hinotify regex-pcre curl \
+                  attoparsec
 
 to install them.
 
index 14554a3..3e134a2 100644 (file)
@@ -416,6 +416,13 @@ AC_ARG_ENABLE([confd],
   [],
   [enable_confd=check])
 
+ENABLE_MONITORING=
+AC_ARG_ENABLE([monitoring],
+  [AS_HELP_STRING([--enable-monitoring],
+  [enable the ganeti monitoring agent (default: check)])],
+  [],
+  [enable_monitoring=check])
+
 # Check for ghc
 AC_ARG_VAR(GHC, [ghc path])
 AC_PATH_PROG(GHC, [ghc], [])
@@ -492,12 +499,41 @@ fi
 AC_SUBST(ENABLE_CONFD, $has_confd)
 AM_CONDITIONAL([ENABLE_CONFD], [test x$has_confd = xTrue])
 
+#extra modules for monitoring agent functionality
+has_monitoring=False
+if test "$enable_monitoring" != "no"; then
+  MONITORING_PKG=
+  AC_GHC_PKG_CHECK([attoparsec], [], [MONITORING_PKG="$MONITORING_PKG attoparsec"])
+  if test -z "$MONITORING_PKG"; then
+    has_monitoring=True
+  else
+    if test "$enable_monitoring" = "check"; then
+      AC_MSG_WARN(m4_normalize([The required extra libraries for the monitoring
+                                agent were not found ($MONITORING_PKG),
+                                monitoring disabled]))
+    else
+      AC_MSG_FAILURE(m4_normalize([The monitoring functionality was requested, but
+                                   required libraries were not found:
+                                   $MONITORING_PKG]))
+    fi
+  fi
+fi
+if test "$has_monitoring" = "True"; then
+  AC_MSG_NOTICE([Enabling the monitoring agent usage])
+fi
+AC_SUBST(ENABLE_MONITORING, $has_monitoring)
+AM_CONDITIONAL([ENABLE_MONITORING], [test x$has_monitoring = xTrue])
+
 # development modules
 HTOOLS_NODEV=
 AC_GHC_PKG_CHECK([QuickCheck-2.*], [], [HTOOLS_NODEV=1], t)
 AC_GHC_PKG_CHECK([test-framework-0.6*], [], [HTOOLS_NODEV=1], t)
 AC_GHC_PKG_CHECK([test-framework-hunit], [], [HTOOLS_NODEV=1])
 AC_GHC_PKG_CHECK([test-framework-quickcheck2], [], [HTOOLS_NODEV=1])
+# FIXME: unify checks for non-test libraries (attoparsec, hinotify, ...)
+#        that are needed to execute the tests, avoiding the duplication
+#        of the checks.
+AC_GHC_PKG_CHECK([attoparsec], [], [HTOOLS_NODEV=1])
 if test -n "$HTOOLS_NODEV"; then
    AC_MSG_WARN(m4_normalize([Required development modules were not found,
                              you won't be able to run Haskell unittests]))