/[hydra]/hydra/configure.in
ViewVC logotype

Contents of /hydra/configure.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.27 - (show annotations)
Mon Oct 21 19:47:04 2002 UTC (21 years, 5 months ago) by nmav
Branch: MAIN
Changes since 1.26: +32 -29 lines
fixes in the sendfile detection

1 dnl $Id: configure.in,v 1.25 2002/10/21 18:46:25 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.0.8"
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 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 AC_C_INLINE
36 AC_TYPE_UID_T
37 AC_TYPE_PID_T
38 AC_HEADER_TIME
39
40 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 dnl Checks for library functions.
51 AC_FUNC_SETVBUF_REVERSED
52 AC_FUNC_MMAP
53 AC_CHECK_FUNCS(getcwd strdup strstr gmtime_r)
54 AC_CHECK_FUNCS(gethostname gethostbyname select socket inet_aton)
55 AC_CHECK_FUNCS(scandir alphasort qsort)
56 AC_CHECK_FUNCS(getrlimit setrlimit)
57 AC_CHECK_FUNCS(stat stat64 atoll,,)
58 AC_CHECK_FUNCS(open64 read64 write64 lseek64,,)
59
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 use_sendfile=yes
148 AC_ARG_ENABLE(sendfile,
149 [ --disable-sendfile disable the use of the sendfile(2) system call],
150 [
151 if test "$enableval" = "no" ; then
152 use_sendfile=no
153 AC_MSG_RESULT(no)
154 else
155 use_sendfile=yes
156 AC_MSG_RESULT(yes)
157 fi
158 ]
159 )
160
161 if test "$use_sendfile" = "yes"; then
162 case $host_os in
163 *linux*)
164 AC_CHECK_HEADERS(sys/sendfile.h)
165 AC_CHECK_FUNCS(sendfile)
166 AC_DEFINE(HAVE_SENDFILE, 1, [whether to use sendfile])
167 AC_DEFINE(HAVE_LINUXSENDFILE, 1, [whether to use Linux' sendfile])
168 ;;
169 *freebsd*)
170 AC_CHECK_HEADERS(sys/sendfile.h)
171 AC_CHECK_FUNCS(sendfile)
172 AC_DEFINE(HAVE_BSDSENDFILE, 1, [whether to use FreeBSD's sendfile])
173 AC_DEFINE(HAVE_SENDFILE, 1, [whether to use sendfile])
174 ;;
175 *) ;;
176 esac
177 fi
178
179 use_ssl=yes
180
181 AC_MSG_CHECKING(whether to include SSL and TLS support)
182 AC_ARG_ENABLE(ssl, [ --disable-ssl Do not include SSL and TLS support],
183 [
184 if test "$enableval" = "yes" ; then
185 use_ssl=yes
186 else
187 use_ssl=no
188 fi
189 ]
190 )
191
192 AC_MSG_RESULT($use_ssl)
193
194 if test "$use_ssl" = "yes"; then
195 AM_PATH_LIBGNUTLS( 0.5.9,
196 AC_DEFINE(HAVE_LIBGNUTLS, 1, [Have libgnutls])
197 LIBS="$LIBS $LIBGNUTLS_LIBS"
198 CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"
199 AC_DEFINE( ENABLE_SSL, 1, [whether to enable ssl]),
200 AC_MSG_WARN([[
201 ***
202 *** libgnutls was not found. You may want to get it from
203 *** ftp://ftp.gnutls.org/pub/gnutls/
204 ]]))
205
206 fi
207
208 use_smp=yes
209
210 AC_MSG_CHECKING(whether to include SMP support)
211 AC_ARG_ENABLE(smp, [ --disable-smp Do not include SMP support],
212 [
213 if test "$enableval" = "yes" ; then
214 use_smp=yes
215 else
216 use_smp=no
217 fi
218 ]
219 )
220
221 AC_MSG_RESULT($use_smp)
222
223 if test "$use_smp" = "yes"; then
224 AC_DEFINE( ENABLE_SMP, 1, [whether to enable SMP code])
225 if test -n "$GCC"; then
226 CFLAGS="$CFLAGS -pthread"
227 AC_DEFINE( ENABLE_SMP, 1, [whether to enable SMP code])
228 CFLAGS="$CFLAGS -D_REENTRANT"
229 else
230 AC_CHECK_LIB( pthread, pthread_create, [
231 LIBS="-lpthread $LIBS"
232 AC_DEFINE( ENABLE_SMP, 1, [whether to enable SMP code])
233 CFLAGS="$CFLAGS -D_REENTRANT"
234 ])
235 fi
236 fi
237
238 if test "$use_smp" = "yes"; then use_hic=yes
239 else use_hic = no
240 fi
241
242 AC_MSG_CHECKING(whether to include HIC (internally handled CGIs) support)
243 AC_ARG_ENABLE(hic, [ --disable-hic Do not include HIC support],
244 [
245 if test "$enableval" = "yes" ; then
246 if test "$use_smp" = "yes"; then use_hic=yes
247 else use_hic = no
248 fi
249 else
250 use_hic=no
251 fi
252 ]
253 )
254
255 AC_MSG_RESULT($use_hic)
256
257 if test "$use_hic" = "yes"; then
258 AC_CHECK_LIB(dl, dlopen,
259 LIBS="$LIBS -ldl"
260 AC_DEFINE( ENABLE_HIC, 1, [whether to use HIC code])
261 )
262 fi
263
264
265 if test -n "$GCC"; then
266 dnl if we are running gcc, use -pipe
267 test -n "$GCC" && CFLAGS="$CFLAGS -pipe"
268
269 AC_MSG_CHECKING(compile and link profiling code)
270 AC_ARG_ENABLE(profiling,
271 [ --enable-profiling Compile and link profiling code],
272 [
273 if test "$enableval" = "yes" ; then
274 AC_MSG_RESULT(yes)
275 AC_CHECK_PROG(FC_OK, fc-config, yes, no)
276 if test x$FC_OK = xyes; then
277 CFLAGS="${CFLAGS} `fc-config --cflags`"
278 LIBS="$LIBS `fc-config --libs`"
279 else
280 AC_MSG_WARN(***
281 *** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html
282 )
283 fi
284 else
285 AC_MSG_RESULT(no)
286 fi
287 ],
288 [
289 AC_MSG_RESULT(no)
290 ])
291 fi
292
293 AC_MSG_CHECKING(whether to compile and link debugging code)
294 AC_ARG_ENABLE(debug,
295 [ --disable-debug Compile and link debugging code],
296 [
297 if test "$enableval" = "yes" ; then
298 AC_MSG_RESULT(yes)
299 LDFLAGS="$LDFLAGS -g"
300 test -n "$GCC" && CFLAGS="$CFLAGS -Wall"
301 else
302 AC_MSG_RESULT(no)
303 fi
304 ],
305 [
306 AC_MSG_RESULT(yes)
307 LDFLAGS="$LDFLAGS -g"
308 test -n "$GCC" && CFLAGS="$CFLAGS -Wall"
309 ])
310
311 AC_MSG_CHECKING(whether to link with the Dmalloc memory debugger/profiler)
312 AC_ARG_WITH(dmalloc,
313 [ --with-dmalloc link with the Dmalloc memory debugger/profiler],
314 [
315 if test "$withval" = "yes"; then
316 AC_MSG_RESULT(trying)
317 AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
318 else
319 AC_MSG_RESULT(no)
320 fi
321 ],
322 [
323 AC_MSG_RESULT(no)
324 ])
325
326 AC_MSG_CHECKING(whether to link with the Electric Fence memory debugger)
327 AC_ARG_WITH(efence,
328 [ --with-efence link with the Electric Fence memory debugger ],
329 [
330 if test "$withval" = "yes"; then
331 AC_MSG_RESULT(trying)
332 AC_CHECK_LIB(efence, main)
333 else
334 AC_MSG_RESULT(no)
335 fi
336 ],
337 [
338 AC_MSG_RESULT(no)
339 ])
340
341
342 POLL_OR_SELECT
343
344 if test "$BOA_ASYNC_IO" = "poll"; then
345 AC_DEFINE( USE_POLL, 1, [whether to use poll])
346 fi
347
348 # there are three scenarios
349 # GNU make is installed as "make"
350 # GNU make is installed as something else we detected
351 # GNU make is not installed
352 # Unfortunately, we can't deal with it one way or the other
353 # Trying multiple AC_OUTPUT confuses autoconf, and using variables
354 # *in* AC_OUTPUT is even worse.
355 # *so*, make a default makefile that just forces make to call gmake
356 # or whatever.
357
358 AC_CONFIG_FILES([Makefile src/Makefile contrib/Makefile examples/Makefile docs/Makefile])
359
360 AC_OUTPUT
361
362 echo "**********************************************************"
363 echo ""
364 echo "An example configuration file for hydra can be found at"
365 echo "examples/hydra.conf."
366 echo ""
367 echo "**********************************************************"

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26