features.h 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. /*
  2. * Written by Joel Sherrill <joel@OARcorp.com>.
  3. *
  4. * COPYRIGHT (c) 1989-2000.
  5. *
  6. * On-Line Applications Research Corporation (OAR).
  7. *
  8. * Permission to use, copy, modify, and distribute this software for any
  9. * purpose without fee is hereby granted, provided that this entire notice
  10. * is included in all copies of any software which is or includes a copy
  11. * or modification of this software.
  12. *
  13. * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
  14. * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION
  15. * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS
  16. * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
  17. *
  18. * $Id$
  19. */
  20. #ifndef _SYS_FEATURES_H
  21. #define _SYS_FEATURES_H
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /* Macros to determine that newlib is being used. Put in this header to
  26. * be similar to where glibc stores its version of these macros.
  27. */
  28. #define __NEWLIB__ 2
  29. #define __NEWLIB_MINOR__ 1
  30. /* Macro to test version of GCC. Returns 0 for non-GCC or too old GCC. */
  31. #ifndef __GNUC_PREREQ
  32. # if defined __GNUC__ && defined __GNUC_MINOR__
  33. # define __GNUC_PREREQ(maj, min) \
  34. ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
  35. # else
  36. # define __GNUC_PREREQ(maj, min) 0
  37. # endif
  38. #endif /* __GNUC_PREREQ */
  39. /* Version with trailing underscores for BSD compatibility. */
  40. #define __GNUC_PREREQ__(ma, mi) __GNUC_PREREQ(ma, mi)
  41. /* RTEMS adheres to POSIX -- 1003.1b with some features from annexes. */
  42. #ifdef __rtems__
  43. #define _POSIX_JOB_CONTROL 1
  44. #define _POSIX_SAVED_IDS 1
  45. #define _POSIX_VERSION 199309L
  46. #define _POSIX_ASYNCHRONOUS_IO 1
  47. #define _POSIX_FSYNC 1
  48. #define _POSIX_MAPPED_FILES 1
  49. #define _POSIX_MEMLOCK 1
  50. #define _POSIX_MEMLOCK_RANGE 1
  51. #define _POSIX_MEMORY_PROTECTION 1
  52. #define _POSIX_MESSAGE_PASSING 1
  53. #define _POSIX_MONOTONIC_CLOCK 200112L
  54. #define _POSIX_PRIORITIZED_IO 1
  55. #define _POSIX_PRIORITY_SCHEDULING 1
  56. #define _POSIX_REALTIME_SIGNALS 1
  57. #define _POSIX_SEMAPHORES 1
  58. /* #define _POSIX_SHARED_MEMORY_OBJECTS 1 */
  59. #define _POSIX_SYNCHRONIZED_IO 1
  60. #define _POSIX_TIMERS 1
  61. #define _POSIX_BARRIERS 200112L
  62. #define _POSIX_READER_WRITER_LOCKS 200112L
  63. #define _POSIX_SPIN_LOCKS 200112L
  64. /* In P1003.1b but defined by drafts at least as early as P1003.1c/D10 */
  65. #define _POSIX_THREADS 1
  66. #define _POSIX_THREAD_ATTR_STACKADDR 1
  67. #define _POSIX_THREAD_ATTR_STACKSIZE 1
  68. #define _POSIX_THREAD_PRIORITY_SCHEDULING 1
  69. #define _POSIX_THREAD_PRIO_INHERIT 1
  70. #define _POSIX_THREAD_PRIO_PROTECT 1
  71. #define _POSIX_THREAD_PROCESS_SHARED 1
  72. #define _POSIX_THREAD_SAFE_FUNCTIONS 1
  73. /* P1003.4b/D8 defines the constants below this comment. */
  74. #define _POSIX_SPAWN 1
  75. #define _POSIX_TIMEOUTS 1
  76. #define _POSIX_CPUTIME 1
  77. #define _POSIX_THREAD_CPUTIME 1
  78. #define _POSIX_SPORADIC_SERVER 1
  79. #define _POSIX_THREAD_SPORADIC_SERVER 1
  80. #define _POSIX_DEVICE_CONTROL 1
  81. #define _POSIX_DEVCTL_DIRECTION 1
  82. #define _POSIX_INTERRUPT_CONTROL 1
  83. #define _POSIX_ADVISORY_INFO 1
  84. /* UNIX98 added some new pthread mutex attributes */
  85. #define _UNIX98_THREAD_MUTEX_ATTRIBUTES 1
  86. #endif
  87. /* XMK loosely adheres to POSIX -- 1003.1 */
  88. #ifdef __XMK__
  89. #define _POSIX_THREADS 1
  90. #define _POSIX_THREAD_PRIORITY_SCHEDULING 1
  91. #endif
  92. #ifdef __svr4__
  93. # define _POSIX_JOB_CONTROL 1
  94. # define _POSIX_SAVED_IDS 1
  95. # define _POSIX_VERSION 199009L
  96. #endif
  97. #ifdef __CYGWIN__
  98. #if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L
  99. #define _POSIX_VERSION 200112L
  100. #define _POSIX2_VERSION 200112L
  101. #define _XOPEN_VERSION 600
  102. #define _POSIX_ADVISORY_INFO 200112L
  103. /* #define _POSIX_ASYNCHRONOUS_IO -1 */
  104. /* #define _POSIX_BARRIERS -1 */
  105. #define _POSIX_CHOWN_RESTRICTED 1
  106. #define _POSIX_CLOCK_SELECTION 200112L
  107. #define _POSIX_CPUTIME 200112L
  108. #define _POSIX_FSYNC 200112L
  109. #define _POSIX_IPV6 200112L
  110. #define _POSIX_JOB_CONTROL 1
  111. #define _POSIX_MAPPED_FILES 200112L
  112. /* #define _POSIX_MEMLOCK -1 */
  113. #define _POSIX_MEMLOCK_RANGE 200112L
  114. #define _POSIX_MEMORY_PROTECTION 200112L
  115. #define _POSIX_MESSAGE_PASSING 200112L
  116. #define _POSIX_MONOTONIC_CLOCK 200112L
  117. #define _POSIX_NO_TRUNC 1
  118. /* #define _POSIX_PRIORITIZED_IO -1 */
  119. #define _POSIX_PRIORITY_SCHEDULING 200112L
  120. #define _POSIX_RAW_SOCKETS 200112L
  121. #define _POSIX_READER_WRITER_LOCKS 200112L
  122. #define _POSIX_REALTIME_SIGNALS 200112L
  123. #define _POSIX_REGEXP 1
  124. #define _POSIX_SAVED_IDS 1
  125. #define _POSIX_SEMAPHORES 200112L
  126. #define _POSIX_SHARED_MEMORY_OBJECTS 200112L
  127. #define _POSIX_SHELL 1
  128. /* #define _POSIX_SPAWN -1 */
  129. #define _POSIX_SPIN_LOCKS 200112L
  130. /* #define _POSIX_SPORADIC_SERVER -1 */
  131. #define _POSIX_SYNCHRONIZED_IO 200112L
  132. #define _POSIX_THREAD_ATTR_STACKADDR 200112L
  133. #define _POSIX_THREAD_ATTR_STACKSIZE 200112L
  134. #define _POSIX_THREAD_CPUTIME 200112L
  135. /* #define _POSIX_THREAD_PRIO_INHERIT -1 */
  136. /* #define _POSIX_THREAD_PRIO_PROTECT -1 */
  137. #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L
  138. #define _POSIX_THREAD_PROCESS_SHARED 200112L
  139. #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
  140. /* #define _POSIX_THREAD_SPORADIC_SERVER -1 */
  141. #define _POSIX_THREADS 200112L
  142. /* #define _POSIX_TIMEOUTS -1 */
  143. #define _POSIX_TIMERS 1
  144. /* #define _POSIX_TRACE -1 */
  145. /* #define _POSIX_TRACE_EVENT_FILTER -1 */
  146. /* #define _POSIX_TRACE_INHERIT -1 */
  147. /* #define _POSIX_TRACE_LOG -1 */
  148. /* #define _POSIX_TYPED_MEMORY_OBJECTS -1 */
  149. #define _POSIX_VDISABLE '\0'
  150. #define _POSIX2_C_BIND 200112L
  151. #define _POSIX2_C_DEV 200112L
  152. #define _POSIX2_CHAR_TERM 200112L
  153. /* #define _POSIX2_FORT_DEV -1 */
  154. /* #define _POSIX2_FORT_RUN -1 */
  155. /* #define _POSIX2_LOCALEDEF -1 */
  156. /* #define _POSIX2_PBS -1 */
  157. /* #define _POSIX2_PBS_ACCOUNTING -1 */
  158. /* #define _POSIX2_PBS_CHECKPOINT -1 */
  159. /* #define _POSIX2_PBS_LOCATE -1 */
  160. /* #define _POSIX2_PBS_MESSAGE -1 */
  161. /* #define _POSIX2_PBS_TRACK -1 */
  162. #define _POSIX2_SW_DEV 200112L
  163. #define _POSIX2_UPE 200112L
  164. #define _POSIX_V6_ILP32_OFF32 -1
  165. #ifdef __LP64__
  166. #define _POSIX_V6_ILP32_OFFBIG -1
  167. #define _POSIX_V6_LP64_OFF64 1
  168. #define _POSIX_V6_LPBIG_OFFBIG 1
  169. #else
  170. #define _POSIX_V6_ILP32_OFFBIG 1
  171. #define _POSIX_V6_LP64_OFF64 -1
  172. #define _POSIX_V6_LPBIG_OFFBIG -1
  173. #endif
  174. #define _XBS5_ILP32_OFF32 _POSIX_V6_ILP32_OFF32
  175. #define _XBS5_ILP32_OFFBIG _POSIX_V6_ILP32_OFFBIG
  176. #define _XBS5_LP64_OFF64 _POSIX_V6_LP64_OFF64
  177. #define _XBS5_LPBIG_OFFBIG _POSIX_V6_LPBIG_OFFBIG
  178. #define _XOPEN_CRYPT 1
  179. #define _XOPEN_ENH_I18N 1
  180. /* #define _XOPEN_LEGACY -1 */
  181. /* #define _XOPEN_REALTIME -1 */
  182. /* #define _XOPEN_REALTIME_THREADS -1 */
  183. #define _XOPEN_SHM 1
  184. /* #define _XOPEN_STREAMS -1 */
  185. /* #define _XOPEN_UNIX -1 */
  186. #endif /* !__STRICT_ANSI__ || __cplusplus || __STDC_VERSION__ >= 199901L */
  187. /* The value corresponds to UNICODE version 4.0, which is the version
  188. supported by XP. Newlib supports 5.2 (2011) but so far Cygwin needs
  189. the MS conversions for double-byte charsets. */
  190. #define __STDC_ISO_10646__ 200305L
  191. #endif /* __CYGWIN__ */
  192. /* ESP-IDF-specific: enable pthreads support */
  193. #ifdef __XTENSA__
  194. #define _POSIX_THREADS 1
  195. #define _UNIX98_THREAD_MUTEX_ATTRIBUTES 1
  196. #endif
  197. /* Per the permission given in POSIX.1-2008 section 2.2.1, define
  198. * _POSIX_C_SOURCE if _XOPEN_SOURCE is defined and _POSIX_C_SOURCE is not.
  199. * (_XOPEN_SOURCE indicates that XSI extensions are desired by an application.)
  200. * This permission is first granted in 2008, but use it for older ones, also.
  201. * Allow for _XOPEN_SOURCE to be empty (from the earliest form of it, before it
  202. * was required to have specific values).
  203. */
  204. #if !defined(_POSIX_C_SOURCE) && defined(_XOPEN_SOURCE)
  205. #if (_XOPEN_SOURCE - 0) == 700 /* POSIX.1-2008 */
  206. #define _POSIX_C_SOURCE 200809L
  207. #elif (_XOPEN_SOURCE - 0) == 600 /* POSIX.1-2001 or 2004 */
  208. #define _POSIX_C_SOURCE 200112L
  209. #elif (_XOPEN_SOURCE - 0) == 500 /* POSIX.1-1995 */
  210. #define _POSIX_C_SOURCE 199506L
  211. #elif (_XOPEN_SOURCE - 0) < 500 /* really old */
  212. #define _POSIX_C_SOURCE 2
  213. #endif
  214. #endif
  215. #ifdef __cplusplus
  216. }
  217. #endif
  218. #endif /* _SYS_FEATURES_H */