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