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