~ubuntu-branches/ubuntu/quantal/memcached/quantal

« back to all changes in this revision

Viewing changes to configure.ac

  • Committer: Bazaar Package Importer
  • Author(s): David Martínez Moreno
  • Date: 2009-10-16 15:09:43 UTC
  • mfrom: (1.1.6 upstream) (3.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20091016150943-0rhh8x206ebgwzeu
Tags: 1.4.2-1
* New upstream release, primarily bugfixes, some of them critical, hence
  the urgency:
  - Reject keys larger than 250 bytes in the binary protocol.
  - Bounds checking on stats cachedump.
  - Binary protocol set+cas wasn't returning a new cas ID.
  - Binary quitq didn't actually close the connection
  - Slab boundary checking cleanup (bad logic in unreachable code)
  - Get hit memory optimizations
  - Disallow -t options that cause the server to not work
  - Killed off incomplete slab rebalance feature.
* debian/patches:
  - 01_init_script_compliant_with_LSB.patch: Remade as upstream applied a
    whitespace cleanup script that broke the patch.
  - 02_manpage_additions.patch: Added missing parameters to the memcached
    manpage.
* Removed TODO from debian/docs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
AC_PREREQ(2.52)
2
 
AC_INIT(memcached, 1.2.8, brad@danga.com)
 
2
m4_include([version.m4])
 
3
AC_INIT(memcached, VERSION_NUMBER, brad@danga.com)
3
4
AC_CANONICAL_SYSTEM
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)
7
8
 
8
9
AC_PROG_CC
 
10
 
 
11
dnl **********************************************************************
 
12
dnl DETECT_ICC ([ACTION-IF-YES], [ACTION-IF-NO])
 
13
dnl
 
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],
 
18
[
 
19
    ICC="no"
 
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],
 
24
         AC_MSG_RESULT([no])
 
25
         [$2],
 
26
         AC_MSG_RESULT([yes])
 
27
         [$1]
 
28
         ICC="yes")
 
29
    else
 
30
       AC_MSG_RESULT([no])
 
31
       [$2]
 
32
    fi
 
33
])
 
34
 
 
35
DETECT_ICC([], [])
 
36
 
 
37
dnl **********************************************************************
 
38
dnl DETECT_SUNCC ([ACTION-IF-YES], [ACTION-IF-NO])
 
39
dnl
 
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],
 
44
[
 
45
    SUNCC="no"
 
46
    AC_MSG_CHECKING([for Sun cc in use])
 
47
    AC_RUN_IFELSE(
 
48
      [AC_LANG_PROGRAM([], [dnl
 
49
#ifdef __SUNPRO_C
 
50
   return 0;
 
51
#else
 
52
   return 1;
 
53
#endif
 
54
      ])
 
55
    ],[
 
56
       AC_MSG_RESULT([yes])
 
57
       [$1]
 
58
       SUNCC="yes"
 
59
    ], [
 
60
       AC_MSG_RESULT([no])
 
61
       [$2]
 
62
    ])
 
63
])
 
64
 
 
65
DETECT_SUNCC([CFLAGS="-mt $CFLAGS"], [])
 
66
 
 
67
if test "$ICC" = "no"; then
 
68
   AC_PROG_CC_C99
 
69
fi
 
70
 
9
71
AM_PROG_CC_C_O
10
72
AC_PROG_INSTALL
11
73
 
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
 
80
    build_dtrace=yes
 
81
    # DTrace on MacOSX does not use -G option
 
82
    $DTRACE -G -o conftest.$$ -s memcached_dtrace.d 2>/dev/zero
 
83
    if test $? -eq 0
 
84
    then
 
85
        dtrace_instrument_obj=yes
 
86
        rm conftest.$$
 
87
    fi
 
88
 
 
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])
 
91
    fi
20
92
  else
21
93
    AC_MSG_ERROR([Need dtrace binary and OS support.])
22
94
  fi
23
 
else
24
 
    AC_DEFINE([ENABLE_DTRACE],0,[Set to nonzero if you want to include DTRACE])
25
95
fi
 
96
 
 
97
AM_CONDITIONAL([BUILD_DTRACE],[test "$build_dtrace" = "yes"])
 
98
AM_CONDITIONAL([DTRACE_INSTRUMENT_OBJ],[test "$dtrace_instrument_obj" = "yes"])
 
99
 
26
100
AC_SUBST(DTRACE)
27
 
AC_SUBST(DTRACE_OBJ)
28
 
AC_SUBST(DTRACE_DEBUG_OBJ)
29
101
AC_SUBST(DTRACEFLAGS)
 
102
AC_SUBST(PROFILER_LDFLAGS)
 
103
 
 
104
AC_ARG_ENABLE(coverage,
 
105
  [AS_HELP_STRING([--disable-coverage],[Disable code coverage])])
 
106
 
 
107
if test "x$enable_coverage" != "xno"; then
 
108
   if test "$ICC" = "yes"
 
109
   then
 
110
      dnl ICC trying to be gcc, but not well
 
111
      CFLAGS="$CFLAGS -pthread"
 
112
   elif test "$GCC" = "yes"
 
113
   then
 
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"
 
119
      fi
 
120
   elif test "$SUNCC" = "yes"
 
121
   then
 
122
      AC_PATH_PROG([PROFILER], [tcov], "no", [$PATH])
 
123
      if test "x$PROFILER" != "xno"; then
 
124
         PROFILER_FLAGS=-xprofile=tcov
 
125
      fi
 
126
   fi
 
127
fi
 
128
AC_SUBST(PROFILER_FLAGS)
 
129
 
30
130
 
31
131
AC_ARG_ENABLE(64bit,
32
132
  [AS_HELP_STRING([--enable-64bit],[build 64bit version])])
130
230
 
131
231
AC_SEARCH_LIBS(socket, socket)
132
232
AC_SEARCH_LIBS(gethostbyname, nsl)
133
 
AC_SEARCH_LIBS(mallinfo, malloc)
134
 
 
135
 
AC_CHECK_FUNC(daemon,AC_DEFINE([HAVE_DAEMON],,[Define this if you have daemon()]),[DAEMON_OBJ=daemon.o])
136
 
AC_SUBST(DAEMON_OBJ)
137
 
 
 
233
AC_SEARCH_LIBS(umem_cache_create, umem)
 
234
AC_SEARCH_LIBS(gethugepagesizes, hugetlbfs)
138
235
AC_HEADER_STDBOOL
139
236
AC_C_CONST
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?])
143
 
    ], ,[
144
 
#    include <malloc.h>
145
 
    ]
146
 
)
147
237
 
148
238
dnl From licq: Copyright (c) 2000 Dirk Mueller
149
239
dnl Check if the type socklen_t is defined anywhere
194
284
 
195
285
AC_C_ENDIAN
196
286
 
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!
205
 
    AC_RUN_IFELSE(
206
 
      [AC_LANG_PROGRAM([], [dnl
207
 
#ifdef __SUNPRO_C
208
 
   return 0;
209
 
#else
210
 
   return 1;
211
 
#endif
212
 
      ])
213
 
    ],[
214
 
      CFLAGS="-mt $CFLAGS"
 
287
AC_DEFUN([AC_C_HTONLL],
 
288
[
 
289
    AC_MSG_CHECKING([for htonll])
 
290
    have_htoll="no"
 
291
    AC_RUN_IFELSE([
 
292
       AC_LANG_PROGRAM([
 
293
#include <sys/types.h>
 
294
#include <netinet/in.h>
 
295
#include <inttypes.h>
 
296
       ], [
 
297
          return htonll(0);
 
298
       ])
 
299
    ], [
 
300
      have_htoll="yes"
 
301
      AC_DEFINE([HAVE_HTONLL], [1], [Have ntohll])
215
302
    ])
216
 
  else
217
 
    AC_MSG_ERROR([Can't enable threads without the POSIX thread library.])
218
 
  fi
 
303
 
 
304
    AC_MSG_RESULT([$have_htoll])
 
305
])
 
306
 
 
307
AC_C_HTONLL
 
308
 
 
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.])
219
313
fi
220
314
 
221
315
AC_CHECK_FUNCS(mlockall)
222
316
AC_CHECK_FUNCS(getpagesizes)
223
317
AC_CHECK_FUNCS(memcntl)
 
318
AC_CHECK_FUNCS(sigignore)
 
319
 
 
320
AC_DEFUN([AC_C_ALIGNMENT],
 
321
[AC_CACHE_CHECK(for alignment, ac_cv_c_alignment,
 
322
[
 
323
  AC_RUN_IFELSE(
 
324
    [AC_LANG_PROGRAM([
 
325
#include <stdlib.h>
 
326
#include <inttypes.h>
 
327
    ], [
 
328
       char *buf = malloc(32);
 
329
       uint64_t *ptr = (uint64_t*)(buf+2);
 
330
       *ptr = 0x1;
 
331
       return 0;
 
332
    ])
 
333
  ],[
 
334
    ac_cv_c_alignment=none
 
335
  ],[
 
336
    ac_cv_c_alignment=need
 
337
  ])
 
338
])
 
339
if test $ac_cv_c_alignment = need; then
 
340
  AC_DEFINE(NEED_ALIGN, 1, [Machine need alignment])
 
341
fi
 
342
])
 
343
 
 
344
AC_C_ALIGNMENT
 
345
 
 
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
 
351
dnl in Makefile.am
 
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
 
357
   ], [])
 
358
],[])
 
359
 
 
360
AM_CONDITIONAL([BUILD_SOLARIS_PRIVS],[test "$build_solaris_privs" = "yes"])
 
361
 
 
362
AC_CHECK_HEADER(umem.h, [
 
363
   AC_DEFINE([HAVE_UMEM_H], 1,
 
364
         [Define this if you have umem.h])
 
365
   build_cache=no
 
366
], [build_cache=yes])
 
367
 
 
368
AM_CONDITIONAL([BUILD_CACHE], [test "x$build_cache" = "xyes"])
 
369
 
 
370
AC_ARG_ENABLE(docs,
 
371
  [AS_HELP_STRING([--disable-docs],[Disable documentation generation])])
 
372
 
 
373
AC_PATH_PROG([XML2RFC], [xml2rfc], "no")
 
374
AC_PATH_PROG([XSLTPROC], [xsltproc], "no")
 
375
 
 
376
AM_CONDITIONAL([BUILD_SPECIFICATIONS],
 
377
               [test "x$enable_docs" != "xno" -a "x$XML2RFC" != "xno" -a "x$XSLTPROC" != "xno"])
 
378
 
 
379
 
 
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"
 
385
then
 
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"
 
390
then
 
391
  GCC_VERSION=`$CC -dumpversion`
 
392
  CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
 
393
  case $GCC_VERSION in
 
394
    4.4.*)
 
395
    CFLAGS="$CFLAGS -fno-strict-aliasing"
 
396
    ;;
 
397
  esac
 
398
  AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux])
 
399
elif test "$SUNCC" = "yes"
 
400
then
 
401
  CFLAGS="$CFLAGS -errfmt=error -errwarn -errshort=tags"
 
402
fi
224
403
 
225
404
AC_CONFIG_FILES(Makefile doc/Makefile)
226
405
AC_OUTPUT