]>
Commit | Line | Data |
---|---|---|
f6e9a3ee | 1 | ## Copyright (C) 1996-2019 The Squid Software Foundation and contributors |
5d2e6f19 AJ |
2 | ## |
3 | ## Squid software is distributed under GPLv2+ license and includes | |
4 | ## contributions from numerous individuals and organizations. | |
5 | ## Please see the COPYING and CONTRIBUTORS files for details. | |
6 | ## | |
0abb39dd FC |
7 | |
8 | dnl check that strnstr() works fine. On Macos X it can cause a buffer overrun | |
9 | dnl sets squid_cv_func_strnstr to "yes" or "no", and defines HAVE_STRNSTR | |
10 | AC_DEFUN([SQUID_CHECK_FUNC_STRNSTR],[ | |
11 | ||
12 | # Yay! This one is a MacOSX brokenness. Its not good enough | |
13 | # to know that strnstr() exists, because MacOSX 10.4 have a bad | |
14 | # copy that crashes with a buffer over-run! | |
15 | AH_TEMPLATE(HAVE_STRNSTR,[MacOS brokenness: strnstr() can overrun on that system]) | |
16 | AC_CACHE_CHECK([if strnstr is well implemented], squid_cv_func_strnstr, | |
17 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
18 | #include <stdlib.h> | |
19 | #include <stdio.h> | |
20 | #include <string.h> | |
21 | // we expect this to succeed, or crash on over-run. | |
22 | // if it passes otherwise we may need a better check. | |
23 | int main(int argc, char **argv) | |
24 | { | |
25 | int size = 20; | |
26 | char *str = malloc(size); | |
27 | memset(str, 'x', size); | |
28 | strnstr(str, "fubar", size); | |
29 | return 0; | |
30 | } | |
aff0e8fe | 31 | ]])],[squid_cv_func_strnstr="yes"],[squid_cv_func_strnstr="no"],[:]) |
0abb39dd FC |
32 | ) |
33 | if test "$squid_cv_func_strnstr" = "yes" ; then | |
34 | AC_DEFINE(HAVE_STRNSTR,1) | |
35 | fi | |
36 | ||
37 | ]) dnl SQUID_CHECK_FUNC_STRNSTR | |
38 | ||
af1e01a8 FC |
39 | dnl check that epoll actually works |
40 | dnl sets squid_cv_epoll_works to "yes" or "no" | |
41 | AC_DEFUN([SQUID_CHECK_EPOLL],[ | |
42 | ||
43 | AC_CACHE_CHECK(if epoll works, squid_cv_epoll_works, | |
44 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
45 | #include <sys/epoll.h> | |
46 | #include <stdlib.h> | |
47 | #include <stdio.h> | |
48 | int main(int argc, char **argv) | |
49 | { | |
50 | int fd = epoll_create(256); | |
51 | if (fd < 0) { | |
52 | perror("epoll_create:"); | |
53 | return 1; | |
54 | } | |
55 | return 0; | |
56 | } | |
aff0e8fe | 57 | ]])],[squid_cv_epoll_works=yes],[squid_cv_epoll_works=no],[:])) |
af1e01a8 FC |
58 | |
59 | ]) dnl SQUID_CHECK_EPOLL | |
45c41a07 | 60 | |
a1ad2f9b AJ |
61 | dnl check that /dev/poll actually works |
62 | dnl sets squid_cv_devpoll_works to "yes" or "no" | |
63 | AC_DEFUN([SQUID_CHECK_DEVPOLL],[ | |
64 | ||
65 | AC_CACHE_CHECK(if /dev/poll works, squid_cv_devpoll_works, | |
66 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
67 | #include <sys/devpoll.h> | |
68 | #include <fcntl.h> | |
69 | #include <stdlib.h> | |
70 | #include <stdio.h> | |
71 | int main(int argc, char **argv) | |
72 | { | |
73 | int fd = open("/dev/poll", O_RDWR); | |
74 | if (fd < 0) { | |
75 | perror("devpoll_create:"); | |
76 | return 1; | |
77 | } | |
78 | return 0; | |
79 | } | |
80 | ]])],[squid_cv_devpoll_works=yes],[squid_cv_devpoll_works=no],[:])) | |
81 | ||
82 | ]) dnl SQUID_CHECK_DEVPOLL | |
83 | ||
ef7ece58 | 84 | |
45c41a07 FC |
85 | dnl check that we have functional libcap2 headers |
86 | dnl sets squid_cv_sys_capability_works to "yes" or "no" | |
ef7ece58 | 87 | |
45c41a07 FC |
88 | AC_DEFUN([SQUID_CHECK_FUNCTIONAL_LIBCAP2],[ |
89 | AC_CACHE_CHECK([for operational libcap2 headers], | |
90 | squid_cv_sys_capability_works, | |
91 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[ | |
92 | #include <stdlib.h> | |
93 | #include <stddef.h> | |
94 | #include <sys/capability.h> | |
95 | ]], [[ | |
96 | capget(NULL, NULL); | |
97 | capset(NULL, NULL); | |
98 | ]])], | |
99 | [squid_cv_sys_capability_works=yes], | |
100 | [squid_cv_sys_capability_works=no]) | |
101 | ) | |
102 | ]) | |
103 | ||
46f50de9 | 104 | |
5d2e6f19 | 105 | dnl From Samba. Thanks! |
46f50de9 | 106 | dnl check that we have Unix sockets. Sets squid_cv_unixsocket to either yes or no depending on the check |
ef7ece58 | 107 | |
46f50de9 FC |
108 | AC_DEFUN([SQUID_CHECK_UNIX_SOCKET],[ |
109 | AC_CACHE_CHECK([for unix domain sockets],squid_cv_unixsocket, [ | |
110 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
111 | #include <sys/types.h> | |
112 | #include <stdlib.h> | |
113 | #include <stddef.h> | |
114 | #include <sys/socket.h> | |
115 | #include <sys/un.h>]], [[ | |
116 | struct sockaddr_un sunaddr; | |
117 | sunaddr.sun_family = AF_UNIX; | |
118 | ]])],[squid_cv_unixsocket=yes],[squid_cv_unixsocket=no])]) | |
119 | ]) | |
ef7ece58 FC |
120 | |
121 | ||
1ca3e305 FC |
122 | dnl check the default FD_SETSIZE size. |
123 | dnl not cached, people are likely to tune this | |
124 | dnl defines DEFAULT_FD_SETSIZE | |
125 | ||
126 | AC_DEFUN([SQUID_CHECK_DEFAULT_FD_SETSIZE],[ | |
127 | AC_MSG_CHECKING(Default FD_SETSIZE value) | |
128 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
129 | #if HAVE_STDIO_H | |
130 | #include <stdio.h> | |
131 | #endif | |
132 | #if HAVE_UNISTD_H | |
133 | #include <unistd.h> | |
134 | #endif | |
135 | #if HAVE_STDLIB_H | |
136 | #include <stdlib.h> | |
137 | #endif | |
138 | #if HAVE_SYS_TIME_H | |
139 | #include <sys/time.h> | |
140 | #endif | |
141 | #if HAVE_SYS_SELECT_H | |
142 | #include <sys/select.h> | |
143 | #endif | |
144 | #if HAVE_SYS_TYPES_H | |
145 | #include <sys/types.h> | |
146 | #endif | |
1ca3e305 FC |
147 | #if HAVE_WINSOCK2_H |
148 | #include <winsock2.h> | |
15d36271 FC |
149 | #elif HAVE_WINSOCK_H |
150 | #include <winsock.h> | |
1ca3e305 FC |
151 | #endif |
152 | int main(int argc, char **argv) { | |
153 | FILE *fp = fopen("conftestval", "w"); | |
154 | fprintf (fp, "%d\n", FD_SETSIZE); | |
155 | return 0; | |
156 | } | |
157 | ]])],[DEFAULT_FD_SETSIZE=`cat conftestval`],[DEFAULT_FD_SETSIZE=256],[DEFAULT_FD_SETSIZE=256]) | |
158 | AC_MSG_RESULT($DEFAULT_FD_SETSIZE) | |
159 | AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE, [Default FD_SETSIZE value]) | |
160 | ]) | |
f467f578 FC |
161 | |
162 | ||
163 | dnl checks the maximum number of filedescriptor we can open | |
164 | dnl sets shell var squid_filedescriptors_num | |
165 | ||
166 | AC_DEFUN([SQUID_CHECK_MAXFD],[ | |
0292eeb7 | 167 | AC_CHECK_FUNCS(setrlimit) |
f467f578 FC |
168 | AC_MSG_CHECKING(Maximum number of filedescriptors we can open) |
169 | dnl damn! FreeBSD pthreads break dup2(). | |
170 | SQUID_STATE_SAVE(maxfd) | |
171 | case $host in | |
172 | i386-unknown-freebsd*) | |
173 | if echo "$LDFLAGS" | grep -q pthread; then | |
174 | LDFLAGS=`echo $LDFLAGS | sed -e "s/-pthread//"` | |
175 | fi | |
176 | esac | |
177 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
178 | #include <stdio.h> | |
179 | #include <unistd.h> | |
180 | #include <stdlib.h> | |
181 | #include <sys/time.h> /* needed on FreeBSD */ | |
182 | #include <sys/param.h> | |
183 | #include <sys/resource.h> | |
184 | int main(int argc, char **argv) { | |
185 | FILE *fp; | |
186 | int i,j; | |
187 | #if defined(__CYGWIN32__) || defined (__CYGWIN__) | |
188 | /* getrlimit and sysconf returns bogous values on cygwin32. | |
189 | * Number of fds is virtually unlimited in cygwin (sys/param.h) | |
190 | * __CYGWIN32__ is deprecated. | |
191 | */ | |
192 | i = NOFILE; | |
193 | #else | |
194 | #if HAVE_SETRLIMIT | |
195 | struct rlimit rl; | |
196 | #if defined(RLIMIT_NOFILE) | |
197 | if (getrlimit(RLIMIT_NOFILE, &rl) < 0) { | |
198 | perror("getrlimit: RLIMIT_NOFILE"); | |
199 | } else { | |
200 | #if defined(__APPLE__) | |
201 | /* asking for more than OPEN_MAX fails on Leopard */ | |
202 | rl.rlim_cur = (OPEN_MAX < rl.rlim_max ? OPEN_MAX : rl.rlim_max); | |
203 | #else | |
204 | rl.rlim_cur = rl.rlim_max; /* set it to the max */ | |
205 | #endif | |
206 | if (setrlimit(RLIMIT_NOFILE, &rl) < 0) { | |
207 | perror("setrlimit: RLIMIT_NOFILE"); | |
208 | } | |
209 | } | |
210 | #elif defined(RLIMIT_OFILE) | |
211 | if (getrlimit(RLIMIT_OFILE, &rl) < 0) { | |
212 | perror("getrlimit: RLIMIT_OFILE"); | |
213 | } else { | |
214 | rl.rlim_cur = rl.rlim_max; /* set it to the max */ | |
215 | if (setrlimit(RLIMIT_OFILE, &rl) < 0) { | |
216 | perror("setrlimit: RLIMIT_OFILE"); | |
217 | } | |
218 | } | |
219 | #endif /* RLIMIT_NOFILE */ | |
220 | #endif /* HAVE_SETRLIMIT */ | |
221 | /* by starting at 2^14, we will never get higher | |
222 | than 2^15 for squid_filedescriptors_num */ | |
223 | i = j = 1<<14; | |
224 | while (j) { | |
225 | j >>= 1; | |
226 | if (dup2(0, i) < 0) { | |
227 | i -= j; | |
228 | } else { | |
229 | close(i); | |
230 | i += j; | |
231 | } | |
232 | } | |
233 | i++; | |
234 | #endif /* IF !DEF CYGWIN */ | |
235 | fp = fopen("conftestval", "w"); | |
236 | fprintf (fp, "%d\n", i & ~0x3F); | |
237 | return 0; | |
238 | } | |
239 | ]])],[squid_filedescriptors_num=`cat conftestval`],[squid_filedescriptors_num=256],[squid_filedescriptors_num=256]) | |
240 | dnl Microsoft MSVCRT.DLL supports 2048 maximum FDs | |
241 | case "$host_os" in | |
242 | mingw|mingw32) | |
243 | squid_filedescriptors_num="2048" | |
244 | ;; | |
245 | esac | |
246 | AC_MSG_RESULT($squid_filedescriptors_num) | |
247 | SQUID_STATE_ROLLBACK(maxfd) | |
248 | ||
249 | if test `expr $squid_filedescriptors_num % 64` != 0; then | |
250 | AC_MSG_WARN([$squid_filedescriptors_num is not an multiple of 64. This may cause issues on certain platforms.]) | |
251 | fi | |
252 | ]) | |
af494bc8 FC |
253 | |
254 | ||
255 | dnl Check whether this OS defines sin6_len as a member of sockaddr_in6 as a backup to ss_len | |
256 | dnl defines HAVE_SIN6_LEN_IN_SAI | |
257 | dnl TODO: move to AC_CHECK_MEMBER? | |
258 | ||
259 | AC_DEFUN([SQUID_CHECK_SIN6_LEN_IN_SAI],[ | |
260 | AC_CACHE_CHECK([for sin6_len field in struct sockaddr_in6], | |
261 | ac_cv_have_sin6_len_in_struct_sai, [ | |
262 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
263 | #include <sys/types.h> | |
264 | #include <sys/socket.h> | |
265 | #include <netinet/in.h> | |
266 | ]], [[ struct sockaddr_in6 s; s.sin6_len = 1; ]])],[ ac_cv_have_sin6_len_in_struct_sai="yes" ],[ ac_cv_have_sin6_len_in_struct_sai="no" | |
267 | ]) | |
268 | ]) | |
269 | SQUID_DEFINE_BOOL(HAVE_SIN6_LEN_IN_SAI,$ac_cv_have_sin6_len_in_struct_sai, | |
270 | [Defined if struct sockaddr_in6 has sin6_len]) | |
271 | ]) | |
272 | ||
273 | ||
274 | dnl Check whether this OS defines ss_len as a member of sockaddr_storage | |
275 | dnl defines HAVE_SS_LEN_IN_SS | |
276 | dnl TODO: move to AC_CHECK_MEMBER? | |
277 | ||
278 | AC_DEFUN([SQUID_CHECK_SS_LEN_IN_SOCKADDR_STORAGE],[ | |
279 | AC_CACHE_CHECK([for ss_len field in struct sockaddr_storage], | |
280 | ac_cv_have_ss_len_in_struct_ss, [ | |
281 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
282 | #include <sys/types.h> | |
283 | #include <sys/socket.h> | |
284 | #include <netinet/in.h> | |
285 | ]], [[ struct sockaddr_storage s; s.ss_len = 1; ]])],[ ac_cv_have_ss_len_in_struct_ss="yes" ],[ ac_cv_have_ss_len_in_struct_ss="no" | |
286 | ]) | |
287 | ]) | |
288 | SQUID_DEFINE_BOOL(HAVE_SS_LEN_IN_SS,$ac_cv_have_ss_len_in_struct_ss, | |
289 | [Define if sockaddr_storage has field ss_len]) | |
290 | ]) | |
291 | ||
292 | ||
293 | dnl Check whether this OS defines sin_len as a member of sockaddr_in as a backup to ss_len | |
294 | dnl defines HAVE_SIN_LEN_IN_SAI | |
295 | dnl TODO: move to AC_CHECK_MEMBER? | |
296 | ||
297 | AC_DEFUN([SQUID_CHECK_SIN_LEN_IN_SOCKADDR_IN],[ | |
298 | AC_CACHE_CHECK([for sin_len field in struct sockaddr_in], | |
299 | ac_cv_have_sin_len_in_struct_sai, [ | |
300 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
301 | #include <sys/types.h> | |
302 | #include <sys/socket.h> | |
303 | #include <netinet/in.h> | |
304 | ]], [[ struct sockaddr_in s; s.sin_len = 1; ]])],[ ac_cv_have_sin_len_in_struct_sai="yes" ],[ ac_cv_have_sin_len_in_struct_sai="no" | |
305 | ]) | |
306 | ]) | |
307 | SQUID_DEFINE_BOOL(HAVE_SIN_LEN_IN_SAI,$ac_cv_have_sin_len_in_struct_sai,[Define if sockaddr_in has field sin_len]) | |
308 | ]) | |
8e0acaf5 FC |
309 | |
310 | ||
311 | dnl detects default UDP buffer size | |
312 | dnl not cached since people are likely to tune this | |
313 | dnl defines SQUID_DETECT_UDP_SO_SNDBUF | |
314 | ||
315 | AC_DEFUN([SQUID_DETECT_UDP_SND_BUFSIZE],[ | |
316 | AC_MSG_CHECKING(Default UDP send buffer size) | |
317 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
318 | #include <stdlib.h> | |
319 | #include <stdio.h> | |
320 | #include <sys/types.h> | |
321 | #if HAVE_SYS_SOCKET_H | |
322 | #include <sys/socket.h> | |
323 | #endif | |
324 | #if HAVE_NETINET_IN_H | |
325 | #include <netinet/in.h> | |
326 | #endif | |
8e0acaf5 FC |
327 | #if HAVE_WINSOCK2_H |
328 | #include <winsock2.h> | |
15d36271 FC |
329 | #elif HAVE_WINSOCK_H |
330 | #include <winsock.h> | |
8e0acaf5 FC |
331 | #endif |
332 | int main(int argc, char **argv) | |
333 | { | |
334 | FILE *fp; | |
335 | int fd,val=0; | |
336 | #if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__)) | |
337 | int len=sizeof(int); | |
338 | WSADATA wsaData; | |
339 | WSAStartup(2, &wsaData); | |
340 | #else | |
341 | socklen_t len=sizeof(socklen_t); | |
342 | #endif | |
343 | if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return 1; | |
344 | #if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__)) | |
345 | if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&val, &len) < 0) return 1; | |
346 | WSACleanup(); | |
347 | #else | |
348 | if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) return 1; | |
349 | #endif | |
350 | if (val<=0) return 1; | |
351 | fp = fopen("conftestval", "w"); | |
352 | fprintf (fp, "%d\n", val); | |
353 | return 0; | |
354 | } | |
355 | ]])],[SQUID_DETECT_UDP_SO_SNDBUF=`cat conftestval`],[SQUID_DETECT_UDP_SO_SNDBUF=16384],[SQUID_DETECT_UDP_SO_SNDBUF=16384]) | |
356 | AC_MSG_RESULT($SQUID_DETECT_UDP_SO_SNDBUF) | |
357 | AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_SNDBUF, $SQUID_DETECT_UDP_SO_SNDBUF,[UDP send buffer size]) | |
358 | ]) | |
359 | ||
360 | ||
361 | dnl detects default UDP buffer size | |
362 | dnl not cached since people are likely to tune this | |
363 | dnl defines SQUID_DETECT_UDP_SO_RCVBUF | |
364 | ||
365 | AC_DEFUN([SQUID_DETECT_UDP_RECV_BUFSIZE],[ | |
366 | AC_MSG_CHECKING(Default UDP receive buffer size) | |
367 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
368 | #include <stdlib.h> | |
369 | #include <stdio.h> | |
370 | #include <sys/types.h> | |
371 | #if HAVE_SYS_SOCKET_H | |
372 | #include <sys/socket.h> | |
373 | #endif | |
374 | #if HAVE_NETINET_IN_H | |
375 | #include <netinet/in.h> | |
376 | #endif | |
8e0acaf5 FC |
377 | #if HAVE_WINSOCK2_H |
378 | #include <winsock2.h> | |
15d36271 FC |
379 | #elif HAVE_WINSOCK_H |
380 | #include <winsock.h> | |
8e0acaf5 FC |
381 | #endif |
382 | int main(int argc, char **argv) | |
383 | { | |
384 | FILE *fp; | |
385 | int fd,val=0; | |
386 | #if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__)) | |
387 | int len=sizeof(int); | |
388 | WSADATA wsaData; | |
389 | WSAStartup(2, &wsaData); | |
390 | #else | |
391 | socklen_t len=sizeof(socklen_t); | |
392 | #endif | |
393 | if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) return 1; | |
394 | #if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__)) | |
395 | if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&val, &len) < 0) return 1; | |
396 | WSACleanup(); | |
397 | #else | |
398 | if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) return 1; | |
399 | #endif | |
400 | if (val <= 0) return 1; | |
401 | fp = fopen("conftestval", "w"); | |
402 | fprintf (fp, "%d\n", val); | |
403 | return 0; | |
404 | } | |
405 | ]])],[SQUID_DETECT_UDP_SO_RCVBUF=`cat conftestval`],[SQUID_DETECT_UDP_SO_RCVBUF=16384],[SQUID_DETECT_UDP_SO_RCVBUF=16384]) | |
406 | AC_MSG_RESULT($SQUID_DETECT_UDP_SO_RCVBUF) | |
407 | AC_DEFINE_UNQUOTED(SQUID_DETECT_UDP_SO_RCVBUF, $SQUID_DETECT_UDP_SO_RCVBUF,[UDP receive buffer size]) | |
408 | ]) | |
409 | ||
410 | ||
411 | dnl detects default TCP buffer size | |
412 | dnl not cached since people are likely to tune this | |
413 | dnl defines SQUID_TCP_SO_SNDBUF | |
414 | ||
415 | AC_DEFUN([SQUID_DETECT_TCP_SND_BUFSIZE],[ | |
416 | AC_MSG_CHECKING(Default TCP send buffer size) | |
417 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
418 | #include <stdlib.h> | |
419 | #include <stdio.h> | |
420 | #include <sys/types.h> | |
421 | #if HAVE_SYS_SOCKET_H | |
422 | #include <sys/socket.h> | |
423 | #endif | |
424 | #if HAVE_NETINET_IN_H | |
425 | #include <netinet/in.h> | |
426 | #endif | |
8e0acaf5 FC |
427 | #if HAVE_WINSOCK2_H |
428 | #include <winsock2.h> | |
15d36271 FC |
429 | #elif HAVE_WINSOCK_H |
430 | #include <winsock.h> | |
8e0acaf5 FC |
431 | #endif |
432 | int main(int argc, char **argv) | |
433 | { | |
434 | FILE *fp; | |
435 | int fd,val=0; | |
436 | #if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__)) | |
437 | int len=sizeof(int); | |
438 | WSADATA wsaData; | |
439 | WSAStartup(2, &wsaData); | |
440 | #else | |
441 | socklen_t len=sizeof(socklen_t); | |
442 | #endif | |
443 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) return 1; | |
444 | #if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__)) | |
445 | if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, (char *)&val, &len) < 0) return 1; | |
446 | WSACleanup(); | |
447 | #else | |
448 | if (getsockopt(fd, SOL_SOCKET, SO_SNDBUF, &val, &len) < 0) return 1; | |
449 | #endif | |
450 | if (val <= 0) return 1; | |
451 | fp = fopen("conftestval", "w"); | |
452 | fprintf (fp, "%d\n", val); | |
453 | return 0; | |
454 | } | |
455 | ]])],[SQUID_TCP_SO_SNDBUF=`cat conftestval`],[SQUID_TCP_SO_SNDBUF=16384],[SQUID_TCP_SO_SNDBUF=16384]) | |
456 | AC_MSG_RESULT($SQUID_TCP_SO_SNDBUF) | |
457 | if test $SQUID_TCP_SO_SNDBUF -gt 32768; then | |
458 | AC_MSG_NOTICE([Limiting send buffer size to 32K]) | |
459 | SQUID_TCP_SO_SNDBUF=32768 | |
460 | fi | |
461 | AC_DEFINE_UNQUOTED(SQUID_TCP_SO_SNDBUF, $SQUID_TCP_SO_SNDBUF,[TCP send buffer size]) | |
462 | ]) | |
463 | ||
464 | ||
465 | dnl detects default TCP buffer size | |
466 | dnl not cached since people are likely to tune this | |
467 | dnl defines SQUID_TCP_SO_RECVBUF | |
468 | ||
469 | AC_DEFUN([SQUID_DETECT_TCP_RECV_BUFSIZE],[ | |
470 | AC_MSG_CHECKING(Default TCP receive buffer size) | |
471 | AC_RUN_IFELSE([AC_LANG_SOURCE([[ | |
472 | #include <stdlib.h> | |
473 | #include <stdio.h> | |
474 | #include <sys/types.h> | |
475 | #if HAVE_SYS_SOCKET_H | |
476 | #include <sys/socket.h> | |
477 | #endif | |
478 | #if HAVE_NETINET_IN_H | |
479 | #include <netinet/in.h> | |
480 | #endif | |
8e0acaf5 FC |
481 | #if HAVE_WINSOCK2_H |
482 | #include <winsock2.h> | |
15d36271 FC |
483 | #elif HAVE_WINSOCK_H |
484 | #include <winsock.h> | |
8e0acaf5 FC |
485 | #endif |
486 | int main(int argc, char **argv) | |
487 | { | |
488 | FILE *fp; | |
489 | int fd,val=0; | |
490 | #if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__)) | |
491 | int len=sizeof(int); | |
492 | WSADATA wsaData; | |
493 | WSAStartup(2, &wsaData); | |
494 | #else | |
495 | socklen_t len=sizeof(socklen_t); | |
496 | #endif | |
497 | if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) return 1; | |
498 | #if (defined(WIN32) || defined(__WIN32__) || defined(__WIN32)) && !(defined(__CYGWIN32__) || defined(__CYGWIN__)) | |
499 | if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&val, &len) < 0) return 1; | |
500 | WSACleanup(); | |
501 | #else | |
502 | if (getsockopt(fd, SOL_SOCKET, SO_RCVBUF, &val, &len) < 0) return 1; | |
503 | #endif | |
504 | if (val <= 0) return 1; | |
505 | fp = fopen("conftestval", "w"); | |
506 | fprintf (fp, "%d\n", val); | |
507 | return 0; | |
508 | } | |
509 | ]])],[SQUID_TCP_SO_RCVBUF=`cat conftestval`],[SQUID_TCP_SO_RCVBUF=16384],[SQUID_TCP_SO_RCVBUF=16384]) | |
510 | AC_MSG_RESULT($SQUID_TCP_SO_RCVBUF) | |
511 | if test $SQUID_TCP_SO_RCVBUF -gt 65535; then | |
512 | AC_MSG_NOTICE([Limiting receive buffer size to 64K]) | |
513 | SQUID_TCP_SO_RCVBUF=65535 | |
514 | fi | |
515 | AC_DEFINE_UNQUOTED(SQUID_TCP_SO_RCVBUF, $SQUID_TCP_SO_RCVBUF,[TCP receive buffer size]) | |
516 | ]) | |
5c3c56fa FC |
517 | |
518 | ||
519 | dnl check if we need to define sys_errlist as external | |
520 | dnl defines NEED_SYS_ERRLIST | |
521 | ||
522 | AC_DEFUN([SQUID_CHECK_NEED_SYS_ERRLIST],[ | |
523 | AC_CACHE_CHECK(if sys_errlist is already defined, ac_cv_needs_sys_errlist, | |
524 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>]], [[char *s = sys_errlist;]])],[ac_cv_needs_sys_errlist="no"],[ac_cv_needs_sys_errlist="yes"]) | |
525 | ) | |
526 | SQUID_DEFINE_BOOL(NEED_SYS_ERRLIST,$ac_cv_needs_sys_errlist,[If we need to declare sys_errlist as extern]) | |
527 | ]) | |
528 | ||
529 | ||
530 | dnl check if MAXPATHLEN is defined in the system headers | |
531 | dnl or define it ourselves | |
532 | ||
533 | AC_DEFUN([SQUID_CHECK_MAXPATHLEN],[ | |
bb214e97 | 534 | AC_MSG_CHECKING(for system-provided MAXPATHLEN) |
5c3c56fa FC |
535 | AC_LINK_IFELSE([ |
536 | AC_LANG_PROGRAM([[ | |
537 | #include <sys/param.h>]], [[ | |
538 | int i = MAXPATHLEN;]])], [ | |
539 | AC_MSG_RESULT(yes)], [ | |
540 | AC_MSG_RESULT(no) | |
541 | AC_DEFINE(MAXPATHLEN,256,[If MAXPATHLEN has not been defined])]) | |
542 | ]) | |
543 | ||
4e28d61e FC |
544 | |
545 | dnl check that we have a working statvfs | |
546 | dnl sets the ac_cv_func_statvfs shell variable and defines HAVE_STATVFS | |
547 | ||
bb214e97 FC |
548 | AC_DEFUN([SQUID_CHECK_WORKING_STATVFS],[ |
549 | AC_CACHE_CHECK(for working statvfs() interface,ac_cv_func_statvfs,[ | |
550 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
551 | #include <stdlib.h> | |
552 | #include <stdio.h> | |
553 | #include <sys/types.h> | |
554 | #include <sys/statvfs.h> | |
555 | ]], [[ | |
556 | struct statvfs sfs; | |
557 | sfs.f_blocks = sfs.f_bfree = sfs.f_frsize = | |
558 | sfs.f_files = sfs.f_ffree = 0; | |
559 | statvfs("/tmp", &sfs); | |
560 | ]])],[ac_cv_func_statvfs=yes],[ac_cv_func_statvfs=no]) | |
561 | ]) | |
562 | SQUID_DEFINE_BOOL(HAVE_STATVFS,$ac_cv_func_statvfs,[set to 1 if our system has statvfs(), and if it actually works]) | |
563 | ]) | |
4e28d61e | 564 | |
819656da | 565 | |
615540cd AJ |
566 | dnl Check whether this OS defines f_frsize as a member of struct statfs |
567 | AC_DEFUN([SQUID_CHECK_F_FRSIZE_IN_STATFS],[ | |
568 | AC_CACHE_CHECK([for f_frsize field in struct statfs], | |
569 | ac_cv_have_f_frsize_in_struct_statfs, [ | |
570 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
571 | #if HAVE_SYS_STATFS_H | |
572 | #include <sts/statfs.h> | |
573 | #endif | |
574 | #if HAVE_SYS_STATVFS_H | |
575 | #include <sts/statvfs.h> | |
576 | #endif | |
577 | #if HAVE_SYS_VFS_H | |
578 | #include <sts/vfs.h> | |
579 | #endif | |
580 | ]], [[ struct statfs s; s.f_frsize = 0; ]])],[ ac_cv_have_f_frsize_in_struct_statfs="yes" ],[ ac_cv_have_f_frsize_in_struct_statfs="no" | |
581 | ]) | |
582 | ]) | |
583 | SQUID_DEFINE_BOOL(HAVE_F_FRSIZE_IN_STATFS,$ac_cv_have_f_frsize_in_struct_statfs,[Define if struct statfs has field f_frsize (Linux 2.6 or later)]) | |
584 | ]) | |
585 | ||
586 | ||
819656da AJ |
587 | dnl check that we can use the libresolv _dns_ttl_ hack |
588 | dnl sets the ac_cv_libresolv_dns_ttl_hack shell variable and defines LIBRESOLV_DNS_TTL_HACK | |
589 | ||
590 | AC_DEFUN([SQUID_CHECK_LIBRESOLV_DNS_TTL_HACK],[ | |
591 | AC_CACHE_CHECK(for libresolv _dns_ttl_ hack, ac_cv_libresolv_dns_ttl_hack, [ | |
592 | AC_LINK_IFELSE([AC_LANG_PROGRAM([[extern int _dns_ttl_;]], [[return _dns_ttl_;]])], | |
593 | [ac_cv_libresolv_dns_ttl_hack=yes],[ac_cv_libresolv_dns_ttl_hack=no]) ]) | |
594 | SQUID_DEFINE_BOOL(LIBRESOLV_DNS_TTL_HACK,$ac_cv_libresolv_dns_ttl_hack, | |
595 | [libresolv.a has been hacked to export _dns_ttl_]) | |
596 | ]) | |
597 | ||
598 | ||
599 | dnl checks for availability of some resolver fields | |
600 | dnl sets ac_cv_have_res_ext_nsaddr_list shell variable | |
601 | dnl defines _SQUID_RES_NSADDR6_COUNT _SQUID_RES_NSADDR6_LARRAY | |
602 | dnl defines _SQUID_RES_NSADDR6_LPTR _SQUID_RES_NSADDR6_COUNT | |
603 | dnl defines _SQUID_RES_NSADDR_LIST _SQUID_RES_NSADDR_COUNT | |
604 | ||
605 | AC_DEFUN([SQUID_CHECK_RESOLVER_FIELDS],[ | |
606 | AC_CACHE_CHECK(for _res_ext.nsaddr_list, ac_cv_have_res_ext_nsaddr_list, | |
607 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
608 | #if HAVE_SYS_TYPES_H | |
609 | #include <sys/types.h> | |
610 | #endif | |
611 | #if HAVE_NETINET_IN_H | |
612 | #include <netinet/in.h> | |
613 | #endif | |
614 | #if HAVE_ARPA_INET_H | |
615 | #include <arpa/inet.h> | |
616 | #endif | |
617 | #if HAVE_ARPA_NAMESER_H | |
618 | #include <arpa/nameser.h> | |
619 | #endif | |
620 | #if HAVE_RESOLV_H | |
621 | #include <resolv.h> | |
622 | #endif | |
623 | ]], | |
624 | [[_res_ext.nsaddr_list[[0]].s_addr;]])],[ | |
625 | ac_cv_have_res_ext_nsaddr_list="yes" ],[ | |
626 | ac_cv_have_res_ext_nsaddr_list="no"])) | |
627 | if test "$ac_cv_have_res_ext_nsaddr_list" = "yes" ; then | |
628 | AC_DEFINE(_SQUID_RES_NSADDR6_LARRAY,_res_ext.nsaddr_list,[If _res_ext structure has nsaddr_list member]) | |
629 | AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,ns6count,[Nameserver Counter for IPv6 _res_ext]) | |
630 | fi | |
631 | ||
632 | if test "$_SQUID_RES_NSADDR6_LIST" = ""; then | |
633 | AC_CACHE_CHECK(for _res._u._ext.nsaddrs, ac_cv_have_res_ext_nsaddrs, | |
634 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
635 | #if HAVE_SYS_TYPES_H | |
636 | #include <sys/types.h> | |
637 | #endif | |
638 | #if HAVE_NETINET_IN_H | |
639 | #include <netinet/in.h> | |
640 | #endif | |
641 | #if HAVE_ARPA_INET_H | |
642 | #include <arpa/inet.h> | |
643 | #endif | |
644 | #if HAVE_ARPA_NAMESER_H | |
645 | #include <arpa/nameser.h> | |
646 | #endif | |
647 | #if HAVE_RESOLV_H | |
648 | #include <resolv.h> | |
649 | #endif | |
650 | ]], i | |
651 | [[_res._u._ext.nsaddrs[[0]]->sin6_addr;]])], | |
652 | [ac_cv_have_res_ext_nsaddrs="yes"],[ac_cv_have_res_ext_nsaddrs="no"])) | |
653 | if test "$ac_cv_have_res_ext_nsaddrs" = "yes" ; then | |
654 | AC_DEFINE(_SQUID_RES_NSADDR6_LPTR,_res._u._ext.nsaddrs,[If _res structure has _ext.nsaddrs member]) | |
655 | AC_DEFINE(_SQUID_RES_NSADDR6_COUNT,_res._u._ext.nscount6,[Nameserver Counter for IPv6 _res]) | |
656 | fi | |
657 | fi | |
658 | ||
659 | AC_CACHE_CHECK(for _res.nsaddr_list, ac_cv_have_res_nsaddr_list, | |
660 | AC_COMPILE_IFELSE([ | |
661 | AC_LANG_PROGRAM([[ | |
662 | #if HAVE_SYS_TYPES_H | |
663 | #include <sys/types.h> | |
664 | #endif | |
665 | #if HAVE_NETINET_IN_H | |
666 | #include <netinet/in.h> | |
667 | #endif | |
668 | #if HAVE_ARPA_INET_H | |
669 | #include <arpa/inet.h> | |
670 | #endif | |
671 | #if HAVE_ARPA_NAMESER_H | |
672 | #include <arpa/nameser.h> | |
673 | #endif | |
674 | #if HAVE_RESOLV_H | |
675 | #include <resolv.h> | |
676 | #endif | |
677 | ]], [[_res.nsaddr_list[[0]];]])], | |
678 | [ac_cv_have_res_nsaddr_list="yes"],[ac_cv_have_res_nsaddr_list="no"])) | |
679 | if test $ac_cv_have_res_nsaddr_list = "yes" ; then | |
680 | AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.nsaddr_list,[If _res structure has nsaddr_list member]) | |
681 | AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res]) | |
682 | fi | |
683 | ||
684 | if test "$_SQUID_RES_NSADDR_LIST" = ""; then | |
685 | AC_CACHE_CHECK(for _res.ns_list, ac_cv_have_res_ns_list, | |
686 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
687 | #if HAVE_SYS_TYPES_H | |
688 | #include <sys/types.h> | |
689 | #endif | |
690 | #if HAVE_NETINET_IN_H | |
691 | #include <netinet/in.h> | |
692 | #endif | |
693 | #if HAVE_ARPA_INET_H | |
694 | #include <arpa/inet.h> | |
695 | #endif | |
696 | #if HAVE_ARPA_NAMESER_H | |
697 | #include <arpa/nameser.h> | |
698 | #endif | |
699 | #if HAVE_RESOLV_H | |
700 | #include <resolv.h> | |
701 | #endif | |
702 | ]], | |
703 | [[_res.ns_list[[0]].addr;]])], | |
704 | [ac_cv_have_res_ns_list="yes"],[ac_cv_have_res_ns_list="no"])) | |
705 | if test $ac_cv_have_res_ns_list = "yes" ; then | |
706 | AC_DEFINE(_SQUID_RES_NSADDR_LIST,_res.ns_list,[If _res structure has ns_list member]) | |
707 | AC_DEFINE(_SQUID_RES_NSADDR_COUNT,_res.nscount,[Nameserver counter for IPv4 _res]) | |
708 | fi | |
709 | fi | |
710 | ]) | |
711 | ||
712 | ||
0c0d381b FC |
713 | dnl checks the winsock library to use (ws2_32 or wsock32) |
714 | dnl may set ac_cv_func_select as a side effect | |
715 | AC_DEFUN([SQUID_CHECK_WINSOCK_LIB],[ | |
391f0bac | 716 | AC_CHECK_HEADERS(winsock2.h winsock.h) |
0c0d381b | 717 | SQUID_STATE_SAVE(winsock) |
391f0bac FC |
718 | SQUID_SEARCH_LIBS([squid_getprotobynumber],[ws2_32 wsock32],,,,[ |
719 | #if HAVE_WINSOCK2_H | |
720 | #include <winsock2.h> | |
721 | #elif HAVE_WINSOCK_H | |
722 | #include <winsock.h> | |
723 | #endif | |
724 | /* ugly hack. */ | |
725 | void squid_getprotobynumber(void) { | |
726 | getprotobynumber(1); | |
727 | } | |
728 | ]) | |
0c0d381b | 729 | AC_MSG_CHECKING([for winsock library]) |
391f0bac | 730 | case "$ac_cv_search_squid_getprotobynumber" in |
0c0d381b FC |
731 | "no") |
732 | AC_MSG_RESULT([winsock library not found]) | |
733 | ;; | |
734 | "none required") | |
735 | AC_MSG_RESULT([winsock library already in LIBS]) | |
736 | ;; | |
737 | "-lws2_32") | |
738 | AC_MSG_RESULT([winsock2]) | |
391f0bac | 739 | XTRA_LIBS="-lws2_32 $XTRA_LIBS" |
0c0d381b FC |
740 | ac_cv_func_select='yes' |
741 | ;; | |
742 | "-lwsock32") | |
743 | AC_MSG_RESULT([winsock]) | |
391f0bac | 744 | XTRA_LIBS="-lwsock32 $XTRA_LIBS" |
0c0d381b FC |
745 | ac_cv_func_select='yes' |
746 | ;; | |
747 | esac | |
0c0d381b FC |
748 | SQUID_STATE_ROLLBACK(winsock) |
749 | ]) | |
91983da0 | 750 | |
91983da0 FC |
751 | dnl check that setresuid is properly implemented. |
752 | dnl sets squid_cv_resuid_works to "yes" or "no" | |
753 | AC_DEFUN([SQUID_CHECK_SETRESUID_WORKS],[ | |
754 | AC_CACHE_CHECK(if setresuid is actually implemented, squid_cv_resuid_works, | |
755 | AC_RUN_IFELSE([ | |
756 | AC_LANG_SOURCE([[ | |
ad17d4bd | 757 | #if HAVE_STDLIB_H |
91983da0 | 758 | #include <stdlib.h> |
ad17d4bd OC |
759 | #endif |
760 | #if HAVE_STDIO_H | |
761 | #include <stdio.h> | |
762 | #endif | |
763 | #if HAVE_UNISTD_H | |
764 | #include <unistd.h> | |
765 | #endif | |
91983da0 FC |
766 | int main(int argc, char **argv) { |
767 | if(setresuid(-1,-1,-1)) { | |
768 | perror("setresuid:"); | |
769 | return 1; | |
770 | } | |
771 | return 0; | |
772 | } | |
773 | ]])],[ | |
774 | squid_cv_resuid_works="yes" ],[ | |
aff0e8fe | 775 | squid_cv_resuid_works="no" ],[:]) |
91983da0 FC |
776 | ) |
777 | ]) | |
5e44eea8 AJ |
778 | |
779 | dnl check that we have functional CPU clock access for the profiler | |
780 | dnl sets squid_cv_profiler_works to "yes" or "no" | |
781 | ||
782 | AC_DEFUN([SQUID_CHECK_FUNCTIONAL_CPU_PROFILER],[ | |
783 | AC_CACHE_CHECK([for operational CPU clock access], | |
784 | squid_cv_cpu_profiler_works, | |
785 | AC_PREPROC_IFELSE([AC_LANG_SOURCE([[ | |
786 | #if defined(__GNUC__) && ( defined(__i386) || defined(__i386__) ) | |
787 | // okay | |
788 | #elif defined(__GNUC__) && ( defined(__x86_64) || defined(__x86_64__) ) | |
789 | // okay | |
790 | #elif defined(__GNUC__) && defined(__alpha) | |
791 | // okay | |
792 | #elif defined(_M_IX86) && defined(_MSC_VER) /* x86 platform on Microsoft C Compiler ONLY */ | |
793 | // okay | |
794 | #else | |
795 | #error This CPU is unsupported. No profiling available here. | |
796 | #endif | |
797 | ]])],[ | |
798 | squid_cv_cpu_profiler_works=yes],[ | |
799 | squid_cv_cpu_profiler_works=no]) | |
800 | ) | |
801 | ]) | |
391f0bac FC |
802 | |
803 | dnl check whether recv takes a char* or void* as a second argument | |
804 | AC_DEFUN([SQUID_CHECK_RECV_ARG_TYPE],[ | |
805 | AC_CACHE_CHECK([whether recv takes a pointer to void or char as second argument], | |
806 | squid_cv_recv_second_arg_type, [ | |
807 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
808 | #include <sys/types.h> | |
809 | #if HAVE_SYS_SOCKET_H | |
810 | #include <sys/socket.h> | |
811 | #endif | |
812 | #if HAVE_WINSOCK2_H | |
813 | #include <winsock2.h> | |
15d36271 | 814 | #elif HAVE_WINSOCK_H |
391f0bac FC |
815 | #include <winsock.h> |
816 | #endif | |
817 | int main (int argc, char ** argv) { | |
818 | void *buf; | |
819 | recv(0,buf,0,0); | |
820 | } | |
821 | ]])],[squid_cv_recv_second_arg_type=void], | |
822 | [squid_cv_recv_second_arg_type=char]) | |
823 | AC_MSG_RESULT($squid_cv_recv_second_arg_type*) | |
824 | ]) | |
825 | AC_DEFINE_UNQUOTED(RECV_ARG_TYPE,$squid_cv_recv_second_arg_type, | |
826 | [Base type of the second argument to recv(2)]) | |
827 | ]) | |
d25bbe26 AJ |
828 | |
829 | ||
830 | dnl check whether Solaris has broken IPFilter headers (Solaris 10 at least does) | |
831 | AC_DEFUN([SQUID_CHECK_BROKEN_SOLARIS_IPFILTER],[ | |
832 | if test "x$squid_cv_broken_ipfilter_minor_t" = "x"; then | |
833 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
834 | # include <sys/types.h> | |
4218a48c | 835 | # include <sys/time.h> |
d25bbe26 AJ |
836 | # include <sys/ioccom.h> |
837 | # include <netinet/in.h> | |
838 | ||
839 | # include <netinet/ip_compat.h> | |
840 | # include <netinet/ip_fil.h> | |
841 | # include <netinet/ip_nat.h> | |
842 | ]])],[ | |
843 | AC_MSG_RESULT(no) | |
844 | squid_cv_broken_ipfilter_minor_t=0 | |
845 | ],[ | |
846 | ## on fail, test the hack | |
847 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |
848 | #define minor_t fubaar | |
849 | # include <sys/types.h> | |
4218a48c | 850 | # include <sys/time.h> |
d25bbe26 AJ |
851 | # include <sys/ioccom.h> |
852 | # include <netinet/in.h> | |
853 | #undef minor_t | |
854 | # include <netinet/ip_compat.h> | |
855 | # include <netinet/ip_fil.h> | |
856 | # include <netinet/ip_nat.h> | |
857 | ]])],[ | |
858 | AC_MSG_RESULT(yes) | |
859 | squid_cv_broken_ipfilter_minor_t=1 | |
860 | ],[ | |
4218a48c | 861 | AC_MSG_ERROR(unable to make IPFilter work with netinet/ headers) |
d25bbe26 AJ |
862 | ]) |
863 | ]) | |
864 | fi | |
865 | ||
866 | AC_DEFINE_UNQUOTED(USE_SOLARIS_IPFILTER_MINOR_T_HACK,$squid_cv_broken_ipfilter_minor_t, | |
867 | [Workaround IPFilter minor_t breakage]) | |
868 | ||
869 | ## check for IPFilter headers that require this hack | |
870 | ## (but first netinet/in.h and sys/ioccom.h which they depend on) | |
871 | AC_CHECK_HEADERS( \ | |
872 | netinet/in.h \ | |
873 | sys/ioccom.h \ | |
874 | ip_compat.h \ | |
875 | ip_fil_compat.h \ | |
876 | ip_fil.h \ | |
877 | ip_nat.h \ | |
878 | netinet/ip_compat.h \ | |
879 | netinet/ip_fil_compat.h \ | |
880 | netinet/ip_fil.h \ | |
881 | netinet/ip_nat.h \ | |
882 | ,,,[ | |
883 | #if USE_SOLARIS_IPFILTER_MINOR_T_HACK | |
884 | #define minor_t fubar | |
885 | #endif | |
886 | #if HAVE_SYS_TYPES_H | |
887 | #include <sys/types.h> | |
888 | #endif | |
4218a48c PW |
889 | #if HAVE_SYS_TIME_H |
890 | #include <sys/time.h> | |
891 | #endif | |
d25bbe26 AJ |
892 | #if HAVE_NETINET_IN_H |
893 | #include <netinet/in.h> | |
894 | #endif | |
895 | #if HAVE_SYS_IOCCOM_H | |
896 | #include <sys/ioccom.h> | |
897 | #endif | |
898 | #if USE_SOLARIS_IPFILTER_MINOR_T_HACK | |
899 | #undef minor_t | |
900 | #endif | |
901 | #if HAVE_IP_COMPAT_H | |
902 | #include <ip_compat.h> | |
903 | #elif HAVE_NETINET_IP_COMPAT_H | |
904 | #include <netinet/ip_compat.h> | |
905 | #endif | |
906 | #if HAVE_IP_FIL_H | |
907 | #include <ip_fil.h> | |
908 | #elif HAVE_NETINET_IP_FIL_H | |
909 | #include <netinet/ip_fil.h> | |
910 | #endif | |
911 | #if !defined(IPFILTER_VERSION) | |
912 | #define IPFILTER_VERSION 5000004 | |
913 | #endif | |
914 | ]) | |
4eaf432d AJ |
915 | |
916 | ## Solaris 10+ backported IPv6 NAT to their IPFilter v4.1 instead of using v5 | |
917 | AC_CHECK_MEMBERS([ | |
918 | struct natlookup.nl_inipaddr.in6, | |
919 | struct natlookup.nl_realipaddr.in6 | |
920 | ],,,[ | |
921 | #if USE_SOLARIS_IPFILTER_MINOR_T_HACK | |
922 | #define minor_t fubar | |
923 | #endif | |
924 | #if HAVE_SYS_TYPES_H | |
925 | #include <sys/types.h> | |
926 | #endif | |
927 | #if HAVE_SYS_TIME_H | |
928 | #include <sys/time.h> | |
929 | #endif | |
930 | #if HAVE_NETINET_IN_H | |
931 | #include <netinet/in.h> | |
932 | #endif | |
933 | #if HAVE_SYS_IOCCOM_H | |
934 | #include <sys/ioccom.h> | |
935 | #endif | |
936 | #if USE_SOLARIS_IPFILTER_MINOR_T_HACK | |
937 | #undef minor_t | |
938 | #endif | |
939 | #if HAVE_IP_COMPAT_H | |
940 | #include <ip_compat.h> | |
941 | #elif HAVE_NETINET_IP_COMPAT_H | |
942 | #include <netinet/ip_compat.h> | |
943 | #endif | |
944 | #if HAVE_IP_FIL_H | |
945 | #include <ip_fil.h> | |
946 | #elif HAVE_NETINET_IP_FIL_H | |
947 | #include <netinet/ip_fil.h> | |
948 | #endif | |
949 | #include <ip_nat.h> | |
950 | ]) | |
951 | ||
d25bbe26 | 952 | ]) |