]> git.ipfire.org Git - thirdparty/squid.git/blob - configure.in
Fixed assertion failures in the authentication framework after the latest
[thirdparty/squid.git] / configure.in
1
2 dnl Configuration input file for Squid
3 dnl
4 dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
5 dnl
6 dnl $Id: configure.in,v 1.384 2005/08/28 10:45:32 serassio Exp $
7 dnl
8 dnl
9 dnl
10 AC_INIT
11 AC_PREREQ(2.52)
12 AC_CONFIG_SRCDIR([src/main.cc])
13 AC_CONFIG_AUX_DIR(cfgaux)
14 AM_INIT_AUTOMAKE(squid, 3.0-PRE3-CVS)
15 AM_CONFIG_HEADER(include/autoconf.h)
16 AC_REVISION($Revision: 1.384 $)dnl
17 AC_PREFIX_DEFAULT(/usr/local/squid)
18 AM_MAINTAINER_MODE
19
20 dnl Set default LDFLAGS
21 if test -z "$LDFLAGS"; then
22 LDFLAGS="-g"
23 fi
24
25 PRESET_CFLAGS="$CFLAGS"
26
27 dnl Check for GNU cc
28 AC_PROG_CC
29 AC_LANG_C
30 AC_PROG_CXX
31 AM_PROG_CC_C_O
32 AC_CANONICAL_HOST
33 AC_DISABLE_SHARED
34 AC_PROG_LIBTOOL
35 AC_LTDL_DLLIB
36 AC_PROG_RANLIB
37
38
39 CRYPTLIB=''
40 REGEXLIB='' # -lregex
41 LIBREGEX='' # libregex.a
42
43 dnl find out the exe extension for this platform. If it's not empty, use it for CGI's as well.
44 AC_EXEEXT
45 AC_OBJEXT
46
47 if test -z "$EXEEXT"; then
48 CGIEXT=".cgi"
49 else
50 # automake automatically adds .exe when installing binaries
51 CGIEXT=""
52 fi
53 AC_SUBST(CGIEXT)
54
55 dnl this should be expanded to a list of platform sensible support requirements.
56 dnl (adding an option like --enable-cygwin-support doesn't make sense :]) - R Collins 2001
57 case "$host_os" in
58 mingw|mingw32|cygwin|cygwin32)
59 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, true)
60 ;;
61 *)
62 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, false)
63 ;;
64 esac
65
66 case "$host_os" in
67 mingw|mingw32)
68 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
69 CFLAGS="$CFLAGS -mthreads"
70 CXXFLAGS="$CXXFLAGS -mthreads"
71 if test "$ac_cv_path_WIN32_PSAPI" = "none"; then
72 echo "PSAPI.DLL is recommended to run Squid on Windows NT Platform"
73 echo "Please see PSAPI.DLL section on doc/win32-relnotes.html."
74 else
75 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
76 LIBS="$LIBS -lpsapi"
77 fi
78 ;;
79 esac
80
81 if test -z "$CACHE_HTTP_PORT"; then
82 CACHE_HTTP_PORT="3128"
83 fi
84 if test -z "$CACHE_ICP_PORT"; then
85 CACHE_ICP_PORT="3130"
86 fi
87
88 dnl Substitutions
89 AC_DEFINE_UNQUOTED(CACHE_HTTP_PORT, $CACHE_HTTP_PORT,
90 [What default TCP port to use for HTTP listening?])
91 AC_DEFINE_UNQUOTED(CACHE_ICP_PORT, $CACHE_ICP_PORT,
92 [What default UDP port to use for ICP listening?])
93
94 AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
95
96 AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args", [configure command line used to configure Squid])
97
98 dnl Check for GNU cc
99 AC_PROG_CC
100
101 dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
102 case "$host" in
103 mab-next-nextstep3)
104 CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
105 ;;
106 esac
107
108 if test "$GCC" = "yes"; then
109 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
110 GCCVER2=`echo $GCCVER | awk '{print $1 * 100}'`
111 case "$host" in
112 i386-*-freebsd*)
113 if test $GCCVER2 -lt 300 ; then
114 echo "ERROR: GCC $GCCVER causes a coredump on $host"
115 echo "ERROR: Try a more recent GCC version"
116 sleep 5
117 fi
118 ;;
119 esac
120 unset GCCVER
121 unset GCCVER2
122 fi
123
124 dnl Set Default CFLAGS
125 if test -z "$PRESET_CFLAGS"; then
126 if test "$GCC" = "yes"; then
127 case "$host" in
128 *-sun-sunos*)
129 # sunos has too many warnings for this to be useful
130 # motorola too
131 ;;
132 *m88k*)
133 # Motorola cc/ld does not like -02 but is ok on -O
134 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
135 ;;
136 *)
137 CFLAGS="$CFLAGS -Wall"
138 ;;
139 esac
140 else
141 case "$host" in
142 *mips-sgi-irix6.*)
143 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
144 CFLAGS="$CFLAGS -n32 -mips3 -O3 -OPT:Olimit=0:space=OFF \
145 -woff 1009,1014,1110,1116,1185,1188,1204,1230,1233 \
146 -Wl,-woff,85,-woff,84,-woff,134 \
147 -nostdinc -I/usr/include -D_BSD_SIGNALS"
148 ;;
149 alpha-dec-osf4.*)
150 # Mogul says DEC compilers take both -g and -O2
151 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
152 CFLAGS="$CFLAGS -O2"
153 ;;
154 *)
155 ;;
156 esac
157 fi
158 fi
159
160 dnl set squid required flags
161 if test "$GCC" = "yes"; then
162 SQUID_CFLAGS="-Werror -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments"
163 SQUID_CXXFLAGS="-Werror -Wall -Wpointer-arith -Wwrite-strings -Wcomments"
164 else
165 SQUID_CFLAGS=
166 SQUID_CXXFLAGS=
167 fi
168 AC_SUBST(SQUID_CFLAGS)
169 AC_SUBST(SQUID_CXXFLAGS)
170
171 AC_TEST_CHECKFORHUGEOBJECTS
172 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $HUGE_OBJECT_FLAG"
173
174 dnl Set LDFLAGS
175 if test -z "$PRESET_LDFLAGS"; then
176 if test "$GCC" = "yes"; then
177 case "$host" in
178 *)
179 # nothing
180 ;;
181 esac
182 else
183 case "$host" in
184 *mips-sgi-irix6.*)
185 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
186 LDFLAGS="-n32 -mips3 -nostdlib -L/usr/lib32"
187 ;;
188 esac
189 fi
190 fi
191
192 dnl Enable optional modules
193 AC_ARG_ENABLE(dlmalloc,
194 [ --enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea],
195 [
196 case "$enableval" in
197 'yes')
198 use_dlmalloc="yes"
199 LIBDLMALLOC="libdlmalloc.a"
200 LIB_MALLOC="-L../lib -ldlmalloc"
201 echo "dlmalloc enabled"
202 ;;
203 'no')
204 use_dlmalloc="no"
205 echo "dlmalloc disabled"
206 ;;
207 *) use_dlmalloc="yes"
208 LIB_MALLOC="$enableval"
209 echo "dlmalloc enabled with $LIB_MALLOC"
210 esac
211 ])
212 if test "${use_dlmalloc-unset}" = unset; then
213 case "$host" in
214 i386-*-solaris2.*)
215 echo "Enabling dlmalloc for $host"
216 use_dlmalloc="yes"
217 LIBDLMALLOC="libdlmalloc.a"
218 LIB_MALLOC="-L../lib -ldlmalloc"
219 ;;
220 *-sgi-irix*)
221 echo "Enabling dlmalloc for $host"
222 use_dlmalloc="yes"
223 LIBDLMALLOC="libdlmalloc.a"
224 LIB_MALLOC="-L../lib -ldlmalloc"
225 ;;
226 esac
227 fi
228 if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
229 # Ok. dlmalloc was enabled before, but state may be changed.
230 # we have to test these again
231 unset ac_cv_func_mallinfo
232 unset ac_cv_func_mallocblksize
233 unset ac_cv_func_free
234 unset ac_cv_func_realloc
235 unset ac_cv_func_memalign
236 unset ac_cv_func_valloc
237 unset ac_cv_func_pvalloc
238 unset ac_cv_func_calloc
239 unset ac_cv_func_cfree
240 unset ac_cv_func_malloc_trim
241 unset ac_cv_func_malloc_usable_size
242 unset ac_cv_func_malloc_stats
243 unset ac_cv_func_mallinfo
244 unset ac_cv_func_mallopt
245 unset ac_cv_lib_gnumalloc
246 unset ac_cv_header_gnumalloc_h
247 unset ac_cv_lib_malloc
248 unset ac_cv_enabled_dlmalloc
249 fi
250 if test "$use_dlmalloc" = yes; then
251 ac_cv_func_mallinfo="yes"
252 ac_cv_func_mallocblksize="no"
253 ac_cv_func_free="yes"
254 ac_cv_func_realloc="yes"
255 ac_cv_func_memalign="yes"
256 ac_cv_func_valloc="yes"
257 ac_cv_func_pvalloc="yes"
258 ac_cv_func_calloc="yes"
259 ac_cv_func_cfree="yes"
260 ac_cv_func_malloc_trim="yes"
261 ac_cv_func_malloc_usable_size="yes"
262 ac_cv_func_malloc_stats="yes"
263 ac_cv_func_mallopt="yes"
264 ac_cv_lib_gnumalloc="no"
265 ac_cv_header_gnumalloc_h="no"
266 ac_cv_lib_malloc="no"
267 ac_cv_enabled_dlmalloc="yes"
268 AC_DEFINE(USE_DLMALLOC, 1, [Compile & use the malloc package by Doug Lea])
269 fi
270
271 AC_SUBST(LIBDLMALLOC)
272 AC_SUBST(LIB_MALLOC)
273
274 AC_ARG_ENABLE(gnuregex,
275 [ --enable-gnuregex Compile GNUregex. Unless you have reason to use this
276 option, you should not enable it. This library file
277 is usually only required on Windows and very old
278 Unix boxes which do not have their own regex library
279 built in.],
280 [USE_GNUREGEX=$enableval])
281
282 SquidInline="yes"
283
284 AC_ARG_ENABLE(optimizations,
285 [ --disable-optimizations Don't compile Squid with compiler optimizations enabled.
286 Optimization is good for production builds, but not
287 good for debugging. During development, use
288 --disable-optimizations to reduce compilation times
289 and allow easier debugging. This option implicitly
290 also enabled --disable-inline],
291 [ if test "$enableval" = "no" ; then
292 echo "Disabling compiler optimizations (-O flag)"
293 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
294 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`"
295 SquidInline="no"
296 fi
297 ])
298
299 AC_ARG_ENABLE(inline,
300 [ --disable-inline Don't compile trivial methods as inline. Squid
301 is coded with much of the code able to be inlined.
302 Inlining is good for production builds, but not
303 good for development. During development, use
304 --disable-inline to reduce compilation times and
305 allow incremental builds to be quick. For
306 production builds, or load tests, use
307 --enable-inline to have squid make all trivial
308 methods inlinable by the compiler.],
309 [ if test "$enableval" = "no" ; then
310 SquidInline="no"
311 fi
312 ])
313
314 if test "$SquidInline" = "yes" ; then
315 AC_DEFINE(_SQUID_INLINE_, inline, [Keyword used by squid for inlining methods])
316 AC_DEFINE(_USE_INLINE_,, [Include inline methods into header file])
317 else
318 echo "Inlining optimization disabled"
319 AC_DEFINE(_SQUID_INLINE_,, [Keyword used by squid for inlining methods])
320 fi
321
322 AC_ARG_ENABLE(debug-cbdata,
323 [ --enable-debug-cbdata Provide some debug information in cbdata],
324 [ if test "$enableval" = "yes" ; then
325 echo "cbdata debugging enabled"
326 AC_DEFINE(CBDATA_DEBUG,1,[Enable for cbdata debug information])
327 fi
328 ])
329
330 dnl This is a developer only option.. developers know how to set defines
331 dnl
332 dnl AC_ARG_ENABLE(xmalloc-debug,
333 dnl [ --enable-xmalloc-debug Do some simple malloc debugging],
334 dnl [ if test "$enableval" = "yes" ; then
335 dnl echo "Malloc debugging enabled"
336 dnl AC_DEFINE(XMALLOC_DEBUG,1,[Define to do simple malloc debugging])
337 dnl fi
338 dnl ])
339
340 dnl This is a developer only option.. developers know how to set defines
341 dnl
342 dnl AC_ARG_ENABLE(xmalloc-debug-trace,
343 dnl [ --enable-xmalloc-debug-trace
344 dnl Detailed trace of memory allocations],
345 dnl [ if test "$enableval" = "yes" ; then
346 dnl echo "Malloc debug trace enabled"
347 dnl AC_DEFINE(XMALLOC_TRACE,1,[Define to have a detailed trace of memory allocations])
348 dnl AC_DEFINE(XMALLOC_DEBUG,1)
349 dnl fi
350 dnl ])
351
352 AC_ARG_ENABLE(xmalloc-statistics,
353 [ --enable-xmalloc-statistics
354 Show malloc statistics in status page],
355 [ if test "$enableval" = "yes" ; then
356 echo "Malloc statistics enabled"
357 AC_DEFINE(XMALLOC_STATISTICS,1,[Define to have malloc statistics])
358 fi
359 ])
360
361 use_carp=1
362 AC_ARG_ENABLE(carp,
363 [ --disable-carp Disable CARP support],
364 [ if test "$enableval" = "no" ; then
365 echo "CARP disabled"
366 use_carp=0
367 fi
368 ])
369 if test $use_carp = 1; then
370 AC_DEFINE(USE_CARP, 1, [Cache Array Routing Protocol])
371 else
372 AC_DEFINE(USE_CARP, 1)
373 fi
374
375 AC_ARG_ENABLE(async-io,
376 [ --enable-async-io[=N_THREADS]
377 Shorthand for
378 --with-aufs-threads=N_THREADS
379 --with-pthreads
380 --enable-storeio=ufs,aufs],
381 [ case $enableval in
382 yes)
383 with_pthreads="yes"
384 STORE_MODULES="ufs aufs"
385 ;;
386 no)
387 ;;
388 *)
389 aufs_io_threads=$enableval
390 with_pthreads="yes"
391 STORE_MODULES="ufs aufs"
392 ;;
393 esac
394 ])
395
396 AC_ARG_WITH(aufs-threads,
397 [ --with-aufs-threads=N_THREADS
398 Tune the number of worker threads for the aufs object
399 store.],
400 [ case $withval in
401 [[0-9]]*)
402 aufs_io_threads=$withval
403 ;;
404 *)
405 echo "ERROR: Invalid --with-aufs-threads argument"
406 exit 1
407 ;;
408 esac
409 ])
410 if test "$aufs_io_threads"; then
411 echo "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(pthreads,
417 [ --with-pthreads Use POSIX Threads])
418 if test "$with_pthreads" = "yes"; then
419 echo "With pthreads"
420 fi
421
422 AC_ARG_WITH(aio,
423 [ --with-aio Use POSIX AIO])
424 if test "$with_aio" = "yes"; then
425 echo "With aio"
426 fi
427
428 AC_ARG_WITH(dl,
429 [ --with-dl Use dynamic linking])
430 if test "$with_dl" = "yes"; then
431 echo "With dl"
432 fi
433
434 AC_ARG_ENABLE(storeio,
435 [ --enable-storeio=\"list of modules\"
436 Build support for the list of store I/O modules.
437 The default is only to build the "ufs" module.
438 See src/fs for a list of available modules, or
439 Programmers Guide section <not yet written>
440 for details on how to build your custom store module],
441 [ case $enableval in
442 yes)
443 for dir in $srcdir/src/fs/*; do
444 module="`basename $dir`"
445 if test -d "$dir" && test "$module" != CVS; then
446 STORE_MODULES="$STORE_MODULES $module"
447 fi
448 done
449 ;;
450 no)
451 ;;
452 *)
453 STORE_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
454 ;;
455 esac
456 ],
457 [ if test -z "$STORE_MODULES"; then
458 STORE_MODULES="ufs"
459 fi
460 ])
461 if test -n "$STORE_MODULES"; then
462 for module in $STORE_MODULES; do
463 if test -d $srcdir/src/fs/$module; then
464 :
465 else
466 echo "ERROR: storeio $module does not exists"
467 exit 1
468 fi
469 done
470 echo "Store modules built: $STORE_MODULES"
471 STORE_LINKOBJS=
472 for module in $STORE_MODULES; do
473 STORE_LINKOBJS="$STORE_LINKOBJS fs/${module}/StoreFS${module}.o"
474 done
475 fi
476 dnl remove all but diskd - its the only module that needs to recurse
477 dnl into the sub directory
478 UFS_FOUND=
479 NEED_UFS=
480 NEED_BLOCKING=
481 NEED_DISKDAEMON=
482 NEED_DISKTHREADS=
483 NEED_AIO=
484 for fs in $STORE_MODULES none; do
485 case "$fs" in
486 diskd)
487 NEED_UFS="true"
488 NEED_BLOCKING="true"
489 NEED_DISKDAEMON="true"
490 ;;
491 aufs)
492 NEED_UFS="true"
493 NEED_BLOCKING="true"
494 NEED_DISKTHREADS="true"
495 ;;
496 coss)
497 NEED_AIO="true"
498 ;;
499 ufs)
500 UFS_FOUND="true"
501 esac
502 done
503 STORE_OBJS=
504 STORE_LIBS=
505 dnl We have 'fake' modules - aufs and diskd - legacy.
506 for fs in $STORE_MODULES; do
507 case "$fs" in
508 diskd);;
509 aufs);;
510 *)
511 STORE_OBJS="$STORE_OBJS fs/lib${fs}.a"
512 STORE_LIBS="$STORE_LIBS lib${fs}.a"
513 ;;
514 esac
515 done
516
517 if test -z "$UFS_FOUND" && test -n "$NEED_UFS"; then
518 echo "adding UFS, as it contains core logic for diskd and aufs"
519 STORE_OBJS="$STORE_OBJS fs/libufs.a"
520 STORE_LIBS="$STORE_LIBS libufs.a"
521 STORE_MODULES="$STORE_MODULES ufs"
522 STORE_LINKOBJS="$STORE_LINKOBJS fs/ufs/StoreFSufs.o"
523 fi
524
525 AC_SUBST(STORE_OBJS)
526 AC_SUBST(STORE_LIBS)
527 AC_SUBST(STORE_LINKOBJS)
528
529 AC_ARG_ENABLE(disk-io,
530 [ --enable-disk-io=\"list of modules\"
531 Build support for the list of disk I/O modules.
532 The default is only to build the "Blocking" module.
533 See src/DiskIO for a list of available modules, or
534 Programmers Guide section <not yet written>
535 for details on how to build your custom disk module],
536 [ case $enableval in
537 yes)
538 for dir in $srcdir/src/DiskIO/*; do
539 module="`basename $dir`"
540 if test -d "$dir" && test "$module" != CVS; then
541 DISK_MODULES="$DISK_MODULES $module"
542 fi
543 done
544 ;;
545 no)
546 ;;
547 *)
548 DISK_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
549 ;;
550 esac
551 ],
552 [ if test -z "$DISK_MODULES"; then
553 DISK_MODULES="Blocking"
554 fi
555 ])
556 if test -n "$DISK_MODULES"; then
557 for module in $DISK_MODULES; do
558 if test -d $srcdir/src/DiskIO/$module; then
559 :
560 else
561 echo "ERROR: disk-io $module does not exists"
562 exit 1
563 fi
564 done
565 DISK_LIBS="lib`echo $DISK_MODULES|sed -e 's% %.a lib%g'`.a"
566 DISK_LINKOBJS=
567 for module in $DISK_MODULES; do
568 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/${module}/${module}DiskIOModule.o"
569 done
570 fi
571 for fs in $DISK_MODULES none; do
572 case "$fs" in
573 DiskDaemon)
574 DISK_PROGRAMS="$DISK_PROGRAMS DiskIO/DiskDaemon/diskd"
575 FOUND_DISKDAEMON="true"
576 ;;
577 DiskThreads)
578 FOUND_DISKTHREADS="true"
579 ;;
580 AIO)
581 FOUND_AIO="true"
582 ;;
583 Blocking)
584 FOUND_BLOCKING="true"
585 esac
586 done
587
588 if test -z "$FOUND_BLOCKING" && test -n "$NEED_BLOCKING"; then
589 echo "adding Blocking, as it is used by an active, legacy Store Module"
590 DISK_LIBS="$DISK_LIBS libBlocking.a"
591 DISK_MODULES="$DISK_MODULES Blocking"
592 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/Blocking/BlockingDiskIOModule.o"
593 fi
594
595 if test -z "$FOUND_DISKDAEMON" && test -n "$NEED_DISKDAEMON"; then
596 echo "adding DiskDaemon, as it is used by an active, legacy Store Module"
597 DISK_LIBS="$DISK_LIBS libDiskDaemon.a"
598 DISK_MODULES="$DISK_MODULES DiskDaemon"
599 DISK_PROGRAMS="$DISK_PROGRAMS DiskIO/DiskDaemon/diskd"
600 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskDaemon/DiskDaemonDiskIOModule.o"
601 fi
602
603 if test -z "$FOUND_DISKTHREADS" && test -n "$NEED_DISKTHREADS"; then
604 echo "adding DiskThreads, as it is used by an active, legacy Store Module"
605 DISK_LIBS="$DISK_LIBS libDiskThreads.a"
606 DISK_MODULES="$DISK_MODULES DiskThreads"
607 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskThreads/DiskThreadsDiskIOModule.o"
608 fi
609 if test -z "$FOUND_AIO" && test -n "$NEED_AIO"; then
610 echo "adding AIO, as it is used by an active, legacy Store Module"
611 DISK_LIBS="$DISK_LIBS libAIO.a"
612 DISK_MODULES="$DISK_MODULES AIO"
613 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/AIO/AIODiskIOModule.o"
614 fi
615 echo "IO Modules built: $DISK_MODULES"
616 dnl we know what is being built. now add dependencies.
617 for fs in $DISK_MODULES none; do
618 case "$fs" in
619 DiskThreads)
620 if test -z "$with_pthreads"; then
621 echo "DiskThreads IO Module used, pthreads support automatically enabled"
622 with_pthreads=yes
623 fi
624 ;;
625 AIO)
626 if test -z "$with_aio"; then
627 echo "Aio IO Module used, aio support automatically enabled"
628 with_aio=yes
629 fi
630 ;;
631 esac
632 done
633
634 AC_SUBST(DISK_LIBS)
635 AC_SUBST(DISK_PROGRAMS)
636 AC_SUBST(DISK_LINKOBJS)
637
638 AC_ARG_ENABLE(removal-policies,
639 [ --enable-removal-policies=\"list of policies\"
640 Build support for the list of removal policies.
641 The default is only to build the "lru" module.
642 See src/repl for a list of available modules, or
643 Programmers Guide section 9.9 for details on how
644 to build your custom policy],
645 [ case $enableval in
646 yes)
647 for dir in $srcdir/src/repl/*; do
648 module="`basename $dir`"
649 if test -d "$dir" && test "$module" != CVS; then
650 REPL_POLICIES="$REPL_POLICIES $module"
651 fi
652 done
653 ;;
654 no)
655 ;;
656 *)
657 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
658 ;;
659 esac
660 ],
661 [ if test -z "$REPL_POLICIES"; then
662 REPL_POLICIES="lru"
663 fi
664 ])
665 if test -n "$REPL_POLICIES"; then
666 for module in $REPL_POLICIES; do
667 if test -d $srcdir/src/repl/$module; then
668 :
669 else
670 echo "ERROR: Removal policy $module does not exists"
671 exit 1
672 fi
673 done
674 echo "Removal policies built: $REPL_POLICIES"
675 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
676 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
677 fi
678 AC_SUBST(REPL_POLICIES)
679 AC_SUBST(REPL_OBJS)
680 AC_SUBST(REPL_LIBS)
681
682 AM_CONDITIONAL(ENABLE_PINGER, false)
683 AC_ARG_ENABLE(icmp,
684 [ --enable-icmp Enable ICMP pinging],
685 [ if test "$enableval" = "yes" ; then
686 echo "ICMP enabled"
687 AC_DEFINE(USE_ICMP,1,
688 [If you want to use Squid's ICMP features (highly recommended!) then
689 define this. When USE_ICMP is defined, Squid will send ICMP pings
690 to origin server sites. This information is used in numerous ways:
691 - Sent in ICP replies so neighbor caches know how close
692 you are to the source.
693 - For finding the closest instance of a URN.
694 - With the 'test_reachability' option. Squid will return
695 ICP_OP_MISS_NOFETCH for sites which it cannot ping.])
696 AM_CONDITIONAL(ENABLE_PINGER, true)
697 fi
698 ])
699
700 AM_CONDITIONAL(USE_DELAY_POOLS, false)
701 AC_ARG_ENABLE(delay-pools,
702 [ --enable-delay-pools Enable delay pools to limit bandwidth usage],
703 [ if test "$enableval" = "yes" ; then
704 echo "Delay pools enabled"
705 AC_DEFINE([DELAY_POOLS],1,[Traffic management via "delay pools".])
706 AM_CONDITIONAL(USE_DELAY_POOLS, true,)
707 fi
708 ])
709
710 AM_CONDITIONAL(USE_ESI, false)
711 AC_ARG_ENABLE(esi,
712 AC_HELP_STRING([--enable-esi],[Enable ESI for accelerators. Requires libexpat. Enabling ESI will cause squid to follow the Edge Acceleration Specification (www.esi.org). This causes squid to IGNORE client Cache-Control headers. DO NOT use this in a squid configured as a web proxy, ONLY use it in a squid configured for webserver acceleration.]),
713 ac_cv_use_esi=$enableval, ac_cv_use_esi=no)
714 AC_CACHE_CHECK(whether to enable ESI,ac_cv_use_esi, ac_cv_use_esi=no)
715 if test "$ac_cv_use_esi" = "yes" ; then
716 AC_DEFINE(ESI,1,[Compile the ESI processor and Surrogate header support])
717 AM_CONDITIONAL(USE_ESI, true)
718 XTRA_LIBS="$XTRA_LIBS -lexpat -lxml2"
719 else
720 AC_DEFINE(ESI,0,[Compile the ESI processor and Surrogate header support])
721 fi
722
723 dnl This is a developer only option. Developers know how to set defines
724 dnl
725 dnl AC_ARG_ENABLE(mem-gen-trace,
726 dnl [ --enable-mem-gen-trace Do trace of memory stuff],
727 dnl [ if test "$enableval" = "yes" ; then
728 dnl echo "Memory trace (to file) enabled"
729 dnl AC_DEFINE(MEM_GEN_TRACE,1,[Define for log file trace of mem alloc/free])
730 dnl fi
731 dnl ])
732
733 AC_ARG_ENABLE(useragent-log,
734 [ --enable-useragent-log Enable logging of User-Agent header],
735 [ if test "$enableval" = "yes" ; then
736 echo "User-Agent logging enabled"
737 AC_DEFINE(USE_USERAGENT_LOG,1,[If you want to log User-Agent request header values, define this.
738 By default, they are written to useragent.log in the Squid log
739 directory.])
740 fi
741 ])
742
743 AC_ARG_ENABLE(referer-log,
744 [ --enable-referer-log Enable logging of Referer header],
745 [ if test "$enableval" = "yes" ; then
746 echo "Referer logging enabled"
747 AC_DEFINE(USE_REFERER_LOG,1,[If you want to log Referer request header values, define this.
748 By default, they are written to referer.log in the Squid log
749 directory.])
750 fi
751 ])
752
753 use_wccp=1
754 AC_ARG_ENABLE(wccp,
755 [ --disable-wccp Disable Web Cache Coordination Protocol],
756 [ if test "$enableval" = "no" ; then
757 echo "Web Cache Coordination Protocol disabled"
758 use_wccp=0
759 fi
760 ])
761 if test $use_wccp = 1; then
762 AC_DEFINE(USE_WCCP, 1,[Define to enable WCCP])
763 else
764 AC_DEFINE(USE_WCCP, 0)
765 fi
766
767 AC_ARG_ENABLE(kill-parent-hack,
768 [ --enable-kill-parent-hack
769 Kill parent on shutdown],
770 [ if test "$enableval" = "yes" ; then
771 echo "Kill parent on shutdown"
772 AC_DEFINE(KILL_PARENT_OPT,1,[A dangerous feature which causes Squid to kill its parent process
773 (presumably the RunCache script) upon receipt of SIGTERM or SIGINT.
774 Use with caution.])
775 fi
776 ])
777
778 AM_CONDITIONAL(USE_SNMP, false)
779 AC_ARG_ENABLE(snmp,
780 [ --enable-snmp Enable SNMP monitoring],
781 [ if test "$enableval" = "yes" ; then
782 echo "SNMP monitoring enabled"
783 AC_DEFINE(SQUID_SNMP,1,[Define to enable SNMP monitoring of Squid])
784 SNMPLIB='-L../snmplib -lsnmp'
785 AM_CONDITIONAL(USE_SNMP, true)
786 SNMP_MAKEFILE=./snmplib/Makefile
787 makesnmplib=snmplib
788 fi
789 ])
790 AC_SUBST(SNMPLIB)
791 AC_SUBST(makesnmplib)
792
793 AC_ARG_ENABLE(cachemgr-hostname,
794 [ --enable-cachemgr-hostname[=hostname]
795 Make cachemgr.cgi default to this host],
796 [ case $enableval in
797 yes)
798 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
799 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
800 echo "Cachemgr default hostname == host where cachemgr runs"
801 ;;
802 no)
803 : # Nothing to do..
804 ;;
805 *)
806 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
807 echo "Cachemgr default hostname set to ${enableval}"
808 ;;
809 esac
810 ])
811
812 AM_CONDITIONAL(ENABLE_ARP_ACL, false)
813 AC_ARG_ENABLE(arp-acl,
814 [ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
815 [ if test "$enableval" = "yes" ; then
816 echo "ARP ACL lists enabled (ether address)"
817 case "$host" in
818 *-linux-*)
819 ;;
820 *-solaris*)
821 ;;
822 *-freebsd*)
823 ;;
824 *-cygwin*)
825 LIBS="$LIBS -liphlpapi"
826 ;;
827 *-mingw*)
828 LIBS="$LIBS -liphlpapi"
829 ;;
830 *)
831 echo "WARNING: ARP ACL support probably won't work on $host."
832 sleep 10
833 ;;
834 esac
835 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, ?).])
836 AM_CONDITIONAL(ENABLE_ARP_ACL, true)
837 fi
838 ])
839
840 AM_CONDITIONAL(ENABLE_HTCP, false)
841 AC_ARG_ENABLE(htcp,
842 [ --enable-htcp Enable HTCP protocol],
843 [ if test "$enableval" = "yes" ; then
844 echo "HTCP enabled"
845 AC_DEFINE(USE_HTCP,1, [Define this to include code for the Hypertext Cache Protocol (HTCP)])
846 AM_CONDITIONAL(ENABLE_HTCP, true)
847 fi
848 ])
849
850 AM_CONDITIONAL(ENABLE_SSL, false)
851
852 AC_ARG_ENABLE(ssl,
853 [ --enable-ssl Enable ssl gatewaying support using OpenSSL],
854 [ if test "$enableval" != "no"; then
855 echo "SSL gatewaying using OpenSSL enabled"
856 AC_DEFINE(USE_SSL,1,[Define this to include code for SSL encryption.])
857 AM_CONDITIONAL(ENABLE_SSL, true)
858 case "$host_os" in
859 mingw|mingw32)
860 dnl Native Windows port of OpenSSL needs -lgdi32
861 SSLLIB='-lssl -lcrypto -lgdi32'
862 ;;
863 *)
864 SSLLIB='-lssl -lcrypto'
865 ;;
866 esac
867 USE_OPENSSL=1
868 fi
869 ])
870
871 AM_CONDITIONAL(NEED_OWN_MD5, true)
872
873 AC_ARG_WITH(openssl,
874 [ --with-openssl[=prefix]
875 Compile with the OpenSSL libraries. The path to
876 the OpenSSL development libraries and headers
877 installation can be specified if outside of the
878 system standard directories],
879 [
880 case "$with_openssl" in
881 yes)
882 USE_OPENSSL=1
883 ;;
884 no)
885 USE_OPENSSL=
886 ;;
887 *)
888 SSLLIBDIR="$with_openssl/lib"
889 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
890 USE_OPENSSL=1
891 esac
892 ])
893
894 if test -n "$USE_OPENSSL"; then
895 echo "Using OpenSSL MD5 implementation"
896 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)])
897 AM_CONDITIONAL(NEED_OWN_MD5, false)
898 if test -z "$SSLLIB"; then
899 SSLLIB="-lcrypto" # for MD5 routines
900 fi
901 dnl This is a workaround for RedHat 9 brain damage..
902 if test -d /usr/kerberos/include && test -z "$SSLLIBDIR" && test -f /usr/include/openssl/kssl.h; then
903 echo "OpenSSL depends on Kerberos"
904 SSLLIBDIR="/usr/kerberos/lib"
905 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
906 fi
907 fi
908 if test -n "$SSLLIBDIR"; then
909 SSLLIB="-L$SSLLIBDIR $SSLLIB"
910 fi
911 AC_SUBST(SSLLIB)
912
913 AC_ARG_ENABLE(forw-via-db,
914 [ --enable-forw-via-db Enable Forw/Via database],
915 [ if test "$enableval" = "yes" ; then
916 echo "FORW-VIA enabled"
917 AC_DEFINE(FORW_VIA_DB,1,[Enable Forw/Via database])
918 fi
919 ])
920
921 AC_ARG_ENABLE(cache-digests,
922 [ --enable-cache-digests Use Cache Digests
923 see http://www.squid-cache.org/FAQ/FAQ-16.html],
924 [ if test "$enableval" = "yes" ; then
925 echo "USE_CACHE_DIGESTS enabled"
926 AC_DEFINE(USE_CACHE_DIGESTS,1,[Use Cache Digests for locating objects in neighbor caches. This code is still semi-experimental.])
927 fi
928 ])
929
930 dnl Select Default Error language
931 AC_ARG_ENABLE(default-err-language,
932 [ --enable-default-err-language=lang
933 Select default language for Error pages (see
934 errors directory) ],
935 [
936 if test -d $srcdir/errors/$enableval; then
937 ERR_DEFAULT_LANGUAGE=$enableval
938 else
939 echo "ERROR! Unknown language $enableval, see errors/ directory"
940 exit 1
941 fi
942 ],[ERR_DEFAULT_LANGUAGE="English"])
943 AC_SUBST(ERR_DEFAULT_LANGUAGE)
944
945 dnl Select languages to be installed
946 AC_ARG_ENABLE(err-languages,
947 [ --enable-err-languages=\"lang1 lang2..\"
948 Select languages to be installed. (All will be
949 installed by default) ],
950 [
951 for l in $enableval; do
952 if test -d $srcdir/errors/$l; then :; else
953 echo "ERROR! Unknown language $$l, see errors/"
954 exit 1
955 fi
956 done
957 ERR_LANGUAGES=$enableval
958 ],[
959 ERR_LANGUAGES=
960 for l in $srcdir/errors/*; do
961 if test -f $l/ERR_ACCESS_DENIED; then
962 ERR_LANGUAGES="$ERR_LANGUAGES `basename $l`"
963 fi
964 done
965 ])
966 AC_SUBST(ERR_LANGUAGES)
967
968 dnl Size of COSS memory buffer
969 AC_ARG_WITH(coss-membuf-size,
970 [ --with-coss-membuf-size COSS membuf size (default 1048576 bytes) ],
971 [ if test "$with_coss_membuf_size"; then
972 echo "Setting COSS membuf size to $with_coss_membuf_size bytes"
973 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $with_coss_membuf_size,[Define if you want to set the COSS membuf size])
974 fi
975 ])
976
977 dnl check for netio plugin stuff
978 dnl Enable poll()
979 AC_ARG_ENABLE(poll,
980 [ --enable-poll Enable poll() support.
981 --disable-poll Disable poll() support. ],
982
983 [
984 case "$enableval" in
985 yes)
986 echo "Forcing poll() to be enabled"
987 ac_cv_func_poll='yes'
988 ;;
989 no)
990 echo "Forcing poll() to be disabled"
991 ac_cv_func_poll='no'
992 ;;
993 esac
994 ])
995
996 dnl Enable select()
997 AC_ARG_ENABLE(select,
998 [ --enable-select Enable select() support.
999 --disable-select Disable select() support. ],
1000
1001 [
1002 case "$enableval" in
1003 yes)
1004 echo "Forcing select() to be enabled"
1005 ac_cv_func_select='yes'
1006 ;;
1007 no)
1008 echo "Forcing select() to be disabled"
1009 ac_cv_func_select='no'
1010 ;;
1011 esac
1012 ])
1013
1014 dnl Enable kqueue()
1015 AC_ARG_ENABLE(kqueue,
1016 [ --enable-kqueue Enable kqueue() support.
1017 --disable-kqueue Disable kqueue() support. ],
1018
1019 [
1020 case "$enableval" in
1021 yes)
1022 echo "Forcing kqueue() to be enabled"
1023 ac_cv_func_kqueue='yes'
1024 ;;
1025 no)
1026 echo "Forcing kqueue() to be disabled"
1027 ac_cv_func_kqueue='no'
1028 ;;
1029 esac
1030 ])
1031
1032 dnl Enable epoll()
1033 AC_ARG_ENABLE(epoll,
1034 [ --enable-epoll Enable epoll() support.
1035 --disable-epoll Disable epoll() support. ],
1036
1037 [
1038 case "$enableval" in
1039 yes)
1040 echo "Forcing epoll() to be enabled"
1041 ac_cv_func_epoll='yes'
1042 ;;
1043 no)
1044 echo "Forcing epoll() to be disabled"
1045 ac_cv_func_epoll='no'
1046 ;;
1047 esac
1048 ])
1049
1050
1051 dnl Disable HTTP violations
1052 http_violations=1
1053 AC_ARG_ENABLE(http-violations,
1054 [ --disable-http-violations
1055 This allows you to remove code which is known to
1056 violate the HTTP protocol specification.],
1057 [ if test "$enableval" = "no" ; then
1058 echo "Disabling HTTP Violations"
1059 http_violations=0
1060 fi
1061 ])
1062 if test $http_violations = 1; then
1063 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.])
1064 else
1065 AC_DEFINE(HTTP_VIOLATIONS, 0)
1066 fi
1067
1068 dnl Enable IP-Filter Transparent Proxy
1069 AC_ARG_ENABLE(ipf-transparent,
1070 [ --enable-ipf-transparent
1071 Enable Transparent Proxy support for systems
1072 using IP-Filter network address redirection.],
1073 [ if test "$enableval" = "yes" ; then
1074 echo "IP-Filter Transparent Proxy enabled"
1075 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.])
1076 IPF_TRANSPARENT="yes"
1077 fi
1078 ])
1079
1080 dnl Enable PF Transparent Proxy
1081 AC_ARG_ENABLE(pf-transparent,
1082 [ --enable-pf-transparent
1083 Enable Transparent Proxy support for systems
1084 using PF network address redirection.],
1085 [ if test "$enableval" = "yes" ; then
1086 echo "PF Transparent Proxy enabled"
1087 AC_DEFINE(PF_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
1088 PF_TRANSPARENT="yes"
1089 fi
1090 ])
1091
1092 dnl Enable Linux Netfilter Transparent Proxy
1093 AC_ARG_ENABLE(linux-netfilter,
1094 [ --enable-linux-netfilter
1095 Enable Transparent Proxy support for Linux (Netfilter) systems.],
1096 [ if test "$enableval" = "yes" ; then
1097 echo "Linux (Netfilter) Transparent Proxy enabled"
1098 AC_DEFINE(LINUX_NETFILTER,1,[Enable support for Transparent Proxy on Linux (Netfilter) systems])
1099 LINUX_NETFILTER="yes"
1100 fi
1101 ])
1102
1103 dnl Enable Large file support
1104 AC_ARG_ENABLE(large-files,
1105 [ --enable-large-files Enable support for large files (>2GB). Still
1106 experimental.],
1107 [ if test "$enableval" = "yes" ; then
1108 echo "Large file support enabled"
1109 SQUID_CFLAGS="$SQUID_CFLAGS -D_FILE_OFFSET_BITS=64"
1110 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_FILE_OFFSET_BITS=64"
1111 fi
1112 ])
1113
1114 AM_CONDITIONAL(MAKE_LEAKFINDER, false)
1115 dnl Enable Leak Finding Functions
1116 AC_ARG_ENABLE(leakfinder,
1117 [ --enable-leakfinder
1118 Enable Leak Finding code. Enabling this alone
1119 does nothing; you also have to modify the source
1120 code to use the leak finding functions. Probably
1121 Useful for hackers only.],
1122 [ if test "$enableval" = "yes" ; then
1123 echo "Leak-Finding enabled"
1124 AC_DEFINE(USE_LEAKFINDER,1,[Enable code for assisting in finding memory leaks. Hacker stuff only.])
1125 USE_LEAKFINDER="yes"
1126 AM_CONDITIONAL(MAKE_LEAKFINDER, true)
1127 fi
1128 ])
1129
1130 use_ident=1
1131 AC_ARG_ENABLE(ident-lookups,
1132 [ --disable-ident-lookups
1133 This allows you to remove code that performs
1134 Ident (RFC 931) lookups.],
1135 [ if test "$enableval" = "no" ; then
1136 echo "Disabling Ident Lookups"
1137 use_ident=0
1138 fi
1139 ])
1140 if test $use_ident = 1; then
1141 AC_DEFINE(USE_IDENT, 1,[Compile in support for Ident (RFC 931) lookups? Enabled by default.])
1142 AM_CONDITIONAL(ENABLE_IDENT, true)
1143 else
1144 AC_DEFINE(USE_IDENT, 0)
1145 AM_CONDITIONAL(ENABLE_IDENT, false)
1146 fi
1147
1148 AM_CONDITIONAL(USE_DNSSERVER, false)
1149 use_dnsserver=
1150 AC_ARG_ENABLE(internal-dns,
1151 [ --disable-internal-dns This prevents Squid from directly sending and
1152 receiving DNS messages, and instead enables the
1153 old external 'dnsserver' processes.],
1154 [ if test "$enableval" = "no" ; then
1155 echo "Disabling Internal DNS queries"
1156 use_dnsserver="yes"
1157 fi
1158 ])
1159 if test "$use_dnsserver" = "yes"; then
1160 AC_DEFINE(USE_DNSSERVERS,1,[Use dnsserver processes instead of the internal DNS protocol support])
1161 AM_CONDITIONAL(USE_DNSSERVER, true)
1162 fi
1163
1164 AC_ARG_ENABLE(truncate,
1165 [ --enable-truncate This uses truncate() instead of unlink() when
1166 removing cache files. Truncate gives a little
1167 performance improvement, but may cause problems
1168 when used with async I/O. Truncate uses more
1169 filesystem inodes than unlink..],
1170 [ if test "$enableval" = "yes" ; then
1171 echo "Enabling truncate instead of unlink"
1172 AC_DEFINE(USE_TRUNCATE,1,[Do we want to use truncate(2) or unlink(2)?])
1173 fi
1174 ])
1175
1176 dnl Disable hostname checks
1177 AC_ARG_ENABLE(hostname-checks,
1178 [ --enable-hostname-checks
1179 Tells Squid to rejects any host names with
1180 odd characters in their name to conform with
1181 internet standards. This was the default in
1182 prior Squid versions, but since Squid-3 Squid
1183 no longer tries to police the use of DNS],
1184 [ if test "$enableval" = "yes"; then
1185 echo "Enabling hostname sanity checks"
1186 AC_DEFINE(CHECK_HOSTNAMES, 1, [Enable hostname sanity checks])
1187 fi
1188 ])
1189
1190 dnl Enable underscore in hostnames
1191 AC_ARG_ENABLE(underscores,
1192 [ --enable-underscores Squid by default rejects any host names with _
1193 in their name to conform with internet standards.
1194 If you disagree with this you may allow _ in
1195 hostnames by using this switch, provided that
1196 the resolver library on the host where Squid runs
1197 does not reject _ in hostnames...],
1198 [ if test "$enableval" = "yes" ; then
1199 echo "Enabling the use of underscores in host names"
1200 AC_DEFINE(ALLOW_HOSTNAME_UNDERSCORES, 1,[Allow underscores in host names])
1201 fi
1202 ])
1203
1204 dnl Select Default hosts file location
1205 AC_ARG_ENABLE(default-hostsfile,
1206 [ --enable-default-hostsfile=path
1207 Select default location for hosts file.
1208 See hosts_file directive in squid.conf for details],
1209 [
1210 if test "$enableval" != "none" ; then
1211 if test -f $enableval; then
1212 OPT_DEFAULT_HOSTS=$enableval
1213 else
1214 echo "Warning Unable to find $enableval"
1215 sleep 5
1216 fi
1217 else
1218 OPT_DEFAULT_HOSTS="none"
1219 fi
1220 echo "Default hosts file set to: $enableval"
1221 ],[OPT_DEFAULT_HOSTS="/etc/hosts"])
1222 AC_SUBST(OPT_DEFAULT_HOSTS)
1223
1224 dnl Select auth schemes modules to build
1225 AC_ARG_ENABLE(auth,
1226 [ --enable-auth=\"list of auth scheme modules\"
1227 Build support for the list of authentication schemes.
1228 The default is to build support for the Basic scheme.
1229 See src/auth for a list of available modules, or
1230 Programmers Guide section authentication schemes
1231 for details on how to build your custom auth scheme
1232 module],
1233 [ case $enableval in
1234 yes)
1235 for dir in $srcdir/src/auth/*; do
1236 module="`basename $dir`"
1237 if test -d "$dir" && test "$module" != CVS; then
1238 AUTH_MODULES="$AUTH_MODULES $module"
1239 fi
1240 done
1241 ;;
1242 no)
1243 ;;
1244 *)
1245 AUTH_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1246 ;;
1247 esac
1248 ],
1249 [ if test -z "$AUTH_MODULES"; then
1250 AUTH_MODULES="basic digest ntlm"
1251 fi
1252 ])
1253 if test -n "$AUTH_MODULES"; then
1254 for module in $AUTH_MODULES; do
1255 if test -d $srcdir/src/auth/$module; then
1256 :
1257 else
1258 echo "ERROR: Auth scheme $module does not exists"
1259 exit 1
1260 fi
1261 done
1262 echo "Auth scheme modules built: $AUTH_MODULES"
1263 AUTH_OBJS="auth/lib`echo $AUTH_MODULES|sed -e 's% %.a auth/lib%g'`.a"
1264 AUTH_LIBS="`echo $AUTH_OBJS|sed -e 's%auth/%%g'`"
1265 fi
1266 AUTH_LINKOBJS=
1267 for module in $AUTH_MODULES; do
1268 AUTH_LINKOBJS="$AUTH_LINKOBJS auth/${module}/${module}Scheme.o"
1269 done
1270 AC_SUBST(AUTH_MODULES)
1271 AC_SUBST(AUTH_LIBS)
1272 AC_SUBST(AUTH_LINKOBJS)
1273 AC_SUBST(AUTH_OBJS)
1274
1275 dnl Select basic auth scheme helpers to build
1276 BASIC_AUTH_HELPERS=""
1277 AC_ARG_ENABLE(basic-auth-helpers,
1278 [ --enable-basic-auth-helpers=\"list of helpers\"
1279 This option selects which basic scheme proxy_auth
1280 helpers to build and install as part of the normal
1281 build process. For a list of available
1282 helpers see the helpers/basic_auth directory.],
1283 [ case "$enableval" in
1284 yes)
1285 for dir in $srcdir/helpers/basic_auth/*; do
1286 helper="`basename $dir`"
1287 if test -d "$dir" && test "$helper" != CVS; then
1288 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $helper"
1289 fi
1290 done
1291 ;;
1292 no)
1293 ;;
1294 *)
1295 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1296 ;;
1297 esac
1298 ])
1299 if test -n "$BASIC_AUTH_HELPERS"; then
1300 for helper in $BASIC_AUTH_HELPERS; do
1301 if test -d $srcdir/helpers/basic_auth/$helper; then
1302 case $helper in
1303 SASL)
1304 require_sasl=yes
1305 ;;
1306 esac
1307 else
1308 echo "ERROR: Basic auth helper $helper does not exists"
1309 exit 1
1310 fi
1311 done
1312 echo "Basic auth helpers built: $BASIC_AUTH_HELPERS"
1313 fi
1314 AC_SUBST(BASIC_AUTH_HELPERS)
1315
1316 dnl Select ntlm auth helpers to build
1317 NTLM_AUTH_HELPERS=
1318 AC_ARG_ENABLE(ntlm-auth-helpers,
1319 [ --enable-ntlm-auth-helpers=\"list of helpers\"
1320 This option selects which proxy_auth ntlm helpers
1321 to build and install as part of the normal build
1322 process. For a list of available helpers see
1323 the helpers/ntlm_auth directory.],
1324 [ case "$enableval" in
1325 yes)
1326 for dir in $srcdir/helpers/ntlm_auth/*; do
1327 helper="`basename $dir`"
1328 if test -d "$dir" && test "$helper" != CVS; then
1329 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $helper"
1330 fi
1331 done
1332 ;;
1333 no)
1334 ;;
1335 *)
1336 NTLM_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1337 ;;
1338 esac
1339 ])
1340 if test -n "$NTLM_AUTH_HELPERS"; then
1341 for helper in $NTLM_AUTH_HELPERS; do
1342 if test -d $srcdir/helpers/ntlm_auth/$helper; then
1343 :
1344 else
1345 echo "ERROR: NTLM Auth helper $helper does not exists"
1346 exit 1
1347 fi
1348 done
1349 echo "NTLM auth helpers built: $NTLM_AUTH_HELPERS"
1350 fi
1351 AC_SUBST(NTLM_AUTH_HELPERS)
1352
1353 dnl Select digest auth scheme helpers to build
1354 DIGEST_AUTH_HELPERS=
1355 AC_ARG_ENABLE(digest-auth-helpers,
1356 [ --enable-digest-auth-helpers=\"list of helpers\"
1357 This option selects which digest scheme authentication
1358 helpers to build and install as part of the normal build
1359 process. For a list of available helpers see the
1360 helpers/digest_auth directory.],
1361 [ case "$enableval" in
1362 yes)
1363 for dir in $srcdir/helpers/digest_auth/*; do
1364 helper="`basename $dir`"
1365 if test -d "$dir" && test "$helper" != CVS; then
1366 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper"
1367 fi
1368 done
1369 ;;
1370 no)
1371 ;;
1372 *)
1373 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1374 ;;
1375 esac
1376 ])
1377 if test -n "$DIGEST_AUTH_HELPERS"; then
1378 for helper in $DIGEST_AUTH_HELPERS; do
1379 if test -f $srcdir/helpers/digest_auth/$helper/Makefile.in; then
1380 :
1381 else
1382 echo "ERROR: digest auth helper $helper does not exists"
1383 exit 1
1384 fi
1385 done
1386 echo "Digest auth helpers built: $DIGEST_AUTH_HELPERS"
1387 fi
1388 AC_SUBST(DIGEST_AUTH_HELPERS)
1389
1390 dnl Enable "NTLM fail open"
1391 AC_ARG_ENABLE(ntlm-fail-open,
1392 [ --enable-ntlm-fail-open Enable NTLM fail open, where a helper that fails one of the
1393 Authentication steps can allow squid to still authenticate
1394 the user.],
1395 [ if test "$enableval" = "yes" ; then
1396 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.])
1397 fi
1398 ])
1399
1400 dnl Select external_acl helpers to build
1401 EXTERNAL_ACL_HELPERS=
1402 AC_ARG_ENABLE(external-acl-helpers,
1403 [ --enable-external-acl-helpers=\"list of helpers\"
1404 This option selects which external_acl helpers to
1405 build and install as part of the normal build
1406 process. For a list of available helpers see the
1407 helpers/external_acl directory.],
1408 [ case "$enableval" in
1409 yes)
1410 for dir in $srcdir/helpers/external_acl/*; do
1411 helper="`basename $dir`"
1412 if test -d "$dir" && test "$helper" != CVS; then
1413 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
1414 fi
1415 done
1416 ;;
1417 no)
1418 ;;
1419 *)
1420 EXTERNAL_ACL_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1421 ;;
1422 esac
1423 ])
1424 if test -n "$EXTERNAL_ACL_HELPERS"; then
1425 for helper in $EXTERNAL_ACL_HELPERS; do
1426 if test -f $srcdir/helpers/external_acl/$helper/Makefile.in; then
1427 :
1428 else
1429 echo "ERROR: external acl helper $helper does not exists"
1430 exit 1
1431 fi
1432 done
1433 echo "External acl helpers built: $EXTERNAL_ACL_HELPERS"
1434 fi
1435 AC_SUBST(EXTERNAL_ACL_HELPERS)
1436
1437 dnl Disable "memPools" code
1438 AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
1439 AC_ARG_ENABLE(mempools,
1440 [ --disable-mempools Disable memPools. Note that this option now simply sets the
1441 default behaviour. Specific classes can override this at runtime, and
1442 only lib/MemPool.c needs to be altered to change the squid-wide
1443 default for all classes.],
1444 [ if test "$enableval" = "no" ; then
1445 echo "memPools disabled"
1446 AC_DEFINE(DISABLE_POOLS, 1, [Define if you have problems with memPools and want to disable Pools])
1447 fi
1448 ])
1449
1450 dnl Enable WIN32 Service compile mode
1451 AC_ARG_ENABLE(win32-service,
1452 [ --enable-win32-service Compile Squid as a WIN32 Service
1453 Works only on Windows NT and Windows 2000 Platforms.],
1454 [ if test "$enableval" = "yes" ; then
1455 echo "Enabling WIN32 run service mode"
1456 AC_DEFINE(USE_WIN32_SERVICE,1,[Define Windows NT & Windows 2000 run service mode])
1457 fi
1458 ])
1459
1460
1461 dnl Check for Cyrus SASL
1462 if test "$require_sasl" = "yes"; then
1463 AC_CHECK_HEADERS(sasl/sasl.h sasl.h)
1464 if test "$ac_cv_header_sasl_sasl_h" = "yes"; then
1465 echo "using SASL2"
1466 LIBSASL="-lsasl2"
1467 else
1468 if test "$ac_cv_header_sasl_h" = "yes"; then
1469 echo "using SASL"
1470 LIBSASL="-lsasl"
1471 else
1472 echo "ERROR: Neither SASL nor SASL2 found"
1473 exit 1
1474 fi
1475 fi
1476 AC_SUBST(LIBSASL)
1477 fi
1478
1479 dnl Disable "unlinkd" code
1480 AC_ARG_ENABLE(unlinkd,
1481 [ --disable-unlinkd Do not use unlinkd],
1482 [ if test "$enableval" = "no" ; then
1483 use_unlinkd=no
1484 else
1485 use_unlinkd=yes
1486 fi
1487 ],[
1488 # Here we should probably use some magic depending on the selected
1489 # storage models
1490 use_unlinkd=yes
1491 ])
1492 if test "$use_unlinkd" = "yes"; then
1493 echo "unlinkd enabled"
1494 AC_DEFINE(USE_UNLINKD,1,[Define this if unlinkd is required (strongly recommended for ufs storage type)])
1495 AM_CONDITIONAL(ENABLE_UNLINKD, true)
1496 else
1497 echo "unlinkd disabled"
1498 AM_CONDITIONAL(ENABLE_UNLINKD, false)
1499 fi
1500
1501 dnl Enable backtraces on fatal errors
1502 AC_ARG_ENABLE(stacktraces,
1503 [ --enable-stacktraces Enable automatic call backtrace on fatal errors],
1504 [ if test "$enableval" = "yes" ; then
1505 echo "Enabling automatic stack backtraces on fatal errors"
1506 AC_DEFINE(PRINT_STACK_TRACE, 1,[Print stacktraces on fatal errors])
1507 fi
1508 ])
1509
1510 AM_CONDITIONAL(ENABLE_XPROF_STATS, false)
1511 dnl Enable USE_XPROF_STATS
1512 AC_ARG_ENABLE(cpu-profiling,
1513 [ --enable-cpu-profiling
1514 This option allows you to see which internal functions
1515 in Squid are consuming how much CPU. Compiles in probes
1516 that measure time spent in probed functions. Needs
1517 source modifications to add new probes. This is meant
1518 for developers to assist in performance optimisations
1519 of Squid internal functions.
1520 If you are not developer and not interested in the stats
1521 you shouldn't enable this, as overhead added, although
1522 small, is still overhead. See lib/Profiler.c for more.
1523 ],
1524 [ if test "$enableval" = "yes" ; then
1525 echo "Enabling cpu-profiling"
1526 AC_DEFINE(USE_XPROF_STATS, 1,[Define to enable CPU profiling within Squid])
1527 AM_CONDITIONAL(ENABLE_XPROF_STATS, true)
1528 fi
1529 ])
1530
1531 dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
1532 AC_ARG_ENABLE(x_accelerator_vary,
1533 [ --enable-x-accelerator-vary
1534 Enable support for the X-Accelerator-Vary
1535 HTTP header. Can be used to indicate
1536 variance within an accelerator setup.
1537 Typically used together with other code
1538 that adds custom HTTP headers to the requests.],
1539 [ if test "$enableval" = "yes" ; then
1540 echo "Enabling support for X-Accelerator-Vary"
1541 AC_DEFINE(X_ACCELERATOR_VARY, 1, [Enable support for the X-Accelerator-Vary HTTP header])
1542 fi
1543 ])
1544
1545 AC_ARG_WITH(filedescriptors,
1546 [ --with-filedescriptors=NUMBER Force squid to support NUMBER filedescriptors],
1547 [ squid_filedescriptors_num=$withval ])
1548
1549 # FIXME, try linking in a test program first, then if that fails try probing etc.
1550 SQUID_CPPUNIT_DIR='cppunit-1.10.0'
1551 SQUID_CPPUNIT_LA='$(top_builddir)/lib/cppunit-1.10.0/src/cppunit/libcppunit.la'
1552 SQUID_CPPUNIT_INC='-I$(top_builddir)/lib/cppunit-1.10.0/include -I $(top_srcdir)/lib/cppunit-1.10.0/include'
1553 if test -f /usr/include/cppunit/TestCase.h; then
1554 echo "using system installed cppunit"
1555 SQUID_CPPUNIT_DIR=''
1556 SQUID_CPPUNIT_LA='/usr/lib/libcppunit.la'
1557 SQUID_CPPUNIT_INC=''
1558 fi
1559 AC_ARG_WITH(cppunit-basedir,
1560 [ --with-cppunit-basedir=/path/to/cppunit-base
1561 Path where the cppunit headers are libraries are found
1562 for unit testing. (defaults to use internal copies -
1563 version 1.10.0)
1564 ],
1565 [ if test -f $withval/include/cppunit/TestCase.h; then
1566 echo "Using cppunit includes from $withval"
1567 SQUID_CPPUNIT_INC="-I${withval}/include"
1568 else
1569 echo "ERROR: Cannot find cppunit at $withval"
1570 exit 1
1571 fi
1572 if test -f $withval/lib/libcppunit.la; then
1573 echo "Using cppunit lib from $withval"
1574 SQUID_CPPUNIT_LA="-I${withval}/lib/libcppunit.la"
1575 else
1576 echo "ERROR: Cannot find cppunit at $withval"
1577 exit 1
1578 fi
1579 SQUID_CPPUNIT_DIR=''
1580 ])
1581 AC_SUBST(SQUID_CPPUNIT_LA)
1582 AC_SUBST(SQUID_CPPUNIT_INC)
1583 AC_SUBST(SQUID_CPPUNIT_DIR)
1584
1585 # Force some compilers to use ANSI features
1586 #
1587 case "$host" in
1588 alpha-dec-osf*)
1589 if test "$ac_cv_prog_CC" = "cc" ; then
1590 echo "adding '-std1' to cc args for $host"
1591 CC="cc -std1";
1592 ac_cv_prog_CC="$CC"
1593 fi
1594 ;;
1595 *-hp-hpux*)
1596 if test "$ac_cv_prog_CC" = "cc" ; then
1597 echo "adding '-Ae' to cc args for $host"
1598 CC="cc -Ae";
1599 ac_cv_prog_CC="$CC"
1600 fi
1601 ;;
1602 esac
1603
1604 dnl Check for programs
1605 AC_PROG_CPP
1606 AC_PROG_INSTALL
1607 AC_PROG_LN_S
1608 AC_PATH_PROG(SH, sh, /bin/sh)
1609 AC_PATH_PROG(FALSE, false, /usr/bin/false)
1610 AC_PATH_PROG(TRUE, true, /usr/bin/true)
1611 AC_PATH_PROG(RM, rm, $FALSE)
1612 AC_PATH_PROG(MV, mv, $FALSE)
1613 AC_PATH_PROG(MKDIR, mkdir, $FALSE)
1614 AC_PATH_PROG(LN, ln, cp)
1615 AC_PATH_PROG(PERL, perl, none)
1616 dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
1617 AC_PATH_PROG(AR, ar, $FALSE)
1618
1619 if test "$ac_cv_path_PERL" = "none"; then
1620 echo "Perl is required to compile Squid"
1621 echo "Please install Perl and then re-run configure"
1622 exit 1
1623 fi
1624
1625 case "$host" in
1626 *-hp-hpux*)
1627 echo "Disabling 'ranlib' for HP-UX..."
1628 RANLIB=":"
1629 ;;
1630 esac
1631
1632 dnl set $(AR)
1633 AR_R="$AR r"
1634 case "$host" in
1635 *-next-nextstep3)
1636 AR="libtool -o"
1637 ;;
1638 esac
1639 AC_SUBST(AR_R)
1640
1641 dnl Check for headers
1642 AC_HEADER_DIRENT
1643 AC_HEADER_STDC
1644
1645 AC_CHECK_HEADERS( \
1646 arpa/inet.h \
1647 arpa/nameser.h \
1648 assert.h \
1649 bstring.h \
1650 crypt.h \
1651 ctype.h \
1652 errno.h \
1653 execinfo.h \
1654 fcntl.h \
1655 fnmatch.h \
1656 getopt.h \
1657 gnumalloc.h \
1658 grp.h \
1659 ip_compat.h \
1660 ip_fil_compat.h \
1661 ip_fil.h \
1662 ip_nat.h \
1663 libc.h \
1664 limits.h \
1665 malloc.h \
1666 math.h \
1667 memory.h \
1668 mount.h \
1669 net/pfvar.h \
1670 netdb.h \
1671 netinet/in.h \
1672 netinet/tcp.h \
1673 netinet/ip_fil_compat.h \
1674 openssl/err.h \
1675 openssl/md5.h \
1676 openssl/ssl.h \
1677 openssl/engine.h \
1678 poll.h \
1679 pwd.h \
1680 regex.h \
1681 sched.h \
1682 signal.h \
1683 stdarg.h \
1684 stddef.h \
1685 stdio.h \
1686 stdlib.h \
1687 string.h \
1688 strings.h \
1689 sys/bitypes.h \
1690 sys/bswap.h \
1691 sys/endian.h \
1692 sys/file.h \
1693 sys/ioctl.h \
1694 sys/param.h \
1695 sys/msg.h \
1696 sys/resource.h \
1697 sys/select.h\
1698 sys/socket.h \
1699 sys/stat.h \
1700 sys/statvfs.h \
1701 syscall.h \
1702 sys/syscall.h \
1703 sys/time.h \
1704 sys/types.h \
1705 sys/un.h \
1706 sys/vfs.h \
1707 sys/wait.h \
1708 syslog.h \
1709 time.h \
1710 unistd.h \
1711 utime.h \
1712 varargs.h \
1713 byteswap.h \
1714 glib.h \
1715 stdint.h \
1716 inttypes.h \
1717 grp.h \
1718 nss_common.h \
1719 nss.h
1720 )
1721
1722 AC_CHECK_HEADERS(linux/netfilter_ipv4.h,,,
1723 SQUID_DEFAULT_INCLUDES
1724 #if HAVE_LIMITS_H
1725 #include <limits.h>
1726 #endif
1727 )
1728
1729 AC_CHECK_HEADERS(net/if.h \
1730 netinet/if_ether.h\
1731 netinet/ip_compat.h\
1732 netinet/ip_fil.h\
1733 netinet/ip_nat.h\
1734 sys/mount.h\
1735 resolv.h,,,SQUID_BSDNET_INCLUDES)
1736
1737 AC_C_CONST
1738 AC_C_BIGENDIAN
1739
1740 AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
1741 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
1742 [foo("bar")],
1743 ac_cv_have_ansi_prototypes="yes",
1744 ac_cv_have_ansi_prototypes="no")
1745 ])
1746 if test $ac_cv_have_ansi_prototypes = "yes" ; then
1747 AC_DEFINE(HAVE_ANSI_PROTOTYPES,1,[Define if your compiler supports prototyping])
1748 fi
1749
1750 AC_STRUCT_TM
1751 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
1752 #if TM_IN_SYS_TIME
1753 #if HAVE_SYS_TIME_H
1754 #include <sys/time.h>
1755 #endif
1756 #elif HAVE_TIME_H
1757 #include <time.h>
1758 #endif
1759 ])
1760
1761 AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
1762 #if HAVE_SYS_TYPES_H
1763 #include <sys/types.h>
1764 #endif
1765 #if HAVE_MALLOC_H
1766 #include <malloc.h>
1767 #endif])
1768
1769 AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
1770 #if HAVE_SYS_TYPES_H
1771 #include <sys/types.h>
1772 #endif
1773 #if HAVE_MALLOC_H
1774 #include <malloc.h>
1775 #endif])
1776
1777 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
1778 #if HAVE_SYS_TIME_H
1779 #include <sys/time.h>
1780 #endif
1781 #if HAVE_SYS_RESOURCE_H
1782 #include <sys/resource.h>
1783 #endif])
1784
1785 AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
1786 #if HAVE_SYS_TYPES_H
1787 #include <sys/types.h>
1788 #endif
1789 #include <netinet/in.h>
1790 #include <netinet/in_systm.h>
1791 #include <netinet/ip.h>
1792 #if defined (__linux__) || defined (__CYGWIN__)
1793 #define ip_hl ihl
1794 #endif
1795 #ifndef __linux__
1796 #ifndef __CYGWIN__
1797 #define iphdr ip
1798 #endif
1799 #endif])
1800
1801 dnl Check for typedefs
1802 AC_CHECK_SIZEOF(void *)
1803
1804 dnl 16 bit integers - int16_t and u_int16_t
1805 dnl if this is defined we trust it to be 16 bits
1806 AC_CHECK_TYPE(int16_t,
1807 AC_DEFINE(HAVE_INT16_T,1,[int16_t is defined in system headers]),
1808 ,SQUID_DEFAULT_INCLUDES)
1809
1810 dnl fallback #1
1811 AC_CHECK_TYPE(short,[
1812 AC_CHECK_SIZEOF(short,,SQUID_DEFAULT_SIZEOF_INCLUDES)
1813 AC_DEFINE(HAVE_SHORT,1,[short is defined in system headers])
1814 ],,SQUID_DEFAULT_INCLUDES)
1815
1816 dnl fallback #2
1817 AC_CHECK_TYPE(int,[
1818 AC_CHECK_SIZEOF(int,,SQUID_DEFAULT_SIZEOF_INCLUDES)
1819 AC_DEFINE(HAVE_INT,1,[int is defined in system headers])
1820 ],,SQUID_DEFAULT_INCLUDES)
1821
1822 dnl unsigned 16 bit ints - u_int16_t
1823 dnl if this is defined we trust it to be 16 bits
1824 AC_CHECK_TYPE(u_int16_t,
1825 AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers]),
1826 ,SQUID_DEFAULT_INCLUDES)
1827
1828 dnl fallback #1
1829 dnl if this is defined we trust it to be 16 bits
1830 AC_CHECK_TYPE(uint16_t,
1831 AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers]),
1832 ,SQUID_DEFAULT_INCLUDES)
1833
1834 dnl 32 bit signed int - int32_t
1835 dnl if this is defined we trust it to be 32 bits
1836 AC_CHECK_TYPE(int32_t,
1837 AC_DEFINE(HAVE_INT32_T,1,[int32_t is defined in system headers]),
1838 ,SQUID_DEFAULT_INCLUDES)
1839
1840 dnl fallback #1
1841 AC_CHECK_TYPE(long,[
1842 AC_CHECK_SIZEOF(long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
1843 AC_DEFINE(HAVE_LONG,1,[long is defined in system headers])
1844 ],,SQUID_DEFAULT_INCLUDES)
1845
1846 dnl 32 bit unsigned int - u_int32_t
1847 dnl if this is defined we trust it to be 32 bits
1848 AC_CHECK_TYPE(u_int32_t,
1849 AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers]),
1850 ,SQUID_DEFAULT_INCLUDES)
1851
1852 dnl fallback #1
1853 dnl if this is defined we trust it to be 32 bits
1854 AC_CHECK_TYPE(uint32_t,
1855 AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers]),
1856 ,SQUID_DEFAULT_INCLUDES)
1857
1858 dnl 64 bit signed - int64_t
1859 dnl if this is defind we trust it to be 64 bits
1860 AC_CHECK_TYPE(int64_t,
1861 AC_DEFINE(HAVE_INT64_T,1,[int64_t is defined in system headers]),
1862 ,SQUID_DEFAULT_INCLUDES)
1863
1864 dnl fallback #1
1865 dnl if this is defind we trust it to be 64 bits
1866 AC_CHECK_TYPE(__int64,
1867 AC_DEFINE(HAVE___INT64,1,[__int64 is defined in system headers]),
1868 ,SQUID_DEFAULT_INCLUDES)
1869
1870 dnl fallback #2
1871 AC_CHECK_TYPE(long long,[
1872 AC_CHECK_SIZEOF(long long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
1873 AC_DEFINE(HAVE_LONG_LONG,1,[long long is defined in system headers])
1874 ],,SQUID_DEFAULT_INCLUDES)
1875
1876 dnl 64 bit unsigned - u_int64_t
1877 dnl if this is defind we trust it to be 64 bits
1878 AC_CHECK_TYPE(u_int64_t,
1879 AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers]),
1880 ,SQUID_DEFAULT_INCLUDES)
1881
1882 dnl fallback #1
1883 dnl if this is defind we trust it to be 64 bits
1884 AC_CHECK_TYPE(uint64_t,
1885 AC_DEFINE(HAVE_UINT64_T,1,[uint64_t is defined in system headers]),
1886 ,SQUID_DEFAULT_INCLUDES)
1887
1888 dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
1889 dnl that is incompatible with the updated Solaris header files.
1890 dnl For this reason, we must check if pad128_t and upad128_t are defined.
1891 AC_CHECK_TYPE(pad128_t,
1892 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
1893 ,SQUID_DEFAULT_INCLUDES)
1894
1895 AC_CHECK_TYPE(upad128_t,
1896 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
1897 ,SQUID_DEFAULT_INCLUDES)
1898
1899 AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
1900 AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
1901 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
1902 AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
1903 AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
1904 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
1905 AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
1906 AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
1907
1908 dnl Check for special functions
1909 AC_FUNC_ALLOCA
1910
1911 AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
1912 #include <sys/types.h>
1913 #include <sys/socket.h>
1914 #if STDC_HEADERS
1915 #include <stdlib.h>
1916 #include <stddef.h>
1917 #endif])
1918
1919 AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
1920 #include <sys/ipc.h>
1921 #include <sys/msg.h>])
1922
1923 dnl Check for needed libraries
1924 AC_CHECK_LIB(nsl, main)
1925 AC_CHECK_LIB(socket, main)
1926 case "$host_os" in
1927 mingw|mingw32)
1928 AC_MSG_CHECKING(for winsock)
1929 save_LIBS="$LIBS"
1930 for curlib in ws2_32 wsock32; do
1931 LIBS="$LIBS -l$curlib"
1932 AC_TRY_LINK([
1933 char __attribute__((stdcall)) socket(int,int,int);
1934 char __attribute__((stdcall)) select(int,int,int,int,int);
1935 char __attribute__((stdcall)) closesocket(int);
1936 char __attribute__((stdcall)) gethostname(int,int);
1937 ],
1938 [
1939 socket(1,2,3);
1940 select(1,2,3,4,5);
1941 closesocket(1);
1942 gethostname(1,2);
1943 ],
1944 have_winsock=yes, have_winsock=no)
1945
1946 if test $have_winsock = yes; then
1947 ac_cv_func_select='yes'
1948 if test $curlib = ws2_32; then
1949 have_winsock=winsock2
1950 fi
1951 break
1952 fi
1953 LIBS="$save_LIBS"
1954 done
1955 AC_MSG_RESULT($have_winsock)
1956 ;;
1957 esac
1958
1959 dnl Ripped from the Samba sources
1960 AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
1961 AC_TRY_COMPILE([
1962 #include <sys/types.h>
1963 #include <stdlib.h>
1964 #include <stddef.h>
1965 #include <sys/socket.h>
1966 #include <sys/un.h>],
1967 [
1968 struct sockaddr_un sunaddr;
1969 sunaddr.sun_family = AF_UNIX;
1970 ],
1971 squid_cv_unixsocket=yes,squid_cv_unixsocket=no)])
1972 if test x"$squid_cv_unixsocket" = x"yes"; then
1973 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
1974 fi
1975 dnl end rip
1976
1977 if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
1978 echo "skipping libmalloc check (--enable-dlmalloc specified)"
1979 else
1980 AC_CHECK_LIB(gnumalloc, main)
1981 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
1982 echo "Disabling extended malloc functions when using gnumalloc"
1983 ac_cv_func_mallinfo=no
1984 ac_cv_func_mallocblksize=no
1985 ac_cv_func_mallopt=no
1986 else
1987 case "$host" in
1988 *-sun-solaris*)
1989 echo "skipping libmalloc check for $host"
1990 ;;
1991 i386-*-freebsd*)
1992 echo "skipping libmalloc check for $host"
1993 ;;
1994 *)
1995
1996 AC_CHECK_LIB(malloc, main)
1997 ;;
1998 esac
1999 fi
2000 fi
2001
2002 AC_CHECK_LIB(bsd, main)
2003 AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
2004 AC_CHECK_LIB(bind, gethostbyname)
2005 if test $ac_cv_lib_bind_gethostbyname = "no" ; then
2006 case "$host" in
2007 i386-*-freebsd*)
2008 echo "skipping libresolv checks for $host"
2009 ;;
2010 *)
2011 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
2012 AC_CHECK_LIB(resolv, main)
2013 ;;
2014 esac
2015 fi
2016 AC_CHECK_LIB(m, main)
2017
2018 dnl Check for libcrypt
2019 dnl Some of our helpers use crypt(3) which may be in libc, or in
2020 dnl libcrypt (eg FreeBSD)
2021 AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
2022 AC_SUBST(CRYPTLIB)
2023
2024 dnl Check for libdl, used by auth_modules/PAM
2025 if test "$with_dl" = "yes"; then
2026 AC_CHECK_LIB(dl, dlopen)
2027 fi
2028
2029 dnl Check for pthreads
2030 dnl We use pthreads when doing ASYNC I/O
2031 if test "$with_pthreads" = "yes"; then
2032 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
2033 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
2034 case "$host" in
2035 i386-unknown-freebsd*)
2036 if test "$GCC" = "yes" ; then
2037 if test -z "$PRESET_LDFLAGS"; then
2038 LDFLAGS="$LDFLAGS -pthread"
2039 fi
2040 fi
2041 ;;
2042 *-solaris2.*)
2043 if test "$GCC" = "yes" ; then
2044 SQUID_CFLAGS="$SQUID_CFLAGS -pthreads"
2045 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -pthreads"
2046 else
2047 SQUID_CFLAGS="$SQUID_CFLAGS -mt"
2048 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -mt"
2049 fi
2050 ;;
2051 esac
2052 AC_CHECK_LIB(pthread, main)
2053 fi
2054
2055 dnl Check for librt
2056 dnl We use AIO in the coss store
2057 if test "$with_aio" = "yes"; then
2058 dnl On some systems POSIX AIO functions are in libaio
2059 AC_CHECK_LIB(rt, aio_read,,AC_CHECK_LIB(aio, aio_read))
2060 fi
2061
2062 dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
2063 dnl Robert Side <rside@aiinc.bc.ca>
2064 dnl Mon, 18 Jan 1999 17:48:00 GMT
2065 case "$host" in
2066 *-pc-sco3.2*)
2067 AC_CHECK_LIB(intl, strftime)
2068 ;;
2069 esac
2070
2071 dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
2072 dnl only with Windows LDAP libraries using -lwldap32
2073 case "$host_os" in
2074 mingw|mingw32)
2075 LIB_LDAP="-lwldap32"
2076 LIB_LBER=""
2077 ;;
2078 *)
2079 LIB_LDAP="-lldap"
2080 dnl LDAP helpers need to know if -llber is needed or not
2081 AC_CHECK_LIB(lber, main, [LIB_LBER="-llber"])
2082 ;;
2083 esac
2084 AC_SUBST(LIB_LDAP)
2085 AC_SUBST(LIB_LBER)
2086
2087 dnl System-specific library modifications
2088 dnl
2089 case "$host" in
2090 i386-*-solaris2.*)
2091 if test "$GCC" = "yes"; then
2092 echo "Removing -O for gcc on $host"
2093 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2094 fi
2095 ;;
2096 *-sgi-irix*)
2097 echo "Removing -lsocket for IRIX..."
2098 LIBS=`echo $LIBS | sed -e s/-lsocket//`
2099 echo "Removing -lnsl for IRIX..."
2100 LIBS=`echo $LIBS | sed -e s/-lnsl//`
2101 ac_cv_lib_nsl_main=no
2102 echo "Removing -lbsd for IRIX..."
2103 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2104 ;;
2105 dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
2106 dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
2107 dnl Please change your configure script. AIX doesn't need -lbsd.
2108 *-ibm-aix*)
2109 echo "Removing -lbsd for AIX..."
2110 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2111 case "$host" in
2112 dnl From: mlaster@metavillage.com (Mike Laster)
2113 dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
2114 dnl So using the internal versions generates a load of warnings
2115 dnl during compile.
2116 *-ibm-aix4*)
2117 echo "disabling snprintf/vsnprintf for $host"
2118 ac_cv_func_snprintf=no
2119 ac_cv_func_vsnprintf=no
2120 ;;
2121 esac
2122 ;;
2123 *m88k*)
2124 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
2125 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
2126 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
2127 ;;
2128 [*-*-solaris2.[0-4]])
2129 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2130 ;;
2131 [*-sony-newsos[56]*])
2132 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2133 ;;
2134 esac
2135
2136 # Remove optimization for GCC 2.95.[123]
2137 # gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
2138 if test "$GCC" = "yes"; then
2139 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
2140 case "$GCCVER" in
2141 [2.95.[123]])
2142 echo "Removing -O for gcc on $host with GCC $GCCVER"
2143 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2144 ;;
2145 esac
2146 fi
2147
2148 # Recommended by Balint Nagy Endre <bne@CareNet.hu>
2149 case "$host" in
2150 *-univel-sysv4.2MP)
2151 if test `uname -v` = "2.03"; then
2152 echo "disabling mallinfo for $host"
2153 ac_cv_func_mallinfo=no
2154 fi
2155 ;;
2156 esac
2157
2158 dnl This has to be before AC_CHECK_FUNCS
2159 # Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2160 # when running configure.
2161 if test -z "$ac_cv_func_poll"; then
2162 case "$host" in
2163 [alpha-dec-osf3.*])
2164 # John Kay (jkay@nlanr.net) 19970818
2165 echo "disabling poll for $host..."
2166 ac_cv_func_poll='no'
2167 ;;
2168 [*-hp-hpux*.*])
2169 # Duane Wessels
2170 echo "disabling poll for $host..."
2171 ac_cv_func_poll='no'
2172 ;;
2173 [*-linux-*])
2174 # Henrik Nordstrom (hno@squid-cache.org) 19980817
2175 # poll is problematic on Linux. We disable it
2176 # by default until Linux gets it right.
2177 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2178 if test $rev -lt 002002; then
2179 echo "disabling poll for $host < 2.2..."
2180 ac_cv_func_poll='no'
2181 fi
2182 ;;
2183 [powerpc-ibm-aix4.1.*])
2184 # Mike Laster (mlaster@metavillage.com) 19981021
2185 echo "disabling poll for $host..."
2186 ac_cv_func_poll='no'
2187 ;;
2188 [*-pc-sco3.2*])
2189 # Robert Side <rside@aiinc.bc.ca>
2190 # Mon, 18 Jan 1999 17:48:00 GMT
2191 echo "disabling poll for $host..."
2192 ac_cv_func_poll='no'
2193 ;;
2194 esac
2195 fi
2196
2197 dnl Check for library functions
2198 AC_CHECK_FUNCS(\
2199 backtrace_symbols_fd \
2200 bcopy \
2201 bswap_16 \
2202 bswap_32 \
2203 bswap16 \
2204 bswap32 \
2205 crypt \
2206 fchmod \
2207 getdtablesize \
2208 getpagesize \
2209 getpass \
2210 getrlimit \
2211 getrusage \
2212 getspnam \
2213 htobe16 \
2214 htole16 \
2215 lrand48 \
2216 mallinfo \
2217 mallocblksize \
2218 mallopt \
2219 memcpy \
2220 memmove \
2221 memset \
2222 mkstemp \
2223 mktime \
2224 mstats \
2225 poll \
2226 pthread_attr_setschedparam \
2227 pthread_attr_setscope \
2228 pthread_setschedparam \
2229 pthread_sigmask \
2230 putenv \
2231 random \
2232 regcomp \
2233 regexec \
2234 regfree \
2235 res_init \
2236 rint \
2237 sbrk \
2238 select \
2239 seteuid \
2240 setgroups \
2241 setpgrp \
2242 setrlimit \
2243 setsid \
2244 sigaction \
2245 snprintf \
2246 socketpair \
2247 srand48 \
2248 srandom \
2249 statfs \
2250 sysconf \
2251 syslog \
2252 timegm \
2253 vsnprintf \
2254 )
2255
2256 dnl Magic which checks whether we are forcing a type of comm loop we
2257 dnl are actually going to (ab)use
2258
2259 dnl Actually do the define magic now
2260 dnl mostly ripped from squid-commloops, thanks to adrian and benno
2261
2262 if test "$ac_cv_func_kqueue" = "yes" ; then
2263 SELECT_TYPE="kqueue"
2264 AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
2265 elif test "$ac_cv_func_epoll" = "yes" ; then
2266 SELECT_TYPE="epoll"
2267 AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
2268 AC_CHECK_LIB(epoll, epoll_create, [EPOLL_LIBS="-lepoll"])
2269 AC_SUBST(EPOLL_LIBS)
2270 elif test "$ac_cv_func_poll" = "yes" ; then
2271 SELECT_TYPE="poll"
2272 AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
2273 elif test "$ac_cv_func_select" = "yes" ; then
2274 SELECT_TYPE="select"
2275 AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
2276 else
2277 echo "Eep! Can't find poll, kqueue, epoll, or select!"
2278 echo "I'll try select and hope for the best."
2279 SELECT_TYPE="select"
2280 AC_DEFINE(USE_SELECT,1)
2281 fi
2282 echo "Using ${SELECT_TYPE} for select loop."
2283
2284
2285 dnl Yay! Another Linux brokenness. Its not good enough
2286 dnl to know that setresuid() exists, because RedHat 5.0 declares
2287 dnl setresuid() but doesn't implement it.
2288 dnl
2289 AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
2290 AC_TRY_RUN([
2291 #include <stdlib.h>
2292 int main() {
2293 if(setresuid(-1,-1,-1)) {
2294 perror("setresuid:");
2295 exit(1);
2296 }
2297 exit(0);
2298 }
2299 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
2300 )
2301 if test "$ac_cv_func_setresuid" = "yes" ; then
2302 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.])
2303 fi
2304
2305 AM_CONDITIONAL(NEED_OWN_SNPRINTF, false)
2306 if test "$ac_cv_func_snprintf" = "no" || test "$ac_cv_func_vsnprintf" = "no" ; then
2307 AM_CONDITIONAL(NEED_OWN_SNPRINTF, true)
2308 fi
2309
2310 dnl
2311 dnl Test for va_copy
2312 dnl
2313 AC_CACHE_CHECK(if va_copy is implemented, ac_cv_func_va_copy,
2314 AC_TRY_RUN([
2315 #include <stdarg.h>
2316 void f (int i, ...) {
2317 va_list args1, args2;
2318 va_start (args1, i);
2319 va_copy (args2, args1);
2320 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2321 exit (1);
2322 va_end (args1); va_end (args2);
2323 }
2324 int main() {
2325 f (0, 42);
2326 return 0;
2327 }
2328 ],ac_cv_func_va_copy="yes",ac_cv_func_va_copy="no")
2329 )
2330 if test "$ac_cv_func_va_copy" = "yes" ; then
2331 AC_DEFINE(HAVE_VA_COPY, 1, [If your system have va_copy])
2332 fi
2333
2334 dnl
2335 dnl Some systems support __va_copy
2336 dnl
2337 AC_CACHE_CHECK(if __va_copy is implemented, ac_cv_func___va_copy,
2338 AC_TRY_RUN([
2339 #include <stdarg.h>
2340 void f (int i, ...) {
2341 va_list args1, args2;
2342 va_start (args1, i);
2343 __va_copy (args2, args1);
2344 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2345 exit (1);
2346 va_end (args1); va_end (args2);
2347 }
2348 int main() {
2349 f (0, 42);
2350 return 0;
2351 }
2352 ],ac_cv_func___va_copy="yes",ac_cv_func___va_copy="no")
2353 )
2354 if test "$ac_cv_func___va_copy" = "yes" ; then
2355 AC_DEFINE(HAVE___VA_COPY, 1, [Some systems have __va_copy instead of va_copy])
2356 fi
2357
2358 dnl IP-Filter support requires ipf header files. These aren't
2359 dnl installed by default, so we need to check for them
2360 if test "$IPF_TRANSPARENT" ; then
2361 AC_MSG_CHECKING(if IP-Filter header files are installed)
2362 # hold on to your hats...
2363 if test "$ac_cv_header_ip_compat_h" = "yes" ||
2364 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
2365 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
2366 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
2367 have_ipfilter_compat_header="yes"
2368 fi
2369 if test "x$have_ipfilter_compat_header" = "xyes" &&
2370 test "$ac_cv_header_ip_fil_h" = "yes" &&
2371 test "$ac_cv_header_ip_nat_h" = "yes" ; then
2372 IPF_TRANSPARENT="yes"
2373 AC_DEFINE(IPF_TRANSPARENT, 1)
2374 elif test "$have_ipfilter_compat_header" = "yes" &&
2375 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
2376 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
2377 IPF_TRANSPARENT="yes"
2378 AC_DEFINE(IPF_TRANSPARENT, 1)
2379 else
2380 IPF_TRANSPARENT="no"
2381 AC_DEFINE(IPF_TRANSPARENT, 0)
2382 fi
2383 AC_MSG_RESULT($IPF_TRANSPARENT)
2384 fi
2385 if test "$IPF_TRANSPARENT" = "no" ; then
2386 echo "WARNING: Cannot find necessary IP-Filter header files"
2387 echo " Transparent Proxy support WILL NOT be enabled"
2388 sleep 10
2389 elif test "$IPF_TRANSPARENT" = "yes" ; then
2390 dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
2391 dnl Solaris minor version (8, 9, 10, ...)
2392 case "$host" in
2393 *-solaris*)
2394 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
2395 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
2396 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
2397 ;;
2398 *)
2399 ;;
2400 esac
2401 fi
2402
2403 dnl PF support requires a header file.
2404 if test "$PF_TRANSPARENT" ; then
2405 AC_MSG_CHECKING(if PF header file is installed)
2406 # hold on to your hats...
2407 if test "$ac_cv_header_net_pfvar_h" = "yes"; then
2408 PF_TRANSPARENT="yes"
2409 AC_DEFINE(PF_TRANSPARENT, 1)
2410 else
2411 PF_TRANSPARENT="no"
2412 AC_DEFINE(PF_TRANSPARENT, 0)
2413 fi
2414 AC_MSG_RESULT($PF_TRANSPARENT)
2415 fi
2416 if test "$PF_TRANSPARENT" = "no" ; then
2417 echo "WARNING: Cannot find necessary PF header file"
2418 echo " Transparent Proxy support WILL NOT be enabled"
2419 sleep 10
2420 fi
2421
2422 dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
2423 dnl Shamelessly copied from above
2424 if test "$LINUX_NETFILTER" ; then
2425 AC_MSG_CHECKING(if Linux (Netfilter) kernel header files are installed)
2426 # hold on to your hats...
2427 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
2428 LINUX_NETFILTER="yes"
2429 AC_DEFINE(LINUX_NETFILTER, 1)
2430 else
2431 LINUX_NETFILTER="no"
2432 AC_DEFINE(LINUX_NETFILTER, 0)
2433 fi
2434 AC_MSG_RESULT($LINUX_NETFILTER)
2435 fi
2436 if test "$LINUX_NETFILTER" = "no" ; then
2437 echo "WARNING: Cannot find necessary Linux kernel (Netfilter) header files"
2438 echo " Linux Transparent Proxy support WILL NOT be enabled"
2439 sleep 10
2440 fi
2441
2442 if test -z "$USE_GNUREGEX" ; then
2443 case "$host" in
2444 *-sun-solaris2.[[0-4]])
2445 USE_GNUREGEX="yes"
2446 ;;
2447 *-next-nextstep*)
2448 USE_GNUREGEX="yes"
2449 ;;
2450 esac
2451 fi
2452 AC_MSG_CHECKING(if GNUregex needs to be compiled)
2453 if test -z "$USE_GNUREGEX"; then
2454 if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
2455 USE_GNUREGEX="yes"
2456 else
2457 AC_TRY_COMPILE([#include <sys/types.h>
2458 #include <regex.h>],[regex_t t; regcomp(&t,"",0);],
2459 USE_GNUREGEX="no",
2460 USE_GNUREGEX="yes")
2461 fi
2462 fi
2463 AC_MSG_RESULT($USE_GNUREGEX)
2464 if test "$USE_GNUREGEX" = "yes"; then
2465 REGEXLIB="-lregex"
2466 LIBREGEX="libregex.a"
2467 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
2468 fi
2469 AC_SUBST(REGEXLIB)
2470 AC_SUBST(LIBREGEX)
2471
2472 AC_REPLACE_FUNCS(\
2473 drand48 \
2474 tempnam \
2475 strerror \
2476 initgroups
2477 )
2478
2479 dnl Not cached since people are likely to tune this
2480 AC_MSG_CHECKING(Default FD_SETSIZE value)
2481 AC_TRY_RUN([
2482 #if HAVE_STDIO_H
2483 #include <stdio.h>
2484 #endif
2485 #if HAVE_UNISTD_H
2486 #include <unistd.h>
2487 #endif
2488 #if HAVE_SYS_TIME_H
2489 #include <sys/time.h>
2490 #endif
2491 #if HAVE_SYS_SELECT_H
2492 #include <sys/select.h>
2493 #endif
2494 #if HAVE_SYS_TYPES_H
2495 #include <sys/types.h>
2496 #endif
2497 main() {
2498 FILE *fp = fopen("conftestval", "w");
2499 fprintf (fp, "%d\n", FD_SETSIZE);
2500 exit(0);
2501 }
2502 ],
2503 DEFAULT_FD_SETSIZE=`cat conftestval`,
2504 DEFAULT_FD_SETSIZE=256,
2505 DEFAULT_FD_SETSIZE=256)
2506 AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
2507 AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
2508
2509
2510 dnl Not cached since people are likely to tune this
2511 AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
2512 dnl damn! FreeBSD's pthreads breaks dup2().
2513 if test -n "$squid_filedescriptors_num" ; then
2514 SQUID_MAXFD=$squid_filedescriptors_num
2515 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
2516 else
2517 TLDFLAGS="$LDFLAGS"
2518 case $host in
2519 i386-unknown-freebsd*)
2520 if echo "$LDFLAGS" | grep -q pthread; then
2521 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
2522 fi
2523 esac
2524 AC_TRY_RUN([
2525 #include <stdio.h>
2526 #include <unistd.h>
2527 #include <sys/time.h> /* needed on FreeBSD */
2528 #include <sys/param.h>
2529 #include <sys/resource.h>
2530 main() {
2531 FILE *fp;
2532 int i,j;
2533 #if defined(__CYGWIN32__) || defined (__CYGWIN__)
2534 /* getrlimit and sysconf returns bogous values on cygwin32.
2535 * Number of fds is virtually unlimited in cygwin (sys/param.h)
2536 * __CYGWIN32__ is deprecated.
2537 */
2538 i = NOFILE;
2539 #else
2540 #if HAVE_SETRLIMIT
2541 struct rlimit rl;
2542 #if defined(RLIMIT_NOFILE)
2543 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
2544 perror("getrlimit: RLIMIT_NOFILE");
2545 } else {
2546 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2547 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
2548 perror("setrlimit: RLIMIT_NOFILE");
2549 }
2550 }
2551 #elif defined(RLIMIT_OFILE)
2552 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
2553 perror("getrlimit: RLIMIT_OFILE");
2554 } else {
2555 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2556 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
2557 perror("setrlimit: RLIMIT_OFILE");
2558 }
2559 }
2560 #endif /* RLIMIT_NOFILE */
2561 #endif /* HAVE_SETRLIMIT */
2562 /* by starting at 2^14, we will never get higher
2563 than 2^15 for SQUID_MAXFD */
2564 i = j = 1<<14;
2565 while (j) {
2566 j >>= 1;
2567 if (dup2(0, i) < 0) {
2568 i -= j;
2569 } else {
2570 close(i);
2571 i += j;
2572 }
2573 }
2574 i++;
2575 #endif /* IF !DEF CYGWIN */
2576 fp = fopen("conftestval", "w");
2577 fprintf (fp, "%d\n", i & ~0x3F);
2578 exit(0);
2579 }
2580 ],
2581 SQUID_MAXFD=`cat conftestval`,
2582 SQUID_MAXFD=256,
2583 SQUID_MAXFD=256)
2584 dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs
2585 case "$host_os" in
2586 mingw|mingw32)
2587 SQUID_MAXFD="2048"
2588 ;;
2589 esac
2590 AC_MSG_RESULT($SQUID_MAXFD)
2591 fi
2592 AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
2593 if test "$SQUID_MAXFD" -lt 512 ; then
2594 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
2595 echo " cache will be very busy. Please see the FAQ page"
2596 echo " http://www.squid-cache.org/FAQ/FAQ-11.html#filedescriptors"
2597 echo " on how to increase your filedescriptor limit"
2598 sleep 10
2599 fi
2600 LDFLAGS="$TLDFLAGS"
2601
2602 if test `expr $SQUID_MAXFD % 64` != 0; then
2603 echo "WARNING: $SQUID_MAXFD is not an multiple of 64. This may cause issues"
2604 echo " on certain platforms."
2605 sleep 10
2606 fi
2607
2608 dnl Not cached since people are likely to tune this
2609 AC_MSG_CHECKING(Default UDP send buffer size)
2610 AC_TRY_RUN([
2611 #include <stdlib.h>
2612 #include <stdio.h>
2613 #include <sys/types.h>
2614 #include <sys/socket.h>
2615 #include <netinet/in.h>
2616 main ()
2617 {
2618 FILE *fp;
2619 int fd,val=0,len=sizeof(int);
2620 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
2621 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
2622 if (val<=0) exit(1);
2623 fp = fopen("conftestval", "w");
2624 fprintf (fp, "%d\n", val);
2625 exit(0);
2626 }
2627 ],
2628 SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`,
2629 SQUID_DETECT_UDP_SO_SNDBUF=16384,
2630 SQUID_DETECT_UDP_SO_SNDBUF=16384)
2631 AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
2632 AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
2633
2634 dnl Not cached since people are likely to tune this
2635 AC_MSG_CHECKING(Default UDP receive buffer size)
2636 AC_TRY_RUN([
2637 #include <stdlib.h>
2638 #include <stdio.h>
2639 #include <sys/types.h>
2640 #include <sys/socket.h>
2641 #include <netinet/in.h>
2642 main ()
2643 {
2644 FILE *fp;
2645 int fd,val=0,len=sizeof(int);
2646 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
2647 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
2648 if (val <= 0) exit(1);
2649 fp = fopen("conftestval", "w");
2650 fprintf (fp, "%d\n", val);
2651 exit(0);
2652 }
2653 ],
2654 SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`,
2655 SQUID_DETECT_UDP_SO_RCVBUF=16384,
2656 SQUID_DETECT_UDP_SO_RCVBUF=16384)
2657 AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
2658 AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
2659
2660 dnl Not cached since people are likely to tune this
2661 AC_MSG_CHECKING(Default TCP send buffer size)
2662 AC_TRY_RUN([
2663 #include <stdlib.h>
2664 #include <stdio.h>
2665 #include <sys/types.h>
2666 #include <sys/socket.h>
2667 #include <netinet/in.h>
2668 main ()
2669 {
2670 FILE *fp;
2671 int fd,val=0,len=sizeof(int);
2672 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
2673 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
2674 if (val <= 0) exit(1);
2675 fp = fopen("conftestval", "w");
2676 fprintf (fp, "%d\n", val);
2677 exit(0);
2678 }
2679 ],
2680 SQUID_TCP_SO_SNDBUF=`cat conftestval`,
2681 SQUID_TCP_SO_SNDBUF=16384,
2682 SQUID_TCP_SO_SNDBUF=16384)
2683 AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
2684 if test $SQUID_TCP_SO_SNDBUF -gt 32768; then
2685 echo "Limiting send buffer size to 32K"
2686 SQUID_TCP_SO_SNDBUF=32768
2687 fi
2688 AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
2689
2690 dnl Not cached since people are likely to tune this
2691 AC_MSG_CHECKING(Default TCP receive buffer size)
2692 AC_TRY_RUN([
2693 #include <stdlib.h>
2694 #include <stdio.h>
2695 #include <sys/types.h>
2696 #include <sys/socket.h>
2697 #include <netinet/in.h>
2698 main ()
2699 {
2700 FILE *fp;
2701 int fd,val=0,len=sizeof(int);
2702 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
2703 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
2704 if (val <= 0) exit(1);
2705 fp = fopen("conftestval", "w");
2706 fprintf (fp, "%d\n", val);
2707 exit(0);
2708 }
2709 ],
2710 SQUID_TCP_SO_RCVBUF=`cat conftestval`,
2711 SQUID_TCP_SO_RCVBUF=16384,
2712 SQUID_TCP_SO_RCVBUF=16384)
2713 AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
2714 if test $SQUID_TCP_SO_RCVBUF -gt 65535; then
2715 echo "Limiting receive buffer size to 64K"
2716 SQUID_TCP_SO_RCVBUF=65535
2717 fi
2718 AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
2719 AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
2720 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
2721 ac_cv_needs_sys_errlist="no",
2722 ac_cv_needs_sys_errlist="yes")
2723 )
2724 if test "$ac_cv_needs_sys_errlist" = "yes" ; then
2725 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
2726 fi
2727
2728 dnl Not cached since people are likely to change this
2729 AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
2730 AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
2731 [AC_MSG_RESULT(yes)
2732 AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],
2733 AC_MSG_RESULT(no))
2734
2735 AC_MSG_CHECKING(if inet_ntoa() actually works)
2736 AC_TRY_RUN([
2737 #include <stdlib.h>
2738 #include <stdio.h>
2739 #include <sys/types.h>
2740 #include <netinet/in.h>
2741 #include <arpa/inet.h>
2742 main ()
2743 {
2744 FILE *fp;
2745 struct in_addr in;
2746 in.s_addr = inet_addr("1.2.3.4");
2747 fp = fopen("conftestval", "w");
2748 fprintf (fp, "%s\n", inet_ntoa(in));
2749 exit(0);
2750 }
2751 ],
2752 INET_NTOA_RESULT=`cat conftestval`,
2753 INET_NTOA_RESULT="broken",
2754 INET_NTOA_RESULT="broken")
2755 if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
2756 AC_MSG_RESULT("yes")
2757 else
2758 AC_MSG_RESULT("no")
2759 case "$host_os" in
2760 mingw|mingw32)
2761 echo "Using Win32 resolver instead."
2762 ;;
2763 *)
2764 echo "Will use our own inet_ntoa()."
2765 AC_LIBOBJ(inet_ntoa)
2766 # echo "WARNING: This looks bad, and probably prevents Squid from working."
2767 # echo " If you're on IRIX and using GCC 2.8, you probably need"
2768 # echo " to use the IRIX C compiler instead."
2769 # sleep 10
2770 ;;
2771 esac
2772 fi
2773
2774 if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
2775 AC_MSG_CHECKING(for working statvfs() interface)
2776 AC_TRY_COMPILE([
2777 #include <stdlib.h>
2778 #include <stdio.h>
2779 #include <sys/types.h>
2780 #include <sys/statvfs.h>
2781 ],
2782 [
2783 struct statvfs sfs;
2784 sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
2785 sfs.f_files = sfs.f_ffree = 0;
2786 statvfs("/tmp", &sfs);
2787 ],
2788 ac_cv_func_statvfs=yes,
2789 ac_cv_func_statvfs=no)
2790 AC_MSG_RESULT($ac_cv_func_statvfs)
2791 if test "$ac_cv_func_statvfs" = "yes" ; then
2792 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
2793 fi
2794 fi
2795
2796 AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
2797 AC_TRY_COMPILE([
2798 #if HAVE_SYS_TYPES_H
2799 #include <sys/types.h>
2800 #endif
2801 #if HAVE_NETINET_IN_H
2802 #include <netinet/in.h>
2803 #endif
2804 #if HAVE_ARPA_INET_H
2805 #include <arpa/inet.h>
2806 #endif
2807 #if HAVE_ARPA_NAMESER_H
2808 #include <arpa/nameser.h>
2809 #endif
2810 #if HAVE_RESOLV_H
2811 #include <resolv.h>
2812 #endif
2813 ],
2814 [_res.nsaddr_list[[0]];],
2815 ac_cv_have_res_nsaddr_list="yes",
2816 ac_cv_have_res_nsaddr_list="no"))
2817 if test $ac_cv_have_res_nsaddr_list = "yes" ; then
2818 AC_DEFINE(HAVE_RES_NSADDR_LIST,1,[If _res structure has nsaddr_list member])
2819 fi
2820
2821 if test $ac_cv_have_res_nsaddr_list = "no" ; then
2822 AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
2823 AC_TRY_COMPILE([
2824 #if HAVE_SYS_TYPES_H
2825 #include <sys/types.h>
2826 #endif
2827 #if HAVE_NETINET_IN_H
2828 #include <netinet/in.h>
2829 #endif
2830 #if HAVE_ARPA_INET_H
2831 #include <arpa/inet.h>
2832 #endif
2833 #if HAVE_ARPA_NAMESER_H
2834 #include <arpa/nameser.h>
2835 #endif
2836 #if HAVE_RESOLV_H
2837 #include <resolv.h>
2838 #endif
2839 ],
2840 [_res.ns_list[[0]].addr;],
2841 ac_cv_have_res_ns_list="yes",
2842 ac_cv_have_res_ns_list="no"))
2843 if test $ac_cv_have_res_ns_list = "yes" ; then
2844 AC_DEFINE(HAVE_RES_NS_LIST,1,[If _res structure has ns_list member])
2845 fi
2846 fi
2847
2848 dnl Need the debugging version of malloc if available
2849 XTRA_OBJS=''
2850 if test "$ac_cv_lib_malloc_main" = "yes" ; then
2851 if test -r /usr/lib/debug/malloc.o ; then
2852 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
2853 fi
2854 if test -r /usr/lib/debug/mallocmap.o ; then
2855 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
2856 fi
2857 fi
2858
2859 AC_SUBST(XTRA_OBJS)
2860
2861 if test -z "$XTRA_LIBS"; then
2862 XTRA_LIBS="$LIBS"
2863 dnl minor cleanup
2864 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
2865 LIBS=''
2866 fi
2867 AC_SUBST(XTRA_LIBS)
2868
2869 dnl Clean up after OSF/1 core dump bug
2870 rm -f core
2871
2872 AC_CONFIG_FILES([\
2873 Makefile \
2874 lib/Makefile \
2875 scripts/Makefile \
2876 scripts/RunCache \
2877 scripts/RunAccel \
2878 src/Makefile \
2879 src/fs/Makefile \
2880 src/repl/Makefile \
2881 src/auth/Makefile \
2882 contrib/Makefile \
2883 snmplib/Makefile \
2884 icons/Makefile \
2885 errors/Makefile \
2886 test-suite/Makefile \
2887 doc/Makefile \
2888 helpers/Makefile \
2889 helpers/basic_auth/Makefile \
2890 helpers/basic_auth/LDAP/Makefile \
2891 helpers/basic_auth/MSNT/Makefile \
2892 helpers/basic_auth/NCSA/Makefile \
2893 helpers/basic_auth/PAM/Makefile \
2894 helpers/basic_auth/SMB/Makefile \
2895 helpers/basic_auth/YP/Makefile \
2896 helpers/basic_auth/getpwnam/Makefile \
2897 helpers/basic_auth/multi-domain-NTLM/Makefile \
2898 helpers/basic_auth/SASL/Makefile \
2899 helpers/digest_auth/Makefile \
2900 helpers/digest_auth/password/Makefile \
2901 helpers/ntlm_auth/Makefile \
2902 helpers/ntlm_auth/fakeauth/Makefile \
2903 helpers/ntlm_auth/no_check/Makefile \
2904 helpers/ntlm_auth/SMB/Makefile \
2905 helpers/ntlm_auth/SMB/smbval/Makefile \
2906 helpers/external_acl/Makefile \
2907 helpers/external_acl/ip_user/Makefile \
2908 helpers/external_acl/ldap_group/Makefile \
2909 helpers/external_acl/unix_group/Makefile \
2910 helpers/external_acl/wbinfo_group/Makefile
2911 ])
2912
2913 AC_CONFIG_SUBDIRS(lib/libTrie)
2914 AC_CONFIG_SUBDIRS(lib/cppunit-1.10.0)
2915
2916 AC_OUTPUT