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