From: Mika Lindqvist Date: Sun, 22 Nov 2015 17:35:34 +0000 (+0200) Subject: Fix creating shared library under MSYS64. X-Git-Tag: 1.9.9-b1~791^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=962354736fea674b62949a0d2a85023c1f2c57ce;p=thirdparty%2Fzlib-ng.git Fix creating shared library under MSYS64. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ec1c0553..bb7f03009 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ cmake_minimum_required(VERSION 2.4.4) set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) +set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required project(zlib C) @@ -219,6 +220,9 @@ if(UNIX) if(NOT APPLE) set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") endif() +elseif(MSYS) + # Suppress version number from shared library name + set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 0) elseif(BUILD_SHARED_LIBS AND WIN32) # Creates zlib1.dll when building shared library version set_target_properties(zlib PROPERTIES SUFFIX "1.dll") diff --git a/gzguts.h b/gzguts.h index ffaa5826e..3930d7e41 100644 --- a/gzguts.h +++ b/gzguts.h @@ -35,7 +35,7 @@ # include #endif -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__) # define WIDECHAR #endif @@ -47,7 +47,7 @@ #endif /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -#if !defined(STDC99) && !defined(__CYGWIN__) && defined(WIN32) +#if !defined(STDC99) && !defined(__CYGWIN__) && !defined(__MINGW__) && defined(WIN32) # if !defined(vsnprintf) # if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) # define vsnprintf _vsnprintf diff --git a/gzlib.c b/gzlib.c index f7b4ca382..44b14a021 100644 --- a/gzlib.c +++ b/gzlib.c @@ -178,7 +178,7 @@ local gzFile gz_open(const void *path, int fd, const char *mode) { /* open the file with the appropriate flags (or just use fd) */ state->fd = fd > -1 ? fd : ( -#ifdef _WIN32 +#if defined(_WIN32) || defined(__MINGW__) fd == -2 ? _wopen(path, oflag, 0666) : #elif __CYGWIN__ fd == -2 ? open(state->path, oflag, 0666) : diff --git a/zlib.h b/zlib.h index 4f5fb131c..0c5994dba 100644 --- a/zlib.h +++ b/zlib.h @@ -1715,7 +1715,7 @@ ZEXTERN int ZEXPORT inflateResetKeep(z_stream *); ZEXTERN int ZEXPORT deflateResetKeep(z_stream *); #ifdef WITH_GZFILEOP -# if (defined(_WIN32) || defined(__CYGWIN__)) +# if (defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW__)) ZEXTERN gzFile ZEXPORT gzopen_w(const wchar_t *path, const char *mode); # endif ZEXTERN int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va);