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