If a core Wireshark developer repeatedly can't remember that the
[metze/wireshark/wip.git] / cmake / TestLargeFiles.c.cmakein
1 /* This code was copied from http://www.gromacs.org/
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 #include <sys/types.h>
14 #include <stdio.h>
15 #include <stdlib.h>
16
17 int main(int argc, char **argv)
18 {
19   /* Cause a compile-time error if off_t is smaller than 64 bits,
20    * and make sure we have ftello / fseeko.
21    */
22 #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
23   int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];  
24   FILE *fp = fopen(argv[0],"r");
25   off_t offset = ftello( fp );
26
27   fseeko( fp, offset, SEEK_CUR );
28   fclose(fp);
29   return 0;
30 }
31