/Src/Dependencies/Boost/boost/chrono/config.hpp

http://hadesmem.googlecode.com/ · C++ Header · 152 lines · 97 code · 25 blank · 30 comment · 26 complexity · dd5d57a7ed4f47cbdf27c36a24377ca9 MD5 · raw file

  1. // boost/chrono/config.hpp -------------------------------------------------//
  2. // Copyright Beman Dawes 2003, 2006, 2008
  3. // Copyright 2009 Vicente J. Botet Escriba
  4. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6. // See http://www.boost.org/libs/chrono for documentation.
  7. #ifndef BOOST_CHRONO_CONFIG_HPP
  8. #define BOOST_CHRONO_CONFIG_HPP
  9. #include <boost/config.hpp>
  10. #if defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_USE_WINDOWS_H)
  11. #define BOOST_USE_WINDOWS_H
  12. #endif
  13. // BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API
  14. // can be defined by the user to specify which API should be used
  15. #if defined(BOOST_CHRONO_WINDOWS_API)
  16. # warning Boost.Chrono will use the Windows API
  17. #elif defined(BOOST_CHRONO_MAC_API)
  18. # warning Boost.Chrono will use the Mac API
  19. #elif defined(BOOST_CHRONO_POSIX_API)
  20. # warning Boost.Chrono will use the POSIX API
  21. #endif
  22. # if defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_POSIX_API )
  23. # error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_POSIX_API are defined
  24. # elif defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_MAC_API )
  25. # error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_MAC_API are defined
  26. # elif defined( BOOST_CHRONO_MAC_API ) && defined( BOOST_CHRONO_POSIX_API )
  27. # error both BOOST_CHRONO_MAC_API and BOOST_CHRONO_POSIX_API are defined
  28. # elif !defined( BOOST_CHRONO_WINDOWS_API ) && !defined( BOOST_CHRONO_MAC_API ) && !defined( BOOST_CHRONO_POSIX_API )
  29. # if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
  30. # define BOOST_CHRONO_WINDOWS_API
  31. # define BOOST_CHRONO_HAS_CLOCK_STEADY
  32. # define BOOST_CHRONO_HAS_THREAD_CLOCK
  33. # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
  34. # elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
  35. # define BOOST_CHRONO_MAC_API
  36. # define BOOST_CHRONO_HAS_CLOCK_STEADY
  37. # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
  38. # else
  39. # define BOOST_CHRONO_POSIX_API
  40. # endif
  41. # endif
  42. # if defined( BOOST_CHRONO_POSIX_API )
  43. # include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME
  44. # if defined(CLOCK_REALTIME)
  45. # if defined(CLOCK_MONOTONIC)
  46. # define BOOST_CHRONO_HAS_CLOCK_STEADY
  47. # endif
  48. # else
  49. # error <time.h> does not supply CLOCK_REALTIME
  50. # endif
  51. # if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS)
  52. # define BOOST_CHRONO_HAS_THREAD_CLOCK
  53. # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
  54. # endif
  55. # if defined(CLOCK_THREAD_CPUTIME_ID) && !defined(BOOST_DISABLE_THREADS)
  56. # define BOOST_CHRONO_HAS_THREAD_CLOCK
  57. # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
  58. # endif
  59. # endif
  60. #if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
  61. #undef BOOST_CHRONO_HAS_THREAD_CLOCK
  62. #undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
  63. #endif
  64. // unicode support ------------------------------//
  65. #if defined(BOOST_NO_UNICODE_LITERALS) || defined(BOOST_NO_CHAR16_T) || defined(BOOST_NO_CHAR32_T)
  66. //~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT
  67. #else
  68. #define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1
  69. #endif
  70. // define constexpr related macros ------------------------------//
  71. #if defined(BOOST_NO_CONSTEXPR)
  72. #define BOOST_CHRONO_CONSTEXPR
  73. #define BOOST_CHRONO_CONSTEXPR_OR_CONST const
  74. #define BOOST_CHRONO_CONST_REF const&
  75. #else
  76. #define BOOST_CHRONO_CONSTEXPR constexpr
  77. #define BOOST_CHRONO_CONSTEXPR_OR_CONST constexpr
  78. #define BOOST_CHRONO_CONST_REF
  79. #endif
  80. #define BOOST_CHRONO_STATIC_CONSTEXPR static BOOST_CHRONO_CONSTEXPR_OR_CONST
  81. #ifdef BOOST_CHRONO_HEADER_ONLY
  82. #define BOOST_CHRONO_INLINE inline
  83. #define BOOST_CHRONO_STATIC
  84. #define BOOST_CHRONO_DECL
  85. #else
  86. #define BOOST_CHRONO_INLINE
  87. #define BOOST_CHRONO_STATIC static
  88. // enable dynamic linking on Windows ---------------------------------------//
  89. #ifdef BOOST_HAS_DECLSPEC // defined by boost.config
  90. // we need to import/export our code only if the user has specifically
  91. // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
  92. // libraries to be dynamically linked, or BOOST_CHRONO_DYN_LINK
  93. // if they want just this one to be dynamically liked:
  94. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK)
  95. // export if this is our own source, otherwise import:
  96. #ifdef BOOST_CHRONO_SOURCE
  97. # define BOOST_CHRONO_DECL __declspec(dllexport)
  98. #else
  99. # define BOOST_CHRONO_DECL __declspec(dllimport)
  100. #endif // BOOST_CHRONO_SOURCE
  101. #endif // DYN_LINK
  102. #endif // BOOST_HAS_DECLSPEC
  103. //
  104. // if BOOST_CHRONO_DECL isn't defined yet define it now:
  105. #ifndef BOOST_CHRONO_DECL
  106. #define BOOST_CHRONO_DECL
  107. #endif
  108. // enable automatic library variant selection ------------------------------//
  109. #if !defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_CHRONO_NO_LIB)
  110. //
  111. // Set the name of our library; this will get undef'ed by auto_link.hpp
  112. // once it's done with it:
  113. //
  114. #define BOOST_LIB_NAME boost_chrono
  115. //
  116. // If we're importing code from a dll, then tell auto_link.hpp about it:
  117. //
  118. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK)
  119. # define BOOST_DYN_LINK
  120. #endif
  121. //
  122. // And include the header that does the work:
  123. //
  124. #include <boost/config/auto_link.hpp>
  125. #endif // auto-linking disabled
  126. #endif // BOOST_CHRONO_HEADER_ONLY
  127. #endif // BOOST_CHRONO_CONFIG_HPP