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