]>
Commit | Line | Data |
---|---|---|
090089c4 | 1 | dnl |
2877b8a9 | 2 | dnl Configuration input file for Squid |
090089c4 | 3 | dnl |
983061ed | 4 | dnl Duane Wessels, wessels@nlanr.net, February 1996 (autoconf v2.9) |
090089c4 | 5 | dnl |
b54a6789 | 6 | dnl $Id: configure.in,v 1.90 1998/01/02 18:04:21 wessels Exp $ |
090089c4 | 7 | dnl |
8 | dnl | |
090089c4 | 9 | dnl |
a26bdc75 | 10 | AC_INIT(src/main.c) |
090089c4 | 11 | AC_CONFIG_HEADER(include/autoconf.h) |
b54a6789 | 12 | AC_REVISION($Revision: 1.90 $)dnl |
2877b8a9 | 13 | AC_PREFIX_DEFAULT(/usr/local/squid) |
da22ac20 | 14 | AC_CONFIG_AUX_DIR(aux) |
090089c4 | 15 | |
88d50a22 | 16 | AC_CANONICAL_HOST |
17 | ||
26675bf4 | 18 | CRYPTLIB='' |
00fa2c12 | 19 | REGEXLIB='' # -lregex |
20 | LIBREGEX='' # libregex.a | |
090089c4 | 21 | |
983061ed | 22 | dnl use directory structure of cached as default (hack) |
23 | if test "$libexecdir" = '${exec_prefix}/libexec'; then | |
24 | libexecdir='${bindir}' | |
25 | localstatedir='${prefix}' | |
26 | ||
27 | fi | |
28 | ||
a26bdc75 | 29 | if test -z "$CACHE_HTTP_PORT"; then |
30 | CACHE_HTTP_PORT="3128" | |
31 | fi | |
32 | if test -z "$CACHE_ICP_PORT"; then | |
33 | CACHE_ICP_PORT="3130" | |
34 | fi | |
a26bdc75 | 35 | |
090089c4 | 36 | dnl Subsitutions |
a26bdc75 | 37 | AC_SUBST(CACHE_HTTP_PORT) |
38 | AC_SUBST(CACHE_ICP_PORT) | |
090089c4 | 39 | |
30a4f2a8 | 40 | AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host") |
41 | ||
42 | dnl Set default LDFLAGS | |
43 | if test -z "$LDFLAGS"; then | |
44 | LDFLAGS="-g" | |
45 | fi | |
46 | ||
38fea766 | 47 | PRESET_CFLAGS="$CFLAGS" |
30a4f2a8 | 48 | |
090089c4 | 49 | dnl Check for GNU cc |
50 | AC_PROG_CC | |
51 | ||
52 | dnl Warn if not using GNU cc | |
c601f22c | 53 | dnl if test $ac_cv_prog_gcc = no; then |
54 | dnl echo '**************************************************************'; | |
55 | dnl echo '**************************************************************'; | |
56 | dnl echo '**'; | |
57 | dnl echo '** WARNING: Squid is only guaranteed to compile with GNU cc.'; | |
58 | dnl echo "** Currently, you're using $CC"; | |
59 | dnl echo '**'; | |
60 | dnl echo '**************************************************************'; | |
61 | dnl echo '**************************************************************'; | |
62 | dnl sleep 5 | |
63 | dnl fi | |
090089c4 | 64 | |
6ad85e8a | 65 | dnl Gerben Wierda <Gerben_Wierda@RnA.nl> |
66 | case "$host" in | |
67 | mab-next-nextstep3) | |
68 | CC="$CC -arch m68k -arch i486 -arch hppa -arch sparc" | |
69 | ;; | |
70 | esac | |
71 | ||
30a4f2a8 | 72 | dnl Set Default CFLAGS |
73 | if test -z "$PRESET_CFLAGS"; then | |
74 | if test "$GCC" = "yes"; then | |
75 | case "$host" in | |
76 | *-sun-sunos*|*m88k*) | |
77 | # sunos has too many warnings for this to be useful | |
78 | # motorola too | |
79 | ;; | |
80 | *) | |
81 | CFLAGS="$CFLAGS -Wall" | |
82 | ;; | |
83 | esac | |
84 | fi | |
30a4f2a8 | 85 | fi |
86 | ||
87 | dnl Set LDFLAGS | |
88 | if test -z "$PRESET_LDFLAGS"; then | |
89 | if test "$GCC" = "yes"; then | |
90 | case "$host" in | |
91 | *) | |
92 | # nothing | |
93 | ;; | |
94 | esac | |
95 | fi | |
96 | fi | |
2060fa9a | 97 | |
090089c4 | 98 | dnl Check for programs |
99 | AC_PROG_CPP | |
100 | AC_PROG_INSTALL | |
101 | AC_PROG_RANLIB | |
102 | AC_PROG_LN_S | |
81280a96 | 103 | AC_PATH_PROG(SH, sh, /bin/sh) |
d9f67e6f | 104 | AC_PATH_PROG(FALSE, false, /usr/bin/false) |
105 | AC_PATH_PROG(TRUE, true, /usr/bin/true) | |
106 | AC_PATH_PROG(RM, rm, $FALSE) | |
107 | AC_PATH_PROG(MV, mv, $FALSE) | |
108 | AC_PATH_PROG(MKDIR, mkdir, $FALSE) | |
090089c4 | 109 | AC_PATH_PROG(LN, ln, cp) |
983061ed | 110 | AC_PATH_PROG(PERL, perl, /usr/local/bin/perl) |
d9f67e6f | 111 | AC_PATH_PROG(MAKEDEPEND, makedepend, $TRUE) |
6ad85e8a | 112 | AC_PATH_PROG(AR, ar, $FALSE) |
113 | ||
114 | case "$host" in | |
115 | *-hp-hpux*) | |
116 | echo "Disabling 'ranlib' for HP-UX..." | |
117 | RANLIB=":" | |
118 | ;; | |
119 | esac | |
120 | ||
121 | dnl set $(AR) | |
122 | AR_R="$AR r" | |
123 | case "$host" in | |
124 | *-next-nextstep3) | |
125 | AR="libtool -o" | |
126 | ;; | |
127 | esac | |
128 | AC_SUBST(AR_R) | |
090089c4 | 129 | |
130 | dnl Check for headers | |
131 | AC_HEADER_DIRENT | |
132 | AC_HEADER_STDC | |
db40ae20 | 133 | |
2060fa9a | 134 | |
db40ae20 | 135 | AC_CHECK_HEADERS( \ |
136 | alloca.h \ | |
137 | arpa/inet.h \ | |
30a4f2a8 | 138 | arpa/nameser.h \ |
9441aa34 | 139 | assert.h \ |
db40ae20 | 140 | bstring.h \ |
141 | config.h \ | |
142 | crypt.h \ | |
30a4f2a8 | 143 | ctype.h \ |
144 | errno.h \ | |
db40ae20 | 145 | fcntl.h \ |
9c1d8929 | 146 | getopt.h \ |
88738790 | 147 | gnumalloc.h \ |
30a4f2a8 | 148 | grp.h \ |
149 | libc.h \ | |
6ad85e8a | 150 | limits.h \ |
30a4f2a8 | 151 | malloc.h \ |
e0bddc45 | 152 | math.h \ |
db40ae20 | 153 | memory.h \ |
30a4f2a8 | 154 | netdb.h \ |
db40ae20 | 155 | netinet/in.h \ |
30a4f2a8 | 156 | netinet/tcp.h \ |
dcfe6390 | 157 | poll.h \ |
30a4f2a8 | 158 | pwd.h \ |
159 | regex.h \ | |
160 | resolv.h \ | |
161 | signal.h \ | |
162 | stdarg.h \ | |
163 | stddef.h \ | |
164 | stdio.h \ | |
db40ae20 | 165 | stdlib.h \ |
166 | string.h \ | |
167 | strings.h \ | |
168 | sys/file.h \ | |
30a4f2a8 | 169 | sys/param.h \ |
170 | sys/resource.h \ | |
db40ae20 | 171 | sys/select.h\ |
30a4f2a8 | 172 | sys/socket.h \ |
173 | sys/stat.h \ | |
174 | sys/syscall.h \ | |
db40ae20 | 175 | sys/time.h \ |
176 | sys/types.h \ | |
30a4f2a8 | 177 | sys/un.h \ |
178 | sys/wait.h \ | |
db40ae20 | 179 | syslog.h \ |
30a4f2a8 | 180 | time.h \ |
181 | unistd.h \ | |
182 | varargs.h \ | |
db40ae20 | 183 | ) |
184 | ||
aee0606f | 185 | AC_C_CONST |
d57288d2 | 186 | AC_C_BIGENDIAN |
aee0606f | 187 | |
5c51415d | 188 | AC_CACHE_CHECK(if ANSI prototypes work,ac_cv_have_ansi_prototypes, [ |
189 | AC_TRY_COMPILE([int foo(char *); int foo (char *bar) {return 1;}], | |
190 | [foo("bar")], | |
191 | ac_cv_have_ansi_prototypes="yes", | |
192 | ac_cv_have_ansi_prototypes="no") | |
193 | ]) | |
194 | if test $ac_cv_have_ansi_prototypes = "yes" ; then | |
195 | AC_DEFINE(HAVE_ANSI_PROTOTYPES) | |
196 | fi | |
20a50bb9 | 197 | |
5c51415d | 198 | AC_CACHE_CHECK(for tm->tm_gmtoff,ac_cv_have_tm_gmoff, [ |
199 | AC_TRY_COMPILE([#include <time.h> | |
46c883ed | 200 | #include <sys/time.h>], |
5c51415d | 201 | [struct tm foo; |
202 | foo.tm_gmtoff = 0;], | |
203 | ac_cv_have_tm_gmoff="yes", | |
204 | ac_cv_have_tm_gmoff="no") | |
205 | ]) | |
206 | if test $ac_cv_have_tm_gmoff = "yes" ; then | |
207 | AC_DEFINE(HAVE_TM_GMTOFF) | |
208 | fi | |
46c883ed | 209 | |
5c51415d | 210 | AC_CACHE_CHECK(for extended mallinfo,ac_cv_have_ext_mallinfo, [ |
211 | AC_TRY_COMPILE([#include <sys/types.h> | |
46c883ed | 212 | #include <malloc.h>], |
5c51415d | 213 | [struct mallinfo foo; |
214 | foo.mxfast = 0;], | |
215 | ac_cv_have_ext_mallinfo="yes", | |
216 | ac_cv_have_ext_mallinfo="no") | |
217 | ]) | |
218 | if test $ac_cv_have_ext_mallinfo = "yes" ; then | |
219 | AC_DEFINE(HAVE_EXT_MALLINFO) | |
220 | fi | |
090089c4 | 221 | |
b54a6789 | 222 | AC_CACHE_CHECK(for struct rusage,ac_cv_have_struct_rusage, [ |
223 | AC_TRY_COMPILE([ | |
224 | #if HAVE_SYS_RESOURCE_H | |
225 | #include <sys/resource.h> | |
226 | #endif], | |
227 | [struct rusage R;], | |
228 | ac_cv_have_struct_rusage="yes", | |
229 | ac_cv_have_struct_rusage="no") | |
230 | ]) | |
231 | if test $ac_cv_have_struct_rusage = "yes" ; then | |
232 | AC_DEFINE(HAVE_STRUCT_RUSAGE) | |
233 | fi | |
234 | ||
5c51415d | 235 | AC_CACHE_CHECK(for ip->ip_hl, ac_cv_have_ip_hl, [ |
236 | AC_TRY_COMPILE([#include <sys/types.h> | |
a025a745 | 237 | #include <netinet/in.h> |
238 | #include <netinet/in_systm.h> | |
6ad85e8a | 239 | #include <netinet/ip.h> |
240 | #ifdef __linux__ | |
241 | #define ip_hl ihl | |
242 | #endif | |
243 | #ifndef __linux__ | |
244 | #define iphdr ip | |
245 | #endif], | |
5c51415d | 246 | [struct iphdr ip; |
247 | ip.ip_hl= 0;], | |
248 | ac_cv_have_ip_hl="yes", | |
249 | ac_cv_have_ip_hl="no") | |
250 | ]) | |
251 | if test $ac_cv_have_ip_hl = "yes" ; then | |
252 | AC_DEFINE(HAVE_IP_HL) | |
253 | fi | |
a025a745 | 254 | |
090089c4 | 255 | dnl Check for typedefs |
256 | AC_CHECK_SIZEOF(int) | |
257 | AC_CHECK_SIZEOF(long) | |
258 | ||
256cf05b | 259 | dnl Check for special functions |
260 | AC_FUNC_ALLOCA | |
090089c4 | 261 | |
3f6fcd8a | 262 | AC_CHECK_TYPE(pid_t, int) |
0897af2d | 263 | AC_CHECK_TYPE(size_t, unsigned int) |
264 | AC_CHECK_TYPE(ssize_t, int) | |
3f6fcd8a | 265 | AC_CHECK_TYPE(off_t, int) |
95cf2361 | 266 | AC_CHECK_TYPE(mode_t, u_short) |
3f6fcd8a | 267 | |
090089c4 | 268 | dnl Check for needed libraries |
30a4f2a8 | 269 | AC_CHECK_LIB(nsl, main) |
6716b242 | 270 | AC_CHECK_LIB(socket, main) |
8a15e65e | 271 | AC_CHECK_LIB(gnumalloc, main) |
5c51415d | 272 | if test "$ac_cv_lib_gnumalloc_main" = "yes"; then |
273 | echo "Disabling extended malloc functions when using gnumalloc" | |
274 | ac_cv_func_mallinfo=no | |
275 | ac_cv_func_mallocblksize=no | |
276 | ac_cv_func_mallopt=no | |
277 | else | |
8a15e65e | 278 | case "$host" in |
279 | *-sun-solaris*) | |
280 | echo "skipping libmalloc check for $host" | |
281 | ;; | |
282 | i386-*-freebsd*) | |
283 | echo "skipping libmalloc check for $host" | |
284 | ;; | |
285 | *) | |
286 | AC_CHECK_LIB(malloc, main) | |
287 | ;; | |
288 | esac | |
289 | fi | |
6716b242 | 290 | AC_CHECK_LIB(bsd, main) |
be79ade0 | 291 | AC_CHECK_LIB(regex, main, [REGEXLIB="-lregex"]) |
78743365 | 292 | case "$host" in |
293 | i386-*-freebsd*) | |
294 | echo "skipping libresolv checks for $host" | |
295 | ;; | |
296 | *) | |
297 | AC_CHECK_LIB(resolv, inet_aton, AC_CHECK_LIB(44bsd, inet_aton)) | |
298 | AC_CHECK_LIB(resolv, main) | |
299 | ;; | |
300 | esac | |
e0bddc45 | 301 | AC_CHECK_LIB(m, main) |
090089c4 | 302 | |
303 | dnl Check for libcrypt | |
b8de7ebe | 304 | dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD) |
be79ade0 | 305 | AC_CHECK_LIB(crypt, crypt, [CRYPTLIB="-lcrypt"]) |
306 | AC_SUBST(CRYPTLIB) | |
77f675ad | 307 | |
71f8abc8 | 308 | dnl Check for libcrypt |
309 | dnl We use crypt(3) which may be in libc, or in libcrypt (eg FreeBSD) | |
310 | AC_CHECK_LIB(pthread, main, [PTHREADLIB="-lpthread"]) | |
311 | AC_SUBST(PTHREADLIB) | |
312 | ||
77f675ad | 313 | dnl System-specific library modifications |
314 | dnl | |
315 | case "$host" in | |
88738790 | 316 | i386-*-solaris2.*) |
7149a49f | 317 | if test "$GCC" = "yes"; then |
318 | echo "Removing -O for gcc on $host" | |
80e92d6d | 319 | CFLAGS="`echo $CFLAGS | sed -e 's/-O[[0-9]]*//'`" |
7149a49f | 320 | fi |
321 | ;; | |
77f675ad | 322 | *-sgi-irix*) |
323 | echo "Removing -lsocket for IRIX..." | |
6716b242 | 324 | LIBS=`echo $LIBS | sed -e s/-lsocket//` |
77f675ad | 325 | echo "Removing -lnsl for IRIX..." |
6716b242 | 326 | LIBS=`echo $LIBS | sed -e s/-lnsl//` |
b44c0fb4 | 327 | echo "Removing -lbsd for IRIX..." |
328 | LIBS=`echo $LIBS | sed -e s/-lbsd//` | |
77f675ad | 329 | ;; |
4ba0bd0e | 330 | dnl From: c0032033@ws.rz.tu-bs.de (Joerg Schumacher) |
331 | dnl Date: Thu, 17 Oct 1996 04:09:30 +0200 | |
332 | dnl Please change your configure script. AIX doesn't need -lbsd. | |
333 | *-ibm-aix*) | |
334 | echo "Removing -lbsd for AIX..." | |
335 | LIBS=`echo $LIBS | sed -e s/-lbsd//` | |
336 | ;; | |
30a4f2a8 | 337 | *m88k*) |
338 | CFLAGS="$CFLAGS -D_SQUID_MOTOROLA_" | |
7149a49f | 339 | AC_DEFINE(GETTIMEOFDAY_NO_TZP) |
340 | ;; | |
580ce039 | 341 | [*-*-solaris2.[0-4]]) |
7149a49f | 342 | AC_DEFINE(GETTIMEOFDAY_NO_TZP) |
30a4f2a8 | 343 | ;; |
77f675ad | 344 | esac |
090089c4 | 345 | |
176d10ee | 346 | # Recommended by Balint Nagy Endre <bne@CareNet.hu> |
347 | case "$host" in | |
348 | *-univel-sysv4.2MP) | |
349 | if test `uname -v` = "2.03"; then | |
350 | echo "disabling mallinfo for $host" | |
351 | ac_cv_func_mallinfo=no | |
352 | fi | |
353 | ;; | |
354 | esac | |
355 | ||
356 | ||
6716b242 | 357 | dnl Check for library functions |
358 | AC_CHECK_FUNCS(\ | |
30a4f2a8 | 359 | bcopy \ |
4ac29a5b | 360 | fchmod \ |
6716b242 | 361 | getdtablesize \ |
30a4f2a8 | 362 | getrusage \ |
9c1d8929 | 363 | getspnam \ |
30a4f2a8 | 364 | lrand48 \ |
6716b242 | 365 | mallinfo \ |
0f5efab0 | 366 | mallocblksize \ |
6716b242 | 367 | mallopt \ |
2ae6b9b0 | 368 | memcpy \ |
30a4f2a8 | 369 | memmove \ |
1812b6c7 | 370 | mktime \ |
88738790 | 371 | mstats \ |
dcfe6390 | 372 | poll \ |
b1e77ec1 | 373 | random \ |
6716b242 | 374 | regcomp \ |
375 | regexec \ | |
376 | regfree \ | |
30a4f2a8 | 377 | res_init \ |
234967c9 | 378 | seteuid \ |
30a4f2a8 | 379 | setpgrp \ |
6716b242 | 380 | setrlimit \ |
30a4f2a8 | 381 | setsid \ |
382 | sigaction \ | |
11430c03 | 383 | snprintf \ |
30a4f2a8 | 384 | srand48 \ |
b1e77ec1 | 385 | srandom \ |
6716b242 | 386 | sysconf \ |
387 | syslog \ | |
0a3efad5 | 388 | tempnam \ |
234967c9 | 389 | timegm \ |
28da5e0d | 390 | vsnprintf \ |
6716b242 | 391 | ) |
392 | ||
a03233e7 | 393 | case "$host" in |
394 | [alpha-dec-osf3.*]) | |
395 | # John Kay (jkay@nlanr.net) 19970818 | |
396 | echo "Disabling poll() for $host..." | |
397 | ac_cv_func_poll="no" | |
398 | ;; | |
399 | esac | |
400 | ||
60939927 | 401 | dnl Yay! Another Linux brokenness. Its not good enough |
402 | dnl to know that setresuid() exists, because RedHat 5.0 declares | |
403 | dnl setresuid() but doesn't implement it. | |
404 | dnl | |
405 | AC_CACHE_CHECK(if setresuid is implemented, ac_cv_func_setresuid, | |
5c51415d | 406 | AC_TRY_RUN([ |
60939927 | 407 | #include <stdlib.h> |
5c51415d | 408 | int main() { |
409 | if(setresuid(-1,-1,-1)) { | |
410 | perror("setresuid:"); | |
411 | exit(1); | |
60939927 | 412 | } |
413 | exit(0); | |
5c51415d | 414 | } |
415 | ],ac_cv_func_setresuid="yes",ac_cv_func_setresuid="no") | |
60939927 | 416 | ) |
5c51415d | 417 | if test "$ac_cv_func_setresuid" = "yes" ; then |
418 | AC_DEFINE(HAVE_SETRESUID) | |
419 | fi | |
60939927 | 420 | |
5c51415d | 421 | AC_ARG_ENABLE(gnuregex, |
422 | [ --enable-gnuregex Compile GNUregex], | |
423 | [USE_GNUREGEX=$enableval]) | |
424 | ||
425 | AC_ARG_ENABLE(hashkey, | |
426 | [ --enable-hashkey[=sha|md5] | |
427 | Use hash function as store index, instead of URL], | |
428 | [ case "$enableval" in | |
429 | yes|sha) | |
430 | echo "Store key set to SHA" | |
431 | AC_DEFINE(STORE_KEY_SHA) | |
432 | ;; | |
433 | md5) | |
434 | echo "Store key set to MD5" | |
435 | AC_DEFINE(STORE_KEY_MD5) | |
436 | ;; | |
437 | esac | |
438 | ]) | |
439 | ||
440 | AC_ARG_ENABLE(xmalloc_debug, | |
109ff6af | 441 | [ --enable-xmalloc-debug Do some simple malloc debugging], |
5c51415d | 442 | [ if test "$enableval" = "yes" ; then |
443 | echo "Malloc debugging enabled" | |
444 | AC_DEFINE(XMALLOC_DEBUG) | |
445 | fi | |
446 | ]) | |
447 | ||
109ff6af | 448 | AC_ARG_ENABLE(xmalloc_debug_count, |
449 | [ --enable-xmalloc-debug-count | |
450 | Detailed trace of memory allocations], | |
451 | [ if test "$enableval" = "yes" ; then | |
452 | echo "Malloc tracing enabled" | |
453 | AC_DEFINE(XMALLOC_COUNT) | |
454 | fi | |
455 | ]) | |
456 | ||
5c51415d | 457 | AC_ARG_ENABLE(xmalloc_statistics, |
458 | [ --enable-xmalloc-statistics | |
459 | Show malloc statistics in status page], | |
460 | [ if test "$enableval" = "yes" ; then | |
461 | echo "Malloc statistics enabled" | |
462 | AC_DEFINE(XMALLOC_STATISTICS) | |
463 | fi | |
464 | ]) | |
109ff6af | 465 | |
466 | AC_ARG_ENABLE(async_io, | |
467 | [ --enable-async-io Use ASYNC disk I/O], | |
468 | [ if test "$enableval" = "yes" ; then | |
469 | echo "Async I/O enabled" | |
470 | AC_DEFINE(USE_ASYNC_IO) | |
471 | fi | |
472 | ]) | |
473 | ||
7a081912 | 474 | AC_MSG_CHECKING(if GNUregex needs to be compiled) |
00fa2c12 | 475 | if test "$ac_cv_func_regcomp" = "no" ; then |
74946a0f | 476 | USE_GNUREGEX="yes" |
00fa2c12 | 477 | else |
74946a0f | 478 | USE_GNUREGEX="no" |
00fa2c12 | 479 | fi |
480 | case "$host" in | |
580ce039 | 481 | [*-sun-solaris2.[0-4]]) |
74946a0f | 482 | USE_GNUREGEX="yes" |
483 | ;; | |
484 | [*-next-nextstep*]) | |
485 | USE_GNUREGEX="yes" | |
486 | ;; | |
00fa2c12 | 487 | esac |
74946a0f | 488 | AC_MSG_RESULT($USE_GNUREGEX) |
489 | if test "$USE_GNUREGEX" = "yes"; then | |
26675bf4 | 490 | REGEXLIB="-lregex" |
7a081912 | 491 | LIBREGEX="libregex.a" |
74946a0f | 492 | AC_DEFINE(USE_GNUREGEX) |
7a081912 | 493 | fi |
26675bf4 | 494 | AC_SUBST(REGEXLIB) |
00fa2c12 | 495 | AC_SUBST(LIBREGEX) |
7a081912 | 496 | |
3f6fcd8a | 497 | AC_REPLACE_FUNCS(\ |
498 | tempnam \ | |
4d38fc7e | 499 | strerror \ |
3f6fcd8a | 500 | ) |
501 | ||
5c51415d | 502 | dnl Not cached since people are likely to tune this |
e924600d | 503 | AC_MSG_CHECKING(Default FD_SETSIZE value) |
504 | AC_TRY_RUN([ | |
505 | #if HAVE_STDIO_H | |
506 | #include <stdio.h> | |
507 | #endif | |
508 | #if HAVE_UNISTD_H | |
509 | #include <unistd.h> | |
510 | #endif | |
511 | #if HAVE_SYS_TIME_H | |
512 | #include <sys/time.h> | |
513 | #endif | |
514 | #if HAVE_SYS_SELECT_H | |
515 | #include <sys/select.h> | |
516 | #endif | |
517 | #if HAVE_SYS_TYPES_H | |
518 | #include <sys/types.h> | |
519 | #endif | |
520 | main() { | |
521 | fprintf (fopen("conftestval", "w"), "%d\n", FD_SETSIZE); | |
522 | exit(0); | |
523 | } | |
524 | ], | |
525 | DEFAULT_FD_SETSIZE=`cat conftestval`, | |
526 | DEFAULT_FD_SETSIZE=256, | |
527 | DEFAULT_FD_SETSIZE=256) | |
528 | AC_MSG_RESULT($DEFAULT_FD_SETSIZE) | |
529 | AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE) | |
530 | ||
5c51415d | 531 | dnl Not cached since people are likely to tune this |
234967c9 | 532 | AC_MSG_CHECKING(Maximum number of filedescriptors we can open) |
533 | AC_TRY_RUN([ | |
8cca06da | 534 | #include <stdio.h> |
234967c9 | 535 | #include <unistd.h> |
30a4f2a8 | 536 | #include <sys/time.h> /* needed on FreeBSD */ |
234967c9 | 537 | #include <sys/param.h> |
538 | #include <sys/resource.h> | |
539 | main() { | |
540 | int i,j; | |
541 | #if HAVE_SETRLIMIT | |
542 | struct rlimit rl; | |
543 | #if defined(RLIMIT_NOFILE) | |
544 | if (getrlimit(RLIMIT_NOFILE, &rl) < 0) { | |
545 | perror("getrlimit: RLIMIT_NOFILE"); | |
546 | } else { | |
547 | rl.rlim_cur = rl.rlim_max; /* set it to the max */ | |
548 | if (setrlimit(RLIMIT_NOFILE, &rl) < 0) { | |
549 | perror("setrlimit: RLIMIT_NOFILE"); | |
550 | } | |
551 | } | |
552 | #elif defined(RLIMIT_OFILE) | |
553 | if (getrlimit(RLIMIT_OFILE, &rl) < 0) { | |
554 | perror("getrlimit: RLIMIT_OFILE"); | |
555 | } else { | |
556 | rl.rlim_cur = rl.rlim_max; /* set it to the max */ | |
557 | if (setrlimit(RLIMIT_OFILE, &rl) < 0) { | |
558 | perror("setrlimit: RLIMIT_OFILE"); | |
559 | } | |
560 | } | |
561 | #endif /* RLIMIT_NOFILE */ | |
562 | #endif /* HAVE_SETRLIMIT */ | |
563 | #if HAVE_SYSCONF && defined(_SC_OPEN_MAX) | |
564 | i = sysconf(_SC_OPEN_MAX); | |
3f6fcd8a | 565 | #elif HAVE_GETDTABLESIZE && !defined(__linux__) |
234967c9 | 566 | i = getdtablesize(); |
567 | #elif defined(OPEN_MAX) | |
568 | i = OPEN_MAX; | |
569 | #elif defined(NOFILE) | |
570 | i = NOFILE; | |
571 | #elif defined(_NFILE) | |
572 | i = _NFILE; | |
573 | #else | |
574 | while((j=open("/dev/null", 0)) > 0) i=j; | |
0a5b9b32 | 575 | close(i); close(i-1); |
576 | i++; | |
234967c9 | 577 | #endif |
578 | fprintf (fopen("conftestval", "w"), "%d\n", i); | |
579 | exit(0); | |
580 | } | |
581 | ], | |
431d84c5 | 582 | SQUID_MAXFD=`cat conftestval`, |
583 | SQUID_MAXFD=256, | |
584 | SQUID_MAXFD=256) | |
585 | AC_MSG_RESULT($SQUID_MAXFD) | |
586 | AC_DEFINE_UNQUOTED(SQUID_MAXFD, $SQUID_MAXFD) | |
234967c9 | 587 | |
5c51415d | 588 | dnl Not cached since people are likely to tune this |
30a4f2a8 | 589 | AC_MSG_CHECKING(Default UDP send buffer size) |
590 | AC_TRY_RUN([ | |
8cca06da | 591 | #include <stdlib.h> |
592 | #include <stdio.h> | |
30a4f2a8 | 593 | #include <sys/types.h> |
594 | #include <sys/socket.h> | |
595 | #include <netinet/in.h> | |
596 | main () | |
597 | { | |
598 | int fd,val=0,len=sizeof(int); | |
599 | if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1); | |
600 | if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1); | |
601 | if (val<=0) exit(1); | |
602 | fprintf (fopen("conftestval", "w"), "%d\n", val); | |
603 | exit(0); | |
604 | } | |
605 | ], | |
606 | SQUID_UDP_SO_SNDBUF=`cat conftestval`, | |
1c481e00 | 607 | SQUID_UDP_SO_SNDBUF=16384, |
608 | SQUID_UDP_SO_SNDBUF=16384) | |
30a4f2a8 | 609 | AC_MSG_RESULT($SQUID_UDP_SO_SNDBUF) |
610 | AC_DEFINE_UNQUOTED(SQUID_UDP_SO_SNDBUF, $SQUID_UDP_SO_SNDBUF) | |
611 | ||
5c51415d | 612 | dnl Not cached since people are likely to tune this |
30a4f2a8 | 613 | AC_MSG_CHECKING(Default UDP receive buffer size) |
614 | AC_TRY_RUN([ | |
8cca06da | 615 | #include <stdlib.h> |
616 | #include <stdio.h> | |
30a4f2a8 | 617 | #include <sys/types.h> |
618 | #include <sys/socket.h> | |
619 | #include <netinet/in.h> | |
620 | main () | |
621 | { | |
622 | int fd,val=0,len=sizeof(int); | |
623 | if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) exit(1); | |
624 | if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1); | |
625 | if (val <= 0) exit(1); | |
626 | fprintf (fopen("conftestval", "w"), "%d\n", val); | |
627 | exit(0); | |
628 | } | |
629 | ], | |
630 | SQUID_UDP_SO_RCVBUF=`cat conftestval`, | |
1c481e00 | 631 | SQUID_UDP_SO_RCVBUF=16384, |
632 | SQUID_UDP_SO_RCVBUF=16384) | |
30a4f2a8 | 633 | AC_MSG_RESULT($SQUID_UDP_SO_RCVBUF) |
634 | AC_DEFINE_UNQUOTED(SQUID_UDP_SO_RCVBUF, $SQUID_UDP_SO_RCVBUF) | |
635 | ||
5c51415d | 636 | dnl Not cached since people are likely to tune this |
30a4f2a8 | 637 | AC_MSG_CHECKING(Default TCP send buffer size) |
638 | AC_TRY_RUN([ | |
8cca06da | 639 | #include <stdlib.h> |
640 | #include <stdio.h> | |
30a4f2a8 | 641 | #include <sys/types.h> |
642 | #include <sys/socket.h> | |
643 | #include <netinet/in.h> | |
644 | main () | |
645 | { | |
646 | int fd,val=0,len=sizeof(int); | |
647 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1); | |
648 | if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) exit(1); | |
649 | if (val <= 0) exit(1); | |
650 | fprintf (fopen("conftestval", "w"), "%d\n", val); | |
651 | exit(0); | |
652 | } | |
653 | ], | |
654 | SQUID_TCP_SO_SNDBUF=`cat conftestval`, | |
1c481e00 | 655 | SQUID_TCP_SO_SNDBUF=16384, |
656 | SQUID_TCP_SO_SNDBUF=16384) | |
30a4f2a8 | 657 | AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF) |
658 | AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF) | |
659 | ||
5c51415d | 660 | dnl Not cached since people are likely to tune this |
30a4f2a8 | 661 | AC_MSG_CHECKING(Default TCP receive buffer size) |
662 | AC_TRY_RUN([ | |
8cca06da | 663 | #include <stdlib.h> |
664 | #include <stdio.h> | |
30a4f2a8 | 665 | #include <sys/types.h> |
666 | #include <sys/socket.h> | |
667 | #include <netinet/in.h> | |
668 | main () | |
669 | { | |
670 | int fd,val=0,len=sizeof(int); | |
671 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) exit(1); | |
672 | if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) exit(1); | |
673 | if (val <= 0) exit(1); | |
674 | fprintf (fopen("conftestval", "w"), "%d\n", val); | |
675 | exit(0); | |
676 | } | |
677 | ], | |
678 | SQUID_TCP_SO_RCVBUF=`cat conftestval`, | |
1c481e00 | 679 | SQUID_TCP_SO_RCVBUF=16384, |
680 | SQUID_TCP_SO_RCVBUF=16384) | |
30a4f2a8 | 681 | AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF) |
682 | AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF) | |
683 | ||
5c51415d | 684 | AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist, |
685 | AC_TRY_COMPILE([#include <stdio.h>],[char *s = sys_errlist[0];], | |
686 | ac_cv_needs_sys_errlist="no", | |
687 | ac_cv_needs_sys_errlist="yes") | |
688 | ) | |
689 | if test "$ac_cv_needs_sys_errlist" = "yes" ; then | |
690 | AC_DEFINE(NEED_SYS_ERRLIST) | |
691 | fi | |
30a4f2a8 | 692 | |
5c51415d | 693 | dnl Not cached since people are likely to change this |
6bf65235 | 694 | AC_MSG_CHECKING(for libresolv _dns_ttl_ hack) |
695 | AC_TRY_LINK(extern int _dns_ttl_;,return _dns_ttl_;, | |
696 | [AC_MSG_RESULT(yes) | |
697 | AC_DEFINE(LIBRESOLV_DNS_TTL_HACK)], | |
698 | AC_MSG_RESULT(no)) | |
699 | ||
090089c4 | 700 | dnl Need the debugging version of malloc if available |
701 | XTRA_OBJS='' | |
6509a1a0 | 702 | if test "$ac_cv_lib_malloc_main" = "yes" ; then |
090089c4 | 703 | if test -r /usr/lib/debug/malloc.o ; then |
704 | XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/malloc.o" | |
705 | fi | |
706 | if test -r /usr/lib/debug/mallocmap.o ; then | |
707 | XTRA_OBJS="$XTRA_OBJS /usr/lib/debug/mallocmap.o" | |
708 | fi | |
709 | fi | |
2bbd722b | 710 | SNMPLIB='libsnmp.a' |
711 | AC_SUBST(SNMPLIB) | |
712 | ||
090089c4 | 713 | AC_SUBST(XTRA_OBJS) |
714 | ||
38fea766 | 715 | if test -z "$XTRA_LIBS"; then |
716 | XTRA_LIBS="$LIBS" | |
717 | LIBS='' | |
718 | fi | |
090089c4 | 719 | AC_SUBST(XTRA_LIBS) |
720 | ||
090089c4 | 721 | dnl Clean up after OSF/1 core dump bug |
722 | rm -f core | |
723 | ||
724 | AC_OUTPUT(\ | |
0992a350 | 725 | ./makefile \ |
090089c4 | 726 | ./lib/Makefile \ |
a26bdc75 | 727 | ./include/config.h \ |
090089c4 | 728 | ./scripts/Makefile \ |
729 | ./scripts/RunCache \ | |
730 | ./scripts/RunAccel \ | |
a26bdc75 | 731 | ./src/Makefile \ |
608cdf33 | 732 | ./src/options.h \ |
e550e8b6 | 733 | ./contrib/Makefile \ |
2bbd722b | 734 | ./snmplib/Makefile \ |
81280a96 | 735 | ./icons/Makefile \ |
d4fb069d | 736 | ./errors/Makefile \ |
090089c4 | 737 | ) |