root/branches/append/server/configure.ac

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

prep for 1.2.3

  • 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.3, 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
9AC_PROG_INSTALL
10
11trylibeventdir=""
12AC_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
21dnl ------------------------------------------------------
22dnl libevent detection.  swiped from Tor.  modified a bit.
23
24LIBEVENT_URL=http://www.monkey.org/~provos/libevent/
25
26AC_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])
76LIBS="$LIBS -levent"
77if 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
90fi
91
92dnl ----------------------------------------------------------------------------
93
94AC_SEARCH_LIBS(socket, socket)
95AC_SEARCH_LIBS(gethostbyname, nsl)
96AC_SEARCH_LIBS(mallinfo, malloc)
97AC_SEARCH_LIBS(pthread_create, pthread)
98
99AC_CHECK_FUNC(daemon,AC_DEFINE([HAVE_DAEMON],,[Define this if you have daemon()]),[AC_LIBOBJ(daemon)])
100
101AC_HEADER_STDBOOL
102AC_C_CONST
103AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?]))
104AC_CHECK_MEMBER([struct mallinfo.arena], [
105        AC_DEFINE(HAVE_STRUCT_MALLINFO,,[do we have stuct mallinfo?])
106    ], ,[
107#    include <malloc.h>
108    ]
109)
110
111dnl From licq: Copyright (c) 2000 Dirk Mueller
112dnl Check if the type socklen_t is defined anywhere
113AC_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])
127if test $ac_cv_c_socklen_t = no; then
128  AC_DEFINE(socklen_t, int, [define to int if socklen_t not available])
129fi
130])
131
132AC_C_SOCKLEN_T
133
134dnl Check if we're a little-endian or a big-endian system, needed by hash code
135AC_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])
150if test $ac_cv_c_endian = big; then
151  AC_DEFINE(ENDIAN_BIG, 1, [machine is bigendian])
152fi
153if test $ac_cv_c_endian = little; then
154  AC_DEFINE(ENDIAN_LITTLE, 1, [machine is littleendian])
155fi
156])
157
158AC_C_ENDIAN
159
160dnl Check whether the user wants threads or not
161AC_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
169AC_CHECK_FUNCS(mlockall)
170
171AC_CONFIG_FILES(Makefile doc/Makefile)
172AC_OUTPUT
Note: See TracBrowser for help on using the browser.