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 #if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0
82 #  define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx
83 #  define BOOST_HAS_SLIST
84 #  define BOOST_HAS_HASH
85 #  define BOOST_SLIST_HEADER <ext/slist>
86 # if !defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
87 #   define BOOST_HASH_SET_HEADER <ext/hash_set>
88 #   define BOOST_HASH_MAP_HEADER <ext/hash_map>
89 # else
90 #   define BOOST_HASH_SET_HEADER <backward/hash_set>
91 #   define BOOST_HASH_MAP_HEADER <backward/hash_map>
92 # endif
93 #endif
94 
95 //
96 // Decide whether we have C++11 support turned on:
97 //
98 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103)
99 #  define BOOST_LIBSTDCXX11
100 #endif
101 
102 //
103 //  Decide which version of libstdc++ we have, normally
104 //  libstdc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly
105 //  __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the libstdc++
106 //  developers. He also commented:
107 //
108 //       "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in
109 //       GCC 4.2.4 it is set to 20080519 but in GCC 4.3.0 it is set to 20080305.
110 //       Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support
111 //       than any release in the 4.2 series."
112 //
113 //  Another resource for understanding libstdc++ features is:
114 //  http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x
115 //
116 //  However, using the GCC version number fails when the compiler is clang since this
117 //  only ever claims to emulate GCC-4.2, see https://svn.boost.org/trac/boost/ticket/7473
118 //  for a long discussion on this issue.  What we can do though is use clang's __has_include
119 //  to detect the presence of a C++11 header that was introduced with a specific GCC release.
120 //  We still have to be careful though as many such headers were buggy and/or incomplete when
121 //  first introduced, so we only check for headers that were fully featured from day 1, and then
122 //  use that to infer the underlying GCC version:
123 //
124 #ifdef __clang__
125 
126 #if __has_include(<experimental/memory_resource>)
127 #  define BOOST_LIBSTDCXX_VERSION 60100
128 #elif __has_include(<experimental/any>)
129 #  define BOOST_LIBSTDCXX_VERSION 50100
130 #elif __has_include(<shared_mutex>)
131 #  define BOOST_LIBSTDCXX_VERSION 40900
132 #elif __has_include(<ext/cmath>)
133 #  define BOOST_LIBSTDCXX_VERSION 40800
134 #elif __has_include(<scoped_allocator>)
135 #  define BOOST_LIBSTDCXX_VERSION 40700
136 #elif __has_include(<typeindex>)
137 #  define BOOST_LIBSTDCXX_VERSION 40600
138 #elif __has_include(<future>)
139 #  define BOOST_LIBSTDCXX_VERSION 40500
140 #elif  __has_include(<ratio>)
141 #  define BOOST_LIBSTDCXX_VERSION 40400
142 #elif __has_include(<array>)
143 #  define BOOST_LIBSTDCXX_VERSION 40300
144 #endif
145 
146 #if (BOOST_LIBSTDCXX_VERSION < 50100)
147 // libstdc++ does not define this function as it's deprecated in C++11, but clang still looks for it,
148 // defining it here is a terrible cludge, but should get things working:
149 extern "C" char *gets (char *__s);
150 #endif
151 //
152 // clang is unable to parse some GCC headers, add those workarounds here:
153 //
154 #if BOOST_LIBSTDCXX_VERSION < 50000
155 #  define BOOST_NO_CXX11_HDR_REGEX
156 #endif
157 //
158 // GCC 4.7.x has no __cxa_thread_atexit which
159 // thread_local objects require for cleanup:
160 //
161 #if BOOST_LIBSTDCXX_VERSION < 40800
162 #  define BOOST_NO_CXX11_THREAD_LOCAL
163 #endif
164 //
165 // Early clang versions can handle <chrono>, not exactly sure which versions
166 // but certainly up to clang-3.8 and gcc-4.6:
167 //
168 #if (__clang_major__ < 5)
169 #  if BOOST_LIBSTDCXX_VERSION < 40800
170 #     define BOOST_NO_CXX11_HDR_FUTURE
171 #     define BOOST_NO_CXX11_HDR_MUTEX
172 #     define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
173 #     define BOOST_NO_CXX11_HDR_CHRONO
174 #  endif
175 #endif
176 
177 //
178 //  GCC 4.8 and 9 add working versions of <atomic> and <regex> respectively.
179 //  However, we have no test for these as the headers were present but broken
180 //  in early GCC versions.
181 //
182 #endif
183 
184 #if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130) && (__cplusplus >= 201103L)
185 //
186 // Oracle Solaris compiler uses it's own verison of libstdc++ but doesn't
187 // set __GNUC__
188 //
189 #if __SUNPRO_CC >= 0x5140
190 #define BOOST_LIBSTDCXX_VERSION 50100
191 #else
192 #define BOOST_LIBSTDCXX_VERSION 40800
193 #endif
194 #endif
195 
196 #if !defined(BOOST_LIBSTDCXX_VERSION)
197 #  define BOOST_LIBSTDCXX_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
198 #endif
199 
200 // std::auto_ptr isn't provided with _GLIBCXX_DEPRECATED=0 (GCC 4.5 and earlier)
201 // or _GLIBCXX_USE_DEPRECATED=0 (GCC 4.6 and later).
202 #if defined(BOOST_LIBSTDCXX11)
203 #  if BOOST_LIBSTDCXX_VERSION < 40600
204 #     if !_GLIBCXX_DEPRECATED
205 #        define BOOST_NO_AUTO_PTR
206 #     endif
207 #  elif !_GLIBCXX_USE_DEPRECATED
208 #     define BOOST_NO_AUTO_PTR
209 #  endif
210 #endif
211 
212 //  C++0x headers in GCC 4.3.0 and later
213 //
214 #if (BOOST_LIBSTDCXX_VERSION < 40300) || !defined(BOOST_LIBSTDCXX11)
215 #  define BOOST_NO_CXX11_HDR_ARRAY
216 #  define BOOST_NO_CXX11_HDR_TUPLE
217 #  define BOOST_NO_CXX11_HDR_UNORDERED_MAP
218 #  define BOOST_NO_CXX11_HDR_UNORDERED_SET
219 #  define BOOST_NO_CXX11_HDR_FUNCTIONAL
220 #endif
221 
222 //  C++0x headers in GCC 4.4.0 and later
223 //
224 #if (BOOST_LIBSTDCXX_VERSION < 40400) || !defined(BOOST_LIBSTDCXX11)
225 #  define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
226 #  define BOOST_NO_CXX11_HDR_FORWARD_LIST
227 #  define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
228 #  define BOOST_NO_CXX11_HDR_MUTEX
229 #  define BOOST_NO_CXX11_HDR_RATIO
230 #  define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
231 #  define BOOST_NO_CXX11_SMART_PTR
232 #else
233 #  define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG
234 #  define BOOST_HAS_TR1_COMPLEX_OVERLOADS
235 #endif
236 
237 //  C++0x features in GCC 4.5.0 and later
238 //
239 #if (BOOST_LIBSTDCXX_VERSION < 40500) || !defined(BOOST_LIBSTDCXX11)
240 #  define BOOST_NO_CXX11_NUMERIC_LIMITS
241 #  define BOOST_NO_CXX11_HDR_FUTURE
242 #  define BOOST_NO_CXX11_HDR_RANDOM
243 #endif
244 
245 //  C++0x features in GCC 4.6.0 and later
246 //
247 #if (BOOST_LIBSTDCXX_VERSION < 40600) || !defined(BOOST_LIBSTDCXX11)
248 #  define BOOST_NO_CXX11_HDR_TYPEINDEX
249 #  define BOOST_NO_CXX11_ADDRESSOF
250 #endif
251 
252 //  C++0x features in GCC 4.7.0 and later
253 //
254 #if (BOOST_LIBSTDCXX_VERSION < 40700) || !defined(BOOST_LIBSTDCXX11)
255 // Note that although <chrono> existed prior to 4.7, "steady_clock" is spelled "monotonic_clock"
256 // so 4.7.0 is the first truly conforming one.
257 #  define BOOST_NO_CXX11_HDR_CHRONO
258 #  define BOOST_NO_CXX11_ALLOCATOR
259 #  define BOOST_NO_CXX11_POINTER_TRAITS
260 #endif
261 //  C++0x features in GCC 4.8.0 and later
262 //
263 #if (BOOST_LIBSTDCXX_VERSION < 40800) || !defined(BOOST_LIBSTDCXX11)
264 // Note that although <atomic> existed prior to gcc 4.8 it was largely unimplemented for many types:
265 #  define BOOST_NO_CXX11_HDR_ATOMIC
266 #  define BOOST_NO_CXX11_HDR_THREAD
267 #endif
268 //  C++0x features in GCC 4.9.0 and later
269 //
270 #if (BOOST_LIBSTDCXX_VERSION < 40900) || !defined(BOOST_LIBSTDCXX11)
271 // Although <regex> is present and compilable against, the actual implementation is not functional
272 // even for the simplest patterns such as "\d" or "[0-9]". This is the case at least in gcc up to 4.8, inclusively.
273 #  define BOOST_NO_CXX11_HDR_REGEX
274 #endif
275 #if (BOOST_LIBSTDCXX_VERSION < 40900) || (__cplusplus <= 201103)
276 #  define BOOST_NO_CXX14_STD_EXCHANGE
277 #endif
278 
279 #if defined(__clang_major__) && ((__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 7)))
280 // As of clang-3.6, libstdc++ header <atomic> throws up errors with clang:
281 #  define BOOST_NO_CXX11_HDR_ATOMIC
282 #endif
283 //
284 //  C++0x features in GCC 5.1 and later
285 //
286 #if (BOOST_LIBSTDCXX_VERSION < 50100) || !defined(BOOST_LIBSTDCXX11)
287 #  define BOOST_NO_CXX11_HDR_TYPE_TRAITS
288 #  define BOOST_NO_CXX11_HDR_CODECVT
289 #  define BOOST_NO_CXX11_ATOMIC_SMART_PTR
290 #  define BOOST_NO_CXX11_STD_ALIGN
291 #endif
292 
293 //
294 //  C++17 features in GCC 6.1 and later
295 //
296 #if (BOOST_LIBSTDCXX_VERSION < 60100) || (__cplusplus <= 201402L)
297 #  define BOOST_NO_CXX17_STD_INVOKE
298 #endif
299 #if (BOOST_LIBSTDCXX_VERSION < 70100) || (__cplusplus <= 201402L)
300 #  define BOOST_NO_CXX17_STD_APPLY
301 #endif
302 
303 #if defined(__has_include)
304 #if !__has_include(<shared_mutex>)
305 #  define BOOST_NO_CXX14_HDR_SHARED_MUTEX
306 #elif __cplusplus <= 201103
307 #  define BOOST_NO_CXX14_HDR_SHARED_MUTEX
308 #endif
309 #elif __cplusplus < 201402 || (BOOST_LIBSTDCXX_VERSION < 40900) || !defined(BOOST_LIBSTDCXX11)
310 #  define BOOST_NO_CXX14_HDR_SHARED_MUTEX
311 #endif
312 
313 //
314 // Headers not present on Solaris with the Oracle compiler:
315 #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
316 #define BOOST_NO_CXX11_HDR_FUTURE
317 #define BOOST_NO_CXX11_HDR_FORWARD_LIST
318 #define BOOST_NO_CXX11_HDR_ATOMIC
319 // shared_ptr is present, but is not convertible to bool
320 // which causes all kinds of problems especially in Boost.Thread
321 // but probably elsewhere as well.
322 #define BOOST_NO_CXX11_SMART_PTR
323 #endif
324 
325 #if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1))
326    // Headers not always available:
327 #  ifndef BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
328 #     define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
329 #  endif
330 #  ifndef BOOST_NO_CXX11_HDR_MUTEX
331 #     define BOOST_NO_CXX11_HDR_MUTEX
332 #  endif
333 #  ifndef BOOST_NO_CXX11_HDR_THREAD
334 #     define BOOST_NO_CXX11_HDR_THREAD
335 #  endif
336 #  ifndef BOOST_NO_CXX14_HDR_SHARED_MUTEX
337 #     define BOOST_NO_CXX14_HDR_SHARED_MUTEX
338 #  endif
339 #endif
340 
341 #if (!defined(_GTHREAD_USE_MUTEX_TIMEDLOCK) || (_GTHREAD_USE_MUTEX_TIMEDLOCK == 0)) && !defined(BOOST_NO_CXX11_HDR_MUTEX)
342 // Timed mutexes are not always available:
343 #  define BOOST_NO_CXX11_HDR_MUTEX
344 #endif
345 
346 //  --- end ---
347