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