config.h 7.0 KB

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