summaryrefslogtreecommitdiffstats
path: root/generic
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 /generic
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.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c9
-rw-r--r--generic/tclZlib.c112
2 files changed, 119 insertions, 2 deletions
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: