config.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. //
  2. // Copyright (c) 2009-2011 Artyom Beilis (Tonkikh)
  3. //
  4. // Distributed under the Boost Software License, Version 1.0.
  5. // https://www.boost.org/LICENSE_1_0.txt
  6. #ifndef BOOST_LOCALE_CONFIG_HPP_INCLUDED
  7. #define BOOST_LOCALE_CONFIG_HPP_INCLUDED
  8. #include <boost/config.hpp>
  9. #include <boost/config/workaround.hpp>
  10. #ifdef __has_include
  11. # if __has_include(<version>)
  12. # include <version>
  13. # endif
  14. #endif
  15. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_LOCALE_DYN_LINK)
  16. # ifdef BOOST_LOCALE_SOURCE
  17. # define BOOST_LOCALE_DECL BOOST_SYMBOL_EXPORT
  18. # else
  19. # define BOOST_LOCALE_DECL BOOST_SYMBOL_IMPORT
  20. # endif // BOOST_LOCALE_SOURCE
  21. #else
  22. # define BOOST_LOCALE_DECL
  23. #endif // BOOST_LOCALE_DYN_LINK
  24. //
  25. // Automatically link to the correct build variant where possible.
  26. //
  27. #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_LOCALE_NO_LIB) && !defined(BOOST_LOCALE_SOURCE)
  28. //
  29. // Set the name of our library, this will get undef'ed by auto_link.hpp
  30. // once it's done with it:
  31. //
  32. # define BOOST_LIB_NAME boost_locale
  33. //
  34. // If we're importing code from a dll, then tell auto_link.hpp about it:
  35. //
  36. # if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_LOCALE_DYN_LINK)
  37. # define BOOST_DYN_LINK
  38. # endif
  39. //
  40. // And include the header that does the work:
  41. //
  42. # include <boost/config/auto_link.hpp>
  43. #endif // auto-linking disabled
  44. // Check for some C++11 features to provide easier checks for what is missing
  45. // shortly after the requirement of C++11 in Boost 1.81
  46. // clang-format off
  47. #if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \
  48. defined(BOOST_NO_CXX11_DEFAULTED_MOVES) || \
  49. defined(BOOST_NO_CXX11_HDR_FUNCTIONAL) || \
  50. defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) || \
  51. defined(BOOST_NO_CXX11_NOEXCEPT) || \
  52. defined(BOOST_NO_CXX11_OVERRIDE) || \
  53. defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \
  54. defined(BOOST_NO_CXX11_SMART_PTR) || \
  55. defined(BOOST_NO_CXX11_STATIC_ASSERT)
  56. // clang-format on
  57. # error "Boost.Locale requires C++11 since Boost 1.81."
  58. #endif
  59. #ifdef _MSC_VER
  60. // Denote a constant condition, e.g. for if(sizeof(...
  61. # define BOOST_LOCALE_START_CONST_CONDITION __pragma(warning(push)) __pragma(warning(disable : 4127))
  62. # define BOOST_LOCALE_END_CONST_CONDITION __pragma(warning(pop))
  63. #else
  64. # define BOOST_LOCALE_START_CONST_CONDITION
  65. # define BOOST_LOCALE_END_CONST_CONDITION
  66. #endif
  67. /// \cond INTERNAL
  68. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  69. // Internal define to check if we have access to the Win32 API
  70. # define BOOST_LOCALE_USE_WIN32_API 1
  71. #else
  72. # define BOOST_LOCALE_USE_WIN32_API 0
  73. #endif
  74. // To be used to suppress false positives of UBSAN
  75. #if defined(__clang__) && defined(__has_attribute)
  76. # if __has_attribute(no_sanitize)
  77. # define BOOST_LOCALE_NO_SANITIZE(what) __attribute__((no_sanitize(what)))
  78. # endif
  79. #endif
  80. #if !defined(BOOST_LOCALE_NO_SANITIZE)
  81. # define BOOST_LOCALE_NO_SANITIZE(what)
  82. #endif
  83. #if !defined(__cpp_lib_char8_t) || BOOST_WORKAROUND(BOOST_CLANG_VERSION, < 150000)
  84. // No std::basic_string<char8_t> or bug in Clang: https://github.com/llvm/llvm-project/issues/55560
  85. # define BOOST_LOCALE_NO_CXX20_STRING8
  86. #endif
  87. /// \endcond
  88. #endif // boost/locale/config.hpp