build without zookeeperlib
[distributedratelimiting.git] / configure.in
index 2f888fb..7bd3640 100644 (file)
@@ -65,10 +65,6 @@ dnl test for MySQL
 dnl
 AC_ARG_WITH(mysql,
  --with-mysql=<directory>              mysql installed in <directory>,[
-if test $withval == no
-then
-    AC_MSG_WARN("mysql disabled.")
-else
 if test $withval != yes
 then
         dir=$withval
@@ -126,8 +122,7 @@ else
                AC_MSG_RESULT(found new MySQL)
        fi
 
-fi
-fi
+fi      
 ])      
 
 
@@ -146,6 +141,86 @@ AC_ARG_WITH(mysql-log-ip-as-string,
    AC_MSG_WARN(the use of --with-mysql-log-ip-as-string is discouraged)
 ])
 
+dnl
+dnl test for libxml2
+dnl
+AC_ARG_WITH(libxml2, --with-libxml=<directory>         libxml2 installed in <directory>,[
+if test $withval != yes
+then
+        dir=$withval
+else
+        dir="/usr/local"
+fi])
+
+libxmldir=""
+AC_MSG_CHECKING(for LIBXML2 files)
+for d in $dir/bin /usr/bin /usr/local/bin /usr/local/libxml2/bin /opt/libxml2/bin /opt/packages/libxml2/bin
+do
+    if test -x $d/xml2-config
+    then
+        AC_MSG_RESULT(found xml2-config in $d)
+        libxmldir=$d
+        break
+    fi
+done
+
+if test x$libxmldir = x
+then
+    AC_MSG_ERROR(xml2-config not found)
+else
+    XMLINCLUDES=`$libxmldir/xml2-config --cflags`
+    AC_SUBST(XMLINCLUDES)
+
+    XMLLIBS=`$libxmldir/xml2-config --libs`
+    AC_SUBST(XMLLIBS)
+fi
+
+dnl
+dnl check for zookeeper library
+dnl
+zkdir="/usr/local/lib"
+
+AC_ARG_WITH(zookeeper, --with-zookeeperlib=<directory>         zookeeper shared object located in <directory>,[
+if test $withval = no
+then
+    zkdir=no
+    AC_MSG_WARN(Building without zookeeper support.)
+else
+    zkdir=$withval
+fi])
+
+zklib=""
+if test $zkdir != no
+then
+    AC_MSG_CHECKING(for zookeeper libraries)
+    for d in $zkdir /usr/local/lib /lib /usr/lib
+    do
+        if test -f $d/libzookeeper_mt.so
+        then
+            AC_MSG_RESULT(found libzookeeper_mt.so in $d)
+            zklib=$d/libzookeeper_mt.so
+            break
+        fi
+    done
+
+    if test x$zklib = x
+    then
+        dnl no zklib
+        AC_MSG_WARN(Zookeeper libraries not found.)
+        ZKLIBS=""
+        AC_SUBST(ZKLIBS)
+
+        ZKFLAGS=""
+        AC_SUBST(ZKFLAGS)
+    else
+        dnl found it
+        ZKLIBS=$zklib
+        AC_SUBST(ZKLIBS)
+
+        ZKFLAGS="-DTHREADED -DBUILD_ZOOKEEPER"
+        AC_SUBST(ZKFLAGS)
+    fi
+fi
 
 dnl
 dnl test for PostgreSQL