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/nettle.m4])
26 m4_include([acinclude/pam.m4])
27 m4_include([acinclude/pkg.m4])
28 m4_include([acinclude/tdb.m4])
29 m4_include([acinclude/lib-checks.m4])
30 m4_include([acinclude/ax_cxx_compile_stdcxx.m4])
31 m4_include([acinclude/win32-sspi.m4])
33 PRESET_CFLAGS="$CFLAGS"
34 PRESET_CXXFLAGS="$CXXFLAGS"
35 PRESET_LDFLAGS="$LDFLAGS"
37 dnl Set default LDFLAGS
38 AS_IF([test "x$LDFLAGS" = "x"],[LDFLAGS="-g"])
40 # check for host OS detail
42 AC_MSG_CHECKING([simplified host os])
43 simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
44 squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
45 AS_IF([test -n "$squid_host_os_version"],[
46 squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
48 squid_host_os="$simple_host_os"
50 AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
51 # on windows squid_host_os is either mingw or cygwin, version is 32
57 # AC_USE_SYSTEM_EXTENSIONS should be called before any macros that run the C compiler.
58 AC_USE_SYSTEM_EXTENSIONS
62 # Clang 3.2 on some CPUs requires -march-native to detect correctly.
63 # GCC 4.3+ can also produce faster executables when its used.
64 # But building inside a virtual machine environment has been found to
65 # cause random Illegal Instruction errors due to mis-detection of CPU.
66 AC_ARG_ENABLE(arch-native,
67 AS_HELP_STRING([--disable-arch-native],[Some compilers offer CPU-specific
68 optimizations with the -march=native parameter.
69 This flag disables the optimization. The default is to
70 auto-detect compiler support and use where available.]), [
71 SQUID_YESNO([$enableval],[--enable-arch-native])
73 AC_MSG_NOTICE([CPU arch native optimization enabled: ${enable_arch_native:=auto}])
74 AS_IF([test "x${enable_arch_native}" != "xno"],[
75 SQUID_CC_CHECK_ARGUMENT([squid_cv_check_marchnative],[-march=native])
78 # If the user did not specify a C++ version.
79 user_cxx=`echo "$PRESET_CXXFLAGS" | grep -o -E "(-)std="`
80 AS_IF([test "x$user_cxx" = "x"],[
81 # Check for C++17 compiler support
83 AX_CXX_COMPILE_STDCXX([17],[noext],[mandatory])
86 # Prerequisite: CXX has been finalized.
87 # BUILDCXXFLAGS are defined later, after CXXFLAGS have been finalized.
88 AC_ARG_VAR([BUILDCXX],[path to compiler for building compile-time tools. e.g. cf_gen])
89 AS_IF([test "x$HOSTCXX" != "x" -a "x$BUILDCXX" = "x"],[
90 AC_MSG_WARN([Cross-compiling with HOSTCXX is deprecated. Use BUILDCXX instead.])
93 AS_IF([test "x$BUILDCXX" = "x"],[
95 AS_IF([test "x$squid_cv_check_marchnative" = "xyes"],[
96 CXXFLAGS="$CXXFLAGS -march=native"
108 AC_PATH_PROG(SH, sh, /bin/sh)
109 AC_PATH_PROG(FALSE, false, /usr/bin/false)
110 AC_PATH_PROG(TRUE, true, /usr/bin/true)
111 AC_PATH_PROG(MV, mv, $FALSE)
112 AC_PATH_PROG(MKDIR, mkdir, $FALSE)
113 AC_PATH_PROG(LN, ln, cp)
114 AC_PATH_PROG(CHMOD, chmod, $FALSE)
115 AC_PATH_PROG(TR, tr, $FALSE)
116 AC_PATH_PROG(RM, rm, $FALSE)
117 dnl Libtool 2.2.6 requires: rm -f
122 AC_PATH_PROG(PERL, perl, none)
123 AS_IF([test "x$ac_cv_path_PERL" = "xnone"],[
124 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
126 AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
127 AM_CONDITIONAL(ENABLE_POD2MAN_DOC, test "x${ac_cv_path_POD2MAN}" != "x$FALSE")
129 AC_PATH_PROG(AR, ar, $FALSE)
133 AC_PATH_PROG(LINUXDOC, linuxdoc, $FALSE)
134 AM_CONDITIONAL(ENABLE_RELEASE_DOCS, test "x${ac_cv_path_LINUXDOC}" != "x$FALSE")
136 SQUID_RELEASE=`echo $VERSION | cut -d. -f1`
137 AC_SUBST(SQUID_RELEASE)
139 # pre-define DEFAULT_PREFIX, some modules need it.
140 AS_IF([test "${prefix}" = "NONE"],[squid_prefix=$ac_default_prefix],[squid_prefix=$prefix])
141 AC_DEFINE_UNQUOTED(DEFAULT_PREFIX,[$squid_prefix],[The install prefix])
143 AC_ARG_ENABLE(strict-error-checking,
144 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
145 with all possible static compiler error-checks enabled.
146 This flag disables the behavior]), [
147 SQUID_YESNO([$enableval],[--enable-strict-error-checking])
149 AC_MSG_NOTICE([strict error checking enabled: ${enable_strict_error_checking:=yes}])
151 # LT_INIT requires libtool v2, might as well state it loud
154 AS_IF([test "x$ac_top_build_prefix" != "x"],[
155 # LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
156 # But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
157 # This fixes Linux LTDLv3-v7, and BSD LTDL v2.2
158 top_build_prefix=${ac_top_build_prefix}
159 AC_SUBST(top_build_prefix)
163 dnl LibTool environment is now prepared for setup. Check that it is usable and initialize.
166 # Do we need these unconditionally for "make distcheck" to work?
170 AC_MSG_CHECKING(whether to use loadable modules)
171 AS_IF([test "x${enable_shared:=yes}" = "xyes"],[AC_DEFINE(USE_LOADABLE_MODULES,1,[Support Loadable Modules])])
172 AM_CONDITIONAL(ENABLE_LOADABLE_MODULES, test "x${enable_shared:=yes}" = "xyes")
173 AC_MSG_RESULT([$enable_shared])
175 SQUID_CC_GUESS_VARIANT
176 SQUID_CC_GUESS_OPTIONS
178 dnl find out the exe extension for this platform.
179 dnl If it is not empty, use it for CGI as well.
182 AS_IF([test "x$EXEEXT" = "x"],[CGIEXT=".cgi"],[CGIEXT=""])
185 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,[test "x$squid_host_os" = "xmingw"])
186 AM_CONDITIONAL(ENABLE_WIN32_IPC,[test "x$squid_host_os" = "xmingw"])
188 AS_CASE(["$squid_host_os"],
190 CFLAGS="$CFLAGS -mthreads"
191 CXXFLAGS="$CXXFLAGS -mthreads -static-libgcc -static-libstdc++"
192 dnl Check for Winsock only on MinGW
193 SQUID_CHECK_WINSOCK_LIB
194 AC_CHECK_HEADERS([ws2tcpip.h winsock2.h windows.h io.h],,,[
196 #include <ws2tcpip.h>
199 #include <winsock2.h>
205 MINGW_LIBS="-lmingwex"
207 AC_CHECK_FUNCS([fsync])
211 # FreeBSD places local libraries and packages in /usr/local
212 CFLAGS="$CFLAGS -I/usr/local/include"
213 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
214 LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-R/usr/local/lib"
219 AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
221 AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args",
222 [configure command line used to configure Squid])
224 CACHE_EFFECTIVE_USER="nobody"
225 AC_ARG_WITH(default-user,
226 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
227 [ CACHE_EFFECTIVE_USER="$withval" ]
229 AC_SUBST(CACHE_EFFECTIVE_USER)
231 DEFAULT_LOG_DIR="$localstatedir/logs"
233 AS_HELP_STRING([--with-logdir=PATH],
234 [Default location for squid logs. default: PREFIX/var/logs]),[
236 [yes|no],[AC_MSG_ERROR([--with-logdir requires a directory PATH. --with-logdir=PATH])],
237 [DEFAULT_LOG_DIR="$withval"]
240 AC_SUBST(DEFAULT_LOG_DIR)
242 DEFAULT_PID_FILE="$localstatedir/run/@SERVICE_NAME@.pid"
244 AS_HELP_STRING([--with-pidfile=PATH],
245 [Default location for squid pid file. Default: PREFIX/var/run/squid.pid]),[
247 [yes|no],[AC_MSG_ERROR([--with-pidfile requires a file PATH. --with-pidfile=PATH])],
248 [DEFAULT_PID_FILE="$withval"]
251 AC_SUBST(DEFAULT_PID_FILE)
253 DEFAULT_SWAP_DIR="$localstatedir/cache/squid"
255 AS_HELP_STRING([--with-swapdir=PATH],
256 [Default location for squid cache directories. Default: PREFIX/var/cache/squid]),[
258 [yes|no],[AC_MSG_ERROR([--with-swapdir requires a directory PATH. --with-swapdir=PATH])],
259 [DEFAULT_SWAP_DIR="$withval"]
262 AC_SUBST(DEFAULT_SWAP_DIR)
264 dnl Set Default CFLAGS
265 AS_IF([test "x$PRESET_CFLAGS" = "x"],[
266 AS_IF([test "$squid_cv_compiler" = "gcc"],[
267 # TODO check if these exceptions are still necessary
270 # sunos has too many warnings for -Wall to be useful
272 [CFLAGS="$squid_cv_cc_option_wall $CFLAGS"]
276 [*mips-sgi-irix6.*],[
277 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
278 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
279 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
280 -Wl,-woff,85,-woff,84,-woff,134 \
281 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
282 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
283 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
284 -Wl,-woff,85,-woff,84,-woff,134 \
285 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
290 AC_MSG_CHECKING([compiler name-version])
291 squid_cv_cc_name=`$CC --version | head -1 | cut -f1 -d" "`
292 AS_CASE([$squid_cv_cc_name],
293 [gcc|clang],[squid_cv_cc_majversion=`$CC -dumpversion | cut -f1 -d.`],
294 [squid_cv_cc_majversion="unknown"]
296 squid_cv_cc_simplified="$squid_cv_cc_name-$squid_cv_cc_majversion"
297 AC_MSG_RESULT($squid_cv_cc_simplified)
302 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([$squid_cv_cc_option_wall])
305 AS_IF([test "$squid_cv_cc_simplified" = "gcc-4"],[
306 AC_MSG_NOTICE([skipping -Wextra on $squid_cv_cc_simplified])
308 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wextra])
310 # Now disable or configure certain warnings enabled by -Wextra
312 # -Wunused-private-field causes a huge number of false positives
313 # in unit tests. Disable that
314 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wno-unused-private-field])
316 # ...=5: Do not trust comments about fallthrough cases (GCC).
317 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wimplicit-fallthrough=5])
318 AS_IF([test "x$squid_cv_cc_arg_wimplicit_fallthrough_5" != "xyes"], [
319 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wno-implicit-fallthrough])
323 # useful warnings that may not be included in -Wall -Wextra
324 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wpointer-arith])
325 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wwrite-strings])
326 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wcomments])
327 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wshadow])
328 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wmissing-declarations])
329 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Woverloaded-virtual])
331 dnl CentOS (and RHEL) still define ntohs() using deprecated C++ features
332 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_wno_deprecated_register],[-Werror -Wno-deprecated-register],[[#include <arpa/inet.h>]],[[int fox=ntohs(1);]])
334 AS_IF([test "x$enable_strict_error_checking" != "xno"],[
335 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
336 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
339 AS_IF([test "x$ac_cv_require_wno_deprecated_register" = "xyes"],[
340 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -Wno-deprecated-register"
343 # squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
344 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
345 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
347 # possibly include some build info tag into squid -v
348 SQUID_EMBED_BUILD_INFO
350 AC_ARG_ENABLE(optimizations,
351 AS_HELP_STRING([--disable-optimizations],
352 [Do not compile Squid with compiler optimizations enabled.
353 Optimization is good for production builds, but not
354 good for debugging. During development, use
355 --disable-optimizations to reduce compilation times
356 and allow easier debugging.]), [
357 AS_IF([test "x$enableval" = "xno"],[
358 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
359 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
360 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9g]]*//'`"
364 dnl Nasty hack to get autoconf 2.64 on Linux to run.
365 dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
366 AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[:])
368 AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
369 AC_ARG_ENABLE(xmalloc-statistics,
370 AS_HELP_STRING([--enable-xmalloc-statistics],
371 [Show malloc statistics in status page]), [
372 SQUID_YESNO([$enableval],[--enable-xmalloc-statistics])
374 SQUID_DEFINE_BOOL(XMALLOC_STATISTICS,${enable_xmalloc_statistics:=no},
375 [Show malloc statistics in status page])
376 AC_MSG_NOTICE([xmalloc stats display: $enable_xmalloc_statistics])
378 squid_opt_aufs_threads=""
379 AC_ARG_WITH(aufs-threads,
380 AS_HELP_STRING([--with-aufs-threads=N_THREADS],
381 [Tune the number of worker threads for the aufs object store.]), [
383 [@<:@0-9@:>@*],[squid_opt_aufs_threads=$withval],
384 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
387 AS_IF([test "x$squid_opt_aufs_threads" != "x"],[
388 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
389 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
390 [Defines how many threads aufs uses for I/O])
393 ## TODO check if this is necessary, LT_INIT does these checks
394 SQUID_AUTO_LIB(dl,[dynamic linking],[LIBDL])
395 SQUID_CHECK_LIB_WORKS(dl,[
396 LDFLAGS="$LIBDL_PATH $LDFLAGS"
397 AC_CHECK_LIB(dl, dlopen,[LIBDL_LIBS="-ldl"])
398 LIBS="$LIBDL_LIBS $LIBS"
401 AC_DEFUN([LIBATOMIC_CHECKER],[
402 AC_MSG_CHECKING(whether linking $1 -latomic works)
408 main(int argc, char **) {
410 std::atomic<uint8_t>(uint8_t(argc)).exchange(0) &&
411 std::atomic<uint64_t>{}.is_lock_free()
416 libatomic_checker_result="yes"],[
418 libatomic_checker_result="no"
421 ## check for atomics library before anything that might need it
422 SQUID_STATE_SAVE(LIBATOMIC)
423 LIBATOMIC_CHECKER(without)
424 AS_IF([test "x$libatomic_checker_result" = "xno"],[
425 LIBS="$LIBS -latomic"
426 LIBATOMIC_CHECKER(with)
427 AS_IF([test "x$libatomic_checker_result" = "xyes"],[
428 ATOMICLIB="-latomic"],[
429 AC_MSG_ERROR([Required library libatomic not found.])
431 SQUID_STATE_ROLLBACK(LIBATOMIC)
434 SQUID_AUTO_LIB(psapi,[Windows PSAPI.dll],[LIBPSAPI])
435 AS_IF([test "x$with_psapi" != "xno"],[
436 SQUID_STATE_SAVE(squid_psapi_state)
437 CPPFLAGS="$LIBPSAPI_CFLAGS $CPPFLAGS"
438 LIBS="$LIBPSAPI_PATH $LIBS"
439 AC_CHECK_LIB([psapi],[K32GetProcessMemoryInfo],[LIBPSAPI_LIBS="-lpsapi"])
440 AC_CHECK_HEADER([psapi.h],,,[
445 SQUID_STATE_ROLLBACK(squid_psapi_state)
446 AS_IF([test "x$LIBPSAPI_LIBS" != "x"],[
447 CXXFLAGS="$LIBPSAPI_CFLAGS $CXXFLAGS"
448 LIBPSAPI_LIBS="$LIBPSAPI_PATH $LIBPSAPI_LIBS"
449 ],[test "x$with_psapi" = "xyes"],[
450 AC_MSG_ERROR([Required library PSAPI.dll not found])
452 AC_MSG_NOTICE([Library PSAPI.dll not found.])
455 AC_MSG_NOTICE([Using Windows PSAPI.dll library: ${with_psapi:=auto}])
456 AC_SUBST(LIBPSAPI_LIBS)
458 AC_SEARCH_LIBS([shm_open], [rt])
459 AS_IF([test "x$ac_cv_search_shm_open" != "xno"],[
460 AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
463 squid_disk_module_candidates=
464 AC_ARG_ENABLE(disk-io,
465 AS_HELP_STRING([--enable-disk-io="list of modules"],
466 [Build support for the list of disk I/O modules.
467 Set without a value or omitted, all available modules will be built.
468 See src/DiskIO for a list of available modules, or
469 Programmers Guide section on DiskIO
470 for details on how to build your custom disk module]),
471 AS_CASE(["$enableval"],
473 [no|none],[enable_disk_io="no"],
476 squid_disk_module_candidates="$enableval"
479 AS_IF([test "x${enable_disk_io:=yes}" = "xyes"],[
480 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
481 AS_IF([test "x$ac_cv_search_shm_open" = "xno"],[
482 squid_disk_module_candidates=`echo "$squid_disk_module_candidates" | sed 's/IpcIo//g'`
485 SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
486 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
487 AC_MSG_NOTICE([DiskIO modules built: ${squid_disk_module_candidates:-none}])
488 SQUID_DEFINE_BOOL(USE_DISKIO,$enable_disk_io,[DiskIO modules are expected to be available.])
490 dnl Some autoconf.h defines we might enable later...
491 AC_ARG_WITH(pthreads,AS_HELP_STRING([--without-pthreads],[Disable POSIX Threads]))
492 AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO. Default: auto-detect]))
495 squid_opt_use_diskthreads=
498 dnl Setup the module paths etc.
501 AH_TEMPLATE(HAVE_DISKIO_MODULE_AIO, [Whether POSIX AIO Disk I/O module is built])
502 AH_TEMPLATE(HAVE_DISKIO_MODULE_BLOCKING, [Whether Blocking Disk I/O module is built])
503 AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKDAEMON, [Whether DiskDaemon Disk I/O module is built])
504 AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKTHREADS, [Whether DiskThreads Disk I/O module is built])
505 AH_TEMPLATE(HAVE_DISKIO_MODULE_IPCIO, [Whether IpcIo Disk I/O module is built])
506 AH_TEMPLATE(HAVE_DISKIO_MODULE_MMAPPED, [Whether Mmapped Disk I/O module is built])
507 for module in $squid_disk_module_candidates none; do
509 AS_IF([test "x$module" = "xnone"],[continue])
510 AS_IF([! test -d "$srcdir/src/DiskIO/$module"],[AC_MSG_ERROR([disk-io $module does not exist])])
513 dnl Check for POSIX AIO availability
514 squid_opt_use_aio="yes"
516 AS_IF([test "x$with_aio" != "xno"],[
518 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
519 dnl On some systems POSIX AIO functions are in librt
520 dnl On some systems POSIX AIO functions are in libaio
521 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
522 dnl Enable AIO if the library and headers are found
523 AS_IF([test "x$AIOLIB" != "x" -a "x$have_aio_header" = "xyes"],[
524 AC_MSG_NOTICE([Native POSIX AIO support detected.])
525 squid_opt_use_aio="yes"
527 dnl Windows does things differently. We provide wrappers.
528 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
529 AS_IF([test "$squid_host_os" = "mingw"],[
530 squid_opt_use_aio="yes"
531 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
533 squid_opt_use_aio="no"
534 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
538 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
539 squid_opt_use_aio="no"
541 dnl Use the POSIX AIO pieces if we actually need them.
542 AS_IF([test "x$squid_opt_use_aio" = "xyes"],[
543 DISK_MODULES="$DISK_MODULES AIO"
544 AC_DEFINE([HAVE_DISKIO_MODULE_AIO],1,[POSIX AIO Disk I/O module is built])
545 AS_IF([test "$squid_host_os" = "mingw"],[
547 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
549 AC_MSG_NOTICE([Enabling AIO DiskIO module])
552 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
553 squid_disk_module_candidates_AIO=no
558 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
559 DISK_MODULES="$DISK_MODULES Blocking"
560 AC_DEFINE([HAVE_DISKIO_MODULE_BLOCKING],1,[Blocking Disk I/O module is built])
564 AS_IF([test "$squid_host_os" = "mingw"],[
565 AC_MSG_NOTICE([DiskDaemon not supported on MinGW])
566 squid_disk_module_candidates_DiskDaemon=no
568 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
569 DISK_MODULES="$DISK_MODULES DiskDaemon"
570 AC_DEFINE([HAVE_DISKIO_MODULE_DISKDAEMON],1,[DiskDaemon Disk I/O module is built])
575 squid_opt_use_diskthreads="yes"
577 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
578 AS_IF([test "x$with_pthreads" != "xno"],[
579 dnl TODO: this needs to be extended to handle more systems and better
580 dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
581 dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
582 AS_CASE(["$squid_host_os"],
585 AC_MSG_NOTICE([Windows threads support automatically enabled])
589 AS_IF([test `echo "$squid_host_os_version" | tr -d .` -lt 70],[
590 AC_MSG_NOTICE(pthread library requires FreeBSD 7 or later)
591 squid_opt_use_diskthreads="no"
593 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
594 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
595 AS_IF([test "x$GCC" = "xyes" -a "x$PRESET_LDFLAGS" = "x"],[LDFLAGS="$LDFLAGS -pthread"])
600 AS_IF([test `echo "$squid_host_os_version" | tr -d .` -lt 52],[
601 AC_MSG_NOTICE(pthread library requires OpenBSD 5.2 or later)
602 squid_opt_use_diskthreads="no"
604 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
605 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
606 LDFLAGS="$LDFLAGS -lpthread"
611 AS_IF([test "x$GCC" = "xyes"],[
612 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
613 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
614 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
615 AC_MSG_NOTICE(pthread library required but cannot be found.)
616 squid_opt_use_diskthreads="no"
619 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
620 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
621 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
622 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
623 LIBPTHREADS="" #in LIBS
625 AC_MSG_NOTICE(pthread library required but cannot be found.)
626 squid_opt_use_diskthreads="no"
632 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
633 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
634 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
635 AC_MSG_NOTICE(pthread library required but cannot be found.)
636 squid_opt_use_diskthreads="no"
641 AC_MSG_NOTICE([Native pthreads support manually disabled.])
642 squid_opt_use_diskthreads="no"
644 AS_IF([test "x$squid_opt_use_diskthreads" = "xyes"],[
645 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
646 DISK_MODULES="$DISK_MODULES DiskThreads"
647 AC_DEFINE([HAVE_DISKIO_MODULE_DISKTHREADS],1,[DiskThreads Disk I/O module is built])
649 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
650 SQUID_STATE_ROLLBACK([diskthreads_state])
651 squid_disk_module_candidates_DiskThreads=no
656 AS_IF([test "x$ac_cv_search_shm_open" = "xno"],[
657 AC_MSG_NOTICE([DiskIO IpcIo module requires shared memory support])
658 squid_disk_module_candidates_IpcIo=no
660 AC_MSG_NOTICE([Enabling IpcIo DiskIO module])
661 DISK_MODULES="$DISK_MODULES IpcIo"
662 AC_DEFINE([HAVE_DISKIO_MODULE_IPCIO],1,[IpcIo Disk I/O module is built])
667 dnl TODO: use availability of sys/mman.h and/or mmap to define
668 dnl OR support windows mmap functions
669 AS_IF([test "x$squid_host_os" = "xmingw"],[
670 AC_MSG_NOTICE([Mmapped DiskIO is not available on Mingw])
671 squid_disk_module_candidates_Mmapped=no
673 AC_MSG_NOTICE([Enabling Mmapped DiskIO module])
674 DISK_MODULES="$DISK_MODULES Mmapped"
675 AC_DEFINE([HAVE_DISKIO_MODULE_MMAPPED],1,[Mmapped Disk I/O module is built])
680 AC_MSG_NOTICE([Enabling $module DiskIO module])
681 DISK_LIBS="$DISK_LIBS lib${module}.la"
682 DISK_MODULES="$DISK_MODULES ${module}"
685 AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
686 AC_SUBST(DISK_MODULES)
688 AM_CONDITIONAL(ENABLE_DISKIO_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes")
690 AM_CONDITIONAL(ENABLE_WIN32_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes" -a "x$ENABLE_WIN32_AIO" = "x1")
691 AM_CONDITIONAL(ENABLE_DISKIO_BLOCKING, test "x$squid_disk_module_candidates_Blocking" = "xyes")
692 AM_CONDITIONAL(ENABLE_DISKIO_DISKDAEMON, test "x$squid_disk_module_candidates_DiskDaemon" = "xyes")
693 AM_CONDITIONAL(ENABLE_DISKIO_DISKTHREADS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes")
694 AC_SUBST(LIBPTHREADS)
695 AM_CONDITIONAL(ENABLE_WIN32_AIOPS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes" -a "x$ENABLE_WIN32_AIOPS" = "x1")
696 AM_CONDITIONAL(ENABLE_DISKIO_IPCIO, test "x$squid_disk_module_candidates_IpcIo" = "xyes")
697 AM_CONDITIONAL(ENABLE_DISKIO_MMAPPED, test "x$squid_disk_module_candidates_Mmapped" = "xyes")
699 dnl Check what Storage formats are wanted.
700 dnl This version will error out with a message saying why if a required DiskIO is missing.
701 AC_ARG_ENABLE([storeio],
702 AS_HELP_STRING([--enable-storeio="list of modules"],
703 [Build support for the list of store I/O modules.
704 The default is only to build the "ufs" module.
705 See src/fs for a list of available modules, or
706 Programmers Guide section <not yet written>
707 for details on how to build your custom store module]), [
708 AS_CASE(["$enableval"],
710 [no|none],[enable_storeio="no"],
713 # ufs is really always needed as it has low-level routines
714 # if it is a dupe it will be cleaned-up later
715 squid_storeio_module_candidates="$enableval ufs"
718 AS_IF([test "x${enable_storeio:=yes}" = "xyes"],[
719 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
721 SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
722 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
723 AC_MSG_NOTICE([Store modules built: ${squid_storeio_module_candidates:-none}])
725 for fs in ${squid_storeio_module_candidates:-none}; do
728 AS_IF([test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
729 "x$squid_disk_module_candidates_DiskDaemon" != "xyes"],[
730 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
734 AS_IF([test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
735 "x$squid_disk_module_candidates_DiskThreads" != "xyes"],[
736 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
740 AS_IF([test "x$squid_disk_module_candidates_IpcIo" != "xyes" -a \
741 "x$squid_disk_module_candidates_Blocking" != "xyes"],[
742 AC_MSG_ERROR([Storage module Rock requires DiskIO module: Blocking or IpcIo])
744 squid_do_build_rock=true
747 AS_IF([test "x$squid_disk_module_candidates_Blocking" != "xyes"],[
748 AC_MSG_ERROR([Storage module ufs requires DiskIO module: Blocking])
750 squid_do_build_ufs=true
755 AM_CONDITIONAL(ENABLE_FS_UFS, test "x$squid_do_build_ufs" = "xtrue")
756 AM_CONDITIONAL(ENABLE_FS_ROCK, test "x$squid_do_build_rock" = "xtrue")
757 dnl hack: need to define those even if not used in the build system to
758 dnl make sure that global FS objects are linked to the squid binary.
759 AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
760 AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
761 AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
762 AH_TEMPLATE(HAVE_FS_ROCK, "Define to 1 if rock filesystem module is build")
765 dnl got final squid_storeio_module_candidates, build library lists
766 dnl This list will not be needed when each fs library has its own Makefile
768 dnl File system libraries to link executables with.
769 dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
771 for fs in $squid_storeio_module_candidates; do
772 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
773 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
774 SQUID_TOUPPER_VAR_CONTENTS([fs])
775 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
778 AC_SUBST(STORE_LIBS_TO_BUILD)
779 AC_SUBST(STORE_LIBS_TO_ADD)
780 AC_SUBST(STORE_TESTS)
783 dnl At lest one removal policy is always needed.
784 dnl 'lru' removal policy is currently hard-coded by name for tests
785 dnl so we must set it as default.
787 AC_ARG_ENABLE(removal-policies,
788 AS_HELP_STRING([--enable-removal-policies="list of policies"],
789 [Build support for the list of removal policies.
790 The default is only to build the "lru" module.
791 See src/repl for a list of available modules, or
792 Programmers Guide section 9.9 for details on how
793 to build your custom policy]), [
794 AS_CASE(["$enableval"],
795 [yes],[ SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES]) ],
797 [ REPL_POLICIES="$enableval" ]
800 SQUID_CLEANUP_MODULES_LIST([REPL_POLICIES])
801 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
802 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
803 REPL_OBJS="repl/lib`echo \"$REPL_POLICIES\" | sed -e 's% %.a repl/lib%g'`.a"
804 REPL_LIBS=`echo "$REPL_OBJS" | sed -e 's%repl/%%g'`
805 AC_SUBST(REPL_POLICIES)
809 AM_CONDITIONAL(ENABLE_PINGER, false)
811 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),[
812 AS_IF([test "x$enableval" = "xyes"],[
813 AC_MSG_NOTICE([ICMP enabled])
814 AC_DEFINE(USE_ICMP,1,[Define to use Squid ICMP and Network Measurement features (highly recommended!)])
815 AM_CONDITIONAL(ENABLE_PINGER, true)
819 AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
820 AC_ARG_ENABLE(delay-pools,
821 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),[
822 AS_IF([test "x$enableval" = "xyes"],[
823 AC_MSG_NOTICE([Delay pools enabled])
824 AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
825 AM_CONDITIONAL(ENABLE_DELAY_POOLS, true)
829 dnl disable generic/common adaptation support by default
830 squid_opt_use_adaptation=no
832 squid_opt_use_esi=auto
833 AH_TEMPLATE([USE_SQUID_ESI],[Define to enable the ESI processor])
835 AS_HELP_STRING([--disable-esi],
836 [Disable ESI for accelerators. ESI requires expat or xml2 library.
837 Enabling ESI will cause squid reverse proxies to be capable
838 of the Edge Acceleration Specification (www.esi.org).]),
839 [squid_opt_use_esi=$enableval],[])
841 # ESI support libraries: expat
842 AH_TEMPLATE(HAVE_LIBEXPAT,[Define to 1 if you have the expat library])
843 SQUID_AUTO_LIB(expat,[ESI expat library],[LIBEXPAT])
844 AS_IF([test "x$squid_opt_use_esi" != "xno" -a "x$with_expat" != "xno"],[
845 SQUID_STATE_SAVE(squid_expat_state)
846 PKG_CHECK_MODULES([LIBEXPAT],[expat],[],[
847 AC_CHECK_LIB([expat],[main],[LIBEXPAT_LIBS="-lexpat"])
849 CPPFLAGS="$LIBEXPAT_CFLAGS $CPPFLAGS"
850 AC_CHECK_HEADERS(expat.h)
851 SQUID_STATE_ROLLBACK(squid_expat_state)
852 AS_IF([test "x$LIBEXPAT_LIBS" != "x"],[
853 squid_opt_use_esi=yes
854 LIBEXPAT_LIBS="$LIBEXPAT_PATH $LIBEXPAT_LIBS"
855 AC_DEFINE(HAVE_LIBEXPAT,1,[Define to 1 if you have the expat library])
857 [test "x$with_expat" = "xyes"],[AC_MSG_ERROR([Required library expat not found.])],
858 [AC_MSG_NOTICE([Library expat not found.])]
861 AM_CONDITIONAL(ENABLE_LIBEXPAT,[test "x$LIBEXPAT_LIBS" != "x"])
862 AC_SUBST(LIBEXPAT_LIBS)
864 # ESI support libraries: xml2
865 AH_TEMPLATE(HAVE_LIBXML2,[Define to 1 if you have the xml2 library])
866 SQUID_AUTO_LIB(xml2,[ESI xml2 library],[LIBXML2])
867 AS_IF([test "x$squid_opt_use_esi" != "xno" -a "x$with_xml2" != "xno"],[
868 SQUID_STATE_SAVE([squid_libxml2_save])
869 PKG_CHECK_MODULES([LIBXML2],[libxml-2.0],[],[
870 AC_CHECK_LIB([xml2],[main],[LIBXML2_LIBS="$LIBXML2_PATH -lxml2"])
872 CPPFLAGS="$LIBXML2_CFLAGS $CPPFLAGS"
873 AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
874 SQUID_STATE_ROLLBACK([squid_libxml2_save])
876 AS_IF([test "x$LIBXML2_LIBS" != "x"],[
877 squid_opt_use_esi=yes
878 CPPFLAGS="$LIBXML2_CFLAGS $CPPFLAGS"
879 LIBXML2_LIBS="$LIBXML2_PATH $LIBXML2_LIBS"
880 AC_DEFINE(HAVE_LIBXML2,1,[Define to 1 if you have the xml2 library])
881 ],[test "x$with_xml2" = "xyes"],[
882 AC_MSG_ERROR([Required library xml2 not found])
884 AC_MSG_NOTICE([Library xml2 not found.])
887 AM_CONDITIONAL(ENABLE_LIBXML2,[test "x$LIBXML2_LIBS" != "x"])
888 AC_SUBST(LIBXML2_LIBS)
890 AS_IF([test "x$squid_opt_use_esi" = "xyes"],[
891 AS_IF([test "x$LIBXML2_LIBS" = "x" -a "x$LIBEXPAT_LIBS" = "x"],[
892 AC_MSG_ERROR([ESI processor requires libxml2 or libexpat])
894 AC_MSG_NOTICE([Enabling ESI processor: $LIBEXPAT_LIBS $LIBXML2_LIBS])
895 AC_DEFINE(USE_SQUID_ESI,1,[Compile the ESI processor])
897 AS_IF(test "x$squid_opt_use_esi" = "xno",[
898 AC_MSG_NOTICE([Disabling ESI processor.])
900 AC_MSG_NOTICE([Disabling ESI processor. libxml2 and libexpat not found.])
903 AM_CONDITIONAL(ENABLE_ESI, test "x$squid_opt_use_esi" = "xyes")
905 AC_ARG_ENABLE(icap-client,
906 AS_HELP_STRING([--disable-icap-client],[Disable the ICAP client.]),[
907 SQUID_YESNO([$enableval],[--enable-icap-client])
909 SQUID_DEFINE_BOOL(ICAP_CLIENT,${enable_icap_client:=yes}, [Enable ICAP client features in Squid])
910 AS_IF(test "x$enable_icap_client" != "xno", squid_opt_use_adaptation="yes")
911 AM_CONDITIONAL(ENABLE_ICAP_CLIENT, test "x$enable_icap_client" != "xno")
914 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]),[
915 SQUID_YESNO([$enableval],[--enable-ecap])],[
918 dnl Perform configuration consistency checks for eCAP
919 AS_IF([test "x$enable_ecap" != "xno"],[
920 AS_IF([test "x$enable_shared" != "xyes"],[
921 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-shared with --enable-ecap.])
924 AS_IF([test -n "$PKG_CONFIG"],[
925 dnl eCAP support requires libecap.
926 dnl This Squid supports libecap v1.0.x.
927 dnl Use EXT_ prefix to distinguish external libecap (that we check for
928 dnl here) from our own convenience ecap library in Makefiles.
929 PKG_CHECK_MODULES([EXT_LIBECAP],[libecap >= 1.0 libecap < 1.1])
931 AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
934 SQUID_STATE_SAVE(squid_ecap_state)
935 AC_MSG_CHECKING([whether -lecap will link])
936 CXXFLAGS="$CXXFLAGS $EXT_LIBECAP_CFLAGS"
937 LIBS="$LIBS $EXT_LIBECAP_LIBS"
938 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libecap/common/names.h>]],[[
939 const libecap::Name test("test", libecap::Name::NextId());
942 squid_opt_use_adaptation=yes
945 AS_IF([test "x$enable_ecap" = "xyes"],[
946 AC_MSG_ERROR([eCAP library will not link.
947 You may need to rebuild libecap using the same version of GCC as Squid.
948 There have been breaking ABI changes in the libstdc++ STL with GCC 5.])
950 AC_MSG_NOTICE([eCAP library will not link.
951 You may need to rebuild libecap using the same version of GCC as Squid.
952 There have been breaking ABI changes in the libstdc++ STL with GCC 5.])
956 SQUID_STATE_ROLLBACK(squid_ecap_state)
958 SQUID_DEFINE_BOOL(USE_ECAP,${enable_ecap:=no},[Whether to use eCAP support])
959 AM_CONDITIONAL(ENABLE_ECAP, test "x$enable_ecap" = "xyes")
961 dnl enable adaptation if requested by specific adaptation mechanisms
963 AS_IF([test "x$squid_opt_use_adaptation" = "xyes"],[ADAPTATION_LIBS="adaptation/libadaptation.la"])
964 SQUID_DEFINE_BOOL(USE_ADAPTATION,${squid_opt_use_adaptation:=no}, [common adaptation support])
965 AM_CONDITIONAL(ENABLE_ADAPTATION, test "x$squid_opt_use_adaptation" = "xyes")
966 AC_SUBST(ADAPTATION_LIBS)
968 AS_IF([test "x$squid_host_os" = "xmingw"],[enable_wccp=no])
970 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]),[
971 SQUID_YESNO([$enableval],[--enable-wccp])
973 SQUID_DEFINE_BOOL(USE_WCCP, ${enable_wccp:=yes}, [Define to enable WCCP])
974 AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $enable_wccp])
976 AS_IF([test "x$squid_host_os" = "xmingw"],[enable_wccpv2=no])
977 AC_ARG_ENABLE(wccpv2,
978 AS_HELP_STRING([--disable-wccpv2],
979 [Disable Web Cache Coordination V2 Protocol]), [
980 SQUID_YESNO([$enableval],[--enable-wccpv2])
982 SQUID_DEFINE_BOOL(USE_WCCPv2,${enable_wccpv2:=yes},
983 [Define to enable WCCP V2])
984 AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $enable_wccpv2])
987 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
988 SQUID_YESNO([$enableval],[--enable-snmp])
990 SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes},
991 [Define to enable SNMP monitoring of Squid])
992 AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
993 AS_IF([test "x$enable_snmp" = "xyes"],[SNMPLIB="../lib/snmplib/libsnmplib.la"])
994 AC_MSG_NOTICE([SNMP support enabled: $enable_snmp])
998 AS_HELP_STRING([--disable-eui],
999 [Disable use of ARP / MAC/ EUI (ether address)]), [
1000 SQUID_YESNO([$enableval],[--enable-eui])
1002 AS_IF([test "x${enable_eui:=yes}" = "xyes"],[
1003 SQUID_STATE_SAVE(LIBEUI)
1004 # GLIBC 2.30 deprecates sysctl.h. Test with the same flags that (may) break includes later.
1005 CFLAGS=$SQUID_CFLAGS
1006 CXXFLAGS=$SQUID_CXXFLAGS
1007 AS_CASE(["$squid_host_os"],
1008 [linux|solaris|freebsd|openbsd|netbsd|cygwin],[:],
1009 [mingw],[EUILIB="-liphlpapi"],
1010 [AC_MSG_WARN([EUI support probably will not work on host $host.])]
1012 # iphlpapi.h check delayed after winsock2.h
1027 #include <sys/types.h>
1028 #include <sys/socket.h>
1031 # OpenBSD, FreeBSD and NetBSD requires sys/param.h to be included before sysctl.h and net/if_dl.h
1036 #if HAVE_SYS_PARAM_H
1037 #include <sys/param.h>
1040 SQUID_STATE_ROLLBACK(LIBEUI)
1043 AC_MSG_NOTICE([EUI (MAC address) controls enabled: $enable_eui])
1044 SQUID_DEFINE_BOOL(USE_SQUID_EUI,$enable_eui,
1045 [Define this to include code which lets you use ethernet addresses. This code uses API initially defined in 4.4-BSD.])
1046 AM_CONDITIONAL(ENABLE_EUI, [test "x$enable_eui" = "xyes" ])
1050 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]), [
1051 SQUID_YESNO([$enableval],[--enable-htcp])
1053 SQUID_DEFINE_BOOL(USE_HTCP,${enable_htcp:=yes},
1054 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
1055 AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
1056 AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
1058 # Cryptograhic libraries
1059 SQUID_AUTO_LIB(nettle,[Nettle crypto],[LIBNETTLE])
1060 SQUID_CHECK_LIB_WORKS(nettle,[
1061 SQUID_STATE_SAVE(squid_nettle_state)
1062 PKG_CHECK_MODULES([LIBNETTLE],[nettle >= 3.4],[],[
1063 CPPFLAGS="$LIBNETTLE_CFLAGS $CPPFLAGS"
1064 AC_CHECK_LIB(nettle,[nettle_md5_init],[LIBNETTLE_LIBS="-lnettle"])
1066 AC_CHECK_HEADERS(nettle/base64.h nettle/md5.h)
1067 SQUID_CHECK_NETTLE_BASE64
1068 SQUID_STATE_ROLLBACK(squid_nettle_state)
1071 dnl Check for libcrypt
1073 dnl Some of our helpers use crypt(3) which may be in libc, or in
1074 dnl libcrypt (eg FreeBSD)
1075 AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
1076 dnl Solaris10 provides MD5 natively through libmd5
1077 AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
1082 SQUID_AUTO_LIB(gnutls,[GnuTLS crypto],[LIBGNUTLS])
1083 AH_TEMPLATE(USE_GNUTLS,[GnuTLS support is available])
1084 SQUID_CHECK_LIB_WORKS(gnutls,[
1085 SQUID_STATE_SAVE(squid_gnutls_state)
1087 # User may have provided a custom location for GnuTLS. Otherwise...
1088 CPPFLAGS="$LIBGNUTLS_CFLAGS $CPPFLAGS"
1089 LIBS="$LIBS $LIBGNUTLS_PATH"
1091 # auto-detect using pkg-config
1092 PKG_CHECK_MODULES([LIBGNUTLS],[gnutls >= 3.4.0],[
1093 CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
1095 ## find the package without pkg-config
1096 ## check that the library is actually new enough.
1097 ## by testing for a 3.4.0+ function which we use
1098 AC_CHECK_LIB(gnutls,gnutls_pcert_export_x509,[LIBGNUTLS_LIBS="-lgnutls"])
1100 # if any of the required headers is not found, signal we can't support gnutls
1101 AC_CHECK_HEADERS([gnutls/gnutls.h gnutls/x509.h gnutls/abstract.h], [], [LIBGNUTLS_LIBS=""])
1103 SQUID_STATE_ROLLBACK(squid_gnutls_state) #de-pollute LIBS
1105 AS_IF([test "x$LIBGNUTLS_LIBS" != "x"],[
1106 SSLLIB="$LIBGNUTLS_PATH $LIBGNUTLS_LIBS $SSLLIB"
1107 AC_DEFINE(USE_GNUTLS,1,[GnuTLS support is available])
1111 dnl User may specify OpenSSL is needed from a non-standard location
1112 SQUID_OPTIONAL_LIB(openssl,[OpenSSL],[LIBOPENSSL])
1113 AH_TEMPLATE(USE_OPENSSL,[OpenSSL support is available])
1114 ## OpenSSL is default disable due to licensing issues on some OS
1115 AS_IF([test "x$with_openssl" = "xyes"],[
1116 CPPFLAGS="$LIBOPENSSL_CFLAGS $CPPFLAGS"
1128 openssl/opensslv.h \
1138 # User may have provided a custom location for OpenSSL. Otherwise...
1139 SQUID_STATE_SAVE(squid_openssl_state)
1140 LIBS="$LIBS $LIBOPENSSL_PATH"
1142 # auto-detect using pkg-config
1143 PKG_CHECK_MODULES([LIBOPENSSL],[openssl],,[
1144 ## For some OS pkg-config is broken or unavailable.
1145 ## Detect libraries the hard way.
1147 # Windows MinGW has some special libraries ...
1148 AS_IF([test "x$squid_host_os" = "xmingw"],[
1149 LIBOPENSSL_LIBS='-lssleay32 -leay32 -lgdi32 $LIBOPENSSL_LIBS'
1150 AC_MSG_NOTICE([Windows OpenSSL library support: yes -lssleay32 -leay32 -lgdi32])
1153 AC_CHECK_LIB(crypto,[CRYPTO_new_ex_data],[LIBOPENSSL_LIBS="-lcrypto $LIBOPENSSL_LIBS"],[
1154 AC_MSG_ERROR([library 'crypto' is required for OpenSSL])
1156 AC_CHECK_LIB(ssl,[SSL_CTX_new],[LIBOPENSSL_LIBS="-lssl $LIBOPENSSL_LIBS"],[
1157 AC_MSG_ERROR([library 'ssl' is required for OpenSSL])
1161 SQUID_STATE_ROLLBACK(squid_openssl_state) #de-pollute LIBS
1163 AS_IF([test "x$LIBOPENSSL_LIBS" != "x"],[
1164 CXXFLAGS="$LIBOPENSSL_CFLAGS $CXXFLAGS"
1165 SSLLIB="$LIBOPENSSL_PATH $LIBOPENSSL_LIBS $SSLLIB"
1166 AC_DEFINE(USE_OPENSSL,1,[OpenSSL support is available])
1168 # check for API functions
1169 SQUID_CHECK_LIBCRYPTO_API
1170 SQUID_CHECK_LIBSSL_API
1171 SQUID_CHECK_OPENSSL_TLS_METHODS
1172 SQUID_STATE_SAVE(check_SSL_CTX_get0_certificate)
1173 LIBS="$LIBS $SSLLIB"
1174 AC_CHECK_LIB(ssl, SSL_CTX_get0_certificate, [
1175 AC_DEFINE(HAVE_SSL_CTX_GET0_CERTIFICATE, 1, [SSL_CTX_get0_certificate is available])
1177 missing_SSL_CTX_get0_certificate=yes
1179 SQUID_STATE_ROLLBACK(check_SSL_CTX_get0_certificate)
1181 # check for other specific broken implementations
1182 AS_IF([test "x$missing_SSL_CTX_get0_certificate" = "xyes"],SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS)
1183 SQUID_CHECK_OPENSSL_CONST_SSL_METHOD
1184 SQUID_CHECK_OPENSSL_CONST_CRYPTO_EX_DATA
1185 SQUID_CHECK_OPENSSL_CONST_SSL_SESSION_CB_ARG
1186 SQUID_CHECK_OPENSSL_CONST_X509_GET0_SIGNATURE_ARGS
1187 SQUID_CHECK_OPENSSL_TXTDB
1189 AS_IF([test "x$SSLLIB" = "x"],[AC_MSG_ERROR([Required OpenSSL library not found])])
1191 AC_MSG_NOTICE([OpenSSL library support: ${with_openssl:=no} ${LIBOPENSSL_PATH} ${LIBOPENSSL_LIBS}])
1192 AM_CONDITIONAL(ENABLE_SSL,[ test "x$with_openssl" = "xyes" ])
1195 dnl User may specify MIT Kerberos is needed from a non-standard location
1196 SQUID_AUTO_LIB(mit-krb5,[MIT Kerberos],[LIB_KRB5])
1197 AH_TEMPLATE(USE_APPLE_KRB5,[Apple Kerberos support is available])
1198 AH_TEMPLATE(USE_MIT_KRB5,[MIT Kerberos support is available])
1199 AH_TEMPLATE(USE_SOLARIS_KRB5,[Solaris Kerberos support is available])
1201 ## find out if pkg-config or krb5-config will work
1202 AS_IF([test "x$with_mit_krb5" != "xno"],[
1203 CXXFLAGS="$LIB_KRB5_CFLAGS $CXXFLAGS"
1204 krb5confpath="$with_mit_krb5/bin"
1205 # find installed libs via pkg-config or krb5-config
1207 PKG_CHECK_EXISTS(mit-krb5-gssapi mit-krb5, [squid_pc_krb5_name="mit-krb5-gssapi mit-krb5"],[
1208 PKG_CHECK_EXISTS(gssapi-krb5 krb5, [squid_pc_krb5_name="gssapi-krb5 krb5"])
1210 AS_IF([test "x$squid_pc_krb5_name" = "x" -a "$cross_compiling" = "no"],[
1211 # Look for krb5-config (unless cross-compiling)
1212 AC_PATH_PROG(krb5_config,krb5-config,no,$krb5confpath)
1213 AS_IF([test "x$ac_cv_path_krb5_config" != "xno"],[
1214 krb5confpath="`dirname $ac_cv_path_krb5_config`"
1215 ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
1216 ac_solaris="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i solaris`"
1217 ac_apple="`$ac_cv_path_krb5_config --vendor 2>/dev/null | grep -c -i apple`"
1218 AS_IF([test $ac_solaris -gt 0],[with_solaris_krb5=yes],
1219 [test $ac_apple -gt 0],[with_apple_krb5=yes],
1220 [test $ac_heimdal -gt 0],[with_mit_krb5=no]
1223 AS_IF([test "x$with_mit_krb5" = "xyes"],[
1224 AC_MSG_ERROR([Could not find krb5-config in path])
1232 # detect MIT Kerberos dependencies (except on Solaris)
1233 AS_IF([test "x$with_mit_krb5" != "xno" -a "x$with_solaris_krb5" != "xyes"],[
1234 SQUID_STATE_SAVE([squid_krb5_save])
1235 LIBS="$LIBS $LIB_KRB5_PATH"
1237 # auto-detect using pkg-config
1238 PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
1239 # look for krb5-config (unless cross-compiling)
1240 AS_IF([test "$cross_compiling" = "no"],[
1241 AS_IF([test "x$krb5confpath" = "x"],[
1242 AC_PATH_PROG(krb5_config,krb5-config,no)
1243 AS_IF([test "x$ac_cv_path_krb5_config" != "xno"],[ac_krb5_config="$ac_cv_path_krb5_config"])
1245 ac_krb5_config="$krb5confpath/krb5-config"
1248 AS_IF([test "x$ac_krb5_config" != "x" -a -x "$ac_krb5_config"],[
1250 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1251 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1252 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1253 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1254 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1256 ## For some OS pkg-config is broken or unavailable.
1257 ## Detect libraries the hard way.
1259 SQUID_STATE_SAVE([squid_mit_save])
1261 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1262 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
1263 AC_MSG_WARN([library 'com_err' is required for MIT Kerberos])
1264 missing_required=yes
1267 AC_CHECK_LIB(k5crypto, [main], [LIB_KRB5_LIBS="-lk5crypto $LIB_KRB5_LIBS"],[
1268 AC_MSG_WARN([library 'k5crypto' is required for MIT Kerberos])
1269 missing_required=yes
1272 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1273 AC_MSG_WARN([library 'krb5' is required for MIT Kerberos])
1274 missing_required=yes
1277 AC_CHECK_LIB(gssapi_krb5, [main], [LIB_KRB5_LIBS="-lgssapi_krb5 $LIB_KRB5_LIBS"],[
1278 AC_MSG_WARN([library 'gssapi_krb5' is required for MIT Kerberos])
1279 missing_required=yes
1281 SQUID_STATE_ROLLBACK([squid_mit_save])
1282 AS_IF([test "x$missing_required" = "xyes"],[LIB_KRB5_LIBS=""])
1286 AS_IF([test "x$LIB_KRB5_LIBS" != "x"],[
1287 AS_IF([test "x$with_apple_krb5" = "xyes"],[
1288 AC_DEFINE(USE_APPLE_KRB5,1,[Apple Kerberos support is available])
1289 KRB5_FLAVOUR="Apple"
1291 AC_DEFINE(USE_MIT_KRB5,1,[MIT Kerberos support is available])
1294 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1295 KRB5INCS="$LIB_KRB5_CFLAGS"
1297 # check for other specific broken implementations
1298 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1299 LIBS="$LIBS $KRB5LIBS"
1301 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1302 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1303 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
1304 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1305 AC_CHECK_HEADERS(profile.h)
1307 SQUID_CHECK_KRB5_FUNCS
1309 AS_IF([test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"],[
1310 AC_MSG_ERROR([Required Kerberos library not found])
1311 ],[test "x$KRB5LIBS" = "x"],[
1315 SQUID_STATE_ROLLBACK([squid_krb5_save])
1318 # detect Solaris Kerberos dependencies
1319 AS_IF([test "x$with_solaris_krb5" = "xyes" -a "x$KRB5LIBS" = "x"],[
1320 SQUID_STATE_SAVE([squid_krb5_save])
1321 LIBS="$LIBS $LIB_KRB5_PATH"
1323 # no pkg-config for solaris native Kerberos
1324 # look for krb5-config (unless cross-compiling)
1325 AS_IF([test "$cross_compiling" = "no"],[
1326 AS_IF([test "x$krb5confpath" = "x"],[
1327 AC_PATH_PROG(krb5_config,krb5-config,no)
1328 AS_IF([test "x$ac_cv_path_krb5_config" != "xno"],[ac_krb5_config="$ac_cv_path_krb5_config"])
1330 ac_krb5_config="$krb5confpath/krb5-config"
1333 AS_IF([test "x$ac_krb5_config" != "x" -a -x "$ac_krb5_config"],[
1335 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1336 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1337 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1338 # Solaris 10 Update 11 patches the krb5-config tool to produce stderr messages on stdout.
1339 SOLARIS_BROKEN_KRB5CONFIG_GSSAPI="`$ac_krb5_config --libs gssapi 2>/dev/null | grep "krb5-config"`"
1340 AS_IF([test "x$SOLARIS_BROKEN_KRB5CONFIG_GSSAPI" = "x"],[
1341 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1342 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1345 ## For some OS pkg-config is broken or unavailable.
1346 ## Detect libraries the hard way.
1348 CXXFLAGS="-I/usr/include/kerberosv5 $CXXFLAGS"
1350 SQUID_STATE_SAVE([squid_solaris_save])
1352 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1353 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1354 AC_MSG_WARN([library 'krb5' is required for Solaris Kerberos])
1355 missing_required=yes
1358 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
1359 AC_MSG_WARN([library 'gss' is required for Solaris Kerberos])
1360 missing_required=yes
1362 SQUID_STATE_ROLLBACK([squid_solaris_save])
1363 AS_IF([test "x$missing_required" = "xyes"],[LIB_KRB5_LIBS=""])
1366 AS_IF([test "x$LIB_KRB5_LIBS" != "x"],[
1367 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1368 KRB5INCS="$LIB_KRB5_CFLAGS"
1369 AC_DEFINE(USE_SOLARIS_KRB5,1,[Solaris Kerberos support is available])
1370 KRB5_FLAVOUR="Solaris"
1372 # check for other specific broken implementations
1373 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1374 LIBS="$LIBS $KRB5LIBS"
1376 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1377 AC_CHECK_HEADERS(gssapi/gssapi.h gssapi/gssapi_ext.h)
1378 AC_CHECK_HEADERS(krb5.h com_err.h)
1380 SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H
1381 AS_IF([test "x$squid_cv_broken_krb5_h" = "xyes"],[
1382 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if Solaris krb5.h is broken for C++])
1383 AC_MSG_WARN([You have a broken Solaris <krb5.h> system include.])
1384 AC_MSG_WARN([Please see http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512])
1385 AC_MSG_WARN([If you need Kerberos support you will have to patch])
1386 AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch])
1388 SQUID_CHECK_KRB5_FUNCS
1390 AS_IF([test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"],[
1391 # Error only if Solaris flavour was detected while looking for required MIT Kerberos
1392 AC_MSG_ERROR([Required Kerberos library not found])
1393 ],[test "x$KRB5LIBS" = "x"],[
1394 with_solaris_krb5=no
1397 SQUID_STATE_ROLLBACK([squid_krb5_save])
1400 dnl User may specify Heimdal Kerberos is needed from a non-standard location
1401 SQUID_AUTO_LIB(heimdal-krb5,[Heimdal Kerberos],[LIB_KRB5])
1402 AH_TEMPLATE(USE_HEIMDAL_KRB5,[Heimdal Kerberos support is available])
1403 AS_IF([test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"],[
1404 CXXFLAGS="$LIB_KRB5_CFLAGS $CXXFLAGS"
1405 krb5confpath="$with_heimdal_krb5/bin"
1406 # find installed libs via pkg-config or krb5-config
1407 PKG_CHECK_EXISTS(heimdal-krb5, [squid_pc_krb5_name="heimdal-krb5"])
1408 AS_IF([test "x$squid_pc_krb5_name" = "x"],[
1409 PKG_CHECK_EXISTS(heimdal-gssapi, [squid_pc_krb5_name="heimdal-gssapi"])
1411 AS_IF([test "x$squid_pc_krb5_name" = "x" -a "$cross_compiling" = "no"],[
1412 # Look for krb5-config (unless cross-compiling)
1413 AC_PATH_PROG(krb5_config,krb5-config,no,$krb5confpath)
1414 AS_IF([test "x$ac_cv_path_krb5_config" != "xno"],[
1415 krb5confpath="`dirname $ac_cv_path_krb5_config`"
1416 ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
1417 AS_IF([test "x$with_heimdal_krb5" = "xyes" -a $ac_heimdal = 0],[
1418 AC_MSG_ERROR([Could not find pkg-config or krb5-config for Heimdal Kerberos])
1421 AS_IF([test "x$with_heimdal_krb5" = "xyes"],[
1422 AC_MSG_ERROR([Could not find krb5-config in path])
1424 AC_MSG_WARN([Could not find krb5-config in path])
1425 with_heimdal_krb5=no
1430 AS_IF([test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"],[
1431 SQUID_STATE_SAVE([squid_krb5_save])
1432 LIBS="$LIBS $LIB_KRB5_PATH"
1434 # auto-detect using pkg-config
1435 PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
1436 # look for krb5-config (unless cross-compiling)
1437 AS_IF([test "$cross_compiling" = "no"],[
1438 AS_IF([test "x$krb5confpath" = "x"],[
1439 AC_PATH_PROG(krb5_config,krb5-config,no)
1440 AS_IF([test "x$ac_cv_path_krb5_config" != "xno"],[ac_krb5_config="$ac_cv_path_krb5_config"])
1442 ac_krb5_config="$krb5confpath/krb5-config"
1445 AS_IF([test "x$ac_krb5_config" != "x" -a -x "$ac_krb5_config"],[
1447 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1448 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1449 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1450 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1451 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1453 ## For some OS pkg-config is broken or unavailable.
1454 ## Detect libraries the hard way.
1455 SQUID_STATE_SAVE([squid_heimdal_save])
1457 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1458 AC_CHECK_LIB(resolv, [main], [LIB_KRB5_LIBS="-lresolv $LIB_KRB5_LIBS"],[
1459 AC_MSG_WARN([library 'resolv' is required for Heimdal Kerberos])
1460 missing_required=yes
1463 AC_CHECK_LIB(crypt, [main], [LIB_KRB5_LIBS="-lcrypt $LIB_KRB5_LIBS"],[
1464 AC_MSG_WARN([library 'crypt' is required for Heimdal Kerberos])
1465 missing_required=yes
1468 AC_CHECK_LIB(roken, [main], [LIB_KRB5_LIBS="-lroken $LIB_KRB5_LIBS"],[
1469 AC_MSG_WARN([library 'roken' is required for Heimdal Kerberos])
1470 missing_required=yes
1473 AC_CHECK_LIB(heimbase, [main], [LIB_KRB5_LIBS="-lheimbase $LIB_KRB5_LIBS"],[
1474 AC_MSG_WARN([library 'heimbase' may be required for Heimdal Kerberos])
1477 AC_CHECK_LIB(wind, [main], [LIB_KRB5_LIBS="-lwind $LIB_KRB5_LIBS"],[
1478 AC_MSG_WARN([library 'wind' may be required for Heimdal Kerberos])
1481 AC_CHECK_LIB(crypto, [main], [LIB_KRB5_LIBS="-lcrypto $LIB_KRB5_LIBS"],[
1482 AC_MSG_WARN([library 'crypto' is required for Heimdal Kerberos])
1483 missing_required=yes
1486 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
1487 AC_MSG_WARN([library 'com_err' is required for Heimdal Kerberos])
1488 missing_required=yes
1491 AC_CHECK_LIB(hx509, [main], [LIB_KRB5_LIBS="-lhx509 $LIB_KRB5_LIBS"],[
1492 AC_MSG_WARN([library 'hx509' may be required for Heimdal Kerberos])
1495 AC_CHECK_LIB(asn1, [main], [LIB_KRB5_LIBS="-lasn1 $LIB_KRB5_LIBS"],[
1496 AC_MSG_WARN([library 'asn1' is required for Heimdal Kerberos])
1497 missing_required=yes
1500 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1501 AC_MSG_WARN([library 'krb5' is required for Heimdal Kerberos])
1502 missing_required=yes
1505 AC_CHECK_LIB(heimntlm, [main], [LIB_KRB5_LIBS="-lheimntlm $LIB_KRB5_LIBS"],[
1506 AC_MSG_WARN([library 'heimntlm' may be required for Heimdal Kerberos])
1509 AC_CHECK_LIB(gssapi, [main], [LIB_KRB5_LIBS="-lgssapi $LIB_KRB5_LIBS"],[
1510 AC_MSG_WARN([library 'gssapi' is required for Heimdal Kerberos])
1511 missing_required=yes
1513 SQUID_STATE_ROLLBACK([squid_heimdal_save])
1514 AS_IF([test "x$missing_required" = "xyes"],[LIB_KRB5_LIBS=""])
1517 AS_IF([test "x$LIB_KRB5_LIBS" != "x"],[
1518 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1519 KRB5INCS="$LIB_KRB5_CFLAGS"
1520 AC_DEFINE(USE_HEIMDAL_KRB5,1,[Heimdal Kerberos support is available])
1521 KRB5_FLAVOUR="Heimdal"
1523 # check for other specific broken implementations
1524 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1525 LIBS="$LIBS $KRB5LIBS"
1527 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1528 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1529 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1531 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1532 AS_IF([test "x$squid_cv_broken_heimdal_krb5_h" = "xyes"],[
1533 AC_DEFINE(HAVE_BROKEN_HEIMDAL_KRB5_H, 1, [Define to 1 if Heimdal krb5.h is broken for C++])
1535 SQUID_CHECK_KRB5_FUNCS
1537 AS_IF([test "x$KRB5LIBS" = "x"],[
1538 AS_IF([test "x$with_heimdal_krb5" = "xyes"],[
1539 AC_MSG_ERROR([Required Heimdal Kerberos library not found])
1541 AC_MSG_WARN([Heimdal Kerberos library not found])
1544 SQUID_STATE_ROLLBACK([squid_krb5_save])
1547 dnl User may specify GNU gss is needed from a non-standard location
1548 SQUID_AUTO_LIB(gnugss,[GNU gss],[LIB_KRB5])
1549 AH_TEMPLATE(USE_GNUGSS,[GNU gss support is available])
1550 AS_IF([test "x$with_gnugss" != "xno" -a "x$KRB5LIBS" = "x"],[
1551 CXXFLAGS="$LIB_KRB5_CFLAGS $CXXFLAGS"
1553 SQUID_STATE_SAVE([squid_krb5_save])
1554 LIBS="$LIBS $LIB_KRB5_PATH"
1556 # auto-detect using pkg-config
1557 PKG_CHECK_MODULES([LIB_KRB5],[gss],,[
1558 ## For some OS pkg-config is broken or unavailable.
1559 ## Detect libraries the hard way.
1561 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1562 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
1563 AC_MSG_WARN([library 'com_err' is required for GNU Kerberos])
1567 AS_IF([test "x$LIB_KRB5_LIBS" != "x"],[
1568 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1569 KRB5INCS="$LIB_KRB5_CFLAGS"
1570 AC_DEFINE(USE_GNUGSS,1,[GNU Kerberos support is available])
1571 KRB5_FLAVOUR="GNU GSS"
1573 # check for other specific broken implementations
1574 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1575 LIBS="$LIBS $KRB5LIBS"
1577 AC_MSG_NOTICE([Try to find Kerbeors headers in given path])
1578 AC_CHECK_HEADERS(gss.h)
1580 SQUID_CHECK_WORKING_GSSAPI
1581 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1583 SQUID_CHECK_SPNEGO_SUPPORT
1584 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1586 SQUID_CHECK_WORKING_KRB5
1587 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1589 AS_IF([test "x$KRB5LIBS" = "x"],[
1590 AS_IF([test "x$with_gnugss" = "xyes"],[
1591 AC_MSG_ERROR([Required GNU GSS Kerberos library not found])
1593 AC_MSG_WARN([GNU GSS Kerberos library not found])
1596 SQUID_STATE_ROLLBACK([squid_krb5_save])
1599 AS_IF([test "x$KRB5LIBS" != "x"],[with_krb5=yes])
1600 AC_MSG_NOTICE([$KRB5_FLAVOUR Kerberos library support: ${with_krb5:=no} ${LIB_KRB5_PATH} ${LIB_KRB5_LIBS}])
1604 SQUID_AUTO_LIB(ldap,[LDAP],[LIBLDAP])
1605 SQUID_CHECK_LIB_WORKS(ldap,[
1606 dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
1607 dnl only with Windows LDAP libraries using -lwldap32
1608 AS_IF([test "$squid_host_os" = "mingw"],[
1609 LIBLDAP_LIBS="-lwldap32"
1611 SQUID_STATE_SAVE(squid_ldap_state)
1612 LIBS="$LIBLDAP_PATH $LIBPTHREADS $LIBS"
1613 PKG_CHECK_MODULES([LIBLDAP],[ldap],[],[
1614 AC_CHECK_LIB(lber, ber_init, [LIBLBER="-llber"])
1615 AC_CHECK_LIB(ldap, ldap_init, [LIBLDAP_LIBS="-lldap $LIBLBER"])
1616 dnl if no ldap lib found check for mozilla version
1617 AS_IF([test "x$ac_cv_lib_ldap_ldap_init" != "xyes"],[
1618 SQUID_STATE_SAVE(squid_ldap_mozilla)
1619 LIBS="$LIBLDAP_PATH $LIBPTHREADS"
1620 AC_CHECK_LIB(ldap60, ldap_init, [LIBLDAP_LIBS="-lldap60 $LIBLBER"])
1621 LIBS="$LIBLDAP_PATH $LIBLDAP_LIBS $LIBPTHREADS"
1622 AC_CHECK_LIB(prldap60, prldap_init, [LIBLDAP_LIBS="-lprldap60 $LIBLDAP_LIBS"])
1623 LIBS="$LIBLDAP_PATH $LIBLDAP_LIBS $LIBPTHREADS"
1624 AC_CHECK_LIB(ssldap60, ldapssl_init, [LIBLDAP_LIBS="-lssldap60 $LIBLDAP_LIBS"])
1625 SQUID_STATE_ROLLBACK(squid_ldap_mozilla)
1628 AC_CHECK_HEADERS(ldap.h lber.h)
1629 AC_CHECK_HEADERS(mozldap/ldap.h)
1630 SQUID_CHECK_LDAP_API
1634 SQUID_AUTO_LIB(systemd,[systemd API for start-up notification],[LIBSYSTEMD])
1635 AH_TEMPLATE(USE_SYSTEMD,[systemd support is available])
1636 SQUID_CHECK_LIB_WORKS(systemd,[
1637 SQUID_STATE_SAVE(squid_systemd_state)
1638 LIBS="$LIBS $LIBSYSTEMD_PATH"
1639 PKG_CHECK_MODULES(LIBSYSTEMD,[libsystemd],,[
1641 PKG_CHECK_MODULES(LIBSYSTEMD,[libsystemd-daemon],,[:])
1643 AC_CHECK_HEADERS(systemd/sd-daemon.h)
1644 SQUID_STATE_ROLLBACK(squid_systemd_state)
1646 AS_IF([test "x$LIBSYSTEMD_LIBS" != "x"],[
1647 AC_DEFINE(USE_SYSTEMD,1,[systemd support is available])
1651 AC_ARG_ENABLE(forw-via-db,
1652 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
1653 SQUID_YESNO([$enableval],[--enable-forw-via-db])
1655 SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
1656 [Enable Forw/Via database])
1657 AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
1659 AC_ARG_ENABLE(cache-digests,
1660 AS_HELP_STRING([--enable-cache-digests],
1661 [Use Cache Digests. See https://wiki.squid-cache.org/SquidFaq/CacheDigests]),[
1662 SQUID_YESNO([$enableval],[--enable-cache-digests])
1664 SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
1665 [Use Cache Digests for locating objects in neighbor caches.])
1666 AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
1669 ################################
1670 # check for netio plugin stuff #
1671 ################################
1672 dnl order of these options handling is relevant in case the user
1673 dnl supplies more than one --enable option. Options handled later
1674 dnl override those handled earlier for io loop method manual override
1675 AC_ARG_ENABLE(select,
1676 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),[
1677 SQUID_YESNO([$enableval],[--enable-select])
1678 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="select"])
1680 AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
1683 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),[
1684 SQUID_YESNO([$enableval],[--enable-poll])
1685 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="poll"])
1687 AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
1689 AC_ARG_ENABLE(kqueue,
1690 AS_HELP_STRING([--disable-kqueue],
1691 [Disable kqueue(2) support.]), [
1692 SQUID_YESNO([$enableval],[--enable-kqueue])
1694 AS_IF([test "x${enable_kqueue:=auto}" != "xno"],[
1695 AC_CHECK_HEADERS([sys/event.h],[],[
1696 AS_IF([test "x${enable_kqueue}" = "xyes"],[
1697 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
1700 AC_CHECK_FUNCS(kqueue,[],[
1701 AS_IF([test "x${enable_kqueue}" = "xyes"],[
1702 AC_MSG_ERROR([kqueue support missing in libc library.])
1705 AS_IF([test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes"],[
1706 squid_opt_io_loop_engine="kqueue"
1711 AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
1714 AC_ARG_ENABLE(epoll,
1715 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
1717 SQUID_YESNO([$enableval],[--enable-epoll])
1718 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="epoll"])
1720 AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
1722 # auto-detect and verify epoll header and library present and working
1723 # logic mapping and loop method selection are performed later
1724 AS_IF([test "x$enable_epoll" != "xno"],[
1725 # check if libs are needed to support epoll
1726 SQUID_STATE_SAVE(squid_epoll_state)
1727 AC_SEARCH_LIBS(epoll_ctl,[epoll])
1728 AS_IF([test "x$ac_cv_search_epoll_ctl" = "xno"],[enable_epoll=no],
1729 [test "x$ac_cv_search_epoll_ctl" = "xnone required"],[EPOLL_LIBS=""],
1730 [EPOLL_LIBS=$ac_cv_search_epoll_ctl]
1732 AC_SUBST(EPOLL_LIBS)
1733 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
1735 # epoll requires sys/epoll.h
1736 AC_CHECK_HEADERS([sys/epoll.h])
1738 dnl Verify that epoll really works
1739 AS_IF([test "x$ac_cv_search_epoll_ctl" != "xno"], SQUID_CHECK_EPOLL)
1741 AS_IF([test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno"],[
1742 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
1746 dnl Enable /dev/poll
1747 AC_ARG_ENABLE(devpoll,
1748 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),[
1749 SQUID_YESNO([$enableval],[--enable-devpoll])
1750 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="devpoll"])
1752 AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
1754 ## auto-detect and verify devpoll header and library present and working
1755 AS_IF([test "x$enable_devpoll" != "xno"],[
1756 # /dev/poll requires ioctl() and write()
1757 AC_CHECK_FUNCS(ioctl)
1758 AC_CHECK_FUNCS(write)
1760 # /dev/poll requires sys/devpoll.h
1761 AC_CHECK_HEADERS([sys/devpoll.h],,[
1762 AS_IF([test "x$enable_devpoll" = "xyes"],[
1763 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
1768 # Verify that /dev/poll really works
1769 AS_IF([test "x$enable_devpoll" != "xno"], SQUID_CHECK_DEVPOLL)
1771 AS_IF([test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno"],[
1772 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
1776 AC_ARG_ENABLE(http-violations,
1777 AS_HELP_STRING([--disable-http-violations],
1778 [This allows you to remove code which is known to
1779 violate the HTTP protocol specification.]), [
1780 SQUID_YESNO([$enableval],[--enable-http-violations])
1782 SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
1783 [Define to enable code which volates the HTTP standard specification])
1784 AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
1786 # IPFW Transparent Proxy
1787 AC_ARG_ENABLE(ipfw-transparent,
1788 AS_HELP_STRING([--enable-ipfw-transparent],
1789 [Enable Transparent Proxy support for systems
1790 using FreeBSD IPFW-style firewalling.]), [
1791 SQUID_YESNO([$enableval],[--enable-ipfw-transparent])
1793 SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
1794 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
1795 AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
1797 # IP-Filter Transparent Proxy
1798 AC_ARG_ENABLE(ipf-transparent,
1799 AS_HELP_STRING([--enable-ipf-transparent],
1800 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
1801 SQUID_YESNO([$enableval],[--enable-ipf-transparent])
1803 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1804 #IPF currently broken. Default-disabled for now.
1805 AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
1807 dnl Enable PF Transparent Proxy
1808 AC_ARG_ENABLE(pf-transparent,
1809 AS_HELP_STRING([--enable-pf-transparent],
1810 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
1811 SQUID_YESNO([$enableval],[--enable-pf-transparent])
1813 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1814 AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
1816 dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
1817 AC_ARG_WITH(nat-devpf,
1818 AS_HELP_STRING([--with-nat-devpf],
1819 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
1820 SQUID_YESNO([$withval],[--with-nat-devpf])
1822 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1823 AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
1825 # Linux Netfilter Transparent Proxy
1826 AC_ARG_ENABLE(linux-netfilter,
1827 AS_HELP_STRING([--enable-linux-netfilter],
1828 [Enable Transparent Proxy support for Linux (Netfilter)]), [
1829 SQUID_YESNO([$enableval],[--enable-linux-netfilter])
1831 AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
1832 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1835 dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
1836 SQUID_AUTO_LIB(netfilter-conntrack,[Netfilter conntrack],[LIBNETFILTER_CONNTRACK])
1837 SQUID_CHECK_LIB_WORKS(netfilter-conntrack,[
1838 LDFLAGS="$LIBNETFILTER_CONNTRACK_PATH $LDFLAGS"
1839 CPPFLAGS="$LIBNETFILTER_CONNTRACK_CFLAGS $CPPFLAGS"
1840 AC_SEARCH_LIBS([nfct_query],[netfilter_conntrack],[LIBNETFILTER_CONNTRACK_LIBS="-lnetfilter_conntrack"])
1841 AC_CHECK_HEADERS([ \
1842 libnetfilter_conntrack/libnetfilter_conntrack.h \
1843 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h
1844 ],,[LIBNETFILTER_CONNTRACK_LIBS=""])
1847 dnl Enable Large file support
1850 AC_ARG_WITH(large-files,
1851 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
1852 SQUID_YESNO([$withval],[--with-large-files])
1853 squid_opt_enable_large_files=$withval
1856 dnl UNIX Build environment
1857 dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
1858 AC_ARG_WITH(build-environment,
1859 AS_HELP_STRING([--with-build-environment=model],
1860 [The build environment to use. Normally one of
1861 POSIX_V6_ILP32_OFF32 (32 bits),
1862 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
1863 POSIX_V6_LP64_OFF64 (64 bits),
1864 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
1865 XBS5_ILP32_OFF32 i(legacy, 32 bits),
1866 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
1867 XBS5_LP64_OFF64 (legacy, 64 bits),
1868 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
1869 or default (The default for your OS)]), [
1870 AS_CASE(["$withval"],
1871 [yes|no],[AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])],
1872 [buildmodel="$withval"]
1876 #hack. Let's early-detect sizeof(long)
1877 AC_CHECK_SIZEOF(long)
1879 AS_IF([test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"],[
1880 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
1881 AS_IF([test "`getconf _$model 2>/dev/null || true`" = 1 -o "`getconf $model 2>/dev/null || true`"],[
1886 AS_IF([test "x$buildmodel" = "x"],[
1887 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
1890 AS_IF([test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"],[
1891 # define _FILE_OFFSET_BITS if requested and needed
1892 AS_IF([test "x$squid_opt_enable_large_files" = "xyes" -a $ac_cv_sizeof_long -le 4],[
1893 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
1894 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
1895 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
1898 AC_MSG_NOTICE([Using $buildmodel build environment])
1899 AS_IF([ ! test "`getconf _$buildmodel 2>/dev/null || true`" = 1 -o "`getconf $buildmodel 2>/dev/null || true`"],[
1900 AC_MSG_ERROR([Build environment $buildmodel not known to getconf.])
1902 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
1903 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
1904 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1905 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
1907 AS_IF([test "x$squid_host_os" = "xsolaris"],[
1908 # On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1909 # for LDFLAGS -xarch=generic64, but:
1910 # "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1911 # For gcc "-xarch=generic64" must be replaced with "-m64"
1912 # The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
1913 AS_IF([test "x$GCC" = "xyes"],[
1914 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
1915 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
1916 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
1917 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
1918 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1919 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1920 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
1922 AC_MSG_NOTICE([Removing -Usun on $host])
1923 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
1924 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
1928 AC_ARG_ENABLE(follow-x-forwarded-for,
1929 AS_HELP_STRING([--disable-follow-x-forwarded-for],
1930 [Do not follow the X-Forwarded-For
1931 HTTP header to try to find the IP address of the
1932 original or indirect client when a request has
1933 been forwarded through other proxies.]), [
1934 SQUID_YESNO([$enableval],[--enable-follow-x-forwarded-for])
1936 AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
1937 SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
1938 [Enable following X-Forwarded-For headers])
1940 AC_ARG_ENABLE(ident-lookups,
1941 AS_HELP_STRING([--disable-ident-lookups],
1942 [Remove code that supports performing Ident (RFC 931) lookups.]), [
1943 SQUID_YESNO([$enableval],[--enable-ident-lookups])
1945 AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
1946 SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
1948 dnl Select Default hosts file location
1949 AC_ARG_ENABLE(default-hostsfile,
1950 AS_HELP_STRING([--enable-default-hostsfile=path],
1951 [Select default location for hosts file.
1952 See hosts_file directive in squid.conf for details]), [
1953 # TODO: handle the "yes" case cleanly
1954 AS_CASE(["$enableval"],
1955 [no|none],[squid_opt_default_hosts="none"],
1957 squid_opt_default_hosts=$enableval
1958 AS_IF([ ! test -f "$enableval"],[
1959 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
1963 AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
1964 DEFAULT_HOSTS=$squid_opt_default_hosts
1965 AC_SUBST(DEFAULT_HOSTS)
1967 # Select auth schemes modules to build
1969 AS_HELP_STRING([--disable-auth],
1970 [Do not support authentication. When supported, the list of schemes
1971 and helpers to be enabled is defined elsewhere]), [
1972 SQUID_YESNO([$enableval],[--enable-auth])
1974 AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
1975 SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
1976 AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
1981 AC_ARG_ENABLE(auth-basic,
1982 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
1983 [Enable the basic authentication scheme, and build the specified helpers.
1984 Not providing an explicit list of helpers will attempt build of
1985 all possible helpers. Default is to do so.
1986 To disable the basic authentication scheme, use --disable-auth-basic.
1987 To enable but build no helpers, specify "none".
1988 To see available helpers, see the src/auth/basic/ directory. ]),[
1989 #nothing to do really
1991 m4_include([src/auth/basic/helpers.m4])
1993 AC_ARG_ENABLE(auth-digest,
1994 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
1995 [Enable the Digest authentication scheme, and build the specified helpers.
1996 Not providing an explicit list of helpers will attempt build of
1997 all possible helpers. Default is to do so.
1998 To disable the Digest authentication scheme, use --disable-auth-digest.
1999 To enable but build no helpers, specify "none".
2000 To see available helpers, see the src/auth/digest/ directory. ]),[
2001 #nothing to do, really
2003 m4_include([src/auth/digest/helpers.m4])
2005 AC_ARG_ENABLE(auth-negotiate,
2006 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
2007 [Enable the Negotiate authentication scheme, and build the specified
2009 Not providing an explicit list of helpers will attempt build of
2010 all possible helpers. Default is to do so.
2011 To disable the Negotiate authentication scheme,
2012 use --disable-auth-negotiate.
2013 To enable but build no helpers, specify "none".
2014 To see available helpers, see the src/auth/negotiate/ directory. ]),[
2015 #nothing to do, really
2017 m4_include([src/auth/negotiate/helpers.m4])
2019 AC_ARG_ENABLE(auth-ntlm,
2020 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
2021 [Enable the NTLM authentication scheme, and build the specified helpers.
2022 Not providing an explicit list of helpers will attempt build of
2023 all possible helpers. Default is to do so.
2024 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
2025 To enable but build no helpers, specify "none".
2026 To see available helpers, see the src/auth/ntlm/ directory. ]),[
2028 m4_include([src/auth/ntlm/helpers.m4])
2030 dnl Authentication libraries to build
2031 dnl This list will not be needed when each auth library has its own Makefile
2032 dnl this is to be placed AFTER each auth module's handler
2034 for module in $AUTH_MODULES; do
2035 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
2037 AC_SUBST(AUTH_MODULES)
2038 AC_SUBST(AUTH_LIBS_TO_BUILD)
2039 AM_CONDITIONAL(ENABLE_SMBLIB, test "x$require_smblib" = "xyes")
2040 AM_CONDITIONAL(ENABLE_SSPI, test "x$require_sspi" = "xyes")
2042 dnl Select logging daemon helpers to build
2043 AC_ARG_ENABLE(log-daemon-helpers,
2044 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
2045 [This option selects which logging daemon helpers to
2046 build and install as part of the normal build process
2047 For a list of available helpers see the src/log/
2049 #nothing to do, really
2051 m4_include([src/log/helpers.m4])
2053 AC_ARG_ENABLE(external-acl-helpers,
2054 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
2055 [Enable external_acl helpers support and the helpers themselves.
2056 Default is to build all buildable helpers and enable support.
2057 To disable support, use --disable-external-acl-helpers.
2058 To build no helpers, specify "none".
2059 To see available helpers, see the src/acl/external/
2061 #nothing to do, really
2063 m4_include([src/acl/external/helpers.m4])
2065 dnl Select url_rewrite helpers to build
2066 AC_ARG_ENABLE(url-rewrite-helpers,
2067 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
2068 [This option selects which url_rewrite helpers to
2069 build and install as part of the normal build
2070 process. The default is to attempt the build of all possible
2071 helpers. Use --disable-url-rewrite-helpers to build none.
2072 For a list of available helpers see the
2073 src/http/url_rewriters/ directory.]),[
2075 m4_include([src/http/url_rewriters/helpers.m4])
2077 dnl Select security helpers to build
2078 AC_ARG_ENABLE(security-cert-validators,
2079 AS_HELP_STRING([--enable-security-cert-validators="list of helpers"],
2080 [This option selects which security certificate validator
2081 helpers to build and install as part of the normal build
2082 process. The default is to attempt the build of all possible
2083 helpers. Use --disable-security-cert-validators to
2084 build none. For a list of available helpers see the
2085 src/security/cert_validators/ directory.]),[
2087 m4_include([src/security/cert_validators/helpers.m4])
2089 AC_ARG_ENABLE(security-cert-generators,
2090 AS_HELP_STRING([--enable-security-cert-generators="list of helpers"],
2091 [This option selects which security certificate validator
2092 helpers to build and install as part of the normal build
2093 process. The default is to attempt the build of all possible
2094 helpers. Use --disable-security-cert-genrators to
2095 build none. For a list of available helpers see the
2096 src/security/cert_generators/ directory.]),[
2098 m4_include([src/security/cert_generators/helpers.m4])
2100 dnl Select storeid_rewrite helpers to build
2101 AC_ARG_ENABLE(storeid-rewrite-helpers,
2102 AS_HELP_STRING([--enable-storeid-rewrite-helpers="list of helpers"],
2103 [This option selects which Store-ID rewrite helpers to
2104 build and install as part of the normal build
2105 process. The default is to attempt the build of all possible
2106 helpers. Use --disable-storeid-rewrite-helpers to build none.
2107 For a list of available helpers see the
2108 src/store/id_rewriters/ directory.]),[
2110 m4_include([src/store/id_rewriters/helpers.m4])
2112 AC_ARG_WITH(valgrind-debug,
2113 AS_HELP_STRING([--with-valgrind-debug],
2114 [Include debug instrumentation for use with valgrind]),
2116 SQUID_YESNO([$withval],[--with-valgrind-debug])
2117 AS_IF([test "x$withval" != "xno"],[
2118 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
2119 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
2123 SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
2124 [Valgrind memory debugger support])
2125 AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
2127 dnl Enable WIN32 Service compile mode
2128 AC_ARG_ENABLE(win32-service,
2129 AS_HELP_STRING([--enable-win32-service],
2130 [Compile Squid as a WIN32 Service.
2131 Works only on MS-Windows platforms]), [
2132 SQUID_YESNO([$enableval],[--enable-win32-service])
2134 SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
2135 [Enable code supporting MS Windows service mode])
2136 AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
2139 # Disable "unlinkd" code
2140 AC_ARG_ENABLE(unlinkd,
2141 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
2142 SQUID_YESNO([$enableval],[--enable-unlinkd])
2144 SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
2145 [Enable useage of unlinkd])
2146 AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
2147 AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
2149 # Enable backtraces on fatal errors
2150 AC_ARG_ENABLE(stacktraces,
2151 AS_HELP_STRING([--enable-stacktraces],
2152 [Enable automatic call backtrace on fatal errors]), [
2153 SQUID_YESNO([$enableval],[--enable-stacktraces])
2155 SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
2156 [Print stack traces on fatal errors])
2157 AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
2159 # Enable X-Accelerator-Vary for Vary support within an accelerator setup
2160 AC_ARG_ENABLE(x-accelerator-vary,
2161 AS_HELP_STRING([--enable-x-accelerator-vary],
2162 [Enable support for the X-Accelerator-Vary
2163 HTTP header. Can be used to indicate
2164 variance within an accelerator setup.
2165 Typically used together with other code
2166 that adds custom HTTP headers to the requests.]), [
2167 SQUID_YESNO([$enableval],[--enable-x-accelerator-vary])
2169 SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
2170 [Enable support for the X-Accelerator-Vary HTTP header])
2171 AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
2173 SQUID_AUTO_LIB(cppunit,[cppunit test framework],[LIBCPPUNIT])
2174 SQUID_CHECK_LIB_WORKS(cppunit,[
2175 LIBCPPUNIT_LIBS="$LIBCPPUNIT_PATH -lcppunit"
2176 PKG_CHECK_MODULES([LIBCPPUNIT],[cppunit],[
2177 squid_cv_cppunit_version="`pkg-config --modversion cppunit`"
2178 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
2179 AS_UNSET(squid_cv_cppunit_version)
2181 SQUID_STATE_SAVE(squid_cppunit_state)
2182 CXXFLAGS="${CXXFLAGS} ${LIBCPPUNIT_CFLAGS}"
2183 LIBS="${LIBS} ${LIBCPPUNIT_LIBS}"
2184 AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
2185 SQUID_STATE_ROLLBACK(squid_cppunit_state)
2187 AC_MSG_WARN([cppunit does not appear to be installed. Squid does not require this, but code testing with 'make check' will fail.])
2191 dnl Check for headers
2212 linux/posix_types.h \
2220 netinet/in_systm.h \
2272 linux/netfilter_ipv4.h \
2273 linux/netfilter_ipv6/ip6_tables.h \
2275 SQUID_DEFAULT_INCLUDES
2279 /* Netfilter ip(6)tables v1.4.0 has broken headers */
2280 #if HAVE_NETINET_IN_H
2281 #include <netinet/in.h>
2285 dnl *BSD do not include the dependencies for all their net/ and netinet/ files
2286 dnl We must include a few basic type headers for them to work.
2301 SQUID_BSDNET_INCLUDES)
2306 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2312 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
2314 #include <sys/time.h>
2316 #if HAVE_SYS_RESOURCE_H
2317 #include <sys/resource.h>
2321 AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2322 #if HAVE_SYS_TYPES_H
2323 #include <sys/types.h>
2325 #include <netinet/in.h>
2326 #include <netinet/in_systm.h>
2327 #include <netinet/ip.h>
2328 #if defined (__linux__) || defined (__CYGWIN__)
2337 dnl Check for typedefs
2338 AC_CHECK_SIZEOF(void *)
2340 # check for a bunch of types
2354 AC_CHECK_TYPE([bool])
2355 #need the defines for PRId64
2356 AC_CHECK_SIZEOF(int64_t)
2357 AC_CHECK_SIZEOF(long)
2358 #need the define for overflow checks
2359 AC_CHECK_SIZEOF(off_t)
2360 AC_CHECK_SIZEOF(size_t)
2362 dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2363 dnl that is incompatible with the updated Solaris header files.
2364 dnl For this reason, we must check if pad128_t and upad128_t are defined.
2365 AC_CHECK_TYPE(pad128_t,
2366 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2367 ,SQUID_DEFAULT_INCLUDES)
2369 AC_CHECK_TYPE(upad128_t,
2370 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2371 ,SQUID_DEFAULT_INCLUDES)
2373 AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2374 AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2376 AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2377 #include <sys/types.h>
2378 #include <sys/socket.h>
2383 AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
2384 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
2385 #include <sys/ipc.h>
2386 #include <sys/msg.h>])
2388 AC_CHECK_TYPE(cpu_set_t,
2389 AC_DEFINE(HAVE_CPU_SET_T,1,[cpu_set_t is defined by the system headers]),,[
2395 dnl Check for special functions
2398 SQUID_AUTO_LIB(cap,[Linux capabilities],[LIBCAP])
2399 SQUID_CHECK_LIB_WORKS(cap,[
2400 SQUID_STATE_SAVE(squid_libcap_state)
2401 CXXFLAGS="$LIBCAP_CFLAGS $CXXFLAGS"
2402 LDFLAGS="$LIBCAP_PATH $LDFLAGS"
2403 PKG_CHECK_MODULES([LIBCAP],[libcap >= 2.09],[],[
2404 # cap_clear_flag is the most recent libcap function we require
2405 AC_CHECK_LIB([cap],[cap_clear_flag],[LIBCAP_LIBS="$LIBCAP_LIBS -lcap"])
2407 SQUID_CHECK_FUNCTIONAL_LIBCAP2
2408 AC_MSG_NOTICE([libcap headers are ok: $squid_cv_sys_capability_works])
2409 AS_IF([test "x$squid_cv_sys_capability_works" = "xno"],[LIBCAP_LIBS=""])
2410 SQUID_STATE_ROLLBACK(squid_libcap_state)
2412 AS_IF([test "x$LIBCAP_LIBS" != "x"],[
2413 AC_DEFINE(USE_LIBCAP,1,[Linux capabilities library support])
2417 dnl Check for needed libraries
2418 AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
2419 AC_SEARCH_LIBS([res_init],[resolv])
2420 AC_SEARCH_LIBS([__res_search],[resolv])
2421 AC_SEARCH_LIBS([bind],[socket])
2422 AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
2423 AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
2425 # check that we have unix sockets
2426 SQUID_CHECK_UNIX_SOCKET
2427 SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
2429 AC_CHECK_LIB(gnumalloc, malloc)
2430 AS_IF([test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"],[
2431 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
2432 ac_cv_func_mallocblksize=no
2433 ac_cv_func_mallopt=no
2435 AS_CASE(["$squid_host_os"],
2436 [solaris],[AC_MSG_NOTICE([skipping libmalloc check for $host])],
2437 [freebsd],[AC_MSG_NOTICE([skipping libmalloc check for $host])],
2438 [AC_CHECK_LIB(malloc, main)]
2442 AS_IF([test "$squid_host_os" = "mingw"],[
2443 AC_MSG_NOTICE([Use MSVCRT for math functions.])
2445 dnl log() are only used in old C code for now.
2447 AC_SEARCH_LIBS([log],[m])
2451 dnl --with-maxfd present for compatibility with Squid-2.
2452 dnl undocumented in ./configure --help to encourage using the Squid-3 directive
2453 AC_ARG_WITH(maxfd,,[
2456 squid_filedescriptors_num=$withval
2457 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
2459 [AC_MSG_ERROR(--with-maxfd expects a numeric argument)]
2463 AC_ARG_WITH(filedescriptors,
2464 AS_HELP_STRING([--with-filedescriptors=NUMBER],
2465 [Force squid to support NUMBER filedescriptors]),[
2468 squid_filedescriptors_num=$withval
2469 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])],
2470 [AC_MSG_ERROR([--with-filedescriptors expects a numeric argument])]
2474 SQUID_CHECK_DEFAULT_FD_SETSIZE
2478 dnl Enable IPv6 support
2479 AC_MSG_CHECKING([whether to enable IPv6])
2481 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
2482 SQUID_YESNO([$enableval],[--enable-ipv6])
2484 AC_MSG_RESULT(${enable_ipv6:=yes})
2485 SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
2487 AS_IF([test "x$enable_ipv6" = "xyes"],[SQUID_CHECK_SIN6_LEN_IN_SAI])
2488 SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
2489 SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
2491 dnl System-specific library modifications
2492 AH_TEMPLATE(GETTIMEOFDAY_NO_TZP,[Whether gettimeofday takes only one argument])
2495 # -lintl is needed on SCO version 3.2v4.2 for strftime()
2496 # Robert Side <rside@aiinc.bc.ca>
2497 # Mon, 18 Jan 1999 17:48:00 GMT
2498 AC_CHECK_LIB(intl, strftime)
2501 [i386-*-solaris2.*],[
2502 AS_IF([test "x$GCC" = "xyes"],[
2503 AC_MSG_NOTICE([Removing -O for gcc on $host])
2504 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
2509 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
2510 LIBS=`echo $LIBS | sed -e s/-lsocket//`
2511 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
2512 LIBS=`echo $LIBS | sed -e s/-lnsl//`
2513 ac_cv_lib_nsl_main=no
2517 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
2523 public:virtual ~Foo(){}
2525 class Bar:public Foo{
2526 public:Bar():Foo(){}
2529 Foo * myFoo=new Bar();
2530 Bar * myBar=dynamic_cast<Bar *>(myFoo);
2531 assert(myBar != NULL);
2533 AS_IF([test "$ac_cv_require_rtti" = "yes"],[
2534 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
2535 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
2539 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
2541 AS_IF([test "$ac_cv_require_qcpluscmt" = "yes"],[
2542 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
2546 [*-*-solaris2.[[0-4]]],[AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)],
2548 [*-sony-newsos[[56]]*],[AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)]
2551 dnl This has to be before AC_CHECK_FUNCS
2552 # Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2553 # when running configure.
2554 AS_IF([test "x$ac_cv_func_poll" = "x"],[
2558 AC_MSG_NOTICE([disabling poll for $host...])
2559 ac_cv_func_poll='no'
2563 # Henrik Nordstrom (hno@squid-cache.org) 19980817
2564 # poll is problematic on Linux. We disable it
2565 # by default until Linux gets it right.
2566 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2567 AS_IF([test $rev -lt 002002],[
2568 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
2569 ac_cv_func_poll='no'
2573 [powerpc-ibm-aix4.1.*],[
2574 # Mike Laster (mlaster@metavillage.com) 19981021
2575 AC_MSG_NOTICE([disabling poll for $host...])
2576 ac_cv_func_poll='no'
2581 dnl Check for library functions
2583 backtrace_symbols_fd \
2606 pthread_attr_setschedparam \
2607 pthread_attr_setscope \
2608 pthread_setschedparam \
2634 dnl ... and some we provide local replacements for
2643 # Magic which checks whether we are forcing a type of comm loop we
2644 # are actually going to (ab)use.
2645 # Mostly ripped from squid-commloops, thanks to adrian and benno
2647 AS_IF([test "x$squid_opt_io_loop_engine" != "x"],
2648 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine]),
2649 [test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes"],
2650 squid_opt_io_loop_engine="epoll",
2651 [test "x$enable_kqueue" != "xno"],
2652 squid_opt_io_loop_engine="kqueue",
2653 [test "x$enable_devpoll" != "xno"],
2654 squid_opt_io_loop_engine="devpoll",
2655 [test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes"],
2656 squid_opt_io_loop_engine="poll",
2657 [test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"],
2658 squid_opt_io_loop_engine="select",
2660 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
2661 AC_MSG_WARN([Will try select and hope for the best.])
2662 squid_opt_io_loop_engine="select"
2666 AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
2668 AM_CONDITIONAL(ENABLE_POLL, test "x$squid_opt_io_loop_engine" = "xpoll")
2669 AM_CONDITIONAL(ENABLE_EPOLL, test "x$squid_opt_io_loop_engine" = "xepoll")
2670 AM_CONDITIONAL(ENABLE_SELECT, test "x$squid_opt_io_loop_engine" = "xselect")
2671 AM_CONDITIONAL(ENABLE_KQUEUE, test "x$squid_opt_io_loop_engine" = "xkqueue")
2672 AM_CONDITIONAL(ENABLE_DEVPOLL, test "x$squid_opt_io_loop_engine" = "xdevpoll")
2674 AS_CASE([$squid_opt_io_loop_engine],
2675 [epoll],[AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])],
2676 [devpoll],[AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop])],
2677 [poll],[AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])],
2678 [kqueue],[AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])],
2679 [select],[AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])],
2682 AS_IF([test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes"],[
2683 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
2686 AC_CHECK_HEADERS(mswsock.h)
2687 AC_MSG_CHECKING([for constant CMSG_SPACE])
2688 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2689 #if HAVE_SYS_SOCKET_H
2690 #include <sys/socket.h>
2693 #include <mswsock.h>
2696 int a[CMSG_SPACE(int)];
2699 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
2704 AC_CHECK_TYPE(struct cmsghdr,AC_DEFINE(HAVE_CMSGHDR,1,[The system provides struct cmsghdr]),,[
2705 #if HAVE_SYS_SOCKET_H
2706 #include <sys/socket.h>
2709 #include <mswsock.h>
2712 #include <winsock2.h>
2716 AC_CHECK_TYPE(struct iovec,AC_DEFINE(HAVE_IOVEC,1,[The system provides struct iovec]),,[
2717 #if HAVE_SYS_SOCKET_H
2718 #include <sys/socket.h>
2721 #include <winsock2.h>
2724 #include <sys/uio.h>
2728 AC_CHECK_TYPE(struct msghdr,AC_DEFINE(HAVE_MSGHDR,1,[The system provides struct msghdr]),,[
2729 #if HAVE_SYS_SOCKET_H
2730 #include <sys/socket.h>
2733 #include <mswsock.h>
2736 #include <winsock2.h>
2740 AC_CHECK_TYPE(struct sockaddr_un,AC_DEFINE(HAVE_SOCKADDR_UN,1,[The system provides sockaddr_un]),,[
2744 #if HAVE_SYS_SOCKET_H
2745 #include <sys/socket.h>
2748 #include <winsock2.h>
2752 SQUID_CHECK_FUNC_STRNSTR
2754 dnl IP-Filter support requires ipf header files. These aren't
2755 dnl installed by default, so we need to check for them
2756 AS_IF([test "x$enable_ipf_transparent" != "xno"],[
2757 SQUID_CHECK_BROKEN_SOLARIS_IPFILTER
2758 AC_MSG_CHECKING(for availability of IP-Filter header files)
2759 # hold on to your hats...
2761 [test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
2762 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
2763 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
2764 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes"],
2765 [have_ipfilter_compat_header="yes"])
2768 [test "x$have_ipfilter_compat_header" = "xyes" -a \
2769 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
2770 "x$ac_cv_header_ip_nat_h" = "xyes"],[enable_ipf_transparent="yes"],
2772 [test "x$have_ipfilter_compat_header" = "xyes" -a \
2773 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
2774 "x$ac_cv_header_netinet_ip_nat_h" = "xyes"],[enable_ipf_transparent="yes"],
2775 [enable_ipf_transparent="no"])
2777 AC_MSG_RESULT($IPF_TRANSPARENT)
2779 ## On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
2780 ## Solaris minor version (8, 9, 10, ...)
2781 AS_IF([test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris"],[
2782 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
2783 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
2784 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
2787 AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
2788 SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
2789 [Enable support for IPF-style transparent proxying])
2791 dnl PF /dev/pf support requires a header file.
2792 AS_IF([test "x$with_nat_devpf" != "xno"],[
2793 AS_IF([test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
2794 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"],[
2795 AS_IF([test "x$with_nat_devpf" = "xauto"],[with_nat_devpf="no"])
2797 AS_IF([test "x$with_nat_devpf" = "xyes"],[
2798 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
2803 SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
2804 [Enable support for PF-style transparent proxying])
2805 SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
2806 [Enable support for /dev/pf NAT lookups])
2808 AS_IF([test "x$enable_linux_netfilter" != "xno"],[
2809 AS_IF([test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"],[
2810 AS_IF([test "x$enable_linux_netfilter" = "xauto"],[enable_linux_netfilter=yes])
2812 AS_IF([test "x$enable_linux_netfilter" = "xauto"],[
2813 enable_linux_netfilter=no
2815 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
2819 SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
2820 [Enable support for Transparent Proxy on Linux via Netfilter])
2822 dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
2823 AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
2824 AS_IF([test "x$enable_linux_netfilter" = "xyes" -a "x$with_cap" != "xyes"],[
2825 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
2826 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
2827 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
2830 AS_IF([test "x$with_netfilter_conntrack" = "xyes" -a "x$with_cap" != "xyes"],[
2831 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
2832 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
2833 with_netfilter_conntrack=no
2835 AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack}])
2838 AC_ARG_ENABLE(zph-qos,
2839 AS_HELP_STRING([--disable-zph-qos],[Disable ZPH QOS support]), [
2840 SQUID_YESNO([$enableval],[--enable-zph-qos])
2842 SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
2843 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
2844 TOS field of HIT responses to help policing network traffic])
2845 AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
2846 AS_IF([test "x$enable_zph_qos" = "xyes"],[
2847 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
2848 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
2849 [Enable support for QOS netfilter mark preservation])
2852 AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
2855 SQUID_DETECT_UDP_SND_BUFSIZE
2856 SQUID_DETECT_UDP_RECV_BUFSIZE
2857 SQUID_DETECT_TCP_SND_BUFSIZE
2858 SQUID_DETECT_TCP_RECV_BUFSIZE
2860 SQUID_CHECK_NEED_SYS_ERRLIST
2861 SQUID_CHECK_MAXPATHLEN
2863 SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
2864 SQUID_CHECK_RESOLVER_FIELDS
2866 AC_CHECK_HEADERS(sys/statvfs.h)
2867 AS_IF([test "x$ac_cv_header_sys_statvfs_h" = "xyes"],[SQUID_CHECK_WORKING_STATVFS])
2868 AS_IF([test "x$ac_cv_func_statvfs" != "xyes"],[
2869 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/vfs.h sys/statfs.h)
2870 AC_CHECK_FUNCS(statfs)
2871 SQUID_CHECK_F_FRSIZE_IN_STATFS
2874 dnl Squid will not usually attempt to translate templates when building
2875 AC_ARG_ENABLE(translation,
2876 AS_HELP_STRING([--enable-translation],[Generate the localized error page templates and manuals.
2877 Which can also be downloaded from http://www.squid-cache.org/Versions/langpack/.]), [
2878 SQUID_YESNO([$enableval],[--enable-translation])
2880 AS_IF([test "x${enable_translation:=no}" = "xyes"],[
2881 AX_WITH_PROG([PO2HTML],[po2html])
2882 AX_WITH_PROG([PO2TEXT],[po2txt])
2889 AM_CONDITIONAL(ENABLE_TRANSLATION, test "x${enable_translation:=no}" = "xyes")
2891 dnl Squid now has limited locale handling ...
2893 AC_ARG_ENABLE(auto-locale,
2894 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
2895 clients request headers.
2896 When disabled Squid requires explicit language configuration.]), [
2897 SQUID_YESNO([$enableval],[--enable-auto-locale])
2899 AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
2900 SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
2901 [Use multi-language support on error pages])
2904 dnl Need the debugging version of malloc if available
2906 AS_IF([test "x$ac_cv_lib_malloc_main" = "xyes"],[
2907 AS_IF([test -r /usr/lib/debug/malloc.o],[XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"])
2908 AS_IF([test -r /usr/lib/debug/mallocmap.o],[XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"]);
2912 AS_IF([test "x$XTRA_LIBS" = "x"],[
2915 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
2920 AC_SUBST(SQUID_CFLAGS)
2921 AC_SUBST(SQUID_CXXFLAGS)
2923 # Prerequisite: CXXFLAGS have been finalized.
2924 AC_ARG_VAR([BUILDCXXFLAGS],[C++ compiler flags for building compile-time tools. e.g. cf_gen])
2925 AS_IF([test "x$BUILDCXXFLAGS" = "x"],[
2926 # if we are NOT cross-compiling, use the default build flags for cf_gen and friends
2927 # otherwise rely on the user-provided value
2928 AS_IF([test "x$squid_cv_check_marchnative" = "xyes"],[
2929 # always valid for the Build compiler.
2930 BUILDCXXFLAGS="-march=native"
2932 BUILDCXXFLAGS="$BUILDCXXFLAGS $CXXFLAGS"
2934 AC_SUBST(BUILDCXXFLAGS)
2936 AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
2937 AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
2938 AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
2939 AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
2940 AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
2941 AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
2942 AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
2943 AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
2944 AC_MSG_NOTICE([BUILD Tools C++ FLAGS: $BUILDCXXFLAGS])
2946 dnl Clean up after OSF/1 core dump bug
2954 doc/manuals/Makefile
2955 doc/release-notes/Makefile
2959 lib/libTrie/Makefile
2960 lib/libTrie/test/Makefile
2961 lib/ntlmauth/Makefile
2964 lib/snmplib/Makefile
2969 src/acl/external/Makefile
2970 src/acl/external/AD_group/Makefile
2971 src/acl/external/delayer/Makefile
2972 src/acl/external/eDirectory_userip/Makefile
2973 src/acl/external/file_userip/Makefile
2974 src/acl/external/kerberos_ldap_group/Makefile
2975 src/acl/external/kerberos_sid_group/Makefile
2976 src/acl/external/LDAP_group/Makefile
2977 src/acl/external/LM_group/Makefile
2978 src/acl/external/session/Makefile
2979 src/acl/external/SQL_session/Makefile
2980 src/acl/external/unix_group/Makefile
2981 src/acl/external/wbinfo_group/Makefile
2982 src/acl/external/time_quota/Makefile
2983 src/adaptation/Makefile
2984 src/adaptation/icap/Makefile
2985 src/adaptation/ecap/Makefile
2988 src/auth/basic/Makefile
2989 src/auth/basic/DB/Makefile
2990 src/auth/basic/fake/Makefile
2991 src/auth/basic/getpwnam/Makefile
2992 src/auth/basic/LDAP/Makefile
2993 src/auth/basic/NCSA/Makefile
2994 src/auth/basic/NIS/Makefile
2995 src/auth/basic/PAM/Makefile
2996 src/auth/basic/POP3/Makefile
2997 src/auth/basic/RADIUS/Makefile
2998 src/auth/basic/SASL/Makefile
2999 src/auth/basic/SMB/Makefile
3000 src/auth/basic/SMB_LM/Makefile
3001 src/auth/basic/SSPI/Makefile
3002 src/auth/digest/Makefile
3003 src/auth/digest/eDirectory/Makefile
3004 src/auth/digest/file/Makefile
3005 src/auth/digest/LDAP/Makefile
3006 src/auth/negotiate/Makefile
3007 src/auth/negotiate/kerberos/Makefile
3008 src/auth/negotiate/SSPI/Makefile
3009 src/auth/negotiate/wrapper/Makefile
3010 src/auth/ntlm/Makefile
3011 src/auth/ntlm/fake/Makefile
3012 src/auth/ntlm/SMB_LM/Makefile
3013 src/auth/ntlm/SSPI/Makefile
3015 src/clients/Makefile
3020 src/DiskIO/AIO/Makefile
3021 src/DiskIO/Blocking/Makefile
3022 src/DiskIO/DiskDaemon/Makefile
3023 src/DiskIO/DiskThreads/Makefile
3024 src/DiskIO/IpcIo/Makefile
3025 src/DiskIO/Mmapped/Makefile
3035 src/http/one/Makefile
3036 src/http/url_rewriters/Makefile
3037 src/http/url_rewriters/fake/Makefile
3038 src/http/url_rewriters/LFS/Makefile
3045 src/log/file/Makefile
3052 src/security/Makefile
3053 src/security/cert_generators/Makefile
3054 src/security/cert_generators/file/Makefile
3055 src/security/cert_validators/Makefile
3056 src/security/cert_validators/fake/Makefile
3057 src/servers/Makefile
3061 src/store/id_rewriters/Makefile
3062 src/store/id_rewriters/file/Makefile
3066 tools/apparmor/Makefile
3067 tools/helper-mux/Makefile
3068 tools/systemd/Makefile
3069 tools/sysvinit/Makefile
3072 # must configure libltdl subdir unconditionally for "make distcheck" to work
3073 #AC_CONFIG_SUBDIRS(libltdl)