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