lp:1079994
[awesomized/libmemcached] / configure.ac
1 # LibmemcacheD
2 # Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
3 # Copyright (C) 2006-2010 Brian Aker, Monty Taylor, Trond Norbye
4 # All rights reserved.
5 #
6 # Use and distribution licensed under the BSD license. See
7 # the COPYING file in this directory for full text.
8
9 AC_INIT([libmemcached],[1.0.14],[http://libmemcached.org/])
10 AC_CONFIG_AUX_DIR([build-aux])
11 AC_CONFIG_MACRO_DIR([m4])
12
13 AC_CANONICAL_TARGET
14 AC_ARG_PROGRAM
15 AC_USE_SYSTEM_EXTENSIONS
16
17 AM_INIT_AUTOMAKE([1.11 color-tests -Wno-portability subdir-objects foreign tar-ustar])
18
19 AC_PREREQ([2.61])
20
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])
23
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
28 # | | |
29 # +------+ | +---+
30 # | | |
31 # current:revision:age
32 # | | |
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])
41
42 AX_HEX_VERSION([LIBMEMCACHED],[$VERSION])
43 AX_HEX_VERSION([LIBHASHKIT],[1.0.0])
44
45 m4_include([libhashkit/include.m4])
46
47 LT_PREREQ([2.2])
48 LT_INIT
49 LT_LANG([C++])
50
51 AX_ASSERT
52
53 AX_PLATFORM
54
55 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
56
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])])
60
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])
67
68 AM_CONDITIONAL([BUILD_LIBMEMCACHED_PROTOCOL],[test "$ax_enable_libmemcachedprotocol" = "yes"])
69
70 AC_MSG_CHECKING([for libmemcachedprotocol])
71 AC_MSG_RESULT([$ax_enable_libmemcachedprotocol])
72 ])
73 LIBMEMCACHED_PROTOCOL
74
75 # Adding support for libtest
76 m4_include([libtest/yatl.m4])
77
78 CHECK_FOR_GEARMAND
79 CHECK_FOR_LIBGEARMAND
80
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])
85
86 AM_CONDITIONAL([BUILDING_GEARMAN],[false])
87
88 # Specialty checks
89 AX_CXX_CINTTYPES
90 CONFIG_EXTRA
91 DETECT_BYTEORDER
92 SETSOCKOPT_SANITY
93 ENABLE_HSIEH_HASH
94 ENABLE_MURMUR_HASH
95 ENABLE_FNV64_HASH
96 ENABLE_MEMASLAP
97 PROTOCOL_BINARY_TEST
98 ENABLE_DEPRECATED
99
100 # Checks for programs.
101 AC_CHECK_PROGS([LEX],['flex'],[:])
102 AC_CHECK_PROGS([YACC],['bison'],[:])
103 AX_PROG_SPHINX_BUILD
104
105 # Checks for libraries.
106 AC_SEARCH_LIBS([getopt_long],[gnugetopt])
107 AC_SEARCH_LIBS([gethostbyname],[nsl])
108
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])
137
138 # Windows only
139 AC_CHECK_HEADERS([winsock2.h])
140 AC_CHECK_HEADERS([ws2tcpip.h])
141
142 # Checks for typedefs, structures, and compiler characteristics.
143
144 # Checks for library functions.
145
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])
173 AC_FUNC_ALLOCA
174 AC_FUNC_ERROR_AT_LINE
175 AC_FUNC_FORK
176 AC_FUNC_STRERROR_R
177
178 AC_CHECK_HEADER([umem.h],
179 [AC_DEFINE([HAVE_UMEM_H],[1],[Define this if you have umem.h])
180 build_cache=no],
181 [build_cache=yes])
182
183 AM_CONDITIONAL([BUILD_CACHE],[test "x$build_cache" = "xyes"])
184
185 AX_COMPILER_VENDOR
186
187 AC_CHECK_TYPES([ptrdiff_t])
188 AC_HEADER_STDBOOL
189 AC_TYPE_INT16_T
190 AC_TYPE_INT32_T
191 AC_TYPE_INT64_T
192 AC_TYPE_INT8_T
193 AC_TYPE_OFF_T
194 AC_TYPE_PID_T
195 AC_TYPE_SSIZE_T
196 AC_TYPE_UINT16_T
197 AC_TYPE_UINT32_T
198 AC_TYPE_UINT64_T
199 AC_TYPE_UINT8_T
200
201 AC_C_BIGENDIAN
202 AC_C_CONST
203 AC_C_INLINE
204 AC_C_VOLATILE
205 AC_C_RESTRICT
206
207 AX_CXX_GCC_ABI_DEMANGLE
208
209 AX_LIBEVENT
210
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])])
215
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])])
222
223 AC_CHECK_LIB([m],[floor])
224 AC_CHECK_FUNCS([sigignore])
225
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])])])
232
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])
239
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
245 # in Makefile.am
246 AC_CHECK_FUNCS([setppriv],
247 [AC_CHECK_HEADER([priv.h],
248 [AC_DEFINE([HAVE_DROP_PRIVILEGES],
249 [1],
250 [Define this if you have an implementation of drop_privileges()])
251 build_solaris_privs=yes])
252 ])
253
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"
261 ])
262 SOCKET_SEND_FLAGS
263
264 AX_UUID_GENERATE_TIME_SAFE
265
266
267 AC_DEFUN([CHECK_FOR_PTHREAD_AND_SASL],
268 [AX_PTHREAD(, [AC_MSG_ERROR([could not find libpthread])])
269 AX_PTHREAD_TIMEDJOIN_NP
270
271 # The sasl functions should only be visible if we build with sasl support
272 #
273 AX_SASL_OPTION
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])
278 ])
279 CHECK_FOR_PTHREAD_AND_SASL
280
281
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().])])
285
286 PANDORA_ENABLE_DTRACE
287 HAVE_GCC_ATOMICS
288 AX_ENDIAN
289 AX_ASSERT
290 AX_HARDEN_COMPILER_FLAGS
291
292 AX_AM_JOBSERVER([yes])
293
294 AC_CONFIG_FILES([Makefile
295 docs/conf.py
296 libmemcached-1.0/configure.h
297 support/libmemcached.pc
298 support/libmemcached.spec
299 ])
300 AC_OUTPUT
301
302 echo "---"
303 echo "Configuration summary for $PACKAGE_NAME version $VERSION"
304 echo ""
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"
320 echo ""
321 echo "---"
322
323 case "$host_os" in
324 *freebsd*)
325 echo "*****"
326 echo "*"
327 echo "* NOTE: You are on FreeBSD. BSD make will not work."
328 echo "*"
329 echo "* use 'gmake' To build libmemcached"
330 echo "*"
331 echo "*****"
332 ;;
333 esac
334