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 // look for long long by looking for the appropriate macros in <limits.h>.
22 // Note that we use limits.h rather than climits for maximal portability,
23 // remember that since these just declare a bunch of macros, there should be
24 // no namespace issues from this.
27 # if !defined(BOOST_HAS_LONG_LONG) \
28 && !(defined(BOOST_MSVC) && BOOST_MSVC <=1300) && !defined(__BORLANDC__) \
29 && (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
30 # define BOOST_HAS_LONG_LONG
32 #if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_INTEGRAL_INT64_T)
33 # define BOOST_NO_INTEGRAL_INT64_T
36 // GCC 3.x will clean up all of those nasty macro definitions that
37 // BOOST_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine
39 #if defined(__GNUC__) && (__GNUC__ >= 3) && defined(BOOST_NO_CTYPE_FUNCTIONS)
40 # undef BOOST_NO_CTYPE_FUNCTIONS
45 // Assume any extensions are in namespace std:: unless stated otherwise:
47 # ifndef BOOST_STD_EXTENSION_NAMESPACE
48 # define BOOST_STD_EXTENSION_NAMESPACE std
52 // If cv-qualified specializations are not allowed, then neither are cv-void ones:
54 # if defined(BOOST_NO_CV_SPECIALIZATIONS) \
55 && !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)
56 # define BOOST_NO_CV_VOID_SPECIALIZATIONS
60 // If there is no numeric_limits template, then it can't have any compile time
63 # if defined(BOOST_NO_LIMITS) \
64 && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS)
65 # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
66 # define BOOST_NO_MS_INT64_NUMERIC_LIMITS
67 # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS
71 // if there is no long long then there is no specialisation
72 // for numeric_limits<long long> either:
74 #if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)
75 # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS
79 // if there is no __int64 then there is no specialisation
80 // for numeric_limits<__int64> either:
82 #if !defined(BOOST_HAS_MS_INT64) && !defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS)
83 # define BOOST_NO_MS_INT64_NUMERIC_LIMITS
87 // if member templates are supported then so is the
88 // VC6 subset of member templates:
90 # if !defined(BOOST_NO_MEMBER_TEMPLATES) \
91 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
92 # define BOOST_MSVC6_MEMBER_TEMPLATES
96 // Without partial specialization, can't test for partial specialisation bugs:
98 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
99 && !defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG)
100 # define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
104 // Without partial specialization, std::iterator_traits can't work:
106 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
107 && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
108 # define BOOST_NO_STD_ITERATOR_TRAITS
112 // Without member template support, we can't have template constructors
113 // in the standard library either:
115 # if defined(BOOST_NO_MEMBER_TEMPLATES) \
116 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \
117 && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
118 # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
122 // Without member template support, we can't have a conforming
123 // std::allocator template either:
125 # if defined(BOOST_NO_MEMBER_TEMPLATES) \
126 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \
127 && !defined(BOOST_NO_STD_ALLOCATOR)
128 # define BOOST_NO_STD_ALLOCATOR
132 // If we have a standard allocator, then we have a partial one as well:
134 #if !defined(BOOST_NO_STD_ALLOCATOR)
135 # define BOOST_HAS_PARTIAL_STD_ALLOCATOR
139 // We can't have a working std::use_facet if there is no std::locale:
141 # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_USE_FACET)
142 # define BOOST_NO_STD_USE_FACET
146 // We can't have a std::messages facet if there is no std::locale:
148 # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_MESSAGES)
149 # define BOOST_NO_STD_MESSAGES
153 // We can't have a working std::wstreambuf if there is no std::locale:
155 # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF)
156 # define BOOST_NO_STD_WSTREAMBUF
160 // We can't have a <cwctype> if there is no <cwchar>:
162 # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_CWCTYPE)
163 # define BOOST_NO_CWCTYPE
167 // We can't have a swprintf if there is no <cwchar>:
169 # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_SWPRINTF)
170 # define BOOST_NO_SWPRINTF
174 // If Win32 support is turned off, then we must turn off
175 // threading support also, unless there is some other
176 // thread API enabled:
178 #if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \
179 && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS)
180 # define BOOST_DISABLE_THREADS
184 // Turn on threading support if the compiler thinks that it's in
185 // multithreaded mode. We put this here because there are only a
186 // limited number of macros that identify this (if there's any missing
187 // from here then add to the appropriate compiler section):
189 #if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \
190 || defined(_PTHREADS)) && !defined(BOOST_HAS_THREADS)
191 # define BOOST_HAS_THREADS
195 // Turn threading support off if BOOST_DISABLE_THREADS is defined:
197 #if defined(BOOST_DISABLE_THREADS) && defined(BOOST_HAS_THREADS)
198 # undef BOOST_HAS_THREADS
202 // Turn threading support off if we don't recognise the threading API:
204 #if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\
205 && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS)\
206 && !defined(BOOST_HAS_MPTASKS)
207 # undef BOOST_HAS_THREADS
211 // If the compiler claims to be C99 conformant, then it had better
212 // have a <stdint.h>:
214 # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
215 # define BOOST_HAS_STDINT_H
219 // Define BOOST_NO_SLIST and BOOST_NO_HASH if required.
220 // Note that this is for backwards compatibility only.
222 # ifndef BOOST_HAS_SLIST
223 # define BOOST_NO_SLIST
226 # ifndef BOOST_HAS_HASH
227 # define BOOST_NO_HASH
230 // BOOST_NO_STDC_NAMESPACE workaround --------------------------------------//
231 // Because std::size_t usage is so common, even in boost headers which do not
232 // otherwise use the C library, the <cstddef> workaround is included here so
233 // that ugly workaround code need not appear in many other boost headers.
234 // NOTE WELL: This is a workaround for non-conforming compilers; <cstddef>
235 // must still be #included in the usual places so that <cstddef> inclusion
236 // works as expected with standard conforming compilers. The resulting
237 // double inclusion of <cstddef> is harmless.
239 # ifdef BOOST_NO_STDC_NAMESPACE
241 namespace std { using ::ptrdiff_t; using ::size_t; }
244 // BOOST_NO_STD_MIN_MAX workaround -----------------------------------------//
246 # ifdef BOOST_NO_STD_MIN_MAX
250 inline const _Tp& min(const _Tp& __a, const _Tp& __b) {
251 return __b < __a ? __b : __a;
254 inline const _Tp& max(const _Tp& __a, const _Tp& __b) {
255 return __a < __b ? __b : __a;
261 // BOOST_STATIC_CONSTANT workaround --------------------------------------- //
262 // On compilers which don't allow in-class initialization of static integral
263 // constant members, we must use enums as a workaround if we want the constants
264 // to be available at compile-time. This macro gives us a convenient way to
265 // declare such constants.
267 # ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
268 # define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment }
270 # define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
273 // BOOST_USE_FACET workaround ----------------------------------------------//
274 // When the standard library does not have a conforming std::use_facet there
275 // are various workarounds available, but they differ from library to library.
276 // This macro provides a consistent way to access a locale's facets.
279 // std::use_facet<Type>(loc);
281 // BOOST_USE_FACET(Type, loc);
282 // Note do not add a std:: prefix to the front of BOOST_USE_FACET!
284 #if defined(BOOST_NO_STD_USE_FACET)
285 # ifdef BOOST_HAS_TWO_ARG_USE_FACET
286 # define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast<Type*>(0))
287 # elif defined(BOOST_HAS_MACRO_USE_FACET)
288 # define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type)
289 # elif defined(BOOST_HAS_STLP_USE_FACET)
290 # define BOOST_USE_FACET(Type, loc) (*std::_Use_facet<Type >(loc))
293 # define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc)
296 // BOOST_NESTED_TEMPLATE workaround ------------------------------------------//
297 // Member templates are supported by some compilers even though they can't use
298 // the A::template member<U> syntax, as a workaround replace:
300 // typedef typename A::template rebind<U> binder;
304 // typedef typename A::BOOST_NESTED_TEMPLATE rebind<U> binder;
306 #ifndef BOOST_NO_MEMBER_TEMPLATE_KEYWORD
307 # define BOOST_NESTED_TEMPLATE template
309 # define BOOST_NESTED_TEMPLATE
312 // BOOST_UNREACHABLE_RETURN(x) workaround -------------------------------------//
313 // Normally evaluates to nothing, unless BOOST_NO_UNREACHABLE_RETURN_DETECTION
314 // is defined, in which case it evaluates to return x; Use when you have a return
315 // statement that can never be reached.
317 #ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION
318 # define BOOST_UNREACHABLE_RETURN(x) return x;
320 # define BOOST_UNREACHABLE_RETURN(x)
323 // BOOST_DEDUCED_TYPENAME workaround ------------------------------------------//
325 // Some compilers don't support the use of `typename' for dependent
326 // types in deduced contexts, e.g.
328 // template <class T> void f(T, typename T::type);
330 // Replace these declarations with:
332 // template <class T> void f(T, BOOST_DEDUCED_TYPENAME T::type);
334 #ifndef BOOST_NO_DEDUCED_TYPENAME
335 # define BOOST_DEDUCED_TYPENAME typename
337 # define BOOST_DEDUCED_TYPENAME
340 // ---------------------------------------------------------------------------//
343 // Helper macro BOOST_STRINGIZE:
344 // Converts the parameter X to a string after macro replacement
345 // on X has been performed.
347 #define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
348 #define BOOST_DO_STRINGIZE(X) #X
351 // Helper macro BOOST_JOIN:
352 // The following piece of macro magic joins the two
353 // arguments together, even when one of the arguments is
354 // itself a macro (see 16.3.1 in C++ standard). The key
355 // is that macro expansion of macro arguments does not
356 // occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN.
358 #define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
359 #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
360 #define BOOST_DO_JOIN2( X, Y ) X##Y
363 // Set some default values for compiler/library/platform names.
364 // These are for debugging config setup only:
366 # ifndef BOOST_COMPILER
367 # define BOOST_COMPILER "Unknown ISO C++ Compiler"
369 # ifndef BOOST_STDLIB
370 # define BOOST_STDLIB "Unknown ISO standard library"
372 # ifndef BOOST_PLATFORM
373 # if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \
374 || defined(_POSIX_SOURCE)
375 # define BOOST_PLATFORM "Generic Unix"
377 # define BOOST_PLATFORM "Unknown"