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