1 | /* features.h,v 1.8 2004/09/14 22:27:32 bird Exp */
|
---|
2 | /** @file
|
---|
3 | * GLIBC v2.3.2
|
---|
4 | * @changed bird: don't define *LARGEFILE64*, but make sure to indicate that
|
---|
5 | * off_t is 64bits.
|
---|
6 | * @changed bird: not GLIBC version numbers.
|
---|
7 | * @changed bird: _GNU_SOURCE should not set _POSIX_SOURCE or _POSIX_C_SOURCE as that
|
---|
8 | * means somewhat imporatant exclusions in EMX and BSD style headers.
|
---|
9 | * Some of this have been fixed by __USE_EMX/_EMX_SOURCE, but that's
|
---|
10 | * not gonna help enough.
|
---|
11 | * @changed bird: Check if stuff is defined before accessing it in #if. Stops -Wundef
|
---|
12 | * from bitching.
|
---|
13 | * @changed bird: don't test on __EMX__ - RC & mozilla.
|
---|
14 | */
|
---|
15 |
|
---|
16 | /* Copyright (C) 1991-1993,1995-2000,2001,2002 Free Software Foundation, Inc.
|
---|
17 | This file is part of the GNU C Library.
|
---|
18 |
|
---|
19 | The GNU C Library is free software; you can redistribute it and/or
|
---|
20 | modify it under the terms of the GNU Lesser General Public
|
---|
21 | License as published by the Free Software Foundation; either
|
---|
22 | version 2.1 of the License, or (at your option) any later version.
|
---|
23 |
|
---|
24 | The GNU C Library is distributed in the hope that it will be useful,
|
---|
25 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
26 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
27 | Lesser General Public License for more details.
|
---|
28 |
|
---|
29 | You should have received a copy of the GNU Lesser General Public
|
---|
30 | License along with the GNU C Library; if not, write to the Free
|
---|
31 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
---|
32 | 02111-1307 USA. */
|
---|
33 |
|
---|
34 | #ifndef _FEATURES_H
|
---|
35 | #define _FEATURES_H 1
|
---|
36 |
|
---|
37 | /* These are defined by the user (or the compiler)
|
---|
38 | to specify the desired environment:
|
---|
39 |
|
---|
40 | __STRICT_ANSI__ ISO Standard C.
|
---|
41 | _ISOC99_SOURCE Extensions to ISO C89 from ISO C99.
|
---|
42 | _POSIX_SOURCE IEEE Std 1003.1.
|
---|
43 | _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
|
---|
44 | if >=199309L, add IEEE Std 1003.1b-1993;
|
---|
45 | if >=199506L, add IEEE Std 1003.1c-1995;
|
---|
46 | if >=200112L, all of IEEE 1003.1-2004
|
---|
47 | _XOPEN_SOURCE Includes POSIX and XPG things. Set to 500 if
|
---|
48 | Single Unix conformance is wanted, to 600 for the
|
---|
49 | upcoming sixth revision.
|
---|
50 | _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
|
---|
51 | _LARGEFILE_SOURCE Some more functions for correct standard I/O.
|
---|
52 | _LARGEFILE64_SOURCE Additional functionality from LFS for large files.
|
---|
53 | _FILE_OFFSET_BITS=N Select default filesystem interface.
|
---|
54 | _BSD_SOURCE ISO C, POSIX, and 4.3BSD things.
|
---|
55 | _SVID_SOURCE ISO C, POSIX, and SVID things.
|
---|
56 | _GNU_SOURCE All of the above, plus GNU extensions.
|
---|
57 | _REENTRANT Select additionally reentrant object.
|
---|
58 | _THREAD_SAFE Same as _REENTRANT, often used by other systems.
|
---|
59 | _FORTIFY_SOURCE If set to numeric value > 0 additional security
|
---|
60 | measures are defined, according to level.
|
---|
61 |
|
---|
62 | The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
|
---|
63 | If none of these are defined, the default is to have _SVID_SOURCE,
|
---|
64 | _BSD_SOURCE, and _POSIX_SOURCE set to one and _POSIX_C_SOURCE set to
|
---|
65 | 199506L. If more than one of these are defined, they accumulate.
|
---|
66 | For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
|
---|
67 | together give you ISO C, 1003.1, and 1003.2, but nothing else.
|
---|
68 |
|
---|
69 | These are defined by this file and are used by the
|
---|
70 | header files to decide what to declare or define:
|
---|
71 |
|
---|
72 | __USE_ISOC99 Define ISO C99 things.
|
---|
73 | __USE_POSIX Define IEEE Std 1003.1 things.
|
---|
74 | __USE_POSIX2 Define IEEE Std 1003.2 things.
|
---|
75 | __USE_POSIX199309 Define IEEE Std 1003.1, and .1b things.
|
---|
76 | __USE_POSIX199506 Define IEEE Std 1003.1, .1b, .1c and .1i things.
|
---|
77 | __USE_XOPEN Define XPG things.
|
---|
78 | __USE_XOPEN_EXTENDED Define X/Open Unix things.
|
---|
79 | __USE_UNIX98 Define Single Unix V2 things.
|
---|
80 | __USE_XOPEN2K Define XPG6 things.
|
---|
81 | __USE_LARGEFILE Define correct standard I/O things.
|
---|
82 | __USE_LARGEFILE64 Define LFS things with separate names.
|
---|
83 | __USE_FILE_OFFSET64 Define 64bit interface as default.
|
---|
84 | __USE_BSD Define 4.3BSD things.
|
---|
85 | __USE_SVID Define SVID things.
|
---|
86 | __USE_MISC Define things common to BSD and System V Unix.
|
---|
87 | __USE_GNU Define GNU extensions.
|
---|
88 | __USE_REENTRANT Define reentrant/thread-safe *_r functions.
|
---|
89 | __USE_FORTIFY_LEVEL Additional security measures used, according to level.
|
---|
90 | __FAVOR_BSD Favor 4.3BSD things in cases of conflict.
|
---|
91 |
|
---|
92 | The macros `__GNU_LIBRARY__', `__GLIBC__', and `__GLIBC_MINOR__' are
|
---|
93 | defined by this file unconditionally. `__GNU_LIBRARY__' is provided
|
---|
94 | only for compatibility. All new code should use the other symbols
|
---|
95 | to test for features.
|
---|
96 |
|
---|
97 | All macros listed above as possibly being defined by this file are
|
---|
98 | explicitly undefined if they are not explicitly defined.
|
---|
99 | Feature-test macros that are not defined by the user or compiler
|
---|
100 | but are implied by the other feature-test macros defined (or by the
|
---|
101 | lack of any definitions) are defined by the file. */
|
---|
102 |
|
---|
103 |
|
---|
104 | /* Undefine everything, so we get a clean slate. */
|
---|
105 | #undef __USE_ISOC99
|
---|
106 | #undef __USE_POSIX
|
---|
107 | #undef __USE_POSIX2
|
---|
108 | #undef __USE_POSIX199309
|
---|
109 | #undef __USE_POSIX199506
|
---|
110 | #undef __USE_XOPEN
|
---|
111 | #undef __USE_XOPEN_EXTENDED
|
---|
112 | #undef __USE_UNIX98
|
---|
113 | #undef __USE_XOPEN2K
|
---|
114 | #undef __USE_LARGEFILE
|
---|
115 | #undef __USE_LARGEFILE64
|
---|
116 | #undef __USE_FILE_OFFSET64
|
---|
117 | #undef __USE_BSD
|
---|
118 | #undef __USE_SVID
|
---|
119 | #undef __USE_MISC
|
---|
120 | #undef __USE_GNU
|
---|
121 | #undef __USE_REENTRANT
|
---|
122 | #undef __USE_FORTIFY_LEVEL
|
---|
123 | #undef __FAVOR_BSD
|
---|
124 | #undef __KERNEL_STRICT_NAMES
|
---|
125 | #undef __USE_EMX /* bird */
|
---|
126 |
|
---|
127 | /* Suppress kernel-name space pollution unless user expressedly asks
|
---|
128 | for it. */
|
---|
129 | #ifndef _LOOSE_KERNEL_NAMES
|
---|
130 | # define __KERNEL_STRICT_NAMES
|
---|
131 | #endif
|
---|
132 |
|
---|
133 | /* Always use ISO C things. */
|
---|
134 | #define __USE_ANSI 1
|
---|
135 |
|
---|
136 | /* Convenience macros to test the versions of glibc and gcc.
|
---|
137 | Use them like this:
|
---|
138 | #if __GNUC_PREREQ (2,8)
|
---|
139 | ... code requiring gcc 2.8 or later ...
|
---|
140 | #endif
|
---|
141 | Note - they won't work for gcc1 or glibc1, since the _MINOR macros
|
---|
142 | were not defined then. */
|
---|
143 | #if defined __GNUC__ && defined __GNUC_MINOR__
|
---|
144 | # define __GNUC_PREREQ(maj, min) \
|
---|
145 | ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
|
---|
146 | #else
|
---|
147 | # define __GNUC_PREREQ(maj, min) 0
|
---|
148 | #endif
|
---|
149 |
|
---|
150 |
|
---|
151 | /* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
|
---|
152 | #if defined _BSD_SOURCE && \
|
---|
153 | !(defined _POSIX_SOURCE || defined _POSIX_C_SOURCE || \
|
---|
154 | defined _XOPEN_SOURCE || defined _XOPEN_SOURCE_EXTENDED || \
|
---|
155 | defined _GNU_SOURCE || defined _SVID_SOURCE)
|
---|
156 | # define __FAVOR_BSD 1
|
---|
157 | #endif
|
---|
158 |
|
---|
159 | /* If _GNU_SOURCE was defined by the user, turn on all the other features. */
|
---|
160 | #ifdef _GNU_SOURCE
|
---|
161 | # undef _ISOC99_SOURCE
|
---|
162 | # define _ISOC99_SOURCE 1
|
---|
163 | /* bird: sorry, but this isn't causing huge exclusions for BSD or EMX headers. */
|
---|
164 | #if 0 /*ndef __EMX__*/ /* bird */
|
---|
165 | # undef _POSIX_SOURCE
|
---|
166 | # define _POSIX_SOURCE 1
|
---|
167 | # undef _POSIX_C_SOURCE
|
---|
168 | # define _POSIX_C_SOURCE 199506L
|
---|
169 | #else /* bird */
|
---|
170 | # define __USE_POSIX199309 1 /* bird */
|
---|
171 | # define __USE_POSIX199506 1 /* bird */
|
---|
172 | #endif /* bird */
|
---|
173 | # undef _XOPEN_SOURCE
|
---|
174 | # define _XOPEN_SOURCE 600
|
---|
175 | # undef _XOPEN_SOURCE_EXTENDED
|
---|
176 | # define _XOPEN_SOURCE_EXTENDED 1
|
---|
177 | # undef _LARGEFILE64_SOURCE
|
---|
178 | #if 0 /*def __EMX__*/ /* bird */
|
---|
179 | # define _LARGEFILE64_SOURCE 1
|
---|
180 | #endif /* bird */
|
---|
181 | # undef _BSD_SOURCE
|
---|
182 | # define _BSD_SOURCE 1
|
---|
183 | # undef _SVID_SOURCE
|
---|
184 | # define _SVID_SOURCE 1
|
---|
185 | # if 1 /*def __EMX__ */ /* bird */
|
---|
186 | # define _EMX_SOURCE 1 /* bird */
|
---|
187 | # endif /* bird */
|
---|
188 | # endif
|
---|
189 |
|
---|
190 | /* If nothing (other than _GNU_SOURCE) is defined,
|
---|
191 | define _BSD_SOURCE and _SVID_SOURCE. */
|
---|
192 | #if (!defined __STRICT_ANSI__ && !defined _ISOC99_SOURCE && \
|
---|
193 | !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
|
---|
194 | !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
|
---|
195 | !defined _BSD_SOURCE && !defined _SVID_SOURCE)
|
---|
196 | # define _BSD_SOURCE 1
|
---|
197 | # define _SVID_SOURCE 1
|
---|
198 | # define _EMX_SOURCE 1 /* bird */
|
---|
199 | #endif
|
---|
200 |
|
---|
201 | /* This is to enable the ISO C99 extension. Also recognize the old macro
|
---|
202 | which was used prior to the standard acceptance. This macro will
|
---|
203 | eventually go away and the features enabled by default once the ISO C99
|
---|
204 | standard is widely adopted. */
|
---|
205 | #if (defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE \
|
---|
206 | || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
|
---|
207 | # define __USE_ISOC99 1
|
---|
208 | #endif
|
---|
209 |
|
---|
210 | #if 0 /*ndef __EMX__*/ /* bird: this messes up lot's of EMX legacy declarations. */
|
---|
211 | /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2
|
---|
212 | (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined). */
|
---|
213 | #if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \
|
---|
214 | !defined _POSIX_C_SOURCE)
|
---|
215 | # define _POSIX_SOURCE 1
|
---|
216 | # if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) < 500
|
---|
217 | # define _POSIX_C_SOURCE 2
|
---|
218 | # else
|
---|
219 | # define _POSIX_C_SOURCE 199506L
|
---|
220 | # endif
|
---|
221 | #endif
|
---|
222 | #endif /* bird */
|
---|
223 |
|
---|
224 | #if defined _POSIX_SOURCE || (defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 1) || defined _XOPEN_SOURCE /* bird: check if defined, -Wundef. */
|
---|
225 | # define __USE_POSIX 1
|
---|
226 | #endif
|
---|
227 |
|
---|
228 | #if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 2 || defined _XOPEN_SOURCE
|
---|
229 | # define __USE_POSIX2 1
|
---|
230 | #endif
|
---|
231 |
|
---|
232 | #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199309L /* bird: check if defined, -Wundef. */
|
---|
233 | # define __USE_POSIX199309 1
|
---|
234 | #endif
|
---|
235 |
|
---|
236 | #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 199506L /* bird: check if defined, -Wundef. */
|
---|
237 | # define __USE_POSIX199506 1
|
---|
238 | #endif
|
---|
239 |
|
---|
240 |
|
---|
241 | #if defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE - 0) >= 200112L /* bird: check if defined, -Wundef. */
|
---|
242 | # define __USE_XOPEN2K 1
|
---|
243 | #endif
|
---|
244 |
|
---|
245 | #ifdef _XOPEN_SOURCE
|
---|
246 | # define __USE_XOPEN 1
|
---|
247 | # if (_XOPEN_SOURCE - 0) >= 500
|
---|
248 | # define __USE_XOPEN_EXTENDED 1
|
---|
249 | # define __USE_UNIX98 1
|
---|
250 | # undef _LARGEFILE_SOURCE
|
---|
251 | # define _LARGEFILE_SOURCE 1
|
---|
252 | # if (_XOPEN_SOURCE - 0) >= 600
|
---|
253 | # define __USE_XOPEN2K 1
|
---|
254 | # undef __USE_ISOC99
|
---|
255 | # define __USE_ISOC99 1
|
---|
256 | # endif
|
---|
257 | # else
|
---|
258 | # ifdef _XOPEN_SOURCE_EXTENDED
|
---|
259 | # define __USE_XOPEN_EXTENDED 1
|
---|
260 | # endif
|
---|
261 | # endif
|
---|
262 | #endif
|
---|
263 |
|
---|
264 | #ifdef _LARGEFILE_SOURCE
|
---|
265 | # define __USE_LARGEFILE 1
|
---|
266 | #endif
|
---|
267 |
|
---|
268 | #if 0 /*ndef __EMX__*/ /* bird */
|
---|
269 | #ifdef _LARGEFILE64_SOURCE
|
---|
270 | # define __USE_LARGEFILE64 1
|
---|
271 | #endif
|
---|
272 | #endif /* bird */
|
---|
273 |
|
---|
274 | #if 0 /*ndef __EMX__*/ /* bird */
|
---|
275 | #if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
|
---|
276 | # define __USE_FILE_OFFSET64 1
|
---|
277 | #endif
|
---|
278 | #else
|
---|
279 | # define __USE_FILE_OFFSET64 1
|
---|
280 | #endif /* bird */
|
---|
281 |
|
---|
282 | #if defined _BSD_SOURCE || defined _SVID_SOURCE
|
---|
283 | # define __USE_MISC 1
|
---|
284 | #endif
|
---|
285 |
|
---|
286 | #ifdef _BSD_SOURCE
|
---|
287 | # define __USE_BSD 1
|
---|
288 | /* bird: __USE_BSD == __BSD_VISIBLE, make sure it's defined. */
|
---|
289 | # undef __BSD_VISIBLE
|
---|
290 | # define __BSD_VISIBLE 1
|
---|
291 | /* bird: end */
|
---|
292 | #endif
|
---|
293 |
|
---|
294 | #ifdef _SVID_SOURCE
|
---|
295 | # define __USE_SVID 1
|
---|
296 | #endif
|
---|
297 |
|
---|
298 | #ifdef _GNU_SOURCE
|
---|
299 | # define __USE_GNU 1
|
---|
300 | #endif
|
---|
301 |
|
---|
302 | #if defined(_EMX_SOURCE) /* bird */
|
---|
303 | # define __USE_EMX 1 /* bird */
|
---|
304 | #endif /* bird */
|
---|
305 |
|
---|
306 | #if defined _REENTRANT || defined _THREAD_SAFE
|
---|
307 | # define __USE_REENTRANT 1
|
---|
308 | #endif
|
---|
309 |
|
---|
310 | #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && __GNUC_PREREQ (4, 1) && defined (__OPTIMIZE__) && __OPTIMIZE__ > 0 /* bird: check if defined, -Wundef. */
|
---|
311 | # if _FORTIFY_SOURCE == 1
|
---|
312 | # define __USE_FORTIFY_LEVEL 1
|
---|
313 | # elif _FORTIFY_SOURCE > 1
|
---|
314 | # define __USE_FORTIFY_LEVEL 2
|
---|
315 | # endif
|
---|
316 | #else
|
---|
317 | # define __USE_FORTIFY_LEVEL 0
|
---|
318 | #endif
|
---|
319 |
|
---|
320 | /* We do support the IEC 559 math functionality, real and complex. */
|
---|
321 | #define __STDC_IEC_559__ 1
|
---|
322 | #define __STDC_IEC_559_COMPLEX__ 1
|
---|
323 |
|
---|
324 | /* wchar_t uses ISO 10646-1 (2nd ed., published 2000-09-15) / Unicode 3.1. */
|
---|
325 | #define __STDC_ISO_10646__ 200009L
|
---|
326 |
|
---|
327 | #if 0 /*ndef __EMX__*/ /*bird: we're not GLIBC */
|
---|
328 | /* This macro indicates that the installed library is the GNU C Library.
|
---|
329 | For historic reasons the value now is 6 and this will stay from now
|
---|
330 | on. The use of this variable is deprecated. Use __GLIBC__ and
|
---|
331 | __GLIBC_MINOR__ now (see below) when you want to test for a specific
|
---|
332 | GNU C library version and use the values in <gnu/lib-names.h> to get
|
---|
333 | the sonames of the shared libraries. */
|
---|
334 | #undef __GNU_LIBRARY__
|
---|
335 | #define __GNU_LIBRARY__ 6
|
---|
336 |
|
---|
337 | /* Major and minor version number of the GNU C library package. Use
|
---|
338 | these macros to test for features in specific releases. */
|
---|
339 | #define __GLIBC__ 2
|
---|
340 | #define __GLIBC_MINOR__ 4
|
---|
341 | #endif /*bird*/
|
---|
342 |
|
---|
343 | #define __GLIBC_PREREQ(maj, min) \
|
---|
344 | ((__GLIBC__ << 16) + __GLIBC_MINOR__ >= ((maj) << 16) + (min))
|
---|
345 |
|
---|
346 | /* Decide whether a compiler supports the long long datatypes. */
|
---|
347 | #if defined __GNUC__ \
|
---|
348 | || (defined __PGI && defined __i386__ ) \
|
---|
349 | || (defined __INTEL_COMPILER && (defined __i386__ || defined __ia64__)) \
|
---|
350 | || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
|
---|
351 | # define __GLIBC_HAVE_LONG_LONG 1
|
---|
352 | #endif
|
---|
353 |
|
---|
354 | /* This is here only because every header file already includes this one. */
|
---|
355 | #ifndef __ASSEMBLER__
|
---|
356 | # ifndef _SYS_CDEFS_H
|
---|
357 | # include <sys/cdefs.h>
|
---|
358 | # endif
|
---|
359 |
|
---|
360 | /* If we don't have __REDIRECT, prototypes will be missing if
|
---|
361 | __USE_FILE_OFFSET64 but not __USE_LARGEFILE[64]. */
|
---|
362 | # if defined __USE_FILE_OFFSET64 && !defined __REDIRECT
|
---|
363 | # define __USE_LARGEFILE 1
|
---|
364 | #if 0 /*ndef __EMX__*/ /* bird */
|
---|
365 | # define __USE_LARGEFILE64 1
|
---|
366 | #endif /* bird */
|
---|
367 | # endif
|
---|
368 |
|
---|
369 | #endif /* !ASSEMBLER */
|
---|
370 |
|
---|
371 | /* Decide whether we can define 'extern inline' functions in headers. */
|
---|
372 | #if __GNUC_PREREQ (2, 7) && !__GNUC_PREREQ (4, 3) && defined __OPTIMIZE__ \
|
---|
373 | && !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__
|
---|
374 | # define __USE_EXTERN_INLINES 1
|
---|
375 | #endif
|
---|
376 |
|
---|
377 |
|
---|
378 | #if 0 /*ndef __EMX__*/ /* bird */
|
---|
379 | /* This is here only because every header file already includes this one.
|
---|
380 | Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
|
---|
381 | <gnu/stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
|
---|
382 | that will always return failure (and set errno to ENOSYS). */
|
---|
383 | #include <gnu/stubs.h>
|
---|
384 | #endif /* bird */
|
---|
385 |
|
---|
386 |
|
---|
387 | #endif /* features.h */
|
---|