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