-
Notifications
You must be signed in to change notification settings - Fork 25
/
configure.in
301 lines (268 loc) · 7.03 KB
/
configure.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
dnl $Id: configure.in,v 1.1.2.16 2003/10/05 04:00:05 jnelson Exp $
dnl Process this file with autoconf to produce a configure script.
AC_INIT
AC_CONFIG_SRCDIR([src/boa.c])
dnl Make config.h
AC_CONFIG_HEADER(src/config.h)
AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_CC
AC_PROG_CPP
AC_C_VAR_FUNC
CHECK_GNU_MAKE
if test "x$_cv_gnu_make_command" != "x"; then
MAKE="$_cv_gnu_make_command"
ALLSOURCES="\$^"
else
MAKE="make"
ALLSOURCES="\$(.ALLSRC)"
fi
AC_SUBST(ALLSOURCES)
AC_SUBST(MAKE)
dnl AC_MSG_RESULT($host) dnl i686-pc-linux-gnu
dnl AC_MSG_RESULT($host_cpu) dnl i686
dnl AC_MSG_RESULT($host_vendor) dnl pc
dnl AC_MSG_RESULT($host_os) dnl linux-gnu
dnl i386-unknown-freebsd4.2
dnl Checks for libraries.
# AC_SEARCH_LIBS (function, search-libs, [action-if-found], [action-if-not-found], [other-libraries])
AC_SEARCH_LIBS(socket, socket net)
AC_SEARCH_LIBS(inet_aton, resolv)
AC_SEARCH_LIBS(gethostname, nsl)
AC_SEARCH_LIBS(gethostbyname, nsl)
dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h sys/fcntl.h limits.h sys/time.h)
AC_CHECK_HEADERS(getopt.h unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_STRUCT_TM
dnl AC_CHECK_TYPE(sa_family_t,unsigned short int)
dnl AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) (includes, function-body, [action-if-found], [action-if-not-found])
AC_MSG_CHECKING(whether sa_family_t is defined)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/socket.h>
]], [[sa_family_t foo2;]])],[AC_MSG_RESULT(yes)],[
AC_MSG_RESULT(no)
AC_DEFINE(DONT_HAVE_SA_FAMILY_T,1,[Define if sa_family_t is not defined])
])
dnl Checks for library functions.
AC_FUNC_FNMATCH
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_SETVBUF_REVERSED
AC_CHECK_FUNCS(getcwd strdup strstr strcspn strtol)
AC_CHECK_FUNCS(gethostname gethostbyname socket inet_aton herror inet_addr)
AC_CHECK_FUNCS(scandir alphasort)
AC_CHECK_FUNCS(madvise)
AC_CHECK_STRUCT_FOR([
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
],tm,tm_gmtoff)
if test "$ac_cv_struct_tm_has_tm_gmtoff" = "yes"; then
AC_DEFINE(HAVE_TM_GMTOFF,1,[Define if struct tm has a tm_gmtoff member])
fi
AC_CHECK_STRUCT_FOR([
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
],tm,tm_zone)
if test "$ac_cv_struct_tm_has_tm_zone" = "yes"; then
AC_DEFINE(HAVE_TM_ZONE,1,[Define if struct tm has tm_zone member])
fi
AC_CHECK_STRUCT_FOR([
#include <sys/types.h>
#include <netinet/in.h>
],sockaddr_in,sin_len)
if test "$ac_cv_struct_sockaddr_in_has_sin_len" = "yes"; then
AC_DEFINE(HAVE_SIN_LEN,1,[Define if struct sockaddr_in has sin_len member])
fi
if test $ac_cv_func_scandir = no; then
# scandir not defined, add it
SCANDIR="scandir.o"
AC_SUBST(SCANDIR)
fi
if test $ac_cv_func_alphasort = no; then
# alphasort not defined, add it
ALPHASORT="alphasort.o"
AC_SUBST(ALPHASORT)
fi
if test $ac_cv_func_strdup = no -o $ac_cv_func_strstr = no; then
# strdup or strstr not defined
STRUTIL="strutil.o"
AC_SUBST(STRUTIL)
fi
if test -n "$GCC"; then
dnl if we are running gcc, use -pipe
test -n "$GCC" && CFLAGS="$CFLAGS -pipe"
AC_MSG_CHECKING(compile and link profiling code)
AC_ARG_ENABLE(profiling,
[ --enable-profiling Compile and link profiling code],
[
if test "$enableval" = "yes" ; then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -pg"
LDFLAGS="$LDFLAGS -g -pg"
else
AC_MSG_RESULT(no)
fi
],
[
AC_MSG_RESULT(no)
])
fi
AC_MSG_CHECKING(whether to enable gunzip support)
AC_ARG_ENABLE(gunzip,
[ --disable-gunzip Disable use of gunzip],
[
if test "$enableval" = "yes" ; then
AC_MSG_RESULT(yes)
AC_PATH_PROG(GUNZIP, gunzip)
AC_DEFINE_UNQUOTED(GUNZIP, "$ac_cv_path_GUNZIP", [Define if gunzip can be found])
else
AC_MSG_RESULT(no)
fi
],
[
AC_MSG_RESULT(yes)
AC_PATH_PROG(GUNZIP, gunzip)
AC_DEFINE_UNQUOTED(GUNZIP, "$ac_cv_path_GUNZIP", [Define if gunzip can be found])
])
AC_MSG_CHECKING(whether to enable access control support)
AC_ARG_ENABLE(access-control,
[ --enable-access-control Enable support for allow/deny rules],
[
if test "$enableval" = "yes" ; then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -DACCESS_CONTROL"
ACCESSCONTROL_SOURCE="access.c"
else
AC_MSG_RESULT(no)
fi
],
[
AC_MSG_RESULT(no)
])
AC_SUBST(ACCESSCONTROL_SOURCE)
AC_MSG_CHECKING(whether to compile and link debugging code)
AC_ARG_ENABLE(debug,
[ --disable-debug Do not compile and link debugging code],
[
if test "$enableval" = "yes" ; then
AC_MSG_RESULT(yes)
LDFLAGS="$LDFLAGS -g"
test -n "$GCC" && CFLAGS="$CFLAGS -Wall"
else
AC_MSG_RESULT(no)
fi
],
[
AC_MSG_RESULT(yes)
LDFLAGS="$LDFLAGS -g"
test -n "$GCC" && CFLAGS="$CFLAGS -Wall"
])
AC_MSG_CHECKING(whether to disable verbose/debug logging)
AC_ARG_ENABLE(verbose,
[ --disable-verbose Do not enable verbose/debug logging],
[
if test "$enableval" = "yes" ; then
AC_MSG_RESULT(yes)
else
CFLAGS="$CFLAGS -DDISABLE_DEBUG"
AC_MSG_RESULT(no)
fi
],
[
AC_MSG_RESULT(yes)
])
AC_MSG_CHECKING(whether to link with the Dmalloc memory debugger/profiler)
AC_ARG_WITH(dmalloc,
[ --with-dmalloc Link with the Dmalloc memory debugger/profiler],
[
if test "$withval" = "yes"; then
AC_MSG_RESULT(trying)
AC_CHECK_LIB(dmalloc, dmalloc_shutdown)
else
AC_MSG_RESULT(no)
fi
],
[
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(whether to link with the Electric Fence memory debugger)
AC_ARG_WITH(efence,
[ --with-efence Link with the Electric Fence memory debugger],
[
if test "$withval" = "yes"; then
AC_MSG_RESULT(trying)
AC_CHECK_LIB(efence, main)
else
AC_MSG_RESULT(no)
fi
],
[
AC_MSG_RESULT(no)
])
case $host_os in
*linux*)
AC_MSG_CHECKING(whether to enable the use of the sendfile(2) system call)
AC_ARG_ENABLE(sendfile,
[ --disable-sendfile Disable the use of the sendfile(2) system call],
[
if test "$enableval" = "no" ; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
AC_CHECK_HEADERS(sys/sendfile.h)
AC_CHECK_FUNCS(sendfile)
fi
],
[
AC_MSG_RESULT(yes)
AC_CHECK_HEADERS(sys/sendfile.h)
AC_CHECK_FUNCS(sendfile)
])
;;
*) ;;
esac
POLL_OR_SELECT
if test "$BOA_ASYNC_IO" = "poll"; then
ASYNCIO_SOURCE="poll.c"
else
ASYNCIO_SOURCE="select.c"
fi
AC_SUBST(ASYNCIO_SOURCE)
# there are three scenarios
# GNU make is installed as "make"
# GNU make is installed as something else we detected
# GNU make is not installed
# Unfortunately, we can't deal with it one way or the other
# Trying multiple AC_OUTPUT confuses autoconf, and using variables
# *in* AC_OUTPUT is even worse.
# *so*, make a default makefile that just forces make to call gmake
# or whatever.
AC_CONFIG_FILES([Makefile src/Makefile docs/Makefile])
AC_OUTPUT