diff options
author | Jay Krell <jaykrell@microsoft.com> | 2019-07-05 15:38:56 +0300 |
---|---|---|
committer | Alexander Köplinger <alex.koeplinger@outlook.com> | 2019-07-05 15:38:56 +0300 |
commit | b84b85688ba252d1e514ff2dec6a3d10544caa8c (patch) | |
tree | 26be7d2f40eb80533f8e56a329f830085fd634de /configure.ac | |
parent | 063985e04d08dbbed358c000d09b0d7b901f86f9 (diff) |
Win32 zlib support. (#15509)
Fixes https://github.com/mono/mono/issues/15503
Always statically link on Windows (msvc and mingw).
This is a somewhat old zlib, and will be updated shortly (https://github.com/mono/mono/pull/15480)
Note that zlib is not valid C++, so always compile as C.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac index 2895837f3d6..d873dd763b9 100644 --- a/configure.ac +++ b/configure.ac @@ -684,23 +684,32 @@ AC_CHECK_HEADERS(sys/user.h, [], [], AC_CHECK_HEADERS(linux/serial.h) -AC_CHECK_HEADER(zlib.h, [have_zlib=yes], [have_zlib=no]) -if test x$have_zlib = xyes; then - AC_TRY_COMPILE([#include <zlib.h>], [ - #if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1230) - #else - #error No good zlib found - #endif - ],[ - AC_MSG_RESULT(Using system zlib) - zlib_msg="system zlib" - AC_DEFINE(HAVE_SYS_ZLIB,1,[Have system zlib]) - ],[ - AC_MSG_RESULT(Using embedded zlib) - have_zlib=no - zlib_msg="bundled zlib" - ]) -fi +case "$host" in + # Use bundled zlib on Windows to be sure it is static. + *-mingw*|*-cygwin*) + have_zlib=no + zlib_msg="bundled zlib" + ;; + default) + AC_CHECK_HEADER(zlib.h, [have_zlib=yes], [have_zlib=no]) + if test x$have_zlib = xyes; then + AC_TRY_COMPILE([#include <zlib.h>], [ + #if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1230) + #else + #error No good zlib found + #endif + ],[ + AC_MSG_RESULT(Using system zlib) + zlib_msg="system zlib" + AC_DEFINE(HAVE_SYS_ZLIB,1,[Have system zlib]) + ],[ + AC_MSG_RESULT(Using embedded zlib) + have_zlib=no + zlib_msg="bundled zlib" + ]) + fi + ;; +esac AC_ARG_WITH(static-zlib, [ --with-static-zlib=PATH use the specified static zlib instead of -lz],[STATIC_ZLIB_PATH=$with_static_zlib],[STATIC_ZLIB_PATH=]) if test "x$STATIC_ZLIB_PATH" != "x"; then |