SPLIT more... use .FN_HDR???
[metze/wireshark/wip.git] / cmake / TestLargeFiles.c.cmakein
1 /*
2  * and its toplevel COPYING file starts with:
3  *
4  * GROMACS is free software, distributed under the GNU General Public License
5  * (GPL) Version 2.
6  */
7
8 #cmakedefine _LARGEFILE_SOURCE
9 #cmakedefine _LARGEFILE64_SOURCE
10 #cmakedefine _LARGE_FILES
11 #cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
12
13 /* detect failure even with -Wno-error on command line */
14 #pragma GCC diagnostic error "-Werror"
15
16 #include <sys/types.h>
17 #include <stdio.h>
18 #include <stdlib.h>
19
20 int main(int argc, char **argv)
21 {
22   /* Cause a compile-time error if off_t is smaller than 64 bits,
23    * and make sure we have ftello / fseeko.
24    */
25 #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
26   int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
27   /* silence unused warnings */
28   FILE *fp;
29   off_t offset;
30   (void)off_t_is_large;
31   (void)argc;
32   (void)argv;
33   fp = fopen(argv[0],"r");
34   offset = ftello( fp );
35
36   fseeko( fp, offset, SEEK_CUR );
37   fclose(fp);
38   return 0;
39 }
40