summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2008-12-12 16:18:09 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2008-12-12 16:18:09 (GMT)
commita5fbabae01fb74139bbfe1c34061e2458395cba5 (patch)
tree3f8eb53a3165efd0a8a534427ad6f88c4520bb6c
parent93b82f20898aee2279608c81083e429192114e7a (diff)
downloadtcl-a5fbabae01fb74139bbfe1c34061e2458395cba5.zip
tcl-a5fbabae01fb74139bbfe1c34061e2458395cba5.tar.gz
tcl-a5fbabae01fb74139bbfe1c34061e2458395cba5.tar.bz2
Make a bad zlib install less fatal to rest of Tcl for now.
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclBasic.c9
-rw-r--r--generic/tclZlib.c112
-rw-r--r--unix/configure.in15
4 files changed, 135 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 39e3769..51f4989 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-12 Donal K. Fellows <dkf@users.sf.net>
+
+ * generic/tclZlib.c, unix/configure.in: Added stubs to use when the
+ version of zlib is not capable enough, and automagic to detect when
+ that is the case.
+
2008-12-12 Alexandre Ferrieux <ferrieux@users.sourceforge.net>
* unix/tclUnixNotfy.c Fix missing CLOEXEC on internal pipes [2417695]
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index c8928ec..cfc88cc 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -16,7 +16,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclBasic.c,v 1.376 2008/12/11 01:21:52 dkf Exp $
+ * RCS: @(#) $Id: tclBasic.c,v 1.377 2008/12/12 16:18:09 dkf Exp $
*/
#include "tclInt.h"
@@ -914,9 +914,16 @@ Tcl_CreateInterp(void)
Tcl_Panic(Tcl_GetString(Tcl_GetObjResult(interp)));
}
+ /*
+ * Only build in zlib support if we've successfully detected a library to
+ * compile and link against.
+ */
+
+#ifdef HAVE_ZLIB
if (TclZlibInit(interp) != TCL_OK) {
Tcl_Panic(Tcl_GetString(Tcl_GetObjResult(interp)));
}
+#endif
TOP_CB(iPtr) = NULL;
return interp;
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index 0daea04..ab38696 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -13,10 +13,11 @@
* 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.6 2008/12/12 15:06:10 dkf Exp $
+ * RCS: @(#) $Id: tclZlib.c,v 1.7 2008/12/12 16:18:09 dkf Exp $
*/
#include "tclInt.h"
+#ifdef HAVE_ZLIB
#include <zlib.h>
#define GZIP_MAGIC_FLAG 16
@@ -2115,6 +2116,115 @@ TclZlibInit(
Tcl_CreateObjCommand(interp, "zlib", ZlibCmd, 0, 0);
return TCL_OK;
}
+#else /* HAVE_ZLIB */
+int
+Tcl_ZlibStreamInit(
+ Tcl_Interp *interp,
+ int mode,
+ int format,
+ int level,
+ Tcl_Obj *dictObj,
+ Tcl_ZlibStream *zshandle)
+{
+ Tcl_SetResult(interp, "unimplemented", TCL_STATIC);
+ return TCL_ERROR;
+}
+
+int
+Tcl_ZlibStreamClose(
+ Tcl_ZlibStream zshandle)
+{
+ return TCL_OK;
+}
+
+int
+Tcl_ZlibStreamReset(
+ Tcl_ZlibStream zshandle)
+{
+ return TCL_OK;
+}
+
+Tcl_Obj *
+Tcl_ZlibStreamGetCommandName(
+ Tcl_ZlibStream zshandle)
+{
+ return NULL;
+}
+
+int
+Tcl_ZlibStreamEof(
+ Tcl_ZlibStream zshandle)
+{
+ return 1;
+}
+
+int
+Tcl_ZlibStreamAdler32(
+ Tcl_ZlibStream zshandle)
+{
+ return 0;
+}
+
+int
+Tcl_ZlibStreamPut(
+ Tcl_ZlibStream zshandle,
+ Tcl_Obj *data,
+ int flush)
+{
+ return TCL_OK;
+}
+
+int
+Tcl_ZlibStreamGet(
+ Tcl_ZlibStream zshandle,
+ Tcl_Obj *data,
+ int count)
+{
+ return TCL_OK;
+}
+
+int
+Tcl_ZlibDeflate(
+ Tcl_Interp *interp,
+ int format,
+ Tcl_Obj *data,
+ int level,
+ Tcl_Obj *gzipHeaderDictObj)
+{
+ Tcl_SetResult(interp, "unimplemented", TCL_STATIC);
+ return TCL_ERROR;
+}
+
+int
+Tcl_ZlibInflate(
+ Tcl_Interp *interp,
+ int format,
+ Tcl_Obj *data,
+ int bufferSize,
+ Tcl_Obj *gzipHeaderDictObj)
+{
+ Tcl_SetResult(interp, "unimplemented", TCL_STATIC);
+ return TCL_ERROR;
+}
+
+unsigned int
+Tcl_ZlibCRC32(
+ unsigned int crc,
+ const char *buf,
+ int len)
+{
+ return 0;
+}
+
+unsigned int
+Tcl_ZlibAdler32(
+ unsigned int adler,
+ const char *buf,
+ int len)
+{
+ return 0;
+}
+#endif /* HAVE_ZLIB */
/*
* Local Variables:
diff --git a/unix/configure.in b/unix/configure.in
index 9dfba00..339b845 100644
--- a/unix/configure.in
+++ b/unix/configure.in
@@ -3,7 +3,7 @@ dnl This file is an input file used by the GNU "autoconf" program to
dnl generate the file "configure", which is run during Tcl installation
dnl to configure the system for the local environment.
#
-# RCS: @(#) $Id: configure.in,v 1.192 2008/12/11 14:42:44 dkf Exp $
+# RCS: @(#) $Id: configure.in,v 1.193 2008/12/12 16:18:09 dkf Exp $
AC_INIT([tcl],[8.6])
AC_PREREQ(2.59)
@@ -118,12 +118,17 @@ SC_ENABLE_SHARED
#------------------------------------------------------------------------
zlib_ok=yes
-AC_CHECK_HEADER([zlib.h],[],[
+AC_CHECK_HEADER([zlib.h],[
+ AC_CHECK_TYPE([gz_header],[],[
zlib_ok=no
- echo TODO: Add -I$srcdir/compat/zlib/include to compile lines...
-])
-AC_SEARCH_LIBS([adler32],[z],[],[
+ AC_DIAGNOSE([],[TODO: Add -I$srcdir/compat/zlib/include to compile lines])
+ ],[#include <zlib.h>])],[
+ zlib_ok=no
+ AC_DIAGNOSE([],[TODO: Add -I$srcdir/compat/zlib/include to compile lines])
+ ])
+AC_SEARCH_LIBS([deflateSetHeader],[z],[],[
zlib_ok=no
+ AC_DIAGNOSE([],[TODO: Add $srcdir/compat/zlib to list of things to build])
])
if test $zlib_ok = yes; then
AC_DEFINE(HAVE_ZLIB, 1, [Is there an installed zlib?])