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