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