source: trunk/src/emx/include/features.h@ 1649

Last change on this file since 1649 was 1649, checked in by bird, 21 years ago

RC fixes.

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