[poppler] CMakeLists.txt cmake/modules config.h.cmake

Albert Astals Cid aacid at kemper.freedesktop.org
Sun May 26 15:02:17 PDT 2013


 CMakeLists.txt                          |    2 +
 cmake/modules/CheckFileOffsetBits.c     |   14 ++++++++++
 cmake/modules/CheckFileOffsetBits.cmake |   44 ++++++++++++++++++++++++++++++++
 config.h.cmake                          |    6 ++--
 4 files changed, 63 insertions(+), 3 deletions(-)

New commits:
commit 61f665885daeb0009ecac2cc85188f23d6addb60
Author: Albert Astals Cid <aacid at kde.org>
Date:   Mon May 27 00:01:24 2013 +0200

    Fix big file support in cmake
    
    Tested by Fabio

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 67d024e..28358ac 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,6 +13,8 @@ include(MacroBoolTo01)
 find_package(Threads)
 include(TestBigEndian)
 test_big_endian(WORDS_BIGENDIAN)
+include(CheckFileOffsetBits)
+CHECK_FILE_OFFSET_BITS()
 
 set(POPPLER_MAJOR_VERSION "0")
 set(POPPLER_MINOR_VERSION "23")
diff --git a/cmake/modules/CheckFileOffsetBits.c b/cmake/modules/CheckFileOffsetBits.c
new file mode 100644
index 0000000..d948fec
--- /dev/null
+++ b/cmake/modules/CheckFileOffsetBits.c
@@ -0,0 +1,14 @@
+#include <sys/types.h>
+
+#define KB ((off_t)1024)
+#define MB ((off_t)1024 * KB)
+#define GB ((off_t)1024 * MB)
+#define TB ((off_t)1024 * GB)
+int t2[(((64 * GB -1) % 671088649) == 268434537)
+       && (((TB - (64 * GB -1) + 255) % 1792151290) == 305159546)? 1: -1];
+
+int main()
+{
+  ;
+  return 0;
+}
diff --git a/cmake/modules/CheckFileOffsetBits.cmake b/cmake/modules/CheckFileOffsetBits.cmake
new file mode 100644
index 0000000..b347c93
--- /dev/null
+++ b/cmake/modules/CheckFileOffsetBits.cmake
@@ -0,0 +1,44 @@
+# - Check if _FILE_OFFSET_BITS macro needed for large files
+# CHECK_FILE_OFFSET_BITS ()
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+#  CMAKE_REQUIRED_FLAGS = string of compile command line flags
+#  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+#  CMAKE_REQUIRED_INCLUDES = list of include directories
+# Copyright (c) 2009, Michihiro NAKAJIMA
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+#INCLUDE(CheckCXXSourceCompiles)
+
+GET_FILENAME_COMPONENT(_selfdir_CheckFileOffsetBits
+	 "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+MACRO (CHECK_FILE_OFFSET_BITS)
+  IF(NOT DEFINED _FILE_OFFSET_BITS)
+    MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files")
+    TRY_COMPILE(__WITHOUT_FILE_OFFSET_BITS_64
+      ${CMAKE_CURRENT_BINARY_DIR}
+      ${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c
+      COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
+    IF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
+      TRY_COMPILE(__WITH_FILE_OFFSET_BITS_64
+        ${CMAKE_CURRENT_BINARY_DIR}
+        ${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c
+        COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64)
+    ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
+
+    IF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
+      SET(_FILE_OFFSET_BITS 64 CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
+      MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - needed")
+    ELSE(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
+      SET(_FILE_OFFSET_BITS "" CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
+      MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - not needed")
+    ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
+  ENDIF(NOT DEFINED _FILE_OFFSET_BITS)
+
+ENDMACRO (CHECK_FILE_OFFSET_BITS)
+
diff --git a/config.h.cmake b/config.h.cmake
index c3b30db..b707ba7 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -222,10 +222,10 @@
 #endif
 
 /* Number of bits in a file offset, on hosts where this is settable. */
-/* #undef _FILE_OFFSET_BITS */
+#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
 
 /* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
-/* #undef _LARGEFILE_SOURCE */
+/* TODO This is wrong, port if needed #undef _LARGEFILE_SOURCE */
 
 /* Define for large files, on AIX-style hosts. */
-/* #undef _LARGE_FILES */
+/* TODO This is wrong, port if needed #undef _LARGE_FILES */


More information about the poppler mailing list