1 // Boost config.hpp configuration header file ------------------------------//
3 // Copyright (c) 2001-2003 John Maddock
4 // Copyright (c) 2001 Darin Adler
5 // Copyright (c) 2001 Peter Dimov
6 // Copyright (c) 2002 Bill Kempf
7 // Copyright (c) 2002 Jens Maurer
8 // Copyright (c) 2002-2003 David Abrahams
9 // Copyright (c) 2003 Gennaro Prota
10 // Copyright (c) 2003 Eric Friedman
11 // Copyright (c) 2010 Eric Jourdanneau, Joel Falcou
12 // Distributed under the Boost Software License, Version 1.0. (See
13 // accompanying file LICENSE_1_0.txt or copy at
14 // http://www.boost.org/LICENSE_1_0.txt)
16 // See http://www.boost.org/ for most recent version.
18 // Boost config.hpp policy and rationale documentation has been moved to
19 // http://www.boost.org/libs/config/
21 // This file is intended to be stable, and relatively unchanging.
22 // It should contain boilerplate code only - no compiler specific
23 // code unless it is unavoidable - no changes unless unavoidable.
25 #ifndef BOOST_CONFIG_SUFFIX_HPP
26 #define BOOST_CONFIG_SUFFIX_HPP
29 // ensure that visibility macros are always defined, thus symplifying use
31 #ifndef BOOST_SYMBOL_EXPORT
32 # define BOOST_SYMBOL_EXPORT
34 #ifndef BOOST_SYMBOL_IMPORT
35 # define BOOST_SYMBOL_IMPORT
37 #ifndef BOOST_SYMBOL_VISIBLE
38 # define BOOST_SYMBOL_VISIBLE
42 // look for long long by looking for the appropriate macros in <limits.h>.
43 // Note that we use limits.h rather than climits for maximal portability,
44 // remember that since these just declare a bunch of macros, there should be
45 // no namespace issues from this.
47 #if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG) \
48 && !defined(BOOST_MSVC) && !defined(__BORLANDC__)
50 # if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
51 # define BOOST_HAS_LONG_LONG
53 # define BOOST_NO_LONG_LONG
57 // GCC 3.x will clean up all of those nasty macro definitions that
58 // BOOST_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine
60 #if defined(__GNUC__) && (__GNUC__ >= 3) && defined(BOOST_NO_CTYPE_FUNCTIONS)
61 # undef BOOST_NO_CTYPE_FUNCTIONS
65 // Assume any extensions are in namespace std:: unless stated otherwise:
67 # ifndef BOOST_STD_EXTENSION_NAMESPACE
68 # define BOOST_STD_EXTENSION_NAMESPACE std
72 // If cv-qualified specializations are not allowed, then neither are cv-void ones:
74 # if defined(BOOST_NO_CV_SPECIALIZATIONS) \
75 && !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)
76 # define BOOST_NO_CV_VOID_SPECIALIZATIONS
80 // If there is no numeric_limits template, then it can't have any compile time
83 # if defined(BOOST_NO_LIMITS) \
84 && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS)
85 # define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
86 # define BOOST_NO_MS_INT64_NUMERIC_LIMITS
87 # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS
91 // if there is no long long then there is no specialisation
92 // for numeric_limits<long long> either:
94 #if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)
95 # define BOOST_NO_LONG_LONG_NUMERIC_LIMITS
99 // Normalize BOOST_NO_STATIC_ASSERT and (depricated) BOOST_HAS_STATIC_ASSERT:
101 #if !defined(BOOST_NO_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT)
102 # define BOOST_HAS_STATIC_ASSERT
106 // if there is no __int64 then there is no specialisation
107 // for numeric_limits<__int64> either:
109 #if !defined(BOOST_HAS_MS_INT64) && !defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS)
110 # define BOOST_NO_MS_INT64_NUMERIC_LIMITS
114 // if member templates are supported then so is the
115 // VC6 subset of member templates:
117 # if !defined(BOOST_NO_MEMBER_TEMPLATES) \
118 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
119 # define BOOST_MSVC6_MEMBER_TEMPLATES
123 // Without partial specialization, can't test for partial specialisation bugs:
125 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
126 && !defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG)
127 # define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
131 // Without partial specialization, we can't have array-type partial specialisations:
133 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
134 && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
135 # define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS
139 // Without partial specialization, std::iterator_traits can't work:
141 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
142 && !defined(BOOST_NO_STD_ITERATOR_TRAITS)
143 # define BOOST_NO_STD_ITERATOR_TRAITS
147 // Without partial specialization, partial
148 // specialization with default args won't work either:
150 # if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
151 && !defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS)
152 # define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
156 // Without member template support, we can't have template constructors
157 // in the standard library either:
159 # if defined(BOOST_NO_MEMBER_TEMPLATES) \
160 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \
161 && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
162 # define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
166 // Without member template support, we can't have a conforming
167 // std::allocator template either:
169 # if defined(BOOST_NO_MEMBER_TEMPLATES) \
170 && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \
171 && !defined(BOOST_NO_STD_ALLOCATOR)
172 # define BOOST_NO_STD_ALLOCATOR
176 // without ADL support then using declarations will break ADL as well:
178 #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
179 # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
183 // Without typeid support we have no dynamic RTTI either:
185 #if defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI)
186 # define BOOST_NO_RTTI
190 // If we have a standard allocator, then we have a partial one as well:
192 #if !defined(BOOST_NO_STD_ALLOCATOR)
193 # define BOOST_HAS_PARTIAL_STD_ALLOCATOR
197 // We can't have a working std::use_facet if there is no std::locale:
199 # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_USE_FACET)
200 # define BOOST_NO_STD_USE_FACET
204 // We can't have a std::messages facet if there is no std::locale:
206 # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_MESSAGES)
207 # define BOOST_NO_STD_MESSAGES
211 // We can't have a working std::wstreambuf if there is no std::locale:
213 # if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF)
214 # define BOOST_NO_STD_WSTREAMBUF
218 // We can't have a <cwctype> if there is no <cwchar>:
220 # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_CWCTYPE)
221 # define BOOST_NO_CWCTYPE
225 // We can't have a swprintf if there is no <cwchar>:
227 # if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_SWPRINTF)
228 # define BOOST_NO_SWPRINTF
232 // If Win32 support is turned off, then we must turn off
233 // threading support also, unless there is some other
234 // thread API enabled:
236 #if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \
237 && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS)
238 # define BOOST_DISABLE_THREADS
242 // Turn on threading support if the compiler thinks that it's in
243 // multithreaded mode. We put this here because there are only a
244 // limited number of macros that identify this (if there's any missing
245 // from here then add to the appropriate compiler section):
247 #if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \
248 || defined(_PTHREADS) || defined(__APPLE__) || defined(__DragonFly__)) \
249 && !defined(BOOST_HAS_THREADS)
250 # define BOOST_HAS_THREADS
254 // Turn threading support off if BOOST_DISABLE_THREADS is defined:
256 #if defined(BOOST_DISABLE_THREADS) && defined(BOOST_HAS_THREADS)
257 # undef BOOST_HAS_THREADS
261 // Turn threading support off if we don't recognise the threading API:
263 #if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\
264 && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS)\
265 && !defined(BOOST_HAS_MPTASKS)
266 # undef BOOST_HAS_THREADS
270 // Turn threading detail macros off if we don't (want to) use threading
272 #ifndef BOOST_HAS_THREADS
273 # undef BOOST_HAS_PTHREADS
274 # undef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
275 # undef BOOST_HAS_PTHREAD_YIELD
276 # undef BOOST_HAS_PTHREAD_DELAY_NP
277 # undef BOOST_HAS_WINTHREADS
278 # undef BOOST_HAS_BETHREADS
279 # undef BOOST_HAS_MPTASKS
283 // If the compiler claims to be C99 conformant, then it had better
284 // have a <stdint.h>:
286 # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)
287 # define BOOST_HAS_STDINT_H
288 # ifndef BOOST_HAS_LOG1P
289 # define BOOST_HAS_LOG1P
291 # ifndef BOOST_HAS_EXPM1
292 # define BOOST_HAS_EXPM1
297 // Define BOOST_NO_SLIST and BOOST_NO_HASH if required.
298 // Note that this is for backwards compatibility only.
300 # if !defined(BOOST_HAS_SLIST) && !defined(BOOST_NO_SLIST)
301 # define BOOST_NO_SLIST
304 # if !defined(BOOST_HAS_HASH) && !defined(BOOST_NO_HASH)
305 # define BOOST_NO_HASH
309 // Set BOOST_SLIST_HEADER if not set already:
311 #if defined(BOOST_HAS_SLIST) && !defined(BOOST_SLIST_HEADER)
312 # define BOOST_SLIST_HEADER <slist>
316 // Set BOOST_HASH_SET_HEADER if not set already:
318 #if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_SET_HEADER)
319 # define BOOST_HASH_SET_HEADER <hash_set>
323 // Set BOOST_HASH_MAP_HEADER if not set already:
325 #if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_MAP_HEADER)
326 # define BOOST_HASH_MAP_HEADER <hash_map>
330 // Set BOOST_NO_INITIALIZER_LISTS if there is no library support.
333 #if defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS)
334 # define BOOST_NO_INITIALIZER_LISTS
338 // Set BOOST_HAS_RVALUE_REFS when BOOST_NO_RVALUE_REFERENCES is not defined
340 #if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS)
341 #define BOOST_HAS_RVALUE_REFS
344 // BOOST_HAS_ABI_HEADERS
345 // This macro gets set if we have headers that fix the ABI,
346 // and prevent ODR violations when linking to external libraries:
347 #if defined(BOOST_ABI_PREFIX) && defined(BOOST_ABI_SUFFIX) && !defined(BOOST_HAS_ABI_HEADERS)
348 # define BOOST_HAS_ABI_HEADERS
351 #if defined(BOOST_HAS_ABI_HEADERS) && defined(BOOST_DISABLE_ABI_HEADERS)
352 # undef BOOST_HAS_ABI_HEADERS
355 // BOOST_NO_STDC_NAMESPACE workaround --------------------------------------//
356 // Because std::size_t usage is so common, even in boost headers which do not
357 // otherwise use the C library, the <cstddef> workaround is included here so
358 // that ugly workaround code need not appear in many other boost headers.
359 // NOTE WELL: This is a workaround for non-conforming compilers; <cstddef>
360 // must still be #included in the usual places so that <cstddef> inclusion
361 // works as expected with standard conforming compilers. The resulting
362 // double inclusion of <cstddef> is harmless.
364 # ifdef BOOST_NO_STDC_NAMESPACE
366 namespace std { using ::ptrdiff_t; using ::size_t; }
369 // Workaround for the unfortunate min/max macros defined by some platform headers
371 #define BOOST_PREVENT_MACRO_SUBSTITUTION
373 #ifndef BOOST_USING_STD_MIN
374 # define BOOST_USING_STD_MIN() using std::min
377 #ifndef BOOST_USING_STD_MAX
378 # define BOOST_USING_STD_MAX() using std::max
381 // BOOST_NO_STD_MIN_MAX workaround -----------------------------------------//
383 # ifdef BOOST_NO_STD_MIN_MAX
387 inline const _Tp& min BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) {
388 return __b < __a ? __b : __a;
391 inline const _Tp& max BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) {
392 return __a < __b ? __b : __a;
398 // BOOST_STATIC_CONSTANT workaround --------------------------------------- //
399 // On compilers which don't allow in-class initialization of static integral
400 // constant members, we must use enums as a workaround if we want the constants
401 // to be available at compile-time. This macro gives us a convenient way to
402 // declare such constants.
404 # ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
405 # define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment }
407 # define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment
410 // BOOST_USE_FACET / HAS_FACET workaround ----------------------------------//
411 // When the standard library does not have a conforming std::use_facet there
412 // are various workarounds available, but they differ from library to library.
413 // The same problem occurs with has_facet.
414 // These macros provide a consistent way to access a locale's facets.
417 // std::use_facet<Type>(loc);
419 // BOOST_USE_FACET(Type, loc);
420 // Note do not add a std:: prefix to the front of BOOST_USE_FACET!
421 // Use for BOOST_HAS_FACET is analogous.
423 #if defined(BOOST_NO_STD_USE_FACET)
424 # ifdef BOOST_HAS_TWO_ARG_USE_FACET
425 # define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast<Type*>(0))
426 # define BOOST_HAS_FACET(Type, loc) std::has_facet(loc, static_cast<Type*>(0))
427 # elif defined(BOOST_HAS_MACRO_USE_FACET)
428 # define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type)
429 # define BOOST_HAS_FACET(Type, loc) std::_HAS(loc, Type)
430 # elif defined(BOOST_HAS_STLP_USE_FACET)
431 # define BOOST_USE_FACET(Type, loc) (*std::_Use_facet<Type >(loc))
432 # define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc)
435 # define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc)
436 # define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc)
439 // BOOST_NESTED_TEMPLATE workaround ------------------------------------------//
440 // Member templates are supported by some compilers even though they can't use
441 // the A::template member<U> syntax, as a workaround replace:
443 // typedef typename A::template rebind<U> binder;
447 // typedef typename A::BOOST_NESTED_TEMPLATE rebind<U> binder;
449 #ifndef BOOST_NO_MEMBER_TEMPLATE_KEYWORD
450 # define BOOST_NESTED_TEMPLATE template
452 # define BOOST_NESTED_TEMPLATE
455 // BOOST_UNREACHABLE_RETURN(x) workaround -------------------------------------//
456 // Normally evaluates to nothing, unless BOOST_NO_UNREACHABLE_RETURN_DETECTION
457 // is defined, in which case it evaluates to return x; Use when you have a return
458 // statement that can never be reached.
460 #ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION
461 # define BOOST_UNREACHABLE_RETURN(x) return x;
463 # define BOOST_UNREACHABLE_RETURN(x)
466 // BOOST_DEDUCED_TYPENAME workaround ------------------------------------------//
468 // Some compilers don't support the use of `typename' for dependent
469 // types in deduced contexts, e.g.
471 // template <class T> void f(T, typename T::type);
473 // Replace these declarations with:
475 // template <class T> void f(T, BOOST_DEDUCED_TYPENAME T::type);
477 #ifndef BOOST_NO_DEDUCED_TYPENAME
478 # define BOOST_DEDUCED_TYPENAME typename
480 # define BOOST_DEDUCED_TYPENAME
483 #ifndef BOOST_NO_TYPENAME_WITH_CTOR
484 # define BOOST_CTOR_TYPENAME typename
486 # define BOOST_CTOR_TYPENAME
489 // long long workaround ------------------------------------------//
490 // On gcc (and maybe other compilers?) long long is alway supported
491 // but it's use may generate either warnings (with -ansi), or errors
492 // (with -pedantic -ansi) unless it's use is prefixed by __extension__
494 #if defined(BOOST_HAS_LONG_LONG)
497 __extension__ typedef long long long_long_type;
498 __extension__ typedef unsigned long long ulong_long_type;
500 typedef long long long_long_type;
501 typedef unsigned long long ulong_long_type;
506 // BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------//
508 // Some compilers have problems with function templates whose template
509 // parameters don't appear in the function parameter list (basically
510 // they just link one instantiation of the template in the final
511 // executable). These macros provide a uniform way to cope with the
512 // problem with no effects on the calling syntax.
516 // #include <iostream>
517 // #include <ostream>
518 // #include <typeinfo>
521 // void f() { std::cout << n << ' '; }
523 // template <typename T>
524 // void g() { std::cout << typeid(T).name() << ' '; }
534 // With VC++ 6.0 the output is:
541 // void f(BOOST_EXPLICIT_TEMPLATE_NON_TYPE(int, n)) { ... }
543 // template <typename T>
544 // void g(BOOST_EXPLICIT_TEMPLATE_TYPE(T)) { ... }
548 #if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
550 # include "boost/type.hpp"
551 # include "boost/non_type.hpp"
553 # define BOOST_EXPLICIT_TEMPLATE_TYPE(t) boost::type<t>* = 0
554 # define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type<t>*
555 # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type<t, v>* = 0
556 # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type<t, v>*
558 # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \
559 , BOOST_EXPLICIT_TEMPLATE_TYPE(t)
560 # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \
561 , BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
562 # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \
563 , BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
564 # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \
565 , BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
569 // no workaround needed: expand to nothing
571 # define BOOST_EXPLICIT_TEMPLATE_TYPE(t)
572 # define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
573 # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
574 # define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
576 # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t)
577 # define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t)
578 # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v)
579 # define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v)
582 #endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
584 // When BOOST_NO_STD_TYPEINFO is defined, we can just import
585 // the global definition into std namespace:
586 #ifdef BOOST_NO_STD_TYPEINFO
588 namespace std{ using ::typeinfo; }
591 // ---------------------------------------------------------------------------//
594 // Helper macro BOOST_STRINGIZE:
595 // Converts the parameter X to a string after macro replacement
596 // on X has been performed.
598 #define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X)
599 #define BOOST_DO_STRINGIZE(X) #X
602 // Helper macro BOOST_JOIN:
603 // The following piece of macro magic joins the two
604 // arguments together, even when one of the arguments is
605 // itself a macro (see 16.3.1 in C++ standard). The key
606 // is that macro expansion of macro arguments does not
607 // occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN.
609 #define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y )
610 #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y)
611 #define BOOST_DO_JOIN2( X, Y ) X##Y
614 // Set some default values for compiler/library/platform names.
615 // These are for debugging config setup only:
617 # ifndef BOOST_COMPILER
618 # define BOOST_COMPILER "Unknown ISO C++ Compiler"
620 # ifndef BOOST_STDLIB
621 # define BOOST_STDLIB "Unknown ISO standard library"
623 # ifndef BOOST_PLATFORM
624 # if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \
625 || defined(_POSIX_SOURCE)
626 # define BOOST_PLATFORM "Generic Unix"
628 # define BOOST_PLATFORM "Unknown"
633 // Set some default values GPU support
635 # ifndef BOOST_GPU_ENABLED
636 # define BOOST_GPU_ENABLED