]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
DW:
[thirdparty/squid.git] / configure.in
CommitLineData
090089c4 1dnl
2877b8a9 2dnl Configuration input file for Squid
090089c4 3dnl
983061ed 4dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9)
090089c4 5dnl
7e3ce7b9 6dnl $Id: configure.in,v 1.182 1999/12/30 17:35:50 wessels Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
a26bdc75 10AC_INIT(src/main.c)
090089c4 11AC_CONFIG_HEADER(include/autoconf.h)
7e3ce7b9 12AC_REVISION($Revision: 1.182 $)dnl
2877b8a9 13AC_PREFIX_DEFAULT(/usr/local/squid)
71b12d7c 14AC_CONFIG_AUX_DIR(cfgaux)
090089c4 15
88d50a22 16AC_CANONICAL_HOST
17
26675bf4 18CRYPTLIB=''
00fa2c12 19REGEXLIB='' # -lregex
20LIBREGEX='' # libregex.a
090089c4 21
983061ed 22dnl use directory structure of cached as default (hack)
23if test "$libexecdir" = '${exec_prefix}/libexec'; then
24 libexecdir='${bindir}'
25 localstatedir='${prefix}'
26
27fi
28
df087e68 29dnl use .exe suffix for executables on cygwin32 platform
30case "$host_os" in
cd377065 31cygwin32|os2)
df087e68 32 exec_suffix=".exe"
33 cgi_suffix=".exe"
34 ;;
35*)
36 exec_suffix=""
37 cgi_suffix=".cgi"
38 ;;
39esac
40AC_SUBST(exec_suffix)
41AC_SUBST(cgi_suffix)
42
a26bdc75 43if test -z "$CACHE_HTTP_PORT"; then
44 CACHE_HTTP_PORT="3128"
45fi
46if test -z "$CACHE_ICP_PORT"; then
47 CACHE_ICP_PORT="3130"
48fi
a26bdc75 49
090089c4 50dnl Subsitutions
a26bdc75 51AC_SUBST(CACHE_HTTP_PORT)
52AC_SUBST(CACHE_ICP_PORT)
090089c4 53
30a4f2a8 54AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host")
55
56dnl Set default LDFLAGS
57if test -z "$LDFLAGS"; then
58 LDFLAGS="-g"
59fi
60
38fea766 61PRESET_CFLAGS="$CFLAGS"
30a4f2a8 62
090089c4 63dnl Check for GNU cc
64AC_PROG_CC
65
6ad85e8a 66dnl Gerben Wierda <Gerben_Wierda@RnA.nl>
67case "$host" in
68 mab-next-nextstep3)
69 CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc"
70 ;;
71esac
72
30a4f2a8 73dnl Set Default CFLAGS
74if test -z "$PRESET_CFLAGS"; then
75 if test "$GCC" = "yes"; then
76 case "$host" in
97b12a5b 77 *-sun-sunos*)
30a4f2a8 78 # sunos has too many warnings for this to be useful
79 # motorola too
80 ;;
97b12a5b 81 *m88k*)
82 # Motorola cc/ld does not like -02 but is ok on -O
83 CFLAGS=`echo $CFLAGS | sed -e 's/-O[0-9]/-O/'`
84 ;;
30a4f2a8 85 *)
86 CFLAGS="$CFLAGS -Wall"
87 ;;
88 esac
81a820c6 89 else
90 case "$host" in
91 *mips-sgi-irix6.4*)
92 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
93 CFLAGS="$CFLAGS -n32 -mips4 -O3 -OPT:Olimit=0:space=OFF \
94 -woff 1009,1014,1048,1110,1116,1185,1188,1204,1230,1233 \
95 -Wl,-woff,85,-woff,84,-woff,134 \
96 -nostdinc -I/usr/include -D_BSD_SIGNALS"
97 ;;
e8f5fb18 98 alpha-dec-osf4.*)
553c24ae 99 # Mogul says DEC compilers take both -g and -O2
b6a2f15e 100 CFLAGS=`echo $CFLAGS | sed -e 's/-g/-g3/'`
553c24ae 101 CFLAGS="$CFLAGS -O2"
102 ;;
81a820c6 103 *)
104 ;;
105 esac
30a4f2a8 106 fi
30a4f2a8 107fi
108
109dnl Set LDFLAGS
110if test -z "$PRESET_LDFLAGS"; then
111 if test "$GCC" = "yes"; then
112 case "$host" in
113 *)
114 # nothing
115 ;;
116 esac
81a820c6 117 else
118 case "$host" in
119 *mips-sgi-irix6.4*)
120 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
121 LDFLAGS="-n32 -mips4 -nostdlib -L/usr/lib32"
122 ;;
123 esac
30a4f2a8 124 fi
125fi
2060fa9a 126
e5f4e1b0 127dnl Enable optional modules
128AC_ARG_ENABLE(dlmalloc,
94d48591 129[ --enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea],
e5f4e1b0 130[
94d48591 131 case "$enableval" in
132 'yes')
029ce4ae 133 use_dlmalloc="yes"
94d48591 134 LIBDLMALLOC="libdlmalloc.a"
135 LIB_MALLOC="-L../lib -ldlmalloc"
029ce4ae 136 echo "dlmalloc enabled"
94d48591 137 ;;
138 'no')
029ce4ae 139 use_dlmalloc="no"
140 echo "dlmalloc disabled"
94d48591 141 ;;
029ce4ae 142 *) use_dlmalloc="yes"
143 LIB_MALLOC="$enableval"
144 echo "dlmalloc enabled with $LIB_MALLOC"
145 esac
146])
147if test "${use_dlmalloc-unset}" = unset; then
148 case "$host" in
149 i386-*-solaris2.*)
150 echo "Enabling dlmalloc for $host"
151 use_dlmalloc="yes"
152 ;;
153 esac
154fi
155if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
156 # Ok. dlmalloc was enabled before, but state may be changed.
157 # we have to test these again
158 unset ac_cv_func_mallinfo
159 unset ac_cv_func_mallocblksize
160 unset ac_cv_func_free
161 unset ac_cv_func_realloc
162 unset ac_cv_func_memalign
163 unset ac_cv_func_valloc
164 unset ac_cv_func_pvalloc
165 unset ac_cv_func_calloc
166 unset ac_cv_func_cfree
167 unset ac_cv_func_malloc_trim
168 unset ac_cv_func_malloc_usable_size
169 unset ac_cv_func_malloc_stats
170 unset ac_cv_func_mallinfo
171 unset ac_cv_func_mallopt
172 unset ac_cv_lib_gnumalloc
173 unset ac_cv_header_gnumalloc_h
174 unset ac_cv_lib_malloc
175 unset ac_cv_enabled_dlmalloc
176fi
177if test "$use_dlmalloc" = yes; then
94d48591 178 ac_cv_func_mallinfo="yes"
179 ac_cv_func_mallocblksize="no"
180 ac_cv_func_free="yes"
181 ac_cv_func_realloc="yes"
182 ac_cv_func_memalign="yes"
183 ac_cv_func_valloc="yes"
184 ac_cv_func_pvalloc="yes"
185 ac_cv_func_calloc="yes"
186 ac_cv_func_cfree="yes"
187 ac_cv_func_malloc_trim="yes"
188 ac_cv_func_malloc_usable_size="yes"
189 ac_cv_func_malloc_stats="yes"
94d48591 190 ac_cv_func_mallopt="yes"
191 ac_cv_lib_gnumalloc="no"
85efe3ec 192 ac_cv_header_gnumalloc_h="no"
94d48591 193 ac_cv_lib_malloc="no"
194 ac_cv_enabled_dlmalloc="yes"
029ce4ae 195fi
196
e5f4e1b0 197AC_SUBST(LIBDLMALLOC)
198AC_SUBST(LIB_MALLOC)
199
200AC_ARG_ENABLE(gnuregex,
201[ --enable-gnuregex Compile GNUregex],
202[USE_GNUREGEX=$enableval])
203
e5f4e1b0 204AC_ARG_ENABLE(xmalloc_debug,
205[ --enable-xmalloc-debug Do some simple malloc debugging],
206[ if test "$enableval" = "yes" ; then
207 echo "Malloc debugging enabled"
208 AC_DEFINE(XMALLOC_DEBUG)
209 fi
210])
211
027acbaf 212AC_ARG_ENABLE(xmalloc_debug_trace,
213[ --enable-xmalloc-debug-trace
e5f4e1b0 214 Detailed trace of memory allocations],
215[ if test "$enableval" = "yes" ; then
027acbaf 216 echo "Malloc debug trace enabled"
217 AC_DEFINE(XMALLOC_TRACE)
218 AC_DEFINE(XMALLOC_DEBUG)
e5f4e1b0 219 fi
220])
221
222AC_ARG_ENABLE(xmalloc_statistics,
223[ --enable-xmalloc-statistics
224 Show malloc statistics in status page],
225[ if test "$enableval" = "yes" ; then
226 echo "Malloc statistics enabled"
227 AC_DEFINE(XMALLOC_STATISTICS)
228 fi
229])
230
323fe0d4 231AC_ARG_ENABLE(carp,
232[ --enable-carp Enable CARP support],
233[ if test "$enableval" = "yes" ; then
234 echo "CARP support enabled"
235 AC_DEFINE(USE_CARP)
236 fi
237])
238
e5f4e1b0 239AC_ARG_ENABLE(async_io,
9bc73deb 240[ --enable-async-io[=N_THREADS]
241 Do ASYNC disk I/O using threads.
242 N_THREADS is the number of worker threads
243 defaults to 16. See also src/squid.h for
244 some additional platform tuning],
245[ case "$enableval" in
246 yes)
247 async_io=yes
248 ;;
249 no)
250 async_io=''
251 ;;
252 *)
253 async_io=yes
254 AC_DEFINE_UNQUOTED(NUMTHREADS, $enableval)
255 ;;
256 esac
257])
258
259if test -n "$async_io" ; then
e5f4e1b0 260 echo "Async I/O enabled"
c68e9c6b 261 async_io=yes
e5f4e1b0 262 AC_DEFINE(USE_ASYNC_IO)
263 ASYNC_OBJS='$(ASYNC_OBJS)'
9fc0b4b8 264 SQUID_PTHREAD_LIB='$(PTHREADLIB)'
265 CFLAGS="$CFLAGS -D_REENTRANT"
c68e9c6b 266 case "$host" in
267 i386-unknown-freebsd*)
268 if test "$GCC" = "yes" ; then
269 if test -z "$PRESET_LDFLAGS"; then
270 LDFLAGS="$LDFLAGS -pthread"
271 fi
272 fi
273 ;;
274 esac
9bc73deb 275fi
e5f4e1b0 276AC_SUBST(ASYNC_OBJS)
277AC_SUBST(SQUID_PTHREAD_LIB)
278
279AC_ARG_ENABLE(icmp,
280[ --enable-icmp Enable ICMP pinging],
281[ if test "$enableval" = "yes" ; then
282 echo "ICMP enabled"
283 AC_DEFINE(USE_ICMP)
284 fi
285])
286
95e36d02 287AC_ARG_ENABLE(delay_pools,
288[ --enable-delay-pools Enable delay pools to limit bandwith usage],
e5f4e1b0 289[ if test "$enableval" = "yes" ; then
95e36d02 290 echo "Delay pools enabled"
291 DELAY_OBJS='$(DELAY_OBJS)'
292 AC_DEFINE(DELAY_POOLS)
e5f4e1b0 293 fi
294])
95e36d02 295AC_SUBST(DELAY_OBJS)
e5f4e1b0 296
36a97e19 297AC_ARG_ENABLE(mem-gen-trace,
298[ --enable-mem-gen-trace Do trace of memory stuff],
299[ if test "$enableval" = "yes" ; then
300 echo "Memory trace (to file) enabled"
301 AC_DEFINE(MEM_GEN_TRACE)
302 fi
303])
304
e5f4e1b0 305AC_ARG_ENABLE(useragent_log,
306[ --enable-useragent-log Enable logging of User-Agent header],
307[ if test "$enableval" = "yes" ; then
308 echo "User-Agent logging enabled"
309 AC_DEFINE(USE_USERAGENT_LOG)
310 fi
311])
312
320e9f36 313AC_ARG_ENABLE(wccp,
eb824054 314[ --disable-wccp Disable Web Cache Coordination Protocol],
315[ if test "$enableval" = "no" ; then
316 echo "Web Cache Coordination Protocol disabled"
317 AC_DEFINE(USE_WCCP, 0)
318 else
319 AC_DEFINE(USE_WCCP, 1)
320e9f36 320 fi
321])
320e9f36 322
9fc0b4b8 323AC_ARG_ENABLE(kill_parent_hack,
324[ --enable-kill-parent-hack
325 Kill parent on shutdown],
e5f4e1b0 326[ if test "$enableval" = "yes" ; then
327 echo "Kill parent on shutdown"
328 AC_DEFINE(KILL_PARENT_OPT)
329 fi
330])
331
332AC_ARG_ENABLE(snmp,
333[ --enable-snmp Enable SNMP monitoring],
334[ if test "$enableval" = "yes" ; then
335 echo "SNMP monitoring enabled"
336 AC_DEFINE(SQUID_SNMP)
337 SNMPLIB='-L../snmplib -lsnmp'
338 SNMP_OBJS='$(SNMP_OBJS)'
8a7f0105 339 SNMP_MAKEFILE=./snmplib/Makefile
e5f4e1b0 340 makesnmplib=snmplib
341 fi
342])
343AC_SUBST(SNMPLIB)
344AC_SUBST(SNMP_OBJS)
345AC_SUBST(makesnmplib)
346
347AC_ARG_ENABLE(time_hack,
348[ --enable-time-hack Update internal timestamp only once per second],
349[ if test "$enableval" = "yes" ; then
350 echo "Update internal timestamp only once per second"
351 AC_DEFINE(ALARM_UPDATES_TIME)
352 fi
353])
354
355AC_ARG_ENABLE(cachemgr_hostname,
356[ --enable-cachemgr-hostname[=hostname]
357 Make cachemgr.cgi default to this host],
358[ case $enableval in
359 yes)
360 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()])
361 echo "Cachemgr default hostname == host where cachemgr runs"
362 ;;
363 no)
364 : # Nothing to do..
365 ;;
366 *)
367 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
368 echo "Cachemgr default hostname set to ${enableval}"
369 ;;
370 esac
371])
372
373AC_ARG_ENABLE(arp_acl,
374[ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
375[ if test "$enableval" = "yes" ; then
376 echo "ARP ACL lists enabled (ether address)"
933cc58d 377 case "$host" in
a931a29b 378 *-pc-linux-*)
379 ;;
933cc58d 380 *)
bd0c865a 381 echo "WARNING: ARP ACL support is only currently supported on Linux"
382 echo " ethernet interfaces, probably won't work on $host."
933cc58d 383 sleep 10
384 ;;
385 esac
e5f4e1b0 386 AC_DEFINE(USE_ARP_ACL)
387 fi
388])
389
74075210 390AC_ARG_ENABLE(htcp,
88b7de25 391[ --enable-htcp Enable HTCP protocol],
b4b8b6da 392[ if test "$enableval" = "yes" ; then
393 echo "HTCP enabled"
394 HTCP_OBJS='$(HTCP_OBJS)'
395 AC_DEFINE(USE_HTCP)
396 fi
74075210 397])
b4b8b6da 398AC_SUBST(HTCP_OBJS)
74075210 399
02749868 400AC_ARG_ENABLE(forw-via-db,
401[ --enable-forw-via-db Enable Forw/Via database],
402[ if test "$enableval" = "yes" ; then
403 echo "FORW-VIA enabled"
404 AC_DEFINE(FORW_VIA_DB)
405 fi
406])
407
6cfa8966 408AC_ARG_ENABLE(cache-digests,
22df58ea 409[ --enable-cache-digests Use Cache Digests
043e3d78 410 see http://squid.nlanr.net/Squid/FAQ/FAQ-16.html],
484f2ebc 411[ if test "$enableval" = "yes" ; then
6cfa8966 412 echo "USE_CACHE_DIGESTS enabled"
413 AC_DEFINE(USE_CACHE_DIGESTS)
484f2ebc 414 fi
415])
416
933cc58d 417dnl Select Error language
418AC_ARG_ENABLE(err-language,
419[ --enable-err-language=lang
420 Select language for Error pages (see errors dir) ],
421[
422 if test -d errors/$enableval; then
423 ERR_LANGUAGE=$enableval
424 else
425 echo "ERROR! Unknown language $enableval, see errors/"
426 exit 1
427 fi
93a8bb45 428],[ERR_LANGUAGE="English"])
933cc58d 429AC_SUBST(ERR_LANGUAGE)
430
9bb83c8b 431dnl Enable poll()
432AC_ARG_ENABLE(poll,
433[ --enable-poll Enable poll() instead of select(). Normally poll
434 is preferred over select, but configure knows poll
435 is broken on some platforms. If you think you are
436 smarter than the configure script, you may enable
437 poll with this option.
c68e9c6b 438 --disable-poll Disable the use of poll().],
439[
440 case "$enableval" in
441 yes)
9bb83c8b 442 echo "Forcing poll() to be enabled"
443 ac_cv_func_poll='yes'
c68e9c6b 444 ;;
445 no)
446 echo "Forcing poll() to be disabled"
447 ac_cv_func_poll='no'
448 ;;
449 esac
9bb83c8b 450])
451
72fd085a 452dnl Disable HTTP violations
453AC_ARG_ENABLE(http-violations,
454[ --disable-http-violations
455 This allows you to remove code which is known to
c68e9c6b 456 violate the HTTP protocol specification.],
72fd085a 457[ if test "$enableval" = "no" ; then
458 echo "Disabling HTTP Violations"
6eec93b2 459 AC_DEFINE(HTTP_VIOLATIONS, 0)
72fd085a 460 else
6eec93b2 461 AC_DEFINE(HTTP_VIOLATIONS, 1)
72fd085a 462 fi
463])
464
5cafc1d6 465dnl Enable IP-Filter Transparent Proxy
466AC_ARG_ENABLE(ipf-transparent,
467[ --enable-ipf-transparent
468 Enable Transparent Proxy support for systems
c68e9c6b 469 using IP-Filter network address redirection.],
5cafc1d6 470[ if test "$enableval" = "yes" ; then
471 echo "IP-Filter Transparent Proxy enabled"
472 AC_DEFINE(IPF_TRANSPARENT)
473 IPF_TRANSPARENT="yes"
474 fi
475])
476
5d620373 477dnl Enable Leak Finding Functions
478AC_ARG_ENABLE(leakfinder,
479[ --enable-leakfinder
480 Enable Leak Finding code. Enabling this alone
481 does nothing; you also have to modify the source
482 code to use the leak finding functions. Probably
483 Useful for hackers only.],
484[ if test "$enableval" = "yes" ; then
485 echo "Leak-Finding enabled"
486 AC_DEFINE(USE_LEAKFINDER)
487 LEAKFINDER_OBJS='$(LEAKFINDER_OBJS)'
488 USE_LEAKFINDER="yes"
489 fi
490])
491AC_SUBST(LEAKFINDER_OBJS)
492
3898f57f 493dnl Disable HTTP violations
494AC_ARG_ENABLE(ident-lookups,
495[ --disable-ident-lookups
496 This allows you to remove code that performs
497 Ident (RFC 931) lookups.],
498[ if test "$enableval" = "no" ; then
499 echo "Disabling Ident Lookups"
500 AC_DEFINE(USE_IDENT, 0)
501 else
502 AC_DEFINE(USE_IDENT, 1)
503 fi
504])
505
eb824054 506AC_ARG_ENABLE(internal-dns,
7e3ce7b9 507[ --disable-internal-dns This prevents Squid from directly sending and
eb824054 508 receiving DNS messages, and instead enables the
509 old external 'dnsserver' processes.],
510[ if test "$enableval" = "no" ; then
511 echo "Disabling Internal DNS queries"
512 AC_DEFINE(USE_DNSSERVERS, 1)
513 else
514 AC_DEFINE(USE_DNSSERVERS, 0)
515 fi
516])
517
518AC_ARG_ENABLE(truncate,
7e3ce7b9 519[ --enable-truncate This uses truncate() instead of unlink() when
eb824054 520 removing cache files. Truncate gives a little
521 performance improvement, but may cause problems
522 when used with async I/O. Truncate uses more
523 filesystem inodes than unlink..],
524[ if test "$enableval" = "yes" ; then
525 echo "Enabling truncate instead of unlink"
526 AC_DEFINE(USE_TRUNCATE)
527 fi
528])
529
9bc73deb 530dnl Enable underscore in hostnames
531AC_ARG_ENABLE(underscores,
532[ --enable-underscores Squid by default rejects any host names with _
533 in their name to conform with internet standars.
534 If you disagree with this you may allow _ in
535 hostnames by using this switch, provided that
536 the resolver library on the host where Squid runs
537 does not reject _ in hostnames...],
538[ if test "$enableval" = "yes" ; then
539 echo "Enabling the use of underscores in host names"
540 AC_DEFINE(ALLOW_HOSTNAME_UNDERSCORES, 1)
541 fi
542])
543
7e3ce7b9 544dnl Enable HEAP_REPLACEMENT
545AC_ARG_ENABLE(heap-replacement,
546[ --enable-heap-replacement
547 This option allows you to use various cache
548 replacement algorithms, instead of the standard
549 LRU algorithm.
550 ],
551[ if test "$enableval" = "yes" ; then
552 echo "Enabling HEAP_REPLACEMENT"
553 AC_DEFINE(HEAP_REPLACEMENT, 1)
554 fi
555])
556
49a8b2ea 557dnl Enable "diskd" code
558AC_ARG_ENABLE(diskd,
559[ --enable-diskd Uses shared memory, message queues, and external
560 processes for disk I/O.],
561[ if test "$enableval" = "yes" ; then
7e3ce7b9 562 echo "DISKD enabled"
49a8b2ea 563 AC_DEFINE(USE_DISKD, 1)
564 OPT_DISKD_EXE='$(DISKD_EXE)'
565 AC_SUBST(OPT_DISKD_EXE)
566 DISKD_OBJS='diskd.o'
567 AC_SUBST(DISKD_OBJS)
568 fi
569])
570
fd9aaa3e 571# Force some compilers to use ANSI features
572#
573case "$host" in
574 alpha-dec-osf*)
575 if test "$ac_cv_prog_CC" = "cc" ; then
576 echo "adding '-std1' to cc args for $host"
577 CC="cc -std1";
578 ac_cv_prog_CC="$CC"
579 fi
580 ;;
c68e9c6b 581 *-hp-hpux*)
582 if test "$ac_cv_prog_CC" = "cc" ; then
583 echo "adding '-Ae' to cc args for $host"
584 CC="cc -Ae";
585 ac_cv_prog_CC="$CC"
586 fi
587 ;;
fd9aaa3e 588esac
589
090089c4 590dnl Check for programs
591AC_PROG_CPP
592AC_PROG_INSTALL
593AC_PROG_RANLIB
594AC_PROG_LN_S
81280a96 595AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 596AC_PATH_PROG(FALSE, false, /usr/bin/false)
597AC_PATH_PROG(TRUE, true, /usr/bin/true)
598AC_PATH_PROG(RM, rm, $FALSE)
599AC_PATH_PROG(MV, mv, $FALSE)
600AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 601AC_PATH_PROG(LN, ln, cp)
983061ed 602AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
d9f67e6f 603AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 604AC_PATH_PROG(AR, ar, $FALSE)
605
606case "$host" in
607 *-hp-hpux*)
608 echo "Disabling 'ranlib' for HP-UX..."
609 RANLIB=":"
610 ;;
611esac
612
613dnl set $(AR)
614AR_R="$AR r"
615case "$host" in
616 *-next-nextstep3)
617 AR="libtool -o"
618 ;;
619esac
620AC_SUBST(AR_R)
090089c4 621
622dnl Check for headers
623AC_HEADER_DIRENT
624AC_HEADER_STDC
db40ae20 625
626AC_CHECK_HEADERS( \
db40ae20 627 arpa/inet.h \
30a4f2a8 628 arpa/nameser.h \
9441aa34 629 assert.h \
db40ae20 630 bstring.h \
631 config.h \
632 crypt.h \
30a4f2a8 633 ctype.h \
634 errno.h \
db40ae20 635 fcntl.h \
9c1d8929 636 getopt.h \
88738790 637 gnumalloc.h \
30a4f2a8 638 grp.h \
5cafc1d6 639 ip_compat.h \
640 ip_fil.h \
641 ip_nat.h \
30a4f2a8 642 libc.h \
6ad85e8a 643 limits.h \
30a4f2a8 644 malloc.h \
e0bddc45 645 math.h \
db40ae20 646 memory.h \
b075cbb1 647 mount.h \
5cafc1d6 648 net/if.h \
30a4f2a8 649 netdb.h \
db40ae20 650 netinet/in.h \
30a4f2a8 651 netinet/tcp.h \
eb824054 652 netinet/ip_compat.h \
653 netinet/ip_fil.h \
654 netinet/ip_nat.h \
dcfe6390 655 poll.h \
30a4f2a8 656 pwd.h \
657 regex.h \
658 resolv.h \
c68e9c6b 659 sched.h \
30a4f2a8 660 signal.h \
661 stdarg.h \
662 stddef.h \
663 stdio.h \
db40ae20 664 stdlib.h \
665 string.h \
666 strings.h \
667 sys/file.h \
5cafc1d6 668 sys/ioctl.h \
ebb3c3ba 669 sys/msg.h \
30a4f2a8 670 sys/param.h \
671 sys/resource.h \
db40ae20 672 sys/select.h\
30a4f2a8 673 sys/socket.h \
674 sys/stat.h \
b075cbb1 675 sys/statvfs.h \
30a4f2a8 676 sys/syscall.h \
db40ae20 677 sys/time.h \
678 sys/types.h \
30a4f2a8 679 sys/un.h \
b075cbb1 680 sys/vfs.h \
30a4f2a8 681 sys/wait.h \
db40ae20 682 syslog.h \
30a4f2a8 683 time.h \
684 unistd.h \
685 varargs.h \
db40ae20 686)
687
aee0606f 688AC_C_CONST
d57288d2 689AC_C_BIGENDIAN
aee0606f 690
5c51415d 691AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
692 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
693 [foo("bar")],
694 ac_cv_have_ansi_prototypes="yes",
695 ac_cv_have_ansi_prototypes="no")
696])
697if test $ac_cv_have_ansi_prototypes = "yes" ; then
698 AC_DEFINE(HAVE_ANSI_PROTOTYPES)
699fi
20a50bb9 700
5c51415d 701AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [
702 AC_TRY_COMPILE([#include <time.h>
46c883ed 703#include <sys/time.h>],
5c51415d 704 [struct tm foo;
705 foo.tm_gmtoff = 0;],
706 ac_cv_have_tm_gmoff="yes",
707 ac_cv_have_tm_gmoff="no")
708])
709if test $ac_cv_have_tm_gmoff = "yes" ; then
710 AC_DEFINE(HAVE_TM_GMTOFF)
711fi
46c883ed 712
eb824054 713AC_CACHE_CHECK(for struct mallinfo,ac_cv_have_struct_mallinfo, [
714 AC_TRY_COMPILE([#include <sys/types.h>
715#if HAVE_MALLOC_H
716#include <malloc.h>
717#endif],
718 [struct mallinfo foo;
719 foo.arena = 0;
720 foo.ordblks = 0;
721 foo.smblks = 0;
722 foo.hblks = 0;
723 foo.hblkhd = 0;
724 foo.uordblks = 0;
725 foo.fordblks = 0;
726 foo.keepcost = 0;],
727 ac_cv_have_struct_mallinfo="yes",
728 ac_cv_have_struct_mallinfo="no")
729])
730if test $ac_cv_have_struct_mallinfo = "yes" ; then
731 AC_DEFINE(HAVE_STRUCT_MALLINFO)
732fi
733
5c51415d 734AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [
735 AC_TRY_COMPILE([#include <sys/types.h>
46c883ed 736#include <malloc.h>],
5c51415d 737 [struct mallinfo foo;
738 foo.mxfast = 0;],
739 ac_cv_have_ext_mallinfo="yes",
740 ac_cv_have_ext_mallinfo="no")
741])
742if test $ac_cv_have_ext_mallinfo = "yes" ; then
743 AC_DEFINE(HAVE_EXT_MALLINFO)
744fi
090089c4 745
b54a6789 746AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [
747 AC_TRY_COMPILE([
8ff51bba 748#if HAVE_SYS_TIME_H
749#include <sys/time.h>
750#endif
b54a6789 751#if HAVE_SYS_RESOURCE_H
752#include <sys/resource.h>
753#endif],
754 [struct rusage R;],
755 ac_cv_have_struct_rusage="yes",
756 ac_cv_have_struct_rusage="no")
757])
758if test $ac_cv_have_struct_rusage = "yes" ; then
759 AC_DEFINE(HAVE_STRUCT_RUSAGE)
760fi
761
5c51415d 762AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [
763 AC_TRY_COMPILE([#include <sys/types.h>
a025a745 764#include <netinet/in.h>
765#include <netinet/in_systm.h>
6ad85e8a 766#include <netinet/ip.h>
767#ifdef __linux__
768#define ip_hl ihl
769#endif
770#ifndef __linux__
771#define iphdr ip
772#endif],
5c51415d 773 [struct iphdr ip;
774 ip.ip_hl= 0;],
775 ac_cv_have_ip_hl="yes",
776 ac_cv_have_ip_hl="no")
777])
778if test $ac_cv_have_ip_hl = "yes" ; then
779 AC_DEFINE(HAVE_IP_HL)
780fi
a025a745 781
090089c4 782dnl Check for typedefs
783AC_CHECK_SIZEOF(int)
784AC_CHECK_SIZEOF(long)
b6a2f15e 785AC_CHECK_SIZEOF(void *)
090089c4 786
256cf05b 787dnl Check for special functions
788AC_FUNC_ALLOCA
090089c4 789
3f6fcd8a 790AC_CHECK_TYPE(pid_t, int)
0897af2d 791AC_CHECK_TYPE(size_t, unsigned int)
792AC_CHECK_TYPE(ssize_t, int)
3f6fcd8a 793AC_CHECK_TYPE(off_t, int)
95cf2361 794AC_CHECK_TYPE(mode_t, u_short)
c716a1dd 795AC_CHECK_TYPE(fd_mask, int)
d63ed275 796AC_CHECK_TYPE(mtyp_t, long)
3f6fcd8a 797
6637e3a5 798dnl Check for type in sys/socket.h
799AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
800 AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
801#include <sys/socket.h>
802#if STDC_HEADERS
803#include <stdlib.h>
804#include <stddef.h>
805#endif],
806 ac_cv_type_socklen_t=yes,
807 ac_cv_type_socklen_t=no)
808])
809if test $ac_cv_type_socklen_t = no; then
810 AC_DEFINE(socklen_t, int)
811fi
812
090089c4 813dnl Check for needed libraries
30a4f2a8 814AC_CHECK_LIB(nsl, main)
6716b242 815AC_CHECK_LIB(socket, main)
94d48591 816
817if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
818 echo "skipping libmalloc check (--enable-dlmalloc specified)"
5c51415d 819else
94d48591 820 AC_CHECK_LIB(gnumalloc, main)
821 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
822 echo "Disabling extended malloc functions when using gnumalloc"
823 ac_cv_func_mallinfo=no
824 ac_cv_func_mallocblksize=no
825 ac_cv_func_mallopt=no
826 else
827 case "$host" in
828 *-sun-solaris*)
829 echo "skipping libmalloc check for $host"
830 ;;
831 i386-*-freebsd*)
832 echo "skipping libmalloc check for $host"
833 ;;
834 *)
835
836 AC_CHECK_LIB(malloc, main)
837 ;;
838 esac
839 fi
8a15e65e 840fi
94d48591 841
6716b242 842AC_CHECK_LIB(bsd, main)
be79ade0 843AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 844AC_CHECK_LIB(bind, gethostbyname)
845if test $ac_cv_lib_bind_gethostbyname = "no" ; then
846 case "$host" in
78743365 847 i386-*-freebsd*)
848 echo "skipping libresolv checks for $host"
849 ;;
850 *)
851 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
852 AC_CHECK_LIB(resolv, main)
853 ;;
04a56fa3 854 esac
855fi
e0bddc45 856AC_CHECK_LIB(m, main)
090089c4 857
858dnl Check for libcrypt
b8de7ebe 859dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
0f5a16f8 860AC_CHECK_LIB(crypt, crypt)
861if test $ac_cv_lib_crypt_crypt = "yes"; then
862 CRYPTLIB="-lcrypt"
863fi
be79ade0 864AC_SUBST(CRYPTLIB)
77f675ad 865
e5f4e1b0 866dnl Check for pthreads
867dnl We use pthreads when doing ASYNC I/O
0f5a16f8 868AC_CHECK_LIB(pthread, main)
869if test $ac_cv_lib_pthread_main = "yes"; then
870 PTHREADLIB="-lpthread"
871fi
71f8abc8 872AC_SUBST(PTHREADLIB)
873
86ec11aa 874dnl -lintl is needed on SCO version 3.2v4.2 for strftime()
875dnl Robert Side <rside@aiinc.bc.ca>
876dnl Mon, 18 Jan 1999 17:48:00 GMT
877case "$host" in
878 *-pc-sco3.2*)
879 AC_CHECK_LIB(intl, strftime)
880 ;;
881esac
882
77f675ad 883dnl System-specific library modifications
884dnl
885case "$host" in
88738790 886 i386-*-solaris2.*)
7149a49f 887 if test "$GCC" = "yes"; then
888 echo "Removing -O for gcc on $host"
80e92d6d 889 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 890 fi
891 ;;
77f675ad 892 *-sgi-irix*)
893 echo "Removing -lsocket for IRIX..."
6716b242 894 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 895 echo "Removing -lnsl for IRIX..."
6716b242 896 LIBS=`echo $LIBS | sed -e s/-lnsl//`
b44c0fb4 897 echo "Removing -lbsd for IRIX..."
898 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 899 ;;
4ba0bd0e 900dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
901dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
902dnl Please change your configure script. AIX doesn't need -lbsd.
903 *-ibm-aix*)
904 echo "Removing -lbsd for AIX..."
905 LIBS=`echo $LIBS | sed -e s/-lbsd//`
c68e9c6b 906dnl From: mlaster@metavillage.com (Mike Laster)
907dnl AIX 4.1.4.x does not have header files for snprintf/vsnprintf
908dnl So using the internal versions generates a load of warnings
909dnl during compile.
910 echo "disabling snprintf/vsnprintf for $host"
911 ac_cv_func_snprintf=no
912 ac_cv_func_vsnprintf=no
4ba0bd0e 913 ;;
30a4f2a8 914 *m88k*)
915 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
7149a49f 916 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
917 ;;
580ce039 918 [*-*-solaris2.[0-4]])
7149a49f 919 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
30a4f2a8 920 ;;
711fa75e 921 [*-sony-newsos[56]*])
f62c73dc 922 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
923 ;;
77f675ad 924esac
090089c4 925
176d10ee 926# Recommended by Balint Nagy Endre <bne@CareNet.hu>
927case "$host" in
928 *-univel-sysv4.2MP)
929 if test `uname -v` = "2.03"; then
930 echo "disabling mallinfo for $host"
931 ac_cv_func_mallinfo=no
932 fi
933 ;;
934esac
935
84cecfd2 936dnl This has to be before AC_CHECK_FUNCS
937# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
938# when running configure.
939if test -z "$ac_cv_func_poll"; then
940 case "$host" in
941 [alpha-dec-osf3.*])
942 # John Kay (jkay@nlanr.net) 19970818
943 echo "disabling poll for $host..."
944 ac_cv_func_poll='no'
945 ;;
946 [*-hp-hpux*.*])
947 # Duane Wessels
948 echo "disabling poll for $host..."
949 ac_cv_func_poll='no'
950 ;;
951 [*-linux-*])
9bb83c8b 952 # Henrik Nordstrom (hno@hem.passagen.se) 19980817
953 # poll is problematic on Linux. We disable it
954 # by default until Linux gets it right.
b6a2f15e 955 rev=`uname -r | awk -F. '{printf "%03d%03d",$1,$2}'`
956 if test $rev -lt 002002; then
957 echo "disabling poll for $host < 2.2..."
958 ac_cv_func_poll='no'
959 fi
84cecfd2 960 ;;
c68e9c6b 961 [powerpc-ibm-aix4.1.*])
962 # Mike Laster (mlaster@metavillage.com) 19981021
963 echo "disabling poll for $host..."
964 ac_cv_func_poll='no'
965 ;;
86ec11aa 966 [*-pc-sco3.2*])
967 # Robert Side <rside@aiinc.bc.ca>
968 # Mon, 18 Jan 1999 17:48:00 GMT
969 echo "disabling poll for $host..."
970 ac_cv_func_poll='no'
971 ;;
84cecfd2 972 esac
973fi
176d10ee 974
6716b242 975dnl Check for library functions
976AC_CHECK_FUNCS(\
30a4f2a8 977 bcopy \
df087e68 978 crypt \
4ac29a5b 979 fchmod \
6716b242 980 getdtablesize \
8505e57b 981 getpagesize \
30a4f2a8 982 getrusage \
9c1d8929 983 getspnam \
30a4f2a8 984 lrand48 \
6716b242 985 mallinfo \
0f5efab0 986 mallocblksize \
6716b242 987 mallopt \
2ae6b9b0 988 memcpy \
30a4f2a8 989 memmove \
dac27377 990 memset \
1812b6c7 991 mktime \
88738790 992 mstats \
84cecfd2 993 poll \
c68e9c6b 994 putenv \
b1e77ec1 995 random \
6716b242 996 regcomp \
997 regexec \
998 regfree \
30a4f2a8 999 res_init \
4915be3b 1000 rint \
234967c9 1001 seteuid \
30a4f2a8 1002 setpgrp \
6716b242 1003 setrlimit \
b6a2f15e 1004 getrlimit \
30a4f2a8 1005 setsid \
1006 sigaction \
11430c03 1007 snprintf \
30a4f2a8 1008 srand48 \
b1e77ec1 1009 srandom \
6716b242 1010 sysconf \
1011 syslog \
234967c9 1012 timegm \
28da5e0d 1013 vsnprintf \
6716b242 1014)
1015
c68e9c6b 1016if test "$async_io" = "yes" ; then
1017 AC_CHECK_FUNCS(\
1018 pthread_attr_setscope \
1019 pthread_setschedparam \
1020 pthread_attr_setschedparam \
1021 )
1022fi
1023
60939927 1024dnl Yay! Another Linux brokenness. Its not good enough
1025dnl to know that setresuid() exists, because RedHat 5.0 declares
1026dnl setresuid() but doesn't implement it.
1027dnl
1028AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 1029 AC_TRY_RUN([
60939927 1030#include <stdlib.h>
5c51415d 1031 int main() {
1032 if(setresuid(-1,-1,-1)) {
1033 perror("setresuid:");
1034 exit(1);
60939927 1035 }
1036 exit(0);
5c51415d 1037 }
1038 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 1039)
5c51415d 1040if test "$ac_cv_func_setresuid" = "yes" ; then
1041 AC_DEFINE(HAVE_SETRESUID)
1042fi
60939927 1043
5cafc1d6 1044dnl IP-Filter support requires ipf header files. These aren't
1045dnl installed by default, so we need to check for them
1046if test "$IPF_TRANSPARENT" ; then
1047 AC_MSG_CHECKING(if IP-Filter header files are installed)
eb824054 1048 if test "$ac_cv_header_ip_compat_h" = "yes" &&
1049 test "$ac_cv_header_ip_fil_h" = "yes" &&
1050 test "$ac_cv_header_ip_nat_h" = "yes" ; then
1051 IPF_TRANSPARENT="yes"
1052 AC_DEFINE(IPF_TRANSPARENT, 1)
1053 elif test "$ac_cv_header_netinet_ip_compat_h" = "yes" &&
1054 test "$ac_cv_header_netinet_ip_fil_h" = "yes" &&
1055 test "$ac_cv_header_netinet_ip_nat_h" = "yes" ; then
1056 IPF_TRANSPARENT="yes"
1057 AC_DEFINE(IPF_TRANSPARENT, 1)
1058 else
5cafc1d6 1059 IPF_TRANSPARENT="no"
1060 AC_DEFINE(IPF_TRANSPARENT, 0)
5cafc1d6 1061 fi
1062 AC_MSG_RESULT($IPF_TRANSPARENT)
1063fi
1064if test "$IPF_TRANSPARENT" = "no" ; then
1065 echo "WARNING: Cannot find necessary IP-Filter header files"
1066 echo " Transparent Proxy support WILL NOT be enabled"
1067 sleep 10
1068fi
1069
91bc414e 1070if test -z "$USE_GNUREGEX" ; then
1071 case "$host" in
1072 *-sun-solaris2.[[0-4]])
1073 USE_GNUREGEX="yes"
1074 ;;
1075 *-next-nextstep*)
1076 USE_GNUREGEX="yes"
1077 ;;
1078 esac
1079fi
7a081912 1080AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 1081if test -z "$USE_GNUREGEX"; then
55878dfd 1082if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 1083 USE_GNUREGEX="yes"
00fa2c12 1084else
0cccc031 1085 AC_TRY_COMPILE([#include <sys/types.h>
1086#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 1087 USE_GNUREGEX="no",
1088 USE_GNUREGEX="yes")
1089fi
00fa2c12 1090fi
74946a0f 1091AC_MSG_RESULT($USE_GNUREGEX)
1092if test "$USE_GNUREGEX" = "yes"; then
26675bf4 1093 REGEXLIB="-lregex"
7a081912 1094 LIBREGEX="libregex.a"
74946a0f 1095 AC_DEFINE(USE_GNUREGEX)
7a081912 1096fi
26675bf4 1097AC_SUBST(REGEXLIB)
00fa2c12 1098AC_SUBST(LIBREGEX)
7a081912 1099
3f6fcd8a 1100AC_REPLACE_FUNCS(\
3d0cf10e 1101 drand48 \
3f6fcd8a 1102 tempnam \
4d38fc7e 1103 strerror \
3f6fcd8a 1104)
1105
5c51415d 1106dnl Not cached since people are likely to tune this
e924600d 1107AC_MSG_CHECKING(Default FD_SETSIZE value)
1108AC_TRY_RUN([
1109#if HAVE_STDIO_H
1110#include <stdio.h>
1111#endif
1112#if HAVE_UNISTD_H
1113#include <unistd.h>
1114#endif
1115#if HAVE_SYS_TIME_H
1116#include <sys/time.h>
1117#endif
1118#if HAVE_SYS_SELECT_H
1119#include <sys/select.h>
1120#endif
1121#if HAVE_SYS_TYPES_H
1122#include <sys/types.h>
1123#endif
1124main() {
635e6242 1125 FILE *fp = fopen("conftestval", "w");
1126 fprintf (fp, "%d\n", FD_SETSIZE);
e924600d 1127 exit(0);
1128}
1129],
1130DEFAULT_FD_SETSIZE=`cat conftestval`,
1131DEFAULT_FD_SETSIZE=256,
1132DEFAULT_FD_SETSIZE=256)
1133AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
1134AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
1135
5c51415d 1136dnl Not cached since people are likely to tune this
234967c9 1137AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
c76d8acc 1138dnl damn! FreeBSD's pthreads breaks dup2().
1139TLDFLAGS="$LDFLAGS"
1140case $host in
1141i386-unknown-freebsd*)
1142 if echo "$LDFLAGS" | grep -q pthread; then
1143 LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"`
1144 fi
1145esac
234967c9 1146AC_TRY_RUN([
8cca06da 1147#include <stdio.h>
234967c9 1148#include <unistd.h>
30a4f2a8 1149#include <sys/time.h> /* needed on FreeBSD */
234967c9 1150#include <sys/param.h>
1151#include <sys/resource.h>
1152main() {
635e6242 1153 FILE *fp;
234967c9 1154 int i,j;
df087e68 1155#if __CYGWIN32__
1156 /* getrlimit and sysconf returns bogous values on cygwin32.
1157 * Number of fds is virtually unlimited in cygwin (sys/param.h)
1158 */
1159 i = NOFILE;
d9399075 1160#elif HAVE_SETRLIMIT
234967c9 1161 struct rlimit rl;
1162#if defined(RLIMIT_NOFILE)
1163 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
1164 perror("getrlimit: RLIMIT_NOFILE");
1165 } else {
1166 rl.rlim_cur = rl.rlim_max; /* set it to the max */
1167 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
1168 perror("setrlimit: RLIMIT_NOFILE");
1169 }
1170 }
1171#elif defined(RLIMIT_OFILE)
1172 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
1173 perror("getrlimit: RLIMIT_OFILE");
1174 } else {
1175 rl.rlim_cur = rl.rlim_max; /* set it to the max */
1176 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
1177 perror("setrlimit: RLIMIT_OFILE");
1178 }
1179 }
1180#endif /* RLIMIT_NOFILE */
1181#endif /* HAVE_SETRLIMIT */
d9399075 1182 /* by starting at 2^14, we will never get higher
1183 than 2^15 for SQUID_MAXFD */
1184 i = j = 1<<14;
1185 while (j) {
1186 j >>= 1;
1187 if (dup2(0, i) < 0) {
1188 i -= j;
1189 } else {
1190 close(i);
1191 i += j;
1192 }
1193 }
1194 i++;
635e6242 1195 fp = fopen("conftestval", "w");
1196 fprintf (fp, "%d\n", i);
234967c9 1197 exit(0);
1198}
1199],
431d84c5 1200SQUID_MAXFD=`cat conftestval`,
1201SQUID_MAXFD=256,
1202SQUID_MAXFD=256)
1203AC_MSG_RESULT($SQUID_MAXFD)
1204AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
b9cc811d 1205if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 1206 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
1207 echo " cache will be very busy. Please see the FAQ page"
043e3d78 1208 echo " http://squid.nlanr.net/Squid/FAQ/FAQ-11.html#filedescriptors"
e692ff35 1209 echo " on how to increase your filedescriptor limit"
933cc58d 1210 sleep 10
80ab193b 1211fi
c76d8acc 1212LDFLAGS="$TLDFLAGS"
234967c9 1213
5c51415d 1214dnl Not cached since people are likely to tune this
30a4f2a8 1215AC_MSG_CHECKING(Default UDP send buffer size)
1216AC_TRY_RUN([
8cca06da 1217#include <stdlib.h>
1218#include <stdio.h>
30a4f2a8 1219#include <sys/types.h>
1220#include <sys/socket.h>
1221#include <netinet/in.h>
1222main ()
1223{
635e6242 1224 FILE *fp;
30a4f2a8 1225 int fd,val=0,len=sizeof(int);
1226 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
1227 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
1228 if (val<=0) exit(1);
635e6242 1229 fp = fopen("conftestval", "w");
1230 fprintf (fp, "%d\n", val);
30a4f2a8 1231 exit(0);
1232}
1233],
1234SQUID_UDP_SO_SNDBUF=`cat conftestval`,
1c481e00 1235SQUID_UDP_SO_SNDBUF=16384,
1236SQUID_UDP_SO_SNDBUF=16384)
30a4f2a8 1237AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
1238AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
1239
5c51415d 1240dnl Not cached since people are likely to tune this
30a4f2a8 1241AC_MSG_CHECKING(Default UDP receive buffer size)
1242AC_TRY_RUN([
8cca06da 1243#include <stdlib.h>
1244#include <stdio.h>
30a4f2a8 1245#include <sys/types.h>
1246#include <sys/socket.h>
1247#include <netinet/in.h>
1248main ()
1249{
635e6242 1250 FILE *fp;
30a4f2a8 1251 int fd,val=0,len=sizeof(int);
1252 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
1253 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1254 if (val <= 0) exit(1);
635e6242 1255 fp = fopen("conftestval", "w");
1256 fprintf (fp, "%d\n", val);
30a4f2a8 1257 exit(0);
1258}
1259],
1260SQUID_UDP_SO_RCVBUF=`cat conftestval`,
1c481e00 1261SQUID_UDP_SO_RCVBUF=16384,
1262SQUID_UDP_SO_RCVBUF=16384)
30a4f2a8 1263AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
1264AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
1265
5c51415d 1266dnl Not cached since people are likely to tune this
30a4f2a8 1267AC_MSG_CHECKING(Default TCP send buffer size)
1268AC_TRY_RUN([
8cca06da 1269#include <stdlib.h>
1270#include <stdio.h>
30a4f2a8 1271#include <sys/types.h>
1272#include <sys/socket.h>
1273#include <netinet/in.h>
1274main ()
1275{
635e6242 1276 FILE *fp;
30a4f2a8 1277 int fd,val=0,len=sizeof(int);
1278 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1279 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
1280 if (val <= 0) exit(1);
635e6242 1281 fp = fopen("conftestval", "w");
1282 fprintf (fp, "%d\n", val);
30a4f2a8 1283 exit(0);
1284}
1285],
1286SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 1287SQUID_TCP_SO_SNDBUF=16384,
1288SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 1289AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
1290AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
1291
5c51415d 1292dnl Not cached since people are likely to tune this
30a4f2a8 1293AC_MSG_CHECKING(Default TCP receive buffer size)
1294AC_TRY_RUN([
8cca06da 1295#include <stdlib.h>
1296#include <stdio.h>
30a4f2a8 1297#include <sys/types.h>
1298#include <sys/socket.h>
1299#include <netinet/in.h>
1300main ()
1301{
635e6242 1302 FILE *fp;
30a4f2a8 1303 int fd,val=0,len=sizeof(int);
1304 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1305 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1306 if (val <= 0) exit(1);
635e6242 1307 fp = fopen("conftestval", "w");
1308 fprintf (fp, "%d\n", val);
30a4f2a8 1309 exit(0);
1310}
1311],
1312SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 1313SQUID_TCP_SO_RCVBUF=16384,
1314SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 1315AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
1316AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
1317
5c51415d 1318AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
9bc73deb 1319 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist;],
5c51415d 1320 ac_cv_needs_sys_errlist="no",
1321 ac_cv_needs_sys_errlist="yes")
1322)
1323if test "$ac_cv_needs_sys_errlist" = "yes" ; then
1324 AC_DEFINE(NEED_SYS_ERRLIST)
1325fi
30a4f2a8 1326
5c51415d 1327dnl Not cached since people are likely to change this
6bf65235 1328AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
1329AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
1330[AC_MSG_RESULT(yes)
1331AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
1332AC_MSG_RESULT(no))
1333
a937d5e3 1334AC_MSG_CHECKING(if inet_ntoa() actually works)
1335AC_TRY_RUN([
1336#include <stdlib.h>
1337#include <stdio.h>
1338#include <sys/types.h>
1339#include <netinet/in.h>
1340#include <arpa/inet.h>
1341main ()
1342{
635e6242 1343 FILE *fp;
a937d5e3 1344 struct in_addr in;
1345 in.s_addr = inet_addr("1.2.3.4");
635e6242 1346 fp = fopen("conftestval", "w");
1347 fprintf (fp, "%s\n", inet_ntoa(in));
a937d5e3 1348 exit(0);
1349}
1350],
1351INET_NTOA_RESULT=`cat conftestval`,
1352INET_NTOA_RESULT="broken",
1353INET_NTOA_RESULT="broken")
1354if test "$INET_NTOA_RESULT" = "1.2.3.4" ; then
1355 AC_MSG_RESULT("yes")
1356else
1357 AC_MSG_RESULT("no")
b6a2f15e 1358 echo "Will use our own inet_ntoa()."
1359 LIBOBJS="$LIBOBJS inet_ntoa.o"
1360# echo "WARNING: This looks bad, and probably prevents Squid from working."
1361# echo " If you're on IRIX and using GCC 2.8, you probably need"
1362# echo " to use the IRIX C compiler instead."
1363# sleep 10
a937d5e3 1364fi
1365
b6a2f15e 1366if test "$ac_cv_header_sys_statvfs_h" = "yes" ; then
c68e9c6b 1367AC_MSG_CHECKING(for working statvfs() interface)
1368AC_TRY_COMPILE([
1369#include <stdlib.h>
1370#include <stdio.h>
1371#include <sys/types.h>
1372#include <sys/statvfs.h>
1373],
1374[
1375struct statvfs sfs;
1376sfs.f_blocks = sfs.f_bfree = sfs.f_frsize =
1377sfs.f_files = sfs.f_ffree = 0;
1378statvfs("/tmp", &sfs);
1379],
1380 ac_cv_func_statvfs=yes,
1381 ac_cv_func_statvfs=no)
1382AC_MSG_RESULT($ac_cv_func_statvfs)
6b8e7481 1383if test "$ac_cv_func_statvfs" = "yes" ; then
b6a2f15e 1384 AC_DEFINE(HAVE_STATVFS)
1385fi
6b8e7481 1386fi
c68e9c6b 1387
1388AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list,
1389AC_TRY_COMPILE([
1390#if HAVE_SYS_TYPES_H
1391#include <sys/types.h>
1392#endif
1393#if HAVE_NETINET_IN_H
1394#include <netinet/in.h>
1395#endif
1396#if HAVE_ARPA_INET_H
1397#include <arpa/inet.h>
1398#endif
1399#if HAVE_ARPA_NAMESER_H
1400#include <arpa/nameser.h>
1401#endif
1402#if HAVE_RESOLV_H
1403#include <resolv.h>
1404#endif
1405],
1406[_res.nsaddr_list[[0]];],
1407ac_cv_have_res_nsaddr_list="yes",
1408ac_cv_have_res_nsaddr_list="no"))
1409if test $ac_cv_have_res_nsaddr_list = "yes" ; then
1410 AC_DEFINE(HAVE_RES_NSADDR_LIST)
1411fi
1412
1413if test $ac_cv_have_res_nsaddr_list = "no" ; then
1414AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list,
1415AC_TRY_COMPILE([
1416#if HAVE_SYS_TYPES_H
1417#include <sys/types.h>
1418#endif
1419#if HAVE_NETINET_IN_H
1420#include <netinet/in.h>
1421#endif
1422#if HAVE_ARPA_INET_H
1423#include <arpa/inet.h>
1424#endif
1425#if HAVE_ARPA_NAMESER_H
1426#include <arpa/nameser.h>
1427#endif
1428#if HAVE_RESOLV_H
1429#include <resolv.h>
1430#endif
1431],
1432[_res.ns_list[[0]].addr;],
1433ac_cv_have_res_ns_list="yes",
1434ac_cv_have_res_ns_list="no"))
1435if test $ac_cv_have_res_ns_list = "yes" ; then
1436 AC_DEFINE(HAVE_RES_NS_LIST)
1437fi
1438fi
1439
090089c4 1440dnl Need the debugging version of malloc if available
1441XTRA_OBJS=''
6509a1a0 1442if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 1443 if test -r /usr/lib/debug/malloc.o ; then
1444 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
1445 fi
1446 if test -r /usr/lib/debug/mallocmap.o ; then
1447 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
1448 fi
1449fi
2bbd722b 1450
090089c4 1451AC_SUBST(XTRA_OBJS)
1452
38fea766 1453if test -z "$XTRA_LIBS"; then
1454 XTRA_LIBS="$LIBS"
0f5a16f8 1455 dnl -lcrypt is set in CRYPTLIB
1456 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lcrypt//"`
1457 dnl -lpthread is set in PTHREADLIB
1458 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lpthread//"`
1459 dnl minor cleanup
1460 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 1461 LIBS=''
1462fi
090089c4 1463AC_SUBST(XTRA_LIBS)
1464
090089c4 1465dnl Clean up after OSF/1 core dump bug
1466rm -f core
1467
1468AC_OUTPUT(\
0992a350 1469 ./makefile \
090089c4 1470 ./lib/Makefile \
a26bdc75 1471 ./include/config.h \
090089c4 1472 ./scripts/Makefile \
1473 ./scripts/RunCache \
1474 ./scripts/RunAccel \
a26bdc75 1475 ./src/Makefile \
e550e8b6 1476 ./contrib/Makefile \
8a7f0105 1477 $SNMP_MAKEFILE \
81280a96 1478 ./icons/Makefile \
d4fb069d 1479 ./errors/Makefile \
e7814e83 1480 ./auth_modules/dummy \
dbfa0154 1481 ./auth_modules/NCSA/Makefile \
bf10b227 1482 ./auth_modules/PAM/Makefile \
1483 ./auth_modules/SMB/Makefile
b6a2f15e 1484 ./auth_modules/getpwnam/Makefile \
9bc73deb 1485 ./auth_modules/LDAP/Makefile \
090089c4 1486)