File tkimg-syslibs.patch of Package tkimg

--- configure.in
+++ configure.in
@@ -43,24 +43,20 @@
 CC=`echo $CC | sed -e 's/ .*$//'`
 
 TEA_CONFIG_COLLECT
-TEA_CONFIG_SUBDIR(libz/tcl,   [])
-TEA_CONFIG_SUBDIR(libpng/tcl, [--with-zlibtcl=`pwd`/libz/tcl])
-TEA_CONFIG_SUBDIR(libtiff/tcl,[])
-TEA_CONFIG_SUBDIR(libjpeg/tcl,[])
 TEA_CONFIG_SUBDIR(base,       [])
 TEA_CONFIG_SUBDIR(bmp,        [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(gif,        [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(ico,        [--with-tkimg=`pwd`/base])
-TEA_CONFIG_SUBDIR(jpeg,       [--with-tkimg=`pwd`/base --with-jpegtcl=`pwd`/libjpeg/tcl])
+TEA_CONFIG_SUBDIR(jpeg,       [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(pcx,        [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(pixmap,     [--with-tkimg=`pwd`/base])
-TEA_CONFIG_SUBDIR(png,        [--with-tkimg=`pwd`/base --with-pngtcl=`pwd`/libpng/tcl --with-zlibtcl=`pwd`/libz/tcl])
+TEA_CONFIG_SUBDIR(png,        [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(ppm,        [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(ps,         [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(sgi,        [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(sun,        [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(tga,        [--with-tkimg=`pwd`/base])
-TEA_CONFIG_SUBDIR(tiff,       [--with-tkimg=`pwd`/base --with-tifftcl=`pwd`/libtiff/tcl --with-zlibtcl=`pwd`/libz/tcl --with-jpegtcl=`pwd`/libjpeg/tcl])
+TEA_CONFIG_SUBDIR(tiff,       [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(window,     [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(xbm,        [--with-tkimg=`pwd`/base])
 TEA_CONFIG_SUBDIR(xpm,        [--with-tkimg=`pwd`/base])
--- jpeg/Makefile.in
+++ jpeg/Makefile.in
@@ -51,10 +51,6 @@
 ## tkimgjpegstub_OBJECTS	= tkimgjpegStubLib.$(OBJEXT)
 ## tkimgjpegstub_LIB_FILE= @tkimgjpegstub_LIB_FILE@
 
-jpegtcl_SRC_PATH	= @jpegtcl_SRC_PATH@
-jpegtcl_BUILD_PATH	= @jpegtcl_BUILD_PATH@
-jpegtcl_VERSION		= @jpegtcl_VERSION@
-
 tkimg_SRC_PATH		= @tkimg_SRC_PATH@
 tkimg_BUILD_PATH	= @tkimg_BUILD_PATH@
 tkimg_VERSION		= @tkimg_VERSION@
@@ -189,8 +185,6 @@
 
 INCLUDES	=				\
 		-I$(tkimg_SRC_PATH)		\
-		-I$(jpegtcl_SRC_PATH)		\
-		-I$(jpegtcl_BUILD_PATH)/libjpeg	\
 		-I. -I$(srcdir)			\
 		@TCL_INCLUDES@			\
 		@TK_INCLUDES@			\
@@ -202,8 +196,7 @@
 
 CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl
 
-CPPFLAGS	= @CPPFLAGS@ -DPACKAGE_NAME=\"$(DPACKAGE)\"	\
-		-DJPEGTCL_VERSION=\"$(jpegtcl_VERSION)\"	\
+CPPFLAGS	= @CPPFLAGS@ -DPACKAGE_NAME=\"$(DPACKAGE)\"
 
 LIBS		= @LIBS@
 AR		= ar
--- jpeg/configure.in
+++ jpeg/configure.in
@@ -95,11 +95,6 @@
 TEA_PATH_CONFIG(tkimg)
 TEA_LOAD_CONFIG(tkimg)
 
-TEA_PATH_CONFIG(jpegtcl)
-TEA_LOAD_CONFIG(jpegtcl)
-AC_SUBST(jpegtcl_VERSION)
-
-IMG_SRCPATH(jpegtcl)
 IMG_SRCPATH(tkimg)
 
 #--------------------------------------------------------------------
@@ -186,7 +181,6 @@
 AC_DEFINE(USE_TCL_STUBS)
 AC_DEFINE(USE_TK_STUBS)
 AC_DEFINE(USE_TKIMG_STUBS)
-AC_DEFINE(USE_JPEGTCL_STUBS)
 
 #--------------------------------------------------------------------
 # This macro generates a line to use when building a library.  It
@@ -203,13 +197,11 @@
 
 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
     SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${tkimg_STUB_LIB_PATH}`\""
-    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${jpegtcl_STUB_LIB_PATH}`\""
 else
     SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${tkimg_STUB_LIB_SPEC}"
-    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${jpegtcl_STUB_LIB_SPEC}"
 fi
 
-SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \${TK_LIBS}"
+SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -ljpeg \${TK_LIBS}"
 
 #--------------------------------------------------------------------
 # Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
--- jpeg/jpeg.c
+++ jpeg/jpeg.c
@@ -53,9 +53,10 @@
  */
 
 #include <stdio.h>
-
-#include <tcl.h>
-#include <jpegtcl.h>
+#include <sys/types.h>
+#include <jpeglib.h>
+#include <jerror.h>
+#include <tk.h>
 
 static int SetupJPegLibrary _ANSI_ARGS_ ((Tcl_Interp *interp));
 
@@ -145,10 +146,6 @@
     struct my_error_mgr jerror;	/* for controlling libjpeg error handling */
     int i;
 
-    if (Jpegtcl_InitStubs(interp, "1.0", 0) == NULL) {
-        return TCL_ERROR;
-    }
-
     /* The followin code tries to determine if the JPEG library is
        valid at all. The library might be configured differently,
        which will produce core dumps. Also it might be that
--- png/Makefile.in
+++ png/Makefile.in
@@ -51,14 +51,6 @@
 ## tkimgpngstub_OBJECTS	= tkimgpngStubLib.$(OBJEXT)
 ## tkimgpngstub_LIB_FILE= @tkimgpngstub_LIB_FILE@
 
-pngtcl_SRC_PATH		= @pngtcl_SRC_PATH@
-pngtcl_BUILD_PATH	= @pngtcl_BUILD_PATH@
-pngtcl_VERSION		= @pngtcl_VERSION@
-
-zlibtcl_SRC_PATH	= @zlibtcl_SRC_PATH@
-zlibtcl_BUILD_PATH	= @zlibtcl_BUILD_PATH@
-zlibtcl_VERSION		= @zlibtcl_VERSION@
-
 tkimg_SRC_PATH		= @tkimg_SRC_PATH@
 tkimg_BUILD_PATH	= @tkimg_BUILD_PATH@
 tkimg_VERSION		= @tkimg_VERSION@
@@ -193,10 +185,6 @@
 
 INCLUDES	=			\
 		-I$(tkimg_SRC_PATH)		\
-		-I$(pngtcl_SRC_PATH)	\
-		-I$(pngtcl_BUILD_PATH)	\
-		-I$(zlibtcl_SRC_PATH)	\
-		-I$(zlibtcl_BUILD_PATH)	\
 		-I. -I$(srcdir)		\
 		@TCL_INCLUDES@		\
 		@TK_INCLUDES@		\
@@ -208,9 +196,7 @@
 
 CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl
 
-CPPFLAGS	= @CPPFLAGS@ -DPACKAGE_NAME=\"$(DPACKAGE)\"	\
-		-DPNGTCL_VERSION=\"$(pngtcl_VERSION)\"	\
-		-DPNGTCL_VERSION=\"$(zlibtcl_VERSION)\"
+CPPFLAGS	= @CPPFLAGS@ -DPACKAGE_NAME=\"$(DPACKAGE)\"
 
 LIBS		= @LIBS@
 AR		= ar
--- png/configure.in
+++ png/configure.in
@@ -95,17 +95,7 @@
 TEA_PATH_CONFIG(tkimg)
 TEA_LOAD_CONFIG(tkimg)
 
-TEA_PATH_CONFIG(pngtcl)
-TEA_LOAD_CONFIG(pngtcl)
-AC_SUBST(pngtcl_VERSION)
-
-TEA_PATH_CONFIG(zlibtcl)
-TEA_LOAD_CONFIG(zlibtcl)
-AC_SUBST(zlibtcl_VERSION)
-
 IMG_SRCPATH(tkimg)
-IMG_SRCPATH(pngtcl)
-IMG_SRCPATH(zlibtcl)
 
 #--------------------------------------------------------------------
 # __CHANGE__
@@ -191,8 +181,6 @@
 AC_DEFINE(USE_TCL_STUBS)
 AC_DEFINE(USE_TK_STUBS)
 AC_DEFINE(USE_TKIMG_STUBS)
-AC_DEFINE(USE_PNGTCL_STUBS)
-AC_DEFINE(USE_ZLIBTCL_STUBS)
 
 #--------------------------------------------------------------------
 # This macro generates a line to use when building a library.  It
@@ -209,13 +197,11 @@
 
 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
     SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${tkimg_STUB_LIB_PATH}`\""
-    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${pngtcl_STUB_LIB_PATH}`\""
 else
     SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${tkimg_STUB_LIB_SPEC}"
-    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${pngtcl_STUB_LIB_SPEC}"
 fi
 
-SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \${TK_LIBS}"
+SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -lpng \${TK_LIBS}"
 
 #--------------------------------------------------------------------
 # Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
--- png/png.c
+++ png/png.c
@@ -21,7 +21,7 @@
  */
 
 #include <tcl.h>
-#include <pngtcl.h>
+#include <png.h>
 #include <string.h>
 #include <stdlib.h>
 
@@ -108,9 +108,6 @@
 SetupPngLibrary (interp)
     Tcl_Interp *interp;
 {
-    if (Pngtcl_InitStubs(interp, PNGTCL_VERSION, 0) == NULL) {
-        return TCL_ERROR;
-    }
     return TCL_OK;
 }
 
--- tclconfig/tcl.m4
+++ tclconfig/tcl.m4
@@ -912,7 +912,7 @@
 
 	    # AIX v<=4.1 has some different flags than 4.2+
 	    if test "$system" = "AIX-4.1" -o "`uname -v`" -lt "4" ; then
-		LIBOBJS="$LIBOBJS tclLoadAix.o"
+		AC_LIBOBJ([tclLoadAix])
 		DL_LIBS="-lld"
 	    fi
 
@@ -2178,7 +2178,7 @@
 	    AC_MSG_RESULT([ok])
 	else
 	    AC_MSG_RESULT([buggy])
-	    LIBOBJS="$LIBOBJS fixstrtod.o"
+	    AC_LIBOBJ([fixstrtod])
 	    AC_DEFINE(strtod, fixstrtod)
 	fi
     fi
--- tiff/Makefile.in
+++ tiff/Makefile.in
@@ -28,9 +28,6 @@
 
 tkimgtiff_SOURCES	=	\
 		tiff.c		\
-		tiffZip.c	\
-		tiffJpeg.c	\
-		tiffPixar.c	\
 		@EXTRA_SOURCES@
 
 WIN_SOURCES	= 
@@ -54,18 +51,6 @@
 ## tkimgtiffstub_OBJECTS	= tkimgtiffStubLib.$(OBJEXT)
 ## tkimgtiffstub_LIB_FILE= @tkimgtiffstub_LIB_FILE@
 
-tifftcl_SRC_PATH	= @tifftcl_SRC_PATH@
-tifftcl_BUILD_PATH	= @tifftcl_BUILD_PATH@
-tifftcl_VERSION		= @tifftcl_VERSION@
-
-jpegtcl_SRC_PATH	= @jpegtcl_SRC_PATH@
-jpegtcl_BUILD_PATH	= @jpegtcl_BUILD_PATH@
-jpegtcl_VERSION		= @jpegtcl_VERSION@
-
-zlibtcl_SRC_PATH	= @zlibtcl_SRC_PATH@
-zlibtcl_BUILD_PATH	= @zlibtcl_BUILD_PATH@
-zlibtcl_VERSION		= @zlibtcl_VERSION@
-
 tkimg_SRC_PATH		= @tkimg_SRC_PATH@
 tkimg_BUILD_PATH	= @tkimg_BUILD_PATH@
 tkimg_VERSION		= @tkimg_VERSION@
@@ -200,12 +185,6 @@
 
 INCLUDES	=				\
 		-I$(tkimg_SRC_PATH)		\
-		-I$(tifftcl_SRC_PATH)		\
-		-I$(tifftcl_BUILD_PATH)/libtiff	\
-		-I$(jpegtcl_SRC_PATH)		\
-		-I$(jpegtcl_BUILD_PATH)/libjpeg	\
-		-I$(zlibtcl_SRC_PATH)		\
-		-I$(zlibtcl_BUILD_PATH)		\
 		-I. -I$(srcdir)			\
 		@TCL_INCLUDES@			\
 		@TK_INCLUDES@			\
@@ -217,10 +196,7 @@
 
 CONFIG_CLEAN_FILES = Makefile pkgIndex.tcl
 
-CPPFLAGS	= @CPPFLAGS@ -DPACKAGE_NAME=\"$(DPACKAGE)\"	\
-		-DTIFFTCL_VERSION=\"$(tifftcl_VERSION)\"	\
-		-DJPEGTCL_VERSION=\"$(jpegtcl_VERSION)\"	\
-		-DZLIBTCL_VERSION=\"$(zlibtcl_VERSION)\"
+CPPFLAGS	= @CPPFLAGS@ -DPACKAGE_NAME=\"$(DPACKAGE)\"
 
 LIBS		= @LIBS@
 AR		= ar
--- tiff/configure.in
+++ tiff/configure.in
@@ -95,22 +95,7 @@
 TEA_PATH_CONFIG(tkimg)
 TEA_LOAD_CONFIG(tkimg)
 
-TEA_PATH_CONFIG(tifftcl)
-TEA_LOAD_CONFIG(tifftcl)
-AC_SUBST(tifftcl_VERSION)
-
-TEA_PATH_CONFIG(jpegtcl)
-TEA_LOAD_CONFIG(jpegtcl)
-AC_SUBST(jpegtcl_VERSION)
-
-TEA_PATH_CONFIG(zlibtcl)
-TEA_LOAD_CONFIG(zlibtcl)
-AC_SUBST(zlibtcl_VERSION)
-
 IMG_SRCPATH(tkimg)
-IMG_SRCPATH(tifftcl)
-IMG_SRCPATH(jpegtcl)
-IMG_SRCPATH(zlibtcl)
 
 #--------------------------------------------------------------------
 # __CHANGE__
@@ -196,9 +181,6 @@
 AC_DEFINE(USE_TCL_STUBS)
 AC_DEFINE(USE_TK_STUBS)
 AC_DEFINE(USE_TKIMG_STUBS)
-AC_DEFINE(USE_TIFFTCL_STUBS)
-AC_DEFINE(USE_JPEGTCL_STUBS)
-AC_DEFINE(USE_ZLIBTCL_STUBS)
 
 #--------------------------------------------------------------------
 # This macro generates a line to use when building a library.  It
@@ -215,17 +197,11 @@
 
 if test "${TEA_PLATFORM}" = "windows" -a "$GCC" != "yes" ; then
     SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${tkimg_STUB_LIB_PATH}`\""
-    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${tifftcl_STUB_LIB_PATH}`\""
-    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${jpegtcl_STUB_LIB_PATH}`\""
-    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \"`${CYGPATH} ${zlibtcl_STUB_LIB_PATH}`\""
 else
     SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${tkimg_STUB_LIB_SPEC}"
-    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${tifftcl_STUB_LIB_SPEC}"
-    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${jpegtcl_STUB_LIB_SPEC}"
-    SHLIB_LD_LIBS="${SHLIB_LD_LIBS} ${zlibtcl_STUB_LIB_SPEC}"
 fi
 
-SHLIB_LD_LIBS="${SHLIB_LD_LIBS} \${TK_LIBS}"
+SHLIB_LD_LIBS="${SHLIB_LD_LIBS} -ltiff \${TK_LIBS}"
 
 #--------------------------------------------------------------------
 # Find tclsh so that we can run pkg_mkIndex to generate the pkgIndex.tcl
--- tiff/tiff.c
+++ tiff/tiff.c
@@ -14,10 +14,7 @@
  * Generic initialization code, parameterized via CPACKAGE and PACKAGE.
  */
 
-#include <tcl.h>
-#include <tifftcl.h>
-#include <jpegtcl.h>
-#include <zlibtcl.h>
+#include <tk.h>
 
 static int SetupTiffLibrary _ANSI_ARGS_ ((Tcl_Interp *interp));
 
@@ -26,6 +23,8 @@
 
 #include "init.c"
 
+#include <tiff.h>
+#include <tiffio.h>
 #include <tiffInt.h>
 
 
@@ -81,10 +80,6 @@
 {
     static int initialized = 0;
 
-    if (Tifftcl_InitStubs(interp, TIFFTCL_VERSION, 0) == NULL) {
-        return TCL_ERROR;
-    }
-
     if (errorMessage) {
 	ckfree(errorMessage);
 	errorMessage = NULL;
@@ -96,35 +91,8 @@
 	TIFFSetWarningHandler(_TIFFwarn);
     }
 
-    /*
-     * Initialize jpeg and zlib too, for use by the CODEC's we register
-     * with the base TIFF library in this package.
-     */
-
-    if (Jpegtcl_InitStubs(interp, "1.0", 0) == NULL) {
-        return TCL_ERROR;
-    }
-
     if (!initialized) {
 	initialized = 1;
-	if (
-	    TIFFRegisterCODEC   && TIFFError        && TIFFPredictorInit &&
-	    TIFFMergeFieldInfo  && TIFFFlushData1   && _TIFFNoPostDecode &&
-	    TIFFTileRowSize     && TIFFScanlineSize && _TIFFsetByteArray &&
-	    TIFFVSetField       && TIFFSwabArrayOfShort
-	    ) {
-
-	  if (Zlibtcl_InitStubs(interp, "1.0", 0) == NULL) {
-	    return TCL_ERROR;
-	  }
-	  TIFFRegisterCODEC (COMPRESSION_DEFLATE,  "Deflate",  TkimgTIFFInitZip);
-
-	  if (Jpegtcl_InitStubs(interp, "1.0", 0) == NULL) {
-	    return TCL_ERROR;
-	  }
-	  TIFFRegisterCODEC (COMPRESSION_JPEG,     "JPEG",     TkimgTIFFInitJpeg);
-	  TIFFRegisterCODEC (COMPRESSION_PIXARLOG, "PixarLog", TkimgTIFFInitPixar);
-	}
     }
     return TCL_OK;
 }
--- tiff/tiffInt.h
+++ tiff/tiffInt.h
@@ -2,7 +2,7 @@
  * tiffInit.h --
  */
 
-#include <tifftcl.h>
+#include <tiff.h>
 
 /*
  * Declarations shared between the .c files of the TIFF format handler.