]> git.ipfire.org Git - thirdparty/squid.git/blob - configure.ac
merge from trunk r14597
[thirdparty/squid.git] / configure.ac
1 ## Copyright (C) 1996-2016 The Squid Software Foundation and contributors
2 ##
3 ## Squid software is distributed under GPLv2+ license and includes
4 ## contributions from numerous individuals and organizations.
5 ## Please see the COPYING and CONTRIBUTORS files for details.
6 ##
7
8 AC_INIT([Squid Web Proxy],[4.0.7-BZR],[http://bugs.squid-cache.org/],[squid])
9 AC_PREREQ(2.61)
10 AC_CONFIG_HEADERS([include/autoconf.h])
11 AC_CONFIG_AUX_DIR(cfgaux)
12 AC_CONFIG_SRCDIR([src/main.cc])
13 AM_INIT_AUTOMAKE([tar-ustar nostdinc subdir-objects])
14 AC_REVISION($Revision$)dnl
15 AC_PREFIX_DEFAULT(/usr/local/squid)
16 AM_MAINTAINER_MODE
17
18 m4_include([acinclude/ax_with_prog.m4])
19 m4_include([acinclude/init.m4])
20 m4_include([acinclude/squid-util.m4])
21 m4_include([acinclude/compiler-flags.m4])
22 m4_include([acinclude/os-deps.m4])
23 m4_include([acinclude/krb5.m4])
24 m4_include([acinclude/pam.m4])
25 m4_include([acinclude/pkg.m4])
26 m4_include([acinclude/lib-checks.m4])
27 m4_include([acinclude/ax_cxx_compile_stdcxx_11.m4])
28 m4_include([acinclude/ax_cxx_0x_types.m4])
29
30 PRESET_CFLAGS="$CFLAGS"
31 PRESET_CXXFLAGS="$CXXFLAGS"
32 PRESET_LDFLAGS="$LDFLAGS"
33
34 dnl Set default LDFLAGS
35 if test "x$LDFLAGS" = "x" ; then
36 LDFLAGS="-g"
37 fi
38
39 # Check for GNU cc
40 AC_PROG_CC
41 AM_PROG_CC_C_O
42 AC_PROG_CXX
43 AC_LANG([C++])
44 AC_CANONICAL_HOST
45
46 # Clang 3.2 on some CPUs requires -march-native to detect correctly.
47 # GCC 4.3+ can also produce faster executables when its used.
48 # But building inside a virtual machine environment has been found to
49 # cause random Illegal Instruction errors due to mis-detection of CPU.
50 AC_ARG_ENABLE(arch-native,
51 AS_HELP_STRING([--disable-arch-native],[Some compilers offer CPU-specific
52 optimizations with the -march=native parameter.
53 This flag disables the optimization. The default is to
54 auto-detect compiler support and use where available.]), [
55 SQUID_YESNO([$enableval],
56 [Unrecognized argument to --disable-arch-native: $enableval])
57 ])
58 AC_MSG_NOTICE([CPU arch native optimization enabled: ${enable_arch_native:=auto}])
59 if test "x${enable_arch_native}" != "xno"; then
60 SQUID_CC_CHECK_ARGUMENT([squid_cv_check_marchnative],[-march=native])
61 fi
62
63 # might be cross-compiling.
64 # NP: BUILDCXXFLAGS defined at the end of configure after CXXFLAGS fully known.
65 AC_ARG_VAR([BUILDCXX],[path to compiler for building compile-time tools. e.g. cf_gen])
66 if test "x$HOSTCXX" != "x" -a "x$BUILDCXX" = "x"; then
67 AC_MSG_WARN([Cross-compiling with HOSTCXX is deprecated. Uses BUILDCXX instead.])
68 BUILDCXX="$HOSTCXX"
69 fi
70 if test "x$BUILDCXX" = "x"; then
71 BUILDCXX="$CXX"
72 if test "x$squid_cv_check_marchnative" = "xyes"; then
73 CXXFLAGS="$CXXFLAGS -march=native"
74 fi
75 fi
76 AC_SUBST(BUILDCXX)
77
78 AC_MSG_CHECKING([simplified host os])
79 simple_host_os=`echo $host_os|sed 's/[0-9].*//g;s/-.*//g'`
80 squid_host_os_version=`echo $host_os|tr -d "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-"`
81 if test -n "$squid_host_os_version"; then
82 squid_host_os="`echo $simple_host_os| sed s/$squid_host_os_version//g`"
83 else
84 squid_host_os="$simple_host_os"
85 fi
86 AC_MSG_RESULT($squid_host_os (version $squid_host_os_version))
87 # on windows squid_host_os is either mingw or cygwin, version is 32
88
89 # this needs to be before any test is run, to have more standard
90 # functions available on some Unix sysems (e.g. Solaris)
91 if test "x$squid_host_os" = "solaris" -a "x$GCC" != "x" ; then
92 AC_USE_SYSTEM_EXTENSIONS
93 fi
94
95 # Check for C++11 compiler support
96 AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
97
98 # test for programs
99 AC_PROG_RANLIB
100 AC_PROG_CPP
101 AC_PROG_INSTALL
102 AC_PROG_LN_S
103 AC_PROG_EGREP
104
105 AC_PATH_PROG(SH, sh, /bin/sh)
106 AC_PATH_PROG(FALSE, false, /usr/bin/false)
107 AC_PATH_PROG(TRUE, true, /usr/bin/true)
108 AC_PATH_PROG(MV, mv, $FALSE)
109 AC_PATH_PROG(MKDIR, mkdir, $FALSE)
110 AC_PATH_PROG(LN, ln, cp)
111 AC_PATH_PROG(CHMOD, chmod, $FALSE)
112 AC_PATH_PROG(TR, tr, $FALSE)
113 AC_PATH_PROG(RM, rm, $FALSE)
114 AC_PATH_PROG(CPPUNITCONFIG, cppunit-config, false)
115 dnl Libtool 2.2.6 requires: rm -f
116 RM="$RM -f"
117
118 AC_PATH_PROG(PERL, perl, none)
119 if test "x$ac_cv_path_PERL" = "xnone"; then
120 AC_MSG_FAILURE([Perl is required to compile Squid. Please install Perl and then re-run configure ])
121 fi
122 AC_PATH_PROG(POD2MAN, pod2man, $FALSE)
123 AM_CONDITIONAL(ENABLE_POD2MAN_DOC, test "x${ac_cv_path_POD2MAN}" != "x$FALSE")
124
125 dnl set $(AR) if not provided by the build environment
126 if test "x$AR" = "x"; then
127 AC_PATH_PROG(AR, ar, $FALSE)
128 fi
129 AR_R="$AR r"
130 AC_SUBST(AR_R)
131
132 AC_PATH_PROG(LINUXDOC, linuxdoc, $FALSE)
133 AM_CONDITIONAL(ENABLE_RELEASE_DOCS, test "x${ac_cv_path_LINUXDOC}" != "x$FALSE")
134
135 # pre-define DEFAULT_PREFIX, some modules need it.
136 if test "${prefix}" = "NONE" ; then
137 squid_prefix=$ac_default_prefix
138 else
139 squid_prefix=$prefix
140 fi
141 AC_DEFINE_UNQUOTED(DEFAULT_PREFIX,[$squid_prefix],[The install prefix])
142
143 AC_ARG_ENABLE(strict-error-checking,
144 AS_HELP_STRING([--disable-strict-error-checking],[By default squid is compiled
145 with all possible static compiler error-checks enabled.
146 This flag disables the behavior]), [
147 SQUID_YESNO([$enableval],
148 [Unrecognized argument to --disable-strict-error-checking: $enableval])
149 ])
150 AC_MSG_NOTICE([strict error checking enabled: ${enable_strict_error_checking:=yes}])
151
152 AC_MSG_CHECKING(whether to use loadable modules)
153 AC_ARG_ENABLE(loadable-modules,
154 AS_HELP_STRING([--disable-loadable-modules],[do not support loadable modules]) , [
155 SQUID_YESNO([$enableval],
156 [Unrecognized argument to --disable-loadable-modules: $enableval])
157 ])
158 AM_CONDITIONAL(ENABLE_LOADABLE_MODULES, test "x${enable_loadable_modules:=yes}" = "xyes")
159 AC_MSG_RESULT([$enable_loadable_modules])
160
161 if test "x$enable_loadable_modules" = "xyes";
162 then
163 AC_DEFINE(USE_LOADABLE_MODULES, 1, [Support Loadable Modules])
164 AC_ENABLE_SHARED
165 else
166 AC_DISABLE_SHARED
167 fi
168
169 # LT_INIT requires libtool v2, might as well state it loud
170 LT_PREREQ([2.2])
171 LT_INIT([dlopen],[disable-shared])
172 if ! test "${ac_top_build_prefix}" = "";
173 then
174 # LTDL v3-v7 macros assume the autoconf 2.62 variable top_build_prefix is defined
175 # But from autoconf 2.64 its called ac_top_build_prefix and not automatically added to the Makefile
176 # This fixes Linux LTDLv3-v7, and BSD LTDL v2.2
177 top_build_prefix=${ac_top_build_prefix}
178 AC_SUBST(top_build_prefix)
179 fi
180 LTDL_INIT
181
182 dnl LibTool environment is now prepared for setup. Check that it is usable and initialize.
183 LT_LIB_DLLOAD
184
185 # Do we need these unconditionally for "make distcheck" to work?
186 AC_SUBST(INCLTDL)
187 AC_SUBST(LIBLTDL)
188
189 if test "x$enable_loadable_modules" = "xyes";
190 then
191 # Why is this needed? Should not LT_INIT (or LT_LIB_DLLOAD) from libtool do that?
192 LIBADD_DL=${lt_cv_dlopen_libs}
193 AC_SUBST([LIBADD_DL])
194 fi
195
196 SQUID_CC_GUESS_VARIANT
197 SQUID_CC_GUESS_OPTIONS
198
199 dnl find out the exe extension for this platform.
200 dnl If it is not empty, use it for CGI as well.
201 AC_EXEEXT
202 AC_OBJEXT
203
204 if test "x$EXEEXT" = "x" ; then
205 CGIEXT=".cgi"
206 else
207 # automake automatically adds .exe when installing binaries
208 CGIEXT=""
209 fi
210 AC_SUBST(CGIEXT)
211
212 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC,[test "x$squid_host_os" = "xmingw"])
213 AM_CONDITIONAL(ENABLE_WIN32_IPC,[test "x$squid_host_os" = "xmingw"])
214
215 case "$squid_host_os" in
216 mingw)
217 AC_PATH_PROG(WIN32_PSAPI, psapi.dll, none)
218 CFLAGS="$CFLAGS -mthreads"
219 CXXFLAGS="$CXXFLAGS -mthreads -static-libgcc -static-libstdc++"
220 if test "x$ac_cv_path_WIN32_PSAPI" = "xnone"; then
221 AC_MSG_NOTICE([PSAPI.DLL is recommended to run Squid on Windows NT Platform])
222 AC_MSG_NOTICE([Please see PSAPI.DLL section on doc/win32-relnotes.html.])
223 else
224 AC_DEFINE(HAVE_WIN32_PSAPI,1,[Define if you have PSAPI.DLL on Windows systems])
225 LIBS="$LIBS -lpsapi"
226 fi
227 MINGW_LIBS="-lmingwex"
228 AC_SUBST(MINGW_LIBS)
229 ;;
230 freebsd)
231 # FreeBSD places local libraries and packages in /usr/local
232 CFLAGS="$CFLAGS -I/usr/local/include"
233 CXXFLAGS="$CXXFLAGS -I/usr/local/include"
234 LDFLAGS="$LDFLAGS -L/usr/local/lib -Wl,-R/usr/local/lib"
235 ;;
236 *)
237 ;;
238 esac
239
240 dnl Substitutions
241 AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host",[Host type from configure])
242
243 AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args",
244 [configure command line used to configure Squid])
245
246 CACHE_EFFECTIVE_USER="nobody"
247 AC_ARG_WITH(default-user,
248 AS_HELP_STRING([--with-default-user=USER],[System user account for squid permissions. Default: nobody]),
249 [ CACHE_EFFECTIVE_USER="$withval" ]
250 )
251 AC_SUBST(CACHE_EFFECTIVE_USER)
252
253 DEFAULT_LOG_DIR="$localstatedir/logs"
254 AC_ARG_WITH(logdir,
255 AS_HELP_STRING([--with-logdir=PATH],
256 [Default location for squid logs. default: PREFIX/var/logs]), [
257 case $withval in
258 yes|no)
259 AC_MSG_ERROR( --with-logdir requires a directory PATH. --with-logdir=PATH )
260 ;;
261 *)
262 DEFAULT_LOG_DIR="$withval"
263 ;;
264 esac
265 ]
266 )
267 AC_SUBST(DEFAULT_LOG_DIR)
268
269 DEFAULT_PID_FILE="$localstatedir/run/@SERVICE_NAME@.pid"
270 AC_ARG_WITH(pidfile,
271 AS_HELP_STRING([--with-pidfile=PATH],
272 [Default location for squid pid file. Default: PREFIX/var/run/squid.pid]), [
273 case $withval in
274 yes|no)
275 AC_MSG_ERROR( --with-pidfile requires a file PATH. --with-pidfile=PATH )
276 ;;
277 *)
278 DEFAULT_PID_FILE="$withval"
279 ;;
280 esac
281 ])
282 AC_SUBST(DEFAULT_PID_FILE)
283
284 DEFAULT_SWAP_DIR="$localstatedir/cache/squid"
285 AC_ARG_WITH(swapdir,
286 AS_HELP_STRING([--with-swapdir=PATH],
287 [Default location for squid cache directories. Default: PREFIX/var/cache/squid]), [
288 case $withval in
289 yes|no)
290 AC_MSG_ERROR( --with-swapdir requires a directory PATH. --with-swapdir=PATH )
291 ;;
292 *)
293 DEFAULT_SWAP_DIR="$withval"
294 ;;
295 esac
296 ])
297 AC_SUBST(DEFAULT_SWAP_DIR)
298
299 dnl Set Default CFLAGS
300 if test "x$PRESET_CFLAGS" = "x"; then
301 if test "$squid_cv_compiler" = "gcc"; then
302 case "$host" in
303 *-sun-sunos*)
304 # sunos has too many warnings for this to be useful
305 # motorola too
306 ;;
307 *m88k*)
308 # Motorola cc/ld does not like -02 but is ok on -O
309 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
310 ;;
311 *)
312 CFLAGS="$squid_cv_cc_option_wall $CFLAGS"
313 ;;
314 esac
315 else
316 case "$host" in
317 *mips-sgi-irix6.*)
318 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
319 CFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
320 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
321 -Wl,-woff,85,-woff,84,-woff,134 \
322 -nostdinc -I/usr/include -D_BSD_SIGNALS $CFLAGS"
323 CXXFLAGS="$squid_cv_cc_option_optimize -OPT:Olimit=0:space=OFF \
324 -woff 1009,1014,1110,1116,1183,1185,1188,1204,1230,1233,1355 \
325 -Wl,-woff,85,-woff,84,-woff,134 \
326 -nostdinc -I/usr/include -D_BSD_SIGNALS $CXXFLAGS"
327 ;;
328 *)
329 ;;
330 esac
331 fi
332 fi
333
334 dnl set squid required flags
335 if test "$squid_cv_compiler" = "gcc"; then
336 case "$squid_host_os" in
337 mingw)
338 dnl Guido Serassio (serassio@squid-cache.org) 20070811
339 dnl Using the latest MinGW (gcc 3.4.5 + mingw-runtime 3.13) cannot build with
340 dnl -Werror -Wmissing-prototypes -Wmissing-declarations
341 dnl TODO: check if the problem will be present in any other newer MinGW release.
342 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow"
343 ;;
344 *)
345 SQUID_CFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing-declarations -Wcomments -Wshadow"
346 ;;
347 esac
348 SQUID_CXXFLAGS="$squid_cv_cc_option_wall -Wpointer-arith -Wwrite-strings -Wcomments -Wshadow -Woverloaded-virtual"
349 else
350 SQUID_CFLAGS=
351 SQUID_CXXFLAGS=
352 fi
353
354 dnl CentOS (and RHEL) still define ntohs() using deprecated C++ features
355 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_wno_deprecated_register],[-Werror -Wno-deprecated-register],[[#include <arpa/inet.h>]],[[int fox=ntohs(1);]])
356
357 if test "x$enable_strict_error_checking" != "xno"; then
358 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_option_werror"
359 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cxx_option_werror"
360 fi
361
362 if test "x$ac_cv_require_wno_deprecated_register" = "xyes"; then
363 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -Wno-deprecated-register"
364 fi
365
366 # squid_cv_cc_arg_pipe is set by SQUID_CC_GUESS_OPTIONS
367 SQUID_CXXFLAGS="$SQUID_CXXFLAGS $squid_cv_cc_arg_pipe"
368 SQUID_CFLAGS="$SQUID_CFLAGS $squid_cv_cc_arg_pipe"
369
370 # possibly include some build info tag into squid -v
371 SQUID_EMBED_BUILD_INFO
372
373 AC_ARG_ENABLE(optimizations,
374 AS_HELP_STRING([--disable-optimizations],
375 [Do not compile Squid with compiler optimizations enabled.
376 Optimization is good for production builds, but not
377 good for debugging. During development, use
378 --disable-optimizations to reduce compilation times
379 and allow easier debugging. This option implies
380 --disable-inline]), [
381 if test "x$enableval" = "xno" ; then
382 AC_MSG_NOTICE([Disabling compiler optimizations (-O flag)])
383 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
384 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-O[[0-9]]*//'`"
385 enable_inline="no"
386 fi
387 ])
388
389 AH_TEMPLATE(_USE_INLINE_,[Include inline methods into header file])
390 AC_ARG_ENABLE(inline,
391 AS_HELP_STRING([--disable-inline],
392 [Do not compile trivial methods as inline. Squid
393 is coded with much of the code able to be inlined.
394 Inlining is good for production builds, but not
395 good for development. During development, use
396 --disable-inline to reduce compilation times and
397 allow incremental builds to be quick. For
398 production builds, or load tests, use
399 --enable-inline to have squid make all trivial
400 methods inlinable by the compiler.]), [
401 SQUID_YESNO([$enableval],
402 [Unrecognized argument to --disable-inline: $enableval])
403 ])
404 AC_MSG_NOTICE([inlining optimizations enabled: ${enable_inline:=yes}])
405 SQUID_DEFINE_BOOL(_USE_INLINE_,$enable_inline,
406 [Include inline methods into header file])
407 # to be used by sub-commands
408 export enable_inline
409
410 AC_ARG_ENABLE(debug-cbdata,
411 AS_HELP_STRING([--enable-debug-cbdata],
412 [Provide some debug information in cbdata]), [
413 SQUID_YESNO([$enableval],
414 [unrecognized argument to --enable-debug-cbdata: $enableval])
415 ])
416 SQUID_DEFINE_BOOL(USE_CBDATA_DEBUG,${enable_debug_cbdata:=no},
417 [Enable support for cbdata debug information])
418 AC_MSG_NOTICE([cbdata debugging enabled: $enable_debug_cbdata])
419
420
421 dnl Nasty hack to get autoconf 2.64 on Linux to run.
422 dnl all other uses of RUN_IFELSE are wrapped inside CACHE_CHECK which breaks on 2.64
423 AC_RUN_IFELSE([AC_LANG_SOURCE([[ int main(int argc, char **argv) { return 0; } ]])],[],[],[:])
424
425 AH_TEMPLATE(XMALLOC_STATISTICS,[Define to have malloc statistics])
426 AC_ARG_ENABLE(xmalloc-statistics,
427 AS_HELP_STRING([--enable-xmalloc-statistics],
428 [Show malloc statistics in status page]), [
429 SQUID_YESNO([$enableval],
430 [unrecognized argument to --enable-xmalloc-statistics: $enableval])
431 ])
432 SQUID_DEFINE_BOOL(XMALLOC_STATISTICS,${enable_xmalloc_statistics:=no},
433 [Show malloc statistics in status page])
434 AC_MSG_NOTICE([xmalloc stats display: $enable_xmalloc_statistics])
435
436 squid_opt_aufs_threads=""
437 AC_ARG_WITH(aufs-threads,
438 AS_HELP_STRING([--with-aufs-threads=N_THREADS],
439 [Tune the number of worker threads for the aufs object store.]), [
440 case $withval in
441 [[0-9]]*)
442 squid_opt_aufs_threads=$withval
443 ;;
444 *)
445 AC_MSG_ERROR(--with-aufs-threads expects a numeric argument)
446 ;;
447 esac
448 ])
449 if test "x$squid_opt_aufs_threads" != "x"; then
450 AC_MSG_NOTICE([With $squid_opt_aufs_threads aufs threads])
451 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$squid_opt_aufs_threads,
452 [Defines how many threads aufs uses for I/O])
453 fi
454
455 AC_ARG_WITH(dl, AS_HELP_STRING([--with-dl],[Use dynamic linking]))
456 if test "x$with_dl" = "xyes"; then
457 AC_MSG_NOTICE([With dl])
458 fi
459
460 ## check for atomics library before anything that might need it
461 # AC_SEARCH_LIBS pollutes LIBS
462 SQUID_STATE_SAVE(LIBATOMIC)
463 AC_SEARCH_LIBS([__atomic_load_8],[atomic],[
464 test "$ac_res" = "none required" || ATOMICLIB=$ac_res],[])
465 SQUID_STATE_ROLLBACK(LIBATOMIC)
466 AC_SUBST(ATOMICLIB)
467
468 AC_SEARCH_LIBS([shm_open], [rt])
469 if test "x$ac_cv_search_shm_open" != "xno" ; then
470 AC_DEFINE(HAVE_SHM,1,[Support shared memory features])
471 fi
472
473 AC_MSG_CHECKING([for DiskIO modules to be enabled])
474 squid_disk_module_candidates=""
475 squid_opt_enable_diskio="auto" #values: no, yes, "auto"(=yes+detect modules)
476 AC_ARG_ENABLE(disk-io,
477 AS_HELP_STRING([--enable-disk-io="list of modules"],
478 [Build support for the list of disk I/O modules.
479 Set without a value or omitted, all available modules will be built.
480 See src/DiskIO for a list of available modules, or
481 Programmers Guide section on DiskIO
482 for details on how to build your custom disk module]), [
483 case $enableval in
484 yes)
485 ${TRUE}
486 #do nothing, "auto" is ok
487 ;;
488 no)
489 squid_opt_enable_diskio="no"
490 ;;
491 *)
492 squid_opt_enable_diskio="yes"
493 squid_disk_module_candidates=" `echo $enableval| sed -e 's/,/ /g;s/ */ /g'` "
494 SQUID_CLEANUP_MODULES_LIST([squid_disk_module_candidates])
495 ;;
496 esac
497 ])
498
499 # if requested to autodetect, find out what we have
500 if test "x$squid_opt_enable_diskio" = "xauto"; then
501 squid_opt_enable_diskio="yes"
502 SQUID_LOOK_FOR_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
503 if test "x$ac_cv_search_shm_open" = "xno" ; then
504 # disable IpcIo
505 squid_disk_module_candidates=`echo $squid_disk_module_candidates|sed 's/IpcIo//'`
506 fi
507 fi
508
509 AC_MSG_RESULT([${squid_disk_module_candidates:-none}])
510 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/DiskIO],[squid_disk_module_candidates])
511 SQUID_DEFINE_BOOL(USE_DISKIO,$squid_opt_enable_diskio,
512 [DiskIO modules are expected to be available.])
513
514
515
516 dnl Some autoconf.h defines we might enable later...
517 AC_ARG_WITH(pthreads,AS_HELP_STRING([--without-pthreads],[Disable POSIX Threads]))
518 AC_ARG_WITH(aio, AS_HELP_STRING([--without-aio],[Do not use POSIX AIO. Default: auto-detect]))
519 ENABLE_WIN32_AIOPS=0
520 squid_opt_use_aio=
521 squid_opt_use_diskthreads=
522 AIOLIB=
523
524 dnl Setup the module paths etc.
525 DISK_LIBS=
526 DISK_MODULES=
527 AH_TEMPLATE(HAVE_DISKIO_MODULE_AIO, [Whether POSIX AIO Disk I/O module is built])
528 AH_TEMPLATE(HAVE_DISKIO_MODULE_BLOCKING, [Whether Blocking Disk I/O module is built])
529 AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKDAEMON, [Whether DiskDaemon Disk I/O module is built])
530 AH_TEMPLATE(HAVE_DISKIO_MODULE_DISKTHREADS, [Whether DiskThreads Disk I/O module is built])
531 AH_TEMPLATE(HAVE_DISKIO_MODULE_IPCIO, [Whether IpcIo Disk I/O module is built])
532 AH_TEMPLATE(HAVE_DISKIO_MODULE_MMAPPED, [Whether Mmapped Disk I/O module is built])
533 for module in $squid_disk_module_candidates none; do
534 # maybe not needed
535 if test "x$module" = "xnone"; then
536 continue
537 fi
538 if ! test -d "$srcdir/src/DiskIO/$module"; then
539 AC_MSG_ERROR(disk-io $module does not exist)
540 fi
541 case "$module" in
542
543 AIO)
544 dnl Check for POSIX AIO availability
545 squid_opt_use_aio="yes"
546 AIOLIB=
547 if test "x$with_aio" != "xno"; then
548 have_aio_header=no
549 AC_CHECK_HEADERS(aio.h,[have_aio_header=yes])
550 dnl On some systems POSIX AIO functions are in librt
551 dnl On some systems POSIX AIO functions are in libaio
552 AC_CHECK_LIB(rt,aio_read,[AIOLIB="-lrt"],AC_CHECK_LIB(aio,aio_read,[AIOLIB="-laio"],[]))
553 dnl Enable AIO if the library and headers are found
554 if test "x$AIOLIB" != "x" && test "x$have_aio_header" = "xyes"; then
555 AC_MSG_NOTICE([Native POSIX AIO support detected.])
556 squid_opt_use_aio="yes"
557 else
558 dnl Windows does things differently. We provide wrappers.
559 dnl TODO: Windows really needs its own DiskIO module or its Overlaped IO
560 case "$squid_host_os" in
561 mingw)
562 squid_opt_use_aio="yes"
563 AC_MSG_NOTICE([Windows being built. Maybe-enable POSIX AIO.])
564 ;;
565 *)
566 AC_MSG_NOTICE([Native POSIX AIO support not detected. AIO automatically disabled.])
567 squid_opt_use_aio="no"
568 ;;
569 esac
570 fi
571 else
572 AC_MSG_NOTICE([POSIX AIO support manually disabled.])
573 squid_opt_use_aio="no"
574 fi
575 dnl Use the POSIX AIO pieces if we actually need them.
576 if test "x$squid_opt_use_aio" = "xyes" ; then
577 DISK_MODULES="$DISK_MODULES AIO"
578 AC_DEFINE([HAVE_DISKIO_MODULE_AIO],1,[POSIX AIO Disk I/O module is built])
579 case "$squid_host_os" in
580 mingw)
581 ENABLE_WIN32_AIO=1
582 AC_MSG_NOTICE([Replacing AIO DiskIO module with: Windows overlapped I/O support])
583 ;;
584 *)
585 AC_MSG_NOTICE([Enabling AIO DiskIO module])
586 ;;
587 esac
588 else
589 AC_MSG_NOTICE([AIO DiskIO Module disabled. Missing POSIX AIO support.])
590 squid_disk_module_candidates_AIO=no
591 fi
592 ;;
593
594 Blocking)
595 AC_MSG_NOTICE([Enabling Blocking DiskIO module])
596 DISK_MODULES="$DISK_MODULES Blocking"
597 AC_DEFINE([HAVE_DISKIO_MODULE_BLOCKING],1,[Blocking Disk I/O module is built])
598 ;;
599
600 DiskDaemon)
601 case "$squid_host_os" in
602 mingw)
603 AC_MSG_NOTICE(["DiskDaemon not supported on MinGW"])
604 squid_disk_module_candidates_DiskDaemon=no
605 ;;
606 *)
607 AC_MSG_NOTICE([Enabling DiskDaemon DiskIO module])
608 DISK_MODULES="$DISK_MODULES DiskDaemon"
609 AC_DEFINE([HAVE_DISKIO_MODULE_DISKDAEMON],1,[DiskDaemon Disk I/O module is built])
610 ;;
611 esac
612 ;;
613
614 DiskThreads)
615 squid_opt_use_diskthreads="yes"
616 LIBPTHREADS=
617 SQUID_STATE_SAVE([diskthreads_state],[SQUID_CFLAGS SQUID_CXXFLAGS])
618 if test "x$with_pthreads" != "xno"; then
619 dnl TODO: this needs to be extended to handle more systems and better
620 dnl REF: http://www.openldap.org/lists/openldap-bugs/200006/msg00070.html
621 dnl REF: http://autoconf-archive.cryp.to/acx_pthread.html
622 case "$squid_host_os" in
623 mingw)
624 ENABLE_WIN32_AIOPS=1
625 AC_MSG_NOTICE([Windows threads support automatically enabled])
626 ;;
627 freebsd)
628 if test `echo "$squid_host_os_version" | tr -d .` -lt 70 ; then
629 AC_MSG_NOTICE(pthread library requires FreeBSD 7 or later)
630 squid_opt_use_diskthreads="no"
631 else
632 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
633 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
634 if test "x$GCC" = "xyes" -a "x$PRESET_LDFLAGS" = "x" ; then
635 LDFLAGS="$LDFLAGS -pthread"
636 fi
637 fi
638 ;;
639 openbsd)
640 if test `echo "$squid_host_os_version" | tr -d .` -lt 52 ; then
641 AC_MSG_NOTICE(pthread library requires OpenBSD 5.2 or later)
642 squid_opt_use_diskthreads="no"
643 else
644 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
645 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
646 LDFLAGS="$LDFLAGS -lpthread"
647 fi
648 ;;
649 solaris)
650 if test "x$GCC" = "xyes" ; then
651 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -pthreads"
652 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -pthreads"
653 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
654 AC_MSG_NOTICE(pthread library required but cannot be found.)
655 squid_opt_use_diskthreads="no"
656 ])
657 else
658 dnl test for -lpthread first. libc version is a stub apparently on Solaris.
659 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT -lpthread"
660 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT -lpthread"
661 AC_SEARCH_LIBS([pthread_create],[pthread thread],[
662 LIBPTHREADS="" #in LIBS
663 ],[
664 AC_MSG_NOTICE(pthread library required but cannot be found.)
665 squid_opt_use_diskthreads="no"
666 ])
667 fi
668 ;;
669 *)
670 SQUID_CFLAGS="$SQUID_CFLAGS -D_REENTRANT"
671 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_REENTRANT"
672 AC_CHECK_LIB(pthread, pthread_create ,[LIBPTHREADS="-lpthread"], [
673 AC_MSG_NOTICE(pthread library required but cannot be found.)
674 squid_opt_use_diskthreads="no"
675 ])
676 ;;
677 esac
678 else
679 AC_MSG_NOTICE([Native pthreads support manually disabled.])
680 squid_opt_use_diskthreads="no"
681 fi
682 if test "x$squid_opt_use_diskthreads" = "xyes" ; then
683 AC_MSG_NOTICE([Enabling DiskThreads DiskIO module])
684 DISK_MODULES="$DISK_MODULES DiskThreads"
685 AC_DEFINE([HAVE_DISKIO_MODULE_DISKTHREADS],1,[DiskThreads Disk I/O module is built])
686 else
687 AC_MSG_NOTICE([Native pthreads support disabled. DiskThreads module automaticaly disabled.])
688 SQUID_STATE_ROLLBACK([diskthreads_state])
689 squid_disk_module_candidates_DiskThreads=no
690 fi
691 ;;
692
693 IpcIo)
694 if test "x$ac_cv_search_shm_open" = "xno" ; then
695 AC_MSG_NOTICE([DiskIO IpcIo module requires shared memory support])
696 squid_disk_module_candidates_IpcIo=no
697 else
698 AC_MSG_NOTICE([Enabling IpcIo DiskIO module])
699 DISK_MODULES="$DISK_MODULES IpcIo"
700 AC_DEFINE([HAVE_DISKIO_MODULE_IPCIO],1,[IpcIo Disk I/O module is built])
701 fi
702 ;;
703
704 Mmapped)
705 dnl TODO: use availability of sys/mman.h and/or mmap to define
706 dnl OR support windows mmap functions
707 if test "x$squid_host_os" = "xmingw" ; then
708 AC_MSG_NOTICE([Mmapped DiskIO is not available on Mingw])
709 squid_disk_module_candidates_Mmapped=no
710 else
711 AC_MSG_NOTICE([Enabling Mmapped DiskIO module])
712 DISK_MODULES="$DISK_MODULES Mmapped"
713 AC_DEFINE([HAVE_DISKIO_MODULE_MMAPPED],1,[Mmapped Disk I/O module is built])
714 fi
715 ;;
716
717 *)
718 AC_MSG_NOTICE([Enabling $module DiskIO module])
719 DISK_LIBS="$DISK_LIBS lib${module}.la"
720 DISK_MODULES="$DISK_MODULES ${module}"
721 ;;
722 esac
723 done
724 AC_MSG_NOTICE([IO Modules built: $DISK_MODULES])
725 AC_SUBST(DISK_MODULES)
726 AC_SUBST(DISK_LIBS)
727 AM_CONDITIONAL([ENABLE_DISKIO_AIO], [test "x$squid_disk_module_candidates_AIO" = "xyes"])
728 AC_SUBST(AIOLIB)
729 AM_CONDITIONAL([ENABLE_WIN32_AIO], [test "x$squid_disk_module_candidates_AIO" = "xyes" -a "x$ENABLE_WIN32_AIO" = "x1"])
730 AM_CONDITIONAL([ENABLE_DISKIO_BLOCKING], [test "x$squid_disk_module_candidates_Blocking" = "xyes"])
731 AM_CONDITIONAL([ENABLE_DISKIO_DISKDAEMON], [test "x$squid_disk_module_candidates_DiskDaemon" = "xyes"])
732 AM_CONDITIONAL([ENABLE_DISKIO_DISKTHREADS], [test "x$squid_disk_module_candidates_DiskThreads" = "xyes"])
733 AC_SUBST(LIBPTHREADS)
734 AM_CONDITIONAL([ENABLE_WIN32_AIOPS], [test "x$squid_disk_module_candidates_DiskThreads" = "xyes" -a "x$ENABLE_WIN32_AIOPS" = "x1"])
735 AM_CONDITIONAL([ENABLE_DISKIO_IPCIO], [test "x$squid_disk_module_candidates_IpcIo" = "xyes"])
736 AM_CONDITIONAL([ENABLE_DISKIO_MMAPPED], [test "x$squid_disk_module_candidates_Mmapped" = "xyes"])
737
738
739 dnl Check what Storage formats are wanted.
740 dnl This version will error out with a message saying why if a required DiskIO is missing.
741 squid_opt_enable_storeio=auto
742 AC_ARG_ENABLE([storeio],
743 AS_HELP_STRING([--enable-storeio="list of modules"],
744 [Build support for the list of store I/O modules.
745 The default is only to build the "ufs" module.
746 See src/fs for a list of available modules, or
747 Programmers Guide section <not yet written>
748 for details on how to build your custom store module]), [
749 case $enableval in
750 yes)
751 squid_opt_enable_storeio=auto
752 ;;
753 no)
754 squid_opt_enable_storeio=no
755 ;;
756 *)
757 squid_opt_enable_storeio=yes
758 squid_storeio_module_candidates="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
759 # ufs is really always needed as it has low-level routines
760 # if it is a dupe it will be cleaned-up later
761 squid_storeio_module_candidates="$squid_storeio_module_candidates ufs"
762 ;;
763 esac
764 ])
765 if test "x$squid_opt_enable_storeio" = "xauto"; then
766 squid_opt_enable_storeio=yes
767 AC_MSG_CHECKING([for available StoreIO modules])
768 SQUID_LOOK_FOR_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
769 AC_MSG_RESULT([$squid_storeio_module_candidates])
770 fi
771
772 SQUID_CLEANUP_MODULES_LIST([squid_storeio_module_candidates])
773 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/fs],[squid_storeio_module_candidates])
774 AC_MSG_NOTICE([Store modules built: $squid_storeio_module_candidates])
775
776 for fs in $squid_storeio_module_candidates none; do
777 case "$fs" in
778 diskd)
779 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
780 "$squid_disk_module_candidates_DiskDaemon" != "yes" ; then
781 AC_MSG_ERROR([Storage diskd module requires DiskIO module: Blocking or DiskDaemon])
782 fi
783 ;;
784 aufs)
785 if test "x$squid_disk_module_candidates_Blocking" != "xyes" -a \
786 "$squid_disk_module_candidates_DiskThreads" != "yes" ; then
787 AC_MSG_ERROR([Storage module aufs requires DiskIO module: Blocking or DiskThreads])
788 fi
789 ;;
790 rock)
791 if test "x$squid_disk_module_candidates_IpcIo" != "xyes" -a \
792 "x$squid_disk_module_candidates_Blocking" != "xyes"; then
793 AC_MSG_ERROR([Storage module Rock requires IpcIo or Blocking DiskIO module])
794 fi
795 squid_do_build_rock=true
796 ;;
797 ufs)
798 squid_do_build_ufs=true
799 ;;
800 esac
801 done
802
803 AM_CONDITIONAL(HAVE_FS_UFS,[test "x$squid_do_build_ufs" = "xtrue" ])
804 AM_CONDITIONAL(HAVE_FS_ROCK,[test "x$squid_do_build_rock" = "xtrue" ])
805 dnl hack: need to define those even if not used in the build system to
806 dnl make sure that global FS objects are linked to the squid binary.
807 AH_TEMPLATE(HAVE_FS_UFS, "Define to 1 if ufs filesystem module is build")
808 AH_TEMPLATE(HAVE_FS_AUFS, "Define to 1 if aufs filesystem module is build")
809 AH_TEMPLATE(HAVE_FS_DISKD, "Define to 1 if diskd filesystem module is build")
810 AH_TEMPLATE(HAVE_FS_ROCK, "Define to 1 if rock filesystem module is build")
811
812
813 dnl got final squid_storeio_module_candidates, build library lists
814 dnl This list will not be needed when each fs library has its own Makefile
815 STORE_LIBS_TO_BUILD=
816 dnl File system libraries to link executables with.
817 dnl These are the same as STORE_LIBS_TO_BUILD, but with a path
818 STORE_LIBS_TO_ADD=
819 for fs in $squid_storeio_module_candidates; do
820 STORE_LIBS_TO_BUILD="$STORE_LIBS_TO_BUILD lib${fs}.la"
821 STORE_LIBS_TO_ADD="$STORE_LIBS_TO_ADD fs/lib${fs}.la"
822 SQUID_TOUPPER_VAR_CONTENTS([fs])
823 AC_DEFINE_UNQUOTED(HAVE_FS_${fs}, 1)
824 done
825
826 AC_SUBST(STORE_LIBS_TO_BUILD)
827 AC_SUBST(STORE_LIBS_TO_ADD)
828 AC_SUBST(STORE_TESTS)
829
830
831 dnl At lest one removal policy is always needed.
832 dnl 'lru' removal policy is currently hard-coded by name for tests
833 dnl so we must set it as default.
834 REPL_POLICIES="lru"
835 AC_ARG_ENABLE(removal-policies,
836 AS_HELP_STRING([--enable-removal-policies="list of policies"],
837 [Build support for the list of removal policies.
838 The default is only to build the "lru" module.
839 See src/repl for a list of available modules, or
840 Programmers Guide section 9.9 for details on how
841 to build your custom policy]), [
842 case $enableval in
843 yes)
844 SQUID_LOOK_FOR_MODULES([$srcdir/src/repl],[REPL_POLICIES])
845 ;;
846 no)
847 ;;
848 *)
849 REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
850 ;;
851 esac
852 ])
853 if test "x$REPL_POLICIES" != "x" ; then
854 SQUID_CHECK_EXISTING_MODULES([$srcdir/src/repl],[REPL_POLICIES])
855 AC_MSG_NOTICE([Removal policies to build: $REPL_POLICIES])
856 REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
857 REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
858 fi
859 AC_SUBST(REPL_POLICIES)
860 AC_SUBST(REPL_OBJS)
861 AC_SUBST(REPL_LIBS)
862
863 AM_CONDITIONAL(ENABLE_PINGER, false)
864 AC_ARG_ENABLE(icmp,
865 AS_HELP_STRING([--enable-icmp],[Enable ICMP pinging and Network Measurement]),
866 [ if test "x$enableval" = "xyes" ; then
867 AC_MSG_NOTICE([ICMP enabled])
868 AC_DEFINE(USE_ICMP,1,[Define to use Squid ICMP and Network Measurement features (highly recommended!)])
869 AM_CONDITIONAL(ENABLE_PINGER, true)
870 fi
871 ])
872
873 AM_CONDITIONAL(ENABLE_DELAY_POOLS, false)
874 AC_ARG_ENABLE(delay-pools,
875 AS_HELP_STRING([--enable-delay-pools],[Enable delay pools to limit bandwidth usage]),
876 [ if test "x$enableval" = "xyes" ; then
877 AC_MSG_NOTICE([Delay pools enabled])
878 AC_DEFINE([USE_DELAY_POOLS],1,[Traffic management via "delay pools".])
879 AM_CONDITIONAL(ENABLE_DELAY_POOLS, true)
880 fi
881 ])
882
883 dnl disable generic/common adaptation support by default
884 squid_opt_use_adaptation=no
885
886 squid_opt_use_esi=yes
887 AH_TEMPLATE([USE_SQUID_ESI],
888 [Define to enable the ESI processor and Surrogate header support])
889 AC_ARG_ENABLE(esi,
890 AS_HELP_STRING([--enable-esi],
891 [Enable ESI for accelerators. Benefits from expat or libxml2.
892 Enabling ESI will cause squid reverse proxies to be capable
893 of the Edge Acceleration Specification (www.esi.org).]),
894 [squid_opt_use_esi=$enableval], [squid_opt_use_esi=no])
895 HAVE_LIBEXPAT=0
896 EXPATLIB=
897 HAVE_LIBXML2=0
898 XMLLIB=
899 if test "x$squid_opt_use_esi" = "xyes" ; then
900 AC_MSG_NOTICE([Enabling ESI processor and Surrogate header support.])
901 AC_DEFINE(USE_SQUID_ESI,1,
902 [Compile the ESI processor and Surrogate header support])
903 else
904 AC_MSG_NOTICE([Disabling ESI processor])
905 fi
906
907 # ESI support libraries: expat
908 AC_ARG_WITH(expat, AS_HELP_STRING([--without-expat],[Do not use expat for ESI. Default: auto-detect]))
909 if test "x$squid_opt_use_esi" = "xyes" -a "x$with_expat" != "xno" ; then
910 AC_CHECK_LIB([expat], [main], [EXPATLIB="-lexpat"; HAVE_LIBEXPAT=1])
911 AC_CHECK_HEADERS([expat.h])
912 AC_DEFINE_UNQUOTED(HAVE_LIBEXPAT, $HAVE_LIBEXPAT, [Define to 1 if you have the expat library])
913 if test "x$with_expat" = "xyes" -a "x$HAVE_LIBEXPAT" != "x1" ; then
914 AC_MSG_ERROR([Required library expat is not able to be found.])
915 fi
916 fi
917
918 AC_ARG_WITH(libxml2, AS_HELP_STRING([--without-libxml2],[Do not use libxml2 for ESI. Default: auto-detect]))
919 if test "x$squid_opt_use_esi" = "xyes" -a "x$with_libxml2" != "xno" ; then
920 AC_CHECK_LIB([xml2], [main], [XMLLIB="-lxml2"; HAVE_LIBXML2=1])
921 dnl Find the main header and include path...
922 AC_CACHE_CHECK([location of libxml2 include files], [ac_cv_libxml2_include], [
923 AC_CHECK_HEADERS([libxml/parser.h], [], [
924 AC_MSG_NOTICE([Testing in /usr/include/libxml2])
925 SAVED_CPPFLAGS="$CPPFLAGS"
926 CPPFLAGS="-I/usr/include/libxml2 $CPPFLAGS"
927 unset ac_cv_header_libxml_parser_h
928 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/include/libxml2"], [
929 AC_MSG_NOTICE([Testing in /usr/local/include/libxml2])
930 CPPFLAGS="-I/usr/local/include/libxml2 $SAVED_CPPFLAGS"
931 unset ac_cv_header_libxml_parser_h
932 AC_CHECK_HEADERS([libxml/parser.h], [ac_cv_libxml2_include="-I/usr/local/include/libxml2"], [
933 AC_MSG_NOTICE([Failed to find libxml2 header file libxml/parser.h])
934 ])
935 ])
936 CPPFLAGS="$SAVED_CPPFLAGS"
937 ])
938 ])
939 if test "x$ac_cv_libxml2_include" != "x"; then
940 SQUID_CXXFLAGS="$ac_cv_libxml2_include $SQUID_CXXFLAGS"
941 CPPFLAGS="$ac_cv_libxml2_include $CPPFLAGS"
942 fi
943 dnl Now that we know where to look find the headers...
944 AC_CHECK_HEADERS(libxml/parser.h libxml/HTMLparser.h libxml/HTMLtree.h)
945 AC_DEFINE_UNQUOTED(HAVE_LIBXML2, $HAVE_LIBXML2, [Define to 1 if you have the libxml2 library])
946 if test "x$with_libxml2" = "xyes" -a "$HAVE_LIBXML2" != "1" ; then
947 AC_MSG_ERROR([Required library libxml2 is not able to be found.])
948 fi
949 fi
950
951 AM_CONDITIONAL(USE_ESI, test "x$squid_opt_use_esi" = "xyes")
952 AM_CONDITIONAL(HAVE_LIBEXPAT, test "$HAVE_LIBEXPAT" = 1)
953 AC_SUBST(EXPATLIB)
954 AM_CONDITIONAL(HAVE_LIBXML2, test "$HAVE_LIBXML2" = 1)
955 AC_SUBST(XMLLIB)
956
957 # icap argument handling
958 AC_ARG_ENABLE(icap-client,
959 AS_HELP_STRING([--disable-icap-client],[Disable the ICAP client.]),[
960 SQUID_YESNO([$enableval],[Unrecognized argument to --disable-icap-client: $enableval])
961 ])
962 SQUID_DEFINE_BOOL(ICAP_CLIENT,${enable_icap_client:=yes}, [Enable ICAP client features in Squid])
963 AM_CONDITIONAL(USE_ICAP_CLIENT, [test "x$enable_icap_client" != "xno" ])
964 if test "x$enable_icap_client" != "xno" ; then
965 ICAP_LIBS="icap/libicap.la"
966 squid_opt_use_adaptation=yes
967 else
968 ICAP_LIBS=""
969 fi
970 AC_SUBST(ICAP_LIBS)
971
972 squid_opt_use_ecap=1
973 AC_MSG_CHECKING(whether to support eCAP)
974 AC_ARG_ENABLE(ecap,
975 AS_HELP_STRING([--enable-ecap],[support loadable content adaptation modules]), [
976 case "${enableval}" in
977 yes|no) squid_opt_use_ecap=$enableval ;;
978 *) AC_MSG_ERROR(bad value ${enableval} for --enable-ecap) ;;
979 esac
980 AC_MSG_RESULT([$squid_opt_use_ecap, explicitly])
981 ], [
982 squid_opt_use_ecap=no;
983 AC_MSG_RESULT([$squid_opt_use_ecap, implicitly])
984 ]
985 )
986
987 dnl Necessary if the first PKG_CHECK_MODULES call is conditional
988 PKG_PROG_PKG_CONFIG
989
990 dnl Perform configuration consistency checks for eCAP
991 if test "x$squid_opt_use_ecap" != "xno";
992 then
993 dnl eCAP support requires loadable modules, which are enabled by default
994 if test "x$enable_loadable_modules" != "xyes"
995 then
996 AC_MSG_ERROR([eCAP support requires loadable modules. Please do not use --disable-loadable-modules with --enable-ecap.])
997 fi
998
999 if test -n "$PKG_CONFIG"; then
1000 dnl eCAP support requires libecap.
1001 dnl This Squid supports libecap v1.0.x.
1002 dnl Use EXT_ prefix to distinguish external libecap (that we check for
1003 dnl here) from our own convenience ecap library in Makefiles.
1004 PKG_CHECK_MODULES([EXT_LIBECAP],[libecap >= 1.0 libecap < 1.1])
1005 else
1006 AC_MSG_NOTICE([eCAP support requires pkg-config to verify the correct library version. Trouble may follow.])
1007 fi
1008 fi
1009
1010 AM_CONDITIONAL(USE_ECAP, test "x$squid_opt_use_ecap" = "xyes")
1011 if test "x$squid_opt_use_ecap" = "xyes";
1012 then
1013 AC_DEFINE(USE_ECAP,1,[Enable eCAP support])
1014 ECAP_LIBS="ecap/libecapsquid.la"
1015 squid_opt_use_adaptation=yes
1016 else
1017 AC_DEFINE(USE_ECAP,0,[Disable eCAP support])
1018 ECAP_LIBS=""
1019 fi
1020 dnl convenience library
1021 AC_SUBST(ECAP_LIBS)
1022
1023
1024 dnl enable adaptation if requested by specific adaptation mechanisms
1025 AM_CONDITIONAL(USE_ADAPTATION, test "x$squid_opt_use_adaptation" = "xyes")
1026 if test "x$squid_opt_use_adaptation" = "xyes"
1027 then
1028 AC_DEFINE(USE_ADAPTATION,1,[common adaptation support])
1029 ADAPTATION_LIBS="adaptation/libadaptation.la"
1030 else
1031 AC_DEFINE(USE_ADAPTATION,0,[common adaptation support])
1032 ADAPTATION_LIBS=""
1033 fi
1034 AC_SUBST(ADAPTATION_LIBS)
1035
1036 test "x$squid_host_os" = "xmingw" && enable_wccp=no
1037 AC_ARG_ENABLE(wccp,
1038 AS_HELP_STRING([--disable-wccp],[Disable Web Cache Coordination Protocol]), [
1039 SQUID_YESNO([$enableval],[unrecognized argument to --disable-wccp: $enableval])
1040 ])
1041 SQUID_DEFINE_BOOL(USE_WCCP, ${enable_wccp:=yes}, [Define to enable WCCP])
1042 AC_MSG_NOTICE([Web Cache Coordination Protocol enabled: $enable_wccp])
1043
1044 test "x$squid_host_os" = "xmingw" && enable_wccpv2=no
1045 AC_ARG_ENABLE(wccpv2,
1046 AS_HELP_STRING([--disable-wccpv2],
1047 [Disable Web Cache Coordination V2 Protocol]), [
1048 SQUID_YESNO([$enableval],
1049 [unrecognized argument to --disable-wccpv2: $enableval])
1050 ])
1051 SQUID_DEFINE_BOOL(USE_WCCPv2,${enable_wccpv2:=yes},
1052 [Define to enable WCCP V2])
1053 AC_MSG_NOTICE([Web Cache Coordination V2 Protocol enabled: $enable_wccpv2])
1054
1055 AC_ARG_ENABLE(kill-parent-hack,
1056 AS_HELP_STRING([--enable-kill-parent-hack],[Kill parent on shutdown]), [
1057 SQUID_YESNO([$enableval],
1058 [unrecognized argument to --enable-kill-parent-hack: $enableval])
1059 ])
1060 SQUID_DEFINE_BOOL(KILL_PARENT_OPT,${enable_kill_parent_hack:=no},
1061 [A dangerous feature which causes Squid to kill its parent
1062 process (presumably the RunCache script) upon receipt
1063 of SIGTERM or SIGINT. Deprecated, Use with caution.])
1064 AC_MSG_NOTICE([Kill parent on shutdown hack enabled: $enable_kill_parent_hack])
1065
1066 AC_ARG_ENABLE(snmp,
1067 AS_HELP_STRING([--disable-snmp],[Disable SNMP monitoring support]), [
1068 SQUID_YESNO([$enableval],
1069 [unrecognized argument to --disable-snmp: $enableval])
1070 ])
1071 SQUID_DEFINE_BOOL(SQUID_SNMP,${enable_snmp:=yes},
1072 [Define to enable SNMP monitoring of Squid])
1073 AM_CONDITIONAL(ENABLE_SNMP, [test "x$enable_snmp" = "xyes"])
1074 if test "x$enable_snmp" = "xyes"; then
1075 SNMPLIB='../lib/snmplib/libsnmplib.la'
1076 fi
1077 AC_MSG_NOTICE([SNMP support enabled: $enable_snmp])
1078 AC_SUBST(SNMPLIB)
1079
1080 AC_ARG_ENABLE(cachemgr-hostname,
1081 AS_HELP_STRING([--enable-cachemgr-hostname=hostname],
1082 [Make cachemgr.cgi default to this host.
1083 If unspecified, uses the name of the build-host]), [
1084 case $enableval in
1085 yes)
1086 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()],
1087 [If you are upset that the cachemgr.cgi form comes up with the hostname field blank, then define this to getfullhostname()])
1088 AC_MSG_NOTICE([Cachemgr default hostname == host where cachemgr runs])
1089 ;;
1090 no)
1091 : # Nothing to do..
1092 ;;
1093 *)
1094 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
1095 AC_MSG_NOTICE([Cachemgr default hostname set to ${enableval}])
1096 ;;
1097 esac
1098 ])
1099
1100 AC_ARG_ENABLE(eui,
1101 AS_HELP_STRING([--disable-eui],
1102 [Disable use of ARP / MAC/ EUI (ether address)]), [
1103 SQUID_YESNO([$enableval],[--disable-eui expects no arguments])
1104 ])
1105 if test "x${enable_eui:=yes}" = "xyes" ; then
1106 case "$squid_host_os" in
1107 linux|solaris|freebsd|openbsd|netbsd|cygwin)
1108 ${TRUE}
1109 ;;
1110 mingw)
1111 EUILIB="-liphlpapi"
1112 ;;
1113 *)
1114 AC_MSG_WARN([EUI support probably will not work on host $host.])
1115 ;;
1116 esac
1117 # iphlpapi.h check delayed after winsock2.h
1118 AC_CHECK_HEADERS( \
1119 windows.h \
1120 sys/sockio.h \
1121 sys/param.h,
1122 [], [], [[
1123 #if HAVE_WINDOWS_H
1124 include <windows.h>
1125 #endif
1126 ]]
1127 )
1128 AC_CHECK_HEADERS( \
1129 net/if_arp.h \
1130 net/route.h,
1131 [], [], [[
1132 #include <sys/types.h>
1133 #include <sys/socket.h>
1134 ]])
1135
1136 # OpenBSD, FreeBSD and NetBSD requires sys/param.h to be included before sysctl.h and net/if_dl.h
1137 AC_CHECK_HEADERS( \
1138 net/if_dl.h \
1139 sys/sysctl.h,
1140 [], [], [[
1141 #if HAVE_SYS_PARAM_H
1142 #include <sys/param.h>
1143 #endif
1144 ]])
1145 fi
1146 AC_SUBST(EUILIB)
1147 AC_MSG_NOTICE([EUI (MAC address) controls enabled: $enable_eui])
1148 SQUID_DEFINE_BOOL(USE_SQUID_EUI,$enable_eui,
1149 [Define this to include code which lets you use ethernet addresses. This code uses API initially defined in 4.4-BSD.])
1150 AM_CONDITIONAL(USE_SQUID_EUI, [test "x$enable_eui" = "xyes" ])
1151
1152
1153 AC_ARG_ENABLE(htcp,
1154 AS_HELP_STRING([--disable-htcp],[Disable HTCP protocol support]), [
1155 SQUID_YESNO([$enableval],
1156 [unrecognized argument to --disable-htcp: $enableval])
1157 ])
1158 SQUID_DEFINE_BOOL(USE_HTCP,${enable_htcp:=yes},
1159 [Define this to include code for the Hypertext Cache Protocol (HTCP)])
1160 AM_CONDITIONAL(ENABLE_HTCP, [test "x$enable_htcp" = "xyes"])
1161 AC_MSG_NOTICE([HTCP support enabled: $enable_htcp])
1162
1163 # Cryptograhic libraries
1164 AC_ARG_WITH(nettle,
1165 AS_HELP_STRING([--without-nettle],[Compile without the Nettle crypto library.]),[
1166 case "$with_nettle" in
1167 yes|no)
1168 : # Nothing special to do here
1169 ;;
1170 *)
1171 if test ! -d "$withval" ; then
1172 AC_MSG_ERROR([--with-nettle path does not point to a directory])
1173 fi
1174 NETTLELIBDIR="-L$with_nettle/lib"
1175 CPPFLAGS="-I$with_nettle/include $CPPFLAGS"
1176 with_nettle=yes
1177 esac
1178 ])
1179 if test "x$with_nettle" != "xno" ; then
1180 AC_CHECK_LIB(nettle, nettle_md5_init,[
1181 NETTLELIB="$NETTLELIBDIR -lnettle"
1182 AC_CHECK_HEADERS(nettle/md5.h)
1183 ],[with_nettle=no])
1184 if test "x$with_nettle" != "xno" ; then
1185 # Base64 uses the nettle 3.0 API
1186 # which matters on 64-bit systems
1187 AC_CHECK_HEADERS(nettle/base64.h)
1188 AC_MSG_CHECKING([for Nettle 3.0 API compatibility])
1189 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1190 # include <cstddef>
1191 # include <cstdint>
1192 # include <nettle/base64.h>
1193 ]],[[
1194 uint8_t inData[10]; inData[0] = '\0';
1195 size_t srcLen = 0;
1196 struct base64_decode_ctx ctx;
1197 base64_decode_init(&ctx);
1198 uint8_t outData[10];
1199 size_t dstLen = 0;
1200 if (!base64_decode_update(&ctx, &dstLen, outData, srcLen, inData) ||
1201 !base64_decode_final(&ctx)) {
1202 return 1;
1203 }
1204 ]])],[AC_MSG_RESULT(yes)
1205 AC_DEFINE(HAVE_NETTLE30_BASE64,1,[set to 1 if Nettle 3.0 API will link])
1206 ],[AC_MSG_RESULT(no)])
1207 fi
1208 fi
1209 AC_MSG_NOTICE([Using Nettle cryptographic library: ${with_nettle:=yes}])
1210 AC_SUBST(NETTLELIB)
1211
1212 dnl Check for libcrypt
1213 CRYPTLIB=
1214 dnl Some of our helpers use crypt(3) which may be in libc, or in
1215 dnl libcrypt (eg FreeBSD)
1216 AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
1217 dnl Solaris10 provides MD5 natively through libmd5
1218 AC_CHECK_LIB(md5, MD5Init, [CRYPTLIB="$CRYPTLIB -lmd5"])
1219 AC_SUBST(CRYPTLIB)
1220
1221 SSLLIB=""
1222
1223 dnl User may want to disable GnuTLS
1224 AC_ARG_WITH(gnutls,
1225 AS_HELP_STRING([--without-gnutls],
1226 [Do not use GnuTLS for SSL. Default: auto-detect]), [
1227 case "$with_gnutls" in
1228 yes|no)
1229 : # Nothing special to do here
1230 ;;
1231 *)
1232 if test ! -d "$withval" ; then
1233 AC_MSG_ERROR([--with-gnutls path does not point to a directory])
1234 fi
1235 LIBGNUTLS_PATH="-L$with_gnutls/lib"
1236 CPPFLAGS="-I$with_gnutls/include $CPPFLAGS"
1237 esac
1238 ])
1239 AH_TEMPLATE(USE_GNUTLS,[GnuTLS support is available])
1240 if test "x$with_gnutls" != "xno"; then
1241 SQUID_STATE_SAVE(squid_gnutls_state)
1242
1243 # User may have provided a custom location for GnuTLS. Otherwise...
1244 LIBS="$LIBS $LIBGNUTLS_PATH"
1245
1246 # auto-detect using pkg-config
1247 PKG_CHECK_MODULES([LIBGNUTLS],[gnutls >= 3.1.5],[
1248 CPPFLAGS="$CPPFLAGS $LIBGNUTLS_CFLAGS"
1249 ],[
1250 ## find the package without pkg-config
1251 ## check that the library is actually new enough.
1252 ## by testing for a 3.1.5+ function which we use
1253 AC_CHECK_LIB(gnutls,gnutls_certificate_verify_peers3,[LIBGNUTLS_LIBS="-lgnutls"])
1254 ])
1255 AC_CHECK_HEADERS(gnutls/gnutls.h gnutls/x509.h)
1256
1257 SQUID_STATE_ROLLBACK(squid_gnutls_state) #de-pollute LIBS
1258
1259 if test "x$with_gnutls" = "xyes" -a "x$LIBGNUTLS_LIBS" = "x"; then
1260 AC_MSG_ERROR([Required GnuTLS library not found])
1261 fi
1262 if test "x$LIBGNUTLS_LIBS" != "x" ; then
1263 CXXFLAGS="$LIBGNUTLS_CFLAGS $CXXFLAGS"
1264 SSLLIB="$LIBGNUTLS_PATH $LIBGNUTLS_LIBS $SSLLIB"
1265 AC_DEFINE(USE_GNUTLS,1,[GnuTLS support is available])
1266 else
1267 with_gnutls=no
1268 fi
1269 fi
1270 AC_MSG_NOTICE([GnuTLS library support: ${with_gnutls:=auto} ${LIBGNUTLS_PATH} ${LIBGNUTLS_LIBS}])
1271
1272 dnl User may specify OpenSSL is needed from a non-standard location
1273 AC_ARG_WITH(openssl,
1274 AS_HELP_STRING([--with-openssl=PATH],
1275 [Compile with the OpenSSL libraries. The path to
1276 the OpenSSL development libraries and headers
1277 installation can be specified if outside of the
1278 system standard directories]), [
1279 case "$with_openssl" in
1280 yes|no)
1281 : # Nothing special to do here
1282 ;;
1283 *)
1284 if test ! -d "$withval" ; then
1285 AC_MSG_ERROR([--with-openssl path does not point to a directory])
1286 fi
1287 LIBOPENSSL_PATH="-L$with_openssl/lib"
1288 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1289 with_openssl=yes
1290 esac
1291 ])
1292 AH_TEMPLATE(USE_OPENSSL,[OpenSSL support is available])
1293 ## OpenSSL is default disable due to licensing issues on some OS
1294 if test "x$with_openssl" = "xyes"; then
1295 AC_CHECK_HEADERS( \
1296 openssl/bio.h \
1297 openssl/crypto.h \
1298 openssl/err.h \
1299 openssl/md5.h \
1300 openssl/opensslv.h \
1301 openssl/ssl.h \
1302 openssl/x509v3.h \
1303 openssl/engine.h \
1304 openssl/txt_db.h \
1305 )
1306
1307 # User may have provided a custom location for OpenSSL. Otherwise...
1308 SQUID_STATE_SAVE(squid_openssl_state)
1309 LIBS="$LIBS $LIBOPENSSL_PATH"
1310
1311 # auto-detect using pkg-config
1312 PKG_CHECK_MODULES([LIBOPENSSL],[openssl],,[
1313 ## For some OS pkg-config is broken or unavailable.
1314 ## Detect libraries the hard way.
1315
1316 # Windows MinGW has some special libraries ...
1317 if test "x$squid_host_os" = "xmingw" ; then
1318 LIBOPENSSL_LIBS='-lssleay32 -leay32 -lgdi32 $LIBOPENSSL_LIBS'
1319 AC_MSG_NOTICE([Windows OpenSSL library support: yes -lssleay32 -leay32 -lgdi32])
1320 fi
1321
1322 AC_CHECK_LIB(crypto,[CRYPTO_new_ex_data],[LIBOPENSSL_LIBS="-lcrypto $LIBOPENSSL_LIBS"],[
1323 AC_MSG_ERROR([library 'crypto' is required for OpenSSL])
1324 ])
1325 AC_CHECK_LIB(ssl,[SSL_library_init],[LIBOPENSSL_LIBS="-lssl $LIBOPENSSL_LIBS"],[
1326 AC_MSG_ERROR([library 'ssl' is required for OpenSSL])
1327 ])
1328 ])
1329
1330 # This is a workaround for RedHat 9 brain damage..
1331 if test -d /usr/kerberos/include -a -f /usr/include/openssl/kssl.h; then
1332 AC_MSG_NOTICE([OpenSSL depends on Kerberos])
1333 LIBOPENSSL_LIBS="-L/usr/kerberos/lib $LIBOPENSSL_LIBS"
1334 CPPFLAGS="$CPPFLAGS -I/usr/kerberos/include"
1335 fi
1336 SQUID_STATE_ROLLBACK(squid_openssl_state) #de-pollute LIBS
1337
1338 if test "x$LIBOPENSSL_LIBS" != "x"; then
1339 CXXFLAGS="$LIBOPENSSL_CFLAGS $CXXFLAGS"
1340 SSLLIB="$LIBOPENSSL_PATH $LIBOPENSSL_LIBS $SSLLIB"
1341 AC_DEFINE(USE_OPENSSL,1,[OpenSSL support is available])
1342
1343 # check for other specific broken implementations
1344 SQUID_CHECK_OPENSSL_GETCERTIFICATE_WORKS
1345 SQUID_CHECK_OPENSSL_CONST_SSL_METHOD
1346 SQUID_CHECK_OPENSSL_TXTDB
1347 SQUID_CHECK_OPENSSL_HELLO_OVERWRITE_HACK
1348 fi
1349 if test "x$SSLLIB" = "x"; then
1350 AC_MSG_ERROR([Required OpenSSL library not found])
1351 fi
1352 fi
1353 AC_MSG_NOTICE([OpenSSL library support: ${with_openssl:=no} ${LIBOPENSSL_PATH} ${LIBOPENSSL_LIBS}])
1354 AM_CONDITIONAL(ENABLE_SSL,[ test "x$with_openssl" = "xyes" ])
1355 AC_SUBST(SSLLIB)
1356
1357 dnl User may specify MIT Kerberos is needed from a non-standard location
1358 AC_ARG_WITH(mit-krb5,
1359 AS_HELP_STRING([--without-mit-krb5],
1360 [Compile without MIT Kerberos support.]), [
1361 case "$with_mit_krb5" in
1362 yes|no)
1363 : # Nothing special to do here
1364 ;;
1365 *)
1366 if test ! -d "$withval" ; then
1367 AC_MSG_ERROR([--with-mit-krb5 path does not point to a directory])
1368 fi
1369 if test -d "$with_mit_krb5/lib64" ; then
1370 LIB_KRB5_PATH="-L$with_mit_krb5/lib64 -L$with_mit_krb5/lib"
1371 else
1372 LIB_KRB5_PATH="-L$with_mit_krb5/lib"
1373 fi
1374 CXXFLAGS="-I$with_mit_krb5/include $CXXFLAGS"
1375 krb5confpath="$with_mit_krb5/bin"
1376 with_mit_krb5=yes
1377 esac
1378 ])
1379 AH_TEMPLATE(USE_APPLE_KRB5,[Apple Kerberos support is available])
1380 AH_TEMPLATE(USE_MIT_KRB5,[MIT Kerberos support is available])
1381 AH_TEMPLATE(USE_SOLARIS_KRB5,[Solaris Kerberos support is available])
1382
1383 ## find out if pkg-config or krb5-config will work
1384 if test "x$with_mit_krb5" != "xno"; then
1385 # find installed libs via pkg-config or krb5-config
1386 squid_pc_krb5_name=
1387 PKG_CHECK_EXISTS(mit-krb5-gssapi mit-krb5, [squid_pc_krb5_name="mit-krb5-gssapi mit-krb5"],[
1388 PKG_CHECK_EXISTS(gssapi-krb5 krb5, [squid_pc_krb5_name="gssapi-krb5 krb5"])
1389 ])
1390 if test "x$squid_pc_krb5_name" = "x" -a "$cross_compiling" = "no"; then
1391 # Look for krb5-config (unless cross-compiling)
1392 AC_PATH_PROG(krb5_config,krb5-config,no)
1393 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1394 krb5confpath="`dirname $ac_cv_path_krb5_config`"
1395 ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
1396 ac_solaris="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i solaris`"
1397 ac_apple="`$ac_cv_path_krb5_config --vendor 2>/dev/null | grep -c -i apple`"
1398 if test $ac_solaris -gt 0 ; then
1399 with_solaris_krb5=yes
1400 elif test $ac_apple -gt 0 ; then
1401 with_apple_krb5=yes
1402 elif test $ac_heimdal -gt 0; then
1403 with_mit_krb5=no
1404 if test "x$with_mit_krb5" = "xyes"; then
1405 AC_MSG_ERROR([Could not find pkg-config or krb5-config for MIT Kerberos])
1406 fi
1407 fi
1408 else
1409 if test "x$with_mit_krb5" = "xyes"; then
1410 AC_MSG_ERROR([Could not find krb5-config in path])
1411 else
1412 with_mit_krb5=no
1413 fi
1414 fi
1415 fi
1416 fi
1417
1418 # detect MIT Kerberos dependencies (except on Solaris)
1419 if test "x$with_mit_krb5" != "xno" -a "x$with_solaris_krb5" != "xyes"; then
1420 SQUID_STATE_SAVE([squid_krb5_save])
1421 LIBS="$LIBS $LIB_KRB5_PATH"
1422
1423 # auto-detect using pkg-config
1424 PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
1425 # look for krb5-config (unless cross-compiling)
1426 if test "$cross_compiling" = "no"; then
1427 if test "x$krb5confpath" = "x" ; then
1428 AC_PATH_PROG(krb5_config,krb5-config,no)
1429 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1430 ac_krb5_config="$ac_cv_path_krb5_config"
1431 fi
1432 else
1433 ac_krb5_config="$krb5confpath/krb5-config"
1434 fi
1435 fi
1436 if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
1437 # Get libs, etc
1438 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1439 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1440 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1441 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1442 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1443 else
1444 ## For some OS pkg-config is broken or unavailable.
1445 ## Detect libraries the hard way.
1446
1447 SQUID_STATE_SAVE([squid_mit_save])
1448 missing_required=
1449 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1450 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
1451 AC_MSG_WARN([library 'com_err' is required for MIT Kerberos])
1452 missing_required=yes
1453 ])
1454 LIBS=$LIB_KRB5_LIBS
1455 AC_CHECK_LIB(k5crypto, [main], [LIB_KRB5_LIBS="-lk5crypto $LIB_KRB5_LIBS"],[
1456 AC_MSG_WARN([library 'k5crypto' is required for MIT Kerberos])
1457 missing_required=yes
1458 ])
1459 LIBS=$LIB_KRB5_LIBS
1460 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1461 AC_MSG_WARN([library 'krb5' is required for MIT Kerberos])
1462 missing_required=yes
1463 ])
1464 LIBS=$LIB_KRB5_LIBS
1465 AC_CHECK_LIB(gssapi_krb5, [main], [LIB_KRB5_LIBS="-lgssapi_krb5 $LIB_KRB5_LIBS"],[
1466 AC_MSG_WARN([library 'gssapi_krb5' is required for MIT Kerberos])
1467 missing_required=yes
1468 ])
1469 SQUID_STATE_ROLLBACK([squid_mit_save])
1470 if test "x$missing_required" = "xyes"; then
1471 LIB_KRB5_LIBS=""
1472 fi
1473 fi
1474 ])
1475
1476 if test "x$LIB_KRB5_LIBS" != "x"; then
1477 if test "x$with_apple_krb5" = "xyes" ; then
1478 AC_DEFINE(USE_APPLE_KRB5,1,[Apple Kerberos support is available])
1479 KRB5_FLAVOUR="Apple"
1480 else
1481 AC_DEFINE(USE_MIT_KRB5,1,[MIT Kerberos support is available])
1482 KRB5_FLAVOUR="MIT"
1483 fi
1484 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1485 KRB5INCS="$LIB_KRB5_CFLAGS"
1486
1487 # check for other specific broken implementations
1488 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1489 LIBS="$LIBS $KRB5LIBS"
1490
1491 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1492 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1493 AC_CHECK_HEADERS(gssapi/gssapi_generic.h)
1494 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1495 AC_CHECK_HEADERS(profile.h)
1496
1497 SQUID_CHECK_KRB5_FUNCS
1498 fi
1499 if test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1500 AC_MSG_ERROR([Required Kerberos library not found])
1501 elif test "x$KRB5LIBS" = "x"; then
1502 with_mit_krb5=no
1503 with_apple_krb5=no
1504 fi
1505 SQUID_STATE_ROLLBACK([squid_krb5_save])
1506 fi
1507
1508 # detect Solaris Kerberos dependencies
1509 if test "x$with_solaris_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1510 SQUID_STATE_SAVE([squid_krb5_save])
1511 LIBS="$LIBS $LIB_KRB5_PATH"
1512
1513 # no pkg-config for solaris native Kerberos
1514 # look for krb5-config (unless cross-compiling)
1515 if test "$cross_compiling" = "no"; then
1516 if test "x$krb5confpath" = "x" ; then
1517 AC_PATH_PROG(krb5_config,krb5-config,no)
1518 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1519 ac_krb5_config="$ac_cv_path_krb5_config"
1520 fi
1521 else
1522 ac_krb5_config="$krb5confpath/krb5-config"
1523 fi
1524 fi
1525 if test "x$ac_krb5_config" != "x" && test -x "$ac_krb5_config"; then
1526 # Get libs, etc
1527 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1528 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1529 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1530 # Solaris 10 Update 11 patches the krb5-config tool to produce stderr messages on stdout.
1531 SOLARIS_BROKEN_KRB5CONFIG_GSSAPI="`$ac_krb5_config --libs gssapi 2>/dev/null | grep "krb5-config"`"
1532 if test "x$SOLARIS_BROKEN_KRB5CONFIG_GSSAPI" = "x"; then
1533 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1534 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1535 fi
1536 else
1537 ## For some OS pkg-config is broken or unavailable.
1538 ## Detect libraries the hard way.
1539
1540 CXXFLAGS="-I/usr/include/kerberosv5 $CXXFLAGS"
1541
1542 SQUID_STATE_SAVE([squid_solaris_save])
1543 missing_required=
1544 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1545 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1546 AC_MSG_WARN([library 'krb5' is required for Solaris Kerberos])
1547 missing_required=yes
1548 ])
1549 LIBS=$LIB_KRB5_LIBS
1550 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
1551 AC_MSG_WARN([library 'gss' is required for Solaris Kerberos])
1552 missing_required=yes
1553 ])
1554 SQUID_STATE_ROLLBACK([squid_solaris_save])
1555 if test "x$missing_required" = "xyes"; then
1556 LIB_KRB5_LIBS=""
1557 fi
1558 fi
1559
1560 if test "x$LIB_KRB5_LIBS" != "x"; then
1561 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1562 KRB5INCS="$LIB_KRB5_CFLAGS"
1563 AC_DEFINE(USE_SOLARIS_KRB5,1,[Solaris Kerberos support is available])
1564 KRB5_FLAVOUR="Solaris"
1565
1566 # check for other specific broken implementations
1567 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1568 LIBS="$LIBS $KRB5LIBS"
1569
1570 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1571 AC_CHECK_HEADERS(gssapi/gssapi.h gssapi/gssapi_ext.h)
1572 AC_CHECK_HEADERS(krb5.h com_err.h)
1573
1574 SQUID_CHECK_KRB5_SOLARIS_BROKEN_KRB5_H
1575 if test "x$squid_cv_broken_krb5_h" = "xyes"; then
1576 AC_DEFINE(HAVE_BROKEN_SOLARIS_KRB5_H, 1, [Define to 1 if Solaris krb5.h is broken for C++])
1577 AC_MSG_WARN([You have a broken Solaris <krb5.h> system include.])
1578 AC_MSG_WARN([Please see http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6837512])
1579 AC_MSG_WARN([If you need Kerberos support you will have to patch])
1580 AC_MSG_WARN([your system. See contrib/solaris/solaris-krb5-include.patch])
1581 fi
1582 SQUID_CHECK_KRB5_FUNCS
1583 fi
1584 if test "x$with_mit_krb5" = "xyes" -a "x$KRB5LIBS" = "x"; then
1585 # Error only if Solaris flavour was detected while looking for required MIT Kerberos
1586 AC_MSG_ERROR([Required Kerberos library not found])
1587 elif test "x$KRB5LIBS" = "x"; then
1588 with_solaris_krb5=no
1589 with_mit_krb5=no
1590 fi
1591 SQUID_STATE_ROLLBACK([squid_krb5_save])
1592 fi
1593
1594 dnl User may specify Heimdal Kerberos is needed from a non-standard location
1595 AC_ARG_WITH(heimdal-krb5,
1596 AS_HELP_STRING([--without-heimdal-krb5],
1597 [Compile without Heimdal Kerberos support.]), [
1598 case "$with_heimdal_krb5" in
1599 yes|no)
1600 : # Nothing special to do here
1601 ;;
1602 *)
1603 if test ! -d "$withval" ; then
1604 AC_MSG_ERROR([--with-heimdal-krb5 path does not point to a directory])
1605 fi
1606 if test -d "$with_heimdal_krb5/lib64" ; then
1607 LIB_KRB5_PATH="-L$with_heimdal_krb5/lib64 -L$with_heimdal_krb5/lib"
1608 else
1609 LIB_KRB5_PATH="-L$with_heimdal_krb5/lib"
1610 fi
1611 CXXFLAGS="-I$with_heimdal_krb5/include $CXXFLAGS"
1612 krb5confpath="$with_heimdal_krb5/bin"
1613 with_heimdal_krb5=yes
1614 esac
1615 ])
1616 AH_TEMPLATE(USE_HEIMDAL_KRB5,[Heimdal Kerberos support is available])
1617 if test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"; then
1618 # find installed libs via pkg-config or krb5-config
1619 PKG_CHECK_EXISTS(heimdal-krb5, [squid_pc_krb5_name="heimdal-krb5"])
1620 if test "x$squid_pc_krb5_name" = "x"; then
1621 PKG_CHECK_EXISTS(heimdal-gssapi, [squid_pc_krb5_name="heimdal-gssapi"])
1622 fi
1623 if test "x$squid_pc_krb5_name" = "x" -a "$cross_compiling" = "no"; then
1624 # Look for krb5-config (unless cross-compiling)
1625 AC_PATH_PROG(krb5_config,krb5-config,no)
1626 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1627 krb5confpath="`dirname $ac_cv_path_krb5_config`"
1628 ac_heimdal="`$ac_cv_path_krb5_config --version 2>/dev/null | grep -c -i heimdal`"
1629 if test "x$with_heimdal_krb5" = "xyes"; then
1630 AC_MSG_ERROR([Could not find pkg-config or krb5-config for Heimdal Kerberos])
1631 fi
1632 else
1633 if test "x$with_heimdal_krb5" = "xyes"; then
1634 AC_MSG_ERROR([Could not find krb5-config in path])
1635 else
1636 AC_MSG_WARN([Could not find krb5-config in path])
1637 with_heimdal_krb5=no
1638 fi
1639 fi
1640 fi
1641 fi
1642 if test "x$with_heimdal_krb5" != "xno" -a "x$KRB5LIBS" = "x"; then
1643 SQUID_STATE_SAVE([squid_krb5_save])
1644 LIBS="$LIBS $LIB_KRB5_PATH"
1645
1646 # auto-detect using pkg-config
1647 PKG_CHECK_MODULES([LIB_KRB5], $squid_pc_krb5_name,,[
1648 # look for krb5-config (unless cross-compiling)
1649 if test "$cross_compiling" = "no"; then
1650 if test "x$krb5confpath" = "x" ; then
1651 AC_PATH_PROG(krb5_config,krb5-config,no)
1652 if test "x$ac_cv_path_krb5_config" != "xno" ; then
1653 ac_krb5_config="$ac_cv_path_krb5_config"
1654 fi
1655 else
1656 ac_krb5_config="$krb5confpath/krb5-config"
1657 fi
1658 fi
1659 if test "x$ac_krb5_config" != "x" -a -x "$ac_krb5_config"; then
1660 # Get libs, etc
1661 AC_MSG_NOTICE([Use krb5-config to get CXXFLAGS and LIBS])
1662 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags krb5 2>/dev/null`"
1663 LIB_KRB5_LIBS="`$ac_krb5_config --libs krb5 2>/dev/null`"
1664 LIB_KRB5_CFLAGS="`$ac_krb5_config --cflags gssapi 2>/dev/null` $LIB_KRB5_CFLAGS"
1665 LIB_KRB5_LIBS="`$ac_krb5_config --libs gssapi 2>/dev/null` $LIB_KRB5_LIBS"
1666 else
1667 ## For some OS pkg-config is broken or unavailable.
1668 ## Detect libraries the hard way.
1669 SQUID_STATE_SAVE([squid_heimdal_save])
1670 missing_required=
1671 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1672 AC_CHECK_LIB(resolv, [main], [LIB_KRB5_LIBS="-lresolv $LIB_KRB5_LIBS"],[
1673 AC_MSG_WARN([library 'resolv' is required for Heimdal Kerberos])
1674 missing_required=yes
1675 ])
1676 LIBS=$LIB_KRB5_LIBS
1677 AC_CHECK_LIB(crypt, [main], [LIB_KRB5_LIBS="-lcrypt $LIB_KRB5_LIBS"],[
1678 AC_MSG_WARN([library 'crypt' is required for Heimdal Kerberos])
1679 missing_required=yes
1680 ])
1681 LIBS=$LIB_KRB5_LIBS
1682 AC_CHECK_LIB(roken, [main], [LIB_KRB5_LIBS="-lroken $LIB_KRB5_LIBS"],[
1683 AC_MSG_WARN([library 'roken' is required for Heimdal Kerberos])
1684 missing_required=yes
1685 ])
1686 LIBS=$LIB_KRB5_LIBS
1687 AC_CHECK_LIB(heimbase, [main], [LIB_KRB5_LIBS="-lheimbase $LIB_KRB5_LIBS"],[
1688 AC_MSG_WARN([library 'heimbase' may be required for Heimdal Kerberos])
1689 ])
1690 LIBS=$LIB_KRB5_LIBS
1691 AC_CHECK_LIB(wind, [main], [LIB_KRB5_LIBS="-lwind $LIB_KRB5_LIBS"],[
1692 AC_MSG_WARN([library 'wind' may be required for Heimdal Kerberos])
1693 ])
1694 LIBS=$LIB_KRB5_LIBS
1695 AC_CHECK_LIB(crypto, [main], [LIB_KRB5_LIBS="-lcrypto $LIB_KRB5_LIBS"],[
1696 AC_MSG_WARN([library 'crypto' is required for Heimdal Kerberos])
1697 missing_required=yes
1698 ])
1699 LIBS=$LIB_KRB5_LIBS
1700 AC_CHECK_LIB(com_err, [main], [LIB_KRB5_LIBS="-lcom_err $LIB_KRB5_LIBS"],[
1701 AC_MSG_WARN([library 'com_err' is required for Heimdal Kerberos])
1702 missing_required=yes
1703 ])
1704 LIBS=$LIB_KRB5_LIBS
1705 AC_CHECK_LIB(hx509, [main], [LIB_KRB5_LIBS="-lhx509 $LIB_KRB5_LIBS"],[
1706 AC_MSG_WARN([library 'hx509' may be required for Heimdal Kerberos])
1707 ])
1708 LIBS=$LIB_KRB5_LIBS
1709 AC_CHECK_LIB(asn1, [main], [LIB_KRB5_LIBS="-lasn1 $LIB_KRB5_LIBS"],[
1710 AC_MSG_WARN([library 'asn1' is required for Heimdal Kerberos])
1711 missing_required=yes
1712 ])
1713 LIBS=$LIB_KRB5_LIBS
1714 AC_CHECK_LIB(krb5, [main], [LIB_KRB5_LIBS="-lkrb5 $LIB_KRB5_LIBS"],[
1715 AC_MSG_WARN([library 'krb5' is required for Heimdal Kerberos])
1716 missing_required=yes
1717 ])
1718 LIBS=$LIB_KRB5_LIBS
1719 AC_CHECK_LIB(heimntlm, [main], [LIB_KRB5_LIBS="-lheimntlm $LIB_KRB5_LIBS"],[
1720 AC_MSG_WARN([library 'heimntlm' may be required for Heimdal Kerberos])
1721 ])
1722 LIBS=$LIB_KRB5_LIBS
1723 AC_CHECK_LIB(gssapi, [main], [LIB_KRB5_LIBS="-lgssapi $LIB_KRB5_LIBS"],[
1724 AC_MSG_WARN([library 'gssapi' is required for Heimdal Kerberos])
1725 missing_required=yes
1726 ])
1727 SQUID_STATE_ROLLBACK([squid_heimdal_save])
1728 if test "x$missing_required" = "xyes"; then
1729 LIB_KRB5_LIBS=""
1730 fi
1731 fi
1732 ])
1733 if test "x$LIB_KRB5_LIBS" != "x"; then
1734 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1735 KRB5INCS="$LIB_KRB5_CFLAGS"
1736 AC_DEFINE(USE_HEIMDAL_KRB5,1,[Heimdal Kerberos support is available])
1737 KRB5_FLAVOUR="Heimdal"
1738
1739 # check for other specific broken implementations
1740 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1741 LIBS="$LIBS $KRB5LIBS"
1742
1743 AC_MSG_NOTICE([Try to find Kerberos headers in given path])
1744 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h gssapi/gssapi_krb5.h)
1745 AC_CHECK_HEADERS(krb5.h com_err.h et/com_err.h)
1746
1747 SQUID_CHECK_KRB5_HEIMDAL_BROKEN_KRB5_H
1748 if test "x$squid_cv_broken_heimdal_krb5_h" = "xyes"; then
1749 AC_DEFINE(HAVE_BROKEN_HEIMDAL_KRB5_H, 1, [Define to 1 if Heimdal krb5.h is broken for C++])
1750 fi
1751 SQUID_CHECK_KRB5_FUNCS
1752 fi
1753 if test "x$KRB5LIBS" = "x"; then
1754 if test test "x$with_heimdal_krb5" = "xyes"; then
1755 AC_MSG_ERROR([Required Heimdal Kerberos library not found])
1756 else
1757 AC_MSG_WARN([Heimdal Kerberos library not found])
1758 fi
1759 fi
1760 SQUID_STATE_ROLLBACK([squid_krb5_save])
1761 fi
1762
1763 dnl User may specify GNU gss is needed from a non-standard location
1764 AC_ARG_WITH(gnugss,
1765 AS_HELP_STRING([--without-gnugss],
1766 [Compile without the GNU gss libraries.]), [
1767 case "$with_gnugss" in
1768 yes|no)
1769 : # Nothing special to do here
1770 ;;
1771 *)
1772 if test ! -d "$withval" ; then
1773 AC_MSG_ERROR([--with-gnugss path does not point to a directory])
1774 fi
1775 if test ! -d "$with_gnugss/lib64" ; then
1776 LIB_KRB5_PATH="-L$with_gnugss/lib64 -L$with_gnugss/lib"
1777 else
1778 LIB_KRB5_PATH="-L$with_gnugss/lib"
1779 fi
1780 CXXFLAGS="-I$with_gnugss/include $CXXFLAGS"
1781 krb5confpath=
1782 with_gnugss=yes
1783 esac
1784 ])
1785 AH_TEMPLATE(USE_GNUGSS,[GNU gss support is available])
1786 if test "x$with_gnugss" != "xno" -a "x$KRB5LIBS" = "x"; then
1787 SQUID_STATE_SAVE([squid_krb5_save])
1788 LIBS="$LIBS $LIB_KRB5_PATH"
1789
1790 # auto-detect using pkg-config
1791 PKG_CHECK_MODULES([LIB_KRB5],[gss],,[
1792 ## For some OS pkg-config is broken or unavailable.
1793 ## Detect libraries the hard way.
1794
1795 AC_MSG_NOTICE([Try to find Kerberos libraries in given path])
1796 AC_CHECK_LIB(gss, [main], [LIB_KRB5_LIBS="-lgss $LIB_KRB5_LIBS"],[
1797 AC_MSG_WARN([library 'com_err' is required for GNU Kerberos])
1798 ])
1799 ])
1800
1801 if test "x$LIB_KRB5_LIBS" != "x"; then
1802 KRB5LIBS="$LIB_KRB5_PATH $LIB_KRB5_LIBS $KRB5LIBS"
1803 KRB5INCS="$LIB_KRB5_CFLAGS"
1804 AC_DEFINE(USE_GNUGSS,1,[GNU Kerberos support is available])
1805 KRB5_FLAVOUR="GNU GSS"
1806
1807 # check for other specific broken implementations
1808 CXXFLAGS="$CXXFLAGS $KRB5INCS"
1809 LIBS="$LIBS $KRB5LIBS"
1810
1811 AC_MSG_NOTICE([Try to find Kerbeors headers in given path])
1812 AC_CHECK_HEADERS(gss.h)
1813
1814 SQUID_CHECK_WORKING_GSSAPI
1815 SQUID_DEFINE_BOOL(HAVE_GSSAPI,$squid_cv_working_gssapi,[GSSAPI support])
1816
1817 SQUID_CHECK_SPNEGO_SUPPORT
1818 SQUID_DEFINE_BOOL(HAVE_SPNEGO,$squid_cv_have_spnego,[SPNEGO support])
1819
1820 SQUID_CHECK_WORKING_KRB5
1821 SQUID_DEFINE_BOOL(HAVE_KRB5,$squid_cv_working_krb5,[KRB5 support])
1822 fi
1823 if test "x$KRB5LIBS" = "x"; then
1824 if test test "x$with_gnugss" = "xyes"; then
1825 AC_MSG_ERROR([Required GNU GSS Kerberos library not found])
1826 else
1827 AC_MSG_WARN([GNU GSS Kerberos library not found])
1828 fi
1829 fi
1830 SQUID_STATE_ROLLBACK([squid_krb5_save])
1831 fi
1832
1833 if test "x$KRB5LIBS" != "x"; then
1834 with_krb5=yes
1835 fi
1836 AC_MSG_NOTICE([$KRB5_FLAVOUR Kerberos library support: ${with_krb5:=no} ${LIB_KRB5_PATH} ${LIB_KRB5_LIBS}])
1837 AC_SUBST(KRB5INCS)
1838 AC_SUBST(KRB5LIBS)
1839 AM_CONDITIONAL(HAVE_SPNEGO, test x"$squid_cv_have_spnego" = x"yes" )
1840
1841 dnl On MinGW OpenLDAP is not available, so LDAP helpers can be linked
1842 dnl only with Windows LDAP libraries using -lwldap32
1843 case "$squid_host_os" in
1844 mingw)
1845 LDAPLIB="-lwldap32"
1846 LBERLIB=""
1847 ;;
1848 *)
1849 AC_CHECK_LIB(ldap, ldap_init, [LDAPLIB="-lldap"])
1850 dnl LDAP helpers need to know if -llber is needed or not
1851 AC_CHECK_LIB(lber, ber_init, [LBERLIB="-llber"])
1852 dnl if no ldap lib found check for mozilla version
1853 if test "x$ac_cv_lib_ldap_ldap_init" != x""yes; then
1854 oLIBS=$LIBS
1855 LIBS="$LIBPTHREADS"
1856 AC_CHECK_LIB(ldap60, ldap_init, [LDAPLIB="-lldap60"])
1857 LIBS="$LDAPLIB $LIBPTHREADS"
1858 AC_CHECK_LIB(prldap60, prldap_init, [LDAPLIB="-lprldap60 $LDAPLIB"])
1859 LIBS="$LDAPLIB $LIBPTHREADS"
1860 AC_CHECK_LIB(ssldap60, ldapssl_init, [LDAPLIB="-lssldap60 $LDAPLIB"])
1861 LIBS=$oLIBS
1862 fi
1863
1864 AC_CHECK_HEADERS(ldap.h lber.h)
1865 AC_CHECK_HEADERS(mozldap/ldap.h)
1866
1867 dnl
1868 dnl Check for LDAP_OPT_DEBUG_LEVEL
1869 dnl
1870 AC_MSG_CHECKING([for LDAP_OPT_DEBUG_LEVEL])
1871 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1872 # include <ldap.h>
1873 ]],[[
1874 int i=LDAP_OPT_DEBUG_LEVEL
1875 ]])],
1876 [ AC_MSG_RESULT(yes) ],
1877 [ AC_MSG_RESULT(no) ])
1878
1879 dnl
1880 dnl Check for working ldap
1881 dnl
1882 oLIBS=$LIBS
1883 LIBS="$LDAPLIB $LBERLIB $LIBPTHREADS"
1884 AC_MSG_CHECKING([for working ldap])
1885 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1886 # define LDAP_DEPRECATED 1
1887 # if HAVE_LDAP_H
1888 # include <ldap.h>
1889 # elif HAVE_MOZLDAP_LDAP_H
1890 # include <mozldap/ldap.h>
1891 # endif
1892 int
1893 main(void)
1894 {
1895 char host[]="";
1896 int port;
1897
1898 ldap_init((const char *)&host, port);
1899
1900 return 0;
1901 }
1902 ]])],
1903 [ AC_DEFINE(HAVE_LDAP, 1, [LDAP support])
1904 AC_MSG_RESULT(yes) ],
1905 [ AC_MSG_RESULT(no) ],
1906 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1907 LIBS=$oLIBS
1908
1909 dnl
1910 dnl Check for ldap vendor
1911 dnl
1912 AC_MSG_CHECKING([for OpenLDAP])
1913 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1914 # if HAVE_LDAP_H
1915 # include <ldap.h>
1916 # endif
1917 # include <string.h>
1918 int
1919 main(void)
1920 {
1921 return strcmp(LDAP_VENDOR_NAME,"OpenLDAP");
1922 }
1923 ]])],
1924 [ AC_DEFINE(HAVE_OPENLDAP, 1, [OpenLDAP support])
1925 AC_MSG_RESULT(yes) ],
1926 [ AC_MSG_RESULT(no) ],
1927 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1928
1929 AC_MSG_CHECKING([for Sun LDAP SDK])
1930 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1931 # if HAVE_LDAP_H
1932 # include <ldap.h>
1933 # endif
1934 # include <string.h>
1935 int
1936 main(void)
1937 {
1938 return strcmp(LDAP_VENDOR_NAME,"Sun Microsystems Inc.");
1939 }
1940 ]])],
1941 [ AC_DEFINE(HAVE_SUN_LDAP_SDK, 1, [Sun LDAP SDK support])
1942 AC_MSG_RESULT(yes) ],
1943 [ AC_MSG_RESULT(no) ],
1944 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1945
1946 AC_MSG_CHECKING([for Mozilla LDAP SDK])
1947 AC_RUN_IFELSE([AC_LANG_SOURCE([[
1948 # if HAVE_LDAP_H
1949 # include <ldap.h>
1950 # elif HAVE_MOZLDAP_LDAP_H
1951 # include <mozldap/ldap.h>
1952 # endif
1953 # include <string.h>
1954 int
1955 main(void)
1956 {
1957 return strcmp(LDAP_VENDOR_NAME,"mozilla.org");
1958 }
1959 ]])],
1960 [ AC_DEFINE(HAVE_MOZILLA_LDAP_SDK, 1, [Mozilla LDAP SDK support])
1961 AC_MSG_RESULT(yes) ],
1962 [ AC_MSG_RESULT(no)],
1963 [ AC_MSG_RESULT(cross-compiler cant tell) ])
1964
1965 dnl
1966 dnl Check for LDAP_REBINDPROC_CALLBACK
1967 dnl
1968 AC_MSG_CHECKING([for LDAP_REBINDPROC_CALLBACK])
1969 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1970 # if HAVE_LDAP_H
1971 # include <ldap.h>
1972 # elif HAVE_MOZLDAP_LDAP_H
1973 # include <mozldap/ldap.h>
1974 # endif
1975 ]],[[
1976 LDAP_REBINDPROC_CALLBACK ldap_rebind;
1977 ]])],
1978 [ AC_DEFINE(HAVE_LDAP_REBINDPROC_CALLBACK,1,[Define to 1 if you have LDAP_REBINDPROC_CALLBACK])
1979 AC_MSG_RESULT(yes) ],
1980 [ AC_MSG_RESULT(no) ])
1981
1982 dnl
1983 dnl Check for LDAP_REBIND_PROC
1984 dnl
1985 AC_MSG_CHECKING([for LDAP_REBIND_PROC])
1986 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1987 # if HAVE_LDAP_H
1988 # include <ldap.h>
1989 # elif HAVE_MOZLDAP_LDAP_H
1990 # include <mozldap/ldap.h>
1991 # endif
1992 ]],[[
1993 LDAP_REBIND_PROC ldap_rebind;
1994 ]])],
1995 [ AC_DEFINE(HAVE_LDAP_REBIND_PROC,1,[Define to 1 if you have LDAP_REBIND_PROC])
1996 AC_MSG_RESULT(yes) ],
1997 [ AC_MSG_RESULT(no) ])
1998
1999 dnl
2000 dnl Check for LDAP_REBIND_FUNCTION
2001 dnl
2002 AC_MSG_CHECKING([for LDAP_REBIND_FUNCTION])
2003 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2004 # define LDAP_REFERRALS
2005 # if HAVE_LDAP_H
2006 # include <ldap.h>
2007 # elif HAVE_MOZLDAP_LDAP_H
2008 # include <mozldap/ldap.h>
2009 # endif
2010 ]],[[
2011 LDAP_REBIND_FUNCTION ldap_rebind;
2012 ]])],
2013 [ AC_DEFINE(HAVE_LDAP_REBIND_FUNCTION,1,[Define to 1 if you have LDAP_REBIND_FUNCTION])
2014 AC_MSG_RESULT(yes) ],
2015 [ AC_MSG_RESULT(no) ])
2016
2017 dnl
2018 dnl Check for LDAP_SCOPE_DEFAULT
2019 dnl
2020 AC_MSG_CHECKING([for LDAP_SCOPE_DEFAULT])
2021 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2022 # if HAVE_LDAP_H
2023 # include <ldap.h>
2024 # elif HAVE_MOZLDAP_LDAP_H
2025 # include <mozldap/ldap.h>
2026 # endif
2027 ]],[[
2028 int i=LDAP_SCOPE_DEFAULT;
2029 ]])],
2030 [ AC_DEFINE(HAVE_LDAP_SCOPE_DEFAULT,1,[Define to 1 if you have LDAP_SCOPE_DEFAULT])
2031 AC_MSG_RESULT(yes) ],
2032 [ AC_MSG_RESULT(no) ])
2033
2034 dnl
2035 dnl Check for ldap_url_desc.lud_scheme
2036 dnl
2037 AC_CHECK_MEMBER(struct ldap_url_desc.lud_scheme,
2038 AC_DEFINE(HAVE_LDAP_URL_LUD_SCHEME,1,
2039 [Define to 1 if you have LDAPURLDesc.lud_scheme]),,[#include <ldap.h>])
2040
2041 dnl
2042 dnl Check for ldapssl_client_init
2043 dnl
2044 AC_CHECK_LIB(ldap,ldapssl_client_init,
2045 AC_DEFINE(HAVE_LDAPSSL_CLIENT_INIT,1,[Define to 1 if you have ldapssl_client_init]),)
2046
2047 dnl
2048 dnl Check for ldap_url_desc2str
2049 dnl
2050 AC_CHECK_LIB(ldap,ldap_url_desc2str,
2051 AC_DEFINE(HAVE_LDAP_URL_DESC2STR,1,[Define to 1 if you have ldap_url_desc2str]),)
2052
2053 dnl
2054 dnl Check for ldap_url_parse
2055 dnl
2056 AC_CHECK_LIB(ldap,ldap_url_parse,
2057 AC_DEFINE(HAVE_LDAP_URL_PARSE,1,[Define to 1 if you have ldap_url_parse]),)
2058
2059 dnl
2060 dnl Check for ldap_start_tls_s
2061 dnl
2062 AC_CHECK_LIB(ldap,ldap_start_tls_s,
2063 AC_DEFINE(HAVE_LDAP_START_TLS_S,1,[Define to 1 if you have ldap_start_tls_s]),)
2064 ;;
2065 esac
2066
2067 AC_SUBST(LDAPLIB)
2068 AC_SUBST(LBERLIB)
2069
2070 AC_ARG_ENABLE(forw-via-db,
2071 AS_HELP_STRING([--enable-forw-via-db],[Enable Forw/Via database]), [
2072 SQUID_YESNO([$enableval],[unrecognized argument to --enable-forw-via-db: $enableval])
2073 ])
2074 SQUID_DEFINE_BOOL(USE_FORW_VIA_DB,${enable_forw_via_db:=no},
2075 [Enable Forw/Via database])
2076 AC_MSG_NOTICE([Forw/Via database enabled: $enable_forw_via_db])
2077
2078 AC_ARG_ENABLE(cache-digests,
2079 AS_HELP_STRING([--enable-cache-digests],
2080 [Use Cache Digests. See http://wiki.squid-cache.org/SquidFaq/CacheDigests]),
2081 [
2082 SQUID_YESNO($enableval,
2083 [unrecognized argument to --enable-cache-digests: $enableval])
2084 ])
2085 SQUID_DEFINE_BOOL(USE_CACHE_DIGESTS,${enable_cache_digests:=no},
2086 [Use Cache Digests for locating objects in neighbor caches.])
2087 AC_MSG_NOTICE([Cache Digests enabled: $enable_cache_digests])
2088
2089
2090 ################################
2091 # check for netio plugin stuff #
2092 ################################
2093 dnl order of these options handling is relevant in case the user
2094 dnl supplies more than one --enable option. Options handled later
2095 dnl override those handled earlier for io loop method manual override
2096 AC_ARG_ENABLE(select,
2097 AS_HELP_STRING([--disable-select],[Disable select(2) support.]),
2098 [
2099 SQUID_YESNO($enableval,[--disable-select takes no extra argument])
2100 if test "x$enableval" = "xyes"; then
2101 if test "x$squid_host_os" = "xmingw"; then
2102 squid_opt_io_loop_engine="select_win32"
2103 else
2104 squid_opt_io_loop_engine="select"
2105 fi
2106 fi
2107 ])
2108 AC_MSG_NOTICE([enabling select syscall for net I/O: ${enable_select:=auto}])
2109
2110 AC_ARG_ENABLE(poll,
2111 AS_HELP_STRING([--disable-poll],[Disable poll(2) support.]),
2112 [
2113 SQUID_YESNO($enableval,[--disable-poll takes no extra argument])
2114 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="poll"
2115 ])
2116 AC_MSG_NOTICE([enabling poll syscall for net I/O: ${enable_poll:=auto}])
2117
2118 AC_ARG_ENABLE(kqueue,
2119 AS_HELP_STRING([--disable-kqueue],
2120 [Disable kqueue(2) support.]), [
2121 SQUID_YESNO($enableval,[--enable-kqueue takes no extra argument])
2122 ])
2123 if test "x${enable_kqueue:=auto}" != "xno" ; then
2124 AC_CHECK_HEADERS([sys/event.h],[],[
2125 if test "x${enable_kqueue}" = "xyes" ; then
2126 AC_MSG_ERROR([kqueue support requires sys/event.h header file.])
2127 fi
2128 ])
2129 AC_CHECK_FUNCS(kqueue,[],[
2130 if test "x${enable_kqueue}" = "xyes" ; then
2131 AC_MSG_ERROR([kqueue support missing in libc library.])
2132 fi
2133 ])
2134 if test "x$ac_cv_func_kqueue" = "xyes" -a "x$ac_cv_header_sys_event_h" = "xyes" ; then
2135 squid_opt_io_loop_engine="kqueue"
2136 else
2137 enable_kqueue="no"
2138 fi
2139 fi
2140 AC_MSG_NOTICE([enabling kqueue for net I/O: ${enable_kqueue:=auto}])
2141
2142 dnl Enable epoll()
2143 AC_ARG_ENABLE(epoll,
2144 AS_HELP_STRING([--disable-epoll],[Disable Linux epoll(2) support.]),
2145 [
2146 SQUID_YESNO($enableval,[--disable-epoll takes no extra argument])
2147 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="epoll"
2148 ])
2149 AC_MSG_NOTICE([enabling epoll syscall for net I/O: ${enable_epoll:=auto}])
2150
2151 # auto-detect and verify epoll header and library present and working
2152 # logic mapping and loop method selection are performed later
2153 if test "x$enable_epoll" != "xno" ; then
2154
2155 # check if libs are needed to support epoll
2156 # note: this code block seems quite generic. Could it be extracted
2157 # into a squid specific configure function?
2158 SQUID_STATE_SAVE(squid_epoll_state)
2159 AC_SEARCH_LIBS(epoll_ctl,[epoll])
2160 if test "x$ac_cv_search_epoll_ctl" = "xno" ; then
2161 enable_epoll=no #disable. Needed code not found
2162 elif test "x$ac_cv_search_epoll_ctl" = "xnone required" ; then
2163 EPOLL_LIBS=""
2164 else
2165 EPOLL_LIBS=$ac_cv_search_epoll_ctl
2166 fi
2167 AC_SUBST(EPOLL_LIBS)
2168 SQUID_STATE_ROLLBACK(squid_epoll_state) #de-pollute LIBS
2169
2170 # epoll requires sys/epoll.h
2171 AC_CHECK_HEADERS([sys/epoll.h])
2172
2173 dnl Verify that epoll really works
2174 if test "x$ac_cv_search_epoll_ctl" != 'xno' ; then
2175 SQUID_CHECK_EPOLL
2176 fi
2177
2178 if test "x$enable_epoll" = "xyes" -a "x$squid_cv_epoll_works" = "xno" ; then
2179 AC_MSG_ERROR([Epoll does not work. Force-enabling it is not going to help.])
2180 fi
2181 fi
2182
2183 dnl Enable /dev/poll
2184 AC_ARG_ENABLE(devpoll,
2185 AS_HELP_STRING([--disable-devpoll],[Disable Solaris /dev/poll support.]),
2186 [
2187 SQUID_YESNO($enableval,[--disable-devpoll takes no extra argument])
2188 test "x$enableval" = "xyes" && squid_opt_io_loop_engine="devpoll"
2189 ])
2190 AC_MSG_NOTICE([enabling /dev/poll for net I/O: ${enable_devpoll:=auto}])
2191
2192 ## auto-detect and verify devpoll header and library present and working
2193 if test "x$enable_devpoll" != "xno"; then
2194
2195 # /dev/poll requires ioctl() and write()
2196 AC_CHECK_FUNCS(ioctl)
2197 AC_CHECK_FUNCS(write)
2198
2199 # /dev/poll requires sys/devpoll.h
2200 AC_CHECK_HEADERS([sys/devpoll.h],,[
2201 if test "x$enable_devpoll" = "xyes"; then
2202 AC_MSG_ERROR([--enable-devpoll specified but /dev/poll headers not found])
2203 fi
2204 enable_devpoll=no])
2205
2206 # Verify that /dev/poll really works
2207 if test "x$enable_devpoll" != 'xno' ; then
2208 SQUID_CHECK_DEVPOLL
2209 fi
2210
2211 if test "x$enable_devpoll" = "xyes" -a "x$squid_cv_devpoll_works" = "xno" ; then
2212 AC_MSG_ERROR([/dev/poll does not work. Force-enabling it is not going to help.])
2213 fi
2214 fi
2215
2216
2217 AC_ARG_ENABLE(http-violations,
2218 AS_HELP_STRING([--disable-http-violations],
2219 [This allows you to remove code which is known to
2220 violate the HTTP protocol specification.]), [
2221 SQUID_YESNO([$enableval],
2222 [unrecognized argument to --disable-http-violations: $enableval])
2223 ])
2224 SQUID_DEFINE_BOOL(USE_HTTP_VIOLATIONS, ${enable_http_violations:=yes},
2225 [Define to enable code which volates the HTTP standard specification])
2226 AC_MSG_NOTICE([HTTP violations support enabled: $enable_http_violations])
2227
2228 # IPFW Transparent Proxy
2229 AC_ARG_ENABLE(ipfw-transparent,
2230 AS_HELP_STRING([--enable-ipfw-transparent],
2231 [Enable Transparent Proxy support for systems
2232 using FreeBSD IPFW-style firewalling.]), [
2233 SQUID_YESNO([$enableval],
2234 [unrecognized argument to --enable-ipfw-transparent: $enableval])
2235 ])
2236 SQUID_DEFINE_BOOL(IPFW_TRANSPARENT,${enable_ipfw_transparent:=no},
2237 [Enable support for Transparent Proxy on systems using FreeBSD IPFW-style firewalling.])
2238 AC_MSG_NOTICE([FreeBSD IPFW-based transparent proxying enabled: $enable_ipfw_transparent])
2239
2240 # IP-Filter Transparent Proxy
2241 AC_ARG_ENABLE(ipf-transparent,
2242 AS_HELP_STRING([--enable-ipf-transparent],
2243 [Enable Transparent Proxy support using IPFilter-style firewalling]), [
2244 SQUID_YESNO([$enableval],
2245 [unrecognized argument to --enable-ipf-transparent: $enableval])
2246 ])
2247 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2248 #IPF currently broken. Default-disabled for now.
2249 AC_MSG_NOTICE([IPF-based transparent proxying requested: ${enable_ipf_transparent:=no}])
2250
2251 dnl Enable PF Transparent Proxy
2252 AC_ARG_ENABLE(pf-transparent,
2253 AS_HELP_STRING([--enable-pf-transparent],
2254 [Enable Transparent Proxy support for systems using PF network address redirection.]), [
2255 SQUID_YESNO([$enableval],
2256 [unrecognized argument to --enable-pf-transparent: $enableval])
2257 ])
2258 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2259 AC_MSG_NOTICE([PF-based transparent proxying requested: ${enable_pf_transparent:=no}])
2260
2261 dnl Enable /dev/pf support for older PF Transparent Proxy systems (OpenBSD 4.x and older)
2262 AC_ARG_WITH(nat-devpf,
2263 AS_HELP_STRING([--with-nat-devpf],
2264 [Enable /dev/pf support for NAT on older OpenBSD and FreeBSD kernels.]), [
2265 SQUID_YESNO([$enableval],
2266 [unrecognized argument to --with-nat-devpf: $enableval])
2267 ])
2268 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2269 AC_MSG_NOTICE([NAT lookups via /dev/pf: ${with_nat_devpf:=no}])
2270
2271 # Linux Netfilter Transparent Proxy
2272 AC_ARG_ENABLE(linux-netfilter,
2273 AS_HELP_STRING([--enable-linux-netfilter],
2274 [Enable Transparent Proxy support for Linux (Netfilter)]), [
2275 SQUID_YESNO([$enableval],
2276 [unrecognized argument to --enable-linux-netfilter: $enableval])
2277 ])
2278 AC_MSG_NOTICE([Linux Netfilter support requested: ${enable_linux_netfilter:=auto}])
2279 #will be AC_DEFINEd later, after checking for appropriate infrastructure
2280
2281
2282 dnl Look for libnetfilter_conntrack options (needed for QOS netfilter marking)
2283 dnl squid_opt_netfilterconntrack is set only when option is explicity specified
2284 AC_ARG_WITH(netfilter-conntrack,
2285 AS_HELP_STRING([--without-netfilter-conntrack],
2286 [Do not use Netfilter conntrack libraries for packet marking.
2287 A path to alternative library location may be specified by
2288 using --with-netfilter-conntrack=PATH. Default: auto-detect.]), [
2289 case "$with_netfilter_conntrack" in
2290 yes|no)
2291 squid_opt_netfilterconntrack=$with_netfilter_conntrack
2292 ;;
2293 *)
2294 if test ! -d "$withval" ; then
2295 AC_MSG_ERROR([--without-netfilter-conntrack path does not point to a directory])
2296 fi
2297 squid_opt_netfilterconntrackpath=$withval
2298 LDFLAGS="-L$squid_opt_netfilterconntrackpath/lib $LDFLAGS"
2299 CPPFLAGS="-I$squid_opt_netfilterconntrackpath/include $CPPFLAGS"
2300 with_netfilter_conntrack=yes
2301 squid_opt_netfilterconntrack=yes
2302 esac
2303 ])
2304 AC_MSG_NOTICE([Linux Netfilter Conntrack support requested: ${with_netfilter_conntrack:=auto}])
2305 if test "x$with_netfilter_conntrack" != "xno"; then
2306 AC_SEARCH_LIBS([nfct_query], [netfilter_conntrack],,[
2307 if test x"$with_netfilter_conntrack" = "xyes"; then
2308 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack library not found])
2309 fi
2310 with_netfilter_conntrack=no])
2311 AC_CHECK_HEADERS([libnetfilter_conntrack/libnetfilter_conntrack.h \
2312 libnetfilter_conntrack/libnetfilter_conntrack_tcp.h],,[
2313 if test x"$with_netfilter_conntrack" = "xyes"; then
2314 AC_MSG_ERROR([--with-netfilter-conntrack specified but libnetfilter-conntrack headers not found])
2315 fi
2316 with_netfilter_conntrack=no])
2317 # If nothing is broken; enable the libraries usage.
2318 if test "x$with_netfilter_conntrack" != "xno"; then
2319 with_netfilter_conntrack=yes
2320 fi
2321 fi
2322
2323
2324 dnl Enable Large file support
2325 buildmodel=""
2326 squid_opt_enable_large_files=no
2327
2328 AC_ARG_WITH(large-files,
2329 AS_HELP_STRING([--with-large-files],[Enable support for large files (logs etc).]), [
2330 if test "x$withval" = "xyes"; then
2331 squid_opt_enable_large_files=yes
2332 fi
2333 ])
2334
2335 dnl UNIX Build environment
2336 dnl AS_HELP_STRING is not suited here because it cannot to specify newlines
2337 AC_ARG_WITH(build-environment,
2338 AS_HELP_STRING([--with-build-environment=model],
2339 [The build environment to use. Normally one of
2340 POSIX_V6_ILP32_OFF32 (32 bits),
2341 POSIX_V6_ILP32_OFFBIG (32 bits with large file support),
2342 POSIX_V6_LP64_OFF64 (64 bits),
2343 POSIX_V6_LPBIG_OFFBIG (large pointers and files),
2344 XBS5_ILP32_OFF32 i(legacy, 32 bits),
2345 XBS5_ILP32_OFFBIG (legacy, 32 bits with large file support),
2346 XBS5_LP64_OFF64 (legacy, 64 bits),
2347 XBS5_LPBIG_OFFBIG (legacy, large pointers and files)
2348 or default (The default for your OS)]), [
2349 case "$withval" in
2350 yes|no)
2351 AC_MSG_FAILURE([--with-build-environment expects a build environment string as used by getconf])
2352 ;;
2353 *)
2354 buildmodel="$withval"
2355 ;;
2356 esac
2357 ])
2358
2359 #hack. Let's early-detect sizeof(long)
2360 AC_CHECK_SIZEOF(long)
2361
2362 if test "x$squid_opt_enable_large_files" = "xyes" -a "x$buildmodel" = "x"; then
2363 for model in POSIX_V6_LPBIG_OFFBIG XBS5_LPBIG_OFFBIG POSIX_V6_LP64_OFF64 XBS5_LP64_OFF64 POSIX_V6_ILP32_OFFBIG XBS5_ILP32_OFFBIG; do
2364 if test "`getconf _$model 2>/dev/null || true`" = 1 || test "`getconf $model 2>/dev/null || true`" ; then
2365 buildmodel=$model
2366 break
2367 fi
2368 done
2369 if test "x$buildmodel" = "x"; then
2370 AC_MSG_WARN([No suitable build environment found for large files. Trying to use _FILE_OFFSET_BITS=64])
2371 fi
2372 fi
2373 if test "x$buildmodel" = "xdefault" -o "x$buildmodel" = "x"; then
2374 # define _FILE_OFFSET_BITS if requested and needed
2375 if test "x$squid_opt_enable_large_files" = "xyes" -a $ac_cv_sizeof_long -le 4 ; then
2376 AC_MSG_NOTICE([Enabling -D_FILE_OFFSET_BITS=64])
2377 CFLAGS="-D_FILE_OFFSET_BITS=64 $CFLAGS"
2378 CXXFLAGS="-D_FILE_OFFSET_BITS=64 $CXXFLAGS"
2379 fi
2380 else
2381 AC_MSG_NOTICE([Using $buildmodel build environment])
2382 if test "`getconf _$buildmodel 2>/dev/null || true`" = 1 || test "`getconf $buildmodel 2>/dev/null || true`" ; then
2383 : # All fine
2384 else
2385 AC_MSG_ERROR(Build environment $buildmodel not known to getconf.)
2386 fi
2387 CFLAGS="`getconf ${buildmodel}_CFLAGS` $CFLAGS"
2388 CXXFLAGS="`getconf ${buildmodel}_CFLAGS` $CXXFLAGS"
2389 LIBS="`getconf ${buildmodel}_LIBS` $LIBS"
2390 LDFLAGS="`getconf ${buildmodel}_LDFLAGS` $LDFLAGS"
2391 if test "x$squid_host_os" = "xsolaris" ; then
2392
2393 # On Solaris getconf returns for CFLAGS -xarch=generic64, -Xa and -Usun options, and
2394 # for LDFLAGS -xarch=generic64, but:
2395 # "-Xa" is supported only by Sun cc, so we need to remove it when using gcc
2396 # For gcc "-xarch=generic64" must be replaced with "-m64"
2397 # The 'sun' define is needed by ipfilter includes, so we must remove "-Usun"
2398 if test "x$GCC" = "xyes"; then
2399 AC_MSG_NOTICE([Removing -Xa for gcc/g++ on $host])
2400 CFLAGS="`echo $CFLAGS | sed -e 's/-Xa//'`"
2401 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Xa//'`"
2402 AC_MSG_NOTICE([Replacing -xarch=generic64 with -m64 for gcc/g++ on $host])
2403 CFLAGS="`echo $CFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2404 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-xarch=generic64/-m64/'`"
2405 LDFLAGS="`echo $LDFLAGS | sed -e 's/-xarch=generic64//'`"
2406 fi
2407 AC_MSG_NOTICE([Removing -Usun on $host])
2408 CFLAGS="`echo $CFLAGS | sed -e 's/-Usun//'`"
2409 CXXFLAGS="`echo $CXXFLAGS | sed -e 's/-Usun//'`"
2410 fi
2411 fi
2412
2413 dnl Enable Leak Finding Functions
2414 AC_ARG_ENABLE(leakfinder,
2415 AS_HELP_STRING([--enable-leakfinder],
2416 [Enable Leak Finding code. Enabling this alone does nothing;
2417 you also have to modify the source code to use the leak
2418 finding functions. Probably Useful for hackers only.]), [
2419 SQUID_YESNO([$enableval],
2420 [unrecognized argument to --enable-leakfinder: $enableval])
2421 ])
2422 AC_MSG_NOTICE([Leak Finder enabled: ${enable_leakfinder:=no}])
2423 SQUID_DEFINE_BOOL(USE_LEAKFINDER,$enable_leakfinder,
2424 [Enable code for assisting in finding memory leaks. Not for the faint of heart])
2425 AM_CONDITIONAL(MAKE_LEAKFINDER, [test "x$enable_leakfinder" = "xyes"])
2426
2427
2428 AC_ARG_ENABLE(follow-x-forwarded-for,
2429 AS_HELP_STRING([--enable-follow-x-forwarded-for],
2430 [Enable support for following the X-Forwarded-For
2431 HTTP header to try to find the IP address of the
2432 original or indirect client when a request has
2433 been forwarded through other proxies.]), [
2434 SQUID_YESNO([$enableval],
2435 [unrecognized argument to --enable-follow-x-forwarded-for: $enableval])
2436 ])
2437 AC_MSG_NOTICE([Support for X-Forwarded-For enabled: ${enable_follow_x_forwarded_for:=yes}])
2438 SQUID_DEFINE_BOOL(FOLLOW_X_FORWARDED_FOR,$enable_follow_x_forwarded_for,
2439 [Enable following X-Forwarded-For headers])
2440
2441 AC_ARG_ENABLE(ident-lookups,
2442 AS_HELP_STRING([--disable-ident-lookups],
2443 [Remove code that supports performing Ident (RFC 931) lookups.]), [
2444 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ident-lookups: $enableval])
2445 ])
2446 AC_MSG_NOTICE([Support for Ident lookups enabled: ${enable_ident_lookups:=yes}])
2447 SQUID_DEFINE_BOOL(USE_IDENT,$enable_ident_lookups,[Support for Ident (RFC 931) lookups])
2448
2449 dnl Select Default hosts file location
2450 AC_ARG_ENABLE(default-hostsfile,
2451 AS_HELP_STRING([--enable-default-hostsfile=path],
2452 [Select default location for hosts file.
2453 See hosts_file directive in squid.conf for details]), [
2454 if test "x$enableval" != "xnone" -a "x$enableval" != "xno" ; then
2455 if test \! -f "$enableval"; then
2456 AC_MSG_WARN([Unable to find file $enableval. I hope you know what you are doing.])
2457 fi
2458 squid_opt_default_hosts=$enableval
2459 else
2460 squid_opt_default_hosts="none"
2461 fi
2462 ])
2463 AC_MSG_NOTICE([Default hosts file set to: ${squid_opt_default_hosts:=/etc/hosts}])
2464 DEFAULT_HOSTS=$squid_opt_default_hosts
2465 AC_SUBST(DEFAULT_HOSTS)
2466
2467 # Select auth schemes modules to build
2468 AC_ARG_ENABLE(auth,
2469 AS_HELP_STRING([--enable-auth],
2470 [Build global support for authentication. The list of schemes
2471 and helpers to be enabled is defined elsewhere]), [
2472 SQUID_YESNO([$enableval],
2473 [unrecognized argument to --enable-auth: $enableval])
2474 ])
2475 AC_MSG_NOTICE([Authentication support enabled: ${enable_auth:=yes}])
2476 SQUID_DEFINE_BOOL(USE_AUTH,$enable_auth,[Enable support for authentication])
2477 AM_CONDITIONAL(ENABLE_AUTH, test "x$enable_auth" != "xno")
2478 AUTH_MODULES=""
2479
2480 AC_ARG_ENABLE(auth-basic,
2481 AS_HELP_STRING([--enable-auth-basic="list of helpers"],
2482 [Enable the basic authentication scheme, and build the specified helpers.
2483 Not providing an explicit list of helpers will attempt build of
2484 all possible helpers. Default is to do so.
2485 To disable the basic authentication scheme, use --disable-auth-basic.
2486 To enable but build no helpers, specify "none".
2487 To see available helpers, see the src/auth/basic/ directory. ]),[
2488 #nothing to do really
2489 ])
2490 m4_include([src/auth/basic/helpers.m4])
2491
2492 AC_ARG_ENABLE(auth-digest,
2493 AS_HELP_STRING([--enable-auth-digest="list of helpers"],
2494 [Enable the Digest authentication scheme, and build the specified helpers.
2495 Not providing an explicit list of helpers will attempt build of
2496 all possible helpers. Default is to do so.
2497 To disable the Digest authentication scheme, use --disable-auth-digest.
2498 To enable but build no helpers, specify "none".
2499 To see available helpers, see the src/auth/digest/ directory. ]),[
2500 #nothing to do, really
2501 ])
2502 m4_include([src/auth/digest/helpers.m4])
2503
2504 AC_ARG_ENABLE(auth-negotiate,
2505 AS_HELP_STRING([--enable-auth-negotiate="list of helpers"],
2506 [Enable the Negotiate authentication scheme, and build the specified
2507 helpers.
2508 Not providing an explicit list of helpers will attempt build of
2509 all possible helpers. Default is to do so.
2510 To disable the Negotiate authentication scheme,
2511 use --disable-auth-negotiate.
2512 To enable but build no helpers, specify "none".
2513 To see available helpers, see the src/auth/negotiate/ directory. ]),[
2514 #nothing to do, really
2515 ])
2516 m4_include([src/auth/negotiate/helpers.m4])
2517
2518 AC_ARG_ENABLE(auth-ntlm,
2519 AS_HELP_STRING([--enable-auth-ntlm="list of helpers"],
2520 [Enable the NTLM authentication scheme, and build the specified helpers.
2521 Not providing an explicit list of helpers will attempt build of
2522 all possible helpers. Default is to do so.
2523 To disable the NTLM authentication scheme, use --disable-auth-ntlm.
2524 To enable but build no helpers, specify "none".
2525 To see available helpers, see the src/auth/ntlm/ directory. ]),[
2526 ])
2527 m4_include([src/auth/ntlm/helpers.m4])
2528
2529 dnl Authentication libraries to build
2530 dnl This list will not be needed when each auth library has its own Makefile
2531 dnl this is to be placed AFTER each auth module's handler
2532 AUTH_LIBS_TO_BUILD=
2533 for module in $AUTH_MODULES; do
2534 AUTH_LIBS_TO_BUILD="$AUTH_LIBS_TO_BUILD ${module}/lib${module}.la"
2535 done
2536 AC_SUBST(AUTH_MODULES)
2537 AC_SUBST(AUTH_LIBS_TO_BUILD)
2538
2539 dnl Select logging daemon helpers to build
2540 AC_ARG_ENABLE(log-daemon-helpers,
2541 AS_HELP_STRING([--enable-log-daemon-helpers="list of helpers"],
2542 [This option selects which logging daemon helpers to
2543 build and install as part of the normal build process
2544 For a list of available helpers see the src/log/
2545 directory.]),[
2546 #nothing to do, really
2547 ])
2548 m4_include([src/log/helpers.m4])
2549
2550 AC_ARG_ENABLE(external-acl-helpers,
2551 AS_HELP_STRING([--enable-external-acl-helpers="list of helpers"],
2552 [Enable external_acl helpers support and the helpers themselves.
2553 Default is to build all buildable helpers and enable support.
2554 To disable support, use --disable-external-acl-helpers.
2555 To build no helpers, specify "none".
2556 To see available helpers, see the src/acl/external/
2557 directory]), [
2558 #nothing to do, really
2559 ])
2560 m4_include([src/acl/external/helpers.m4])
2561
2562 dnl Select url_rewrite helpers to build
2563 AC_ARG_ENABLE(url-rewrite-helpers,
2564 AS_HELP_STRING([--enable-url-rewrite-helpers="list of helpers"],
2565 [This option selects which url_rewrite helpers to
2566 build and install as part of the normal build
2567 process. The default is to attempt the build of all possible
2568 helpers. Use --disable-url-rewrite-helpers to build none.
2569 For a list of available helpers see the
2570 src/http/url_rewriters/ directory.]),[
2571 ])
2572 m4_include([src/http/url_rewriters/helpers.m4])
2573
2574 dnl Select security helpers to build
2575 AC_ARG_ENABLE(security-cert-validators,
2576 AS_HELP_STRING([--enable-security-cert-validators="list of helpers"],
2577 [This option selects which security certificate validator
2578 helpers to build and install as part of the normal build
2579 process. The default is to attempt the build of all possible
2580 helpers. Use --disable-security-cert-validators to
2581 build none. For a list of available helpers see the
2582 src/security/cert_validators/ directory.]),[
2583 ])
2584 m4_include([src/security/cert_validators/helpers.m4])
2585
2586 AC_ARG_ENABLE(security-cert-generators,
2587 AS_HELP_STRING([--enable-security-cert-generators="list of helpers"],
2588 [This option selects which security certificate validator
2589 helpers to build and install as part of the normal build
2590 process. The default is to attempt the build of all possible
2591 helpers. Use --disable-security-cert-genrators to
2592 build none. For a list of available helpers see the
2593 src/security/cert_generators/ directory.]),[
2594 ])
2595 m4_include([src/security/cert_generators/helpers.m4])
2596
2597 dnl Select storeid_rewrite helpers to build
2598 AC_ARG_ENABLE(storeid-rewrite-helpers,
2599 AS_HELP_STRING([--enable-storeid-rewrite-helpers="list of helpers"],
2600 [This option selects which Store-ID rewrite helpers to
2601 build and install as part of the normal build
2602 process. The default is to attempt the build of all possible
2603 helpers. Use --disable-storeid-rewrite-helpers to build none.
2604 For a list of available helpers see the
2605 src/store/id_rewriters/ directory.]),[
2606 ])
2607 m4_include([src/store/id_rewriters/helpers.m4])
2608
2609 AC_ARG_WITH(valgrind-debug,
2610 AS_HELP_STRING([--with-valgrind-debug],
2611 [Include debug instrumentation for use with valgrind]),
2612 [
2613 SQUID_YESNO([$withval],
2614 [unrecognized argument to --with-valgrind-debug: $withval])
2615 if test "x$withval" != "xno" ; then
2616 AC_CHECK_HEADERS(valgrind/memcheck.h,[],[
2617 AC_MSG_ERROR([Valgrind support requested, needed headers not found.])
2618 ])
2619 fi
2620 ])
2621 SQUID_DEFINE_BOOL(WITH_VALGRIND,${with_valgrind_debug:=no},
2622 [Valgrind memory debugger support])
2623 AC_MSG_NOTICE([Valgrind debug support enabled: $with_valgrind_debug])
2624
2625 dnl Disable "memPools" code
2626 #AC_ARG_ENABLE(chunkedmempools,
2627 # AS_HELP_STRING([--enable-chunkedmempools],
2628 # [Enable experimental chunked memPools. Note that this option
2629 # simply sets the default behaviour. Specific classes can override this
2630 # at runtime, and only lib/MemPool.c needs to be altered
2631 # to change the squid-wide default for all classes.]), [
2632 #SQUID_YESNO([$enableval],
2633 # [--enable-chunkedmempools option takes no arguments])
2634 #])
2635 SQUID_DEFINE_BOOL(USE_CHUNKEDMEMPOOLS,${enable_chunkedmempools:=no},
2636 [Enable chunked Memory Pools support (experimental)])
2637 #AC_MSG_NOTICE([Chunked MemPools enabled: $enable_chunkedmempools])
2638
2639 dnl Enable WIN32 Service compile mode
2640 AC_ARG_ENABLE(win32-service,
2641 AS_HELP_STRING([--enable-win32-service],
2642 [Compile Squid as a WIN32 Service.
2643 Works only on MS-Windows platforms]), [
2644 SQUID_YESNO([$enableval],
2645 [unrecognized argument to --enable-win32-service: $enableval])
2646 ])
2647 SQUID_DEFINE_BOOL(USE_WIN32_SERVICE,${enable_win32_service:=no},
2648 [Enable code supporting MS Windows service mode])
2649 AC_MSG_NOTICE([MS Windows service mode enabled: $enable_win32_service])
2650
2651
2652 # Disable "unlinkd" code
2653 AC_ARG_ENABLE(unlinkd,
2654 AS_HELP_STRING([--disable-unlinkd],[Do not use unlinkd]), [
2655 SQUID_YESNO([$enableval],
2656 [unrecognized argument to --disable-unlinkd: $enableval])
2657 ])
2658 SQUID_DEFINE_BOOL(USE_UNLINKD,${enable_unlinkd:=yes},
2659 [Enable useage of unlinkd])
2660 AM_CONDITIONAL(ENABLE_UNLINKD,test "x$enable_unlinkd" = "xyes")
2661 AC_MSG_NOTICE([unlinkd enabled: $enable_unlinkd])
2662
2663 # Enable backtraces on fatal errors
2664 AC_ARG_ENABLE(stacktraces,
2665 AS_HELP_STRING([--enable-stacktraces],
2666 [Enable automatic call backtrace on fatal errors]), [
2667 SQUID_YESNO([$enableval],
2668 [unrecognized argument to --enable-stacktraces: $enableval])
2669 ])
2670 SQUID_DEFINE_BOOL(PRINT_STACK_TRACE,${enable_stacktraces:=no},
2671 [Print stack traces on fatal errors])
2672 AC_MSG_NOTICE([Automatically print stack trace on fatal errors: $enable_stacktraces])
2673
2674
2675 # CPU Profiling options handling
2676 AC_ARG_ENABLE(cpu-profiling,
2677 AS_HELP_STRING([--enable-cpu-profiling],
2678 [Enable instrumentation to try and understand how CPU power
2679 is spent by squid, by enabling specific probes in selected
2680 functions.
2681 New probes can only be added by modifying the source code.
2682 It is meant to help developers in optimizing performance
2683 of Squid internal functions.
2684 If you are not developer you should not enable this,
2685 as it slows squid down somewhat.
2686 See lib/Profiler.c for more details.]), [
2687 SQUID_YESNO([$enableval],
2688 [unrecognized argument to --enable-cpu-profiling: $enableval])
2689 ])
2690 # Default OFF. This is a debug feature. Only check and enable if forced ON.
2691 if test "x$enable_cpu_profiling" = "xyes"; then
2692 SQUID_CHECK_FUNCTIONAL_CPU_PROFILER
2693 if test "x$squid_cv_cpu_profiler_works" = "xno"; then
2694 AC_MSG_ERROR([CPU profiling will not be functional in this build.])
2695 fi
2696 fi
2697 SQUID_DEFINE_BOOL(USE_XPROF_STATS,${enable_cpu_profiling:=no},
2698 [Define to enable CPU profiling within Squid])
2699 AM_CONDITIONAL(ENABLE_XPROF_STATS,
2700 test "x$enable_cpu_profiling" = "xyes")
2701 AC_MSG_NOTICE([CPU profiling enabled: $enable_cpu_profiling])
2702
2703 # Enable X-Accelerator-Vary for Vary support within an accelerator setup
2704 AC_ARG_ENABLE(x-accelerator-vary,
2705 AS_HELP_STRING([--enable-x-accelerator-vary],
2706 [Enable support for the X-Accelerator-Vary
2707 HTTP header. Can be used to indicate
2708 variance within an accelerator setup.
2709 Typically used together with other code
2710 that adds custom HTTP headers to the requests.]), [
2711 SQUID_YESNO([$enableval],
2712 [unrecognized argument to --enable-x-accelerator-vary: $enableval])
2713 ])
2714 SQUID_DEFINE_BOOL(X_ACCELERATOR_VARY,${enable_x_accelerator_vary:=no},
2715 [Enable support for the X-Accelerator-Vary HTTP header])
2716 AC_MSG_NOTICE([X-Accelerator-Vary support enabled: $enable_x_accelerator_vary])
2717
2718
2719 if $CPPUNITCONFIG --help >/dev/null; then
2720 squid_cv_cppunit_version="`$CPPUNITCONFIG --version`"
2721 AC_MSG_NOTICE([using system installed cppunit version $squid_cv_cppunit_version])
2722 unset squid_cv_cppunit_version
2723 SQUID_CPPUNIT_LIBS="`$CPPUNITCONFIG --libs`"
2724 SQUID_CPPUNIT_LA=''
2725 SQUID_CPPUNIT_INC="`$CPPUNITCONFIG --cflags`"
2726 else
2727 AC_MSG_WARN([cppunit does not appear to be installed. squid does not require this, but code testing with 'make check' will fail.])
2728 SQUID_CPPUNIT_LA=''
2729 SQUID_CPPUNIT_LIBS=''
2730 SQUID_CPPUNIT_INC=''
2731 fi
2732
2733 AC_ARG_WITH(cppunit-basedir,
2734 AS_HELP_STRING([--with-cppunit-basedir=PATH],
2735 [Path where the cppunit headers are libraries can be found ]), [
2736 if test -f "$withval/include/cppunit/TestCase.h"; then
2737 AC_MSG_NOTICE([Using cppunit includes from $withval])
2738 SQUID_CPPUNIT_INC="-I${withval}/include"
2739 else
2740 AC_MSG_ERROR(Cannot find cppunit at $withval)
2741 fi
2742 if test -f "$withval/lib/libcppunit.la"; then
2743 AC_MSG_NOTICE([Using cppunit lib from $withval])
2744 SQUID_CPPUNIT_LA="${withval}/lib/libcppunit.la"
2745 SQUID_CPPUNIT_LIBS='$(SQUID_CPPUNIT_LA)'
2746 else
2747 AC_MSG_ERROR(Cannot find cppunit at $withval)
2748 fi
2749 ])
2750 SQUID_STATE_SAVE(squid_cppunit_state)
2751 CXXFLAGS="$CXXFLAGS $SQUID_CPPUNIT_INC"
2752 AC_CHECK_HEADERS(cppunit/extensions/HelperMacros.h)
2753 SQUID_STATE_ROLLBACK(squid_cppunit_state)
2754 AC_SUBST(SQUID_CPPUNIT_LIBS)
2755 AC_SUBST(SQUID_CPPUNIT_LA)
2756 AC_SUBST(SQUID_CPPUNIT_INC)
2757
2758 # Force some compilers to use ANSI features
2759 #
2760 case "$host" in
2761 *-hp-hpux*)
2762 if test "x$ac_cv_prog_CC" = "xcc" ; then
2763 AC_MSG_NOTICE([adding '-Ae' to cc args for $host])
2764 CC="cc -Ae";
2765 ac_cv_prog_CC="$CC"
2766 fi
2767 ;;
2768 esac
2769
2770
2771 dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
2772
2773 case "$host" in
2774 *hpux*)
2775 AC_MSG_NOTICE([Disabling ranlib for HP-UX...])
2776 RANLIB=":"
2777 ;;
2778 esac
2779
2780 dnl Check for headers
2781 AC_HEADER_DIRENT
2782 AC_HEADER_STDC
2783
2784 AC_CHECK_HEADERS( \
2785 arpa/inet.h \
2786 arpa/nameser.h \
2787 assert.h \
2788 bstring.h \
2789 crypt.h \
2790 ctype.h \
2791 direct.h \
2792 errno.h \
2793 execinfo.h \
2794 fcntl.h \
2795 fnmatch.h \
2796 getopt.h \
2797 glob.h \
2798 gnumalloc.h \
2799 grp.h \
2800 ipl.h \
2801 lber.h \
2802 ldap.h \
2803 libc.h \
2804 limits.h \
2805 linux/posix_types.h \
2806 linux/types.h \
2807 malloc.h \
2808 math.h \
2809 memory.h \
2810 mount.h \
2811 netdb.h \
2812 netinet/in.h \
2813 netinet/in_systm.h \
2814 netinet/tcp.h \
2815 paths.h \
2816 poll.h \
2817 pwd.h \
2818 regex.h \
2819 sched.h \
2820 siginfo.h \
2821 signal.h \
2822 stdarg.h \
2823 stddef.h \
2824 stdio.h \
2825 stdlib.h \
2826 string.h \
2827 strings.h \
2828 sys/bitypes.h \
2829 sys/file.h \
2830 sys/ioctl.h \
2831 sys/ipc.cc \
2832 sys/param.h \
2833 sys/prctl.h \
2834 sys/md5.h \
2835 sys/mman.h \
2836 sys/msg.h \
2837 sys/resource.h \
2838 sys/select.h \
2839 sys/shm.h \
2840 sys/socket.h \
2841 sys/stat.h \
2842 syscall.h \
2843 sys/syscall.h \
2844 sys/time.h \
2845 sys/types.h \
2846 sys/uio.h \
2847 sys/un.h \
2848 sys/vfs.h \
2849 sys/wait.h \
2850 syslog.h \
2851 time.h \
2852 unistd.h \
2853 utime.h \
2854 varargs.h \
2855 byteswap.h \
2856 glib.h \
2857 stdint.h \
2858 inttypes.h \
2859 db.h \
2860 db_185.h \
2861 wchar.h
2862 )
2863
2864 AC_CHECK_HEADERS( \
2865 linux/netfilter_ipv4.h \
2866 linux/netfilter_ipv6/ip6_tables.h \
2867 ,,,
2868 SQUID_DEFAULT_INCLUDES
2869 #if HAVE_LIMITS_H
2870 #include <limits.h>
2871 #endif
2872 /* Netfilter ip(6)tables v1.4.0 has broken headers */
2873 #if HAVE_NETINET_IN_H
2874 #include <netinet/in.h>
2875 #endif
2876 )
2877
2878 dnl *BSD dont include the dependencies for all their net/ and netinet/ files
2879 dnl We must include a few basic type headers for them to work.
2880 AC_CHECK_HEADERS( \
2881 net/if.h \
2882 netinet/if_ether.h\
2883 netinet/icmp6.h \
2884 netinet/in.h \
2885 netinet/ip.h \
2886 netinet/ip6.h \
2887 netinet/ip_icmp.h \
2888 netinet/ipl.h \
2889 net/pf/pfvar.h \
2890 net/pfvar.h \
2891 sys/mount.h\
2892 resolv.h \
2893 ,,,
2894 SQUID_BSDNET_INCLUDES)
2895
2896 AC_C_CONST
2897 AC_C_BIGENDIAN
2898
2899 AC_STRUCT_TM
2900 AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[
2901 #if TM_IN_SYS_TIME
2902 #if HAVE_SYS_TIME_H
2903 #include <sys/time.h>
2904 #endif
2905 #elif HAVE_TIME_H
2906 #include <time.h>
2907 #endif
2908 ])
2909
2910 dnl Override rusage() detect on MinGW because is emulated in source code
2911 case "$squid_host_os" in
2912 mingw)
2913 AC_DEFINE(HAVE_STRUCT_RUSAGE)
2914 ac_cv_func_getrusage='yes'
2915 AC_MSG_NOTICE([Using own rusage on Windows.])
2916 ;;
2917 *)
2918 AC_CHECK_TYPE(struct rusage,AC_DEFINE(HAVE_STRUCT_RUSAGE,1,[The system provides struct rusage]),,[
2919 #if HAVE_SYS_TIME_H
2920 #include <sys/time.h>
2921 #endif
2922 #if HAVE_SYS_RESOURCE_H
2923 #include <sys/resource.h>
2924 #endif])
2925 ;;
2926 esac
2927
2928 AC_CHECK_MEMBERS([struct iphdr.ip_hl],,,[
2929 #if HAVE_SYS_TYPES_H
2930 #include <sys/types.h>
2931 #endif
2932 #include <netinet/in.h>
2933 #include <netinet/in_systm.h>
2934 #include <netinet/ip.h>
2935 #if defined (__linux__) || defined (__CYGWIN__)
2936 #define ip_hl ihl
2937 #endif
2938 #ifndef __linux__
2939 #ifndef __CYGWIN__
2940 #define iphdr ip
2941 #endif
2942 #endif])
2943
2944 dnl Check for typedefs
2945 AC_CHECK_SIZEOF(void *)
2946
2947 # check for a bunch of types
2948 AC_TYPE_INT8_T
2949 AC_TYPE_UINT8_T
2950 AC_TYPE_INT16_T
2951 AC_TYPE_UINT16_T
2952 AC_TYPE_INT32_T
2953 AC_TYPE_UINT32_T
2954 AC_TYPE_INT64_T
2955 AC_TYPE_UINT64_T
2956 AC_TYPE_PID_T
2957 AC_TYPE_SIZE_T
2958 AC_TYPE_SSIZE_T
2959 AC_TYPE_OFF_T
2960 AC_TYPE_UID_T
2961 AC_CHECK_TYPE([bool])
2962 #need the defines for PRId64
2963 AC_CHECK_SIZEOF(int64_t)
2964 AC_CHECK_SIZEOF(long)
2965 #need the defines for PRIuSIZE
2966 AC_CHECK_SIZEOF(size_t)
2967 #need the define for overflow checks
2968 AC_CHECK_SIZEOF(off_t)
2969 AC_CHECK_SIZEOF(size_t)
2970
2971 dnl Some C++11 types we try to use
2972 AX_CXX_TYPE_NULLPTR
2973 AX_CXX_TYPE_UNIQUE_PTR
2974 AX_CXX_TYPE_UNIFORM_DISTRIBUTIONS
2975 SQUID_CXX_STD_UNDERLYING_TYPE
2976
2977 dnl On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
2978 dnl that is incompatible with the updated Solaris header files.
2979 dnl For this reason, we must check if pad128_t and upad128_t are defined.
2980 AC_CHECK_TYPE(pad128_t,
2981 AC_DEFINE(HAVE_PAD128_T,1,[pad128_t is defined in system headers]),
2982 ,SQUID_DEFAULT_INCLUDES)
2983
2984 AC_CHECK_TYPE(upad128_t,
2985 AC_DEFINE(HAVE_UPAD128_T,1,[upad128_t is defined in system headers]),
2986 ,SQUID_DEFAULT_INCLUDES)
2987
2988 AC_CHECK_TYPE(mode_t, AC_DEFINE(HAVE_MODE_T,1,[mode_t is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2989 AC_CHECK_TYPE(fd_mask, AC_DEFINE(HAVE_FD_MASK,1,[fd_mask is defined by the system headers]),,SQUID_DEFAULT_INCLUDES)
2990
2991 AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T,1,[socklen_t is defined by the system headers]),,[
2992 #include <sys/types.h>
2993 #include <sys/socket.h>
2994 #if STDC_HEADERS
2995 #include <stdlib.h>
2996 #include <stddef.h>
2997 #endif])
2998
2999 AC_CHECK_TYPE(mtyp_t,AC_DEFINE(HAVE_MTYP_T,1,
3000 [mtyp_t is defined by the system headers]),,[#include <sys/types.h>
3001 #include <sys/ipc.h>
3002 #include <sys/msg.h>])
3003
3004 # check for compiler support of %zu printf macro
3005 AH_TEMPLATE(PRIuSIZE,[Compiler supports %zu printf macro])
3006 AC_MSG_CHECKING([for compiler %zu support])
3007 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
3008 #include <stdio.h>
3009 ]],[[size_t n=1;printf("%zu",n);]])],[
3010 AC_DEFINE(PRIuSIZE,"zu")
3011 AC_MSG_RESULT(yes)
3012 ],[AC_MSG_RESULT(no)],[AC_MSG_RESULT(no)])
3013
3014
3015 dnl Check for special functions
3016 AC_FUNC_ALLOCA
3017
3018
3019 dnl Check for libcap header (assume its not broken unless
3020 AC_ARG_WITH(libcap, AS_HELP_STRING([--without-libcap],
3021 [disable usage of Linux capabilities library to control privileges]), [
3022 SQUID_YESNO([$withval],[unrecognized argument to --without-libcap: $withval])
3023 ],[with_libcap=auto])
3024
3025 if test "x$with_libcap" != "xno"; then
3026 # cap_clear_flag is the most recent libcap function we require
3027 AC_CHECK_HEADERS(sys/capability.h)
3028 AC_CHECK_LIB(cap, cap_clear_flag)
3029 SQUID_CHECK_FUNCTIONAL_LIBCAP2
3030
3031 # if it can't be supported..
3032 if test "x$ac_cv_header_sys_capability_h" = "xno" -o \
3033 "x$ac_cv_lib_cap_cap_clear_flag" = "xno"; then
3034 # and it was forced on: error
3035 if test "x$with_libcap" = "xyes" ; then
3036 AC_MSG_ERROR([libcap forced enabled but not available or not usable, requires libcap-2.09 or later])
3037 else
3038 # with_libcap is "auto"; it can't be supported. Disable.
3039 with_libcap=no
3040 fi
3041 else
3042 # header and lib are ok, we support
3043 with_libcap=yes
3044 fi
3045
3046 fi
3047
3048 SQUID_DEFINE_BOOL(USE_LIBCAP,$with_libcap,
3049 [use libcap to set capabilities required for TPROXY])
3050 AC_MSG_NOTICE([libcap support enabled: $with_libcap])
3051 SQUID_DEFINE_BOOL(LIBCAP_BROKEN,${squid_cv_sys_capability_works:=no},
3052 [libcap2 headers are broken and clashing with glibc])
3053 AC_MSG_NOTICE([libcap2 headers are ok: $squid_cv_sys_capability_works])
3054
3055
3056 dnl Check for needed libraries
3057 AC_SEARCH_LIBS([gethostbyname],[nsl resolv bind])
3058 AC_SEARCH_LIBS([res_init],[resolv])
3059 AC_SEARCH_LIBS([__res_search],[resolv])
3060 AC_SEARCH_LIBS([bind],[socket])
3061 AC_SEARCH_LIBS([opcom_stack_trace],[opcom_stack])
3062 AC_SEARCH_LIBS([strlcpy], [bsd])
3063 AC_SEARCH_LIBS([yp_match], [nsl nss_nis nss_nisplus])
3064 dnl Check for Winsock only on MinGW, on Cygwin we must use emulated BSD socket API
3065 if test "x$squid_host_os" = "xmingw" ; then
3066 SQUID_CHECK_WINSOCK_LIB
3067 AC_CHECK_HEADERS( \
3068 windows.h \
3069 ws2tcpip.h \
3070 iphlpapi.h ,,,[
3071 #if HAVE_WINSOCK2_H
3072 #include <winsock2.h>
3073 #endif
3074 #if HAVE_WINDOWS_H
3075 #include <windows.h>
3076 #endif
3077 #if HAVE_WS2TCPIP_H
3078 #include <ws2tcpip.h>
3079 #endif
3080 ])
3081 fi
3082
3083 # check that we have unix sockets
3084 SQUID_CHECK_UNIX_SOCKET
3085 SQUID_DEFINE_BOOL(HAVE_UNIXSOCKET,$squid_cv_unixsocket,[System supports unix sockets])
3086
3087 AC_CHECK_LIB(gnumalloc, malloc)
3088 if test "x$ac_cv_lib_gnumalloc_malloc" = "xyes"; then
3089 AC_MSG_NOTICE([Disabling extended malloc functions when using bundled gnumalloc])
3090 ac_cv_func_mallocblksize=no
3091 ac_cv_func_mallopt=no
3092 else
3093 case "$squid_host_os" in
3094 solaris)
3095 AC_MSG_NOTICE([skipping libmalloc check for $host])
3096 ;;
3097 freebsd)
3098 AC_MSG_NOTICE([skipping libmalloc check for $host])
3099 ;;
3100 *)
3101 #used later. FIXME
3102 AC_CHECK_LIB(malloc, main)
3103 ;;
3104 esac
3105 fi
3106
3107 case "$squid_host_os" in
3108 mingw)
3109 AC_MSG_NOTICE([Use MSVCRT for math functions.])
3110 ;;
3111 *)
3112 dnl rint() and log() are only used in old C code for now.
3113 AC_LANG_PUSH([C])
3114 AC_SEARCH_LIBS([rint],[m])
3115 AC_SEARCH_LIBS([log],[m])
3116 AC_LANG_POP([C])
3117 ;;
3118 esac
3119
3120 dnl --with-maxfd present for compatibility with Squid-2.
3121 dnl undocumented in ./configure --help to encourage using the Squid-3 directive
3122 AC_ARG_WITH(maxfd,,
3123 [
3124 case ${withval} in
3125 [[0-9]]*)
3126 squid_filedescriptors_num=$withval
3127 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
3128 ;;
3129 *)
3130 AC_MSG_ERROR(--with-maxfd expects a numeric argument)
3131 ;;
3132 esac
3133 ])
3134
3135 AC_ARG_WITH(filedescriptors,
3136 AS_HELP_STRING([--with-filedescriptors=NUMBER],
3137 [Force squid to support NUMBER filedescriptors]),
3138 [
3139 case ${withval} in
3140 [[0-9]]*)
3141 squid_filedescriptors_num=$withval
3142 AC_MSG_NOTICE([forcing default of $squid_filedescriptors_num filedescriptors (user-forced)])
3143 ;;
3144 *)
3145 AC_MSG_ERROR(--with-filedescriptors expects a numeric argument)
3146 ;;
3147 esac
3148 ])
3149
3150 SQUID_CHECK_DEFAULT_FD_SETSIZE
3151 SQUID_CHECK_MAXFD
3152 if test "x$squid_filedescriptors_num" != "x"; then
3153 AC_MSG_NOTICE([Default number of fieldescriptors: $squid_filedescriptors_num])
3154 fi
3155 if test "$squid_filedescriptors_num" -lt 512 ; then
3156 AC_MSG_WARN([$squid_filedescriptors_num may not be enough filedescriptors if your])
3157 AC_MSG_WARN([cache will be very busy. Please see the FAQ page])
3158 AC_MSG_WARN([http://wiki.squid-cache.org/SquidFaq/TroubleShooting])
3159 AC_MSG_WARN([on how to increase your filedescriptor limit])
3160 fi
3161 AC_DEFINE_UNQUOTED(SQUID_MAXFD, $squid_filedescriptors_num,[Maximum number of open filedescriptors])
3162
3163
3164 dnl Enable IPv6 support
3165 AC_MSG_CHECKING([whether to enable IPv6])
3166 AC_ARG_ENABLE(ipv6,
3167 AS_HELP_STRING([--disable-ipv6],[Disable IPv6 support. The default is to probe system capabilities on startup.]), [
3168 SQUID_YESNO([$enableval],[unrecognized argument to --disable-ipv6: $enableval])
3169 ])
3170 AC_MSG_RESULT(${enable_ipv6:=yes})
3171 SQUID_DEFINE_BOOL(USE_IPV6,$enable_ipv6,[Enable support for IPv6 ])
3172
3173 if test "x$enable_ipv6" = "xyes" ; then
3174 SQUID_CHECK_SIN6_LEN_IN_SAI
3175 fi
3176 SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE
3177 SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN
3178
3179
3180 dnl Check for libdl, used by auth_modules/PAM
3181 if test "x$with_dl" = "xyes"; then
3182 AC_CHECK_LIB(dl, dlopen)
3183 fi
3184
3185 dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
3186 dnl Robert Side <rside@aiinc.bc.ca>
3187 dnl Mon, 18 Jan 1999 17:48:00 GMT
3188 case "$host" in
3189 *-pc-sco3.2*)
3190 AC_CHECK_LIB(intl, strftime)
3191 ;;
3192 esac
3193
3194 dnl Check for libdb
3195 dnl this is not fully functional if db.h is for a differend db version
3196 DBLIB=
3197
3198 dnl check that dbopen is actually defined in the header
3199 dnl FIXME: in case of failure undef db-related includes etc.
3200 AC_CHECK_DECL(dbopen,,,[
3201 #if HAVE_SYS_TYPES_H
3202 #include <sys/types.h>
3203 #endif
3204 #if HAVE_LIMITS_H
3205 #include <limits.h>
3206 #endif
3207 #if HAVE_DB_185_H
3208 #include <db_185.h>
3209 #elif HAVE_DB_H
3210 #include <db.h>
3211 #endif])
3212
3213 dnl 1.85
3214 SQUID_CHECK_DBOPEN_NEEDS_LIBDB
3215 if test "x$ac_cv_dbopen_libdb" = "xyes"; then
3216 LIB_DB="-ldb"
3217 fi
3218 AC_SUBST(LIB_DB)
3219
3220 dnl System-specific library modifications
3221 dnl
3222 case "$host" in
3223 i386-*-solaris2.*)
3224 if test "x$GCC" = "xyes"; then
3225 AC_MSG_NOTICE([Removing -O for gcc on $host])
3226 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
3227 fi
3228 ;;
3229
3230 *-sgi-irix*)
3231 AC_MSG_NOTICE([Removing -lsocket for IRIX...])
3232 LIBS=`echo $LIBS | sed -e s/-lsocket//`
3233 AC_MSG_NOTICE([Removing -lnsl for IRIX...])
3234 LIBS=`echo $LIBS | sed -e s/-lnsl//`
3235 ac_cv_lib_nsl_main=no
3236 AC_MSG_NOTICE([Removing -lbsd for IRIX...])
3237 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3238 ;;
3239 dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
3240 dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
3241 dnl Please change your configure script. AIX doesn't need -lbsd.
3242 *-ibm-aix*)
3243 AC_MSG_NOTICE([Removing -lbsd for AIX...])
3244 LIBS=`echo $LIBS | sed -e s/-lbsd//`
3245
3246 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_rtti],[-rtti],[[
3247 #include <assert.h>
3248 #ifndef NULL
3249 #define NULL 0
3250 #endif
3251 class Foo{
3252 public:virtual ~Foo(){}
3253 };
3254 class Bar:public Foo{
3255 public:Bar():Foo(){}
3256 };
3257 ]],[[
3258 Foo * myFoo=new Bar();
3259 Bar * myBar=dynamic_cast<Bar *>(myFoo);
3260 assert(myBar != NULL);
3261 ]])
3262 if test "$ac_cv_require_rtti" = "yes"; then
3263 SQUID_CFLAGS="-rtti $SQUID_CFLAGS"
3264 SQUID_CXXFLAGS="-rtti $SQUID_CXXFLAGS"
3265 fi
3266
3267 AC_LANG_PUSH([C])
3268 SQUID_CC_REQUIRE_ARGUMENT([ac_cv_require_qcpluscmt],[-qcpluscmt],[[]],[[//c++ cmt]])
3269 AC_LANG_POP([C])
3270 if test "$ac_cv_require_qcpluscmt" = "yes"; then
3271 SQUID_CFLAGS="-qcpluscmt $SQUID_CFLAGS"
3272 fi
3273 ;;
3274
3275 *m88k*)
3276 SQUID_CFLAGS="$SQUID_CFLAGS -D_SQUID_MOTOROLA_"
3277 SQUID_CXXFLAGS="$SQUID_CXXFLAGS -D_SQUID_MOTOROLA_"
3278 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1,
3279 [If gettimeofday is known to take only one argument])
3280 ;;
3281 [*-*-solaris2.[0-4]])
3282 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
3283 ;;
3284 [*-sony-newsos[56]*])
3285 AC_DEFINE(GETTIMEOFDAY_NO_TZP,1)
3286 ;;
3287 esac
3288
3289 dnl This has to be before AC_CHECK_FUNCS
3290 # Disable poll() on certain platforms. Override by setting ac_cv_func_poll
3291 # when running configure.
3292 if test "x$ac_cv_func_poll" = "x" ; then
3293 case "$host" in
3294 [*-hp-hpux*.*])
3295 # Duane Wessels
3296 AC_MSG_NOTICE([disabling poll for $host...])
3297 ac_cv_func_poll='no'
3298 ;;
3299 [*-linux-*])
3300 # Henrik Nordstrom (hno@squid-cache.org) 19980817
3301 # poll is problematic on Linux. We disable it
3302 # by default until Linux gets it right.
3303 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
3304 if test $rev -lt 002002; then
3305 AC_MSG_NOTICE([disabling poll for $host < 2.2...])
3306 ac_cv_func_poll='no'
3307 fi
3308 ;;
3309 [powerpc-ibm-aix4.1.*])
3310 # Mike Laster (mlaster@metavillage.com) 19981021
3311 AC_MSG_NOTICE([disabling poll for $host...])
3312 ac_cv_func_poll='no'
3313 ;;
3314 [*-pc-sco3.2*])
3315 # Robert Side <rside@aiinc.bc.ca>
3316 # Mon, 18 Jan 1999 17:48:00 GMT
3317 AC_MSG_NOTICE([disabling poll for $host...])
3318 ac_cv_func_poll='no'
3319 ;;
3320 esac
3321 fi
3322
3323 dnl Check for library functions
3324 AC_CHECK_FUNCS(\
3325 backtrace_symbols_fd \
3326 bcopy \
3327 eui64_aton \
3328 fchmod \
3329 getdtablesize \
3330 getpagesize \
3331 getpass \
3332 getrlimit \
3333 getrusage \
3334 getspnam \
3335 gettimeofday \
3336 glob \
3337 mallocblksize \
3338 mallopt \
3339 memcpy \
3340 memmove \
3341 memrchr \
3342 memset \
3343 mkstemp \
3344 mktime \
3345 mstats \
3346 poll \
3347 prctl \
3348 pthread_attr_setschedparam \
3349 pthread_attr_setscope \
3350 pthread_setschedparam \
3351 pthread_sigmask \
3352 putenv \
3353 regcomp \
3354 regexec \
3355 regfree \
3356 res_init \
3357 __res_init \
3358 rint \
3359 sched_getaffinity \
3360 sched_setaffinity \
3361 select \
3362 seteuid \
3363 setgroups \
3364 setpgrp \
3365 setsid \
3366 sigaction \
3367 snprintf \
3368 socketpair \
3369 sysconf \
3370 syslog \
3371 timegm \
3372 vsnprintf \
3373 )
3374 dnl ... and some we provide local replacements for
3375 AC_REPLACE_FUNCS(\
3376 initgroups \
3377 psignal \
3378 strerror \
3379 strtoll \
3380 tempnam \
3381 )
3382
3383 AC_CHECK_DECLS([getaddrinfo,getnameinfo,inet_ntop,inet_pton,InetNtopA,InetPtonA],,,[
3384 /*
3385 * BSD requires sys/types.h, sys/socket.h, netinet/in.h, netdb.h, arpa/inet.h
3386 * Linux requires sys/types.h, sys/socket.h, arpa/inet.h
3387 * Windows requires sys/socket.h, winsock2.h, ws2tcpip.h
3388 */
3389 #if HAVE_SYS_TYPES_H
3390 #include <sys/types.h>
3391 #endif
3392 #if HAVE_NETINET_IN_H
3393 #include <netinet/in.h>
3394 #endif
3395 #if HAVE_SYS_SOCKET_H
3396 #include <sys/socket.h>
3397 #endif
3398 #if HAVE_NETDB_H
3399 #include <netdb.h>
3400 #endif
3401 #if HAVE_ARPA_INET_H
3402 #include <arpa/inet.h>
3403 #endif
3404 #if HAVE_WINSOCK2_H
3405 #include <winsock2.h>
3406 #endif
3407 #if HAVE_WS2TCPIP_H
3408 #include <ws2tcpip.h>
3409 #endif
3410 ])
3411
3412 # Magic which checks whether we are forcing a type of comm loop we
3413 # are actually going to (ab)use.
3414 # Mostly ripped from squid-commloops, thanks to adrian and benno
3415
3416 if test "x$squid_opt_io_loop_engine" != "x"; then
3417 AC_MSG_NOTICE([choosing user-specified net I/O API $squid_opt_io_loop_engine])
3418 elif test "x$enable_epoll" != "xno" -a "x$squid_cv_epoll_works" = "xyes" ; then
3419 squid_opt_io_loop_engine="epoll"
3420 elif test "x$enable_kqueue" != "xno" ; then
3421 squid_opt_io_loop_engine="kqueue"
3422 elif test "x$enable_devpoll" != "xno" ; then
3423 squid_opt_io_loop_engine="devpoll"
3424 elif test "x$enable_poll" != "xno" -a "x$ac_cv_func_poll" = "xyes" ; then
3425 squid_opt_io_loop_engine="poll"
3426 elif test "x$enable_select" != "xno" -a "x$ac_cv_func_select" = "xyes"; then
3427 squid_opt_io_loop_engine="select"
3428 elif test "x$enable_select" != "xno" -a "x$squid_host_os" = "xmingw"; then
3429 squid_opt_io_loop_engine="select_win32"
3430 else
3431 AC_MSG_WARN([Eep! Cannot find epoll, kqueue, /dev/poll, poll or select!])
3432 AC_MSG_WARN([Will try select and hope for the best.])
3433 squid_opt_io_loop_engine="select"
3434 fi
3435
3436 AC_MSG_NOTICE([Using ${squid_opt_io_loop_engine} for the IO loop.])
3437
3438 AM_CONDITIONAL([USE_POLL], [test $squid_opt_io_loop_engine = poll])
3439 AM_CONDITIONAL([USE_EPOLL], [test $squid_opt_io_loop_engine = epoll])
3440 AM_CONDITIONAL([USE_SELECT], [test $squid_opt_io_loop_engine = select])
3441 AM_CONDITIONAL([USE_SELECT_WIN32], [test $squid_opt_io_loop_engine = select_win32])
3442 AM_CONDITIONAL([USE_KQUEUE], [test $squid_opt_io_loop_engine = kqueue])
3443 AM_CONDITIONAL([USE_DEVPOLL], [test $squid_opt_io_loop_engine = devpoll])
3444
3445 case $squid_opt_io_loop_engine in
3446 epoll) AC_DEFINE(USE_EPOLL,1,[Use epoll() for the IO loop]) ;;
3447 devpoll) AC_DEFINE(USE_DEVPOLL,1,[Use /dev/poll for the IO loop]) ;;
3448 poll) AC_DEFINE(USE_POLL,1,[Use poll() for the IO loop]) ;;
3449 kqueue) AC_DEFINE(USE_KQUEUE,1,[Use kqueue() for the IO loop]) ;;
3450 select_win32) AC_DEFINE(USE_SELECT_WIN32,1,[Use Winsock select() for the IO loop]) ;;
3451 select) AC_DEFINE(USE_SELECT,1,[Use select() for the IO loop]) ;;
3452 esac
3453
3454 if test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes" ; then
3455 AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
3456 fi
3457
3458 SQUID_CHECK_SETRESUID_WORKS
3459 if test "x$squid_cv_resuid_works" = "xyes" ; then
3460 AC_DEFINE(HAVE_SETRESUID,1,[Yay! Another Linux brokenness. Knowing that setresuid() exists is not enough, because RedHat 5.0 declares setresuid() but does not implement it.])
3461 fi
3462
3463 AC_CHECK_HEADERS(mswsock.h)
3464 AC_MSG_CHECKING([for constant CMSG_SPACE])
3465 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
3466 #if HAVE_SYS_SOCKET_H
3467 #include <sys/socket.h>
3468 #endif
3469 #if HAVE_MSWSOCK_H
3470 #include <mswsock.h>
3471 #endif
3472
3473 int a[CMSG_SPACE(int)];
3474 ]])], [
3475 AC_MSG_RESULT(yes)
3476 AC_DEFINE(HAVE_CONSTANT_CMSG_SPACE, 1, [Define to 1 if CMSG_SPACE is constant])
3477 ], [
3478 AC_MSG_RESULT(no)
3479 ])
3480
3481 AC_CHECK_TYPE(struct cmsghdr,AC_DEFINE(HAVE_CMSGHDR,1,[The system provides struct cmsghdr]),,[
3482 #if HAVE_SYS_SOCKET_H
3483 #include <sys/socket.h>
3484 #endif
3485 #if HAVE_MSWSOCK_H
3486 #include <mswsock.h>
3487 #endif
3488 #if HAVE_WINSOCK2_H
3489 #include <winsock2.h>
3490 #endif
3491 ])
3492
3493 AC_CHECK_TYPE(struct iovec,AC_DEFINE(HAVE_IOVEC,1,[The system provides struct iovec]),,[
3494 #if HAVE_SYS_SOCKET_H
3495 #include <sys/socket.h>
3496 #endif
3497 #if HAVE_WINSOCK2_H
3498 #include <winsock2.h>
3499 #endif
3500 #if HAVE_SYS_UIO_H
3501 #include <sys/uio.h>
3502 #endif
3503 ])
3504
3505 AC_CHECK_TYPE(struct msghdr,AC_DEFINE(HAVE_MSGHDR,1,[The system provides struct msghdr]),,[
3506 #if HAVE_SYS_SOCKET_H
3507 #include <sys/socket.h>
3508 #endif
3509 #if HAVE_MSWSOCK_H
3510 #include <mswsock.h>
3511 #endif
3512 #if HAVE_WINSOCK2_H
3513 #include <winsock2.h>
3514 #endif
3515 ])
3516
3517 AC_CHECK_TYPE(struct sockaddr_un,AC_DEFINE(HAVE_SOCKADDR_UN,1,[The system provides sockaddr_un]),,[
3518 #if HAVE_SYS_UN_H
3519 #include <sys/un.h>
3520 #endif
3521 #if HAVE_SYS_SOCKET_H
3522 #include <sys/socket.h>
3523 #endif
3524 #if HAVE_WINSOCK2_H
3525 #include <winsock2.h>
3526 #endif
3527 ])
3528
3529 SQUID_CHECK_FUNC_STRNSTR
3530 SQUID_CHECK_FUNC_VACOPY
3531 SQUID_CHECK_FUNC___VACOPY
3532
3533 dnl IP-Filter support requires ipf header files. These aren't
3534 dnl installed by default, so we need to check for them
3535 if test "x$enable_ipf_transparent" != "xno" ; then
3536 SQUID_CHECK_BROKEN_SOLARIS_IPFILTER
3537 AC_MSG_CHECKING(for availability of IP-Filter header files)
3538 # hold on to your hats...
3539 if test "x$ac_cv_header_ip_compat_h" = "xyes" -o \
3540 "x$ac_cv_header_ip_fil_compat_h" = "xyes" -o \
3541 "x$ac_cv_header_netinet_ip_compat_h" = "xyes" -o \
3542 "x$ac_cv_header_netinet_ip_fil_compat_h" = "xyes" ; then
3543 have_ipfilter_compat_header="yes"
3544 fi
3545 if test "x$have_ipfilter_compat_header" = "xyes" -a \
3546 "x$ac_cv_header_ip_fil_h" = "xyes" -a \
3547 "x$ac_cv_header_ip_nat_h" = "xyes" ; then
3548 enable_ipf_transparent="yes"
3549 elif test "x$have_ipfilter_compat_header" = "xyes" -a \
3550 "x$ac_cv_header_netinet_ip_fil_h" = "xyes" -a \
3551 "x$ac_cv_header_netinet_ip_nat_h" = "xyes" ; then
3552 enable_ipf_transparent="yes"
3553 else
3554 enable_ipf_transparent="no"
3555 fi
3556 AC_MSG_RESULT($IPF_TRANSPARENT)
3557
3558 ## On Solaris Ipfilter includes expect that SOLARIS2 is defined with the
3559 ## Solaris minor version (8, 9, 10, ...)
3560 if test "x$enable_ipf_transparent" = "xyes" -a "x$squid_host_os" = "xsolaris" ; then
3561 solrev=`uname -r | sh -c 'IFS=. read j n x; echo $n'`
3562 CFLAGS="-DSOLARIS2=$solrev $CFLAGS"
3563 CXXFLAGS="-DSOLARIS2=$solrev $CXXFLAGS"
3564 fi
3565
3566 fi
3567 AC_MSG_NOTICE([IPF-based transparent proxying enabled: $enable_ipf_transparent])
3568 SQUID_DEFINE_BOOL(IPF_TRANSPARENT,$enable_ipf_transparent,
3569 [Enable support for IPF-style transparent proxying])
3570
3571 dnl PF /dev/pf support requires a header file.
3572 if test "x$with_nat_devpf" != "xno" ; then
3573 if test "x$ac_cv_header_net_pfvar_h" = "xyes" -o \
3574 "x$ac_cv_header_net_pf_pfvar_h" = "xyes"; then
3575 if test "x$with_nat_devpf" = "xauto" ; then
3576 with_nat_devpf="no"
3577 fi
3578 else
3579 if test "x$with_nat_devpf" = "xyes" ; then
3580 AC_MSG_ERROR([PF /dev/pf based NAT requested but needed header not found])
3581 fi
3582 with_nat_devpf="no"
3583 fi
3584 fi
3585 SQUID_DEFINE_BOOL(PF_TRANSPARENT,${enable_pf_transparent:=no},
3586 [Enable support for PF-style transparent proxying])
3587 SQUID_DEFINE_BOOL(USE_NAT_DEVPF,${with_nat_devpf:=no},
3588 [Enable support for /dev/pf NAT lookups])
3589
3590 if test "x$enable_linux_netfilter" != "xno" ; then
3591 if test "x$ac_cv_header_linux_netfilter_ipv4_h" = "xyes"; then
3592 if test "x$enable_linux_netfilter" = "xauto" ; then
3593 enable_linux_netfilter=yes
3594 fi
3595 else
3596 if test "x$enable_linux_netfilter" = "xauto" ; then
3597 enable_linux_netfilter=no
3598 else
3599 AC_MSG_ERROR([Linux Netfilter support requested but needed headers not found])
3600 fi
3601 fi
3602 fi
3603 SQUID_DEFINE_BOOL(LINUX_NETFILTER,$enable_linux_netfilter,
3604 [Enable support for Transparent Proxy on Linux via Netfilter])
3605
3606 dnl Netfilter TPROXY depends on libcap but the NAT parts can still work.
3607 AC_MSG_NOTICE([Support for Netfilter-based interception proxy requested: $enable_linux_netfilter])
3608 if test "x$enable_linux_netfilter" = "xyes" -a "x$with_libcap" != "xyes" ; then
3609 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for TPROXY])
3610 AC_MSG_WARN([Linux Transparent Proxy (version 4+) support WILL NOT be enabled])
3611 AC_MSG_WARN([Reduced support to NAT Interception Proxy])
3612 # AC_DEFINEd later
3613 fi
3614
3615 if test "x$squid_opt_netfilterconntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3616 AC_MSG_ERROR([Linux netfilter conntrack requires libcap support (libcap 2.09+)])
3617 fi
3618 if test "x$with_netfilter_conntrack" = "xyes" -a "x$with_libcap" != "xyes" ; then
3619 AC_MSG_WARN([Missing needed capabilities (libcap 2.09+) for netfilter mark support])
3620 AC_MSG_WARN([Linux netfilter marking support WILL NOT be enabled])
3621 with_netfilter_conntrack=no
3622 fi
3623 AC_MSG_NOTICE([Linux Netfilter Conntrack support enabled: ${with_netfilter_conntrack} ${squid_opt_netfilterconntrackpath}])
3624
3625
3626 AC_ARG_ENABLE(zph-qos,
3627 AS_HELP_STRING([--enable-zph-qos],[Enable ZPH QOS support]), [
3628 SQUID_YESNO([$enableval],
3629 [unrecognized argument to --enable-zph-qos: $enableval])
3630 ])
3631 SQUID_DEFINE_BOOL(USE_QOS_TOS,${enable_zph_qos:=yes},
3632 [Enable Zero Penalty Hit QOS. When set, Squid will alter the
3633 TOS field of HIT responses to help policing network traffic])
3634 AC_MSG_NOTICE([ZPH QOS enabled: $enable_zph_qos])
3635 if test x"$enable_zph_qos" = "xyes" ; then
3636 AC_MSG_NOTICE([QOS netfilter mark preservation enabled: $with_netfilter_conntrack])
3637 SQUID_DEFINE_BOOL(USE_LIBNETFILTERCONNTRACK,${with_netfilter_conntrack:=no},
3638 [Enable support for QOS netfilter mark preservation])
3639 fi
3640
3641
3642 AC_CHECK_LIB(regex, regexec, [REGEXLIB="-lregex"],[REGEXLIB=''])
3643 AC_ARG_ENABLE(gnuregex,
3644 AS_HELP_STRING([--enable-gnuregex],
3645 [Compile GNUregex. Unless you have reason to use
3646 this option, you should not enable it.
3647 This library file is usually only required on Windows and
3648 very old Unix boxes which do not have their own regex
3649 library built in.]), [
3650 SQUID_YESNO([$enableval],[unrecognized argument to --enable-gnuregex: $enableval])
3651 ])
3652 # force-enable on old solaris and nextstep
3653 if test "x${enable_gnuregex:=auto}" = "xauto" ; then
3654 case "$host" in
3655 *-sun-solaris2.[[0-4]])
3656 enable_gnuregex="yes"
3657 ;;
3658 *-next-nextstep*)
3659 enable_gnuregex="yes"
3660 ;;
3661 esac
3662 fi
3663
3664 # try detecting if it is needed
3665 if test "x$enable_gnuregex" = "xauto" ; then
3666 SQUID_CHECK_REGEX_WORKS
3667 if test "x$squid_cv_regex_works" = "xyes" ; then
3668 enable_gnuregex=no
3669 else
3670 enable_gnuregex=yes
3671 fi
3672 fi
3673 AC_MSG_CHECKING(if GNUregex needs to be compiled)
3674 AC_MSG_RESULT($enable_gnuregex)
3675 if test "x$enable_gnuregex" = "xyes"; then
3676 # for some reason (force-enable, test..) gnuregex was found as needed. Override any system lib
3677 REGEXLIB=""
3678 fi
3679 #if no reason was found to enable gnuregex, disable it
3680 if test "x$enable_gnuregex" = "xauto" ; then
3681 enable_gnuregex=no
3682 fi
3683 SQUID_DEFINE_BOOL(USE_GNUREGEX,$enable_gnuregex,[Define if we should use GNU regex])
3684 AC_SUBST(REGEXLIB)
3685
3686 SQUID_DETECT_UDP_SND_BUFSIZE
3687 SQUID_DETECT_UDP_RECV_BUFSIZE
3688 SQUID_DETECT_TCP_SND_BUFSIZE
3689 SQUID_DETECT_TCP_RECV_BUFSIZE
3690
3691 SQUID_CHECK_RECV_ARG_TYPE
3692 SQUID_CHECK_NEED_SYS_ERRLIST
3693 SQUID_CHECK_MAXPATHLEN
3694
3695 SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK
3696 SQUID_CHECK_RESOLVER_FIELDS
3697
3698 AC_CHECK_HEADERS(sys/statvfs.h)
3699 if test "x$ac_cv_header_sys_statvfs_h" = "xyes" ; then
3700 SQUID_CHECK_WORKING_STATVFS
3701 fi
3702 if test "x$ac_cv_func_statvfs" != "xyes" ; then
3703 AC_CHECK_HEADERS(sys/param.h sys/mount.h sys/vfs.h sys/statfs.h)
3704 AC_CHECK_FUNCS(statfs)
3705 SQUID_CHECK_F_FRSIZE_IN_STATFS
3706 fi
3707
3708 dnl Squid will not usually attempt to translate templates when building
3709 AC_ARG_ENABLE(translation,
3710 AS_HELP_STRING([--enable-translation],[Generate the localized error page templates and manuals.
3711 Which can also be downloaded from http://www.squid-cache.org/Versions/langpack/.]), [
3712 SQUID_YESNO([$enableval],
3713 [unrecognized argument to --enable-translation: $enableval])
3714 ])
3715 if test "x${enable_translation:=no}" = "xyes" ; then
3716 AX_WITH_PROG([PO2HTML],[po2html])
3717 AX_WITH_PROG([PO2TEXT],[po2txt])
3718 else
3719 PO2HTML="off"
3720 PO2TEXT="off"
3721 fi
3722 AC_SUBST(PO2HTML)
3723 AC_SUBST(PO2TEXT)
3724
3725 dnl Squid now has limited locale handling ...
3726 dnl on error pages
3727 AC_ARG_ENABLE(auto-locale,
3728 AS_HELP_STRING([--disable-auto-locale],[This prevents Squid providing localized error pages based on the
3729 clients request headers.
3730 When disabled Squid requires explicit language configuration.]), [
3731 SQUID_YESNO([$enableval],
3732 [unrecognized argument to --disable-auto-locale: $enableval])
3733 ])
3734 AC_MSG_NOTICE([Multi-Language support enabled: ${enable_auto_locale:=yes}])
3735 SQUID_DEFINE_BOOL(USE_ERR_LOCALES,$enable_auto_locale,
3736 [Use multi-language support on error pages])
3737
3738
3739 dnl Need the debugging version of malloc if available
3740 XTRA_OBJS=''
3741 if test "x$ac_cv_lib_malloc_main" = "xyes" ; then
3742 if test -r /usr/lib/debug/malloc.o ; then
3743 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
3744 fi
3745 if test -r /usr/lib/debug/mallocmap.o ; then
3746 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
3747 fi
3748 fi
3749 AC_SUBST(XTRA_OBJS)
3750
3751 if test "x$XTRA_LIBS" = "x"; then
3752 XTRA_LIBS="$LIBS"
3753 dnl minor cleanup
3754 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
3755 LIBS=''
3756 fi
3757 AC_SUBST(XTRA_LIBS)
3758
3759 AC_SUBST(SQUID_CFLAGS)
3760 AC_SUBST(SQUID_CXXFLAGS)
3761
3762 AC_ARG_VAR([BUILDCXXFLAGS],[C++ compiler flags for building compile-time tools. e.g. cf_gen])
3763 if test "x$BUILDCXXFLAGS" = "x"; then
3764 # if we are NOT cross-compiling, use the default build flags for cf_gen and friends
3765 # otherwise rely on the user-provided value
3766 if test "x$squid_cv_check_marchnative" = "xyes"; then
3767 # always valid for the Build compiler.
3768 BUILDCXXFLAGS="-march=native"
3769 fi
3770 BUILDCXXFLAGS="$BUILDCXXFLAGS $CXXFLAGS"
3771 fi
3772 AC_SUBST(BUILDCXXFLAGS)
3773
3774 AC_MSG_NOTICE([BUILD LIBRARIES: $LIBS])
3775 AC_MSG_NOTICE([BUILD EXTRA LIBRARIES: $XTRA_LIBS])
3776 AC_MSG_NOTICE([BUILD OBJECTS: $OBJS])
3777 AC_MSG_NOTICE([BUILD EXTRA OBJECTS: $XTRA_OBJS])
3778 AC_MSG_NOTICE([BUILD C FLAGS: $CFLAGS])
3779 AC_MSG_NOTICE([BUILD EXTRA C FLAGS: $SQUID_CFLAGS])
3780 AC_MSG_NOTICE([BUILD C++ FLAGS: $CXXFLAGS])
3781 AC_MSG_NOTICE([BUILD EXTRA C++ FLAGS: $SQUID_CXXFLAGS])
3782 AC_MSG_NOTICE([BUILD Tools C++ FLAGS: $BUILDCXXFLAGS])
3783
3784 dnl Clean up after OSF/1 core dump bug
3785 rm -f core
3786
3787 AC_CONFIG_FILES([
3788 Makefile
3789 compat/Makefile
3790 contrib/Makefile
3791 doc/Makefile
3792 doc/manuals/Makefile
3793 doc/release-notes/Makefile
3794 errors/Makefile
3795 icons/Makefile
3796 lib/Makefile
3797 lib/libTrie/Makefile
3798 lib/libTrie/test/Makefile
3799 lib/ntlmauth/Makefile
3800 lib/profiler/Makefile
3801 lib/rfcnb/Makefile
3802 lib/smblib/Makefile
3803 lib/snmplib/Makefile
3804 scripts/Makefile
3805 src/Makefile
3806 src/acl/Makefile
3807 src/acl/external/Makefile
3808 src/acl/external/AD_group/Makefile
3809 src/acl/external/delayer/Makefile
3810 src/acl/external/eDirectory_userip/Makefile
3811 src/acl/external/file_userip/Makefile
3812 src/acl/external/kerberos_ldap_group/Makefile
3813 src/acl/external/LDAP_group/Makefile
3814 src/acl/external/LM_group/Makefile
3815 src/acl/external/session/Makefile
3816 src/acl/external/SQL_session/Makefile
3817 src/acl/external/unix_group/Makefile
3818 src/acl/external/wbinfo_group/Makefile
3819 src/acl/external/time_quota/Makefile
3820 src/adaptation/Makefile
3821 src/adaptation/icap/Makefile
3822 src/adaptation/ecap/Makefile
3823 src/anyp/Makefile
3824 src/auth/Makefile
3825 src/auth/basic/Makefile
3826 src/auth/basic/DB/Makefile
3827 src/auth/basic/fake/Makefile
3828 src/auth/basic/getpwnam/Makefile
3829 src/auth/basic/LDAP/Makefile
3830 src/auth/basic/NCSA/Makefile
3831 src/auth/basic/NIS/Makefile
3832 src/auth/basic/PAM/Makefile
3833 src/auth/basic/POP3/Makefile
3834 src/auth/basic/RADIUS/Makefile
3835 src/auth/basic/SASL/Makefile
3836 src/auth/basic/SMB/Makefile
3837 src/auth/basic/SMB_LM/Makefile
3838 src/auth/basic/SSPI/Makefile
3839 src/auth/digest/Makefile
3840 src/auth/digest/eDirectory/Makefile
3841 src/auth/digest/file/Makefile
3842 src/auth/digest/LDAP/Makefile
3843 src/auth/negotiate/Makefile
3844 src/auth/negotiate/kerberos/Makefile
3845 src/auth/negotiate/SSPI/Makefile
3846 src/auth/negotiate/wrapper/Makefile
3847 src/auth/ntlm/Makefile
3848 src/auth/ntlm/fake/Makefile
3849 src/auth/ntlm/SMB_LM/Makefile
3850 src/auth/ntlm/SSPI/Makefile
3851 src/base/Makefile
3852 src/clients/Makefile
3853 src/comm/Makefile
3854 src/dns/Makefile
3855 src/DiskIO/Makefile
3856 src/DiskIO/AIO/Makefile
3857 src/DiskIO/Blocking/Makefile
3858 src/DiskIO/DiskDaemon/Makefile
3859 src/DiskIO/DiskThreads/Makefile
3860 src/DiskIO/IpcIo/Makefile
3861 src/DiskIO/Mmapped/Makefile
3862 src/esi/Makefile
3863 src/eui/Makefile
3864 src/format/Makefile
3865 src/fs/Makefile
3866 src/ftp/Makefile
3867 src/helper/Makefile
3868 src/http/Makefile
3869 src/http/one/Makefile
3870 src/http/url_rewriters/Makefile
3871 src/http/url_rewriters/fake/Makefile
3872 src/http/url_rewriters/LFS/Makefile
3873 src/icmp/Makefile
3874 src/ident/Makefile
3875 src/ip/Makefile
3876 src/ipc/Makefile
3877 src/log/Makefile
3878 src/log/DB/Makefile
3879 src/log/file/Makefile
3880 src/mem/Makefile
3881 src/mgr/Makefile
3882 src/parser/Makefile
3883 src/repl/Makefile
3884 src/sbuf/Makefile
3885 src/security/Makefile
3886 src/security/cert_generators/Makefile
3887 src/security/cert_generators/file/Makefile
3888 src/security/cert_validators/Makefile
3889 src/security/cert_validators/fake/Makefile
3890 src/servers/Makefile
3891 src/snmp/Makefile
3892 src/ssl/Makefile
3893 src/store/Makefile
3894 src/store/id_rewriters/Makefile
3895 src/store/id_rewriters/file/Makefile
3896 test-suite/Makefile
3897 tools/Makefile
3898 tools/helper-mux/Makefile
3899 tools/purge/Makefile
3900 tools/squidclient/Makefile
3901 tools/systemd/Makefile
3902 tools/sysvinit/Makefile
3903 ])
3904
3905 # must configure libltdl subdir unconditionally for "make distcheck" to work
3906 #AC_CONFIG_SUBDIRS(libltdl)
3907
3908 AC_OUTPUT