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.

config.hpp 54KB

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