Cygwin: Add new APIs tc[gs]etwinsize()
[newlib-cygwin.git] / newlib / libc / include / sys / config.h
blob5dcc77a8087820f473b605a2e1d3668354f716f4
1 #ifndef __SYS_CONFIG_H__
2 #define __SYS_CONFIG_H__
4 #include <machine/ieeefp.h> /* floating point macros */
5 #include <sys/features.h> /* POSIX defs */
7 #ifdef __aarch64__
8 #define MALLOC_ALIGNMENT 16
9 #endif
11 #ifdef __AMDGCN__
12 #define __DYNAMIC_REENT__
13 #endif
15 /* exceptions first */
16 #if defined(__H8500__) || defined(__W65__)
17 #define __SMALL_BITFIELDS
18 /* ??? This conditional is true for the h8500 and the w65, defining H8300
19 in those cases probably isn't the right thing to do. */
20 #define H8300 1
21 #endif
23 /* 16 bit integer machines */
24 #if defined(__Z8001__) || defined(__Z8002__) || defined(__H8500__) || defined(__W65__) || defined (__mn10200__) || defined (__AVR__) || defined (__MSP430__)
26 #undef INT_MAX
27 #undef UINT_MAX
28 #define INT_MAX 32767
29 #define UINT_MAX 65535
30 #endif
32 #if defined (__H8300__) || defined (__H8300H__) || defined(__H8300S__) || defined (__H8300SX__)
33 #define __SMALL_BITFIELDS
34 #define H8300 1
35 #undef INT_MAX
36 #undef UINT_MAX
37 #define INT_MAX __INT_MAX__
38 #define UINT_MAX (__INT_MAX__ * 2U + 1)
39 #endif
41 #if (defined(__CR16__) || defined(__CR16C__) ||defined(__CR16CP__))
42 #ifndef __INT32__
43 #define __SMALL_BITFIELDS
44 #undef INT_MAX
45 #undef UINT_MAX
46 #define INT_MAX 32767
47 #define UINT_MAX (__INT_MAX__ * 2U + 1)
48 #else /* INT32 */
49 #undef INT_MAX
50 #undef UINT_MAX
51 #define INT_MAX 2147483647
52 #define UINT_MAX (__INT_MAX__ * 2U + 1)
53 #endif /* INT32 */
55 #endif /* CR16C */
57 #if defined (__xc16x__) || defined (__xc16xL__) || defined (__xc16xS__)
58 #define __SMALL_BITFIELDS
59 #endif
61 #ifdef __W65__
62 #define __SMALL_BITFIELDS
63 #endif
65 #if defined(__D10V__)
66 #define __SMALL_BITFIELDS
67 #undef INT_MAX
68 #undef UINT_MAX
69 #define INT_MAX __INT_MAX__
70 #define UINT_MAX (__INT_MAX__ * 2U + 1)
71 #define _POINTER_INT short
72 #endif
74 #if defined(__mc68hc11__) || defined(__mc68hc12__) || defined(__mc68hc1x__)
75 #undef INT_MAX
76 #undef UINT_MAX
77 #define INT_MAX __INT_MAX__
78 #define UINT_MAX (__INT_MAX__ * 2U + 1)
79 #define _POINTER_INT short
80 #endif
82 #if defined(__m68k__) || defined(__mc68000__) || defined(__riscv)
83 #define _READ_WRITE_RETURN_TYPE _ssize_t
84 #endif
86 #ifdef ___AM29K__
87 #define _FLOAT_RET double
88 #endif
90 #ifdef __i386__
91 #ifndef __unix__
92 /* in other words, go32 */
93 #define _FLOAT_RET double
94 #endif
95 #if defined(__linux__) || defined(__RDOS__)
96 /* we want the reentrancy structure to be returned by a function */
97 #define __DYNAMIC_REENT__
98 #define HAVE_GETDATE
99 #define _READ_WRITE_RETURN_TYPE _ssize_t
100 #define __LARGE64_FILES 1
101 /* we use some glibc header files so turn on glibc large file feature */
102 #define _LARGEFILE64_SOURCE 1
103 #endif
104 #endif
106 #ifdef __mn10200__
107 #define __SMALL_BITFIELDS
108 #endif
110 #ifdef __AVR__
111 #define __SMALL_BITFIELDS
112 #define _POINTER_INT short
113 #endif
115 #if defined(__v850) && !defined(__rtems__)
116 #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__sda__))
117 #endif
119 /* For the PowerPC eabi, force the _impure_ptr to be in .sdata */
120 #if defined(__PPC__)
121 #if defined(_CALL_SYSV)
122 #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
123 #endif
124 #ifdef __SPE__
125 #define _LONG_DOUBLE double
126 #endif
127 #endif
129 /* Configure small REENT structure for Xilinx MicroBlaze platforms */
130 #if defined (__MICROBLAZE__) && !defined(__rtems__)
131 #ifndef _REENT_SMALL
132 #define _REENT_SMALL
133 #endif
134 /* Xilinx XMK uses Unix98 mutex */
135 #ifdef __XMK__
136 #define _UNIX98_THREAD_MUTEX_ATTRIBUTES
137 #endif
138 #endif
140 #if defined(__mips__) && !defined(__rtems__)
141 #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
142 #endif
144 #ifdef __xstormy16__
145 #define __SMALL_BITFIELDS
146 #undef INT_MAX
147 #undef UINT_MAX
148 #define INT_MAX __INT_MAX__
149 #define UINT_MAX (__INT_MAX__ * 2U + 1)
150 #define MALLOC_ALIGNMENT 8
151 #define _POINTER_INT short
152 #define __BUFSIZ__ 16
153 #define _REENT_SMALL
154 #endif
156 #if defined __MSP430__
157 #ifndef _REENT_SMALL
158 #define _REENT_SMALL
159 #endif
161 #define __BUFSIZ__ 256
162 #define __SMALL_BITFIELDS
164 #ifdef __MSP430X_LARGE__
165 #define _POINTER_INT __int20
166 #else
167 #define _POINTER_INT int
168 #endif
169 #endif
171 #ifdef __m32c__
172 #define __SMALL_BITFIELDS
173 #undef INT_MAX
174 #undef UINT_MAX
175 #define INT_MAX __INT_MAX__
176 #define UINT_MAX (__INT_MAX__ * 2U + 1)
177 #define MALLOC_ALIGNMENT 8
178 #if defined(__r8c_cpu__) || defined(__m16c_cpu__)
179 #define _POINTER_INT short
180 #else
181 #define _POINTER_INT long
182 #endif
183 #define __BUFSIZ__ 16
184 #define _REENT_SMALL
185 #endif /* __m32c__ */
187 #ifdef __SPU__
188 #define MALLOC_ALIGNMENT 16
189 #define __CUSTOM_FILE_IO__
190 #endif
192 #if defined(__or1k__) || defined(__or1knd__)
193 #define __DYNAMIC_REENT__
194 #endif
196 /* This block should be kept in sync with GCC's limits.h. The point
197 of having these definitions here is to not include limits.h, which
198 would pollute the user namespace, while still using types of the
199 the correct widths when deciding how to define __int32_t and
200 __int64_t. */
201 #ifndef __INT_MAX__
202 # ifdef INT_MAX
203 # define __INT_MAX__ INT_MAX
204 # else
205 # define __INT_MAX__ 2147483647
206 # endif
207 #endif
209 #ifndef __LONG_MAX__
210 # ifdef LONG_MAX
211 # define __LONG_MAX__ LONG_MAX
212 # else
213 # if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) \
214 || defined (__sparcv9)
215 # define __LONG_MAX__ 9223372036854775807L
216 # else
217 # define __LONG_MAX__ 2147483647L
218 # endif /* __alpha__ || sparc64 */
219 # endif
220 #endif
221 /* End of block that should be kept in sync with GCC's limits.h. */
223 #ifndef _POINTER_INT
224 #define _POINTER_INT long
225 #endif
227 #ifdef __frv__
228 #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
229 #endif
230 #undef __RAND_MAX
231 #if __INT_MAX__ == 32767
232 #define __RAND_MAX 32767
233 #else
234 #define __RAND_MAX 0x7fffffff
235 #endif
237 #if defined(__CYGWIN__)
238 #include <cygwin/config.h>
239 #endif
241 #if defined(__rtems__)
242 #define __FILENAME_MAX__ 255
243 #define _READ_WRITE_RETURN_TYPE _ssize_t
244 #define __DYNAMIC_REENT__
245 #endif
247 #ifndef __EXPORT
248 #define __EXPORT
249 #endif
251 #ifndef __IMPORT
252 #define __IMPORT
253 #endif
255 /* Define return type of read/write routines. In POSIX, the return type
256 for read()/write() is "ssize_t" but legacy newlib code has been using
257 "int" for some time. If not specified, "int" is defaulted. */
258 #ifndef _READ_WRITE_RETURN_TYPE
259 #define _READ_WRITE_RETURN_TYPE int
260 #endif
261 /* Define `count' parameter of read/write routines. In POSIX, the `count'
262 parameter is "size_t" but legacy newlib code has been using "int" for some
263 time. If not specified, "int" is defaulted. */
264 #ifndef _READ_WRITE_BUFSIZE_TYPE
265 #define _READ_WRITE_BUFSIZE_TYPE int
266 #endif
268 #ifndef __WCHAR_MAX__
269 #if __INT_MAX__ == 32767 || defined (_WIN32)
270 #define __WCHAR_MAX__ 0xffffu
271 #endif
272 #endif
274 /* See if small reent asked for at configuration time and
275 is not chosen by the platform by default. */
276 #ifdef _WANT_REENT_SMALL
277 #ifndef _REENT_SMALL
278 #define _REENT_SMALL
279 #endif
280 #endif
282 #ifdef _WANT_USE_LONG_TIME_T
283 #ifndef _USE_LONG_TIME_T
284 #define _USE_LONG_TIME_T
285 #endif
286 #endif
288 #ifdef _WANT_USE_GDTOA
289 #ifndef _USE_GDTOA
290 #define _USE_GDTOA
291 #endif
292 #endif
294 #ifdef _WANT_REENT_BACKWARD_BINARY_COMPAT
295 #ifndef _REENT_BACKWARD_BINARY_COMPAT
296 #define _REENT_BACKWARD_BINARY_COMPAT
297 #endif
298 #endif
300 #ifdef _WANT_REENT_THREAD_LOCAL
301 #ifndef _REENT_THREAD_LOCAL
302 #define _REENT_THREAD_LOCAL
303 #endif
304 #endif
306 /* If _MB_EXTENDED_CHARSETS_ALL is set, we want all of the extended
307 charsets. The extended charsets add a few functions and a couple
308 of tables of a few K each. */
309 #ifdef _MB_EXTENDED_CHARSETS_ALL
310 #define _MB_EXTENDED_CHARSETS_ISO 1
311 #define _MB_EXTENDED_CHARSETS_WINDOWS 1
312 #endif
314 #endif /* __SYS_CONFIG_H__ */