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