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