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