Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 542 lines (483 sloc) 14.931 kB
1b53326 @bradfitz autoconf/automake support from evan
bradfitz authored
1 AC_PREREQ(2.52)
8ecbd88 Replace ./autogen.sh with ./config/autorun.sh
Trond Norbye authored
2 m4_include([m4/version.m4])
a0a7032 @dustin Backporting AC_PROG_CC_C99 macro for redhat.
dustin authored
3 m4_include([m4/c99-backport.m4])
4 AC_INIT(memcached, VERSION_NUMBER, memcached@googlegroups.com)
df8f7a8 @bradfitz my first attempt at autoconf. seems to work.
bradfitz authored
5 AC_CANONICAL_SYSTEM
1b53326 @bradfitz autoconf/automake support from evan
bradfitz authored
6 AC_CONFIG_SRCDIR(memcached.c)
601b690 @bradfitz auto* changes, update to version 1.0.2
bradfitz authored
7 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
1b53326 @bradfitz autoconf/automake support from evan
bradfitz authored
8 AM_CONFIG_HEADER(config.h)
9
10 AC_PROG_CC
1a6619b Create the engine as a shared object..
Trond Norbye authored
11 AC_DISABLE_STATIC
12 AC_PROG_LIBTOOL
13
14 if test "x${enable_dependency_tracking}" = "x"
15 then
16 enable_dependency_tracking=yes
17 fi
dfc5130 @dustin Get build working under ICC.
dustin authored
18
19 dnl **********************************************************************
20 dnl DETECT_ICC ([ACTION-IF-YES], [ACTION-IF-NO])
21 dnl
22 dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
23 dnl sets the $ICC variable to "yes" or "no"
24 dnl **********************************************************************
25 AC_DEFUN([DETECT_ICC],
26 [
27 ICC="no"
28 AC_MSG_CHECKING([for icc in use])
29 if test "$GCC" = "yes"; then
30 dnl check if this is icc acting as gcc in disguise
31 AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
725c26f @dustin Workaround Solaris autoconf interaction to look for C99.
dustin authored
32 AC_MSG_RESULT([no])
6ddbbfd Fix output from DETECT_ICC macro when $GCC != "yes"
Trond Norbye authored
33 [$2],
dfc5130 @dustin Get build working under ICC.
dustin authored
34 AC_MSG_RESULT([yes])
35 [$1]
725c26f @dustin Workaround Solaris autoconf interaction to look for C99.
dustin authored
36 ICC="yes")
6ddbbfd Fix output from DETECT_ICC macro when $GCC != "yes"
Trond Norbye authored
37 else
38 AC_MSG_RESULT([no])
39 [$2]
dfc5130 @dustin Get build working under ICC.
dustin authored
40 fi
41 ])
42
9a05216 Added --disable-coverage
Trond Norbye authored
43 dnl **********************************************************************
44 dnl DETECT_SUNCC ([ACTION-IF-YES], [ACTION-IF-NO])
45 dnl
46 dnl check if this is the Sun Studio compiler, and if so run the ACTION-IF-YES
47 dnl sets the $SUNCC variable to "yes" or "no"
48 dnl **********************************************************************
49 AC_DEFUN([DETECT_SUNCC],
50 [
51 SUNCC="no"
52 AC_MSG_CHECKING([for Sun cc in use])
53 AC_RUN_IFELSE(
54 [AC_LANG_PROGRAM([], [dnl
55 #ifdef __SUNPRO_C
56 return 0;
57 #else
58 return 1;
59 #endif
60 ])
61 ],[
62 AC_MSG_RESULT([yes])
63 [$1]
64 SUNCC="yes"
65 ], [
66 AC_MSG_RESULT([no])
67 [$2]
68 ])
69 ])
70
5cdc4e8 Refactor: Reduce symbol visibility
Trond Norbye authored
71 AS_IF(test "x$GCC" = "xyes",
72 DETECT_ICC([], [CFLAGS="-fvisibility=hidden $CFLAGS"]),
73 ICC=no
74 DETECT_SUNCC([CFLAGS="-xldscope=hidden -mt $CFLAGS"], []))
9a05216 Added --disable-coverage
Trond Norbye authored
75
6ea8f57 @dustin Fix shell bug in configure.
dustin authored
76 if test "$ICC" = "no"; then
725c26f @dustin Workaround Solaris autoconf interaction to look for C99.
dustin authored
77 AC_PROG_CC_C99
78 fi
dfc5130 @dustin Get build working under ICC.
dustin authored
79
9d99ab6 small fix for newer versions of automake
Paul Lindner authored
80 AM_PROG_CC_C_O
1b53326 @bradfitz autoconf/automake support from evan
bradfitz authored
81 AC_PROG_INSTALL
82
48abfcc @dustin Look for sasl.
dustin authored
83 AC_ARG_ENABLE(sasl,
84 [AS_HELP_STRING([--enable-sasl],[Enable SASL authentication])])
85
7a221d9 @trondn Add support for --enable-sasl-pwdb
trondn authored
86 AC_ARG_ENABLE(sasl_pwdb,
87 [AS_HELP_STRING([--enable-sasl-pwdb],[Enable plaintext password db])])
88
89 AS_IF([test "x$enable_sasl_pwdb" = "xyes"],
90 [enable_sasl=yes ])
91
92
93 dnl **********************************************************************
94 dnl DETECT_SASL_CB_GETCONF
95 dnl
96 dnl check if we can use SASL_CB_GETCONF
97 dnl **********************************************************************
98 AC_DEFUN([AC_C_DETECT_SASL_CB_GETCONF],
99 [
100 AC_CACHE_CHECK([for SASL_CB_GETCONF],
101 [ac_cv_c_sasl_cb_getconf],
102 [AC_TRY_COMPILE(
103 [
104 #include <sasl/sasl.h>
105 ], [
106 unsigned long val = SASL_CB_GETCONF;
107 ],
108 [ ac_cv_c_sasl_cb_getconf=yes ],
109 [ ac_cv_c_sasl_cb_getconf=no ])
110 ])
111 AS_IF([test "$ac_cv_c_sasl_cb_getconf" = "yes"],
112 [AC_DEFINE([HAVE_SASL_CB_GETCONF], 1,
113 [Set to nonzero if your SASL implementation supports SASL_CB_GETCONF])])
114 ])
115
48abfcc @dustin Look for sasl.
dustin authored
116 AC_CHECK_HEADERS([sasl/sasl.h])
117 if test "x$enable_sasl" = "xyes"; then
7a221d9 @trondn Add support for --enable-sasl-pwdb
trondn authored
118 AC_C_DETECT_SASL_CB_GETCONF
48abfcc @dustin Look for sasl.
dustin authored
119 AC_DEFINE([ENABLE_SASL],1,[Set to nonzero if you want to include SASL])
7a221d9 @trondn Add support for --enable-sasl-pwdb
trondn authored
120 AC_SEARCH_LIBS([sasl_server_init], [sasl2 sasl], [],
48abfcc @dustin Look for sasl.
dustin authored
121 [
122 AC_MSG_ERROR([Failed to locate the library containing sasl_server_init])
123 ])
7a221d9 @trondn Add support for --enable-sasl-pwdb
trondn authored
124
125 AS_IF([test "x$enable_sasl_pwdb" = "xyes"],
126 [AC_DEFINE([ENABLE_SASL_PWDB], 1,
127 [Set to nonzero if you want to enable a SASL pwdb])])
48abfcc @dustin Look for sasl.
dustin authored
128 fi
129
7828684 @dustin Optionally build-in the default engine.
dustin authored
130 AC_ARG_ENABLE(default-engine,
131 [AS_HELP_STRING([--enable-default-engine], [Build-in default engine])])
132 AM_CONDITIONAL([INCLUDE_DEFAULT_ENGINE],[test "$enable_default_engine" = "yes"])
133
6895721 Add DTrace probes for Solaris/etc.
Trond Norbye authored
134 AC_ARG_ENABLE(dtrace,
135 [AS_HELP_STRING([--enable-dtrace],[Enable dtrace probes])])
4f84702 @dustin Fixed some more == in shell tests.
dustin authored
136 if test "x$enable_dtrace" = "xyes"; then
6895721 Add DTrace probes for Solaris/etc.
Trond Norbye authored
137 AC_PATH_PROG([DTRACE], [dtrace], "no", [/usr/sbin:$PATH])
138 if test "x$DTRACE" != "xno"; then
139 AC_DEFINE([ENABLE_DTRACE],1,[Set to nonzero if you want to include DTRACE])
7c23e79 Modified the dtrace build support
Trond Norbye authored
140 build_dtrace=yes
e440813 dtrace on macosx does not support -G
Trond Norbye authored
141 # DTrace on MacOSX does not use -G option
40c8848 Invoke the dtrace binary we searched for instead of searching the path
Trond Norbye authored
142 $DTRACE -G -o conftest.$$ -s memcached_dtrace.d 2>/dev/zero
e440813 dtrace on macosx does not support -G
Trond Norbye authored
143 if test $? -eq 0
144 then
7c23e79 Modified the dtrace build support
Trond Norbye authored
145 dtrace_instrument_obj=yes
e440813 dtrace on macosx does not support -G
Trond Norbye authored
146 rm conftest.$$
7c23e79 Modified the dtrace build support
Trond Norbye authored
147 fi
4f5e185 Detect broken compilation environment on Solaris
Trond Norbye authored
148
149 if test "`which tr`" = "/usr/ucb/tr"; then
150 AC_MSG_ERROR([Please remove /usr/ucb from your path. See man standards for more info])
151 fi
6895721 Add DTrace probes for Solaris/etc.
Trond Norbye authored
152 else
153 AC_MSG_ERROR([Need dtrace binary and OS support.])
154 fi
155 fi
e440813 dtrace on macosx does not support -G
Trond Norbye authored
156
7c23e79 Modified the dtrace build support
Trond Norbye authored
157 AM_CONDITIONAL([BUILD_DTRACE],[test "$build_dtrace" = "yes"])
158 AM_CONDITIONAL([DTRACE_INSTRUMENT_OBJ],[test "$dtrace_instrument_obj" = "yes"])
48abfcc @dustin Look for sasl.
dustin authored
159 AM_CONDITIONAL([ENABLE_SASL],[test "$enable_sasl" = "yes"])
7c23e79 Modified the dtrace build support
Trond Norbye authored
160
6895721 Add DTrace probes for Solaris/etc.
Trond Norbye authored
161 AC_SUBST(DTRACE)
162 AC_SUBST(DTRACEFLAGS)
48abfcc @dustin Look for sasl.
dustin authored
163 AC_SUBST(ENABLE_SASL)
2a381c8 @dustin libgcov is needed for gcov debug builds.
dustin authored
164 AC_SUBST(PROFILER_LDFLAGS)
6895721 Add DTrace probes for Solaris/etc.
Trond Norbye authored
165
9a05216 Added --disable-coverage
Trond Norbye authored
166 AC_ARG_ENABLE(coverage,
e19b312 Don't build two binaries.. build one and test it!
Trond Norbye authored
167 [AS_HELP_STRING([--enable-coverage],[Disable code coverage])])
9a05216 Added --disable-coverage
Trond Norbye authored
168
e19b312 Don't build two binaries.. build one and test it!
Trond Norbye authored
169 if test "x$enable_coverage" = "xyes"; then
9a05216 Added --disable-coverage
Trond Norbye authored
170 if test "$ICC" = "yes"
171 then
172 dnl ICC trying to be gcc, but not well
b416a19 Use -pthread when compiling threaded code with gcc
Trond Norbye authored
173 CFLAGS="$CFLAGS -pthread"
9a05216 Added --disable-coverage
Trond Norbye authored
174 elif test "$GCC" = "yes"
175 then
b416a19 Use -pthread when compiling threaded code with gcc
Trond Norbye authored
176 CFLAGS="$CFLAGS -pthread"
9a05216 Added --disable-coverage
Trond Norbye authored
177 AC_PATH_PROG([PROFILER], [gcov], "no", [$PATH])
178 if test "x$PROFILER" != "xno"; then
9ff5b44 Issue 97: Check for the existence of libgcov
Trond Norbye authored
179 # Issue 97: The existense of gcov doesn't mean we have -lgcov
180 AC_CHECK_LIB(gcov, main,
181 [
182 PROFILER_FLAGS="-fprofile-arcs -ftest-coverage"
183 PROFILER_LDFLAGS="-lgcov"
184 ], [
185 PROFILER_FLAGS=
186 PROFILER_LDFLAGS=
187 ])
9a05216 Added --disable-coverage
Trond Norbye authored
188 fi
189 elif test "$SUNCC" = "yes"
190 then
191 AC_PATH_PROG([PROFILER], [tcov], "no", [$PATH])
192 if test "x$PROFILER" != "xno"; then
193 PROFILER_FLAGS=-xprofile=tcov
194 fi
0d56047 @victorkirkebo Added support for test code coverage output for "make test" target
victorkirkebo authored
195 fi
196 fi
197 AC_SUBST(PROFILER_FLAGS)
198
199
9281de4 Add --enable-64bit to build 64-bit version of memcached (Trond Norbye…
Trond Norbye authored
200 AC_ARG_ENABLE(64bit,
b2e7e90 DTrace probe fix, Fix typo in configure script, Use calloc(3) instead…
Ricky Zhou authored
201 [AS_HELP_STRING([--enable-64bit],[build 64bit version])])
4f84702 @dustin Fixed some more == in shell tests.
dustin authored
202 if test "x$enable_64bit" = "xyes"
9281de4 Add --enable-64bit to build 64-bit version of memcached (Trond Norbye…
Trond Norbye authored
203 then
204 org_cflags=$CFLAGS
205 CFLAGS=-m64
206 AC_RUN_IFELSE(
207 [AC_LANG_PROGRAM([], [dnl
208 return sizeof(void*) == 8 ? 0 : 1;
209 ])
210 ],[
211 CFLAGS="-m64 $org_cflags"
212 ],[
213 AC_MSG_ERROR([Don't know how to build a 64-bit object.])
214 ])
215 fi
216
1f11bf0 @bradfitz improve autoconf detection for libevent. from the Tor project.
bradfitz authored
217 trylibeventdir=""
8405f72 @martine Evan Martin: portability work to build on OS X (and other BSDs)
martine authored
218 AC_ARG_WITH(libevent,
1f11bf0 @bradfitz improve autoconf detection for libevent. from the Tor project.
bradfitz authored
219 [ --with-libevent=PATH Specify path to libevent installation ],
220 [
221 if test "x$withval" != "xno" ; then
222 trylibeventdir=$withval
223 fi
224 ]
225 )
226
227 dnl ------------------------------------------------------
228 dnl libevent detection. swiped from Tor. modified a bit.
8405f72 @martine Evan Martin: portability work to build on OS X (and other BSDs)
martine authored
229
230 LIBEVENT_URL=http://www.monkey.org/~provos/libevent/
1f11bf0 @bradfitz improve autoconf detection for libevent. from the Tor project.
bradfitz authored
231
232 AC_CACHE_CHECK([for libevent directory], ac_cv_libevent_dir, [
233 saved_LIBS="$LIBS"
234 saved_LDFLAGS="$LDFLAGS"
235 saved_CPPFLAGS="$CPPFLAGS"
236 le_found=no
237 for ledir in $trylibeventdir "" $prefix /usr/local ; do
238 LDFLAGS="$saved_LDFLAGS"
239 LIBS="$saved_LIBS -levent"
240
241 # Skip the directory if it isn't there.
242 if test ! -z "$ledir" -a ! -d "$ledir" ; then
243 continue;
244 fi
245 if test ! -z "$ledir" ; then
246 if test -d "$ledir/lib" ; then
247 LDFLAGS="-L$ledir/lib $LDFLAGS"
248 else
249 LDFLAGS="-L$ledir $LDFLAGS"
250 fi
251 if test -d "$ledir/include" ; then
252 CPPFLAGS="-I$ledir/include $CPPFLAGS"
253 else
254 CPPFLAGS="-I$ledir $CPPFLAGS"
255 fi
256 fi
257 # Can I compile and link it?
258 AC_TRY_LINK([#include <sys/time.h>
259 #include <sys/types.h>
260 #include <event.h>], [ event_init(); ],
261 [ libevent_linked=yes ], [ libevent_linked=no ])
262 if test $libevent_linked = yes; then
263 if test ! -z "$ledir" ; then
264 ac_cv_libevent_dir=$ledir
265 else
266 ac_cv_libevent_dir="(system)"
267 fi
268 le_found=yes
269 break
270 fi
271 done
272 LIBS="$saved_LIBS"
273 LDFLAGS="$saved_LDFLAGS"
274 CPPFLAGS="$saved_CPPFLAGS"
275 if test $le_found = no ; then
276 AC_MSG_ERROR([libevent is required. You can get it from $LIBEVENT_URL
277
278 If it's already installed, specify its path using --with-libevent=/dir/
279 ])
280 fi
281 ])
282 LIBS="$LIBS -levent"
283 if test $ac_cv_libevent_dir != "(system)"; then
284 if test -d "$ac_cv_libevent_dir/lib" ; then
285 LDFLAGS="-L$ac_cv_libevent_dir/lib $LDFLAGS"
286 le_libdir="$ac_cv_libevent_dir/lib"
287 else
288 LDFLAGS="-L$ac_cv_libevent_dir $LDFLAGS"
289 le_libdir="$ac_cv_libevent_dir"
290 fi
291 if test -d "$ac_cv_libevent_dir/include" ; then
292 CPPFLAGS="-I$ac_cv_libevent_dir/include $CPPFLAGS"
293 else
294 CPPFLAGS="-I$ac_cv_libevent_dir $CPPFLAGS"
295 fi
296 fi
297
298 dnl ----------------------------------------------------------------------------
8405f72 @martine Evan Martin: portability work to build on OS X (and other BSDs)
martine authored
299
98ca309 @bradfitz autoconf work so it runs on nexenta
bradfitz authored
300 AC_SEARCH_LIBS(socket, socket)
301 AC_SEARCH_LIBS(gethostbyname, nsl)
ed69f30 Link with libumem if available
Trond Norbye authored
302 AC_SEARCH_LIBS(umem_cache_create, umem)
73628d3 Add support for hugetlbfs (for Linux).
Trond Norbye authored
303 AC_SEARCH_LIBS(gethugepagesizes, hugetlbfs)
2ec05be First checkpoint. A lot of stuff needs more work, and a lot of tests …
Trond Norbye authored
304 AC_SEARCH_LIBS(dlopen, dl)
305 AC_CHECK_HEADERS(link.h dlfcn.h)
77dde9f multiple cleanups/refactoring, see ChangeLog
Paul Lindner authored
306 AC_HEADER_STDBOOL
2486932 Allow semi-broken C99 compilers to compile memcached
Trond Norbye authored
307 AH_BOTTOM([#if HAVE_STDBOOL_H
308 #include <stdbool.h>
309 #else
310 #define bool char
311 #define false 0
312 #define true 1
313 #endif ])
314
315 AC_CHECK_HEADERS([inttypes.h])
316 AH_BOTTOM([#ifdef HAVE_INTTYPES_H
317 #include <inttypes.h>
318 #endif
319 ])
320
321 dnl **********************************************************************
322 dnl DETECT_UINT64_SUPPORT
323 dnl
324 dnl check if we can use a uint64_t
325 dnl **********************************************************************
326 AC_DEFUN([AC_C_DETECT_UINT64_SUPPORT],
327 [
328 AC_CACHE_CHECK([for print macros for integers (C99 section 7.8.1)],
329 [ac_cv_c_uint64_support],
330 [AC_TRY_COMPILE(
331 [
332 #ifdef HAVE_INTTYPES_H
333 #include <inttypes.h>
334 #endif
335 #include <stdio.h>
336 ], [
337 uint64_t val = 0;
338 fprintf(stderr, "%" PRIu64 "\n", val);
339 ],
340 [ ac_cv_c_uint64_support=yes ],
341 [ ac_cv_c_uint64_support=no ])
342 ])
343 ])
344
345 AC_C_DETECT_UINT64_SUPPORT
346 AS_IF([test "x$ac_cv_c_uint64_support" = "xno"],
347 [AC_MSG_WARN([
348
349 Failed to use print macros (PRIu) as defined in C99 section 7.8.1.
350
351 ])])
352
77dde9f multiple cleanups/refactoring, see ChangeLog
Paul Lindner authored
353 AC_C_CONST
afb95ec Disable mallinfo on Solaris
Trond Norbye authored
354
8405f72 @martine Evan Martin: portability work to build on OS X (and other BSDs)
martine authored
355 dnl From licq: Copyright (c) 2000 Dirk Mueller
356 dnl Check if the type socklen_t is defined anywhere
29d0d2c get rid of underquoted messages
Paul Lindner authored
357 AC_DEFUN([AC_C_SOCKLEN_T],
8405f72 @martine Evan Martin: portability work to build on OS X (and other BSDs)
martine authored
358 [AC_CACHE_CHECK(for socklen_t, ac_cv_c_socklen_t,
359 [
360 AC_TRY_COMPILE([
361 #include <sys/types.h>
362 #include <sys/socket.h>
363 ],[
364 socklen_t foo;
365 ],[
366 ac_cv_c_socklen_t=yes
367 ],[
368 ac_cv_c_socklen_t=no
369 ])
370 ])
371 if test $ac_cv_c_socklen_t = no; then
372 AC_DEFINE(socklen_t, int, [define to int if socklen_t not available])
373 fi
374 ])
375
376 AC_C_SOCKLEN_T
377
28a8165 Update hash function to Jenkins2006.
Steven Grimm authored
378 dnl Check if we're a little-endian or a big-endian system, needed by hash code
29d0d2c get rid of underquoted messages
Paul Lindner authored
379 AC_DEFUN([AC_C_ENDIAN],
28a8165 Update hash function to Jenkins2006.
Steven Grimm authored
380 [AC_CACHE_CHECK(for endianness, ac_cv_c_endian,
381 [
382 AC_RUN_IFELSE(
383 [AC_LANG_PROGRAM([], [dnl
384 long val = 1;
385 char *c = (char *) &val;
386 exit(*c == 1);
387 ])
388 ],[
389 ac_cv_c_endian=big
390 ],[
391 ac_cv_c_endian=little
392 ])
393 ])
394 if test $ac_cv_c_endian = big; then
395 AC_DEFINE(ENDIAN_BIG, 1, [machine is bigendian])
396 fi
397 if test $ac_cv_c_endian = little; then
398 AC_DEFINE(ENDIAN_LITTLE, 1, [machine is littleendian])
399 fi
400 ])
401
402 AC_C_ENDIAN
403
9791b77 Issue: #83: Refactor: use htonll or ntohll if the os provides them
Trond Norbye authored
404 AC_DEFUN([AC_C_HTONLL],
405 [
406 AC_MSG_CHECKING([for htonll])
407 have_htoll="no"
408 AC_RUN_IFELSE([
409 AC_LANG_PROGRAM([
410 #include <sys/types.h>
411 #include <netinet/in.h>
2486932 Allow semi-broken C99 compilers to compile memcached
Trond Norbye authored
412 #ifdef HAVE_INTTYPES_H
413 #include <inttypes.h> */
414 #endif
9791b77 Issue: #83: Refactor: use htonll or ntohll if the os provides them
Trond Norbye authored
415 ], [
416 return htonll(0);
417 ])
418 ], [
419 have_htoll="yes"
420 AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])
421 ])
422
423 AC_MSG_RESULT([$have_htoll])
424 ])
425
426 AC_C_HTONLL
427
a9dcd9a Code modified to only build and run under multi-threaded mode.
Toru Maesaka authored
428 dnl Check whether the user's system supports pthread
429 AC_SEARCH_LIBS(pthread_create, pthread)
4f84702 @dustin Fixed some more == in shell tests.
dustin authored
430 if test "x$ac_cv_search_pthread_create" = "xno"; then
a9dcd9a Code modified to only build and run under multi-threaded mode.
Toru Maesaka authored
431 AC_MSG_ERROR([Can't enable threads without the POSIX thread library.])
0cb75e3 @kroki Fix --disable-threads not to _enable_ them. (Tomash Brechko)
kroki authored
432 fi
56b8339 Merge multithreaded into trunk, commit #2 (first commit only did the
Steven Grimm authored
433
a8e605d @brion autoconf for mlockall (Brion Vibber)
brion authored
434 AC_CHECK_FUNCS(mlockall)
a6b35b4 Enable use of large memory pages (Trond Norbye) <Trond.Norbye@Sun.COM>
Trond Norbye authored
435 AC_CHECK_FUNCS(getpagesizes)
436 AC_CHECK_FUNCS(memcntl)
ee0c3d5 Ignore SIGHUP when running as a daemon
Trond Norbye authored
437 AC_CHECK_FUNCS(sigignore)
a8e605d @brion autoconf for mlockall (Brion Vibber)
brion authored
438
5268604 Realign command input buffer (binary protocol)
Trond Norbye authored
439 AC_DEFUN([AC_C_ALIGNMENT],
440 [AC_CACHE_CHECK(for alignment, ac_cv_c_alignment,
441 [
442 AC_RUN_IFELSE(
443 [AC_LANG_PROGRAM([
444 #include <stdlib.h>
445 #include <inttypes.h>
446 ], [
447 char *buf = malloc(32);
ba7fdc5 add tests to detect ARM CPU alignment issues
Paul Lindner authored
448
5268604 Realign command input buffer (binary protocol)
Trond Norbye authored
449 uint64_t *ptr = (uint64_t*)(buf+2);
ba7fdc5 add tests to detect ARM CPU alignment issues
Paul Lindner authored
450 // catch sigbus, etc.
5268604 Realign command input buffer (binary protocol)
Trond Norbye authored
451 *ptr = 0x1;
ba7fdc5 add tests to detect ARM CPU alignment issues
Paul Lindner authored
452
453 // catch unaligned word access (ARM cpus)
454 *buf = 1; *(buf +1) = 2; *(buf + 2) = 2; *(buf + 3) = 3; *(buf + 4) = 4;
455 int* i = (int*)(buf+1);
456 return (84148994 == i) ? 0 : 1;
5268604 Realign command input buffer (binary protocol)
Trond Norbye authored
457 ])
458 ],[
459 ac_cv_c_alignment=none
460 ],[
ca51c3d @mjhostet Fix caching of alignment requirement detection.
mjhostet authored
461 ac_cv_c_alignment=need
5268604 Realign command input buffer (binary protocol)
Trond Norbye authored
462 ])
463 ])
ca51c3d @mjhostet Fix caching of alignment requirement detection.
mjhostet authored
464 if test $ac_cv_c_alignment = need; then
5268604 Realign command input buffer (binary protocol)
Trond Norbye authored
465 AC_DEFINE(NEED_ALIGN, 1, [Machine need alignment])
466 fi
467 ])
468
469 AC_C_ALIGNMENT
470
69aa542 Drop privileges when running on Solaris
Trond Norbye authored
471 dnl Check for the requirements for running memcached with less privileges
472 dnl than the default privilege set. On Solaris we need setppriv and priv.h
473 dnl If you want to add support for other platforms you should check for
474 dnl your requirements, define HAVE_DROP_PRIVILEGES, and make sure you add
475 dnl the source file containing the implementation into memcached_SOURCE
476 dnl in Makefile.am
477 AC_CHECK_FUNCS(setppriv, [
478 AC_CHECK_HEADER(priv.h, [
479 AC_DEFINE([HAVE_DROP_PRIVILEGES], 1,
480 [Define this if you have an implementation of drop_privileges()])
481 build_solaris_privs=yes
482 ], [])
483 ],[])
484
485 AM_CONDITIONAL([BUILD_SOLARIS_PRIVS],[test "$build_solaris_privs" = "yes"])
486
4c86fa5 Create a generic cache for objects of same size
Trond Norbye authored
487 AC_CHECK_HEADER(umem.h, [
488 AC_DEFINE([HAVE_UMEM_H], 1,
489 [Define this if you have umem.h])
490 build_cache=no
491 ], [build_cache=yes])
492
493 AM_CONDITIONAL([BUILD_CACHE], [test "x$build_cache" = "xyes"])
494
5329ace Don't generate the txt files from xml by default..
Trond Norbye authored
495 dnl Don't generate text files from the XML documents by default.
496 dnl Most developers just run ./configure and will run a lot of make / make clean
497 dnl and we don't want them to spend their time waiting for doc generation ;-)
498 dnl If you really want the documents you should be capable of adding
499 dnl --enable-docs yourself...
20c6238 @dustin Conditionally disable the generation of docs.
dustin authored
500 AC_ARG_ENABLE(docs,
5329ace Don't generate the txt files from xml by default..
Trond Norbye authored
501 [AS_HELP_STRING([--enable-docs],[Disable documentation generation])])
20c6238 @dustin Conditionally disable the generation of docs.
dustin authored
502
5329ace Don't generate the txt files from xml by default..
Trond Norbye authored
503 if test "x$enable_docs" = "xyes"; then
504 AC_PATH_PROG([XML2RFC], [xml2rfc], "no")
505 if test "x$XML2RFC" = "xno"; then
506 AC_MSG_ERROR([Can't build documentation without xml2rfc.])
507 fi
508 AC_PATH_PROG([XSLTPROC], [xsltproc], "no")
509 if test "x$XSLTPROC" = "xno"; then
510 AC_MSG_ERROR([Can't build documentation without xsltproc.])
511 fi
512 fi
513 AM_CONDITIONAL([BUILD_SPECIFICATIONS], [test "x$enable_docs" = "xyes"])
f181a24 Detect xml2rfc and xsltproc during configure and generate the documen…
Trond Norbye authored
514
df1b7e4 Removed compiler warnings and increased warning level
Trond Norbye authored
515 dnl Let the compiler be a bit more picky. Please note that you cannot
516 dnl specify these flags to the compiler before AC_CHECK_FUNCS, because
517 dnl the test program will generate a compilation warning and hence fail
518 dnl to detect the function ;-)
dfc5130 @dustin Get build working under ICC.
dustin authored
519 if test "$ICC" = "yes"
520 then
521 dnl ICC trying to be gcc.
8e328be @dustin icc: Enable -Wall and -Werror
dustin authored
522 CFLAGS="$CFLAGS -diag-disable 187 -Wall -Werror"
ee0c3d5 Ignore SIGHUP when running as a daemon
Trond Norbye authored
523 AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
dfc5130 @dustin Get build working under ICC.
dustin authored
524 elif test "$GCC" = "yes"
df1b7e4 Removed compiler warnings and increased warning level
Trond Norbye authored
525 then
d747f59 @dustin Configure fix for CC that's not in path.
dustin authored
526 GCC_VERSION=`$CC -dumpversion`
da3d85a @dustin Relax the warnings a bit for cyrus-sasl
dustin authored
527 CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
12ae767 @dustin Only turn off strict aliasing for gcc 4.4.*
dustin authored
528 case $GCC_VERSION in
529 4.4.*)
530 CFLAGS="$CFLAGS -fno-strict-aliasing"
531 ;;
532 esac
ee0c3d5 Ignore SIGHUP when running as a daemon
Trond Norbye authored
533 AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
9a05216 Added --disable-coverage
Trond Norbye authored
534 elif test "$SUNCC" = "yes"
df1b7e4 Removed compiler warnings and increased warning level
Trond Norbye authored
535 then
536 CFLAGS="$CFLAGS -errfmt=error -errwarn -errshort=tags"
537 fi
538
bee8e11 Move "public" headers to include/memcached
Trond Norbye authored
539 CPPFLAGS="-I\${top_srcdir}/include ${CPPFLAGS}"
b585e73 @electrum patch from David Phillips <electrum@gmail.com>
electrum authored
540 AC_CONFIG_FILES(Makefile doc/Makefile)
1b53326 @bradfitz autoconf/automake support from evan
bradfitz authored
541 AC_OUTPUT
Something went wrong with that request. Please try again.