]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Fixed assertion failures in the authentication framework after the latest
[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
20b3ae10 6dnl $Id: configure.in,v 1.384 2005/08/28 10:45:32 serassio 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)
20b3ae10 16AC_REVISION($Revision: 1.384 $)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"
dd81cb63 116 sleep 5
4c43504f 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
588e71df 1888dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
1889dnl that is incompatible with the updated Solaris header files.
1890dnl For this reason, we must check if pad128_t and upad128_t are defined.
1891AC_CHECK_TYPE(pad128_t,
1892 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
1893 ,SQUID_DEFAULT_INCLUDES)
1894
1895AC_CHECK_TYPE(upad128_t,
1896 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
1897 ,SQUID_DEFAULT_INCLUDES)
1898
6a9f6389 1899AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 1900AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1901 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
1902AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 1903AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1904 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
1905AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
1906AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 1907
77d6bd88 1908dnl Check for special functions
1909AC_FUNC_ALLOCA
1910
6a9f6389 1911AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
1912#include <sys/types.h>
6637e3a5 1913#include <sys/socket.h>
1914#if STDC_HEADERS
1915#include <stdlib.h>
1916#include <stddef.h>
6a9f6389 1917#endif])
6637e3a5 1918
6a9f6389 1919AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
aea1be68 1920#include <sys/ipc.h>
6a9f6389 1921#include <sys/msg.h>])
aea1be68 1922
090089c4 1923dnl Check for needed libraries
30a4f2a8 1924AC_CHECK_LIB(nsl, main)
6716b242 1925AC_CHECK_LIB(socket, main)
4b26fae9 1926case "$host_os" in
1927 mingw|mingw32)
1928 AC_MSG_CHECKING(for winsock)
1929 save_LIBS="$LIBS"
1930 for curlib in ws2_32 wsock32; do
1931 LIBS="$LIBS -l$curlib"
1932 AC_TRY_LINK([
1933 char __attribute__((stdcall)) socket(int,int,int);
1934 char __attribute__((stdcall)) select(int,int,int,int,int);
1935 char __attribute__((stdcall)) closesocket(int);
1936 char __attribute__((stdcall)) gethostname(int,int);
1937 ],
1938 [
1939 socket(1,2,3);
1940 select(1,2,3,4,5);
1941 closesocket(1);
1942 gethostname(1,2);
1943 ],
1944 have_winsock=yes, have_winsock=no)
1945
1946 if test $have_winsock = yes; then
1947 ac_cv_func_select='yes'
1948 if test $curlib = ws2_32; then
1949 have_winsock=winsock2
1950 fi
1951 break
1952 fi
1953 LIBS="$save_LIBS"
1954 done
1955 AC_MSG_RESULT($have_winsock)
1956 ;;
1957esac
94d48591 1958
3c641669 1959dnl Ripped from the Samba sources
1960AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
1961 AC_TRY_COMPILE([
1962#include <sys/types.h>
1963#include <stdlib.h>
1964#include <stddef.h>
1965#include <sys/socket.h>
1966#include <sys/un.h>],
1967[
1968 struct sockaddr_un sunaddr;
1969 sunaddr.sun_family = AF_UNIX;
1970],
1971 squid_cv_unixsocket=yes,squid_cv_unixsocket=no)])
1972if test x"$squid_cv_unixsocket" = x"yes"; then
6a9f6389 1973 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
3c641669 1974fi
1975dnl end rip
1976
94d48591 1977if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
1978 echo "skipping libmalloc check (--enable-dlmalloc specified)"
5c51415d 1979else
94d48591 1980 AC_CHECK_LIB(gnumalloc, main)
1981 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
1982 echo "Disabling extended malloc functions when using gnumalloc"
1983 ac_cv_func_mallinfo=no
1984 ac_cv_func_mallocblksize=no
1985 ac_cv_func_mallopt=no
1986 else
1987 case "$host" in
1988 *-sun-solaris*)
1989 echo "skipping libmalloc check for $host"
1990 ;;
1991 i386-*-freebsd*)
1992 echo "skipping libmalloc check for $host"
1993 ;;
1994 *)
1995
1996 AC_CHECK_LIB(malloc, main)
1997 ;;
1998 esac
1999 fi
8a15e65e 2000fi
94d48591 2001
6716b242 2002AC_CHECK_LIB(bsd, main)
be79ade0 2003AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 2004AC_CHECK_LIB(bind, gethostbyname)
2005if test $ac_cv_lib_bind_gethostbyname = "no" ; then
2006 case "$host" in
78743365 2007 i386-*-freebsd*)
2008 echo "skipping libresolv checks for $host"
2009 ;;
2010 *)
2011 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
2012 AC_CHECK_LIB(resolv, main)
2013 ;;
04a56fa3 2014 esac
2015fi
e0bddc45 2016AC_CHECK_LIB(m, main)
090089c4 2017
2018dnl Check for libcrypt
8154dd82 2019dnl Some of our helpers use crypt(3) which may be in libc, or in
2020dnl libcrypt (eg FreeBSD)
042b1f8a 2021AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
be79ade0 2022AC_SUBST(CRYPTLIB)
77f675ad 2023
042b1f8a 2024dnl Check for libdl, used by auth_modules/PAM
8154dd82 2025if test "$with_dl" = "yes"; then
2026 AC_CHECK_LIB(dl, dlopen)
2027fi
042b1f8a 2028
e5f4e1b0 2029dnl Check for pthreads
2030dnl We use pthreads when doing ASYNC I/O
8154dd82 2031if test "$with_pthreads" = "yes"; then
fa035612 2032 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
2033 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
e685e3c6 2034 case "$host" in
2035 i386-unknown-freebsd*)
2036 if test "$GCC" = "yes" ; then
2037 if test -z "$PRESET_LDFLAGS"; then
2038 LDFLAGS="$LDFLAGS -pthread"
2039 fi
2040 fi
2041 ;;
2042 *-solaris2.*)
2043 if test "$GCC" = "yes" ; then
fa035612 2044 SQUID_CFLAGS="$SQUID_CFLAGS -pthreads"
2045 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -pthreads"
e685e3c6 2046 else
fa035612 2047 SQUID_CFLAGS="$SQUID_CFLAGS -mt"
2048 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -mt"
e685e3c6 2049 fi
2050 ;;
2051 esac
8154dd82 2052 AC_CHECK_LIB(pthread, main)
2053fi
71f8abc8 2054
f85c88f3 2055dnl Check for librt
2056dnl We use AIO in the coss store
8154dd82 2057if test "$with_aio" = "yes"; then
580e2134 2058 dnl On some systems POSIX AIO functions are in libaio
2059 AC_CHECK_LIB(rt, aio_read,,AC_CHECK_LIB(aio, aio_read))
8154dd82 2060fi
f85c88f3 2061
86ec11aa 2062dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
2063dnl Robert Side <rside@aiinc.bc.ca>
2064dnl Mon, 18 Jan 1999 17:48:00 GMT
2065case "$host" in
2066 *-pc-sco3.2*)
2067 AC_CHECK_LIB(intl, strftime)
2068 ;;
2069esac
2070
20e869bf 2071dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
2072dnl only with Windows LDAP libraries using -lwldap32
2073case "$host_os" in
2074mingw|mingw32)
2075 LIB_LDAP="-lwldap32"
2076 LIB_LBER=""
2077 ;;
2078*)
2079 LIB_LDAP="-lldap"
2080 dnl LDAP helpers need to know if -llber is needed or not
2081 AC_CHECK_LIB(lber, main, [LIB_LBER="-llber"])
2082 ;;
2083esac
2084AC_SUBST(LIB_LDAP)
2085AC_SUBST(LIB_LBER)
2086
77f675ad 2087dnl System-specific library modifications
2088dnl
2089case "$host" in
88738790 2090 i386-*-solaris2.*)
7149a49f 2091 if test "$GCC" = "yes"; then
2092 echo "Removing -O for gcc on $host"
80e92d6d 2093 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 2094 fi
2095 ;;
77f675ad 2096 *-sgi-irix*)
2097 echo "Removing -lsocket for IRIX..."
6716b242 2098 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 2099 echo "Removing -lnsl for IRIX..."
6716b242 2100 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 2101 ac_cv_lib_nsl_main=no
b44c0fb4 2102 echo "Removing -lbsd for IRIX..."
2103 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 2104 ;;
4ba0bd0e 2105dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
2106dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
2107dnl Please change your configure script. AIX doesn't need -lbsd.
2108 *-ibm-aix*)
2109 echo "Removing -lbsd for AIX..."
2110 LIBS=`echo $LIBS | sed -e s/-lbsd//`
a6e0ad1e 2111 case "$host" in
c68e9c6b 2112dnl From: mlaster@metavillage.com (Mike Laster)
2113dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
2114dnl So using the internal versions generates a load of warnings
2115dnl during compile.
a6e0ad1e 2116 *-ibm-aix4*)
2117 echo "disabling snprintf/vsnprintf for $host"
2118 ac_cv_func_snprintf=no
2119 ac_cv_func_vsnprintf=no
2120 ;;
2121 esac
4ba0bd0e 2122 ;;
30a4f2a8 2123 *m88k*)
fa035612 2124 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
2125 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
6a9f6389 2126 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
7149a49f 2127 ;;
580ce039 2128 [*-*-solaris2.[0-4]])
6a9f6389 2129 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
30a4f2a8 2130 ;;
711fa75e 2131 [*-sony-newsos[56]*])
6a9f6389 2132 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
f62c73dc 2133 ;;
77f675ad 2134esac
090089c4 2135
57faa85a 2136# Remove optimization for GCC 2.95.[123]
d20b1cd0 2137# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
2138if test "$GCC" = "yes"; then
2139 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
2140 case "$GCCVER" in
57faa85a 2141 [2.95.[123]])
d20b1cd0 2142 echo "Removing -O for gcc on $host with GCC $GCCVER"
2143 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2144 ;;
2145 esac
2146fi
2147
176d10ee 2148# Recommended by Balint Nagy Endre <bne@CareNet.hu>
2149case "$host" in
2150 *-univel-sysv4.2MP)
2151 if test `uname -v` = "2.03"; then
2152 echo "disabling mallinfo for $host"
2153 ac_cv_func_mallinfo=no
2154 fi
2155 ;;
2156esac
2157
84cecfd2 2158dnl This has to be before AC_CHECK_FUNCS
2159# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2160# when running configure.
2161if test -z "$ac_cv_func_poll"; then
2162 case "$host" in
2163 [alpha-dec-osf3.*])
2164 # John Kay (jkay@nlanr.net) 19970818
2165 echo "disabling poll for $host..."
2166 ac_cv_func_poll='no'
2167 ;;
2168 [*-hp-hpux*.*])
2169 # Duane Wessels
2170 echo "disabling poll for $host..."
2171 ac_cv_func_poll='no'
2172 ;;
2173 [*-linux-*])
f5cec332 2174 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 2175 # poll is problematic on Linux. We disable it
2176 # by default until Linux gets it right.
b6a2f15e 2177 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2178 if test $rev -lt 002002; then
2179 echo "disabling poll for $host < 2.2..."
2180 ac_cv_func_poll='no'
2181 fi
84cecfd2 2182 ;;
c68e9c6b 2183 [powerpc-ibm-aix4.1.*])
2184 # Mike Laster (mlaster@metavillage.com) 19981021
2185 echo "disabling poll for $host..."
2186 ac_cv_func_poll='no'
2187 ;;
86ec11aa 2188 [*-pc-sco3.2*])
2189 # Robert Side <rside@aiinc.bc.ca>
2190 # Mon, 18 Jan 1999 17:48:00 GMT
2191 echo "disabling poll for $host..."
2192 ac_cv_func_poll='no'
2193 ;;
84cecfd2 2194 esac
2195fi
176d10ee 2196
6716b242 2197dnl Check for library functions
2198AC_CHECK_FUNCS(\
ce3d30fb 2199 backtrace_symbols_fd \
3a144521 2200 bcopy \
2201 bswap_16 \
2202 bswap_32 \
f9576890 2203 bswap16 \
2204 bswap32 \
df087e68 2205 crypt \
4ac29a5b 2206 fchmod \
6716b242 2207 getdtablesize \
8505e57b 2208 getpagesize \
230c091c 2209 getpass \
3a144521 2210 getrlimit \
30a4f2a8 2211 getrusage \
9c1d8929 2212 getspnam \
f9576890 2213 htobe16 \
2214 htole16 \
30a4f2a8 2215 lrand48 \
6716b242 2216 mallinfo \
0f5efab0 2217 mallocblksize \
6716b242 2218 mallopt \
2ae6b9b0 2219 memcpy \
30a4f2a8 2220 memmove \
dac27377 2221 memset \
b99a6dec 2222 mkstemp \
1812b6c7 2223 mktime \
88738790 2224 mstats \
84cecfd2 2225 poll \
3a144521 2226 pthread_attr_setschedparam \
cd748f27 2227 pthread_attr_setscope \
2228 pthread_setschedparam \
42b51993 2229 pthread_sigmask \
c68e9c6b 2230 putenv \
b1e77ec1 2231 random \
6716b242 2232 regcomp \
2233 regexec \
2234 regfree \
30a4f2a8 2235 res_init \
4915be3b 2236 rint \
a4ba1105 2237 sbrk \
3a144521 2238 select \
234967c9 2239 seteuid \
c415c128 2240 setgroups \
30a4f2a8 2241 setpgrp \
6716b242 2242 setrlimit \
30a4f2a8 2243 setsid \
2244 sigaction \
11430c03 2245 snprintf \
1ccc0d40 2246 socketpair \
30a4f2a8 2247 srand48 \
b1e77ec1 2248 srandom \
0343b99c 2249 statfs \
6716b242 2250 sysconf \
2251 syslog \
234967c9 2252 timegm \
28da5e0d 2253 vsnprintf \
6716b242 2254)
2255
1b3db6d9 2256dnl Magic which checks whether we are forcing a type of comm loop we
2257dnl are actually going to (ab)use
2258
2259dnl Actually do the define magic now
2260dnl mostly ripped from squid-commloops, thanks to adrian and benno
2261
6c9797b9 2262if test "$ac_cv_func_kqueue" = "yes" ; then
92b9f1fd 2263 SELECT_TYPE="kqueue"
6a9f6389 2264 AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
a46d2c0e 2265elif test "$ac_cv_func_epoll" = "yes" ; then
2266 SELECT_TYPE="epoll"
2267 AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
48510020 2268 AC_CHECK_LIB(epoll, epoll_create, [EPOLL_LIBS="-lepoll"])
2269 AC_SUBST(EPOLL_LIBS)
6c9797b9 2270elif test "$ac_cv_func_poll" = "yes" ; then
2271 SELECT_TYPE="poll"
2272 AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
2273elif test "$ac_cv_func_select" = "yes" ; then
2274 SELECT_TYPE="select"
2275 AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
1b3db6d9 2276else
a46d2c0e 2277 echo "Eep! Can't find poll, kqueue, epoll, or select!"
1b3db6d9 2278 echo "I'll try select and hope for the best."
2279 SELECT_TYPE="select"
6a9f6389 2280 AC_DEFINE(USE_SELECT,1)
1b3db6d9 2281fi
2282echo "Using ${SELECT_TYPE} for select loop."
1b3db6d9 2283
2284
60939927 2285dnl Yay! Another Linux brokenness. Its not good enough
2286dnl to know that setresuid() exists, because RedHat 5.0 declares
2287dnl setresuid() but doesn't implement it.
2288dnl
2289AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 2290 AC_TRY_RUN([
60939927 2291#include <stdlib.h>
5c51415d 2292 int main() {
2293 if(setresuid(-1,-1,-1)) {
2294 perror("setresuid:");
2295 exit(1);
60939927 2296 }
2297 exit(0);
5c51415d 2298 }
2299 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 2300)
5c51415d 2301if test "$ac_cv_func_setresuid" = "yes" ; then
6a9f6389 2302 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 2303fi
60939927 2304
c3d0c8b5 2305AM_CONDITIONAL(NEED_OWN_SNPRINTF, false)
2306if test "$ac_cv_func_snprintf" = "no" || test "$ac_cv_func_vsnprintf" = "no" ; then
2307 AM_CONDITIONAL(NEED_OWN_SNPRINTF, true)
2308fi
eee79a2e 2309
2310dnl
2311dnl Test for va_copy
2312dnl
2313AC_CACHE_CHECK(if va_copy is implemented, ac_cv_func_va_copy,
2314 AC_TRY_RUN([
2315 #include <stdarg.h>
2316 void f (int i, ...) {
2317 va_list args1, args2;
2318 va_start (args1, i);
2319 va_copy (args2, args1);
2320 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2321 exit (1);
2322 va_end (args1); va_end (args2);
2323 }
2324 int main() {
2325 f (0, 42);
2326 return 0;
2327 }
2328 ],ac_cv_func_va_copy="yes",ac_cv_func_va_copy="no")
2329)
2330if test "$ac_cv_func_va_copy" = "yes" ; then
a45f884d 2331 AC_DEFINE(HAVE_VA_COPY, 1, [If your system have va_copy])
eee79a2e 2332fi
2333
2334dnl
2335dnl Some systems support __va_copy
2336dnl
2337AC_CACHE_CHECK(if __va_copy is implemented, ac_cv_func___va_copy,
2338 AC_TRY_RUN([
2339 #include <stdarg.h>
2340 void f (int i, ...) {
2341 va_list args1, args2;
2342 va_start (args1, i);
2343 __va_copy (args2, args1);
2344 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2345 exit (1);
2346 va_end (args1); va_end (args2);
2347 }
2348 int main() {
2349 f (0, 42);
2350 return 0;
2351 }
2352 ],ac_cv_func___va_copy="yes",ac_cv_func___va_copy="no")
2353)
2354if test "$ac_cv_func___va_copy" = "yes" ; then
a45f884d 2355 AC_DEFINE(HAVE___VA_COPY, 1, [Some systems have __va_copy instead of va_copy])
eee79a2e 2356fi
c3d0c8b5 2357
5cafc1d6 2358dnl IP-Filter support requires ipf header files. These aren't
2359dnl installed by default, so we need to check for them
2360if test "$IPF_TRANSPARENT" ; then
2361 AC_MSG_CHECKING(if IP-Filter header files are installed)
42b51993 2362 # hold on to your hats...
2363 if test "$ac_cv_header_ip_compat_h" = "yes" ||
2364 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 2365 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
2366 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 2367 have_ipfilter_compat_header="yes"
2368 fi
2369 if test "x$have_ipfilter_compat_header" = "xyes" &&
eb824054 2370 test "$ac_cv_header_ip_fil_h" = "yes" &&
2371 test "$ac_cv_header_ip_nat_h" = "yes" ; then
2372 IPF_TRANSPARENT="yes"
2373 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 2374 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 2375 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
2376 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
2377 IPF_TRANSPARENT="yes"
2378 AC_DEFINE(IPF_TRANSPARENT, 1)
2379 else
5cafc1d6 2380 IPF_TRANSPARENT="no"
2381 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 2382 fi
2383 AC_MSG_RESULT($IPF_TRANSPARENT)
2384fi
2385if test "$IPF_TRANSPARENT" = "no" ; then
2386 echo "WARNING: Cannot find necessary IP-Filter header files"
2387 echo " Transparent Proxy support WILL NOT be enabled"
2388 sleep 10
8f6ca20d 2389elif test "$IPF_TRANSPARENT" = "yes" ; then
2390dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
2391dnl Solaris minor version (8, 9, 10, ...)
2392 case "$host" in
2393 *-solaris*)
2394 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
2395 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
20b3ae10 2396 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
8f6ca20d 2397 ;;
2398 *)
2399 ;;
2400 esac
5cafc1d6 2401fi
2402
2b0dd4ac 2403dnl PF support requires a header file.
2404if test "$PF_TRANSPARENT" ; then
2405 AC_MSG_CHECKING(if PF header file is installed)
2406 # hold on to your hats...
2407 if test "$ac_cv_header_net_pfvar_h" = "yes"; then
2408 PF_TRANSPARENT="yes"
2409 AC_DEFINE(PF_TRANSPARENT, 1)
2410 else
2411 PF_TRANSPARENT="no"
2412 AC_DEFINE(PF_TRANSPARENT, 0)
2413 fi
2414 AC_MSG_RESULT($PF_TRANSPARENT)
2415fi
2416if test "$PF_TRANSPARENT" = "no" ; then
2417 echo "WARNING: Cannot find necessary PF header file"
2418 echo " Transparent Proxy support WILL NOT be enabled"
2419 sleep 10
2420fi
2421
d852fbad 2422dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
2423dnl Shamelessly copied from above
2424if test "$LINUX_NETFILTER" ; then
d6d62546 2425 AC_MSG_CHECKING(if Linux (Netfilter) kernel header files are installed)
d852fbad 2426 # hold on to your hats...
2427 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
2428 LINUX_NETFILTER="yes"
2429 AC_DEFINE(LINUX_NETFILTER, 1)
2430 else
2431 LINUX_NETFILTER="no"
2432 AC_DEFINE(LINUX_NETFILTER, 0)
2433 fi
2434 AC_MSG_RESULT($LINUX_NETFILTER)
2435fi
2436if test "$LINUX_NETFILTER" = "no" ; then
d6d62546 2437 echo "WARNING: Cannot find necessary Linux kernel (Netfilter) header files"
2438 echo " Linux Transparent Proxy support WILL NOT be enabled"
d852fbad 2439 sleep 10
2440fi
2441
91bc414e 2442if test -z "$USE_GNUREGEX" ; then
2443 case "$host" in
2444 *-sun-solaris2.[[0-4]])
2445 USE_GNUREGEX="yes"
2446 ;;
2447 *-next-nextstep*)
2448 USE_GNUREGEX="yes"
2449 ;;
2450 esac
2451fi
7a081912 2452AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 2453if test -z "$USE_GNUREGEX"; then
55878dfd 2454if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 2455 USE_GNUREGEX="yes"
00fa2c12 2456else
0cccc031 2457 AC_TRY_COMPILE([#include <sys/types.h>
2458#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 2459 USE_GNUREGEX="no",
2460 USE_GNUREGEX="yes")
2461fi
00fa2c12 2462fi
74946a0f 2463AC_MSG_RESULT($USE_GNUREGEX)
2464if test "$USE_GNUREGEX" = "yes"; then
26675bf4 2465 REGEXLIB="-lregex"
7a081912 2466 LIBREGEX="libregex.a"
6a9f6389 2467 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
7a081912 2468fi
26675bf4 2469AC_SUBST(REGEXLIB)
00fa2c12 2470AC_SUBST(LIBREGEX)
7a081912 2471
3f6fcd8a 2472AC_REPLACE_FUNCS(\
3d0cf10e 2473 drand48 \
3f6fcd8a 2474 tempnam \
4d38fc7e 2475 strerror \
e3d74828 2476 initgroups
3f6fcd8a 2477)
2478
5c51415d 2479dnl Not cached since people are likely to tune this
e924600d 2480AC_MSG_CHECKING(Default FD_SETSIZE value)
2481AC_TRY_RUN([
2482#if HAVE_STDIO_H
2483#include <stdio.h>
2484#endif
2485#if HAVE_UNISTD_H
2486#include <unistd.h>
2487#endif
2488#if HAVE_SYS_TIME_H
2489#include <sys/time.h>
2490#endif
2491#if HAVE_SYS_SELECT_H
2492#include <sys/select.h>
2493#endif
2494#if HAVE_SYS_TYPES_H
2495#include <sys/types.h>
2496#endif
2497main() {
635e6242 2498 FILE *fp = fopen("conftestval", "w");
2499 fprintf (fp, "%d\n", FD_SETSIZE);
e924600d 2500 exit(0);
2501}
2502],
2503DEFAULT_FD_SETSIZE=`cat conftestval`,
2504DEFAULT_FD_SETSIZE=256,
2505DEFAULT_FD_SETSIZE=256)
2506AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
6a9f6389 2507AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
e924600d 2508
f49be7d1 2509
5c51415d 2510dnl Not cached since people are likely to tune this
234967c9 2511AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 2512dnl damn! FreeBSD's pthreads breaks dup2().
f49be7d1 2513if test -n "$squid_filedescriptors_num" ; then
2514 SQUID_MAXFD=$squid_filedescriptors_num
2515 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
2516else
2517 TLDFLAGS="$LDFLAGS"
2518 case $host in
2519 i386-unknown-freebsd*)
2520 if echo "$LDFLAGS" | grep -q pthread; then
2521 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
2522 fi
2523 esac
2524 AC_TRY_RUN([
8cca06da 2525#include <stdio.h>
234967c9 2526#include <unistd.h>
30a4f2a8 2527#include <sys/time.h> /* needed on FreeBSD */
234967c9 2528#include <sys/param.h>
2529#include <sys/resource.h>
2530main() {
635e6242 2531 FILE *fp;
234967c9 2532 int i,j;
42b51993 2533#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 2534 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 2535 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 2536 * __CYGWIN32__ is deprecated.
df087e68 2537 */
2538 i = NOFILE;
b05490a8 2539#else
2540#if HAVE_SETRLIMIT
234967c9 2541 struct rlimit rl;
2542#if defined(RLIMIT_NOFILE)
2543 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
2544 perror("getrlimit: RLIMIT_NOFILE");
2545 } else {
2546 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2547 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
2548 perror("setrlimit: RLIMIT_NOFILE");
2549 }
2550 }
2551#elif defined(RLIMIT_OFILE)
2552 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
2553 perror("getrlimit: RLIMIT_OFILE");
2554 } else {
2555 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2556 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
2557 perror("setrlimit: RLIMIT_OFILE");
2558 }
2559 }
2560#endif /* RLIMIT_NOFILE */
2561#endif /* HAVE_SETRLIMIT */
d9399075 2562 /* by starting at 2^14, we will never get higher
2563 than 2^15 for SQUID_MAXFD */
2564 i = j = 1<<14;
2565 while (j) {
2566 j >>= 1;
2567 if (dup2(0, i) < 0) {
2568 i -= j;
2569 } else {
2570 close(i);
2571 i += j;
2572 }
2573 }
2574 i++;
b05490a8 2575#endif /* IF !DEF CYGWIN */
635e6242 2576 fp = fopen("conftestval", "w");
a4d7e961 2577 fprintf (fp, "%d\n", i & ~0x3F);
234967c9 2578 exit(0);
2579}
f49be7d1 2580 ],
2581 SQUID_MAXFD=`cat conftestval`,
2582 SQUID_MAXFD=256,
2583 SQUID_MAXFD=256)
4b26fae9 2584 dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs
2585 case "$host_os" in
2586 mingw|mingw32)
2587 SQUID_MAXFD="2048"
2588 ;;
2589 esac
f49be7d1 2590 AC_MSG_RESULT($SQUID_MAXFD)
2591fi
6a9f6389 2592AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
b9cc811d 2593if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 2594 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
2595 echo " cache will be very busy. Please see the FAQ page"
2b6662ba 2596 echo " http://www.squid-cache.org/FAQ/FAQ-11.html#filedescriptors"
e692ff35 2597 echo " on how to increase your filedescriptor limit"
933cc58d 2598 sleep 10
80ab193b 2599fi
c76d8acc 2600LDFLAGS="$TLDFLAGS"
234967c9 2601
d0f9207a 2602if test `expr $SQUID_MAXFD % 64` != 0; then
a4d7e961 2603 echo "WARNING: $SQUID_MAXFD is not an multiple of 64. This may cause issues"
2604 echo " on certain platforms."
2605 sleep 10
2606fi
2607
5c51415d 2608dnl Not cached since people are likely to tune this
30a4f2a8 2609AC_MSG_CHECKING(Default UDP send buffer size)
2610AC_TRY_RUN([
8cca06da 2611#include <stdlib.h>
2612#include <stdio.h>
30a4f2a8 2613#include <sys/types.h>
2614#include <sys/socket.h>
2615#include <netinet/in.h>
2616main ()
2617{
635e6242 2618 FILE *fp;
30a4f2a8 2619 int fd,val=0,len=sizeof(int);
2620 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
2621 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
2622 if (val<=0) exit(1);
635e6242 2623 fp = fopen("conftestval", "w");
2624 fprintf (fp, "%d\n", val);
30a4f2a8 2625 exit(0);
2626}
2627],
6a9f6389 2628SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`,
2629SQUID_DETECT_UDP_SO_SNDBUF=16384,
2630SQUID_DETECT_UDP_SO_SNDBUF=16384)
2631AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
2632AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
30a4f2a8 2633
5c51415d 2634dnl Not cached since people are likely to tune this
30a4f2a8 2635AC_MSG_CHECKING(Default UDP receive buffer size)
2636AC_TRY_RUN([
8cca06da 2637#include <stdlib.h>
2638#include <stdio.h>
30a4f2a8 2639#include <sys/types.h>
2640#include <sys/socket.h>
2641#include <netinet/in.h>
2642main ()
2643{
635e6242 2644 FILE *fp;
30a4f2a8 2645 int fd,val=0,len=sizeof(int);
2646 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
2647 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
2648 if (val <= 0) exit(1);
635e6242 2649 fp = fopen("conftestval", "w");
2650 fprintf (fp, "%d\n", val);
30a4f2a8 2651 exit(0);
2652}
2653],
6a9f6389 2654SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`,
2655SQUID_DETECT_UDP_SO_RCVBUF=16384,
2656SQUID_DETECT_UDP_SO_RCVBUF=16384)
2657AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
2658AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
30a4f2a8 2659
5c51415d 2660dnl Not cached since people are likely to tune this
30a4f2a8 2661AC_MSG_CHECKING(Default TCP send buffer size)
2662AC_TRY_RUN([
8cca06da 2663#include <stdlib.h>
2664#include <stdio.h>
30a4f2a8 2665#include <sys/types.h>
2666#include <sys/socket.h>
2667#include <netinet/in.h>
2668main ()
2669{
635e6242 2670 FILE *fp;
30a4f2a8 2671 int fd,val=0,len=sizeof(int);
2672 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
2673 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
2674 if (val <= 0) exit(1);
635e6242 2675 fp = fopen("conftestval", "w");
2676 fprintf (fp, "%d\n", val);
30a4f2a8 2677 exit(0);
2678}
2679],
2680SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 2681SQUID_TCP_SO_SNDBUF=16384,
2682SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 2683AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
2aa6ca58 2684if test $SQUID_TCP_SO_SNDBUF -gt 32768; then
2685 echo "Limiting send buffer size to 32K"
2686 SQUID_TCP_SO_SNDBUF=32768
2687fi
6a9f6389 2688AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
30a4f2a8 2689
5c51415d 2690dnl Not cached since people are likely to tune this
30a4f2a8 2691AC_MSG_CHECKING(Default TCP receive buffer size)
2692AC_TRY_RUN([
8cca06da 2693#include <stdlib.h>
2694#include <stdio.h>
30a4f2a8 2695#include <sys/types.h>
2696#include <sys/socket.h>
2697#include <netinet/in.h>
2698main ()
2699{
635e6242 2700 FILE *fp;
30a4f2a8 2701 int fd,val=0,len=sizeof(int);
2702 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
2703 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
2704 if (val <= 0) exit(1);
635e6242 2705 fp = fopen("conftestval", "w");
2706 fprintf (fp, "%d\n", val);
30a4f2a8 2707 exit(0);
2708}
2709],
2710SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 2711SQUID_TCP_SO_RCVBUF=16384,
2712SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 2713AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
2aa6ca58 2714if test $SQUID_TCP_SO_RCVBUF -gt 65535; then
2715 echo "Limiting receive buffer size to 64K"
2716 SQUID_TCP_SO_RCVBUF=65535
2717fi
6a9f6389 2718AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
5c51415d 2719AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
9bc73deb 2720 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
5c51415d 2721 ac_cv_needs_sys_errlist="no",
2722 ac_cv_needs_sys_errlist="yes")
2723)
2724if test "$ac_cv_needs_sys_errlist" = "yes" ; then
6a9f6389 2725 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
5c51415d 2726fi
30a4f2a8 2727
5c51415d 2728dnl Not cached since people are likely to change this
6bf65235 2729AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
2730AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
2731[AC_MSG_RESULT(yes)
6a9f6389 2732AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],
6bf65235 2733AC_MSG_RESULT(no))
2734
a937d5e3 2735AC_MSG_CHECKING(if inet_ntoa() actually works)
2736AC_TRY_RUN([
2737#include <stdlib.h>
2738#include <stdio.h>
2739#include <sys/types.h>
2740#include <netinet/in.h>
2741#include <arpa/inet.h>
2742main ()
2743{
635e6242 2744 FILE *fp;
a937d5e3 2745 struct in_addr in;
2746 in.s_addr = inet_addr("1.2.3.4");
635e6242 2747 fp = fopen("conftestval", "w");
2748 fprintf (fp, "%s\n", inet_ntoa(in));
a937d5e3 2749 exit(0);
2750}
2751],
2752INET_NTOA_RESULT=`cat conftestval`,
2753INET_NTOA_RESULT="broken",
2754INET_NTOA_RESULT="broken")
2755if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
2756 AC_MSG_RESULT("yes")
2757else
2758 AC_MSG_RESULT("no")
4b26fae9 2759 case "$host_os" in
2760 mingw|mingw32)
2761 echo "Using Win32 resolver instead."
2762 ;;
2763 *)
2764 echo "Will use our own inet_ntoa()."
2765 AC_LIBOBJ(inet_ntoa)
2766# echo "WARNING: This looks bad, and probably prevents Squid from working."
2767# echo " If you're on IRIX and using GCC 2.8, you probably need"
2768# echo " to use the IRIX C compiler instead."
2769# sleep 10
2770 ;;
2771 esac
a937d5e3 2772fi
2773
b6a2f15e 2774if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 2775AC_MSG_CHECKING(for working statvfs() interface)
2776AC_TRY_COMPILE([
2777#include <stdlib.h>
2778#include <stdio.h>
2779#include <sys/types.h>
2780#include <sys/statvfs.h>
2781],
2782[
2783struct statvfs sfs;
2784sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
2785sfs.f_files = sfs.f_ffree = 0;
2786statvfs("/tmp", &sfs);
2787],
2788 ac_cv_func_statvfs=yes,
2789 ac_cv_func_statvfs=no)
2790AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 2791if test "$ac_cv_func_statvfs" = "yes" ; then
6a9f6389 2792 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
b6a2f15e 2793fi
6b8e7481 2794fi
c68e9c6b 2795
2796AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
2797AC_TRY_COMPILE([
2798#if HAVE_SYS_TYPES_H
2799#include <sys/types.h>
2800#endif
2801#if HAVE_NETINET_IN_H
2802#include <netinet/in.h>
2803#endif
2804#if HAVE_ARPA_INET_H
2805#include <arpa/inet.h>
2806#endif
2807#if HAVE_ARPA_NAMESER_H
2808#include <arpa/nameser.h>
2809#endif
2810#if HAVE_RESOLV_H
2811#include <resolv.h>
2812#endif
2813],
2814[_res.nsaddr_list[[0]];],
2815ac_cv_have_res_nsaddr_list="yes",
2816ac_cv_have_res_nsaddr_list="no"))
2817if test $ac_cv_have_res_nsaddr_list = "yes" ; then
6a9f6389 2818 AC_DEFINE(HAVE_RES_NSADDR_LIST,1,[If _res structure has nsaddr_list member])
c68e9c6b 2819fi
2820
2821if test $ac_cv_have_res_nsaddr_list = "no" ; then
2822AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
2823AC_TRY_COMPILE([
2824#if HAVE_SYS_TYPES_H
2825#include <sys/types.h>
2826#endif
2827#if HAVE_NETINET_IN_H
2828#include <netinet/in.h>
2829#endif
2830#if HAVE_ARPA_INET_H
2831#include <arpa/inet.h>
2832#endif
2833#if HAVE_ARPA_NAMESER_H
2834#include <arpa/nameser.h>
2835#endif
2836#if HAVE_RESOLV_H
2837#include <resolv.h>
2838#endif
2839],
2840[_res.ns_list[[0]].addr;],
2841ac_cv_have_res_ns_list="yes",
2842ac_cv_have_res_ns_list="no"))
2843if test $ac_cv_have_res_ns_list = "yes" ; then
6a9f6389 2844 AC_DEFINE(HAVE_RES_NS_LIST,1,[If _res structure has ns_list member])
c68e9c6b 2845fi
2846fi
2847
090089c4 2848dnl Need the debugging version of malloc if available
2849XTRA_OBJS=''
6509a1a0 2850if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 2851 if test -r /usr/lib/debug/malloc.o ; then
2852 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
2853 fi
2854 if test -r /usr/lib/debug/mallocmap.o ; then
2855 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
2856 fi
2857fi
2bbd722b 2858
090089c4 2859AC_SUBST(XTRA_OBJS)
2860
38fea766 2861if test -z "$XTRA_LIBS"; then
2862 XTRA_LIBS="$LIBS"
0f5a16f8 2863 dnl minor cleanup
2864 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 2865 LIBS=''
2866fi
090089c4 2867AC_SUBST(XTRA_LIBS)
2868
090089c4 2869dnl Clean up after OSF/1 core dump bug
2870rm -f core
2871
6a9f6389 2872AC_CONFIG_FILES([\
a2794549 2873 Makefile \
2874 lib/Makefile \
a2794549 2875 scripts/Makefile \
2876 scripts/RunCache \
2877 scripts/RunAccel \
2878 src/Makefile \
2879 src/fs/Makefile \
2880 src/repl/Makefile \
2881 src/auth/Makefile \
a2794549 2882 contrib/Makefile \
2883 snmplib/Makefile \
2884 icons/Makefile \
2885 errors/Makefile \
1077c1b8 2886 test-suite/Makefile \
99db07b3 2887 doc/Makefile \
0c510f3c 2888 helpers/Makefile \
2889 helpers/basic_auth/Makefile \
2890 helpers/basic_auth/LDAP/Makefile \
2891 helpers/basic_auth/MSNT/Makefile \
2892 helpers/basic_auth/NCSA/Makefile \
2893 helpers/basic_auth/PAM/Makefile \
2894 helpers/basic_auth/SMB/Makefile \
2895 helpers/basic_auth/YP/Makefile \
2896 helpers/basic_auth/getpwnam/Makefile \
2897 helpers/basic_auth/multi-domain-NTLM/Makefile \
2898 helpers/basic_auth/SASL/Makefile \
0c510f3c 2899 helpers/digest_auth/Makefile \
2900 helpers/digest_auth/password/Makefile \
2901 helpers/ntlm_auth/Makefile \
2902 helpers/ntlm_auth/fakeauth/Makefile \
2903 helpers/ntlm_auth/no_check/Makefile \
2904 helpers/ntlm_auth/SMB/Makefile \
2905 helpers/ntlm_auth/SMB/smbval/Makefile \
c6588c68 2906 helpers/external_acl/Makefile \
2907 helpers/external_acl/ip_user/Makefile \
2908 helpers/external_acl/ldap_group/Makefile \
2909 helpers/external_acl/unix_group/Makefile \
97b131b6 2910 helpers/external_acl/wbinfo_group/Makefile
53cbe3e4 2911])
43ae1d95 2912
2913AC_CONFIG_SUBDIRS(lib/libTrie)
f5691f9c 2914AC_CONFIG_SUBDIRS(lib/cppunit-1.10.0)
43ae1d95 2915
6a9f6389 2916AC_OUTPUT