1// (C) Copyright John Maddock 2001.
2// (C) Copyright Jens Maurer 2001.
3// Use, modification and distribution are subject to the
4// Boost Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7// See http://www.boost.org for most recent version.
8
9// config for libstdc++ v3
10// not much to go in here:
11
12#define BOOST_GNU_STDLIB 1
13
14#ifdef __GLIBCXX__
15#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCXX__)
16#else
17#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCPP__)
18#endif
19
20#if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T)
21# define BOOST_NO_CWCHAR
22# define BOOST_NO_CWCTYPE
23# define BOOST_NO_STD_WSTRING
24# define BOOST_NO_STD_WSTREAMBUF
25#endif
26
27#if defined(__osf__) && !defined(_REENTRANT) \
28 && ( defined(_GLIBCXX_HAVE_GTHR_DEFAULT) || defined(_GLIBCPP_HAVE_GTHR_DEFAULT) )
29// GCC 3 on Tru64 forces the definition of _REENTRANT when any std lib header
30// file is included, therefore for consistency we define it here as well.
31# define _REENTRANT
32#endif
33
34#ifdef __GLIBCXX__ // gcc 3.4 and greater:
35# if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
36 || defined(_GLIBCXX__PTHREADS) \
37 || defined(_GLIBCXX_HAS_GTHREADS) \
38 || defined(_WIN32) \
39 || defined(_AIX) \
40 || defined(__HAIKU__)
41 //
42 // If the std lib has thread support turned on, then turn it on in Boost
43 // as well. We do this because some gcc-3.4 std lib headers define _REENTANT
44 // while others do not...
45 //
46# define BOOST_HAS_THREADS
47# else
48# define BOOST_DISABLE_THREADS
49# endif
50#elif defined(__GLIBCPP__) \
51 && !defined(_GLIBCPP_HAVE_GTHR_DEFAULT) \
52 && !defined(_GLIBCPP__PTHREADS)
53 // disable thread support if the std lib was built single threaded:
54# define BOOST_DISABLE_THREADS
55#endif
56
57#if (defined(linux) || defined(__linux) || defined(__linux__)) && defined(__arm__) && defined(_GLIBCPP_HAVE_GTHR_DEFAULT)
58// linux on arm apparently doesn't define _REENTRANT
59// so just turn on threading support whenever the std lib is thread safe:
60# define BOOST_HAS_THREADS
61#endif
62
63#if !defined(_GLIBCPP_USE_LONG_LONG) \
64 && !defined(_GLIBCXX_USE_LONG_LONG)\
65 && defined(BOOST_HAS_LONG_LONG)
66// May have been set by compiler/*.hpp, but "long long" without library
67// support is useless.
68# undef BOOST_HAS_LONG_LONG
69#endif
70
71// Apple doesn't seem to reliably defined a *unix* macro
72#if !defined(CYGWIN) && ( defined(__unix__) \
73 || defined(__unix) \
74 || defined(unix) \
75 || defined(__APPLE__) \
76 || defined(__APPLE) \
77 || defined(APPLE))
78# include <unistd.h>
79#endif
80
81#ifndef __VXWORKS__ // VxWorks uses Dinkum, not GNU STL with GCC
82#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0
83# define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx
84# define BOOST_HAS_SLIST
85# define BOOST_HAS_HASH
86# define BOOST_SLIST_HEADER <ext/slist>
87# if !defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
88# define BOOST_HASH_SET_HEADER <ext/hash_set>
89# define BOOST_HASH_MAP_HEADER <ext/hash_map>
90# else
91# define BOOST_HASH_SET_HEADER <backward/hash_set>
92# define BOOST_HASH_MAP_HEADER <backward/hash_map>
93# endif
94#endif
95#endif
96
97#if defined(__has_include)
98#if defined(BOOST_HAS_HASH)
99#if !__has_include(BOOST_HASH_SET_HEADER) || (__GNUC__ >= 10)
100#undef BOOST_HAS_HASH
101#undef BOOST_HAS_SET_HEADER
102#undef BOOST_HAS_MAP_HEADER
103#endif
104#if !__has_include(BOOST_SLIST_HEADER)
105#undef BOOST_HAS_SLIST
106#undef BOOST_HAS_SLIST_HEADER
107#endif
108#endif
109#endif
110
111//
112// Decide whether we have C++11 support turned on:
113//
114#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103)
115# define BOOST_LIBSTDCXX11
116#endif
117
118//
119// Decide which version of libstdc++ we have, normally
120// libstdc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly
121// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the libstdc++
122// developers. He also commented:
123//
124// "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in
125// GCC 4.2.4 it is set to 20080519 but in GCC 4.3.0 it is set to 20080305.
126// Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support
127// than any release in the 4.2 series."
128//
129// Another resource for understanding libstdc++ features is:
130// http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x
131//
132// However, using the GCC version number fails when the compiler is clang since this
133// only ever claims to emulate GCC-4.2, see https://svn.boost.org/trac/boost/ticket/7473
134// for a long discussion on this issue. What we can do though is use clang's __has_include
135// to detect the presence of a C++11 header that was introduced with a specific GCC release.
136// We still have to be careful though as many such headers were buggy and/or incomplete when
137// first introduced, so we only check for headers that were fully featured from day 1, and then
138// use that to infer the underlying GCC version:
139//
140#ifdef __clang__
141
142#ifdef _GLIBCXX_RELEASE
143# define BOOST_LIBSTDCXX_VERSION (_GLIBCXX_RELEASE * 10000 + 100)
144#else
145//
146// We figure out which gcc version issued this std lib
147// by checking which headers are available:
148//
149#if __has_include(<expected>)
150# define BOOST_LIBSTDCXX_VERSION 120100
151#elif __has_include(<source_location>)
152# define BOOST_LIBSTDCXX_VERSION 110100
153#elif __has_include(<compare>)
154# define BOOST_LIBSTDCXX_VERSION 100100
155#elif __has_include(<memory_resource>)
156# define BOOST_LIBSTDCXX_VERSION 90100
157#elif __has_include(<charconv>)
158# define BOOST_LIBSTDCXX_VERSION 80100
159#elif __has_include(<variant>)
160# define BOOST_LIBSTDCXX_VERSION 70100
161#elif __has_include(<experimental/memory_resource>)
162# define BOOST_LIBSTDCXX_VERSION 60100
163#elif __has_include(<experimental/any>)
164# define BOOST_LIBSTDCXX_VERSION 50100
165#elif __has_include(<shared_mutex>)
166# define BOOST_LIBSTDCXX_VERSION 40900
167#elif __has_include(<ext/cmath>)
168# define BOOST_LIBSTDCXX_VERSION 40800
169#elif __has_include(<scoped_allocator>)
170# define BOOST_LIBSTDCXX_VERSION 40700
171#elif __has_include(<typeindex>)
172# define BOOST_LIBSTDCXX_VERSION 40600
173#elif __has_include(<future>)
174# define BOOST_LIBSTDCXX_VERSION 40500
175#elif __has_include(<ratio>)
176# define BOOST_LIBSTDCXX_VERSION 40400
177#elif __has_include(<array>)
178# define BOOST_LIBSTDCXX_VERSION 40300
179#endif
180#endif
181//
182// If BOOST_HAS_FLOAT128 is set, now that we know the std lib is libstdc++3, check to see if the std lib is
183// configured to support this type. If not disable it:
184//
185#if defined(BOOST_HAS_FLOAT128) && !defined(_GLIBCXX_USE_FLOAT128)
186# undef BOOST_HAS_FLOAT128
187#endif
188
189#if (BOOST_LIBSTDCXX_VERSION >= 100000) && defined(BOOST_HAS_HASH)
190//
191// hash_set/hash_map deprecated and have terminal bugs:
192//
193#undef BOOST_HAS_HASH
194#undef BOOST_HAS_SET_HEADER
195#undef BOOST_HAS_MAP_HEADER
196#endif
197
198
199#if (BOOST_LIBSTDCXX_VERSION >= 100000) && defined(BOOST_HAS_HASH)
200//
201// hash_set/hash_map deprecated and have terminal bugs:
202//
203#undef BOOST_HAS_HASH
204#undef BOOST_HAS_SET_HEADER
205#undef BOOST_HAS_MAP_HEADER
206#endif
207
208
209#if (BOOST_LIBSTDCXX_VERSION < 50100)
210// libstdc++ does not define this function as it's deprecated in C++11, but clang still looks for it,
211// defining it here is a terrible cludge, but should get things working:
212extern "C" char *gets (char *__s);
213#endif
214//
215// clang is unable to parse some GCC headers, add those workarounds here:
216//
217#if BOOST_LIBSTDCXX_VERSION < 50000
218# define BOOST_NO_CXX11_HDR_REGEX
219#endif
220//
221// GCC 4.7.x has no __cxa_thread_atexit which
222// thread_local objects require for cleanup:
223//
224#if BOOST_LIBSTDCXX_VERSION < 40800
225# define BOOST_NO_CXX11_THREAD_LOCAL
226#endif
227//
228// Early clang versions can handle <chrono>, not exactly sure which versions
229// but certainly up to clang-3.8 and gcc-4.6:
230//
231#if (__clang_major__ < 5)
232# if BOOST_LIBSTDCXX_VERSION < 40800
233# define BOOST_NO_CXX11_HDR_FUTURE
234# define BOOST_NO_CXX11_HDR_MUTEX
235# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
236# define BOOST_NO_CXX11_HDR_CHRONO
237# endif
238#endif
239
240//
241// GCC 4.8 and 9 add working versions of <atomic> and <regex> respectively.
242// However, we have no test for these as the headers were present but broken
243// in early GCC versions.
244//
245#endif
246
247#if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130) && (__cplusplus >= 201103L)
248//
249// Oracle Solaris compiler uses it's own verison of libstdc++ but doesn't
250// set __GNUC__
251//
252#if __SUNPRO_CC >= 0x5140
253#define BOOST_LIBSTDCXX_VERSION 50100
254#else
255#define BOOST_LIBSTDCXX_VERSION 40800
256#endif
257#endif
258
259#if !defined(BOOST_LIBSTDCXX_VERSION)
260# define BOOST_LIBSTDCXX_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
261#endif
262
263// std::auto_ptr isn't provided with _GLIBCXX_DEPRECATED=0 (GCC 4.5 and earlier)
264// or _GLIBCXX_USE_DEPRECATED=0 (GCC 4.6 and later).
265#if defined(BOOST_LIBSTDCXX11)
266# if BOOST_LIBSTDCXX_VERSION < 40600
267# if !_GLIBCXX_DEPRECATED
268# define BOOST_NO_AUTO_PTR
269# endif
270# elif !defined(_GLIBCXX_USE_DEPRECATED) || !_GLIBCXX_USE_DEPRECATED
271# define BOOST_NO_AUTO_PTR
272# define BOOST_NO_CXX98_BINDERS
273# endif
274#endif
275
276// C++0x headers in GCC 4.3.0 and later
277//
278#if (BOOST_LIBSTDCXX_VERSION < 40300) || !defined(BOOST_LIBSTDCXX11)
279# define BOOST_NO_CXX11_HDR_ARRAY
280# define BOOST_NO_CXX11_HDR_TUPLE
281# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
282# define BOOST_NO_CXX11_HDR_UNORDERED_SET
283# define BOOST_NO_CXX11_HDR_FUNCTIONAL
284#endif
285
286// C++0x headers in GCC 4.4.0 and later
287//
288#if (BOOST_LIBSTDCXX_VERSION < 40400) || !defined(BOOST_LIBSTDCXX11)
289# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
290# define BOOST_NO_CXX11_HDR_FORWARD_LIST
291# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
292# define BOOST_NO_CXX11_HDR_MUTEX
293# define BOOST_NO_CXX11_HDR_RATIO
294# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
295# define BOOST_NO_CXX11_SMART_PTR
296# define BOOST_NO_CXX11_HDR_EXCEPTION
297#else
298# define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG
299# define BOOST_HAS_TR1_COMPLEX_OVERLOADS
300#endif
301
302// C++0x features in GCC 4.5.0 and later
303//
304#if (BOOST_LIBSTDCXX_VERSION < 40500) || !defined(BOOST_LIBSTDCXX11)
305# define BOOST_NO_CXX11_NUMERIC_LIMITS
306# define BOOST_NO_CXX11_HDR_FUTURE
307# define BOOST_NO_CXX11_HDR_RANDOM
308#endif
309
310// C++0x features in GCC 4.6.0 and later
311//
312#if (BOOST_LIBSTDCXX_VERSION < 40600) || !defined(BOOST_LIBSTDCXX11)
313# define BOOST_NO_CXX11_HDR_TYPEINDEX
314# define BOOST_NO_CXX11_ADDRESSOF
315# define BOOST_NO_CXX17_ITERATOR_TRAITS
316#endif
317
318// C++0x features in GCC 4.7.0 and later
319//
320#if (BOOST_LIBSTDCXX_VERSION < 40700) || !defined(BOOST_LIBSTDCXX11)
321// Note that although <chrono> existed prior to 4.7, "steady_clock" is spelled "monotonic_clock"
322// so 4.7.0 is the first truly conforming one.
323# define BOOST_NO_CXX11_HDR_CHRONO
324# define BOOST_NO_CXX11_ALLOCATOR
325# define BOOST_NO_CXX11_POINTER_TRAITS
326#endif
327// C++0x features in GCC 4.8.0 and later
328//
329#if (BOOST_LIBSTDCXX_VERSION < 40800) || !defined(BOOST_LIBSTDCXX11)
330// Note that although <atomic> existed prior to gcc 4.8 it was largely unimplemented for many types:
331# define BOOST_NO_CXX11_HDR_ATOMIC
332# define BOOST_NO_CXX11_HDR_THREAD
333#endif
334// C++0x features in GCC 4.9.0 and later
335//
336#if (BOOST_LIBSTDCXX_VERSION < 40900) || !defined(BOOST_LIBSTDCXX11)
337// Although <regex> is present and compilable against, the actual implementation is not functional
338// even for the simplest patterns such as "\d" or "[0-9]". This is the case at least in gcc up to 4.8, inclusively.
339# define BOOST_NO_CXX11_HDR_REGEX
340#endif
341#if (BOOST_LIBSTDCXX_VERSION < 40900) || (__cplusplus <= 201103)
342# define BOOST_NO_CXX14_STD_EXCHANGE
343#endif
344
345//
346// C++0x features in GCC 5.1 and later
347//
348#if (BOOST_LIBSTDCXX_VERSION < 50100) || !defined(BOOST_LIBSTDCXX11)
349# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
350# define BOOST_NO_CXX11_HDR_CODECVT
351# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
352# define BOOST_NO_CXX11_STD_ALIGN
353#endif
354
355//
356// C++17 features in GCC 7.1 and later
357//
358#if (BOOST_LIBSTDCXX_VERSION < 70100) || (__cplusplus <= 201402L)
359# define BOOST_NO_CXX17_STD_INVOKE
360# define BOOST_NO_CXX17_STD_APPLY
361# define BOOST_NO_CXX17_HDR_OPTIONAL
362# define BOOST_NO_CXX17_HDR_STRING_VIEW
363# define BOOST_NO_CXX17_HDR_VARIANT
364#endif
365
366#if defined(__has_include)
367#if !__has_include(<shared_mutex>)
368# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
369#elif __cplusplus <= 201103
370# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
371#endif
372//
373// <execution> has a dependency to Intel's thread building blocks:
374// unless these are installed seperately, including <execution> leads
375// to inscrutable errors inside libstdc++'s own headers.
376//
377#if (BOOST_LIBSTDCXX_VERSION < 100100)
378#if !__has_include(<tbb/tbb.h>)
379#define BOOST_NO_CXX17_HDR_EXECUTION
380#endif
381#endif
382#elif __cplusplus < 201402 || (BOOST_LIBSTDCXX_VERSION < 40900) || !defined(BOOST_LIBSTDCXX11)
383# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
384#endif
385
386#if BOOST_LIBSTDCXX_VERSION < 100100
387//
388// The header may be present but is incomplete:
389//
390# define BOOST_NO_CXX17_HDR_CHARCONV
391#endif
392
393#if BOOST_LIBSTDCXX_VERSION < 110000
394//
395// Header <bit> may be present but lacks std::bit_cast:
396//
397#define BOOST_NO_CXX20_HDR_BIT
398#endif
399
400#if BOOST_LIBSTDCXX_VERSION >= 120000
401//
402// Unary function is now deprecated in C++11 and later:
403//
404#if __cplusplus >= 201103L
405#define BOOST_NO_CXX98_FUNCTION_BASE
406#endif
407#endif
408
409#ifndef __cpp_impl_coroutine
410# define BOOST_NO_CXX20_HDR_COROUTINE
411#endif
412
413//
414// These next defines are mostly for older clang versions with a newer libstdc++ :
415//
416#if !defined(__cpp_lib_concepts)
417#if !defined(BOOST_NO_CXX20_HDR_COMPARE)
418# define BOOST_NO_CXX20_HDR_COMPARE
419#endif
420#if !defined(BOOST_NO_CXX20_HDR_CONCEPTS)
421# define BOOST_NO_CXX20_HDR_CONCEPTS
422#endif
423#if !defined(BOOST_NO_CXX20_HDR_SPAN)
424# define BOOST_NO_CXX20_HDR_SPAN
425#endif
426#if !defined(BOOST_NO_CXX20_HDR_RANGES)
427# define BOOST_NO_CXX20_HDR_RANGES
428#endif
429#endif
430
431#if defined(__clang__)
432#if (__clang_major__ < 11) && !defined(BOOST_NO_CXX20_HDR_RANGES)
433# define BOOST_NO_CXX20_HDR_RANGES
434#endif
435#if (__clang_major__ < 10) && (BOOST_LIBSTDCXX_VERSION >= 110000) && !defined(BOOST_NO_CXX11_HDR_CHRONO)
436// Old clang can't parse <chrono>:
437# define BOOST_NO_CXX11_HDR_CHRONO
438# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
439#endif
440#endif
441
442#if defined(__clang__) && (BOOST_LIBSTDCXX_VERSION < 40300) && !defined(BOOST_NO_CXX11_NULLPTR)
443# define BOOST_NO_CXX11_NULLPTR
444#endif
445#if defined(__clang__) && (BOOST_LIBSTDCXX_VERSION < 40300) && defined(BOOST_HAS_INT128) && defined(__APPLE_CC__)
446#undef BOOST_HAS_INT128
447#endif
448
449//
450// Headers not present on Solaris with the Oracle compiler:
451#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
452#define BOOST_NO_CXX11_HDR_FUTURE
453#define BOOST_NO_CXX11_HDR_FORWARD_LIST
454#define BOOST_NO_CXX11_HDR_ATOMIC
455// shared_ptr is present, but is not convertible to bool
456// which causes all kinds of problems especially in Boost.Thread
457// but probably elsewhere as well.
458#define BOOST_NO_CXX11_SMART_PTR
459#endif
460
461#if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1))
462 // Headers not always available:
463# ifndef BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
464# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
465# endif
466# ifndef BOOST_NO_CXX11_HDR_MUTEX
467# define BOOST_NO_CXX11_HDR_MUTEX
468# endif
469# ifndef BOOST_NO_CXX11_HDR_THREAD
470# define BOOST_NO_CXX11_HDR_THREAD
471# endif
472# ifndef BOOST_NO_CXX14_HDR_SHARED_MUTEX
473# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
474# endif
475#endif
476
477#if (!defined(_GTHREAD_USE_MUTEX_TIMEDLOCK) || (_GTHREAD_USE_MUTEX_TIMEDLOCK == 0)) && !defined(BOOST_NO_CXX11_HDR_MUTEX) && (__GNUC__ < 6)
478// Timed mutexes are not always available:
479# define BOOST_NO_CXX11_HDR_MUTEX
480#endif
481
482// --- end ---
483

source code of boost/libs/config/include/boost/config/stdlib/libstdcpp3.hpp