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