| 1 | // platform_config.hpp --------------------------------------------------------------------// |
| 2 | |
| 3 | // Copyright 2020 Andrey Semashev |
| 4 | |
| 5 | // Distributed under the Boost Software License, Version 1.0. |
| 6 | // See http://www.boost.org/LICENSE_1_0.txt |
| 7 | |
| 8 | // See library home page at http://www.boost.org/libs/filesystem |
| 9 | |
| 10 | #ifndef BOOST_FILESYSTEM_PLATFORM_CONFIG_HPP_ |
| 11 | #define BOOST_FILESYSTEM_PLATFORM_CONFIG_HPP_ |
| 12 | |
| 13 | // define 64-bit offset macros BEFORE including boost/config.hpp (see ticket #5355) |
| 14 | #if defined(__ANDROID__) && defined(__ANDROID_API__) && __ANDROID_API__ < 24 |
| 15 | // Android fully supports 64-bit file offsets only for API 24 and above. |
| 16 | // |
| 17 | // Trying to define _FILE_OFFSET_BITS=64 for APIs below 24 |
| 18 | // leads to compilation failure for one or another reason, |
| 19 | // depending on target Android API level, Android NDK version, |
| 20 | // used STL, order of include paths and more. |
| 21 | // For more information, please see: |
| 22 | // - https://github.com/boostorg/filesystem/issues/65 |
| 23 | // - https://github.com/boostorg/filesystem/pull/69 |
| 24 | // |
| 25 | // Android NDK developers consider it the expected behavior. |
| 26 | // See their official position here: |
| 27 | // - https://github.com/android-ndk/ndk/issues/501#issuecomment-326447479 |
| 28 | // - https://android.googlesource.com/platform/bionic/+/a34817457feee026e8702a1d2dffe9e92b51d7d1/docs/32-bit-abi.md#32_bit-abi-bugs |
| 29 | // |
| 30 | // Thus we do not define _FILE_OFFSET_BITS in such case. |
| 31 | #else |
| 32 | // Defining _FILE_OFFSET_BITS=64 should kick in 64-bit off_t's |
| 33 | // (and thus st_size) on 32-bit systems that provide the Large File |
| 34 | // Support (LFS) interface, such as Linux, Solaris, and IRIX. |
| 35 | // |
| 36 | // At the time of this comment writing (March 2018), on most systems |
| 37 | // _FILE_OFFSET_BITS=64 definition is harmless: |
| 38 | // either the definition is supported and enables 64-bit off_t, |
| 39 | // or the definition is not supported and is ignored, in which case |
| 40 | // off_t does not change its default size for the target system |
| 41 | // (which may be 32-bit or 64-bit already). |
| 42 | // Thus it makes sense to have _FILE_OFFSET_BITS=64 defined by default, |
| 43 | // instead of listing every system that supports the definition. |
| 44 | // Those few systems, on which _FILE_OFFSET_BITS=64 is harmful, |
| 45 | // for example this definition causes compilation failure on those systems, |
| 46 | // should be exempt from defining _FILE_OFFSET_BITS by adding |
| 47 | // an appropriate #elif block above with the appropriate comment. |
| 48 | // |
| 49 | // _FILE_OFFSET_BITS must be defined before any headers are included |
| 50 | // to ensure that the definition is available to all included headers. |
| 51 | // That is required at least on Solaris, and possibly on other |
| 52 | // systems as well. |
| 53 | #define _FILE_OFFSET_BITS 64 |
| 54 | #endif |
| 55 | |
| 56 | #if defined(__APPLE__) || defined(__MACH__) |
| 57 | // Enable newer ABI on Mac OS 10.5 and later, which is needed for struct stat to have birthtime members |
| 58 | #define _DARWIN_USE_64_BIT_INODE 1 |
| 59 | #endif |
| 60 | |
| 61 | #ifndef _POSIX_PTHREAD_SEMANTICS |
| 62 | #define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r() needs this |
| 63 | #endif |
| 64 | |
| 65 | #if !defined(_INCLUDE_STDCSOURCE_199901) && (defined(hpux) || defined(_hpux) || defined(__hpux)) |
| 66 | // For HP-UX, request that WCHAR_MAX and WCHAR_MIN be defined as macros, |
| 67 | // not casts. See ticket 5048 |
| 68 | #define _INCLUDE_STDCSOURCE_199901 |
| 69 | #endif |
| 70 | |
| 71 | #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) || \ |
| 72 | defined(__CYGWIN__) |
| 73 | // Define target Windows version macros before including any other headers |
| 74 | #include <boost/winapi/config.hpp> |
| 75 | #endif |
| 76 | |
| 77 | #ifndef BOOST_SYSTEM_NO_DEPRECATED |
| 78 | #define BOOST_SYSTEM_NO_DEPRECATED |
| 79 | #endif |
| 80 | |
| 81 | #include <boost/filesystem/config.hpp> |
| 82 | |
| 83 | #endif // BOOST_FILESYSTEM_PLATFORM_CONFIG_HPP_ |
| 84 | |