]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix build under Cygwin.
authorMika Lindqvist <postmaster@raasu.org>
Tue, 25 May 2021 14:46:46 +0000 (17:46 +0300)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 27 May 2021 10:39:23 +0000 (12:39 +0200)
CMakeLists.txt
test/minideflate.c
test/switchlevels.c

index f800c0398a849a0890d90022dfbc0ff9fcbeb2a1..a7ff3b09de4ce6a158dad2112e69b58483d1c164 100644 (file)
@@ -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)
index 392516852d303389ad3932fc252324950996ab73..8ce57fad5855728f031e2988f3da16893ff9f8eb 100644 (file)
@@ -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 <stdio.h>
 #include <stddef.h>
 #include <stdint.h>
index 0f850113e27d769fd43ed70d7c9c64de31149faa..a4ec4b7c76c8d2f3bc1970797edf954f8959acdd 100644 (file)
@@ -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"