2 # Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/
3 # Copyright (C) 2006-2010 Brian Aker, Monty Taylor, Trond Norbye
6 # Use and distribution licensed under the BSD license. See
7 # the COPYING file in this directory for full text.
9 AC_INIT([libmemcached],[1.0.17],[http://libmemcached.org/])
10 AC_CONFIG_AUX_DIR([build-aux])
11 AC_CONFIG_MACRO_DIR([m4])
15 AC_USE_SYSTEM_EXTENSIONS
17 AM_INIT_AUTOMAKE([1.11 color-tests -Wno-portability subdir-objects foreign tar-ustar])
21 AC_CONFIG_HEADERS([mem_config.h:mem_config.in])dnl Keep filename to 8.3 for MS-DOS.
22 AC_SUBST([AUTOHEADER_FILE],[mem_config.h])
23 AC_CONFIG_SRCDIR([libmemcached/memcached.cc])
25 #shared library versioning
26 MEMCACHED_UTIL_LIBRARY_VERSION=2:0:0
27 MEMCACHED_PROTOCAL_LIBRARY_VERSION=0:0:0
28 MEMCACHED_LIBRARY_VERSION=11:0:0
32 # current:revision:age
34 # | | +- increment if interfaces have been added
35 # | | set to zero if interfaces have been removed or changed
36 # | +- increment if source code has changed
37 # | set to zero if current is incremented
38 # +- increment if interfaces have been added, removed or changed
39 AC_SUBST([MEMCACHED_UTIL_LIBRARY_VERSION])
40 AC_SUBST([MEMCACHED_PROTOCAL_LIBRARY_VERSION])
41 AC_SUBST([MEMCACHED_LIBRARY_VERSION])
43 AX_HEX_VERSION([LIBMEMCACHED],[$VERSION])
44 AX_HEX_VERSION([LIBHASHKIT],[1.0.0])
46 m4_include([libhashkit/include.m4])
57 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
59 AX_CXX_HEADER_STDCXX_98
60 AS_IF([test "x$ax_cv_cxx_stdcxx_98" = "xno"],
61 [AC_MSG_ERROR([Your system lacks a new enough C++ compiler])])
63 AC_DEFUN([LIBMEMCACHED_PROTOCOL],
64 [AC_ARG_ENABLE([libmemcachedprotocol],
65 [AS_HELP_STRING([--enable-libmemcachedprotocol],
66 [Enable libmemcachedprotocol])],
67 [ax_enable_libmemcachedprotocol=yes],
68 [ax_enable_libmemcachedprotocol=no])
70 AM_CONDITIONAL([BUILD_LIBMEMCACHED_PROTOCOL],[test "$ax_enable_libmemcachedprotocol" = "yes"])
72 AC_MSG_CHECKING([for libmemcachedprotocol])
73 AC_MSG_RESULT([$ax_enable_libmemcachedprotocol])
77 # Adding support for libtest
78 m4_include([libtest/yatl.m4])
83 AM_CONDITIONAL([BUILDING_LIBMEMCACHED],[true])
84 AM_CONDITIONAL([HAVE_LIBMEMCACHED],[false])
85 AM_CONDITIONAL([HAVE_LIBDRIZZLE],[false])
86 AC_DEFINE([HAVE_LIBMEMCACHED],[1],[Enables libmemcached Support])
88 AM_CONDITIONAL([BUILDING_GEARMAN],[false])
102 # Checks for programs.
106 AC_CHECK_PROGS([LEX],['flex'],[:])
107 AC_CHECK_PROGS([YACC],['bison'],[:])
111 # Checks for libraries.
112 AC_SEARCH_LIBS([getopt_long],[gnugetopt])
113 AC_SEARCH_LIBS([gethostbyname],[nsl])
115 # Checks for header files.
116 AC_CHECK_HEADERS_ONCE([arpa/inet.h])
117 AC_CHECK_HEADERS_ONCE([errno.h])
118 AC_CHECK_HEADERS_ONCE([execinfo.h])
119 AC_CHECK_HEADERS_ONCE([fcntl.h])
120 AC_CHECK_HEADERS_ONCE([features.h])
121 AC_CHECK_HEADERS_ONCE([fnmatch.h])
122 AC_CHECK_HEADERS_ONCE([inttypes.h])
123 AC_CHECK_HEADERS_ONCE([libintl.h])
124 AC_CHECK_HEADERS_ONCE([limits.h])
125 AC_CHECK_HEADERS_ONCE([mach/mach.h])
126 AC_CHECK_HEADERS_ONCE([malloc.h])
127 AC_CHECK_HEADERS_ONCE([math.h])
128 AC_CHECK_HEADERS_ONCE([netdb.h])
129 AC_CHECK_HEADERS_ONCE([netinet/in.h])
130 AC_CHECK_HEADERS_ONCE([netinet/tcp.h])
131 AC_CHECK_HEADERS_ONCE([poll.h])
132 AC_CHECK_HEADERS_ONCE([pthread.h])
133 AC_CHECK_HEADERS_ONCE([spawn.h])
134 AC_CHECK_HEADERS_ONCE([stdarg.h])
135 AC_CHECK_HEADERS_ONCE([stddef.h])
136 AC_CHECK_HEADERS_ONCE([stdio.h])
137 AC_CHECK_HEADERS_ONCE([stdlib.h])
138 AC_CHECK_HEADERS_ONCE([sys/socket.h])
139 AC_CHECK_HEADERS_ONCE([sys/sysctl.h])
140 AC_CHECK_HEADERS_ONCE([sys/time.h])
141 AC_CHECK_HEADERS_ONCE([sys/types.h])
142 AC_CHECK_HEADERS_ONCE([sys/un.h])
143 AC_CHECK_HEADERS_ONCE([sys/wait.h])
144 AC_CHECK_HEADERS_ONCE([syslog.h])
145 AC_CHECK_HEADERS_ONCE([time.h])
146 AC_CHECK_HEADERS_ONCE([unistd.h])
149 AC_CHECK_HEADERS_ONCE([winsock2.h])
150 AC_CHECK_HEADERS_ONCE([ws2tcpip.h])
152 # Checks for typedefs, structures, and compiler characteristics.
154 # Checks for library functions.
156 AC_CHECK_FUNCS([alarm])
157 AC_CHECK_FUNCS([atexit])
158 AC_CHECK_FUNCS([clock_gettime])
159 AC_CHECK_FUNCS([dup2])
160 AC_CHECK_FUNCS([fcntl])
161 AC_CHECK_FUNCS([floor])
162 AC_CHECK_FUNCS([getcwd])
163 AC_CHECK_FUNCS([getline])
164 AC_CHECK_FUNCS([gettimeofday])
165 AC_CHECK_FUNCS([inet_ntoa])
166 AC_CHECK_FUNCS([memchr])
167 AC_CHECK_FUNCS([memmove])
168 AC_CHECK_FUNCS([memset])
169 AC_CHECK_FUNCS([pipe2])
170 AC_CHECK_FUNCS([putenv])
171 AC_CHECK_FUNCS([select])
172 AC_CHECK_FUNCS([setenv])
173 AC_CHECK_FUNCS([sigignore])
174 AC_CHECK_FUNCS([socket])
175 AC_CHECK_FUNCS([sqrt])
176 AC_CHECK_FUNCS([strcasecmp])
177 AC_CHECK_FUNCS([strchr])
178 AC_CHECK_FUNCS([strdup])
179 AC_CHECK_FUNCS([strerror])
180 AC_CHECK_FUNCS([strstr])
181 AC_CHECK_FUNCS([strtol])
182 AC_CHECK_FUNCS([strtoul])
183 AC_CHECK_FUNCS([strtoull])
185 AC_FUNC_ERROR_AT_LINE
189 AC_CHECK_HEADER([umem.h],
190 [AC_DEFINE([HAVE_UMEM_H],[1],[Define this if you have umem.h])
194 AM_CONDITIONAL([BUILD_CACHE],[test "x$build_cache" = "xyes"])
198 AC_CHECK_TYPES([in_port_t],,,[[
199 #ifdef HAVE_SYS_TYPES_H
200 # include <sys/types.h>
202 #ifdef HAVE_NETINET_IN_H
203 # include <netinet/in.h>
208 AC_CHECK_TYPES([ptrdiff_t])
228 AX_CXX_GCC_ABI_DEMANGLE
232 AC_CHECK_LIB([rt],[clock_gettime],
233 [AC_SUBST([RT_LIB],[-lrt])
234 AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Have clock_gettime])],
235 [AC_DEFINE([HAVE_CLOCK_GETTIME],[0],[Have clock_gettime])])
238 # Check for the ability to call dlopen (used in libhostile)
241 AC_CHECK_HEADERS([atomic.h])
242 AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],
243 [AC_CHECK_FUNCS([atomic_add_64])
244 AC_CHECK_FUNCS([atomic_add_32])
245 AS_IF([test "x$ac_cv_func_atomic_add_64" = "xyes" -a "x$ac_cv_func_atomic_add_32" = "xyes"],
246 [AC_DEFINE([USE_ATOMIC_H],[1],[Define to true if you want to use functions from atomic.h])])])
248 AC_DEFINE([HAVE_LIBDRIZZLE],[0],[Support for libdrizzle])
249 AC_DEFINE([HAVE_DRIZZLED_BINARY],[0],[Support for DrizzleD])
250 AC_DEFINE([DRIZZLED_BINARY],[0],[Support for DrizzleD])
251 AC_DEFINE([GEARMAND_BLOBSLAP_WORKER],[0],[Support for Gearman Blobslap worker])
252 AC_DEFINE([HAVE_LIBPQ],[0],[Support for Postgres])
253 AC_DEFINE([HAVE_LIBCURL],[0],[Support for libcurl])
255 # Check for the requirements for running memcached with less privileges
256 # than the default privilege set. On Solaris we need setppriv and priv.h
257 # If you want to add support for other platforms you should check for
258 # your requirements, define HAVE_DROP_PRIVILEGES, and make sure you add
259 # the source file containing the implementation into memcached_SOURCE
261 AC_CHECK_FUNCS([setppriv],
262 [AC_CHECK_HEADER([priv.h],
263 [AC_DEFINE([HAVE_DROP_PRIVILEGES],
265 [Define this if you have an implementation of drop_privileges()])
266 build_solaris_privs=yes])
269 AM_CONDITIONAL([BUILD_POLL],[test "x$ac_cv_header_poll_h" = "xno"])
270 AM_CONDITIONAL([BUILD_WIN32_WRAPPERS],[test "x$ac_cv_header_winsock2_h" = "xyes"])
271 AS_IF([test "x$ac_cv_header_winsock2_h" = "xyes"],
272 [AM_LDFLAGS="$AM_LDFLAGS -lws2_32"
273 AM_CFLAGS="$AM_CFLAGS $NO_WERROR"
274 AM_CXXFLAGS="$AM_CXXFLAGS $NO_WERROR"
278 AX_UUID_GENERATE_TIME_SAFE
280 AC_DEFUN([CHECK_FOR_PTHREAD_AND_SASL],
281 [AX_PTHREAD(, [AC_MSG_ERROR([could not find libpthread])])
282 AX_PTHREAD_TIMEDJOIN_NP
284 # The sasl functions should only be visible if we build with sasl support
287 AS_IF([test "x$ac_enable_sasl" = xyes],
288 [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 1"],
289 [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 0"])
290 AC_SUBST([LIBMEMCACHED_WITH_SASL_SUPPORT])
292 CHECK_FOR_PTHREAD_AND_SASL
294 # backtrace(), others require shared builds
295 AC_DEFUN([__ENABLE_SHARED],
296 [AC_REQUIRE([AX_PLATFORM])
297 AS_IF([test "x${TARGET_WINDOWS}" = "xtrue"],[enable_shared=no])
298 AS_IF([test "x$enable_shared" = "xyes"],
299 [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().])])])
300 AM_CONDITIONAL([SHARED_ENABLED],[test "x$enable_shared" = "xyes"])
302 PANDORA_ENABLE_DTRACE
306 AX_HARDEN_COMPILER_FLAGS
308 AX_AM_JOBSERVER([yes])
310 AC_CONFIG_FILES([Makefile
312 libmemcached-1.0/configure.h
313 support/libmemcached.pc
314 support/libmemcached.spec
319 echo "Configuration summary for $PACKAGE_NAME version $VERSION"
321 echo " * Installation prefix: $prefix"
322 echo " * System type: $host_vendor-$host_os"
323 echo " * Host CPU: $host_cpu"
324 echo " * C Compiler: $CC_VERSION"
325 echo " * C Flags: $CFLAGS"
326 echo " * C++ Compiler: $CXX_VERSION"
327 echo " * C++ Flags: $CXXFLAGS"
328 echo " * CPP Flags: $CPPFLAGS"
329 echo " * LIB Flags: $LIB"
330 echo " * Assertions enabled: $ax_enable_assert"
331 echo " * Debug enabled: $ax_enable_debug"
332 echo " * Shared: $enable_shared"
333 echo " * Warnings as failure: $ac_cv_warnings_as_errors"
334 echo " * SASL support: $ac_enable_sasl"
335 echo " * make -j: $enable_jobserver"
336 echo " * VCS checkout: $ac_cv_vcs_checkout"
344 echo "* NOTE: You are on FreeBSD. BSD make will not work."
346 echo "* use 'gmake' To build libmemcached"