TestLargeFiles.c.cmake.in 615 B

123456789101112131415161718192021222324
  1. #cmakedefine _LARGEFILE_SOURCE
  2. #cmakedefine _LARGE_FILES
  3. #cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
  4. #include <sys/types.h>
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. int main(int argc, char **argv)
  8. {
  9. /* Cause a compile-time error if off_t is smaller than 64 bits,
  10. * and make sure we have ftello / fseeko.
  11. */
  12. #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
  13. int off_t_is_large[ (LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1 ];
  14. FILE *fp = fopen(argv[0],"r");
  15. off_t offset = ftello( fp );
  16. fseeko( fp, offset, SEEK_CUR );
  17. fclose(fp);
  18. return 0;
  19. }