1 | #ifndef DATE_TIME_COMPILER_CONFIG_HPP___ |
2 | #define DATE_TIME_COMPILER_CONFIG_HPP___ |
3 | |
4 | /* Copyright (c) 2002-2004 CrystalClear Software, Inc. |
5 | * Subject to the Boost Software License, Version 1.0. (See accompanying |
6 | * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) |
7 | * Author: Jeff Garland, Bart Garst |
8 | * $Date$ |
9 | */ |
10 | |
11 | #include <cstdlib> |
12 | #include <boost/config.hpp> |
13 | #include <boost/detail/workaround.hpp> |
14 | |
15 | |
16 | // This file performs some local compiler configurations |
17 | |
18 | #include <boost/date_time/locale_config.hpp> //set up locale configurations |
19 | |
20 | //Set up a configuration parameter for platforms that have |
21 | //GetTimeOfDay |
22 | #if defined(BOOST_HAS_GETTIMEOFDAY) || defined(BOOST_HAS_FTIME) |
23 | #define BOOST_DATE_TIME_HAS_HIGH_PRECISION_CLOCK |
24 | #endif |
25 | |
26 | // To Force no default constructors for date & ptime, un-comment following |
27 | //#define DATE_TIME_NO_DEFAULT_CONSTRUCTOR |
28 | |
29 | // Include extensions to date_duration - comment out to remove this feature |
30 | #define BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES |
31 | // these extensions are known to cause problems with gcc295 |
32 | #if defined(__GNUC__) && (__GNUC__ < 3) |
33 | #undef BOOST_DATE_TIME_OPTIONAL_GREGORIAN_TYPES |
34 | #endif |
35 | |
36 | #if (defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) || BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) ) ) |
37 | #define BOOST_DATE_TIME_NO_MEMBER_INIT |
38 | #endif |
39 | |
40 | // include these types before we try to re-define them |
41 | #include <boost/cstdint.hpp> |
42 | |
43 | //Define INT64_C for compilers that don't have it |
44 | #if (!defined(INT64_C)) |
45 | #define INT64_C(value) int64_t(value) |
46 | #endif |
47 | |
48 | |
49 | /* Workaround for Borland iterator error. Error was "Cannot convert 'istream *' to 'wistream *' in function istream_iterator<>::istream_iterator() */ |
50 | #if defined(BOOST_BORLANDC) && defined(BOOST_BCB_WITH_RW_LIB) |
51 | #define BOOST_DATE_TIME_NO_WISTREAM_ITERATOR |
52 | #endif |
53 | |
54 | |
55 | // Borland v5.64 does not have the following in std namespace; v5.5.1 does |
56 | #if defined(BOOST_BORLANDC) && defined(BOOST_BCB_WITH_STLPORT) |
57 | #include <locale> |
58 | namespace std { |
59 | using stlport::tolower; |
60 | using stlport::ctype; |
61 | using stlport::use_facet; |
62 | } |
63 | #endif |
64 | |
65 | // workaround for errors associated with output for date classes |
66 | // modifications and input streaming for time classes. |
67 | // Compilers affected are: |
68 | // gcc295, msvc (neither with STLPort), any borland |
69 | // |
70 | #if (((defined(__GNUC__) && (__GNUC__ < 3)) || \ |
71 | (defined(_MSC_VER) && (_MSC_VER < 1300)) ) && \ |
72 | !defined(_STLP_OWN_IOSTREAMS) ) || \ |
73 | BOOST_WORKAROUND( BOOST_BORLANDC, BOOST_TESTED_AT(0x581) ) |
74 | #define BOOST_DATE_TIME_INCLUDE_LIMITED_HEADERS |
75 | #endif |
76 | |
77 | // The macro marks up places where compiler complains for missing return statement or |
78 | // uninitialized variables after calling to boost::throw_exception. |
79 | // BOOST_UNREACHABLE_RETURN doesn't work since even compilers that support |
80 | // unreachable statements detection emit such warnings. |
81 | #if defined(_MSC_VER) |
82 | // Use special MSVC extension to markup unreachable code |
83 | # define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) __assume(false) |
84 | #elif !defined(BOOST_NO_UNREACHABLE_RETURN_DETECTION) |
85 | // Call to a non-returning function should suppress the warning |
86 | # if defined(BOOST_NO_STDC_NAMESPACE) |
87 | namespace std { |
88 | using ::abort; |
89 | } |
90 | # endif // defined(BOOST_NO_STDC_NAMESPACE) |
91 | # define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) std::abort() |
92 | #else |
93 | // For other poor compilers the specified expression is compiled. Usually, this would be a return statement. |
94 | # define BOOST_DATE_TIME_UNREACHABLE_EXPRESSION(x) x |
95 | #endif |
96 | |
97 | /* The following handles the definition of the necessary macros |
98 | * for dll building on Win32 platforms. |
99 | * |
100 | * For code that will be placed in the date_time .dll, |
101 | * it must be properly prefixed with BOOST_DATE_TIME_DECL. |
102 | * The corresponding .cpp file must have BOOST_DATE_TIME_SOURCE |
103 | * defined before including its header. For examples see: |
104 | * greg_month.hpp & greg_month.cpp |
105 | * |
106 | */ |
107 | |
108 | // we need to import/export our code only if the user has specifically |
109 | // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost |
110 | // libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK |
111 | // if they want just this one to be dynamically liked: |
112 | #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK) |
113 | // export if this is our own source, otherwise import: |
114 | # ifdef BOOST_DATE_TIME_SOURCE |
115 | # define BOOST_DATE_TIME_DECL BOOST_SYMBOL_EXPORT |
116 | # else |
117 | # define BOOST_DATE_TIME_DECL BOOST_SYMBOL_IMPORT |
118 | # endif // BOOST_DATE_TIME_SOURCE |
119 | #endif // DYN_LINK |
120 | // |
121 | // if BOOST_WHATEVER_DECL isn't defined yet define it now: |
122 | #ifndef BOOST_DATE_TIME_DECL |
123 | # define BOOST_DATE_TIME_DECL |
124 | #endif |
125 | |
126 | // |
127 | // Automatically link to the correct build variant where possible. |
128 | // |
129 | #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_DATE_TIME_NO_LIB) && !defined(BOOST_DATE_TIME_SOURCE) |
130 | // |
131 | // Set the name of our library, this will get undef'ed by auto_link.hpp |
132 | // once it's done with it: |
133 | // |
134 | #define BOOST_LIB_NAME boost_date_time |
135 | // |
136 | // If we're importing code from a dll, then tell auto_link.hpp about it: |
137 | // |
138 | #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK) |
139 | # define BOOST_DYN_LINK |
140 | #endif |
141 | // |
142 | // And include the header that does the work: |
143 | // |
144 | #include <boost/config/auto_link.hpp> |
145 | #endif // auto-linking disabled |
146 | |
147 | #if defined(BOOST_HAS_THREADS) |
148 | # if defined(_MSC_VER) || defined(__MWERKS__) || defined(__MINGW32__) || defined(__BORLANDC__) |
149 | //no reentrant posix functions (eg: localtime_r) |
150 | # elif (!defined(__hpux) || (defined(__hpux) && defined(_REENTRANT))) |
151 | # define BOOST_DATE_TIME_HAS_REENTRANT_STD_FUNCTIONS |
152 | # endif |
153 | #endif |
154 | |
155 | #if defined(BOOST_NO_CXX11_NULLPTR) |
156 | # define BOOST_DATE_TIME_NULLPTR 0 |
157 | #else |
158 | # define BOOST_DATE_TIME_NULLPTR nullptr |
159 | #endif |
160 | |
161 | #endif |
162 | |