2
AC_INIT(memcached, 1.2.8, brad@danga.com)
2
m4_include([version.m4])
3
AC_INIT(memcached, VERSION_NUMBER, brad@danga.com)
4
5
AC_CONFIG_SRCDIR(memcached.c)
5
6
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
6
7
AM_CONFIG_HEADER(config.h)
11
dnl **********************************************************************
12
dnl DETECT_ICC ([ACTION-IF-YES], [ACTION-IF-NO])
14
dnl check if this is the Intel ICC compiler, and if so run the ACTION-IF-YES
15
dnl sets the $ICC variable to "yes" or "no"
16
dnl **********************************************************************
17
AC_DEFUN([DETECT_ICC],
20
AC_MSG_CHECKING([for icc in use])
21
if test "$GCC" = "yes"; then
22
dnl check if this is icc acting as gcc in disguise
23
AC_EGREP_CPP([^__INTEL_COMPILER], [__INTEL_COMPILER],
37
dnl **********************************************************************
38
dnl DETECT_SUNCC ([ACTION-IF-YES], [ACTION-IF-NO])
40
dnl check if this is the Sun Studio compiler, and if so run the ACTION-IF-YES
41
dnl sets the $SUNCC variable to "yes" or "no"
42
dnl **********************************************************************
43
AC_DEFUN([DETECT_SUNCC],
46
AC_MSG_CHECKING([for Sun cc in use])
48
[AC_LANG_PROGRAM([], [dnl
65
DETECT_SUNCC([CFLAGS="-mt $CFLAGS"], [])
67
if test "$ICC" = "no"; then
15
77
AC_PATH_PROG([DTRACE], [dtrace], "no", [/usr/sbin:$PATH])
16
78
if test "x$DTRACE" != "xno"; then
17
79
AC_DEFINE([ENABLE_DTRACE],1,[Set to nonzero if you want to include DTRACE])
18
DTRACE_OBJ=memcached_dtrace.o
19
DTRACE_DEBUG_OBJ=memcached_debug_dtrace.o
81
# DTrace on MacOSX does not use -G option
82
$DTRACE -G -o conftest.$$ -s memcached_dtrace.d 2>/dev/zero
85
dtrace_instrument_obj=yes
89
if test "`which tr`" = "/usr/ucb/tr"; then
90
AC_MSG_ERROR([Please remove /usr/ucb from your path. See man standards for more info])
21
93
AC_MSG_ERROR([Need dtrace binary and OS support.])
24
AC_DEFINE([ENABLE_DTRACE],0,[Set to nonzero if you want to include DTRACE])
97
AM_CONDITIONAL([BUILD_DTRACE],[test "$build_dtrace" = "yes"])
98
AM_CONDITIONAL([DTRACE_INSTRUMENT_OBJ],[test "$dtrace_instrument_obj" = "yes"])
28
AC_SUBST(DTRACE_DEBUG_OBJ)
29
101
AC_SUBST(DTRACEFLAGS)
102
AC_SUBST(PROFILER_LDFLAGS)
104
AC_ARG_ENABLE(coverage,
105
[AS_HELP_STRING([--disable-coverage],[Disable code coverage])])
107
if test "x$enable_coverage" != "xno"; then
108
if test "$ICC" = "yes"
110
dnl ICC trying to be gcc, but not well
111
CFLAGS="$CFLAGS -pthread"
112
elif test "$GCC" = "yes"
114
CFLAGS="$CFLAGS -pthread"
115
AC_PATH_PROG([PROFILER], [gcov], "no", [$PATH])
116
if test "x$PROFILER" != "xno"; then
117
PROFILER_FLAGS="-fprofile-arcs -ftest-coverage"
118
PROFILER_LDFLAGS="-lgcov"
120
elif test "$SUNCC" = "yes"
122
AC_PATH_PROG([PROFILER], [tcov], "no", [$PATH])
123
if test "x$PROFILER" != "xno"; then
124
PROFILER_FLAGS=-xprofile=tcov
128
AC_SUBST(PROFILER_FLAGS)
31
131
AC_ARG_ENABLE(64bit,
32
132
[AS_HELP_STRING([--enable-64bit],[build 64bit version])])
131
231
AC_SEARCH_LIBS(socket, socket)
132
232
AC_SEARCH_LIBS(gethostbyname, nsl)
133
AC_SEARCH_LIBS(mallinfo, malloc)
135
AC_CHECK_FUNC(daemon,AC_DEFINE([HAVE_DAEMON],,[Define this if you have daemon()]),[DAEMON_OBJ=daemon.o])
233
AC_SEARCH_LIBS(umem_cache_create, umem)
234
AC_SEARCH_LIBS(gethugepagesizes, hugetlbfs)
138
235
AC_HEADER_STDBOOL
140
AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?]))
141
AC_CHECK_MEMBER([struct mallinfo.arena], [
142
AC_DEFINE(HAVE_STRUCT_MALLINFO,,[do we have stuct mallinfo?])
148
238
dnl From licq: Copyright (c) 2000 Dirk Mueller
149
239
dnl Check if the type socklen_t is defined anywhere
197
dnl Check whether the user wants threads or not
198
AC_ARG_ENABLE(threads,
199
[AS_HELP_STRING([--enable-threads],[support multithreaded execution])])
200
if test "x$enable_threads" == "xyes"; then
201
AC_SEARCH_LIBS(pthread_create, pthread)
202
if test "x$ac_cv_search_pthread_create" != "xno"; then
203
AC_DEFINE([USE_THREADS],,[Define this if you want to use pthreads])
204
dnl Sun compilers need the -mt flag!
206
[AC_LANG_PROGRAM([], [dnl
287
AC_DEFUN([AC_C_HTONLL],
289
AC_MSG_CHECKING([for htonll])
293
#include <sys/types.h>
294
#include <netinet/in.h>
295
#include <inttypes.h>
301
AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])
217
AC_MSG_ERROR([Can't enable threads without the POSIX thread library.])
304
AC_MSG_RESULT([$have_htoll])
309
dnl Check whether the user's system supports pthread
310
AC_SEARCH_LIBS(pthread_create, pthread)
311
if test "x$ac_cv_search_pthread_create" == "xno"; then
312
AC_MSG_ERROR([Can't enable threads without the POSIX thread library.])
221
315
AC_CHECK_FUNCS(mlockall)
222
316
AC_CHECK_FUNCS(getpagesizes)
223
317
AC_CHECK_FUNCS(memcntl)
318
AC_CHECK_FUNCS(sigignore)
320
AC_DEFUN([AC_C_ALIGNMENT],
321
[AC_CACHE_CHECK(for alignment, ac_cv_c_alignment,
326
#include <inttypes.h>
328
char *buf = malloc(32);
329
uint64_t *ptr = (uint64_t*)(buf+2);
334
ac_cv_c_alignment=none
336
ac_cv_c_alignment=need
339
if test $ac_cv_c_alignment = need; then
340
AC_DEFINE(NEED_ALIGN, 1, [Machine need alignment])
346
dnl Check for the requirements for running memcached with less privileges
347
dnl than the default privilege set. On Solaris we need setppriv and priv.h
348
dnl If you want to add support for other platforms you should check for
349
dnl your requirements, define HAVE_DROP_PRIVILEGES, and make sure you add
350
dnl the source file containing the implementation into memcached_SOURCE
352
AC_CHECK_FUNCS(setppriv, [
353
AC_CHECK_HEADER(priv.h, [
354
AC_DEFINE([HAVE_DROP_PRIVILEGES], 1,
355
[Define this if you have an implementation of drop_privileges()])
356
build_solaris_privs=yes
360
AM_CONDITIONAL([BUILD_SOLARIS_PRIVS],[test "$build_solaris_privs" = "yes"])
362
AC_CHECK_HEADER(umem.h, [
363
AC_DEFINE([HAVE_UMEM_H], 1,
364
[Define this if you have umem.h])
366
], [build_cache=yes])
368
AM_CONDITIONAL([BUILD_CACHE], [test "x$build_cache" = "xyes"])
371
[AS_HELP_STRING([--disable-docs],[Disable documentation generation])])
373
AC_PATH_PROG([XML2RFC], [xml2rfc], "no")
374
AC_PATH_PROG([XSLTPROC], [xsltproc], "no")
376
AM_CONDITIONAL([BUILD_SPECIFICATIONS],
377
[test "x$enable_docs" != "xno" -a "x$XML2RFC" != "xno" -a "x$XSLTPROC" != "xno"])
380
dnl Let the compiler be a bit more picky. Please note that you cannot
381
dnl specify these flags to the compiler before AC_CHECK_FUNCS, because
382
dnl the test program will generate a compilation warning and hence fail
383
dnl to detect the function ;-)
384
if test "$ICC" = "yes"
386
dnl ICC trying to be gcc.
387
CFLAGS="$CFLAGS -diag-disable 187 -Wall -Werror"
388
AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
389
elif test "$GCC" = "yes"
391
GCC_VERSION=`$CC -dumpversion`
392
CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
395
CFLAGS="$CFLAGS -fno-strict-aliasing"
398
AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
399
elif test "$SUNCC" = "yes"
401
CFLAGS="$CFLAGS -errfmt=error -errwarn -errshort=tags"
225
404
AC_CONFIG_FILES(Makefile doc/Makefile)