1 dnl this files has to be processed by autoconf
5 AC_CONFIG_SRCDIR([README])
6 AC_CONFIG_SRCDIR(job.c)
7 AC_CONFIG_HEADERS(config.h)
8 AC_CONFIG_MACRO_DIR([m4])
10 AM_INIT_AUTOMAKE(beanstalkd,$($srcdir/version.sh))
13 AS_COMPILER_FLAGS(CFLAGS, "-Wall -Werror")
18 DEFAULT_INSTALL_PREFIX="/usr/local"
19 STANDARD_PREFIXES="/usr /usr/local /opt /local"
24 [AS_HELP_STRING([--with-libdir],[look for libraries in .../NAME rather than .../lib])
26 [LIBDIR=$with_libdir],
31 dnl {{{ --disable-rpath
33 [AS_HELP_STRING([--disable-rpath],[disable passing additional runtime library search paths])
40 dnl {{{ check for rpath support
41 AC_MSG_CHECKING([if compiler supports -R])
42 AC_CACHE_VAL(bt_cv_cc_dashr,[
44 LIBS="-R /usr/$LIBDIR $LIBS"
45 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[bt_cv_cc_dashr=yes],[bt_cv_cc_dashr=no])
47 AC_MSG_RESULT([$bt_cv_cc_dashr])
48 if test $bt_cv_cc_dashr = "yes"; then
51 AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
52 AC_CACHE_VAL(bt_cv_cc_rpath,[
54 LIBS="-Wl,-rpath,/usr/$LIBDIR $LIBS"
55 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[bt_cv_cc_rpath=yes],[bt_cv_cc_rpath=no])
57 AC_MSG_RESULT([$bt_cv_cc_rpath])
58 if test $bt_cv_cc_rpath = "yes"; then
59 ld_runpath_switch=-Wl,-rpath,
64 if test "$BEAN_RPATH" = "no"; then
71 [AS_HELP_STRING([--with-event],[specify libevent install prefix])
77 if test "x$with_event" = "xno"; then
78 AC_MSG_ERROR([can't continue without libevent])
80 AC_MSG_CHECKING([libevent install prefix])
82 if test "x$with_event" = "xyes"; then
83 for i in `echo "$STANDARD_PREFIXES"`; do
84 if test -f "$i/include/event.h"; then
90 if test -f "$with_event/include/event.h"; then
91 LIBEVENT_DIR="$with_event"
94 AC_MSG_ERROR([Can't find libevent headers under $with_event directory])
98 if test "x$LIBEVENT_DIR" = "x"; then
99 AC_MSG_ERROR([Unable to locate libevent headers, please use --with-event=<DIR>])
102 AC_MSG_RESULT([$LIBEVENT_DIR])
103 LDFLAGS="$LDFLAGS -L$LIBEVENT_DIR/$LIBDIR"
104 CFLAGS="$CFLAGS -I$LIBEVENT_DIR/include"
107 AC_CHECK_FUNCS([posix_fallocate])
108 AC_CHECK_FUNCS([fdatasync])
110 AC_CHECK_LIB([socket], [bind], [
111 LIBS="$LIBS -lsocket"
114 AC_CHECK_LIB([nsl], [inet_aton], [
118 if test "$BEAN_RPATH" != "no"; then
119 LDFLAGS="$LDFLAGS $ld_runpath_switch$LIBEVENT_DIR/$LIBDIR"
122 AC_CHECK_LIB([event], [event_get_version], [], [
123 AC_MSG_ERROR([event_get_version() is missing, check config.log for more details])
126 AC_CHECK_LIB([event], [event_reinit], [], [
127 AC_MSG_ERROR([beanstalkd requires libevent version 1.4.1 or later.])
130 if test -f "$LIBEVENT_DIR/$LIBDIR/libevent.so"; then
131 LIBEVENT="$LIBEVENT_DIR/$LIBDIR/libevent.so";
133 if test -f "$LIBEVENT_DIR/lib/libevent.so"; then
134 LIBEVENT="$LIBEVENT_DIR/lib/libevent.so";
136 if test -f "$LIBEVENT_DIR/lib64/libevent.so"; then
137 LIBEVENT="$LIBEVENT_DIR/lib64/libevent.so";
145 dnl {{{ --enable-debug
147 [AS_HELP_STRING([--enable-debug],[enable debugging symbols and compile flags])
150 if test x"$enableval" = xyes ; then
158 if test x"$debug" = xyes ; then
159 AC_DEFINE([BEAN_DEBUG], [], [debug build])
161 if test x"$GCC" = xyes; then
162 dnl Remove any optimization flags from CFLAGS
164 CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9s]*//g'`
165 CFLAGS=`echo "$CFLAGS" | sed -e 's/-g[0-2]\? //g'`
167 CFLAGS="$CFLAGS -g3 -Wall -O0"
170 dnl Do not strip symbols from developer object files.
171 INSTALL_STRIP_FLAG=""
173 dnl Make sure to strip symbols from non-developer object files.
174 INSTALL_STRIP_FLAG="-s"
178 # Checks for typedefs, structures, and compiler characteristics.
181 AC_SUBST(INSTALL_STRIP_FLAG)
183 AC_CONFIG_FILES([Makefile beanstalkd.spec])
186 dnl vim700: ts=2 sw=2 et