Skip to content
Snippets Groups Projects
Commit 363bf5ab authored by Brad King's avatar Brad King
Browse files

Configure: Drop Large File Support macro definitions

Historically we have defined macros like

* `_LARGEFILE_SOURCE`
* `_LARGEFILE64_SOURCE`
* `_LARGE_FILES`
* `_FILE_OFFSET_BITS`

in `Configure.h` to activate large file support in system headers.  This
requires consuming projects to include the header at the beginning of
every translation unit in order to get the macros defined consistently.

Instead these macros should be defined by the build system on the
compiler command line.  Drop them from KWSys in favor of that approach.
The macros are not needed as often as they once were anyway.
parent e270ce9f
No related branches found
No related tags found
No related merge requests found
......@@ -179,13 +179,6 @@ IF(KWSYS_USE_ConsoleBuf)
SET(KWSYS_USE_Encoding 1)
ENDIF()
# Setup the large file support default.
IF(KWSYS_LFS_DISABLE)
SET(KWSYS_LFS_REQUESTED 0)
ELSE()
SET(KWSYS_LFS_REQUESTED 1)
ENDIF()
# Specify default 8 bit encoding for Windows
IF(NOT KWSYS_ENCODING_DEFAULT_CODEPAGE)
SET(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_ACP)
......@@ -352,30 +345,6 @@ IF(KWSYS_STANDALONE)
ENDIF()
ENDIF()
#-----------------------------------------------------------------------------
# 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)
ENDIF()
ELSE()
# Large File Support is not requested.
SET(KWSYS_LFS_REQUESTED 0)
ENDIF()
#-----------------------------------------------------------------------------
# Configure the standard library header wrappers based on compiler's
# capabilities and parent project's request. Enforce 0/1 as only
......@@ -575,9 +544,6 @@ IF(KWSYS_USE_SystemInformation)
COMPILE_DEFINITIONS KWSYS_SYS_HAS_MACHINE_CPU_H=1)
ENDIF()
ENDIF()
IF(KWSYS_LFS_AVAILABLE AND NOT KWSYS_LFS_DISABLE)
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES -DKWSYS_HAS_LFS=1)
ENDIF()
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_RLIMIT64
"Checking whether CXX compiler has rlimit64" DIRECT)
SET(KWSYS_PLATFORM_CXX_TEST_DEFINES)
......
......@@ -28,43 +28,6 @@
/* Whether kwsys namespace is "kwsys". */
#define @KWSYS_NAMESPACE@_NAME_IS_KWSYS @KWSYS_NAME_IS_KWSYS@
/* Whether Large File Support is requested. */
#define @KWSYS_NAMESPACE@_LFS_REQUESTED @KWSYS_LFS_REQUESTED@
/* Whether Large File Support is available. */
#if @KWSYS_NAMESPACE@_LFS_REQUESTED
# define @KWSYS_NAMESPACE@_LFS_AVAILABLE @KWSYS_LFS_AVAILABLE@
#endif
/* Setup Large File Support if requested. */
#if @KWSYS_NAMESPACE@_LFS_REQUESTED
/* Since LFS is requested this header must be included before system
headers whether or not LFS is available. */
# if 0 && (defined(_SYS_TYPES_H) || defined(_SYS_TYPES_INCLUDED))
# error "@KWSYS_NAMESPACE@/Configure.h must be included before sys/types.h"
# endif
/* Enable the large file API if it is available. */
# if @KWSYS_NAMESPACE@_LFS_AVAILABLE && \
!defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINES)
# if !defined(_LARGEFILE_SOURCE) && \
!defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGEFILE_SOURCE)
# define _LARGEFILE_SOURCE
# endif
# if !defined(_LARGEFILE64_SOURCE) && \
!defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGEFILE64_SOURCE)
# define _LARGEFILE64_SOURCE
# endif
# if !defined(_LARGE_FILES) && \
!defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_LARGE_FILES)
# define _LARGE_FILES
# endif
# if !defined(_FILE_OFFSET_BITS) && \
!defined(@KWSYS_NAMESPACE@_LFS_NO_DEFINE_FILE_OFFSET_BITS)
# define _FILE_OFFSET_BITS 64
# endif
# endif
#endif
/* Setup the export macro. */
#if @KWSYS_BUILD_SHARED@
# if defined(_WIN32) || defined(__CYGWIN__)
......
......@@ -136,42 +136,6 @@ 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 <assert.h>
# include <sys/stat.h>
# if KWSYS_CXX_HAS_CSTDIO
# include <cstdio>
# endif
# 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_HAS_SETENV
# include <stdlib.h>
int main()
......@@ -212,12 +176,6 @@ int main()
#endif
#ifdef TEST_KWSYS_CXX_HAS_RLIMIT64
# if defined(KWSYS_HAS_LFS)
# define _LARGEFILE_SOURCE
# define _LARGEFILE64_SOURCE
# define _LARGE_FILES
# define _FILE_OFFSET_BITS 64
# endif
# include <sys/resource.h>
int main()
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment