diff options
| author | Alex Merry <alex.merry@kde.org> | 2014-05-02 16:53:40 +0100 | 
|---|---|---|
| committer | Alex Merry <alex.merry@kde.org> | 2014-05-02 17:00:48 +0100 | 
| commit | 0ec4b7b4128a9aa22530512bb87863e5d72ee2f2 (patch) | |
| tree | 25f94cdadbb6dd6cbdf3e98ab0fb68e9e322d34f | |
| parent | f8b5cf4773c8f860894bc43c48d8bdac8ac07cad (diff) | |
| download | extra-cmake-modules-0ec4b7b4128a9aa22530512bb87863e5d72ee2f2.tar.gz extra-cmake-modules-0ec4b7b4128a9aa22530512bb87863e5d72ee2f2.tar.bz2 | |
Set _FILE_OFFSET_BITS=64 again when necessary
This essentially reverts db553c810cbc3a446f90d4c962110d6262853cde. It
turns out that (for better or worse) quite a few places access files
without going through KFile, so it is worth making sure they can deal
with files larger than 2Gb on 32-bit systems.
Reviewed by: Harald Sitter <sitter@kde.org>
CCBUG: 165449
| -rw-r--r-- | kde-modules/KDECompilerSettings.cmake | 20 | 
1 files changed, 20 insertions, 0 deletions
| diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake index 229e4f59..46b7719c 100644 --- a/kde-modules/KDECompilerSettings.cmake +++ b/kde-modules/KDECompilerSettings.cmake @@ -123,6 +123,26 @@ if (UNIX)      # FIXME: this is included in _GNU_SOURCE in glibc; do other libc      # implementation recognize it?      _kde_add_platform_definitions(-D_LARGEFILE64_SOURCE) + +    include(CheckCXXSourceCompiles) + +    # By default (in glibc, at least), on 32bit platforms off_t is 32 bits, +    # which causes a SIGXFSZ when trying to manipulate files larger than 2Gb +    # using libc calls (note that this issue does not occur when using QFile). +    check_cxx_source_compiles(" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. +    We can't simply define LARGE_OFF_T to be 9223372036854775807, +    since some C++ compilers masquerading as C compilers +    incorrectly reject 9223372036854775807.  */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) +  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; +  int main() { return 0; } +" _OFFT_IS_64BIT) + +    if (NOT _OFFT_IS_64BIT) +        _kde_add_platform_definitions(-D_FILE_OFFSET_BITS=64) +    endif ()  endif()  if (WIN32) | 
