config.hpp 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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_EX_CHRONO_CONFIG_HPP
  8. #define BOOST_EX_CHRONO_CONFIG_HPP
  9. #include <boost/config.hpp>
  10. // BOOST_EX_CHRONO_POSIX_API, BOOST_EX_CHRONO_MAC_API, or BOOST_EX_CHRONO_WINDOWS_API
  11. // can be defined by the user to specify which API should be used
  12. #if defined(BOOST_EX_CHRONO_WINDOWS_API)
  13. # warning Boost.Chrono will use the Windows API
  14. #elif defined(BOOST_EX_CHRONO_MAC_API)
  15. # warning Boost.Chrono will use the Mac API
  16. #elif defined(BOOST_EX_CHRONO_POSIX_API)
  17. # warning Boost.Chrono will use the POSIX API
  18. #endif
  19. # if defined( BOOST_EX_CHRONO_WINDOWS_API ) && defined( BOOST_EX_CHRONO_POSIX_API )
  20. # error both BOOST_EX_CHRONO_WINDOWS_API and BOOST_EX_CHRONO_POSIX_API are defined
  21. # elif defined( BOOST_EX_CHRONO_WINDOWS_API ) && defined( BOOST_EX_CHRONO_MAC_API )
  22. # error both BOOST_EX_CHRONO_WINDOWS_API and BOOST_EX_CHRONO_MAC_API are defined
  23. # elif defined( BOOST_EX_CHRONO_MAC_API ) && defined( BOOST_EX_CHRONO_POSIX_API )
  24. # error both BOOST_EX_CHRONO_MAC_API and BOOST_EX_CHRONO_POSIX_API are defined
  25. # elif !defined( BOOST_EX_CHRONO_WINDOWS_API ) && !defined( BOOST_EX_CHRONO_MAC_API ) && !defined( BOOST_EX_CHRONO_POSIX_API )
  26. # if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32))
  27. # define BOOST_EX_CHRONO_WINDOWS_API
  28. # define BOOST_EX_CHRONO_HAS_CLOCK_MONOTONIC
  29. # define BOOST_EX_CHRONO_HAS_THREAD_CLOCK
  30. # define BOOST_EX_CHRONO_THREAD_CLOCK_IS_MONOTONIC true
  31. # elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
  32. # define BOOST_EX_CHRONO_MAC_API
  33. # define BOOST_EX_CHRONO_HAS_CLOCK_MONOTONIC
  34. # define BOOST_EX_CHRONO_THREAD_CLOCK_IS_MONOTONIC true
  35. # else
  36. # define BOOST_EX_CHRONO_POSIX_API
  37. # endif
  38. # endif
  39. # if defined( BOOST_EX_CHRONO_POSIX_API )
  40. # include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME
  41. # if defined(CLOCK_REALTIME)
  42. # if defined(CLOCK_MONOTONIC)
  43. # define BOOST_EX_CHRONO_HAS_CLOCK_MONOTONIC
  44. # endif
  45. # else
  46. # error <time.h> does not supply CLOCK_REALTIME
  47. # endif
  48. # if defined(_POSIX_THREAD_CPUTIME)
  49. # define BOOST_EX_CHRONO_HAS_THREAD_CLOCK
  50. # define BOOST_EX_CHRONO_THREAD_CLOCK_IS_MONOTONIC true
  51. # endif
  52. # endif
  53. // enable dynamic linking on Windows ---------------------------------------//
  54. //# if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_EX_CHRONO_DYN_LINK)) && defined(__BORLANDC__) && defined(__WIN32__)
  55. //# error Dynamic linking Boost.System does not work for Borland; use static linking instead
  56. //# endif
  57. #ifdef BOOST_HAS_DECLSPEC // defined by boost.config
  58. // we need to import/export our code only if the user has specifically
  59. // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost
  60. // libraries to be dynamically linked, or BOOST_EX_CHRONO_DYN_LINK
  61. // if they want just this one to be dynamically liked:
  62. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_EX_CHRONO_DYN_LINK)
  63. // export if this is our own source, otherwise import:
  64. #ifdef BOOST_EX_CHRONO_SOURCE
  65. # define BOOST_EX_CHRONO_DECL __declspec(dllexport)
  66. #else
  67. # define BOOST_EX_CHRONO_DECL __declspec(dllimport)
  68. #endif // BOOST_EX_CHRONO_SOURCE
  69. #endif // DYN_LINK
  70. #endif // BOOST_HAS_DECLSPEC
  71. //
  72. // if BOOST_EX_CHRONO_DECL isn't defined yet define it now:
  73. #ifndef BOOST_EX_CHRONO_DECL
  74. #define BOOST_EX_CHRONO_DECL
  75. #endif
  76. // define constexpr related macros ------------------------------//
  77. //~ #include <boost/config.hpp>
  78. #if defined(BOOST_NO_CXX11_CONSTEXPR)
  79. #define BOOST_EX_CHRONO_CONSTEXPR
  80. #define BOOST_EX_CHRONO_CONST_REF const&
  81. #else
  82. #define BOOST_EX_CHRONO_CONSTEXPR constexpr
  83. #define BOOST_EX_CHRONO_CONST_REF
  84. #endif
  85. // enable automatic library variant selection ------------------------------//
  86. #if !defined(BOOST_EX_CHRONO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_EX_CHRONO_NO_LIB)
  87. //
  88. // Set the name of our library; this will get undef'ed by auto_link.hpp
  89. // once it's done with it:
  90. //
  91. #define BOOST_LIB_NAME boost_chrono
  92. //
  93. // If we're importing code from a dll, then tell auto_link.hpp about it:
  94. //
  95. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_EX_CHRONO_DYN_LINK)
  96. # define BOOST_DYN_LINK
  97. #endif
  98. //
  99. // And include the header that does the work:
  100. //
  101. #include <boost/config/auto_link.hpp>
  102. #endif // auto-linking disabled
  103. #endif // BOOST_EX_CHRONO_CONFIG_HPP