]>
Commit | Line | Data |
---|---|---|
d3669add | 1 | /* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc. |
28f540f4 RM |
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 Library General Public License as | |
6 | published by the Free Software Foundation; either version 2 of the | |
7 | 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 | Library General Public License for more details. | |
13 | ||
14 | You should have received a copy of the GNU Library General Public | |
15 | License along with the GNU C Library; see the file COPYING.LIB. If | |
16 | not, write to the Free Software Foundation, Inc., 675 Mass Ave, | |
17 | Cambridge, MA 02139, USA. */ | |
18 | ||
19 | #ifndef _FEATURES_H | |
20 | ||
21 | #define _FEATURES_H 1 | |
22 | ||
23 | /* These are defined by the user (or the compiler) | |
24 | to specify the desired environment: | |
25 | ||
26 | __STRICT_ANSI__ ANSI Standard C. | |
27 | _POSIX_SOURCE IEEE Std 1003.1. | |
28 | _POSIX_C_SOURCE If ==1, like _POSIX_SOURCE; if ==2 add IEEE Std 1003.2. | |
29 | _BSD_SOURCE ANSI, POSIX, and 4.3BSD things. | |
30 | _SVID_SOURCE ANSI, POSIX, and SVID things. | |
31 | _GNU_SOURCE All of the above, plus GNU extensions. | |
ec4b0518 UD |
32 | _REENTRANT Select additionally reentrant object. |
33 | _THREAD_SAFE Same as _REENTRANT, often used by other systems. | |
28f540f4 RM |
34 | |
35 | The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__. | |
d3669add | 36 | If none of these are defined, the default is all but _GNU_SOURCE. |
28f540f4 RM |
37 | If more than one of these are defined, they accumulate. |
38 | For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE | |
39 | together give you ANSI C, 1003.1, and 1003.2, but nothing else. | |
40 | ||
41 | These are defined by this file and are used by the | |
42 | header files to decide what to declare or define: | |
43 | ||
44 | __USE_POSIX Define IEEE Std 1003.1 things. | |
45 | __USE_POSIX2 Define IEEE Std 1003.2 things. | |
46 | __USE_BSD Define 4.3BSD things. | |
47 | __USE_SVID Define SVID things. | |
48 | __USE_MISC Define things common to BSD and System V Unix. | |
49 | __USE_GNU Define GNU extensions. | |
aa910907 | 50 | __USE_REENTRANT Define reentrant/thread-safe *_r functions. |
28f540f4 RM |
51 | __FAVOR_BSD Favor 4.3BSD things in cases of conflict. |
52 | ||
53 | The macro `__GNU_LIBRARY__' is defined by this file unconditionally. | |
54 | ||
28f540f4 RM |
55 | All macros listed above as possibly being defined by this file are |
56 | explicitly undefined if they are not explicitly defined. | |
57 | Feature-test macros that are not defined by the user or compiler | |
58 | but are implied by the other feature-test macros defined (or by the | |
59 | lack of any definitions) are defined by the file. */ | |
60 | ||
61 | ||
62 | /* Undefine everything, so we get a clean slate. */ | |
63 | #undef __USE_POSIX | |
64 | #undef __USE_POSIX2 | |
65 | #undef __USE_BSD | |
66 | #undef __USE_SVID | |
67 | #undef __USE_MISC | |
68 | #undef __USE_GNU | |
aa910907 | 69 | #undef __USE_REENTRANT |
28f540f4 | 70 | #undef __FAVOR_BSD |
a1470b6f | 71 | #undef __KERNEL_STRICT_NAMES |
28f540f4 | 72 | |
a1470b6f RM |
73 | /* Suppress kernel-name space pollution unless user expressedly asks |
74 | for it: */ | |
75 | #ifndef _LOOSE_KERNEL_NAMES | |
76 | # define __KERNEL_STRICT_NAMES | |
77 | #endif | |
28f540f4 | 78 | |
28f540f4 RM |
79 | /* Always use ANSI things. */ |
80 | #define __USE_ANSI 1 | |
81 | ||
82 | ||
83 | /* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */ | |
d3669add | 84 | #if defined (_BSD_SOURCE) && \ |
4d585333 RM |
85 | !(defined (_POSIX_SOURCE) || defined (_POSIX_C_SOURCE) || \ |
86 | defined (_GNU_SOURCE) || defined (_SVID_SOURCE)) | |
28f540f4 RM |
87 | #define __FAVOR_BSD 1 |
88 | #endif | |
89 | ||
59dd8641 RM |
90 | /* If _GNU_SOURCE was defined by the user, turn on all the other features. */ |
91 | #ifdef _GNU_SOURCE | |
5f160cde RM |
92 | #undef _POSIX_SOURCE |
93 | #define _POSIX_SOURCE 1 | |
94 | #undef _POSIX_C_SOURCE | |
95 | #define _POSIX_C_SOURCE 2 | |
96 | #undef _BSD_SOURCE | |
97 | #define _BSD_SOURCE 1 | |
98 | #undef _SVID_SOURCE | |
99 | #define _SVID_SOURCE 1 | |
59dd8641 | 100 | #endif |
28f540f4 RM |
101 | |
102 | /* If nothing (other than _GNU_SOURCE) is defined, | |
103 | define _BSD_SOURCE and _SVID_SOURCE. */ | |
59dd8641 RM |
104 | #if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) && \ |
105 | !defined (_POSIX_C_SOURCE) && !defined (_BSD_SOURCE) && \ | |
106 | !defined (_SVID_SOURCE)) | |
28f540f4 RM |
107 | #define _BSD_SOURCE 1 |
108 | #define _SVID_SOURCE 1 | |
109 | #endif | |
110 | ||
111 | /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2. */ | |
59dd8641 RM |
112 | #if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) && \ |
113 | !defined (_POSIX_C_SOURCE)) | |
28f540f4 RM |
114 | #define _POSIX_SOURCE 1 |
115 | #define _POSIX_C_SOURCE 2 | |
116 | #endif | |
117 | ||
59dd8641 | 118 | #if defined (_POSIX_SOURCE) || _POSIX_C_SOURCE >= 1 |
28f540f4 RM |
119 | #define __USE_POSIX 1 |
120 | #endif | |
121 | ||
59dd8641 | 122 | #if defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2 |
28f540f4 RM |
123 | #define __USE_POSIX2 1 |
124 | #endif | |
125 | ||
59dd8641 | 126 | #if defined (_BSD_SOURCE) || defined (_SVID_SOURCE) |
28f540f4 RM |
127 | #define __USE_MISC 1 |
128 | #endif | |
129 | ||
130 | #ifdef _BSD_SOURCE | |
131 | #define __USE_BSD 1 | |
132 | #endif | |
133 | ||
134 | #ifdef _SVID_SOURCE | |
135 | #define __USE_SVID 1 | |
136 | #endif | |
137 | ||
138 | #ifdef _GNU_SOURCE | |
139 | #define __USE_GNU 1 | |
140 | #endif | |
141 | ||
ec4b0518 | 142 | #if defined (_REENTRANT) || defined (_THREAD_SAFE) |
aa910907 RM |
143 | #define __USE_REENTRANT 1 |
144 | #endif | |
145 | ||
28f540f4 | 146 | |
6ed0492f UD |
147 | /* Include header with information of libc version numbers. */ |
148 | #include <libc-version.h> | |
28f540f4 RM |
149 | |
150 | ||
59dd8641 | 151 | #if !defined (__GNUC__) || __GNUC__ < 2 |
28f540f4 RM |
152 | /* In GCC version 2, (__extension__ EXPR) will not complain |
153 | about GCC extensions used in EXPR under -ansi or -pedantic. */ | |
154 | #define __extension__ | |
155 | #endif | |
156 | ||
157 | ||
158 | /* This is here only because every header file already includes this one. */ | |
edf5b2d7 | 159 | #ifndef __ASSEMBLER__ |
28f540f4 | 160 | #include <sys/cdefs.h> |
edf5b2d7 | 161 | #endif |
28f540f4 RM |
162 | |
163 | /* This is here only because every header file already includes this one. */ | |
164 | #ifndef _LIBC | |
165 | /* Get the definitions of all the appropriate `__stub_FUNCTION' symbols. | |
166 | <stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub | |
167 | which will always return failure (and set errno to ENOSYS). | |
168 | ||
169 | We avoid including <stubs.h> when compiling the C library itself to | |
170 | avoid a dependency loop. stubs.h depends on every object file. If | |
171 | this #include were done for the library source code, then every object | |
172 | file would depend on stubs.h. */ | |
173 | ||
174 | #include <stubs.h> | |
175 | #endif | |
176 | ||
6ed0492f | 177 | #endif /* features.h */ |