]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix build under MSYS2. 66/head
authorMika Lindqvist <postmaster@raasu.org>
Fri, 15 Apr 2016 10:28:19 +0000 (13:28 +0300)
committerMika Lindqvist <postmaster@raasu.org>
Tue, 26 Apr 2016 20:00:57 +0000 (23:00 +0300)
.gitignore
CMakeLists.txt
configure
zconf.h.in
zutil.h

index 0cfd4838158e60a9a8ea1dfa0c04797cec2fd91b..a53e4488972a1fe1ab9009e7dd255a168368da15 100644 (file)
@@ -37,6 +37,7 @@ CMakeCache.txt
 CMakeFiles
 Testing
 *.cmake
+*.stackdump
 zconf.h
 zconf.h.cmakein
 zconf.h.included
index bb7f030095cb43aa06ea42de03fbe6ddb6f9b286..7ca4a2e72318a710bf2fd466b9ea9e2c0a56f410 100644 (file)
@@ -58,6 +58,11 @@ endif()
 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
 
@@ -170,7 +175,7 @@ else (WITH_GZFILEOP)
 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.
     )
@@ -181,7 +186,7 @@ file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
 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)
@@ -195,7 +200,7 @@ if(MINGW)
                             -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})
index 00526ff3a25d6ffe10cfe0f0e4024c5994216956..d437c20958fd9f85837f573fe4d7a70c3ea6faca 100755 (executable)
--- a/configure
+++ b/configure
@@ -455,6 +455,9 @@ echo >> configure.log
 # 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
index bc5cd5456478dbb3206d57247bbaf73c072a6da0..7cacf1b79ed4c6a87cd72c62987310b486ccad0e 100644 (file)
@@ -164,7 +164,9 @@ typedef void       *voidp;
 #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
diff --git a/zutil.h b/zutil.h
index 17e3a03c53335b646501a75b953ac1d1e317c15b..c56ca71f199afb92a4835febdae68b9423e3536b 100644 (file)
--- a/zutil.h
+++ b/zutil.h
@@ -79,7 +79,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
 #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