1 // Boost config.hpp configuration header file ------------------------------//
3 // (C) Copyright Boost.org 2001. Permission to copy, use, modify, sell and
4 // distribute this software is granted provided this copyright notice appears
5 // in all copies. This software is provided "as is" without express or implied
6 // warranty, and with no claim as to its suitability for any purpose.
8 // See http://www.boost.org for most recent version.
10 // Boost config.hpp policy and rationale documentation has been moved to
11 // http://www.boost.org/libs/config
13 // This file is intended to be stable, and relatively unchanging.
14 // It should contain boilerplate code only - no compiler specific
15 // code unless it is unavoidable - no changes unless unavoidable.
17 #ifndef BOOST_CONFIG_SUFFIX_HPP
18 #define BOOST_CONFIG_SUFFIX_HPP
21 # define BOOST_DECL // default for compilers not needing this decoration.
25 // look for long long by looking for the appropriate macros in <limits.h>.
26 // Note that we use limits.h rather than climits for maximal portability,
27 // remember that since these just declare a bunch of macros, there should be
28 // no namespace issues from this.
31 # if !defined(BOOST_MSVC) && !defined(__BORLANDC__) \
32 && (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
33 # define BOOST_HAS_LONG_LONG
35 #if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_INTEGRAL_INT64_T)
36 # define BOOST_NO_INTEGRAL_INT64_T
39 // GCC 3.x will clean up all of those nasty macro definitions that
40 // BOOST_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine
42 #if defined(__GNUC__) && (__GNUC__ >= 3) && defined(BOOST_NO_CTYPE_FUNCTIONS)
43 # undef BOOST_NO_CTYPE_FUNCTIONS
48 // Assume any extensions are in namespace std:: unless stated otherwise:
50 # ifndef BOOST_STD_EXTENSION_NAMESPACE
51 # define BOOST_STD_EXTENSION_NAMESPACE std
55 // If cv-qualified specializations are not allowed, then neither are cv-void ones:
57 # if defined(BOOST_NO_CV_SPECIALIZATIONS) \
58 && !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)
59 # define BOOST_NO_CV_VOID_SPECIALIZATIONS
63 // If there is no numeric_limits template, then it can't have any compile time
66 # if defined(BOOST_NO_LIMITS) \
67 && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS)
68 # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
72 // if member templates are supported then so is the
73 // VC6 subset of member templates:
75 # if !defined(BOOST_NO_MEMBER_TEMPLATES) \
76 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
77 # define BOOST_MSVC6_MEMBER_TEMPLATES
81 // Without partial specialization, can't test for partial specialisation bugs:
83 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
84 && !defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG)
85 # define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
89 // Without partial specialization, std::iterator_traits can't work:
91 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
92 && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
93 # define BOOST_NO_STD_ITERATOR_TRAITS
97 // Without member template support, we can't have template constructors
98 // in the standard library either:
100 # if defined(BOOST_NO_MEMBER_TEMPLATES) \
101 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \
102 && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
103 # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
107 // Without member template support, we can't have a conforming
108 // std::allocator template either:
110 # if defined(BOOST_NO_MEMBER_TEMPLATES) \
111 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \
112 && !defined(BOOST_NO_STD_ALLOCATOR)
113 # define BOOST_NO_STD_ALLOCATOR
117 // We can't have a working std::use_facet if there is no std::locale:
119 # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_USE_FACET)
120 # define BOOST_NO_STD_USE_FACET
124 // We can't have a std::messages facet if there is no std::locale:
126 # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_MESSAGES)
127 # define BOOST_NO_STD_MESSAGES
131 // We can't have a <cwctype> if there is no <cwchar>:
133 # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_CWCTYPE)
134 # define BOOST_NO_CWCTYPE
138 // We can't have a swprintf if there is no <cwchar>:
140 # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_SWPRINTF)
141 # define BOOST_NO_SWPRINTF
145 // If Win32 support is turned off, then we must turn off
146 // threading support also, unless there is some other
147 // thread API enabled:
149 #if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \
150 && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS)
151 # define BOOST_DISABLE_THREADS
155 // Turn on threading support if the compiler thinks that it's in
156 // multithreaded mode. We put this here because there are only a
157 // limited number of macros that identify this (if there's any missing
158 // from here then add to the appropriate compiler section):
160 #if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \
161 || defined(_PTHREADS)) && !defined(BOOST_HAS_THREADS)
162 # define BOOST_HAS_THREADS
166 // Turn threading support off if BOOST_DISABLE_THREADS is defined:
168 #if defined(BOOST_DISABLE_THREADS) && defined(BOOST_HAS_THREADS)
169 # undef BOOST_HAS_THREADS
173 // Turn threading support off if we don't recognise the threading API:
175 #if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\
176 && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS)\
177 && !defined(BOOST_HAS_MPTASKS)
178 # undef BOOST_HAS_THREADS
182 // If the compiler claims to be C99 conformant, then it had better
183 // have a <stdint.h>:
185 # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
186 # define BOOST_HAS_STDINT_H
190 // Define BOOST_NO_SLIST and BOOST_NO_HASH if required.
191 // Note that this is for backwards compatibility only.
193 # ifndef BOOST_HAS_SLIST
194 # define BOOST_NO_SLIST
197 # ifndef BOOST_HAS_HASH
198 # define BOOST_NO_HASH
201 // BOOST_NO_STDC_NAMESPACE workaround --------------------------------------//
202 // Because std::size_t usage is so common, even in boost headers which do not
203 // otherwise use the C library, the <cstddef> workaround is included here so
204 // that ugly workaround code need not appear in many other boost headers.
205 // NOTE WELL: This is a workaround for non-conforming compilers; <cstddef>
206 // must still be #included in the usual places so that <cstddef> inclusion
207 // works as expected with standard conforming compilers. The resulting
208 // double inclusion of <cstddef> is harmless.
210 # ifdef BOOST_NO_STDC_NAMESPACE
212 namespace std { using ::ptrdiff_t; using ::size_t; }
215 // BOOST_NO_STD_MIN_MAX workaround -----------------------------------------//
217 # ifdef BOOST_NO_STD_MIN_MAX
221 inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
222 return __b < __a ? __b : __a;
225 inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
226 return __a < __b ? __b : __a;
229 // Apparently, something in the Microsoft libraries requires the "long"
230 // overload, because it calls the min/max functions with arguments of
231 // slightly different type. (If this proves to be incorrect, this
232 // whole "BOOST_MSVC" section can be removed.)
233 inline long min(long __a, long __b) {
234 return __b < __a ? __b : __a;
236 inline long max(long __a, long __b) {
237 return __a < __b ? __b : __a;
239 // The "long double" overload is required, otherwise user code calling
240 // min/max for floating-point numbers will use the "long" overload.
241 // (SourceForge bug #495495)
242 inline long double min(long double __a, long double __b) {
243 return __b < __a ? __b : __a;
245 inline long double max(long double __a, long double __b) {
246 return __a < __b ? __b : __a;
253 // BOOST_STATIC_CONSTANT workaround --------------------------------------- //
254 // On compilers which don't allow in-class initialization of static integral
255 // constant members, we must use enums as a workaround if we want the constants
256 // to be available at compile-time. This macro gives us a convenient way to
257 // declare such constants.
259 # ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
260 # define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment }
262 # define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
265 // BOOST_USE_FACET workaround ----------------------------------------------//
266 // When the standard library does not have a conforming std::use_facet there
267 // are various workarounds available, but they differ from library to library.
268 // This macro provides a consistent way to access a locale's facets.
271 // std::use_facet<Type>(loc);
273 // BOOST_USE_FACET(Type, loc);
274 // Note do not add a std:: prefix to the front of BOOST_USE_FACET!
276 #if defined(BOOST_NO_STD_USE_FACET)
277 # ifdef BOOST_HAS_TWO_ARG_USE_FACET
278 # define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast<Type*>(0))
279 # elif defined(BOOST_HAS_MACRO_USE_FACET)
280 # define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type)
281 # elif defined(BOOST_HAS_STLP_USE_FACET)
282 # define BOOST_USE_FACET(Type, loc) (*std::_Use_facet<Type >(loc))
285 # define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc)
288 // BOOST_NESTED_TEMPLATE workaround ------------------------------------------//
289 // Member templates are supported by some compilers even though they can't use
290 // the A::template member<U> syntax, as a workaround replace:
292 // typedef typename A::template rebind<U> binder;
296 // typedef typename A::BOOST_NESTED_TEMPLATE rebind<U> binder;
298 #ifndef BOOST_NO_MEMBER_TEMPLATE_KEYWORD
299 # define BOOST_NESTED_TEMPLATE template
301 # define BOOST_NESTED_TEMPLATE
304 // ---------------------------------------------------------------------------//
307 // Helper macro BOOST_STRINGIZE:
308 // Converts the parameter X to a string after macro replacement
309 // on X has been performed.
311 #define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
312 #define BOOST_DO_STRINGIZE(X) #X
315 // Helper macro BOOST_JOIN:
316 // The following piece of macro magic joins the two
317 // arguments together, even when one of the arguments is
318 // itself a macro (see 16.3.1 in C++ standard). The key
319 // is that macro expansion of macro arguments does not
320 // occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN.
322 #define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
323 #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
324 #define BOOST_DO_JOIN2( X, Y ) X##Y
327 // Set some default values for compiler/library/platform names.
328 // These are for debugging config setup only:
330 # ifndef BOOST_COMPILER
331 # define BOOST_COMPILER "Unknown ISO C++ Compiler"
333 # ifndef BOOST_STDLIB
334 # define BOOST_STDLIB "Unknown ISO standard library"
336 # ifndef BOOST_PLATFORM
337 # if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \
338 || defined(_POSIX_SOURCE)
339 # define BOOST_PLATFORM "Generic Unix"
341 # define BOOST_PLATFORM "Unknown"