1 |
dnl $Id: configure.in,v 1.13 2002/09/30 18:34:40 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 |
SERVER_VERSION="0.0.5" |
8 |
AC_DEFINE_UNQUOTED(SERVER_VERSION, "$SERVER_VERSION", [Version of Hydra]) |
9 |
AC_DEFINE_UNQUOTED(SERVER_NAME, "Hydra", [Name of the server]) |
10 |
|
11 |
AM_INIT_AUTOMAKE(hydra, $SERVER_VERSION, [nothing here]) |
12 |
|
13 |
dnl Make config.h |
14 |
AM_CONFIG_HEADER(config.h) |
15 |
|
16 |
AM_MAINTAINER_MODE |
17 |
|
18 |
dnl Checks for programs. |
19 |
AM_PROG_LEX |
20 |
AC_PROG_YACC |
21 |
AC_PROG_CC |
22 |
AC_PROG_CPP |
23 |
|
24 |
dnl Checks for header files. |
25 |
AC_HEADER_DIRENT |
26 |
AC_HEADER_STDC |
27 |
AC_HEADER_SYS_WAIT |
28 |
AC_CHECK_HEADERS(fcntl.h sys/fcntl.h limits.h sys/time.h sys/select.h) |
29 |
AC_CHECK_HEADERS(getopt.h netinet/tcp.h) |
30 |
|
31 |
dnl Checks for typedefs, structures, and compiler characteristics. |
32 |
AC_C_CONST |
33 |
AC_C_INLINE |
34 |
AC_TYPE_UID_T |
35 |
AC_TYPE_PID_T |
36 |
AC_HEADER_TIME |
37 |
|
38 |
dnl Checks for library functions. |
39 |
AC_FUNC_SETVBUF_REVERSED |
40 |
AC_FUNC_MMAP |
41 |
AC_CHECK_FUNCS(getcwd strdup strstr) |
42 |
AC_CHECK_FUNCS(gethostname gethostbyname select socket inet_aton) |
43 |
AC_CHECK_FUNCS(scandir alphasort) |
44 |
|
45 |
AC_CHECK_STRUCT_FOR([ |
46 |
#if TIME_WITH_SYS_TIME |
47 |
# include <sys/time.h> |
48 |
# include <time.h> |
49 |
#else |
50 |
# if HAVE_SYS_TIME_H |
51 |
# include <sys/time.h> |
52 |
# else |
53 |
# include <time.h> |
54 |
# endif |
55 |
#endif |
56 |
],tm,tm_gmtoff) |
57 |
|
58 |
if test "$ac_cv_struct_tm_has_tm_gmtoff" = "yes"; then |
59 |
AC_DEFINE(HAVE_TM_GMTOFF, 1, [Have tm_gmtoff]) |
60 |
fi |
61 |
|
62 |
AC_CHECK_STRUCT_FOR([ |
63 |
|
64 |
#if TIME_WITH_SYS_TIME |
65 |
# include <sys/time.h> |
66 |
# include <time.h> |
67 |
#else |
68 |
# if HAVE_SYS_TIME_H |
69 |
# include <sys/time.h> |
70 |
# else |
71 |
# include <time.h> |
72 |
# endif |
73 |
#endif |
74 |
],tm,tm_zone) |
75 |
|
76 |
if test "$ac_cv_struct_tm_has_tm_zone" = "yes"; then |
77 |
AC_DEFINE(HAVE_TM_ZONE, 1, [Have tm_zone]) |
78 |
fi |
79 |
|
80 |
AC_CHECK_STRUCT_FOR([ |
81 |
#include <sys/types.h> |
82 |
#include <netinet/in.h> |
83 |
],sockaddr_in,sin_len) |
84 |
|
85 |
if test "$ac_cv_struct_sockaddr_in_has_sin_len" = "yes"; then |
86 |
AC_DEFINE(HAVE_SIN_LEN,1, [Have sin_len]) |
87 |
fi |
88 |
|
89 |
if test $ac_cv_func_socket = no; then |
90 |
# socket is not in the default libraries. |
91 |
AC_CHECK_LIB(socket, socket, |
92 |
[ MYLIBS="$MYLIBS -lsocket" ]) |
93 |
fi |
94 |
|
95 |
if test $ac_cv_func_inet_aton = no; then |
96 |
# inet_aton is not in the default libraries. |
97 |
AC_CHECK_LIB(resolv, inet_aton, MYLIBS="$MYLIBS -lresolv") |
98 |
fi |
99 |
|
100 |
if test $ac_cv_func_gethostname = no; then |
101 |
AC_CHECK_LIB(nsl, gethostname, MYLIBS="$MYLIBS -lnsl") |
102 |
fi |
103 |
|
104 |
dnl May end up with duplicate -lnsl -- oh well |
105 |
if test $ac_cv_func_gethostbyname = no; then |
106 |
AC_CHECK_LIB(nsl, gethostbyname, MYLIBS="$MYLIBS -lnsl") |
107 |
fi |
108 |
|
109 |
LIBS="$LIBS $MYLIBS" |
110 |
|
111 |
if test $ac_cv_func_scandir = no; then |
112 |
# scandir not defined, add it |
113 |
SCANDIR="scandir.o" |
114 |
fi |
115 |
|
116 |
if test $ac_cv_func_alphasort = no; then |
117 |
# alphasort not defined, add it |
118 |
ALPHASORT="alphasort.o" |
119 |
fi |
120 |
|
121 |
# Try to find TCP_CORK and use it if found. |
122 |
AC_MSG_CHECKING([whether TCP_CORK is a valid TCP socket option]) |
123 |
AC_TRY_COMPILE( |
124 |
#include <sys/socket.h> |
125 |
#include <netinet/tcp.h> |
126 |
#include <netinet/in.h> |
127 |
,[ |
128 |
int one = 1, fd; |
129 |
if (setsockopt(fd, IPPROTO_TCP, TCP_CORK, |
130 |
(void *) &one, sizeof (one)) == -1) |
131 |
return -1; |
132 |
return 0; |
133 |
|
134 |
], |
135 |
dnl *** FOUND |
136 |
AC_DEFINE( HAVE_TCP_CORK, 1, [TCP_CORK was found and will be used]) |
137 |
AC_MSG_RESULT(yes), |
138 |
dnl *** NOT FOUND |
139 |
AC_MSG_RESULT(no) |
140 |
) |
141 |
|
142 |
use_ssl=yes |
143 |
|
144 |
AC_MSG_CHECKING(whether to include SSL and TLS support) |
145 |
AC_ARG_ENABLE(ssl, [ --disable-ssl Do not include SSL and TLS support], |
146 |
[ |
147 |
if test "$enableval" = "yes" ; then |
148 |
use_ssl=yes |
149 |
else |
150 |
use_ssl=no |
151 |
fi |
152 |
] |
153 |
) |
154 |
|
155 |
AC_MSG_RESULT($use_ssl) |
156 |
|
157 |
if test "$use_ssl" = "yes"; then |
158 |
AM_PATH_LIBGNUTLS( 0.5.8, |
159 |
AC_DEFINE(HAVE_LIBGNUTLS, 1, [Have libgnutls]) |
160 |
LIBS="$LIBS $LIBGNUTLS_LIBS" |
161 |
CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS" |
162 |
AC_DEFINE( ENABLE_SSL, 1, [whether to enable ssl]), |
163 |
AC_MSG_WARN([[ |
164 |
*** |
165 |
*** libgnutls was not found. You may want to get it from |
166 |
*** ftp://ftp.gnutls.org/pub/gnutls/ |
167 |
]])) |
168 |
|
169 |
fi |
170 |
|
171 |
use_smp=yes |
172 |
|
173 |
AC_MSG_CHECKING(whether to include SMP support) |
174 |
AC_ARG_ENABLE(smp, [ --disable-smp Do not include SMP support], |
175 |
[ |
176 |
if test "$enableval" = "yes" ; then |
177 |
use_smp=yes |
178 |
else |
179 |
use_smp=no |
180 |
fi |
181 |
] |
182 |
) |
183 |
|
184 |
AC_MSG_RESULT($use_smp) |
185 |
|
186 |
if test "$use_smp" = "yes"; then |
187 |
AC_CHECK_LIB( pthread, pthread_create, [ |
188 |
AC_DEFINE( ENABLE_SMP, 1, [whether to enable SMP code]) |
189 |
LIBS="-lpthread $LIBS" |
190 |
]) |
191 |
CFLAGS="$CFLAGS -D_REENTRANT" |
192 |
fi |
193 |
|
194 |
if test "$use_smp" = "yes"; then use_hic=yes |
195 |
else use_hic = no |
196 |
fi |
197 |
|
198 |
AC_MSG_CHECKING(whether to include HIC (internally handled CGIs) support) |
199 |
AC_ARG_ENABLE(hic, [ --disable-hic Do not include HIC support], |
200 |
[ |
201 |
if test "$enableval" = "yes" ; then |
202 |
if test "$use_smp" = "yes"; then use_hic=yes |
203 |
else use_hic = no |
204 |
fi |
205 |
else |
206 |
use_hic=no |
207 |
fi |
208 |
] |
209 |
) |
210 |
|
211 |
AC_MSG_RESULT($use_hic) |
212 |
|
213 |
if test "$use_hic" = "yes"; then |
214 |
AC_CHECK_LIB(dl, dlopen, |
215 |
LIBS="$LIBS -ldl" |
216 |
AC_DEFINE( ENABLE_HIC, 1, [whether to use HIC code]) |
217 |
) |
218 |
fi |
219 |
|
220 |
|
221 |
if test $ac_cv_func_strdup = no -o $ac_cv_func_strstr = no; then |
222 |
# strdup or strstr not defined |
223 |
STRUTIL="strutil.o" |
224 |
fi |
225 |
|
226 |
if test -n "$GCC"; then |
227 |
dnl if we are running gcc, use -pipe |
228 |
test -n "$GCC" && CFLAGS="$CFLAGS -pipe" |
229 |
|
230 |
AC_MSG_CHECKING(compile and link profiling code) |
231 |
AC_ARG_ENABLE(profiling, |
232 |
[ --enable-profiling Compile and link profiling code], |
233 |
[ |
234 |
if test "$enableval" = "yes" ; then |
235 |
AC_MSG_RESULT(yes) |
236 |
CFLAGS="$CFLAGS -pg -fprofile-arcs" |
237 |
else |
238 |
AC_MSG_RESULT(no) |
239 |
fi |
240 |
], |
241 |
[ |
242 |
AC_MSG_RESULT(no) |
243 |
]) |
244 |
fi |
245 |
|
246 |
AC_MSG_CHECKING(whether to compile and link debugging code) |
247 |
AC_ARG_ENABLE(debug, |
248 |
[ --disable-debug Compile and link debugging code], |
249 |
[ |
250 |
if test "$enableval" = "yes" ; then |
251 |
AC_MSG_RESULT(yes) |
252 |
LDFLAGS="$LDFLAGS -g" |
253 |
test -n "$GCC" && CFLAGS="$CFLAGS -Wall" |
254 |
else |
255 |
AC_MSG_RESULT(no) |
256 |
fi |
257 |
], |
258 |
[ |
259 |
AC_MSG_RESULT(yes) |
260 |
LDFLAGS="$LDFLAGS -g" |
261 |
test -n "$GCC" && CFLAGS="$CFLAGS -Wall" |
262 |
]) |
263 |
|
264 |
AC_MSG_CHECKING(whether to link with the Dmalloc memory debugger/profiler) |
265 |
AC_ARG_WITH(dmalloc, |
266 |
[ --with-dmalloc link with the Dmalloc memory debugger/profiler], |
267 |
[ |
268 |
if test "$withval" = "yes"; then |
269 |
AC_MSG_RESULT(trying) |
270 |
AC_CHECK_LIB(dmalloc, dmalloc_shutdown) |
271 |
else |
272 |
AC_MSG_RESULT(no) |
273 |
fi |
274 |
], |
275 |
[ |
276 |
AC_MSG_RESULT(no) |
277 |
]) |
278 |
|
279 |
AC_MSG_CHECKING(whether to link with the Electric Fence memory debugger) |
280 |
AC_ARG_WITH(efence, |
281 |
[ --with-efence link with the Electric Fence memory debugger ], |
282 |
[ |
283 |
if test "$withval" = "yes"; then |
284 |
AC_MSG_RESULT(trying) |
285 |
AC_CHECK_LIB(efence, main) |
286 |
else |
287 |
AC_MSG_RESULT(no) |
288 |
fi |
289 |
], |
290 |
[ |
291 |
AC_MSG_RESULT(no) |
292 |
]) |
293 |
|
294 |
dnl For anything that wasn't found but we have source for |
295 |
AC_SUBST(STRUTIL) |
296 |
AC_SUBST(ALPHASORT) |
297 |
AC_SUBST(SCANDIR) |
298 |
|
299 |
AC_CONFIG_FILES([Makefile src/Makefile extras/Makefile contrib/Makefile examples/Makefile docs/Makefile]) |
300 |
|
301 |
AC_OUTPUT |
302 |
|
303 |
echo "**********************************************************" |
304 |
echo "" |
305 |
echo "An example configuration file for hydra can be found at" |
306 |
echo "examples/hydra.conf." |
307 |
echo "" |
308 |
echo "**********************************************************" |