1 |
dnl $Id: configure.in,v 1.43 2006-03-10 16:40:20 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.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 |
use_smp=yes |
21 |
|
22 |
AC_MSG_CHECKING([whether to include SMP support]) |
23 |
AC_ARG_ENABLE(smp, |
24 |
AS_HELP_STRING([--disable-smp],[Do not include SMP support]), |
25 |
use_smp=$enableval) |
26 |
AC_MSG_RESULT($use_smp) |
27 |
|
28 |
|
29 |
dnl Checks for programs. |
30 |
AM_PROG_LEX |
31 |
AC_PROG_YACC |
32 |
AC_PROG_CC |
33 |
AC_PROG_CPP |
34 |
|
35 |
dnl Checks for header files. |
36 |
AC_HEADER_DIRENT |
37 |
AC_HEADER_STDC |
38 |
AC_HEADER_SYS_WAIT |
39 |
AC_CHECK_HEADERS(fcntl.h sys/fcntl.h limits.h sys/time.h sys/select.h) |
40 |
AC_CHECK_HEADERS(getopt.h netinet/tcp.h) |
41 |
|
42 |
dnl Checks for typedefs, structures, and compiler characteristics. |
43 |
AC_C_CONST |
44 |
AC_C_INLINE |
45 |
AC_TYPE_UID_T |
46 |
AC_TYPE_PID_T |
47 |
AC_HEADER_TIME |
48 |
|
49 |
AC_CHECK_TYPE( off_t, |
50 |
AC_DEFINE( HAVE_OFF_T, 1, [have off_t type]),, |
51 |
) |
52 |
|
53 |
AC_SYS_LARGEFILE |
54 |
|
55 |
dnl Checks for library functions. |
56 |
AC_FUNC_SETVBUF_REVERSED |
57 |
AC_FUNC_MMAP |
58 |
AC_CHECK_FUNCS(getcwd strdup strstr gmtime_r) |
59 |
AC_CHECK_FUNCS(gethostname gethostbyname select socket inet_aton) |
60 |
AC_CHECK_FUNCS(scandir alphasort qsort) |
61 |
AC_CHECK_FUNCS(getrlimit setrlimit) |
62 |
AC_CHECK_FUNCS(stat) |
63 |
|
64 |
AC_CHECK_STRUCT_FOR([ |
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_gmtoff) |
76 |
|
77 |
if test $ac_cv_struct_tm_has_tm_gmtoff = yes; then |
78 |
AC_DEFINE(HAVE_TM_GMTOFF, 1, [Have tm_gmtoff]) |
79 |
fi |
80 |
|
81 |
AC_CHECK_STRUCT_FOR([ |
82 |
|
83 |
#if TIME_WITH_SYS_TIME |
84 |
# include <sys/time.h> |
85 |
# include <time.h> |
86 |
#else |
87 |
# if HAVE_SYS_TIME_H |
88 |
# include <sys/time.h> |
89 |
# else |
90 |
# include <time.h> |
91 |
# endif |
92 |
#endif |
93 |
],tm,tm_zone) |
94 |
|
95 |
if test "$ac_cv_struct_tm_has_tm_zone" = "yes"; then |
96 |
AC_DEFINE(HAVE_TM_ZONE, 1, [Have tm_zone]) |
97 |
fi |
98 |
|
99 |
AC_CHECK_STRUCT_FOR([ |
100 |
#include <sys/types.h> |
101 |
#include <netinet/in.h> |
102 |
],sockaddr_in,sin_len) |
103 |
|
104 |
if test "$ac_cv_struct_sockaddr_in_has_sin_len" = "yes"; then |
105 |
AC_DEFINE(HAVE_SIN_LEN,1, [Have sin_len]) |
106 |
fi |
107 |
|
108 |
if test $ac_cv_func_socket = no; then |
109 |
# socket is not in the default libraries. |
110 |
AC_CHECK_LIB(socket, socket, |
111 |
[ MYLIBS="$MYLIBS -lsocket" ]) |
112 |
fi |
113 |
|
114 |
if test $ac_cv_func_inet_aton = no; then |
115 |
# inet_aton is not in the default libraries. |
116 |
AC_CHECK_LIB(resolv, inet_aton, MYLIBS="$MYLIBS -lresolv") |
117 |
fi |
118 |
|
119 |
if test $ac_cv_func_gethostname = no; then |
120 |
AC_CHECK_LIB(nsl, gethostname, MYLIBS="$MYLIBS -lnsl") |
121 |
fi |
122 |
|
123 |
dnl May end up with duplicate -lnsl -- oh well |
124 |
if test $ac_cv_func_gethostbyname = no; then |
125 |
AC_CHECK_LIB(nsl, gethostbyname, MYLIBS="$MYLIBS -lnsl") |
126 |
fi |
127 |
|
128 |
LIBS="$LIBS $MYLIBS" |
129 |
|
130 |
# Try to find TCP_CORK and use it if found. |
131 |
AC_MSG_CHECKING([whether TCP_CORK is a valid TCP socket option]) |
132 |
AC_TRY_COMPILE( |
133 |
#include <sys/socket.h> |
134 |
#include <netinet/tcp.h> |
135 |
#include <netinet/in.h> |
136 |
,[ |
137 |
int one = 1, fd; |
138 |
if (setsockopt(fd, IPPROTO_TCP, TCP_CORK, |
139 |
(void *) &one, sizeof (one)) == -1) |
140 |
return -1; |
141 |
return 0; |
142 |
|
143 |
], |
144 |
dnl *** FOUND |
145 |
AC_DEFINE( HAVE_TCP_CORK, 1, [TCP_CORK was found and will be used]) |
146 |
AC_MSG_RESULT(yes), |
147 |
dnl *** NOT FOUND |
148 |
AC_MSG_RESULT(no) |
149 |
) |
150 |
|
151 |
use_sendfile=yes |
152 |
AC_MSG_CHECKING([whether to enable sendfile(2) usage]) |
153 |
AC_ARG_ENABLE(sendfile, |
154 |
AS_HELP_STRING([--disable-sendfile],[Disable the use of the sendfile(2) system call]), |
155 |
use_sendfile=$enableval) |
156 |
AC_MSG_RESULT($use_sendfile) |
157 |
|
158 |
if test "$use_sendfile" = "yes"; then |
159 |
case $host_os in |
160 |
*linux*) |
161 |
AC_CHECK_HEADERS(sys/sendfile.h) |
162 |
AC_CHECK_FUNCS(sendfile) |
163 |
AC_DEFINE(HAVE_SENDFILE, 1, [whether to use sendfile]) |
164 |
AC_DEFINE(HAVE_LINUXSENDFILE, 1, [whether to use Linux' sendfile]) |
165 |
;; |
166 |
*freebsd*) |
167 |
AC_CHECK_HEADERS(sys/sendfile.h) |
168 |
AC_CHECK_FUNCS(sendfile) |
169 |
AC_DEFINE(HAVE_BSDSENDFILE, 1, [whether to use FreeBSD's sendfile]) |
170 |
AC_DEFINE(HAVE_SENDFILE, 1, [whether to use sendfile]) |
171 |
;; |
172 |
*) ;; |
173 |
esac |
174 |
fi |
175 |
|
176 |
|
177 |
|
178 |
if test "$use_smp" = "yes"; then |
179 |
dnl Check for pthreads and do not define ENABLE_SMP |
180 |
dnl if not found |
181 |
|
182 |
ACX_PTHREAD( |
183 |
AC_DEFINE( ENABLE_SMP, 1, [whether to enable SMP code]) |
184 |
LIBS="$PTHREAD_LIBS $LIBS" |
185 |
CFLAGS="$CFLAGS $PTHREAD_CFLAGS" |
186 |
CC="$PTHREAD_CC" |
187 |
) |
188 |
fi |
189 |
|
190 |
|
191 |
use_ssl=yes |
192 |
|
193 |
AC_MSG_CHECKING(whether to include SSL and TLS support) |
194 |
AC_ARG_ENABLE(ssl, |
195 |
AS_HELP_STRING([--disable-ssl],[Disable SSL and TLS support]), |
196 |
use_ssl=$enableval) |
197 |
AC_MSG_RESULT($use_ssl) |
198 |
|
199 |
if test "$use_ssl" = "yes"; then |
200 |
AM_PATH_LIBGNUTLS( 1.0.9, |
201 |
AC_DEFINE(HAVE_LIBGNUTLS, 1, [Have libgnutls]) |
202 |
AC_DEFINE( ENABLE_SSL, 1, [whether to enable ssl]), |
203 |
AC_MSG_WARN([[ |
204 |
*** |
205 |
*** libgnutls was not found. You may want to get it from |
206 |
*** ftp://ftp.gnutls.org/pub/gnutls/ |
207 |
]])) |
208 |
|
209 |
fi |
210 |
|
211 |
|
212 |
AC_CHECK_FUNC( fnmatch, |
213 |
AC_DEFINE( ENABLE_ACCESS_LISTS, 1, [whether to enable file access control lists]) , |
214 |
AC_MSG_WARN([[ |
215 |
*** |
216 |
*** fnmatch() is not available in your system. File access control lists |
217 |
*** will not be available. |
218 |
]]) |
219 |
) |
220 |
|
221 |
if test -n "$GCC"; then |
222 |
dnl if we are running gcc, use -pipe |
223 |
test -n "$GCC" && CFLAGS="$CFLAGS -pipe" |
224 |
|
225 |
AC_MSG_CHECKING(compile and link profiling code) |
226 |
AC_ARG_ENABLE(profiling, |
227 |
[ --enable-profiling Compile and link profiling code], |
228 |
[ |
229 |
if test "$enableval" = "yes" ; then |
230 |
AC_MSG_RESULT(yes) |
231 |
AC_CHECK_PROG(FC_OK, fc-config, yes, no) |
232 |
if test x$FC_OK = xyes; then |
233 |
CFLAGS="${CFLAGS} `fc-config --cflags`" |
234 |
LIBS="$LIBS `fc-config --libs`" |
235 |
else |
236 |
AC_MSG_WARN(*** |
237 |
*** You must install libfc in order to enable profiling. http://www710.univ-lyon1.fr/~yperret/fnccheck/profiler.html |
238 |
) |
239 |
fi |
240 |
|
241 |
else |
242 |
AC_MSG_RESULT(no) |
243 |
fi |
244 |
], |
245 |
[ |
246 |
AC_MSG_RESULT(no) |
247 |
]) |
248 |
fi |
249 |
|
250 |
AC_MSG_CHECKING(whether to compile and link debugging code) |
251 |
AC_ARG_ENABLE(debug, |
252 |
[ --disable-debug Compile and link debugging code], |
253 |
[ |
254 |
if test "$enableval" = "yes" ; then |
255 |
AC_MSG_RESULT(yes) |
256 |
LDFLAGS="$LDFLAGS -g" |
257 |
test -n "$GCC" && CFLAGS="$CFLAGS -Wall" |
258 |
else |
259 |
AC_MSG_RESULT(no) |
260 |
fi |
261 |
], |
262 |
[ |
263 |
AC_MSG_RESULT(yes) |
264 |
LDFLAGS="$LDFLAGS -g" |
265 |
test -n "$GCC" && CFLAGS="$CFLAGS -Wall" |
266 |
]) |
267 |
|
268 |
AC_MSG_CHECKING(whether to link with the Dmalloc memory debugger/profiler) |
269 |
AC_ARG_WITH(dmalloc, |
270 |
[ --with-dmalloc link with the Dmalloc memory debugger/profiler], |
271 |
[ |
272 |
if test "$withval" = "yes"; then |
273 |
AC_MSG_RESULT(trying) |
274 |
AC_CHECK_LIB(dmalloc, dmalloc_shutdown) |
275 |
else |
276 |
AC_MSG_RESULT(no) |
277 |
fi |
278 |
], |
279 |
[ |
280 |
AC_MSG_RESULT(no) |
281 |
]) |
282 |
|
283 |
AC_MSG_CHECKING(whether to link with the Electric Fence memory debugger) |
284 |
AC_ARG_WITH(efence, |
285 |
[ --with-efence link with the Electric Fence memory debugger ], |
286 |
[ |
287 |
if test "$withval" = "yes"; then |
288 |
AC_MSG_RESULT(trying) |
289 |
AC_CHECK_LIB(efence, main) |
290 |
else |
291 |
AC_MSG_RESULT(no) |
292 |
fi |
293 |
], |
294 |
[ |
295 |
AC_MSG_RESULT(no) |
296 |
]) |
297 |
|
298 |
|
299 |
POLL_OR_SELECT |
300 |
|
301 |
if test "$BOA_ASYNC_IO" = "poll"; then |
302 |
AC_DEFINE( USE_POLL, 1, [whether to use poll]) |
303 |
fi |
304 |
|
305 |
# there are three scenarios |
306 |
# GNU make is installed as "make" |
307 |
# GNU make is installed as something else we detected |
308 |
# GNU make is not installed |
309 |
# Unfortunately, we can't deal with it one way or the other |
310 |
# Trying multiple AC_OUTPUT confuses autoconf, and using variables |
311 |
# *in* AC_OUTPUT is even worse. |
312 |
# *so*, make a default makefile that just forces make to call gmake |
313 |
# or whatever. |
314 |
|
315 |
AC_CONFIG_FILES([Makefile src/Makefile contrib/Makefile contrib/redhat/Makefile examples/Makefile docs/Makefile]) |
316 |
|
317 |
AC_OUTPUT |
318 |
|
319 |
echo "**********************************************************" |
320 |
echo "" |
321 |
echo "An example configuration file for hydra can be found at" |
322 |
echo "examples/hydra.conf." |
323 |
echo "" |
324 |
echo "**********************************************************" |