check_type_size(off64_t OFF64_T)
if(HAVE_OFF64_T)
add_definitions(-D_LARGEFILE64_SOURCE=1)
+else()
+ check_type_size(_off64_t _OFF64_T)
+ if (HAVE__OFF64_T)
+ add_definitions(-D_LARGEFILE64_SOURCE=1)
+ endif()
endif()
set(CMAKE_REQUIRED_DEFINITIONS) # clear variable
endif (WITH_GZFILEOP)
-if(NOT MINGW)
+if(NOT MINGW AND NOT MSYS)
set(ZLIB_DLL_SRCS
win32/zlib1.rc # If present will override custom build rule below.
)
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
"\\1" ZLIB_FULL_VERSION ${_zlib_h_contents})
-if(MINGW)
+if(MINGW OR MSYS)
# This gets us DLL resource information when compiling on MinGW.
if(NOT CMAKE_RC_COMPILER)
set(CMAKE_RC_COMPILER windres.exe)
-o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj
-i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc)
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
-endif(MINGW)
+endif(MINGW OR MSYS)
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_GZFILE_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_GZFILE_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
# check for large file support, and if none, check for fseeko()
cat > $test.c <<EOF
#include <sys/types.h>
+#ifdef __MSYS__
+# define off64_t _off64_t
+#endif
off64_t dummy = 0;
EOF
if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then
#if !defined(WIN32) && defined(Z_LARGE64)
# define z_off64_t off64_t
#else
-# if defined(WIN32) && !defined(__GNUC__)
+# if defined(__MSYS__)
+# define z_off64_t _off64_t
+# elif defined(WIN32) && !defined(__GNUC__)
# define z_off64_t __int64
# else
# define z_off64_t z_off_t
#endif
/* provide prototypes for these when building zlib without LFS */
-#if !defined(WIN32) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
+#if !defined(WIN32) && !defined(__MSYS__) && (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
ZEXTERN uint32_t ZEXPORT adler32_combine64(uint32_t, uint32_t, z_off_t);
ZEXTERN uint32_t ZEXPORT crc32_combine64(uint32_t, uint32_t, z_off_t);
#endif