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