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