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