Chris@16: // boost/chrono/config.hpp -------------------------------------------------// Chris@16: Chris@16: // Copyright Beman Dawes 2003, 2006, 2008 Chris@16: // Copyright 2009-2011 Vicente J. Botet Escriba Chris@101: // Copyright (c) Microsoft Corporation 2014 Chris@16: Chris@16: // Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: // See http://www.boost.org/libs/chrono for documentation. Chris@16: Chris@16: #ifndef BOOST_CHRONO_CONFIG_HPP Chris@16: #define BOOST_CHRONO_CONFIG_HPP Chris@16: Chris@16: #include Chris@101: #include Chris@16: Chris@16: #if !defined BOOST_CHRONO_VERSION Chris@16: #define BOOST_CHRONO_VERSION 1 Chris@16: #else Chris@16: #if BOOST_CHRONO_VERSION!=1 && BOOST_CHRONO_VERSION!=2 Chris@16: #error "BOOST_CHRONO_VERSION must be 1 or 2" Chris@16: #endif Chris@16: #endif Chris@16: Chris@16: #if defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_USE_WINDOWS_H) Chris@16: #define BOOST_USE_WINDOWS_H Chris@16: #endif Chris@16: Chris@16: #if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \ Chris@16: && ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT Chris@16: Chris@16: # define BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT Chris@16: Chris@16: #endif Chris@16: Chris@16: // BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API Chris@16: // can be defined by the user to specify which API should be used Chris@16: Chris@16: #if defined(BOOST_CHRONO_WINDOWS_API) Chris@16: # warning Boost.Chrono will use the Windows API Chris@16: #elif defined(BOOST_CHRONO_MAC_API) Chris@16: # warning Boost.Chrono will use the Mac API Chris@16: #elif defined(BOOST_CHRONO_POSIX_API) Chris@16: # warning Boost.Chrono will use the POSIX API Chris@16: #endif Chris@16: Chris@16: # if defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_POSIX_API ) Chris@16: # error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_POSIX_API are defined Chris@16: # elif defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_MAC_API ) Chris@16: # error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_MAC_API are defined Chris@16: # elif defined( BOOST_CHRONO_MAC_API ) && defined( BOOST_CHRONO_POSIX_API ) Chris@16: # error both BOOST_CHRONO_MAC_API and BOOST_CHRONO_POSIX_API are defined Chris@16: # elif !defined( BOOST_CHRONO_WINDOWS_API ) && !defined( BOOST_CHRONO_MAC_API ) && !defined( BOOST_CHRONO_POSIX_API ) Chris@16: # if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) Chris@16: # define BOOST_CHRONO_WINDOWS_API Chris@16: # elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) Chris@16: # define BOOST_CHRONO_MAC_API Chris@16: # else Chris@16: # define BOOST_CHRONO_POSIX_API Chris@16: # endif Chris@16: # endif Chris@16: Chris@16: # if defined( BOOST_CHRONO_WINDOWS_API ) Chris@16: # ifndef UNDER_CE Chris@16: # define BOOST_CHRONO_HAS_PROCESS_CLOCKS Chris@16: # endif Chris@16: # define BOOST_CHRONO_HAS_CLOCK_STEADY Chris@101: # if BOOST_PLAT_WINDOWS_DESKTOP Chris@101: # define BOOST_CHRONO_HAS_THREAD_CLOCK Chris@101: # endif Chris@16: # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true Chris@16: # endif Chris@16: Chris@16: # if defined( BOOST_CHRONO_MAC_API ) Chris@16: # define BOOST_CHRONO_HAS_PROCESS_CLOCKS Chris@16: # define BOOST_CHRONO_HAS_CLOCK_STEADY Chris@101: # define BOOST_CHRONO_HAS_THREAD_CLOCK Chris@16: # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true Chris@16: # endif Chris@16: Chris@16: # if defined( BOOST_CHRONO_POSIX_API ) Chris@16: # define BOOST_CHRONO_HAS_PROCESS_CLOCKS Chris@16: # include //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME Chris@16: # if defined(CLOCK_MONOTONIC) Chris@16: # define BOOST_CHRONO_HAS_CLOCK_STEADY Chris@16: # endif Chris@16: # if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS) Chris@16: # define BOOST_CHRONO_HAS_THREAD_CLOCK Chris@16: # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true Chris@16: # endif Chris@16: # if defined(CLOCK_THREAD_CPUTIME_ID) && !defined(BOOST_DISABLE_THREADS) Chris@16: # define BOOST_CHRONO_HAS_THREAD_CLOCK Chris@16: # define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true Chris@16: # endif Chris@16: # if defined(sun) || defined(__sun) Chris@16: # undef BOOST_CHRONO_HAS_THREAD_CLOCK Chris@16: # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY Chris@16: # endif Chris@101: # if (defined(__HP_aCC) || defined(__GNUC__)) && defined(__hpux) Chris@16: # undef BOOST_CHRONO_HAS_THREAD_CLOCK Chris@16: # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY Chris@16: # endif Chris@16: # if defined(__VXWORKS__) Chris@16: # undef BOOST_CHRONO_HAS_PROCESS_CLOCKS Chris@16: # endif Chris@16: # endif Chris@16: Chris@16: #if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK) Chris@16: #undef BOOST_CHRONO_HAS_THREAD_CLOCK Chris@16: #undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY Chris@16: #endif Chris@16: Chris@16: // unicode support ------------------------------// Chris@16: Chris@16: #if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T) Chris@16: //~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT Chris@16: #else Chris@16: #define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1 Chris@16: #endif Chris@16: Chris@101: #ifndef BOOST_CHRONO_LIB_CONSTEXPR Chris@16: #if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) Chris@16: #define BOOST_CHRONO_LIB_CONSTEXPR Chris@16: #elif defined(_LIBCPP_VERSION) && !defined(_LIBCPP_CONSTEXPR) Chris@16: #define BOOST_CHRONO_LIB_CONSTEXPR Chris@16: #else Chris@16: #define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR Chris@16: #endif Chris@101: #endif Chris@16: Chris@16: #if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) Chris@16: # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() Chris@16: #else Chris@16: #ifdef BOOST_NO_CXX11_NOEXCEPT Chris@16: # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() Chris@16: #else Chris@16: # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept Chris@16: #endif Chris@16: #endif Chris@16: Chris@16: #if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ Chris@16: && defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING Chris@16: #error "BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING && BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING defined" Chris@16: #endif Chris@16: Chris@16: #if defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ Chris@16: && defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 Chris@16: #error "BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 && BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 defined" Chris@16: #endif Chris@16: Chris@16: #if ! defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ Chris@16: && ! defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING Chris@16: #define BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING Chris@16: #endif Chris@16: Chris@16: #if (BOOST_CHRONO_VERSION == 2) Chris@16: #if ! defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ Chris@16: && ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 Chris@16: #define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 Chris@16: #endif Chris@16: #endif Chris@16: Chris@16: #ifdef BOOST_CHRONO_HEADER_ONLY Chris@16: #define BOOST_CHRONO_INLINE inline Chris@16: #define BOOST_CHRONO_STATIC inline Chris@16: #define BOOST_CHRONO_DECL Chris@16: Chris@16: #else Chris@16: #define BOOST_CHRONO_INLINE Chris@16: #define BOOST_CHRONO_STATIC static Chris@16: Chris@16: // enable dynamic linking on Windows ---------------------------------------// Chris@16: Chris@16: // we need to import/export our code only if the user has specifically Chris@16: // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost Chris@16: // libraries to be dynamically linked, or BOOST_CHRONO_DYN_LINK Chris@16: // if they want just this one to be dynamically liked: Chris@16: #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK) Chris@16: // export if this is our own source, otherwise import: Chris@16: #ifdef BOOST_CHRONO_SOURCE Chris@16: # define BOOST_CHRONO_DECL BOOST_SYMBOL_EXPORT Chris@16: #else Chris@16: # define BOOST_CHRONO_DECL BOOST_SYMBOL_IMPORT Chris@16: #endif // BOOST_CHRONO_SOURCE Chris@16: #endif // DYN_LINK Chris@16: // Chris@16: // if BOOST_CHRONO_DECL isn't defined yet define it now: Chris@16: #ifndef BOOST_CHRONO_DECL Chris@16: #define BOOST_CHRONO_DECL Chris@16: #endif Chris@16: Chris@16: Chris@16: Chris@16: // enable automatic library variant selection ------------------------------// Chris@16: Chris@16: #if !defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_CHRONO_NO_LIB) Chris@16: // Chris@16: // Set the name of our library; this will get undef'ed by auto_link.hpp Chris@16: // once it's done with it: Chris@16: // Chris@16: #define BOOST_LIB_NAME boost_chrono Chris@16: // Chris@16: // If we're importing code from a dll, then tell auto_link.hpp about it: Chris@16: // Chris@16: #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK) Chris@16: # define BOOST_DYN_LINK Chris@16: #endif Chris@16: // Chris@16: // And include the header that does the work: Chris@16: // Chris@16: #include Chris@16: #endif // auto-linking disabled Chris@16: #endif // BOOST_CHRONO_HEADER_ONLY Chris@16: #endif // BOOST_CHRONO_CONFIG_HPP Chris@16: