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