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