]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Converted many #ifdefs to #ifs
[thirdparty/squid.git] / configure.in
CommitLineData
e2716c57 1
090089c4 2dnl
262a0e14 3dnl $Id$
090089c4 4dnl
090089c4 5dnl
6dnl
62979ab1 7AC_INIT([Squid Web Proxy],[3.HEAD-BZR],[http://www.squid-cache.org/bugs/],[squid])
d966027f 8AC_PREREQ(2.61)
62979ab1 9AC_CONFIG_HEADERS([include/autoconf.h])
71b12d7c 10AC_CONFIG_AUX_DIR(cfgaux)
8d9ce05e 11AC_CONFIG_SRCDIR([src/main.cc])
189f1e66 12AM_INIT_AUTOMAKE([tar-ustar nostdinc])
c2720d44 13AC_REVISION($Revision$)dnl
a2794549 14AC_PREFIX_DEFAULT(/usr/local/squid)
246d7ffc 15AM_MAINTAINER_MODE
a2794549 16
fa522425 17m4_include([acinclude/squid-util.m4])
6a56798f 18m4_include([acinclude/compiler-flags.m4])
0abb39dd 19m4_include([acinclude/os-deps.m4])
6a56798f 20
63e02610 21PRESET_CFLAGS="$CFLAGS"
22PRESET_LDFLAGS="$LDFLAGS"
23
a2794549 24dnl Set default LDFLAGS
25if test -z "$LDFLAGS"; then
26 LDFLAGS="-g"
27fi
28
aff48cc8 29# Check for GNU cc
a2794549 30AC_PROG_CC
e6c4cdd6 31AM_PROG_CC_C_O
29b8d8d6 32AC_PROG_CXX
62979ab1 33AC_LANG([C++])
88d50a22 34AC_CANONICAL_HOST
3e7b6055 35
40503c27
FC
36AC_MSG_CHECKING([simplified host os])
37squid_host_os=`echo $host_os|sed 's/[0-9].*//'`
38squid_host_os_version=`echo $host_os|sed "s/$squid_host_os//"`
39AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
40# on windows squid_host_os is either mingw or cygwin, version is 32
41
aff48cc8
FC
42# test for programs
43AC_PROG_LIBTOOL
44AC_PROG_RANLIB
45AC_PROG_CPP
46AC_PROG_INSTALL
47AC_PROG_LN_S
48AC_PROG_EGREP
49
50AC_PATH_PROG(SH, sh, /bin/sh)
51AC_PATH_PROG(FALSE, false, /usr/bin/false)
52AC_PATH_PROG(TRUE, true, /usr/bin/true)
53AC_PATH_PROG(MV, mv, $FALSE)
54AC_PATH_PROG(MKDIR, mkdir, $FALSE)
55AC_PATH_PROG(LN, ln, cp)
56AC_PATH_PROG(CHMOD, chmod, $FALSE)
6d1c1ab1 57AC_PATH_PROG(TR, tr, $FALSE)
aff48cc8 58AC_PATH_PROG(RM, rm, $FALSE)
ffa3bad9 59AC_PATH_PROG(CPPUNITCONFIG, cppunit-config, false)
aff48cc8
FC
60dnl Libtool 2.2.6 requires: rm -f
61RM="$RM -f"
62
63AC_PATH_PROG(PERL, perl, none)
64if test "$ac_cv_path_PERL" = "none"; then
65 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
66fi
07f370ee 67AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
aff48cc8
FC
68
69dnl set $(AR)
70AC_PATH_PROG(AR, ar, $FALSE)
71AR_R="$AR r"
aff48cc8
FC
72AC_SUBST(AR_R)
73
f9d138eb 74
d1f95b42 75dnl Make the squid top srcdir available to sub-packages as --with-squid=PATH
fa6307ae 76ac_configure_args="$ac_configure_args --with-squid=$ac_abs_confdir"
d1f95b42 77
fa6307ae 78squid_opt_enable_werror="yes" # default
0b45d157
FC
79AC_ARG_ENABLE(strict-error-checking,
80 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
81 with all possible static compiler error-checks enbled.
82 This flag disables the behavior]),
83[
84 if test "${enableval}" = "no"
85 then
fa6307ae 86 squid_opt_enable_werror="no"
0b45d157
FC
87 fi
88])
d1f95b42 89
f7baea2d 90use_loadable_modules=1
3e7b6055
AR
91AC_MSG_CHECKING(whether to use loadable modules)
92AC_ARG_ENABLE(loadable-modules,
8075a4da 93 AS_HELP_STRING([--disable-loadable-modules],[do not support loadable modules]) , [
3e7b6055
AR
94 case "${enableval}" in
95 yes) use_loadable_modules=yes ;;
96 no) use_loadable_modules=no ;;
97 *) AC_MSG_ERROR(bad value ${enableval} for --disable-loadable-modules) ;;
98 esac
99 AC_MSG_RESULT([$use_loadable_modules, explicitly])
8075a4da 100 ], [
3e7b6055
AR
101 use_loadable_modules=yes;
102 AC_MSG_RESULT([$use_loadable_modules, implicitly])
8075a4da 103 ])
3e7b6055
AR
104
105AM_CONDITIONAL(USE_LOADABLE_MODULES, test $use_loadable_modules = yes)
106
107if test $use_loadable_modules = yes;
108then
109 AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules])
110 AC_ENABLE_SHARED
111else
112 AC_DISABLE_SHARED
113fi
114
115AC_LIBTOOL_DLOPEN
116if test $use_loadable_modules = yes;
117then
0fb3665c
AJ
118 dnl Linux LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
119 dnl But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
120 top_build_prefix=${ac_top_build_prefix}
121 AC_SUBST(top_build_prefix)
122
660faa02 123 AC_LIBLTDL_CONVENIENCE
3e7b6055 124fi
f5691f9c 125AC_LTDL_DLLIB
3e7b6055
AR
126
127# Do we need these unconditionally for "make distcheck" to work?
128AC_SUBST(INCLTDL)
129AC_SUBST(LIBLTDL)
130
131if test $use_loadable_modules = yes;
132then
133 # Why is this needed? Should not libtool's AC_LIBTOOL_DLOPEN do that?
134 LIBADD_DL=${lt_cv_dlopen_libs}
135 AC_SUBST([LIBADD_DL])
136fi
137
88d50a22 138
07f370ee 139SQUID_CC_GUESS_VARIANT
fa6307ae 140SQUID_CC_GUESS_OPTIONS
f9d138eb 141
a2794549 142
00fa2c12 143REGEXLIB='' # -lregex
cc937513 144# LIBREGEX='' # libregex.a
090089c4 145
a2794549 146dnl find out the exe extension for this platform. If it's not empty, use it for CGI's as well.
147AC_EXEEXT
148AC_OBJEXT
149
150if test -z "$EXEEXT"; then
151 CGIEXT=".cgi"
152else
7aeb8001 153 # automake automatically adds .exe when installing binaries
154 CGIEXT=""
a2794549 155fi
7aeb8001 156AC_SUBST(CGIEXT)
a2794549 157
0e6d05ef 158dnl this should be expanded to a list of platform sensible support requirements.
159dnl (adding an option like --enable-cygwin-support doesn't make sense :]) - R Collins 2001
8075a4da
FC
160AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,
161 [test "$squid_host_os" = "mingw" -o "$squid_host_os" = "cygwin"])
40503c27 162AM_CONDITIONAL(USE_IPC_WIN32,[test "$squid_host_os" = "mingw"])
df087e68 163
40503c27 164if test $squid_host_os = "mingw"; then
4b26fae9 165 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
166 CFLAGS="$CFLAGS -mthreads"
167 CXXFLAGS="$CXXFLAGS -mthreads"
168 if test "$ac_cv_path_WIN32_PSAPI" = "none"; then
eed82608
AJ
169 AC_MSG_NOTICE([PSAPI.DLL is recommended to run Squid on Windows NT Platform])
170 AC_MSG_NOTICE([Please see PSAPI.DLL section on doc/win32-relnotes.html.])
4b26fae9 171 else
172 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
173 LIBS="$LIBS -lpsapi"
174 fi
790ebe36 175 MINGW_LIBS="-lmingwex"
176 AC_SUBST(MINGW_LIBS)
40503c27 177fi
4b26fae9 178
a26bdc75 179if test -z "$CACHE_HTTP_PORT"; then
180 CACHE_HTTP_PORT="3128"
181fi
182if test -z "$CACHE_ICP_PORT"; then
183 CACHE_ICP_PORT="3130"
184fi
a26bdc75 185
f4aaf39c 186dnl Substitutions
6a9f6389 187AC_DEFINE_UNQUOTED(CACHE_HTTP_PORT, $CACHE_HTTP_PORT,
8075a4da 188 [What default TCP port to use for HTTP listening?])
58c1507a 189AC_SUBST(CACHE_HTTP_PORT)
6a9f6389 190AC_DEFINE_UNQUOTED(CACHE_ICP_PORT, $CACHE_ICP_PORT,
8075a4da 191 [What default UDP port to use for ICP listening?])
f5e5c4cf 192AC_SUBST(CACHE_ICP_PORT)
090089c4 193
6a9f6389 194AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
30a4f2a8 195
8075a4da
FC
196AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args",
197 [configure command line used to configure Squid])
090089c4 198
5483d916 199CACHE_EFFECTIVE_USER="nobody"
200AC_ARG_WITH(default-user,
62979ab1 201 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
5483d916 202 [ CACHE_EFFECTIVE_USER="$withval" ]
203)
204AC_SUBST(CACHE_EFFECTIVE_USER)
205
c8d2dc9b
AJ
206DEFAULT_LOG_DIR="$localstatedir/logs"
207AC_ARG_WITH(logdir,
62979ab1 208 AS_HELP_STRING([--with-logdir=PATH],[Default location for squid logs. default: $DEFAULT_LOG_DIR]),
c8d2dc9b
AJ
209 [ case $withval in
210 yes|no)
211 AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH )
212 ;;
213 *)
214 DEFAULT_LOG_DIR="$withval"
215 ;;
216 esac
217 ]
218)
219AC_SUBST(DEFAULT_LOG_DIR)
220
b1d38b05 221DEFAULT_PIDFILE="$localstatedir/run/squid.pid"
a7f6af35 222AC_ARG_WITH(pidfile,
e0eb5853
FC
223 AS_HELP_STRING([--with-pidfile=PATH],
224 [Default location for squid PID file. default: PREFIX/var/run/squid.pid]),
225[case $withval in
a7f6af35
AJ
226 yes|no)
227 AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH )
228 ;;
229 *)
230 DEFAULT_PIDFILE="$withval"
231 ;;
232 esac
e0eb5853 233])
a7f6af35
AJ
234AC_SUBST(DEFAULT_PIDFILE)
235
4c43504f 236if test "$GCC" = "yes"; then
237 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
238 GCCVER2=`echo $GCCVER | awk '{print $1 * 100}'`
239 case "$host" in
240 i386-*-freebsd*)
241 if test $GCCVER2 -lt 300 ; then
eed82608 242 AC_MSG_FAILURE([GCC $GCCVER causes a coredump on $host. Try a more recent GCC version])
4c43504f 243 fi
244 ;;
245 esac
246 unset GCCVER
247 unset GCCVER2
6bb3e7d4 248
4c43504f 249fi
250
30a4f2a8 251dnl Set Default CFLAGS
252if test -z "$PRESET_CFLAGS"; then
253 if test "$GCC" = "yes"; then
254 case "$host" in
97b12a5b 255 *-sun-sunos*)
30a4f2a8 256 # sunos has too many warnings for this to be useful
257 # motorola too
258 ;;
97b12a5b 259 *m88k*)
260 # Motorola cc/ld does not like -02 but is ok on -O
261 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
262 ;;
30a4f2a8 263 *)
fa6307ae 264 CFLAGS="$squid_cv_cc_option_wall $CFLAGS"
30a4f2a8 265 ;;
266 esac
81a820c6 267 else
268 case "$host" in
c415c128 269 *mips-sgi-irix6.*)
81a820c6 270 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
fa6307ae 271 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
776b0191 272 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
81a820c6 273 -Wl,-woff,85,-woff,84,-woff,134 \
63e02610 274 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
fa6307ae 275 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
776b0191 276 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
277 -Wl,-woff,85,-woff,84,-woff,134 \
278 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
81a820c6 279 ;;
e8f5fb18 280 alpha-dec-osf4.*)
553c24ae 281 # Mogul says DEC compilers take both -g and -O2
b6a2f15e 282 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
fa6307ae 283 CFLAGS="$squid_cv_cc_option_optimize $CFLAGS"
553c24ae 284 ;;
81a820c6 285 *)
286 ;;
287 esac
30a4f2a8 288 fi
30a4f2a8 289fi
290
d2e3605e 291dnl set squid required flags
292if test "$GCC" = "yes"; then
9f68fb10 293dnl Guido Serassio (serassio@squid-cache.org) 20070811
294dnl Using the latest MinGW (gcc 3.4.5 + mingw-runtime 3.13) cannot build with
0a13cc9d 295dnl -Werror -Wmissing-prototypes -Wmissing-declarations
9f68fb10 296dnl TODO: check if the problem will be present in any other newer MinGW release.
297 case "$host_os" in
298 mingw|mingw32)
fa6307ae 299 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments"
9f68fb10 300 ;;
301 *)
fa6307ae 302 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments"
9f68fb10 303 ;;
304 esac
fa6307ae 305 SQUID_CXXFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments"
d2e3605e 306else
9f68fb10 307 SQUID_CFLAGS=
308 SQUID_CXXFLAGS=
d2e3605e 309fi
07f370ee 310
fa6307ae 311if test "$squid_opt_enable_werror" = "no"
07f370ee
FC
312then
313 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
314 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_option_werror"
315fi
316
d2e3605e 317AC_SUBST(SQUID_CFLAGS)
318AC_SUBST(SQUID_CXXFLAGS)
319
07f370ee
FC
320SQUID_CXX_CHECK_ARG_FHUGEOBJECTS
321if test "$squid_cv_cxx_arg_fhugeobjects" = "yes"; then
6a56798f
FC
322 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -fhuge-objects"
323fi
e0eb5853
FC
324# squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
325SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
326SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
2060fa9a 327
6c0c04db 328SquidInline="yes"
83079644 329
330AC_ARG_ENABLE(optimizations,
ffa3bad9
FC
331 AS_HELP_STRING([--disable-optimizations],
332 [Don't compile Squid with compiler optimizations enabled.
a2f6a96c
FC
333 Optimization is good for production builds, but not
334 good for debugging. During development, use
335 --disable-optimizations to reduce compilation times
336 and allow easier debugging. This option implicitly
337 also enabled --disable-inline]),
83079644 338[ if test "$enableval" = "no" ; then
eed82608 339 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
83079644 340 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
341 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`"
342 SquidInline="no"
343 fi
344])
345
ffa3bad9 346AH_TEMPLATE(_USE_INLINE_,[Include inline methods into header file])
6c0c04db 347AC_ARG_ENABLE(inline,
62979ab1 348 AS_HELP_STRING([--disable-inline],[Don't compile trivial methods as inline. Squid
a2f6a96c
FC
349 is coded with much of the code able to be inlined.
350 Inlining is good for production builds, but not
351 good for development. During development, use
352 --disable-inline to reduce compilation times and
353 allow incremental builds to be quick. For
354 production builds, or load tests, use
355 --enable-inline to have squid make all trivial
356 methods inlinable by the compiler.]),
6c0c04db 357[ if test "$enableval" = "no" ; then
358 SquidInline="no"
359 fi
360])
361
362if test "$SquidInline" = "yes" ; then
363 AC_DEFINE(_SQUID_INLINE_, inline, [Keyword used by squid for inlining methods])
ffa3bad9 364 AC_DEFINE(_USE_INLINE_, 1 , [Include inline methods into header file])
6c0c04db 365else
eed82608 366 AC_MSG_NOTICE([Inlining optimization disabled])
ffa3bad9 367 AC_DEFINE(_SQUID_INLINE_,[], [Keyword used by squid for inlining methods])
6c0c04db 368fi
369
fa80a8ef 370AC_ARG_ENABLE(debug-cbdata,
8075a4da
FC
371 AS_HELP_STRING([--enable-debug-cbdata],
372 [Provide some debug information in cbdata]), [
373if test "$enableval" = "yes" ; then
374 AC_MSG_NOTICE([cbdata debugging enabled])
375 AC_DEFINE(CBDATA_DEBUG,1, [Enable support for cbdata debug information])
376fi
fa80a8ef 377])
378
c9267250
AJ
379dnl Nasty hack to get autoconf 2.64 on Linux to run.
380dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
381AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[])
382
0961c811 383dnl This is a developer only option.. developers know how to set defines
384dnl
385dnl AC_ARG_ENABLE(xmalloc-debug,
386dnl [ --enable-xmalloc-debug Do some simple malloc debugging],
387dnl [ if test "$enableval" = "yes" ; then
eed82608 388dnl AC_MSG_NOTICE([malloc debugging enabled])
6a9f6389 389dnl AC_DEFINE(XMALLOC_DEBUG,1,[Define to do simple malloc debugging])
0961c811 390dnl fi
391dnl ])
392
393dnl This is a developer only option.. developers know how to set defines
394dnl
395dnl AC_ARG_ENABLE(xmalloc-debug-trace,
396dnl [ --enable-xmalloc-debug-trace
397dnl Detailed trace of memory allocations],
398dnl [ if test "$enableval" = "yes" ; then
eed82608 399dnl AC_MSG_NOTICE([malloc debug trace enabled])
6a9f6389 400dnl AC_DEFINE(XMALLOC_TRACE,1,[Define to have a detailed trace of memory allocations])
401dnl AC_DEFINE(XMALLOC_DEBUG,1)
0961c811 402dnl fi
403dnl ])
e5f4e1b0 404
0d00c98b 405AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
d9180414 406AC_ARG_ENABLE(xmalloc-statistics,
8075a4da
FC
407 AS_HELP_STRING([--enable-xmalloc-statistics],
408 [Show malloc statistics in status page]), [
409if test "$enableval" = "yes" ; then
410 AC_MSG_NOTICE([malloc statistics enabled])
411 AC_DEFINE(XMALLOC_STATISTICS,1)
412fi
e5f4e1b0 413])
414
8075a4da 415squid_opt_aufs_threads=""
f85c88f3 416AC_ARG_WITH(aufs-threads,
8075a4da
FC
417 AS_HELP_STRING([--with-aufs-threads=N_THREADS],
418 [Tune the number of worker threads for the aufs object store.]), [
419case $withval in
a3310b77 420 [[0-9]]*)
50fbcbd6 421 squid_opt_aufs_threads=$withval
a3310b77 422 ;;
423 *)
8b0d8e31 424 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
a3310b77 425 ;;
426 esac
427])
8075a4da 428if test -n "$squid_opt_aufs_threads"; then
50fbcbd6
FC
429 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
430 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
8075a4da 431 [Defines how many threads aufs uses for I/O])
cd748f27 432fi
433
50fbcbd6 434AC_ARG_WITH(dl, AS_HELP_STRING([--with-dl],[Use dynamic linking]))
8154dd82 435if test "$with_dl" = "yes"; then
eed82608 436 AC_MSG_NOTICE([With dl])
8154dd82 437fi
f85c88f3 438
d235bc84 439AC_MSG_CHECKING([for DiskIO modules to be enabled])
50fbcbd6 440squid_disk_module_candidates=""
8075a4da 441squid_opt_enable_diskio="auto" #values: no, yes, "auto"(=yes+detect modules)
2513178d 442AC_ARG_ENABLE(disk-io,
50fbcbd6
FC
443 AS_HELP_STRING([--enable-disk-io="list of modules"],
444 [Build support for the list of disk I/O modules.
445 Set without a value or omitted, all available modules will be built.
446 See src/DiskIO for a list of available modules, or
447 Programmers Guide section on DiskIO
8075a4da
FC
448 for details on how to build your custom disk module]), [
449case $enableval in
2513178d 450 yes)
8075a4da 451 $(TRUE)
50fbcbd6 452 #do nothing, "auto" is ok
2513178d
AJ
453 ;;
454 no)
8075a4da 455 squid_opt_enable_diskio="no"
2513178d
AJ
456 ;;
457 *)
8075a4da 458 squid_opt_enable_diskio="yes"
50fbcbd6 459 squid_disk_module_candidates=" `echo $enableval| sed -e 's/,/ /g;s/ */ /g'` "
d235bc84 460 SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
2513178d
AJ
461 ;;
462 esac
50fbcbd6
FC
463])
464
d235bc84 465# if requested to autodetect, find out what we have
50fbcbd6 466if test $squid_opt_enable_diskio = "auto"; then
8075a4da 467 squid_opt_enable_diskio="yes"
50fbcbd6 468 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
50fbcbd6 469fi
d235bc84
FC
470
471AC_MSG_RESULT([${squid_disk_module_candidates_output:-none}])
dc299f29 472SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
8075a4da 473SQUID_DEFINE_UNQUOTED([USE_DISKIO],$squid_opt_enable_diskio,
50fbcbd6 474 [DiskIO modules are expected to be available.])
2513178d 475
dc299f29 476
40503c27 477
2513178d 478dnl Some autoconf.h defines we might enable later...
0b163dbb
FC
479AC_ARG_WITH(pthreads,AS_HELP_STRING([--without-pthreads],[Disable POSIX Threads]))
480AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO. Default: auto-detect]))
0d00c98b
FC
481AH_TEMPLATE(USE_DISKIO_AIO, [Whether POSIX AIO support is needed. Automatic])
482AH_TEMPLATE(USE_DISKIO_DISKTHREADS, [Whether pthreads support is needed. Automatic])
2513178d 483USE_AIOPS_WIN32=0
ffa3bad9
FC
484squid_opt_use_aio=
485squid_opt_use_diskthreads=
46577dd1 486AIOLIB=
2513178d
AJ
487
488dnl Setup the module paths etc.
2513178d 489DISK_LIBS=
e2716c57 490DISK_OS_LIBS=
2513178d
AJ
491DISK_MODULES=
492DISK_LINKOBJS=
50fbcbd6 493for module in $squid_disk_module_candidates none; do
d235bc84 494 # maybe not needed
2513178d
AJ
495 if test "$module" = "none"; then
496 continue
497 fi
498 if ! test -d $srcdir/src/DiskIO/$module; then
499 AC_MSG_ERROR(disk-io $module does not exist)
500 fi
501 case "$module" in
502 DiskDaemon)
6312592e 503 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
2513178d
AJ
504 DISK_LIBS="$DISK_LIBS libDiskDaemon.a"
505 DISK_MODULES="$DISK_MODULES DiskDaemon"
506 DISK_PROGRAMS="$DISK_PROGRAMS DiskIO/DiskDaemon/diskd"
507 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskDaemon/DiskDaemonDiskIOModule.o"
508 ;;
509 DiskThreads)
ffa3bad9 510 squid_opt_use_diskthreads="yes"
6312592e 511 LIBPTHREADS=
0b163dbb 512 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
6312592e
AJ
513 if test "$with_pthreads" != "no"; then
514 dnl TODO: this needs to be extended to handle more systems and better
515 dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
516 dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
0b163dbb
FC
517 case "$squid_host_os" in
518 mingw)
6312592e
AJ
519 USE_AIOPS_WIN32=1
520 AC_MSG_NOTICE([Windows threads support automatically enabled])
521 ;;
0b163dbb 522 freebsd)
6312592e
AJ
523 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
524 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
0b163dbb
FC
525 if test "$GCC" = "yes" -a -z "$PRESET_LDFLAGS" ; then
526 LDFLAGS="$LDFLAGS -pthread"
6312592e
AJ
527 fi
528 ;;
0b163dbb 529 solaris)
6312592e
AJ
530 if test "$GCC" = "yes" ; then
531 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
532 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
ffa3bad9 533 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"],
6312592e 534 [ AC_MSG_NOTICE(pthread library required but cannot be found.)
ffa3bad9 535 squid_opt_use_diskthreads="no"
6312592e
AJ
536 ])
537 else
538 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
539 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
540 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
40503c27
FC
541 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
542 LIBPTHREADS="" #in LIBS
543 ],[
544 AC_MSG_NOTICE(pthread library required but cannot be found.)
545 squid_opt_use_diskthreads="no"
546 ])
6312592e
AJ
547 fi
548 ;;
549 *)
550 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
551 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
0b163dbb 552 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"],
6312592e 553 [ AC_MSG_NOTICE(pthread library required but cannot be found.)
ffa3bad9 554 squid_opt_use_diskthreads="no"
6312592e
AJ
555 ])
556 ;;
557 esac
2513178d 558 else
6312592e 559 AC_MSG_NOTICE([Native pthreads support manually disabled.])
ffa3bad9 560 squid_opt_use_diskthreads="no"
2513178d 561 fi
ffa3bad9 562 if test "$squid_opt_use_diskthreads" = "yes" ; then
6312592e 563 AC_DEFINE(USE_DISKIO_DISKTHREADS, 1, [Whether pthreads support is needed. Automatic])
2513178d 564 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
e2716c57
HN
565 DISK_LIBS="$DISK_LIBS libDiskThreads.a"
566 DISK_OS_LIBS="$DISK_OS_LIBS $LIBPTHREADS"
2513178d
AJ
567 DISK_MODULES="$DISK_MODULES DiskThreads"
568 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskThreads/DiskThreadsDiskIOModule.o"
569 else
6312592e
AJ
570 AC_DEFINE(USE_DISKIO_DISKTHREADS, 0, [Whether pthreads support is needed. Automatic])
571 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
0b163dbb 572 SQUID_STATE_ROLLBACK([diskthreads_state])
2513178d
AJ
573 fi
574 ;;
575
576 AIO)
2513178d 577 dnl Check for POSIX AIO availability
ffa3bad9 578 squid_opt_use_aio="yes"
46577dd1 579 AIOLIB=
2513178d
AJ
580 if test "$with_aio" != "no"; then
581 have_aio_header=no
582 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
583 dnl On some systems POSIX AIO functions are in librt
584 dnl On some systems POSIX AIO functions are in libaio
46577dd1 585 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
2513178d 586 dnl Enable AIO if the library and headers are found
46577dd1 587 if test "$AIOLIB" != "" && test "$have_aio_header" = "yes"; then
2513178d 588 AC_MSG_NOTICE([Native POSIX AIO support detected.])
ffa3bad9 589 squid_opt_use_aio="yes"
2513178d
AJ
590 else
591 dnl Windows does things differently. We provide wrappers.
592 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
593 case "$host_os" in
594 mingw|mingw32)
ffa3bad9 595 squid_opt_use_aio="yes"
2513178d
AJ
596 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
597 ;;
598 *)
599 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
ffa3bad9 600 squid_opt_use_aio="no"
2513178d
AJ
601 ;;
602 esac
603 fi
604 else
605 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
ffa3bad9 606 squid_opt_use_aio="no"
2513178d
AJ
607 fi
608 dnl Use the POSIX AIO pieces if we actually need them.
ffa3bad9 609 if test "$squid_opt_use_aio" = "yes" ; then
2513178d
AJ
610 AC_DEFINE(USE_DISKIO_AIO, 1, [Whether POSIX AIO support is needed. Automatic])
611 DISK_MODULES="$DISK_MODULES AIO"
46577dd1 612 DISK_LIBS="$DISK_LIBS libAIO.a"
2513178d
AJ
613 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/AIO/AIODiskIOModule.o"
614 case "$host_os" in
615 mingw|mingw32)
616 USE_AIO_WIN32=1
617 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
618 ;;
619 *)
620 AC_MSG_NOTICE([Enabling AIO DiskIO module])
e2716c57 621 DISK_OS_LIBS="$DISK_OS_LIBS $AIOLIB"
2513178d
AJ
622 ;;
623 esac
624 else
3cf1e8b6 625 AC_DEFINE(USE_DISKIO_AIO, 0, [Whether POSIX AIO support is needed. Automatic])
2513178d
AJ
626 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
627 fi
628 ;;
629
630 Blocking)
2513178d
AJ
631 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
632 DISK_LIBS="$DISK_LIBS libBlocking.a"
633 DISK_MODULES="$DISK_MODULES Blocking"
634 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/Blocking/BlockingDiskIOModule.o"
635 ;;
636
637 *)
638 AC_MSG_NOTICE([Enabling $module DiskIO module])
639 DISK_LIBS="$DISK_LIBS lib${module}.a"
640 DISK_MODULES="$DISK_MODULES ${module}"
641 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/${module}/${module}DiskIOModule.o"
642 ;;
643 esac
644done
645AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
646AC_SUBST(DISK_MODULES)
647AC_SUBST(DISK_LIBS)
648AC_SUBST(DISK_PROGRAMS)
649AC_SUBST(DISK_LINKOBJS)
e2716c57 650AC_SUBST(DISK_OS_LIBS)
2513178d
AJ
651AM_CONDITIONAL([USE_AIOPS_WIN32], [test "$USE_AIOPS_WIN32" = 1])
652AM_CONDITIONAL([USE_AIO_WIN32], [test "$USE_AIO_WIN32" = 1])
653
654
655dnl Check what Storage formats are wanted.
656dnl This version will error out with a message saying why if a required DiskIO is missing.
dc299f29 657squid_opt_enable_storeio=auto
d235bc84
FC
658AC_ARG_ENABLE([storeio],
659 AS_HELP_STRING([--enable-storeio="list of modules"],
660 [Build support for the list of store I/O modules.
18cc92fb
FC
661 The default is only to build the "ufs" module.
662 See src/fs for a list of available modules, or
663 Programmers Guide section <not yet written>
664 for details on how to build your custom store module]),
cd748f27 665[ case $enableval in
666 yes)
dc299f29 667 squid_opt_enable_storeio=auto
cd748f27 668 ;;
669 no)
dc299f29 670 squid_opt_enable_storeio=no
cd748f27 671 ;;
1c690e30 672 *)
dc299f29 673 squid_opt_enable_storeio=yes
d235bc84 674 squid_storeio_module_candidates="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
80f756db
FC
675 # ufs is really always needed as it has low-level routines
676 # if it's a dupe it will be cleaned-up later
677 squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
cd748f27 678 ;;
679 esac
cd748f27 680])
dc299f29
FC
681if test "$squid_opt_enable_storeio" = "auto"; then
682 squid_opt_enable_storeio=yes
d235bc84
FC
683 AC_MSG_CHECKING([for available StoreIO modules])
684 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
defb3257 685 # disable coss
7eb77a5f 686 squid_storeio_module_candidates=`echo $squid_storeio_module_candidates|sed 's/coss//'`
d235bc84
FC
687 AC_MSG_RESULT([$squid_storeio_module_candidates])
688fi
689
dc299f29
FC
690SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
691SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
692AC_MSG_NOTICE([Store modules built: $squid_storeio_module_candidates])
693
694for fs in $squid_storeio_module_candidates none; do
8154dd82 695 case "$fs" in
696 diskd)
80f756db
FC
697 if test "$squid_disk_module_candidates_Blocking" != "yes" -a \
698 "$squid_disk_module_candidates_DiskDaemon" != "yes" ; then
699 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
2513178d 700 fi
8154dd82 701 ;;
702 aufs)
80f756db
FC
703 if test "$squid_disk_module_candidates_Blocking" != "yes" -a \
704 "$squid_disk_module_candidates_DiskThreads" != "yes" ; then
705 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
2513178d 706 fi
8154dd82 707 ;;
708 coss)
dc299f29 709 AC_MSG_WARN([COSS Support is not stable yet in Squid-3. Please do not use.\a])
dc299f29 710 if ! test "$squid_disk_module_candidates_AIO" = "yes"; then
2513178d
AJ
711 AC_MSG_ERROR([COSS requires POSIX AIO which is not available.])
712 fi
3256ae73 713 dnl
714 dnl Automake om MinGW needs explicit exe extension
715 dnl for STORE_TESTS substition
716 dnl
082a5e7a 717 STORE_TESTS="$STORE_TESTS tests/testCoss$EXEEXT"
718 ;;
d3b3ab85 719 ufs)
082a5e7a 720 STORE_TESTS="$STORE_TESTS tests/testUfs$EXEEXT"
8154dd82 721 esac
a2794549 722done
d3b3ab85 723
6d1c1ab1 724dnl TODO: FIXME What are those for? They seem to be never be defined. Kinkie
7b5b7ba8
CT
725AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
726AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
727AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
728AH_TEMPLATE(HAVE_FS_COSS, "Define to 1 if coss filesystem module is build")
729
730
dc299f29 731dnl got final squid_storeio_module_candidates, build library lists
b66455ff
AR
732dnl This list will not be needed when each fs library has its own Makefile
733STORE_LIBS_TO_BUILD=
734dnl File system libraries to link executables with.
735dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
736STORE_LIBS_TO_ADD=
dc299f29 737for fs in $squid_storeio_module_candidates; do
7b5b7ba8
CT
738 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
739 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
6d1c1ab1
FC
740 SQUID_TOUPPER_VAR_CONTENTS([fs])
741 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
b66455ff
AR
742done
743
744AC_SUBST(STORE_LIBS_TO_BUILD)
745AC_SUBST(STORE_LIBS_TO_ADD)
082a5e7a 746AC_SUBST(STORE_TESTS)
a2794549 747
24a04df9
AJ
748
749dnl At lest one removal policy is always needed.
750dnl 'lru' removal policy is currently hard-coded by name for tests
751dnl so we must set it as default.
752REPL_POLICIES="lru"
d9180414 753AC_ARG_ENABLE(removal-policies,
56ffc413
FC
754 AS_HELP_STRING([--enable-removal-policies="list of policies"],
755 [Build support for the list of removal policies.
18cc92fb
FC
756 The default is only to build the "lru" module.
757 See src/repl for a list of available modules, or
758 Programmers Guide section 9.9 for details on how
759 to build your custom policy]),
6a566b9c 760[ case $enableval in
761 yes)
5069fb38 762 SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES])
6a566b9c 763 ;;
764 no)
765 ;;
1c690e30 766 *)
767 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
6a566b9c 768 ;;
769 esac
6a566b9c 770])
1c690e30 771if test -n "$REPL_POLICIES"; then
56ffc413 772 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
5069fb38 773 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
1c690e30 774 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
775 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
776fi
6a566b9c 777AC_SUBST(REPL_POLICIES)
6a566b9c 778AC_SUBST(REPL_OBJS)
f71946fc 779AC_SUBST(REPL_LIBS)
6a566b9c 780
d1da2d1f 781AM_CONDITIONAL(ENABLE_PINGER, false)
e5f4e1b0 782AC_ARG_ENABLE(icmp,
62979ab1 783 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),
e5f4e1b0 784[ if test "$enableval" = "yes" ; then
eed82608 785 AC_MSG_NOTICE([ICMP enabled])
8e62bf65 786 AC_DEFINE(USE_ICMP,1,[Define to use Squid's ICMP and Network Measurement features (highly recommended!)])
d1da2d1f 787 AM_CONDITIONAL(ENABLE_PINGER, true)
e5f4e1b0 788 fi
789])
790
a2794549 791AM_CONDITIONAL(USE_DELAY_POOLS, false)
d9180414 792AC_ARG_ENABLE(delay-pools,
62979ab1 793 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),
e5f4e1b0 794[ if test "$enableval" = "yes" ; then
eed82608 795 AC_MSG_NOTICE([Delay pools enabled])
6a9f6389 796 AC_DEFINE([DELAY_POOLS],1,[Traffic management via "delay pools".])
797 AM_CONDITIONAL(USE_DELAY_POOLS, true,)
e5f4e1b0 798 fi
799])
800
5fa840c3 801dnl disable generic/common adaptation support by default
5069fb38 802squid_opt_use_adaptation=no
5fa840c3 803
5069fb38 804squid_opt_use_esi=yes
7eb77a5f
FC
805AH_TEMPLATE([USE_SQUID_ESI],
806 [Define to enable the ESI processor and Surrogate header support])
43ae1d95 807AC_ARG_ENABLE(esi,
7eb77a5f 808 AS_HELP_STRING([--enable-esi],
5069fb38 809 [Enable ESI for accelerators. Benefits from expat or libxml2.
7eb77a5f 810 Enabling ESI will cause squid reverse proxies to be capable
5069fb38
FC
811 of the Edge Acceleration Specification (www.esi.org).]),
812 [squid_opt_use_esi=$enableval], [squid_opt_use_esi=no])
88bfe098
AJ
813HAVE_LIBEXPAT=0
814EXPATLIB=
815HAVE_LIBXML2=0
816XMLLIB=
5069fb38 817if test "$squid_opt_use_esi" = "yes" ; then
3473acb1 818 AC_MSG_NOTICE([Enabling ESI processor and Surrogate header support.])
7eb77a5f
FC
819 AC_DEFINE(USE_SQUID_ESI,1,
820 [Compile the ESI processor and Surrogate header support])
821else
8075a4da 822 AC_MSG_NOTICE([Disabling ESI processor])
7eb77a5f 823fi
88bfe098 824
7eb77a5f
FC
825# ESI support libraries: expat
826AC_ARG_WITH(expat, AS_HELP_STRING([--without-expat],[Do not use expat for ESI. Default: auto-detect]))
5069fb38 827if test "$squid_opt_use_esi" = "yes" -a "$with_expat" != "no" ; then
7eb77a5f
FC
828 AC_CHECK_LIB([expat], [main], [EXPATLIB="-lexpat"; HAVE_LIBEXPAT=1])
829 AC_CHECK_HEADERS([expat.h])
830 AC_DEFINE_UNQUOTED(HAVE_LIBEXPAT, $HAVE_LIBEXPAT, [Define to 1 if you have the expat library])
831 if test "$with_expat" = "yes" && test "$HAVE_LIBEXPAT" != "1" ; then
832 AC_MSG_ERROR([Required library expat is not able to be found.])
23df48fd 833 fi
7eb77a5f 834fi
ad32c661 835
7eb77a5f 836AC_ARG_WITH(libxml2, AS_HELP_STRING([--without-libxml2],[Do not use libxml2 for ESI. Default: auto-detect]))
5069fb38 837if test "$squid_opt_use_esi" = "yes" -a "$with_libxml2" != "no" ; then
7eb77a5f
FC
838 AC_CHECK_LIB([xml2], [main], [XMLLIB="-lxml2"; HAVE_LIBXML2=1])
839 dnl Find the main header and include path...
840 AC_CHECK_HEADERS([libxml/parser.h], [], [
841 SAVED_CPPFLAGS="$CPPFLAGS"
842 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
843 unset ac_cv_header_libxml_parser_h
844 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include=yes], [])
845 CPPFLAGS="$SAVED_CPPFLAGS"
846 ])
847 if test "x$ac_cv_libxml2_include" = "xyes"; then
848 SQUID_CXXFLAGS="-I/usr/include/libxml2 $SQUID_CXXFLAGS"
849 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
850 fi
851 dnl Now that we know where to look find the other headers...
852 AC_CHECK_HEADERS(libxml/HTMLparser.h libxml/HTMLtree.h)
853 AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
854 if test "$with_libxml2" = "yes" && test "$HAVE_LIBXML2" != "1" ; then
855 AC_MSG_ERROR([Required library libxml2 is not able to be found.])
856 fi
43ae1d95 857fi
7eb77a5f 858
5069fb38 859AM_CONDITIONAL(USE_ESI, test "$squid_opt_use_esi" = "yes")
88bfe098
AJ
860AM_CONDITIONAL(HAVE_LIBEXPAT, test $HAVE_LIBEXPAT = 1)
861AC_SUBST(EXPATLIB)
862AM_CONDITIONAL(HAVE_LIBXML2, test $HAVE_LIBXML2 = 1)
863AC_SUBST(XMLLIB)
43ae1d95 864
8075a4da 865# icap argument handling
51952383 866AC_ARG_ENABLE(icap-client,
62979ab1 867 AS_HELP_STRING([--enable-icap-client],[Enable the ICAP client.]),
8075a4da
FC
868 [squid_opt_use_icap_client=$enableval], [squid_opt_use_icap_client=no])
869SQUID_DEFINE_UNQUOTED([ICAP_CLIENT],$squid_opt_use_icap_client,
870 [Enable ICAP client features in Squid])
871AM_CONDITIONAL(USE_ICAP_CLIENT, [test "$squid_opt_use_icap_client" = "yes" ])
5069fb38 872if test "$squid_opt_use_icap_client" = "yes" ; then
1f3c65fc 873 ICAP_LIBS="icap/libicap.la"
5069fb38 874 squid_opt_use_adaptation=yes
51952383 875else
c21ad0f5 876 ICAP_LIBS=""
51952383 877fi
c21ad0f5 878AC_SUBST(ICAP_LIBS)
51952383 879
5069fb38 880squid_opt_use_ecap=1
3e7b6055
AR
881AC_MSG_CHECKING(whether to support eCAP)
882AC_ARG_ENABLE(ecap,
8075a4da
FC
883 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]), [
884 case "${enableval}" in
885 yes|no) squid_opt_use_ecap=$enableval ;;
886 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
887 esac
888AC_MSG_RESULT([$squid_opt_use_ecap, explicitly])
889 ], [
5069fb38
FC
890 squid_opt_use_ecap=no;
891 AC_MSG_RESULT([$squid_opt_use_ecap, implicitly])
3e7b6055
AR
892 ]
893)
894
895dnl Perform configuration consistency checks for eCAP
b61a58df 896ECAPLIB=""
5069fb38 897if test $squid_opt_use_ecap = yes;
3e7b6055 898then
5fa840c3 899 dnl eCAP support requires loadable modules, which are enabled by default
3e7b6055
AR
900 if test "$use_loadable_modules" != "yes"
901 then
945980c0 902 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.]);
3e7b6055 903 fi
4cfba571
AR
904
905 dnl eCAP support requires libecap
906 AC_CHECK_LIB([ecap], [main],
b61a58df 907 [ECAPLIB="-lecap"],
591e6db0 908 [AC_MSG_FAILURE([eCAP support requires libecap library, but no usable library was found])]
4cfba571 909 )
3e7b6055
AR
910fi
911
5069fb38
FC
912AM_CONDITIONAL(USE_ECAP, test $squid_opt_use_ecap = yes)
913if test $squid_opt_use_ecap = yes;
3e7b6055
AR
914then
915 AC_DEFINE(USE_ECAP,1,[Enable eCAP support])
1f3c65fc 916 ECAP_LIBS="ecap/libecap.la $ECAP_LIBS"
5069fb38 917 squid_opt_use_adaptation=yes
3e7b6055 918else
5fa840c3 919 AC_DEFINE(USE_ECAP,0,[Disable eCAP support])
3e7b6055
AR
920 ECAP_LIBS=""
921fi
b61a58df 922dnl convenience library
3e7b6055 923AC_SUBST(ECAP_LIBS)
b61a58df
AJ
924dnl -lecap if needed
925AC_SUBST(ECAPLIB)
3e7b6055 926
3e7b6055 927
5fa840c3 928dnl enable adaptation if requested by specific adaptation mechanisms
5069fb38
FC
929AM_CONDITIONAL(USE_ADAPTATION, test $squid_opt_use_adaptation = yes)
930if test $squid_opt_use_adaptation = yes
5fa840c3
AR
931then
932 AC_DEFINE(USE_ADAPTATION,1,[common adaptation support])
933 ADAPTATION_LIBS="adaptation/libadaptation.la"
51952383 934else
5fa840c3
AR
935 AC_DEFINE(USE_ADAPTATION,0,[common adaptation support])
936 ADAPTATION_LIBS=""
51952383 937fi
5fa840c3 938AC_SUBST(ADAPTATION_LIBS)
3e7b6055
AR
939
940
0961c811 941dnl This is a developer only option. Developers know how to set defines
942dnl
943dnl AC_ARG_ENABLE(mem-gen-trace,
944dnl [ --enable-mem-gen-trace Do trace of memory stuff],
945dnl [ if test "$enableval" = "yes" ; then
eed82608 946dnl AC_MSG_NOTICE([Memory trace (to file) enabled])
6a9f6389 947dnl AC_DEFINE(MEM_GEN_TRACE,1,[Define for log file trace of mem alloc/free])
5069fb38
FC
948dnl fi
949dnl ])
950
36a97e19 951
d9180414 952AC_ARG_ENABLE(useragent-log,
8075a4da
FC
953 AS_HELP_STRING([--enable-useragent-log],[Enable logging of User-Agent header]), [
954 if test "$enableval" = "yes" ; then
eed82608 955 AC_MSG_NOTICE([User-Agent logging enabled])
5069fb38 956 AC_DEFINE(USE_USERAGENT_LOG,1,
8075a4da 957 [If you want to log User-Agent request header values, define this.])
e5f4e1b0 958 fi
959])
960
dfca7e1a 961AC_ARG_ENABLE(referer-log,
62979ab1 962 AS_HELP_STRING([--enable-referer-log],[Enable logging of Referer header]),
dfca7e1a 963[ if test "$enableval" = "yes" ; then
eed82608 964 AC_MSG_NOTICE([Referer logging enabled])
5069fb38
FC
965 AC_DEFINE(USE_REFERER_LOG,1,
966 [If you want to log Referer request header values, define this.
967 By default, they are written to referer.log in the Squid log directory.])
dfca7e1a 968 fi
969])
970
8075a4da 971squid_opt_use_wccp="yes"
5069fb38 972AC_ARG_ENABLE(wccp,
8075a4da
FC
973 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]), [
974if test "$enableval" = "no" ; then
975 squid_opt_use_wccp="no"
320e9f36 976 fi
5069fb38 977])
8075a4da
FC
978AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $squid_opt_use_wccp])
979SQUID_DEFINE_UNQUOTED(USE_WCCP, $squid_opt_use_wccp, [Define to enable WCCP])
0b0cfcf2 980
8075a4da 981squid_opt_use_wccp_v2="yes"
0b0cfcf2 982AC_ARG_ENABLE(wccpv2,
8075a4da
FC
983 AS_HELP_STRING([--disable-wccpv2],[Disable Web Cache Coordination V2 Protocol]), [
984if test "$enableval" = "no" ; then
985 squid_opt_use_wccp_v2=yes
0b0cfcf2 986 fi
987])
8075a4da
FC
988AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $squid_opt_use_wccp_v2])
989SQUID_DEFINE_UNQUOTED(USE_WCCPv2,$squid_opt_use_wccp_v2,[Define to enable WCCP V2])
320e9f36 990
20ad76ab 991
8075a4da 992squid_opt_kill_parent="no"
d9180414 993AC_ARG_ENABLE(kill-parent-hack,
8075a4da
FC
994 AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]), [
995 if test "$enableval" = "yes" ; then
996 squid_opt_kill_parent="yes"
e5f4e1b0 997 fi
998])
8075a4da
FC
999AC_MSG_NOTICE([Kill parent on shutdown hack enabled: $squid_opt_kill_parent])
1000SQUID_DEFINE_UNQUOTED(KILL_PARENT_OPT,$squid_opt_kill_parent,
20ad76ab
FC
1001 [A dangerous feature which causes Squid to kill its parent process
1002 (presumably the RunCache script) upon receipt of SIGTERM or SIGINT.
1003 Use with caution.])
1004
e5f4e1b0 1005
af1e01a8 1006squid_opt_enable_snmp="yes"
e5f4e1b0 1007AC_ARG_ENABLE(snmp,
8efb08bc
FC
1008 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
1009 if test "$enableval" = "no" ; then
eed82608 1010 AC_MSG_NOTICE([SNMP monitoring disabled])
af1e01a8 1011 squid_opt_enable_snmp="no"
87630341 1012 fi
1013])
af1e01a8 1014if test "$squid_opt_enable_snmp" = "yes"; then
63705952 1015 SNMPLIB='../snmplib/libsnmp.a'
e5f4e1b0 1016 makesnmplib=snmplib
87630341 1017fi
8efb08bc
FC
1018SQUID_DEFINE_UNQUOTED(SQUID_SNMP,$squid_opt_enable_snmp,
1019 [Define to enable SNMP monitoring of Squid])
af1e01a8 1020AM_CONDITIONAL(USE_SNMP, [test "$squid_opt_enable_snmp" = "yes"])
e5f4e1b0 1021AC_SUBST(SNMPLIB)
e5f4e1b0 1022AC_SUBST(makesnmplib)
1023
d9180414 1024AC_ARG_ENABLE(cachemgr-hostname,
5069fb38
FC
1025 AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
1026 [Make cachemgr.cgi default to this host.
86f53af2 1027 If unspecified, uses the name of the build-host]),
e5f4e1b0 1028[ case $enableval in
1029 yes)
6a9f6389 1030 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1031 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
eed82608 1032 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
e5f4e1b0 1033 ;;
1034 no)
1035 : # Nothing to do..
1036 ;;
1037 *)
1038 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
eed82608 1039 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
e5f4e1b0 1040 ;;
1041 esac
1042])
1043
ee0927b6 1044AM_CONDITIONAL(USE_SQUID_EUI, false)
5069fb38 1045squid_opt_use_eui="yes"
ee0927b6 1046AC_ARG_ENABLE(eui,
a98c2da5 1047 AS_HELP_STRING([--disable-eui],[Enable use of ARP / MAC/ EUI (ether address)]),
5069fb38
FC
1048 [squid_opt_use_eui="$enableval"])
1049if test "$squid_opt_use_eui" = "yes" ; then
ee0927b6 1050 AC_MSG_NOTICE([EUI controls enabled (ether address)])
5069fb38
FC
1051 case "$squid_host_os" in
1052 linux|solaris|freebsd|openbsd|netbsd)
1053 $(TRUE)
074bf084 1054 ;;
5069fb38 1055 cygwin|mingw)
ee0927b6 1056 EUILIB="-liphlpapi"
5700029a 1057 ;;
933cc58d 1058 *)
ee0927b6 1059 AC_MSG_WARN([EUI support probably won't work on $host.])
933cc58d 1060 ;;
1061 esac
ee0927b6
AJ
1062 AC_CHECK_HEADERS( \
1063 Iphlpapi.h \
1064 net/if.h \
1065 net/if_arp.h \
1066 net/if_dl.h \
1067 net/route.h \
1068 netinet/if_ether.h \
1069 sys/sockio.h \
1070 sys/sysctl.h \
1071 sys/ioctl.h \
1072 )
5069fb38 1073 AC_DEFINE(USE_SQUID_EUI,1,[Define this to include code which lets you use ethernet hardware addresses. This code uses API initially defined in 4.4-BSD.])
ee0927b6 1074 AM_CONDITIONAL(USE_SQUID_EUI, true)
a98c2da5
AJ
1075else
1076 AC_MSG_NOTICE([EUI controls disabled (ether address)])
1077fi
e5f4e1b0 1078
87630341 1079USE_HTCP=true
a2794549 1080AM_CONDITIONAL(ENABLE_HTCP, false)
74075210 1081AC_ARG_ENABLE(htcp,
62979ab1 1082 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]),
87630341 1083[ if test "$enableval" = "no" ; then
eed82608 1084 AC_MSG_NOTICE([HTCP support disabled])
b4b8b6da 1085 fi
74075210 1086])
5069fb38
FC
1087if test "$USE_HTCP" = "true"; then
1088 AC_DEFINE(USE_HTCP,1,
1089 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
87630341 1090fi
5069fb38 1091AM_CONDITIONAL(ENABLE_HTCP, [test "$USE_HTCP" = "true"])
a2794549 1092
3d4022fa 1093dnl SSL is not enabled by default.
a2794549 1094AM_CONDITIONAL(ENABLE_SSL, false)
74075210 1095
3d4022fa 1096dnl Default is to use OpenSSL when available
1f7c9178 1097AC_ARG_ENABLE(ssl,
62979ab1 1098 AS_HELP_STRING([--enable-ssl],[Enable ssl gatewaying support using OpenSSL]),
1f7c9178 1099[ if test "$enableval" != "no"; then
eed82608 1100 AC_MSG_NOTICE([SSL gatewaying using OpenSSL enabled])
6a9f6389 1101 AC_DEFINE(USE_SSL,1,[Define this to include code for SSL encryption.])
a2794549 1102 AM_CONDITIONAL(ENABLE_SSL, true)
5069fb38 1103 if test "$squid_host_os" = "mingw" ; then
ee86c79b 1104 SSLLIB='-lssleay32 -leay32 -lgdi32'
5069fb38 1105 else
4b26fae9 1106 SSLLIB='-lssl -lcrypto'
5069fb38 1107 fi
1f7c9178 1108 USE_OPENSSL=1
1109 fi
1110])
1111
3d4022fa 1112dnl User may specify OpenSSL is needed from a non-standard location
1f7c9178 1113AC_ARG_WITH(openssl,
62979ab1 1114 AS_HELP_STRING([--with-openssl{=PATH}],[Compile with the OpenSSL libraries. The path to
86f53af2
FC
1115 the OpenSSL development libraries and headers
1116 installation can be specified if outside of the
1117 system standard directories]),
1f7c9178 1118[
46ce628c 1119 case "$with_openssl" in
1f7c9178 1120 yes)
1121 USE_OPENSSL=1
1122 ;;
1123 no)
1124 USE_OPENSSL=
1125 ;;
1126 *)
46ce628c 1127 SSLLIBDIR="$with_openssl/lib"
bcce53ce 1128 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1f7c9178 1129 USE_OPENSSL=1
1130 esac
1131])
1f7c9178 1132if test -n "$USE_OPENSSL"; then
eed82608 1133 AC_MSG_NOTICE([Using OpenSSL MD5 implementation])
6a9f6389 1134 AC_DEFINE(USE_OPENSSL,1,[Define this to make use of the OpenSSL libraries for MD5 calculation rather than Squid's own MD5 implementation or if building with SSL encryption (USE_SSL)])
1f7c9178 1135 if test -z "$SSLLIB"; then
1136 SSLLIB="-lcrypto" # for MD5 routines
1137 fi
f11555e0 1138 dnl This is a workaround for RedHat 9 brain damage..
1139 if test -d /usr/kerberos/include && test -z "$SSLLIBDIR" && test -f /usr/include/openssl/kssl.h; then
eed82608 1140 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
f11555e0 1141 SSLLIBDIR="/usr/kerberos/lib"
1142 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1143 fi
1f7c9178 1144fi
1145if test -n "$SSLLIBDIR"; then
1146 SSLLIB="-L$SSLLIBDIR $SSLLIB"
1147fi
1f7c9178 1148AC_SUBST(SSLLIB)
1149
3d4022fa 1150
02749868 1151AC_ARG_ENABLE(forw-via-db,
62979ab1 1152 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]),
02749868 1153[ if test "$enableval" = "yes" ; then
eed82608 1154 AC_MSG_NOTICE([FORW-VIA enabled])
6a9f6389 1155 AC_DEFINE(FORW_VIA_DB,1,[Enable Forw/Via database])
02749868 1156 fi
1157])
1158
6cfa8966 1159AC_ARG_ENABLE(cache-digests,
62979ab1 1160 AS_HELP_STRING([--enable-cache-digests],[Use Cache Digests.
86f53af2 1161 See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
484f2ebc 1162[ if test "$enableval" = "yes" ; then
eed82608 1163 AC_MSG_NOTICE([Cache Disgests enabled])
6a9f6389 1164 AC_DEFINE(USE_CACHE_DIGESTS,1,[Use Cache Digests for locating objects in neighbor caches. This code is still semi-experimental.])
484f2ebc 1165 fi
1166])
1167
cd748f27 1168dnl Size of COSS memory buffer
1169AC_ARG_WITH(coss-membuf-size,
62979ab1 1170 AS_HELP_STRING([--with-coss-membuf-size=size],[COSS membuf size (default 1048576 bytes)]),
8b0d8e31 1171[ if test -n "$withval" -a "x$withval" != "xno" ; then
eed82608 1172 AC_MSG_NOTICE([Setting COSS membuf size to $with_coss_membuf_size bytes])
6a9f6389 1173 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $with_coss_membuf_size,[Define if you want to set the COSS membuf size])
cd748f27 1174 fi
1175])
1176
1b3db6d9 1177dnl check for netio plugin stuff
6564c397 1178
9bb83c8b 1179dnl Enable poll()
bf53a520 1180squid_opt_enable_poll=auto
9bb83c8b 1181AC_ARG_ENABLE(poll,
62979ab1 1182 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
1b3db6d9 1183[
c68e9c6b 1184 case "$enableval" in
1185 yes)
8075a4da 1186 squid_opt_io_loop_engine="poll"
bf53a520 1187 squid_opt_enable_poll=yes
c68e9c6b 1188 ;;
1189 no)
bf53a520 1190 squid_opt_enable_poll=no
c68e9c6b 1191 ;;
1192 esac
9bb83c8b 1193])
bf53a520 1194AC_MSG_NOTICE([enabling the use of poll() for net I/O: $squid_opt_enable_poll])
9bb83c8b 1195
1b3db6d9 1196dnl Enable select()
bf53a520 1197squid_opt_enable_select=auto
1b3db6d9 1198AC_ARG_ENABLE(select,
62979ab1 1199 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),
1b3db6d9 1200[
1201 case "$enableval" in
1202 yes)
8075a4da 1203 squid_opt_io_loop_engine="select"
bf53a520 1204 squid_opt_enable_select=yes
1b3db6d9 1205 ;;
1206 no)
bf53a520 1207 squid_opt_enable_select=no
1b3db6d9 1208 ;;
1209 esac
1210])
bf53a520 1211AC_MSG_NOTICE([enabling the use of select() for net I/O: $squid_opt_enable_select])
1b3db6d9 1212
1213dnl Enable kqueue()
6564c397 1214dnl kqueue support is still experiemntal and unstable. Not enabled by default.
bf53a520 1215squid_opt_enable_kqueue="no"
1b3db6d9 1216AC_ARG_ENABLE(kqueue,
62979ab1 1217 AS_HELP_STRING([--enable-kqueue],[Enable kqueue(2) support (experimental).]),
1b3db6d9 1218[
1219 case "$enableval" in
1220 yes)
8075a4da 1221 squid_opt_io_loop_engine="kqueue"
11f11b5c
AJ
1222 AC_CHECK_HEADERS([sys/event.h],[],
1223 [ AC_MSG_ERROR([kqueue support requires sys/event.h header file.]) ])
bf53a520 1224 squid_opt_enable_kqueue=yes
1b3db6d9 1225 ;;
1226 no)
bf53a520 1227 squid_opt_enable_kqueue=no
1b3db6d9 1228 ;;
bf53a520 1229 esac
1b3db6d9 1230])
bf53a520 1231AC_MSG_NOTICE([enabling the use of kqueue for net I/O: $squid_opt_enable_kqueue])
1b3db6d9 1232
a46d2c0e 1233dnl Enable epoll()
bf53a520 1234squid_opt_enable_epoll="auto"
a46d2c0e 1235AC_ARG_ENABLE(epoll,
62979ab1 1236 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
a46d2c0e 1237[
1238 case "$enableval" in
1239 yes)
8075a4da 1240 squid_opt_io_loop_engine="epoll"
bf53a520 1241 squid_opt_enable_epoll="yes"
a46d2c0e 1242 ;;
1243 no)
bf53a520 1244 squid_opt_enable_epoll="no"
a46d2c0e 1245 ;;
1246esac
1247])
bf53a520
FC
1248AC_MSG_NOTICE([enabling the use of epoll for net I/O: $squid_opt_enable_epoll])
1249
2ca8b332 1250dnl auto-detect and verify epoll header and library present and working
bf53a520 1251if test "$squid_opt_enable_epoll" != "no" ; then
2ca8b332 1252
ad32c661 1253 # Check for libepoll
bf53a520 1254 EPOLL_LIBS=""
ad32c661
AJ
1255 AC_CHECK_LIB(epoll, epoll_ctl, [EPOLL_LIBS="-lepoll"])
1256 AC_SUBST(EPOLL_LIBS)
1257
2ca8b332
AJ
1258 dnl on some systems it is provided by libc
1259 dnl not to worry, the working test below will catch them
1260 dnl and we don't want to force additional libraries
1261
1262
ad32c661 1263 # Check for epoll_ctl, may need -lepoll
af1e01a8 1264 SQUID_STATE_SAVE(squid_epoll_state)
2ca8b332 1265 LIBS="$LIBS $EPOLL_LIBS"
ad32c661 1266 AC_CHECK_FUNCS(epoll_ctl)
af1e01a8 1267 SQUID_STATE_ROLLBACK(squid_epoll_state)
a46d2c0e 1268
2ca8b332 1269 dnl epoll requires sys/epoll.h
98d13964 1270 AC_CHECK_HEADERS([sys/epoll.h])
ad32c661
AJ
1271
1272 dnl Verify that epoll really works
1273 if test $ac_cv_func_epoll_ctl = yes; then
af1e01a8 1274 SQUID_CHECK_EPOLL
ad32c661 1275 fi
2ca8b332 1276
af1e01a8 1277 if test "$squid_opt_enable_epoll" = "yes" && test "$squid_cv_epoll_works" = "no" ; then
2ca8b332
AJ
1278 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
1279 fi
ad32c661 1280fi
a46d2c0e 1281
72fd085a 1282dnl Disable HTTP violations
af1e01a8 1283squid_opt_enable_http_violations=1
72fd085a 1284AC_ARG_ENABLE(http-violations,
af1e01a8
FC
1285 AS_HELP_STRING([--disable-http-violations],
1286 [This allows you to remove code which is known to
ddfc433e 1287 violate the HTTP protocol specification.]),
72fd085a 1288[ if test "$enableval" = "no" ; then
eed82608 1289 AC_MSG_NOTICE([Disabling HTTP Violations])
af1e01a8 1290 squid_opt_enable_http_violations=0
72fd085a 1291 fi
1292])
af1e01a8 1293AC_DEFINE_UNQUOTED(HTTP_VIOLATIONS, $squid_opt_enable_http_violations,[If defined, squid will enable code which volates the HTTP standard specification])
72fd085a 1294
68075fad 1295dnl Enable IPFW Transparent Proxy
af1e01a8 1296squid_opt_enable_ipfw_transparent=0
68075fad 1297AC_ARG_ENABLE(ipfw-transparent,
62979ab1 1298 AS_HELP_STRING([--enable-ipfw-transparent],[Enable Transparent Proxy support for systems
2277004e 1299 using FreeBSD IPFW-style firewalling.]),
68075fad 1300[ if test "$enableval" = "yes" ; then
eed82608 1301 AC_MSG_NOTICE([IPFW Transparent Proxy enabled])
af1e01a8 1302 squid_opt_enable_ipfw_transparent=1
68075fad 1303 fi
1304])
af1e01a8 1305AC_DEFINE_UNQUOTED(IPFW_TRANSPARENT,$squid_opt_enable_ipfw_transparent,
2277004e 1306 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
68075fad 1307
5cafc1d6 1308dnl Enable IP-Filter Transparent Proxy
2277004e
FC
1309AH_TEMPLATE(IPF_TRANSPARENT,
1310 [Enable support for Transparent Proxy on systems using IPF-style firewalling])
20ad76ab 1311squid_opt_ipf_transparent=no
5cafc1d6 1312AC_ARG_ENABLE(ipf-transparent,
2277004e
FC
1313 AS_HELP_STRING([--enable-ipf-transparent],
1314 [Enable Transparent Proxy support for OSes using IPFilter-style firewalling])
5cafc1d6 1315[ if test "$enableval" = "yes" ; then
eed82608 1316 AC_MSG_NOTICE([IP-Filter Transparent Proxy enabled])
20ad76ab 1317 squid_opt_ipf_transparent="yes"
2277004e 1318 #will be AC_DEFINE'd later, after checking for appropriate infrastructure
5cafc1d6 1319 fi
1320])
1321
2b0dd4ac 1322dnl Enable PF Transparent Proxy
2277004e
FC
1323AH_TEMPLATE(PF_TRANSPARENT,
1324 [Enable support for Transparent Proxy on systems using OpenBSD-style PF firewalling])
2b0dd4ac 1325AC_ARG_ENABLE(pf-transparent,
2277004e
FC
1326 AS_HELP_STRING([--enable-pf-transparent],
1327 [Enable Transparent Proxy support for systems using PF network address redirection.]),
2b0dd4ac 1328[ if test "$enableval" = "yes" ; then
eed82608 1329 AC_MSG_NOTICE([PF Transparent Proxy enabled])
20ad76ab 1330 squid_opt_pf_transparent="yes"
2277004e 1331 #will be AC_DEFINE'd later, after checking for appropriate infrastructure
2b0dd4ac 1332 fi
1333])
1334
96f08e2d
FC
1335# Enable Linux Netfilter Transparent Proxy
1336squid_opt_linux_netfilter="auto"
20ad76ab 1337AH_TEMPLATE(LINUX_NETFILTER,[Enable support for Transparent Proxy on Linux via Netfilter])
d852fbad 1338AC_ARG_ENABLE(linux-netfilter,
20ad76ab 1339 AS_HELP_STRING([--enable-linux-netfilter],
96f08e2d
FC
1340 [Enable Transparent Proxy support for Linux (Netfilter)]), [
1341squid_opt_linux_netfilter=$enableval
1342AC_MSG_NOTICE([Linux Transparent Proxy (Netfilter) support requested: $squid_opt_linux_netfilter])
1343#will be AC_DEFINE'd later, after checking for appropriate infrastructure
d852fbad 1344])
1345
bb7b5fd0 1346dnl Enable Large file support
2df6213e 1347buildmodel=""
2277004e 1348squid_opt_enable_large_files=no
2df6213e 1349
1350AC_ARG_WITH(large-files,
62979ab1 1351 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]),
8b0d8e31 1352[ if test "x$withval" = "xyes"; then
2277004e 1353 squid_opt_enable_large_files=yes
bb7b5fd0 1354 fi
1355])
1356
2df6213e 1357dnl UNIX Build environment
62979ab1 1358dnl AS_HELP_STRING is not suited here because it doesn't allow to specify newlines
2df6213e 1359AC_ARG_WITH(build-environment,
1360[ --with-build-environment=model
1361 The build environment to use. Normally one of
1362 POSIX_V6_ILP32_OFF32 32 bits
1363 POSIX_V6_ILP32_OFFBIG 32 bits with large file support
1364 POSIX_V6_LP64_OFF64 64 bits
1365 POSIX_V6_LPBIG_OFFBIG large pointers and files
1366 XBS5_ILP32_OFF32 32 bits (legacy)
1367 XBS5_ILP32_OFFBIG 32 bits with large file support (legacy)
1368 XBS5_LP64_OFF64 64 bits (legacy)
1369 XBS5_LPBIG_OFFBIG large pointers and files (legacy)
1370 default The default for your OS],
1371[ case "$withval" in
1372 yes|no)
2277004e 1373 AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])
2df6213e 1374 ;;
1375 *)
1376 buildmodel="$withval"
1377 ;;
1378 esac
1379])
1380
2277004e
FC
1381if test "$squid_opt_enable_large_files" = "yes" -a -z "$buildmodel"; then
1382 for model in POSIX_V6_LPBIG_OFFBIG XBS5_LPBIG_OFFBIG POSIX_V6_LP64_OFF64 XBS5_LP64_OFF64 POSIX_V6_ILP32_OFFBIG XBS5_ILP32_OFFBIG; do
1383 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
1384 buildmodel=$model
1385 break
1386 fi
1387 done
1388 if test -z "$buildmodel"; then
1389 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
1390 fi
9b8002de
HN
1391fi
1392case "$buildmodel" in
1393default|"")
2277004e 1394 if test "$squid_opt_enable_large_files" = "yes" ; then
eed82608 1395 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
2df6213e 1396 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
cca81db1 1397 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
2df6213e 1398 fi
9b8002de
HN
1399 ;;
1400*)
eed82608 1401 AC_MSG_NOTICE([Using $buildmodel build environment])
2df6213e 1402 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
1403 : # All fine
1404 else
8b0d8e31 1405 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
2df6213e 1406 fi
1407 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
cca81db1 1408 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
2df6213e 1409 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1410 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
2277004e
FC
1411 if "$squid_host_os" = "solaris" ; then
1412
1413# On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1414# for LDFLAGS -xarch=generic64, but:
1415# "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1416# For gcc "-xarch=generic64" must be replaced with "-m64"
1417# The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
1418 if test "$GCC" = "yes"; then
1419 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
1420 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
1421 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
1422 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
1423 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1424 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1425 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
1426 fi
1427 AC_MSG_NOTICE([Removing -Usun on $host])
1428 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
1429 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
1430 fi
9b8002de 1431esac
2df6213e 1432
7b0a0d1f 1433dnl Enable Linux transparent proxy support for obsolete TPROXY
20ad76ab 1434AH_TEMPLATE(LINUX_TPROXY2,[Enable real Transparent Proxy support for Netfilter TPROXY v2])
96f08e2d 1435squid_opt_linux_tproxy2="no"
e8cca4ac 1436AC_ARG_ENABLE(linux-tproxy,
2277004e 1437 AS_HELP_STRING([--enable-linux-tproxy],
96f08e2d
FC
1438 [Enable real Transparent Proxy support for Netfilter TPROXY (version 2).]), [
1439 if test "$enableval" = "yes" ; then
1440 squid_opt_linux_tproxy2="yes"
1441 AC_MSG_NOTICE([Linux Transparent Proxy (TPROXY) requested])
f1e0717c 1442 fi
96f08e2d 1443 #AC_DEFINE will be handled later
f1e0717c 1444])
fc68f6b1 1445
a2794549 1446AM_CONDITIONAL(MAKE_LEAKFINDER, false)
5d620373 1447dnl Enable Leak Finding Functions
1448AC_ARG_ENABLE(leakfinder,
62979ab1 1449 AS_HELP_STRING([--enable-leakfinder],[Enable Leak Finding code. Enabling this alone
19b4777c
FC
1450 does nothing; you also have to modify the source
1451 code to use the leak finding functions. Probably
1452 Useful for hackers only.]),
5d620373 1453[ if test "$enableval" = "yes" ; then
eed82608 1454 AC_MSG_NOTICE([Leak-Finding enabled])
6a9f6389 1455 AC_DEFINE(USE_LEAKFINDER,1,[Enable code for assisting in finding memory leaks. Hacker stuff only.])
a2794549 1456 AM_CONDITIONAL(MAKE_LEAKFINDER, true)
5d620373 1457 fi
1458])
5d620373 1459
8075a4da 1460AH_TEMPLATE([FOLLOW_X_FORWARDED_FOR],[Enable following X-Forwarded-For headers])
8efb08bc 1461squid_opt_follow_xff="yes"
3d674977 1462AC_ARG_ENABLE(follow-x-forwarded-for,
62979ab1 1463 AS_HELP_STRING([--enable-follow-x-forwarded-for],[Enable support for following the X-Forwarded-For
19b4777c
FC
1464 HTTP header to try to find the IP address of the
1465 original or indirect client when a request has
8075a4da
FC
1466 been forwarded through other proxies.]), [
1467if test "$enableval" = "no" ; then
8efb08bc 1468 squid_opt_follow_xff="no"
3d674977 1469fi
8075a4da
FC
1470])
1471AC_MSG_NOTICE([Support for X-Forwarded-For enabled: $squid_opt_follow_xff])
8efb08bc 1472SQUID_DEFINE_UNQUOTED([FOLLOW_X_FORWARDED_FOR],$squid_opt_follow_xff)
3d674977 1473
8075a4da 1474AH_TEMPLATE(USE_IDENT,[Support for Ident (RFC 931) lookups])
8efb08bc 1475squid_opt_use_ident="yes"
3898f57f 1476AC_ARG_ENABLE(ident-lookups,
8075a4da
FC
1477 AS_HELP_STRING([--disable-ident-lookups],
1478 [Remove code that supports performing Ident (RFC 931) lookups.]), [
1479if test "$enableval" = "no" ; then
8efb08bc 1480 squid_opt_use_ident="no"
14b32873 1481fi
8075a4da
FC
1482])
1483AC_MSG_NOTICE([Support for Ident lookups enabled: $squid_opt_use_ident])
8efb08bc 1484SQUID_DEFINE_UNQUOTED(USE_IDENT,$squid_opt_use_ident)
3898f57f 1485
8efb08bc
FC
1486squid_opt_use_dnsserver="no"
1487AH_TEMPLATE(USE_DNSSERVERS,
1488 [Use dnsserver processes instead of the internal DNS protocol support])
eb824054 1489AC_ARG_ENABLE(internal-dns,
8efb08bc
FC
1490 AS_HELP_STRING([--disable-internal-dns],
1491 [Prevents Squid from directly sending and receiving DNS messages,
1492 and instead enables the old external 'dnsserver' processes.]), [
1493 if test "$enableval" = "no" ; then
eed82608 1494 AC_MSG_WARN([Disabling Internal DNS queries])
8efb08bc
FC
1495 squid_opt_use_dnsserver="yes"
1496 AC_DEFINE(USE_DNSSERVERS,1)
1497 else
1498 AC_DEFINE(USE_DNSSERVERS,0)
eb824054 1499 fi
1500])
8efb08bc
FC
1501AM_CONDITIONAL([USE_DNSSERVER],[test "$squid_opt_use_dnsserver" = "yes" ])
1502
1503dnl ************** KK HERE *************
eb824054 1504
9d798391 1505dnl Select Default hosts file location
1506AC_ARG_ENABLE(default-hostsfile,
62979ab1 1507 AS_HELP_STRING([--enable-default-hostsfile=path],[Select default location for hosts file.
19b4777c 1508 See hosts_file directive in squid.conf for details]),
9d798391 1509[
59ad6d31 1510 if test "$enableval" != "none" -a "$enableval" != "no" ; then
20ad76ab
FC
1511 if test -f $enableval; then
1512 OPT_DEFAULT_HOSTS=$enableval
9d798391 1513 else
20ad76ab 1514 AC_MSG_WARN([Unable to find $enableval])
9d798391 1515 fi
20ad76ab
FC
1516 else
1517 OPT_DEFAULT_HOSTS="none"
1518 fi
1519 AC_MSG_NOTICE([Default hosts file set to: $enableval])
9d798391 1520],[OPT_DEFAULT_HOSTS="/etc/hosts"])
1521AC_SUBST(OPT_DEFAULT_HOSTS)
1522
94439e4e 1523dnl Select auth schemes modules to build
1524AC_ARG_ENABLE(auth,
62979ab1 1525 AS_HELP_STRING([--enable-auth="list of auth scheme modules"],[Build support for the list of authentication schemes.
19b4777c
FC
1526 The default is to build support for the Basic scheme.
1527 See src/auth for a list of available modules, or
1528 Programmers Guide section authentication schemes
1529 for details on how to build your custom auth scheme
1530 module]),
94439e4e 1531[ case $enableval in
1532 yes)
1c42c4a1 1533 for dir in $srcdir/src/auth/*; do
1534 module="`basename $dir`"
1c690e30 1535 if test -d "$dir" && test "$module" != CVS; then
1c42c4a1 1536 AUTH_MODULES="$AUTH_MODULES $module"
94439e4e 1537 fi
1538 done
1539 ;;
1540 no)
1541 ;;
1c690e30 1542 *)
1543 AUTH_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1544 ;;
94439e4e 1545 esac
1546],
1547[ if test -z "$AUTH_MODULES"; then
6bf4f823 1548 AUTH_MODULES="ntlm basic digest negotiate"
94439e4e 1549 fi
1550])
1c690e30 1551if test -n "$AUTH_MODULES"; then
1552 for module in $AUTH_MODULES; do
1553 if test -d $srcdir/src/auth/$module; then
1554 :
1555 else
8b0d8e31 1556 AC_MSG_ERROR(Auth scheme $module does not exist)
1c690e30 1557 fi
7f18d2bd 1558 eval AUTH_MODULE_${module}=yes
1c690e30 1559 done
eed82608 1560 AC_MSG_NOTICE([Auth scheme modules built: $AUTH_MODULES])
d0571da6 1561else
eed82608 1562 AC_MSG_WARN([Auth scheme modules built: None])
1c690e30 1563fi
2d2b0bb7
AR
1564dnl Authentication libraries to build
1565dnl This list will not be needed when each auth library has its own Makefile
1566AUTH_LIBS_TO_BUILD=
f5691f9c 1567for module in $AUTH_MODULES; do
bcf44a2c 1568 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD lib${module}.la"
f5691f9c 1569done
94439e4e 1570AC_SUBST(AUTH_MODULES)
2d2b0bb7 1571AC_SUBST(AUTH_LIBS_TO_BUILD)
94439e4e 1572
7762106d
FC
1573dnl bundled auth modules, in order to have handy defines for the cppunit testsuite
1574test -n "$AUTH_MODULE_basic" && AC_DEFINE([HAVE_AUTH_MODULE_BASIC],1,[Basic auth module is built])
1575test -n "$AUTH_MODULE_digest" && AC_DEFINE([HAVE_AUTH_MODULE_DIGEST],1,[Digest auth module is built])
1576test -n "$AUTH_MODULE_ntlm" && AC_DEFINE([HAVE_AUTH_MODULE_NTLM],1,[NTLM auth module is built])
1577test -n "$AUTH_MODULE_negotiate" && AC_DEFINE([HAVE_AUTH_MODULE_NEGOTIATE],1,[Negotiate auth module is built])
1578
94439e4e 1579dnl Select basic auth scheme helpers to build
7f18d2bd 1580if test -n "$AUTH_MODULE_basic"; then
1581 BASIC_AUTH_HELPERS="all"
1582fi
94439e4e 1583AC_ARG_ENABLE(basic-auth-helpers,
62979ab1 1584 AS_HELP_STRING([--enable-basic-auth-helpers="list of helpers"],[This option selects which basic scheme proxy_auth
19b4777c
FC
1585 helpers to build and install as part of the normal
1586 build process. For a list of available
1587 helpers see the helpers/basic_auth directory.]),
94439e4e 1588[ case "$enableval" in
7f18d2bd 1589 yes)
1590 BASIC_AUTH_HELPERS="all"
1c690e30 1591 ;;
94439e4e 1592 no)
7f18d2bd 1593 BASIC_AUTH_HELPERS=""
1c690e30 1594 ;;
94439e4e 1595 *)
7f18d2bd 1596 if test -z "$AUTH_MODULE_basic"; then
eed82608 1597 AC_MSG_WARN([Basic auth helpers selected without the basic scheme enabled])
7f18d2bd 1598 fi
1c690e30 1599 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1600 ;;
94439e4e 1601 esac
1602])
7f18d2bd 1603if test "$BASIC_AUTH_HELPERS" = "all" ; then
1604 BASIC_AUTH_HELPERS=""
1605 for dir in $srcdir/helpers/basic_auth/*; do
1606 helper="`basename $dir`"
1607 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1608 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $helper"
ce7c6bba
AJ
1609 elif test -d $srcdir/helpers/basic_auth/$helper ; then
1610 AC_MSG_NOTICE([Basic auth helper $helper ... found but cannot be built])
7f18d2bd 1611 fi
1612 done
1613fi
fc83a946 1614if test -n "$BASIC_AUTH_HELPERS"; then
20d8bfe4 1615 for helper in $BASIC_AUTH_HELPERS; do
1c690e30 1616 if test -d $srcdir/helpers/basic_auth/$helper; then
2adff954 1617 case $helper in
1618 SASL)
1619 require_sasl=yes
1620 ;;
1621 esac
20d8bfe4 1622 else
8b0d8e31 1623 AC_MSG_ERROR(Basic auth helper $helper does not exist)
20d8bfe4 1624 fi
1625 done
eed82608 1626 AC_MSG_NOTICE([Basic auth helpers built: $BASIC_AUTH_HELPERS])
94439e4e 1627fi
fc83a946 1628AC_SUBST(BASIC_AUTH_HELPERS)
94439e4e 1629
1630dnl Select ntlm auth helpers to build
7f18d2bd 1631if test -n "$AUTH_MODULE_ntlm"; then
1632 NTLM_AUTH_HELPERS="all"
1633fi
94439e4e 1634AC_ARG_ENABLE(ntlm-auth-helpers,
62979ab1 1635 AS_HELP_STRING([--enable-ntlm-auth-helpers="list of helpers"],[This option selects which proxy_auth ntlm helpers
19b4777c
FC
1636 to build and install as part of the normal build
1637 process. For a list of available helpers see
1638 the helpers/ntlm_auth directory.]),
380f0a87 1639[ case "$enableval" in
1640 yes)
7f18d2bd 1641 NTLM_AUTH_HELPERS="all"
1c690e30 1642 ;;
380f0a87 1643 no)
7f18d2bd 1644 NTLM_AUTH_HELPERS=""
1c690e30 1645 ;;
380f0a87 1646 *)
1c690e30 1647 NTLM_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1648 ;;
380f0a87 1649 esac
1650])
7f18d2bd 1651if test "$NTLM_AUTH_HELPERS" = "all" ; then
1652 NTLM_AUTH_HELPERS=""
1653 for dir in $srcdir/helpers/ntlm_auth/*; do
1654 helper="`basename $dir`"
1655 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1656 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $helper"
ce7c6bba
AJ
1657 elif test -d $srcdir/helpers/ntlm_auth/$helper ; then
1658 AC_MSG_NOTICE([NTLM auth helper $helper ... found but cannot be built])
7f18d2bd 1659 fi
1660 done
1661fi
94439e4e 1662if test -n "$NTLM_AUTH_HELPERS"; then
20d8bfe4 1663 for helper in $NTLM_AUTH_HELPERS; do
1c690e30 1664 if test -d $srcdir/helpers/ntlm_auth/$helper; then
1665 :
20d8bfe4 1666 else
8b0d8e31 1667 AC_MSG_ERROR(NTLM Auth helper $helper does not exist)
20d8bfe4 1668 fi
1669 done
eed82608 1670 AC_MSG_NOTICE([NTLM auth helpers built: $NTLM_AUTH_HELPERS])
380f0a87 1671fi
94439e4e 1672AC_SUBST(NTLM_AUTH_HELPERS)
1673
6e785d85 1674dnl Select negotiate auth helpers to build
7f18d2bd 1675if test -n "$AUTH_MODULE_negotiate"; then
1676 NEGOTIATE_AUTH_HELPERS="all"
1677fi
6e785d85 1678AC_ARG_ENABLE(negotiate-auth-helpers,
62979ab1 1679 AS_HELP_STRING([--enable-negotiate-auth-helpers="list of helpers"],[This option selects which proxy_auth negotiate helpers
e702812e
FC
1680 to build and install as part of the normal build
1681 process. For a list of available helpers see
1682 the helpers/negotiate_auth directory.]),
6e785d85 1683[ case "$enableval" in
1684 yes)
7f18d2bd 1685 NEGOTIATE_AUTH_HELPERS="all"
6e785d85 1686 ;;
1687 no)
7f18d2bd 1688 NEGOTIATE_AUTH_HELPERS=""
6e785d85 1689 ;;
1690 *)
1691 NEGOTIATE_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1692 ;;
1693 esac
1694])
7f18d2bd 1695if test "$NEGOTIATE_AUTH_HELPERS" = "all" ; then
1696 NEGOTIATE_AUTH_HELPERS=""
1697 for dir in $srcdir/helpers/negotiate_auth/*; do
1698 helper="`basename $dir`"
1699 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1700 NEGOTIATE_AUTH_HELPERS="$NEGOTIATE_AUTH_HELPERS $helper"
ce7c6bba
AJ
1701 elif test -d $srcdir/helpers/negotiate_auth/$helper ; then
1702 AC_MSG_NOTICE([Negotiate auth helper $helper ... found but cannot be built])
7f18d2bd 1703 fi
1704 done
1705fi
6e785d85 1706if test -n "$NEGOTIATE_AUTH_HELPERS"; then
1707 for helper in $NEGOTIATE_AUTH_HELPERS; do
1708 if test -d $srcdir/helpers/negotiate_auth/$helper; then
1709 :
1710 else
8b0d8e31 1711 AC_MSG_ERROR(Negotiate Auth helper $helper does not exist)
6e785d85 1712 fi
1713 done
eed82608 1714 AC_MSG_NOTICE([Negotiate auth helpers built: $NEGOTIATE_AUTH_HELPERS])
6e785d85 1715fi
1716AC_SUBST(NEGOTIATE_AUTH_HELPERS)
1717
2d70df72 1718dnl Select digest auth scheme helpers to build
7f18d2bd 1719if test -n "$AUTH_MODULE_digest"; then
1720 DIGEST_AUTH_HELPERS=all
1721fi
2d70df72 1722AC_ARG_ENABLE(digest-auth-helpers,
62979ab1 1723 AS_HELP_STRING([--enable-digest-auth-helpers="list of helpers"],[This option selects which digest scheme authentication
e702812e
FC
1724 helpers to build and install as part of the normal build
1725 process. For a list of available helpers see the
1726 helpers/digest_auth directory.]),
2d70df72 1727[ case "$enableval" in
1728 yes)
7f18d2bd 1729 DIGEST_AUTH_HELPERS="all"
1c690e30 1730 ;;
2d70df72 1731 no)
7f18d2bd 1732 DIGEST_AUTH_HELPERS=""
1c690e30 1733 ;;
2d70df72 1734 *)
1c690e30 1735 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1736 ;;
2d70df72 1737 esac
1738])
7f18d2bd 1739if test "$DIGEST_AUTH_HELPERS" = "all" ; then
1740 DIGEST_AUTH_HELPERS=""
1741 for dir in $srcdir/helpers/digest_auth/*; do
1742 helper="`basename $dir`"
1743 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1744 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper"
ce7c6bba
AJ
1745 elif test -d $srcdir/helpers/digest_auth/$helper ; then
1746 AC_MSG_NOTICE([Digest auth helper $helper ... found but cannot be built])
7f18d2bd 1747 fi
1748 done
1749fi
2d70df72 1750if test -n "$DIGEST_AUTH_HELPERS"; then
1daefc1a 1751 for helper in $DIGEST_AUTH_HELPERS; do
1752 if test -f $srcdir/helpers/digest_auth/$helper/Makefile.in; then
1753 :
1754 else
8b0d8e31 1755 AC_MSG_ERROR(digest auth helper $helper does not exist)
1daefc1a 1756 fi
1757 done
eed82608 1758 AC_MSG_NOTICE([Digest auth helpers built: $DIGEST_AUTH_HELPERS])
2d70df72 1759fi
1760AC_SUBST(DIGEST_AUTH_HELPERS)
380f0a87 1761
82b7abe3
AJ
1762dnl Select logging daemon helpers to build
1763LOG_DAEMON_HELPERS="all"
1764AC_ARG_ENABLE(log-daemon-helpers,
1765 AS_HELP_STRING([--enable-log-daemon-auth-helpers="list of helpers"],[This option selects which logging daemon
1766 helpers to build and install as part of the normal build process. For a list of available
1767 helpers see the helpers/log_daemon directory.]),
1768[ case "$enableval" in
1769 yes)
1770 LOG_DAEMON_HELPERS="all"
1771 ;;
1772 no)
1773 LOG_DAEMON_HELPERS=""
1774 ;;
1775 *)
1776 LOG_DAEMON_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1777 ;;
1778 esac
1779])
1780if test "$LOG_DAEMON_HELPERS" = "all" ; then
1781 LOG_DAEMON_HELPERS=""
1782 for dir in $srcdir/helpers/log_daemon/*; do
1783 helper="`basename $dir`"
1784 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1785 LOG_DAEMON_HELPERS="$LOG_DAEMON_HELPERS $helper"
1786 elif test -d $srcdir/helpers/log_daemon/$helper ; then
1787 AC_MSG_NOTICE([Log daemon auth helper $helper ... found but cannot be built])
1788 fi
1789 done
1790fi
1791if test -n "$LOG_DAEMON_HELPERS"; then
1792 for helper in $LOG_DAEMON_HELPERS; do
1793 if test -d $srcdir/helpers/log_daemon/$helper; then
1794 :
1795 else
1796 AC_MSG_ERROR(Log daemon helper $helper does not exist)
1797 fi
1798 done
1799 AC_MSG_NOTICE([Log daemon helpers built: $LOG_DAEMON_HELPERS])
1800fi
1801AC_SUBST(LOG_DAEMON_HELPERS)
1802
3d62cc61
FC
1803dnl
1804dnl Check Kerberos/GSSAPI/SPNEGO
1805dnl
9ca29d23
AJ
1806SAVED_CPPFLAGS=$CPPFLAGS
1807SAVED_LIBS=$LIBS
1808AC_ARG_WITH(krb5-config,
1809 [ --with-krb5-config=PATH specify path to krb5-config @<:@default=detect@:>@],
1810[ if test "$withval" = "yes"; then
1811 unset krb5confpath
1812 elif test "$withval" != "no"; then
1813 krb5confpath=$withval
1814 else
1815 krb5confpath=no
1816 fi
1817])
1818if test x"$krb5confpath" != xno; then
1819 if test x"$krb5confpath" != x; then
1820 if ! test -x "$krb5confpath"; then
1821 AC_MSG_WARN([krb5-config '$krb5confpath' not executable, ignoring])
1822 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no)
1823 krb5confpath=krb5-config
1824 fi
1825 krb5_config_path=`dirname $krb5confpath`
1826 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no, $krb5_config_path)
1827 else
1828 AC_CHECK_PROG(ac_krb5_config,krb5-config,yes,no)
1829 krb5confpath=krb5-config
1830 fi
1831fi
1832if test "$ac_krb5_config" = "yes" ; then
cf99ae25
AJ
1833 ac_heimdal="`$krb5confpath --version 2>/dev/null | grep -i heimdal`"
1834 ac_solaris="`$krb5confpath --version 2>/dev/null | grep -i solaris`"
9ca29d23
AJ
1835 if test "x$ac_heimdal" != "x" ; then
1836 AC_DEFINE(HAVE_HEIMDAL_KERBEROS,1,[Define to 1 if you have Heimdal Kerberos])
1837 else
1838 AC_DEFINE(HAVE_MIT_KERBEROS,1,[Define to 1 if you have MIT Kerberos])
1839 fi
1840 if test "$ac_solaris" != "" ; then
cf99ae25
AJ
1841 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1842 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
9ca29d23
AJ
1843 KRB5INCS="-I/usr/include/gssapi $KRB5INCS"
1844 KRB5LIBS="-L/usr/lib -R/usr/lib -lgss -lresolv -lsocket -lnsl $KRB5LIBS"
1845 else
cf99ae25
AJ
1846 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1847 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
9ca29d23
AJ
1848 KRB5INCS="`$krb5confpath --cflags gssapi 2>/dev/null` $KRB5INCS"
1849 KRB5LIBS="`$krb5confpath --libs gssapi 2>/dev/null` $KRB5LIBS"
1850 fi
1851 CPPFLAGS="$CPPFLAGS $KRB5INCS"
1852 LIBS="$LIBS $KRB5LIBS"
1853 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1854 if test "x$ac_heimdal" == "x" ; then
1855 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
3d62cc61 1856 AC_CHECK_HEADERS(profile.h)
9ca29d23 1857 fi
d14e78e9 1858 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
3d62cc61
FC
1859 AC_CACHE_CHECK([for broken Solaris krb5.h],squid_cv_broken_krb5_h, [
1860 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
9ca29d23 1861#include <krb5.h>
3d62cc61
FC
1862int i;
1863]])], [ squid_cv_broken_krb5_h=no ],
1864 [ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1865#if defined(__cplusplus)
1866#define KRB5INT_BEGIN_DECLS extern "C" {
1867#define KRB5INT_END_DECLS
1868KRB5INT_BEGIN_DECLS
1869#endif
1870#include <krb5.h>
1871int i;
1872]])], [ squid_cv_broken_krb5_h=yes ], [ squid_cv_broken_krb5_h=no ])])])
1873 if test x"$squid_cv_broken_krb5_h" = x"yes"; then
1874 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if krb5.h is broken for C++])
1875 fi
9ca29d23 1876
3d62cc61
FC
1877 ac_com_error_message=no
1878 if test "x$ac_cv_header_com_err_h" == "xyes" ; then
1879 AC_EGREP_HEADER(error_message,com_err.h,ac_com_error_message=yes)
1880 elif test "x$ac_cv_header_et_com_err_h" == "xyes" ; then
1881 AC_EGREP_HEADER(error_message,et/com_err.h,ac_com_error_message=yes)
1882 fi
1883 AC_CACHE_CHECK([for max_skew in struct krb5_context],squid_cv_max_skew_context, [
1884 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1885#if HAVE_BROKEN_SOLARIS_KRB5_H
1886#if defined(__cplusplus)
1887#define KRB5INT_BEGIN_DECLS extern "C" {
1888#define KRB5INT_END_DECLS
1889KRB5INT_BEGIN_DECLS
1890#endif
1891#endif
1892#include <krb5.h>
1893krb5_context kc; kc->max_skew = 1;
1894]])],[ squid_cv_max_skew_context=yes ], [ squid_cv_max_skew_context=no ])])
1895 if test x"$squid_cv_max_skew_context" = x"yes"; then
1896 AC_DEFINE(HAVE_MAX_SKEW_IN_KRB5_CONTEXT, 1, [Define to 1 if max_skew in struct krb5_context])
1897 fi
1898
1899 if test `echo $KRB5LIBS | grep -c com_err` -ne 0 -a "x$ac_com_error_message" == "xyes" ; then
1900 AC_CHECK_LIB(com_err,error_message,
1901 AC_DEFINE(HAVE_ERROR_MESSAGE,1,[Define to 1 if you have error_message]),)
1902 elif test "x$ac_com_error_message" == "xyes" ; then
1903 AC_CHECK_LIB(krb5,error_message,
1904 AC_DEFINE(HAVE_ERROR_MESSAGE,1,[Define to 1 if you have error_message]),)
9ca29d23 1905 fi
cf99ae25
AJ
1906 AC_CHECK_LIB(krb5,krb5_get_err_text,
1907 AC_DEFINE(HAVE_KRB5_GET_ERR_TEXT,1,[Define to 1 if you have krb5_get_err_text]),)
1908 AC_CHECK_LIB(krb5,krb5_get_error_message,
1909 AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE,1,[Define to 1 if you have krb5_get_error_message]),)
9ca29d23
AJ
1910 AC_CHECK_LIB(krb5,krb5_kt_free_entry,
1911 AC_DEFINE(HAVE_KRB5_KT_FREE_ENTRY,1,[Define to 1 if you have krb5_kt_free_entry]),)
1912 AC_CHECK_LIB(krb5,krb5_get_init_creds_keytab,
1913 AC_DEFINE(HAVE_GET_INIT_CREDS_KEYTAB,1,[Define to 1 if you have krb5_get_init_creds_keytab]),)
1914 AC_CHECK_LIB(krb5,krb5_get_max_time_skew,
1915 AC_DEFINE(HAVE_KRB5_GET_MAX_TIME_SKEW,1,[Define to 1 if you have krb5_get_max_time_skew]),)
1916 AC_CHECK_LIB(krb5,krb5_get_profile,
1917 AC_DEFINE(HAVE_KRB5_GET_PROFILE,1,[Define to 1 if you have krb5_get_profile]),)
1918 AC_CHECK_LIB(krb5,profile_get_integer,
1919 AC_DEFINE(HAVE_PROFILE_GET_INTEGER,1,[Define to 1 if you have profile_get_integer]),)
1920 AC_CHECK_LIB(krb5,profile_release,
1921 AC_DEFINE(HAVE_PROFILE_RELEASE,1,[Define to 1 if you have profile_release]),)
3d62cc61
FC
1922 AC_CACHE_CHECK([for memory cache], squid_cv_memory_cache, [
1923 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1924#if HAVE_BROKEN_SOLARIS_KRB5_H
1925#if defined(__cplusplus)
1926#define KRB5INT_BEGIN_DECLS extern "C" {
1927#define KRB5INT_END_DECLS
1928KRB5INT_BEGIN_DECLS
1929#endif
1930#endif
9ca29d23
AJ
1931#include<krb5.h>
1932main()
1933{
1934 krb5_context context;
1935 krb5_ccache cc;
1936
1937 krb5_init_context(&context);
1938 return krb5_cc_resolve(context, "MEMORY:test_cache", &cc);
3d62cc61
FC
1939}
1940]])], [ squid_cv_memory_cache=yes ], [ squid_cv_memory_cache=no ])])
1941 if test "$squid_cv_memory_cache" = "yes" ; then
1942 AC_DEFINE(HAVE_KRB5_MEMORY_CACHE,1, [Define to 1 if you have MEMORY: cache support])
1943 fi
1944 AC_CACHE_CHECK([for working gssapi], squid_cv_working_gssapi, [
1945 AC_RUN_IFELSE([AC_LANG_SOURCE([[
9ca29d23
AJ
1946#ifdef HAVE_GSSAPI_GSSAPI_H
1947#include <gssapi/gssapi.h>
1948#elif HAVE_GSSAPI_H
1949#include <gssapi.h>
1950#endif
1951
1952#ifdef HAVE_GSSAPI_GSSAPI_EXT_H
1953#include <gssapi/gssapi_ext.h>
1954#endif
1955
1956#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
1957#include <gssapi/gssapi_krb5.h>
1958#endif
1959
1960#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
1961#include <gssapi/gssapi_generic.h>
1962#endif
1963int
1964main(void)
1965{
1966 OM_uint32 val;
1967 gss_OID_set set;
1968
1969 gss_create_empty_oid_set(&val, &set);
1970
1971 return 0;
1972}
3d62cc61
FC
1973]])], [ squid_cv_working_gssapi=yes ], [ squid_cv_working_gssapi=no ])])
1974 if test "$squid_cv_working_gssapi" = "yes" ; then
1975 AC_DEFINE(HAVE_GSSAPI, 1, [GSSAPI support])
1976 fi
1977
1978 AC_CACHE_CHECK([for spnego support], squid_cv_have_spnego, [
1979 AC_RUN_IFELSE([AC_LANG_SOURCE([[
9ca29d23
AJ
1980#ifdef HAVE_HEIMDAL_KERBEROS
1981#ifdef HAVE_GSSAPI_GSSAPI_H
1982#include <gssapi/gssapi.h>
1983#elif defined(HAVE_GSSAPI_H)
1984#include <gssapi.h>
1985#endif
1986#else
1987#ifdef HAVE_GSSAPI_GSSAPI_H
1988#include <gssapi/gssapi.h>
1989#elif defined(HAVE_GSSAPI_H)
1990#include <gssapi.h>
1991#endif
1992#ifdef HAVE_GSSAPI_GSSAPI_KRB5_H
1993#include <gssapi/gssapi_krb5.h>
1994#endif
1995#ifdef HAVE_GSSAPI_GSSAPI_GENERIC_H
1996#include <gssapi/gssapi_generic.h>
1997#endif
1998#endif
1999#include <string.h>
2000int main(int argc, char *argv[]) {
2001 OM_uint32 major_status,minor_status;
2002 gss_OID_set gss_mech_set;
2003 int i;
2004
2005static gss_OID_desc _gss_mech_spnego = {6, (void *)"\x2b\x06\x01\x05\x05\x02"};
2006gss_OID gss_mech_spnego = &_gss_mech_spnego;
2007
2008 major_status = gss_indicate_mechs( &minor_status, &gss_mech_set);
2009
2010 for (i=0;i<gss_mech_set->count;i++) {
2011 if (!memcmp(gss_mech_set->elements[i].elements,gss_mech_spnego->elements,gss_mech_set->elements[i].length)) {
2012 return 0;
2013 }
2014 }
2015
2016 return 1;
3d62cc61
FC
2017}
2018]])], [ squid_cv_have_spnego=yes ], [ squid_cv_have_spnego=no ])])
2019
2020 if test "$squid_cv_have_spnego" = "yes" ; then
9ca29d23 2021 AC_DEFINE(HAVE_SPNEGO,1, [Define to 1 if you have SPNEGO support])
3d62cc61
FC
2022 fi
2023 AC_CACHE_CHECK([for working krb5], squid_cv_working_krb5, [
2024 AC_RUN_IFELSE([AC_LANG_SOURCE([[
9ca29d23 2025#ifdef HAVE_KRB5_H
3d62cc61
FC
2026#if HAVE_BROKEN_SOLARIS_KRB5_H
2027#if defined(__cplusplus)
2028#define KRB5INT_BEGIN_DECLS extern "C" {
2029#define KRB5INT_END_DECLS
2030KRB5INT_BEGIN_DECLS
2031#endif
2032#endif
9ca29d23
AJ
2033#include <krb5.h>
2034#endif
2035
2036int
2037main(void)
2038{
2039 krb5_context context;
2040
2041 krb5_init_context(&context);
2042
2043 return 0;
2044}
3d62cc61
FC
2045]])], [ squid_cv_working_krb5=yes ], [ squid_cv_working_krb5=no ])])
2046 if test "$squid_cv_working_krb5" = "yes" ; then
2047 AC_DEFINE(HAVE_KRB5, 1, [KRB5 support])
2048 fi
2049
9ca29d23
AJ
2050 LIBS=$SAVED_LIBS
2051 CPPFLAGS=$SAVED_CPPFLAGS
2052 AC_SUBST(KRB5INCS)
2053 AC_SUBST(KRB5LIBS)
2054fi
3d62cc61 2055AM_CONDITIONAL(HAVE_SPNEGO, test x"$squid_cv_have_spnego" = x"yes" )
9ca29d23 2056
6437ac71 2057dnl Enable "NTLM fail open"
2058AC_ARG_ENABLE(ntlm-fail-open,
62979ab1 2059 AS_HELP_STRING([--enable-ntlm-fail-open],[Enable NTLM fail open, where a helper that fails one of the
e702812e
FC
2060 Authentication steps can allow squid to still authenticate
2061 the user.]),
6437ac71 2062[ if test "$enableval" = "yes" ; then
6a9f6389 2063 AC_DEFINE(NTLM_FAIL_OPEN,1,[Define if NTLM is allowed to fail gracefully when a helper has problems. WARNING: This has security implications. DO NOT enable unless you KNOW you need it.])
6437ac71 2064 fi
2065])
2066
c6588c68 2067dnl Select external_acl helpers to build
7f18d2bd 2068EXTERNAL_ACL_HELPERS=all
c6588c68 2069AC_ARG_ENABLE(external-acl-helpers,
62979ab1 2070 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],[This option selects which external_acl helpers to
e702812e
FC
2071 build and install as part of the normal build
2072 process. For a list of available helpers see the
2073 helpers/external_acl directory.]),
c6588c68 2074[ case "$enableval" in
2075 yes)
7f18d2bd 2076 EXTERNAL_ACL_HELPERS=all
1c690e30 2077 ;;
c6588c68 2078 no)
7f18d2bd 2079 EXTERNAL_ACL_HELPERS=""
1c690e30 2080 ;;
c6588c68 2081 *)
1c690e30 2082 EXTERNAL_ACL_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
2083 ;;
c6588c68 2084 esac
2085])
7f18d2bd 2086if test "$EXTERNAL_ACL_HELPERS" = "all" ; then
39ee7289 2087 EXTERNAL_ACL_HELPERS=""
7f18d2bd 2088 for dir in $srcdir/helpers/external_acl/*; do
2089 helper="`basename $dir`"
2090 if test -f $dir/config.test && sh $dir/config.test "$@"; then
2091 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
ce7c6bba
AJ
2092 elif test -d $srcdir/helpers/external_acl/$helper ; then
2093 AC_MSG_NOTICE([External ACL helper $helper ... found but cannot be built])
7f18d2bd 2094 fi
2095 done
2096fi
c6588c68 2097if test -n "$EXTERNAL_ACL_HELPERS"; then
20d8bfe4 2098 for helper in $EXTERNAL_ACL_HELPERS; do
2099 if test -f $srcdir/helpers/external_acl/$helper/Makefile.in; then
2100 :
2101 else
8b0d8e31 2102 AC_MSG_ERROR(external acl helper $helper does not exist)
20d8bfe4 2103 fi
2104 done
eed82608 2105 AC_MSG_NOTICE([External acl helpers built: $EXTERNAL_ACL_HELPERS])
c6588c68 2106fi
2107AC_SUBST(EXTERNAL_ACL_HELPERS)
2108
fdbb3b19
AJ
2109dnl Select url_rewrite helpers to build
2110URL_REWRITE_HELPERS=all
2111AC_ARG_ENABLE(url-rewrite-helpers,
2112 AC_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
2113 [This option selects which url_rewrite helpers to
2114 build and install as part of the normal build
2115 process. For a list of available helpers see the
2116 helpers/url_rewrite directory.]),
2117[ case "$enableval" in
2118 yes)
2119 URL_REWRITE_HELPERS=all
2120 ;;
2121 no)
2122 URL_REWRITE_HELPERS=""
2123 ;;
2124 *)
2125 URL_REWRITE_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
2126 ;;
2127 esac
2128])
2129if test "$URL_REWRITE_HELPERS" = "all" ; then
2130 URL_REWRITE_HELPERS=""
2131 for dir in $srcdir/helpers/url_rewrite/*; do
2132 helper="`basename $dir`"
2133 if test -f $dir/config.test && sh $dir/config.test "$@"; then
2134 URL_REWRITE_HELPERS="$URL_REWRITE_HELPERS $helper"
ce7c6bba
AJ
2135 elif test -d $srcdir/helpers/url_rewrite/$helper ; then
2136 AC_MSG_NOTICE([URL re-write helper $helper ... found but cannot be built])
fdbb3b19
AJ
2137 fi
2138 done
2139fi
2140if test -n "$URL_REWRITE_HELPERS"; then
2141 for helper in $URL_REWRITE_HELPERS; do
2142 if test -f $srcdir/helpers/url_rewrite/$helper/Makefile.in; then
2143 :
2144 else
2145 AC_MSG_ERROR(url_rewrite helper $helper does not exist)
2146 fi
2147 done
2148 AC_MSG_NOTICE([url_rewrite helpers built: $URL_REWRITE_HELPERS])
2149fi
2150AC_SUBST(URL_REWRITE_HELPERS)
2151
2152
3a125142 2153AC_ARG_WITH(valgrind-debug,
62979ab1 2154 AS_HELP_STRING([--with-valgrind-debug],[Include debug instrumentation for use with valgrind]),
b4bab919 2155[ case $withval in
2156 yes)
2157 valgrind=1
2158 ;;
2159 no)
2160 valgrind=
2161 ;;
2162 *)
2163 CPPFLAGS="$CPPFLAGS -I${enableval}/include"
2164 valgrind=1
2165 ;;
2166 esac
2167 if test $valgrind; then
ad32c661
AJ
2168 AC_CHECK_HEADERS(valgrind/memcheck.h,
2169 [ AC_DEFINE(WITH_VALGRIND, 1, [Valgrind memory debugger support])
eed82608
AJ
2170 AC_MSG_NOTICE([Valgrind debug support enabled]) ],
2171 [ AC_MSG_WARN([Valgrind header not found. Valgrind support disabled.]) ]
ad32c661 2172 )
b4bab919 2173 fi
2174])
2175
d96ceb8e 2176dnl Disable "memPools" code
2177AC_ARG_ENABLE(mempools,
62979ab1 2178 AS_HELP_STRING([--disable-mempools],[Disable memPools. Note that this option now simply sets the
e702812e
FC
2179 default behaviour. Specific classes can override this at runtime, and
2180 only lib/MemPool.c needs to be altered to change the squid-wide
2181 default for all classes.]),
d96ceb8e 2182[ if test "$enableval" = "no" ; then
eed82608 2183 AC_MSG_NOTICE([memPools disabled])
6a9f6389 2184 AC_DEFINE(DISABLE_POOLS, 1, [Define if you have problems with memPools and want to disable Pools])
3e0dc9a8 2185 else
2186 AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 2187 fi
3e0dc9a8 2188],
2189[ AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 2190])
2191
0e657244 2192dnl Enable WIN32 Service compile mode
2193AC_ARG_ENABLE(win32-service,
62979ab1 2194 AS_HELP_STRING([--enable-win32-service],[Compile Squid as a WIN32 Service.
e702812e 2195 Works only on MS-Windows platforms (NT and up).]),
0e657244 2196[ if test "$enableval" = "yes" ; then
eed82608 2197 AC_MSG_NOTICE([Enabling WIN32 run service mode])
0e657244 2198 AC_DEFINE(USE_WIN32_SERVICE,1,[Define Windows NT & Windows 2000 run service mode])
2199 fi
2200])
2201
b1485ff8 2202
2adff954 2203dnl Check for Cyrus SASL
2204if test "$require_sasl" = "yes"; then
2205 AC_CHECK_HEADERS(sasl/sasl.h sasl.h)
2206 if test "$ac_cv_header_sasl_sasl_h" = "yes"; then
eed82608 2207 AC_MSG_NOTICE([using SASL2])
2adff954 2208 LIBSASL="-lsasl2"
2209 else
2210 if test "$ac_cv_header_sasl_h" = "yes"; then
eed82608 2211 AC_MSG_NOTICE([using SASL])
2adff954 2212 LIBSASL="-lsasl"
2213 else
8b0d8e31 2214 AC_MSG_ERROR(Neither SASL nor SASL2 found)
2adff954 2215 fi
2216 fi
2217 AC_SUBST(LIBSASL)
2218fi
2219
3c573763 2220dnl Disable "unlinkd" code
fe0810ac 2221AC_ARG_ENABLE(unlinkd,
62979ab1 2222 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]),
fe0810ac 2223[ if test "$enableval" = "no" ; then
3c573763 2224 use_unlinkd=no
fe0810ac 2225 else
3c573763 2226 use_unlinkd=yes
fe0810ac 2227 fi
2228],[
2229 # Here we should probably use some magic depending on the selected
2230 # storage models
3c573763 2231 use_unlinkd=yes
fe0810ac 2232])
3c573763 2233if test "$use_unlinkd" = "yes"; then
eed82608 2234 AC_MSG_NOTICE([unlinkd enabled])
6a9f6389 2235 AC_DEFINE(USE_UNLINKD,1,[Define this if unlinkd is required (strongly recommended for ufs storage type)])
a2794549 2236 AM_CONDITIONAL(ENABLE_UNLINKD, true)
fe0810ac 2237else
eed82608 2238 AC_MSG_NOTICE([unlinkd disabled])
a2794549 2239 AM_CONDITIONAL(ENABLE_UNLINKD, false)
fe0810ac 2240fi
fe0810ac 2241
ce3d30fb 2242dnl Enable backtraces on fatal errors
2243AC_ARG_ENABLE(stacktraces,
62979ab1 2244 AS_HELP_STRING([--enable-stacktraces],[Enable automatic call backtrace on fatal errors]),
ce3d30fb 2245[ if test "$enableval" = "yes" ; then
eed82608 2246 AC_MSG_NOTICE([Enabling automatic stack backtraces on fatal errors])
6a9f6389 2247 AC_DEFINE(PRINT_STACK_TRACE, 1,[Print stacktraces on fatal errors])
ce3d30fb 2248 fi
2249])
2250
88bfe092 2251AM_CONDITIONAL(ENABLE_XPROF_STATS, false)
2252dnl Enable USE_XPROF_STATS
2253AC_ARG_ENABLE(cpu-profiling,
62979ab1 2254 AS_HELP_STRING([--enable-cpu-profiling],[Enable instrumentation to try and understand how CPU power
e702812e
FC
2255 is spent by squid, by enabling specific probes in selected
2256 functions. New probes can only be added by modifying the source code.
2257 It is meant to help developers in optimizing performance
2258 of Squid internal functions.
2259 If you are not developer you shouldn't enable this,
2260 as it slows squid down somewhat. See lib/Profiler.c for more details.]),
88bfe092 2261[ if test "$enableval" = "yes" ; then
eed82608 2262 AC_MSG_NOTICE([Enabling cpu-profiling])
6a9f6389 2263 AC_DEFINE(USE_XPROF_STATS, 1,[Define to enable CPU profiling within Squid])
88bfe092 2264 AM_CONDITIONAL(ENABLE_XPROF_STATS, true)
2265 fi
2266])
2267
f66a9ef4 2268dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
2092c67d 2269AC_ARG_ENABLE(x-accelerator-vary,
62979ab1 2270 AS_HELP_STRING([--enable-x-accelerator-vary],[Enable support for the X-Accelerator-Vary
e702812e
FC
2271 HTTP header. Can be used to indicate
2272 variance within an accelerator setup.
2273 Typically used together with other code
2274 that adds custom HTTP headers to the requests.]),
f66a9ef4 2275[ if test "$enableval" = "yes" ; then
eed82608 2276 AC_MSG_NOTICE([Enabling support for X-Accelerator-Vary])
6a9f6389 2277 AC_DEFINE(X_ACCELERATOR_VARY, 1, [Enable support for the X-Accelerator-Vary HTTP header])
f66a9ef4 2278 fi
2279])
2280
7172612f 2281AC_ARG_ENABLE(zph-qos,
62979ab1 2282 AS_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]),
7172612f 2283[ if test "$enableval" = "yes" ; then
eed82608 2284 AC_MSG_NOTICE([ZPH QOS enabled])
7172612f
AJ
2285 AC_DEFINE(USE_ZPH_QOS,1,
2286 [ Define this to use Squid's ZPH (Zero Penalty Hit) QOS features.
2287 When enabled, Squid will alter TOS field of HIT responses for better QOS on intermediate routing/shaping devices.])
2288 fi
2289])
2290
a41b3435
AJ
2291dnl --with-maxfd present for compatibility with Squid-2.
2292dnl undocumented in ./configure --help to encourage using the Squid-3 directive.
2293AC_ARG_WITH(maxfd,,
2294[
2295 case ${withval} in
2296 [[0-9]]*)
2297 squid_filedescriptors_num=$withval
2298 ;;
2299 *)
2300 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
2301 ;;
2302 esac
2303])
f49be7d1 2304AC_ARG_WITH(filedescriptors,
62979ab1 2305 AS_HELP_STRING([--with-filedescriptors=NUMBER],[Force squid to support NUMBER filedescriptors]),
8b0d8e31
AJ
2306[
2307 case ${withval} in
2308 [[0-9]]*)
2309 squid_filedescriptors_num=$withval
2310 ;;
2311 *)
2312 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
2313 ;;
2314 esac
2315])
f49be7d1 2316
8b5e106b 2317if $CPPUNITCONFIG --help >/dev/null; then
eed82608 2318 AC_MSG_NOTICE([using system installed cppunit])
8b5e106b 2319 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2320 SQUID_CPPUNIT_LA=''
2321 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2322else
eed82608 2323 AC_MSG_WARN([cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail.])
63d03edb 2324 SQUID_CPPUNIT_LA=''
2325 SQUID_CPPUNIT_LIBS=''
2326 SQUID_CPPUNIT_INC=''
f5691f9c 2327fi
8b5e106b 2328
f5691f9c 2329AC_ARG_WITH(cppunit-basedir,
62979ab1 2330 AS_HELP_STRING([--with-cppunit-basedir=PATH],[Path where the cppunit headers are libraries are found
b0e7900f 2331 for unit testing.]),
f5691f9c 2332[ if test -f $withval/include/cppunit/TestCase.h; then
eed82608 2333 AC_MSG_NOTICE([Using cppunit includes from $withval])
f5691f9c 2334 SQUID_CPPUNIT_INC="-I${withval}/include"
2335 else
8b0d8e31 2336 AC_MSG_ERROR(Cannot find cppunit at $withval)
f5691f9c 2337 fi
2338 if test -f $withval/lib/libcppunit.la; then
eed82608 2339 AC_MSG_NOTICE([Using cppunit lib from $withval])
549b1e60 2340 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
8b5e106b 2341 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
f5691f9c 2342 else
8b0d8e31 2343 AC_MSG_ERROR(Cannot find cppunit at $withval)
f5691f9c 2344 fi
f5691f9c 2345])
8b5e106b 2346AC_SUBST(SQUID_CPPUNIT_LIBS)
f5691f9c 2347AC_SUBST(SQUID_CPPUNIT_LA)
2348AC_SUBST(SQUID_CPPUNIT_INC)
f5691f9c 2349
fd9aaa3e 2350# Force some compilers to use ANSI features
2351#
2352case "$host" in
2353 alpha-dec-osf*)
2354 if test "$ac_cv_prog_CC" = "cc" ; then
eed82608 2355 AC_MSG_NOTICE([adding '-std1' to cc args for $host])
fd9aaa3e 2356 CC="cc -std1";
2357 ac_cv_prog_CC="$CC"
2358 fi
2359 ;;
c68e9c6b 2360 *-hp-hpux*)
2361 if test "$ac_cv_prog_CC" = "cc" ; then
eed82608 2362 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
c68e9c6b 2363 CC="cc -Ae";
2364 ac_cv_prog_CC="$CC"
2365 fi
2366 ;;
fd9aaa3e 2367esac
2368
dd56802c 2369
a2794549 2370dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
4e9d8e26 2371
6ad85e8a 2372case "$host" in
2373 *-hp-hpux*)
eed82608 2374 AC_MSG_NOTICE([Disabling 'ranlib' for HP-UX...])
6ad85e8a 2375 RANLIB=":"
2376 ;;
2377esac
2378
090089c4 2379dnl Check for headers
2380AC_HEADER_DIRENT
2381AC_HEADER_STDC
db40ae20 2382
2383AC_CHECK_HEADERS( \
db40ae20 2384 arpa/inet.h \
30a4f2a8 2385 arpa/nameser.h \
9441aa34 2386 assert.h \
db40ae20 2387 bstring.h \
27e059d4 2388 cassert \
db40ae20 2389 crypt.h \
281422f8 2390 cstring \
30a4f2a8 2391 ctype.h \
2392 errno.h \
ce3d30fb 2393 execinfo.h \
db40ae20 2394 fcntl.h \
42ad37af 2395 fnmatch.h \
9c1d8929 2396 getopt.h \
52303a3d 2397 glob.h \
88738790 2398 gnumalloc.h \
30a4f2a8 2399 grp.h \
27e059d4
AJ
2400 iosfwd \
2401 iomanip \
2402 iostream \
5cafc1d6 2403 ip_compat.h \
42b51993 2404 ip_fil_compat.h \
5cafc1d6 2405 ip_fil.h \
2406 ip_nat.h \
dbc5782a 2407 ipl.h \
30a4f2a8 2408 libc.h \
6ad85e8a 2409 limits.h \
d2422105 2410 linux/types.h \
1cc2f840 2411 machine/byte_swap.h \
30a4f2a8 2412 malloc.h \
e0bddc45 2413 math.h \
db40ae20 2414 memory.h \
b075cbb1 2415 mount.h \
30a4f2a8 2416 netdb.h \
db40ae20 2417 netinet/in.h \
cc192b50 2418 netinet/in_systm.h \
42b51993 2419 netinet/ip_fil_compat.h \
1f7c9178 2420 openssl/err.h \
2421 openssl/md5.h \
2422 openssl/ssl.h \
cc192b50 2423 netinet/tcp.h \
a7ad6e4e 2424 openssl/engine.h \
27e059d4 2425 ostream \
4da086c4 2426 paths.h \
dcfe6390 2427 poll.h \
30a4f2a8 2428 pwd.h \
b5e4d7d4 2429 shadow.h \
30a4f2a8 2430 regex.h \
c68e9c6b 2431 sched.h \
30a4f2a8 2432 signal.h \
27e059d4 2433 sstream \
30a4f2a8 2434 stdarg.h \
2435 stddef.h \
27e059d4 2436 stdexcept \
30a4f2a8 2437 stdio.h \
db40ae20 2438 stdlib.h \
27e059d4 2439 string \
db40ae20 2440 string.h \
2441 strings.h \
0a4e8536 2442 sys/bitypes.h \
f9576890 2443 sys/bswap.h \
2444 sys/endian.h \
db40ae20 2445 sys/file.h \
5cafc1d6 2446 sys/ioctl.h \
30a4f2a8 2447 sys/param.h \
62ae0622 2448 sys/prctl.h \
3d4022fa 2449 sys/md5.h \
77e4c0c9 2450 sys/msg.h \
30a4f2a8 2451 sys/resource.h \
db40ae20 2452 sys/select.h\
30a4f2a8 2453 sys/socket.h \
2454 sys/stat.h \
b075cbb1 2455 sys/statvfs.h \
3c641669 2456 syscall.h \
30a4f2a8 2457 sys/syscall.h \
db40ae20 2458 sys/time.h \
2459 sys/types.h \
30a4f2a8 2460 sys/un.h \
b075cbb1 2461 sys/vfs.h \
30a4f2a8 2462 sys/wait.h \
db40ae20 2463 syslog.h \
30a4f2a8 2464 time.h \
2465 unistd.h \
3c641669 2466 utime.h \
30a4f2a8 2467 varargs.h \
77d6bd88 2468 byteswap.h \
2469 glib.h \
60d096f4 2470 stdint.h \
2471 inttypes.h \
3c641669 2472 grp.h \
94331f58 2473 db.h \
5b43d209 2474 db_185.h
db40ae20 2475)
2476
fc68f6b1 2477AC_CHECK_HEADERS(
2478 linux/netfilter_ipv4.h \
2479 linux/netfilter_ipv4/ip_tproxy.h \
2480,,,
dcd1dc78 2481SQUID_DEFAULT_INCLUDES
2482#if HAVE_LIMITS_H
2483#include <limits.h>
2484#endif
a74968c2
AJ
2485/* Netfilter ip(6)tables v1.4.0 has broken headers */
2486#if HAVE_NETINET_IN_H
2487#include <netinet/in.h>
2488#endif
dcd1dc78 2489)
2490
d1e5191e 2491dnl *BSD dont include the depenencies for all their net/ and netinet/ files
c92b4732 2492dnl We must include a few basic type headers for them to work.
d1e5191e
AJ
2493AC_CHECK_HEADERS( \
2494 net/if.h \
5a3237b0 2495 netinet/if_ether.h\
d1e5191e 2496 netinet/icmp6.h \
975cfef6 2497 netinet/in.h \
d1e5191e
AJ
2498 netinet/ip.h \
2499 netinet/ip6.h \
5a3237b0 2500 netinet/ip_compat.h\
975cfef6 2501 netinet/ip_fil_compat.h\
5a3237b0 2502 netinet/ip_fil.h\
d1e5191e 2503 netinet/ip_icmp.h \
dbc5782a 2504 netinet/ipl.h \
975cfef6 2505 netinet/ip_nat.h\
ec9909b0 2506 net/pf/pfvar.h \
d1e5191e 2507 net/pfvar.h \
77e4c0c9 2508 sys/mount.h\
d1e5191e
AJ
2509 resolv.h \
2510,,,
2511SQUID_BSDNET_INCLUDES)
5a3237b0 2512
aee0606f 2513AC_C_CONST
d57288d2 2514AC_C_BIGENDIAN
aee0606f 2515
6a9f6389 2516AC_STRUCT_TM
2517AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2518#if TM_IN_SYS_TIME
2519#if HAVE_SYS_TIME_H
2520#include <sys/time.h>
2521#endif
2522#elif HAVE_TIME_H
2523#include <time.h>
2524#endif
5c51415d 2525])
46c883ed 2526
6a9f6389 2527AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
2528#if HAVE_SYS_TYPES_H
2529#include <sys/types.h>
2530#endif
eb824054 2531#if HAVE_MALLOC_H
2532#include <malloc.h>
6a9f6389 2533#endif])
eb824054 2534
6a9f6389 2535AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
2536#if HAVE_SYS_TYPES_H
2537#include <sys/types.h>
2538#endif
2539#if HAVE_MALLOC_H
2540#include <malloc.h>
2541#endif])
090089c4 2542
08caf8c6 2543dnl Override rusage() detect on MinGW because is emulated in source code
2544case "$host_os" in
2545 mingw|mingw32)
2546 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2547 ac_cv_func_getrusage='yes'
eed82608 2548 AC_MSG_NOTICE([Using own rusage on Windows.])
08caf8c6 2549 ;;
2550 *)
2551 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 2552#if HAVE_SYS_TIME_H
2553#include <sys/time.h>
2554#endif
b54a6789 2555#if HAVE_SYS_RESOURCE_H
2556#include <sys/resource.h>
6a9f6389 2557#endif])
08caf8c6 2558 ;;
2559esac
b54a6789 2560
6a9f6389 2561AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2562#if HAVE_SYS_TYPES_H
2563#include <sys/types.h>
2564#endif
a025a745 2565#include <netinet/in.h>
2566#include <netinet/in_systm.h>
6ad85e8a 2567#include <netinet/ip.h>
b05490a8 2568#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 2569#define ip_hl ihl
2570#endif
2571#ifndef __linux__
b05490a8 2572#ifndef __CYGWIN__
6ad85e8a 2573#define iphdr ip
b05490a8 2574#endif
6a9f6389 2575#endif])
a025a745 2576
090089c4 2577dnl Check for typedefs
77d6bd88 2578AC_CHECK_SIZEOF(void *)
090089c4 2579
0409a509 2580dnl 8 bit integers - int8_t
2581dnl if this is defined we trust it to be 8 bits
2582AC_CHECK_TYPE(int8_t,[
2583 AC_CHECK_SIZEOF(int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2584 AC_DEFINE(HAVE_INT8_T,1,[int8_t is defined in system headers])
2585 ],,SQUID_DEFAULT_INCLUDES)
2586
2587dnl fallback #1
2588AC_CHECK_TYPE(char,[
2589 AC_CHECK_SIZEOF(char,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2590 AC_DEFINE(HAVE_CHAR,1,[char is defined in system headers])
2591 ],,SQUID_DEFAULT_INCLUDES)
2592
2593dnl unsigned 8 bit ints - u_int8_t
2594dnl if this is defined we trust it to be 8 bits
2595AC_CHECK_TYPE(u_int8_t,[
2596 AC_CHECK_SIZEOF(u_int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2597 AC_DEFINE(HAVE_U_INT8_T,1,[u_int8_t is defined in system headers])
2598 ],,SQUID_DEFAULT_INCLUDES)
2599
2600dnl fallback #1
2601dnl if this is defined we trust it to be 8 bits
2602AC_CHECK_TYPE(uint8_t,[
2603 AC_CHECK_SIZEOF(uint8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2604 AC_DEFINE(HAVE_UINT8_T,1,[uint8_t is defined in system headers])
2605 ],,SQUID_DEFAULT_INCLUDES)
2606
2607dnl 16 bit integers - int16_t
6a9f6389 2608dnl if this is defined we trust it to be 16 bits
62266438 2609AC_CHECK_TYPE(int16_t,[
2610 AC_CHECK_SIZEOF(int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2611 AC_DEFINE(HAVE_INT16_T,1,[int16_t is defined in system headers])
2612 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2613
2614dnl fallback #1
2615AC_CHECK_TYPE(short,[
856e69c5 2616 AC_CHECK_SIZEOF(short,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2617 AC_DEFINE(HAVE_SHORT,1,[short is defined in system headers])
2618 ],,SQUID_DEFAULT_INCLUDES)
2619
2620dnl fallback #2
2621AC_CHECK_TYPE(int,[
856e69c5 2622 AC_CHECK_SIZEOF(int,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2623 AC_DEFINE(HAVE_INT,1,[int is defined in system headers])
2624 ],,SQUID_DEFAULT_INCLUDES)
2625
2626dnl unsigned 16 bit ints - u_int16_t
2627dnl if this is defined we trust it to be 16 bits
62266438 2628AC_CHECK_TYPE(u_int16_t,[
2629 AC_CHECK_SIZEOF(u_int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2630 AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers])
2631 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2632
2633dnl fallback #1
2634dnl if this is defined we trust it to be 16 bits
62266438 2635AC_CHECK_TYPE(uint16_t,[
2636 AC_CHECK_SIZEOF(uint16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2637 AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers])
2638 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2639
2640dnl 32 bit signed int - int32_t
2641dnl if this is defined we trust it to be 32 bits
62266438 2642AC_CHECK_TYPE(int32_t,[
2643 AC_CHECK_SIZEOF(int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2644 AC_DEFINE(HAVE_INT32_T,1,[int32_t is defined in system headers])
2645 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2646
2647dnl fallback #1
2648AC_CHECK_TYPE(long,[
856e69c5 2649 AC_CHECK_SIZEOF(long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2650 AC_DEFINE(HAVE_LONG,1,[long is defined in system headers])
2651 ],,SQUID_DEFAULT_INCLUDES)
2652
2653dnl 32 bit unsigned int - u_int32_t
2654dnl if this is defined we trust it to be 32 bits
62266438 2655AC_CHECK_TYPE(u_int32_t,[
2656 AC_CHECK_SIZEOF(u_int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2657 AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers])
2658 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2659
2660dnl fallback #1
2661dnl if this is defined we trust it to be 32 bits
62266438 2662AC_CHECK_TYPE(uint32_t,[
2663 AC_CHECK_SIZEOF(uint32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2664 AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers])
2665 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2666
2667dnl 64 bit signed - int64_t
2668dnl if this is defind we trust it to be 64 bits
62266438 2669AC_CHECK_TYPE(int64_t,[
2670 AC_CHECK_SIZEOF(int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2671 AC_DEFINE(HAVE_INT64_T,1,[int64_t is defined in system headers])
2672 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2673
2674dnl fallback #1
2675dnl if this is defind we trust it to be 64 bits
62266438 2676AC_CHECK_TYPE(__int64,[
2677 AC_CHECK_SIZEOF(__int64,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2678 AC_DEFINE(HAVE___INT64,1,[__int64 is defined in system headers])
2679 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2680
2681dnl fallback #2
2682AC_CHECK_TYPE(long long,[
856e69c5 2683 AC_CHECK_SIZEOF(long long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2684 AC_DEFINE(HAVE_LONG_LONG,1,[long long is defined in system headers])
2685 ],,SQUID_DEFAULT_INCLUDES)
2686
2687dnl 64 bit unsigned - u_int64_t
2688dnl if this is defind we trust it to be 64 bits
62266438 2689AC_CHECK_TYPE(u_int64_t,[
2690 AC_CHECK_SIZEOF(u_int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2691 AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers])
2692 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2693
2694dnl fallback #1
2695dnl if this is defind we trust it to be 64 bits
62266438 2696AC_CHECK_TYPE(uint64_t,[
2697 AC_CHECK_SIZEOF(uint64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2698 AC_DEFINE(HAVE_UINT64_T,1,[uint64_t is defined in system headers])
2699 ],,SQUID_DEFAULT_INCLUDES)
6a9f6389 2700
588e71df 2701dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2702dnl that is incompatible with the updated Solaris header files.
2703dnl For this reason, we must check if pad128_t and upad128_t are defined.
2704AC_CHECK_TYPE(pad128_t,
2705 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2706 ,SQUID_DEFAULT_INCLUDES)
2707
2708AC_CHECK_TYPE(upad128_t,
2709 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2710 ,SQUID_DEFAULT_INCLUDES)
2711
6a9f6389 2712AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2713AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2714 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2715AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 2716AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 2717 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2718AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2719AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 2720
77d6bd88 2721dnl Check for special functions
2722AC_FUNC_ALLOCA
2723
6a9f6389 2724AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2725#include <sys/types.h>
6637e3a5 2726#include <sys/socket.h>
2727#if STDC_HEADERS
2728#include <stdlib.h>
2729#include <stddef.h>
6a9f6389 2730#endif])
6637e3a5 2731
b50f1b2b 2732dnl Check for libcap header (assume its not broken unless
69367152
HN
2733use_libcap=auto
2734AC_ARG_WITH(libcap, AS_HELP_STRING([--without-libcap],[disable usage of Linux capabilities library to control privileges]),
2735[ if test "x$withval" = "xyes" ; then
b64b6030 2736 AC_MSG_RESULT(libcap forced enabled)
69367152 2737 use_libcap=yes
b50f1b2b 2738 else
1c9910eb 2739 AC_MSG_RESULT(libcap forced disabled)
69367152 2740 use_libcap=no
b50f1b2b 2741 fi
b64b6030 2742])
69367152 2743if test "x$use_libcap" != "xno"; then
b64b6030
HN
2744 # cap_clear_flag is the most recent libcap function we require
2745 AC_CHECK_LIB(cap, cap_clear_flag)
6a4d3ec8
HN
2746 if test "x$ac_cv_lib_cap_cap_clear_flag" = xyes; then
2747 use_libcap=yes
2748 else
69367152 2749 if test "x$use_libcap" = "xyes"; then
ff8d255b 2750 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
b64b6030 2751 fi
69367152 2752 use_libcap=no
b64b6030
HN
2753 fi
2754fi
69367152 2755
6a4d3ec8 2756if test "x$use_libcap" = "xyes"; then
b64b6030
HN
2757 AC_DEFINE(USE_LIBCAP, 1, [use libcap to set capabilities required for TPROXY])
2758 dnl Check for libcap headader breakage.
b50f1b2b 2759 AC_CHECK_HEADERS(sys/capability.h)
ff8d255b
HN
2760 AC_CACHE_CHECK([for operational libcap2 headers], squid_cv_sys_capability_works,
2761 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
2762#include <stdlib.h>
2763#include <stddef.h>
2764#include <sys/capability.h>
2765]], [[
2766capget(NULL, NULL);
2767capset(NULL, NULL);
2768 ]])],[squid_cv_sys_capability_works=yes],[squid_cv_sys_capability_works=no])
b50f1b2b 2769 )
ff8d255b
HN
2770 if test x$squid_cv_sys_capability_works != xyes; then
2771 AC_DEFINE([LIBCAP_BROKEN],1,[if libcap2 headers are broken and clashing with glibc])
2772 fi
b50f1b2b 2773fi
5b43d209 2774
b64b6030 2775
6a9f6389 2776AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
aea1be68 2777#include <sys/ipc.h>
6a9f6389 2778#include <sys/msg.h>])
aea1be68 2779
090089c4 2780dnl Check for needed libraries
54c95954
FC
2781AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
2782AC_SEARCH_LIBS([res_init],[resolv])
2783AC_SEARCH_LIBS([bind],[socket])
2784AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
2785AC_SEARCH_LIBS([strlcpy], [bsd])
85cd85f3 2786AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
bfe8dedf 2787dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
4b26fae9 2788case "$host_os" in
2789 mingw|mingw32)
2790 AC_MSG_CHECKING(for winsock)
2791 save_LIBS="$LIBS"
2792 for curlib in ws2_32 wsock32; do
2793 LIBS="$LIBS -l$curlib"
62979ab1 2794 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <winsock.h>]], [[
1635bf30
GS
2795 socket(0,0,0);
2796 select(0,NULL,NULL,NULL,NULL);
2797 closesocket(0);
2798 gethostname(NULL,0);
62979ab1 2799 ]])],[have_winsock=yes],[have_winsock=no])
4b26fae9 2800
2801 if test $have_winsock = yes; then
2802 ac_cv_func_select='yes'
2803 if test $curlib = ws2_32; then
2804 have_winsock=winsock2
2805 fi
2806 break
2807 fi
2808 LIBS="$save_LIBS"
2809 done
2810 AC_MSG_RESULT($have_winsock)
bfe8dedf
GS
2811 if test $have_winsock = winsock2; then
2812 AC_CHECK_HEADERS(winsock2.h)
2813 else
2814 AC_CHECK_HEADERS(winsock.h)
2815 fi
4b26fae9 2816 ;;
2817esac
94d48591 2818
3c641669 2819dnl Ripped from the Samba sources
2820AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
62979ab1 2821 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3c641669 2822#include <sys/types.h>
2823#include <stdlib.h>
2824#include <stddef.h>
2825#include <sys/socket.h>
62979ab1 2826#include <sys/un.h>]], [[
3c641669 2827 struct sockaddr_un sunaddr;
2828 sunaddr.sun_family = AF_UNIX;
62979ab1 2829]])],[squid_cv_unixsocket=yes],[squid_cv_unixsocket=no])])
3c641669 2830if test x"$squid_cv_unixsocket" = x"yes"; then
6a9f6389 2831 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
3c641669 2832fi
2833dnl end rip
2834
94d48591 2835 AC_CHECK_LIB(gnumalloc, main)
2836 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
eed82608 2837 AC_MSG_NOTICE([Disabling extended malloc functions when using gnumalloc])
94d48591 2838 ac_cv_func_mallinfo=no
2839 ac_cv_func_mallocblksize=no
2840 ac_cv_func_mallopt=no
2841 else
2842 case "$host" in
2843 *-sun-solaris*)
eed82608 2844 AC_MSG_NOTICE([skipping libmalloc check for $host])
94d48591 2845 ;;
2846 i386-*-freebsd*)
eed82608 2847 AC_MSG_NOTICE([skipping libmalloc check for $host])
94d48591 2848 ;;
2849 *)
2850
2851 AC_CHECK_LIB(malloc, main)
2852 ;;
2853 esac
2854 fi
94d48591 2855
be79ade0 2856AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
08caf8c6 2857case "$host_os" in
2858mingw|mingw32)
eed82608 2859 AC_MSG_NOTICE([Use MSVCRT for math functions.])
08caf8c6 2860 ;;
2861 *)
2862 AC_CHECK_LIB(m, main)
2863 ;;
2864esac
090089c4 2865
001ad4cc
AJ
2866dnl Enable IPv6 support
2867AC_MSG_CHECKING([whether to enable IPv6])
2868use_ipng=yes
2869AC_ARG_ENABLE(ipv6,
62979ab1 2870 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
001ad4cc
AJ
2871[ if test "x$enableval" = "xyes" ; then
2872 AC_MSG_RESULT(yes)
2873 else
2874 AC_MSG_RESULT(no)
2875 use_ipng=no
2876 fi
2877],[AC_MSG_RESULT(yes)])
2878
2879if test "$use_ipng" = "yes"; then
2880 SAVED_LIBS="$LIBS"
2881 dnl Solaris 10/11 requires -lsocket
2882 case "$host" in
2883 *-solaris*)
2884 LIBS="$LIBS -lsocket"
2885 ;;
2886 *)
2887 ;;
2888 esac
2889 AC_CACHE_CHECK([if PF_INET6 is available], $use_ipng,
62979ab1 2890 AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* PF_INET6 available check */
001ad4cc
AJ
2891# include <sys/types.h>
2892# include <sys/socket.h>
b3167ca7 2893 int main(int argc, char **argv) {
001ad4cc
AJ
2894 if (socket(PF_INET6, SOCK_STREAM, 0) < 0)
2895 return 1;
2896 else
2897 return 0;
2898 }
62979ab1 2899 ]])],[ AC_MSG_RESULT(yes)
001ad4cc 2900 use_ipng=yes
62979ab1
AJ
2901 SAVED_LIBS="$LIBS" ],[ AC_MSG_RESULT(no)
2902 use_ipng=no ],[])
001ad4cc
AJ
2903 )
2904 LIBS="$SAVED_LIBS"
2905fi
2906
2907if test "$use_ipng" = "yes"; then
2908 AC_DEFINE(USE_IPV6,1,[Enable support for IPv6 ])
18a8e998 2909 SET_IPV6_SETTINGS=""
001ad4cc
AJ
2910 use_v4mapped=yes
2911
44770d71 2912dnl Check for forced split-stack mode
001ad4cc
AJ
2913 AC_MSG_CHECKING([for IPv6 split-stack requirement])
2914 AC_ARG_WITH(ipv6-split-stack,
62979ab1 2915 AS_HELP_STRING([--with-ipv6-split-stack],[Force-Enable experimental split-stack support for Windows XP and *BSD. Requires IPv6.]),
001ad4cc
AJ
2916 [ use_v4mapped="no"
2917 AC_MSG_RESULT(yes)],
2918 [ AC_MSG_RESULT(no) ])
2919
44770d71
AJ
2920dnl Check for IPv6 v4-mapping availability
2921dnl Useful for other OS with hybrid-stack defaults turned OFF
001ad4cc
AJ
2922dnl But only usable if it actually works...
2923 if test "$use_v4mapped" = "yes" ; then
2924 AC_MSG_CHECKING([for IPv6 v4-mapping ability])
62979ab1 2925 AC_RUN_IFELSE([AC_LANG_SOURCE([[ /* IPPROTO_V4MAPPED is usable check */
001ad4cc
AJ
2926# include <sys/types.h>
2927# include <sys/socket.h>
2928# include <netinet/in.h>
2929#if HAVE_NETINET_IN6_H
2930# include <netinet/in6.h>
2931#endif
b3167ca7 2932 int main(int argc, char **argv) {
001ad4cc
AJ
2933 int s = socket(PF_INET6, SOCK_STREAM, 0);
2934 int tos = 0;
2935 if (setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, (char *) &tos, sizeof(int)) < 0)
2936 return 1;
2937 else
2938 return 0;
2939 }
62979ab1 2940 ]])],[ AC_MSG_RESULT(yes)
001ad4cc
AJ
2941 use_v4mapped=yes
2942 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 1, [Enable v4-mapping through v6 sockets])
62979ab1 2943 ],[ AC_MSG_RESULT(no)
001ad4cc
AJ
2944 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 0, [Enable v4-mapping through v6 sockets])
2945 use_v4mapped=no
62979ab1 2946 ],[])
001ad4cc
AJ
2947 fi
2948
2949dnl if we can't defer v4-mapping to the OS we are forced to split-stack the FD table.
2950 AC_MSG_CHECKING([for IPv6 stack type/mode])
2951 if test "$use_v4mapped" = "yes"; then
2952 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 1, [Enable v4-mapping through v6 sockets. Requires IPv6 hybrid-stack.])
2953 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 0, [Enable support for IPv6 on split-stack implementations])
2954 AC_MSG_RESULT(mapping hybrid)
2955 else
2956 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 0, [Enable v4-mapping through v6 sockets. Requires IPv6 hybrid-stack.])
2957 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 1, [Enable support for IPv6 on split-stack implementations])
2958 AC_MSG_RESULT(split-stack or BSD non-mapping dual-stack)
2959 fi
2960
2961dnl Check whether this OS defines sin6_len as a member of sockaddr_in6 as a backup to ss_len
2962AC_CACHE_CHECK([for sin6_len field in struct sockaddr_in6],
2963 ac_cv_have_sin6_len_in_struct_sai, [
62979ab1 2964 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
001ad4cc
AJ
2965#include <sys/types.h>
2966#include <sys/socket.h>
2967#include <netinet/in.h>
62979ab1
AJ
2968 ]], [[ struct sockaddr_in6 s; s.sin6_len = 1; ]])],[ ac_cv_have_sin6_len_in_struct_sai="yes" ],[ ac_cv_have_sin6_len_in_struct_sai="no"
2969 ])
001ad4cc
AJ
2970 ])
2971 if test "x$ac_cv_have_sin6_len_in_struct_sai" = "xyes" ; then
2972 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 1, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
2973 else
2974 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 0, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
2975 fi
2976
2977else
2978 # NP: semi-silent failure as IPv4-only mode is perfectly usable on this system.
2979 AC_MSG_WARN([IPv6 is not available on this system.])
2980 AC_DEFINE(USE_IPV6,0,[Enable support for IPv6])
2981 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK,0,[Enable support for IPv6 on split-stack implementations])
2982 AC_DEFINE(IPV6_SPECIAL_V4MAPPED,0,[Enable v4-mapping through v6 sockets])
18a8e998 2983 SET_IPV6_SETTINGS="\#IPv6 Not Available: "
001ad4cc 2984fi
18a8e998 2985AC_SUBST(SET_IPV6_SETTINGS)
001ad4cc
AJ
2986
2987dnl Check whether this OS defines ss_len as a member of sockaddr_storage
2988AC_CACHE_CHECK([for ss_len field in struct sockaddr_storage],
2989 ac_cv_have_ss_len_in_struct_ss, [
62979ab1 2990 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
001ad4cc
AJ
2991#include <sys/types.h>
2992#include <sys/socket.h>
2993#include <netinet/in.h>
62979ab1
AJ
2994 ]], [[ struct sockaddr_storage s; s.ss_len = 1; ]])],[ ac_cv_have_ss_len_in_struct_ss="yes" ],[ ac_cv_have_ss_len_in_struct_ss="no"
2995 ])
001ad4cc
AJ
2996])
2997if test "x$ac_cv_have_ss_len_in_struct_ss" = "xyes" ; then
2998 AC_DEFINE(HAVE_SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
2999else
3000 AC_DEFINE(HAVE_SS_LEN_IN_SS, 0, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
3001fi
3002
3003dnl Check whether this OS defines sin_len as a member of sockaddr_in as a backup to ss_len
3004AC_CACHE_CHECK([for sin_len field in struct sockaddr_in],
3005 ac_cv_have_sin_len_in_struct_sai, [
62979ab1 3006 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
001ad4cc
AJ
3007#include <sys/types.h>
3008#include <sys/socket.h>
3009#include <netinet/in.h>
62979ab1
AJ
3010 ]], [[ struct sockaddr_in s; s.sin_len = 1; ]])],[ ac_cv_have_sin_len_in_struct_sai="yes" ],[ ac_cv_have_sin_len_in_struct_sai="no"
3011 ])
001ad4cc
AJ
3012])
3013if test "x$ac_cv_have_sin_len_in_struct_sai" = "xyes" ; then
3014 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 1, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
3015else
3016 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 0, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
3017fi
3018
090089c4 3019dnl Check for libcrypt
0d8565ac 3020CRYPTLIB=
8154dd82 3021dnl Some of our helpers use crypt(3) which may be in libc, or in
3022dnl libcrypt (eg FreeBSD)
c1dc012a 3023AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
3d4022fa 3024dnl Solaris10 provides MD5 natively through libmd5
c1dc012a 3025AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
be79ade0 3026AC_SUBST(CRYPTLIB)
77f675ad 3027
0d8565ac
AJ
3028# check for crypt, may require -lcrypt
3029SAVED_LIBS="$LIBS"
3030LIBS="$LIBS $CRYPTLIB"
3031AC_CHECK_FUNCS(crypt)
3032LIBS="$SAVED_LIBS"
3033
3034
042b1f8a 3035dnl Check for libdl, used by auth_modules/PAM
8154dd82 3036if test "$with_dl" = "yes"; then
3037 AC_CHECK_LIB(dl, dlopen)
3038fi
042b1f8a 3039
86ec11aa 3040dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
3041dnl Robert Side <rside@aiinc.bc.ca>
3042dnl Mon, 18 Jan 1999 17:48:00 GMT
3043case "$host" in
3044 *-pc-sco3.2*)
3045 AC_CHECK_LIB(intl, strftime)
3046 ;;
3047esac
3048
20e869bf 3049dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
3050dnl only with Windows LDAP libraries using -lwldap32
3051case "$host_os" in
3052mingw|mingw32)
428744a1
AJ
3053 LDAPLIB="-lwldap32"
3054 LBERLIB=""
3055 ;;
20e869bf 3056*)
428744a1
AJ
3057 LDAPLIB="-lldap"
3058 dnl LDAP helpers need to know if -llber is needed or not
3059 AC_CHECK_LIB(lber, main, [LBERLIB="-llber"])
3060 ;;
20e869bf 3061esac
428744a1
AJ
3062AC_SUBST(LDAPLIB)
3063AC_SUBST(LBERLIB)
20e869bf 3064
b7a1c19e 3065dnl Check for libdb
3066DBLIB=
01b4931d 3067dnl 1.85
a258dfca 3068AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [
32d0bbd7 3069SAVED_LIBS="$LIBS"; LIBS="$LIBS -ldb"
62979ab1 3070 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
a258dfca 3071#if HAVE_SYS_TYPES_H
3072#include <sys/types.h>
3073#endif
3074#if HAVE_LIMITS_H
3075#include <limits.h>
3076#endif
3077#if HAVE_DB_185_H
3078#include <db_185.h>
3079#elif HAVE_DB_H
3080#include <db.h>
62979ab1 3081#endif]], [[dbopen("", 0, 0, DB_HASH, (void *)0L)]])],[ac_cv_dbopen_libdb="yes"],[ac_cv_dbopen_libdb="no"])
32d0bbd7 3082LIBS="$SAVED_LIBS"
a258dfca 3083])
2b2161bb 3084if test $ac_cv_dbopen_libdb = yes; then
32d0bbd7 3085 LIB_DB="-ldb"
3086fi
01b4931d 3087AC_SUBST(LIB_DB)
b7a1c19e 3088
77f675ad 3089dnl System-specific library modifications
3090dnl
3091case "$host" in
88738790 3092 i386-*-solaris2.*)
7149a49f 3093 if test "$GCC" = "yes"; then
eed82608 3094 AC_MSG_NOTICE([Removing -O for gcc on $host])
80e92d6d 3095 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 3096 fi
3097 ;;
77f675ad 3098 *-sgi-irix*)
eed82608 3099 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
6716b242 3100 LIBS=`echo $LIBS | sed -e s/-lsocket//`
eed82608 3101 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
6716b242 3102 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 3103 ac_cv_lib_nsl_main=no
eed82608 3104 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
b44c0fb4 3105 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 3106 ;;
4ba0bd0e 3107dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
3108dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
3109dnl Please change your configure script. AIX doesn't need -lbsd.
3110 *-ibm-aix*)
eed82608 3111 AC_MSG_NOTICE([Removing -lbsd for AIX...])
4ba0bd0e 3112 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3113 ;;
30a4f2a8 3114 *m88k*)
fa035612 3115 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
3116 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
6a9f6389 3117 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
7149a49f 3118 ;;
580ce039 3119 [*-*-solaris2.[0-4]])
6a9f6389 3120 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
30a4f2a8 3121 ;;
711fa75e 3122 [*-sony-newsos[56]*])
6a9f6389 3123 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
f62c73dc 3124 ;;
77f675ad 3125esac
090089c4 3126
57faa85a 3127# Remove optimization for GCC 2.95.[123]
d20b1cd0 3128# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
3129if test "$GCC" = "yes"; then
3130 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
3131 case "$GCCVER" in
57faa85a 3132 [2.95.[123]])
eed82608 3133 AC_MSG_NOTICE([Removing -O for gcc on $host with GCC $GCCVER])
d20b1cd0 3134 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
3135 ;;
3136 esac
3137fi
3138
176d10ee 3139# Recommended by Balint Nagy Endre <bne@CareNet.hu>
3140case "$host" in
3141 *-univel-sysv4.2MP)
3142 if test `uname -v` = "2.03"; then
eed82608 3143 AC_MSG_NOTICE([disabling mallinfo for $host])
176d10ee 3144 ac_cv_func_mallinfo=no
3145 fi
3146 ;;
3147esac
3148
84cecfd2 3149dnl This has to be before AC_CHECK_FUNCS
3150# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
3151# when running configure.
3152if test -z "$ac_cv_func_poll"; then
3153 case "$host" in
3154 [alpha-dec-osf3.*])
3155 # John Kay (jkay@nlanr.net) 19970818
eed82608 3156 AC_MSG_NOTICE([disabling poll for $host...])
84cecfd2 3157 ac_cv_func_poll='no'
3158 ;;
3159 [*-hp-hpux*.*])
3160 # Duane Wessels
eed82608 3161 AC_MSG_NOTICE([disabling poll for $host...])
84cecfd2 3162 ac_cv_func_poll='no'
3163 ;;
3164 [*-linux-*])
f5cec332 3165 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 3166 # poll is problematic on Linux. We disable it
3167 # by default until Linux gets it right.
b6a2f15e 3168 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
3169 if test $rev -lt 002002; then
eed82608 3170 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
b6a2f15e 3171 ac_cv_func_poll='no'
3172 fi
84cecfd2 3173 ;;
c68e9c6b 3174 [powerpc-ibm-aix4.1.*])
3175 # Mike Laster (mlaster@metavillage.com) 19981021
eed82608 3176 AC_MSG_NOTICE([disabling poll for $host...])
c68e9c6b 3177 ac_cv_func_poll='no'
3178 ;;
86ec11aa 3179 [*-pc-sco3.2*])
3180 # Robert Side <rside@aiinc.bc.ca>
3181 # Mon, 18 Jan 1999 17:48:00 GMT
eed82608 3182 AC_MSG_NOTICE([disabling poll for $host...])
86ec11aa 3183 ac_cv_func_poll='no'
3184 ;;
84cecfd2 3185 esac
3186fi
176d10ee 3187
08caf8c6 3188dnl Override statfs() detect on MinGW becasue is emulated in source code
3189case "$host_os" in
3190mingw|mingw32)
3191 ac_cv_func_statfs='yes'
3192 ;;
3193esac
3194
6716b242 3195dnl Check for library functions
3196AC_CHECK_FUNCS(\
ce3d30fb 3197 backtrace_symbols_fd \
3a144521 3198 bcopy \
3199 bswap_16 \
3200 bswap_32 \
f9576890 3201 bswap16 \
3202 bswap32 \
4ac29a5b 3203 fchmod \
6716b242 3204 getdtablesize \
8505e57b 3205 getpagesize \
230c091c 3206 getpass \
3a144521 3207 getrlimit \
30a4f2a8 3208 getrusage \
9c1d8929 3209 getspnam \
379d5751 3210 gettimeofday \
52303a3d 3211 glob \
f9576890 3212 htobe16 \
3213 htole16 \
d474c7a6 3214 kqueue\
30a4f2a8 3215 lrand48 \
6716b242 3216 mallinfo \
0f5efab0 3217 mallocblksize \
6716b242 3218 mallopt \
2ae6b9b0 3219 memcpy \
30a4f2a8 3220 memmove \
dac27377 3221 memset \
b99a6dec 3222 mkstemp \
1812b6c7 3223 mktime \
88738790 3224 mstats \
84cecfd2 3225 poll \
62ae0622 3226 prctl \
3a144521 3227 pthread_attr_setschedparam \
cd748f27 3228 pthread_attr_setscope \
3229 pthread_setschedparam \
42b51993 3230 pthread_sigmask \
c68e9c6b 3231 putenv \
b1e77ec1 3232 random \
6716b242 3233 regcomp \
3234 regexec \
3235 regfree \
30a4f2a8 3236 res_init \
af76ec93 3237 __res_init \
4915be3b 3238 rint \
a4ba1105 3239 sbrk \
3a144521 3240 select \
234967c9 3241 seteuid \
c415c128 3242 setgroups \
30a4f2a8 3243 setpgrp \
6716b242 3244 setrlimit \
30a4f2a8 3245 setsid \
3246 sigaction \
11430c03 3247 snprintf \
1ccc0d40 3248 socketpair \
30a4f2a8 3249 srand48 \
b1e77ec1 3250 srandom \
0343b99c 3251 statfs \
6716b242 3252 sysconf \
3253 syslog \
234967c9 3254 timegm \
28da5e0d 3255 vsnprintf \
6716b242 3256)
f5e5c4cf 3257dnl ... and some we provide local replacements for
3258AC_REPLACE_FUNCS(\
3259 drand48 \
a98c2da5 3260 eui64_aton \
cc192b50 3261 inet_ntop \
3262 inet_pton \
f5e5c4cf 3263 initgroups \
cc192b50 3264 getaddrinfo \
3265 getnameinfo \
f5e5c4cf 3266 strerror \
585cddda
AJ
3267 strsep \
3268 strtoll \
f5e5c4cf 3269 tempnam \
3270)
6716b242 3271
1b3db6d9 3272dnl Magic which checks whether we are forcing a type of comm loop we
3273dnl are actually going to (ab)use
3274
3275dnl Actually do the define magic now
3276dnl mostly ripped from squid-commloops, thanks to adrian and benno
3277
8075a4da
FC
3278if test -n "$squid_opt_io_loop_engine"; then
3279 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine])
bf53a520 3280elif test "$squid_opt_enable_epoll" != "no" && test "$ac_cv_epoll_works" = "yes" ; then
8075a4da 3281 squid_opt_io_loop_engine="epoll"
bf53a520 3282elif test "$squid_opt_enable_kqueue" != "no" && test "$ac_cv_func_kqueue" = "yes" ; then
8075a4da 3283 squid_opt_io_loop_engine="kqueue"
bf53a520 3284elif test "$squid_opt_enable_poll" != "no" && test "$ac_cv_func_poll" = "yes" ; then
8075a4da 3285 squid_opt_io_loop_engine="poll"
bf53a520 3286elif test "$squid_opt_enable_select" != "no" && test "$ac_cv_func_select" = "yes" ; then
8075a4da 3287 squid_opt_io_loop_engine="select"
bf53a520 3288 if test "$squid_host_os" = "mingw" ; then
8075a4da 3289 squid_opt_io_loop_engine="select_win32"
bf53a520 3290 fi
1b3db6d9 3291else
bf53a520
FC
3292 AC_MSG_WARN([Eep! Can't find poll, kqueue, epoll, or select!])
3293 AC_MSG_WARN([I'll try select and hope for the best.])
8075a4da 3294 squid_opt_io_loop_engine="select"
1b3db6d9 3295fi
d474c7a6 3296
8075a4da 3297AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
d474c7a6 3298
8075a4da
FC
3299AM_CONDITIONAL([USE_POLL], [test $squid_opt_io_loop_engine = poll])
3300AM_CONDITIONAL([USE_EPOLL], [test $squid_opt_io_loop_engine = epoll])
3301AM_CONDITIONAL([USE_SELECT], [test $squid_opt_io_loop_engine = select])
3302AM_CONDITIONAL([USE_SELECT_SIMPLE], [test $squid_opt_io_loop_engine = select_simple])
3303AM_CONDITIONAL([USE_SELECT_WIN32], [test $squid_opt_io_loop_engine = select_win32])
3304AM_CONDITIONAL([USE_KQUEUE], [test $squid_opt_io_loop_engine = kqueue])
3305AM_CONDITIONAL([USE_DEVPOLL], [test $squid_opt_io_loop_engine = devpoll])
d474c7a6 3306
8075a4da 3307case $squid_opt_io_loop_engine in
0abb39dd
FC
3308 epoll) AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop]) ;;
3309 poll) AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop]) ;;
3310 kqueue) AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop]) ;;
3311 select_win32) AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop]) ;;
3312 select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
d474c7a6 3313esac
1b3db6d9 3314
60939927 3315dnl Yay! Another Linux brokenness. Its not good enough
3316dnl to know that setresuid() exists, because RedHat 5.0 declares
3317dnl setresuid() but doesn't implement it.
3318dnl
3319AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
62979ab1 3320 AC_RUN_IFELSE([AC_LANG_SOURCE([[
60939927 3321#include <stdlib.h>
b3167ca7 3322 int main(int argc, char **argv) {
5c51415d 3323 if(setresuid(-1,-1,-1)) {
3324 perror("setresuid:");
b3167ca7 3325 return 1;
60939927 3326 }
b3167ca7 3327 return 0;
5c51415d 3328 }
62979ab1 3329 ]])],[ac_cv_func_setresuid="yes"],[ac_cv_func_setresuid="no"],[])
60939927 3330)
5c51415d 3331if test "$ac_cv_func_setresuid" = "yes" ; then
6a9f6389 3332 AC_DEFINE(HAVE_SETRESUID,1,[Yay! Another Linux brokenness. Its not good enough to know that setresuid() exists, because RedHat 5.0 declare setresuid() but doesn't implement it.])
5c51415d 3333fi
60939927 3334
0abb39dd
FC
3335SQUID_CHECK_FUNC_STRNSTR
3336SQUID_CHECK_FUNC_VACOPY
3337SQUID_CHECK_FUNC___VACOPY
cee08cbc 3338
c3d0c8b5 3339
5cafc1d6 3340dnl IP-Filter support requires ipf header files. These aren't
3341dnl installed by default, so we need to check for them
20ad76ab
FC
3342if test "$squid_opt_ipf_transparent" != "no" ; then
3343 AC_MSG_CHECKING(for availability of IP-Filter header files)
42b51993 3344 # hold on to your hats...
3345 if test "$ac_cv_header_ip_compat_h" = "yes" ||
3346 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 3347 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
3348 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 3349 have_ipfilter_compat_header="yes"
3350 fi
20ad76ab 3351 if test "$have_ipfilter_compat_header" = "yes" &&
eb824054 3352 test "$ac_cv_header_ip_fil_h" = "yes" &&
3353 test "$ac_cv_header_ip_nat_h" = "yes" ; then
20ad76ab 3354 squid_opt_ipf_transparent="yes"
eb824054 3355 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 3356 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 3357 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
3358 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
20ad76ab 3359 squid_opt_ipf_transparent="yes"
eb824054 3360 AC_DEFINE(IPF_TRANSPARENT, 1)
3361 else
20ad76ab 3362 squid_opt_ipf_transparent="no"
5cafc1d6 3363 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 3364 fi
3365 AC_MSG_RESULT($IPF_TRANSPARENT)
3366fi
20ad76ab 3367if test "$squid_opt_ipf_transparent" = "yes" -a "$squid_host_os" = "solaris" ; then
8f6ca20d 3368dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3369dnl Solaris minor version (8, 9, 10, ...)
20ad76ab
FC
3370 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3371 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3372 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
5cafc1d6 3373fi
3374
2b0dd4ac 3375dnl PF support requires a header file.
20ad76ab
FC
3376if test "$squid_opt_pf_transparent" != "no" ; then
3377 AC_MSG_CHECKING(for availability o fPF header files)
3378 # hold on to your hats...
3379 if test "$ac_cv_header_net_pfvar_h" = "yes" || test "$ac_cv_header_net_pf_pfvar_h" = "yes"; then
3380 squid_opt_pf_transparent="yes"
3381 AC_DEFINE(PF_TRANSPARENT, 1)
3382 else
3383 squid_opt_pf_transparent="no"
3384 AC_DEFINE(PF_TRANSPARENT, 0)
3385 fi
3386 AC_MSG_RESULT($squid_opt_pf_transparent)
2b0dd4ac 3387fi
20ad76ab 3388if test "$squid_opt_pf_transparent" = "no" ; then
eed82608
AJ
3389 AC_MSG_WARN([Cannot find necessary PF header file])
3390 AC_MSG_WARN([Transparent Proxy support WILL NOT be enabled])
2b0dd4ac 3391fi
3392
20ad76ab 3393if test "$squid_opt_linux_netfilter" != "no" ; then
d6d62546 3394 AC_MSG_CHECKING(if Linux (Netfilter) kernel header files are installed)
d852fbad 3395 # hold on to your hats...
3396 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
d852fbad 3397 AC_DEFINE(LINUX_NETFILTER, 1)
3398 else
20ad76ab 3399 squid_opt_linux_netfilter="no"
d852fbad 3400 AC_DEFINE(LINUX_NETFILTER, 0)
20ad76ab
FC
3401 AC_MSG_WARN([Cannot find necessary Linux kernel (Netfilter) header files])
3402 AC_MSG_WARN([Linux Transparent and Intercepting Proxy support WILL NOT be enabled])
d852fbad 3403 fi
20ad76ab 3404 AC_MSG_RESULT($squid_opt_linux_netfilter)
b50f1b2b 3405fi
20ad76ab 3406
b50f1b2b 3407dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
20ad76ab 3408if test "$squid_opt_linux_netfilter" = "yes" && test "$use_libcap" != "yes" ; then
b50f1b2b
AJ
3409 AC_MSG_WARN([Missing needed capabilities (libcap or libcap2) for TPROXY])
3410 AC_MSG_WARN([Linux Transparent Proxy support WILL NOT be enabled])
3411 AC_MSG_WARN([Reduced support to Interception Proxy])
96f08e2d
FC
3412 squid_opt_linux_tproxy2="no"
3413 # AC_DEFINE'd later
3414fi
3415
3416# Linux Netfilter/TPROXYv2 support requires some specific header files and
3417# support infrastructure (netfilter and libcap)
3418if test "$squid_opt_linux_tproxy2" = "yes" -a "$use_libcap" != "yes" ; then
3419 AC_MSG_WARN([Missing needed capabilities (libcap or libcap2) for TPROXY])
3420 AC_MSG_WARN([Disabling Linux TPROXY v2 support])
3421 AC_MSG_WARN([Interception proxy will still work])
3422 squid_opt_linux_tproxy2="no"
3423fi
3424if test "$squid_opt_linux_tproxy2" = "yes" ; then
3425 # we already checked that $use_libcap2=yes
3426 if test "$squid_opt_linux_netfilter" = "no" ; then
3427 squid_opt_linux_netfilter="yes"
3428 AC_MSG_NOTICE([Enabling Linux Netfilter support needed by Linux TPROXY v2])
3429 fi
3430 AC_MSG_CHECKING([if TPROXYv2 header files are installed])
3431 if test "$ac_cv_header_linux_netfilter_ipv4_ip_tproxy_h" != "yes" ; then
3432 squid_opt_linux_tproxy2="no"
3433 dnl need to output before next lines
3434 AC_MSG_RESULT($squid_opt_linux_tproxy2)
96f08e2d
FC
3435 AC_MSG_WARN([Cannot find TPROXY v2 headers, you need to patch the kernel with ])
3436 AC_MSG_WARN([tproxy package from: http://www.balabit.com/downloads/files/tproxy/])
3437 AC_MSG_WARN([or use '--enable-linux-netfilter' option instead for Netfilter support.])
b50f1b2b 3438 else
96f08e2d 3439 AC_MSG_RESULT($squid_opt_linux_tproxy2)
b50f1b2b 3440 fi
fc68f6b1 3441fi
3442
96f08e2d
FC
3443dnl at the end of it all..
3444if test "$squid_opt_linux_tproxy2" = "yes" ; then
3445 AC_DEFINE(LINUX_TPROXY2, 1)
3446else
3447 AC_DEFINE(LINUX_TPROXY2, 0)
3448fi
3449
3450
cc937513 3451AC_ARG_ENABLE(gnuregex,
62979ab1 3452 AS_HELP_STRING([--enable-gnuregex],[Compile GNUregex. Unless you have reason to use
cc937513
AJ
3453 this option, you should not enable it.
3454 This library file is usually only required on Windows and
3455 very old Unix boxes which do not have their own regex
3456 library built in.]),
3457[USE_GNUREGEX=$enableval])
91bc414e 3458if test -z "$USE_GNUREGEX" ; then
3459 case "$host" in
3460 *-sun-solaris2.[[0-4]])
3461 USE_GNUREGEX="yes"
3462 ;;
3463 *-next-nextstep*)
3464 USE_GNUREGEX="yes"
3465 ;;
3466 esac
3467fi
7a081912 3468AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 3469if test -z "$USE_GNUREGEX"; then
55878dfd 3470if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 3471 USE_GNUREGEX="yes"
00fa2c12 3472else
62979ab1
AJ
3473 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
3474#include <regex.h>]], [[regex_t t; regcomp(&t,"",0);]])],[USE_GNUREGEX="no"],[USE_GNUREGEX="yes"])
91bc414e 3475fi
00fa2c12 3476fi
74946a0f 3477AC_MSG_RESULT($USE_GNUREGEX)
3478if test "$USE_GNUREGEX" = "yes"; then
cc937513
AJ
3479 # override system regex with ours. Not good. But what was asked for.
3480 REGEXLIB=""
6a9f6389 3481 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
7a081912 3482fi
26675bf4 3483AC_SUBST(REGEXLIB)
cc937513 3484#AC_SUBST(LIBREGEX)
7a081912 3485
5c51415d 3486dnl Not cached since people are likely to tune this
e924600d 3487AC_MSG_CHECKING(Default FD_SETSIZE value)
62979ab1 3488AC_RUN_IFELSE([AC_LANG_SOURCE([[
e924600d 3489#if HAVE_STDIO_H
3490#include <stdio.h>
3491#endif
3492#if HAVE_UNISTD_H
3493#include <unistd.h>
3494#endif
cf69e4f2
HN
3495#if HAVE_STDLIB_H
3496#include <stdlib.h>
3497#endif
e924600d 3498#if HAVE_SYS_TIME_H
3499#include <sys/time.h>
3500#endif
3501#if HAVE_SYS_SELECT_H
3502#include <sys/select.h>
3503#endif
3504#if HAVE_SYS_TYPES_H
3505#include <sys/types.h>
3506#endif
bfe8dedf
GS
3507#if HAVE_WINSOCK_H
3508#include <winsock.h>
3509#endif
3510#if HAVE_WINSOCK2_H
3511#include <winsock2.h>
3512#endif
b3167ca7 3513int main(int argc, char **argv) {
635e6242 3514 FILE *fp = fopen("conftestval", "w");
3515 fprintf (fp, "%d\n", FD_SETSIZE);
b3167ca7 3516 return 0;
e924600d 3517}
62979ab1 3518]])],[DEFAULT_FD_SETSIZE=`cat conftestval`],[DEFAULT_FD_SETSIZE=256],[DEFAULT_FD_SETSIZE=256])
e924600d 3519AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
6a9f6389 3520AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
e924600d 3521
f49be7d1 3522
5c51415d 3523dnl Not cached since people are likely to tune this
234967c9 3524AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 3525dnl damn! FreeBSD's pthreads breaks dup2().
5132a9eb 3526TLDFLAGS="$LDFLAGS"
f49be7d1 3527if test -n "$squid_filedescriptors_num" ; then
3528 SQUID_MAXFD=$squid_filedescriptors_num
3529 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
3530else
f49be7d1 3531 case $host in
3532 i386-unknown-freebsd*)
3533 if echo "$LDFLAGS" | grep -q pthread; then
3534 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
3535 fi
3536 esac
62979ab1 3537 AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3538#include <stdio.h>
234967c9 3539#include <unistd.h>
cf69e4f2 3540#include <stdlib.h>
30a4f2a8 3541#include <sys/time.h> /* needed on FreeBSD */
234967c9 3542#include <sys/param.h>
3543#include <sys/resource.h>
b3167ca7 3544int main(int argc, char **argv) {
635e6242 3545 FILE *fp;
234967c9 3546 int i,j;
42b51993 3547#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 3548 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 3549 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 3550 * __CYGWIN32__ is deprecated.
df087e68 3551 */
3552 i = NOFILE;
b05490a8 3553#else
3554#if HAVE_SETRLIMIT
234967c9 3555 struct rlimit rl;
3556#if defined(RLIMIT_NOFILE)
3557 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
3558 perror("getrlimit: RLIMIT_NOFILE");
3559 } else {
f168f0c5
AJ
3560#if defined(__APPLE__)
3561 /* asking for more than OPEN_MAX fails on Leopard */
3562 rl.rlim_cur = (OPEN_MAX < rl.rlim_max ? OPEN_MAX : rl.rlim_max);
3563#else
234967c9 3564 rl.rlim_cur = rl.rlim_max; /* set it to the max */
f168f0c5 3565#endif
234967c9 3566 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
3567 perror("setrlimit: RLIMIT_NOFILE");
3568 }
3569 }
3570#elif defined(RLIMIT_OFILE)
3571 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
3572 perror("getrlimit: RLIMIT_OFILE");
3573 } else {
3574 rl.rlim_cur = rl.rlim_max; /* set it to the max */
3575 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
3576 perror("setrlimit: RLIMIT_OFILE");
3577 }
3578 }
3579#endif /* RLIMIT_NOFILE */
3580#endif /* HAVE_SETRLIMIT */
d9399075 3581 /* by starting at 2^14, we will never get higher
3582 than 2^15 for SQUID_MAXFD */
3583 i = j = 1<<14;
3584 while (j) {
3585 j >>= 1;
3586 if (dup2(0, i) < 0) {
3587 i -= j;
3588 } else {
3589 close(i);
3590 i += j;
3591 }
3592 }
3593 i++;
b05490a8 3594#endif /* IF !DEF CYGWIN */
635e6242 3595 fp = fopen("conftestval", "w");
a4d7e961 3596 fprintf (fp, "%d\n", i & ~0x3F);
b3167ca7 3597 return 0;
234967c9 3598}
62979ab1 3599 ]])],[SQUID_MAXFD=`cat conftestval`],[SQUID_MAXFD=256],[SQUID_MAXFD=256])
4b26fae9 3600 dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs
3601 case "$host_os" in
3602 mingw|mingw32)
3603 SQUID_MAXFD="2048"
3604 ;;
3605 esac
f49be7d1 3606 AC_MSG_RESULT($SQUID_MAXFD)
3607fi
6a9f6389 3608AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
b9cc811d 3609if test "$SQUID_MAXFD" -lt 512 ; then
eed82608
AJ
3610 AC_MSG_WARN([$SQUID_MAXFD may not be enough filedescriptors if your])
3611 AC_MSG_WARN([cache will be very busy. Please see the FAQ page])
3612 AC_MSG_WARN([http://wiki.squid-cache.org/SquidFaq/TroubleShooting])
3613 AC_MSG_WARN([on how to increase your filedescriptor limit])
80ab193b 3614fi
c76d8acc 3615LDFLAGS="$TLDFLAGS"
234967c9 3616
d0f9207a 3617if test `expr $SQUID_MAXFD % 64` != 0; then
eed82608 3618 AC_MSG_WARN([$SQUID_MAXFD is not an multiple of 64. This may cause issues on certain platforms.])
a4d7e961 3619fi
3620
5c51415d 3621dnl Not cached since people are likely to tune this
30a4f2a8 3622AC_MSG_CHECKING(Default UDP send buffer size)
62979ab1 3623AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3624#include <stdlib.h>
3625#include <stdio.h>
30a4f2a8 3626#include <sys/types.h>
bfe8dedf 3627#if HAVE_SYS_SOCKET_H
30a4f2a8 3628#include <sys/socket.h>
bfe8dedf
GS
3629#endif
3630#if HAVE_NETINET_IN_H
30a4f2a8 3631#include <netinet/in.h>
bfe8dedf
GS
3632#endif
3633#if HAVE_WINSOCK_H
3634#include <winsock.h>
3635#endif
3636#if HAVE_WINSOCK2_H
3637#include <winsock2.h>
3638#endif
b3167ca7 3639int main(int argc, char **argv)
30a4f2a8 3640{
635e6242 3641 FILE *fp;
eab7694a 3642 int fd,val=0;
bfe8dedf 3643#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3644 int len=sizeof(int);
bfe8dedf
GS
3645 WSADATA wsaData;
3646 WSAStartup(2, &wsaData);
eab7694a
GS
3647#else
3648 socklen_t len=sizeof(socklen_t);
bfe8dedf 3649#endif
b3167ca7 3650 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return 1;
bfe8dedf 3651#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3652 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3653 WSACleanup();
f3f3e961 3654#else
b3167ca7 3655 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) return 1;
bfe8dedf 3656#endif
b3167ca7 3657 if (val<=0) return 1;
635e6242 3658 fp = fopen("conftestval", "w");
3659 fprintf (fp, "%d\n", val);
b3167ca7 3660 return 0;
30a4f2a8 3661}
62979ab1 3662]])],[SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`],[SQUID_DETECT_UDP_SO_SNDBUF=16384],[SQUID_DETECT_UDP_SO_SNDBUF=16384])
6a9f6389 3663AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
3664AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
30a4f2a8 3665
5c51415d 3666dnl Not cached since people are likely to tune this
30a4f2a8 3667AC_MSG_CHECKING(Default UDP receive buffer size)
62979ab1 3668AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3669#include <stdlib.h>
3670#include <stdio.h>
30a4f2a8 3671#include <sys/types.h>
bfe8dedf 3672#if HAVE_SYS_SOCKET_H
30a4f2a8 3673#include <sys/socket.h>
bfe8dedf
GS
3674#endif
3675#if HAVE_NETINET_IN_H
30a4f2a8 3676#include <netinet/in.h>
bfe8dedf
GS
3677#endif
3678#if HAVE_WINSOCK_H
3679#include <winsock.h>
3680#endif
3681#if HAVE_WINSOCK2_H
3682#include <winsock2.h>
3683#endif
b3167ca7 3684int main(int argc, char **argv)
30a4f2a8 3685{
635e6242 3686 FILE *fp;
eab7694a 3687 int fd,val=0;
bfe8dedf 3688#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3689 int len=sizeof(int);
bfe8dedf
GS
3690 WSADATA wsaData;
3691 WSAStartup(2, &wsaData);
eab7694a
GS
3692#else
3693 socklen_t len=sizeof(socklen_t);
bfe8dedf 3694#endif
b3167ca7 3695 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return 1;
bfe8dedf 3696#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3697 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3698 WSACleanup();
f3f3e961 3699#else
b3167ca7 3700 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) return 1;
bfe8dedf 3701#endif
b3167ca7 3702 if (val <= 0) return 1;
635e6242 3703 fp = fopen("conftestval", "w");
3704 fprintf (fp, "%d\n", val);
b3167ca7 3705 return 0;
30a4f2a8 3706}
62979ab1 3707]])],[SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`],[SQUID_DETECT_UDP_SO_RCVBUF=16384],[SQUID_DETECT_UDP_SO_RCVBUF=16384])
6a9f6389 3708AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
3709AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
30a4f2a8 3710
5c51415d 3711dnl Not cached since people are likely to tune this
30a4f2a8 3712AC_MSG_CHECKING(Default TCP send buffer size)
62979ab1 3713AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3714#include <stdlib.h>
3715#include <stdio.h>
30a4f2a8 3716#include <sys/types.h>
bfe8dedf 3717#if HAVE_SYS_SOCKET_H
30a4f2a8 3718#include <sys/socket.h>
bfe8dedf
GS
3719#endif
3720#if HAVE_NETINET_IN_H
30a4f2a8 3721#include <netinet/in.h>
bfe8dedf
GS
3722#endif
3723#if HAVE_WINSOCK_H
3724#include <winsock.h>
3725#endif
3726#if HAVE_WINSOCK2_H
3727#include <winsock2.h>
3728#endif
b3167ca7 3729int main(int argc, char **argv)
30a4f2a8 3730{
635e6242 3731 FILE *fp;
eab7694a 3732 int fd,val=0;
bfe8dedf 3733#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3734 int len=sizeof(int);
bfe8dedf
GS
3735 WSADATA wsaData;
3736 WSAStartup(2, &wsaData);
eab7694a
GS
3737#else
3738 socklen_t len=sizeof(socklen_t);
bfe8dedf 3739#endif
b3167ca7 3740 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) return 1;
bfe8dedf 3741#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3742 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3743 WSACleanup();
f3f3e961 3744#else
b3167ca7 3745 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) return 1;
bfe8dedf 3746#endif
b3167ca7 3747 if (val <= 0) return 1;
635e6242 3748 fp = fopen("conftestval", "w");
3749 fprintf (fp, "%d\n", val);
b3167ca7 3750 return 0;
30a4f2a8 3751}
62979ab1 3752]])],[SQUID_TCP_SO_SNDBUF=`cat conftestval`],[SQUID_TCP_SO_SNDBUF=16384],[SQUID_TCP_SO_SNDBUF=16384])
30a4f2a8 3753AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
2aa6ca58 3754if test $SQUID_TCP_SO_SNDBUF -gt 32768; then
eed82608 3755 AC_MSG_NOTICE([Limiting send buffer size to 32K])
2aa6ca58 3756 SQUID_TCP_SO_SNDBUF=32768
3757fi
6a9f6389 3758AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
30a4f2a8 3759
5c51415d 3760dnl Not cached since people are likely to tune this
30a4f2a8 3761AC_MSG_CHECKING(Default TCP receive buffer size)
62979ab1 3762AC_RUN_IFELSE([AC_LANG_SOURCE([[
8cca06da 3763#include <stdlib.h>
3764#include <stdio.h>
30a4f2a8 3765#include <sys/types.h>
bfe8dedf 3766#if HAVE_SYS_SOCKET_H
30a4f2a8 3767#include <sys/socket.h>
bfe8dedf
GS
3768#endif
3769#if HAVE_NETINET_IN_H
30a4f2a8 3770#include <netinet/in.h>
bfe8dedf
GS
3771#endif
3772#if HAVE_WINSOCK_H
3773#include <winsock.h>
3774#endif
3775#if HAVE_WINSOCK2_H
3776#include <winsock2.h>
3777#endif
b3167ca7 3778int main(int argc, char **argv)
30a4f2a8 3779{
635e6242 3780 FILE *fp;
eab7694a 3781 int fd,val=0;
bfe8dedf 3782#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
eab7694a 3783 int len=sizeof(int);
bfe8dedf
GS
3784 WSADATA wsaData;
3785 WSAStartup(2, &wsaData);
eab7694a
GS
3786#else
3787 socklen_t len=sizeof(socklen_t);
bfe8dedf 3788#endif
b3167ca7 3789 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) return 1;
bfe8dedf 3790#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
b3167ca7 3791 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&val, &len) < 0) return 1;
bfe8dedf 3792 WSACleanup();
f3f3e961 3793#else
b3167ca7 3794 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) return 1;
bfe8dedf 3795#endif
b3167ca7 3796 if (val <= 0) return 1;
635e6242 3797 fp = fopen("conftestval", "w");
3798 fprintf (fp, "%d\n", val);
b3167ca7 3799 return 0;
30a4f2a8 3800}
62979ab1 3801]])],[SQUID_TCP_SO_RCVBUF=`cat conftestval`],[SQUID_TCP_SO_RCVBUF=16384],[SQUID_TCP_SO_RCVBUF=16384])
30a4f2a8 3802AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
2aa6ca58 3803if test $SQUID_TCP_SO_RCVBUF -gt 65535; then
eed82608 3804 AC_MSG_NOTICE([Limiting receive buffer size to 64K])
2aa6ca58 3805 SQUID_TCP_SO_RCVBUF=65535
3806fi
6a9f6389 3807AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
5c51415d 3808AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
62979ab1 3809 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[char *s = sys_errlist;]])],[ac_cv_needs_sys_errlist="no"],[ac_cv_needs_sys_errlist="yes"])
5c51415d 3810)
3811if test "$ac_cv_needs_sys_errlist" = "yes" ; then
6a9f6389 3812 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
5c51415d 3813fi
30a4f2a8 3814
5c51415d 3815dnl Not cached since people are likely to change this
6bf65235 3816AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
62979ab1
AJ
3817AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern int _dns_ttl_;]], [[return _dns_ttl_;]])],[AC_MSG_RESULT(yes)
3818AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],[AC_MSG_RESULT(no)])
6bf65235 3819
b6a2f15e 3820if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 3821AC_MSG_CHECKING(for working statvfs() interface)
62979ab1 3822AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c68e9c6b 3823#include <stdlib.h>
3824#include <stdio.h>
3825#include <sys/types.h>
3826#include <sys/statvfs.h>
62979ab1 3827]], [[
c68e9c6b 3828struct statvfs sfs;
3829sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
3830sfs.f_files = sfs.f_ffree = 0;
3831statvfs("/tmp", &sfs);
62979ab1 3832]])],[ac_cv_func_statvfs=yes],[ac_cv_func_statvfs=no])
c68e9c6b 3833AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 3834if test "$ac_cv_func_statvfs" = "yes" ; then
6a9f6389 3835 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
b6a2f15e 3836fi
6b8e7481 3837fi
c68e9c6b 3838
cc192b50 3839dnl Detect what resolver fields we have available to use...
3840AC_CACHE_CHECK(for _res_ext.nsaddr_list, ac_cv_have_res_ext_nsaddr_list,
62979ab1 3841AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
cc192b50 3842#if HAVE_SYS_TYPES_H
3843#include <sys/types.h>
3844#endif
3845#if HAVE_NETINET_IN_H
3846#include <netinet/in.h>
3847#endif
3848#if HAVE_ARPA_INET_H
3849#include <arpa/inet.h>
3850#endif
3851#if HAVE_ARPA_NAMESER_H
3852#include <arpa/nameser.h>
3853#endif
3854#if HAVE_RESOLV_H
3855#include <resolv.h>
3856#endif
62979ab1 3857]], [[_res_ext.nsaddr_list[[0]].s_addr;]])],[ac_cv_have_res_ext_nsaddr_list="yes"],[ac_cv_have_res_ext_nsaddr_list="no"]))
cc192b50 3858if test "$ac_cv_have_res_ext_nsaddr_list" = "yes" ; then
3859 AC_DEFINE(_SQUID_RES_NSADDR6_LARRAY,_res_ext.nsaddr_list,[If _res_ext structure has nsaddr_list member])
3860 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,ns6count,[Nameserver Counter for IPv6 _res_ext])
3861fi
3862
0873b2ab 3863if test "$_SQUID_RES_NSADDR6_LIST" = ""; then
cc192b50 3864AC_CACHE_CHECK(for _res._u._ext.nsaddrs, ac_cv_have_res_ext_nsaddrs,
62979ab1 3865AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
cc192b50 3866#if HAVE_SYS_TYPES_H
3867#include <sys/types.h>
3868#endif
3869#if HAVE_NETINET_IN_H
3870#include <netinet/in.h>
3871#endif
3872#if HAVE_ARPA_INET_H
3873#include <arpa/inet.h>
3874#endif
3875#if HAVE_ARPA_NAMESER_H
3876#include <arpa/nameser.h>
3877#endif
3878#if HAVE_RESOLV_H
3879#include <resolv.h>
3880#endif
62979ab1 3881]], [[_res._u._ext.nsaddrs[[0]]->sin6_addr;]])],[ac_cv_have_res_ext_nsaddrs="yes"],[ac_cv_have_res_ext_nsaddrs="no"]))
cc192b50 3882if test "$ac_cv_have_res_ext_nsaddrs" = "yes" ; then
3883 AC_DEFINE(_SQUID_RES_NSADDR6_LPTR,_res._u._ext.nsaddrs,[If _res structure has _ext.nsaddrs member])
3884 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,_res._u._ext.nscount6,[Nameserver Counter for IPv6 _res])
3885fi
3886fi
3887
c68e9c6b 3888AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
62979ab1 3889AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c68e9c6b 3890#if HAVE_SYS_TYPES_H
3891#include <sys/types.h>
3892#endif
3893#if HAVE_NETINET_IN_H
3894#include <netinet/in.h>
3895#endif
3896#if HAVE_ARPA_INET_H
3897#include <arpa/inet.h>
3898#endif
3899#if HAVE_ARPA_NAMESER_H
3900#include <arpa/nameser.h>
3901#endif
3902#if HAVE_RESOLV_H
3903#include <resolv.h>
3904#endif
62979ab1 3905]], [[_res.nsaddr_list[[0]];]])],[ac_cv_have_res_nsaddr_list="yes"],[ac_cv_have_res_nsaddr_list="no"]))
c68e9c6b 3906if test $ac_cv_have_res_nsaddr_list = "yes" ; then
cc192b50 3907 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.nsaddr_list,[If _res structure has nsaddr_list member])
3908 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
c68e9c6b 3909fi
3910
0873b2ab 3911if test "$_SQUID_RES_NSADDR_LIST" = ""; then
c68e9c6b 3912AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
62979ab1 3913AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
c68e9c6b 3914#if HAVE_SYS_TYPES_H
3915#include <sys/types.h>
3916#endif
3917#if HAVE_NETINET_IN_H
3918#include <netinet/in.h>
3919#endif
3920#if HAVE_ARPA_INET_H
3921#include <arpa/inet.h>
3922#endif
3923#if HAVE_ARPA_NAMESER_H
3924#include <arpa/nameser.h>
3925#endif
3926#if HAVE_RESOLV_H
3927#include <resolv.h>
3928#endif
62979ab1 3929]], [[_res.ns_list[[0]].addr;]])],[ac_cv_have_res_ns_list="yes"],[ac_cv_have_res_ns_list="no"]))
c68e9c6b 3930if test $ac_cv_have_res_ns_list = "yes" ; then
cc192b50 3931 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.ns_list,[If _res structure has ns_list member])
3932 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
c68e9c6b 3933fi
3934fi
3935
461b8219 3936dnl Squid will usually attempt to translate when packaging or building from VCS
44e0a249 3937use_translation="yes"
461b8219 3938AC_ARG_ENABLE(translation,
62979ab1 3939 AS_HELP_STRING([--disable-translation],[Prevent Squid generating localized error page templates and manuals.
b3fed8c3 3940 Which is usually tried, but may not be needed.]),
461b8219
AJ
3941[ if test "$enableval" = "no" ; then
3942 use_translation=no
3943 fi
3944])
e4b70b44 3945dnl Squid now has .po translation capability, given the right toolkit
461b8219
AJ
3946if test "$use_translation" = "yes" ; then
3947 AX_WITH_PROG([PO2HTML],[po2html])
3948else
3949 PO2HTML="off"
3950fi
3951AC_SUBST(PO2HTML)
ee1a8ac2 3952
43000484
AJ
3953dnl Squid now has limited locale handling ...
3954dnl on error pages
8db7a54b 3955use_errlocale=yes
43000484 3956AC_ARG_ENABLE(auto-locale,
62979ab1 3957 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
21d5413e
AJ
3958 clients request headers.
3959 When disabled Squid requires explicit language configuration.]),
8db7a54b
AJ
3960[ if test "$enableval" = "no" ; then
3961 use_errlocale=no
3962 fi
3963])
3964if test "$use_errlocale" = "yes" ; then
eed82608 3965 AC_MSG_NOTICE([Enabling Multi-Language Support])
43000484 3966 AC_DEFINE(USE_ERR_LOCALES,1,[Use multi-language support on error pages])
8db7a54b 3967else
eed82608 3968 AC_MSG_WARN([Disabling Multi-Language Support])
43000484 3969 AC_DEFINE(USE_ERR_LOCALES,0,[Use multi-language support on error pages])
8db7a54b 3970fi
43000484 3971
090089c4 3972dnl Need the debugging version of malloc if available
3973XTRA_OBJS=''
6509a1a0 3974if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 3975 if test -r /usr/lib/debug/malloc.o ; then
3976 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3977 fi
3978 if test -r /usr/lib/debug/mallocmap.o ; then
3979 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3980 fi
3981fi
3982AC_SUBST(XTRA_OBJS)
3983
38fea766 3984if test -z "$XTRA_LIBS"; then
3985 XTRA_LIBS="$LIBS"
0f5a16f8 3986 dnl minor cleanup
3987 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 3988 LIBS=''
3989fi
090089c4 3990AC_SUBST(XTRA_LIBS)
3991
090089c4 3992dnl Clean up after OSF/1 core dump bug
3993rm -f core
3994
6a9f6389 3995AC_CONFIG_FILES([\
a2794549 3996 Makefile \
eee95dfe 3997 compat/Makefile \
a2794549 3998 lib/Makefile \
a2794549 3999 scripts/Makefile \
a2794549 4000 src/Makefile \
5bd7a218 4001 src/base/Makefile \
bcf44a2c 4002 src/acl/Makefile \
a2794549 4003 src/fs/Makefile \
4004 src/repl/Makefile \
4005 src/auth/Makefile \
5fa840c3 4006 src/adaptation/Makefile \
1f3c65fc
AR
4007 src/adaptation/icap/Makefile \
4008 src/adaptation/ecap/Makefile \
f99c2cfe 4009 src/esi/Makefile \
ee0927b6 4010 src/eui/Makefile \
663ff9aa 4011 src/icmp/Makefile \
4daaf3cb 4012 src/ident/Makefile \
f963428c 4013 src/ip/Makefile \
82b7abe3 4014 src/log/Makefile \
a2794549 4015 contrib/Makefile \
4016 snmplib/Makefile \
4017 icons/Makefile \
4018 errors/Makefile \
1077c1b8 4019 test-suite/Makefile \
99db07b3 4020 doc/Makefile \
3faa6da8 4021 doc/manuals/Makefile \
0c510f3c 4022 helpers/Makefile \
4023 helpers/basic_auth/Makefile \
4024 helpers/basic_auth/LDAP/Makefile \
4025 helpers/basic_auth/MSNT/Makefile \
4026 helpers/basic_auth/NCSA/Makefile \
4027 helpers/basic_auth/PAM/Makefile \
4028 helpers/basic_auth/SMB/Makefile \
6e785d85 4029 helpers/basic_auth/mswin_sspi/Makefile \
0c510f3c 4030 helpers/basic_auth/YP/Makefile \
4031 helpers/basic_auth/getpwnam/Makefile \
4032 helpers/basic_auth/multi-domain-NTLM/Makefile \
4033 helpers/basic_auth/SASL/Makefile \
bcf74be7 4034 helpers/basic_auth/POP3/Makefile \
002d9b03 4035 helpers/basic_auth/DB/Makefile \
d80aac12 4036 helpers/basic_auth/squid_radius_auth/Makefile \
0c510f3c 4037 helpers/digest_auth/Makefile \
4038 helpers/digest_auth/password/Makefile \
55013f9c 4039 helpers/digest_auth/ldap/Makefile \
89f77e43 4040 helpers/digest_auth/eDirectory/Makefile \
0c510f3c 4041 helpers/ntlm_auth/Makefile \
4042 helpers/ntlm_auth/fakeauth/Makefile \
4043 helpers/ntlm_auth/no_check/Makefile \
3963d7b1
AJ
4044 helpers/ntlm_auth/smb_lm/Makefile \
4045 helpers/ntlm_auth/smb_lm/smbval/Makefile \
6e785d85 4046 helpers/ntlm_auth/mswin_sspi/Makefile \
4047 helpers/negotiate_auth/Makefile \
45b2de83 4048 helpers/negotiate_auth/kerberos/Makefile \
6e785d85 4049 helpers/negotiate_auth/mswin_sspi/Makefile \
c6588c68 4050 helpers/external_acl/Makefile \
4051 helpers/external_acl/ip_user/Makefile \
4052 helpers/external_acl/ldap_group/Makefile \
74ab8d10 4053 helpers/external_acl/session/Makefile \
c6588c68 4054 helpers/external_acl/unix_group/Makefile \
736a9a4d 4055 helpers/external_acl/wbinfo_group/Makefile \
9e6e0372 4056 helpers/external_acl/mswin_ad_group/Makefile \
94ab55b0 4057 helpers/external_acl/mswin_lm_group/Makefile \
82b7abe3
AJ
4058 helpers/log_daemon/Makefile \
4059 helpers/log_daemon/file/Makefile \
fdbb3b19
AJ
4060 helpers/url_rewrite/Makefile \
4061 helpers/url_rewrite/fake/Makefile \
94ab55b0 4062 tools/Makefile
53cbe3e4 4063])
43ae1d95 4064
377792e4 4065AC_CONFIG_SUBDIRS(lib/libTrie)
4066
3e7b6055 4067# must configure libltdl subdir unconditionally for "make distcheck" to work
660faa02 4068AC_CONFIG_SUBDIRS(libltdl)
3e7b6055 4069
6a9f6389 4070AC_OUTPUT