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