Mercurial > hg > memcached
comparison configure.ac @ 0:30782bb1fc04 MEMCACHED_1_2_3
memcached-1.2.3
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sun, 23 Sep 2007 03:58:34 +0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:30782bb1fc04 |
---|---|
1 AC_PREREQ(2.52) | |
2 AC_INIT(memcached, 1.2.3, brad@danga.com) | |
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 | |
9 AC_PROG_INSTALL | |
10 | |
11 trylibeventdir="" | |
12 AC_ARG_WITH(libevent, | |
13 [ --with-libevent=PATH Specify path to libevent installation ], | |
14 [ | |
15 if test "x$withval" != "xno" ; then | |
16 trylibeventdir=$withval | |
17 fi | |
18 ] | |
19 ) | |
20 | |
21 dnl ------------------------------------------------------ | |
22 dnl libevent detection. swiped from Tor. modified a bit. | |
23 | |
24 LIBEVENT_URL=http://www.monkey.org/~provos/libevent/ | |
25 | |
26 AC_CACHE_CHECK([for libevent directory], ac_cv_libevent_dir, [ | |
27 saved_LIBS="$LIBS" | |
28 saved_LDFLAGS="$LDFLAGS" | |
29 saved_CPPFLAGS="$CPPFLAGS" | |
30 le_found=no | |
31 for ledir in $trylibeventdir "" $prefix /usr/local ; do | |
32 LDFLAGS="$saved_LDFLAGS" | |
33 LIBS="$saved_LIBS -levent" | |
34 | |
35 # Skip the directory if it isn't there. | |
36 if test ! -z "$ledir" -a ! -d "$ledir" ; then | |
37 continue; | |
38 fi | |
39 if test ! -z "$ledir" ; then | |
40 if test -d "$ledir/lib" ; then | |
41 LDFLAGS="-L$ledir/lib $LDFLAGS" | |
42 else | |
43 LDFLAGS="-L$ledir $LDFLAGS" | |
44 fi | |
45 if test -d "$ledir/include" ; then | |
46 CPPFLAGS="-I$ledir/include $CPPFLAGS" | |
47 else | |
48 CPPFLAGS="-I$ledir $CPPFLAGS" | |
49 fi | |
50 fi | |
51 # Can I compile and link it? | |
52 AC_TRY_LINK([#include <sys/time.h> | |
53 #include <sys/types.h> | |
54 #include <event.h>], [ event_init(); ], | |
55 [ libevent_linked=yes ], [ libevent_linked=no ]) | |
56 if test $libevent_linked = yes; then | |
57 if test ! -z "$ledir" ; then | |
58 ac_cv_libevent_dir=$ledir | |
59 else | |
60 ac_cv_libevent_dir="(system)" | |
61 fi | |
62 le_found=yes | |
63 break | |
64 fi | |
65 done | |
66 LIBS="$saved_LIBS" | |
67 LDFLAGS="$saved_LDFLAGS" | |
68 CPPFLAGS="$saved_CPPFLAGS" | |
69 if test $le_found = no ; then | |
70 AC_MSG_ERROR([libevent is required. You can get it from $LIBEVENT_URL | |
71 | |
72 If it's already installed, specify its path using --with-libevent=/dir/ | |
73 ]) | |
74 fi | |
75 ]) | |
76 LIBS="$LIBS -levent" | |
77 if test $ac_cv_libevent_dir != "(system)"; then | |
78 if test -d "$ac_cv_libevent_dir/lib" ; then | |
79 LDFLAGS="-L$ac_cv_libevent_dir/lib $LDFLAGS" | |
80 le_libdir="$ac_cv_libevent_dir/lib" | |
81 else | |
82 LDFLAGS="-L$ac_cv_libevent_dir $LDFLAGS" | |
83 le_libdir="$ac_cv_libevent_dir" | |
84 fi | |
85 if test -d "$ac_cv_libevent_dir/include" ; then | |
86 CPPFLAGS="-I$ac_cv_libevent_dir/include $CPPFLAGS" | |
87 else | |
88 CPPFLAGS="-I$ac_cv_libevent_dir $CPPFLAGS" | |
89 fi | |
90 fi | |
91 | |
92 dnl ---------------------------------------------------------------------------- | |
93 | |
94 AC_SEARCH_LIBS(socket, socket) | |
95 AC_SEARCH_LIBS(gethostbyname, nsl) | |
96 AC_SEARCH_LIBS(mallinfo, malloc) | |
97 AC_SEARCH_LIBS(pthread_create, pthread) | |
98 | |
99 AC_CHECK_FUNC(daemon,AC_DEFINE([HAVE_DAEMON],,[Define this if you have daemon()]),[AC_LIBOBJ(daemon)]) | |
100 | |
101 AC_HEADER_STDBOOL | |
102 AC_C_CONST | |
103 AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?])) | |
104 AC_CHECK_MEMBER([struct mallinfo.arena], [ | |
105 AC_DEFINE(HAVE_STRUCT_MALLINFO,,[do we have stuct mallinfo?]) | |
106 ], ,[ | |
107 # include <malloc.h> | |
108 ] | |
109 ) | |
110 | |
111 dnl From licq: Copyright (c) 2000 Dirk Mueller | |
112 dnl Check if the type socklen_t is defined anywhere | |
113 AC_DEFUN([AC_C_SOCKLEN_T], | |
114 [AC_CACHE_CHECK(for socklen_t, ac_cv_c_socklen_t, | |
115 [ | |
116 AC_TRY_COMPILE([ | |
117 #include <sys/types.h> | |
118 #include <sys/socket.h> | |
119 ],[ | |
120 socklen_t foo; | |
121 ],[ | |
122 ac_cv_c_socklen_t=yes | |
123 ],[ | |
124 ac_cv_c_socklen_t=no | |
125 ]) | |
126 ]) | |
127 if test $ac_cv_c_socklen_t = no; then | |
128 AC_DEFINE(socklen_t, int, [define to int if socklen_t not available]) | |
129 fi | |
130 ]) | |
131 | |
132 AC_C_SOCKLEN_T | |
133 | |
134 dnl Check if we're a little-endian or a big-endian system, needed by hash code | |
135 AC_DEFUN([AC_C_ENDIAN], | |
136 [AC_CACHE_CHECK(for endianness, ac_cv_c_endian, | |
137 [ | |
138 AC_RUN_IFELSE( | |
139 [AC_LANG_PROGRAM([], [dnl | |
140 long val = 1; | |
141 char *c = (char *) &val; | |
142 exit(*c == 1); | |
143 ]) | |
144 ],[ | |
145 ac_cv_c_endian=big | |
146 ],[ | |
147 ac_cv_c_endian=little | |
148 ]) | |
149 ]) | |
150 if test $ac_cv_c_endian = big; then | |
151 AC_DEFINE(ENDIAN_BIG, 1, [machine is bigendian]) | |
152 fi | |
153 if test $ac_cv_c_endian = little; then | |
154 AC_DEFINE(ENDIAN_LITTLE, 1, [machine is littleendian]) | |
155 fi | |
156 ]) | |
157 | |
158 AC_C_ENDIAN | |
159 | |
160 dnl Check whether the user wants threads or not | |
161 AC_ARG_ENABLE(threads, | |
162 [AS_HELP_STRING([--enable-threads],[support multithreaded execution])], | |
163 [if test "$ac_cv_search_pthread_create" != "no"; then | |
164 AC_DEFINE([USE_THREADS],,[Define this if you want to use pthreads]) | |
165 else | |
166 AC_MSG_ERROR([Can't enable threads without the POSIX thread library.]) | |
167 fi]) | |
168 | |
169 AC_CHECK_FUNCS(mlockall) | |
170 | |
171 AC_CONFIG_FILES(Makefile doc/Makefile) | |
172 AC_OUTPUT |