ENH: Support large file systems in kwsys
This commit is contained in:
parent
211e991057
commit
d510ef2557
@ -241,6 +241,23 @@ IF(NOT KWSYS_IN_SOURCE_BUILD)
|
|||||||
${PROJECT_BINARY_DIR}/kwsysPrivate.h COPY_ONLY IMMEDIATE)
|
${PROJECT_BINARY_DIR}/kwsysPrivate.h COPY_ONLY IMMEDIATE)
|
||||||
ENDIF(NOT KWSYS_IN_SOURCE_BUILD)
|
ENDIF(NOT KWSYS_IN_SOURCE_BUILD)
|
||||||
|
|
||||||
|
|
||||||
|
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(CheckCXXSourceRuns)
|
||||||
|
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)
|
||||||
|
ELSE(REQUIRE_LARGE_FILE_SUPPORT)
|
||||||
|
SET(KWSYS_REQUIRE_LARGE_FILE_SUPPORT 0)
|
||||||
|
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.
|
# We require ANSI support from the C compiler. Add any needed flags.
|
||||||
IF(CMAKE_ANSI_CFLAGS)
|
IF(CMAKE_ANSI_CFLAGS)
|
||||||
|
@ -22,6 +22,20 @@
|
|||||||
# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
|
# define kwsysEXPORT @KWSYS_NAMESPACE@_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* 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@
|
||||||
|
# ifndef _LARGEFILE_SOURCE
|
||||||
|
# define _LARGEFILE_SOURCE
|
||||||
|
# endif
|
||||||
|
# ifndef _LARGE_FILES
|
||||||
|
# define _LARGE_FILES
|
||||||
|
# endif
|
||||||
|
# ifndef _FILE_OFFSET_BITS
|
||||||
|
# define _FILE_OFFSET_BITS 64
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Setup the export macro. */
|
/* Setup the export macro. */
|
||||||
#if defined(_WIN32) && @KWSYS_BUILD_SHARED@
|
#if defined(_WIN32) && @KWSYS_BUILD_SHARED@
|
||||||
# if defined(@KWSYS_NAMESPACE@_EXPORTS)
|
# if defined(@KWSYS_NAMESPACE@_EXPORTS)
|
||||||
|
28
Source/kwsys/RequireLargeFilesSupport.cxx
Normal file
28
Source/kwsys/RequireLargeFilesSupport.cxx
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
@ -279,6 +279,7 @@ cmake_kwsys_config_replace_string ()
|
|||||||
cat "${INFILE}" |
|
cat "${INFILE}" |
|
||||||
sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
|
sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g;
|
||||||
s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
|
s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g;
|
||||||
|
s/@KWSYS_REQUIRE_LARGE_FILE_SUPPORT@/${KWSYS_REQUIRE_LARGE_FILE_SUPPORT}/g;
|
||||||
s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
|
s/@KWSYS_NAME_IS_KWSYS@/${KWSYS_NAME_IS_KWSYS}/g;
|
||||||
s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
|
s/@KWSYS_IOS_USE_ANSI@/${KWSYS_IOS_USE_ANSI}/g;
|
||||||
s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
|
s/@KWSYS_IOS_HAVE_STD@/${KWSYS_IOS_HAVE_STD}/g;
|
||||||
@ -821,6 +822,7 @@ fi
|
|||||||
# Test for kwsys features
|
# Test for kwsys features
|
||||||
KWSYS_NAME_IS_KWSYS=0
|
KWSYS_NAME_IS_KWSYS=0
|
||||||
KWSYS_BUILD_SHARED=0
|
KWSYS_BUILD_SHARED=0
|
||||||
|
KWSYS_REQUIRE_LARGE_FILE_SUPPORT=0
|
||||||
KWSYS_IOS_USE_STRSTREAM_H=0
|
KWSYS_IOS_USE_STRSTREAM_H=0
|
||||||
KWSYS_IOS_USE_STRSTREA_H=0
|
KWSYS_IOS_USE_STRSTREA_H=0
|
||||||
KWSYS_IOS_HAVE_STD=0
|
KWSYS_IOS_HAVE_STD=0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user