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