linux.hpp 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #include <cstdlib>
  11. //
  12. // <stdint.h> added to glibc 2.1.1
  13. // We can only test for 2.1 though:
  14. //
  15. #if defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)))
  16. // <stdint.h> defines int64_t unconditionally, but <sys/types.h> defines
  17. // int64_t only if __GNUC__. Thus, assume a fully usable <stdint.h>
  18. // only when using GCC.
  19. # if defined __GNUC__
  20. # define BOOST_HAS_STDINT_H
  21. # endif
  22. #endif
  23. #if defined(__LIBCOMO__)
  24. //
  25. // como on linux doesn't have std:: c functions:
  26. // NOTE: versions of libcomo prior to beta28 have octal version numbering,
  27. // e.g. version 25 is 21 (dec)
  28. //
  29. # if __LIBCOMO_VERSION__ <= 20
  30. # define BOOST_NO_STDC_NAMESPACE
  31. # endif
  32. # if __LIBCOMO_VERSION__ <= 21
  33. # define BOOST_NO_SWPRINTF
  34. # endif
  35. #endif
  36. //
  37. // If glibc is past version 2 then we definitely have
  38. // gettimeofday, earlier versions may or may not have it:
  39. //
  40. #if defined(__GLIBC__) && (__GLIBC__ >= 2)
  41. # define BOOST_HAS_GETTIMEOFDAY
  42. #endif
  43. #ifdef __USE_POSIX199309
  44. # define BOOST_HAS_NANOSLEEP
  45. #endif
  46. #if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
  47. // __GLIBC_PREREQ is available since 2.1.2
  48. // swprintf is available since glibc 2.2.0
  49. # if !__GLIBC_PREREQ(2,2) || (!defined(__USE_ISOC99) && !defined(__USE_UNIX98))
  50. # define BOOST_NO_SWPRINTF
  51. # endif
  52. #else
  53. # define BOOST_NO_SWPRINTF
  54. #endif
  55. // boilerplate code:
  56. #define BOOST_HAS_UNISTD_H
  57. #include <boost/config/posix_features.hpp>
  58. #ifndef __GNUC__
  59. //
  60. // if the compiler is not gcc we still need to be able to parse
  61. // the GNU system headers, some of which (mainly <stdint.h>)
  62. // use GNU specific extensions:
  63. //
  64. # ifndef __extension__
  65. # define __extension__
  66. # endif
  67. # ifndef __const__
  68. # define __const__ const
  69. # endif
  70. # ifndef __volatile__
  71. # define __volatile__ volatile
  72. # endif
  73. # ifndef __signed__
  74. # define __signed__ signed
  75. # endif
  76. # ifndef __typeof__
  77. # define __typeof__ typeof
  78. # endif
  79. # ifndef __inline__
  80. # define __inline__ inline
  81. # endif
  82. #endif