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