From 169288808baa8f9a7b98f2af49f7a2b88433ec09 Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Wed, 12 Jun 2013 12:24:23 +0000
Subject: Workaround for mingw-w64 (AMD64-only) bug: It appears that zdll.lib
 (as produced by Microsoft tools) doesn't import the zlib symbols correctly,
 so use "libz.dll.a" produced with mingw-w64 tools in stead.

---
 compat/zlib/win64/libz.dll.a | Bin 0 -> 46874 bytes
 win/Makefile.in              |   2 +-
 win/configure                |  12 +++++++++++-
 win/configure.in             |   6 +++++-
 4 files changed, 17 insertions(+), 3 deletions(-)
 create mode 100644 compat/zlib/win64/libz.dll.a

diff --git a/compat/zlib/win64/libz.dll.a b/compat/zlib/win64/libz.dll.a
new file mode 100644
index 0000000..a3ae403
Binary files /dev/null and b/compat/zlib/win64/libz.dll.a differ
diff --git a/win/Makefile.in b/win/Makefile.in
index 18993fe..47f3fdd 100644
--- a/win/Makefile.in
+++ b/win/Makefile.in
@@ -458,7 +458,7 @@ ${TEST_DLL_FILE}: ${TCLTEST_OBJS} ${TCL_STUB_LIB_FILE}
 
 # use pre-built zlib1.dll
 ${ZLIB_DLL_FILE}: ${TCL_STUB_LIB_FILE}
-	@if test "@ZLIB_LIBS@set" == "${ZLIB_DIR}/win64/zdll.libset" ; then \
+	@if test "@ZLIB_LIBS@set" != "${ZLIB_DIR}/win32/zdll.libset" ; then \
 		$(COPY) $(ZLIB_DIR)/win64/${ZLIB_DLL_FILE} ${ZLIB_DLL_FILE}; \
 	else \
 		$(COPY) $(ZLIB_DIR)/win32/${ZLIB_DLL_FILE} ${ZLIB_DLL_FILE}; \
diff --git a/win/configure b/win/configure
index bad344c..fc453f8 100755
--- a/win/configure
+++ b/win/configure
@@ -4362,7 +4362,17 @@ if test "$tcl_ok" = "yes"; then
 
   if test "$do64bit" = "yes"; then
 
-    ZLIB_LIBS=\${ZLIB_DIR}/win64/zdll.lib
+    if test "$GCC" == "yes"; then
+
+      ZLIB_LIBS=\${ZLIB_DIR}/win64/libz.dll.a
+
+
+else
+
+      ZLIB_LIBS=\${ZLIB_DIR}/win64/zdll.lib
+
+
+fi
 
 
 else
diff --git a/win/configure.in b/win/configure.in
index 574fce2..373cfcc 100644
--- a/win/configure.in
+++ b/win/configure.in
@@ -129,7 +129,11 @@ AS_IF([test "${enable_shared+set}" = "set"], [
 AS_IF([test "$tcl_ok" = "yes"], [
   AC_SUBST(ZLIB_DLL_FILE,[\${ZLIB_DLL_FILE}])
   AS_IF([test "$do64bit" = "yes"], [
-    AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win64/zdll.lib])
+    AS_IF([test "$GCC" == "yes"],[
+      AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win64/libz.dll.a])
+    ], [
+      AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win64/zdll.lib])
+    ])
   ], [
     AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win32/zdll.lib])
   ])
-- 
cgit v0.12