]> git.ipfire.org Git - thirdparty/squid.git/blob - configure.ac
Rename ./configure option --with-libcap to --with-cap (#1140)
[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 CPPFLAGS="$LIBXML2_CFLAGS $CPPFLAGS"
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 CPPFLAGS="$LIBXML2_CFLAGS $CPPFLAGS"
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],[LIBSYSTEMD])
1846 AH_TEMPLATE(USE_SYSTEMD,[systemd support is available])
1847 AS_IF([test "x$with_systemd" != "xno"],[
1848 SQUID_STATE_SAVE(squid_systemd_state)
1849 LIBS="$LIBS $LIBSYSTEMD_PATH"
1850 PKG_CHECK_MODULES(LIBSYSTEMD,[libsystemd],,[
1851 # systemd < 209
1852 PKG_CHECK_MODULES(LIBSYSTEMD,[libsystemd-daemon],,[:])
1853 ])
1854 AC_CHECK_HEADERS(systemd/sd-daemon.h)
1855 SQUID_STATE_ROLLBACK(squid_systemd_state)
1856
1857 AS_IF([test "x$LIBSYSTEMD_LIBS" != "x"],[
1858 CXXFLAGS="$LIBSYSTEMD_CFLAGS $CXXFLAGS"
1859 LIBSYSTEMD_LIBS="$LIBSYSTEMD_PATH $LIBSYSTEMD_LIBS"
1860 AC_DEFINE(USE_SYSTEMD,1,[systemd support is available])
1861 ],[test "x$with_systemd" = "xyes"],[
1862 AC_MSG_ERROR([Required systemd library not found])
1863 ],[
1864 AC_MSG_NOTICE([Library for systemd support not found])
1865 ])
1866 ])
1867 AC_MSG_NOTICE([systemd library support: $with_systemd $LIBSYSTEMD_LIBS])
1868
1869 AC_ARG_ENABLE(forw-via-db,
1870 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
1871 SQUID_YESNO([$enableval],[--enable-forw-via-db])
1872 ])
1873 SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
1874 [Enable Forw/Via database])
1875 AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
1876
1877 AC_ARG_ENABLE(cache-digests,
1878 AS_HELP_STRING([--enable-cache-digests],
1879 [Use Cache Digests. See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),[
1880 SQUID_YESNO([$enableval],[--enable-cache-digests])
1881 ])
1882 SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
1883 [Use Cache Digests for locating objects in neighbor caches.])
1884 AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
1885
1886
1887 ################################
1888 # check for netio plugin stuff #
1889 ################################
1890 dnl order of these options handling is relevant in case the user
1891 dnl supplies more than one --enable option. Options handled later
1892 dnl override those handled earlier for io loop method manual override
1893 AC_ARG_ENABLE(select,
1894 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),[
1895 SQUID_YESNO([$enableval],[--enable-select])
1896 AS_IF([test "x$enableval" = "xyes"],[
1897 squid_opt_io_loop_engine="select"
1898 AS_IF([test "x$squid_host_os" = "xmingw"],[squid_opt_io_loop_engine="select_win32"])
1899 ])
1900 ])
1901 AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
1902
1903 AC_ARG_ENABLE(poll,
1904 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),[
1905 SQUID_YESNO([$enableval],[--enable-poll])
1906 AS_IF(["x$enableval" = "xyes"],[squid_opt_io_loop_engine="poll"])
1907 ])
1908 AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
1909
1910 AC_ARG_ENABLE(kqueue,
1911 AS_HELP_STRING([--disable-kqueue],
1912 [Disable kqueue(2) support.]), [
1913 SQUID_YESNO([$enableval],[--enable-kqueue])
1914 ])
1915 AS_IF([test "x${enable_kqueue:=auto}" != "xno"],[
1916 AC_CHECK_HEADERS([sys/event.h],[],[
1917 AS_IF([test "x${enable_kqueue}" = "xyes"],[
1918 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
1919 ])
1920 ])
1921 AC_CHECK_FUNCS(kqueue,[],[
1922 AS_IF([test "x${enable_kqueue}" = "xyes"],[
1923 AC_MSG_ERROR([kqueue support missing in libc library.])
1924 ])
1925 ])
1926 AS_IF([test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes"],[
1927 squid_opt_io_loop_engine="kqueue"
1928 ],[
1929 enable_kqueue="no"
1930 ])
1931 ])
1932 AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
1933
1934 dnl Enable epoll()
1935 AC_ARG_ENABLE(epoll,
1936 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
1937 [
1938 SQUID_YESNO([$enableval],[--enable-epoll])
1939 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="epoll"])
1940 ])
1941 AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
1942
1943 # auto-detect and verify epoll header and library present and working
1944 # logic mapping and loop method selection are performed later
1945 AS_IF([test "x$enable_epoll" != "xno"],[
1946 # check if libs are needed to support epoll
1947 SQUID_STATE_SAVE(squid_epoll_state)
1948 AC_SEARCH_LIBS(epoll_ctl,[epoll])
1949 AS_IF([test "x$ac_cv_search_epoll_ctl" = "xno"],[enable_epoll=no],
1950 [test "x$ac_cv_search_epoll_ctl" = "xnone required"],[EPOLL_LIBS=""],
1951 [EPOLL_LIBS=$ac_cv_search_epoll_ctl]
1952 )
1953 AC_SUBST(EPOLL_LIBS)
1954 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
1955
1956 # epoll requires sys/epoll.h
1957 AC_CHECK_HEADERS([sys/epoll.h])
1958
1959 dnl Verify that epoll really works
1960 AS_IF([test "x$ac_cv_search_epoll_ctl" != "xno"], SQUID_CHECK_EPOLL)
1961
1962 AS_IF([test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno"],[
1963 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
1964 ])
1965 ])
1966
1967 dnl Enable /dev/poll
1968 AC_ARG_ENABLE(devpoll,
1969 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),[
1970 SQUID_YESNO([$enableval],[--enable-devpoll])
1971 AS_IF([test "x$enableval" = "xyes"],[squid_opt_io_loop_engine="devpoll"])
1972 ])
1973 AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
1974
1975 ## auto-detect and verify devpoll header and library present and working
1976 AS_IF([test "x$enable_devpoll" != "xno"],[
1977 # /dev/poll requires ioctl() and write()
1978 AC_CHECK_FUNCS(ioctl)
1979 AC_CHECK_FUNCS(write)
1980
1981 # /dev/poll requires sys/devpoll.h
1982 AC_CHECK_HEADERS([sys/devpoll.h],,[
1983 AS_IF([test "x$enable_devpoll" = "xyes"],[
1984 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
1985 ])
1986 enable_devpoll=no
1987 ])
1988
1989 # Verify that /dev/poll really works
1990 AS_IF([test "x$enable_devpoll" != "xno"], SQUID_CHECK_DEVPOLL)
1991
1992 AS_IF([test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno"],[
1993 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
1994 ])
1995 ])
1996
1997 AC_ARG_ENABLE(http-violations,
1998 AS_HELP_STRING([--disable-http-violations],
1999 [This allows you to remove code which is known to
2000 violate the HTTP protocol specification.]), [
2001 SQUID_YESNO([$enableval],[--enable-http-violations])
2002 ])
2003 SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
2004 [Define to enable code which volates the HTTP standard specification])
2005 AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
2006
2007 # IPFW Transparent Proxy
2008 AC_ARG_ENABLE(ipfw-transparent,
2009 AS_HELP_STRING([--enable-ipfw-transparent],
2010 [Enable Transparent Proxy support for systems
2011 using FreeBSD IPFW-style firewalling.]), [
2012 SQUID_YESNO([$enableval],[--enable-ipfw-transparent])
2013 ])
2014 SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
2015 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
2016 AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
2017
2018 # IP-Filter Transparent Proxy
2019 AC_ARG_ENABLE(ipf-transparent,
2020 AS_HELP_STRING([--enable-ipf-transparent],
2021 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
2022 SQUID_YESNO([$enableval],[--enable-ipf-transparent])
2023 ])
2024 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2025 #IPF currently broken. Default-disabled for now.
2026 AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
2027
2028 dnl Enable PF Transparent Proxy
2029 AC_ARG_ENABLE(pf-transparent,
2030 AS_HELP_STRING([--enable-pf-transparent],
2031 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
2032 SQUID_YESNO([$enableval],[--enable-pf-transparent])
2033 ])
2034 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2035 AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
2036
2037 dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
2038 AC_ARG_WITH(nat-devpf,
2039 AS_HELP_STRING([--with-nat-devpf],
2040 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
2041 SQUID_YESNO([$withval],[--with-nat-devpf])
2042 ])
2043 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2044 AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
2045
2046 # Linux Netfilter Transparent Proxy
2047 AC_ARG_ENABLE(linux-netfilter,
2048 AS_HELP_STRING([--enable-linux-netfilter],
2049 [Enable Transparent Proxy support for Linux (Netfilter)]), [
2050 SQUID_YESNO([$enableval],[--enable-linux-netfilter])
2051 ])
2052 AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
2053 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2054
2055
2056 dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
2057 SQUID_AUTO_LIB(netfilter-conntrack,[Netfilter conntrack],[LIBNETFILTER_CONNTRACK])
2058 AC_MSG_NOTICE([Linux Netfilter Conntrack support requested: ${with_netfilter_conntrack:=auto}])
2059 AS_IF([test "x$with_netfilter_conntrack" != "xno"],[
2060 LDFLAGS="$LIBNETFILTER_CONNTRACK_PATH $LDFLAGS"
2061 CPPFLAGS="$LIBNETFILTER_CONNTRACK_CFLAGS $CPPFLAGS"
2062 AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
2063 AS_IF([test "x$with_netfilter_conntrack" = "xyes"],[
2064 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack library not found])
2065 ])
2066 with_netfilter_conntrack=no
2067 ])
2068 AC_CHECK_HEADERS([ \
2069 libnetfilter_conntrack/libnetfilter_conntrack.h \
2070 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h
2071 ],,[
2072 AS_IF([test "x$with_netfilter_conntrack" = "xyes"],[
2073 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack headers not found])
2074 ])
2075 with_netfilter_conntrack=no
2076 ])
2077 AS_IF([test "x$with_netfilter_conntrack" != "xno"],[with_netfilter_conntrack=yes])
2078 ])
2079
2080 dnl Enable Large file support
2081 buildmodel=""
2082
2083 AC_ARG_WITH(large-files,
2084 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
2085 SQUID_YESNO([$withval],[--with-large-files])
2086 squid_opt_enable_large_files=$withval
2087 ])
2088
2089 dnl UNIX Build environment
2090 dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
2091 AC_ARG_WITH(build-environment,
2092 AS_HELP_STRING([--with-build-environment=model],
2093 [The build environment to use. Normally one of
2094 POSIX_V6_ILP32_OFF32 (32 bits),
2095 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
2096 POSIX_V6_LP64_OFF64 (64 bits),
2097 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
2098 XBS5_ILP32_OFF32 i(legacy, 32 bits),
2099 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
2100 XBS5_LP64_OFF64 (legacy, 64 bits),
2101 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
2102 or default (The default for your OS)]), [
2103 AS_CASE(["$withval"],
2104 [yes|no],[AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])],
2105 [buildmodel="$withval"]
2106 )
2107 ])
2108
2109 #hack. Let's early-detect sizeof(long)
2110 AC_CHECK_SIZEOF(long)
2111
2112 AS_IF([test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"],[
2113 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
2114 AS_IF([test "`getconf _$model 2>/dev/null || true`" = 1 -o "`getconf $model 2>/dev/null || true`"],[
2115 buildmodel=$model
2116 break
2117 ])
2118 done
2119 AS_IF([test "x$buildmodel" = "x"],[
2120 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
2121 ])
2122 ])
2123 AS_IF([test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"],[
2124 # define _FILE_OFFSET_BITS if requested and needed
2125 AS_IF([test "x$squid_opt_enable_large_files" = "xyes" -a $ac_cv_sizeof_long -le 4],[
2126 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
2127 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
2128 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
2129 ])
2130 ],[
2131 AC_MSG_NOTICE([Using $buildmodel build environment])
2132 AS_IF([ ! test "`getconf _$buildmodel 2>/dev/null || true`" = 1 -o "`getconf $buildmodel 2>/dev/null || true`"],[
2133 AC_MSG_ERROR([Build environment $buildmodel not known to getconf.])
2134 ])
2135 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
2136 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
2137 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
2138 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
2139
2140 AS_IF([test "x$squid_host_os" = "xsolaris"],[
2141 # On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
2142 # for LDFLAGS -xarch=generic64, but:
2143 # "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
2144 # For gcc "-xarch=generic64" must be replaced with "-m64"
2145 # The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
2146 AS_IF([test "x$GCC" = "xyes"],[
2147 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
2148 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
2149 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
2150 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
2151 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2152 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2153 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
2154 ])
2155 AC_MSG_NOTICE([Removing -Usun on $host])
2156 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
2157 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
2158 ])
2159 ])
2160
2161 AC_ARG_ENABLE(follow-x-forwarded-for,
2162 AS_HELP_STRING([--disable-follow-x-forwarded-for],
2163 [Do not follow the X-Forwarded-For
2164 HTTP header to try to find the IP address of the
2165 original or indirect client when a request has
2166 been forwarded through other proxies.]), [
2167 SQUID_YESNO([$enableval],[--enable-follow-x-forwarded-for])
2168 ])
2169 AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
2170 SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
2171 [Enable following X-Forwarded-For headers])
2172
2173 AC_ARG_ENABLE(ident-lookups,
2174 AS_HELP_STRING([--disable-ident-lookups],
2175 [Remove code that supports performing Ident (RFC 931) lookups.]), [
2176 SQUID_YESNO([$enableval],[--enable-ident-lookups])
2177 ])
2178 AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
2179 SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
2180
2181 dnl Select Default hosts file location
2182 AC_ARG_ENABLE(default-hostsfile,
2183 AS_HELP_STRING([--enable-default-hostsfile=path],
2184 [Select default location for hosts file.
2185 See hosts_file directive in squid.conf for details]), [
2186 # TODO: handle the "yes" case cleanly
2187 AS_CASE(["$enableval"],
2188 [no|none],[squid_opt_default_hosts="none"],
2189 [
2190 squid_opt_default_hosts=$enableval
2191 AS_IF([ ! test -f "$enableval"],[
2192 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
2193 ])
2194 ])
2195 ])
2196 AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
2197 DEFAULT_HOSTS=$squid_opt_default_hosts
2198 AC_SUBST(DEFAULT_HOSTS)
2199
2200 # Select auth schemes modules to build
2201 AC_ARG_ENABLE(auth,
2202 AS_HELP_STRING([--disable-auth],
2203 [Do not support authentication. When supported, the list of schemes
2204 and helpers to be enabled is defined elsewhere]), [
2205 SQUID_YESNO([$enableval],[--enable-auth])
2206 ])
2207 AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
2208 SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
2209 AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
2210 AUTH_MODULES=""
2211 require_smblib="no"
2212
2213 AC_ARG_ENABLE(auth-basic,
2214 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
2215 [Enable the basic authentication scheme, and build the specified helpers.
2216 Not providing an explicit list of helpers will attempt build of
2217 all possible helpers. Default is to do so.
2218 To disable the basic authentication scheme, use --disable-auth-basic.
2219 To enable but build no helpers, specify "none".
2220 To see available helpers, see the src/auth/basic/ directory. ]),[
2221 #nothing to do really
2222 ])
2223 m4_include([src/auth/basic/helpers.m4])
2224
2225 AC_ARG_ENABLE(auth-digest,
2226 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
2227 [Enable the Digest authentication scheme, and build the specified helpers.
2228 Not providing an explicit list of helpers will attempt build of
2229 all possible helpers. Default is to do so.
2230 To disable the Digest authentication scheme, use --disable-auth-digest.
2231 To enable but build no helpers, specify "none".
2232 To see available helpers, see the src/auth/digest/ directory. ]),[
2233 #nothing to do, really
2234 ])
2235 m4_include([src/auth/digest/helpers.m4])
2236
2237 AC_ARG_ENABLE(auth-negotiate,
2238 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
2239 [Enable the Negotiate authentication scheme, and build the specified
2240 helpers.
2241 Not providing an explicit list of helpers will attempt build of
2242 all possible helpers. Default is to do so.
2243 To disable the Negotiate authentication scheme,
2244 use --disable-auth-negotiate.
2245 To enable but build no helpers, specify "none".
2246 To see available helpers, see the src/auth/negotiate/ directory. ]),[
2247 #nothing to do, really
2248 ])
2249 m4_include([src/auth/negotiate/helpers.m4])
2250
2251 AC_ARG_ENABLE(auth-ntlm,
2252 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
2253 [Enable the NTLM authentication scheme, and build the specified helpers.
2254 Not providing an explicit list of helpers will attempt build of
2255 all possible helpers. Default is to do so.
2256 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
2257 To enable but build no helpers, specify "none".
2258 To see available helpers, see the src/auth/ntlm/ directory. ]),[
2259 ])
2260 m4_include([src/auth/ntlm/helpers.m4])
2261
2262 dnl Authentication libraries to build
2263 dnl This list will not be needed when each auth library has its own Makefile
2264 dnl this is to be placed AFTER each auth module's handler
2265 AUTH_LIBS_TO_BUILD=
2266 for module in $AUTH_MODULES; do
2267 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
2268 done
2269 AC_SUBST(AUTH_MODULES)
2270 AC_SUBST(AUTH_LIBS_TO_BUILD)
2271 AM_CONDITIONAL(ENABLE_SMBLIB, test "x$require_smblib" = "xyes")
2272
2273 dnl Select logging daemon helpers to build
2274 AC_ARG_ENABLE(log-daemon-helpers,
2275 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
2276 [This option selects which logging daemon helpers to
2277 build and install as part of the normal build process
2278 For a list of available helpers see the src/log/
2279 directory.]),[
2280 #nothing to do, really
2281 ])
2282 m4_include([src/log/helpers.m4])
2283
2284 AC_ARG_ENABLE(external-acl-helpers,
2285 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
2286 [Enable external_acl helpers support and the helpers themselves.
2287 Default is to build all buildable helpers and enable support.
2288 To disable support, use --disable-external-acl-helpers.
2289 To build no helpers, specify "none".
2290 To see available helpers, see the src/acl/external/
2291 directory]), [
2292 #nothing to do, really
2293 ])
2294 m4_include([src/acl/external/helpers.m4])
2295
2296 dnl Select url_rewrite helpers to build
2297 AC_ARG_ENABLE(url-rewrite-helpers,
2298 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
2299 [This option selects which url_rewrite helpers to
2300 build and install as part of the normal build
2301 process. The default is to attempt the build of all possible
2302 helpers. Use --disable-url-rewrite-helpers to build none.
2303 For a list of available helpers see the
2304 src/http/url_rewriters/ directory.]),[
2305 ])
2306 m4_include([src/http/url_rewriters/helpers.m4])
2307
2308 dnl Select security helpers to build
2309 AC_ARG_ENABLE(security-cert-validators,
2310 AS_HELP_STRING([--enable-security-cert-validators="list of helpers"],
2311 [This option selects which security certificate validator
2312 helpers to build and install as part of the normal build
2313 process. The default is to attempt the build of all possible
2314 helpers. Use --disable-security-cert-validators to
2315 build none. For a list of available helpers see the
2316 src/security/cert_validators/ directory.]),[
2317 ])
2318 m4_include([src/security/cert_validators/helpers.m4])
2319
2320 AC_ARG_ENABLE(security-cert-generators,
2321 AS_HELP_STRING([--enable-security-cert-generators="list of helpers"],
2322 [This option selects which security certificate validator
2323 helpers to build and install as part of the normal build
2324 process. The default is to attempt the build of all possible
2325 helpers. Use --disable-security-cert-genrators to
2326 build none. For a list of available helpers see the
2327 src/security/cert_generators/ directory.]),[
2328 ])
2329 m4_include([src/security/cert_generators/helpers.m4])
2330
2331 dnl Select storeid_rewrite helpers to build
2332 AC_ARG_ENABLE(storeid-rewrite-helpers,
2333 AS_HELP_STRING([--enable-storeid-rewrite-helpers="list of helpers"],
2334 [This option selects which Store-ID rewrite helpers to
2335 build and install as part of the normal build
2336 process. The default is to attempt the build of all possible
2337 helpers. Use --disable-storeid-rewrite-helpers to build none.
2338 For a list of available helpers see the
2339 src/store/id_rewriters/ directory.]),[
2340 ])
2341 m4_include([src/store/id_rewriters/helpers.m4])
2342
2343 AC_ARG_WITH(valgrind-debug,
2344 AS_HELP_STRING([--with-valgrind-debug],
2345 [Include debug instrumentation for use with valgrind]),
2346 [
2347 SQUID_YESNO([$withval],[--with-valgrind-debug])
2348 AS_IF([test "x$withval" != "xno"],[
2349 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
2350 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
2351 ])
2352 ])
2353 ])
2354 SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
2355 [Valgrind memory debugger support])
2356 AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
2357
2358 dnl Enable WIN32 Service compile mode
2359 AC_ARG_ENABLE(win32-service,
2360 AS_HELP_STRING([--enable-win32-service],
2361 [Compile Squid as a WIN32 Service.
2362 Works only on MS-Windows platforms]), [
2363 SQUID_YESNO([$enableval],[--enable-win32-service])
2364 ])
2365 SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
2366 [Enable code supporting MS Windows service mode])
2367 AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
2368
2369
2370 # Disable "unlinkd" code
2371 AC_ARG_ENABLE(unlinkd,
2372 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
2373 SQUID_YESNO([$enableval],[--enable-unlinkd])
2374 ])
2375 SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
2376 [Enable useage of unlinkd])
2377 AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
2378 AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
2379
2380 # Enable backtraces on fatal errors
2381 AC_ARG_ENABLE(stacktraces,
2382 AS_HELP_STRING([--enable-stacktraces],
2383 [Enable automatic call backtrace on fatal errors]), [
2384 SQUID_YESNO([$enableval],[--enable-stacktraces])
2385 ])
2386 SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
2387 [Print stack traces on fatal errors])
2388 AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
2389
2390 # Enable X-Accelerator-Vary for Vary support within an accelerator setup
2391 AC_ARG_ENABLE(x-accelerator-vary,
2392 AS_HELP_STRING([--enable-x-accelerator-vary],
2393 [Enable support for the X-Accelerator-Vary
2394 HTTP header. Can be used to indicate
2395 variance within an accelerator setup.
2396 Typically used together with other code
2397 that adds custom HTTP headers to the requests.]), [
2398 SQUID_YESNO([$enableval],[--enable-x-accelerator-vary])
2399 ])
2400 SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
2401 [Enable support for the X-Accelerator-Vary HTTP header])
2402 AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
2403
2404 SQUID_AUTO_LIB(cppunit,[cppunit test framework],[LIBCPPUNIT])
2405 AS_IF([test "x$with_cppunit" != "xno"],[
2406 LIBCPPUNIT_LIBS="$LIBCPPUNIT_PATH -lcppunit"
2407 PKG_CHECK_MODULES([LIBCPPUNIT],[cppunit],[
2408 squid_cv_cppunit_version="`pkg-config --modversion cppunit`"
2409 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
2410 AS_UNSET(squid_cv_cppunit_version)
2411
2412 SQUID_STATE_SAVE(squid_cppunit_state)
2413 CXXFLAGS="${CXXFLAGS} ${LIBCPPUNIT_CFLAGS}"
2414 LIBS="${LIBS} ${LIBCPPUNIT_LIBS}"
2415 AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
2416 SQUID_STATE_ROLLBACK(squid_cppunit_state)
2417 ],[
2418 AC_MSG_WARN([cppunit does not appear to be installed. Squid does not require this, but code testing with 'make check' will fail.])
2419 ])
2420 ])
2421
2422 dnl Check for headers
2423 AC_CHECK_HEADERS( \
2424 arpa/inet.h \
2425 arpa/nameser.h \
2426 assert.h \
2427 bstring.h \
2428 crypt.h \
2429 ctype.h \
2430 direct.h \
2431 dirent.h \
2432 errno.h \
2433 execinfo.h \
2434 fcntl.h \
2435 fnmatch.h \
2436 getopt.h \
2437 glob.h \
2438 gnumalloc.h \
2439 grp.h \
2440 ipl.h \
2441 lber.h \
2442 ldap.h \
2443 libc.h \
2444 limits.h \
2445 linux/posix_types.h \
2446 linux/types.h \
2447 malloc.h \
2448 math.h \
2449 memory.h \
2450 mount.h \
2451 netdb.h \
2452 netinet/in.h \
2453 netinet/in_systm.h \
2454 netinet/tcp.h \
2455 paths.h \
2456 poll.h \
2457 priv.h \
2458 pwd.h \
2459 regex.h \
2460 sched.h \
2461 siginfo.h \
2462 signal.h \
2463 stdarg.h \
2464 stddef.h \
2465 stdio.h \
2466 stdlib.h \
2467 string.h \
2468 strings.h \
2469 sys/bitypes.h \
2470 sys/file.h \
2471 sys/ioctl.h \
2472 sys/ipc.cc \
2473 sys/param.h \
2474 sys/prctl.h \
2475 sys/procctl.h \
2476 sys/md5.h \
2477 sys/mman.h \
2478 sys/msg.h \
2479 sys/resource.h \
2480 sys/select.h \
2481 sys/shm.h \
2482 sys/socket.h \
2483 sys/stat.h \
2484 syscall.h \
2485 sys/syscall.h \
2486 sys/time.h \
2487 sys/types.h \
2488 sys/uio.h \
2489 sys/un.h \
2490 sys/vfs.h \
2491 sys/wait.h \
2492 syslog.h \
2493 time.h \
2494 unistd.h \
2495 utime.h \
2496 varargs.h \
2497 byteswap.h \
2498 glib.h \
2499 stdint.h \
2500 inttypes.h \
2501 wchar.h
2502 )
2503
2504 AC_CHECK_HEADERS( \
2505 linux/netfilter_ipv4.h \
2506 linux/netfilter_ipv6/ip6_tables.h \
2507 ,,,
2508 SQUID_DEFAULT_INCLUDES
2509 #if HAVE_LIMITS_H
2510 #include <limits.h>
2511 #endif
2512 /* Netfilter ip(6)tables v1.4.0 has broken headers */
2513 #if HAVE_NETINET_IN_H
2514 #include <netinet/in.h>
2515 #endif
2516 )
2517
2518 dnl *BSD do not include the dependencies for all their net/ and netinet/ files
2519 dnl We must include a few basic type headers for them to work.
2520 AC_CHECK_HEADERS( \
2521 net/if.h \
2522 netinet/if_ether.h\
2523 netinet/icmp6.h \
2524 netinet/in.h \
2525 netinet/ip.h \
2526 netinet/ip6.h \
2527 netinet/ip_icmp.h \
2528 netinet/ipl.h \
2529 net/pf/pfvar.h \
2530 net/pfvar.h \
2531 sys/mount.h\
2532 resolv.h \
2533 ,,,
2534 SQUID_BSDNET_INCLUDES)
2535
2536 AC_C_CONST
2537 AC_C_BIGENDIAN
2538
2539 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2540 #if HAVE_TIME_H
2541 #include <time.h>
2542 #endif
2543 ])
2544
2545 dnl Override rusage() detect on MinGW because is emulated in source code
2546 AS_IF([test "$squid_host_os" = "mingw"],[
2547 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2548 ac_cv_func_getrusage="yes"
2549 AC_MSG_NOTICE([Using own rusage on Windows.])
2550 ],[
2551 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
2552 #if HAVE_SYS_TIME_H
2553 #include <sys/time.h>
2554 #endif
2555 #if HAVE_SYS_RESOURCE_H
2556 #include <sys/resource.h>
2557 #endif
2558 ])
2559 ])
2560
2561 AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2562 #if HAVE_SYS_TYPES_H
2563 #include <sys/types.h>
2564 #endif
2565 #include <netinet/in.h>
2566 #include <netinet/in_systm.h>
2567 #include <netinet/ip.h>
2568 #if defined (__linux__) || defined (__CYGWIN__)
2569 #define ip_hl ihl
2570 #endif
2571 #ifndef __linux__
2572 #ifndef __CYGWIN__
2573 #define iphdr ip
2574 #endif
2575 #endif])
2576
2577 dnl Check for typedefs
2578 AC_CHECK_SIZEOF(void *)
2579
2580 # check for a bunch of types
2581 AC_TYPE_INT8_T
2582 AC_TYPE_UINT8_T
2583 AC_TYPE_INT16_T
2584 AC_TYPE_UINT16_T
2585 AC_TYPE_INT32_T
2586 AC_TYPE_UINT32_T
2587 AC_TYPE_INT64_T
2588 AC_TYPE_UINT64_T
2589 AC_TYPE_PID_T
2590 AC_TYPE_SIZE_T
2591 AC_TYPE_SSIZE_T
2592 AC_TYPE_OFF_T
2593 AC_TYPE_UID_T
2594 AC_CHECK_TYPE([bool])
2595 #need the defines for PRId64
2596 AC_CHECK_SIZEOF(int64_t)
2597 AC_CHECK_SIZEOF(long)
2598 #need the defines for PRIuSIZE
2599 AC_CHECK_SIZEOF(size_t)
2600 #need the define for overflow checks
2601 AC_CHECK_SIZEOF(off_t)
2602 AC_CHECK_SIZEOF(size_t)
2603
2604 dnl Some C++11 types we try to use
2605 AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS
2606 SQUID_CXX_STD_UNDERLYING_TYPE
2607 SQUID_CXX_STD_IS_TRIVIALLY_COPYABLE
2608
2609 dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2610 dnl that is incompatible with the updated Solaris header files.
2611 dnl For this reason, we must check if pad128_t and upad128_t are defined.
2612 AC_CHECK_TYPE(pad128_t,
2613 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2614 ,SQUID_DEFAULT_INCLUDES)
2615
2616 AC_CHECK_TYPE(upad128_t,
2617 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2618 ,SQUID_DEFAULT_INCLUDES)
2619
2620 AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2621 AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2622
2623 AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2624 #include <sys/types.h>
2625 #include <sys/socket.h>
2626 #include <stdlib.h>
2627 #include <stddef.h>
2628 ])
2629
2630 AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
2631 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
2632 #include <sys/ipc.h>
2633 #include <sys/msg.h>])
2634
2635 AC_CHECK_TYPE(cpu_set_t,
2636 AC_DEFINE(HAVE_CPU_SET_T,1,[cpu_set_t is defined by the system headers]),,[
2637 #if HAVE_SCHED_H
2638 #include <sched.h>
2639 #endif
2640 ])
2641
2642 # check for compiler support of %zu printf macro
2643 AH_TEMPLATE(PRIuSIZE,[Compiler supports %zu printf macro])
2644 AC_MSG_CHECKING([for compiler %zu support])
2645 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2646 #include <stdio.h>
2647 ]],[[size_t n=1;printf("%zu",n);]])],[
2648 AC_DEFINE(PRIuSIZE,"zu")
2649 AC_MSG_RESULT(yes)
2650 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
2651
2652
2653 dnl Check for special functions
2654 AC_FUNC_ALLOCA
2655
2656 SQUID_AUTO_LIB(cap,[Linux capabilities],[LIBCAP])
2657 AS_IF([test "x$with_cap" != "xno"],[
2658 SQUID_STATE_SAVE(squid_libcap_state)
2659 CXXFLAGS="$LIBCAP_CFLAGS $CXXFLAGS"
2660 LDFLAGS="$LIBCAP_PATH $LDFLAGS"
2661 PKG_CHECK_MODULES([LIBCAP],[libcap >= 2.09],[],[
2662 # cap_clear_flag is the most recent libcap function we require
2663 AC_CHECK_LIB([cap],[cap_clear_flag],[LIBCAP_LIBS="$LIBCAP_LIBS -lcap"])
2664 ])
2665 SQUID_CHECK_FUNCTIONAL_LIBCAP2
2666 AC_MSG_NOTICE([libcap headers are ok: $squid_cv_sys_capability_works])
2667 AS_IF([test "x$squid_cv_sys_capability_works" = "xno"],[LIBCAP_LIBS=""])
2668 SQUID_STATE_ROLLBACK(squid_libcap_state)
2669
2670 AS_IF([test "x$LIBCAP_LIBS" != "x"],[
2671 with_cap=yes
2672 CPPFLAGS="$LIBCAP_CFLAGS $CPPFLAGS"
2673 LIBCAP_LIBS="$LIBCAP_PATH $LIBCAP_LIBS"
2674 AC_DEFINE(USE_LIBCAP,1,[Linux capabilities library support])
2675 ],[test "x$with_cap" = "xyes"],[
2676 AC_MSG_ERROR([Required library libcap not found])
2677 ],[
2678 AC_MSG_NOTICE([Library libcap not found])
2679 with_cap=no
2680 ])
2681 ])
2682 AC_MSG_NOTICE([Linux capabilities support enabled: ${with_cap} ${LIBCAP_LIBS}])
2683
2684 dnl Check for needed libraries
2685 AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
2686 AC_SEARCH_LIBS([res_init],[resolv])
2687 AC_SEARCH_LIBS([__res_search],[resolv])
2688 AC_SEARCH_LIBS([bind],[socket])
2689 AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
2690 AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
2691 dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
2692 AS_IF([test "x$squid_host_os" = "xmingw"],[
2693 SQUID_CHECK_WINSOCK_LIB
2694 AC_CHECK_HEADERS( \
2695 windows.h \
2696 ws2tcpip.h \
2697 iphlpapi.h ,,,[
2698 #if HAVE_WINSOCK2_H
2699 #include <winsock2.h>
2700 #endif
2701 #if HAVE_WINDOWS_H
2702 #include <windows.h>
2703 #endif
2704 #if HAVE_WS2TCPIP_H
2705 #include <ws2tcpip.h>
2706 #endif
2707 ])
2708 ])
2709
2710 # check that we have unix sockets
2711 SQUID_CHECK_UNIX_SOCKET
2712 SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
2713
2714 AC_CHECK_LIB(gnumalloc, malloc)
2715 AS_IF([test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"],[
2716 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
2717 ac_cv_func_mallocblksize=no
2718 ac_cv_func_mallopt=no
2719 ],[
2720 AS_CASE(["$squid_host_os"],
2721 [solaris],[AC_MSG_NOTICE([skipping libmalloc check for $host])],
2722 [freebsd],[AC_MSG_NOTICE([skipping libmalloc check for $host])],
2723 [AC_CHECK_LIB(malloc, main)]
2724 )
2725 ])
2726
2727 AS_IF([test "$squid_host_os" = "mingw"],[
2728 AC_MSG_NOTICE([Use MSVCRT for math functions.])
2729 ],[
2730 dnl log() are only used in old C code for now.
2731 AC_LANG_PUSH([C])
2732 AC_SEARCH_LIBS([log],[m])
2733 AC_LANG_POP([C])
2734 ])
2735
2736 dnl --with-maxfd present for compatibility with Squid-2.
2737 dnl undocumented in ./configure --help to encourage using the Squid-3 directive
2738 AC_ARG_WITH(maxfd,,[
2739 AS_CASE([$withval],
2740 [[[0-9]]*],[
2741 squid_filedescriptors_num=$withval
2742 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
2743 ],
2744 [AC_MSG_ERROR(--with-maxfd expects a numeric argument)]
2745 )
2746 ])
2747
2748 AC_ARG_WITH(filedescriptors,
2749 AS_HELP_STRING([--with-filedescriptors=NUMBER],
2750 [Force squid to support NUMBER filedescriptors]),
2751 AS_CASE([$withval],
2752 [[[0-9]]*],[
2753 squid_filedescriptors_num=$withval
2754 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])],
2755 [AC_MSG_ERROR([--with-filedescriptors expects a numeric argument])]
2756 )
2757 )
2758
2759 SQUID_CHECK_DEFAULT_FD_SETSIZE
2760 SQUID_CHECK_MAXFD
2761
2762
2763 dnl Enable IPv6 support
2764 AC_MSG_CHECKING([whether to enable IPv6])
2765 AC_ARG_ENABLE(ipv6,
2766 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
2767 SQUID_YESNO([$enableval],[--enable-ipv6])
2768 ])
2769 AC_MSG_RESULT(${enable_ipv6:=yes})
2770 SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
2771
2772 AS_IF([test "x$enable_ipv6" = "xyes"],[SQUID_CHECK_SIN6_LEN_IN_SAI])
2773 SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
2774 SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
2775
2776 dnl System-specific library modifications
2777 AH_TEMPLATE(GETTIMEOFDAY_NO_TZP,[Whether gettimeofday takes only one argument])
2778 AS_CASE(["$host"],
2779 [*-pc-sco3.2*],[
2780 # -lintl is needed on SCO version 3.2v4.2 for strftime()
2781 # Robert Side <rside@aiinc.bc.ca>
2782 # Mon, 18 Jan 1999 17:48:00 GMT
2783 AC_CHECK_LIB(intl, strftime)
2784 ],
2785
2786 [i386-*-solaris2.*],[
2787 AS_IF([test "x$GCC" = "xyes"],[
2788 AC_MSG_NOTICE([Removing -O for gcc on $host])
2789 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9g]]*//'`"
2790 ])
2791 ],
2792
2793 [*-sgi-irix*],[
2794 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
2795 LIBS=`echo $LIBS | sed -e s/-lsocket//`
2796 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
2797 LIBS=`echo $LIBS | sed -e s/-lnsl//`
2798 ac_cv_lib_nsl_main=no
2799 ],
2800
2801 [*-ibm-aix*],[
2802 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
2803 #include <assert.h>
2804 #ifndef NULL
2805 #define NULL 0
2806 #endif
2807 class Foo{
2808 public:virtual ~Foo(){}
2809 };
2810 class Bar:public Foo{
2811 public:Bar():Foo(){}
2812 };
2813 ]],[[
2814 Foo * myFoo=new Bar();
2815 Bar * myBar=dynamic_cast<Bar *>(myFoo);
2816 assert(myBar != NULL);
2817 ]])
2818 AS_IF([test "$ac_cv_require_rtti" = "yes"],[
2819 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
2820 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
2821 ])
2822
2823 AC_LANG_PUSH([C])
2824 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
2825 AC_LANG_POP([C])
2826 AS_IF([test "$ac_cv_require_qcpluscmt" = "yes"],[
2827 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
2828 ])
2829 ],
2830
2831 [*-*-solaris2.[[0-4]]],[AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)],
2832
2833 [*-sony-newsos[[56]]*],[AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)]
2834 )
2835
2836 dnl This has to be before AC_CHECK_FUNCS
2837 # Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2838 # when running configure.
2839 AS_IF([test "x$ac_cv_func_poll" = "x"],[
2840 AS_CASE(["$host"],
2841 [*-hp-hpux*.*],[
2842 # Duane Wessels
2843 AC_MSG_NOTICE([disabling poll for $host...])
2844 ac_cv_func_poll='no'
2845 ],
2846
2847 [*-linux-*],[
2848 # Henrik Nordstrom (hno@squid-cache.org) 19980817
2849 # poll is problematic on Linux. We disable it
2850 # by default until Linux gets it right.
2851 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2852 AS_IF([test $rev -lt 002002],[
2853 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
2854 ac_cv_func_poll='no'
2855 ])
2856 ],
2857
2858 [powerpc-ibm-aix4.1.*],[
2859 # Mike Laster (mlaster@metavillage.com) 19981021
2860 AC_MSG_NOTICE([disabling poll for $host...])
2861 ac_cv_func_poll='no'
2862 ]
2863 )
2864 ])
2865
2866 dnl Check for library functions
2867 AC_CHECK_FUNCS(\
2868 backtrace_symbols_fd \
2869 bcopy \
2870 eui64_aton \
2871 fchmod \
2872 getdtablesize \
2873 getpagesize \
2874 getpass \
2875 getrusage \
2876 getspnam \
2877 gettimeofday \
2878 glob \
2879 mallocblksize \
2880 mallopt \
2881 memcpy \
2882 memmove \
2883 memrchr \
2884 memset \
2885 mkstemp \
2886 mktime \
2887 mstats \
2888 poll \
2889 prctl \
2890 procctl \
2891 pthread_attr_setschedparam \
2892 pthread_attr_setscope \
2893 pthread_setschedparam \
2894 pthread_sigmask \
2895 putenv \
2896 regcomp \
2897 regexec \
2898 regfree \
2899 res_init \
2900 __res_init \
2901 rint \
2902 sched_getaffinity \
2903 sched_setaffinity \
2904 select \
2905 seteuid \
2906 setgroups \
2907 setpflags \
2908 setpgrp \
2909 setsid \
2910 sigaction \
2911 snprintf \
2912 socketpair \
2913 sysconf \
2914 syslog \
2915 timegm \
2916 vsnprintf \
2917 )
2918 dnl ... and some we provide local replacements for
2919 AC_REPLACE_FUNCS(\
2920 initgroups \
2921 psignal \
2922 strerror \
2923 strtoll \
2924 tempnam \
2925 )
2926
2927 AC_CHECK_DECLS([getaddrinfo,getnameinfo,inet_ntop,inet_pton,InetNtopA,InetPtonA],,,[
2928 /*
2929 * BSD requires sys/types.h, sys/socket.h, netinet/in.h, netdb.h, arpa/inet.h
2930 * Linux requires sys/types.h, sys/socket.h, arpa/inet.h
2931 * Windows requires sys/socket.h, winsock2.h, ws2tcpip.h
2932 */
2933 #if HAVE_SYS_TYPES_H
2934 #include <sys/types.h>
2935 #endif
2936 #if HAVE_NETINET_IN_H
2937 #include <netinet/in.h>
2938 #endif
2939 #if HAVE_SYS_SOCKET_H
2940 #include <sys/socket.h>
2941 #endif
2942 #if HAVE_NETDB_H
2943 #include <netdb.h>
2944 #endif
2945 #if HAVE_ARPA_INET_H
2946 #include <arpa/inet.h>
2947 #endif
2948 #if HAVE_WINSOCK2_H
2949 #include <winsock2.h>
2950 #endif
2951 #if HAVE_WS2TCPIP_H
2952 #include <ws2tcpip.h>
2953 #endif
2954 ])
2955
2956 # Magic which checks whether we are forcing a type of comm loop we
2957 # are actually going to (ab)use.
2958 # Mostly ripped from squid-commloops, thanks to adrian and benno
2959
2960 AS_IF([test "x$squid_opt_io_loop_engine" != "x"],
2961 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine]),
2962 [test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes"],
2963 squid_opt_io_loop_engine="epoll",
2964 [test "x$enable_kqueue" != "xno"],
2965 squid_opt_io_loop_engine="kqueue",
2966 [test "x$enable_devpoll" != "xno"],
2967 squid_opt_io_loop_engine="devpoll",
2968 [test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes"],
2969 squid_opt_io_loop_engine="poll",
2970 [test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"],
2971 squid_opt_io_loop_engine="select",
2972 [test "x$enable_select" != "xno" -a "x$squid_host_os" = "xmingw"],
2973 squid_opt_io_loop_engine="select_win32",
2974 [
2975 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
2976 AC_MSG_WARN([Will try select and hope for the best.])
2977 squid_opt_io_loop_engine="select"
2978 ]
2979 )
2980
2981 AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
2982
2983 AM_CONDITIONAL(ENABLE_POLL, test "x$squid_opt_io_loop_engine" = "xpoll")
2984 AM_CONDITIONAL(ENABLE_EPOLL, test "x$squid_opt_io_loop_engine" = "xepoll")
2985 AM_CONDITIONAL(ENABLE_SELECT, test "x$squid_opt_io_loop_engine" = "xselect")
2986 AM_CONDITIONAL(ENABLE_SELECT_WIN32, test "x$squid_opt_io_loop_engine" = "xselect_win32")
2987 AM_CONDITIONAL(ENABLE_KQUEUE, test "x$squid_opt_io_loop_engine" = "xkqueue")
2988 AM_CONDITIONAL(ENABLE_DEVPOLL, test "x$squid_opt_io_loop_engine" = "xdevpoll")
2989
2990 AS_CASE([$squid_opt_io_loop_engine],
2991 [epoll],[AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])],
2992 [devpoll],[AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop])],
2993 [poll],[AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])],
2994 [kqueue],[AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])],
2995 [select_win32],[AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop])],
2996 [select],[AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])],
2997 )
2998
2999 AS_IF([test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes"],[
3000 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
3001 ])
3002
3003 SQUID_CHECK_SETRESUID_WORKS
3004 AS_IF([test "x$squid_cv_resuid_works" = "xyes"],[
3005 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.])
3006 ])
3007
3008 AC_CHECK_HEADERS(mswsock.h)
3009 AC_MSG_CHECKING([for constant CMSG_SPACE])
3010 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3011 #if HAVE_SYS_SOCKET_H
3012 #include <sys/socket.h>
3013 #endif
3014 #if HAVE_MSWSOCK_H
3015 #include <mswsock.h>
3016 #endif
3017
3018 int a[CMSG_SPACE(int)];
3019 ]])], [
3020 AC_MSG_RESULT(yes)
3021 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
3022 ], [
3023 AC_MSG_RESULT(no)
3024 ])
3025
3026 AC_CHECK_TYPE(struct cmsghdr,AC_DEFINE(HAVE_CMSGHDR,1,[The system provides struct cmsghdr]),,[
3027 #if HAVE_SYS_SOCKET_H
3028 #include <sys/socket.h>
3029 #endif
3030 #if HAVE_MSWSOCK_H
3031 #include <mswsock.h>
3032 #endif
3033 #if HAVE_WINSOCK2_H
3034 #include <winsock2.h>
3035 #endif
3036 ])
3037
3038 AC_CHECK_TYPE(struct iovec,AC_DEFINE(HAVE_IOVEC,1,[The system provides struct iovec]),,[
3039 #if HAVE_SYS_SOCKET_H
3040 #include <sys/socket.h>
3041 #endif
3042 #if HAVE_WINSOCK2_H
3043 #include <winsock2.h>
3044 #endif
3045 #if HAVE_SYS_UIO_H
3046 #include <sys/uio.h>
3047 #endif
3048 ])
3049
3050 AC_CHECK_TYPE(struct msghdr,AC_DEFINE(HAVE_MSGHDR,1,[The system provides struct msghdr]),,[
3051 #if HAVE_SYS_SOCKET_H
3052 #include <sys/socket.h>
3053 #endif
3054 #if HAVE_MSWSOCK_H
3055 #include <mswsock.h>
3056 #endif
3057 #if HAVE_WINSOCK2_H
3058 #include <winsock2.h>
3059 #endif
3060 ])
3061
3062 AC_CHECK_TYPE(struct sockaddr_un,AC_DEFINE(HAVE_SOCKADDR_UN,1,[The system provides sockaddr_un]),,[
3063 #if HAVE_SYS_UN_H
3064 #include <sys/un.h>
3065 #endif
3066 #if HAVE_SYS_SOCKET_H
3067 #include <sys/socket.h>
3068 #endif
3069 #if HAVE_WINSOCK2_H
3070 #include <winsock2.h>
3071 #endif
3072 ])
3073
3074 SQUID_CHECK_FUNC_STRNSTR
3075
3076 dnl IP-Filter support requires ipf header files. These aren't
3077 dnl installed by default, so we need to check for them
3078 AS_IF([test "x$enable_ipf_transparent" != "xno"],[
3079 SQUID_CHECK_BROKEN_SOLARIS_IPFILTER
3080 AC_MSG_CHECKING(for availability of IP-Filter header files)
3081 # hold on to your hats...
3082 AS_IF(
3083 [test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
3084 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
3085 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
3086 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes"],
3087 [have_ipfilter_compat_header="yes"])
3088
3089 AS_IF(
3090 [test "x$have_ipfilter_compat_header" = "xyes" -a \
3091 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
3092 "x$ac_cv_header_ip_nat_h" = "xyes"],[enable_ipf_transparent="yes"],
3093
3094 [test "x$have_ipfilter_compat_header" = "xyes" -a \
3095 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
3096 "x$ac_cv_header_netinet_ip_nat_h" = "xyes"],[enable_ipf_transparent="yes"],
3097 [enable_ipf_transparent="no"])
3098
3099 AC_MSG_RESULT($IPF_TRANSPARENT)
3100
3101 ## On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3102 ## Solaris minor version (8, 9, 10, ...)
3103 AS_IF([test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris"],[
3104 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3105 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3106 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
3107 ])
3108 ])
3109 AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
3110 SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
3111 [Enable support for IPF-style transparent proxying])
3112
3113 dnl PF /dev/pf support requires a header file.
3114 AS_IF([test "x$with_nat_devpf" != "xno"],[
3115 AS_IF([test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
3116 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"],[
3117 AS_IF([test "x$with_nat_devpf" = "xauto"],[with_nat_devpf="no"])
3118 ],[
3119 AS_IF([test "x$with_nat_devpf" = "xyes"],[
3120 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
3121 ])
3122 with_nat_devpf="no"
3123 ])
3124 ])
3125 SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
3126 [Enable support for PF-style transparent proxying])
3127 SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
3128 [Enable support for /dev/pf NAT lookups])
3129
3130 AS_IF([test "x$enable_linux_netfilter" != "xno"],[
3131 AS_IF([test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"],[
3132 AS_IF([test "x$enable_linux_netfilter" = "xauto"],[enable_linux_netfilter=yes])
3133 ],[
3134 AS_IF([test "x$enable_linux_netfilter" = "xauto"],[
3135 enable_linux_netfilter=no
3136 ],[
3137 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
3138 ])
3139 ])
3140 ])
3141 SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
3142 [Enable support for Transparent Proxy on Linux via Netfilter])
3143
3144 dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
3145 AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
3146 AS_IF([test "x$enable_linux_netfilter" = "xyes" -a "x$with_cap" != "xyes"],[
3147 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
3148 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
3149 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
3150 # AC_DEFINEd later
3151 ])
3152 AS_IF([test "x$with_netfilter_conntrack" = "xyes" -a "x$with_cap" != "xyes"],[
3153 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
3154 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
3155 with_netfilter_conntrack=no
3156 ])
3157 AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack}])
3158
3159
3160 AC_ARG_ENABLE(zph-qos,
3161 AS_HELP_STRING([--disable-zph-qos],[Disable ZPH QOS support]), [
3162 SQUID_YESNO([$enableval],[--enable-zph-qos])
3163 ])
3164 SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
3165 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
3166 TOS field of HIT responses to help policing network traffic])
3167 AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
3168 AS_IF(test "x$enable_zph_qos" = "xyes"],[
3169 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
3170 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
3171 [Enable support for QOS netfilter mark preservation])
3172 ])
3173
3174 AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
3175 AC_ARG_ENABLE(gnuregex,
3176 AS_HELP_STRING([--enable-gnuregex],
3177 [Compile GNUregex. Unless you have reason to use
3178 this option, you should not enable it.
3179 This library file is usually only required on Windows and
3180 very old Unix boxes which do not have their own regex
3181 library built in.]), [
3182 SQUID_YESNO([$enableval],[--enable-gnuregex])
3183 ])
3184 # force-enable on old solaris
3185 AS_IF([test "x${enable_gnuregex:=auto}" = "xauto"],[
3186 AS_CASE(["$host"],
3187 [*-sun-solaris2.[[0-4]]],[enable_gnuregex="yes"]
3188 )
3189 ])
3190
3191 # try detecting if it is needed
3192 AS_IF([test "x$enable_gnuregex" = "xauto"],[
3193 SQUID_CHECK_REGEX_WORKS
3194 AS_IF([test "x$squid_cv_regex_works" = "xyes"],[enable_gnuregex=no],[enable_gnuregex=yes])
3195 ])
3196 AC_MSG_CHECKING(if GNUregex needs to be compiled)
3197 AC_MSG_RESULT($enable_gnuregex)
3198 AS_IF([test "x$enable_gnuregex" = "xyes"],[
3199 # for some reason (force-enable, test..) gnuregex was found as needed. Override any system lib
3200 REGEXLIB=""
3201 ])
3202 #if no reason was found to enable gnuregex, disable it
3203 AS_IF([test "x$enable_gnuregex" = "xauto"],[enable_gnuregex=no])
3204 SQUID_DEFINE_BOOL(USE_GNUREGEX,$enable_gnuregex,[Define if we should use GNU regex])
3205 AC_SUBST(REGEXLIB)
3206
3207 SQUID_DETECT_UDP_SND_BUFSIZE
3208 SQUID_DETECT_UDP_RECV_BUFSIZE
3209 SQUID_DETECT_TCP_SND_BUFSIZE
3210 SQUID_DETECT_TCP_RECV_BUFSIZE
3211
3212 SQUID_CHECK_NEED_SYS_ERRLIST
3213 SQUID_CHECK_MAXPATHLEN
3214
3215 SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
3216 SQUID_CHECK_RESOLVER_FIELDS
3217
3218 AC_CHECK_HEADERS(sys/statvfs.h)
3219 AS_IF([test "x$ac_cv_header_sys_statvfs_h" = "xyes"],[SQUID_CHECK_WORKING_STATVFS])
3220 AS_IF([test "x$ac_cv_func_statvfs" != "xyes"],[
3221 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/vfs.h sys/statfs.h)
3222 AC_CHECK_FUNCS(statfs)
3223 SQUID_CHECK_F_FRSIZE_IN_STATFS
3224 ])
3225
3226 dnl Squid will not usually attempt to translate templates when building
3227 AC_ARG_ENABLE(translation,
3228 AS_HELP_STRING([--enable-translation],[Generate the localized error page templates and manuals.
3229 Which can also be downloaded from http://www.squid-cache.org/Versions/langpack/.]), [
3230 SQUID_YESNO([$enableval],[--enable-translation])
3231 ])
3232 AS_IF([test "x${enable_translation:=no}" = "xyes"],[
3233 AX_WITH_PROG([PO2HTML],[po2html])
3234 AX_WITH_PROG([PO2TEXT],[po2txt])
3235 ],[
3236 PO2HTML="off"
3237 PO2TEXT="off"
3238 ])
3239 AC_SUBST(PO2HTML)
3240 AC_SUBST(PO2TEXT)
3241 AM_CONDITIONAL(ENABLE_TRANSLATION, test "x${enable_translation:=no}" = "xyes")
3242
3243 dnl Squid now has limited locale handling ...
3244 dnl on error pages
3245 AC_ARG_ENABLE(auto-locale,
3246 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
3247 clients request headers.
3248 When disabled Squid requires explicit language configuration.]), [
3249 SQUID_YESNO([$enableval],[--enable-auto-locale])
3250 ])
3251 AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
3252 SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
3253 [Use multi-language support on error pages])
3254
3255
3256 dnl Need the debugging version of malloc if available
3257 XTRA_OBJS=''
3258 AS_IF([test "x$ac_cv_lib_malloc_main" = "xyes"],[
3259 AS_IF([test -r /usr/lib/debug/malloc.o],[XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"])
3260 AS_IF([test -r /usr/lib/debug/mallocmap.o],[XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"]);
3261 ])
3262 AC_SUBST(XTRA_OBJS)
3263
3264 AS_IF([test "x$XTRA_LIBS" = "x"],[
3265 XTRA_LIBS="$LIBS"
3266 dnl minor cleanup
3267 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
3268 LIBS=''
3269 ])
3270 AC_SUBST(XTRA_LIBS)
3271
3272 AC_SUBST(SQUID_CFLAGS)
3273 AC_SUBST(SQUID_CXXFLAGS)
3274
3275 AC_ARG_VAR([BUILDCXXFLAGS],[C++ compiler flags for building compile-time tools. e.g. cf_gen])
3276 AS_IF([test "x$BUILDCXXFLAGS" = "x"],[
3277 # if we are NOT cross-compiling, use the default build flags for cf_gen and friends
3278 # otherwise rely on the user-provided value
3279 AS_IF([test "x$squid_cv_check_marchnative" = "xyes"],[
3280 # always valid for the Build compiler.
3281 BUILDCXXFLAGS="-march=native"
3282 ])
3283 BUILDCXXFLAGS="$BUILDCXXFLAGS $CXXFLAGS"
3284 ])
3285 AC_SUBST(BUILDCXXFLAGS)
3286
3287 AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
3288 AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
3289 AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
3290 AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
3291 AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
3292 AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
3293 AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
3294 AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
3295 AC_MSG_NOTICE([BUILD Tools C++ FLAGS: $BUILDCXXFLAGS])
3296
3297 dnl Clean up after OSF/1 core dump bug
3298 rm -f core
3299
3300 AC_CONFIG_FILES([
3301 Makefile
3302 compat/Makefile
3303 contrib/Makefile
3304 doc/Makefile
3305 doc/manuals/Makefile
3306 doc/release-notes/Makefile
3307 errors/Makefile
3308 icons/Makefile
3309 lib/Makefile
3310 lib/libTrie/Makefile
3311 lib/libTrie/test/Makefile
3312 lib/ntlmauth/Makefile
3313 lib/rfcnb/Makefile
3314 lib/smblib/Makefile
3315 lib/snmplib/Makefile
3316 scripts/Makefile
3317 src/Makefile
3318 src/acl/Makefile
3319 src/acl/external/Makefile
3320 src/acl/external/AD_group/Makefile
3321 src/acl/external/delayer/Makefile
3322 src/acl/external/eDirectory_userip/Makefile
3323 src/acl/external/file_userip/Makefile
3324 src/acl/external/kerberos_ldap_group/Makefile
3325 src/acl/external/kerberos_sid_group/Makefile
3326 src/acl/external/LDAP_group/Makefile
3327 src/acl/external/LM_group/Makefile
3328 src/acl/external/session/Makefile
3329 src/acl/external/SQL_session/Makefile
3330 src/acl/external/unix_group/Makefile
3331 src/acl/external/wbinfo_group/Makefile
3332 src/acl/external/time_quota/Makefile
3333 src/adaptation/Makefile
3334 src/adaptation/icap/Makefile
3335 src/adaptation/ecap/Makefile
3336 src/anyp/Makefile
3337 src/auth/Makefile
3338 src/auth/basic/Makefile
3339 src/auth/basic/DB/Makefile
3340 src/auth/basic/fake/Makefile
3341 src/auth/basic/getpwnam/Makefile
3342 src/auth/basic/LDAP/Makefile
3343 src/auth/basic/NCSA/Makefile
3344 src/auth/basic/NIS/Makefile
3345 src/auth/basic/PAM/Makefile
3346 src/auth/basic/POP3/Makefile
3347 src/auth/basic/RADIUS/Makefile
3348 src/auth/basic/SASL/Makefile
3349 src/auth/basic/SMB/Makefile
3350 src/auth/basic/SMB_LM/Makefile
3351 src/auth/basic/SSPI/Makefile
3352 src/auth/digest/Makefile
3353 src/auth/digest/eDirectory/Makefile
3354 src/auth/digest/file/Makefile
3355 src/auth/digest/LDAP/Makefile
3356 src/auth/negotiate/Makefile
3357 src/auth/negotiate/kerberos/Makefile
3358 src/auth/negotiate/SSPI/Makefile
3359 src/auth/negotiate/wrapper/Makefile
3360 src/auth/ntlm/Makefile
3361 src/auth/ntlm/fake/Makefile
3362 src/auth/ntlm/SMB_LM/Makefile
3363 src/auth/ntlm/SSPI/Makefile
3364 src/base/Makefile
3365 src/clients/Makefile
3366 src/comm/Makefile
3367 src/debug/Makefile
3368 src/dns/Makefile
3369 src/DiskIO/Makefile
3370 src/DiskIO/AIO/Makefile
3371 src/DiskIO/Blocking/Makefile
3372 src/DiskIO/DiskDaemon/Makefile
3373 src/DiskIO/DiskThreads/Makefile
3374 src/DiskIO/IpcIo/Makefile
3375 src/DiskIO/Mmapped/Makefile
3376 src/error/Makefile
3377 src/esi/Makefile
3378 src/eui/Makefile
3379 src/format/Makefile
3380 src/fs/Makefile
3381 src/ftp/Makefile
3382 src/helper/Makefile
3383 src/http/Makefile
3384 src/http/one/Makefile
3385 src/http/url_rewriters/Makefile
3386 src/http/url_rewriters/fake/Makefile
3387 src/http/url_rewriters/LFS/Makefile
3388 src/icmp/Makefile
3389 src/ident/Makefile
3390 src/ip/Makefile
3391 src/ipc/Makefile
3392 src/log/Makefile
3393 src/log/DB/Makefile
3394 src/log/file/Makefile
3395 src/mem/Makefile
3396 src/mgr/Makefile
3397 src/parser/Makefile
3398 src/proxyp/Makefile
3399 src/repl/Makefile
3400 src/sbuf/Makefile
3401 src/security/Makefile
3402 src/security/cert_generators/Makefile
3403 src/security/cert_generators/file/Makefile
3404 src/security/cert_validators/Makefile
3405 src/security/cert_validators/fake/Makefile
3406 src/servers/Makefile
3407 src/snmp/Makefile
3408 src/ssl/Makefile
3409 src/store/Makefile
3410 src/store/id_rewriters/Makefile
3411 src/store/id_rewriters/file/Makefile
3412 src/time/Makefile
3413 test-suite/Makefile
3414 tools/Makefile
3415 tools/apparmor/Makefile
3416 tools/helper-mux/Makefile
3417 tools/purge/Makefile
3418 tools/squidclient/Makefile
3419 tools/systemd/Makefile
3420 tools/sysvinit/Makefile
3421 ])
3422
3423 # must configure libltdl subdir unconditionally for "make distcheck" to work
3424 #AC_CONFIG_SUBDIRS(libltdl)
3425
3426 AC_OUTPUT