1 ## Copyright (C) 1996-2023 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],[7.0.0-VCS],[https://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/ldap.m4])
25 m4_include([acinclude/pam.m4])
26 m4_include([acinclude/pkg.m4])
27 m4_include([acinclude/tdb.m4])
28 m4_include([acinclude/lib-checks.m4])
29 m4_include([acinclude/ax_cxx_compile_stdcxx.m4])
30 m4_include([acinclude/win32-sspi.m4])
32 PRESET_CFLAGS="$CFLAGS"
33 PRESET_CXXFLAGS="$CXXFLAGS"
34 PRESET_LDFLAGS="$LDFLAGS"
36 dnl Set default LDFLAGS
37 AS_IF([test "x$LDFLAGS" = "x"],[LDFLAGS="-g"])
39 # check for host OS detail
41 AC_MSG_CHECKING([simplified host os])
42 simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
43 squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
44 AS_IF([test -n "$squid_host_os_version"],[
45 squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
47 squid_host_os="$simple_host_os"
49 AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
50 # on windows squid_host_os is either mingw or cygwin, version is 32
56 # AC_USE_SYSTEM_EXTENSIONS should be called before any macros that run the C compiler.
57 AC_USE_SYSTEM_EXTENSIONS
61 # Clang 3.2 on some CPUs requires -march-native to detect correctly.
62 # GCC 4.3+ can also produce faster executables when its used.
63 # But building inside a virtual machine environment has been found to
64 # cause random Illegal Instruction errors due to mis-detection of CPU.
65 AC_ARG_ENABLE(arch-native,
66 AS_HELP_STRING([--disable-arch-native],[Some compilers offer CPU-specific
67 optimizations with the -march=native parameter.
68 This flag disables the optimization. The default is to
69 auto-detect compiler support and use where available.]), [
70 SQUID_YESNO([$enableval],[--enable-arch-native])
72 AC_MSG_NOTICE([CPU arch native optimization enabled: ${enable_arch_native:=auto}])
73 AS_IF([test "x${enable_arch_native}" != "xno"],[
74 SQUID_CC_CHECK_ARGUMENT([squid_cv_check_marchnative],[-march=native])
77 # If the user did not specify a C++ version.
78 user_cxx=`echo "$PRESET_CXXFLAGS" | grep -o -E "(-)std="`
79 AS_IF([test "x$user_cxx" = "x"],[
80 # Check for C++17 compiler support
82 AX_CXX_COMPILE_STDCXX([17],[noext],[mandatory])
85 # Prerequisite: CXX has been finalized.
86 # BUILDCXXFLAGS are defined later, after CXXFLAGS have been finalized.
87 AC_ARG_VAR([BUILDCXX],[path to compiler for building compile-time tools. e.g. cf_gen])
88 AS_IF([test "x$HOSTCXX" != "x" -a "x$BUILDCXX" = "x"],[
89 AC_MSG_WARN([Cross-compiling with HOSTCXX is deprecated. Use BUILDCXX instead.])
92 AS_IF([test "x$BUILDCXX" = "x"],[
94 AS_IF([test "x$squid_cv_check_marchnative" = "xyes"],[
95 CXXFLAGS="$CXXFLAGS -march=native"
107 AC_PATH_PROG(SH, sh, /bin/sh)
108 AC_PATH_PROG(FALSE, false, /usr/bin/false)
109 AC_PATH_PROG(TRUE, true, /usr/bin/true)
110 AC_PATH_PROG(MV, mv, $FALSE)
111 AC_PATH_PROG(MKDIR, mkdir, $FALSE)
112 AC_PATH_PROG(LN, ln, cp)
113 AC_PATH_PROG(CHMOD, chmod, $FALSE)
114 AC_PATH_PROG(TR, tr, $FALSE)
115 AC_PATH_PROG(RM, rm, $FALSE)
116 dnl Libtool 2.2.6 requires: rm -f
121 AC_PATH_PROG(PERL, perl, none)
122 AS_IF([test "x$ac_cv_path_PERL" = "xnone"],[
123 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
125 AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
126 AM_CONDITIONAL(ENABLE_POD2MAN_DOC, test "x${ac_cv_path_POD2MAN}" != "x$FALSE")
128 AC_PATH_PROG(AR, ar, $FALSE)
132 AC_PATH_PROG(LINUXDOC, linuxdoc, $FALSE)
133 AM_CONDITIONAL(ENABLE_RELEASE_DOCS, test "x${ac_cv_path_LINUXDOC}" != "x$FALSE")
135 SQUID_RELEASE=`echo $VERSION | cut -d. -f1`
136 AC_SUBST(SQUID_RELEASE)
138 # pre-define DEFAULT_PREFIX, some modules need it.
139 AS_IF([test "${prefix}" = "NONE"],[squid_prefix=$ac_default_prefix],[squid_prefix=$prefix])
140 AC_DEFINE_UNQUOTED(DEFAULT_PREFIX,[$squid_prefix],[The install prefix])
142 AC_ARG_ENABLE(strict-error-checking,
143 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
144 with all possible static compiler error-checks enabled.
145 This flag disables the behavior]), [
146 SQUID_YESNO([$enableval],[--enable-strict-error-checking])
148 AC_MSG_NOTICE([strict error checking enabled: ${enable_strict_error_checking:=yes}])
150 # LT_INIT requires libtool v2, might as well state it loud
153 AS_IF([test "x$ac_top_build_prefix" != "x"],[
154 # LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
155 # But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
156 # This fixes Linux LTDLv3-v7, and BSD LTDL v2.2
157 top_build_prefix=${ac_top_build_prefix}
158 AC_SUBST(top_build_prefix)
162 dnl LibTool environment is now prepared for setup. Check that it is usable and initialize.
165 # Do we need these unconditionally for "make distcheck" to work?
169 AC_MSG_CHECKING(whether to use loadable modules)
170 AS_IF([test "x${enable_shared:=yes}" = "xyes"],[AC_DEFINE(USE_LOADABLE_MODULES,1,[Support Loadable Modules])])
171 AM_CONDITIONAL(ENABLE_LOADABLE_MODULES, test "x${enable_shared:=yes}" = "xyes")
172 AC_MSG_RESULT([$enable_shared])
174 SQUID_CC_GUESS_VARIANT
175 SQUID_CC_GUESS_OPTIONS
177 dnl find out the exe extension for this platform.
178 dnl If it is not empty, use it for CGI as well.
181 AS_IF([test "x$EXEEXT" = "x"],[CGIEXT=".cgi"],[CGIEXT=""])
184 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,[test "x$squid_host_os" = "xmingw"])
185 AM_CONDITIONAL(ENABLE_WIN32_IPC,[test "x$squid_host_os" = "xmingw"])
187 AS_CASE(["$squid_host_os"],
189 CFLAGS="$CFLAGS -mthreads"
190 CXXFLAGS="$CXXFLAGS -mthreads -static-libgcc -static-libstdc++"
191 dnl Check for Winsock only on MinGW
192 SQUID_CHECK_WINSOCK_LIB
193 AC_CHECK_HEADERS([ws2tcpip.h winsock2.h windows.h io.h],,,[
195 #include <ws2tcpip.h>
198 #include <winsock2.h>
204 MINGW_LIBS="-lmingwex"
206 AC_CHECK_FUNCS([fsync])
210 # FreeBSD places local libraries and packages in /usr/local
211 CFLAGS="$CFLAGS -I/usr/local/include"
212 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
213 LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-R/usr/local/lib"
218 AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
220 AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args",
221 [configure command line used to configure Squid])
223 CACHE_EFFECTIVE_USER="nobody"
224 AC_ARG_WITH(default-user,
225 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
226 [ CACHE_EFFECTIVE_USER="$withval" ]
228 AC_SUBST(CACHE_EFFECTIVE_USER)
230 DEFAULT_LOG_DIR="$localstatedir/logs"
232 AS_HELP_STRING([--with-logdir=PATH],
233 [Default location for squid logs. default: PREFIX/var/logs]),[
235 [yes|no],[AC_MSG_ERROR([--with-logdir requires a directory PATH. --with-logdir=PATH])],
236 [DEFAULT_LOG_DIR="$withval"]
239 AC_SUBST(DEFAULT_LOG_DIR)
241 DEFAULT_PID_FILE="$localstatedir/run/@SERVICE_NAME@.pid"
243 AS_HELP_STRING([--with-pidfile=PATH],
244 [Default location for squid pid file. Default: PREFIX/var/run/squid.pid]),[
246 [yes|no],[AC_MSG_ERROR([--with-pidfile requires a file PATH. --with-pidfile=PATH])],
247 [DEFAULT_PID_FILE="$withval"]
250 AC_SUBST(DEFAULT_PID_FILE)
252 DEFAULT_SWAP_DIR="$localstatedir/cache/squid"
254 AS_HELP_STRING([--with-swapdir=PATH],
255 [Default location for squid cache directories. Default: PREFIX/var/cache/squid]),[
257 [yes|no],[AC_MSG_ERROR([--with-swapdir requires a directory PATH. --with-swapdir=PATH])],
258 [DEFAULT_SWAP_DIR="$withval"]
261 AC_SUBST(DEFAULT_SWAP_DIR)
263 dnl Set Default CFLAGS
264 AS_IF([test "x$PRESET_CFLAGS" = "x"],[
265 AS_IF([test "$squid_cv_compiler" = "gcc"],[
266 # TODO check if these exceptions are still necessary
269 # sunos has too many warnings for -Wall to be useful
271 [CFLAGS="$squid_cv_cc_option_wall $CFLAGS"]
275 [*mips-sgi-irix6.*],[
276 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
277 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
278 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
279 -Wl,-woff,85,-woff,84,-woff,134 \
280 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
281 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
282 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
283 -Wl,-woff,85,-woff,84,-woff,134 \
284 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
289 AC_MSG_CHECKING([compiler name-version])
290 squid_cv_cc_name=`$CC --version | head -1 | cut -f1 -d" "`
291 AS_CASE([$squid_cv_cc_name],
292 [gcc|clang],[squid_cv_cc_majversion=`$CC -dumpversion | cut -f1 -d.`],
293 [squid_cv_cc_majversion="unknown"]
295 squid_cv_cc_simplified="$squid_cv_cc_name-$squid_cv_cc_majversion"
296 AC_MSG_RESULT($squid_cv_cc_simplified)
301 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([$squid_cv_cc_option_wall])
304 AS_IF([test "$squid_cv_cc_simplified" = "gcc-4"],[
305 AC_MSG_NOTICE([skipping -Wextra on $squid_cv_cc_simplified])
307 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wextra])
309 # Now disable or configure certain warnings enabled by -Wextra
311 # -Wunused-private-field causes a huge number of false positives
312 # in unit tests. Disable that
313 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wno-unused-private-field])
315 # ...=5: Do not trust comments about fallthrough cases (GCC).
316 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wimplicit-fallthrough=5])
317 AS_IF([test "x$squid_cv_cc_arg_wimplicit_fallthrough_5" != "xyes"], [
318 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wno-implicit-fallthrough])
322 # useful warnings that may not be included in -Wall -Wextra
323 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wpointer-arith])
324 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wwrite-strings])
325 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wcomments])
326 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wshadow])
327 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wmissing-declarations])
328 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Woverloaded-virtual])
330 dnl CentOS (and RHEL) still define ntohs() using deprecated C++ features
331 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_wno_deprecated_register],[-Werror -Wno-deprecated-register],[[#include <arpa/inet.h>]],[[int fox=ntohs(1);]])
333 AS_IF([test "x$enable_strict_error_checking" != "xno"],[
334 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
335 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
338 AS_IF([test "x$ac_cv_require_wno_deprecated_register" = "xyes"],[
339 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -Wno-deprecated-register"
342 # squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
343 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
344 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
346 # possibly include some build info tag into squid -v
347 SQUID_EMBED_BUILD_INFO
349 AC_ARG_ENABLE(optimizations,
350 AS_HELP_STRING([--disable-optimizations],
351 [Do not compile Squid with compiler optimizations enabled.
352 Optimization is good for production builds, but not
353 good for debugging. During development, use
354 --disable-optimizations to reduce compilation times
355 and allow easier debugging.]), [
356 AS_IF([test "x$enableval" = "xno"],[
357 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
358 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
359 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9g]]*//'`"
363 dnl Nasty hack to get autoconf 2.64 on Linux to run.
364 dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
365 AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[:])
367 AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
368 AC_ARG_ENABLE(xmalloc-statistics,
369 AS_HELP_STRING([--enable-xmalloc-statistics],
370 [Show malloc statistics in status page]), [
371 SQUID_YESNO([$enableval],[--enable-xmalloc-statistics])
373 SQUID_DEFINE_BOOL(XMALLOC_STATISTICS,${enable_xmalloc_statistics:=no},
374 [Show malloc statistics in status page])
375 AC_MSG_NOTICE([xmalloc stats display: $enable_xmalloc_statistics])
377 squid_opt_aufs_threads=""
378 AC_ARG_WITH(aufs-threads,
379 AS_HELP_STRING([--with-aufs-threads=N_THREADS],
380 [Tune the number of worker threads for the aufs object store.]), [
382 [@<:@0-9@:>@*],[squid_opt_aufs_threads=$withval],
383 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
386 AS_IF([test "x$squid_opt_aufs_threads" != "x"],[
387 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
388 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
389 [Defines how many threads aufs uses for I/O])
392 ## TODO check if this is necessary, LT_INIT does these checks
393 SQUID_AUTO_LIB(dl,[dynamic linking],[LIBDL])
394 SQUID_CHECK_LIB_WORKS(dl,[
395 LDFLAGS="$LIBDL_PATH $LDFLAGS"
396 AC_CHECK_LIB(dl, dlopen,[LIBDL_LIBS="-ldl"])
397 LIBS="$LIBDL_LIBS $LIBS"
400 AC_DEFUN([LIBATOMIC_CHECKER],[
401 AC_MSG_CHECKING(whether linking $1 -latomic works)
407 main(int argc, char **) {
409 std::atomic<uint8_t>(uint8_t(argc)).exchange(0) &&
410 std::atomic<uint64_t>{}.is_lock_free()
415 libatomic_checker_result="yes"],[
417 libatomic_checker_result="no"
420 ## check for atomics library before anything that might need it
421 SQUID_STATE_SAVE(LIBATOMIC)
422 LIBATOMIC_CHECKER(without)
423 AS_IF([test "x$libatomic_checker_result" = "xno"],[
424 LIBS="$LIBS -latomic"
425 LIBATOMIC_CHECKER(with)
426 AS_IF([test "x$libatomic_checker_result" = "xyes"],[
427 ATOMICLIB="-latomic"],[
428 AC_MSG_ERROR([Required library libatomic not found.])
430 SQUID_STATE_ROLLBACK(LIBATOMIC)
433 SQUID_AUTO_LIB(psapi,[Windows PSAPI.dll],[LIBPSAPI])
434 SQUID_CHECK_LIB_WORKS(psapi,[
435 SQUID_STATE_SAVE(squid_psapi_state)
436 CPPFLAGS="$LIBPSAPI_CFLAGS $CPPFLAGS"
437 LIBS="$LIBPSAPI_PATH $LIBS"
438 AC_CHECK_LIB([psapi],[K32GetProcessMemoryInfo],[
439 LIBPSAPI_LIBS="-lpsapi"
440 AC_CHECK_HEADERS([psapi.h],,,[
446 SQUID_STATE_ROLLBACK(squid_psapi_state)
449 AC_SEARCH_LIBS([shm_open], [rt])
450 AS_IF([test "x$ac_cv_search_shm_open" != "xno"],[
451 AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
454 squid_disk_module_candidates=
455 AC_ARG_ENABLE(disk-io,
456 AS_HELP_STRING([--enable-disk-io="list of modules"],
457 [Build support for the list of disk I/O modules.
458 Set without a value or omitted, all available modules will be built.
459 See src/DiskIO for a list of available modules, or
460 Programmers Guide section on DiskIO
461 for details on how to build your custom disk module]),
462 AS_CASE(["$enableval"],
464 [no|none],[enable_disk_io="no"],
467 squid_disk_module_candidates="$enableval"
470 AS_IF([test "x${enable_disk_io:=yes}" = "xyes"],[
471 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
472 AS_IF([test "x$ac_cv_search_shm_open" = "xno"],[
473 squid_disk_module_candidates=`echo "$squid_disk_module_candidates" | sed 's/IpcIo//g'`
476 SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
477 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
478 AC_MSG_NOTICE([DiskIO modules built: ${squid_disk_module_candidates:-none}])
479 SQUID_DEFINE_BOOL(USE_DISKIO,$enable_disk_io,[DiskIO modules are expected to be available.])
481 dnl Some autoconf.h defines we might enable later...
482 AC_ARG_WITH(pthreads,AS_HELP_STRING([--without-pthreads],[Disable POSIX Threads]))
483 AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO. Default: auto-detect]))
486 squid_opt_use_diskthreads=
489 dnl Setup the module paths etc.
492 AH_TEMPLATE(HAVE_DISKIO_MODULE_AIO, [Whether POSIX AIO Disk I/O module is built])
493 AH_TEMPLATE(HAVE_DISKIO_MODULE_BLOCKING, [Whether Blocking Disk I/O module is built])
494 AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKDAEMON, [Whether DiskDaemon Disk I/O module is built])
495 AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKTHREADS, [Whether DiskThreads Disk I/O module is built])
496 AH_TEMPLATE(HAVE_DISKIO_MODULE_IPCIO, [Whether IpcIo Disk I/O module is built])
497 AH_TEMPLATE(HAVE_DISKIO_MODULE_MMAPPED, [Whether Mmapped Disk I/O module is built])
498 for module in $squid_disk_module_candidates none; do
500 AS_IF([test "x$module" = "xnone"],[continue])
501 AS_IF([! test -d "$srcdir/src/DiskIO/$module"],[AC_MSG_ERROR([disk-io $module does not exist])])
504 dnl Check for POSIX AIO availability
505 squid_opt_use_aio="yes"
507 AS_IF([test "x$with_aio" != "xno"],[
509 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
510 dnl On some systems POSIX AIO functions are in librt
511 dnl On some systems POSIX AIO functions are in libaio
512 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
513 dnl Enable AIO if the library and headers are found
514 AS_IF([test "x$AIOLIB" != "x" -a "x$have_aio_header" = "xyes"],[
515 AC_MSG_NOTICE([Native POSIX AIO support detected.])
516 squid_opt_use_aio="yes"
518 dnl Windows does things differently. We provide wrappers.
519 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
520 AS_IF([test "$squid_host_os" = "mingw"],[
521 squid_opt_use_aio="yes"
522 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
524 squid_opt_use_aio="no"
525 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
529 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
530 squid_opt_use_aio="no"
532 dnl Use the POSIX AIO pieces if we actually need them.
533 AS_IF([test "x$squid_opt_use_aio" = "xyes"],[
534 DISK_MODULES="$DISK_MODULES AIO"
535 AC_DEFINE([HAVE_DISKIO_MODULE_AIO],1,[POSIX AIO Disk I/O module is built])
536 AS_IF([test "$squid_host_os" = "mingw"],[
538 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
540 AC_MSG_NOTICE([Enabling AIO DiskIO module])
543 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
544 squid_disk_module_candidates_AIO=no
549 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
550 DISK_MODULES="$DISK_MODULES Blocking"
551 AC_DEFINE([HAVE_DISKIO_MODULE_BLOCKING],1,[Blocking Disk I/O module is built])
555 AS_IF([test "$squid_host_os" = "mingw"],[
556 AC_MSG_NOTICE([DiskDaemon not supported on MinGW])
557 squid_disk_module_candidates_DiskDaemon=no
559 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
560 DISK_MODULES="$DISK_MODULES DiskDaemon"
561 AC_DEFINE([HAVE_DISKIO_MODULE_DISKDAEMON],1,[DiskDaemon Disk I/O module is built])
566 squid_opt_use_diskthreads="yes"
568 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
569 AS_IF([test "x$with_pthreads" != "xno"],[
570 dnl TODO: this needs to be extended to handle more systems and better
571 dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
572 dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
573 AS_CASE(["$squid_host_os"],
576 AC_MSG_NOTICE([Windows threads support automatically enabled])
580 AS_IF([test `echo "$squid_host_os_version" | tr -d .` -lt 70],[
581 AC_MSG_NOTICE(pthread library requires FreeBSD 7 or later)
582 squid_opt_use_diskthreads="no"
584 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
585 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
586 AS_IF([test "x$GCC" = "xyes" -a "x$PRESET_LDFLAGS" = "x"],[LDFLAGS="$LDFLAGS -pthread"])
591 AS_IF([test `echo "$squid_host_os_version" | tr -d .` -lt 52],[
592 AC_MSG_NOTICE(pthread library requires OpenBSD 5.2 or later)
593 squid_opt_use_diskthreads="no"
595 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
596 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
597 LDFLAGS="$LDFLAGS -lpthread"
602 AS_IF([test "x$GCC" = "xyes"],[
603 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
604 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
605 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
606 AC_MSG_NOTICE(pthread library required but cannot be found.)
607 squid_opt_use_diskthreads="no"
610 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
611 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
612 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
613 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
614 LIBPTHREADS="" #in LIBS
616 AC_MSG_NOTICE(pthread library required but cannot be found.)
617 squid_opt_use_diskthreads="no"
623 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
624 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
625 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
626 AC_MSG_NOTICE(pthread library required but cannot be found.)
627 squid_opt_use_diskthreads="no"
632 AC_MSG_NOTICE([Native pthreads support manually disabled.])
633 squid_opt_use_diskthreads="no"
635 AS_IF([test "x$squid_opt_use_diskthreads" = "xyes"],[
636 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
637 DISK_MODULES="$DISK_MODULES DiskThreads"
638 AC_DEFINE([HAVE_DISKIO_MODULE_DISKTHREADS],1,[DiskThreads Disk I/O module is built])
640 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
641 SQUID_STATE_ROLLBACK([diskthreads_state])
642 squid_disk_module_candidates_DiskThreads=no
647 AS_IF([test "x$ac_cv_search_shm_open" = "xno"],[
648 AC_MSG_NOTICE([DiskIO IpcIo module requires shared memory support])
649 squid_disk_module_candidates_IpcIo=no
651 AC_MSG_NOTICE([Enabling IpcIo DiskIO module])
652 DISK_MODULES="$DISK_MODULES IpcIo"
653 AC_DEFINE([HAVE_DISKIO_MODULE_IPCIO],1,[IpcIo Disk I/O module is built])
658 dnl TODO: use availability of sys/mman.h and/or mmap to define
659 dnl OR support windows mmap functions
660 AS_IF([test "x$squid_host_os" = "xmingw"],[
661 AC_MSG_NOTICE([Mmapped DiskIO is not available on Mingw])
662 squid_disk_module_candidates_Mmapped=no
664 AC_MSG_NOTICE([Enabling Mmapped DiskIO module])
665 DISK_MODULES="$DISK_MODULES Mmapped"
666 AC_DEFINE([HAVE_DISKIO_MODULE_MMAPPED],1,[Mmapped Disk I/O module is built])
671 AC_MSG_NOTICE([Enabling $module DiskIO module])
672 DISK_LIBS="$DISK_LIBS lib${module}.la"
673 DISK_MODULES="$DISK_MODULES ${module}"
676 AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
677 AC_SUBST(DISK_MODULES)
679 AM_CONDITIONAL(ENABLE_DISKIO_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes")
681 AM_CONDITIONAL(ENABLE_WIN32_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes" -a "x$ENABLE_WIN32_AIO" = "x1")
682 AM_CONDITIONAL(ENABLE_DISKIO_BLOCKING, test "x$squid_disk_module_candidates_Blocking" = "xyes")
683 AM_CONDITIONAL(ENABLE_DISKIO_DISKDAEMON, test "x$squid_disk_module_candidates_DiskDaemon" = "xyes")
684 AM_CONDITIONAL(ENABLE_DISKIO_DISKTHREADS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes")
685 AC_SUBST(LIBPTHREADS)
686 AM_CONDITIONAL(ENABLE_WIN32_AIOPS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes" -a "x$ENABLE_WIN32_AIOPS" = "x1")
687 AM_CONDITIONAL(ENABLE_DISKIO_IPCIO, test "x$squid_disk_module_candidates_IpcIo" = "xyes")
688 AM_CONDITIONAL(ENABLE_DISKIO_MMAPPED, test "x$squid_disk_module_candidates_Mmapped" = "xyes")
690 dnl Check what Storage formats are wanted.
691 dnl This version will error out with a message saying why if a required DiskIO is missing.
692 AC_ARG_ENABLE([storeio],
693 AS_HELP_STRING([--enable-storeio="list of modules"],
694 [Build support for the list of store I/O modules.
695 The default is only to build the "ufs" module.
696 See src/fs for a list of available modules, or
697 Programmers Guide section <not yet written>
698 for details on how to build your custom store module]), [
699 AS_CASE(["$enableval"],
701 [no|none],[enable_storeio="no"],
704 # ufs is really always needed as it has low-level routines
705 # if it is a dupe it will be cleaned-up later
706 squid_storeio_module_candidates="$enableval ufs"
709 AS_IF([test "x${enable_storeio:=yes}" = "xyes"],[
710 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
712 SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
713 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
714 AC_MSG_NOTICE([Store modules built: ${squid_storeio_module_candidates:-none}])
716 for fs in ${squid_storeio_module_candidates:-none}; do
719 AS_IF([test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
720 "x$squid_disk_module_candidates_DiskDaemon" != "xyes"],[
721 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
725 AS_IF([test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
726 "x$squid_disk_module_candidates_DiskThreads" != "xyes"],[
727 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
731 AS_IF([test "x$squid_disk_module_candidates_IpcIo" != "xyes" -a \
732 "x$squid_disk_module_candidates_Blocking" != "xyes"],[
733 AC_MSG_ERROR([Storage module Rock requires DiskIO module: Blocking or IpcIo])
735 squid_do_build_rock=true
738 AS_IF([test "x$squid_disk_module_candidates_Blocking" != "xyes"],[
739 AC_MSG_ERROR([Storage module ufs requires DiskIO module: Blocking])
741 squid_do_build_ufs=true
746 AM_CONDITIONAL(ENABLE_FS_UFS, test "x$squid_do_build_ufs" = "xtrue")
747 AM_CONDITIONAL(ENABLE_FS_ROCK, test "x$squid_do_build_rock" = "xtrue")
748 dnl hack: need to define those even if not used in the build system to
749 dnl make sure that global FS objects are linked to the squid binary.
750 AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
751 AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
752 AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
753 AH_TEMPLATE(HAVE_FS_ROCK, "Define to 1 if rock filesystem module is build")
756 dnl got final squid_storeio_module_candidates, build library lists
757 dnl This list will not be needed when each fs library has its own Makefile
759 dnl File system libraries to link executables with.
760 dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
762 for fs in $squid_storeio_module_candidates; do
763 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
764 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
765 SQUID_TOUPPER_VAR_CONTENTS([fs])
766 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
769 AC_SUBST(STORE_LIBS_TO_BUILD)
770 AC_SUBST(STORE_LIBS_TO_ADD)
771 AC_SUBST(STORE_TESTS)
774 dnl At lest one removal policy is always needed.
775 dnl 'lru' removal policy is currently hard-coded by name for tests
776 dnl so we must set it as default.
778 AC_ARG_ENABLE(removal-policies,
779 AS_HELP_STRING([--enable-removal-policies="list of policies"],
780 [Build support for the list of removal policies.
781 The default is only to build the "lru" module.
782 See src/repl for a list of available modules, or
783 Programmers Guide section 9.9 for details on how
784 to build your custom policy]), [
785 AS_CASE(["$enableval"],
786 [yes],[ SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES]) ],
788 [ REPL_POLICIES="$enableval" ]
791 SQUID_CLEANUP_MODULES_LIST([REPL_POLICIES])
792 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
793 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
794 REPL_OBJS="repl/lib`echo \"$REPL_POLICIES\" | sed -e 's% %.a repl/lib%g'`.a"
795 REPL_LIBS=`echo "$REPL_OBJS" | sed -e 's%repl/%%g'`
796 AC_SUBST(REPL_POLICIES)
800 AM_CONDITIONAL(ENABLE_PINGER, false)
802 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),[
803 AS_IF([test "x$enableval" = "xyes"],[
804 AC_MSG_NOTICE([ICMP enabled])
805 AC_DEFINE(USE_ICMP,1,[Define to use Squid ICMP and Network Measurement features (highly recommended!)])
806 AM_CONDITIONAL(ENABLE_PINGER, true)
810 AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
811 AC_ARG_ENABLE(delay-pools,
812 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),[
813 AS_IF([test "x$enableval" = "xyes"],[
814 AC_MSG_NOTICE([Delay pools enabled])
815 AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
816 AM_CONDITIONAL(ENABLE_DELAY_POOLS, true)
820 dnl disable generic/common adaptation support by default
821 squid_opt_use_adaptation=no
823 squid_opt_use_esi=auto
824 AH_TEMPLATE([USE_SQUID_ESI],[Define to enable the ESI processor])
826 AS_HELP_STRING([--disable-esi],
827 [Disable ESI for accelerators. ESI requires expat or xml2 library.
828 Enabling ESI will cause squid reverse proxies to be capable
829 of the Edge Acceleration Specification (www.esi.org).]),
830 [squid_opt_use_esi=$enableval],[])
832 # ESI support libraries: expat
833 AH_TEMPLATE(HAVE_LIBEXPAT,[Define to 1 if you have the expat library])
834 SQUID_AUTO_LIB(expat,[ESI expat library],[LIBEXPAT])
835 AS_IF([test "x$squid_opt_use_esi" != "xno" -a "x$with_expat" != "xno"],[
836 SQUID_STATE_SAVE(squid_expat_state)
837 PKG_CHECK_MODULES([LIBEXPAT],[expat],[],[
838 AC_CHECK_LIB([expat],[main],[LIBEXPAT_LIBS="-lexpat"])
840 CPPFLAGS="$LIBEXPAT_CFLAGS $CPPFLAGS"
841 AC_CHECK_HEADERS(expat.h)
842 SQUID_STATE_ROLLBACK(squid_expat_state)
843 AS_IF([test "x$LIBEXPAT_LIBS" != "x"],[
844 squid_opt_use_esi=yes
845 LIBEXPAT_LIBS="$LIBEXPAT_PATH $LIBEXPAT_LIBS"
846 AC_DEFINE(HAVE_LIBEXPAT,1,[Define to 1 if you have the expat library])
848 [test "x$with_expat" = "xyes"],[AC_MSG_ERROR([Required library expat not found.])],
849 [AC_MSG_NOTICE([Library expat not found.])]
852 AM_CONDITIONAL(ENABLE_LIBEXPAT,[test "x$LIBEXPAT_LIBS" != "x"])
853 AC_SUBST(LIBEXPAT_LIBS)
855 # ESI support libraries: xml2
856 AH_TEMPLATE(HAVE_LIBXML2,[Define to 1 if you have the xml2 library])
857 SQUID_AUTO_LIB(xml2,[ESI xml2 library],[LIBXML2])
858 AS_IF([test "x$squid_opt_use_esi" != "xno" -a "x$with_xml2" != "xno"],[
859 SQUID_STATE_SAVE([squid_libxml2_save])
860 PKG_CHECK_MODULES([LIBXML2],[libxml-2.0],[],[
861 AC_CHECK_LIB([xml2],[main],[LIBXML2_LIBS="$LIBXML2_PATH -lxml2"])
863 CPPFLAGS="$LIBXML2_CFLAGS $CPPFLAGS"
864 AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
865 SQUID_STATE_ROLLBACK([squid_libxml2_save])
867 AS_IF([test "x$LIBXML2_LIBS" != "x"],[
868 squid_opt_use_esi=yes
869 CPPFLAGS="$LIBXML2_CFLAGS $CPPFLAGS"
870 LIBXML2_LIBS="$LIBXML2_PATH $LIBXML2_LIBS"
871 AC_DEFINE(HAVE_LIBXML2,1,[Define to 1 if you have the xml2 library])
872 ],[test "x$with_xml2" = "xyes"],[
873 AC_MSG_ERROR([Required library xml2 not found])
875 AC_MSG_NOTICE([Library xml2 not found.])
878 AM_CONDITIONAL(ENABLE_LIBXML2,[test "x$LIBXML2_LIBS" != "x"])
879 AC_SUBST(LIBXML2_LIBS)
881 AS_IF([test "x$squid_opt_use_esi" = "xyes"],[
882 AS_IF([test "x$LIBXML2_LIBS" = "x" -a "x$LIBEXPAT_LIBS" = "x"],[
883 AC_MSG_ERROR([ESI processor requires libxml2 or libexpat])
885 AC_MSG_NOTICE([Enabling ESI processor: $LIBEXPAT_LIBS $LIBXML2_LIBS])
886 AC_DEFINE(USE_SQUID_ESI,1,[Compile the ESI processor])
888 AS_IF(test "x$squid_opt_use_esi" = "xno",[
889 AC_MSG_NOTICE([Disabling ESI processor.])
891 AC_MSG_NOTICE([Disabling ESI processor. libxml2 and libexpat not found.])
894 AM_CONDITIONAL(ENABLE_ESI, test "x$squid_opt_use_esi" = "xyes")
896 AC_ARG_ENABLE(icap-client,
897 AS_HELP_STRING([--disable-icap-client],[Disable the ICAP client.]),[
898 SQUID_YESNO([$enableval],[--enable-icap-client])
900 SQUID_DEFINE_BOOL(ICAP_CLIENT,${enable_icap_client:=yes}, [Enable ICAP client features in Squid])
901 AS_IF(test "x$enable_icap_client" != "xno", squid_opt_use_adaptation="yes")
902 AM_CONDITIONAL(ENABLE_ICAP_CLIENT, test "x$enable_icap_client" != "xno")
905 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]),[
906 SQUID_YESNO([$enableval],[--enable-ecap])],[
909 dnl Perform configuration consistency checks for eCAP
910 AS_IF([test "x$enable_ecap" != "xno"],[
911 AS_IF([test "x$enable_shared" != "xyes"],[
912 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-shared with --enable-ecap.])
915 AS_IF([test -n "$PKG_CONFIG"],[
916 dnl eCAP support requires libecap.
917 dnl This Squid supports libecap v1.0.x.
918 dnl Use EXT_ prefix to distinguish external libecap (that we check for
919 dnl here) from our own convenience ecap library in Makefiles.
920 PKG_CHECK_MODULES([EXT_LIBECAP],[libecap >= 1.0 libecap < 1.1])
922 AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
925 SQUID_STATE_SAVE(squid_ecap_state)
926 AC_MSG_CHECKING([whether -lecap will link])
927 CXXFLAGS="$CXXFLAGS $EXT_LIBECAP_CFLAGS"
928 LIBS="$LIBS $EXT_LIBECAP_LIBS"
929 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libecap/common/names.h>]],[[
930 const libecap::Name test("test", libecap::Name::NextId());
933 squid_opt_use_adaptation=yes
936 AS_IF([test "x$enable_ecap" = "xyes"],[
937 AC_MSG_ERROR([eCAP library will not link.
938 You may need to rebuild libecap using the same version of GCC as Squid.
939 There have been breaking ABI changes in the libstdc++ STL with GCC 5.])
941 AC_MSG_NOTICE([eCAP library will not link.
942 You may need to rebuild libecap using the same version of GCC as Squid.
943 There have been breaking ABI changes in the libstdc++ STL with GCC 5.])
947 SQUID_STATE_ROLLBACK(squid_ecap_state)
949 SQUID_DEFINE_BOOL(USE_ECAP,${enable_ecap:=no},[Whether to use eCAP support])
950 AM_CONDITIONAL(ENABLE_ECAP, test "x$enable_ecap" = "xyes")
952 dnl enable adaptation if requested by specific adaptation mechanisms
954 AS_IF([test "x$squid_opt_use_adaptation" = "xyes"],[ADAPTATION_LIBS="adaptation/libadaptation.la"])
955 SQUID_DEFINE_BOOL(USE_ADAPTATION,${squid_opt_use_adaptation:=no}, [common adaptation support])
956 AM_CONDITIONAL(ENABLE_ADAPTATION, test "x$squid_opt_use_adaptation" = "xyes")
957 AC_SUBST(ADAPTATION_LIBS)
959 AS_IF([test "x$squid_host_os" = "xmingw"],[enable_wccp=no])
961 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]),[
962 SQUID_YESNO([$enableval],[--enable-wccp])
964 SQUID_DEFINE_BOOL(USE_WCCP, ${enable_wccp:=yes}, [Define to enable WCCP])
965 AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $enable_wccp])
967 AS_IF([test "x$squid_host_os" = "xmingw"],[enable_wccpv2=no])
968 AC_ARG_ENABLE(wccpv2,
969 AS_HELP_STRING([--disable-wccpv2],
970 [Disable Web Cache Coordination V2 Protocol]), [
971 SQUID_YESNO([$enableval],[--enable-wccpv2])
973 SQUID_DEFINE_BOOL(USE_WCCPv2,${enable_wccpv2:=yes},
974 [Define to enable WCCP V2])
975 AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $enable_wccpv2])
978 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
979 SQUID_YESNO([$enableval],[--enable-snmp])
981 SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes},
982 [Define to enable SNMP monitoring of Squid])
983 AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
984 AS_IF([test "x$enable_snmp" = "xyes"],[SNMPLIB="../lib/snmplib/libsnmplib.la"])
985 AC_MSG_NOTICE([SNMP support enabled: $enable_snmp])
989 AS_HELP_STRING([--disable-eui],
990 [Disable use of ARP / MAC/ EUI (ether address)]), [
991 SQUID_YESNO([$enableval],[--enable-eui])
993 AS_IF([test "x${enable_eui:=yes}" = "xyes"],[
994 SQUID_STATE_SAVE(LIBEUI)
995 # GLIBC 2.30 deprecates sysctl.h. Test with the same flags that (may) break includes later.
997 CXXFLAGS=$SQUID_CXXFLAGS
998 AS_CASE(["$squid_host_os"],
999 [linux|solaris|freebsd|openbsd|netbsd|cygwin],[:],
1000 [mingw],[EUILIB="-liphlpapi"],
1001 [AC_MSG_WARN([EUI support probably will not work on host $host.])]
1003 # iphlpapi.h check delayed after winsock2.h
1018 #include <sys/types.h>
1019 #include <sys/socket.h>
1022 # OpenBSD, FreeBSD and NetBSD requires sys/param.h to be included before sysctl.h and net/if_dl.h
1027 #if HAVE_SYS_PARAM_H
1028 #include <sys/param.h>
1031 SQUID_STATE_ROLLBACK(LIBEUI)
1034 AC_MSG_NOTICE([EUI (MAC address) controls enabled: $enable_eui])
1035 SQUID_DEFINE_BOOL(USE_SQUID_EUI,$enable_eui,
1036 [Define this to include code which lets you use ethernet addresses. This code uses API initially defined in 4.4-BSD.])
1037 AM_CONDITIONAL(ENABLE_EUI, [test "x$enable_eui" = "xyes" ])
1041 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]), [
1042 SQUID_YESNO([$enableval],[--enable-htcp])
1044 SQUID_DEFINE_BOOL(USE_HTCP,${enable_htcp:=yes},
1045 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
1046 AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
1047 AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
1049 # Cryptograhic libraries
1050 SQUID_AUTO_LIB(nettle,[Nettle crypto],[LIBNETTLE])
1051 SQUID_CHECK_LIB_WORKS(nettle,[
1052 SQUID_STATE_SAVE(squid_nettle_state)
1053 PKG_CHECK_MODULES([LIBNETTLE],[nettle >= 3.4],[
1054 CPPFLAGS="$LIBNETTLE_CFLAGS $CPPFLAGS"
1055 AC_CHECK_HEADERS(nettle/base64.h nettle/md5.h)
1057 SQUID_STATE_ROLLBACK(squid_nettle_state)
1060 dnl Check for libcrypt
1062 dnl Some of our helpers use crypt(3) which may be in libc, or in
1063 dnl libcrypt (eg FreeBSD)
1064 AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
1065 dnl Solaris10 provides MD5 natively through libmd5
1066 AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
1069 SQUID_AUTO_LIB(gnutls,[GnuTLS crypto],[LIBGNUTLS])
1070 SQUID_CHECK_LIB_WORKS(gnutls,[
1071 SQUID_STATE_SAVE(squid_gnutls_state)
1072 PKG_CHECK_MODULES([LIBGNUTLS],[gnutls >= 3.4.0],[
1073 CPPFLAGS="$LIBGNUTLS_CFLAGS $CPPFLAGS"
1074 AC_CHECK_HEADERS(gnutls/gnutls.h gnutls/x509.h gnutls/abstract.h)
1076 SQUID_STATE_ROLLBACK(squid_gnutls_state)
1080 dnl User may specify OpenSSL is needed from a non-standard location
1081 SQUID_OPTIONAL_LIB(openssl,[OpenSSL],[LIBOPENSSL])
1082 AH_TEMPLATE(USE_OPENSSL,[OpenSSL support is available])
1083 ## OpenSSL is default disable due to licensing issues on some OS
1084 AS_IF([test "x$with_openssl" = "xyes"],[
1085 CPPFLAGS="$LIBOPENSSL_CFLAGS $CPPFLAGS"
1097 openssl/opensslv.h \
1107 # User may have provided a custom location for OpenSSL. Otherwise...
1108 SQUID_STATE_SAVE(squid_openssl_state)
1109 LIBS="$LIBS $LIBOPENSSL_PATH"
1111 # auto-detect using pkg-config
1112 PKG_CHECK_MODULES([LIBOPENSSL],[openssl],,[
1113 ## For some OS pkg-config is broken or unavailable.
1114 ## Detect libraries the hard way.
1116 # Windows MinGW has some special libraries ...
1117 AS_IF([test "x$squid_host_os" = "xmingw"],[
1118 LIBOPENSSL_LIBS='-lssleay32 -leay32 -lgdi32 $LIBOPENSSL_LIBS'
1119 AC_MSG_NOTICE([Windows OpenSSL library support: yes -lssleay32 -leay32 -lgdi32])
1122 AC_CHECK_LIB(crypto,[CRYPTO_new_ex_data],[LIBOPENSSL_LIBS="-lcrypto $LIBOPENSSL_LIBS"],[
1123 AC_MSG_ERROR([library 'crypto' is required for OpenSSL])
1125 AC_CHECK_LIB(ssl,[SSL_CTX_new],[LIBOPENSSL_LIBS="-lssl $LIBOPENSSL_LIBS"],[
1126 AC_MSG_ERROR([library 'ssl' is required for OpenSSL])
1130 SQUID_STATE_ROLLBACK(squid_openssl_state) #de-pollute LIBS
1132 AS_IF([test "x$LIBOPENSSL_LIBS" != "x"],[
1133 CXXFLAGS="$LIBOPENSSL_CFLAGS $CXXFLAGS"
1134 SSLLIB="$LIBOPENSSL_PATH $LIBOPENSSL_LIBS $SSLLIB"
1135 AC_DEFINE(USE_OPENSSL,1,[OpenSSL support is available])
1137 # check for API functions
1138 SQUID_CHECK_LIBCRYPTO_API
1139 SQUID_CHECK_LIBSSL_API
1140 SQUID_CHECK_OPENSSL_TLS_METHODS
1141 SQUID_STATE_SAVE(check_SSL_CTX_get0_certificate)
1142 LIBS="$LIBS $SSLLIB"
1143 AC_CHECK_LIB(ssl, SSL_CTX_get0_certificate, [
1144 AC_DEFINE(HAVE_SSL_CTX_GET0_CERTIFICATE, 1, [SSL_CTX_get0_certificate is available])
1146 missing_SSL_CTX_get0_certificate=yes
1148 SQUID_STATE_ROLLBACK(check_SSL_CTX_get0_certificate)
1150 # check for other specific broken implementations
1151 AS_IF([test "x$missing_SSL_CTX_get0_certificate" = "xyes"],SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS)
1152 SQUID_CHECK_OPENSSL_CONST_SSL_METHOD
1153 SQUID_CHECK_OPENSSL_CONST_CRYPTO_EX_DATA
1154 SQUID_CHECK_OPENSSL_CONST_SSL_SESSION_CB_ARG
1155 SQUID_CHECK_OPENSSL_CONST_X509_GET0_SIGNATURE_ARGS
1156 SQUID_CHECK_OPENSSL_TXTDB
1158 AS_IF([test "x$SSLLIB" = "x"],[AC_MSG_ERROR([Required OpenSSL library not found])])
1160 AC_MSG_NOTICE([OpenSSL library support: ${with_openssl:=no} ${LIBOPENSSL_PATH} ${LIBOPENSSL_LIBS}])
1161 AM_CONDITIONAL(ENABLE_SSL,[ test "x$with_openssl" = "xyes" ])
1164 # Kerberos support libraries: MIT
1165 SQUID_AUTO_LIB(mit-krb5,[MIT Kerberos],[LIB_KRB5])
1166 AH_TEMPLATE(USE_APPLE_KRB5,[Apple Kerberos support is available])
1167 AH_TEMPLATE(USE_SOLARIS_KRB5,[Solaris Kerberos support is available])
1168 SQUID_CHECK_LIB_WORKS(mit-krb5,[
1169 SQUID_STATE_SAVE(squid_mit_krb5_save)
1170 AS_IF([test "x$squid_host_os" = "xsolaris"],[
1171 # pkg-config not available for Solaris krb5 implementation
1172 SQUID_CHECK_SOLARIS_KRB5
1174 PKG_CHECK_MODULES([LIBMIT_KRB5],[mit-krb5 mit-krb5-gssapi],[
1175 AS_IF([test "x$squid_host_os" = "xdarwin"],[
1176 AC_DEFINE(USE_APPLE_KRB5,1,[Apple Kerberos support is available])
1177 AC_CHECK_LIB(resolv,[main],[LIBMIT_KRB5_LIBS="$LIBMIT_KRB5_LIBS -lresolv"],[
1178 AC_MSG_ERROR([library 'resolv' is required for Apple Kerberos])
1181 CPPFLAGS="$LIBMIT_KRB5_CFLAGS $CPPFLAGS"
1182 LIBS="$LIBMIT_KRB5_PATH $LIBMIT_KRB5_LIBS $LIBS"
1183 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1184 AC_CHECK_HEADERS(gssapi/gssapi_ext.h gssapi/gssapi_generic.h)
1185 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1186 AC_CHECK_HEADERS(profile.h)
1187 SQUID_CHECK_KRB5_FUNCS
1190 SQUID_STATE_ROLLBACK(squid_mit_krb5_save)
1193 # Kerberos support libraries: Heimdal
1194 SQUID_AUTO_LIB(heimdal-krb5,[Heimdal Kerberos],[LIBHEIMDAL_KRB5])
1195 SQUID_CHECK_LIB_WORKS(heimdal-krb5,[
1196 AS_IF([test "x$LIBMIT_KRB5_LIBS" = "x"],[
1197 SQUID_STATE_SAVE(squid_heimdal_krb5_save)
1198 PKG_CHECK_MODULES([LIBHEIMDAL_KRB5],[heimdal-krb5 heimdal-gssapi],[
1199 CPPFLAGS="$LIBHEIMDAL_KRB5_CFLAGS $CPPFLAGS"
1200 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1201 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1203 LIBS="$LIBHEIMDAL_KRB5_PATH $LIBHEIMDAL_KRB5_LIBS $LIBS"
1204 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1205 SQUID_CHECK_KRB5_FUNCS
1207 SQUID_STATE_ROLLBACK(squid_heimdal_krb5_save)
1211 # Kerberos support libraries: GNU GSS
1212 SQUID_AUTO_LIB(gss,[GNU gss],[LIBGSS])
1213 SQUID_CHECK_LIB_WORKS(gss,[
1214 AS_IF([test "x$LIBMIT_KRB5_LIBS" = "x" -a "x$LIBHEIMDAL_KRB5_LIBS" = "x"],[
1215 SQUID_STATE_SAVE(squid_gss_save)
1216 PKG_CHECK_MODULES([LIBGSS],[gss],[
1217 CPPFLAGS="$LIBGSS_CFLAGS $CPPFLAGS"
1218 AC_CHECK_HEADERS(gss.h)
1219 LIBS="$LIBGSS_PATH $LIBS"
1220 SQUID_CHECK_WORKING_GSSAPI
1221 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1222 SQUID_CHECK_SPNEGO_SUPPORT
1223 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1224 SQUID_CHECK_WORKING_KRB5
1225 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1227 SQUID_STATE_ROLLBACK(squid_gss_save)
1231 SQUID_AUTO_LIB(ldap,[LDAP],[LIBLDAP])
1232 SQUID_CHECK_LIB_WORKS(ldap,[
1233 dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
1234 dnl only with Windows LDAP libraries using -lwldap32
1235 AS_IF([test "$squid_host_os" = "mingw"],[
1236 LIBLDAP_LIBS="-lwldap32"
1238 SQUID_STATE_SAVE(squid_ldap_state)
1239 LIBS="$LIBLDAP_PATH $LIBPTHREADS $LIBS"
1240 PKG_CHECK_MODULES([LIBLDAP],[ldap],[],[
1241 AC_CHECK_LIB(lber, ber_init, [LIBLBER="-llber"])
1242 AC_CHECK_LIB(ldap, ldap_init, [LIBLDAP_LIBS="-lldap $LIBLBER"])
1243 dnl if no ldap lib found check for mozilla version
1244 AS_IF([test "x$ac_cv_lib_ldap_ldap_init" != "xyes"],[
1245 SQUID_STATE_SAVE(squid_ldap_mozilla)
1246 LIBS="$LIBLDAP_PATH $LIBPTHREADS"
1247 AC_CHECK_LIB(ldap60, ldap_init, [LIBLDAP_LIBS="-lldap60 $LIBLBER"])
1248 LIBS="$LIBLDAP_PATH $LIBLDAP_LIBS $LIBPTHREADS"
1249 AC_CHECK_LIB(prldap60, prldap_init, [LIBLDAP_LIBS="-lprldap60 $LIBLDAP_LIBS"])
1250 LIBS="$LIBLDAP_PATH $LIBLDAP_LIBS $LIBPTHREADS"
1251 AC_CHECK_LIB(ssldap60, ldapssl_init, [LIBLDAP_LIBS="-lssldap60 $LIBLDAP_LIBS"])
1252 SQUID_STATE_ROLLBACK(squid_ldap_mozilla)
1255 AC_CHECK_HEADERS(ldap.h lber.h)
1256 AC_CHECK_HEADERS(mozldap/ldap.h)
1257 SQUID_CHECK_LDAP_API
1261 SQUID_AUTO_LIB(systemd,[systemd API for start-up notification],[LIBSYSTEMD])
1262 SQUID_CHECK_LIB_WORKS(systemd,[
1263 SQUID_STATE_SAVE(squid_systemd_state)
1264 LIBS="$LIBS $LIBSYSTEMD_PATH"
1265 PKG_CHECK_MODULES(LIBSYSTEMD,[libsystemd >= 209],[
1266 AC_CHECK_HEADERS(systemd/sd-daemon.h)
1268 SQUID_STATE_ROLLBACK(squid_systemd_state)
1271 AC_ARG_ENABLE(forw-via-db,
1272 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
1273 SQUID_YESNO([$enableval],[--enable-forw-via-db])
1275 SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
1276 [Enable Forw/Via database])
1277 AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
1279 AC_ARG_ENABLE(cache-digests,
1280 AS_HELP_STRING([--enable-cache-digests],
1281 [Use Cache Digests. See https://wiki.squid-cache.org/SquidFaq/CacheDigests]),[
1282 SQUID_YESNO([$enableval],[--enable-cache-digests])
1284 SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
1285 [Use Cache Digests for locating objects in neighbor caches.])
1286 AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
1289 ################################
1290 # check for netio plugin stuff #
1291 ################################
1292 dnl order of these options handling is relevant in case the user
1293 dnl supplies more than one --enable option. Options handled later
1294 dnl override those handled earlier for io loop method manual override
1295 AC_ARG_ENABLE(select,
1296 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),[
1297 SQUID_YESNO([$enableval],[--enable-select])
1298 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="select"])
1300 AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
1303 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),[
1304 SQUID_YESNO([$enableval],[--enable-poll])
1305 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="poll"])
1307 AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
1309 AC_ARG_ENABLE(kqueue,
1310 AS_HELP_STRING([--disable-kqueue],
1311 [Disable kqueue(2) support.]), [
1312 SQUID_YESNO([$enableval],[--enable-kqueue])
1314 AS_IF([test "x${enable_kqueue:=auto}" != "xno"],[
1315 AC_CHECK_HEADERS([sys/event.h],[],[
1316 AS_IF([test "x${enable_kqueue}" = "xyes"],[
1317 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
1320 AC_CHECK_FUNCS(kqueue,[],[
1321 AS_IF([test "x${enable_kqueue}" = "xyes"],[
1322 AC_MSG_ERROR([kqueue support missing in libc library.])
1325 AS_IF([test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes"],[
1326 squid_opt_io_loop_engine="kqueue"
1331 AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
1334 AC_ARG_ENABLE(epoll,
1335 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
1337 SQUID_YESNO([$enableval],[--enable-epoll])
1338 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="epoll"])
1340 AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
1342 # auto-detect and verify epoll header and library present and working
1343 # logic mapping and loop method selection are performed later
1344 AS_IF([test "x$enable_epoll" != "xno"],[
1345 # check if libs are needed to support epoll
1346 SQUID_STATE_SAVE(squid_epoll_state)
1347 AC_SEARCH_LIBS(epoll_ctl,[epoll])
1348 AS_IF([test "x$ac_cv_search_epoll_ctl" = "xno"],[enable_epoll=no],
1349 [test "x$ac_cv_search_epoll_ctl" = "xnone required"],[EPOLL_LIBS=""],
1350 [EPOLL_LIBS=$ac_cv_search_epoll_ctl]
1352 AC_SUBST(EPOLL_LIBS)
1353 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
1355 # epoll requires sys/epoll.h
1356 AC_CHECK_HEADERS([sys/epoll.h])
1358 dnl Verify that epoll really works
1359 AS_IF([test "x$ac_cv_search_epoll_ctl" != "xno"], SQUID_CHECK_EPOLL)
1361 AS_IF([test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno"],[
1362 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
1366 dnl Enable /dev/poll
1367 AC_ARG_ENABLE(devpoll,
1368 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),[
1369 SQUID_YESNO([$enableval],[--enable-devpoll])
1370 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="devpoll"])
1372 AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
1374 ## auto-detect and verify devpoll header and library present and working
1375 AS_IF([test "x$enable_devpoll" != "xno"],[
1376 # /dev/poll requires ioctl() and write()
1377 AC_CHECK_FUNCS(ioctl)
1378 AC_CHECK_FUNCS(write)
1380 # /dev/poll requires sys/devpoll.h
1381 AC_CHECK_HEADERS([sys/devpoll.h],,[
1382 AS_IF([test "x$enable_devpoll" = "xyes"],[
1383 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
1388 # Verify that /dev/poll really works
1389 AS_IF([test "x$enable_devpoll" != "xno"], SQUID_CHECK_DEVPOLL)
1391 AS_IF([test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno"],[
1392 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
1396 AC_ARG_ENABLE(http-violations,
1397 AS_HELP_STRING([--disable-http-violations],
1398 [This allows you to remove code which is known to
1399 violate the HTTP protocol specification.]), [
1400 SQUID_YESNO([$enableval],[--enable-http-violations])
1402 SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
1403 [Define to enable code which volates the HTTP standard specification])
1404 AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
1406 # IPFW Transparent Proxy
1407 AC_ARG_ENABLE(ipfw-transparent,
1408 AS_HELP_STRING([--enable-ipfw-transparent],
1409 [Enable Transparent Proxy support for systems
1410 using FreeBSD IPFW-style firewalling.]), [
1411 SQUID_YESNO([$enableval],[--enable-ipfw-transparent])
1413 SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
1414 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
1415 AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
1417 # IP-Filter Transparent Proxy
1418 AC_ARG_ENABLE(ipf-transparent,
1419 AS_HELP_STRING([--enable-ipf-transparent],
1420 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
1421 SQUID_YESNO([$enableval],[--enable-ipf-transparent])
1423 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1424 #IPF currently broken. Default-disabled for now.
1425 AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
1427 dnl Enable PF Transparent Proxy
1428 AC_ARG_ENABLE(pf-transparent,
1429 AS_HELP_STRING([--enable-pf-transparent],
1430 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
1431 SQUID_YESNO([$enableval],[--enable-pf-transparent])
1433 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1434 AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
1436 dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
1437 AC_ARG_WITH(nat-devpf,
1438 AS_HELP_STRING([--with-nat-devpf],
1439 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
1440 SQUID_YESNO([$withval],[--with-nat-devpf])
1442 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1443 AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
1445 # Linux Netfilter Transparent Proxy
1446 AC_ARG_ENABLE(linux-netfilter,
1447 AS_HELP_STRING([--enable-linux-netfilter],
1448 [Enable Transparent Proxy support for Linux (Netfilter)]), [
1449 SQUID_YESNO([$enableval],[--enable-linux-netfilter])
1451 AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
1452 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1455 dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
1456 SQUID_AUTO_LIB(netfilter-conntrack,[Netfilter conntrack],[LIBNETFILTER_CONNTRACK])
1457 SQUID_CHECK_LIB_WORKS(netfilter-conntrack,[
1458 SQUID_STATE_SAVE(squid_netfilter_conntrack_state)
1459 PKG_CHECK_MODULES([LIBNETFILTER_CONNTRACK],[libnetfilter_conntrack],[:],[:])
1460 CPPFLAGS="$LIBNETFILTER_CONNTRACK_CFLAGS $CPPFLAGS"
1461 LIBS="$LIBNETFILTER_CONNTRACK_PATH $LIBNETFILTER_CONNTRACK_LIBS $LIBS"
1462 AC_CHECK_HEADERS([ \
1463 libnetfilter_conntrack/libnetfilter_conntrack.h \
1464 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h \
1466 SQUID_STATE_ROLLBACK(squid_netfilter_conntrack_state)
1469 dnl Enable Large file support
1472 AC_ARG_WITH(large-files,
1473 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
1474 SQUID_YESNO([$withval],[--with-large-files])
1475 squid_opt_enable_large_files=$withval
1478 dnl UNIX Build environment
1479 dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
1480 AC_ARG_WITH(build-environment,
1481 AS_HELP_STRING([--with-build-environment=model],
1482 [The build environment to use. Normally one of
1483 POSIX_V6_ILP32_OFF32 (32 bits),
1484 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
1485 POSIX_V6_LP64_OFF64 (64 bits),
1486 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
1487 XBS5_ILP32_OFF32 i(legacy, 32 bits),
1488 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
1489 XBS5_LP64_OFF64 (legacy, 64 bits),
1490 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
1491 or default (The default for your OS)]), [
1492 AS_CASE(["$withval"],
1493 [yes|no],[AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])],
1494 [buildmodel="$withval"]
1498 #hack. Let's early-detect sizeof(long)
1499 AC_CHECK_SIZEOF(long)
1501 AS_IF([test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"],[
1502 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
1503 AS_IF([test "`getconf _$model 2>/dev/null || true`" = 1 -o "`getconf $model 2>/dev/null || true`"],[
1508 AS_IF([test "x$buildmodel" = "x"],[
1509 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
1512 AS_IF([test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"],[
1513 # define _FILE_OFFSET_BITS if requested and needed
1514 AS_IF([test "x$squid_opt_enable_large_files" = "xyes" -a $ac_cv_sizeof_long -le 4],[
1515 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
1516 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
1517 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
1520 AC_MSG_NOTICE([Using $buildmodel build environment])
1521 AS_IF([ ! test "`getconf _$buildmodel 2>/dev/null || true`" = 1 -o "`getconf $buildmodel 2>/dev/null || true`"],[
1522 AC_MSG_ERROR([Build environment $buildmodel not known to getconf.])
1524 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
1525 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
1526 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1527 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
1529 AS_IF([test "x$squid_host_os" = "xsolaris"],[
1530 # On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1531 # for LDFLAGS -xarch=generic64, but:
1532 # "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1533 # For gcc "-xarch=generic64" must be replaced with "-m64"
1534 # The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
1535 AS_IF([test "x$GCC" = "xyes"],[
1536 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
1537 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
1538 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
1539 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
1540 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1541 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1542 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
1544 AC_MSG_NOTICE([Removing -Usun on $host])
1545 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
1546 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
1550 AC_ARG_ENABLE(follow-x-forwarded-for,
1551 AS_HELP_STRING([--disable-follow-x-forwarded-for],
1552 [Do not follow the X-Forwarded-For
1553 HTTP header to try to find the IP address of the
1554 original or indirect client when a request has
1555 been forwarded through other proxies.]), [
1556 SQUID_YESNO([$enableval],[--enable-follow-x-forwarded-for])
1558 AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
1559 SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
1560 [Enable following X-Forwarded-For headers])
1562 AC_ARG_ENABLE(ident-lookups,
1563 AS_HELP_STRING([--disable-ident-lookups],
1564 [Remove code that supports performing Ident (RFC 931) lookups.]), [
1565 SQUID_YESNO([$enableval],[--enable-ident-lookups])
1567 AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
1568 SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
1570 dnl Select Default hosts file location
1571 AC_ARG_ENABLE(default-hostsfile,
1572 AS_HELP_STRING([--enable-default-hostsfile=path],
1573 [Select default location for hosts file.
1574 See hosts_file directive in squid.conf for details]), [
1575 # TODO: handle the "yes" case cleanly
1576 AS_CASE(["$enableval"],
1577 [no|none],[squid_opt_default_hosts="none"],
1579 squid_opt_default_hosts=$enableval
1580 AS_IF([ ! test -f "$enableval"],[
1581 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
1585 AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
1586 DEFAULT_HOSTS=$squid_opt_default_hosts
1587 AC_SUBST(DEFAULT_HOSTS)
1589 # Select auth schemes modules to build
1591 AS_HELP_STRING([--disable-auth],
1592 [Do not support authentication. When supported, the list of schemes
1593 and helpers to be enabled is defined elsewhere]), [
1594 SQUID_YESNO([$enableval],[--enable-auth])
1596 AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
1597 SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
1598 AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
1603 AC_ARG_ENABLE(auth-basic,
1604 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
1605 [Enable the basic authentication scheme, and build the specified helpers.
1606 Not providing an explicit list of helpers will attempt build of
1607 all possible helpers. Default is to do so.
1608 To disable the basic authentication scheme, use --disable-auth-basic.
1609 To enable but build no helpers, specify "none".
1610 To see available helpers, see the src/auth/basic/ directory. ]),[
1611 #nothing to do really
1613 m4_include([src/auth/basic/helpers.m4])
1615 AC_ARG_ENABLE(auth-digest,
1616 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
1617 [Enable the Digest authentication scheme, and build the specified helpers.
1618 Not providing an explicit list of helpers will attempt build of
1619 all possible helpers. Default is to do so.
1620 To disable the Digest authentication scheme, use --disable-auth-digest.
1621 To enable but build no helpers, specify "none".
1622 To see available helpers, see the src/auth/digest/ directory. ]),[
1623 #nothing to do, really
1625 m4_include([src/auth/digest/helpers.m4])
1627 AC_ARG_ENABLE(auth-negotiate,
1628 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
1629 [Enable the Negotiate authentication scheme, and build the specified
1631 Not providing an explicit list of helpers will attempt build of
1632 all possible helpers. Default is to do so.
1633 To disable the Negotiate authentication scheme,
1634 use --disable-auth-negotiate.
1635 To enable but build no helpers, specify "none".
1636 To see available helpers, see the src/auth/negotiate/ directory. ]),[
1637 #nothing to do, really
1639 m4_include([src/auth/negotiate/helpers.m4])
1641 AC_ARG_ENABLE(auth-ntlm,
1642 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
1643 [Enable the NTLM authentication scheme, and build the specified helpers.
1644 Not providing an explicit list of helpers will attempt build of
1645 all possible helpers. Default is to do so.
1646 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
1647 To enable but build no helpers, specify "none".
1648 To see available helpers, see the src/auth/ntlm/ directory. ]),[
1650 m4_include([src/auth/ntlm/helpers.m4])
1652 dnl Authentication libraries to build
1653 dnl This list will not be needed when each auth library has its own Makefile
1654 dnl this is to be placed AFTER each auth module's handler
1656 for module in $AUTH_MODULES; do
1657 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
1659 AC_SUBST(AUTH_MODULES)
1660 AC_SUBST(AUTH_LIBS_TO_BUILD)
1661 AM_CONDITIONAL(ENABLE_SMBLIB, test "x$require_smblib" = "xyes")
1662 AM_CONDITIONAL(ENABLE_SSPI, test "x$require_sspi" = "xyes")
1664 dnl Select logging daemon helpers to build
1665 AC_ARG_ENABLE(log-daemon-helpers,
1666 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
1667 [This option selects which logging daemon helpers to
1668 build and install as part of the normal build process
1669 For a list of available helpers see the src/log/
1671 #nothing to do, really
1673 m4_include([src/log/helpers.m4])
1675 AC_ARG_ENABLE(external-acl-helpers,
1676 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
1677 [Enable external_acl helpers support and the helpers themselves.
1678 Default is to build all buildable helpers and enable support.
1679 To disable support, use --disable-external-acl-helpers.
1680 To build no helpers, specify "none".
1681 To see available helpers, see the src/acl/external/
1683 #nothing to do, really
1685 m4_include([src/acl/external/helpers.m4])
1687 dnl Select url_rewrite helpers to build
1688 AC_ARG_ENABLE(url-rewrite-helpers,
1689 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
1690 [This option selects which url_rewrite helpers to
1691 build and install as part of the normal build
1692 process. The default is to attempt the build of all possible
1693 helpers. Use --disable-url-rewrite-helpers to build none.
1694 For a list of available helpers see the
1695 src/http/url_rewriters/ directory.]),[
1697 m4_include([src/http/url_rewriters/helpers.m4])
1699 dnl Select security helpers to build
1700 AC_ARG_ENABLE(security-cert-validators,
1701 AS_HELP_STRING([--enable-security-cert-validators="list of helpers"],
1702 [This option selects which security certificate validator
1703 helpers to build and install as part of the normal build
1704 process. The default is to attempt the build of all possible
1705 helpers. Use --disable-security-cert-validators to
1706 build none. For a list of available helpers see the
1707 src/security/cert_validators/ directory.]),[
1709 m4_include([src/security/cert_validators/helpers.m4])
1711 AC_ARG_ENABLE(security-cert-generators,
1712 AS_HELP_STRING([--enable-security-cert-generators="list of helpers"],
1713 [This option selects which security certificate validator
1714 helpers to build and install as part of the normal build
1715 process. The default is to attempt the build of all possible
1716 helpers. Use --disable-security-cert-genrators to
1717 build none. For a list of available helpers see the
1718 src/security/cert_generators/ directory.]),[
1720 m4_include([src/security/cert_generators/helpers.m4])
1722 dnl Select storeid_rewrite helpers to build
1723 AC_ARG_ENABLE(storeid-rewrite-helpers,
1724 AS_HELP_STRING([--enable-storeid-rewrite-helpers="list of helpers"],
1725 [This option selects which Store-ID rewrite helpers to
1726 build and install as part of the normal build
1727 process. The default is to attempt the build of all possible
1728 helpers. Use --disable-storeid-rewrite-helpers to build none.
1729 For a list of available helpers see the
1730 src/store/id_rewriters/ directory.]),[
1732 m4_include([src/store/id_rewriters/helpers.m4])
1734 AC_ARG_WITH(valgrind-debug,
1735 AS_HELP_STRING([--with-valgrind-debug],
1736 [Include debug instrumentation for use with valgrind]),
1738 SQUID_YESNO([$withval],[--with-valgrind-debug])
1739 AS_IF([test "x$withval" != "xno"],[
1740 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
1741 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
1745 SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
1746 [Valgrind memory debugger support])
1747 AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
1749 dnl Enable WIN32 Service compile mode
1750 AC_ARG_ENABLE(win32-service,
1751 AS_HELP_STRING([--enable-win32-service],
1752 [Compile Squid as a WIN32 Service.
1753 Works only on MS-Windows platforms]), [
1754 SQUID_YESNO([$enableval],[--enable-win32-service])
1756 SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
1757 [Enable code supporting MS Windows service mode])
1758 AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
1761 # Disable "unlinkd" code
1762 AC_ARG_ENABLE(unlinkd,
1763 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
1764 SQUID_YESNO([$enableval],[--enable-unlinkd])
1766 SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
1767 [Enable useage of unlinkd])
1768 AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
1769 AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
1771 # Enable backtraces on fatal errors
1772 AC_ARG_ENABLE(stacktraces,
1773 AS_HELP_STRING([--enable-stacktraces],
1774 [Enable automatic call backtrace on fatal errors]), [
1775 SQUID_YESNO([$enableval],[--enable-stacktraces])
1777 SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
1778 [Print stack traces on fatal errors])
1779 AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
1781 # Enable X-Accelerator-Vary for Vary support within an accelerator setup
1782 AC_ARG_ENABLE(x-accelerator-vary,
1783 AS_HELP_STRING([--enable-x-accelerator-vary],
1784 [Enable support for the X-Accelerator-Vary
1785 HTTP header. Can be used to indicate
1786 variance within an accelerator setup.
1787 Typically used together with other code
1788 that adds custom HTTP headers to the requests.]), [
1789 SQUID_YESNO([$enableval],[--enable-x-accelerator-vary])
1791 SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
1792 [Enable support for the X-Accelerator-Vary HTTP header])
1793 AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
1795 SQUID_AUTO_LIB(cppunit,[cppunit test framework],[LIBCPPUNIT])
1796 SQUID_CHECK_LIB_WORKS(cppunit,[
1797 PKG_CHECK_MODULES([LIBCPPUNIT],[cppunit],[
1798 squid_cv_cppunit_version="`pkg-config --modversion cppunit`"
1799 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
1800 AS_UNSET(squid_cv_cppunit_version)
1802 SQUID_STATE_SAVE(squid_cppunit_state)
1803 CXXFLAGS="${CXXFLAGS} ${LIBCPPUNIT_CFLAGS}"
1804 LIBS="${LIBS} ${LIBCPPUNIT_LIBS}"
1805 AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
1806 SQUID_STATE_ROLLBACK(squid_cppunit_state)
1808 AC_MSG_WARN([cppunit does not appear to be installed. Squid does not require this, but code testing with 'make check' will fail.])
1812 dnl Check for headers
1833 linux/posix_types.h \
1841 netinet/in_systm.h \
1893 linux/netfilter_ipv4.h \
1894 linux/netfilter_ipv6/ip6_tables.h \
1896 SQUID_DEFAULT_INCLUDES
1900 /* Netfilter ip(6)tables v1.4.0 has broken headers */
1901 #if HAVE_NETINET_IN_H
1902 #include <netinet/in.h>
1906 dnl *BSD do not include the dependencies for all their net/ and netinet/ files
1907 dnl We must include a few basic type headers for them to work.
1922 SQUID_BSDNET_INCLUDES)
1927 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
1933 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
1935 #include <sys/time.h>
1937 #if HAVE_SYS_RESOURCE_H
1938 #include <sys/resource.h>
1942 AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
1943 #if HAVE_SYS_TYPES_H
1944 #include <sys/types.h>
1946 #include <netinet/in.h>
1947 #include <netinet/in_systm.h>
1948 #include <netinet/ip.h>
1949 #if defined (__linux__) || defined (__CYGWIN__)
1958 dnl Check for typedefs
1959 AC_CHECK_SIZEOF(void *)
1961 # check for a bunch of types
1975 AC_CHECK_TYPE([bool])
1976 #need the defines for PRId64
1977 AC_CHECK_SIZEOF(int64_t)
1978 AC_CHECK_SIZEOF(long)
1979 #need the define for overflow checks
1980 AC_CHECK_SIZEOF(off_t)
1981 AC_CHECK_SIZEOF(size_t)
1983 dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
1984 dnl that is incompatible with the updated Solaris header files.
1985 dnl For this reason, we must check if pad128_t and upad128_t are defined.
1986 AC_CHECK_TYPE(pad128_t,
1987 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
1988 ,SQUID_DEFAULT_INCLUDES)
1990 AC_CHECK_TYPE(upad128_t,
1991 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
1992 ,SQUID_DEFAULT_INCLUDES)
1994 AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
1995 AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
1997 AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
1998 #include <sys/types.h>
1999 #include <sys/socket.h>
2004 AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
2005 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
2006 #include <sys/ipc.h>
2007 #include <sys/msg.h>])
2009 AC_CHECK_TYPE(cpu_set_t,
2010 AC_DEFINE(HAVE_CPU_SET_T,1,[cpu_set_t is defined by the system headers]),,[
2016 dnl Check for special functions
2019 SQUID_AUTO_LIB(cap,[Linux capabilities],[LIBCAP])
2020 SQUID_CHECK_LIB_WORKS(cap,[
2021 SQUID_STATE_SAVE(squid_libcap_state)
2022 PKG_CHECK_MODULES([LIBCAP],[libcap >= 2.09],[:],[:])
2023 CPPFLAGS="$LIBCAP_CFLAGS $CPPFLAGS"
2024 LIBS="$LIBCAP_PATH $LIBCAP_LIBS $LIBS"
2025 SQUID_CHECK_FUNCTIONAL_LIBCAP2
2026 AC_MSG_NOTICE([libcap headers are ok: $squid_cv_sys_capability_works])
2027 AS_IF([test "x$squid_cv_sys_capability_works" = "xno"],[LIBCAP_LIBS=""])
2028 SQUID_STATE_ROLLBACK(squid_libcap_state)
2031 dnl Check for needed libraries
2032 AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
2033 AC_SEARCH_LIBS([res_init],[resolv])
2034 AC_SEARCH_LIBS([__res_search],[resolv])
2035 AC_SEARCH_LIBS([bind],[socket])
2036 AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
2037 AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
2039 # check that we have unix sockets
2040 SQUID_CHECK_UNIX_SOCKET
2041 SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
2043 AC_CHECK_LIB(gnumalloc, malloc)
2044 AS_IF([test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"],[
2045 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
2046 ac_cv_func_mallocblksize=no
2047 ac_cv_func_mallopt=no
2049 AS_CASE(["$squid_host_os"],
2050 [solaris],[AC_MSG_NOTICE([skipping libmalloc check for $host])],
2051 [freebsd],[AC_MSG_NOTICE([skipping libmalloc check for $host])],
2052 [AC_CHECK_LIB(malloc, main)]
2056 AS_IF([test "$squid_host_os" = "mingw"],[
2057 AC_MSG_NOTICE([Use MSVCRT for math functions.])
2059 dnl log() are only used in old C code for now.
2061 AC_SEARCH_LIBS([log],[m])
2065 dnl --with-maxfd present for compatibility with Squid-2.
2066 dnl undocumented in ./configure --help to encourage using the Squid-3 directive
2067 AC_ARG_WITH(maxfd,,[
2070 squid_filedescriptors_num=$withval
2071 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
2073 [AC_MSG_ERROR(--with-maxfd expects a numeric argument)]
2077 AC_ARG_WITH(filedescriptors,
2078 AS_HELP_STRING([--with-filedescriptors=NUMBER],
2079 [Force squid to support NUMBER filedescriptors]),[
2082 squid_filedescriptors_num=$withval
2083 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])],
2084 [AC_MSG_ERROR([--with-filedescriptors expects a numeric argument])]
2088 SQUID_CHECK_DEFAULT_FD_SETSIZE
2092 dnl Enable IPv6 support
2093 AC_MSG_CHECKING([whether to enable IPv6])
2095 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
2096 SQUID_YESNO([$enableval],[--enable-ipv6])
2098 AC_MSG_RESULT(${enable_ipv6:=yes})
2099 SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
2101 AS_IF([test "x$enable_ipv6" = "xyes"],[SQUID_CHECK_SIN6_LEN_IN_SAI])
2102 SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
2103 SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
2105 dnl System-specific library modifications
2106 AH_TEMPLATE(GETTIMEOFDAY_NO_TZP,[Whether gettimeofday takes only one argument])
2109 # -lintl is needed on SCO version 3.2v4.2 for strftime()
2110 # Robert Side <rside@aiinc.bc.ca>
2111 # Mon, 18 Jan 1999 17:48:00 GMT
2112 AC_CHECK_LIB(intl, strftime)
2115 [i386-*-solaris2.*],[
2116 AS_IF([test "x$GCC" = "xyes"],[
2117 AC_MSG_NOTICE([Removing -O for gcc on $host])
2118 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
2123 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
2124 LIBS=`echo $LIBS | sed -e s/-lsocket//`
2125 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
2126 LIBS=`echo $LIBS | sed -e s/-lnsl//`
2127 ac_cv_lib_nsl_main=no
2131 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
2137 public:virtual ~Foo(){}
2139 class Bar:public Foo{
2140 public:Bar():Foo(){}
2143 Foo * myFoo=new Bar();
2144 Bar * myBar=dynamic_cast<Bar *>(myFoo);
2145 assert(myBar != NULL);
2147 AS_IF([test "$ac_cv_require_rtti" = "yes"],[
2148 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
2149 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
2153 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
2155 AS_IF([test "$ac_cv_require_qcpluscmt" = "yes"],[
2156 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
2160 [*-*-solaris2.[[0-4]]],[AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)],
2162 [*-sony-newsos[[56]]*],[AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)]
2165 dnl This has to be before AC_CHECK_FUNCS
2166 # Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2167 # when running configure.
2168 AS_IF([test "x$ac_cv_func_poll" = "x"],[
2172 AC_MSG_NOTICE([disabling poll for $host...])
2173 ac_cv_func_poll='no'
2177 # Henrik Nordstrom (hno@squid-cache.org) 19980817
2178 # poll is problematic on Linux. We disable it
2179 # by default until Linux gets it right.
2180 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2181 AS_IF([test $rev -lt 002002],[
2182 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
2183 ac_cv_func_poll='no'
2187 [powerpc-ibm-aix4.1.*],[
2188 # Mike Laster (mlaster@metavillage.com) 19981021
2189 AC_MSG_NOTICE([disabling poll for $host...])
2190 ac_cv_func_poll='no'
2195 dnl Check for library functions
2197 backtrace_symbols_fd \
2220 pthread_attr_setschedparam \
2221 pthread_attr_setscope \
2222 pthread_setschedparam \
2248 dnl ... and some we provide local replacements for
2257 # Magic which checks whether we are forcing a type of comm loop we
2258 # are actually going to (ab)use.
2259 # Mostly ripped from squid-commloops, thanks to adrian and benno
2261 AS_IF([test "x$squid_opt_io_loop_engine" != "x"],
2262 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine]),
2263 [test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes"],
2264 squid_opt_io_loop_engine="epoll",
2265 [test "x$enable_kqueue" != "xno"],
2266 squid_opt_io_loop_engine="kqueue",
2267 [test "x$enable_devpoll" != "xno"],
2268 squid_opt_io_loop_engine="devpoll",
2269 [test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes"],
2270 squid_opt_io_loop_engine="poll",
2271 [test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"],
2272 squid_opt_io_loop_engine="select",
2274 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
2275 AC_MSG_WARN([Will try select and hope for the best.])
2276 squid_opt_io_loop_engine="select"
2280 AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
2282 AM_CONDITIONAL(ENABLE_POLL, test "x$squid_opt_io_loop_engine" = "xpoll")
2283 AM_CONDITIONAL(ENABLE_EPOLL, test "x$squid_opt_io_loop_engine" = "xepoll")
2284 AM_CONDITIONAL(ENABLE_SELECT, test "x$squid_opt_io_loop_engine" = "xselect")
2285 AM_CONDITIONAL(ENABLE_KQUEUE, test "x$squid_opt_io_loop_engine" = "xkqueue")
2286 AM_CONDITIONAL(ENABLE_DEVPOLL, test "x$squid_opt_io_loop_engine" = "xdevpoll")
2288 AS_CASE([$squid_opt_io_loop_engine],
2289 [epoll],[AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])],
2290 [devpoll],[AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop])],
2291 [poll],[AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])],
2292 [kqueue],[AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])],
2293 [select],[AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])],
2296 AS_IF([test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes"],[
2297 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
2300 AC_CHECK_HEADERS(mswsock.h)
2301 AC_MSG_CHECKING([for constant CMSG_SPACE])
2302 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2303 #if HAVE_SYS_SOCKET_H
2304 #include <sys/socket.h>
2307 #include <mswsock.h>
2310 int a[CMSG_SPACE(int)];
2313 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
2318 AC_CHECK_TYPE(struct cmsghdr,AC_DEFINE(HAVE_CMSGHDR,1,[The system provides struct cmsghdr]),,[
2319 #if HAVE_SYS_SOCKET_H
2320 #include <sys/socket.h>
2323 #include <mswsock.h>
2326 #include <winsock2.h>
2330 AC_CHECK_TYPE(struct iovec,AC_DEFINE(HAVE_IOVEC,1,[The system provides struct iovec]),,[
2331 #if HAVE_SYS_SOCKET_H
2332 #include <sys/socket.h>
2335 #include <winsock2.h>
2338 #include <sys/uio.h>
2342 AC_CHECK_TYPE(struct msghdr,AC_DEFINE(HAVE_MSGHDR,1,[The system provides struct msghdr]),,[
2343 #if HAVE_SYS_SOCKET_H
2344 #include <sys/socket.h>
2347 #include <mswsock.h>
2350 #include <winsock2.h>
2354 AC_CHECK_TYPE(struct sockaddr_un,AC_DEFINE(HAVE_SOCKADDR_UN,1,[The system provides sockaddr_un]),,[
2358 #if HAVE_SYS_SOCKET_H
2359 #include <sys/socket.h>
2362 #include <winsock2.h>
2366 dnl IP-Filter support requires ipf header files. These aren't
2367 dnl installed by default, so we need to check for them
2368 AS_IF([test "x$enable_ipf_transparent" != "xno"],[
2369 SQUID_CHECK_BROKEN_SOLARIS_IPFILTER
2370 AC_MSG_CHECKING(for availability of IP-Filter header files)
2371 # hold on to your hats...
2373 [test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
2374 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
2375 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
2376 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes"],
2377 [have_ipfilter_compat_header="yes"])
2380 [test "x$have_ipfilter_compat_header" = "xyes" -a \
2381 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
2382 "x$ac_cv_header_ip_nat_h" = "xyes"],[enable_ipf_transparent="yes"],
2384 [test "x$have_ipfilter_compat_header" = "xyes" -a \
2385 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
2386 "x$ac_cv_header_netinet_ip_nat_h" = "xyes"],[enable_ipf_transparent="yes"],
2387 [enable_ipf_transparent="no"])
2389 AC_MSG_RESULT($IPF_TRANSPARENT)
2391 ## On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
2392 ## Solaris minor version (8, 9, 10, ...)
2393 AS_IF([test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris"],[
2394 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
2395 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
2396 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
2399 AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
2400 SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
2401 [Enable support for IPF-style transparent proxying])
2403 dnl PF /dev/pf support requires a header file.
2404 AS_IF([test "x$with_nat_devpf" != "xno"],[
2405 AS_IF([test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
2406 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"],[
2407 AS_IF([test "x$with_nat_devpf" = "xauto"],[with_nat_devpf="no"])
2409 AS_IF([test "x$with_nat_devpf" = "xyes"],[
2410 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
2415 SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
2416 [Enable support for PF-style transparent proxying])
2417 SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
2418 [Enable support for /dev/pf NAT lookups])
2420 AS_IF([test "x$enable_linux_netfilter" != "xno"],[
2421 AS_IF([test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"],[
2422 AS_IF([test "x$enable_linux_netfilter" = "xauto"],[enable_linux_netfilter=yes])
2424 AS_IF([test "x$enable_linux_netfilter" = "xauto"],[
2425 enable_linux_netfilter=no
2427 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
2431 SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
2432 [Enable support for Transparent Proxy on Linux via Netfilter])
2434 dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
2435 AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
2436 AS_IF([test "x$enable_linux_netfilter" = "xyes" -a "x$with_cap" != "xyes"],[
2437 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
2438 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
2439 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
2442 AS_IF([test "x$with_netfilter_conntrack" = "xyes" -a "x$with_cap" != "xyes"],[
2443 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
2444 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
2445 with_netfilter_conntrack=no
2447 AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack}])
2450 AC_ARG_ENABLE(zph-qos,
2451 AS_HELP_STRING([--disable-zph-qos],[Disable ZPH QOS support]), [
2452 SQUID_YESNO([$enableval],[--enable-zph-qos])
2454 SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
2455 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
2456 TOS field of HIT responses to help policing network traffic])
2457 AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
2458 AS_IF([test "x$enable_zph_qos" = "xyes"],[
2459 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
2460 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
2461 [Enable support for QOS netfilter mark preservation])
2464 AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
2467 SQUID_DETECT_UDP_SND_BUFSIZE
2468 SQUID_DETECT_UDP_RECV_BUFSIZE
2469 SQUID_DETECT_TCP_SND_BUFSIZE
2470 SQUID_DETECT_TCP_RECV_BUFSIZE
2472 SQUID_CHECK_NEED_SYS_ERRLIST
2473 SQUID_CHECK_MAXPATHLEN
2475 SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
2476 SQUID_CHECK_RESOLVER_FIELDS
2478 AC_CHECK_HEADERS(sys/statvfs.h)
2479 AS_IF([test "x$ac_cv_header_sys_statvfs_h" = "xyes"],[SQUID_CHECK_WORKING_STATVFS])
2480 AS_IF([test "x$ac_cv_func_statvfs" != "xyes"],[
2481 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/vfs.h sys/statfs.h)
2482 AC_CHECK_FUNCS(statfs)
2483 SQUID_CHECK_F_FRSIZE_IN_STATFS
2486 dnl Squid will not usually attempt to translate templates when building
2487 AC_ARG_ENABLE(translation,
2488 AS_HELP_STRING([--enable-translation],[Generate the localized error page templates and manuals.
2489 Which can also be downloaded from http://www.squid-cache.org/Versions/langpack/.]), [
2490 SQUID_YESNO([$enableval],[--enable-translation])
2492 AS_IF([test "x${enable_translation:=no}" = "xyes"],[
2493 AX_WITH_PROG([PO2HTML],[po2html])
2494 AX_WITH_PROG([PO2TEXT],[po2txt])
2501 AM_CONDITIONAL(ENABLE_TRANSLATION, test "x${enable_translation:=no}" = "xyes")
2503 dnl Squid now has limited locale handling ...
2505 AC_ARG_ENABLE(auto-locale,
2506 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
2507 clients request headers.
2508 When disabled Squid requires explicit language configuration.]), [
2509 SQUID_YESNO([$enableval],[--enable-auto-locale])
2511 AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
2512 SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
2513 [Use multi-language support on error pages])
2516 dnl Need the debugging version of malloc if available
2518 AS_IF([test "x$ac_cv_lib_malloc_main" = "xyes"],[
2519 AS_IF([test -r /usr/lib/debug/malloc.o],[XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"])
2520 AS_IF([test -r /usr/lib/debug/mallocmap.o],[XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"]);
2524 AS_IF([test "x$XTRA_LIBS" = "x"],[
2527 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
2532 AC_SUBST(SQUID_CFLAGS)
2533 AC_SUBST(SQUID_CXXFLAGS)
2535 # Prerequisite: CXXFLAGS have been finalized.
2536 AC_ARG_VAR([BUILDCXXFLAGS],[C++ compiler flags for building compile-time tools. e.g. cf_gen])
2537 AS_IF([test "x$BUILDCXXFLAGS" = "x"],[
2538 # if we are NOT cross-compiling, use the default build flags for cf_gen and friends
2539 # otherwise rely on the user-provided value
2540 AS_IF([test "x$squid_cv_check_marchnative" = "xyes"],[
2541 # always valid for the Build compiler.
2542 BUILDCXXFLAGS="-march=native"
2544 BUILDCXXFLAGS="$BUILDCXXFLAGS $CXXFLAGS"
2546 AC_SUBST(BUILDCXXFLAGS)
2548 AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
2549 AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
2550 AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
2551 AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
2552 AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
2553 AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
2554 AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
2555 AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
2556 AC_MSG_NOTICE([BUILD Tools C++ FLAGS: $BUILDCXXFLAGS])
2558 dnl Clean up after OSF/1 core dump bug
2566 doc/manuals/Makefile
2567 doc/release-notes/Makefile
2571 lib/libTrie/Makefile
2572 lib/libTrie/test/Makefile
2573 lib/ntlmauth/Makefile
2576 lib/snmplib/Makefile
2581 src/acl/external/Makefile
2582 src/acl/external/AD_group/Makefile
2583 src/acl/external/delayer/Makefile
2584 src/acl/external/eDirectory_userip/Makefile
2585 src/acl/external/file_userip/Makefile
2586 src/acl/external/kerberos_ldap_group/Makefile
2587 src/acl/external/kerberos_sid_group/Makefile
2588 src/acl/external/LDAP_group/Makefile
2589 src/acl/external/LM_group/Makefile
2590 src/acl/external/session/Makefile
2591 src/acl/external/SQL_session/Makefile
2592 src/acl/external/unix_group/Makefile
2593 src/acl/external/wbinfo_group/Makefile
2594 src/acl/external/time_quota/Makefile
2595 src/adaptation/Makefile
2596 src/adaptation/icap/Makefile
2597 src/adaptation/ecap/Makefile
2600 src/auth/basic/Makefile
2601 src/auth/basic/DB/Makefile
2602 src/auth/basic/fake/Makefile
2603 src/auth/basic/getpwnam/Makefile
2604 src/auth/basic/LDAP/Makefile
2605 src/auth/basic/NCSA/Makefile
2606 src/auth/basic/NIS/Makefile
2607 src/auth/basic/PAM/Makefile
2608 src/auth/basic/POP3/Makefile
2609 src/auth/basic/RADIUS/Makefile
2610 src/auth/basic/SASL/Makefile
2611 src/auth/basic/SMB/Makefile
2612 src/auth/basic/SMB_LM/Makefile
2613 src/auth/basic/SSPI/Makefile
2614 src/auth/digest/Makefile
2615 src/auth/digest/eDirectory/Makefile
2616 src/auth/digest/file/Makefile
2617 src/auth/digest/LDAP/Makefile
2618 src/auth/negotiate/Makefile
2619 src/auth/negotiate/kerberos/Makefile
2620 src/auth/negotiate/SSPI/Makefile
2621 src/auth/negotiate/wrapper/Makefile
2622 src/auth/ntlm/Makefile
2623 src/auth/ntlm/fake/Makefile
2624 src/auth/ntlm/SMB_LM/Makefile
2625 src/auth/ntlm/SSPI/Makefile
2627 src/clients/Makefile
2632 src/DiskIO/AIO/Makefile
2633 src/DiskIO/Blocking/Makefile
2634 src/DiskIO/DiskDaemon/Makefile
2635 src/DiskIO/DiskThreads/Makefile
2636 src/DiskIO/IpcIo/Makefile
2637 src/DiskIO/Mmapped/Makefile
2647 src/http/one/Makefile
2648 src/http/url_rewriters/Makefile
2649 src/http/url_rewriters/fake/Makefile
2650 src/http/url_rewriters/LFS/Makefile
2657 src/log/file/Makefile
2664 src/security/Makefile
2665 src/security/cert_generators/Makefile
2666 src/security/cert_generators/file/Makefile
2667 src/security/cert_validators/Makefile
2668 src/security/cert_validators/fake/Makefile
2669 src/servers/Makefile
2673 src/store/id_rewriters/Makefile
2674 src/store/id_rewriters/file/Makefile
2678 tools/apparmor/Makefile
2679 tools/helper-mux/Makefile
2680 tools/systemd/Makefile
2681 tools/sysvinit/Makefile
2684 # must configure libltdl subdir unconditionally for "make distcheck" to work
2685 #AC_CONFIG_SUBDIRS(libltdl)