aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryuta.256 <yuta.256@b7c3aa3b-274f-0410-ae0b-edc9d07c929d>2008-07-12 20:11:47 +0000
committeryuta.256 <yuta.256@b7c3aa3b-274f-0410-ae0b-edc9d07c929d>2008-07-12 20:11:47 +0000
commit7ce18b071a5fd6a76570bcc38e17b7f7dffe00f4 (patch)
tree97cb266eef5e4f88af42037a256a6f6450c1d623
parentef0055e6a78949bbe2f69b45f0f7b136879c5b45 (diff)
downloadlibdivsufsort-7ce18b071a5fd6a76570bcc38e17b7f7dffe00f4.tar.gz
Added LFS (Large File Support) files.
-rw-r--r--CMakeLists.txt1
-rw-r--r--include/CMakeLists.txt20
-rw-r--r--include/config.h.cmake19
3 files changed, 39 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d6c3f24..bceca8f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,6 +45,7 @@ include(ProjectCPack)
option(BUILD_SHARED_LIBS "Set to OFF to build static libraries" ON)
option(BUILD_EXAMPLES "Build examples" ON)
option(USE_OPENMP "Use OpenMP for parallelization" OFF)
+option(WITH_LFS "Enable Large File Support" ON)
## Build type ##
if(NOT CMAKE_BUILD_TYPE)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 3a4f2af..ebbef28 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -3,6 +3,7 @@ include(CheckIncludeFile)
include(CheckSymbolExists)
include(CheckTypeSize)
include(CheckFunctionKeywords)
+include(CheckLFS)
## Checks for header files ##
check_include_file("inttypes.h" HAVE_INTTYPES_H)
@@ -13,7 +14,6 @@ check_include_file("stdlib.h" HAVE_STDLIB_H)
check_include_file("string.h" HAVE_STRING_H)
check_include_file("strings.h" HAVE_STRINGS_H)
check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
-check_include_file("sys/stat.h" HAVE_SYS_STAT_H)
if(HAVE_INTTYPES_H)
set(INCFILE "#include <inttypes.h>")
elseif(HAVE_STDINT_H)
@@ -23,6 +23,24 @@ else(HAVE_INTTYPES_H)
endif(HAVE_INTTYPES_H)
## create configuration files from .cmake file ##
+if(BUILD_EXAMPLES)
+ ## Checks for WinIO ##
+ if(WIN32)
+ check_include_file("io.h" HAVE_IO_H)
+ check_include_file("fcntl.h" HAVE_FCNTL_H)
+ check_symbol_exists("_setmode" "io.h;fcntl.h" HAVE__SETMODE)
+ if(NOT HAVE__SETMODE)
+ check_symbol_exists("setmode" "io.h;fcntl.h" HAVE_SETMODE)
+ endif(NOT HAVE__SETMODE)
+ check_symbol_exists("_fileno" "stdio.h" HAVE__FILENO)
+ check_symbol_exists("fopen_s" "stdio.h" HAVE_FOPEN_S)
+ check_symbol_exists("_O_BINARY" "fcntl.h" HAVE__O_BINARY)
+ endif(WIN32)
+
+ ## Checks for large file support ##
+ check_lfs(WITH_LFS)
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lfs.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/lfs.h" @ONLY)
+endif(BUILD_EXAMPLES)
## generate config.h ##
check_function_keywords("inline;__inline;__inline__;__declspec(dllexport);__declspec(dllimport)")
diff --git a/include/config.h.cmake b/include/config.h.cmake
index f0a0159..6a1cf47 100644
--- a/include/config.h.cmake
+++ b/include/config.h.cmake
@@ -44,6 +44,25 @@ extern "C" {
#cmakedefine HAVE_MEMORY_H 1
#cmakedefine HAVE_SYS_TYPES_H 1
+/** for WinIO **/
+#cmakedefine HAVE_IO_H 1
+#cmakedefine HAVE_FCNTL_H 1
+#cmakedefine HAVE__SETMODE 1
+#cmakedefine HAVE_SETMODE 1
+#cmakedefine HAVE__FILENO 1
+#cmakedefine HAVE_FOPEN_S 1
+#cmakedefine HAVE__O_BINARY 1
+#ifndef HAVE__SETMODE
+# if HAVE_SETMODE
+# define _setmode setmode
+# define HAVE__SETMODE 1
+# endif
+# if HAVE__SETMODE && !HAVE__O_BINARY
+# define _O_BINARY 0
+# define HAVE__O_BINARY 1
+# endif
+#endif
+
/** for inline **/
#ifndef INLINE
# define INLINE @INLINE@