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