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