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