]> git.ipfire.org Git - thirdparty/squid.git/blame_incremental - configure.in
Prep for 3.0.STABLE15
[thirdparty/squid.git] / configure.in
... / ...
CommitLineData
1dnl Configuration input file for Squid
2dnl
3dnl $Id$
4dnl
5dnl
6dnl
7AC_INIT(Squid Web Proxy, 3.HEAD-BZR, http://www.squid-cache.org/bugs/, squid)
8AC_PREREQ(2.52)
9AM_CONFIG_HEADER(include/autoconf.h)
10AC_CONFIG_AUX_DIR(cfgaux)
11AC_CONFIG_SRCDIR([src/main.cc])
12AM_INIT_AUTOMAKE([tar-ustar nostdinc])
13AC_REVISION($Revision: 1.497 $)dnl
14AC_PREFIX_DEFAULT(/usr/local/squid)
15AM_MAINTAINER_MODE
16
17PRESET_CFLAGS="$CFLAGS"
18PRESET_LDFLAGS="$LDFLAGS"
19
20dnl Set default LDFLAGS
21if test -z "$LDFLAGS"; then
22 LDFLAGS="-g"
23fi
24
25dnl Check for GNU cc
26AC_PROG_CC
27AM_PROG_CC_C_O
28AC_PROG_CXX
29AC_LANG_CPLUSPLUS
30AC_CANONICAL_HOST
31
32dnl Make the squid top srcdir available to sub-packages as --with-squid=PATH
33new_configure_args="$ac_configure_args --with-squid=$ac_abs_confdir"
34ac_configure_args="$new_configure_args"
35
36
37use_loadable_modules=1
38AC_MSG_CHECKING(whether to use loadable modules)
39AC_ARG_ENABLE(loadable-modules,
40 AC_HELP_STRING( [--disable-loadable-modules], [do not support loadable modules]) ,
41 [
42 case "${enableval}" in
43 yes) use_loadable_modules=yes ;;
44 no) use_loadable_modules=no ;;
45 *) AC_MSG_ERROR(bad value ${enableval} for --disable-loadable-modules) ;;
46 esac
47 AC_MSG_RESULT([$use_loadable_modules, explicitly])
48 ],
49 [
50 use_loadable_modules=yes;
51 AC_MSG_RESULT([$use_loadable_modules, implicitly])
52 ]
53)
54
55AM_CONDITIONAL(USE_LOADABLE_MODULES, test $use_loadable_modules = yes)
56
57if test $use_loadable_modules = yes;
58then
59 AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules])
60 AC_ENABLE_SHARED
61else
62 AC_DISABLE_SHARED
63fi
64
65AC_LIBTOOL_DLOPEN
66if test $use_loadable_modules = yes;
67then
68 AC_LIBLTDL_CONVENIENCE(lib/libLtdl)
69fi
70AC_PROG_LIBTOOL
71AC_LTDL_DLLIB
72
73# Do we need these unconditionally for "make distcheck" to work?
74AC_SUBST(INCLTDL)
75AC_SUBST(LIBLTDL)
76
77if test $use_loadable_modules = yes;
78then
79 # Why is this needed? Should not libtool's AC_LIBTOOL_DLOPEN do that?
80 LIBADD_DL=${lt_cv_dlopen_libs}
81 AC_SUBST([LIBADD_DL])
82fi
83
84AC_PROG_RANLIB
85
86
87CRYPTLIB=''
88REGEXLIB='' # -lregex
89# LIBREGEX='' # libregex.a
90
91dnl find out the exe extension for this platform. If it's not empty, use it for CGI's as well.
92AC_EXEEXT
93AC_OBJEXT
94
95if test -z "$EXEEXT"; then
96 CGIEXT=".cgi"
97else
98 # automake automatically adds .exe when installing binaries
99 CGIEXT=""
100fi
101AC_SUBST(CGIEXT)
102
103dnl this should be expanded to a list of platform sensible support requirements.
104dnl (adding an option like --enable-cygwin-support doesn't make sense :]) - R Collins 2001
105case "$host_os" in
106mingw|mingw32|cygwin|cygwin32)
107 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, true)
108 ;;
109*)
110 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, false)
111 ;;
112esac
113
114case "$host_os" in
115mingw|mingw32)
116 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
117 CFLAGS="$CFLAGS -mthreads"
118 CXXFLAGS="$CXXFLAGS -mthreads"
119 if test "$ac_cv_path_WIN32_PSAPI" = "none"; then
120 AC_MSG_NOTICE([PSAPI.DLL is recommended to run Squid on Windows NT Platform])
121 AC_MSG_NOTICE([Please see PSAPI.DLL section on doc/win32-relnotes.html.])
122 else
123 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
124 LIBS="$LIBS -lpsapi"
125 fi
126 MINGW_LIBS="-lmingwex"
127 AM_CONDITIONAL(USE_IPC_WIN32, true)
128 AC_SUBST(MINGW_LIBS)
129 ;;
130*)
131 AM_CONDITIONAL(USE_IPC_WIN32, false)
132 ;;
133esac
134
135if test -z "$CACHE_HTTP_PORT"; then
136 CACHE_HTTP_PORT="3128"
137fi
138if test -z "$CACHE_ICP_PORT"; then
139 CACHE_ICP_PORT="3130"
140fi
141
142dnl Substitutions
143AC_DEFINE_UNQUOTED(CACHE_HTTP_PORT, $CACHE_HTTP_PORT,
144[What default TCP port to use for HTTP listening?])
145AC_SUBST(CACHE_HTTP_PORT)
146AC_DEFINE_UNQUOTED(CACHE_ICP_PORT, $CACHE_ICP_PORT,
147[What default UDP port to use for ICP listening?])
148AC_SUBST(CACHE_ICP_PORT)
149
150AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
151
152AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args", [configure command line used to configure Squid])
153
154CACHE_EFFECTIVE_USER="nobody"
155AC_ARG_WITH(default-user,
156 AC_HELP_STRING([--with-default-user=USER],
157 [System user account for squid permissions. Default: nobody]),
158 [ CACHE_EFFECTIVE_USER="$withval" ]
159)
160AC_SUBST(CACHE_EFFECTIVE_USER)
161
162DEFAULT_LOG_DIR="$localstatedir/logs"
163AC_ARG_WITH(logdir,
164 AC_HELP_STRING([--with-logdir=PATH],
165 Default location for squid logs. default: $DEFAULT_LOG_DIR),
166 [ case $withval in
167 yes|no)
168 AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH )
169 ;;
170 *)
171 DEFAULT_LOG_DIR="$withval"
172 ;;
173 esac
174 ]
175)
176AC_SUBST(DEFAULT_LOG_DIR)
177
178DEFAULT_PIDFILE="$localstatedir/squid.pid"
179AC_ARG_WITH(pidfile,
180 AC_HELP_STRING([--with-pidfile=PATH],
181 Default location for squid PID file. default: $DEFAULT_PIDFILE),
182 [ case $withval in
183 yes|no)
184 AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH )
185 ;;
186 *)
187 DEFAULT_PIDFILE="$withval"
188 ;;
189 esac
190 ]
191)
192AC_SUBST(DEFAULT_PIDFILE)
193
194dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
195case "$host" in
196 mab-next-nextstep3)
197 CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
198 ;;
199esac
200
201if test "$GCC" = "yes"; then
202 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
203 GCCVER2=`echo $GCCVER | awk '{print $1 * 100}'`
204 case "$host" in
205 i386-*-freebsd*)
206 if test $GCCVER2 -lt 300 ; then
207 AC_MSG_FAILURE([GCC $GCCVER causes a coredump on $host. Try a more recent GCC version])
208 sleep 5
209 fi
210 ;;
211 esac
212 unset GCCVER
213 unset GCCVER2
214fi
215
216dnl Set Default CFLAGS
217if test -z "$PRESET_CFLAGS"; then
218 if test "$GCC" = "yes"; then
219 case "$host" in
220 *-sun-sunos*)
221 # sunos has too many warnings for this to be useful
222 # motorola too
223 ;;
224 *m88k*)
225 # Motorola cc/ld does not like -02 but is ok on -O
226 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
227 ;;
228 *)
229 CFLAGS="-Wall $CFLAGS"
230 ;;
231 esac
232 else
233 case "$host" in
234 *mips-sgi-irix6.*)
235 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
236 CFLAGS="-O3 -OPT:Olimit=0:space=OFF \
237 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
238 -Wl,-woff,85,-woff,84,-woff,134 \
239 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
240 CXXFLAGS="-O3 -OPT:Olimit=0:space=OFF \
241 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
242 -Wl,-woff,85,-woff,84,-woff,134 \
243 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
244 ;;
245 alpha-dec-osf4.*)
246 # Mogul says DEC compilers take both -g and -O2
247 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
248 CFLAGS="-O2 $CFLAGS"
249 ;;
250 *)
251 ;;
252 esac
253 fi
254fi
255
256dnl set squid required flags
257if test "$GCC" = "yes"; then
258dnl Guido Serassio (serassio@squid-cache.org) 20070811
259dnl Using the latest MinGW (gcc 3.4.5 + mingw-runtime 3.13) cannot build with
260dnl -Wmissing-prototypes -Wmissing-declarations
261dnl TODO: check if the problem will be present in any other newer MinGW release.
262 case "$host_os" in
263 mingw|mingw32)
264 SQUID_CFLAGS="-Werror -Wall -Wpointer-arith -Wwrite-strings -Wcomments"
265 ;;
266 *)
267 SQUID_CFLAGS="-Werror -Wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments"
268 ;;
269 esac
270 SQUID_CXXFLAGS="-Werror -Wall -Wpointer-arith -Wwrite-strings -Wcomments"
271else
272 SQUID_CFLAGS=
273 SQUID_CXXFLAGS=
274fi
275AC_SUBST(SQUID_CFLAGS)
276AC_SUBST(SQUID_CXXFLAGS)
277
278AC_TEST_CHECKFORHUGEOBJECTS
279SQUID_CXXFLAGS="$SQUID_CXXFLAGS $HUGE_OBJECT_FLAG"
280
281dnl Set LDFLAGS
282if test -z "$PRESET_LDFLAGS"; then
283 if test "$GCC" = "yes"; then
284 case "$host" in
285 *mips-sgi-irix6.*)
286 # Silence Linker warnings 84, 85 and 134
287 LDFLAGS="-Wl,-woff,85 -Wl,-woff,84 -Wl,-woff,134 $LDFLAGS"
288 ;;
289 *)
290 # nothing
291 ;;
292 esac
293 else
294 case "$host" in
295 *)
296 # nothing
297 ;;
298 esac
299 fi
300fi
301
302SquidInline="yes"
303
304AC_ARG_ENABLE(optimizations,
305 AC_HELP_STRING([--disable-optimizations],
306 [Don't compile Squid with compiler optimizations enabled.
307 Optimization is good for production builds, but not
308 good for debugging. During development, use
309 --disable-optimizations to reduce compilation times
310 and allow easier debugging. This option implicitly
311 also enabled --disable-inline]),
312[ if test "$enableval" = "no" ; then
313 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
314 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
315 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`"
316 SquidInline="no"
317 fi
318])
319
320AC_ARG_ENABLE(inline,
321 AC_HELP_STRING([--disable-inline],
322 [Don't compile trivial methods as inline. Squid
323 is coded with much of the code able to be inlined.
324 Inlining is good for production builds, but not
325 good for development. During development, use
326 --disable-inline to reduce compilation times and
327 allow incremental builds to be quick. For
328 production builds, or load tests, use
329 --enable-inline to have squid make all trivial
330 methods inlinable by the compiler.]),
331[ if test "$enableval" = "no" ; then
332 SquidInline="no"
333 fi
334])
335
336if test "$SquidInline" = "yes" ; then
337 AC_DEFINE(_SQUID_INLINE_, inline, [Keyword used by squid for inlining methods])
338 AC_DEFINE(_USE_INLINE_,, [Include inline methods into header file])
339else
340 AC_MSG_NOTICE([Inlining optimization disabled])
341 AC_DEFINE(_SQUID_INLINE_,, [Keyword used by squid for inlining methods])
342fi
343
344AC_ARG_ENABLE(debug-cbdata,
345 AC_HELP_STRING([--enable-debug-cbdata],
346 [Provide some debug information in cbdata]),
347[ if test "$enableval" = "yes" ; then
348 AC_MSG_NOTICE([cbdata debugging enabled])
349 AC_DEFINE(CBDATA_DEBUG,1,[Enable for cbdata debug information])
350 fi
351])
352
353dnl This is a developer only option.. developers know how to set defines
354dnl
355dnl AC_ARG_ENABLE(xmalloc-debug,
356dnl [ --enable-xmalloc-debug Do some simple malloc debugging],
357dnl [ if test "$enableval" = "yes" ; then
358dnl AC_MSG_NOTICE([malloc debugging enabled])
359dnl AC_DEFINE(XMALLOC_DEBUG,1,[Define to do simple malloc debugging])
360dnl fi
361dnl ])
362
363dnl This is a developer only option.. developers know how to set defines
364dnl
365dnl AC_ARG_ENABLE(xmalloc-debug-trace,
366dnl [ --enable-xmalloc-debug-trace
367dnl Detailed trace of memory allocations],
368dnl [ if test "$enableval" = "yes" ; then
369dnl AC_MSG_NOTICE([malloc debug trace enabled])
370dnl AC_DEFINE(XMALLOC_TRACE,1,[Define to have a detailed trace of memory allocations])
371dnl AC_DEFINE(XMALLOC_DEBUG,1)
372dnl fi
373dnl ])
374
375AC_ARG_ENABLE(xmalloc-statistics,
376 AC_HELP_STRING([--enable-xmalloc-statistics],
377 [Show malloc statistics in status page]),
378[ if test "$enableval" = "yes" ; then
379 AC_MSG_NOTICE([malloc statistics enabled])
380 AC_DEFINE(XMALLOC_STATISTICS,1,[Define to have malloc statistics])
381 fi
382])
383
384AC_ARG_ENABLE(async-io,
385 AC_HELP_STRING([--enable-async-io[=N_THREADS]],
386 [Shorthand for "--with-aufs-threads=N_THREADS --with-pthreads
387 --enable-storeio=ufs,aufs"]),
388[ case $enableval in
389 yes)
390 with_pthreads="yes"
391 STORE_MODULES="ufs aufs"
392 ;;
393 no)
394 ;;
395 *)
396 aufs_io_threads=$enableval
397 with_pthreads="yes"
398 STORE_MODULES="ufs aufs"
399 ;;
400 esac
401])
402
403AC_ARG_WITH(aufs-threads,
404 AC_HELP_STRING([--with-aufs-threads=N_THREADS],
405 [Tune the number of worker threads for the aufs object store.]),
406[ case $withval in
407 [[0-9]]*)
408 aufs_io_threads=$withval
409 ;;
410 *)
411 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
412 ;;
413 esac
414])
415if test "$aufs_io_threads"; then
416 AC_MSG_NOTICE([With $aufs_io_threads aufs threads])
417 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$aufs_io_threads,
418 [Defines how many threads aufs uses for I/O])
419fi
420
421AC_ARG_WITH(pthreads,
422 AC_HELP_STRING([--with-pthreads],[Use POSIX Threads]))
423if test "$with_pthreads" = "yes"; then
424 AC_MSG_NOTICE([With pthreads])
425fi
426
427AC_ARG_WITH(aio,
428 AC_HELP_STRING([--with-aio],[Use POSIX AIO]))
429if test "$with_aio" = "yes"; then
430 AC_MSG_NOTICE([With aio])
431fi
432
433
434AC_ARG_WITH(dl,
435 AC_HELP_STRING([--with-dl],[Use dynamic linking]))
436if test "$with_dl" = "yes"; then
437 AC_MSG_NOTICE([With dl])
438fi
439
440AC_ARG_ENABLE(storeio,
441 AC_HELP_STRING([--enable-storeio="list of modules"],
442 [Build support for the list of store I/O modules.
443 The default is only to build the "ufs" module.
444 See src/fs for a list of available modules, or
445 Programmers Guide section <not yet written>
446 for details on how to build your custom store module]),
447[ case $enableval in
448 yes)
449 for dir in $srcdir/src/fs/*; do
450 module="`basename $dir`"
451 if test -d "$dir" && test "$module" != CVS && test "$module" != coss; then
452 STORE_MODULES="$STORE_MODULES $module"
453 fi
454 done
455 ;;
456 no)
457 ;;
458 *)
459 STORE_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
460 ;;
461 esac
462],
463[ if test -z "$STORE_MODULES"; then
464 STORE_MODULES="ufs"
465 fi
466])
467if test -n "$STORE_MODULES"; then
468 dnl ensure that all modules a) exist and b) only include once.
469 STORE_MODULES_FULL=$STORE_MODULES
470 STORE_MODULES=
471 for module in $STORE_MODULES_FULL; do
472 have_mod=`echo "$STORE_MODULES" | grep "$module"`
473 if test "$have_mod" != ""; then
474 AC_MSG_NOTICE([Removing duplicate $module from storeio])
475 elif test -d $srcdir/src/fs/$module; then
476 STORE_MODULES="$STORE_MODULES $module"
477 else
478 AC_MSG_ERROR(storeio $module does not exist)
479 fi
480 done
481 AC_MSG_NOTICE([Store modules built: $STORE_MODULES])
482fi
483dnl remove all but diskd - its the only module that needs to recurse
484dnl into the sub directory
485UFS_FOUND=
486NEED_UFS=
487NEED_BLOCKING=
488NEED_DISKDAEMON=
489NEED_DISKTHREADS=
490NEED_AIO=
491STORE_TESTS=
492for fs in $STORE_MODULES none; do
493 case "$fs" in
494 diskd)
495 NEED_UFS="true"
496 NEED_BLOCKING="true"
497 NEED_DISKDAEMON="true"
498 ;;
499 aufs)
500 NEED_UFS="true"
501 NEED_BLOCKING="true"
502 NEED_DISKTHREADS="true"
503 ;;
504 coss)
505 NEED_AIO="true"
506 dnl
507 dnl Automake om MinGW needs explicit exe extension
508 dnl for STORE_TESTS substition
509 dnl
510 STORE_TESTS="$STORE_TESTS tests/testCoss$EXEEXT"
511 ;;
512 ufs)
513 UFS_FOUND="true"
514 STORE_TESTS="$STORE_TESTS tests/testUfs$EXEEXT"
515 esac
516done
517
518if test -z "$UFS_FOUND" && test -n "$NEED_UFS"; then
519 AC_MSG_NOTICE([Adding UFS, as it contains core logic for diskd and aufs])
520 STORE_MODULES="$STORE_MODULES ufs"
521 dnl
522 dnl Automake om MinGW needs explicit exe extension
523 dnl for STORE_TESTS substition
524 dnl
525 STORE_TESTS="$STORE_TESTS tests/testUfs$EXEEXT"
526fi
527
528AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
529AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
530AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
531AH_TEMPLATE(HAVE_FS_COSS, "Define to 1 if coss filesystem module is build")
532
533
534dnl got final STORE_MODULES, build library lists
535dnl This list will not be needed when each fs library has its own Makefile
536STORE_LIBS_TO_BUILD=
537dnl File system libraries to link executables with.
538dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
539STORE_LIBS_TO_ADD=
540for fs in $STORE_MODULES; do
541 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
542 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
543 HAVE_FS_TYPE=HAVE_FS_`echo $fs | sed 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
544 AC_DEFINE_UNQUOTED($HAVE_FS_TYPE, 1)
545done
546
547AC_SUBST(STORE_LIBS_TO_BUILD)
548AC_SUBST(STORE_LIBS_TO_ADD)
549AC_SUBST(STORE_TESTS)
550
551AC_ARG_ENABLE(disk-io,
552 AC_HELP_STRING([--enable-disk-io="list of modules"],
553 [Build support for the list of disk I/O modules.
554 If unset only the "Blocking" module will be built.
555 Set without a value all available modules will be built.
556 See src/DiskIO for a list of available modules, or
557 Programmers Guide section on DiskIO
558 for details on how to build your custom disk module]),
559[ case $enableval in
560 yes)
561 for dir in $srcdir/src/DiskIO/*; do
562 module="`basename $dir`"
563 if test -d "$dir" && test "$module" != CVS; then
564 AC_MSG_NOTICE([Autodetected $module DiskIO module])
565 DISK_MODULES="$DISK_MODULES $module"
566 fi
567 done
568 AC_DEFINE(USE_DISKIO,1,[DiskIO modules are expected to be available.])
569 ;;
570 no)
571 AC_DEFINE(USE_DISKIO,0,[DiskIO modules are expected to be available.])
572 ;;
573 *)
574 DISK_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
575 AC_DEFINE(USE_DISKIO,1,[DiskIO modules are expected to be available.])
576 ;;
577 esac
578],
579[ if test -z "$DISK_MODULES"; then
580 DISK_MODULES="Blocking"
581 AC_MSG_NOTICE([Enabling Blocking DiskIO module (required default)])
582 AC_DEFINE(USE_DISKIO,1,[DiskIO modules are expected to be available.])
583 fi
584])
585if test -n "$DISK_MODULES"; then
586 for module in $DISK_MODULES; do
587 if test -d $srcdir/src/DiskIO/$module; then
588 :
589 else
590 AC_MSG_ERROR(disk-io $module does not exist)
591 fi
592 done
593 DISK_LIBS="lib`echo $DISK_MODULES|sed -e 's% %.a lib%g'`.a"
594 DISK_LINKOBJS=
595 for module in $DISK_MODULES; do
596 AC_MSG_NOTICE([Enabling $module DiskIO module])
597 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/${module}/${module}DiskIOModule.o"
598 done
599fi
600for fs in $DISK_MODULES none; do
601 case "$fs" in
602 DiskDaemon)
603 DISK_PROGRAMS="$DISK_PROGRAMS DiskIO/DiskDaemon/diskd"
604 FOUND_DISKDAEMON="true"
605 ;;
606 DiskThreads)
607 FOUND_DISKTHREADS="true"
608 ;;
609 AIO)
610 FOUND_AIO="true"
611 ;;
612 Blocking)
613 FOUND_BLOCKING="true"
614 esac
615done
616
617if test -z "$FOUND_BLOCKING" && test -n "$NEED_BLOCKING"; then
618 AC_MSG_NOTICE([adding Blocking, as it is used by an active, legacy Store Module])
619 DISK_LIBS="$DISK_LIBS libBlocking.a"
620 DISK_MODULES="$DISK_MODULES Blocking"
621 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/Blocking/BlockingDiskIOModule.o"
622fi
623
624if test -z "$FOUND_DISKDAEMON" && test -n "$NEED_DISKDAEMON"; then
625 AC_MSG_NOTICE(["adding DiskDaemon, as it is used by an active, legacy Store Module])
626 DISK_LIBS="$DISK_LIBS libDiskDaemon.a"
627 DISK_MODULES="$DISK_MODULES DiskDaemon"
628 DISK_PROGRAMS="$DISK_PROGRAMS DiskIO/DiskDaemon/diskd"
629 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskDaemon/DiskDaemonDiskIOModule.o"
630fi
631
632if test -z "$FOUND_DISKTHREADS" && test -n "$NEED_DISKTHREADS"; then
633 AC_MSG_NOTICE([adding DiskThreads, as it is used by an active, legacy Store Module])
634 DISK_LIBS="$DISK_LIBS libDiskThreads.a"
635 DISK_MODULES="$DISK_MODULES DiskThreads"
636 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/DiskThreads/DiskThreadsDiskIOModule.o"
637fi
638
639if test -z "$FOUND_AIO" && test -n "$NEED_AIO"; then
640 AC_MSG_NOTICE([adding AIO, as it is used by an active, legacy Store Module])
641 DISK_LIBS="$DISK_LIBS libAIO.a"
642 DISK_MODULES="$DISK_MODULES AIO"
643 DISK_LINKOBJS="$DISK_LINKOBJS DiskIO/AIO/AIODiskIOModule.o"
644fi
645AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
646USE_AIOPS_WIN32=0
647USE_AIO_WIN32=0
648dnl we know what is being built. now add dependencies.
649for fs in $DISK_MODULES none; do
650 case "$fs" in
651 DiskThreads)
652 if test -z "$with_pthreads"; then
653 case "$host_os" in
654 mingw|mingw32)
655 USE_AIOPS_WIN32=1
656 AC_MSG_NOTICE([DiskThreads IO Module used, Windows threads support automatically enabled])
657 ;;
658 *)
659 AC_MSG_NOTICE([DiskThreads IO Module used, pthreads support automatically enabled])
660 with_pthreads=yes
661 ;;
662 esac
663 fi
664 ;;
665 AIO)
666 if test -z "$with_aio"; then
667 case "$host_os" in
668 mingw|mingw32)
669 USE_AIO_WIN32=1
670 AC_MSG_NOTICE([Aio IO Module used, Windows overlapped I/O support automatically enabled])
671 ;;
672 *)
673 AC_MSG_NOTICE([Aio IO Module used, aio support automatically enabled])
674 with_aio=yes
675 ;;
676 esac
677 fi
678 ;;
679 esac
680done
681
682dnl Check for librt
683dnl We use AIO in the coss store
684if test "$with_aio" = "yes"; then
685 dnl On some systems POSIX AIO functions are in libaio
686 AC_CHECK_LIB(rt, aio_read,
687 [DISK_LIBS="$DISK_LIBS -lrt"],
688 AC_CHECK_LIB(aio, aio_read,[DISK_LIBS="$DISK_LIBS -laio"])
689 )
690fi
691
692dnl Check for pthreads
693dnl We use pthreads when doing ASYNC I/O
694dnl
695dnl TODO: this needs to be re-coded to handle more systems and better
696dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
697dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
698if test "$with_pthreads" = "yes"; then
699 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
700 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
701 case "$host" in
702 i386-unknown-freebsd*)
703 if test "$GCC" = "yes" ; then
704 if test -z "$PRESET_LDFLAGS"; then
705 LDFLAGS="$LDFLAGS -pthread"
706 fi
707 fi
708 ;;
709 *-solaris2.*)
710 if test "$GCC" = "yes" ; then
711 SQUID_CFLAGS="$SQUID_CFLAGS -pthreads"
712 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -pthreads"
713 AC_CHECK_LIB(pthread, main,[DISK_LIBS="$DISK_LIBS -lpthread"],
714 [ AC_MSG_ERROR(pthread library required but cannot be found.) ])
715 else
716dnl test for -lpthread first. libc version is a stub apparently on Solaris.
717 SQUID_CFLAGS="$SQUID_CFLAGS -lpthread"
718 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -lpthread"
719 AC_CHECK_LIB(pthread, main,[DISK_LIBS="$DISK_LIBS -lpthread"],
720 [ SQUID_CFLAGS="$SQUID_CFLAGS -lpthread -mt"
721 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -lpthread -mt"
722 AC_CHECK_LIB(pthread, main,[DISK_LIBS="$DISK_LIBS -lpthread"],
723 [ AC_MSG_ERROR(pthread library required but cannot be found.) ])
724 ])
725 fi
726 ;;
727 *)
728 AC_CHECK_LIB(pthread, main,[DISK_LIBS="$DISK_LIBS -lpthread"],
729 [ AC_MSG_ERROR(pthread library required but cannot be found.) ])
730 ;;
731 esac
732fi
733
734AC_SUBST(DISK_MODULES)
735AC_SUBST(DISK_LIBS)
736AC_SUBST(DISK_PROGRAMS)
737AC_SUBST(DISK_LINKOBJS)
738AM_CONDITIONAL([USE_AIOPS_WIN32], [test "$USE_AIOPS_WIN32" = 1])
739AM_CONDITIONAL([USE_AIO_WIN32], [test "$USE_AIO_WIN32" = 1])
740
741
742dnl At lest one removal policy is always needed.
743dnl 'lru' removal policy is currently hard-coded by name for tests
744dnl so we must set it as default.
745REPL_POLICIES="lru"
746AC_ARG_ENABLE(removal-policies,
747 AC_HELP_STRING([--enable-removal-policies="list of policies"],
748 [Build support for the list of removal policies.
749 The default is only to build the "lru" module.
750 See src/repl for a list of available modules, or
751 Programmers Guide section 9.9 for details on how
752 to build your custom policy]),
753[ case $enableval in
754 yes)
755 for dir in $srcdir/src/repl/*; do
756 module="`basename $dir`"
757 if test -d "$dir" && test "$module" != CVS && test "$module" != "lru"; then
758 REPL_POLICIES="$REPL_POLICIES $module"
759 fi
760 done
761 ;;
762 no)
763 ;;
764 *)
765 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
766 ;;
767 esac
768])
769if test -n "$REPL_POLICIES"; then
770 for module in $REPL_POLICIES; do
771 if test -d $srcdir/src/repl/$module; then
772 :
773 else
774 AC_MSG_ERROR(Removal policy $module does not exist)
775 fi
776 done
777 AC_MSG_NOTICE([Removal policies built: $REPL_POLICIES])
778 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
779 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
780fi
781AC_SUBST(REPL_POLICIES)
782AC_SUBST(REPL_OBJS)
783AC_SUBST(REPL_LIBS)
784
785AM_CONDITIONAL(ENABLE_PINGER, false)
786AC_ARG_ENABLE(icmp,
787 AC_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),
788[ if test "$enableval" = "yes" ; then
789 AC_MSG_NOTICE([ICMP enabled])
790 AC_DEFINE(USE_ICMP,1,[Define to use Squid's ICMP and Network Measurement features (highly recommended!)])
791 AM_CONDITIONAL(ENABLE_PINGER, true)
792 fi
793])
794
795AM_CONDITIONAL(USE_DELAY_POOLS, false)
796AC_ARG_ENABLE(delay-pools,
797 AC_HELP_STRING([--enable-delay-pools],
798 [Enable delay pools to limit bandwidth usage]),
799[ if test "$enableval" = "yes" ; then
800 AC_MSG_NOTICE([Delay pools enabled])
801 AC_DEFINE([DELAY_POOLS],1,[Traffic management via "delay pools".])
802 AM_CONDITIONAL(USE_DELAY_POOLS, true,)
803 fi
804])
805
806dnl disable generic/common adaptation support by default
807use_adaptation=no
808
809AM_CONDITIONAL(USE_ESI, false)
810AC_ARG_ENABLE(esi,
811 AC_HELP_STRING([--enable-esi],
812 [Enable ESI for accelerators. Requires libexpat.
813 Enabling ESI will cause squid to follow the
814 Edge Acceleration Specification (www.esi.org).
815 This causes squid to IGNORE client Cache-Control headers.
816 DO NOT use this in a squid configured as a web proxy,
817 ONLY use it in a squid configured for webserver acceleration.]),
818 use_esi=$enableval, use_esi=no)
819if test "$use_esi" = "yes" ; then
820 AC_DEFINE(USE_SQUID_ESI,1,[Compile the ESI processor and Surrogate header support])
821 AM_CONDITIONAL(USE_ESI, true)
822
823 dnl Perform configuration consistency checks for ESI
824 dnl ESI support requires libexpat
825 AC_CHECK_LIB([expat], [main],
826 [ESI_LIBS="-lexpat"],
827 [AC_MSG_FAILURE([ESI support requires libexpat library, but no usable library was found])]
828 )
829 AC_CHECK_LIB([xml2], [main],
830 [ESI_LIBS="-lxml2"],
831 [AC_MSG_FAILURE([ESI support requires libxml2 library, but no usable library was found])]
832 )
833 XTRA_LIBS="$XTRA_LIBS -lexpat -lxml2"
834
835else
836 AC_DEFINE(USE_SQUID_ESI,0,[Compile the ESI processor and Surrogate header support])
837fi
838
839AM_CONDITIONAL(USE_ICAP_CLIENT, false)
840AC_ARG_ENABLE(icap-client,
841 AC_HELP_STRING([--enable-icap-client],[Enable the ICAP client.]),
842 use_icap_client=$enableval, use_icap_client=no)
843if test "$use_icap_client" = "yes" ; then
844 AC_DEFINE(ICAP_CLIENT,1,[Enable ICAP client features in Squid])
845 AM_CONDITIONAL(USE_ICAP_CLIENT, true)
846 ICAP_LIBS="icap/libicap.la"
847 use_adaptation=yes
848else
849 AC_DEFINE(ICAP_CLIENT,0,[Enable ICAP client features in Squid])
850 ICAP_LIBS=""
851fi
852AC_SUBST(ICAP_LIBS)
853
854use_ecap=1
855AC_MSG_CHECKING(whether to support eCAP)
856AC_ARG_ENABLE(ecap,
857 AC_HELP_STRING([--enable-ecap],
858 [support loadable content adaptation modules]),
859 [
860 case "${enableval}" in
861 yes) use_ecap=yes ;;
862 no) use_ecap=no ;;
863 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
864 esac
865 AC_MSG_RESULT([$use_ecap, explicitly])
866 ],
867 [
868 use_ecap=no;
869 AC_MSG_RESULT([$use_ecap, implicitly])
870 ]
871)
872
873dnl Perform configuration consistency checks for eCAP
874if test $use_ecap = yes;
875then
876 dnl eCAP support requires loadable modules, which are enabled by default
877 if test "$use_loadable_modules" != "yes"
878 then
879 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.]);
880 fi
881
882 dnl eCAP support requires libecap
883 AC_CHECK_LIB([ecap], [main],
884 [ECAP_LIBS="-lecap"],
885 [AC_MSG_FAILURE([eCAP support requires libecap library, but no usable library was found])]
886 )
887fi
888
889AM_CONDITIONAL(USE_ECAP, test $use_ecap = yes)
890if test $use_ecap = yes;
891then
892 AC_DEFINE(USE_ECAP,1,[Enable eCAP support])
893 ECAP_LIBS="ecap/libecap.la $ECAP_LIBS"
894 use_adaptation=yes
895else
896 AC_DEFINE(USE_ECAP,0,[Disable eCAP support])
897 ECAP_LIBS=""
898fi
899AC_SUBST(ECAP_LIBS)
900
901
902dnl enable adaptation if requested by specific adaptation mechanisms
903AM_CONDITIONAL(USE_ADAPTATION, test $use_adaptation = yes)
904if test $use_adaptation = yes
905then
906 AC_DEFINE(USE_ADAPTATION,1,[common adaptation support])
907 ADAPTATION_LIBS="adaptation/libadaptation.la"
908else
909 AC_DEFINE(USE_ADAPTATION,0,[common adaptation support])
910 ADAPTATION_LIBS=""
911fi
912AC_SUBST(ADAPTATION_LIBS)
913
914
915dnl This is a developer only option. Developers know how to set defines
916dnl
917dnl AC_ARG_ENABLE(mem-gen-trace,
918dnl [ --enable-mem-gen-trace Do trace of memory stuff],
919dnl [ if test "$enableval" = "yes" ; then
920dnl AC_MSG_NOTICE([Memory trace (to file) enabled])
921dnl AC_DEFINE(MEM_GEN_TRACE,1,[Define for log file trace of mem alloc/free])
922dnl fi
923dnl ])
924
925AC_ARG_ENABLE(useragent-log,
926 AC_HELP_STRING([--enable-useragent-log],
927 [Enable logging of User-Agent header]),
928[ if test "$enableval" = "yes" ; then
929 AC_MSG_NOTICE([User-Agent logging enabled])
930 AC_DEFINE(USE_USERAGENT_LOG,1,[If you want to log User-Agent request header values, define this.
931 By default, they are written to useragent.log in the Squid log
932 directory.])
933 fi
934])
935
936AC_ARG_ENABLE(referer-log,
937 AC_HELP_STRING([--enable-referer-log],[Enable logging of Referer header]),
938[ if test "$enableval" = "yes" ; then
939 AC_MSG_NOTICE([Referer logging enabled])
940 AC_DEFINE(USE_REFERER_LOG,1,[If you want to log Referer request header values, define this.
941 By default, they are written to referer.log in the Squid log
942 directory.])
943 fi
944])
945
946USE_WCCP=1
947AC_ARG_ENABLE(wccp,
948 AC_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]),
949[ if test "$enableval" = "no" ; then
950 AC_MSG_NOTICE([Web Cache Coordination Protocol disabled])
951 USE_WCCP=0
952 fi
953])
954if test $USE_WCCP = 1; then
955 AC_DEFINE(USE_WCCP, 1, [Define to enable WCCP])
956fi
957
958USE_WCCPv2=1
959AC_ARG_ENABLE(wccpv2,
960 AC_HELP_STRING([--disable-wccpv2],
961 [Disable Web Cache Coordination V2 Protocol]),
962[ if test "$enableval" = "no" ; then
963 AC_MSG_NOTICE(["Web Cache Coordination V2 Protocol disabled])
964 USE_WCCPv2=0
965 fi
966])
967if test $USE_WCCPv2 = 1; then
968 AC_DEFINE(USE_WCCPv2, 1, [Define to enable WCCP V2])
969fi
970
971AC_ARG_ENABLE(kill-parent-hack,
972 AC_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]),
973[ if test "$enableval" = "yes" ; then
974 AC_MSG_NOTICE([Kill parent on shutdown])
975 AC_DEFINE(KILL_PARENT_OPT,1,[A dangerous feature which causes Squid to kill its parent process
976 (presumably the RunCache script) upon receipt of SIGTERM or SIGINT.
977 Use with caution.])
978 fi
979])
980
981USE_SNMP=true
982AC_ARG_ENABLE(snmp,
983 AC_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]),
984[ if test "$enableval" = "no" ; then
985 AC_MSG_NOTICE([SNMP monitoring disabled])
986 USE_SNMP=
987 fi
988])
989if test x"$USE_SNMP" = xtrue; then
990 AC_DEFINE(SQUID_SNMP,1,[Define to enable SNMP monitoring of Squid])
991 SNMPLIB='../snmplib/libsnmp.a'
992 makesnmplib=snmplib
993fi
994AM_CONDITIONAL(USE_SNMP, [test x$USE_SNMP = xtrue])
995AC_SUBST(SNMPLIB)
996AC_SUBST(makesnmplib)
997
998AC_ARG_ENABLE(cachemgr-hostname,
999 AC_HELP_STRING([--enable-cachemgr-hostname=hostname],
1000 [Make cachemgr.cgi default to this host.
1001 If unspecified, uses the name of the build-host]),
1002[ case $enableval in
1003 yes)
1004 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1005 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
1006 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
1007 ;;
1008 no)
1009 : # Nothing to do..
1010 ;;
1011 *)
1012 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
1013 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
1014 ;;
1015 esac
1016])
1017
1018AM_CONDITIONAL(ENABLE_ARP_ACL, false)
1019AC_ARG_ENABLE(arp-acl,
1020 AC_HELP_STRING([--enable-arp-acl],
1021 [Enable use of ARP ACL lists (ether address)]),
1022[ if test "$enableval" = "yes" ; then
1023 AC_MSG_NOTICE([ARP ACL lists enabled (ether address)])
1024 case "$host" in
1025 *-linux-*)
1026 ;;
1027 *-solaris*)
1028 ;;
1029 *-freebsd*)
1030 ;;
1031 *-openbsd*)
1032 ;;
1033 *-netbsd*)
1034 ;;
1035 *-cygwin*)
1036 LIBS="$LIBS -liphlpapi"
1037 ;;
1038 *-mingw*)
1039 LIBS="$LIBS -liphlpapi"
1040 ;;
1041 *)
1042 AC_MSG_WARN([ARP ACL support probably won't work on $host.])
1043 sleep 10
1044 ;;
1045 esac
1046 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, ?).])
1047 AM_CONDITIONAL(ENABLE_ARP_ACL, true)
1048 fi
1049])
1050
1051USE_HTCP=true
1052AM_CONDITIONAL(ENABLE_HTCP, false)
1053AC_ARG_ENABLE(htcp,
1054 AC_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]),
1055[ if test "$enableval" = "no" ; then
1056 AC_MSG_NOTICE([HTCP support disabled])
1057 fi
1058])
1059if test x$USE_HTCP = xtrue; then
1060 AC_DEFINE(USE_HTCP,1, [Define this to include code for the Hypertext Cache Protocol (HTCP)])
1061fi
1062AM_CONDITIONAL(ENABLE_HTCP, [test x$USE_HTCP = xtrue])
1063
1064dnl SSL is not enabled by default.
1065AM_CONDITIONAL(ENABLE_SSL, false)
1066
1067dnl Default is to use OpenSSL when available
1068AC_ARG_ENABLE(ssl,
1069 AC_HELP_STRING([--enable-ssl],[Enable ssl gatewaying support using OpenSSL]),
1070[ if test "$enableval" != "no"; then
1071 AC_MSG_NOTICE([SSL gatewaying using OpenSSL enabled])
1072 AC_DEFINE(USE_SSL,1,[Define this to include code for SSL encryption.])
1073 AM_CONDITIONAL(ENABLE_SSL, true)
1074 case "$host_os" in
1075 mingw|mingw32)
1076 dnl Native Windows port of OpenSSL needs -lgdi32
1077 SSLLIB='-lssleay32 -leay32 -lgdi32'
1078 ;;
1079 *)
1080 SSLLIB='-lssl -lcrypto'
1081 ;;
1082 esac
1083 USE_OPENSSL=1
1084 fi
1085])
1086
1087dnl User may specify OpenSSL is needed from a non-standard location
1088AC_ARG_WITH(openssl,
1089 AC_HELP_STRING([--with-openssl{=PATH}],
1090 [Compile with the OpenSSL libraries. The path to
1091 the OpenSSL development libraries and headers
1092 installation can be specified if outside of the
1093 system standard directories]),
1094[
1095 case "$with_openssl" in
1096 yes)
1097 USE_OPENSSL=1
1098 ;;
1099 no)
1100 USE_OPENSSL=
1101 ;;
1102 *)
1103 SSLLIBDIR="$with_openssl/lib"
1104 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1105 USE_OPENSSL=1
1106 esac
1107])
1108if test -n "$USE_OPENSSL"; then
1109 AC_MSG_NOTICE([Using OpenSSL MD5 implementation])
1110 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)])
1111 if test -z "$SSLLIB"; then
1112 SSLLIB="-lcrypto" # for MD5 routines
1113 fi
1114 dnl This is a workaround for RedHat 9 brain damage..
1115 if test -d /usr/kerberos/include && test -z "$SSLLIBDIR" && test -f /usr/include/openssl/kssl.h; then
1116 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
1117 SSLLIBDIR="/usr/kerberos/lib"
1118 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1119 fi
1120fi
1121if test -n "$SSLLIBDIR"; then
1122 SSLLIB="-L$SSLLIBDIR $SSLLIB"
1123fi
1124AC_SUBST(SSLLIB)
1125
1126
1127AC_ARG_ENABLE(forw-via-db,
1128 AC_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]),
1129[ if test "$enableval" = "yes" ; then
1130 AC_MSG_NOTICE([FORW-VIA enabled])
1131 AC_DEFINE(FORW_VIA_DB,1,[Enable Forw/Via database])
1132 fi
1133])
1134
1135AC_ARG_ENABLE(cache-digests,
1136 AC_HELP_STRING([--enable-cache-digests],
1137 [Use Cache Digests.
1138 See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
1139[ if test "$enableval" = "yes" ; then
1140 AC_MSG_NOTICE([Cache Disgests enabled])
1141 AC_DEFINE(USE_CACHE_DIGESTS,1,[Use Cache Digests for locating objects in neighbor caches. This code is still semi-experimental.])
1142 fi
1143])
1144
1145dnl Size of COSS memory buffer
1146AC_ARG_WITH(coss-membuf-size,
1147 AC_HELP_STRING([--with-coss-membuf-size=size],
1148 [COSS membuf size (default 1048576 bytes)]),
1149[ if test -n "$withval" -a "x$withval" != "xno" ; then
1150 AC_MSG_NOTICE([Setting COSS membuf size to $with_coss_membuf_size bytes])
1151 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $with_coss_membuf_size,[Define if you want to set the COSS membuf size])
1152 fi
1153])
1154
1155dnl check for netio plugin stuff
1156
1157dnl Enable poll()
1158disable_poll=
1159AC_ARG_ENABLE(poll,
1160 AC_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
1161[
1162 case "$enableval" in
1163 yes)
1164 AC_MSG_WARN([Forcing poll() to be enabled])
1165 SELECT_TYPE="poll"
1166 ;;
1167 no)
1168 AC_MSG_WARN([Forcing poll() to be disabled])
1169 disable_poll=true
1170 ;;
1171 esac
1172])
1173
1174dnl Enable select()
1175disable_select=
1176AC_ARG_ENABLE(select,
1177 AC_HELP_STRING([--disable-select],[Disable select(2) support.]),
1178[
1179 case "$enableval" in
1180 yes)
1181 AC_MSG_WARN([Forcing select() to be enabled])
1182 SELECT_TYPE="select"
1183 ;;
1184 no)
1185 AC_MSG_WARN([Forcing select() to be disabled])
1186 disable_select=true
1187 ;;
1188 esac
1189])
1190
1191dnl Enable kqueue()
1192dnl kqueue support is still experiemntal and unstable. Not enabled by default.
1193disable_kqueue=true
1194AC_ARG_ENABLE(kqueue,
1195 AC_HELP_STRING([--enable-kqueue],[Enable kqueue(2) support (experimental).]),
1196[
1197 case "$enableval" in
1198 yes)
1199 AC_MSG_WARN([Forcing kqueue() to be enabled])
1200 SELECT_TYPE="kqueue"
1201 AC_CHECK_HEADERS([sys/event.h],[],
1202 [ AC_MSG_ERROR([kqueue support requires sys/event.h header file.]) ])
1203 ;;
1204 no)
1205 AC_MSG_WARN([Forcing kqueue() to be disabled])
1206 disable_kqueue=true
1207 ;;
1208 *)
1209 AC_CHECK_HEADERS([sys/event.h])
1210 ;;
1211esac
1212])
1213
1214dnl Enable epoll()
1215disable_epoll=
1216force_epoll="no"
1217AC_ARG_ENABLE(epoll,
1218 AC_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
1219[
1220 case "$enableval" in
1221 yes)
1222 AC_MSG_WARN([Forcing epoll() to be enabled])
1223 SELECT_TYPE="epoll"
1224 force_epoll="yes"
1225 ;;
1226 no)
1227 AC_MSG_WARN([Forcing epoll() to be disabled])
1228 disable_epoll=true
1229 ;;
1230esac
1231])
1232dnl auto-detect and verify epoll header and library present and working
1233if test -z "$disable_epoll"; then
1234
1235 # Check for libepoll
1236 EPOLL_LIB=
1237 AC_CHECK_LIB(epoll, epoll_ctl, [EPOLL_LIBS="-lepoll"])
1238 AC_SUBST(EPOLL_LIBS)
1239
1240 dnl on some systems it is provided by libc
1241 dnl not to worry, the working test below will catch them
1242 dnl and we don't want to force additional libraries
1243
1244
1245 # Check for epoll_ctl, may need -lepoll
1246 SAVED_LIBS="$LIBS"
1247 LIBS="$LIBS $EPOLL_LIBS"
1248 AC_CHECK_FUNCS(epoll_ctl)
1249 LIBS="$SAVED_LIBS"
1250
1251 dnl epoll requires sys/epoll.h
1252 AC_CHECK_HEADERS([sys/epoll.h])
1253
1254 dnl Verify that epoll really works
1255 if test $ac_cv_func_epoll_ctl = yes; then
1256 AC_CACHE_CHECK(if epoll works, ac_cv_epoll_works,
1257 AC_TRY_RUN([
1258#include <sys/epoll.h>
1259#include <stdlib.h>
1260#include <stdio.h>
1261int main(int argc, char **argv)
1262{
1263 int fd = epoll_create(256);
1264 if (fd < 0) {
1265 perror("epoll_create:");
1266 exit(1);
1267 }
1268 exit(0);
1269}
1270 ], [ac_cv_epoll_works=yes], [ac_cv_epoll_works=no]))
1271 fi
1272
1273 if test "$force_epoll" = "yes" && test "$ac_cv_epoll_works" = "no" ; then
1274 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
1275 fi
1276fi
1277
1278dnl Disable HTTP violations
1279http_violations=1
1280AC_ARG_ENABLE(http-violations,
1281 AC_HELP_STRING([--disable-http-violations],
1282 [This allows you to remove code which is known to
1283 violate the HTTP protocol specification.]),
1284[ if test "$enableval" = "no" ; then
1285 AC_MSG_NOTICE([Disabling HTTP Violations])
1286 http_violations=0
1287 fi
1288])
1289if test $http_violations = 1; then
1290 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.])
1291else
1292 AC_DEFINE(HTTP_VIOLATIONS, 0)
1293fi
1294
1295dnl Enable IPFW Transparent Proxy
1296AC_ARG_ENABLE(ipfw-transparent,
1297 AC_HELP_STRING([--enable-ipfw-transparent],
1298 [Enable Transparent Proxy support for systems
1299 using FreeBSD IPFW style redirection.]),
1300[ if test "$enableval" = "yes" ; then
1301 AC_MSG_NOTICE([IPFW Transparent Proxy enabled])
1302 AC_DEFINE(IPFW_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using FreeBSD IPFW address redirection.])
1303 IPFW_TRANSPARENT="yes"
1304 else
1305 AC_DEFINE(IPFW_TRANSPARENT,0,[Enable support for Transparent Proxy on systems using FreeBSD IPFW address redirection.])
1306 fi
1307])
1308
1309dnl Enable IP-Filter Transparent Proxy
1310AC_ARG_ENABLE(ipf-transparent,
1311 AC_HELP_STRING([--enable-ipf-transparent],
1312 [Enable Transparent Proxy support for systems
1313 using IP-Filter network address redirection.]),
1314[ if test "$enableval" = "yes" ; then
1315 AC_MSG_NOTICE([IP-Filter Transparent Proxy enabled])
1316 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.])
1317 IPF_TRANSPARENT="yes"
1318 else
1319 AC_DEFINE(IPF_TRANSPARENT,0,[Enable support for Transparent Proxy on systems using IP-Filter address redirection. This provides "masquerading" support for non Linux system.])
1320 fi
1321])
1322
1323dnl Enable PF Transparent Proxy
1324AC_ARG_ENABLE(pf-transparent,
1325 AC_HELP_STRING([--enable-pf-transparent],
1326 [Enable Transparent Proxy support for systems
1327 using PF network address redirection.]),
1328[ if test "$enableval" = "yes" ; then
1329 AC_MSG_NOTICE([PF Transparent Proxy enabled])
1330 AC_DEFINE(PF_TRANSPARENT,1,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
1331 PF_TRANSPARENT="yes"
1332 else
1333 AC_DEFINE(PF_TRANSPARENT,0,[Enable support for Transparent Proxy on systems using PF address redirection. This provides "masquerading" support for OpenBSD.])
1334 fi
1335])
1336
1337dnl Enable Linux Netfilter Transparent Proxy
1338AC_ARG_ENABLE(linux-netfilter,
1339 AC_HELP_STRING([--enable-linux-netfilter],
1340 [Enable Transparent Proxy support for Linux (Netfilter)]),
1341[ if test "$enableval" = "yes" ; then
1342 AC_MSG_NOTICE([Linux (Netfilter) Transparent Proxy enabled])
1343 AC_DEFINE(LINUX_NETFILTER,1,[Enable support for Transparent Proxy on Linux (Netfilter) systems])
1344 LINUX_NETFILTER="yes"
1345 else
1346 AC_DEFINE(LINUX_NETFILTER,0,[Enable support for Transparent Proxy on Linux (Netfilter) systems])
1347 fi
1348])
1349
1350dnl Enable Large file support
1351buildmodel=""
1352needlargefiles=
1353
1354AC_ARG_WITH(large-files,
1355 AC_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]),
1356[ if test "x$withval" = "xyes"; then
1357 needlargefiles=1
1358 fi
1359])
1360
1361dnl UNIX Build environment
1362dnl AC_HELP_STRING is not suited here because it doesn't allow to specify newlines
1363AC_ARG_WITH(build-environment,
1364[ --with-build-environment=model
1365 The build environment to use. Normally one of
1366 POSIX_V6_ILP32_OFF32 32 bits
1367 POSIX_V6_ILP32_OFFBIG 32 bits with large file support
1368 POSIX_V6_LP64_OFF64 64 bits
1369 POSIX_V6_LPBIG_OFFBIG large pointers and files
1370 XBS5_ILP32_OFF32 32 bits (legacy)
1371 XBS5_ILP32_OFFBIG 32 bits with large file support (legacy)
1372 XBS5_LP64_OFF64 64 bits (legacy)
1373 XBS5_LPBIG_OFFBIG large pointers and files (legacy)
1374 default The default for your OS],
1375[ case "$withval" in
1376 yes|no)
1377 AC_MSG_FAILURE(["--with-build-environment expects a build environment string as used by getconf])
1378 ;;
1379 *)
1380 buildmodel="$withval"
1381 ;;
1382 esac
1383])
1384
1385if test $needlargefiles && test -z "$buildmodel"; then
1386 for model in POSIX_V6_LPBIG_OFFBIG XBS5_LPBIG_OFFBIG POSIX_V6_LP64_OFF64 XBS5_LP64_OFF64 POSIX_V6_ILP32_OFFBIG XBS5_ILP32_OFFBIG; do
1387 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
1388 buildmodel=$model
1389 break
1390 fi
1391 done
1392 if test -z "$buildmodel"; then
1393 AC_MSG_WARN(["No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
1394 sleep 1
1395 fi
1396fi
1397case "$buildmodel" in
1398default|"")
1399 if test "$needlargefiles"; then
1400 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
1401 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
1402 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
1403 fi
1404 ;;
1405*)
1406 AC_MSG_NOTICE([Using $buildmodel build environment])
1407 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
1408 : # All fine
1409 else
1410 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
1411 fi
1412 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
1413 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
1414 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
1415 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
1416 case "$host" in
1417dnl
1418dnl On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
1419dnl for LDFLAGS -xarch=generic64, but:
1420dnl "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
1421dnl For gcc "-xarch=generic64" must be replaced with "-m64"
1422dnl The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
1423 *-solaris*)
1424 if test "$GCC" = "yes"; then
1425 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
1426 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
1427 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
1428 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
1429 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1430 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
1431 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
1432 fi
1433 AC_MSG_NOTICE([Removing -Usun on $host])
1434 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
1435 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
1436 ;;
1437dnl
1438dnl On Irix 6.x getconf returns options valid only for the SGI MipsPRO compiler,
1439dnl so we must adjust something to avoid gcc errors.
1440dnl On Irix 6.x 32/64 bit we must replace "-n32" with "-mabi=n32" in CFLAGS and
1441dnl remove "-n32" from LDFLAGS
1442dnl On Irix 6.x 64 bit we must replace "-64" with "-mabi=64" in CFLAGS and remove
1443dnl "-64" from LDFLAGS
1444 *-sgi-irix6.*)
1445 if test "$GCC" = "yes"; then
1446 CFLAGS="`echo $CFLAGS | sed -e 's/-n32/-mabi=n32/'`"
1447 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-n32/-mabi=n32/'`"
1448 LDFLAGS="`echo $LDFLAGS | sed -e 's/-n32//'`"
1449 CFLAGS="`echo $CFLAGS | sed -e 's/-64/-mabi=64/'`"
1450 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-64/-mabi=64/'`"
1451 LDFLAGS="`echo $LDFLAGS | sed -e 's/-64//'`"
1452 fi
1453 ;;
1454 *)
1455 ;;
1456 esac
1457 ;;
1458esac
1459
1460dnl Enable Linux transparent proxy support for obsolete TPROXY
1461AC_ARG_ENABLE(linux-tproxy,
1462 AC_HELP_STRING([--enable-linux-tproxy],
1463 [Enable real Transparent Proxy support for Netfilter TPROXY
1464 (version 2).]),
1465[ if test "$enableval" = "yes" ; then
1466 AC_MSG_NOTICE(["Linux Netfilter/TPROXY v2 enabled])
1467 AC_DEFINE(LINUX_TPROXY2, 1, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
1468 LINUX_TPROXY2="yes"
1469 if test -z "$LINUX_NETFILTER"; then
1470 AC_MSG_NOTICE([Linux-Netfilter Transparent Proxy automatically enabled])
1471 LINUX_NETFILTER="yes"
1472 fi
1473 else
1474 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
1475 fi
1476])
1477
1478AM_CONDITIONAL(MAKE_LEAKFINDER, false)
1479dnl Enable Leak Finding Functions
1480AC_ARG_ENABLE(leakfinder,
1481 AC_HELP_STRING([--enable-leakfinder],
1482 [Enable Leak Finding code. Enabling this alone
1483 does nothing; you also have to modify the source
1484 code to use the leak finding functions. Probably
1485 Useful for hackers only.]),
1486[ if test "$enableval" = "yes" ; then
1487 AC_MSG_NOTICE([Leak-Finding enabled])
1488 AC_DEFINE(USE_LEAKFINDER,1,[Enable code for assisting in finding memory leaks. Hacker stuff only.])
1489 USE_LEAKFINDER="yes"
1490 AM_CONDITIONAL(MAKE_LEAKFINDER, true)
1491 fi
1492])
1493
1494follow_xff=1
1495AC_ARG_ENABLE(follow-x-forwarded-for,
1496 AC_HELP_STRING([--enable-follow-x-forwarded-for],
1497 [Enable support for following the X-Forwarded-For
1498 HTTP header to try to find the IP address of the
1499 original or indirect client when a request has
1500 been forwarded through other proxies.]),
1501[ if test "$enableval" = "yes" ; then
1502 AC_MSG_NOTICE([follow X-Forwarded-For enabled])
1503 follow_xff=1
1504 fi
1505])
1506if test $follow_xff = 1; then
1507 AC_DEFINE(FOLLOW_X_FORWARDED_FOR, 1, [Enable following X-Forwarded-For headers])
1508else
1509 AC_DEFINE(FOLLOW_X_FORWARDED_FOR, 0)
1510fi
1511
1512use_ident=1
1513AC_ARG_ENABLE(ident-lookups,
1514 AC_HELP_STRING([--disable-ident-lookups],
1515 [This allows you to remove code that performs Ident (RFC 931) lookups.]),
1516[ if test "$enableval" = "no" ; then
1517 AC_MSG_NOTICE([Disabling Ident Lookups])
1518 use_ident=0
1519 fi
1520])
1521if test $use_ident = 1; then
1522 AC_DEFINE(USE_IDENT, 1,[Compile in support for Ident (RFC 931) lookups? Enabled by default.])
1523 AM_CONDITIONAL(ENABLE_IDENT, true)
1524else
1525 AC_DEFINE(USE_IDENT, 0)
1526 AM_CONDITIONAL(ENABLE_IDENT, false)
1527fi
1528
1529AM_CONDITIONAL(USE_DNSSERVER, false)
1530use_dnsserver=
1531AC_ARG_ENABLE(internal-dns,
1532 AC_HELP_STRING([--disable-internal-dns],
1533 [Prevents Squid from directly sending and receiving DNS messages,
1534 and instead enables the old external 'dnsserver' processes.]),
1535[ if test "$enableval" = "no" ; then
1536 AC_MSG_WARN([Disabling Internal DNS queries])
1537 use_dnsserver="yes"
1538 fi
1539])
1540if test "$use_dnsserver" = "yes"; then
1541 AC_DEFINE(USE_DNSSERVERS,1,[Use dnsserver processes instead of the internal DNS protocol support])
1542 AM_CONDITIONAL(USE_DNSSERVER, true)
1543fi
1544
1545dnl Select Default hosts file location
1546AC_ARG_ENABLE(default-hostsfile,
1547 AC_HELP_STRING([--enable-default-hostsfile=path],
1548 [Select default location for hosts file.
1549 See hosts_file directive in squid.conf for details]),
1550[
1551 if test "$enableval" != "none" ; then
1552 if test -f $enableval; then
1553 OPT_DEFAULT_HOSTS=$enableval
1554 else
1555 AC_MSG_WARN([Unable to find $enableval])
1556 sleep 5
1557 fi
1558 else
1559 OPT_DEFAULT_HOSTS="none"
1560 fi
1561 AC_MSG_NOTICE([Default hosts file set to: $enableval])
1562],[OPT_DEFAULT_HOSTS="/etc/hosts"])
1563AC_SUBST(OPT_DEFAULT_HOSTS)
1564
1565dnl Select auth schemes modules to build
1566AC_ARG_ENABLE(auth,
1567 AC_HELP_STRING([--enable-auth="list of auth scheme modules"],
1568 [Build support for the list of authentication schemes.
1569 The default is to build support for the Basic scheme.
1570 See src/auth for a list of available modules, or
1571 Programmers Guide section authentication schemes
1572 for details on how to build your custom auth scheme
1573 module]),
1574[ case $enableval in
1575 yes)
1576 for dir in $srcdir/src/auth/*; do
1577 module="`basename $dir`"
1578 if test -d "$dir" && test "$module" != CVS; then
1579 AUTH_MODULES="$AUTH_MODULES $module"
1580 fi
1581 done
1582 ;;
1583 no)
1584 ;;
1585 *)
1586 AUTH_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1587 ;;
1588 esac
1589],
1590[ if test -z "$AUTH_MODULES"; then
1591 AUTH_MODULES="ntlm basic digest negotiate"
1592 fi
1593])
1594if test -n "$AUTH_MODULES"; then
1595 for module in $AUTH_MODULES; do
1596 if test -d $srcdir/src/auth/$module; then
1597 :
1598 else
1599 AC_MSG_ERROR(Auth scheme $module does not exist)
1600 fi
1601 eval AUTH_MODULE_${module}=yes
1602 done
1603 AC_MSG_NOTICE([Auth scheme modules built: $AUTH_MODULES])
1604else
1605 AC_MSG_WARN([Auth scheme modules built: None])
1606fi
1607dnl Authentication libraries to build
1608dnl This list will not be needed when each auth library has its own Makefile
1609AUTH_LIBS_TO_BUILD=
1610for module in $AUTH_MODULES; do
1611 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD lib${module}.la"
1612done
1613AC_SUBST(AUTH_MODULES)
1614AC_SUBST(AUTH_LIBS_TO_BUILD)
1615
1616dnl bundled auth modules, in order to have handy defines for the cppunit testsuite
1617test -n "$AUTH_MODULE_basic" && AC_DEFINE([HAVE_AUTH_MODULE_BASIC],1,[Basic auth module is built])
1618test -n "$AUTH_MODULE_digest" && AC_DEFINE([HAVE_AUTH_MODULE_DIGEST],1,[Digest auth module is built])
1619test -n "$AUTH_MODULE_ntlm" && AC_DEFINE([HAVE_AUTH_MODULE_NTLM],1,[NTLM auth module is built])
1620test -n "$AUTH_MODULE_negotiate" && AC_DEFINE([HAVE_AUTH_MODULE_NEGOTIATE],1,[Negotiate auth module is built])
1621
1622dnl Select basic auth scheme helpers to build
1623if test -n "$AUTH_MODULE_basic"; then
1624 BASIC_AUTH_HELPERS="all"
1625fi
1626AC_ARG_ENABLE(basic-auth-helpers,
1627 AC_HELP_STRING([--enable-basic-auth-helpers="list of helpers"],
1628 [This option selects which basic scheme proxy_auth
1629 helpers to build and install as part of the normal
1630 build process. For a list of available
1631 helpers see the helpers/basic_auth directory.]),
1632[ case "$enableval" in
1633 yes)
1634 BASIC_AUTH_HELPERS="all"
1635 ;;
1636 no)
1637 BASIC_AUTH_HELPERS=""
1638 ;;
1639 *)
1640 if test -z "$AUTH_MODULE_basic"; then
1641 AC_MSG_WARN([Basic auth helpers selected without the basic scheme enabled])
1642 sleep 15
1643 fi
1644 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1645 ;;
1646 esac
1647])
1648if test "$BASIC_AUTH_HELPERS" = "all" ; then
1649 BASIC_AUTH_HELPERS=""
1650 for dir in $srcdir/helpers/basic_auth/*; do
1651 helper="`basename $dir`"
1652 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1653 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS $helper"
1654 fi
1655 done
1656fi
1657if test -n "$BASIC_AUTH_HELPERS"; then
1658 for helper in $BASIC_AUTH_HELPERS; do
1659 if test -d $srcdir/helpers/basic_auth/$helper; then
1660 case $helper in
1661 SASL)
1662 require_sasl=yes
1663 ;;
1664 esac
1665 else
1666 AC_MSG_ERROR(Basic auth helper $helper does not exist)
1667 fi
1668 done
1669 AC_MSG_NOTICE([Basic auth helpers built: $BASIC_AUTH_HELPERS])
1670fi
1671AC_SUBST(BASIC_AUTH_HELPERS)
1672
1673dnl Select ntlm auth helpers to build
1674if test -n "$AUTH_MODULE_ntlm"; then
1675 NTLM_AUTH_HELPERS="all"
1676fi
1677AC_ARG_ENABLE(ntlm-auth-helpers,
1678 AC_HELP_STRING([--enable-ntlm-auth-helpers="list of helpers"],
1679 [This option selects which proxy_auth ntlm helpers
1680 to build and install as part of the normal build
1681 process. For a list of available helpers see
1682 the helpers/ntlm_auth directory.]),
1683[ case "$enableval" in
1684 yes)
1685 NTLM_AUTH_HELPERS="all"
1686 ;;
1687 no)
1688 NTLM_AUTH_HELPERS=""
1689 ;;
1690 *)
1691 NTLM_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1692 ;;
1693 esac
1694])
1695if test "$NTLM_AUTH_HELPERS" = "all" ; then
1696 NTLM_AUTH_HELPERS=""
1697 for dir in $srcdir/helpers/ntlm_auth/*; do
1698 helper="`basename $dir`"
1699 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1700 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS $helper"
1701 fi
1702 done
1703fi
1704if test -n "$NTLM_AUTH_HELPERS"; then
1705 for helper in $NTLM_AUTH_HELPERS; do
1706 if test -d $srcdir/helpers/ntlm_auth/$helper; then
1707 :
1708 else
1709 AC_MSG_ERROR(NTLM Auth helper $helper does not exist)
1710 fi
1711 done
1712 AC_MSG_NOTICE([NTLM auth helpers built: $NTLM_AUTH_HELPERS])
1713fi
1714AC_SUBST(NTLM_AUTH_HELPERS)
1715
1716dnl Select negotiate auth helpers to build
1717if test -n "$AUTH_MODULE_negotiate"; then
1718 NEGOTIATE_AUTH_HELPERS="all"
1719fi
1720AC_ARG_ENABLE(negotiate-auth-helpers,
1721 AC_HELP_STRING([--enable-negotiate-auth-helpers="list of helpers"],
1722 [This option selects which proxy_auth negotiate helpers
1723 to build and install as part of the normal build
1724 process. For a list of available helpers see
1725 the helpers/negotiate_auth directory.]),
1726[ case "$enableval" in
1727 yes)
1728 NEGOTIATE_AUTH_HELPERS="all"
1729 ;;
1730 no)
1731 NEGOTIATE_AUTH_HELPERS=""
1732 ;;
1733 *)
1734 NEGOTIATE_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1735 ;;
1736 esac
1737])
1738if test "$NEGOTIATE_AUTH_HELPERS" = "all" ; then
1739 NEGOTIATE_AUTH_HELPERS=""
1740 for dir in $srcdir/helpers/negotiate_auth/*; do
1741 helper="`basename $dir`"
1742 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1743 NEGOTIATE_AUTH_HELPERS="$NEGOTIATE_AUTH_HELPERS $helper"
1744 fi
1745 done
1746fi
1747if test -n "$NEGOTIATE_AUTH_HELPERS"; then
1748 for helper in $NEGOTIATE_AUTH_HELPERS; do
1749 if test -d $srcdir/helpers/negotiate_auth/$helper; then
1750 :
1751 else
1752 AC_MSG_ERROR(Negotiate Auth helper $helper does not exist)
1753 fi
1754 done
1755 AC_MSG_NOTICE([Negotiate auth helpers built: $NEGOTIATE_AUTH_HELPERS])
1756fi
1757AC_SUBST(NEGOTIATE_AUTH_HELPERS)
1758AC_CONFIG_SUBDIRS(helpers/negotiate_auth/squid_kerb_auth)
1759
1760dnl Select digest auth scheme helpers to build
1761if test -n "$AUTH_MODULE_digest"; then
1762 DIGEST_AUTH_HELPERS=all
1763fi
1764AC_ARG_ENABLE(digest-auth-helpers,
1765 AC_HELP_STRING([--enable-digest-auth-helpers="list of helpers"],
1766 [This option selects which digest scheme authentication
1767 helpers to build and install as part of the normal build
1768 process. For a list of available helpers see the
1769 helpers/digest_auth directory.]),
1770[ case "$enableval" in
1771 yes)
1772 DIGEST_AUTH_HELPERS="all"
1773 ;;
1774 no)
1775 DIGEST_AUTH_HELPERS=""
1776 ;;
1777 *)
1778 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1779 ;;
1780 esac
1781])
1782if test "$DIGEST_AUTH_HELPERS" = "all" ; then
1783 DIGEST_AUTH_HELPERS=""
1784 for dir in $srcdir/helpers/digest_auth/*; do
1785 helper="`basename $dir`"
1786 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1787 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS $helper"
1788 fi
1789 done
1790fi
1791if test -n "$DIGEST_AUTH_HELPERS"; then
1792 for helper in $DIGEST_AUTH_HELPERS; do
1793 if test -f $srcdir/helpers/digest_auth/$helper/Makefile.in; then
1794 :
1795 else
1796 AC_MSG_ERROR(digest auth helper $helper does not exist)
1797 fi
1798 done
1799 AC_MSG_NOTICE([Digest auth helpers built: $DIGEST_AUTH_HELPERS])
1800fi
1801AC_SUBST(DIGEST_AUTH_HELPERS)
1802
1803dnl Enable "NTLM fail open"
1804AC_ARG_ENABLE(ntlm-fail-open,
1805 AC_HELP_STRING([--enable-ntlm-fail-open],
1806 [Enable NTLM fail open, where a helper that fails one of the
1807 Authentication steps can allow squid to still authenticate
1808 the user.]),
1809[ if test "$enableval" = "yes" ; then
1810 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.])
1811 fi
1812])
1813
1814dnl Select external_acl helpers to build
1815EXTERNAL_ACL_HELPERS=all
1816AC_ARG_ENABLE(external-acl-helpers,
1817 AC_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
1818 [This option selects which external_acl helpers to
1819 build and install as part of the normal build
1820 process. For a list of available helpers see the
1821 helpers/external_acl directory.]),
1822[ case "$enableval" in
1823 yes)
1824 EXTERNAL_ACL_HELPERS=all
1825 ;;
1826 no)
1827 EXTERNAL_ACL_HELPERS=""
1828 ;;
1829 *)
1830 EXTERNAL_ACL_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
1831 ;;
1832 esac
1833])
1834if test "$EXTERNAL_ACL_HELPERS" = "all" ; then
1835 EXTERNAL_ACL_HELPERS=""
1836 for dir in $srcdir/helpers/external_acl/*; do
1837 helper="`basename $dir`"
1838 if test -f $dir/config.test && sh $dir/config.test "$@"; then
1839 EXTERNAL_ACL_HELPERS="$EXTERNAL_ACL_HELPERS $helper"
1840 fi
1841 done
1842fi
1843if test -n "$EXTERNAL_ACL_HELPERS"; then
1844 for helper in $EXTERNAL_ACL_HELPERS; do
1845 if test -f $srcdir/helpers/external_acl/$helper/Makefile.in; then
1846 :
1847 else
1848 AC_MSG_ERROR(external acl helper $helper does not exist)
1849 fi
1850 done
1851 AC_MSG_NOTICE([External acl helpers built: $EXTERNAL_ACL_HELPERS])
1852fi
1853AC_SUBST(EXTERNAL_ACL_HELPERS)
1854
1855AC_ARG_WITH(valgrind-debug,
1856 AC_HELP_STRING([--with-valgrind-debug],
1857 [Include debug instrumentation for use with valgrind]),
1858[ case $withval in
1859 yes)
1860 valgrind=1
1861 ;;
1862 no)
1863 valgrind=
1864 ;;
1865 *)
1866 CPPFLAGS="$CPPFLAGS -I${enableval}/include"
1867 valgrind=1
1868 ;;
1869 esac
1870 if test $valgrind; then
1871 AC_CHECK_HEADERS(valgrind/memcheck.h,
1872 [ AC_DEFINE(WITH_VALGRIND, 1, [Valgrind memory debugger support])
1873 AC_MSG_NOTICE([Valgrind debug support enabled]) ],
1874 [ AC_MSG_WARN([Valgrind header not found. Valgrind support disabled.]) ]
1875 )
1876 fi
1877])
1878
1879dnl Disable "memPools" code
1880AC_ARG_ENABLE(mempools,
1881 AC_HELP_STRING([--disable-mempools],
1882 [Disable memPools. Note that this option now simply sets the
1883 default behaviour. Specific classes can override this at runtime, and
1884 only lib/MemPool.c needs to be altered to change the squid-wide
1885 default for all classes.]),
1886[ if test "$enableval" = "no" ; then
1887 AC_MSG_NOTICE([memPools disabled])
1888 AC_DEFINE(DISABLE_POOLS, 1, [Define if you have problems with memPools and want to disable Pools])
1889 else
1890 AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
1891 fi
1892],
1893[ AC_DEFINE(DISABLE_POOLS, 0, [Define if you have problems with memPools and want to disable Pools.])
1894])
1895
1896dnl Enable WIN32 Service compile mode
1897AC_ARG_ENABLE(win32-service,
1898 AC_HELP_STRING([--enable-win32-service],
1899 [Compile Squid as a WIN32 Service.
1900 Works only on MS-Windows platforms (NT and up).]),
1901[ if test "$enableval" = "yes" ; then
1902 AC_MSG_NOTICE([Enabling WIN32 run service mode])
1903 AC_DEFINE(USE_WIN32_SERVICE,1,[Define Windows NT & Windows 2000 run service mode])
1904 fi
1905])
1906
1907
1908dnl Check for Cyrus SASL
1909if test "$require_sasl" = "yes"; then
1910 AC_CHECK_HEADERS(sasl/sasl.h sasl.h)
1911 if test "$ac_cv_header_sasl_sasl_h" = "yes"; then
1912 AC_MSG_NOTICE([using SASL2])
1913 LIBSASL="-lsasl2"
1914 else
1915 if test "$ac_cv_header_sasl_h" = "yes"; then
1916 AC_MSG_NOTICE([using SASL])
1917 LIBSASL="-lsasl"
1918 else
1919 AC_MSG_ERROR(Neither SASL nor SASL2 found)
1920 fi
1921 fi
1922 AC_SUBST(LIBSASL)
1923fi
1924
1925dnl Disable "unlinkd" code
1926AC_ARG_ENABLE(unlinkd,
1927 AC_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]),
1928[ if test "$enableval" = "no" ; then
1929 use_unlinkd=no
1930 else
1931 use_unlinkd=yes
1932 fi
1933],[
1934 # Here we should probably use some magic depending on the selected
1935 # storage models
1936 use_unlinkd=yes
1937])
1938if test "$use_unlinkd" = "yes"; then
1939 AC_MSG_NOTICE([unlinkd enabled])
1940 AC_DEFINE(USE_UNLINKD,1,[Define this if unlinkd is required (strongly recommended for ufs storage type)])
1941 AM_CONDITIONAL(ENABLE_UNLINKD, true)
1942else
1943 AC_MSG_NOTICE([unlinkd disabled])
1944 AM_CONDITIONAL(ENABLE_UNLINKD, false)
1945fi
1946
1947dnl Enable backtraces on fatal errors
1948AC_ARG_ENABLE(stacktraces,
1949 AC_HELP_STRING([--enable-stacktraces],
1950 [Enable automatic call backtrace on fatal errors]),
1951[ if test "$enableval" = "yes" ; then
1952 AC_MSG_NOTICE([Enabling automatic stack backtraces on fatal errors])
1953 AC_DEFINE(PRINT_STACK_TRACE, 1,[Print stacktraces on fatal errors])
1954 fi
1955])
1956
1957AM_CONDITIONAL(ENABLE_XPROF_STATS, false)
1958dnl Enable USE_XPROF_STATS
1959AC_ARG_ENABLE(cpu-profiling,
1960 AC_HELP_STRING([--enable-cpu-profiling],
1961 [Enable instrumentation to try and understand how CPU power
1962 is spent by squid, by enabling specific probes in selected
1963 functions. New probes can only be added by modifying the source code.
1964 It is meant to help developers in optimizing performance
1965 of Squid internal functions.
1966 If you are not developer you shouldn't enable this,
1967 as it slows squid down somewhat. See lib/Profiler.c for more details.]),
1968[ if test "$enableval" = "yes" ; then
1969 AC_MSG_NOTICE([Enabling cpu-profiling])
1970 AC_DEFINE(USE_XPROF_STATS, 1,[Define to enable CPU profiling within Squid])
1971 AM_CONDITIONAL(ENABLE_XPROF_STATS, true)
1972 fi
1973])
1974
1975dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
1976AC_ARG_ENABLE(x-accelerator-vary,
1977 AC_HELP_STRING([--enable-x-accelerator-vary],
1978 [Enable support for the X-Accelerator-Vary
1979 HTTP header. Can be used to indicate
1980 variance within an accelerator setup.
1981 Typically used together with other code
1982 that adds custom HTTP headers to the requests.]),
1983[ if test "$enableval" = "yes" ; then
1984 AC_MSG_NOTICE([Enabling support for X-Accelerator-Vary])
1985 AC_DEFINE(X_ACCELERATOR_VARY, 1, [Enable support for the X-Accelerator-Vary HTTP header])
1986 fi
1987])
1988
1989dnl Enable IPv6 support
1990AC_MSG_CHECKING([whether to enable IPv6])
1991use_ipng=yes
1992AC_ARG_ENABLE(ipv6,
1993 AC_HELP_STRING([--disable-ipv6],[Disable IPv6 support]),
1994[ if test "x$enableval" = "xyes" ; then
1995 AC_MSG_RESULT(yes)
1996 else
1997 AC_MSG_RESULT(no)
1998 use_ipng=no
1999 fi
2000],[AC_MSG_RESULT(yes)])
2001
2002if test "$use_ipng" = "yes"; then
2003 SAVED_LIBS="$LIBS"
2004 dnl Solaris 10/11 requires -lsocket
2005 case "$host" in
2006 *-solaris*)
2007 LIBS="$LIBS -lsocket"
2008 ;;
2009 *)
2010 ;;
2011 esac
2012 AC_CACHE_CHECK([if PF_INET6 is available], $use_ipng,
2013 AC_TRY_RUN([ /* PF_INET6 available check */
2014# include <sys/types.h>
2015# include <sys/socket.h>
2016 int main() {
2017 if (socket(PF_INET6, SOCK_STREAM, 0) < 0)
2018 return 1;
2019 else
2020 return 0;
2021 }
2022 ],
2023 [ AC_MSG_RESULT(yes)
2024 use_ipng=yes
2025 SAVED_LIBS="$LIBS"
2026 ],
2027 [ AC_MSG_RESULT(no)
2028 use_ipng=no
2029 ])
2030 )
2031 LIBS="$SAVED_LIBS"
2032fi
2033
2034if test "$use_ipng" = "yes"; then
2035
2036AC_DEFINE(USE_IPV6,1,[Enable support for IPv6 ])
2037
2038dnl Check for IPv6 Windows Vista option
2039dnl Also useful for other OS with hybrid-stack defaults turned OFF
2040AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 1, [Enable v4-mapping through v6 sockets])
2041
2042dnl Check for Windows XP option
2043AC_MSG_CHECKING([for IPv6 split-stack requirement])
2044AC_ARG_WITH(ipv6-split-stack,
2045 AC_HELP_STRING([--with-ipv6-split-stack],
2046 [Enable experimental split-stack support for Windows XP. Requires IPv6.]),
2047 [ AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 1, [Enable support for IPv6 on split-stack implementations])
2048 AC_DEFINE(IPV6_SPECIAL_V4MAPPED, 0, [Enable v4-mapping through v6 sockets. Requires IPv6 hybrid-stack.])
2049 AC_MSG_RESULT(yes)
2050 ],
2051 [AC_DEFINE(IPV6_SPECIAL_SPLITSTACK, 0, [Enable support for IPv6 on split-stack implementations]) AC_MSG_RESULT(no)]
2052)
2053
2054dnl Check whether this OS defines sin6_len as a member of sockaddr_in6 as a backup to ss_len
2055AC_CACHE_CHECK([for sin6_len field in struct sockaddr_in6],
2056 ac_cv_have_sin6_len_in_struct_sai, [
2057 AC_TRY_COMPILE([
2058#include <sys/types.h>
2059#include <sys/socket.h>
2060#include <netinet/in.h>
2061 ],
2062 [ struct sockaddr_in6 s; s.sin6_len = 1; ],
2063 [ ac_cv_have_sin6_len_in_struct_sai="yes" ],
2064 [ ac_cv_have_sin6_len_in_struct_sai="no" ]
2065 )
2066])
2067if test "x$ac_cv_have_sin6_len_in_struct_sai" = "xyes" ; then
2068 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 1, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
2069else
2070 AC_DEFINE(HAVE_SIN6_LEN_IN_SAI, 0, [Does struct sockaddr_in6 have sin6_len? 1: Yes, 0: No])
2071fi
2072
2073
2074else
2075 # NP: semi-silent failure as IPv4-only mode is perfectly usable on this system.
2076 AC_MSG_WARN([IPv6 is not available on this system.])
2077 AC_DEFINE(USE_IPV6,0,[Enable support for IPv6])
2078 AC_DEFINE(IPV6_SPECIAL_SPLITSTACK,0,[Enable support for IPv6 on split-stack implementations])
2079 AC_DEFINE(IPV6_SPECIAL_V4MAPPED,0,[Enable v4-mapping through v6 sockets])
2080fi
2081
2082AC_ARG_ENABLE(zph-qos,
2083 AC_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]),
2084[ if test "$enableval" = "yes" ; then
2085 AC_MSG_NOTICE([ZPH QOS enabled])
2086 AC_DEFINE(USE_ZPH_QOS,1,
2087 [ Define this to use Squid's ZPH (Zero Penalty Hit) QOS features.
2088 When enabled, Squid will alter TOS field of HIT responses for better QOS on intermediate routing/shaping devices.])
2089 fi
2090])
2091
2092dnl Check whether this OS defines ss_len as a member of sockaddr_storage
2093AC_CACHE_CHECK([for ss_len field in struct sockaddr_storage],
2094 ac_cv_have_ss_len_in_struct_ss, [
2095 AC_TRY_COMPILE([
2096#include <sys/types.h>
2097#include <sys/socket.h>
2098#include <netinet/in.h>
2099 ],
2100 [ struct sockaddr_storage s; s.ss_len = 1; ],
2101 [ ac_cv_have_ss_len_in_struct_ss="yes" ],
2102 [ ac_cv_have_ss_len_in_struct_ss="no" ]
2103 )
2104])
2105if test "x$ac_cv_have_ss_len_in_struct_ss" = "xyes" ; then
2106 AC_DEFINE(HAVE_SS_LEN_IN_SS, 1, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
2107else
2108 AC_DEFINE(HAVE_SS_LEN_IN_SS, 0, [Does struct sockaddr_storage have ss_len? 1: Yes, 0: No])
2109fi
2110
2111dnl Check whether this OS defines sin_len as a member of sockaddr_in as a backup to ss_len
2112AC_CACHE_CHECK([for sin_len field in struct sockaddr_in],
2113 ac_cv_have_sin_len_in_struct_sai, [
2114 AC_TRY_COMPILE([
2115#include <sys/types.h>
2116#include <sys/socket.h>
2117#include <netinet/in.h>
2118 ],
2119 [ struct sockaddr_in s; s.sin_len = 1; ],
2120 [ ac_cv_have_sin_len_in_struct_sai="yes" ],
2121 [ ac_cv_have_sin_len_in_struct_sai="no" ]
2122 )
2123])
2124if test "x$ac_cv_have_sin_len_in_struct_sai" = "xyes" ; then
2125 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 1, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
2126else
2127 AC_DEFINE(HAVE_SIN_LEN_IN_SAI, 0, [Does struct sockaddr_in have sin_len? 1: Yes, 0: No])
2128fi
2129
2130dnl --with-maxfd present for compatibility with Squid-2.
2131dnl undocumented in ./configure --help to encourage using the Squid-3 directive.
2132AC_ARG_WITH(maxfd,,
2133[
2134 case ${withval} in
2135 [[0-9]]*)
2136 squid_filedescriptors_num=$withval
2137 ;;
2138 *)
2139 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
2140 ;;
2141 esac
2142])
2143AC_ARG_WITH(filedescriptors,
2144 AC_HELP_STRING([--with-filedescriptors=NUMBER],
2145 [Force squid to support NUMBER filedescriptors]),
2146[
2147 case ${withval} in
2148 [[0-9]]*)
2149 squid_filedescriptors_num=$withval
2150 ;;
2151 *)
2152 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
2153 ;;
2154 esac
2155])
2156
2157AC_PATH_PROG(CPPUNITCONFIG, cppunit-config, false)
2158if $CPPUNITCONFIG --help >/dev/null; then
2159 AC_MSG_NOTICE([using system installed cppunit])
2160 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2161 SQUID_CPPUNIT_LA=''
2162 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2163else
2164 AC_MSG_WARN([cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail.])
2165 SQUID_CPPUNIT_LA=''
2166 SQUID_CPPUNIT_LIBS=''
2167 SQUID_CPPUNIT_INC=''
2168fi
2169
2170AC_ARG_WITH(cppunit-basedir,
2171 AC_HELP_STRING([--with-cppunit-basedir=PATH],
2172 [Path where the cppunit headers are libraries are found
2173 for unit testing.]),
2174[ if test -f $withval/include/cppunit/TestCase.h; then
2175 AC_MSG_NOTICE([Using cppunit includes from $withval])
2176 SQUID_CPPUNIT_INC="-I${withval}/include"
2177 else
2178 AC_MSG_ERROR(Cannot find cppunit at $withval)
2179 fi
2180 if test -f $withval/lib/libcppunit.la; then
2181 AC_MSG_NOTICE([Using cppunit lib from $withval])
2182 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
2183 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
2184 else
2185 AC_MSG_ERROR(Cannot find cppunit at $withval)
2186 exit 1
2187 fi
2188])
2189AC_SUBST(SQUID_CPPUNIT_LIBS)
2190AC_SUBST(SQUID_CPPUNIT_LA)
2191AC_SUBST(SQUID_CPPUNIT_INC)
2192
2193# Force some compilers to use ANSI features
2194#
2195case "$host" in
2196 alpha-dec-osf*)
2197 if test "$ac_cv_prog_CC" = "cc" ; then
2198 AC_MSG_NOTICE([adding '-std1' to cc args for $host])
2199 CC="cc -std1";
2200 ac_cv_prog_CC="$CC"
2201 fi
2202 ;;
2203 *-hp-hpux*)
2204 if test "$ac_cv_prog_CC" = "cc" ; then
2205 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
2206 CC="cc -Ae";
2207 ac_cv_prog_CC="$CC"
2208 fi
2209 ;;
2210esac
2211
2212dnl Check for programs
2213AC_PROG_CPP
2214AC_PROG_INSTALL
2215AC_PROG_LN_S
2216AC_PATH_PROG(SH, sh, /bin/sh)
2217AC_PATH_PROG(FALSE, false, /usr/bin/false)
2218AC_PATH_PROG(TRUE, true, /usr/bin/true)
2219AC_PATH_PROG(RM, rm, $FALSE)
2220AC_PATH_PROG(MV, mv, $FALSE)
2221AC_PATH_PROG(MKDIR, mkdir, $FALSE)
2222AC_PATH_PROG(LN, ln, cp)
2223dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
2224AC_PROG_EGREP
2225
2226AC_PATH_PROG(PERL, perl, none)
2227if test "$ac_cv_path_PERL" = "none"; then
2228 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
2229fi
2230
2231case "$host" in
2232 *-hp-hpux*)
2233 AC_MSG_NOTICE([Disabling 'ranlib' for HP-UX...])
2234 RANLIB=":"
2235 ;;
2236esac
2237
2238dnl set $(AR)
2239AC_PATH_PROG(AR, ar, $FALSE)
2240AR_R="$AR r"
2241case "$host" in
2242 *-next-nextstep3)
2243 AR="libtool -o"
2244 ;;
2245esac
2246AC_SUBST(AR_R)
2247
2248dnl Check for headers
2249AC_HEADER_DIRENT
2250AC_HEADER_STDC
2251
2252AC_CHECK_HEADERS( \
2253 aio.h \
2254 arpa/inet.h \
2255 arpa/nameser.h \
2256 assert.h \
2257 bstring.h \
2258 cassert \
2259 crypt.h \
2260 ctype.h \
2261 errno.h \
2262 execinfo.h \
2263 fcntl.h \
2264 fnmatch.h \
2265 getopt.h \
2266 glob.h \
2267 gnumalloc.h \
2268 grp.h \
2269 iosfwd \
2270 iomanip \
2271 iostream \
2272 ip_compat.h \
2273 ip_fil_compat.h \
2274 ip_fil.h \
2275 ip_nat.h \
2276 ipl.h \
2277 libc.h \
2278 limits.h \
2279 machine/byte_swap.h \
2280 malloc.h \
2281 math.h \
2282 memory.h \
2283 mount.h \
2284 netdb.h \
2285 netinet/in.h \
2286 netinet/in_systm.h \
2287 netinet/ip_fil_compat.h \
2288 openssl/err.h \
2289 openssl/md5.h \
2290 openssl/ssl.h \
2291 netinet/tcp.h \
2292 openssl/engine.h \
2293 ostream \
2294 paths.h \
2295 poll.h \
2296 pwd.h \
2297 shadow.h \
2298 regex.h \
2299 sched.h \
2300 signal.h \
2301 sstream \
2302 stdarg.h \
2303 stddef.h \
2304 stdexcept \
2305 stdio.h \
2306 stdlib.h \
2307 string \
2308 string.h \
2309 strings.h \
2310 sys/bitypes.h \
2311 sys/bswap.h \
2312 sys/endian.h \
2313 sys/file.h \
2314 sys/ioctl.h \
2315 sys/param.h \
2316 sys/prctl.h \
2317 sys/md5.h \
2318 sys/msg.h \
2319 sys/resource.h \
2320 sys/select.h\
2321 sys/socket.h \
2322 sys/stat.h \
2323 sys/statvfs.h \
2324 syscall.h \
2325 sys/syscall.h \
2326 sys/time.h \
2327 sys/types.h \
2328 sys/un.h \
2329 sys/vfs.h \
2330 sys/wait.h \
2331 syslog.h \
2332 time.h \
2333 unistd.h \
2334 utime.h \
2335 varargs.h \
2336 byteswap.h \
2337 glib.h \
2338 stdint.h \
2339 inttypes.h \
2340 grp.h \
2341 db.h \
2342 db_185.h \
2343 sys/capability.h
2344)
2345
2346AC_CHECK_HEADERS(
2347 linux/netfilter_ipv4.h \
2348 linux/netfilter_ipv4/ip_tproxy.h \
2349,,,
2350SQUID_DEFAULT_INCLUDES
2351#if HAVE_LIMITS_H
2352#include <limits.h>
2353#endif
2354/* Netfilter ip(6)tables v1.4.0 has broken headers */
2355#if HAVE_NETINET_IN_H
2356#include <netinet/in.h>
2357#endif
2358)
2359
2360dnl *BSD dont include the depenencies for all their net/ and netinet/ files
2361dnl We must include a few basic type headers for them to work.
2362AC_CHECK_HEADERS( \
2363 net/if.h \
2364 netinet/if_ether.h\
2365 netinet/icmp6.h \
2366 netinet/in.h \
2367 netinet/ip.h \
2368 netinet/ip6.h \
2369 netinet/ip_compat.h\
2370 netinet/ip_fil_compat.h\
2371 netinet/ip_fil.h\
2372 netinet/ip_icmp.h \
2373 netinet/ipl.h \
2374 netinet/ip_nat.h\
2375 net/pf/pfvar.h \
2376 net/pfvar.h \
2377 sys/mount.h\
2378 resolv.h \
2379,,,
2380SQUID_BSDNET_INCLUDES)
2381
2382AC_CHECK_HEADERS([libxml/parser.h], [], [
2383 SAVED_CPPFLAGS="$CPPFLAGS"
2384 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
2385 unset ac_cv_header_libxml_parser_h
2386 AC_CHECK_HEADERS([libxml/parser.h], [], [
2387 CPPFLAGS="$SAVED_CPPFLAGS"
2388 ])
2389 ])
2390
2391AC_C_CONST
2392AC_C_BIGENDIAN
2393
2394AC_STRUCT_TM
2395AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2396#if TM_IN_SYS_TIME
2397#if HAVE_SYS_TIME_H
2398#include <sys/time.h>
2399#endif
2400#elif HAVE_TIME_H
2401#include <time.h>
2402#endif
2403])
2404
2405AC_CHECK_TYPE(struct mallinfo,AC_DEFINE(HAVE_STRUCT_MALLINFO,1,[The system provides struct mallinfo]),,[
2406#if HAVE_SYS_TYPES_H
2407#include <sys/types.h>
2408#endif
2409#if HAVE_MALLOC_H
2410#include <malloc.h>
2411#endif])
2412
2413AC_CHECK_MEMBERS([struct mallinfo.mxfast],,,[
2414#if HAVE_SYS_TYPES_H
2415#include <sys/types.h>
2416#endif
2417#if HAVE_MALLOC_H
2418#include <malloc.h>
2419#endif])
2420
2421dnl Override rusage() detect on MinGW because is emulated in source code
2422case "$host_os" in
2423 mingw|mingw32)
2424 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2425 ac_cv_func_getrusage='yes'
2426 AC_MSG_NOTICE([Using own rusage on Windows.])
2427 ;;
2428 *)
2429 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
2430#if HAVE_SYS_TIME_H
2431#include <sys/time.h>
2432#endif
2433#if HAVE_SYS_RESOURCE_H
2434#include <sys/resource.h>
2435#endif])
2436 ;;
2437esac
2438
2439AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2440#if HAVE_SYS_TYPES_H
2441#include <sys/types.h>
2442#endif
2443#include <netinet/in.h>
2444#include <netinet/in_systm.h>
2445#include <netinet/ip.h>
2446#if defined (__linux__) || defined (__CYGWIN__)
2447#define ip_hl ihl
2448#endif
2449#ifndef __linux__
2450#ifndef __CYGWIN__
2451#define iphdr ip
2452#endif
2453#endif])
2454
2455dnl Check for typedefs
2456AC_CHECK_SIZEOF(void *)
2457
2458dnl 8 bit integers - int8_t
2459dnl if this is defined we trust it to be 8 bits
2460AC_CHECK_TYPE(int8_t,[
2461 AC_CHECK_SIZEOF(int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2462 AC_DEFINE(HAVE_INT8_T,1,[int8_t is defined in system headers])
2463 ],,SQUID_DEFAULT_INCLUDES)
2464
2465dnl fallback #1
2466AC_CHECK_TYPE(char,[
2467 AC_CHECK_SIZEOF(char,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2468 AC_DEFINE(HAVE_CHAR,1,[char is defined in system headers])
2469 ],,SQUID_DEFAULT_INCLUDES)
2470
2471dnl unsigned 8 bit ints - u_int8_t
2472dnl if this is defined we trust it to be 8 bits
2473AC_CHECK_TYPE(u_int8_t,[
2474 AC_CHECK_SIZEOF(u_int8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2475 AC_DEFINE(HAVE_U_INT8_T,1,[u_int8_t is defined in system headers])
2476 ],,SQUID_DEFAULT_INCLUDES)
2477
2478dnl fallback #1
2479dnl if this is defined we trust it to be 8 bits
2480AC_CHECK_TYPE(uint8_t,[
2481 AC_CHECK_SIZEOF(uint8_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2482 AC_DEFINE(HAVE_UINT8_T,1,[uint8_t is defined in system headers])
2483 ],,SQUID_DEFAULT_INCLUDES)
2484
2485dnl 16 bit integers - int16_t
2486dnl if this is defined we trust it to be 16 bits
2487AC_CHECK_TYPE(int16_t,[
2488 AC_CHECK_SIZEOF(int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2489 AC_DEFINE(HAVE_INT16_T,1,[int16_t is defined in system headers])
2490 ],,SQUID_DEFAULT_INCLUDES)
2491
2492dnl fallback #1
2493AC_CHECK_TYPE(short,[
2494 AC_CHECK_SIZEOF(short,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2495 AC_DEFINE(HAVE_SHORT,1,[short is defined in system headers])
2496 ],,SQUID_DEFAULT_INCLUDES)
2497
2498dnl fallback #2
2499AC_CHECK_TYPE(int,[
2500 AC_CHECK_SIZEOF(int,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2501 AC_DEFINE(HAVE_INT,1,[int is defined in system headers])
2502 ],,SQUID_DEFAULT_INCLUDES)
2503
2504dnl unsigned 16 bit ints - u_int16_t
2505dnl if this is defined we trust it to be 16 bits
2506AC_CHECK_TYPE(u_int16_t,[
2507 AC_CHECK_SIZEOF(u_int16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2508 AC_DEFINE(HAVE_U_INT16_T,1,[u_int16_t is defined in system headers])
2509 ],,SQUID_DEFAULT_INCLUDES)
2510
2511dnl fallback #1
2512dnl if this is defined we trust it to be 16 bits
2513AC_CHECK_TYPE(uint16_t,[
2514 AC_CHECK_SIZEOF(uint16_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2515 AC_DEFINE(HAVE_UINT16_T,1,[uint16_t is defined in system headers])
2516 ],,SQUID_DEFAULT_INCLUDES)
2517
2518dnl 32 bit signed int - int32_t
2519dnl if this is defined we trust it to be 32 bits
2520AC_CHECK_TYPE(int32_t,[
2521 AC_CHECK_SIZEOF(int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2522 AC_DEFINE(HAVE_INT32_T,1,[int32_t is defined in system headers])
2523 ],,SQUID_DEFAULT_INCLUDES)
2524
2525dnl fallback #1
2526AC_CHECK_TYPE(long,[
2527 AC_CHECK_SIZEOF(long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2528 AC_DEFINE(HAVE_LONG,1,[long is defined in system headers])
2529 ],,SQUID_DEFAULT_INCLUDES)
2530
2531dnl 32 bit unsigned int - u_int32_t
2532dnl if this is defined we trust it to be 32 bits
2533AC_CHECK_TYPE(u_int32_t,[
2534 AC_CHECK_SIZEOF(u_int32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2535 AC_DEFINE(HAVE_U_INT32_T,1,[u_int32_t is defined in system headers])
2536 ],,SQUID_DEFAULT_INCLUDES)
2537
2538dnl fallback #1
2539dnl if this is defined we trust it to be 32 bits
2540AC_CHECK_TYPE(uint32_t,[
2541 AC_CHECK_SIZEOF(uint32_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2542 AC_DEFINE(HAVE_UINT32_T,1,[uint32_t is defined in system headers])
2543 ],,SQUID_DEFAULT_INCLUDES)
2544
2545dnl 64 bit signed - int64_t
2546dnl if this is defind we trust it to be 64 bits
2547AC_CHECK_TYPE(int64_t,[
2548 AC_CHECK_SIZEOF(int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2549 AC_DEFINE(HAVE_INT64_T,1,[int64_t is defined in system headers])
2550 ],,SQUID_DEFAULT_INCLUDES)
2551
2552dnl fallback #1
2553dnl if this is defind we trust it to be 64 bits
2554AC_CHECK_TYPE(__int64,[
2555 AC_CHECK_SIZEOF(__int64,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2556 AC_DEFINE(HAVE___INT64,1,[__int64 is defined in system headers])
2557 ],,SQUID_DEFAULT_INCLUDES)
2558
2559dnl fallback #2
2560AC_CHECK_TYPE(long long,[
2561 AC_CHECK_SIZEOF(long long,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2562 AC_DEFINE(HAVE_LONG_LONG,1,[long long is defined in system headers])
2563 ],,SQUID_DEFAULT_INCLUDES)
2564
2565dnl 64 bit unsigned - u_int64_t
2566dnl if this is defind we trust it to be 64 bits
2567AC_CHECK_TYPE(u_int64_t,[
2568 AC_CHECK_SIZEOF(u_int64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2569 AC_DEFINE(HAVE_U_INT64_T,1,[u_int64_t is defined in system headers])
2570 ],,SQUID_DEFAULT_INCLUDES)
2571
2572dnl fallback #1
2573dnl if this is defind we trust it to be 64 bits
2574AC_CHECK_TYPE(uint64_t,[
2575 AC_CHECK_SIZEOF(uint64_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2576 AC_DEFINE(HAVE_UINT64_T,1,[uint64_t is defined in system headers])
2577 ],,SQUID_DEFAULT_INCLUDES)
2578
2579dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2580dnl that is incompatible with the updated Solaris header files.
2581dnl For this reason, we must check if pad128_t and upad128_t are defined.
2582AC_CHECK_TYPE(pad128_t,
2583 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2584 ,SQUID_DEFAULT_INCLUDES)
2585
2586AC_CHECK_TYPE(upad128_t,
2587 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2588 ,SQUID_DEFAULT_INCLUDES)
2589
2590AC_CHECK_TYPE(pid_t, AC_DEFINE(HAVE_PID_T,1,[pid_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2591AC_CHECK_TYPE(size_t, [AC_CHECK_SIZEOF(size_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2592 AC_DEFINE(HAVE_SIZE_T,1,[size_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2593AC_CHECK_TYPE(ssize_t, AC_DEFINE(HAVE_SSIZE_T,1,[ssize_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2594AC_CHECK_TYPE(off_t,[ AC_CHECK_SIZEOF(off_t,,SQUID_DEFAULT_SIZEOF_INCLUDES)
2595 AC_DEFINE(HAVE_OFF_T,1,[off_t is defined by the system headers])],,SQUID_DEFAULT_INCLUDES)
2596AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2597AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2598
2599dnl Check for special functions
2600AC_FUNC_ALLOCA
2601
2602AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2603#include <sys/types.h>
2604#include <sys/socket.h>
2605#if STDC_HEADERS
2606#include <stdlib.h>
2607#include <stddef.h>
2608#endif])
2609
2610AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,[mtyp_t is defined by the system headers]),,[#include <sys/types.h>
2611#include <sys/ipc.h>
2612#include <sys/msg.h>])
2613
2614dnl Check for needed libraries
2615AC_CHECK_LIB(nsl, main)
2616AC_CHECK_LIB(socket, main)
2617dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
2618case "$host_os" in
2619 mingw|mingw32)
2620 AC_MSG_CHECKING(for winsock)
2621 save_LIBS="$LIBS"
2622 for curlib in ws2_32 wsock32; do
2623 LIBS="$LIBS -l$curlib"
2624 AC_TRY_LINK([
2625 char __attribute__((stdcall)) socket(int,int,int);
2626 char __attribute__((stdcall)) select(int,int,int,int,int);
2627 char __attribute__((stdcall)) closesocket(int);
2628 char __attribute__((stdcall)) gethostname(int,int);
2629 ],
2630 [
2631 socket(1,2,3);
2632 select(1,2,3,4,5);
2633 closesocket(1);
2634 gethostname(1,2);
2635 ],
2636 have_winsock=yes, have_winsock=no)
2637
2638 if test $have_winsock = yes; then
2639 ac_cv_func_select='yes'
2640 if test $curlib = ws2_32; then
2641 have_winsock=winsock2
2642 fi
2643 break
2644 fi
2645 LIBS="$save_LIBS"
2646 done
2647 AC_MSG_RESULT($have_winsock)
2648 if test $have_winsock = winsock2; then
2649 AC_CHECK_HEADERS(winsock2.h)
2650 else
2651 AC_CHECK_HEADERS(winsock.h)
2652 fi
2653 ;;
2654esac
2655
2656dnl Ripped from the Samba sources
2657AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
2658 AC_TRY_COMPILE([
2659#include <sys/types.h>
2660#include <stdlib.h>
2661#include <stddef.h>
2662#include <sys/socket.h>
2663#include <sys/un.h>],
2664[
2665 struct sockaddr_un sunaddr;
2666 sunaddr.sun_family = AF_UNIX;
2667],
2668 squid_cv_unixsocket=yes,squid_cv_unixsocket=no)])
2669if test x"$squid_cv_unixsocket" = x"yes"; then
2670 AC_DEFINE(HAVE_UNIXSOCKET,1,[Do we have unix sockets? (required for the winbind ntlm helper])
2671fi
2672dnl end rip
2673
2674 AC_CHECK_LIB(gnumalloc, main)
2675 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
2676 AC_MSG_NOTICE([Disabling extended malloc functions when using gnumalloc])
2677 ac_cv_func_mallinfo=no
2678 ac_cv_func_mallocblksize=no
2679 ac_cv_func_mallopt=no
2680 else
2681 case "$host" in
2682 *-sun-solaris*)
2683 AC_MSG_NOTICE([skipping libmalloc check for $host])
2684 ;;
2685 i386-*-freebsd*)
2686 AC_MSG_NOTICE([skipping libmalloc check for $host])
2687 ;;
2688 *)
2689
2690 AC_CHECK_LIB(malloc, main)
2691 ;;
2692 esac
2693 fi
2694
2695AC_CHECK_LIB(bsd, main)
2696AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
2697AC_CHECK_LIB(bind, gethostbyname)
2698if test $ac_cv_lib_bind_gethostbyname = "no" ; then
2699 case "$host" in
2700 i386-*-freebsd*)
2701 AC_MSG_NOTICE([skipping libresolv checks for $host])
2702 ;;
2703 *)
2704 AC_CHECK_LIB(resolv, main)
2705 ;;
2706 esac
2707fi
2708case "$host_os" in
2709mingw|mingw32)
2710 AC_MSG_NOTICE([Use MSVCRT for math functions.])
2711 ;;
2712 *)
2713 AC_CHECK_LIB(m, main)
2714 ;;
2715esac
2716
2717dnl Check for libcrypt
2718dnl Some of our helpers use crypt(3) which may be in libc, or in
2719dnl libcrypt (eg FreeBSD)
2720AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
2721dnl Solaris10 provides MD5 natively through libmd5
2722AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
2723AC_SUBST(CRYPTLIB)
2724
2725dnl Check for libdl, used by auth_modules/PAM
2726if test "$with_dl" = "yes"; then
2727 AC_CHECK_LIB(dl, dlopen)
2728fi
2729
2730dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
2731dnl Robert Side <rside@aiinc.bc.ca>
2732dnl Mon, 18 Jan 1999 17:48:00 GMT
2733case "$host" in
2734 *-pc-sco3.2*)
2735 AC_CHECK_LIB(intl, strftime)
2736 ;;
2737esac
2738
2739dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
2740dnl only with Windows LDAP libraries using -lwldap32
2741case "$host_os" in
2742mingw|mingw32)
2743 LIB_LDAP="-lwldap32"
2744 LIB_LBER=""
2745 ;;
2746*)
2747 LIB_LDAP="-lldap"
2748 dnl LDAP helpers need to know if -llber is needed or not
2749 AC_CHECK_LIB(lber, main, [LIB_LBER="-llber"])
2750 ;;
2751esac
2752AC_SUBST(LIB_LDAP)
2753AC_SUBST(LIB_LBER)
2754
2755dnl Check for libdb
2756DBLIB=
2757dnl 1.85
2758AC_CACHE_CHECK(if dbopen needs -ldb,ac_cv_dbopen_libdb, [
2759SAVED_LIBS="$LIBS"; LIBS="$LIBS -ldb"
2760 AC_TRY_LINK([
2761#if HAVE_SYS_TYPES_H
2762#include <sys/types.h>
2763#endif
2764#if HAVE_LIMITS_H
2765#include <limits.h>
2766#endif
2767#if HAVE_DB_185_H
2768#include <db_185.h>
2769#elif HAVE_DB_H
2770#include <db.h>
2771#endif],
2772 [dbopen("", 0, 0, DB_HASH, (void *)0L)],
2773 ac_cv_dbopen_libdb="yes",
2774 ac_cv_dbopen_libdb="no")
2775LIBS="$SAVED_LIBS"
2776])
2777if test $ac_cv_dbopen_libdb = yes; then
2778 LIB_DB="-ldb"
2779fi
2780AC_SUBST(LIB_DB)
2781
2782dnl System-specific library modifications
2783dnl
2784case "$host" in
2785 i386-*-solaris2.*)
2786 if test "$GCC" = "yes"; then
2787 AC_MSG_NOTICE([Removing -O for gcc on $host])
2788 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2789 fi
2790 ;;
2791 *-sgi-irix*)
2792 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
2793 LIBS=`echo $LIBS | sed -e s/-lsocket//`
2794 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
2795 LIBS=`echo $LIBS | sed -e s/-lnsl//`
2796 ac_cv_lib_nsl_main=no
2797 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
2798 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2799 ;;
2800dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
2801dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
2802dnl Please change your configure script. AIX doesn't need -lbsd.
2803 *-ibm-aix*)
2804 AC_MSG_NOTICE([Removing -lbsd for AIX...])
2805 LIBS=`echo $LIBS | sed -e s/-lbsd//`
2806 ;;
2807 *m88k*)
2808 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
2809 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
2810 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,[If gettimeofday is known to take only one argument])
2811 ;;
2812 [*-*-solaris2.[0-4]])
2813 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2814 ;;
2815 [*-sony-newsos[56]*])
2816 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
2817 ;;
2818esac
2819
2820# Remove optimization for GCC 2.95.[123]
2821# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
2822if test "$GCC" = "yes"; then
2823 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
2824 case "$GCCVER" in
2825 [2.95.[123]])
2826 AC_MSG_NOTICE([Removing -O for gcc on $host with GCC $GCCVER])
2827 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
2828 ;;
2829 esac
2830fi
2831
2832# Recommended by Balint Nagy Endre <bne@CareNet.hu>
2833case "$host" in
2834 *-univel-sysv4.2MP)
2835 if test `uname -v` = "2.03"; then
2836 AC_MSG_NOTICE([disabling mallinfo for $host])
2837 ac_cv_func_mallinfo=no
2838 fi
2839 ;;
2840esac
2841
2842dnl This has to be before AC_CHECK_FUNCS
2843# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
2844# when running configure.
2845if test -z "$ac_cv_func_poll"; then
2846 case "$host" in
2847 [alpha-dec-osf3.*])
2848 # John Kay (jkay@nlanr.net) 19970818
2849 AC_MSG_NOTICE([disabling poll for $host...])
2850 ac_cv_func_poll='no'
2851 ;;
2852 [*-hp-hpux*.*])
2853 # Duane Wessels
2854 AC_MSG_NOTICE([disabling poll for $host...])
2855 ac_cv_func_poll='no'
2856 ;;
2857 [*-linux-*])
2858 # Henrik Nordstrom (hno@squid-cache.org) 19980817
2859 # poll is problematic on Linux. We disable it
2860 # by default until Linux gets it right.
2861 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
2862 if test $rev -lt 002002; then
2863 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
2864 ac_cv_func_poll='no'
2865 fi
2866 ;;
2867 [powerpc-ibm-aix4.1.*])
2868 # Mike Laster (mlaster@metavillage.com) 19981021
2869 AC_MSG_NOTICE([disabling poll for $host...])
2870 ac_cv_func_poll='no'
2871 ;;
2872 [*-pc-sco3.2*])
2873 # Robert Side <rside@aiinc.bc.ca>
2874 # Mon, 18 Jan 1999 17:48:00 GMT
2875 AC_MSG_NOTICE([disabling poll for $host...])
2876 ac_cv_func_poll='no'
2877 ;;
2878 esac
2879fi
2880
2881dnl Override statfs() detect on MinGW becasue is emulated in source code
2882case "$host_os" in
2883mingw|mingw32)
2884 ac_cv_func_statfs='yes'
2885 ;;
2886esac
2887
2888dnl Check for library functions
2889AC_CHECK_FUNCS(\
2890 backtrace_symbols_fd \
2891 bcopy \
2892 bswap_16 \
2893 bswap_32 \
2894 bswap16 \
2895 bswap32 \
2896 fchmod \
2897 getdtablesize \
2898 getpagesize \
2899 getpass \
2900 getrlimit \
2901 getrusage \
2902 getspnam \
2903 gettimeofday \
2904 glob \
2905 htobe16 \
2906 htole16 \
2907 kqueue\
2908 lrand48 \
2909 mallinfo \
2910 mallocblksize \
2911 mallopt \
2912 memcpy \
2913 memmove \
2914 memset \
2915 mkstemp \
2916 mktime \
2917 mstats \
2918 poll \
2919 prctl \
2920 pthread_attr_setschedparam \
2921 pthread_attr_setscope \
2922 pthread_setschedparam \
2923 pthread_sigmask \
2924 putenv \
2925 random \
2926 regcomp \
2927 regexec \
2928 regfree \
2929 res_init \
2930 __res_init \
2931 rint \
2932 sbrk \
2933 select \
2934 seteuid \
2935 setgroups \
2936 setpgrp \
2937 setrlimit \
2938 setsid \
2939 sigaction \
2940 snprintf \
2941 socketpair \
2942 srand48 \
2943 srandom \
2944 statfs \
2945 strsep \
2946 strtoll \
2947 sysconf \
2948 syslog \
2949 timegm \
2950 vsnprintf \
2951)
2952dnl ... and some we provide local replacements for
2953AC_REPLACE_FUNCS(\
2954 drand48 \
2955 inet_ntop \
2956 inet_pton \
2957 initgroups \
2958 getaddrinfo \
2959 getnameinfo \
2960 strerror \
2961 tempnam \
2962)
2963
2964# check for crypt, may require -lcrypt
2965SAVED_LIBS="$LIBS"
2966LIBS="$LIBS $CRYPTLIB"
2967AC_CHECK_FUNCS(crypt)
2968LIBS="$SAVED_LIBS"
2969
2970dnl Magic which checks whether we are forcing a type of comm loop we
2971dnl are actually going to (ab)use
2972
2973dnl Actually do the define magic now
2974dnl mostly ripped from squid-commloops, thanks to adrian and benno
2975
2976if test -n "$SELECT_TYPE"; then
2977 : # Already decided above. Nothing to do here
2978elif test -z "$disable_epoll" && test "$ac_cv_epoll_works" = "yes" ; then
2979 SELECT_TYPE="epoll"
2980elif test -z "$disable_kqueue" && test "$ac_cv_func_kqueue" = "yes" ; then
2981 SELECT_TYPE="kqueue"
2982elif test -z "$disable_poll" && test "$ac_cv_func_poll" = "yes" ; then
2983 SELECT_TYPE="poll"
2984elif test -z "$disable_select" && test "$ac_cv_func_select" = "yes" ; then
2985 case "$host_os" in
2986 mingw|mingw32)
2987 SELECT_TYPE="select_win32"
2988 ;;
2989 *)
2990 SELECT_TYPE="select"
2991 ;;
2992 esac
2993else
2994 AC_MSG_WARN([Eep! Can't find poll, kqueue, epoll, or select!])
2995 AC_MSG_WARN([I'll try select and hope for the best.])
2996 SELECT_TYPE="select"
2997 AC_DEFINE(USE_SELECT,1)
2998fi
2999
3000AC_MSG_NOTICE([Using ${SELECT_TYPE} for the IO loop.])
3001
3002AM_CONDITIONAL([USE_POLL], [test $SELECT_TYPE = poll])
3003AM_CONDITIONAL([USE_EPOLL], [test $SELECT_TYPE = epoll])
3004AM_CONDITIONAL([USE_SELECT], [test $SELECT_TYPE = select])
3005AM_CONDITIONAL([USE_SELECT_SIMPLE], [test $SELECT_TYPE = select_simple])
3006AM_CONDITIONAL([USE_SELECT_WIN32], [test $SELECT_TYPE = select_win32])
3007AM_CONDITIONAL([USE_KQUEUE], [test $SELECT_TYPE = kqueue])
3008AM_CONDITIONAL([USE_DEVPOLL], [test $SELECT_TYPE = devpoll])
3009
3010case $SELECT_TYPE in
3011epoll)
3012 AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop])
3013 ;;
3014poll)
3015 AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop])
3016 ;;
3017kqueue)
3018 AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop])
3019 ;;
3020select_win32)
3021 AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop])
3022 ;;
3023select)
3024 AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop])
3025 ;;
3026esac
3027
3028
3029
3030dnl Yay! Another Linux brokenness. Its not good enough
3031dnl to know that setresuid() exists, because RedHat 5.0 declares
3032dnl setresuid() but doesn't implement it.
3033dnl
3034AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
3035 AC_TRY_RUN([
3036#include <stdlib.h>
3037 int main() {
3038 if(setresuid(-1,-1,-1)) {
3039 perror("setresuid:");
3040 exit(1);
3041 }
3042 exit(0);
3043 }
3044 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
3045)
3046if test "$ac_cv_func_setresuid" = "yes" ; then
3047 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.])
3048fi
3049
3050dnl Yay! This one is a MacOSX brokenness. Its not good enough
3051dnl to know that strnstr() exists, because MacOSX 10.4 have a bad
3052dnl copy that crashes with a buffer over-run!
3053dnl
3054AC_CACHE_CHECK(if strnstr is well implemented, ac_cv_func_strnstr,
3055 AC_TRY_RUN([
3056#include <stdlib.h>
3057#include <stdio.h>
3058#include <string.h>
3059 // we expect this to succeed, or crash on over-run.
3060 // if it passes otherwise we may need a better check.
3061int main(int argc, char **argv)
3062{
3063 int size = 20;
3064 char *str = malloc(size);
3065 memset(str, 'x', size);
3066 strnstr(str, "fubar", size);
3067 return 0;
3068}
3069 ],ac_cv_func_strnstr="yes",ac_cv_func_strnstr="no")
3070)
3071if test "$ac_cv_func_strnstr" = "yes" ; then
3072 AC_DEFINE(HAVE_STRNSTR,1,[Yay! We have a working strnstr!])
3073else
3074 AC_DEFINE(HAVE_STRNSTR,0,[Yay! A MacOS X brokenness. Its not good enough to know that strnstr() exists, because MacOSX 10.4 and earlier may have a buffer overrun.])
3075fi
3076
3077
3078AM_CONDITIONAL(NEED_OWN_STRSEP, false)
3079if test "$ac_cv_func_strsep" = "no" ; then
3080 AM_CONDITIONAL(NEED_OWN_STRSEP, true)
3081fi
3082
3083AM_CONDITIONAL(NEED_OWN_STRTOLL, false)
3084if test "$ac_cv_func_strtoll" = "no" ; then
3085 AM_CONDITIONAL(NEED_OWN_STRTOLL, true)
3086fi
3087
3088dnl
3089dnl Test for va_copy
3090dnl
3091AC_CACHE_CHECK(if va_copy is implemented, ac_cv_func_va_copy,
3092 AC_TRY_RUN([
3093 #include <stdarg.h>
3094 #include <stdlib.h>
3095 void f (int i, ...) {
3096 va_list args1, args2;
3097 va_start (args1, i);
3098 va_copy (args2, args1);
3099 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3100 exit (1);
3101 va_end (args1); va_end (args2);
3102 }
3103 int main() {
3104 f (0, 42);
3105 return 0;
3106 }
3107 ],ac_cv_func_va_copy="yes",ac_cv_func_va_copy="no")
3108)
3109if test "$ac_cv_func_va_copy" = "yes" ; then
3110 AC_DEFINE(HAVE_VA_COPY, 1, [If your system have va_copy])
3111fi
3112
3113dnl
3114dnl Some systems support __va_copy
3115dnl
3116AC_CACHE_CHECK(if __va_copy is implemented, ac_cv_func___va_copy,
3117 AC_TRY_RUN([
3118 #include <stdarg.h>
3119 #include <stdlib.h>
3120 void f (int i, ...) {
3121 va_list args1, args2;
3122 va_start (args1, i);
3123 __va_copy (args2, args1);
3124 if (va_arg (args2, int) != 42 || va_arg (args1, int) != 42)
3125 exit (1);
3126 va_end (args1); va_end (args2);
3127 }
3128 int main() {
3129 f (0, 42);
3130 return 0;
3131 }
3132 ],ac_cv_func___va_copy="yes",ac_cv_func___va_copy="no")
3133)
3134if test "$ac_cv_func___va_copy" = "yes" ; then
3135 AC_DEFINE(HAVE___VA_COPY, 1, [Some systems have __va_copy instead of va_copy])
3136fi
3137
3138dnl IP-Filter support requires ipf header files. These aren't
3139dnl installed by default, so we need to check for them
3140if test "$IPF_TRANSPARENT" ; then
3141 AC_MSG_CHECKING(if IP-Filter header files are installed)
3142 # hold on to your hats...
3143 if test "$ac_cv_header_ip_compat_h" = "yes" ||
3144 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
3145 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
3146 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
3147 have_ipfilter_compat_header="yes"
3148 fi
3149 if test "x$have_ipfilter_compat_header" = "xyes" &&
3150 test "$ac_cv_header_ip_fil_h" = "yes" &&
3151 test "$ac_cv_header_ip_nat_h" = "yes" ; then
3152 IPF_TRANSPARENT="yes"
3153 AC_DEFINE(IPF_TRANSPARENT, 1)
3154 elif test "$have_ipfilter_compat_header" = "yes" &&
3155 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
3156 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
3157 IPF_TRANSPARENT="yes"
3158 AC_DEFINE(IPF_TRANSPARENT, 1)
3159 else
3160 IPF_TRANSPARENT="no"
3161 AC_DEFINE(IPF_TRANSPARENT, 0)
3162 fi
3163 AC_MSG_RESULT($IPF_TRANSPARENT)
3164fi
3165if test "$IPF_TRANSPARENT" = "no" ; then
3166 AC_MSG_WARN([Cannot find necessary IP-Filter header files])
3167 AC_MSG_WARN([Transparent Proxy support WILL NOT be enabled])
3168 sleep 10
3169elif test "$IPF_TRANSPARENT" = "yes" ; then
3170dnl On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3171dnl Solaris minor version (8, 9, 10, ...)
3172 case "$host" in
3173 *-solaris*)
3174 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3175 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3176 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
3177 ;;
3178 *)
3179 ;;
3180 esac
3181fi
3182
3183dnl PF support requires a header file.
3184if test "$PF_TRANSPARENT" ; then
3185 AC_MSG_CHECKING(if PF header file is installed)
3186 # hold on to your hats...
3187 if test "$ac_cv_header_net_pfvar_h" = "yes" || test "$ac_cv_header_net_pf_pfvar_h" = "yes"; then
3188 PF_TRANSPARENT="yes"
3189 AC_DEFINE(PF_TRANSPARENT, 1)
3190 else
3191 PF_TRANSPARENT="no"
3192 AC_DEFINE(PF_TRANSPARENT, 0)
3193 fi
3194 AC_MSG_RESULT($PF_TRANSPARENT)
3195fi
3196if test "$PF_TRANSPARENT" = "no" ; then
3197 AC_MSG_WARN([Cannot find necessary PF header file])
3198 AC_MSG_WARN([Transparent Proxy support WILL NOT be enabled])
3199 sleep 10
3200fi
3201
3202dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
3203dnl Shamelessly copied from above
3204if test "$LINUX_NETFILTER" ; then
3205 AC_MSG_CHECKING(if Linux (Netfilter) kernel header files are installed)
3206 # hold on to your hats...
3207 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
3208 LINUX_NETFILTER="yes"
3209 AC_DEFINE(LINUX_NETFILTER, 1)
3210 else
3211 LINUX_NETFILTER="no"
3212 AC_DEFINE(LINUX_NETFILTER, 0)
3213 fi
3214 AC_MSG_RESULT($LINUX_NETFILTER)
3215fi
3216if test "$LINUX_NETFILTER" = "no" ; then
3217 AC_MSG_WARN([Cannot find necessary Linux kernel (Netfilter) header files])
3218 AC_MSG_WARN([Linux Transparent and Intercepting Proxy support WILL NOT be enabled])
3219 sleep 10
3220fi
3221
3222dnl Linux Netfilter/TPROXYv2 support requires some specific header files
3223dnl Shamelessly copied from shamelessly copied from above
3224if test "$LINUX_TPROXY2" ; then
3225 AC_MSG_CHECKING(if TPROXYv2 header files are installed)
3226 # hold on to your hats...
3227 if test "$ac_cv_header_linux_netfilter_ipv4_ip_tproxy_h" = "yes" && test "$LINUX_NETFILTER" = "yes"; then
3228 LINUX_TPROXY2="yes"
3229 AC_DEFINE(LINUX_TPROXY2, 1, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
3230 else
3231 LINUX_TPROXY2="no"
3232 AC_DEFINE(LINUX_TPROXY2, 0, [Enable real Transparent Proxy support for Netfilter TPROXY v2.])
3233 fi
3234 AC_MSG_RESULT($LINUX_TPROXY2)
3235 if test "$LINUX_TPROXY2" = "no" && test "$LINUX_NETFILTER" = "yes"; then
3236 AC_MSG_WARN([Cannot find TPROXY v2 headers, you need to patch the kernel with ])
3237 AC_MSG_WARN([tproxy package from:])
3238 AC_MSG_WARN([ - lynx http://www.balabit.com/downloads/files/tproxy/])
3239 AC_MSG_WARN([Or select the '--enable-linux-netfilter' option instead for Netfilter support.])
3240 sleep 10
3241 fi
3242fi
3243
3244AC_ARG_ENABLE(gnuregex,
3245 AC_HELP_STRING([--enable-gnuregex],
3246 [Compile GNUregex. Unless you have reason to use
3247 this option, you should not enable it.
3248 This library file is usually only required on Windows and
3249 very old Unix boxes which do not have their own regex
3250 library built in.]),
3251[USE_GNUREGEX=$enableval])
3252if test -z "$USE_GNUREGEX" ; then
3253 case "$host" in
3254 *-sun-solaris2.[[0-4]])
3255 USE_GNUREGEX="yes"
3256 ;;
3257 *-next-nextstep*)
3258 USE_GNUREGEX="yes"
3259 ;;
3260 esac
3261fi
3262AC_MSG_CHECKING(if GNUregex needs to be compiled)
3263if test -z "$USE_GNUREGEX"; then
3264if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
3265 USE_GNUREGEX="yes"
3266else
3267 AC_TRY_COMPILE([#include <sys/types.h>
3268#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
3269 USE_GNUREGEX="no",
3270 USE_GNUREGEX="yes")
3271fi
3272fi
3273AC_MSG_RESULT($USE_GNUREGEX)
3274if test "$USE_GNUREGEX" = "yes"; then
3275 # override system regex with ours. Not good. But what was asked for.
3276 REGEXLIB=""
3277 AC_DEFINE(USE_GNUREGEX,1,[Define if we should use GNU regex])
3278fi
3279AC_SUBST(REGEXLIB)
3280#AC_SUBST(LIBREGEX)
3281
3282dnl Not cached since people are likely to tune this
3283AC_MSG_CHECKING(Default FD_SETSIZE value)
3284AC_TRY_RUN([
3285#if HAVE_STDIO_H
3286#include <stdio.h>
3287#endif
3288#if HAVE_UNISTD_H
3289#include <unistd.h>
3290#endif
3291#if HAVE_STDLIB_H
3292#include <stdlib.h>
3293#endif
3294#if HAVE_SYS_TIME_H
3295#include <sys/time.h>
3296#endif
3297#if HAVE_SYS_SELECT_H
3298#include <sys/select.h>
3299#endif
3300#if HAVE_SYS_TYPES_H
3301#include <sys/types.h>
3302#endif
3303#if HAVE_WINSOCK_H
3304#include <winsock.h>
3305#endif
3306#if HAVE_WINSOCK2_H
3307#include <winsock2.h>
3308#endif
3309main() {
3310 FILE *fp = fopen("conftestval", "w");
3311 fprintf (fp, "%d\n", FD_SETSIZE);
3312 exit(0);
3313}
3314],
3315DEFAULT_FD_SETSIZE=`cat conftestval`,
3316DEFAULT_FD_SETSIZE=256,
3317DEFAULT_FD_SETSIZE=256)
3318AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
3319AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value])
3320
3321
3322dnl Not cached since people are likely to tune this
3323AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
3324dnl damn! FreeBSD's pthreads breaks dup2().
3325TLDFLAGS="$LDFLAGS"
3326if test -n "$squid_filedescriptors_num" ; then
3327 SQUID_MAXFD=$squid_filedescriptors_num
3328 AC_MSG_RESULT($SQUID_MAXFD (user-forced))
3329else
3330 case $host in
3331 i386-unknown-freebsd*)
3332 if echo "$LDFLAGS" | grep -q pthread; then
3333 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
3334 fi
3335 esac
3336 AC_TRY_RUN([
3337#include <stdio.h>
3338#include <unistd.h>
3339#include <stdlib.h>
3340#include <sys/time.h> /* needed on FreeBSD */
3341#include <sys/param.h>
3342#include <sys/resource.h>
3343main() {
3344 FILE *fp;
3345 int i,j;
3346#if defined(__CYGWIN32__) || defined (__CYGWIN__)
3347 /* getrlimit and sysconf returns bogous values on cygwin32.
3348 * Number of fds is virtually unlimited in cygwin (sys/param.h)
3349 * __CYGWIN32__ is deprecated.
3350 */
3351 i = NOFILE;
3352#else
3353#if HAVE_SETRLIMIT
3354 struct rlimit rl;
3355#if defined(RLIMIT_NOFILE)
3356 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
3357 perror("getrlimit: RLIMIT_NOFILE");
3358 } else {
3359#if defined(__APPLE__)
3360 /* asking for more than OPEN_MAX fails on Leopard */
3361 rl.rlim_cur = (OPEN_MAX < rl.rlim_max ? OPEN_MAX : rl.rlim_max);
3362#else
3363 rl.rlim_cur = rl.rlim_max; /* set it to the max */
3364#endif
3365 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
3366 perror("setrlimit: RLIMIT_NOFILE");
3367 }
3368 }
3369#elif defined(RLIMIT_OFILE)
3370 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
3371 perror("getrlimit: RLIMIT_OFILE");
3372 } else {
3373 rl.rlim_cur = rl.rlim_max; /* set it to the max */
3374 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
3375 perror("setrlimit: RLIMIT_OFILE");
3376 }
3377 }
3378#endif /* RLIMIT_NOFILE */
3379#endif /* HAVE_SETRLIMIT */
3380 /* by starting at 2^14, we will never get higher
3381 than 2^15 for SQUID_MAXFD */
3382 i = j = 1<<14;
3383 while (j) {
3384 j >>= 1;
3385 if (dup2(0, i) < 0) {
3386 i -= j;
3387 } else {
3388 close(i);
3389 i += j;
3390 }
3391 }
3392 i++;
3393#endif /* IF !DEF CYGWIN */
3394 fp = fopen("conftestval", "w");
3395 fprintf (fp, "%d\n", i & ~0x3F);
3396 exit(0);
3397}
3398 ],
3399 SQUID_MAXFD=`cat conftestval`,
3400 SQUID_MAXFD=256,
3401 SQUID_MAXFD=256)
3402 dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs
3403 case "$host_os" in
3404 mingw|mingw32)
3405 SQUID_MAXFD="2048"
3406 ;;
3407 esac
3408 AC_MSG_RESULT($SQUID_MAXFD)
3409fi
3410AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD,[Maximum number of open filedescriptors])
3411if test "$SQUID_MAXFD" -lt 512 ; then
3412 AC_MSG_WARN([$SQUID_MAXFD may not be enough filedescriptors if your])
3413 AC_MSG_WARN([cache will be very busy. Please see the FAQ page])
3414 AC_MSG_WARN([http://wiki.squid-cache.org/SquidFaq/TroubleShooting])
3415 AC_MSG_WARN([on how to increase your filedescriptor limit])
3416 sleep 10
3417fi
3418LDFLAGS="$TLDFLAGS"
3419
3420if test `expr $SQUID_MAXFD % 64` != 0; then
3421 AC_MSG_WARN([$SQUID_MAXFD is not an multiple of 64. This may cause issues on certain platforms.])
3422 sleep 10
3423fi
3424
3425dnl Not cached since people are likely to tune this
3426AC_MSG_CHECKING(Default UDP send buffer size)
3427AC_TRY_RUN([
3428#include <stdlib.h>
3429#include <stdio.h>
3430#include <sys/types.h>
3431#if HAVE_SYS_SOCKET_H
3432#include <sys/socket.h>
3433#endif
3434#if HAVE_NETINET_IN_H
3435#include <netinet/in.h>
3436#endif
3437#if HAVE_WINSOCK_H
3438#include <winsock.h>
3439#endif
3440#if HAVE_WINSOCK2_H
3441#include <winsock2.h>
3442#endif
3443main ()
3444{
3445 FILE *fp;
3446 int fd,val=0,len=sizeof(int);
3447#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3448 WSADATA wsaData;
3449 WSAStartup(2, &wsaData);
3450#endif
3451 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
3452 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
3453#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3454 WSACleanup();
3455#endif
3456 if (val<=0) exit(1);
3457 fp = fopen("conftestval", "w");
3458 fprintf (fp, "%d\n", val);
3459 exit(0);
3460}
3461],
3462SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`,
3463SQUID_DETECT_UDP_SO_SNDBUF=16384,
3464SQUID_DETECT_UDP_SO_SNDBUF=16384)
3465AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF)
3466AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size])
3467
3468dnl Not cached since people are likely to tune this
3469AC_MSG_CHECKING(Default UDP receive buffer size)
3470AC_TRY_RUN([
3471#include <stdlib.h>
3472#include <stdio.h>
3473#include <sys/types.h>
3474#if HAVE_SYS_SOCKET_H
3475#include <sys/socket.h>
3476#endif
3477#if HAVE_NETINET_IN_H
3478#include <netinet/in.h>
3479#endif
3480#if HAVE_WINSOCK_H
3481#include <winsock.h>
3482#endif
3483#if HAVE_WINSOCK2_H
3484#include <winsock2.h>
3485#endif
3486main ()
3487{
3488 FILE *fp;
3489 int fd,val=0,len=sizeof(int);
3490#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3491 WSADATA wsaData;
3492 WSAStartup(2, &wsaData);
3493#endif
3494 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
3495 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
3496#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3497 WSACleanup();
3498#endif
3499 if (val <= 0) exit(1);
3500 fp = fopen("conftestval", "w");
3501 fprintf (fp, "%d\n", val);
3502 exit(0);
3503}
3504],
3505SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`,
3506SQUID_DETECT_UDP_SO_RCVBUF=16384,
3507SQUID_DETECT_UDP_SO_RCVBUF=16384)
3508AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF)
3509AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size])
3510
3511dnl Not cached since people are likely to tune this
3512AC_MSG_CHECKING(Default TCP send buffer size)
3513AC_TRY_RUN([
3514#include <stdlib.h>
3515#include <stdio.h>
3516#include <sys/types.h>
3517#if HAVE_SYS_SOCKET_H
3518#include <sys/socket.h>
3519#endif
3520#if HAVE_NETINET_IN_H
3521#include <netinet/in.h>
3522#endif
3523#if HAVE_WINSOCK_H
3524#include <winsock.h>
3525#endif
3526#if HAVE_WINSOCK2_H
3527#include <winsock2.h>
3528#endif
3529main ()
3530{
3531 FILE *fp;
3532 int fd,val=0,len=sizeof(int);
3533#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3534 WSADATA wsaData;
3535 WSAStartup(2, &wsaData);
3536#endif
3537 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
3538 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
3539#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3540 WSACleanup();
3541#endif
3542 if (val <= 0) exit(1);
3543 fp = fopen("conftestval", "w");
3544 fprintf (fp, "%d\n", val);
3545 exit(0);
3546}
3547],
3548SQUID_TCP_SO_SNDBUF=`cat conftestval`,
3549SQUID_TCP_SO_SNDBUF=16384,
3550SQUID_TCP_SO_SNDBUF=16384)
3551AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
3552if test $SQUID_TCP_SO_SNDBUF -gt 32768; then
3553 AC_MSG_NOTICE([Limiting send buffer size to 32K])
3554 SQUID_TCP_SO_SNDBUF=32768
3555fi
3556AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size])
3557
3558dnl Not cached since people are likely to tune this
3559AC_MSG_CHECKING(Default TCP receive buffer size)
3560AC_TRY_RUN([
3561#include <stdlib.h>
3562#include <stdio.h>
3563#include <sys/types.h>
3564#if HAVE_SYS_SOCKET_H
3565#include <sys/socket.h>
3566#endif
3567#if HAVE_NETINET_IN_H
3568#include <netinet/in.h>
3569#endif
3570#if HAVE_WINSOCK_H
3571#include <winsock.h>
3572#endif
3573#if HAVE_WINSOCK2_H
3574#include <winsock2.h>
3575#endif
3576main ()
3577{
3578 FILE *fp;
3579 int fd,val=0,len=sizeof(int);
3580#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3581 WSADATA wsaData;
3582 WSAStartup(2, &wsaData);
3583#endif
3584 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
3585 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
3586#if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__))
3587 WSACleanup();
3588#endif
3589 if (val <= 0) exit(1);
3590 fp = fopen("conftestval", "w");
3591 fprintf (fp, "%d\n", val);
3592 exit(0);
3593}
3594],
3595SQUID_TCP_SO_RCVBUF=`cat conftestval`,
3596SQUID_TCP_SO_RCVBUF=16384,
3597SQUID_TCP_SO_RCVBUF=16384)
3598AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
3599if test $SQUID_TCP_SO_RCVBUF -gt 65535; then
3600 AC_MSG_NOTICE([Limiting receive buffer size to 64K])
3601 SQUID_TCP_SO_RCVBUF=65535
3602fi
3603AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size])
3604AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
3605 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
3606 ac_cv_needs_sys_errlist="no",
3607 ac_cv_needs_sys_errlist="yes")
3608)
3609if test "$ac_cv_needs_sys_errlist" = "yes" ; then
3610 AC_DEFINE(NEED_SYS_ERRLIST,1,[If we need to declare sys_errlist[] as external])
3611fi
3612
3613dnl Not cached since people are likely to change this
3614AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
3615AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
3616[AC_MSG_RESULT(yes)
3617AC_DEFINE(LIBRESOLV_DNS_TTL_HACK,1,[If libresolv.a has been hacked to export _dns_ttl_])],
3618AC_MSG_RESULT(no))
3619
3620if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
3621AC_MSG_CHECKING(for working statvfs() interface)
3622AC_TRY_COMPILE([
3623#include <stdlib.h>
3624#include <stdio.h>
3625#include <sys/types.h>
3626#include <sys/statvfs.h>
3627],
3628[
3629struct statvfs sfs;
3630sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
3631sfs.f_files = sfs.f_ffree = 0;
3632statvfs("/tmp", &sfs);
3633],
3634 ac_cv_func_statvfs=yes,
3635 ac_cv_func_statvfs=no)
3636AC_MSG_RESULT($ac_cv_func_statvfs)
3637if test "$ac_cv_func_statvfs" = "yes" ; then
3638 AC_DEFINE(HAVE_STATVFS,1,[If your system has statvfs(), and if it actually works!])
3639fi
3640fi
3641
3642dnl Detect what resolver fields we have available to use...
3643AC_CACHE_CHECK(for _res_ext.nsaddr_list, ac_cv_have_res_ext_nsaddr_list,
3644AC_TRY_COMPILE([
3645#if HAVE_SYS_TYPES_H
3646#include <sys/types.h>
3647#endif
3648#if HAVE_NETINET_IN_H
3649#include <netinet/in.h>
3650#endif
3651#if HAVE_ARPA_INET_H
3652#include <arpa/inet.h>
3653#endif
3654#if HAVE_ARPA_NAMESER_H
3655#include <arpa/nameser.h>
3656#endif
3657#if HAVE_RESOLV_H
3658#include <resolv.h>
3659#endif
3660],
3661[_res_ext.nsaddr_list[[0]].s_addr;],
3662ac_cv_have_res_ext_nsaddr_list="yes",
3663ac_cv_have_res_ext_nsaddr_list="no"))
3664if test "$ac_cv_have_res_ext_nsaddr_list" = "yes" ; then
3665 AC_DEFINE(_SQUID_RES_NSADDR6_LARRAY,_res_ext.nsaddr_list,[If _res_ext structure has nsaddr_list member])
3666 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,ns6count,[Nameserver Counter for IPv6 _res_ext])
3667fi
3668
3669if test "$_SQUID_RES_NSADDR6_LIST" = ""; then
3670AC_CACHE_CHECK(for _res._u._ext.nsaddrs, ac_cv_have_res_ext_nsaddrs,
3671AC_TRY_COMPILE([
3672#if HAVE_SYS_TYPES_H
3673#include <sys/types.h>
3674#endif
3675#if HAVE_NETINET_IN_H
3676#include <netinet/in.h>
3677#endif
3678#if HAVE_ARPA_INET_H
3679#include <arpa/inet.h>
3680#endif
3681#if HAVE_ARPA_NAMESER_H
3682#include <arpa/nameser.h>
3683#endif
3684#if HAVE_RESOLV_H
3685#include <resolv.h>
3686#endif
3687],
3688[_res._u._ext.nsaddrs[[0]]->sin6_addr;],
3689ac_cv_have_res_ext_nsaddrs="yes",
3690ac_cv_have_res_ext_nsaddrs="no"))
3691if test "$ac_cv_have_res_ext_nsaddrs" = "yes" ; then
3692 AC_DEFINE(_SQUID_RES_NSADDR6_LPTR,_res._u._ext.nsaddrs,[If _res structure has _ext.nsaddrs member])
3693 AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,_res._u._ext.nscount6,[Nameserver Counter for IPv6 _res])
3694fi
3695fi
3696
3697AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
3698AC_TRY_COMPILE([
3699#if HAVE_SYS_TYPES_H
3700#include <sys/types.h>
3701#endif
3702#if HAVE_NETINET_IN_H
3703#include <netinet/in.h>
3704#endif
3705#if HAVE_ARPA_INET_H
3706#include <arpa/inet.h>
3707#endif
3708#if HAVE_ARPA_NAMESER_H
3709#include <arpa/nameser.h>
3710#endif
3711#if HAVE_RESOLV_H
3712#include <resolv.h>
3713#endif
3714],
3715[_res.nsaddr_list[[0]];],
3716ac_cv_have_res_nsaddr_list="yes",
3717ac_cv_have_res_nsaddr_list="no"))
3718if test $ac_cv_have_res_nsaddr_list = "yes" ; then
3719 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.nsaddr_list,[If _res structure has nsaddr_list member])
3720 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
3721fi
3722
3723if test "$_SQUID_RES_NSADDR_LIST" = ""; then
3724AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
3725AC_TRY_COMPILE([
3726#if HAVE_SYS_TYPES_H
3727#include <sys/types.h>
3728#endif
3729#if HAVE_NETINET_IN_H
3730#include <netinet/in.h>
3731#endif
3732#if HAVE_ARPA_INET_H
3733#include <arpa/inet.h>
3734#endif
3735#if HAVE_ARPA_NAMESER_H
3736#include <arpa/nameser.h>
3737#endif
3738#if HAVE_RESOLV_H
3739#include <resolv.h>
3740#endif
3741],
3742[_res.ns_list[[0]].addr;],
3743ac_cv_have_res_ns_list="yes",
3744ac_cv_have_res_ns_list="no"))
3745if test $ac_cv_have_res_ns_list = "yes" ; then
3746 AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.ns_list,[If _res structure has ns_list member])
3747 AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res])
3748fi
3749fi
3750
3751dnl Squid now has .po translation capability, given the right toolkit
3752AX_WITH_PROG([PO2HTML],[po2html])
3753
3754dnl Squid now has limited locale handling ...
3755dnl on error pages
3756use_errlocale=yes
3757AC_ARG_ENABLE(auto-locale,
3758 AC_HELP_STRING([--disable-auto-locale],
3759 [This prevents Squid providing localized error pages based on the
3760 clients request headers.
3761 When disabled Squid requires explicit language configuration.]),
3762[ if test "$enableval" = "no" ; then
3763 use_errlocale=no
3764 fi
3765])
3766if test "$use_errlocale" = "yes" ; then
3767 AC_MSG_NOTICE([Enabling Multi-Language Support])
3768 AC_DEFINE(USE_ERR_LOCALES,1,[Use multi-language support on error pages])
3769else
3770 AC_MSG_WARN([Disabling Multi-Language Support])
3771 AC_DEFINE(USE_ERR_LOCALES,0,[Use multi-language support on error pages])
3772 dnl So we don't want to even attempt translation if its forcibly disabled.
3773 PO2HTML="off"
3774fi
3775AC_SUBST(PO2HTML)
3776
3777dnl Need the debugging version of malloc if available
3778XTRA_OBJS=''
3779if test "$ac_cv_lib_malloc_main" = "yes" ; then
3780 if test -r /usr/lib/debug/malloc.o ; then
3781 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3782 fi
3783 if test -r /usr/lib/debug/mallocmap.o ; then
3784 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3785 fi
3786fi
3787AC_SUBST(XTRA_OBJS)
3788
3789if test -z "$XTRA_LIBS"; then
3790 XTRA_LIBS="$LIBS"
3791 dnl minor cleanup
3792 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
3793 LIBS=''
3794fi
3795AC_SUBST(XTRA_LIBS)
3796
3797dnl Clean up after OSF/1 core dump bug
3798rm -f core
3799
3800AC_CONFIG_FILES([\
3801 Makefile \
3802 compat/Makefile \
3803 lib/Makefile \
3804 scripts/Makefile \
3805 scripts/RunCache \
3806 scripts/RunAccel \
3807 src/Makefile \
3808 src/base/Makefile \
3809 src/acl/Makefile \
3810 src/fs/Makefile \
3811 src/repl/Makefile \
3812 src/auth/Makefile \
3813 src/adaptation/Makefile \
3814 src/adaptation/icap/Makefile \
3815 src/adaptation/ecap/Makefile \
3816 src/esi/Makefile \
3817 src/icmp/Makefile \
3818 src/ip/Makefile \
3819 contrib/Makefile \
3820 snmplib/Makefile \
3821 icons/Makefile \
3822 errors/Makefile \
3823 test-suite/Makefile \
3824 doc/Makefile \
3825 helpers/Makefile \
3826 helpers/basic_auth/Makefile \
3827 helpers/basic_auth/LDAP/Makefile \
3828 helpers/basic_auth/MSNT/Makefile \
3829 helpers/basic_auth/NCSA/Makefile \
3830 helpers/basic_auth/PAM/Makefile \
3831 helpers/basic_auth/SMB/Makefile \
3832 helpers/basic_auth/mswin_sspi/Makefile \
3833 helpers/basic_auth/YP/Makefile \
3834 helpers/basic_auth/getpwnam/Makefile \
3835 helpers/basic_auth/multi-domain-NTLM/Makefile \
3836 helpers/basic_auth/SASL/Makefile \
3837 helpers/basic_auth/POP3/Makefile \
3838 helpers/basic_auth/DB/Makefile \
3839 helpers/basic_auth/squid_radius_auth/Makefile \
3840 helpers/digest_auth/Makefile \
3841 helpers/digest_auth/password/Makefile \
3842 helpers/digest_auth/ldap/Makefile \
3843 helpers/digest_auth/eDirectory/Makefile \
3844 helpers/ntlm_auth/Makefile \
3845 helpers/ntlm_auth/fakeauth/Makefile \
3846 helpers/ntlm_auth/no_check/Makefile \
3847 helpers/ntlm_auth/smb_lm/Makefile \
3848 helpers/ntlm_auth/smb_lm/smbval/Makefile \
3849 helpers/ntlm_auth/mswin_sspi/Makefile \
3850 helpers/negotiate_auth/Makefile \
3851 helpers/negotiate_auth/mswin_sspi/Makefile \
3852 helpers/external_acl/Makefile \
3853 helpers/external_acl/ip_user/Makefile \
3854 helpers/external_acl/ldap_group/Makefile \
3855 helpers/external_acl/session/Makefile \
3856 helpers/external_acl/unix_group/Makefile \
3857 helpers/external_acl/wbinfo_group/Makefile \
3858 helpers/external_acl/mswin_ad_group/Makefile \
3859 helpers/external_acl/mswin_lm_group/Makefile \
3860 tools/Makefile
3861])
3862
3863AC_CONFIG_SUBDIRS(lib/libTrie)
3864
3865# must configure libltdl subdir unconditionally for "make distcheck" to work
3866AC_CONFIG_SUBDIRS(lib/libLtdl)
3867
3868AC_OUTPUT