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