tmaesaka / memcached forked from dustin/memcached
- Source
- Commits
- Network (16)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
86159eb
commit 86159eb7b5c611d25a33eb1cb6c750c806350912
tree 0999112a62230d18393587b633fd251543ac09c5
parent df5d1bf9d87428d3e777782d9b676baf37667b53
tree 0999112a62230d18393587b633fd251543ac09c5
parent df5d1bf9d87428d3e777782d9b676baf37667b53
memcached / configure.ac
| 1438d16b » | bradfitz | 2006-03-22 | 1 | AC_PREREQ(2.52) | |
| 92213e4e » | tmaesaka | 2008-08-03 | 2 | AC_INIT(memcached, 1.3.1, brad@danga.com) | |
| 1438d16b » | bradfitz | 2006-03-22 | 3 | AC_CANONICAL_SYSTEM | |
| 4 | AC_CONFIG_SRCDIR(memcached.c) | ||||
| 5 | AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) | ||||
| 6 | AM_CONFIG_HEADER(config.h) | ||||
| 7 | |||||
| 8 | AC_PROG_CC | ||||
| a9fab8e0 » | Trond Norbye | 2008-10-06 | 9 | AC_PROG_CC_C99 | |
| 27a15d95 » | plindner | 2007-08-21 | 10 | AM_PROG_CC_C_O | |
| 1438d16b » | bradfitz | 2006-03-22 | 11 | AC_PROG_INSTALL | |
| 12 | |||||
| 7e3fada3 » | tmaesaka | 2008-08-01 | 13 | AC_ARG_ENABLE(dtrace, | |
| 14 | [AS_HELP_STRING([--enable-dtrace],[Enable dtrace probes])]) | ||||
| 15 | if test "x$enable_dtrace" == "xyes"; then | ||||
| 16 | AC_PATH_PROG([DTRACE], [dtrace], "no", [/usr/sbin:$PATH]) | ||||
| 17 | if test "x$DTRACE" != "xno"; then | ||||
| 18 | AC_DEFINE([ENABLE_DTRACE],1,[Set to nonzero if you want to include DTRACE]) | ||||
| 46510f26 » | Trond Norbye | 2008-10-02 | 19 | DTRACE_HEADER=memcached_dtrace.h | |
| 20 | |||||
| 21 | # DTrace on MacOSX does not use -G option | ||||
| 8b03e781 » | Trond Norbye | 2008-10-08 | 22 | $DTRACE -G -o conftest.$$ -s memcached_dtrace.d 2>/dev/zero | |
| 46510f26 » | Trond Norbye | 2008-10-02 | 23 | if test $? -eq 0 | |
| 24 | then | ||||
| 25 | DTRACE_OBJ=memcached_dtrace.o | ||||
| 26 | DTRACE_DEBUG_OBJ=memcached_debug_dtrace.o | ||||
| 27 | rm conftest.$$ | ||||
| 28 | fi | ||||
| 7e3fada3 » | tmaesaka | 2008-08-01 | 29 | else | |
| 30 | AC_MSG_ERROR([Need dtrace binary and OS support.]) | ||||
| 31 | fi | ||||
| 32 | fi | ||||
| 46510f26 » | Trond Norbye | 2008-10-02 | 33 | ||
| 7e3fada3 » | tmaesaka | 2008-08-01 | 34 | AC_SUBST(DTRACE) | |
| 46510f26 » | Trond Norbye | 2008-10-02 | 35 | AC_SUBST(DTRACE_HEADER) | |
| 7e3fada3 » | tmaesaka | 2008-08-01 | 36 | AC_SUBST(DTRACE_OBJ) | |
| 37 | AC_SUBST(DTRACE_DEBUG_OBJ) | ||||
| 38 | AC_SUBST(DTRACEFLAGS) | ||||
| 39 | |||||
| ccef5465 » | dormando | 2008-02-18 | 40 | AC_ARG_ENABLE(64bit, | |
| b430762b » | tmaesaka | 2008-09-29 | 41 | [AS_HELP_STRING([--enable-64bit],[build 64bit version])]) | |
| ccef5465 » | dormando | 2008-02-18 | 42 | if test "x$enable_64bit" == "xyes" | |
| 43 | then | ||||
| 44 | org_cflags=$CFLAGS | ||||
| 45 | CFLAGS=-m64 | ||||
| 46 | AC_RUN_IFELSE( | ||||
| 47 | [AC_LANG_PROGRAM([], [dnl | ||||
| 48 | return sizeof(void*) == 8 ? 0 : 1; | ||||
| 49 | ]) | ||||
| 50 | ],[ | ||||
| 51 | CFLAGS="-m64 $org_cflags" | ||||
| 52 | ],[ | ||||
| 53 | AC_MSG_ERROR([Don't know how to build a 64-bit object.]) | ||||
| 54 | ]) | ||||
| 55 | fi | ||||
| 56 | |||||
| 63e13c20 » | bradfitz | 2006-09-04 | 57 | trylibeventdir="" | |
| 1438d16b » | bradfitz | 2006-03-22 | 58 | AC_ARG_WITH(libevent, | |
| 63e13c20 » | bradfitz | 2006-09-04 | 59 | [ --with-libevent=PATH Specify path to libevent installation ], | |
| 60 | [ | ||||
| 61 | if test "x$withval" != "xno" ; then | ||||
| 62 | trylibeventdir=$withval | ||||
| 63 | fi | ||||
| 64 | ] | ||||
| 65 | ) | ||||
| 66 | |||||
| 67 | dnl ------------------------------------------------------ | ||||
| 68 | dnl libevent detection. swiped from Tor. modified a bit. | ||||
| 1438d16b » | bradfitz | 2006-03-22 | 69 | ||
| 70 | LIBEVENT_URL=http://www.monkey.org/~provos/libevent/ | ||||
| 63e13c20 » | bradfitz | 2006-09-04 | 71 | ||
| 72 | AC_CACHE_CHECK([for libevent directory], ac_cv_libevent_dir, [ | ||||
| 73 | saved_LIBS="$LIBS" | ||||
| 74 | saved_LDFLAGS="$LDFLAGS" | ||||
| 75 | saved_CPPFLAGS="$CPPFLAGS" | ||||
| 76 | le_found=no | ||||
| 77 | for ledir in $trylibeventdir "" $prefix /usr/local ; do | ||||
| 78 | LDFLAGS="$saved_LDFLAGS" | ||||
| 79 | LIBS="$saved_LIBS -levent" | ||||
| 80 | |||||
| 81 | # Skip the directory if it isn't there. | ||||
| 82 | if test ! -z "$ledir" -a ! -d "$ledir" ; then | ||||
| 83 | continue; | ||||
| 84 | fi | ||||
| 85 | if test ! -z "$ledir" ; then | ||||
| 86 | if test -d "$ledir/lib" ; then | ||||
| 87 | LDFLAGS="-L$ledir/lib $LDFLAGS" | ||||
| 88 | else | ||||
| 89 | LDFLAGS="-L$ledir $LDFLAGS" | ||||
| 90 | fi | ||||
| 91 | if test -d "$ledir/include" ; then | ||||
| 92 | CPPFLAGS="-I$ledir/include $CPPFLAGS" | ||||
| 93 | else | ||||
| 94 | CPPFLAGS="-I$ledir $CPPFLAGS" | ||||
| 95 | fi | ||||
| 96 | fi | ||||
| 97 | # Can I compile and link it? | ||||
| 98 | AC_TRY_LINK([#include <sys/time.h> | ||||
| 99 | #include <sys/types.h> | ||||
| 100 | #include <event.h>], [ event_init(); ], | ||||
| 101 | [ libevent_linked=yes ], [ libevent_linked=no ]) | ||||
| 102 | if test $libevent_linked = yes; then | ||||
| 103 | if test ! -z "$ledir" ; then | ||||
| 104 | ac_cv_libevent_dir=$ledir | ||||
| 105 | else | ||||
| 106 | ac_cv_libevent_dir="(system)" | ||||
| 107 | fi | ||||
| 108 | le_found=yes | ||||
| 109 | break | ||||
| 110 | fi | ||||
| 111 | done | ||||
| 112 | LIBS="$saved_LIBS" | ||||
| 113 | LDFLAGS="$saved_LDFLAGS" | ||||
| 114 | CPPFLAGS="$saved_CPPFLAGS" | ||||
| 115 | if test $le_found = no ; then | ||||
| 116 | AC_MSG_ERROR([libevent is required. You can get it from $LIBEVENT_URL | ||||
| 117 | |||||
| 118 | If it's already installed, specify its path using --with-libevent=/dir/ | ||||
| 119 | ]) | ||||
| 120 | fi | ||||
| 121 | ]) | ||||
| 122 | LIBS="$LIBS -levent" | ||||
| 123 | if test $ac_cv_libevent_dir != "(system)"; then | ||||
| 124 | if test -d "$ac_cv_libevent_dir/lib" ; then | ||||
| 125 | LDFLAGS="-L$ac_cv_libevent_dir/lib $LDFLAGS" | ||||
| 126 | le_libdir="$ac_cv_libevent_dir/lib" | ||||
| 127 | else | ||||
| 128 | LDFLAGS="-L$ac_cv_libevent_dir $LDFLAGS" | ||||
| 129 | le_libdir="$ac_cv_libevent_dir" | ||||
| 130 | fi | ||||
| 131 | if test -d "$ac_cv_libevent_dir/include" ; then | ||||
| 132 | CPPFLAGS="-I$ac_cv_libevent_dir/include $CPPFLAGS" | ||||
| 133 | else | ||||
| 134 | CPPFLAGS="-I$ac_cv_libevent_dir $CPPFLAGS" | ||||
| 135 | fi | ||||
| 136 | fi | ||||
| 137 | |||||
| 138 | dnl ---------------------------------------------------------------------------- | ||||
| 1438d16b » | bradfitz | 2006-03-22 | 139 | ||
| dabe32db » | bradfitz | 2006-04-30 | 140 | AC_SEARCH_LIBS(socket, socket) | |
| 141 | AC_SEARCH_LIBS(gethostbyname, nsl) | ||||
| 142 | AC_SEARCH_LIBS(mallinfo, malloc) | ||||
| 143 | |||||
| 3459576c » | plindner | 2007-03-06 | 144 | AC_HEADER_STDBOOL | |
| 145 | AC_C_CONST | ||||
| 1438d16b » | bradfitz | 2006-03-22 | 146 | AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?])) | |
| 147 | AC_CHECK_MEMBER([struct mallinfo.arena], [ | ||||
| 2c1a7082 » | plindner | 2007-04-10 | 148 | AC_DEFINE(HAVE_STRUCT_MALLINFO,,[do we have stuct mallinfo?]) | |
| 149 | ], ,[ | ||||
| 150 | # include <malloc.h> | ||||
| 151 | ] | ||||
| 1438d16b » | bradfitz | 2006-03-22 | 152 | ) | |
| 153 | |||||
| 154 | dnl From licq: Copyright (c) 2000 Dirk Mueller | ||||
| 155 | dnl Check if the type socklen_t is defined anywhere | ||||
| 491bf48e » | plindner | 2007-06-05 | 156 | AC_DEFUN([AC_C_SOCKLEN_T], | |
| 1438d16b » | bradfitz | 2006-03-22 | 157 | [AC_CACHE_CHECK(for socklen_t, ac_cv_c_socklen_t, | |
| 158 | [ | ||||
| 159 | AC_TRY_COMPILE([ | ||||
| 160 | #include <sys/types.h> | ||||
| 161 | #include <sys/socket.h> | ||||
| 162 | ],[ | ||||
| 163 | socklen_t foo; | ||||
| 164 | ],[ | ||||
| 165 | ac_cv_c_socklen_t=yes | ||||
| 166 | ],[ | ||||
| 167 | ac_cv_c_socklen_t=no | ||||
| 168 | ]) | ||||
| 169 | ]) | ||||
| 170 | if test $ac_cv_c_socklen_t = no; then | ||||
| 171 | AC_DEFINE(socklen_t, int, [define to int if socklen_t not available]) | ||||
| 172 | fi | ||||
| 173 | ]) | ||||
| 174 | |||||
| 175 | AC_C_SOCKLEN_T | ||||
| 176 | |||||
| d303dec0 » | sgrimm | 2006-10-13 | 177 | dnl Check if we're a little-endian or a big-endian system, needed by hash code | |
| 491bf48e » | plindner | 2007-06-05 | 178 | AC_DEFUN([AC_C_ENDIAN], | |
| d303dec0 » | sgrimm | 2006-10-13 | 179 | [AC_CACHE_CHECK(for endianness, ac_cv_c_endian, | |
| 180 | [ | ||||
| 181 | AC_RUN_IFELSE( | ||||
| 182 | [AC_LANG_PROGRAM([], [dnl | ||||
| 183 | long val = 1; | ||||
| 184 | char *c = (char *) &val; | ||||
| 185 | exit(*c == 1); | ||||
| 186 | ]) | ||||
| 187 | ],[ | ||||
| 188 | ac_cv_c_endian=big | ||||
| 189 | ],[ | ||||
| 190 | ac_cv_c_endian=little | ||||
| 191 | ]) | ||||
| 192 | ]) | ||||
| 193 | if test $ac_cv_c_endian = big; then | ||||
| 194 | AC_DEFINE(ENDIAN_BIG, 1, [machine is bigendian]) | ||||
| 195 | fi | ||||
| 196 | if test $ac_cv_c_endian = little; then | ||||
| 197 | AC_DEFINE(ENDIAN_LITTLE, 1, [machine is littleendian]) | ||||
| 198 | fi | ||||
| 199 | ]) | ||||
| 200 | |||||
| 201 | AC_C_ENDIAN | ||||
| 202 | |||||
| 1d53637b » | tmaesaka | 2008-04-28 | 203 | dnl Check whether the user's system supports pthread | |
| 204 | AC_SEARCH_LIBS(pthread_create, pthread) | ||||
| 205 | if test "x$ac_cv_search_pthread_create" != "xno"; then | ||||
| 206 | dnl Sun compilers need the -mt flag! | ||||
| 207 | AC_RUN_IFELSE( | ||||
| 208 | [AC_LANG_PROGRAM([], [dnl | ||||
| 6831dd7a » | dormando | 2008-02-18 | 209 | #ifdef __SUNPRO_C | |
| 1d53637b » | tmaesaka | 2008-04-28 | 210 | return 0; | |
| 6831dd7a » | dormando | 2008-02-18 | 211 | #else | |
| 1d53637b » | tmaesaka | 2008-04-28 | 212 | return 1; | |
| 6831dd7a » | dormando | 2008-02-18 | 213 | #endif | |
| 214 | ]) | ||||
| 1d53637b » | tmaesaka | 2008-04-28 | 215 | ],[ | |
| 216 | CFLAGS="-mt $CFLAGS" | ||||
| a9fab8e0 » | Trond Norbye | 2008-10-06 | 217 | SUNSTUDIO=true | |
| 1d53637b » | tmaesaka | 2008-04-28 | 218 | ]) | |
| 219 | else | ||||
| 220 | AC_MSG_ERROR([Can't enable threads without the POSIX thread library.]) | ||||
| 6485774c » | dormando | 2007-12-07 | 221 | fi | |
| 111846a4 » | sgrimm | 2007-04-16 | 222 | ||
| 1438d16b » | bradfitz | 2006-03-22 | 223 | AC_CHECK_FUNCS(mlockall) | |
| b1595683 » | dormando | 2008-02-25 | 224 | AC_CHECK_FUNCS(getpagesizes) | |
| 225 | AC_CHECK_FUNCS(memcntl) | ||||
| 1438d16b » | bradfitz | 2006-03-22 | 226 | ||
| a9fab8e0 » | Trond Norbye | 2008-10-06 | 227 | dnl Let the compiler be a bit more picky. Please note that you cannot | |
| 228 | dnl specify these flags to the compiler before AC_CHECK_FUNCS, because | ||||
| 229 | dnl the test program will generate a compilation warning and hence fail | ||||
| 230 | dnl to detect the function ;-) | ||||
| 231 | if test "$GCC" = "yes" | ||||
| 232 | then | ||||
| 1cf85b5e » | Trond Norbye | 2008-10-06 | 233 | CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls" | |
| a9fab8e0 » | Trond Norbye | 2008-10-06 | 234 | elif test "$SUNSTUDIO" = "true" | |
| 235 | then | ||||
| 236 | CFLAGS="$CFLAGS -errfmt=error -errwarn -errshort=tags" | ||||
| 237 | fi | ||||
| 238 | |||||
| 1438d16b » | bradfitz | 2006-03-22 | 239 | AC_CONFIG_FILES(Makefile doc/Makefile) | |
| 240 | AC_OUTPUT | ||||
