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