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