-AC_HEADER_TIME
-AC_TYPE_SIZE_T
-AC_SEARCH_LIBS(getopt_long, gnugetopt)
-AC_SEARCH_LIBS(socket, socket)
-AC_SEARCH_LIBS(gethostbyname, nsl)
-
-save_LIBS="$LIBS"
-LIBS="$LIBS -lm"
-AC_LINK_IFELSE(
- [AC_LANG_PROGRAM(
- [[
-#include <stdlib.h>
- ]],[[
- float f= floorf((float) 1.0);
- ]],
- [LIBM="-lm"],[LIBM=""])])
-
-AC_SUBST(LIBM)
-LIBS="$save_LIBS"
-AC_SEARCH_LIBS(floorf, m)
-
-
-sinclude(config/pod2man.m4)
-sinclude(config/debug.m4)
-sinclude(config/dtrace.m4)
-sinclude(config/byteorder.m4)
-sinclude(config/64bit.m4)
-sinclude(config/protocol_binary.m4)
-sinclude(config/memcached.m4)
-sinclude(config/setsockopt.m4)
-sinclude(config/hsieh.m4)
-sinclude(config/util.m4)
-
-dnl This is likely subverted by vpath builds. How do we find the original
-dnl source dir in the configure step of a vpath build?
-if test -d ".hg"
-then
- building_from_hg=yes
-else
- building_from_hg=no
-fi
-
-# We only support GCC and Sun's forte at the moment
-if test "$GCC" = "yes"
-then
- if test "$building_from_hg" = "yes"
- then
- CFLAGS="-Werror $CFLAGS"
- CXXFLAGS="-Werror $CXXFLAGS"
- fi
-
- CFLAGS="-W -std=iso9899:1999 -Wall -Wextra -Wno-strict-aliasing -pedantic -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -O3 -ggdb $CFLAGS"
- CXXFLAGS="-W -Wall -Wextra -Wno-strict-aliasing -pedantic -Wundef -Woverloaded-virtual -Wnon-virtual-dtor -Wctor-dtor-privacy -Wold-style-cast -Weffc++ -Wconversion -Wmissing-declarations -Wredundant-decls -O3 -ggdb $CXXFLAGS"
-
- if test "$ENABLE_DEBUG" = "yes"
- then
- CFLAGS="$CFLAGS -ggdb -DHAVE_DEBUG"
- fi
-else
- CFLAGS="-Xa -xstrconst -mt -D_FORTEC_ -errfmt=error -errwarn -errshort=tags $CFLAGS"
- CXXFLAGS="+w +w2 -xwe -mt -D_FORTEC_ $CXXFLAGS"
- if test "$ENABLE_DEBUG" = "yes"
- then
- CFLAGS="$CFLAGS -DHAVE_DEBUG"
- CXXFLAGS="$CXXFLAGS -DHAVE_DEBUG"
- fi
-fi
-
-
-AM_CPPFLAGS="-I\$(top_srcdir) -I\$(top_builddir) ${CPPFLAGS}"
-AM_CFLAGS="${CFLAGS}"
-AM_CXXFLAGS="${CXXFLAGS}"
-
-AC_SUBST([AM_CPPFLAGS])
-AC_SUBST([AM_CFLAGS])
-AC_SUBST([AM_CXXFLAGS])
-
-dnl We've collected the flags in AM_*FLAGS now, so blank these.
-CFLAGS=""
-CXXFLAGS=""
-CPPFLAGS=""
-
-AC_CONFIG_FILES([Makefile clients/Makefile tests/Makefile docs/Makefile libmemcached/Makefile libmemcachedutil/Makefile support/Makefile support/libmemcached.pc support/libmemcached.spec support/libmemcached-fc.spec])
+AC_C_INLINE
+AC_C_VOLATILE
+AC_C_RESTRICT
+
+AX_CXX_GCC_ABI_DEMANGLE
+
+AX_LIBEVENT
+
+AC_CHECK_LIB([rt],[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 (used in libhostile)
+AX_DLOPEN
+
+AC_CHECK_HEADERS([atomic.h])
+AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],
+ [AC_CHECK_FUNCS([atomic_add_64])
+ AC_CHECK_FUNCS([atomic_add_32])
+ AS_IF([test "x$ac_cv_func_atomic_add_64" = "xyes" -a "x$ac_cv_func_atomic_add_32" = "xyes"],
+ [AC_DEFINE([USE_ATOMIC_H],[1],[Define to true if you want to use functions from atomic.h])])])
+
+AC_DEFINE([HAVE_LIBDRIZZLE],[0],[Support for libdrizzle])
+AC_DEFINE([HAVE_DRIZZLED_BINARY],[0],[Support for DrizzleD])
+AC_DEFINE([DRIZZLED_BINARY],[0],[Support for DrizzleD])
+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])
+
+# 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],
+ [1],
+ [Define this if you have an implementation of drop_privileges()])
+ build_solaris_privs=yes])
+ ])
+
+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"],
+ [AM_LDFLAGS="$AM_LDFLAGS -lws2_32"
+ AM_CFLAGS="$AM_CFLAGS $NO_WERROR"
+ AM_CXXFLAGS="$AM_CXXFLAGS $NO_WERROR"
+ ])
+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
+
+# backtrace(), others require shared builds
+AC_DEFUN([__ENABLE_SHARED],
+ [AC_REQUIRE([AX_PLATFORM])
+ AS_IF([test "x${TARGET_WINDOWS}" = "xtrue"],[enable_shared=no])
+ 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
+
+AX_AM_JOBSERVER([yes])
+
+AC_CONFIG_FILES([Makefile
+ docs/conf.py
+ libmemcached-1.0/configure.h
+ support/libmemcached.pc
+ support/libmemcached.spec
+ ])