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

Last change on this file since 1083 was 1083, checked in by bird, 22 years ago

#define BSD_VISIBLE together with USE_BSD. Don't define _POSIX_SOURCE as a default fallback when nothing is specified as that fkes up EMX legacy.

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