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