• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[/
2 / Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com)
3 /
4 / Distributed under the Boost Software License, Version 1.0. (See accompanying
5 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 /]
7
8[heading Compiler/platform feature detection macros]
9
10Asio automatically defines preprocessor macros corresponding to the detected
11available features on a particular compiler and target platform. These macros
12are named with the prefix `BOOST_ASIO_HAS_`, and are listed in the table below.
13
14Many of these macros also have a corresponding `BOOST_ASIO_DISABLE_` macro that
15may be used to explicitly disable the feature.
16
17In general, `BOOST_ASIO_HAS_` macros should not be explicitly defined by the
18user, except when absolutely required as a workaround for the latest version of
19a compiler or platform. For older compiler/platform combinations where a
20specific `BOOST_ASIO_HAS_` macro is not automatically defined, testing may have
21shown that a claimed feature isn't sufficiently conformant to be compatible
22with Boost.Asio's needs.
23
24[table
25  [[Macro][Description][Macro to disable feature]]
26  [
27    [`BOOST_ASIO_HAS_ALIAS_TEMPLATES`]
28    [
29      Support alias templates on compilers known to allow it.
30    ]
31    [`BOOST_ASIO_DISABLE_ALIAS_TEMPLATES`]
32  ]
33  [
34    [`BOOST_ASIO_HAS_BOOST_ARRAY`]
35    [
36      Boost array library.
37    ]
38    [`BOOST_ASIO_DISABLE_BOOST_ARRAY`]
39  ]
40  [
41    [`BOOST_ASIO_HAS_BOOST_ASSERT`]
42    [
43      Boost assert macro.
44    ]
45    [`BOOST_ASIO_DISABLE_BOOST_ASSERT`]
46  ]
47  [
48    [`BOOST_ASIO_HAS_BOOST_BIND`]
49    [
50      Boost bind function.
51    ]
52    [`BOOST_ASIO_DISABLE_BOOST_BIND`]
53  ]
54  [
55    [`BOOST_ASIO_HAS_BOOST_CHRONO`]
56    [
57      Boost support for chrono.
58    ]
59    [`BOOST_ASIO_DISABLE_BOOST_CHRONO`]
60  ]
61  [
62    [`BOOST_ASIO_HAS_BOOST_CONFIG`]
63    [
64
65    ]
66    []
67  ]
68  [
69    [`BOOST_ASIO_HAS_BOOST_DATE_TIME`]
70    [
71      Boost support for the DateTime library.
72    ]
73    [`BOOST_ASIO_DISABLE_BOOST_DATE_TIME`]
74  ]
75  [
76    [`BOOST_ASIO_HAS_BOOST_LIMITS`]
77    [
78      Boost limits header.
79    ]
80    [`BOOST_ASIO_DISABLE_BOOST_LIMITS`]
81  ]
82  [
83    [`BOOST_ASIO_HAS_BOOST_REGEX`]
84    [
85      Boost regex library.
86    ]
87    [`BOOST_ASIO_DISABLE_BOOST_REGEX`]
88  ]
89  [
90    [`BOOST_ASIO_HAS_BOOST_THROW_EXCEPTION`]
91    [
92      Boost throw_exception function.
93    ]
94    [`BOOST_ASIO_DISABLE_BOOST_THROW_EXCEPTION`]
95  ]
96  [
97    [`BOOST_ASIO_HAS_BOOST_WORKAROUND`]
98    [
99      Boost's BOOST_WORKAROUND macro.
100    ]
101    [`BOOST_ASIO_DISABLE_BOOST_WORKAROUND`]
102  ]
103  [
104    [`BOOST_ASIO_HAS_CHRONO`]
105    [
106      Some form of chrono library is available.
107    ]
108    []
109  ]
110  [
111    [`BOOST_ASIO_HAS_CLANG_LIBCXX`]
112    [
113      Clang / libc++ detection.
114    ]
115    []
116  ]
117  [
118    [`BOOST_ASIO_HAS_CONCEPTS`]
119    [
120      Support concepts on compilers known to allow them.
121    ]
122    [`BOOST_ASIO_DISABLE_CONCEPTS`]
123  ]
124  [
125    [`BOOST_ASIO_HAS_CONSTANT_EXPRESSION_SFINAE`]
126    [
127      Support SFINAE use of constant expressions on compilers known to allow it.
128    ]
129    [`BOOST_ASIO_DISABLE_CONSTANT_EXPRESSION_SFINAE`]
130  ]
131  [
132    [`BOOST_ASIO_HAS_CONSTEXPR`]
133    [
134      Support constexpr on compilers known to allow it.
135    ]
136    [`BOOST_ASIO_DISABLE_CONSTEXPR`]
137  ]
138  [
139    [`BOOST_ASIO_HAS_CO_AWAIT`]
140    [
141      Support the co_await keyword on compilers known to allow it.
142    ]
143    [`BOOST_ASIO_DISABLE_CO_AWAIT`]
144  ]
145  [
146    [`BOOST_ASIO_HAS_CSTDINT`]
147    [
148      Standard library support for the cstdint header.
149    ]
150    [`BOOST_ASIO_DISABLE_CSTDINT`]
151  ]
152  [
153    [`BOOST_ASIO_HAS_CXX11_ALLOCATORS`]
154    [
155      Standard library support for the C++11 allocator additions.
156    ]
157    [`BOOST_ASIO_DISABLE_CXX11_ALLOCATORS`]
158  ]
159  [
160    [`BOOST_ASIO_HAS_DECLTYPE`]
161    [
162      Support automatic type deduction on compilers known to support it.
163    ]
164    [`BOOST_ASIO_DISABLE_DECLTYPE`]
165  ]
166  [
167    [`BOOST_ASIO_HAS_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS`]
168    [
169      Support default function template arguments on compilers known to allow it.
170    ]
171    [`BOOST_ASIO_DISABLE_DEFAULT_FUNCTION_TEMPLATE_ARGUMENTS`]
172  ]
173  [
174    [`BOOST_ASIO_HAS_DEV_POLL`]
175    [
176      Solaris: /dev/poll.
177    ]
178    [`BOOST_ASIO_DISABLE_DEV_POLL`]
179  ]
180  [
181    [`BOOST_ASIO_HAS_EPOLL`]
182    [
183      Linux: epoll, eventfd and timerfd.
184    ]
185    [`BOOST_ASIO_DISABLE_EPOLL`]
186  ]
187  [
188    [`BOOST_ASIO_HAS_EVENTFD`]
189    [
190      Linux: epoll, eventfd and timerfd.
191    ]
192    [`BOOST_ASIO_DISABLE_EVENTFD`]
193  ]
194  [
195    [`BOOST_ASIO_HAS_GETADDRINFO`]
196    [
197      Can use getaddrinfo() and getnameinfo().
198    ]
199    [`BOOST_ASIO_DISABLE_GETADDRINFO`]
200  ]
201  [
202    [`BOOST_ASIO_HAS_HANDLER_HOOKS`]
203    [
204      Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
205    ]
206    [`BOOST_ASIO_DISABLE_HANDLER_HOOKS`]
207  ]
208  [
209    [`BOOST_ASIO_HAS_IOCP`]
210    [
211      Windows: IO Completion Ports.
212    ]
213    [`BOOST_ASIO_DISABLE_IOCP`]
214  ]
215  [
216    [`BOOST_ASIO_HAS_KQUEUE`]
217    [
218      Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
219    ]
220    [`BOOST_ASIO_DISABLE_KQUEUE`]
221  ]
222  [
223    [`BOOST_ASIO_HAS_LOCAL_SOCKETS`]
224    [
225      UNIX domain sockets.
226    ]
227    [`BOOST_ASIO_DISABLE_LOCAL_SOCKETS`]
228  ]
229  [
230    [`BOOST_ASIO_HAS_MOVE`]
231    [
232      Support move construction and assignment on compilers known to allow it.
233    ]
234    [`BOOST_ASIO_DISABLE_MOVE`]
235  ]
236  [
237    [`BOOST_ASIO_HAS_MSG_NOSIGNAL`]
238    [
239      Kernel support for MSG_NOSIGNAL.
240    ]
241    []
242  ]
243  [
244    [`BOOST_ASIO_HAS_NOEXCEPT`]
245    [
246      Support noexcept on compilers known to allow it.
247    ]
248    [`BOOST_ASIO_DISABLE_NOEXCEPT`]
249  ]
250  [
251    [`BOOST_ASIO_HAS_NULLPTR`]
252    [
253      Standard library support for the nullptr_t type.
254    ]
255    [`BOOST_ASIO_DISABLE_NULLPTR`]
256  ]
257  [
258    [`BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR`]
259    [
260      POSIX: stream-oriented file descriptors.
261    ]
262    [`BOOST_ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR`]
263  ]
264  [
265    [`BOOST_ASIO_HAS_PTHREADS`]
266    [
267      POSIX threads.
268    ]
269    []
270  ]
271  [
272    [`BOOST_ASIO_HAS_REF_QUALIFIED_FUNCTIONS`]
273    [
274      Support ref-qualified functions on compilers known to allow it.
275    ]
276    [`BOOST_ASIO_DISABLE_REF_QUALIFIED_FUNCTIONS`]
277  ]
278  [
279    [`BOOST_ASIO_HAS_RETURN_TYPE_DEDUCTION`]
280    [
281      Support return type deduction on compilers known to allow it.
282    ]
283    [`BOOST_ASIO_DISABLE_RETURN_TYPE_DEDUCTION`]
284  ]
285  [
286    [`BOOST_ASIO_HAS_SECURE_RTL`]
287    [
288      Microsoft Visual C++'s secure C runtime library.
289    ]
290    [`BOOST_ASIO_DISABLE_SECURE_RTL`]
291  ]
292  [
293    [`BOOST_ASIO_HAS_SERIAL_PORT`]
294    [
295      Serial ports.
296    ]
297    [`BOOST_ASIO_DISABLE_SERIAL_PORT`]
298  ]
299  [
300    [`BOOST_ASIO_HAS_SFINAE_VARIABLE_TEMPLATES`]
301    [
302      Support SFINAEd template variables on compilers known to allow it.
303    ]
304    [`BOOST_ASIO_DISABLE_SFINAE_VARIABLE_TEMPLATES`]
305  ]
306  [
307    [`BOOST_ASIO_HAS_SIGACTION`]
308    [
309      Can use sigaction() instead of signal().
310    ]
311    [`BOOST_ASIO_DISABLE_SIGACTION`]
312  ]
313  [
314    [`BOOST_ASIO_HAS_SIGNAL`]
315    [
316      Can use signal().
317    ]
318    [`BOOST_ASIO_DISABLE_SIGNAL`]
319  ]
320  [
321    [`BOOST_ASIO_HAS_SOURCE_LOCATION`]
322    [
323      Standard library has a source_location that we can use.
324    ]
325    [`BOOST_ASIO_DISABLE_SOURCE_LOCATION`]
326  ]
327  [
328    [`BOOST_ASIO_HAS_SSIZE_T`]
329    [
330      Support for POSIX ssize_t typedef.
331    ]
332    [`BOOST_ASIO_DISABLE_SSIZE_T`]
333  ]
334  [
335    [`BOOST_ASIO_HAS_STD_ADDRESSOF`]
336    [
337      Standard library support for addressof.
338    ]
339    [`BOOST_ASIO_DISABLE_STD_ADDRESSOF`]
340  ]
341  [
342    [`BOOST_ASIO_HAS_STD_ALLOCATOR_ARG`]
343    [
344      Standard library support for allocator_arg_t.
345    ]
346    [`BOOST_ASIO_DISABLE_STD_ALLOCATOR_ARG`]
347  ]
348  [
349    [`BOOST_ASIO_HAS_STD_ANY`]
350    [
351      Standard library support for std::any.
352    ]
353    [`BOOST_ASIO_DISABLE_STD_ANY`]
354  ]
355  [
356    [`BOOST_ASIO_HAS_STD_ARRAY`]
357    [
358      Standard library support for arrays.
359    ]
360    [`BOOST_ASIO_DISABLE_STD_ARRAY`]
361  ]
362  [
363    [`BOOST_ASIO_HAS_STD_ATOMIC`]
364    [
365      Standard library support for atomic operations.
366    ]
367    [`BOOST_ASIO_DISABLE_STD_ATOMIC`]
368  ]
369  [
370    [`BOOST_ASIO_HAS_STD_CALL_ONCE`]
371    [
372      Standard library support for the call_once function.
373    ]
374    [`BOOST_ASIO_DISABLE_STD_CALL_ONCE`]
375  ]
376  [
377    [`BOOST_ASIO_HAS_STD_CHRONO`]
378    [
379      Standard library support for chrono. Some standard libraries (such as the
380      libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
381      drafts, rather than the eventually standardised name of steady_clock.
382    ]
383    [`BOOST_ASIO_DISABLE_STD_CHRONO`]
384  ]
385  [
386    [`BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK`]
387    [
388      Standard library support for chrono. Some standard libraries (such as the
389      libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
390      drafts, rather than the eventually standardised name of steady_clock.
391    ]
392    []
393  ]
394  [
395    [`BOOST_ASIO_HAS_STD_COROUTINE`]
396    [
397      Standard library support for coroutines.
398    ]
399    [`BOOST_ASIO_DISABLE_STD_COROUTINE`]
400  ]
401  [
402    [`BOOST_ASIO_HAS_STD_EXCEPTION_PTR`]
403    [
404      Standard library support for std::exception_ptr and std::current_exception.
405    ]
406    [`BOOST_ASIO_DISABLE_STD_EXCEPTION_PTR`]
407  ]
408  [
409    [`BOOST_ASIO_HAS_STD_EXPERIMENTAL_SOURCE_LOCATION`]
410    [
411      Standard library support for std::experimental::source_location.
412    ]
413    [`BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_SOURCE_LOCATION`]
414  ]
415  [
416    [`BOOST_ASIO_HAS_STD_EXPERIMENTAL_STRING_VIEW`]
417    [
418      Standard library support for std::experimental::string_view.
419    ]
420    [`BOOST_ASIO_DISABLE_STD_EXPERIMENTAL_STRING_VIEW`]
421  ]
422  [
423    [`BOOST_ASIO_HAS_STD_FUNCTION`]
424    [
425      Standard library support for the function class.
426    ]
427    [`BOOST_ASIO_DISABLE_STD_FUNCTION`]
428  ]
429  [
430    [`BOOST_ASIO_HAS_STD_FUTURE`]
431    [
432      Standard library support for futures.
433    ]
434    [`BOOST_ASIO_DISABLE_STD_FUTURE`]
435  ]
436  [
437    [`BOOST_ASIO_HAS_STD_INVOKE_RESULT`]
438    [
439      Standard library has invoke_result (which supersedes result_of).
440    ]
441    [`BOOST_ASIO_DISABLE_STD_INVOKE_RESULT`]
442  ]
443  [
444    [`BOOST_ASIO_HAS_STD_IOSTREAM_MOVE`]
445    [
446      Standard library support for iostream move construction and assignment.
447    ]
448    [`BOOST_ASIO_DISABLE_STD_IOSTREAM_MOVE`]
449  ]
450  [
451    [`BOOST_ASIO_HAS_STD_MUTEX_AND_CONDVAR`]
452    [
453      Standard library support for the mutex and condition variable classes.
454    ]
455    [`BOOST_ASIO_DISABLE_STD_MUTEX_AND_CONDVAR`]
456  ]
457  [
458    [`BOOST_ASIO_HAS_STD_NESTED_EXCEPTION`]
459    [
460      Standard library support for std::nested_exception.
461    ]
462    [`BOOST_ASIO_DISABLE_STD_NESTED_EXCEPTION`]
463  ]
464  [
465    [`BOOST_ASIO_HAS_STD_SHARED_PTR`]
466    [
467      Standard library support for shared_ptr and weak_ptr.
468    ]
469    [`BOOST_ASIO_DISABLE_STD_SHARED_PTR`]
470  ]
471  [
472    [`BOOST_ASIO_HAS_STD_STRING_VIEW`]
473    [
474      Standard library support for std::string_view.
475    ]
476    [`BOOST_ASIO_DISABLE_STD_STRING_VIEW`]
477  ]
478  [
479    [`BOOST_ASIO_HAS_STD_SYSTEM_ERROR`]
480    [
481      Standard library support for system errors.
482    ]
483    [`BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR`]
484  ]
485  [
486    [`BOOST_ASIO_HAS_STD_THREAD`]
487    [
488      Standard library support for the thread class.
489    ]
490    [`BOOST_ASIO_DISABLE_STD_THREAD`]
491  ]
492  [
493    [`BOOST_ASIO_HAS_STD_TYPE_TRAITS`]
494    [
495      Standard library support for type traits.
496    ]
497    [`BOOST_ASIO_DISABLE_STD_TYPE_TRAITS`]
498  ]
499  [
500    [`BOOST_ASIO_HAS_STRING_VIEW`]
501    [
502      Standard library has a string_view that we can use.
503    ]
504    [`BOOST_ASIO_DISABLE_STRING_VIEW`]
505  ]
506  [
507    [`BOOST_ASIO_HAS_THREADS`]
508    [
509      Threads.
510    ]
511    [`BOOST_ASIO_DISABLE_THREADS`]
512  ]
513  [
514    [`BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION`]
515    [
516      Support for the __thread keyword extension.
517    ]
518    [`BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION`]
519  ]
520  [
521    [`BOOST_ASIO_HAS_TIMERFD`]
522    [
523      Linux: epoll, eventfd and timerfd.
524    ]
525    []
526  ]
527  [
528    [`BOOST_ASIO_HAS_UNISTD_H`]
529    [
530      On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
531      get access to the various platform feature macros, e.g. to be able to test
532      for threads support.
533    ]
534    []
535  ]
536  [
537    [`BOOST_ASIO_HAS_VARIABLE_TEMPLATES`]
538    [
539      Support template variables on compilers known to allow it.
540    ]
541    [`BOOST_ASIO_DISABLE_VARIABLE_TEMPLATES`]
542  ]
543  [
544    [`BOOST_ASIO_HAS_VARIADIC_TEMPLATES`]
545    [
546      Support variadic templates on compilers known to allow it.
547    ]
548    [`BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES`]
549  ]
550  [
551    [`BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE`]
552    [
553      Windows: object handles.
554    ]
555    [`BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE`]
556  ]
557  [
558    [`BOOST_ASIO_HAS_WINDOWS_OVERLAPPED_PTR`]
559    [
560      Windows: OVERLAPPED wrapper.
561    ]
562    [`BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR`]
563  ]
564  [
565    [`BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE`]
566    [
567      Windows: random access handles.
568    ]
569    [`BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE`]
570  ]
571  [
572    [`BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE`]
573    [
574      Windows: stream handles.
575    ]
576    [`BOOST_ASIO_DISABLE_WINDOWS_STREAM_HANDLE`]
577  ]
578  [
579    [`BOOST_ASIO_HAS_WORKING_EXPRESSION_SFINAE`]
580    [
581      Enable workarounds for lack of working expression SFINAE.
582    ]
583    [`BOOST_ASIO_DISABLE_WORKING_EXPRESSION_SFINAE`]
584  ]
585]
586