]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
added counters for cleaned store files and unlinked files
[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
b672a532 6dnl $Id: configure.in,v 1.150 1998/09/22 17:45:25 wessels Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
a26bdc75 10AC_INIT(src/main.c)
090089c4 11AC_CONFIG_HEADER(include/autoconf.h)
b672a532 12AC_REVISION($Revision: 1.150 $)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
31cygwin32)
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 ;;
98 *)
99 ;;
100 esac
30a4f2a8 101 fi
30a4f2a8 102fi
103
104dnl Set LDFLAGS
105if test -z "$PRESET_LDFLAGS"; then
106 if test "$GCC" = "yes"; then
107 case "$host" in
108 *)
109 # nothing
110 ;;
111 esac
81a820c6 112 else
113 case "$host" in
114 *mips-sgi-irix6.4*)
115 # suggested by Rafael Seidl <rafaels@cthulhu.engr.sgi.com>
116 LDFLAGS="-n32 -mips4 -nostdlib -L/usr/lib32"
117 ;;
118 esac
30a4f2a8 119 fi
120fi
2060fa9a 121
e5f4e1b0 122dnl Enable optional modules
123AC_ARG_ENABLE(dlmalloc,
94d48591 124[ --enable-dlmalloc[=LIB] Compile & use the malloc package by Doug Lea],
e5f4e1b0 125[
94d48591 126 if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
127 # Ok. dlmalloc was enabled before, but state may be changed.
e5f4e1b0 128 # we have to test these again
129 unset ac_cv_func_mallinfo
130 unset ac_cv_func_mallocblksize
131 unset ac_cv_func_free
132 unset ac_cv_func_realloc
133 unset ac_cv_func_memalign
134 unset ac_cv_func_valloc
135 unset ac_cv_func_pvalloc
136 unset ac_cv_func_calloc
137 unset ac_cv_func_cfree
138 unset ac_cv_func_malloc_trim
139 unset ac_cv_func_malloc_usable_size
140 unset ac_cv_func_malloc_stats
141 unset ac_cv_func_mallinfo
142 unset ac_cv_func_mallopt
143 unset ac_cv_lib_gnumalloc
144 unset ac_cv_lib_malloc
145 unset ac_cv_enabled_dlmalloc
146 fi
94d48591 147 case "$enableval" in
148 'yes')
149 LIBDLMALLOC="libdlmalloc.a"
150 LIB_MALLOC="-L../lib -ldlmalloc"
151 ac_cv_func_mallinfo="yes"
152 ac_cv_func_mallocblksize="no"
153 ac_cv_func_free="yes"
154 ac_cv_func_realloc="yes"
155 ac_cv_func_memalign="yes"
156 ac_cv_func_valloc="yes"
157 ac_cv_func_pvalloc="yes"
158 ac_cv_func_calloc="yes"
159 ac_cv_func_cfree="yes"
160 ac_cv_func_malloc_trim="yes"
161 ac_cv_func_malloc_usable_size="yes"
162 ac_cv_func_malloc_stats="yes"
163 ac_cv_func_mallinfo="yes"
164 ac_cv_func_mallopt="yes"
165 ac_cv_lib_gnumalloc="no"
166 ac_cv_lib_malloc="no"
167 ac_cv_enabled_dlmalloc="yes"
168 echo "dlmalloc build enabled"
169 ;;
170 'no')
171 # Disabled explicitly.
172 echo "dlmalloc disabled."
173 ;;
174 *)
175 # Use already installed dlmalloc library.
176 LIB_MALLOC="${enableval}"
177 ac_cv_func_mallinfo="yes"
178 ac_cv_func_mallocblksize="no"
179 ac_cv_func_free="yes"
180 ac_cv_func_realloc="yes"
181 ac_cv_func_memalign="yes"
182 ac_cv_func_valloc="yes"
183 ac_cv_func_pvalloc="yes"
184 ac_cv_func_calloc="yes"
185 ac_cv_func_cfree="yes"
186 ac_cv_func_malloc_trim="yes"
187 ac_cv_func_malloc_usable_size="yes"
188 ac_cv_func_malloc_stats="yes"
189 ac_cv_func_mallinfo="yes"
190 ac_cv_func_mallopt="yes"
191 ac_cv_lib_gnumalloc="no"
192 ac_cv_lib_malloc="no"
193 ac_cv_enabled_dlmalloc="yes"
194 echo "Use installed dlmalloc."
195 ;;
196 esac
e5f4e1b0 197 ],[
198 if test "x$ac_cv_enabled_dlmalloc" = "xyes"; then
199 # Ok. dlmalloc was enabled before, but now disabled.
200 # we have to test these again
201 unset ac_cv_func_mallinfo
202 unset ac_cv_func_mallocblksize
203 unset ac_cv_func_free
204 unset ac_cv_func_realloc
205 unset ac_cv_func_memalign
206 unset ac_cv_func_valloc
207 unset ac_cv_func_pvalloc
208 unset ac_cv_func_calloc
209 unset ac_cv_func_cfree
210 unset ac_cv_func_malloc_trim
211 unset ac_cv_func_malloc_usable_size
212 unset ac_cv_func_malloc_stats
213 unset ac_cv_func_mallinfo
214 unset ac_cv_func_mallopt
215 unset ac_cv_lib_gnumalloc
216 unset ac_cv_lib_malloc
217 unset ac_cv_enabled_dlmalloc
218 fi
219 ])
220AC_SUBST(LIBDLMALLOC)
221AC_SUBST(LIB_MALLOC)
222
223AC_ARG_ENABLE(gnuregex,
224[ --enable-gnuregex Compile GNUregex],
225[USE_GNUREGEX=$enableval])
226
e5f4e1b0 227AC_ARG_ENABLE(xmalloc_debug,
228[ --enable-xmalloc-debug Do some simple malloc debugging],
229[ if test "$enableval" = "yes" ; then
230 echo "Malloc debugging enabled"
231 AC_DEFINE(XMALLOC_DEBUG)
232 fi
233])
234
027acbaf 235AC_ARG_ENABLE(xmalloc_debug_trace,
236[ --enable-xmalloc-debug-trace
e5f4e1b0 237 Detailed trace of memory allocations],
238[ if test "$enableval" = "yes" ; then
027acbaf 239 echo "Malloc debug trace enabled"
240 AC_DEFINE(XMALLOC_TRACE)
241 AC_DEFINE(XMALLOC_DEBUG)
e5f4e1b0 242 fi
243])
244
245AC_ARG_ENABLE(xmalloc_statistics,
246[ --enable-xmalloc-statistics
247 Show malloc statistics in status page],
248[ if test "$enableval" = "yes" ; then
249 echo "Malloc statistics enabled"
250 AC_DEFINE(XMALLOC_STATISTICS)
251 fi
252])
253
323fe0d4 254AC_ARG_ENABLE(carp,
255[ --enable-carp Enable CARP support],
256[ if test "$enableval" = "yes" ; then
257 echo "CARP support enabled"
258 AC_DEFINE(USE_CARP)
259 fi
260])
261
e5f4e1b0 262AC_ARG_ENABLE(async_io,
263[ --enable-async-io Do ASYNC disk I/O using threads],
264[ if test "$enableval" = "yes" ; then
265 echo "Async I/O enabled"
266 AC_DEFINE(USE_ASYNC_IO)
267 ASYNC_OBJS='$(ASYNC_OBJS)'
9fc0b4b8 268 SQUID_PTHREAD_LIB='$(PTHREADLIB)'
269 CFLAGS="$CFLAGS -D_REENTRANT"
e5f4e1b0 270 fi
271])
272AC_SUBST(ASYNC_OBJS)
273AC_SUBST(SQUID_PTHREAD_LIB)
274
275AC_ARG_ENABLE(icmp,
276[ --enable-icmp Enable ICMP pinging],
277[ if test "$enableval" = "yes" ; then
278 echo "ICMP enabled"
279 AC_DEFINE(USE_ICMP)
280 fi
281])
282
95e36d02 283AC_ARG_ENABLE(delay_pools,
284[ --enable-delay-pools Enable delay pools to limit bandwith usage],
e5f4e1b0 285[ if test "$enableval" = "yes" ; then
95e36d02 286 echo "Delay pools enabled"
287 DELAY_OBJS='$(DELAY_OBJS)'
288 AC_DEFINE(DELAY_POOLS)
e5f4e1b0 289 fi
290])
95e36d02 291AC_SUBST(DELAY_OBJS)
e5f4e1b0 292
36a97e19 293AC_ARG_ENABLE(mem-gen-trace,
294[ --enable-mem-gen-trace Do trace of memory stuff],
295[ if test "$enableval" = "yes" ; then
296 echo "Memory trace (to file) enabled"
297 AC_DEFINE(MEM_GEN_TRACE)
298 fi
299])
300
e5f4e1b0 301AC_ARG_ENABLE(useragent_log,
302[ --enable-useragent-log Enable logging of User-Agent header],
303[ if test "$enableval" = "yes" ; then
304 echo "User-Agent logging enabled"
305 AC_DEFINE(USE_USERAGENT_LOG)
306 fi
307])
308
9fc0b4b8 309AC_ARG_ENABLE(kill_parent_hack,
310[ --enable-kill-parent-hack
311 Kill parent on shutdown],
e5f4e1b0 312[ if test "$enableval" = "yes" ; then
313 echo "Kill parent on shutdown"
314 AC_DEFINE(KILL_PARENT_OPT)
315 fi
316])
317
318AC_ARG_ENABLE(snmp,
319[ --enable-snmp Enable SNMP monitoring],
320[ if test "$enableval" = "yes" ; then
321 echo "SNMP monitoring enabled"
322 AC_DEFINE(SQUID_SNMP)
323 SNMPLIB='-L../snmplib -lsnmp'
324 SNMP_OBJS='$(SNMP_OBJS)'
8a7f0105 325 SNMP_MAKEFILE=./snmplib/Makefile
e5f4e1b0 326 makesnmplib=snmplib
327 fi
328])
329AC_SUBST(SNMPLIB)
330AC_SUBST(SNMP_OBJS)
331AC_SUBST(makesnmplib)
332
333AC_ARG_ENABLE(time_hack,
334[ --enable-time-hack Update internal timestamp only once per second],
335[ if test "$enableval" = "yes" ; then
336 echo "Update internal timestamp only once per second"
337 AC_DEFINE(ALARM_UPDATES_TIME)
338 fi
339])
340
341AC_ARG_ENABLE(cachemgr_hostname,
342[ --enable-cachemgr-hostname[=hostname]
343 Make cachemgr.cgi default to this host],
344[ case $enableval in
345 yes)
346 AC_DEFINE(CACHEMGR_HOSTNAME,[getfullhostname()])
347 echo "Cachemgr default hostname == host where cachemgr runs"
348 ;;
349 no)
350 : # Nothing to do..
351 ;;
352 *)
353 AC_DEFINE_UNQUOTED(CACHEMGR_HOSTNAME,"${enableval}")
354 echo "Cachemgr default hostname set to ${enableval}"
355 ;;
356 esac
357])
358
359AC_ARG_ENABLE(arp_acl,
360[ --enable-arp-acl Enable use of ARP ACL lists (ether address)],
361[ if test "$enableval" = "yes" ; then
362 echo "ARP ACL lists enabled (ether address)"
933cc58d 363 case "$host" in
a931a29b 364 *-pc-linux-*)
365 ;;
933cc58d 366 *)
bd0c865a 367 echo "WARNING: ARP ACL support is only currently supported on Linux"
368 echo " ethernet interfaces, probably won't work on $host."
933cc58d 369 sleep 10
370 ;;
371 esac
e5f4e1b0 372 AC_DEFINE(USE_ARP_ACL)
373 fi
374])
375
74075210 376AC_ARG_ENABLE(htcp,
88b7de25 377[ --enable-htcp Enable HTCP protocol],
b4b8b6da 378[ if test "$enableval" = "yes" ; then
379 echo "HTCP enabled"
380 HTCP_OBJS='$(HTCP_OBJS)'
381 AC_DEFINE(USE_HTCP)
382 fi
74075210 383])
b4b8b6da 384AC_SUBST(HTCP_OBJS)
74075210 385
02749868 386AC_ARG_ENABLE(forw-via-db,
387[ --enable-forw-via-db Enable Forw/Via database],
388[ if test "$enableval" = "yes" ; then
389 echo "FORW-VIA enabled"
390 AC_DEFINE(FORW_VIA_DB)
391 fi
392])
393
6cfa8966 394AC_ARG_ENABLE(cache-digests,
22df58ea 395[ --enable-cache-digests Use Cache Digests
043e3d78 396 see http://squid.nlanr.net/Squid/FAQ/FAQ-16.html],
484f2ebc 397[ if test "$enableval" = "yes" ; then
6cfa8966 398 echo "USE_CACHE_DIGESTS enabled"
399 AC_DEFINE(USE_CACHE_DIGESTS)
484f2ebc 400 fi
401])
402
933cc58d 403dnl Select Error language
404AC_ARG_ENABLE(err-language,
405[ --enable-err-language=lang
406 Select language for Error pages (see errors dir) ],
407[
408 if test -d errors/$enableval; then
409 ERR_LANGUAGE=$enableval
410 else
411 echo "ERROR! Unknown language $enableval, see errors/"
412 exit 1
413 fi
93a8bb45 414],[ERR_LANGUAGE="English"])
933cc58d 415AC_SUBST(ERR_LANGUAGE)
416
9bb83c8b 417dnl Enable poll()
418AC_ARG_ENABLE(poll,
419[ --enable-poll Enable poll() instead of select(). Normally poll
420 is preferred over select, but configure knows poll
421 is broken on some platforms. If you think you are
422 smarter than the configure script, you may enable
423 poll with this option.
424],
425[ if test "$enableval" = "yes" ; then
426 echo "Forcing poll() to be enabled"
427 ac_cv_func_poll='yes'
428 fi
429])
430
72fd085a 431dnl Disable HTTP violations
432AC_ARG_ENABLE(http-violations,
433[ --disable-http-violations
434 This allows you to remove code which is known to
435 violate the HTTP protocol specification.
436],
437[ if test "$enableval" = "no" ; then
438 echo "Disabling HTTP Violations"
6eec93b2 439 AC_DEFINE(HTTP_VIOLATIONS, 0)
72fd085a 440 else
6eec93b2 441 AC_DEFINE(HTTP_VIOLATIONS, 1)
72fd085a 442 fi
443])
444
fd9aaa3e 445# Force some compilers to use ANSI features
446#
447case "$host" in
448 alpha-dec-osf*)
449 if test "$ac_cv_prog_CC" = "cc" ; then
450 echo "adding '-std1' to cc args for $host"
451 CC="cc -std1";
452 ac_cv_prog_CC="$CC"
453 fi
454 ;;
455esac
456
090089c4 457dnl Check for programs
458AC_PROG_CPP
459AC_PROG_INSTALL
460AC_PROG_RANLIB
461AC_PROG_LN_S
81280a96 462AC_PATH_PROG(SH, sh, /bin/sh)
d9f67e6f 463AC_PATH_PROG(FALSE, false, /usr/bin/false)
464AC_PATH_PROG(TRUE, true, /usr/bin/true)
465AC_PATH_PROG(RM, rm, $FALSE)
466AC_PATH_PROG(MV, mv, $FALSE)
467AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 468AC_PATH_PROG(LN, ln, cp)
983061ed 469AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
d9f67e6f 470AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
6ad85e8a 471AC_PATH_PROG(AR, ar, $FALSE)
472
473case "$host" in
474 *-hp-hpux*)
475 echo "Disabling 'ranlib' for HP-UX..."
476 RANLIB=":"
477 ;;
478esac
479
480dnl set $(AR)
481AR_R="$AR r"
482case "$host" in
483 *-next-nextstep3)
484 AR="libtool -o"
485 ;;
486esac
487AC_SUBST(AR_R)
090089c4 488
489dnl Check for headers
490AC_HEADER_DIRENT
491AC_HEADER_STDC
db40ae20 492
493AC_CHECK_HEADERS( \
494 alloca.h \
495 arpa/inet.h \
30a4f2a8 496 arpa/nameser.h \
9441aa34 497 assert.h \
db40ae20 498 bstring.h \
499 config.h \
500 crypt.h \
30a4f2a8 501 ctype.h \
502 errno.h \
db40ae20 503 fcntl.h \
9c1d8929 504 getopt.h \
88738790 505 gnumalloc.h \
30a4f2a8 506 grp.h \
507 libc.h \
6ad85e8a 508 limits.h \
30a4f2a8 509 malloc.h \
e0bddc45 510 math.h \
db40ae20 511 memory.h \
30a4f2a8 512 netdb.h \
db40ae20 513 netinet/in.h \
30a4f2a8 514 netinet/tcp.h \
dcfe6390 515 poll.h \
30a4f2a8 516 pwd.h \
517 regex.h \
518 resolv.h \
519 signal.h \
520 stdarg.h \
521 stddef.h \
522 stdio.h \
db40ae20 523 stdlib.h \
524 string.h \
525 strings.h \
526 sys/file.h \
30a4f2a8 527 sys/param.h \
528 sys/resource.h \
db40ae20 529 sys/select.h\
30a4f2a8 530 sys/socket.h \
531 sys/stat.h \
b672a532 532 sys/statfs.h \
30a4f2a8 533 sys/syscall.h \
db40ae20 534 sys/time.h \
535 sys/types.h \
30a4f2a8 536 sys/un.h \
537 sys/wait.h \
db40ae20 538 syslog.h \
30a4f2a8 539 time.h \
540 unistd.h \
541 varargs.h \
db40ae20 542)
543
aee0606f 544AC_C_CONST
d57288d2 545AC_C_BIGENDIAN
aee0606f 546
5c51415d 547AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [
548 AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
549 [foo("bar")],
550 ac_cv_have_ansi_prototypes="yes",
551 ac_cv_have_ansi_prototypes="no")
552])
553if test $ac_cv_have_ansi_prototypes = "yes" ; then
554 AC_DEFINE(HAVE_ANSI_PROTOTYPES)
555fi
20a50bb9 556
5c51415d 557AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [
558 AC_TRY_COMPILE([#include <time.h>
46c883ed 559#include <sys/time.h>],
5c51415d 560 [struct tm foo;
561 foo.tm_gmtoff = 0;],
562 ac_cv_have_tm_gmoff="yes",
563 ac_cv_have_tm_gmoff="no")
564])
565if test $ac_cv_have_tm_gmoff = "yes" ; then
566 AC_DEFINE(HAVE_TM_GMTOFF)
567fi
46c883ed 568
5c51415d 569AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [
570 AC_TRY_COMPILE([#include <sys/types.h>
46c883ed 571#include <malloc.h>],
5c51415d 572 [struct mallinfo foo;
573 foo.mxfast = 0;],
574 ac_cv_have_ext_mallinfo="yes",
575 ac_cv_have_ext_mallinfo="no")
576])
577if test $ac_cv_have_ext_mallinfo = "yes" ; then
578 AC_DEFINE(HAVE_EXT_MALLINFO)
579fi
090089c4 580
b54a6789 581AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [
582 AC_TRY_COMPILE([
8ff51bba 583#if HAVE_SYS_TIME_H
584#include <sys/time.h>
585#endif
b54a6789 586#if HAVE_SYS_RESOURCE_H
587#include <sys/resource.h>
588#endif],
589 [struct rusage R;],
590 ac_cv_have_struct_rusage="yes",
591 ac_cv_have_struct_rusage="no")
592])
593if test $ac_cv_have_struct_rusage = "yes" ; then
594 AC_DEFINE(HAVE_STRUCT_RUSAGE)
595fi
596
5c51415d 597AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [
598 AC_TRY_COMPILE([#include <sys/types.h>
a025a745 599#include <netinet/in.h>
600#include <netinet/in_systm.h>
6ad85e8a 601#include <netinet/ip.h>
602#ifdef __linux__
603#define ip_hl ihl
604#endif
605#ifndef __linux__
606#define iphdr ip
607#endif],
5c51415d 608 [struct iphdr ip;
609 ip.ip_hl= 0;],
610 ac_cv_have_ip_hl="yes",
611 ac_cv_have_ip_hl="no")
612])
613if test $ac_cv_have_ip_hl = "yes" ; then
614 AC_DEFINE(HAVE_IP_HL)
615fi
a025a745 616
090089c4 617dnl Check for typedefs
618AC_CHECK_SIZEOF(int)
619AC_CHECK_SIZEOF(long)
620
256cf05b 621dnl Check for special functions
622AC_FUNC_ALLOCA
090089c4 623
3f6fcd8a 624AC_CHECK_TYPE(pid_t, int)
0897af2d 625AC_CHECK_TYPE(size_t, unsigned int)
626AC_CHECK_TYPE(ssize_t, int)
3f6fcd8a 627AC_CHECK_TYPE(off_t, int)
95cf2361 628AC_CHECK_TYPE(mode_t, u_short)
3f6fcd8a 629
6637e3a5 630dnl Check for type in sys/socket.h
631AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
632 AC_EGREP_CPP([socklen_t[^a-zA-Z_0-9]], [#include <sys/types.h>
633#include <sys/socket.h>
634#if STDC_HEADERS
635#include <stdlib.h>
636#include <stddef.h>
637#endif],
638 ac_cv_type_socklen_t=yes,
639 ac_cv_type_socklen_t=no)
640])
641if test $ac_cv_type_socklen_t = no; then
642 AC_DEFINE(socklen_t, int)
643fi
644
090089c4 645dnl Check for needed libraries
30a4f2a8 646AC_CHECK_LIB(nsl, main)
6716b242 647AC_CHECK_LIB(socket, main)
94d48591 648
649if test "x$ac_cv_enabled_dlmalloc" = "xyes" ; then
650 echo "skipping libmalloc check (--enable-dlmalloc specified)"
5c51415d 651else
94d48591 652 AC_CHECK_LIB(gnumalloc, main)
653 if test "$ac_cv_lib_gnumalloc_main" = "yes"; then
654 echo "Disabling extended malloc functions when using gnumalloc"
655 ac_cv_func_mallinfo=no
656 ac_cv_func_mallocblksize=no
657 ac_cv_func_mallopt=no
658 else
659 case "$host" in
660 *-sun-solaris*)
661 echo "skipping libmalloc check for $host"
662 ;;
663 i386-*-freebsd*)
664 echo "skipping libmalloc check for $host"
665 ;;
666 *)
667
668 AC_CHECK_LIB(malloc, main)
669 ;;
670 esac
671 fi
8a15e65e 672fi
94d48591 673
6716b242 674AC_CHECK_LIB(bsd, main)
be79ade0 675AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
04a56fa3 676AC_CHECK_LIB(bind, gethostbyname)
677if test $ac_cv_lib_bind_gethostbyname = "no" ; then
678 case "$host" in
78743365 679 i386-*-freebsd*)
680 echo "skipping libresolv checks for $host"
681 ;;
682 *)
683 AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
684 AC_CHECK_LIB(resolv, main)
685 ;;
04a56fa3 686 esac
687fi
e0bddc45 688AC_CHECK_LIB(m, main)
090089c4 689
690dnl Check for libcrypt
b8de7ebe 691dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
0f5a16f8 692AC_CHECK_LIB(crypt, crypt)
693if test $ac_cv_lib_crypt_crypt = "yes"; then
694 CRYPTLIB="-lcrypt"
695fi
be79ade0 696AC_SUBST(CRYPTLIB)
77f675ad 697
e5f4e1b0 698dnl Check for pthreads
699dnl We use pthreads when doing ASYNC I/O
0f5a16f8 700AC_CHECK_LIB(pthread, main)
701if test $ac_cv_lib_pthread_main = "yes"; then
702 PTHREADLIB="-lpthread"
703fi
71f8abc8 704AC_SUBST(PTHREADLIB)
705
77f675ad 706dnl System-specific library modifications
707dnl
708case "$host" in
88738790 709 i386-*-solaris2.*)
7149a49f 710 if test "$GCC" = "yes"; then
711 echo "Removing -O for gcc on $host"
80e92d6d 712 CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`"
7149a49f 713 fi
714 ;;
77f675ad 715 *-sgi-irix*)
716 echo "Removing -lsocket for IRIX..."
6716b242 717 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 718 echo "Removing -lnsl for IRIX..."
6716b242 719 LIBS=`echo $LIBS | sed -e s/-lnsl//`
b44c0fb4 720 echo "Removing -lbsd for IRIX..."
721 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 722 ;;
4ba0bd0e 723dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
724dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
725dnl Please change your configure script. AIX doesn't need -lbsd.
726 *-ibm-aix*)
727 echo "Removing -lbsd for AIX..."
728 LIBS=`echo $LIBS | sed -e s/-lbsd//`
729 ;;
30a4f2a8 730 *m88k*)
731 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
7149a49f 732 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
733 ;;
580ce039 734 [*-*-solaris2.[0-4]])
7149a49f 735 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
30a4f2a8 736 ;;
f62c73dc 737 *-sony-newsos[56]*)
738 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
739 ;;
77f675ad 740esac
090089c4 741
176d10ee 742# Recommended by Balint Nagy Endre <bne@CareNet.hu>
743case "$host" in
744 *-univel-sysv4.2MP)
745 if test `uname -v` = "2.03"; then
746 echo "disabling mallinfo for $host"
747 ac_cv_func_mallinfo=no
748 fi
749 ;;
750esac
751
84cecfd2 752dnl This has to be before AC_CHECK_FUNCS
753# Disable poll() on certain platforms. Override by setting ac_cv_func_poll
754# when running configure.
755if test -z "$ac_cv_func_poll"; then
756 case "$host" in
757 [alpha-dec-osf3.*])
758 # John Kay (jkay@nlanr.net) 19970818
759 echo "disabling poll for $host..."
760 ac_cv_func_poll='no'
761 ;;
762 [*-hp-hpux*.*])
763 # Duane Wessels
764 echo "disabling poll for $host..."
765 ac_cv_func_poll='no'
766 ;;
767 [*-linux-*])
9bb83c8b 768 # Henrik Nordstrom (hno@hem.passagen.se) 19980817
769 # poll is problematic on Linux. We disable it
770 # by default until Linux gets it right.
771 echo "disabling poll for $host..."
772 ac_cv_func_poll='no'
84cecfd2 773 ;;
774 esac
775fi
176d10ee 776
6716b242 777dnl Check for library functions
778AC_CHECK_FUNCS(\
30a4f2a8 779 bcopy \
df087e68 780 crypt \
4ac29a5b 781 fchmod \
6716b242 782 getdtablesize \
8505e57b 783 getpagesize \
30a4f2a8 784 getrusage \
9c1d8929 785 getspnam \
30a4f2a8 786 lrand48 \
6716b242 787 mallinfo \
0f5efab0 788 mallocblksize \
6716b242 789 mallopt \
2ae6b9b0 790 memcpy \
30a4f2a8 791 memmove \
dac27377 792 memset \
1812b6c7 793 mktime \
88738790 794 mstats \
84cecfd2 795 poll \
b1e77ec1 796 random \
6716b242 797 regcomp \
798 regexec \
799 regfree \
30a4f2a8 800 res_init \
4915be3b 801 rint \
234967c9 802 seteuid \
30a4f2a8 803 setpgrp \
6716b242 804 setrlimit \
30a4f2a8 805 setsid \
806 sigaction \
11430c03 807 snprintf \
30a4f2a8 808 srand48 \
b1e77ec1 809 srandom \
6716b242 810 sysconf \
811 syslog \
0a3efad5 812 tempnam \
234967c9 813 timegm \
28da5e0d 814 vsnprintf \
6716b242 815)
816
60939927 817dnl Yay! Another Linux brokenness. Its not good enough
818dnl to know that setresuid() exists, because RedHat 5.0 declares
819dnl setresuid() but doesn't implement it.
820dnl
821AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid,
5c51415d 822 AC_TRY_RUN([
60939927 823#include <stdlib.h>
5c51415d 824 int main() {
825 if(setresuid(-1,-1,-1)) {
826 perror("setresuid:");
827 exit(1);
60939927 828 }
829 exit(0);
5c51415d 830 }
831 ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no")
60939927 832)
5c51415d 833if test "$ac_cv_func_setresuid" = "yes" ; then
834 AC_DEFINE(HAVE_SETRESUID)
835fi
60939927 836
91bc414e 837if test -z "$USE_GNUREGEX" ; then
838 case "$host" in
839 *-sun-solaris2.[[0-4]])
840 USE_GNUREGEX="yes"
841 ;;
842 *-next-nextstep*)
843 USE_GNUREGEX="yes"
844 ;;
845 esac
846fi
7a081912 847AC_MSG_CHECKING(if GNUregex needs to be compiled)
91bc414e 848if test -z "$USE_GNUREGEX"; then
55878dfd 849if test "$ac_cv_func_regcomp" = "no" || test "$USE_GNUREGEX" = "yes" ; then
74946a0f 850 USE_GNUREGEX="yes"
00fa2c12 851else
0cccc031 852 AC_TRY_COMPILE([#include <sys/types.h>
853#include <regex.h>],[regex_t t; regcomp(&t,"",0);],
91bc414e 854 USE_GNUREGEX="no",
855 USE_GNUREGEX="yes")
856fi
00fa2c12 857fi
74946a0f 858AC_MSG_RESULT($USE_GNUREGEX)
859if test "$USE_GNUREGEX" = "yes"; then
26675bf4 860 REGEXLIB="-lregex"
7a081912 861 LIBREGEX="libregex.a"
74946a0f 862 AC_DEFINE(USE_GNUREGEX)
7a081912 863fi
26675bf4 864AC_SUBST(REGEXLIB)
00fa2c12 865AC_SUBST(LIBREGEX)
7a081912 866
3f6fcd8a 867AC_REPLACE_FUNCS(\
868 tempnam \
4d38fc7e 869 strerror \
3f6fcd8a 870)
871
5c51415d 872dnl Not cached since people are likely to tune this
e924600d 873AC_MSG_CHECKING(Default FD_SETSIZE value)
874AC_TRY_RUN([
875#if HAVE_STDIO_H
876#include <stdio.h>
877#endif
878#if HAVE_UNISTD_H
879#include <unistd.h>
880#endif
881#if HAVE_SYS_TIME_H
882#include <sys/time.h>
883#endif
884#if HAVE_SYS_SELECT_H
885#include <sys/select.h>
886#endif
887#if HAVE_SYS_TYPES_H
888#include <sys/types.h>
889#endif
890main() {
891 fprintf (fopen("conftestval", "w"), "%d\n", FD_SETSIZE);
892 exit(0);
893}
894],
895DEFAULT_FD_SETSIZE=`cat conftestval`,
896DEFAULT_FD_SETSIZE=256,
897DEFAULT_FD_SETSIZE=256)
898AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
899AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
900
5c51415d 901dnl Not cached since people are likely to tune this
234967c9 902AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
903AC_TRY_RUN([
8cca06da 904#include <stdio.h>
234967c9 905#include <unistd.h>
30a4f2a8 906#include <sys/time.h> /* needed on FreeBSD */
234967c9 907#include <sys/param.h>
908#include <sys/resource.h>
909main() {
910 int i,j;
df087e68 911#if __CYGWIN32__
912 /* getrlimit and sysconf returns bogous values on cygwin32.
913 * Number of fds is virtually unlimited in cygwin (sys/param.h)
914 */
915 i = NOFILE;
916#else
234967c9 917#if HAVE_SETRLIMIT
918 struct rlimit rl;
919#if defined(RLIMIT_NOFILE)
920 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
921 perror("getrlimit: RLIMIT_NOFILE");
922 } else {
923 rl.rlim_cur = rl.rlim_max; /* set it to the max */
924 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
925 perror("setrlimit: RLIMIT_NOFILE");
926 }
927 }
928#elif defined(RLIMIT_OFILE)
929 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
930 perror("getrlimit: RLIMIT_OFILE");
931 } else {
932 rl.rlim_cur = rl.rlim_max; /* set it to the max */
933 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
934 perror("setrlimit: RLIMIT_OFILE");
935 }
936 }
937#endif /* RLIMIT_NOFILE */
938#endif /* HAVE_SETRLIMIT */
939#if HAVE_SYSCONF && defined(_SC_OPEN_MAX)
940 i = sysconf(_SC_OPEN_MAX);
3f6fcd8a 941#elif HAVE_GETDTABLESIZE && !defined(__linux__)
234967c9 942 i = getdtablesize();
943#elif defined(OPEN_MAX)
944 i = OPEN_MAX;
945#elif defined(NOFILE)
946 i = NOFILE;
947#elif defined(_NFILE)
948 i = _NFILE;
949#else
950 while((j=open("/dev/null", 0)) > 0) i=j;
0a5b9b32 951 close(i); close(i-1);
952 i++;
234967c9 953#endif
df087e68 954#endif /* __CYGWIN32__ */
234967c9 955 fprintf (fopen("conftestval", "w"), "%d\n", i);
956 exit(0);
957}
958],
431d84c5 959SQUID_MAXFD=`cat conftestval`,
960SQUID_MAXFD=256,
961SQUID_MAXFD=256)
962AC_MSG_RESULT($SQUID_MAXFD)
963AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
b9cc811d 964if test "$SQUID_MAXFD" -lt 512 ; then
80ab193b 965 echo "WARNING: $SQUID_MAXFD may not be enough filedescriptors if your"
966 echo " cache will be very busy. Please see the FAQ page"
043e3d78 967 echo " http://squid.nlanr.net/Squid/FAQ/FAQ-11.html#filedescriptors"
e692ff35 968 echo " on how to increase your filedescriptor limit"
933cc58d 969 sleep 10
80ab193b 970fi
234967c9 971
5c51415d 972dnl Not cached since people are likely to tune this
30a4f2a8 973AC_MSG_CHECKING(Default UDP send buffer size)
974AC_TRY_RUN([
8cca06da 975#include <stdlib.h>
976#include <stdio.h>
30a4f2a8 977#include <sys/types.h>
978#include <sys/socket.h>
979#include <netinet/in.h>
980main ()
981{
982 int fd,val=0,len=sizeof(int);
983 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
984 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
985 if (val<=0) exit(1);
986 fprintf (fopen("conftestval", "w"), "%d\n", val);
987 exit(0);
988}
989],
990SQUID_UDP_SO_SNDBUF=`cat conftestval`,
1c481e00 991SQUID_UDP_SO_SNDBUF=16384,
992SQUID_UDP_SO_SNDBUF=16384)
30a4f2a8 993AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
994AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
995
5c51415d 996dnl Not cached since people are likely to tune this
30a4f2a8 997AC_MSG_CHECKING(Default UDP receive buffer size)
998AC_TRY_RUN([
8cca06da 999#include <stdlib.h>
1000#include <stdio.h>
30a4f2a8 1001#include <sys/types.h>
1002#include <sys/socket.h>
1003#include <netinet/in.h>
1004main ()
1005{
1006 int fd,val=0,len=sizeof(int);
1007 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
1008 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1009 if (val <= 0) exit(1);
1010 fprintf (fopen("conftestval", "w"), "%d\n", val);
1011 exit(0);
1012}
1013],
1014SQUID_UDP_SO_RCVBUF=`cat conftestval`,
1c481e00 1015SQUID_UDP_SO_RCVBUF=16384,
1016SQUID_UDP_SO_RCVBUF=16384)
30a4f2a8 1017AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
1018AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
1019
5c51415d 1020dnl Not cached since people are likely to tune this
30a4f2a8 1021AC_MSG_CHECKING(Default TCP send buffer size)
1022AC_TRY_RUN([
8cca06da 1023#include <stdlib.h>
1024#include <stdio.h>
30a4f2a8 1025#include <sys/types.h>
1026#include <sys/socket.h>
1027#include <netinet/in.h>
1028main ()
1029{
1030 int fd,val=0,len=sizeof(int);
1031 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1032 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
1033 if (val <= 0) exit(1);
1034 fprintf (fopen("conftestval", "w"), "%d\n", val);
1035 exit(0);
1036}
1037],
1038SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 1039SQUID_TCP_SO_SNDBUF=16384,
1040SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 1041AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
1042AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
1043
5c51415d 1044dnl Not cached since people are likely to tune this
30a4f2a8 1045AC_MSG_CHECKING(Default TCP receive buffer size)
1046AC_TRY_RUN([
8cca06da 1047#include <stdlib.h>
1048#include <stdio.h>
30a4f2a8 1049#include <sys/types.h>
1050#include <sys/socket.h>
1051#include <netinet/in.h>
1052main ()
1053{
1054 int fd,val=0,len=sizeof(int);
1055 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
1056 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
1057 if (val <= 0) exit(1);
1058 fprintf (fopen("conftestval", "w"), "%d\n", val);
1059 exit(0);
1060}
1061],
1062SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 1063SQUID_TCP_SO_RCVBUF=16384,
1064SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 1065AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
1066AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
1067
5c51415d 1068AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist,
1069 AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist[0];],
1070 ac_cv_needs_sys_errlist="no",
1071 ac_cv_needs_sys_errlist="yes")
1072)
1073if test "$ac_cv_needs_sys_errlist" = "yes" ; then
1074 AC_DEFINE(NEED_SYS_ERRLIST)
1075fi
30a4f2a8 1076
5c51415d 1077dnl Not cached since people are likely to change this
6bf65235 1078AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
1079AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
1080[AC_MSG_RESULT(yes)
1081AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
1082AC_MSG_RESULT(no))
1083
090089c4 1084dnl Need the debugging version of malloc if available
1085XTRA_OBJS=''
6509a1a0 1086if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 1087 if test -r /usr/lib/debug/malloc.o ; then
1088 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
1089 fi
1090 if test -r /usr/lib/debug/mallocmap.o ; then
1091 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
1092 fi
1093fi
2bbd722b 1094
090089c4 1095AC_SUBST(XTRA_OBJS)
1096
38fea766 1097if test -z "$XTRA_LIBS"; then
1098 XTRA_LIBS="$LIBS"
0f5a16f8 1099 dnl -lcrypt is set in CRYPTLIB
1100 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lcrypt//"`
1101 dnl -lpthread is set in PTHREADLIB
1102 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/-lpthread//"`
1103 dnl minor cleanup
1104 XTRA_LIBS=`echo $XTRA_LIBS | sed -e "s/ */ /g"`
38fea766 1105 LIBS=''
1106fi
090089c4 1107AC_SUBST(XTRA_LIBS)
1108
090089c4 1109dnl Clean up after OSF/1 core dump bug
1110rm -f core
1111
1112AC_OUTPUT(\
0992a350 1113 ./makefile \
090089c4 1114 ./lib/Makefile \
a26bdc75 1115 ./include/config.h \
090089c4 1116 ./scripts/Makefile \
1117 ./scripts/RunCache \
1118 ./scripts/RunAccel \
a26bdc75 1119 ./src/Makefile \
e550e8b6 1120 ./contrib/Makefile \
8a7f0105 1121 $SNMP_MAKEFILE \
81280a96 1122 ./icons/Makefile \
d4fb069d 1123 ./errors/Makefile \
dbfa0154 1124 ./auth_modules/NCSA/Makefile \
090089c4 1125)