2 # Copyright (C) 2011-2012 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.14],[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_CONFIG_SRCDIR([libmemcached/memcached.cc])
24 #shared library versioning
25 MEMCACHED_UTIL_LIBRARY_VERSION=2:0:0
26 MEMCACHED_PROTOCAL_LIBRARY_VERSION=0:0:0
27 MEMCACHED_LIBRARY_VERSION=11:0:0
31 # current:revision:age
33 # | | +- increment if interfaces have been added
34 # | | set to zero if interfaces have been removed or changed
35 # | +- increment if source code has changed
36 # | set to zero if current is incremented
37 # +- increment if interfaces have been added, removed or changed
38 AC_SUBST([MEMCACHED_UTIL_LIBRARY_VERSION])
39 AC_SUBST([MEMCACHED_PROTOCAL_LIBRARY_VERSION])
40 AC_SUBST([MEMCACHED_LIBRARY_VERSION])
42 AX_HEX_VERSION([LIBMEMCACHED],[$VERSION])
43 AX_HEX_VERSION([LIBHASHKIT],[1.0.0])
45 m4_include([libhashkit/include.m4])
55 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
57 AX_CXX_HEADER_STDCXX_98
58 AS_IF([test "x$ax_cv_cxx_stdcxx_98" = "xno"],
59 [AC_MSG_ERROR([Your system lacks a new enough C++ compiler])])
61 AC_DEFUN([LIBMEMCACHED_PROTOCOL],
62 [AC_ARG_ENABLE([libmemcachedprotocol],
63 [AS_HELP_STRING([--enable-libmemcachedprotocol],
64 [Enable libmemcachedprotocol])],
65 [ax_enable_libmemcachedprotocol=yes],
66 [ax_enable_libmemcachedprotocol=no])
68 AM_CONDITIONAL([BUILD_LIBMEMCACHED_PROTOCOL],[test "$ax_enable_libmemcachedprotocol" = "yes"])
70 AC_MSG_CHECKING([for libmemcachedprotocol])
71 AC_MSG_RESULT([$ax_enable_libmemcachedprotocol])
75 # Adding support for libtest
76 m4_include([libtest/yatl.m4])
81 AM_CONDITIONAL([BUILDING_LIBMEMCACHED],[true])
82 AM_CONDITIONAL([HAVE_LIBMEMCACHED],[false])
83 AM_CONDITIONAL([HAVE_LIBDRIZZLE],[false])
84 AC_DEFINE([HAVE_LIBMEMCACHED],[1],[Enables libmemcached Support])
86 AM_CONDITIONAL([BUILDING_GEARMAN],[false])
100 # Checks for programs.
101 AC_CHECK_PROGS([LEX],['flex'],[:])
102 AC_CHECK_PROGS([YACC],['bison'],[:])
105 # Checks for libraries.
106 AC_SEARCH_LIBS([getopt_long],[gnugetopt])
107 AC_SEARCH_LIBS([gethostbyname],[nsl])
109 # Checks for header files.
110 AC_CHECK_HEADERS_ONCE([arpa/inet.h])
111 AC_CHECK_HEADERS_ONCE([dlfcn.h])
112 AC_CHECK_HEADERS_ONCE([errno.h])
113 AC_CHECK_HEADERS_ONCE([execinfo.h])
114 AC_CHECK_HEADERS_ONCE([fcntl.h])
115 AC_CHECK_HEADERS_ONCE([inttypes.h])
116 AC_CHECK_HEADERS_ONCE([libintl.h])
117 AC_CHECK_HEADERS_ONCE([limits.h])
118 AC_CHECK_HEADERS_ONCE([mach/mach.h])
119 AC_CHECK_HEADERS_ONCE([malloc.h])
120 AC_CHECK_HEADERS_ONCE([math.h])
121 AC_CHECK_HEADERS_ONCE([netdb.h])
122 AC_CHECK_HEADERS_ONCE([netinet/in.h])
123 AC_CHECK_HEADERS_ONCE([netinet/tcp.h])
124 AC_CHECK_HEADERS_ONCE([pthread.h])
125 AC_CHECK_HEADERS_ONCE([spawn.h])
126 AC_CHECK_HEADERS_ONCE([stdarg.h])
127 AC_CHECK_HEADERS_ONCE([stddef.h])
128 AC_CHECK_HEADERS_ONCE([stdio.h])
129 AC_CHECK_HEADERS_ONCE([stdlib.h])
130 AC_CHECK_HEADERS_ONCE([sys/socket.h])
131 AC_CHECK_HEADERS_ONCE([sys/sysctl.h])
132 AC_CHECK_HEADERS_ONCE([sys/time.h])
133 AC_CHECK_HEADERS_ONCE([sys/un.h])
134 AC_CHECK_HEADERS_ONCE([syslog.h])
135 AC_CHECK_HEADERS_ONCE([time.h])
136 AC_CHECK_HEADERS_ONCE([unistd.h])
139 AC_CHECK_HEADERS([winsock2.h])
140 AC_CHECK_HEADERS([ws2tcpip.h])
142 # Checks for typedefs, structures, and compiler characteristics.
144 # Checks for library functions.
146 AC_CHECK_FUNCS([alarm])
147 AC_CHECK_FUNCS([atexit])
148 AC_CHECK_FUNCS([clock_gettime])
149 AC_CHECK_FUNCS([dup2])
150 AC_CHECK_FUNCS([fcntl])
151 AC_CHECK_FUNCS([floor])
152 AC_CHECK_FUNCS([getcwd])
153 AC_CHECK_FUNCS([getline])
154 AC_CHECK_FUNCS([gettimeofday])
155 AC_CHECK_FUNCS([inet_ntoa])
156 AC_CHECK_FUNCS([memchr])
157 AC_CHECK_FUNCS([memmove])
158 AC_CHECK_FUNCS([memset])
159 AC_CHECK_FUNCS([pipe2])
160 AC_CHECK_FUNCS([putenv])
161 AC_CHECK_FUNCS([select])
162 AC_CHECK_FUNCS([setenv])
163 AC_CHECK_FUNCS([socket])
164 AC_CHECK_FUNCS([sqrt])
165 AC_CHECK_FUNCS([strcasecmp])
166 AC_CHECK_FUNCS([strchr])
167 AC_CHECK_FUNCS([strdup])
168 AC_CHECK_FUNCS([strerror])
169 AC_CHECK_FUNCS([strstr])
170 AC_CHECK_FUNCS([strtol])
171 AC_CHECK_FUNCS([strtoul])
172 AC_CHECK_FUNCS([strtoull])
174 AC_FUNC_ERROR_AT_LINE
178 AC_CHECK_HEADER([umem.h],
179 [AC_DEFINE([HAVE_UMEM_H],[1],[Define this if you have umem.h])
183 AM_CONDITIONAL([BUILD_CACHE],[test "x$build_cache" = "xyes"])
187 AC_CHECK_TYPES([ptrdiff_t])
207 AX_CXX_GCC_ABI_DEMANGLE
211 AC_CHECK_LIB([rt],[clock_gettime],
212 [AC_SUBST([RT_LIB],[-lrt])
213 AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Have clock_gettime])],
214 [AC_DEFINE([HAVE_CLOCK_GETTIME],[0],[Have clock_gettime])])
216 # Check for the ability to call dlopen
217 AS_IF([test "x$enable_static" = "xyes"],
218 [AC_CHECK_LIB([dl],[dlopen],
219 [AC_SUBST([DL_LIB],[-ldl])
220 AC_DEFINE([HAVE_LIBDL],[1],[Have dlopen])])],
221 [AC_DEFINE([HAVE_LIBDL], [0], [Have dlopen])])
223 AC_CHECK_LIB([m],[floor])
224 AC_CHECK_FUNCS([sigignore])
226 AC_CHECK_HEADERS([atomic.h])
227 AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],
228 [AC_CHECK_FUNCS([atomic_add_64])
229 AC_CHECK_FUNCS([atomic_add_32])
230 AS_IF([test "x$ac_cv_func_atomic_add_64" = "xyes" -a "x$ac_cv_func_atomic_add_32" = "xyes"],
231 [AC_DEFINE([USE_ATOMIC_H],[1],[Define to true if you want to use functions from atomic.h])])])
233 AC_DEFINE([HAVE_LIBDRIZZLE],[0],[Support for libdrizzle])
234 AC_DEFINE([HAVE_DRIZZLED_BINARY],[0],[Support for DrizzleD])
235 AC_DEFINE([DRIZZLED_BINARY],[0],[Support for DrizzleD])
236 AC_DEFINE([GEARMAND_BLOBSLAP_WORKER],[0],[Support for Gearman Blobslap worker])
237 AC_DEFINE([HAVE_LIBPQ],[0],[Support for Postgres])
238 AC_DEFINE([HAVE_LIBCURL],[0],[Support for libcurl])
240 # Check for the requirements for running memcached with less privileges
241 # than the default privilege set. On Solaris we need setppriv and priv.h
242 # If you want to add support for other platforms you should check for
243 # your requirements, define HAVE_DROP_PRIVILEGES, and make sure you add
244 # the source file containing the implementation into memcached_SOURCE
246 AC_CHECK_FUNCS([setppriv],
247 [AC_CHECK_HEADER([priv.h],
248 [AC_DEFINE([HAVE_DROP_PRIVILEGES],
250 [Define this if you have an implementation of drop_privileges()])
251 build_solaris_privs=yes])
254 AC_CHECK_HEADERS_ONCE([winsock2.h poll.h sys/wait.h fnmatch.h])
255 AM_CONDITIONAL([BUILD_POLL],[test "x$ac_cv_header_poll_h" = "xno"])
256 AM_CONDITIONAL([BUILD_WIN32_WRAPPERS],[test "x$ac_cv_header_winsock2_h" = "xyes"])
257 AS_IF([test "x$ac_cv_header_winsock2_h" = "xyes"],
258 [AM_LDFLAGS="$AM_LDFLAGS -lws2_32"
259 AM_CFLAGS="$AM_CFLAGS $NO_WERROR"
260 AM_CXXFLAGS="$AM_CXXFLAGS $NO_WERROR"
264 AX_UUID_GENERATE_TIME_SAFE
267 AC_DEFUN([CHECK_FOR_PTHREAD_AND_SASL],
268 [AX_PTHREAD(, [AC_MSG_ERROR([could not find libpthread])])
269 AX_PTHREAD_TIMEDJOIN_NP
271 # The sasl functions should only be visible if we build with sasl support
274 AS_IF([test "x$ac_enable_sasl" = xyes],
275 [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 1"],
276 [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 0"])
277 AC_SUBST([LIBMEMCACHED_WITH_SASL_SUPPORT])
279 CHECK_FOR_PTHREAD_AND_SASL
282 # backtrace() does not work with static builds.
283 AS_IF([test "x$enable_static" = "xyes"],
284 [AC_DEFINE([AX_ENABLE_BACKTRACE],[1],[Support for backtrace().])])
286 PANDORA_ENABLE_DTRACE
290 AX_HARDEN_COMPILER_FLAGS
292 AX_AM_JOBSERVER([yes])
294 AC_CONFIG_FILES([Makefile
296 libmemcached-1.0/configure.h
297 support/libmemcached.pc
298 support/libmemcached.spec
303 echo "Configuration summary for $PACKAGE_NAME version $VERSION"
305 echo " * Installation prefix: $prefix"
306 echo " * System type: $host_vendor-$host_os"
307 echo " * Host CPU: $host_cpu"
308 echo " * C Compiler: $CC_VERSION"
309 echo " * C Flags: $CFLAGS"
310 echo " * C++ Compiler: $CXX_VERSION"
311 echo " * C++ Flags: $CXXFLAGS"
312 echo " * CPP Flags: $CPPFLAGS"
313 echo " * LIB Flags: $LIB"
314 echo " * Assertions enabled: $ax_enable_assert"
315 echo " * Debug enabled: $ax_enable_debug"
316 echo " * Warnings as failure: $ac_cv_warnings_as_errors"
317 echo " * SASL support: $ax_sasl_option"
318 echo " * make -j: $enable_jobserver"
319 echo " * VCS checkout: $ac_cv_vcs_checkout"
327 echo "* NOTE: You are on FreeBSD. BSD make will not work."
329 echo "* use 'gmake' To build libmemcached"