aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/TestFileOffsetBits.c
diff options
context:
space:
mode:
authorJörg Mayer <jmayer@loplof.de>2013-07-23 09:40:21 +0000
committerJörg Mayer <jmayer@loplof.de>2013-07-23 09:40:21 +0000
commit1cbd49e61b022970dc7a24fefd6a6f8fba69eac5 (patch)
treef82678ef6135d90c2b0aa0fee55f6925f4798fa4 /cmake/TestFileOffsetBits.c
parentd937adcc9ee07dde8c96f17b9c54fbba37fb45ba (diff)
Copy over cmake largfile detection from the gromacs project.
svn path=/trunk/; revision=50824
Diffstat (limited to 'cmake/TestFileOffsetBits.c')
-rw-r--r--cmake/TestFileOffsetBits.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/cmake/TestFileOffsetBits.c b/cmake/TestFileOffsetBits.c
new file mode 100644
index 0000000000..9a9dcfd182
--- /dev/null
+++ b/cmake/TestFileOffsetBits.c
@@ -0,0 +1,17 @@
+/* This code was copied from http://www.gromacs.org/
+ * and its toplevel COPYING file starts with:
+ *
+ * GROMACS is free software, distributed under the GNU General Public License
+ * (GPL) Version 2.
+ */
+
+#include <sys/types.h>
+
+int main(int argc, char **argv)
+{
+ /* Cause a compile-time error if off_t is smaller than 64 bits */
+#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 ];
+ return 0;
+}
+