Check for failures while configuring client.
[awesomized/libmemcached] / configure.ac
1 #!/usr/bin/env bash
2 # LibmemcacheD
3 # Copyright (C) 2011 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_PREREQ(2.59)
11 AC_INIT([libmemcached],[0.48],[http://libmemcached.org/])
12 AC_CONFIG_SRCDIR([libmemcached/memcached.c])
13 AC_CONFIG_AUX_DIR(config)
14
15 PANDORA_CANONICAL_TARGET(no-vc-changelog)
16 AC_CHECK_PROGS([YACC], ['bison'], [:])
17 AC_CHECK_PROGS([LEX], ['flex'], [:])
18
19 #shared library versioning
20 MEMCACHED_UTIL_LIBRARY_VERSION=1:0:0
21 MEMCACHED_PROTOCAL_LIBRARY_VERSION=0:0:0
22 MEMCACHED_LIBRARY_VERSION=6:0:0
23 # | | |
24 # +------+ | +---+
25 # | | |
26 # current:revision:age
27 # | | |
28 # | | +- increment if interfaces have been added
29 # | | set to zero if interfaces have been removed or changed
30 # | +- increment if source code has changed
31 # | set to zero if current is incremented
32 # +- increment if interfaces have been added, removed or changed
33 AC_SUBST(MEMCACHED_UTIL_LIBRARY_VERSION)
34 AC_SUBST(MEMCACHED_PROTOCAL_LIBRARY_VERSION)
35 AC_SUBST(MEMCACHED_LIBRARY_VERSION)
36
37
38 HASHKIT_LIBRARY_VERSION=1:0:0
39 AC_SUBST(HASHKIT_LIBRARY_VERSION)
40
41 AH_TOP([
42 #ifndef CONFIG_H
43 #define CONFIG_H
44
45 #ifdef _SYS_FEATURE_TESTS_H
46 #error "You should include config.h as your first include file"
47 #endif
48
49 #ifdef WIN32
50 #define _WIN32_WINNT 0x0501
51 #endif
52 ])
53
54 AH_BOTTOM([
55 #ifdef HAVE_SYS_WAIT_H
56 #include <sys/wait.h>
57 #endif
58
59 #ifdef HAVE_FNMATCH_H
60 #include <fnmatch.h>
61 #endif
62
63 #ifdef HAVE_POLL_H
64 #include <poll.h>
65 #else
66 #include "poll/poll.h"
67 #endif
68
69 /* To hide the platform differences between MS Windows and Unix, I am
70 * going to use the Microsoft way and #define the Microsoft-specific
71 * functions to the unix way. Microsoft use a separate subsystem for sockets,
72 * but Unix normally just use a filedescriptor on the same functions. It is
73 * a lot easier to map back to the unix way with macros than going the other
74 * way without side effect ;-)
75 */
76 #ifdef WIN32
77 #include "win32/wrappers.h"
78 #define get_socket_errno() WSAGetLastError()
79 #else
80 #define INVALID_SOCKET -1
81 #define SOCKET_ERROR -1
82 #define closesocket(a) close(a)
83 #define get_socket_errno() errno
84 #endif
85
86 #ifndef HAVE_MSG_NOSIGNAL
87 #define MSG_NOSIGNAL 0
88 #endif
89
90 #ifndef HAVE_MSG_DONTWAIT
91 #define MSG_DONTWAIT 0
92 #endif
93
94 #endif
95 ])
96
97 AC_SEARCH_LIBS(getopt_long, gnugetopt)
98 AC_SEARCH_LIBS(gethostbyname, nsl)
99
100 AC_CHECK_FUNCS([getline])
101
102 PANDORA_HAVE_LIBGTEST
103 PANDORA_HAVE_LIBEVENT
104 my_saved_libs="$LIBS"
105 LIBS=
106 PANDORA_REQUIRE_PTHREAD
107 LIBS="$my_saved_libs"
108
109 dnl Specialty checks
110 DETECT_BYTEORDER
111 ENABLE_UTILLIB
112 SETSOCKOPT_SANITY
113 ENABLE_HSIEH_HASH
114 ENABLE_MURMUR_HASH
115 PROTOCOL_BINARY_TEST
116 WITH_MEMCACHED
117 ENABLE_DEPRECATED
118 PANDORA_HAVE_LIBINNODB
119 PANDORA_PRINT_CALLSTACK
120 PANDORA_HAVE_SASL
121
122 dnl The sasl functions should only be visible if we build with sasl support
123 AS_IF([test "x$ac_cv_sasl" = "xyes"],
124 [LIBMEMCACHED_WITH_SASL_SUPPORT="#define LIBMEMCACHED_WITH_SASL_SUPPORT 1"])
125 AC_SUBST(LIBMEMCACHED_WITH_SASL_SUPPORT)
126
127 AC_CHECK_HEADERS([atomic.h])
128 AS_IF([test "x$ac_cv_header_atomic_h" = "xyes"],[
129 AC_CHECK_FUNCS(atomic_add_64)
130 AC_CHECK_FUNCS(atomic_add_32)
131 AS_IF([test "x$ac_cv_func_atomic_add_64" = "xyes" -a "x$ac_cv_func_atomic_add_32" = "xyes"],[
132 AC_DEFINE([USE_ATOMIC_H],
133 [1],
134 [Define to true if you want to use functions from atomic.h])])])
135
136 AC_ARG_WITH([docs],
137 [AS_HELP_STRING([--with-docs],
138 [Generate documentation (yes|no) @<:@default=yes@:>@])],
139 [with_docs=$withval],
140 [with_docs=yes])
141
142 AS_IF([test "$with_docs" = "yes"],
143 [
144 REQUIRE_POD2MAN
145 REQUIRE_PODCHECKER
146 ])
147 AM_CONDITIONAL(BUILD_DOCS, test "$with_docs" = "yes")
148
149 AC_CHECK_HEADERS_ONCE(winsock2.h poll.h sys/wait.h fnmatch.h)
150 AM_CONDITIONAL(BUILD_POLL, test "x$ac_cv_header_poll_h" = "xno")
151 AM_CONDITIONAL(BUILD_WIN32_WRAPPERS, test "x$ac_cv_header_winsock2_h" = "xyes")
152 AS_IF(test "x$ac_cv_header_winsock2_h" = "xyes",
153 [AM_LDFLAGS="$AM_LDFLAGS -lws2_32"
154 AM_CFLAGS="$AM_CFLAGS $NO_WERROR"
155 AM_CXXFLAGS="$AM_CXXFLAGS $NO_WERROR"
156 ])
157 DETECT_EAGAIN
158 SOCKET_SEND_FLAGS
159
160 AC_CONFIG_FILES([
161 Makefile
162 docs/Makefile
163 libhashkit/configure.h
164 libmemcached/configure.h
165 support/libmemcached.pc
166 support/libmemcached.spec
167 support/libmemcached-fc.spec
168 ])
169 AC_OUTPUT
170
171 echo "---"
172 echo "Configuration summary for $PACKAGE_NAME version $VERSION"
173 echo ""
174 echo " * Installation prefix: $prefix"
175 echo " * System type: $host_vendor-$host_os"
176 echo " * Host CPU: $host_cpu"
177 echo " * C Compiler: $CC_VERSION"
178 echo " * Assertions enabled: $ac_cv_assert"
179 echo " * Debug enabled: $with_debug"
180 echo " * Warnings as failure: $ac_cv_warnings_as_errors"
181 echo ""
182 echo "---"
183
184 case "$host_os" in
185 *freebsd*)
186 echo "*****"
187 echo "*"
188 echo "* NOTE: You are on FreeBSD. BSD make will not work."
189 echo "*"
190 echo "* use 'gmake' To build libmemcached"
191 echo "*"
192 echo "*****"
193 ;;
194 esac
195
196 AS_IF(test "$with_docs" = "no",
197 [
198 echo "*****"
199 echo "*"
200 echo "* WARNING: You are not generating any documentation."
201 echo "* Please don't ship libmemcached to an end user"
202 echo "* without documentation..."
203 echo "*"
204 echo "*****"
205 ])