1 |
dnl $Id: configure.in,v 1.16 2002/10/02 19:26:15 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.6" |
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 qsort) |
44 |
AC_CHECK_FUNCS(getrlimit setrlimit) |
45 |
|
46 |
AC_CHECK_STRUCT_FOR([ |
47 |
#if TIME_WITH_SYS_TIME |
48 |
# include <sys/time.h> |
49 |
# include <time.h> |
50 |
#else |
51 |
# if HAVE_SYS_TIME_H |
52 |
# include <sys/time.h> |
53 |
# else |
54 |
# include <time.h> |
55 |
# endif |
56 |
#endif |
57 |
],tm,tm_gmtoff) |
58 |
|
59 |
if test "$ac_cv_struct_tm_has_tm_gmtoff" = "yes"; then |
60 |
AC_DEFINE(HAVE_TM_GMTOFF, 1, [Have tm_gmtoff]) |
61 |
fi |
62 |
|
63 |
AC_CHECK_STRUCT_FOR([ |
64 |
|
65 |
#if TIME_WITH_SYS_TIME |
66 |
# include <sys/time.h> |
67 |
# include <time.h> |
68 |
#else |
69 |
# if HAVE_SYS_TIME_H |
70 |
# include <sys/time.h> |
71 |
# else |
72 |
# include <time.h> |
73 |
# endif |
74 |
#endif |
75 |
],tm,tm_zone) |
76 |
|
77 |
if test "$ac_cv_struct_tm_has_tm_zone" = "yes"; then |
78 |
AC_DEFINE(HAVE_TM_ZONE, 1, [Have tm_zone]) |
79 |
fi |
80 |
|
81 |
AC_CHECK_STRUCT_FOR([ |
82 |
#include <sys/types.h> |
83 |
#include <netinet/in.h> |
84 |
],sockaddr_in,sin_len) |
85 |
|
86 |
if test "$ac_cv_struct_sockaddr_in_has_sin_len" = "yes"; then |
87 |
AC_DEFINE(HAVE_SIN_LEN,1, [Have sin_len]) |
88 |
fi |
89 |
|
90 |
if test $ac_cv_func_socket = no; then |
91 |
# socket is not in the default libraries. |
92 |
AC_CHECK_LIB(socket, socket, |
93 |
[ MYLIBS="$MYLIBS -lsocket" ]) |
94 |
fi |
95 |
|
96 |
if test $ac_cv_func_inet_aton = no; then |
97 |
# inet_aton is not in the default libraries. |
98 |
AC_CHECK_LIB(resolv, inet_aton, MYLIBS="$MYLIBS -lresolv") |
99 |
fi |
100 |
|
101 |
if test $ac_cv_func_gethostname = no; then |
102 |
AC_CHECK_LIB(nsl, gethostname, MYLIBS="$MYLIBS -lnsl") |
103 |
fi |
104 |
|
105 |
dnl May end up with duplicate -lnsl -- oh well |
106 |
if test $ac_cv_func_gethostbyname = no; then |
107 |
AC_CHECK_LIB(nsl, gethostbyname, MYLIBS="$MYLIBS -lnsl") |
108 |
fi |
109 |
|
110 |
LIBS="$LIBS $MYLIBS" |
111 |
|
112 |
# Try to find TCP_CORK and use it if found. |
113 |
AC_MSG_CHECKING([whether TCP_CORK is a valid TCP socket option]) |
114 |
AC_TRY_COMPILE( |
115 |
#include <sys/socket.h> |
116 |
#include <netinet/tcp.h> |
117 |
#include <netinet/in.h> |
118 |
,[ |
119 |
int one = 1, fd; |
120 |
if (setsockopt(fd, IPPROTO_TCP, TCP_CORK, |
121 |
(void *) &one, sizeof (one)) == -1) |
122 |
return -1; |
123 |
return 0; |
124 |
|
125 |
], |
126 |
dnl *** FOUND |
127 |
AC_DEFINE( HAVE_TCP_CORK, 1, [TCP_CORK was found and will be used]) |
128 |
AC_MSG_RESULT(yes), |
129 |
dnl *** NOT FOUND |
130 |
AC_MSG_RESULT(no) |
131 |
) |
132 |
|
133 |
use_ssl=yes |
134 |
|
135 |
AC_MSG_CHECKING(whether to include SSL and TLS support) |
136 |
AC_ARG_ENABLE(ssl, [ --disable-ssl Do not include SSL and TLS support], |
137 |
[ |
138 |
if test "$enableval" = "yes" ; then |
139 |
use_ssl=yes |
140 |
else |
141 |
use_ssl=no |
142 |
fi |
143 |
] |
144 |
) |
145 |
|
146 |
AC_MSG_RESULT($use_ssl) |
147 |
|
148 |
if test "$use_ssl" = "yes"; then |
149 |
AM_PATH_LIBGNUTLS( 0.5.8, |
150 |
AC_DEFINE(HAVE_LIBGNUTLS, 1, [Have libgnutls]) |
151 |
LIBS="$LIBS $LIBGNUTLS_LIBS" |
152 |
CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS" |
153 |
AC_DEFINE( ENABLE_SSL, 1, [whether to enable ssl]), |
154 |
AC_MSG_WARN([[ |
155 |
*** |
156 |
*** libgnutls was not found. You may want to get it from |
157 |
*** ftp://ftp.gnutls.org/pub/gnutls/ |
158 |
]])) |
159 |
|
160 |
fi |
161 |
|
162 |
use_smp=yes |
163 |
|
164 |
AC_MSG_CHECKING(whether to include SMP support) |
165 |
AC_ARG_ENABLE(smp, [ --disable-smp Do not include SMP support], |
166 |
[ |
167 |
if test "$enableval" = "yes" ; then |
168 |
use_smp=yes |
169 |
else |
170 |
use_smp=no |
171 |
fi |
172 |
] |
173 |
) |
174 |
|
175 |
AC_MSG_RESULT($use_smp) |
176 |
|
177 |
if test "$use_smp" = "yes"; then |
178 |
AC_CHECK_LIB( pthread, pthread_create, [ |
179 |
AC_DEFINE( ENABLE_SMP, 1, [whether to enable SMP code]) |
180 |
LIBS="-lpthread $LIBS" |
181 |
]) |
182 |
CFLAGS="$CFLAGS -D_REENTRANT" |
183 |
fi |
184 |
|
185 |
if test "$use_smp" = "yes"; then use_hic=yes |
186 |
else use_hic = no |
187 |
fi |
188 |
|
189 |
AC_MSG_CHECKING(whether to include HIC (internally handled CGIs) support) |
190 |
AC_ARG_ENABLE(hic, [ --disable-hic Do not include HIC support], |
191 |
[ |
192 |
if test "$enableval" = "yes" ; then |
193 |
if test "$use_smp" = "yes"; then use_hic=yes |
194 |
else use_hic = no |
195 |
fi |
196 |
else |
197 |
use_hic=no |
198 |
fi |
199 |
] |
200 |
) |
201 |
|
202 |
AC_MSG_RESULT($use_hic) |
203 |
|
204 |
if test "$use_hic" = "yes"; then |
205 |
AC_CHECK_LIB(dl, dlopen, |
206 |
LIBS="$LIBS -ldl" |
207 |
AC_DEFINE( ENABLE_HIC, 1, [whether to use HIC code]) |
208 |
) |
209 |
fi |
210 |
|
211 |
if test -n "$GCC"; then |
212 |
dnl if we are running gcc, use -pipe |
213 |
test -n "$GCC" && CFLAGS="$CFLAGS -pipe" |
214 |
|
215 |
AC_MSG_CHECKING(compile and link profiling code) |
216 |
AC_ARG_ENABLE(profiling, |
217 |
[ --enable-profiling Compile and link profiling code], |
218 |
[ |
219 |
if test "$enableval" = "yes" ; then |
220 |
AC_MSG_RESULT(yes) |
221 |
CFLAGS="$CFLAGS -pg -fprofile-arcs" |
222 |
else |
223 |
AC_MSG_RESULT(no) |
224 |
fi |
225 |
], |
226 |
[ |
227 |
AC_MSG_RESULT(no) |
228 |
]) |
229 |
fi |
230 |
|
231 |
AC_MSG_CHECKING(whether to compile and link debugging code) |
232 |
AC_ARG_ENABLE(debug, |
233 |
[ --disable-debug Compile and link debugging code], |
234 |
[ |
235 |
if test "$enableval" = "yes" ; then |
236 |
AC_MSG_RESULT(yes) |
237 |
LDFLAGS="$LDFLAGS -g" |
238 |
test -n "$GCC" && CFLAGS="$CFLAGS -Wall" |
239 |
else |
240 |
AC_MSG_RESULT(no) |
241 |
fi |
242 |
], |
243 |
[ |
244 |
AC_MSG_RESULT(yes) |
245 |
LDFLAGS="$LDFLAGS -g" |
246 |
test -n "$GCC" && CFLAGS="$CFLAGS -Wall" |
247 |
]) |
248 |
|
249 |
AC_MSG_CHECKING(whether to link with the Dmalloc memory debugger/profiler) |
250 |
AC_ARG_WITH(dmalloc, |
251 |
[ --with-dmalloc link with the Dmalloc memory debugger/profiler], |
252 |
[ |
253 |
if test "$withval" = "yes"; then |
254 |
AC_MSG_RESULT(trying) |
255 |
AC_CHECK_LIB(dmalloc, dmalloc_shutdown) |
256 |
else |
257 |
AC_MSG_RESULT(no) |
258 |
fi |
259 |
], |
260 |
[ |
261 |
AC_MSG_RESULT(no) |
262 |
]) |
263 |
|
264 |
AC_MSG_CHECKING(whether to link with the Electric Fence memory debugger) |
265 |
AC_ARG_WITH(efence, |
266 |
[ --with-efence link with the Electric Fence memory debugger ], |
267 |
[ |
268 |
if test "$withval" = "yes"; then |
269 |
AC_MSG_RESULT(trying) |
270 |
AC_CHECK_LIB(efence, main) |
271 |
else |
272 |
AC_MSG_RESULT(no) |
273 |
fi |
274 |
], |
275 |
[ |
276 |
AC_MSG_RESULT(no) |
277 |
]) |
278 |
|
279 |
AC_CONFIG_FILES([Makefile src/Makefile contrib/Makefile examples/Makefile docs/Makefile]) |
280 |
|
281 |
AC_OUTPUT |
282 |
|
283 |
echo "**********************************************************" |
284 |
echo "" |
285 |
echo "An example configuration file for hydra can be found at" |
286 |
echo "examples/hydra.conf." |
287 |
echo "" |
288 |
echo "**********************************************************" |