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