Fixes for scanner/parser from OSX.
[awesomized/libmemcached] / configure.ac
index 0d421155b193b60771b7b578714ed3a27cae74d3..de966c8074273ba8253ba3ad34f9a7052b02dde0 100644 (file)
@@ -6,7 +6,7 @@
 # Use and distribution licensed under the BSD license.  See
 # the COPYING file in this directory for full text.
 
-AC_INIT([libmemcached],[1.0.14],[http://libmemcached.org/])
+AC_INIT([libmemcached],[1.0.15],[http://libmemcached.org/])
 AC_CONFIG_AUX_DIR([build-aux])
 AC_CONFIG_MACRO_DIR([m4])
 
@@ -19,6 +19,7 @@ AM_INIT_AUTOMAKE([1.11 color-tests -Wno-portability subdir-objects foreign tar-u
 AC_PREREQ([2.61])
 
 AC_CONFIG_HEADERS([mem_config.h:mem_config.in])dnl Keep filename to 8.3 for MS-DOS.
+AC_SUBST([AUTOHEADER_FILE],[mem_config.h])
 AC_CONFIG_SRCDIR([libmemcached/memcached.cc])
 
 #shared library versioning
@@ -47,6 +48,7 @@ m4_include([libhashkit/include.m4])
 LT_PREREQ([2.2])
 LT_INIT
 LT_LANG([C++])
+LT_LIB_M
 
 AX_ASSERT
 
@@ -75,18 +77,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
@@ -109,10 +110,10 @@ AC_SEARCH_LIBS([gethostbyname],[nsl])
 
 # Checks for header files.
 AC_CHECK_HEADERS_ONCE([arpa/inet.h])
-AC_CHECK_HEADERS_ONCE([dlfcn.h])
 AC_CHECK_HEADERS_ONCE([errno.h])
 AC_CHECK_HEADERS_ONCE([execinfo.h])
 AC_CHECK_HEADERS_ONCE([fcntl.h])
+AC_CHECK_HEADERS_ONCE([fnmatch.h])
 AC_CHECK_HEADERS_ONCE([inttypes.h])
 AC_CHECK_HEADERS_ONCE([libintl.h])
 AC_CHECK_HEADERS_ONCE([limits.h])
@@ -122,6 +123,7 @@ AC_CHECK_HEADERS_ONCE([math.h])
 AC_CHECK_HEADERS_ONCE([netdb.h])
 AC_CHECK_HEADERS_ONCE([netinet/in.h])
 AC_CHECK_HEADERS_ONCE([netinet/tcp.h])
+AC_CHECK_HEADERS_ONCE([poll.h])
 AC_CHECK_HEADERS_ONCE([pthread.h])
 AC_CHECK_HEADERS_ONCE([spawn.h])
 AC_CHECK_HEADERS_ONCE([stdarg.h])
@@ -132,13 +134,14 @@ AC_CHECK_HEADERS_ONCE([sys/socket.h])
 AC_CHECK_HEADERS_ONCE([sys/sysctl.h])
 AC_CHECK_HEADERS_ONCE([sys/time.h])
 AC_CHECK_HEADERS_ONCE([sys/un.h])
+AC_CHECK_HEADERS_ONCE([sys/wait.h])
 AC_CHECK_HEADERS_ONCE([syslog.h])
 AC_CHECK_HEADERS_ONCE([time.h])
 AC_CHECK_HEADERS_ONCE([unistd.h])
 
 # Windows only
-AC_CHECK_HEADERS([winsock2.h])
-AC_CHECK_HEADERS([ws2tcpip.h])
+AC_CHECK_HEADERS_ONCE([winsock2.h])
+AC_CHECK_HEADERS_ONCE([ws2tcpip.h])
 
 # Checks for typedefs, structures, and compiler characteristics.
 
@@ -161,6 +164,7 @@ AC_CHECK_FUNCS([pipe2])
 AC_CHECK_FUNCS([putenv])
 AC_CHECK_FUNCS([select])
 AC_CHECK_FUNCS([setenv])
+AC_CHECK_FUNCS([sigignore])
 AC_CHECK_FUNCS([socket])
 AC_CHECK_FUNCS([sqrt])
 AC_CHECK_FUNCS([strcasecmp])
@@ -185,6 +189,7 @@ AM_CONDITIONAL([BUILD_CACHE],[test "x$build_cache" = "xyes"])
 
 AX_COMPILER_VENDOR
 
+AC_CHECK_TYPES([in_port_t])
 AC_CHECK_TYPES([ptrdiff_t])
 AC_HEADER_STDBOOL
 AC_TYPE_INT16_T
@@ -207,33 +212,16 @@ 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])])
-
-# 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_CHECK_LIB([m],[floor])
-AC_CHECK_FUNCS([sigignore])
+             [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 (used in libhostile)
+AX_DLOPEN
 
 AC_CHECK_HEADERS([atomic.h])
 AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],
@@ -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],
@@ -263,7 +251,6 @@ AC_CHECK_FUNCS([setppriv],
                                 build_solaris_privs=yes])
                ])
 
-AC_CHECK_HEADERS_ONCE([winsock2.h poll.h sys/wait.h fnmatch.h])
 AM_CONDITIONAL([BUILD_POLL],[test "x$ac_cv_header_poll_h" = "xno"])
 AM_CONDITIONAL([BUILD_WIN32_WRAPPERS],[test "x$ac_cv_header_winsock2_h" = "xyes"])
 AS_IF([test "x$ac_cv_header_winsock2_h" = "xyes"],
@@ -275,15 +262,28 @@ SOCKET_SEND_FLAGS
 
 AX_UUID_GENERATE_TIME_SAFE
 
+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
 
-AX_PTHREAD(, [AC_MSG_ERROR([could not find libpthread])])
-AX_PTHREAD_TIMEDJOIN_NP
 
-# backtrace() does not work with static builds.
-AS_IF([test "x$enable_static" = "xyes"],
-      [AC_DEFINE([AX_ENABLE_BACKTRACE],[1],[Support for backtrace().])])
+# backtrace(), others require shared builds
+AS_IF([test "x$enable_shared" = "xyes"],
+      [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().])])
+AM_CONDITIONAL([SHARED_ENABLED],[test "x$enable_shared" = "xyes"])
 
 PANDORA_ENABLE_DTRACE
+HAVE_GCC_ATOMICS
 AX_ENDIAN
 AX_ASSERT
 AX_HARDEN_COMPILER_FLAGS
@@ -312,6 +312,7 @@ echo "   * CPP Flags:                 $CPPFLAGS"
 echo "   * LIB Flags:                 $LIB"
 echo "   * Assertions enabled:        $ax_enable_assert"
 echo "   * Debug enabled:             $ax_enable_debug"
+echo "   * Shared:                    $enable_shared"
 echo "   * Warnings as failure:       $ac_cv_warnings_as_errors"
 echo "   * SASL support:              $ac_enable_sasl"
 echo "   * make -j:                   $enable_jobserver"