config.hpp 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. // boost/chrono/config.hpp -------------------------------------------------//
  2. // Copyright Beman Dawes 2003, 2006, 2008
  3. // Copyright 2009-2011 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_VERSION
  11. #define BOOST_CHRONO_VERSION 1
  12. #else
  13. #if BOOST_CHRONO_VERSION!=1 && BOOST_CHRONO_VERSION!=2
  14. #error "BOOST_CHRONO_VERSION must be 1 or 2"
  15. #endif
  16. #endif
  17. #if defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_USE_WINDOWS_H)
  18. #define BOOST_USE_WINDOWS_H
  19. #endif
  20. #if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \
  21. && ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
  22. # define BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
  23. #endif
  24. // BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API
  25. // can be defined by the user to specify which API should be used
  26. #if defined(BOOST_CHRONO_WINDOWS_API)
  27. # warning Boost.Chrono will use the Windows API
  28. #elif defined(BOOST_CHRONO_MAC_API)
  29. # warning Boost.Chrono will use the Mac API
  30. #elif defined(BOOST_CHRONO_POSIX_API)
  31. # warning Boost.Chrono will use the POSIX API
  32. #endif
  33. # if defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_POSIX_API )
  34. # error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_POSIX_API are defined
  35. # elif defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_MAC_API )
  36. # error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_MAC_API are defined
  37. # elif defined( BOOST_CHRONO_MAC_API ) && defined( BOOST_CHRONO_POSIX_API )
  38. # error both BOOST_CHRONO_MAC_API and BOOST_CHRONO_POSIX_API are defined
  39. # elif !defined( BOOST_CHRONO_WINDOWS_API ) && !defined( BOOST_CHRONO_MAC_API ) && !defined( BOOST_CHRONO_POSIX_API )
  40. # if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
  41. # define BOOST_CHRONO_WINDOWS_API
  42. # elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
  43. # define BOOST_CHRONO_MAC_API
  44. # else
  45. # define BOOST_CHRONO_POSIX_API
  46. # endif
  47. # endif
  48. # if defined( BOOST_CHRONO_WINDOWS_API )
  49. # ifndef UNDER_CE
  50. # define BOOST_CHRONO_HAS_PROCESS_CLOCKS
  51. # endif
  52. # define BOOST_CHRONO_HAS_CLOCK_STEADY
  53. # define BOOST_CHRONO_HAS_THREAD_CLOCK
  54. # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
  55. # endif
  56. # if defined( BOOST_CHRONO_MAC_API )
  57. # define BOOST_CHRONO_HAS_PROCESS_CLOCKS
  58. # define BOOST_CHRONO_HAS_CLOCK_STEADY
  59. # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
  60. # endif
  61. # if defined( BOOST_CHRONO_POSIX_API )
  62. # define BOOST_CHRONO_HAS_PROCESS_CLOCKS
  63. # include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME
  64. # if defined(CLOCK_MONOTONIC)
  65. # define BOOST_CHRONO_HAS_CLOCK_STEADY
  66. # endif
  67. # if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS)
  68. # define BOOST_CHRONO_HAS_THREAD_CLOCK
  69. # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
  70. # endif
  71. # if defined(CLOCK_THREAD_CPUTIME_ID) && !defined(BOOST_DISABLE_THREADS)
  72. # define BOOST_CHRONO_HAS_THREAD_CLOCK
  73. # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true
  74. # endif
  75. # if defined(sun) || defined(__sun)
  76. # undef BOOST_CHRONO_HAS_THREAD_CLOCK
  77. # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
  78. # endif
  79. # if defined(__HP_aCC) && defined(__hpux)
  80. # undef BOOST_CHRONO_HAS_THREAD_CLOCK
  81. # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
  82. # endif
  83. # if defined(__VXWORKS__)
  84. # undef BOOST_CHRONO_HAS_PROCESS_CLOCKS
  85. # endif
  86. # endif
  87. #if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
  88. #undef BOOST_CHRONO_HAS_THREAD_CLOCK
  89. #undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
  90. #endif
  91. //#undef BOOST_CHRONO_HAS_PROCESS_CLOCKS
  92. // unicode support ------------------------------//
  93. #if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T)
  94. //~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT
  95. #else
  96. #define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1
  97. #endif
  98. #if ! defined BOOST_NOEXCEPT
  99. #if defined(BOOST_NO_CXX11_NOEXCEPT)
  100. #define BOOST_NOEXCEPT
  101. #else
  102. #define BOOST_NOEXCEPT noexcept
  103. #endif
  104. #endif
  105. #if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
  106. #define BOOST_CHRONO_LIB_CONSTEXPR
  107. #elif defined(_LIBCPP_VERSION) && !defined(_LIBCPP_CONSTEXPR)
  108. #define BOOST_CHRONO_LIB_CONSTEXPR
  109. #else
  110. #define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR
  111. #endif
  112. #if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
  113. # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw()
  114. #else
  115. #ifdef BOOST_NO_CXX11_NOEXCEPT
  116. # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw()
  117. #else
  118. # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept
  119. #endif
  120. #endif
  121. #if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \
  122. && defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
  123. #error "BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING && BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING defined"
  124. #endif
  125. #if defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \
  126. && defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
  127. #error "BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 && BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 defined"
  128. #endif
  129. #if ! defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \
  130. && ! defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
  131. #define BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING
  132. #endif
  133. #if (BOOST_CHRONO_VERSION == 2)
  134. #if ! defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \
  135. && ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
  136. #define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0
  137. #endif
  138. #endif
  139. #ifdef BOOST_CHRONO_HEADER_ONLY
  140. #define BOOST_CHRONO_INLINE inline
  141. #define BOOST_CHRONO_STATIC inline
  142. #define BOOST_CHRONO_DECL
  143. #else
  144. #define BOOST_CHRONO_INLINE
  145. #define BOOST_CHRONO_STATIC static
  146. // enable dynamic linking on Windows ---------------------------------------//
  147. // we need to import/export our code only if the user has specifically
  148. // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
  149. // libraries to be dynamically linked, or BOOST_CHRONO_DYN_LINK
  150. // if they want just this one to be dynamically liked:
  151. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK)
  152. // export if this is our own source, otherwise import:
  153. #ifdef BOOST_CHRONO_SOURCE
  154. # define BOOST_CHRONO_DECL BOOST_SYMBOL_EXPORT
  155. #else
  156. # define BOOST_CHRONO_DECL BOOST_SYMBOL_IMPORT
  157. #endif // BOOST_CHRONO_SOURCE
  158. #endif // DYN_LINK
  159. //
  160. // if BOOST_CHRONO_DECL isn't defined yet define it now:
  161. #ifndef BOOST_CHRONO_DECL
  162. #define BOOST_CHRONO_DECL
  163. #endif
  164. // enable automatic library variant selection ------------------------------//
  165. #if !defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_CHRONO_NO_LIB)
  166. //
  167. // Set the name of our library; this will get undef'ed by auto_link.hpp
  168. // once it's done with it:
  169. //
  170. #define BOOST_LIB_NAME boost_chrono
  171. //
  172. // If we're importing code from a dll, then tell auto_link.hpp about it:
  173. //
  174. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK)
  175. # define BOOST_DYN_LINK
  176. #endif
  177. //
  178. // And include the header that does the work:
  179. //
  180. #include <boost/config/auto_link.hpp>
  181. #endif // auto-linking disabled
  182. #endif // BOOST_CHRONO_HEADER_ONLY
  183. #endif // BOOST_CHRONO_CONFIG_HPP