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