diff --git a/CMakeLists.txt b/CMakeLists.txt index 399071a55..ca87a5359 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -865,7 +865,7 @@ CHECK_FUNCTION_EXISTS(getpagesize HAVE_GETPAGESIZE) CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF) CHECK_FUNCTION_EXISTS(mremap HAVE_MREMAP) CHECK_FUNCTION_EXISTS(getrlimit HAVE_GETRLIMIT) - +CHECK_FUNCTION_EXISTS(_filelengthi64 HAVE_FILE_LENGTH_I64) ##### # End system inspection checks. diff --git a/config.h.in.cmake b/config.h.in.cmake index a9c795b04..46170554c 100644 --- a/config.h.in.cmake +++ b/config.h.in.cmake @@ -197,6 +197,9 @@ are set when opening a binary file on Windows. */ /* Define to 1 if you have the BaseTsd.h header file. */ #cmakedefine HAVE_BASETSD_H @HAVE_BASETSD_H@ +/* Define if we have filelengthi64. */ +#cmakedefine HAVE_FILE_LENGTH_I64 @HAVE_FILE_LENGTH_I64@ + /* The size of `double` as computed by sizeof. */ #cmakedefine SIZEOF_DOUBLE @SIZEOF_DOUBLE@ /* The size of `float` as computed by sizeof. */ diff --git a/libsrc/posixio.c b/libsrc/posixio.c index 81f65906f..e0aaf50c9 100644 --- a/libsrc/posixio.c +++ b/libsrc/posixio.c @@ -1732,7 +1732,7 @@ ncio_px_filesize(ncio *nciop, off_t *filesizep) /* There is a problem with fstat on Windows based systems which manifests (so far) when Config RELEASE is built. Use _filelengthi64 isntead. */ -#ifdef _MSC_VER +#ifdef HAVE_FILE_LENGTH_I64 __int64 file_len = 0; if( (file_len = _filelengthi64(nciop->fd)) < 0) {