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