Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 154 lines (138 sloc) 4.566 kb
3888b56 add hacked memcacheq
xunxin authored
1 AC_PREREQ(2.61)
2 AC_INIT([memcacheq], [0.1.1], [stvchu@gmail.com])
3 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
4 AC_PROG_CC
5 AM_PROG_CC_C_O
6 AC_CONFIG_HEADERS([config.h])
7
8 trylibeventdir=""
9 AC_ARG_WITH(libevent,
10 [ --with-libevent=PATH Specify path to libevent installation ],
11 [
12 if test "x$withval" != "xno" ; then
13 trylibeventdir=$withval
14 fi
15 ]
16 )
17
18 dnl ------------------------------------------------------
19 dnl libevent detection. swiped from Tor. modified a bit.
20
21 LIBEVENT_URL=http://www.monkey.org/~provos/libevent/
22
23 AC_CACHE_CHECK([for libevent directory], ac_cv_libevent_dir, [
24 saved_LIBS="$LIBS"
25 saved_LDFLAGS="$LDFLAGS"
26 saved_CPPFLAGS="$CPPFLAGS"
27 le_found=no
28 for ledir in $trylibeventdir "" $prefix /usr/local ; do
29 LDFLAGS="$saved_LDFLAGS"
30 LIBS="$saved_LIBS -levent"
31
32 # Skip the directory if it isn't there.
33 if test ! -z "$ledir" -a ! -d "$ledir" ; then
34 continue;
35 fi
36 if test ! -z "$ledir" ; then
37 if test -d "$ledir/lib" ; then
38 LDFLAGS="-L$ledir/lib $LDFLAGS"
39 else
40 LDFLAGS="-L$ledir $LDFLAGS"
41 fi
42 if test -d "$ledir/include" ; then
43 CPPFLAGS="-I$ledir/include $CPPFLAGS"
44 else
45 CPPFLAGS="-I$ledir $CPPFLAGS"
46 fi
47 fi
48 # Can I compile and link it?
49 AC_TRY_LINK([#include <sys/time.h>
50 #include <sys/types.h>
51 #include <event.h>], [ event_init(); ],
52 [ libevent_linked=yes ], [ libevent_linked=no ])
53 if test $libevent_linked = yes; then
54 if test ! -z "$ledir" ; then
55 ac_cv_libevent_dir=$ledir
56 else
57 ac_cv_libevent_dir="(system)"
58 fi
59 le_found=yes
60 break
61 fi
62 done
63 LIBS="$saved_LIBS"
64 LDFLAGS="$saved_LDFLAGS"
65 CPPFLAGS="$saved_CPPFLAGS"
66 if test $le_found = no ; then
67 AC_MSG_ERROR([libevent is required. You can get it from $LIBEVENT_URL
68
69 If it's already installed, specify its path using --with-libevent=/dir/
70 ])
71 fi
72 ])
73 LIBS="$LIBS -levent"
74 if test $ac_cv_libevent_dir != "(system)"; then
75 if test -d "$ac_cv_libevent_dir/lib" ; then
76 LDFLAGS="-L$ac_cv_libevent_dir/lib $LDFLAGS"
77 le_libdir="$ac_cv_libevent_dir/lib"
78 else
79 LDFLAGS="-L$ac_cv_libevent_dir $LDFLAGS"
80 le_libdir="$ac_cv_libevent_dir"
81 fi
82 if test -d "$ac_cv_libevent_dir/include" ; then
83 CPPFLAGS="-I$ac_cv_libevent_dir/include $CPPFLAGS"
84 else
85 CPPFLAGS="-I$ac_cv_libevent_dir $CPPFLAGS"
86 fi
87 fi
88
89 dnl Check BerkeleyDB lib and headers
90 bdbdir="/usr/local/BerkeleyDB.4.7"
91 AC_ARG_WITH(bdb,
92 [ --with-bdb=PATH Specify path to BerkeleyDB installation ],
93 [
94 if test "x$withval" != "xno" ; then
95 bdbdir=$withval
96 fi
97 ]
98 )
99 CPPFLAGS="-I$bdbdir/include $CPPFLAGS"
100 LDFLAGS="-L$bdbdir/lib $LDFLAGS"
101 AC_SEARCH_LIBS([db_create], [db], [] ,[AC_MSG_ERROR(cannot find libdb.so in $bdbdir/lib)])
102 AC_CHECK_HEADERS([db.h], [] ,[AC_MSG_ERROR(cannot find db.h in $bdbdir/include)])
103
104 dnl ----------------------------------------------------------------------------
105
106 AC_SEARCH_LIBS(socket, socket)
107 AC_SEARCH_LIBS(gethostbyname, nsl)
108 AC_SEARCH_LIBS(mallinfo, malloc)
109
110 AC_CHECK_FUNC(daemon,AC_DEFINE([HAVE_DAEMON],,[Define this if you have daemon()]),[AC_LIBOBJ(daemon)])
111
112 AC_HEADER_STDBOOL
113 AC_C_CONST
114 AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?]))
115 AC_CHECK_MEMBER([struct mallinfo.arena], [
116 AC_DEFINE(HAVE_STRUCT_MALLINFO,,[do we have stuct mallinfo?])
117 ], ,[
118 # include <malloc.h>
119 ]
120 )
121
122 dnl From licq: Copyright (c) 2000 Dirk Mueller
123 dnl Check if the type socklen_t is defined anywhere
124 AC_DEFUN([AC_C_SOCKLEN_T],
125 [AC_CACHE_CHECK(for socklen_t, ac_cv_c_socklen_t,
126 [
127 AC_TRY_COMPILE([
128 #include <sys/types.h>
129 #include <sys/socket.h>
130 ],[
131 socklen_t foo;
132 ],[
133 ac_cv_c_socklen_t=yes
134 ],[
135 ac_cv_c_socklen_t=no
136 ])
137 ])
138 if test $ac_cv_c_socklen_t = no; then
139 AC_DEFINE(socklen_t, int, [define to int if socklen_t not available])
140 fi
141 ])
142
143 AC_C_SOCKLEN_T
144
145 dnl Check whether the user wants threads or not
146 AC_ARG_ENABLE(threads,
147 [AS_HELP_STRING([--enable-threads],[support multithreaded execution])])
148 if test "x$enable_threads" == "xyes"; then
149 AC_SEARCH_LIBS([pthread_create], [pthread], [AC_DEFINE([USE_THREADS],,[Define this if you want to use pthreads])] ,[AC_MSG_ERROR(cannot find libpthread.so)])
150 fi
151
152 AC_CONFIG_FILES([Makefile])
153 AC_OUTPUT
Something went wrong with that request. Please try again.