Fixes around m4 from trunk
[awesomized/libmemcached] / configure.ac
1 #!/usr/bin/env bash
2 # LibmemcacheD
3 # Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/
4 # Copyright (C) 2006-2010 Brian Aker, Monty Taylor, Trond Norbye
5 # All rights reserved.
6 #
7 # Use and distribution licensed under the BSD license. See
8 # the COPYING file in this directory for full text.
9
10 AC_INIT([libmemcached],[1.0.4],[http://libmemcached.org/])
11
12 AC_CONFIG_AUX_DIR(config)
13
14 AC_CANONICAL_TARGET
15
16 AM_INIT_AUTOMAKE
17
18 AC_CANONICAL_HOST
19 AC_CANONICAL_BUILD
20
21 AC_PREREQ([2.61])
22
23 AC_CONFIG_MACRO_DIR(m4)
24
25 AC_CONFIG_HEADERS([config.h:config.in])dnl Keep filename to 8.3 for MS-DOS.
26
27 AC_CONFIG_SRCDIR([libmemcached/memcached.cc])
28
29 PANDORA_CANONICAL_TARGET(no-vc-changelog)
30 AC_CHECK_PROGS([YACC], ['bison'], [:])
31 AC_CHECK_PROGS([LEX], ['flex'], [:])
32
33 #shared library versioning
34 MEMCACHED_UTIL_LIBRARY_VERSION=2:0:0
35 MEMCACHED_PROTOCAL_LIBRARY_VERSION=0:0:0
36 MEMCACHED_LIBRARY_VERSION=9:0:0
37 # | | |
38 # +------+ | +---+
39 # | | |
40 # current:revision:age
41 # | | |
42 # | | +- increment if interfaces have been added
43 # | | set to zero if interfaces have been removed or changed
44 # | +- increment if source code has changed
45 # | set to zero if current is incremented
46 # +- increment if interfaces have been added, removed or changed
47 AC_SUBST(MEMCACHED_UTIL_LIBRARY_VERSION)
48 AC_SUBST(MEMCACHED_PROTOCAL_LIBRARY_VERSION)
49 AC_SUBST(MEMCACHED_LIBRARY_VERSION)
50
51
52 HASHKIT_LIBRARY_VERSION=1:0:0
53 AC_SUBST(HASHKIT_LIBRARY_VERSION)
54
55 LT_PREREQ([2.2])
56 LT_INIT()
57 LT_LANG([C++])
58 LT_LANG([C])
59 gl_VISIBILITY
60
61 AX_CXX_HEADER_STDCXX_98
62 if test "$ax_cv_cxx_stdcxx_98" = no; then
63 AC_MSG_ERROR([Your system lacks a new enough C++ compiler])
64 fi
65
66 m4_include([m4/memcached.m4])
67 m4_include([m4/memcached_sasl.m4])
68 m4_include([m4/gearmand.m4])
69 m4_include([m4/libgearman.m4])
70
71 AM_CONDITIONAL(BUILDING_LIBMEMCACHED, true)
72 AM_CONDITIONAL(HAVE_LIBMEMCACHED, false)
73 AC_DEFINE([HAVE_LIBMEMCACHED], [1], [Enables libmemcached Support])
74
75 AM_CONDITIONAL(BUILDING_GEARMAN, false)
76
77 AC_SEARCH_LIBS(getopt_long, gnugetopt)
78 AC_SEARCH_LIBS(gethostbyname, nsl)
79
80 case "$target_os" in
81 *linux*)
82 AS_IF([test "x$GCC" = "xyes"],
83 [
84 LDFLAGS="$LDFLAGS -z relro -z now"
85 ])
86 ;;
87 esac
88
89 dnl Specialty checks
90 AX_PTHREAD
91 AX_CXX_CINTTYPES
92 CONFIG_EXTRA
93 DETECT_BYTEORDER
94 ENABLE_UTILLIB
95 SETSOCKOPT_SANITY
96 ENABLE_HSIEH_HASH
97 ENABLE_MURMUR_HASH
98 ENABLE_FNV64_HASH
99 ENABLE_MEMASLAP
100 PROTOCOL_BINARY_TEST
101 ENABLE_DEPRECATED
102 PANDORA_HAVE_SASL
103
104 AC_CHECK_FUNCS([alarm])
105 AC_CHECK_FUNCS([dup2])
106 AC_CHECK_FUNCS([getline])
107 AC_CHECK_FUNCS([gettimeofday])
108 AC_CHECK_FUNCS([memchr])
109 AC_CHECK_FUNCS([memmove])
110 AC_CHECK_FUNCS([memset])
111 AC_CHECK_FUNCS([select])
112 AC_CHECK_FUNCS([setenv])
113 AC_CHECK_FUNCS([socket])
114 AC_CHECK_FUNCS([sqrt])
115 AC_CHECK_FUNCS([strcasecmp])
116 AC_CHECK_FUNCS([strchr])
117 AC_CHECK_FUNCS([strdup])
118 AC_CHECK_FUNCS([strerror])
119 AC_CHECK_FUNCS([strtol])
120 AC_CHECK_FUNCS([strtoul])
121 AC_CHECK_FUNCS([strtoull])
122
123 AC_CHECK_HEADERS([arpa/inet.h])
124 AC_CHECK_HEADERS([fcntl.h])
125 AC_CHECK_HEADERS([libintl.h])
126 AC_CHECK_HEADERS([limits.h])
127 AC_CHECK_HEADERS([malloc.h])
128 AC_CHECK_HEADERS([netdb.h])
129 AC_CHECK_HEADERS([netinet/in.h])
130 AC_CHECK_HEADERS([stddef.h])
131 AC_CHECK_HEADERS([sys/time.h])
132 AC_CHECK_HEADERS([sasl/sasl.h])
133 AC_CHECK_HEADERS([execinfo.h])
134 AC_CHECK_HEADERS([cxxabi.h],
135 AC_DEFINE([HAVE_CXXABI_H], [1], [Have cxxabi.h]),
136 AC_DEFINE([HAVE_CXXABI_H], [0], [Have cxxabi.h]))
137
138 AX_COMPILER_VENDOR
139 AC_CXX_HEADER_STDCXX_98
140
141 AC_FUNC_ALLOCA
142 AC_FUNC_ERROR_AT_LINE
143 AC_FUNC_FORK
144 AC_FUNC_MALLOC
145 AC_FUNC_REALLOC
146 AC_FUNC_STRERROR_R
147 AC_HEADER_STDBOOL
148 AC_TYPE_INT16_T
149 AC_TYPE_INT32_T
150 AC_TYPE_INT64_T
151 AC_TYPE_INT8_T
152 AC_TYPE_OFF_T
153 AC_TYPE_PID_T
154 AC_TYPE_SSIZE_T
155 AC_TYPE_UINT16_T
156 AC_TYPE_UINT32_T
157 AC_TYPE_UINT64_T
158 AC_TYPE_UINT8_T
159
160 AC_C_BIGENDIAN
161 AC_C_CONST
162 AC_C_INLINE
163 AC_C_VOLATILE
164 AC_C_RESTRICT
165
166 AX_CXX_GCC_ABI_DEMANGLE
167
168 AX_CHECK_LIBRARY([LIBUUID], [uuid/uuid.h], [uuid],
169 [
170 LIBUUID_LDFLAGS="-luuid"
171 AC_DEFINE([HAVE_LIBUUID], [ 1 ], [Have libuuid])
172 ],
173 [
174 AC_DEFINE([HAVE_LIBUUID], [ 0 ], [Have libuuid])
175 ])
176
177 AC_CHECK_LIB([rt], [clock_gettime],
178 [
179 RT_LIB="-lrt"
180 AC_SUBST(RT_LIB)
181 AC_DEFINE([HAVE_LIBRT], [ 1 ], [Have clock_gettime])
182 ],
183 [
184 AC_DEFINE([HAVE_LIBRT], [ 0 ], [Have clock_gettime])
185 ])
186
187 AC_CHECK_LIB([m], [floor])
188
189 dnl The sasl functions should only be visible if we build with sasl support
190 AS_IF([test "x$ac_cv_sasl" = "xyes"],
191 [
192 [ LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 1" ]
193 ],
194 [
195 [ LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 0" ]
196 ]
197 )
198 AC_SUBST(LIBMEMCACHED_WITH_SASL_SUPPORT)
199
200 AC_CHECK_HEADERS([atomic.h])
201 AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],[
202 AC_CHECK_FUNCS(atomic_add_64)
203 AC_CHECK_FUNCS(atomic_add_32)
204 AS_IF([test "x$ac_cv_func_atomic_add_64" = "xyes" -a "x$ac_cv_func_atomic_add_32" = "xyes"],[
205 AC_DEFINE([USE_ATOMIC_H],
206 [1],
207 [Define to true if you want to use functions from atomic.h])])])
208
209 AC_CHECK_HEADERS_ONCE(winsock2.h poll.h sys/wait.h fnmatch.h)
210 AM_CONDITIONAL(BUILD_POLL, test "x$ac_cv_header_poll_h" = "xno")
211 AM_CONDITIONAL(BUILD_WIN32_WRAPPERS, test "x$ac_cv_header_winsock2_h" = "xyes")
212 AS_IF(test "x$ac_cv_header_winsock2_h" = "xyes",
213 [AM_LDFLAGS="$AM_LDFLAGS -lws2_32"
214 AM_CFLAGS="$AM_CFLAGS $NO_WERROR"
215 AM_CXXFLAGS="$AM_CXXFLAGS $NO_WERROR"
216 ])
217 SOCKET_SEND_FLAGS
218
219 AX_CHECK_LIBRARY([LIBEVENT], [event.h], [event],
220 [
221 LIBEVENT_LDFLAGS="-levent"
222 ],
223 [
224 AC_MSG_WARN([Unable to find libevent])
225 ])
226 AM_CONDITIONAL(HAVE_LIBEVENT, test "x${ax_cv_have_LIBEVENT}" = "xyes")
227
228 AC_CONFIG_FILES([
229 Makefile
230 docs/conf.py
231 libhashkit-1.0/configure.h
232 libmemcached-1.0/configure.h
233 libmemcached-1.2/configure.h
234 libmemcached-2.0/configure.h
235 support/libmemcached.pc
236 support/libmemcached.spec
237 support/libmemcached-fc.spec
238 libtest/version.h
239 ])
240 AC_OUTPUT
241
242 echo "---"
243 echo "Configuration summary for $PACKAGE_NAME version $VERSION"
244 echo ""
245 echo " * Installation prefix: $prefix"
246 echo " * System type: $host_vendor-$host_os"
247 echo " * Host CPU: $host_cpu"
248 echo " * C Compiler: $CC_VERSION"
249 echo " * Assertions enabled: $ac_cv_assert"
250 echo " * Debug enabled: $with_debug"
251 echo " * Warnings as failure: $ac_cv_warnings_as_errors"
252 echo ""
253 echo "---"
254
255 case "$host_os" in
256 *freebsd*)
257 echo "*****"
258 echo "*"
259 echo "* NOTE: You are on FreeBSD. BSD make will not work."
260 echo "*"
261 echo "* use 'gmake' To build libmemcached"
262 echo "*"
263 echo "*****"
264 ;;
265 esac
266