]> git.ipfire.org Git - thirdparty/squid.git/blob - include/config.h
Summary: Synced with libecap, adopted pass-all-changes-through transactions
[thirdparty/squid.git] / include / config.h
1 /*
2 * $Id: config.h,v 1.27 2008/01/07 15:47:08 hno Exp $
3 *
4 * AUTHOR: Duane Wessels
5 *
6 * SQUID Web Proxy Cache http://www.squid-cache.org/
7 * ----------------------------------------------------------
8 *
9 * Squid is the result of efforts by numerous individuals from
10 * the Internet community; see the CONTRIBUTORS file for full
11 * details. Many organizations have provided support for Squid's
12 * development; see the SPONSORS file for full details. Squid is
13 * Copyrighted (C) 2001 by the Regents of the University of
14 * California; see the COPYRIGHT file for full details. Squid
15 * incorporates software developed and/or copyrighted by other
16 * sources; see the CREDITS file for full details.
17 *
18 * This program is free software; you can redistribute it and/or modify
19 * it under the terms of the GNU General Public License as published by
20 * the Free Software Foundation; either version 2 of the License, or
21 * (at your option) any later version.
22 *
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 *
28 * You should have received a copy of the GNU General Public License
29 * along with this program; if not, write to the Free Software
30 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
31 *
32 */
33
34 #ifndef SQUID_CONFIG_H
35 #define SQUID_CONFIG_H
36
37 #include "autoconf.h" /* For GNU autoconf variables */
38 #include "version.h"
39
40 /* To keep API definitions clear */
41 #ifdef __cplusplus
42 #define SQUIDCEXTERN extern "C"
43 #else
44 #define SQUIDCEXTERN extern
45 #endif
46
47 /****************************************************************************
48 *--------------------------------------------------------------------------*
49 * DO *NOT* MAKE ANY CHANGES below here unless you know what you're doing...*
50 *--------------------------------------------------------------------------*
51 ****************************************************************************/
52
53 #ifdef USE_POSIX_REGEX
54 #ifndef USE_RE_SYNTAX
55 #define USE_RE_SYNTAX REG_EXTENDED /* default Syntax */
56 #endif
57 #endif
58
59 /* define the _SQUID_TYPE_ based on a guess of the OS */
60 #if defined(__sun__) || defined(__sun) /* SUN */
61 #define _SQUID_SUN_
62 #if defined(__SVR4) /* SOLARIS */
63 #define _SQUID_SOLARIS_
64 #else /* SUNOS */
65 #define _SQUID_SUNOS_
66 #endif
67
68 #elif defined(__hpux) /* HP-UX - SysV-like? */
69 #define _SQUID_HPUX_
70 #define _SQUID_SYSV_
71
72 #elif defined(__osf__) /* OSF/1 */
73 #define _SQUID_OSF_
74
75 #elif defined(__ultrix) /* Ultrix */
76 #define _SQUID_ULTRIX_
77
78 #elif defined(_AIX) /* AIX */
79 #define _SQUID_AIX_
80
81 #elif defined(__linux__) /* Linux */
82 #define _SQUID_LINUX_
83 #if USE_ASYNC_IO
84 #define _SQUID_LINUX_THREADS_
85 #endif
86
87 #elif defined(__FreeBSD__) /* FreeBSD */
88 #define _SQUID_FREEBSD_
89 #if USE_ASYNC_IO && defined(LINUXTHREADS)
90 #define _SQUID_LINUX_THREADS_
91 #endif
92
93 #elif defined(__sgi__) || defined(sgi) || defined(__sgi) /* SGI */
94 #define _SQUID_SGI_
95 #if !defined(_SVR4_SOURCE)
96 #define _SVR4_SOURCE /* for tempnam(3) */
97 #endif
98 #if USE_ASYNC_IO
99 #define _ABI_SOURCE
100 #endif /* USE_ASYNC_IO */
101
102 #elif defined(__NeXT__)
103 #define _SQUID_NEXT_
104
105 #elif defined(__bsdi__)
106 #define _SQUID_BSDI_ /* BSD/OS */
107
108 #elif defined(__NetBSD__)
109 #define _SQUID_NETBSD_
110
111 #elif defined(__OpenBSD__)
112 #define _SQUID_OPENBSD_
113
114 #elif defined(__CYGWIN32__) || defined(__CYGWIN__)
115 #define _SQUID_CYGWIN_
116 #define _SQUID_WIN32_
117
118 #elif defined(WIN32) || defined(WINNT) || defined(__WIN32__) || defined(__WIN32)
119 #define _SQUID_MSWIN_
120 #define _SQUID_WIN32_
121 #include "squid_mswin.h"
122
123 #elif defined(__APPLE__)
124 #define _SQUID_APPLE_
125
126 #elif defined(sony_news) && defined(__svr4)
127 #define _SQUID_NEWSOS6_
128
129 #elif defined(__EMX__) || defined(OS2) || defined(__OS2__)
130 #define _SQUID_OS2_
131 /*
132 * FIXME: the os2 port of bash seems to have problems checking
133 * the return codes of programs in if statements. These options
134 * need to be overridden.
135 */
136 #endif
137
138 /* FD_SETSIZE must be redefined before including sys/types.h */
139
140 /*
141 * On some systems, FD_SETSIZE is set to something lower than the
142 * actual number of files which can be opened. IRIX is one case,
143 * NetBSD is another. So here we increase FD_SETSIZE to our
144 * configure-discovered maximum *before* any system includes.
145 */
146 #define CHANGE_FD_SETSIZE 1
147
148 /*
149 * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE
150 * with glibc 2.2 (or later? remains to be seen). We do this by including
151 * bits/types.h which defines __FD_SETSIZE first, then we redefine
152 * __FD_SETSIZE. Ofcourse a user program may NEVER include bits/whatever.h
153 * directly, so this is a dirty hack!
154 */
155 #if defined(_SQUID_LINUX_)
156 #undef CHANGE_FD_SETSIZE
157 #define CHANGE_FD_SETSIZE 0
158 #include <features.h>
159 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
160 #if SQUID_MAXFD > DEFAULT_FD_SETSIZE
161 #include <bits/types.h>
162 #undef __FD_SETSIZE
163 #define __FD_SETSIZE SQUID_MAXFD
164 #endif
165 #endif
166 #endif
167
168 /*
169 * Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2)
170 * to return EINVAL.
171 * --Marian Durkovic <marian@svf.stuba.sk>
172 * --Peter Wemm <peter@spinner.DIALix.COM>
173 */
174 #if defined(_SQUID_FREEBSD_)
175 #include <osreldate.h>
176 #if __FreeBSD_version < 220000
177 #undef CHANGE_FD_SETSIZE
178 #define CHANGE_FD_SETSIZE 0
179 #endif
180 #endif
181
182 /*
183 * Trying to redefine CHANGE_FD_SETSIZE causes a slew of warnings
184 * on Mac OS X Server.
185 */
186 #if defined(_SQUID_APPLE_)
187 #undef CHANGE_FD_SETSIZE
188 #define CHANGE_FD_SETSIZE 0
189 #endif
190
191 /* Increase FD_SETSIZE if SQUID_MAXFD is bigger */
192 #if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
193 #define FD_SETSIZE SQUID_MAXFD
194 #endif
195
196 /* Typedefs for missing entries on a system */
197
198 #include "squid_types.h"
199
200 /* int8_t */
201 #ifndef HAVE_INT8_T
202 #if HAVE_CHAR && SIZEOF_CHAR == 1
203 typedef char int8_t;
204 #else
205 #error NO 8 bit signed type available
206 #endif
207 #endif
208
209 /* u_int8_t */
210 #ifndef HAVE_U_INT8_T
211 #if HAVE_UINT8_T
212 typedef uint8_t u_int8_t;
213 #else
214 typedef unsigned char u_int8_t;
215 #endif
216 #endif
217
218 /* int16_t */
219 #ifndef HAVE_INT16_T
220 #if HAVE_SHORT && SIZEOF_SHORT == 2
221 typedef short int16_t;
222 #elif HAVE_INT && SIZEOF_INT == 2
223 typedef int int16_t;
224 #else
225 #error NO 16 bit signed type available
226 #endif
227 #endif
228
229 /* u_int16_t */
230 #ifndef HAVE_U_INT16_T
231 #if HAVE_UINT16_T
232 typedef uint16_t u_int16_t;
233 #else
234 typedef unsigned int16_t u_int16_t;
235 #endif
236 #endif
237
238 /* int32_t */
239 #ifndef HAVE_INT32_T
240 #if HAVE_INT && SIZEOF_INT == 4
241 typedef int int32_t;
242 #elif HAVE_LONG && SIZEOF_LONG == 4
243 typedef long int32_t;
244 #else
245 #error NO 32 bit signed type available
246 #endif
247 #endif
248
249 /* u_int32_t */
250 #ifndef HAVE_U_INT32_T
251 #if HAVE_UINT32_T
252 typedef uint32_t u_int32_t;
253 #else
254 typedef unsigned int32_t u_int32_t;
255 #endif
256 #endif
257
258 /* int64_t */
259 #ifndef HAVE_INT64_T
260 #if HAVE___INT64
261 typedef __int64 int64_t;
262 #elif HAVE_LONG && SIZEOF_LONG == 8
263 typedef long int64_t;
264 #elif HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8
265 typedef long long int64_t;
266 #else
267 #error NO 64 bit signed type available
268 #endif
269 #endif
270
271 /* u_int64_t */
272 #ifndef HAVE_U_INT64_T
273 #if HAVE_UINT64_T
274 typedef uint64_t u_int64_t;
275 #else
276 typedef unsigned int64_t u_int64_t;
277 #endif
278 #endif
279
280
281 #ifndef HAVE_PID_T
282 typedef int pid_t;
283 #endif
284
285 #ifndef HAVE_SIZE_T
286 typedef unsigned int size_t;
287 #endif
288
289 #ifndef HAVE_SSIZE_T
290 typedef int ssize_t;
291 #endif
292
293 #ifndef HAVE_OFF_T
294 typedef int off_t;
295 #endif
296
297 #ifndef HAVE_MODE_T
298 typedef unsigned short mode_t;
299 #endif
300
301 #ifndef HAVE_FD_MASK
302 typedef unsigned long fd_mask;
303 #endif
304
305 #ifndef HAVE_SOCKLEN_T
306 typedef int socklen_t;
307 #endif
308
309 #ifndef HAVE_MTYP_T
310 typedef long mtyp_t;
311 #endif
312
313 /*
314 * On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
315 * that is incompatible with the updated Solaris header files.
316 */
317 #if defined(_SQUID_SOLARIS_) && (defined(i386) || defined(__i386))
318 #ifndef HAVE_PAD128_T
319 typedef union {
320 long double _q;
321 int32_t _l[4];
322 } pad128_t;
323 #endif
324 #ifndef HAVE_UPAD128_T
325 typedef union {
326 long double _q;
327 uint32_t _l[4];
328 } upad128_t;
329 #endif
330 #endif
331
332 /*
333 * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD
334 */
335 #if defined(HAVE_MALLOC_H) && (defined(_SQUID_FREEBSD_) || defined(_SQUID_NEXT_) || defined(_SQUID_OPENBSD_))
336 #undef HAVE_MALLOC_H
337 #endif
338
339 /*
340 * res_init() is just a macro re-definition of __res_init on Linux (Debian/Ubuntu)
341 */
342 #if !defined(HAVE_RES_INIT) && defined(HAVE___RES_INIT) && !defined(res_init)
343 #define res_init __res_init
344 #define HAVE_RES_INIT HAVE___RES_INIT
345 #endif
346
347 #if !defined(CACHEMGR_HOSTNAME)
348 #define CACHEMGR_HOSTNAME ""
349 #else
350 #define CACHEMGR_HOSTNAME_DEFINED 1
351 #endif
352
353 #if SQUID_DETECT_UDP_SO_SNDBUF > 16384
354 #define SQUID_UDP_SO_SNDBUF 16384
355 #else
356 #define SQUID_UDP_SO_SNDBUF SQUID_DETECT_UDP_SO_SNDBUF
357 #endif
358
359 #if SQUID_DETECT_UDP_SO_RCVBUF > 16384
360 #define SQUID_UDP_SO_RCVBUF 16384
361 #else
362 #define SQUID_UDP_SO_RCVBUF SQUID_DETECT_UDP_SO_RCVBUF
363 #endif
364
365 #ifdef HAVE_MEMCPY
366 #define xmemcpy(d,s,n) memcpy((d),(s),(n))
367 #elif HAVE_BCOPY
368 #define xmemcpy(d,s,n) bcopy((s),(d),(n))
369 #elif HAVE_MEMMOVE
370 #define xmemcpy(d,s,n) memmove((d),(s),(n))
371 #endif
372
373 #ifdef HAVE_MEMMOVE
374 #define xmemmove(d,s,n) memmove((d),(s),(n))
375 #elif HAVE_BCOPY
376 #define xmemmove(d,s,n) bcopy((s),(d),(n))
377 #endif
378
379 #define xisspace(x) isspace((unsigned char)x)
380 #define xtoupper(x) toupper((unsigned char)x)
381 #define xtolower(x) tolower((unsigned char)x)
382 #define xisdigit(x) isdigit((unsigned char)x)
383 #define xisascii(x) isascii((unsigned char)x)
384 #define xislower(x) islower((unsigned char)x)
385 #define xisalpha(x) isalpha((unsigned char)x)
386 #define xisprint(x) isprint((unsigned char)x)
387 #define xisalnum(x) isalnum((unsigned char)x)
388 #define xiscntrl(x) iscntrl((unsigned char)x)
389 #define xispunct(x) ispunct((unsigned char)x)
390 #define xisupper(x) isupper((unsigned char)x)
391 #define xisxdigit(x) isxdigit((unsigned char)x)
392 #define xisgraph(x) isgraph((unsigned char)x)
393
394 #if HAVE_RANDOM
395 #define squid_random random
396 #define squid_srandom srandom
397 #elif HAVE_LRAND48
398 #define squid_random lrand48
399 #define squid_srandom srand48
400 #else
401 #define squid_random rand
402 #define squid_srandom srand
403 #endif
404
405 /* gcc doesn't recognize the Windows native 64 bit formatting tags causing
406 * the compile fail, so we must disable the check on native Windows.
407 */
408
409 #if __GNUC__ && !defined(_SQUID_MSWIN_)
410 #define PRINTF_FORMAT_ARG1 __attribute__ ((format (printf, 1, 2)))
411 #define PRINTF_FORMAT_ARG2 __attribute__ ((format (printf, 2, 3)))
412 #define PRINTF_FORMAT_ARG3 __attribute__ ((format (printf, 3, 4)))
413 #else
414 #define PRINTF_FORMAT_ARG1
415 #define PRINTF_FORMAT_ARG2
416 #define PRINTF_FORMAT_ARG3
417 #endif
418
419 /*
420 * Determine if this is a leak check build or standard
421 */
422 #if PURIFY
423 #define LEAK_CHECK_MODE 1
424 #elif WITH_VALGRIND
425 #define LEAK_CHECK_MODE 1
426 #elif XMALLOC_TRACE
427 #define LEAK_CHECK_MODE 1
428 #endif
429
430 /*
431 * valgrind debug support
432 */
433 #if WITH_VALGRIND
434 #include <valgrind/memcheck.h>
435 #undef VALGRIND_MAKE_NOACCESS
436 #undef VALGRIND_MAKE_WRITABLE
437 #undef VALGRIND_MAKE_READABLE
438 /* A little glue for older valgrind version prior to 3.2.0 */
439 #ifndef VALGRIND_MAKE_MEM_NOACCESS
440 #define VALGRIND_MAKE_MEM_NOACCESS VALGRIND_MAKE_NOACCESS
441 #define VALGRIND_MAKE_MEM_UNDEFINED VALGRIND_MAKE_WRITABLE
442 #define VALGRIND_MAKE_MEM_DEFINED VALGRIND_MAKE_READABLE
443 #define VALGRIND_CHECK_MEM_IS_ADDRESSABLE VALGRIND_CHECK_WRITABLE
444 #endif
445 #else
446 #define VALGRIND_MAKE_MEM_NOACCESS(a,b) (0)
447 #define VALGRIND_MAKE_MEM_UNDEFINED(a,b) (0)
448 #define VALGRIND_MAKE_MEM_DEFINED(a,b) (0)
449 #define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,b) (0)
450 #define VALGRIND_CHECK_MEM_IS_DEFINED(a,b) (0)
451 #define VALGRIND_MALLOCLIKE_BLOCK(a,b,c,d)
452 #define VALGRIND_FREELIKE_BLOCK(a,b)
453 #define RUNNING_ON_VALGRIND 0
454 #endif /* WITH_VALGRIND */
455
456
457 /*
458 * strnstr() is needed. The OS may not provide a working copy.
459 */
460 #include "strnstr.h"
461
462 #endif /* SQUID_CONFIG_H */