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