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__)
  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 _HAVE_SYSTYPES
  81. #define _READ_WRITE_RETURN_TYPE _ssize_t
  82. #define __LARGE64_FILES 1
  83. /* we use some glibc header files so turn on glibc large file feature */
  84. #define _LARGEFILE64_SOURCE 1
  85. #endif
  86. #endif
  87. #ifdef __mn10200__
  88. #define __SMALL_BITFIELDS
  89. #endif
  90. #ifdef __AVR__
  91. #define __SMALL_BITFIELDS
  92. #define _POINTER_INT short
  93. #endif
  94. #ifdef __v850
  95. #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__sda__))
  96. #endif
  97. /* For the PowerPC eabi, force the _impure_ptr to be in .sdata */
  98. #if defined(__PPC__)
  99. #if defined(_CALL_SYSV)
  100. #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
  101. #endif
  102. #ifdef __SPE__
  103. #define _LONG_DOUBLE double
  104. #endif
  105. #endif
  106. /* Configure small REENT structure for Xilinx MicroBlaze platforms */
  107. #if defined (__MICROBLAZE__)
  108. #ifndef _REENT_SMALL
  109. #define _REENT_SMALL
  110. #endif
  111. /* Xilinx XMK uses Unix98 mutex */
  112. #ifdef __XMK__
  113. #define _UNIX98_THREAD_MUTEX_ATTRIBUTES
  114. #endif
  115. #endif
  116. #if defined(__mips__) && !defined(__rtems__)
  117. #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
  118. #endif
  119. #ifdef __xstormy16__
  120. #define __SMALL_BITFIELDS
  121. #undef INT_MAX
  122. #undef UINT_MAX
  123. #define INT_MAX __INT_MAX__
  124. #define UINT_MAX (__INT_MAX__ * 2U + 1)
  125. #define MALLOC_ALIGNMENT 8
  126. #define _POINTER_INT short
  127. #define __BUFSIZ__ 16
  128. #define _REENT_SMALL
  129. #endif
  130. #if defined __MSP430__
  131. #ifndef _REENT_SMALL
  132. #define _REENT_SMALL
  133. #endif
  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. #ifdef __XTENSA__
  161. #include <xtensa/config/core-isa.h>
  162. #define MALLOC_ALIGNMENT ((XCHAL_DATA_WIDTH) < 16 ? 16 : (XCHAL_DATA_WIDTH))
  163. /* esp8266-specific: shrink the default fd buffer size */
  164. #define __BUFSIZ__ 128
  165. #ifndef __DYNAMIC_REENT__
  166. #define __DYNAMIC_REENT__
  167. #endif
  168. #ifndef _REENT_SMALL
  169. #define _REENT_SMALL
  170. #endif
  171. #define HAVE_GETOPT
  172. #endif
  173. /* This block should be kept in sync with GCC's limits.h. The point
  174. of having these definitions here is to not include limits.h, which
  175. would pollute the user namespace, while still using types of the
  176. the correct widths when deciding how to define __int32_t and
  177. __int64_t. */
  178. #ifndef __INT_MAX__
  179. # ifdef INT_MAX
  180. # define __INT_MAX__ INT_MAX
  181. # else
  182. # define __INT_MAX__ 2147483647
  183. # endif
  184. #endif
  185. #ifndef __LONG_MAX__
  186. # ifdef LONG_MAX
  187. # define __LONG_MAX__ LONG_MAX
  188. # else
  189. # if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) \
  190. || defined (__sparcv9)
  191. # define __LONG_MAX__ 9223372036854775807L
  192. # else
  193. # define __LONG_MAX__ 2147483647L
  194. # endif /* __alpha__ || sparc64 */
  195. # endif
  196. #endif
  197. /* End of block that should be kept in sync with GCC's limits.h. */
  198. #ifndef _POINTER_INT
  199. #define _POINTER_INT long
  200. #endif
  201. #ifdef __frv__
  202. #define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
  203. #endif
  204. #undef __RAND_MAX
  205. #if __INT_MAX__ == 32767
  206. #define __RAND_MAX 32767
  207. #else
  208. #define __RAND_MAX 0x7fffffff
  209. #endif
  210. #if defined(__CYGWIN__)
  211. #include <cygwin/config.h>
  212. #if !defined (__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L)
  213. #define __USE_XOPEN2K 1
  214. #endif
  215. #endif
  216. #if defined(__rtems__)
  217. #define __FILENAME_MAX__ 255
  218. #define _READ_WRITE_RETURN_TYPE _ssize_t
  219. #define __DYNAMIC_REENT__
  220. #define _REENT_GLOBAL_ATEXIT
  221. #endif
  222. #ifndef __EXPORT
  223. #define __EXPORT
  224. #endif
  225. #ifndef __IMPORT
  226. #define __IMPORT
  227. #endif
  228. /* Define return type of read/write routines. In POSIX, the return type
  229. for read()/write() is "ssize_t" but legacy newlib code has been using
  230. "int" for some time. If not specified, "int" is defaulted. */
  231. #ifndef _READ_WRITE_RETURN_TYPE
  232. #define _READ_WRITE_RETURN_TYPE int
  233. #endif
  234. /* Define `count' parameter of read/write routines. In POSIX, the `count'
  235. parameter is "size_t" but legacy newlib code has been using "int" for some
  236. time. If not specified, "int" is defaulted. */
  237. #ifndef _READ_WRITE_BUFSIZE_TYPE
  238. #define _READ_WRITE_BUFSIZE_TYPE int
  239. #endif
  240. #ifndef __WCHAR_MAX__
  241. #if __INT_MAX__ == 32767 || defined (_WIN32)
  242. #define __WCHAR_MAX__ 0xffffu
  243. #endif
  244. #endif
  245. /* See if small reent asked for at configuration time and
  246. is not chosen by the platform by default. */
  247. #ifdef _WANT_REENT_SMALL
  248. #ifndef _REENT_SMALL
  249. #define _REENT_SMALL
  250. #endif
  251. #endif
  252. /* If _MB_EXTENDED_CHARSETS_ALL is set, we want all of the extended
  253. charsets. The extended charsets add a few functions and a couple
  254. of tables of a few K each. */
  255. #ifdef _MB_EXTENDED_CHARSETS_ALL
  256. #define _MB_EXTENDED_CHARSETS_ISO 1
  257. #define _MB_EXTENDED_CHARSETS_WINDOWS 1
  258. #endif
  259. #endif /* __SYS_CONFIG_H__ */