]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.ac
Append "Connection: close" to OPTIONS requests when icap_persistent_connections
[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"
96598f93
AJ
58# if test "x$squid_cv_check_marchnative" = "xyes"; then
59# CXXFLAGS="$CXXFLAGS -march=native"
60# fi
de051d9d 61fi
96598f93
AJ
62#if test "x$squid_cv_check_marchnative" = "xyes"; then
63# # always valid for the Host compiler.
64# HOSTCXX="$HOSTCXX -march=native"
65#fi
de051d9d
BJ
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
9bb01611 836 STORE_TESTS="$STORE_TESTS tests/testRock$EXEEXT"
e2851fe7 837 ;;
d3b3ab85 838 ufs)
507ca601 839 STORE_TESTS="$STORE_TESTS tests/testUfs$EXEEXT"
8154dd82 840 esac
a2794549 841done
d3b3ab85 842
9d6186b1
FC
843dnl hack: need to define those even if not used in the build system to
844dnl make sure that global FS objects are linked to the squid binary.
7b5b7ba8
CT
845AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
846AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
847AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
e2851fe7 848AH_TEMPLATE(HAVE_FS_ROCK, "Define to 1 if rock filesystem module is build")
7b5b7ba8
CT
849
850
dc299f29 851dnl got final squid_storeio_module_candidates, build library lists
b66455ff
AR
852dnl This list will not be needed when each fs library has its own Makefile
853STORE_LIBS_TO_BUILD=
854dnl File system libraries to link executables with.
855dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
856STORE_LIBS_TO_ADD=
dc299f29 857for fs in $squid_storeio_module_candidates; do
7b5b7ba8
CT
858 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
859 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
6d1c1ab1
FC
860 SQUID_TOUPPER_VAR_CONTENTS([fs])
861 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
b66455ff
AR
862done
863
864AC_SUBST(STORE_LIBS_TO_BUILD)
865AC_SUBST(STORE_LIBS_TO_ADD)
082a5e7a 866AC_SUBST(STORE_TESTS)
a2794549 867
24a04df9
AJ
868
869dnl At lest one removal policy is always needed.
870dnl 'lru' removal policy is currently hard-coded by name for tests
871dnl so we must set it as default.
872REPL_POLICIES="lru"
d9180414 873AC_ARG_ENABLE(removal-policies,
56ffc413
FC
874 AS_HELP_STRING([--enable-removal-policies="list of policies"],
875 [Build support for the list of removal policies.
18cc92fb
FC
876 The default is only to build the "lru" module.
877 See src/repl for a list of available modules, or
878 Programmers Guide section 9.9 for details on how
507ca601
FC
879 to build your custom policy]), [
880case $enableval in
6a566b9c 881 yes)
5069fb38 882 SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES])
507ca601 883 ;;
6a566b9c 884 no)
507ca601 885 ;;
1c690e30 886 *)
507ca601
FC
887 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
888 ;;
6a566b9c 889 esac
6a566b9c 890])
fcabe077 891if test "x$REPL_POLICIES" != "x" ; then
56ffc413 892 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
5069fb38 893 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
1c690e30 894 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
895 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
896fi
6a566b9c 897AC_SUBST(REPL_POLICIES)
6a566b9c 898AC_SUBST(REPL_OBJS)
f71946fc 899AC_SUBST(REPL_LIBS)
6a566b9c 900
d1da2d1f 901AM_CONDITIONAL(ENABLE_PINGER, false)
e5f4e1b0 902AC_ARG_ENABLE(icmp,
62979ab1 903 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),
fcabe077 904[ if test "x$enableval" = "xyes" ; then
eed82608 905 AC_MSG_NOTICE([ICMP enabled])
be0c7ff0 906 AC_DEFINE(USE_ICMP,1,[Define to use Squid ICMP and Network Measurement features (highly recommended!)])
d1da2d1f 907 AM_CONDITIONAL(ENABLE_PINGER, true)
e5f4e1b0 908 fi
909])
910
9a0a18de 911AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
d9180414 912AC_ARG_ENABLE(delay-pools,
62979ab1 913 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),
fcabe077 914[ if test "x$enableval" = "xyes" ; then
eed82608 915 AC_MSG_NOTICE([Delay pools enabled])
9a0a18de 916 AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
ffe4ffd8 917 AM_CONDITIONAL(ENABLE_DELAY_POOLS, true)
e5f4e1b0 918 fi
919])
920
5fa840c3 921dnl disable generic/common adaptation support by default
5069fb38 922squid_opt_use_adaptation=no
5fa840c3 923
5069fb38 924squid_opt_use_esi=yes
7eb77a5f
FC
925AH_TEMPLATE([USE_SQUID_ESI],
926 [Define to enable the ESI processor and Surrogate header support])
43ae1d95 927AC_ARG_ENABLE(esi,
7eb77a5f 928 AS_HELP_STRING([--enable-esi],
5069fb38 929 [Enable ESI for accelerators. Benefits from expat or libxml2.
7eb77a5f 930 Enabling ESI will cause squid reverse proxies to be capable
5069fb38 931 of the Edge Acceleration Specification (www.esi.org).]),
507ca601 932 [squid_opt_use_esi=$enableval], [squid_opt_use_esi=no])
88bfe098
AJ
933HAVE_LIBEXPAT=0
934EXPATLIB=
935HAVE_LIBXML2=0
936XMLLIB=
fcabe077 937if test "x$squid_opt_use_esi" = "xyes" ; then
3473acb1 938 AC_MSG_NOTICE([Enabling ESI processor and Surrogate header support.])
7eb77a5f 939 AC_DEFINE(USE_SQUID_ESI,1,
507ca601 940 [Compile the ESI processor and Surrogate header support])
7eb77a5f 941else
8075a4da 942 AC_MSG_NOTICE([Disabling ESI processor])
7eb77a5f 943fi
88bfe098 944
7eb77a5f
FC
945# ESI support libraries: expat
946AC_ARG_WITH(expat, AS_HELP_STRING([--without-expat],[Do not use expat for ESI. Default: auto-detect]))
fcabe077 947if test "x$squid_opt_use_esi" = "xyes" -a "x$with_expat" != "xno" ; then
7eb77a5f
FC
948 AC_CHECK_LIB([expat], [main], [EXPATLIB="-lexpat"; HAVE_LIBEXPAT=1])
949 AC_CHECK_HEADERS([expat.h])
950 AC_DEFINE_UNQUOTED(HAVE_LIBEXPAT, $HAVE_LIBEXPAT, [Define to 1 if you have the expat library])
fcabe077 951 if test "x$with_expat" = "xyes" -a "x$HAVE_LIBEXPAT" != "x1" ; then
7eb77a5f 952 AC_MSG_ERROR([Required library expat is not able to be found.])
23df48fd 953 fi
7eb77a5f 954fi
ad32c661 955
7eb77a5f 956AC_ARG_WITH(libxml2, AS_HELP_STRING([--without-libxml2],[Do not use libxml2 for ESI. Default: auto-detect]))
fcabe077 957if test "x$squid_opt_use_esi" = "xyes" -a "x$with_libxml2" != "xno" ; then
7eb77a5f
FC
958 AC_CHECK_LIB([xml2], [main], [XMLLIB="-lxml2"; HAVE_LIBXML2=1])
959 dnl Find the main header and include path...
0dc1a86a
HN
960 AC_CACHE_CHECK([location of libxml2 include files], [ac_cv_libxml2_include], [
961 AC_CHECK_HEADERS([libxml/parser.h], [], [
94ea9adc 962 AC_MSG_NOTICE([Testing in /usr/include/libxml2])
7eb77a5f
FC
963 SAVED_CPPFLAGS="$CPPFLAGS"
964 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
965 unset ac_cv_header_libxml_parser_h
0dc1a86a
HN
966 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/include/libxml2"], [
967 AC_MSG_NOTICE([Testing in /usr/local/include/libxml2])
968 CPPFLAGS="-I/usr/local/include/libxml2 $SAVED_CPPFLAGS"
969 unset ac_cv_header_libxml_parser_h
970 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/local/include/libxml2"], [
67840a07 971 AC_MSG_NOTICE([Failed to find libxml2 header file libxml/parser.h])
0dc1a86a 972 ])
7eb77a5f 973 ])
0dc1a86a
HN
974 CPPFLAGS="$SAVED_CPPFLAGS"
975 ])
976 ])
977 if test "x$ac_cv_libxml2_include" != "x"; then
978 SQUID_CXXFLAGS="$ac_cv_libxml2_include $SQUID_CXXFLAGS"
979 CPPFLAGS="$ac_cv_libxml2_include $CPPFLAGS"
7eb77a5f 980 fi
0dc1a86a
HN
981 dnl Now that we know where to look find the headers...
982 AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
7eb77a5f 983 AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
fcabe077 984 if test "x$with_libxml2" = "xyes" -a "$HAVE_LIBXML2" != "1" ; then
7eb77a5f
FC
985 AC_MSG_ERROR([Required library libxml2 is not able to be found.])
986 fi
43ae1d95 987fi
7eb77a5f 988
fcabe077
FC
989AM_CONDITIONAL(USE_ESI, test "x$squid_opt_use_esi" = "xyes")
990AM_CONDITIONAL(HAVE_LIBEXPAT, test "$HAVE_LIBEXPAT" = 1)
88bfe098 991AC_SUBST(EXPATLIB)
fcabe077 992AM_CONDITIONAL(HAVE_LIBXML2, test "$HAVE_LIBXML2" = 1)
88bfe098 993AC_SUBST(XMLLIB)
43ae1d95 994
8075a4da 995# icap argument handling
51952383 996AC_ARG_ENABLE(icap-client,
62979ab1 997 AS_HELP_STRING([--enable-icap-client],[Enable the ICAP client.]),
507ca601
FC
998 [squid_opt_use_icap_client=$enableval],
999 [squid_opt_use_icap_client=no])
0f658b5b 1000SQUID_DEFINE_BOOL(ICAP_CLIENT,$squid_opt_use_icap_client,
8075a4da 1001 [Enable ICAP client features in Squid])
fcabe077
FC
1002AM_CONDITIONAL(USE_ICAP_CLIENT, [test "x$squid_opt_use_icap_client" = "xyes" ])
1003if test "x$squid_opt_use_icap_client" = "xyes" ; then
1f3c65fc 1004 ICAP_LIBS="icap/libicap.la"
5069fb38 1005 squid_opt_use_adaptation=yes
51952383 1006else
c21ad0f5 1007 ICAP_LIBS=""
51952383 1008fi
c21ad0f5 1009AC_SUBST(ICAP_LIBS)
51952383 1010
5069fb38 1011squid_opt_use_ecap=1
3e7b6055
AR
1012AC_MSG_CHECKING(whether to support eCAP)
1013AC_ARG_ENABLE(ecap,
8075a4da
FC
1014 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]), [
1015 case "${enableval}" in
1016 yes|no) squid_opt_use_ecap=$enableval ;;
1017 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
1018 esac
1019AC_MSG_RESULT([$squid_opt_use_ecap, explicitly])
1020 ], [
5069fb38
FC
1021 squid_opt_use_ecap=no;
1022 AC_MSG_RESULT([$squid_opt_use_ecap, implicitly])
3e7b6055
AR
1023 ]
1024)
1025
80ab04bb
AR
1026dnl Necessary if the first PKG_CHECK_MODULES call is conditional
1027PKG_PROG_PKG_CONFIG
1028
3e7b6055 1029dnl Perform configuration consistency checks for eCAP
cbc14831 1030if test "x$squid_opt_use_ecap" != "xno";
3e7b6055 1031then
cbc14831
AJ
1032 dnl eCAP support requires loadable modules, which are enabled by default
1033 if test "x$enable_loadable_modules" != "xyes"
1034 then
1035 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.])
1036 fi
4cfba571 1037
cbc14831 1038 if test -n "$PKG_CONFIG"; then
6666da11
AR
1039 dnl eCAP support requires libecap.
1040 dnl This Squid supports libecap v0.2.x.
3e115aaf
AR
1041 dnl Use EXT_ prefix to distinguish external libecap (that we check for
1042 dnl here) from our own convenience ecap library in Makefiles.
cbc14831
AJ
1043 PKG_CHECK_MODULES([EXT_LIBECAP],[libecap >= 0.2.0 libecap < 0.3])
1044 else
1045 AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
1046 fi
3e7b6055
AR
1047fi
1048
fcabe077
FC
1049AM_CONDITIONAL(USE_ECAP, test "x$squid_opt_use_ecap" = "xyes")
1050if test "x$squid_opt_use_ecap" = "xyes";
3e7b6055
AR
1051then
1052 AC_DEFINE(USE_ECAP,1,[Enable eCAP support])
3e115aaf 1053 ECAP_LIBS="ecap/libsquid-ecap.la"
5069fb38 1054 squid_opt_use_adaptation=yes
3e7b6055 1055else
5fa840c3 1056 AC_DEFINE(USE_ECAP,0,[Disable eCAP support])
3e7b6055
AR
1057 ECAP_LIBS=""
1058fi
b61a58df 1059dnl convenience library
3e7b6055
AR
1060AC_SUBST(ECAP_LIBS)
1061
3e7b6055 1062
5fa840c3 1063dnl enable adaptation if requested by specific adaptation mechanisms
fcabe077
FC
1064AM_CONDITIONAL(USE_ADAPTATION, test "x$squid_opt_use_adaptation" = "xyes")
1065if test "x$squid_opt_use_adaptation" = "xyes"
5fa840c3
AR
1066then
1067 AC_DEFINE(USE_ADAPTATION,1,[common adaptation support])
1068 ADAPTATION_LIBS="adaptation/libadaptation.la"
51952383 1069else
5fa840c3
AR
1070 AC_DEFINE(USE_ADAPTATION,0,[common adaptation support])
1071 ADAPTATION_LIBS=""
51952383 1072fi
5fa840c3 1073AC_SUBST(ADAPTATION_LIBS)
3e7b6055
AR
1074
1075
0961c811 1076dnl This is a developer only option. Developers know how to set defines
1077dnl
1078dnl AC_ARG_ENABLE(mem-gen-trace,
1079dnl [ --enable-mem-gen-trace Do trace of memory stuff],
1080dnl [ if test "$enableval" = "yes" ; then
eed82608 1081dnl AC_MSG_NOTICE([Memory trace (to file) enabled])
6a9f6389 1082dnl AC_DEFINE(MEM_GEN_TRACE,1,[Define for log file trace of mem alloc/free])
5069fb38
FC
1083dnl fi
1084dnl ])
1085
36a97e19 1086
1d3aafe4 1087test "x$squid_host_os" = "xmingw" && enable_wccp=no
5069fb38 1088AC_ARG_ENABLE(wccp,
8075a4da 1089 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]), [
1a6b111a 1090SQUID_YESNO([$enableval],[unrecognized argument to --disable-wccp: $enableval])
5069fb38 1091])
0067eb06 1092SQUID_DEFINE_BOOL(USE_WCCP, ${enable_wccp:=yes}, [Define to enable WCCP])
1a6b111a 1093AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $enable_wccp])
0b0cfcf2 1094
1d3aafe4 1095test "x$squid_host_os" = "xmingw" && enable_wccpv2=no
0b0cfcf2 1096AC_ARG_ENABLE(wccpv2,
1a6b111a
FC
1097 AS_HELP_STRING([--disable-wccpv2],
1098 [Disable Web Cache Coordination V2 Protocol]), [
1099SQUID_YESNO([$enableval],
1100 [unrecognized argument to --disable-wccpv2: $enableval])
0b0cfcf2 1101])
0067eb06 1102SQUID_DEFINE_BOOL(USE_WCCPv2,${enable_wccpv2:=yes},
1a6b111a
FC
1103 [Define to enable WCCP V2])
1104AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $enable_wccpv2])
320e9f36 1105
d9180414 1106AC_ARG_ENABLE(kill-parent-hack,
8075a4da 1107 AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]), [
1a6b111a
FC
1108SQUID_YESNO([$enableval],
1109 [unrecognized argument to --enable-kill-parent-hack: $enableval])
e5f4e1b0 1110])
0067eb06 1111SQUID_DEFINE_BOOL(KILL_PARENT_OPT,${enable_kill_parent_hack:=no},
1a6b111a
FC
1112 [A dangerous feature which causes Squid to kill its parent
1113 process (presumably the RunCache script) upon receipt
1114 of SIGTERM or SIGINT. Deprecated, Use with caution.])
1115AC_MSG_NOTICE([Kill parent on shutdown hack enabled: $enable_kill_parent_hack])
20ad76ab 1116
e5f4e1b0 1117AC_ARG_ENABLE(snmp,
1d87b6b3 1118 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
1a6b111a
FC
1119 SQUID_YESNO([$enableval],
1120 [unrecognized argument to --disable-snmp: $enableval])
87630341 1121])
0067eb06 1122SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes},
1a6b111a 1123 [Define to enable SNMP monitoring of Squid])
f738d783 1124AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
fcabe077 1125if test "x$enable_snmp" = "xyes"; then
d6e3ad20 1126 SNMPLIB='../snmplib/libsnmplib.a'
e5f4e1b0 1127 makesnmplib=snmplib
87630341 1128fi
1a6b111a 1129AC_MSG_NOTICE([SNMP support enabled: $enable_snmp])
e5f4e1b0 1130AC_SUBST(SNMPLIB)
e5f4e1b0 1131AC_SUBST(makesnmplib)
1132
d9180414 1133AC_ARG_ENABLE(cachemgr-hostname,
5069fb38
FC
1134 AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
1135 [Make cachemgr.cgi default to this host.
1d87b6b3
FC
1136 If unspecified, uses the name of the build-host]), [
1137 case $enableval in
1138 yes)
1139 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1140 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
1141 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
1142 ;;
1143 no)
1144 : # Nothing to do..
1145 ;;
1146 *)
1147 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
1148 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
1149 ;;
1150 esac
e5f4e1b0 1151])
1152
ee0927b6 1153AC_ARG_ENABLE(eui,
1a6b111a 1154 AS_HELP_STRING([--disable-eui],
c8da66ba 1155 [Disable use of ARP / MAC/ EUI (ether address)]), [
1a6b111a
FC
1156SQUID_YESNO([$enableval],[--disable-eui expects no arguments])
1157])
fcabe077 1158if test "x${enable_eui:=yes}" = "xyes" ; then
507ca601
FC
1159 case "$squid_host_os" in
1160 linux|solaris|freebsd|openbsd|netbsd)
1161 ${TRUE}
1162 ;;
1163 cygwin|mingw)
1164 EUILIB="-liphlpapi"
1165 ;;
1166 *)
1167 AC_MSG_WARN([EUI support probably will not work on host $host.])
1168 ;;
1169 esac
0a675778 1170 #Iphlpapi.h check delayed after winsock2.h
507ca601 1171 AC_CHECK_HEADERS( \
32341684 1172 windows.h \
507ca601 1173 sys/sockio.h \
32341684
AJ
1174 sys/param.h,
1175 [], [], [[
1176#if HAVE_WINDOWS_H
1177include <windows.h>
54d47324 1178#endif
32341684 1179]]
507ca601 1180 )
29759678
FC
1181 AC_CHECK_HEADERS( \
1182 net/if_arp.h \
1183 net/route.h,
1184 [], [], [[
1185#include <sys/types.h>
1186#include <sys/socket.h>
1187]])
1188
43c1320a
AJ
1189 # OpenBSD, FreeBSD and NetBSD requires sys/param.h to be included before sysctl.h and net/if_dl.h
1190 AC_CHECK_HEADERS( \
1191 net/if_dl.h \
1192 sys/sysctl.h,
1193 [], [], [[
54d47324 1194#if HAVE_SYS_PARAM_H
29759678
FC
1195#include <sys/param.h>
1196#endif
1197 ]])
a98c2da5 1198fi
2ef664d8 1199AC_SUBST(EUILIB)
1a6b111a 1200AC_MSG_NOTICE([EUI (MAC address) controls enabled: $enable_eui])
0067eb06 1201SQUID_DEFINE_BOOL(USE_SQUID_EUI,$enable_eui,
1a6b111a 1202 [Define this to include code which lets you use ethernet addresses. This code uses API initially defined in 4.4-BSD.])
fcabe077 1203AM_CONDITIONAL(USE_SQUID_EUI, [test "x$enable_eui" = "xyes" ])
1a6b111a 1204
e5f4e1b0 1205
74075210 1206AC_ARG_ENABLE(htcp,
47d80734 1207 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]), [
1a6b111a
FC
1208SQUID_YESNO([$enableval],
1209 [unrecognized argument to --disable-htcp: $enableval])
74075210 1210])
0f658b5b 1211SQUID_DEFINE_BOOL(USE_HTCP,${enable_htcp:=yes},
47d80734 1212 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
fcabe077 1213AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
1a6b111a
FC
1214AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
1215
a2794549 1216
f88ca0d1
FC
1217# SSL is not enabled by default.
1218# Default is to use OpenSSL when available
1f7c9178 1219AC_ARG_ENABLE(ssl,
a9dfcab8
FC
1220 AS_HELP_STRING([--enable-ssl],
1221 [Enable ssl gatewaying support using OpenSSL]), [
1222SQUID_YESNO([$enableval],
1223 [unrecognized argument to --enable-ssl: $enableval])
1224])
f88ca0d1
FC
1225# USE_OPENSSL is AC_DEFINED later
1226# default for ssl is set here
fcabe077 1227if test "x${enable_ssl:=no}" = "xyes" ; then
507ca601
FC
1228 if test "x$squid_host_os" = "xmingw" ; then
1229 SSLLIB='-lssleay32 -leay32 -lgdi32'
1230 else
1231 SSLLIB='-lssl -lcrypto'
1232 fi
1233 if test "x$with_openssl" = "x"; then
1234 with_openssl=yes
1235 fi
1236 if test "x$with_openssl" = "x"; then
1237 with_openssl=yes
1238 fi
a9dfcab8 1239fi
fcabe077 1240AM_CONDITIONAL(ENABLE_SSL,[ test "x$enable_ssl" = "xyes" ])
a9dfcab8
FC
1241AC_MSG_NOTICE([SSL gatewaying support enabled: $enable_ssl])
1242
3d4022fa 1243dnl User may specify OpenSSL is needed from a non-standard location
1f7c9178 1244AC_ARG_WITH(openssl,
f88ca0d1
FC
1245 AS_HELP_STRING([--with-openssl=PATH],
1246 [Compile with the OpenSSL libraries. The path to
86f53af2
FC
1247 the OpenSSL development libraries and headers
1248 installation can be specified if outside of the
f88ca0d1
FC
1249 system standard directories]), [
1250case "$with_openssl" in
a3b28798
HN
1251 yes|no)
1252 : # Nothing special to do here
1f7c9178 1253 ;;
1254 *)
fcabe077 1255 if test ! -d "$withval" ; then
f88ca0d1
FC
1256 AC_MSG_ERROR([--with-openssl path does not point to a directory])
1257 fi
46ce628c 1258 SSLLIBDIR="$with_openssl/lib"
bcce53ce 1259 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
a3b28798 1260 with_openssl=yes
1f7c9178 1261 esac
1262])
0067eb06 1263SQUID_DEFINE_BOOL(USE_SSL,$enable_ssl,
f88ca0d1 1264 [Define this to include code for SSL gatewaying support])
a024f63d 1265AC_MSG_NOTICE([Using OpenSSL MD5 implementation: ${with_openssl:=no}])
0067eb06 1266SQUID_DEFINE_BOOL(USE_OPENSSL,${with_openssl},
f88ca0d1 1267 [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
1268if test "x$enable_ssl" = "xyes"; then
1269 if test "x$SSLLIB" = "x"; then
1f7c9178 1270 SSLLIB="-lcrypto" # for MD5 routines
1271 fi
f88ca0d1 1272 # This is a workaround for RedHat 9 brain damage..
fcabe077 1273 if test -d /usr/kerberos/include -a "x$SSLLIBDIR" = "x" -a -f /usr/include/openssl/kssl.h; then
eed82608 1274 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
f11555e0 1275 SSLLIBDIR="/usr/kerberos/lib"
1276 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1277 fi
1f7c9178 1278fi
fcabe077 1279if test "x$SSLLIBDIR" != "x" ; then
1f7c9178 1280 SSLLIB="-L$SSLLIBDIR $SSLLIB"
1281fi
1f7c9178 1282AC_SUBST(SSLLIB)
1283
fc321c30
CT
1284if test "x$with_openssl" = "xyes"; then
1285SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS
19179f7c 1286SQUID_CHECK_OPENSSL_CONST_SSL_METHOD
fee5325b 1287SQUID_CHECK_OPENSSL_TXTDB
fc321c30 1288fi
3d4022fa 1289
02749868 1290AC_ARG_ENABLE(forw-via-db,
47d80734
FC
1291 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
1292 SQUID_YESNO([$enableval],[unrecognized argument to --enable-forw-via-db: $enableval])
02749868 1293])
21f6708d 1294SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
9676633b
FC
1295 [Enable Forw/Via database])
1296AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
02749868 1297
6cfa8966 1298AC_ARG_ENABLE(cache-digests,
47d80734 1299 AS_HELP_STRING([--enable-cache-digests],
9676633b
FC
1300 [Use Cache Digests. See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
1301[
1302 SQUID_YESNO($enableval,
1303 [unrecognized argument to --enable-cache-digests: $enableval])
484f2ebc 1304])
0067eb06 1305SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
47d80734 1306 [Use Cache Digests for locating objects in neighbor caches.])
9676633b 1307AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
47d80734 1308
484f2ebc 1309
9676633b
FC
1310################################
1311# check for netio plugin stuff #
1312################################
1313dnl order of these options handling is relevant in case the user
1314dnl supplies more than one --enable option. Options handled later
1315dnl override those handled earlier for io loop method manual override
1316AC_ARG_ENABLE(select,
1317 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),
1318[
1319SQUID_YESNO($enableval,[--disable-select takes no extra argument])
39145d19
AJ
1320if test "x$enableval" = "xyes"; then
1321 if test "x$squid_host_os" = "xmingw"; then
1322 squid_opt_io_loop_engine="select_win32"
1323 else
1324 squid_opt_io_loop_engine="select"
1325 fi
1326fi
9676633b
FC
1327])
1328AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
cd748f27 1329
9bb83c8b 1330AC_ARG_ENABLE(poll,
62979ab1 1331 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
1b3db6d9 1332[
9676633b 1333SQUID_YESNO($enableval,[--disable-poll takes no extra argument])
fcabe077 1334test "x$enableval" = "xyes" && squid_opt_io_loop_engine="poll"
9bb83c8b 1335])
9676633b 1336AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
9bb83c8b 1337
1b3db6d9 1338AC_ARG_ENABLE(kqueue,
26d50fd2
AJ
1339 AS_HELP_STRING([--disable-kqueue],
1340 [Disable kqueue(2) support.]), [
9676633b 1341SQUID_YESNO($enableval,[--enable-kqueue takes no extra argument])
1b3db6d9 1342])
26d50fd2
AJ
1343if test "x${enable_kqueue:=auto}" != "xno" ; then
1344 AC_CHECK_HEADERS([sys/event.h],[],[
1345 if test "x${enable_kqueue}" = "xyes" ; then
1346 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
1347 fi
1348 ])
1349 AC_CHECK_FUNCS(kqueue,[],[
1350 if test "x${enable_kqueue}" = "xyes" ; then
1351 AC_MSG_ERROR([kqueue support missing in libc library.])
1352 fi
1353 ])
1354 if test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes" ; then
1355 squid_opt_io_loop_engine="kqueue"
1356 else
1357 enable_kqueue="no"
1358 fi
9676633b 1359fi
26d50fd2 1360AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
1b3db6d9 1361
a46d2c0e 1362dnl Enable epoll()
a46d2c0e 1363AC_ARG_ENABLE(epoll,
62979ab1 1364 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
a46d2c0e 1365[
9676633b 1366SQUID_YESNO($enableval,[--disable-epoll takes no extra argument])
fcabe077 1367test "x$enableval" = "xyes" && squid_opt_io_loop_engine="epoll"
a46d2c0e 1368])
9676633b 1369AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
2ca8b332 1370
9676633b
FC
1371# auto-detect and verify epoll header and library present and working
1372# logic mapping and loop method selection are performed later
fcabe077 1373if test "x$enable_epoll" != "xno" ; then
2ca8b332 1374
9676633b
FC
1375 # check if libs are needed to support epoll
1376 # note: this code block seems quite generic. Could it be extracted
1377 # into a squid specific configure function?
af1e01a8 1378 SQUID_STATE_SAVE(squid_epoll_state)
9676633b 1379 AC_SEARCH_LIBS(epoll_ctl,[epoll])
fcabe077 1380 if test "x$ac_cv_search_epoll_ctl" = "xno" ; then
9676633b 1381 enable_epoll=no #disable. Needed code not found
fcabe077 1382 elif test "x$ac_cv_search_epoll_ctl" = "xnone required" ; then
9676633b
FC
1383 EPOLL_LIBS=""
1384 else
1385 EPOLL_LIBS=$ac_cv_search_epoll_ctl
1386 fi
1387 AC_SUBST(EPOLL_LIBS)
1388 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
a46d2c0e 1389
9676633b 1390 # epoll requires sys/epoll.h
98d13964 1391 AC_CHECK_HEADERS([sys/epoll.h])
ad32c661
AJ
1392
1393 dnl Verify that epoll really works
dcac6885 1394 if test "x$ac_cv_search_epoll_ctl" != 'xno' ; then
af1e01a8 1395 SQUID_CHECK_EPOLL
ad32c661 1396 fi
2ca8b332 1397
fcabe077 1398 if test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno" ; then
2ca8b332
AJ
1399 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
1400 fi
ad32c661 1401fi
a46d2c0e 1402
a1ad2f9b
AJ
1403dnl Enable /dev/poll
1404AC_ARG_ENABLE(devpoll,
1405 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),
1406[
1407SQUID_YESNO($enableval,[--disable-devpoll takes no extra argument])
1408test "x$enableval" = "xyes" && squid_opt_io_loop_engine="devpoll"
1409])
1410AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
1411
1412## auto-detect and verify devpoll header and library present and working
1413if test "x$enable_devpoll" != "xno"; then
1414
1415 # /dev/poll requires ioctl() and write()
1416 AC_CHECK_FUNCS(ioctl)
1417 AC_CHECK_FUNCS(write)
1418
1419 # /dev/poll requires sys/devpoll.h
1420 AC_CHECK_HEADERS([sys/devpoll.h],,[
1421 if test "x$enable_devpoll" = "xyes"; then
1422 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
1423 fi
1424 enable_devpoll=no])
1425
1426 # Verify that /dev/poll really works
1427 if test "x$enable_devpoll" != 'xno' ; then
1428 SQUID_CHECK_DEVPOLL
1429 fi
1430
1431 if test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno" ; then
1432 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
1433 fi
1434fi
1435
9676633b 1436
72fd085a 1437AC_ARG_ENABLE(http-violations,
af1e01a8
FC
1438 AS_HELP_STRING([--disable-http-violations],
1439 [This allows you to remove code which is known to
47d80734 1440 violate the HTTP protocol specification.]), [
9676633b
FC
1441 SQUID_YESNO([$enableval],
1442 [unrecognized argument to --disable-http-violations: $enableval])
72fd085a 1443])
626096be 1444SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
47d80734 1445 [Define to enable code which volates the HTTP standard specification])
9676633b 1446AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
72fd085a 1447
47d80734 1448# IPFW Transparent Proxy
68075fad 1449AC_ARG_ENABLE(ipfw-transparent,
1d26e252
FC
1450 AS_HELP_STRING([--enable-ipfw-transparent],
1451 [Enable Transparent Proxy support for systems
47d80734 1452 using FreeBSD IPFW-style firewalling.]), [
1d26e252
FC
1453 SQUID_YESNO([$enableval],
1454 [unrecognized argument to --enable-ipfw-transparent: $enableval])
68075fad 1455])
0067eb06 1456SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
2277004e 1457 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
1d26e252 1458AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
68075fad 1459
47d80734 1460# IP-Filter Transparent Proxy
5cafc1d6 1461AC_ARG_ENABLE(ipf-transparent,
2277004e 1462 AS_HELP_STRING([--enable-ipf-transparent],
1d26e252
FC
1463 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
1464 SQUID_YESNO([$enableval],
1465 [unrecognized argument to --enable-ipf-transparent: $enableval])
5cafc1d6 1466])
be0c7ff0 1467#will be AC_DEFINEd later, after checking for appropriate infrastructure
4bd144d2
FC
1468#IPF currently broken. Default-disabled for now.
1469AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
5cafc1d6 1470
2b0dd4ac 1471dnl Enable PF Transparent Proxy
1472AC_ARG_ENABLE(pf-transparent,
2277004e 1473 AS_HELP_STRING([--enable-pf-transparent],
47d80734 1474 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
1d26e252
FC
1475 SQUID_YESNO([$enableval],
1476 [unrecognized argument to --enable-pf-transparent: $enableval])
2b0dd4ac 1477])
be0c7ff0 1478#will be AC_DEFINEd later, after checking for appropriate infrastructure
b2192042
AJ
1479AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
1480
1481dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
1482AC_ARG_WITH(nat-devpf,
1483 AS_HELP_STRING([--with-nat-devpf],
1484 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
1485 SQUID_YESNO([$enableval],
1486 [unrecognized argument to --with-nat-devpf: $enableval])
1487])
1488#will be AC_DEFINEd later, after checking for appropriate infrastructure
1489AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
2b0dd4ac 1490
4bd144d2 1491# Linux Netfilter Transparent Proxy
d852fbad 1492AC_ARG_ENABLE(linux-netfilter,
20ad76ab 1493 AS_HELP_STRING([--enable-linux-netfilter],
96f08e2d 1494 [Enable Transparent Proxy support for Linux (Netfilter)]), [
4bd144d2
FC
1495 SQUID_YESNO([$enableval],
1496 [unrecognized argument to --enable-linux-netfilter: $enableval])
d852fbad 1497])
4bd144d2 1498AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
be0c7ff0 1499#will be AC_DEFINEd later, after checking for appropriate infrastructure
d852fbad 1500
425de4c8
AJ
1501
1502dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
11e8cfe3 1503dnl squid_opt_netfilterconntrack is set only when option is explicity specified
425de4c8
AJ
1504AC_ARG_WITH(netfilter-conntrack,
1505 AS_HELP_STRING([--without-netfilter-conntrack],
1506 [Do not use Netfilter conntrack libraries for packet marking.
1507 A path to alternative library location may be specified by
1508 using --with-netfilter-conntrack=PATH. Default: auto-detect.]), [
f4f6c2e0
AJ
1509case "$with_netfilter_conntrack" in
1510 yes|no)
11e8cfe3 1511 squid_opt_netfilterconntrack=$with_netfilter_conntrack
f4f6c2e0
AJ
1512 ;;
1513 *)
1514 if test ! -d "$withval" ; then
1515 AC_MSG_ERROR([--without-netfilter-conntrack path does not point to a directory])
1516 fi
1517 squid_opt_netfilterconntrackpath=$withval
1518 LDFLAGS="-L$squid_opt_netfilterconntrackpath/lib $LDFLAGS"
1519 CPPFLAGS="-I$squid_opt_netfilterconntrackpath/include $CPPFLAGS"
425de4c8 1520 with_netfilter_conntrack=yes
11e8cfe3 1521 squid_opt_netfilterconntrack=yes
f4f6c2e0 1522 esac
425de4c8 1523])
f4f6c2e0
AJ
1524AC_MSG_NOTICE([Linux Netfilter Conntrack support requested: ${with_netfilter_conntrack:=auto}])
1525if test "x$with_netfilter_conntrack" != "xno"; then
1526 AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
1527 if test x"$with_netfilter_conntrack" = "xyes"; then
1528 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack library not found])
425de4c8 1529 fi
f4f6c2e0 1530 with_netfilter_conntrack=no])
425de4c8 1531 AC_CHECK_HEADERS([libnetfilter_conntrack/libnetfilter_conntrack.h \
f4f6c2e0
AJ
1532 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h],,[
1533 if test x"$with_netfilter_conntrack" = "xyes"; then
1534 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack headers not found])
1535 fi
1536 with_netfilter_conntrack=no])
88a2a8c6
AJ
1537 # If nothing is broken; enable the libraries usage.
1538 if test "x$with_netfilter_conntrack" != "xno"; then
1539 with_netfilter_conntrack=yes
1540 fi
425de4c8
AJ
1541fi
1542
1543
bb7b5fd0 1544dnl Enable Large file support
2df6213e 1545buildmodel=""
2277004e 1546squid_opt_enable_large_files=no
2df6213e 1547
1548AC_ARG_WITH(large-files,
507ca601
FC
1549 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
1550 if test "x$withval" = "xyes"; then
1551 squid_opt_enable_large_files=yes
bb7b5fd0 1552 fi
1553])
1554
2df6213e 1555dnl UNIX Build environment
be0c7ff0 1556dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
2df6213e 1557AC_ARG_WITH(build-environment,
507ca601
FC
1558 AS_HELP_STRING([--with-build-environment=model],
1559 [The build environment to use. Normally one of
1560 POSIX_V6_ILP32_OFF32 (32 bits),
1561 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
1562 POSIX_V6_LP64_OFF64 (64 bits),
1563 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
1564 XBS5_ILP32_OFF32 i(legacy, 32 bits),
1565 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
1566 XBS5_LP64_OFF64 (legacy, 64 bits),
1567 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
1568 or default (The default for your OS)]), [
1569case "$withval" in
2df6213e 1570 yes|no)
507ca601
FC
1571 AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])
1572 ;;
2df6213e 1573 *)
507ca601
FC
1574 buildmodel="$withval"
1575 ;;
1576esac
2df6213e 1577])
1578
228332d3
FC
1579#hack. Let's early-detect sizeof(long)
1580AC_CHECK_SIZEOF(long)
1581
fcabe077 1582if test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"; then
2277004e
FC
1583 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
1584 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
1585 buildmodel=$model
1586 break
1587 fi
1588 done
fcabe077 1589 if test "x$buildmodel" = "x"; then
2277004e
FC
1590 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
1591 fi
9b8002de 1592fi
0c0d381b 1593if test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"; then
228332d3
FC
1594 # define _FILE_OFFSET_BITS if requested and needed
1595 if test "x$squid_opt_enable_large_files" = "xyes" -a $ac_cv_sizeof_long -le 4 ; then
507ca601
FC
1596 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
1597 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
1598 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
1599 fi
1600else
1601 AC_MSG_NOTICE([Using $buildmodel build environment])
1602 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
1603 : # All fine
1604 else
1605 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
1606 fi
1607 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
1608 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
1609 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1610 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
941c31f3 1611 if test "x$squid_host_os" = "xsolaris" ; then
2277004e
FC
1612
1613# On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1614# for LDFLAGS -xarch=generic64, but:
1615# "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1616# For gcc "-xarch=generic64" must be replaced with "-m64"
1617# The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
fcabe077 1618 if test "x$GCC" = "xyes"; then
2277004e
FC
1619 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
1620 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
1621 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
1622 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
1623 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1624 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1625 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
1626 fi
1627 AC_MSG_NOTICE([Removing -Usun on $host])
1628 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
1629 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
1630 fi
507ca601 1631fi
2df6213e 1632
5d620373 1633dnl Enable Leak Finding Functions
1634AC_ARG_ENABLE(leakfinder,
47d80734
FC
1635 AS_HELP_STRING([--enable-leakfinder],
1636 [Enable Leak Finding code. Enabling this alone does nothing;
1637 you also have to modify the source code to use the leak
1638 finding functions. Probably Useful for hackers only.]), [
89f640aa
FC
1639 SQUID_YESNO([$enableval],
1640 [unrecognized argument to --enable-leakfinder: $enableval])
5d620373 1641])
89f640aa
FC
1642AC_MSG_NOTICE([Leak Finder enabled: ${enable_leakfinder:=no}])
1643SQUID_DEFINE_BOOL(USE_LEAKFINDER,$enable_leakfinder,
47d80734 1644 [Enable code for assisting in finding memory leaks. Not for the faint of heart])
fcabe077 1645AM_CONDITIONAL(MAKE_LEAKFINDER, [test "x$enable_leakfinder" = "xyes"])
47d80734 1646
5d620373 1647
3d674977 1648AC_ARG_ENABLE(follow-x-forwarded-for,
6ec005b5
FC
1649 AS_HELP_STRING([--enable-follow-x-forwarded-for],
1650 [Enable support for following the X-Forwarded-For
19b4777c
FC
1651 HTTP header to try to find the IP address of the
1652 original or indirect client when a request has
8075a4da 1653 been forwarded through other proxies.]), [
6ec005b5
FC
1654 SQUID_YESNO([$enableval],
1655 [unrecognized argument to --enable-follow-x-forwarded-for: $enableval])
8075a4da 1656])
6ec005b5 1657AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
3a5af257 1658SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
47d80734 1659 [Enable following X-Forwarded-For headers])
3d674977 1660
3898f57f 1661AC_ARG_ENABLE(ident-lookups,
8075a4da 1662 AS_HELP_STRING([--disable-ident-lookups],
47d80734
FC
1663 [Remove code that supports performing Ident (RFC 931) lookups.]), [
1664 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ident-lookups: $enableval])
8075a4da 1665])
6c5dc16a
FC
1666AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
1667SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
3898f57f 1668
95d2589c
CT
1669AM_CONDITIONAL(USE_SSL_CRTD, false)
1670AC_ARG_ENABLE(ssl-crtd,
1671 AC_HELP_STRING([--enable-ssl-crtd],
1672 [Prevent Squid from directly generation of SSL private key and
1673 certificate request and instead enables the ssl_crtd processes.]), [
1674 SQUID_YESNO([$enableval],
1675 [unrecogized argument to --enable-ssl-crtd: $enableval])
1676])
1677
1678if test "x$enable_ssl_crtd" = "xyes" -a "x$enable_ssl" = "xno" ; then
1679 AC_MSG_ERROR([You need to enable ssl gatewaying support to use ssl_crtd feature. Try to use --enable-ssl. ])
1680fi
1681SQUID_DEFINE_BOOL(USE_SSL_CRTD, ${enable_ssl_crtd:=no},[Use ssl_crtd daemon])
1682AM_CONDITIONAL(USE_SSL_CRTD, [test "x$enable_ssl_crtd" = "xyes"])
1683
9d798391 1684dnl Select Default hosts file location
1685AC_ARG_ENABLE(default-hostsfile,
8ea232f5
FC
1686 AS_HELP_STRING([--enable-default-hostsfile=path],
1687 [Select default location for hosts file.
75eaac6c
FC
1688 See hosts_file directive in squid.conf for details]), [
1689if test "x$enableval" != "xnone" -a "x$enableval" != "xno" ; then
1690 if test \! -f "$enableval"; then
1691 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
20ad76ab 1692 fi
75eaac6c
FC
1693 squid_opt_default_hosts=$enableval
1694else
1695 squid_opt_default_hosts="none"
1696fi
1697])
1698AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
1699DEFAULT_HOSTS=$squid_opt_default_hosts
1700AC_SUBST(DEFAULT_HOSTS)
9d798391 1701
47d80734 1702# Select auth schemes modules to build
94439e4e 1703AC_ARG_ENABLE(auth,
26ffc057
FC
1704 AS_HELP_STRING([--enable-auth],
1705 [Build global support for authentication. The list of schemes
1706 and helpers to be enabled is defined elsewhere]), [
1707SQUID_YESNO([$enableval],
1708 [unrecognized argument to --enable-auth: $enableval])
94439e4e 1709])
26ffc057 1710AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
2f1431ea
AJ
1711SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
1712AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
26ffc057
FC
1713AUTH_MODULES=""
1714
1715AC_ARG_ENABLE(auth-basic,
1716 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
1717 [Enable the basic authentication scheme, and build the specified helpers.
1718 Not providing an explicit list of helpers will attempt build of
1719 all possible helpers. Default is to do so.
1720 To disable the basic authentication scheme, use --disable-auth-basic.
d9655720 1721 To enable but build no helpers, specify "none".
26ffc057
FC
1722 To see available helpers, see the helpers/basic_auth directory. ]),[
1723#nothing to do really
1724])
5a0c5a92 1725m4_include([helpers/basic_auth/modules.m4])
94439e4e 1726
26ffc057
FC
1727AC_ARG_ENABLE(auth-ntlm,
1728 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
1729 [Enable the NTLM authentication scheme, and build the specified helpers.
1730 Not providing an explicit list of helpers will attempt build of
1731 all possible helpers. Default is to do so.
1732 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
1733 To enable but build no helpers, specify "none".
1734 To see available helpers, see the helpers/ntlm_auth directory. ]),[
380f0a87 1735])
5eabe4b4 1736m4_include([helpers/ntlm_auth/modules.m4])
94439e4e 1737
26ffc057
FC
1738AC_ARG_ENABLE(auth-negotiate,
1739 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
1740 [Enable the Negotiate authentication scheme, and build the specified
1741 helpers.
1742 Not providing an explicit list of helpers will attempt build of
1743 all possible helpers. Default is to do so.
1744 To disable the Negotiate authentication scheme,
1745 use --disable-auth-negotiate.
1746 To enable but build no helpers, specify "none".
1747 To see available helpers, see the helpers/negotiate_auth directory. ]),[
1748#nothing to do, really
6e785d85 1749])
5eabe4b4 1750m4_include([helpers/negotiate_auth/modules.m4])
6e785d85 1751
26ffc057
FC
1752AC_ARG_ENABLE(auth-digest,
1753 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
1754 [Enable the Digest authentication scheme, and build the specified helpers.
1755 Not providing an explicit list of helpers will attempt build of
1756 all possible helpers. Default is to do so.
1757 To disable the Digest authentication scheme, use --disable-auth-digest.
1758 To enable but build no helpers, specify "none".
1759 To see available helpers, see the helpers/digest_auth directory. ]),[
1760#nothing to do, really
2d70df72 1761])
5eabe4b4 1762m4_include([helpers/digest_auth/modules.m4])
380f0a87 1763
26ffc057
FC
1764dnl Authentication libraries to build
1765dnl This list will not be needed when each auth library has its own Makefile
be0c7ff0 1766dnl this is to be placed AFTER each auth module's handler
26ffc057
FC
1767AUTH_LIBS_TO_BUILD=
1768for module in $AUTH_MODULES; do
616cfc4c 1769 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
26ffc057
FC
1770done
1771AC_SUBST(AUTH_MODULES)
1772AC_SUBST(AUTH_LIBS_TO_BUILD)
1773
82b7abe3 1774dnl Select logging daemon helpers to build
82b7abe3 1775AC_ARG_ENABLE(log-daemon-helpers,
26ffc057 1776 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
a62e8408
FC
1777 [This option selects which logging daemon helpers to
1778 build and install as part of the normal build process
1779 For a list of available helpers see the helpers/log_daemon
1780 directory.]),[
6a8b1040 1781#nothing to do, really
82b7abe3 1782])
5eabe4b4 1783m4_include([helpers/log_daemon/modules.m4])
82b7abe3 1784
3d62cc61
FC
1785dnl
1786dnl Check Kerberos/GSSAPI/SPNEGO
1787dnl
c8093f05
FC
1788SQUID_STATE_SAVE([krbsave])
1789
9ca29d23 1790AC_ARG_WITH(krb5-config,
507ca601
FC
1791 AS_HELP_STRING([--with-krb5-config=PATH],
1792 [specify path to krb5-config (default=detect)]), [
1793case "$withval" in
1794 yes) unset krb5confpath ;;
1795 no) krb5confpath=no ;;
1796 *) krb5confpath=$withval ;;
1797esac
9ca29d23 1798])
fcabe077
FC
1799if test x"$krb5confpath" != "xno"; then
1800 if test "x$krb5confpath" != "x"; then
9ca29d23
AJ
1801 if ! test -x "$krb5confpath"; then
1802 AC_MSG_WARN([krb5-config '$krb5confpath' not executable, ignoring])
1803 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no)
1804 krb5confpath=krb5-config
1805 fi
1806 krb5_config_path=`dirname $krb5confpath`
1807 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no, $krb5_config_path)
1808 else
1809 AC_CHECK_PROG(ac_krb5_config,krb5-config,yes,no)
1810 krb5confpath=krb5-config
1811 fi
1812fi
fcabe077
FC
1813if test "x$ac_krb5_config" = "xyes" ; then
1814 ac_heimdal="`$krb5confpath --version 2>/dev/null | grep -i heimdal`"
1815 ac_solaris="`$krb5confpath --version 2>/dev/null | grep -i solaris`"
1816 if test "x$ac_heimdal" != "x" ; then
1817 AC_DEFINE(HAVE_HEIMDAL_KERBEROS,1,[Define to 1 if you have Heimdal Kerberos])
1818 else
1819 AC_DEFINE(HAVE_MIT_KERBEROS,1,[Define to 1 if you have MIT Kerberos])
1820 fi
1821 if test "x$ac_solaris" != "x" ; then
1822 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1823 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
1824 KRB5INCS="-I/usr/include/gssapi $KRB5INCS"
1825 KRB5LIBS="-L/usr/lib -R/usr/lib -lgss -lresolv -lsocket -lnsl $KRB5LIBS"
1826 else
1827 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1828 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
1829 KRB5INCS="`$krb5confpath --cflags gssapi 2>/dev/null` $KRB5INCS"
1830 KRB5LIBS="`$krb5confpath --libs gssapi 2>/dev/null` $KRB5LIBS"
1831 fi
1832 CPPFLAGS="$CPPFLAGS $KRB5INCS"
1833 LIBS="$LIBS $KRB5LIBS"
1834 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1835 if test "x$ac_heimdal" == "x" ; then
1836 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
1837 AC_CHECK_HEADERS(profile.h)
1838 fi
9ca29d23 1839
fcabe077
FC
1840 SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H
1841 if test "x$squid_cv_broken_krb5_h" = "xyes"; then
ffe4ffd8 1842 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if Solaris krb5.h is broken for C++])
a05af879
FC
1843 AC_MSG_WARN([You have a broken Solaris <krb5.h> system include.])
1844 AC_MSG_WARN([Please see http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512])
1845 AC_MSG_WARN([If you need Kerberos support you'll have to patch])
1846 AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch])
fcabe077 1847 fi
ffe4ffd8
AJ
1848 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1849 if test "x$squid_cv_broken_heimdal_krb5_h" = "xyes"; then
1850 AC_DEFINE(HAVE_BROKEN_HEIMDAL_KRB5_H, 1, [Define to 1 if Heimdal krb5.h is broken for C++])
1851 fi
a05af879 1852 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
3d62cc61 1853
fcabe077
FC
1854 ac_com_error_message=no
1855 if test "x$ac_cv_header_com_err_h" == "xyes" ; then
1856 AC_EGREP_HEADER(error_message,com_err.h,ac_com_error_message=yes)
1857 elif test "x$ac_cv_header_et_com_err_h" == "xyes" ; then
1858 AC_EGREP_HEADER(error_message,et/com_err.h,ac_com_error_message=yes)
1859 fi
c8093f05 1860
fcabe077
FC
1861 SQUID_CHECK_MAX_SKEW_IN_KRB5_CONTEXT
1862 if test "x$squid_cv_max_skew_context" = "xyes"; then
1863 AC_DEFINE(HAVE_MAX_SKEW_IN_KRB5_CONTEXT, 1, [Define to 1 if max_skew in struct krb5_context])
1864 fi
3d62cc61 1865
fcabe077
FC
1866 if test `echo $KRB5LIBS | grep -c com_err` -ne 0 -a "x$ac_com_error_message" == "xyes" ; then
1867 AC_CHECK_LIB(com_err,error_message,
1868 AC_DEFINE(HAVE_ERROR_MESSAGE,1,
1869 [Define to 1 if you have error_message]),)
1870 elif test "x$ac_com_error_message" == "xyes" ; then
1871 AC_CHECK_LIB(krb5,error_message,
1872 AC_DEFINE(HAVE_ERROR_MESSAGE,1,
1873 [Define to 1 if you have error_message]),)
1874 fi
1875 AC_CHECK_LIB(krb5,krb5_get_err_text,
1876 AC_DEFINE(HAVE_KRB5_GET_ERR_TEXT,1,
1877 [Define to 1 if you have krb5_get_err_text]),)
1878 AC_CHECK_LIB(krb5,krb5_get_error_message,
1879 AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE,1,
1880 [Define to 1 if you have krb5_get_error_message]),)
b1218840 1881 AC_CHECK_DECLS(krb5_kt_free_entry,,,[#include <krb5.h>])
4ebcf1ce
MM
1882 AC_CHECK_TYPE(krb5_pac,
1883 AC_DEFINE(HAVE_KRB5_PAC,1,
1884 [Define to 1 if you have krb5_pac]),,
1885 [#include <krb5.h>])
fcabe077
FC
1886 AC_CHECK_LIB(krb5,krb5_kt_free_entry,
1887 AC_DEFINE(HAVE_KRB5_KT_FREE_ENTRY,1,
1888 [Define to 1 if you have krb5_kt_free_entry]),)
1889 AC_CHECK_LIB(krb5,krb5_get_init_creds_keytab,
1890 AC_DEFINE(HAVE_GET_INIT_CREDS_KEYTAB,1,
1891 [Define to 1 if you have krb5_get_init_creds_keytab]),)
1892 AC_CHECK_LIB(krb5,krb5_get_max_time_skew,
1893 AC_DEFINE(HAVE_KRB5_GET_MAX_TIME_SKEW,1,
1894 [Define to 1 if you have krb5_get_max_time_skew]),)
1895 AC_CHECK_LIB(krb5,krb5_get_profile,
1896 AC_DEFINE(HAVE_KRB5_GET_PROFILE,1,
1897 [Define to 1 if you have krb5_get_profile]),)
1898 AC_CHECK_LIB(krb5,profile_get_integer,
1899 AC_DEFINE(HAVE_PROFILE_GET_INTEGER,1,
1900 [Define to 1 if you have profile_get_integer]),)
1901 AC_CHECK_LIB(krb5,profile_release,
1902 AC_DEFINE(HAVE_PROFILE_RELEASE,1,
1903 [Define to 1 if you have profile_release]),)
4ebcf1ce
MM
1904 AC_CHECK_LIB(krb5,krb5_get_renewed_creds,
1905 AC_DEFINE(HAVE_KRB5_GET_RENEWED_CREDS,1,
1906 [Define to 1 if you have krb5_get_renewed_creds]),)
1907 AC_CHECK_LIB(krb5,krb5_principal_get_realm,
1908 AC_DEFINE(HAVE_KRB5_PRINCIPAL_GET_REALM,1,
1909 [Define to 1 if you have krb5_principal_get_realm]),)
1910 AC_CHECK_LIB(krb5, krb5_get_init_creds_opt_alloc,
1911 AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_OPT_ALLOC,1,
1912 [Define to 1 if you have krb5_get_init_creds_opt_alloc]),)
1913 AC_MSG_CHECKING([for krb5_get_init_creds_free requires krb5_context])
1914 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1915 #include <krb5.h>
1916 ]],[[krb5_context context;
1917 krb5_get_init_creds_opt *options;
1918 krb5_get_init_creds_opt_free(context, options)]])],[
1919 AC_DEFINE(HAVE_KRB5_GET_INIT_CREDS_FREE_CONTEXT,1,
1920 [Define to 1 if you krb5_get_init_creds_free requires krb5_context])
1921 AC_MSG_RESULT(yes)
1922 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
1923
1924
1925 AC_CHECK_FUNCS(gss_map_name_to_any,
1926 AC_DEFINE(HAVE_GSS_MAP_ANY_TO_ANY,1,
1927 [Define to 1 if you have gss_map_name_to_any]),)
1928 AC_CHECK_FUNCS(gsskrb5_extract_authz_data_from_sec_context,
1929 AC_DEFINE(HAVE_GSSKRB5_EXTRACT_AUTHZ_DATA_FROM_SEC_CONTEXT,1,
1930 [Define to 1 if you have gsskrb5_extract_authz_data_from_sec_context]),)
fcabe077
FC
1931
1932 SQUID_CHECK_KRB5_CONTEXT_MEMORY_CACHE
1933 SQUID_DEFINE_BOOL(HAVE_KRB5_MEMORY_CACHE,$squid_cv_memory_cache,
1934 [Define if kerberos has MEMORY: cache support])
1935
1936 SQUID_CHECK_WORKING_GSSAPI
1937 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1938
1939 SQUID_CHECK_SPNEGO_SUPPORT
1940 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1941
1942 SQUID_CHECK_WORKING_KRB5
1943 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1944
1945 AC_SUBST(KRB5INCS)
1946 AC_SUBST(KRB5LIBS)
9ca29d23 1947fi
1a5ffec6 1948SQUID_STATE_ROLLBACK([krbsave])
3d62cc61 1949AM_CONDITIONAL(HAVE_SPNEGO, test x"$squid_cv_have_spnego" = x"yes" )
9ca29d23 1950
c6588c68 1951AC_ARG_ENABLE(external-acl-helpers,
f2d9a578 1952 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
8ea232f5 1953 [Enable external_acl helpers support and thelpers themselves.
d9655720 1954 Default is to build all buildable helpers and enable support.
8ea232f5 1955 To disable support, use --disable-external-acl-helpers.
d9655720 1956 To build no helpers, specify "none".
8ea232f5
FC
1957 To see available helpers, see the helpers/external_acl
1958 directory]), [
d9655720 1959#nothing to do, really
c6588c68 1960])
5eabe4b4 1961m4_include([helpers/external_acl/modules.m4])
d9655720 1962
fdbb3b19 1963dnl Select url_rewrite helpers to build
fdbb3b19 1964AC_ARG_ENABLE(url-rewrite-helpers,
081863f3 1965 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
fdbb3b19
AJ
1966 [This option selects which url_rewrite helpers to
1967 build and install as part of the normal build
8ea232f5
FC
1968 process. The default is to attempt the build of all possible
1969 helpers. Use --disable-url-rewrite-helpers to build none.
1970 For a list of available helpers see the
1971 helpers/url_rewrite directory.]),[
fdbb3b19 1972])
5eabe4b4 1973m4_include([helpers/url_rewrite/modules.m4])
fdbb3b19 1974
0d5ee502
AM
1975dnl Select storeid_rewrite helpers to build
1976AC_ARG_ENABLE(storeid-rewrite-helpers,
1977 AS_HELP_STRING([--enable-storeid-rewrite-helpers="list of helpers"],
1978 [This option selects which Store-ID rewrite helpers to
1979 build and install as part of the normal build
1980 process. The default is to attempt the build of all possible
1981 helpers. Use --disable-storeid-rewrite-helpers to build none.
1982 For a list of available helpers see the
1983 helpers/storeid_rewrite directory.]),[
1984])
1985m4_include([helpers/storeid_rewrite/modules.m4])
1986
3a125142 1987AC_ARG_WITH(valgrind-debug,
0f705e3b
FC
1988 AS_HELP_STRING([--with-valgrind-debug],
1989 [Include debug instrumentation for use with valgrind]),
4e26f472
FC
1990[
1991 SQUID_YESNO([$withval],
1992 [unrecognized argument to --with-valgrind-debug: $withval])
fcabe077 1993 if test "x$withval" != "xno" ; then
4e26f472
FC
1994 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
1995 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
1996 ])
b4bab919 1997 fi
1998])
4e26f472
FC
1999SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
2000 [Valgrind memory debugger support])
2001AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
b4bab919 2002
d96ceb8e 2003dnl Disable "memPools" code
8730e87a
HN
2004#AC_ARG_ENABLE(chunkedmempools,
2005# AS_HELP_STRING([--enable-chunkedmempools],
2006# [Enable experimental chunked memPools. Note that this option
507ca601 2007# simply sets the default behaviour. Specific classes can override this
8730e87a
HN
2008# at runtime, and only lib/MemPool.c needs to be altered
2009# to change the squid-wide default for all classes.]), [
2010#SQUID_YESNO([$enableval],
2011# [--enable-chunkedmempools option takes no arguments])
2012#])
4d7cefbb
HN
2013SQUID_DEFINE_BOOL(USE_CHUNKEDMEMPOOLS,${enable_chunkedmempools:=no},
2014 [Enable chunked Memory Pools support (experimental)])
8730e87a 2015#AC_MSG_NOTICE([Chunked MemPools enabled: $enable_chunkedmempools])
d96ceb8e 2016
0e657244 2017dnl Enable WIN32 Service compile mode
2018AC_ARG_ENABLE(win32-service,
054a4caa 2019 AS_HELP_STRING([--enable-win32-service],
0f705e3b 2020 [Compile Squid as a WIN32 Service.
b284c470
FC
2021 Works only on MS-Windows platforms]), [
2022SQUID_YESNO([$enableval],
2023 [unrecognized argument to --enable-win32-service: $enableval])
0e657244 2024])
b284c470
FC
2025SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
2026 [Enable code supporting MS Windows service mode])
2027AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
0e657244 2028
b1485ff8 2029
29f22442 2030# Disable "unlinkd" code
fe0810ac 2031AC_ARG_ENABLE(unlinkd,
0a081cb0 2032 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
0f705e3b
FC
2033SQUID_YESNO([$enableval],
2034 [unrecognized argument to --disable-unlinkd: $enableval])
fe0810ac 2035])
0f658b5b 2036SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
0f705e3b 2037 [Enable useage of unlinkd])
fcabe077 2038AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
fbc04c0a 2039AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
fe0810ac 2040
0f705e3b 2041# Enable backtraces on fatal errors
ce3d30fb 2042AC_ARG_ENABLE(stacktraces,
0f705e3b
FC
2043 AS_HELP_STRING([--enable-stacktraces],
2044 [Enable automatic call backtrace on fatal errors]), [
2045SQUID_YESNO([$enableval],
2046 [unrecognized argument to --enable-stacktraces: $enableval])
ce3d30fb 2047])
0f658b5b 2048SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
0f705e3b 2049 [Print stack traces on fatal errors])
78614cd4 2050AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
0a081cb0 2051
ce3d30fb 2052
904676a2 2053# CPU Profiling options handling
88bfe092 2054AC_ARG_ENABLE(cpu-profiling,
0f705e3b
FC
2055 AS_HELP_STRING([--enable-cpu-profiling],
2056 [Enable instrumentation to try and understand how CPU power
2057 is spent by squid, by enabling specific probes in selected
2058 functions.
2059 New probes can only be added by modifying the source code.
2060 It is meant to help developers in optimizing performance
2061 of Squid internal functions.
87fa90fb 2062 If you are not developer you should not enable this,
0f705e3b
FC
2063 as it slows squid down somewhat.
2064 See lib/Profiler.c for more details.]), [
2065SQUID_YESNO([$enableval],
2066 [unrecognized argument to --enable-cpu-profiling: $enableval])
88bfe092 2067])
13e41ca5
AJ
2068# Default OFF. This is a debug feature. Only check and enable if forced ON.
2069if test "x$enable_cpu_profiling" = "xyes"; then
5e44eea8 2070 SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
13e41ca5 2071 if test "x$squid_cv_cpu_profiler_works" = "xno"; then
5e44eea8 2072 AC_MSG_ERROR([CPU profiling will not be functional in this build.])
5e44eea8 2073 fi
5e44eea8 2074fi
0f658b5b 2075SQUID_DEFINE_BOOL(USE_XPROF_STATS,${enable_cpu_profiling:=no},
0f705e3b
FC
2076 [Define to enable CPU profiling within Squid])
2077AM_CONDITIONAL(ENABLE_XPROF_STATS,
fcabe077 2078 test "x$enable_cpu_profiling" = "xyes")
78614cd4 2079AC_MSG_NOTICE([CPU profiling enabled: $enable_cpu_profiling])
88bfe092 2080
904676a2 2081# Enable X-Accelerator-Vary for Vary support within an accelerator setup
2092c67d 2082AC_ARG_ENABLE(x-accelerator-vary,
904676a2
FC
2083 AS_HELP_STRING([--enable-x-accelerator-vary],
2084 [Enable support for the X-Accelerator-Vary
e702812e
FC
2085 HTTP header. Can be used to indicate
2086 variance within an accelerator setup.
2087 Typically used together with other code
904676a2
FC
2088 that adds custom HTTP headers to the requests.]), [
2089SQUID_YESNO([$enableval],
2090 [unrecognized argument to --enable-x-accelerator-vary: $enableval])
f66a9ef4 2091])
0f658b5b 2092SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
904676a2 2093 [Enable support for the X-Accelerator-Vary HTTP header])
78614cd4 2094AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
f66a9ef4 2095
87fa90fb 2096
8b5e106b 2097if $CPPUNITCONFIG --help >/dev/null; then
78cae3b4
FC
2098 squid_cv_cppunit_version="`$CPPUNITCONFIG --version`"
2099 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
2100 unset squid_cv_cppunit_version
8b5e106b 2101 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2102 SQUID_CPPUNIT_LA=''
2103 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2104else
eed82608 2105 AC_MSG_WARN([cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail.])
63d03edb 2106 SQUID_CPPUNIT_LA=''
2107 SQUID_CPPUNIT_LIBS=''
2108 SQUID_CPPUNIT_INC=''
f5691f9c 2109fi
8b5e106b 2110
f5691f9c 2111AC_ARG_WITH(cppunit-basedir,
1b9fe876 2112 AS_HELP_STRING([--with-cppunit-basedir=PATH],
3680cc44
FC
2113 [Path where the cppunit headers are libraries can be found ]), [
2114if test -f "$withval/include/cppunit/TestCase.h"; then
2115 AC_MSG_NOTICE([Using cppunit includes from $withval])
2116 SQUID_CPPUNIT_INC="-I${withval}/include"
2117else
2118 AC_MSG_ERROR(Cannot find cppunit at $withval)
2119fi
2120if test -f "$withval/lib/libcppunit.la"; then
2121 AC_MSG_NOTICE([Using cppunit lib from $withval])
2122 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
2123 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
2124else
2125 AC_MSG_ERROR(Cannot find cppunit at $withval)
2126fi
f5691f9c 2127])
7b81a8f7
AJ
2128SQUID_STATE_SAVE(squid_cppunit_state)
2129CXXFLAGS="$CXXFLAGS $SQUID_CPPUNIT_INC"
2130AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
2131SQUID_STATE_ROLLBACK(squid_cppunit_state)
8b5e106b 2132AC_SUBST(SQUID_CPPUNIT_LIBS)
f5691f9c 2133AC_SUBST(SQUID_CPPUNIT_LA)
2134AC_SUBST(SQUID_CPPUNIT_INC)
f5691f9c 2135
fd9aaa3e 2136# Force some compilers to use ANSI features
2137#
2138case "$host" in
3680cc44
FC
2139 *-hp-hpux*)
2140 if test "x$ac_cv_prog_CC" = "xcc" ; then
2141 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
2142 CC="cc -Ae";
2143 ac_cv_prog_CC="$CC"
2144 fi
2145 ;;
fd9aaa3e 2146esac
2147
dd56802c 2148
a2794549 2149dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
4e9d8e26 2150
6ad85e8a 2151case "$host" in
3680cc44
FC
2152 *hpux*)
2153 AC_MSG_NOTICE([Disabling ranlib for HP-UX...])
2154 RANLIB=":"
2155 ;;
6ad85e8a 2156esac
2157
090089c4 2158dnl Check for headers
2159AC_HEADER_DIRENT
2160AC_HEADER_STDC
db40ae20 2161
2162AC_CHECK_HEADERS( \
b167f1b8 2163 algorithm \
3680cc44
FC
2164 arpa/inet.h \
2165 arpa/nameser.h \
2166 assert.h \
2167 bstring.h \
2168 cassert \
2169 crypt.h \
dbb66306 2170 cstdarg \
25f98340 2171 cstdlib \
3680cc44 2172 cstring \
95d2589c 2173 list \
3680cc44
FC
2174 ctype.h \
2175 errno.h \
2176 execinfo.h \
2177 fcntl.h \
2178 fnmatch.h \
2179 getopt.h \
2180 glob.h \
2181 gnumalloc.h \
2182 grp.h \
2183 iosfwd \
2184 iomanip \
2185 iostream \
95d2589c 2186 fstream \
43d1bbe4 2187 climits \
3680cc44
FC
2188 ip_compat.h \
2189 ip_fil_compat.h \
2190 ip_fil.h \
2191 ip_nat.h \
2192 ipl.h \
2193 lber.h \
2194 ldap.h \
2195 libc.h \
425de4c8 2196 limits \
3680cc44
FC
2197 limits.h \
2198 linux/posix_types.h \
2199 linux/types.h \
2200 machine/byte_swap.h \
2201 malloc.h \
2202 map \
2203 math.h \
2204 memory.h \
95d2589c 2205 memory \
3680cc44
FC
2206 mount.h \
2207 netdb.h \
2208 netinet/in.h \
2209 netinet/in_systm.h \
2210 netinet/ip_fil_compat.h \
2211 openssl/err.h \
2212 openssl/md5.h \
3eee6040 2213 openssl/opensslv.h \
3680cc44
FC
2214 openssl/ssl.h \
2215 openssl/x509v3.h \
2216 netinet/tcp.h \
2217 openssl/engine.h \
95d2589c 2218 openssl/txt_db.h \
3680cc44
FC
2219 ostream \
2220 paths.h \
2221 poll.h \
2222 pwd.h \
2223 shadow.h \
2224 regex.h \
2225 sched.h \
2ccf2eb2 2226 siginfo.h \
3680cc44
FC
2227 signal.h \
2228 sstream \
2229 stdarg.h \
425de4c8 2230 stdbool.h \
3680cc44
FC
2231 stddef.h \
2232 stdexcept \
2233 stdio.h \
2234 stdlib.h \
2235 string \
2236 string.h \
2237 strings.h \
2238 sys/bitypes.h \
2239 sys/bswap.h \
2240 sys/endian.h \
2241 sys/file.h \
2242 sys/ioctl.h \
d440d5a4 2243 sys/ipc.cc \
3680cc44
FC
2244 sys/param.h \
2245 sys/prctl.h \
2246 sys/md5.h \
c975f532 2247 sys/mman.h \
3680cc44
FC
2248 sys/msg.h \
2249 sys/resource.h \
2ccf2eb2 2250 sys/select.h \
d440d5a4 2251 sys/shm.h \
3680cc44
FC
2252 sys/socket.h \
2253 sys/stat.h \
2254 sys/statvfs.h \
2255 syscall.h \
2256 sys/syscall.h \
2257 sys/time.h \
2258 sys/types.h \
2259 sys/uio.h \
2260 sys/un.h \
2261 sys/vfs.h \
2262 sys/wait.h \
2263 syslog.h \
2264 time.h \
2265 unistd.h \
2266 utime.h \
2267 varargs.h \
2268 byteswap.h \
2269 glib.h \
2270 stdint.h \
2271 inttypes.h \
3680cc44 2272 db.h \
cdb86165
FC
2273 db_185.h \
2274 wchar.h
db40ae20 2275)
3c586e38 2276
ee80a919
AR
2277AC_CHECK_HEADERS( \
2278 linux/netfilter_ipv4.h \
2279 linux/netfilter_ipv6/ip6_tables.h \
fc68f6b1 2280,,,
dcd1dc78 2281SQUID_DEFAULT_INCLUDES
2282#if HAVE_LIMITS_H
2283#include <limits.h>
2284#endif
a74968c2
AJ
2285/* Netfilter ip(6)tables v1.4.0 has broken headers */
2286#if HAVE_NETINET_IN_H
2287#include <netinet/in.h>
2288#endif
dcd1dc78 2289)
2290
cdb352bb 2291dnl *BSD dont include the dependencies for all their net/ and netinet/ files
c92b4732 2292dnl We must include a few basic type headers for them to work.
d1e5191e 2293AC_CHECK_HEADERS( \
0c0d381b
FC
2294 net/if.h \
2295 netinet/if_ether.h\
2296 netinet/icmp6.h \
2297 netinet/in.h \
2298 netinet/ip.h \
2299 netinet/ip6.h \
2300 netinet/ip_compat.h\
2301 netinet/ip_fil_compat.h\
2302 netinet/ip_fil.h\
2303 netinet/ip_icmp.h \
2304 netinet/ipl.h \
2305 netinet/ip_nat.h\
2306 net/pf/pfvar.h \
2307 net/pfvar.h \
2308 sys/mount.h\
2309 resolv.h \
d1e5191e
AJ
2310,,,
2311SQUID_BSDNET_INCLUDES)
5a3237b0 2312
aee0606f 2313AC_C_CONST
d57288d2 2314AC_C_BIGENDIAN
aee0606f 2315
6a9f6389 2316AC_STRUCT_TM
2317AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2318#if TM_IN_SYS_TIME
2319#if HAVE_SYS_TIME_H
2320#include <sys/time.h>
2321#endif
2322#elif HAVE_TIME_H
2323#include <time.h>
2324#endif
5c51415d 2325])
46c883ed 2326
ef7ece58 2327SQUID_HAVE_STRUCT_MALLINFO
090089c4 2328
08caf8c6 2329dnl Override rusage() detect on MinGW because is emulated in source code
78a60bca
AJ
2330case "$squid_host_os" in
2331 mingw)
08caf8c6 2332 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2333 ac_cv_func_getrusage='yes'
eed82608 2334 AC_MSG_NOTICE([Using own rusage on Windows.])
08caf8c6 2335 ;;
2336 *)
2337 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 2338#if HAVE_SYS_TIME_H
2339#include <sys/time.h>
2340#endif
b54a6789 2341#if HAVE_SYS_RESOURCE_H
2342#include <sys/resource.h>
6a9f6389 2343#endif])
08caf8c6 2344 ;;
2345esac
b54a6789 2346
6a9f6389 2347AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2348#if HAVE_SYS_TYPES_H
2349#include <sys/types.h>
2350#endif
a025a745 2351#include <netinet/in.h>
2352#include <netinet/in_systm.h>
6ad85e8a 2353#include <netinet/ip.h>
b05490a8 2354#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 2355#define ip_hl ihl
2356#endif
2357#ifndef __linux__
b05490a8 2358#ifndef __CYGWIN__
6ad85e8a 2359#define iphdr ip
b05490a8 2360#endif
6a9f6389 2361#endif])
a025a745 2362
090089c4 2363dnl Check for typedefs
77d6bd88 2364AC_CHECK_SIZEOF(void *)
090089c4 2365
41aa7d00
FC
2366# check for a bunch of types
2367AC_TYPE_INT8_T
2368AC_TYPE_UINT8_T
2369AC_TYPE_INT16_T
2370AC_TYPE_UINT16_T
2371AC_TYPE_INT32_T
2372AC_TYPE_UINT32_T
2373AC_TYPE_INT64_T
2374AC_TYPE_UINT64_T
2375AC_TYPE_PID_T
2376AC_TYPE_SIZE_T
2377AC_TYPE_SSIZE_T
2378AC_TYPE_OFF_T
2379AC_TYPE_UID_T
59a09b98 2380AC_CHECK_TYPE([bool])
41aa7d00
FC
2381#need the defines for PRId64
2382AC_CHECK_SIZEOF(int64_t)
2383AC_CHECK_SIZEOF(long)
fe1e5c91
AJ
2384#need the defines for PRIuSIZE
2385AC_CHECK_SIZEOF(size_t)
50f9c873
AR
2386#need the define for overflow checks
2387AC_CHECK_SIZEOF(off_t)
46e172d9 2388AC_CHECK_SIZEOF(size_t)
6a9f6389 2389
a203dec7
AJ
2390dnl Some C++0x types we try to use
2391AX_CXX_TYPE_NULLPTR
2392AX_CXX_TYPE_UNIQUE_PTR
2393
588e71df 2394dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2395dnl that is incompatible with the updated Solaris header files.
2396dnl For this reason, we must check if pad128_t and upad128_t are defined.
2397AC_CHECK_TYPE(pad128_t,
2398 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2399 ,SQUID_DEFAULT_INCLUDES)
2400
2401AC_CHECK_TYPE(upad128_t,
2402 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2403 ,SQUID_DEFAULT_INCLUDES)
2404
6a9f6389 2405AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2406AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 2407
6a9f6389 2408AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2409#include <sys/types.h>
6637e3a5 2410#include <sys/socket.h>
2411#if STDC_HEADERS
2412#include <stdlib.h>
2413#include <stddef.h>
6a9f6389 2414#endif])
6637e3a5 2415
cdb352bb
FC
2416AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
2417 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
2418#include <sys/ipc.h>
2419#include <sys/msg.h>])
2420
fe1e5c91
AJ
2421# check for compiler support of %zu printf macro
2422AH_TEMPLATE(PRIuSIZE,[Compiler supports %zu printf macro])
2423AC_MSG_CHECKING([for compiler %zu support])
2424AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2425#include <stdio.h>
2426 ]],[[size_t n=1;printf("%zu",n);]])],[
2427 AC_DEFINE(PRIuSIZE,"zu")
2428 AC_MSG_RESULT(yes)
2429 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
2430
2431
cdb352bb
FC
2432dnl Check for special functions
2433AC_FUNC_ALLOCA
2434
2435
b50f1b2b 2436dnl Check for libcap header (assume its not broken unless
45c41a07
FC
2437AC_ARG_WITH(libcap, AS_HELP_STRING([--without-libcap],
2438 [disable usage of Linux capabilities library to control privileges]), [
2439SQUID_YESNO([$withval],[unrecognized argument to --without-libcap: $withval])
2440],[with_libcap=auto])
2441
2442if test "x$with_libcap" != "xno"; then
b64b6030 2443 # cap_clear_flag is the most recent libcap function we require
45c41a07 2444 AC_CHECK_HEADERS(sys/capability.h)
b64b6030 2445 AC_CHECK_LIB(cap, cap_clear_flag)
45c41a07
FC
2446 SQUID_CHECK_FUNCTIONAL_LIBCAP2
2447
2448 # if it can't be supported..
35e2b2e5 2449 if test "x$ac_cv_header_sys_capability_h" = "xno" -o \
46f50de9 2450 "x$ac_cv_lib_cap_cap_clear_flag" = "xno"; then
45c41a07 2451 # and it was forced on: error
46f50de9 2452 if test "x$with_libcap" = "xyes" ; then
ff8d255b 2453 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
3fbda12c
FC
2454 else
2455 # with_libcap is "auto"; it can't be supported. Disable.
2456 with_libcap=no
b64b6030 2457 fi
45c41a07
FC
2458 else
2459 # header and lib are ok, we support
2460 with_libcap=yes
b64b6030 2461 fi
69367152 2462
b50f1b2b 2463fi
5b43d209 2464
45c41a07
FC
2465SQUID_DEFINE_BOOL(USE_LIBCAP,$with_libcap,
2466 [use libcap to set capabilities required for TPROXY])
2467AC_MSG_NOTICE([libcap support enabled: $with_libcap])
2468SQUID_DEFINE_BOOL(LIBCAP_BROKEN,${squid_cv_sys_capability_works:=no},
2469 [libcap2 headers are broken and clashing with glibc])
2470AC_MSG_NOTICE([libcap2 headers are ok: $squid_cv_sys_capability_works])
2471
b64b6030 2472
090089c4 2473dnl Check for needed libraries
54c95954 2474AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
819656da
AJ
2475AC_SEARCH_LIBS([res_init],[resolv])
2476AC_SEARCH_LIBS([__res_search],[resolv])
54c95954
FC
2477AC_SEARCH_LIBS([bind],[socket])
2478AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
2479AC_SEARCH_LIBS([strlcpy], [bsd])
85cd85f3 2480AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
bfe8dedf 2481dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
0c0d381b
FC
2482if test "x$squid_host_os" = "xmingw" ; then
2483 SQUID_CHECK_WINSOCK_LIB
32341684
AJ
2484 AC_CHECK_HEADERS( \
2485 windows.h \
2486 ws2tcpip.h \
2487 Iphlpapi.h ,,,[
2488#if HAVE_WINDOWS_H
2489#include <windows.h>
2490#endif
0a675778
FC
2491#if HAVE_WINSOCK2_H
2492#include <winsock2.h>
2493#endif])
0c0d381b 2494fi
94d48591 2495
46f50de9
FC
2496# check that we have unix sockets
2497SQUID_CHECK_UNIX_SOCKET
2498SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
2499
2500AC_CHECK_LIB(gnumalloc, malloc)
2501if test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"; then
ef7ece58 2502 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
46f50de9
FC
2503 ac_cv_func_mallinfo=no
2504 ac_cv_func_mallocblksize=no
2505 ac_cv_func_mallopt=no
2506else
2507 case "$squid_host_os" in
2508 solaris)
2509 AC_MSG_NOTICE([skipping libmalloc check for $host])
2510 ;;
2511 freebsd)
2512 AC_MSG_NOTICE([skipping libmalloc check for $host])
2513 ;;
2514 *)
2515 #used later. FIXME
2516 AC_CHECK_LIB(malloc, main)
2517 ;;
cdb352bb
FC
2518 esac
2519fi
94d48591 2520
78a60bca
AJ
2521case "$squid_host_os" in
2522 mingw)
2523 AC_MSG_NOTICE([Use MSVCRT for math functions.])
2524 ;;
2525 *)
2526 dnl rint() and log() are only used in old C code for now.
2527 AC_LANG_PUSH([C])
2528 AC_SEARCH_LIBS([rint],[m])
2529 AC_SEARCH_LIBS([log],[m])
2530 AC_LANG_POP([C])
2531 ;;
08caf8c6 2532esac
090089c4 2533
001ad4cc 2534
f467f578
FC
2535dnl --with-maxfd present for compatibility with Squid-2.
2536dnl undocumented in ./configure --help to encourage using the Squid-3 directive
2537AC_ARG_WITH(maxfd,,
2538[
2539 case ${withval} in
2540 [[0-9]]*)
2541 squid_filedescriptors_num=$withval
2542 ;;
2543 *)
2544 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
2545 ;;
2546 esac
055421ee 2547])
001ad4cc 2548
f467f578
FC
2549AC_ARG_WITH(filedescriptors,
2550 AS_HELP_STRING([--with-filedescriptors=NUMBER],
2551 [Force squid to support NUMBER filedescriptors]),
2552[
2553 case ${withval} in
2554 [[0-9]]*)
2555 squid_filedescriptors_num=$withval
2556 ;;
2557 *)
2558 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
2559 ;;
2560 esac
001ad4cc 2561])
f467f578
FC
2562
2563SQUID_CHECK_DEFAULT_FD_SETSIZE
2564if test "x$squid_filedescriptors_num" = "x"; then
2565 SQUID_CHECK_MAXFD
001ad4cc 2566else
f467f578 2567 AC_MSG_NOTICE([forcing use of $squid_filedescriptors_num filedescriptors (user-forced)])
001ad4cc 2568fi
f467f578
FC
2569if test "$squid_filedescriptors_num" -lt 512 ; then
2570 AC_MSG_WARN([$squid_filedescriptors_num may not be enough filedescriptors if your])
2571 AC_MSG_WARN([cache will be very busy. Please see the FAQ page])
2572 AC_MSG_WARN([http://wiki.squid-cache.org/SquidFaq/TroubleShooting])
2573 AC_MSG_WARN([on how to increase your filedescriptor limit])
2574fi
2575AC_DEFINE_UNQUOTED(SQUID_MAXFD, $squid_filedescriptors_num,[Maximum number of open filedescriptors])
001ad4cc 2576
f467f578 2577
001ad4cc
AJ
2578dnl Enable IPv6 support
2579AC_MSG_CHECKING([whether to enable IPv6])
001ad4cc 2580AC_ARG_ENABLE(ipv6,
af494bc8
FC
2581 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
2582SQUID_YESNO([$enableval],[unrecognized argument to --disable-ipv6: $enableval])
001ad4cc 2583])
7d927f1f
AJ
2584AC_MSG_RESULT(${enable_ipv6:=yes})
2585SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
001ad4cc 2586
7d927f1f 2587if test "x$enable_ipv6" = "xyes" ; then
af494bc8 2588 SQUID_CHECK_SIN6_LEN_IN_SAI
001ad4cc 2589fi
7d553ad9
AJ
2590SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
2591SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
001ad4cc 2592
001ad4cc 2593
090089c4 2594dnl Check for libcrypt
0d8565ac 2595CRYPTLIB=
8154dd82 2596dnl Some of our helpers use crypt(3) which may be in libc, or in
2597dnl libcrypt (eg FreeBSD)
c1dc012a 2598AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
3d4022fa 2599dnl Solaris10 provides MD5 natively through libmd5
c1dc012a 2600AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
be79ade0 2601AC_SUBST(CRYPTLIB)
77f675ad 2602
0d8565ac
AJ
2603# check for crypt, may require -lcrypt
2604SAVED_LIBS="$LIBS"
2605LIBS="$LIBS $CRYPTLIB"
2606AC_CHECK_FUNCS(crypt)
2607LIBS="$SAVED_LIBS"
2608
2609
042b1f8a 2610dnl Check for libdl, used by auth_modules/PAM
fcabe077 2611if test "x$with_dl" = "xyes"; then
8154dd82 2612 AC_CHECK_LIB(dl, dlopen)
2613fi
042b1f8a 2614
86ec11aa 2615dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
2616dnl Robert Side <rside@aiinc.bc.ca>
2617dnl Mon, 18 Jan 1999 17:48:00 GMT
2618case "$host" in
2619 *-pc-sco3.2*)
2620 AC_CHECK_LIB(intl, strftime)
2621 ;;
2622esac
2623
20e869bf 2624dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
2625dnl only with Windows LDAP libraries using -lwldap32
78a60bca
AJ
2626case "$squid_host_os" in
2627 mingw)
b1218840
AJ
2628 LDAPLIB="-lwldap32"
2629 LBERLIB=""
2630 ;;
2631 *)
2632 AC_CHECK_LIB(ldap, ldap_init, [LDAPLIB="-lldap"])
2633 dnl LDAP helpers need to know if -llber is needed or not
2634 AC_CHECK_LIB(lber, ber_init, [LBERLIB="-llber"])
2635 dnl if no ldap lib found check for mozilla version
2636 if test "x$ac_cv_lib_ldap_ldap_init" != x""yes; then
2637 oLIBS=$LIBS
2638 LIBS="$LIBPTHREADS"
2639 AC_CHECK_LIB(ldap60, ldap_init, [LDAPLIB="-lldap60"])
2640 LIBS="$LDAPLIB $LIBPTHREADS"
2641 AC_CHECK_LIB(prldap60, prldap_init, [LDAPLIB="-lprldap60 $LDAPLIB"])
2642 LIBS="$LDAPLIB $LIBPTHREADS"
2643 AC_CHECK_LIB(ssldap60, ldapssl_init, [LDAPLIB="-lssldap60 $LDAPLIB"])
2644 LIBS=$oLIBS
2645 fi
2646
2647 AC_CHECK_HEADERS(ldap.h lber.h)
2648 AC_CHECK_HEADERS(mozldap/ldap.h)
2649
2650 dnl
2651 dnl Check for LDAP_OPT_DEBUG_LEVEL
2652 dnl
2653 AC_MSG_CHECKING([for LDAP_OPT_DEBUG_LEVEL])
2654 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2655# include <ldap.h>
2656 ]],[[
2657 int i=LDAP_OPT_DEBUG_LEVEL
2658 ]])],
2659 [ AC_MSG_RESULT(yes) ],
2660 [ AC_MSG_RESULT(no) ])
2661
2662 dnl
2663 dnl Check for working ldap
2664 dnl
2665 oLIBS=$LIBS
2666 LIBS="$LDAPLIB $LBERLIB $LIBPTHREADS"
2667 AC_MSG_CHECKING([for working ldap])
2668 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2669# define LDAP_DEPRECATED 1
2670# if HAVE_LDAP_H
2671# include <ldap.h>
2672# elif HAVE_MOZLDAP_LDAP_H
2673# include <mozldap/ldap.h>
2674# endif
2675 int
2676 main(void)
2677 {
2678 char host[]="";
2679 int port;
2680
2681 ldap_init((const char *)&host, port);
2682
2683 return 0;
2684 }
2685 ]])],
2686 [ AC_DEFINE(HAVE_LDAP, 1, [LDAP support])
2687 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2688 [ AC_MSG_RESULT(no) ],
2689 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2690 LIBS=$oLIBS
2691
2692 dnl
2693 dnl Check for ldap vendor
2694 dnl
2695 AC_MSG_CHECKING([for OpenLDAP])
2696 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2697# if HAVE_LDAP_H
2698# include <ldap.h>
2699# endif
2700# include <string.h>
2701 int
2702 main(void)
2703 {
2704 return strcmp(LDAP_VENDOR_NAME,"OpenLDAP");
2705 }
2706 ]])],
2707 [ AC_DEFINE(HAVE_OPENLDAP, 1, [OpenLDAP support])
2708 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2709 [ AC_MSG_RESULT(no) ],
2710 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2711
2712 AC_MSG_CHECKING([for Sun LDAP SDK])
2713 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2714# if HAVE_LDAP_H
2715# include <ldap.h>
2716# endif
2717# include <string.h>
2718 int
2719 main(void)
2720 {
2721 return strcmp(LDAP_VENDOR_NAME,"Sun Microsystems Inc.");
2722 }
2723 ]])],
2724 [ AC_DEFINE(HAVE_SUN_LDAP_SDK, 1, [Sun LDAP SDK support])
2725 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2726 [ AC_MSG_RESULT(no) ],
2727 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2728
2729 AC_MSG_CHECKING([for Mozilla LDAP SDK])
2730 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2731# if HAVE_LDAP_H
2732# include <ldap.h>
2733# elif HAVE_MOZLDAP_LDAP_H
2734# include <mozldap/ldap.h>
2735# endif
2736# include <string.h>
2737 int
2738 main(void)
2739 {
2740 return strcmp(LDAP_VENDOR_NAME,"mozilla.org");
2741 }
2742 ]])],
2743 [ AC_DEFINE(HAVE_MOZILLA_LDAP_SDK, 1, [Mozilla LDAP SDK support])
2744 AC_MSG_RESULT(yes) ],
aff0e8fe
AJ
2745 [ AC_MSG_RESULT(no)],
2746 [ AC_MSG_RESULT(cross-compiler cant tell) ])
b1218840
AJ
2747
2748 dnl
2749 dnl Check for LDAP_REBINDPROC_CALLBACK
2750 dnl
2751 AC_MSG_CHECKING([for LDAP_REBINDPROC_CALLBACK])
2752 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2753# if HAVE_LDAP_H
2754# include <ldap.h>
2755# elif HAVE_MOZLDAP_LDAP_H
2756# include <mozldap/ldap.h>
2757# endif
2758 ]],[[
2759 LDAP_REBINDPROC_CALLBACK ldap_rebind;
2760 ]])],
2761 [ AC_DEFINE(HAVE_LDAP_REBINDPROC_CALLBACK,1,[Define to 1 if you have LDAP_REBINDPROC_CALLBACK])
2762 AC_MSG_RESULT(yes) ],
2763 [ AC_MSG_RESULT(no) ])
2764
2765 dnl
2766 dnl Check for LDAP_REBIND_PROC
2767 dnl
2768 AC_MSG_CHECKING([for LDAP_REBIND_PROC])
2769 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2770# if HAVE_LDAP_H
2771# include <ldap.h>
2772# elif HAVE_MOZLDAP_LDAP_H
2773# include <mozldap/ldap.h>
2774# endif
2775 ]],[[
2776 LDAP_REBIND_PROC ldap_rebind;
2777 ]])],
2778 [ AC_DEFINE(HAVE_LDAP_REBIND_PROC,1,[Define to 1 if you have LDAP_REBIND_PROC])
2779 AC_MSG_RESULT(yes) ],
2780 [ AC_MSG_RESULT(no) ])
2781
2782 dnl
2783 dnl Check for LDAP_REBIND_FUNCTION
2784 dnl
2785 AC_MSG_CHECKING([for LDAP_REBIND_FUNCTION])
2786 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2787# define LDAP_REFERRALS
2788# if HAVE_LDAP_H
2789# include <ldap.h>
2790# elif HAVE_MOZLDAP_LDAP_H
2791# include <mozldap/ldap.h>
2792# endif
2793 ]],[[
2794 LDAP_REBIND_FUNCTION ldap_rebind;
2795 ]])],
2796 [ AC_DEFINE(HAVE_LDAP_REBIND_FUNCTION,1,[Define to 1 if you have LDAP_REBIND_FUNCTION])
2797 AC_MSG_RESULT(yes) ],
2798 [ AC_MSG_RESULT(no) ])
2799
2800 dnl
2801 dnl Check for LDAP_SCOPE_DEFAULT
2802 dnl
2803 AC_MSG_CHECKING([for LDAP_SCOPE_DEFAULT])
2804 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2805# if HAVE_LDAP_H
2806# include <ldap.h>
2807# elif HAVE_MOZLDAP_LDAP_H
2808# include <mozldap/ldap.h>
2809# endif
2810 ]],[[
2811 int i=LDAP_SCOPE_DEFAULT;
2812 ]])],
2813 [ AC_DEFINE(HAVE_LDAP_SCOPE_DEFAULT,1,[Define to 1 if you have LDAP_SCOPE_DEFAULT])
2814 AC_MSG_RESULT(yes) ],
2815 [ AC_MSG_RESULT(no) ])
2816
2817 dnl
2818 dnl Check for ldap_url_desc.lud_scheme
2819 dnl
2820 AC_CHECK_MEMBER(struct ldap_url_desc.lud_scheme,
2821 AC_DEFINE(HAVE_LDAP_URL_LUD_SCHEME,1,
2822 [Define to 1 if you have LDAPURLDesc.lud_scheme]),,[#include <ldap.h>])
2823
2824 dnl
2825 dnl Check for ldapssl_client_init
2826 dnl
2827 AC_CHECK_LIB(ldap,ldapssl_client_init,
2828 AC_DEFINE(HAVE_LDAPSSL_CLIENT_INIT,1,[Define to 1 if you have ldapssl_client_init]),)
2829
2830 dnl
2831 dnl Check for ldap_url_desc2str
2832 dnl
2833 AC_CHECK_LIB(ldap,ldap_url_desc2str,
2834 AC_DEFINE(HAVE_LDAP_URL_DESC2STR,1,[Define to 1 if you have ldap_url_desc2str]),)
2835
2836 dnl
2837 dnl Check for ldap_url_parse
2838 dnl
2839 AC_CHECK_LIB(ldap,ldap_url_parse,
2840 AC_DEFINE(HAVE_LDAP_URL_PARSE,1,[Define to 1 if you have ldap_url_parse]),)
60727a6f
AJ
2841
2842 dnl
2843 dnl Check for ldap_start_tls_s
2844 dnl
2845 AC_CHECK_LIB(ldap,ldap_start_tls_s,
2846 AC_DEFINE(HAVE_LDAP_START_TLS_S,1,[Define to 1 if you have ldap_start_tls_s]),)
b1218840 2847 ;;
20e869bf 2848esac
b1218840 2849
428744a1
AJ
2850AC_SUBST(LDAPLIB)
2851AC_SUBST(LBERLIB)
20e869bf 2852
b7a1c19e 2853dnl Check for libdb
6b5de50d 2854dnl this is not fully functional if db.h is for a differend db version
b7a1c19e 2855DBLIB=
6b5de50d
FC
2856
2857dnl check that dbopen is actually defined in the header
2858dnl FIXME: in case of failure undef db-related includes etc.
2859AC_CHECK_DECL(dbopen,,,[
06fbee01
FC
2860#if HAVE_SYS_TYPES_H
2861#include <sys/types.h>
2862#endif
2863#if HAVE_LIMITS_H
2864#include <limits.h>
2865#endif
6b5de50d
FC
2866#if HAVE_DB_185_H
2867#include <db_185.h>
2868#elif HAVE_DB_H
2869#include <db.h>
2870#endif])
2871
01b4931d 2872dnl 1.85
91983da0 2873SQUID_CHECK_DBOPEN_NEEDS_LIBDB
fcabe077 2874if test "x$ac_cv_dbopen_libdb" = "xyes"; then
32d0bbd7 2875 LIB_DB="-ldb"
2876fi
01b4931d 2877AC_SUBST(LIB_DB)
b7a1c19e 2878
77f675ad 2879dnl System-specific library modifications
2880dnl
2881case "$host" in
fcabe077
FC
2882 i386-*-solaris2.*)
2883 if test "x$GCC" = "xyes"; then
2884 AC_MSG_NOTICE([Removing -O for gcc on $host])
2885 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2886 fi
2887 ;;
2888 *-sgi-irix*)
2889 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
2890 LIBS=`echo $LIBS | sed -e s/-lsocket//`
2891 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
2892 LIBS=`echo $LIBS | sed -e s/-lnsl//`
2893 ac_cv_lib_nsl_main=no
2894 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
2895 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2896 ;;
4ba0bd0e 2897dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
2898dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
2899dnl Please change your configure script. AIX doesn't need -lbsd.
fcabe077
FC
2900 *-ibm-aix*)
2901 AC_MSG_NOTICE([Removing -lbsd for AIX...])
2902 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3e1ce596
KB
2903
2904 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
2905#include <assert.h>
2906#ifndef NULL
2907#define NULL 0
2908#endif
2909class Foo{
2910public:virtual ~Foo(){}
2911};
2912class Bar:public Foo{
2913public:Bar():Foo(){}
2914};
2915 ]],[[
2916Foo * myFoo=new Bar();
2917Bar * myBar=dynamic_cast<Bar *>(myFoo);
2918assert(myBar != NULL);
2919 ]])
2920 if test "$ac_cv_require_rtti" = "yes"; then
2921 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
2922 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
fcabe077 2923 fi
3e1ce596
KB
2924
2925 AC_LANG_PUSH([C])
2926 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
fcabe077 2927 AC_LANG_POP([C])
3e1ce596
KB
2928 if test "$ac_cv_require_qcpluscmt" = "yes"; then
2929 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
2930 fi
fcabe077 2931 ;;
3e1ce596 2932
fcabe077
FC
2933 *m88k*)
2934 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
2935 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
2936 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,
2937 [If gettimeofday is known to take only one argument])
2938 ;;
2939 [*-*-solaris2.[0-4]])
2940 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2941 ;;
2942 [*-sony-newsos[56]*])
2943 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2944 ;;
2945 esac
090089c4 2946
57faa85a 2947# Remove optimization for GCC 2.95.[123]
d20b1cd0 2948# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
fcabe077 2949if test "x$GCC" = "xyes"; then
d20b1cd0 2950 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
2951 case "$GCCVER" in
57faa85a 2952 [2.95.[123]])
eed82608 2953 AC_MSG_NOTICE([Removing -O for gcc on $host with GCC $GCCVER])
d20b1cd0 2954 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2955 ;;
2956 esac
2957fi
2958
176d10ee 2959# Recommended by Balint Nagy Endre <bne@CareNet.hu>
2960case "$host" in
fcabe077
FC
2961 *-univel-sysv4.2MP)
2962 if test `uname -v` = "2.03"; then
2963 AC_MSG_NOTICE([disabling mallinfo for $host])
2964 ac_cv_func_mallinfo=no
2965 fi
2966 ;;
176d10ee 2967esac
2968
84cecfd2 2969dnl This has to be before AC_CHECK_FUNCS
2970# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2971# when running configure.
fcabe077
FC
2972if test "x$ac_cv_func_poll" = "x" ; then
2973 case "$host" in
2974 [*-hp-hpux*.*])
2975 # Duane Wessels
2976 AC_MSG_NOTICE([disabling poll for $host...])
2977 ac_cv_func_poll='no'
2978 ;;
2979 [*-linux-*])
2980 # Henrik Nordstrom (hno@squid-cache.org) 19980817
2981 # poll is problematic on Linux. We disable it
2982 # by default until Linux gets it right.
2983 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2984 if test $rev -lt 002002; then
2985 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
2986 ac_cv_func_poll='no'
2987 fi
2988 ;;
2989 [powerpc-ibm-aix4.1.*])
2990 # Mike Laster (mlaster@metavillage.com) 19981021
2991 AC_MSG_NOTICE([disabling poll for $host...])
2992 ac_cv_func_poll='no'
2993 ;;
2994 [*-pc-sco3.2*])
2995 # Robert Side <rside@aiinc.bc.ca>
2996 # Mon, 18 Jan 1999 17:48:00 GMT
2997 AC_MSG_NOTICE([disabling poll for $host...])
2998 ac_cv_func_poll='no'
2999 ;;
3000 esac
84cecfd2 3001fi
176d10ee 3002
78a60bca
AJ
3003dnl Override statfs() detect on MinGW because it is emulated in source code
3004if test "x$squid_host_os" = "xmingw" ; then
fcabe077 3005 ac_cv_func_statfs='yes'
78a60bca 3006fi
08caf8c6 3007
6716b242 3008dnl Check for library functions
3009AC_CHECK_FUNCS(\
ce3d30fb 3010 backtrace_symbols_fd \
3a144521 3011 bcopy \
3012 bswap_16 \
3013 bswap_32 \
f9576890 3014 bswap16 \
3015 bswap32 \
4ac29a5b 3016 fchmod \
6716b242 3017 getdtablesize \
8505e57b 3018 getpagesize \
230c091c 3019 getpass \
3a144521 3020 getrlimit \
30a4f2a8 3021 getrusage \
9c1d8929 3022 getspnam \
379d5751 3023 gettimeofday \
52303a3d 3024 glob \
f9576890 3025 htobe16 \
3026 htole16 \
30a4f2a8 3027 lrand48 \
6716b242 3028 mallinfo \
0f5efab0 3029 mallocblksize \
6716b242 3030 mallopt \
2ae6b9b0 3031 memcpy \
30a4f2a8 3032 memmove \
dac27377 3033 memset \
b99a6dec 3034 mkstemp \
1812b6c7 3035 mktime \
88738790 3036 mstats \
84cecfd2 3037 poll \
62ae0622 3038 prctl \
3a144521 3039 pthread_attr_setschedparam \
cd748f27 3040 pthread_attr_setscope \
3041 pthread_setschedparam \
42b51993 3042 pthread_sigmask \
c68e9c6b 3043 putenv \
b1e77ec1 3044 random \
6716b242 3045 regcomp \
3046 regexec \
3047 regfree \
819656da
AJ
3048 res_init \
3049 __res_init \
4915be3b 3050 rint \
a4ba1105 3051 sbrk \
96c2bb61
AR
3052 sched_getaffinity \
3053 sched_setaffinity \
3a144521 3054 select \
234967c9 3055 seteuid \
c415c128 3056 setgroups \
30a4f2a8 3057 setpgrp \
30a4f2a8 3058 setsid \
3059 sigaction \
11430c03 3060 snprintf \
1ccc0d40 3061 socketpair \
30a4f2a8 3062 srand48 \
b1e77ec1 3063 srandom \
0343b99c 3064 statfs \
6716b242 3065 sysconf \
3066 syslog \
234967c9 3067 timegm \
28da5e0d 3068 vsnprintf \
6716b242 3069)
f5e5c4cf 3070dnl ... and some we provide local replacements for
3071AC_REPLACE_FUNCS(\
3072 drand48 \
a98c2da5 3073 eui64_aton \
cc192b50 3074 inet_ntop \
3075 inet_pton \
f5e5c4cf 3076 initgroups \
cc192b50 3077 getaddrinfo \
3078 getnameinfo \
2ccf2eb2 3079 psignal \
f5e5c4cf 3080 strerror \
585cddda
AJ
3081 strsep \
3082 strtoll \
f5e5c4cf 3083 tempnam \
3084)
6716b242 3085
9676633b
FC
3086# Magic which checks whether we are forcing a type of comm loop we
3087# are actually going to (ab)use.
3088# Mostly ripped from squid-commloops, thanks to adrian and benno
1b3db6d9 3089
fcabe077 3090if test "x$squid_opt_io_loop_engine" != "x"; then
8075a4da 3091 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine])
fcabe077 3092elif test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes" ; then
8075a4da 3093 squid_opt_io_loop_engine="epoll"
26d50fd2 3094elif test "x$enable_kqueue" != "xno" ; then
8075a4da 3095 squid_opt_io_loop_engine="kqueue"
a1ad2f9b
AJ
3096elif test "x$enable_devpoll" != "xno" ; then
3097 squid_opt_io_loop_engine="devpoll"
fcabe077 3098elif test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes" ; then
8075a4da 3099 squid_opt_io_loop_engine="poll"
39145d19 3100elif test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"; then
8075a4da 3101 squid_opt_io_loop_engine="select"
39145d19
AJ
3102elif test "x$enable_select" != "xno" -a "x$squid_host_os" = "xmingw"; then
3103 squid_opt_io_loop_engine="select_win32"
1b3db6d9 3104else
a1ad2f9b 3105 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
be0c7ff0 3106 AC_MSG_WARN([Will try select and hope for the best.])
8075a4da 3107 squid_opt_io_loop_engine="select"
1b3db6d9 3108fi
d474c7a6 3109
8075a4da 3110AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
d474c7a6 3111
8075a4da
FC
3112AM_CONDITIONAL([USE_POLL], [test $squid_opt_io_loop_engine = poll])
3113AM_CONDITIONAL([USE_EPOLL], [test $squid_opt_io_loop_engine = epoll])
3114AM_CONDITIONAL([USE_SELECT], [test $squid_opt_io_loop_engine = select])
8075a4da
FC
3115AM_CONDITIONAL([USE_SELECT_WIN32], [test $squid_opt_io_loop_engine = select_win32])
3116AM_CONDITIONAL([USE_KQUEUE], [test $squid_opt_io_loop_engine = kqueue])
3117AM_CONDITIONAL([USE_DEVPOLL], [test $squid_opt_io_loop_engine = devpoll])
d474c7a6 3118
8075a4da 3119case $squid_opt_io_loop_engine in
0abb39dd 3120 epoll) AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop]) ;;
a1ad2f9b 3121 devpoll) AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop]) ;;
0abb39dd
FC
3122 poll) AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop]) ;;
3123 kqueue) AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop]) ;;
3124 select_win32) AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop]) ;;
3125 select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
d474c7a6 3126esac
1b3db6d9 3127
96c2bb61
AR
3128if test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes" ; then
3129 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
3130fi
3131
91983da0
FC
3132SQUID_CHECK_SETRESUID_WORKS
3133if test "x$squid_cv_resuid_works" = "xyes" ; then
be0c7ff0 3134 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 3135fi
60939927 3136
14c0d3ab
DK
3137AC_MSG_CHECKING([for constant CMSG_SPACE])
3138AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3139 #if HAVE_SYS_SOCKET_H
3140 #include <sys/socket.h>
3141 #endif
3142
3143 int a[CMSG_SPACE(int)];
3144]])], [
3145 AC_MSG_RESULT(yes)
3146 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
3147], [
3148 AC_MSG_RESULT(no)
3149])
3150
0abb39dd
FC
3151SQUID_CHECK_FUNC_STRNSTR
3152SQUID_CHECK_FUNC_VACOPY
3153SQUID_CHECK_FUNC___VACOPY
cee08cbc 3154
c3d0c8b5 3155
5cafc1d6 3156dnl IP-Filter support requires ipf header files. These aren't
3157dnl installed by default, so we need to check for them
fcabe077 3158if test "x$enable_ipf_transparent" != "xno" ; then
20ad76ab 3159 AC_MSG_CHECKING(for availability of IP-Filter header files)
42b51993 3160 # hold on to your hats...
fcabe077
FC
3161 if test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
3162 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
3163 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
3164 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes" ; then
42b51993 3165 have_ipfilter_compat_header="yes"
3166 fi
fcabe077
FC
3167 if test "x$have_ipfilter_compat_header" = "xyes" -a \
3168 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
3169 "x$ac_cv_header_ip_nat_h" = "xyes" ; then
1d26e252 3170 enable_ipf_transparent="yes"
fcabe077
FC
3171 elif test "x$have_ipfilter_compat_header" = "xyes" -a \
3172 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
3173 "x$ac_cv_header_netinet_ip_nat_h" = "xyes" ; then
1d26e252 3174 enable_ipf_transparent="yes"
eb824054 3175 else
1d26e252 3176 enable_ipf_transparent="no"
5cafc1d6 3177 fi
3178 AC_MSG_RESULT($IPF_TRANSPARENT)
1d26e252
FC
3179fi
3180AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
0f658b5b 3181SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
1d26e252
FC
3182 [Enable support for IPF-style transparent proxying])
3183
fcabe077 3184if test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris" ; then
8f6ca20d 3185dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3186dnl Solaris minor version (8, 9, 10, ...)
20ad76ab
FC
3187 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3188 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3189 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
5cafc1d6 3190fi
3191
b2192042
AJ
3192dnl PF /dev/pf support requires a header file.
3193if test "x$with_nat_devpf" != "xno" ; then
fcabe077
FC
3194 if test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
3195 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"; then
b2192042
AJ
3196 if test "x$with_nat_devpf" = "xauto" ; then
3197 with_nat_devpf="no"
fcabe077
FC
3198 fi
3199 else
b2192042
AJ
3200 if test "x$with_nat_devpf" = "xyes" ; then
3201 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
fcabe077 3202 fi
b2192042 3203 with_nat_devpf="no"
fcabe077 3204 fi
2b0dd4ac 3205fi
b2192042 3206SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
38ff0a40 3207 [Enable support for PF-style transparent proxying])
b2192042
AJ
3208SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
3209 [Enable support for /dev/pf NAT lookups])
2b0dd4ac 3210
fcabe077
FC
3211if test "x$enable_linux_netfilter" != "xno" ; then
3212 if test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"; then
3213 if test "x$enable_linux_netfilter" = "xauto" ; then
4bd144d2
FC
3214 enable_linux_netfilter=yes
3215 fi
3216 else
fcabe077 3217 if test "x$enable_linux_netfilter" = "xauto" ; then
4bd144d2 3218 enable_linux_netfilter=no
d852fbad 3219 else
4bd144d2 3220 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
d852fbad 3221 fi
4bd144d2 3222 fi
b50f1b2b 3223fi
0f658b5b 3224SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
969d4051 3225 [Enable support for Transparent Proxy on Linux via Netfilter])
20ad76ab 3226
b50f1b2b 3227dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
4bd144d2 3228AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
fcabe077 3229if test "x$enable_linux_netfilter" = "xyes" -a "x$with_libcap" != "xyes" ; then
3b7a7630
AJ
3230 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
3231 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
3232 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
be0c7ff0 3233 # AC_DEFINEd later
96f08e2d
FC
3234fi
3235
11e8cfe3 3236if test "x$squid_opt_netfilterconntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3b7a7630 3237 AC_MSG_ERROR([Linux netfilter conntrack requires libcap support (libcap 2.09+)])
11e8cfe3
AB
3238fi
3239if test "x$with_netfilter_conntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3b7a7630 3240 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
11e8cfe3
AB
3241 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
3242 with_netfilter_conntrack=no
3243fi
3244AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack} ${squid_opt_netfilterconntrackpath}])
3245
3246
3247AC_ARG_ENABLE(zph-qos,
3248 AS_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]), [
3249SQUID_YESNO([$enableval],
3250 [unrecognized argument to --enable-zph-qos: $enableval])
3251])
3252SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
3253 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
3254 TOS field of HIT responses to help policing network traffic])
3255AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
3256if test x"$enable_zph_qos" = "xyes" ; then
3257 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
3258 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
3259 [Enable support for QOS netfilter mark preservation])
3260fi
3261
3262
0f13ff28 3263AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
cc937513 3264AC_ARG_ENABLE(gnuregex,
a5eb3731
FC
3265 AS_HELP_STRING([--enable-gnuregex],
3266 [Compile GNUregex. Unless you have reason to use
cc937513
AJ
3267 this option, you should not enable it.
3268 This library file is usually only required on Windows and
3269 very old Unix boxes which do not have their own regex
0f13ff28
FC
3270 library built in.]), [
3271SQUID_YESNO([$enableval],[unrecognized argument to --enable-gnuregex: $enableval])
3272])
cdb352bb 3273# force-enable on old solaris and nextstep
fcabe077 3274if test "x${enable_gnuregex:=auto}" = "xauto" ; then
91bc414e 3275 case "$host" in
3276 *-sun-solaris2.[[0-4]])
0f13ff28 3277 enable_gnuregex="yes"
91bc414e 3278 ;;
3279 *-next-nextstep*)
0f13ff28 3280 enable_gnuregex="yes"
91bc414e 3281 ;;
3282 esac
3283fi
7a081912 3284
0f13ff28 3285# try detecting if it is needed
fcabe077 3286if test "x$enable_gnuregex" = "xauto" ; then
91983da0
FC
3287 SQUID_CHECK_REGEX_WORKS
3288 if test "x$squid_cv_regex_works" = "xyes" ; then
3289 enable_gnuregex=no
3290 else
3291 enable_gnuregex=yes
3292 fi
f49be7d1 3293fi
91983da0 3294AC_MSG_CHECKING(if GNUregex needs to be compiled)
0f13ff28 3295AC_MSG_RESULT($enable_gnuregex)
fcabe077 3296if test "x$enable_gnuregex" = "xyes"; then
0f13ff28
FC
3297 # for some reason (force-enable, test..) gnuregex was found as needed. Override any system lib
3298 REGEXLIB=""
80ab193b 3299fi
0f13ff28 3300#if no reason was found to enable gnuregex, disable it
fcabe077 3301if test "x$enable_gnuregex" = "xauto" ; then
0f13ff28 3302 enable_gnuregex=no
a4d7e961 3303fi
0f13ff28 3304SQUID_DEFINE_BOOL(USE_GNUREGEX,$enable_gnuregex,[Define if we should use GNU regex])
26675bf4 3305AC_SUBST(REGEXLIB)
a4d7e961 3306
8e0acaf5
FC
3307SQUID_DETECT_UDP_SND_BUFSIZE
3308SQUID_DETECT_UDP_RECV_BUFSIZE
3309SQUID_DETECT_TCP_SND_BUFSIZE
3310SQUID_DETECT_TCP_RECV_BUFSIZE
6bf65235 3311
fa8be5b5 3312SQUID_CHECK_RECV_ARG_TYPE
5c3c56fa
FC
3313SQUID_CHECK_NEED_SYS_ERRLIST
3314SQUID_CHECK_MAXPATHLEN
cc192b50 3315
819656da
AJ
3316SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
3317SQUID_CHECK_RESOLVER_FIELDS
3318
fcabe077 3319if test "x$ac_cv_header_sys_statvfs_h" = "xyes" ; then
bb214e97 3320 SQUID_CHECK_WORKING_STATVFS
c68e9c6b 3321fi
3322
c68e9c6b 3323
461b8219 3324dnl Squid will usually attempt to translate when packaging or building from VCS
461b8219 3325AC_ARG_ENABLE(translation,
62979ab1 3326 AS_HELP_STRING([--disable-translation],[Prevent Squid generating localized error page templates and manuals.
fb46b778
FC
3327 Which is usually tried, but may not be needed.]), [
3328SQUID_YESNO([$enableval],
3329 [unrecognized argument to --disable-translation: $enableval])
461b8219 3330])
e4b70b44 3331dnl Squid now has .po translation capability, given the right toolkit
fcabe077 3332if test "x${enable_translation:=yes}" = "xyes" ; then
461b8219 3333 AX_WITH_PROG([PO2HTML],[po2html])
02259ff8 3334 AX_WITH_PROG([PO2TEXT],[po2txt])
461b8219
AJ
3335else
3336 PO2HTML="off"
02259ff8 3337 PO2TEXT="off"
461b8219
AJ
3338fi
3339AC_SUBST(PO2HTML)
02259ff8 3340AC_SUBST(PO2TEXT)
ee1a8ac2 3341
43000484
AJ
3342dnl Squid now has limited locale handling ...
3343dnl on error pages
3344AC_ARG_ENABLE(auto-locale,
62979ab1 3345 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
21d5413e 3346 clients request headers.
fb46b778
FC
3347 When disabled Squid requires explicit language configuration.]), [
3348SQUID_YESNO([$enableval],
3349 [unrecognized argument to --disable-auto-locale: $enableval])
8db7a54b 3350])
fb46b778
FC
3351AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
3352SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
3353 [Use multi-language support on error pages])
3354
43000484 3355
090089c4 3356dnl Need the debugging version of malloc if available
3357XTRA_OBJS=''
fcabe077 3358if test "x$ac_cv_lib_malloc_main" = "xyes" ; then
090089c4 3359 if test -r /usr/lib/debug/malloc.o ; then
3360 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3361 fi
3362 if test -r /usr/lib/debug/mallocmap.o ; then
3363 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3364 fi
3365fi
3366AC_SUBST(XTRA_OBJS)
3367
fcabe077 3368if test "x$XTRA_LIBS" = "x"; then
38fea766 3369 XTRA_LIBS="$LIBS"
0f5a16f8 3370 dnl minor cleanup
3371 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 3372 LIBS=''
3373fi
090089c4 3374AC_SUBST(XTRA_LIBS)
3375
daed6927
FC
3376AC_SUBST(SQUID_CFLAGS)
3377AC_SUBST(SQUID_CXXFLAGS)
3378
90b412dd
AJ
3379AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
3380AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
3381AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
3382AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
3383AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
3384AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
3385AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
3386AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
daed6927 3387
090089c4 3388dnl Clean up after OSF/1 core dump bug
3389rm -f core
3390
6a9f6389 3391AC_CONFIG_FILES([\
a2794549 3392 Makefile \
eee95dfe 3393 compat/Makefile \
a2794549 3394 lib/Makefile \
7c16470c 3395 lib/ntlmauth/Makefile \
99742866
FC
3396 lib/libTrie/Makefile \
3397 lib/libTrie/test/Makefile \
25f98340 3398 lib/profiler/Makefile \
7c16470c
AJ
3399 lib/rfcnb/Makefile \
3400 lib/smblib/Makefile \
a2794549 3401 scripts/Makefile \
a2794549 3402 src/Makefile \
0c3d3f65 3403 src/anyp/Makefile \
5bd7a218 3404 src/base/Makefile \
bcf44a2c 3405 src/acl/Makefile \
a2794549 3406 src/fs/Makefile \
3407 src/repl/Makefile \
3408 src/auth/Makefile \
616cfc4c
AJ
3409 src/auth/basic/Makefile \
3410 src/auth/digest/Makefile \
3411 src/auth/negotiate/Makefile \
3412 src/auth/ntlm/Makefile \
5fa840c3 3413 src/adaptation/Makefile \
1f3c65fc
AR
3414 src/adaptation/icap/Makefile \
3415 src/adaptation/ecap/Makefile \
04f55905 3416 src/comm/Makefile \
f99c2cfe 3417 src/esi/Makefile \
ee0927b6 3418 src/eui/Makefile \
38e16f92 3419 src/format/Makefile \
c2a7cefd 3420 src/http/Makefile \
663ff9aa 3421 src/icmp/Makefile \
4daaf3cb 3422 src/ident/Makefile \
f963428c 3423 src/ip/Makefile \
82b7abe3 3424 src/log/Makefile \
40daaeb8 3425 src/ipc/Makefile \
95d2589c 3426 src/ssl/Makefile \
8822ebee 3427 src/mgr/Makefile \
d6e3ad20 3428 src/snmp/Makefile \
a2794549 3429 contrib/Makefile \
3430 snmplib/Makefile \
3431 icons/Makefile \
3432 errors/Makefile \
1077c1b8 3433 test-suite/Makefile \
99db07b3 3434 doc/Makefile \
3faa6da8 3435 doc/manuals/Makefile \
0c510f3c 3436 helpers/Makefile \
3437 helpers/basic_auth/Makefile \
5a48ed18 3438 helpers/basic_auth/DB/Makefile \
c152a447 3439 helpers/basic_auth/fake/Makefile \
5a48ed18 3440 helpers/basic_auth/getpwnam/Makefile \
0c510f3c 3441 helpers/basic_auth/LDAP/Makefile \
3442 helpers/basic_auth/MSNT/Makefile \
5a48ed18 3443 helpers/basic_auth/MSNT-multi-domain/Makefile \
0c510f3c 3444 helpers/basic_auth/NCSA/Makefile \
5a48ed18 3445 helpers/basic_auth/NIS/Makefile \
0c510f3c 3446 helpers/basic_auth/PAM/Makefile \
bcf74be7 3447 helpers/basic_auth/POP3/Makefile \
5a48ed18
AJ
3448 helpers/basic_auth/RADIUS/Makefile \
3449 helpers/basic_auth/SASL/Makefile \
3450 helpers/basic_auth/SMB/Makefile \
3451 helpers/basic_auth/SSPI/Makefile \
0c510f3c 3452 helpers/digest_auth/Makefile \
89f77e43 3453 helpers/digest_auth/eDirectory/Makefile \
54e8823b 3454 helpers/digest_auth/file/Makefile \
56ff4687 3455 helpers/digest_auth/LDAP/Makefile \
0c510f3c 3456 helpers/ntlm_auth/Makefile \
75aa769b 3457 helpers/ntlm_auth/fake/Makefile \
3963d7b1 3458 helpers/ntlm_auth/smb_lm/Makefile \
bc25525a 3459 helpers/ntlm_auth/SSPI/Makefile \
6e785d85 3460 helpers/negotiate_auth/Makefile \
45b2de83 3461 helpers/negotiate_auth/kerberos/Makefile \
8eeb87e6 3462 helpers/negotiate_auth/SSPI/Makefile \
eb3dea38 3463 helpers/negotiate_auth/wrapper/Makefile \
c6588c68 3464 helpers/external_acl/Makefile \
c152a447 3465 helpers/external_acl/AD_group/Makefile \
b283ea3f 3466 helpers/external_acl/eDirectory_userip/Makefile \
c152a447 3467 helpers/external_acl/file_userip/Makefile \
b1218840 3468 helpers/external_acl/kerberos_ldap_group/Makefile \
c152a447
AJ
3469 helpers/external_acl/LDAP_group/Makefile \
3470 helpers/external_acl/LM_group/Makefile \
74ab8d10 3471 helpers/external_acl/session/Makefile \
0f0a89ab 3472 helpers/external_acl/SQL_session/Makefile \
c6588c68 3473 helpers/external_acl/unix_group/Makefile \
736a9a4d 3474 helpers/external_acl/wbinfo_group/Makefile \
9938b57f 3475 helpers/external_acl/time_quota/Makefile \
82b7abe3 3476 helpers/log_daemon/Makefile \
7ce3900c 3477 helpers/log_daemon/DB/Makefile \
82b7abe3 3478 helpers/log_daemon/file/Makefile \
fdbb3b19
AJ
3479 helpers/url_rewrite/Makefile \
3480 helpers/url_rewrite/fake/Makefile \
2cef0ca6 3481 helpers/ssl/Makefile \
0d5ee502
AM
3482 helpers/storeid_rewrite/Makefile \
3483 helpers/storeid_rewrite/file/Makefile \
94ab55b0 3484 tools/Makefile
2ccf2eb2 3485 tools/purge/Makefile
53cbe3e4 3486])
43ae1d95 3487
3e7b6055 3488# must configure libltdl subdir unconditionally for "make distcheck" to work
081863f3 3489#AC_CONFIG_SUBDIRS(libltdl)
3e7b6055 3490
6a9f6389 3491AC_OUTPUT