config.h 7.0 KB

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