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

source code of boost/libs/chrono/include/boost/chrono/config.hpp