First pass through fixing SASL.
[awesomized/libmemcached] / configure.ac
index 0d421155b193b60771b7b578714ed3a27cae74d3..451d139d9607035227f8b3530b50047f18212961 100644 (file)
@@ -75,18 +75,17 @@ LIBMEMCACHED_PROTOCOL
 # Adding support for libtest
 m4_include([libtest/yatl.m4])
 
-m4_include([m4/memcached_sasl.m4])
-m4_include([m4/gearmand.m4])
-m4_include([m4/libgearman.m4])
+CHECK_FOR_GEARMAND
+CHECK_FOR_LIBGEARMAND
 
-AM_CONDITIONAL([BUILDING_LIBMEMCACHED], [true])
-AM_CONDITIONAL([HAVE_LIBMEMCACHED], [false])
-AM_CONDITIONAL([HAVE_LIBDRIZZLE], [false])
-AC_DEFINE([HAVE_LIBMEMCACHED], [1], [Enables libmemcached Support])
+AM_CONDITIONAL([BUILDING_LIBMEMCACHED],[true])
+AM_CONDITIONAL([HAVE_LIBMEMCACHED],[false])
+AM_CONDITIONAL([HAVE_LIBDRIZZLE],[false])
+AC_DEFINE([HAVE_LIBMEMCACHED],[1],[Enables libmemcached Support])
 
-AM_CONDITIONAL([BUILDING_GEARMAN], [false])
+AM_CONDITIONAL([BUILDING_GEARMAN],[false])
 
-dnl Specialty checks
+# Specialty checks
 AX_CXX_CINTTYPES
 CONFIG_EXTRA
 DETECT_BYTEORDER
@@ -207,30 +206,19 @@ AC_C_RESTRICT
 
 AX_CXX_GCC_ABI_DEMANGLE
 
-AX_SASL_CHECK
 AX_LIBEVENT
 
-#
-# The sasl functions should only be visible if we build with sasl support
-#
-AS_IF([test "x$ac_enable_sasl" = "xyes"],
-      [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 1"],
-      [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 0"])
-AC_SUBST([LIBMEMCACHED_WITH_SASL_SUPPORT])
-
 AC_CHECK_LIB([rt],[clock_gettime],
-             [RT_LIB="-lrt"
-              AC_SUBST(RT_LIB)
-              AC_DEFINE([HAVE_CLOCK_GETTIME], [ 1 ], [Have clock_gettime])],
-              [AC_DEFINE([HAVE_CLOCK_GETTIME], [ 0 ], [Have clock_gettime])])
+             [AC_SUBST([RT_LIB],[-lrt])
+             AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Have clock_gettime])],
+             [AC_DEFINE([HAVE_CLOCK_GETTIME],[0],[Have clock_gettime])])
 
 # Check for the ability to call dlopen
 AS_IF([test "x$enable_static" = "xyes"],
       [AC_CHECK_LIB([dl],[dlopen],
-                    [DL_LIB="-ldl"
-                     AC_SUBST([DL_LIB])
-                     AC_DEFINE([HAVE_LIBDL],[1],[Have dlopen])])],
-                     [AC_DEFINE([HAVE_LIBDL], [0], [Have dlopen])])
+                    [AC_SUBST([DL_LIB],[-ldl])
+                    AC_DEFINE([HAVE_LIBDL],[1],[Have dlopen])])],
+                    [AC_DEFINE([HAVE_LIBDL], [0], [Have dlopen])])
 
 AC_CHECK_LIB([m],[floor])
 AC_CHECK_FUNCS([sigignore])
@@ -249,12 +237,12 @@ AC_DEFINE([GEARMAND_BLOBSLAP_WORKER],[0],[Support for Gearman Blobslap worker])
 AC_DEFINE([HAVE_LIBPQ],[0],[Support for Postgres])
 AC_DEFINE([HAVE_LIBCURL],[0],[Support for libcurl])
 
-dnl Check for the requirements for running memcached with less privileges
-dnl than the default privilege set. On Solaris we need setppriv and priv.h
-dnl If you want to add support for other platforms you should check for
-dnl your requirements, define HAVE_DROP_PRIVILEGES, and make sure you add
-dnl the source file containing the implementation into memcached_SOURCE
-dnl in Makefile.am
+# Check for the requirements for running memcached with less privileges
+# than the default privilege set. On Solaris we need setppriv and priv.h
+# If you want to add support for other platforms you should check for
+# your requirements, define HAVE_DROP_PRIVILEGES, and make sure you add
+# the source file containing the implementation into memcached_SOURCE
+# in Makefile.am
 AC_CHECK_FUNCS([setppriv],
                [AC_CHECK_HEADER([priv.h],
                                 [AC_DEFINE([HAVE_DROP_PRIVILEGES],
@@ -276,8 +264,20 @@ SOCKET_SEND_FLAGS
 AX_UUID_GENERATE_TIME_SAFE
 
 
-AX_PTHREAD(, [AC_MSG_ERROR([could not find libpthread])])
-AX_PTHREAD_TIMEDJOIN_NP
+AC_DEFUN([CHECK_FOR_PTHREAD_AND_SASL],
+         [AX_PTHREAD(, [AC_MSG_ERROR([could not find libpthread])])
+         AX_PTHREAD_TIMEDJOIN_NP
+
+         # The sasl functions should only be visible if we build with sasl support
+         #
+         AX_SASL_OPTION
+         AS_IF([test "x$ac_enable_sasl" = xyes],
+               [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 1"],
+               [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 0"])
+         AC_SUBST([LIBMEMCACHED_WITH_SASL_SUPPORT])
+         ])
+CHECK_FOR_PTHREAD_AND_SASL
+
 
 # backtrace() does not work with static builds.
 AS_IF([test "x$enable_static" = "xyes"],
@@ -313,7 +313,7 @@ echo "   * LIB Flags:                 $LIB"
 echo "   * Assertions enabled:        $ax_enable_assert"
 echo "   * Debug enabled:             $ax_enable_debug"
 echo "   * Warnings as failure:       $ac_cv_warnings_as_errors"
-echo "   * SASL support:              $ac_enable_sasl"
+echo "   * SASL support:              $ax_sasl_option"
 echo "   * make -j:                   $enable_jobserver"
 echo "   * VCS checkout:              $ac_cv_vcs_checkout"
 echo ""