update from main archive 961214
[glibc/history.git] / features.h
blob9b20512c513ae2431070e37dbe89d00f7b546a24
1 /* Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
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.
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.
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 not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #ifndef _FEATURES_H
21 #define _FEATURES_H 1
23 /* These are defined by the user (or the compiler)
24 to specify the desired environment:
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 _XOPEN_SOURCE Includes POSIX and XPG things.
30 _XOPEN_SOURCE_EXTENDED XPG things and X/Open Unix extensions.
31 _BSD_SOURCE ANSI, POSIX, and 4.3BSD things.
32 _SVID_SOURCE ANSI, POSIX, and SVID things.
33 _GNU_SOURCE All of the above, plus GNU extensions.
34 _REENTRANT Select additionally reentrant object.
35 _THREAD_SAFE Same as _REENTRANT, often used by other systems.
37 The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
38 If none of these are defined, the default is all but _GNU_SOURCE.
39 If more than one of these are defined, they accumulate.
40 For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
41 together give you ANSI C, 1003.1, and 1003.2, but nothing else.
43 These are defined by this file and are used by the
44 header files to decide what to declare or define:
46 __USE_POSIX Define IEEE Std 1003.1 things.
47 __USE_POSIX2 Define IEEE Std 1003.2 things.
48 __USE_XOPEN Define XPG things.
49 __USE_XOPEN_EXTENDED Define X/Open Unix things.
50 __USE_BSD Define 4.3BSD things.
51 __USE_SVID Define SVID things.
52 __USE_MISC Define things common to BSD and System V Unix.
53 __USE_GNU Define GNU extensions.
54 __USE_REENTRANT Define reentrant/thread-safe *_r functions.
55 __FAVOR_BSD Favor 4.3BSD things in cases of conflict.
57 The macro `__GNU_LIBRARY__' is defined by this file unconditionally.
59 All macros listed above as possibly being defined by this file are
60 explicitly undefined if they are not explicitly defined.
61 Feature-test macros that are not defined by the user or compiler
62 but are implied by the other feature-test macros defined (or by the
63 lack of any definitions) are defined by the file. */
66 /* Undefine everything, so we get a clean slate. */
67 #undef __USE_POSIX
68 #undef __USE_POSIX2
69 #undef __USE_XOPEN
70 #undef __USE_XOPEN_EXTENDED
71 #undef __USE_BSD
72 #undef __USE_SVID
73 #undef __USE_MISC
74 #undef __USE_GNU
75 #undef __USE_REENTRANT
76 #undef __FAVOR_BSD
77 #undef __KERNEL_STRICT_NAMES
79 /* Suppress kernel-name space pollution unless user expressedly asks
80 for it. */
81 #ifndef _LOOSE_KERNEL_NAMES
82 # define __KERNEL_STRICT_NAMES
83 #endif
85 /* Always use ANSI things. */
86 #define __USE_ANSI 1
89 /* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
90 #if defined (_BSD_SOURCE) && \
91 !(defined (_POSIX_SOURCE) || defined (_POSIX_C_SOURCE) || \
92 defined (_XOPEN_SOURCE) || defined (_XOPEN_SOURCE_DEFINED) || \
93 defined (_GNU_SOURCE) || defined (_SVID_SOURCE))
94 # define __FAVOR_BSD 1
95 #endif
97 /* If _GNU_SOURCE was defined by the user, turn on all the other features. */
98 #ifdef _GNU_SOURCE
99 #undef _POSIX_SOURCE
100 #define _POSIX_SOURCE 1
101 #undef _POSIX_C_SOURCE
102 #define _POSIX_C_SOURCE 2
103 #undef _XOPEN_SOURCE
104 #define _XOPEN_SOURCE 1
105 #undef _XOPEN_SOURCE_EXTENDED
106 #define _XOPEN_SOURCE_EXTENDED 1
107 #undef _BSD_SOURCE
108 #define _BSD_SOURCE 1
109 #undef _SVID_SOURCE
110 #define _SVID_SOURCE 1
111 #endif
113 /* If nothing (other than _GNU_SOURCE) is defined,
114 define _BSD_SOURCE and _SVID_SOURCE. */
115 #if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) && \
116 !defined (_POSIX_C_SOURCE) && !defined (_XOPEN_SOURCE) && \
117 !defined (_XOPEN_SOURCE_EXTENDED) && !defined (_BSD_SOURCE) && \
118 !defined (_SVID_SOURCE))
119 #define _BSD_SOURCE 1
120 #define _SVID_SOURCE 1
121 #endif
123 /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2. */
124 #if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) && \
125 !defined (_POSIX_C_SOURCE))
126 #define _POSIX_SOURCE 1
127 #define _POSIX_C_SOURCE 2
128 #endif
130 #if (defined (_POSIX_SOURCE) || _POSIX_C_SOURCE >= 1 || \
131 defined (_XOPEN_SOURCE))
132 #define __USE_POSIX 1
133 #endif
135 #if (defined (_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2 || \
136 defined (_XOPEN_SOURCE))
137 #define __USE_POSIX2 1
138 #endif
140 #ifdef _XOPEN_SOURCE
141 #define __USE_XOPEN 1
142 #ifdef _XOPEN_SOURCE_EXTENDED
143 #define __USE_XOPEN_EXTENDED 1
144 #endif
145 #endif
147 #if defined (_BSD_SOURCE) || defined (_SVID_SOURCE)
148 #define __USE_MISC 1
149 #endif
151 #ifdef _BSD_SOURCE
152 #define __USE_BSD 1
153 #endif
155 #ifdef _SVID_SOURCE
156 #define __USE_SVID 1
157 #endif
159 #ifdef _GNU_SOURCE
160 #define __USE_GNU 1
161 #endif
163 #if defined (_REENTRANT) || defined (_THREAD_SAFE)
164 #define __USE_REENTRANT 1
165 #endif
168 /* This macro indicates that the installed library is the GNU C Library.
169 For historic reasons the value now is 6 and this will stay from now
170 on. The use of this variable is deprecated. Use __GLIBC__ and
171 __GLIBC_MINOR__ now (see below) when you want to test for a specific
172 GNU C library version and use the values in <gnu/lib-names.h> to get
173 the sonames of the shared libraries. */
174 #undef __GNU_LIBRARY__
175 #define __GNU_LIBRARY__ 6
177 /* Major and minor version number of the GNU C library package. Use
178 these macros to test for features in specific releases. */
179 #define __GLIBC__ 2
180 #define __GLIBC_MINOR__ 0
183 #if !defined (__GNUC__) || __GNUC__ < 2
184 /* In GCC version 2, (__extension__ EXPR) will not complain
185 about GCC extensions used in EXPR under -ansi or -pedantic. */
186 #define __extension__
187 #endif
190 /* This is here only because every header file already includes this one. */
191 #ifndef __ASSEMBLER__
192 #include <sys/cdefs.h>
193 #endif
195 /* This is here only because every header file already includes this one. */
196 #ifndef _LIBC
197 /* Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
198 <stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
199 which will always return failure (and set errno to ENOSYS).
201 We avoid including <stubs.h> when compiling the C library itself to
202 avoid a dependency loop. stubs.h depends on every object file. If
203 this #include were done for the library source code, then every object
204 file would depend on stubs.h. */
206 #include <stubs.h>
207 #endif
209 #endif /* features.h */