1 AC_INIT([Squid Web Proxy],[3.HEAD-BZR],[http://bugs.squid-cache.org/],[squid])
3 AC_CONFIG_HEADERS([include/autoconf.h])
4 AC_CONFIG_AUX_DIR(cfgaux)
5 AC_CONFIG_SRCDIR([src/main.cc])
6 AM_INIT_AUTOMAKE([tar-ustar nostdinc])
7 AC_REVISION($Revision$)dnl
8 AC_PREFIX_DEFAULT(/usr/local/squid)
11 m4_include([acinclude/init.m4])
12 m4_include([acinclude/squid-util.m4])
13 m4_include([acinclude/compiler-flags.m4])
14 m4_include([acinclude/os-deps.m4])
15 m4_include([acinclude/krb5.m4])
16 m4_include([acinclude/pam.m4])
17 m4_include([acinclude/pkg.m4])
18 m4_include([acinclude/lib-checks.m4])
19 m4_include([acinclude/ax_cxx_compile_stdcxx_0x.m4])
20 m4_include([acinclude/ax_cxx_0x_types.m4])
22 PRESET_CFLAGS="$CFLAGS"
23 PRESET_CXXFLAGS="$CXXFLAGS"
24 PRESET_LDFLAGS="$LDFLAGS"
26 dnl Set default LDFLAGS
27 if test "x$LDFLAGS" = "x" ; then
38 # Clang 3.2 on some CPUs requires -march-native to detect correctly
39 # GCC 4.3+ can also produce faster executables when its used
40 SQUID_CC_CHECK_ARGUMENT([squid_cv_check_marchnative],[-march=native])
42 # might be cross-compiling.
43 if test "x$HOSTCXX" = "x"; then
45 if test "x$squid_cv_check_marchnative" = "xyes"; then
46 CXXFLAGS="$CXXFLAGS -march=native"
49 if test "x$squid_cv_check_marchnative" = "xyes"; then
50 # always valid for the Host compiler.
51 HOSTCXX="$HOSTCXX -march=native"
55 AC_MSG_CHECKING([simplified host os])
56 simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
57 squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
58 if test -n "$squid_host_os_version"; then
59 squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
61 squid_host_os="$simple_host_os"
63 AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
64 # on windows squid_host_os is either mingw or cygwin, version is 32
66 # this needs to be before any test is run, to have more standard
67 # functions available on some Unix sysems (e.g. Solaris)
68 if test "x$squid_host_os" = "solaris" -a "x$GCC" != "x" ; then
69 AC_USE_SYSTEM_EXTENSIONS
72 # Check for C++0x compiler support
73 AX_CXX_COMPILE_STDCXX_0X
74 if test "x$ax_cv_cxx_compile_cxx0x_cxx" = "xyes" ; then
75 #BUG 3613: when clang -std=c++0x is used, it activates a "strict mode"
76 # in the system libraries, which makes some c99 methods unavailable
77 # (e.g. strtoll), yet configure detects them as avilable.
79 *clang++*) ;; #do nothing
80 *) CXXFLAGS="$CXXFLAGS -std=c++0x" ;;
91 AC_PATH_PROG(SH, sh, /bin/sh)
92 AC_PATH_PROG(FALSE, false, /usr/bin/false)
93 AC_PATH_PROG(TRUE, true, /usr/bin/true)
94 AC_PATH_PROG(MV, mv, $FALSE)
95 AC_PATH_PROG(MKDIR, mkdir, $FALSE)
96 AC_PATH_PROG(LN, ln, cp)
97 AC_PATH_PROG(CHMOD, chmod, $FALSE)
98 AC_PATH_PROG(TR, tr, $FALSE)
99 AC_PATH_PROG(RM, rm, $FALSE)
100 AC_PATH_PROG(CPPUNITCONFIG, cppunit-config, false)
101 dnl Libtool 2.2.6 requires: rm -f
104 AC_PATH_PROG(PERL, perl, none)
105 if test "x$ac_cv_path_PERL" = "xnone"; then
106 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
108 AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
110 dnl set $(AR) if not provided by the build environment
111 if test "x$AR" = "x"; then
112 AC_PATH_PROG(AR, ar, $FALSE)
117 # pre-define DEFAULT_PREFIX, some modules need it.
118 if test "${prefix}" = "NONE" ; then
119 squid_prefix=$ac_default_prefix
123 AC_DEFINE_UNQUOTED(DEFAULT_PREFIX,[$squid_prefix],[The install prefix])
125 AC_ARG_ENABLE(strict-error-checking,
126 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
127 with all possible static compiler error-checks enabled.
128 This flag disables the behavior]), [
129 SQUID_YESNO([$enableval],
130 [Unrecognized argument to --disable-strict-error-checking: $enableval])
132 AC_MSG_NOTICE([strict error checking enabled: ${enable_strict_error_checking:=yes}])
134 AC_MSG_CHECKING(whether to use loadable modules)
135 AC_ARG_ENABLE(loadable-modules,
136 AS_HELP_STRING([--disable-loadable-modules],[do not support loadable modules]) , [
137 SQUID_YESNO([$enableval],
138 [Unrecognized argument to --disable-loadable-modules: $enableval])
140 AM_CONDITIONAL(USE_LOADABLE_MODULES, test "x${enable_loadable_modules:=yes}" = "xyes")
141 AC_MSG_RESULT([$enable_loadable_modules])
143 if test "x$enable_loadable_modules" = "xyes";
145 AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules])
151 # LT_INIT requires libtool v2, might as well state it loud
153 LT_INIT([dlopen],[disable-shared])
154 if ! test "${ac_top_build_prefix}" = "";
156 # LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
157 # But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
158 # This fixes Linux LTDLv3-v7, and BSD LTDL v2.2
159 top_build_prefix=${ac_top_build_prefix}
160 AC_SUBST(top_build_prefix)
164 dnl LibTool environment is now prepared for setup. Check that it is usable and initialize.
167 # Do we need these unconditionally for "make distcheck" to work?
171 if test "x$enable_loadable_modules" = "xyes";
173 # Why is this needed? Should not LT_INIT (or LT_LIB_DLLOAD) from libtool do that?
174 LIBADD_DL=${lt_cv_dlopen_libs}
175 AC_SUBST([LIBADD_DL])
178 SQUID_CC_GUESS_VARIANT
179 SQUID_CC_GUESS_OPTIONS
181 dnl find out the exe extension for this platform.
182 dnl If it is not empty, use it for CGI as well.
186 if test "x$EXEEXT" = "x" ; then
189 # automake automatically adds .exe when installing binaries
194 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,
195 [test "x$squid_host_os" = "xmingw" -o "x$squid_host_os" = "xcygwin"])
196 AM_CONDITIONAL(USE_IPC_WIN32,[test "x$squid_host_os" = "xmingw"])
198 if test "x$squid_host_os" = "xmingw"; then
199 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
200 CFLAGS="$CFLAGS -mthreads"
201 CXXFLAGS="$CXXFLAGS -mthreads"
202 if test "x$ac_cv_path_WIN32_PSAPI" = "xnone"; then
203 AC_MSG_NOTICE([PSAPI.DLL is recommended to run Squid on Windows NT Platform])
204 AC_MSG_NOTICE([Please see PSAPI.DLL section on doc/win32-relnotes.html.])
206 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
209 MINGW_LIBS="-lmingwex"
214 AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
216 AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args",
217 [configure command line used to configure Squid])
219 CACHE_EFFECTIVE_USER="nobody"
220 AC_ARG_WITH(default-user,
221 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
222 [ CACHE_EFFECTIVE_USER="$withval" ]
224 AC_SUBST(CACHE_EFFECTIVE_USER)
226 DEFAULT_LOG_DIR="$localstatedir/logs"
228 AS_HELP_STRING([--with-logdir=PATH],
229 [Default location for squid logs. default: PREFIX/var/logs]), [
232 AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH )
235 DEFAULT_LOG_DIR="$withval"
240 AC_SUBST(DEFAULT_LOG_DIR)
242 DEFAULT_PID_FILE="$localstatedir/run/squid.pid"
244 AS_HELP_STRING([--with-pidfile=PATH],
245 [Default location for squid pid file. Default: PREFIX/var/run/squid.pid]), [
248 AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH )
251 DEFAULT_PID_FILE="$withval"
255 AC_SUBST(DEFAULT_PID_FILE)
257 DEFAULT_SWAP_DIR="$localstatedir/cache/squid"
259 AS_HELP_STRING([--with-swapdir=PATH],
260 [Default location for squid cache directories. Default: PREFIX/var/cache/squid]), [
263 AC_MSG_ERROR( --with-swapdir requires a directory PATH. --with-swapdir=PATH )
266 DEFAULT_SWAP_DIR="$withval"
270 AC_SUBST(DEFAULT_SWAP_DIR)
272 if test "$squid_cv_compiler" = "gcc"; then
273 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
274 GCCVER2=`echo $GCCVER | awk '{print $1 * 100}'`
277 if test $GCCVER2 -lt 300 ; then
278 AC_MSG_FAILURE([GCC $GCCVER causes a coredump on $host.
279 Please use a more recent GCC version])
287 dnl Set Default CFLAGS
288 if test "x$PRESET_CFLAGS" = "x"; then
289 if test "$squid_cv_compiler" = "gcc"; then
292 # sunos has too many warnings for this to be useful
296 # Motorola cc/ld does not like -02 but is ok on -O
297 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
300 CFLAGS="$squid_cv_cc_option_wall $CFLAGS"
306 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
307 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
308 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
309 -Wl,-woff,85,-woff,84,-woff,134 \
310 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
311 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
312 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
313 -Wl,-woff,85,-woff,84,-woff,134 \
314 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
322 dnl set squid required flags
323 if test "$squid_cv_compiler" = "gcc"; then
324 case "$squid_host_os" in
326 dnl Guido Serassio (serassio@squid-cache.org) 20070811
327 dnl Using the latest MinGW (gcc 3.4.5 + mingw-runtime 3.13) cannot build with
328 dnl -Werror -Wmissing-prototypes -Wmissing-declarations
329 dnl TODO: check if the problem will be present in any other newer MinGW release.
330 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow"
333 # FreeBSD places local libraries and packages in /usr/local
334 CFLAGS="$CFLAGS -I/usr/local/include"
335 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
336 LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-R/usr/local/lib"
339 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow"
342 SQUID_CXXFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow"
348 if test "x$enable_strict_error_checking" != "xno"; then
349 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
350 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
353 # squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
354 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
355 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
357 # possibly include some build info tag into squid -v
358 SQUID_EMBED_BUILD_INFO
360 AC_ARG_ENABLE(optimizations,
361 AS_HELP_STRING([--disable-optimizations],
362 [Do not compile Squid with compiler optimizations enabled.
363 Optimization is good for production builds, but not
364 good for debugging. During development, use
365 --disable-optimizations to reduce compilation times
366 and allow easier debugging. This option implies
367 --disable-inline]), [
368 if test "x$enableval" = "xno" ; then
369 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
370 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
371 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`"
376 AH_TEMPLATE(_USE_INLINE_,[Include inline methods into header file])
377 AC_ARG_ENABLE(inline,
378 AS_HELP_STRING([--disable-inline],
379 [Do not compile trivial methods as inline. Squid
380 is coded with much of the code able to be inlined.
381 Inlining is good for production builds, but not
382 good for development. During development, use
383 --disable-inline to reduce compilation times and
384 allow incremental builds to be quick. For
385 production builds, or load tests, use
386 --enable-inline to have squid make all trivial
387 methods inlinable by the compiler.]), [
388 SQUID_YESNO([$enableval],
389 [Unrecognized argument to --disable-inline: $enableval])
391 AC_MSG_NOTICE([inlining optimizations enabled: ${enable_inline:=yes}])
392 SQUID_DEFINE_BOOL(_USE_INLINE_,$enable_inline,
393 [Include inline methods into header file])
394 # to be used by sub-commands
398 dnl Check for atomic operations support in the compiler
400 AC_MSG_CHECKING([for GNU atomic operations support])
401 AC_RUN_IFELSE([AC_LANG_PROGRAM([[
404 __sync_add_and_fetch(&n, 10); // n becomes 10
405 __sync_fetch_and_add(&n, 20); // n becomes 30
406 __sync_sub_and_fetch(&n, 15); // n becomes 15
407 __sync_bool_compare_and_swap(&n, 15, 201); // n becomes 201
408 __sync_fetch_and_and(&n, 200); // n becomes 200
409 return (n == 200) ? 0 : -1;
412 AC_DEFINE(HAVE_ATOMIC_OPS,1,[Define to 1 if you have __sync_add_and_fetch() and such])
419 AC_ARG_ENABLE(debug-cbdata,
420 AS_HELP_STRING([--enable-debug-cbdata],
421 [Provide some debug information in cbdata]), [
422 SQUID_YESNO([$enableval],
423 [unrecognized argument to --enable-debug-cbdata: $enableval])
425 SQUID_DEFINE_BOOL(USE_CBDATA_DEBUG,${enable_debug_cbdata:=no},
426 [Enable support for cbdata debug information])
427 AC_MSG_NOTICE([cbdata debugging enabled: $enable_debug_cbdata])
430 dnl Nasty hack to get autoconf 2.64 on Linux to run.
431 dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
432 AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[:])
434 dnl This is a developer only option.. developers know how to set defines
436 dnl AC_ARG_ENABLE(xmalloc-debug,
437 dnl [ --enable-xmalloc-debug Do some simple malloc debugging],
438 dnl [ if test "$enableval" = "yes" ; then
439 dnl AC_MSG_NOTICE([malloc debugging enabled])
440 dnl AC_DEFINE(XMALLOC_DEBUG,1,[Define to do simple malloc debugging])
444 dnl This is a developer only option.. developers know how to set defines
446 dnl AC_ARG_ENABLE(xmalloc-debug-trace,
447 dnl [ --enable-xmalloc-debug-trace
448 dnl Detailed trace of memory allocations],
449 dnl [ if test "$enableval" = "yes" ; then
450 dnl AC_MSG_NOTICE([malloc debug trace enabled])
451 dnl AC_DEFINE(XMALLOC_TRACE,1,[Define to have a detailed trace of memory allocations])
452 dnl AC_DEFINE(XMALLOC_DEBUG,1)
456 AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
457 AC_ARG_ENABLE(xmalloc-statistics,
458 AS_HELP_STRING([--enable-xmalloc-statistics],
459 [Show malloc statistics in status page]), [
460 SQUID_YESNO([$enableval],
461 [unrecognized argument to --enable-xmalloc-statistics: $enableval])
463 SQUID_DEFINE_BOOL(XMALLOC_STATISTICS,${enable_xmalloc_statistics:=no},
464 [Show malloc statistics in status page])
465 AC_MSG_NOTICE([xmalloc stats display: $enable_xmalloc_statistics])
467 squid_opt_aufs_threads=""
468 AC_ARG_WITH(aufs-threads,
469 AS_HELP_STRING([--with-aufs-threads=N_THREADS],
470 [Tune the number of worker threads for the aufs object store.]), [
473 squid_opt_aufs_threads=$withval
476 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
480 if test "x$squid_opt_aufs_threads" != "x"; then
481 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
482 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
483 [Defines how many threads aufs uses for I/O])
486 AC_ARG_WITH(dl, AS_HELP_STRING([--with-dl],[Use dynamic linking]))
487 if test "x$with_dl" = "xyes"; then
488 AC_MSG_NOTICE([With dl])
491 AC_SEARCH_LIBS([shm_open], [rt])
492 if test "x$ac_cv_search_shm_open" != "xno" ; then
493 AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
496 AC_MSG_CHECKING([for DiskIO modules to be enabled])
497 squid_disk_module_candidates=""
498 squid_opt_enable_diskio="auto" #values: no, yes, "auto"(=yes+detect modules)
499 AC_ARG_ENABLE(disk-io,
500 AS_HELP_STRING([--enable-disk-io="list of modules"],
501 [Build support for the list of disk I/O modules.
502 Set without a value or omitted, all available modules will be built.
503 See src/DiskIO for a list of available modules, or
504 Programmers Guide section on DiskIO
505 for details on how to build your custom disk module]), [
509 #do nothing, "auto" is ok
512 squid_opt_enable_diskio="no"
515 squid_opt_enable_diskio="yes"
516 squid_disk_module_candidates=" `echo $enableval| sed -e 's/,/ /g;s/ */ /g'` "
517 SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
522 # if requested to autodetect, find out what we have
523 if test "x$squid_opt_enable_diskio" = "xauto"; then
524 squid_opt_enable_diskio="yes"
525 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
526 if test "x$ac_cv_search_shm_open" = "xno" ; then
528 squid_disk_module_candidates=`echo $squid_disk_module_candidates|sed 's/IpcIo//'`
532 AC_MSG_RESULT([${squid_disk_module_candidates:-none}])
533 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
534 SQUID_DEFINE_BOOL(USE_DISKIO,$squid_opt_enable_diskio,
535 [DiskIO modules are expected to be available.])
539 dnl Some autoconf.h defines we might enable later...
540 AC_ARG_WITH(pthreads,AS_HELP_STRING([--without-pthreads],[Disable POSIX Threads]))
541 AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO. Default: auto-detect]))
542 AH_TEMPLATE(USE_DISKIO_AIO, [Whether POSIX AIO support is needed. Automatic])
543 AH_TEMPLATE(USE_DISKIO_DISKTHREADS, [Whether pthreads support is needed. Automatic])
546 squid_opt_use_diskthreads=
549 dnl Setup the module paths etc.
554 for module in $squid_disk_module_candidates none; do
556 if test "x$module" = "xnone"; then
559 if ! test -d "$srcdir/src/DiskIO/$module"; then
560 AC_MSG_ERROR(disk-io $module does not exist)
564 case "$squid_host_os" in
566 AC_MSG_NOTICE(["DiskDaemon not supported on MinGW"])
569 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
570 DISK_LIBS="$DISK_LIBS libDiskDaemon.a"
571 DISK_MODULES="$DISK_MODULES DiskDaemon"
572 DISK_PROGRAMS="$DISK_PROGRAMS DiskIO/DiskDaemon/diskd"
573 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskDaemon/DiskDaemonDiskIOModule.o"
578 squid_opt_use_diskthreads="yes"
580 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
581 if test "x$with_pthreads" != "xno"; then
582 dnl TODO: this needs to be extended to handle more systems and better
583 dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
584 dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
585 case "$squid_host_os" in
588 AC_MSG_NOTICE([Windows threads support automatically enabled])
591 if test `echo "$squid_host_os_version" | cut -b1` -lt 7 ; then
592 AC_MSG_NOTICE(pthread library requires FreeBSD 7 or later)
593 squid_opt_use_diskthreads="no"
595 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
596 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
597 if test "x$GCC" = "xyes" -a "x$PRESET_LDFLAGS" = "x" ; then
598 LDFLAGS="$LDFLAGS -pthread"
603 if test `echo "$squid_host_os_version" | tr -d .` -lt 52 ; then
604 AC_MSG_NOTICE(pthread library requires OpenBSD 5.2 or later)
605 squid_opt_use_diskthreads="no"
607 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
608 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
609 LDFLAGS="$LDFLAGS -lpthread"
613 if test "x$GCC" = "xyes" ; then
614 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
615 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
616 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
617 AC_MSG_NOTICE(pthread library required but cannot be found.)
618 squid_opt_use_diskthreads="no"
621 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
622 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
623 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
624 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
625 LIBPTHREADS="" #in LIBS
627 AC_MSG_NOTICE(pthread library required but cannot be found.)
628 squid_opt_use_diskthreads="no"
633 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
634 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
635 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
636 AC_MSG_NOTICE(pthread library required but cannot be found.)
637 squid_opt_use_diskthreads="no"
642 AC_MSG_NOTICE([Native pthreads support manually disabled.])
643 squid_opt_use_diskthreads="no"
645 if test "x$squid_opt_use_diskthreads" = "xyes" ; then
646 AC_DEFINE(USE_DISKIO_DISKTHREADS, 1, [Whether pthreads support is needed. Automatic])
647 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
648 DISK_LIBS="$DISK_LIBS libDiskThreads.a"
649 DISK_OS_LIBS="$DISK_OS_LIBS $LIBPTHREADS"
650 DISK_MODULES="$DISK_MODULES DiskThreads"
651 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskThreads/DiskThreadsDiskIOModule.o"
653 AC_DEFINE(USE_DISKIO_DISKTHREADS, 0, [Whether pthreads support is needed. Automatic])
654 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
655 SQUID_STATE_ROLLBACK([diskthreads_state])
660 dnl Check for POSIX AIO availability
661 squid_opt_use_aio="yes"
663 if test "x$with_aio" != "xno"; then
665 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
666 dnl On some systems POSIX AIO functions are in librt
667 dnl On some systems POSIX AIO functions are in libaio
668 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
669 dnl Enable AIO if the library and headers are found
670 if test "x$AIOLIB" != "x" && test "x$have_aio_header" = "xyes"; then
671 AC_MSG_NOTICE([Native POSIX AIO support detected.])
672 squid_opt_use_aio="yes"
674 dnl Windows does things differently. We provide wrappers.
675 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
676 case "$squid_host_os" in
678 squid_opt_use_aio="yes"
679 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
682 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
683 squid_opt_use_aio="no"
688 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
689 squid_opt_use_aio="no"
691 dnl Use the POSIX AIO pieces if we actually need them.
692 if test "x$squid_opt_use_aio" = "xyes" ; then
693 AC_DEFINE(USE_DISKIO_AIO, 1, [Whether POSIX AIO support is needed. Automatic])
694 DISK_MODULES="$DISK_MODULES AIO"
695 DISK_LIBS="$DISK_LIBS libAIO.a"
696 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/AIO/AIODiskIOModule.o"
697 case "$squid_host_os" in
700 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
703 AC_MSG_NOTICE([Enabling AIO DiskIO module])
704 DISK_OS_LIBS="$DISK_OS_LIBS $AIOLIB"
708 AC_DEFINE(USE_DISKIO_AIO, 0, [Whether POSIX AIO support is needed. Automatic])
709 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
714 dnl TODO: use availability of sys/mman.h and/or mmap to define
715 dnl OR support windows mmap functions
716 if test "x$squid_host_os" = "xmingw" ; then
717 AC_MSG_NOTICE([Mmapped DiskIO is not available on Mingw])
719 AC_MSG_NOTICE([Enabling Mmapped DiskIO module])
720 DISK_LIBS="$DISK_LIBS libMmapped.a"
721 DISK_MODULES="$DISK_MODULES Mmapped"
722 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/Mmapped/MmappedDiskIOModule.o"
727 AC_MSG_NOTICE([Enabling IpcIo DiskIO module])
728 if test "x$ac_cv_search_shm_open" = "xno" ; then
729 AC_MSG_ERROR([DiskIO IpcIo module requires shared memory support])
731 DISK_LIBS="$DISK_LIBS libIpcIo.a"
732 DISK_MODULES="$DISK_MODULES IpcIo"
733 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/IpcIo/IpcIoDiskIOModule.o"
734 AC_DEFINE(USE_DISKIO_IPCIO, 1, [Enable DiskIO IpcIo module.])
738 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
739 DISK_LIBS="$DISK_LIBS libBlocking.a"
740 DISK_MODULES="$DISK_MODULES Blocking"
741 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/Blocking/BlockingDiskIOModule.o"
745 AC_MSG_NOTICE([Enabling $module DiskIO module])
746 DISK_LIBS="$DISK_LIBS lib${module}.a"
747 DISK_MODULES="$DISK_MODULES ${module}"
748 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/${module}/${module}DiskIOModule.o"
752 AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
753 AC_SUBST(DISK_MODULES)
755 AC_SUBST(DISK_PROGRAMS)
756 AC_SUBST(DISK_LINKOBJS)
757 AC_SUBST(DISK_OS_LIBS)
758 AM_CONDITIONAL([USE_AIOPS_WIN32], [test "$USE_AIOPS_WIN32" = "1"])
759 AM_CONDITIONAL([USE_AIO_WIN32], [test "$USE_AIO_WIN32" = "1"])
762 dnl Check what Storage formats are wanted.
763 dnl This version will error out with a message saying why if a required DiskIO is missing.
764 squid_opt_enable_storeio=auto
765 AC_ARG_ENABLE([storeio],
766 AS_HELP_STRING([--enable-storeio="list of modules"],
767 [Build support for the list of store I/O modules.
768 The default is only to build the "ufs" module.
769 See src/fs for a list of available modules, or
770 Programmers Guide section <not yet written>
771 for details on how to build your custom store module]), [
774 squid_opt_enable_storeio=auto
777 squid_opt_enable_storeio=no
780 squid_opt_enable_storeio=yes
781 squid_storeio_module_candidates="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
782 # ufs is really always needed as it has low-level routines
783 # if it is a dupe it will be cleaned-up later
784 squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
788 if test "x$squid_opt_enable_storeio" = "xauto"; then
789 squid_opt_enable_storeio=yes
790 AC_MSG_CHECKING([for available StoreIO modules])
791 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
793 squid_storeio_module_candidates=`echo $squid_storeio_module_candidates|sed 's/coss//'`
794 AC_MSG_RESULT([$squid_storeio_module_candidates])
797 SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
798 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
799 AC_MSG_NOTICE([Store modules built: $squid_storeio_module_candidates])
801 for fs in $squid_storeio_module_candidates none; do
804 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
805 "$squid_disk_module_candidates_DiskDaemon" != "yes" ; then
806 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
810 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
811 "$squid_disk_module_candidates_DiskThreads" != "yes" ; then
812 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
816 AC_MSG_WARN([COSS Support is not stable yet in Squid-3. Please do not use.
\a])
817 if ! test "x$squid_disk_module_candidates_AIO" = "xyes"; then
818 AC_MSG_ERROR([COSS requires POSIX AIO which is not available.])
820 # Automake on MinGW needs explicit exe extension
821 # for STORE_TESTS substition
822 STORE_TESTS="$STORE_TESTS tests/testCoss$EXEEXT"
825 if test "x$squid_disk_module_candidates_IpcIo" != "xyes" -a \
826 "x$squid_disk_module_candidates_Blocking" != "xyes"; then
827 AC_MSG_ERROR([Storage module Rock requires IpcIo or Blocking DiskIO module])
829 STORE_TESTS="$STORE_TESTS tests/testRock$EXEEXT"
832 STORE_TESTS="$STORE_TESTS tests/testUfs$EXEEXT"
836 dnl hack: need to define those even if not used in the build system to
837 dnl make sure that global FS objects are linked to the squid binary.
838 AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
839 AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
840 AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
841 AH_TEMPLATE(HAVE_FS_COSS, "Define to 1 if coss filesystem module is build")
842 AH_TEMPLATE(HAVE_FS_ROCK, "Define to 1 if rock filesystem module is build")
845 dnl got final squid_storeio_module_candidates, build library lists
846 dnl This list will not be needed when each fs library has its own Makefile
848 dnl File system libraries to link executables with.
849 dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
851 for fs in $squid_storeio_module_candidates; do
852 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
853 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
854 SQUID_TOUPPER_VAR_CONTENTS([fs])
855 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
858 AC_SUBST(STORE_LIBS_TO_BUILD)
859 AC_SUBST(STORE_LIBS_TO_ADD)
860 AC_SUBST(STORE_TESTS)
863 dnl At lest one removal policy is always needed.
864 dnl 'lru' removal policy is currently hard-coded by name for tests
865 dnl so we must set it as default.
867 AC_ARG_ENABLE(removal-policies,
868 AS_HELP_STRING([--enable-removal-policies="list of policies"],
869 [Build support for the list of removal policies.
870 The default is only to build the "lru" module.
871 See src/repl for a list of available modules, or
872 Programmers Guide section 9.9 for details on how
873 to build your custom policy]), [
876 SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES])
881 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
885 if test "x$REPL_POLICIES" != "x" ; then
886 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
887 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
888 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
889 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
891 AC_SUBST(REPL_POLICIES)
895 AM_CONDITIONAL(ENABLE_PINGER, false)
897 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),
898 [ if test "x$enableval" = "xyes" ; then
899 AC_MSG_NOTICE([ICMP enabled])
900 AC_DEFINE(USE_ICMP,1,[Define to use Squid ICMP and Network Measurement features (highly recommended!)])
901 AM_CONDITIONAL(ENABLE_PINGER, true)
905 AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
906 AC_ARG_ENABLE(delay-pools,
907 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),
908 [ if test "x$enableval" = "xyes" ; then
909 AC_MSG_NOTICE([Delay pools enabled])
910 AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
911 AM_CONDITIONAL(ENABLE_DELAY_POOLS, true)
915 dnl disable generic/common adaptation support by default
916 squid_opt_use_adaptation=no
918 squid_opt_use_esi=yes
919 AH_TEMPLATE([USE_SQUID_ESI],
920 [Define to enable the ESI processor and Surrogate header support])
922 AS_HELP_STRING([--enable-esi],
923 [Enable ESI for accelerators. Benefits from expat or libxml2.
924 Enabling ESI will cause squid reverse proxies to be capable
925 of the Edge Acceleration Specification (www.esi.org).]),
926 [squid_opt_use_esi=$enableval], [squid_opt_use_esi=no])
931 if test "x$squid_opt_use_esi" = "xyes" ; then
932 AC_MSG_NOTICE([Enabling ESI processor and Surrogate header support.])
933 AC_DEFINE(USE_SQUID_ESI,1,
934 [Compile the ESI processor and Surrogate header support])
936 AC_MSG_NOTICE([Disabling ESI processor])
939 # ESI support libraries: expat
940 AC_ARG_WITH(expat, AS_HELP_STRING([--without-expat],[Do not use expat for ESI. Default: auto-detect]))
941 if test "x$squid_opt_use_esi" = "xyes" -a "x$with_expat" != "xno" ; then
942 AC_CHECK_LIB([expat], [main], [EXPATLIB="-lexpat"; HAVE_LIBEXPAT=1])
943 AC_CHECK_HEADERS([expat.h])
944 AC_DEFINE_UNQUOTED(HAVE_LIBEXPAT, $HAVE_LIBEXPAT, [Define to 1 if you have the expat library])
945 if test "x$with_expat" = "xyes" -a "x$HAVE_LIBEXPAT" != "x1" ; then
946 AC_MSG_ERROR([Required library expat is not able to be found.])
950 AC_ARG_WITH(libxml2, AS_HELP_STRING([--without-libxml2],[Do not use libxml2 for ESI. Default: auto-detect]))
951 if test "x$squid_opt_use_esi" = "xyes" -a "x$with_libxml2" != "xno" ; then
952 AC_CHECK_LIB([xml2], [main], [XMLLIB="-lxml2"; HAVE_LIBXML2=1])
953 dnl Find the main header and include path...
954 AC_CACHE_CHECK([location of libxml2 include files], [ac_cv_libxml2_include], [
955 AC_CHECK_HEADERS([libxml/parser.h], [], [
956 AC_MSG_NOTICE([Testing in /usr/include/libxml2])
957 SAVED_CPPFLAGS="$CPPFLAGS"
958 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
959 unset ac_cv_header_libxml_parser_h
960 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/include/libxml2"], [
961 AC_MSG_NOTICE([Testing in /usr/local/include/libxml2])
962 CPPFLAGS="-I/usr/local/include/libxml2 $SAVED_CPPFLAGS"
963 unset ac_cv_header_libxml_parser_h
964 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/local/include/libxml2"], [
965 AC_MSG_NOTICE([Failed to find libxml2 header file libxml/parser.h])
968 CPPFLAGS="$SAVED_CPPFLAGS"
971 if test "x$ac_cv_libxml2_include" != "x"; then
972 SQUID_CXXFLAGS="$ac_cv_libxml2_include $SQUID_CXXFLAGS"
973 CPPFLAGS="$ac_cv_libxml2_include $CPPFLAGS"
975 dnl Now that we know where to look find the headers...
976 AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
977 AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
978 if test "x$with_libxml2" = "xyes" -a "$HAVE_LIBXML2" != "1" ; then
979 AC_MSG_ERROR([Required library libxml2 is not able to be found.])
983 AM_CONDITIONAL(USE_ESI, test "x$squid_opt_use_esi" = "xyes")
984 AM_CONDITIONAL(HAVE_LIBEXPAT, test "$HAVE_LIBEXPAT" = 1)
986 AM_CONDITIONAL(HAVE_LIBXML2, test "$HAVE_LIBXML2" = 1)
989 # icap argument handling
990 AC_ARG_ENABLE(icap-client,
991 AS_HELP_STRING([--enable-icap-client],[Enable the ICAP client.]),
992 [squid_opt_use_icap_client=$enableval],
993 [squid_opt_use_icap_client=no])
994 SQUID_DEFINE_BOOL(ICAP_CLIENT,$squid_opt_use_icap_client,
995 [Enable ICAP client features in Squid])
996 AM_CONDITIONAL(USE_ICAP_CLIENT, [test "x$squid_opt_use_icap_client" = "xyes" ])
997 if test "x$squid_opt_use_icap_client" = "xyes" ; then
998 ICAP_LIBS="icap/libicap.la"
999 squid_opt_use_adaptation=yes
1005 squid_opt_use_ecap=1
1006 AC_MSG_CHECKING(whether to support eCAP)
1008 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]), [
1009 case "${enableval}" in
1010 yes|no) squid_opt_use_ecap=$enableval ;;
1011 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
1013 AC_MSG_RESULT([$squid_opt_use_ecap, explicitly])
1015 squid_opt_use_ecap=no;
1016 AC_MSG_RESULT([$squid_opt_use_ecap, implicitly])
1020 dnl Necessary if the first PKG_CHECK_MODULES call is conditional
1023 dnl Perform configuration consistency checks for eCAP
1024 if test "x$squid_opt_use_ecap" != "xno";
1026 dnl eCAP support requires loadable modules, which are enabled by default
1027 if test "x$enable_loadable_modules" != "xyes"
1029 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.])
1032 if test -n "$PKG_CONFIG"; then
1033 dnl eCAP support requires libecap.
1034 dnl This Squid supports libecap v0.2.x.
1035 dnl Use EXT_ prefix to distinguish external libecap (that we check for
1036 dnl here) from our own convenience ecap library in Makefiles.
1037 PKG_CHECK_MODULES([EXT_LIBECAP],[libecap >= 0.2.0 libecap < 0.3])
1039 AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
1043 AM_CONDITIONAL(USE_ECAP, test "x$squid_opt_use_ecap" = "xyes")
1044 if test "x$squid_opt_use_ecap" = "xyes";
1046 AC_DEFINE(USE_ECAP,1,[Enable eCAP support])
1047 ECAP_LIBS="ecap/libsquid-ecap.la"
1048 squid_opt_use_adaptation=yes
1050 AC_DEFINE(USE_ECAP,0,[Disable eCAP support])
1053 dnl convenience library
1057 dnl enable adaptation if requested by specific adaptation mechanisms
1058 AM_CONDITIONAL(USE_ADAPTATION, test "x$squid_opt_use_adaptation" = "xyes")
1059 if test "x$squid_opt_use_adaptation" = "xyes"
1061 AC_DEFINE(USE_ADAPTATION,1,[common adaptation support])
1062 ADAPTATION_LIBS="adaptation/libadaptation.la"
1064 AC_DEFINE(USE_ADAPTATION,0,[common adaptation support])
1067 AC_SUBST(ADAPTATION_LIBS)
1070 dnl This is a developer only option. Developers know how to set defines
1072 dnl AC_ARG_ENABLE(mem-gen-trace,
1073 dnl [ --enable-mem-gen-trace Do trace of memory stuff],
1074 dnl [ if test "$enableval" = "yes" ; then
1075 dnl AC_MSG_NOTICE([Memory trace (to file) enabled])
1076 dnl AC_DEFINE(MEM_GEN_TRACE,1,[Define for log file trace of mem alloc/free])
1081 test "x$squid_host_os" = "xmingw" && enable_wccp=no
1083 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]), [
1084 SQUID_YESNO([$enableval],[unrecognized argument to --disable-wccp: $enableval])
1086 SQUID_DEFINE_BOOL(USE_WCCP, ${enable_wccp:=yes}, [Define to enable WCCP])
1087 AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $enable_wccp])
1089 test "x$squid_host_os" = "xmingw" && enable_wccpv2=no
1090 AC_ARG_ENABLE(wccpv2,
1091 AS_HELP_STRING([--disable-wccpv2],
1092 [Disable Web Cache Coordination V2 Protocol]), [
1093 SQUID_YESNO([$enableval],
1094 [unrecognized argument to --disable-wccpv2: $enableval])
1096 SQUID_DEFINE_BOOL(USE_WCCPv2,${enable_wccpv2:=yes},
1097 [Define to enable WCCP V2])
1098 AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $enable_wccpv2])
1100 AC_ARG_ENABLE(kill-parent-hack,
1101 AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]), [
1102 SQUID_YESNO([$enableval],
1103 [unrecognized argument to --enable-kill-parent-hack: $enableval])
1105 SQUID_DEFINE_BOOL(KILL_PARENT_OPT,${enable_kill_parent_hack:=no},
1106 [A dangerous feature which causes Squid to kill its parent
1107 process (presumably the RunCache script) upon receipt
1108 of SIGTERM or SIGINT. Deprecated, Use with caution.])
1109 AC_MSG_NOTICE([Kill parent on shutdown hack enabled: $enable_kill_parent_hack])
1112 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
1113 SQUID_YESNO([$enableval],
1114 [unrecognized argument to --disable-snmp: $enableval])
1116 SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes},
1117 [Define to enable SNMP monitoring of Squid])
1118 AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
1119 if test "x$enable_snmp" = "xyes"; then
1120 SNMPLIB='../snmplib/libsnmplib.a'
1123 AC_MSG_NOTICE([SNMP support enabled: $enable_snmp])
1125 AC_SUBST(makesnmplib)
1127 AC_ARG_ENABLE(cachemgr-hostname,
1128 AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
1129 [Make cachemgr.cgi default to this host.
1130 If unspecified, uses the name of the build-host]), [
1133 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1134 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
1135 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
1141 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
1142 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
1148 AS_HELP_STRING([--disable-eui],
1149 [Disable use of ARP / MAC/ EUI (ether address)]), [
1150 SQUID_YESNO([$enableval],[--disable-eui expects no arguments])
1152 if test "x${enable_eui:=yes}" = "xyes" ; then
1153 case "$squid_host_os" in
1154 linux|solaris|freebsd|openbsd|netbsd)
1161 AC_MSG_WARN([EUI support probably will not work on host $host.])
1164 #Iphlpapi.h check delayed after winsock2.h
1179 #include <sys/types.h>
1180 #include <sys/socket.h>
1183 # OpenBSD, FreeBSD and NetBSD requires sys/param.h to be included before sysctl.h and net/if_dl.h
1188 #if HAVE_SYS_PARAM_H
1189 #include <sys/param.h>
1194 AC_MSG_NOTICE([EUI (MAC address) controls enabled: $enable_eui])
1195 SQUID_DEFINE_BOOL(USE_SQUID_EUI,$enable_eui,
1196 [Define this to include code which lets you use ethernet addresses. This code uses API initially defined in 4.4-BSD.])
1197 AM_CONDITIONAL(USE_SQUID_EUI, [test "x$enable_eui" = "xyes" ])
1201 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]), [
1202 SQUID_YESNO([$enableval],
1203 [unrecognized argument to --disable-htcp: $enableval])
1205 SQUID_DEFINE_BOOL(USE_HTCP,${enable_htcp:=yes},
1206 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
1207 AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
1208 AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
1211 # SSL is not enabled by default.
1212 # Default is to use OpenSSL when available
1214 AS_HELP_STRING([--enable-ssl],
1215 [Enable ssl gatewaying support using OpenSSL]), [
1216 SQUID_YESNO([$enableval],
1217 [unrecognized argument to --enable-ssl: $enableval])
1219 # USE_OPENSSL is AC_DEFINED later
1220 # default for ssl is set here
1221 if test "x${enable_ssl:=no}" = "xyes" ; then
1222 if test "x$squid_host_os" = "xmingw" ; then
1223 SSLLIB='-lssleay32 -leay32 -lgdi32'
1225 SSLLIB='-lssl -lcrypto'
1227 if test "x$with_openssl" = "x"; then
1230 if test "x$with_openssl" = "x"; then
1234 AM_CONDITIONAL(ENABLE_SSL,[ test "x$enable_ssl" = "xyes" ])
1235 AC_MSG_NOTICE([SSL gatewaying support enabled: $enable_ssl])
1237 dnl User may specify OpenSSL is needed from a non-standard location
1238 AC_ARG_WITH(openssl,
1239 AS_HELP_STRING([--with-openssl=PATH],
1240 [Compile with the OpenSSL libraries. The path to
1241 the OpenSSL development libraries and headers
1242 installation can be specified if outside of the
1243 system standard directories]), [
1244 case "$with_openssl" in
1246 : # Nothing special to do here
1249 if test ! -d "$withval" ; then
1250 AC_MSG_ERROR([--with-openssl path does not point to a directory])
1252 SSLLIBDIR="$with_openssl/lib"
1253 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1257 SQUID_DEFINE_BOOL(USE_SSL,$enable_ssl,
1258 [Define this to include code for SSL gatewaying support])
1259 AC_MSG_NOTICE([Using OpenSSL MD5 implementation: ${with_openssl:=no}])
1260 SQUID_DEFINE_BOOL(USE_OPENSSL,${with_openssl},
1261 [Define this to make use of the OpenSSL libraries for MD5 calculation rather than Squid-supplied MD5 implementation or if building with SSL encryption])
1262 if test "x$enable_ssl" = "xyes"; then
1263 if test "x$SSLLIB" = "x"; then
1264 SSLLIB="-lcrypto" # for MD5 routines
1266 # This is a workaround for RedHat 9 brain damage..
1267 if test -d /usr/kerberos/include -a "x$SSLLIBDIR" = "x" -a -f /usr/include/openssl/kssl.h; then
1268 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
1269 SSLLIBDIR="/usr/kerberos/lib"
1270 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1273 if test "x$SSLLIBDIR" != "x" ; then
1274 SSLLIB="-L$SSLLIBDIR $SSLLIB"
1278 if test "x$with_openssl" = "xyes"; then
1279 SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS
1280 SQUID_CHECK_OPENSSL_TXTDB
1283 AC_ARG_ENABLE(forw-via-db,
1284 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
1285 SQUID_YESNO([$enableval],[unrecognized argument to --enable-forw-via-db: $enableval])
1287 SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
1288 [Enable Forw/Via database])
1289 AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
1291 AC_ARG_ENABLE(cache-digests,
1292 AS_HELP_STRING([--enable-cache-digests],
1293 [Use Cache Digests. See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
1295 SQUID_YESNO($enableval,
1296 [unrecognized argument to --enable-cache-digests: $enableval])
1298 SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
1299 [Use Cache Digests for locating objects in neighbor caches.])
1300 AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
1303 dnl Size of COSS memory buffer
1304 squid_opt_coss_membuf_size=1048576
1305 AC_ARG_WITH(coss-membuf-size,
1306 AS_HELP_STRING([--with-coss-membuf-size=size],
1307 [COSS membuf size (default $squid_opt_coss_membuf_size bytes)]), [
1309 [[0-9]]*) squid_opt_coss_membuf_size=$withval ;;
1310 *) AC_MSG_ERROR([--with-coss-membuf-size expects a numeric argument]) ;;
1313 AC_MSG_NOTICE([Setting COSS membuf size to $squid_opt_coss_membuf_size bytes])
1314 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $squid_opt_coss_membuf_size,
1315 [Default COSS membuf size])
1317 ################################
1318 # check for netio plugin stuff #
1319 ################################
1320 dnl order of these options handling is relevant in case the user
1321 dnl supplies more than one --enable option. Options handled later
1322 dnl override those handled earlier for io loop method manual override
1323 AC_ARG_ENABLE(select,
1324 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),
1326 SQUID_YESNO($enableval,[--disable-select takes no extra argument])
1327 if test "x$enableval" = "xyes"; then
1328 if test "x$squid_host_os" = "xmingw"; then
1329 squid_opt_io_loop_engine="select_win32"
1331 squid_opt_io_loop_engine="select"
1335 AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
1338 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
1340 SQUID_YESNO($enableval,[--disable-poll takes no extra argument])
1341 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="poll"
1343 AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
1345 AC_ARG_ENABLE(kqueue,
1346 AS_HELP_STRING([--disable-kqueue],
1347 [Disable kqueue(2) support.]), [
1348 SQUID_YESNO($enableval,[--enable-kqueue takes no extra argument])
1350 if test "x${enable_kqueue:=auto}" != "xno" ; then
1351 AC_CHECK_HEADERS([sys/event.h],[],[
1352 if test "x${enable_kqueue}" = "xyes" ; then
1353 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
1356 AC_CHECK_FUNCS(kqueue,[],[
1357 if test "x${enable_kqueue}" = "xyes" ; then
1358 AC_MSG_ERROR([kqueue support missing in libc library.])
1361 if test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes" ; then
1362 squid_opt_io_loop_engine="kqueue"
1367 AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
1370 AC_ARG_ENABLE(epoll,
1371 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
1373 SQUID_YESNO($enableval,[--disable-epoll takes no extra argument])
1374 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="epoll"
1376 AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
1378 # auto-detect and verify epoll header and library present and working
1379 # logic mapping and loop method selection are performed later
1380 if test "x$enable_epoll" != "xno" ; then
1382 # check if libs are needed to support epoll
1383 # note: this code block seems quite generic. Could it be extracted
1384 # into a squid specific configure function?
1385 SQUID_STATE_SAVE(squid_epoll_state)
1386 AC_SEARCH_LIBS(epoll_ctl,[epoll])
1387 if test "x$ac_cv_search_epoll_ctl" = "xno" ; then
1388 enable_epoll=no #disable. Needed code not found
1389 elif test "x$ac_cv_search_epoll_ctl" = "xnone required" ; then
1392 EPOLL_LIBS=$ac_cv_search_epoll_ctl
1394 AC_SUBST(EPOLL_LIBS)
1395 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
1397 # epoll requires sys/epoll.h
1398 AC_CHECK_HEADERS([sys/epoll.h])
1400 dnl Verify that epoll really works
1401 if test "x$ac_cv_search_epoll_ctl" != 'xno' ; then
1405 if test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno" ; then
1406 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
1410 dnl Enable /dev/poll
1411 AC_ARG_ENABLE(devpoll,
1412 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),
1414 SQUID_YESNO($enableval,[--disable-devpoll takes no extra argument])
1415 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="devpoll"
1417 AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
1419 ## auto-detect and verify devpoll header and library present and working
1420 if test "x$enable_devpoll" != "xno"; then
1422 # /dev/poll requires ioctl() and write()
1423 AC_CHECK_FUNCS(ioctl)
1424 AC_CHECK_FUNCS(write)
1426 # /dev/poll requires sys/devpoll.h
1427 AC_CHECK_HEADERS([sys/devpoll.h],,[
1428 if test "x$enable_devpoll" = "xyes"; then
1429 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
1433 # Verify that /dev/poll really works
1434 if test "x$enable_devpoll" != 'xno' ; then
1438 if test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno" ; then
1439 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
1444 AC_ARG_ENABLE(http-violations,
1445 AS_HELP_STRING([--disable-http-violations],
1446 [This allows you to remove code which is known to
1447 violate the HTTP protocol specification.]), [
1448 SQUID_YESNO([$enableval],
1449 [unrecognized argument to --disable-http-violations: $enableval])
1451 SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
1452 [Define to enable code which volates the HTTP standard specification])
1453 AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
1455 # IPFW Transparent Proxy
1456 AC_ARG_ENABLE(ipfw-transparent,
1457 AS_HELP_STRING([--enable-ipfw-transparent],
1458 [Enable Transparent Proxy support for systems
1459 using FreeBSD IPFW-style firewalling.]), [
1460 SQUID_YESNO([$enableval],
1461 [unrecognized argument to --enable-ipfw-transparent: $enableval])
1463 SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
1464 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
1465 AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
1467 # IP-Filter Transparent Proxy
1468 AC_ARG_ENABLE(ipf-transparent,
1469 AS_HELP_STRING([--enable-ipf-transparent],
1470 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
1471 SQUID_YESNO([$enableval],
1472 [unrecognized argument to --enable-ipf-transparent: $enableval])
1474 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1475 #IPF currently broken. Default-disabled for now.
1476 AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
1478 dnl Enable PF Transparent Proxy
1479 AC_ARG_ENABLE(pf-transparent,
1480 AS_HELP_STRING([--enable-pf-transparent],
1481 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
1482 SQUID_YESNO([$enableval],
1483 [unrecognized argument to --enable-pf-transparent: $enableval])
1485 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1486 AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
1488 dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
1489 AC_ARG_WITH(nat-devpf,
1490 AS_HELP_STRING([--with-nat-devpf],
1491 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
1492 SQUID_YESNO([$enableval],
1493 [unrecognized argument to --with-nat-devpf: $enableval])
1495 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1496 AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
1498 # Linux Netfilter Transparent Proxy
1499 AC_ARG_ENABLE(linux-netfilter,
1500 AS_HELP_STRING([--enable-linux-netfilter],
1501 [Enable Transparent Proxy support for Linux (Netfilter)]), [
1502 SQUID_YESNO([$enableval],
1503 [unrecognized argument to --enable-linux-netfilter: $enableval])
1505 AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
1506 #will be AC_DEFINEd later, after checking for appropriate infrastructure
1509 dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
1510 dnl squid_opt_netfilterconntrack is set only when option is explicity specified
1511 AC_ARG_WITH(netfilter-conntrack,
1512 AS_HELP_STRING([--without-netfilter-conntrack],
1513 [Do not use Netfilter conntrack libraries for packet marking.
1514 A path to alternative library location may be specified by
1515 using --with-netfilter-conntrack=PATH. Default: auto-detect.]), [
1516 case "$with_netfilter_conntrack" in
1518 squid_opt_netfilterconntrack=$with_netfilter_conntrack
1521 if test ! -d "$withval" ; then
1522 AC_MSG_ERROR([--without-netfilter-conntrack path does not point to a directory])
1524 squid_opt_netfilterconntrackpath=$withval
1525 LDFLAGS="-L$squid_opt_netfilterconntrackpath/lib $LDFLAGS"
1526 CPPFLAGS="-I$squid_opt_netfilterconntrackpath/include $CPPFLAGS"
1527 with_netfilter_conntrack=yes
1528 squid_opt_netfilterconntrack=yes
1531 AC_MSG_NOTICE([Linux Netfilter Conntrack support requested: ${with_netfilter_conntrack:=auto}])
1532 if test "x$with_netfilter_conntrack" != "xno"; then
1533 AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
1534 if test x"$with_netfilter_conntrack" = "xyes"; then
1535 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack library not found])
1537 with_netfilter_conntrack=no])
1538 AC_CHECK_HEADERS([libnetfilter_conntrack/libnetfilter_conntrack.h \
1539 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h],,[
1540 if test x"$with_netfilter_conntrack" = "xyes"; then
1541 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack headers not found])
1543 with_netfilter_conntrack=no])
1544 # If nothing is broken; enable the libraries usage.
1545 if test "x$with_netfilter_conntrack" != "xno"; then
1546 with_netfilter_conntrack=yes
1551 dnl Enable Large file support
1553 squid_opt_enable_large_files=no
1555 AC_ARG_WITH(large-files,
1556 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
1557 if test "x$withval" = "xyes"; then
1558 squid_opt_enable_large_files=yes
1562 dnl UNIX Build environment
1563 dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
1564 AC_ARG_WITH(build-environment,
1565 AS_HELP_STRING([--with-build-environment=model],
1566 [The build environment to use. Normally one of
1567 POSIX_V6_ILP32_OFF32 (32 bits),
1568 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
1569 POSIX_V6_LP64_OFF64 (64 bits),
1570 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
1571 XBS5_ILP32_OFF32 i(legacy, 32 bits),
1572 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
1573 XBS5_LP64_OFF64 (legacy, 64 bits),
1574 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
1575 or default (The default for your OS)]), [
1578 AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])
1581 buildmodel="$withval"
1586 if test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"; then
1587 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
1588 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
1593 if test "x$buildmodel" = "x"; then
1594 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
1597 if test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"; then
1598 if test "x$squid_opt_enable_large_files" = "xyes" ; then
1599 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
1600 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
1601 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
1604 AC_MSG_NOTICE([Using $buildmodel build environment])
1605 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
1608 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
1610 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
1611 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
1612 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1613 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
1614 if test "x$squid_host_os" = "xsolaris" ; then
1616 # On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1617 # for LDFLAGS -xarch=generic64, but:
1618 # "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1619 # For gcc "-xarch=generic64" must be replaced with "-m64"
1620 # The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
1621 if test "x$GCC" = "xyes"; then
1622 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
1623 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
1624 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
1625 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
1626 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1627 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1628 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
1630 AC_MSG_NOTICE([Removing -Usun on $host])
1631 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
1632 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
1636 dnl Enable Leak Finding Functions
1637 AC_ARG_ENABLE(leakfinder,
1638 AS_HELP_STRING([--enable-leakfinder],
1639 [Enable Leak Finding code. Enabling this alone does nothing;
1640 you also have to modify the source code to use the leak
1641 finding functions. Probably Useful for hackers only.]), [
1642 SQUID_YESNO([$enableval],
1643 [unrecognized argument to --enable-leakfinder: $enableval])
1645 AC_MSG_NOTICE([Leak Finder enabled: ${enable_leakfinder:=no}])
1646 SQUID_DEFINE_BOOL(USE_LEAKFINDER,$enable_leakfinder,
1647 [Enable code for assisting in finding memory leaks. Not for the faint of heart])
1648 AM_CONDITIONAL(MAKE_LEAKFINDER, [test "x$enable_leakfinder" = "xyes"])
1651 AC_ARG_ENABLE(follow-x-forwarded-for,
1652 AS_HELP_STRING([--enable-follow-x-forwarded-for],
1653 [Enable support for following the X-Forwarded-For
1654 HTTP header to try to find the IP address of the
1655 original or indirect client when a request has
1656 been forwarded through other proxies.]), [
1657 SQUID_YESNO([$enableval],
1658 [unrecognized argument to --enable-follow-x-forwarded-for: $enableval])
1660 AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
1661 SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
1662 [Enable following X-Forwarded-For headers])
1664 AC_ARG_ENABLE(ident-lookups,
1665 AS_HELP_STRING([--disable-ident-lookups],
1666 [Remove code that supports performing Ident (RFC 931) lookups.]), [
1667 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ident-lookups: $enableval])
1669 AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
1670 SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
1672 squid_opt_use_dnshelper="no"
1673 AC_ARG_ENABLE(internal-dns,
1674 AS_HELP_STRING([--disable-internal-dns],
1675 [Prevents Squid from directly sending and receiving DNS messages,
1676 and instead enables the old external 'dnsserver' processes.]), [
1677 if test "x$enableval" = "xno" ; then
1678 AC_MSG_WARN([Disabling Internal DNS queries])
1679 squid_opt_use_dnshelper="yes"
1682 SQUID_DEFINE_BOOL(USE_DNSHELPER,$squid_opt_use_dnshelper,
1683 [Use dnsserver processes instead of the internal DNS protocol support])
1684 AM_CONDITIONAL([ENABLE_DNSHELPER],[test "x$squid_opt_use_dnshelper" = "xyes" ])
1687 AM_CONDITIONAL(USE_SSL_CRTD, false)
1688 AC_ARG_ENABLE(ssl-crtd,
1689 AC_HELP_STRING([--enable-ssl-crtd],
1690 [Prevent Squid from directly generation of SSL private key and
1691 certificate request and instead enables the ssl_crtd processes.]), [
1692 SQUID_YESNO([$enableval],
1693 [unrecogized argument to --enable-ssl-crtd: $enableval])
1696 if test "x$enable_ssl_crtd" = "xyes" -a "x$enable_ssl" = "xno" ; then
1697 AC_MSG_ERROR([You need to enable ssl gatewaying support to use ssl_crtd feature. Try to use --enable-ssl. ])
1699 SQUID_DEFINE_BOOL(USE_SSL_CRTD, ${enable_ssl_crtd:=no},[Use ssl_crtd daemon])
1700 AM_CONDITIONAL(USE_SSL_CRTD, [test "x$enable_ssl_crtd" = "xyes"])
1702 dnl Select Default hosts file location
1703 AC_ARG_ENABLE(default-hostsfile,
1704 AS_HELP_STRING([--enable-default-hostsfile=path],
1705 [Select default location for hosts file.
1706 See hosts_file directive in squid.conf for details]), [
1707 if test "x$enableval" != "xnone" -a "x$enableval" != "xno" ; then
1708 if test \! -f "$enableval"; then
1709 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
1711 squid_opt_default_hosts=$enableval
1713 squid_opt_default_hosts="none"
1716 AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
1717 DEFAULT_HOSTS=$squid_opt_default_hosts
1718 AC_SUBST(DEFAULT_HOSTS)
1720 # Select auth schemes modules to build
1722 AS_HELP_STRING([--enable-auth],
1723 [Build global support for authentication. The list of schemes
1724 and helpers to be enabled is defined elsewhere]), [
1725 SQUID_YESNO([$enableval],
1726 [unrecognized argument to --enable-auth: $enableval])
1728 AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
1729 SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
1730 AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
1733 AC_ARG_ENABLE(auth-basic,
1734 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
1735 [Enable the basic authentication scheme, and build the specified helpers.
1736 Not providing an explicit list of helpers will attempt build of
1737 all possible helpers. Default is to do so.
1738 To disable the basic authentication scheme, use --disable-auth-basic.
1739 To enable but build no helpers, specify "none".
1740 To see available helpers, see the helpers/basic_auth directory. ]),[
1741 #nothing to do really
1743 m4_include([helpers/basic_auth/modules.m4])
1745 AC_ARG_ENABLE(auth-ntlm,
1746 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
1747 [Enable the NTLM authentication scheme, and build the specified helpers.
1748 Not providing an explicit list of helpers will attempt build of
1749 all possible helpers. Default is to do so.
1750 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
1751 To enable but build no helpers, specify "none".
1752 To see available helpers, see the helpers/ntlm_auth directory. ]),[
1754 m4_include([helpers/ntlm_auth/modules.m4])
1756 AC_ARG_ENABLE(auth-negotiate,
1757 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
1758 [Enable the Negotiate authentication scheme, and build the specified
1760 Not providing an explicit list of helpers will attempt build of
1761 all possible helpers. Default is to do so.
1762 To disable the Negotiate authentication scheme,
1763 use --disable-auth-negotiate.
1764 To enable but build no helpers, specify "none".
1765 To see available helpers, see the helpers/negotiate_auth directory. ]),[
1766 #nothing to do, really
1768 m4_include([helpers/negotiate_auth/modules.m4])
1770 AC_ARG_ENABLE(auth-digest,
1771 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
1772 [Enable the Digest authentication scheme, and build the specified helpers.
1773 Not providing an explicit list of helpers will attempt build of
1774 all possible helpers. Default is to do so.
1775 To disable the Digest authentication scheme, use --disable-auth-digest.
1776 To enable but build no helpers, specify "none".
1777 To see available helpers, see the helpers/digest_auth directory. ]),[
1778 #nothing to do, really
1780 m4_include([helpers/digest_auth/modules.m4])
1782 dnl Authentication libraries to build
1783 dnl This list will not be needed when each auth library has its own Makefile
1784 dnl this is to be placed AFTER each auth module's handler
1786 for module in $AUTH_MODULES; do
1787 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
1789 AC_SUBST(AUTH_MODULES)
1790 AC_SUBST(AUTH_LIBS_TO_BUILD)
1792 dnl Select logging daemon helpers to build
1793 AC_ARG_ENABLE(log-daemon-helpers,
1794 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
1795 [This option selects which logging daemon helpers to
1796 build and install as part of the normal build process
1797 For a list of available helpers see the helpers/log_daemon
1799 #nothing to do, really
1801 m4_include([helpers/log_daemon/modules.m4])
1804 dnl Check Kerberos/GSSAPI/SPNEGO
1806 SQUID_STATE_SAVE([krbsave])
1808 AC_ARG_WITH(krb5-config,
1809 AS_HELP_STRING([--with-krb5-config=PATH],
1810 [specify path to krb5-config (default=detect)]), [
1812 yes) unset krb5confpath ;;
1813 no) krb5confpath=no ;;
1814 *) krb5confpath=$withval ;;
1817 if test x"$krb5confpath" != "xno"; then
1818 if test "x$krb5confpath" != "x"; then
1819 if ! test -x "$krb5confpath"; then
1820 AC_MSG_WARN([krb5-config '$krb5confpath' not executable, ignoring])
1821 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no)
1822 krb5confpath=krb5-config
1824 krb5_config_path=`dirname $krb5confpath`
1825 AC_CHECK_PROG(ac_krb5_config, krb5-config, yes, no, $krb5_config_path)
1827 AC_CHECK_PROG(ac_krb5_config,krb5-config,yes,no)
1828 krb5confpath=krb5-config
1831 if test "x$ac_krb5_config" = "xyes" ; then
1832 ac_heimdal="`$krb5confpath --version 2>/dev/null | grep -i heimdal`"
1833 ac_solaris="`$krb5confpath --version 2>/dev/null | grep -i solaris`"
1834 if test "x$ac_heimdal" != "x" ; then
1835 AC_DEFINE(HAVE_HEIMDAL_KERBEROS,1,[Define to 1 if you have Heimdal Kerberos])
1837 AC_DEFINE(HAVE_MIT_KERBEROS,1,[Define to 1 if you have MIT Kerberos])
1839 if test "x$ac_solaris" != "x" ; then
1840 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1841 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
1842 KRB5INCS="-I/usr/include/gssapi $KRB5INCS"
1843 KRB5LIBS="-L/usr/lib -R/usr/lib -lgss -lresolv -lsocket -lnsl $KRB5LIBS"
1845 KRB5INCS="`$krb5confpath --cflags krb5 2>/dev/null`"
1846 KRB5LIBS="`$krb5confpath --libs krb5 2>/dev/null`"
1847 KRB5INCS="`$krb5confpath --cflags gssapi 2>/dev/null` $KRB5INCS"
1848 KRB5LIBS="`$krb5confpath --libs gssapi 2>/dev/null` $KRB5LIBS"
1850 CPPFLAGS="$CPPFLAGS $KRB5INCS"
1851 LIBS="$LIBS $KRB5LIBS"
1852 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1853 if test "x$ac_heimdal" == "x" ; then
1854 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
1855 AC_CHECK_HEADERS(profile.h)
1858 SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H
1859 if test "x$squid_cv_broken_krb5_h" = "xyes"; then
1860 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if Solaris krb5.h is broken for C++])
1861 AC_MSG_WARN([You have a broken Solaris <krb5.h> system include.])
1862 AC_MSG_WARN([Please see http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512])
1863 AC_MSG_WARN([If you need Kerberos support you'll have to patch])
1864 AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch])
1866 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1867 if test "x$squid_cv_broken_heimdal_krb5_h" = "xyes"; then
1868 AC_DEFINE(HAVE_BROKEN_HEIMDAL_KRB5_H, 1, [Define to 1 if Heimdal krb5.h is broken for C++])
1870 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1872 ac_com_error_message=no
1873 if test "x$ac_cv_header_com_err_h" == "xyes" ; then
1874 AC_EGREP_HEADER(error_message,com_err.h,ac_com_error_message=yes)
1875 elif test "x$ac_cv_header_et_com_err_h" == "xyes" ; then
1876 AC_EGREP_HEADER(error_message,et/com_err.h,ac_com_error_message=yes)
1879 SQUID_CHECK_MAX_SKEW_IN_KRB5_CONTEXT
1880 if test "x$squid_cv_max_skew_context" = "xyes"; then
1881 AC_DEFINE(HAVE_MAX_SKEW_IN_KRB5_CONTEXT, 1, [Define to 1 if max_skew in struct krb5_context])
1884 if test `echo $KRB5LIBS | grep -c com_err` -ne 0 -a "x$ac_com_error_message" == "xyes" ; then
1885 AC_CHECK_LIB(com_err,error_message,
1886 AC_DEFINE(HAVE_ERROR_MESSAGE,1,
1887 [Define to 1 if you have error_message]),)
1888 elif test "x$ac_com_error_message" == "xyes" ; then
1889 AC_CHECK_LIB(krb5,error_message,
1890 AC_DEFINE(HAVE_ERROR_MESSAGE,1,
1891 [Define to 1 if you have error_message]),)
1893 AC_CHECK_LIB(krb5,krb5_get_err_text,
1894 AC_DEFINE(HAVE_KRB5_GET_ERR_TEXT,1,
1895 [Define to 1 if you have krb5_get_err_text]),)
1896 AC_CHECK_LIB(krb5,krb5_get_error_message,
1897 AC_DEFINE(HAVE_KRB5_GET_ERROR_MESSAGE,1,
1898 [Define to 1 if you have krb5_get_error_message]),)
1899 AC_CHECK_DECLS(krb5_kt_free_entry,,,[#include <krb5.h>])
1900 AC_CHECK_LIB(krb5,krb5_kt_free_entry,
1901 AC_DEFINE(HAVE_KRB5_KT_FREE_ENTRY,1,
1902 [Define to 1 if you have krb5_kt_free_entry]),)
1903 AC_CHECK_LIB(krb5,krb5_get_init_creds_keytab,
1904 AC_DEFINE(HAVE_GET_INIT_CREDS_KEYTAB,1,
1905 [Define to 1 if you have krb5_get_init_creds_keytab]),)
1906 AC_CHECK_LIB(krb5,krb5_get_max_time_skew,
1907 AC_DEFINE(HAVE_KRB5_GET_MAX_TIME_SKEW,1,
1908 [Define to 1 if you have krb5_get_max_time_skew]),)
1909 AC_CHECK_LIB(krb5,krb5_get_profile,
1910 AC_DEFINE(HAVE_KRB5_GET_PROFILE,1,
1911 [Define to 1 if you have krb5_get_profile]),)
1912 AC_CHECK_LIB(krb5,profile_get_integer,
1913 AC_DEFINE(HAVE_PROFILE_GET_INTEGER,1,
1914 [Define to 1 if you have profile_get_integer]),)
1915 AC_CHECK_LIB(krb5,profile_release,
1916 AC_DEFINE(HAVE_PROFILE_RELEASE,1,
1917 [Define to 1 if you have profile_release]),)
1919 SQUID_CHECK_KRB5_CONTEXT_MEMORY_CACHE
1920 SQUID_DEFINE_BOOL(HAVE_KRB5_MEMORY_CACHE,$squid_cv_memory_cache,
1921 [Define if kerberos has MEMORY: cache support])
1923 SQUID_CHECK_WORKING_GSSAPI
1924 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1926 SQUID_CHECK_SPNEGO_SUPPORT
1927 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1929 SQUID_CHECK_WORKING_KRB5
1930 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1935 SQUID_STATE_ROLLBACK([krbsave])
1936 AM_CONDITIONAL(HAVE_SPNEGO, test x"$squid_cv_have_spnego" = x"yes" )
1938 AC_ARG_ENABLE(external-acl-helpers,
1939 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
1940 [Enable external_acl helpers support and thelpers themselves.
1941 Default is to build all buildable helpers and enable support.
1942 To disable support, use --disable-external-acl-helpers.
1943 To build no helpers, specify "none".
1944 To see available helpers, see the helpers/external_acl
1946 #nothing to do, really
1948 m4_include([helpers/external_acl/modules.m4])
1950 dnl Select url_rewrite helpers to build
1951 AC_ARG_ENABLE(url-rewrite-helpers,
1952 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
1953 [This option selects which url_rewrite helpers to
1954 build and install as part of the normal build
1955 process. The default is to attempt the build of all possible
1956 helpers. Use --disable-url-rewrite-helpers to build none.
1957 For a list of available helpers see the
1958 helpers/url_rewrite directory.]),[
1960 m4_include([helpers/url_rewrite/modules.m4])
1962 AC_ARG_WITH(valgrind-debug,
1963 AS_HELP_STRING([--with-valgrind-debug],
1964 [Include debug instrumentation for use with valgrind]),
1966 SQUID_YESNO([$withval],
1967 [unrecognized argument to --with-valgrind-debug: $withval])
1968 if test "x$withval" != "xno" ; then
1969 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
1970 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
1974 SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
1975 [Valgrind memory debugger support])
1976 AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
1978 dnl Disable "memPools" code
1979 #AC_ARG_ENABLE(chunkedmempools,
1980 # AS_HELP_STRING([--enable-chunkedmempools],
1981 # [Enable experimental chunked memPools. Note that this option
1982 # simply sets the default behaviour. Specific classes can override this
1983 # at runtime, and only lib/MemPool.c needs to be altered
1984 # to change the squid-wide default for all classes.]), [
1985 #SQUID_YESNO([$enableval],
1986 # [--enable-chunkedmempools option takes no arguments])
1988 SQUID_DEFINE_BOOL(USE_CHUNKEDMEMPOOLS,${enable_chunkedmempools:=no},
1989 [Enable chunked Memory Pools support (experimental)])
1990 #AC_MSG_NOTICE([Chunked MemPools enabled: $enable_chunkedmempools])
1992 dnl Enable WIN32 Service compile mode
1993 AC_ARG_ENABLE(win32-service,
1994 AS_HELP_STRING([--enable-win32-service],
1995 [Compile Squid as a WIN32 Service.
1996 Works only on MS-Windows platforms]), [
1997 SQUID_YESNO([$enableval],
1998 [unrecognized argument to --enable-win32-service: $enableval])
2000 SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
2001 [Enable code supporting MS Windows service mode])
2002 AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
2005 # Disable "unlinkd" code
2006 AC_ARG_ENABLE(unlinkd,
2007 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
2008 SQUID_YESNO([$enableval],
2009 [unrecognized argument to --disable-unlinkd: $enableval])
2011 SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
2012 [Enable useage of unlinkd])
2013 AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
2014 AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
2016 # Enable backtraces on fatal errors
2017 AC_ARG_ENABLE(stacktraces,
2018 AS_HELP_STRING([--enable-stacktraces],
2019 [Enable automatic call backtrace on fatal errors]), [
2020 SQUID_YESNO([$enableval],
2021 [unrecognized argument to --enable-stacktraces: $enableval])
2023 SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
2024 [Print stack traces on fatal errors])
2025 AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
2028 # CPU Profiling options handling
2029 AC_ARG_ENABLE(cpu-profiling,
2030 AS_HELP_STRING([--enable-cpu-profiling],
2031 [Enable instrumentation to try and understand how CPU power
2032 is spent by squid, by enabling specific probes in selected
2034 New probes can only be added by modifying the source code.
2035 It is meant to help developers in optimizing performance
2036 of Squid internal functions.
2037 If you are not developer you should not enable this,
2038 as it slows squid down somewhat.
2039 See lib/Profiler.c for more details.]), [
2040 SQUID_YESNO([$enableval],
2041 [unrecognized argument to --enable-cpu-profiling: $enableval])
2043 # Default OFF. This is a debug feature. Only check and enable if forced ON.
2044 if test "x$enable_cpu_profiling" = "xyes"; then
2045 SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
2046 if test "x$squid_cv_cpu_profiler_works" = "xno"; then
2047 AC_MSG_ERROR([CPU profiling will not be functional in this build.])
2050 SQUID_DEFINE_BOOL(USE_XPROF_STATS,${enable_cpu_profiling:=no},
2051 [Define to enable CPU profiling within Squid])
2052 AM_CONDITIONAL(ENABLE_XPROF_STATS,
2053 test "x$enable_cpu_profiling" = "xyes")
2054 AC_MSG_NOTICE([CPU profiling enabled: $enable_cpu_profiling])
2056 # Enable X-Accelerator-Vary for Vary support within an accelerator setup
2057 AC_ARG_ENABLE(x-accelerator-vary,
2058 AS_HELP_STRING([--enable-x-accelerator-vary],
2059 [Enable support for the X-Accelerator-Vary
2060 HTTP header. Can be used to indicate
2061 variance within an accelerator setup.
2062 Typically used together with other code
2063 that adds custom HTTP headers to the requests.]), [
2064 SQUID_YESNO([$enableval],
2065 [unrecognized argument to --enable-x-accelerator-vary: $enableval])
2067 SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
2068 [Enable support for the X-Accelerator-Vary HTTP header])
2069 AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
2072 if $CPPUNITCONFIG --help >/dev/null; then
2073 squid_cv_cppunit_version="`$CPPUNITCONFIG --version`"
2074 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
2075 unset squid_cv_cppunit_version
2076 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2078 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2080 AC_MSG_WARN([cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail.])
2082 SQUID_CPPUNIT_LIBS=''
2083 SQUID_CPPUNIT_INC=''
2086 AC_ARG_WITH(cppunit-basedir,
2087 AS_HELP_STRING([--with-cppunit-basedir=PATH],
2088 [Path where the cppunit headers are libraries can be found ]), [
2089 if test -f "$withval/include/cppunit/TestCase.h"; then
2090 AC_MSG_NOTICE([Using cppunit includes from $withval])
2091 SQUID_CPPUNIT_INC="-I${withval}/include"
2093 AC_MSG_ERROR(Cannot find cppunit at $withval)
2095 if test -f "$withval/lib/libcppunit.la"; then
2096 AC_MSG_NOTICE([Using cppunit lib from $withval])
2097 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
2098 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
2100 AC_MSG_ERROR(Cannot find cppunit at $withval)
2103 SQUID_STATE_SAVE(squid_cppunit_state)
2104 CXXFLAGS="$CXXFLAGS $SQUID_CPPUNIT_INC"
2105 AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
2106 SQUID_STATE_ROLLBACK(squid_cppunit_state)
2107 AC_SUBST(SQUID_CPPUNIT_LIBS)
2108 AC_SUBST(SQUID_CPPUNIT_LA)
2109 AC_SUBST(SQUID_CPPUNIT_INC)
2111 # Force some compilers to use ANSI features
2115 if test "x$ac_cv_prog_CC" = "xcc" ; then
2116 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
2124 dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
2128 AC_MSG_NOTICE([Disabling ranlib for HP-UX...])
2133 dnl Check for headers
2173 linux/posix_types.h \
2175 machine/byte_swap.h \
2184 netinet/in_systm.h \
2185 netinet/ip_fil_compat.h \
2188 openssl/opensslv.h \
2201 security/pam_appl.h \
2253 CHECK_STRUCT_PAM_CONV
2256 linux/netfilter_ipv4.h
2258 SQUID_DEFAULT_INCLUDES
2262 /* Netfilter ip(6)tables v1.4.0 has broken headers */
2263 #if HAVE_NETINET_IN_H
2264 #include <netinet/in.h>
2268 dnl *BSD dont include the dependencies for all their net/ and netinet/ files
2269 dnl We must include a few basic type headers for them to work.
2277 netinet/ip_compat.h\
2278 netinet/ip_fil_compat.h\
2288 SQUID_BSDNET_INCLUDES)
2294 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2297 #include <sys/time.h>
2304 SQUID_HAVE_STRUCT_MALLINFO
2306 dnl Override rusage() detect on MinGW because is emulated in source code
2307 case "$squid_host_os" in
2309 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2310 ac_cv_func_getrusage='yes'
2311 AC_MSG_NOTICE([Using own rusage on Windows.])
2314 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
2316 #include <sys/time.h>
2318 #if HAVE_SYS_RESOURCE_H
2319 #include <sys/resource.h>
2324 AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2325 #if HAVE_SYS_TYPES_H
2326 #include <sys/types.h>
2328 #include <netinet/in.h>
2329 #include <netinet/in_systm.h>
2330 #include <netinet/ip.h>
2331 #if defined (__linux__) || defined (__CYGWIN__)
2340 dnl Check for typedefs
2341 AC_CHECK_SIZEOF(void *)
2343 # check for a bunch of types
2357 AC_CHECK_TYPE([bool])
2358 #need the defines for PRId64
2359 AC_CHECK_SIZEOF(int64_t)
2360 AC_CHECK_SIZEOF(long)
2361 #need the defines for PRIuSIZE
2362 AC_CHECK_SIZEOF(size_t)
2363 #need the define for overflow checks
2364 AC_CHECK_SIZEOF(off_t)
2365 AC_CHECK_SIZEOF(size_t)
2367 dnl Some C++0x types we try to use
2369 AX_CXX_TYPE_UNIQUE_PTR
2371 dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2372 dnl that is incompatible with the updated Solaris header files.
2373 dnl For this reason, we must check if pad128_t and upad128_t are defined.
2374 AC_CHECK_TYPE(pad128_t,
2375 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2376 ,SQUID_DEFAULT_INCLUDES)
2378 AC_CHECK_TYPE(upad128_t,
2379 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2380 ,SQUID_DEFAULT_INCLUDES)
2382 AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2383 AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2385 AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2386 #include <sys/types.h>
2387 #include <sys/socket.h>
2393 AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
2394 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
2395 #include <sys/ipc.h>
2396 #include <sys/msg.h>])
2398 # check for compiler support of %zu printf macro
2399 AH_TEMPLATE(PRIuSIZE,[Compiler supports %zu printf macro])
2400 AC_MSG_CHECKING([for compiler %zu support])
2401 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2403 ]],[[size_t n=1;printf("%zu",n);]])],[
2404 AC_DEFINE(PRIuSIZE,"zu")
2406 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
2409 dnl Check for special functions
2413 dnl Check for libcap header (assume its not broken unless
2414 AC_ARG_WITH(libcap, AS_HELP_STRING([--without-libcap],
2415 [disable usage of Linux capabilities library to control privileges]), [
2416 SQUID_YESNO([$withval],[unrecognized argument to --without-libcap: $withval])
2417 ],[with_libcap=auto])
2419 if test "x$with_libcap" != "xno"; then
2420 # cap_clear_flag is the most recent libcap function we require
2421 AC_CHECK_HEADERS(sys/capability.h)
2422 AC_CHECK_LIB(cap, cap_clear_flag)
2423 SQUID_CHECK_FUNCTIONAL_LIBCAP2
2425 # if it can't be supported..
2426 if test "x$ac_cv_header_sys_capability_h" = "xno" -o \
2427 "x$ac_cv_lib_cap_cap_clear_flag" = "xno"; then
2428 # and it was forced on: error
2429 if test "x$with_libcap" = "xyes" ; then
2430 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
2432 # with_libcap is "auto"; it can't be supported. Disable.
2436 # header and lib are ok, we support
2442 SQUID_DEFINE_BOOL(USE_LIBCAP,$with_libcap,
2443 [use libcap to set capabilities required for TPROXY])
2444 AC_MSG_NOTICE([libcap support enabled: $with_libcap])
2445 SQUID_DEFINE_BOOL(LIBCAP_BROKEN,${squid_cv_sys_capability_works:=no},
2446 [libcap2 headers are broken and clashing with glibc])
2447 AC_MSG_NOTICE([libcap2 headers are ok: $squid_cv_sys_capability_works])
2450 dnl Check for needed libraries
2451 AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
2452 AC_SEARCH_LIBS([res_init],[resolv])
2453 AC_SEARCH_LIBS([__res_search],[resolv])
2454 AC_SEARCH_LIBS([bind],[socket])
2455 AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
2456 AC_SEARCH_LIBS([strlcpy], [bsd])
2457 AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
2458 dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
2459 if test "x$squid_host_os" = "xmingw" ; then
2460 SQUID_CHECK_WINSOCK_LIB
2466 #include <windows.h>
2469 #include <winsock2.h>
2473 # check that we have unix sockets
2474 SQUID_CHECK_UNIX_SOCKET
2475 SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
2477 AC_CHECK_LIB(gnumalloc, malloc)
2478 if test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"; then
2479 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
2480 ac_cv_func_mallinfo=no
2481 ac_cv_func_mallocblksize=no
2482 ac_cv_func_mallopt=no
2484 case "$squid_host_os" in
2486 AC_MSG_NOTICE([skipping libmalloc check for $host])
2489 AC_MSG_NOTICE([skipping libmalloc check for $host])
2493 AC_CHECK_LIB(malloc, main)
2498 case "$squid_host_os" in
2500 AC_MSG_NOTICE([Use MSVCRT for math functions.])
2503 dnl rint() and log() are only used in old C code for now.
2505 AC_SEARCH_LIBS([rint],[m])
2506 AC_SEARCH_LIBS([log],[m])
2512 dnl --with-maxfd present for compatibility with Squid-2.
2513 dnl undocumented in ./configure --help to encourage using the Squid-3 directive
2518 squid_filedescriptors_num=$withval
2521 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
2526 AC_ARG_WITH(filedescriptors,
2527 AS_HELP_STRING([--with-filedescriptors=NUMBER],
2528 [Force squid to support NUMBER filedescriptors]),
2532 squid_filedescriptors_num=$withval
2535 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
2540 SQUID_CHECK_DEFAULT_FD_SETSIZE
2541 if test "x$squid_filedescriptors_num" = "x"; then
2544 AC_MSG_NOTICE([forcing use of $squid_filedescriptors_num filedescriptors (user-forced)])
2546 if test "$squid_filedescriptors_num" -lt 512 ; then
2547 AC_MSG_WARN([$squid_filedescriptors_num may not be enough filedescriptors if your])
2548 AC_MSG_WARN([cache will be very busy. Please see the FAQ page])
2549 AC_MSG_WARN([http://wiki.squid-cache.org/SquidFaq/TroubleShooting])
2550 AC_MSG_WARN([on how to increase your filedescriptor limit])
2552 AC_DEFINE_UNQUOTED(SQUID_MAXFD, $squid_filedescriptors_num,[Maximum number of open filedescriptors])
2555 dnl Enable IPv6 support
2556 AC_MSG_CHECKING([whether to enable IPv6])
2558 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
2559 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ipv6: $enableval])
2561 AC_MSG_RESULT(${enable_ipv6:=yes})
2562 SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
2564 if test "x$enable_ipv6" = "xyes" ; then
2565 SQUID_CHECK_SIN6_LEN_IN_SAI
2567 SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
2568 SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
2571 dnl Check for libcrypt
2573 dnl Some of our helpers use crypt(3) which may be in libc, or in
2574 dnl libcrypt (eg FreeBSD)
2575 AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
2576 dnl Solaris10 provides MD5 natively through libmd5
2577 AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
2580 # check for crypt, may require -lcrypt
2582 LIBS="$LIBS $CRYPTLIB"
2583 AC_CHECK_FUNCS(crypt)
2587 dnl Check for libdl, used by auth_modules/PAM
2588 if test "x$with_dl" = "xyes"; then
2589 AC_CHECK_LIB(dl, dlopen)
2592 dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
2593 dnl Robert Side <rside@aiinc.bc.ca>
2594 dnl Mon, 18 Jan 1999 17:48:00 GMT
2597 AC_CHECK_LIB(intl, strftime)
2601 dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
2602 dnl only with Windows LDAP libraries using -lwldap32
2603 case "$squid_host_os" in
2609 AC_CHECK_LIB(ldap, ldap_init, [LDAPLIB="-lldap"])
2610 dnl LDAP helpers need to know if -llber is needed or not
2611 AC_CHECK_LIB(lber, ber_init, [LBERLIB="-llber"])
2612 dnl if no ldap lib found check for mozilla version
2613 if test "x$ac_cv_lib_ldap_ldap_init" != x""yes; then
2616 AC_CHECK_LIB(ldap60, ldap_init, [LDAPLIB="-lldap60"])
2617 LIBS="$LDAPLIB $LIBPTHREADS"
2618 AC_CHECK_LIB(prldap60, prldap_init, [LDAPLIB="-lprldap60 $LDAPLIB"])
2619 LIBS="$LDAPLIB $LIBPTHREADS"
2620 AC_CHECK_LIB(ssldap60, ldapssl_init, [LDAPLIB="-lssldap60 $LDAPLIB"])
2624 AC_CHECK_HEADERS(ldap.h lber.h)
2625 AC_CHECK_HEADERS(mozldap/ldap.h)
2628 dnl Check for LDAP_OPT_DEBUG_LEVEL
2630 AC_MSG_CHECKING([for LDAP_OPT_DEBUG_LEVEL])
2631 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2634 int i=LDAP_OPT_DEBUG_LEVEL
2636 [ AC_MSG_RESULT(yes) ],
2637 [ AC_MSG_RESULT(no) ])
2640 dnl Check for working ldap
2643 LIBS="$LDAPLIB $LBERLIB $LIBPTHREADS"
2644 AC_MSG_CHECKING([for working ldap])
2645 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2646 # define LDAP_DEPRECATED 1
2649 # elif HAVE_MOZLDAP_LDAP_H
2650 # include <mozldap/ldap.h>
2658 ldap_init((const char *)&host, port);
2663 [ AC_DEFINE(HAVE_LDAP, 1, [LDAP support])
2664 AC_MSG_RESULT(yes) ],
2665 [ AC_MSG_RESULT(no) ],
2666 [ AC_MSG_RESULT(cross-compiler cant tell) ])
2670 dnl Check for ldap vendor
2672 AC_MSG_CHECKING([for OpenLDAP])
2673 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2677 # include <string.h>
2681 return strcmp(LDAP_VENDOR_NAME,"OpenLDAP");
2684 [ AC_DEFINE(HAVE_OPENLDAP, 1, [OpenLDAP support])
2685 AC_MSG_RESULT(yes) ],
2686 [ AC_MSG_RESULT(no) ],
2687 [ AC_MSG_RESULT(cross-compiler cant tell) ])
2689 AC_MSG_CHECKING([for Sun LDAP SDK])
2690 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2694 # include <string.h>
2698 return strcmp(LDAP_VENDOR_NAME,"Sun Microsystems Inc.");
2701 [ AC_DEFINE(HAVE_SUN_LDAP_SDK, 1, [Sun LDAP SDK support])
2702 AC_MSG_RESULT(yes) ],
2703 [ AC_MSG_RESULT(no) ],
2704 [ AC_MSG_RESULT(cross-compiler cant tell) ])
2706 AC_MSG_CHECKING([for Mozilla LDAP SDK])
2707 AC_RUN_IFELSE([AC_LANG_SOURCE([[
2710 # elif HAVE_MOZLDAP_LDAP_H
2711 # include <mozldap/ldap.h>
2713 # include <string.h>
2717 return strcmp(LDAP_VENDOR_NAME,"mozilla.org");
2720 [ AC_DEFINE(HAVE_MOZILLA_LDAP_SDK, 1, [Mozilla LDAP SDK support])
2721 AC_MSG_RESULT(yes) ],
2722 [ AC_MSG_RESULT(no)],
2723 [ AC_MSG_RESULT(cross-compiler cant tell) ])
2726 dnl Check for LDAP_REBINDPROC_CALLBACK
2728 AC_MSG_CHECKING([for LDAP_REBINDPROC_CALLBACK])
2729 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2732 # elif HAVE_MOZLDAP_LDAP_H
2733 # include <mozldap/ldap.h>
2736 LDAP_REBINDPROC_CALLBACK ldap_rebind;
2738 [ AC_DEFINE(HAVE_LDAP_REBINDPROC_CALLBACK,1,[Define to 1 if you have LDAP_REBINDPROC_CALLBACK])
2739 AC_MSG_RESULT(yes) ],
2740 [ AC_MSG_RESULT(no) ])
2743 dnl Check for LDAP_REBIND_PROC
2745 AC_MSG_CHECKING([for LDAP_REBIND_PROC])
2746 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2749 # elif HAVE_MOZLDAP_LDAP_H
2750 # include <mozldap/ldap.h>
2753 LDAP_REBIND_PROC ldap_rebind;
2755 [ AC_DEFINE(HAVE_LDAP_REBIND_PROC,1,[Define to 1 if you have LDAP_REBIND_PROC])
2756 AC_MSG_RESULT(yes) ],
2757 [ AC_MSG_RESULT(no) ])
2760 dnl Check for LDAP_REBIND_FUNCTION
2762 AC_MSG_CHECKING([for LDAP_REBIND_FUNCTION])
2763 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2764 # define LDAP_REFERRALS
2767 # elif HAVE_MOZLDAP_LDAP_H
2768 # include <mozldap/ldap.h>
2771 LDAP_REBIND_FUNCTION ldap_rebind;
2773 [ AC_DEFINE(HAVE_LDAP_REBIND_FUNCTION,1,[Define to 1 if you have LDAP_REBIND_FUNCTION])
2774 AC_MSG_RESULT(yes) ],
2775 [ AC_MSG_RESULT(no) ])
2778 dnl Check for LDAP_SCOPE_DEFAULT
2780 AC_MSG_CHECKING([for LDAP_SCOPE_DEFAULT])
2781 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2784 # elif HAVE_MOZLDAP_LDAP_H
2785 # include <mozldap/ldap.h>
2788 int i=LDAP_SCOPE_DEFAULT;
2790 [ AC_DEFINE(HAVE_LDAP_SCOPE_DEFAULT,1,[Define to 1 if you have LDAP_SCOPE_DEFAULT])
2791 AC_MSG_RESULT(yes) ],
2792 [ AC_MSG_RESULT(no) ])
2795 dnl Check for ldap_url_desc.lud_scheme
2797 AC_CHECK_MEMBER(struct ldap_url_desc.lud_scheme,
2798 AC_DEFINE(HAVE_LDAP_URL_LUD_SCHEME,1,
2799 [Define to 1 if you have LDAPURLDesc.lud_scheme]),,[#include <ldap.h>])
2802 dnl Check for ldapssl_client_init
2804 AC_CHECK_LIB(ldap,ldapssl_client_init,
2805 AC_DEFINE(HAVE_LDAPSSL_CLIENT_INIT,1,[Define to 1 if you have ldapssl_client_init]),)
2808 dnl Check for ldap_url_desc2str
2810 AC_CHECK_LIB(ldap,ldap_url_desc2str,
2811 AC_DEFINE(HAVE_LDAP_URL_DESC2STR,1,[Define to 1 if you have ldap_url_desc2str]),)
2814 dnl Check for ldap_url_parse
2816 AC_CHECK_LIB(ldap,ldap_url_parse,
2817 AC_DEFINE(HAVE_LDAP_URL_PARSE,1,[Define to 1 if you have ldap_url_parse]),)
2820 dnl Check for ldap_start_tls_s
2822 AC_CHECK_LIB(ldap,ldap_start_tls_s,
2823 AC_DEFINE(HAVE_LDAP_START_TLS_S,1,[Define to 1 if you have ldap_start_tls_s]),)
2831 dnl this is not fully functional if db.h is for a differend db version
2834 dnl check that dbopen is actually defined in the header
2835 dnl FIXME: in case of failure undef db-related includes etc.
2836 AC_CHECK_DECL(dbopen,,,[
2837 #if HAVE_SYS_TYPES_H
2838 #include <sys/types.h>
2850 SQUID_CHECK_DBOPEN_NEEDS_LIBDB
2851 if test "x$ac_cv_dbopen_libdb" = "xyes"; then
2856 dnl System-specific library modifications
2860 if test "x$GCC" = "xyes"; then
2861 AC_MSG_NOTICE([Removing -O for gcc on $host])
2862 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2866 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
2867 LIBS=`echo $LIBS | sed -e s/-lsocket//`
2868 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
2869 LIBS=`echo $LIBS | sed -e s/-lnsl//`
2870 ac_cv_lib_nsl_main=no
2871 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
2872 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2874 dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
2875 dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
2876 dnl Please change your configure script. AIX doesn't need -lbsd.
2878 AC_MSG_NOTICE([Removing -lbsd for AIX...])
2879 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2881 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
2887 public:virtual ~Foo(){}
2889 class Bar:public Foo{
2890 public:Bar():Foo(){}
2893 Foo * myFoo=new Bar();
2894 Bar * myBar=dynamic_cast<Bar *>(myFoo);
2895 assert(myBar != NULL);
2897 if test "$ac_cv_require_rtti" = "yes"; then
2898 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
2899 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
2903 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
2905 if test "$ac_cv_require_qcpluscmt" = "yes"; then
2906 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
2911 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
2912 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
2913 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,
2914 [If gettimeofday is known to take only one argument])
2916 [*-*-solaris2.[0-4]])
2917 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2919 [*-sony-newsos[56]*])
2920 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2924 # Remove optimization for GCC 2.95.[123]
2925 # gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
2926 if test "x$GCC" = "xyes"; then
2927 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
2930 AC_MSG_NOTICE([Removing -O for gcc on $host with GCC $GCCVER])
2931 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2936 # Recommended by Balint Nagy Endre <bne@CareNet.hu>
2939 if test `uname -v` = "2.03"; then
2940 AC_MSG_NOTICE([disabling mallinfo for $host])
2941 ac_cv_func_mallinfo=no
2946 dnl This has to be before AC_CHECK_FUNCS
2947 # Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2948 # when running configure.
2949 if test "x$ac_cv_func_poll" = "x" ; then
2953 AC_MSG_NOTICE([disabling poll for $host...])
2954 ac_cv_func_poll='no'
2957 # Henrik Nordstrom (hno@squid-cache.org) 19980817
2958 # poll is problematic on Linux. We disable it
2959 # by default until Linux gets it right.
2960 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2961 if test $rev -lt 002002; then
2962 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
2963 ac_cv_func_poll='no'
2966 [powerpc-ibm-aix4.1.*])
2967 # Mike Laster (mlaster@metavillage.com) 19981021
2968 AC_MSG_NOTICE([disabling poll for $host...])
2969 ac_cv_func_poll='no'
2972 # Robert Side <rside@aiinc.bc.ca>
2973 # Mon, 18 Jan 1999 17:48:00 GMT
2974 AC_MSG_NOTICE([disabling poll for $host...])
2975 ac_cv_func_poll='no'
2980 dnl Override statfs() detect on MinGW because it is emulated in source code
2981 if test "x$squid_host_os" = "xmingw" ; then
2982 ac_cv_func_statfs='yes'
2985 dnl Check for library functions
2987 backtrace_symbols_fd \
3016 pthread_attr_setschedparam \
3017 pthread_attr_setscope \
3018 pthread_setschedparam \
3047 dnl ... and some we provide local replacements for
3063 # Magic which checks whether we are forcing a type of comm loop we
3064 # are actually going to (ab)use.
3065 # Mostly ripped from squid-commloops, thanks to adrian and benno
3067 if test "x$squid_opt_io_loop_engine" != "x"; then
3068 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine])
3069 elif test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes" ; then
3070 squid_opt_io_loop_engine="epoll"
3071 elif test "x$enable_kqueue" != "xno" ; then
3072 squid_opt_io_loop_engine="kqueue"
3073 elif test "x$enable_devpoll" != "xno" ; then
3074 squid_opt_io_loop_engine="devpoll"
3075 elif test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes" ; then
3076 squid_opt_io_loop_engine="poll"
3077 elif test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"; then
3078 squid_opt_io_loop_engine="select"
3079 elif test "x$enable_select" != "xno" -a "x$squid_host_os" = "xmingw"; then
3080 squid_opt_io_loop_engine="select_win32"
3082 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
3083 AC_MSG_WARN([Will try select and hope for the best.])
3084 squid_opt_io_loop_engine="select"
3087 AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
3089 AM_CONDITIONAL([USE_POLL], [test $squid_opt_io_loop_engine = poll])
3090 AM_CONDITIONAL([USE_EPOLL], [test $squid_opt_io_loop_engine = epoll])
3091 AM_CONDITIONAL([USE_SELECT], [test $squid_opt_io_loop_engine = select])
3092 AM_CONDITIONAL([USE_SELECT_WIN32], [test $squid_opt_io_loop_engine = select_win32])
3093 AM_CONDITIONAL([USE_KQUEUE], [test $squid_opt_io_loop_engine = kqueue])
3094 AM_CONDITIONAL([USE_DEVPOLL], [test $squid_opt_io_loop_engine = devpoll])
3096 case $squid_opt_io_loop_engine in
3097 epoll) AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop]) ;;
3098 devpoll) AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop]) ;;
3099 poll) AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop]) ;;
3100 kqueue) AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop]) ;;
3101 select_win32) AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop]) ;;
3102 select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
3105 if test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes" ; then
3106 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
3109 SQUID_CHECK_SETRESUID_WORKS
3110 if test "x$squid_cv_resuid_works" = "xyes" ; then
3111 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.])
3114 AC_MSG_CHECKING([for constant CMSG_SPACE])
3115 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3116 #if HAVE_SYS_SOCKET_H
3117 #include <sys/socket.h>
3120 int a[CMSG_SPACE(int)];
3123 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
3128 SQUID_CHECK_FUNC_STRNSTR
3129 SQUID_CHECK_FUNC_VACOPY
3130 SQUID_CHECK_FUNC___VACOPY
3133 dnl IP-Filter support requires ipf header files. These aren't
3134 dnl installed by default, so we need to check for them
3135 if test "x$enable_ipf_transparent" != "xno" ; then
3136 AC_MSG_CHECKING(for availability of IP-Filter header files)
3137 # hold on to your hats...
3138 if test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
3139 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
3140 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
3141 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes" ; then
3142 have_ipfilter_compat_header="yes"
3144 if test "x$have_ipfilter_compat_header" = "xyes" -a \
3145 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
3146 "x$ac_cv_header_ip_nat_h" = "xyes" ; then
3147 enable_ipf_transparent="yes"
3148 elif test "x$have_ipfilter_compat_header" = "xyes" -a \
3149 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
3150 "x$ac_cv_header_netinet_ip_nat_h" = "xyes" ; then
3151 enable_ipf_transparent="yes"
3153 enable_ipf_transparent="no"
3155 AC_MSG_RESULT($IPF_TRANSPARENT)
3157 AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
3158 SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
3159 [Enable support for IPF-style transparent proxying])
3161 if test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris" ; then
3162 dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3163 dnl Solaris minor version (8, 9, 10, ...)
3164 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3165 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3166 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
3169 dnl PF /dev/pf support requires a header file.
3170 if test "x$with_nat_devpf" != "xno" ; then
3171 if test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
3172 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"; then
3173 if test "x$with_nat_devpf" = "xauto" ; then
3177 if test "x$with_nat_devpf" = "xyes" ; then
3178 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
3183 SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
3184 [Enable support for PF-style transparent proxying])
3185 SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
3186 [Enable support for /dev/pf NAT lookups])
3188 if test "x$enable_linux_netfilter" != "xno" ; then
3189 if test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"; then
3190 if test "x$enable_linux_netfilter" = "xauto" ; then
3191 enable_linux_netfilter=yes
3194 if test "x$enable_linux_netfilter" = "xauto" ; then
3195 enable_linux_netfilter=no
3197 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
3201 SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
3202 [Enable support for Transparent Proxy on Linux via Netfilter])
3204 dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
3205 AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
3206 if test "x$enable_linux_netfilter" = "xyes" -a "x$with_libcap" != "xyes" ; then
3207 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
3208 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
3209 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
3213 if test "x$squid_opt_netfilterconntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3214 AC_MSG_ERROR([Linux netfilter conntrack requires libcap support (libcap 2.09+)])
3216 if test "x$with_netfilter_conntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3217 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
3218 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
3219 with_netfilter_conntrack=no
3221 AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack} ${squid_opt_netfilterconntrackpath}])
3224 AC_ARG_ENABLE(zph-qos,
3225 AS_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]), [
3226 SQUID_YESNO([$enableval],
3227 [unrecognized argument to --enable-zph-qos: $enableval])
3229 SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
3230 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
3231 TOS field of HIT responses to help policing network traffic])
3232 AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
3233 if test x"$enable_zph_qos" = "xyes" ; then
3234 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
3235 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
3236 [Enable support for QOS netfilter mark preservation])
3240 AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
3241 AC_ARG_ENABLE(gnuregex,
3242 AS_HELP_STRING([--enable-gnuregex],
3243 [Compile GNUregex. Unless you have reason to use
3244 this option, you should not enable it.
3245 This library file is usually only required on Windows and
3246 very old Unix boxes which do not have their own regex
3247 library built in.]), [
3248 SQUID_YESNO([$enableval],[unrecognized argument to --enable-gnuregex: $enableval])
3250 # force-enable on old solaris and nextstep
3251 if test "x${enable_gnuregex:=auto}" = "xauto" ; then
3253 *-sun-solaris2.[[0-4]])
3254 enable_gnuregex="yes"
3257 enable_gnuregex="yes"
3262 # try detecting if it is needed
3263 if test "x$enable_gnuregex" = "xauto" ; then
3264 SQUID_CHECK_REGEX_WORKS
3265 if test "x$squid_cv_regex_works" = "xyes" ; then
3271 AC_MSG_CHECKING(if GNUregex needs to be compiled)
3272 AC_MSG_RESULT($enable_gnuregex)
3273 if test "x$enable_gnuregex" = "xyes"; then
3274 # for some reason (force-enable, test..) gnuregex was found as needed. Override any system lib
3277 #if no reason was found to enable gnuregex, disable it
3278 if test "x$enable_gnuregex" = "xauto" ; then
3281 SQUID_DEFINE_BOOL(USE_GNUREGEX,$enable_gnuregex,[Define if we should use GNU regex])
3284 SQUID_DETECT_UDP_SND_BUFSIZE
3285 SQUID_DETECT_UDP_RECV_BUFSIZE
3286 SQUID_DETECT_TCP_SND_BUFSIZE
3287 SQUID_DETECT_TCP_RECV_BUFSIZE
3289 SQUID_CHECK_RECV_ARG_TYPE
3290 SQUID_CHECK_NEED_SYS_ERRLIST
3291 SQUID_CHECK_MAXPATHLEN
3293 if test "x$squid_opt_use_dnshelper" = "xyes"; then
3294 SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
3295 SQUID_CHECK_RESOLVER_FIELDS
3298 if test "x$ac_cv_header_sys_statvfs_h" = "xyes" ; then
3299 SQUID_CHECK_WORKING_STATVFS
3303 dnl Squid will usually attempt to translate when packaging or building from VCS
3304 AC_ARG_ENABLE(translation,
3305 AS_HELP_STRING([--disable-translation],[Prevent Squid generating localized error page templates and manuals.
3306 Which is usually tried, but may not be needed.]), [
3307 SQUID_YESNO([$enableval],
3308 [unrecognized argument to --disable-translation: $enableval])
3310 dnl Squid now has .po translation capability, given the right toolkit
3311 if test "x${enable_translation:=yes}" = "xyes" ; then
3312 AX_WITH_PROG([PO2HTML],[po2html])
3313 AX_WITH_PROG([PO2TEXT],[po2txt])
3321 dnl Squid now has limited locale handling ...
3323 AC_ARG_ENABLE(auto-locale,
3324 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
3325 clients request headers.
3326 When disabled Squid requires explicit language configuration.]), [
3327 SQUID_YESNO([$enableval],
3328 [unrecognized argument to --disable-auto-locale: $enableval])
3330 AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
3331 SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
3332 [Use multi-language support on error pages])
3335 dnl Need the debugging version of malloc if available
3337 if test "x$ac_cv_lib_malloc_main" = "xyes" ; then
3338 if test -r /usr/lib/debug/malloc.o ; then
3339 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3341 if test -r /usr/lib/debug/mallocmap.o ; then
3342 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3347 if test "x$XTRA_LIBS" = "x"; then
3350 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
3355 AC_SUBST(SQUID_CFLAGS)
3356 AC_SUBST(SQUID_CXXFLAGS)
3358 AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
3359 AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
3360 AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
3361 AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
3362 AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
3363 AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
3364 AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
3365 AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
3367 dnl Clean up after OSF/1 core dump bug
3374 lib/ntlmauth/Makefile \
3375 lib/profiler/Makefile \
3376 lib/rfcnb/Makefile \
3377 lib/smblib/Makefile \
3386 src/auth/basic/Makefile \
3387 src/auth/digest/Makefile \
3388 src/auth/negotiate/Makefile \
3389 src/auth/ntlm/Makefile \
3390 src/adaptation/Makefile \
3391 src/adaptation/icap/Makefile \
3392 src/adaptation/ecap/Makefile \
3396 src/format/Makefile \
3399 src/ident/Makefile \
3410 test-suite/Makefile \
3412 doc/manuals/Makefile \
3414 helpers/basic_auth/Makefile \
3415 helpers/basic_auth/DB/Makefile \
3416 helpers/basic_auth/fake/Makefile \
3417 helpers/basic_auth/getpwnam/Makefile \
3418 helpers/basic_auth/LDAP/Makefile \
3419 helpers/basic_auth/MSNT/Makefile \
3420 helpers/basic_auth/MSNT-multi-domain/Makefile \
3421 helpers/basic_auth/NCSA/Makefile \
3422 helpers/basic_auth/NIS/Makefile \
3423 helpers/basic_auth/PAM/Makefile \
3424 helpers/basic_auth/POP3/Makefile \
3425 helpers/basic_auth/RADIUS/Makefile \
3426 helpers/basic_auth/SASL/Makefile \
3427 helpers/basic_auth/SMB/Makefile \
3428 helpers/basic_auth/SSPI/Makefile \
3429 helpers/digest_auth/Makefile \
3430 helpers/digest_auth/eDirectory/Makefile \
3431 helpers/digest_auth/file/Makefile \
3432 helpers/digest_auth/LDAP/Makefile \
3433 helpers/ntlm_auth/Makefile \
3434 helpers/ntlm_auth/fake/Makefile \
3435 helpers/ntlm_auth/smb_lm/Makefile \
3436 helpers/ntlm_auth/SSPI/Makefile \
3437 helpers/negotiate_auth/Makefile \
3438 helpers/negotiate_auth/kerberos/Makefile \
3439 helpers/negotiate_auth/SSPI/Makefile \
3440 helpers/negotiate_auth/wrapper/Makefile \
3441 helpers/external_acl/Makefile \
3442 helpers/external_acl/AD_group/Makefile \
3443 helpers/external_acl/eDirectory_userip/Makefile \
3444 helpers/external_acl/file_userip/Makefile \
3445 helpers/external_acl/kerberos_ldap_group/Makefile \
3446 helpers/external_acl/LDAP_group/Makefile \
3447 helpers/external_acl/LM_group/Makefile \
3448 helpers/external_acl/session/Makefile \
3449 helpers/external_acl/SQL_session/Makefile \
3450 helpers/external_acl/unix_group/Makefile \
3451 helpers/external_acl/wbinfo_group/Makefile \
3452 helpers/external_acl/time_quota/Makefile \
3453 helpers/log_daemon/Makefile \
3454 helpers/log_daemon/DB/Makefile \
3455 helpers/log_daemon/file/Makefile \
3456 helpers/url_rewrite/Makefile \
3457 helpers/url_rewrite/fake/Makefile \
3458 helpers/ssl/Makefile \
3460 tools/purge/Makefile
3463 AC_CONFIG_SUBDIRS(lib/libTrie)
3465 # must configure libltdl subdir unconditionally for "make distcheck" to work
3466 #AC_CONFIG_SUBDIRS(libltdl)