]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.ac
Windows: Ensure array index is an integer in C code
[thirdparty/squid.git] / configure.ac
CommitLineData
b0e13af3 1AC_INIT([Squid Web Proxy],[3.HEAD-BZR],[http://bugs.squid-cache.org/],[squid])
d966027f 2AC_PREREQ(2.61)
62979ab1 3AC_CONFIG_HEADERS([include/autoconf.h])
71b12d7c 4AC_CONFIG_AUX_DIR(cfgaux)
8d9ce05e 5AC_CONFIG_SRCDIR([src/main.cc])
189f1e66 6AM_INIT_AUTOMAKE([tar-ustar nostdinc])
c2720d44 7AC_REVISION($Revision$)dnl
a2794549 8AC_PREFIX_DEFAULT(/usr/local/squid)
246d7ffc 9AM_MAINTAINER_MODE
a2794549 10
4ecf021b 11m4_include([acinclude/init.m4])
fa522425 12m4_include([acinclude/squid-util.m4])
6a56798f 13m4_include([acinclude/compiler-flags.m4])
0abb39dd 14m4_include([acinclude/os-deps.m4])
c8093f05 15m4_include([acinclude/krb5.m4])
3c586e38 16m4_include([acinclude/pam.m4])
2b448046 17m4_include([acinclude/pkg.m4])
91983da0 18m4_include([acinclude/lib-checks.m4])
a203dec7
AJ
19m4_include([acinclude/ax_cxx_compile_stdcxx_0x.m4])
20m4_include([acinclude/ax_cxx_0x_types.m4])
6a56798f 21
63e02610 22PRESET_CFLAGS="$CFLAGS"
a203dec7 23PRESET_CXXFLAGS="$CXXFLAGS"
63e02610 24PRESET_LDFLAGS="$LDFLAGS"
25
a2794549 26dnl Set default LDFLAGS
fcabe077 27if test "x$LDFLAGS" = "x" ; then
73862432 28 LDFLAGS="-g"
a2794549 29fi
30
aff48cc8 31# Check for GNU cc
a2794549 32AC_PROG_CC
e6c4cdd6 33AM_PROG_CC_C_O
29b8d8d6 34AC_PROG_CXX
62979ab1 35AC_LANG([C++])
88d50a22 36AC_CANONICAL_HOST
3e7b6055 37
c8640c9a
AJ
38# Clang 3.2 on some CPUs requires -march-native to detect correctly.
39# GCC 4.3+ can also produce faster executables when its used.
40# But building inside a virtual machine environment has been found to
41# cause random Illegal Instruction errors due to mis-detection of CPU.
42AC_ARG_ENABLE(arch-native,
43 AS_HELP_STRING([--disable-arch-native],[Some compilers offer CPU-specific
44 optimizations with the -march=native parameter.
45 This flag disables the optimization. The default is to
46 auto-detect compiler support and use where available.]), [
47 SQUID_YESNO([$enableval],
48 [Unrecognized argument to --disable-arch-native: $enableval])
49])
50AC_MSG_NOTICE([CPU -march=native optimization enabled: ${enable_arch_native:=auto}])
51if test "x${enable_arch_native}" != "xno"; then
52 SQUID_CC_CHECK_ARGUMENT([squid_cv_check_marchnative],[-march=native])
53fi
e9d3951b
AJ
54
55# might be cross-compiling.
de051d9d
BJ
56if test "x$HOSTCXX" = "x"; then
57 HOSTCXX="$CXX"
6589cd12
AJ
58 if test "x$squid_cv_check_marchnative" = "xyes"; then
59 CXXFLAGS="$CXXFLAGS -march=native"
60 fi
61fi
62if test "x$squid_cv_check_marchnative" = "xyes"; then
63 # always valid for the Host compiler.
64 HOSTCXX="$HOSTCXX -march=native"
de051d9d
BJ
65fi
66AC_SUBST(HOSTCXX)
67
40503c27 68AC_MSG_CHECKING([simplified host os])
78a60bca 69simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
035a321e 70squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
6ca34f6f
HN
71if test -n "$squid_host_os_version"; then
72 squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
73else
74 squid_host_os="$simple_host_os"
75fi
40503c27
FC
76AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
77# on windows squid_host_os is either mingw or cygwin, version is 32
78
b2b60232
FC
79# this needs to be before any test is run, to have more standard
80# functions available on some Unix sysems (e.g. Solaris)
81if test "x$squid_host_os" = "solaris" -a "x$GCC" != "x" ; then
82 AC_USE_SYSTEM_EXTENSIONS
83fi
84
a203dec7
AJ
85# Check for C++0x compiler support
86AX_CXX_COMPILE_STDCXX_0X
5afc4bc8
AJ
87if test "x$ax_cv_cxx_compile_cxx0x_cxx" = "xyes" -a \
88 "x$squid_host_os" != "xmingw" ; then
1e6c5276
FC
89 #BUG 3613: when clang -std=c++0x is used, it activates a "strict mode"
90 # in the system libraries, which makes some c99 methods unavailable
91 # (e.g. strtoll), yet configure detects them as avilable.
92 case "$CXX" in
93 *clang++*) ;; #do nothing
94 *) CXXFLAGS="$CXXFLAGS -std=c++0x" ;;
95 esac
a203dec7
AJ
96fi
97
aff48cc8 98# test for programs
aff48cc8
FC
99AC_PROG_RANLIB
100AC_PROG_CPP
101AC_PROG_INSTALL
102AC_PROG_LN_S
103AC_PROG_EGREP
104
105AC_PATH_PROG(SH, sh, /bin/sh)
106AC_PATH_PROG(FALSE, false, /usr/bin/false)
107AC_PATH_PROG(TRUE, true, /usr/bin/true)
108AC_PATH_PROG(MV, mv, $FALSE)
109AC_PATH_PROG(MKDIR, mkdir, $FALSE)
110AC_PATH_PROG(LN, ln, cp)
111AC_PATH_PROG(CHMOD, chmod, $FALSE)
6d1c1ab1 112AC_PATH_PROG(TR, tr, $FALSE)
aff48cc8 113AC_PATH_PROG(RM, rm, $FALSE)
ffa3bad9 114AC_PATH_PROG(CPPUNITCONFIG, cppunit-config, false)
aff48cc8
FC
115dnl Libtool 2.2.6 requires: rm -f
116RM="$RM -f"
117
118AC_PATH_PROG(PERL, perl, none)
fcabe077 119if test "x$ac_cv_path_PERL" = "xnone"; then
aff48cc8
FC
120 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
121fi
07f370ee 122AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
aff48cc8 123
52c549d9
AJ
124dnl set $(AR) if not provided by the build environment
125if test "x$AR" = "x"; then
126 AC_PATH_PROG(AR, ar, $FALSE)
127fi
aff48cc8 128AR_R="$AR r"
aff48cc8
FC
129AC_SUBST(AR_R)
130
cda5e747
AJ
131# pre-define DEFAULT_PREFIX, some modules need it.
132if test "${prefix}" = "NONE" ; then
133 squid_prefix=$ac_default_prefix
134else
135 squid_prefix=$prefix
136fi
137AC_DEFINE_UNQUOTED(DEFAULT_PREFIX,[$squid_prefix],[The install prefix])
138
0b45d157
FC
139AC_ARG_ENABLE(strict-error-checking,
140 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
2d65bb9a 141 with all possible static compiler error-checks enabled.
cdb352bb
FC
142 This flag disables the behavior]), [
143 SQUID_YESNO([$enableval],
144 [Unrecognized argument to --disable-strict-error-checking: $enableval])
0b45d157 145])
cdb352bb 146AC_MSG_NOTICE([strict error checking enabled: ${enable_strict_error_checking:=yes}])
d1f95b42 147
3e7b6055
AR
148AC_MSG_CHECKING(whether to use loadable modules)
149AC_ARG_ENABLE(loadable-modules,
73862432
FC
150 AS_HELP_STRING([--disable-loadable-modules],[do not support loadable modules]) , [
151 SQUID_YESNO([$enableval],
152 [Unrecognized argument to --disable-loadable-modules: $enableval])
153])
154AM_CONDITIONAL(USE_LOADABLE_MODULES, test "x${enable_loadable_modules:=yes}" = "xyes")
155AC_MSG_RESULT([$enable_loadable_modules])
3e7b6055 156
73862432 157if test "x$enable_loadable_modules" = "xyes";
3e7b6055 158then
73862432
FC
159 AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules])
160 AC_ENABLE_SHARED
3e7b6055 161else
73862432 162 AC_DISABLE_SHARED
3e7b6055
AR
163fi
164
4313559d 165# LT_INIT requires libtool v2, might as well state it loud
2663a9c8 166LT_PREREQ([2.2])
220d7675 167LT_INIT([dlopen],[disable-shared])
2148ef58
AJ
168if ! test "${ac_top_build_prefix}" = "";
169then
170 # LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
171 # But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
172 # This fixes Linux LTDLv3-v7, and BSD LTDL v2.2
173 top_build_prefix=${ac_top_build_prefix}
174 AC_SUBST(top_build_prefix)
175fi
bd9303f5 176LTDL_INIT
081863f3 177
d9a41469 178dnl LibTool environment is now prepared for setup. Check that it is usable and initialize.
081863f3 179LT_LIB_DLLOAD
3e7b6055
AR
180
181# Do we need these unconditionally for "make distcheck" to work?
182AC_SUBST(INCLTDL)
183AC_SUBST(LIBLTDL)
184
73862432 185if test "x$enable_loadable_modules" = "xyes";
3e7b6055 186then
73862432
FC
187 # Why is this needed? Should not LT_INIT (or LT_LIB_DLLOAD) from libtool do that?
188 LIBADD_DL=${lt_cv_dlopen_libs}
189 AC_SUBST([LIBADD_DL])
3e7b6055
AR
190fi
191
07f370ee 192SQUID_CC_GUESS_VARIANT
fa6307ae 193SQUID_CC_GUESS_OPTIONS
f9d138eb 194
be0c7ff0
FC
195dnl find out the exe extension for this platform.
196dnl If it is not empty, use it for CGI as well.
a2794549 197AC_EXEEXT
198AC_OBJEXT
199
fcabe077
FC
200if test "x$EXEEXT" = "x" ; then
201 CGIEXT=".cgi"
a2794549 202else
fcabe077
FC
203 # automake automatically adds .exe when installing binaries
204 CGIEXT=""
a2794549 205fi
7aeb8001 206AC_SUBST(CGIEXT)
a2794549 207
8075a4da 208AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,
fcabe077
FC
209 [test "x$squid_host_os" = "xmingw" -o "x$squid_host_os" = "xcygwin"])
210AM_CONDITIONAL(USE_IPC_WIN32,[test "x$squid_host_os" = "xmingw"])
211
b5467222
CT
212case "$squid_host_os" in
213mingw)
fcabe077
FC
214 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
215 CFLAGS="$CFLAGS -mthreads"
216 CXXFLAGS="$CXXFLAGS -mthreads"
217 if test "x$ac_cv_path_WIN32_PSAPI" = "xnone"; then
218 AC_MSG_NOTICE([PSAPI.DLL is recommended to run Squid on Windows NT Platform])
219 AC_MSG_NOTICE([Please see PSAPI.DLL section on doc/win32-relnotes.html.])
220 else
221 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
222 LIBS="$LIBS -lpsapi"
223 fi
224 MINGW_LIBS="-lmingwex"
225 AC_SUBST(MINGW_LIBS)
b5467222
CT
226 ;;
227freebsd)
228 # FreeBSD places local libraries and packages in /usr/local
229 CFLAGS="$CFLAGS -I/usr/local/include"
230 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
231 LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-R/usr/local/lib"
232 ;;
233*)
234 ;;
235esac
4b26fae9 236
f4aaf39c 237dnl Substitutions
6a9f6389 238AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
30a4f2a8 239
8075a4da
FC
240AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args",
241 [configure command line used to configure Squid])
090089c4 242
5483d916 243CACHE_EFFECTIVE_USER="nobody"
244AC_ARG_WITH(default-user,
62979ab1 245 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
5483d916 246 [ CACHE_EFFECTIVE_USER="$withval" ]
247)
248AC_SUBST(CACHE_EFFECTIVE_USER)
249
c8d2dc9b
AJ
250DEFAULT_LOG_DIR="$localstatedir/logs"
251AC_ARG_WITH(logdir,
73862432 252 AS_HELP_STRING([--with-logdir=PATH],
cdb352bb 253 [Default location for squid logs. default: PREFIX/var/logs]), [
73862432
FC
254case $withval in
255 yes|no)
256 AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH )
257 ;;
258 *)
259 DEFAULT_LOG_DIR="$withval"
260 ;;
261esac
c8d2dc9b
AJ
262 ]
263)
264AC_SUBST(DEFAULT_LOG_DIR)
265
32f07882 266DEFAULT_PID_FILE="$localstatedir/run/squid.pid"
a7f6af35 267AC_ARG_WITH(pidfile,
e0eb5853 268 AS_HELP_STRING([--with-pidfile=PATH],
cdb352bb 269 [Default location for squid pid file. Default: PREFIX/var/run/squid.pid]), [
73862432
FC
270case $withval in
271 yes|no)
272 AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH )
273 ;;
274 *)
32f07882 275 DEFAULT_PID_FILE="$withval"
73862432
FC
276 ;;
277 esac
e0eb5853 278])
32f07882 279AC_SUBST(DEFAULT_PID_FILE)
a7f6af35 280
bf52b026
AJ
281DEFAULT_SWAP_DIR="$localstatedir/cache/squid"
282AC_ARG_WITH(swapdir,
283 AS_HELP_STRING([--with-swapdir=PATH],
284 [Default location for squid cache directories. Default: PREFIX/var/cache/squid]), [
285case $withval in
286 yes|no)
287 AC_MSG_ERROR( --with-swapdir requires a directory PATH. --with-swapdir=PATH )
288 ;;
289 *)
290 DEFAULT_SWAP_DIR="$withval"
291 ;;
292 esac
293])
294AC_SUBST(DEFAULT_SWAP_DIR)
295
f70e69c6 296if test "$squid_cv_compiler" = "gcc"; then
fcabe077
FC
297 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
298 GCCVER2=`echo $GCCVER | awk '{print $1 * 100}'`
299 case "$host" in
4c43504f 300 i386-*-freebsd*)
fcabe077 301 if test $GCCVER2 -lt 300 ; then
73862432
FC
302 AC_MSG_FAILURE([GCC $GCCVER causes a coredump on $host.
303 Please use a more recent GCC version])
fcabe077
FC
304 fi
305 ;;
4c43504f 306 esac
fcabe077
FC
307 unset GCCVER
308 unset GCCVER2
4c43504f 309fi
310
30a4f2a8 311dnl Set Default CFLAGS
fcabe077 312if test "x$PRESET_CFLAGS" = "x"; then
f70e69c6 313 if test "$squid_cv_compiler" = "gcc"; then
fcabe077
FC
314 case "$host" in
315 *-sun-sunos*)
316 # sunos has too many warnings for this to be useful
317 # motorola too
318 ;;
319 *m88k*)
320 # Motorola cc/ld does not like -02 but is ok on -O
321 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
322 ;;
323 *)
324 CFLAGS="$squid_cv_cc_option_wall $CFLAGS"
325 ;;
326 esac
327 else
328 case "$host" in
329 *mips-sgi-irix6.*)
330 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
331 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
332 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
333 -Wl,-woff,85,-woff,84,-woff,134 \
334 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
335 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
336 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
337 -Wl,-woff,85,-woff,84,-woff,134 \
338 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
339 ;;
30a4f2a8 340 *)
fcabe077
FC
341 ;;
342 esac
343 fi
30a4f2a8 344fi
345
d2e3605e 346dnl set squid required flags
f70e69c6 347if test "$squid_cv_compiler" = "gcc"; then
78a60bca
AJ
348 case "$squid_host_os" in
349 mingw)
9f68fb10 350dnl Guido Serassio (serassio@squid-cache.org) 20070811
351dnl Using the latest MinGW (gcc 3.4.5 + mingw-runtime 3.13) cannot build with
0a13cc9d 352dnl -Werror -Wmissing-prototypes -Wmissing-declarations
9f68fb10 353dnl TODO: check if the problem will be present in any other newer MinGW release.
cb35a124 354 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow"
fcabe077
FC
355 ;;
356 *)
cb35a124 357 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow"
fcabe077
FC
358 ;;
359 esac
cb35a124 360 SQUID_CXXFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow"
d2e3605e 361else
fcabe077
FC
362 SQUID_CFLAGS=
363 SQUID_CXXFLAGS=
d2e3605e 364fi
07f370ee 365
cdb352bb 366if test "x$enable_strict_error_checking" != "xno"; then
fcabe077 367 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
59a09b98 368 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
07f370ee
FC
369fi
370
e0eb5853
FC
371# squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
372SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
373SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
2060fa9a 374
4fe75473
FC
375# possibly include some build info tag into squid -v
376SQUID_EMBED_BUILD_INFO
377
83079644 378AC_ARG_ENABLE(optimizations,
ffa3bad9 379 AS_HELP_STRING([--disable-optimizations],
be0c7ff0 380 [Do not compile Squid with compiler optimizations enabled.
a2f6a96c
FC
381 Optimization is good for production builds, but not
382 good for debugging. During development, use
383 --disable-optimizations to reduce compilation times
cdb352bb
FC
384 and allow easier debugging. This option implies
385 --disable-inline]), [
fcabe077
FC
386if test "x$enableval" = "xno" ; then
387 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
388 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
389 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`"
73862432 390 enable_inline="no"
fcabe077 391fi
83079644 392])
393
ffa3bad9 394AH_TEMPLATE(_USE_INLINE_,[Include inline methods into header file])
6c0c04db 395AC_ARG_ENABLE(inline,
be0c7ff0
FC
396 AS_HELP_STRING([--disable-inline],
397 [Do not compile trivial methods as inline. Squid
a2f6a96c
FC
398 is coded with much of the code able to be inlined.
399 Inlining is good for production builds, but not
400 good for development. During development, use
401 --disable-inline to reduce compilation times and
402 allow incremental builds to be quick. For
403 production builds, or load tests, use
404 --enable-inline to have squid make all trivial
73862432
FC
405 methods inlinable by the compiler.]), [
406SQUID_YESNO([$enableval],
407 [Unrecognized argument to --disable-inline: $enableval])
6c0c04db 408])
941c31f3 409AC_MSG_NOTICE([inlining optimizations enabled: ${enable_inline:=yes}])
73862432
FC
410SQUID_DEFINE_BOOL(_USE_INLINE_,$enable_inline,
411 [Include inline methods into header file])
412# to be used by sub-commands
413export enable_inline
6c0c04db 414
65b81b27
AR
415dnl
416dnl Check for atomic operations support in the compiler
417dnl
34e19edf
AJ
418AC_MSG_CHECKING([for GNU atomic operations support])
419AC_RUN_IFELSE([AC_LANG_PROGRAM([[
65b81b27
AR
420 int n = 0;
421]],[[
d92c39af
AR
422 __sync_add_and_fetch(&n, 10); // n becomes 10
423 __sync_fetch_and_add(&n, 20); // n becomes 30
424 __sync_sub_and_fetch(&n, 15); // n becomes 15
425 __sync_bool_compare_and_swap(&n, 15, 201); // n becomes 201
65b81b27
AR
426 __sync_fetch_and_and(&n, 200); // n becomes 200
427 return (n == 200) ? 0 : -1;
428]])],
429[
34e19edf 430 AC_DEFINE(HAVE_ATOMIC_OPS,1,[Define to 1 if you have __sync_add_and_fetch() and such])
65b81b27
AR
431 AC_MSG_RESULT(yes)
432],[
433 AC_MSG_RESULT(no)
434])
435
436
fa80a8ef 437AC_ARG_ENABLE(debug-cbdata,
8075a4da
FC
438 AS_HELP_STRING([--enable-debug-cbdata],
439 [Provide some debug information in cbdata]), [
50af7161
FC
440SQUID_YESNO([$enableval],
441 [unrecognized argument to --enable-debug-cbdata: $enableval])
fa80a8ef 442])
9a0a18de 443SQUID_DEFINE_BOOL(USE_CBDATA_DEBUG,${enable_debug_cbdata:=no},
50af7161
FC
444 [Enable support for cbdata debug information])
445AC_MSG_NOTICE([cbdata debugging enabled: $enable_debug_cbdata])
446
fa80a8ef 447
c9267250
AJ
448dnl Nasty hack to get autoconf 2.64 on Linux to run.
449dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
aff0e8fe 450AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[:])
c9267250 451
0961c811 452dnl This is a developer only option.. developers know how to set defines
453dnl
454dnl AC_ARG_ENABLE(xmalloc-debug,
455dnl [ --enable-xmalloc-debug Do some simple malloc debugging],
456dnl [ if test "$enableval" = "yes" ; then
eed82608 457dnl AC_MSG_NOTICE([malloc debugging enabled])
6a9f6389 458dnl AC_DEFINE(XMALLOC_DEBUG,1,[Define to do simple malloc debugging])
0961c811 459dnl fi
460dnl ])
461
462dnl This is a developer only option.. developers know how to set defines
463dnl
464dnl AC_ARG_ENABLE(xmalloc-debug-trace,
465dnl [ --enable-xmalloc-debug-trace
466dnl Detailed trace of memory allocations],
467dnl [ if test "$enableval" = "yes" ; then
eed82608 468dnl AC_MSG_NOTICE([malloc debug trace enabled])
6a9f6389 469dnl AC_DEFINE(XMALLOC_TRACE,1,[Define to have a detailed trace of memory allocations])
470dnl AC_DEFINE(XMALLOC_DEBUG,1)
0961c811 471dnl fi
472dnl ])
e5f4e1b0 473
0d00c98b 474AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
d9180414 475AC_ARG_ENABLE(xmalloc-statistics,
8075a4da
FC
476 AS_HELP_STRING([--enable-xmalloc-statistics],
477 [Show malloc statistics in status page]), [
4d1d2477
FC
478SQUID_YESNO([$enableval],
479 [unrecognized argument to --enable-xmalloc-statistics: $enableval])
e5f4e1b0 480])
4d1d2477
FC
481SQUID_DEFINE_BOOL(XMALLOC_STATISTICS,${enable_xmalloc_statistics:=no},
482 [Show malloc statistics in status page])
483AC_MSG_NOTICE([xmalloc stats display: $enable_xmalloc_statistics])
e5f4e1b0 484
8075a4da 485squid_opt_aufs_threads=""
f85c88f3 486AC_ARG_WITH(aufs-threads,
8075a4da
FC
487 AS_HELP_STRING([--with-aufs-threads=N_THREADS],
488 [Tune the number of worker threads for the aufs object store.]), [
489case $withval in
a3310b77 490 [[0-9]]*)
50fbcbd6 491 squid_opt_aufs_threads=$withval
a3310b77 492 ;;
493 *)
8b0d8e31 494 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
a3310b77 495 ;;
496 esac
497])
fcabe077 498if test "x$squid_opt_aufs_threads" != "x"; then
50fbcbd6
FC
499 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
500 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
8075a4da 501 [Defines how many threads aufs uses for I/O])
cd748f27 502fi
503
50fbcbd6 504AC_ARG_WITH(dl, AS_HELP_STRING([--with-dl],[Use dynamic linking]))
fcabe077 505if test "x$with_dl" = "xyes"; then
eed82608 506 AC_MSG_NOTICE([With dl])
8154dd82 507fi
f85c88f3 508
c975f532
DK
509AC_SEARCH_LIBS([shm_open], [rt])
510if test "x$ac_cv_search_shm_open" != "xno" ; then
511 AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
512fi
513
d235bc84 514AC_MSG_CHECKING([for DiskIO modules to be enabled])
50fbcbd6 515squid_disk_module_candidates=""
8075a4da 516squid_opt_enable_diskio="auto" #values: no, yes, "auto"(=yes+detect modules)
2513178d 517AC_ARG_ENABLE(disk-io,
50fbcbd6
FC
518 AS_HELP_STRING([--enable-disk-io="list of modules"],
519 [Build support for the list of disk I/O modules.
520 Set without a value or omitted, all available modules will be built.
521 See src/DiskIO for a list of available modules, or
522 Programmers Guide section on DiskIO
8075a4da
FC
523 for details on how to build your custom disk module]), [
524case $enableval in
2513178d 525 yes)
fe9ddf62 526 ${TRUE}
50fbcbd6 527 #do nothing, "auto" is ok
507ca601 528 ;;
2513178d 529 no)
8075a4da 530 squid_opt_enable_diskio="no"
507ca601 531 ;;
2513178d 532 *)
8075a4da 533 squid_opt_enable_diskio="yes"
47d80734 534 squid_disk_module_candidates=" `echo $enableval| sed -e 's/,/ /g;s/ */ /g'` "
d235bc84 535 SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
507ca601 536 ;;
2513178d 537 esac
50fbcbd6
FC
538])
539
d235bc84 540# if requested to autodetect, find out what we have
fcabe077 541if test "x$squid_opt_enable_diskio" = "xauto"; then
8075a4da 542 squid_opt_enable_diskio="yes"
50fbcbd6 543 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
c975f532
DK
544 if test "x$ac_cv_search_shm_open" = "xno" ; then
545 # disable IpcIo
546 squid_disk_module_candidates=`echo $squid_disk_module_candidates|sed 's/IpcIo//'`
547 fi
50fbcbd6 548fi
d235bc84 549
47d80734 550AC_MSG_RESULT([${squid_disk_module_candidates:-none}])
dc299f29 551SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
0f658b5b 552SQUID_DEFINE_BOOL(USE_DISKIO,$squid_opt_enable_diskio,
50fbcbd6 553 [DiskIO modules are expected to be available.])
2513178d 554
dc299f29 555
40503c27 556
2513178d 557dnl Some autoconf.h defines we might enable later...
0b163dbb
FC
558AC_ARG_WITH(pthreads,AS_HELP_STRING([--without-pthreads],[Disable POSIX Threads]))
559AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO. Default: auto-detect]))
0d00c98b
FC
560AH_TEMPLATE(USE_DISKIO_AIO, [Whether POSIX AIO support is needed. Automatic])
561AH_TEMPLATE(USE_DISKIO_DISKTHREADS, [Whether pthreads support is needed. Automatic])
2513178d 562USE_AIOPS_WIN32=0
ffa3bad9
FC
563squid_opt_use_aio=
564squid_opt_use_diskthreads=
46577dd1 565AIOLIB=
2513178d
AJ
566
567dnl Setup the module paths etc.
2513178d 568DISK_LIBS=
e2716c57 569DISK_OS_LIBS=
2513178d
AJ
570DISK_MODULES=
571DISK_LINKOBJS=
50fbcbd6 572for module in $squid_disk_module_candidates none; do
d235bc84 573 # maybe not needed
fcabe077 574 if test "x$module" = "xnone"; then
507ca601 575 continue
2513178d 576 fi
fcabe077 577 if ! test -d "$srcdir/src/DiskIO/$module"; then
2513178d
AJ
578 AC_MSG_ERROR(disk-io $module does not exist)
579 fi
580 case "$module" in
581 DiskDaemon)
1d3aafe4
FC
582 case "$squid_host_os" in
583 mingw)
584 AC_MSG_NOTICE(["DiskDaemon not supported on MinGW"])
585 ;;
586 *)
587 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
588 DISK_LIBS="$DISK_LIBS libDiskDaemon.a"
589 DISK_MODULES="$DISK_MODULES DiskDaemon"
590 DISK_PROGRAMS="$DISK_PROGRAMS DiskIO/DiskDaemon/diskd"
591 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskDaemon/DiskDaemonDiskIOModule.o"
592 ;;
593 esac
507ca601 594 ;;
2513178d 595 DiskThreads)
507ca601
FC
596 squid_opt_use_diskthreads="yes"
597 LIBPTHREADS=
598 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
599 if test "x$with_pthreads" != "xno"; then
600 dnl TODO: this needs to be extended to handle more systems and better
601 dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
602 dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
603 case "$squid_host_os" in
604 mingw)
605 USE_AIOPS_WIN32=1
606 AC_MSG_NOTICE([Windows threads support automatically enabled])
607 ;;
608 freebsd)
794533ea 609 if test `echo "$squid_host_os_version" | cut -b1` -lt 7 ; then
a0f82085
AJ
610 AC_MSG_NOTICE(pthread library requires FreeBSD 7 or later)
611 squid_opt_use_diskthreads="no"
612 else
613 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
614 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
615 if test "x$GCC" = "xyes" -a "x$PRESET_LDFLAGS" = "x" ; then
616 LDFLAGS="$LDFLAGS -pthread"
617 fi
507ca601
FC
618 fi
619 ;;
ec264296
SH
620 openbsd)
621 if test `echo "$squid_host_os_version" | tr -d .` -lt 52 ; then
622 AC_MSG_NOTICE(pthread library requires OpenBSD 5.2 or later)
623 squid_opt_use_diskthreads="no"
624 else
625 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
626 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
627 LDFLAGS="$LDFLAGS -lpthread"
628 fi
629 ;;
507ca601
FC
630 solaris)
631 if test "x$GCC" = "xyes" ; then
632 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
633 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
634 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
635 AC_MSG_NOTICE(pthread library required but cannot be found.)
636 squid_opt_use_diskthreads="no"
637 ])
638 else
639 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
640 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
641 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
642 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
643 LIBPTHREADS="" #in LIBS
644 ],[
645 AC_MSG_NOTICE(pthread library required but cannot be found.)
646 squid_opt_use_diskthreads="no"
647 ])
648 fi
649 ;;
650 *)
651 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
652 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
653 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
40503c27
FC
654 AC_MSG_NOTICE(pthread library required but cannot be found.)
655 squid_opt_use_diskthreads="no"
656 ])
507ca601
FC
657 ;;
658 esac
659 else
660 AC_MSG_NOTICE([Native pthreads support manually disabled.])
661 squid_opt_use_diskthreads="no"
662 fi
663 if test "x$squid_opt_use_diskthreads" = "xyes" ; then
664 AC_DEFINE(USE_DISKIO_DISKTHREADS, 1, [Whether pthreads support is needed. Automatic])
665 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
666 DISK_LIBS="$DISK_LIBS libDiskThreads.a"
667 DISK_OS_LIBS="$DISK_OS_LIBS $LIBPTHREADS"
668 DISK_MODULES="$DISK_MODULES DiskThreads"
669 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskThreads/DiskThreadsDiskIOModule.o"
670 else
671 AC_DEFINE(USE_DISKIO_DISKTHREADS, 0, [Whether pthreads support is needed. Automatic])
672 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
0b163dbb 673 SQUID_STATE_ROLLBACK([diskthreads_state])
507ca601
FC
674 fi
675 ;;
2513178d
AJ
676
677 AIO)
507ca601
FC
678 dnl Check for POSIX AIO availability
679 squid_opt_use_aio="yes"
680 AIOLIB=
681 if test "x$with_aio" != "xno"; then
682 have_aio_header=no
683 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
684 dnl On some systems POSIX AIO functions are in librt
685 dnl On some systems POSIX AIO functions are in libaio
686 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
687 dnl Enable AIO if the library and headers are found
688 if test "x$AIOLIB" != "x" && test "x$have_aio_header" = "xyes"; then
689 AC_MSG_NOTICE([Native POSIX AIO support detected.])
690 squid_opt_use_aio="yes"
691 else
692 dnl Windows does things differently. We provide wrappers.
693 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
78a60bca
AJ
694 case "$squid_host_os" in
695 mingw)
507ca601
FC
696 squid_opt_use_aio="yes"
697 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
698 ;;
699 *)
700 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
701 squid_opt_use_aio="no"
702 ;;
703 esac
704 fi
705 else
706 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
707 squid_opt_use_aio="no"
708 fi
709 dnl Use the POSIX AIO pieces if we actually need them.
710 if test "x$squid_opt_use_aio" = "xyes" ; then
711 AC_DEFINE(USE_DISKIO_AIO, 1, [Whether POSIX AIO support is needed. Automatic])
712 DISK_MODULES="$DISK_MODULES AIO"
713 DISK_LIBS="$DISK_LIBS libAIO.a"
714 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/AIO/AIODiskIOModule.o"
78a60bca
AJ
715 case "$squid_host_os" in
716 mingw)
507ca601
FC
717 USE_AIO_WIN32=1
718 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
719 ;;
720 *)
721 AC_MSG_NOTICE([Enabling AIO DiskIO module])
722 DISK_OS_LIBS="$DISK_OS_LIBS $AIOLIB"
723 ;;
724 esac
725 else
726 AC_DEFINE(USE_DISKIO_AIO, 0, [Whether POSIX AIO support is needed. Automatic])
727 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
728 fi
729 ;;
2513178d 730
e2851fe7 731 Mmapped)
e2cbb70e
FC
732 dnl TODO: use availability of sys/mman.h and/or mmap to define
733 dnl OR support windows mmap functions
734 if test "x$squid_host_os" = "xmingw" ; then
735 AC_MSG_NOTICE([Mmapped DiskIO is not available on Mingw])
736 else
737 AC_MSG_NOTICE([Enabling Mmapped DiskIO module])
738 DISK_LIBS="$DISK_LIBS libMmapped.a"
739 DISK_MODULES="$DISK_MODULES Mmapped"
740 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/Mmapped/MmappedDiskIOModule.o"
741 fi
e2851fe7
AR
742 ;;
743
254912f3
AR
744 IpcIo)
745 AC_MSG_NOTICE([Enabling IpcIo DiskIO module])
c975f532
DK
746 if test "x$ac_cv_search_shm_open" = "xno" ; then
747 AC_MSG_ERROR([DiskIO IpcIo module requires shared memory support])
748 fi
254912f3
AR
749 DISK_LIBS="$DISK_LIBS libIpcIo.a"
750 DISK_MODULES="$DISK_MODULES IpcIo"
751 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/IpcIo/IpcIoDiskIOModule.o"
fbb7e179 752 AC_DEFINE(USE_DISKIO_IPCIO, 1, [Enable DiskIO IpcIo module.])
254912f3
AR
753 ;;
754
2513178d 755 Blocking)
507ca601
FC
756 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
757 DISK_LIBS="$DISK_LIBS libBlocking.a"
758 DISK_MODULES="$DISK_MODULES Blocking"
759 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/Blocking/BlockingDiskIOModule.o"
760 ;;
2513178d
AJ
761
762 *)
507ca601
FC
763 AC_MSG_NOTICE([Enabling $module DiskIO module])
764 DISK_LIBS="$DISK_LIBS lib${module}.a"
765 DISK_MODULES="$DISK_MODULES ${module}"
766 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/${module}/${module}DiskIOModule.o"
767 ;;
2513178d
AJ
768 esac
769done
770AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
771AC_SUBST(DISK_MODULES)
772AC_SUBST(DISK_LIBS)
773AC_SUBST(DISK_PROGRAMS)
774AC_SUBST(DISK_LINKOBJS)
e2716c57 775AC_SUBST(DISK_OS_LIBS)
fcabe077
FC
776AM_CONDITIONAL([USE_AIOPS_WIN32], [test "$USE_AIOPS_WIN32" = "1"])
777AM_CONDITIONAL([USE_AIO_WIN32], [test "$USE_AIO_WIN32" = "1"])
2513178d
AJ
778
779
780dnl Check what Storage formats are wanted.
781dnl This version will error out with a message saying why if a required DiskIO is missing.
dc299f29 782squid_opt_enable_storeio=auto
d235bc84
FC
783AC_ARG_ENABLE([storeio],
784 AS_HELP_STRING([--enable-storeio="list of modules"],
785 [Build support for the list of store I/O modules.
18cc92fb
FC
786 The default is only to build the "ufs" module.
787 See src/fs for a list of available modules, or
788 Programmers Guide section <not yet written>
507ca601
FC
789 for details on how to build your custom store module]), [
790case $enableval in
cd748f27 791 yes)
dc299f29 792 squid_opt_enable_storeio=auto
507ca601 793 ;;
cd748f27 794 no)
dc299f29 795 squid_opt_enable_storeio=no
507ca601 796 ;;
1c690e30 797 *)
dc299f29 798 squid_opt_enable_storeio=yes
507ca601 799 squid_storeio_module_candidates="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
80f756db 800 # ufs is really always needed as it has low-level routines
be0c7ff0 801 # if it is a dupe it will be cleaned-up later
80f756db 802 squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
507ca601 803 ;;
cd748f27 804 esac
cd748f27 805])
fcabe077 806if test "x$squid_opt_enable_storeio" = "xauto"; then
dc299f29 807 squid_opt_enable_storeio=yes
d235bc84
FC
808 AC_MSG_CHECKING([for available StoreIO modules])
809 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
810 AC_MSG_RESULT([$squid_storeio_module_candidates])
811fi
812
dc299f29
FC
813SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
814SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
815AC_MSG_NOTICE([Store modules built: $squid_storeio_module_candidates])
816
817for fs in $squid_storeio_module_candidates none; do
507ca601 818 case "$fs" in
8154dd82 819 diskd)
507ca601 820 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
80f756db 821 "$squid_disk_module_candidates_DiskDaemon" != "yes" ; then
507ca601
FC
822 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
823 fi
824 ;;
8154dd82 825 aufs)
507ca601 826 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
80f756db 827 "$squid_disk_module_candidates_DiskThreads" != "yes" ; then
507ca601
FC
828 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
829 fi
830 ;;
e2851fe7 831 rock)
be718d7a
DK
832 if test "x$squid_disk_module_candidates_IpcIo" != "xyes" -a \
833 "x$squid_disk_module_candidates_Blocking" != "xyes"; then
834 AC_MSG_ERROR([Storage module Rock requires IpcIo or Blocking DiskIO module])
c975f532 835 fi
b5377bef 836 squid_do_build_rock=true
e2851fe7 837 ;;
d3b3ab85 838 ufs)
b5377bef
FC
839 squid_do_build_ufs=true
840 ;;
8154dd82 841 esac
a2794549 842done
b5377bef
FC
843
844AM_CONDITIONAL(HAVE_FS_UFS,[test "x$squid_do_build_ufs" = "xtrue" ])
845AM_CONDITIONAL(HAVE_FS_ROCK,[test "x$squid_do_build_rock" = "xtrue" ])
9d6186b1
FC
846dnl hack: need to define those even if not used in the build system to
847dnl make sure that global FS objects are linked to the squid binary.
7b5b7ba8
CT
848AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
849AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
850AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
e2851fe7 851AH_TEMPLATE(HAVE_FS_ROCK, "Define to 1 if rock filesystem module is build")
7b5b7ba8
CT
852
853
dc299f29 854dnl got final squid_storeio_module_candidates, build library lists
b66455ff
AR
855dnl This list will not be needed when each fs library has its own Makefile
856STORE_LIBS_TO_BUILD=
857dnl File system libraries to link executables with.
858dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
859STORE_LIBS_TO_ADD=
dc299f29 860for fs in $squid_storeio_module_candidates; do
7b5b7ba8
CT
861 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
862 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
6d1c1ab1
FC
863 SQUID_TOUPPER_VAR_CONTENTS([fs])
864 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
b66455ff
AR
865done
866
867AC_SUBST(STORE_LIBS_TO_BUILD)
868AC_SUBST(STORE_LIBS_TO_ADD)
082a5e7a 869AC_SUBST(STORE_TESTS)
a2794549 870
24a04df9
AJ
871
872dnl At lest one removal policy is always needed.
873dnl 'lru' removal policy is currently hard-coded by name for tests
874dnl so we must set it as default.
875REPL_POLICIES="lru"
d9180414 876AC_ARG_ENABLE(removal-policies,
56ffc413
FC
877 AS_HELP_STRING([--enable-removal-policies="list of policies"],
878 [Build support for the list of removal policies.
18cc92fb
FC
879 The default is only to build the "lru" module.
880 See src/repl for a list of available modules, or
881 Programmers Guide section 9.9 for details on how
507ca601
FC
882 to build your custom policy]), [
883case $enableval in
6a566b9c 884 yes)
5069fb38 885 SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES])
507ca601 886 ;;
6a566b9c 887 no)
507ca601 888 ;;
1c690e30 889 *)
507ca601
FC
890 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
891 ;;
6a566b9c 892 esac
6a566b9c 893])
fcabe077 894if test "x$REPL_POLICIES" != "x" ; then
56ffc413 895 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
5069fb38 896 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
1c690e30 897 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
898 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
899fi
6a566b9c 900AC_SUBST(REPL_POLICIES)
6a566b9c 901AC_SUBST(REPL_OBJS)
f71946fc 902AC_SUBST(REPL_LIBS)
6a566b9c 903
d1da2d1f 904AM_CONDITIONAL(ENABLE_PINGER, false)
e5f4e1b0 905AC_ARG_ENABLE(icmp,
62979ab1 906 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),
fcabe077 907[ if test "x$enableval" = "xyes" ; then
eed82608 908 AC_MSG_NOTICE([ICMP enabled])
be0c7ff0 909 AC_DEFINE(USE_ICMP,1,[Define to use Squid ICMP and Network Measurement features (highly recommended!)])
d1da2d1f 910 AM_CONDITIONAL(ENABLE_PINGER, true)
e5f4e1b0 911 fi
912])
913
9a0a18de 914AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
d9180414 915AC_ARG_ENABLE(delay-pools,
62979ab1 916 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),
fcabe077 917[ if test "x$enableval" = "xyes" ; then
eed82608 918 AC_MSG_NOTICE([Delay pools enabled])
9a0a18de 919 AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
ffe4ffd8 920 AM_CONDITIONAL(ENABLE_DELAY_POOLS, true)
e5f4e1b0 921 fi
922])
923
5fa840c3 924dnl disable generic/common adaptation support by default
5069fb38 925squid_opt_use_adaptation=no
5fa840c3 926
5069fb38 927squid_opt_use_esi=yes
7eb77a5f
FC
928AH_TEMPLATE([USE_SQUID_ESI],
929 [Define to enable the ESI processor and Surrogate header support])
43ae1d95 930AC_ARG_ENABLE(esi,
7eb77a5f 931 AS_HELP_STRING([--enable-esi],
5069fb38 932 [Enable ESI for accelerators. Benefits from expat or libxml2.
7eb77a5f 933 Enabling ESI will cause squid reverse proxies to be capable
5069fb38 934 of the Edge Acceleration Specification (www.esi.org).]),
507ca601 935 [squid_opt_use_esi=$enableval], [squid_opt_use_esi=no])
88bfe098
AJ
936HAVE_LIBEXPAT=0
937EXPATLIB=
938HAVE_LIBXML2=0
939XMLLIB=
fcabe077 940if test "x$squid_opt_use_esi" = "xyes" ; then
3473acb1 941 AC_MSG_NOTICE([Enabling ESI processor and Surrogate header support.])
7eb77a5f 942 AC_DEFINE(USE_SQUID_ESI,1,
507ca601 943 [Compile the ESI processor and Surrogate header support])
7eb77a5f 944else
8075a4da 945 AC_MSG_NOTICE([Disabling ESI processor])
7eb77a5f 946fi
88bfe098 947
7eb77a5f
FC
948# ESI support libraries: expat
949AC_ARG_WITH(expat, AS_HELP_STRING([--without-expat],[Do not use expat for ESI. Default: auto-detect]))
fcabe077 950if test "x$squid_opt_use_esi" = "xyes" -a "x$with_expat" != "xno" ; then
7eb77a5f
FC
951 AC_CHECK_LIB([expat], [main], [EXPATLIB="-lexpat"; HAVE_LIBEXPAT=1])
952 AC_CHECK_HEADERS([expat.h])
953 AC_DEFINE_UNQUOTED(HAVE_LIBEXPAT, $HAVE_LIBEXPAT, [Define to 1 if you have the expat library])
fcabe077 954 if test "x$with_expat" = "xyes" -a "x$HAVE_LIBEXPAT" != "x1" ; then
7eb77a5f 955 AC_MSG_ERROR([Required library expat is not able to be found.])
23df48fd 956 fi
7eb77a5f 957fi
ad32c661 958
7eb77a5f 959AC_ARG_WITH(libxml2, AS_HELP_STRING([--without-libxml2],[Do not use libxml2 for ESI. Default: auto-detect]))
fcabe077 960if test "x$squid_opt_use_esi" = "xyes" -a "x$with_libxml2" != "xno" ; then
7eb77a5f
FC
961 AC_CHECK_LIB([xml2], [main], [XMLLIB="-lxml2"; HAVE_LIBXML2=1])
962 dnl Find the main header and include path...
0dc1a86a
HN
963 AC_CACHE_CHECK([location of libxml2 include files], [ac_cv_libxml2_include], [
964 AC_CHECK_HEADERS([libxml/parser.h], [], [
94ea9adc 965 AC_MSG_NOTICE([Testing in /usr/include/libxml2])
7eb77a5f
FC
966 SAVED_CPPFLAGS="$CPPFLAGS"
967 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
968 unset ac_cv_header_libxml_parser_h
0dc1a86a
HN
969 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/include/libxml2"], [
970 AC_MSG_NOTICE([Testing in /usr/local/include/libxml2])
971 CPPFLAGS="-I/usr/local/include/libxml2 $SAVED_CPPFLAGS"
972 unset ac_cv_header_libxml_parser_h
973 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/local/include/libxml2"], [
67840a07 974 AC_MSG_NOTICE([Failed to find libxml2 header file libxml/parser.h])
0dc1a86a 975 ])
7eb77a5f 976 ])
0dc1a86a
HN
977 CPPFLAGS="$SAVED_CPPFLAGS"
978 ])
979 ])
980 if test "x$ac_cv_libxml2_include" != "x"; then
981 SQUID_CXXFLAGS="$ac_cv_libxml2_include $SQUID_CXXFLAGS"
982 CPPFLAGS="$ac_cv_libxml2_include $CPPFLAGS"
7eb77a5f 983 fi
0dc1a86a
HN
984 dnl Now that we know where to look find the headers...
985 AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
7eb77a5f 986 AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
fcabe077 987 if test "x$with_libxml2" = "xyes" -a "$HAVE_LIBXML2" != "1" ; then
7eb77a5f
FC
988 AC_MSG_ERROR([Required library libxml2 is not able to be found.])
989 fi
43ae1d95 990fi
7eb77a5f 991
fcabe077
FC
992AM_CONDITIONAL(USE_ESI, test "x$squid_opt_use_esi" = "xyes")
993AM_CONDITIONAL(HAVE_LIBEXPAT, test "$HAVE_LIBEXPAT" = 1)
88bfe098 994AC_SUBST(EXPATLIB)
fcabe077 995AM_CONDITIONAL(HAVE_LIBXML2, test "$HAVE_LIBXML2" = 1)
88bfe098 996AC_SUBST(XMLLIB)
43ae1d95 997
8075a4da 998# icap argument handling
51952383 999AC_ARG_ENABLE(icap-client,
62979ab1 1000 AS_HELP_STRING([--enable-icap-client],[Enable the ICAP client.]),
507ca601
FC
1001 [squid_opt_use_icap_client=$enableval],
1002 [squid_opt_use_icap_client=no])
0f658b5b 1003SQUID_DEFINE_BOOL(ICAP_CLIENT,$squid_opt_use_icap_client,
8075a4da 1004 [Enable ICAP client features in Squid])
fcabe077
FC
1005AM_CONDITIONAL(USE_ICAP_CLIENT, [test "x$squid_opt_use_icap_client" = "xyes" ])
1006if test "x$squid_opt_use_icap_client" = "xyes" ; then
1f3c65fc 1007 ICAP_LIBS="icap/libicap.la"
5069fb38 1008 squid_opt_use_adaptation=yes
51952383 1009else
c21ad0f5 1010 ICAP_LIBS=""
51952383 1011fi
c21ad0f5 1012AC_SUBST(ICAP_LIBS)
51952383 1013
5069fb38 1014squid_opt_use_ecap=1
3e7b6055
AR
1015AC_MSG_CHECKING(whether to support eCAP)
1016AC_ARG_ENABLE(ecap,
8075a4da
FC
1017 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]), [
1018 case "${enableval}" in
1019 yes|no) squid_opt_use_ecap=$enableval ;;
1020 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
1021 esac
1022AC_MSG_RESULT([$squid_opt_use_ecap, explicitly])
1023 ], [
5069fb38
FC
1024 squid_opt_use_ecap=no;
1025 AC_MSG_RESULT([$squid_opt_use_ecap, implicitly])
3e7b6055
AR
1026 ]
1027)
1028
80ab04bb
AR
1029dnl Necessary if the first PKG_CHECK_MODULES call is conditional
1030PKG_PROG_PKG_CONFIG
1031
3e7b6055 1032dnl Perform configuration consistency checks for eCAP
cbc14831 1033if test "x$squid_opt_use_ecap" != "xno";
3e7b6055 1034then
cbc14831
AJ
1035 dnl eCAP support requires loadable modules, which are enabled by default
1036 if test "x$enable_loadable_modules" != "xyes"
1037 then
1038 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.])
1039 fi
4cfba571 1040
cbc14831 1041 if test -n "$PKG_CONFIG"; then
6666da11
AR
1042 dnl eCAP support requires libecap.
1043 dnl This Squid supports libecap v0.2.x.
3e115aaf
AR
1044 dnl Use EXT_ prefix to distinguish external libecap (that we check for
1045 dnl here) from our own convenience ecap library in Makefiles.
cbc14831
AJ
1046 PKG_CHECK_MODULES([EXT_LIBECAP],[libecap >= 0.2.0 libecap < 0.3])
1047 else
1048 AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
1049 fi
3e7b6055
AR
1050fi
1051
fcabe077
FC
1052AM_CONDITIONAL(USE_ECAP, test "x$squid_opt_use_ecap" = "xyes")
1053if test "x$squid_opt_use_ecap" = "xyes";
3e7b6055
AR
1054then
1055 AC_DEFINE(USE_ECAP,1,[Enable eCAP support])
3e115aaf 1056 ECAP_LIBS="ecap/libsquid-ecap.la"
5069fb38 1057 squid_opt_use_adaptation=yes
3e7b6055 1058else
5fa840c3 1059 AC_DEFINE(USE_ECAP,0,[Disable eCAP support])
3e7b6055
AR
1060 ECAP_LIBS=""
1061fi
b61a58df 1062dnl convenience library
3e7b6055
AR
1063AC_SUBST(ECAP_LIBS)
1064
3e7b6055 1065
5fa840c3 1066dnl enable adaptation if requested by specific adaptation mechanisms
fcabe077
FC
1067AM_CONDITIONAL(USE_ADAPTATION, test "x$squid_opt_use_adaptation" = "xyes")
1068if test "x$squid_opt_use_adaptation" = "xyes"
5fa840c3
AR
1069then
1070 AC_DEFINE(USE_ADAPTATION,1,[common adaptation support])
1071 ADAPTATION_LIBS="adaptation/libadaptation.la"
51952383 1072else
5fa840c3
AR
1073 AC_DEFINE(USE_ADAPTATION,0,[common adaptation support])
1074 ADAPTATION_LIBS=""
51952383 1075fi
5fa840c3 1076AC_SUBST(ADAPTATION_LIBS)
3e7b6055
AR
1077
1078
0961c811 1079dnl This is a developer only option. Developers know how to set defines
1080dnl
1081dnl AC_ARG_ENABLE(mem-gen-trace,
1082dnl [ --enable-mem-gen-trace Do trace of memory stuff],
1083dnl [ if test "$enableval" = "yes" ; then
eed82608 1084dnl AC_MSG_NOTICE([Memory trace (to file) enabled])
6a9f6389 1085dnl AC_DEFINE(MEM_GEN_TRACE,1,[Define for log file trace of mem alloc/free])
5069fb38
FC
1086dnl fi
1087dnl ])
1088
36a97e19 1089
1d3aafe4 1090test "x$squid_host_os" = "xmingw" && enable_wccp=no
5069fb38 1091AC_ARG_ENABLE(wccp,
8075a4da 1092 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]), [
1a6b111a 1093SQUID_YESNO([$enableval],[unrecognized argument to --disable-wccp: $enableval])
5069fb38 1094])
0067eb06 1095SQUID_DEFINE_BOOL(USE_WCCP, ${enable_wccp:=yes}, [Define to enable WCCP])
1a6b111a 1096AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $enable_wccp])
0b0cfcf2 1097
1d3aafe4 1098test "x$squid_host_os" = "xmingw" && enable_wccpv2=no
0b0cfcf2 1099AC_ARG_ENABLE(wccpv2,
1a6b111a
FC
1100 AS_HELP_STRING([--disable-wccpv2],
1101 [Disable Web Cache Coordination V2 Protocol]), [
1102SQUID_YESNO([$enableval],
1103 [unrecognized argument to --disable-wccpv2: $enableval])
0b0cfcf2 1104])
0067eb06 1105SQUID_DEFINE_BOOL(USE_WCCPv2,${enable_wccpv2:=yes},
1a6b111a
FC
1106 [Define to enable WCCP V2])
1107AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $enable_wccpv2])
320e9f36 1108
d9180414 1109AC_ARG_ENABLE(kill-parent-hack,
8075a4da 1110 AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]), [
1a6b111a
FC
1111SQUID_YESNO([$enableval],
1112 [unrecognized argument to --enable-kill-parent-hack: $enableval])
e5f4e1b0 1113])
0067eb06 1114SQUID_DEFINE_BOOL(KILL_PARENT_OPT,${enable_kill_parent_hack:=no},
1a6b111a
FC
1115 [A dangerous feature which causes Squid to kill its parent
1116 process (presumably the RunCache script) upon receipt
1117 of SIGTERM or SIGINT. Deprecated, Use with caution.])
1118AC_MSG_NOTICE([Kill parent on shutdown hack enabled: $enable_kill_parent_hack])
20ad76ab 1119
e5f4e1b0 1120AC_ARG_ENABLE(snmp,
1d87b6b3 1121 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
1a6b111a
FC
1122 SQUID_YESNO([$enableval],
1123 [unrecognized argument to --disable-snmp: $enableval])
87630341 1124])
0067eb06 1125SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes},
1a6b111a 1126 [Define to enable SNMP monitoring of Squid])
f738d783 1127AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
fcabe077 1128if test "x$enable_snmp" = "xyes"; then
82609577 1129 SNMPLIB='../lib/snmplib/libsnmplib.a'
e5f4e1b0 1130 makesnmplib=snmplib
87630341 1131fi
1a6b111a 1132AC_MSG_NOTICE([SNMP support enabled: $enable_snmp])
e5f4e1b0 1133AC_SUBST(SNMPLIB)
e5f4e1b0 1134AC_SUBST(makesnmplib)
1135
d9180414 1136AC_ARG_ENABLE(cachemgr-hostname,
5069fb38
FC
1137 AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
1138 [Make cachemgr.cgi default to this host.
1d87b6b3
FC
1139 If unspecified, uses the name of the build-host]), [
1140 case $enableval in
1141 yes)
1142 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1143 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
1144 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
1145 ;;
1146 no)
1147 : # Nothing to do..
1148 ;;
1149 *)
1150 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
1151 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
1152 ;;
1153 esac
e5f4e1b0 1154])
1155
ee0927b6 1156AC_ARG_ENABLE(eui,
1a6b111a 1157 AS_HELP_STRING([--disable-eui],
c8da66ba 1158 [Disable use of ARP / MAC/ EUI (ether address)]), [
1a6b111a
FC
1159SQUID_YESNO([$enableval],[--disable-eui expects no arguments])
1160])
fcabe077 1161if test "x${enable_eui:=yes}" = "xyes" ; then
507ca601
FC
1162 case "$squid_host_os" in
1163 linux|solaris|freebsd|openbsd|netbsd)
1164 ${TRUE}
1165 ;;
1166 cygwin|mingw)
1167 EUILIB="-liphlpapi"
1168 ;;
1169 *)
1170 AC_MSG_WARN([EUI support probably will not work on host $host.])
1171 ;;
1172 esac
0a675778 1173 #Iphlpapi.h check delayed after winsock2.h
507ca601 1174 AC_CHECK_HEADERS( \
32341684 1175 windows.h \
507ca601 1176 sys/sockio.h \
32341684
AJ
1177 sys/param.h,
1178 [], [], [[
1179#if HAVE_WINDOWS_H
1180include <windows.h>
54d47324 1181#endif
32341684 1182]]
507ca601 1183 )
29759678
FC
1184 AC_CHECK_HEADERS( \
1185 net/if_arp.h \
1186 net/route.h,
1187 [], [], [[
1188#include <sys/types.h>
1189#include <sys/socket.h>
1190]])
1191
43c1320a
AJ
1192 # OpenBSD, FreeBSD and NetBSD requires sys/param.h to be included before sysctl.h and net/if_dl.h
1193 AC_CHECK_HEADERS( \
1194 net/if_dl.h \
1195 sys/sysctl.h,
1196 [], [], [[
54d47324 1197#if HAVE_SYS_PARAM_H
29759678
FC
1198#include <sys/param.h>
1199#endif
1200 ]])
a98c2da5 1201fi
2ef664d8 1202AC_SUBST(EUILIB)
1a6b111a 1203AC_MSG_NOTICE([EUI (MAC address) controls enabled: $enable_eui])
0067eb06 1204SQUID_DEFINE_BOOL(USE_SQUID_EUI,$enable_eui,
1a6b111a 1205 [Define this to include code which lets you use ethernet addresses. This code uses API initially defined in 4.4-BSD.])
fcabe077 1206AM_CONDITIONAL(USE_SQUID_EUI, [test "x$enable_eui" = "xyes" ])
1a6b111a 1207
e5f4e1b0 1208
74075210 1209AC_ARG_ENABLE(htcp,
47d80734 1210 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]), [
1a6b111a
FC
1211SQUID_YESNO([$enableval],
1212 [unrecognized argument to --disable-htcp: $enableval])
74075210 1213])
0f658b5b 1214SQUID_DEFINE_BOOL(USE_HTCP,${enable_htcp:=yes},
47d80734 1215 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
fcabe077 1216AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
1a6b111a
FC
1217AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
1218
a2794549 1219
f88ca0d1
FC
1220# SSL is not enabled by default.
1221# Default is to use OpenSSL when available
1f7c9178 1222AC_ARG_ENABLE(ssl,
a9dfcab8
FC
1223 AS_HELP_STRING([--enable-ssl],
1224 [Enable ssl gatewaying support using OpenSSL]), [
1225SQUID_YESNO([$enableval],
1226 [unrecognized argument to --enable-ssl: $enableval])
1227])
f88ca0d1
FC
1228# USE_OPENSSL is AC_DEFINED later
1229# default for ssl is set here
fcabe077 1230if test "x${enable_ssl:=no}" = "xyes" ; then
507ca601
FC
1231 if test "x$squid_host_os" = "xmingw" ; then
1232 SSLLIB='-lssleay32 -leay32 -lgdi32'
1233 else
1234 SSLLIB='-lssl -lcrypto'
1235 fi
1236 if test "x$with_openssl" = "x"; then
1237 with_openssl=yes
1238 fi
1239 if test "x$with_openssl" = "x"; then
1240 with_openssl=yes
1241 fi
a9dfcab8 1242fi
fcabe077 1243AM_CONDITIONAL(ENABLE_SSL,[ test "x$enable_ssl" = "xyes" ])
a9dfcab8
FC
1244AC_MSG_NOTICE([SSL gatewaying support enabled: $enable_ssl])
1245
3d4022fa 1246dnl User may specify OpenSSL is needed from a non-standard location
1f7c9178 1247AC_ARG_WITH(openssl,
f88ca0d1
FC
1248 AS_HELP_STRING([--with-openssl=PATH],
1249 [Compile with the OpenSSL libraries. The path to
86f53af2
FC
1250 the OpenSSL development libraries and headers
1251 installation can be specified if outside of the
f88ca0d1
FC
1252 system standard directories]), [
1253case "$with_openssl" in
a3b28798
HN
1254 yes|no)
1255 : # Nothing special to do here
1f7c9178 1256 ;;
1257 *)
fcabe077 1258 if test ! -d "$withval" ; then
f88ca0d1
FC
1259 AC_MSG_ERROR([--with-openssl path does not point to a directory])
1260 fi
46ce628c 1261 SSLLIBDIR="$with_openssl/lib"
bcce53ce 1262 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
a3b28798 1263 with_openssl=yes
1f7c9178 1264 esac
1265])
0067eb06 1266SQUID_DEFINE_BOOL(USE_SSL,$enable_ssl,
f88ca0d1 1267 [Define this to include code for SSL gatewaying support])
a024f63d 1268AC_MSG_NOTICE([Using OpenSSL MD5 implementation: ${with_openssl:=no}])
0067eb06 1269SQUID_DEFINE_BOOL(USE_OPENSSL,${with_openssl},
f88ca0d1 1270 [Define this to make use of the OpenSSL libraries for MD5 calculation rather than Squid-supplied MD5 implementation or if building with SSL encryption])
fcabe077
FC
1271if test "x$enable_ssl" = "xyes"; then
1272 if test "x$SSLLIB" = "x"; then
1f7c9178 1273 SSLLIB="-lcrypto" # for MD5 routines
1274 fi
f88ca0d1 1275 # This is a workaround for RedHat 9 brain damage..
fcabe077 1276 if test -d /usr/kerberos/include -a "x$SSLLIBDIR" = "x" -a -f /usr/include/openssl/kssl.h; then
eed82608 1277 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
f11555e0 1278 SSLLIBDIR="/usr/kerberos/lib"
1279 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1280 fi
1f7c9178 1281fi
fcabe077 1282if test "x$SSLLIBDIR" != "x" ; then
1f7c9178 1283 SSLLIB="-L$SSLLIBDIR $SSLLIB"
1284fi
1f7c9178 1285AC_SUBST(SSLLIB)
1286
fc321c30
CT
1287if test "x$with_openssl" = "xyes"; then
1288SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS
19179f7c 1289SQUID_CHECK_OPENSSL_CONST_SSL_METHOD
fee5325b 1290SQUID_CHECK_OPENSSL_TXTDB
fc321c30 1291fi
3d4022fa 1292
02749868 1293AC_ARG_ENABLE(forw-via-db,
47d80734
FC
1294 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
1295 SQUID_YESNO([$enableval],[unrecognized argument to --enable-forw-via-db: $enableval])
02749868 1296])
21f6708d 1297SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
9676633b
FC
1298 [Enable Forw/Via database])
1299AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
02749868 1300
6cfa8966 1301AC_ARG_ENABLE(cache-digests,
47d80734 1302 AS_HELP_STRING([--enable-cache-digests],
9676633b
FC
1303 [Use Cache Digests. See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
1304[
1305 SQUID_YESNO($enableval,
1306 [unrecognized argument to --enable-cache-digests: $enableval])
484f2ebc 1307])
0067eb06 1308SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
47d80734 1309 [Use Cache Digests for locating objects in neighbor caches.])
9676633b 1310AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
47d80734 1311
484f2ebc 1312
9676633b
FC
1313################################
1314# check for netio plugin stuff #
1315################################
1316dnl order of these options handling is relevant in case the user
1317dnl supplies more than one --enable option. Options handled later
1318dnl override those handled earlier for io loop method manual override
1319AC_ARG_ENABLE(select,
1320 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),
1321[
1322SQUID_YESNO($enableval,[--disable-select takes no extra argument])
39145d19
AJ
1323if test "x$enableval" = "xyes"; then
1324 if test "x$squid_host_os" = "xmingw"; then
1325 squid_opt_io_loop_engine="select_win32"
1326 else
1327 squid_opt_io_loop_engine="select"
1328 fi
1329fi
9676633b
FC
1330])
1331AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
cd748f27 1332
9bb83c8b 1333AC_ARG_ENABLE(poll,
62979ab1 1334 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
1b3db6d9 1335[
9676633b 1336SQUID_YESNO($enableval,[--disable-poll takes no extra argument])
fcabe077 1337test "x$enableval" = "xyes" && squid_opt_io_loop_engine="poll"
9bb83c8b 1338])
9676633b 1339AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
9bb83c8b 1340
1b3db6d9 1341AC_ARG_ENABLE(kqueue,
26d50fd2
AJ
1342 AS_HELP_STRING([--disable-kqueue],
1343 [Disable kqueue(2) support.]), [
9676633b 1344SQUID_YESNO($enableval,[--enable-kqueue takes no extra argument])
1b3db6d9 1345])
26d50fd2
AJ
1346if test "x${enable_kqueue:=auto}" != "xno" ; then
1347 AC_CHECK_HEADERS([sys/event.h],[],[
1348 if test "x${enable_kqueue}" = "xyes" ; then
1349 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
1350 fi
1351 ])
1352 AC_CHECK_FUNCS(kqueue,[],[
1353 if test "x${enable_kqueue}" = "xyes" ; then
1354 AC_MSG_ERROR([kqueue support missing in libc library.])
1355 fi
1356 ])
1357 if test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes" ; then
1358 squid_opt_io_loop_engine="kqueue"
1359 else
1360 enable_kqueue="no"
1361 fi
9676633b 1362fi
26d50fd2 1363AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
1b3db6d9 1364
a46d2c0e 1365dnl Enable epoll()
a46d2c0e 1366AC_ARG_ENABLE(epoll,
62979ab1 1367 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
a46d2c0e 1368[
9676633b 1369SQUID_YESNO($enableval,[--disable-epoll takes no extra argument])
fcabe077 1370test "x$enableval" = "xyes" && squid_opt_io_loop_engine="epoll"
a46d2c0e 1371])
9676633b 1372AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
2ca8b332 1373
9676633b
FC
1374# auto-detect and verify epoll header and library present and working
1375# logic mapping and loop method selection are performed later
fcabe077 1376if test "x$enable_epoll" != "xno" ; then
2ca8b332 1377
9676633b
FC
1378 # check if libs are needed to support epoll
1379 # note: this code block seems quite generic. Could it be extracted
1380 # into a squid specific configure function?
af1e01a8 1381 SQUID_STATE_SAVE(squid_epoll_state)
9676633b 1382 AC_SEARCH_LIBS(epoll_ctl,[epoll])
fcabe077 1383 if test "x$ac_cv_search_epoll_ctl" = "xno" ; then
9676633b 1384 enable_epoll=no #disable. Needed code not found
fcabe077 1385 elif test "x$ac_cv_search_epoll_ctl" = "xnone required" ; then
9676633b
FC
1386 EPOLL_LIBS=""
1387 else
1388 EPOLL_LIBS=$ac_cv_search_epoll_ctl
1389 fi
1390 AC_SUBST(EPOLL_LIBS)
1391 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
a46d2c0e 1392
9676633b 1393 # epoll requires sys/epoll.h
98d13964 1394 AC_CHECK_HEADERS([sys/epoll.h])
ad32c661
AJ
1395
1396 dnl Verify that epoll really works
dcac6885 1397 if test "x$ac_cv_search_epoll_ctl" != 'xno' ; then
af1e01a8 1398 SQUID_CHECK_EPOLL
ad32c661 1399 fi
2ca8b332 1400
fcabe077 1401 if test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno" ; then
2ca8b332
AJ
1402 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
1403 fi
ad32c661 1404fi
a46d2c0e 1405
a1ad2f9b
AJ
1406dnl Enable /dev/poll
1407AC_ARG_ENABLE(devpoll,
1408 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),
1409[
1410SQUID_YESNO($enableval,[--disable-devpoll takes no extra argument])
1411test "x$enableval" = "xyes" && squid_opt_io_loop_engine="devpoll"
1412])
1413AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
1414
1415## auto-detect and verify devpoll header and library present and working
1416if test "x$enable_devpoll" != "xno"; then
1417
1418 # /dev/poll requires ioctl() and write()
1419 AC_CHECK_FUNCS(ioctl)
1420 AC_CHECK_FUNCS(write)
1421
1422 # /dev/poll requires sys/devpoll.h
1423 AC_CHECK_HEADERS([sys/devpoll.h],,[
1424 if test "x$enable_devpoll" = "xyes"; then
1425 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
1426 fi
1427 enable_devpoll=no])
1428
1429 # Verify that /dev/poll really works
1430 if test "x$enable_devpoll" != 'xno' ; then
1431 SQUID_CHECK_DEVPOLL
1432 fi
1433
1434 if test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno" ; then
1435 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
1436 fi
1437fi
1438
9676633b 1439
72fd085a 1440AC_ARG_ENABLE(http-violations,
af1e01a8
FC
1441 AS_HELP_STRING([--disable-http-violations],
1442 [This allows you to remove code which is known to
47d80734 1443 violate the HTTP protocol specification.]), [
9676633b
FC
1444 SQUID_YESNO([$enableval],
1445 [unrecognized argument to --disable-http-violations: $enableval])
72fd085a 1446])
626096be 1447SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
47d80734 1448 [Define to enable code which volates the HTTP standard specification])
9676633b 1449AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
72fd085a 1450
47d80734 1451# IPFW Transparent Proxy
68075fad 1452AC_ARG_ENABLE(ipfw-transparent,
1d26e252
FC
1453 AS_HELP_STRING([--enable-ipfw-transparent],
1454 [Enable Transparent Proxy support for systems
47d80734 1455 using FreeBSD IPFW-style firewalling.]), [
1d26e252
FC
1456 SQUID_YESNO([$enableval],
1457 [unrecognized argument to --enable-ipfw-transparent: $enableval])
68075fad 1458])
0067eb06 1459SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
2277004e 1460 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
1d26e252 1461AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
68075fad 1462
47d80734 1463# IP-Filter Transparent Proxy
5cafc1d6 1464AC_ARG_ENABLE(ipf-transparent,
2277004e 1465 AS_HELP_STRING([--enable-ipf-transparent],
1d26e252
FC
1466 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
1467 SQUID_YESNO([$enableval],
1468 [unrecognized argument to --enable-ipf-transparent: $enableval])
5cafc1d6 1469])
be0c7ff0 1470#will be AC_DEFINEd later, after checking for appropriate infrastructure
4bd144d2
FC
1471#IPF currently broken. Default-disabled for now.
1472AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
5cafc1d6 1473
2b0dd4ac 1474dnl Enable PF Transparent Proxy
1475AC_ARG_ENABLE(pf-transparent,
2277004e 1476 AS_HELP_STRING([--enable-pf-transparent],
47d80734 1477 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
1d26e252
FC
1478 SQUID_YESNO([$enableval],
1479 [unrecognized argument to --enable-pf-transparent: $enableval])
2b0dd4ac 1480])
be0c7ff0 1481#will be AC_DEFINEd later, after checking for appropriate infrastructure
b2192042
AJ
1482AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
1483
1484dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
1485AC_ARG_WITH(nat-devpf,
1486 AS_HELP_STRING([--with-nat-devpf],
1487 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
1488 SQUID_YESNO([$enableval],
1489 [unrecognized argument to --with-nat-devpf: $enableval])
1490])
1491#will be AC_DEFINEd later, after checking for appropriate infrastructure
1492AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
2b0dd4ac 1493
4bd144d2 1494# Linux Netfilter Transparent Proxy
d852fbad 1495AC_ARG_ENABLE(linux-netfilter,
20ad76ab 1496 AS_HELP_STRING([--enable-linux-netfilter],
96f08e2d 1497 [Enable Transparent Proxy support for Linux (Netfilter)]), [
4bd144d2
FC
1498 SQUID_YESNO([$enableval],
1499 [unrecognized argument to --enable-linux-netfilter: $enableval])
d852fbad 1500])
4bd144d2 1501AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
be0c7ff0 1502#will be AC_DEFINEd later, after checking for appropriate infrastructure
d852fbad 1503
425de4c8
AJ
1504
1505dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
11e8cfe3 1506dnl squid_opt_netfilterconntrack is set only when option is explicity specified
425de4c8
AJ
1507AC_ARG_WITH(netfilter-conntrack,
1508 AS_HELP_STRING([--without-netfilter-conntrack],
1509 [Do not use Netfilter conntrack libraries for packet marking.
1510 A path to alternative library location may be specified by
1511 using --with-netfilter-conntrack=PATH. Default: auto-detect.]), [
f4f6c2e0
AJ
1512case "$with_netfilter_conntrack" in
1513 yes|no)
11e8cfe3 1514 squid_opt_netfilterconntrack=$with_netfilter_conntrack
f4f6c2e0
AJ
1515 ;;
1516 *)
1517 if test ! -d "$withval" ; then
1518 AC_MSG_ERROR([--without-netfilter-conntrack path does not point to a directory])
1519 fi
1520 squid_opt_netfilterconntrackpath=$withval
1521 LDFLAGS="-L$squid_opt_netfilterconntrackpath/lib $LDFLAGS"
1522 CPPFLAGS="-I$squid_opt_netfilterconntrackpath/include $CPPFLAGS"
425de4c8 1523 with_netfilter_conntrack=yes
11e8cfe3 1524 squid_opt_netfilterconntrack=yes
f4f6c2e0 1525 esac
425de4c8 1526])
f4f6c2e0
AJ
1527AC_MSG_NOTICE([Linux Netfilter Conntrack support requested: ${with_netfilter_conntrack:=auto}])
1528if test "x$with_netfilter_conntrack" != "xno"; then
1529 AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
1530 if test x"$with_netfilter_conntrack" = "xyes"; then
1531 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack library not found])
425de4c8 1532 fi
f4f6c2e0 1533 with_netfilter_conntrack=no])
425de4c8 1534 AC_CHECK_HEADERS([libnetfilter_conntrack/libnetfilter_conntrack.h \
f4f6c2e0
AJ
1535 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h],,[
1536 if test x"$with_netfilter_conntrack" = "xyes"; then
1537 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack headers not found])
1538 fi
1539 with_netfilter_conntrack=no])
88a2a8c6
AJ
1540 # If nothing is broken; enable the libraries usage.
1541 if test "x$with_netfilter_conntrack" != "xno"; then
1542 with_netfilter_conntrack=yes
1543 fi
425de4c8
AJ
1544fi
1545
1546
bb7b5fd0 1547dnl Enable Large file support
2df6213e 1548buildmodel=""
2277004e 1549squid_opt_enable_large_files=no
2df6213e 1550
1551AC_ARG_WITH(large-files,
507ca601
FC
1552 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
1553 if test "x$withval" = "xyes"; then
1554 squid_opt_enable_large_files=yes
bb7b5fd0 1555 fi
1556])
1557
2df6213e 1558dnl UNIX Build environment
be0c7ff0 1559dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
2df6213e 1560AC_ARG_WITH(build-environment,
507ca601
FC
1561 AS_HELP_STRING([--with-build-environment=model],
1562 [The build environment to use. Normally one of
1563 POSIX_V6_ILP32_OFF32 (32 bits),
1564 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
1565 POSIX_V6_LP64_OFF64 (64 bits),
1566 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
1567 XBS5_ILP32_OFF32 i(legacy, 32 bits),
1568 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
1569 XBS5_LP64_OFF64 (legacy, 64 bits),
1570 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
1571 or default (The default for your OS)]), [
1572case "$withval" in
2df6213e 1573 yes|no)
507ca601
FC
1574 AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])
1575 ;;
2df6213e 1576 *)
507ca601
FC
1577 buildmodel="$withval"
1578 ;;
1579esac
2df6213e 1580])
1581
228332d3
FC
1582#hack. Let's early-detect sizeof(long)
1583AC_CHECK_SIZEOF(long)
1584
fcabe077 1585if test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"; then
2277004e
FC
1586 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
1587 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
1588 buildmodel=$model
1589 break
1590 fi
1591 done
fcabe077 1592 if test "x$buildmodel" = "x"; then
2277004e
FC
1593 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
1594 fi
9b8002de 1595fi
0c0d381b 1596if test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"; then
228332d3
FC
1597 # define _FILE_OFFSET_BITS if requested and needed
1598 if test "x$squid_opt_enable_large_files" = "xyes" -a $ac_cv_sizeof_long -le 4 ; then
507ca601
FC
1599 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
1600 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
1601 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
1602 fi
1603else
1604 AC_MSG_NOTICE([Using $buildmodel build environment])
1605 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
1606 : # All fine
1607 else
1608 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
1609 fi
1610 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
1611 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
1612 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1613 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
941c31f3 1614 if test "x$squid_host_os" = "xsolaris" ; then
2277004e
FC
1615
1616# On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1617# for LDFLAGS -xarch=generic64, but:
1618# "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1619# For gcc "-xarch=generic64" must be replaced with "-m64"
1620# The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
fcabe077 1621 if test "x$GCC" = "xyes"; then
2277004e
FC
1622 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
1623 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
1624 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
1625 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
1626 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1627 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1628 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
1629 fi
1630 AC_MSG_NOTICE([Removing -Usun on $host])
1631 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
1632 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
1633 fi
507ca601 1634fi
2df6213e 1635
5d620373 1636dnl Enable Leak Finding Functions
1637AC_ARG_ENABLE(leakfinder,
47d80734
FC
1638 AS_HELP_STRING([--enable-leakfinder],
1639 [Enable Leak Finding code. Enabling this alone does nothing;
1640 you also have to modify the source code to use the leak
1641 finding functions. Probably Useful for hackers only.]), [
89f640aa
FC
1642 SQUID_YESNO([$enableval],
1643 [unrecognized argument to --enable-leakfinder: $enableval])
5d620373 1644])
89f640aa
FC
1645AC_MSG_NOTICE([Leak Finder enabled: ${enable_leakfinder:=no}])
1646SQUID_DEFINE_BOOL(USE_LEAKFINDER,$enable_leakfinder,
47d80734 1647 [Enable code for assisting in finding memory leaks. Not for the faint of heart])
fcabe077 1648AM_CONDITIONAL(MAKE_LEAKFINDER, [test "x$enable_leakfinder" = "xyes"])
47d80734 1649
5d620373 1650
3d674977 1651AC_ARG_ENABLE(follow-x-forwarded-for,
6ec005b5
FC
1652 AS_HELP_STRING([--enable-follow-x-forwarded-for],
1653 [Enable support for following the X-Forwarded-For
19b4777c
FC
1654 HTTP header to try to find the IP address of the
1655 original or indirect client when a request has
8075a4da 1656 been forwarded through other proxies.]), [
6ec005b5
FC
1657 SQUID_YESNO([$enableval],
1658 [unrecognized argument to --enable-follow-x-forwarded-for: $enableval])
8075a4da 1659])
6ec005b5 1660AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
3a5af257 1661SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
47d80734 1662 [Enable following X-Forwarded-For headers])
3d674977 1663
3898f57f 1664AC_ARG_ENABLE(ident-lookups,
8075a4da 1665 AS_HELP_STRING([--disable-ident-lookups],
47d80734
FC
1666 [Remove code that supports performing Ident (RFC 931) lookups.]), [
1667 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ident-lookups: $enableval])
8075a4da 1668])
6c5dc16a
FC
1669AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
1670SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
3898f57f 1671
95d2589c
CT
1672AM_CONDITIONAL(USE_SSL_CRTD, false)
1673AC_ARG_ENABLE(ssl-crtd,
1674 AC_HELP_STRING([--enable-ssl-crtd],
1675 [Prevent Squid from directly generation of SSL private key and
1676 certificate request and instead enables the ssl_crtd processes.]), [
1677 SQUID_YESNO([$enableval],
1678 [unrecogized argument to --enable-ssl-crtd: $enableval])
1679])
1680
1681if test "x$enable_ssl_crtd" = "xyes" -a "x$enable_ssl" = "xno" ; then
1682 AC_MSG_ERROR([You need to enable ssl gatewaying support to use ssl_crtd feature. Try to use --enable-ssl. ])
1683fi
1684SQUID_DEFINE_BOOL(USE_SSL_CRTD, ${enable_ssl_crtd:=no},[Use ssl_crtd daemon])
1685AM_CONDITIONAL(USE_SSL_CRTD, [test "x$enable_ssl_crtd" = "xyes"])
1686
9d798391 1687dnl Select Default hosts file location
1688AC_ARG_ENABLE(default-hostsfile,
8ea232f5
FC
1689 AS_HELP_STRING([--enable-default-hostsfile=path],
1690 [Select default location for hosts file.
75eaac6c
FC
1691 See hosts_file directive in squid.conf for details]), [
1692if test "x$enableval" != "xnone" -a "x$enableval" != "xno" ; then
1693 if test \! -f "$enableval"; then
1694 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
20ad76ab 1695 fi
75eaac6c
FC
1696 squid_opt_default_hosts=$enableval
1697else
1698 squid_opt_default_hosts="none"
1699fi
1700])
1701AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
1702DEFAULT_HOSTS=$squid_opt_default_hosts
1703AC_SUBST(DEFAULT_HOSTS)
9d798391 1704
47d80734 1705# Select auth schemes modules to build
94439e4e 1706AC_ARG_ENABLE(auth,
26ffc057
FC
1707 AS_HELP_STRING([--enable-auth],
1708 [Build global support for authentication. The list of schemes
1709 and helpers to be enabled is defined elsewhere]), [
1710SQUID_YESNO([$enableval],
1711 [unrecognized argument to --enable-auth: $enableval])
94439e4e 1712])
26ffc057 1713AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
2f1431ea
AJ
1714SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
1715AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
26ffc057
FC
1716AUTH_MODULES=""
1717
1718AC_ARG_ENABLE(auth-basic,
1719 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
1720 [Enable the basic authentication scheme, and build the specified helpers.
1721 Not providing an explicit list of helpers will attempt build of
1722 all possible helpers. Default is to do so.
1723 To disable the basic authentication scheme, use --disable-auth-basic.
d9655720 1724 To enable but build no helpers, specify "none".
26ffc057
FC
1725 To see available helpers, see the helpers/basic_auth directory. ]),[
1726#nothing to do really
1727])
5a0c5a92 1728m4_include([helpers/basic_auth/modules.m4])
94439e4e 1729
26ffc057
FC
1730AC_ARG_ENABLE(auth-ntlm,
1731 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
1732 [Enable the NTLM authentication scheme, and build the specified helpers.
1733 Not providing an explicit list of helpers will attempt build of
1734 all possible helpers. Default is to do so.
1735 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
1736 To enable but build no helpers, specify "none".
1737 To see available helpers, see the helpers/ntlm_auth directory. ]),[
380f0a87 1738])
5eabe4b4 1739m4_include([helpers/ntlm_auth/modules.m4])
94439e4e 1740
26ffc057
FC
1741AC_ARG_ENABLE(auth-negotiate,
1742 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
1743 [Enable the Negotiate authentication scheme, and build the specified
1744 helpers.
1745 Not providing an explicit list of helpers will attempt build of
1746 all possible helpers. Default is to do so.
1747 To disable the Negotiate authentication scheme,
1748 use --disable-auth-negotiate.
1749 To enable but build no helpers, specify "none".
1750 To see available helpers, see the helpers/negotiate_auth directory. ]),[
1751#nothing to do, really
6e785d85 1752])
5eabe4b4 1753m4_include([helpers/negotiate_auth/modules.m4])
6e785d85 1754
26ffc057
FC
1755AC_ARG_ENABLE(auth-digest,
1756 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
1757 [Enable the Digest authentication scheme, and build the specified helpers.
1758 Not providing an explicit list of helpers will attempt build of
1759 all possible helpers. Default is to do so.
1760 To disable the Digest authentication scheme, use --disable-auth-digest.
1761 To enable but build no helpers, specify "none".
1762 To see available helpers, see the helpers/digest_auth directory. ]),[
1763#nothing to do, really
2d70df72 1764])
5eabe4b4 1765m4_include([helpers/digest_auth/modules.m4])
380f0a87 1766
26ffc057
FC
1767dnl Authentication libraries to build
1768dnl This list will not be needed when each auth library has its own Makefile
be0c7ff0 1769dnl this is to be placed AFTER each auth module's handler
26ffc057
FC
1770AUTH_LIBS_TO_BUILD=
1771for module in $AUTH_MODULES; do
616cfc4c 1772 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
26ffc057
FC
1773done
1774AC_SUBST(AUTH_MODULES)
1775AC_SUBST(AUTH_LIBS_TO_BUILD)
1776
82b7abe3 1777dnl Select logging daemon helpers to build
82b7abe3 1778AC_ARG_ENABLE(log-daemon-helpers,
26ffc057 1779 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
a62e8408
FC
1780 [This option selects which logging daemon helpers to
1781 build and install as part of the normal build process
1782 For a list of available helpers see the helpers/log_daemon
1783 directory.]),[
6a8b1040 1784#nothing to do, really
82b7abe3 1785])
5eabe4b4 1786m4_include([helpers/log_daemon/modules.m4])
82b7abe3 1787
3d62cc61
FC
1788dnl
1789dnl Check Kerberos/GSSAPI/SPNEGO
1790dnl
c8093f05
FC
1791SQUID_STATE_SAVE([krbsave])
1792
9ca29d23 1793AC_ARG_WITH(krb5-config,
507ca601
FC
1794 AS_HELP_STRING([--with-krb5-config=PATH],
1795 [specify path to krb5-config (default=detect)]), [
1796case "$withval" in
1797 yes) unset krb5confpath ;;
1798 no) krb5confpath=no ;;
1799 *) krb5confpath=$withval ;;
1800esac
9ca29d23 1801])
fcabe077
FC
1802if test x"$krb5confpath" != "xno"; then
1803 if test "x$krb5confpath" != "x"; then
9ca29d23
AJ
1804 if ! test -x "$krb5confpath"; then
1805 AC_MSG_WARN([krb5-config '$krb5confpath' not executable, ignoring])
1806 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no)
1807 krb5confpath=krb5-config
1808 fi
1809 krb5_config_path=`dirname $krb5confpath`
1810 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no, $krb5_config_path)
1811 else
1812 AC_CHECK_PROG(ac_krb5_config,krb5-config,yes,no)
1813 krb5confpath=krb5-config
1814 fi
1815fi
fcabe077
FC
1816if test "x$ac_krb5_config" = "xyes" ; then
1817 ac_heimdal="`$krb5confpath --version 2>/dev/null | grep -i heimdal`"
1818 ac_solaris="`$krb5confpath --version 2>/dev/null | grep -i solaris`"
1819 if test "x$ac_heimdal" != "x" ; then
1820 AC_DEFINE(HAVE_HEIMDAL_KERBEROS,1,[Define to 1 if you have Heimdal Kerberos])
1821 else
1822 AC_DEFINE(HAVE_MIT_KERBEROS,1,[Define to 1 if you have MIT Kerberos])
1823 fi
1824 if test "x$ac_solaris" != "x" ; then
1825 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1826 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
1827 KRB5INCS="-I/usr/include/gssapi $KRB5INCS"
1828 KRB5LIBS="-L/usr/lib -R/usr/lib -lgss -lresolv -lsocket -lnsl $KRB5LIBS"
1829 else
1830 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1831 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
1832 KRB5INCS="`$krb5confpath --cflags gssapi 2>/dev/null` $KRB5INCS"
1833 KRB5LIBS="`$krb5confpath --libs gssapi 2>/dev/null` $KRB5LIBS"
1834 fi
1835 CPPFLAGS="$CPPFLAGS $KRB5INCS"
1836 LIBS="$LIBS $KRB5LIBS"
1837 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1838 if test "x$ac_heimdal" == "x" ; then
1839 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
1840 AC_CHECK_HEADERS(profile.h)
1841 fi
9ca29d23 1842
fcabe077
FC
1843 SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H
1844 if test "x$squid_cv_broken_krb5_h" = "xyes"; then
ffe4ffd8 1845 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if Solaris krb5.h is broken for C++])
a05af879
FC
1846 AC_MSG_WARN([You have a broken Solaris <krb5.h> system include.])
1847 AC_MSG_WARN([Please see http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512])
1848 AC_MSG_WARN([If you need Kerberos support you'll have to patch])
1849 AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch])
fcabe077 1850 fi
ffe4ffd8
AJ
1851 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1852 if test "x$squid_cv_broken_heimdal_krb5_h" = "xyes"; then
1853 AC_DEFINE(HAVE_BROKEN_HEIMDAL_KRB5_H, 1, [Define to 1 if Heimdal krb5.h is broken for C++])
1854 fi
a05af879 1855 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
3d62cc61 1856
fcabe077
FC
1857 ac_com_error_message=no
1858 if test "x$ac_cv_header_com_err_h" == "xyes" ; then
1859 AC_EGREP_HEADER(error_message,com_err.h,ac_com_error_message=yes)
1860 elif test "x$ac_cv_header_et_com_err_h" == "xyes" ; then
1861 AC_EGREP_HEADER(error_message,et/com_err.h,ac_com_error_message=yes)
1862 fi
c8093f05 1863
fcabe077
FC
1864 SQUID_CHECK_MAX_SKEW_IN_KRB5_CONTEXT
1865 if test "x$squid_cv_max_skew_context" = "xyes"; then
1866 AC_DEFINE(HAVE_MAX_SKEW_IN_KRB5_CONTEXT, 1, [Define to 1 if max_skew in struct krb5_context])
1867 fi
3d62cc61 1868
fcabe077
FC
1869 if test `echo $KRB5LIBS | grep -c com_err` -ne 0 -a "x$ac_com_error_message" == "xyes" ; then
1870 AC_CHECK_LIB(com_err,error_message,
1871 AC_DEFINE(HAVE_ERROR_MESSAGE,1,
1872 [Define to 1 if you have error_message]),)
1873 elif test "x$ac_com_error_message" == "xyes" ; then
1874 AC_CHECK_LIB(krb5,error_message,
1875 AC_DEFINE(HAVE_ERROR_MESSAGE,1,
1876 [Define to 1 if you have error_message]),)
1877 fi
1878 AC_CHECK_LIB(krb5,krb5_get_err_text,
1879 AC_DEFINE(HAVE_KRB5_GET_ERR_TEXT,1,
1880 [Define to 1 if you have krb5_get_err_text]),)
1881 AC_CHECK_LIB(krb5,krb5_get_error_message,
1882 AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE,1,
1883 [Define to 1 if you have krb5_get_error_message]),)
b1218840 1884 AC_CHECK_DECLS(krb5_kt_free_entry,,,[#include <krb5.h>])
4ebcf1ce
MM
1885 AC_CHECK_TYPE(krb5_pac,
1886 AC_DEFINE(HAVE_KRB5_PAC,1,
1887 [Define to 1 if you have krb5_pac]),,
1888 [#include <krb5.h>])
fcabe077
FC
1889 AC_CHECK_LIB(krb5,krb5_kt_free_entry,
1890 AC_DEFINE(HAVE_KRB5_KT_FREE_ENTRY,1,
1891 [Define to 1 if you have krb5_kt_free_entry]),)
1892 AC_CHECK_LIB(krb5,krb5_get_init_creds_keytab,
1893 AC_DEFINE(HAVE_GET_INIT_CREDS_KEYTAB,1,
1894 [Define to 1 if you have krb5_get_init_creds_keytab]),)
1895 AC_CHECK_LIB(krb5,krb5_get_max_time_skew,
1896 AC_DEFINE(HAVE_KRB5_GET_MAX_TIME_SKEW,1,
1897 [Define to 1 if you have krb5_get_max_time_skew]),)
1898 AC_CHECK_LIB(krb5,krb5_get_profile,
1899 AC_DEFINE(HAVE_KRB5_GET_PROFILE,1,
1900 [Define to 1 if you have krb5_get_profile]),)
1901 AC_CHECK_LIB(krb5,profile_get_integer,
1902 AC_DEFINE(HAVE_PROFILE_GET_INTEGER,1,
1903 [Define to 1 if you have profile_get_integer]),)
1904 AC_CHECK_LIB(krb5,profile_release,
1905 AC_DEFINE(HAVE_PROFILE_RELEASE,1,
1906 [Define to 1 if you have profile_release]),)
4ebcf1ce
MM
1907 AC_CHECK_LIB(krb5,krb5_get_renewed_creds,
1908 AC_DEFINE(HAVE_KRB5_GET_RENEWED_CREDS,1,
1909 [Define to 1 if you have krb5_get_renewed_creds]),)
1910 AC_CHECK_LIB(krb5,krb5_principal_get_realm,
1911 AC_DEFINE(HAVE_KRB5_PRINCIPAL_GET_REALM,1,
1912 [Define to 1 if you have krb5_principal_get_realm]),)
1913 AC_CHECK_LIB(krb5, krb5_get_init_creds_opt_alloc,
1914 AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC,1,
1915 [Define to 1 if you have krb5_get_init_creds_opt_alloc]),)
1916 AC_MSG_CHECKING([for krb5_get_init_creds_free requires krb5_context])
1917 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1918 #include <krb5.h>
1919 ]],[[krb5_context context;
1920 krb5_get_init_creds_opt *options;
1921 krb5_get_init_creds_opt_free(context, options)]])],[
1922 AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_FREE_CONTEXT,1,
1923 [Define to 1 if you krb5_get_init_creds_free requires krb5_context])
1924 AC_MSG_RESULT(yes)
1925 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
1926
1927
1928 AC_CHECK_FUNCS(gss_map_name_to_any,
1929 AC_DEFINE(HAVE_GSS_MAP_ANY_TO_ANY,1,
1930 [Define to 1 if you have gss_map_name_to_any]),)
1931 AC_CHECK_FUNCS(gsskrb5_extract_authz_data_from_sec_context,
1932 AC_DEFINE(HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT,1,
1933 [Define to 1 if you have gsskrb5_extract_authz_data_from_sec_context]),)
fcabe077
FC
1934
1935 SQUID_CHECK_KRB5_CONTEXT_MEMORY_CACHE
1936 SQUID_DEFINE_BOOL(HAVE_KRB5_MEMORY_CACHE,$squid_cv_memory_cache,
1937 [Define if kerberos has MEMORY: cache support])
1938
1939 SQUID_CHECK_WORKING_GSSAPI
1940 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1941
1942 SQUID_CHECK_SPNEGO_SUPPORT
1943 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1944
1945 SQUID_CHECK_WORKING_KRB5
1946 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1947
1948 AC_SUBST(KRB5INCS)
1949 AC_SUBST(KRB5LIBS)
9ca29d23 1950fi
1a5ffec6 1951SQUID_STATE_ROLLBACK([krbsave])
3d62cc61 1952AM_CONDITIONAL(HAVE_SPNEGO, test x"$squid_cv_have_spnego" = x"yes" )
9ca29d23 1953
c6588c68 1954AC_ARG_ENABLE(external-acl-helpers,
f2d9a578 1955 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
8ea232f5 1956 [Enable external_acl helpers support and thelpers themselves.
d9655720 1957 Default is to build all buildable helpers and enable support.
8ea232f5 1958 To disable support, use --disable-external-acl-helpers.
d9655720 1959 To build no helpers, specify "none".
8ea232f5
FC
1960 To see available helpers, see the helpers/external_acl
1961 directory]), [
d9655720 1962#nothing to do, really
c6588c68 1963])
5eabe4b4 1964m4_include([helpers/external_acl/modules.m4])
d9655720 1965
fdbb3b19 1966dnl Select url_rewrite helpers to build
fdbb3b19 1967AC_ARG_ENABLE(url-rewrite-helpers,
081863f3 1968 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
fdbb3b19
AJ
1969 [This option selects which url_rewrite helpers to
1970 build and install as part of the normal build
8ea232f5
FC
1971 process. The default is to attempt the build of all possible
1972 helpers. Use --disable-url-rewrite-helpers to build none.
1973 For a list of available helpers see the
1974 helpers/url_rewrite directory.]),[
fdbb3b19 1975])
5eabe4b4 1976m4_include([helpers/url_rewrite/modules.m4])
fdbb3b19 1977
0d5ee502
AM
1978dnl Select storeid_rewrite helpers to build
1979AC_ARG_ENABLE(storeid-rewrite-helpers,
1980 AS_HELP_STRING([--enable-storeid-rewrite-helpers="list of helpers"],
1981 [This option selects which Store-ID rewrite helpers to
1982 build and install as part of the normal build
1983 process. The default is to attempt the build of all possible
1984 helpers. Use --disable-storeid-rewrite-helpers to build none.
1985 For a list of available helpers see the
1986 helpers/storeid_rewrite directory.]),[
1987])
1988m4_include([helpers/storeid_rewrite/modules.m4])
1989
3a125142 1990AC_ARG_WITH(valgrind-debug,
0f705e3b
FC
1991 AS_HELP_STRING([--with-valgrind-debug],
1992 [Include debug instrumentation for use with valgrind]),
4e26f472
FC
1993[
1994 SQUID_YESNO([$withval],
1995 [unrecognized argument to --with-valgrind-debug: $withval])
fcabe077 1996 if test "x$withval" != "xno" ; then
4e26f472
FC
1997 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
1998 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
1999 ])
b4bab919 2000 fi
2001])
4e26f472
FC
2002SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
2003 [Valgrind memory debugger support])
2004AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
b4bab919 2005
d96ceb8e 2006dnl Disable "memPools" code
8730e87a
HN
2007#AC_ARG_ENABLE(chunkedmempools,
2008# AS_HELP_STRING([--enable-chunkedmempools],
2009# [Enable experimental chunked memPools. Note that this option
507ca601 2010# simply sets the default behaviour. Specific classes can override this
8730e87a
HN
2011# at runtime, and only lib/MemPool.c needs to be altered
2012# to change the squid-wide default for all classes.]), [
2013#SQUID_YESNO([$enableval],
2014# [--enable-chunkedmempools option takes no arguments])
2015#])
4d7cefbb
HN
2016SQUID_DEFINE_BOOL(USE_CHUNKEDMEMPOOLS,${enable_chunkedmempools:=no},
2017 [Enable chunked Memory Pools support (experimental)])
8730e87a 2018#AC_MSG_NOTICE([Chunked MemPools enabled: $enable_chunkedmempools])
d96ceb8e 2019
0e657244 2020dnl Enable WIN32 Service compile mode
2021AC_ARG_ENABLE(win32-service,
054a4caa 2022 AS_HELP_STRING([--enable-win32-service],
0f705e3b 2023 [Compile Squid as a WIN32 Service.
b284c470
FC
2024 Works only on MS-Windows platforms]), [
2025SQUID_YESNO([$enableval],
2026 [unrecognized argument to --enable-win32-service: $enableval])
0e657244 2027])
b284c470
FC
2028SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
2029 [Enable code supporting MS Windows service mode])
2030AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
0e657244 2031
b1485ff8 2032
29f22442 2033# Disable "unlinkd" code
fe0810ac 2034AC_ARG_ENABLE(unlinkd,
0a081cb0 2035 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
0f705e3b
FC
2036SQUID_YESNO([$enableval],
2037 [unrecognized argument to --disable-unlinkd: $enableval])
fe0810ac 2038])
0f658b5b 2039SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
0f705e3b 2040 [Enable useage of unlinkd])
fcabe077 2041AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
fbc04c0a 2042AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
fe0810ac 2043
0f705e3b 2044# Enable backtraces on fatal errors
ce3d30fb 2045AC_ARG_ENABLE(stacktraces,
0f705e3b
FC
2046 AS_HELP_STRING([--enable-stacktraces],
2047 [Enable automatic call backtrace on fatal errors]), [
2048SQUID_YESNO([$enableval],
2049 [unrecognized argument to --enable-stacktraces: $enableval])
ce3d30fb 2050])
0f658b5b 2051SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
0f705e3b 2052 [Print stack traces on fatal errors])
78614cd4 2053AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
0a081cb0 2054
ce3d30fb 2055
904676a2 2056# CPU Profiling options handling
88bfe092 2057AC_ARG_ENABLE(cpu-profiling,
0f705e3b
FC
2058 AS_HELP_STRING([--enable-cpu-profiling],
2059 [Enable instrumentation to try and understand how CPU power
2060 is spent by squid, by enabling specific probes in selected
2061 functions.
2062 New probes can only be added by modifying the source code.
2063 It is meant to help developers in optimizing performance
2064 of Squid internal functions.
87fa90fb 2065 If you are not developer you should not enable this,
0f705e3b
FC
2066 as it slows squid down somewhat.
2067 See lib/Profiler.c for more details.]), [
2068SQUID_YESNO([$enableval],
2069 [unrecognized argument to --enable-cpu-profiling: $enableval])
88bfe092 2070])
13e41ca5
AJ
2071# Default OFF. This is a debug feature. Only check and enable if forced ON.
2072if test "x$enable_cpu_profiling" = "xyes"; then
5e44eea8 2073 SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
13e41ca5 2074 if test "x$squid_cv_cpu_profiler_works" = "xno"; then
5e44eea8 2075 AC_MSG_ERROR([CPU profiling will not be functional in this build.])
5e44eea8 2076 fi
5e44eea8 2077fi
0f658b5b 2078SQUID_DEFINE_BOOL(USE_XPROF_STATS,${enable_cpu_profiling:=no},
0f705e3b
FC
2079 [Define to enable CPU profiling within Squid])
2080AM_CONDITIONAL(ENABLE_XPROF_STATS,
fcabe077 2081 test "x$enable_cpu_profiling" = "xyes")
78614cd4 2082AC_MSG_NOTICE([CPU profiling enabled: $enable_cpu_profiling])
88bfe092 2083
904676a2 2084# Enable X-Accelerator-Vary for Vary support within an accelerator setup
2092c67d 2085AC_ARG_ENABLE(x-accelerator-vary,
904676a2
FC
2086 AS_HELP_STRING([--enable-x-accelerator-vary],
2087 [Enable support for the X-Accelerator-Vary
e702812e
FC
2088 HTTP header. Can be used to indicate
2089 variance within an accelerator setup.
2090 Typically used together with other code
904676a2
FC
2091 that adds custom HTTP headers to the requests.]), [
2092SQUID_YESNO([$enableval],
2093 [unrecognized argument to --enable-x-accelerator-vary: $enableval])
f66a9ef4 2094])
0f658b5b 2095SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
904676a2 2096 [Enable support for the X-Accelerator-Vary HTTP header])
78614cd4 2097AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
f66a9ef4 2098
87fa90fb 2099
8b5e106b 2100if $CPPUNITCONFIG --help >/dev/null; then
78cae3b4
FC
2101 squid_cv_cppunit_version="`$CPPUNITCONFIG --version`"
2102 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
2103 unset squid_cv_cppunit_version
8b5e106b 2104 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2105 SQUID_CPPUNIT_LA=''
2106 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2107else
eed82608 2108 AC_MSG_WARN([cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail.])
63d03edb 2109 SQUID_CPPUNIT_LA=''
2110 SQUID_CPPUNIT_LIBS=''
2111 SQUID_CPPUNIT_INC=''
f5691f9c 2112fi
8b5e106b 2113
f5691f9c 2114AC_ARG_WITH(cppunit-basedir,
1b9fe876 2115 AS_HELP_STRING([--with-cppunit-basedir=PATH],
3680cc44
FC
2116 [Path where the cppunit headers are libraries can be found ]), [
2117if test -f "$withval/include/cppunit/TestCase.h"; then
2118 AC_MSG_NOTICE([Using cppunit includes from $withval])
2119 SQUID_CPPUNIT_INC="-I${withval}/include"
2120else
2121 AC_MSG_ERROR(Cannot find cppunit at $withval)
2122fi
2123if test -f "$withval/lib/libcppunit.la"; then
2124 AC_MSG_NOTICE([Using cppunit lib from $withval])
2125 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
2126 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
2127else
2128 AC_MSG_ERROR(Cannot find cppunit at $withval)
2129fi
f5691f9c 2130])
7b81a8f7
AJ
2131SQUID_STATE_SAVE(squid_cppunit_state)
2132CXXFLAGS="$CXXFLAGS $SQUID_CPPUNIT_INC"
2133AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
2134SQUID_STATE_ROLLBACK(squid_cppunit_state)
8b5e106b 2135AC_SUBST(SQUID_CPPUNIT_LIBS)
f5691f9c 2136AC_SUBST(SQUID_CPPUNIT_LA)
2137AC_SUBST(SQUID_CPPUNIT_INC)
f5691f9c 2138
fd9aaa3e 2139# Force some compilers to use ANSI features
2140#
2141case "$host" in
3680cc44
FC
2142 *-hp-hpux*)
2143 if test "x$ac_cv_prog_CC" = "xcc" ; then
2144 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
2145 CC="cc -Ae";
2146 ac_cv_prog_CC="$CC"
2147 fi
2148 ;;
fd9aaa3e 2149esac
2150
dd56802c 2151
a2794549 2152dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
4e9d8e26 2153
6ad85e8a 2154case "$host" in
3680cc44
FC
2155 *hpux*)
2156 AC_MSG_NOTICE([Disabling ranlib for HP-UX...])
2157 RANLIB=":"
2158 ;;
6ad85e8a 2159esac
2160
090089c4 2161dnl Check for headers
2162AC_HEADER_DIRENT
2163AC_HEADER_STDC
db40ae20 2164
2165AC_CHECK_HEADERS( \
b167f1b8 2166 algorithm \
3680cc44
FC
2167 arpa/inet.h \
2168 arpa/nameser.h \
2169 assert.h \
2170 bstring.h \
2171 cassert \
2172 crypt.h \
dbb66306 2173 cstdarg \
25f98340 2174 cstdlib \
3680cc44 2175 cstring \
95d2589c 2176 list \
3680cc44
FC
2177 ctype.h \
2178 errno.h \
2179 execinfo.h \
2180 fcntl.h \
2181 fnmatch.h \
2182 getopt.h \
2183 glob.h \
2184 gnumalloc.h \
2185 grp.h \
2186 iosfwd \
2187 iomanip \
2188 iostream \
95d2589c 2189 fstream \
43d1bbe4 2190 climits \
3680cc44
FC
2191 ip_compat.h \
2192 ip_fil_compat.h \
2193 ip_fil.h \
2194 ip_nat.h \
2195 ipl.h \
2196 lber.h \
2197 ldap.h \
2198 libc.h \
425de4c8 2199 limits \
3680cc44
FC
2200 limits.h \
2201 linux/posix_types.h \
2202 linux/types.h \
2203 machine/byte_swap.h \
2204 malloc.h \
2205 map \
2206 math.h \
2207 memory.h \
95d2589c 2208 memory \
3680cc44
FC
2209 mount.h \
2210 netdb.h \
2211 netinet/in.h \
2212 netinet/in_systm.h \
2213 netinet/ip_fil_compat.h \
2214 openssl/err.h \
2215 openssl/md5.h \
3eee6040 2216 openssl/opensslv.h \
3680cc44
FC
2217 openssl/ssl.h \
2218 openssl/x509v3.h \
2219 netinet/tcp.h \
2220 openssl/engine.h \
95d2589c 2221 openssl/txt_db.h \
3680cc44
FC
2222 ostream \
2223 paths.h \
2224 poll.h \
2225 pwd.h \
2226 shadow.h \
2227 regex.h \
2228 sched.h \
2ccf2eb2 2229 siginfo.h \
3680cc44
FC
2230 signal.h \
2231 sstream \
2232 stdarg.h \
425de4c8 2233 stdbool.h \
3680cc44
FC
2234 stddef.h \
2235 stdexcept \
2236 stdio.h \
2237 stdlib.h \
2238 string \
2239 string.h \
2240 strings.h \
2241 sys/bitypes.h \
2242 sys/bswap.h \
2243 sys/endian.h \
2244 sys/file.h \
2245 sys/ioctl.h \
d440d5a4 2246 sys/ipc.cc \
3680cc44
FC
2247 sys/param.h \
2248 sys/prctl.h \
2249 sys/md5.h \
c975f532 2250 sys/mman.h \
3680cc44
FC
2251 sys/msg.h \
2252 sys/resource.h \
2ccf2eb2 2253 sys/select.h \
d440d5a4 2254 sys/shm.h \
3680cc44
FC
2255 sys/socket.h \
2256 sys/stat.h \
2257 sys/statvfs.h \
2258 syscall.h \
2259 sys/syscall.h \
2260 sys/time.h \
2261 sys/types.h \
2262 sys/uio.h \
2263 sys/un.h \
2264 sys/vfs.h \
2265 sys/wait.h \
2266 syslog.h \
2267 time.h \
2268 unistd.h \
2269 utime.h \
2270 varargs.h \
2271 byteswap.h \
2272 glib.h \
2273 stdint.h \
2274 inttypes.h \
3680cc44 2275 db.h \
cdb86165
FC
2276 db_185.h \
2277 wchar.h
db40ae20 2278)
3c586e38 2279
ee80a919
AR
2280AC_CHECK_HEADERS( \
2281 linux/netfilter_ipv4.h \
2282 linux/netfilter_ipv6/ip6_tables.h \
fc68f6b1 2283,,,
dcd1dc78 2284SQUID_DEFAULT_INCLUDES
2285#if HAVE_LIMITS_H
2286#include <limits.h>
2287#endif
a74968c2
AJ
2288/* Netfilter ip(6)tables v1.4.0 has broken headers */
2289#if HAVE_NETINET_IN_H
2290#include <netinet/in.h>
2291#endif
dcd1dc78 2292)
2293
cdb352bb 2294dnl *BSD dont include the dependencies for all their net/ and netinet/ files
c92b4732 2295dnl We must include a few basic type headers for them to work.
d1e5191e 2296AC_CHECK_HEADERS( \
0c0d381b
FC
2297 net/if.h \
2298 netinet/if_ether.h\
2299 netinet/icmp6.h \
2300 netinet/in.h \
2301 netinet/ip.h \
2302 netinet/ip6.h \
2303 netinet/ip_compat.h\
2304 netinet/ip_fil_compat.h\
2305 netinet/ip_fil.h\
2306 netinet/ip_icmp.h \
2307 netinet/ipl.h \
2308 netinet/ip_nat.h\
2309 net/pf/pfvar.h \
2310 net/pfvar.h \
2311 sys/mount.h\
2312 resolv.h \
d1e5191e
AJ
2313,,,
2314SQUID_BSDNET_INCLUDES)
5a3237b0 2315
aee0606f 2316AC_C_CONST
d57288d2 2317AC_C_BIGENDIAN
aee0606f 2318
6a9f6389 2319AC_STRUCT_TM
2320AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2321#if TM_IN_SYS_TIME
2322#if HAVE_SYS_TIME_H
2323#include <sys/time.h>
2324#endif
2325#elif HAVE_TIME_H
2326#include <time.h>
2327#endif
5c51415d 2328])
46c883ed 2329
ef7ece58 2330SQUID_HAVE_STRUCT_MALLINFO
090089c4 2331
08caf8c6 2332dnl Override rusage() detect on MinGW because is emulated in source code
78a60bca
AJ
2333case "$squid_host_os" in
2334 mingw)
08caf8c6 2335 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2336 ac_cv_func_getrusage='yes'
eed82608 2337 AC_MSG_NOTICE([Using own rusage on Windows.])
08caf8c6 2338 ;;
2339 *)
2340 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 2341#if HAVE_SYS_TIME_H
2342#include <sys/time.h>
2343#endif
b54a6789 2344#if HAVE_SYS_RESOURCE_H
2345#include <sys/resource.h>
6a9f6389 2346#endif])
08caf8c6 2347 ;;
2348esac
b54a6789 2349
6a9f6389 2350AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2351#if HAVE_SYS_TYPES_H
2352#include <sys/types.h>
2353#endif
a025a745 2354#include <netinet/in.h>
2355#include <netinet/in_systm.h>
6ad85e8a 2356#include <netinet/ip.h>
b05490a8 2357#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 2358#define ip_hl ihl
2359#endif
2360#ifndef __linux__
b05490a8 2361#ifndef __CYGWIN__
6ad85e8a 2362#define iphdr ip
b05490a8 2363#endif
6a9f6389 2364#endif])
a025a745 2365
090089c4 2366dnl Check for typedefs
77d6bd88 2367AC_CHECK_SIZEOF(void *)
090089c4 2368
41aa7d00
FC
2369# check for a bunch of types
2370AC_TYPE_INT8_T
2371AC_TYPE_UINT8_T
2372AC_TYPE_INT16_T
2373AC_TYPE_UINT16_T
2374AC_TYPE_INT32_T
2375AC_TYPE_UINT32_T
2376AC_TYPE_INT64_T
2377AC_TYPE_UINT64_T
2378AC_TYPE_PID_T
2379AC_TYPE_SIZE_T
2380AC_TYPE_SSIZE_T
2381AC_TYPE_OFF_T
2382AC_TYPE_UID_T
59a09b98 2383AC_CHECK_TYPE([bool])
41aa7d00
FC
2384#need the defines for PRId64
2385AC_CHECK_SIZEOF(int64_t)
2386AC_CHECK_SIZEOF(long)
fe1e5c91
AJ
2387#need the defines for PRIuSIZE
2388AC_CHECK_SIZEOF(size_t)
50f9c873
AR
2389#need the define for overflow checks
2390AC_CHECK_SIZEOF(off_t)
46e172d9 2391AC_CHECK_SIZEOF(size_t)
6a9f6389 2392
a203dec7
AJ
2393dnl Some C++0x types we try to use
2394AX_CXX_TYPE_NULLPTR
2395AX_CXX_TYPE_UNIQUE_PTR
2396
588e71df 2397dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2398dnl that is incompatible with the updated Solaris header files.
2399dnl For this reason, we must check if pad128_t and upad128_t are defined.
2400AC_CHECK_TYPE(pad128_t,
2401 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2402 ,SQUID_DEFAULT_INCLUDES)
2403
2404AC_CHECK_TYPE(upad128_t,
2405 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2406 ,SQUID_DEFAULT_INCLUDES)
2407
6a9f6389 2408AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2409AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 2410
6a9f6389 2411AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2412#include <sys/types.h>
6637e3a5 2413#include <sys/socket.h>
2414#if STDC_HEADERS
2415#include <stdlib.h>
2416#include <stddef.h>
6a9f6389 2417#endif])
6637e3a5 2418
cdb352bb
FC
2419AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
2420 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
2421#include <sys/ipc.h>
2422#include <sys/msg.h>])
2423
fe1e5c91
AJ
2424# check for compiler support of %zu printf macro
2425AH_TEMPLATE(PRIuSIZE,[Compiler supports %zu printf macro])
2426AC_MSG_CHECKING([for compiler %zu support])
2427AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2428#include <stdio.h>
2429 ]],[[size_t n=1;printf("%zu",n);]])],[
2430 AC_DEFINE(PRIuSIZE,"zu")
2431 AC_MSG_RESULT(yes)
2432 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
2433
2434
cdb352bb
FC
2435dnl Check for special functions
2436AC_FUNC_ALLOCA
2437
2438
b50f1b2b 2439dnl Check for libcap header (assume its not broken unless
45c41a07
FC
2440AC_ARG_WITH(libcap, AS_HELP_STRING([--without-libcap],
2441 [disable usage of Linux capabilities library to control privileges]), [
2442SQUID_YESNO([$withval],[unrecognized argument to --without-libcap: $withval])
2443],[with_libcap=auto])
2444
2445if test "x$with_libcap" != "xno"; then
b64b6030 2446 # cap_clear_flag is the most recent libcap function we require
45c41a07 2447 AC_CHECK_HEADERS(sys/capability.h)
b64b6030 2448 AC_CHECK_LIB(cap, cap_clear_flag)
45c41a07
FC
2449 SQUID_CHECK_FUNCTIONAL_LIBCAP2
2450
2451 # if it can't be supported..
35e2b2e5 2452 if test "x$ac_cv_header_sys_capability_h" = "xno" -o \
46f50de9 2453 "x$ac_cv_lib_cap_cap_clear_flag" = "xno"; then
45c41a07 2454 # and it was forced on: error
46f50de9 2455 if test "x$with_libcap" = "xyes" ; then
ff8d255b 2456 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
3fbda12c
FC
2457 else
2458 # with_libcap is "auto"; it can't be supported. Disable.
2459 with_libcap=no
b64b6030 2460 fi
45c41a07
FC
2461 else
2462 # header and lib are ok, we support
2463 with_libcap=yes
b64b6030 2464 fi
69367152 2465
b50f1b2b 2466fi
5b43d209 2467
45c41a07
FC
2468SQUID_DEFINE_BOOL(USE_LIBCAP,$with_libcap,
2469 [use libcap to set capabilities required for TPROXY])
2470AC_MSG_NOTICE([libcap support enabled: $with_libcap])
2471SQUID_DEFINE_BOOL(LIBCAP_BROKEN,${squid_cv_sys_capability_works:=no},
2472 [libcap2 headers are broken and clashing with glibc])
2473AC_MSG_NOTICE([libcap2 headers are ok: $squid_cv_sys_capability_works])
2474
b64b6030 2475
090089c4 2476dnl Check for needed libraries
54c95954 2477AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
819656da
AJ
2478AC_SEARCH_LIBS([res_init],[resolv])
2479AC_SEARCH_LIBS([__res_search],[resolv])
54c95954
FC
2480AC_SEARCH_LIBS([bind],[socket])
2481AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
2482AC_SEARCH_LIBS([strlcpy], [bsd])
85cd85f3 2483AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
bfe8dedf 2484dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
0c0d381b
FC
2485if test "x$squid_host_os" = "xmingw" ; then
2486 SQUID_CHECK_WINSOCK_LIB
32341684
AJ
2487 AC_CHECK_HEADERS( \
2488 windows.h \
2489 ws2tcpip.h \
2490 Iphlpapi.h ,,,[
2491#if HAVE_WINDOWS_H
2492#include <windows.h>
2493#endif
0a675778
FC
2494#if HAVE_WINSOCK2_H
2495#include <winsock2.h>
2496#endif])
0c0d381b 2497fi
94d48591 2498
46f50de9
FC
2499# check that we have unix sockets
2500SQUID_CHECK_UNIX_SOCKET
2501SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
2502
2503AC_CHECK_LIB(gnumalloc, malloc)
2504if test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"; then
ef7ece58 2505 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
46f50de9
FC
2506 ac_cv_func_mallinfo=no
2507 ac_cv_func_mallocblksize=no
2508 ac_cv_func_mallopt=no
2509else
2510 case "$squid_host_os" in
2511 solaris)
2512 AC_MSG_NOTICE([skipping libmalloc check for $host])
2513 ;;
2514 freebsd)
2515 AC_MSG_NOTICE([skipping libmalloc check for $host])
2516 ;;
2517 *)
2518 #used later. FIXME
2519 AC_CHECK_LIB(malloc, main)
2520 ;;
cdb352bb
FC
2521 esac
2522fi
94d48591 2523
78a60bca
AJ
2524case "$squid_host_os" in
2525 mingw)
2526 AC_MSG_NOTICE([Use MSVCRT for math functions.])
2527 ;;
2528 *)
2529 dnl rint() and log() are only used in old C code for now.
2530 AC_LANG_PUSH([C])
2531 AC_SEARCH_LIBS([rint],[m])
2532 AC_SEARCH_LIBS([log],[m])
2533 AC_LANG_POP([C])
2534 ;;
08caf8c6 2535esac
090089c4 2536
001ad4cc 2537
f467f578
FC
2538dnl --with-maxfd present for compatibility with Squid-2.
2539dnl undocumented in ./configure --help to encourage using the Squid-3 directive
2540AC_ARG_WITH(maxfd,,
2541[
2542 case ${withval} in
2543 [[0-9]]*)
2544 squid_filedescriptors_num=$withval
2545 ;;
2546 *)
2547 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
2548 ;;
2549 esac
055421ee 2550])
001ad4cc 2551
f467f578
FC
2552AC_ARG_WITH(filedescriptors,
2553 AS_HELP_STRING([--with-filedescriptors=NUMBER],
2554 [Force squid to support NUMBER filedescriptors]),
2555[
2556 case ${withval} in
2557 [[0-9]]*)
2558 squid_filedescriptors_num=$withval
2559 ;;
2560 *)
2561 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
2562 ;;
2563 esac
001ad4cc 2564])
f467f578
FC
2565
2566SQUID_CHECK_DEFAULT_FD_SETSIZE
2567if test "x$squid_filedescriptors_num" = "x"; then
2568 SQUID_CHECK_MAXFD
001ad4cc 2569else
f467f578 2570 AC_MSG_NOTICE([forcing use of $squid_filedescriptors_num filedescriptors (user-forced)])
001ad4cc 2571fi
f467f578
FC
2572if test "$squid_filedescriptors_num" -lt 512 ; then
2573 AC_MSG_WARN([$squid_filedescriptors_num may not be enough filedescriptors if your])
2574 AC_MSG_WARN([cache will be very busy. Please see the FAQ page])
2575 AC_MSG_WARN([http://wiki.squid-cache.org/SquidFaq/TroubleShooting])
2576 AC_MSG_WARN([on how to increase your filedescriptor limit])
2577fi
2578AC_DEFINE_UNQUOTED(SQUID_MAXFD, $squid_filedescriptors_num,[Maximum number of open filedescriptors])
001ad4cc 2579
f467f578 2580
001ad4cc
AJ
2581dnl Enable IPv6 support
2582AC_MSG_CHECKING([whether to enable IPv6])
001ad4cc 2583AC_ARG_ENABLE(ipv6,
af494bc8
FC
2584 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
2585SQUID_YESNO([$enableval],[unrecognized argument to --disable-ipv6: $enableval])
001ad4cc 2586])
7d927f1f
AJ
2587AC_MSG_RESULT(${enable_ipv6:=yes})
2588SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
001ad4cc 2589
7d927f1f 2590if test "x$enable_ipv6" = "xyes" ; then
af494bc8 2591 SQUID_CHECK_SIN6_LEN_IN_SAI
001ad4cc 2592fi
7d553ad9
AJ
2593SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
2594SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
001ad4cc 2595
001ad4cc 2596
090089c4 2597dnl Check for libcrypt
0d8565ac 2598CRYPTLIB=
8154dd82 2599dnl Some of our helpers use crypt(3) which may be in libc, or in
2600dnl libcrypt (eg FreeBSD)
c1dc012a 2601AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
3d4022fa 2602dnl Solaris10 provides MD5 natively through libmd5
c1dc012a 2603AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
be79ade0 2604AC_SUBST(CRYPTLIB)
77f675ad 2605
0d8565ac
AJ
2606# check for crypt, may require -lcrypt
2607SAVED_LIBS="$LIBS"
2608LIBS="$LIBS $CRYPTLIB"
2609AC_CHECK_FUNCS(crypt)
2610LIBS="$SAVED_LIBS"
2611
2612
042b1f8a 2613dnl Check for libdl, used by auth_modules/PAM
fcabe077 2614if test "x$with_dl" = "xyes"; then
8154dd82 2615 AC_CHECK_LIB(dl, dlopen)
2616fi
042b1f8a 2617
86ec11aa 2618dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
2619dnl Robert Side <rside@aiinc.bc.ca>
2620dnl Mon, 18 Jan 1999 17:48:00 GMT
2621case "$host" in
2622 *-pc-sco3.2*)
2623 AC_CHECK_LIB(intl, strftime)
2624 ;;
2625esac
2626
20e869bf 2627dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
2628dnl only with Windows LDAP libraries using -lwldap32
78a60bca
AJ
2629case "$squid_host_os" in
2630 mingw)
b1218840
AJ
2631 LDAPLIB="-lwldap32"
2632 LBERLIB=""
2633 ;;
2634 *)
2635 AC_CHECK_LIB(ldap, ldap_init, [LDAPLIB="-lldap"])
2636 dnl LDAP helpers need to know if -llber is needed or not
2637 AC_CHECK_LIB(lber, ber_init, [LBERLIB="-llber"])
2638 dnl if no ldap lib found check for mozilla version
2639 if test "x$ac_cv_lib_ldap_ldap_init" != x""yes; then
2640 oLIBS=$LIBS
2641 LIBS="$LIBPTHREADS"
2642 AC_CHECK_LIB(ldap60, ldap_init, [LDAPLIB="-lldap60"])
2643 LIBS="$LDAPLIB $LIBPTHREADS"
2644 AC_CHECK_LIB(prldap60, prldap_init, [LDAPLIB="-lprldap60 $LDAPLIB"])
2645 LIBS="$LDAPLIB $LIBPTHREADS"
2646 AC_CHECK_LIB(ssldap60, ldapssl_init, [LDAPLIB="-lssldap60 $LDAPLIB"])
2647 LIBS=$oLIBS
2648 fi
2649
2650 AC_CHECK_HEADERS(ldap.h lber.h)
2651 AC_CHECK_HEADERS(mozldap/ldap.h)
2652
2653 dnl
2654 dnl Check for LDAP_OPT_DEBUG_LEVEL
2655 dnl
2656 AC_MSG_CHECKING([for LDAP_OPT_DEBUG_LEVEL])
2657 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2658# include <ldap.h>
2659 ]],[[
2660 int i=LDAP_OPT_DEBUG_LEVEL
2661 ]])],
2662 [ AC_MSG_RESULT(yes) ],
2663 [ AC_MSG_RESULT(no) ])
2664
2665 dnl
2666 dnl Check for working ldap
2667 dnl
2668 oLIBS=$LIBS
2669 LIBS="$LDAPLIB $LBERLIB $LIBPTHREADS"
2670 AC_MSG_CHECKING([for working ldap])
2671 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2672# define LDAP_DEPRECATED 1
2673# if HAVE_LDAP_H
2674# include <ldap.h>
2675# elif HAVE_MOZLDAP_LDAP_H
2676# include <mozldap/ldap.h>
2677# endif
2678 int
2679 main(void)
2680 {
2681 char host[]="";
2682 int port;
2683
2684 ldap_init((const char *)&host, port);
2685
2686 return 0;
2687 }
2688 ]])],
2689 [ AC_DEFINE(HAVE_LDAP, 1, [LDAP support])
2690 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2691 [ AC_MSG_RESULT(no) ],
2692 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2693 LIBS=$oLIBS
2694
2695 dnl
2696 dnl Check for ldap vendor
2697 dnl
2698 AC_MSG_CHECKING([for OpenLDAP])
2699 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2700# if HAVE_LDAP_H
2701# include <ldap.h>
2702# endif
2703# include <string.h>
2704 int
2705 main(void)
2706 {
2707 return strcmp(LDAP_VENDOR_NAME,"OpenLDAP");
2708 }
2709 ]])],
2710 [ AC_DEFINE(HAVE_OPENLDAP, 1, [OpenLDAP support])
2711 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2712 [ AC_MSG_RESULT(no) ],
2713 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2714
2715 AC_MSG_CHECKING([for Sun LDAP SDK])
2716 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2717# if HAVE_LDAP_H
2718# include <ldap.h>
2719# endif
2720# include <string.h>
2721 int
2722 main(void)
2723 {
2724 return strcmp(LDAP_VENDOR_NAME,"Sun Microsystems Inc.");
2725 }
2726 ]])],
2727 [ AC_DEFINE(HAVE_SUN_LDAP_SDK, 1, [Sun LDAP SDK support])
2728 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2729 [ AC_MSG_RESULT(no) ],
2730 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2731
2732 AC_MSG_CHECKING([for Mozilla LDAP SDK])
2733 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2734# if HAVE_LDAP_H
2735# include <ldap.h>
2736# elif HAVE_MOZLDAP_LDAP_H
2737# include <mozldap/ldap.h>
2738# endif
2739# include <string.h>
2740 int
2741 main(void)
2742 {
2743 return strcmp(LDAP_VENDOR_NAME,"mozilla.org");
2744 }
2745 ]])],
2746 [ AC_DEFINE(HAVE_MOZILLA_LDAP_SDK, 1, [Mozilla LDAP SDK support])
2747 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2748 [ AC_MSG_RESULT(no)],
2749 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2750
2751 dnl
2752 dnl Check for LDAP_REBINDPROC_CALLBACK
2753 dnl
2754 AC_MSG_CHECKING([for LDAP_REBINDPROC_CALLBACK])
2755 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2756# if HAVE_LDAP_H
2757# include <ldap.h>
2758# elif HAVE_MOZLDAP_LDAP_H
2759# include <mozldap/ldap.h>
2760# endif
2761 ]],[[
2762 LDAP_REBINDPROC_CALLBACK ldap_rebind;
2763 ]])],
2764 [ AC_DEFINE(HAVE_LDAP_REBINDPROC_CALLBACK,1,[Define to 1 if you have LDAP_REBINDPROC_CALLBACK])
2765 AC_MSG_RESULT(yes) ],
2766 [ AC_MSG_RESULT(no) ])
2767
2768 dnl
2769 dnl Check for LDAP_REBIND_PROC
2770 dnl
2771 AC_MSG_CHECKING([for LDAP_REBIND_PROC])
2772 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2773# if HAVE_LDAP_H
2774# include <ldap.h>
2775# elif HAVE_MOZLDAP_LDAP_H
2776# include <mozldap/ldap.h>
2777# endif
2778 ]],[[
2779 LDAP_REBIND_PROC ldap_rebind;
2780 ]])],
2781 [ AC_DEFINE(HAVE_LDAP_REBIND_PROC,1,[Define to 1 if you have LDAP_REBIND_PROC])
2782 AC_MSG_RESULT(yes) ],
2783 [ AC_MSG_RESULT(no) ])
2784
2785 dnl
2786 dnl Check for LDAP_REBIND_FUNCTION
2787 dnl
2788 AC_MSG_CHECKING([for LDAP_REBIND_FUNCTION])
2789 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2790# define LDAP_REFERRALS
2791# if HAVE_LDAP_H
2792# include <ldap.h>
2793# elif HAVE_MOZLDAP_LDAP_H
2794# include <mozldap/ldap.h>
2795# endif
2796 ]],[[
2797 LDAP_REBIND_FUNCTION ldap_rebind;
2798 ]])],
2799 [ AC_DEFINE(HAVE_LDAP_REBIND_FUNCTION,1,[Define to 1 if you have LDAP_REBIND_FUNCTION])
2800 AC_MSG_RESULT(yes) ],
2801 [ AC_MSG_RESULT(no) ])
2802
2803 dnl
2804 dnl Check for LDAP_SCOPE_DEFAULT
2805 dnl
2806 AC_MSG_CHECKING([for LDAP_SCOPE_DEFAULT])
2807 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2808# if HAVE_LDAP_H
2809# include <ldap.h>
2810# elif HAVE_MOZLDAP_LDAP_H
2811# include <mozldap/ldap.h>
2812# endif
2813 ]],[[
2814 int i=LDAP_SCOPE_DEFAULT;
2815 ]])],
2816 [ AC_DEFINE(HAVE_LDAP_SCOPE_DEFAULT,1,[Define to 1 if you have LDAP_SCOPE_DEFAULT])
2817 AC_MSG_RESULT(yes) ],
2818 [ AC_MSG_RESULT(no) ])
2819
2820 dnl
2821 dnl Check for ldap_url_desc.lud_scheme
2822 dnl
2823 AC_CHECK_MEMBER(struct ldap_url_desc.lud_scheme,
2824 AC_DEFINE(HAVE_LDAP_URL_LUD_SCHEME,1,
2825 [Define to 1 if you have LDAPURLDesc.lud_scheme]),,[#include <ldap.h>])
2826
2827 dnl
2828 dnl Check for ldapssl_client_init
2829 dnl
2830 AC_CHECK_LIB(ldap,ldapssl_client_init,
2831 AC_DEFINE(HAVE_LDAPSSL_CLIENT_INIT,1,[Define to 1 if you have ldapssl_client_init]),)
2832
2833 dnl
2834 dnl Check for ldap_url_desc2str
2835 dnl
2836 AC_CHECK_LIB(ldap,ldap_url_desc2str,
2837 AC_DEFINE(HAVE_LDAP_URL_DESC2STR,1,[Define to 1 if you have ldap_url_desc2str]),)
2838
2839 dnl
2840 dnl Check for ldap_url_parse
2841 dnl
2842 AC_CHECK_LIB(ldap,ldap_url_parse,
2843 AC_DEFINE(HAVE_LDAP_URL_PARSE,1,[Define to 1 if you have ldap_url_parse]),)
60727a6f
AJ
2844
2845 dnl
2846 dnl Check for ldap_start_tls_s
2847 dnl
2848 AC_CHECK_LIB(ldap,ldap_start_tls_s,
2849 AC_DEFINE(HAVE_LDAP_START_TLS_S,1,[Define to 1 if you have ldap_start_tls_s]),)
b1218840 2850 ;;
20e869bf 2851esac
b1218840 2852
428744a1
AJ
2853AC_SUBST(LDAPLIB)
2854AC_SUBST(LBERLIB)
20e869bf 2855
b7a1c19e 2856dnl Check for libdb
6b5de50d 2857dnl this is not fully functional if db.h is for a differend db version
b7a1c19e 2858DBLIB=
6b5de50d
FC
2859
2860dnl check that dbopen is actually defined in the header
2861dnl FIXME: in case of failure undef db-related includes etc.
2862AC_CHECK_DECL(dbopen,,,[
06fbee01
FC
2863#if HAVE_SYS_TYPES_H
2864#include <sys/types.h>
2865#endif
2866#if HAVE_LIMITS_H
2867#include <limits.h>
2868#endif
6b5de50d
FC
2869#if HAVE_DB_185_H
2870#include <db_185.h>
2871#elif HAVE_DB_H
2872#include <db.h>
2873#endif])
2874
01b4931d 2875dnl 1.85
91983da0 2876SQUID_CHECK_DBOPEN_NEEDS_LIBDB
fcabe077 2877if test "x$ac_cv_dbopen_libdb" = "xyes"; then
32d0bbd7 2878 LIB_DB="-ldb"
2879fi
01b4931d 2880AC_SUBST(LIB_DB)
b7a1c19e 2881
77f675ad 2882dnl System-specific library modifications
2883dnl
2884case "$host" in
fcabe077
FC
2885 i386-*-solaris2.*)
2886 if test "x$GCC" = "xyes"; then
2887 AC_MSG_NOTICE([Removing -O for gcc on $host])
2888 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2889 fi
2890 ;;
2891 *-sgi-irix*)
2892 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
2893 LIBS=`echo $LIBS | sed -e s/-lsocket//`
2894 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
2895 LIBS=`echo $LIBS | sed -e s/-lnsl//`
2896 ac_cv_lib_nsl_main=no
2897 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
2898 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2899 ;;
4ba0bd0e 2900dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
2901dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
2902dnl Please change your configure script. AIX doesn't need -lbsd.
fcabe077
FC
2903 *-ibm-aix*)
2904 AC_MSG_NOTICE([Removing -lbsd for AIX...])
2905 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3e1ce596
KB
2906
2907 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
2908#include <assert.h>
2909#ifndef NULL
2910#define NULL 0
2911#endif
2912class Foo{
2913public:virtual ~Foo(){}
2914};
2915class Bar:public Foo{
2916public:Bar():Foo(){}
2917};
2918 ]],[[
2919Foo * myFoo=new Bar();
2920Bar * myBar=dynamic_cast<Bar *>(myFoo);
2921assert(myBar != NULL);
2922 ]])
2923 if test "$ac_cv_require_rtti" = "yes"; then
2924 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
2925 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
fcabe077 2926 fi
3e1ce596
KB
2927
2928 AC_LANG_PUSH([C])
2929 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
fcabe077 2930 AC_LANG_POP([C])
3e1ce596
KB
2931 if test "$ac_cv_require_qcpluscmt" = "yes"; then
2932 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
2933 fi
fcabe077 2934 ;;
3e1ce596 2935
fcabe077
FC
2936 *m88k*)
2937 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
2938 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
2939 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,
2940 [If gettimeofday is known to take only one argument])
2941 ;;
2942 [*-*-solaris2.[0-4]])
2943 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2944 ;;
2945 [*-sony-newsos[56]*])
2946 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2947 ;;
2948 esac
090089c4 2949
57faa85a 2950# Remove optimization for GCC 2.95.[123]
d20b1cd0 2951# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
fcabe077 2952if test "x$GCC" = "xyes"; then
d20b1cd0 2953 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
2954 case "$GCCVER" in
57faa85a 2955 [2.95.[123]])
eed82608 2956 AC_MSG_NOTICE([Removing -O for gcc on $host with GCC $GCCVER])
d20b1cd0 2957 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2958 ;;
2959 esac
2960fi
2961
176d10ee 2962# Recommended by Balint Nagy Endre <bne@CareNet.hu>
2963case "$host" in
fcabe077
FC
2964 *-univel-sysv4.2MP)
2965 if test `uname -v` = "2.03"; then
2966 AC_MSG_NOTICE([disabling mallinfo for $host])
2967 ac_cv_func_mallinfo=no
2968 fi
2969 ;;
176d10ee 2970esac
2971
84cecfd2 2972dnl This has to be before AC_CHECK_FUNCS
2973# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2974# when running configure.
fcabe077
FC
2975if test "x$ac_cv_func_poll" = "x" ; then
2976 case "$host" in
2977 [*-hp-hpux*.*])
2978 # Duane Wessels
2979 AC_MSG_NOTICE([disabling poll for $host...])
2980 ac_cv_func_poll='no'
2981 ;;
2982 [*-linux-*])
2983 # Henrik Nordstrom (hno@squid-cache.org) 19980817
2984 # poll is problematic on Linux. We disable it
2985 # by default until Linux gets it right.
2986 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2987 if test $rev -lt 002002; then
2988 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
2989 ac_cv_func_poll='no'
2990 fi
2991 ;;
2992 [powerpc-ibm-aix4.1.*])
2993 # Mike Laster (mlaster@metavillage.com) 19981021
2994 AC_MSG_NOTICE([disabling poll for $host...])
2995 ac_cv_func_poll='no'
2996 ;;
2997 [*-pc-sco3.2*])
2998 # Robert Side <rside@aiinc.bc.ca>
2999 # Mon, 18 Jan 1999 17:48:00 GMT
3000 AC_MSG_NOTICE([disabling poll for $host...])
3001 ac_cv_func_poll='no'
3002 ;;
3003 esac
84cecfd2 3004fi
176d10ee 3005
78a60bca
AJ
3006dnl Override statfs() detect on MinGW because it is emulated in source code
3007if test "x$squid_host_os" = "xmingw" ; then
fcabe077 3008 ac_cv_func_statfs='yes'
78a60bca 3009fi
08caf8c6 3010
6716b242 3011dnl Check for library functions
3012AC_CHECK_FUNCS(\
ce3d30fb 3013 backtrace_symbols_fd \
3a144521 3014 bcopy \
3015 bswap_16 \
3016 bswap_32 \
f9576890 3017 bswap16 \
3018 bswap32 \
4ac29a5b 3019 fchmod \
6716b242 3020 getdtablesize \
8505e57b 3021 getpagesize \
230c091c 3022 getpass \
3a144521 3023 getrlimit \
30a4f2a8 3024 getrusage \
9c1d8929 3025 getspnam \
379d5751 3026 gettimeofday \
52303a3d 3027 glob \
f9576890 3028 htobe16 \
3029 htole16 \
30a4f2a8 3030 lrand48 \
6716b242 3031 mallinfo \
0f5efab0 3032 mallocblksize \
6716b242 3033 mallopt \
2ae6b9b0 3034 memcpy \
30a4f2a8 3035 memmove \
dac27377 3036 memset \
b99a6dec 3037 mkstemp \
1812b6c7 3038 mktime \
88738790 3039 mstats \
84cecfd2 3040 poll \
62ae0622 3041 prctl \
3a144521 3042 pthread_attr_setschedparam \
cd748f27 3043 pthread_attr_setscope \
3044 pthread_setschedparam \
42b51993 3045 pthread_sigmask \
c68e9c6b 3046 putenv \
b1e77ec1 3047 random \
6716b242 3048 regcomp \
3049 regexec \
3050 regfree \
819656da
AJ
3051 res_init \
3052 __res_init \
4915be3b 3053 rint \
a4ba1105 3054 sbrk \
96c2bb61
AR
3055 sched_getaffinity \
3056 sched_setaffinity \
3a144521 3057 select \
234967c9 3058 seteuid \
c415c128 3059 setgroups \
30a4f2a8 3060 setpgrp \
30a4f2a8 3061 setsid \
3062 sigaction \
11430c03 3063 snprintf \
1ccc0d40 3064 socketpair \
30a4f2a8 3065 srand48 \
b1e77ec1 3066 srandom \
0343b99c 3067 statfs \
6716b242 3068 sysconf \
3069 syslog \
234967c9 3070 timegm \
28da5e0d 3071 vsnprintf \
6716b242 3072)
f5e5c4cf 3073dnl ... and some we provide local replacements for
3074AC_REPLACE_FUNCS(\
3075 drand48 \
a98c2da5 3076 eui64_aton \
cc192b50 3077 inet_ntop \
3078 inet_pton \
f5e5c4cf 3079 initgroups \
cc192b50 3080 getaddrinfo \
3081 getnameinfo \
2ccf2eb2 3082 psignal \
f5e5c4cf 3083 strerror \
585cddda
AJ
3084 strsep \
3085 strtoll \
f5e5c4cf 3086 tempnam \
3087)
6716b242 3088
9676633b
FC
3089# Magic which checks whether we are forcing a type of comm loop we
3090# are actually going to (ab)use.
3091# Mostly ripped from squid-commloops, thanks to adrian and benno
1b3db6d9 3092
fcabe077 3093if test "x$squid_opt_io_loop_engine" != "x"; then
8075a4da 3094 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine])
fcabe077 3095elif test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes" ; then
8075a4da 3096 squid_opt_io_loop_engine="epoll"
26d50fd2 3097elif test "x$enable_kqueue" != "xno" ; then
8075a4da 3098 squid_opt_io_loop_engine="kqueue"
a1ad2f9b
AJ
3099elif test "x$enable_devpoll" != "xno" ; then
3100 squid_opt_io_loop_engine="devpoll"
fcabe077 3101elif test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes" ; then
8075a4da 3102 squid_opt_io_loop_engine="poll"
39145d19 3103elif test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"; then
8075a4da 3104 squid_opt_io_loop_engine="select"
39145d19
AJ
3105elif test "x$enable_select" != "xno" -a "x$squid_host_os" = "xmingw"; then
3106 squid_opt_io_loop_engine="select_win32"
1b3db6d9 3107else
a1ad2f9b 3108 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
be0c7ff0 3109 AC_MSG_WARN([Will try select and hope for the best.])
8075a4da 3110 squid_opt_io_loop_engine="select"
1b3db6d9 3111fi
d474c7a6 3112
8075a4da 3113AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
d474c7a6 3114
8075a4da
FC
3115AM_CONDITIONAL([USE_POLL], [test $squid_opt_io_loop_engine = poll])
3116AM_CONDITIONAL([USE_EPOLL], [test $squid_opt_io_loop_engine = epoll])
3117AM_CONDITIONAL([USE_SELECT], [test $squid_opt_io_loop_engine = select])
8075a4da
FC
3118AM_CONDITIONAL([USE_SELECT_WIN32], [test $squid_opt_io_loop_engine = select_win32])
3119AM_CONDITIONAL([USE_KQUEUE], [test $squid_opt_io_loop_engine = kqueue])
3120AM_CONDITIONAL([USE_DEVPOLL], [test $squid_opt_io_loop_engine = devpoll])
d474c7a6 3121
8075a4da 3122case $squid_opt_io_loop_engine in
0abb39dd 3123 epoll) AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop]) ;;
a1ad2f9b 3124 devpoll) AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop]) ;;
0abb39dd
FC
3125 poll) AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop]) ;;
3126 kqueue) AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop]) ;;
3127 select_win32) AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop]) ;;
3128 select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
d474c7a6 3129esac
1b3db6d9 3130
96c2bb61
AR
3131if test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes" ; then
3132 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
3133fi
3134
91983da0
FC
3135SQUID_CHECK_SETRESUID_WORKS
3136if test "x$squid_cv_resuid_works" = "xyes" ; then
be0c7ff0 3137 AC_DEFINE(HAVE_SETRESUID,1,[Yay! Another Linux brokenness. Knowing that setresuid() exists is not enough, because RedHat 5.0 declares setresuid() but does not implement it.])
5c51415d 3138fi
60939927 3139
14c0d3ab
DK
3140AC_MSG_CHECKING([for constant CMSG_SPACE])
3141AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3142 #if HAVE_SYS_SOCKET_H
3143 #include <sys/socket.h>
3144 #endif
3145
3146 int a[CMSG_SPACE(int)];
3147]])], [
3148 AC_MSG_RESULT(yes)
3149 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
3150], [
3151 AC_MSG_RESULT(no)
3152])
3153
0abb39dd
FC
3154SQUID_CHECK_FUNC_STRNSTR
3155SQUID_CHECK_FUNC_VACOPY
3156SQUID_CHECK_FUNC___VACOPY
cee08cbc 3157
c3d0c8b5 3158
5cafc1d6 3159dnl IP-Filter support requires ipf header files. These aren't
3160dnl installed by default, so we need to check for them
fcabe077 3161if test "x$enable_ipf_transparent" != "xno" ; then
20ad76ab 3162 AC_MSG_CHECKING(for availability of IP-Filter header files)
42b51993 3163 # hold on to your hats...
fcabe077
FC
3164 if test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
3165 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
3166 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
3167 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes" ; then
42b51993 3168 have_ipfilter_compat_header="yes"
3169 fi
fcabe077
FC
3170 if test "x$have_ipfilter_compat_header" = "xyes" -a \
3171 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
3172 "x$ac_cv_header_ip_nat_h" = "xyes" ; then
1d26e252 3173 enable_ipf_transparent="yes"
fcabe077
FC
3174 elif test "x$have_ipfilter_compat_header" = "xyes" -a \
3175 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
3176 "x$ac_cv_header_netinet_ip_nat_h" = "xyes" ; then
1d26e252 3177 enable_ipf_transparent="yes"
eb824054 3178 else
1d26e252 3179 enable_ipf_transparent="no"
5cafc1d6 3180 fi
3181 AC_MSG_RESULT($IPF_TRANSPARENT)
1d26e252
FC
3182fi
3183AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
0f658b5b 3184SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
1d26e252
FC
3185 [Enable support for IPF-style transparent proxying])
3186
fcabe077 3187if test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris" ; then
8f6ca20d 3188dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3189dnl Solaris minor version (8, 9, 10, ...)
20ad76ab
FC
3190 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3191 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3192 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
5cafc1d6 3193fi
3194
b2192042
AJ
3195dnl PF /dev/pf support requires a header file.
3196if test "x$with_nat_devpf" != "xno" ; then
fcabe077
FC
3197 if test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
3198 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"; then
b2192042
AJ
3199 if test "x$with_nat_devpf" = "xauto" ; then
3200 with_nat_devpf="no"
fcabe077
FC
3201 fi
3202 else
b2192042
AJ
3203 if test "x$with_nat_devpf" = "xyes" ; then
3204 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
fcabe077 3205 fi
b2192042 3206 with_nat_devpf="no"
fcabe077 3207 fi
2b0dd4ac 3208fi
b2192042 3209SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
38ff0a40 3210 [Enable support for PF-style transparent proxying])
b2192042
AJ
3211SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
3212 [Enable support for /dev/pf NAT lookups])
2b0dd4ac 3213
fcabe077
FC
3214if test "x$enable_linux_netfilter" != "xno" ; then
3215 if test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"; then
3216 if test "x$enable_linux_netfilter" = "xauto" ; then
4bd144d2
FC
3217 enable_linux_netfilter=yes
3218 fi
3219 else
fcabe077 3220 if test "x$enable_linux_netfilter" = "xauto" ; then
4bd144d2 3221 enable_linux_netfilter=no
d852fbad 3222 else
4bd144d2 3223 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
d852fbad 3224 fi
4bd144d2 3225 fi
b50f1b2b 3226fi
0f658b5b 3227SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
969d4051 3228 [Enable support for Transparent Proxy on Linux via Netfilter])
20ad76ab 3229
b50f1b2b 3230dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
4bd144d2 3231AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
fcabe077 3232if test "x$enable_linux_netfilter" = "xyes" -a "x$with_libcap" != "xyes" ; then
3b7a7630
AJ
3233 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
3234 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
3235 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
be0c7ff0 3236 # AC_DEFINEd later
96f08e2d
FC
3237fi
3238
11e8cfe3 3239if test "x$squid_opt_netfilterconntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3b7a7630 3240 AC_MSG_ERROR([Linux netfilter conntrack requires libcap support (libcap 2.09+)])
11e8cfe3
AB
3241fi
3242if test "x$with_netfilter_conntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3b7a7630 3243 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
11e8cfe3
AB
3244 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
3245 with_netfilter_conntrack=no
3246fi
3247AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack} ${squid_opt_netfilterconntrackpath}])
3248
3249
3250AC_ARG_ENABLE(zph-qos,
3251 AS_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]), [
3252SQUID_YESNO([$enableval],
3253 [unrecognized argument to --enable-zph-qos: $enableval])
3254])
3255SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
3256 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
3257 TOS field of HIT responses to help policing network traffic])
3258AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
3259if test x"$enable_zph_qos" = "xyes" ; then
3260 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
3261 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
3262 [Enable support for QOS netfilter mark preservation])
3263fi
3264
3265
0f13ff28 3266AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
cc937513 3267AC_ARG_ENABLE(gnuregex,
a5eb3731
FC
3268 AS_HELP_STRING([--enable-gnuregex],
3269 [Compile GNUregex. Unless you have reason to use
cc937513
AJ
3270 this option, you should not enable it.
3271 This library file is usually only required on Windows and
3272 very old Unix boxes which do not have their own regex
0f13ff28
FC
3273 library built in.]), [
3274SQUID_YESNO([$enableval],[unrecognized argument to --enable-gnuregex: $enableval])
3275])
cdb352bb 3276# force-enable on old solaris and nextstep
fcabe077 3277if test "x${enable_gnuregex:=auto}" = "xauto" ; then
91bc414e 3278 case "$host" in
3279 *-sun-solaris2.[[0-4]])
0f13ff28 3280 enable_gnuregex="yes"
91bc414e 3281 ;;
3282 *-next-nextstep*)
0f13ff28 3283 enable_gnuregex="yes"
91bc414e 3284 ;;
3285 esac
3286fi
7a081912 3287
0f13ff28 3288# try detecting if it is needed
fcabe077 3289if test "x$enable_gnuregex" = "xauto" ; then
91983da0
FC
3290 SQUID_CHECK_REGEX_WORKS
3291 if test "x$squid_cv_regex_works" = "xyes" ; then
3292 enable_gnuregex=no
3293 else
3294 enable_gnuregex=yes
3295 fi
f49be7d1 3296fi
91983da0 3297AC_MSG_CHECKING(if GNUregex needs to be compiled)
0f13ff28 3298AC_MSG_RESULT($enable_gnuregex)
fcabe077 3299if test "x$enable_gnuregex" = "xyes"; then
0f13ff28
FC
3300 # for some reason (force-enable, test..) gnuregex was found as needed. Override any system lib
3301 REGEXLIB=""
80ab193b 3302fi
0f13ff28 3303#if no reason was found to enable gnuregex, disable it
fcabe077 3304if test "x$enable_gnuregex" = "xauto" ; then
0f13ff28 3305 enable_gnuregex=no
a4d7e961 3306fi
0f13ff28 3307SQUID_DEFINE_BOOL(USE_GNUREGEX,$enable_gnuregex,[Define if we should use GNU regex])
26675bf4 3308AC_SUBST(REGEXLIB)
a4d7e961 3309
8e0acaf5
FC
3310SQUID_DETECT_UDP_SND_BUFSIZE
3311SQUID_DETECT_UDP_RECV_BUFSIZE
3312SQUID_DETECT_TCP_SND_BUFSIZE
3313SQUID_DETECT_TCP_RECV_BUFSIZE
6bf65235 3314
fa8be5b5 3315SQUID_CHECK_RECV_ARG_TYPE
5c3c56fa
FC
3316SQUID_CHECK_NEED_SYS_ERRLIST
3317SQUID_CHECK_MAXPATHLEN
cc192b50 3318
819656da
AJ
3319SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
3320SQUID_CHECK_RESOLVER_FIELDS
3321
fcabe077 3322if test "x$ac_cv_header_sys_statvfs_h" = "xyes" ; then
bb214e97 3323 SQUID_CHECK_WORKING_STATVFS
c68e9c6b 3324fi
3325
c68e9c6b 3326
461b8219 3327dnl Squid will usually attempt to translate when packaging or building from VCS
461b8219 3328AC_ARG_ENABLE(translation,
62979ab1 3329 AS_HELP_STRING([--disable-translation],[Prevent Squid generating localized error page templates and manuals.
fb46b778
FC
3330 Which is usually tried, but may not be needed.]), [
3331SQUID_YESNO([$enableval],
3332 [unrecognized argument to --disable-translation: $enableval])
461b8219 3333])
e4b70b44 3334dnl Squid now has .po translation capability, given the right toolkit
fcabe077 3335if test "x${enable_translation:=yes}" = "xyes" ; then
461b8219 3336 AX_WITH_PROG([PO2HTML],[po2html])
02259ff8 3337 AX_WITH_PROG([PO2TEXT],[po2txt])
461b8219
AJ
3338else
3339 PO2HTML="off"
02259ff8 3340 PO2TEXT="off"
461b8219
AJ
3341fi
3342AC_SUBST(PO2HTML)
02259ff8 3343AC_SUBST(PO2TEXT)
ee1a8ac2 3344
43000484
AJ
3345dnl Squid now has limited locale handling ...
3346dnl on error pages
3347AC_ARG_ENABLE(auto-locale,
62979ab1 3348 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
21d5413e 3349 clients request headers.
fb46b778
FC
3350 When disabled Squid requires explicit language configuration.]), [
3351SQUID_YESNO([$enableval],
3352 [unrecognized argument to --disable-auto-locale: $enableval])
8db7a54b 3353])
fb46b778
FC
3354AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
3355SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
3356 [Use multi-language support on error pages])
3357
43000484 3358
090089c4 3359dnl Need the debugging version of malloc if available
3360XTRA_OBJS=''
fcabe077 3361if test "x$ac_cv_lib_malloc_main" = "xyes" ; then
090089c4 3362 if test -r /usr/lib/debug/malloc.o ; then
3363 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3364 fi
3365 if test -r /usr/lib/debug/mallocmap.o ; then
3366 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3367 fi
3368fi
3369AC_SUBST(XTRA_OBJS)
3370
fcabe077 3371if test "x$XTRA_LIBS" = "x"; then
38fea766 3372 XTRA_LIBS="$LIBS"
0f5a16f8 3373 dnl minor cleanup
3374 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 3375 LIBS=''
3376fi
090089c4 3377AC_SUBST(XTRA_LIBS)
3378
daed6927
FC
3379AC_SUBST(SQUID_CFLAGS)
3380AC_SUBST(SQUID_CXXFLAGS)
3381
90b412dd
AJ
3382AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
3383AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
3384AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
3385AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
3386AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
3387AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
3388AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
3389AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
daed6927 3390
090089c4 3391dnl Clean up after OSF/1 core dump bug
3392rm -f core
3393
6a9f6389 3394AC_CONFIG_FILES([\
a2794549 3395 Makefile \
eee95dfe 3396 compat/Makefile \
a2794549 3397 lib/Makefile \
7c16470c 3398 lib/ntlmauth/Makefile \
99742866
FC
3399 lib/libTrie/Makefile \
3400 lib/libTrie/test/Makefile \
25f98340 3401 lib/profiler/Makefile \
7c16470c
AJ
3402 lib/rfcnb/Makefile \
3403 lib/smblib/Makefile \
82609577 3404 lib/snmplib/Makefile \
a2794549 3405 scripts/Makefile \
a2794549 3406 src/Makefile \
0c3d3f65 3407 src/anyp/Makefile \
5bd7a218 3408 src/base/Makefile \
bcf44a2c 3409 src/acl/Makefile \
a2794549 3410 src/fs/Makefile \
3411 src/repl/Makefile \
3412 src/auth/Makefile \
616cfc4c
AJ
3413 src/auth/basic/Makefile \
3414 src/auth/digest/Makefile \
3415 src/auth/negotiate/Makefile \
3416 src/auth/ntlm/Makefile \
5fa840c3 3417 src/adaptation/Makefile \
1f3c65fc
AR
3418 src/adaptation/icap/Makefile \
3419 src/adaptation/ecap/Makefile \
04f55905 3420 src/comm/Makefile \
f99c2cfe 3421 src/esi/Makefile \
ee0927b6 3422 src/eui/Makefile \
38e16f92 3423 src/format/Makefile \
c2a7cefd 3424 src/http/Makefile \
663ff9aa 3425 src/icmp/Makefile \
4daaf3cb 3426 src/ident/Makefile \
f963428c 3427 src/ip/Makefile \
82b7abe3 3428 src/log/Makefile \
40daaeb8 3429 src/ipc/Makefile \
95d2589c 3430 src/ssl/Makefile \
8822ebee 3431 src/mgr/Makefile \
d6e3ad20 3432 src/snmp/Makefile \
a2794549 3433 contrib/Makefile \
a2794549 3434 icons/Makefile \
3435 errors/Makefile \
1077c1b8 3436 test-suite/Makefile \
99db07b3 3437 doc/Makefile \
3faa6da8 3438 doc/manuals/Makefile \
0c510f3c 3439 helpers/Makefile \
3440 helpers/basic_auth/Makefile \
5a48ed18 3441 helpers/basic_auth/DB/Makefile \
c152a447 3442 helpers/basic_auth/fake/Makefile \
5a48ed18 3443 helpers/basic_auth/getpwnam/Makefile \
0c510f3c 3444 helpers/basic_auth/LDAP/Makefile \
3445 helpers/basic_auth/MSNT/Makefile \
5a48ed18 3446 helpers/basic_auth/MSNT-multi-domain/Makefile \
0c510f3c 3447 helpers/basic_auth/NCSA/Makefile \
5a48ed18 3448 helpers/basic_auth/NIS/Makefile \
0c510f3c 3449 helpers/basic_auth/PAM/Makefile \
bcf74be7 3450 helpers/basic_auth/POP3/Makefile \
5a48ed18
AJ
3451 helpers/basic_auth/RADIUS/Makefile \
3452 helpers/basic_auth/SASL/Makefile \
3453 helpers/basic_auth/SMB/Makefile \
3454 helpers/basic_auth/SSPI/Makefile \
0c510f3c 3455 helpers/digest_auth/Makefile \
89f77e43 3456 helpers/digest_auth/eDirectory/Makefile \
54e8823b 3457 helpers/digest_auth/file/Makefile \
56ff4687 3458 helpers/digest_auth/LDAP/Makefile \
0c510f3c 3459 helpers/ntlm_auth/Makefile \
75aa769b 3460 helpers/ntlm_auth/fake/Makefile \
3963d7b1 3461 helpers/ntlm_auth/smb_lm/Makefile \
bc25525a 3462 helpers/ntlm_auth/SSPI/Makefile \
6e785d85 3463 helpers/negotiate_auth/Makefile \
45b2de83 3464 helpers/negotiate_auth/kerberos/Makefile \
8eeb87e6 3465 helpers/negotiate_auth/SSPI/Makefile \
eb3dea38 3466 helpers/negotiate_auth/wrapper/Makefile \
c6588c68 3467 helpers/external_acl/Makefile \
c152a447 3468 helpers/external_acl/AD_group/Makefile \
b283ea3f 3469 helpers/external_acl/eDirectory_userip/Makefile \
c152a447 3470 helpers/external_acl/file_userip/Makefile \
b1218840 3471 helpers/external_acl/kerberos_ldap_group/Makefile \
c152a447
AJ
3472 helpers/external_acl/LDAP_group/Makefile \
3473 helpers/external_acl/LM_group/Makefile \
74ab8d10 3474 helpers/external_acl/session/Makefile \
0f0a89ab 3475 helpers/external_acl/SQL_session/Makefile \
c6588c68 3476 helpers/external_acl/unix_group/Makefile \
736a9a4d 3477 helpers/external_acl/wbinfo_group/Makefile \
9938b57f 3478 helpers/external_acl/time_quota/Makefile \
82b7abe3 3479 helpers/log_daemon/Makefile \
7ce3900c 3480 helpers/log_daemon/DB/Makefile \
82b7abe3 3481 helpers/log_daemon/file/Makefile \
fdbb3b19
AJ
3482 helpers/url_rewrite/Makefile \
3483 helpers/url_rewrite/fake/Makefile \
2cef0ca6 3484 helpers/ssl/Makefile \
0d5ee502
AM
3485 helpers/storeid_rewrite/Makefile \
3486 helpers/storeid_rewrite/file/Makefile \
94ab55b0 3487 tools/Makefile
2ccf2eb2 3488 tools/purge/Makefile
53cbe3e4 3489])
43ae1d95 3490
3e7b6055 3491# must configure libltdl subdir unconditionally for "make distcheck" to work
081863f3 3492#AC_CONFIG_SUBDIRS(libltdl)
3e7b6055 3493
6a9f6389 3494AC_OUTPUT