]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.ac
Have SQUID_CHECK_LIB_WORKS do state SAVE/RESTORE (#1774)
[thirdparty/squid.git] / configure.ac
CommitLineData
b8ae064d 1## Copyright (C) 1996-2023 The Squid Software Foundation and contributors
5d2e6f19
AJ
2##
3## Squid software is distributed under GPLv2+ license and includes
4## contributions from numerous individuals and organizations.
5## Please see the COPYING and CONTRIBUTORS files for details.
6##
7
672d2a73 8AC_INIT([Squid Web Proxy],[7.0.0-VCS],[https://bugs.squid-cache.org/],[squid])
d966027f 9AC_PREREQ(2.61)
62979ab1 10AC_CONFIG_HEADERS([include/autoconf.h])
71b12d7c 11AC_CONFIG_AUX_DIR(cfgaux)
8d9ce05e 12AC_CONFIG_SRCDIR([src/main.cc])
3dc6f003 13AM_INIT_AUTOMAKE([tar-ustar nostdinc subdir-objects dist-xz])
c2720d44 14AC_REVISION($Revision$)dnl
a2794549 15AC_PREFIX_DEFAULT(/usr/local/squid)
246d7ffc 16AM_MAINTAINER_MODE
a2794549 17
5d2e6f19 18m4_include([acinclude/ax_with_prog.m4])
4ecf021b 19m4_include([acinclude/init.m4])
fa522425 20m4_include([acinclude/squid-util.m4])
6a56798f 21m4_include([acinclude/compiler-flags.m4])
0abb39dd 22m4_include([acinclude/os-deps.m4])
c8093f05 23m4_include([acinclude/krb5.m4])
0d57ed2e 24m4_include([acinclude/ldap.m4])
3c586e38 25m4_include([acinclude/pam.m4])
2b448046 26m4_include([acinclude/pkg.m4])
acd207af 27m4_include([acinclude/tdb.m4])
91983da0 28m4_include([acinclude/lib-checks.m4])
09835feb 29m4_include([acinclude/ax_cxx_compile_stdcxx.m4])
b9ce9676 30m4_include([acinclude/win32-sspi.m4])
6a56798f 31
63e02610 32PRESET_CFLAGS="$CFLAGS"
a203dec7 33PRESET_CXXFLAGS="$CXXFLAGS"
63e02610 34PRESET_LDFLAGS="$LDFLAGS"
35
a2794549 36dnl Set default LDFLAGS
a1c22363 37AS_IF([test "x$LDFLAGS" = "x"],[LDFLAGS="-g"])
a2794549 38
0c4134e1
AJ
39# check for host OS detail
40AC_CANONICAL_HOST
41AC_MSG_CHECKING([simplified host os])
42simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
43squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
44AS_IF([test -n "$squid_host_os_version"],[
45 squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
46],[
47 squid_host_os="$simple_host_os"
48])
49AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
50# on windows squid_host_os is either mingw or cygwin, version is 32
51
a2794549 52AC_PROG_CC
e6c4cdd6 53AM_PROG_CC_C_O
29b8d8d6 54AC_PROG_CXX
0c4134e1
AJ
55
56# AC_USE_SYSTEM_EXTENSIONS should be called before any macros that run the C compiler.
5139f0f6 57AC_USE_SYSTEM_EXTENSIONS
0c4134e1 58
62979ab1 59AC_LANG([C++])
3e7b6055 60
c8640c9a
AJ
61# Clang 3.2 on some CPUs requires -march-native to detect correctly.
62# GCC 4.3+ can also produce faster executables when its used.
63# But building inside a virtual machine environment has been found to
64# cause random Illegal Instruction errors due to mis-detection of CPU.
65AC_ARG_ENABLE(arch-native,
66 AS_HELP_STRING([--disable-arch-native],[Some compilers offer CPU-specific
67 optimizations with the -march=native parameter.
68 This flag disables the optimization. The default is to
69 auto-detect compiler support and use where available.]), [
ec308e40 70 SQUID_YESNO([$enableval],[--enable-arch-native])
c8640c9a 71])
d8a4ba7c 72AC_MSG_NOTICE([CPU arch native optimization enabled: ${enable_arch_native:=auto}])
a1c22363 73AS_IF([test "x${enable_arch_native}" != "xno"],[
c8640c9a 74 SQUID_CC_CHECK_ARGUMENT([squid_cv_check_marchnative],[-march=native])
a1c22363 75])
e9d3951b 76
09835feb
AR
77# If the user did not specify a C++ version.
78user_cxx=`echo "$PRESET_CXXFLAGS" | grep -o -E "(-)std="`
79AS_IF([test "x$user_cxx" = "x"],[
80 # Check for C++17 compiler support
81 # May change CXX.
82 AX_CXX_COMPILE_STDCXX([17],[noext],[mandatory])
83])
84
85# Prerequisite: CXX has been finalized.
86# BUILDCXXFLAGS are defined later, after CXXFLAGS have been finalized.
b2f0a375 87AC_ARG_VAR([BUILDCXX],[path to compiler for building compile-time tools. e.g. cf_gen])
a1c22363
AJ
88AS_IF([test "x$HOSTCXX" != "x" -a "x$BUILDCXX" = "x"],[
89 AC_MSG_WARN([Cross-compiling with HOSTCXX is deprecated. Use BUILDCXX instead.])
b2f0a375 90 BUILDCXX="$HOSTCXX"
a1c22363
AJ
91])
92AS_IF([test "x$BUILDCXX" = "x"],[
b2f0a375 93 BUILDCXX="$CXX"
a1c22363 94 AS_IF([test "x$squid_cv_check_marchnative" = "xyes"],[
e9d3951b 95 CXXFLAGS="$CXXFLAGS -march=native"
a1c22363
AJ
96 ])
97])
b2f0a375 98AC_SUBST(BUILDCXX)
de051d9d 99
aff48cc8 100# test for programs
aff48cc8
FC
101AC_PROG_RANLIB
102AC_PROG_CPP
103AC_PROG_INSTALL
104AC_PROG_LN_S
105AC_PROG_EGREP
106
107AC_PATH_PROG(SH, sh, /bin/sh)
108AC_PATH_PROG(FALSE, false, /usr/bin/false)
109AC_PATH_PROG(TRUE, true, /usr/bin/true)
110AC_PATH_PROG(MV, mv, $FALSE)
111AC_PATH_PROG(MKDIR, mkdir, $FALSE)
112AC_PATH_PROG(LN, ln, cp)
113AC_PATH_PROG(CHMOD, chmod, $FALSE)
6d1c1ab1 114AC_PATH_PROG(TR, tr, $FALSE)
aff48cc8
FC
115AC_PATH_PROG(RM, rm, $FALSE)
116dnl Libtool 2.2.6 requires: rm -f
117RM="$RM -f"
118
d93bf055
AJ
119PKG_PROG_PKG_CONFIG
120
aff48cc8 121AC_PATH_PROG(PERL, perl, none)
a1c22363 122AS_IF([test "x$ac_cv_path_PERL" = "xnone"],[
aff48cc8 123 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
a1c22363 124])
07f370ee 125AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
33d1abfe 126AM_CONDITIONAL(ENABLE_POD2MAN_DOC, test "x${ac_cv_path_POD2MAN}" != "x$FALSE")
aff48cc8 127
a1c22363 128AC_PATH_PROG(AR, ar, $FALSE)
aff48cc8 129AR_R="$AR r"
aff48cc8
FC
130AC_SUBST(AR_R)
131
86b8d400
AJ
132AC_PATH_PROG(LINUXDOC, linuxdoc, $FALSE)
133AM_CONDITIONAL(ENABLE_RELEASE_DOCS, test "x${ac_cv_path_LINUXDOC}" != "x$FALSE")
134
552d1774
AJ
135SQUID_RELEASE=`echo $VERSION | cut -d. -f1`
136AC_SUBST(SQUID_RELEASE)
137
cda5e747 138# pre-define DEFAULT_PREFIX, some modules need it.
a1c22363 139AS_IF([test "${prefix}" = "NONE"],[squid_prefix=$ac_default_prefix],[squid_prefix=$prefix])
cda5e747
AJ
140AC_DEFINE_UNQUOTED(DEFAULT_PREFIX,[$squid_prefix],[The install prefix])
141
0b45d157
FC
142AC_ARG_ENABLE(strict-error-checking,
143 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
2d65bb9a 144 with all possible static compiler error-checks enabled.
cdb352bb 145 This flag disables the behavior]), [
ec308e40 146 SQUID_YESNO([$enableval],[--enable-strict-error-checking])
0b45d157 147])
cdb352bb 148AC_MSG_NOTICE([strict error checking enabled: ${enable_strict_error_checking:=yes}])
d1f95b42 149
4313559d 150# LT_INIT requires libtool v2, might as well state it loud
2663a9c8 151LT_PREREQ([2.2])
5a2409b7 152LT_INIT([dlopen])
a1c22363
AJ
153AS_IF([test "x$ac_top_build_prefix" != "x"],[
154 # LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
155 # But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
156 # This fixes Linux LTDLv3-v7, and BSD LTDL v2.2
157 top_build_prefix=${ac_top_build_prefix}
158 AC_SUBST(top_build_prefix)
159])
bd9303f5 160LTDL_INIT
081863f3 161
d9a41469 162dnl LibTool environment is now prepared for setup. Check that it is usable and initialize.
081863f3 163LT_LIB_DLLOAD
3e7b6055
AR
164
165# Do we need these unconditionally for "make distcheck" to work?
166AC_SUBST(INCLTDL)
167AC_SUBST(LIBLTDL)
168
5a2409b7
AJ
169AC_MSG_CHECKING(whether to use loadable modules)
170AS_IF([test "x${enable_shared:=yes}" = "xyes"],[AC_DEFINE(USE_LOADABLE_MODULES,1,[Support Loadable Modules])])
171AM_CONDITIONAL(ENABLE_LOADABLE_MODULES, test "x${enable_shared:=yes}" = "xyes")
172AC_MSG_RESULT([$enable_shared])
173
07f370ee 174SQUID_CC_GUESS_VARIANT
fa6307ae 175SQUID_CC_GUESS_OPTIONS
f9d138eb 176
be0c7ff0
FC
177dnl find out the exe extension for this platform.
178dnl If it is not empty, use it for CGI as well.
a2794549 179AC_EXEEXT
180AC_OBJEXT
a1c22363 181AS_IF([test "x$EXEEXT" = "x"],[CGIEXT=".cgi"],[CGIEXT=""])
7aeb8001 182AC_SUBST(CGIEXT)
a2794549 183
a396d1f8 184AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,[test "x$squid_host_os" = "xmingw"])
daf2ddfa 185AM_CONDITIONAL(ENABLE_WIN32_IPC,[test "x$squid_host_os" = "xmingw"])
fcabe077 186
a1c22363
AJ
187AS_CASE(["$squid_host_os"],
188 [mingw],[
a1c22363
AJ
189 CFLAGS="$CFLAGS -mthreads"
190 CXXFLAGS="$CXXFLAGS -mthreads -static-libgcc -static-libstdc++"
f44dcb95
AJ
191 dnl Check for Winsock only on MinGW
192 SQUID_CHECK_WINSOCK_LIB
3f045e25 193 AC_CHECK_HEADERS([ws2tcpip.h winsock2.h windows.h io.h],,,[
f44dcb95
AJ
194#if HAVE_WS2TCPIP_H
195#include <ws2tcpip.h>
196#endif
197#if HAVE_WINSOCK2_H
198#include <winsock2.h>
199#endif
200#if HAVE_WINDOWS_H
201#include <windows.h>
202#endif
203 ])
a1c22363
AJ
204 MINGW_LIBS="-lmingwex"
205 AC_SUBST(MINGW_LIBS)
3f045e25 206 AC_CHECK_FUNCS([fsync])
a1c22363
AJ
207 ],
208
209 [freebsd],[
b5467222
CT
210 # FreeBSD places local libraries and packages in /usr/local
211 CFLAGS="$CFLAGS -I/usr/local/include"
212 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
213 LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-R/usr/local/lib"
a1c22363
AJ
214 ]
215)
4b26fae9 216
f4aaf39c 217dnl Substitutions
6a9f6389 218AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
30a4f2a8 219
9603207d 220AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args",
8075a4da 221 [configure command line used to configure Squid])
090089c4 222
5483d916 223CACHE_EFFECTIVE_USER="nobody"
224AC_ARG_WITH(default-user,
62979ab1 225 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
5483d916 226 [ CACHE_EFFECTIVE_USER="$withval" ]
227)
228AC_SUBST(CACHE_EFFECTIVE_USER)
229
c8d2dc9b
AJ
230DEFAULT_LOG_DIR="$localstatedir/logs"
231AC_ARG_WITH(logdir,
73862432 232 AS_HELP_STRING([--with-logdir=PATH],
a1c22363
AJ
233 [Default location for squid logs. default: PREFIX/var/logs]),[
234 AS_CASE([$withval],
235 [yes|no],[AC_MSG_ERROR([--with-logdir requires a directory PATH. --with-logdir=PATH])],
236 [DEFAULT_LOG_DIR="$withval"]
237 )
238])
c8d2dc9b
AJ
239AC_SUBST(DEFAULT_LOG_DIR)
240
2f36643c 241DEFAULT_PID_FILE="$localstatedir/run/@SERVICE_NAME@.pid"
a7f6af35 242AC_ARG_WITH(pidfile,
e0eb5853 243 AS_HELP_STRING([--with-pidfile=PATH],
a1c22363
AJ
244 [Default location for squid pid file. Default: PREFIX/var/run/squid.pid]),[
245 AS_CASE([$withval],
246 [yes|no],[AC_MSG_ERROR([--with-pidfile requires a file PATH. --with-pidfile=PATH])],
247 [DEFAULT_PID_FILE="$withval"]
248 )
e0eb5853 249])
32f07882 250AC_SUBST(DEFAULT_PID_FILE)
a7f6af35 251
bf52b026
AJ
252DEFAULT_SWAP_DIR="$localstatedir/cache/squid"
253AC_ARG_WITH(swapdir,
254 AS_HELP_STRING([--with-swapdir=PATH],
a1c22363
AJ
255 [Default location for squid cache directories. Default: PREFIX/var/cache/squid]),[
256 AS_CASE([$withval],
257 [yes|no],[AC_MSG_ERROR([--with-swapdir requires a directory PATH. --with-swapdir=PATH])],
258 [DEFAULT_SWAP_DIR="$withval"]
259 )
bf52b026
AJ
260])
261AC_SUBST(DEFAULT_SWAP_DIR)
262
30a4f2a8 263dnl Set Default CFLAGS
a1c22363
AJ
264AS_IF([test "x$PRESET_CFLAGS" = "x"],[
265 AS_IF([test "$squid_cv_compiler" = "gcc"],[
266 # TODO check if these exceptions are still necessary
267 AS_CASE(["$host"],
268 [*-sun-sunos*],[
269 # sunos has too many warnings for -Wall to be useful
270 ],
271 [CFLAGS="$squid_cv_cc_option_wall $CFLAGS"]
272 )
273 ],[
274 AS_CASE(["$host"],
275 [*mips-sgi-irix6.*],[
fcabe077
FC
276 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
277 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
278 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
279 -Wl,-woff,85,-woff,84,-woff,134 \
280 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
281 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
282 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
283 -Wl,-woff,85,-woff,84,-woff,134 \
284 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
a1c22363
AJ
285 ])
286 ])
287])
30a4f2a8 288
0ba77a3c
AR
289AC_MSG_CHECKING([compiler name-version])
290squid_cv_cc_name=`$CC --version | head -1 | cut -f1 -d" "`
291AS_CASE([$squid_cv_cc_name],
292 [gcc|clang],[squid_cv_cc_majversion=`$CC -dumpversion | cut -f1 -d.`],
293 [squid_cv_cc_majversion="unknown"]
294)
295squid_cv_cc_simplified="$squid_cv_cc_name-$squid_cv_cc_majversion"
296AC_MSG_RESULT($squid_cv_cc_simplified)
297
298# warning flags
299
300# -Wall
301SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([$squid_cv_cc_option_wall])
302
303# -Wextra
304AS_IF([test "$squid_cv_cc_simplified" = "gcc-4"],[
305 AC_MSG_NOTICE([skipping -Wextra on $squid_cv_cc_simplified])
306],[
307 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wextra])
308
309 # Now disable or configure certain warnings enabled by -Wextra
310
311 # -Wunused-private-field causes a huge number of false positives
312 # in unit tests. Disable that
313 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wno-unused-private-field])
314
09835feb
AR
315 # ...=5: Do not trust comments about fallthrough cases (GCC).
316 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wimplicit-fallthrough=5])
317 AS_IF([test "x$squid_cv_cc_arg_wimplicit_fallthrough_5" != "xyes"], [
0ba77a3c
AR
318 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wno-implicit-fallthrough])
319 ])
320])
321
8b082ed9 322# useful warnings that may not be included in -Wall -Wextra
0ba77a3c
AR
323SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wpointer-arith])
324SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wwrite-strings])
325SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wcomments])
326SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wshadow])
327SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wmissing-declarations])
328SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Woverloaded-virtual])
07f370ee 329
05c9db69 330dnl CentOS (and RHEL) still define ntohs() using deprecated C++ features
629cb141 331SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_wno_deprecated_register],[-Werror -Wno-deprecated-register],[[#include <arpa/inet.h>]],[[int fox=ntohs(1);]])
05c9db69 332
a1c22363 333AS_IF([test "x$enable_strict_error_checking" != "xno"],[
fcabe077 334 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
59a09b98 335 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
a1c22363 336])
07f370ee 337
a1c22363 338AS_IF([test "x$ac_cv_require_wno_deprecated_register" = "xyes"],[
0568bff2 339 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -Wno-deprecated-register"
a1c22363 340])
0568bff2 341
e0eb5853
FC
342# squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
343SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
344SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
2060fa9a 345
4fe75473
FC
346# possibly include some build info tag into squid -v
347SQUID_EMBED_BUILD_INFO
348
83079644 349AC_ARG_ENABLE(optimizations,
ffa3bad9 350 AS_HELP_STRING([--disable-optimizations],
be0c7ff0 351 [Do not compile Squid with compiler optimizations enabled.
a2f6a96c
FC
352 Optimization is good for production builds, but not
353 good for debugging. During development, use
354 --disable-optimizations to reduce compilation times
10185a38 355 and allow easier debugging.]), [
a1c22363
AJ
356 AS_IF([test "x$enableval" = "xno"],[
357 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
358 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
359 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9g]]*//'`"
360 ])
83079644 361])
362
c9267250
AJ
363dnl Nasty hack to get autoconf 2.64 on Linux to run.
364dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
aff0e8fe 365AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[:])
c9267250 366
0d00c98b 367AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
d9180414 368AC_ARG_ENABLE(xmalloc-statistics,
8075a4da
FC
369 AS_HELP_STRING([--enable-xmalloc-statistics],
370 [Show malloc statistics in status page]), [
ec308e40 371 SQUID_YESNO([$enableval],[--enable-xmalloc-statistics])
e5f4e1b0 372])
4d1d2477
FC
373SQUID_DEFINE_BOOL(XMALLOC_STATISTICS,${enable_xmalloc_statistics:=no},
374 [Show malloc statistics in status page])
375AC_MSG_NOTICE([xmalloc stats display: $enable_xmalloc_statistics])
e5f4e1b0 376
8075a4da 377squid_opt_aufs_threads=""
f85c88f3 378AC_ARG_WITH(aufs-threads,
8075a4da 379 AS_HELP_STRING([--with-aufs-threads=N_THREADS],
a1c22363
AJ
380 [Tune the number of worker threads for the aufs object store.]), [
381 AS_CASE([$withval],
c881e2b1 382 [@<:@0-9@:>@*],[squid_opt_aufs_threads=$withval],
8b0d8e31 383 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
a1c22363
AJ
384 )
385])
386AS_IF([test "x$squid_opt_aufs_threads" != "x"],[
387 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
388 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
389 [Defines how many threads aufs uses for I/O])
a3310b77 390])
cd748f27 391
24531401
AJ
392## TODO check if this is necessary, LT_INIT does these checks
393SQUID_AUTO_LIB(dl,[dynamic linking],[LIBDL])
a3bc98c3 394SQUID_CHECK_LIB_WORKS(dl,[
24531401 395 LDFLAGS="$LIBDL_PATH $LDFLAGS"
a3bc98c3 396 AC_CHECK_LIB(dl, dlopen,[LIBDL_LIBS="-ldl"])
a1c22363 397])
f85c88f3 398
8636e7c1
EB
399AC_DEFUN([LIBATOMIC_CHECKER],[
400 AC_MSG_CHECKING(whether linking $1 -latomic works)
401 AC_LINK_IFELSE([
402 AC_LANG_SOURCE([[
403#include <atomic>
404#include <cstdint>
405 int
b98c6823
HS
406 main(int argc, char **) {
407 return (
408 std::atomic<uint8_t>(uint8_t(argc)).exchange(0) &&
409 std::atomic<uint64_t>{}.is_lock_free()
410 ) ? 0 : 1;
8636e7c1
EB
411 }
412 ]])],[
413 AC_MSG_RESULT(yes)
414 libatomic_checker_result="yes"],[
415 AC_MSG_RESULT(no)
416 libatomic_checker_result="no"
417])])
418
4b0f8912 419## check for atomics library before anything that might need it
16530552 420SQUID_STATE_SAVE(LIBATOMIC)
8636e7c1
EB
421LIBATOMIC_CHECKER(without)
422AS_IF([test "x$libatomic_checker_result" = "xno"],[
423 LIBS="$LIBS -latomic"
424 LIBATOMIC_CHECKER(with)
425 AS_IF([test "x$libatomic_checker_result" = "xyes"],[
426 ATOMICLIB="-latomic"],[
427 AC_MSG_ERROR([Required library libatomic not found.])
428])])
16530552 429SQUID_STATE_ROLLBACK(LIBATOMIC)
4b0f8912
AJ
430AC_SUBST(ATOMICLIB)
431
a186e0d9 432SQUID_AUTO_LIB(psapi,[Windows PSAPI.dll],[LIBPSAPI])
92d356d1 433SQUID_CHECK_LIB_WORKS(psapi,[
a186e0d9
AJ
434 CPPFLAGS="$LIBPSAPI_CFLAGS $CPPFLAGS"
435 LIBS="$LIBPSAPI_PATH $LIBS"
92d356d1
AJ
436 AC_CHECK_LIB([psapi],[K32GetProcessMemoryInfo],[
437 LIBPSAPI_LIBS="-lpsapi"
438 AC_CHECK_HEADERS([psapi.h],,,[
a186e0d9
AJ
439#if HAVE_WINDOWS_H
440#include <windows.h>
441#endif
92d356d1 442 ])
a186e0d9 443 ])
a186e0d9 444])
a186e0d9 445
c975f532 446AC_SEARCH_LIBS([shm_open], [rt])
a1c22363 447AS_IF([test "x$ac_cv_search_shm_open" != "xno"],[
c975f532 448 AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
a1c22363 449])
c975f532 450
a1c22363 451squid_disk_module_candidates=
2513178d 452AC_ARG_ENABLE(disk-io,
50fbcbd6
FC
453 AS_HELP_STRING([--enable-disk-io="list of modules"],
454 [Build support for the list of disk I/O modules.
455 Set without a value or omitted, all available modules will be built.
456 See src/DiskIO for a list of available modules, or
457 Programmers Guide section on DiskIO
a1c22363
AJ
458 for details on how to build your custom disk module]),
459 AS_CASE(["$enableval"],
460 [yes],[],
461 [no|none],[enable_disk_io="no"],
462 [
463 enable_disk_io="yes"
464 squid_disk_module_candidates="$enableval"
465 ])
466)
467AS_IF([test "x${enable_disk_io:=yes}" = "xyes"],[
468 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
469 AS_IF([test "x$ac_cv_search_shm_open" = "xno"],[
470 squid_disk_module_candidates=`echo "$squid_disk_module_candidates" | sed 's/IpcIo//g'`
471 ])
472])
473SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
dc299f29 474SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
a1c22363
AJ
475AC_MSG_NOTICE([DiskIO modules built: ${squid_disk_module_candidates:-none}])
476SQUID_DEFINE_BOOL(USE_DISKIO,$enable_disk_io,[DiskIO modules are expected to be available.])
40503c27 477
2513178d 478dnl Some autoconf.h defines we might enable later...
0b163dbb
FC
479AC_ARG_WITH(pthreads,AS_HELP_STRING([--without-pthreads],[Disable POSIX Threads]))
480AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO. Default: auto-detect]))
daf2ddfa 481ENABLE_WIN32_AIOPS=0
ffa3bad9
FC
482squid_opt_use_aio=
483squid_opt_use_diskthreads=
46577dd1 484AIOLIB=
2513178d
AJ
485
486dnl Setup the module paths etc.
2513178d
AJ
487DISK_LIBS=
488DISK_MODULES=
d9691f09
AJ
489AH_TEMPLATE(HAVE_DISKIO_MODULE_AIO, [Whether POSIX AIO Disk I/O module is built])
490AH_TEMPLATE(HAVE_DISKIO_MODULE_BLOCKING, [Whether Blocking Disk I/O module is built])
491AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKDAEMON, [Whether DiskDaemon Disk I/O module is built])
23ee12fb 492AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKTHREADS, [Whether DiskThreads Disk I/O module is built])
d9691f09
AJ
493AH_TEMPLATE(HAVE_DISKIO_MODULE_IPCIO, [Whether IpcIo Disk I/O module is built])
494AH_TEMPLATE(HAVE_DISKIO_MODULE_MMAPPED, [Whether Mmapped Disk I/O module is built])
50fbcbd6 495for module in $squid_disk_module_candidates none; do
d235bc84 496 # maybe not needed
a1c22363
AJ
497 AS_IF([test "x$module" = "xnone"],[continue])
498 AS_IF([! test -d "$srcdir/src/DiskIO/$module"],[AC_MSG_ERROR([disk-io $module does not exist])])
499 AS_CASE(["$module"],
500 [AIO],[
d9691f09
AJ
501 dnl Check for POSIX AIO availability
502 squid_opt_use_aio="yes"
503 AIOLIB=
a1c22363 504 AS_IF([test "x$with_aio" != "xno"],[
d9691f09
AJ
505 have_aio_header=no
506 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
507 dnl On some systems POSIX AIO functions are in librt
508 dnl On some systems POSIX AIO functions are in libaio
509 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
510 dnl Enable AIO if the library and headers are found
a1c22363 511 AS_IF([test "x$AIOLIB" != "x" -a "x$have_aio_header" = "xyes"],[
d9691f09
AJ
512 AC_MSG_NOTICE([Native POSIX AIO support detected.])
513 squid_opt_use_aio="yes"
a1c22363 514 ],[
d9691f09
AJ
515 dnl Windows does things differently. We provide wrappers.
516 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
a1c22363
AJ
517 AS_IF([test "$squid_host_os" = "mingw"],[
518 squid_opt_use_aio="yes"
519 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
520 ],[
521 squid_opt_use_aio="no"
522 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
523 ])
524 ])
525 ],[
d9691f09
AJ
526 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
527 squid_opt_use_aio="no"
a1c22363 528 ])
d9691f09 529 dnl Use the POSIX AIO pieces if we actually need them.
a1c22363 530 AS_IF([test "x$squid_opt_use_aio" = "xyes"],[
d9691f09 531 DISK_MODULES="$DISK_MODULES AIO"
d9691f09 532 AC_DEFINE([HAVE_DISKIO_MODULE_AIO],1,[POSIX AIO Disk I/O module is built])
a1c22363
AJ
533 AS_IF([test "$squid_host_os" = "mingw"],[
534 ENABLE_WIN32_AIO=1
535 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
536 ],[
537 AC_MSG_NOTICE([Enabling AIO DiskIO module])
538 ])
539 ],[
d9691f09 540 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
fedd516f 541 squid_disk_module_candidates_AIO=no
a1c22363
AJ
542 ])
543 ],
d9691f09 544
a1c22363 545 [Blocking],[
d9691f09
AJ
546 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
547 DISK_MODULES="$DISK_MODULES Blocking"
d9691f09 548 AC_DEFINE([HAVE_DISKIO_MODULE_BLOCKING],1,[Blocking Disk I/O module is built])
a1c22363
AJ
549 ],
550
551 [DiskDaemon],[
552 AS_IF([test "$squid_host_os" = "mingw"],[
553 AC_MSG_NOTICE([DiskDaemon not supported on MinGW])
554 squid_disk_module_candidates_DiskDaemon=no
555 ],[
556 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
557 DISK_MODULES="$DISK_MODULES DiskDaemon"
558 AC_DEFINE([HAVE_DISKIO_MODULE_DISKDAEMON],1,[DiskDaemon Disk I/O module is built])
559 ])
560 ],
561
562 [DiskThreads],[
507ca601
FC
563 squid_opt_use_diskthreads="yes"
564 LIBPTHREADS=
565 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
a1c22363
AJ
566 AS_IF([test "x$with_pthreads" != "xno"],[
567 dnl TODO: this needs to be extended to handle more systems and better
568 dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
569 dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
570 AS_CASE(["$squid_host_os"],
571 [mingw],[
daf2ddfa 572 ENABLE_WIN32_AIOPS=1
507ca601 573 AC_MSG_NOTICE([Windows threads support automatically enabled])
a1c22363
AJ
574 ],
575
576 [freebsd],[
577 AS_IF([test `echo "$squid_host_os_version" | tr -d .` -lt 70],[
578 AC_MSG_NOTICE(pthread library requires FreeBSD 7 or later)
579 squid_opt_use_diskthreads="no"
580 ],[
a0f82085
AJ
581 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
582 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
a1c22363
AJ
583 AS_IF([test "x$GCC" = "xyes" -a "x$PRESET_LDFLAGS" = "x"],[LDFLAGS="$LDFLAGS -pthread"])
584 ])
585 ],
586
587 [openbsd],[
588 AS_IF([test `echo "$squid_host_os_version" | tr -d .` -lt 52],[
589 AC_MSG_NOTICE(pthread library requires OpenBSD 5.2 or later)
590 squid_opt_use_diskthreads="no"
591 ],[
ec264296
SH
592 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
593 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
594 LDFLAGS="$LDFLAGS -lpthread"
a1c22363
AJ
595 ])
596 ],
597
598 [solaris],[
599 AS_IF([test "x$GCC" = "xyes"],[
507ca601
FC
600 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
601 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
602 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
603 AC_MSG_NOTICE(pthread library required but cannot be found.)
604 squid_opt_use_diskthreads="no"
605 ])
a1c22363 606 ],[
507ca601
FC
607 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
608 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
609 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
610 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
9603207d 611 LIBPTHREADS="" #in LIBS
507ca601
FC
612 ],[
613 AC_MSG_NOTICE(pthread library required but cannot be found.)
614 squid_opt_use_diskthreads="no"
615 ])
a1c22363
AJ
616 ])
617 ],
618
619 [
507ca601
FC
620 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
621 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
622 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
40503c27
FC
623 AC_MSG_NOTICE(pthread library required but cannot be found.)
624 squid_opt_use_diskthreads="no"
625 ])
a1c22363
AJ
626 ]
627 )
628 ],[
629 AC_MSG_NOTICE([Native pthreads support manually disabled.])
630 squid_opt_use_diskthreads="no"
631 ])
632 AS_IF([test "x$squid_opt_use_diskthreads" = "xyes"],[
633 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
634 DISK_MODULES="$DISK_MODULES DiskThreads"
635 AC_DEFINE([HAVE_DISKIO_MODULE_DISKTHREADS],1,[DiskThreads Disk I/O module is built])
636 ],[
637 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
638 SQUID_STATE_ROLLBACK([diskthreads_state])
639 squid_disk_module_candidates_DiskThreads=no
640 ])
641 ],
642
643 [IpcIo],[
644 AS_IF([test "x$ac_cv_search_shm_open" = "xno"],[
fedd516f
AJ
645 AC_MSG_NOTICE([DiskIO IpcIo module requires shared memory support])
646 squid_disk_module_candidates_IpcIo=no
a1c22363 647 ],[
23ee12fb 648 AC_MSG_NOTICE([Enabling IpcIo DiskIO module])
fedd516f 649 DISK_MODULES="$DISK_MODULES IpcIo"
fedd516f 650 AC_DEFINE([HAVE_DISKIO_MODULE_IPCIO],1,[IpcIo Disk I/O module is built])
a1c22363
AJ
651 ])
652 ],
2513178d 653
a1c22363 654 [Mmapped],[
e2cbb70e
FC
655 dnl TODO: use availability of sys/mman.h and/or mmap to define
656 dnl OR support windows mmap functions
a1c22363 657 AS_IF([test "x$squid_host_os" = "xmingw"],[
e2cbb70e 658 AC_MSG_NOTICE([Mmapped DiskIO is not available on Mingw])
fedd516f 659 squid_disk_module_candidates_Mmapped=no
a1c22363 660 ],[
e2cbb70e 661 AC_MSG_NOTICE([Enabling Mmapped DiskIO module])
e2cbb70e 662 DISK_MODULES="$DISK_MODULES Mmapped"
d9691f09 663 AC_DEFINE([HAVE_DISKIO_MODULE_MMAPPED],1,[Mmapped Disk I/O module is built])
a1c22363
AJ
664 ])
665 ],
e2851fe7 666
a1c22363 667 [
507ca601 668 AC_MSG_NOTICE([Enabling $module DiskIO module])
d9691f09 669 DISK_LIBS="$DISK_LIBS lib${module}.la"
507ca601 670 DISK_MODULES="$DISK_MODULES ${module}"
a1c22363 671 ])
2513178d
AJ
672done
673AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
674AC_SUBST(DISK_MODULES)
675AC_SUBST(DISK_LIBS)
8aafbbc1 676AM_CONDITIONAL(ENABLE_DISKIO_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes")
d9691f09 677AC_SUBST(AIOLIB)
8aafbbc1
AJ
678AM_CONDITIONAL(ENABLE_WIN32_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes" -a "x$ENABLE_WIN32_AIO" = "x1")
679AM_CONDITIONAL(ENABLE_DISKIO_BLOCKING, test "x$squid_disk_module_candidates_Blocking" = "xyes")
680AM_CONDITIONAL(ENABLE_DISKIO_DISKDAEMON, test "x$squid_disk_module_candidates_DiskDaemon" = "xyes")
681AM_CONDITIONAL(ENABLE_DISKIO_DISKTHREADS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes")
d9691f09 682AC_SUBST(LIBPTHREADS)
8aafbbc1
AJ
683AM_CONDITIONAL(ENABLE_WIN32_AIOPS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes" -a "x$ENABLE_WIN32_AIOPS" = "x1")
684AM_CONDITIONAL(ENABLE_DISKIO_IPCIO, test "x$squid_disk_module_candidates_IpcIo" = "xyes")
685AM_CONDITIONAL(ENABLE_DISKIO_MMAPPED, test "x$squid_disk_module_candidates_Mmapped" = "xyes")
2513178d
AJ
686
687dnl Check what Storage formats are wanted.
688dnl This version will error out with a message saying why if a required DiskIO is missing.
d235bc84
FC
689AC_ARG_ENABLE([storeio],
690 AS_HELP_STRING([--enable-storeio="list of modules"],
691 [Build support for the list of store I/O modules.
18cc92fb
FC
692 The default is only to build the "ufs" module.
693 See src/fs for a list of available modules, or
694 Programmers Guide section <not yet written>
507ca601 695 for details on how to build your custom store module]), [
a1c22363
AJ
696 AS_CASE(["$enableval"],
697 [yes],[],
698 [no|none],[enable_storeio="no"],
699 [
700 enable_storeio="yes"
701 # ufs is really always needed as it has low-level routines
702 # if it is a dupe it will be cleaned-up later
703 squid_storeio_module_candidates="$enableval ufs"
704 ])
705])
706AS_IF([test "x${enable_storeio:=yes}" = "xyes"],[
d235bc84 707 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
a1c22363 708])
dc299f29
FC
709SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
710SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
a1c22363 711AC_MSG_NOTICE([Store modules built: ${squid_storeio_module_candidates:-none}])
dc299f29 712
a1c22363
AJ
713for fs in ${squid_storeio_module_candidates:-none}; do
714 AS_CASE([$fs],
715 [diskd],[
716 AS_IF([test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
717 "x$squid_disk_module_candidates_DiskDaemon" != "xyes"],[
507ca601 718 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
a1c22363
AJ
719 ])
720 ],
721 [aufs],[
722 AS_IF([test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
723 "x$squid_disk_module_candidates_DiskThreads" != "xyes"],[
507ca601 724 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
a1c22363
AJ
725 ])
726 ],
727 [rock],[
728 AS_IF([test "x$squid_disk_module_candidates_IpcIo" != "xyes" -a \
729 "x$squid_disk_module_candidates_Blocking" != "xyes"],[
b5b88fb5 730 AC_MSG_ERROR([Storage module Rock requires DiskIO module: Blocking or IpcIo])
a1c22363 731 ])
b5b88fb5 732 squid_do_build_rock=true
a1c22363
AJ
733 ],
734 [ufs],[
735 AS_IF([test "x$squid_disk_module_candidates_Blocking" != "xyes"],[
b5b88fb5 736 AC_MSG_ERROR([Storage module ufs requires DiskIO module: Blocking])
a1c22363 737 ])
b5b88fb5 738 squid_do_build_ufs=true
a1c22363
AJ
739 ]
740 )
a2794549 741done
23ee12fb 742
8aafbbc1
AJ
743AM_CONDITIONAL(ENABLE_FS_UFS, test "x$squid_do_build_ufs" = "xtrue")
744AM_CONDITIONAL(ENABLE_FS_ROCK, test "x$squid_do_build_rock" = "xtrue")
9d6186b1
FC
745dnl hack: need to define those even if not used in the build system to
746dnl make sure that global FS objects are linked to the squid binary.
7b5b7ba8
CT
747AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
748AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
749AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
e2851fe7 750AH_TEMPLATE(HAVE_FS_ROCK, "Define to 1 if rock filesystem module is build")
7b5b7ba8
CT
751
752
dc299f29 753dnl got final squid_storeio_module_candidates, build library lists
b66455ff
AR
754dnl This list will not be needed when each fs library has its own Makefile
755STORE_LIBS_TO_BUILD=
756dnl File system libraries to link executables with.
757dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
758STORE_LIBS_TO_ADD=
dc299f29 759for fs in $squid_storeio_module_candidates; do
7b5b7ba8
CT
760 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
761 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
6d1c1ab1
FC
762 SQUID_TOUPPER_VAR_CONTENTS([fs])
763 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
b66455ff
AR
764done
765
766AC_SUBST(STORE_LIBS_TO_BUILD)
767AC_SUBST(STORE_LIBS_TO_ADD)
082a5e7a 768AC_SUBST(STORE_TESTS)
a2794549 769
24a04df9
AJ
770
771dnl At lest one removal policy is always needed.
772dnl 'lru' removal policy is currently hard-coded by name for tests
773dnl so we must set it as default.
774REPL_POLICIES="lru"
d9180414 775AC_ARG_ENABLE(removal-policies,
56ffc413
FC
776 AS_HELP_STRING([--enable-removal-policies="list of policies"],
777 [Build support for the list of removal policies.
18cc92fb
FC
778 The default is only to build the "lru" module.
779 See src/repl for a list of available modules, or
780 Programmers Guide section 9.9 for details on how
507ca601 781 to build your custom policy]), [
a1c22363
AJ
782 AS_CASE(["$enableval"],
783 [yes],[ SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES]) ],
784 [no],[],
785 [ REPL_POLICIES="$enableval" ]
786 )
787])
788SQUID_CLEANUP_MODULES_LIST([REPL_POLICIES])
789SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
790AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
791REPL_OBJS="repl/lib`echo \"$REPL_POLICIES\" | sed -e 's% %.a repl/lib%g'`.a"
792REPL_LIBS=`echo "$REPL_OBJS" | sed -e 's%repl/%%g'`
6a566b9c 793AC_SUBST(REPL_POLICIES)
6a566b9c 794AC_SUBST(REPL_OBJS)
f71946fc 795AC_SUBST(REPL_LIBS)
6a566b9c 796
d1da2d1f 797AM_CONDITIONAL(ENABLE_PINGER, false)
e5f4e1b0 798AC_ARG_ENABLE(icmp,
a1c22363
AJ
799 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),[
800 AS_IF([test "x$enableval" = "xyes"],[
eed82608 801 AC_MSG_NOTICE([ICMP enabled])
be0c7ff0 802 AC_DEFINE(USE_ICMP,1,[Define to use Squid ICMP and Network Measurement features (highly recommended!)])
d1da2d1f 803 AM_CONDITIONAL(ENABLE_PINGER, true)
a1c22363 804 ])
e5f4e1b0 805])
806
9a0a18de 807AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
d9180414 808AC_ARG_ENABLE(delay-pools,
a1c22363
AJ
809 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),[
810 AS_IF([test "x$enableval" = "xyes"],[
eed82608 811 AC_MSG_NOTICE([Delay pools enabled])
9a0a18de 812 AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
ffe4ffd8 813 AM_CONDITIONAL(ENABLE_DELAY_POOLS, true)
a1c22363 814 ])
e5f4e1b0 815])
816
5fa840c3 817dnl disable generic/common adaptation support by default
5069fb38 818squid_opt_use_adaptation=no
5fa840c3 819
82c9e1f0
AJ
820AH_TEMPLATE([USE_SQUID_ESI],[whether to enable ESI processing])
821AC_ARG_ENABLE(esi,[
822 AS_HELP_STRING([--enable-esi],
823 [Enable ESI for accelerators. ESI requires expat or xml2 library.
7eb77a5f 824 Enabling ESI will cause squid reverse proxies to be capable
82c9e1f0
AJ
825 of the Edge Acceleration Specification (www.esi.org).])
826],[
827 SQUID_DEFINE_BOOL(USE_SQUID_ESI,$enable_esi)
828])
829AC_MSG_NOTICE([Enable ESI processor: ${enable_esi:=no (auto)}])
88bfe098 830
7eb77a5f 831# ESI support libraries: expat
5cf2197f 832SQUID_AUTO_LIB(expat,[ESI expat library],[LIBEXPAT])
7b47b3cb 833SQUID_CHECK_LIB_WORKS(expat,[
7b47b3cb 834 PKG_CHECK_MODULES([LIBEXPAT],[expat],[:],[:])
407c0702
AJ
835 CPPFLAGS="$LIBEXPAT_CFLAGS $CPPFLAGS"
836 AC_CHECK_HEADERS(expat.h)
a1c22363 837])
ad32c661 838
866a092d 839# ESI support libraries: xml2
5cf2197f 840SQUID_AUTO_LIB(xml2,[ESI xml2 library],[LIBXML2])
209bb425 841SQUID_CHECK_LIB_WORKS(xml2,[
209bb425 842 PKG_CHECK_MODULES([LIBXML2],[libxml-2.0],[:],[:])
37be0e75 843 CPPFLAGS="$LIBXML2_CFLAGS $CPPFLAGS"
0dc1a86a 844 AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
a1c22363 845])
7eb77a5f 846
82c9e1f0
AJ
847AS_IF([test "x$enable_esi" = "xyes" -a "x$LIBXML2_LIBS" = "x" -a "x$LIBEXPAT_LIBS" = "x"],[
848 AC_MSG_ERROR([ESI processor requires libxml2 or libexpat])
799b66d1 849])
82c9e1f0 850AM_CONDITIONAL(ENABLE_ESI,[test "x$enable_esi" = "xyes"])
43ae1d95 851
51952383 852AC_ARG_ENABLE(icap-client,
4f07726a 853 AS_HELP_STRING([--disable-icap-client],[Disable the ICAP client.]),[
ec308e40 854 SQUID_YESNO([$enableval],[--enable-icap-client])
4f07726a
AJ
855])
856SQUID_DEFINE_BOOL(ICAP_CLIENT,${enable_icap_client:=yes}, [Enable ICAP client features in Squid])
ebf76e07 857AS_IF(test "x$enable_icap_client" != "xno", squid_opt_use_adaptation="yes")
8aafbbc1 858AM_CONDITIONAL(ENABLE_ICAP_CLIENT, test "x$enable_icap_client" != "xno")
51952383 859
3e7b6055 860AC_ARG_ENABLE(ecap,
a1c22363 861 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]),[
ec308e40 862 SQUID_YESNO([$enableval],[--enable-ecap])],[
a1c22363
AJ
863 enable_ecap="no"
864])
3e7b6055 865dnl Perform configuration consistency checks for eCAP
a1c22363
AJ
866AS_IF([test "x$enable_ecap" != "xno"],[
867 AS_IF([test "x$enable_shared" != "xyes"],[
5a2409b7 868 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-shared with --enable-ecap.])
a1c22363 869 ])
4cfba571 870
a1c22363 871 AS_IF([test -n "$PKG_CONFIG"],[
6666da11 872 dnl eCAP support requires libecap.
0a720258 873 dnl This Squid supports libecap v1.0.x.
3e115aaf
AR
874 dnl Use EXT_ prefix to distinguish external libecap (that we check for
875 dnl here) from our own convenience ecap library in Makefiles.
0a720258 876 PKG_CHECK_MODULES([EXT_LIBECAP],[libecap >= 1.0 libecap < 1.1])
a1c22363 877 ],[
cbc14831 878 AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
a1c22363 879 ])
3e7b6055 880
ebf76e07 881 SQUID_STATE_SAVE(squid_ecap_state)
8800478b
AJ
882 CPPFLAGS="$EXT_LIBECAP_CFLAGS $CPPFLAGS"
883 LIBS="$EXT_LIBECAP_LIBS $LIBS"
884 AC_CHECK_HEADERS([ \
885 libecap/adapter/service.h \
886 libecap/adapter/xaction.h \
887 libecap/common/area.h \
888 libecap/common/body.h \
889 libecap/common/delay.h \
890 libecap/common/forward.h \
891 libecap/common/header.h \
892 libecap/common/memory.h \
893 libecap/common/message.h \
894 libecap/common/name.h \
895 libecap/common/named_values.h \
896 libecap/common/names.h \
897 libecap/common/options.h \
898 libecap/common/registry.h \
899 libecap/common/version.h \
900 libecap/host/host.h \
901 libecap/host/xaction.h \
902 ],,,[
903/* libecap-1.0.1 headers do not build without autoconf.h magic */
904#define HAVE_CONFIG_H
905/* libecap/common/delay.h fails to include <string> */
906#include <string>
907 ])
ebf76e07 908 AC_MSG_CHECKING([whether -lecap will link])
8800478b
AJ
909 AC_LINK_IFELSE([AC_LANG_PROGRAM([[
910#if HAVE_LIBECAP_COMMON_NAMES_H
911#include <libecap/common/names.h>
912#endif
913 ]],[[
914 const libecap::Name test("test", libecap::Name::NextId());
915 ]])
916 ],[
ebf76e07 917 AC_MSG_RESULT(yes)
5069fb38 918 squid_opt_use_adaptation=yes
ebf76e07
AJ
919 ],[
920 AC_MSG_RESULT(no)
a1c22363
AJ
921 AS_IF([test "x$enable_ecap" = "xyes"],[
922 AC_MSG_ERROR([eCAP library will not link.
ebf76e07 923 You may need to rebuild libecap using the same version of GCC as Squid.
a1c22363
AJ
924 There have been breaking ABI changes in the libstdc++ STL with GCC 5.])
925 ],[
926 AC_MSG_NOTICE([eCAP library will not link.
ebf76e07
AJ
927 You may need to rebuild libecap using the same version of GCC as Squid.
928 There have been breaking ABI changes in the libstdc++ STL with GCC 5.])
a1c22363 929 enable_ecap="no"
ebf76e07
AJ
930 ])
931 ])
932 SQUID_STATE_ROLLBACK(squid_ecap_state)
a1c22363
AJ
933])
934SQUID_DEFINE_BOOL(USE_ECAP,${enable_ecap:=no},[Whether to use eCAP support])
935AM_CONDITIONAL(ENABLE_ECAP, test "x$enable_ecap" = "xyes")
3e7b6055 936
5fa840c3 937dnl enable adaptation if requested by specific adaptation mechanisms
8aafbbc1 938ADAPTATION_LIBS=""
a1c22363 939AS_IF([test "x$squid_opt_use_adaptation" = "xyes"],[ADAPTATION_LIBS="adaptation/libadaptation.la"])
8aafbbc1
AJ
940SQUID_DEFINE_BOOL(USE_ADAPTATION,${squid_opt_use_adaptation:=no}, [common adaptation support])
941AM_CONDITIONAL(ENABLE_ADAPTATION, test "x$squid_opt_use_adaptation" = "xyes")
5fa840c3 942AC_SUBST(ADAPTATION_LIBS)
3e7b6055 943
a1c22363 944AS_IF([test "x$squid_host_os" = "xmingw"],[enable_wccp=no])
5069fb38 945AC_ARG_ENABLE(wccp,
ec308e40
AJ
946 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]),[
947 SQUID_YESNO([$enableval],[--enable-wccp])
5069fb38 948])
0067eb06 949SQUID_DEFINE_BOOL(USE_WCCP, ${enable_wccp:=yes}, [Define to enable WCCP])
1a6b111a 950AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $enable_wccp])
0b0cfcf2 951
a1c22363 952AS_IF([test "x$squid_host_os" = "xmingw"],[enable_wccpv2=no])
0b0cfcf2 953AC_ARG_ENABLE(wccpv2,
1a6b111a 954 AS_HELP_STRING([--disable-wccpv2],
9603207d 955 [Disable Web Cache Coordination V2 Protocol]), [
ec308e40 956 SQUID_YESNO([$enableval],[--enable-wccpv2])
0b0cfcf2 957])
0067eb06 958SQUID_DEFINE_BOOL(USE_WCCPv2,${enable_wccpv2:=yes},
1a6b111a
FC
959 [Define to enable WCCP V2])
960AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $enable_wccpv2])
320e9f36 961
e5f4e1b0 962AC_ARG_ENABLE(snmp,
1d87b6b3 963 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
ec308e40 964 SQUID_YESNO([$enableval],[--enable-snmp])
87630341 965])
0067eb06 966SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes},
1a6b111a 967 [Define to enable SNMP monitoring of Squid])
f738d783 968AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
a1c22363 969AS_IF([test "x$enable_snmp" = "xyes"],[SNMPLIB="../lib/snmplib/libsnmplib.la"])
1a6b111a 970AC_MSG_NOTICE([SNMP support enabled: $enable_snmp])
e5f4e1b0 971AC_SUBST(SNMPLIB)
e5f4e1b0 972
ee0927b6 973AC_ARG_ENABLE(eui,
1a6b111a 974 AS_HELP_STRING([--disable-eui],
c8da66ba 975 [Disable use of ARP / MAC/ EUI (ether address)]), [
ec308e40 976 SQUID_YESNO([$enableval],[--enable-eui])
1a6b111a 977])
a1c22363 978AS_IF([test "x${enable_eui:=yes}" = "xyes"],[
195ec847
AJ
979 SQUID_STATE_SAVE(LIBEUI)
980 # GLIBC 2.30 deprecates sysctl.h. Test with the same flags that (may) break includes later.
981 CFLAGS=$SQUID_CFLAGS
982 CXXFLAGS=$SQUID_CXXFLAGS
a1c22363
AJ
983 AS_CASE(["$squid_host_os"],
984 [linux|solaris|freebsd|openbsd|netbsd|cygwin],[:],
985 [mingw],[EUILIB="-liphlpapi"],
986 [AC_MSG_WARN([EUI support probably will not work on host $host.])]
987 )
b966288b 988 # iphlpapi.h check delayed after winsock2.h
507ca601 989 AC_CHECK_HEADERS( \
32341684 990 windows.h \
507ca601 991 sys/sockio.h \
32341684
AJ
992 sys/param.h,
993 [], [], [[
994#if HAVE_WINDOWS_H
995include <windows.h>
54d47324 996#endif
32341684 997]]
507ca601 998 )
29759678
FC
999 AC_CHECK_HEADERS( \
1000 net/if_arp.h \
9603207d 1001 net/route.h,
29759678
FC
1002 [], [], [[
1003#include <sys/types.h>
1004#include <sys/socket.h>
1005]])
1006
43c1320a
AJ
1007 # OpenBSD, FreeBSD and NetBSD requires sys/param.h to be included before sysctl.h and net/if_dl.h
1008 AC_CHECK_HEADERS( \
1009 net/if_dl.h \
1010 sys/sysctl.h,
1011 [], [], [[
54d47324 1012#if HAVE_SYS_PARAM_H
29759678
FC
1013#include <sys/param.h>
1014#endif
1015 ]])
195ec847 1016 SQUID_STATE_ROLLBACK(LIBEUI)
a1c22363 1017])
2ef664d8 1018AC_SUBST(EUILIB)
1a6b111a 1019AC_MSG_NOTICE([EUI (MAC address) controls enabled: $enable_eui])
0067eb06 1020SQUID_DEFINE_BOOL(USE_SQUID_EUI,$enable_eui,
1a6b111a 1021 [Define this to include code which lets you use ethernet addresses. This code uses API initially defined in 4.4-BSD.])
8aafbbc1 1022AM_CONDITIONAL(ENABLE_EUI, [test "x$enable_eui" = "xyes" ])
1a6b111a 1023
e5f4e1b0 1024
74075210 1025AC_ARG_ENABLE(htcp,
47d80734 1026 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]), [
ec308e40 1027 SQUID_YESNO([$enableval],[--enable-htcp])
74075210 1028])
0f658b5b 1029SQUID_DEFINE_BOOL(USE_HTCP,${enable_htcp:=yes},
47d80734 1030 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
fcabe077 1031AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
1a6b111a
FC
1032AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
1033
09cd7204 1034# Cryptograhic libraries
24531401 1035SQUID_AUTO_LIB(nettle,[Nettle crypto],[LIBNETTLE])
a3bc98c3 1036SQUID_CHECK_LIB_WORKS(nettle,[
deb19890 1037 PKG_CHECK_MODULES([LIBNETTLE],[nettle >= 3.4],[
b12b66cd 1038 CPPFLAGS="$LIBNETTLE_CFLAGS $CPPFLAGS"
deb19890
AJ
1039 AC_CHECK_HEADERS(nettle/base64.h nettle/md5.h)
1040 ],[:])
a1c22363 1041])
a9dfcab8 1042
e59a64d7
AJ
1043dnl Check for libcrypt
1044CRYPTLIB=
1045dnl Some of our helpers use crypt(3) which may be in libc, or in
1046dnl libcrypt (eg FreeBSD)
1047AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
1048dnl Solaris10 provides MD5 natively through libmd5
1049AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
1050AC_SUBST(CRYPTLIB)
1051
24531401 1052SQUID_AUTO_LIB(gnutls,[GnuTLS crypto],[LIBGNUTLS])
a3bc98c3 1053SQUID_CHECK_LIB_WORKS(gnutls,[
516ec633 1054 PKG_CHECK_MODULES([LIBGNUTLS],[gnutls >= 3.4.0],[
c813943d
AJ
1055 CPPFLAGS="$LIBGNUTLS_CFLAGS $CPPFLAGS"
1056 AC_CHECK_HEADERS(gnutls/gnutls.h gnutls/x509.h gnutls/abstract.h)
1057 ],[:])
a1c22363 1058])
b4f805f6 1059
c813943d 1060SSLLIB=""
3d4022fa 1061dnl User may specify OpenSSL is needed from a non-standard location
24531401 1062SQUID_OPTIONAL_LIB(openssl,[OpenSSL],[LIBOPENSSL])
cb4f4424 1063AH_TEMPLATE(USE_OPENSSL,[OpenSSL support is available])
c41db002 1064## OpenSSL is default disable due to licensing issues on some OS
a1c22363 1065AS_IF([test "x$with_openssl" = "xyes"],[
24531401 1066 CPPFLAGS="$LIBOPENSSL_CFLAGS $CPPFLAGS"
c41db002 1067 AC_CHECK_HEADERS( \
24b30fdc 1068 openssl/asn1.h \
8693472e 1069 openssl/bio.h \
24b30fdc 1070 openssl/bn.h \
eacc1666 1071 openssl/crypto.h \
742236c7 1072 openssl/decoder.h \
24b30fdc 1073 openssl/dh.h \
c41db002 1074 openssl/err.h \
24b30fdc
EQ
1075 openssl/evp.h \
1076 openssl/lhash.h \
c41db002
AJ
1077 openssl/md5.h \
1078 openssl/opensslv.h \
24b30fdc 1079 openssl/rsa.h \
c41db002 1080 openssl/ssl.h \
24b30fdc 1081 openssl/x509.h \
c41db002
AJ
1082 openssl/x509v3.h \
1083 openssl/engine.h \
1084 openssl/txt_db.h \
a7b75c64 1085 openssl/pem.h \
c41db002
AJ
1086 )
1087
e0b98074 1088 # User may have provided a custom location for OpenSSL. Otherwise...
84c3fc14
AJ
1089 SQUID_STATE_SAVE(squid_openssl_state)
1090 LIBS="$LIBS $LIBOPENSSL_PATH"
1091
1092 # auto-detect using pkg-config
1093 PKG_CHECK_MODULES([LIBOPENSSL],[openssl],,[
1094 ## For some OS pkg-config is broken or unavailable.
1095 ## Detect libraries the hard way.
1096
1097 # Windows MinGW has some special libraries ...
a1c22363 1098 AS_IF([test "x$squid_host_os" = "xmingw"],[
84c3fc14
AJ
1099 LIBOPENSSL_LIBS='-lssleay32 -leay32 -lgdi32 $LIBOPENSSL_LIBS'
1100 AC_MSG_NOTICE([Windows OpenSSL library support: yes -lssleay32 -leay32 -lgdi32])
a1c22363 1101 ])
e0b98074 1102
84c3fc14
AJ
1103 AC_CHECK_LIB(crypto,[CRYPTO_new_ex_data],[LIBOPENSSL_LIBS="-lcrypto $LIBOPENSSL_LIBS"],[
1104 AC_MSG_ERROR([library 'crypto' is required for OpenSSL])
37a20074 1105 ],$LIBOPENSSL_LIBS)
403c4682 1106 AC_CHECK_LIB(ssl,[SSL_CTX_new],[LIBOPENSSL_LIBS="-lssl $LIBOPENSSL_LIBS"],[
84c3fc14 1107 AC_MSG_ERROR([library 'ssl' is required for OpenSSL])
37a20074 1108 ],$LIBOPENSSL_LIBS)
84c3fc14 1109 ])
e0b98074 1110
84c3fc14 1111 SQUID_STATE_ROLLBACK(squid_openssl_state) #de-pollute LIBS
1f7c9178 1112
a1c22363 1113 AS_IF([test "x$LIBOPENSSL_LIBS" != "x"],[
c41db002 1114 CXXFLAGS="$LIBOPENSSL_CFLAGS $CXXFLAGS"
84c3fc14 1115 SSLLIB="$LIBOPENSSL_PATH $LIBOPENSSL_LIBS $SSLLIB"
cb4f4424 1116 AC_DEFINE(USE_OPENSSL,1,[OpenSSL support is available])
c41db002 1117
b8649ee4 1118 # check for API functions
17e98f24
AJ
1119 SQUID_CHECK_LIBCRYPTO_API
1120 SQUID_CHECK_LIBSSL_API
8d56fe55 1121 SQUID_CHECK_OPENSSL_TLS_METHODS
b8649ee4
CT
1122 SQUID_STATE_SAVE(check_SSL_CTX_get0_certificate)
1123 LIBS="$LIBS $SSLLIB"
1124 AC_CHECK_LIB(ssl, SSL_CTX_get0_certificate, [
1125 AC_DEFINE(HAVE_SSL_CTX_GET0_CERTIFICATE, 1, [SSL_CTX_get0_certificate is available])
1126 ], [
1127 missing_SSL_CTX_get0_certificate=yes
1128 ])
1129 SQUID_STATE_ROLLBACK(check_SSL_CTX_get0_certificate)
1130
c41db002 1131 # check for other specific broken implementations
a1c22363 1132 AS_IF([test "x$missing_SSL_CTX_get0_certificate" = "xyes"],SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS)
c41db002 1133 SQUID_CHECK_OPENSSL_CONST_SSL_METHOD
7d841344
AJ
1134 SQUID_CHECK_OPENSSL_CONST_CRYPTO_EX_DATA
1135 SQUID_CHECK_OPENSSL_CONST_SSL_SESSION_CB_ARG
70cfe22f 1136 SQUID_CHECK_OPENSSL_CONST_X509_GET0_SIGNATURE_ARGS
c41db002 1137 SQUID_CHECK_OPENSSL_TXTDB
a1c22363
AJ
1138 ])
1139 AS_IF([test "x$SSLLIB" = "x"],[AC_MSG_ERROR([Required OpenSSL library not found])])
1140])
84c3fc14 1141AC_MSG_NOTICE([OpenSSL library support: ${with_openssl:=no} ${LIBOPENSSL_PATH} ${LIBOPENSSL_LIBS}])
c41db002 1142AM_CONDITIONAL(ENABLE_SSL,[ test "x$with_openssl" = "xyes" ])
1f7c9178 1143AC_SUBST(SSLLIB)
1144
d99af84f 1145# Kerberos support libraries: MIT
24531401 1146SQUID_AUTO_LIB(mit-krb5,[MIT Kerberos],[LIB_KRB5])
75f3c557 1147AH_TEMPLATE(USE_APPLE_KRB5,[Apple Kerberos support is available])
1a22a39e 1148AH_TEMPLATE(USE_SOLARIS_KRB5,[Solaris Kerberos support is available])
d99af84f 1149SQUID_CHECK_LIB_WORKS(mit-krb5,[
d99af84f
AJ
1150 AS_IF([test "x$squid_host_os" = "xsolaris"],[
1151 # pkg-config not available for Solaris krb5 implementation
1152 SQUID_CHECK_SOLARIS_KRB5
a1c22363 1153 ],[
d99af84f
AJ
1154 PKG_CHECK_MODULES([LIBMIT_KRB5],[mit-krb5 mit-krb5-gssapi],[
1155 AS_IF([test "x$squid_host_os" = "xdarwin"],[
1156 AC_DEFINE(USE_APPLE_KRB5,1,[Apple Kerberos support is available])
1157 AC_CHECK_LIB(resolv,[main],[LIBMIT_KRB5_LIBS="$LIBMIT_KRB5_LIBS -lresolv"],[
1158 AC_MSG_ERROR([library 'resolv' is required for Apple Kerberos])
1159 ])
1160 ])
1161 CPPFLAGS="$LIBMIT_KRB5_CFLAGS $CPPFLAGS"
1162 LIBS="$LIBMIT_KRB5_PATH $LIBMIT_KRB5_LIBS $LIBS"
1163 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1164 AC_CHECK_HEADERS(gssapi/gssapi_ext.h gssapi/gssapi_generic.h)
1165 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1166 AC_CHECK_HEADERS(profile.h)
1167 SQUID_CHECK_KRB5_FUNCS
1168 ],[:])
a1c22363 1169 ])
a1c22363 1170])
1a22a39e 1171
adcdd245
AJ
1172# Kerberos support libraries: Heimdal
1173SQUID_AUTO_LIB(heimdal-krb5,[Heimdal Kerberos],[LIBHEIMDAL_KRB5])
1174SQUID_CHECK_LIB_WORKS(heimdal-krb5,[
d99af84f 1175 AS_IF([test "x$LIBMIT_KRB5_LIBS" = "x"],[
adcdd245
AJ
1176 PKG_CHECK_MODULES([LIBHEIMDAL_KRB5],[heimdal-krb5 heimdal-gssapi],[
1177 CPPFLAGS="$LIBHEIMDAL_KRB5_CFLAGS $CPPFLAGS"
1178 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1179 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1180
1181 LIBS="$LIBHEIMDAL_KRB5_PATH $LIBHEIMDAL_KRB5_LIBS $LIBS"
1182 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1183 SQUID_CHECK_KRB5_FUNCS
1184 ],[:])
a1c22363 1185 ])
a1c22363 1186])
1a22a39e 1187
457fd081
AJ
1188# Kerberos support libraries: GNU GSS
1189SQUID_AUTO_LIB(gss,[GNU gss],[LIBGSS])
1190SQUID_CHECK_LIB_WORKS(gss,[
d99af84f 1191 AS_IF([test "x$LIBMIT_KRB5_LIBS" = "x" -a "x$LIBHEIMDAL_KRB5_LIBS" = "x"],[
457fd081
AJ
1192 PKG_CHECK_MODULES([LIBGSS],[gss],[
1193 CPPFLAGS="$LIBGSS_CFLAGS $CPPFLAGS"
1194 AC_CHECK_HEADERS(gss.h)
1195 LIBS="$LIBGSS_PATH $LIBS"
1196 SQUID_CHECK_WORKING_GSSAPI
1197 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1198 SQUID_CHECK_SPNEGO_SUPPORT
1199 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1200 SQUID_CHECK_WORKING_KRB5
1201 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1202 ],[:])
a1c22363 1203 ])
a1c22363 1204])
75c5f82b 1205
0d57ed2e 1206SQUID_AUTO_LIB(ldap,[LDAP],[LIBLDAP])
a3bc98c3 1207SQUID_CHECK_LIB_WORKS(ldap,[
2a849db2
AJ
1208 PKG_CHECK_MODULES([LIBLDAP],[ldap],[:],[:])
1209 AS_IF([test "$squid_host_os" = "mingw" -a "x$LIBLDAP_LIBS" = "x"],[
1210 dnl On MinGW OpenLDAP is not available, try Windows LDAP libraries
1211 dnl TODO: use AC_CHECK_LIB
0d57ed2e 1212 LIBLDAP_LIBS="-lwldap32"
2a849db2 1213 AC_CHECK_HEADERS(winldap.h)
a1c22363 1214 ])
2a849db2
AJ
1215 AC_CHECK_HEADERS(ldap.h lber.h)
1216 AC_CHECK_HEADERS(mozldap/ldap.h)
1217 SQUID_CHECK_LDAP_API
a1c22363 1218])
1a22a39e 1219
388d024e
FC
1220SQUID_AUTO_LIB(sasl,[Cyrus SASL],[LIBSASL])
1221SQUID_CHECK_LIB_WORKS([sasl],[
388d024e
FC
1222 PKG_CHECK_MODULES([LIBSASL],[libsasl2],[:],[:])
1223 CPPFLAGS="$LIBSASL_CFLAGS $CPPFLAGS"
1224 LIBS="$LIBSASL_LIBS $LIBS"
1225 AC_CHECK_HEADERS([sasl/sasl.h sasl.h])
388d024e
FC
1226])
1227
6c025870 1228SQUID_AUTO_LIB(systemd,[systemd API for start-up notification],[LIBSYSTEMD])
a3bc98c3 1229SQUID_CHECK_LIB_WORKS(systemd,[
6c025870 1230 LIBS="$LIBS $LIBSYSTEMD_PATH"
553b28e7
AJ
1231 PKG_CHECK_MODULES(LIBSYSTEMD,[libsystemd >= 209],[
1232 AC_CHECK_HEADERS(systemd/sd-daemon.h)
1233 ],[:])
a1c22363 1234])
6fa8c664 1235
02749868 1236AC_ARG_ENABLE(forw-via-db,
47d80734 1237 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
ec308e40 1238 SQUID_YESNO([$enableval],[--enable-forw-via-db])
02749868 1239])
21f6708d 1240SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
9676633b
FC
1241 [Enable Forw/Via database])
1242AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
02749868 1243
6cfa8966 1244AC_ARG_ENABLE(cache-digests,
47d80734 1245 AS_HELP_STRING([--enable-cache-digests],
7409131e 1246 [Use Cache Digests. See https://wiki.squid-cache.org/SquidFaq/CacheDigests]),[
ec308e40 1247 SQUID_YESNO([$enableval],[--enable-cache-digests])
484f2ebc 1248])
0067eb06 1249SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
47d80734 1250 [Use Cache Digests for locating objects in neighbor caches.])
9676633b 1251AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
47d80734 1252
484f2ebc 1253
9676633b
FC
1254################################
1255# check for netio plugin stuff #
1256################################
1257dnl order of these options handling is relevant in case the user
1258dnl supplies more than one --enable option. Options handled later
1259dnl override those handled earlier for io loop method manual override
1260AC_ARG_ENABLE(select,
a1c22363 1261 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),[
ec308e40 1262 SQUID_YESNO([$enableval],[--enable-select])
91a04222 1263 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="select"])
9676633b
FC
1264])
1265AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
cd748f27 1266
9bb83c8b 1267AC_ARG_ENABLE(poll,
a1c22363 1268 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),[
ec308e40 1269 SQUID_YESNO([$enableval],[--enable-poll])
8ff06f2a 1270 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="poll"])
9bb83c8b 1271])
9676633b 1272AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
9bb83c8b 1273
1b3db6d9 1274AC_ARG_ENABLE(kqueue,
26d50fd2
AJ
1275 AS_HELP_STRING([--disable-kqueue],
1276 [Disable kqueue(2) support.]), [
ec308e40 1277 SQUID_YESNO([$enableval],[--enable-kqueue])
1b3db6d9 1278])
a1c22363 1279AS_IF([test "x${enable_kqueue:=auto}" != "xno"],[
26d50fd2 1280 AC_CHECK_HEADERS([sys/event.h],[],[
a1c22363 1281 AS_IF([test "x${enable_kqueue}" = "xyes"],[
26d50fd2 1282 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
a1c22363 1283 ])
26d50fd2
AJ
1284 ])
1285 AC_CHECK_FUNCS(kqueue,[],[
a1c22363 1286 AS_IF([test "x${enable_kqueue}" = "xyes"],[
26d50fd2 1287 AC_MSG_ERROR([kqueue support missing in libc library.])
a1c22363 1288 ])
26d50fd2 1289 ])
a1c22363 1290 AS_IF([test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes"],[
26d50fd2 1291 squid_opt_io_loop_engine="kqueue"
a1c22363 1292 ],[
26d50fd2 1293 enable_kqueue="no"
a1c22363
AJ
1294 ])
1295])
26d50fd2 1296AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
1b3db6d9 1297
a46d2c0e 1298dnl Enable epoll()
a46d2c0e 1299AC_ARG_ENABLE(epoll,
62979ab1 1300 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
a46d2c0e 1301[
ec308e40 1302 SQUID_YESNO([$enableval],[--enable-epoll])
a1c22363 1303AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="epoll"])
a46d2c0e 1304])
9676633b 1305AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
2ca8b332 1306
9676633b
FC
1307# auto-detect and verify epoll header and library present and working
1308# logic mapping and loop method selection are performed later
a1c22363 1309AS_IF([test "x$enable_epoll" != "xno"],[
9676633b 1310 # check if libs are needed to support epoll
af1e01a8 1311 SQUID_STATE_SAVE(squid_epoll_state)
9676633b 1312 AC_SEARCH_LIBS(epoll_ctl,[epoll])
a1c22363
AJ
1313 AS_IF([test "x$ac_cv_search_epoll_ctl" = "xno"],[enable_epoll=no],
1314 [test "x$ac_cv_search_epoll_ctl" = "xnone required"],[EPOLL_LIBS=""],
1315 [EPOLL_LIBS=$ac_cv_search_epoll_ctl]
1316 )
9676633b
FC
1317 AC_SUBST(EPOLL_LIBS)
1318 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
a46d2c0e 1319
9676633b 1320 # epoll requires sys/epoll.h
98d13964 1321 AC_CHECK_HEADERS([sys/epoll.h])
ad32c661
AJ
1322
1323 dnl Verify that epoll really works
a1c22363 1324 AS_IF([test "x$ac_cv_search_epoll_ctl" != "xno"], SQUID_CHECK_EPOLL)
2ca8b332 1325
a1c22363 1326 AS_IF([test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno"],[
2ca8b332 1327 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
a1c22363
AJ
1328 ])
1329])
a46d2c0e 1330
a1ad2f9b
AJ
1331dnl Enable /dev/poll
1332AC_ARG_ENABLE(devpoll,
a1c22363 1333 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),[
ec308e40 1334 SQUID_YESNO([$enableval],[--enable-devpoll])
a1c22363 1335 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="devpoll"])
a1ad2f9b
AJ
1336])
1337AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
1338
1339## auto-detect and verify devpoll header and library present and working
a1c22363 1340AS_IF([test "x$enable_devpoll" != "xno"],[
a1ad2f9b
AJ
1341 # /dev/poll requires ioctl() and write()
1342 AC_CHECK_FUNCS(ioctl)
1343 AC_CHECK_FUNCS(write)
1344
1345 # /dev/poll requires sys/devpoll.h
1346 AC_CHECK_HEADERS([sys/devpoll.h],,[
a1c22363
AJ
1347 AS_IF([test "x$enable_devpoll" = "xyes"],[
1348 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
1349 ])
1350 enable_devpoll=no
1351 ])
a1ad2f9b
AJ
1352
1353 # Verify that /dev/poll really works
a1c22363 1354 AS_IF([test "x$enable_devpoll" != "xno"], SQUID_CHECK_DEVPOLL)
a1ad2f9b 1355
a1c22363 1356 AS_IF([test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno"],[
a1ad2f9b 1357 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
a1c22363
AJ
1358 ])
1359])
9676633b 1360
72fd085a 1361AC_ARG_ENABLE(http-violations,
af1e01a8
FC
1362 AS_HELP_STRING([--disable-http-violations],
1363 [This allows you to remove code which is known to
47d80734 1364 violate the HTTP protocol specification.]), [
ec308e40 1365 SQUID_YESNO([$enableval],[--enable-http-violations])
72fd085a 1366])
626096be 1367SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
47d80734 1368 [Define to enable code which volates the HTTP standard specification])
9676633b 1369AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
72fd085a 1370
47d80734 1371# IPFW Transparent Proxy
68075fad 1372AC_ARG_ENABLE(ipfw-transparent,
1d26e252
FC
1373 AS_HELP_STRING([--enable-ipfw-transparent],
1374 [Enable Transparent Proxy support for systems
47d80734 1375 using FreeBSD IPFW-style firewalling.]), [
ec308e40 1376 SQUID_YESNO([$enableval],[--enable-ipfw-transparent])
68075fad 1377])
0067eb06 1378SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
2277004e 1379 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
1d26e252 1380AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
68075fad 1381
47d80734 1382# IP-Filter Transparent Proxy
5cafc1d6 1383AC_ARG_ENABLE(ipf-transparent,
2277004e 1384 AS_HELP_STRING([--enable-ipf-transparent],
1d26e252 1385 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
ec308e40 1386 SQUID_YESNO([$enableval],[--enable-ipf-transparent])
5cafc1d6 1387])
be0c7ff0 1388#will be AC_DEFINEd later, after checking for appropriate infrastructure
4bd144d2
FC
1389#IPF currently broken. Default-disabled for now.
1390AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
5cafc1d6 1391
2b0dd4ac 1392dnl Enable PF Transparent Proxy
1393AC_ARG_ENABLE(pf-transparent,
2277004e 1394 AS_HELP_STRING([--enable-pf-transparent],
47d80734 1395 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
ec308e40 1396 SQUID_YESNO([$enableval],[--enable-pf-transparent])
2b0dd4ac 1397])
be0c7ff0 1398#will be AC_DEFINEd later, after checking for appropriate infrastructure
b2192042
AJ
1399AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
1400
1401dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
1402AC_ARG_WITH(nat-devpf,
1403 AS_HELP_STRING([--with-nat-devpf],
1404 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
ec308e40 1405 SQUID_YESNO([$withval],[--with-nat-devpf])
b2192042
AJ
1406])
1407#will be AC_DEFINEd later, after checking for appropriate infrastructure
1408AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
2b0dd4ac 1409
4bd144d2 1410# Linux Netfilter Transparent Proxy
d852fbad 1411AC_ARG_ENABLE(linux-netfilter,
20ad76ab 1412 AS_HELP_STRING([--enable-linux-netfilter],
96f08e2d 1413 [Enable Transparent Proxy support for Linux (Netfilter)]), [
ec308e40 1414 SQUID_YESNO([$enableval],[--enable-linux-netfilter])
d852fbad 1415])
4bd144d2 1416AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
be0c7ff0 1417#will be AC_DEFINEd later, after checking for appropriate infrastructure
d852fbad 1418
425de4c8
AJ
1419
1420dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
24531401 1421SQUID_AUTO_LIB(netfilter-conntrack,[Netfilter conntrack],[LIBNETFILTER_CONNTRACK])
a3bc98c3 1422SQUID_CHECK_LIB_WORKS(netfilter-conntrack,[
ba08d0f4 1423 PKG_CHECK_MODULES([LIBNETFILTER_CONNTRACK],[libnetfilter_conntrack],[:],[:])
a1c22363 1424 CPPFLAGS="$LIBNETFILTER_CONNTRACK_CFLAGS $CPPFLAGS"
ba08d0f4 1425 LIBS="$LIBNETFILTER_CONNTRACK_PATH $LIBNETFILTER_CONNTRACK_LIBS $LIBS"
a1c22363
AJ
1426 AC_CHECK_HEADERS([ \
1427 libnetfilter_conntrack/libnetfilter_conntrack.h \
ba08d0f4
AJ
1428 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h \
1429 ])
a1c22363 1430])
425de4c8 1431
bb7b5fd0 1432dnl Enable Large file support
2df6213e 1433buildmodel=""
2df6213e 1434
1435AC_ARG_WITH(large-files,
507ca601 1436 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
ec308e40 1437 SQUID_YESNO([$withval],[--with-large-files])
a1c22363 1438 squid_opt_enable_large_files=$withval
bb7b5fd0 1439])
1440
2df6213e 1441dnl UNIX Build environment
be0c7ff0 1442dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
2df6213e 1443AC_ARG_WITH(build-environment,
507ca601 1444 AS_HELP_STRING([--with-build-environment=model],
9603207d 1445 [The build environment to use. Normally one of
507ca601
FC
1446 POSIX_V6_ILP32_OFF32 (32 bits),
1447 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
1448 POSIX_V6_LP64_OFF64 (64 bits),
1449 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
1450 XBS5_ILP32_OFF32 i(legacy, 32 bits),
1451 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
1452 XBS5_LP64_OFF64 (legacy, 64 bits),
1453 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
1454 or default (The default for your OS)]), [
a1c22363
AJ
1455 AS_CASE(["$withval"],
1456 [yes|no],[AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])],
1457 [buildmodel="$withval"]
1458 )
2df6213e 1459])
1460
228332d3
FC
1461#hack. Let's early-detect sizeof(long)
1462AC_CHECK_SIZEOF(long)
1463
a1c22363 1464AS_IF([test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"],[
2277004e 1465 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
a1c22363 1466 AS_IF([test "`getconf _$model 2>/dev/null || true`" = 1 -o "`getconf $model 2>/dev/null || true`"],[
2277004e
FC
1467 buildmodel=$model
1468 break
a1c22363 1469 ])
2277004e 1470 done
a1c22363 1471 AS_IF([test "x$buildmodel" = "x"],[
2277004e 1472 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
a1c22363
AJ
1473 ])
1474])
1475AS_IF([test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"],[
228332d3 1476 # define _FILE_OFFSET_BITS if requested and needed
a1c22363 1477 AS_IF([test "x$squid_opt_enable_large_files" = "xyes" -a $ac_cv_sizeof_long -le 4],[
507ca601
FC
1478 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
1479 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
1480 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
a1c22363
AJ
1481 ])
1482],[
507ca601 1483 AC_MSG_NOTICE([Using $buildmodel build environment])
a1c22363
AJ
1484 AS_IF([ ! test "`getconf _$buildmodel 2>/dev/null || true`" = 1 -o "`getconf $buildmodel 2>/dev/null || true`"],[
1485 AC_MSG_ERROR([Build environment $buildmodel not known to getconf.])
1486 ])
507ca601
FC
1487 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
1488 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
1489 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1490 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
2277004e 1491
a1c22363 1492 AS_IF([test "x$squid_host_os" = "xsolaris"],[
2277004e
FC
1493# On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1494# for LDFLAGS -xarch=generic64, but:
1495# "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1496# For gcc "-xarch=generic64" must be replaced with "-m64"
1497# The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
a1c22363 1498 AS_IF([test "x$GCC" = "xyes"],[
2277004e
FC
1499 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
1500 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
1501 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
1502 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
1503 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1504 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1505 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
a1c22363 1506 ])
2277004e
FC
1507 AC_MSG_NOTICE([Removing -Usun on $host])
1508 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
1509 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
a1c22363
AJ
1510 ])
1511])
2df6213e 1512
3d674977 1513AC_ARG_ENABLE(follow-x-forwarded-for,
6c83720b
AR
1514 AS_HELP_STRING([--disable-follow-x-forwarded-for],
1515 [Do not follow the X-Forwarded-For
19b4777c
FC
1516 HTTP header to try to find the IP address of the
1517 original or indirect client when a request has
8075a4da 1518 been forwarded through other proxies.]), [
ec308e40 1519 SQUID_YESNO([$enableval],[--enable-follow-x-forwarded-for])
8075a4da 1520])
6ec005b5 1521AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
3a5af257 1522SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
47d80734 1523 [Enable following X-Forwarded-For headers])
3d674977 1524
3898f57f 1525AC_ARG_ENABLE(ident-lookups,
8075a4da 1526 AS_HELP_STRING([--disable-ident-lookups],
47d80734 1527 [Remove code that supports performing Ident (RFC 931) lookups.]), [
ec308e40 1528 SQUID_YESNO([$enableval],[--enable-ident-lookups])
8075a4da 1529])
6c5dc16a
FC
1530AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
1531SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
3898f57f 1532
9d798391 1533dnl Select Default hosts file location
1534AC_ARG_ENABLE(default-hostsfile,
8ea232f5
FC
1535 AS_HELP_STRING([--enable-default-hostsfile=path],
1536 [Select default location for hosts file.
75eaac6c 1537 See hosts_file directive in squid.conf for details]), [
a1c22363
AJ
1538 # TODO: handle the "yes" case cleanly
1539 AS_CASE(["$enableval"],
1540 [no|none],[squid_opt_default_hosts="none"],
1541 [
1542 squid_opt_default_hosts=$enableval
1543 AS_IF([ ! test -f "$enableval"],[
1544 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
1545 ])
1546 ])
75eaac6c
FC
1547])
1548AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
1549DEFAULT_HOSTS=$squid_opt_default_hosts
1550AC_SUBST(DEFAULT_HOSTS)
9d798391 1551
47d80734 1552# Select auth schemes modules to build
94439e4e 1553AC_ARG_ENABLE(auth,
6c83720b
AR
1554 AS_HELP_STRING([--disable-auth],
1555 [Do not support authentication. When supported, the list of schemes
26ffc057 1556 and helpers to be enabled is defined elsewhere]), [
ec308e40 1557 SQUID_YESNO([$enableval],[--enable-auth])
94439e4e 1558])
26ffc057 1559AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
2f1431ea
AJ
1560SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
1561AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
26ffc057 1562AUTH_MODULES=""
dcbfe1a3 1563require_smblib="no"
b9ce9676 1564require_sspi="no"
26ffc057
FC
1565
1566AC_ARG_ENABLE(auth-basic,
1567 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
1568 [Enable the basic authentication scheme, and build the specified helpers.
1569 Not providing an explicit list of helpers will attempt build of
1570 all possible helpers. Default is to do so.
1571 To disable the basic authentication scheme, use --disable-auth-basic.
d9655720 1572 To enable but build no helpers, specify "none".
03901cf8 1573 To see available helpers, see the src/auth/basic/ directory. ]),[
26ffc057
FC
1574#nothing to do really
1575])
03901cf8 1576m4_include([src/auth/basic/helpers.m4])
94439e4e 1577
12daeef6
AJ
1578AC_ARG_ENABLE(auth-digest,
1579 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
1580 [Enable the Digest authentication scheme, and build the specified helpers.
26ffc057
FC
1581 Not providing an explicit list of helpers will attempt build of
1582 all possible helpers. Default is to do so.
12daeef6 1583 To disable the Digest authentication scheme, use --disable-auth-digest.
26ffc057 1584 To enable but build no helpers, specify "none".
d4d7f6dd 1585 To see available helpers, see the src/auth/digest/ directory. ]),[
12daeef6 1586#nothing to do, really
380f0a87 1587])
d4d7f6dd 1588m4_include([src/auth/digest/helpers.m4])
94439e4e 1589
26ffc057
FC
1590AC_ARG_ENABLE(auth-negotiate,
1591 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
16c02b14 1592 [Enable the Negotiate authentication scheme, and build the specified
26ffc057
FC
1593 helpers.
1594 Not providing an explicit list of helpers will attempt build of
1595 all possible helpers. Default is to do so.
16c02b14 1596 To disable the Negotiate authentication scheme,
26ffc057
FC
1597 use --disable-auth-negotiate.
1598 To enable but build no helpers, specify "none".
16c02b14 1599 To see available helpers, see the src/auth/negotiate/ directory. ]),[
26ffc057 1600#nothing to do, really
6e785d85 1601])
16c02b14 1602m4_include([src/auth/negotiate/helpers.m4])
6e785d85 1603
12daeef6
AJ
1604AC_ARG_ENABLE(auth-ntlm,
1605 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
1606 [Enable the NTLM authentication scheme, and build the specified helpers.
26ffc057
FC
1607 Not providing an explicit list of helpers will attempt build of
1608 all possible helpers. Default is to do so.
12daeef6 1609 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
1a22a39e 1610 To enable but build no helpers, specify "none".
b817c20f 1611 To see available helpers, see the src/auth/ntlm/ directory. ]),[
1a22a39e 1612])
b817c20f 1613m4_include([src/auth/ntlm/helpers.m4])
c8093f05 1614
1a22a39e
MM
1615dnl Authentication libraries to build
1616dnl This list will not be needed when each auth library has its own Makefile
1617dnl this is to be placed AFTER each auth module's handler
1618AUTH_LIBS_TO_BUILD=
1619for module in $AUTH_MODULES; do
1620 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
1621done
1622AC_SUBST(AUTH_MODULES)
1623AC_SUBST(AUTH_LIBS_TO_BUILD)
dcbfe1a3 1624AM_CONDITIONAL(ENABLE_SMBLIB, test "x$require_smblib" = "xyes")
b9ce9676 1625AM_CONDITIONAL(ENABLE_SSPI, test "x$require_sspi" = "xyes")
3d62cc61 1626
1a22a39e
MM
1627dnl Select logging daemon helpers to build
1628AC_ARG_ENABLE(log-daemon-helpers,
1629 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
4d5dd85a 1630 [This option selects which logging daemon helpers to
1a22a39e 1631 build and install as part of the normal build process
4d5dd85a 1632 For a list of available helpers see the src/log/
1a22a39e
MM
1633 directory.]),[
1634#nothing to do, really
1635])
4d5dd85a 1636m4_include([src/log/helpers.m4])
9ca29d23 1637
c6588c68 1638AC_ARG_ENABLE(external-acl-helpers,
f2d9a578 1639 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
e046643f 1640 [Enable external_acl helpers support and the helpers themselves.
d9655720 1641 Default is to build all buildable helpers and enable support.
8ea232f5 1642 To disable support, use --disable-external-acl-helpers.
d9655720 1643 To build no helpers, specify "none".
e046643f 1644 To see available helpers, see the src/acl/external/
8ea232f5 1645 directory]), [
d9655720 1646#nothing to do, really
c6588c68 1647])
e046643f 1648m4_include([src/acl/external/helpers.m4])
d9655720 1649
fdbb3b19 1650dnl Select url_rewrite helpers to build
fdbb3b19 1651AC_ARG_ENABLE(url-rewrite-helpers,
081863f3 1652 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
fdbb3b19
AJ
1653 [This option selects which url_rewrite helpers to
1654 build and install as part of the normal build
8ea232f5
FC
1655 process. The default is to attempt the build of all possible
1656 helpers. Use --disable-url-rewrite-helpers to build none.
1657 For a list of available helpers see the
d6d6203a 1658 src/http/url_rewriters/ directory.]),[
fdbb3b19 1659])
d6d6203a 1660m4_include([src/http/url_rewriters/helpers.m4])
fdbb3b19 1661
a27cfbe0 1662dnl Select security helpers to build
8732ea9d
AJ
1663AC_ARG_ENABLE(security-cert-validators,
1664 AS_HELP_STRING([--enable-security-cert-validators="list of helpers"],
bbf79f12
AJ
1665 [This option selects which security certificate validator
1666 helpers to build and install as part of the normal build
a27cfbe0 1667 process. The default is to attempt the build of all possible
8732ea9d 1668 helpers. Use --disable-security-cert-validators to
bbf79f12
AJ
1669 build none. For a list of available helpers see the
1670 src/security/cert_validators/ directory.]),[
a27cfbe0 1671])
4d5dd85a 1672m4_include([src/security/cert_validators/helpers.m4])
a27cfbe0 1673
cb0b3d63
AJ
1674AC_ARG_ENABLE(security-cert-generators,
1675 AS_HELP_STRING([--enable-security-cert-generators="list of helpers"],
1676 [This option selects which security certificate validator
1677 helpers to build and install as part of the normal build
1678 process. The default is to attempt the build of all possible
1679 helpers. Use --disable-security-cert-genrators to
1680 build none. For a list of available helpers see the
1681 src/security/cert_generators/ directory.]),[
1682])
1683m4_include([src/security/cert_generators/helpers.m4])
1684
0d5ee502
AM
1685dnl Select storeid_rewrite helpers to build
1686AC_ARG_ENABLE(storeid-rewrite-helpers,
1687 AS_HELP_STRING([--enable-storeid-rewrite-helpers="list of helpers"],
1688 [This option selects which Store-ID rewrite helpers to
1689 build and install as part of the normal build
1690 process. The default is to attempt the build of all possible
1691 helpers. Use --disable-storeid-rewrite-helpers to build none.
1692 For a list of available helpers see the
0c1f8b9b 1693 src/store/id_rewriters/ directory.]),[
0d5ee502 1694])
0c1f8b9b 1695m4_include([src/store/id_rewriters/helpers.m4])
0d5ee502 1696
3a125142 1697AC_ARG_WITH(valgrind-debug,
0f705e3b
FC
1698 AS_HELP_STRING([--with-valgrind-debug],
1699 [Include debug instrumentation for use with valgrind]),
4e26f472 1700[
ec308e40 1701 SQUID_YESNO([$withval],[--with-valgrind-debug])
a1c22363 1702 AS_IF([test "x$withval" != "xno"],[
4e26f472
FC
1703 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
1704 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
1705 ])
a1c22363 1706 ])
b4bab919 1707])
4e26f472
FC
1708SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
1709 [Valgrind memory debugger support])
1710AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
b4bab919 1711
0e657244 1712dnl Enable WIN32 Service compile mode
1713AC_ARG_ENABLE(win32-service,
054a4caa 1714 AS_HELP_STRING([--enable-win32-service],
0f705e3b 1715 [Compile Squid as a WIN32 Service.
b284c470 1716 Works only on MS-Windows platforms]), [
ec308e40 1717 SQUID_YESNO([$enableval],[--enable-win32-service])
0e657244 1718])
b284c470
FC
1719SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
1720 [Enable code supporting MS Windows service mode])
1721AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
0e657244 1722
b1485ff8 1723
29f22442 1724# Disable "unlinkd" code
fe0810ac 1725AC_ARG_ENABLE(unlinkd,
0a081cb0 1726 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
ec308e40 1727 SQUID_YESNO([$enableval],[--enable-unlinkd])
fe0810ac 1728])
0f658b5b 1729SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
0f705e3b 1730 [Enable useage of unlinkd])
fcabe077 1731AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
fbc04c0a 1732AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
fe0810ac 1733
0f705e3b 1734# Enable backtraces on fatal errors
ce3d30fb 1735AC_ARG_ENABLE(stacktraces,
0f705e3b
FC
1736 AS_HELP_STRING([--enable-stacktraces],
1737 [Enable automatic call backtrace on fatal errors]), [
ec308e40 1738 SQUID_YESNO([$enableval],[--enable-stacktraces])
ce3d30fb 1739])
0f658b5b 1740SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
0f705e3b 1741 [Print stack traces on fatal errors])
78614cd4 1742AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
0a081cb0 1743
904676a2 1744# Enable X-Accelerator-Vary for Vary support within an accelerator setup
2092c67d 1745AC_ARG_ENABLE(x-accelerator-vary,
904676a2
FC
1746 AS_HELP_STRING([--enable-x-accelerator-vary],
1747 [Enable support for the X-Accelerator-Vary
e702812e
FC
1748 HTTP header. Can be used to indicate
1749 variance within an accelerator setup.
1750 Typically used together with other code
904676a2 1751 that adds custom HTTP headers to the requests.]), [
ec308e40 1752 SQUID_YESNO([$enableval],[--enable-x-accelerator-vary])
f66a9ef4 1753])
0f658b5b 1754SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
904676a2 1755 [Enable support for the X-Accelerator-Vary HTTP header])
78614cd4 1756AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
f66a9ef4 1757
24531401 1758SQUID_AUTO_LIB(cppunit,[cppunit test framework],[LIBCPPUNIT])
a3bc98c3 1759SQUID_CHECK_LIB_WORKS(cppunit,[
d93bf055 1760 PKG_CHECK_MODULES([LIBCPPUNIT],[cppunit],[
f30eb8f7 1761 squid_cv_cppunit_version="`pkg-config --modversion cppunit`"
d93bf055
AJ
1762 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
1763 AS_UNSET(squid_cv_cppunit_version)
1764
e77b66af
FC
1765 CXXFLAGS="${CXXFLAGS} ${LIBCPPUNIT_CFLAGS}"
1766 LIBS="${LIBS} ${LIBCPPUNIT_LIBS}"
d93bf055 1767 AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
d93bf055
AJ
1768 ],[
1769 AC_MSG_WARN([cppunit does not appear to be installed. Squid does not require this, but code testing with 'make check' will fail.])
1770 ])
f5691f9c 1771])
f5691f9c 1772
090089c4 1773dnl Check for headers
db40ae20 1774AC_CHECK_HEADERS( \
3680cc44
FC
1775 arpa/inet.h \
1776 arpa/nameser.h \
1777 assert.h \
1778 bstring.h \
3680cc44 1779 crypt.h \
3680cc44 1780 ctype.h \
ee4d4e85 1781 direct.h \
a1c22363 1782 dirent.h \
3680cc44
FC
1783 errno.h \
1784 execinfo.h \
1785 fcntl.h \
1786 fnmatch.h \
1787 getopt.h \
1788 glob.h \
1789 gnumalloc.h \
1790 grp.h \
3680cc44 1791 ipl.h \
3680cc44
FC
1792 libc.h \
1793 limits.h \
1794 linux/posix_types.h \
1795 linux/types.h \
3680cc44 1796 malloc.h \
3680cc44
FC
1797 math.h \
1798 memory.h \
1799 mount.h \
1800 netdb.h \
1801 netinet/in.h \
1802 netinet/in_systm.h \
3680cc44 1803 netinet/tcp.h \
3680cc44
FC
1804 paths.h \
1805 poll.h \
321223fe 1806 priv.h \
3680cc44 1807 pwd.h \
c2afddd8 1808 regex.h \
3680cc44 1809 sched.h \
2ccf2eb2 1810 siginfo.h \
3680cc44 1811 signal.h \
3680cc44
FC
1812 stdarg.h \
1813 stddef.h \
3680cc44
FC
1814 stdio.h \
1815 stdlib.h \
3680cc44
FC
1816 string.h \
1817 strings.h \
1818 sys/bitypes.h \
3680cc44
FC
1819 sys/file.h \
1820 sys/ioctl.h \
d440d5a4 1821 sys/ipc.cc \
3680cc44
FC
1822 sys/param.h \
1823 sys/prctl.h \
321223fe 1824 sys/procctl.h \
3680cc44 1825 sys/md5.h \
c975f532 1826 sys/mman.h \
3680cc44
FC
1827 sys/msg.h \
1828 sys/resource.h \
2ccf2eb2 1829 sys/select.h \
d440d5a4 1830 sys/shm.h \
3680cc44
FC
1831 sys/socket.h \
1832 sys/stat.h \
3680cc44
FC
1833 syscall.h \
1834 sys/syscall.h \
1835 sys/time.h \
1836 sys/types.h \
1837 sys/uio.h \
1838 sys/un.h \
1839 sys/vfs.h \
1840 sys/wait.h \
1841 syslog.h \
1842 time.h \
1843 unistd.h \
1844 utime.h \
1845 varargs.h \
1846 byteswap.h \
1847 glib.h \
1848 stdint.h \
1849 inttypes.h \
cdb86165 1850 wchar.h
db40ae20 1851)
3c586e38 1852
ee80a919
AR
1853AC_CHECK_HEADERS( \
1854 linux/netfilter_ipv4.h \
1855 linux/netfilter_ipv6/ip6_tables.h \
fc68f6b1 1856,,,
dcd1dc78 1857SQUID_DEFAULT_INCLUDES
1858#if HAVE_LIMITS_H
1859#include <limits.h>
1860#endif
a74968c2
AJ
1861/* Netfilter ip(6)tables v1.4.0 has broken headers */
1862#if HAVE_NETINET_IN_H
1863#include <netinet/in.h>
1864#endif
dcd1dc78 1865)
1866
61beade2 1867dnl *BSD do not include the dependencies for all their net/ and netinet/ files
c92b4732 1868dnl We must include a few basic type headers for them to work.
d1e5191e 1869AC_CHECK_HEADERS( \
0c0d381b
FC
1870 net/if.h \
1871 netinet/if_ether.h\
1872 netinet/icmp6.h \
1873 netinet/in.h \
1874 netinet/ip.h \
1875 netinet/ip6.h \
0c0d381b
FC
1876 netinet/ip_icmp.h \
1877 netinet/ipl.h \
0c0d381b
FC
1878 net/pf/pfvar.h \
1879 net/pfvar.h \
1880 sys/mount.h\
1881 resolv.h \
d1e5191e
AJ
1882,,,
1883SQUID_BSDNET_INCLUDES)
5a3237b0 1884
aee0606f 1885AC_C_CONST
d57288d2 1886AC_C_BIGENDIAN
aee0606f 1887
6a9f6389 1888AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
a1c22363 1889#if HAVE_TIME_H
6a9f6389 1890#include <time.h>
1891#endif
5c51415d 1892])
46c883ed 1893
a186e0d9 1894AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 1895#if HAVE_SYS_TIME_H
1896#include <sys/time.h>
1897#endif
b54a6789 1898#if HAVE_SYS_RESOURCE_H
1899#include <sys/resource.h>
a1c22363 1900#endif
a1c22363 1901])
b54a6789 1902
6a9f6389 1903AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
1904#if HAVE_SYS_TYPES_H
1905#include <sys/types.h>
1906#endif
a025a745 1907#include <netinet/in.h>
1908#include <netinet/in_systm.h>
6ad85e8a 1909#include <netinet/ip.h>
b05490a8 1910#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 1911#define ip_hl ihl
1912#endif
1913#ifndef __linux__
b05490a8 1914#ifndef __CYGWIN__
6ad85e8a 1915#define iphdr ip
b05490a8 1916#endif
6a9f6389 1917#endif])
a025a745 1918
090089c4 1919dnl Check for typedefs
77d6bd88 1920AC_CHECK_SIZEOF(void *)
090089c4 1921
41aa7d00
FC
1922# check for a bunch of types
1923AC_TYPE_INT8_T
1924AC_TYPE_UINT8_T
1925AC_TYPE_INT16_T
1926AC_TYPE_UINT16_T
1927AC_TYPE_INT32_T
1928AC_TYPE_UINT32_T
1929AC_TYPE_INT64_T
1930AC_TYPE_UINT64_T
1931AC_TYPE_PID_T
1932AC_TYPE_SIZE_T
1933AC_TYPE_SSIZE_T
1934AC_TYPE_OFF_T
1935AC_TYPE_UID_T
59a09b98 1936AC_CHECK_TYPE([bool])
41aa7d00
FC
1937#need the defines for PRId64
1938AC_CHECK_SIZEOF(int64_t)
1939AC_CHECK_SIZEOF(long)
50f9c873
AR
1940#need the define for overflow checks
1941AC_CHECK_SIZEOF(off_t)
46e172d9 1942AC_CHECK_SIZEOF(size_t)
6a9f6389 1943
588e71df 1944dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
1945dnl that is incompatible with the updated Solaris header files.
1946dnl For this reason, we must check if pad128_t and upad128_t are defined.
1947AC_CHECK_TYPE(pad128_t,
1948 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
1949 ,SQUID_DEFAULT_INCLUDES)
1950
1951AC_CHECK_TYPE(upad128_t,
1952 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
1953 ,SQUID_DEFAULT_INCLUDES)
1954
6a9f6389 1955AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
1956AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 1957
6a9f6389 1958AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
1959#include <sys/types.h>
6637e3a5 1960#include <sys/socket.h>
6637e3a5 1961#include <stdlib.h>
1962#include <stddef.h>
a1c22363 1963])
6637e3a5 1964
cdb352bb
FC
1965AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
1966 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
1967#include <sys/ipc.h>
1968#include <sys/msg.h>])
1969
f367e6af
AJ
1970AC_CHECK_TYPE(cpu_set_t,
1971 AC_DEFINE(HAVE_CPU_SET_T,1,[cpu_set_t is defined by the system headers]),,[
1972#if HAVE_SCHED_H
1973#include <sched.h>
1974#endif
1975])
1976
cdb352bb
FC
1977dnl Check for special functions
1978AC_FUNC_ALLOCA
1979
59eac907 1980SQUID_AUTO_LIB(cap,[Linux capabilities],[LIBCAP])
a3bc98c3 1981SQUID_CHECK_LIB_WORKS(cap,[
4106ed25
AJ
1982 PKG_CHECK_MODULES([LIBCAP],[libcap >= 2.09],[:],[:])
1983 CPPFLAGS="$LIBCAP_CFLAGS $CPPFLAGS"
1984 LIBS="$LIBCAP_PATH $LIBCAP_LIBS $LIBS"
45c41a07 1985 SQUID_CHECK_FUNCTIONAL_LIBCAP2
59eac907
AJ
1986 AC_MSG_NOTICE([libcap headers are ok: $squid_cv_sys_capability_works])
1987 AS_IF([test "x$squid_cv_sys_capability_works" = "xno"],[LIBCAP_LIBS=""])
a1c22363 1988])
b64b6030 1989
090089c4 1990dnl Check for needed libraries
54c95954 1991AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
819656da
AJ
1992AC_SEARCH_LIBS([res_init],[resolv])
1993AC_SEARCH_LIBS([__res_search],[resolv])
54c95954
FC
1994AC_SEARCH_LIBS([bind],[socket])
1995AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
85cd85f3 1996AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
94d48591 1997
46f50de9
FC
1998# check that we have unix sockets
1999SQUID_CHECK_UNIX_SOCKET
2000SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
2001
2002AC_CHECK_LIB(gnumalloc, malloc)
a1c22363 2003AS_IF([test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"],[
ef7ece58 2004 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
46f50de9
FC
2005 ac_cv_func_mallocblksize=no
2006 ac_cv_func_mallopt=no
a1c22363
AJ
2007],[
2008 AS_CASE(["$squid_host_os"],
2009 [solaris],[AC_MSG_NOTICE([skipping libmalloc check for $host])],
2010 [freebsd],[AC_MSG_NOTICE([skipping libmalloc check for $host])],
2011 [AC_CHECK_LIB(malloc, main)]
2012 )
2013])
2014
2015AS_IF([test "$squid_host_os" = "mingw"],[
2016 AC_MSG_NOTICE([Use MSVCRT for math functions.])
2017],[
2018 dnl log() are only used in old C code for now.
2019 AC_LANG_PUSH([C])
2020 AC_SEARCH_LIBS([log],[m])
2021 AC_LANG_POP([C])
2022])
090089c4 2023
f467f578
FC
2024dnl --with-maxfd present for compatibility with Squid-2.
2025dnl undocumented in ./configure --help to encourage using the Squid-3 directive
a1c22363
AJ
2026AC_ARG_WITH(maxfd,,[
2027 AS_CASE([$withval],
c881e2b1 2028 [@<:@0-9@:>@*],[
f467f578 2029 squid_filedescriptors_num=$withval
acea95af 2030 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
a1c22363
AJ
2031 ],
2032 [AC_MSG_ERROR(--with-maxfd expects a numeric argument)]
2033 )
055421ee 2034])
001ad4cc 2035
f467f578
FC
2036AC_ARG_WITH(filedescriptors,
2037 AS_HELP_STRING([--with-filedescriptors=NUMBER],
c881e2b1 2038 [Force squid to support NUMBER filedescriptors]),[
a1c22363 2039 AS_CASE([$withval],
c881e2b1 2040 [@<:@0-9@:>@*],[
f467f578 2041 squid_filedescriptors_num=$withval
a1c22363
AJ
2042 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])],
2043 [AC_MSG_ERROR([--with-filedescriptors expects a numeric argument])]
2044 )
c881e2b1 2045])
f467f578
FC
2046
2047SQUID_CHECK_DEFAULT_FD_SETSIZE
acea95af 2048SQUID_CHECK_MAXFD
001ad4cc 2049
f467f578 2050
001ad4cc
AJ
2051dnl Enable IPv6 support
2052AC_MSG_CHECKING([whether to enable IPv6])
001ad4cc 2053AC_ARG_ENABLE(ipv6,
af494bc8 2054 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
ec308e40 2055 SQUID_YESNO([$enableval],[--enable-ipv6])
001ad4cc 2056])
7d927f1f
AJ
2057AC_MSG_RESULT(${enable_ipv6:=yes})
2058SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
001ad4cc 2059
a1c22363 2060AS_IF([test "x$enable_ipv6" = "xyes"],[SQUID_CHECK_SIN6_LEN_IN_SAI])
7d553ad9
AJ
2061SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
2062SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
001ad4cc 2063
77f675ad 2064dnl System-specific library modifications
a1c22363
AJ
2065AH_TEMPLATE(GETTIMEOFDAY_NO_TZP,[Whether gettimeofday takes only one argument])
2066AS_CASE(["$host"],
2067 [*-pc-sco3.2*],[
2068 # -lintl is needed on SCO version 3.2v4.2 for strftime()
2069 # Robert Side <rside@aiinc.bc.ca>
2070 # Mon, 18 Jan 1999 17:48:00 GMT
2071 AC_CHECK_LIB(intl, strftime)
2072 ],
2073
2074 [i386-*-solaris2.*],[
2075 AS_IF([test "x$GCC" = "xyes"],[
fcabe077 2076 AC_MSG_NOTICE([Removing -O for gcc on $host])
d0441961 2077 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
a1c22363
AJ
2078 ])
2079 ],
141eb4a6 2080
a1c22363 2081 [*-sgi-irix*],[
fcabe077
FC
2082 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
2083 LIBS=`echo $LIBS | sed -e s/-lsocket//`
2084 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
2085 LIBS=`echo $LIBS | sed -e s/-lnsl//`
2086 ac_cv_lib_nsl_main=no
a1c22363
AJ
2087 ],
2088
2089 [*-ibm-aix*],[
3e1ce596
KB
2090 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
2091#include <assert.h>
2092#ifndef NULL
2093#define NULL 0
2094#endif
2095class Foo{
2096public:virtual ~Foo(){}
2097};
2098class Bar:public Foo{
2099public:Bar():Foo(){}
2100};
2101 ]],[[
2102Foo * myFoo=new Bar();
2103Bar * myBar=dynamic_cast<Bar *>(myFoo);
2104assert(myBar != NULL);
2105 ]])
a1c22363 2106 AS_IF([test "$ac_cv_require_rtti" = "yes"],[
3e1ce596
KB
2107 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
2108 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
a1c22363 2109 ])
3e1ce596
KB
2110
2111 AC_LANG_PUSH([C])
2112 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
fcabe077 2113 AC_LANG_POP([C])
a1c22363 2114 AS_IF([test "$ac_cv_require_qcpluscmt" = "yes"],[
3e1ce596 2115 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
a1c22363
AJ
2116 ])
2117 ],
2118
2119 [*-*-solaris2.[[0-4]]],[AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)],
3e1ce596 2120
a1c22363
AJ
2121 [*-sony-newsos[[56]]*],[AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)]
2122)
090089c4 2123
84cecfd2 2124dnl This has to be before AC_CHECK_FUNCS
2125# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2126# when running configure.
a1c22363
AJ
2127AS_IF([test "x$ac_cv_func_poll" = "x"],[
2128 AS_CASE(["$host"],
2129 [*-hp-hpux*.*],[
fcabe077
FC
2130 # Duane Wessels
2131 AC_MSG_NOTICE([disabling poll for $host...])
2132 ac_cv_func_poll='no'
a1c22363
AJ
2133 ],
2134
2135 [*-linux-*],[
fcabe077
FC
2136 # Henrik Nordstrom (hno@squid-cache.org) 19980817
2137 # poll is problematic on Linux. We disable it
2138 # by default until Linux gets it right.
2139 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
a1c22363 2140 AS_IF([test $rev -lt 002002],[
fcabe077
FC
2141 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
2142 ac_cv_func_poll='no'
a1c22363
AJ
2143 ])
2144 ],
2145
2146 [powerpc-ibm-aix4.1.*],[
fcabe077
FC
2147 # Mike Laster (mlaster@metavillage.com) 19981021
2148 AC_MSG_NOTICE([disabling poll for $host...])
2149 ac_cv_func_poll='no'
a1c22363
AJ
2150 ]
2151 )
2152])
176d10ee 2153
6716b242 2154dnl Check for library functions
2155AC_CHECK_FUNCS(\
ce3d30fb 2156 backtrace_symbols_fd \
3a144521 2157 bcopy \
4de1e2da 2158 eui64_aton \
4ac29a5b 2159 fchmod \
6716b242 2160 getdtablesize \
8505e57b 2161 getpagesize \
230c091c 2162 getpass \
30a4f2a8 2163 getrusage \
9c1d8929 2164 getspnam \
379d5751 2165 gettimeofday \
52303a3d 2166 glob \
0f5efab0 2167 mallocblksize \
6716b242 2168 mallopt \
2ae6b9b0 2169 memcpy \
30a4f2a8 2170 memmove \
ee4d4e85 2171 memrchr \
dac27377 2172 memset \
b99a6dec 2173 mkstemp \
1812b6c7 2174 mktime \
88738790 2175 mstats \
84cecfd2 2176 poll \
62ae0622 2177 prctl \
321223fe 2178 procctl \
3a144521 2179 pthread_attr_setschedparam \
cd748f27 2180 pthread_attr_setscope \
2181 pthread_setschedparam \
42b51993 2182 pthread_sigmask \
c68e9c6b 2183 putenv \
c2afddd8
AJ
2184 regcomp \
2185 regexec \
2186 regfree \
819656da
AJ
2187 res_init \
2188 __res_init \
4915be3b 2189 rint \
96c2bb61
AR
2190 sched_getaffinity \
2191 sched_setaffinity \
3a144521 2192 select \
234967c9 2193 seteuid \
c415c128 2194 setgroups \
321223fe 2195 setpflags \
30a4f2a8 2196 setpgrp \
30a4f2a8 2197 setsid \
76e7e636 2198 setresuid \
30a4f2a8 2199 sigaction \
11430c03 2200 snprintf \
1ccc0d40 2201 socketpair \
6716b242 2202 sysconf \
2203 syslog \
234967c9 2204 timegm \
28da5e0d 2205 vsnprintf \
6716b242 2206)
f5e5c4cf 2207dnl ... and some we provide local replacements for
2208AC_REPLACE_FUNCS(\
f5e5c4cf 2209 initgroups \
2ccf2eb2 2210 psignal \
f5e5c4cf 2211 strerror \
585cddda 2212 strtoll \
f5e5c4cf 2213 tempnam \
2214)
6716b242 2215
9676633b
FC
2216# Magic which checks whether we are forcing a type of comm loop we
2217# are actually going to (ab)use.
2218# Mostly ripped from squid-commloops, thanks to adrian and benno
1b3db6d9 2219
a1c22363
AJ
2220AS_IF([test "x$squid_opt_io_loop_engine" != "x"],
2221 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine]),
2222 [test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes"],
2223 squid_opt_io_loop_engine="epoll",
2224 [test "x$enable_kqueue" != "xno"],
2225 squid_opt_io_loop_engine="kqueue",
2226 [test "x$enable_devpoll" != "xno"],
2227 squid_opt_io_loop_engine="devpoll",
2228 [test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes"],
2229 squid_opt_io_loop_engine="poll",
2230 [test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"],
2231 squid_opt_io_loop_engine="select",
a1c22363
AJ
2232 [
2233 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
2234 AC_MSG_WARN([Will try select and hope for the best.])
2235 squid_opt_io_loop_engine="select"
2236 ]
2237)
d474c7a6 2238
8075a4da 2239AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
d474c7a6 2240
8aafbbc1
AJ
2241AM_CONDITIONAL(ENABLE_POLL, test "x$squid_opt_io_loop_engine" = "xpoll")
2242AM_CONDITIONAL(ENABLE_EPOLL, test "x$squid_opt_io_loop_engine" = "xepoll")
2243AM_CONDITIONAL(ENABLE_SELECT, test "x$squid_opt_io_loop_engine" = "xselect")
8aafbbc1
AJ
2244AM_CONDITIONAL(ENABLE_KQUEUE, test "x$squid_opt_io_loop_engine" = "xkqueue")
2245AM_CONDITIONAL(ENABLE_DEVPOLL, test "x$squid_opt_io_loop_engine" = "xdevpoll")
d474c7a6 2246
a1c22363
AJ
2247AS_CASE([$squid_opt_io_loop_engine],
2248 [epoll],[AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])],
2249 [devpoll],[AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop])],
2250 [poll],[AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])],
2251 [kqueue],[AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])],
a1c22363
AJ
2252 [select],[AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])],
2253)
1b3db6d9 2254
a1c22363 2255AS_IF([test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes"],[
96c2bb61 2256 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
a1c22363 2257])
96c2bb61 2258
2ff9dfaa 2259AC_CHECK_HEADERS(mswsock.h)
14c0d3ab
DK
2260AC_MSG_CHECKING([for constant CMSG_SPACE])
2261AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
2262 #if HAVE_SYS_SOCKET_H
2263 #include <sys/socket.h>
2264 #endif
2ff9dfaa
AJ
2265 #if HAVE_MSWSOCK_H
2266 #include <mswsock.h>
2267 #endif
14c0d3ab
DK
2268
2269 int a[CMSG_SPACE(int)];
2270]])], [
2271 AC_MSG_RESULT(yes)
2272 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
2273], [
2274 AC_MSG_RESULT(no)
2275])
2276
ecd8516d 2277AC_CHECK_TYPE(struct cmsghdr,AC_DEFINE(HAVE_CMSGHDR,1,[The system provides struct cmsghdr]),,[
c72f8c2e
AJ
2278 #if HAVE_SYS_SOCKET_H
2279 #include <sys/socket.h>
2280 #endif
2ff9dfaa
AJ
2281 #if HAVE_MSWSOCK_H
2282 #include <mswsock.h>
2283 #endif
c72f8c2e
AJ
2284 #if HAVE_WINSOCK2_H
2285 #include <winsock2.h>
2286 #endif
2287])
2288
ecd8516d 2289AC_CHECK_TYPE(struct iovec,AC_DEFINE(HAVE_IOVEC,1,[The system provides struct iovec]),,[
c72f8c2e
AJ
2290 #if HAVE_SYS_SOCKET_H
2291 #include <sys/socket.h>
2292 #endif
2293 #if HAVE_WINSOCK2_H
2294 #include <winsock2.h>
2295 #endif
9ac84dcf
FC
2296 #if HAVE_SYS_UIO_H
2297 #include <sys/uio.h>
2298 #endif
c72f8c2e
AJ
2299])
2300
ecd8516d 2301AC_CHECK_TYPE(struct msghdr,AC_DEFINE(HAVE_MSGHDR,1,[The system provides struct msghdr]),,[
c72f8c2e
AJ
2302 #if HAVE_SYS_SOCKET_H
2303 #include <sys/socket.h>
2304 #endif
2ff9dfaa
AJ
2305 #if HAVE_MSWSOCK_H
2306 #include <mswsock.h>
2307 #endif
c72f8c2e
AJ
2308 #if HAVE_WINSOCK2_H
2309 #include <winsock2.h>
2310 #endif
2311])
2312
ecd8516d 2313AC_CHECK_TYPE(struct sockaddr_un,AC_DEFINE(HAVE_SOCKADDR_UN,1,[The system provides sockaddr_un]),,[
c72f8c2e
AJ
2314 #if HAVE_SYS_UN_H
2315 #include <sys/un.h>
2316 #endif
2317 #if HAVE_SYS_SOCKET_H
2318 #include <sys/socket.h>
2319 #endif
2320 #if HAVE_WINSOCK2_H
2321 #include <winsock2.h>
2322 #endif
2323])
2324
5cafc1d6 2325dnl IP-Filter support requires ipf header files. These aren't
2326dnl installed by default, so we need to check for them
a1c22363
AJ
2327AS_IF([test "x$enable_ipf_transparent" != "xno"],[
2328 SQUID_CHECK_BROKEN_SOLARIS_IPFILTER
2329 AC_MSG_CHECKING(for availability of IP-Filter header files)
2330 # hold on to your hats...
2331 AS_IF(
2332 [test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
2333 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
2334 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
2335 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes"],
2336 [have_ipfilter_compat_header="yes"])
2337
2338 AS_IF(
2339 [test "x$have_ipfilter_compat_header" = "xyes" -a \
2340 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
2341 "x$ac_cv_header_ip_nat_h" = "xyes"],[enable_ipf_transparent="yes"],
2342
2343 [test "x$have_ipfilter_compat_header" = "xyes" -a \
2344 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
2345 "x$ac_cv_header_netinet_ip_nat_h" = "xyes"],[enable_ipf_transparent="yes"],
2346 [enable_ipf_transparent="no"])
2347
2348 AC_MSG_RESULT($IPF_TRANSPARENT)
d25bbe26
AJ
2349
2350## On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
2351## Solaris minor version (8, 9, 10, ...)
a1c22363 2352 AS_IF([test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris"],[
d25bbe26
AJ
2353 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
2354 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
2355 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
a1c22363
AJ
2356 ])
2357])
1d26e252 2358AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
0f658b5b 2359SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
1d26e252
FC
2360 [Enable support for IPF-style transparent proxying])
2361
b2192042 2362dnl PF /dev/pf support requires a header file.
a1c22363
AJ
2363AS_IF([test "x$with_nat_devpf" != "xno"],[
2364 AS_IF([test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
2365 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"],[
2366 AS_IF([test "x$with_nat_devpf" = "xauto"],[with_nat_devpf="no"])
2367 ],[
2368 AS_IF([test "x$with_nat_devpf" = "xyes"],[
b2192042 2369 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
a1c22363 2370 ])
b2192042 2371 with_nat_devpf="no"
a1c22363
AJ
2372 ])
2373])
b2192042 2374SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
38ff0a40 2375 [Enable support for PF-style transparent proxying])
b2192042
AJ
2376SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
2377 [Enable support for /dev/pf NAT lookups])
2b0dd4ac 2378
a1c22363
AJ
2379AS_IF([test "x$enable_linux_netfilter" != "xno"],[
2380 AS_IF([test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"],[
2381 AS_IF([test "x$enable_linux_netfilter" = "xauto"],[enable_linux_netfilter=yes])
2382 ],[
2383 AS_IF([test "x$enable_linux_netfilter" = "xauto"],[
4bd144d2 2384 enable_linux_netfilter=no
a1c22363 2385 ],[
4bd144d2 2386 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
a1c22363
AJ
2387 ])
2388 ])
2389])
0f658b5b 2390SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
969d4051 2391 [Enable support for Transparent Proxy on Linux via Netfilter])
20ad76ab 2392
b50f1b2b 2393dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
4bd144d2 2394AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
59eac907 2395AS_IF([test "x$enable_linux_netfilter" = "xyes" -a "x$with_cap" != "xyes"],[
a1c22363
AJ
2396 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
2397 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
2398 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
2399 # AC_DEFINEd later
2400])
59eac907 2401AS_IF([test "x$with_netfilter_conntrack" = "xyes" -a "x$with_cap" != "xyes"],[
a1c22363
AJ
2402 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
2403 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
2404 with_netfilter_conntrack=no
2405])
24531401 2406AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack}])
11e8cfe3
AB
2407
2408
2409AC_ARG_ENABLE(zph-qos,
6c83720b 2410 AS_HELP_STRING([--disable-zph-qos],[Disable ZPH QOS support]), [
ec308e40 2411 SQUID_YESNO([$enableval],[--enable-zph-qos])
11e8cfe3
AB
2412])
2413SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
2414 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
2415 TOS field of HIT responses to help policing network traffic])
2416AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
5ca367d9 2417AS_IF([test "x$enable_zph_qos" = "xyes"],[
a1c22363
AJ
2418 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
2419 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
2420 [Enable support for QOS netfilter mark preservation])
2421])
c2afddd8
AJ
2422
2423AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
c2afddd8
AJ
2424AC_SUBST(REGEXLIB)
2425
8e0acaf5
FC
2426SQUID_DETECT_UDP_SND_BUFSIZE
2427SQUID_DETECT_UDP_RECV_BUFSIZE
2428SQUID_DETECT_TCP_SND_BUFSIZE
2429SQUID_DETECT_TCP_RECV_BUFSIZE
6bf65235 2430
5c3c56fa
FC
2431SQUID_CHECK_NEED_SYS_ERRLIST
2432SQUID_CHECK_MAXPATHLEN
cc192b50 2433
819656da
AJ
2434SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
2435SQUID_CHECK_RESOLVER_FIELDS
2436
615540cd 2437AC_CHECK_HEADERS(sys/statvfs.h)
a1c22363
AJ
2438AS_IF([test "x$ac_cv_header_sys_statvfs_h" = "xyes"],[SQUID_CHECK_WORKING_STATVFS])
2439AS_IF([test "x$ac_cv_func_statvfs" != "xyes"],[
615540cd
AJ
2440 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/vfs.h sys/statfs.h)
2441 AC_CHECK_FUNCS(statfs)
2442 SQUID_CHECK_F_FRSIZE_IN_STATFS
a1c22363 2443])
c68e9c6b 2444
4eb85b7a 2445dnl Squid will not usually attempt to translate templates when building
461b8219 2446AC_ARG_ENABLE(translation,
4eb85b7a 2447 AS_HELP_STRING([--enable-translation],[Generate the localized error page templates and manuals.
9603207d 2448 Which can also be downloaded from http://www.squid-cache.org/Versions/langpack/.]), [
ec308e40 2449 SQUID_YESNO([$enableval],[--enable-translation])
461b8219 2450])
a1c22363 2451AS_IF([test "x${enable_translation:=no}" = "xyes"],[
461b8219 2452 AX_WITH_PROG([PO2HTML],[po2html])
02259ff8 2453 AX_WITH_PROG([PO2TEXT],[po2txt])
a1c22363 2454],[
461b8219 2455 PO2HTML="off"
02259ff8 2456 PO2TEXT="off"
a1c22363 2457])
461b8219 2458AC_SUBST(PO2HTML)
02259ff8 2459AC_SUBST(PO2TEXT)
d146da3b 2460AM_CONDITIONAL(ENABLE_TRANSLATION, test "x${enable_translation:=no}" = "xyes")
ee1a8ac2 2461
43000484
AJ
2462dnl Squid now has limited locale handling ...
2463dnl on error pages
2464AC_ARG_ENABLE(auto-locale,
62979ab1 2465 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
21d5413e 2466 clients request headers.
fb46b778 2467 When disabled Squid requires explicit language configuration.]), [
ec308e40 2468 SQUID_YESNO([$enableval],[--enable-auto-locale])
8db7a54b 2469])
fb46b778
FC
2470AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
2471SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
2472 [Use multi-language support on error pages])
2473
43000484 2474
090089c4 2475dnl Need the debugging version of malloc if available
2476XTRA_OBJS=''
a1c22363
AJ
2477AS_IF([test "x$ac_cv_lib_malloc_main" = "xyes"],[
2478 AS_IF([test -r /usr/lib/debug/malloc.o],[XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"])
2479 AS_IF([test -r /usr/lib/debug/mallocmap.o],[XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"]);
2480])
090089c4 2481AC_SUBST(XTRA_OBJS)
2482
a1c22363
AJ
2483AS_IF([test "x$XTRA_LIBS" = "x"],[
2484 XTRA_LIBS="$LIBS"
2485 dnl minor cleanup
2486 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
2487 LIBS=''
2488])
090089c4 2489AC_SUBST(XTRA_LIBS)
2490
daed6927
FC
2491AC_SUBST(SQUID_CFLAGS)
2492AC_SUBST(SQUID_CXXFLAGS)
2493
09835feb 2494# Prerequisite: CXXFLAGS have been finalized.
b2f0a375 2495AC_ARG_VAR([BUILDCXXFLAGS],[C++ compiler flags for building compile-time tools. e.g. cf_gen])
a1c22363 2496AS_IF([test "x$BUILDCXXFLAGS" = "x"],[
b2f0a375
AJ
2497 # if we are NOT cross-compiling, use the default build flags for cf_gen and friends
2498 # otherwise rely on the user-provided value
a1c22363 2499 AS_IF([test "x$squid_cv_check_marchnative" = "xyes"],[
b2f0a375 2500 # always valid for the Build compiler.
b3080eec 2501 BUILDCXXFLAGS="-march=native"
a1c22363 2502 ])
b2f0a375 2503 BUILDCXXFLAGS="$BUILDCXXFLAGS $CXXFLAGS"
a1c22363 2504])
b2f0a375
AJ
2505AC_SUBST(BUILDCXXFLAGS)
2506
90b412dd
AJ
2507AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
2508AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
2509AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
2510AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
2511AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
2512AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
2513AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
2514AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
b2f0a375 2515AC_MSG_NOTICE([BUILD Tools C++ FLAGS: $BUILDCXXFLAGS])
daed6927 2516
090089c4 2517dnl Clean up after OSF/1 core dump bug
9603207d 2518rm -f core
090089c4 2519
7a03447c
AJ
2520AC_CONFIG_FILES([
2521 Makefile
2522 compat/Makefile
7a03447c 2523 contrib/Makefile
7a03447c
AJ
2524 doc/Makefile
2525 doc/manuals/Makefile
86b8d400 2526 doc/release-notes/Makefile
6b99776c 2527 errors/Makefile
6b99776c
AJ
2528 icons/Makefile
2529 lib/Makefile
2530 lib/libTrie/Makefile
2531 lib/libTrie/test/Makefile
2532 lib/ntlmauth/Makefile
6b99776c
AJ
2533 lib/rfcnb/Makefile
2534 lib/smblib/Makefile
2535 lib/snmplib/Makefile
b9ce9676 2536 lib/sspi/Makefile
6b99776c
AJ
2537 scripts/Makefile
2538 src/Makefile
2539 src/acl/Makefile
e046643f
AJ
2540 src/acl/external/Makefile
2541 src/acl/external/AD_group/Makefile
2542 src/acl/external/delayer/Makefile
2543 src/acl/external/eDirectory_userip/Makefile
2544 src/acl/external/file_userip/Makefile
2545 src/acl/external/kerberos_ldap_group/Makefile
4a544c9d 2546 src/acl/external/kerberos_sid_group/Makefile
e046643f
AJ
2547 src/acl/external/LDAP_group/Makefile
2548 src/acl/external/LM_group/Makefile
2549 src/acl/external/session/Makefile
2550 src/acl/external/SQL_session/Makefile
2551 src/acl/external/unix_group/Makefile
2552 src/acl/external/wbinfo_group/Makefile
2553 src/acl/external/time_quota/Makefile
6b99776c
AJ
2554 src/adaptation/Makefile
2555 src/adaptation/icap/Makefile
2556 src/adaptation/ecap/Makefile
2557 src/anyp/Makefile
2558 src/auth/Makefile
2559 src/auth/basic/Makefile
03901cf8
AJ
2560 src/auth/basic/DB/Makefile
2561 src/auth/basic/fake/Makefile
2562 src/auth/basic/getpwnam/Makefile
2563 src/auth/basic/LDAP/Makefile
2564 src/auth/basic/NCSA/Makefile
2565 src/auth/basic/NIS/Makefile
2566 src/auth/basic/PAM/Makefile
2567 src/auth/basic/POP3/Makefile
2568 src/auth/basic/RADIUS/Makefile
2569 src/auth/basic/SASL/Makefile
2570 src/auth/basic/SMB/Makefile
2571 src/auth/basic/SMB_LM/Makefile
2572 src/auth/basic/SSPI/Makefile
6b99776c 2573 src/auth/digest/Makefile
d4d7f6dd
AJ
2574 src/auth/digest/eDirectory/Makefile
2575 src/auth/digest/file/Makefile
2576 src/auth/digest/LDAP/Makefile
6b99776c 2577 src/auth/negotiate/Makefile
16c02b14
AJ
2578 src/auth/negotiate/kerberos/Makefile
2579 src/auth/negotiate/SSPI/Makefile
2580 src/auth/negotiate/wrapper/Makefile
6b99776c 2581 src/auth/ntlm/Makefile
b817c20f
AJ
2582 src/auth/ntlm/fake/Makefile
2583 src/auth/ntlm/SMB_LM/Makefile
2584 src/auth/ntlm/SSPI/Makefile
6b99776c
AJ
2585 src/base/Makefile
2586 src/clients/Makefile
2587 src/comm/Makefile
675b8408 2588 src/debug/Makefile
4a3b98d7 2589 src/dns/Makefile
13d8c08c 2590 src/DiskIO/Makefile
d9691f09
AJ
2591 src/DiskIO/AIO/Makefile
2592 src/DiskIO/Blocking/Makefile
2593 src/DiskIO/DiskDaemon/Makefile
2594 src/DiskIO/DiskThreads/Makefile
2595 src/DiskIO/IpcIo/Makefile
2596 src/DiskIO/Mmapped/Makefile
83b053a0 2597 src/error/Makefile
6b99776c
AJ
2598 src/esi/Makefile
2599 src/eui/Makefile
2600 src/format/Makefile
2601 src/fs/Makefile
2602 src/ftp/Makefile
2603 src/helper/Makefile
1d0bc8ee 2604 src/html/Makefile
6b99776c
AJ
2605 src/http/Makefile
2606 src/http/one/Makefile
d6d6203a
AJ
2607 src/http/url_rewriters/Makefile
2608 src/http/url_rewriters/fake/Makefile
2609 src/http/url_rewriters/LFS/Makefile
6b99776c
AJ
2610 src/icmp/Makefile
2611 src/ident/Makefile
2612 src/ip/Makefile
2613 src/ipc/Makefile
2614 src/log/Makefile
4d5dd85a
AJ
2615 src/log/DB/Makefile
2616 src/log/file/Makefile
6b99776c
AJ
2617 src/mem/Makefile
2618 src/mgr/Makefile
2619 src/parser/Makefile
36c774f7 2620 src/proxyp/Makefile
6b99776c 2621 src/repl/Makefile
65e41a45 2622 src/sbuf/Makefile
7dcca85b 2623 src/security/Makefile
cb0b3d63
AJ
2624 src/security/cert_generators/Makefile
2625 src/security/cert_generators/file/Makefile
bbf79f12
AJ
2626 src/security/cert_validators/Makefile
2627 src/security/cert_validators/fake/Makefile
6b99776c
AJ
2628 src/servers/Makefile
2629 src/snmp/Makefile
2630 src/ssl/Makefile
2745fea5 2631 src/store/Makefile
0c1f8b9b
AJ
2632 src/store/id_rewriters/Makefile
2633 src/store/id_rewriters/file/Makefile
98cacedb 2634 src/time/Makefile
6b99776c 2635 test-suite/Makefile
94ab55b0 2636 tools/Makefile
3d276e1d 2637 tools/apparmor/Makefile
33d1abfe 2638 tools/helper-mux/Makefile
422cb5da 2639 tools/systemd/Makefile
a35a0ac7 2640 tools/sysvinit/Makefile
53cbe3e4 2641])
43ae1d95 2642
3e7b6055 2643# must configure libltdl subdir unconditionally for "make distcheck" to work
081863f3 2644#AC_CONFIG_SUBDIRS(libltdl)
3e7b6055 2645
6a9f6389 2646AC_OUTPUT