tmaesaka / memcached forked from dustin/memcached

This is where my memcached work lives before svn munges the changes.

This URL has Read+Write access

memcached / configure.ac
1438d16b » bradfitz 2006-03-22 moving server stuff down in... 1 AC_PREREQ(2.52)
92213e4e » tmaesaka 2008-08-03 Applied Trond's false asser... 2 AC_INIT(memcached, 1.3.1, brad@danga.com)
1438d16b » bradfitz 2006-03-22 moving server stuff down in... 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 Removed compiler warnings a... 9 AC_PROG_CC_C99
27a15d95 » plindner 2007-08-21 small fix for newer version... 10 AM_PROG_CC_C_O
1438d16b » bradfitz 2006-03-22 moving server stuff down in... 11 AC_PROG_INSTALL
12
7e3fada3 » tmaesaka 2008-08-01 Merged the patches that wen... 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 dtrace on macosx does not s... 19 DTRACE_HEADER=memcached_dtrace.h
20
21 # DTrace on MacOSX does not use -G option
8b03e781 » Trond Norbye 2008-10-08 Invoke the dtrace binary we... 22 $DTRACE -G -o conftest.$$ -s memcached_dtrace.d 2>/dev/zero
46510f26 » Trond Norbye 2008-10-02 dtrace on macosx does not s... 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 Merged the patches that wen... 29 else
30 AC_MSG_ERROR([Need dtrace binary and OS support.])
31 fi
32 fi
46510f26 » Trond Norbye 2008-10-02 dtrace on macosx does not s... 33
7e3fada3 » tmaesaka 2008-08-01 Merged the patches that wen... 34 AC_SUBST(DTRACE)
46510f26 » Trond Norbye 2008-10-02 dtrace on macosx does not s... 35 AC_SUBST(DTRACE_HEADER)
7e3fada3 » tmaesaka 2008-08-01 Merged the patches that wen... 36 AC_SUBST(DTRACE_OBJ)
37 AC_SUBST(DTRACE_DEBUG_OBJ)
38 AC_SUBST(DTRACEFLAGS)
39
ccef5465 » dormando 2008-02-18 Add --enable-64bit to build... 40 AC_ARG_ENABLE(64bit,
b430762b » tmaesaka 2008-09-29 DTrace probe fix, Fix typo ... 41 [AS_HELP_STRING([--enable-64bit],[build 64bit version])])
ccef5465 » dormando 2008-02-18 Add --enable-64bit to build... 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 improve autoconf detection ... 57 trylibeventdir=""
1438d16b » bradfitz 2006-03-22 moving server stuff down in... 58 AC_ARG_WITH(libevent,
63e13c20 » bradfitz 2006-09-04 improve autoconf detection ... 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 moving server stuff down in... 69
70 LIBEVENT_URL=http://www.monkey.org/~provos/libevent/
63e13c20 » bradfitz 2006-09-04 improve autoconf detection ... 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 moving server stuff down in... 139
dabe32db » bradfitz 2006-04-30 autoconf work so it runs on... 140 AC_SEARCH_LIBS(socket, socket)
141 AC_SEARCH_LIBS(gethostbyname, nsl)
142 AC_SEARCH_LIBS(mallinfo, malloc)
143
3459576c » plindner 2007-03-06 multiple cleanups/refactori... 144 AC_HEADER_STDBOOL
145 AC_C_CONST
1438d16b » bradfitz 2006-03-22 moving server stuff down in... 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 update clean-whitespace, ad... 148 AC_DEFINE(HAVE_STRUCT_MALLINFO,,[do we have stuct mallinfo?])
149 ], ,[
150 # include <malloc.h>
151 ]
1438d16b » bradfitz 2006-03-22 moving server stuff down in... 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 get rid of underquoted mess... 156 AC_DEFUN([AC_C_SOCKLEN_T],
1438d16b » bradfitz 2006-03-22 moving server stuff down in... 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 Update hash function to Jen... 177 dnl Check if we're a little-endian or a big-endian system, needed by hash code
491bf48e » plindner 2007-06-05 get rid of underquoted mess... 178 AC_DEFUN([AC_C_ENDIAN],
d303dec0 » sgrimm 2006-10-13 Update hash function to Jen... 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 Code modified to only build... 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 add compiler options for Su... 209 #ifdef __SUNPRO_C
1d53637b » tmaesaka 2008-04-28 Code modified to only build... 210 return 0;
6831dd7a » dormando 2008-02-18 add compiler options for Su... 211 #else
1d53637b » tmaesaka 2008-04-28 Code modified to only build... 212 return 1;
6831dd7a » dormando 2008-02-18 add compiler options for Su... 213 #endif
214 ])
1d53637b » tmaesaka 2008-04-28 Code modified to only build... 215 ],[
216 CFLAGS="-mt $CFLAGS"
a9fab8e0 » Trond Norbye 2008-10-06 Removed compiler warnings a... 217 SUNSTUDIO=true
1d53637b » tmaesaka 2008-04-28 Code modified to only build... 218 ])
219 else
220 AC_MSG_ERROR([Can't enable threads without the POSIX thread library.])
6485774c » dormando 2007-12-07 Fix --disable-threads not t... 221 fi
111846a4 » sgrimm 2007-04-16 Merge multithreaded into tr... 222
1438d16b » bradfitz 2006-03-22 moving server stuff down in... 223 AC_CHECK_FUNCS(mlockall)
b1595683 » dormando 2008-02-25 Enable use of large memory ... 224 AC_CHECK_FUNCS(getpagesizes)
225 AC_CHECK_FUNCS(memcntl)
1438d16b » bradfitz 2006-03-22 moving server stuff down in... 226
a9fab8e0 » Trond Norbye 2008-10-06 Removed compiler warnings a... 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 Add -Wall to gcc compilation 233 CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls"
a9fab8e0 » Trond Norbye 2008-10-06 Removed compiler warnings a... 234 elif test "$SUNSTUDIO" = "true"
235 then
236 CFLAGS="$CFLAGS -errfmt=error -errwarn -errshort=tags"
237 fi
238
1438d16b » bradfitz 2006-03-22 moving server stuff down in... 239 AC_CONFIG_FILES(Makefile doc/Makefile)
240 AC_OUTPUT