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