From: Mika Lindqvist Date: Tue, 25 May 2021 14:46:46 +0000 (+0300) Subject: Fix build under Cygwin. X-Git-Tag: 2.0.4~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=414ec0f00d85394849d0ce26c799faf094e2b6fb;p=thirdparty%2Fzlib-ng.git Fix build under Cygwin. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f800c0398..a7ff3b09d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -945,13 +945,13 @@ set(ZLIB_GZFILE_SRCS gzwrite.c ) -if(NOT MINGW AND NOT MSYS) +if(NOT MINGW AND NOT MSYS AND NOT CYGWIN) set(ZLIB_DLL_SRCS win32/zlib${SUFFIX}1.rc # If present will override custom build rule below. ) endif() -if(MINGW OR MSYS) +if(MINGW OR MSYS OR CYGWIN) # This gets us DLL resource information when compiling on MinGW. if(NOT CMAKE_RC_COMPILER) set(CMAKE_RC_COMPILER windres.exe) @@ -1033,7 +1033,8 @@ if(NOT DEFINED BUILD_SHARED_LIBS OR BUILD_SHARED_LIBS) # Match configure/make's behavior (i.e. don't use @rpath on mac). set_target_properties(zlib PROPERTIES INSTALL_NAME_DIR "${LIB_INSTALL_DIR}") endif() - elseif(MSYS) + endif() + if(MSYS OR CYGWIN) # Suppress version number from shared library name set(CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION 0) elseif(WIN32) diff --git a/test/minideflate.c b/test/minideflate.c index 392516852..8ce57fad5 100644 --- a/test/minideflate.c +++ b/test/minideflate.c @@ -3,6 +3,9 @@ * For conditions of distribution and use, see copyright notice in zlib.h */ +#define _POSIX_SOURCE 1 /* This file needs POSIX for fileno(). */ +#define _POSIX_C_SOURCE 200112 /* For snprintf(). */ + #include #include #include diff --git a/test/switchlevels.c b/test/switchlevels.c index 0f850113e..a4ec4b7c7 100644 --- a/test/switchlevels.c +++ b/test/switchlevels.c @@ -2,6 +2,8 @@ * Each chunk is compressed with a user-specified level. */ +#define _POSIX_SOURCE 1 /* This file needs POSIX for fileno(). */ + #include "zbuild.h" #ifdef ZLIB_COMPAT # include "zlib.h"