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