]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.ac
Source Format Enforcement (#1132)
[thirdparty/squid.git] / configure.ac
CommitLineData
bf95c10a 1## Copyright (C) 1996-2022 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
a8b7dd82 8AC_INIT([Squid Web Proxy],[6.0.0-VCS],[http://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])
3c586e38 24m4_include([acinclude/pam.m4])
2b448046 25m4_include([acinclude/pkg.m4])
acd207af 26m4_include([acinclude/tdb.m4])
91983da0 27m4_include([acinclude/lib-checks.m4])
ea1cf567 28m4_include([acinclude/ax_cxx_compile_stdcxx_11.m4])
a203dec7 29m4_include([acinclude/ax_cxx_0x_types.m4])
6a56798f 30
63e02610 31PRESET_CFLAGS="$CFLAGS"
a203dec7 32PRESET_CXXFLAGS="$CXXFLAGS"
63e02610 33PRESET_LDFLAGS="$LDFLAGS"
34
a2794549 35dnl Set default LDFLAGS
fcabe077 36if test "x$LDFLAGS" = "x" ; then
73862432 37 LDFLAGS="-g"
a2794549 38fi
39
aff48cc8 40# Check for GNU cc
a2794549 41AC_PROG_CC
e6c4cdd6 42AM_PROG_CC_C_O
29b8d8d6 43AC_PROG_CXX
62979ab1 44AC_LANG([C++])
88d50a22 45AC_CANONICAL_HOST
3e7b6055 46
c8640c9a
AJ
47# Clang 3.2 on some CPUs requires -march-native to detect correctly.
48# GCC 4.3+ can also produce faster executables when its used.
49# But building inside a virtual machine environment has been found to
50# cause random Illegal Instruction errors due to mis-detection of CPU.
51AC_ARG_ENABLE(arch-native,
52 AS_HELP_STRING([--disable-arch-native],[Some compilers offer CPU-specific
53 optimizations with the -march=native parameter.
54 This flag disables the optimization. The default is to
55 auto-detect compiler support and use where available.]), [
56 SQUID_YESNO([$enableval],
57 [Unrecognized argument to --disable-arch-native: $enableval])
58])
d8a4ba7c 59AC_MSG_NOTICE([CPU arch native optimization enabled: ${enable_arch_native:=auto}])
c8640c9a
AJ
60if test "x${enable_arch_native}" != "xno"; then
61 SQUID_CC_CHECK_ARGUMENT([squid_cv_check_marchnative],[-march=native])
62fi
e9d3951b
AJ
63
64# might be cross-compiling.
b2f0a375
AJ
65# NP: BUILDCXXFLAGS defined at the end of configure after CXXFLAGS fully known.
66AC_ARG_VAR([BUILDCXX],[path to compiler for building compile-time tools. e.g. cf_gen])
67if test "x$HOSTCXX" != "x" -a "x$BUILDCXX" = "x"; then
68 AC_MSG_WARN([Cross-compiling with HOSTCXX is deprecated. Uses BUILDCXX instead.])
69 BUILDCXX="$HOSTCXX"
70fi
71if test "x$BUILDCXX" = "x"; then
72 BUILDCXX="$CXX"
e9d3951b
AJ
73 if test "x$squid_cv_check_marchnative" = "xyes"; then
74 CXXFLAGS="$CXXFLAGS -march=native"
75 fi
76fi
b2f0a375 77AC_SUBST(BUILDCXX)
de051d9d 78
40503c27 79AC_MSG_CHECKING([simplified host os])
78a60bca 80simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
035a321e 81squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
6ca34f6f
HN
82if test -n "$squid_host_os_version"; then
83 squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
84else
85 squid_host_os="$simple_host_os"
86fi
40503c27
FC
87AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
88# on windows squid_host_os is either mingw or cygwin, version is 32
89
b2b60232
FC
90# this needs to be before any test is run, to have more standard
91# functions available on some Unix sysems (e.g. Solaris)
92if test "x$squid_host_os" = "solaris" -a "x$GCC" != "x" ; then
93 AC_USE_SYSTEM_EXTENSIONS
94fi
95
79987b1a
AJ
96# If the user did not specify a C++ version.
97user_cxx=`echo "$PRESET_CXXFLAGS" | grep -o -E "\-std="`
98if test "x$user_cxx" = "x"; then
99 # Check for C++11 compiler support
100 AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
101fi
a203dec7 102
aff48cc8 103# test for programs
aff48cc8
FC
104AC_PROG_RANLIB
105AC_PROG_CPP
106AC_PROG_INSTALL
107AC_PROG_LN_S
108AC_PROG_EGREP
109
110AC_PATH_PROG(SH, sh, /bin/sh)
111AC_PATH_PROG(FALSE, false, /usr/bin/false)
112AC_PATH_PROG(TRUE, true, /usr/bin/true)
113AC_PATH_PROG(MV, mv, $FALSE)
114AC_PATH_PROG(MKDIR, mkdir, $FALSE)
115AC_PATH_PROG(LN, ln, cp)
116AC_PATH_PROG(CHMOD, chmod, $FALSE)
6d1c1ab1 117AC_PATH_PROG(TR, tr, $FALSE)
aff48cc8
FC
118AC_PATH_PROG(RM, rm, $FALSE)
119dnl Libtool 2.2.6 requires: rm -f
120RM="$RM -f"
121
d93bf055
AJ
122PKG_PROG_PKG_CONFIG
123
aff48cc8 124AC_PATH_PROG(PERL, perl, none)
fcabe077 125if test "x$ac_cv_path_PERL" = "xnone"; then
aff48cc8
FC
126 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
127fi
07f370ee 128AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
33d1abfe 129AM_CONDITIONAL(ENABLE_POD2MAN_DOC, test "x${ac_cv_path_POD2MAN}" != "x$FALSE")
aff48cc8 130
52c549d9
AJ
131dnl set $(AR) if not provided by the build environment
132if test "x$AR" = "x"; then
133 AC_PATH_PROG(AR, ar, $FALSE)
134fi
aff48cc8 135AR_R="$AR r"
aff48cc8
FC
136AC_SUBST(AR_R)
137
86b8d400
AJ
138AC_PATH_PROG(LINUXDOC, linuxdoc, $FALSE)
139AM_CONDITIONAL(ENABLE_RELEASE_DOCS, test "x${ac_cv_path_LINUXDOC}" != "x$FALSE")
140
cda5e747
AJ
141# pre-define DEFAULT_PREFIX, some modules need it.
142if test "${prefix}" = "NONE" ; then
143 squid_prefix=$ac_default_prefix
144else
145 squid_prefix=$prefix
146fi
147AC_DEFINE_UNQUOTED(DEFAULT_PREFIX,[$squid_prefix],[The install prefix])
148
0b45d157
FC
149AC_ARG_ENABLE(strict-error-checking,
150 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
2d65bb9a 151 with all possible static compiler error-checks enabled.
cdb352bb
FC
152 This flag disables the behavior]), [
153 SQUID_YESNO([$enableval],
154 [Unrecognized argument to --disable-strict-error-checking: $enableval])
0b45d157 155])
cdb352bb 156AC_MSG_NOTICE([strict error checking enabled: ${enable_strict_error_checking:=yes}])
d1f95b42 157
4313559d 158# LT_INIT requires libtool v2, might as well state it loud
2663a9c8 159LT_PREREQ([2.2])
5a2409b7 160LT_INIT([dlopen])
2148ef58
AJ
161if ! test "${ac_top_build_prefix}" = "";
162then
163 # LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
164 # But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
165 # This fixes Linux LTDLv3-v7, and BSD LTDL v2.2
166 top_build_prefix=${ac_top_build_prefix}
167 AC_SUBST(top_build_prefix)
168fi
bd9303f5 169LTDL_INIT
081863f3 170
d9a41469 171dnl LibTool environment is now prepared for setup. Check that it is usable and initialize.
081863f3 172LT_LIB_DLLOAD
3e7b6055
AR
173
174# Do we need these unconditionally for "make distcheck" to work?
175AC_SUBST(INCLTDL)
176AC_SUBST(LIBLTDL)
177
5a2409b7
AJ
178AC_MSG_CHECKING(whether to use loadable modules)
179AS_IF([test "x${enable_shared:=yes}" = "xyes"],[AC_DEFINE(USE_LOADABLE_MODULES,1,[Support Loadable Modules])])
180AM_CONDITIONAL(ENABLE_LOADABLE_MODULES, test "x${enable_shared:=yes}" = "xyes")
181AC_MSG_RESULT([$enable_shared])
182
07f370ee 183SQUID_CC_GUESS_VARIANT
fa6307ae 184SQUID_CC_GUESS_OPTIONS
f9d138eb 185
be0c7ff0
FC
186dnl find out the exe extension for this platform.
187dnl If it is not empty, use it for CGI as well.
a2794549 188AC_EXEEXT
189AC_OBJEXT
190
fcabe077
FC
191if test "x$EXEEXT" = "x" ; then
192 CGIEXT=".cgi"
a2794549 193else
fcabe077
FC
194 # automake automatically adds .exe when installing binaries
195 CGIEXT=""
a2794549 196fi
7aeb8001 197AC_SUBST(CGIEXT)
a2794549 198
a396d1f8 199AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,[test "x$squid_host_os" = "xmingw"])
daf2ddfa 200AM_CONDITIONAL(ENABLE_WIN32_IPC,[test "x$squid_host_os" = "xmingw"])
fcabe077 201
b5467222
CT
202case "$squid_host_os" in
203mingw)
fcabe077
FC
204 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
205 CFLAGS="$CFLAGS -mthreads"
d66b42da 206 CXXFLAGS="$CXXFLAGS -mthreads -static-libgcc -static-libstdc++"
fcabe077
FC
207 if test "x$ac_cv_path_WIN32_PSAPI" = "xnone"; then
208 AC_MSG_NOTICE([PSAPI.DLL is recommended to run Squid on Windows NT Platform])
209 AC_MSG_NOTICE([Please see PSAPI.DLL section on doc/win32-relnotes.html.])
210 else
211 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
212 LIBS="$LIBS -lpsapi"
213 fi
214 MINGW_LIBS="-lmingwex"
215 AC_SUBST(MINGW_LIBS)
b5467222
CT
216 ;;
217freebsd)
218 # FreeBSD places local libraries and packages in /usr/local
219 CFLAGS="$CFLAGS -I/usr/local/include"
220 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
221 LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-R/usr/local/lib"
222 ;;
223*)
224 ;;
225esac
4b26fae9 226
f4aaf39c 227dnl Substitutions
6a9f6389 228AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
30a4f2a8 229
9603207d 230AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args",
8075a4da 231 [configure command line used to configure Squid])
090089c4 232
5483d916 233CACHE_EFFECTIVE_USER="nobody"
234AC_ARG_WITH(default-user,
62979ab1 235 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
5483d916 236 [ CACHE_EFFECTIVE_USER="$withval" ]
237)
238AC_SUBST(CACHE_EFFECTIVE_USER)
239
c8d2dc9b
AJ
240DEFAULT_LOG_DIR="$localstatedir/logs"
241AC_ARG_WITH(logdir,
73862432 242 AS_HELP_STRING([--with-logdir=PATH],
cdb352bb 243 [Default location for squid logs. default: PREFIX/var/logs]), [
73862432
FC
244case $withval in
245 yes|no)
246 AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH )
247 ;;
248 *)
249 DEFAULT_LOG_DIR="$withval"
250 ;;
251esac
c8d2dc9b
AJ
252 ]
253)
254AC_SUBST(DEFAULT_LOG_DIR)
255
2f36643c 256DEFAULT_PID_FILE="$localstatedir/run/@SERVICE_NAME@.pid"
a7f6af35 257AC_ARG_WITH(pidfile,
e0eb5853 258 AS_HELP_STRING([--with-pidfile=PATH],
cdb352bb 259 [Default location for squid pid file. Default: PREFIX/var/run/squid.pid]), [
73862432
FC
260case $withval in
261 yes|no)
262 AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH )
263 ;;
264 *)
32f07882 265 DEFAULT_PID_FILE="$withval"
73862432
FC
266 ;;
267 esac
e0eb5853 268])
32f07882 269AC_SUBST(DEFAULT_PID_FILE)
a7f6af35 270
bf52b026
AJ
271DEFAULT_SWAP_DIR="$localstatedir/cache/squid"
272AC_ARG_WITH(swapdir,
273 AS_HELP_STRING([--with-swapdir=PATH],
274 [Default location for squid cache directories. Default: PREFIX/var/cache/squid]), [
275case $withval in
276 yes|no)
277 AC_MSG_ERROR( --with-swapdir requires a directory PATH. --with-swapdir=PATH )
278 ;;
279 *)
280 DEFAULT_SWAP_DIR="$withval"
281 ;;
282 esac
283])
284AC_SUBST(DEFAULT_SWAP_DIR)
285
30a4f2a8 286dnl Set Default CFLAGS
fcabe077 287if test "x$PRESET_CFLAGS" = "x"; then
f70e69c6 288 if test "$squid_cv_compiler" = "gcc"; then
fcabe077
FC
289 case "$host" in
290 *-sun-sunos*)
291 # sunos has too many warnings for this to be useful
fcabe077
FC
292 ;;
293 *)
294 CFLAGS="$squid_cv_cc_option_wall $CFLAGS"
295 ;;
296 esac
297 else
298 case "$host" in
299 *mips-sgi-irix6.*)
300 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
301 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
302 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
303 -Wl,-woff,85,-woff,84,-woff,134 \
304 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
305 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
306 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
307 -Wl,-woff,85,-woff,84,-woff,134 \
308 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
309 ;;
30a4f2a8 310 *)
fcabe077
FC
311 ;;
312 esac
313 fi
30a4f2a8 314fi
315
0ba77a3c
AR
316AC_MSG_CHECKING([compiler name-version])
317squid_cv_cc_name=`$CC --version | head -1 | cut -f1 -d" "`
318AS_CASE([$squid_cv_cc_name],
319 [gcc|clang],[squid_cv_cc_majversion=`$CC -dumpversion | cut -f1 -d.`],
320 [squid_cv_cc_majversion="unknown"]
321)
322squid_cv_cc_simplified="$squid_cv_cc_name-$squid_cv_cc_majversion"
323AC_MSG_RESULT($squid_cv_cc_simplified)
324
325# warning flags
326
327# -Wall
328SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([$squid_cv_cc_option_wall])
329
330# -Wextra
331AS_IF([test "$squid_cv_cc_simplified" = "gcc-4"],[
332 AC_MSG_NOTICE([skipping -Wextra on $squid_cv_cc_simplified])
333],[
334 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wextra])
335
336 # Now disable or configure certain warnings enabled by -Wextra
337
338 # -Wunused-private-field causes a huge number of false positives
339 # in unit tests. Disable that
340 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wno-unused-private-field])
341
342 # ...=2: This flexibility level allows GCC to "understand" our fallthrough
343 # comments. TODO: Switch to [[fallthrough]] attributes with C++17.
344 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wimplicit-fallthrough=2])
345 AS_IF([test "x$squid_cv_cc_arg_wimplicit_fallthrough_2" != "xyes"], [
346 SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wno-implicit-fallthrough])
347 ])
348])
349
8b082ed9 350# useful warnings that may not be included in -Wall -Wextra
0ba77a3c
AR
351SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wpointer-arith])
352SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wwrite-strings])
353SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wcomments])
354SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wshadow])
355SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Wmissing-declarations])
356SQUID_CC_ADD_CXXFLAG_WARNING_IF_SUPPORTED([-Woverloaded-virtual])
07f370ee 357
05c9db69 358dnl CentOS (and RHEL) still define ntohs() using deprecated C++ features
629cb141 359SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_wno_deprecated_register],[-Werror -Wno-deprecated-register],[[#include <arpa/inet.h>]],[[int fox=ntohs(1);]])
05c9db69 360
cdb352bb 361if test "x$enable_strict_error_checking" != "xno"; then
fcabe077 362 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
59a09b98 363 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
07f370ee
FC
364fi
365
0568bff2 366if test "x$ac_cv_require_wno_deprecated_register" = "xyes"; then
367 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -Wno-deprecated-register"
368fi
369
e0eb5853
FC
370# squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
371SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
372SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
2060fa9a 373
4fe75473
FC
374# possibly include some build info tag into squid -v
375SQUID_EMBED_BUILD_INFO
376
83079644 377AC_ARG_ENABLE(optimizations,
ffa3bad9 378 AS_HELP_STRING([--disable-optimizations],
be0c7ff0 379 [Do not compile Squid with compiler optimizations enabled.
a2f6a96c
FC
380 Optimization is good for production builds, but not
381 good for debugging. During development, use
382 --disable-optimizations to reduce compilation times
10185a38 383 and allow easier debugging.]), [
fcabe077
FC
384if test "x$enableval" = "xno" ; then
385 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
d0441961
CG
386 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
387 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9g]]*//'`"
fcabe077 388fi
83079644 389])
390
fa80a8ef 391AC_ARG_ENABLE(debug-cbdata,
8075a4da 392 AS_HELP_STRING([--enable-debug-cbdata],
9603207d 393 [Provide some debug information in cbdata]), [
50af7161
FC
394SQUID_YESNO([$enableval],
395 [unrecognized argument to --enable-debug-cbdata: $enableval])
fa80a8ef 396])
9a0a18de 397SQUID_DEFINE_BOOL(USE_CBDATA_DEBUG,${enable_debug_cbdata:=no},
50af7161
FC
398 [Enable support for cbdata debug information])
399AC_MSG_NOTICE([cbdata debugging enabled: $enable_debug_cbdata])
400
fa80a8ef 401
c9267250
AJ
402dnl Nasty hack to get autoconf 2.64 on Linux to run.
403dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
aff0e8fe 404AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[:])
c9267250 405
0d00c98b 406AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
d9180414 407AC_ARG_ENABLE(xmalloc-statistics,
8075a4da
FC
408 AS_HELP_STRING([--enable-xmalloc-statistics],
409 [Show malloc statistics in status page]), [
4d1d2477
FC
410SQUID_YESNO([$enableval],
411 [unrecognized argument to --enable-xmalloc-statistics: $enableval])
e5f4e1b0 412])
4d1d2477
FC
413SQUID_DEFINE_BOOL(XMALLOC_STATISTICS,${enable_xmalloc_statistics:=no},
414 [Show malloc statistics in status page])
415AC_MSG_NOTICE([xmalloc stats display: $enable_xmalloc_statistics])
e5f4e1b0 416
8075a4da 417squid_opt_aufs_threads=""
f85c88f3 418AC_ARG_WITH(aufs-threads,
8075a4da 419 AS_HELP_STRING([--with-aufs-threads=N_THREADS],
9603207d 420 [Tune the number of worker threads for the aufs object store.]), [
8075a4da 421case $withval in
a3310b77 422 [[0-9]]*)
50fbcbd6 423 squid_opt_aufs_threads=$withval
a3310b77 424 ;;
425 *)
8b0d8e31 426 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
a3310b77 427 ;;
428 esac
429])
fcabe077 430if test "x$squid_opt_aufs_threads" != "x"; then
50fbcbd6
FC
431 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
432 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
8075a4da 433 [Defines how many threads aufs uses for I/O])
cd748f27 434fi
435
24531401
AJ
436## TODO check if this is necessary, LT_INIT does these checks
437SQUID_AUTO_LIB(dl,[dynamic linking],[LIBDL])
438if test "x$with_dl" != "xno"; then
439 CXXFLAGS="$LIBDL_CFLAGS $CXXFLAGS"
440 LDFLAGS="$LIBDL_PATH $LDFLAGS"
441 AC_CHECK_LIB(dl, dlopen)
8154dd82 442fi
f85c88f3 443
8636e7c1
EB
444AC_DEFUN([LIBATOMIC_CHECKER],[
445 AC_MSG_CHECKING(whether linking $1 -latomic works)
446 AC_LINK_IFELSE([
447 AC_LANG_SOURCE([[
448#include <atomic>
449#include <cstdint>
450 int
b98c6823
HS
451 main(int argc, char **) {
452 return (
453 std::atomic<uint8_t>(uint8_t(argc)).exchange(0) &&
454 std::atomic<uint64_t>{}.is_lock_free()
455 ) ? 0 : 1;
8636e7c1
EB
456 }
457 ]])],[
458 AC_MSG_RESULT(yes)
459 libatomic_checker_result="yes"],[
460 AC_MSG_RESULT(no)
461 libatomic_checker_result="no"
462])])
463
4b0f8912 464## check for atomics library before anything that might need it
16530552 465SQUID_STATE_SAVE(LIBATOMIC)
8636e7c1
EB
466LIBATOMIC_CHECKER(without)
467AS_IF([test "x$libatomic_checker_result" = "xno"],[
468 LIBS="$LIBS -latomic"
469 LIBATOMIC_CHECKER(with)
470 AS_IF([test "x$libatomic_checker_result" = "xyes"],[
471 ATOMICLIB="-latomic"],[
472 AC_MSG_ERROR([Required library libatomic not found.])
473])])
16530552 474SQUID_STATE_ROLLBACK(LIBATOMIC)
4b0f8912
AJ
475AC_SUBST(ATOMICLIB)
476
c975f532
DK
477AC_SEARCH_LIBS([shm_open], [rt])
478if test "x$ac_cv_search_shm_open" != "xno" ; then
479 AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
480fi
481
d235bc84 482AC_MSG_CHECKING([for DiskIO modules to be enabled])
50fbcbd6 483squid_disk_module_candidates=""
8075a4da 484squid_opt_enable_diskio="auto" #values: no, yes, "auto"(=yes+detect modules)
2513178d 485AC_ARG_ENABLE(disk-io,
50fbcbd6
FC
486 AS_HELP_STRING([--enable-disk-io="list of modules"],
487 [Build support for the list of disk I/O modules.
488 Set without a value or omitted, all available modules will be built.
489 See src/DiskIO for a list of available modules, or
490 Programmers Guide section on DiskIO
9603207d 491 for details on how to build your custom disk module]), [
8075a4da 492case $enableval in
2513178d 493 yes)
fe9ddf62 494 ${TRUE}
50fbcbd6 495 #do nothing, "auto" is ok
507ca601 496 ;;
2513178d 497 no)
8075a4da 498 squid_opt_enable_diskio="no"
507ca601 499 ;;
2513178d 500 *)
8075a4da 501 squid_opt_enable_diskio="yes"
47d80734 502 squid_disk_module_candidates=" `echo $enableval| sed -e 's/,/ /g;s/ */ /g'` "
d235bc84 503 SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
507ca601 504 ;;
2513178d 505 esac
50fbcbd6
FC
506])
507
d235bc84 508# if requested to autodetect, find out what we have
fcabe077 509if test "x$squid_opt_enable_diskio" = "xauto"; then
8075a4da 510 squid_opt_enable_diskio="yes"
50fbcbd6 511 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
c975f532
DK
512 if test "x$ac_cv_search_shm_open" = "xno" ; then
513 # disable IpcIo
514 squid_disk_module_candidates=`echo $squid_disk_module_candidates|sed 's/IpcIo//'`
515 fi
50fbcbd6 516fi
d235bc84 517
47d80734 518AC_MSG_RESULT([${squid_disk_module_candidates:-none}])
dc299f29 519SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
0f658b5b 520SQUID_DEFINE_BOOL(USE_DISKIO,$squid_opt_enable_diskio,
50fbcbd6 521 [DiskIO modules are expected to be available.])
2513178d 522
dc299f29 523
40503c27 524
2513178d 525dnl Some autoconf.h defines we might enable later...
0b163dbb
FC
526AC_ARG_WITH(pthreads,AS_HELP_STRING([--without-pthreads],[Disable POSIX Threads]))
527AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO. Default: auto-detect]))
daf2ddfa 528ENABLE_WIN32_AIOPS=0
ffa3bad9
FC
529squid_opt_use_aio=
530squid_opt_use_diskthreads=
46577dd1 531AIOLIB=
2513178d
AJ
532
533dnl Setup the module paths etc.
2513178d
AJ
534DISK_LIBS=
535DISK_MODULES=
d9691f09
AJ
536AH_TEMPLATE(HAVE_DISKIO_MODULE_AIO, [Whether POSIX AIO Disk I/O module is built])
537AH_TEMPLATE(HAVE_DISKIO_MODULE_BLOCKING, [Whether Blocking Disk I/O module is built])
538AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKDAEMON, [Whether DiskDaemon Disk I/O module is built])
23ee12fb 539AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKTHREADS, [Whether DiskThreads Disk I/O module is built])
d9691f09
AJ
540AH_TEMPLATE(HAVE_DISKIO_MODULE_IPCIO, [Whether IpcIo Disk I/O module is built])
541AH_TEMPLATE(HAVE_DISKIO_MODULE_MMAPPED, [Whether Mmapped Disk I/O module is built])
50fbcbd6 542for module in $squid_disk_module_candidates none; do
d235bc84 543 # maybe not needed
fcabe077 544 if test "x$module" = "xnone"; then
507ca601 545 continue
2513178d 546 fi
fcabe077 547 if ! test -d "$srcdir/src/DiskIO/$module"; then
2513178d
AJ
548 AC_MSG_ERROR(disk-io $module does not exist)
549 fi
550 case "$module" in
d9691f09
AJ
551
552 AIO)
553 dnl Check for POSIX AIO availability
554 squid_opt_use_aio="yes"
555 AIOLIB=
556 if test "x$with_aio" != "xno"; then
557 have_aio_header=no
558 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
559 dnl On some systems POSIX AIO functions are in librt
560 dnl On some systems POSIX AIO functions are in libaio
561 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
562 dnl Enable AIO if the library and headers are found
563 if test "x$AIOLIB" != "x" && test "x$have_aio_header" = "xyes"; then
564 AC_MSG_NOTICE([Native POSIX AIO support detected.])
565 squid_opt_use_aio="yes"
566 else
567 dnl Windows does things differently. We provide wrappers.
568 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
569 case "$squid_host_os" in
570 mingw)
571 squid_opt_use_aio="yes"
572 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
573 ;;
574 *)
575 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
576 squid_opt_use_aio="no"
577 ;;
578 esac
579 fi
580 else
581 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
582 squid_opt_use_aio="no"
583 fi
584 dnl Use the POSIX AIO pieces if we actually need them.
585 if test "x$squid_opt_use_aio" = "xyes" ; then
586 DISK_MODULES="$DISK_MODULES AIO"
d9691f09
AJ
587 AC_DEFINE([HAVE_DISKIO_MODULE_AIO],1,[POSIX AIO Disk I/O module is built])
588 case "$squid_host_os" in
589 mingw)
590 ENABLE_WIN32_AIO=1
591 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
592 ;;
593 *)
594 AC_MSG_NOTICE([Enabling AIO DiskIO module])
595 ;;
596 esac
597 else
598 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
fedd516f 599 squid_disk_module_candidates_AIO=no
d9691f09
AJ
600 fi
601 ;;
602
603 Blocking)
604 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
605 DISK_MODULES="$DISK_MODULES Blocking"
d9691f09
AJ
606 AC_DEFINE([HAVE_DISKIO_MODULE_BLOCKING],1,[Blocking Disk I/O module is built])
607 ;;
608
2513178d 609 DiskDaemon)
1d3aafe4
FC
610 case "$squid_host_os" in
611 mingw)
612 AC_MSG_NOTICE(["DiskDaemon not supported on MinGW"])
fedd516f 613 squid_disk_module_candidates_DiskDaemon=no
1d3aafe4
FC
614 ;;
615 *)
616 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
1d3aafe4 617 DISK_MODULES="$DISK_MODULES DiskDaemon"
d9691f09 618 AC_DEFINE([HAVE_DISKIO_MODULE_DISKDAEMON],1,[DiskDaemon Disk I/O module is built])
1d3aafe4
FC
619 ;;
620 esac
507ca601 621 ;;
d9691f09 622
2513178d 623 DiskThreads)
507ca601
FC
624 squid_opt_use_diskthreads="yes"
625 LIBPTHREADS=
626 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
627 if test "x$with_pthreads" != "xno"; then
628 dnl TODO: this needs to be extended to handle more systems and better
629 dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
630 dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
631 case "$squid_host_os" in
632 mingw)
daf2ddfa 633 ENABLE_WIN32_AIOPS=1
507ca601
FC
634 AC_MSG_NOTICE([Windows threads support automatically enabled])
635 ;;
636 freebsd)
2a76c9c4 637 if test `echo "$squid_host_os_version" | tr -d .` -lt 70 ; then
a0f82085
AJ
638 AC_MSG_NOTICE(pthread library requires FreeBSD 7 or later)
639 squid_opt_use_diskthreads="no"
640 else
641 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
642 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
643 if test "x$GCC" = "xyes" -a "x$PRESET_LDFLAGS" = "x" ; then
644 LDFLAGS="$LDFLAGS -pthread"
645 fi
507ca601
FC
646 fi
647 ;;
ec264296
SH
648 openbsd)
649 if test `echo "$squid_host_os_version" | tr -d .` -lt 52 ; then
650 AC_MSG_NOTICE(pthread library requires OpenBSD 5.2 or later)
651 squid_opt_use_diskthreads="no"
652 else
653 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
654 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
655 LDFLAGS="$LDFLAGS -lpthread"
656 fi
657 ;;
507ca601
FC
658 solaris)
659 if test "x$GCC" = "xyes" ; then
660 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
661 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
662 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
663 AC_MSG_NOTICE(pthread library required but cannot be found.)
664 squid_opt_use_diskthreads="no"
665 ])
666 else
667 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
668 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
669 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
670 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
9603207d 671 LIBPTHREADS="" #in LIBS
507ca601
FC
672 ],[
673 AC_MSG_NOTICE(pthread library required but cannot be found.)
674 squid_opt_use_diskthreads="no"
675 ])
676 fi
677 ;;
678 *)
679 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
680 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
681 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
40503c27
FC
682 AC_MSG_NOTICE(pthread library required but cannot be found.)
683 squid_opt_use_diskthreads="no"
684 ])
507ca601
FC
685 ;;
686 esac
687 else
688 AC_MSG_NOTICE([Native pthreads support manually disabled.])
689 squid_opt_use_diskthreads="no"
690 fi
691 if test "x$squid_opt_use_diskthreads" = "xyes" ; then
507ca601 692 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
507ca601 693 DISK_MODULES="$DISK_MODULES DiskThreads"
d9691f09 694 AC_DEFINE([HAVE_DISKIO_MODULE_DISKTHREADS],1,[DiskThreads Disk I/O module is built])
507ca601 695 else
507ca601 696 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
0b163dbb 697 SQUID_STATE_ROLLBACK([diskthreads_state])
fedd516f 698 squid_disk_module_candidates_DiskThreads=no
507ca601
FC
699 fi
700 ;;
2513178d 701
d9691f09 702 IpcIo)
d9691f09 703 if test "x$ac_cv_search_shm_open" = "xno" ; then
fedd516f
AJ
704 AC_MSG_NOTICE([DiskIO IpcIo module requires shared memory support])
705 squid_disk_module_candidates_IpcIo=no
706 else
23ee12fb 707 AC_MSG_NOTICE([Enabling IpcIo DiskIO module])
fedd516f 708 DISK_MODULES="$DISK_MODULES IpcIo"
fedd516f 709 AC_DEFINE([HAVE_DISKIO_MODULE_IPCIO],1,[IpcIo Disk I/O module is built])
507ca601
FC
710 fi
711 ;;
2513178d 712
e2851fe7 713 Mmapped)
e2cbb70e
FC
714 dnl TODO: use availability of sys/mman.h and/or mmap to define
715 dnl OR support windows mmap functions
716 if test "x$squid_host_os" = "xmingw" ; then
717 AC_MSG_NOTICE([Mmapped DiskIO is not available on Mingw])
fedd516f 718 squid_disk_module_candidates_Mmapped=no
e2cbb70e
FC
719 else
720 AC_MSG_NOTICE([Enabling Mmapped DiskIO module])
e2cbb70e 721 DISK_MODULES="$DISK_MODULES Mmapped"
d9691f09 722 AC_DEFINE([HAVE_DISKIO_MODULE_MMAPPED],1,[Mmapped Disk I/O module is built])
e2cbb70e 723 fi
e2851fe7
AR
724 ;;
725
2513178d 726 *)
507ca601 727 AC_MSG_NOTICE([Enabling $module DiskIO module])
d9691f09 728 DISK_LIBS="$DISK_LIBS lib${module}.la"
507ca601 729 DISK_MODULES="$DISK_MODULES ${module}"
507ca601 730 ;;
2513178d
AJ
731 esac
732done
733AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
734AC_SUBST(DISK_MODULES)
735AC_SUBST(DISK_LIBS)
8aafbbc1 736AM_CONDITIONAL(ENABLE_DISKIO_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes")
d9691f09 737AC_SUBST(AIOLIB)
8aafbbc1
AJ
738AM_CONDITIONAL(ENABLE_WIN32_AIO, test "x$squid_disk_module_candidates_AIO" = "xyes" -a "x$ENABLE_WIN32_AIO" = "x1")
739AM_CONDITIONAL(ENABLE_DISKIO_BLOCKING, test "x$squid_disk_module_candidates_Blocking" = "xyes")
740AM_CONDITIONAL(ENABLE_DISKIO_DISKDAEMON, test "x$squid_disk_module_candidates_DiskDaemon" = "xyes")
741AM_CONDITIONAL(ENABLE_DISKIO_DISKTHREADS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes")
d9691f09 742AC_SUBST(LIBPTHREADS)
8aafbbc1
AJ
743AM_CONDITIONAL(ENABLE_WIN32_AIOPS, test "x$squid_disk_module_candidates_DiskThreads" = "xyes" -a "x$ENABLE_WIN32_AIOPS" = "x1")
744AM_CONDITIONAL(ENABLE_DISKIO_IPCIO, test "x$squid_disk_module_candidates_IpcIo" = "xyes")
745AM_CONDITIONAL(ENABLE_DISKIO_MMAPPED, test "x$squid_disk_module_candidates_Mmapped" = "xyes")
2513178d
AJ
746
747dnl Check what Storage formats are wanted.
748dnl This version will error out with a message saying why if a required DiskIO is missing.
dc299f29 749squid_opt_enable_storeio=auto
d235bc84
FC
750AC_ARG_ENABLE([storeio],
751 AS_HELP_STRING([--enable-storeio="list of modules"],
752 [Build support for the list of store I/O modules.
18cc92fb
FC
753 The default is only to build the "ufs" module.
754 See src/fs for a list of available modules, or
755 Programmers Guide section <not yet written>
507ca601
FC
756 for details on how to build your custom store module]), [
757case $enableval in
cd748f27 758 yes)
dc299f29 759 squid_opt_enable_storeio=auto
507ca601 760 ;;
cd748f27 761 no)
dc299f29 762 squid_opt_enable_storeio=no
507ca601 763 ;;
1c690e30 764 *)
dc299f29 765 squid_opt_enable_storeio=yes
507ca601 766 squid_storeio_module_candidates="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
80f756db 767 # ufs is really always needed as it has low-level routines
be0c7ff0 768 # if it is a dupe it will be cleaned-up later
80f756db 769 squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
507ca601 770 ;;
cd748f27 771 esac
cd748f27 772])
fcabe077 773if test "x$squid_opt_enable_storeio" = "xauto"; then
dc299f29 774 squid_opt_enable_storeio=yes
d235bc84
FC
775 AC_MSG_CHECKING([for available StoreIO modules])
776 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
777 AC_MSG_RESULT([$squid_storeio_module_candidates])
778fi
779
dc299f29
FC
780SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
781SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
782AC_MSG_NOTICE([Store modules built: $squid_storeio_module_candidates])
783
784for fs in $squid_storeio_module_candidates none; do
507ca601 785 case "$fs" in
8154dd82 786 diskd)
507ca601 787 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
80f756db 788 "$squid_disk_module_candidates_DiskDaemon" != "yes" ; then
507ca601
FC
789 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
790 fi
791 ;;
8154dd82 792 aufs)
507ca601 793 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
80f756db 794 "$squid_disk_module_candidates_DiskThreads" != "yes" ; then
507ca601
FC
795 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
796 fi
797 ;;
e2851fe7 798 rock)
b5b88fb5
MM
799 if test "x$squid_disk_module_candidates_IpcIo" != "xyes" -a \
800 "x$squid_disk_module_candidates_Blocking" != "xyes"; then
801 AC_MSG_ERROR([Storage module Rock requires DiskIO module: Blocking or IpcIo])
802 fi
803 squid_do_build_rock=true
804 ;;
d3b3ab85 805 ufs)
b5b88fb5
MM
806 if test "x$squid_disk_module_candidates_Blocking" != "xyes"; then
807 AC_MSG_ERROR([Storage module ufs requires DiskIO module: Blocking])
808 fi
809 squid_do_build_ufs=true
810 ;;
8154dd82 811 esac
a2794549 812done
23ee12fb 813
8aafbbc1
AJ
814AM_CONDITIONAL(ENABLE_FS_UFS, test "x$squid_do_build_ufs" = "xtrue")
815AM_CONDITIONAL(ENABLE_FS_ROCK, test "x$squid_do_build_rock" = "xtrue")
9d6186b1
FC
816dnl hack: need to define those even if not used in the build system to
817dnl make sure that global FS objects are linked to the squid binary.
7b5b7ba8
CT
818AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
819AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
820AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
e2851fe7 821AH_TEMPLATE(HAVE_FS_ROCK, "Define to 1 if rock filesystem module is build")
7b5b7ba8
CT
822
823
dc299f29 824dnl got final squid_storeio_module_candidates, build library lists
b66455ff
AR
825dnl This list will not be needed when each fs library has its own Makefile
826STORE_LIBS_TO_BUILD=
827dnl File system libraries to link executables with.
828dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
829STORE_LIBS_TO_ADD=
dc299f29 830for fs in $squid_storeio_module_candidates; do
7b5b7ba8
CT
831 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
832 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
6d1c1ab1
FC
833 SQUID_TOUPPER_VAR_CONTENTS([fs])
834 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
b66455ff
AR
835done
836
837AC_SUBST(STORE_LIBS_TO_BUILD)
838AC_SUBST(STORE_LIBS_TO_ADD)
082a5e7a 839AC_SUBST(STORE_TESTS)
a2794549 840
24a04df9
AJ
841
842dnl At lest one removal policy is always needed.
843dnl 'lru' removal policy is currently hard-coded by name for tests
844dnl so we must set it as default.
845REPL_POLICIES="lru"
d9180414 846AC_ARG_ENABLE(removal-policies,
56ffc413
FC
847 AS_HELP_STRING([--enable-removal-policies="list of policies"],
848 [Build support for the list of removal policies.
18cc92fb
FC
849 The default is only to build the "lru" module.
850 See src/repl for a list of available modules, or
851 Programmers Guide section 9.9 for details on how
507ca601
FC
852 to build your custom policy]), [
853case $enableval in
6a566b9c 854 yes)
5069fb38 855 SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES])
507ca601 856 ;;
6a566b9c 857 no)
507ca601 858 ;;
1c690e30 859 *)
507ca601
FC
860 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
861 ;;
6a566b9c 862 esac
6a566b9c 863])
fcabe077 864if test "x$REPL_POLICIES" != "x" ; then
56ffc413 865 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
5069fb38 866 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
1c690e30 867 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
868 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
869fi
6a566b9c 870AC_SUBST(REPL_POLICIES)
6a566b9c 871AC_SUBST(REPL_OBJS)
f71946fc 872AC_SUBST(REPL_LIBS)
6a566b9c 873
d1da2d1f 874AM_CONDITIONAL(ENABLE_PINGER, false)
e5f4e1b0 875AC_ARG_ENABLE(icmp,
62979ab1 876 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),
fcabe077 877[ if test "x$enableval" = "xyes" ; then
eed82608 878 AC_MSG_NOTICE([ICMP enabled])
be0c7ff0 879 AC_DEFINE(USE_ICMP,1,[Define to use Squid ICMP and Network Measurement features (highly recommended!)])
d1da2d1f 880 AM_CONDITIONAL(ENABLE_PINGER, true)
e5f4e1b0 881 fi
882])
883
9a0a18de 884AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
d9180414 885AC_ARG_ENABLE(delay-pools,
62979ab1 886 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),
fcabe077 887[ if test "x$enableval" = "xyes" ; then
eed82608 888 AC_MSG_NOTICE([Delay pools enabled])
9a0a18de 889 AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
ffe4ffd8 890 AM_CONDITIONAL(ENABLE_DELAY_POOLS, true)
e5f4e1b0 891 fi
892])
893
5fa840c3 894dnl disable generic/common adaptation support by default
5069fb38 895squid_opt_use_adaptation=no
5fa840c3 896
799b66d1
AJ
897squid_opt_use_esi=auto
898AH_TEMPLATE([USE_SQUID_ESI],[Define to enable the ESI processor])
43ae1d95 899AC_ARG_ENABLE(esi,
799b66d1
AJ
900 AS_HELP_STRING([--disable-esi],
901 [Disable ESI for accelerators. ESI requires expat or libxml2.
7eb77a5f 902 Enabling ESI will cause squid reverse proxies to be capable
5069fb38 903 of the Edge Acceleration Specification (www.esi.org).]),
799b66d1 904 [squid_opt_use_esi=$enableval],[])
88bfe098
AJ
905HAVE_LIBEXPAT=0
906EXPATLIB=
907HAVE_LIBXML2=0
908XMLLIB=
88bfe098 909
7eb77a5f 910# ESI support libraries: expat
24531401 911SQUID_AUTO_LIB(expat,[ESI expat],[LIBEXPAT])
799b66d1 912if test "x$squid_opt_use_esi" != "xno" -a "x$with_expat" != "xno" ; then
7eb77a5f
FC
913 AC_CHECK_LIB([expat], [main], [EXPATLIB="-lexpat"; HAVE_LIBEXPAT=1])
914 AC_CHECK_HEADERS([expat.h])
915 AC_DEFINE_UNQUOTED(HAVE_LIBEXPAT, $HAVE_LIBEXPAT, [Define to 1 if you have the expat library])
799b66d1
AJ
916 AS_IF(test "x$HAVE_LIBEXPAT" = "x1",[
917 squid_opt_use_esi=yes
918 ],[
919 AS_IF(test "x$with_expat" = "xyes",[
920 AC_MSG_ERROR([Required library expat not found.])
921 ],[
922 AC_MSG_NOTICE([Library expat not found.])
923 ])
924 ])
7eb77a5f 925fi
ad32c661 926
24531401
AJ
927# TODO: remove this 'lib' prefix to match coding standard
928SQUID_AUTO_LIB(libxml2,[ESI libxml2],[LIBXML2])
799b66d1 929if test "x$squid_opt_use_esi" != "xno" -a "x$with_libxml2" != "xno" ; then
8fa07024
FF
930 SQUID_STATE_SAVE([squid_libxml2_save])
931 PKG_CHECK_MODULES([LIBXML2],[libxml-2.0],[],[
932 AC_CHECK_LIB([xml2], [main], [LIBXML2_LIBS="$LIBXML2_LIBS -lxml2"])
933 dnl Find the main header and include path...
934 AC_CACHE_CHECK([location of libxml2 include files], [ac_cv_libxml2_include], [
935 AC_CHECK_HEADERS([libxml/parser.h], [], [
936 AC_MSG_NOTICE([Testing in /usr/include/libxml2])
937 SAVED_CPPFLAGS="$CPPFLAGS"
938 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
0dc1a86a 939 unset ac_cv_header_libxml_parser_h
8fa07024
FF
940 AC_CHECK_HEADERS([libxml/parser.h], [LIBXML2_CFLAGS="$LIBXML2_CFLAGS -I/usr/include/libxml2"], [
941 AC_MSG_NOTICE([Testing in /usr/local/include/libxml2])
942 CPPFLAGS="-I/usr/local/include/libxml2 $SAVED_CPPFLAGS"
943 unset ac_cv_header_libxml_parser_h
944 AC_CHECK_HEADERS([libxml/parser.h], [LIBXML2_CFLAGS="$LIBXML2_CFLAGS -I/usr/local/include/libxml2"], [
945 AC_MSG_NOTICE([Failed to find libxml2 header file libxml/parser.h])
946 ])
0dc1a86a 947 ])
8fa07024 948 CPPFLAGS="$SAVED_CPPFLAGS"
7eb77a5f 949 ])
0dc1a86a
HN
950 ])
951 ])
8fa07024 952 CPPFLAGS="$CPPFLAGS $LIBXML2_CFLAGS"
0dc1a86a
HN
953 dnl Now that we know where to look find the headers...
954 AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
8fa07024
FF
955 SQUID_STATE_ROLLBACK([squid_libxml2_save])
956
957 if test "x$LIBXML2_LIBS" != "x"; then
958 HAVE_LIBXML2=1
799b66d1 959 squid_opt_use_esi=yes
8fa07024
FF
960 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $LIBXML2_CFLAGS"
961 CPPFLAGS="$CPPFLAGS $LIBXML2_CFLAGS"
962 XMLLIB="$LIBXML2_LIBS"
963 AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
964 elif test "x$with_libxml2" = "xyes"; then
965 AC_MSG_ERROR([Required library libxml2 not found])
966 else
967 AC_MSG_NOTICE([Library libxml2 not found.])
968 fi
43ae1d95 969fi
7eb77a5f 970
799b66d1
AJ
971AS_IF([test "x$squid_opt_use_esi" = "xyes"],[
972 AS_IF(test "x$HAVE_LIBXML2" = "x0" -a "x$HAVE_LIBEXPAT" = "x0",[
973 AC_MSG_ERROR([ESI processor requires libxml2 or libexpat])
974 ])
975 AC_MSG_NOTICE([Enabling ESI processor: $EXPATLIB $XMLLIB])
976 AC_DEFINE(USE_SQUID_ESI,1,[Compile the ESI processor])
977],[
978 AS_IF(test "x$squid_opt_use_esi" = "xno",[
979 AC_MSG_NOTICE([Disabling ESI processor.])
980 ],[
981 AC_MSG_NOTICE([Disabling ESI processor. libxml2 and libexpat not found.])
982 ])
983])
8aafbbc1 984AM_CONDITIONAL(ENABLE_ESI, test "x$squid_opt_use_esi" = "xyes")
799b66d1 985AM_CONDITIONAL(ENABLE_LIBEXPAT, test "x$HAVE_LIBEXPAT" = "x1")
88bfe098 986AC_SUBST(EXPATLIB)
799b66d1 987AM_CONDITIONAL(ENABLE_LIBXML2, test "x$HAVE_LIBXML2" = "x1")
88bfe098 988AC_SUBST(XMLLIB)
43ae1d95 989
8075a4da 990# icap argument handling
51952383 991AC_ARG_ENABLE(icap-client,
4f07726a
AJ
992 AS_HELP_STRING([--disable-icap-client],[Disable the ICAP client.]),[
993 SQUID_YESNO([$enableval],[Unrecognized argument to --disable-icap-client: $enableval])
994])
995SQUID_DEFINE_BOOL(ICAP_CLIENT,${enable_icap_client:=yes}, [Enable ICAP client features in Squid])
ebf76e07 996AS_IF(test "x$enable_icap_client" != "xno", squid_opt_use_adaptation="yes")
8aafbbc1 997AM_CONDITIONAL(ENABLE_ICAP_CLIENT, test "x$enable_icap_client" != "xno")
51952383 998
5069fb38 999squid_opt_use_ecap=1
3e7b6055
AR
1000AC_MSG_CHECKING(whether to support eCAP)
1001AC_ARG_ENABLE(ecap,
8075a4da
FC
1002 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]), [
1003 case "${enableval}" in
1004 yes|no) squid_opt_use_ecap=$enableval ;;
1005 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
1006 esac
1007AC_MSG_RESULT([$squid_opt_use_ecap, explicitly])
1008 ], [
5069fb38
FC
1009 squid_opt_use_ecap=no;
1010 AC_MSG_RESULT([$squid_opt_use_ecap, implicitly])
3e7b6055
AR
1011 ]
1012)
1013
1014dnl Perform configuration consistency checks for eCAP
cbc14831 1015if test "x$squid_opt_use_ecap" != "xno";
3e7b6055 1016then
cbc14831 1017 dnl eCAP support requires loadable modules, which are enabled by default
5a2409b7 1018 if test "x$enable_shared" != "xyes"
cbc14831 1019 then
5a2409b7 1020 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-shared with --enable-ecap.])
cbc14831 1021 fi
4cfba571 1022
cbc14831 1023 if test -n "$PKG_CONFIG"; then
6666da11 1024 dnl eCAP support requires libecap.
0a720258 1025 dnl This Squid supports libecap v1.0.x.
3e115aaf
AR
1026 dnl Use EXT_ prefix to distinguish external libecap (that we check for
1027 dnl here) from our own convenience ecap library in Makefiles.
0a720258 1028 PKG_CHECK_MODULES([EXT_LIBECAP],[libecap >= 1.0 libecap < 1.1])
cbc14831
AJ
1029 else
1030 AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
1031 fi
3e7b6055 1032
ebf76e07
AJ
1033 SQUID_STATE_SAVE(squid_ecap_state)
1034 AC_MSG_CHECKING([whether -lecap will link])
a023fd8e
AJ
1035 CXXFLAGS="$CXXFLAGS $EXT_LIBECAP_CFLAGS"
1036 LIBS="$LIBS $EXT_LIBECAP_LIBS"
ebf76e07
AJ
1037 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <libecap/common/names.h>]],[[
1038 const libecap::Name test("test", libecap::Name::NextId());
1039 ]])],[
1040 AC_MSG_RESULT(yes)
5069fb38 1041 squid_opt_use_adaptation=yes
ebf76e07
AJ
1042 ],[
1043 AC_MSG_RESULT(no)
1044 AS_IF(
1045 test "x$squid_opt_use_ecap" = "xyes", AC_MSG_ERROR([eCAP library will not link.
1046 You may need to rebuild libecap using the same version of GCC as Squid.
1047 There have been breaking ABI changes in the libstdc++ STL with GCC 5.]),
1048
1049 [AC_MSG_NOTICE([eCAP library will not link.
1050 You may need to rebuild libecap using the same version of GCC as Squid.
1051 There have been breaking ABI changes in the libstdc++ STL with GCC 5.])
1052 squid_opt_use_ecap="no"
1053 ])
1054 ])
1055 SQUID_STATE_ROLLBACK(squid_ecap_state)
3e7b6055 1056fi
b65a2365 1057SQUID_DEFINE_BOOL(USE_ECAP,${squid_opt_use_ecap:=no},[Whether to use eCAP support])
8aafbbc1 1058AM_CONDITIONAL(ENABLE_ECAP, test "x$squid_opt_use_ecap" = "xyes")
3e7b6055 1059
5fa840c3 1060dnl enable adaptation if requested by specific adaptation mechanisms
8aafbbc1
AJ
1061ADAPTATION_LIBS=""
1062if test "x$squid_opt_use_adaptation" = "xyes"; then
5fa840c3 1063 ADAPTATION_LIBS="adaptation/libadaptation.la"
51952383 1064fi
8aafbbc1
AJ
1065SQUID_DEFINE_BOOL(USE_ADAPTATION,${squid_opt_use_adaptation:=no}, [common adaptation support])
1066AM_CONDITIONAL(ENABLE_ADAPTATION, test "x$squid_opt_use_adaptation" = "xyes")
5fa840c3 1067AC_SUBST(ADAPTATION_LIBS)
3e7b6055 1068
1d3aafe4 1069test "x$squid_host_os" = "xmingw" && enable_wccp=no
5069fb38 1070AC_ARG_ENABLE(wccp,
8075a4da 1071 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]), [
1a6b111a 1072SQUID_YESNO([$enableval],[unrecognized argument to --disable-wccp: $enableval])
5069fb38 1073])
0067eb06 1074SQUID_DEFINE_BOOL(USE_WCCP, ${enable_wccp:=yes}, [Define to enable WCCP])
1a6b111a 1075AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $enable_wccp])
0b0cfcf2 1076
1d3aafe4 1077test "x$squid_host_os" = "xmingw" && enable_wccpv2=no
0b0cfcf2 1078AC_ARG_ENABLE(wccpv2,
1a6b111a 1079 AS_HELP_STRING([--disable-wccpv2],
9603207d 1080 [Disable Web Cache Coordination V2 Protocol]), [
1a6b111a
FC
1081SQUID_YESNO([$enableval],
1082 [unrecognized argument to --disable-wccpv2: $enableval])
0b0cfcf2 1083])
0067eb06 1084SQUID_DEFINE_BOOL(USE_WCCPv2,${enable_wccpv2:=yes},
1a6b111a
FC
1085 [Define to enable WCCP V2])
1086AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $enable_wccpv2])
320e9f36 1087
d9180414 1088AC_ARG_ENABLE(kill-parent-hack,
9603207d 1089 AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]), [
1a6b111a
FC
1090SQUID_YESNO([$enableval],
1091 [unrecognized argument to --enable-kill-parent-hack: $enableval])
e5f4e1b0 1092])
0067eb06 1093SQUID_DEFINE_BOOL(KILL_PARENT_OPT,${enable_kill_parent_hack:=no},
9603207d 1094 [A dangerous feature which causes Squid to kill its parent
1095 process (presumably the RunCache script) upon receipt
1a6b111a
FC
1096 of SIGTERM or SIGINT. Deprecated, Use with caution.])
1097AC_MSG_NOTICE([Kill parent on shutdown hack enabled: $enable_kill_parent_hack])
20ad76ab 1098
e5f4e1b0 1099AC_ARG_ENABLE(snmp,
1d87b6b3 1100 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
1a6b111a
FC
1101 SQUID_YESNO([$enableval],
1102 [unrecognized argument to --disable-snmp: $enableval])
87630341 1103])
0067eb06 1104SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes},
1a6b111a 1105 [Define to enable SNMP monitoring of Squid])
f738d783 1106AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
fcabe077 1107if test "x$enable_snmp" = "xyes"; then
4de1e2da 1108 SNMPLIB='../lib/snmplib/libsnmplib.la'
87630341 1109fi
1a6b111a 1110AC_MSG_NOTICE([SNMP support enabled: $enable_snmp])
e5f4e1b0 1111AC_SUBST(SNMPLIB)
e5f4e1b0 1112
d9180414 1113AC_ARG_ENABLE(cachemgr-hostname,
5069fb38
FC
1114 AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
1115 [Make cachemgr.cgi default to this host.
1d87b6b3
FC
1116 If unspecified, uses the name of the build-host]), [
1117 case $enableval in
1118 yes)
1119 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1120 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
1121 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
1122 ;;
1123 no)
1124 : # Nothing to do..
1125 ;;
1126 *)
1127 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
1128 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
1129 ;;
1130 esac
e5f4e1b0 1131])
1132
ee0927b6 1133AC_ARG_ENABLE(eui,
1a6b111a 1134 AS_HELP_STRING([--disable-eui],
c8da66ba 1135 [Disable use of ARP / MAC/ EUI (ether address)]), [
1a6b111a
FC
1136SQUID_YESNO([$enableval],[--disable-eui expects no arguments])
1137])
fcabe077 1138if test "x${enable_eui:=yes}" = "xyes" ; then
195ec847
AJ
1139 SQUID_STATE_SAVE(LIBEUI)
1140 # GLIBC 2.30 deprecates sysctl.h. Test with the same flags that (may) break includes later.
1141 CFLAGS=$SQUID_CFLAGS
1142 CXXFLAGS=$SQUID_CXXFLAGS
507ca601 1143 case "$squid_host_os" in
a396d1f8 1144 linux|solaris|freebsd|openbsd|netbsd|cygwin)
507ca601
FC
1145 ${TRUE}
1146 ;;
a396d1f8 1147 mingw)
507ca601
FC
1148 EUILIB="-liphlpapi"
1149 ;;
1150 *)
1151 AC_MSG_WARN([EUI support probably will not work on host $host.])
1152 ;;
1153 esac
b966288b 1154 # iphlpapi.h check delayed after winsock2.h
507ca601 1155 AC_CHECK_HEADERS( \
32341684 1156 windows.h \
507ca601 1157 sys/sockio.h \
32341684
AJ
1158 sys/param.h,
1159 [], [], [[
1160#if HAVE_WINDOWS_H
1161include <windows.h>
54d47324 1162#endif
32341684 1163]]
507ca601 1164 )
29759678
FC
1165 AC_CHECK_HEADERS( \
1166 net/if_arp.h \
9603207d 1167 net/route.h,
29759678
FC
1168 [], [], [[
1169#include <sys/types.h>
1170#include <sys/socket.h>
1171]])
1172
43c1320a
AJ
1173 # OpenBSD, FreeBSD and NetBSD requires sys/param.h to be included before sysctl.h and net/if_dl.h
1174 AC_CHECK_HEADERS( \
1175 net/if_dl.h \
1176 sys/sysctl.h,
1177 [], [], [[
54d47324 1178#if HAVE_SYS_PARAM_H
29759678
FC
1179#include <sys/param.h>
1180#endif
1181 ]])
195ec847 1182 SQUID_STATE_ROLLBACK(LIBEUI)
a98c2da5 1183fi
2ef664d8 1184AC_SUBST(EUILIB)
1a6b111a 1185AC_MSG_NOTICE([EUI (MAC address) controls enabled: $enable_eui])
0067eb06 1186SQUID_DEFINE_BOOL(USE_SQUID_EUI,$enable_eui,
1a6b111a 1187 [Define this to include code which lets you use ethernet addresses. This code uses API initially defined in 4.4-BSD.])
8aafbbc1 1188AM_CONDITIONAL(ENABLE_EUI, [test "x$enable_eui" = "xyes" ])
1a6b111a 1189
e5f4e1b0 1190
74075210 1191AC_ARG_ENABLE(htcp,
47d80734 1192 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]), [
1a6b111a
FC
1193SQUID_YESNO([$enableval],
1194 [unrecognized argument to --disable-htcp: $enableval])
74075210 1195])
0f658b5b 1196SQUID_DEFINE_BOOL(USE_HTCP,${enable_htcp:=yes},
47d80734 1197 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
fcabe077 1198AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
1a6b111a
FC
1199AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
1200
09cd7204 1201# Cryptograhic libraries
24531401 1202SQUID_AUTO_LIB(nettle,[Nettle crypto],[LIBNETTLE])
09cd7204 1203if test "x$with_nettle" != "xno" ; then
24531401 1204 CPPFLAGS="$LIBNETTLE_CFLAGS $CPPFLAGS"
09cd7204 1205 AC_CHECK_LIB(nettle, nettle_md5_init,[
24531401 1206 NETTLELIB="$LIBNETTLE_PATH -lnettle"
f9ef3ed8 1207 AC_CHECK_HEADERS(nettle/md5.h)
09cd7204 1208 ],[with_nettle=no])
f9ef3ed8 1209 if test "x$with_nettle" != "xno" ; then
1d11e9b3 1210 # Base64 uses the nettle 3.4 API
f9ef3ed8
AJ
1211 # which matters on 64-bit systems
1212 AC_CHECK_HEADERS(nettle/base64.h)
1d11e9b3 1213 AC_MSG_CHECKING([for Nettle 3.4 API compatibility])
f9ef3ed8
AJ
1214 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1215# include <cstddef>
1216# include <cstdint>
1217# include <nettle/base64.h>
1218 ]],[[
1d11e9b3 1219 char inData[10]; inData[0] = '\0';
f9ef3ed8
AJ
1220 size_t srcLen = 0;
1221 struct base64_decode_ctx ctx;
1222 base64_decode_init(&ctx);
1223 uint8_t outData[10];
1224 size_t dstLen = 0;
1225 if (!base64_decode_update(&ctx, &dstLen, outData, srcLen, inData) ||
1226 !base64_decode_final(&ctx)) {
1227 return 1;
1228 }
1229 ]])],[AC_MSG_RESULT(yes)
1d11e9b3 1230 AC_DEFINE(HAVE_NETTLE34_BASE64,1,[set to 1 if Nettle 3.4 API will link])
f9ef3ed8
AJ
1231 ],[AC_MSG_RESULT(no)])
1232 fi
a9dfcab8 1233fi
09cd7204
AJ
1234AC_MSG_NOTICE([Using Nettle cryptographic library: ${with_nettle:=yes}])
1235AC_SUBST(NETTLELIB)
a9dfcab8 1236
e59a64d7
AJ
1237dnl Check for libcrypt
1238CRYPTLIB=
1239dnl Some of our helpers use crypt(3) which may be in libc, or in
1240dnl libcrypt (eg FreeBSD)
1241AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
1242dnl Solaris10 provides MD5 natively through libmd5
1243AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
1244AC_SUBST(CRYPTLIB)
1245
b4f805f6
AJ
1246SSLLIB=""
1247
24531401 1248SQUID_AUTO_LIB(gnutls,[GnuTLS crypto],[LIBGNUTLS])
b4f805f6
AJ
1249AH_TEMPLATE(USE_GNUTLS,[GnuTLS support is available])
1250if test "x$with_gnutls" != "xno"; then
7c760558 1251 SQUID_STATE_SAVE(squid_gnutls_state)
b4f805f6
AJ
1252
1253 # User may have provided a custom location for GnuTLS. Otherwise...
24531401 1254 CPPFLAGS="$LIBGNUTLS_CFLAGS $CPPFLAGS"
b4f805f6
AJ
1255 LIBS="$LIBS $LIBGNUTLS_PATH"
1256
1257 # auto-detect using pkg-config
516ec633 1258 PKG_CHECK_MODULES([LIBGNUTLS],[gnutls >= 3.4.0],[
7c760558
FC
1259 CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
1260 ],[
b4f805f6 1261 ## find the package without pkg-config
c113986e 1262 ## check that the library is actually new enough.
516ec633
AJ
1263 ## by testing for a 3.4.0+ function which we use
1264 AC_CHECK_LIB(gnutls,gnutls_pcert_export_x509,[LIBGNUTLS_LIBS="-lgnutls"])
b4f805f6 1265 ])
51e09c08 1266 AC_CHECK_HEADERS(gnutls/gnutls.h gnutls/x509.h gnutls/abstract.h)
b4f805f6
AJ
1267
1268 SQUID_STATE_ROLLBACK(squid_gnutls_state) #de-pollute LIBS
1269
1270 if test "x$with_gnutls" = "xyes" -a "x$LIBGNUTLS_LIBS" = "x"; then
1271 AC_MSG_ERROR([Required GnuTLS library not found])
1272 fi
1273 if test "x$LIBGNUTLS_LIBS" != "x" ; then
1274 CXXFLAGS="$LIBGNUTLS_CFLAGS $CXXFLAGS"
1275 SSLLIB="$LIBGNUTLS_PATH $LIBGNUTLS_LIBS $SSLLIB"
1276 AC_DEFINE(USE_GNUTLS,1,[GnuTLS support is available])
1277 else
1278 with_gnutls=no
1279 fi
1280fi
1281AC_MSG_NOTICE([GnuTLS library support: ${with_gnutls:=auto} ${LIBGNUTLS_PATH} ${LIBGNUTLS_LIBS}])
1282
3d4022fa 1283dnl User may specify OpenSSL is needed from a non-standard location
24531401 1284SQUID_OPTIONAL_LIB(openssl,[OpenSSL],[LIBOPENSSL])
cb4f4424 1285AH_TEMPLATE(USE_OPENSSL,[OpenSSL support is available])
c41db002
AJ
1286## OpenSSL is default disable due to licensing issues on some OS
1287if test "x$with_openssl" = "xyes"; then
24531401 1288 CPPFLAGS="$LIBOPENSSL_CFLAGS $CPPFLAGS"
c41db002 1289 AC_CHECK_HEADERS( \
24b30fdc 1290 openssl/asn1.h \
8693472e 1291 openssl/bio.h \
24b30fdc 1292 openssl/bn.h \
eacc1666 1293 openssl/crypto.h \
742236c7 1294 openssl/decoder.h \
24b30fdc 1295 openssl/dh.h \
c41db002 1296 openssl/err.h \
24b30fdc
EQ
1297 openssl/evp.h \
1298 openssl/lhash.h \
c41db002
AJ
1299 openssl/md5.h \
1300 openssl/opensslv.h \
24b30fdc 1301 openssl/rsa.h \
c41db002 1302 openssl/ssl.h \
24b30fdc 1303 openssl/x509.h \
c41db002
AJ
1304 openssl/x509v3.h \
1305 openssl/engine.h \
1306 openssl/txt_db.h \
1307 )
1308
e0b98074 1309 # User may have provided a custom location for OpenSSL. Otherwise...
84c3fc14
AJ
1310 SQUID_STATE_SAVE(squid_openssl_state)
1311 LIBS="$LIBS $LIBOPENSSL_PATH"
1312
1313 # auto-detect using pkg-config
1314 PKG_CHECK_MODULES([LIBOPENSSL],[openssl],,[
1315 ## For some OS pkg-config is broken or unavailable.
1316 ## Detect libraries the hard way.
1317
1318 # Windows MinGW has some special libraries ...
1319 if test "x$squid_host_os" = "xmingw" ; then
1320 LIBOPENSSL_LIBS='-lssleay32 -leay32 -lgdi32 $LIBOPENSSL_LIBS'
1321 AC_MSG_NOTICE([Windows OpenSSL library support: yes -lssleay32 -leay32 -lgdi32])
1322 fi
e0b98074 1323
84c3fc14
AJ
1324 AC_CHECK_LIB(crypto,[CRYPTO_new_ex_data],[LIBOPENSSL_LIBS="-lcrypto $LIBOPENSSL_LIBS"],[
1325 AC_MSG_ERROR([library 'crypto' is required for OpenSSL])
37a20074 1326 ],$LIBOPENSSL_LIBS)
403c4682 1327 AC_CHECK_LIB(ssl,[SSL_CTX_new],[LIBOPENSSL_LIBS="-lssl $LIBOPENSSL_LIBS"],[
84c3fc14 1328 AC_MSG_ERROR([library 'ssl' is required for OpenSSL])
37a20074 1329 ],$LIBOPENSSL_LIBS)
84c3fc14 1330 ])
e0b98074 1331
84c3fc14
AJ
1332 # This is a workaround for RedHat 9 brain damage..
1333 if test -d /usr/kerberos/include -a -f /usr/include/openssl/kssl.h; then
1334 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
1335 LIBOPENSSL_LIBS="-L/usr/kerberos/lib $LIBOPENSSL_LIBS"
1336 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
f11555e0 1337 fi
84c3fc14 1338 SQUID_STATE_ROLLBACK(squid_openssl_state) #de-pollute LIBS
1f7c9178 1339
e0b98074 1340 if test "x$LIBOPENSSL_LIBS" != "x"; then
c41db002 1341 CXXFLAGS="$LIBOPENSSL_CFLAGS $CXXFLAGS"
84c3fc14 1342 SSLLIB="$LIBOPENSSL_PATH $LIBOPENSSL_LIBS $SSLLIB"
cb4f4424 1343 AC_DEFINE(USE_OPENSSL,1,[OpenSSL support is available])
c41db002 1344
b8649ee4 1345 # check for API functions
17e98f24
AJ
1346 SQUID_CHECK_LIBCRYPTO_API
1347 SQUID_CHECK_LIBSSL_API
8d56fe55 1348 SQUID_CHECK_OPENSSL_TLS_METHODS
b8649ee4
CT
1349 SQUID_STATE_SAVE(check_SSL_CTX_get0_certificate)
1350 LIBS="$LIBS $SSLLIB"
1351 AC_CHECK_LIB(ssl, SSL_CTX_get0_certificate, [
1352 AC_DEFINE(HAVE_SSL_CTX_GET0_CERTIFICATE, 1, [SSL_CTX_get0_certificate is available])
1353 ], [
1354 missing_SSL_CTX_get0_certificate=yes
1355 ])
1356 SQUID_STATE_ROLLBACK(check_SSL_CTX_get0_certificate)
1357
c41db002 1358 # check for other specific broken implementations
b8649ee4
CT
1359 if test "x$missing_SSL_CTX_get0_certificate" = "xyes"; then
1360 SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS
1361 fi
c41db002 1362 SQUID_CHECK_OPENSSL_CONST_SSL_METHOD
7d841344
AJ
1363 SQUID_CHECK_OPENSSL_CONST_CRYPTO_EX_DATA
1364 SQUID_CHECK_OPENSSL_CONST_SSL_SESSION_CB_ARG
70cfe22f 1365 SQUID_CHECK_OPENSSL_CONST_X509_GET0_SIGNATURE_ARGS
c41db002 1366 SQUID_CHECK_OPENSSL_TXTDB
1f7c9178 1367 fi
e0b98074
AJ
1368 if test "x$SSLLIB" = "x"; then
1369 AC_MSG_ERROR([Required OpenSSL library not found])
f11555e0 1370 fi
1f7c9178 1371fi
84c3fc14 1372AC_MSG_NOTICE([OpenSSL library support: ${with_openssl:=no} ${LIBOPENSSL_PATH} ${LIBOPENSSL_LIBS}])
c41db002 1373AM_CONDITIONAL(ENABLE_SSL,[ test "x$with_openssl" = "xyes" ])
1f7c9178 1374AC_SUBST(SSLLIB)
1375
1a22a39e 1376dnl User may specify MIT Kerberos is needed from a non-standard location
24531401 1377SQUID_AUTO_LIB(mit-krb5,[MIT Kerberos],[LIB_KRB5])
75f3c557 1378AH_TEMPLATE(USE_APPLE_KRB5,[Apple Kerberos support is available])
1a22a39e
MM
1379AH_TEMPLATE(USE_MIT_KRB5,[MIT Kerberos support is available])
1380AH_TEMPLATE(USE_SOLARIS_KRB5,[Solaris Kerberos support is available])
1381
75c5f82b
AJ
1382## find out if pkg-config or krb5-config will work
1383if test "x$with_mit_krb5" != "xno"; then
24531401
AJ
1384 CXXFLAGS="$LIB_KRB5_CFLAGS $CXXFLAGS"
1385 krb5confpath="$with_mit_krb5/bin"
1a22a39e 1386 # find installed libs via pkg-config or krb5-config
75c5f82b 1387 squid_pc_krb5_name=
7c664dbc
AJ
1388 PKG_CHECK_EXISTS(mit-krb5-gssapi mit-krb5, [squid_pc_krb5_name="mit-krb5-gssapi mit-krb5"],[
1389 PKG_CHECK_EXISTS(gssapi-krb5 krb5, [squid_pc_krb5_name="gssapi-krb5 krb5"])
1390 ])
75c5f82b 1391 if test "x$squid_pc_krb5_name" = "x" -a "$cross_compiling" = "no"; then
77f4953d 1392 # Look for krb5-config (unless cross-compiling)
c4b12583 1393 AC_PATH_PROG(krb5_config,krb5-config,no,$krb5confpath)
1a22a39e
MM
1394 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1395 krb5confpath="`dirname $ac_cv_path_krb5_config`"
1396 ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
1397 ac_solaris="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i solaris`"
75f3c557 1398 ac_apple="`$ac_cv_path_krb5_config --vendor 2>/dev/null | grep -c -i apple`"
1a22a39e
MM
1399 if test $ac_solaris -gt 0 ; then
1400 with_solaris_krb5=yes
75c5f82b 1401 elif test $ac_apple -gt 0 ; then
75f3c557 1402 with_apple_krb5=yes
75c5f82b
AJ
1403 elif test $ac_heimdal -gt 0; then
1404 with_mit_krb5=no
1405 if test "x$with_mit_krb5" = "xyes"; then
1406 AC_MSG_ERROR([Could not find pkg-config or krb5-config for MIT Kerberos])
1407 fi
1a22a39e
MM
1408 fi
1409 else
75c5f82b
AJ
1410 if test "x$with_mit_krb5" = "xyes"; then
1411 AC_MSG_ERROR([Could not find krb5-config in path])
1412 else
1413 with_mit_krb5=no
1414 fi
1a22a39e
MM
1415 fi
1416 fi
1417fi
1418
ed3a42d0
AJ
1419# detect MIT Kerberos dependencies (except on Solaris)
1420if test "x$with_mit_krb5" != "xno" -a "x$with_solaris_krb5" != "xyes"; then
1a22a39e
MM
1421 SQUID_STATE_SAVE([squid_krb5_save])
1422 LIBS="$LIBS $LIB_KRB5_PATH"
1423
1424 # auto-detect using pkg-config
75c5f82b 1425 PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
77f4953d
AJ
1426 # look for krb5-config (unless cross-compiling)
1427 if test "$cross_compiling" = "no"; then
1428 if test "x$krb5confpath" = "x" ; then
1429 AC_PATH_PROG(krb5_config,krb5-config,no)
1430 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1431 ac_krb5_config="$ac_cv_path_krb5_config"
1432 fi
1433 else
1434 ac_krb5_config="$krb5confpath/krb5-config"
1a22a39e 1435 fi
1a22a39e
MM
1436 fi
1437 if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
1438 # Get libs, etc
1439 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1440 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1441 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1442 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1443 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1444 else
1445 ## For some OS pkg-config is broken or unavailable.
1446 ## Detect libraries the hard way.
1447
b2bdde72 1448 SQUID_STATE_SAVE([squid_mit_save])
ff78f3c3 1449 missing_required=
1a22a39e
MM
1450 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1451 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
ff78f3c3
AJ
1452 AC_MSG_WARN([library 'com_err' is required for MIT Kerberos])
1453 missing_required=yes
1a22a39e 1454 ])
b2bdde72 1455 LIBS=$LIB_KRB5_LIBS
1a22a39e 1456 AC_CHECK_LIB(k5crypto, [main], [LIB_KRB5_LIBS="-lk5crypto $LIB_KRB5_LIBS"],[
ff78f3c3
AJ
1457 AC_MSG_WARN([library 'k5crypto' is required for MIT Kerberos])
1458 missing_required=yes
1a22a39e 1459 ])
b2bdde72 1460 LIBS=$LIB_KRB5_LIBS
1a22a39e 1461 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
ff78f3c3
AJ
1462 AC_MSG_WARN([library 'krb5' is required for MIT Kerberos])
1463 missing_required=yes
1a22a39e 1464 ])
b2bdde72 1465 LIBS=$LIB_KRB5_LIBS
1a22a39e 1466 AC_CHECK_LIB(gssapi_krb5, [main], [LIB_KRB5_LIBS="-lgssapi_krb5 $LIB_KRB5_LIBS"],[
ff78f3c3
AJ
1467 AC_MSG_WARN([library 'gssapi_krb5' is required for MIT Kerberos])
1468 missing_required=yes
1a22a39e 1469 ])
b2bdde72 1470 SQUID_STATE_ROLLBACK([squid_mit_save])
ff78f3c3
AJ
1471 if test "x$missing_required" = "xyes"; then
1472 LIB_KRB5_LIBS=""
1473 fi
1a22a39e 1474 fi
1a22a39e
MM
1475 ])
1476
1477 if test "x$LIB_KRB5_LIBS" != "x"; then
75f3c557
MM
1478 if test "x$with_apple_krb5" = "xyes" ; then
1479 AC_DEFINE(USE_APPLE_KRB5,1,[Apple Kerberos support is available])
9603207d 1480 KRB5_FLAVOUR="Apple"
75f3c557
MM
1481 else
1482 AC_DEFINE(USE_MIT_KRB5,1,[MIT Kerberos support is available])
9603207d 1483 KRB5_FLAVOUR="MIT"
75f3c557 1484 fi
1a22a39e
MM
1485 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1486 KRB5INCS="$LIB_KRB5_CFLAGS"
9603207d 1487
1a22a39e
MM
1488 # check for other specific broken implementations
1489 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1490 LIBS="$LIBS $KRB5LIBS"
1491
1492 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1493 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1494 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
1495 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1496 AC_CHECK_HEADERS(profile.h)
1497
1a22a39e 1498 SQUID_CHECK_KRB5_FUNCS
1a22a39e 1499 fi
75c5f82b 1500 if test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1a22a39e 1501 AC_MSG_ERROR([Required Kerberos library not found])
75c5f82b
AJ
1502 elif test "x$KRB5LIBS" = "x"; then
1503 with_mit_krb5=no
1504 with_apple_krb5=no
1a22a39e 1505 fi
1a22a39e
MM
1506 SQUID_STATE_ROLLBACK([squid_krb5_save])
1507fi
1508
75c5f82b
AJ
1509# detect Solaris Kerberos dependencies
1510if test "x$with_solaris_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1a22a39e
MM
1511 SQUID_STATE_SAVE([squid_krb5_save])
1512 LIBS="$LIBS $LIB_KRB5_PATH"
1513
1514 # no pkg-config for solaris native Kerberos
77f4953d
AJ
1515 # look for krb5-config (unless cross-compiling)
1516 if test "$cross_compiling" = "no"; then
1517 if test "x$krb5confpath" = "x" ; then
1518 AC_PATH_PROG(krb5_config,krb5-config,no)
1519 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1520 ac_krb5_config="$ac_cv_path_krb5_config"
1521 fi
1522 else
1523 ac_krb5_config="$krb5confpath/krb5-config"
1a22a39e 1524 fi
1a22a39e
MM
1525 fi
1526 if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
1527 # Get libs, etc
1528 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1529 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1530 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
b2da83da
AJ
1531 # Solaris 10 Update 11 patches the krb5-config tool to produce stderr messages on stdout.
1532 SOLARIS_BROKEN_KRB5CONFIG_GSSAPI="`$ac_krb5_config --libs gssapi 2>/dev/null | grep "krb5-config"`"
1533 if test "x$SOLARIS_BROKEN_KRB5CONFIG_GSSAPI" = "x"; then
1534 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1535 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1536 fi
1a22a39e
MM
1537 else
1538 ## For some OS pkg-config is broken or unavailable.
1539 ## Detect libraries the hard way.
1540
1541 CXXFLAGS="-I/usr/include/kerberosv5 $CXXFLAGS"
1542
b2bdde72 1543 SQUID_STATE_SAVE([squid_solaris_save])
ff78f3c3 1544 missing_required=
1a22a39e
MM
1545 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1546 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
ff78f3c3
AJ
1547 AC_MSG_WARN([library 'krb5' is required for Solaris Kerberos])
1548 missing_required=yes
1a22a39e 1549 ])
b2bdde72 1550 LIBS=$LIB_KRB5_LIBS
1a22a39e 1551 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
ff78f3c3
AJ
1552 AC_MSG_WARN([library 'gss' is required for Solaris Kerberos])
1553 missing_required=yes
1a22a39e 1554 ])
b2bdde72 1555 SQUID_STATE_ROLLBACK([squid_solaris_save])
ff78f3c3
AJ
1556 if test "x$missing_required" = "xyes"; then
1557 LIB_KRB5_LIBS=""
1558 fi
1a22a39e
MM
1559 fi
1560
1561 if test "x$LIB_KRB5_LIBS" != "x"; then
1562 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1563 KRB5INCS="$LIB_KRB5_CFLAGS"
1564 AC_DEFINE(USE_SOLARIS_KRB5,1,[Solaris Kerberos support is available])
9603207d 1565 KRB5_FLAVOUR="Solaris"
1566
1a22a39e
MM
1567 # check for other specific broken implementations
1568 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1569 LIBS="$LIBS $KRB5LIBS"
1570
1571 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1572 AC_CHECK_HEADERS(gssapi/gssapi.h gssapi/gssapi_ext.h)
1573 AC_CHECK_HEADERS(krb5.h com_err.h)
1574
1575 SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H
1576 if test "x$squid_cv_broken_krb5_h" = "xyes"; then
1577 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if Solaris krb5.h is broken for C++])
1578 AC_MSG_WARN([You have a broken Solaris <krb5.h> system include.])
1579 AC_MSG_WARN([Please see http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512])
1580 AC_MSG_WARN([If you need Kerberos support you will have to patch])
1581 AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch])
1582 fi
1a22a39e 1583 SQUID_CHECK_KRB5_FUNCS
1a22a39e 1584 fi
75c5f82b
AJ
1585 if test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1586 # Error only if Solaris flavour was detected while looking for required MIT Kerberos
1a22a39e 1587 AC_MSG_ERROR([Required Kerberos library not found])
75c5f82b
AJ
1588 elif test "x$KRB5LIBS" = "x"; then
1589 with_solaris_krb5=no
1590 with_mit_krb5=no
1a22a39e 1591 fi
1a22a39e
MM
1592 SQUID_STATE_ROLLBACK([squid_krb5_save])
1593fi
1594
75c5f82b 1595dnl User may specify Heimdal Kerberos is needed from a non-standard location
24531401 1596SQUID_AUTO_LIB(heimdal-krb5,[Heimdal Kerberos],[LIB_KRB5])
75c5f82b
AJ
1597AH_TEMPLATE(USE_HEIMDAL_KRB5,[Heimdal Kerberos support is available])
1598if test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"; then
24531401
AJ
1599 CXXFLAGS="$LIB_KRB5_CFLAGS $CXXFLAGS"
1600 krb5confpath="$with_heimdal_krb5/bin"
75c5f82b
AJ
1601 # find installed libs via pkg-config or krb5-config
1602 PKG_CHECK_EXISTS(heimdal-krb5, [squid_pc_krb5_name="heimdal-krb5"])
1603 if test "x$squid_pc_krb5_name" = "x"; then
1604 PKG_CHECK_EXISTS(heimdal-gssapi, [squid_pc_krb5_name="heimdal-gssapi"])
1605 fi
297a2769 1606 if test "x$squid_pc_krb5_name" = "x" -a "$cross_compiling" = "no"; then
75c5f82b 1607 # Look for krb5-config (unless cross-compiling)
c4b12583 1608 AC_PATH_PROG(krb5_config,krb5-config,no,$krb5confpath)
75c5f82b
AJ
1609 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1610 krb5confpath="`dirname $ac_cv_path_krb5_config`"
1611 ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
95ee97e7 1612 if test "x$with_heimdal_krb5" = "xyes" -a $ac_heimdal = 0; then
75c5f82b
AJ
1613 AC_MSG_ERROR([Could not find pkg-config or krb5-config for Heimdal Kerberos])
1614 fi
1615 else
1616 if test "x$with_heimdal_krb5" = "xyes"; then
1617 AC_MSG_ERROR([Could not find krb5-config in path])
1618 else
1619 AC_MSG_WARN([Could not find krb5-config in path])
1620 with_heimdal_krb5=no
1621 fi
1622 fi
1623 fi
1624fi
1625if test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"; then
1a22a39e
MM
1626 SQUID_STATE_SAVE([squid_krb5_save])
1627 LIBS="$LIBS $LIB_KRB5_PATH"
1628
1629 # auto-detect using pkg-config
75c5f82b 1630 PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
77f4953d
AJ
1631 # look for krb5-config (unless cross-compiling)
1632 if test "$cross_compiling" = "no"; then
1633 if test "x$krb5confpath" = "x" ; then
1634 AC_PATH_PROG(krb5_config,krb5-config,no)
1635 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1636 ac_krb5_config="$ac_cv_path_krb5_config"
1637 fi
1638 else
1639 ac_krb5_config="$krb5confpath/krb5-config"
1a22a39e 1640 fi
1a22a39e 1641 fi
75c5f82b 1642 if test "x$ac_krb5_config" != "x" -a -x "$ac_krb5_config"; then
1a22a39e
MM
1643 # Get libs, etc
1644 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1645 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1646 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1647 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1648 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1649 else
1650 ## For some OS pkg-config is broken or unavailable.
1651 ## Detect libraries the hard way.
b2bdde72 1652 SQUID_STATE_SAVE([squid_heimdal_save])
87a4a80f 1653 missing_required=
1a22a39e
MM
1654 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1655 AC_CHECK_LIB(resolv, [main], [LIB_KRB5_LIBS="-lresolv $LIB_KRB5_LIBS"],[
87a4a80f
AJ
1656 AC_MSG_WARN([library 'resolv' is required for Heimdal Kerberos])
1657 missing_required=yes
1a22a39e 1658 ])
b2bdde72 1659 LIBS=$LIB_KRB5_LIBS
1a22a39e 1660 AC_CHECK_LIB(crypt, [main], [LIB_KRB5_LIBS="-lcrypt $LIB_KRB5_LIBS"],[
87a4a80f
AJ
1661 AC_MSG_WARN([library 'crypt' is required for Heimdal Kerberos])
1662 missing_required=yes
1a22a39e 1663 ])
b2bdde72 1664 LIBS=$LIB_KRB5_LIBS
1a22a39e 1665 AC_CHECK_LIB(roken, [main], [LIB_KRB5_LIBS="-lroken $LIB_KRB5_LIBS"],[
87a4a80f
AJ
1666 AC_MSG_WARN([library 'roken' is required for Heimdal Kerberos])
1667 missing_required=yes
1a22a39e 1668 ])
b2bdde72 1669 LIBS=$LIB_KRB5_LIBS
1a22a39e
MM
1670 AC_CHECK_LIB(heimbase, [main], [LIB_KRB5_LIBS="-lheimbase $LIB_KRB5_LIBS"],[
1671 AC_MSG_WARN([library 'heimbase' may be required for Heimdal Kerberos])
1672 ])
b2bdde72 1673 LIBS=$LIB_KRB5_LIBS
1a22a39e
MM
1674 AC_CHECK_LIB(wind, [main], [LIB_KRB5_LIBS="-lwind $LIB_KRB5_LIBS"],[
1675 AC_MSG_WARN([library 'wind' may be required for Heimdal Kerberos])
1676 ])
b2bdde72 1677 LIBS=$LIB_KRB5_LIBS
1a22a39e 1678 AC_CHECK_LIB(crypto, [main], [LIB_KRB5_LIBS="-lcrypto $LIB_KRB5_LIBS"],[
87a4a80f
AJ
1679 AC_MSG_WARN([library 'crypto' is required for Heimdal Kerberos])
1680 missing_required=yes
1a22a39e 1681 ])
b2bdde72 1682 LIBS=$LIB_KRB5_LIBS
1a22a39e 1683 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
87a4a80f
AJ
1684 AC_MSG_WARN([library 'com_err' is required for Heimdal Kerberos])
1685 missing_required=yes
1a22a39e 1686 ])
b2bdde72 1687 LIBS=$LIB_KRB5_LIBS
1a22a39e
MM
1688 AC_CHECK_LIB(hx509, [main], [LIB_KRB5_LIBS="-lhx509 $LIB_KRB5_LIBS"],[
1689 AC_MSG_WARN([library 'hx509' may be required for Heimdal Kerberos])
1690 ])
b2bdde72 1691 LIBS=$LIB_KRB5_LIBS
1a22a39e 1692 AC_CHECK_LIB(asn1, [main], [LIB_KRB5_LIBS="-lasn1 $LIB_KRB5_LIBS"],[
87a4a80f
AJ
1693 AC_MSG_WARN([library 'asn1' is required for Heimdal Kerberos])
1694 missing_required=yes
1a22a39e 1695 ])
b2bdde72 1696 LIBS=$LIB_KRB5_LIBS
1a22a39e 1697 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
87a4a80f
AJ
1698 AC_MSG_WARN([library 'krb5' is required for Heimdal Kerberos])
1699 missing_required=yes
1a22a39e 1700 ])
b2bdde72 1701 LIBS=$LIB_KRB5_LIBS
1a22a39e
MM
1702 AC_CHECK_LIB(heimntlm, [main], [LIB_KRB5_LIBS="-lheimntlm $LIB_KRB5_LIBS"],[
1703 AC_MSG_WARN([library 'heimntlm' may be required for Heimdal Kerberos])
1704 ])
b2bdde72 1705 LIBS=$LIB_KRB5_LIBS
1a22a39e 1706 AC_CHECK_LIB(gssapi, [main], [LIB_KRB5_LIBS="-lgssapi $LIB_KRB5_LIBS"],[
87a4a80f
AJ
1707 AC_MSG_WARN([library 'gssapi' is required for Heimdal Kerberos])
1708 missing_required=yes
1a22a39e 1709 ])
b2bdde72 1710 SQUID_STATE_ROLLBACK([squid_heimdal_save])
87a4a80f
AJ
1711 if test "x$missing_required" = "xyes"; then
1712 LIB_KRB5_LIBS=""
1713 fi
1a22a39e 1714 fi
1a22a39e
MM
1715 ])
1716 if test "x$LIB_KRB5_LIBS" != "x"; then
1717 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1718 KRB5INCS="$LIB_KRB5_CFLAGS"
1719 AC_DEFINE(USE_HEIMDAL_KRB5,1,[Heimdal Kerberos support is available])
9603207d 1720 KRB5_FLAVOUR="Heimdal"
1721
1a22a39e
MM
1722 # check for other specific broken implementations
1723 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1724 LIBS="$LIBS $KRB5LIBS"
1725
1726 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1727 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1728 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1729
1730 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1731 if test "x$squid_cv_broken_heimdal_krb5_h" = "xyes"; then
1732 AC_DEFINE(HAVE_BROKEN_HEIMDAL_KRB5_H, 1, [Define to 1 if Heimdal krb5.h is broken for C++])
1733 fi
1a22a39e 1734 SQUID_CHECK_KRB5_FUNCS
1a22a39e
MM
1735 fi
1736 if test "x$KRB5LIBS" = "x"; then
a4f19899 1737 if test "x$with_heimdal_krb5" = "xyes"; then
75c5f82b
AJ
1738 AC_MSG_ERROR([Required Heimdal Kerberos library not found])
1739 else
1740 AC_MSG_WARN([Heimdal Kerberos library not found])
1741 fi
1a22a39e 1742 fi
1a22a39e
MM
1743 SQUID_STATE_ROLLBACK([squid_krb5_save])
1744fi
1745
75c5f82b 1746dnl User may specify GNU gss is needed from a non-standard location
24531401 1747SQUID_AUTO_LIB(gnugss,[GNU gss],[LIB_KRB5])
75c5f82b
AJ
1748AH_TEMPLATE(USE_GNUGSS,[GNU gss support is available])
1749if test "x$with_gnugss" != "xno" -a "x$KRB5LIBS" = "x"; then
24531401
AJ
1750 CXXFLAGS="$LIB_KRB5_CFLAGS $CXXFLAGS"
1751 krb5confpath=
1a22a39e
MM
1752 SQUID_STATE_SAVE([squid_krb5_save])
1753 LIBS="$LIBS $LIB_KRB5_PATH"
1754
1755 # auto-detect using pkg-config
1756 PKG_CHECK_MODULES([LIB_KRB5],[gss],,[
1757 ## For some OS pkg-config is broken or unavailable.
1758 ## Detect libraries the hard way.
1759
1760 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1761 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
75c5f82b 1762 AC_MSG_WARN([library 'com_err' is required for GNU Kerberos])
1a22a39e 1763 ])
1a22a39e
MM
1764 ])
1765
1766 if test "x$LIB_KRB5_LIBS" != "x"; then
1767 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1768 KRB5INCS="$LIB_KRB5_CFLAGS"
1769 AC_DEFINE(USE_GNUGSS,1,[GNU Kerberos support is available])
9603207d 1770 KRB5_FLAVOUR="GNU GSS"
1a22a39e
MM
1771
1772 # check for other specific broken implementations
1773 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1774 LIBS="$LIBS $KRB5LIBS"
1775
1776 AC_MSG_NOTICE([Try to find Kerbeors headers in given path])
1777 AC_CHECK_HEADERS(gss.h)
1778
1779 SQUID_CHECK_WORKING_GSSAPI
1780 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1781
1782 SQUID_CHECK_SPNEGO_SUPPORT
1783 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1784
1785 SQUID_CHECK_WORKING_KRB5
1786 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1a22a39e
MM
1787 fi
1788 if test "x$KRB5LIBS" = "x"; then
a4f19899 1789 if test "x$with_gnugss" = "xyes"; then
75c5f82b
AJ
1790 AC_MSG_ERROR([Required GNU GSS Kerberos library not found])
1791 else
1792 AC_MSG_WARN([GNU GSS Kerberos library not found])
1793 fi
1a22a39e 1794 fi
1a22a39e
MM
1795 SQUID_STATE_ROLLBACK([squid_krb5_save])
1796fi
75c5f82b
AJ
1797
1798if test "x$KRB5LIBS" != "x"; then
1a22a39e
MM
1799 with_krb5=yes
1800fi
1801AC_MSG_NOTICE([$KRB5_FLAVOUR Kerberos library support: ${with_krb5:=no} ${LIB_KRB5_PATH} ${LIB_KRB5_LIBS}])
1802AC_SUBST(KRB5INCS)
1803AC_SUBST(KRB5LIBS)
1a22a39e 1804
8aafbbc1 1805dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
1a22a39e
MM
1806dnl only with Windows LDAP libraries using -lwldap32
1807case "$squid_host_os" in
1808 mingw)
1809 LDAPLIB="-lwldap32"
1810 LBERLIB=""
1811 ;;
1812 *)
1813 AC_CHECK_LIB(ldap, ldap_init, [LDAPLIB="-lldap"])
1814 dnl LDAP helpers need to know if -llber is needed or not
1815 AC_CHECK_LIB(lber, ber_init, [LBERLIB="-llber"])
1816 dnl if no ldap lib found check for mozilla version
1817 if test "x$ac_cv_lib_ldap_ldap_init" != x""yes; then
1818 oLIBS=$LIBS
1819 LIBS="$LIBPTHREADS"
1820 AC_CHECK_LIB(ldap60, ldap_init, [LDAPLIB="-lldap60"])
1821 LIBS="$LDAPLIB $LIBPTHREADS"
1822 AC_CHECK_LIB(prldap60, prldap_init, [LDAPLIB="-lprldap60 $LDAPLIB"])
1823 LIBS="$LDAPLIB $LIBPTHREADS"
1824 AC_CHECK_LIB(ssldap60, ldapssl_init, [LDAPLIB="-lssldap60 $LDAPLIB"])
1825 LIBS=$oLIBS
1826 fi
1827
1828 AC_CHECK_HEADERS(ldap.h lber.h)
1829 AC_CHECK_HEADERS(mozldap/ldap.h)
1830
1831 dnl
1832 dnl Check for LDAP_OPT_DEBUG_LEVEL
1833 dnl
1834 AC_MSG_CHECKING([for LDAP_OPT_DEBUG_LEVEL])
1835 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1836# include <ldap.h>
1837 ]],[[
1838 int i=LDAP_OPT_DEBUG_LEVEL
1839 ]])],
1840 [ AC_MSG_RESULT(yes) ],
1841 [ AC_MSG_RESULT(no) ])
1842
1843 dnl
1844 dnl Check for working ldap
1845 dnl
1846 oLIBS=$LIBS
1847 LIBS="$LDAPLIB $LBERLIB $LIBPTHREADS"
1848 AC_MSG_CHECKING([for working ldap])
1849 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1850# define LDAP_DEPRECATED 1
1851# if HAVE_LDAP_H
1852# include <ldap.h>
1853# elif HAVE_MOZLDAP_LDAP_H
1854# include <mozldap/ldap.h>
1855# endif
1856 int
1857 main(void)
1858 {
1859 char host[]="";
1860 int port;
1861
1862 ldap_init((const char *)&host, port);
1863
1864 return 0;
1865 }
9603207d 1866 ]])],
1867 [ AC_DEFINE(HAVE_LDAP, 1, [LDAP support])
1a22a39e
MM
1868 AC_MSG_RESULT(yes) ],
1869 [ AC_MSG_RESULT(no) ],
1870 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1871 LIBS=$oLIBS
1872
1873 dnl
1874 dnl Check for ldap vendor
1875 dnl
1876 AC_MSG_CHECKING([for OpenLDAP])
1877 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1878# if HAVE_LDAP_H
1879# include <ldap.h>
1880# endif
1881# include <string.h>
1882 int
1883 main(void)
1884 {
1885 return strcmp(LDAP_VENDOR_NAME,"OpenLDAP");
1886 }
9603207d 1887 ]])],
1888 [ AC_DEFINE(HAVE_OPENLDAP, 1, [OpenLDAP support])
1a22a39e
MM
1889 AC_MSG_RESULT(yes) ],
1890 [ AC_MSG_RESULT(no) ],
1891 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1892
1893 AC_MSG_CHECKING([for Sun LDAP SDK])
1894 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1895# if HAVE_LDAP_H
1896# include <ldap.h>
1897# endif
1898# include <string.h>
1899 int
1900 main(void)
1901 {
1902 return strcmp(LDAP_VENDOR_NAME,"Sun Microsystems Inc.");
1903 }
9603207d 1904 ]])],
1a22a39e
MM
1905 [ AC_DEFINE(HAVE_SUN_LDAP_SDK, 1, [Sun LDAP SDK support])
1906 AC_MSG_RESULT(yes) ],
1907 [ AC_MSG_RESULT(no) ],
1908 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1909
1910 AC_MSG_CHECKING([for Mozilla LDAP SDK])
1911 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1912# if HAVE_LDAP_H
1913# include <ldap.h>
1914# elif HAVE_MOZLDAP_LDAP_H
1915# include <mozldap/ldap.h>
1916# endif
1917# include <string.h>
1918 int
1919 main(void)
1920 {
1921 return strcmp(LDAP_VENDOR_NAME,"mozilla.org");
1922 }
9603207d 1923 ]])],
1a22a39e
MM
1924 [ AC_DEFINE(HAVE_MOZILLA_LDAP_SDK, 1, [Mozilla LDAP SDK support])
1925 AC_MSG_RESULT(yes) ],
1926 [ AC_MSG_RESULT(no)],
1927 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1928
1929 dnl
1930 dnl Check for LDAP_REBINDPROC_CALLBACK
1931 dnl
1932 AC_MSG_CHECKING([for LDAP_REBINDPROC_CALLBACK])
1933 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1934# if HAVE_LDAP_H
1935# include <ldap.h>
1936# elif HAVE_MOZLDAP_LDAP_H
1937# include <mozldap/ldap.h>
1938# endif
1939 ]],[[
1940 LDAP_REBINDPROC_CALLBACK ldap_rebind;
1941 ]])],
1942 [ AC_DEFINE(HAVE_LDAP_REBINDPROC_CALLBACK,1,[Define to 1 if you have LDAP_REBINDPROC_CALLBACK])
1943 AC_MSG_RESULT(yes) ],
1944 [ AC_MSG_RESULT(no) ])
1945
1946 dnl
1947 dnl Check for LDAP_REBIND_PROC
1948 dnl
1949 AC_MSG_CHECKING([for LDAP_REBIND_PROC])
1950 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1951# if HAVE_LDAP_H
1952# include <ldap.h>
1953# elif HAVE_MOZLDAP_LDAP_H
1954# include <mozldap/ldap.h>
1955# endif
1956 ]],[[
1957 LDAP_REBIND_PROC ldap_rebind;
1958 ]])],
1959 [ AC_DEFINE(HAVE_LDAP_REBIND_PROC,1,[Define to 1 if you have LDAP_REBIND_PROC])
1960 AC_MSG_RESULT(yes) ],
1961 [ AC_MSG_RESULT(no) ])
1962
1963 dnl
1964 dnl Check for LDAP_REBIND_FUNCTION
1965 dnl
1966 AC_MSG_CHECKING([for LDAP_REBIND_FUNCTION])
1967 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1968# define LDAP_REFERRALS
1969# if HAVE_LDAP_H
1970# include <ldap.h>
1971# elif HAVE_MOZLDAP_LDAP_H
1972# include <mozldap/ldap.h>
1973# endif
1974 ]],[[
1975 LDAP_REBIND_FUNCTION ldap_rebind;
1976 ]])],
1977 [ AC_DEFINE(HAVE_LDAP_REBIND_FUNCTION,1,[Define to 1 if you have LDAP_REBIND_FUNCTION])
1978 AC_MSG_RESULT(yes) ],
1979 [ AC_MSG_RESULT(no) ])
1980
1981 dnl
1982 dnl Check for LDAP_SCOPE_DEFAULT
1983 dnl
1984 AC_MSG_CHECKING([for LDAP_SCOPE_DEFAULT])
1985 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1986# if HAVE_LDAP_H
1987# include <ldap.h>
1988# elif HAVE_MOZLDAP_LDAP_H
1989# include <mozldap/ldap.h>
1990# endif
1991 ]],[[
1992 int i=LDAP_SCOPE_DEFAULT;
1993 ]])],
1994 [ AC_DEFINE(HAVE_LDAP_SCOPE_DEFAULT,1,[Define to 1 if you have LDAP_SCOPE_DEFAULT])
1995 AC_MSG_RESULT(yes) ],
1996 [ AC_MSG_RESULT(no) ])
1997
1998 dnl
1999 dnl Check for ldap_url_desc.lud_scheme
2000 dnl
2001 AC_CHECK_MEMBER(struct ldap_url_desc.lud_scheme,
2002 AC_DEFINE(HAVE_LDAP_URL_LUD_SCHEME,1,
2003 [Define to 1 if you have LDAPURLDesc.lud_scheme]),,[#include <ldap.h>])
2004
2005 dnl
2006 dnl Check for ldapssl_client_init
2007 dnl
2008 AC_CHECK_LIB(ldap,ldapssl_client_init,
2009 AC_DEFINE(HAVE_LDAPSSL_CLIENT_INIT,1,[Define to 1 if you have ldapssl_client_init]),)
2010
2011 dnl
2012 dnl Check for ldap_url_desc2str
2013 dnl
2014 AC_CHECK_LIB(ldap,ldap_url_desc2str,
2015 AC_DEFINE(HAVE_LDAP_URL_DESC2STR,1,[Define to 1 if you have ldap_url_desc2str]),)
2016
2017 dnl
2018 dnl Check for ldap_url_parse
2019 dnl
2020 AC_CHECK_LIB(ldap,ldap_url_parse,
2021 AC_DEFINE(HAVE_LDAP_URL_PARSE,1,[Define to 1 if you have ldap_url_parse]),)
2022
2023 dnl
2024 dnl Check for ldap_start_tls_s
2025 dnl
2026 AC_CHECK_LIB(ldap,ldap_start_tls_s,
2027 AC_DEFINE(HAVE_LDAP_START_TLS_S,1,[Define to 1 if you have ldap_start_tls_s]),)
2028 ;;
2029esac
2030
2031AC_SUBST(LDAPLIB)
2032AC_SUBST(LBERLIB)
2033
75a8daaf 2034SQUID_AUTO_LIB(systemd,[systemd API for start-up notification],[SYSTEMD])
6fa8c664
MM
2035AH_TEMPLATE(USE_SYSTEMD,[systemd support is available])
2036if test "x$with_systemd" != "xno" -a "x$squid_host_os" = "xlinux"; then
2037 SQUID_STATE_SAVE(squid_systemd_state)
2038
2039 # User may have provided a custom location for systemd. Otherwise...
2040 LIBS="$LIBS $SYSTEMD_PATH"
2041
2042 # auto-detect using pkg-config
2043 PKG_CHECK_MODULES(SYSTEMD,[libsystemd],,[
2044 # systemd < 209
2045 PKG_CHECK_MODULES(SYSTEMD,[libsystemd-daemon],,[:])
2046 ])
2047
2048 AC_CHECK_HEADERS(systemd/sd-daemon.h)
2049
2050 SQUID_STATE_ROLLBACK(squid_systemd_state) #de-pollute LIBS
2051
2052 if test "x$with_systemd" = "xyes" -a "x$SYSTEMD_LIBS" = "x"; then
2053 AC_MSG_ERROR([Required systemd library not found])
2054 fi
2055 if test "x$SYSTEMD_LIBS" != "x" ; then
2056 CXXFLAGS="$SYSTEMD_CFLAGS $CXXFLAGS"
75a8daaf 2057 LDFLAGS="$SYSTEMD_PATH $SYSTEMD_LIBS $LDFLAGS"
6fa8c664
MM
2058 AC_DEFINE(USE_SYSTEMD,1,[systemd support is available])
2059 else
2060 with_systemd=no
2061 fi
2062fi
2063AC_MSG_NOTICE([systemd library support: ${with_systemd:=auto} ${SYSTEMD_PATH} ${SYSTEMD_LIBS}])
2064
02749868 2065AC_ARG_ENABLE(forw-via-db,
47d80734
FC
2066 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
2067 SQUID_YESNO([$enableval],[unrecognized argument to --enable-forw-via-db: $enableval])
02749868 2068])
21f6708d 2069SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
9676633b
FC
2070 [Enable Forw/Via database])
2071AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
02749868 2072
6cfa8966 2073AC_ARG_ENABLE(cache-digests,
47d80734 2074 AS_HELP_STRING([--enable-cache-digests],
9676633b
FC
2075 [Use Cache Digests. See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
2076[
2077 SQUID_YESNO($enableval,
2078 [unrecognized argument to --enable-cache-digests: $enableval])
484f2ebc 2079])
0067eb06 2080SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
47d80734 2081 [Use Cache Digests for locating objects in neighbor caches.])
9676633b 2082AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
47d80734 2083
484f2ebc 2084
9676633b
FC
2085################################
2086# check for netio plugin stuff #
2087################################
2088dnl order of these options handling is relevant in case the user
2089dnl supplies more than one --enable option. Options handled later
2090dnl override those handled earlier for io loop method manual override
2091AC_ARG_ENABLE(select,
2092 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),
2093[
2094SQUID_YESNO($enableval,[--disable-select takes no extra argument])
39145d19
AJ
2095if test "x$enableval" = "xyes"; then
2096 if test "x$squid_host_os" = "xmingw"; then
2097 squid_opt_io_loop_engine="select_win32"
2098 else
2099 squid_opt_io_loop_engine="select"
2100 fi
2101fi
9676633b
FC
2102])
2103AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
cd748f27 2104
9bb83c8b 2105AC_ARG_ENABLE(poll,
62979ab1 2106 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
1b3db6d9 2107[
9676633b 2108SQUID_YESNO($enableval,[--disable-poll takes no extra argument])
fcabe077 2109test "x$enableval" = "xyes" && squid_opt_io_loop_engine="poll"
9bb83c8b 2110])
9676633b 2111AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
9bb83c8b 2112
1b3db6d9 2113AC_ARG_ENABLE(kqueue,
26d50fd2
AJ
2114 AS_HELP_STRING([--disable-kqueue],
2115 [Disable kqueue(2) support.]), [
9676633b 2116SQUID_YESNO($enableval,[--enable-kqueue takes no extra argument])
1b3db6d9 2117])
26d50fd2
AJ
2118if test "x${enable_kqueue:=auto}" != "xno" ; then
2119 AC_CHECK_HEADERS([sys/event.h],[],[
2120 if test "x${enable_kqueue}" = "xyes" ; then
2121 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
2122 fi
2123 ])
2124 AC_CHECK_FUNCS(kqueue,[],[
2125 if test "x${enable_kqueue}" = "xyes" ; then
2126 AC_MSG_ERROR([kqueue support missing in libc library.])
2127 fi
2128 ])
2129 if test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes" ; then
2130 squid_opt_io_loop_engine="kqueue"
2131 else
2132 enable_kqueue="no"
2133 fi
9676633b 2134fi
26d50fd2 2135AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
1b3db6d9 2136
a46d2c0e 2137dnl Enable epoll()
a46d2c0e 2138AC_ARG_ENABLE(epoll,
62979ab1 2139 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
a46d2c0e 2140[
9676633b 2141SQUID_YESNO($enableval,[--disable-epoll takes no extra argument])
fcabe077 2142test "x$enableval" = "xyes" && squid_opt_io_loop_engine="epoll"
a46d2c0e 2143])
9676633b 2144AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
2ca8b332 2145
9676633b
FC
2146# auto-detect and verify epoll header and library present and working
2147# logic mapping and loop method selection are performed later
fcabe077 2148if test "x$enable_epoll" != "xno" ; then
2ca8b332 2149
9676633b
FC
2150 # check if libs are needed to support epoll
2151 # note: this code block seems quite generic. Could it be extracted
2152 # into a squid specific configure function?
af1e01a8 2153 SQUID_STATE_SAVE(squid_epoll_state)
9676633b 2154 AC_SEARCH_LIBS(epoll_ctl,[epoll])
fcabe077 2155 if test "x$ac_cv_search_epoll_ctl" = "xno" ; then
9676633b 2156 enable_epoll=no #disable. Needed code not found
fcabe077 2157 elif test "x$ac_cv_search_epoll_ctl" = "xnone required" ; then
9676633b
FC
2158 EPOLL_LIBS=""
2159 else
2160 EPOLL_LIBS=$ac_cv_search_epoll_ctl
2161 fi
2162 AC_SUBST(EPOLL_LIBS)
2163 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
a46d2c0e 2164
9676633b 2165 # epoll requires sys/epoll.h
98d13964 2166 AC_CHECK_HEADERS([sys/epoll.h])
ad32c661
AJ
2167
2168 dnl Verify that epoll really works
dcac6885 2169 if test "x$ac_cv_search_epoll_ctl" != 'xno' ; then
af1e01a8 2170 SQUID_CHECK_EPOLL
ad32c661 2171 fi
2ca8b332 2172
fcabe077 2173 if test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno" ; then
2ca8b332
AJ
2174 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
2175 fi
ad32c661 2176fi
a46d2c0e 2177
a1ad2f9b
AJ
2178dnl Enable /dev/poll
2179AC_ARG_ENABLE(devpoll,
2180 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),
2181[
2182SQUID_YESNO($enableval,[--disable-devpoll takes no extra argument])
2183test "x$enableval" = "xyes" && squid_opt_io_loop_engine="devpoll"
2184])
2185AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
2186
2187## auto-detect and verify devpoll header and library present and working
2188if test "x$enable_devpoll" != "xno"; then
2189
2190 # /dev/poll requires ioctl() and write()
2191 AC_CHECK_FUNCS(ioctl)
2192 AC_CHECK_FUNCS(write)
2193
2194 # /dev/poll requires sys/devpoll.h
2195 AC_CHECK_HEADERS([sys/devpoll.h],,[
2196 if test "x$enable_devpoll" = "xyes"; then
2197 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
2198 fi
2199 enable_devpoll=no])
2200
2201 # Verify that /dev/poll really works
2202 if test "x$enable_devpoll" != 'xno' ; then
2203 SQUID_CHECK_DEVPOLL
2204 fi
2205
2206 if test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno" ; then
2207 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
2208 fi
2209fi
2210
9676633b 2211
72fd085a 2212AC_ARG_ENABLE(http-violations,
af1e01a8
FC
2213 AS_HELP_STRING([--disable-http-violations],
2214 [This allows you to remove code which is known to
47d80734 2215 violate the HTTP protocol specification.]), [
9676633b
FC
2216 SQUID_YESNO([$enableval],
2217 [unrecognized argument to --disable-http-violations: $enableval])
72fd085a 2218])
626096be 2219SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
47d80734 2220 [Define to enable code which volates the HTTP standard specification])
9676633b 2221AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
72fd085a 2222
47d80734 2223# IPFW Transparent Proxy
68075fad 2224AC_ARG_ENABLE(ipfw-transparent,
1d26e252
FC
2225 AS_HELP_STRING([--enable-ipfw-transparent],
2226 [Enable Transparent Proxy support for systems
47d80734 2227 using FreeBSD IPFW-style firewalling.]), [
1d26e252
FC
2228 SQUID_YESNO([$enableval],
2229 [unrecognized argument to --enable-ipfw-transparent: $enableval])
68075fad 2230])
0067eb06 2231SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
2277004e 2232 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
1d26e252 2233AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
68075fad 2234
47d80734 2235# IP-Filter Transparent Proxy
5cafc1d6 2236AC_ARG_ENABLE(ipf-transparent,
2277004e 2237 AS_HELP_STRING([--enable-ipf-transparent],
1d26e252
FC
2238 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
2239 SQUID_YESNO([$enableval],
2240 [unrecognized argument to --enable-ipf-transparent: $enableval])
5cafc1d6 2241])
be0c7ff0 2242#will be AC_DEFINEd later, after checking for appropriate infrastructure
4bd144d2
FC
2243#IPF currently broken. Default-disabled for now.
2244AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
5cafc1d6 2245
2b0dd4ac 2246dnl Enable PF Transparent Proxy
2247AC_ARG_ENABLE(pf-transparent,
2277004e 2248 AS_HELP_STRING([--enable-pf-transparent],
47d80734 2249 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
1d26e252
FC
2250 SQUID_YESNO([$enableval],
2251 [unrecognized argument to --enable-pf-transparent: $enableval])
2b0dd4ac 2252])
be0c7ff0 2253#will be AC_DEFINEd later, after checking for appropriate infrastructure
b2192042
AJ
2254AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
2255
2256dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
2257AC_ARG_WITH(nat-devpf,
2258 AS_HELP_STRING([--with-nat-devpf],
2259 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
2260 SQUID_YESNO([$enableval],
2261 [unrecognized argument to --with-nat-devpf: $enableval])
2262])
2263#will be AC_DEFINEd later, after checking for appropriate infrastructure
2264AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
2b0dd4ac 2265
4bd144d2 2266# Linux Netfilter Transparent Proxy
d852fbad 2267AC_ARG_ENABLE(linux-netfilter,
20ad76ab 2268 AS_HELP_STRING([--enable-linux-netfilter],
96f08e2d 2269 [Enable Transparent Proxy support for Linux (Netfilter)]), [
4bd144d2
FC
2270 SQUID_YESNO([$enableval],
2271 [unrecognized argument to --enable-linux-netfilter: $enableval])
d852fbad 2272])
4bd144d2 2273AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
be0c7ff0 2274#will be AC_DEFINEd later, after checking for appropriate infrastructure
d852fbad 2275
425de4c8
AJ
2276
2277dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
24531401 2278SQUID_AUTO_LIB(netfilter-conntrack,[Netfilter conntrack],[LIBNETFILTER_CONNTRACK])
f4f6c2e0
AJ
2279AC_MSG_NOTICE([Linux Netfilter Conntrack support requested: ${with_netfilter_conntrack:=auto}])
2280if test "x$with_netfilter_conntrack" != "xno"; then
24531401
AJ
2281 LDFLAGS="$LIBNETFILTER_CONNTRACK_PATH $LDFLAGS"
2282 CPPFLAGS="$LIBNETFILTER_CONNTRACK_CFLAGS $CPPFLAGS"
f4f6c2e0
AJ
2283 AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
2284 if test x"$with_netfilter_conntrack" = "xyes"; then
2285 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack library not found])
425de4c8 2286 fi
f4f6c2e0 2287 with_netfilter_conntrack=no])
425de4c8 2288 AC_CHECK_HEADERS([libnetfilter_conntrack/libnetfilter_conntrack.h \
f4f6c2e0
AJ
2289 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h],,[
2290 if test x"$with_netfilter_conntrack" = "xyes"; then
2291 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack headers not found])
2292 fi
2293 with_netfilter_conntrack=no])
88a2a8c6
AJ
2294 # If nothing is broken; enable the libraries usage.
2295 if test "x$with_netfilter_conntrack" != "xno"; then
2296 with_netfilter_conntrack=yes
2297 fi
425de4c8
AJ
2298fi
2299
2300
bb7b5fd0 2301dnl Enable Large file support
2df6213e 2302buildmodel=""
2277004e 2303squid_opt_enable_large_files=no
2df6213e 2304
2305AC_ARG_WITH(large-files,
507ca601
FC
2306 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
2307 if test "x$withval" = "xyes"; then
2308 squid_opt_enable_large_files=yes
bb7b5fd0 2309 fi
2310])
2311
2df6213e 2312dnl UNIX Build environment
be0c7ff0 2313dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
2df6213e 2314AC_ARG_WITH(build-environment,
507ca601 2315 AS_HELP_STRING([--with-build-environment=model],
9603207d 2316 [The build environment to use. Normally one of
507ca601
FC
2317 POSIX_V6_ILP32_OFF32 (32 bits),
2318 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
2319 POSIX_V6_LP64_OFF64 (64 bits),
2320 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
2321 XBS5_ILP32_OFF32 i(legacy, 32 bits),
2322 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
2323 XBS5_LP64_OFF64 (legacy, 64 bits),
2324 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
2325 or default (The default for your OS)]), [
2326case "$withval" in
2df6213e 2327 yes|no)
507ca601
FC
2328 AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])
2329 ;;
2df6213e 2330 *)
507ca601
FC
2331 buildmodel="$withval"
2332 ;;
2333esac
2df6213e 2334])
2335
228332d3
FC
2336#hack. Let's early-detect sizeof(long)
2337AC_CHECK_SIZEOF(long)
2338
fcabe077 2339if test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"; then
2277004e
FC
2340 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
2341 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
2342 buildmodel=$model
2343 break
2344 fi
2345 done
fcabe077 2346 if test "x$buildmodel" = "x"; then
2277004e
FC
2347 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
2348 fi
9b8002de 2349fi
0c0d381b 2350if test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"; then
228332d3
FC
2351 # define _FILE_OFFSET_BITS if requested and needed
2352 if test "x$squid_opt_enable_large_files" = "xyes" -a $ac_cv_sizeof_long -le 4 ; then
507ca601
FC
2353 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
2354 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
2355 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
2356 fi
2357else
2358 AC_MSG_NOTICE([Using $buildmodel build environment])
2359 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
2360 : # All fine
2361 else
2362 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
2363 fi
2364 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
2365 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
2366 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
2367 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
941c31f3 2368 if test "x$squid_host_os" = "xsolaris" ; then
2277004e
FC
2369
2370# On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
2371# for LDFLAGS -xarch=generic64, but:
2372# "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
2373# For gcc "-xarch=generic64" must be replaced with "-m64"
2374# The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
fcabe077 2375 if test "x$GCC" = "xyes"; then
2277004e
FC
2376 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
2377 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
2378 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
2379 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
2380 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2381 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2382 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
2383 fi
2384 AC_MSG_NOTICE([Removing -Usun on $host])
2385 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
2386 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
2387 fi
507ca601 2388fi
2df6213e 2389
3d674977 2390AC_ARG_ENABLE(follow-x-forwarded-for,
6c83720b
AR
2391 AS_HELP_STRING([--disable-follow-x-forwarded-for],
2392 [Do not follow the X-Forwarded-For
19b4777c
FC
2393 HTTP header to try to find the IP address of the
2394 original or indirect client when a request has
8075a4da 2395 been forwarded through other proxies.]), [
6ec005b5
FC
2396 SQUID_YESNO([$enableval],
2397 [unrecognized argument to --enable-follow-x-forwarded-for: $enableval])
8075a4da 2398])
6ec005b5 2399AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
3a5af257 2400SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
47d80734 2401 [Enable following X-Forwarded-For headers])
3d674977 2402
3898f57f 2403AC_ARG_ENABLE(ident-lookups,
8075a4da 2404 AS_HELP_STRING([--disable-ident-lookups],
47d80734
FC
2405 [Remove code that supports performing Ident (RFC 931) lookups.]), [
2406 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ident-lookups: $enableval])
8075a4da 2407])
6c5dc16a
FC
2408AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
2409SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
3898f57f 2410
9d798391 2411dnl Select Default hosts file location
2412AC_ARG_ENABLE(default-hostsfile,
8ea232f5
FC
2413 AS_HELP_STRING([--enable-default-hostsfile=path],
2414 [Select default location for hosts file.
75eaac6c
FC
2415 See hosts_file directive in squid.conf for details]), [
2416if test "x$enableval" != "xnone" -a "x$enableval" != "xno" ; then
2417 if test \! -f "$enableval"; then
2418 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
20ad76ab 2419 fi
75eaac6c
FC
2420 squid_opt_default_hosts=$enableval
2421else
2422 squid_opt_default_hosts="none"
2423fi
2424])
2425AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
2426DEFAULT_HOSTS=$squid_opt_default_hosts
2427AC_SUBST(DEFAULT_HOSTS)
9d798391 2428
47d80734 2429# Select auth schemes modules to build
94439e4e 2430AC_ARG_ENABLE(auth,
6c83720b
AR
2431 AS_HELP_STRING([--disable-auth],
2432 [Do not support authentication. When supported, the list of schemes
26ffc057
FC
2433 and helpers to be enabled is defined elsewhere]), [
2434SQUID_YESNO([$enableval],
2435 [unrecognized argument to --enable-auth: $enableval])
94439e4e 2436])
26ffc057 2437AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
2f1431ea
AJ
2438SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
2439AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
26ffc057 2440AUTH_MODULES=""
dcbfe1a3 2441require_smblib="no"
26ffc057
FC
2442
2443AC_ARG_ENABLE(auth-basic,
2444 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
2445 [Enable the basic authentication scheme, and build the specified helpers.
2446 Not providing an explicit list of helpers will attempt build of
2447 all possible helpers. Default is to do so.
2448 To disable the basic authentication scheme, use --disable-auth-basic.
d9655720 2449 To enable but build no helpers, specify "none".
03901cf8 2450 To see available helpers, see the src/auth/basic/ directory. ]),[
26ffc057
FC
2451#nothing to do really
2452])
03901cf8 2453m4_include([src/auth/basic/helpers.m4])
94439e4e 2454
12daeef6
AJ
2455AC_ARG_ENABLE(auth-digest,
2456 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
2457 [Enable the Digest authentication scheme, and build the specified helpers.
26ffc057
FC
2458 Not providing an explicit list of helpers will attempt build of
2459 all possible helpers. Default is to do so.
12daeef6 2460 To disable the Digest authentication scheme, use --disable-auth-digest.
26ffc057 2461 To enable but build no helpers, specify "none".
d4d7f6dd 2462 To see available helpers, see the src/auth/digest/ directory. ]),[
12daeef6 2463#nothing to do, really
380f0a87 2464])
d4d7f6dd 2465m4_include([src/auth/digest/helpers.m4])
94439e4e 2466
26ffc057
FC
2467AC_ARG_ENABLE(auth-negotiate,
2468 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
16c02b14 2469 [Enable the Negotiate authentication scheme, and build the specified
26ffc057
FC
2470 helpers.
2471 Not providing an explicit list of helpers will attempt build of
2472 all possible helpers. Default is to do so.
16c02b14 2473 To disable the Negotiate authentication scheme,
26ffc057
FC
2474 use --disable-auth-negotiate.
2475 To enable but build no helpers, specify "none".
16c02b14 2476 To see available helpers, see the src/auth/negotiate/ directory. ]),[
26ffc057 2477#nothing to do, really
6e785d85 2478])
16c02b14 2479m4_include([src/auth/negotiate/helpers.m4])
6e785d85 2480
12daeef6
AJ
2481AC_ARG_ENABLE(auth-ntlm,
2482 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
2483 [Enable the NTLM authentication scheme, and build the specified helpers.
26ffc057
FC
2484 Not providing an explicit list of helpers will attempt build of
2485 all possible helpers. Default is to do so.
12daeef6 2486 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
1a22a39e 2487 To enable but build no helpers, specify "none".
b817c20f 2488 To see available helpers, see the src/auth/ntlm/ directory. ]),[
1a22a39e 2489])
b817c20f 2490m4_include([src/auth/ntlm/helpers.m4])
c8093f05 2491
1a22a39e
MM
2492dnl Authentication libraries to build
2493dnl This list will not be needed when each auth library has its own Makefile
2494dnl this is to be placed AFTER each auth module's handler
2495AUTH_LIBS_TO_BUILD=
2496for module in $AUTH_MODULES; do
2497 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
2498done
2499AC_SUBST(AUTH_MODULES)
2500AC_SUBST(AUTH_LIBS_TO_BUILD)
dcbfe1a3 2501AM_CONDITIONAL(ENABLE_SMBLIB, test "x$require_smblib" = "xyes")
3d62cc61 2502
1a22a39e
MM
2503dnl Select logging daemon helpers to build
2504AC_ARG_ENABLE(log-daemon-helpers,
2505 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
4d5dd85a 2506 [This option selects which logging daemon helpers to
1a22a39e 2507 build and install as part of the normal build process
4d5dd85a 2508 For a list of available helpers see the src/log/
1a22a39e
MM
2509 directory.]),[
2510#nothing to do, really
2511])
4d5dd85a 2512m4_include([src/log/helpers.m4])
9ca29d23 2513
c6588c68 2514AC_ARG_ENABLE(external-acl-helpers,
f2d9a578 2515 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
e046643f 2516 [Enable external_acl helpers support and the helpers themselves.
d9655720 2517 Default is to build all buildable helpers and enable support.
8ea232f5 2518 To disable support, use --disable-external-acl-helpers.
d9655720 2519 To build no helpers, specify "none".
e046643f 2520 To see available helpers, see the src/acl/external/
8ea232f5 2521 directory]), [
d9655720 2522#nothing to do, really
c6588c68 2523])
e046643f 2524m4_include([src/acl/external/helpers.m4])
d9655720 2525
fdbb3b19 2526dnl Select url_rewrite helpers to build
fdbb3b19 2527AC_ARG_ENABLE(url-rewrite-helpers,
081863f3 2528 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
fdbb3b19
AJ
2529 [This option selects which url_rewrite helpers to
2530 build and install as part of the normal build
8ea232f5
FC
2531 process. The default is to attempt the build of all possible
2532 helpers. Use --disable-url-rewrite-helpers to build none.
2533 For a list of available helpers see the
d6d6203a 2534 src/http/url_rewriters/ directory.]),[
fdbb3b19 2535])
d6d6203a 2536m4_include([src/http/url_rewriters/helpers.m4])
fdbb3b19 2537
a27cfbe0 2538dnl Select security helpers to build
8732ea9d
AJ
2539AC_ARG_ENABLE(security-cert-validators,
2540 AS_HELP_STRING([--enable-security-cert-validators="list of helpers"],
bbf79f12
AJ
2541 [This option selects which security certificate validator
2542 helpers to build and install as part of the normal build
a27cfbe0 2543 process. The default is to attempt the build of all possible
8732ea9d 2544 helpers. Use --disable-security-cert-validators to
bbf79f12
AJ
2545 build none. For a list of available helpers see the
2546 src/security/cert_validators/ directory.]),[
a27cfbe0 2547])
4d5dd85a 2548m4_include([src/security/cert_validators/helpers.m4])
a27cfbe0 2549
cb0b3d63
AJ
2550AC_ARG_ENABLE(security-cert-generators,
2551 AS_HELP_STRING([--enable-security-cert-generators="list of helpers"],
2552 [This option selects which security certificate validator
2553 helpers to build and install as part of the normal build
2554 process. The default is to attempt the build of all possible
2555 helpers. Use --disable-security-cert-genrators to
2556 build none. For a list of available helpers see the
2557 src/security/cert_generators/ directory.]),[
2558])
2559m4_include([src/security/cert_generators/helpers.m4])
2560
0d5ee502
AM
2561dnl Select storeid_rewrite helpers to build
2562AC_ARG_ENABLE(storeid-rewrite-helpers,
2563 AS_HELP_STRING([--enable-storeid-rewrite-helpers="list of helpers"],
2564 [This option selects which Store-ID rewrite helpers to
2565 build and install as part of the normal build
2566 process. The default is to attempt the build of all possible
2567 helpers. Use --disable-storeid-rewrite-helpers to build none.
2568 For a list of available helpers see the
0c1f8b9b 2569 src/store/id_rewriters/ directory.]),[
0d5ee502 2570])
0c1f8b9b 2571m4_include([src/store/id_rewriters/helpers.m4])
0d5ee502 2572
3a125142 2573AC_ARG_WITH(valgrind-debug,
0f705e3b
FC
2574 AS_HELP_STRING([--with-valgrind-debug],
2575 [Include debug instrumentation for use with valgrind]),
4e26f472
FC
2576[
2577 SQUID_YESNO([$withval],
2578 [unrecognized argument to --with-valgrind-debug: $withval])
fcabe077 2579 if test "x$withval" != "xno" ; then
4e26f472
FC
2580 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
2581 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
2582 ])
b4bab919 2583 fi
2584])
4e26f472
FC
2585SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
2586 [Valgrind memory debugger support])
2587AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
b4bab919 2588
0e657244 2589dnl Enable WIN32 Service compile mode
2590AC_ARG_ENABLE(win32-service,
054a4caa 2591 AS_HELP_STRING([--enable-win32-service],
0f705e3b 2592 [Compile Squid as a WIN32 Service.
b284c470
FC
2593 Works only on MS-Windows platforms]), [
2594SQUID_YESNO([$enableval],
2595 [unrecognized argument to --enable-win32-service: $enableval])
0e657244 2596])
b284c470
FC
2597SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
2598 [Enable code supporting MS Windows service mode])
2599AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
0e657244 2600
b1485ff8 2601
29f22442 2602# Disable "unlinkd" code
fe0810ac 2603AC_ARG_ENABLE(unlinkd,
0a081cb0 2604 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
0f705e3b
FC
2605SQUID_YESNO([$enableval],
2606 [unrecognized argument to --disable-unlinkd: $enableval])
fe0810ac 2607])
0f658b5b 2608SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
0f705e3b 2609 [Enable useage of unlinkd])
fcabe077 2610AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
fbc04c0a 2611AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
fe0810ac 2612
0f705e3b 2613# Enable backtraces on fatal errors
ce3d30fb 2614AC_ARG_ENABLE(stacktraces,
0f705e3b
FC
2615 AS_HELP_STRING([--enable-stacktraces],
2616 [Enable automatic call backtrace on fatal errors]), [
2617SQUID_YESNO([$enableval],
2618 [unrecognized argument to --enable-stacktraces: $enableval])
ce3d30fb 2619])
0f658b5b 2620SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
0f705e3b 2621 [Print stack traces on fatal errors])
78614cd4 2622AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
0a081cb0 2623
904676a2 2624# Enable X-Accelerator-Vary for Vary support within an accelerator setup
2092c67d 2625AC_ARG_ENABLE(x-accelerator-vary,
904676a2
FC
2626 AS_HELP_STRING([--enable-x-accelerator-vary],
2627 [Enable support for the X-Accelerator-Vary
e702812e
FC
2628 HTTP header. Can be used to indicate
2629 variance within an accelerator setup.
2630 Typically used together with other code
904676a2
FC
2631 that adds custom HTTP headers to the requests.]), [
2632SQUID_YESNO([$enableval],
2633 [unrecognized argument to --enable-x-accelerator-vary: $enableval])
f66a9ef4 2634])
0f658b5b 2635SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
904676a2 2636 [Enable support for the X-Accelerator-Vary HTTP header])
78614cd4 2637AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
f66a9ef4 2638
24531401 2639SQUID_AUTO_LIB(cppunit,[cppunit test framework],[LIBCPPUNIT])
d93bf055 2640AS_IF([test "x$with_cppunit" != "xno"],[
24531401 2641 LIBCPPUNIT_LIBS="$LIBCPPUNIT_PATH -lcppunit"
d93bf055
AJ
2642 PKG_CHECK_MODULES([LIBCPPUNIT],[cppunit],[
2643 squid_cv_cppunit_version="`pkg-config cppunit --version`"
2644 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
2645 AS_UNSET(squid_cv_cppunit_version)
2646
2647 SQUID_STATE_SAVE(squid_cppunit_state)
e77b66af
FC
2648 CXXFLAGS="${CXXFLAGS} ${LIBCPPUNIT_CFLAGS}"
2649 LIBS="${LIBS} ${LIBCPPUNIT_LIBS}"
d93bf055
AJ
2650 AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
2651 SQUID_STATE_ROLLBACK(squid_cppunit_state)
2652 ],[
2653 AC_MSG_WARN([cppunit does not appear to be installed. Squid does not require this, but code testing with 'make check' will fail.])
2654 ])
f5691f9c 2655])
f5691f9c 2656
090089c4 2657dnl Check for headers
2658AC_HEADER_DIRENT
2659AC_HEADER_STDC
db40ae20 2660
2661AC_CHECK_HEADERS( \
3680cc44
FC
2662 arpa/inet.h \
2663 arpa/nameser.h \
2664 assert.h \
2665 bstring.h \
3680cc44 2666 crypt.h \
3680cc44 2667 ctype.h \
ee4d4e85 2668 direct.h \
3680cc44
FC
2669 errno.h \
2670 execinfo.h \
2671 fcntl.h \
2672 fnmatch.h \
2673 getopt.h \
2674 glob.h \
2675 gnumalloc.h \
2676 grp.h \
3680cc44
FC
2677 ipl.h \
2678 lber.h \
2679 ldap.h \
2680 libc.h \
2681 limits.h \
2682 linux/posix_types.h \
2683 linux/types.h \
3680cc44 2684 malloc.h \
3680cc44
FC
2685 math.h \
2686 memory.h \
2687 mount.h \
2688 netdb.h \
2689 netinet/in.h \
2690 netinet/in_systm.h \
3680cc44 2691 netinet/tcp.h \
3680cc44
FC
2692 paths.h \
2693 poll.h \
321223fe 2694 priv.h \
3680cc44 2695 pwd.h \
c2afddd8 2696 regex.h \
3680cc44 2697 sched.h \
2ccf2eb2 2698 siginfo.h \
3680cc44 2699 signal.h \
3680cc44
FC
2700 stdarg.h \
2701 stddef.h \
3680cc44
FC
2702 stdio.h \
2703 stdlib.h \
3680cc44
FC
2704 string.h \
2705 strings.h \
2706 sys/bitypes.h \
3680cc44
FC
2707 sys/file.h \
2708 sys/ioctl.h \
d440d5a4 2709 sys/ipc.cc \
3680cc44
FC
2710 sys/param.h \
2711 sys/prctl.h \
321223fe 2712 sys/procctl.h \
3680cc44 2713 sys/md5.h \
c975f532 2714 sys/mman.h \
3680cc44
FC
2715 sys/msg.h \
2716 sys/resource.h \
2ccf2eb2 2717 sys/select.h \
d440d5a4 2718 sys/shm.h \
3680cc44
FC
2719 sys/socket.h \
2720 sys/stat.h \
3680cc44
FC
2721 syscall.h \
2722 sys/syscall.h \
2723 sys/time.h \
2724 sys/types.h \
2725 sys/uio.h \
2726 sys/un.h \
2727 sys/vfs.h \
2728 sys/wait.h \
2729 syslog.h \
2730 time.h \
2731 unistd.h \
2732 utime.h \
2733 varargs.h \
2734 byteswap.h \
2735 glib.h \
2736 stdint.h \
2737 inttypes.h \
cdb86165 2738 wchar.h
db40ae20 2739)
3c586e38 2740
ee80a919
AR
2741AC_CHECK_HEADERS( \
2742 linux/netfilter_ipv4.h \
2743 linux/netfilter_ipv6/ip6_tables.h \
fc68f6b1 2744,,,
dcd1dc78 2745SQUID_DEFAULT_INCLUDES
2746#if HAVE_LIMITS_H
2747#include <limits.h>
2748#endif
a74968c2
AJ
2749/* Netfilter ip(6)tables v1.4.0 has broken headers */
2750#if HAVE_NETINET_IN_H
2751#include <netinet/in.h>
2752#endif
dcd1dc78 2753)
2754
61beade2 2755dnl *BSD do not include the dependencies for all their net/ and netinet/ files
c92b4732 2756dnl We must include a few basic type headers for them to work.
d1e5191e 2757AC_CHECK_HEADERS( \
0c0d381b
FC
2758 net/if.h \
2759 netinet/if_ether.h\
2760 netinet/icmp6.h \
2761 netinet/in.h \
2762 netinet/ip.h \
2763 netinet/ip6.h \
0c0d381b
FC
2764 netinet/ip_icmp.h \
2765 netinet/ipl.h \
0c0d381b
FC
2766 net/pf/pfvar.h \
2767 net/pfvar.h \
2768 sys/mount.h\
2769 resolv.h \
d1e5191e
AJ
2770,,,
2771SQUID_BSDNET_INCLUDES)
5a3237b0 2772
aee0606f 2773AC_C_CONST
d57288d2 2774AC_C_BIGENDIAN
aee0606f 2775
6a9f6389 2776AC_STRUCT_TM
2777AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2778#if TM_IN_SYS_TIME
2779#if HAVE_SYS_TIME_H
2780#include <sys/time.h>
2781#endif
2782#elif HAVE_TIME_H
2783#include <time.h>
2784#endif
5c51415d 2785])
46c883ed 2786
08caf8c6 2787dnl Override rusage() detect on MinGW because is emulated in source code
78a60bca
AJ
2788case "$squid_host_os" in
2789 mingw)
08caf8c6 2790 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2791 ac_cv_func_getrusage='yes'
eed82608 2792 AC_MSG_NOTICE([Using own rusage on Windows.])
08caf8c6 2793 ;;
9603207d 2794 *)
08caf8c6 2795 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 2796#if HAVE_SYS_TIME_H
2797#include <sys/time.h>
2798#endif
b54a6789 2799#if HAVE_SYS_RESOURCE_H
2800#include <sys/resource.h>
6a9f6389 2801#endif])
08caf8c6 2802 ;;
2803esac
b54a6789 2804
6a9f6389 2805AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2806#if HAVE_SYS_TYPES_H
2807#include <sys/types.h>
2808#endif
a025a745 2809#include <netinet/in.h>
2810#include <netinet/in_systm.h>
6ad85e8a 2811#include <netinet/ip.h>
b05490a8 2812#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 2813#define ip_hl ihl
2814#endif
2815#ifndef __linux__
b05490a8 2816#ifndef __CYGWIN__
6ad85e8a 2817#define iphdr ip
b05490a8 2818#endif
6a9f6389 2819#endif])
a025a745 2820
090089c4 2821dnl Check for typedefs
77d6bd88 2822AC_CHECK_SIZEOF(void *)
090089c4 2823
41aa7d00
FC
2824# check for a bunch of types
2825AC_TYPE_INT8_T
2826AC_TYPE_UINT8_T
2827AC_TYPE_INT16_T
2828AC_TYPE_UINT16_T
2829AC_TYPE_INT32_T
2830AC_TYPE_UINT32_T
2831AC_TYPE_INT64_T
2832AC_TYPE_UINT64_T
2833AC_TYPE_PID_T
2834AC_TYPE_SIZE_T
2835AC_TYPE_SSIZE_T
2836AC_TYPE_OFF_T
2837AC_TYPE_UID_T
59a09b98 2838AC_CHECK_TYPE([bool])
41aa7d00
FC
2839#need the defines for PRId64
2840AC_CHECK_SIZEOF(int64_t)
2841AC_CHECK_SIZEOF(long)
fe1e5c91
AJ
2842#need the defines for PRIuSIZE
2843AC_CHECK_SIZEOF(size_t)
50f9c873
AR
2844#need the define for overflow checks
2845AC_CHECK_SIZEOF(off_t)
46e172d9 2846AC_CHECK_SIZEOF(size_t)
6a9f6389 2847
249b93df 2848dnl Some C++11 types we try to use
249b93df 2849AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS
2fefc43c 2850SQUID_CXX_STD_UNDERLYING_TYPE
1dde4660 2851SQUID_CXX_STD_IS_TRIVIALLY_COPYABLE
a203dec7 2852
588e71df 2853dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2854dnl that is incompatible with the updated Solaris header files.
2855dnl For this reason, we must check if pad128_t and upad128_t are defined.
2856AC_CHECK_TYPE(pad128_t,
2857 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2858 ,SQUID_DEFAULT_INCLUDES)
2859
2860AC_CHECK_TYPE(upad128_t,
2861 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2862 ,SQUID_DEFAULT_INCLUDES)
2863
6a9f6389 2864AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2865AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 2866
6a9f6389 2867AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2868#include <sys/types.h>
6637e3a5 2869#include <sys/socket.h>
2870#if STDC_HEADERS
2871#include <stdlib.h>
2872#include <stddef.h>
6a9f6389 2873#endif])
6637e3a5 2874
cdb352bb
FC
2875AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
2876 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
2877#include <sys/ipc.h>
2878#include <sys/msg.h>])
2879
f367e6af
AJ
2880AC_CHECK_TYPE(cpu_set_t,
2881 AC_DEFINE(HAVE_CPU_SET_T,1,[cpu_set_t is defined by the system headers]),,[
2882#if HAVE_SCHED_H
2883#include <sched.h>
2884#endif
2885])
2886
fe1e5c91
AJ
2887# check for compiler support of %zu printf macro
2888AH_TEMPLATE(PRIuSIZE,[Compiler supports %zu printf macro])
2889AC_MSG_CHECKING([for compiler %zu support])
2890AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2891#include <stdio.h>
2892 ]],[[size_t n=1;printf("%zu",n);]])],[
2893 AC_DEFINE(PRIuSIZE,"zu")
2894 AC_MSG_RESULT(yes)
2895 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
2896
2897
cdb352bb
FC
2898dnl Check for special functions
2899AC_FUNC_ALLOCA
2900
2901
24531401
AJ
2902# TODO: remove this 'lib' prefix to match coding standard
2903SQUID_AUTO_LIB(libcap,[Linux capabilities],[LIBCAP])
45c41a07 2904if test "x$with_libcap" != "xno"; then
24531401
AJ
2905 CXXFLAGS="$LIBCAP_CFLAGS $CXXFLAGS"
2906 LDFLAGS="$LIBCAP_PATH $LDFLAGS"
b64b6030 2907 # cap_clear_flag is the most recent libcap function we require
45c41a07 2908 AC_CHECK_HEADERS(sys/capability.h)
b64b6030 2909 AC_CHECK_LIB(cap, cap_clear_flag)
45c41a07
FC
2910 SQUID_CHECK_FUNCTIONAL_LIBCAP2
2911
2912 # if it can't be supported..
35e2b2e5 2913 if test "x$ac_cv_header_sys_capability_h" = "xno" -o \
46f50de9 2914 "x$ac_cv_lib_cap_cap_clear_flag" = "xno"; then
45c41a07 2915 # and it was forced on: error
46f50de9 2916 if test "x$with_libcap" = "xyes" ; then
ff8d255b 2917 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
3fbda12c
FC
2918 else
2919 # with_libcap is "auto"; it can't be supported. Disable.
2920 with_libcap=no
b64b6030 2921 fi
45c41a07
FC
2922 else
2923 # header and lib are ok, we support
2924 with_libcap=yes
b64b6030 2925 fi
69367152 2926
b50f1b2b 2927fi
5b43d209 2928
45c41a07
FC
2929SQUID_DEFINE_BOOL(USE_LIBCAP,$with_libcap,
2930 [use libcap to set capabilities required for TPROXY])
2931AC_MSG_NOTICE([libcap support enabled: $with_libcap])
2932SQUID_DEFINE_BOOL(LIBCAP_BROKEN,${squid_cv_sys_capability_works:=no},
2933 [libcap2 headers are broken and clashing with glibc])
2934AC_MSG_NOTICE([libcap2 headers are ok: $squid_cv_sys_capability_works])
2935
b64b6030 2936
090089c4 2937dnl Check for needed libraries
54c95954 2938AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
819656da
AJ
2939AC_SEARCH_LIBS([res_init],[resolv])
2940AC_SEARCH_LIBS([__res_search],[resolv])
54c95954
FC
2941AC_SEARCH_LIBS([bind],[socket])
2942AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
85cd85f3 2943AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
bfe8dedf 2944dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
0c0d381b
FC
2945if test "x$squid_host_os" = "xmingw" ; then
2946 SQUID_CHECK_WINSOCK_LIB
32341684
AJ
2947 AC_CHECK_HEADERS( \
2948 windows.h \
2949 ws2tcpip.h \
b966288b 2950 iphlpapi.h ,,,[
2ff9dfaa
AJ
2951#if HAVE_WINSOCK2_H
2952#include <winsock2.h>
2953#endif
32341684
AJ
2954#if HAVE_WINDOWS_H
2955#include <windows.h>
2956#endif
2ff9dfaa
AJ
2957#if HAVE_WS2TCPIP_H
2958#include <ws2tcpip.h>
2959#endif
2960])
0c0d381b 2961fi
94d48591 2962
46f50de9
FC
2963# check that we have unix sockets
2964SQUID_CHECK_UNIX_SOCKET
2965SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
2966
2967AC_CHECK_LIB(gnumalloc, malloc)
2968if test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"; then
ef7ece58 2969 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
46f50de9
FC
2970 ac_cv_func_mallocblksize=no
2971 ac_cv_func_mallopt=no
2972else
2973 case "$squid_host_os" in
2974 solaris)
2975 AC_MSG_NOTICE([skipping libmalloc check for $host])
2976 ;;
2977 freebsd)
2978 AC_MSG_NOTICE([skipping libmalloc check for $host])
2979 ;;
2980 *)
9837567d 2981 # XXX: used later
46f50de9
FC
2982 AC_CHECK_LIB(malloc, main)
2983 ;;
cdb352bb
FC
2984 esac
2985fi
94d48591 2986
78a60bca
AJ
2987case "$squid_host_os" in
2988 mingw)
2989 AC_MSG_NOTICE([Use MSVCRT for math functions.])
2990 ;;
2991 *)
23d0a396 2992 dnl log() are only used in old C code for now.
78a60bca 2993 AC_LANG_PUSH([C])
78a60bca
AJ
2994 AC_SEARCH_LIBS([log],[m])
2995 AC_LANG_POP([C])
2996 ;;
08caf8c6 2997esac
090089c4 2998
f467f578
FC
2999dnl --with-maxfd present for compatibility with Squid-2.
3000dnl undocumented in ./configure --help to encourage using the Squid-3 directive
3001AC_ARG_WITH(maxfd,,
9603207d 3002[
f467f578
FC
3003 case ${withval} in
3004 [[0-9]]*)
3005 squid_filedescriptors_num=$withval
acea95af 3006 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
f467f578
FC
3007 ;;
3008 *)
3009 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
3010 ;;
3011 esac
055421ee 3012])
001ad4cc 3013
f467f578
FC
3014AC_ARG_WITH(filedescriptors,
3015 AS_HELP_STRING([--with-filedescriptors=NUMBER],
3016 [Force squid to support NUMBER filedescriptors]),
9603207d 3017[
f467f578
FC
3018 case ${withval} in
3019 [[0-9]]*)
3020 squid_filedescriptors_num=$withval
acea95af 3021 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
f467f578
FC
3022 ;;
3023 *)
3024 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
3025 ;;
3026 esac
001ad4cc 3027])
f467f578
FC
3028
3029SQUID_CHECK_DEFAULT_FD_SETSIZE
acea95af 3030SQUID_CHECK_MAXFD
001ad4cc 3031
f467f578 3032
001ad4cc
AJ
3033dnl Enable IPv6 support
3034AC_MSG_CHECKING([whether to enable IPv6])
001ad4cc 3035AC_ARG_ENABLE(ipv6,
af494bc8
FC
3036 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
3037SQUID_YESNO([$enableval],[unrecognized argument to --disable-ipv6: $enableval])
001ad4cc 3038])
7d927f1f
AJ
3039AC_MSG_RESULT(${enable_ipv6:=yes})
3040SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
001ad4cc 3041
7d927f1f 3042if test "x$enable_ipv6" = "xyes" ; then
af494bc8 3043 SQUID_CHECK_SIN6_LEN_IN_SAI
001ad4cc 3044fi
7d553ad9
AJ
3045SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
3046SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
001ad4cc 3047
77f675ad 3048dnl System-specific library modifications
3049dnl
057a3cf3 3050AH_TEMPLATE(GETTIMEOFDAY_NO_TZP,[If gettimeofday is known to take only one argument])
77f675ad 3051case "$host" in
fcabe077
FC
3052 i386-*-solaris2.*)
3053 if test "x$GCC" = "xyes"; then
3054 AC_MSG_NOTICE([Removing -O for gcc on $host])
d0441961 3055 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
fcabe077
FC
3056 fi
3057 ;;
141eb4a6 3058
fcabe077
FC
3059 *-sgi-irix*)
3060 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
3061 LIBS=`echo $LIBS | sed -e s/-lsocket//`
3062 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
3063 LIBS=`echo $LIBS | sed -e s/-lnsl//`
3064 ac_cv_lib_nsl_main=no
fcabe077 3065 ;;
fcabe077 3066 *-ibm-aix*)
3e1ce596
KB
3067 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
3068#include <assert.h>
3069#ifndef NULL
3070#define NULL 0
3071#endif
3072class Foo{
3073public:virtual ~Foo(){}
3074};
3075class Bar:public Foo{
3076public:Bar():Foo(){}
3077};
3078 ]],[[
3079Foo * myFoo=new Bar();
3080Bar * myBar=dynamic_cast<Bar *>(myFoo);
3081assert(myBar != NULL);
3082 ]])
3083 if test "$ac_cv_require_rtti" = "yes"; then
3084 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
3085 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
fcabe077 3086 fi
3e1ce596
KB
3087
3088 AC_LANG_PUSH([C])
3089 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
fcabe077 3090 AC_LANG_POP([C])
3e1ce596
KB
3091 if test "$ac_cv_require_qcpluscmt" = "yes"; then
3092 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
3093 fi
fcabe077 3094 ;;
3e1ce596 3095
fcabe077
FC
3096 [*-*-solaris2.[0-4]])
3097 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
3098 ;;
3099 [*-sony-newsos[56]*])
3100 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
3101 ;;
3102 esac
090089c4 3103
84cecfd2 3104dnl This has to be before AC_CHECK_FUNCS
3105# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
3106# when running configure.
fcabe077
FC
3107if test "x$ac_cv_func_poll" = "x" ; then
3108 case "$host" in
3109 [*-hp-hpux*.*])
3110 # Duane Wessels
3111 AC_MSG_NOTICE([disabling poll for $host...])
3112 ac_cv_func_poll='no'
3113 ;;
3114 [*-linux-*])
3115 # Henrik Nordstrom (hno@squid-cache.org) 19980817
3116 # poll is problematic on Linux. We disable it
3117 # by default until Linux gets it right.
3118 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
3119 if test $rev -lt 002002; then
3120 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
3121 ac_cv_func_poll='no'
3122 fi
3123 ;;
3124 [powerpc-ibm-aix4.1.*])
3125 # Mike Laster (mlaster@metavillage.com) 19981021
3126 AC_MSG_NOTICE([disabling poll for $host...])
3127 ac_cv_func_poll='no'
3128 ;;
fcabe077 3129 esac
84cecfd2 3130fi
176d10ee 3131
6716b242 3132dnl Check for library functions
3133AC_CHECK_FUNCS(\
ce3d30fb 3134 backtrace_symbols_fd \
3a144521 3135 bcopy \
4de1e2da 3136 eui64_aton \
4ac29a5b 3137 fchmod \
6716b242 3138 getdtablesize \
8505e57b 3139 getpagesize \
230c091c 3140 getpass \
30a4f2a8 3141 getrusage \
9c1d8929 3142 getspnam \
379d5751 3143 gettimeofday \
52303a3d 3144 glob \
0f5efab0 3145 mallocblksize \
6716b242 3146 mallopt \
2ae6b9b0 3147 memcpy \
30a4f2a8 3148 memmove \
ee4d4e85 3149 memrchr \
dac27377 3150 memset \
b99a6dec 3151 mkstemp \
1812b6c7 3152 mktime \
88738790 3153 mstats \
84cecfd2 3154 poll \
62ae0622 3155 prctl \
321223fe 3156 procctl \
3a144521 3157 pthread_attr_setschedparam \
cd748f27 3158 pthread_attr_setscope \
3159 pthread_setschedparam \
42b51993 3160 pthread_sigmask \
c68e9c6b 3161 putenv \
c2afddd8
AJ
3162 regcomp \
3163 regexec \
3164 regfree \
819656da
AJ
3165 res_init \
3166 __res_init \
4915be3b 3167 rint \
96c2bb61
AR
3168 sched_getaffinity \
3169 sched_setaffinity \
3a144521 3170 select \
234967c9 3171 seteuid \
c415c128 3172 setgroups \
321223fe 3173 setpflags \
30a4f2a8 3174 setpgrp \
30a4f2a8 3175 setsid \
3176 sigaction \
11430c03 3177 snprintf \
1ccc0d40 3178 socketpair \
6716b242 3179 sysconf \
3180 syslog \
234967c9 3181 timegm \
28da5e0d 3182 vsnprintf \
6716b242 3183)
f5e5c4cf 3184dnl ... and some we provide local replacements for
3185AC_REPLACE_FUNCS(\
f5e5c4cf 3186 initgroups \
2ccf2eb2 3187 psignal \
f5e5c4cf 3188 strerror \
585cddda 3189 strtoll \
f5e5c4cf 3190 tempnam \
3191)
6716b242 3192
dfb96b6b 3193AC_CHECK_DECLS([getaddrinfo,getnameinfo,inet_ntop,inet_pton,InetNtopA,InetPtonA],,,[
55d7d5e9
AJ
3194/*
3195 * BSD requires sys/types.h, sys/socket.h, netinet/in.h, netdb.h, arpa/inet.h
3196 * Linux requires sys/types.h, sys/socket.h, arpa/inet.h
3197 * Windows requires sys/socket.h, winsock2.h, ws2tcpip.h
3198 */
3199#if HAVE_SYS_TYPES_H
3200#include <sys/types.h>
3201#endif
3202#if HAVE_NETINET_IN_H
3203#include <netinet/in.h>
3204#endif
3205#if HAVE_SYS_SOCKET_H
3206#include <sys/socket.h>
3207#endif
3208#if HAVE_NETDB_H
3209#include <netdb.h>
3210#endif
3211#if HAVE_ARPA_INET_H
3212#include <arpa/inet.h>
3213#endif
3214#if HAVE_WINSOCK2_H
3215#include <winsock2.h>
3216#endif
3217#if HAVE_WS2TCPIP_H
3218#include <ws2tcpip.h>
3219#endif
3220])
3221
9676633b
FC
3222# Magic which checks whether we are forcing a type of comm loop we
3223# are actually going to (ab)use.
3224# Mostly ripped from squid-commloops, thanks to adrian and benno
1b3db6d9 3225
fcabe077 3226if test "x$squid_opt_io_loop_engine" != "x"; then
8075a4da 3227 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine])
fcabe077 3228elif test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes" ; then
8075a4da 3229 squid_opt_io_loop_engine="epoll"
26d50fd2 3230elif test "x$enable_kqueue" != "xno" ; then
8075a4da 3231 squid_opt_io_loop_engine="kqueue"
a1ad2f9b
AJ
3232elif test "x$enable_devpoll" != "xno" ; then
3233 squid_opt_io_loop_engine="devpoll"
fcabe077 3234elif test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes" ; then
8075a4da 3235 squid_opt_io_loop_engine="poll"
39145d19 3236elif test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"; then
8075a4da 3237 squid_opt_io_loop_engine="select"
39145d19
AJ
3238elif test "x$enable_select" != "xno" -a "x$squid_host_os" = "xmingw"; then
3239 squid_opt_io_loop_engine="select_win32"
1b3db6d9 3240else
a1ad2f9b 3241 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
be0c7ff0 3242 AC_MSG_WARN([Will try select and hope for the best.])
8075a4da 3243 squid_opt_io_loop_engine="select"
1b3db6d9 3244fi
d474c7a6 3245
8075a4da 3246AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
d474c7a6 3247
8aafbbc1
AJ
3248AM_CONDITIONAL(ENABLE_POLL, test "x$squid_opt_io_loop_engine" = "xpoll")
3249AM_CONDITIONAL(ENABLE_EPOLL, test "x$squid_opt_io_loop_engine" = "xepoll")
3250AM_CONDITIONAL(ENABLE_SELECT, test "x$squid_opt_io_loop_engine" = "xselect")
3251AM_CONDITIONAL(ENABLE_SELECT_WIN32, test "x$squid_opt_io_loop_engine" = "xselect_win32")
3252AM_CONDITIONAL(ENABLE_KQUEUE, test "x$squid_opt_io_loop_engine" = "xkqueue")
3253AM_CONDITIONAL(ENABLE_DEVPOLL, test "x$squid_opt_io_loop_engine" = "xdevpoll")
d474c7a6 3254
8075a4da 3255case $squid_opt_io_loop_engine in
0abb39dd 3256 epoll) AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop]) ;;
a1ad2f9b 3257 devpoll) AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop]) ;;
0abb39dd
FC
3258 poll) AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop]) ;;
3259 kqueue) AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop]) ;;
3260 select_win32) AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop]) ;;
3261 select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
d474c7a6 3262esac
1b3db6d9 3263
96c2bb61
AR
3264if test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes" ; then
3265 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
3266fi
3267
91983da0
FC
3268SQUID_CHECK_SETRESUID_WORKS
3269if test "x$squid_cv_resuid_works" = "xyes" ; then
be0c7ff0 3270 AC_DEFINE(HAVE_SETRESUID,1,[Yay! Another Linux brokenness. Knowing that setresuid() exists is not enough, because RedHat 5.0 declares setresuid() but does not implement it.])
5c51415d 3271fi
60939927 3272
2ff9dfaa 3273AC_CHECK_HEADERS(mswsock.h)
14c0d3ab
DK
3274AC_MSG_CHECKING([for constant CMSG_SPACE])
3275AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3276 #if HAVE_SYS_SOCKET_H
3277 #include <sys/socket.h>
3278 #endif
2ff9dfaa
AJ
3279 #if HAVE_MSWSOCK_H
3280 #include <mswsock.h>
3281 #endif
14c0d3ab
DK
3282
3283 int a[CMSG_SPACE(int)];
3284]])], [
3285 AC_MSG_RESULT(yes)
3286 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
3287], [
3288 AC_MSG_RESULT(no)
3289])
3290
ecd8516d 3291AC_CHECK_TYPE(struct cmsghdr,AC_DEFINE(HAVE_CMSGHDR,1,[The system provides struct cmsghdr]),,[
c72f8c2e
AJ
3292 #if HAVE_SYS_SOCKET_H
3293 #include <sys/socket.h>
3294 #endif
2ff9dfaa
AJ
3295 #if HAVE_MSWSOCK_H
3296 #include <mswsock.h>
3297 #endif
c72f8c2e
AJ
3298 #if HAVE_WINSOCK2_H
3299 #include <winsock2.h>
3300 #endif
3301])
3302
ecd8516d 3303AC_CHECK_TYPE(struct iovec,AC_DEFINE(HAVE_IOVEC,1,[The system provides struct iovec]),,[
c72f8c2e
AJ
3304 #if HAVE_SYS_SOCKET_H
3305 #include <sys/socket.h>
3306 #endif
3307 #if HAVE_WINSOCK2_H
3308 #include <winsock2.h>
3309 #endif
9ac84dcf
FC
3310 #if HAVE_SYS_UIO_H
3311 #include <sys/uio.h>
3312 #endif
c72f8c2e
AJ
3313])
3314
ecd8516d 3315AC_CHECK_TYPE(struct msghdr,AC_DEFINE(HAVE_MSGHDR,1,[The system provides struct msghdr]),,[
c72f8c2e
AJ
3316 #if HAVE_SYS_SOCKET_H
3317 #include <sys/socket.h>
3318 #endif
2ff9dfaa
AJ
3319 #if HAVE_MSWSOCK_H
3320 #include <mswsock.h>
3321 #endif
c72f8c2e
AJ
3322 #if HAVE_WINSOCK2_H
3323 #include <winsock2.h>
3324 #endif
3325])
3326
ecd8516d 3327AC_CHECK_TYPE(struct sockaddr_un,AC_DEFINE(HAVE_SOCKADDR_UN,1,[The system provides sockaddr_un]),,[
c72f8c2e
AJ
3328 #if HAVE_SYS_UN_H
3329 #include <sys/un.h>
3330 #endif
3331 #if HAVE_SYS_SOCKET_H
3332 #include <sys/socket.h>
3333 #endif
3334 #if HAVE_WINSOCK2_H
3335 #include <winsock2.h>
3336 #endif
3337])
3338
0abb39dd 3339SQUID_CHECK_FUNC_STRNSTR
cee08cbc 3340
5cafc1d6 3341dnl IP-Filter support requires ipf header files. These aren't
3342dnl installed by default, so we need to check for them
fcabe077 3343if test "x$enable_ipf_transparent" != "xno" ; then
d25bbe26 3344 SQUID_CHECK_BROKEN_SOLARIS_IPFILTER
20ad76ab 3345 AC_MSG_CHECKING(for availability of IP-Filter header files)
42b51993 3346 # hold on to your hats...
fcabe077
FC
3347 if test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
3348 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
3349 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
3350 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes" ; then
42b51993 3351 have_ipfilter_compat_header="yes"
d25bbe26
AJ
3352 fi
3353 if test "x$have_ipfilter_compat_header" = "xyes" -a \
fcabe077
FC
3354 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
3355 "x$ac_cv_header_ip_nat_h" = "xyes" ; then
1d26e252 3356 enable_ipf_transparent="yes"
fcabe077
FC
3357 elif test "x$have_ipfilter_compat_header" = "xyes" -a \
3358 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
3359 "x$ac_cv_header_netinet_ip_nat_h" = "xyes" ; then
1d26e252 3360 enable_ipf_transparent="yes"
eb824054 3361 else
1d26e252 3362 enable_ipf_transparent="no"
5cafc1d6 3363 fi
3364 AC_MSG_RESULT($IPF_TRANSPARENT)
d25bbe26
AJ
3365
3366## On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3367## Solaris minor version (8, 9, 10, ...)
3368 if test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris" ; then
3369 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3370 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3371 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
3372 fi
3373
1d26e252
FC
3374fi
3375AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
0f658b5b 3376SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
1d26e252
FC
3377 [Enable support for IPF-style transparent proxying])
3378
b2192042
AJ
3379dnl PF /dev/pf support requires a header file.
3380if test "x$with_nat_devpf" != "xno" ; then
fcabe077
FC
3381 if test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
3382 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"; then
b2192042
AJ
3383 if test "x$with_nat_devpf" = "xauto" ; then
3384 with_nat_devpf="no"
fcabe077
FC
3385 fi
3386 else
b2192042
AJ
3387 if test "x$with_nat_devpf" = "xyes" ; then
3388 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
fcabe077 3389 fi
b2192042 3390 with_nat_devpf="no"
fcabe077 3391 fi
2b0dd4ac 3392fi
b2192042 3393SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
38ff0a40 3394 [Enable support for PF-style transparent proxying])
b2192042
AJ
3395SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
3396 [Enable support for /dev/pf NAT lookups])
2b0dd4ac 3397
fcabe077
FC
3398if test "x$enable_linux_netfilter" != "xno" ; then
3399 if test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"; then
3400 if test "x$enable_linux_netfilter" = "xauto" ; then
4bd144d2
FC
3401 enable_linux_netfilter=yes
3402 fi
3403 else
fcabe077 3404 if test "x$enable_linux_netfilter" = "xauto" ; then
4bd144d2 3405 enable_linux_netfilter=no
d852fbad 3406 else
4bd144d2 3407 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
d852fbad 3408 fi
4bd144d2 3409 fi
b50f1b2b 3410fi
0f658b5b 3411SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
969d4051 3412 [Enable support for Transparent Proxy on Linux via Netfilter])
20ad76ab 3413
b50f1b2b 3414dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
4bd144d2 3415AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
fcabe077 3416if test "x$enable_linux_netfilter" = "xyes" -a "x$with_libcap" != "xyes" ; then
3b7a7630
AJ
3417 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
3418 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
3419 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
be0c7ff0 3420 # AC_DEFINEd later
96f08e2d 3421fi
11e8cfe3 3422if test "x$with_netfilter_conntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3b7a7630 3423 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
11e8cfe3
AB
3424 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
3425 with_netfilter_conntrack=no
3426fi
24531401 3427AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack}])
11e8cfe3
AB
3428
3429
3430AC_ARG_ENABLE(zph-qos,
6c83720b 3431 AS_HELP_STRING([--disable-zph-qos],[Disable ZPH QOS support]), [
11e8cfe3
AB
3432SQUID_YESNO([$enableval],
3433 [unrecognized argument to --enable-zph-qos: $enableval])
3434])
3435SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
3436 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
3437 TOS field of HIT responses to help policing network traffic])
3438AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
3439if test x"$enable_zph_qos" = "xyes" ; then
3440 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
3441 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
3442 [Enable support for QOS netfilter mark preservation])
3443fi
3444
c2afddd8
AJ
3445
3446AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
3447AC_ARG_ENABLE(gnuregex,
3448 AS_HELP_STRING([--enable-gnuregex],
9603207d 3449 [Compile GNUregex. Unless you have reason to use
c2afddd8 3450 this option, you should not enable it.
9603207d 3451 This library file is usually only required on Windows and
3452 very old Unix boxes which do not have their own regex
c2afddd8
AJ
3453 library built in.]), [
3454SQUID_YESNO([$enableval],[unrecognized argument to --enable-gnuregex: $enableval])
3455])
c633a6b0 3456# force-enable on old solaris
c2afddd8
AJ
3457if test "x${enable_gnuregex:=auto}" = "xauto" ; then
3458 case "$host" in
3459 *-sun-solaris2.[[0-4]])
3460 enable_gnuregex="yes"
3461 ;;
c2afddd8
AJ
3462 esac
3463fi
3464
3465# try detecting if it is needed
3466if test "x$enable_gnuregex" = "xauto" ; then
3467 SQUID_CHECK_REGEX_WORKS
3468 if test "x$squid_cv_regex_works" = "xyes" ; then
3469 enable_gnuregex=no
3470 else
3471 enable_gnuregex=yes
3472 fi
3473fi
3474AC_MSG_CHECKING(if GNUregex needs to be compiled)
3475AC_MSG_RESULT($enable_gnuregex)
3476if test "x$enable_gnuregex" = "xyes"; then
3477 # for some reason (force-enable, test..) gnuregex was found as needed. Override any system lib
3478 REGEXLIB=""
3479fi
3480#if no reason was found to enable gnuregex, disable it
3481if test "x$enable_gnuregex" = "xauto" ; then
3482 enable_gnuregex=no
3483fi
3484SQUID_DEFINE_BOOL(USE_GNUREGEX,$enable_gnuregex,[Define if we should use GNU regex])
3485AC_SUBST(REGEXLIB)
3486
8e0acaf5
FC
3487SQUID_DETECT_UDP_SND_BUFSIZE
3488SQUID_DETECT_UDP_RECV_BUFSIZE
3489SQUID_DETECT_TCP_SND_BUFSIZE
3490SQUID_DETECT_TCP_RECV_BUFSIZE
6bf65235 3491
fa8be5b5 3492SQUID_CHECK_RECV_ARG_TYPE
5c3c56fa
FC
3493SQUID_CHECK_NEED_SYS_ERRLIST
3494SQUID_CHECK_MAXPATHLEN
cc192b50 3495
819656da
AJ
3496SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
3497SQUID_CHECK_RESOLVER_FIELDS
3498
615540cd 3499AC_CHECK_HEADERS(sys/statvfs.h)
fcabe077 3500if test "x$ac_cv_header_sys_statvfs_h" = "xyes" ; then
bb214e97 3501 SQUID_CHECK_WORKING_STATVFS
c68e9c6b 3502fi
615540cd
AJ
3503if test "x$ac_cv_func_statvfs" != "xyes" ; then
3504 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/vfs.h sys/statfs.h)
3505 AC_CHECK_FUNCS(statfs)
3506 SQUID_CHECK_F_FRSIZE_IN_STATFS
3507fi
c68e9c6b 3508
4eb85b7a 3509dnl Squid will not usually attempt to translate templates when building
461b8219 3510AC_ARG_ENABLE(translation,
4eb85b7a 3511 AS_HELP_STRING([--enable-translation],[Generate the localized error page templates and manuals.
9603207d 3512 Which can also be downloaded from http://www.squid-cache.org/Versions/langpack/.]), [
4eb85b7a
AJ
3513 SQUID_YESNO([$enableval],
3514 [unrecognized argument to --enable-translation: $enableval])
461b8219 3515])
4eb85b7a 3516if test "x${enable_translation:=no}" = "xyes" ; then
461b8219 3517 AX_WITH_PROG([PO2HTML],[po2html])
02259ff8 3518 AX_WITH_PROG([PO2TEXT],[po2txt])
461b8219
AJ
3519else
3520 PO2HTML="off"
02259ff8 3521 PO2TEXT="off"
461b8219
AJ
3522fi
3523AC_SUBST(PO2HTML)
02259ff8 3524AC_SUBST(PO2TEXT)
d146da3b 3525AM_CONDITIONAL(ENABLE_TRANSLATION, test "x${enable_translation:=no}" = "xyes")
ee1a8ac2 3526
43000484
AJ
3527dnl Squid now has limited locale handling ...
3528dnl on error pages
3529AC_ARG_ENABLE(auto-locale,
62979ab1 3530 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
21d5413e 3531 clients request headers.
fb46b778
FC
3532 When disabled Squid requires explicit language configuration.]), [
3533SQUID_YESNO([$enableval],
3534 [unrecognized argument to --disable-auto-locale: $enableval])
8db7a54b 3535])
fb46b778
FC
3536AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
3537SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
3538 [Use multi-language support on error pages])
3539
43000484 3540
090089c4 3541dnl Need the debugging version of malloc if available
3542XTRA_OBJS=''
fcabe077 3543if test "x$ac_cv_lib_malloc_main" = "xyes" ; then
090089c4 3544 if test -r /usr/lib/debug/malloc.o ; then
3545 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3546 fi
3547 if test -r /usr/lib/debug/mallocmap.o ; then
3548 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3549 fi
3550fi
3551AC_SUBST(XTRA_OBJS)
3552
fcabe077 3553if test "x$XTRA_LIBS" = "x"; then
38fea766 3554 XTRA_LIBS="$LIBS"
0f5a16f8 3555 dnl minor cleanup
3556 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 3557 LIBS=''
3558fi
090089c4 3559AC_SUBST(XTRA_LIBS)
3560
daed6927
FC
3561AC_SUBST(SQUID_CFLAGS)
3562AC_SUBST(SQUID_CXXFLAGS)
3563
b2f0a375
AJ
3564AC_ARG_VAR([BUILDCXXFLAGS],[C++ compiler flags for building compile-time tools. e.g. cf_gen])
3565if test "x$BUILDCXXFLAGS" = "x"; then
3566 # if we are NOT cross-compiling, use the default build flags for cf_gen and friends
3567 # otherwise rely on the user-provided value
3568 if test "x$squid_cv_check_marchnative" = "xyes"; then
3569 # always valid for the Build compiler.
b3080eec 3570 BUILDCXXFLAGS="-march=native"
b2f0a375
AJ
3571 fi
3572 BUILDCXXFLAGS="$BUILDCXXFLAGS $CXXFLAGS"
3573fi
3574AC_SUBST(BUILDCXXFLAGS)
3575
90b412dd
AJ
3576AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
3577AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
3578AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
3579AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
3580AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
3581AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
3582AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
3583AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
b2f0a375 3584AC_MSG_NOTICE([BUILD Tools C++ FLAGS: $BUILDCXXFLAGS])
daed6927 3585
090089c4 3586dnl Clean up after OSF/1 core dump bug
9603207d 3587rm -f core
090089c4 3588
7a03447c
AJ
3589AC_CONFIG_FILES([
3590 Makefile
3591 compat/Makefile
7a03447c 3592 contrib/Makefile
7a03447c
AJ
3593 doc/Makefile
3594 doc/manuals/Makefile
86b8d400 3595 doc/release-notes/Makefile
6b99776c 3596 errors/Makefile
6b99776c
AJ
3597 icons/Makefile
3598 lib/Makefile
3599 lib/libTrie/Makefile
3600 lib/libTrie/test/Makefile
3601 lib/ntlmauth/Makefile
6b99776c
AJ
3602 lib/rfcnb/Makefile
3603 lib/smblib/Makefile
3604 lib/snmplib/Makefile
3605 scripts/Makefile
3606 src/Makefile
3607 src/acl/Makefile
e046643f
AJ
3608 src/acl/external/Makefile
3609 src/acl/external/AD_group/Makefile
3610 src/acl/external/delayer/Makefile
3611 src/acl/external/eDirectory_userip/Makefile
3612 src/acl/external/file_userip/Makefile
3613 src/acl/external/kerberos_ldap_group/Makefile
4a544c9d 3614 src/acl/external/kerberos_sid_group/Makefile
e046643f
AJ
3615 src/acl/external/LDAP_group/Makefile
3616 src/acl/external/LM_group/Makefile
3617 src/acl/external/session/Makefile
3618 src/acl/external/SQL_session/Makefile
3619 src/acl/external/unix_group/Makefile
3620 src/acl/external/wbinfo_group/Makefile
3621 src/acl/external/time_quota/Makefile
6b99776c
AJ
3622 src/adaptation/Makefile
3623 src/adaptation/icap/Makefile
3624 src/adaptation/ecap/Makefile
3625 src/anyp/Makefile
3626 src/auth/Makefile
3627 src/auth/basic/Makefile
03901cf8
AJ
3628 src/auth/basic/DB/Makefile
3629 src/auth/basic/fake/Makefile
3630 src/auth/basic/getpwnam/Makefile
3631 src/auth/basic/LDAP/Makefile
3632 src/auth/basic/NCSA/Makefile
3633 src/auth/basic/NIS/Makefile
3634 src/auth/basic/PAM/Makefile
3635 src/auth/basic/POP3/Makefile
3636 src/auth/basic/RADIUS/Makefile
3637 src/auth/basic/SASL/Makefile
3638 src/auth/basic/SMB/Makefile
3639 src/auth/basic/SMB_LM/Makefile
3640 src/auth/basic/SSPI/Makefile
6b99776c 3641 src/auth/digest/Makefile
d4d7f6dd
AJ
3642 src/auth/digest/eDirectory/Makefile
3643 src/auth/digest/file/Makefile
3644 src/auth/digest/LDAP/Makefile
6b99776c 3645 src/auth/negotiate/Makefile
16c02b14
AJ
3646 src/auth/negotiate/kerberos/Makefile
3647 src/auth/negotiate/SSPI/Makefile
3648 src/auth/negotiate/wrapper/Makefile
6b99776c 3649 src/auth/ntlm/Makefile
b817c20f
AJ
3650 src/auth/ntlm/fake/Makefile
3651 src/auth/ntlm/SMB_LM/Makefile
3652 src/auth/ntlm/SSPI/Makefile
6b99776c
AJ
3653 src/base/Makefile
3654 src/clients/Makefile
3655 src/comm/Makefile
675b8408 3656 src/debug/Makefile
4a3b98d7 3657 src/dns/Makefile
13d8c08c 3658 src/DiskIO/Makefile
d9691f09
AJ
3659 src/DiskIO/AIO/Makefile
3660 src/DiskIO/Blocking/Makefile
3661 src/DiskIO/DiskDaemon/Makefile
3662 src/DiskIO/DiskThreads/Makefile
3663 src/DiskIO/IpcIo/Makefile
3664 src/DiskIO/Mmapped/Makefile
83b053a0 3665 src/error/Makefile
6b99776c
AJ
3666 src/esi/Makefile
3667 src/eui/Makefile
3668 src/format/Makefile
3669 src/fs/Makefile
3670 src/ftp/Makefile
3671 src/helper/Makefile
3672 src/http/Makefile
3673 src/http/one/Makefile
d6d6203a
AJ
3674 src/http/url_rewriters/Makefile
3675 src/http/url_rewriters/fake/Makefile
3676 src/http/url_rewriters/LFS/Makefile
6b99776c
AJ
3677 src/icmp/Makefile
3678 src/ident/Makefile
3679 src/ip/Makefile
3680 src/ipc/Makefile
3681 src/log/Makefile
4d5dd85a
AJ
3682 src/log/DB/Makefile
3683 src/log/file/Makefile
6b99776c
AJ
3684 src/mem/Makefile
3685 src/mgr/Makefile
3686 src/parser/Makefile
36c774f7 3687 src/proxyp/Makefile
6b99776c 3688 src/repl/Makefile
65e41a45 3689 src/sbuf/Makefile
7dcca85b 3690 src/security/Makefile
cb0b3d63
AJ
3691 src/security/cert_generators/Makefile
3692 src/security/cert_generators/file/Makefile
bbf79f12
AJ
3693 src/security/cert_validators/Makefile
3694 src/security/cert_validators/fake/Makefile
6b99776c
AJ
3695 src/servers/Makefile
3696 src/snmp/Makefile
3697 src/ssl/Makefile
2745fea5 3698 src/store/Makefile
0c1f8b9b
AJ
3699 src/store/id_rewriters/Makefile
3700 src/store/id_rewriters/file/Makefile
98cacedb 3701 src/time/Makefile
6b99776c 3702 test-suite/Makefile
94ab55b0 3703 tools/Makefile
3d276e1d 3704 tools/apparmor/Makefile
33d1abfe 3705 tools/helper-mux/Makefile
2ccf2eb2 3706 tools/purge/Makefile
a35a0ac7 3707 tools/squidclient/Makefile
422cb5da 3708 tools/systemd/Makefile
a35a0ac7 3709 tools/sysvinit/Makefile
53cbe3e4 3710])
43ae1d95 3711
3e7b6055 3712# must configure libltdl subdir unconditionally for "make distcheck" to work
081863f3 3713#AC_CONFIG_SUBDIRS(libltdl)
3e7b6055 3714
6a9f6389 3715AC_OUTPUT