1// boost/filesystem/v3/config.hpp ----------------------------------------------------//
2
3// Copyright Beman Dawes 2003
4// Copyright Andrey Semashev 2021-2023
5
6// Distributed under the Boost Software License, Version 1.0.
7// See http://www.boost.org/LICENSE_1_0.txt
8
9// Library home page: http://www.boost.org/libs/filesystem
10
11//--------------------------------------------------------------------------------------//
12
13#ifndef BOOST_FILESYSTEM_CONFIG_HPP
14#define BOOST_FILESYSTEM_CONFIG_HPP
15
16// This header implements separate compilation features as described in
17// http://www.boost.org/more/separate_compilation.html
18
19#include <boost/config.hpp>
20#include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API
21#include <boost/detail/workaround.hpp>
22
23#if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3 && BOOST_FILESYSTEM_VERSION != 4
24#error Compiling Boost.Filesystem file with BOOST_FILESYSTEM_VERSION defined != 3 or 4
25#endif
26
27#if defined(BOOST_FILESYSTEM_SOURCE)
28#undef BOOST_FILESYSTEM_VERSION
29#define BOOST_FILESYSTEM_VERSION 4
30#elif !defined(BOOST_FILESYSTEM_VERSION)
31#define BOOST_FILESYSTEM_VERSION 3
32#endif
33
34#define BOOST_FILESYSTEM_VERSIONED_SYM(sym) BOOST_JOIN(sym, BOOST_JOIN(_v, BOOST_FILESYSTEM_VERSION))
35#define BOOST_FILESYSTEM_VERSION_NAMESPACE BOOST_JOIN(v, BOOST_FILESYSTEM_VERSION)
36
37#if BOOST_FILESYSTEM_VERSION == 4
38#undef BOOST_FILESYSTEM_DEPRECATED
39#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
40#define BOOST_FILESYSTEM_NO_DEPRECATED
41#endif
42#endif
43
44#define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions
45
46// BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------//
47
48#ifdef BOOST_FILESYSTEM_SOURCE
49#define BOOST_FILESYSTEM_DEPRECATED
50#undef BOOST_FILESYSTEM_NO_DEPRECATED // fixes #9454, src bld fails if NO_DEP defined
51#endif
52
53#if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED)
54#error Both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined
55#endif
56
57// throw an exception ----------------------------------------------------------------//
58//
59// Exceptions were originally thrown via boost::throw_exception().
60// As throw_exception() became more complex, it caused user error reporting
61// to be harder to interpret, since the exception reported became much more complex.
62// The immediate fix was to throw directly, wrapped in a macro to make any later change
63// easier.
64
65#define BOOST_FILESYSTEM_THROW(EX) throw EX
66
67#if defined(BOOST_NO_STD_WSTRING)
68#error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
69#endif
70
71// Deprecated symbols markup -----------------------------------------------------------//
72
73#if !defined(BOOST_FILESYSTEM_ALLOW_DEPRECATED)
74#define BOOST_FILESYSTEM_DETAIL_DEPRECATED(msg) BOOST_DEPRECATED(msg)
75#else
76#define BOOST_FILESYSTEM_DETAIL_DEPRECATED(msg)
77#endif
78
79
80// This header implements separate compilation features as described in
81// http://www.boost.org/more/separate_compilation.html
82
83// normalize macros ------------------------------------------------------------------//
84
85#if !defined(BOOST_FILESYSTEM_DYN_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK) && !defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_ALL_STATIC_LINK)
86#define BOOST_FILESYSTEM_STATIC_LINK
87#endif
88
89#if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_FILESYSTEM_DYN_LINK)
90#define BOOST_FILESYSTEM_DYN_LINK
91#elif defined(BOOST_ALL_STATIC_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK)
92#define BOOST_FILESYSTEM_STATIC_LINK
93#endif
94
95#if defined(BOOST_FILESYSTEM_DYN_LINK) && defined(BOOST_FILESYSTEM_STATIC_LINK)
96#error Must not define both BOOST_FILESYSTEM_DYN_LINK and BOOST_FILESYSTEM_STATIC_LINK
97#endif
98
99#if defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB)
100#define BOOST_FILESYSTEM_NO_LIB
101#endif
102
103// enable dynamic linking ------------------------------------------------------------//
104
105#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
106#if defined(BOOST_FILESYSTEM_SOURCE)
107#define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT
108#else
109#define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT
110#endif
111#else
112#define BOOST_FILESYSTEM_DECL
113#endif
114
115// enable automatic library variant selection ----------------------------------------//
116
117#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB)
118//
119// Set the name of our library, this will get undef'ed by auto_link.hpp
120// once it's done with it:
121//
122#define BOOST_LIB_NAME boost_filesystem
123//
124// If we're importing code from a dll, then tell auto_link.hpp about it:
125//
126#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK)
127#define BOOST_DYN_LINK
128#endif
129//
130// And include the header that does the work:
131//
132#include <boost/config/auto_link.hpp>
133#endif // auto-linking disabled
134
135#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) ||\
136 (defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 50000)) ||\
137 (defined(BOOST_MSSTL_VERSION) && (BOOST_MSSTL_VERSION < 100))
138// Indicates that the standard library fstream types do not support move constructor/assignment.
139#define BOOST_FILESYSTEM_DETAIL_NO_CXX11_MOVABLE_FSTREAMS
140#endif
141
142#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) && \
143 (\
144 (defined(BOOST_DINKUMWARE_STDLIB) && defined(_HAS_CXX23) && (_HAS_CXX23 != 0) && defined(_MSVC_STL_UPDATE) && (_MSVC_STL_UPDATE < 202208L)) || \
145 (defined(BOOST_LIBSTDCXX_VERSION) && (BOOST_LIBSTDCXX_VERSION < 110400 || (BOOST_LIBSTDCXX_VERSION >= 120000 && BOOST_LIBSTDCXX_VERSION < 120200)) && (BOOST_CXX_VERSION > 202002L))\
146 )
147// Indicates that std::string_view has implicit constructor from ranges that was present in an early C++23 draft (N4892).
148// This was later rectified by marking the constructor explicit (https://wg21.link/p2499). Unfortunately, some compilers
149// were released with the constructor being implicit.
150#define BOOST_FILESYSTEM_DETAIL_CXX23_STRING_VIEW_HAS_IMPLICIT_RANGE_CTOR
151#endif
152
153#endif // BOOST_FILESYSTEM_CONFIG_HPP
154

source code of boost/libs/filesystem/include/boost/filesystem/config.hpp