linux.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // (C) Copyright John Maddock 2001 - 2003.
  2. // (C) Copyright Jens Maurer 2001 - 2003.
  3. // Use, modification and distribution are subject to the
  4. // Boost Software License, Version 1.0. (See accompanying file
  5. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. // See http://www.boost.org for most recent version.
  7. // linux specific config options:
  8. #define BOOST_PLATFORM "linux"
  9. // make sure we have __GLIBC_PREREQ if available at all
  10. #ifdef __cplusplus
  11. #include <cstdlib>
  12. #else
  13. #include <stdlib.h>
  14. #endif
  15. //
  16. // <stdint.h> added to glibc 2.1.1
  17. // We can only test for 2.1 though:
  18. //
  19. #if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)))
  20. // <stdint.h> defines int64_t unconditionally, but <sys/types.h> defines
  21. // int64_t only if __GNUC__. Thus, assume a fully usable <stdint.h>
  22. // only when using GCC. Update 2017: this appears not to be the case for
  23. // recent glibc releases, see bug report: https://svn.boost.org/trac/boost/ticket/13045
  24. # if defined(__GNUC__) || ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 5)))
  25. # define BOOST_HAS_STDINT_H
  26. # endif
  27. #endif
  28. #if defined(__LIBCOMO__)
  29. //
  30. // como on linux doesn't have std:: c functions:
  31. // NOTE: versions of libcomo prior to beta28 have octal version numbering,
  32. // e.g. version 25 is 21 (dec)
  33. //
  34. # if __LIBCOMO_VERSION__ <= 20
  35. # define BOOST_NO_STDC_NAMESPACE
  36. # endif
  37. # if __LIBCOMO_VERSION__ <= 21
  38. # define BOOST_NO_SWPRINTF
  39. # endif
  40. #endif
  41. //
  42. // If glibc is past version 2 then we definitely have
  43. // gettimeofday, earlier versions may or may not have it:
  44. //
  45. #if defined(__GLIBC__) && (__GLIBC__ >= 2)
  46. # define BOOST_HAS_GETTIMEOFDAY
  47. #endif
  48. #ifdef __USE_POSIX199309
  49. # define BOOST_HAS_NANOSLEEP
  50. #endif
  51. #if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
  52. // __GLIBC_PREREQ is available since 2.1.2
  53. // swprintf is available since glibc 2.2.0
  54. # if !__GLIBC_PREREQ(2,2) || (!defined(__USE_ISOC99) && !defined(__USE_UNIX98))
  55. # define BOOST_NO_SWPRINTF
  56. # endif
  57. #else
  58. # define BOOST_NO_SWPRINTF
  59. #endif
  60. // boilerplate code:
  61. #define BOOST_HAS_UNISTD_H
  62. #include <boost/config/detail/posix_features.hpp>
  63. #if defined(__USE_GNU) && !defined(__ANDROID__) && !defined(ANDROID)
  64. #define BOOST_HAS_PTHREAD_YIELD
  65. #endif
  66. #ifndef __GNUC__
  67. //
  68. // if the compiler is not gcc we still need to be able to parse
  69. // the GNU system headers, some of which (mainly <stdint.h>)
  70. // use GNU specific extensions:
  71. //
  72. # ifndef __extension__
  73. # define __extension__
  74. # endif
  75. # ifndef __const__
  76. # define __const__ const
  77. # endif
  78. # ifndef __volatile__
  79. # define __volatile__ volatile
  80. # endif
  81. # ifndef __signed__
  82. # define __signed__ signed
  83. # endif
  84. # ifndef __typeof__
  85. # define __typeof__ typeof
  86. # endif
  87. # ifndef __inline__
  88. # define __inline__ inline
  89. # endif
  90. #endif