_linux.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #ifndef __stl_config__linux_h
  2. #define __stl_config__linux_h
  3. #define _STLP_PLATFORM "Linux"
  4. #include "features.h"
  5. /* This is defined wether library in use is glibc or not.
  6. This may be treated as presence of GNU libc compatible
  7. header files (these define is not really intended to check
  8. for the presence of a particular library, but rather is used
  9. to define an INTERFACE.) */
  10. #ifndef _STLP_SGX_CONFIG
  11. #ifndef _STLP_USE_GLIBC
  12. # define _STLP_USE_GLIBC 1
  13. #endif
  14. #ifndef _STLP_USE_STDIO_IO
  15. # define _STLP_USE_UNIX_IO
  16. #endif
  17. #endif
  18. /* #define _STLP_USE_STDIO_IO */
  19. /* If not explicitly specified otherwise, work with threads
  20. */
  21. #if !defined(_STLP_NO_THREADS) && !defined(_REENTRANT)
  22. # define _REENTRANT
  23. #endif
  24. #if defined(_REENTRANT) && !defined(_PTHREADS)
  25. # define _PTHREADS
  26. #endif
  27. #ifdef __UCLIBC__ /* uClibc 0.9.27 */
  28. # define _STLP_USE_UCLIBC 1
  29. # if !defined(__UCLIBC_HAS_WCHAR__)
  30. # ifndef _STLP_NO_WCHAR_T
  31. # define _STLP_NO_WCHAR_T
  32. # endif
  33. # ifndef _STLP_NO_NATIVE_MBSTATE_T
  34. # define _STLP_NO_NATIVE_MBSTATE_T
  35. # endif
  36. # ifndef _STLP_NO_NATIVE_WIDE_STREAMS
  37. # define _STLP_NO_NATIVE_WIDE_STREAMS
  38. # endif
  39. # endif /* __UCLIBC_HAS_WCHAR__ */
  40. /* Hmm, bogus _GLIBCPP_USE_NAMESPACES seems undefined... */
  41. # define _STLP_VENDOR_GLOBAL_CSTD 1
  42. #endif
  43. #if defined(_PTHREADS)
  44. # define _STLP_THREADS
  45. # define _STLP_PTHREADS
  46. /*
  47. # ifndef __USE_UNIX98
  48. # define __USE_UNIX98
  49. # endif
  50. */
  51. /* This feature exist at least since glibc 2.2.4 */
  52. /* # define __FIT_XSI_THR */ /* Unix 98 or X/Open System Interfaces Extention */
  53. # ifdef __USE_XOPEN2K
  54. /* The IEEE Std. 1003.1j-2000 introduces functions to implement spinlocks. */
  55. # ifndef __UCLIBC__ /* There are no spinlocks in uClibc 0.9.27 */
  56. # define _STLP_USE_PTHREAD_SPINLOCK
  57. # else
  58. # ifndef _STLP_DONT_USE_PTHREAD_SPINLOCK
  59. /* in uClibc (0.9.26) pthread_spinlock* declared in headers
  60. * but absent in library */
  61. # define _STLP_DONT_USE_PTHREAD_SPINLOCK
  62. # endif
  63. # endif
  64. # ifndef _STLP_DONT_USE_PTHREAD_SPINLOCK
  65. # define _STLP_USE_PTHREAD_SPINLOCK
  66. # define _STLP_STATIC_MUTEX _STLP_mutex
  67. # endif
  68. /* # define __FIT_PSHARED_MUTEX */
  69. # endif
  70. #endif
  71. /* Endiannes */
  72. #include <sys/endian.h>
  73. #if !defined(_BYTE_ORDER) || !defined(_LITTLE_ENDIAN) || !defined(_BIG_ENDIAN)
  74. # error "One of _BYTE_ORDER, _LITTLE_ENDIAN and _BIG_ENDIAN undefined; Fix me!"
  75. #endif
  76. #if ( _BYTE_ORDER == _LITTLE_ENDIAN )
  77. # define _STLP_LITTLE_ENDIAN 1
  78. #elif ( _BYTE_ORDER == _BIG_ENDIAN )
  79. # define _STLP_BIG_ENDIAN 1
  80. #else
  81. # error "_BYTE_ORDER neither _BIG_ENDIAN nor _LITTLE_ENDIAN; Fix me!"
  82. #endif
  83. #if defined(__GNUC__) && (__GNUC__ < 3)
  84. # define _STLP_NO_NATIVE_WIDE_FUNCTIONS 1
  85. #endif
  86. #ifdef __GLIBC__
  87. # if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3) || (__GLIBC__ > 2)
  88. /* From glibc 2.3.x default allocator is malloc_alloc, if was not defined other */
  89. # if !defined(_STLP_USE_MALLOC) && !defined(_STLP_USE_NEWALLOC) && !defined(_STLP_USE_PERTHREAD_ALLOC) && !defined(_STLP_USE_NODE_ALLOC)
  90. # define _STLP_USE_MALLOC 1
  91. # endif
  92. # endif
  93. /* Following platforms has no long double:
  94. * - Alpha
  95. * - PowerPC
  96. * - SPARC, 32-bits (64-bits platform has long double)
  97. * - MIPS, 32-bits
  98. * - ARM
  99. * - SH4
  100. */
  101. # if defined(__alpha__) || \
  102. defined(__ppc__) || defined(PPC) || defined(__powerpc__) || \
  103. ((defined(__sparc) || defined(__sparcv9) || defined(__sparcv8plus)) && !defined ( __WORD64 ) && !defined(__arch64__)) /* ? */ || \
  104. (defined(_MIPS_SIM) && (_MIPS_SIM == _ABIO32)) || \
  105. defined(__arm__) || \
  106. defined(__sh__)
  107. /* # if defined(__NO_LONG_DOUBLE_MATH) */
  108. # define _STLP_NO_LONG_DOUBLE
  109. # endif
  110. #endif
  111. #endif /* __stl_config__linux_h */