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