-
Notifications
You must be signed in to change notification settings - Fork 1
/
configure.in
198 lines (168 loc) · 4.7 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
dnl this files has to be processed by autoconf
AC_PREREQ(2.61)
AC_INIT
AC_CONFIG_SRCDIR([README])
AC_CONFIG_SRCDIR(job.c)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE(beanstalkd,$($srcdir/version.sh))
AM_MAINTAINER_MODE
AS_COMPILER_FLAGS(CFLAGS, "-Wall -Werror")
AC_PROG_CC
AC_PROG_INSTALL
DEFAULT_INSTALL_PREFIX="/usr/local"
STANDARD_PREFIXES="/usr /usr/local /opt /local"
dnl {{{ --with-libdir
AC_ARG_WITH(libdir,
[AS_HELP_STRING([--with-libdir],[look for libraries in .../NAME rather than .../lib])
],
[LIBDIR=$with_libdir],
[LIBDIR=lib]
)
dnl }}}
dnl {{{ --disable-rpath
AC_ARG_ENABLE(rpath,
[AS_HELP_STRING([--disable-rpath],[disable passing additional runtime library search paths])
],
[BEAN_RPATH=no],
[BEAN_RPATH=yes]
)
dnl }}}
dnl {{{ check for rpath support
AC_MSG_CHECKING([if compiler supports -R])
AC_CACHE_VAL(bt_cv_cc_dashr,[
SAVE_LIBS=$LIBS
LIBS="-R /usr/$LIBDIR $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[bt_cv_cc_dashr=yes],[bt_cv_cc_dashr=no])
LIBS=$SAVE_LIBS])
AC_MSG_RESULT([$bt_cv_cc_dashr])
if test $bt_cv_cc_dashr = "yes"; then
ld_runpath_switch=-R
else
AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
AC_CACHE_VAL(bt_cv_cc_rpath,[
SAVE_LIBS=$LIBS
LIBS="-Wl,-rpath,/usr/$LIBDIR $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[bt_cv_cc_rpath=yes],[bt_cv_cc_rpath=no])
LIBS=$SAVE_LIBS])
AC_MSG_RESULT([$bt_cv_cc_rpath])
if test $bt_cv_cc_rpath = "yes"; then
ld_runpath_switch=-Wl,-rpath,
else
ld_runpath_switch=-L
fi
fi
if test "$BEAN_RPATH" = "no"; then
ld_runpath_switch=
fi
dnl }}}
dnl {{{ --with-event
AC_ARG_WITH(event,
[AS_HELP_STRING([--with-event],[specify libevent install prefix])
],
[ ],
[with_event=yes]
)
if test "x$with_event" = "xno"; then
AC_MSG_ERROR([can't continue without libevent])
else
AC_MSG_CHECKING([libevent install prefix])
if test "x$with_event" = "xyes"; then
for i in `echo "$STANDARD_PREFIXES"`; do
if test -f "$i/include/event.h"; then
LIBEVENT_DIR="$i"
break;
fi
done
else
if test -f "$with_event/include/event.h"; then
LIBEVENT_DIR="$with_event"
break;
else
AC_MSG_ERROR([Can't find libevent headers under $with_event directory])
fi
fi
if test "x$LIBEVENT_DIR" = "x"; then
AC_MSG_ERROR([Unable to locate libevent headers, please use --with-event=<DIR>])
fi
AC_MSG_RESULT([$LIBEVENT_DIR])
LDFLAGS="$LDFLAGS -L$LIBEVENT_DIR/$LIBDIR"
CFLAGS="$CFLAGS -I$LIBEVENT_DIR/include"
LIBS="$LIBS -levent"
AC_CHECK_FUNCS([posix_fallocate])
dnl {{{ make sure that fdatasync exits
AC_CACHE_CHECK([for fdatasync],[ac_cv_func_fdatasync],[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <unistd.h>
]],[[
fdatasync(4);
]])],
[ac_cv_func_fdatasync=yes],
[ac_cv_func_fdatasync=no])
])
AS_IF([test "x${ac_cv_func_fdatasync}" = "xyes"],
[AC_DEFINE([HAVE_FDATASYNC],[1],[If the system defines fdatasync])])
dnl }}}
AC_CHECK_LIB([socket], [bind], [
LIBS="$LIBS -lsocket"
])
AC_CHECK_LIB([nsl], [inet_aton], [
LIBS="$LIBS -lnsl"
])
if test "$BEAN_RPATH" != "no"; then
LDFLAGS="$LDFLAGS $ld_runpath_switch$LIBEVENT_DIR/$LIBDIR"
fi
AC_CHECK_LIB([event], [event_get_version], [], [
AC_MSG_ERROR([event_get_version() is missing, check config.log for more details])
])
AC_CHECK_LIB([event], [event_reinit], [], [
AC_MSG_ERROR([beanstalkd requires libevent version 1.4.1 or later.])
])
if test -f "$LIBEVENT_DIR/$LIBDIR/libevent.so"; then
LIBEVENT="$LIBEVENT_DIR/$LIBDIR/libevent.so";
else
if test -f "$LIBEVENT_DIR/lib/libevent.so"; then
LIBEVENT="$LIBEVENT_DIR/lib/libevent.so";
else
if test -f "$LIBEVENT_DIR/lib64/libevent.so"; then
LIBEVENT="$LIBEVENT_DIR/lib64/libevent.so";
fi
fi
fi
fi
dnl }}}
dnl {{{ --enable-debug
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],[enable debugging symbols and compile flags])
],
[
if test x"$enableval" = xyes ; then
debug="yes"
else
debug="no"
fi
]
)
if test x"$debug" = xyes ; then
AC_DEFINE([BEAN_DEBUG], [], [debug build])
if test x"$GCC" = xyes; then
dnl Remove any optimization flags from CFLAGS
changequote({,})
CFLAGS=`echo "$CFLAGS" | sed -e 's/-O[0-9s]*//g'`
CFLAGS=`echo "$CFLAGS" | sed -e 's/-g[0-2]\? //g'`
changequote([,])
CFLAGS="$CFLAGS -g3 -Wall -O0"
fi
dnl Do not strip symbols from developer object files.
INSTALL_STRIP_FLAG=""
else
dnl Make sure to strip symbols from non-developer object files.
INSTALL_STRIP_FLAG="-s"
fi
dnl }}}
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_UINT16_T
AC_SUBST(INSTALL_STRIP_FLAG)
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
dnl vim700: ts=2 sw=2 et