1 ## Copyright (C) 1996-2016 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],[4.0.13-BZR],[http://bugs.squid-cache.org/],[squid])
10 AC_CONFIG_HEADERS([include/autoconf.h])
11 AC_CONFIG_AUX_DIR(cfgaux)
12 AC_CONFIG_SRCDIR([src/main.cc])
13 AM_INIT_AUTOMAKE([tar-ustar nostdinc subdir-objects])
14 AC_REVISION($Revision$)dnl
15 AC_PREFIX_DEFAULT(/usr/local/squid)
18 m4_include([acinclude/ax_with_prog.m4])
19 m4_include([acinclude/init.m4])
20 m4_include([acinclude/squid-util.m4])
21 m4_include([acinclude/compiler-flags.m4])
22 m4_include([acinclude/os-deps.m4])
23 m4_include([acinclude/krb5.m4])
24 m4_include([acinclude/pam.m4])
25 m4_include([acinclude/pkg.m4])
26 m4_include([acinclude/lib-checks.m4])
27 m4_include([acinclude/ax_cxx_compile_stdcxx_11.m4])
28 m4_include([acinclude/ax_cxx_0x_types.m4])
30 PRESET_CFLAGS="$CFLAGS"
31 PRESET_CXXFLAGS="$CXXFLAGS"
32 PRESET_LDFLAGS="$LDFLAGS"
34 dnl Set default LDFLAGS
35 if test "x$LDFLAGS" = "x" ; then
46 # Clang 3.2 on some CPUs requires -march-native to detect correctly.
47 # GCC 4.3+ can also produce faster executables when its used.
48 # But building inside a virtual machine environment has been found to
49 # cause random Illegal Instruction errors due to mis-detection of CPU.
50 AC_ARG_ENABLE(arch-native,
51 AS_HELP_STRING([--disable-arch-native],[Some compilers offer CPU-specific
52 optimizations with the -march=native parameter.
53 This flag disables the optimization. The default is to
54 auto-detect compiler support and use where available.]), [
55 SQUID_YESNO([$enableval],
56 [Unrecognized argument to --disable-arch-native: $enableval])
58 AC_MSG_NOTICE([CPU arch native optimization enabled: ${enable_arch_native:=auto}])
59 if test "x${enable_arch_native}" != "xno"; then
60 SQUID_CC_CHECK_ARGUMENT([squid_cv_check_marchnative],[-march=native])
63 # might be cross-compiling.
64 # NP: BUILDCXXFLAGS defined at the end of configure after CXXFLAGS fully known.
65 AC_ARG_VAR([BUILDCXX],[path to compiler for building compile-time tools. e.g. cf_gen])
66 if test "x$HOSTCXX" != "x" -a "x$BUILDCXX" = "x"; then
67 AC_MSG_WARN([Cross-compiling with HOSTCXX is deprecated. Uses BUILDCXX instead.])
70 if test "x$BUILDCXX" = "x"; then
72 if test "x$squid_cv_check_marchnative" = "xyes"; then
73 CXXFLAGS="$CXXFLAGS -march=native"
78 AC_MSG_CHECKING([simplified host os])
79 simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
80 squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
81 if test -n "$squid_host_os_version"; then
82 squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
84 squid_host_os="$simple_host_os"
86 AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
87 # on windows squid_host_os is either mingw or cygwin, version is 32
89 # this needs to be before any test is run, to have more standard
90 # functions available on some Unix sysems (e.g. Solaris)
91 if test "x$squid_host_os" = "solaris" -a "x$GCC" != "x" ; then
92 AC_USE_SYSTEM_EXTENSIONS
95 # If the user did not specify a C++ version.
96 user_cxx=`echo "$PRESET_CXXFLAGS" | grep -o -E "\-std="`
97 if test "x$user_cxx" = "x"; then
98 # Check for C++11 compiler support
99 AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
109 AC_PATH_PROG(SH, sh, /bin/sh)
110 AC_PATH_PROG(FALSE, false, /usr/bin/false)
111 AC_PATH_PROG(TRUE, true, /usr/bin/true)
112 AC_PATH_PROG(MV, mv, $FALSE)
113 AC_PATH_PROG(MKDIR, mkdir, $FALSE)
114 AC_PATH_PROG(LN, ln, cp)
115 AC_PATH_PROG(CHMOD, chmod, $FALSE)
116 AC_PATH_PROG(TR, tr, $FALSE)
117 AC_PATH_PROG(RM, rm, $FALSE)
118 dnl Libtool 2.2.6 requires: rm -f
123 AC_PATH_PROG(PERL, perl, none)
124 if test "x$ac_cv_path_PERL" = "xnone"; then
125 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
127 AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
128 AM_CONDITIONAL(ENABLE_POD2MAN_DOC, test "x${ac_cv_path_POD2MAN}" != "x$FALSE")
130 dnl set $(AR) if not provided by the build environment
131 if test "x$AR" = "x"; then
132 AC_PATH_PROG(AR, ar, $FALSE)
137 AC_PATH_PROG(LINUXDOC, linuxdoc, $FALSE)
138 AM_CONDITIONAL(ENABLE_RELEASE_DOCS, test "x${ac_cv_path_LINUXDOC}" != "x$FALSE")
140 # pre-define DEFAULT_PREFIX, some modules need it.
141 if test "${prefix}" = "NONE" ; then
142 squid_prefix=$ac_default_prefix
146 AC_DEFINE_UNQUOTED(DEFAULT_PREFIX,[$squid_prefix],[The install prefix])
148 AC_ARG_ENABLE(strict-error-checking,
149 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
150 with all possible static compiler error-checks enabled.
151 This flag disables the behavior]), [
152 SQUID_YESNO([$enableval],
153 [Unrecognized argument to --disable-strict-error-checking: $enableval])
155 AC_MSG_NOTICE([strict error checking enabled: ${enable_strict_error_checking:=yes}])
157 AC_MSG_CHECKING(whether to use loadable modules)
158 AC_ARG_ENABLE(loadable-modules,
159 AS_HELP_STRING([--disable-loadable-modules],[do not support loadable modules]) , [
160 SQUID_YESNO([$enableval],
161 [Unrecognized argument to --disable-loadable-modules: $enableval])
163 AM_CONDITIONAL(ENABLE_LOADABLE_MODULES, test "x${enable_loadable_modules:=yes}" = "xyes")
164 AC_MSG_RESULT([$enable_loadable_modules])
166 if test "x$enable_loadable_modules" = "xyes";
168 AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules])
174 # LT_INIT requires libtool v2, might as well state it loud
176 LT_INIT([dlopen],[disable-shared])
177 if ! test "${ac_top_build_prefix}" = "";
179 # LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
180 # But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
181 # This fixes Linux LTDLv3-v7, and BSD LTDL v2.2
182 top_build_prefix=${ac_top_build_prefix}
183 AC_SUBST(top_build_prefix)
187 dnl LibTool environment is now prepared for setup. Check that it is usable and initialize.
190 # Do we need these unconditionally for "make distcheck" to work?
194 if test "x$enable_loadable_modules" = "xyes";
196 # Why is this needed? Should not LT_INIT (or LT_LIB_DLLOAD) from libtool do that?
197 LIBADD_DL=${lt_cv_dlopen_libs}
198 AC_SUBST([LIBADD_DL])
201 SQUID_CC_GUESS_VARIANT
202 SQUID_CC_GUESS_OPTIONS
204 dnl find out the exe extension for this platform.
205 dnl If it is not empty, use it for CGI as well.
209 if test "x$EXEEXT" = "x" ; then
212 # automake automatically adds .exe when installing binaries
217 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,[test "x$squid_host_os" = "xmingw"])
218 AM_CONDITIONAL(ENABLE_WIN32_IPC,[test "x$squid_host_os" = "xmingw"])
220 case "$squid_host_os" in
222 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
223 CFLAGS="$CFLAGS -mthreads"
224 CXXFLAGS="$CXXFLAGS -mthreads -static-libgcc -static-libstdc++"
225 if test "x$ac_cv_path_WIN32_PSAPI" = "xnone"; then
226 AC_MSG_NOTICE([PSAPI.DLL is recommended to run Squid on Windows NT Platform])
227 AC_MSG_NOTICE([Please see PSAPI.DLL section on doc/win32-relnotes.html.])
229 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
232 MINGW_LIBS="-lmingwex"
236 # FreeBSD places local libraries and packages in /usr/local
237 CFLAGS="$CFLAGS -I/usr/local/include"
238 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
239 LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-R/usr/local/lib"
246 AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
248 AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args",
249 [configure command line used to configure Squid])
251 CACHE_EFFECTIVE_USER="nobody"
252 AC_ARG_WITH(default-user,
253 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
254 [ CACHE_EFFECTIVE_USER="$withval" ]
256 AC_SUBST(CACHE_EFFECTIVE_USER)
258 DEFAULT_LOG_DIR="$localstatedir/logs"
260 AS_HELP_STRING([--with-logdir=PATH],
261 [Default location for squid logs. default: PREFIX/var/logs]), [
264 AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH )
267 DEFAULT_LOG_DIR="$withval"
272 AC_SUBST(DEFAULT_LOG_DIR)
274 DEFAULT_PID_FILE="$localstatedir/run/@SERVICE_NAME@.pid"
276 AS_HELP_STRING([--with-pidfile=PATH],
277 [Default location for squid pid file. Default: PREFIX/var/run/squid.pid]), [
280 AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH )
283 DEFAULT_PID_FILE="$withval"
287 AC_SUBST(DEFAULT_PID_FILE)
289 DEFAULT_SWAP_DIR="$localstatedir/cache/squid"
291 AS_HELP_STRING([--with-swapdir=PATH],
292 [Default location for squid cache directories. Default: PREFIX/var/cache/squid]), [
295 AC_MSG_ERROR( --with-swapdir requires a directory PATH. --with-swapdir=PATH )
298 DEFAULT_SWAP_DIR="$withval"
302 AC_SUBST(DEFAULT_SWAP_DIR)
304 dnl Set Default CFLAGS
305 if test "x$PRESET_CFLAGS" = "x"; then
306 if test "$squid_cv_compiler" = "gcc"; then
309 # sunos has too many warnings for this to be useful
313 # Motorola cc/ld does not like -02 but is ok on -O
314 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
317 CFLAGS="$squid_cv_cc_option_wall $CFLAGS"
323 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
324 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
325 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
326 -Wl,-woff,85,-woff,84,-woff,134 \
327 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
328 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
329 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
330 -Wl,-woff,85,-woff,84,-woff,134 \
331 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
339 dnl set squid required flags
340 if test "$squid_cv_compiler" = "gcc"; then
341 case "$squid_host_os" in
343 dnl Guido Serassio (serassio@squid-cache.org) 20070811
344 dnl Using the latest MinGW (gcc 3.4.5 + mingw-runtime 3.13) cannot build with
345 dnl -Werror -Wmissing-prototypes -Wmissing-declarations
346 dnl TODO: check if the problem will be present in any other newer MinGW release.
347 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow"
350 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow"
353 SQUID_CXXFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual"
359 dnl CentOS (and RHEL) still define ntohs() using deprecated C++ features
360 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_wno_deprecated_register],[-Werror -Wno-deprecated-register],[[#include <arpa/inet.h>]],[[int fox=ntohs(1);]])
362 if test "x$enable_strict_error_checking" != "xno"; then
363 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
364 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
367 if test "x$ac_cv_require_wno_deprecated_register" = "xyes"; then
368 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -Wno-deprecated-register"
371 # squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
372 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
373 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
375 # possibly include some build info tag into squid -v
376 SQUID_EMBED_BUILD_INFO
378 AC_ARG_ENABLE(optimizations,
379 AS_HELP_STRING([--disable-optimizations],
380 [Do not compile Squid with compiler optimizations enabled.
381 Optimization is good for production builds, but not
382 good for debugging. During development, use
383 --disable-optimizations to reduce compilation times
384 and allow easier debugging. This option implies
385 --disable-inline]), [
386 if test "x$enableval" = "xno" ; then
387 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
388 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
389 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9g]]*//'`"
394 AH_TEMPLATE(_USE_INLINE_,[Include inline methods into header file])
395 AC_ARG_ENABLE(inline,
396 AS_HELP_STRING([--disable-inline],
397 [Do not compile trivial methods as inline. Squid
398 is coded with much of the code able to be inlined.
399 Inlining is good for production builds, but not
400 good for development. During development, use
401 --disable-inline to reduce compilation times and
402 allow incremental builds to be quick. For
403 production builds, or load tests, use
404 --enable-inline to have squid make all trivial
405 methods inlinable by the compiler.]), [
406 SQUID_YESNO([$enableval],
407 [Unrecognized argument to --disable-inline: $enableval])
409 AC_MSG_NOTICE([inlining optimizations enabled: ${enable_inline:=yes}])
410 SQUID_DEFINE_BOOL(_USE_INLINE_,$enable_inline,
411 [Include inline methods into header file])
412 # to be used by sub-commands
415 AC_ARG_ENABLE(debug-cbdata,
416 AS_HELP_STRING([--enable-debug-cbdata],
417 [Provide some debug information in cbdata]), [
418 SQUID_YESNO([$enableval],
419 [unrecognized argument to --enable-debug-cbdata: $enableval])
421 SQUID_DEFINE_BOOL(USE_CBDATA_DEBUG,${enable_debug_cbdata:=no},
422 [Enable support for cbdata debug information])
423 AC_MSG_NOTICE([cbdata debugging enabled: $enable_debug_cbdata])
426 dnl Nasty hack to get autoconf 2.64 on Linux to run.
427 dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
428 AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[:])
430 AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
431 AC_ARG_ENABLE(xmalloc-statistics,
432 AS_HELP_STRING([--enable-xmalloc-statistics],
433 [Show malloc statistics in status page]), [
434 SQUID_YESNO([$enableval],
435 [unrecognized argument to --enable-xmalloc-statistics: $enableval])
437 SQUID_DEFINE_BOOL(XMALLOC_STATISTICS,${enable_xmalloc_statistics:=no},
438 [Show malloc statistics in status page])
439 AC_MSG_NOTICE([xmalloc stats display: $enable_xmalloc_statistics])
441 squid_opt_aufs_threads=""
442 AC_ARG_WITH(aufs-threads,
443 AS_HELP_STRING([--with-aufs-threads=N_THREADS],
444 [Tune the number of worker threads for the aufs object store.]), [
447 squid_opt_aufs_threads=$withval
450 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
454 if test "x$squid_opt_aufs_threads" != "x"; then
455 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
456 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
457 [Defines how many threads aufs uses for I/O])
460 AC_ARG_WITH(dl, AS_HELP_STRING([--with-dl],[Use dynamic linking]))
461 if test "x$with_dl" = "xyes"; then
462 AC_MSG_NOTICE([With dl])
465 ## check for atomics library before anything that might need it
466 # AC_SEARCH_LIBS pollutes LIBS
467 SQUID_STATE_SAVE(LIBATOMIC)
468 AC_SEARCH_LIBS([__atomic_load_8],[atomic],[
469 test "$ac_res" = "none required" || ATOMICLIB=$ac_res],[])
470 SQUID_STATE_ROLLBACK(LIBATOMIC)
473 AC_SEARCH_LIBS([shm_open], [rt])
474 if test "x$ac_cv_search_shm_open" != "xno" ; then
475 AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
478 AC_MSG_CHECKING([for DiskIO modules to be enabled])
479 squid_disk_module_candidates=""
480 squid_opt_enable_diskio="auto" #values: no, yes, "auto"(=yes+detect modules)
481 AC_ARG_ENABLE(disk-io,
482 AS_HELP_STRING([--enable-disk-io="list of modules"],
483 [Build support for the list of disk I/O modules.
484 Set without a value or omitted, all available modules will be built.
485 See src/DiskIO for a list of available modules, or
486 Programmers Guide section on DiskIO
487 for details on how to build your custom disk module]), [
491 #do nothing, "auto" is ok
494 squid_opt_enable_diskio="no"
497 squid_opt_enable_diskio="yes"
498 squid_disk_module_candidates=" `echo $enableval| sed -e 's/,/ /g;s/ */ /g'` "
499 SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
504 # if requested to autodetect, find out what we have
505 if test "x$squid_opt_enable_diskio" = "xauto"; then
506 squid_opt_enable_diskio="yes"
507 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
508 if test "x$ac_cv_search_shm_open" = "xno" ; then
510 squid_disk_module_candidates=`echo $squid_disk_module_candidates|sed 's/IpcIo//'`
514 AC_MSG_RESULT([${squid_disk_module_candidates:-none}])
515 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
516 SQUID_DEFINE_BOOL(USE_DISKIO,$squid_opt_enable_diskio,
517 [DiskIO modules are expected to be available.])
521 dnl Some autoconf.h defines we might enable later...
522 AC_ARG_WITH(pthreads,AS_HELP_STRING([--without-pthreads],[Disable POSIX Threads]))
523 AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO. Default: auto-detect]))
526 squid_opt_use_diskthreads=
529 dnl Setup the module paths etc.
532 AH_TEMPLATE(HAVE_DISKIO_MODULE_AIO, [Whether POSIX AIO Disk I/O module is built])
533 AH_TEMPLATE(HAVE_DISKIO_MODULE_BLOCKING, [Whether Blocking Disk I/O module is built])
534 AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKDAEMON, [Whether DiskDaemon Disk I/O module is built])
535 AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKTHREADS, [Whether DiskThreads Disk I/O module is built])
536 AH_TEMPLATE(HAVE_DISKIO_MODULE_IPCIO, [Whether IpcIo Disk I/O module is built])
537 AH_TEMPLATE(HAVE_DISKIO_MODULE_MMAPPED, [Whether Mmapped Disk I/O module is built])
538 for module in $squid_disk_module_candidates none; do
540 if test "x$module" = "xnone"; then
543 if ! test -d "$srcdir/src/DiskIO/$module"; then
544 AC_MSG_ERROR(disk-io $module does not exist)
549 dnl Check for POSIX AIO availability
550 squid_opt_use_aio="yes"
552 if test "x$with_aio" != "xno"; then
554 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
555 dnl On some systems POSIX AIO functions are in librt
556 dnl On some systems POSIX AIO functions are in libaio
557 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
558 dnl Enable AIO if the library and headers are found
559 if test "x$AIOLIB" != "x" && test "x$have_aio_header" = "xyes"; then
560 AC_MSG_NOTICE([Native POSIX AIO support detected.])
561 squid_opt_use_aio="yes"
563 dnl Windows does things differently. We provide wrappers.
564 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
565 case "$squid_host_os" in
567 squid_opt_use_aio="yes"
568 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
571 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
572 squid_opt_use_aio="no"
577 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
578 squid_opt_use_aio="no"
580 dnl Use the POSIX AIO pieces if we actually need them.
581 if test "x$squid_opt_use_aio" = "xyes" ; then
582 DISK_MODULES="$DISK_MODULES AIO"
583 AC_DEFINE([HAVE_DISKIO_MODULE_AIO],1,[POSIX AIO Disk I/O module is built])
584 case "$squid_host_os" in
587 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
590 AC_MSG_NOTICE([Enabling AIO DiskIO module])
594 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
595 squid_disk_module_candidates_AIO=no
600 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
601 DISK_MODULES="$DISK_MODULES Blocking"
602 AC_DEFINE([HAVE_DISKIO_MODULE_BLOCKING],1,[Blocking Disk I/O module is built])
606 case "$squid_host_os" in
608 AC_MSG_NOTICE(["DiskDaemon not supported on MinGW"])
609 squid_disk_module_candidates_DiskDaemon=no
612 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
613 DISK_MODULES="$DISK_MODULES DiskDaemon"
614 AC_DEFINE([HAVE_DISKIO_MODULE_DISKDAEMON],1,[DiskDaemon Disk I/O module is built])
620 squid_opt_use_diskthreads="yes"
622 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
623 if test "x$with_pthreads" != "xno"; then
624 dnl TODO: this needs to be extended to handle more systems and better
625 dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
626 dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
627 case "$squid_host_os" in
630 AC_MSG_NOTICE([Windows threads support automatically enabled])
633 if test `echo "$squid_host_os_version" | tr -d .` -lt 70 ; then
634 AC_MSG_NOTICE(pthread library requires FreeBSD 7 or later)
635 squid_opt_use_diskthreads="no"
637 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
638 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
639 if test "x$GCC" = "xyes" -a "x$PRESET_LDFLAGS" = "x" ; then
640 LDFLAGS="$LDFLAGS -pthread"
645 if test `echo "$squid_host_os_version" | tr -d .` -lt 52 ; then
646 AC_MSG_NOTICE(pthread library requires OpenBSD 5.2 or later)
647 squid_opt_use_diskthreads="no"
649 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
650 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
651 LDFLAGS="$LDFLAGS -lpthread"
655 if test "x$GCC" = "xyes" ; then
656 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
657 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
658 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
659 AC_MSG_NOTICE(pthread library required but cannot be found.)
660 squid_opt_use_diskthreads="no"
663 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
664 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
665 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
666 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
667 LIBPTHREADS="" #in LIBS
669 AC_MSG_NOTICE(pthread library required but cannot be found.)
670 squid_opt_use_diskthreads="no"
675 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
676 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
677 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
678 AC_MSG_NOTICE(pthread library required but cannot be found.)
679 squid_opt_use_diskthreads="no"
684 AC_MSG_NOTICE([Native pthreads support manually disabled.])
685 squid_opt_use_diskthreads="no"
687 if test "x$squid_opt_use_diskthreads" = "xyes" ; then
688 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
689 DISK_MODULES="$DISK_MODULES DiskThreads"
690 AC_DEFINE([HAVE_DISKIO_MODULE_DISKTHREADS],1,[DiskThreads Disk I/O module is built])
692 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
693 SQUID_STATE_ROLLBACK([diskthreads_state])
694 squid_disk_module_candidates_DiskThreads=no
699 if test "x$ac_cv_search_shm_open" = "xno" ; then
700 AC_MSG_NOTICE([DiskIO IpcIo module requires shared memory support])
701 squid_disk_module_candidates_IpcIo=no
703 AC_MSG_NOTICE([Enabling IpcIo DiskIO module])
704 DISK_MODULES="$DISK_MODULES IpcIo"
705 AC_DEFINE([HAVE_DISKIO_MODULE_IPCIO],1,[IpcIo Disk I/O module is built])
710 dnl TODO: use availability of sys/mman.h and/or mmap to define
711 dnl OR support windows mmap functions
712 if test "x$squid_host_os" = "xmingw" ; then
713 AC_MSG_NOTICE([Mmapped DiskIO is not available on Mingw])
714 squid_disk_module_candidates_Mmapped=no
716 AC_MSG_NOTICE([Enabling Mmapped DiskIO module])
717 DISK_MODULES="$DISK_MODULES Mmapped"
718 AC_DEFINE([HAVE_DISKIO_MODULE_MMAPPED],1,[Mmapped Disk I/O module is built])
723 AC_MSG_NOTICE([Enabling $module DiskIO module])
724 DISK_LIBS="$DISK_LIBS lib${module}.la"
725 DISK_MODULES="$DISK_MODULES ${module}"
729 AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
730 AC_SUBST(DISK_MODULES)
732 AM_CONDITIONAL(ENABLE_DISKIO_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes")
734 AM_CONDITIONAL(ENABLE_WIN32_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes" -a "x$ENABLE_WIN32_AIO" = "x1")
735 AM_CONDITIONAL(ENABLE_DISKIO_BLOCKING, test "x$squid_disk_module_candidates_Blocking" = "xyes")
736 AM_CONDITIONAL(ENABLE_DISKIO_DISKDAEMON, test "x$squid_disk_module_candidates_DiskDaemon" = "xyes")
737 AM_CONDITIONAL(ENABLE_DISKIO_DISKTHREADS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes")
738 AC_SUBST(LIBPTHREADS)
739 AM_CONDITIONAL(ENABLE_WIN32_AIOPS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes" -a "x$ENABLE_WIN32_AIOPS" = "x1")
740 AM_CONDITIONAL(ENABLE_DISKIO_IPCIO, test "x$squid_disk_module_candidates_IpcIo" = "xyes")
741 AM_CONDITIONAL(ENABLE_DISKIO_MMAPPED, test "x$squid_disk_module_candidates_Mmapped" = "xyes")
743 dnl Check what Storage formats are wanted.
744 dnl This version will error out with a message saying why if a required DiskIO is missing.
745 squid_opt_enable_storeio=auto
746 AC_ARG_ENABLE([storeio],
747 AS_HELP_STRING([--enable-storeio="list of modules"],
748 [Build support for the list of store I/O modules.
749 The default is only to build the "ufs" module.
750 See src/fs for a list of available modules, or
751 Programmers Guide section <not yet written>
752 for details on how to build your custom store module]), [
755 squid_opt_enable_storeio=auto
758 squid_opt_enable_storeio=no
761 squid_opt_enable_storeio=yes
762 squid_storeio_module_candidates="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
763 # ufs is really always needed as it has low-level routines
764 # if it is a dupe it will be cleaned-up later
765 squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
769 if test "x$squid_opt_enable_storeio" = "xauto"; then
770 squid_opt_enable_storeio=yes
771 AC_MSG_CHECKING([for available StoreIO modules])
772 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
773 AC_MSG_RESULT([$squid_storeio_module_candidates])
776 SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
777 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
778 AC_MSG_NOTICE([Store modules built: $squid_storeio_module_candidates])
780 for fs in $squid_storeio_module_candidates none; do
783 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
784 "$squid_disk_module_candidates_DiskDaemon" != "yes" ; then
785 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
789 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
790 "$squid_disk_module_candidates_DiskThreads" != "yes" ; then
791 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
795 if test "x$squid_disk_module_candidates_IpcIo" != "xyes" -a \
796 "x$squid_disk_module_candidates_Blocking" != "xyes"; then
797 AC_MSG_ERROR([Storage module Rock requires DiskIO module: Blocking or IpcIo])
799 squid_do_build_rock=true
802 if test "x$squid_disk_module_candidates_Blocking" != "xyes"; then
803 AC_MSG_ERROR([Storage module ufs requires DiskIO module: Blocking])
805 squid_do_build_ufs=true
810 AM_CONDITIONAL(ENABLE_FS_UFS, test "x$squid_do_build_ufs" = "xtrue")
811 AM_CONDITIONAL(ENABLE_FS_ROCK, test "x$squid_do_build_rock" = "xtrue")
812 dnl hack: need to define those even if not used in the build system to
813 dnl make sure that global FS objects are linked to the squid binary.
814 AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
815 AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
816 AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
817 AH_TEMPLATE(HAVE_FS_ROCK, "Define to 1 if rock filesystem module is build")
820 dnl got final squid_storeio_module_candidates, build library lists
821 dnl This list will not be needed when each fs library has its own Makefile
823 dnl File system libraries to link executables with.
824 dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
826 for fs in $squid_storeio_module_candidates; do
827 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
828 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
829 SQUID_TOUPPER_VAR_CONTENTS([fs])
830 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
833 AC_SUBST(STORE_LIBS_TO_BUILD)
834 AC_SUBST(STORE_LIBS_TO_ADD)
835 AC_SUBST(STORE_TESTS)
838 dnl At lest one removal policy is always needed.
839 dnl 'lru' removal policy is currently hard-coded by name for tests
840 dnl so we must set it as default.
842 AC_ARG_ENABLE(removal-policies,
843 AS_HELP_STRING([--enable-removal-policies="list of policies"],
844 [Build support for the list of removal policies.
845 The default is only to build the "lru" module.
846 See src/repl for a list of available modules, or
847 Programmers Guide section 9.9 for details on how
848 to build your custom policy]), [
851 SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES])
856 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
860 if test "x$REPL_POLICIES" != "x" ; then
861 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
862 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
863 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
864 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
866 AC_SUBST(REPL_POLICIES)
870 AM_CONDITIONAL(ENABLE_PINGER, false)
872 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),
873 [ if test "x$enableval" = "xyes" ; then
874 AC_MSG_NOTICE([ICMP enabled])
875 AC_DEFINE(USE_ICMP,1,[Define to use Squid ICMP and Network Measurement features (highly recommended!)])
876 AM_CONDITIONAL(ENABLE_PINGER, true)
880 AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
881 AC_ARG_ENABLE(delay-pools,
882 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),
883 [ if test "x$enableval" = "xyes" ; then
884 AC_MSG_NOTICE([Delay pools enabled])
885 AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
886 AM_CONDITIONAL(ENABLE_DELAY_POOLS, true)
890 dnl disable generic/common adaptation support by default
891 squid_opt_use_adaptation=no
893 squid_opt_use_esi=yes
894 AH_TEMPLATE([USE_SQUID_ESI],
895 [Define to enable the ESI processor and Surrogate header support])
897 AS_HELP_STRING([--enable-esi],
898 [Enable ESI for accelerators. Benefits from expat or libxml2.
899 Enabling ESI will cause squid reverse proxies to be capable
900 of the Edge Acceleration Specification (www.esi.org).]),
901 [squid_opt_use_esi=$enableval], [squid_opt_use_esi=no])
906 if test "x$squid_opt_use_esi" = "xyes" ; then
907 AC_MSG_NOTICE([Enabling ESI processor and Surrogate header support.])
908 AC_DEFINE(USE_SQUID_ESI,1,
909 [Compile the ESI processor and Surrogate header support])
911 AC_MSG_NOTICE([Disabling ESI processor])
914 # ESI support libraries: expat
915 AC_ARG_WITH(expat, AS_HELP_STRING([--without-expat],[Do not use expat for ESI. Default: auto-detect]))
916 if test "x$squid_opt_use_esi" = "xyes" -a "x$with_expat" != "xno" ; then
917 AC_CHECK_LIB([expat], [main], [EXPATLIB="-lexpat"; HAVE_LIBEXPAT=1])
918 AC_CHECK_HEADERS([expat.h])
919 AC_DEFINE_UNQUOTED(HAVE_LIBEXPAT, $HAVE_LIBEXPAT, [Define to 1 if you have the expat library])
920 if test "x$with_expat" = "xyes" -a "x$HAVE_LIBEXPAT" != "x1" ; then
921 AC_MSG_ERROR([Required library expat is not able to be found.])
925 AC_ARG_WITH(libxml2, AS_HELP_STRING([--without-libxml2],[Do not use libxml2 for ESI. Default: auto-detect]))
926 if test "x$squid_opt_use_esi" = "xyes" -a "x$with_libxml2" != "xno" ; then
927 AC_CHECK_LIB([xml2], [main], [XMLLIB="-lxml2"; HAVE_LIBXML2=1])
928 dnl Find the main header and include path...
929 AC_CACHE_CHECK([location of libxml2 include files], [ac_cv_libxml2_include], [
930 AC_CHECK_HEADERS([libxml/parser.h], [], [
931 AC_MSG_NOTICE([Testing in /usr/include/libxml2])
932 SAVED_CPPFLAGS="$CPPFLAGS"
933 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
934 unset ac_cv_header_libxml_parser_h
935 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/include/libxml2"], [
936 AC_MSG_NOTICE([Testing in /usr/local/include/libxml2])
937 CPPFLAGS="-I/usr/local/include/libxml2 $SAVED_CPPFLAGS"
938 unset ac_cv_header_libxml_parser_h
939 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/local/include/libxml2"], [
940 AC_MSG_NOTICE([Failed to find libxml2 header file libxml/parser.h])
943 CPPFLAGS="$SAVED_CPPFLAGS"
946 if test "x$ac_cv_libxml2_include" != "x"; then
947 SQUID_CXXFLAGS="$ac_cv_libxml2_include $SQUID_CXXFLAGS"
948 CPPFLAGS="$ac_cv_libxml2_include $CPPFLAGS"
950 dnl Now that we know where to look find the headers...
951 AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
952 AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
953 if test "x$with_libxml2" = "xyes" -a "$HAVE_LIBXML2" != "1" ; then
954 AC_MSG_ERROR([Required library libxml2 is not able to be found.])
958 AM_CONDITIONAL(ENABLE_ESI, test "x$squid_opt_use_esi" = "xyes")
959 AM_CONDITIONAL(ENABLE_LIBEXPAT, test "$HAVE_LIBEXPAT" = 1)
961 AM_CONDITIONAL(ENABLE_LIBXML2, test "$HAVE_LIBXML2" = 1)
964 # icap argument handling
965 AC_ARG_ENABLE(icap-client,
966 AS_HELP_STRING([--disable-icap-client],[Disable the ICAP client.]),[
967 SQUID_YESNO([$enableval],[Unrecognized argument to --disable-icap-client: $enableval])
969 SQUID_DEFINE_BOOL(ICAP_CLIENT,${enable_icap_client:=yes}, [Enable ICAP client features in Squid])
970 AS_IF(test "x$enable_icap_client" != "xno", squid_opt_use_adaptation="yes")
971 AM_CONDITIONAL(ENABLE_ICAP_CLIENT, test "x$enable_icap_client" != "xno")
974 AC_MSG_CHECKING(whether to support eCAP)
976 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]), [
977 case "${enableval}" in
978 yes|no) squid_opt_use_ecap=$enableval ;;
979 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
981 AC_MSG_RESULT([$squid_opt_use_ecap, explicitly])
983 squid_opt_use_ecap=no;
984 AC_MSG_RESULT([$squid_opt_use_ecap, implicitly])
988 dnl Perform configuration consistency checks for eCAP
989 if test "x$squid_opt_use_ecap" != "xno";
991 dnl eCAP support requires loadable modules, which are enabled by default
992 if test "x$enable_loadable_modules" != "xyes"
994 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.])
997 if test -n "$PKG_CONFIG"; then
998 dnl eCAP support requires libecap.
999 dnl This Squid supports libecap v1.0.x.
1000 dnl Use EXT_ prefix to distinguish external libecap (that we check for
1001 dnl here) from our own convenience ecap library in Makefiles.
1002 PKG_CHECK_MODULES([EXT_LIBECAP],[libecap >= 1.0 libecap < 1.1])
1004 AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
1007 SQUID_STATE_SAVE(squid_ecap_state)
1008 AC_MSG_CHECKING([whether -lecap will link])
1009 CXXFLAGS="$CXXFLAGS $EXT_LIBECAP_CFLAGS"
1010 LIBS="$LIBS $EXT_LIBECAP_LIBS"
1011 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libecap/common/names.h>]],[[
1012 const libecap::Name test("test", libecap::Name::NextId());
1015 squid_opt_use_adaptation=yes
1019 test "x$squid_opt_use_ecap" = "xyes", AC_MSG_ERROR([eCAP library will not link.
1020 You may need to rebuild libecap using the same version of GCC as Squid.
1021 There have been breaking ABI changes in the libstdc++ STL with GCC 5.]),
1023 [AC_MSG_NOTICE([eCAP library will not link.
1024 You may need to rebuild libecap using the same version of GCC as Squid.
1025 There have been breaking ABI changes in the libstdc++ STL with GCC 5.])
1026 squid_opt_use_ecap="no"
1029 SQUID_STATE_ROLLBACK(squid_ecap_state)
1031 SQUID_DEFINE_BOOL(USE_ECAP,${squid_opt_use_ecap:=no},[Whether to use eCAP support])
1032 AM_CONDITIONAL(ENABLE_ECAP, test "x$squid_opt_use_ecap" = "xyes")
1034 dnl enable adaptation if requested by specific adaptation mechanisms
1036 if test "x$squid_opt_use_adaptation" = "xyes"; then
1037 ADAPTATION_LIBS="adaptation/libadaptation.la"
1039 SQUID_DEFINE_BOOL(USE_ADAPTATION,${squid_opt_use_adaptation:=no}, [common adaptation support])
1040 AM_CONDITIONAL(ENABLE_ADAPTATION, test "x$squid_opt_use_adaptation" = "xyes")
1041 AC_SUBST(ADAPTATION_LIBS)
1043 test "x$squid_host_os" = "xmingw" && enable_wccp=no
1045 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]), [
1046 SQUID_YESNO([$enableval],[unrecognized argument to --disable-wccp: $enableval])
1048 SQUID_DEFINE_BOOL(USE_WCCP, ${enable_wccp:=yes}, [Define to enable WCCP])
1049 AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $enable_wccp])
1051 test "x$squid_host_os" = "xmingw" && enable_wccpv2=no
1052 AC_ARG_ENABLE(wccpv2,
1053 AS_HELP_STRING([--disable-wccpv2],
1054 [Disable Web Cache Coordination V2 Protocol]), [
1055 SQUID_YESNO([$enableval],
1056 [unrecognized argument to --disable-wccpv2: $enableval])
1058 SQUID_DEFINE_BOOL(USE_WCCPv2,${enable_wccpv2:=yes},
1059 [Define to enable WCCP V2])
1060 AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $enable_wccpv2])
1062 AC_ARG_ENABLE(kill-parent-hack,
1063 AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]), [
1064 SQUID_YESNO([$enableval],
1065 [unrecognized argument to --enable-kill-parent-hack: $enableval])
1067 SQUID_DEFINE_BOOL(KILL_PARENT_OPT,${enable_kill_parent_hack:=no},
1068 [A dangerous feature which causes Squid to kill its parent
1069 process (presumably the RunCache script) upon receipt
1070 of SIGTERM or SIGINT. Deprecated, Use with caution.])
1071 AC_MSG_NOTICE([Kill parent on shutdown hack enabled: $enable_kill_parent_hack])
1074 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
1075 SQUID_YESNO([$enableval],
1076 [unrecognized argument to --disable-snmp: $enableval])
1078 SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes},
1079 [Define to enable SNMP monitoring of Squid])
1080 AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
1081 if test "x$enable_snmp" = "xyes"; then
1082 SNMPLIB='../lib/snmplib/libsnmplib.la'
1084 AC_MSG_NOTICE([SNMP support enabled: $enable_snmp])
1087 AC_ARG_ENABLE(cachemgr-hostname,
1088 AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
1089 [Make cachemgr.cgi default to this host.
1090 If unspecified, uses the name of the build-host]), [
1093 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1094 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
1095 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
1101 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
1102 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
1108 AS_HELP_STRING([--disable-eui],
1109 [Disable use of ARP / MAC/ EUI (ether address)]), [
1110 SQUID_YESNO([$enableval],[--disable-eui expects no arguments])
1112 if test "x${enable_eui:=yes}" = "xyes" ; then
1113 case "$squid_host_os" in
1114 linux|solaris|freebsd|openbsd|netbsd|cygwin)
1121 AC_MSG_WARN([EUI support probably will not work on host $host.])
1124 # iphlpapi.h check delayed after winsock2.h
1139 #include <sys/types.h>
1140 #include <sys/socket.h>
1143 # OpenBSD, FreeBSD and NetBSD requires sys/param.h to be included before sysctl.h and net/if_dl.h
1148 #if HAVE_SYS_PARAM_H
1149 #include <sys/param.h>
1154 AC_MSG_NOTICE([EUI (MAC address) controls enabled: $enable_eui])
1155 SQUID_DEFINE_BOOL(USE_SQUID_EUI,$enable_eui,
1156 [Define this to include code which lets you use ethernet addresses. This code uses API initially defined in 4.4-BSD.])
1157 AM_CONDITIONAL(ENABLE_EUI, [test "x$enable_eui" = "xyes" ])
1161 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]), [
1162 SQUID_YESNO([$enableval],
1163 [unrecognized argument to --disable-htcp: $enableval])
1165 SQUID_DEFINE_BOOL(USE_HTCP,${enable_htcp:=yes},
1166 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
1167 AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
1168 AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
1170 # Cryptograhic libraries
1172 AS_HELP_STRING([--without-nettle],[Compile without the Nettle crypto library.]),[
1173 case "$with_nettle" in
1175 : # Nothing special to do here
1178 if test ! -d "$withval" ; then
1179 AC_MSG_ERROR([--with-nettle path does not point to a directory])
1181 NETTLELIBDIR="-L$with_nettle/lib"
1182 CPPFLAGS="-I$with_nettle/include $CPPFLAGS"
1186 if test "x$with_nettle" != "xno" ; then
1187 AC_CHECK_LIB(nettle, nettle_md5_init,[
1188 NETTLELIB="$NETTLELIBDIR -lnettle"
1189 AC_CHECK_HEADERS(nettle/md5.h)
1191 if test "x$with_nettle" != "xno" ; then
1192 # Base64 uses the nettle 3.0 API
1193 # which matters on 64-bit systems
1194 AC_CHECK_HEADERS(nettle/base64.h)
1195 AC_MSG_CHECKING([for Nettle 3.0 API compatibility])
1196 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1199 # include <nettle/base64.h>
1201 uint8_t inData[10]; inData[0] = '\0';
1203 struct base64_decode_ctx ctx;
1204 base64_decode_init(&ctx);
1205 uint8_t outData[10];
1207 if (!base64_decode_update(&ctx, &dstLen, outData, srcLen, inData) ||
1208 !base64_decode_final(&ctx)) {
1211 ]])],[AC_MSG_RESULT(yes)
1212 AC_DEFINE(HAVE_NETTLE30_BASE64,1,[set to 1 if Nettle 3.0 API will link])
1213 ],[AC_MSG_RESULT(no)])
1216 AC_MSG_NOTICE([Using Nettle cryptographic library: ${with_nettle:=yes}])
1219 dnl Check for libcrypt
1221 dnl Some of our helpers use crypt(3) which may be in libc, or in
1222 dnl libcrypt (eg FreeBSD)
1223 AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
1224 dnl Solaris10 provides MD5 natively through libmd5
1225 AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
1230 dnl User may want to disable GnuTLS
1232 AS_HELP_STRING([--without-gnutls],
1233 [Do not use GnuTLS for SSL. Default: auto-detect]), [
1234 case "$with_gnutls" in
1236 : # Nothing special to do here
1239 if test ! -d "$withval" ; then
1240 AC_MSG_ERROR([--with-gnutls path does not point to a directory])
1242 LIBGNUTLS_PATH="-L$with_gnutls/lib"
1243 CPPFLAGS="-I$with_gnutls/include $CPPFLAGS"
1246 AH_TEMPLATE(USE_GNUTLS,[GnuTLS support is available])
1247 if test "x$with_gnutls" != "xno"; then
1248 SQUID_STATE_SAVE(squid_gnutls_state)
1250 # User may have provided a custom location for GnuTLS. Otherwise...
1251 LIBS="$LIBS $LIBGNUTLS_PATH"
1253 # auto-detect using pkg-config
1254 PKG_CHECK_MODULES([LIBGNUTLS],[gnutls >= 3.1.5],[
1255 CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
1257 ## find the package without pkg-config
1258 ## check that the library is actually new enough.
1259 ## by testing for a 3.1.5+ function which we use
1260 AC_CHECK_LIB(gnutls,gnutls_certificate_verify_peers3,[LIBGNUTLS_LIBS="-lgnutls"])
1262 AC_CHECK_HEADERS(gnutls/gnutls.h gnutls/x509.h)
1264 SQUID_STATE_ROLLBACK(squid_gnutls_state) #de-pollute LIBS
1266 if test "x$with_gnutls" = "xyes" -a "x$LIBGNUTLS_LIBS" = "x"; then
1267 AC_MSG_ERROR([Required GnuTLS library not found])
1269 if test "x$LIBGNUTLS_LIBS" != "x" ; then
1270 CXXFLAGS="$LIBGNUTLS_CFLAGS $CXXFLAGS"
1271 SSLLIB="$LIBGNUTLS_PATH $LIBGNUTLS_LIBS $SSLLIB"
1272 AC_DEFINE(USE_GNUTLS,1,[GnuTLS support is available])
1277 AC_MSG_NOTICE([GnuTLS library support: ${with_gnutls:=auto} ${LIBGNUTLS_PATH} ${LIBGNUTLS_LIBS}])
1279 dnl User may specify OpenSSL is needed from a non-standard location
1280 AC_ARG_WITH(openssl,
1281 AS_HELP_STRING([--with-openssl=PATH],
1282 [Compile with the OpenSSL libraries. The path to
1283 the OpenSSL development libraries and headers
1284 installation can be specified if outside of the
1285 system standard directories]), [
1286 case "$with_openssl" in
1288 : # Nothing special to do here
1291 if test ! -d "$withval" ; then
1292 AC_MSG_ERROR([--with-openssl path does not point to a directory])
1294 LIBOPENSSL_PATH="-L$with_openssl/lib"
1295 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1299 AH_TEMPLATE(USE_OPENSSL,[OpenSSL support is available])
1300 ## OpenSSL is default disable due to licensing issues on some OS
1301 if test "x$with_openssl" = "xyes"; then
1307 openssl/opensslv.h \
1314 # User may have provided a custom location for OpenSSL. Otherwise...
1315 SQUID_STATE_SAVE(squid_openssl_state)
1316 LIBS="$LIBS $LIBOPENSSL_PATH"
1318 # auto-detect using pkg-config
1319 PKG_CHECK_MODULES([LIBOPENSSL],[openssl],,[
1320 ## For some OS pkg-config is broken or unavailable.
1321 ## Detect libraries the hard way.
1323 # Windows MinGW has some special libraries ...
1324 if test "x$squid_host_os" = "xmingw" ; then
1325 LIBOPENSSL_LIBS='-lssleay32 -leay32 -lgdi32 $LIBOPENSSL_LIBS'
1326 AC_MSG_NOTICE([Windows OpenSSL library support: yes -lssleay32 -leay32 -lgdi32])
1329 AC_CHECK_LIB(crypto,[CRYPTO_new_ex_data],[LIBOPENSSL_LIBS="-lcrypto $LIBOPENSSL_LIBS"],[
1330 AC_MSG_ERROR([library 'crypto' is required for OpenSSL])
1332 AC_CHECK_LIB(ssl,[SSL_library_init],[LIBOPENSSL_LIBS="-lssl $LIBOPENSSL_LIBS"],[
1333 AC_MSG_ERROR([library 'ssl' is required for OpenSSL])
1337 # This is a workaround for RedHat 9 brain damage..
1338 if test -d /usr/kerberos/include -a -f /usr/include/openssl/kssl.h; then
1339 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
1340 LIBOPENSSL_LIBS="-L/usr/kerberos/lib $LIBOPENSSL_LIBS"
1341 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1343 SQUID_STATE_ROLLBACK(squid_openssl_state) #de-pollute LIBS
1345 if test "x$LIBOPENSSL_LIBS" != "x"; then
1346 CXXFLAGS="$LIBOPENSSL_CFLAGS $CXXFLAGS"
1347 SSLLIB="$LIBOPENSSL_PATH $LIBOPENSSL_LIBS $SSLLIB"
1348 AC_DEFINE(USE_OPENSSL,1,[OpenSSL support is available])
1350 # check for other specific broken implementations
1351 SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS
1352 SQUID_CHECK_OPENSSL_CONST_SSL_METHOD
1353 SQUID_CHECK_OPENSSL_TXTDB
1354 SQUID_CHECK_OPENSSL_HELLO_OVERWRITE_HACK
1356 if test "x$SSLLIB" = "x"; then
1357 AC_MSG_ERROR([Required OpenSSL library not found])
1360 AC_MSG_NOTICE([OpenSSL library support: ${with_openssl:=no} ${LIBOPENSSL_PATH} ${LIBOPENSSL_LIBS}])
1361 AM_CONDITIONAL(ENABLE_SSL,[ test "x$with_openssl" = "xyes" ])
1364 dnl User may specify MIT Kerberos is needed from a non-standard location
1365 AC_ARG_WITH(mit-krb5,
1366 AS_HELP_STRING([--without-mit-krb5],
1367 [Compile without MIT Kerberos support.]), [
1368 case "$with_mit_krb5" in
1370 : # Nothing special to do here
1373 if test ! -d "$withval" ; then
1374 AC_MSG_ERROR([--with-mit-krb5 path does not point to a directory])
1376 if test -d "$with_mit_krb5/lib64" ; then
1377 LIB_KRB5_PATH="-L$with_mit_krb5/lib64 -L$with_mit_krb5/lib"
1379 LIB_KRB5_PATH="-L$with_mit_krb5/lib"
1381 CXXFLAGS="-I$with_mit_krb5/include $CXXFLAGS"
1382 krb5confpath="$with_mit_krb5/bin"
1386 AH_TEMPLATE(USE_APPLE_KRB5,[Apple Kerberos support is available])
1387 AH_TEMPLATE(USE_MIT_KRB5,[MIT Kerberos support is available])
1388 AH_TEMPLATE(USE_SOLARIS_KRB5,[Solaris Kerberos support is available])
1390 ## find out if pkg-config or krb5-config will work
1391 if test "x$with_mit_krb5" != "xno"; then
1392 # find installed libs via pkg-config or krb5-config
1394 PKG_CHECK_EXISTS(mit-krb5-gssapi mit-krb5, [squid_pc_krb5_name="mit-krb5-gssapi mit-krb5"],[
1395 PKG_CHECK_EXISTS(gssapi-krb5 krb5, [squid_pc_krb5_name="gssapi-krb5 krb5"])
1397 if test "x$squid_pc_krb5_name" = "x" -a "$cross_compiling" = "no"; then
1398 # Look for krb5-config (unless cross-compiling)
1399 AC_PATH_PROG(krb5_config,krb5-config,no)
1400 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1401 krb5confpath="`dirname $ac_cv_path_krb5_config`"
1402 ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
1403 ac_solaris="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i solaris`"
1404 ac_apple="`$ac_cv_path_krb5_config --vendor 2>/dev/null | grep -c -i apple`"
1405 if test $ac_solaris -gt 0 ; then
1406 with_solaris_krb5=yes
1407 elif test $ac_apple -gt 0 ; then
1409 elif test $ac_heimdal -gt 0; then
1411 if test "x$with_mit_krb5" = "xyes"; then
1412 AC_MSG_ERROR([Could not find pkg-config or krb5-config for MIT Kerberos])
1416 if test "x$with_mit_krb5" = "xyes"; then
1417 AC_MSG_ERROR([Could not find krb5-config in path])
1425 # detect MIT Kerberos dependencies (except on Solaris)
1426 if test "x$with_mit_krb5" != "xno" -a "x$with_solaris_krb5" != "xyes"; then
1427 SQUID_STATE_SAVE([squid_krb5_save])
1428 LIBS="$LIBS $LIB_KRB5_PATH"
1430 # auto-detect using pkg-config
1431 PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
1432 # look for krb5-config (unless cross-compiling)
1433 if test "$cross_compiling" = "no"; then
1434 if test "x$krb5confpath" = "x" ; then
1435 AC_PATH_PROG(krb5_config,krb5-config,no)
1436 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1437 ac_krb5_config="$ac_cv_path_krb5_config"
1440 ac_krb5_config="$krb5confpath/krb5-config"
1443 if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
1445 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1446 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1447 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1448 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1449 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1451 ## For some OS pkg-config is broken or unavailable.
1452 ## Detect libraries the hard way.
1454 SQUID_STATE_SAVE([squid_mit_save])
1456 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1457 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
1458 AC_MSG_WARN([library 'com_err' is required for MIT Kerberos])
1459 missing_required=yes
1462 AC_CHECK_LIB(k5crypto, [main], [LIB_KRB5_LIBS="-lk5crypto $LIB_KRB5_LIBS"],[
1463 AC_MSG_WARN([library 'k5crypto' is required for MIT Kerberos])
1464 missing_required=yes
1467 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1468 AC_MSG_WARN([library 'krb5' is required for MIT Kerberos])
1469 missing_required=yes
1472 AC_CHECK_LIB(gssapi_krb5, [main], [LIB_KRB5_LIBS="-lgssapi_krb5 $LIB_KRB5_LIBS"],[
1473 AC_MSG_WARN([library 'gssapi_krb5' is required for MIT Kerberos])
1474 missing_required=yes
1476 SQUID_STATE_ROLLBACK([squid_mit_save])
1477 if test "x$missing_required" = "xyes"; then
1483 if test "x$LIB_KRB5_LIBS" != "x"; then
1484 if test "x$with_apple_krb5" = "xyes" ; then
1485 AC_DEFINE(USE_APPLE_KRB5,1,[Apple Kerberos support is available])
1486 KRB5_FLAVOUR="Apple"
1488 AC_DEFINE(USE_MIT_KRB5,1,[MIT Kerberos support is available])
1491 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1492 KRB5INCS="$LIB_KRB5_CFLAGS"
1494 # check for other specific broken implementations
1495 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1496 LIBS="$LIBS $KRB5LIBS"
1498 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1499 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1500 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
1501 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1502 AC_CHECK_HEADERS(profile.h)
1504 SQUID_CHECK_KRB5_FUNCS
1506 if test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1507 AC_MSG_ERROR([Required Kerberos library not found])
1508 elif test "x$KRB5LIBS" = "x"; then
1512 SQUID_STATE_ROLLBACK([squid_krb5_save])
1515 # detect Solaris Kerberos dependencies
1516 if test "x$with_solaris_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1517 SQUID_STATE_SAVE([squid_krb5_save])
1518 LIBS="$LIBS $LIB_KRB5_PATH"
1520 # no pkg-config for solaris native Kerberos
1521 # look for krb5-config (unless cross-compiling)
1522 if test "$cross_compiling" = "no"; then
1523 if test "x$krb5confpath" = "x" ; then
1524 AC_PATH_PROG(krb5_config,krb5-config,no)
1525 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1526 ac_krb5_config="$ac_cv_path_krb5_config"
1529 ac_krb5_config="$krb5confpath/krb5-config"
1532 if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
1534 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1535 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1536 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1537 # Solaris 10 Update 11 patches the krb5-config tool to produce stderr messages on stdout.
1538 SOLARIS_BROKEN_KRB5CONFIG_GSSAPI="`$ac_krb5_config --libs gssapi 2>/dev/null | grep "krb5-config"`"
1539 if test "x$SOLARIS_BROKEN_KRB5CONFIG_GSSAPI" = "x"; then
1540 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1541 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1544 ## For some OS pkg-config is broken or unavailable.
1545 ## Detect libraries the hard way.
1547 CXXFLAGS="-I/usr/include/kerberosv5 $CXXFLAGS"
1549 SQUID_STATE_SAVE([squid_solaris_save])
1551 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1552 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1553 AC_MSG_WARN([library 'krb5' is required for Solaris Kerberos])
1554 missing_required=yes
1557 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
1558 AC_MSG_WARN([library 'gss' is required for Solaris Kerberos])
1559 missing_required=yes
1561 SQUID_STATE_ROLLBACK([squid_solaris_save])
1562 if test "x$missing_required" = "xyes"; then
1567 if test "x$LIB_KRB5_LIBS" != "x"; then
1568 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1569 KRB5INCS="$LIB_KRB5_CFLAGS"
1570 AC_DEFINE(USE_SOLARIS_KRB5,1,[Solaris Kerberos support is available])
1571 KRB5_FLAVOUR="Solaris"
1573 # check for other specific broken implementations
1574 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1575 LIBS="$LIBS $KRB5LIBS"
1577 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1578 AC_CHECK_HEADERS(gssapi/gssapi.h gssapi/gssapi_ext.h)
1579 AC_CHECK_HEADERS(krb5.h com_err.h)
1581 SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H
1582 if test "x$squid_cv_broken_krb5_h" = "xyes"; then
1583 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if Solaris krb5.h is broken for C++])
1584 AC_MSG_WARN([You have a broken Solaris <krb5.h> system include.])
1585 AC_MSG_WARN([Please see http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512])
1586 AC_MSG_WARN([If you need Kerberos support you will have to patch])
1587 AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch])
1589 SQUID_CHECK_KRB5_FUNCS
1591 if test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1592 # Error only if Solaris flavour was detected while looking for required MIT Kerberos
1593 AC_MSG_ERROR([Required Kerberos library not found])
1594 elif test "x$KRB5LIBS" = "x"; then
1595 with_solaris_krb5=no
1598 SQUID_STATE_ROLLBACK([squid_krb5_save])
1601 dnl User may specify Heimdal Kerberos is needed from a non-standard location
1602 AC_ARG_WITH(heimdal-krb5,
1603 AS_HELP_STRING([--without-heimdal-krb5],
1604 [Compile without Heimdal Kerberos support.]), [
1605 case "$with_heimdal_krb5" in
1607 : # Nothing special to do here
1610 if test ! -d "$withval" ; then
1611 AC_MSG_ERROR([--with-heimdal-krb5 path does not point to a directory])
1613 if test -d "$with_heimdal_krb5/lib64" ; then
1614 LIB_KRB5_PATH="-L$with_heimdal_krb5/lib64 -L$with_heimdal_krb5/lib"
1616 LIB_KRB5_PATH="-L$with_heimdal_krb5/lib"
1618 CXXFLAGS="-I$with_heimdal_krb5/include $CXXFLAGS"
1619 krb5confpath="$with_heimdal_krb5/bin"
1620 with_heimdal_krb5=yes
1623 AH_TEMPLATE(USE_HEIMDAL_KRB5,[Heimdal Kerberos support is available])
1624 if test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"; then
1625 # find installed libs via pkg-config or krb5-config
1626 PKG_CHECK_EXISTS(heimdal-krb5, [squid_pc_krb5_name="heimdal-krb5"])
1627 if test "x$squid_pc_krb5_name" = "x"; then
1628 PKG_CHECK_EXISTS(heimdal-gssapi, [squid_pc_krb5_name="heimdal-gssapi"])
1630 if test "x$squid_pc_krb5_name" = "x" -a "$cross_compiling" = "no"; then
1631 # Look for krb5-config (unless cross-compiling)
1632 AC_PATH_PROG(krb5_config,krb5-config,no)
1633 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1634 krb5confpath="`dirname $ac_cv_path_krb5_config`"
1635 ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
1636 if test "x$with_heimdal_krb5" = "xyes" -a $ac_heimdal = 0; then
1637 AC_MSG_ERROR([Could not find pkg-config or krb5-config for Heimdal Kerberos])
1640 if test "x$with_heimdal_krb5" = "xyes"; then
1641 AC_MSG_ERROR([Could not find krb5-config in path])
1643 AC_MSG_WARN([Could not find krb5-config in path])
1644 with_heimdal_krb5=no
1649 if test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"; then
1650 SQUID_STATE_SAVE([squid_krb5_save])
1651 LIBS="$LIBS $LIB_KRB5_PATH"
1653 # auto-detect using pkg-config
1654 PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
1655 # look for krb5-config (unless cross-compiling)
1656 if test "$cross_compiling" = "no"; then
1657 if test "x$krb5confpath" = "x" ; then
1658 AC_PATH_PROG(krb5_config,krb5-config,no)
1659 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1660 ac_krb5_config="$ac_cv_path_krb5_config"
1663 ac_krb5_config="$krb5confpath/krb5-config"
1666 if test "x$ac_krb5_config" != "x" -a -x "$ac_krb5_config"; then
1668 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1669 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1670 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1671 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1672 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1674 ## For some OS pkg-config is broken or unavailable.
1675 ## Detect libraries the hard way.
1676 SQUID_STATE_SAVE([squid_heimdal_save])
1678 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1679 AC_CHECK_LIB(resolv, [main], [LIB_KRB5_LIBS="-lresolv $LIB_KRB5_LIBS"],[
1680 AC_MSG_WARN([library 'resolv' is required for Heimdal Kerberos])
1681 missing_required=yes
1684 AC_CHECK_LIB(crypt, [main], [LIB_KRB5_LIBS="-lcrypt $LIB_KRB5_LIBS"],[
1685 AC_MSG_WARN([library 'crypt' is required for Heimdal Kerberos])
1686 missing_required=yes
1689 AC_CHECK_LIB(roken, [main], [LIB_KRB5_LIBS="-lroken $LIB_KRB5_LIBS"],[
1690 AC_MSG_WARN([library 'roken' is required for Heimdal Kerberos])
1691 missing_required=yes
1694 AC_CHECK_LIB(heimbase, [main], [LIB_KRB5_LIBS="-lheimbase $LIB_KRB5_LIBS"],[
1695 AC_MSG_WARN([library 'heimbase' may be required for Heimdal Kerberos])
1698 AC_CHECK_LIB(wind, [main], [LIB_KRB5_LIBS="-lwind $LIB_KRB5_LIBS"],[
1699 AC_MSG_WARN([library 'wind' may be required for Heimdal Kerberos])
1702 AC_CHECK_LIB(crypto, [main], [LIB_KRB5_LIBS="-lcrypto $LIB_KRB5_LIBS"],[
1703 AC_MSG_WARN([library 'crypto' is required for Heimdal Kerberos])
1704 missing_required=yes
1707 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
1708 AC_MSG_WARN([library 'com_err' is required for Heimdal Kerberos])
1709 missing_required=yes
1712 AC_CHECK_LIB(hx509, [main], [LIB_KRB5_LIBS="-lhx509 $LIB_KRB5_LIBS"],[
1713 AC_MSG_WARN([library 'hx509' may be required for Heimdal Kerberos])
1716 AC_CHECK_LIB(asn1, [main], [LIB_KRB5_LIBS="-lasn1 $LIB_KRB5_LIBS"],[
1717 AC_MSG_WARN([library 'asn1' is required for Heimdal Kerberos])
1718 missing_required=yes
1721 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1722 AC_MSG_WARN([library 'krb5' is required for Heimdal Kerberos])
1723 missing_required=yes
1726 AC_CHECK_LIB(heimntlm, [main], [LIB_KRB5_LIBS="-lheimntlm $LIB_KRB5_LIBS"],[
1727 AC_MSG_WARN([library 'heimntlm' may be required for Heimdal Kerberos])
1730 AC_CHECK_LIB(gssapi, [main], [LIB_KRB5_LIBS="-lgssapi $LIB_KRB5_LIBS"],[
1731 AC_MSG_WARN([library 'gssapi' is required for Heimdal Kerberos])
1732 missing_required=yes
1734 SQUID_STATE_ROLLBACK([squid_heimdal_save])
1735 if test "x$missing_required" = "xyes"; then
1740 if test "x$LIB_KRB5_LIBS" != "x"; then
1741 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1742 KRB5INCS="$LIB_KRB5_CFLAGS"
1743 AC_DEFINE(USE_HEIMDAL_KRB5,1,[Heimdal Kerberos support is available])
1744 KRB5_FLAVOUR="Heimdal"
1746 # check for other specific broken implementations
1747 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1748 LIBS="$LIBS $KRB5LIBS"
1750 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1751 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1752 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1754 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1755 if test "x$squid_cv_broken_heimdal_krb5_h" = "xyes"; then
1756 AC_DEFINE(HAVE_BROKEN_HEIMDAL_KRB5_H, 1, [Define to 1 if Heimdal krb5.h is broken for C++])
1758 SQUID_CHECK_KRB5_FUNCS
1760 if test "x$KRB5LIBS" = "x"; then
1761 if test test "x$with_heimdal_krb5" = "xyes"; then
1762 AC_MSG_ERROR([Required Heimdal Kerberos library not found])
1764 AC_MSG_WARN([Heimdal Kerberos library not found])
1767 SQUID_STATE_ROLLBACK([squid_krb5_save])
1770 dnl User may specify GNU gss is needed from a non-standard location
1772 AS_HELP_STRING([--without-gnugss],
1773 [Compile without the GNU gss libraries.]), [
1774 case "$with_gnugss" in
1776 : # Nothing special to do here
1779 if test ! -d "$withval" ; then
1780 AC_MSG_ERROR([--with-gnugss path does not point to a directory])
1782 if test ! -d "$with_gnugss/lib64" ; then
1783 LIB_KRB5_PATH="-L$with_gnugss/lib64 -L$with_gnugss/lib"
1785 LIB_KRB5_PATH="-L$with_gnugss/lib"
1787 CXXFLAGS="-I$with_gnugss/include $CXXFLAGS"
1792 AH_TEMPLATE(USE_GNUGSS,[GNU gss support is available])
1793 if test "x$with_gnugss" != "xno" -a "x$KRB5LIBS" = "x"; then
1794 SQUID_STATE_SAVE([squid_krb5_save])
1795 LIBS="$LIBS $LIB_KRB5_PATH"
1797 # auto-detect using pkg-config
1798 PKG_CHECK_MODULES([LIB_KRB5],[gss],,[
1799 ## For some OS pkg-config is broken or unavailable.
1800 ## Detect libraries the hard way.
1802 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1803 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
1804 AC_MSG_WARN([library 'com_err' is required for GNU Kerberos])
1808 if test "x$LIB_KRB5_LIBS" != "x"; then
1809 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1810 KRB5INCS="$LIB_KRB5_CFLAGS"
1811 AC_DEFINE(USE_GNUGSS,1,[GNU Kerberos support is available])
1812 KRB5_FLAVOUR="GNU GSS"
1814 # check for other specific broken implementations
1815 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1816 LIBS="$LIBS $KRB5LIBS"
1818 AC_MSG_NOTICE([Try to find Kerbeors headers in given path])
1819 AC_CHECK_HEADERS(gss.h)
1821 SQUID_CHECK_WORKING_GSSAPI
1822 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1824 SQUID_CHECK_SPNEGO_SUPPORT
1825 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1827 SQUID_CHECK_WORKING_KRB5
1828 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1830 if test "x$KRB5LIBS" = "x"; then
1831 if test test "x$with_gnugss" = "xyes"; then
1832 AC_MSG_ERROR([Required GNU GSS Kerberos library not found])
1834 AC_MSG_WARN([GNU GSS Kerberos library not found])
1837 SQUID_STATE_ROLLBACK([squid_krb5_save])
1840 if test "x$KRB5LIBS" != "x"; then
1843 AC_MSG_NOTICE([$KRB5_FLAVOUR Kerberos library support: ${with_krb5:=no} ${LIB_KRB5_PATH} ${LIB_KRB5_LIBS}])
1847 dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
1848 dnl only with Windows LDAP libraries using -lwldap32
1849 case "$squid_host_os" in
1855 AC_CHECK_LIB(ldap, ldap_init, [LDAPLIB="-lldap"])
1856 dnl LDAP helpers need to know if -llber is needed or not
1857 AC_CHECK_LIB(lber, ber_init, [LBERLIB="-llber"])
1858 dnl if no ldap lib found check for mozilla version
1859 if test "x$ac_cv_lib_ldap_ldap_init" != x""yes; then
1862 AC_CHECK_LIB(ldap60, ldap_init, [LDAPLIB="-lldap60"])
1863 LIBS="$LDAPLIB $LIBPTHREADS"
1864 AC_CHECK_LIB(prldap60, prldap_init, [LDAPLIB="-lprldap60 $LDAPLIB"])
1865 LIBS="$LDAPLIB $LIBPTHREADS"
1866 AC_CHECK_LIB(ssldap60, ldapssl_init, [LDAPLIB="-lssldap60 $LDAPLIB"])
1870 AC_CHECK_HEADERS(ldap.h lber.h)
1871 AC_CHECK_HEADERS(mozldap/ldap.h)
1874 dnl Check for LDAP_OPT_DEBUG_LEVEL
1876 AC_MSG_CHECKING([for LDAP_OPT_DEBUG_LEVEL])
1877 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1880 int i=LDAP_OPT_DEBUG_LEVEL
1882 [ AC_MSG_RESULT(yes) ],
1883 [ AC_MSG_RESULT(no) ])
1886 dnl Check for working ldap
1889 LIBS="$LDAPLIB $LBERLIB $LIBPTHREADS"
1890 AC_MSG_CHECKING([for working ldap])
1891 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1892 # define LDAP_DEPRECATED 1
1895 # elif HAVE_MOZLDAP_LDAP_H
1896 # include <mozldap/ldap.h>
1904 ldap_init((const char *)&host, port);
1909 [ AC_DEFINE(HAVE_LDAP, 1, [LDAP support])
1910 AC_MSG_RESULT(yes) ],
1911 [ AC_MSG_RESULT(no) ],
1912 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1916 dnl Check for ldap vendor
1918 AC_MSG_CHECKING([for OpenLDAP])
1919 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1923 # include <string.h>
1927 return strcmp(LDAP_VENDOR_NAME,"OpenLDAP");
1930 [ AC_DEFINE(HAVE_OPENLDAP, 1, [OpenLDAP support])
1931 AC_MSG_RESULT(yes) ],
1932 [ AC_MSG_RESULT(no) ],
1933 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1935 AC_MSG_CHECKING([for Sun LDAP SDK])
1936 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1940 # include <string.h>
1944 return strcmp(LDAP_VENDOR_NAME,"Sun Microsystems Inc.");
1947 [ AC_DEFINE(HAVE_SUN_LDAP_SDK, 1, [Sun LDAP SDK support])
1948 AC_MSG_RESULT(yes) ],
1949 [ AC_MSG_RESULT(no) ],
1950 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1952 AC_MSG_CHECKING([for Mozilla LDAP SDK])
1953 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1956 # elif HAVE_MOZLDAP_LDAP_H
1957 # include <mozldap/ldap.h>
1959 # include <string.h>
1963 return strcmp(LDAP_VENDOR_NAME,"mozilla.org");
1966 [ AC_DEFINE(HAVE_MOZILLA_LDAP_SDK, 1, [Mozilla LDAP SDK support])
1967 AC_MSG_RESULT(yes) ],
1968 [ AC_MSG_RESULT(no)],
1969 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1972 dnl Check for LDAP_REBINDPROC_CALLBACK
1974 AC_MSG_CHECKING([for LDAP_REBINDPROC_CALLBACK])
1975 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1978 # elif HAVE_MOZLDAP_LDAP_H
1979 # include <mozldap/ldap.h>
1982 LDAP_REBINDPROC_CALLBACK ldap_rebind;
1984 [ AC_DEFINE(HAVE_LDAP_REBINDPROC_CALLBACK,1,[Define to 1 if you have LDAP_REBINDPROC_CALLBACK])
1985 AC_MSG_RESULT(yes) ],
1986 [ AC_MSG_RESULT(no) ])
1989 dnl Check for LDAP_REBIND_PROC
1991 AC_MSG_CHECKING([for LDAP_REBIND_PROC])
1992 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1995 # elif HAVE_MOZLDAP_LDAP_H
1996 # include <mozldap/ldap.h>
1999 LDAP_REBIND_PROC ldap_rebind;
2001 [ AC_DEFINE(HAVE_LDAP_REBIND_PROC,1,[Define to 1 if you have LDAP_REBIND_PROC])
2002 AC_MSG_RESULT(yes) ],
2003 [ AC_MSG_RESULT(no) ])
2006 dnl Check for LDAP_REBIND_FUNCTION
2008 AC_MSG_CHECKING([for LDAP_REBIND_FUNCTION])
2009 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2010 # define LDAP_REFERRALS
2013 # elif HAVE_MOZLDAP_LDAP_H
2014 # include <mozldap/ldap.h>
2017 LDAP_REBIND_FUNCTION ldap_rebind;
2019 [ AC_DEFINE(HAVE_LDAP_REBIND_FUNCTION,1,[Define to 1 if you have LDAP_REBIND_FUNCTION])
2020 AC_MSG_RESULT(yes) ],
2021 [ AC_MSG_RESULT(no) ])
2024 dnl Check for LDAP_SCOPE_DEFAULT
2026 AC_MSG_CHECKING([for LDAP_SCOPE_DEFAULT])
2027 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2030 # elif HAVE_MOZLDAP_LDAP_H
2031 # include <mozldap/ldap.h>
2034 int i=LDAP_SCOPE_DEFAULT;
2036 [ AC_DEFINE(HAVE_LDAP_SCOPE_DEFAULT,1,[Define to 1 if you have LDAP_SCOPE_DEFAULT])
2037 AC_MSG_RESULT(yes) ],
2038 [ AC_MSG_RESULT(no) ])
2041 dnl Check for ldap_url_desc.lud_scheme
2043 AC_CHECK_MEMBER(struct ldap_url_desc.lud_scheme,
2044 AC_DEFINE(HAVE_LDAP_URL_LUD_SCHEME,1,
2045 [Define to 1 if you have LDAPURLDesc.lud_scheme]),,[#include <ldap.h>])
2048 dnl Check for ldapssl_client_init
2050 AC_CHECK_LIB(ldap,ldapssl_client_init,
2051 AC_DEFINE(HAVE_LDAPSSL_CLIENT_INIT,1,[Define to 1 if you have ldapssl_client_init]),)
2054 dnl Check for ldap_url_desc2str
2056 AC_CHECK_LIB(ldap,ldap_url_desc2str,
2057 AC_DEFINE(HAVE_LDAP_URL_DESC2STR,1,[Define to 1 if you have ldap_url_desc2str]),)
2060 dnl Check for ldap_url_parse
2062 AC_CHECK_LIB(ldap,ldap_url_parse,
2063 AC_DEFINE(HAVE_LDAP_URL_PARSE,1,[Define to 1 if you have ldap_url_parse]),)
2066 dnl Check for ldap_start_tls_s
2068 AC_CHECK_LIB(ldap,ldap_start_tls_s,
2069 AC_DEFINE(HAVE_LDAP_START_TLS_S,1,[Define to 1 if you have ldap_start_tls_s]),)
2076 AC_ARG_ENABLE(forw-via-db,
2077 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
2078 SQUID_YESNO([$enableval],[unrecognized argument to --enable-forw-via-db: $enableval])
2080 SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
2081 [Enable Forw/Via database])
2082 AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
2084 AC_ARG_ENABLE(cache-digests,
2085 AS_HELP_STRING([--enable-cache-digests],
2086 [Use Cache Digests. See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
2088 SQUID_YESNO($enableval,
2089 [unrecognized argument to --enable-cache-digests: $enableval])
2091 SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
2092 [Use Cache Digests for locating objects in neighbor caches.])
2093 AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
2096 ################################
2097 # check for netio plugin stuff #
2098 ################################
2099 dnl order of these options handling is relevant in case the user
2100 dnl supplies more than one --enable option. Options handled later
2101 dnl override those handled earlier for io loop method manual override
2102 AC_ARG_ENABLE(select,
2103 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),
2105 SQUID_YESNO($enableval,[--disable-select takes no extra argument])
2106 if test "x$enableval" = "xyes"; then
2107 if test "x$squid_host_os" = "xmingw"; then
2108 squid_opt_io_loop_engine="select_win32"
2110 squid_opt_io_loop_engine="select"
2114 AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
2117 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
2119 SQUID_YESNO($enableval,[--disable-poll takes no extra argument])
2120 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="poll"
2122 AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
2124 AC_ARG_ENABLE(kqueue,
2125 AS_HELP_STRING([--disable-kqueue],
2126 [Disable kqueue(2) support.]), [
2127 SQUID_YESNO($enableval,[--enable-kqueue takes no extra argument])
2129 if test "x${enable_kqueue:=auto}" != "xno" ; then
2130 AC_CHECK_HEADERS([sys/event.h],[],[
2131 if test "x${enable_kqueue}" = "xyes" ; then
2132 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
2135 AC_CHECK_FUNCS(kqueue,[],[
2136 if test "x${enable_kqueue}" = "xyes" ; then
2137 AC_MSG_ERROR([kqueue support missing in libc library.])
2140 if test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes" ; then
2141 squid_opt_io_loop_engine="kqueue"
2146 AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
2149 AC_ARG_ENABLE(epoll,
2150 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
2152 SQUID_YESNO($enableval,[--disable-epoll takes no extra argument])
2153 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="epoll"
2155 AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
2157 # auto-detect and verify epoll header and library present and working
2158 # logic mapping and loop method selection are performed later
2159 if test "x$enable_epoll" != "xno" ; then
2161 # check if libs are needed to support epoll
2162 # note: this code block seems quite generic. Could it be extracted
2163 # into a squid specific configure function?
2164 SQUID_STATE_SAVE(squid_epoll_state)
2165 AC_SEARCH_LIBS(epoll_ctl,[epoll])
2166 if test "x$ac_cv_search_epoll_ctl" = "xno" ; then
2167 enable_epoll=no #disable. Needed code not found
2168 elif test "x$ac_cv_search_epoll_ctl" = "xnone required" ; then
2171 EPOLL_LIBS=$ac_cv_search_epoll_ctl
2173 AC_SUBST(EPOLL_LIBS)
2174 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
2176 # epoll requires sys/epoll.h
2177 AC_CHECK_HEADERS([sys/epoll.h])
2179 dnl Verify that epoll really works
2180 if test "x$ac_cv_search_epoll_ctl" != 'xno' ; then
2184 if test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno" ; then
2185 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
2189 dnl Enable /dev/poll
2190 AC_ARG_ENABLE(devpoll,
2191 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),
2193 SQUID_YESNO($enableval,[--disable-devpoll takes no extra argument])
2194 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="devpoll"
2196 AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
2198 ## auto-detect and verify devpoll header and library present and working
2199 if test "x$enable_devpoll" != "xno"; then
2201 # /dev/poll requires ioctl() and write()
2202 AC_CHECK_FUNCS(ioctl)
2203 AC_CHECK_FUNCS(write)
2205 # /dev/poll requires sys/devpoll.h
2206 AC_CHECK_HEADERS([sys/devpoll.h],,[
2207 if test "x$enable_devpoll" = "xyes"; then
2208 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
2212 # Verify that /dev/poll really works
2213 if test "x$enable_devpoll" != 'xno' ; then
2217 if test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno" ; then
2218 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
2223 AC_ARG_ENABLE(http-violations,
2224 AS_HELP_STRING([--disable-http-violations],
2225 [This allows you to remove code which is known to
2226 violate the HTTP protocol specification.]), [
2227 SQUID_YESNO([$enableval],
2228 [unrecognized argument to --disable-http-violations: $enableval])
2230 SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
2231 [Define to enable code which volates the HTTP standard specification])
2232 AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
2234 # IPFW Transparent Proxy
2235 AC_ARG_ENABLE(ipfw-transparent,
2236 AS_HELP_STRING([--enable-ipfw-transparent],
2237 [Enable Transparent Proxy support for systems
2238 using FreeBSD IPFW-style firewalling.]), [
2239 SQUID_YESNO([$enableval],
2240 [unrecognized argument to --enable-ipfw-transparent: $enableval])
2242 SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
2243 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
2244 AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
2246 # IP-Filter Transparent Proxy
2247 AC_ARG_ENABLE(ipf-transparent,
2248 AS_HELP_STRING([--enable-ipf-transparent],
2249 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
2250 SQUID_YESNO([$enableval],
2251 [unrecognized argument to --enable-ipf-transparent: $enableval])
2253 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2254 #IPF currently broken. Default-disabled for now.
2255 AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
2257 dnl Enable PF Transparent Proxy
2258 AC_ARG_ENABLE(pf-transparent,
2259 AS_HELP_STRING([--enable-pf-transparent],
2260 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
2261 SQUID_YESNO([$enableval],
2262 [unrecognized argument to --enable-pf-transparent: $enableval])
2264 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2265 AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
2267 dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
2268 AC_ARG_WITH(nat-devpf,
2269 AS_HELP_STRING([--with-nat-devpf],
2270 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
2271 SQUID_YESNO([$enableval],
2272 [unrecognized argument to --with-nat-devpf: $enableval])
2274 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2275 AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
2277 # Linux Netfilter Transparent Proxy
2278 AC_ARG_ENABLE(linux-netfilter,
2279 AS_HELP_STRING([--enable-linux-netfilter],
2280 [Enable Transparent Proxy support for Linux (Netfilter)]), [
2281 SQUID_YESNO([$enableval],
2282 [unrecognized argument to --enable-linux-netfilter: $enableval])
2284 AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
2285 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2288 dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
2289 dnl squid_opt_netfilterconntrack is set only when option is explicity specified
2290 AC_ARG_WITH(netfilter-conntrack,
2291 AS_HELP_STRING([--without-netfilter-conntrack],
2292 [Do not use Netfilter conntrack libraries for packet marking.
2293 A path to alternative library location may be specified by
2294 using --with-netfilter-conntrack=PATH. Default: auto-detect.]), [
2295 case "$with_netfilter_conntrack" in
2297 squid_opt_netfilterconntrack=$with_netfilter_conntrack
2300 if test ! -d "$withval" ; then
2301 AC_MSG_ERROR([--without-netfilter-conntrack path does not point to a directory])
2303 squid_opt_netfilterconntrackpath=$withval
2304 LDFLAGS="-L$squid_opt_netfilterconntrackpath/lib $LDFLAGS"
2305 CPPFLAGS="-I$squid_opt_netfilterconntrackpath/include $CPPFLAGS"
2306 with_netfilter_conntrack=yes
2307 squid_opt_netfilterconntrack=yes
2310 AC_MSG_NOTICE([Linux Netfilter Conntrack support requested: ${with_netfilter_conntrack:=auto}])
2311 if test "x$with_netfilter_conntrack" != "xno"; then
2312 AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
2313 if test x"$with_netfilter_conntrack" = "xyes"; then
2314 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack library not found])
2316 with_netfilter_conntrack=no])
2317 AC_CHECK_HEADERS([libnetfilter_conntrack/libnetfilter_conntrack.h \
2318 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h],,[
2319 if test x"$with_netfilter_conntrack" = "xyes"; then
2320 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack headers not found])
2322 with_netfilter_conntrack=no])
2323 # If nothing is broken; enable the libraries usage.
2324 if test "x$with_netfilter_conntrack" != "xno"; then
2325 with_netfilter_conntrack=yes
2330 dnl Enable Large file support
2332 squid_opt_enable_large_files=no
2334 AC_ARG_WITH(large-files,
2335 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
2336 if test "x$withval" = "xyes"; then
2337 squid_opt_enable_large_files=yes
2341 dnl UNIX Build environment
2342 dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
2343 AC_ARG_WITH(build-environment,
2344 AS_HELP_STRING([--with-build-environment=model],
2345 [The build environment to use. Normally one of
2346 POSIX_V6_ILP32_OFF32 (32 bits),
2347 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
2348 POSIX_V6_LP64_OFF64 (64 bits),
2349 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
2350 XBS5_ILP32_OFF32 i(legacy, 32 bits),
2351 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
2352 XBS5_LP64_OFF64 (legacy, 64 bits),
2353 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
2354 or default (The default for your OS)]), [
2357 AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])
2360 buildmodel="$withval"
2365 #hack. Let's early-detect sizeof(long)
2366 AC_CHECK_SIZEOF(long)
2368 if test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"; then
2369 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
2370 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
2375 if test "x$buildmodel" = "x"; then
2376 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
2379 if test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"; then
2380 # define _FILE_OFFSET_BITS if requested and needed
2381 if test "x$squid_opt_enable_large_files" = "xyes" -a $ac_cv_sizeof_long -le 4 ; then
2382 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
2383 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
2384 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
2387 AC_MSG_NOTICE([Using $buildmodel build environment])
2388 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
2391 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
2393 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
2394 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
2395 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
2396 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
2397 if test "x$squid_host_os" = "xsolaris" ; then
2399 # On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
2400 # for LDFLAGS -xarch=generic64, but:
2401 # "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
2402 # For gcc "-xarch=generic64" must be replaced with "-m64"
2403 # The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
2404 if test "x$GCC" = "xyes"; then
2405 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
2406 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
2407 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
2408 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
2409 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2410 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2411 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
2413 AC_MSG_NOTICE([Removing -Usun on $host])
2414 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
2415 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
2419 dnl Enable Leak Finding Functions
2420 AC_ARG_ENABLE(leakfinder,
2421 AS_HELP_STRING([--enable-leakfinder],
2422 [Enable Leak Finding code. Enabling this alone does nothing;
2423 you also have to modify the source code to use the leak
2424 finding functions. Probably Useful for hackers only.]), [
2425 SQUID_YESNO([$enableval],
2426 [unrecognized argument to --enable-leakfinder: $enableval])
2428 AC_MSG_NOTICE([Leak Finder enabled: ${enable_leakfinder:=no}])
2429 SQUID_DEFINE_BOOL(USE_LEAKFINDER,$enable_leakfinder,
2430 [Enable code for assisting in finding memory leaks. Not for the faint of heart])
2431 AM_CONDITIONAL(ENABLE_LEAKFINDER, [test "x$enable_leakfinder" = "xyes"])
2434 AC_ARG_ENABLE(follow-x-forwarded-for,
2435 AS_HELP_STRING([--enable-follow-x-forwarded-for],
2436 [Enable support for following the X-Forwarded-For
2437 HTTP header to try to find the IP address of the
2438 original or indirect client when a request has
2439 been forwarded through other proxies.]), [
2440 SQUID_YESNO([$enableval],
2441 [unrecognized argument to --enable-follow-x-forwarded-for: $enableval])
2443 AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
2444 SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
2445 [Enable following X-Forwarded-For headers])
2447 AC_ARG_ENABLE(ident-lookups,
2448 AS_HELP_STRING([--disable-ident-lookups],
2449 [Remove code that supports performing Ident (RFC 931) lookups.]), [
2450 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ident-lookups: $enableval])
2452 AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
2453 SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
2455 dnl Select Default hosts file location
2456 AC_ARG_ENABLE(default-hostsfile,
2457 AS_HELP_STRING([--enable-default-hostsfile=path],
2458 [Select default location for hosts file.
2459 See hosts_file directive in squid.conf for details]), [
2460 if test "x$enableval" != "xnone" -a "x$enableval" != "xno" ; then
2461 if test \! -f "$enableval"; then
2462 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
2464 squid_opt_default_hosts=$enableval
2466 squid_opt_default_hosts="none"
2469 AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
2470 DEFAULT_HOSTS=$squid_opt_default_hosts
2471 AC_SUBST(DEFAULT_HOSTS)
2473 # Select auth schemes modules to build
2475 AS_HELP_STRING([--enable-auth],
2476 [Build global support for authentication. The list of schemes
2477 and helpers to be enabled is defined elsewhere]), [
2478 SQUID_YESNO([$enableval],
2479 [unrecognized argument to --enable-auth: $enableval])
2481 AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
2482 SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
2483 AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
2487 AC_ARG_ENABLE(auth-basic,
2488 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
2489 [Enable the basic authentication scheme, and build the specified helpers.
2490 Not providing an explicit list of helpers will attempt build of
2491 all possible helpers. Default is to do so.
2492 To disable the basic authentication scheme, use --disable-auth-basic.
2493 To enable but build no helpers, specify "none".
2494 To see available helpers, see the src/auth/basic/ directory. ]),[
2495 #nothing to do really
2497 m4_include([src/auth/basic/helpers.m4])
2499 AC_ARG_ENABLE(auth-digest,
2500 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
2501 [Enable the Digest authentication scheme, and build the specified helpers.
2502 Not providing an explicit list of helpers will attempt build of
2503 all possible helpers. Default is to do so.
2504 To disable the Digest authentication scheme, use --disable-auth-digest.
2505 To enable but build no helpers, specify "none".
2506 To see available helpers, see the src/auth/digest/ directory. ]),[
2507 #nothing to do, really
2509 m4_include([src/auth/digest/helpers.m4])
2511 AC_ARG_ENABLE(auth-negotiate,
2512 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
2513 [Enable the Negotiate authentication scheme, and build the specified
2515 Not providing an explicit list of helpers will attempt build of
2516 all possible helpers. Default is to do so.
2517 To disable the Negotiate authentication scheme,
2518 use --disable-auth-negotiate.
2519 To enable but build no helpers, specify "none".
2520 To see available helpers, see the src/auth/negotiate/ directory. ]),[
2521 #nothing to do, really
2523 m4_include([src/auth/negotiate/helpers.m4])
2525 AC_ARG_ENABLE(auth-ntlm,
2526 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
2527 [Enable the NTLM authentication scheme, and build the specified helpers.
2528 Not providing an explicit list of helpers will attempt build of
2529 all possible helpers. Default is to do so.
2530 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
2531 To enable but build no helpers, specify "none".
2532 To see available helpers, see the src/auth/ntlm/ directory. ]),[
2534 m4_include([src/auth/ntlm/helpers.m4])
2536 dnl Authentication libraries to build
2537 dnl This list will not be needed when each auth library has its own Makefile
2538 dnl this is to be placed AFTER each auth module's handler
2540 for module in $AUTH_MODULES; do
2541 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
2543 AC_SUBST(AUTH_MODULES)
2544 AC_SUBST(AUTH_LIBS_TO_BUILD)
2545 AM_CONDITIONAL(ENABLE_SMBLIB, test "x$require_smblib" = "xyes")
2547 dnl Select logging daemon helpers to build
2548 AC_ARG_ENABLE(log-daemon-helpers,
2549 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
2550 [This option selects which logging daemon helpers to
2551 build and install as part of the normal build process
2552 For a list of available helpers see the src/log/
2554 #nothing to do, really
2556 m4_include([src/log/helpers.m4])
2558 AC_ARG_ENABLE(external-acl-helpers,
2559 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
2560 [Enable external_acl helpers support and the helpers themselves.
2561 Default is to build all buildable helpers and enable support.
2562 To disable support, use --disable-external-acl-helpers.
2563 To build no helpers, specify "none".
2564 To see available helpers, see the src/acl/external/
2566 #nothing to do, really
2568 m4_include([src/acl/external/helpers.m4])
2570 dnl Select url_rewrite helpers to build
2571 AC_ARG_ENABLE(url-rewrite-helpers,
2572 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
2573 [This option selects which url_rewrite helpers to
2574 build and install as part of the normal build
2575 process. The default is to attempt the build of all possible
2576 helpers. Use --disable-url-rewrite-helpers to build none.
2577 For a list of available helpers see the
2578 src/http/url_rewriters/ directory.]),[
2580 m4_include([src/http/url_rewriters/helpers.m4])
2582 dnl Select security helpers to build
2583 AC_ARG_ENABLE(security-cert-validators,
2584 AS_HELP_STRING([--enable-security-cert-validators="list of helpers"],
2585 [This option selects which security certificate validator
2586 helpers to build and install as part of the normal build
2587 process. The default is to attempt the build of all possible
2588 helpers. Use --disable-security-cert-validators to
2589 build none. For a list of available helpers see the
2590 src/security/cert_validators/ directory.]),[
2592 m4_include([src/security/cert_validators/helpers.m4])
2594 AC_ARG_ENABLE(security-cert-generators,
2595 AS_HELP_STRING([--enable-security-cert-generators="list of helpers"],
2596 [This option selects which security certificate validator
2597 helpers to build and install as part of the normal build
2598 process. The default is to attempt the build of all possible
2599 helpers. Use --disable-security-cert-genrators to
2600 build none. For a list of available helpers see the
2601 src/security/cert_generators/ directory.]),[
2603 m4_include([src/security/cert_generators/helpers.m4])
2605 dnl Select storeid_rewrite helpers to build
2606 AC_ARG_ENABLE(storeid-rewrite-helpers,
2607 AS_HELP_STRING([--enable-storeid-rewrite-helpers="list of helpers"],
2608 [This option selects which Store-ID rewrite helpers to
2609 build and install as part of the normal build
2610 process. The default is to attempt the build of all possible
2611 helpers. Use --disable-storeid-rewrite-helpers to build none.
2612 For a list of available helpers see the
2613 src/store/id_rewriters/ directory.]),[
2615 m4_include([src/store/id_rewriters/helpers.m4])
2617 AC_ARG_WITH(valgrind-debug,
2618 AS_HELP_STRING([--with-valgrind-debug],
2619 [Include debug instrumentation for use with valgrind]),
2621 SQUID_YESNO([$withval],
2622 [unrecognized argument to --with-valgrind-debug: $withval])
2623 if test "x$withval" != "xno" ; then
2624 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
2625 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
2629 SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
2630 [Valgrind memory debugger support])
2631 AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
2633 dnl Disable "memPools" code
2634 #AC_ARG_ENABLE(chunkedmempools,
2635 # AS_HELP_STRING([--enable-chunkedmempools],
2636 # [Enable experimental chunked memPools. Note that this option
2637 # simply sets the default behaviour. Specific classes can override this
2638 # at runtime, and only lib/MemPool.c needs to be altered
2639 # to change the squid-wide default for all classes.]), [
2640 #SQUID_YESNO([$enableval],
2641 # [--enable-chunkedmempools option takes no arguments])
2643 SQUID_DEFINE_BOOL(USE_CHUNKEDMEMPOOLS,${enable_chunkedmempools:=no},
2644 [Enable chunked Memory Pools support (experimental)])
2645 #AC_MSG_NOTICE([Chunked MemPools enabled: $enable_chunkedmempools])
2647 dnl Enable WIN32 Service compile mode
2648 AC_ARG_ENABLE(win32-service,
2649 AS_HELP_STRING([--enable-win32-service],
2650 [Compile Squid as a WIN32 Service.
2651 Works only on MS-Windows platforms]), [
2652 SQUID_YESNO([$enableval],
2653 [unrecognized argument to --enable-win32-service: $enableval])
2655 SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
2656 [Enable code supporting MS Windows service mode])
2657 AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
2660 # Disable "unlinkd" code
2661 AC_ARG_ENABLE(unlinkd,
2662 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
2663 SQUID_YESNO([$enableval],
2664 [unrecognized argument to --disable-unlinkd: $enableval])
2666 SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
2667 [Enable useage of unlinkd])
2668 AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
2669 AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
2671 # Enable backtraces on fatal errors
2672 AC_ARG_ENABLE(stacktraces,
2673 AS_HELP_STRING([--enable-stacktraces],
2674 [Enable automatic call backtrace on fatal errors]), [
2675 SQUID_YESNO([$enableval],
2676 [unrecognized argument to --enable-stacktraces: $enableval])
2678 SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
2679 [Print stack traces on fatal errors])
2680 AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
2683 # CPU Profiling options handling
2684 AC_ARG_ENABLE(cpu-profiling,
2685 AS_HELP_STRING([--enable-cpu-profiling],
2686 [Enable instrumentation to try and understand how CPU power
2687 is spent by squid, by enabling specific probes in selected
2689 New probes can only be added by modifying the source code.
2690 It is meant to help developers in optimizing performance
2691 of Squid internal functions.
2692 If you are not developer you should not enable this,
2693 as it slows squid down somewhat.
2694 See lib/Profiler.c for more details.]), [
2695 SQUID_YESNO([$enableval],
2696 [unrecognized argument to --enable-cpu-profiling: $enableval])
2698 # Default OFF. This is a debug feature. Only check and enable if forced ON.
2699 if test "x$enable_cpu_profiling" = "xyes"; then
2700 SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
2701 if test "x$squid_cv_cpu_profiler_works" = "xno"; then
2702 AC_MSG_ERROR([CPU profiling will not be functional in this build.])
2705 SQUID_DEFINE_BOOL(USE_XPROF_STATS,${enable_cpu_profiling:=no},
2706 [Define to enable CPU profiling within Squid])
2707 AM_CONDITIONAL(ENABLE_XPROF_STATS,
2708 test "x$enable_cpu_profiling" = "xyes")
2709 AC_MSG_NOTICE([CPU profiling enabled: $enable_cpu_profiling])
2711 # Enable X-Accelerator-Vary for Vary support within an accelerator setup
2712 AC_ARG_ENABLE(x-accelerator-vary,
2713 AS_HELP_STRING([--enable-x-accelerator-vary],
2714 [Enable support for the X-Accelerator-Vary
2715 HTTP header. Can be used to indicate
2716 variance within an accelerator setup.
2717 Typically used together with other code
2718 that adds custom HTTP headers to the requests.]), [
2719 SQUID_YESNO([$enableval],
2720 [unrecognized argument to --enable-x-accelerator-vary: $enableval])
2722 SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
2723 [Enable support for the X-Accelerator-Vary HTTP header])
2724 AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
2726 AC_ARG_WITH([cppunit], AS_HELP_STRING([--without-cppunit],[Do not use cppunit test framework]),[
2727 AS_CASE($with_cppunit, [yes|no],[],
2729 AS_IF([test ! -d "$withval"],AC_MSG_ERROR([--with-cppunit PATH does not point to a directory]))
2730 LIBCPPUNIT_CFLAGS="-I$with_cppunit/include"
2731 LIBCPPUNIT_LIBS="-L$with_cppunit/lib -lcppunit"
2734 AS_IF([test "x$with_cppunit" != "xno"],[
2735 PKG_CHECK_MODULES([LIBCPPUNIT],[cppunit],[
2736 squid_cv_cppunit_version="`pkg-config cppunit --version`"
2737 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
2738 AS_UNSET(squid_cv_cppunit_version)
2740 SQUID_STATE_SAVE(squid_cppunit_state)
2741 AS_VAR_APPEND(CXXFLAGS,[$LIBCPPUNIT_CFLAGS])
2742 AS_VAR_APPEND(LIBS,[$LIBCPPUNIT_LIBS])
2743 AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
2744 SQUID_STATE_ROLLBACK(squid_cppunit_state)
2746 AC_MSG_WARN([cppunit does not appear to be installed. Squid does not require this, but code testing with 'make check' will fail.])
2750 # Force some compilers to use ANSI features
2754 if test "x$ac_cv_prog_CC" = "xcc" ; then
2755 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
2763 dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
2767 AC_MSG_NOTICE([Disabling ranlib for HP-UX...])
2772 dnl Check for headers
2797 linux/posix_types.h \
2805 netinet/in_systm.h \
2857 linux/netfilter_ipv4.h \
2858 linux/netfilter_ipv6/ip6_tables.h \
2860 SQUID_DEFAULT_INCLUDES
2864 /* Netfilter ip(6)tables v1.4.0 has broken headers */
2865 #if HAVE_NETINET_IN_H
2866 #include <netinet/in.h>
2870 dnl *BSD dont include the dependencies for all their net/ and netinet/ files
2871 dnl We must include a few basic type headers for them to work.
2886 SQUID_BSDNET_INCLUDES)
2892 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2895 #include <sys/time.h>
2902 dnl Override rusage() detect on MinGW because is emulated in source code
2903 case "$squid_host_os" in
2905 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2906 ac_cv_func_getrusage='yes'
2907 AC_MSG_NOTICE([Using own rusage on Windows.])
2910 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
2912 #include <sys/time.h>
2914 #if HAVE_SYS_RESOURCE_H
2915 #include <sys/resource.h>
2920 AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2921 #if HAVE_SYS_TYPES_H
2922 #include <sys/types.h>
2924 #include <netinet/in.h>
2925 #include <netinet/in_systm.h>
2926 #include <netinet/ip.h>
2927 #if defined (__linux__) || defined (__CYGWIN__)
2936 dnl Check for typedefs
2937 AC_CHECK_SIZEOF(void *)
2939 # check for a bunch of types
2953 AC_CHECK_TYPE([bool])
2954 #need the defines for PRId64
2955 AC_CHECK_SIZEOF(int64_t)
2956 AC_CHECK_SIZEOF(long)
2957 #need the defines for PRIuSIZE
2958 AC_CHECK_SIZEOF(size_t)
2959 #need the define for overflow checks
2960 AC_CHECK_SIZEOF(off_t)
2961 AC_CHECK_SIZEOF(size_t)
2963 dnl Some C++11 types we try to use
2965 AX_CXX_TYPE_UNIQUE_PTR
2966 AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS
2967 SQUID_CXX_STD_UNDERLYING_TYPE
2969 dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2970 dnl that is incompatible with the updated Solaris header files.
2971 dnl For this reason, we must check if pad128_t and upad128_t are defined.
2972 AC_CHECK_TYPE(pad128_t,
2973 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2974 ,SQUID_DEFAULT_INCLUDES)
2976 AC_CHECK_TYPE(upad128_t,
2977 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2978 ,SQUID_DEFAULT_INCLUDES)
2980 AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2981 AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2983 AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2984 #include <sys/types.h>
2985 #include <sys/socket.h>
2991 AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
2992 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
2993 #include <sys/ipc.h>
2994 #include <sys/msg.h>])
2996 # check for compiler support of %zu printf macro
2997 AH_TEMPLATE(PRIuSIZE,[Compiler supports %zu printf macro])
2998 AC_MSG_CHECKING([for compiler %zu support])
2999 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3001 ]],[[size_t n=1;printf("%zu",n);]])],[
3002 AC_DEFINE(PRIuSIZE,"zu")
3004 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
3007 dnl Check for special functions
3011 dnl Check for libcap header (assume its not broken unless
3012 AC_ARG_WITH(libcap, AS_HELP_STRING([--without-libcap],
3013 [disable usage of Linux capabilities library to control privileges]), [
3014 SQUID_YESNO([$withval],[unrecognized argument to --without-libcap: $withval])
3015 ],[with_libcap=auto])
3017 if test "x$with_libcap" != "xno"; then
3018 # cap_clear_flag is the most recent libcap function we require
3019 AC_CHECK_HEADERS(sys/capability.h)
3020 AC_CHECK_LIB(cap, cap_clear_flag)
3021 SQUID_CHECK_FUNCTIONAL_LIBCAP2
3023 # if it can't be supported..
3024 if test "x$ac_cv_header_sys_capability_h" = "xno" -o \
3025 "x$ac_cv_lib_cap_cap_clear_flag" = "xno"; then
3026 # and it was forced on: error
3027 if test "x$with_libcap" = "xyes" ; then
3028 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
3030 # with_libcap is "auto"; it can't be supported. Disable.
3034 # header and lib are ok, we support
3040 SQUID_DEFINE_BOOL(USE_LIBCAP,$with_libcap,
3041 [use libcap to set capabilities required for TPROXY])
3042 AC_MSG_NOTICE([libcap support enabled: $with_libcap])
3043 SQUID_DEFINE_BOOL(LIBCAP_BROKEN,${squid_cv_sys_capability_works:=no},
3044 [libcap2 headers are broken and clashing with glibc])
3045 AC_MSG_NOTICE([libcap2 headers are ok: $squid_cv_sys_capability_works])
3048 dnl Check for needed libraries
3049 AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
3050 AC_SEARCH_LIBS([res_init],[resolv])
3051 AC_SEARCH_LIBS([__res_search],[resolv])
3052 AC_SEARCH_LIBS([bind],[socket])
3053 AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
3054 AC_SEARCH_LIBS([strlcpy], [bsd])
3055 AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
3056 dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
3057 if test "x$squid_host_os" = "xmingw" ; then
3058 SQUID_CHECK_WINSOCK_LIB
3064 #include <winsock2.h>
3067 #include <windows.h>
3070 #include <ws2tcpip.h>
3075 # check that we have unix sockets
3076 SQUID_CHECK_UNIX_SOCKET
3077 SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
3079 AC_CHECK_LIB(gnumalloc, malloc)
3080 if test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"; then
3081 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
3082 ac_cv_func_mallocblksize=no
3083 ac_cv_func_mallopt=no
3085 case "$squid_host_os" in
3087 AC_MSG_NOTICE([skipping libmalloc check for $host])
3090 AC_MSG_NOTICE([skipping libmalloc check for $host])
3094 AC_CHECK_LIB(malloc, main)
3099 case "$squid_host_os" in
3101 AC_MSG_NOTICE([Use MSVCRT for math functions.])
3104 dnl rint() and log() are only used in old C code for now.
3106 AC_SEARCH_LIBS([rint],[m])
3107 AC_SEARCH_LIBS([log],[m])
3112 dnl --with-maxfd present for compatibility with Squid-2.
3113 dnl undocumented in ./configure --help to encourage using the Squid-3 directive
3118 squid_filedescriptors_num=$withval
3119 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
3122 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
3127 AC_ARG_WITH(filedescriptors,
3128 AS_HELP_STRING([--with-filedescriptors=NUMBER],
3129 [Force squid to support NUMBER filedescriptors]),
3133 squid_filedescriptors_num=$withval
3134 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
3137 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
3142 SQUID_CHECK_DEFAULT_FD_SETSIZE
3144 if test "x$squid_filedescriptors_num" != "x"; then
3145 AC_MSG_NOTICE([Default number of fieldescriptors: $squid_filedescriptors_num])
3147 if test "$squid_filedescriptors_num" -lt 512 ; then
3148 AC_MSG_WARN([$squid_filedescriptors_num may not be enough filedescriptors if your])
3149 AC_MSG_WARN([cache will be very busy. Please see the FAQ page])
3150 AC_MSG_WARN([http://wiki.squid-cache.org/SquidFaq/TroubleShooting])
3151 AC_MSG_WARN([on how to increase your filedescriptor limit])
3153 AC_DEFINE_UNQUOTED(SQUID_MAXFD, $squid_filedescriptors_num,[Maximum number of open filedescriptors])
3156 dnl Enable IPv6 support
3157 AC_MSG_CHECKING([whether to enable IPv6])
3159 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
3160 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ipv6: $enableval])
3162 AC_MSG_RESULT(${enable_ipv6:=yes})
3163 SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
3165 if test "x$enable_ipv6" = "xyes" ; then
3166 SQUID_CHECK_SIN6_LEN_IN_SAI
3168 SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
3169 SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
3172 dnl Check for libdl, used by auth_modules/PAM
3173 if test "x$with_dl" = "xyes"; then
3174 AC_CHECK_LIB(dl, dlopen)
3177 dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
3178 dnl Robert Side <rside@aiinc.bc.ca>
3179 dnl Mon, 18 Jan 1999 17:48:00 GMT
3182 AC_CHECK_LIB(intl, strftime)
3187 dnl this is not fully functional if db.h is for a differend db version
3190 dnl check that dbopen is actually defined in the header
3191 dnl FIXME: in case of failure undef db-related includes etc.
3192 AC_CHECK_DECL(dbopen,,,[
3193 #if HAVE_SYS_TYPES_H
3194 #include <sys/types.h>
3206 SQUID_CHECK_DBOPEN_NEEDS_LIBDB
3207 if test "x$ac_cv_dbopen_libdb" = "xyes"; then
3212 dnl System-specific library modifications
3216 if test "x$GCC" = "xyes"; then
3217 AC_MSG_NOTICE([Removing -O for gcc on $host])
3218 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
3223 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
3224 LIBS=`echo $LIBS | sed -e s/-lsocket//`
3225 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
3226 LIBS=`echo $LIBS | sed -e s/-lnsl//`
3227 ac_cv_lib_nsl_main=no
3228 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
3229 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3231 dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
3232 dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
3233 dnl Please change your configure script. AIX doesn't need -lbsd.
3235 AC_MSG_NOTICE([Removing -lbsd for AIX...])
3236 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3238 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
3244 public:virtual ~Foo(){}
3246 class Bar:public Foo{
3247 public:Bar():Foo(){}
3250 Foo * myFoo=new Bar();
3251 Bar * myBar=dynamic_cast<Bar *>(myFoo);
3252 assert(myBar != NULL);
3254 if test "$ac_cv_require_rtti" = "yes"; then
3255 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
3256 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
3260 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
3262 if test "$ac_cv_require_qcpluscmt" = "yes"; then
3263 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
3268 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
3269 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
3270 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,
3271 [If gettimeofday is known to take only one argument])
3273 [*-*-solaris2.[0-4]])
3274 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
3276 [*-sony-newsos[56]*])
3277 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
3281 dnl This has to be before AC_CHECK_FUNCS
3282 # Disable poll() on certain platforms. Override by setting ac_cv_func_poll
3283 # when running configure.
3284 if test "x$ac_cv_func_poll" = "x" ; then
3288 AC_MSG_NOTICE([disabling poll for $host...])
3289 ac_cv_func_poll='no'
3292 # Henrik Nordstrom (hno@squid-cache.org) 19980817
3293 # poll is problematic on Linux. We disable it
3294 # by default until Linux gets it right.
3295 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
3296 if test $rev -lt 002002; then
3297 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
3298 ac_cv_func_poll='no'
3301 [powerpc-ibm-aix4.1.*])
3302 # Mike Laster (mlaster@metavillage.com) 19981021
3303 AC_MSG_NOTICE([disabling poll for $host...])
3304 ac_cv_func_poll='no'
3307 # Robert Side <rside@aiinc.bc.ca>
3308 # Mon, 18 Jan 1999 17:48:00 GMT
3309 AC_MSG_NOTICE([disabling poll for $host...])
3310 ac_cv_func_poll='no'
3315 dnl Check for library functions
3317 backtrace_symbols_fd \
3340 pthread_attr_setschedparam \
3341 pthread_attr_setscope \
3342 pthread_setschedparam \
3366 dnl ... and some we provide local replacements for
3375 AC_CHECK_DECLS([getaddrinfo,getnameinfo,inet_ntop,inet_pton,InetNtopA,InetPtonA],,,[
3377 * BSD requires sys/types.h, sys/socket.h, netinet/in.h, netdb.h, arpa/inet.h
3378 * Linux requires sys/types.h, sys/socket.h, arpa/inet.h
3379 * Windows requires sys/socket.h, winsock2.h, ws2tcpip.h
3381 #if HAVE_SYS_TYPES_H
3382 #include <sys/types.h>
3384 #if HAVE_NETINET_IN_H
3385 #include <netinet/in.h>
3387 #if HAVE_SYS_SOCKET_H
3388 #include <sys/socket.h>
3393 #if HAVE_ARPA_INET_H
3394 #include <arpa/inet.h>
3397 #include <winsock2.h>
3400 #include <ws2tcpip.h>
3404 # Magic which checks whether we are forcing a type of comm loop we
3405 # are actually going to (ab)use.
3406 # Mostly ripped from squid-commloops, thanks to adrian and benno
3408 if test "x$squid_opt_io_loop_engine" != "x"; then
3409 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine])
3410 elif test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes" ; then
3411 squid_opt_io_loop_engine="epoll"
3412 elif test "x$enable_kqueue" != "xno" ; then
3413 squid_opt_io_loop_engine="kqueue"
3414 elif test "x$enable_devpoll" != "xno" ; then
3415 squid_opt_io_loop_engine="devpoll"
3416 elif test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes" ; then
3417 squid_opt_io_loop_engine="poll"
3418 elif test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"; then
3419 squid_opt_io_loop_engine="select"
3420 elif test "x$enable_select" != "xno" -a "x$squid_host_os" = "xmingw"; then
3421 squid_opt_io_loop_engine="select_win32"
3423 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
3424 AC_MSG_WARN([Will try select and hope for the best.])
3425 squid_opt_io_loop_engine="select"
3428 AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
3430 AM_CONDITIONAL(ENABLE_POLL, test "x$squid_opt_io_loop_engine" = "xpoll")
3431 AM_CONDITIONAL(ENABLE_EPOLL, test "x$squid_opt_io_loop_engine" = "xepoll")
3432 AM_CONDITIONAL(ENABLE_SELECT, test "x$squid_opt_io_loop_engine" = "xselect")
3433 AM_CONDITIONAL(ENABLE_SELECT_WIN32, test "x$squid_opt_io_loop_engine" = "xselect_win32")
3434 AM_CONDITIONAL(ENABLE_KQUEUE, test "x$squid_opt_io_loop_engine" = "xkqueue")
3435 AM_CONDITIONAL(ENABLE_DEVPOLL, test "x$squid_opt_io_loop_engine" = "xdevpoll")
3437 case $squid_opt_io_loop_engine in
3438 epoll) AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop]) ;;
3439 devpoll) AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop]) ;;
3440 poll) AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop]) ;;
3441 kqueue) AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop]) ;;
3442 select_win32) AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop]) ;;
3443 select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
3446 if test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes" ; then
3447 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
3450 SQUID_CHECK_SETRESUID_WORKS
3451 if test "x$squid_cv_resuid_works" = "xyes" ; then
3452 AC_DEFINE(HAVE_SETRESUID,1,[Yay! Another Linux brokenness. Knowing that setresuid() exists is not enough, because RedHat 5.0 declares setresuid() but does not implement it.])
3455 AC_CHECK_HEADERS(mswsock.h)
3456 AC_MSG_CHECKING([for constant CMSG_SPACE])
3457 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3458 #if HAVE_SYS_SOCKET_H
3459 #include <sys/socket.h>
3462 #include <mswsock.h>
3465 int a[CMSG_SPACE(int)];
3468 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
3473 AC_CHECK_TYPE(struct cmsghdr,AC_DEFINE(HAVE_CMSGHDR,1,[The system provides struct cmsghdr]),,[
3474 #if HAVE_SYS_SOCKET_H
3475 #include <sys/socket.h>
3478 #include <mswsock.h>
3481 #include <winsock2.h>
3485 AC_CHECK_TYPE(struct iovec,AC_DEFINE(HAVE_IOVEC,1,[The system provides struct iovec]),,[
3486 #if HAVE_SYS_SOCKET_H
3487 #include <sys/socket.h>
3490 #include <winsock2.h>
3493 #include <sys/uio.h>
3497 AC_CHECK_TYPE(struct msghdr,AC_DEFINE(HAVE_MSGHDR,1,[The system provides struct msghdr]),,[
3498 #if HAVE_SYS_SOCKET_H
3499 #include <sys/socket.h>
3502 #include <mswsock.h>
3505 #include <winsock2.h>
3509 AC_CHECK_TYPE(struct sockaddr_un,AC_DEFINE(HAVE_SOCKADDR_UN,1,[The system provides sockaddr_un]),,[
3513 #if HAVE_SYS_SOCKET_H
3514 #include <sys/socket.h>
3517 #include <winsock2.h>
3521 SQUID_CHECK_FUNC_STRNSTR
3522 SQUID_CHECK_FUNC_VACOPY
3523 SQUID_CHECK_FUNC___VACOPY
3525 dnl IP-Filter support requires ipf header files. These aren't
3526 dnl installed by default, so we need to check for them
3527 if test "x$enable_ipf_transparent" != "xno" ; then
3528 SQUID_CHECK_BROKEN_SOLARIS_IPFILTER
3529 AC_MSG_CHECKING(for availability of IP-Filter header files)
3530 # hold on to your hats...
3531 if test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
3532 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
3533 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
3534 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes" ; then
3535 have_ipfilter_compat_header="yes"
3537 if test "x$have_ipfilter_compat_header" = "xyes" -a \
3538 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
3539 "x$ac_cv_header_ip_nat_h" = "xyes" ; then
3540 enable_ipf_transparent="yes"
3541 elif test "x$have_ipfilter_compat_header" = "xyes" -a \
3542 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
3543 "x$ac_cv_header_netinet_ip_nat_h" = "xyes" ; then
3544 enable_ipf_transparent="yes"
3546 enable_ipf_transparent="no"
3548 AC_MSG_RESULT($IPF_TRANSPARENT)
3550 ## On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3551 ## Solaris minor version (8, 9, 10, ...)
3552 if test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris" ; then
3553 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3554 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3555 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
3559 AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
3560 SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
3561 [Enable support for IPF-style transparent proxying])
3563 dnl PF /dev/pf support requires a header file.
3564 if test "x$with_nat_devpf" != "xno" ; then
3565 if test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
3566 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"; then
3567 if test "x$with_nat_devpf" = "xauto" ; then
3571 if test "x$with_nat_devpf" = "xyes" ; then
3572 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
3577 SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
3578 [Enable support for PF-style transparent proxying])
3579 SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
3580 [Enable support for /dev/pf NAT lookups])
3582 if test "x$enable_linux_netfilter" != "xno" ; then
3583 if test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"; then
3584 if test "x$enable_linux_netfilter" = "xauto" ; then
3585 enable_linux_netfilter=yes
3588 if test "x$enable_linux_netfilter" = "xauto" ; then
3589 enable_linux_netfilter=no
3591 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
3595 SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
3596 [Enable support for Transparent Proxy on Linux via Netfilter])
3598 dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
3599 AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
3600 if test "x$enable_linux_netfilter" = "xyes" -a "x$with_libcap" != "xyes" ; then
3601 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
3602 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
3603 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
3607 if test "x$squid_opt_netfilterconntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3608 AC_MSG_ERROR([Linux netfilter conntrack requires libcap support (libcap 2.09+)])
3610 if test "x$with_netfilter_conntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3611 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
3612 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
3613 with_netfilter_conntrack=no
3615 AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack} ${squid_opt_netfilterconntrackpath}])
3618 AC_ARG_ENABLE(zph-qos,
3619 AS_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]), [
3620 SQUID_YESNO([$enableval],
3621 [unrecognized argument to --enable-zph-qos: $enableval])
3623 SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
3624 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
3625 TOS field of HIT responses to help policing network traffic])
3626 AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
3627 if test x"$enable_zph_qos" = "xyes" ; then
3628 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
3629 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
3630 [Enable support for QOS netfilter mark preservation])
3634 AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
3635 AC_ARG_ENABLE(gnuregex,
3636 AS_HELP_STRING([--enable-gnuregex],
3637 [Compile GNUregex. Unless you have reason to use
3638 this option, you should not enable it.
3639 This library file is usually only required on Windows and
3640 very old Unix boxes which do not have their own regex
3641 library built in.]), [
3642 SQUID_YESNO([$enableval],[unrecognized argument to --enable-gnuregex: $enableval])
3644 # force-enable on old solaris and nextstep
3645 if test "x${enable_gnuregex:=auto}" = "xauto" ; then
3647 *-sun-solaris2.[[0-4]])
3648 enable_gnuregex="yes"
3651 enable_gnuregex="yes"
3656 # try detecting if it is needed
3657 if test "x$enable_gnuregex" = "xauto" ; then
3658 SQUID_CHECK_REGEX_WORKS
3659 if test "x$squid_cv_regex_works" = "xyes" ; then
3665 AC_MSG_CHECKING(if GNUregex needs to be compiled)
3666 AC_MSG_RESULT($enable_gnuregex)
3667 if test "x$enable_gnuregex" = "xyes"; then
3668 # for some reason (force-enable, test..) gnuregex was found as needed. Override any system lib
3671 #if no reason was found to enable gnuregex, disable it
3672 if test "x$enable_gnuregex" = "xauto" ; then
3675 SQUID_DEFINE_BOOL(USE_GNUREGEX,$enable_gnuregex,[Define if we should use GNU regex])
3678 SQUID_DETECT_UDP_SND_BUFSIZE
3679 SQUID_DETECT_UDP_RECV_BUFSIZE
3680 SQUID_DETECT_TCP_SND_BUFSIZE
3681 SQUID_DETECT_TCP_RECV_BUFSIZE
3683 SQUID_CHECK_RECV_ARG_TYPE
3684 SQUID_CHECK_NEED_SYS_ERRLIST
3685 SQUID_CHECK_MAXPATHLEN
3687 SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
3688 SQUID_CHECK_RESOLVER_FIELDS
3690 AC_CHECK_HEADERS(sys/statvfs.h)
3691 if test "x$ac_cv_header_sys_statvfs_h" = "xyes" ; then
3692 SQUID_CHECK_WORKING_STATVFS
3694 if test "x$ac_cv_func_statvfs" != "xyes" ; then
3695 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/vfs.h sys/statfs.h)
3696 AC_CHECK_FUNCS(statfs)
3697 SQUID_CHECK_F_FRSIZE_IN_STATFS
3700 dnl Squid will not usually attempt to translate templates when building
3701 AC_ARG_ENABLE(translation,
3702 AS_HELP_STRING([--enable-translation],[Generate the localized error page templates and manuals.
3703 Which can also be downloaded from http://www.squid-cache.org/Versions/langpack/.]), [
3704 SQUID_YESNO([$enableval],
3705 [unrecognized argument to --enable-translation: $enableval])
3707 if test "x${enable_translation:=no}" = "xyes" ; then
3708 AX_WITH_PROG([PO2HTML],[po2html])
3709 AX_WITH_PROG([PO2TEXT],[po2txt])
3717 dnl Squid now has limited locale handling ...
3719 AC_ARG_ENABLE(auto-locale,
3720 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
3721 clients request headers.
3722 When disabled Squid requires explicit language configuration.]), [
3723 SQUID_YESNO([$enableval],
3724 [unrecognized argument to --disable-auto-locale: $enableval])
3726 AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
3727 SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
3728 [Use multi-language support on error pages])
3731 dnl Need the debugging version of malloc if available
3733 if test "x$ac_cv_lib_malloc_main" = "xyes" ; then
3734 if test -r /usr/lib/debug/malloc.o ; then
3735 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3737 if test -r /usr/lib/debug/mallocmap.o ; then
3738 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3743 if test "x$XTRA_LIBS" = "x"; then
3746 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
3751 AC_SUBST(SQUID_CFLAGS)
3752 AC_SUBST(SQUID_CXXFLAGS)
3754 AC_ARG_VAR([BUILDCXXFLAGS],[C++ compiler flags for building compile-time tools. e.g. cf_gen])
3755 if test "x$BUILDCXXFLAGS" = "x"; then
3756 # if we are NOT cross-compiling, use the default build flags for cf_gen and friends
3757 # otherwise rely on the user-provided value
3758 if test "x$squid_cv_check_marchnative" = "xyes"; then
3759 # always valid for the Build compiler.
3760 BUILDCXXFLAGS="-march=native"
3762 BUILDCXXFLAGS="$BUILDCXXFLAGS $CXXFLAGS"
3764 AC_SUBST(BUILDCXXFLAGS)
3766 AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
3767 AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
3768 AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
3769 AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
3770 AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
3771 AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
3772 AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
3773 AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
3774 AC_MSG_NOTICE([BUILD Tools C++ FLAGS: $BUILDCXXFLAGS])
3776 dnl Clean up after OSF/1 core dump bug
3784 doc/manuals/Makefile
3785 doc/release-notes/Makefile
3789 lib/libTrie/Makefile
3790 lib/libTrie/test/Makefile
3791 lib/ntlmauth/Makefile
3792 lib/profiler/Makefile
3795 lib/snmplib/Makefile
3799 src/acl/external/Makefile
3800 src/acl/external/AD_group/Makefile
3801 src/acl/external/delayer/Makefile
3802 src/acl/external/eDirectory_userip/Makefile
3803 src/acl/external/file_userip/Makefile
3804 src/acl/external/kerberos_ldap_group/Makefile
3805 src/acl/external/LDAP_group/Makefile
3806 src/acl/external/LM_group/Makefile
3807 src/acl/external/session/Makefile
3808 src/acl/external/SQL_session/Makefile
3809 src/acl/external/unix_group/Makefile
3810 src/acl/external/wbinfo_group/Makefile
3811 src/acl/external/time_quota/Makefile
3812 src/adaptation/Makefile
3813 src/adaptation/icap/Makefile
3814 src/adaptation/ecap/Makefile
3817 src/auth/basic/Makefile
3818 src/auth/basic/DB/Makefile
3819 src/auth/basic/fake/Makefile
3820 src/auth/basic/getpwnam/Makefile
3821 src/auth/basic/LDAP/Makefile
3822 src/auth/basic/NCSA/Makefile
3823 src/auth/basic/NIS/Makefile
3824 src/auth/basic/PAM/Makefile
3825 src/auth/basic/POP3/Makefile
3826 src/auth/basic/RADIUS/Makefile
3827 src/auth/basic/SASL/Makefile
3828 src/auth/basic/SMB/Makefile
3829 src/auth/basic/SMB_LM/Makefile
3830 src/auth/basic/SSPI/Makefile
3831 src/auth/digest/Makefile
3832 src/auth/digest/eDirectory/Makefile
3833 src/auth/digest/file/Makefile
3834 src/auth/digest/LDAP/Makefile
3835 src/auth/negotiate/Makefile
3836 src/auth/negotiate/kerberos/Makefile
3837 src/auth/negotiate/SSPI/Makefile
3838 src/auth/negotiate/wrapper/Makefile
3839 src/auth/ntlm/Makefile
3840 src/auth/ntlm/fake/Makefile
3841 src/auth/ntlm/SMB_LM/Makefile
3842 src/auth/ntlm/SSPI/Makefile
3844 src/clients/Makefile
3848 src/DiskIO/AIO/Makefile
3849 src/DiskIO/Blocking/Makefile
3850 src/DiskIO/DiskDaemon/Makefile
3851 src/DiskIO/DiskThreads/Makefile
3852 src/DiskIO/IpcIo/Makefile
3853 src/DiskIO/Mmapped/Makefile
3861 src/http/one/Makefile
3862 src/http/url_rewriters/Makefile
3863 src/http/url_rewriters/fake/Makefile
3864 src/http/url_rewriters/LFS/Makefile
3871 src/log/file/Makefile
3877 src/security/Makefile
3878 src/security/cert_generators/Makefile
3879 src/security/cert_generators/file/Makefile
3880 src/security/cert_validators/Makefile
3881 src/security/cert_validators/fake/Makefile
3882 src/servers/Makefile
3886 src/store/id_rewriters/Makefile
3887 src/store/id_rewriters/file/Makefile
3890 tools/helper-mux/Makefile
3891 tools/purge/Makefile
3892 tools/squidclient/Makefile
3893 tools/systemd/Makefile
3894 tools/sysvinit/Makefile
3897 # must configure libltdl subdir unconditionally for "make distcheck" to work
3898 #AC_CONFIG_SUBDIRS(libltdl)