root/trunk/server/configure.ac @ 623

Revision 623, 4.5 kB (checked in by plindner, 2 years ago)

The memcached-tool script can now display stats. Patch
provided by Dan Christian <dchristian@…>

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