From 558377569146536beb543ce14a22c876605bf2f9 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 3 Oct 2012 00:47:33 +0100
Subject: [PATCH] Try to auto-enable htools-rapi and split query

We try to automatically enable the htools-rapi and split query (if
confd and htools-rapi are enabled) options. This is our intended
default configuration, and allows easier test of the new code
path. Further cleanups for checking whether confd can be enabled will
come later.

The move block is due to the fact that we first have to check for
htools-rapi, and only then we can auto-enable the feature.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 configure.ac | 67 ++++++++++++++++++++++++++++++++--------------------
 1 file changed, 41 insertions(+), 26 deletions(-)

diff --git a/configure.ac b/configure.ac
index 2d0cb92bc..b603562ac 100644
--- a/configure.ac
+++ b/configure.ac
@@ -324,7 +324,7 @@ AC_ARG_ENABLE([htools-rapi],
         [AS_HELP_STRING([--enable-htools-rapi],
         [enable use of RAPI in htools (needs curl, default: no)])],
         [],
-        [enable_htools_rapi=no])
+        [enable_htools_rapi=check])
 
 # --enable-confd
 ENABLE_CONFD=
@@ -349,31 +349,6 @@ AC_SUBST(ENABLE_CONFD, $enable_confd)
 
 AM_CONDITIONAL([ENABLE_CONFD], [test x$enable_confd = xTrue])
 
-# --enable-split-query
-ENABLE_SPLIT_QUERY=
-AC_ARG_ENABLE([split-query],
-  [AS_HELP_STRING([--enable-split-query],
-  [enable use of custom query daemon via confd])],
-  [[case "$enableval" in
-      no)
-        enable_split_query=False
-        ;;
-      yes)
-        enable_split_query=True
-        ;;
-      *)
-        echo "Invalid value for enable-confd '$enableval'"
-        exit 1
-        ;;
-    esac
-  ]],
-  [enable_split_query=False])
-AC_SUBST(ENABLE_SPLIT_QUERY, $enable_split_query)
-
-if test x$enable_split_query = xTrue -a x$enable_confd != xTrue; then
-  AC_MSG_ERROR([Split queries require the confd daemon])
-fi
-
 # --with-disk-separator=...
 AC_ARG_WITH([disk-separator],
   [AS_HELP_STRING([--with-disk-separator=STRING],
@@ -548,6 +523,46 @@ if test "$enable_htools" != "no"; then
 fi
 AC_SUBST(HTOOLS)
 
+# --enable-split-query
+ENABLE_SPLIT_QUERY=
+AC_ARG_ENABLE([split-query],
+  [AS_HELP_STRING([--enable-split-query],
+  [enable use of custom query daemon via confd])],
+  [[case "$enableval" in
+      no)
+        enable_split_query=False
+        ;;
+      yes)
+        enable_split_query=True
+        ;;
+      *)
+        echo "Invalid value for enable-confd '$enableval'"
+        exit 1
+        ;;
+    esac
+  ]],
+  [[case "x${enable_confd}x${HTOOLS_NOCURL}x" in
+     xTruexx)
+       enable_split_query=True
+       ;;
+     *)
+       enable_split_query=False
+       ;;
+   esac]])
+AC_SUBST(ENABLE_SPLIT_QUERY, $enable_split_query)
+
+if test x$enable_split_query = xTrue -a x$enable_confd != xTrue; then
+  AC_MSG_ERROR([Split queries require the confd daemon])
+fi
+
+if test x$enable_split_query = xTrue -a x$HTOOLS_NOCURL != x; then
+  AC_MSG_ERROR([Split queries require the htools-rapi feature (curl library)])
+fi
+
+if test x$enable_split_query = xTrue; then
+  AC_MSG_NOTICE([Split query functionality enabled])
+fi
+
 # Check for HsColour
 HTOOLS_APIDOC=no
 AC_ARG_VAR(HSCOLOUR, [HsColour path])
-- 
GitLab