diff options
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | compat/zlib/win32/zdll.lib | bin | 0 -> 10590 bytes | |||
-rw-r--r-- | compat/zlib/win32/zlib1.dll | bin | 0 -> 59904 bytes | |||
-rw-r--r-- | generic/tclZlib.c | 112 | ||||
-rw-r--r-- | win/Makefile.in | 17 | ||||
-rwxr-xr-x | win/configure | 39 | ||||
-rw-r--r-- | win/configure.in | 18 |
7 files changed, 156 insertions, 39 deletions
@@ -1,4 +1,11 @@ -2009-02-10 Jan Nijtmans <nijtmans@users.sf.net> +2009-02-16 Jan Nijtmans <nijtmans@users.sf.net> + + * generic/tclZlib.c hack needed for official zlib1.dll build. + * win/configure.in fix [Feature Request 2605263] use official + * win/Makefile.in zlib build. + * win/configure (regenerated) + +2009-02-16 Jan Nijtmans <nijtmans@users.sf.net> * win/Makefile.in fix [Bug 2605232] tdbc doesn't build when Tcl is compiled with --disable-shared. diff --git a/compat/zlib/win32/zdll.lib b/compat/zlib/win32/zdll.lib Binary files differnew file mode 100644 index 0000000..01f4e10 --- /dev/null +++ b/compat/zlib/win32/zdll.lib diff --git a/compat/zlib/win32/zlib1.dll b/compat/zlib/win32/zlib1.dll Binary files differnew file mode 100644 index 0000000..1cf8a47 --- /dev/null +++ b/compat/zlib/win32/zlib1.dll diff --git a/generic/tclZlib.c b/generic/tclZlib.c index 95de991..13d7e27 100644 --- a/generic/tclZlib.c +++ b/generic/tclZlib.c @@ -13,11 +13,21 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclZlib.c,v 1.23 2009/02/07 22:42:01 dkf Exp $ + * RCS: @(#) $Id: tclZlib.c,v 1.24 2009/02/16 22:56:14 nijtmans Exp $ */ #include "tclInt.h" #ifdef HAVE_ZLIB +#ifdef _WIN32 +# ifndef STATIC_BUILD +/* HACK needed for zlib1.dll version 1.2.3 on Win32. See comment below. + * As soon as zlib 1.2.4 is reasonable mainstream, remove this hack! */ +# include "../compat/zlib/zutil.h" +# include "../compat/zlib/inftrees.h" +# include "../compat/zlib/deflate.h" +# include "../compat/zlib/inflate.h" +# endif /* !STATIC_BUILD */ +#endif /* _WIN32 */ #include <zlib.h> /* @@ -149,6 +159,48 @@ static Tcl_Channel ZlibStackChannel(Tcl_Interp *interp, int mode, int format, int level, Tcl_Channel channel, Tcl_Obj *gzipHeaderDictPtr); +#ifdef _WIN32 +# ifndef STATIC_BUILD + +/* + * zlib 1.2.3 on Windows has a bug that the functions deflateSetHeader and + * inflateGetHeader are not exported from the dll. Hopefully, this bug + * will be fixed in zlib 1.2.4 and higher. It is already reported to the + * zlib people. The functions deflateSetHeader and inflateGetHeader here + * are just copied from the zlib 1.2.3 source. This is dangerous, but works. + * In practice, the only fields used from the internal state are "wrap" and + * "head", which are rather at the beginning of the structure. As long as the + * offsets of those fields don't change, this code will continue to work. + */ +#define deflateSetHeader dsetheader +#define inflateGetHeader igetheader +static int +deflateSetHeader( + z_streamp strm, + gz_headerp head) +{ + struct internal_state *state; + if (strm == Z_NULL) return Z_STREAM_ERROR; + state = (struct internal_state *) strm->state; + if ((state == Z_NULL) || (state->wrap != 2)) return Z_STREAM_ERROR; + state->gzhead = head; + return Z_OK; +} +static int inflateGetHeader( + z_streamp strm, + gz_headerp head) +{ + struct inflate_state *state; + if (strm == Z_NULL) return Z_STREAM_ERROR; + state = (struct inflate_state *) strm->state; + if ((state == Z_NULL) || ((state->wrap & 2) == 0)) return Z_STREAM_ERROR; + state->head = head; + head->done = 0; + return Z_OK; +} +# endif /* !STATIC_BUILD */ +#endif /* _WIN32 */ + /* * Type of zlib-based compressing and decompressing channels. */ @@ -170,7 +222,7 @@ static const Tcl_ChannelType zlibChannelType = { NULL /*ChanHandler*/, NULL /* wideSeekProc */ }; - + /* *---------------------------------------------------------------------- * @@ -225,7 +277,7 @@ ConvertError( Tcl_SetErrorCode(interp, "TCL", "ZLIB", codeStr, codeStr2, NULL); } } - + /* *---------------------------------------------------------------------- * @@ -270,7 +322,7 @@ GenerateHeader( { Tcl_Obj *value; int len, result = TCL_ERROR; - char *valueStr; + const char *valueStr; Tcl_Encoding latin1enc; static const char *const types[] = { "binary", "text" @@ -346,7 +398,7 @@ GenerateHeader( Tcl_FreeEncoding(latin1enc); return result; } - + /* *---------------------------------------------------------------------- * @@ -437,7 +489,7 @@ ExtractHeader( Tcl_FreeEncoding(latin1enc); } } - + /* *---------------------------------------------------------------------- * @@ -628,7 +680,7 @@ Tcl_ZlibStreamInit( ckfree((char *) zshPtr); return TCL_ERROR; } - + /* *---------------------------------------------------------------------- * @@ -655,7 +707,7 @@ ZlibStreamCmdDelete( zshPtr->cmd = NULL; ZlibStreamCleanup(zshPtr); } - + /* *---------------------------------------------------------------------- * @@ -693,7 +745,7 @@ Tcl_ZlibStreamClose( } return TCL_OK; } - + /* *---------------------------------------------------------------------- * @@ -735,7 +787,7 @@ ZlibStreamCleanup( ckfree((char *) zshPtr); } - + /* *---------------------------------------------------------------------- * @@ -804,7 +856,7 @@ Tcl_ZlibStreamReset( return TCL_OK; } - + /* *---------------------------------------------------------------------- * @@ -838,7 +890,7 @@ Tcl_ZlibStreamGetCommandName( Tcl_GetCommandFullName(zshPtr->interp, zshPtr->cmd, objPtr); return objPtr; } - + /* *---------------------------------------------------------------------- * @@ -866,7 +918,7 @@ Tcl_ZlibStreamEof( return zshPtr->streamEnd; } - + /* *---------------------------------------------------------------------- * @@ -886,7 +938,7 @@ Tcl_ZlibStreamChecksum( return zshPtr->stream.adler; } - + /* *---------------------------------------------------------------------- * @@ -994,7 +1046,7 @@ Tcl_ZlibStreamPut( return TCL_OK; } - + /* *---------------------------------------------------------------------- * @@ -1203,7 +1255,7 @@ Tcl_ZlibStreamGet( } return TCL_OK; } - + /* *---------------------------------------------------------------------- * @@ -1358,7 +1410,7 @@ Tcl_ZlibDeflate( ConvertError(interp, e); return TCL_ERROR; } - + /* *---------------------------------------------------------------------- * @@ -1545,7 +1597,7 @@ Tcl_ZlibInflate( } return TCL_ERROR; } - + /* *---------------------------------------------------------------------- * @@ -1574,7 +1626,7 @@ Tcl_ZlibAdler32( { return adler32(adler, (Bytef *) buf, (unsigned) len); } - + /* *---------------------------------------------------------------------- * @@ -1699,7 +1751,7 @@ TclZlibCmd( } headerDictObj = NULL; for (i=3 ; i<objc ; i+=2) { - static const char *gzipopts[] = { + static const char *const gzipopts[] = { "-header", "-level", NULL }; @@ -1767,7 +1819,7 @@ TclZlibCmd( } headerDictObj = headerVarObj = NULL; for (i=3 ; i<objc ; i+=2) { - static const char *gunzipopts[] = { + static const char *const gunzipopts[] = { "-buffersize", "-headerVar", NULL }; @@ -1853,7 +1905,7 @@ TclZlibCmd( case z_push: { /* push mode channel options...*/ Tcl_Channel chan; int chanMode, mode; - static const char *pushOptions[] = { + static const char *const pushOptions[] = { "-header", "-level", "-limit", NULL }; @@ -2000,7 +2052,7 @@ TclZlibCmd( Tcl_AppendResult(interp, "buffer size must be 32 to 65536", NULL); return TCL_ERROR; } - + /* *---------------------------------------------------------------------- * @@ -2222,7 +2274,7 @@ ZlibStreamCmd( return TCL_OK; } - + /* *---------------------------------------------------------------------- * Set of functions to support channel stacking. @@ -2381,7 +2433,7 @@ ChanOutput( *errorCodePtr = EINVAL; return -1; } - + return toWrite - cd->outStream.avail_out; } @@ -2501,7 +2553,7 @@ ChanGetOption( Tcl_DecrRefCount(tmpObj); } else { int len; - char *str = Tcl_GetStringFromObj(tmpObj, &len); + const char *str = Tcl_GetStringFromObj(tmpObj, &len); Tcl_DStringAppend(dsPtr, str, len); Tcl_DecrRefCount(tmpObj); @@ -2570,7 +2622,7 @@ ChanHandler( return interestMask; } #endif - + /* *---------------------------------------------------------------------- * @@ -2707,7 +2759,7 @@ ZlibStackChannel( ckfree((char *) cd); return NULL; } - + /* *---------------------------------------------------------------------- * Finally, the TclZlibInit function. Used to install the zlib API. @@ -2733,7 +2785,7 @@ TclZlibInit( Tcl_CreateObjCommand(interp, "zlib", TclZlibCmd, 0, 0); return TCL_OK; } - + /* *---------------------------------------------------------------------- * Stubs used when a suitable zlib installation was not found during @@ -2850,7 +2902,7 @@ Tcl_ZlibAdler32( return 0; } #endif /* HAVE_ZLIB */ - + /* * Local Variables: * mode: c diff --git a/win/Makefile.in b/win/Makefile.in index ac0b052..343c3d3 100644 --- a/win/Makefile.in +++ b/win/Makefile.in @@ -4,7 +4,7 @@ # "./configure", which is a configuration script generated by the "autoconf" # program (constructs like "@foo@" will get replaced in the actual Makefile. # -# RCS: @(#) $Id: Makefile.in,v 1.149 2009/02/16 21:41:56 nijtmans Exp $ +# RCS: @(#) $Id: Makefile.in,v 1.150 2009/02/16 22:56:14 nijtmans Exp $ VERSION = @TCL_VERSION@ @@ -135,13 +135,14 @@ TCL_DLL_FILE = @TCL_DLL_FILE@ TCL_STATIC_LIB_FILE = @TCL_STATIC_LIB_FILE@ TCL_IMPORT_LIB_FILE = @TCL_IMPORT_LIB_FILE@ TCL_LIB_FILE = @TCL_LIB_FILE@ +ZLIB_DLL_FILE = zlib1${DLLSUFFIX} DDE_DLL_FILE = tcldde$(DDEVER)${DLLSUFFIX} DDE_LIB_FILE = tcldde$(DDEVER)${LIBSUFFIX} REG_DLL_FILE = tclreg$(REGVER)${DLLSUFFIX} REG_LIB_FILE = tclreg$(REGVER)${LIBSUFFIX} PIPE_DLL_FILE = tclpip$(VER)${DLLSUFFIX} -SHARED_LIBRARIES = $(TCL_DLL_FILE) $(TCL_STUB_LIB_FILE) \ +SHARED_LIBRARIES = $(TCL_DLL_FILE) $(ZLIB_DLL_FILE) $(TCL_STUB_LIB_FILE) \ $(DDE_DLL_FILE) $(REG_DLL_FILE) $(PIPE_DLL_FILE) STATIC_LIBRARIES = $(TCL_LIB_FILE) $(TCL_STUB_LIB_FILE) $(REG_LIB_FILE) $(DDE_LIB_FILE) @@ -182,7 +183,7 @@ SHLIB_LD = @SHLIB_LD@ SHLIB_LD_LIBS = @SHLIB_LD_LIBS@ SHLIB_CFLAGS = @SHLIB_CFLAGS@ SHLIB_SUFFIX = @SHLIB_SUFFIX@ -LIBS = @LIBS@ +LIBS = @LIBS@ @ZLIB_LIBS@ RMDIR = rm -rf MKDIR = mkdir -p @@ -400,7 +401,7 @@ ZLIB_OBJS = \ Zuncompr.$(OBJEXT) \ Zzutil.$(OBJEXT) -TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} ${ZLIB_OBJS} +TCL_OBJS = ${GENERIC_OBJS} $(TOMMATH_OBJS) ${WIN_OBJS} @ZLIB_OBJS@ TCL_DOCS = "$(ROOT_DIR_NATIVE)"/doc/*.[13n] @@ -436,7 +437,7 @@ ${TCL_STUB_LIB_FILE}: ${STUB_OBJS} @MAKE_LIB@ ${STUB_OBJS} @POST_MAKE_LIB@ -${TCL_DLL_FILE} $(TCL_IMPORT_LIB_FILE): ${TCL_OBJS} tcl.$(RES) +${TCL_DLL_FILE} $(TCL_IMPORT_LIB_FILE): ${TCL_OBJS} tcl.$(RES) @ZLIB_DLL_FILE@ @$(RM) ${TCL_DLL_FILE} $(TCL_IMPORT_LIB_FILE) @MAKE_DLL@ ${TCL_OBJS} tcl.$(RES) $(SHLIB_LD_LIBS) @@ -463,6 +464,10 @@ ${REG_LIB_FILE}: ${REG_OBJS} ${TCL_LIB_FILE} @$(RM) ${REG_LIB_FILE} @MAKE_LIB@ ${REG_OBJS} ${TCL_LIB_FILE} +# use pre-built zlib1.dll +${ZLIB_DLL_FILE}: $(ZLIB_DIR)/win32/${ZLIB_DLL_FILE} + @$(COPY) $(ZLIB_DIR)/win32/${ZLIB_DLL_FILE} ${ZLIB_DLL_FILE} + # PIPE_DLL_FILE is actually an executable, don't build it like a DLL. ${PIPE_DLL_FILE}: ${PIPE_OBJS} @@ -617,7 +622,7 @@ install-binaries: binaries else true; \ fi; \ done; - @for i in $(TCL_DLL_FILE) $(TCLSH) $(PIPE_DLL_FILE); \ + @for i in $(TCL_DLL_FILE) $(ZLIB_DLL_FILE) $(TCLSH) $(PIPE_DLL_FILE); \ do \ if [ -f $$i ]; then \ echo "Installing $$i to $(BIN_INSTALL_DIR)/"; \ diff --git a/win/configure b/win/configure index 399c326..819c2de 100755 --- a/win/configure +++ b/win/configure @@ -272,7 +272,7 @@ PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="../generic/tcl.h" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AR RANLIB RC SET_MAKE TCL_THREADS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING CFLAGS_DEFAULT LDFLAGS_DEFAULT TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL PKG_CFG_ARGS TCL_LIB_FILE TCL_LIB_FLAG TCL_STATIC_LIB_FILE TCL_STATIC_LIB_FLAG TCL_IMPORT_LIB_FILE TCL_IMPORT_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_STUB_LIB_PATH TCL_INCLUDE_SPEC TCL_BUILD_STUB_LIB_SPEC TCL_BUILD_STUB_LIB_PATH TCL_DLL_FILE TCL_SRC_DIR TCL_BIN_DIR TCL_DBGX CFG_TCL_SHARED_LIB_SUFFIX CFG_TCL_UNSHARED_LIB_SUFFIX CFG_TCL_EXPORT_FILE_SUFFIX EXTRA_CFLAGS DEPARG CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX TCL_SHARED_BUILD LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TCL_BUILD_LIB_SPEC TCL_LD_SEARCH_FLAGS TCL_NEEDS_EXP_FILE TCL_BUILD_EXP_FILE TCL_EXP_FILE TCL_LIB_VERSIONS_OK TCL_PACKAGE_PATH TCL_DDE_VERSION TCL_DDE_MAJOR_VERSION TCL_DDE_MINOR_VERSION TCL_DDE_PATCH_LEVEL TCL_REG_VERSION TCL_REG_MAJOR_VERSION TCL_REG_MINOR_VERSION TCL_REG_PATCH_LEVEL RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES RES LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AR RANLIB RC SET_MAKE TCL_THREADS ZLIB_DLL_FILE ZLIB_LIBS ZLIB_OBJS CYGPATH CELIB_DIR DL_LIBS CFLAGS_DEBUG CFLAGS_OPTIMIZE CFLAGS_WARNING CFLAGS_DEFAULT LDFLAGS_DEFAULT TCL_VERSION TCL_MAJOR_VERSION TCL_MINOR_VERSION TCL_PATCH_LEVEL PKG_CFG_ARGS TCL_LIB_FILE TCL_LIB_FLAG TCL_STATIC_LIB_FILE TCL_STATIC_LIB_FLAG TCL_IMPORT_LIB_FILE TCL_IMPORT_LIB_FLAG TCL_LIB_SPEC TCL_STUB_LIB_FILE TCL_STUB_LIB_FLAG TCL_STUB_LIB_SPEC TCL_STUB_LIB_PATH TCL_INCLUDE_SPEC TCL_BUILD_STUB_LIB_SPEC TCL_BUILD_STUB_LIB_PATH TCL_DLL_FILE TCL_SRC_DIR TCL_BIN_DIR TCL_DBGX CFG_TCL_SHARED_LIB_SUFFIX CFG_TCL_UNSHARED_LIB_SUFFIX CFG_TCL_EXPORT_FILE_SUFFIX EXTRA_CFLAGS DEPARG CC_OBJNAME CC_EXENAME LDFLAGS_DEBUG LDFLAGS_OPTIMIZE LDFLAGS_CONSOLE LDFLAGS_WINDOW STLIB_LD SHLIB_LD SHLIB_LD_LIBS SHLIB_CFLAGS SHLIB_SUFFIX TCL_SHARED_BUILD LIBS_GUI DLLSUFFIX LIBPREFIX LIBSUFFIX EXESUFFIX LIBRARIES MAKE_LIB POST_MAKE_LIB MAKE_DLL MAKE_EXE TCL_BUILD_LIB_SPEC TCL_LD_SEARCH_FLAGS TCL_NEEDS_EXP_FILE TCL_BUILD_EXP_FILE TCL_EXP_FILE TCL_LIB_VERSIONS_OK TCL_PACKAGE_PATH TCL_DDE_VERSION TCL_DDE_MAJOR_VERSION TCL_DDE_MINOR_VERSION TCL_DDE_PATCH_LEVEL TCL_REG_VERSION TCL_REG_MAJOR_VERSION TCL_REG_MINOR_VERSION TCL_REG_PATCH_LEVEL RC_OUT RC_TYPE RC_INCLUDE RC_DEFINE RC_DEFINES RES LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. @@ -3664,6 +3664,40 @@ _ACEOF # as we just assume that the platform hasn't got a usable z.lib #------------------------------------------------------------------------ +if test "$do64bit" = "yes"; then + + tcl_ok=no + +else + +if test "${enable_shared+set}" = "set"; then + + enableval="$enable_shared" + tcl_ok=$enableval + +else + + tcl_ok=yes + +fi + + +fi + +if test "$tcl_ok" = "yes"; then + + ZLIB_DLL_FILE=\${ZLIB_DLL_FILE} + + ZLIB_LIBS=\${ZLIB_DIR}/win32/zdll.lib + + +else + + ZLIB_OBJS=\${ZLIB_OBJS} + + +fi + cat >>confdefs.h <<\_ACEOF #define HAVE_ZLIB 1 @@ -5079,6 +5113,9 @@ s,@RANLIB@,$RANLIB,;t t s,@RC@,$RC,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@TCL_THREADS@,$TCL_THREADS,;t t +s,@ZLIB_DLL_FILE@,$ZLIB_DLL_FILE,;t t +s,@ZLIB_LIBS@,$ZLIB_LIBS,;t t +s,@ZLIB_OBJS@,$ZLIB_OBJS,;t t s,@CYGPATH@,$CYGPATH,;t t s,@CELIB_DIR@,$CELIB_DIR,;t t s,@DL_LIBS@,$DL_LIBS,;t t diff --git a/win/configure.in b/win/configure.in index 33f40cc..5c8a3f7 100644 --- a/win/configure.in +++ b/win/configure.in @@ -3,7 +3,7 @@ # generate the file "configure", which is run during Tcl installation # to configure the system for the local environment. # -# RCS: @(#) $Id: configure.in,v 1.116 2009/01/16 20:44:25 dgp Exp $ +# RCS: @(#) $Id: configure.in,v 1.117 2009/02/16 22:56:14 nijtmans Exp $ AC_INIT(../generic/tcl.h) AC_PREREQ(2.59) @@ -343,6 +343,22 @@ SC_ENABLE_SHARED # as we just assume that the platform hasn't got a usable z.lib #------------------------------------------------------------------------ +AS_IF([test "$do64bit" = "yes"], [ + tcl_ok=no +], [ +AS_IF([test "${enable_shared+set}" = "set"], [ + enableval="$enable_shared" + tcl_ok=$enableval +], [ + tcl_ok=yes +]) +]) +AS_IF([test "$tcl_ok" = "yes"], [ + AC_SUBST(ZLIB_DLL_FILE,[\${ZLIB_DLL_FILE}]) + AC_SUBST(ZLIB_LIBS,[\${ZLIB_DIR}/win32/zdll.lib]) +], [ + AC_SUBST(ZLIB_OBJS,[\${ZLIB_OBJS}]) +]) AC_DEFINE(HAVE_ZLIB, 1, [Is there an installed zlib?]) #-------------------------------------------------------------------- |