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