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