+AX_PLATFORM
+
+m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
+
+AX_CXX_HEADER_STDCXX_98
+AS_IF([test "x$ax_cv_cxx_stdcxx_98" = "xno"],
+ [AC_MSG_ERROR([Your system lacks a new enough C++ compiler])])
+
+AC_DEFUN([LIBMEMCACHED_PROTOCOL],
+ [AC_ARG_ENABLE([libmemcachedprotocol],
+ [AS_HELP_STRING([--enable-libmemcachedprotocol],
+ [Enable libmemcachedprotocol])],
+ [ax_enable_libmemcachedprotocol=yes],
+ [ax_enable_libmemcachedprotocol=no])
+
+ AM_CONDITIONAL([BUILD_LIBMEMCACHED_PROTOCOL],[test "$ax_enable_libmemcachedprotocol" = "yes"])
+
+ AC_MSG_CHECKING([for libmemcachedprotocol])
+ AC_MSG_RESULT([$ax_enable_libmemcachedprotocol])
+ ])
+LIBMEMCACHED_PROTOCOL
+
+# Adding support for libtest
+m4_include([libtest/yatl.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_GEARMAN],[false])
+
+# Specialty checks
+AX_CXX_CINTTYPES
+CONFIG_EXTRA
+DETECT_BYTEORDER
+SETSOCKOPT_SANITY
+ENABLE_HSIEH_HASH
+ENABLE_MURMUR_HASH
+ENABLE_FNV64_HASH
+ENABLE_MEMASLAP
+PROTOCOL_BINARY_TEST
+ENABLE_DEPRECATED
+
+# Checks for programs.
+AC_CHECK_PROGS([DPKG_GENSYMBOLS],[dpkg-gensymbols])
+AC_CHECK_PROGS([LEX],['flex'],[:])
+AC_CHECK_PROGS([PERL],[perl])
+AC_CHECK_PROGS([VALGRIND],['valgrind'])
+AC_CHECK_PROGS([WINE],['wine'])
+AC_CHECK_PROGS([YACC],['bison --warnings=all'],[:])
+AC_PROG_AWK
+AC_PROG_MKDIR_P
+AC_PROG_SED
+AX_PROG_MEMCACHED
+AX_PROG_SPHINX_BUILD(,[AC_MSG_WARN([sphinx-build version 1.0 or greater is required to build man pages])])
+AX_WITH_PROG([LCOV],[lcov])
+AX_WITH_PROG([LCOV_GENHTML],[genhtml])
+AC_DEFINE([HAVE_MEMCACHED_SASL_BINARY],[0],[If Memcached binary with sasl support is available])
+
+# Checks for libraries.
+AC_SEARCH_LIBS([getopt_long],[gnugetopt])
+AC_SEARCH_LIBS([gethostbyname],[nsl])
+
+# Checks for header files.
+AC_CHECK_HEADERS_ONCE([arpa/inet.h])
+AC_CHECK_HEADERS_ONCE([errno.h])
+AC_CHECK_HEADERS_ONCE([execinfo.h])
+AC_CHECK_HEADERS_ONCE([fcntl.h])
+AC_CHECK_HEADERS_ONCE([features.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])
+AC_CHECK_HEADERS_ONCE([mach/mach.h])
+AC_CHECK_HEADERS_ONCE([malloc.h])
+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])
+AC_CHECK_HEADERS_ONCE([stddef.h])
+AC_CHECK_HEADERS_ONCE([stdio.h])
+AC_CHECK_HEADERS_ONCE([stdlib.h])
+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/types.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_ONCE([winsock2.h])
+AC_CHECK_HEADERS_ONCE([ws2tcpip.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+
+AC_CHECK_FUNCS([alarm])
+AC_CHECK_FUNCS([atexit])
+AC_CHECK_FUNCS([clock_gettime])
+AC_CHECK_FUNCS([dup2])
+AC_CHECK_FUNCS([fcntl])
+AC_CHECK_FUNCS([floor])
+AC_CHECK_FUNCS([getcwd])
+AC_CHECK_FUNCS([getline])
+AC_CHECK_FUNCS([gettimeofday])
+AC_CHECK_FUNCS([inet_ntoa])
+AC_CHECK_FUNCS([memchr])
+AC_CHECK_FUNCS([memmove])
+AC_CHECK_FUNCS([memset])
+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])
+AC_CHECK_FUNCS([strchr])
+AC_CHECK_FUNCS([strdup])
+AC_CHECK_FUNCS([strerror])
+AC_CHECK_FUNCS([strstr])
+AC_CHECK_FUNCS([strtol])
+AC_CHECK_FUNCS([strtoul])
+AC_CHECK_FUNCS([strtoull])
+AC_FUNC_ALLOCA
+AC_FUNC_ERROR_AT_LINE
+AC_FUNC_FORK
+AC_FUNC_STRERROR_R
+
+AC_CHECK_HEADER([umem.h],
+ [AC_DEFINE([HAVE_UMEM_H],[1],[Define this if you have umem.h])
+ build_cache=no],
+ [build_cache=yes])