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