1 ## Copyright (C) 1996-2021 The Squid Software Foundation and contributors
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.
8 AC_INIT([Squid Web Proxy],[5.2-VCS],[http://bugs.squid-cache.org/],[squid])
10 AC_CONFIG_HEADERS([include/autoconf.h])
11 AC_CONFIG_AUX_DIR(cfgaux)
12 AC_CONFIG_SRCDIR([src/main.cc])
13 AM_INIT_AUTOMAKE([tar-ustar nostdinc subdir-objects dist-xz])
14 AC_REVISION($Revision$)dnl
15 AC_PREFIX_DEFAULT(/usr/local/squid)
18 m4_include([acinclude/ax_with_prog.m4])
19 m4_include([acinclude/init.m4])
20 m4_include([acinclude/squid-util.m4])
21 m4_include([acinclude/compiler-flags.m4])
22 m4_include([acinclude/os-deps.m4])
23 m4_include([acinclude/krb5.m4])
24 m4_include([acinclude/pam.m4])
25 m4_include([acinclude/pkg.m4])
26 m4_include([acinclude/tdb.m4])
27 m4_include([acinclude/lib-checks.m4])
28 m4_include([acinclude/ax_cxx_compile_stdcxx_11.m4])
29 m4_include([acinclude/ax_cxx_0x_types.m4])
31 PRESET_CFLAGS="$CFLAGS"
32 PRESET_CXXFLAGS="$CXXFLAGS"
33 PRESET_LDFLAGS="$LDFLAGS"
35 dnl Set default LDFLAGS
36 if test "x$LDFLAGS" = "x" ; then
47 # Clang 3.2 on some CPUs requires -march-native to detect correctly.
48 # GCC 4.3+ can also produce faster executables when its used.
49 # But building inside a virtual machine environment has been found to
50 # cause random Illegal Instruction errors due to mis-detection of CPU.
51 AC_ARG_ENABLE(arch-native,
52 AS_HELP_STRING([--disable-arch-native],[Some compilers offer CPU-specific
53 optimizations with the -march=native parameter.
54 This flag disables the optimization. The default is to
55 auto-detect compiler support and use where available.]), [
56 SQUID_YESNO([$enableval],
57 [Unrecognized argument to --disable-arch-native: $enableval])
59 AC_MSG_NOTICE([CPU arch native optimization enabled: ${enable_arch_native:=auto}])
60 if test "x${enable_arch_native}" != "xno"; then
61 SQUID_CC_CHECK_ARGUMENT([squid_cv_check_marchnative],[-march=native])
64 # might be cross-compiling.
65 # NP: BUILDCXXFLAGS defined at the end of configure after CXXFLAGS fully known.
66 AC_ARG_VAR([BUILDCXX],[path to compiler for building compile-time tools. e.g. cf_gen])
67 if test "x$HOSTCXX" != "x" -a "x$BUILDCXX" = "x"; then
68 AC_MSG_WARN([Cross-compiling with HOSTCXX is deprecated. Uses BUILDCXX instead.])
71 if test "x$BUILDCXX" = "x"; then
73 if test "x$squid_cv_check_marchnative" = "xyes"; then
74 CXXFLAGS="$CXXFLAGS -march=native"
79 AC_MSG_CHECKING([simplified host os])
80 simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
81 squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
82 if test -n "$squid_host_os_version"; then
83 squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
85 squid_host_os="$simple_host_os"
87 AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
88 # on windows squid_host_os is either mingw or cygwin, version is 32
90 # this needs to be before any test is run, to have more standard
91 # functions available on some Unix sysems (e.g. Solaris)
92 if test "x$squid_host_os" = "solaris" -a "x$GCC" != "x" ; then
93 AC_USE_SYSTEM_EXTENSIONS
96 # If the user did not specify a C++ version.
97 user_cxx=`echo "$PRESET_CXXFLAGS" | grep -o -E "\-std="`
98 if test "x$user_cxx" = "x"; then
99 # Check for C++11 compiler support
100 AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
110 AC_PATH_PROG(SH, sh, /bin/sh)
111 AC_PATH_PROG(FALSE, false, /usr/bin/false)
112 AC_PATH_PROG(TRUE, true, /usr/bin/true)
113 AC_PATH_PROG(MV, mv, $FALSE)
114 AC_PATH_PROG(MKDIR, mkdir, $FALSE)
115 AC_PATH_PROG(LN, ln, cp)
116 AC_PATH_PROG(CHMOD, chmod, $FALSE)
117 AC_PATH_PROG(TR, tr, $FALSE)
118 AC_PATH_PROG(RM, rm, $FALSE)
119 dnl Libtool 2.2.6 requires: rm -f
124 AC_PATH_PROG(PERL, perl, none)
125 if test "x$ac_cv_path_PERL" = "xnone"; then
126 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
128 AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
129 AM_CONDITIONAL(ENABLE_POD2MAN_DOC, test "x${ac_cv_path_POD2MAN}" != "x$FALSE")
131 dnl set $(AR) if not provided by the build environment
132 if test "x$AR" = "x"; then
133 AC_PATH_PROG(AR, ar, $FALSE)
138 AC_PATH_PROG(LINUXDOC, linuxdoc, $FALSE)
139 AM_CONDITIONAL(ENABLE_RELEASE_DOCS, test "x${ac_cv_path_LINUXDOC}" != "x$FALSE")
141 # pre-define DEFAULT_PREFIX, some modules need it.
142 if test "${prefix}" = "NONE" ; then
143 squid_prefix=$ac_default_prefix
147 AC_DEFINE_UNQUOTED(DEFAULT_PREFIX,[$squid_prefix],[The install prefix])
149 AC_ARG_ENABLE(strict-error-checking,
150 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
151 with all possible static compiler error-checks enabled.
152 This flag disables the behavior]), [
153 SQUID_YESNO([$enableval],
154 [Unrecognized argument to --disable-strict-error-checking: $enableval])
156 AC_MSG_NOTICE([strict error checking enabled: ${enable_strict_error_checking:=yes}])
158 AC_MSG_CHECKING(whether to use loadable modules)
159 AC_ARG_ENABLE(loadable-modules,
160 AS_HELP_STRING([--disable-loadable-modules],[do not support loadable modules]) , [
161 SQUID_YESNO([$enableval],
162 [Unrecognized argument to --disable-loadable-modules: $enableval])
164 AM_CONDITIONAL(ENABLE_LOADABLE_MODULES, test "x${enable_loadable_modules:=yes}" = "xyes")
165 AC_MSG_RESULT([$enable_loadable_modules])
167 if test "x$enable_loadable_modules" = "xyes";
169 AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules])
175 # LT_INIT requires libtool v2, might as well state it loud
177 LT_INIT([dlopen],[disable-shared])
178 if ! test "${ac_top_build_prefix}" = "";
180 # LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
181 # But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
182 # This fixes Linux LTDLv3-v7, and BSD LTDL v2.2
183 top_build_prefix=${ac_top_build_prefix}
184 AC_SUBST(top_build_prefix)
188 dnl LibTool environment is now prepared for setup. Check that it is usable and initialize.
191 # Do we need these unconditionally for "make distcheck" to work?
195 if test "x$enable_loadable_modules" = "xyes";
197 # Why is this needed? Should not LT_INIT (or LT_LIB_DLLOAD) from libtool do that?
198 LIBADD_DL=${lt_cv_dlopen_libs}
199 AC_SUBST([LIBADD_DL])
202 SQUID_CC_GUESS_VARIANT
203 SQUID_CC_GUESS_OPTIONS
205 dnl find out the exe extension for this platform.
206 dnl If it is not empty, use it for CGI as well.
210 if test "x$EXEEXT" = "x" ; then
213 # automake automatically adds .exe when installing binaries
218 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,[test "x$squid_host_os" = "xmingw"])
219 AM_CONDITIONAL(ENABLE_WIN32_IPC,[test "x$squid_host_os" = "xmingw"])
221 case "$squid_host_os" in
223 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
224 CFLAGS="$CFLAGS -mthreads"
225 CXXFLAGS="$CXXFLAGS -mthreads -static-libgcc -static-libstdc++"
226 if test "x$ac_cv_path_WIN32_PSAPI" = "xnone"; then
227 AC_MSG_NOTICE([PSAPI.DLL is recommended to run Squid on Windows NT Platform])
228 AC_MSG_NOTICE([Please see PSAPI.DLL section on doc/win32-relnotes.html.])
230 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
233 MINGW_LIBS="-lmingwex"
237 # FreeBSD places local libraries and packages in /usr/local
238 CFLAGS="$CFLAGS -I/usr/local/include"
239 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
240 LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-R/usr/local/lib"
247 AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
249 AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args",
250 [configure command line used to configure Squid])
252 CACHE_EFFECTIVE_USER="nobody"
253 AC_ARG_WITH(default-user,
254 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
255 [ CACHE_EFFECTIVE_USER="$withval" ]
257 AC_SUBST(CACHE_EFFECTIVE_USER)
259 DEFAULT_LOG_DIR="$localstatedir/logs"
261 AS_HELP_STRING([--with-logdir=PATH],
262 [Default location for squid logs. default: PREFIX/var/logs]), [
265 AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH )
268 DEFAULT_LOG_DIR="$withval"
273 AC_SUBST(DEFAULT_LOG_DIR)
275 DEFAULT_PID_FILE="$localstatedir/run/@SERVICE_NAME@.pid"
277 AS_HELP_STRING([--with-pidfile=PATH],
278 [Default location for squid pid file. Default: PREFIX/var/run/squid.pid]), [
281 AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH )
284 DEFAULT_PID_FILE="$withval"
288 AC_SUBST(DEFAULT_PID_FILE)
290 DEFAULT_SWAP_DIR="$localstatedir/cache/squid"
292 AS_HELP_STRING([--with-swapdir=PATH],
293 [Default location for squid cache directories. Default: PREFIX/var/cache/squid]), [
296 AC_MSG_ERROR( --with-swapdir requires a directory PATH. --with-swapdir=PATH )
299 DEFAULT_SWAP_DIR="$withval"
303 AC_SUBST(DEFAULT_SWAP_DIR)
305 dnl Set Default CFLAGS
306 if test "x$PRESET_CFLAGS" = "x"; then
307 if test "$squid_cv_compiler" = "gcc"; then
310 # sunos has too many warnings for this to be useful
314 # Motorola cc/ld does not like -02 but is ok on -O
315 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
318 CFLAGS="$squid_cv_cc_option_wall $CFLAGS"
324 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
325 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
326 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
327 -Wl,-woff,85,-woff,84,-woff,134 \
328 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
329 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
330 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
331 -Wl,-woff,85,-woff,84,-woff,134 \
332 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
340 dnl set squid required flags
341 if test "$squid_cv_compiler" = "gcc"; then
342 case "$squid_host_os" in
344 dnl Guido Serassio (serassio@squid-cache.org) 20070811
345 dnl Using the latest MinGW (gcc 3.4.5 + mingw-runtime 3.13) cannot build with
346 dnl -Werror -Wmissing-prototypes -Wmissing-declarations
347 dnl TODO: check if the problem will be present in any other newer MinGW release.
348 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow"
351 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow"
354 SQUID_CXXFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual"
360 dnl CentOS (and RHEL) still define ntohs() using deprecated C++ features
361 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_wno_deprecated_register],[-Werror -Wno-deprecated-register],[[#include <arpa/inet.h>]],[[int fox=ntohs(1);]])
363 if test "x$enable_strict_error_checking" != "xno"; then
364 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
365 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
368 if test "x$ac_cv_require_wno_deprecated_register" = "xyes"; then
369 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -Wno-deprecated-register"
372 # squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
373 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
374 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
376 # possibly include some build info tag into squid -v
377 SQUID_EMBED_BUILD_INFO
379 AC_ARG_ENABLE(optimizations,
380 AS_HELP_STRING([--disable-optimizations],
381 [Do not compile Squid with compiler optimizations enabled.
382 Optimization is good for production builds, but not
383 good for debugging. During development, use
384 --disable-optimizations to reduce compilation times
385 and allow easier debugging.]), [
386 if test "x$enableval" = "xno" ; then
387 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
388 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
389 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9g]]*//'`"
393 AC_ARG_ENABLE(debug-cbdata,
394 AS_HELP_STRING([--enable-debug-cbdata],
395 [Provide some debug information in cbdata]), [
396 SQUID_YESNO([$enableval],
397 [unrecognized argument to --enable-debug-cbdata: $enableval])
399 SQUID_DEFINE_BOOL(USE_CBDATA_DEBUG,${enable_debug_cbdata:=no},
400 [Enable support for cbdata debug information])
401 AC_MSG_NOTICE([cbdata debugging enabled: $enable_debug_cbdata])
404 dnl Nasty hack to get autoconf 2.64 on Linux to run.
405 dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
406 AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[:])
408 AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
409 AC_ARG_ENABLE(xmalloc-statistics,
410 AS_HELP_STRING([--enable-xmalloc-statistics],
411 [Show malloc statistics in status page]), [
412 SQUID_YESNO([$enableval],
413 [unrecognized argument to --enable-xmalloc-statistics: $enableval])
415 SQUID_DEFINE_BOOL(XMALLOC_STATISTICS,${enable_xmalloc_statistics:=no},
416 [Show malloc statistics in status page])
417 AC_MSG_NOTICE([xmalloc stats display: $enable_xmalloc_statistics])
419 squid_opt_aufs_threads=""
420 AC_ARG_WITH(aufs-threads,
421 AS_HELP_STRING([--with-aufs-threads=N_THREADS],
422 [Tune the number of worker threads for the aufs object store.]), [
425 squid_opt_aufs_threads=$withval
428 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
432 if test "x$squid_opt_aufs_threads" != "x"; then
433 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
434 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
435 [Defines how many threads aufs uses for I/O])
438 AC_ARG_WITH(dl, AS_HELP_STRING([--with-dl],[Use dynamic linking]))
439 if test "x$with_dl" = "xyes"; then
440 AC_MSG_NOTICE([With dl])
443 AC_DEFUN([LIBATOMIC_CHECKER],[
444 AC_MSG_CHECKING(whether linking $1 -latomic works)
450 main(int argc, char **) {
452 std::atomic<uint8_t>(uint8_t(argc)).exchange(0) &&
453 std::atomic<uint64_t>{}.is_lock_free()
458 libatomic_checker_result="yes"],[
460 libatomic_checker_result="no"
463 ## check for atomics library before anything that might need it
464 SQUID_STATE_SAVE(LIBATOMIC)
465 LIBATOMIC_CHECKER(without)
466 AS_IF([test "x$libatomic_checker_result" = "xno"],[
467 LIBS="$LIBS -latomic"
468 LIBATOMIC_CHECKER(with)
469 AS_IF([test "x$libatomic_checker_result" = "xyes"],[
470 ATOMICLIB="-latomic"],[
471 AC_MSG_ERROR([Required library libatomic not found.])
473 SQUID_STATE_ROLLBACK(LIBATOMIC)
476 AC_SEARCH_LIBS([shm_open], [rt])
477 if test "x$ac_cv_search_shm_open" != "xno" ; then
478 AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
481 AC_MSG_CHECKING([for DiskIO modules to be enabled])
482 squid_disk_module_candidates=""
483 squid_opt_enable_diskio="auto" #values: no, yes, "auto"(=yes+detect modules)
484 AC_ARG_ENABLE(disk-io,
485 AS_HELP_STRING([--enable-disk-io="list of modules"],
486 [Build support for the list of disk I/O modules.
487 Set without a value or omitted, all available modules will be built.
488 See src/DiskIO for a list of available modules, or
489 Programmers Guide section on DiskIO
490 for details on how to build your custom disk module]), [
494 #do nothing, "auto" is ok
497 squid_opt_enable_diskio="no"
500 squid_opt_enable_diskio="yes"
501 squid_disk_module_candidates=" `echo $enableval| sed -e 's/,/ /g;s/ */ /g'` "
502 SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
507 # if requested to autodetect, find out what we have
508 if test "x$squid_opt_enable_diskio" = "xauto"; then
509 squid_opt_enable_diskio="yes"
510 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
511 if test "x$ac_cv_search_shm_open" = "xno" ; then
513 squid_disk_module_candidates=`echo $squid_disk_module_candidates|sed 's/IpcIo//'`
517 AC_MSG_RESULT([${squid_disk_module_candidates:-none}])
518 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
519 SQUID_DEFINE_BOOL(USE_DISKIO,$squid_opt_enable_diskio,
520 [DiskIO modules are expected to be available.])
524 dnl Some autoconf.h defines we might enable later...
525 AC_ARG_WITH(pthreads,AS_HELP_STRING([--without-pthreads],[Disable POSIX Threads]))
526 AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO. Default: auto-detect]))
529 squid_opt_use_diskthreads=
532 dnl Setup the module paths etc.
535 AH_TEMPLATE(HAVE_DISKIO_MODULE_AIO, [Whether POSIX AIO Disk I/O module is built])
536 AH_TEMPLATE(HAVE_DISKIO_MODULE_BLOCKING, [Whether Blocking Disk I/O module is built])
537 AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKDAEMON, [Whether DiskDaemon Disk I/O module is built])
538 AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKTHREADS, [Whether DiskThreads Disk I/O module is built])
539 AH_TEMPLATE(HAVE_DISKIO_MODULE_IPCIO, [Whether IpcIo Disk I/O module is built])
540 AH_TEMPLATE(HAVE_DISKIO_MODULE_MMAPPED, [Whether Mmapped Disk I/O module is built])
541 for module in $squid_disk_module_candidates none; do
543 if test "x$module" = "xnone"; then
546 if ! test -d "$srcdir/src/DiskIO/$module"; then
547 AC_MSG_ERROR(disk-io $module does not exist)
552 dnl Check for POSIX AIO availability
553 squid_opt_use_aio="yes"
555 if test "x$with_aio" != "xno"; then
557 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
558 dnl On some systems POSIX AIO functions are in librt
559 dnl On some systems POSIX AIO functions are in libaio
560 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
561 dnl Enable AIO if the library and headers are found
562 if test "x$AIOLIB" != "x" && test "x$have_aio_header" = "xyes"; then
563 AC_MSG_NOTICE([Native POSIX AIO support detected.])
564 squid_opt_use_aio="yes"
566 dnl Windows does things differently. We provide wrappers.
567 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
568 case "$squid_host_os" in
570 squid_opt_use_aio="yes"
571 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
574 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
575 squid_opt_use_aio="no"
580 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
581 squid_opt_use_aio="no"
583 dnl Use the POSIX AIO pieces if we actually need them.
584 if test "x$squid_opt_use_aio" = "xyes" ; then
585 DISK_MODULES="$DISK_MODULES AIO"
586 AC_DEFINE([HAVE_DISKIO_MODULE_AIO],1,[POSIX AIO Disk I/O module is built])
587 case "$squid_host_os" in
590 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
593 AC_MSG_NOTICE([Enabling AIO DiskIO module])
597 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
598 squid_disk_module_candidates_AIO=no
603 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
604 DISK_MODULES="$DISK_MODULES Blocking"
605 AC_DEFINE([HAVE_DISKIO_MODULE_BLOCKING],1,[Blocking Disk I/O module is built])
609 case "$squid_host_os" in
611 AC_MSG_NOTICE(["DiskDaemon not supported on MinGW"])
612 squid_disk_module_candidates_DiskDaemon=no
615 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
616 DISK_MODULES="$DISK_MODULES DiskDaemon"
617 AC_DEFINE([HAVE_DISKIO_MODULE_DISKDAEMON],1,[DiskDaemon Disk I/O module is built])
623 squid_opt_use_diskthreads="yes"
625 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
626 if test "x$with_pthreads" != "xno"; then
627 dnl TODO: this needs to be extended to handle more systems and better
628 dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
629 dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
630 case "$squid_host_os" in
633 AC_MSG_NOTICE([Windows threads support automatically enabled])
636 if test `echo "$squid_host_os_version" | tr -d .` -lt 70 ; then
637 AC_MSG_NOTICE(pthread library requires FreeBSD 7 or later)
638 squid_opt_use_diskthreads="no"
640 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
641 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
642 if test "x$GCC" = "xyes" -a "x$PRESET_LDFLAGS" = "x" ; then
643 LDFLAGS="$LDFLAGS -pthread"
648 if test `echo "$squid_host_os_version" | tr -d .` -lt 52 ; then
649 AC_MSG_NOTICE(pthread library requires OpenBSD 5.2 or later)
650 squid_opt_use_diskthreads="no"
652 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
653 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
654 LDFLAGS="$LDFLAGS -lpthread"
658 if test "x$GCC" = "xyes" ; then
659 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
660 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
661 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
662 AC_MSG_NOTICE(pthread library required but cannot be found.)
663 squid_opt_use_diskthreads="no"
666 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
667 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
668 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
669 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
670 LIBPTHREADS="" #in LIBS
672 AC_MSG_NOTICE(pthread library required but cannot be found.)
673 squid_opt_use_diskthreads="no"
678 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
679 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
680 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
681 AC_MSG_NOTICE(pthread library required but cannot be found.)
682 squid_opt_use_diskthreads="no"
687 AC_MSG_NOTICE([Native pthreads support manually disabled.])
688 squid_opt_use_diskthreads="no"
690 if test "x$squid_opt_use_diskthreads" = "xyes" ; then
691 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
692 DISK_MODULES="$DISK_MODULES DiskThreads"
693 AC_DEFINE([HAVE_DISKIO_MODULE_DISKTHREADS],1,[DiskThreads Disk I/O module is built])
695 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
696 SQUID_STATE_ROLLBACK([diskthreads_state])
697 squid_disk_module_candidates_DiskThreads=no
702 if test "x$ac_cv_search_shm_open" = "xno" ; then
703 AC_MSG_NOTICE([DiskIO IpcIo module requires shared memory support])
704 squid_disk_module_candidates_IpcIo=no
706 AC_MSG_NOTICE([Enabling IpcIo DiskIO module])
707 DISK_MODULES="$DISK_MODULES IpcIo"
708 AC_DEFINE([HAVE_DISKIO_MODULE_IPCIO],1,[IpcIo Disk I/O module is built])
713 dnl TODO: use availability of sys/mman.h and/or mmap to define
714 dnl OR support windows mmap functions
715 if test "x$squid_host_os" = "xmingw" ; then
716 AC_MSG_NOTICE([Mmapped DiskIO is not available on Mingw])
717 squid_disk_module_candidates_Mmapped=no
719 AC_MSG_NOTICE([Enabling Mmapped DiskIO module])
720 DISK_MODULES="$DISK_MODULES Mmapped"
721 AC_DEFINE([HAVE_DISKIO_MODULE_MMAPPED],1,[Mmapped Disk I/O module is built])
726 AC_MSG_NOTICE([Enabling $module DiskIO module])
727 DISK_LIBS="$DISK_LIBS lib${module}.la"
728 DISK_MODULES="$DISK_MODULES ${module}"
732 AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
733 AC_SUBST(DISK_MODULES)
735 AM_CONDITIONAL(ENABLE_DISKIO_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes")
737 AM_CONDITIONAL(ENABLE_WIN32_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes" -a "x$ENABLE_WIN32_AIO" = "x1")
738 AM_CONDITIONAL(ENABLE_DISKIO_BLOCKING, test "x$squid_disk_module_candidates_Blocking" = "xyes")
739 AM_CONDITIONAL(ENABLE_DISKIO_DISKDAEMON, test "x$squid_disk_module_candidates_DiskDaemon" = "xyes")
740 AM_CONDITIONAL(ENABLE_DISKIO_DISKTHREADS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes")
741 AC_SUBST(LIBPTHREADS)
742 AM_CONDITIONAL(ENABLE_WIN32_AIOPS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes" -a "x$ENABLE_WIN32_AIOPS" = "x1")
743 AM_CONDITIONAL(ENABLE_DISKIO_IPCIO, test "x$squid_disk_module_candidates_IpcIo" = "xyes")
744 AM_CONDITIONAL(ENABLE_DISKIO_MMAPPED, test "x$squid_disk_module_candidates_Mmapped" = "xyes")
746 dnl Check what Storage formats are wanted.
747 dnl This version will error out with a message saying why if a required DiskIO is missing.
748 squid_opt_enable_storeio=auto
749 AC_ARG_ENABLE([storeio],
750 AS_HELP_STRING([--enable-storeio="list of modules"],
751 [Build support for the list of store I/O modules.
752 The default is only to build the "ufs" module.
753 See src/fs for a list of available modules, or
754 Programmers Guide section <not yet written>
755 for details on how to build your custom store module]), [
758 squid_opt_enable_storeio=auto
761 squid_opt_enable_storeio=no
764 squid_opt_enable_storeio=yes
765 squid_storeio_module_candidates="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
766 # ufs is really always needed as it has low-level routines
767 # if it is a dupe it will be cleaned-up later
768 squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
772 if test "x$squid_opt_enable_storeio" = "xauto"; then
773 squid_opt_enable_storeio=yes
774 AC_MSG_CHECKING([for available StoreIO modules])
775 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
776 AC_MSG_RESULT([$squid_storeio_module_candidates])
779 SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
780 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
781 AC_MSG_NOTICE([Store modules built: $squid_storeio_module_candidates])
783 for fs in $squid_storeio_module_candidates none; do
786 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
787 "$squid_disk_module_candidates_DiskDaemon" != "yes" ; then
788 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
792 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
793 "$squid_disk_module_candidates_DiskThreads" != "yes" ; then
794 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
798 if test "x$squid_disk_module_candidates_IpcIo" != "xyes" -a \
799 "x$squid_disk_module_candidates_Blocking" != "xyes"; then
800 AC_MSG_ERROR([Storage module Rock requires DiskIO module: Blocking or IpcIo])
802 squid_do_build_rock=true
805 if test "x$squid_disk_module_candidates_Blocking" != "xyes"; then
806 AC_MSG_ERROR([Storage module ufs requires DiskIO module: Blocking])
808 squid_do_build_ufs=true
813 AM_CONDITIONAL(ENABLE_FS_UFS, test "x$squid_do_build_ufs" = "xtrue")
814 AM_CONDITIONAL(ENABLE_FS_ROCK, test "x$squid_do_build_rock" = "xtrue")
815 dnl hack: need to define those even if not used in the build system to
816 dnl make sure that global FS objects are linked to the squid binary.
817 AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
818 AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
819 AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
820 AH_TEMPLATE(HAVE_FS_ROCK, "Define to 1 if rock filesystem module is build")
823 dnl got final squid_storeio_module_candidates, build library lists
824 dnl This list will not be needed when each fs library has its own Makefile
826 dnl File system libraries to link executables with.
827 dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
829 for fs in $squid_storeio_module_candidates; do
830 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
831 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
832 SQUID_TOUPPER_VAR_CONTENTS([fs])
833 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
836 AC_SUBST(STORE_LIBS_TO_BUILD)
837 AC_SUBST(STORE_LIBS_TO_ADD)
838 AC_SUBST(STORE_TESTS)
841 dnl At lest one removal policy is always needed.
842 dnl 'lru' removal policy is currently hard-coded by name for tests
843 dnl so we must set it as default.
845 AC_ARG_ENABLE(removal-policies,
846 AS_HELP_STRING([--enable-removal-policies="list of policies"],
847 [Build support for the list of removal policies.
848 The default is only to build the "lru" module.
849 See src/repl for a list of available modules, or
850 Programmers Guide section 9.9 for details on how
851 to build your custom policy]), [
854 SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES])
859 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
863 if test "x$REPL_POLICIES" != "x" ; then
864 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
865 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
866 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
867 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
869 AC_SUBST(REPL_POLICIES)
873 AM_CONDITIONAL(ENABLE_PINGER, false)
875 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),
876 [ if test "x$enableval" = "xyes" ; then
877 AC_MSG_NOTICE([ICMP enabled])
878 AC_DEFINE(USE_ICMP,1,[Define to use Squid ICMP and Network Measurement features (highly recommended!)])
879 AM_CONDITIONAL(ENABLE_PINGER, true)
883 AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
884 AC_ARG_ENABLE(delay-pools,
885 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),
886 [ if test "x$enableval" = "xyes" ; then
887 AC_MSG_NOTICE([Delay pools enabled])
888 AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
889 AM_CONDITIONAL(ENABLE_DELAY_POOLS, true)
893 dnl disable generic/common adaptation support by default
894 squid_opt_use_adaptation=no
896 squid_opt_use_esi=auto
897 AH_TEMPLATE([USE_SQUID_ESI],[Define to enable the ESI processor])
899 AS_HELP_STRING([--disable-esi],
900 [Disable ESI for accelerators. ESI requires expat or libxml2.
901 Enabling ESI will cause squid reverse proxies to be capable
902 of the Edge Acceleration Specification (www.esi.org).]),
903 [squid_opt_use_esi=$enableval],[])
909 # ESI support libraries: expat
910 AC_ARG_WITH(expat, AS_HELP_STRING([--without-expat],[Do not use expat for ESI. Default: auto-detect]))
911 if test "x$squid_opt_use_esi" != "xno" -a "x$with_expat" != "xno" ; then
912 AC_CHECK_LIB([expat], [main], [EXPATLIB="-lexpat"; HAVE_LIBEXPAT=1])
913 AC_CHECK_HEADERS([expat.h])
914 AC_DEFINE_UNQUOTED(HAVE_LIBEXPAT, $HAVE_LIBEXPAT, [Define to 1 if you have the expat library])
915 AS_IF(test "x$HAVE_LIBEXPAT" = "x1",[
916 squid_opt_use_esi=yes
918 AS_IF(test "x$with_expat" = "xyes",[
919 AC_MSG_ERROR([Required library expat not found.])
921 AC_MSG_NOTICE([Library expat not found.])
926 AC_ARG_WITH(libxml2, AS_HELP_STRING([--without-libxml2],[Do not use libxml2 for ESI. Default: auto-detect]))
927 if test "x$squid_opt_use_esi" != "xno" -a "x$with_libxml2" != "xno" ; then
928 SQUID_STATE_SAVE([squid_libxml2_save])
929 PKG_CHECK_MODULES([LIBXML2],[libxml-2.0],[],[
930 AC_CHECK_LIB([xml2], [main], [LIBXML2_LIBS="$LIBXML2_LIBS -lxml2"])
931 dnl Find the main header and include path...
932 AC_CACHE_CHECK([location of libxml2 include files], [ac_cv_libxml2_include], [
933 AC_CHECK_HEADERS([libxml/parser.h], [], [
934 AC_MSG_NOTICE([Testing in /usr/include/libxml2])
935 SAVED_CPPFLAGS="$CPPFLAGS"
936 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
937 unset ac_cv_header_libxml_parser_h
938 AC_CHECK_HEADERS([libxml/parser.h], [LIBXML2_CFLAGS="$LIBXML2_CFLAGS -I/usr/include/libxml2"], [
939 AC_MSG_NOTICE([Testing in /usr/local/include/libxml2])
940 CPPFLAGS="-I/usr/local/include/libxml2 $SAVED_CPPFLAGS"
941 unset ac_cv_header_libxml_parser_h
942 AC_CHECK_HEADERS([libxml/parser.h], [LIBXML2_CFLAGS="$LIBXML2_CFLAGS -I/usr/local/include/libxml2"], [
943 AC_MSG_NOTICE([Failed to find libxml2 header file libxml/parser.h])
946 CPPFLAGS="$SAVED_CPPFLAGS"
950 CPPFLAGS="$CPPFLAGS $LIBXML2_CFLAGS"
951 dnl Now that we know where to look find the headers...
952 AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
953 SQUID_STATE_ROLLBACK([squid_libxml2_save])
955 if test "x$LIBXML2_LIBS" != "x"; then
957 squid_opt_use_esi=yes
958 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $LIBXML2_CFLAGS"
959 CPPFLAGS="$CPPFLAGS $LIBXML2_CFLAGS"
960 XMLLIB="$LIBXML2_LIBS"
961 AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
962 elif test "x$with_libxml2" = "xyes"; then
963 AC_MSG_ERROR([Required library libxml2 not found])
965 AC_MSG_NOTICE([Library libxml2 not found.])
969 AS_IF([test "x$squid_opt_use_esi" = "xyes"],[
970 AS_IF(test "x$HAVE_LIBXML2" = "x0" -a "x$HAVE_LIBEXPAT" = "x0",[
971 AC_MSG_ERROR([ESI processor requires libxml2 or libexpat])
973 AC_MSG_NOTICE([Enabling ESI processor: $EXPATLIB $XMLLIB])
974 AC_DEFINE(USE_SQUID_ESI,1,[Compile the ESI processor])
976 AS_IF(test "x$squid_opt_use_esi" = "xno",[
977 AC_MSG_NOTICE([Disabling ESI processor.])
979 AC_MSG_NOTICE([Disabling ESI processor. libxml2 and libexpat not found.])
982 AM_CONDITIONAL(ENABLE_ESI, test "x$squid_opt_use_esi" = "xyes")
983 AM_CONDITIONAL(ENABLE_LIBEXPAT, test "x$HAVE_LIBEXPAT" = "x1")
985 AM_CONDITIONAL(ENABLE_LIBXML2, test "x$HAVE_LIBXML2" = "x1")
988 # icap argument handling
989 AC_ARG_ENABLE(icap-client,
990 AS_HELP_STRING([--disable-icap-client],[Disable the ICAP client.]),[
991 SQUID_YESNO([$enableval],[Unrecognized argument to --disable-icap-client: $enableval])
993 SQUID_DEFINE_BOOL(ICAP_CLIENT,${enable_icap_client:=yes}, [Enable ICAP client features in Squid])
994 AS_IF(test "x$enable_icap_client" != "xno", squid_opt_use_adaptation="yes")
995 AM_CONDITIONAL(ENABLE_ICAP_CLIENT, test "x$enable_icap_client" != "xno")
998 AC_MSG_CHECKING(whether to support eCAP)
1000 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]), [
1001 case "${enableval}" in
1002 yes|no) squid_opt_use_ecap=$enableval ;;
1003 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
1005 AC_MSG_RESULT([$squid_opt_use_ecap, explicitly])
1007 squid_opt_use_ecap=no;
1008 AC_MSG_RESULT([$squid_opt_use_ecap, implicitly])
1012 dnl Perform configuration consistency checks for eCAP
1013 if test "x$squid_opt_use_ecap" != "xno";
1015 dnl eCAP support requires loadable modules, which are enabled by default
1016 if test "x$enable_loadable_modules" != "xyes"
1018 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.])
1021 if test -n "$PKG_CONFIG"; then
1022 dnl eCAP support requires libecap.
1023 dnl This Squid supports libecap v1.0.x.
1024 dnl Use EXT_ prefix to distinguish external libecap (that we check for
1025 dnl here) from our own convenience ecap library in Makefiles.
1026 PKG_CHECK_MODULES([EXT_LIBECAP],[libecap >= 1.0 libecap < 1.1])
1028 AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
1031 SQUID_STATE_SAVE(squid_ecap_state)
1032 AC_MSG_CHECKING([whether -lecap will link])
1033 CXXFLAGS="$CXXFLAGS $EXT_LIBECAP_CFLAGS"
1034 LIBS="$LIBS $EXT_LIBECAP_LIBS"
1035 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libecap/common/names.h>]],[[
1036 const libecap::Name test("test", libecap::Name::NextId());
1039 squid_opt_use_adaptation=yes
1043 test "x$squid_opt_use_ecap" = "xyes", AC_MSG_ERROR([eCAP library will not link.
1044 You may need to rebuild libecap using the same version of GCC as Squid.
1045 There have been breaking ABI changes in the libstdc++ STL with GCC 5.]),
1047 [AC_MSG_NOTICE([eCAP library will not link.
1048 You may need to rebuild libecap using the same version of GCC as Squid.
1049 There have been breaking ABI changes in the libstdc++ STL with GCC 5.])
1050 squid_opt_use_ecap="no"
1053 SQUID_STATE_ROLLBACK(squid_ecap_state)
1055 SQUID_DEFINE_BOOL(USE_ECAP,${squid_opt_use_ecap:=no},[Whether to use eCAP support])
1056 AM_CONDITIONAL(ENABLE_ECAP, test "x$squid_opt_use_ecap" = "xyes")
1058 dnl enable adaptation if requested by specific adaptation mechanisms
1060 if test "x$squid_opt_use_adaptation" = "xyes"; then
1061 ADAPTATION_LIBS="adaptation/libadaptation.la"
1063 SQUID_DEFINE_BOOL(USE_ADAPTATION,${squid_opt_use_adaptation:=no}, [common adaptation support])
1064 AM_CONDITIONAL(ENABLE_ADAPTATION, test "x$squid_opt_use_adaptation" = "xyes")
1065 AC_SUBST(ADAPTATION_LIBS)
1067 test "x$squid_host_os" = "xmingw" && enable_wccp=no
1069 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]), [
1070 SQUID_YESNO([$enableval],[unrecognized argument to --disable-wccp: $enableval])
1072 SQUID_DEFINE_BOOL(USE_WCCP, ${enable_wccp:=yes}, [Define to enable WCCP])
1073 AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $enable_wccp])
1075 test "x$squid_host_os" = "xmingw" && enable_wccpv2=no
1076 AC_ARG_ENABLE(wccpv2,
1077 AS_HELP_STRING([--disable-wccpv2],
1078 [Disable Web Cache Coordination V2 Protocol]), [
1079 SQUID_YESNO([$enableval],
1080 [unrecognized argument to --disable-wccpv2: $enableval])
1082 SQUID_DEFINE_BOOL(USE_WCCPv2,${enable_wccpv2:=yes},
1083 [Define to enable WCCP V2])
1084 AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $enable_wccpv2])
1086 AC_ARG_ENABLE(kill-parent-hack,
1087 AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]), [
1088 SQUID_YESNO([$enableval],
1089 [unrecognized argument to --enable-kill-parent-hack: $enableval])
1091 SQUID_DEFINE_BOOL(KILL_PARENT_OPT,${enable_kill_parent_hack:=no},
1092 [A dangerous feature which causes Squid to kill its parent
1093 process (presumably the RunCache script) upon receipt
1094 of SIGTERM or SIGINT. Deprecated, Use with caution.])
1095 AC_MSG_NOTICE([Kill parent on shutdown hack enabled: $enable_kill_parent_hack])
1098 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
1099 SQUID_YESNO([$enableval],
1100 [unrecognized argument to --disable-snmp: $enableval])
1102 SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes},
1103 [Define to enable SNMP monitoring of Squid])
1104 AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
1105 if test "x$enable_snmp" = "xyes"; then
1106 SNMPLIB='../lib/snmplib/libsnmplib.la'
1108 AC_MSG_NOTICE([SNMP support enabled: $enable_snmp])
1111 AC_ARG_ENABLE(cachemgr-hostname,
1112 AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
1113 [Make cachemgr.cgi default to this host.
1114 If unspecified, uses the name of the build-host]), [
1117 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1118 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
1119 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
1125 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
1126 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
1132 AS_HELP_STRING([--disable-eui],
1133 [Disable use of ARP / MAC/ EUI (ether address)]), [
1134 SQUID_YESNO([$enableval],[--disable-eui expects no arguments])
1136 if test "x${enable_eui:=yes}" = "xyes" ; then
1137 SQUID_STATE_SAVE(LIBEUI)
1138 # GLIBC 2.30 deprecates sysctl.h. Test with the same flags that (may) break includes later.
1139 CFLAGS=$SQUID_CFLAGS
1140 CXXFLAGS=$SQUID_CXXFLAGS
1141 case "$squid_host_os" in
1142 linux|solaris|freebsd|openbsd|netbsd|cygwin)
1149 AC_MSG_WARN([EUI support probably will not work on host $host.])
1152 # iphlpapi.h check delayed after winsock2.h
1167 #include <sys/types.h>
1168 #include <sys/socket.h>
1171 # OpenBSD, FreeBSD and NetBSD requires sys/param.h to be included before sysctl.h and net/if_dl.h
1176 #if HAVE_SYS_PARAM_H
1177 #include <sys/param.h>
1180 SQUID_STATE_ROLLBACK(LIBEUI)
1183 AC_MSG_NOTICE([EUI (MAC address) controls enabled: $enable_eui])
1184 SQUID_DEFINE_BOOL(USE_SQUID_EUI,$enable_eui,
1185 [Define this to include code which lets you use ethernet addresses. This code uses API initially defined in 4.4-BSD.])
1186 AM_CONDITIONAL(ENABLE_EUI, [test "x$enable_eui" = "xyes" ])
1190 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]), [
1191 SQUID_YESNO([$enableval],
1192 [unrecognized argument to --disable-htcp: $enableval])
1194 SQUID_DEFINE_BOOL(USE_HTCP,${enable_htcp:=yes},
1195 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
1196 AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
1197 AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
1199 # Cryptograhic libraries
1201 AS_HELP_STRING([--without-nettle],[Compile without the Nettle crypto library.]),[
1202 case "$with_nettle" in
1204 : # Nothing special to do here
1207 if test ! -d "$withval" ; then
1208 AC_MSG_ERROR([--with-nettle path does not point to a directory])
1210 NETTLELIBDIR="-L$with_nettle/lib"
1211 CPPFLAGS="-I$with_nettle/include $CPPFLAGS"
1215 if test "x$with_nettle" != "xno" ; then
1216 AC_CHECK_LIB(nettle, nettle_md5_init,[
1217 NETTLELIB="$NETTLELIBDIR -lnettle"
1218 AC_CHECK_HEADERS(nettle/md5.h)
1220 if test "x$with_nettle" != "xno" ; then
1221 # Base64 uses the nettle 3.4 API
1222 # which matters on 64-bit systems
1223 AC_CHECK_HEADERS(nettle/base64.h)
1224 AC_MSG_CHECKING([for Nettle 3.4 API compatibility])
1225 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1228 # include <nettle/base64.h>
1230 char inData[10]; inData[0] = '\0';
1232 struct base64_decode_ctx ctx;
1233 base64_decode_init(&ctx);
1234 uint8_t outData[10];
1236 if (!base64_decode_update(&ctx, &dstLen, outData, srcLen, inData) ||
1237 !base64_decode_final(&ctx)) {
1240 ]])],[AC_MSG_RESULT(yes)
1241 AC_DEFINE(HAVE_NETTLE34_BASE64,1,[set to 1 if Nettle 3.4 API will link])
1242 ],[AC_MSG_RESULT(no)])
1245 AC_MSG_NOTICE([Using Nettle cryptographic library: ${with_nettle:=yes}])
1248 dnl Check for libcrypt
1250 dnl Some of our helpers use crypt(3) which may be in libc, or in
1251 dnl libcrypt (eg FreeBSD)
1252 AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
1253 dnl Solaris10 provides MD5 natively through libmd5
1254 AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
1259 dnl User may want to disable GnuTLS
1261 AS_HELP_STRING([--without-gnutls],
1262 [Do not use GnuTLS for SSL. Default: auto-detect]), [
1263 case "$with_gnutls" in
1265 : # Nothing special to do here
1268 if test ! -d "$withval" ; then
1269 AC_MSG_ERROR([--with-gnutls path does not point to a directory])
1271 LIBGNUTLS_PATH="-L$with_gnutls/lib"
1272 CPPFLAGS="-I$with_gnutls/include $CPPFLAGS"
1275 AH_TEMPLATE(USE_GNUTLS,[GnuTLS support is available])
1276 if test "x$with_gnutls" != "xno"; then
1277 SQUID_STATE_SAVE(squid_gnutls_state)
1279 # User may have provided a custom location for GnuTLS. Otherwise...
1280 LIBS="$LIBS $LIBGNUTLS_PATH"
1282 # auto-detect using pkg-config
1283 PKG_CHECK_MODULES([LIBGNUTLS],[gnutls >= 3.4.0],[
1284 CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
1286 ## find the package without pkg-config
1287 ## check that the library is actually new enough.
1288 ## by testing for a 3.4.0+ function which we use
1289 AC_CHECK_LIB(gnutls,gnutls_pcert_export_x509,[LIBGNUTLS_LIBS="-lgnutls"])
1291 AC_CHECK_HEADERS(gnutls/gnutls.h gnutls/x509.h gnutls/abstract.h)
1293 SQUID_STATE_ROLLBACK(squid_gnutls_state) #de-pollute LIBS
1295 if test "x$with_gnutls" = "xyes" -a "x$LIBGNUTLS_LIBS" = "x"; then
1296 AC_MSG_ERROR([Required GnuTLS library not found])
1298 if test "x$LIBGNUTLS_LIBS" != "x" ; then
1299 CXXFLAGS="$LIBGNUTLS_CFLAGS $CXXFLAGS"
1300 SSLLIB="$LIBGNUTLS_PATH $LIBGNUTLS_LIBS $SSLLIB"
1301 AC_DEFINE(USE_GNUTLS,1,[GnuTLS support is available])
1306 AC_MSG_NOTICE([GnuTLS library support: ${with_gnutls:=auto} ${LIBGNUTLS_PATH} ${LIBGNUTLS_LIBS}])
1308 dnl User may specify OpenSSL is needed from a non-standard location
1309 AC_ARG_WITH(openssl,
1310 AS_HELP_STRING([--with-openssl=PATH],
1311 [Compile with the OpenSSL libraries. The path to
1312 the OpenSSL development libraries and headers
1313 installation can be specified if outside of the
1314 system standard directories]), [
1315 case "$with_openssl" in
1317 : # Nothing special to do here
1320 if test ! -d "$withval" ; then
1321 AC_MSG_ERROR([--with-openssl path does not point to a directory])
1323 LIBOPENSSL_PATH="-L$with_openssl/lib"
1324 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1328 AH_TEMPLATE(USE_OPENSSL,[OpenSSL support is available])
1329 ## OpenSSL is default disable due to licensing issues on some OS
1330 if test "x$with_openssl" = "xyes"; then
1341 openssl/opensslv.h \
1350 # User may have provided a custom location for OpenSSL. Otherwise...
1351 SQUID_STATE_SAVE(squid_openssl_state)
1352 LIBS="$LIBS $LIBOPENSSL_PATH"
1354 # auto-detect using pkg-config
1355 PKG_CHECK_MODULES([LIBOPENSSL],[openssl],,[
1356 ## For some OS pkg-config is broken or unavailable.
1357 ## Detect libraries the hard way.
1359 # Windows MinGW has some special libraries ...
1360 if test "x$squid_host_os" = "xmingw" ; then
1361 LIBOPENSSL_LIBS='-lssleay32 -leay32 -lgdi32 $LIBOPENSSL_LIBS'
1362 AC_MSG_NOTICE([Windows OpenSSL library support: yes -lssleay32 -leay32 -lgdi32])
1365 AC_CHECK_LIB(crypto,[CRYPTO_new_ex_data],[LIBOPENSSL_LIBS="-lcrypto $LIBOPENSSL_LIBS"],[
1366 AC_MSG_ERROR([library 'crypto' is required for OpenSSL])
1368 AC_CHECK_LIB(ssl,[SSL_CTX_new],[LIBOPENSSL_LIBS="-lssl $LIBOPENSSL_LIBS"],[
1369 AC_MSG_ERROR([library 'ssl' is required for OpenSSL])
1373 # This is a workaround for RedHat 9 brain damage..
1374 if test -d /usr/kerberos/include -a -f /usr/include/openssl/kssl.h; then
1375 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
1376 LIBOPENSSL_LIBS="-L/usr/kerberos/lib $LIBOPENSSL_LIBS"
1377 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1379 SQUID_STATE_ROLLBACK(squid_openssl_state) #de-pollute LIBS
1381 if test "x$LIBOPENSSL_LIBS" != "x"; then
1382 CXXFLAGS="$LIBOPENSSL_CFLAGS $CXXFLAGS"
1383 SSLLIB="$LIBOPENSSL_PATH $LIBOPENSSL_LIBS $SSLLIB"
1384 AC_DEFINE(USE_OPENSSL,1,[OpenSSL support is available])
1386 # check for API functions
1387 SQUID_CHECK_LIBCRYPTO_API
1388 SQUID_CHECK_LIBSSL_API
1389 SQUID_CHECK_OPENSSL_TLS_METHODS
1390 SQUID_STATE_SAVE(check_SSL_CTX_get0_certificate)
1391 LIBS="$LIBS $SSLLIB"
1392 AC_CHECK_LIB(ssl, SSL_CTX_get0_certificate, [
1393 AC_DEFINE(HAVE_SSL_CTX_GET0_CERTIFICATE, 1, [SSL_CTX_get0_certificate is available])
1395 missing_SSL_CTX_get0_certificate=yes
1397 SQUID_STATE_ROLLBACK(check_SSL_CTX_get0_certificate)
1399 # check for other specific broken implementations
1400 if test "x$missing_SSL_CTX_get0_certificate" = "xyes"; then
1401 SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS
1403 SQUID_CHECK_OPENSSL_CONST_SSL_METHOD
1404 SQUID_CHECK_OPENSSL_CONST_CRYPTO_EX_DATA
1405 SQUID_CHECK_OPENSSL_CONST_SSL_SESSION_CB_ARG
1406 SQUID_CHECK_OPENSSL_CONST_X509_GET0_SIGNATURE_ARGS
1407 SQUID_CHECK_OPENSSL_TXTDB
1408 SQUID_CHECK_OPENSSL_HELLO_OVERWRITE_HACK
1410 if test "x$SSLLIB" = "x"; then
1411 AC_MSG_ERROR([Required OpenSSL library not found])
1414 AC_MSG_NOTICE([OpenSSL library support: ${with_openssl:=no} ${LIBOPENSSL_PATH} ${LIBOPENSSL_LIBS}])
1415 AM_CONDITIONAL(ENABLE_SSL,[ test "x$with_openssl" = "xyes" ])
1418 dnl User may specify MIT Kerberos is needed from a non-standard location
1419 AC_ARG_WITH(mit-krb5,
1420 AS_HELP_STRING([--without-mit-krb5],
1421 [Compile without MIT Kerberos support.]), [
1422 case "$with_mit_krb5" in
1424 : # Nothing special to do here
1427 if test ! -d "$withval" ; then
1428 AC_MSG_ERROR([--with-mit-krb5 path does not point to a directory])
1430 if test -d "$with_mit_krb5/lib64" ; then
1431 LIB_KRB5_PATH="-L$with_mit_krb5/lib64 -L$with_mit_krb5/lib"
1433 LIB_KRB5_PATH="-L$with_mit_krb5/lib"
1435 CXXFLAGS="-I$with_mit_krb5/include $CXXFLAGS"
1436 krb5confpath="$with_mit_krb5/bin"
1440 AH_TEMPLATE(USE_APPLE_KRB5,[Apple Kerberos support is available])
1441 AH_TEMPLATE(USE_MIT_KRB5,[MIT Kerberos support is available])
1442 AH_TEMPLATE(USE_SOLARIS_KRB5,[Solaris Kerberos support is available])
1444 ## find out if pkg-config or krb5-config will work
1445 if test "x$with_mit_krb5" != "xno"; then
1446 # find installed libs via pkg-config or krb5-config
1448 PKG_CHECK_EXISTS(mit-krb5-gssapi mit-krb5, [squid_pc_krb5_name="mit-krb5-gssapi mit-krb5"],[
1449 PKG_CHECK_EXISTS(gssapi-krb5 krb5, [squid_pc_krb5_name="gssapi-krb5 krb5"])
1451 if test "x$squid_pc_krb5_name" = "x" -a "$cross_compiling" = "no"; then
1452 # Look for krb5-config (unless cross-compiling)
1453 AC_PATH_PROG(krb5_config,krb5-config,no,$krb5confpath)
1454 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1455 krb5confpath="`dirname $ac_cv_path_krb5_config`"
1456 ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
1457 ac_solaris="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i solaris`"
1458 ac_apple="`$ac_cv_path_krb5_config --vendor 2>/dev/null | grep -c -i apple`"
1459 if test $ac_solaris -gt 0 ; then
1460 with_solaris_krb5=yes
1461 elif test $ac_apple -gt 0 ; then
1463 elif test $ac_heimdal -gt 0; then
1465 if test "x$with_mit_krb5" = "xyes"; then
1466 AC_MSG_ERROR([Could not find pkg-config or krb5-config for MIT Kerberos])
1470 if test "x$with_mit_krb5" = "xyes"; then
1471 AC_MSG_ERROR([Could not find krb5-config in path])
1479 # detect MIT Kerberos dependencies (except on Solaris)
1480 if test "x$with_mit_krb5" != "xno" -a "x$with_solaris_krb5" != "xyes"; then
1481 SQUID_STATE_SAVE([squid_krb5_save])
1482 LIBS="$LIBS $LIB_KRB5_PATH"
1484 # auto-detect using pkg-config
1485 PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
1486 # look for krb5-config (unless cross-compiling)
1487 if test "$cross_compiling" = "no"; then
1488 if test "x$krb5confpath" = "x" ; then
1489 AC_PATH_PROG(krb5_config,krb5-config,no)
1490 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1491 ac_krb5_config="$ac_cv_path_krb5_config"
1494 ac_krb5_config="$krb5confpath/krb5-config"
1497 if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
1499 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1500 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1501 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1502 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1503 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1505 ## For some OS pkg-config is broken or unavailable.
1506 ## Detect libraries the hard way.
1508 SQUID_STATE_SAVE([squid_mit_save])
1510 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1511 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
1512 AC_MSG_WARN([library 'com_err' is required for MIT Kerberos])
1513 missing_required=yes
1516 AC_CHECK_LIB(k5crypto, [main], [LIB_KRB5_LIBS="-lk5crypto $LIB_KRB5_LIBS"],[
1517 AC_MSG_WARN([library 'k5crypto' is required for MIT Kerberos])
1518 missing_required=yes
1521 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1522 AC_MSG_WARN([library 'krb5' is required for MIT Kerberos])
1523 missing_required=yes
1526 AC_CHECK_LIB(gssapi_krb5, [main], [LIB_KRB5_LIBS="-lgssapi_krb5 $LIB_KRB5_LIBS"],[
1527 AC_MSG_WARN([library 'gssapi_krb5' is required for MIT Kerberos])
1528 missing_required=yes
1530 SQUID_STATE_ROLLBACK([squid_mit_save])
1531 if test "x$missing_required" = "xyes"; then
1537 if test "x$LIB_KRB5_LIBS" != "x"; then
1538 if test "x$with_apple_krb5" = "xyes" ; then
1539 AC_DEFINE(USE_APPLE_KRB5,1,[Apple Kerberos support is available])
1540 KRB5_FLAVOUR="Apple"
1542 AC_DEFINE(USE_MIT_KRB5,1,[MIT Kerberos support is available])
1545 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1546 KRB5INCS="$LIB_KRB5_CFLAGS"
1548 # check for other specific broken implementations
1549 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1550 LIBS="$LIBS $KRB5LIBS"
1552 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1553 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1554 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
1555 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1556 AC_CHECK_HEADERS(profile.h)
1558 SQUID_CHECK_KRB5_FUNCS
1560 if test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1561 AC_MSG_ERROR([Required Kerberos library not found])
1562 elif test "x$KRB5LIBS" = "x"; then
1566 SQUID_STATE_ROLLBACK([squid_krb5_save])
1569 # detect Solaris Kerberos dependencies
1570 if test "x$with_solaris_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1571 SQUID_STATE_SAVE([squid_krb5_save])
1572 LIBS="$LIBS $LIB_KRB5_PATH"
1574 # no pkg-config for solaris native Kerberos
1575 # look for krb5-config (unless cross-compiling)
1576 if test "$cross_compiling" = "no"; then
1577 if test "x$krb5confpath" = "x" ; then
1578 AC_PATH_PROG(krb5_config,krb5-config,no)
1579 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1580 ac_krb5_config="$ac_cv_path_krb5_config"
1583 ac_krb5_config="$krb5confpath/krb5-config"
1586 if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
1588 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1589 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1590 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1591 # Solaris 10 Update 11 patches the krb5-config tool to produce stderr messages on stdout.
1592 SOLARIS_BROKEN_KRB5CONFIG_GSSAPI="`$ac_krb5_config --libs gssapi 2>/dev/null | grep "krb5-config"`"
1593 if test "x$SOLARIS_BROKEN_KRB5CONFIG_GSSAPI" = "x"; then
1594 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1595 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1598 ## For some OS pkg-config is broken or unavailable.
1599 ## Detect libraries the hard way.
1601 CXXFLAGS="-I/usr/include/kerberosv5 $CXXFLAGS"
1603 SQUID_STATE_SAVE([squid_solaris_save])
1605 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1606 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1607 AC_MSG_WARN([library 'krb5' is required for Solaris Kerberos])
1608 missing_required=yes
1611 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
1612 AC_MSG_WARN([library 'gss' is required for Solaris Kerberos])
1613 missing_required=yes
1615 SQUID_STATE_ROLLBACK([squid_solaris_save])
1616 if test "x$missing_required" = "xyes"; then
1621 if test "x$LIB_KRB5_LIBS" != "x"; then
1622 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1623 KRB5INCS="$LIB_KRB5_CFLAGS"
1624 AC_DEFINE(USE_SOLARIS_KRB5,1,[Solaris Kerberos support is available])
1625 KRB5_FLAVOUR="Solaris"
1627 # check for other specific broken implementations
1628 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1629 LIBS="$LIBS $KRB5LIBS"
1631 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1632 AC_CHECK_HEADERS(gssapi/gssapi.h gssapi/gssapi_ext.h)
1633 AC_CHECK_HEADERS(krb5.h com_err.h)
1635 SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H
1636 if test "x$squid_cv_broken_krb5_h" = "xyes"; then
1637 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if Solaris krb5.h is broken for C++])
1638 AC_MSG_WARN([You have a broken Solaris <krb5.h> system include.])
1639 AC_MSG_WARN([Please see http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512])
1640 AC_MSG_WARN([If you need Kerberos support you will have to patch])
1641 AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch])
1643 SQUID_CHECK_KRB5_FUNCS
1645 if test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1646 # Error only if Solaris flavour was detected while looking for required MIT Kerberos
1647 AC_MSG_ERROR([Required Kerberos library not found])
1648 elif test "x$KRB5LIBS" = "x"; then
1649 with_solaris_krb5=no
1652 SQUID_STATE_ROLLBACK([squid_krb5_save])
1655 dnl User may specify Heimdal Kerberos is needed from a non-standard location
1656 AC_ARG_WITH(heimdal-krb5,
1657 AS_HELP_STRING([--without-heimdal-krb5],
1658 [Compile without Heimdal Kerberos support.]), [
1659 case "$with_heimdal_krb5" in
1661 : # Nothing special to do here
1664 if test ! -d "$withval" ; then
1665 AC_MSG_ERROR([--with-heimdal-krb5 path does not point to a directory])
1667 if test -d "$with_heimdal_krb5/lib64" ; then
1668 LIB_KRB5_PATH="-L$with_heimdal_krb5/lib64 -L$with_heimdal_krb5/lib"
1670 LIB_KRB5_PATH="-L$with_heimdal_krb5/lib"
1672 CXXFLAGS="-I$with_heimdal_krb5/include $CXXFLAGS"
1673 krb5confpath="$with_heimdal_krb5/bin"
1674 with_heimdal_krb5=yes
1677 AH_TEMPLATE(USE_HEIMDAL_KRB5,[Heimdal Kerberos support is available])
1678 if test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"; then
1679 # find installed libs via pkg-config or krb5-config
1680 PKG_CHECK_EXISTS(heimdal-krb5, [squid_pc_krb5_name="heimdal-krb5"])
1681 if test "x$squid_pc_krb5_name" = "x"; then
1682 PKG_CHECK_EXISTS(heimdal-gssapi, [squid_pc_krb5_name="heimdal-gssapi"])
1684 if test "x$squid_pc_krb5_name" = "x" -a "$cross_compiling" = "no"; then
1685 # Look for krb5-config (unless cross-compiling)
1686 AC_PATH_PROG(krb5_config,krb5-config,no,$krb5confpath)
1687 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1688 krb5confpath="`dirname $ac_cv_path_krb5_config`"
1689 ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
1690 if test "x$with_heimdal_krb5" = "xyes" -a $ac_heimdal = 0; then
1691 AC_MSG_ERROR([Could not find pkg-config or krb5-config for Heimdal Kerberos])
1694 if test "x$with_heimdal_krb5" = "xyes"; then
1695 AC_MSG_ERROR([Could not find krb5-config in path])
1697 AC_MSG_WARN([Could not find krb5-config in path])
1698 with_heimdal_krb5=no
1703 if test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"; then
1704 SQUID_STATE_SAVE([squid_krb5_save])
1705 LIBS="$LIBS $LIB_KRB5_PATH"
1707 # auto-detect using pkg-config
1708 PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
1709 # look for krb5-config (unless cross-compiling)
1710 if test "$cross_compiling" = "no"; then
1711 if test "x$krb5confpath" = "x" ; then
1712 AC_PATH_PROG(krb5_config,krb5-config,no)
1713 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1714 ac_krb5_config="$ac_cv_path_krb5_config"
1717 ac_krb5_config="$krb5confpath/krb5-config"
1720 if test "x$ac_krb5_config" != "x" -a -x "$ac_krb5_config"; then
1722 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1723 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1724 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1725 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1726 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1728 ## For some OS pkg-config is broken or unavailable.
1729 ## Detect libraries the hard way.
1730 SQUID_STATE_SAVE([squid_heimdal_save])
1732 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1733 AC_CHECK_LIB(resolv, [main], [LIB_KRB5_LIBS="-lresolv $LIB_KRB5_LIBS"],[
1734 AC_MSG_WARN([library 'resolv' is required for Heimdal Kerberos])
1735 missing_required=yes
1738 AC_CHECK_LIB(crypt, [main], [LIB_KRB5_LIBS="-lcrypt $LIB_KRB5_LIBS"],[
1739 AC_MSG_WARN([library 'crypt' is required for Heimdal Kerberos])
1740 missing_required=yes
1743 AC_CHECK_LIB(roken, [main], [LIB_KRB5_LIBS="-lroken $LIB_KRB5_LIBS"],[
1744 AC_MSG_WARN([library 'roken' is required for Heimdal Kerberos])
1745 missing_required=yes
1748 AC_CHECK_LIB(heimbase, [main], [LIB_KRB5_LIBS="-lheimbase $LIB_KRB5_LIBS"],[
1749 AC_MSG_WARN([library 'heimbase' may be required for Heimdal Kerberos])
1752 AC_CHECK_LIB(wind, [main], [LIB_KRB5_LIBS="-lwind $LIB_KRB5_LIBS"],[
1753 AC_MSG_WARN([library 'wind' may be required for Heimdal Kerberos])
1756 AC_CHECK_LIB(crypto, [main], [LIB_KRB5_LIBS="-lcrypto $LIB_KRB5_LIBS"],[
1757 AC_MSG_WARN([library 'crypto' is required for Heimdal Kerberos])
1758 missing_required=yes
1761 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
1762 AC_MSG_WARN([library 'com_err' is required for Heimdal Kerberos])
1763 missing_required=yes
1766 AC_CHECK_LIB(hx509, [main], [LIB_KRB5_LIBS="-lhx509 $LIB_KRB5_LIBS"],[
1767 AC_MSG_WARN([library 'hx509' may be required for Heimdal Kerberos])
1770 AC_CHECK_LIB(asn1, [main], [LIB_KRB5_LIBS="-lasn1 $LIB_KRB5_LIBS"],[
1771 AC_MSG_WARN([library 'asn1' is required for Heimdal Kerberos])
1772 missing_required=yes
1775 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1776 AC_MSG_WARN([library 'krb5' is required for Heimdal Kerberos])
1777 missing_required=yes
1780 AC_CHECK_LIB(heimntlm, [main], [LIB_KRB5_LIBS="-lheimntlm $LIB_KRB5_LIBS"],[
1781 AC_MSG_WARN([library 'heimntlm' may be required for Heimdal Kerberos])
1784 AC_CHECK_LIB(gssapi, [main], [LIB_KRB5_LIBS="-lgssapi $LIB_KRB5_LIBS"],[
1785 AC_MSG_WARN([library 'gssapi' is required for Heimdal Kerberos])
1786 missing_required=yes
1788 SQUID_STATE_ROLLBACK([squid_heimdal_save])
1789 if test "x$missing_required" = "xyes"; then
1794 if test "x$LIB_KRB5_LIBS" != "x"; then
1795 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1796 KRB5INCS="$LIB_KRB5_CFLAGS"
1797 AC_DEFINE(USE_HEIMDAL_KRB5,1,[Heimdal Kerberos support is available])
1798 KRB5_FLAVOUR="Heimdal"
1800 # check for other specific broken implementations
1801 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1802 LIBS="$LIBS $KRB5LIBS"
1804 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1805 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1806 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1808 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1809 if test "x$squid_cv_broken_heimdal_krb5_h" = "xyes"; then
1810 AC_DEFINE(HAVE_BROKEN_HEIMDAL_KRB5_H, 1, [Define to 1 if Heimdal krb5.h is broken for C++])
1812 SQUID_CHECK_KRB5_FUNCS
1814 if test "x$KRB5LIBS" = "x"; then
1815 if test "x$with_heimdal_krb5" = "xyes"; then
1816 AC_MSG_ERROR([Required Heimdal Kerberos library not found])
1818 AC_MSG_WARN([Heimdal Kerberos library not found])
1821 SQUID_STATE_ROLLBACK([squid_krb5_save])
1824 dnl User may specify GNU gss is needed from a non-standard location
1826 AS_HELP_STRING([--without-gnugss],
1827 [Compile without the GNU gss libraries.]), [
1828 case "$with_gnugss" in
1830 : # Nothing special to do here
1833 if test ! -d "$withval" ; then
1834 AC_MSG_ERROR([--with-gnugss path does not point to a directory])
1836 if test ! -d "$with_gnugss/lib64" ; then
1837 LIB_KRB5_PATH="-L$with_gnugss/lib64 -L$with_gnugss/lib"
1839 LIB_KRB5_PATH="-L$with_gnugss/lib"
1841 CXXFLAGS="-I$with_gnugss/include $CXXFLAGS"
1846 AH_TEMPLATE(USE_GNUGSS,[GNU gss support is available])
1847 if test "x$with_gnugss" != "xno" -a "x$KRB5LIBS" = "x"; then
1848 SQUID_STATE_SAVE([squid_krb5_save])
1849 LIBS="$LIBS $LIB_KRB5_PATH"
1851 # auto-detect using pkg-config
1852 PKG_CHECK_MODULES([LIB_KRB5],[gss],,[
1853 ## For some OS pkg-config is broken or unavailable.
1854 ## Detect libraries the hard way.
1856 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1857 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
1858 AC_MSG_WARN([library 'com_err' is required for GNU Kerberos])
1862 if test "x$LIB_KRB5_LIBS" != "x"; then
1863 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1864 KRB5INCS="$LIB_KRB5_CFLAGS"
1865 AC_DEFINE(USE_GNUGSS,1,[GNU Kerberos support is available])
1866 KRB5_FLAVOUR="GNU GSS"
1868 # check for other specific broken implementations
1869 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1870 LIBS="$LIBS $KRB5LIBS"
1872 AC_MSG_NOTICE([Try to find Kerbeors headers in given path])
1873 AC_CHECK_HEADERS(gss.h)
1875 SQUID_CHECK_WORKING_GSSAPI
1876 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1878 SQUID_CHECK_SPNEGO_SUPPORT
1879 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1881 SQUID_CHECK_WORKING_KRB5
1882 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1884 if test "x$KRB5LIBS" = "x"; then
1885 if test "x$with_gnugss" = "xyes"; then
1886 AC_MSG_ERROR([Required GNU GSS Kerberos library not found])
1888 AC_MSG_WARN([GNU GSS Kerberos library not found])
1891 SQUID_STATE_ROLLBACK([squid_krb5_save])
1894 if test "x$KRB5LIBS" != "x"; then
1897 AC_MSG_NOTICE([$KRB5_FLAVOUR Kerberos library support: ${with_krb5:=no} ${LIB_KRB5_PATH} ${LIB_KRB5_LIBS}])
1901 dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
1902 dnl only with Windows LDAP libraries using -lwldap32
1903 case "$squid_host_os" in
1909 AC_CHECK_LIB(ldap, ldap_init, [LDAPLIB="-lldap"])
1910 dnl LDAP helpers need to know if -llber is needed or not
1911 AC_CHECK_LIB(lber, ber_init, [LBERLIB="-llber"])
1912 dnl if no ldap lib found check for mozilla version
1913 if test "x$ac_cv_lib_ldap_ldap_init" != x""yes; then
1916 AC_CHECK_LIB(ldap60, ldap_init, [LDAPLIB="-lldap60"])
1917 LIBS="$LDAPLIB $LIBPTHREADS"
1918 AC_CHECK_LIB(prldap60, prldap_init, [LDAPLIB="-lprldap60 $LDAPLIB"])
1919 LIBS="$LDAPLIB $LIBPTHREADS"
1920 AC_CHECK_LIB(ssldap60, ldapssl_init, [LDAPLIB="-lssldap60 $LDAPLIB"])
1924 AC_CHECK_HEADERS(ldap.h lber.h)
1925 AC_CHECK_HEADERS(mozldap/ldap.h)
1928 dnl Check for LDAP_OPT_DEBUG_LEVEL
1930 AC_MSG_CHECKING([for LDAP_OPT_DEBUG_LEVEL])
1931 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1934 int i=LDAP_OPT_DEBUG_LEVEL
1936 [ AC_MSG_RESULT(yes) ],
1937 [ AC_MSG_RESULT(no) ])
1940 dnl Check for working ldap
1943 LIBS="$LDAPLIB $LBERLIB $LIBPTHREADS"
1944 AC_MSG_CHECKING([for working ldap])
1945 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1946 # define LDAP_DEPRECATED 1
1949 # elif HAVE_MOZLDAP_LDAP_H
1950 # include <mozldap/ldap.h>
1958 ldap_init((const char *)&host, port);
1963 [ AC_DEFINE(HAVE_LDAP, 1, [LDAP support])
1964 AC_MSG_RESULT(yes) ],
1965 [ AC_MSG_RESULT(no) ],
1966 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1970 dnl Check for ldap vendor
1972 AC_MSG_CHECKING([for OpenLDAP])
1973 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1977 # include <string.h>
1981 return strcmp(LDAP_VENDOR_NAME,"OpenLDAP");
1984 [ AC_DEFINE(HAVE_OPENLDAP, 1, [OpenLDAP support])
1985 AC_MSG_RESULT(yes) ],
1986 [ AC_MSG_RESULT(no) ],
1987 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1989 AC_MSG_CHECKING([for Sun LDAP SDK])
1990 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1994 # include <string.h>
1998 return strcmp(LDAP_VENDOR_NAME,"Sun Microsystems Inc.");
2001 [ AC_DEFINE(HAVE_SUN_LDAP_SDK, 1, [Sun LDAP SDK support])
2002 AC_MSG_RESULT(yes) ],
2003 [ AC_MSG_RESULT(no) ],
2004 [ AC_MSG_RESULT(cross-compiler cant tell) ])
2006 AC_MSG_CHECKING([for Mozilla LDAP SDK])
2007 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2010 # elif HAVE_MOZLDAP_LDAP_H
2011 # include <mozldap/ldap.h>
2013 # include <string.h>
2017 return strcmp(LDAP_VENDOR_NAME,"mozilla.org");
2020 [ AC_DEFINE(HAVE_MOZILLA_LDAP_SDK, 1, [Mozilla LDAP SDK support])
2021 AC_MSG_RESULT(yes) ],
2022 [ AC_MSG_RESULT(no)],
2023 [ AC_MSG_RESULT(cross-compiler cant tell) ])
2026 dnl Check for LDAP_REBINDPROC_CALLBACK
2028 AC_MSG_CHECKING([for LDAP_REBINDPROC_CALLBACK])
2029 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2032 # elif HAVE_MOZLDAP_LDAP_H
2033 # include <mozldap/ldap.h>
2036 LDAP_REBINDPROC_CALLBACK ldap_rebind;
2038 [ AC_DEFINE(HAVE_LDAP_REBINDPROC_CALLBACK,1,[Define to 1 if you have LDAP_REBINDPROC_CALLBACK])
2039 AC_MSG_RESULT(yes) ],
2040 [ AC_MSG_RESULT(no) ])
2043 dnl Check for LDAP_REBIND_PROC
2045 AC_MSG_CHECKING([for LDAP_REBIND_PROC])
2046 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2049 # elif HAVE_MOZLDAP_LDAP_H
2050 # include <mozldap/ldap.h>
2053 LDAP_REBIND_PROC ldap_rebind;
2055 [ AC_DEFINE(HAVE_LDAP_REBIND_PROC,1,[Define to 1 if you have LDAP_REBIND_PROC])
2056 AC_MSG_RESULT(yes) ],
2057 [ AC_MSG_RESULT(no) ])
2060 dnl Check for LDAP_REBIND_FUNCTION
2062 AC_MSG_CHECKING([for LDAP_REBIND_FUNCTION])
2063 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2064 # define LDAP_REFERRALS
2067 # elif HAVE_MOZLDAP_LDAP_H
2068 # include <mozldap/ldap.h>
2071 LDAP_REBIND_FUNCTION ldap_rebind;
2073 [ AC_DEFINE(HAVE_LDAP_REBIND_FUNCTION,1,[Define to 1 if you have LDAP_REBIND_FUNCTION])
2074 AC_MSG_RESULT(yes) ],
2075 [ AC_MSG_RESULT(no) ])
2078 dnl Check for LDAP_SCOPE_DEFAULT
2080 AC_MSG_CHECKING([for LDAP_SCOPE_DEFAULT])
2081 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2084 # elif HAVE_MOZLDAP_LDAP_H
2085 # include <mozldap/ldap.h>
2088 int i=LDAP_SCOPE_DEFAULT;
2090 [ AC_DEFINE(HAVE_LDAP_SCOPE_DEFAULT,1,[Define to 1 if you have LDAP_SCOPE_DEFAULT])
2091 AC_MSG_RESULT(yes) ],
2092 [ AC_MSG_RESULT(no) ])
2095 dnl Check for ldap_url_desc.lud_scheme
2097 AC_CHECK_MEMBER(struct ldap_url_desc.lud_scheme,
2098 AC_DEFINE(HAVE_LDAP_URL_LUD_SCHEME,1,
2099 [Define to 1 if you have LDAPURLDesc.lud_scheme]),,[#include <ldap.h>])
2102 dnl Check for ldapssl_client_init
2104 AC_CHECK_LIB(ldap,ldapssl_client_init,
2105 AC_DEFINE(HAVE_LDAPSSL_CLIENT_INIT,1,[Define to 1 if you have ldapssl_client_init]),)
2108 dnl Check for ldap_url_desc2str
2110 AC_CHECK_LIB(ldap,ldap_url_desc2str,
2111 AC_DEFINE(HAVE_LDAP_URL_DESC2STR,1,[Define to 1 if you have ldap_url_desc2str]),)
2114 dnl Check for ldap_url_parse
2116 AC_CHECK_LIB(ldap,ldap_url_parse,
2117 AC_DEFINE(HAVE_LDAP_URL_PARSE,1,[Define to 1 if you have ldap_url_parse]),)
2120 dnl Check for ldap_start_tls_s
2122 AC_CHECK_LIB(ldap,ldap_start_tls_s,
2123 AC_DEFINE(HAVE_LDAP_START_TLS_S,1,[Define to 1 if you have ldap_start_tls_s]),)
2130 AC_ARG_WITH(systemd,
2131 AS_HELP_STRING([--without-systemd],
2132 [Do not use systemd API to send start-up completion
2133 notification. Default: auto-detect]), [
2134 case "$with_systemd" in
2136 : # Nothing special to do here
2139 if test ! -d "$withval" ; then
2140 AC_MSG_ERROR([--with-systemd path does not point to a directory])
2142 SYSTEMD_PATH="-L$with_systemd/lib"
2143 CPPFLAGS="-I$with_systemd/include $CPPFLAGS"
2146 AH_TEMPLATE(USE_SYSTEMD,[systemd support is available])
2147 if test "x$with_systemd" != "xno" -a "x$squid_host_os" = "xlinux"; then
2148 SQUID_STATE_SAVE(squid_systemd_state)
2150 # User may have provided a custom location for systemd. Otherwise...
2151 LIBS="$LIBS $SYSTEMD_PATH"
2153 # auto-detect using pkg-config
2154 PKG_CHECK_MODULES(SYSTEMD,[libsystemd],,[
2156 PKG_CHECK_MODULES(SYSTEMD,[libsystemd-daemon],,[:])
2159 AC_CHECK_HEADERS(systemd/sd-daemon.h)
2161 SQUID_STATE_ROLLBACK(squid_systemd_state) #de-pollute LIBS
2163 if test "x$with_systemd" = "xyes" -a "x$SYSTEMD_LIBS" = "x"; then
2164 AC_MSG_ERROR([Required systemd library not found])
2166 if test "x$SYSTEMD_LIBS" != "x" ; then
2167 CXXFLAGS="$SYSTEMD_CFLAGS $CXXFLAGS"
2168 AC_DEFINE(USE_SYSTEMD,1,[systemd support is available])
2173 AC_MSG_NOTICE([systemd library support: ${with_systemd:=auto} ${SYSTEMD_PATH} ${SYSTEMD_LIBS}])
2175 AC_ARG_ENABLE(forw-via-db,
2176 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
2177 SQUID_YESNO([$enableval],[unrecognized argument to --enable-forw-via-db: $enableval])
2179 SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
2180 [Enable Forw/Via database])
2181 AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
2183 AC_ARG_ENABLE(cache-digests,
2184 AS_HELP_STRING([--enable-cache-digests],
2185 [Use Cache Digests. See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
2187 SQUID_YESNO($enableval,
2188 [unrecognized argument to --enable-cache-digests: $enableval])
2190 SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
2191 [Use Cache Digests for locating objects in neighbor caches.])
2192 AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
2195 ################################
2196 # check for netio plugin stuff #
2197 ################################
2198 dnl order of these options handling is relevant in case the user
2199 dnl supplies more than one --enable option. Options handled later
2200 dnl override those handled earlier for io loop method manual override
2201 AC_ARG_ENABLE(select,
2202 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),
2204 SQUID_YESNO($enableval,[--disable-select takes no extra argument])
2205 if test "x$enableval" = "xyes"; then
2206 if test "x$squid_host_os" = "xmingw"; then
2207 squid_opt_io_loop_engine="select_win32"
2209 squid_opt_io_loop_engine="select"
2213 AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
2216 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
2218 SQUID_YESNO($enableval,[--disable-poll takes no extra argument])
2219 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="poll"
2221 AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
2223 AC_ARG_ENABLE(kqueue,
2224 AS_HELP_STRING([--disable-kqueue],
2225 [Disable kqueue(2) support.]), [
2226 SQUID_YESNO($enableval,[--enable-kqueue takes no extra argument])
2228 if test "x${enable_kqueue:=auto}" != "xno" ; then
2229 AC_CHECK_HEADERS([sys/event.h],[],[
2230 if test "x${enable_kqueue}" = "xyes" ; then
2231 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
2234 AC_CHECK_FUNCS(kqueue,[],[
2235 if test "x${enable_kqueue}" = "xyes" ; then
2236 AC_MSG_ERROR([kqueue support missing in libc library.])
2239 if test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes" ; then
2240 squid_opt_io_loop_engine="kqueue"
2245 AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
2248 AC_ARG_ENABLE(epoll,
2249 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
2251 SQUID_YESNO($enableval,[--disable-epoll takes no extra argument])
2252 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="epoll"
2254 AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
2256 # auto-detect and verify epoll header and library present and working
2257 # logic mapping and loop method selection are performed later
2258 if test "x$enable_epoll" != "xno" ; then
2260 # check if libs are needed to support epoll
2261 # note: this code block seems quite generic. Could it be extracted
2262 # into a squid specific configure function?
2263 SQUID_STATE_SAVE(squid_epoll_state)
2264 AC_SEARCH_LIBS(epoll_ctl,[epoll])
2265 if test "x$ac_cv_search_epoll_ctl" = "xno" ; then
2266 enable_epoll=no #disable. Needed code not found
2267 elif test "x$ac_cv_search_epoll_ctl" = "xnone required" ; then
2270 EPOLL_LIBS=$ac_cv_search_epoll_ctl
2272 AC_SUBST(EPOLL_LIBS)
2273 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
2275 # epoll requires sys/epoll.h
2276 AC_CHECK_HEADERS([sys/epoll.h])
2278 dnl Verify that epoll really works
2279 if test "x$ac_cv_search_epoll_ctl" != 'xno' ; then
2283 if test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno" ; then
2284 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
2288 dnl Enable /dev/poll
2289 AC_ARG_ENABLE(devpoll,
2290 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),
2292 SQUID_YESNO($enableval,[--disable-devpoll takes no extra argument])
2293 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="devpoll"
2295 AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
2297 ## auto-detect and verify devpoll header and library present and working
2298 if test "x$enable_devpoll" != "xno"; then
2300 # /dev/poll requires ioctl() and write()
2301 AC_CHECK_FUNCS(ioctl)
2302 AC_CHECK_FUNCS(write)
2304 # /dev/poll requires sys/devpoll.h
2305 AC_CHECK_HEADERS([sys/devpoll.h],,[
2306 if test "x$enable_devpoll" = "xyes"; then
2307 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
2311 # Verify that /dev/poll really works
2312 if test "x$enable_devpoll" != 'xno' ; then
2316 if test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno" ; then
2317 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
2322 AC_ARG_ENABLE(http-violations,
2323 AS_HELP_STRING([--disable-http-violations],
2324 [This allows you to remove code which is known to
2325 violate the HTTP protocol specification.]), [
2326 SQUID_YESNO([$enableval],
2327 [unrecognized argument to --disable-http-violations: $enableval])
2329 SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
2330 [Define to enable code which volates the HTTP standard specification])
2331 AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
2333 # IPFW Transparent Proxy
2334 AC_ARG_ENABLE(ipfw-transparent,
2335 AS_HELP_STRING([--enable-ipfw-transparent],
2336 [Enable Transparent Proxy support for systems
2337 using FreeBSD IPFW-style firewalling.]), [
2338 SQUID_YESNO([$enableval],
2339 [unrecognized argument to --enable-ipfw-transparent: $enableval])
2341 SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
2342 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
2343 AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
2345 # IP-Filter Transparent Proxy
2346 AC_ARG_ENABLE(ipf-transparent,
2347 AS_HELP_STRING([--enable-ipf-transparent],
2348 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
2349 SQUID_YESNO([$enableval],
2350 [unrecognized argument to --enable-ipf-transparent: $enableval])
2352 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2353 #IPF currently broken. Default-disabled for now.
2354 AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
2356 dnl Enable PF Transparent Proxy
2357 AC_ARG_ENABLE(pf-transparent,
2358 AS_HELP_STRING([--enable-pf-transparent],
2359 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
2360 SQUID_YESNO([$enableval],
2361 [unrecognized argument to --enable-pf-transparent: $enableval])
2363 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2364 AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
2366 dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
2367 AC_ARG_WITH(nat-devpf,
2368 AS_HELP_STRING([--with-nat-devpf],
2369 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
2370 SQUID_YESNO([$enableval],
2371 [unrecognized argument to --with-nat-devpf: $enableval])
2373 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2374 AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
2376 # Linux Netfilter Transparent Proxy
2377 AC_ARG_ENABLE(linux-netfilter,
2378 AS_HELP_STRING([--enable-linux-netfilter],
2379 [Enable Transparent Proxy support for Linux (Netfilter)]), [
2380 SQUID_YESNO([$enableval],
2381 [unrecognized argument to --enable-linux-netfilter: $enableval])
2383 AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
2384 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2387 dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
2388 dnl squid_opt_netfilterconntrack is set only when option is explicity specified
2389 AC_ARG_WITH(netfilter-conntrack,
2390 AS_HELP_STRING([--without-netfilter-conntrack],
2391 [Do not use Netfilter conntrack libraries for packet marking.
2392 A path to alternative library location may be specified by
2393 using --with-netfilter-conntrack=PATH. Default: auto-detect.]), [
2394 case "$with_netfilter_conntrack" in
2396 squid_opt_netfilterconntrack=$with_netfilter_conntrack
2399 if test ! -d "$withval" ; then
2400 AC_MSG_ERROR([--with-netfilter-conntrack path does not point to a directory])
2402 squid_opt_netfilterconntrackpath=$withval
2403 LDFLAGS="-L$squid_opt_netfilterconntrackpath/lib $LDFLAGS"
2404 CPPFLAGS="-I$squid_opt_netfilterconntrackpath/include $CPPFLAGS"
2405 with_netfilter_conntrack=yes
2406 squid_opt_netfilterconntrack=yes
2409 AC_MSG_NOTICE([Linux Netfilter Conntrack support requested: ${with_netfilter_conntrack:=auto}])
2410 if test "x$with_netfilter_conntrack" != "xno"; then
2411 AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
2412 if test x"$with_netfilter_conntrack" = "xyes"; then
2413 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack library not found])
2415 with_netfilter_conntrack=no])
2416 AC_CHECK_HEADERS([libnetfilter_conntrack/libnetfilter_conntrack.h \
2417 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h],,[
2418 if test x"$with_netfilter_conntrack" = "xyes"; then
2419 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack headers not found])
2421 with_netfilter_conntrack=no])
2422 # If nothing is broken; enable the libraries usage.
2423 if test "x$with_netfilter_conntrack" != "xno"; then
2424 with_netfilter_conntrack=yes
2429 dnl Enable Large file support
2431 squid_opt_enable_large_files=no
2433 AC_ARG_WITH(large-files,
2434 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
2435 if test "x$withval" = "xyes"; then
2436 squid_opt_enable_large_files=yes
2440 dnl UNIX Build environment
2441 dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
2442 AC_ARG_WITH(build-environment,
2443 AS_HELP_STRING([--with-build-environment=model],
2444 [The build environment to use. Normally one of
2445 POSIX_V6_ILP32_OFF32 (32 bits),
2446 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
2447 POSIX_V6_LP64_OFF64 (64 bits),
2448 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
2449 XBS5_ILP32_OFF32 i(legacy, 32 bits),
2450 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
2451 XBS5_LP64_OFF64 (legacy, 64 bits),
2452 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
2453 or default (The default for your OS)]), [
2456 AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])
2459 buildmodel="$withval"
2464 #hack. Let's early-detect sizeof(long)
2465 AC_CHECK_SIZEOF(long)
2467 if test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"; then
2468 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
2469 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
2474 if test "x$buildmodel" = "x"; then
2475 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
2478 if test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"; then
2479 # define _FILE_OFFSET_BITS if requested and needed
2480 if test "x$squid_opt_enable_large_files" = "xyes" -a $ac_cv_sizeof_long -le 4 ; then
2481 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
2482 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
2483 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
2486 AC_MSG_NOTICE([Using $buildmodel build environment])
2487 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
2490 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
2492 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
2493 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
2494 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
2495 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
2496 if test "x$squid_host_os" = "xsolaris" ; then
2498 # On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
2499 # for LDFLAGS -xarch=generic64, but:
2500 # "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
2501 # For gcc "-xarch=generic64" must be replaced with "-m64"
2502 # The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
2503 if test "x$GCC" = "xyes"; then
2504 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
2505 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
2506 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
2507 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
2508 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2509 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2510 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
2512 AC_MSG_NOTICE([Removing -Usun on $host])
2513 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
2514 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
2518 dnl Enable Leak Finding Functions
2519 AC_ARG_ENABLE(leakfinder,
2520 AS_HELP_STRING([--enable-leakfinder],
2521 [Enable Leak Finding code. Enabling this alone does nothing;
2522 you also have to modify the source code to use the leak
2523 finding functions. Probably Useful for hackers only.]), [
2524 SQUID_YESNO([$enableval],
2525 [unrecognized argument to --enable-leakfinder: $enableval])
2527 AC_MSG_NOTICE([Leak Finder enabled: ${enable_leakfinder:=no}])
2528 SQUID_DEFINE_BOOL(USE_LEAKFINDER,$enable_leakfinder,
2529 [Enable code for assisting in finding memory leaks. Not for the faint of heart])
2530 AM_CONDITIONAL(ENABLE_LEAKFINDER, [test "x$enable_leakfinder" = "xyes"])
2533 AC_ARG_ENABLE(follow-x-forwarded-for,
2534 AS_HELP_STRING([--enable-follow-x-forwarded-for],
2535 [Enable support for following the X-Forwarded-For
2536 HTTP header to try to find the IP address of the
2537 original or indirect client when a request has
2538 been forwarded through other proxies.]), [
2539 SQUID_YESNO([$enableval],
2540 [unrecognized argument to --enable-follow-x-forwarded-for: $enableval])
2542 AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
2543 SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
2544 [Enable following X-Forwarded-For headers])
2546 AC_ARG_ENABLE(ident-lookups,
2547 AS_HELP_STRING([--disable-ident-lookups],
2548 [Remove code that supports performing Ident (RFC 931) lookups.]), [
2549 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ident-lookups: $enableval])
2551 AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
2552 SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
2554 dnl Select Default hosts file location
2555 AC_ARG_ENABLE(default-hostsfile,
2556 AS_HELP_STRING([--enable-default-hostsfile=path],
2557 [Select default location for hosts file.
2558 See hosts_file directive in squid.conf for details]), [
2559 if test "x$enableval" != "xnone" -a "x$enableval" != "xno" ; then
2560 if test \! -f "$enableval"; then
2561 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
2563 squid_opt_default_hosts=$enableval
2565 squid_opt_default_hosts="none"
2568 AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
2569 DEFAULT_HOSTS=$squid_opt_default_hosts
2570 AC_SUBST(DEFAULT_HOSTS)
2572 # Select auth schemes modules to build
2574 AS_HELP_STRING([--enable-auth],
2575 [Build global support for authentication. The list of schemes
2576 and helpers to be enabled is defined elsewhere]), [
2577 SQUID_YESNO([$enableval],
2578 [unrecognized argument to --enable-auth: $enableval])
2580 AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
2581 SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
2582 AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
2586 AC_ARG_ENABLE(auth-basic,
2587 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
2588 [Enable the basic authentication scheme, and build the specified helpers.
2589 Not providing an explicit list of helpers will attempt build of
2590 all possible helpers. Default is to do so.
2591 To disable the basic authentication scheme, use --disable-auth-basic.
2592 To enable but build no helpers, specify "none".
2593 To see available helpers, see the src/auth/basic/ directory. ]),[
2594 #nothing to do really
2596 m4_include([src/auth/basic/helpers.m4])
2598 AC_ARG_ENABLE(auth-digest,
2599 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
2600 [Enable the Digest authentication scheme, and build the specified helpers.
2601 Not providing an explicit list of helpers will attempt build of
2602 all possible helpers. Default is to do so.
2603 To disable the Digest authentication scheme, use --disable-auth-digest.
2604 To enable but build no helpers, specify "none".
2605 To see available helpers, see the src/auth/digest/ directory. ]),[
2606 #nothing to do, really
2608 m4_include([src/auth/digest/helpers.m4])
2610 AC_ARG_ENABLE(auth-negotiate,
2611 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
2612 [Enable the Negotiate authentication scheme, and build the specified
2614 Not providing an explicit list of helpers will attempt build of
2615 all possible helpers. Default is to do so.
2616 To disable the Negotiate authentication scheme,
2617 use --disable-auth-negotiate.
2618 To enable but build no helpers, specify "none".
2619 To see available helpers, see the src/auth/negotiate/ directory. ]),[
2620 #nothing to do, really
2622 m4_include([src/auth/negotiate/helpers.m4])
2624 AC_ARG_ENABLE(auth-ntlm,
2625 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
2626 [Enable the NTLM authentication scheme, and build the specified helpers.
2627 Not providing an explicit list of helpers will attempt build of
2628 all possible helpers. Default is to do so.
2629 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
2630 To enable but build no helpers, specify "none".
2631 To see available helpers, see the src/auth/ntlm/ directory. ]),[
2633 m4_include([src/auth/ntlm/helpers.m4])
2635 dnl Authentication libraries to build
2636 dnl This list will not be needed when each auth library has its own Makefile
2637 dnl this is to be placed AFTER each auth module's handler
2639 for module in $AUTH_MODULES; do
2640 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
2642 AC_SUBST(AUTH_MODULES)
2643 AC_SUBST(AUTH_LIBS_TO_BUILD)
2644 AM_CONDITIONAL(ENABLE_SMBLIB, test "x$require_smblib" = "xyes")
2646 dnl Select logging daemon helpers to build
2647 AC_ARG_ENABLE(log-daemon-helpers,
2648 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
2649 [This option selects which logging daemon helpers to
2650 build and install as part of the normal build process
2651 For a list of available helpers see the src/log/
2653 #nothing to do, really
2655 m4_include([src/log/helpers.m4])
2657 AC_ARG_ENABLE(external-acl-helpers,
2658 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
2659 [Enable external_acl helpers support and the helpers themselves.
2660 Default is to build all buildable helpers and enable support.
2661 To disable support, use --disable-external-acl-helpers.
2662 To build no helpers, specify "none".
2663 To see available helpers, see the src/acl/external/
2665 #nothing to do, really
2667 m4_include([src/acl/external/helpers.m4])
2669 dnl Select url_rewrite helpers to build
2670 AC_ARG_ENABLE(url-rewrite-helpers,
2671 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
2672 [This option selects which url_rewrite helpers to
2673 build and install as part of the normal build
2674 process. The default is to attempt the build of all possible
2675 helpers. Use --disable-url-rewrite-helpers to build none.
2676 For a list of available helpers see the
2677 src/http/url_rewriters/ directory.]),[
2679 m4_include([src/http/url_rewriters/helpers.m4])
2681 dnl Select security helpers to build
2682 AC_ARG_ENABLE(security-cert-validators,
2683 AS_HELP_STRING([--enable-security-cert-validators="list of helpers"],
2684 [This option selects which security certificate validator
2685 helpers to build and install as part of the normal build
2686 process. The default is to attempt the build of all possible
2687 helpers. Use --disable-security-cert-validators to
2688 build none. For a list of available helpers see the
2689 src/security/cert_validators/ directory.]),[
2691 m4_include([src/security/cert_validators/helpers.m4])
2693 AC_ARG_ENABLE(security-cert-generators,
2694 AS_HELP_STRING([--enable-security-cert-generators="list of helpers"],
2695 [This option selects which security certificate validator
2696 helpers to build and install as part of the normal build
2697 process. The default is to attempt the build of all possible
2698 helpers. Use --disable-security-cert-genrators to
2699 build none. For a list of available helpers see the
2700 src/security/cert_generators/ directory.]),[
2702 m4_include([src/security/cert_generators/helpers.m4])
2704 dnl Select storeid_rewrite helpers to build
2705 AC_ARG_ENABLE(storeid-rewrite-helpers,
2706 AS_HELP_STRING([--enable-storeid-rewrite-helpers="list of helpers"],
2707 [This option selects which Store-ID rewrite helpers to
2708 build and install as part of the normal build
2709 process. The default is to attempt the build of all possible
2710 helpers. Use --disable-storeid-rewrite-helpers to build none.
2711 For a list of available helpers see the
2712 src/store/id_rewriters/ directory.]),[
2714 m4_include([src/store/id_rewriters/helpers.m4])
2716 AC_ARG_WITH(valgrind-debug,
2717 AS_HELP_STRING([--with-valgrind-debug],
2718 [Include debug instrumentation for use with valgrind]),
2720 SQUID_YESNO([$withval],
2721 [unrecognized argument to --with-valgrind-debug: $withval])
2722 if test "x$withval" != "xno" ; then
2723 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
2724 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
2728 SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
2729 [Valgrind memory debugger support])
2730 AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
2732 dnl Enable WIN32 Service compile mode
2733 AC_ARG_ENABLE(win32-service,
2734 AS_HELP_STRING([--enable-win32-service],
2735 [Compile Squid as a WIN32 Service.
2736 Works only on MS-Windows platforms]), [
2737 SQUID_YESNO([$enableval],
2738 [unrecognized argument to --enable-win32-service: $enableval])
2740 SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
2741 [Enable code supporting MS Windows service mode])
2742 AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
2745 # Disable "unlinkd" code
2746 AC_ARG_ENABLE(unlinkd,
2747 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
2748 SQUID_YESNO([$enableval],
2749 [unrecognized argument to --disable-unlinkd: $enableval])
2751 SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
2752 [Enable useage of unlinkd])
2753 AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
2754 AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
2756 # Enable backtraces on fatal errors
2757 AC_ARG_ENABLE(stacktraces,
2758 AS_HELP_STRING([--enable-stacktraces],
2759 [Enable automatic call backtrace on fatal errors]), [
2760 SQUID_YESNO([$enableval],
2761 [unrecognized argument to --enable-stacktraces: $enableval])
2763 SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
2764 [Print stack traces on fatal errors])
2765 AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
2768 # CPU Profiling options handling
2769 AC_ARG_ENABLE(cpu-profiling,
2770 AS_HELP_STRING([--enable-cpu-profiling],
2771 [Enable instrumentation to try and understand how CPU power
2772 is spent by squid, by enabling specific probes in selected
2774 New probes can only be added by modifying the source code.
2775 It is meant to help developers in optimizing performance
2776 of Squid internal functions.
2777 If you are not developer you should not enable this,
2778 as it slows squid down somewhat.
2779 See lib/Profiler.c for more details.]), [
2780 SQUID_YESNO([$enableval],
2781 [unrecognized argument to --enable-cpu-profiling: $enableval])
2783 # Default OFF. This is a debug feature. Only check and enable if forced ON.
2784 if test "x$enable_cpu_profiling" = "xyes"; then
2785 AC_CHECK_FUNCS(clock_gettime_nsec_np)
2786 SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
2787 if test "x$squid_cv_cpu_profiler_works" = "xno"; then
2788 AC_MSG_ERROR([CPU profiling will not be functional in this build.])
2791 SQUID_DEFINE_BOOL(USE_XPROF_STATS,${enable_cpu_profiling:=no},
2792 [Define to enable CPU profiling within Squid])
2793 AM_CONDITIONAL(ENABLE_XPROF_STATS,
2794 test "x$enable_cpu_profiling" = "xyes")
2795 AC_MSG_NOTICE([CPU profiling enabled: $enable_cpu_profiling])
2797 # Enable X-Accelerator-Vary for Vary support within an accelerator setup
2798 AC_ARG_ENABLE(x-accelerator-vary,
2799 AS_HELP_STRING([--enable-x-accelerator-vary],
2800 [Enable support for the X-Accelerator-Vary
2801 HTTP header. Can be used to indicate
2802 variance within an accelerator setup.
2803 Typically used together with other code
2804 that adds custom HTTP headers to the requests.]), [
2805 SQUID_YESNO([$enableval],
2806 [unrecognized argument to --enable-x-accelerator-vary: $enableval])
2808 SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
2809 [Enable support for the X-Accelerator-Vary HTTP header])
2810 AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
2812 AC_ARG_WITH([cppunit], AS_HELP_STRING([--without-cppunit],[Do not use cppunit test framework]),[
2813 AS_CASE($with_cppunit, [yes|no],[],
2815 AS_IF([test ! -d "$withval"],AC_MSG_ERROR([--with-cppunit PATH does not point to a directory]))
2816 LIBCPPUNIT_CFLAGS="-I$with_cppunit/include"
2817 LIBCPPUNIT_LIBS="-L$with_cppunit/lib -lcppunit"
2820 AS_IF([test "x$with_cppunit" != "xno"],[
2821 PKG_CHECK_MODULES([LIBCPPUNIT],[cppunit],[
2822 squid_cv_cppunit_version="`pkg-config cppunit --version`"
2823 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
2824 AS_UNSET(squid_cv_cppunit_version)
2826 SQUID_STATE_SAVE(squid_cppunit_state)
2827 CXXFLAGS="${CXXFLAGS} ${LIBCPPUNIT_CFLAGS}"
2828 LIBS="${LIBS} ${LIBCPPUNIT_LIBS}"
2829 AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
2830 SQUID_STATE_ROLLBACK(squid_cppunit_state)
2832 AC_MSG_WARN([cppunit does not appear to be installed. Squid does not require this, but code testing with 'make check' will fail.])
2836 # Force some compilers to use ANSI features
2840 if test "x$ac_cv_prog_CC" = "xcc" ; then
2841 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
2849 dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
2853 AC_MSG_NOTICE([Disabling ranlib for HP-UX...])
2858 dnl Check for headers
2883 linux/posix_types.h \
2891 netinet/in_systm.h \
2941 linux/netfilter_ipv4.h \
2942 linux/netfilter_ipv6/ip6_tables.h \
2944 SQUID_DEFAULT_INCLUDES
2948 /* Netfilter ip(6)tables v1.4.0 has broken headers */
2949 #if HAVE_NETINET_IN_H
2950 #include <netinet/in.h>
2954 dnl *BSD do not include the dependencies for all their net/ and netinet/ files
2955 dnl We must include a few basic type headers for them to work.
2970 SQUID_BSDNET_INCLUDES)
2976 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2979 #include <sys/time.h>
2986 dnl Override rusage() detect on MinGW because is emulated in source code
2987 case "$squid_host_os" in
2989 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2990 ac_cv_func_getrusage='yes'
2991 AC_MSG_NOTICE([Using own rusage on Windows.])
2994 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
2996 #include <sys/time.h>
2998 #if HAVE_SYS_RESOURCE_H
2999 #include <sys/resource.h>
3004 AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
3005 #if HAVE_SYS_TYPES_H
3006 #include <sys/types.h>
3008 #include <netinet/in.h>
3009 #include <netinet/in_systm.h>
3010 #include <netinet/ip.h>
3011 #if defined (__linux__) || defined (__CYGWIN__)
3020 dnl Check for typedefs
3021 AC_CHECK_SIZEOF(void *)
3023 # check for a bunch of types
3037 AC_CHECK_TYPE([bool])
3038 #need the defines for PRId64
3039 AC_CHECK_SIZEOF(int64_t)
3040 AC_CHECK_SIZEOF(long)
3041 #need the defines for PRIuSIZE
3042 AC_CHECK_SIZEOF(size_t)
3043 #need the define for overflow checks
3044 AC_CHECK_SIZEOF(off_t)
3045 AC_CHECK_SIZEOF(size_t)
3047 dnl Some C++11 types we try to use
3049 AX_CXX_TYPE_UNIQUE_PTR
3050 AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS
3051 SQUID_CXX_STD_UNDERLYING_TYPE
3053 dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
3054 dnl that is incompatible with the updated Solaris header files.
3055 dnl For this reason, we must check if pad128_t and upad128_t are defined.
3056 AC_CHECK_TYPE(pad128_t,
3057 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
3058 ,SQUID_DEFAULT_INCLUDES)
3060 AC_CHECK_TYPE(upad128_t,
3061 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
3062 ,SQUID_DEFAULT_INCLUDES)
3064 AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
3065 AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
3067 AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
3068 #include <sys/types.h>
3069 #include <sys/socket.h>
3075 AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
3076 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
3077 #include <sys/ipc.h>
3078 #include <sys/msg.h>])
3080 AC_CHECK_TYPE(cpu_set_t,
3081 AC_DEFINE(HAVE_CPU_SET_T,1,[cpu_set_t is defined by the system headers]),,[
3087 # check for compiler support of %zu printf macro
3088 AH_TEMPLATE(PRIuSIZE,[Compiler supports %zu printf macro])
3089 AC_MSG_CHECKING([for compiler %zu support])
3090 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3092 ]],[[size_t n=1;printf("%zu",n);]])],[
3093 AC_DEFINE(PRIuSIZE,"zu")
3095 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
3098 dnl Check for special functions
3102 dnl Check for libcap header (assume its not broken unless
3103 AC_ARG_WITH(libcap, AS_HELP_STRING([--without-libcap],
3104 [disable usage of Linux capabilities library to control privileges]), [
3105 SQUID_YESNO([$withval],[unrecognized argument to --without-libcap: $withval])
3106 ],[with_libcap=auto])
3108 if test "x$with_libcap" != "xno"; then
3109 # cap_clear_flag is the most recent libcap function we require
3110 AC_CHECK_HEADERS(sys/capability.h)
3111 AC_CHECK_LIB(cap, cap_clear_flag)
3112 SQUID_CHECK_FUNCTIONAL_LIBCAP2
3114 # if it can't be supported..
3115 if test "x$ac_cv_header_sys_capability_h" = "xno" -o \
3116 "x$ac_cv_lib_cap_cap_clear_flag" = "xno"; then
3117 # and it was forced on: error
3118 if test "x$with_libcap" = "xyes" ; then
3119 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
3121 # with_libcap is "auto"; it can't be supported. Disable.
3125 # header and lib are ok, we support
3131 SQUID_DEFINE_BOOL(USE_LIBCAP,$with_libcap,
3132 [use libcap to set capabilities required for TPROXY])
3133 AC_MSG_NOTICE([libcap support enabled: $with_libcap])
3134 SQUID_DEFINE_BOOL(LIBCAP_BROKEN,${squid_cv_sys_capability_works:=no},
3135 [libcap2 headers are broken and clashing with glibc])
3136 AC_MSG_NOTICE([libcap2 headers are ok: $squid_cv_sys_capability_works])
3139 dnl Check for needed libraries
3140 AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
3141 AC_SEARCH_LIBS([res_init],[resolv])
3142 AC_SEARCH_LIBS([__res_search],[resolv])
3143 AC_SEARCH_LIBS([bind],[socket])
3144 AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
3145 AC_SEARCH_LIBS([strlcpy], [bsd])
3146 AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
3147 dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
3148 if test "x$squid_host_os" = "xmingw" ; then
3149 SQUID_CHECK_WINSOCK_LIB
3155 #include <winsock2.h>
3158 #include <windows.h>
3161 #include <ws2tcpip.h>
3166 # check that we have unix sockets
3167 SQUID_CHECK_UNIX_SOCKET
3168 SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
3170 AC_CHECK_LIB(gnumalloc, malloc)
3171 if test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"; then
3172 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
3173 ac_cv_func_mallocblksize=no
3174 ac_cv_func_mallopt=no
3176 case "$squid_host_os" in
3178 AC_MSG_NOTICE([skipping libmalloc check for $host])
3181 AC_MSG_NOTICE([skipping libmalloc check for $host])
3185 AC_CHECK_LIB(malloc, main)
3190 case "$squid_host_os" in
3192 AC_MSG_NOTICE([Use MSVCRT for math functions.])
3195 dnl rint() and log() are only used in old C code for now.
3197 AC_SEARCH_LIBS([rint],[m])
3198 AC_SEARCH_LIBS([log],[m])
3203 dnl --with-maxfd present for compatibility with Squid-2.
3204 dnl undocumented in ./configure --help to encourage using the Squid-3 directive
3209 squid_filedescriptors_num=$withval
3210 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
3213 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
3218 AC_ARG_WITH(filedescriptors,
3219 AS_HELP_STRING([--with-filedescriptors=NUMBER],
3220 [Force squid to support NUMBER filedescriptors]),
3224 squid_filedescriptors_num=$withval
3225 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
3228 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
3233 SQUID_CHECK_DEFAULT_FD_SETSIZE
3237 dnl Enable IPv6 support
3238 AC_MSG_CHECKING([whether to enable IPv6])
3240 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
3241 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ipv6: $enableval])
3243 AC_MSG_RESULT(${enable_ipv6:=yes})
3244 SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
3246 if test "x$enable_ipv6" = "xyes" ; then
3247 SQUID_CHECK_SIN6_LEN_IN_SAI
3249 SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
3250 SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
3253 dnl Check for libdl, used by auth_modules/PAM
3254 if test "x$with_dl" = "xyes"; then
3255 AC_CHECK_LIB(dl, dlopen)
3258 dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
3259 dnl Robert Side <rside@aiinc.bc.ca>
3260 dnl Mon, 18 Jan 1999 17:48:00 GMT
3263 AC_CHECK_LIB(intl, strftime)
3267 dnl System-specific library modifications
3271 if test "x$GCC" = "xyes"; then
3272 AC_MSG_NOTICE([Removing -O for gcc on $host])
3273 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
3278 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
3279 LIBS=`echo $LIBS | sed -e s/-lsocket//`
3280 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
3281 LIBS=`echo $LIBS | sed -e s/-lnsl//`
3282 ac_cv_lib_nsl_main=no
3283 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
3284 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3286 dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
3287 dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
3288 dnl Please change your configure script. AIX doesn't need -lbsd.
3290 AC_MSG_NOTICE([Removing -lbsd for AIX...])
3291 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3293 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
3299 public:virtual ~Foo(){}
3301 class Bar:public Foo{
3302 public:Bar():Foo(){}
3305 Foo * myFoo=new Bar();
3306 Bar * myBar=dynamic_cast<Bar *>(myFoo);
3307 assert(myBar != NULL);
3309 if test "$ac_cv_require_rtti" = "yes"; then
3310 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
3311 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
3315 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
3317 if test "$ac_cv_require_qcpluscmt" = "yes"; then
3318 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
3323 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
3324 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
3325 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,
3326 [If gettimeofday is known to take only one argument])
3328 [*-*-solaris2.[0-4]])
3329 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
3331 [*-sony-newsos[56]*])
3332 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
3336 dnl This has to be before AC_CHECK_FUNCS
3337 # Disable poll() on certain platforms. Override by setting ac_cv_func_poll
3338 # when running configure.
3339 if test "x$ac_cv_func_poll" = "x" ; then
3343 AC_MSG_NOTICE([disabling poll for $host...])
3344 ac_cv_func_poll='no'
3347 # Henrik Nordstrom (hno@squid-cache.org) 19980817
3348 # poll is problematic on Linux. We disable it
3349 # by default until Linux gets it right.
3350 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
3351 if test $rev -lt 002002; then
3352 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
3353 ac_cv_func_poll='no'
3356 [powerpc-ibm-aix4.1.*])
3357 # Mike Laster (mlaster@metavillage.com) 19981021
3358 AC_MSG_NOTICE([disabling poll for $host...])
3359 ac_cv_func_poll='no'
3362 # Robert Side <rside@aiinc.bc.ca>
3363 # Mon, 18 Jan 1999 17:48:00 GMT
3364 AC_MSG_NOTICE([disabling poll for $host...])
3365 ac_cv_func_poll='no'
3370 dnl Check for library functions
3372 backtrace_symbols_fd \
3394 pthread_attr_setschedparam \
3395 pthread_attr_setscope \
3396 pthread_setschedparam \
3420 dnl ... and some we provide local replacements for
3429 AC_CHECK_DECLS([getaddrinfo,getnameinfo,inet_ntop,inet_pton,InetNtopA,InetPtonA],,,[
3431 * BSD requires sys/types.h, sys/socket.h, netinet/in.h, netdb.h, arpa/inet.h
3432 * Linux requires sys/types.h, sys/socket.h, arpa/inet.h
3433 * Windows requires sys/socket.h, winsock2.h, ws2tcpip.h
3435 #if HAVE_SYS_TYPES_H
3436 #include <sys/types.h>
3438 #if HAVE_NETINET_IN_H
3439 #include <netinet/in.h>
3441 #if HAVE_SYS_SOCKET_H
3442 #include <sys/socket.h>
3447 #if HAVE_ARPA_INET_H
3448 #include <arpa/inet.h>
3451 #include <winsock2.h>
3454 #include <ws2tcpip.h>
3458 # Magic which checks whether we are forcing a type of comm loop we
3459 # are actually going to (ab)use.
3460 # Mostly ripped from squid-commloops, thanks to adrian and benno
3462 if test "x$squid_opt_io_loop_engine" != "x"; then
3463 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine])
3464 elif test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes" ; then
3465 squid_opt_io_loop_engine="epoll"
3466 elif test "x$enable_kqueue" != "xno" ; then
3467 squid_opt_io_loop_engine="kqueue"
3468 elif test "x$enable_devpoll" != "xno" ; then
3469 squid_opt_io_loop_engine="devpoll"
3470 elif test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes" ; then
3471 squid_opt_io_loop_engine="poll"
3472 elif test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"; then
3473 squid_opt_io_loop_engine="select"
3474 elif test "x$enable_select" != "xno" -a "x$squid_host_os" = "xmingw"; then
3475 squid_opt_io_loop_engine="select_win32"
3477 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
3478 AC_MSG_WARN([Will try select and hope for the best.])
3479 squid_opt_io_loop_engine="select"
3482 AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
3484 AM_CONDITIONAL(ENABLE_POLL, test "x$squid_opt_io_loop_engine" = "xpoll")
3485 AM_CONDITIONAL(ENABLE_EPOLL, test "x$squid_opt_io_loop_engine" = "xepoll")
3486 AM_CONDITIONAL(ENABLE_SELECT, test "x$squid_opt_io_loop_engine" = "xselect")
3487 AM_CONDITIONAL(ENABLE_SELECT_WIN32, test "x$squid_opt_io_loop_engine" = "xselect_win32")
3488 AM_CONDITIONAL(ENABLE_KQUEUE, test "x$squid_opt_io_loop_engine" = "xkqueue")
3489 AM_CONDITIONAL(ENABLE_DEVPOLL, test "x$squid_opt_io_loop_engine" = "xdevpoll")
3491 case $squid_opt_io_loop_engine in
3492 epoll) AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop]) ;;
3493 devpoll) AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop]) ;;
3494 poll) AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop]) ;;
3495 kqueue) AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop]) ;;
3496 select_win32) AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop]) ;;
3497 select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
3500 if test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes" ; then
3501 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
3504 SQUID_CHECK_SETRESUID_WORKS
3505 if test "x$squid_cv_resuid_works" = "xyes" ; then
3506 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.])
3509 AC_CHECK_HEADERS(mswsock.h)
3510 AC_MSG_CHECKING([for constant CMSG_SPACE])
3511 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3512 #if HAVE_SYS_SOCKET_H
3513 #include <sys/socket.h>
3516 #include <mswsock.h>
3519 int a[CMSG_SPACE(int)];
3522 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
3527 AC_CHECK_TYPE(struct cmsghdr,AC_DEFINE(HAVE_CMSGHDR,1,[The system provides struct cmsghdr]),,[
3528 #if HAVE_SYS_SOCKET_H
3529 #include <sys/socket.h>
3532 #include <mswsock.h>
3535 #include <winsock2.h>
3539 AC_CHECK_TYPE(struct iovec,AC_DEFINE(HAVE_IOVEC,1,[The system provides struct iovec]),,[
3540 #if HAVE_SYS_SOCKET_H
3541 #include <sys/socket.h>
3544 #include <winsock2.h>
3547 #include <sys/uio.h>
3551 AC_CHECK_TYPE(struct msghdr,AC_DEFINE(HAVE_MSGHDR,1,[The system provides struct msghdr]),,[
3552 #if HAVE_SYS_SOCKET_H
3553 #include <sys/socket.h>
3556 #include <mswsock.h>
3559 #include <winsock2.h>
3563 AC_CHECK_TYPE(struct sockaddr_un,AC_DEFINE(HAVE_SOCKADDR_UN,1,[The system provides sockaddr_un]),,[
3567 #if HAVE_SYS_SOCKET_H
3568 #include <sys/socket.h>
3571 #include <winsock2.h>
3575 SQUID_CHECK_FUNC_STRNSTR
3577 dnl IP-Filter support requires ipf header files. These aren't
3578 dnl installed by default, so we need to check for them
3579 if test "x$enable_ipf_transparent" != "xno" ; then
3580 SQUID_CHECK_BROKEN_SOLARIS_IPFILTER
3581 AC_MSG_CHECKING(for availability of IP-Filter header files)
3582 # hold on to your hats...
3583 if test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
3584 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
3585 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
3586 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes" ; then
3587 have_ipfilter_compat_header="yes"
3589 if test "x$have_ipfilter_compat_header" = "xyes" -a \
3590 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
3591 "x$ac_cv_header_ip_nat_h" = "xyes" ; then
3592 enable_ipf_transparent="yes"
3593 elif test "x$have_ipfilter_compat_header" = "xyes" -a \
3594 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
3595 "x$ac_cv_header_netinet_ip_nat_h" = "xyes" ; then
3596 enable_ipf_transparent="yes"
3598 enable_ipf_transparent="no"
3600 AC_MSG_RESULT($IPF_TRANSPARENT)
3602 ## On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3603 ## Solaris minor version (8, 9, 10, ...)
3604 if test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris" ; then
3605 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3606 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3607 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
3611 AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
3612 SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
3613 [Enable support for IPF-style transparent proxying])
3615 dnl PF /dev/pf support requires a header file.
3616 if test "x$with_nat_devpf" != "xno" ; then
3617 if test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
3618 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"; then
3619 if test "x$with_nat_devpf" = "xauto" ; then
3623 if test "x$with_nat_devpf" = "xyes" ; then
3624 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
3629 SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
3630 [Enable support for PF-style transparent proxying])
3631 SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
3632 [Enable support for /dev/pf NAT lookups])
3634 if test "x$enable_linux_netfilter" != "xno" ; then
3635 if test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"; then
3636 if test "x$enable_linux_netfilter" = "xauto" ; then
3637 enable_linux_netfilter=yes
3640 if test "x$enable_linux_netfilter" = "xauto" ; then
3641 enable_linux_netfilter=no
3643 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
3647 SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
3648 [Enable support for Transparent Proxy on Linux via Netfilter])
3650 dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
3651 AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
3652 if test "x$enable_linux_netfilter" = "xyes" -a "x$with_libcap" != "xyes" ; then
3653 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
3654 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
3655 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
3659 if test "x$squid_opt_netfilterconntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3660 AC_MSG_ERROR([Linux netfilter conntrack requires libcap support (libcap 2.09+)])
3662 if test "x$with_netfilter_conntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3663 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
3664 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
3665 with_netfilter_conntrack=no
3667 AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack} ${squid_opt_netfilterconntrackpath}])
3670 AC_ARG_ENABLE(zph-qos,
3671 AS_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]), [
3672 SQUID_YESNO([$enableval],
3673 [unrecognized argument to --enable-zph-qos: $enableval])
3675 SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
3676 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
3677 TOS field of HIT responses to help policing network traffic])
3678 AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
3679 if test x"$enable_zph_qos" = "xyes" ; then
3680 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
3681 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
3682 [Enable support for QOS netfilter mark preservation])
3686 AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
3687 AC_ARG_ENABLE(gnuregex,
3688 AS_HELP_STRING([--enable-gnuregex],
3689 [Compile GNUregex. Unless you have reason to use
3690 this option, you should not enable it.
3691 This library file is usually only required on Windows and
3692 very old Unix boxes which do not have their own regex
3693 library built in.]), [
3694 SQUID_YESNO([$enableval],[unrecognized argument to --enable-gnuregex: $enableval])
3696 # force-enable on old solaris and nextstep
3697 if test "x${enable_gnuregex:=auto}" = "xauto" ; then
3699 *-sun-solaris2.[[0-4]])
3700 enable_gnuregex="yes"
3703 enable_gnuregex="yes"
3708 # try detecting if it is needed
3709 if test "x$enable_gnuregex" = "xauto" ; then
3710 SQUID_CHECK_REGEX_WORKS
3711 if test "x$squid_cv_regex_works" = "xyes" ; then
3717 AC_MSG_CHECKING(if GNUregex needs to be compiled)
3718 AC_MSG_RESULT($enable_gnuregex)
3719 if test "x$enable_gnuregex" = "xyes"; then
3720 # for some reason (force-enable, test..) gnuregex was found as needed. Override any system lib
3723 #if no reason was found to enable gnuregex, disable it
3724 if test "x$enable_gnuregex" = "xauto" ; then
3727 SQUID_DEFINE_BOOL(USE_GNUREGEX,$enable_gnuregex,[Define if we should use GNU regex])
3730 SQUID_DETECT_UDP_SND_BUFSIZE
3731 SQUID_DETECT_UDP_RECV_BUFSIZE
3732 SQUID_DETECT_TCP_SND_BUFSIZE
3733 SQUID_DETECT_TCP_RECV_BUFSIZE
3735 SQUID_CHECK_RECV_ARG_TYPE
3736 SQUID_CHECK_NEED_SYS_ERRLIST
3737 SQUID_CHECK_MAXPATHLEN
3739 SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
3740 SQUID_CHECK_RESOLVER_FIELDS
3742 AC_CHECK_HEADERS(sys/statvfs.h)
3743 if test "x$ac_cv_header_sys_statvfs_h" = "xyes" ; then
3744 SQUID_CHECK_WORKING_STATVFS
3746 if test "x$ac_cv_func_statvfs" != "xyes" ; then
3747 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/vfs.h sys/statfs.h)
3748 AC_CHECK_FUNCS(statfs)
3749 SQUID_CHECK_F_FRSIZE_IN_STATFS
3752 dnl Squid will not usually attempt to translate templates when building
3753 AC_ARG_ENABLE(translation,
3754 AS_HELP_STRING([--enable-translation],[Generate the localized error page templates and manuals.
3755 Which can also be downloaded from http://www.squid-cache.org/Versions/langpack/.]), [
3756 SQUID_YESNO([$enableval],
3757 [unrecognized argument to --enable-translation: $enableval])
3759 if test "x${enable_translation:=no}" = "xyes" ; then
3760 AX_WITH_PROG([PO2HTML],[po2html])
3761 AX_WITH_PROG([PO2TEXT],[po2txt])
3769 dnl Squid now has limited locale handling ...
3771 AC_ARG_ENABLE(auto-locale,
3772 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
3773 clients request headers.
3774 When disabled Squid requires explicit language configuration.]), [
3775 SQUID_YESNO([$enableval],
3776 [unrecognized argument to --disable-auto-locale: $enableval])
3778 AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
3779 SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
3780 [Use multi-language support on error pages])
3783 dnl Need the debugging version of malloc if available
3785 if test "x$ac_cv_lib_malloc_main" = "xyes" ; then
3786 if test -r /usr/lib/debug/malloc.o ; then
3787 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3789 if test -r /usr/lib/debug/mallocmap.o ; then
3790 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3795 if test "x$XTRA_LIBS" = "x"; then
3798 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
3803 AC_SUBST(SQUID_CFLAGS)
3804 AC_SUBST(SQUID_CXXFLAGS)
3806 AC_ARG_VAR([BUILDCXXFLAGS],[C++ compiler flags for building compile-time tools. e.g. cf_gen])
3807 if test "x$BUILDCXXFLAGS" = "x"; then
3808 # if we are NOT cross-compiling, use the default build flags for cf_gen and friends
3809 # otherwise rely on the user-provided value
3810 if test "x$squid_cv_check_marchnative" = "xyes"; then
3811 # always valid for the Build compiler.
3812 BUILDCXXFLAGS="-march=native"
3814 BUILDCXXFLAGS="$BUILDCXXFLAGS $CXXFLAGS"
3816 AC_SUBST(BUILDCXXFLAGS)
3818 AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
3819 AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
3820 AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
3821 AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
3822 AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
3823 AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
3824 AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
3825 AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
3826 AC_MSG_NOTICE([BUILD Tools C++ FLAGS: $BUILDCXXFLAGS])
3828 dnl Clean up after OSF/1 core dump bug
3836 doc/manuals/Makefile
3837 doc/release-notes/Makefile
3841 lib/libTrie/Makefile
3842 lib/libTrie/test/Makefile
3843 lib/ntlmauth/Makefile
3844 lib/profiler/Makefile
3847 lib/snmplib/Makefile
3851 src/acl/external/Makefile
3852 src/acl/external/AD_group/Makefile
3853 src/acl/external/delayer/Makefile
3854 src/acl/external/eDirectory_userip/Makefile
3855 src/acl/external/file_userip/Makefile
3856 src/acl/external/kerberos_ldap_group/Makefile
3857 src/acl/external/kerberos_sid_group/Makefile
3858 src/acl/external/LDAP_group/Makefile
3859 src/acl/external/LM_group/Makefile
3860 src/acl/external/session/Makefile
3861 src/acl/external/SQL_session/Makefile
3862 src/acl/external/unix_group/Makefile
3863 src/acl/external/wbinfo_group/Makefile
3864 src/acl/external/time_quota/Makefile
3865 src/adaptation/Makefile
3866 src/adaptation/icap/Makefile
3867 src/adaptation/ecap/Makefile
3870 src/auth/basic/Makefile
3871 src/auth/basic/DB/Makefile
3872 src/auth/basic/fake/Makefile
3873 src/auth/basic/getpwnam/Makefile
3874 src/auth/basic/LDAP/Makefile
3875 src/auth/basic/NCSA/Makefile
3876 src/auth/basic/NIS/Makefile
3877 src/auth/basic/PAM/Makefile
3878 src/auth/basic/POP3/Makefile
3879 src/auth/basic/RADIUS/Makefile
3880 src/auth/basic/SASL/Makefile
3881 src/auth/basic/SMB/Makefile
3882 src/auth/basic/SMB_LM/Makefile
3883 src/auth/basic/SSPI/Makefile
3884 src/auth/digest/Makefile
3885 src/auth/digest/eDirectory/Makefile
3886 src/auth/digest/file/Makefile
3887 src/auth/digest/LDAP/Makefile
3888 src/auth/negotiate/Makefile
3889 src/auth/negotiate/kerberos/Makefile
3890 src/auth/negotiate/SSPI/Makefile
3891 src/auth/negotiate/wrapper/Makefile
3892 src/auth/ntlm/Makefile
3893 src/auth/ntlm/fake/Makefile
3894 src/auth/ntlm/SMB_LM/Makefile
3895 src/auth/ntlm/SSPI/Makefile
3897 src/clients/Makefile
3901 src/DiskIO/AIO/Makefile
3902 src/DiskIO/Blocking/Makefile
3903 src/DiskIO/DiskDaemon/Makefile
3904 src/DiskIO/DiskThreads/Makefile
3905 src/DiskIO/IpcIo/Makefile
3906 src/DiskIO/Mmapped/Makefile
3915 src/http/one/Makefile
3916 src/http/url_rewriters/Makefile
3917 src/http/url_rewriters/fake/Makefile
3918 src/http/url_rewriters/LFS/Makefile
3925 src/log/file/Makefile
3932 src/security/Makefile
3933 src/security/cert_generators/Makefile
3934 src/security/cert_generators/file/Makefile
3935 src/security/cert_validators/Makefile
3936 src/security/cert_validators/fake/Makefile
3937 src/servers/Makefile
3941 src/store/id_rewriters/Makefile
3942 src/store/id_rewriters/file/Makefile
3945 tools/apparmor/Makefile
3946 tools/helper-mux/Makefile
3947 tools/purge/Makefile
3948 tools/squidclient/Makefile
3949 tools/systemd/Makefile
3950 tools/sysvinit/Makefile
3953 # must configure libltdl subdir unconditionally for "make distcheck" to work
3954 #AC_CONFIG_SUBDIRS(libltdl)