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