]> git.ipfire.org Git - thirdparty/squid.git/blob - include/config.h
gcc 3.4.2 fixes from Henrik
[thirdparty/squid.git] / include / config.h
1 /*
2 * $Id: config.h,v 1.15 2004/12/21 17:28:27 robertc 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
122 #elif defined(__APPLE__)
123 #define _SQUID_APPLE_
124
125 #elif defined(sony_news) && defined(__svr4)
126 #define _SQUID_NEWSOS6_
127
128 #elif defined(__EMX__) || defined(OS2) || defined(__OS2__)
129 #define _SQUID_OS2_
130 /*
131 * FIXME: the os2 port of bash seems to have problems checking
132 * the return codes of programs in if statements. These options
133 * need to be overridden.
134 */
135 #endif
136
137 /* FD_SETSIZE must be redefined before including sys/types.h */
138
139 /*
140 * On some systems, FD_SETSIZE is set to something lower than the
141 * actual number of files which can be opened. IRIX is one case,
142 * NetBSD is another. So here we increase FD_SETSIZE to our
143 * configure-discovered maximum *before* any system includes.
144 */
145 #define CHANGE_FD_SETSIZE 1
146
147 /*
148 * Cannot increase FD_SETSIZE on Linux, but we can increase __FD_SETSIZE
149 * with glibc 2.2 (or later? remains to be seen). We do this by including
150 * bits/types.h which defines __FD_SETSIZE first, then we redefine
151 * __FD_SETSIZE. Ofcourse a user program may NEVER include bits/whatever.h
152 * directly, so this is a dirty hack!
153 */
154 #if defined(_SQUID_LINUX_)
155 #undef CHANGE_FD_SETSIZE
156 #define CHANGE_FD_SETSIZE 0
157 #include <features.h>
158 #if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
159 #if SQUID_MAXFD > DEFAULT_FD_SETSIZE
160 #include <bits/types.h>
161 #undef __FD_SETSIZE
162 #define __FD_SETSIZE SQUID_MAXFD
163 #endif
164 #endif
165 #endif
166
167 /*
168 * Cannot increase FD_SETSIZE on FreeBSD before 2.2.0, causes select(2)
169 * to return EINVAL.
170 * --Marian Durkovic <marian@svf.stuba.sk>
171 * --Peter Wemm <peter@spinner.DIALix.COM>
172 */
173 #if defined(_SQUID_FREEBSD_)
174 #include <osreldate.h>
175 #if __FreeBSD_version < 220000
176 #undef CHANGE_FD_SETSIZE
177 #define CHANGE_FD_SETSIZE 0
178 #endif
179 #endif
180
181 /*
182 * Trying to redefine CHANGE_FD_SETSIZE causes a slew of warnings
183 * on Mac OS X Server.
184 */
185 #if defined(_SQUID_APPLE_)
186 #undef CHANGE_FD_SETSIZE
187 #define CHANGE_FD_SETSIZE 0
188 #endif
189
190 /* Increase FD_SETSIZE if SQUID_MAXFD is bigger */
191 #if CHANGE_FD_SETSIZE && SQUID_MAXFD > DEFAULT_FD_SETSIZE
192 #define FD_SETSIZE SQUID_MAXFD
193 #endif
194
195
196
197 /* Typedefs for missing entries on a system */
198
199 #include "squid_types.h"
200
201 /* int16_t */
202 #ifndef HAVE_INT16_T
203 #if HAVE_SHORT && SIZEOF_SHORT == 2
204 typedef short int16_t;
205 #elif HAVE_INT && SIZEOF_INT == 2
206 typedef int int16_t;
207 #else
208 #error NO 16 bit signed type available
209 #endif
210 #endif
211
212 /* u_int16_t */
213 #ifndef HAVE_U_INT16_T
214 #if HAVE_UINT16_T
215 typedef uint16_t u_int16_t;
216 #else
217 typedef unsigned int16_t u_int16_t;
218 #endif
219 #endif
220
221 /* int32_t */
222 #ifndef HAVE_INT32_T
223 #if HAVE_INT && SIZEOF_INT == 4
224 typedef int int32_t;
225 #elif HAVE_LONG && SIZEOF_LONG == 4
226 typedef long int32_t;
227 #else
228 #error NO 32 bit signed type available
229 #endif
230 #endif
231
232 /* u_int32_t */
233 #ifndef HAVE_U_INT32_T
234 #if HAVE_UINT32_T
235 typedef uint32_t u_int32_t;
236 #else
237 typedef unsigned int32_t u_int32_t;
238 #endif
239 #endif
240
241 /* int64_t */
242 #ifndef HAVE_INT64_T
243 #if HAVE___INT64
244 typedef __int64 int64_t;
245 #elif HAVE_LONG && SIZEOF_LONG == 8
246 typedef long int64_t;
247 #elif HAVE_LONG_LONG && SIZEOF_LONG_LONG == 8
248 typedef long long int64_t;
249 #else
250 #error NO 64 bit signed type available
251 #endif
252 #endif
253
254 /* u_int64_t */
255 #ifndef HAVE_U_INT64_T
256 #if HAVE_UINT64_T
257 typedef uint64_t u_int64_t;
258 #else
259 typedef unsigned int64_t u_int64_t;
260 #endif
261 #endif
262
263
264 #ifndef HAVE_PID_T
265 typedef int pid_t;
266 #endif
267
268 #ifndef HAVE_SIZE_T
269 typedef unsigned int size_t;
270 #endif
271
272 #ifndef HAVE_SSIZE_T
273 typedef int ssize_t;
274 #endif
275
276 #ifndef HAVE_OFF_T
277 typedef int off_t;
278 #endif
279
280 #ifndef HAVE_MODE_T
281 typedef unsigned short mode_t;
282 #endif
283
284 #ifndef HAVE_FD_MASK
285 typedef unsigned long fd_mask;
286 #endif
287
288 #ifndef HAVE_SOCKLEN_T
289 typedef int socklen_t;
290 #endif
291
292 #ifndef HAVE_MTYP_T
293 typedef long mtyp_t;
294 #endif
295
296 /*
297 * On Solaris 9 x86, gcc may includes a "fixed" set of old system include files
298 * that is incompatible with the updated Solaris header files.
299 */
300 #if defined(_SQUID_SOLARIS_) && (defined(i386) || defined(__i386))
301 #ifndef pad128_t
302 typedef union {
303 long double _q;
304 int32_t _l[4];
305 } pad128_t;
306 #endif
307 #ifndef upda128_t
308 typedef union {
309 long double _q;
310 uint32_t _l[4];
311 } upad128_t;
312 #endif
313 #endif
314
315 /*
316 * Don't allow inclusion of malloc.h on FreeBSD, Next and OpenBSD
317 */
318 #if defined(HAVE_MALLOC_H) && (defined(_SQUID_FREEBSD_) || defined(_SQUID_NEXT_) || defined(_SQUID_OPENBSD_))
319 #undef HAVE_MALLOC_H
320 #endif
321
322 #if !defined(CACHEMGR_HOSTNAME)
323 #define CACHEMGR_HOSTNAME ""
324 #endif
325
326 #if SQUID_DETECT_UDP_SO_SNDBUF > 16384
327 #define SQUID_UDP_SO_SNDBUF 16384
328 #else
329 #define SQUID_UDP_SO_SNDBUF SQUID_DETECT_UDP_SO_SNDBUF
330 #endif
331
332 #if SQUID_DETECT_UDP_SO_RCVBUF > 16384
333 #define SQUID_UDP_SO_RCVBUF 16384
334 #else
335 #define SQUID_UDP_SO_RCVBUF SQUID_DETECT_UDP_SO_RCVBUF
336 #endif
337
338 #ifdef HAVE_MEMCPY
339 #define xmemcpy(d,s,n) memcpy((d),(s),(n))
340 #elif HAVE_BCOPY
341 #define xmemcpy(d,s,n) bcopy((s),(d),(n))
342 #elif HAVE_MEMMOVE
343 #define xmemcpy(d,s,n) memmove((d),(s),(n))
344 #endif
345
346 #ifdef HAVE_MEMMOVE
347 #define xmemmove(d,s,n) memmove((d),(s),(n))
348 #elif HAVE_BCOPY
349 #define xmemmove(d,s,n) bcopy((s),(d),(n))
350 #endif
351
352 #define xisspace(x) isspace((unsigned char)x)
353 #define xtoupper(x) toupper((unsigned char)x)
354 #define xtolower(x) tolower((unsigned char)x)
355 #define xisdigit(x) isdigit((unsigned char)x)
356 #define xisascii(x) isascii((unsigned char)x)
357 #define xislower(x) islower((unsigned char)x)
358 #define xisalpha(x) isalpha((unsigned char)x)
359 #define xisprint(x) isprint((unsigned char)x)
360 #define xisalnum(x) isalnum((unsigned char)x)
361 #define xiscntrl(x) iscntrl((unsigned char)x)
362 #define xispunct(x) ispunct((unsigned char)x)
363 #define xisupper(x) isupper((unsigned char)x)
364 #define xisxdigit(x) isxdigit((unsigned char)x)
365
366 #if HAVE_RANDOM
367 #define squid_random random
368 #define squid_srandom srandom
369 #elif HAVE_LRAND48
370 #define squid_random lrand48
371 #define squid_srandom srand48
372 #else
373 #define squid_random rand
374 #define squid_srandom srand
375 #endif
376
377 #if __GNUC__
378 #define PRINTF_FORMAT_ARG1 __attribute__ ((format (printf, 1, 2)))
379 #define PRINTF_FORMAT_ARG2 __attribute__ ((format (printf, 2, 3)))
380 #define PRINTF_FORMAT_ARG3 __attribute__ ((format (printf, 3, 4)))
381 #else
382 #define PRINTF_FORMAT_ARG1
383 #define PRINTF_FORMAT_ARG2
384 #define PRINTF_FORMAT_ARG3
385 #endif
386
387 #endif /* SQUID_CONFIG_H */