Mon Nov 13 15:23:01 1995 Roland McGrath <roland@churchy.gnu.ai.mit.edu>
[glibc.git] / features.h
blob1249bb50b3e5715033ae6e64a2160dda8cd86b95
1 /* Copyright (C) 1991, 1992, 1993, 1995 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
16 not, write to the Free Software Foundation, Inc., 675 Mass Ave,
17 Cambridge, MA 02139, 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 _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.
33 The `-ansi' switch to the GNU C compiler defines __STRICT_ANSI__.
34 If none of these are defined, the default is _GNU_SOURCE.
35 If more than one of these are defined, they accumulate.
36 For example __STRICT_ANSI__, _POSIX_SOURCE and _POSIX_C_SOURCE
37 together give you ANSI C, 1003.1, and 1003.2, but nothing else.
39 These are defined by this file and are used by the
40 header files to decide what to declare or define:
42 __USE_POSIX Define IEEE Std 1003.1 things.
43 __USE_POSIX2 Define IEEE Std 1003.2 things.
44 __USE_BSD Define 4.3BSD things.
45 __USE_SVID Define SVID things.
46 __USE_MISC Define things common to BSD and System V Unix.
47 __USE_GNU Define GNU extensions.
48 __USE_REENTRANT Define reentrant/thread-safe *_r functions.
49 __FAVOR_BSD Favor 4.3BSD things in cases of conflict.
51 The macro `__GNU_LIBRARY__' is defined by this file unconditionally.
53 All macros defined by this file are defined as 1.
54 All macros listed above as possibly being defined by this file are
55 explicitly undefined if they are not explicitly defined.
56 Feature-test macros that are not defined by the user or compiler
57 but are implied by the other feature-test macros defined (or by the
58 lack of any definitions) are defined by the file. */
61 /* Undefine everything, so we get a clean slate. */
62 #undef __USE_POSIX
63 #undef __USE_POSIX2
64 #undef __USE_BSD
65 #undef __USE_SVID
66 #undef __USE_MISC
67 #undef __USE_GNU
68 #undef __USE_REENTRANT
69 #undef __FAVOR_BSD
72 /* If nothing is defined, define _GNU_SOURCE. */
73 #if (!defined(_GNU_SOURCE) && !defined(__STRICT_ANSI__) && \
74 !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) && \
75 !defined(_BSD_SOURCE) && !defined(_SVID_SOURCE))
76 #define _GNU_SOURCE 1
77 #endif
80 /* Always use ANSI things. */
81 #define __USE_ANSI 1
84 /* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
85 #ifdef _BSD_SOURCE
86 #define __FAVOR_BSD 1
87 #endif
90 /* If nothing (other than _GNU_SOURCE) is defined,
91 define _BSD_SOURCE and _SVID_SOURCE. */
92 #if (!defined(__STRICT_ANSI__) && !defined(_POSIX_SOURCE) && \
93 !defined(_POSIX_C_SOURCE) && !defined(_BSD_SOURCE) && \
94 !defined(_SVID_SOURCE))
95 #define _BSD_SOURCE 1
96 #define _SVID_SOURCE 1
97 #endif
99 /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2. */
100 #if (!defined(__STRICT_ANSI__) && !defined(_POSIX_SOURCE) && \
101 !defined(_POSIX_C_SOURCE))
102 #define _POSIX_SOURCE 1
103 #define _POSIX_C_SOURCE 2
104 #endif
106 #if defined(_POSIX_SOURCE) || _POSIX_C_SOURCE >= 1
107 #define __USE_POSIX 1
108 #endif
110 #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 2
111 #define __USE_POSIX2 1
112 #endif
114 #if defined(_BSD_SOURCE) || defined(_SVID_SOURCE)
115 #define __USE_MISC 1
116 #endif
118 #ifdef _BSD_SOURCE
119 #define __USE_BSD 1
120 #endif
122 #ifdef _SVID_SOURCE
123 #define __USE_SVID 1
124 #endif
126 #ifdef _GNU_SOURCE
127 #define __USE_GNU 1
128 #endif
130 #if defined (__USE_GNU) || defined (__USE_MISC)
131 #define __USE_REENTRANT 1
132 #endif
135 /* This macro indicates that the installed library is the GNU C Library.
136 Its value must be incremented whenever any existing library interface
137 changes such that callers must be recompiled with the new header files.
138 This value should always coincide with the major version number used for
139 the shared C library corresponding to this set of header files. */
141 #undef __GNU_LIBRARY__
142 #define __GNU_LIBRARY__ 5
145 #if !defined(__GNUC__) || __GNUC__ < 2
146 /* In GCC version 2, (__extension__ EXPR) will not complain
147 about GCC extensions used in EXPR under -ansi or -pedantic. */
148 #define __extension__
149 #endif
152 /* This is here only because every header file already includes this one. */
153 #include <sys/cdefs.h>
155 /* This is here only because every header file already includes this one. */
156 #ifndef _LIBC
157 /* Get the definitions of all the appropriate `__stub_FUNCTION' symbols.
158 <stubs.h> contains `#define __stub_FUNCTION' when FUNCTION is a stub
159 which will always return failure (and set errno to ENOSYS).
161 We avoid including <stubs.h> when compiling the C library itself to
162 avoid a dependency loop. stubs.h depends on every object file. If
163 this #include were done for the library source code, then every object
164 file would depend on stubs.h. */
166 #include <stubs.h>
167 #endif
169 #endif /* __features.h */