summaryrefslogtreecommitdiff
path: root/cmake/TestLargeFiles.c.cmake.in
diff options
context:
space:
mode:
authorMathieu Malaterre <mathieu.malaterre@gmail.com>2012-09-28 08:11:41 +0000
committerMathieu Malaterre <mathieu.malaterre@gmail.com>2012-09-28 08:11:41 +0000
commitd518970039a19a2a9b6d2bdd592cc88a43897bbb (patch)
tree57bac2cf7e63e9352228231062763baac627563c /cmake/TestLargeFiles.c.cmake.in
parent8363a6ab1e031bb4b2e40a92e56efd40fdab1aa1 (diff)
[trunk] Start FolderReorgProposal task
Update issue 177
Diffstat (limited to 'cmake/TestLargeFiles.c.cmake.in')
-rw-r--r--cmake/TestLargeFiles.c.cmake.in23
1 files changed, 23 insertions, 0 deletions
diff --git a/cmake/TestLargeFiles.c.cmake.in b/cmake/TestLargeFiles.c.cmake.in
new file mode 100644
index 00000000..623f95f8
--- /dev/null
+++ b/cmake/TestLargeFiles.c.cmake.in
@@ -0,0 +1,23 @@
+#cmakedefine _LARGEFILE_SOURCE
+#cmakedefine _LARGE_FILES
+#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
+
+#include <sys/types.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ /* Cause a compile-time error if off_t is smaller than 64 bits,
+ * and make sure we have ftello / fseeko.
+ */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
+ FILE *fp = fopen(argv[0],"r");
+ off_t offset = ftello( fp );
+
+ fseeko( fp, offset, SEEK_CUR );
+ fclose(fp);
+ return 0;
+}
+