Merge lp:~tangent-org/libmemcached/1.0-build/ Build: jenkins-Libmemcached-241
[m6w6/libmemcached] / configure.ac
1 # LibmemcacheD
2 # Copyright (C) 2011-2013 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.17],[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_SUBST([AUTOHEADER_FILE],[mem_config.h])
23 AC_CONFIG_SRCDIR([libmemcached/memcached.cc])
24
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
29 # | | |
30 # +------+ | +---+
31 # | | |
32 # current:revision:age
33 # | | |
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])
42
43 AX_HEX_VERSION([LIBMEMCACHED],[$VERSION])
44 AX_HEX_VERSION([LIBHASHKIT],[1.0.0])
45
46 m4_include([libhashkit/include.m4])
47
48 LT_PREREQ([2.2])
49 LT_INIT
50 LT_LANG([C++])
51 LT_LIB_M
52
53 AX_ASSERT
54
55 AX_PLATFORM
56
57 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
58
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])])
62
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])
69
70 AM_CONDITIONAL([BUILD_LIBMEMCACHED_PROTOCOL],[test "$ax_enable_libmemcachedprotocol" = "yes"])
71
72 AC_MSG_CHECKING([for libmemcachedprotocol])
73 AC_MSG_RESULT([$ax_enable_libmemcachedprotocol])
74 ])
75 LIBMEMCACHED_PROTOCOL
76
77 # Adding support for libtest
78 m4_include([libtest/yatl.m4])
79
80 CHECK_FOR_GEARMAND
81 CHECK_FOR_LIBGEARMAND
82
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])
87
88 AM_CONDITIONAL([BUILDING_GEARMAN],[false])
89
90 # Specialty checks
91 AX_CXX_CINTTYPES
92 CONFIG_EXTRA
93 DETECT_BYTEORDER
94 SETSOCKOPT_SANITY
95 ENABLE_HSIEH_HASH
96 ENABLE_MURMUR_HASH
97 ENABLE_FNV64_HASH
98 ENABLE_MEMASLAP
99 PROTOCOL_BINARY_TEST
100 ENABLE_DEPRECATED
101
102 # Checks for programs.
103 AC_PROG_AWK
104 AC_PROG_SED
105 AC_PROG_MKDIR_P
106 AC_CHECK_PROGS([LEX],['flex'],[:])
107 AC_CHECK_PROGS([YACC],['bison'],[:])
108 AX_PROG_SPHINX_BUILD
109 AX_PROG_MEMCACHED
110
111 # Checks for libraries.
112 AC_SEARCH_LIBS([getopt_long],[gnugetopt])
113 AC_SEARCH_LIBS([gethostbyname],[nsl])
114
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])
147
148 # Windows only
149 AC_CHECK_HEADERS_ONCE([winsock2.h])
150 AC_CHECK_HEADERS_ONCE([ws2tcpip.h])
151
152 # Checks for typedefs, structures, and compiler characteristics.
153
154 # Checks for library functions.
155
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])
184 AC_FUNC_ALLOCA
185 AC_FUNC_ERROR_AT_LINE
186 AC_FUNC_FORK
187 AC_FUNC_STRERROR_R
188
189 AC_CHECK_HEADER([umem.h],
190 [AC_DEFINE([HAVE_UMEM_H],[1],[Define this if you have umem.h])
191 build_cache=no],
192 [build_cache=yes])
193
194 AM_CONDITIONAL([BUILD_CACHE],[test "x$build_cache" = "xyes"])
195
196 AX_COMPILER_VENDOR
197
198 AC_CHECK_TYPES([in_port_t],,,[[
199 #ifdef HAVE_SYS_TYPES_H
200 # include <sys/types.h>
201 #endif
202 #ifdef HAVE_NETINET_IN_H
203 # include <netinet/in.h>
204 #endif
205 #ifdef HAVE_NETDB_H
206 # include <netdb.h>
207 #endif]])
208 AC_CHECK_TYPES([ptrdiff_t])
209 AC_HEADER_STDBOOL
210 AC_TYPE_INT16_T
211 AC_TYPE_INT32_T
212 AC_TYPE_INT64_T
213 AC_TYPE_INT8_T
214 AC_TYPE_OFF_T
215 AC_TYPE_PID_T
216 AC_TYPE_SSIZE_T
217 AC_TYPE_UINT16_T
218 AC_TYPE_UINT32_T
219 AC_TYPE_UINT64_T
220 AC_TYPE_UINT8_T
221
222 AC_C_BIGENDIAN
223 AC_C_CONST
224 AC_C_INLINE
225 AC_C_VOLATILE
226 AC_C_RESTRICT
227
228 AX_CXX_GCC_ABI_DEMANGLE
229
230 AX_LIBEVENT
231
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])])
236
237
238 # Check for the ability to call dlopen (used in libhostile)
239 AX_DLOPEN
240
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])])])
247
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])
254
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
260 # in Makefile.am
261 AC_CHECK_FUNCS([setppriv],
262 [AC_CHECK_HEADER([priv.h],
263 [AC_DEFINE([HAVE_DROP_PRIVILEGES],
264 [1],
265 [Define this if you have an implementation of drop_privileges()])
266 build_solaris_privs=yes])
267 ])
268
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"
275 ])
276 SOCKET_SEND_FLAGS
277
278 AX_UUID_GENERATE_TIME_SAFE
279
280 AC_DEFUN([CHECK_FOR_PTHREAD_AND_SASL],
281 [AX_PTHREAD(, [AC_MSG_ERROR([could not find libpthread])])
282 AX_PTHREAD_TIMEDJOIN_NP
283
284 # The sasl functions should only be visible if we build with sasl support
285 #
286 AX_SASL_OPTION
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])
291 ])
292 CHECK_FOR_PTHREAD_AND_SASL
293
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"])
301
302 PANDORA_ENABLE_DTRACE
303 HAVE_GCC_ATOMICS
304 AX_ENDIAN
305 AX_ASSERT
306 AX_HARDEN_COMPILER_FLAGS
307
308 AX_AM_JOBSERVER([yes])
309
310 AC_CONFIG_FILES([Makefile
311 docs/conf.py
312 libmemcached-1.0/configure.h
313 support/libmemcached.pc
314 support/libmemcached.spec
315 ])
316 AC_OUTPUT
317
318 echo "---"
319 echo "Configuration summary for $PACKAGE_NAME version $VERSION"
320 echo ""
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"
337 echo ""
338 echo "---"
339
340 case "$host_os" in
341 *freebsd*)
342 echo "*****"
343 echo "*"
344 echo "* NOTE: You are on FreeBSD. BSD make will not work."
345 echo "*"
346 echo "* use 'gmake' To build libmemcached"
347 echo "*"
348 echo "*****"
349 ;;
350 esac
351