From: Brian Aker Date: Mon, 13 Feb 2012 18:47:58 +0000 (-0800) Subject: Fix sasl/stdcxx m4 issues X-Git-Tag: 1.0.5~54 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=dfd32abf4991c32007288e57ca5a0993778dd0e8;p=awesomized%2Flibmemcached Fix sasl/stdcxx m4 issues --- diff --git a/configure.ac b/configure.ac index 6b95e25e..7378dff6 100644 --- a/configure.ac +++ b/configure.ac @@ -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 "---" diff --git a/libmemcached/include.am b/libmemcached/include.am index 24d95982..d5b2fc76 100644 --- a/libmemcached/include.am +++ b/libmemcached/include.am @@ -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 diff --git a/libmemcached/sasl.cc b/libmemcached/sasl.cc index 902ccd87..ce61e318 100644 --- a/libmemcached/sasl.cc +++ b/libmemcached/sasl.cc @@ -40,7 +40,10 @@ #if defined(LIBMEMCACHED_WITH_SASL_SUPPORT) && LIBMEMCACHED_WITH_SASL_SUPPORT +#if defined(HAVE_LIBSASL) && HAVE_LIBSASL #include +#endif + #include 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 index 856241bc..00000000 --- a/m4/ac_cxx_header_stdcxx_98.m4 +++ /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 -# -# 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 - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - ],, - 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 index 00000000..c11efb9c --- /dev/null +++ b/m4/ax_sasl.m4 @@ -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 +# +# 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 index ca4a21dc..00000000 --- a/m4/pandora_have_sasl.m4 +++ /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 - #include - ],[ - sasl_server_init(NULL, NULL); - ]) - - AS_IF([test "x${ac_cv_libsasl}" != "xyes" ], - [ - AC_LIB_HAVE_LINKFLAGS(sasl2,,[ - #include - #include - ],[ - 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 - #include - ],[ - 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 - #include - ],[ - 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}])) -])