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