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 m4_include([version.m4])
10 AC_INIT([libmemcached],VERSION_NUMBER,[http://libmemcached.org/])
11 AC_CONFIG_AUX_DIR([build-aux])
12 AC_CONFIG_MACRO_DIR([m4])
16 AC_USE_SYSTEM_EXTENSIONS
18 AM_INIT_AUTOMAKE([1.11 color-tests -Wno-portability subdir-objects foreign tar-ustar])
22 AC_CONFIG_HEADERS([mem_config.h:mem_config.in])dnl Keep filename to 8.3 for MS-DOS.
23 AC_SUBST([AUTOHEADER_FILE],[mem_config.h])
24 AC_CONFIG_SRCDIR([libmemcached/memcached.cc])
26 #shared library versioning
27 MEMCACHED_UTIL_LIBRARY_VERSION=2:0:0
28 MEMCACHED_PROTOCAL_LIBRARY_VERSION=0:0:0
29 MEMCACHED_LIBRARY_VERSION=11:0:0
33 # current:revision:age
35 # | | +- increment if interfaces have been added
36 # | | set to zero if interfaces have been removed or changed
37 # | +- increment if source code has changed
38 # | set to zero if current is incremented
39 # +- increment if interfaces have been added, removed or changed
40 AC_SUBST([MEMCACHED_UTIL_LIBRARY_VERSION])
41 AC_SUBST([MEMCACHED_PROTOCAL_LIBRARY_VERSION])
42 AC_SUBST([MEMCACHED_LIBRARY_VERSION])
44 AX_HEX_VERSION([LIBMEMCACHED],[$VERSION])
45 AX_HEX_VERSION([LIBHASHKIT],[1.0.0])
47 m4_include([libhashkit/include.m4])
55 AS_IF([test "x${ac_cv_prog_cc_c99}" == "xno"],[AC_MSG_ERROR([No c99 compatible compiler found])])
61 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
63 AX_CXX_HEADER_STDCXX_98
64 AS_IF([test "x$ax_cv_cxx_stdcxx_98" = "xno"],
65 [AC_MSG_ERROR([Your system lacks a new enough C++ compiler])])
67 AC_DEFUN([LIBMEMCACHED_PROTOCOL],
68 [AC_ARG_ENABLE([libmemcachedprotocol],
69 [AS_HELP_STRING([--enable-libmemcachedprotocol],
70 [Enable libmemcachedprotocol])],
71 [ax_enable_libmemcachedprotocol=yes],
72 [ax_enable_libmemcachedprotocol=no])
74 AM_CONDITIONAL([BUILD_LIBMEMCACHED_PROTOCOL],[test "$ax_enable_libmemcachedprotocol" = "yes"])
76 AC_MSG_CHECKING([for libmemcachedprotocol])
77 AC_MSG_RESULT([$ax_enable_libmemcachedprotocol])
81 # Adding support for libtest
82 m4_include([libtest/yatl.m4])
87 AM_CONDITIONAL([BUILDING_LIBMEMCACHED],[true])
88 AM_CONDITIONAL([HAVE_LIBMEMCACHED],[false])
89 AM_CONDITIONAL([HAVE_LIBDRIZZLE],[false])
90 AC_DEFINE([HAVE_LIBMEMCACHED],[1],[Enables libmemcached Support])
92 AM_CONDITIONAL([BUILDING_GEARMAN],[false])
106 # Checks for programs.
107 AC_CHECK_PROGS([DPKG_GENSYMBOLS],[dpkg-gensymbols])
108 AC_CHECK_PROGS([LEX],['flex'],[:])
109 AC_CHECK_PROGS([PERL],[perl])
110 AC_CHECK_PROGS([VALGRIND],['valgrind'])
111 AC_CHECK_PROGS([WINE],['wine'])
112 AC_CHECK_PROGS([YACC],['bison --warnings=all'],[:])
117 AX_PROG_SPHINX_BUILD(,[AC_MSG_WARN([sphinx-build version 1.0 or greater is required to build man pages])])
118 AX_WITH_PROG([LCOV],[lcov])
119 AX_WITH_PROG([LCOV_GENHTML],[genhtml])
120 AC_DEFINE([HAVE_MEMCACHED_SASL_BINARY],[0],[If Memcached binary with sasl support is available])
122 # Checks for libraries.
123 AC_SEARCH_LIBS([getopt_long],[gnugetopt])
124 AC_SEARCH_LIBS([gethostbyname],[nsl])
126 # Checks for header files.
127 AC_CHECK_HEADERS_ONCE([arpa/inet.h])
128 AC_CHECK_HEADERS_ONCE([errno.h])
129 AC_CHECK_HEADERS_ONCE([execinfo.h])
130 AC_CHECK_HEADERS_ONCE([fcntl.h])
131 AC_CHECK_HEADERS_ONCE([features.h])
132 AC_CHECK_HEADERS_ONCE([fnmatch.h])
133 AC_CHECK_HEADERS_ONCE([inttypes.h])
134 AC_CHECK_HEADERS_ONCE([libintl.h])
135 AC_CHECK_HEADERS_ONCE([limits.h])
136 AC_CHECK_HEADERS_ONCE([mach/mach.h])
137 AC_CHECK_HEADERS_ONCE([malloc.h])
138 AC_CHECK_HEADERS_ONCE([math.h])
139 AC_CHECK_HEADERS_ONCE([netdb.h])
140 AC_CHECK_HEADERS_ONCE([netinet/in.h])
141 AC_CHECK_HEADERS_ONCE([netinet/tcp.h])
142 AC_CHECK_HEADERS_ONCE([poll.h])
143 AC_CHECK_HEADERS_ONCE([pthread.h])
144 AC_CHECK_HEADERS_ONCE([spawn.h])
145 AC_CHECK_HEADERS_ONCE([stdarg.h])
146 AC_CHECK_HEADERS_ONCE([stddef.h])
147 AC_CHECK_HEADERS_ONCE([stdio.h])
148 AC_CHECK_HEADERS_ONCE([stdlib.h])
149 AC_CHECK_HEADERS_ONCE([sys/socket.h])
150 AC_CHECK_HEADERS_ONCE([sys/sysctl.h])
151 AC_CHECK_HEADERS_ONCE([sys/time.h])
152 AC_CHECK_HEADERS_ONCE([sys/types.h])
153 AC_CHECK_HEADERS_ONCE([sys/un.h])
154 AC_CHECK_HEADERS_ONCE([sys/wait.h])
155 AC_CHECK_HEADERS_ONCE([syslog.h])
156 AC_CHECK_HEADERS_ONCE([time.h])
157 AC_CHECK_HEADERS_ONCE([unistd.h])
160 AC_CHECK_HEADERS_ONCE([winsock2.h])
161 AC_CHECK_HEADERS_ONCE([ws2tcpip.h])
163 # Checks for typedefs, structures, and compiler characteristics.
165 # Checks for library functions.
167 AC_CHECK_FUNCS([alarm])
168 AC_CHECK_FUNCS([atexit])
169 AC_CHECK_FUNCS([clock_gettime])
170 AC_CHECK_FUNCS([dup2])
171 AC_CHECK_FUNCS([fcntl])
172 AC_CHECK_FUNCS([floor])
173 AC_CHECK_FUNCS([getcwd])
174 AC_CHECK_FUNCS([getline])
175 AC_CHECK_FUNCS([gettimeofday])
176 AC_CHECK_FUNCS([inet_ntoa])
177 AC_CHECK_FUNCS([memchr])
178 AC_CHECK_FUNCS([memmove])
179 AC_CHECK_FUNCS([memset])
180 AC_CHECK_FUNCS([pipe2])
181 AC_CHECK_FUNCS([putenv])
182 AC_CHECK_FUNCS([select])
183 AC_CHECK_FUNCS([setenv])
184 AC_CHECK_FUNCS([sigignore])
185 AC_CHECK_FUNCS([socket])
186 AC_CHECK_FUNCS([sqrt])
187 AC_CHECK_FUNCS([strcasecmp])
188 AC_CHECK_FUNCS([strchr])
189 AC_CHECK_FUNCS([strdup])
190 AC_CHECK_FUNCS([strerror])
191 AC_CHECK_FUNCS([strstr])
192 AC_CHECK_FUNCS([strtol])
193 AC_CHECK_FUNCS([strtoul])
194 AC_CHECK_FUNCS([strtoull])
196 AC_FUNC_ERROR_AT_LINE
200 AC_CHECK_HEADER([umem.h],
201 [AC_DEFINE([HAVE_UMEM_H],[1],[Define this if you have umem.h])
205 AM_CONDITIONAL([BUILD_CACHE],[test "x$build_cache" = "xyes"])
209 AC_CHECK_TYPES([in_port_t],,,[[
210 #ifdef HAVE_SYS_TYPES_H
211 # include <sys/types.h>
213 #ifdef HAVE_NETINET_IN_H
214 # include <netinet/in.h>
219 AC_CHECK_TYPES([ptrdiff_t])
239 AX_CXX_GCC_ABI_DEMANGLE
243 AC_CHECK_LIB([rt],[clock_gettime],
244 [AC_SUBST([RT_LIB],[-lrt])
245 AC_DEFINE([HAVE_CLOCK_GETTIME],[1],[Have clock_gettime])],
246 [AC_DEFINE([HAVE_CLOCK_GETTIME],[0],[Have clock_gettime])])
249 # Check for the ability to call dlopen (used in libhostile)
252 AC_CHECK_HEADERS([atomic.h])
253 AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],
254 [AC_CHECK_FUNCS([atomic_add_64])
255 AC_CHECK_FUNCS([atomic_add_32])
256 AS_IF([test "x$ac_cv_func_atomic_add_64" = "xyes" -a "x$ac_cv_func_atomic_add_32" = "xyes"],
257 [AC_DEFINE([USE_ATOMIC_H],[1],[Define to true if you want to use functions from atomic.h])])])
259 AC_DEFINE([HAVE_LIBDRIZZLE],[0],[Support for libdrizzle])
260 AC_DEFINE([HAVE_DRIZZLED_BINARY],[0],[Support for DrizzleD])
261 AC_DEFINE([DRIZZLED_BINARY],[0],[Support for DrizzleD])
262 AC_DEFINE([GEARMAND_BLOBSLAP_WORKER],[0],[Support for Gearman Blobslap worker])
263 AC_DEFINE([HAVE_LIBPQ],[0],[Support for Postgres])
264 AC_DEFINE([HAVE_LIBCURL],[0],[Support for libcurl])
266 # Check for the requirements for running memcached with less privileges
267 # than the default privilege set. On Solaris we need setppriv and priv.h
268 # If you want to add support for other platforms you should check for
269 # your requirements, define HAVE_DROP_PRIVILEGES, and make sure you add
270 # the source file containing the implementation into memcached_SOURCE
272 AC_CHECK_FUNCS([setppriv],
273 [AC_CHECK_HEADER([priv.h],
274 [AC_DEFINE([HAVE_DROP_PRIVILEGES],
276 [Define this if you have an implementation of drop_privileges()])
277 build_solaris_privs=yes])
280 AM_CONDITIONAL([BUILD_POLL],[test "x$ac_cv_header_poll_h" = "xno"])
281 AM_CONDITIONAL([BUILD_WIN32_WRAPPERS],[test "x$ac_cv_header_winsock2_h" = "xyes"])
282 AS_IF([test "x$ac_cv_header_winsock2_h" = "xyes"],
283 [AM_LDFLAGS="$AM_LDFLAGS -lws2_32"
284 AM_CFLAGS="$AM_CFLAGS $NO_WERROR"
285 AM_CXXFLAGS="$AM_CXXFLAGS $NO_WERROR"
289 AX_UUID_GENERATE_TIME_SAFE
291 AC_DEFUN([CHECK_FOR_PTHREAD_AND_SASL],
292 [AX_PTHREAD(, [AC_MSG_ERROR([could not find libpthread])])
293 AX_PTHREAD_TIMEDJOIN_NP
295 # The sasl functions should only be visible if we build with sasl support
298 AS_IF([test "x$ac_enable_sasl" = xyes],
299 [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 1"],
300 [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 0"])
301 AC_SUBST([LIBMEMCACHED_WITH_SASL_SUPPORT])
303 CHECK_FOR_PTHREAD_AND_SASL
305 # backtrace(), others require shared builds
306 AC_DEFUN([__ENABLE_SHARED],
307 [AC_REQUIRE([AX_PLATFORM])
308 AS_IF([test "x${TARGET_WINDOWS}" = "xtrue"],[enable_shared=no])
309 AS_IF([test "x$enable_shared" = "xyes"],
310 [AC_DEFINE([HAVE_SHARED_ENABLED],[1],[Enable code which requires shared library support. Like backtrace().])])])
311 AM_CONDITIONAL([SHARED_ENABLED],[test "x$enable_shared" = "xyes"])
313 PANDORA_ENABLE_DTRACE
317 AX_HARDEN_COMPILER_FLAGS
319 AX_AM_JOBSERVER([yes])
321 AC_CONFIG_FILES([Makefile
323 libmemcached-1.0/configure.h
324 support/libmemcached.pc
325 support/libmemcached.spec
330 echo "Configuration summary for $PACKAGE_NAME version $VERSION"
332 echo " * Installation prefix: $prefix"
333 echo " * System type: $host_vendor-$host_os"
334 echo " * Host CPU: $host_cpu"
335 echo " * C Compiler: $CC_VERSION"
336 echo " * C Flags: $CFLAGS"
337 echo " * C++ Compiler: $CXX_VERSION"
338 echo " * C++ Flags: $CXXFLAGS"
339 echo " * CPP Flags: $CPPFLAGS"
340 echo " * LIB Flags: $LIB"
341 echo " * Assertions enabled: $ax_enable_assert"
342 echo " * Debug enabled: $ax_enable_debug"
343 echo " * Shared: $enable_shared"
344 echo " * Warnings as failure: $ac_cv_warnings_as_errors"
345 echo " * SASL support: $ac_enable_sasl"
346 echo " * make -j: $enable_jobserver"
347 echo " * VCS checkout: $ac_cv_vcs_checkout"
355 echo "* NOTE: You are on FreeBSD. BSD make will not work."
357 echo "* use 'gmake' To build libmemcached"