summaryrefslogtreecommitdiffstats
path: root/Source/kwsys
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-08-25 20:00:10 (GMT)
committerBrad King <brad.king@kitware.com>2006-08-25 20:00:10 (GMT)
commitffb1a9f80ad4e604c11c24a2f8769e93ba035ab3 (patch)
tree855aac7c8f94433ecdb66b519451c9044e6fdc02 /Source/kwsys
parent6c75c03143bb4ffed2dd192591adab89bde5b8b0 (diff)
downloadCMake-ffb1a9f80ad4e604c11c24a2f8769e93ba035ab3.zip
CMake-ffb1a9f80ad4e604c11c24a2f8769e93ba035ab3.tar.gz
CMake-ffb1a9f80ad4e604c11c24a2f8769e93ba035ab3.tar.bz2
ENH: Moved test for large file support into kwsysPlatformCxxTests.cxx with name KWSYS_LFS_WORKS.
Diffstat (limited to 'Source/kwsys')
-rw-r--r--Source/kwsys/CMakeLists.txt40
-rw-r--r--Source/kwsys/Configure.h.in2
-rw-r--r--Source/kwsys/RequireLargeFilesSupport.cxx28
-rw-r--r--Source/kwsys/kwsysPlatformCxxTests.cxx32
4 files changed, 56 insertions, 46 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt
index 291a7af..b4bd93c 100644
--- a/Source/kwsys/CMakeLists.txt
+++ b/Source/kwsys/CMakeLists.txt
@@ -142,6 +142,9 @@ IF(KWSYS_STANDALONE)
ENDIF(BUILD_TESTING)
ENDIF(KWSYS_STANDALONE)
+# Include helper macros.
+INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cmake)
+
# Do full dependency headers.
INCLUDE_REGULAR_EXPRESSION("^.*$")
@@ -241,22 +244,6 @@ IF(NOT KWSYS_IN_SOURCE_BUILD)
${PROJECT_BINARY_DIR}/kwsysPrivate.h COPY_ONLY IMMEDIATE)
ENDIF(NOT KWSYS_IN_SOURCE_BUILD)
-
-SET(KWSYS_REQUIRE_LARGE_FILE_SUPPORT 0)
-IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.4)
- MESSAGE(STATUS "Skip large files support because CMake is earlier than 2.4")
-ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.4)
- INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/CheckCXXSourceRuns.cmake)
- FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/RequireLargeFilesSupport.cxx"
- __kwsys_require_large_files_support)
- CHECK_CXX_SOURCE_RUNS("${__kwsys_require_large_files_support}"
- REQUIRE_LARGE_FILE_SUPPORT
- "Support for 64 bit file systems")
- IF(REQUIRE_LARGE_FILE_SUPPORT)
- SET(KWSYS_REQUIRE_LARGE_FILE_SUPPORT 1)
- ENDIF(REQUIRE_LARGE_FILE_SUPPORT)
-ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" LESS 2.4)
-
#-----------------------------------------------------------------------------
# We require ANSI support from the C compiler. Add any needed flags.
IF(CMAKE_ANSI_CFLAGS)
@@ -281,10 +268,29 @@ IF(NOT CMAKE_COMPILER_IS_GNUCXX)
ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
#-----------------------------------------------------------------------------
+# Configure Large File Support.
+SET(KWSYS_LFS_REQUESTED 1)
+SET(KWSYS_LFS_AVAILABLE 0)
+IF(KWSYS_LFS_REQUESTED)
+ # Large File Support is requested.
+ SET(KWSYS_LFS_REQUESTED 1)
+
+ # Check for large file support.
+ KWSYS_PLATFORM_CXX_TEST_RUN(KWSYS_LFS_WORKS
+ "Checking for Large File Support" DIRECT)
+
+ IF(KWSYS_LFS_WORKS)
+ SET(KWSYS_LFS_AVAILABLE 1)
+ ENDIF(KWSYS_LFS_WORKS)
+ELSE(KWSYS_LFS_REQUESTED)
+ # Large File Support is not requested.
+ SET(KWSYS_LFS_REQUESTED 0)
+ENDIF(KWSYS_LFS_REQUESTED)
+
+#-----------------------------------------------------------------------------
# Configure the standard library header wrappers based on compiler's
# capabilities and parent project's request. Enforce 0/1 as only
# possible values for configuration into Configure.hxx.
-INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cmake)
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAVE_STD
"Checking whether STL classes are in std namespace" DIRECT)
diff --git a/Source/kwsys/Configure.h.in b/Source/kwsys/Configure.h.in
index 5456467..ba4b99c 100644
--- a/Source/kwsys/Configure.h.in
+++ b/Source/kwsys/Configure.h.in
@@ -24,7 +24,7 @@
/* This is a support for files on the disk that are larger than 2GB. Since
this is the first place that any include should happen, do this here. */
-#if @KWSYS_REQUIRE_LARGE_FILE_SUPPORT@
+#if @KWSYS_LFS_AVAILABLE@
# ifndef _LARGEFILE_SOURCE
# define _LARGEFILE_SOURCE
# endif
diff --git a/Source/kwsys/RequireLargeFilesSupport.cxx b/Source/kwsys/RequireLargeFilesSupport.cxx
deleted file mode 100644
index 596bd60..0000000
--- a/Source/kwsys/RequireLargeFilesSupport.cxx
+++ /dev/null
@@ -1,28 +0,0 @@
-#define _LARGEFILE_SOURCE
-#define _LARGE_FILES
-#define _FILE_OFFSET_BITS 64
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <assert.h>
-#include <stdio.h>
-
-int main( int, char **argv )
-{
- // check that off_t can hold 2^63 - 1 and perform basic operations...
-#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
- if (OFF_T_64 % 2147483647 != 1)
- return 1;
-
- // stat breaks on SCO OpenServer
- struct stat buf;
- stat( argv[0], &buf );
- if (!S_ISREG(buf.st_mode))
- return 2;
-
- FILE *file = fopen( argv[0], "r" );
- off_t offset = ftello( file );
- fseek( file, offset, SEEK_CUR );
- fclose( file );
- return 0;
-}
-
diff --git a/Source/kwsys/kwsysPlatformCxxTests.cxx b/Source/kwsys/kwsysPlatformCxxTests.cxx
index 8048acf..989bf1b 100644
--- a/Source/kwsys/kwsysPlatformCxxTests.cxx
+++ b/Source/kwsys/kwsysPlatformCxxTests.cxx
@@ -275,6 +275,38 @@ int main()
}
#endif
+#ifdef TEST_KWSYS_LFS_WORKS
+/* Return 0 when LFS is available and 1 otherwise. */
+#define _LARGEFILE_SOURCE
+#define _LARGEFILE64_SOURCE
+#define _LARGE_FILES
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <assert.h>
+#include <stdio.h>
+
+int main(int, char **argv)
+{
+ /* check that off_t can hold 2^63 - 1 and perform basic operations... */
+#define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ if (OFF_T_64 % 2147483647 != 1)
+ return 1;
+
+ // stat breaks on SCO OpenServer
+ struct stat buf;
+ stat( argv[0], &buf );
+ if (!S_ISREG(buf.st_mode))
+ return 2;
+
+ FILE *file = fopen( argv[0], "r" );
+ off_t offset = ftello( file );
+ fseek( file, offset, SEEK_CUR );
+ fclose( file );
+ return 0;
+}
+#endif
+
#ifdef TEST_KWSYS_CXX_TYPE_INFO
/* Collect fundamental type information and save it to a CMake script. */