From e5b5923da14d12dc0d9f00c2de778d1c55671f8d Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Mon, 27 Jul 2009 16:45:15 -0400 Subject: [PATCH] BUG: Enable large files only if <cstdio> works Some AIX/gcc version combinations the <cstdio> header breaks when large file support is enabled. See this GCC issue for details: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20366 We work around the problem by enhancing the configuration check for large file support to include <cstdio> when available. This will cause LFS to be disabled when the above problem occurs. --- CMakeLists.txt | 5 +++++ kwsysDateStamp.cmake | 2 +- kwsysPlatformTestsCXX.cxx | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 145e43a..92ac20f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -337,14 +337,19 @@ ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) #----------------------------------------------------------------------------- # Configure Large File Support. +KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_CSTDIO + "Checking whether header cstdio is available" DIRECT) SET(KWSYS_LFS_AVAILABLE 0) IF(KWSYS_LFS_REQUESTED) # Large File Support is requested. SET(KWSYS_LFS_REQUESTED 1) # Check for large file support. + SET(KWSYS_PLATFORM_CXX_TEST_DEFINES + -DKWSYS_CXX_HAS_CSTDIO=${KWSYS_CXX_HAS_CSTDIO}) KWSYS_PLATFORM_CXX_TEST_RUN(KWSYS_LFS_WORKS "Checking for Large File Support" DIRECT) + SET(KWSYS_PLATFORM_CXX_TEST_DEFINES) IF(KWSYS_LFS_WORKS) SET(KWSYS_LFS_AVAILABLE 1) diff --git a/kwsysDateStamp.cmake b/kwsysDateStamp.cmake index 0382f07..54ed2d4 100644 --- a/kwsysDateStamp.cmake +++ b/kwsysDateStamp.cmake @@ -7,4 +7,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2009) SET(KWSYS_DATE_STAMP_MONTH 07) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 26) +SET(KWSYS_DATE_STAMP_DAY 27) diff --git a/kwsysPlatformTestsCXX.cxx b/kwsysPlatformTestsCXX.cxx index f0a2dfc..3d5550d 100644 --- a/kwsysPlatformTestsCXX.cxx +++ b/kwsysPlatformTestsCXX.cxx @@ -91,6 +91,11 @@ bool f(const kwsys_stl::string& s) { return s != ""; } int main() { return 0; } #endif +#ifdef TEST_KWSYS_CXX_HAS_CSTDIO +#include <cstdio> +int main() { return 0; } +#endif + #ifdef TEST_KWSYS_CXX_HAS_CSTDDEF #include <cstddef> void f(size_t) {} @@ -331,6 +336,9 @@ int main() #include <sys/types.h> #include <sys/stat.h> #include <assert.h> +#if KWSYS_CXX_HAS_CSTDIO +# include <cstdio> +#endif #include <stdio.h> int main(int, char **argv) -- GitLab