root/branches/binary/server/configure.ac @ 725

Revision 725, 5.1 kB (checked in by dsallings, 21 months ago)

Merge commit 'trunk' into lbinary as of r724

Conflicts:

server/memcached.c

  • 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
12AC_ARG_ENABLE(64bit,
13  [AS_HELP_STRING([--enable-64bit],[build 64bit verison])])
14if test "x$enable_64bit" == "xyes"
15then
16    org_cflags=$CFLAGS
17    CFLAGS=-m64
18    AC_RUN_IFELSE(
19      [AC_LANG_PROGRAM([], [dnl
20return sizeof(void*) == 8 ? 0 : 1;
21      ])
22    ],[
23      CFLAGS="-m64 $org_cflags"
24    ],[
25    AC_MSG_ERROR([Don't know how to build a 64-bit object.])
26    ])
27fi
28
29trylibeventdir=""
30AC_ARG_WITH(libevent,
31       [  --with-libevent=PATH     Specify path to libevent installation ],
32       [
33                if test "x$withval" != "xno" ; then
34                        trylibeventdir=$withval
35                fi
36       ]
37)
38
39dnl ------------------------------------------------------
40dnl libevent detection.  swiped from Tor.  modified a bit.
41
42LIBEVENT_URL=http://www.monkey.org/~provos/libevent/
43
44AC_CACHE_CHECK([for libevent directory], ac_cv_libevent_dir, [
45  saved_LIBS="$LIBS"
46  saved_LDFLAGS="$LDFLAGS"
47  saved_CPPFLAGS="$CPPFLAGS"
48  le_found=no
49  for ledir in $trylibeventdir "" $prefix /usr/local ; do
50    LDFLAGS="$saved_LDFLAGS"
51    LIBS="$saved_LIBS -levent"
52
53    # Skip the directory if it isn't there.
54    if test ! -z "$ledir" -a ! -d "$ledir" ; then
55       continue;
56    fi
57    if test ! -z "$ledir" ; then
58      if test -d "$ledir/lib" ; then
59        LDFLAGS="-L$ledir/lib $LDFLAGS"
60      else
61        LDFLAGS="-L$ledir $LDFLAGS"
62      fi
63      if test -d "$ledir/include" ; then
64        CPPFLAGS="-I$ledir/include $CPPFLAGS"
65      else
66        CPPFLAGS="-I$ledir $CPPFLAGS"
67      fi
68    fi
69    # Can I compile and link it?
70    AC_TRY_LINK([#include <sys/time.h>
71#include <sys/types.h>
72#include <event.h>], [ event_init(); ],
73       [ libevent_linked=yes ], [ libevent_linked=no ])
74    if test $libevent_linked = yes; then
75       if test ! -z "$ledir" ; then
76         ac_cv_libevent_dir=$ledir
77       else
78         ac_cv_libevent_dir="(system)"
79       fi
80       le_found=yes
81       break
82    fi
83  done
84  LIBS="$saved_LIBS"
85  LDFLAGS="$saved_LDFLAGS"
86  CPPFLAGS="$saved_CPPFLAGS"
87  if test $le_found = no ; then
88    AC_MSG_ERROR([libevent is required.  You can get it from $LIBEVENT_URL
89
90      If it's already installed, specify its path using --with-libevent=/dir/
91])
92  fi
93])
94LIBS="$LIBS -levent"
95if test $ac_cv_libevent_dir != "(system)"; then
96  if test -d "$ac_cv_libevent_dir/lib" ; then
97    LDFLAGS="-L$ac_cv_libevent_dir/lib $LDFLAGS"
98    le_libdir="$ac_cv_libevent_dir/lib"
99  else
100    LDFLAGS="-L$ac_cv_libevent_dir $LDFLAGS"
101    le_libdir="$ac_cv_libevent_dir"
102  fi
103  if test -d "$ac_cv_libevent_dir/include" ; then
104    CPPFLAGS="-I$ac_cv_libevent_dir/include $CPPFLAGS"
105  else
106    CPPFLAGS="-I$ac_cv_libevent_dir $CPPFLAGS"
107  fi
108fi
109
110dnl ----------------------------------------------------------------------------
111
112AC_SEARCH_LIBS(socket, socket)
113AC_SEARCH_LIBS(gethostbyname, nsl)
114AC_SEARCH_LIBS(mallinfo, malloc)
115
116AC_CHECK_FUNC(daemon,AC_DEFINE([HAVE_DAEMON],,[Define this if you have daemon()]),[AC_LIBOBJ(daemon)])
117
118AC_HEADER_STDBOOL
119AC_C_CONST
120AC_CHECK_HEADER(malloc.h, AC_DEFINE(HAVE_MALLOC_H,,[do we have malloc.h?]))
121AC_CHECK_MEMBER([struct mallinfo.arena], [
122        AC_DEFINE(HAVE_STRUCT_MALLINFO,,[do we have stuct mallinfo?])
123    ], ,[
124#    include <malloc.h>
125    ]
126)
127
128dnl From licq: Copyright (c) 2000 Dirk Mueller
129dnl Check if the type socklen_t is defined anywhere
130AC_DEFUN([AC_C_SOCKLEN_T],
131[AC_CACHE_CHECK(for socklen_t, ac_cv_c_socklen_t,
132[
133  AC_TRY_COMPILE([
134    #include <sys/types.h>
135    #include <sys/socket.h>
136  ],[
137    socklen_t foo;
138  ],[
139    ac_cv_c_socklen_t=yes
140  ],[
141    ac_cv_c_socklen_t=no
142  ])
143])
144if test $ac_cv_c_socklen_t = no; then
145  AC_DEFINE(socklen_t, int, [define to int if socklen_t not available])
146fi
147])
148
149AC_C_SOCKLEN_T
150
151dnl Check if we're a little-endian or a big-endian system, needed by hash code
152AC_DEFUN([AC_C_ENDIAN],
153[AC_CACHE_CHECK(for endianness, ac_cv_c_endian,
154[
155  AC_RUN_IFELSE(
156    [AC_LANG_PROGRAM([], [dnl
157        long val = 1;
158        char *c = (char *) &val;
159        exit(*c == 1);
160    ])
161  ],[
162    ac_cv_c_endian=big
163  ],[
164    ac_cv_c_endian=little
165  ])
166])
167if test $ac_cv_c_endian = big; then
168  AC_DEFINE(ENDIAN_BIG, 1, [machine is bigendian])
169fi
170if test $ac_cv_c_endian = little; then
171  AC_DEFINE(ENDIAN_LITTLE, 1, [machine is littleendian])
172fi
173])
174
175AC_C_ENDIAN
176
177dnl Check whether the user wants threads or not
178AC_ARG_ENABLE(threads,
179  [AS_HELP_STRING([--enable-threads],[support multithreaded execution])])
180if test "x$enable_threads" == "xyes"; then
181  AC_SEARCH_LIBS(pthread_create, pthread)
182  if test "x$ac_cv_search_pthread_create" != "xno"; then
183    AC_DEFINE([USE_THREADS],,[Define this if you want to use pthreads])
184    dnl Sun compilers need the -mt flag!
185    AC_RUN_IFELSE(
186      [AC_LANG_PROGRAM([], [dnl
187#ifdef __SUNPRO_C
188   return 0;
189#else
190   return 1;
191#endif
192      ])
193    ],[
194      CFLAGS="-mt $CFLAGS"
195    ])
196  else
197    AC_MSG_ERROR([Can't enable threads without the POSIX thread library.])
198  fi
199fi
200
201AC_CHECK_FUNCS(mlockall)
202AC_CHECK_FUNCS(getpagesizes)
203AC_CHECK_FUNCS(memcntl)
204
205AC_CONFIG_FILES(Makefile doc/Makefile)
206AC_OUTPUT
Note: See TracBrowser for help on using the browser.