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