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