config.hpp 7.3 KB

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