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