Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1157 lines
43KB

  1. //
  2. // detail/config.hpp
  3. // ~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef ASIO_DETAIL_CONFIG_HPP
  11. #define ASIO_DETAIL_CONFIG_HPP
  12. #if defined(ASIO_STANDALONE)
  13. # define ASIO_DISABLE_BOOST_ARRAY 1
  14. # define ASIO_DISABLE_BOOST_ASSERT 1
  15. # define ASIO_DISABLE_BOOST_BIND 1
  16. # define ASIO_DISABLE_BOOST_CHRONO 1
  17. # define ASIO_DISABLE_BOOST_DATE_TIME 1
  18. # define ASIO_DISABLE_BOOST_LIMITS 1
  19. # define ASIO_DISABLE_BOOST_REGEX 1
  20. # define ASIO_DISABLE_BOOST_STATIC_CONSTANT 1
  21. # define ASIO_DISABLE_BOOST_THROW_EXCEPTION 1
  22. # define ASIO_DISABLE_BOOST_WORKAROUND 1
  23. #else // defined(ASIO_STANDALONE)
  24. # include <boost/config.hpp>
  25. # include <boost/version.hpp>
  26. # define ASIO_HAS_BOOST_CONFIG 1
  27. #endif // defined(ASIO_STANDALONE)
  28. // Default to a header-only implementation. The user must specifically request
  29. // separate compilation by defining either ASIO_SEPARATE_COMPILATION or
  30. // ASIO_DYN_LINK (as a DLL/shared library implies separate compilation).
  31. #if !defined(ASIO_HEADER_ONLY)
  32. # if !defined(ASIO_SEPARATE_COMPILATION)
  33. # if !defined(ASIO_DYN_LINK)
  34. # define ASIO_HEADER_ONLY 1
  35. # endif // !defined(ASIO_DYN_LINK)
  36. # endif // !defined(ASIO_SEPARATE_COMPILATION)
  37. #endif // !defined(ASIO_HEADER_ONLY)
  38. #if defined(ASIO_HEADER_ONLY)
  39. # define ASIO_DECL inline
  40. #else // defined(ASIO_HEADER_ONLY)
  41. # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
  42. // We need to import/export our code only if the user has specifically asked
  43. // for it by defining ASIO_DYN_LINK.
  44. # if defined(ASIO_DYN_LINK)
  45. // Export if this is our own source, otherwise import.
  46. # if defined(ASIO_SOURCE)
  47. # define ASIO_DECL __declspec(dllexport)
  48. # else // defined(ASIO_SOURCE)
  49. # define ASIO_DECL __declspec(dllimport)
  50. # endif // defined(ASIO_SOURCE)
  51. # endif // defined(ASIO_DYN_LINK)
  52. # endif // defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CODEGEARC__)
  53. #endif // defined(ASIO_HEADER_ONLY)
  54. // If ASIO_DECL isn't defined yet define it now.
  55. #if !defined(ASIO_DECL)
  56. # define ASIO_DECL
  57. #endif // !defined(ASIO_DECL)
  58. // Microsoft Visual C++ detection.
  59. #if !defined(ASIO_MSVC)
  60. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
  61. # define ASIO_MSVC BOOST_MSVC
  62. # elif defined(_MSC_VER) && !defined(__MWERKS__) && !defined(__EDG_VERSION__)
  63. # define ASIO_MSVC _MSC_VER
  64. # endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_MSVC)
  65. #endif // defined(ASIO_MSVC)
  66. // Clang / libc++ detection.
  67. #if defined(__clang__)
  68. # if (__cplusplus >= 201103)
  69. # if __has_include(<__config>)
  70. # include <__config>
  71. # if defined(_LIBCPP_VERSION)
  72. # define ASIO_HAS_CLANG_LIBCXX 1
  73. # endif // defined(_LIBCPP_VERSION)
  74. # endif // __has_include(<__config>)
  75. # endif // (__cplusplus >= 201103)
  76. #endif // defined(__clang__)
  77. // Support move construction and assignment on compilers known to allow it.
  78. #if !defined(ASIO_HAS_MOVE)
  79. # if !defined(ASIO_DISABLE_MOVE)
  80. # if defined(__clang__)
  81. # if __has_feature(__cxx_rvalue_references__)
  82. # define ASIO_HAS_MOVE 1
  83. # endif // __has_feature(__cxx_rvalue_references__)
  84. # endif // defined(__clang__)
  85. # if defined(__GNUC__)
  86. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  87. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  88. # define ASIO_HAS_MOVE 1
  89. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  90. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  91. # endif // defined(__GNUC__)
  92. # if defined(ASIO_MSVC)
  93. # if (_MSC_VER >= 1700)
  94. # define ASIO_HAS_MOVE 1
  95. # endif // (_MSC_VER >= 1700)
  96. # endif // defined(ASIO_MSVC)
  97. # endif // !defined(ASIO_DISABLE_MOVE)
  98. #endif // !defined(ASIO_HAS_MOVE)
  99. // If ASIO_MOVE_CAST isn't defined, and move support is available, define
  100. // ASIO_MOVE_ARG and ASIO_MOVE_CAST to take advantage of rvalue
  101. // references and perfect forwarding.
  102. #if defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST)
  103. # define ASIO_MOVE_ARG(type) type&&
  104. # define ASIO_MOVE_ARG2(type1, type2) type1, type2&&
  105. # define ASIO_MOVE_CAST(type) static_cast<type&&>
  106. # define ASIO_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
  107. #endif // defined(ASIO_HAS_MOVE) && !defined(ASIO_MOVE_CAST)
  108. // If ASIO_MOVE_CAST still isn't defined, default to a C++03-compatible
  109. // implementation. Note that older g++ and MSVC versions don't like it when you
  110. // pass a non-member function through a const reference, so for most compilers
  111. // we'll play it safe and stick with the old approach of passing the handler by
  112. // value.
  113. #if !defined(ASIO_MOVE_CAST)
  114. # if defined(__GNUC__)
  115. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
  116. # define ASIO_MOVE_ARG(type) const type&
  117. # else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
  118. # define ASIO_MOVE_ARG(type) type
  119. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4)
  120. # elif defined(ASIO_MSVC)
  121. # if (_MSC_VER >= 1400)
  122. # define ASIO_MOVE_ARG(type) const type&
  123. # else // (_MSC_VER >= 1400)
  124. # define ASIO_MOVE_ARG(type) type
  125. # endif // (_MSC_VER >= 1400)
  126. # else
  127. # define ASIO_MOVE_ARG(type) type
  128. # endif
  129. # define ASIO_MOVE_CAST(type) static_cast<const type&>
  130. # define ASIO_MOVE_CAST2(type1, type2) static_cast<const type1, type2&>
  131. #endif // !defined(ASIO_MOVE_CAST)
  132. // Support variadic templates on compilers known to allow it.
  133. #if !defined(ASIO_HAS_VARIADIC_TEMPLATES)
  134. # if !defined(ASIO_DISABLE_VARIADIC_TEMPLATES)
  135. # if defined(__clang__)
  136. # if __has_feature(__cxx_variadic_templates__)
  137. # define ASIO_HAS_VARIADIC_TEMPLATES 1
  138. # endif // __has_feature(__cxx_variadic_templates__)
  139. # endif // defined(__clang__)
  140. # if defined(__GNUC__)
  141. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  142. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  143. # define ASIO_HAS_VARIADIC_TEMPLATES 1
  144. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  145. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  146. # endif // defined(__GNUC__)
  147. # endif // !defined(ASIO_DISABLE_VARIADIC_TEMPLATES)
  148. #endif // !defined(ASIO_HAS_VARIADIC_TEMPLATES)
  149. // Support deleted functions on compilers known to allow it.
  150. #if !defined(ASIO_DELETED)
  151. # if defined(__GNUC__)
  152. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  153. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  154. # define ASIO_DELETED = delete
  155. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  156. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  157. # endif // defined(__GNUC__)
  158. # if defined(__clang__)
  159. # if __has_feature(__cxx_deleted_functions__)
  160. # define ASIO_DELETED = delete
  161. # endif // __has_feature(__cxx_deleted_functions__)
  162. # endif // defined(__clang__)
  163. # if !defined(ASIO_DELETED)
  164. # define ASIO_DELETED
  165. # endif // !defined(ASIO_DELETED)
  166. #endif // !defined(ASIO_DELETED)
  167. // Support constexpr on compilers known to allow it.
  168. #if !defined(ASIO_HAS_CONSTEXPR)
  169. # if !defined(ASIO_DISABLE_CONSTEXPR)
  170. # if defined(__clang__)
  171. # if __has_feature(__cxx_constexpr__)
  172. # define ASIO_HAS_CONSTEXPR 1
  173. # endif // __has_feature(__cxx_constexr__)
  174. # endif // defined(__clang__)
  175. # if defined(__GNUC__)
  176. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  177. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  178. # define ASIO_HAS_CONSTEXPR 1
  179. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  180. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  181. # endif // defined(__GNUC__)
  182. # endif // !defined(ASIO_DISABLE_CONSTEXPR)
  183. #endif // !defined(ASIO_HAS_CONSTEXPR)
  184. #if !defined(ASIO_CONSTEXPR)
  185. # if defined(ASIO_HAS_CONSTEXPR)
  186. # define ASIO_CONSTEXPR constexpr
  187. # else // defined(ASIO_HAS_CONSTEXPR)
  188. # define ASIO_CONSTEXPR
  189. # endif // defined(ASIO_HAS_CONSTEXPR)
  190. #endif // !defined(ASIO_CONSTEXPR)
  191. // Support noexcept on compilers known to allow it.
  192. #if !defined(ASIO_NOEXCEPT)
  193. # if !defined(ASIO_DISABLE_NOEXCEPT)
  194. # if (BOOST_VERSION >= 105300)
  195. # define ASIO_NOEXCEPT BOOST_NOEXCEPT
  196. # define ASIO_NOEXCEPT_OR_NOTHROW BOOST_NOEXCEPT_OR_NOTHROW
  197. # elif defined(__clang__)
  198. # if __has_feature(__cxx_noexcept__)
  199. # define ASIO_NOEXCEPT noexcept(true)
  200. # define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
  201. # endif // __has_feature(__cxx_noexcept__)
  202. # elif defined(__GNUC__)
  203. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  204. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  205. # define ASIO_NOEXCEPT noexcept(true)
  206. # define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
  207. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  208. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  209. # elif defined(ASIO_MSVC)
  210. # if (_MSC_VER >= 1900)
  211. # define ASIO_NOEXCEPT noexcept(true)
  212. # define ASIO_NOEXCEPT_OR_NOTHROW noexcept(true)
  213. # endif // (_MSC_VER >= 1900)
  214. # endif // defined(ASIO_MSVC)
  215. # endif // !defined(ASIO_DISABLE_NOEXCEPT)
  216. # if !defined(ASIO_NOEXCEPT)
  217. # define ASIO_NOEXCEPT
  218. # endif // !defined(ASIO_NOEXCEPT)
  219. # if !defined(ASIO_NOEXCEPT_OR_NOTHROW)
  220. # define ASIO_NOEXCEPT_OR_NOTHROW throw()
  221. # endif // !defined(ASIO_NOEXCEPT_OR_NOTHROW)
  222. #endif // !defined(ASIO_NOEXCEPT)
  223. // Support automatic type deduction on compilers known to support it.
  224. #if !defined(ASIO_HAS_DECLTYPE)
  225. # if !defined(ASIO_DISABLE_DECLTYPE)
  226. # if defined(__clang__)
  227. # if __has_feature(__cxx_decltype__)
  228. # define ASIO_HAS_DECLTYPE 1
  229. # endif // __has_feature(__cxx_decltype__)
  230. # endif // defined(__clang__)
  231. # if defined(__GNUC__)
  232. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  233. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  234. # define ASIO_HAS_DECLTYPE 1
  235. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  236. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  237. # endif // defined(__GNUC__)
  238. # if defined(ASIO_MSVC)
  239. # if (_MSC_VER >= 1700)
  240. # define ASIO_HAS_DECLTYPE 1
  241. # endif // (_MSC_VER >= 1700)
  242. # endif // defined(ASIO_MSVC)
  243. # endif // !defined(ASIO_DISABLE_DECLTYPE)
  244. #endif // !defined(ASIO_HAS_DECLTYPE)
  245. // Standard library support for system errors.
  246. #if !defined(ASIO_HAS_STD_SYSTEM_ERROR)
  247. # if !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
  248. # if defined(__clang__)
  249. # if defined(ASIO_HAS_CLANG_LIBCXX)
  250. # define ASIO_HAS_STD_SYSTEM_ERROR 1
  251. # elif (__cplusplus >= 201103)
  252. # if __has_include(<system_error>)
  253. # define ASIO_HAS_STD_SYSTEM_ERROR 1
  254. # endif // __has_include(<system_error>)
  255. # endif // (__cplusplus >= 201103)
  256. # endif // defined(__clang__)
  257. # if defined(__GNUC__)
  258. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  259. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  260. # define ASIO_HAS_STD_SYSTEM_ERROR 1
  261. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  262. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  263. # endif // defined(__GNUC__)
  264. # if defined(ASIO_MSVC)
  265. # if (_MSC_VER >= 1700)
  266. # define ASIO_HAS_STD_SYSTEM_ERROR 1
  267. # endif // (_MSC_VER >= 1700)
  268. # endif // defined(ASIO_MSVC)
  269. # endif // !defined(ASIO_DISABLE_STD_SYSTEM_ERROR)
  270. #endif // !defined(ASIO_HAS_STD_SYSTEM_ERROR)
  271. // Compliant C++11 compilers put noexcept specifiers on error_category members.
  272. #if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
  273. # if (BOOST_VERSION >= 105300)
  274. # define ASIO_ERROR_CATEGORY_NOEXCEPT BOOST_NOEXCEPT
  275. # elif defined(__clang__)
  276. # if __has_feature(__cxx_noexcept__)
  277. # define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
  278. # endif // __has_feature(__cxx_noexcept__)
  279. # elif defined(__GNUC__)
  280. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  281. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  282. # define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
  283. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  284. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  285. # elif defined(ASIO_MSVC)
  286. # if (_MSC_VER >= 1900)
  287. # define ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true)
  288. # endif // (_MSC_VER >= 1900)
  289. # endif // defined(ASIO_MSVC)
  290. # if !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
  291. # define ASIO_ERROR_CATEGORY_NOEXCEPT
  292. # endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
  293. #endif // !defined(ASIO_ERROR_CATEGORY_NOEXCEPT)
  294. // Standard library support for arrays.
  295. #if !defined(ASIO_HAS_STD_ARRAY)
  296. # if !defined(ASIO_DISABLE_STD_ARRAY)
  297. # if defined(__clang__)
  298. # if defined(ASIO_HAS_CLANG_LIBCXX)
  299. # define ASIO_HAS_STD_ARRAY 1
  300. # elif (__cplusplus >= 201103)
  301. # if __has_include(<array>)
  302. # define ASIO_HAS_STD_ARRAY 1
  303. # endif // __has_include(<array>)
  304. # endif // (__cplusplus >= 201103)
  305. # endif // defined(__clang__)
  306. # if defined(__GNUC__)
  307. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  308. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  309. # define ASIO_HAS_STD_ARRAY 1
  310. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  311. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  312. # endif // defined(__GNUC__)
  313. # if defined(ASIO_MSVC)
  314. # if (_MSC_VER >= 1600)
  315. # define ASIO_HAS_STD_ARRAY 1
  316. # endif // (_MSC_VER >= 1600)
  317. # endif // defined(ASIO_MSVC)
  318. # endif // !defined(ASIO_DISABLE_STD_ARRAY)
  319. #endif // !defined(ASIO_HAS_STD_ARRAY)
  320. // Standard library support for shared_ptr and weak_ptr.
  321. #if !defined(ASIO_HAS_STD_SHARED_PTR)
  322. # if !defined(ASIO_DISABLE_STD_SHARED_PTR)
  323. # if defined(__clang__)
  324. # if defined(ASIO_HAS_CLANG_LIBCXX)
  325. # define ASIO_HAS_STD_SHARED_PTR 1
  326. # elif (__cplusplus >= 201103)
  327. # define ASIO_HAS_STD_SHARED_PTR 1
  328. # endif // (__cplusplus >= 201103)
  329. # endif // defined(__clang__)
  330. # if defined(__GNUC__)
  331. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  332. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  333. # define ASIO_HAS_STD_SHARED_PTR 1
  334. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  335. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4)
  336. # endif // defined(__GNUC__)
  337. # if defined(ASIO_MSVC)
  338. # if (_MSC_VER >= 1600)
  339. # define ASIO_HAS_STD_SHARED_PTR 1
  340. # endif // (_MSC_VER >= 1600)
  341. # endif // defined(ASIO_MSVC)
  342. # endif // !defined(ASIO_DISABLE_STD_SHARED_PTR)
  343. #endif // !defined(ASIO_HAS_STD_SHARED_PTR)
  344. // Standard library support for allocator_arg_t.
  345. #if !defined(ASIO_HAS_STD_ALLOCATOR_ARG)
  346. # if !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG)
  347. # if defined(__clang__)
  348. # if defined(ASIO_HAS_CLANG_LIBCXX)
  349. # define ASIO_HAS_STD_ALLOCATOR_ARG 1
  350. # elif (__cplusplus >= 201103)
  351. # define ASIO_HAS_STD_ALLOCATOR_ARG 1
  352. # endif // (__cplusplus >= 201103)
  353. # endif // defined(__clang__)
  354. # if defined(__GNUC__)
  355. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  356. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  357. # define ASIO_HAS_STD_ALLOCATOR_ARG 1
  358. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  359. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  360. # endif // defined(__GNUC__)
  361. # if defined(ASIO_MSVC)
  362. # if (_MSC_VER >= 1600)
  363. # define ASIO_HAS_STD_ALLOCATOR_ARG 1
  364. # endif // (_MSC_VER >= 1600)
  365. # endif // defined(ASIO_MSVC)
  366. # endif // !defined(ASIO_DISABLE_STD_ALLOCATOR_ARG)
  367. #endif // !defined(ASIO_HAS_STD_ALLOCATOR_ARG)
  368. // Standard library support for atomic operations.
  369. #if !defined(ASIO_HAS_STD_ATOMIC)
  370. # if !defined(ASIO_DISABLE_STD_ATOMIC)
  371. # if defined(__clang__)
  372. # if defined(ASIO_HAS_CLANG_LIBCXX)
  373. # define ASIO_HAS_STD_ATOMIC 1
  374. # elif (__cplusplus >= 201103)
  375. # if __has_include(<atomic>)
  376. # define ASIO_HAS_STD_ATOMIC 1
  377. # endif // __has_include(<atomic>)
  378. # endif // (__cplusplus >= 201103)
  379. # endif // defined(__clang__)
  380. # if defined(__GNUC__)
  381. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  382. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  383. # define ASIO_HAS_STD_ATOMIC 1
  384. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  385. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  386. # endif // defined(__GNUC__)
  387. # if defined(ASIO_MSVC)
  388. # if (_MSC_VER >= 1700)
  389. # define ASIO_HAS_STD_ATOMIC 1
  390. # endif // (_MSC_VER >= 1700)
  391. # endif // defined(ASIO_MSVC)
  392. # endif // !defined(ASIO_DISABLE_STD_ATOMIC)
  393. #endif // !defined(ASIO_HAS_STD_ATOMIC)
  394. // Standard library support for chrono. Some standard libraries (such as the
  395. // libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x
  396. // drafts, rather than the eventually standardised name of steady_clock.
  397. #if !defined(ASIO_HAS_STD_CHRONO)
  398. # if !defined(ASIO_DISABLE_STD_CHRONO)
  399. # if defined(__clang__)
  400. # if defined(ASIO_HAS_CLANG_LIBCXX)
  401. # define ASIO_HAS_STD_CHRONO 1
  402. # elif (__cplusplus >= 201103)
  403. # if __has_include(<chrono>)
  404. # define ASIO_HAS_STD_CHRONO 1
  405. # endif // __has_include(<chrono>)
  406. # endif // (__cplusplus >= 201103)
  407. # endif // defined(__clang__)
  408. # if defined(__GNUC__)
  409. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  410. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  411. # define ASIO_HAS_STD_CHRONO 1
  412. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
  413. # define ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK 1
  414. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6))
  415. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  416. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  417. # endif // defined(__GNUC__)
  418. # if defined(ASIO_MSVC)
  419. # if (_MSC_VER >= 1700)
  420. # define ASIO_HAS_STD_CHRONO 1
  421. # endif // (_MSC_VER >= 1700)
  422. # endif // defined(ASIO_MSVC)
  423. # endif // !defined(ASIO_DISABLE_STD_CHRONO)
  424. #endif // !defined(ASIO_HAS_STD_CHRONO)
  425. // Boost support for chrono.
  426. #if !defined(ASIO_HAS_BOOST_CHRONO)
  427. # if !defined(ASIO_DISABLE_BOOST_CHRONO)
  428. # if (BOOST_VERSION >= 104700)
  429. # define ASIO_HAS_BOOST_CHRONO 1
  430. # endif // (BOOST_VERSION >= 104700)
  431. # endif // !defined(ASIO_DISABLE_BOOST_CHRONO)
  432. #endif // !defined(ASIO_HAS_BOOST_CHRONO)
  433. // Some form of chrono library is available.
  434. #if !defined(ASIO_HAS_CHRONO)
  435. # if defined(ASIO_HAS_STD_CHRONO) \
  436. || defined(ASIO_HAS_BOOST_CHRONO)
  437. # define ASIO_HAS_CHRONO 1
  438. # endif // defined(ASIO_HAS_STD_CHRONO)
  439. // || defined(ASIO_HAS_BOOST_CHRONO)
  440. #endif // !defined(ASIO_HAS_CHRONO)
  441. // Boost support for the DateTime library.
  442. #if !defined(ASIO_HAS_BOOST_DATE_TIME)
  443. # if !defined(ASIO_DISABLE_BOOST_DATE_TIME)
  444. # define ASIO_HAS_BOOST_DATE_TIME 1
  445. # endif // !defined(ASIO_DISABLE_BOOST_DATE_TIME)
  446. #endif // !defined(ASIO_HAS_BOOST_DATE_TIME)
  447. // Standard library support for addressof.
  448. #if !defined(ASIO_HAS_STD_ADDRESSOF)
  449. # if !defined(ASIO_DISABLE_STD_ADDRESSOF)
  450. # if defined(__clang__)
  451. # if defined(ASIO_HAS_CLANG_LIBCXX)
  452. # define ASIO_HAS_STD_ADDRESSOF 1
  453. # elif (__cplusplus >= 201103)
  454. # define ASIO_HAS_STD_ADDRESSOF 1
  455. # endif // (__cplusplus >= 201103)
  456. # endif // defined(__clang__)
  457. # if defined(__GNUC__)
  458. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  459. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  460. # define ASIO_HAS_STD_ADDRESSOF 1
  461. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  462. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  463. # endif // defined(__GNUC__)
  464. # if defined(ASIO_MSVC)
  465. # if (_MSC_VER >= 1700)
  466. # define ASIO_HAS_STD_ADDRESSOF 1
  467. # endif // (_MSC_VER >= 1700)
  468. # endif // defined(ASIO_MSVC)
  469. # endif // !defined(ASIO_DISABLE_STD_ADDRESSOF)
  470. #endif // !defined(ASIO_HAS_STD_ADDRESSOF)
  471. // Standard library support for the function class.
  472. #if !defined(ASIO_HAS_STD_FUNCTION)
  473. # if !defined(ASIO_DISABLE_STD_FUNCTION)
  474. # if defined(__clang__)
  475. # if defined(ASIO_HAS_CLANG_LIBCXX)
  476. # define ASIO_HAS_STD_FUNCTION 1
  477. # elif (__cplusplus >= 201103)
  478. # define ASIO_HAS_STD_FUNCTION 1
  479. # endif // (__cplusplus >= 201103)
  480. # endif // defined(__clang__)
  481. # if defined(__GNUC__)
  482. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  483. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  484. # define ASIO_HAS_STD_FUNCTION 1
  485. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  486. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  487. # endif // defined(__GNUC__)
  488. # if defined(ASIO_MSVC)
  489. # if (_MSC_VER >= 1700)
  490. # define ASIO_HAS_STD_FUNCTION 1
  491. # endif // (_MSC_VER >= 1700)
  492. # endif // defined(ASIO_MSVC)
  493. # endif // !defined(ASIO_DISABLE_STD_FUNCTION)
  494. #endif // !defined(ASIO_HAS_STD_FUNCTION)
  495. // Standard library support for type traits.
  496. #if !defined(ASIO_HAS_STD_TYPE_TRAITS)
  497. # if !defined(ASIO_DISABLE_STD_TYPE_TRAITS)
  498. # if defined(__clang__)
  499. # if defined(ASIO_HAS_CLANG_LIBCXX)
  500. # define ASIO_HAS_STD_TYPE_TRAITS 1
  501. # elif (__cplusplus >= 201103)
  502. # if __has_include(<type_traits>)
  503. # define ASIO_HAS_STD_TYPE_TRAITS 1
  504. # endif // __has_include(<type_traits>)
  505. # endif // (__cplusplus >= 201103)
  506. # endif // defined(__clang__)
  507. # if defined(__GNUC__)
  508. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  509. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  510. # define ASIO_HAS_STD_TYPE_TRAITS 1
  511. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  512. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  513. # endif // defined(__GNUC__)
  514. # if defined(ASIO_MSVC)
  515. # if (_MSC_VER >= 1700)
  516. # define ASIO_HAS_STD_TYPE_TRAITS 1
  517. # endif // (_MSC_VER >= 1700)
  518. # endif // defined(ASIO_MSVC)
  519. # endif // !defined(ASIO_DISABLE_STD_TYPE_TRAITS)
  520. #endif // !defined(ASIO_HAS_STD_TYPE_TRAITS)
  521. // Standard library support for the nullptr_t type.
  522. #if !defined(ASIO_HAS_NULLPTR)
  523. # if !defined(ASIO_DISABLE_NULLPTR)
  524. # if defined(__clang__)
  525. # if __has_feature(__cxx_nullptr__)
  526. # define ASIO_HAS_NULLPTR 1
  527. # endif // __has_feature(__cxx_rvalue_references__)
  528. # elif defined(__GNUC__)
  529. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  530. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  531. # define ASIO_HAS_NULLPTR 1
  532. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  533. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
  534. # endif // defined(__GNUC__)
  535. # if defined(ASIO_MSVC)
  536. # if (_MSC_VER >= 1700)
  537. # define ASIO_HAS_NULLPTR 1
  538. # endif // (_MSC_VER >= 1700)
  539. # endif // defined(ASIO_MSVC)
  540. # endif // !defined(ASIO_DISABLE_NULLPTR)
  541. #endif // !defined(ASIO_HAS_NULLPTR)
  542. // Standard library support for the cstdint header.
  543. #if !defined(ASIO_HAS_CSTDINT)
  544. # if !defined(ASIO_DISABLE_CSTDINT)
  545. # if defined(__clang__)
  546. # if defined(ASIO_HAS_CLANG_LIBCXX)
  547. # define ASIO_HAS_CSTDINT 1
  548. # elif (__cplusplus >= 201103)
  549. # define ASIO_HAS_CSTDINT 1
  550. # endif // (__cplusplus >= 201103)
  551. # endif // defined(__clang__)
  552. # if defined(__GNUC__)
  553. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  554. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  555. # define ASIO_HAS_CSTDINT 1
  556. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  557. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4)
  558. # endif // defined(__GNUC__)
  559. # if defined(ASIO_MSVC)
  560. # if (_MSC_VER >= 1700)
  561. # define ASIO_HAS_CSTDINT 1
  562. # endif // (_MSC_VER >= 1700)
  563. # endif // defined(ASIO_MSVC)
  564. # endif // !defined(ASIO_DISABLE_CSTDINT)
  565. #endif // !defined(ASIO_HAS_CSTDINT)
  566. // Standard library support for the thread class.
  567. #if !defined(ASIO_HAS_STD_THREAD)
  568. # if !defined(ASIO_DISABLE_STD_THREAD)
  569. # if defined(__clang__)
  570. # if defined(ASIO_HAS_CLANG_LIBCXX)
  571. # define ASIO_HAS_STD_THREAD 1
  572. # elif (__cplusplus >= 201103)
  573. # if __has_include(<thread>)
  574. # define ASIO_HAS_STD_THREAD 1
  575. # endif // __has_include(<thread>)
  576. # endif // (__cplusplus >= 201103)
  577. # endif // defined(__clang__)
  578. # if defined(__GNUC__)
  579. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  580. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  581. # define ASIO_HAS_STD_THREAD 1
  582. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  583. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  584. # endif // defined(__GNUC__)
  585. # if defined(ASIO_MSVC)
  586. # if (_MSC_VER >= 1700)
  587. # define ASIO_HAS_STD_THREAD 1
  588. # endif // (_MSC_VER >= 1700)
  589. # endif // defined(ASIO_MSVC)
  590. # endif // !defined(ASIO_DISABLE_STD_THREAD)
  591. #endif // !defined(ASIO_HAS_STD_THREAD)
  592. // Standard library support for the mutex and condition variable classes.
  593. #if !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR)
  594. # if !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
  595. # if defined(__clang__)
  596. # if defined(ASIO_HAS_CLANG_LIBCXX)
  597. # define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
  598. # elif (__cplusplus >= 201103)
  599. # if __has_include(<mutex>)
  600. # define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
  601. # endif // __has_include(<mutex>)
  602. # endif // (__cplusplus >= 201103)
  603. # endif // defined(__clang__)
  604. # if defined(__GNUC__)
  605. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  606. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  607. # define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
  608. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  609. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  610. # endif // defined(__GNUC__)
  611. # if defined(ASIO_MSVC)
  612. # if (_MSC_VER >= 1700)
  613. # define ASIO_HAS_STD_MUTEX_AND_CONDVAR 1
  614. # endif // (_MSC_VER >= 1700)
  615. # endif // defined(ASIO_MSVC)
  616. # endif // !defined(ASIO_DISABLE_STD_MUTEX_AND_CONDVAR)
  617. #endif // !defined(ASIO_HAS_STD_MUTEX_AND_CONDVAR)
  618. // Standard library support for the call_once function.
  619. #if !defined(ASIO_HAS_STD_CALL_ONCE)
  620. # if !defined(ASIO_DISABLE_STD_CALL_ONCE)
  621. # if defined(__clang__)
  622. # if defined(ASIO_HAS_CLANG_LIBCXX)
  623. # define ASIO_HAS_STD_CALL_ONCE 1
  624. # elif (__cplusplus >= 201103)
  625. # if __has_include(<mutex>)
  626. # define ASIO_HAS_STD_CALL_ONCE 1
  627. # endif // __has_include(<mutex>)
  628. # endif // (__cplusplus >= 201103)
  629. # endif // defined(__clang__)
  630. # if defined(__GNUC__)
  631. # if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  632. # if defined(__GXX_EXPERIMENTAL_CXX0X__)
  633. # define ASIO_HAS_STD_CALL_ONCE 1
  634. # endif // defined(__GXX_EXPERIMENTAL_CXX0X__)
  635. # endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
  636. # endif // defined(__GNUC__)
  637. # if defined(ASIO_MSVC)
  638. # if (_MSC_VER >= 1700)
  639. # define ASIO_HAS_STD_CALL_ONCE 1
  640. # endif // (_MSC_VER >= 1700)
  641. # endif // defined(ASIO_MSVC)
  642. # endif // !defined(ASIO_DISABLE_STD_CALL_ONCE)
  643. #endif // !defined(ASIO_HAS_STD_CALL_ONCE)
  644. // Windows App target. Windows but with a limited API.
  645. #if !defined(ASIO_WINDOWS_APP)
  646. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
  647. # include <winapifamily.h>
  648. # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
  649. && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  650. # define ASIO_WINDOWS_APP 1
  651. # endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
  652. // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  653. # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0603)
  654. #endif // !defined(ASIO_WINDOWS_APP)
  655. // Legacy WinRT target. Windows App is preferred.
  656. #if !defined(ASIO_WINDOWS_RUNTIME)
  657. # if !defined(ASIO_WINDOWS_APP)
  658. # if defined(__cplusplus_winrt)
  659. # include <winapifamily.h>
  660. # if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) \
  661. && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  662. # define ASIO_WINDOWS_RUNTIME 1
  663. # endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
  664. // && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
  665. # endif // defined(__cplusplus_winrt)
  666. # endif // !defined(ASIO_WINDOWS_APP)
  667. #endif // !defined(ASIO_WINDOWS_RUNTIME)
  668. // Windows target. Excludes WinRT but includes Windows App targets.
  669. #if !defined(ASIO_WINDOWS)
  670. # if !defined(ASIO_WINDOWS_RUNTIME)
  671. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
  672. # define ASIO_WINDOWS 1
  673. # elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
  674. # define ASIO_WINDOWS 1
  675. # elif defined(ASIO_WINDOWS_APP)
  676. # define ASIO_WINDOWS 1
  677. # endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_WINDOWS)
  678. # endif // !defined(ASIO_WINDOWS_RUNTIME)
  679. #endif // !defined(ASIO_WINDOWS)
  680. // Windows: target OS version.
  681. #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  682. # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  683. # if defined(_MSC_VER) || defined(__BORLANDC__)
  684. # pragma message( \
  685. "Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
  686. "- add -D_WIN32_WINNT=0x0501 to the compiler command line; or\n"\
  687. "- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.\n"\
  688. "Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).")
  689. # else // defined(_MSC_VER) || defined(__BORLANDC__)
  690. # warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
  691. # warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
  692. # warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
  693. # endif // defined(_MSC_VER) || defined(__BORLANDC__)
  694. # define _WIN32_WINNT 0x0501
  695. # endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
  696. # if defined(_MSC_VER)
  697. # if defined(_WIN32) && !defined(WIN32)
  698. # if !defined(_WINSOCK2API_)
  699. # define WIN32 // Needed for correct types in winsock2.h
  700. # else // !defined(_WINSOCK2API_)
  701. # error Please define the macro WIN32 in your compiler options
  702. # endif // !defined(_WINSOCK2API_)
  703. # endif // defined(_WIN32) && !defined(WIN32)
  704. # endif // defined(_MSC_VER)
  705. # if defined(__BORLANDC__)
  706. # if defined(__WIN32__) && !defined(WIN32)
  707. # if !defined(_WINSOCK2API_)
  708. # define WIN32 // Needed for correct types in winsock2.h
  709. # else // !defined(_WINSOCK2API_)
  710. # error Please define the macro WIN32 in your compiler options
  711. # endif // !defined(_WINSOCK2API_)
  712. # endif // defined(__WIN32__) && !defined(WIN32)
  713. # endif // defined(__BORLANDC__)
  714. # if defined(__CYGWIN__)
  715. # if !defined(__USE_W32_SOCKETS)
  716. # error You must add -D__USE_W32_SOCKETS to your compiler options.
  717. # endif // !defined(__USE_W32_SOCKETS)
  718. # endif // defined(__CYGWIN__)
  719. #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  720. // Windows: minimise header inclusion.
  721. #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  722. # if !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
  723. # if !defined(WIN32_LEAN_AND_MEAN)
  724. # define WIN32_LEAN_AND_MEAN
  725. # endif // !defined(WIN32_LEAN_AND_MEAN)
  726. # endif // !defined(ASIO_NO_WIN32_LEAN_AND_MEAN)
  727. #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  728. // Windows: suppress definition of "min" and "max" macros.
  729. #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  730. # if !defined(ASIO_NO_NOMINMAX)
  731. # if !defined(NOMINMAX)
  732. # define NOMINMAX 1
  733. # endif // !defined(NOMINMAX)
  734. # endif // !defined(ASIO_NO_NOMINMAX)
  735. #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  736. // Windows: IO Completion Ports.
  737. #if !defined(ASIO_HAS_IOCP)
  738. # if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  739. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
  740. # if !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
  741. # if !defined(ASIO_DISABLE_IOCP)
  742. # define ASIO_HAS_IOCP 1
  743. # endif // !defined(ASIO_DISABLE_IOCP)
  744. # endif // !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
  745. # endif // defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0400)
  746. # endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  747. #endif // !defined(ASIO_HAS_IOCP)
  748. // On POSIX (and POSIX-like) platforms we need to include unistd.h in order to
  749. // get access to the various platform feature macros, e.g. to be able to test
  750. // for threads support.
  751. #if !defined(ASIO_HAS_UNISTD_H)
  752. # if !defined(ASIO_HAS_BOOST_CONFIG)
  753. # if defined(unix) \
  754. || defined(__unix) \
  755. || defined(_XOPEN_SOURCE) \
  756. || defined(_POSIX_SOURCE) \
  757. || (defined(__MACH__) && defined(__APPLE__)) \
  758. || defined(__FreeBSD__) \
  759. || defined(__NetBSD__) \
  760. || defined(__OpenBSD__) \
  761. || defined(__linux__)
  762. # define ASIO_HAS_UNISTD_H 1
  763. # endif
  764. # endif // !defined(ASIO_HAS_BOOST_CONFIG)
  765. #endif // !defined(ASIO_HAS_UNISTD_H)
  766. #if defined(ASIO_HAS_UNISTD_H)
  767. # include <unistd.h>
  768. #endif // defined(ASIO_HAS_UNISTD_H)
  769. // Linux: epoll, eventfd and timerfd.
  770. #if defined(__linux__)
  771. # include <linux/version.h>
  772. # if !defined(ASIO_HAS_EPOLL)
  773. # if !defined(ASIO_DISABLE_EPOLL)
  774. # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
  775. # define ASIO_HAS_EPOLL 1
  776. # endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,45)
  777. # endif // !defined(ASIO_DISABLE_EPOLL)
  778. # endif // !defined(ASIO_HAS_EPOLL)
  779. # if !defined(ASIO_HAS_EVENTFD)
  780. # if !defined(ASIO_DISABLE_EVENTFD)
  781. # if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
  782. # define ASIO_HAS_EVENTFD 1
  783. # endif // LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
  784. # endif // !defined(ASIO_DISABLE_EVENTFD)
  785. # endif // !defined(ASIO_HAS_EVENTFD)
  786. # if !defined(ASIO_HAS_TIMERFD)
  787. # if defined(ASIO_HAS_EPOLL)
  788. # if (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
  789. # define ASIO_HAS_TIMERFD 1
  790. # endif // (__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 8)
  791. # endif // defined(ASIO_HAS_EPOLL)
  792. # endif // !defined(ASIO_HAS_TIMERFD)
  793. #endif // defined(__linux__)
  794. // Mac OS X, FreeBSD, NetBSD, OpenBSD: kqueue.
  795. #if (defined(__MACH__) && defined(__APPLE__)) \
  796. || defined(__FreeBSD__) \
  797. || defined(__NetBSD__) \
  798. || defined(__OpenBSD__)
  799. # if !defined(ASIO_HAS_KQUEUE)
  800. # if !defined(ASIO_DISABLE_KQUEUE)
  801. # define ASIO_HAS_KQUEUE 1
  802. # endif // !defined(ASIO_DISABLE_KQUEUE)
  803. # endif // !defined(ASIO_HAS_KQUEUE)
  804. #endif // (defined(__MACH__) && defined(__APPLE__))
  805. // || defined(__FreeBSD__)
  806. // || defined(__NetBSD__)
  807. // || defined(__OpenBSD__)
  808. // Solaris: /dev/poll.
  809. #if defined(__sun)
  810. # if !defined(ASIO_HAS_DEV_POLL)
  811. # if !defined(ASIO_DISABLE_DEV_POLL)
  812. # define ASIO_HAS_DEV_POLL 1
  813. # endif // !defined(ASIO_DISABLE_DEV_POLL)
  814. # endif // !defined(ASIO_HAS_DEV_POLL)
  815. #endif // defined(__sun)
  816. // Serial ports.
  817. #if !defined(ASIO_HAS_SERIAL_PORT)
  818. # if defined(ASIO_HAS_IOCP) \
  819. || !defined(ASIO_WINDOWS) \
  820. && !defined(ASIO_WINDOWS_RUNTIME) \
  821. && !defined(__CYGWIN__)
  822. # if !defined(__SYMBIAN32__)
  823. # if !defined(ASIO_DISABLE_SERIAL_PORT)
  824. # define ASIO_HAS_SERIAL_PORT 1
  825. # endif // !defined(ASIO_DISABLE_SERIAL_PORT)
  826. # endif // !defined(__SYMBIAN32__)
  827. # endif // defined(ASIO_HAS_IOCP)
  828. // || !defined(ASIO_WINDOWS)
  829. // && !defined(ASIO_WINDOWS_RUNTIME)
  830. // && !defined(__CYGWIN__)
  831. #endif // !defined(ASIO_HAS_SERIAL_PORT)
  832. // Windows: stream handles.
  833. #if !defined(ASIO_HAS_WINDOWS_STREAM_HANDLE)
  834. # if !defined(ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
  835. # if defined(ASIO_HAS_IOCP)
  836. # define ASIO_HAS_WINDOWS_STREAM_HANDLE 1
  837. # endif // defined(ASIO_HAS_IOCP)
  838. # endif // !defined(ASIO_DISABLE_WINDOWS_STREAM_HANDLE)
  839. #endif // !defined(ASIO_HAS_WINDOWS_STREAM_HANDLE)
  840. // Windows: random access handles.
  841. #if !defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
  842. # if !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
  843. # if defined(ASIO_HAS_IOCP)
  844. # define ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE 1
  845. # endif // defined(ASIO_HAS_IOCP)
  846. # endif // !defined(ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE)
  847. #endif // !defined(ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE)
  848. // Windows: object handles.
  849. #if !defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE)
  850. # if !defined(ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
  851. # if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  852. # if !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
  853. # define ASIO_HAS_WINDOWS_OBJECT_HANDLE 1
  854. # endif // !defined(UNDER_CE) && !defined(ASIO_WINDOWS_APP)
  855. # endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  856. # endif // !defined(ASIO_DISABLE_WINDOWS_OBJECT_HANDLE)
  857. #endif // !defined(ASIO_HAS_WINDOWS_OBJECT_HANDLE)
  858. // Windows: OVERLAPPED wrapper.
  859. #if !defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
  860. # if !defined(ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
  861. # if defined(ASIO_HAS_IOCP)
  862. # define ASIO_HAS_WINDOWS_OVERLAPPED_PTR 1
  863. # endif // defined(ASIO_HAS_IOCP)
  864. # endif // !defined(ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR)
  865. #endif // !defined(ASIO_HAS_WINDOWS_OVERLAPPED_PTR)
  866. // POSIX: stream-oriented file descriptors.
  867. #if !defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
  868. # if !defined(ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
  869. # if !defined(ASIO_WINDOWS) \
  870. && !defined(ASIO_WINDOWS_RUNTIME) \
  871. && !defined(__CYGWIN__)
  872. # define ASIO_HAS_POSIX_STREAM_DESCRIPTOR 1
  873. # endif // !defined(ASIO_WINDOWS)
  874. // && !defined(ASIO_WINDOWS_RUNTIME)
  875. // && !defined(__CYGWIN__)
  876. # endif // !defined(ASIO_DISABLE_POSIX_STREAM_DESCRIPTOR)
  877. #endif // !defined(ASIO_HAS_POSIX_STREAM_DESCRIPTOR)
  878. // UNIX domain sockets.
  879. #if !defined(ASIO_HAS_LOCAL_SOCKETS)
  880. # if !defined(ASIO_DISABLE_LOCAL_SOCKETS)
  881. # if !defined(ASIO_WINDOWS) \
  882. && !defined(ASIO_WINDOWS_RUNTIME) \
  883. && !defined(__CYGWIN__)
  884. # define ASIO_HAS_LOCAL_SOCKETS 1
  885. # endif // !defined(ASIO_WINDOWS)
  886. // && !defined(ASIO_WINDOWS_RUNTIME)
  887. // && !defined(__CYGWIN__)
  888. # endif // !defined(ASIO_DISABLE_LOCAL_SOCKETS)
  889. #endif // !defined(ASIO_HAS_LOCAL_SOCKETS)
  890. // Can use sigaction() instead of signal().
  891. #if !defined(ASIO_HAS_SIGACTION)
  892. # if !defined(ASIO_DISABLE_SIGACTION)
  893. # if !defined(ASIO_WINDOWS) \
  894. && !defined(ASIO_WINDOWS_RUNTIME) \
  895. && !defined(__CYGWIN__)
  896. # define ASIO_HAS_SIGACTION 1
  897. # endif // !defined(ASIO_WINDOWS)
  898. // && !defined(ASIO_WINDOWS_RUNTIME)
  899. // && !defined(__CYGWIN__)
  900. # endif // !defined(ASIO_DISABLE_SIGACTION)
  901. #endif // !defined(ASIO_HAS_SIGACTION)
  902. // Can use signal().
  903. #if !defined(ASIO_HAS_SIGNAL)
  904. # if !defined(ASIO_DISABLE_SIGNAL)
  905. # if !defined(UNDER_CE)
  906. # define ASIO_HAS_SIGNAL 1
  907. # endif // !defined(UNDER_CE)
  908. # endif // !defined(ASIO_DISABLE_SIGNAL)
  909. #endif // !defined(ASIO_HAS_SIGNAL)
  910. // Can use getaddrinfo() and getnameinfo().
  911. #if !defined(ASIO_HAS_GETADDRINFO)
  912. # if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
  913. # if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0501)
  914. # define ASIO_HAS_GETADDRINFO 1
  915. # elif defined(UNDER_CE)
  916. # define ASIO_HAS_GETADDRINFO 1
  917. # endif // defined(UNDER_CE)
  918. # elif !(defined(__MACH__) && defined(__APPLE__))
  919. # define ASIO_HAS_GETADDRINFO 1
  920. # endif // !(defined(__MACH__) && defined(__APPLE__))
  921. #endif // !defined(ASIO_HAS_GETADDRINFO)
  922. // Whether standard iostreams are disabled.
  923. #if !defined(ASIO_NO_IOSTREAM)
  924. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_IOSTREAM)
  925. # define ASIO_NO_IOSTREAM 1
  926. # endif // !defined(BOOST_NO_IOSTREAM)
  927. #endif // !defined(ASIO_NO_IOSTREAM)
  928. // Whether exception handling is disabled.
  929. #if !defined(ASIO_NO_EXCEPTIONS)
  930. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_EXCEPTIONS)
  931. # define ASIO_NO_EXCEPTIONS 1
  932. # endif // !defined(BOOST_NO_EXCEPTIONS)
  933. #endif // !defined(ASIO_NO_EXCEPTIONS)
  934. // Whether the typeid operator is supported.
  935. #if !defined(ASIO_NO_TYPEID)
  936. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_NO_TYPEID)
  937. # define ASIO_NO_TYPEID 1
  938. # endif // !defined(BOOST_NO_TYPEID)
  939. #endif // !defined(ASIO_NO_TYPEID)
  940. // Threads.
  941. #if !defined(ASIO_HAS_THREADS)
  942. # if !defined(ASIO_DISABLE_THREADS)
  943. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
  944. # define ASIO_HAS_THREADS 1
  945. # elif defined(__GNUC__) && !defined(__MINGW32__) \
  946. && !defined(linux) && !defined(__linux) && !defined(__linux__)
  947. # define ASIO_HAS_THREADS 1
  948. # elif defined(_MT) || defined(__MT__)
  949. # define ASIO_HAS_THREADS 1
  950. # elif defined(_REENTRANT)
  951. # define ASIO_HAS_THREADS 1
  952. # elif defined(__APPLE__)
  953. # define ASIO_HAS_THREADS 1
  954. # elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
  955. # define ASIO_HAS_THREADS 1
  956. # elif defined(_PTHREADS)
  957. # define ASIO_HAS_THREADS 1
  958. # endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_THREADS)
  959. # endif // !defined(ASIO_DISABLE_THREADS)
  960. #endif // !defined(ASIO_HAS_THREADS)
  961. // POSIX threads.
  962. #if !defined(ASIO_HAS_PTHREADS)
  963. # if defined(ASIO_HAS_THREADS)
  964. # if defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
  965. # define ASIO_HAS_PTHREADS 1
  966. # elif defined(_POSIX_THREADS) && (_POSIX_THREADS + 0 >= 0)
  967. # define ASIO_HAS_PTHREADS 1
  968. # endif // defined(ASIO_HAS_BOOST_CONFIG) && defined(BOOST_HAS_PTHREADS)
  969. # endif // defined(ASIO_HAS_THREADS)
  970. #endif // !defined(ASIO_HAS_PTHREADS)
  971. // Helper to prevent macro expansion.
  972. #define ASIO_PREVENT_MACRO_SUBSTITUTION
  973. // Helper to define in-class constants.
  974. #if !defined(ASIO_STATIC_CONSTANT)
  975. # if !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  976. # define ASIO_STATIC_CONSTANT(type, assignment) \
  977. BOOST_STATIC_CONSTANT(type, assignment)
  978. # else // !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  979. # define ASIO_STATIC_CONSTANT(type, assignment) \
  980. static const type assignment
  981. # endif // !defined(ASIO_DISABLE_BOOST_STATIC_CONSTANT)
  982. #endif // !defined(ASIO_STATIC_CONSTANT)
  983. // Boost array library.
  984. #if !defined(ASIO_HAS_BOOST_ARRAY)
  985. # if !defined(ASIO_DISABLE_BOOST_ARRAY)
  986. # define ASIO_HAS_BOOST_ARRAY 1
  987. # endif // !defined(ASIO_DISABLE_BOOST_ARRAY)
  988. #endif // !defined(ASIO_HAS_BOOST_ARRAY)
  989. // Boost assert macro.
  990. #if !defined(ASIO_HAS_BOOST_ASSERT)
  991. # if !defined(ASIO_DISABLE_BOOST_ASSERT)
  992. # define ASIO_HAS_BOOST_ASSERT 1
  993. # endif // !defined(ASIO_DISABLE_BOOST_ASSERT)
  994. #endif // !defined(ASIO_HAS_BOOST_ASSERT)
  995. // Boost limits header.
  996. #if !defined(ASIO_HAS_BOOST_LIMITS)
  997. # if !defined(ASIO_DISABLE_BOOST_LIMITS)
  998. # define ASIO_HAS_BOOST_LIMITS 1
  999. # endif // !defined(ASIO_DISABLE_BOOST_LIMITS)
  1000. #endif // !defined(ASIO_HAS_BOOST_LIMITS)
  1001. // Boost throw_exception function.
  1002. #if !defined(ASIO_HAS_BOOST_THROW_EXCEPTION)
  1003. # if !defined(ASIO_DISABLE_BOOST_THROW_EXCEPTION)
  1004. # define ASIO_HAS_BOOST_THROW_EXCEPTION 1
  1005. # endif // !defined(ASIO_DISABLE_BOOST_THROW_EXCEPTION)
  1006. #endif // !defined(ASIO_HAS_BOOST_THROW_EXCEPTION)
  1007. // Boost regex library.
  1008. #if !defined(ASIO_HAS_BOOST_REGEX)
  1009. # if !defined(ASIO_DISABLE_BOOST_REGEX)
  1010. # define ASIO_HAS_BOOST_REGEX 1
  1011. # endif // !defined(ASIO_DISABLE_BOOST_REGEX)
  1012. #endif // !defined(ASIO_HAS_BOOST_REGEX)
  1013. // Boost bind function.
  1014. #if !defined(ASIO_HAS_BOOST_BIND)
  1015. # if !defined(ASIO_DISABLE_BOOST_BIND)
  1016. # define ASIO_HAS_BOOST_BIND 1
  1017. # endif // !defined(ASIO_DISABLE_BOOST_BIND)
  1018. #endif // !defined(ASIO_HAS_BOOST_BIND)
  1019. // Boost's BOOST_WORKAROUND macro.
  1020. #if !defined(ASIO_HAS_BOOST_WORKAROUND)
  1021. # if !defined(ASIO_DISABLE_BOOST_WORKAROUND)
  1022. # define ASIO_HAS_BOOST_WORKAROUND 1
  1023. # endif // !defined(ASIO_DISABLE_BOOST_WORKAROUND)
  1024. #endif // !defined(ASIO_HAS_BOOST_WORKAROUND)
  1025. // Microsoft Visual C++'s secure C runtime library.
  1026. #if !defined(ASIO_HAS_SECURE_RTL)
  1027. # if !defined(ASIO_DISABLE_SECURE_RTL)
  1028. # if defined(ASIO_MSVC) \
  1029. && (ASIO_MSVC >= 1400) \
  1030. && !defined(UNDER_CE)
  1031. # define ASIO_HAS_SECURE_RTL 1
  1032. # endif // defined(ASIO_MSVC)
  1033. // && (ASIO_MSVC >= 1400)
  1034. // && !defined(UNDER_CE)
  1035. # endif // !defined(ASIO_DISABLE_SECURE_RTL)
  1036. #endif // !defined(ASIO_HAS_SECURE_RTL)
  1037. // Handler hooking. Disabled for ancient Borland C++ and gcc compilers.
  1038. #if !defined(ASIO_HAS_HANDLER_HOOKS)
  1039. # if !defined(ASIO_DISABLE_HANDLER_HOOKS)
  1040. # if defined(__GNUC__)
  1041. # if (__GNUC__ >= 3)
  1042. # define ASIO_HAS_HANDLER_HOOKS 1
  1043. # endif // (__GNUC__ >= 3)
  1044. # elif !defined(__BORLANDC__)
  1045. # define ASIO_HAS_HANDLER_HOOKS 1
  1046. # endif // !defined(__BORLANDC__)
  1047. # endif // !defined(ASIO_DISABLE_HANDLER_HOOKS)
  1048. #endif // !defined(ASIO_HAS_HANDLER_HOOKS)
  1049. // Support for the __thread keyword extension.
  1050. #if !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
  1051. # if defined(__linux__)
  1052. # if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
  1053. # if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
  1054. # if !defined(__INTEL_COMPILER) && !defined(__ICL) \
  1055. && !(defined(__clang__) && defined(__ANDROID__))
  1056. # define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1057. # define ASIO_THREAD_KEYWORD __thread
  1058. # elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
  1059. # define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1060. # endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100)
  1061. // && !(defined(__clang__) && defined(__ANDROID__))
  1062. # endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)
  1063. # endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
  1064. # endif // defined(__linux__)
  1065. # if defined(ASIO_MSVC) && defined(ASIO_WINDOWS_RUNTIME)
  1066. # if (_MSC_VER >= 1700)
  1067. # define ASIO_HAS_THREAD_KEYWORD_EXTENSION 1
  1068. # define ASIO_THREAD_KEYWORD __declspec(thread)
  1069. # endif // (_MSC_VER >= 1700)
  1070. # endif // defined(ASIO_MSVC) && defined(ASIO_WINDOWS_RUNTIME)
  1071. #endif // !defined(ASIO_DISABLE_THREAD_KEYWORD_EXTENSION)
  1072. #if !defined(ASIO_THREAD_KEYWORD)
  1073. # define ASIO_THREAD_KEYWORD __thread
  1074. #endif // !defined(ASIO_THREAD_KEYWORD)
  1075. // Support for POSIX ssize_t typedef.
  1076. #if !defined(ASIO_DISABLE_SSIZE_T)
  1077. # if defined(__linux__) \
  1078. || (defined(__MACH__) && defined(__APPLE__))
  1079. # define ASIO_HAS_SSIZE_T 1
  1080. # endif // defined(__linux__)
  1081. // || (defined(__MACH__) && defined(__APPLE__))
  1082. #endif // !defined(ASIO_DISABLE_SSIZE_T)
  1083. #endif // ASIO_DETAIL_CONFIG_HPP