Fix sasl/stdcxx m4 issues
authorBrian Aker <brian@tangent.org>
Mon, 13 Feb 2012 18:47:58 +0000 (10:47 -0800)
committerBrian Aker <brian@tangent.org>
Mon, 13 Feb 2012 18:47:58 +0000 (10:47 -0800)
configure.ac
libmemcached/include.am
libmemcached/sasl.cc
m4/ac_cxx_header_stdcxx_98.m4 [deleted file]
m4/ax_sasl.m4 [new file with mode: 0644]
m4/pandora_have_sasl.m4 [deleted file]

index 6b95e25eec534c3d9de901d434bff7060c825c62..7378dff6198c29289cf8af1cbf6681c603633b6d 100644 (file)
@@ -99,7 +99,6 @@ ENABLE_FNV64_HASH
 ENABLE_MEMASLAP
 PROTOCOL_BINARY_TEST
 ENABLE_DEPRECATED
-PANDORA_HAVE_SASL
 
 AC_CHECK_FUNCS([alarm])
 AC_CHECK_FUNCS([dup2])
@@ -136,7 +135,6 @@ AC_CHECK_HEADERS([cxxabi.h],
                  AC_DEFINE([HAVE_CXXABI_H], [0], [Have cxxabi.h]))
 
 AX_COMPILER_VENDOR
-AC_CXX_HEADER_STDCXX_98
 
 AC_FUNC_ALLOCA
 AC_FUNC_ERROR_AT_LINE
@@ -165,6 +163,18 @@ AC_C_RESTRICT
 
 AX_CXX_GCC_ABI_DEMANGLE
 
+AX_SASL_OPTION
+
+dnl
+dnl The sasl functions should only be visible if we build with sasl support
+dnl
+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)
+
 AX_CHECK_LIBRARY([LIBUUID], [uuid/uuid.h], [uuid], 
                  [
                   LIBUUID_LDFLAGS="-luuid"
@@ -186,17 +196,6 @@ AC_CHECK_LIB([rt], [clock_gettime],
 
 AC_CHECK_LIB([m], [floor])
 
-dnl The sasl functions should only be visible if we build with sasl support
-AS_IF([test "x$ac_cv_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_HEADERS([atomic.h])
 AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],[
       AC_CHECK_FUNCS(atomic_add_64)
@@ -249,6 +248,7 @@ echo "   * C Compiler:                $CC_VERSION"
 echo "   * Assertions enabled:        $ac_cv_assert"
 echo "   * Debug enabled:             $with_debug"
 echo "   * Warnings as failure:       $ac_cv_warnings_as_errors"
+echo "   * SASL support:              $ac_enable_sasl"
 echo ""
 echo "---"
 
index 24d9598215ce303ab4bf10a0e1353a231013540e..d5b2fc76de1d33847d272b0f5503b3a655cf5e57 100644 (file)
@@ -38,6 +38,7 @@ noinst_HEADERS+= \
                 libmemcached/namespace.h \
                 libmemcached/options.hpp \
                 libmemcached/response.h \
+                libmemcached/sasl.hpp \
                 libmemcached/server.hpp \
                 libmemcached/server_instance.h \
                 libmemcached/socket.hpp \
@@ -88,7 +89,7 @@ libmemcached_libmemcached_la_SOURCES+= \
                                       libmemcached/quit.hpp \
                                       libmemcached/response.cc \
                                       libmemcached/result.cc \
-                                      libmemcached/sasl.hpp \
+                                      libmemcached/sasl.cc \
                                       libmemcached/server.cc \
                                       libmemcached/server_list.cc \
                                       libmemcached/server_list.hpp \
@@ -110,11 +111,11 @@ libmemcached_libmemcached_la_LIBADD=
 libmemcached_libmemcached_la_LDFLAGS=
 libmemcached_libmemcached_la_LDFLAGS+= -version-info ${MEMCACHED_LIBRARY_VERSION}
 
-libmemcached_libmemcached_la_LIBADD+= $(LTLIBSASL) $(LTLIBSASL2)
-libmemcached_libmemcached_la_SOURCES += libmemcached/sasl.cc
 if HAVE_SASL
-libmemcached_libmemcached_la_CXXFLAGS+= ${PTHREAD_CFLAGS}
-libmemcached_libmemcached_la_LIBADD+= ${PTHREAD_LIBS}
+libmemcached_libmemcached_la_CXXFLAGS+= $(LIBSASL_CPPFLAGS)
+libmemcached_libmemcached_la_CXXFLAGS+= $(PTHREAD_CFLAGS)
+libmemcached_libmemcached_la_LIBADD+= $(PTHREAD_LIBS)
+libmemcached_libmemcached_la_LIBADD+= $(LIBSASL_LDFLAGS)
 endif
 
 if HAVE_DTRACE
index 902ccd872cf77ee7ede0903730a31c6c9bd96f3d..ce61e3182f93421c5d1fc7c562d957e467df50a5 100644 (file)
 
 #if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT
 
+#if defined(HAVE_LIBSASL) && HAVE_LIBSASL
 #include <sasl/sasl.h>
+#endif
+
 #include <pthread.h>
 
 void memcached_set_sasl_callbacks(memcached_st *ptr,
diff --git a/m4/ac_cxx_header_stdcxx_98.m4 b/m4/ac_cxx_header_stdcxx_98.m4
deleted file mode 100644 (file)
index 856241b..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-# ===========================================================================
-#        http://autoconf-archive.cryp.to/ac_cxx_header_stdcxx_98.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AC_CXX_HEADER_STDCXX_98
-#
-# DESCRIPTION
-#
-#   Check for complete library coverage of the C++1998/2003 standard.
-#
-# LICENSE
-#
-#   Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
-#
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved.
-
-AC_DEFUN([AC_CXX_HEADER_STDCXX_98], [
-  AC_CACHE_CHECK(for ISO C++ 98 include files,
-  ac_cv_cxx_stdcxx_98,
-  [AC_LANG_SAVE
-  AC_LANG_CPLUSPLUS
-  AC_TRY_COMPILE([
-    #include <cassert>
-    #include <cctype>
-    #include <cerrno>
-    #include <cfloat>
-    #include <ciso646>
-    #include <climits>
-    #include <clocale>
-    #include <cmath>
-    #include <csetjmp>
-    #include <csignal>
-    #include <cstdarg>
-    #include <cstddef>
-    #include <cstdio>
-    #include <cstdlib>
-    #include <cstring>
-    #include <ctime>
-
-    #include <algorithm>
-    #include <bitset>
-    #include <complex>
-    #include <deque>
-    #include <exception>
-    #include <fstream>
-    #include <functional>
-    #include <iomanip>
-    #include <ios>
-    #include <iosfwd>
-    #include <iostream>
-    #include <istream>
-    #include <iterator>
-    #include <limits>
-    #include <list>
-    #include <locale>
-    #include <map>
-    #include <memory>
-    #include <new>
-    #include <numeric>
-    #include <ostream>
-    #include <queue>
-    #include <set>
-    #include <sstream>
-    #include <stack>
-    #include <stdexcept>
-    #include <streambuf>
-    #include <string>
-    #include <typeinfo>
-    #include <utility>
-    #include <valarray>
-    #include <vector>
-  ],,
-  ac_cv_cxx_stdcxx_98=yes, ac_cv_cxx_stdcxx_98=no)
-  AC_LANG_RESTORE
-  ])
-  if test "$ac_cv_cxx_stdcxx_98" = yes; then
-    AC_DEFINE(STDCXX_98_HEADERS,,[Define if ISO C++ 1998 header files are present. ])
-  fi
-])
diff --git a/m4/ax_sasl.m4 b/m4/ax_sasl.m4
new file mode 100644 (file)
index 0000000..c11efb9
--- /dev/null
@@ -0,0 +1,54 @@
+# ===========================================================================
+#  http://www.tangent.org/
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_SASL
+#
+# DESCRIPTION
+#
+#   Check for sasl version one or two support.
+#
+# LICENSE
+#
+#   Copyright (c) 2012 Brian Aker <brian@tangent.org>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 1
+
+AC_DEFUN([AX_SASL_OPTION],[
+    AC_REQUIRE([AX_SASL_CHECK])
+    AC_ARG_ENABLE([sasl],
+      [AS_HELP_STRING([--disable-sasl], [Build with sasl support @<:@default=on@:>@])],
+      [ac_enable_sasl="$enableval"],
+      [ac_enable_sasl="yes"])
+
+    AS_IF([test "x$ac_enable_sasl" = "xyes"], [
+      AS_IF([test "x$ax_cv_sasl" = "xyes"], [
+        AC_DEFINE([HAVE_LIBSASL], [ 1 ], [Have libsasl2])
+        ], [
+        AC_DEFINE([HAVE_LIBSASL], [ 0 ], [Have libsasl2])
+        ac_enable_sasl= no 
+        ])
+      ], [
+      AC_DEFINE([HAVE_LIBSASL], [ 0 ], [Have libsasl2])
+      ])
+
+    AM_CONDITIONAL(HAVE_SASL, test "x${ac_enable_sasl}" = "xyes")
+
+    ])
+
+AC_DEFUN([AX_SASL_CHECK],[
+
+    AX_CHECK_LIBRARY([LIBSASL], [sasl/sasl.h], [sasl2],[
+      LIBSASL_LDFLAGS="-lsasl2"
+      ax_cv_sasl=yes
+      ], [
+      ax_cv_sasl=no 
+      ])
+    ])
diff --git a/m4/pandora_have_sasl.m4 b/m4/pandora_have_sasl.m4
deleted file mode 100644 (file)
index ca4a21d..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-dnl  Copyright (C) 2009 Sun Microsystems, Inc.
-dnl This file is free software; Sun Microsystems, Inc.
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([_PANDORA_SEARCH_SASL],[
-  AC_REQUIRE([AC_LIB_PREFIX])
-
-  dnl --------------------------------------------------------------------
-  dnl  Check for sasl
-  dnl --------------------------------------------------------------------
-  AC_ARG_ENABLE([sasl],
-    [AS_HELP_STRING([--disable-sasl],
-      [Build with sasl support @<:@default=on@:>@])],
-    [ac_enable_sasl="$enableval"],
-    [ac_enable_sasl="yes"])
-
-  AS_IF([test "x$ac_enable_sasl" = "xyes"],
-    [
-      AC_LIB_HAVE_LINKFLAGS(sasl,,[
-        #include <stdlib.h>
-        #include <sasl/sasl.h>
-      ],[
-        sasl_server_init(NULL, NULL);
-      ])
-
-      AS_IF([test "x${ac_cv_libsasl}" != "xyes" ],
-            [
-              AC_LIB_HAVE_LINKFLAGS(sasl2,,[
-                #include <stdlib.h>
-                #include <sasl/sasl.h>
-              ],[
-                sasl_server_init(NULL, NULL);
-              ])
-              HAVE_LIBSASL="$HAVE_LIBSASL2"
-              LIBSASL="$LIBSASL2"
-              LIBSASL_PREFIX="$LIBSASL2_PREFIX"
-             LTLIBSASL="$LT_LIBSASL2"
-            ])
-    ])
-
-  AS_IF([test "x${ac_cv_libsasl}" = "xyes" -o "x${ac_cv_libsasl2}" = "xyes"],
-        [ac_cv_sasl=yes],
-        [ac_cv_sasl=no])
-
-  AM_CONDITIONAL(HAVE_LIBSASL, [test "x${ac_cv_libsasl}" = "xyes"])
-  AM_CONDITIONAL(HAVE_LIBSASL2, [test "x${ac_cv_libsasl2}" = "xyes"])
-  AM_CONDITIONAL(HAVE_SASL, [test "x${ac_cv_sasl}" = "xyes"])
-])
-
-AC_DEFUN([PANDORA_HAVE_SASL],[
-  AC_REQUIRE([_PANDORA_SEARCH_SASL])
-])
-
-AC_DEFUN([PANDORA_REQUIRE_SASL],[
-  AC_REQUIRE([_PANDORA_SEARCH_SASL])
-  AS_IF([test "x${ac_cv_sasl}" = "xno"],
-    AC_MSG_ERROR([SASL (libsasl or libsasl2) is required for ${PACKAGE}]))
-])
-
-AC_DEFUN([_PANDORA_SEARCH_LIBSASL],[
-  AC_REQUIRE([AC_LIB_PREFIX])
-
-  dnl --------------------------------------------------------------------
-  dnl  Check for libsasl
-  dnl --------------------------------------------------------------------
-
-  AC_ARG_ENABLE([libsasl],
-    [AS_HELP_STRING([--disable-libsasl],
-      [Build with libsasl support @<:@default=on@:>@])],
-    [ac_enable_libsasl="$enableval"],
-    [ac_enable_libsasl="yes"])
-
-  AS_IF([test "x$ac_enable_libsasl" = "xyes"],[
-    AC_LIB_HAVE_LINKFLAGS(sasl,,[
-      #include <stdlib.h>
-      #include <sasl/sasl.h>
-    ],[
-      sasl_server_init(NULL, NULL);
-    ])
-  ],[
-    ac_cv_libsasl="no"
-  ])
-
-  AM_CONDITIONAL(HAVE_LIBSASL, [test "x${ac_cv_libsasl}" = "xyes"])
-])
-
-AC_DEFUN([PANDORA_HAVE_LIBSASL],[
-  AC_REQUIRE([_PANDORA_SEARCH_LIBSASL])
-])
-
-AC_DEFUN([PANDORA_REQUIRE_LIBSASL],[
-  AC_REQUIRE([_PANDORA_SEARCH_LIBSASL])
-  AS_IF([test "x${ac_cv_libsasl}" = "xno"],
-    AC_MSG_ERROR([libsasl is required for ${PACKAGE}]))
-])
-
-AC_DEFUN([_PANDORA_SEARCH_LIBSASL2],[
-  AC_REQUIRE([AC_LIB_PREFIX])
-
-  dnl --------------------------------------------------------------------
-  dnl  Check for libsasl2
-  dnl --------------------------------------------------------------------
-
-  AC_ARG_ENABLE([libsasl2],
-    [AS_HELP_STRING([--disable-libsasl2],
-      [Build with libsasl2 support @<:@default=on@:>@])],
-    [ac_enable_libsasl2="$enableval"],
-    [ac_enable_libsasl2="yes"])
-
-  AS_IF([test "x$ac_enable_libsasl2" = "xyes"],[
-    AC_LIB_HAVE_LINKFLAGS(sasl2,,[
-      #include <stdlib.h>
-      #include <sasl2/sasl2.h>
-    ],[
-      sasl2_server_init(NULL, NULL);
-    ])
-  ],[
-    ac_cv_libsasl2="no"
-  ])
-
-  AM_CONDITIONAL(HAVE_LIBSASL2, [test "x${ac_cv_libsasl2}" = "xyes"])
-])
-
-AC_DEFUN([PANDORA_HAVE_LIBSASL2],[
-  AC_REQUIRE([_PANDORA_SEARCH_LIBSASL2])
-])
-
-AC_DEFUN([PANDORA_REQUIRE_LIBSASL2],[
-  AC_REQUIRE([_PANDORA_SEARCH_LIBSASL2])
-  AS_IF([test "x${ac_cv_libsasl2}" = "xno"],
-    AC_MSG_ERROR([libsasl2 is required for ${PACKAGE}]))
-])