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 #ifndef _POSIX_PTHREAD_SEMANTICS 57 #define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r() needs this 58 #endif 59 60 #if !defined(_INCLUDE_STDCSOURCE_199901) && (defined(hpux) || defined(_hpux) || defined(__hpux)) 61 // For HP-UX, request that WCHAR_MAX and WCHAR_MIN be defined as macros, 62 // not casts. See ticket 5048 63 #define _INCLUDE_STDCSOURCE_199901 64 #endif 65 66 #if defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) ||\ 67 defined(__CYGWIN__) 68 // Define target Windows version macros before including any other headers 69 #include <boost/winapi/config.hpp> 70 #endif 71 72 #ifndef BOOST_SYSTEM_NO_DEPRECATED 73 #define BOOST_SYSTEM_NO_DEPRECATED 74 #endif 75 76 #include <boost/filesystem/config.hpp> 77 78 #endif // BOOST_FILESYSTEM_PLATFORM_CONFIG_HPP_ 79