From 6f0f77f5edc45673eb7de006a7b98eaffccc7416 Mon Sep 17 00:00:00 2001
From: Martin Stjernholm <mast@lysator.liu.se>
Date: Thu, 3 Aug 2006 13:56:27 +0200
Subject: [PATCH] Added fallback to link uncompress_header with a special
 static libz.

Rev: src/Makefile.in:1.442
Rev: src/configure.in:1.979
---
 src/Makefile.in  |  6 +++---
 src/configure.in | 18 +++++++++++++-----
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/Makefile.in b/src/Makefile.in
index a5cc849b41..769c081ec5 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,5 +1,5 @@
 #
-# $Id: Makefile.in,v 1.441 2006/08/02 21:19:03 mast Exp $
+# $Id: Makefile.in,v 1.442 2006/08/03 11:56:27 mast Exp $
 #
 
 # This line is needed on some machines.
@@ -1291,10 +1291,10 @@ testsuite: $(SRCDIR)/testsuite.in $(TMP_BINDIR)/mktestsuite
 	fi
 
 header_uncompress: $(SRCDIR)/uncompressor.c
-	$(CC) -O2 -static  $(SRCDIR)/uncompressor.c -o header_uncompress -lz
+	$(CC) -O2 -static  $(SRCDIR)/uncompressor.c -o header_uncompress @UNCOMPRESS_LIBZ@
 
 uncompress_header: $(SRCDIR)/uncompressor.c header_uncompress
-	$(CC) -O2 -static  $(SRCDIR)/uncompressor.c -o uncompress_header -lz -DSEEK_TO=`wc -c header_uncompress|sed 's/[^0-9]//g'`
+	$(CC) -O2 -static  $(SRCDIR)/uncompressor.c -o uncompress_header @UNCOMPRESS_LIBZ@ -DSEEK_TO=`wc -c header_uncompress|sed 's/[^0-9]//g'`
 	test "`wc -c header_uncompress|sed 's/[^0-9]//g'`" = "`wc -c uncompress_header|sed 's/[^0-9]//g'`"
 
 HFILES=						\
diff --git a/src/configure.in b/src/configure.in
index bc58c87085..782d39a049 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -1,4 +1,4 @@
-AC_REVISION("$Id: configure.in,v 1.978 2006/08/02 21:19:02 mast Exp $")
+AC_REVISION("$Id: configure.in,v 1.979 2006/08/03 11:56:26 mast Exp $")
 AC_INIT(interpret.c)
 AC_CONFIG_HEADER(machine.h)
 
@@ -1255,7 +1255,7 @@ MY_AC_ARG_WITH(static_linking, MY_DESCR([--with-static-linking],
 					[link statically, if possible]),
 	       [with_static_linking=yes])
 AC_ARG_ENABLE(dll, MY_DESCR([--enable-dll],
-			    [link dynamic modules to DLLs on NT]),
+			    [link dynamic modules to DLLs on Windows]),
 	      [], [enable_dll=no])
 AC_ARG_WITH(bundles,
 	    MY_DESCR([--without-bundles],
@@ -2265,7 +2265,7 @@ if test "x$PIKE_PATH_TRANSLATE" = "x"; then
     # MinGW system.
     cat <<\EOF
 #!/bin/sh
-# Automatically generated by $Id: configure.in,v 1.978 2006/08/02 21:19:02 mast Exp $.
+# Automatically generated by $Id: configure.in,v 1.979 2006/08/03 11:56:26 mast Exp $.
 # MinGW-version. Do NOT edit.
 posix_name="`cat`"
 posix_prefix="/"
@@ -2303,7 +2303,7 @@ EOF
     # Native POSIX system.
   cat <<\EOF
 #!/bin/sh
-# Automatically generated by $Id: configure.in,v 1.978 2006/08/02 21:19:02 mast Exp $.
+# Automatically generated by $Id: configure.in,v 1.979 2006/08/03 11:56:26 mast Exp $.
 # POSIX-version. Do NOT edit.
 cat
 EOF
@@ -2312,7 +2312,7 @@ else
   # rntcl-style
   cat <<\EOF
 #!/bin/sh
-# Automatically generated by $Id: configure.in,v 1.978 2006/08/02 21:19:02 mast Exp $.
+# Automatically generated by $Id: configure.in,v 1.979 2006/08/03 11:56:26 mast Exp $.
 # RNTCL-version. Do NOT edit.
 sed -e "$PIKE_PATH_TRANSLATE"
 EOF
@@ -7425,6 +7425,14 @@ elif test "x$static_crt_flag" != x; then
   CFLAGS="$CFLAGS $static_crt_flag"
 fi
 
+# In case the normal libz is linked to the dynamic crt we need to use
+# a different one linked with the static crt for the exe installer. We
+# check if there is such a thing in the build environment with the
+# nonstandard name "z_static".
+UNCOMPRESS_LIBZ=-lz
+AC_CHECK_LIB(z_static, inflate, [UNCOMPRESS_LIBZ=-lz_static])
+AC_SUBST(UNCOMPRESS_LIBZ)
+
 #######################################################################
 # Since configure doesn't always know if we will be linking with ld or cc,
 # We use this little code snippet to add flags to ld that would otherwise
-- 
GitLab