Refer to the correct binlog.
[beanstalkd.git] / configure.in
blobe009bbd1cf7420959047114fb73ec90cd6f39150
1 dnl this files has to be processed by autoconf
2 AC_PREREQ(2.61)
4 AC_INIT
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)
9 AM_MAINTAINER_MODE
11 AC_PROG_CC
12 AC_PROG_LD
13 AC_PROG_INSTALL
15 DEFAULT_INSTALL_PREFIX="/usr/local"
16 STANDARD_PREFIXES="/usr /usr/local /opt /local"
18 MAJOR_VERSION=1
19 MINOR_VERSION=2
20 EXTRA_VERSION="-dev"
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'
32 else
33   rm -f version.h.new
35 dnl }}}
37 dnl {{{ --with-libdir
38 AC_ARG_WITH(libdir,
39   [AS_HELP_STRING([--with-libdir],[look for libraries in .../NAME rather than .../lib])
40   ],
41   [LIBDIR=$with_libdir],
42   [LIBDIR=lib]
44 dnl }}}
46 dnl {{{ --disable-rpath
47 AC_ARG_ENABLE(rpath,
48   [AS_HELP_STRING([--disable-rpath],[disable passing additional runtime library search paths])
49   ],
50   [BEAN_RPATH=no],
51   [BEAN_RPATH=yes]
53 dnl }}}
55 dnl {{{ check for rpath support
56 AC_MSG_CHECKING([if compiler supports -R])
57 AC_CACHE_VAL(bt_cv_cc_dashr,[
58   SAVE_LIBS=$LIBS
59   LIBS="-R /usr/$LIBDIR $LIBS"
60   AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[bt_cv_cc_dashr=yes],[bt_cv_cc_dashr=no])
61   LIBS=$SAVE_LIBS])
62 AC_MSG_RESULT([$bt_cv_cc_dashr])
63 if test $bt_cv_cc_dashr = "yes"; then
64   ld_runpath_switch=-R
65 else
66   AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
67   AC_CACHE_VAL(bt_cv_cc_rpath,[
68     SAVE_LIBS=$LIBS
69     LIBS="-Wl,-rpath,/usr/$LIBDIR $LIBS"
70     AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[bt_cv_cc_rpath=yes],[bt_cv_cc_rpath=no])
71     LIBS=$SAVE_LIBS])
72   AC_MSG_RESULT([$bt_cv_cc_rpath])
73   if test $bt_cv_cc_rpath = "yes"; then
74     ld_runpath_switch=-Wl,-rpath,
75   else
76     ld_runpath_switch=-L
77   fi
79 if test "$BEAN_RPATH" = "no"; then
80   ld_runpath_switch=
82 dnl }}}
84 dnl {{{ --with-event
85 AC_ARG_WITH(event,
86   [AS_HELP_STRING([--with-event],[specify libevent install prefix])
87   ],
88   [ ],
89   [with_event=yes]
92 if test "x$with_event" = "xno"; then
93   AC_MSG_ERROR([can't continue without libevent])
94 else
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
100         LIBEVENT_DIR="$i"
101         break;
102       fi
103     done
104   else
105     if test -f "$with_event/include/event.h"; then
106       LIBEVENT_DIR="$with_event"
107       break;
108     else
109       AC_MSG_ERROR([Can't find libevent headers under $with_event directory])
110     fi
111   fi
113   if test "x$LIBEVENT_DIR" = "x"; then
114     AC_MSG_ERROR([Unable to locate libevent headers, please use --with-event=<DIR>])
115   fi
117   AC_MSG_RESULT([$LIBEVENT_DIR])
118   LDFLAGS="$LDFLAGS -L$LIBEVENT_DIR/$LIBDIR"
119   CFLAGS="$CFLAGS -I$LIBEVENT_DIR/include"
120   LIBS="$LIBS -levent"
122   if test "$BEAN_RPATH" != "no"; then
123     LDFLAGS="$LDFLAGS $ld_runpath_switch$LIBEVENT_DIR/$LIBDIR"
124   fi
126   AC_CHECK_LIB([event], [event_get_version], [], [
127     AC_MSG_ERROR([event_get_version() is missing, check config.log for more details])
128   ])
130   if test -f "$LIBEVENT_DIR/$LIBDIR/libevent.so"; then
131     LIBEVENT="$LIBEVENT_DIR/$LIBDIR/libevent.so";
132   else 
133     if test -f "$LIBEVENT_DIR/lib/libevent.so"; then
134       LIBEVENT="$LIBEVENT_DIR/lib/libevent.so";
135     else 
136       if test -f "$LIBEVENT_DIR/lib64/libevent.so"; then 
137         LIBEVENT="$LIBEVENT_DIR/lib64/libevent.so";
138       fi
139     fi
140   fi
143 dnl }}}
145 dnl {{{ --enable-debug 
146 AC_ARG_ENABLE(debug,
147   [AS_HELP_STRING([--enable-debug],[enable debugging symbols and compile flags])
148   ],
149   [
150   if test x"$enableval" = xyes ; then
151     debug="yes"
152   else
153     debug="no"
154   fi
155   ]
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
163     changequote({,})
164     CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9s]*//g'`
165     CFLAGS=`echo "$CFLAGS" | sed -e 's/-g[0-2]\? //g'`
166     changequote([,])
167     CFLAGS="$CFLAGS -g3 -Wall -O0"
168   fi
170   dnl Do not strip symbols from developer object files.
171   INSTALL_STRIP_FLAG=""
172 else
173   dnl Make sure to strip symbols from non-developer object files.
174   INSTALL_STRIP_FLAG="-s"
176 dnl }}}
178 AC_SUBST(INSTALL_STRIP_FLAG)
180 AC_CONFIG_FILES([Makefile])
181 AC_OUTPUT
183 dnl vim700: ts=2 sw=2 et