1 |
nmav |
1.41 |
dnl $Id: configure.in,v 1.40 2006-03-09 18:11:49 nmav Exp $ |
2 |
nmav |
1.1 |
dnl Process this file with autoconf to produce a configure script. |
3 |
|
|
AC_PREREQ(2.50) |
4 |
|
|
|
5 |
nmav |
1.4 |
AC_INIT |
6 |
|
|
|
7 |
nmav |
1.25 |
AC_CANONICAL_HOST |
8 |
|
|
|
9 |
nmav |
1.39 |
SERVER_VERSION="0.1.7" |
10 |
nmav |
1.4 |
AC_DEFINE_UNQUOTED(SERVER_VERSION, "$SERVER_VERSION", [Version of Hydra]) |
11 |
nmav |
1.1 |
AC_DEFINE_UNQUOTED(SERVER_NAME, "Hydra", [Name of the server]) |
12 |
|
|
|
13 |
nmav |
1.4 |
AM_INIT_AUTOMAKE(hydra, $SERVER_VERSION, [nothing here]) |
14 |
nmav |
1.1 |
|
15 |
|
|
dnl Make config.h |
16 |
|
|
AM_CONFIG_HEADER(config.h) |
17 |
|
|
|
18 |
nmav |
1.4 |
AM_MAINTAINER_MODE |
19 |
|
|
|
20 |
nmav |
1.35 |
use_smp=yes |
21 |
|
|
|
22 |
nmav |
1.41 |
AC_MSG_CHECKING([whether to include SMP support]) |
23 |
|
|
AC_ARG_ENABLE(smp, |
24 |
|
|
AS_HELP_STRING([ --disable-smp Do not include SMP support]), |
25 |
|
|
use_smp=$enableval) |
26 |
nmav |
1.35 |
|
27 |
|
|
AC_MSG_RESULT($use_smp) |
28 |
|
|
|
29 |
|
|
if test "$use_smp" = "yes"; then |
30 |
|
|
dnl Check for pthreads and do not define ENABLE_SMP |
31 |
|
|
dnl if not found |
32 |
|
|
|
33 |
|
|
ACX_PTHREAD( |
34 |
|
|
AC_DEFINE( ENABLE_SMP, 1, [whether to enable SMP code]) |
35 |
|
|
LIBS="$PTHREAD_LIBS $LIBS" |
36 |
|
|
CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
37 |
|
|
CC="$PTHREAD_CC" |
38 |
|
|
) |
39 |
|
|
fi |
40 |
|
|
|
41 |
nmav |
1.1 |
dnl Checks for programs. |
42 |
|
|
AM_PROG_LEX |
43 |
|
|
AC_PROG_YACC |
44 |
|
|
AC_PROG_CC |
45 |
|
|
AC_PROG_CPP |
46 |
|
|
|
47 |
|
|
dnl Checks for header files. |
48 |
|
|
AC_HEADER_DIRENT |
49 |
|
|
AC_HEADER_STDC |
50 |
|
|
AC_HEADER_SYS_WAIT |
51 |
|
|
AC_CHECK_HEADERS(fcntl.h sys/fcntl.h limits.h sys/time.h sys/select.h) |
52 |
|
|
AC_CHECK_HEADERS(getopt.h netinet/tcp.h) |
53 |
|
|
|
54 |
|
|
dnl Checks for typedefs, structures, and compiler characteristics. |
55 |
|
|
AC_C_CONST |
56 |
nmav |
1.12 |
AC_C_INLINE |
57 |
nmav |
1.1 |
AC_TYPE_UID_T |
58 |
|
|
AC_TYPE_PID_T |
59 |
|
|
AC_HEADER_TIME |
60 |
|
|
|
61 |
nmav |
1.18 |
AC_CHECK_TYPE( off_t, |
62 |
|
|
AC_DEFINE( HAVE_OFF_T, 1, [have off_t type]),, |
63 |
|
|
) |
64 |
|
|
|
65 |
nmav |
1.36 |
AC_SYS_LARGEFILE |
66 |
nmav |
1.30 |
|
67 |
nmav |
1.1 |
dnl Checks for library functions. |
68 |
|
|
AC_FUNC_SETVBUF_REVERSED |
69 |
|
|
AC_FUNC_MMAP |
70 |
nmav |
1.20 |
AC_CHECK_FUNCS(getcwd strdup strstr gmtime_r) |
71 |
nmav |
1.1 |
AC_CHECK_FUNCS(gethostname gethostbyname select socket inet_aton) |
72 |
nmav |
1.15 |
AC_CHECK_FUNCS(scandir alphasort qsort) |
73 |
nmav |
1.16 |
AC_CHECK_FUNCS(getrlimit setrlimit) |
74 |
nmav |
1.30 |
AC_CHECK_FUNCS(stat) |
75 |
nmav |
1.1 |
|
76 |
|
|
AC_CHECK_STRUCT_FOR([ |
77 |
|
|
#if TIME_WITH_SYS_TIME |
78 |
|
|
# include <sys/time.h> |
79 |
|
|
# include <time.h> |
80 |
|
|
#else |
81 |
|
|
# if HAVE_SYS_TIME_H |
82 |
|
|
# include <sys/time.h> |
83 |
|
|
# else |
84 |
|
|
# include <time.h> |
85 |
|
|
# endif |
86 |
|
|
#endif |
87 |
|
|
],tm,tm_gmtoff) |
88 |
|
|
|
89 |
nmav |
1.30 |
if test $ac_cv_struct_tm_has_tm_gmtoff = yes; then |
90 |
nmav |
1.1 |
AC_DEFINE(HAVE_TM_GMTOFF, 1, [Have tm_gmtoff]) |
91 |
|
|
fi |
92 |
|
|
|
93 |
|
|
AC_CHECK_STRUCT_FOR([ |
94 |
|
|
|
95 |
|
|
#if TIME_WITH_SYS_TIME |
96 |
|
|
# include <sys/time.h> |
97 |
|
|
# include <time.h> |
98 |
|
|
#else |
99 |
|
|
# if HAVE_SYS_TIME_H |
100 |
|
|
# include <sys/time.h> |
101 |
|
|
# else |
102 |
|
|
# include <time.h> |
103 |
|
|
# endif |
104 |
|
|
#endif |
105 |
|
|
],tm,tm_zone) |
106 |
|
|
|
107 |
|
|
if test "$ac_cv_struct_tm_has_tm_zone" = "yes"; then |
108 |
|
|
AC_DEFINE(HAVE_TM_ZONE, 1, [Have tm_zone]) |
109 |
|
|
fi |
110 |
|
|
|
111 |
|
|
AC_CHECK_STRUCT_FOR([ |
112 |
|
|
#include <sys/types.h> |
113 |
|
|
#include <netinet/in.h> |
114 |
|
|
],sockaddr_in,sin_len) |
115 |
|
|
|
116 |
|
|
if test "$ac_cv_struct_sockaddr_in_has_sin_len" = "yes"; then |
117 |
|
|
AC_DEFINE(HAVE_SIN_LEN,1, [Have sin_len]) |
118 |
|
|
fi |
119 |
|
|
|
120 |
|
|
if test $ac_cv_func_socket = no; then |
121 |
|
|
# socket is not in the default libraries. |
122 |
|
|
AC_CHECK_LIB(socket, socket, |
123 |
|
|
[ MYLIBS="$MYLIBS -lsocket" ]) |
124 |
|
|
fi |
125 |
|
|
|
126 |
|
|
if test $ac_cv_func_inet_aton = no; then |
127 |
|
|
# inet_aton is not in the default libraries. |
128 |
|
|
AC_CHECK_LIB(resolv, inet_aton, MYLIBS="$MYLIBS -lresolv") |
129 |
|
|
fi |
130 |
|
|
|
131 |
|
|
if test $ac_cv_func_gethostname = no; then |
132 |
|
|
AC_CHECK_LIB(nsl, gethostname, MYLIBS="$MYLIBS -lnsl") |
133 |
|
|
fi |
134 |
|
|
|
135 |
|
|
dnl May end up with duplicate -lnsl -- oh well |
136 |
|
|
if test $ac_cv_func_gethostbyname = no; then |
137 |
|
|
AC_CHECK_LIB(nsl, gethostbyname, MYLIBS="$MYLIBS -lnsl") |
138 |
|
|
fi |
139 |
|
|
|
140 |
|
|
LIBS="$LIBS $MYLIBS" |
141 |
|
|
|
142 |
|
|
# Try to find TCP_CORK and use it if found. |
143 |
|
|
AC_MSG_CHECKING([whether TCP_CORK is a valid TCP socket option]) |
144 |
|
|
AC_TRY_COMPILE( |
145 |
|
|
#include <sys/socket.h> |
146 |
|
|
#include <netinet/tcp.h> |
147 |
|
|
#include <netinet/in.h> |
148 |
|
|
,[ |
149 |
|
|
int one = 1, fd; |
150 |
|
|
if (setsockopt(fd, IPPROTO_TCP, TCP_CORK, |
151 |
|
|
(void *) &one, sizeof (one)) == -1) |
152 |
|
|
return -1; |
153 |
|
|
return 0; |
154 |
|
|
|
155 |
|
|
], |
156 |
|
|
dnl *** FOUND |
157 |
|
|
AC_DEFINE( HAVE_TCP_CORK, 1, [TCP_CORK was found and will be used]) |
158 |
|
|
AC_MSG_RESULT(yes), |
159 |
|
|
dnl *** NOT FOUND |
160 |
|
|
AC_MSG_RESULT(no) |
161 |
|
|
) |
162 |
|
|
|
163 |
nmav |
1.27 |
use_sendfile=yes |
164 |
nmav |
1.28 |
AC_MSG_CHECKING([whether to enable sendfile(2) usage]) |
165 |
nmav |
1.27 |
AC_ARG_ENABLE(sendfile, |
166 |
|
|
[ --disable-sendfile disable the use of the sendfile(2) system call], |
167 |
|
|
[ |
168 |
|
|
if test "$enableval" = "no" ; then |
169 |
|
|
use_sendfile=no |
170 |
|
|
else |
171 |
|
|
use_sendfile=yes |
172 |
|
|
fi |
173 |
|
|
] |
174 |
|
|
) |
175 |
|
|
|
176 |
nmav |
1.30 |
AC_MSG_RESULT($use_sendfile) |
177 |
|
|
|
178 |
nmav |
1.27 |
if test "$use_sendfile" = "yes"; then |
179 |
|
|
case $host_os in |
180 |
|
|
*linux*) |
181 |
|
|
AC_CHECK_HEADERS(sys/sendfile.h) |
182 |
|
|
AC_CHECK_FUNCS(sendfile) |
183 |
|
|
AC_DEFINE(HAVE_SENDFILE, 1, [whether to use sendfile]) |
184 |
|
|
AC_DEFINE(HAVE_LINUXSENDFILE, 1, [whether to use Linux' sendfile]) |
185 |
|
|
;; |
186 |
|
|
*freebsd*) |
187 |
|
|
AC_CHECK_HEADERS(sys/sendfile.h) |
188 |
|
|
AC_CHECK_FUNCS(sendfile) |
189 |
|
|
AC_DEFINE(HAVE_BSDSENDFILE, 1, [whether to use FreeBSD's sendfile]) |
190 |
|
|
AC_DEFINE(HAVE_SENDFILE, 1, [whether to use sendfile]) |
191 |
|
|
;; |
192 |
|
|
*) ;; |
193 |
|
|
esac |
194 |
|
|
fi |
195 |
|
|
|
196 |
nmav |
1.1 |
use_ssl=yes |
197 |
|
|
|
198 |
|
|
AC_MSG_CHECKING(whether to include SSL and TLS support) |
199 |
|
|
AC_ARG_ENABLE(ssl, [ --disable-ssl Do not include SSL and TLS support], |
200 |
|
|
[ |
201 |
|
|
if test "$enableval" = "yes" ; then |
202 |
|
|
use_ssl=yes |
203 |
|
|
else |
204 |
|
|
use_ssl=no |
205 |
|
|
fi |
206 |
|
|
] |
207 |
|
|
) |
208 |
|
|
|
209 |
|
|
AC_MSG_RESULT($use_ssl) |
210 |
|
|
|
211 |
|
|
if test "$use_ssl" = "yes"; then |
212 |
nmav |
1.38 |
AM_PATH_LIBGNUTLS( 1.0.9, |
213 |
nmav |
1.11 |
AC_DEFINE(HAVE_LIBGNUTLS, 1, [Have libgnutls]) |
214 |
nmav |
1.10 |
LIBS="$LIBS $LIBGNUTLS_LIBS" |
215 |
|
|
CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS" |
216 |
|
|
AC_DEFINE( ENABLE_SSL, 1, [whether to enable ssl]), |
217 |
nmav |
1.11 |
AC_MSG_WARN([[ |
218 |
nmav |
1.1 |
*** |
219 |
|
|
*** libgnutls was not found. You may want to get it from |
220 |
|
|
*** ftp://ftp.gnutls.org/pub/gnutls/ |
221 |
|
|
]])) |
222 |
|
|
|
223 |
|
|
fi |
224 |
|
|
|
225 |
nmav |
1.6 |
|
226 |
nmav |
1.7 |
if test "$use_smp" = "yes"; then use_hic=yes |
227 |
|
|
else use_hic = no |
228 |
|
|
fi |
229 |
nmav |
1.6 |
|
230 |
nmav |
1.31 |
AC_CHECK_FUNC( fnmatch, |
231 |
|
|
AC_DEFINE( ENABLE_ACCESS_LISTS, 1, [whether to enable file access control lists]) , |
232 |
|
|
AC_MSG_WARN([[ |
233 |
|
|
*** |
234 |
|
|
*** fnmatch() is not available in your system. File access control lists |
235 |
|
|
*** will not be available. |
236 |
|
|
]]) |
237 |
|
|
) |
238 |
nmav |
1.1 |
|
239 |
|
|
if test -n "$GCC"; then |
240 |
|
|
dnl if we are running gcc, use -pipe |
241 |
|
|
test -n "$GCC" && CFLAGS="$CFLAGS -pipe" |
242 |
|
|
|
243 |
|
|
AC_MSG_CHECKING(compile and link profiling code) |
244 |
|
|
AC_ARG_ENABLE(profiling, |
245 |
|
|
[ --enable-profiling Compile and link profiling code], |
246 |
|
|
[ |
247 |
|
|
if test "$enableval" = "yes" ; then |
248 |
|
|
AC_MSG_RESULT(yes) |
249 |
nmav |
1.21 |
AC_CHECK_PROG(FC_OK, fc-config, yes, no) |
250 |
|
|
if test x$FC_OK = xyes; then |
251 |
|
|
CFLAGS="${CFLAGS} `fc-config --cflags`" |
252 |
|
|
LIBS="$LIBS `fc-config --libs`" |
253 |
|
|
else |
254 |
|
|
AC_MSG_WARN(*** |
255 |
|
|
*** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html |
256 |
|
|
) |
257 |
|
|
fi |
258 |
nmav |
1.30 |
|
259 |
nmav |
1.1 |
else |
260 |
|
|
AC_MSG_RESULT(no) |
261 |
|
|
fi |
262 |
|
|
], |
263 |
|
|
[ |
264 |
|
|
AC_MSG_RESULT(no) |
265 |
|
|
]) |
266 |
|
|
fi |
267 |
|
|
|
268 |
|
|
AC_MSG_CHECKING(whether to compile and link debugging code) |
269 |
|
|
AC_ARG_ENABLE(debug, |
270 |
|
|
[ --disable-debug Compile and link debugging code], |
271 |
|
|
[ |
272 |
|
|
if test "$enableval" = "yes" ; then |
273 |
|
|
AC_MSG_RESULT(yes) |
274 |
|
|
LDFLAGS="$LDFLAGS -g" |
275 |
|
|
test -n "$GCC" && CFLAGS="$CFLAGS -Wall" |
276 |
|
|
else |
277 |
|
|
AC_MSG_RESULT(no) |
278 |
|
|
fi |
279 |
|
|
], |
280 |
|
|
[ |
281 |
|
|
AC_MSG_RESULT(yes) |
282 |
|
|
LDFLAGS="$LDFLAGS -g" |
283 |
|
|
test -n "$GCC" && CFLAGS="$CFLAGS -Wall" |
284 |
|
|
]) |
285 |
|
|
|
286 |
|
|
AC_MSG_CHECKING(whether to link with the Dmalloc memory debugger/profiler) |
287 |
|
|
AC_ARG_WITH(dmalloc, |
288 |
|
|
[ --with-dmalloc link with the Dmalloc memory debugger/profiler], |
289 |
|
|
[ |
290 |
|
|
if test "$withval" = "yes"; then |
291 |
|
|
AC_MSG_RESULT(trying) |
292 |
|
|
AC_CHECK_LIB(dmalloc, dmalloc_shutdown) |
293 |
|
|
else |
294 |
|
|
AC_MSG_RESULT(no) |
295 |
|
|
fi |
296 |
|
|
], |
297 |
|
|
[ |
298 |
|
|
AC_MSG_RESULT(no) |
299 |
|
|
]) |
300 |
|
|
|
301 |
|
|
AC_MSG_CHECKING(whether to link with the Electric Fence memory debugger) |
302 |
|
|
AC_ARG_WITH(efence, |
303 |
|
|
[ --with-efence link with the Electric Fence memory debugger ], |
304 |
|
|
[ |
305 |
|
|
if test "$withval" = "yes"; then |
306 |
|
|
AC_MSG_RESULT(trying) |
307 |
|
|
AC_CHECK_LIB(efence, main) |
308 |
|
|
else |
309 |
|
|
AC_MSG_RESULT(no) |
310 |
|
|
fi |
311 |
|
|
], |
312 |
|
|
[ |
313 |
|
|
AC_MSG_RESULT(no) |
314 |
|
|
]) |
315 |
nmav |
1.25 |
|
316 |
|
|
|
317 |
|
|
POLL_OR_SELECT |
318 |
|
|
|
319 |
|
|
if test "$BOA_ASYNC_IO" = "poll"; then |
320 |
|
|
AC_DEFINE( USE_POLL, 1, [whether to use poll]) |
321 |
|
|
fi |
322 |
|
|
|
323 |
|
|
# there are three scenarios |
324 |
|
|
# GNU make is installed as "make" |
325 |
|
|
# GNU make is installed as something else we detected |
326 |
|
|
# GNU make is not installed |
327 |
|
|
# Unfortunately, we can't deal with it one way or the other |
328 |
|
|
# Trying multiple AC_OUTPUT confuses autoconf, and using variables |
329 |
|
|
# *in* AC_OUTPUT is even worse. |
330 |
|
|
# *so*, make a default makefile that just forces make to call gmake |
331 |
|
|
# or whatever. |
332 |
nmav |
1.1 |
|
333 |
nmav |
1.35 |
AC_CONFIG_FILES([Makefile src/Makefile contrib/Makefile contrib/redhat/Makefile examples/Makefile docs/Makefile]) |
334 |
nmav |
1.3 |
|
335 |
|
|
AC_OUTPUT |
336 |
nmav |
1.4 |
|
337 |
|
|
echo "**********************************************************" |
338 |
|
|
echo "" |
339 |
|
|
echo "An example configuration file for hydra can be found at" |
340 |
|
|
echo "examples/hydra.conf." |
341 |
|
|
echo "" |
342 |
|
|
echo "**********************************************************" |