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