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 AM_INIT_AUTOMAKE(beanstalkd,1.2-dev)
15 DEFAULT_INSTALL_PREFIX="/usr/local"
16 STANDARD_PREFIXES="/usr /usr/local /opt /local"
22 BEAN_VERSION="${MAJOR_VERSION}.${MINOR_VERSION}${EXTRA_VERSION}"
24 dnl generate version.h {{{
25 echo "/* automatically generated by configure */" > version.h.new
26 echo "/* edit configure.in to change the version number */" >> version.h.new
27 echo "#define BEAN_VERSION \"$BEAN_VERSION\"" >> version.h.new
28 cmp version.h.new $srcdir/version.h >/dev/null 2>&1
29 if test $? -ne 0 ; then
30 rm -f $srcdir/version.h && mv version.h.new $srcdir/version.h && \
31 echo 'Updated version.h'
39 [AS_HELP_STRING([--with-libdir],[look for libraries in .../NAME rather than .../lib])
41 [LIBDIR=$with_libdir],
46 dnl {{{ --disable-rpath
48 [AS_HELP_STRING([--disable-rpath],[disable passing additional runtime library search paths])
55 dnl {{{ check for rpath support
56 AC_MSG_CHECKING([if compiler supports -R])
57 AC_CACHE_VAL(bt_cv_cc_dashr,[
59 LIBS="-R /usr/$LIBDIR $LIBS"
60 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[bt_cv_cc_dashr=yes],[bt_cv_cc_dashr=no])
62 AC_MSG_RESULT([$bt_cv_cc_dashr])
63 if test $bt_cv_cc_dashr = "yes"; then
66 AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
67 AC_CACHE_VAL(bt_cv_cc_rpath,[
69 LIBS="-Wl,-rpath,/usr/$LIBDIR $LIBS"
70 AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[bt_cv_cc_rpath=yes],[bt_cv_cc_rpath=no])
72 AC_MSG_RESULT([$bt_cv_cc_rpath])
73 if test $bt_cv_cc_rpath = "yes"; then
74 ld_runpath_switch=-Wl,-rpath,
79 if test "$BEAN_RPATH" = "no"; then
86 [AS_HELP_STRING([--with-event],[specify libevent install prefix])
92 if test "x$with_event" = "xno"; then
93 AC_MSG_ERROR([can't continue without libevent])
95 AC_MSG_CHECKING([libevent install prefix])
97 if test "x$with_event" = "xyes"; then
98 for i in `echo "$STANDARD_PREFIXES"`; do
99 if test -f "$i/include/event.h"; then
105 if test -f "$with_event/include/event.h"; then
106 LIBEVENT_DIR="$with_event"
109 AC_MSG_ERROR([Can't find libevent headers under $with_event directory])
113 if test "x$LIBEVENT_DIR" = "x"; then
114 AC_MSG_ERROR([Unable to locate libevent headers, please use --with-event=<DIR>])
117 AC_MSG_RESULT([$LIBEVENT_DIR])
118 LDFLAGS="$LDFLAGS -L$LIBEVENT_DIR/$LIBDIR"
119 CFLAGS="$CFLAGS -I$LIBEVENT_DIR/include"
122 if test "$BEAN_RPATH" != "no"; then
123 LDFLAGS="$LDFLAGS $ld_runpath_switch$LIBEVENT_DIR/$LIBDIR"
126 AC_CHECK_LIB([event], [event_get_version], [], [
127 AC_MSG_ERROR([event_get_version() is missing, check config.log for more details])
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 AC_SUBST(INSTALL_STRIP_FLAG)
180 AC_CONFIG_FILES([Makefile])
183 dnl vim700: ts=2 sw=2 et