]> git.ipfire.org Git - thirdparty/squid.git/blame - configure.in
Round Robin parenting
[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
b1e77ec1 6dnl $Id: configure.in,v 1.66 1997/01/20 18:33:48 wessels Exp $
090089c4 7dnl
8dnl
090089c4 9dnl
a26bdc75 10AC_INIT(src/main.c)
090089c4 11AC_CONFIG_HEADER(include/autoconf.h)
b1e77ec1 12AC_REVISION($Revision: 1.66 $)dnl
2877b8a9 13AC_PREFIX_DEFAULT(/usr/local/squid)
da22ac20 14AC_CONFIG_AUX_DIR(aux)
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
a26bdc75 29if test -z "$CACHE_HTTP_PORT"; then
30 CACHE_HTTP_PORT="3128"
31fi
32if test -z "$CACHE_ICP_PORT"; then
33 CACHE_ICP_PORT="3130"
34fi
a26bdc75 35
090089c4 36dnl Subsitutions
a26bdc75 37AC_SUBST(CACHE_HTTP_PORT)
38AC_SUBST(CACHE_ICP_PORT)
090089c4 39
30a4f2a8 40AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host")
41
42dnl Set default LDFLAGS
43if test -z "$LDFLAGS"; then
44 LDFLAGS="-g"
45fi
46
38fea766 47PRESET_CFLAGS="$CFLAGS"
30a4f2a8 48
090089c4 49dnl Check for GNU cc
50AC_PROG_CC
51
52dnl Warn if not using GNU cc
ec1b5d74 53if test $ac_cv_prog_gcc = no; then
090089c4 54 echo '**************************************************************';
55 echo '**************************************************************';
56 echo '**';
2877b8a9 57 echo '** WARNING: Squid is only guaranteed to compile with GNU cc.';
090089c4 58 echo "** Currently, you're using $CC";
e973b94a 59 echo '**';
090089c4 60 echo '**************************************************************';
61 echo '**************************************************************';
62 sleep 5
63fi
64
30a4f2a8 65dnl Set Default CFLAGS
66if test -z "$PRESET_CFLAGS"; then
67 if test "$GCC" = "yes"; then
68 case "$host" in
69 *-sun-sunos*|*m88k*)
70 # sunos has too many warnings for this to be useful
71 # motorola too
72 ;;
73 *)
74 CFLAGS="$CFLAGS -Wall"
75 ;;
76 esac
77 fi
78
30a4f2a8 79 case "$host" in
30a4f2a8 80 *-hp-hpux*)
81 echo "Disabling 'ranlib' for HP-UX..."
82 RANLIB=":"
83 ;;
84 esac
85fi
86
87dnl Set LDFLAGS
88if test -z "$PRESET_LDFLAGS"; then
89 if test "$GCC" = "yes"; then
90 case "$host" in
91 *)
92 # nothing
93 ;;
94 esac
95 fi
96fi
2060fa9a 97
090089c4 98dnl Check for programs
99AC_PROG_CPP
100AC_PROG_INSTALL
101AC_PROG_RANLIB
102AC_PROG_LN_S
d9f67e6f 103AC_PATH_PROG(FALSE, false, /usr/bin/false)
104AC_PATH_PROG(TRUE, true, /usr/bin/true)
105AC_PATH_PROG(RM, rm, $FALSE)
106AC_PATH_PROG(MV, mv, $FALSE)
107AC_PATH_PROG(MKDIR, mkdir, $FALSE)
090089c4 108AC_PATH_PROG(LN, ln, cp)
983061ed 109AC_PATH_PROG(PERL, perl, /usr/local/bin/perl)
d9f67e6f 110AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE)
090089c4 111
090089c4 112
113dnl Check for headers
114AC_HEADER_DIRENT
115AC_HEADER_STDC
db40ae20 116
2060fa9a 117
db40ae20 118AC_CHECK_HEADERS( \
119 alloca.h \
120 arpa/inet.h \
30a4f2a8 121 arpa/nameser.h \
db40ae20 122 bstring.h \
123 config.h \
124 crypt.h \
30a4f2a8 125 ctype.h \
126 errno.h \
db40ae20 127 fcntl.h \
9c1d8929 128 getopt.h \
30a4f2a8 129 grp.h \
130 libc.h \
131 malloc.h \
e0bddc45 132 math.h \
db40ae20 133 memory.h \
30a4f2a8 134 netdb.h \
db40ae20 135 netinet/in.h \
30a4f2a8 136 netinet/tcp.h \
dcfe6390 137 poll.h \
30a4f2a8 138 pwd.h \
139 regex.h \
140 resolv.h \
46aea673 141 shadow.h \
30a4f2a8 142 signal.h \
143 stdarg.h \
144 stddef.h \
145 stdio.h \
db40ae20 146 stdlib.h \
147 string.h \
148 strings.h \
149 sys/file.h \
30a4f2a8 150 sys/param.h \
151 sys/resource.h \
db40ae20 152 sys/select.h\
30a4f2a8 153 sys/socket.h \
154 sys/stat.h \
155 sys/syscall.h \
db40ae20 156 sys/time.h \
157 sys/types.h \
30a4f2a8 158 sys/un.h \
159 sys/wait.h \
db40ae20 160 syslog.h \
30a4f2a8 161 time.h \
162 unistd.h \
163 varargs.h \
db40ae20 164)
165
aee0606f 166AC_C_CONST
167
20a50bb9 168AC_MSG_CHECKING(if ANSI prototypes work)
8cca06da 169AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}],
170[foo("bar")],
20a50bb9 171[AC_DEFINE(HAVE_ANSI_PROTOTYPES)
172AC_MSG_RESULT(yes)],
173AC_MSG_RESULT(no))
174
46c883ed 175AC_MSG_CHECKING(for tm->tm_gmtoff)
176AC_TRY_COMPILE([#include <time.h>
177#include <sys/time.h>],
178[struct tm foo;
179foo.tm_gmtoff = 0;],
180[AC_DEFINE(HAVE_TM_GMTOFF)
181AC_MSG_RESULT(yes)],
182AC_MSG_RESULT(no))
183
184AC_MSG_CHECKING(for extended mallinfo)
185AC_TRY_COMPILE([#include <sys/types.h>
186#include <malloc.h>],
187[struct mallinfo foo;
188foo.mxfast = 0;],
189[AC_DEFINE(HAVE_EXT_MALLINFO)
190AC_MSG_RESULT(yes)],
191AC_MSG_RESULT(no))
090089c4 192
a025a745 193AC_MSG_CHECKING(for ip->ip_hl)
194AC_TRY_COMPILE([#include <sys/types.h>
195#include <netinet/in.h>
196#include <netinet/in_systm.h>
197#include <netinet/ip.h>],
198[struct ip ip;
199ip.ip_hl= 0;],
200[AC_DEFINE(HAVE_IP_HL)
201AC_MSG_RESULT(yes)],
202AC_MSG_RESULT(no))
203
090089c4 204dnl Check for typedefs
205AC_CHECK_SIZEOF(int)
206AC_CHECK_SIZEOF(long)
207
256cf05b 208dnl Check for special functions
209AC_FUNC_ALLOCA
090089c4 210
3f6fcd8a 211AC_CHECK_TYPE(pid_t, int)
212AC_CHECK_TYPE(size_t, int)
213AC_CHECK_TYPE(off_t, int)
95cf2361 214AC_CHECK_TYPE(mode_t, u_short)
3f6fcd8a 215
090089c4 216dnl Check for needed libraries
30a4f2a8 217AC_CHECK_LIB(nsl, main)
6716b242 218AC_CHECK_LIB(socket, main)
8a15e65e 219AC_CHECK_LIB(gnumalloc, main)
6509a1a0 220if test "$ac_cv_lib_gnumalloc_main" = "no"; then
8a15e65e 221 case "$host" in
222 *-sun-solaris*)
223 echo "skipping libmalloc check for $host"
224 ;;
225 i386-*-freebsd*)
226 echo "skipping libmalloc check for $host"
227 ;;
228 *)
229 AC_CHECK_LIB(malloc, main)
230 ;;
231 esac
232fi
6716b242 233AC_CHECK_LIB(bsd, main)
be79ade0 234AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"])
8a15e65e 235AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton))
6509a1a0 236AC_CHECK_LIB(resolv, main)
e0bddc45 237AC_CHECK_LIB(m, main)
090089c4 238
239dnl Check for libcrypt
b8de7ebe 240dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD)
be79ade0 241AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"])
242AC_SUBST(CRYPTLIB)
77f675ad 243
46aea673 244dnl Check for libshadow which is needed by the shadow password suite
245AC_CHECK_LIB(shadow, main)
246
77f675ad 247dnl System-specific library modifications
248dnl
249case "$host" in
7149a49f 250 i386-*-solaris2.?)
251 if test "$GCC" = "yes"; then
252 echo "Removing -O for gcc on $host"
253 CFLAGS="`echo $CFLAGS | sed -e s/-O//`"
254 fi
255 ;;
77f675ad 256 *-sgi-irix*)
257 echo "Removing -lsocket for IRIX..."
6716b242 258 LIBS=`echo $LIBS | sed -e s/-lsocket//`
77f675ad 259 echo "Removing -lnsl for IRIX..."
6716b242 260 LIBS=`echo $LIBS | sed -e s/-lnsl//`
b44c0fb4 261 echo "Removing -lbsd for IRIX..."
262 LIBS=`echo $LIBS | sed -e s/-lbsd//`
77f675ad 263 ;;
4ba0bd0e 264dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher)
265dnl Date: Thu, 17 Oct 1996 04:09:30 +0200
266dnl Please change your configure script. AIX doesn't need -lbsd.
267 *-ibm-aix*)
268 echo "Removing -lbsd for AIX..."
269 LIBS=`echo $LIBS | sed -e s/-lbsd//`
270 ;;
30a4f2a8 271 *m88k*)
272 CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_"
7149a49f 273 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
274 ;;
580ce039 275 [*-*-solaris2.[0-4]])
7149a49f 276 AC_DEFINE(GETTIMEOFDAY_NO_TZP)
30a4f2a8 277 ;;
77f675ad 278esac
090089c4 279
176d10ee 280# Recommended by Balint Nagy Endre <bne@CareNet.hu>
281case "$host" in
282 *-univel-sysv4.2MP)
283 if test `uname -v` = "2.03"; then
284 echo "disabling mallinfo for $host"
285 ac_cv_func_mallinfo=no
286 fi
287 ;;
288esac
289
290
6716b242 291dnl Check for library functions
292AC_CHECK_FUNCS(\
30a4f2a8 293 bcopy \
4ac29a5b 294 fchmod \
6716b242 295 getdtablesize \
30a4f2a8 296 getrusage \
9c1d8929 297 getspnam \
30a4f2a8 298 lrand48 \
6716b242 299 mallinfo \
0f5efab0 300 mallocblksize \
6716b242 301 mallopt \
2ae6b9b0 302 memcpy \
30a4f2a8 303 memmove \
1812b6c7 304 mktime \
dcfe6390 305 poll \
b7c1b13c 306 pw_encrypt \
b1e77ec1 307 random \
6716b242 308 regcomp \
309 regexec \
310 regfree \
30a4f2a8 311 res_init \
234967c9 312 seteuid \
30a4f2a8 313 setpgrp \
234967c9 314 setresuid \
6716b242 315 setrlimit \
30a4f2a8 316 setsid \
317 sigaction \
30a4f2a8 318 srand48 \
b1e77ec1 319 srandom \
0f5efab0 320 strerror \
6716b242 321 sysconf \
322 syslog \
0a3efad5 323 tempnam \
234967c9 324 timegm \
6716b242 325)
326
7a081912 327AC_MSG_CHECKING(if GNUregex needs to be compiled)
00fa2c12 328if test "$ac_cv_func_regcomp" = "no" ; then
74946a0f 329 USE_GNUREGEX="yes"
00fa2c12 330else
74946a0f 331 USE_GNUREGEX="no"
00fa2c12 332fi
333case "$host" in
580ce039 334 [*-sun-solaris2.[0-4]])
74946a0f 335 USE_GNUREGEX="yes"
336 ;;
337 [*-next-nextstep*])
338 USE_GNUREGEX="yes"
339 ;;
00fa2c12 340esac
74946a0f 341AC_MSG_RESULT($USE_GNUREGEX)
342if test "$USE_GNUREGEX" = "yes"; then
26675bf4 343 REGEXLIB="-lregex"
7a081912 344 LIBREGEX="libregex.a"
74946a0f 345 AC_DEFINE(USE_GNUREGEX)
7a081912 346fi
26675bf4 347AC_SUBST(REGEXLIB)
00fa2c12 348AC_SUBST(LIBREGEX)
7a081912 349
3f6fcd8a 350AC_REPLACE_FUNCS(\
351 tempnam \
352)
353
234967c9 354AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
355AC_TRY_RUN([
8cca06da 356#include <stdio.h>
234967c9 357#include <unistd.h>
30a4f2a8 358#include <sys/time.h> /* needed on FreeBSD */
234967c9 359#include <sys/param.h>
360#include <sys/resource.h>
361main() {
362 int i,j;
363#if HAVE_SETRLIMIT
364 struct rlimit rl;
365#if defined(RLIMIT_NOFILE)
366 if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
367 perror("getrlimit: RLIMIT_NOFILE");
368 } else {
369 rl.rlim_cur = rl.rlim_max; /* set it to the max */
370 if (setrlimit(RLIMIT_NOFILE, &rl) < 0) {
371 perror("setrlimit: RLIMIT_NOFILE");
372 }
373 }
374#elif defined(RLIMIT_OFILE)
375 if (getrlimit(RLIMIT_OFILE, &rl) < 0) {
376 perror("getrlimit: RLIMIT_OFILE");
377 } else {
378 rl.rlim_cur = rl.rlim_max; /* set it to the max */
379 if (setrlimit(RLIMIT_OFILE, &rl) < 0) {
380 perror("setrlimit: RLIMIT_OFILE");
381 }
382 }
383#endif /* RLIMIT_NOFILE */
384#endif /* HAVE_SETRLIMIT */
385#if HAVE_SYSCONF && defined(_SC_OPEN_MAX)
386 i = sysconf(_SC_OPEN_MAX);
3f6fcd8a 387#elif HAVE_GETDTABLESIZE && !defined(__linux__)
234967c9 388 i = getdtablesize();
389#elif defined(OPEN_MAX)
390 i = OPEN_MAX;
391#elif defined(NOFILE)
392 i = NOFILE;
393#elif defined(_NFILE)
394 i = _NFILE;
395#else
396 while((j=open("/dev/null", 0)) > 0) i=j;
0a5b9b32 397 close(i); close(i-1);
398 i++;
234967c9 399#endif
400 fprintf (fopen("conftestval", "w"), "%d\n", i);
401 exit(0);
402}
403],
431d84c5 404SQUID_MAXFD=`cat conftestval`,
405SQUID_MAXFD=256,
406SQUID_MAXFD=256)
407AC_MSG_RESULT($SQUID_MAXFD)
408AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD)
234967c9 409
30a4f2a8 410AC_MSG_CHECKING(Default UDP send buffer size)
411AC_TRY_RUN([
8cca06da 412#include <stdlib.h>
413#include <stdio.h>
30a4f2a8 414#include <sys/types.h>
415#include <sys/socket.h>
416#include <netinet/in.h>
417main ()
418{
419 int fd,val=0,len=sizeof(int);
420 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
421 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
422 if (val<=0) exit(1);
423 fprintf (fopen("conftestval", "w"), "%d\n", val);
424 exit(0);
425}
426],
427SQUID_UDP_SO_SNDBUF=`cat conftestval`,
1c481e00 428SQUID_UDP_SO_SNDBUF=16384,
429SQUID_UDP_SO_SNDBUF=16384)
30a4f2a8 430AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF)
431AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF)
432
433AC_MSG_CHECKING(Default UDP receive buffer size)
434AC_TRY_RUN([
8cca06da 435#include <stdlib.h>
436#include <stdio.h>
30a4f2a8 437#include <sys/types.h>
438#include <sys/socket.h>
439#include <netinet/in.h>
440main ()
441{
442 int fd,val=0,len=sizeof(int);
443 if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1);
444 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
445 if (val <= 0) exit(1);
446 fprintf (fopen("conftestval", "w"), "%d\n", val);
447 exit(0);
448}
449],
450SQUID_UDP_SO_RCVBUF=`cat conftestval`,
1c481e00 451SQUID_UDP_SO_RCVBUF=16384,
452SQUID_UDP_SO_RCVBUF=16384)
30a4f2a8 453AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF)
454AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF)
455
456AC_MSG_CHECKING(Default TCP send buffer size)
457AC_TRY_RUN([
8cca06da 458#include <stdlib.h>
459#include <stdio.h>
30a4f2a8 460#include <sys/types.h>
461#include <sys/socket.h>
462#include <netinet/in.h>
463main ()
464{
465 int fd,val=0,len=sizeof(int);
466 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
467 if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1);
468 if (val <= 0) exit(1);
469 fprintf (fopen("conftestval", "w"), "%d\n", val);
470 exit(0);
471}
472],
473SQUID_TCP_SO_SNDBUF=`cat conftestval`,
1c481e00 474SQUID_TCP_SO_SNDBUF=16384,
475SQUID_TCP_SO_SNDBUF=16384)
30a4f2a8 476AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF)
477AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF)
478
479AC_MSG_CHECKING(Default TCP receive buffer size)
480AC_TRY_RUN([
8cca06da 481#include <stdlib.h>
482#include <stdio.h>
30a4f2a8 483#include <sys/types.h>
484#include <sys/socket.h>
485#include <netinet/in.h>
486main ()
487{
488 int fd,val=0,len=sizeof(int);
489 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1);
490 if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1);
491 if (val <= 0) exit(1);
492 fprintf (fopen("conftestval", "w"), "%d\n", val);
493 exit(0);
494}
495],
496SQUID_TCP_SO_RCVBUF=`cat conftestval`,
1c481e00 497SQUID_TCP_SO_RCVBUF=16384,
498SQUID_TCP_SO_RCVBUF=16384)
30a4f2a8 499AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF)
500AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF)
501
502AC_MSG_CHECKING(if sys_errlist[] is already defined)
503AC_TRY_COMPILE([#include <stdio.h>],
504[char *s = sys_errlist[0];],
505AC_MSG_RESULT(yes),
506[AC_MSG_RESULT(no)
507AC_DEFINE(NEED_SYS_ERRLIST)])
508
6bf65235 509AC_MSG_CHECKING(for libresolv _dns_ttl_ hack)
510AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;,
511[AC_MSG_RESULT(yes)
512AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)],
513AC_MSG_RESULT(no))
514
090089c4 515dnl Need the debugging version of malloc if available
516XTRA_OBJS=''
6509a1a0 517if test "$ac_cv_lib_malloc_main" = "yes" ; then
090089c4 518 if test -r /usr/lib/debug/malloc.o ; then
519 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o"
520 fi
521 if test -r /usr/lib/debug/mallocmap.o ; then
522 XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o"
523 fi
524fi
525AC_SUBST(XTRA_OBJS)
526
38fea766 527if test -z "$XTRA_LIBS"; then
528 XTRA_LIBS="$LIBS"
529 LIBS=''
530fi
090089c4 531AC_SUBST(XTRA_LIBS)
532
090089c4 533dnl Clean up after OSF/1 core dump bug
534rm -f core
535
536AC_OUTPUT(\
0992a350 537 ./makefile \
090089c4 538 ./lib/Makefile \
a26bdc75 539 ./include/config.h \
090089c4 540 ./scripts/Makefile \
541 ./scripts/RunCache \
542 ./scripts/RunAccel \
a26bdc75 543 ./src/Makefile \
983061ed 544 ./src/squid.conf.pre \
e550e8b6 545 ./contrib/Makefile \
090089c4 546)