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