]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Make http_port optional, allowing for SSL-only operation. Squid will
[thirdparty/squid.git] / configure.in
CommitLineData
1b3db6d9 1
2877b8a9 2dnl Configuration input file for Squid
090089c4 3dnl
983061ed 4dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
090089c4 5dnl
0961c811 6dnl $Id: configure.in,v 1.259 2002/04/01 13:06:28 hno Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
a26bdc75 10AC_INIT(src/main.c)
71b12d7c 11AC_CONFIG_AUX_DIR(cfgaux)
8ea177f7 12AM_INIT_AUTOMAKE(squid, 2.6-DEVEL)
a2794549 13AM_CONFIG_HEADER(include/autoconf.h)
0961c811 14AC_REVISION($Revision: 1.259 $)dnl
a2794549 15AC_PREFIX_DEFAULT(/usr/local/squid)
246d7ffc 16AM_MAINTAINER_MODE
a2794549 17
18dnl Set default LDFLAGS
19if test -z "$LDFLAGS"; then
20 LDFLAGS="-g"
21fi
22
23PRESET_CFLAGS="$CFLAGS"
090089c4 24
a2794549 25dnl Check for GNU cc
26AC_PROG_CC
27AM_PROG_CC_C_O
88d50a22 28AC_CANONICAL_HOST
29
a2794549 30
26675bf4 31CRYPTLIB=''
00fa2c12 32REGEXLIB='' # -lregex
33LIBREGEX='' # libregex.a
090089c4 34
a2794549 35dnl find out the exe extension for this platform. If it's not empty, use it for CGI's as well.
36AC_EXEEXT
37AC_OBJEXT
38
39if test -z "$EXEEXT"; then
40 CGIEXT=".cgi"
41else
42 CGIEXT="$EXEEXT"
43fi
44
0e6d05ef 45dnl this should be expanded to a list of platform sensible support requirements.
46dnl (adding an option like --enable-cygwin-support doesn't make sense :]) - R Collins 2001
df087e68 47case "$host_os" in
a2794549 48cygwin|cygwin32)
49 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, true)
df087e68 50 ;;
51*)
a2794549 52 AM_CONDITIONAL(ENABLE_WIN32SPECIFIC, false)
df087e68 53 ;;
54esac
df087e68 55
a26bdc75 56if test -z "$CACHE_HTTP_PORT"; then
57 CACHE_HTTP_PORT="3128"
58fi
59if test -z "$CACHE_ICP_PORT"; then
60 CACHE_ICP_PORT="3130"
61fi
a26bdc75 62
090089c4 63dnl Subsitutions
4d683a65 64AC_DEFINE_UNQUOTED(CACHE_HTTP_PORT, $CACHE_HTTP_PORT)
65AC_DEFINE_UNQUOTED(CACHE_ICP_PORT, $CACHE_ICP_PORT)
090089c4 66
30a4f2a8 67AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host")
68
781ba3fb 69AC_DEFINE_UNQUOTED(SQUID_CONFIGURE_OPTIONS, "$ac_configure_args")
090089c4 70
6ad85e8a 71dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
72case "$host" in
73 mab-next-nextstep3)
74 CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
75 ;;
76esac
77
30a4f2a8 78dnl Set Default CFLAGS
79if test -z "$PRESET_CFLAGS"; then
80 if test "$GCC" = "yes"; then
81 case "$host" in
97b12a5b 82 *-sun-sunos*)
30a4f2a8 83 # sunos has too many warnings for this to be useful
84 # motorola too
85 ;;
97b12a5b 86 *m88k*)
87 # Motorola cc/ld does not like -02 but is ok on -O
88 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
89 ;;
30a4f2a8 90 *)
91 CFLAGS="$CFLAGS -Wall"
92 ;;
93 esac
81a820c6 94 else
95 case "$host" in
c415c128 96 *mips-sgi-irix6.*)
81a820c6 97 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
c415c128 98 CFLAGS="$CFLAGS -n32 -mips3 -O3 -OPT:Olimit=0:space=OFF \
58dc050d 99 -woff 1009,1014,1110,1116,1185,1188,1204,1230,1233 \
81a820c6 100 -Wl,-woff,85,-woff,84,-woff,134 \
101 -nostdinc -I/usr/include -D_BSD_SIGNALS"
102 ;;
e8f5fb18 103 alpha-dec-osf4.*)
553c24ae 104 # Mogul says DEC compilers take both -g and -O2
b6a2f15e 105 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
553c24ae 106 CFLAGS="$CFLAGS -O2"
107 ;;
81a820c6 108 *)
109 ;;
110 esac
30a4f2a8 111 fi
30a4f2a8 112fi
113
114dnl Set LDFLAGS
115if test -z "$PRESET_LDFLAGS"; then
116 if test "$GCC" = "yes"; then
117 case "$host" in
118 *)
119 # nothing
120 ;;
121 esac
81a820c6 122 else
123 case "$host" in
c415c128 124 *mips-sgi-irix6.*)
81a820c6 125 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
c415c128 126 LDFLAGS="-n32 -mips3 -nostdlib -L/usr/lib32"
81a820c6 127 ;;
128 esac
30a4f2a8 129 fi
130fi
2060fa9a 131
e5f4e1b0 132dnl Enable optional modules
133AC_ARG_ENABLE(dlmalloc,
94d48591 134[ --enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea],
e5f4e1b0 135[
94d48591 136 case "$enableval" in
137 'yes')
029ce4ae 138 use_dlmalloc="yes"
94d48591 139 LIBDLMALLOC="libdlmalloc.a"
140 LIB_MALLOC="-L../lib -ldlmalloc"
029ce4ae 141 echo "dlmalloc enabled"
94d48591 142 ;;
143 'no')
029ce4ae 144 use_dlmalloc="no"
145 echo "dlmalloc disabled"
94d48591 146 ;;
029ce4ae 147 *) use_dlmalloc="yes"
148 LIB_MALLOC="$enableval"
149 echo "dlmalloc enabled with $LIB_MALLOC"
150 esac
151])
152if test "${use_dlmalloc-unset}" = unset; then
153 case "$host" in
154 i386-*-solaris2.*)
155 echo "Enabling dlmalloc for $host"
156 use_dlmalloc="yes"
d20b1cd0 157 LIBDLMALLOC="libdlmalloc.a"
158 LIB_MALLOC="-L../lib -ldlmalloc"
029ce4ae 159 ;;
e8dbaa90 160 *-sgi-irix*)
161 echo "Enabling dlmalloc for $host"
162 use_dlmalloc="yes"
163 LIBDLMALLOC="libdlmalloc.a"
164 LIB_MALLOC="-L../lib -ldlmalloc"
165 ;;
029ce4ae 166 esac
167fi
168if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
169 # Ok. dlmalloc was enabled before, but state may be changed.
170 # we have to test these again
171 unset ac_cv_func_mallinfo
172 unset ac_cv_func_mallocblksize
173 unset ac_cv_func_free
174 unset ac_cv_func_realloc
175 unset ac_cv_func_memalign
176 unset ac_cv_func_valloc
177 unset ac_cv_func_pvalloc
178 unset ac_cv_func_calloc
179 unset ac_cv_func_cfree
180 unset ac_cv_func_malloc_trim
181 unset ac_cv_func_malloc_usable_size
182 unset ac_cv_func_malloc_stats
183 unset ac_cv_func_mallinfo
184 unset ac_cv_func_mallopt
185 unset ac_cv_lib_gnumalloc
186 unset ac_cv_header_gnumalloc_h
187 unset ac_cv_lib_malloc
188 unset ac_cv_enabled_dlmalloc
189fi
190if test "$use_dlmalloc" = yes; then
94d48591 191 ac_cv_func_mallinfo="yes"
192 ac_cv_func_mallocblksize="no"
193 ac_cv_func_free="yes"
194 ac_cv_func_realloc="yes"
195 ac_cv_func_memalign="yes"
196 ac_cv_func_valloc="yes"
197 ac_cv_func_pvalloc="yes"
198 ac_cv_func_calloc="yes"
199 ac_cv_func_cfree="yes"
200 ac_cv_func_malloc_trim="yes"
201 ac_cv_func_malloc_usable_size="yes"
202 ac_cv_func_malloc_stats="yes"
94d48591 203 ac_cv_func_mallopt="yes"
204 ac_cv_lib_gnumalloc="no"
85efe3ec 205 ac_cv_header_gnumalloc_h="no"
94d48591 206 ac_cv_lib_malloc="no"
207 ac_cv_enabled_dlmalloc="yes"
029ce4ae 208fi
209
e5f4e1b0 210AC_SUBST(LIBDLMALLOC)
211AC_SUBST(LIB_MALLOC)
212
213AC_ARG_ENABLE(gnuregex,
214[ --enable-gnuregex Compile GNUregex],
215[USE_GNUREGEX=$enableval])
216
0961c811 217dnl This is a developer only option.. developers know how to set defines
218dnl
219dnl AC_ARG_ENABLE(xmalloc-debug,
220dnl [ --enable-xmalloc-debug Do some simple malloc debugging],
221dnl [ if test "$enableval" = "yes" ; then
222dnl echo "Malloc debugging enabled"
223dnl AC_DEFINE(XMALLOC_DEBUG)
224dnl fi
225dnl ])
226
227dnl This is a developer only option.. developers know how to set defines
228dnl
229dnl AC_ARG_ENABLE(xmalloc-debug-trace,
230dnl [ --enable-xmalloc-debug-trace
231dnl Detailed trace of memory allocations],
232dnl [ if test "$enableval" = "yes" ; then
233dnl echo "Malloc debug trace enabled"
234dnl AC_DEFINE(XMALLOC_TRACE)
235dnl AC_DEFINE(XMALLOC_DEBUG)
236dnl fi
237dnl ])
e5f4e1b0 238
d9180414 239AC_ARG_ENABLE(xmalloc-statistics,
e5f4e1b0 240[ --enable-xmalloc-statistics
241 Show malloc statistics in status page],
242[ if test "$enableval" = "yes" ; then
243 echo "Malloc statistics enabled"
244 AC_DEFINE(XMALLOC_STATISTICS)
245 fi
246])
247
323fe0d4 248AC_ARG_ENABLE(carp,
249[ --enable-carp Enable CARP support],
250[ if test "$enableval" = "yes" ; then
251 echo "CARP support enabled"
252 AC_DEFINE(USE_CARP)
253 fi
254])
255
cd748f27 256AC_ARG_ENABLE(async-io,
9bc73deb 257[ --enable-async-io[=N_THREADS]
cd748f27 258 Shorthand for
f85c88f3 259 --with-aufs-threads=N_THREADS
cd748f27 260 --with-pthreads
261 --enable-storeio=ufs,aufs],
262[ case $enableval in
9bc73deb 263 yes)
cd748f27 264 with_pthreads=yes
265 STORE_MODULES="ufs aufs"
9bc73deb 266 ;;
267 no)
9bc73deb 268 ;;
269 *)
f85c88f3 270 aufs_io_threads=$enableval
cd748f27 271 with_pthreads=yes
272 STORE_MODULES="ufs aufs"
9bc73deb 273 ;;
274 esac
275])
276
f85c88f3 277AC_ARG_WITH(aufs-threads,
278[ --with-aufs-threads=N_THREADS
cd748f27 279 Tune the number of worker threads for the aufs object
280 store.],
f85c88f3 281[ aufs_io_threads=$withval ])
282if test "$aufs_io_threads"; then
283 echo "With $aufs_io_threads aufs threads"
cd748f27 284 with_pthreads=yes
f85c88f3 285 AC_DEFINE_UNQUOTED(AUFS_IO_THREADS,$aufs_io_threads)
cd748f27 286fi
287
288AC_ARG_WITH(pthreads,
289[ --with-pthreads Use POSIX Threads],
290[ if test "$enableval" = "yes"; then
291 with_pthreads=yes
292 fi
293])
294if test "$with_pthreads"; then
295 echo "With pthreads"
9fc0b4b8 296 SQUID_PTHREAD_LIB='$(PTHREADLIB)'
297 CFLAGS="$CFLAGS -D_REENTRANT"
c68e9c6b 298 case "$host" in
299 i386-unknown-freebsd*)
cd748f27 300 if test "$GCC" = "yes" ; then
301 if test -z "$PRESET_LDFLAGS"; then
302 LDFLAGS="$LDFLAGS -pthread"
303 fi
304 fi
305 ;;
b71119d9 306 *-solaris2.*)
307 if test "$GCC" = "yes" ; then
308 CFLAGS="$CFLAGS -pthreads"
309 else
310 CFLAGS="$CFLAGS -mt"
311 fi
312 ;;
c68e9c6b 313 esac
9bc73deb 314fi
e5f4e1b0 315AC_SUBST(SQUID_PTHREAD_LIB)
316
f85c88f3 317AC_ARG_WITH(aio,
318[ --with-aio Use POSIX AIO],
319[ if test "$enableval" = "yes"; then
320 with_aio=yes
321 fi
322])
323if test "$with_aio"; then
324 echo "With aio"
325 SQUID_AIO_LIB='$(AIOLIB)'
326fi
327AC_SUBST(SQUID_AIO_LIB)
328
cd748f27 329AC_ARG_ENABLE(storeio,
330[ --enable-storeio=\"list of modules\"
331 Build support for the list of store I/O modules.
332 The default is only to build the "ufs" module.
333 See src/fs for a list of available modules, or
334 Programmers Guide section <not yet written>
335 for details on how to build your custom store module],
336[ case $enableval in
337 yes)
338 for module in $srcdir/src/fs/*; do
339 if test -f $module/Makefile.in; then
340 STORE_MODULES="$STORE_MODULES `basename $module`"
a2794549 341 fi
cd748f27 342 done
343 ;;
344 no)
345 ;;
346 *) STORE_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
347 ;;
348 esac
349],
350[ if test -z "$STORE_MODULES"; then
351 STORE_MODULES="ufs"
352 fi
353])
d1aad03d 354echo "Store modules built: $STORE_MODULES"
a2794549 355STORE_OBJS="fs/lib`echo $STORE_MODULES|sed -e 's% %.a fs/lib%g'`.a"
cd748f27 356AC_SUBST(STORE_OBJS)
6652c622 357STORE_LIBS="`echo $STORE_OBJS|sed -e 's%fs/%%g'`"
f71946fc 358AC_SUBST(STORE_LIBS)
a2794549 359dnl remove all but diskd - its the only module that needs to recurse
360dnl into the sub directory
361STORE_MODULE_SUBDIRS=
362for fs in $STORE_MODULES none; do
f6ff4419 363 if test "$fs" = "diskd"; then
a2794549 364 STORE_MODULE_SUBDIRS="$STORE_MODULE_SUBDIRS $fs"
bacca099 365 OPT_DISKD_EXE='diskd$(EXEEXT)'
a2794549 366 fi
367done
368AC_SUBST(STORE_MODULES)
369AC_SUBST(STORE_MODULE_SUBDIRS)
bacca099 370AC_SUBST(OPT_DISKD_EXE)
a2794549 371
cd748f27 372
6a566b9c 373dnl --enable-heap-replacement compability option
374AC_ARG_ENABLE(heap-replacement,
375[ --enable-heap-replacement
376 Backwards compability option. Please use the
377 new --enable-removal-policies directive instead.],
378[ if test "$enableval" = "yes" ; then
379 echo "--enable-heap-replacement is obsolete. please use the new"
380 echo "--enable-removal-policies directive instead"
381 sleep 5
382 REPL_POLICIES="heap"
383 fi
384])
385
d9180414 386AC_ARG_ENABLE(removal-policies,
6a566b9c 387[ --enable-removal-policies=\"list of policies\"
388 Build support for the list of removal policies.
389 The default is only to build the "lru" module.
390 See src/repl for a list of available modules, or
391 Programmers Guide section 9.9 for details on how
392 to build your custom policy],
393[ case $enableval in
394 yes)
395 for module in $srcdir/src/repl/*; do
396 if test -f $module/Makefile.in; then
397 REPL_POLICIES="$REPL_POLICIES `basename $module`"
398 fi
399 done
400 ;;
401 no)
402 ;;
403 *) REPL_POLICIES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
404 ;;
405 esac
406],
407[ if test -z "$REPL_POLICIES"; then
408 REPL_POLICIES="lru"
409 fi
410])
65033bdd 411echo "Removal policies built: $REPL_POLICIES"
6a566b9c 412AC_SUBST(REPL_POLICIES)
a2794549 413REPL_OBJS="repl/lib`echo $REPL_POLICIES|sed -e 's% %.a repl/lib%g'`.a"
6a566b9c 414AC_SUBST(REPL_OBJS)
6652c622 415REPL_LIBS="`echo $REPL_OBJS|sed -e 's%repl/%%g'`"
f71946fc 416AC_SUBST(REPL_LIBS)
6a566b9c 417
8efddab9 418OPT_PINGER=''
3c573763 419OPT_PINGER_EXE=''
e5f4e1b0 420AC_ARG_ENABLE(icmp,
421[ --enable-icmp Enable ICMP pinging],
422[ if test "$enableval" = "yes" ; then
423 echo "ICMP enabled"
424 AC_DEFINE(USE_ICMP)
8efddab9 425 OPT_PINGER='pinger'
426 OPT_PINGER_EXE='pinger$(EXEEXT)'
e5f4e1b0 427 fi
428])
8efddab9 429AC_SUBST(OPT_PINGER)
3c573763 430AC_SUBST(OPT_PINGER_EXE)
e5f4e1b0 431
a2794549 432AM_CONDITIONAL(USE_DELAY_POOLS, false)
d9180414 433AC_ARG_ENABLE(delay-pools,
76d83c52 434[ --enable-delay-pools Enable delay pools to limit bandwidth usage],
e5f4e1b0 435[ if test "$enableval" = "yes" ; then
95e36d02 436 echo "Delay pools enabled"
95e36d02 437 AC_DEFINE(DELAY_POOLS)
a2794549 438 AM_CONDITIONAL(USE_DELAY_POOLS, true)
e5f4e1b0 439 fi
440])
441
0961c811 442dnl This is a developer only option. Developers know how to set defines
443dnl
444dnl AC_ARG_ENABLE(mem-gen-trace,
445dnl [ --enable-mem-gen-trace Do trace of memory stuff],
446dnl [ if test "$enableval" = "yes" ; then
447dnl echo "Memory trace (to file) enabled"
448dnl AC_DEFINE(MEM_GEN_TRACE)
449dnl fi
450dnl ])
36a97e19 451
d9180414 452AC_ARG_ENABLE(useragent-log,
e5f4e1b0 453[ --enable-useragent-log Enable logging of User-Agent header],
454[ if test "$enableval" = "yes" ; then
455 echo "User-Agent logging enabled"
456 AC_DEFINE(USE_USERAGENT_LOG)
457 fi
458])
459
dfca7e1a 460AC_ARG_ENABLE(referer-log,
0961c811 461[ --enable-referer-log Enable logging of Referer header],
dfca7e1a 462[ if test "$enableval" = "yes" ; then
463 echo "Referer logging enabled"
464 AC_DEFINE(USE_REFERER_LOG)
465 fi
466])
467
320e9f36 468AC_ARG_ENABLE(wccp,
0961c811 469[ --disable-wccp Disable Web Cache Coordination Protocol],
eb824054 470[ if test "$enableval" = "no" ; then
471 echo "Web Cache Coordination Protocol disabled"
472 AC_DEFINE(USE_WCCP, 0)
473 else
474 AC_DEFINE(USE_WCCP, 1)
320e9f36 475 fi
476])
320e9f36 477
d9180414 478AC_ARG_ENABLE(kill-parent-hack,
9fc0b4b8 479[ --enable-kill-parent-hack
480 Kill parent on shutdown],
e5f4e1b0 481[ if test "$enableval" = "yes" ; then
482 echo "Kill parent on shutdown"
483 AC_DEFINE(KILL_PARENT_OPT)
484 fi
485])
486
a2794549 487AM_CONDITIONAL(USE_SNMP, false)
e5f4e1b0 488AC_ARG_ENABLE(snmp,
489[ --enable-snmp Enable SNMP monitoring],
490[ if test "$enableval" = "yes" ; then
491 echo "SNMP monitoring enabled"
492 AC_DEFINE(SQUID_SNMP)
493 SNMPLIB='-L../snmplib -lsnmp'
a2794549 494 AM_CONDITIONAL(USE_SNMP, true)
8a7f0105 495 SNMP_MAKEFILE=./snmplib/Makefile
e5f4e1b0 496 makesnmplib=snmplib
497 fi
498])
499AC_SUBST(SNMPLIB)
e5f4e1b0 500AC_SUBST(makesnmplib)
501
0961c811 502dnl This do not work well.. disable for now so people do not
503dnl enable it and thereby cause problems.. (tired of seeing people
504dnl having enabled this, and then complaining...)
505dnl
506dnl AC_ARG_ENABLE(time-hack,
507dnl [ --enable-time-hack Update internal timestamp only once per second],
508dnl [ if test "$enableval" = "yes" ; then
509dnl echo "Update internal timestamp only once per second"
510dnl AC_DEFINE(ALARM_UPDATES_TIME)
511dnl fi
512dnl ])
e5f4e1b0 513
d9180414 514AC_ARG_ENABLE(cachemgr-hostname,
e5f4e1b0 515[ --enable-cachemgr-hostname[=hostname]
516 Make cachemgr.cgi default to this host],
517[ case $enableval in
518 yes)
519 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()])
520 echo "Cachemgr default hostname == host where cachemgr runs"
521 ;;
522 no)
523 : # Nothing to do..
524 ;;
525 *)
526 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
527 echo "Cachemgr default hostname set to ${enableval}"
528 ;;
529 esac
530])
531
d9180414 532AC_ARG_ENABLE(arp-acl,
e5f4e1b0 533[ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
534[ if test "$enableval" = "yes" ; then
535 echo "ARP ACL lists enabled (ether address)"
933cc58d 536 case "$host" in
ef614b1c 537 *-linux-*)
538 ;;
539 *-solaris-*)
a931a29b 540 ;;
933cc58d 541 *)
ef614b1c 542 echo "WARNING: ARP ACL support probably won't work on $host."
933cc58d 543 sleep 10
544 ;;
545 esac
e5f4e1b0 546 AC_DEFINE(USE_ARP_ACL)
547 fi
548])
549
a2794549 550AM_CONDITIONAL(ENABLE_HTCP, false)
74075210 551AC_ARG_ENABLE(htcp,
88b7de25 552[ --enable-htcp Enable HTCP protocol],
b4b8b6da 553[ if test "$enableval" = "yes" ; then
554 echo "HTCP enabled"
b4b8b6da 555 AC_DEFINE(USE_HTCP)
a2794549 556 AM_CONDITIONAL(ENABLE_HTCP, true)
b4b8b6da 557 fi
74075210 558])
a2794549 559
560AM_CONDITIONAL(ENABLE_SSL, false)
74075210 561
1f7c9178 562AC_ARG_ENABLE(ssl,
563[ --enable-ssl Enable ssl gatewaying support using OpenSSL],
564[ if test "$enableval" != "no"; then
3dff197f 565 echo "SSL gatewaying using OpenSSL enabled"
1f7c9178 566 AC_DEFINE(USE_SSL)
a2794549 567 AM_CONDITIONAL(ENABLE_SSL, true)
1f7c9178 568 SSLLIB='-lssl -lcrypto'
569 USE_OPENSSL=1
570 fi
571])
572
3dff197f 573AM_CONDITIONAL(NEED_OWN_MD5, true)
574
1f7c9178 575AC_ARG_WITH(openssl,
576[ --with-openssl[=prefix]
577 Compile with the OpenSSL libraries. The path to
578 the OpenSSL development libraries and headers
579 installation can be specified if outside of the
580 system standard directories],
581[
46ce628c 582 case "$with_openssl" in
1f7c9178 583 yes)
584 USE_OPENSSL=1
585 ;;
586 no)
587 USE_OPENSSL=
588 ;;
589 *)
46ce628c 590 SSLLIBDIR="$with_openssl/lib"
bcce53ce 591 CPPFLAGS="-I$with_openssl/include $CPPFLAGS"
1f7c9178 592 USE_OPENSSL=1
593 esac
594])
595
596if test -n "$USE_OPENSSL"; then
3dff197f 597 echo "Using OpenSSL MD5 implementation"
1f7c9178 598 AC_DEFINE(USE_OPENSSL)
3dff197f 599 AM_CONDITIONAL(NEED_OWN_MD5, false)
1f7c9178 600 if test -z "$SSLLIB"; then
601 SSLLIB="-lcrypto" # for MD5 routines
602 fi
603fi
604if test -n "$SSLLIBDIR"; then
605 SSLLIB="-L$SSLLIBDIR $SSLLIB"
606fi
1f7c9178 607AC_SUBST(SSLLIB)
608
02749868 609AC_ARG_ENABLE(forw-via-db,
610[ --enable-forw-via-db Enable Forw/Via database],
611[ if test "$enableval" = "yes" ; then
612 echo "FORW-VIA enabled"
613 AC_DEFINE(FORW_VIA_DB)
614 fi
615])
616
6cfa8966 617AC_ARG_ENABLE(cache-digests,
22df58ea 618[ --enable-cache-digests Use Cache Digests
2b6662ba 619 see http://www.squid-cache.org/FAQ/FAQ-16.html],
484f2ebc 620[ if test "$enableval" = "yes" ; then
6cfa8966 621 echo "USE_CACHE_DIGESTS enabled"
622 AC_DEFINE(USE_CACHE_DIGESTS)
484f2ebc 623 fi
624])
625
8c3926c5 626dnl Select Default Error language
627AC_ARG_ENABLE(default-err-language,
628[ --enable-default-err-language=lang
0961c811 629 Select default language for Error pages (see
630 errors directory) ],
933cc58d 631[
cf9d704a 632 if test -d $srcdir/errors/$enableval; then
8c3926c5 633 ERR_DEFAULT_LANGUAGE=$enableval
933cc58d 634 else
0961c811 635 echo "ERROR! Unknown language $enableval, see errors/ directory"
933cc58d 636 exit 1
637 fi
8c3926c5 638],[ERR_DEFAULT_LANGUAGE="English"])
639AC_SUBST(ERR_DEFAULT_LANGUAGE)
640
641dnl Select languages to be installed
642AC_ARG_ENABLE(err-languages,
643[ --enable-err-languages=\"lang1 lang2..\"
0961c811 644 Select languages to be installed. (All will be
645 installed by default) ],
8c3926c5 646[
647 for l in $enableval; do
648 if test -d $srcdir/errors/$l; then :; else
649 echo "ERROR! Unknown language $$l, see errors/"
650 exit 1
651 fi
652 done
653 ERR_LANGUAGES=$enableval
654],[
655 ERR_LANGUAGES=
656 for l in $srcdir/errors/*; do
cbbe101f 657 if test -f $l/ERR_ACCESS_DENIED; then
8c3926c5 658 ERR_LANGUAGES="$ERR_LANGUAGES `basename $l`"
659 fi
660 done
661])
662AC_SUBST(ERR_LANGUAGES)
933cc58d 663
cd748f27 664dnl Size of COSS memory buffer
665AC_ARG_WITH(coss-membuf-size,
666[ --with-coss-membuf-size COSS membuf size (default 1048576 bytes) ],
667[ if test "$with_coss_membuf_size"; then
668 echo "Setting COSS membuf size to $with_coss_membuf_size bytes"
669 AC_DEFINE_UNQUOTED(COSS_MEMBUF_SZ, $with_coss_membuf_size)
670 fi
671])
672
1b3db6d9 673dnl check for netio plugin stuff
9bb83c8b 674dnl Enable poll()
675AC_ARG_ENABLE(poll,
0961c811 676[ --enable-poll Enable poll() support.
677 --disable-poll Disable poll() support. ],
1b3db6d9 678
679[
c68e9c6b 680 case "$enableval" in
681 yes)
9bb83c8b 682 echo "Forcing poll() to be enabled"
683 ac_cv_func_poll='yes'
c68e9c6b 684 ;;
685 no)
686 echo "Forcing poll() to be disabled"
687 ac_cv_func_poll='no'
688 ;;
689 esac
9bb83c8b 690])
691
1b3db6d9 692dnl Enable select()
693AC_ARG_ENABLE(select,
0961c811 694[ --enable-select Enable select() support.
695 --disable-select Disable select() support. ],
1b3db6d9 696
697[
698 case "$enableval" in
699 yes)
700 echo "Forcing select() to be enabled"
701 ac_cv_func_select='yes'
702 ;;
703 no)
704 echo "Forcing select() to be disabled"
705 ac_cv_func_select='no'
706 ;;
707 esac
708])
709
710dnl Enable kqueue()
711AC_ARG_ENABLE(kqueue,
0961c811 712[ --enable-kqueue Enable kqueue() support.
713 --disable-kqueue Disable kqueue() support. ],
1b3db6d9 714
715[
716 case "$enableval" in
717 yes)
718 echo "Forcing kqueue() to be enabled"
719 ac_cv_func_kqueue='yes'
720 ;;
721 no)
722 echo "Forcing kqueue() to be disabled"
723 ac_cv_func_kqueue='no'
724 ;;
725esac
726])
727
72fd085a 728dnl Disable HTTP violations
729AC_ARG_ENABLE(http-violations,
730[ --disable-http-violations
731 This allows you to remove code which is known to
c68e9c6b 732 violate the HTTP protocol specification.],
72fd085a 733[ if test "$enableval" = "no" ; then
734 echo "Disabling HTTP Violations"
6eec93b2 735 AC_DEFINE(HTTP_VIOLATIONS, 0)
72fd085a 736 else
6eec93b2 737 AC_DEFINE(HTTP_VIOLATIONS, 1)
72fd085a 738 fi
739])
740
5cafc1d6 741dnl Enable IP-Filter Transparent Proxy
742AC_ARG_ENABLE(ipf-transparent,
743[ --enable-ipf-transparent
744 Enable Transparent Proxy support for systems
c68e9c6b 745 using IP-Filter network address redirection.],
5cafc1d6 746[ if test "$enableval" = "yes" ; then
747 echo "IP-Filter Transparent Proxy enabled"
748 AC_DEFINE(IPF_TRANSPARENT)
749 IPF_TRANSPARENT="yes"
750 fi
751])
752
d852fbad 753dnl Enable Linux Netfilter (2.4) Transparent Proxy
754AC_ARG_ENABLE(linux-netfilter,
755[ --enable-linux-netfilter
756 Enable Transparent Proxy support for Linux 2.4.],
757[ if test "$enableval" = "yes" ; then
758 echo "Linux-Netfilter Transparent Proxy enabled"
759 AC_DEFINE(LINUX_NETFILTER)
760 LINUX_NETFILTER="yes"
761 fi
762])
763
bb7b5fd0 764dnl Enable Large file support
765AC_ARG_ENABLE(large-files,
766[ --enable-large-files Enable support for large files (>2GB). Still
767 experimental.],
768[ if test "$enableval" = "yes" ; then
769 echo "Large file support enabled"
770 CFLAGS="$CFLAGS -D_FILE_OFFSET_BITS=64"
771 fi
772])
773
a2794549 774AM_CONDITIONAL(MAKE_LEAKFINDER, false)
5d620373 775dnl Enable Leak Finding Functions
776AC_ARG_ENABLE(leakfinder,
777[ --enable-leakfinder
778 Enable Leak Finding code. Enabling this alone
779 does nothing; you also have to modify the source
780 code to use the leak finding functions. Probably
781 Useful for hackers only.],
782[ if test "$enableval" = "yes" ; then
783 echo "Leak-Finding enabled"
784 AC_DEFINE(USE_LEAKFINDER)
5d620373 785 USE_LEAKFINDER="yes"
a2794549 786 AM_CONDITIONAL(MAKE_LEAKFINDER, true)
5d620373 787 fi
788])
5d620373 789
3898f57f 790AC_ARG_ENABLE(ident-lookups,
791[ --disable-ident-lookups
792 This allows you to remove code that performs
793 Ident (RFC 931) lookups.],
794[ if test "$enableval" = "no" ; then
795 echo "Disabling Ident Lookups"
796 AC_DEFINE(USE_IDENT, 0)
797 else
798 AC_DEFINE(USE_IDENT, 1)
799 fi
800])
801
a2794549 802AM_CONDITIONAL(USE_DNSSERVER, false)
3c573763 803use_dnsserver=
eb824054 804AC_ARG_ENABLE(internal-dns,
7e3ce7b9 805[ --disable-internal-dns This prevents Squid from directly sending and
eb824054 806 receiving DNS messages, and instead enables the
807 old external 'dnsserver' processes.],
808[ if test "$enableval" = "no" ; then
809 echo "Disabling Internal DNS queries"
3c573763 810 use_dnsserver="yes"
eb824054 811 fi
812])
3c573763 813if test "$use_dnsserver" = "yes"; then
7b800d9f 814 AC_DEFINE(USE_DNSSERVERS)
bacca099 815 OPT_DNSSERVER_EXE='dnsserver$(EXEEXT)'
a2794549 816 AM_CONDITIONAL(USE_DNSSERVER, true)
3c573763 817else
818 OPT_DNSSERVER_EXE=''
3c573763 819fi
820AC_SUBST(OPT_DNSSERVER_EXE)
eb824054 821
822AC_ARG_ENABLE(truncate,
7e3ce7b9 823[ --enable-truncate This uses truncate() instead of unlink() when
eb824054 824 removing cache files. Truncate gives a little
825 performance improvement, but may cause problems
826 when used with async I/O. Truncate uses more
827 filesystem inodes than unlink..],
828[ if test "$enableval" = "yes" ; then
829 echo "Enabling truncate instead of unlink"
830 AC_DEFINE(USE_TRUNCATE)
831 fi
832])
833
9bc73deb 834dnl Enable underscore in hostnames
835AC_ARG_ENABLE(underscores,
836[ --enable-underscores Squid by default rejects any host names with _
76d83c52 837 in their name to conform with internet standards.
9bc73deb 838 If you disagree with this you may allow _ in
839 hostnames by using this switch, provided that
840 the resolver library on the host where Squid runs
841 does not reject _ in hostnames...],
842[ if test "$enableval" = "yes" ; then
843 echo "Enabling the use of underscores in host names"
844 AC_DEFINE(ALLOW_HOSTNAME_UNDERSCORES, 1)
845 fi
846])
847
94439e4e 848
849dnl Select auth schemes modules to build
850AC_ARG_ENABLE(auth,
851[ --enable-auth=\"list of auth scheme modules\"
852 Build support for the list of authentication schemes.
853 The default is to build support for the Basic scheme.
854 See src/auth for a list of available modules, or
855 Programmers Guide section authentication schemes
856 for details on how to build your custom auth scheme
857 module],
858[ case $enableval in
859 yes)
860 for module in $srcdir/src/auth/*; do
861 if test -f $module/Makefile.in; then
862 AUTH_MODULES="$AUTH_MODULES `basename $module`"
863 fi
864 done
865 ;;
866 no)
867 ;;
868 *) AUTH_MODULES="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
869 ;;
870 esac
871],
872[ if test -z "$AUTH_MODULES"; then
873 AUTH_MODULES="basic"
874 fi
875])
876echo "Auth scheme modules built: $AUTH_MODULES"
877AC_SUBST(AUTH_MODULES)
a2794549 878AUTH_OBJS="auth/lib`echo $AUTH_MODULES|sed -e 's% %.a auth/lib%g'`.a"
94439e4e 879AC_SUBST(AUTH_OBJS)
6652c622 880AUTH_LIBS="`echo $AUTH_OBJS|sed -e 's%auth/%%g'`"
94439e4e 881AC_SUBST(AUTH_LIBS)
882
883dnl Select basic auth scheme helpers to build
884BASIC_AUTH_HELPERS=""
380f0a87 885AC_ARG_ENABLE(auth-modules,
94439e4e 886[ --enable-auth-modules=\"list of helpers\"
887 Backwards compability alias for
888 --enable-basic-auth-helpers],
889[ echo "--enable-auth-modules is obsolete. Please use the new"
890 echo "option --enable-basic-auth-helpers"
891 sleep 5
892 case "$enableval" in
893 yes)
894 for helper in $srcdir/src/auth/basic/helpers/*; do
895 if test -f $helper/Makefile.in; then
fc83a946 896 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS `basename $helper`"
94439e4e 897 fi
898 done
899 ;;
900 no)
901 ;;
902 *)
fc83a946 903 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
94439e4e 904 esac
905])
906AC_ARG_ENABLE(basic-auth-helpers,
907[ --enable-basic-auth-helpers=\"list of helpers\"
908 This option selects which basic scheme proxy_auth
909 helpers to build and install as part of the normal
910 build process. For a list of available
911 helpers see the src/auth/basic/helpers directory.],
912[ case "$enableval" in
913 yes)
914 BASIC_AUTH_HELPERS=""
915 for helper in $srcdir/src/auth/basic/helpers/*; do
916 if test -f $helper/Makefile.in; then
fc83a946 917 BASIC_AUTH_HELPERS="$BASIC_AUTH_HELPERS `basename $helper`"
94439e4e 918 fi
919 done
920 ;;
921 no)
922 ;;
923 *)
fc83a946 924 BASIC_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
94439e4e 925 esac
926])
fc83a946 927if test -n "$BASIC_AUTH_HELPERS"; then
928 echo "Basic auth helpers built: $BASIC_AUTH_HELPERS"
94439e4e 929fi
fc83a946 930AC_SUBST(BASIC_AUTH_HELPERS)
94439e4e 931
932dnl Select ntlm auth helpers to build
933NTLM_AUTH_HELPERS=
934AC_ARG_ENABLE(ntlm-auth-helpers,
935[ --enable-ntlm-auth-helpers=\"list of helpers\"
936 This option selects which proxy_auth ntlm helpers
937 to build and install as part of the normal build
380f0a87 938 process. For a list of available modules see
94439e4e 939 the src/auth/ntlm/helpers directory.],
380f0a87 940[ case "$enableval" in
941 yes)
94439e4e 942 for helper in $srcdir/src/auth/ntlm/helpers/*; do
943 if test -f $helper/Makefile.in; then
944 NTLM_AUTH_HELPERS="$NTLM_AUTH_HELPERS `basename $helper`"
380f0a87 945 fi
946 done
947 ;;
948 no)
949 ;;
950 *)
94439e4e 951 NTLM_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
380f0a87 952 esac
953])
94439e4e 954if test -n "$NTLM_AUTH_HELPERS"; then
955 echo "NTLM auth helpers built: $NTLM_AUTH_HELPERS"
380f0a87 956fi
94439e4e 957AC_SUBST(NTLM_AUTH_HELPERS)
958
2d70df72 959dnl Select digest auth scheme helpers to build
960DIGEST_AUTH_HELPERS=
961AC_ARG_ENABLE(digest-auth-helpers,
962[ --enable-digest-auth-helpers=\"list of helpers\"
963 This option selects which digest scheme authentication
964 helpers to build and install as part of the normal build
965 process. For a list of available modules see the
966 src/auth/digest/helpers directory.],
967[ case "$enableval" in
968 yes)
969 for helper in $srcdir/src/auth/digest/helpers/*; do
970 if test -f $helper/Makefile.in; then
971 DIGEST_AUTH_HELPERS="$DIGEST_AUTH_HELPERS `basename $helper`"
972 fi
973 done
974 ;;
975 no)
976 ;;
977 *)
978 DIGEST_AUTH_HELPERS="`echo $enableval| sed -e 's/,/ /g;s/ */ /g'`"
979 esac
980])
981if test -n "$DIGEST_AUTH_HELPERS"; then
982 echo "Digest auth helpers built: $DIGEST_AUTH_HELPERS"
983fi
984AC_SUBST(DIGEST_AUTH_HELPERS)
380f0a87 985
6437ac71 986dnl Enable "NTLM fail open"
987AC_ARG_ENABLE(ntlm-fail-open,
988[ --enable-ntlm-fail-open Enable NTLM fail open, where a helper that fails one of the
0961c811 989 Authentication steps can allow squid to still authenticate
990 the user.],
6437ac71 991[ if test "$enableval" = "yes" ; then
992 AC_DEFINE(NTLM_FAIL_OPEN)
993 fi
994])
995
3c573763 996dnl Disable "unlinkd" code
fe0810ac 997AC_ARG_ENABLE(unlinkd,
998[ --disable-unlinkd Do not use unlinkd],
999[ if test "$enableval" = "no" ; then
3c573763 1000 use_unlinkd=no
fe0810ac 1001 else
3c573763 1002 use_unlinkd=yes
fe0810ac 1003 fi
1004],[
1005 # Here we should probably use some magic depending on the selected
1006 # storage models
3c573763 1007 use_unlinkd=yes
fe0810ac 1008])
3c573763 1009if test "$use_unlinkd" = "yes"; then
fe0810ac 1010 echo "unlinkd enabled"
1011 AC_DEFINE(USE_UNLINKD)
a2794549 1012 AM_CONDITIONAL(ENABLE_UNLINKD, true)
fe0810ac 1013else
1014 echo "unlinkd disabled"
a2794549 1015 AM_CONDITIONAL(ENABLE_UNLINKD, false)
fe0810ac 1016fi
fe0810ac 1017
ce3d30fb 1018dnl Enable backtraces on fatal errors
1019AC_ARG_ENABLE(stacktraces,
1020[ --enable-stacktraces Enable automatic call backtrace on fatal errors],
1021[ if test "$enableval" = "yes" ; then
1022 echo "Enabling automatic stack backtraces on fatal errors"
1023 AC_DEFINE(PRINT_STACK_TRACE, 1)
1024 fi
1025])
1026
f66a9ef4 1027dnl Enable X-Accelerator-Vary for Vary support within an accelerator setup
1028AC_ARG_ENABLE(x_accelerator_vary,
0961c811 1029[ --enable-x-accelerator-vary
1030 Enable support for the X-Accelerator-Vary
1031 HTTP header. Can be used to indicate
1032 variance within an accelerator setup.
1033 Typically used together with other code
1034 that adds custom HTTP headers to the requests.],
f66a9ef4 1035[ if test "$enableval" = "yes" ; then
1036 echo "Enabling support for X-Accelerator-Vary"
1037 AC_DEFINE(X_ACCELERATOR_VARY, 1)
1038 fi
1039])
1040
fd9aaa3e 1041# Force some compilers to use ANSI features
1042#
1043case "$host" in
1044 alpha-dec-osf*)
1045 if test "$ac_cv_prog_CC" = "cc" ; then
1046 echo "adding '-std1' to cc args for $host"
1047 CC="cc -std1";
1048 ac_cv_prog_CC="$CC"
1049 fi
1050 ;;
c68e9c6b 1051 *-hp-hpux*)
1052 if test "$ac_cv_prog_CC" = "cc" ; then
1053 echo "adding '-Ae' to cc args for $host"
1054 CC="cc -Ae";
1055 ac_cv_prog_CC="$CC"
1056 fi
1057 ;;
fd9aaa3e 1058esac
1059
090089c4 1060dnl Check for programs
1061AC_PROG_CPP
1062AC_PROG_INSTALL
1063AC_PROG_RANLIB
1064AC_PROG_LN_S
81280a96 1065AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 1066AC_PATH_PROG(FALSE, false, /usr/bin/false)
1067AC_PATH_PROG(TRUE, true, /usr/bin/true)
1068AC_PATH_PROG(RM, rm, $FALSE)
1069AC_PATH_PROG(MV, mv, $FALSE)
1070AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 1071AC_PATH_PROG(LN, ln, cp)
4e9d8e26 1072AC_PATH_PROG(PERL, perl, none)
a2794549 1073dnl automake handles this AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 1074AC_PATH_PROG(AR, ar, $FALSE)
1075
4e9d8e26 1076if test "$ac_cv_path_PERL" = "none"; then
1077 echo "Perl is required to compile Squid"
1078 echo "Please install Perl and then re-run configure"
1079 exit 1
1080fi
1081
6ad85e8a 1082case "$host" in
1083 *-hp-hpux*)
1084 echo "Disabling 'ranlib' for HP-UX..."
1085 RANLIB=":"
1086 ;;
1087esac
1088
1089dnl set $(AR)
1090AR_R="$AR r"
1091case "$host" in
1092 *-next-nextstep3)
1093 AR="libtool -o"
1094 ;;
1095esac
1096AC_SUBST(AR_R)
090089c4 1097
1098dnl Check for headers
1099AC_HEADER_DIRENT
1100AC_HEADER_STDC
db40ae20 1101
1102AC_CHECK_HEADERS( \
db40ae20 1103 arpa/inet.h \
30a4f2a8 1104 arpa/nameser.h \
9441aa34 1105 assert.h \
db40ae20 1106 bstring.h \
db40ae20 1107 crypt.h \
30a4f2a8 1108 ctype.h \
1109 errno.h \
ce3d30fb 1110 execinfo.h \
db40ae20 1111 fcntl.h \
9c1d8929 1112 getopt.h \
88738790 1113 gnumalloc.h \
30a4f2a8 1114 grp.h \
5cafc1d6 1115 ip_compat.h \
42b51993 1116 ip_fil_compat.h \
5cafc1d6 1117 ip_fil.h \
1118 ip_nat.h \
30a4f2a8 1119 libc.h \
6ad85e8a 1120 limits.h \
d852fbad 1121 linux/netfilter_ipv4.h \
30a4f2a8 1122 malloc.h \
e0bddc45 1123 math.h \
db40ae20 1124 memory.h \
b075cbb1 1125 mount.h \
5cafc1d6 1126 net/if.h \
30a4f2a8 1127 netdb.h \
c415c128 1128 netinet/if_ether.h \
db40ae20 1129 netinet/in.h \
30a4f2a8 1130 netinet/tcp.h \
eb824054 1131 netinet/ip_compat.h \
42b51993 1132 netinet/ip_fil_compat.h \
eb824054 1133 netinet/ip_fil.h \
1134 netinet/ip_nat.h \
1f7c9178 1135 openssl/err.h \
1136 openssl/md5.h \
1137 openssl/ssl.h \
dcfe6390 1138 poll.h \
30a4f2a8 1139 pwd.h \
1140 regex.h \
1141 resolv.h \
c68e9c6b 1142 sched.h \
30a4f2a8 1143 signal.h \
1144 stdarg.h \
1145 stddef.h \
1146 stdio.h \
db40ae20 1147 stdlib.h \
1148 string.h \
1149 strings.h \
1150 sys/file.h \
5cafc1d6 1151 sys/ioctl.h \
0343b99c 1152 sys/mount.h \
ebb3c3ba 1153 sys/msg.h \
30a4f2a8 1154 sys/param.h \
1155 sys/resource.h \
db40ae20 1156 sys/select.h\
30a4f2a8 1157 sys/socket.h \
1158 sys/stat.h \
b075cbb1 1159 sys/statvfs.h \
3c641669 1160 syscall.h \
30a4f2a8 1161 sys/syscall.h \
db40ae20 1162 sys/time.h \
1163 sys/types.h \
30a4f2a8 1164 sys/un.h \
b075cbb1 1165 sys/vfs.h \
30a4f2a8 1166 sys/wait.h \
db40ae20 1167 syslog.h \
30a4f2a8 1168 time.h \
1169 unistd.h \
3c641669 1170 utime.h \
30a4f2a8 1171 varargs.h \
77d6bd88 1172 byteswap.h \
1173 glib.h \
60d096f4 1174 stdint.h \
1175 inttypes.h \
3c641669 1176 grp.h \
1177 nss_common.h \
1178 nss.h
db40ae20 1179)
1180
aee0606f 1181AC_C_CONST
d57288d2 1182AC_C_BIGENDIAN
aee0606f 1183
5c51415d 1184AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
1185 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
1186 [foo("bar")],
1187 ac_cv_have_ansi_prototypes="yes",
1188 ac_cv_have_ansi_prototypes="no")
1189])
1190if test $ac_cv_have_ansi_prototypes = "yes" ; then
1191 AC_DEFINE(HAVE_ANSI_PROTOTYPES)
1192fi
20a50bb9 1193
5c51415d 1194AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [
1195 AC_TRY_COMPILE([#include <time.h>
46c883ed 1196#include <sys/time.h>],
5c51415d 1197 [struct tm foo;
1198 foo.tm_gmtoff = 0;],
1199 ac_cv_have_tm_gmoff="yes",
1200 ac_cv_have_tm_gmoff="no")
1201])
1202if test $ac_cv_have_tm_gmoff = "yes" ; then
1203 AC_DEFINE(HAVE_TM_GMTOFF)
1204fi
46c883ed 1205
eb824054 1206AC_CACHE_CHECK(for struct mallinfo,ac_cv_have_struct_mallinfo, [
1207 AC_TRY_COMPILE([#include <sys/types.h>
1208#if HAVE_MALLOC_H
1209#include <malloc.h>
1210#endif],
1211 [struct mallinfo foo;
1212 foo.arena = 0;
1213 foo.ordblks = 0;
1214 foo.smblks = 0;
1215 foo.hblks = 0;
1216 foo.hblkhd = 0;
1217 foo.uordblks = 0;
1218 foo.fordblks = 0;
1219 foo.keepcost = 0;],
1220 ac_cv_have_struct_mallinfo="yes",
1221 ac_cv_have_struct_mallinfo="no")
1222])
1223if test $ac_cv_have_struct_mallinfo = "yes" ; then
1224 AC_DEFINE(HAVE_STRUCT_MALLINFO)
1225fi
1226
5c51415d 1227AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [
1228 AC_TRY_COMPILE([#include <sys/types.h>
46c883ed 1229#include <malloc.h>],
5c51415d 1230 [struct mallinfo foo;
1231 foo.mxfast = 0;],
1232 ac_cv_have_ext_mallinfo="yes",
1233 ac_cv_have_ext_mallinfo="no")
1234])
1235if test $ac_cv_have_ext_mallinfo = "yes" ; then
1236 AC_DEFINE(HAVE_EXT_MALLINFO)
1237fi
090089c4 1238
b54a6789 1239AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [
1240 AC_TRY_COMPILE([
8ff51bba 1241#if HAVE_SYS_TIME_H
1242#include <sys/time.h>
1243#endif
b54a6789 1244#if HAVE_SYS_RESOURCE_H
1245#include <sys/resource.h>
1246#endif],
1247 [struct rusage R;],
1248 ac_cv_have_struct_rusage="yes",
1249 ac_cv_have_struct_rusage="no")
1250])
1251if test $ac_cv_have_struct_rusage = "yes" ; then
1252 AC_DEFINE(HAVE_STRUCT_RUSAGE)
1253fi
1254
5c51415d 1255AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [
1256 AC_TRY_COMPILE([#include <sys/types.h>
a025a745 1257#include <netinet/in.h>
1258#include <netinet/in_systm.h>
6ad85e8a 1259#include <netinet/ip.h>
b05490a8 1260#if defined (__linux__) || defined (__CYGWIN__)
6ad85e8a 1261#define ip_hl ihl
1262#endif
1263#ifndef __linux__
b05490a8 1264#ifndef __CYGWIN__
6ad85e8a 1265#define iphdr ip
b05490a8 1266#endif
6ad85e8a 1267#endif],
5c51415d 1268 [struct iphdr ip;
1269 ip.ip_hl= 0;],
1270 ac_cv_have_ip_hl="yes",
1271 ac_cv_have_ip_hl="no")
1272])
1273if test $ac_cv_have_ip_hl = "yes" ; then
1274 AC_DEFINE(HAVE_IP_HL)
1275fi
a025a745 1276
090089c4 1277dnl Check for typedefs
77d6bd88 1278AC_CHECK_SIZEOF(void *)
1279AC_CHECK_SIZEOF(short)
090089c4 1280AC_CHECK_SIZEOF(int)
1281AC_CHECK_SIZEOF(long)
77d6bd88 1282AC_CHECK_SIZEOF(long long)
1283AC_CHECK_SIZEOF(__int64)
1284AC_CHECK_SIZEOF(int16_t)
1285AC_CHECK_SIZEOF(uint16_t)
1286AC_CHECK_SIZEOF(u_int16_t)
1287AC_CHECK_SIZEOF(int32_t)
1288AC_CHECK_SIZEOF(uint32_t)
1289AC_CHECK_SIZEOF(u_int32_t)
1290AC_CHECK_SIZEOF(int64_t)
1291AC_CHECK_SIZEOF(uint64_t)
1292AC_CHECK_SIZEOF(u_int64_t)
1293
1294dnl int16_t
1295if test "x$ac_cv_sizeof_short" = "x2"; then
1296 AC_CHECK_TYPE(int16_t,short)
1297elif test "x$ac_cv_sizeof_int" = "x2"; then
1298 AC_CHECK_TYPE(int16_t,int)
1299fi
1300dnl u_int16t_t
1301if test "x$ac_cv_sizeof_uint16_t" = "x2"; then
1302 AC_CHECK_TYPE(u_int16_t,uint16_t)
1303elif test "x$ac_cv_sizeof_short" = "x2"; then
1304 AC_CHECK_TYPE(u_int16_t,unsigned short)
1305elif test "x$ac_cv_sizeof_int" = "x2"; then
1306 AC_CHECK_TYPE(u_int16_t,unsigned int)
1307fi
1308dnl int32_t
1309if test "x$ac_cv_sizeof_int" = "x4"; then
1310 AC_CHECK_TYPE(int32_t,int)
1311elif "x$ac_cv_sizeof_long" = "x4"; then
1312 AC_CHECK_TYPE(int32_t,long)
1313fi
1314dnl u_int32_t
1315if test "x$ac_cv_sizeof_uint32_t" = "x4"; then
1316 AC_CHECK_TYPE(u_int32_t,uint32_t)
1317elif test "x$ac_cv_sizeof_int" = "x4"; then
1318 AC_CHECK_TYPE(u_int32_t,unsigned int)
1319elif test "x$ac_cv_sizeof_long" = "x4"; then
1320 AC_CHECK_TYPE(u_int32_t,unsigned long)
1321fi
1322dnl int64_t
1323if test "x$ac_cv_sizeof_long" = "x8"; then
1324 AC_CHECK_TYPE(int64_t,long)
1325elif test "x$ac_cv_sizeof_long_long" = "x8"; then
1326 AC_CHECK_TYPE(int64_t,long long)
1327elif test "x$ac_cv_sizeof___int64" = "x8"; then
1328 AC_CHECK_TYPE(int64_t,__int64)
1329fi
1330dnl u_int64_t
1331if test "x$ac_cv_sizeof_uint64_t" = "x8"; then
1332 AC_CHECK_TYPE(u_int64_t,uint64_t)
1333elif test "x$ac_cv_sizeof_long" = "x8"; then
1334 AC_CHECK_TYPE(u_int64_t,unsigned long)
1335elif test "x$ac_cv_sizeof_long_long" = "x8"; then
1336 AC_CHECK_TYPE(u_int64_t,unsigned long long)
1337elif test "x$ac_cv_sizeof___int64" = "x8"; then
1338 AC_CHECK_TYPE(int64_t,unsigned __int64)
1339fi
090089c4 1340
3f6fcd8a 1341AC_CHECK_TYPE(pid_t, int)
0897af2d 1342AC_CHECK_TYPE(size_t, unsigned int)
1343AC_CHECK_TYPE(ssize_t, int)
3f6fcd8a 1344AC_CHECK_TYPE(off_t, int)
95cf2361 1345AC_CHECK_TYPE(mode_t, u_short)
c716a1dd 1346AC_CHECK_TYPE(fd_mask, int)
3f6fcd8a 1347
77d6bd88 1348dnl Check for special functions
1349AC_FUNC_ALLOCA
1350
1351
6637e3a5 1352dnl Check for type in sys/socket.h
1353AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
1354 AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
1355#include <sys/socket.h>
1356#if STDC_HEADERS
1357#include <stdlib.h>
1358#include <stddef.h>
1359#endif],
1360 ac_cv_type_socklen_t=yes,
1361 ac_cv_type_socklen_t=no)
1362])
1363if test $ac_cv_type_socklen_t = no; then
1364 AC_DEFINE(socklen_t, int)
1365fi
1366
aea1be68 1367dnl Check for mtyp_t in some headers
1368AC_CACHE_CHECK(for mtyp_t, ac_cv_type_mtyp_t, [
1369 AC_EGREP_CPP([mtyp_t[^a-zA-Z_0-9]], [#include <sys/types.h>
1370#include <sys/ipc.h>
1371#include <sys/msg.h>],
1372 ac_cv_type_mtyp_t=yes,
1373 ac_cv_type_mtyp_t=no)
1374])
1375if test $ac_cv_type_mtyp_t = no; then
1376 AC_DEFINE(mtyp_t, long)
1377 fi
1378
090089c4 1379dnl Check for needed libraries
30a4f2a8 1380AC_CHECK_LIB(nsl, main)
6716b242 1381AC_CHECK_LIB(socket, main)
94d48591 1382
3c641669 1383dnl Ripped from the Samba sources
1384AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [
1385 AC_TRY_COMPILE([
1386#include <sys/types.h>
1387#include <stdlib.h>
1388#include <stddef.h>
1389#include <sys/socket.h>
1390#include <sys/un.h>],
1391[
1392 struct sockaddr_un sunaddr;
1393 sunaddr.sun_family = AF_UNIX;
1394],
1395 squid_cv_unixsocket=yes,squid_cv_unixsocket=no)])
1396if test x"$squid_cv_unixsocket" = x"yes"; then
1397 AC_DEFINE(HAVE_UNIXSOCKET)
1398fi
1399dnl end rip
1400
94d48591 1401if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
1402 echo "skipping libmalloc check (--enable-dlmalloc specified)"
5c51415d 1403else
94d48591 1404 AC_CHECK_LIB(gnumalloc, main)
1405 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
1406 echo "Disabling extended malloc functions when using gnumalloc"
1407 ac_cv_func_mallinfo=no
1408 ac_cv_func_mallocblksize=no
1409 ac_cv_func_mallopt=no
1410 else
1411 case "$host" in
1412 *-sun-solaris*)
1413 echo "skipping libmalloc check for $host"
1414 ;;
1415 i386-*-freebsd*)
1416 echo "skipping libmalloc check for $host"
1417 ;;
1418 *)
1419
1420 AC_CHECK_LIB(malloc, main)
1421 ;;
1422 esac
1423 fi
8a15e65e 1424fi
94d48591 1425
6716b242 1426AC_CHECK_LIB(bsd, main)
be79ade0 1427AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 1428AC_CHECK_LIB(bind, gethostbyname)
1429if test $ac_cv_lib_bind_gethostbyname = "no" ; then
1430 case "$host" in
78743365 1431 i386-*-freebsd*)
1432 echo "skipping libresolv checks for $host"
1433 ;;
1434 *)
1435 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
1436 AC_CHECK_LIB(resolv, main)
1437 ;;
04a56fa3 1438 esac
1439fi
e0bddc45 1440AC_CHECK_LIB(m, main)
090089c4 1441
1442dnl Check for libcrypt
b8de7ebe 1443dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
042b1f8a 1444AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
be79ade0 1445AC_SUBST(CRYPTLIB)
77f675ad 1446
042b1f8a 1447dnl Check for libdl, used by auth_modules/PAM
1448AC_CHECK_LIB(dl, dlopen, [DLLIB="-ldl"])
1449AC_SUBST(DLLIB)
1450
e5f4e1b0 1451dnl Check for pthreads
1452dnl We use pthreads when doing ASYNC I/O
042b1f8a 1453AC_CHECK_LIB(pthread, main, [PTHREADLIB="-lpthread"])
71f8abc8 1454AC_SUBST(PTHREADLIB)
1455
f85c88f3 1456dnl Check for librt
1457dnl We use AIO in the coss store
1458AC_CHECK_LIB(rt, aio_read, [AIOLIB="-lrt"])
1459AC_SUBST(AIOLIB)
1460
86ec11aa 1461dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
1462dnl Robert Side <rside@aiinc.bc.ca>
1463dnl Mon, 18 Jan 1999 17:48:00 GMT
1464case "$host" in
1465 *-pc-sco3.2*)
1466 AC_CHECK_LIB(intl, strftime)
1467 ;;
1468esac
1469
77f675ad 1470dnl System-specific library modifications
1471dnl
1472case "$host" in
88738790 1473 i386-*-solaris2.*)
7149a49f 1474 if test "$GCC" = "yes"; then
1475 echo "Removing -O for gcc on $host"
80e92d6d 1476 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 1477 fi
1478 ;;
77f675ad 1479 *-sgi-irix*)
1480 echo "Removing -lsocket for IRIX..."
6716b242 1481 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 1482 echo "Removing -lnsl for IRIX..."
6716b242 1483 LIBS=`echo $LIBS | sed -e s/-lnsl//`
c415c128 1484 ac_cv_lib_nsl_main=no
b44c0fb4 1485 echo "Removing -lbsd for IRIX..."
1486 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 1487 ;;
4ba0bd0e 1488dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
1489dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
1490dnl Please change your configure script. AIX doesn't need -lbsd.
1491 *-ibm-aix*)
1492 echo "Removing -lbsd for AIX..."
1493 LIBS=`echo $LIBS | sed -e s/-lbsd//`
c68e9c6b 1494dnl From: mlaster@metavillage.com (Mike Laster)
1495dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
1496dnl So using the internal versions generates a load of warnings
1497dnl during compile.
1498 echo "disabling snprintf/vsnprintf for $host"
1499 ac_cv_func_snprintf=no
1500 ac_cv_func_vsnprintf=no
4ba0bd0e 1501 ;;
30a4f2a8 1502 *m88k*)
1503 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
7149a49f 1504 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
1505 ;;
580ce039 1506 [*-*-solaris2.[0-4]])
7149a49f 1507 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
30a4f2a8 1508 ;;
711fa75e 1509 [*-sony-newsos[56]*])
f62c73dc 1510 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
1511 ;;
77f675ad 1512esac
090089c4 1513
57faa85a 1514# Remove optimization for GCC 2.95.[123]
d20b1cd0 1515# gcc -O[2] on *BSD and Linux (x86) causes pointers to magically become NULL
1516if test "$GCC" = "yes"; then
1517 GCCVER=`$CC -v 2>&1 | awk '$2 == "version" {print $3}'`
1518 case "$GCCVER" in
57faa85a 1519 [2.95.[123]])
d20b1cd0 1520 echo "Removing -O for gcc on $host with GCC $GCCVER"
1521 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
1522 ;;
1523 esac
1524fi
1525
176d10ee 1526# Recommended by Balint Nagy Endre <bne@CareNet.hu>
1527case "$host" in
1528 *-univel-sysv4.2MP)
1529 if test `uname -v` = "2.03"; then
1530 echo "disabling mallinfo for $host"
1531 ac_cv_func_mallinfo=no
1532 fi
1533 ;;
1534esac
1535
84cecfd2 1536dnl This has to be before AC_CHECK_FUNCS
1537# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
1538# when running configure.
1539if test -z "$ac_cv_func_poll"; then
1540 case "$host" in
1541 [alpha-dec-osf3.*])
1542 # John Kay (jkay@nlanr.net) 19970818
1543 echo "disabling poll for $host..."
1544 ac_cv_func_poll='no'
1545 ;;
1546 [*-hp-hpux*.*])
1547 # Duane Wessels
1548 echo "disabling poll for $host..."
1549 ac_cv_func_poll='no'
1550 ;;
1551 [*-linux-*])
f5cec332 1552 # Henrik Nordstrom (hno@squid-cache.org) 19980817
9bb83c8b 1553 # poll is problematic on Linux. We disable it
1554 # by default until Linux gets it right.
b6a2f15e 1555 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
1556 if test $rev -lt 002002; then
1557 echo "disabling poll for $host < 2.2..."
1558 ac_cv_func_poll='no'
1559 fi
84cecfd2 1560 ;;
c68e9c6b 1561 [powerpc-ibm-aix4.1.*])
1562 # Mike Laster (mlaster@metavillage.com) 19981021
1563 echo "disabling poll for $host..."
1564 ac_cv_func_poll='no'
1565 ;;
86ec11aa 1566 [*-pc-sco3.2*])
1567 # Robert Side <rside@aiinc.bc.ca>
1568 # Mon, 18 Jan 1999 17:48:00 GMT
1569 echo "disabling poll for $host..."
1570 ac_cv_func_poll='no'
1571 ;;
84cecfd2 1572 esac
1573fi
176d10ee 1574
6716b242 1575dnl Check for library functions
1576AC_CHECK_FUNCS(\
30a4f2a8 1577 bcopy \
ce3d30fb 1578 backtrace_symbols_fd \
df087e68 1579 crypt \
4ac29a5b 1580 fchmod \
6716b242 1581 getdtablesize \
8505e57b 1582 getpagesize \
30a4f2a8 1583 getrusage \
9c1d8929 1584 getspnam \
30a4f2a8 1585 lrand48 \
6716b242 1586 mallinfo \
0f5efab0 1587 mallocblksize \
6716b242 1588 mallopt \
2ae6b9b0 1589 memcpy \
30a4f2a8 1590 memmove \
dac27377 1591 memset \
b99a6dec 1592 mkstemp \
1812b6c7 1593 mktime \
88738790 1594 mstats \
84cecfd2 1595 poll \
cd748f27 1596 pthread_attr_setscope \
1597 pthread_setschedparam \
1598 pthread_attr_setschedparam \
42b51993 1599 pthread_sigmask \
c68e9c6b 1600 putenv \
b1e77ec1 1601 random \
6716b242 1602 regcomp \
1603 regexec \
1604 regfree \
30a4f2a8 1605 res_init \
4915be3b 1606 rint \
234967c9 1607 seteuid \
c415c128 1608 setgroups \
30a4f2a8 1609 setpgrp \
6716b242 1610 setrlimit \
b6a2f15e 1611 getrlimit \
30a4f2a8 1612 setsid \
1613 sigaction \
11430c03 1614 snprintf \
30a4f2a8 1615 srand48 \
b1e77ec1 1616 srandom \
0343b99c 1617 statfs \
6716b242 1618 sysconf \
1619 syslog \
234967c9 1620 timegm \
28da5e0d 1621 vsnprintf \
77d6bd88 1622 bswap_16 \
1623 bswap_32 \
6716b242 1624)
1625
1b3db6d9 1626dnl Magic which checks whether we are forcing a type of comm loop we
1627dnl are actually going to (ab)use
1628
1629dnl Actually do the define magic now
1630dnl mostly ripped from squid-commloops, thanks to adrian and benno
1631
1632if test "$ac_cv_func_poll" = "yes" ; then
1633 SELECT_TYPE="poll"
1634 AC_DEFINE(USE_POLL)
1635elif test "$ac_cv_func_select" = "yes" ; then
1636 SELECT_TYPE="select"
1637 AC_DEFINE(USE_SELECT)
92b9f1fd 1638elif test "$ac_cv_func_kqueue" = "yes" ; then
1639 SELECT_TYPE="kqueue"
1640 AC_DEFINE(USE_KQUEUE)
1b3db6d9 1641else
92b9f1fd 1642 echo "Eep! Can't find poll, kqueue or select!"
1b3db6d9 1643 echo "I'll try select and hope for the best."
1644 SELECT_TYPE="select"
1645 AC_DEFINE(USE_SELECT)
1646fi
1647echo "Using ${SELECT_TYPE} for select loop."
1b3db6d9 1648
1649
60939927 1650dnl Yay! Another Linux brokenness. Its not good enough
1651dnl to know that setresuid() exists, because RedHat 5.0 declares
1652dnl setresuid() but doesn't implement it.
1653dnl
1654AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 1655 AC_TRY_RUN([
60939927 1656#include <stdlib.h>
5c51415d 1657 int main() {
1658 if(setresuid(-1,-1,-1)) {
1659 perror("setresuid:");
1660 exit(1);
60939927 1661 }
1662 exit(0);
5c51415d 1663 }
1664 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 1665)
5c51415d 1666if test "$ac_cv_func_setresuid" = "yes" ; then
1667 AC_DEFINE(HAVE_SETRESUID)
1668fi
60939927 1669
c3d0c8b5 1670AM_CONDITIONAL(NEED_OWN_SNPRINTF, false)
1671if test "$ac_cv_func_snprintf" = "no" || test "$ac_cv_func_vsnprintf" = "no" ; then
1672 AM_CONDITIONAL(NEED_OWN_SNPRINTF, true)
1673fi
1674
5cafc1d6 1675dnl IP-Filter support requires ipf header files. These aren't
1676dnl installed by default, so we need to check for them
1677if test "$IPF_TRANSPARENT" ; then
1678 AC_MSG_CHECKING(if IP-Filter header files are installed)
42b51993 1679 # hold on to your hats...
1680 if test "$ac_cv_header_ip_compat_h" = "yes" ||
1681 test "$ac_cv_header_ip_fil_compat_h" = "yes" ||
87d21d8b 1682 test "$ac_cv_header_netinet_ip_compat_h" = "yes" ||
1683 test "$ac_cv_header_netinet_ip_fil_compat_h" = "yes" ; then
42b51993 1684 have_ipfilter_compat_header="yes"
1685 fi
1686 if test "x$have_ipfilter_compat_header" = "xyes" &&
eb824054 1687 test "$ac_cv_header_ip_fil_h" = "yes" &&
1688 test "$ac_cv_header_ip_nat_h" = "yes" ; then
1689 IPF_TRANSPARENT="yes"
1690 AC_DEFINE(IPF_TRANSPARENT, 1)
42b51993 1691 elif test "$have_ipfilter_compat_header" = "yes" &&
eb824054 1692 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
1693 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
1694 IPF_TRANSPARENT="yes"
1695 AC_DEFINE(IPF_TRANSPARENT, 1)
1696 else
5cafc1d6 1697 IPF_TRANSPARENT="no"
1698 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 1699 fi
1700 AC_MSG_RESULT($IPF_TRANSPARENT)
1701fi
1702if test "$IPF_TRANSPARENT" = "no" ; then
1703 echo "WARNING: Cannot find necessary IP-Filter header files"
1704 echo " Transparent Proxy support WILL NOT be enabled"
1705 sleep 10
1706fi
1707
d852fbad 1708dnl Linux-Netfilter support requires Linux 2.4 kernel header files.
1709dnl Shamelessly copied from above
1710if test "$LINUX_NETFILTER" ; then
1711 AC_MSG_CHECKING(if Linux 2.4 kernel header files are installed)
1712 # hold on to your hats...
1713 if test "$ac_cv_header_linux_netfilter_ipv4_h" = "yes"; then
1714 LINUX_NETFILTER="yes"
1715 AC_DEFINE(LINUX_NETFILTER, 1)
1716 else
1717 LINUX_NETFILTER="no"
1718 AC_DEFINE(LINUX_NETFILTER, 0)
1719 fi
1720 AC_MSG_RESULT($LINUX_NETFILTER)
1721fi
1722if test "$LINUX_NETFILTER" = "no" ; then
1723 echo "WARNING: Cannot find necessary Linux 2.4 kernel header files"
1724 echo " Linux 2.4 Transparent Proxy support WILL NOT be enabled"
1725 sleep 10
1726fi
1727
91bc414e 1728if test -z "$USE_GNUREGEX" ; then
1729 case "$host" in
1730 *-sun-solaris2.[[0-4]])
1731 USE_GNUREGEX="yes"
1732 ;;
1733 *-next-nextstep*)
1734 USE_GNUREGEX="yes"
1735 ;;
1736 esac
1737fi
7a081912 1738AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 1739if test -z "$USE_GNUREGEX"; then
55878dfd 1740if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 1741 USE_GNUREGEX="yes"
00fa2c12 1742else
0cccc031 1743 AC_TRY_COMPILE([#include <sys/types.h>
1744#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 1745 USE_GNUREGEX="no",
1746 USE_GNUREGEX="yes")
1747fi
00fa2c12 1748fi
74946a0f 1749AC_MSG_RESULT($USE_GNUREGEX)
1750if test "$USE_GNUREGEX" = "yes"; then
26675bf4 1751 REGEXLIB="-lregex"
7a081912 1752 LIBREGEX="libregex.a"
74946a0f 1753 AC_DEFINE(USE_GNUREGEX)
7a081912 1754fi
26675bf4 1755AC_SUBST(REGEXLIB)
00fa2c12 1756AC_SUBST(LIBREGEX)
7a081912 1757
3f6fcd8a 1758AC_REPLACE_FUNCS(\
3d0cf10e 1759 drand48 \
3f6fcd8a 1760 tempnam \
4d38fc7e 1761 strerror \
3f6fcd8a 1762)
1763
5c51415d 1764dnl Not cached since people are likely to tune this
e924600d 1765AC_MSG_CHECKING(Default FD_SETSIZE value)
1766AC_TRY_RUN([
1767#if HAVE_STDIO_H
1768#include <stdio.h>
1769#endif
1770#if HAVE_UNISTD_H
1771#include <unistd.h>
1772#endif
1773#if HAVE_SYS_TIME_H
1774#include <sys/time.h>
1775#endif
1776#if HAVE_SYS_SELECT_H
1777#include <sys/select.h>
1778#endif
1779#if HAVE_SYS_TYPES_H
1780#include <sys/types.h>
1781#endif
1782main() {
635e6242 1783 FILE *fp = fopen("conftestval", "w");
1784 fprintf (fp, "%d\n", FD_SETSIZE);
e924600d 1785 exit(0);
1786}
1787],
1788DEFAULT_FD_SETSIZE=`cat conftestval`,
1789DEFAULT_FD_SETSIZE=256,
1790DEFAULT_FD_SETSIZE=256)
1791AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
1792AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
1793
5c51415d 1794dnl Not cached since people are likely to tune this
234967c9 1795AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 1796dnl damn! FreeBSD's pthreads breaks dup2().
1797TLDFLAGS="$LDFLAGS"
1798case $host in
1799i386-unknown-freebsd*)
1800 if echo "$LDFLAGS" | grep -q pthread; then
1801 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
1802 fi
1803esac
234967c9 1804AC_TRY_RUN([
8cca06da 1805#include <stdio.h>
234967c9 1806#include <unistd.h>
30a4f2a8 1807#include <sys/time.h> /* needed on FreeBSD */
234967c9 1808#include <sys/param.h>
1809#include <sys/resource.h>
1810main() {
635e6242 1811 FILE *fp;
234967c9 1812 int i,j;
42b51993 1813#if defined(__CYGWIN32__) || defined (__CYGWIN__)
b05490a8 1814 /* getrlimit and sysconf returns bogous values on cygwin32.
df087e68 1815 * Number of fds is virtually unlimited in cygwin (sys/param.h)
b05490a8 1816 * __CYGWIN32__ is deprecated.
df087e68 1817 */
1818 i = NOFILE;
b05490a8 1819#else
1820#if HAVE_SETRLIMIT
234967c9 1821 struct rlimit rl;
1822#if defined(RLIMIT_NOFILE)
1823 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
1824 perror("getrlimit: RLIMIT_NOFILE");
1825 } else {
1826 rl.rlim_cur = rl.rlim_max; /* set it to the max */
1827 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
1828 perror("setrlimit: RLIMIT_NOFILE");
1829 }
1830 }
1831#elif defined(RLIMIT_OFILE)
1832 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
1833 perror("getrlimit: RLIMIT_OFILE");
1834 } else {
1835 rl.rlim_cur = rl.rlim_max; /* set it to the max */
1836 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
1837 perror("setrlimit: RLIMIT_OFILE");
1838 }
1839 }
1840#endif /* RLIMIT_NOFILE */
1841#endif /* HAVE_SETRLIMIT */
d9399075 1842 /* by starting at 2^14, we will never get higher
1843 than 2^15 for SQUID_MAXFD */
1844 i = j = 1<<14;
1845 while (j) {
1846 j >>= 1;
1847 if (dup2(0, i) < 0) {
1848 i -= j;
1849 } else {
1850 close(i);
1851 i += j;
1852 }
1853 }
1854 i++;
b05490a8 1855#endif /* IF !DEF CYGWIN */
635e6242 1856 fp = fopen("conftestval", "w");
1857 fprintf (fp, "%d\n", i);
234967c9 1858 exit(0);
1859}
1860],
431d84c5 1861SQUID_MAXFD=`cat conftestval`,
1862SQUID_MAXFD=256,
1863SQUID_MAXFD=256)
1864AC_MSG_RESULT($SQUID_MAXFD)
1865AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
b9cc811d 1866if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 1867 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
1868 echo " cache will be very busy. Please see the FAQ page"
2b6662ba 1869 echo " http://www.squid-cache.org/FAQ/FAQ-11.html#filedescriptors"
e692ff35 1870 echo " on how to increase your filedescriptor limit"
933cc58d 1871 sleep 10
80ab193b 1872fi
c76d8acc 1873LDFLAGS="$TLDFLAGS"
234967c9 1874
5c51415d 1875dnl Not cached since people are likely to tune this
30a4f2a8 1876AC_MSG_CHECKING(Default UDP send buffer size)
1877AC_TRY_RUN([
8cca06da 1878#include <stdlib.h>
1879#include <stdio.h>
30a4f2a8 1880#include <sys/types.h>
1881#include <sys/socket.h>
1882#include <netinet/in.h>
1883main ()
1884{
635e6242 1885 FILE *fp;
30a4f2a8 1886 int fd,val=0,len=sizeof(int);
1887 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
1888 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
1889 if (val<=0) exit(1);
635e6242 1890 fp = fopen("conftestval", "w");
1891 fprintf (fp, "%d\n", val);
30a4f2a8 1892 exit(0);
1893}
1894],
1895SQUID_UDP_SO_SNDBUF=`cat conftestval`,
1c481e00 1896SQUID_UDP_SO_SNDBUF=16384,
1897SQUID_UDP_SO_SNDBUF=16384)
30a4f2a8 1898AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
1899AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
1900
5c51415d 1901dnl Not cached since people are likely to tune this
30a4f2a8 1902AC_MSG_CHECKING(Default UDP receive buffer size)
1903AC_TRY_RUN([
8cca06da 1904#include <stdlib.h>
1905#include <stdio.h>
30a4f2a8 1906#include <sys/types.h>
1907#include <sys/socket.h>
1908#include <netinet/in.h>
1909main ()
1910{
635e6242 1911 FILE *fp;
30a4f2a8 1912 int fd,val=0,len=sizeof(int);
1913 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
1914 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1915 if (val <= 0) exit(1);
635e6242 1916 fp = fopen("conftestval", "w");
1917 fprintf (fp, "%d\n", val);
30a4f2a8 1918 exit(0);
1919}
1920],
1921SQUID_UDP_SO_RCVBUF=`cat conftestval`,
1c481e00 1922SQUID_UDP_SO_RCVBUF=16384,
1923SQUID_UDP_SO_RCVBUF=16384)
30a4f2a8 1924AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
1925AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
1926
5c51415d 1927dnl Not cached since people are likely to tune this
30a4f2a8 1928AC_MSG_CHECKING(Default TCP send buffer size)
1929AC_TRY_RUN([
8cca06da 1930#include <stdlib.h>
1931#include <stdio.h>
30a4f2a8 1932#include <sys/types.h>
1933#include <sys/socket.h>
1934#include <netinet/in.h>
1935main ()
1936{
635e6242 1937 FILE *fp;
30a4f2a8 1938 int fd,val=0,len=sizeof(int);
1939 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1940 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
1941 if (val <= 0) exit(1);
635e6242 1942 fp = fopen("conftestval", "w");
1943 fprintf (fp, "%d\n", val);
30a4f2a8 1944 exit(0);
1945}
1946],
1947SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 1948SQUID_TCP_SO_SNDBUF=16384,
1949SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 1950AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
1951AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
1952
5c51415d 1953dnl Not cached since people are likely to tune this
30a4f2a8 1954AC_MSG_CHECKING(Default TCP receive buffer size)
1955AC_TRY_RUN([
8cca06da 1956#include <stdlib.h>
1957#include <stdio.h>
30a4f2a8 1958#include <sys/types.h>
1959#include <sys/socket.h>
1960#include <netinet/in.h>
1961main ()
1962{
635e6242 1963 FILE *fp;
30a4f2a8 1964 int fd,val=0,len=sizeof(int);
1965 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1966 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1967 if (val <= 0) exit(1);
635e6242 1968 fp = fopen("conftestval", "w");
1969 fprintf (fp, "%d\n", val);
30a4f2a8 1970 exit(0);
1971}
1972],
1973SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 1974SQUID_TCP_SO_RCVBUF=16384,
1975SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 1976AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
1977AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
1978
5c51415d 1979AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
9bc73deb 1980 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
5c51415d 1981 ac_cv_needs_sys_errlist="no",
1982 ac_cv_needs_sys_errlist="yes")
1983)
1984if test "$ac_cv_needs_sys_errlist" = "yes" ; then
1985 AC_DEFINE(NEED_SYS_ERRLIST)
1986fi
30a4f2a8 1987
5c51415d 1988dnl Not cached since people are likely to change this
6bf65235 1989AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
1990AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
1991[AC_MSG_RESULT(yes)
1992AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
1993AC_MSG_RESULT(no))
1994
a937d5e3 1995AC_MSG_CHECKING(if inet_ntoa() actually works)
1996AC_TRY_RUN([
1997#include <stdlib.h>
1998#include <stdio.h>
1999#include <sys/types.h>
2000#include <netinet/in.h>
2001#include <arpa/inet.h>
2002main ()
2003{
635e6242 2004 FILE *fp;
a937d5e3 2005 struct in_addr in;
2006 in.s_addr = inet_addr("1.2.3.4");
635e6242 2007 fp = fopen("conftestval", "w");
2008 fprintf (fp, "%s\n", inet_ntoa(in));
a937d5e3 2009 exit(0);
2010}
2011],
2012INET_NTOA_RESULT=`cat conftestval`,
2013INET_NTOA_RESULT="broken",
2014INET_NTOA_RESULT="broken")
2015if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
2016 AC_MSG_RESULT("yes")
2017else
2018 AC_MSG_RESULT("no")
b6a2f15e 2019 echo "Will use our own inet_ntoa()."
2020 LIBOBJS="$LIBOBJS inet_ntoa.o"
2021# echo "WARNING: This looks bad, and probably prevents Squid from working."
2022# echo " If you're on IRIX and using GCC 2.8, you probably need"
2023# echo " to use the IRIX C compiler instead."
2024# sleep 10
a937d5e3 2025fi
2026
b6a2f15e 2027if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 2028AC_MSG_CHECKING(for working statvfs() interface)
2029AC_TRY_COMPILE([
2030#include <stdlib.h>
2031#include <stdio.h>
2032#include <sys/types.h>
2033#include <sys/statvfs.h>
2034],
2035[
2036struct statvfs sfs;
2037sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
2038sfs.f_files = sfs.f_ffree = 0;
2039statvfs("/tmp", &sfs);
2040],
2041 ac_cv_func_statvfs=yes,
2042 ac_cv_func_statvfs=no)
2043AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 2044if test "$ac_cv_func_statvfs" = "yes" ; then
b6a2f15e 2045 AC_DEFINE(HAVE_STATVFS)
2046fi
6b8e7481 2047fi
c68e9c6b 2048
2049AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
2050AC_TRY_COMPILE([
2051#if HAVE_SYS_TYPES_H
2052#include <sys/types.h>
2053#endif
2054#if HAVE_NETINET_IN_H
2055#include <netinet/in.h>
2056#endif
2057#if HAVE_ARPA_INET_H
2058#include <arpa/inet.h>
2059#endif
2060#if HAVE_ARPA_NAMESER_H
2061#include <arpa/nameser.h>
2062#endif
2063#if HAVE_RESOLV_H
2064#include <resolv.h>
2065#endif
2066],
2067[_res.nsaddr_list[[0]];],
2068ac_cv_have_res_nsaddr_list="yes",
2069ac_cv_have_res_nsaddr_list="no"))
2070if test $ac_cv_have_res_nsaddr_list = "yes" ; then
2071 AC_DEFINE(HAVE_RES_NSADDR_LIST)
2072fi
2073
2074if test $ac_cv_have_res_nsaddr_list = "no" ; then
2075AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
2076AC_TRY_COMPILE([
2077#if HAVE_SYS_TYPES_H
2078#include <sys/types.h>
2079#endif
2080#if HAVE_NETINET_IN_H
2081#include <netinet/in.h>
2082#endif
2083#if HAVE_ARPA_INET_H
2084#include <arpa/inet.h>
2085#endif
2086#if HAVE_ARPA_NAMESER_H
2087#include <arpa/nameser.h>
2088#endif
2089#if HAVE_RESOLV_H
2090#include <resolv.h>
2091#endif
2092],
2093[_res.ns_list[[0]].addr;],
2094ac_cv_have_res_ns_list="yes",
2095ac_cv_have_res_ns_list="no"))
2096if test $ac_cv_have_res_ns_list = "yes" ; then
2097 AC_DEFINE(HAVE_RES_NS_LIST)
2098fi
2099fi
2100
090089c4 2101dnl Need the debugging version of malloc if available
2102XTRA_OBJS=''
6509a1a0 2103if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 2104 if test -r /usr/lib/debug/malloc.o ; then
2105 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
2106 fi
2107 if test -r /usr/lib/debug/mallocmap.o ; then
2108 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
2109 fi
2110fi
2bbd722b 2111
090089c4 2112AC_SUBST(XTRA_OBJS)
2113
38fea766 2114if test -z "$XTRA_LIBS"; then
2115 XTRA_LIBS="$LIBS"
0f5a16f8 2116 dnl minor cleanup
2117 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 2118 LIBS=''
2119fi
090089c4 2120AC_SUBST(XTRA_LIBS)
2121
090089c4 2122dnl Clean up after OSF/1 core dump bug
2123rm -f core
2124
a2794549 2125dnl FS_MAKEFILES=""
2126dnl for fs in $STORE_MODULES none; do
2127dnl if test $fs != none; then
2128dnl FS_MAKEFILES="$FS_MAKEFILES ./src/fs/$fs/Makefile"
2129dnl fi
2130dnl done
2131dnl REPL_MAKEFILES=""
2132dnl for repl in $REPL_POLICIES none; do
2133dnl if test $repl != none; then
2134dnl REPL_MAKEFILES="$REPL_MAKEFILES ./src/repl/$repl/Makefile"
2135dnl fi
2136dnl done
caa4f581 2137
63bf42ae 2138dnl This could actually be used to find all the Makefiles..
a2794549 2139dnl One of Automake's limitations is that it needs to know all the created makefiles.
2140dnl AUTH_MAKEFILES=""
2141dnl for auth in `find $srcdir/src/auth -type d -print`; do
2142dnl if test -f $auth/Makefile.in; then
2143dnl dir=`echo $auth | sed -e "s|^$srcdir/||"`
2144dnl AUTH_MAKEFILES="$AUTH_MAKEFILES ./$dir/Makefile"
2145dnl fi
2146dnl done
2147
2148
2149dnl src/fs/aufs/Makefile \
2150dnl src/fs/coss/Makefile \
2151dnl src/fs/diskd/Makefile \
2152dnl src/fs/null/Makefile \
2153dnl src/fs/ufs/Makefile \
2154dnl src/repl/heap/Makefile \
2155dnl src/repl/lru/Makefile \
2156AC_OUTPUT([\
2157 Makefile \
2158 lib/Makefile \
a2794549 2159 scripts/Makefile \
2160 scripts/RunCache \
2161 scripts/RunAccel \
2162 src/Makefile \
2163 src/fs/Makefile \
2164 src/repl/Makefile \
2165 src/auth/Makefile \
2166 src/auth/basic/Makefile \
2167 src/auth/basic/helpers/Makefile \
2168 src/auth/basic/helpers/LDAP/Makefile \
2169 src/auth/basic/helpers/MSNT/Makefile \
2170 src/auth/basic/helpers/NCSA/Makefile \
2171 src/auth/basic/helpers/PAM/Makefile \
2172 src/auth/basic/helpers/SMB/Makefile \
2173 src/auth/basic/helpers/YP/Makefile \
2174 src/auth/basic/helpers/getpwnam/Makefile \
2175 src/auth/basic/helpers/multi-domain-NTLM/Makefile \
4e2c57a0 2176 src/auth/basic/helpers/SASL/Makefile \
a2794549 2177 src/auth/digest/Makefile \
2178 src/auth/digest/helpers/Makefile \
2179 src/auth/digest/helpers/password/Makefile \
2180 src/auth/ntlm/Makefile \
2181 src/auth/ntlm/helpers/Makefile \
2182 src/auth/ntlm/helpers/fakeauth/Makefile \
2183 src/auth/ntlm/helpers/no_check/Makefile \
2184 src/auth/ntlm/helpers/NTLMSSP/Makefile \
2185 src/auth/ntlm/helpers/NTLMSSP/smbval/Makefile \
2186 contrib/Makefile \
2187 snmplib/Makefile \
2188 icons/Makefile \
2189 errors/Makefile \
c0f59984 2190 src/fs/aufs/Makefile \
2191 src/fs/coss/Makefile \
2192 src/fs/diskd/Makefile \
2193 src/fs/null/Makefile \
2194 src/fs/ufs/Makefile \
2195 src/repl/heap/Makefile \
2196 src/repl/lru/Makefile \
99db07b3 2197 doc/Makefile \
53cbe3e4 2198])