]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Forgotten to add Makefile.in files to native Windows helpers ....
[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
6e785d85 6dnl $Id: configure.in,v 1.389 2005/10/30 21:48:21 serassio Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
6a9f6389 10AC_INIT
856e69c5 11AC_PREREQ(2.52)
e6ccf245 12AC_CONFIG_SRCDIR([src/main.cc])
71b12d7c 13AC_CONFIG_AUX_DIR(cfgaux)
13d69257 14AM_INIT_AUTOMAKE(squid, 3.0-PRE3-CVS)
a2794549 15AM_CONFIG_HEADER(include/autoconf.h)
6e785d85 16AC_REVISION($Revision: 1.389 $)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
6e785d85 1355dnl Select negotiate auth helpers to build
1356NEGOTIATE_AUTH_HELPERS=
1357AC_ARG_ENABLE(negotiate-auth-helpers,
1358[ --enable-negotiate-auth-helpers=\"list of helpers\"
1359 This option selects which proxy_auth negotiate helpers
1360 to build and install as part of the normal build
1361 process. For a list of available helpers see
1362 the helpers/negotiate_auth directory.],
1363[ case "$enableval" in
1364 yes)
1365 for dir in $srcdir/helpers/negotiate_auth/*; do
1366 helper="`basename $dir`"
1367 if test -d "$dir" && test "$helper" != CVS; then
1368 NEGOTIATE_AUTH_HELPERS="$NEGOTIATE_AUTH_HELPERS $helper"
1369 fi
1370 done
1371 ;;
1372 no)
1373 ;;
1374 *)
1375 NEGOTIATE_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1376 ;;
1377 esac
1378])
1379if test -n "$NEGOTIATE_AUTH_HELPERS"; then
1380 for helper in $NEGOTIATE_AUTH_HELPERS; do
1381 if test -d $srcdir/helpers/negotiate_auth/$helper; then
1382 :
1383 else
1384 echo "ERROR: Negotiate Auth helper $helper does not exists"
1385 exit 1
1386 fi
1387 done
1388 echo "Negotiate auth helpers built: $NEGOTIATE_AUTH_HELPERS"
1389fi
1390AC_SUBST(NEGOTIATE_AUTH_HELPERS)
1391
2d70df72 1392dnl Select digest auth scheme helpers to build
1393DIGEST_AUTH_HELPERS=
1394AC_ARG_ENABLE(digest-auth-helpers,
1395[ --enable-digest-auth-helpers=\"list of helpers\"
1396 This option selects which digest scheme authentication
1397 helpers to build and install as part of the normal build
0c510f3c 1398 process. For a list of available helpers see the
1399 helpers/digest_auth directory.],
2d70df72 1400[ case "$enableval" in
1401 yes)
1c690e30 1402 for dir in $srcdir/helpers/digest_auth/*; do
1403 helper="`basename $dir`"
1404 if test -d "$dir" && test "$helper" != CVS; then
1405 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper"
1406 fi
1407 done
1408 ;;
2d70df72 1409 no)
1c690e30 1410 ;;
2d70df72 1411 *)
1c690e30 1412 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1413 ;;
2d70df72 1414 esac
1415])
1416if test -n "$DIGEST_AUTH_HELPERS"; then
1daefc1a 1417 for helper in $DIGEST_AUTH_HELPERS; do
1418 if test -f $srcdir/helpers/digest_auth/$helper/Makefile.in; then
1419 :
1420 else
1421 echo "ERROR: digest auth helper $helper does not exists"
1422 exit 1
1423 fi
1424 done
2d70df72 1425 echo "Digest auth helpers built: $DIGEST_AUTH_HELPERS"
1426fi
1427AC_SUBST(DIGEST_AUTH_HELPERS)
380f0a87 1428
6437ac71 1429dnl Enable "NTLM fail open"
1430AC_ARG_ENABLE(ntlm-fail-open,
1431[ --enable-ntlm-fail-open Enable NTLM fail open, where a helper that fails one of the
0961c811 1432 Authentication steps can allow squid to still authenticate
1433 the user.],
6437ac71 1434[ if test "$enableval" = "yes" ; then
6a9f6389 1435 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 1436 fi
1437])
1438
c6588c68 1439dnl Select external_acl helpers to build
1440EXTERNAL_ACL_HELPERS=
1441AC_ARG_ENABLE(external-acl-helpers,
1442[ --enable-external-acl-helpers=\"list of helpers\"
1443 This option selects which external_acl helpers to
1444 build and install as part of the normal build
1445 process. For a list of available helpers see the
1446 helpers/external_acl directory.],
1447[ case "$enableval" in
1448 yes)
1c690e30 1449 for dir in $srcdir/helpers/external_acl/*; do
1450 helper="`basename $dir`"
1451 if test -d "$dir" && test "$helper" != CVS; then
1452 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
1453 fi
1454 done
1455 ;;
c6588c68 1456 no)
1c690e30 1457 ;;
c6588c68 1458 *)
1c690e30 1459 EXTERNAL_ACL_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1460 ;;
c6588c68 1461 esac
1462])
1463if test -n "$EXTERNAL_ACL_HELPERS"; then
20d8bfe4 1464 for helper in $EXTERNAL_ACL_HELPERS; do
1465 if test -f $srcdir/helpers/external_acl/$helper/Makefile.in; then
1466 :
1467 else
1daefc1a 1468 echo "ERROR: external acl helper $helper does not exists"
20d8bfe4 1469 exit 1
1470 fi
1471 done
c6588c68 1472 echo "External acl helpers built: $EXTERNAL_ACL_HELPERS"
1473fi
1474AC_SUBST(EXTERNAL_ACL_HELPERS)
1475
d96ceb8e 1476dnl Disable "memPools" code
b001e822 1477AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
d96ceb8e 1478AC_ARG_ENABLE(mempools,
b001e822 1479[ --disable-mempools Disable memPools. Note that this option now simply sets the
1480 default behaviour. Specific classes can override this at runtime, and
1481 only lib/MemPool.c needs to be altered to change the squid-wide
1482 default for all classes.],
d96ceb8e 1483[ if test "$enableval" = "no" ; then
1484 echo "memPools disabled"
6a9f6389 1485 AC_DEFINE(DISABLE_POOLS, 1, [Define if you have problems with memPools and want to disable Pools])
d96ceb8e 1486 fi
1487])
1488
0e657244 1489dnl Enable WIN32 Service compile mode
1490AC_ARG_ENABLE(win32-service,
1491[ --enable-win32-service Compile Squid as a WIN32 Service
1492 Works only on Windows NT and Windows 2000 Platforms.],
1493[ if test "$enableval" = "yes" ; then
1494 echo "Enabling WIN32 run service mode"
1495 AC_DEFINE(USE_WIN32_SERVICE,1,[Define Windows NT & Windows 2000 run service mode])
1496 fi
1497])
1498
b1485ff8 1499
2adff954 1500dnl Check for Cyrus SASL
1501if test "$require_sasl" = "yes"; then
1502 AC_CHECK_HEADERS(sasl/sasl.h sasl.h)
1503 if test "$ac_cv_header_sasl_sasl_h" = "yes"; then
1504 echo "using SASL2"
1505 LIBSASL="-lsasl2"
1506 else
1507 if test "$ac_cv_header_sasl_h" = "yes"; then
1508 echo "using SASL"
1509 LIBSASL="-lsasl"
1510 else
1511 echo "ERROR: Neither SASL nor SASL2 found"
1512 exit 1
1513 fi
1514 fi
1515 AC_SUBST(LIBSASL)
1516fi
1517
3c573763 1518dnl Disable "unlinkd" code
fe0810ac 1519AC_ARG_ENABLE(unlinkd,
1520[ --disable-unlinkd Do not use unlinkd],
1521[ if test "$enableval" = "no" ; then
3c573763 1522 use_unlinkd=no
fe0810ac 1523 else
3c573763 1524 use_unlinkd=yes
fe0810ac 1525 fi
1526],[
1527 # Here we should probably use some magic depending on the selected
1528 # storage models
3c573763 1529 use_unlinkd=yes
fe0810ac 1530])
3c573763 1531if test "$use_unlinkd" = "yes"; then
fe0810ac 1532 echo "unlinkd enabled"
6a9f6389 1533 AC_DEFINE(USE_UNLINKD,1,[Define this if unlinkd is required (strongly recommended for ufs storage type)])
a2794549 1534 AM_CONDITIONAL(ENABLE_UNLINKD, true)
fe0810ac 1535else
1536 echo "unlinkd disabled"
a2794549 1537 AM_CONDITIONAL(ENABLE_UNLINKD, false)
fe0810ac 1538fi
fe0810ac 1539
ce3d30fb 1540dnl Enable backtraces on fatal errors
1541AC_ARG_ENABLE(stacktraces,
1542[ --enable-stacktraces Enable automatic call backtrace on fatal errors],
1543[ if test "$enableval" = "yes" ; then
1544 echo "Enabling automatic stack backtraces on fatal errors"
6a9f6389 1545 AC_DEFINE(PRINT_STACK_TRACE, 1,[Print stacktraces on fatal errors])
ce3d30fb 1546 fi
1547])
1548
88bfe092 1549AM_CONDITIONAL(ENABLE_XPROF_STATS, false)
1550dnl Enable USE_XPROF_STATS
1551AC_ARG_ENABLE(cpu-profiling,
1552[ --enable-cpu-profiling
1553 This option allows you to see which internal functions
1554 in Squid are consuming how much CPU. Compiles in probes
1555 that measure time spent in probed functions. Needs
1556 source modifications to add new probes. This is meant
1557 for developers to assist in performance optimisations
1558 of Squid internal functions.
1559 If you are not developer and not interested in the stats
1560 you shouldn't enable this, as overhead added, although
1561 small, is still overhead. See lib/Profiler.c for more.
1562 ],
1563[ if test "$enableval" = "yes" ; then
1564 echo "Enabling cpu-profiling"
6a9f6389 1565 AC_DEFINE(USE_XPROF_STATS, 1,[Define to enable CPU profiling within Squid])
88bfe092 1566 AM_CONDITIONAL(ENABLE_XPROF_STATS, true)
1567 fi
1568])
1569
f66a9ef4 1570dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
1571AC_ARG_ENABLE(x_accelerator_vary,
0961c811 1572[ --enable-x-accelerator-vary
1573 Enable support for the X-Accelerator-Vary
1574 HTTP header. Can be used to indicate
1575 variance within an accelerator setup.
1576 Typically used together with other code
1577 that adds custom HTTP headers to the requests.],
f66a9ef4 1578[ if test "$enableval" = "yes" ; then
1579 echo "Enabling support for X-Accelerator-Vary"
6a9f6389 1580 AC_DEFINE(X_ACCELERATOR_VARY, 1, [Enable support for the X-Accelerator-Vary HTTP header])
f66a9ef4 1581 fi
1582])
1583
f49be7d1 1584AC_ARG_WITH(filedescriptors,
1585[ --with-filedescriptors=NUMBER Force squid to support NUMBER filedescriptors],
1586[ squid_filedescriptors_num=$withval ])
1587
f5691f9c 1588# FIXME, try linking in a test program first, then if that fails try probing etc.
1589SQUID_CPPUNIT_DIR='cppunit-1.10.0'
1590SQUID_CPPUNIT_LA='$(top_builddir)/lib/cppunit-1.10.0/src/cppunit/libcppunit.la'
1591SQUID_CPPUNIT_INC='-I$(top_builddir)/lib/cppunit-1.10.0/include -I $(top_srcdir)/lib/cppunit-1.10.0/include'
1592if test -f /usr/include/cppunit/TestCase.h; then
1593 echo "using system installed cppunit"
1594 SQUID_CPPUNIT_DIR=''
1595 SQUID_CPPUNIT_LA='/usr/lib/libcppunit.la'
1596 SQUID_CPPUNIT_INC=''
1597fi
1598AC_ARG_WITH(cppunit-basedir,
1599[ --with-cppunit-basedir=/path/to/cppunit-base
1600 Path where the cppunit headers are libraries are found
1601 for unit testing. (defaults to use internal copies -
1602 version 1.10.0)
1603 ],
1604[ if test -f $withval/include/cppunit/TestCase.h; then
1605 echo "Using cppunit includes from $withval"
1606 SQUID_CPPUNIT_INC="-I${withval}/include"
1607 else
1608 echo "ERROR: Cannot find cppunit at $withval"
1609 exit 1
1610 fi
1611 if test -f $withval/lib/libcppunit.la; then
1612 echo "Using cppunit lib from $withval"
1613 SQUID_CPPUNIT_LA="-I${withval}/lib/libcppunit.la"
1614 else
1615 echo "ERROR: Cannot find cppunit at $withval"
1616 exit 1
1617 fi
1618 SQUID_CPPUNIT_DIR=''
1619])
1620AC_SUBST(SQUID_CPPUNIT_LA)
1621AC_SUBST(SQUID_CPPUNIT_INC)
1622AC_SUBST(SQUID_CPPUNIT_DIR)
1623
fd9aaa3e 1624# Force some compilers to use ANSI features
1625#
1626case "$host" in
1627 alpha-dec-osf*)
1628 if test "$ac_cv_prog_CC" = "cc" ; then
1629 echo "adding '-std1' to cc args for $host"
1630 CC="cc -std1";
1631 ac_cv_prog_CC="$CC"
1632 fi
1633 ;;
c68e9c6b 1634 *-hp-hpux*)
1635 if test "$ac_cv_prog_CC" = "cc" ; then
1636 echo "adding '-Ae' to cc args for $host"
1637 CC="cc -Ae";
1638 ac_cv_prog_CC="$CC"
1639 fi
1640 ;;
fd9aaa3e 1641esac
1642
090089c4 1643dnl Check for programs
1644AC_PROG_CPP
1645AC_PROG_INSTALL
090089c4 1646AC_PROG_LN_S
81280a96 1647AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 1648AC_PATH_PROG(FALSE, false, /usr/bin/false)
1649AC_PATH_PROG(TRUE, true, /usr/bin/true)
1650AC_PATH_PROG(RM, rm, $FALSE)
1651AC_PATH_PROG(MV, mv, $FALSE)
1652AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 1653AC_PATH_PROG(LN, ln, cp)
4e9d8e26 1654AC_PATH_PROG(PERL, perl, none)
a2794549 1655dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 1656AC_PATH_PROG(AR, ar, $FALSE)
1657
4e9d8e26 1658if test "$ac_cv_path_PERL" = "none"; then
1659 echo "Perl is required to compile Squid"
1660 echo "Please install Perl and then re-run configure"
1661 exit 1
1662fi
1663
6ad85e8a 1664case "$host" in
1665 *-hp-hpux*)
1666 echo "Disabling 'ranlib' for HP-UX..."
1667 RANLIB=":"
1668 ;;
1669esac
1670
1671dnl set $(AR)
1672AR_R="$AR r"
1673case "$host" in
1674 *-next-nextstep3)
1675 AR="libtool -o"
1676 ;;
1677esac
1678AC_SUBST(AR_R)
090089c4 1679
1680dnl Check for headers
1681AC_HEADER_DIRENT
1682AC_HEADER_STDC
db40ae20 1683
1684AC_CHECK_HEADERS( \
db40ae20 1685 arpa/inet.h \
30a4f2a8 1686 arpa/nameser.h \
9441aa34 1687 assert.h \
db40ae20 1688 bstring.h \
db40ae20 1689 crypt.h \
30a4f2a8 1690 ctype.h \
1691 errno.h \
ce3d30fb 1692 execinfo.h \
db40ae20 1693 fcntl.h \
42ad37af 1694 fnmatch.h \
9c1d8929 1695 getopt.h \
88738790 1696 gnumalloc.h \
30a4f2a8 1697 grp.h \
5cafc1d6 1698 ip_compat.h \
42b51993 1699 ip_fil_compat.h \
5cafc1d6 1700 ip_fil.h \
1701 ip_nat.h \
dbc5782a 1702 ipl.h \
30a4f2a8 1703 libc.h \
6ad85e8a 1704 limits.h \
30a4f2a8 1705 malloc.h \
e0bddc45 1706 math.h \
db40ae20 1707 memory.h \
b075cbb1 1708 mount.h \
2b0dd4ac 1709 net/pfvar.h \
30a4f2a8 1710 netdb.h \
db40ae20 1711 netinet/in.h \
30a4f2a8 1712 netinet/tcp.h \
42b51993 1713 netinet/ip_fil_compat.h \
1f7c9178 1714 openssl/err.h \
1715 openssl/md5.h \
1716 openssl/ssl.h \
a7ad6e4e 1717 openssl/engine.h \
dcfe6390 1718 poll.h \
30a4f2a8 1719 pwd.h \
1720 regex.h \
c68e9c6b 1721 sched.h \
30a4f2a8 1722 signal.h \
1723 stdarg.h \
1724 stddef.h \
1725 stdio.h \
db40ae20 1726 stdlib.h \
1727 string.h \
1728 strings.h \
0a4e8536 1729 sys/bitypes.h \
f9576890 1730 sys/bswap.h \
1731 sys/endian.h \
db40ae20 1732 sys/file.h \
5cafc1d6 1733 sys/ioctl.h \
30a4f2a8 1734 sys/param.h \
62ae0622 1735 sys/prctl.h \
77e4c0c9 1736 sys/msg.h \
30a4f2a8 1737 sys/resource.h \
db40ae20 1738 sys/select.h\
30a4f2a8 1739 sys/socket.h \
1740 sys/stat.h \
b075cbb1 1741 sys/statvfs.h \
3c641669 1742 syscall.h \
30a4f2a8 1743 sys/syscall.h \
db40ae20 1744 sys/time.h \
1745 sys/types.h \
30a4f2a8 1746 sys/un.h \
b075cbb1 1747 sys/vfs.h \
30a4f2a8 1748 sys/wait.h \
db40ae20 1749 syslog.h \
30a4f2a8 1750 time.h \
1751 unistd.h \
3c641669 1752 utime.h \
30a4f2a8 1753 varargs.h \
77d6bd88 1754 byteswap.h \
1755 glib.h \
60d096f4 1756 stdint.h \
1757 inttypes.h \
3c641669 1758 grp.h \
1759 nss_common.h \
1760 nss.h
db40ae20 1761)
1762
5a3237b0 1763AC_CHECK_HEADERS(linux/netfilter_ipv4.h,,,
dcd1dc78 1764SQUID_DEFAULT_INCLUDES
1765#if HAVE_LIMITS_H
1766#include <limits.h>
1767#endif
1768)
1769
5a3237b0 1770AC_CHECK_HEADERS(net/if.h \
1771 netinet/if_ether.h\
1772 netinet/ip_compat.h\
1773 netinet/ip_fil.h\
77e4c0c9 1774 netinet/ip_nat.h\
dbc5782a 1775 netinet/ipl.h \
77e4c0c9 1776 sys/mount.h\
1777 resolv.h,,,SQUID_BSDNET_INCLUDES)
5a3237b0 1778
aee0606f 1779AC_C_CONST
d57288d2 1780AC_C_BIGENDIAN
aee0606f 1781
5c51415d 1782AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
1783 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
1784 [foo("bar")],
1785 ac_cv_have_ansi_prototypes="yes",
1786 ac_cv_have_ansi_prototypes="no")
1787])
1788if test $ac_cv_have_ansi_prototypes = "yes" ; then
6a9f6389 1789 AC_DEFINE(HAVE_ANSI_PROTOTYPES,1,[Define if your compiler supports prototyping])
5c51415d 1790fi
20a50bb9 1791
6a9f6389 1792AC_STRUCT_TM
1793AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
1794#if TM_IN_SYS_TIME
1795#if HAVE_SYS_TIME_H
1796#include <sys/time.h>
1797#endif
1798#elif HAVE_TIME_H
1799#include <time.h>
1800#endif
5c51415d 1801])
46c883ed 1802
6a9f6389 1803AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
1804#if HAVE_SYS_TYPES_H
1805#include <sys/types.h>
1806#endif
eb824054 1807#if HAVE_MALLOC_H
1808#include <malloc.h>
6a9f6389 1809#endif])
eb824054 1810
6a9f6389 1811AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
1812#if HAVE_SYS_TYPES_H
1813#include <sys/types.h>
1814#endif
1815#if HAVE_MALLOC_H
1816#include <malloc.h>
1817#endif])
090089c4 1818
6a9f6389 1819AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
8ff51bba 1820#if HAVE_SYS_TIME_H
1821#include <sys/time.h>
1822#endif
b54a6789 1823#if HAVE_SYS_RESOURCE_H
1824#include <sys/resource.h>
6a9f6389 1825#endif])
b54a6789 1826
6a9f6389 1827AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
1828#if HAVE_SYS_TYPES_H
1829#include <sys/types.h>
1830#endif
a025a745 1831#include <netinet/in.h>
1832#include <netinet/in_systm.h>
6ad85e8a 1833#include <netinet/ip.h>
b05490a8 1834#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 1835#define ip_hl ihl
1836#endif
1837#ifndef __linux__
b05490a8 1838#ifndef __CYGWIN__
6ad85e8a 1839#define iphdr ip
b05490a8 1840#endif
6a9f6389 1841#endif])
a025a745 1842
090089c4 1843dnl Check for typedefs
77d6bd88 1844AC_CHECK_SIZEOF(void *)
090089c4 1845
6a9f6389 1846dnl 16 bit integers - int16_t and u_int16_t
1847dnl if this is defined we trust it to be 16 bits
1848AC_CHECK_TYPE(int16_t,
1849 AC_DEFINE(HAVE_INT16_T,1,[int16_t is defined in system headers]),
1850 ,SQUID_DEFAULT_INCLUDES)
1851
1852dnl fallback #1
1853AC_CHECK_TYPE(short,[
856e69c5 1854 AC_CHECK_SIZEOF(short,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1855 AC_DEFINE(HAVE_SHORT,1,[short is defined in system headers])
1856 ],,SQUID_DEFAULT_INCLUDES)
1857
1858dnl fallback #2
1859AC_CHECK_TYPE(int,[
856e69c5 1860 AC_CHECK_SIZEOF(int,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1861 AC_DEFINE(HAVE_INT,1,[int is defined in system headers])
1862 ],,SQUID_DEFAULT_INCLUDES)
1863
1864dnl unsigned 16 bit ints - u_int16_t
1865dnl if this is defined we trust it to be 16 bits
1866AC_CHECK_TYPE(u_int16_t,
1867 AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers]),
1868 ,SQUID_DEFAULT_INCLUDES)
1869
1870dnl fallback #1
1871dnl if this is defined we trust it to be 16 bits
1872AC_CHECK_TYPE(uint16_t,
1873 AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers]),
1874 ,SQUID_DEFAULT_INCLUDES)
1875
1876dnl 32 bit signed int - int32_t
1877dnl if this is defined we trust it to be 32 bits
1878AC_CHECK_TYPE(int32_t,
1879 AC_DEFINE(HAVE_INT32_T,1,[int32_t is defined in system headers]),
1880 ,SQUID_DEFAULT_INCLUDES)
1881
1882dnl fallback #1
1883AC_CHECK_TYPE(long,[
856e69c5 1884 AC_CHECK_SIZEOF(long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1885 AC_DEFINE(HAVE_LONG,1,[long is defined in system headers])
1886 ],,SQUID_DEFAULT_INCLUDES)
1887
1888dnl 32 bit unsigned int - u_int32_t
1889dnl if this is defined we trust it to be 32 bits
1890AC_CHECK_TYPE(u_int32_t,
1891 AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers]),
1892 ,SQUID_DEFAULT_INCLUDES)
1893
1894dnl fallback #1
1895dnl if this is defined we trust it to be 32 bits
1896AC_CHECK_TYPE(uint32_t,
1897 AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers]),
1898 ,SQUID_DEFAULT_INCLUDES)
1899
1900dnl 64 bit signed - int64_t
1901dnl if this is defind we trust it to be 64 bits
1902AC_CHECK_TYPE(int64_t,
1903 AC_DEFINE(HAVE_INT64_T,1,[int64_t is defined in system headers]),
1904 ,SQUID_DEFAULT_INCLUDES)
1905
1906dnl fallback #1
1907dnl if this is defind we trust it to be 64 bits
1908AC_CHECK_TYPE(__int64,
1909 AC_DEFINE(HAVE___INT64,1,[__int64 is defined in system headers]),
1910 ,SQUID_DEFAULT_INCLUDES)
1911
1912dnl fallback #2
1913AC_CHECK_TYPE(long long,[
856e69c5 1914 AC_CHECK_SIZEOF(long long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1915 AC_DEFINE(HAVE_LONG_LONG,1,[long long is defined in system headers])
1916 ],,SQUID_DEFAULT_INCLUDES)
1917
1918dnl 64 bit unsigned - u_int64_t
1919dnl if this is defind we trust it to be 64 bits
1920AC_CHECK_TYPE(u_int64_t,
1921 AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers]),
1922 ,SQUID_DEFAULT_INCLUDES)
1923
1924dnl fallback #1
1925dnl if this is defind we trust it to be 64 bits
1926AC_CHECK_TYPE(uint64_t,
1927 AC_DEFINE(HAVE_UINT64_T,1,[uint64_t is defined in system headers]),
1928 ,SQUID_DEFAULT_INCLUDES)
1929
588e71df 1930dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
1931dnl that is incompatible with the updated Solaris header files.
1932dnl For this reason, we must check if pad128_t and upad128_t are defined.
1933AC_CHECK_TYPE(pad128_t,
1934 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
1935 ,SQUID_DEFAULT_INCLUDES)
1936
1937AC_CHECK_TYPE(upad128_t,
1938 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
1939 ,SQUID_DEFAULT_INCLUDES)
1940
6a9f6389 1941AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 1942AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1943 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
1944AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
856e69c5 1945AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
6a9f6389 1946 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
1947AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
1948AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
adcceb47 1949
77d6bd88 1950dnl Check for special functions
1951AC_FUNC_ALLOCA
1952
6a9f6389 1953AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
1954#include <sys/types.h>
6637e3a5 1955#include <sys/socket.h>
1956#if STDC_HEADERS
1957#include <stdlib.h>
1958#include <stddef.h>
6a9f6389 1959#endif])
6637e3a5 1960
6a9f6389 1961AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
aea1be68 1962#include <sys/ipc.h>
6a9f6389 1963#include <sys/msg.h>])
aea1be68 1964
090089c4 1965dnl Check for needed libraries
30a4f2a8 1966AC_CHECK_LIB(nsl, main)
6716b242 1967AC_CHECK_LIB(socket, main)
4b26fae9 1968case "$host_os" in
1969 mingw|mingw32)
1970 AC_MSG_CHECKING(for winsock)
1971 save_LIBS="$LIBS"
1972 for curlib in ws2_32 wsock32; do
1973 LIBS="$LIBS -l$curlib"
1974 AC_TRY_LINK([
1975 char __attribute__((stdcall)) socket(int,int,int);
1976 char __attribute__((stdcall)) select(int,int,int,int,int);
1977 char __attribute__((stdcall)) closesocket(int);
1978 char __attribute__((stdcall)) gethostname(int,int);
1979 ],
1980 [
1981 socket(1,2,3);
1982 select(1,2,3,4,5);
1983 closesocket(1);
1984 gethostname(1,2);
1985 ],
1986 have_winsock=yes, have_winsock=no)
1987
1988 if test $have_winsock = yes; then
1989 ac_cv_func_select='yes'
1990 if test $curlib = ws2_32; then
1991 have_winsock=winsock2
1992 fi
1993 break
1994 fi
1995 LIBS="$save_LIBS"
1996 done
1997 AC_MSG_RESULT($have_winsock)
1998 ;;
1999esac
94d48591 2000
3c641669 2001dnl Ripped from the Samba sources
2002AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
2003 AC_TRY_COMPILE([
2004#include <sys/types.h>
2005#include <stdlib.h>
2006#include <stddef.h>
2007#include <sys/socket.h>
2008#include <sys/un.h>],
2009[
2010 struct sockaddr_un sunaddr;
2011 sunaddr.sun_family = AF_UNIX;
2012],
2013 squid_cv_unixsocket=yes,squid_cv_unixsocket=no)])
2014if test x"$squid_cv_unixsocket" = x"yes"; then
6a9f6389 2015 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
3c641669 2016fi
2017dnl end rip
2018
94d48591 2019if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
2020 echo "skipping libmalloc check (--enable-dlmalloc specified)"
5c51415d 2021else
94d48591 2022 AC_CHECK_LIB(gnumalloc, main)
2023 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
2024 echo "Disabling extended malloc functions when using gnumalloc"
2025 ac_cv_func_mallinfo=no
2026 ac_cv_func_mallocblksize=no
2027 ac_cv_func_mallopt=no
2028 else
2029 case "$host" in
2030 *-sun-solaris*)
2031 echo "skipping libmalloc check for $host"
2032 ;;
2033 i386-*-freebsd*)
2034 echo "skipping libmalloc check for $host"
2035 ;;
2036 *)
2037
2038 AC_CHECK_LIB(malloc, main)
2039 ;;
2040 esac
2041 fi
8a15e65e 2042fi
94d48591 2043
6716b242 2044AC_CHECK_LIB(bsd, main)
be79ade0 2045AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 2046AC_CHECK_LIB(bind, gethostbyname)
2047if test $ac_cv_lib_bind_gethostbyname = "no" ; then
2048 case "$host" in
78743365 2049 i386-*-freebsd*)
2050 echo "skipping libresolv checks for $host"
2051 ;;
2052 *)
2053 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
2054 AC_CHECK_LIB(resolv, main)
2055 ;;
04a56fa3 2056 esac
2057fi
e0bddc45 2058AC_CHECK_LIB(m, main)
090089c4 2059
2060dnl Check for libcrypt
8154dd82 2061dnl Some of our helpers use crypt(3) which may be in libc, or in
2062dnl libcrypt (eg FreeBSD)
042b1f8a 2063AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
be79ade0 2064AC_SUBST(CRYPTLIB)
77f675ad 2065
042b1f8a 2066dnl Check for libdl, used by auth_modules/PAM
8154dd82 2067if test "$with_dl" = "yes"; then
2068 AC_CHECK_LIB(dl, dlopen)
2069fi
042b1f8a 2070
e5f4e1b0 2071dnl Check for pthreads
2072dnl We use pthreads when doing ASYNC I/O
8154dd82 2073if test "$with_pthreads" = "yes"; then
fa035612 2074 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
2075 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
e685e3c6 2076 case "$host" in
2077 i386-unknown-freebsd*)
2078 if test "$GCC" = "yes" ; then
2079 if test -z "$PRESET_LDFLAGS"; then
2080 LDFLAGS="$LDFLAGS -pthread"
2081 fi
2082 fi
2083 ;;
2084 *-solaris2.*)
2085 if test "$GCC" = "yes" ; then
fa035612 2086 SQUID_CFLAGS="$SQUID_CFLAGS -pthreads"
2087 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -pthreads"
e685e3c6 2088 else
fa035612 2089 SQUID_CFLAGS="$SQUID_CFLAGS -mt"
2090 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -mt"
e685e3c6 2091 fi
2092 ;;
2093 esac
8154dd82 2094 AC_CHECK_LIB(pthread, main)
2095fi
71f8abc8 2096
f85c88f3 2097dnl Check for librt
2098dnl We use AIO in the coss store
8154dd82 2099if test "$with_aio" = "yes"; then
580e2134 2100 dnl On some systems POSIX AIO functions are in libaio
2101 AC_CHECK_LIB(rt, aio_read,,AC_CHECK_LIB(aio, aio_read))
8154dd82 2102fi
f85c88f3 2103
86ec11aa 2104dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
2105dnl Robert Side <rside@aiinc.bc.ca>
2106dnl Mon, 18 Jan 1999 17:48:00 GMT
2107case "$host" in
2108 *-pc-sco3.2*)
2109 AC_CHECK_LIB(intl, strftime)
2110 ;;
2111esac
2112
20e869bf 2113dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
2114dnl only with Windows LDAP libraries using -lwldap32
2115case "$host_os" in
2116mingw|mingw32)
2117 LIB_LDAP="-lwldap32"
2118 LIB_LBER=""
2119 ;;
2120*)
2121 LIB_LDAP="-lldap"
2122 dnl LDAP helpers need to know if -llber is needed or not
2123 AC_CHECK_LIB(lber, main, [LIB_LBER="-llber"])
2124 ;;
2125esac
2126AC_SUBST(LIB_LDAP)
2127AC_SUBST(LIB_LBER)
2128
77f675ad 2129dnl System-specific library modifications
2130dnl
2131case "$host" in
88738790 2132 i386-*-solaris2.*)
7149a49f 2133 if test "$GCC" = "yes"; then
2134 echo "Removing -O for gcc on $host"
80e92d6d 2135 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 2136 fi
2137 ;;
77f675ad 2138 *-sgi-irix*)
2139 echo "Removing -lsocket for IRIX..."
6716b242 2140 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 2141 echo "Removing -lnsl for IRIX..."
6716b242 2142 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 2143 ac_cv_lib_nsl_main=no
b44c0fb4 2144 echo "Removing -lbsd for IRIX..."
2145 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 2146 ;;
4ba0bd0e 2147dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
2148dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
2149dnl Please change your configure script. AIX doesn't need -lbsd.
2150 *-ibm-aix*)
2151 echo "Removing -lbsd for AIX..."
2152 LIBS=`echo $LIBS | sed -e s/-lbsd//`
a6e0ad1e 2153 case "$host" in
c68e9c6b 2154dnl From: mlaster@metavillage.com (Mike Laster)
2155dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
2156dnl So using the internal versions generates a load of warnings
2157dnl during compile.
a6e0ad1e 2158 *-ibm-aix4*)
2159 echo "disabling snprintf/vsnprintf for $host"
2160 ac_cv_func_snprintf=no
2161 ac_cv_func_vsnprintf=no
2162 ;;
2163 esac
4ba0bd0e 2164 ;;
30a4f2a8 2165 *m88k*)
fa035612 2166 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
2167 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
6a9f6389 2168 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
7149a49f 2169 ;;
580ce039 2170 [*-*-solaris2.[0-4]])
6a9f6389 2171 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
30a4f2a8 2172 ;;
711fa75e 2173 [*-sony-newsos[56]*])
6a9f6389 2174 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
f62c73dc 2175 ;;
77f675ad 2176esac
090089c4 2177
57faa85a 2178# Remove optimization for GCC 2.95.[123]
d20b1cd0 2179# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
2180if test "$GCC" = "yes"; then
2181 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
2182 case "$GCCVER" in
57faa85a 2183 [2.95.[123]])
d20b1cd0 2184 echo "Removing -O for gcc on $host with GCC $GCCVER"
2185 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2186 ;;
2187 esac
2188fi
2189
176d10ee 2190# Recommended by Balint Nagy Endre <bne@CareNet.hu>
2191case "$host" in
2192 *-univel-sysv4.2MP)
2193 if test `uname -v` = "2.03"; then
2194 echo "disabling mallinfo for $host"
2195 ac_cv_func_mallinfo=no
2196 fi
2197 ;;
2198esac
2199
84cecfd2 2200dnl This has to be before AC_CHECK_FUNCS
2201# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2202# when running configure.
2203if test -z "$ac_cv_func_poll"; then
2204 case "$host" in
2205 [alpha-dec-osf3.*])
2206 # John Kay (jkay@nlanr.net) 19970818
2207 echo "disabling poll for $host..."
2208 ac_cv_func_poll='no'
2209 ;;
2210 [*-hp-hpux*.*])
2211 # Duane Wessels
2212 echo "disabling poll for $host..."
2213 ac_cv_func_poll='no'
2214 ;;
2215 [*-linux-*])
f5cec332 2216 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 2217 # poll is problematic on Linux. We disable it
2218 # by default until Linux gets it right.
b6a2f15e 2219 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2220 if test $rev -lt 002002; then
2221 echo "disabling poll for $host < 2.2..."
2222 ac_cv_func_poll='no'
2223 fi
84cecfd2 2224 ;;
c68e9c6b 2225 [powerpc-ibm-aix4.1.*])
2226 # Mike Laster (mlaster@metavillage.com) 19981021
2227 echo "disabling poll for $host..."
2228 ac_cv_func_poll='no'
2229 ;;
86ec11aa 2230 [*-pc-sco3.2*])
2231 # Robert Side <rside@aiinc.bc.ca>
2232 # Mon, 18 Jan 1999 17:48:00 GMT
2233 echo "disabling poll for $host..."
2234 ac_cv_func_poll='no'
2235 ;;
84cecfd2 2236 esac
2237fi
176d10ee 2238
6716b242 2239dnl Check for library functions
2240AC_CHECK_FUNCS(\
ce3d30fb 2241 backtrace_symbols_fd \
3a144521 2242 bcopy \
2243 bswap_16 \
2244 bswap_32 \
f9576890 2245 bswap16 \
2246 bswap32 \
df087e68 2247 crypt \
4ac29a5b 2248 fchmod \
6716b242 2249 getdtablesize \
8505e57b 2250 getpagesize \
230c091c 2251 getpass \
3a144521 2252 getrlimit \
30a4f2a8 2253 getrusage \
9c1d8929 2254 getspnam \
f9576890 2255 htobe16 \
2256 htole16 \
30a4f2a8 2257 lrand48 \
6716b242 2258 mallinfo \
0f5efab0 2259 mallocblksize \
6716b242 2260 mallopt \
2ae6b9b0 2261 memcpy \
30a4f2a8 2262 memmove \
dac27377 2263 memset \
b99a6dec 2264 mkstemp \
1812b6c7 2265 mktime \
88738790 2266 mstats \
84cecfd2 2267 poll \
62ae0622 2268 prctl \
3a144521 2269 pthread_attr_setschedparam \
cd748f27 2270 pthread_attr_setscope \
2271 pthread_setschedparam \
42b51993 2272 pthread_sigmask \
c68e9c6b 2273 putenv \
b1e77ec1 2274 random \
6716b242 2275 regcomp \
2276 regexec \
2277 regfree \
30a4f2a8 2278 res_init \
4915be3b 2279 rint \
a4ba1105 2280 sbrk \
3a144521 2281 select \
234967c9 2282 seteuid \
c415c128 2283 setgroups \
30a4f2a8 2284 setpgrp \
6716b242 2285 setrlimit \
30a4f2a8 2286 setsid \
2287 sigaction \
11430c03 2288 snprintf \
1ccc0d40 2289 socketpair \
30a4f2a8 2290 srand48 \
b1e77ec1 2291 srandom \
0343b99c 2292 statfs \
6716b242 2293 sysconf \
2294 syslog \
234967c9 2295 timegm \
28da5e0d 2296 vsnprintf \
6716b242 2297)
2298
1b3db6d9 2299dnl Magic which checks whether we are forcing a type of comm loop we
2300dnl are actually going to (ab)use
2301
2302dnl Actually do the define magic now
2303dnl mostly ripped from squid-commloops, thanks to adrian and benno
2304
6c9797b9 2305if test "$ac_cv_func_kqueue" = "yes" ; then
92b9f1fd 2306 SELECT_TYPE="kqueue"
6a9f6389 2307 AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
a46d2c0e 2308elif test "$ac_cv_func_epoll" = "yes" ; then
2309 SELECT_TYPE="epoll"
2310 AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
48510020 2311 AC_CHECK_LIB(epoll, epoll_create, [EPOLL_LIBS="-lepoll"])
2312 AC_SUBST(EPOLL_LIBS)
6c9797b9 2313elif test "$ac_cv_func_poll" = "yes" ; then
2314 SELECT_TYPE="poll"
2315 AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
2316elif test "$ac_cv_func_select" = "yes" ; then
2317 SELECT_TYPE="select"
2318 AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
1b3db6d9 2319else
a46d2c0e 2320 echo "Eep! Can't find poll, kqueue, epoll, or select!"
1b3db6d9 2321 echo "I'll try select and hope for the best."
2322 SELECT_TYPE="select"
6a9f6389 2323 AC_DEFINE(USE_SELECT,1)
1b3db6d9 2324fi
2325echo "Using ${SELECT_TYPE} for select loop."
1b3db6d9 2326
2327
60939927 2328dnl Yay! Another Linux brokenness. Its not good enough
2329dnl to know that setresuid() exists, because RedHat 5.0 declares
2330dnl setresuid() but doesn't implement it.
2331dnl
2332AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 2333 AC_TRY_RUN([
60939927 2334#include <stdlib.h>
5c51415d 2335 int main() {
2336 if(setresuid(-1,-1,-1)) {
2337 perror("setresuid:");
2338 exit(1);
60939927 2339 }
2340 exit(0);
5c51415d 2341 }
2342 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 2343)
5c51415d 2344if test "$ac_cv_func_setresuid" = "yes" ; then
6a9f6389 2345 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 2346fi
60939927 2347
c3d0c8b5 2348AM_CONDITIONAL(NEED_OWN_SNPRINTF, false)
2349if test "$ac_cv_func_snprintf" = "no" || test "$ac_cv_func_vsnprintf" = "no" ; then
2350 AM_CONDITIONAL(NEED_OWN_SNPRINTF, true)
2351fi
eee79a2e 2352
2353dnl
2354dnl Test for va_copy
2355dnl
2356AC_CACHE_CHECK(if va_copy is implemented, ac_cv_func_va_copy,
2357 AC_TRY_RUN([
2358 #include <stdarg.h>
2359 void f (int i, ...) {
2360 va_list args1, args2;
2361 va_start (args1, i);
2362 va_copy (args2, args1);
2363 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2364 exit (1);
2365 va_end (args1); va_end (args2);
2366 }
2367 int main() {
2368 f (0, 42);
2369 return 0;
2370 }
2371 ],ac_cv_func_va_copy="yes",ac_cv_func_va_copy="no")
2372)
2373if test "$ac_cv_func_va_copy" = "yes" ; then
a45f884d 2374 AC_DEFINE(HAVE_VA_COPY, 1, [If your system have va_copy])
eee79a2e 2375fi
2376
2377dnl
2378dnl Some systems support __va_copy
2379dnl
2380AC_CACHE_CHECK(if __va_copy is implemented, ac_cv_func___va_copy,
2381 AC_TRY_RUN([
2382 #include <stdarg.h>
2383 void f (int i, ...) {
2384 va_list args1, args2;
2385 va_start (args1, i);
2386 __va_copy (args2, args1);
2387 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
2388 exit (1);
2389 va_end (args1); va_end (args2);
2390 }
2391 int main() {
2392 f (0, 42);
2393 return 0;
2394 }
2395 ],ac_cv_func___va_copy="yes",ac_cv_func___va_copy="no")
2396)
2397if test "$ac_cv_func___va_copy" = "yes" ; then
a45f884d 2398 AC_DEFINE(HAVE___VA_COPY, 1, [Some systems have __va_copy instead of va_copy])
eee79a2e 2399fi
c3d0c8b5 2400
5cafc1d6 2401dnl IP-Filter support requires ipf header files. These aren't
2402dnl installed by default, so we need to check for them
2403if test "$IPF_TRANSPARENT" ; then
2404 AC_MSG_CHECKING(if IP-Filter header files are installed)
42b51993 2405 # hold on to your hats...
2406 if test "$ac_cv_header_ip_compat_h" = "yes" ||
2407 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 2408 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
2409 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 2410 have_ipfilter_compat_header="yes"
2411 fi
2412 if test "x$have_ipfilter_compat_header" = "xyes" &&
eb824054 2413 test "$ac_cv_header_ip_fil_h" = "yes" &&
2414 test "$ac_cv_header_ip_nat_h" = "yes" ; then
2415 IPF_TRANSPARENT="yes"
2416 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 2417 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 2418 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
2419 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
2420 IPF_TRANSPARENT="yes"
2421 AC_DEFINE(IPF_TRANSPARENT, 1)
2422 else
5cafc1d6 2423 IPF_TRANSPARENT="no"
2424 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 2425 fi
2426 AC_MSG_RESULT($IPF_TRANSPARENT)
2427fi
2428if test "$IPF_TRANSPARENT" = "no" ; then
2429 echo "WARNING: Cannot find necessary IP-Filter header files"
2430 echo " Transparent Proxy support WILL NOT be enabled"
2431 sleep 10
8f6ca20d 2432elif test "$IPF_TRANSPARENT" = "yes" ; then
2433dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
2434dnl Solaris minor version (8, 9, 10, ...)
2435 case "$host" in
2436 *-solaris*)
2437 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
2438 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
20b3ae10 2439 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
8f6ca20d 2440 ;;
2441 *)
2442 ;;
2443 esac
5cafc1d6 2444fi
2445
2b0dd4ac 2446dnl PF support requires a header file.
2447if test "$PF_TRANSPARENT" ; then
2448 AC_MSG_CHECKING(if PF header file is installed)
2449 # hold on to your hats...
2450 if test "$ac_cv_header_net_pfvar_h" = "yes"; then
2451 PF_TRANSPARENT="yes"
2452 AC_DEFINE(PF_TRANSPARENT, 1)
2453 else
2454 PF_TRANSPARENT="no"
2455 AC_DEFINE(PF_TRANSPARENT, 0)
2456 fi
2457 AC_MSG_RESULT($PF_TRANSPARENT)
2458fi
2459if test "$PF_TRANSPARENT" = "no" ; then
2460 echo "WARNING: Cannot find necessary PF header file"
2461 echo " Transparent Proxy support WILL NOT be enabled"
2462 sleep 10
2463fi
2464
d852fbad 2465dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
2466dnl Shamelessly copied from above
2467if test "$LINUX_NETFILTER" ; then
d6d62546 2468 AC_MSG_CHECKING(if Linux (Netfilter) kernel header files are installed)
d852fbad 2469 # hold on to your hats...
2470 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
2471 LINUX_NETFILTER="yes"
2472 AC_DEFINE(LINUX_NETFILTER, 1)
2473 else
2474 LINUX_NETFILTER="no"
2475 AC_DEFINE(LINUX_NETFILTER, 0)
2476 fi
2477 AC_MSG_RESULT($LINUX_NETFILTER)
2478fi
2479if test "$LINUX_NETFILTER" = "no" ; then
d6d62546 2480 echo "WARNING: Cannot find necessary Linux kernel (Netfilter) header files"
2481 echo " Linux Transparent Proxy support WILL NOT be enabled"
d852fbad 2482 sleep 10
2483fi
2484
91bc414e 2485if test -z "$USE_GNUREGEX" ; then
2486 case "$host" in
2487 *-sun-solaris2.[[0-4]])
2488 USE_GNUREGEX="yes"
2489 ;;
2490 *-next-nextstep*)
2491 USE_GNUREGEX="yes"
2492 ;;
2493 esac
2494fi
7a081912 2495AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 2496if test -z "$USE_GNUREGEX"; then
55878dfd 2497if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 2498 USE_GNUREGEX="yes"
00fa2c12 2499else
0cccc031 2500 AC_TRY_COMPILE([#include <sys/types.h>
2501#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 2502 USE_GNUREGEX="no",
2503 USE_GNUREGEX="yes")
2504fi
00fa2c12 2505fi
74946a0f 2506AC_MSG_RESULT($USE_GNUREGEX)
2507if test "$USE_GNUREGEX" = "yes"; then
26675bf4 2508 REGEXLIB="-lregex"
7a081912 2509 LIBREGEX="libregex.a"
6a9f6389 2510 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
7a081912 2511fi
26675bf4 2512AC_SUBST(REGEXLIB)
00fa2c12 2513AC_SUBST(LIBREGEX)
7a081912 2514
3f6fcd8a 2515AC_REPLACE_FUNCS(\
3d0cf10e 2516 drand48 \
3f6fcd8a 2517 tempnam \
4d38fc7e 2518 strerror \
e3d74828 2519 initgroups
3f6fcd8a 2520)
2521
5c51415d 2522dnl Not cached since people are likely to tune this
e924600d 2523AC_MSG_CHECKING(Default FD_SETSIZE value)
2524AC_TRY_RUN([
2525#if HAVE_STDIO_H
2526#include <stdio.h>
2527#endif
2528#if HAVE_UNISTD_H
2529#include <unistd.h>
2530#endif
2531#if HAVE_SYS_TIME_H
2532#include <sys/time.h>
2533#endif
2534#if HAVE_SYS_SELECT_H
2535#include <sys/select.h>
2536#endif
2537#if HAVE_SYS_TYPES_H
2538#include <sys/types.h>
2539#endif
2540main() {
635e6242 2541 FILE *fp = fopen("conftestval", "w");
2542 fprintf (fp, "%d\n", FD_SETSIZE);
e924600d 2543 exit(0);
2544}
2545],
2546DEFAULT_FD_SETSIZE=`cat conftestval`,
2547DEFAULT_FD_SETSIZE=256,
2548DEFAULT_FD_SETSIZE=256)
2549AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
6a9f6389 2550AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
e924600d 2551
f49be7d1 2552
5c51415d 2553dnl Not cached since people are likely to tune this
234967c9 2554AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 2555dnl damn! FreeBSD's pthreads breaks dup2().
f49be7d1 2556if test -n "$squid_filedescriptors_num" ; then
2557 SQUID_MAXFD=$squid_filedescriptors_num
2558 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
2559else
2560 TLDFLAGS="$LDFLAGS"
2561 case $host in
2562 i386-unknown-freebsd*)
2563 if echo "$LDFLAGS" | grep -q pthread; then
2564 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
2565 fi
2566 esac
2567 AC_TRY_RUN([
8cca06da 2568#include <stdio.h>
234967c9 2569#include <unistd.h>
30a4f2a8 2570#include <sys/time.h> /* needed on FreeBSD */
234967c9 2571#include <sys/param.h>
2572#include <sys/resource.h>
2573main() {
635e6242 2574 FILE *fp;
234967c9 2575 int i,j;
42b51993 2576#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 2577 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 2578 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 2579 * __CYGWIN32__ is deprecated.
df087e68 2580 */
2581 i = NOFILE;
b05490a8 2582#else
2583#if HAVE_SETRLIMIT
234967c9 2584 struct rlimit rl;
2585#if defined(RLIMIT_NOFILE)
2586 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
2587 perror("getrlimit: RLIMIT_NOFILE");
2588 } else {
2589 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2590 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
2591 perror("setrlimit: RLIMIT_NOFILE");
2592 }
2593 }
2594#elif defined(RLIMIT_OFILE)
2595 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
2596 perror("getrlimit: RLIMIT_OFILE");
2597 } else {
2598 rl.rlim_cur = rl.rlim_max; /* set it to the max */
2599 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
2600 perror("setrlimit: RLIMIT_OFILE");
2601 }
2602 }
2603#endif /* RLIMIT_NOFILE */
2604#endif /* HAVE_SETRLIMIT */
d9399075 2605 /* by starting at 2^14, we will never get higher
2606 than 2^15 for SQUID_MAXFD */
2607 i = j = 1<<14;
2608 while (j) {
2609 j >>= 1;
2610 if (dup2(0, i) < 0) {
2611 i -= j;
2612 } else {
2613 close(i);
2614 i += j;
2615 }
2616 }
2617 i++;
b05490a8 2618#endif /* IF !DEF CYGWIN */
635e6242 2619 fp = fopen("conftestval", "w");
a4d7e961 2620 fprintf (fp, "%d\n", i & ~0x3F);
234967c9 2621 exit(0);
2622}
f49be7d1 2623 ],
2624 SQUID_MAXFD=`cat conftestval`,
2625 SQUID_MAXFD=256,
2626 SQUID_MAXFD=256)
4b26fae9 2627 dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs
2628 case "$host_os" in
2629 mingw|mingw32)
2630 SQUID_MAXFD="2048"
2631 ;;
2632 esac
f49be7d1 2633 AC_MSG_RESULT($SQUID_MAXFD)
2634fi
6a9f6389 2635AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
b9cc811d 2636if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 2637 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
2638 echo " cache will be very busy. Please see the FAQ page"
2b6662ba 2639 echo " http://www.squid-cache.org/FAQ/FAQ-11.html#filedescriptors"
e692ff35 2640 echo " on how to increase your filedescriptor limit"
933cc58d 2641 sleep 10
80ab193b 2642fi
c76d8acc 2643LDFLAGS="$TLDFLAGS"
234967c9 2644
d0f9207a 2645if test `expr $SQUID_MAXFD % 64` != 0; then
a4d7e961 2646 echo "WARNING: $SQUID_MAXFD is not an multiple of 64. This may cause issues"
2647 echo " on certain platforms."
2648 sleep 10
2649fi
2650
5c51415d 2651dnl Not cached since people are likely to tune this
30a4f2a8 2652AC_MSG_CHECKING(Default UDP send buffer size)
2653AC_TRY_RUN([
8cca06da 2654#include <stdlib.h>
2655#include <stdio.h>
30a4f2a8 2656#include <sys/types.h>
2657#include <sys/socket.h>
2658#include <netinet/in.h>
2659main ()
2660{
635e6242 2661 FILE *fp;
30a4f2a8 2662 int fd,val=0,len=sizeof(int);
2663 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
2664 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
2665 if (val<=0) exit(1);
635e6242 2666 fp = fopen("conftestval", "w");
2667 fprintf (fp, "%d\n", val);
30a4f2a8 2668 exit(0);
2669}
2670],
6a9f6389 2671SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`,
2672SQUID_DETECT_UDP_SO_SNDBUF=16384,
2673SQUID_DETECT_UDP_SO_SNDBUF=16384)
2674AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
2675AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
30a4f2a8 2676
5c51415d 2677dnl Not cached since people are likely to tune this
30a4f2a8 2678AC_MSG_CHECKING(Default UDP receive buffer size)
2679AC_TRY_RUN([
8cca06da 2680#include <stdlib.h>
2681#include <stdio.h>
30a4f2a8 2682#include <sys/types.h>
2683#include <sys/socket.h>
2684#include <netinet/in.h>
2685main ()
2686{
635e6242 2687 FILE *fp;
30a4f2a8 2688 int fd,val=0,len=sizeof(int);
2689 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
2690 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
2691 if (val <= 0) exit(1);
635e6242 2692 fp = fopen("conftestval", "w");
2693 fprintf (fp, "%d\n", val);
30a4f2a8 2694 exit(0);
2695}
2696],
6a9f6389 2697SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`,
2698SQUID_DETECT_UDP_SO_RCVBUF=16384,
2699SQUID_DETECT_UDP_SO_RCVBUF=16384)
2700AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
2701AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
30a4f2a8 2702
5c51415d 2703dnl Not cached since people are likely to tune this
30a4f2a8 2704AC_MSG_CHECKING(Default TCP send buffer size)
2705AC_TRY_RUN([
8cca06da 2706#include <stdlib.h>
2707#include <stdio.h>
30a4f2a8 2708#include <sys/types.h>
2709#include <sys/socket.h>
2710#include <netinet/in.h>
2711main ()
2712{
635e6242 2713 FILE *fp;
30a4f2a8 2714 int fd,val=0,len=sizeof(int);
2715 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
2716 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
2717 if (val <= 0) exit(1);
635e6242 2718 fp = fopen("conftestval", "w");
2719 fprintf (fp, "%d\n", val);
30a4f2a8 2720 exit(0);
2721}
2722],
2723SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 2724SQUID_TCP_SO_SNDBUF=16384,
2725SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 2726AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
2aa6ca58 2727if test $SQUID_TCP_SO_SNDBUF -gt 32768; then
2728 echo "Limiting send buffer size to 32K"
2729 SQUID_TCP_SO_SNDBUF=32768
2730fi
6a9f6389 2731AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
30a4f2a8 2732
5c51415d 2733dnl Not cached since people are likely to tune this
30a4f2a8 2734AC_MSG_CHECKING(Default TCP receive buffer size)
2735AC_TRY_RUN([
8cca06da 2736#include <stdlib.h>
2737#include <stdio.h>
30a4f2a8 2738#include <sys/types.h>
2739#include <sys/socket.h>
2740#include <netinet/in.h>
2741main ()
2742{
635e6242 2743 FILE *fp;
30a4f2a8 2744 int fd,val=0,len=sizeof(int);
2745 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
2746 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
2747 if (val <= 0) exit(1);
635e6242 2748 fp = fopen("conftestval", "w");
2749 fprintf (fp, "%d\n", val);
30a4f2a8 2750 exit(0);
2751}
2752],
2753SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 2754SQUID_TCP_SO_RCVBUF=16384,
2755SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 2756AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
2aa6ca58 2757if test $SQUID_TCP_SO_RCVBUF -gt 65535; then
2758 echo "Limiting receive buffer size to 64K"
2759 SQUID_TCP_SO_RCVBUF=65535
2760fi
6a9f6389 2761AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
5c51415d 2762AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
9bc73deb 2763 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
5c51415d 2764 ac_cv_needs_sys_errlist="no",
2765 ac_cv_needs_sys_errlist="yes")
2766)
2767if test "$ac_cv_needs_sys_errlist" = "yes" ; then
6a9f6389 2768 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
5c51415d 2769fi
30a4f2a8 2770
5c51415d 2771dnl Not cached since people are likely to change this
6bf65235 2772AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
2773AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
2774[AC_MSG_RESULT(yes)
6a9f6389 2775AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],
6bf65235 2776AC_MSG_RESULT(no))
2777
a937d5e3 2778AC_MSG_CHECKING(if inet_ntoa() actually works)
2779AC_TRY_RUN([
2780#include <stdlib.h>
2781#include <stdio.h>
2782#include <sys/types.h>
2783#include <netinet/in.h>
2784#include <arpa/inet.h>
2785main ()
2786{
635e6242 2787 FILE *fp;
a937d5e3 2788 struct in_addr in;
2789 in.s_addr = inet_addr("1.2.3.4");
635e6242 2790 fp = fopen("conftestval", "w");
2791 fprintf (fp, "%s\n", inet_ntoa(in));
a937d5e3 2792 exit(0);
2793}
2794],
2795INET_NTOA_RESULT=`cat conftestval`,
2796INET_NTOA_RESULT="broken",
2797INET_NTOA_RESULT="broken")
2798if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
2799 AC_MSG_RESULT("yes")
2800else
2801 AC_MSG_RESULT("no")
4b26fae9 2802 case "$host_os" in
2803 mingw|mingw32)
2804 echo "Using Win32 resolver instead."
2805 ;;
2806 *)
2807 echo "Will use our own inet_ntoa()."
2808 AC_LIBOBJ(inet_ntoa)
2809# echo "WARNING: This looks bad, and probably prevents Squid from working."
2810# echo " If you're on IRIX and using GCC 2.8, you probably need"
2811# echo " to use the IRIX C compiler instead."
2812# sleep 10
2813 ;;
2814 esac
a937d5e3 2815fi
2816
b6a2f15e 2817if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 2818AC_MSG_CHECKING(for working statvfs() interface)
2819AC_TRY_COMPILE([
2820#include <stdlib.h>
2821#include <stdio.h>
2822#include <sys/types.h>
2823#include <sys/statvfs.h>
2824],
2825[
2826struct statvfs sfs;
2827sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
2828sfs.f_files = sfs.f_ffree = 0;
2829statvfs("/tmp", &sfs);
2830],
2831 ac_cv_func_statvfs=yes,
2832 ac_cv_func_statvfs=no)
2833AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 2834if test "$ac_cv_func_statvfs" = "yes" ; then
6a9f6389 2835 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
b6a2f15e 2836fi
6b8e7481 2837fi
c68e9c6b 2838
2839AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
2840AC_TRY_COMPILE([
2841#if HAVE_SYS_TYPES_H
2842#include <sys/types.h>
2843#endif
2844#if HAVE_NETINET_IN_H
2845#include <netinet/in.h>
2846#endif
2847#if HAVE_ARPA_INET_H
2848#include <arpa/inet.h>
2849#endif
2850#if HAVE_ARPA_NAMESER_H
2851#include <arpa/nameser.h>
2852#endif
2853#if HAVE_RESOLV_H
2854#include <resolv.h>
2855#endif
2856],
2857[_res.nsaddr_list[[0]];],
2858ac_cv_have_res_nsaddr_list="yes",
2859ac_cv_have_res_nsaddr_list="no"))
2860if test $ac_cv_have_res_nsaddr_list = "yes" ; then
6a9f6389 2861 AC_DEFINE(HAVE_RES_NSADDR_LIST,1,[If _res structure has nsaddr_list member])
c68e9c6b 2862fi
2863
2864if test $ac_cv_have_res_nsaddr_list = "no" ; then
2865AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
2866AC_TRY_COMPILE([
2867#if HAVE_SYS_TYPES_H
2868#include <sys/types.h>
2869#endif
2870#if HAVE_NETINET_IN_H
2871#include <netinet/in.h>
2872#endif
2873#if HAVE_ARPA_INET_H
2874#include <arpa/inet.h>
2875#endif
2876#if HAVE_ARPA_NAMESER_H
2877#include <arpa/nameser.h>
2878#endif
2879#if HAVE_RESOLV_H
2880#include <resolv.h>
2881#endif
2882],
2883[_res.ns_list[[0]].addr;],
2884ac_cv_have_res_ns_list="yes",
2885ac_cv_have_res_ns_list="no"))
2886if test $ac_cv_have_res_ns_list = "yes" ; then
6a9f6389 2887 AC_DEFINE(HAVE_RES_NS_LIST,1,[If _res structure has ns_list member])
c68e9c6b 2888fi
2889fi
2890
090089c4 2891dnl Need the debugging version of malloc if available
2892XTRA_OBJS=''
6509a1a0 2893if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 2894 if test -r /usr/lib/debug/malloc.o ; then
2895 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
2896 fi
2897 if test -r /usr/lib/debug/mallocmap.o ; then
2898 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
2899 fi
2900fi
2bbd722b 2901
090089c4 2902AC_SUBST(XTRA_OBJS)
2903
38fea766 2904if test -z "$XTRA_LIBS"; then
2905 XTRA_LIBS="$LIBS"
0f5a16f8 2906 dnl minor cleanup
2907 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 2908 LIBS=''
2909fi
090089c4 2910AC_SUBST(XTRA_LIBS)
2911
090089c4 2912dnl Clean up after OSF/1 core dump bug
2913rm -f core
2914
6a9f6389 2915AC_CONFIG_FILES([\
a2794549 2916 Makefile \
2917 lib/Makefile \
a2794549 2918 scripts/Makefile \
2919 scripts/RunCache \
2920 scripts/RunAccel \
2921 src/Makefile \
2922 src/fs/Makefile \
2923 src/repl/Makefile \
2924 src/auth/Makefile \
a2794549 2925 contrib/Makefile \
2926 snmplib/Makefile \
2927 icons/Makefile \
2928 errors/Makefile \
1077c1b8 2929 test-suite/Makefile \
99db07b3 2930 doc/Makefile \
0c510f3c 2931 helpers/Makefile \
2932 helpers/basic_auth/Makefile \
2933 helpers/basic_auth/LDAP/Makefile \
2934 helpers/basic_auth/MSNT/Makefile \
2935 helpers/basic_auth/NCSA/Makefile \
2936 helpers/basic_auth/PAM/Makefile \
2937 helpers/basic_auth/SMB/Makefile \
6e785d85 2938 helpers/basic_auth/mswin_sspi/Makefile \
0c510f3c 2939 helpers/basic_auth/YP/Makefile \
2940 helpers/basic_auth/getpwnam/Makefile \
2941 helpers/basic_auth/multi-domain-NTLM/Makefile \
2942 helpers/basic_auth/SASL/Makefile \
0c510f3c 2943 helpers/digest_auth/Makefile \
2944 helpers/digest_auth/password/Makefile \
2945 helpers/ntlm_auth/Makefile \
2946 helpers/ntlm_auth/fakeauth/Makefile \
2947 helpers/ntlm_auth/no_check/Makefile \
2948 helpers/ntlm_auth/SMB/Makefile \
2949 helpers/ntlm_auth/SMB/smbval/Makefile \
6e785d85 2950 helpers/ntlm_auth/mswin_sspi/Makefile \
2951 helpers/negotiate_auth/Makefile \
2952 helpers/negotiate_auth/mswin_sspi/Makefile \
c6588c68 2953 helpers/external_acl/Makefile \
2954 helpers/external_acl/ip_user/Makefile \
2955 helpers/external_acl/ldap_group/Makefile \
2956 helpers/external_acl/unix_group/Makefile \
97b131b6 2957 helpers/external_acl/wbinfo_group/Makefile
53cbe3e4 2958])
43ae1d95 2959
2960AC_CONFIG_SUBDIRS(lib/libTrie)
f5691f9c 2961AC_CONFIG_SUBDIRS(lib/cppunit-1.10.0)
43ae1d95 2962
6a9f6389 2963AC_OUTPUT