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