--- libtk-img-1.3-release.orig/debian/libtk-img.dirs
+++ libtk-img-1.3-release/debian/libtk-img.dirs
@@ -0,0 +1,2 @@
+usr/lib
+usr/share/lintian/overrides
--- libtk-img-1.3-release.orig/debian/libtk-img.lintian-overrides
+++ libtk-img-1.3-release/debian/libtk-img.lintian-overrides
@@ -0,0 +1,2 @@
+# Overridden false positive
+libtk-img: embedded-library usr/lib/tcltk/Img1.3/libtkimgtiff1.3.so: tiff
--- libtk-img-1.3-release.orig/debian/libtk-img.docs
+++ libtk-img-1.3-release/debian/libtk-img.docs
@@ -0,0 +1 @@
+README
--- libtk-img-1.3-release.orig/debian/libtk-img.install
+++ libtk-img-1.3-release/debian/libtk-img.install
@@ -0,0 +1,2 @@
+debian/tmp/usr/lib/tcltk/Img*/*.so
+debian/tmp/usr/lib/tcltk/Img*/*.tcl
--- libtk-img-1.3-release.orig/debian/rules
+++ libtk-img-1.3-release/debian/rules
@@ -0,0 +1,189 @@
+#!/usr/bin/make -f
+
+#export DH_VERBOSE=1
+#export DH_COMPAT=4
+
+export QUILT_PATCHES := debian/patches
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+pkgdir=$(shell pwd)/debian/tmp
+libdir=$(pkgdir)/usr/lib
+
+#CFLAGS = -Wall -g
+
+ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS)))
+	INSTALL_PROGRAM += -s
+endif
+
+DPKG_EXPORT_BUILDFLAGS = 1
+include /usr/share/dpkg/buildflags.mk
+
+LDFLAGS_DEFAULT = `dpkg-buildflags --get LDFLAGS`
+export LDFLAGS_DEFAULT
+LDFLAGS_OPTIMIZE = `dpkg-buildflags --get LDFLAGS`
+export LDFLAGS_OPTIMIZE
+
+
+unpatch:
+	dh_testdir
+	quilt pop -a || test $$? = 2
+	rm -rf patch-stamp .pc
+
+clean: clean-patched unpatch
+	dh_testdir
+	dh_testroot
+	dh_clean
+
+clean-patched: patch-stamp
+	dh_testdir
+	dh_testroot
+	rm -f configure-stamp build-stamp
+
+	[ ! -f Makefile ] || $(MAKE) distclean
+	rm -f doc/man/*.3tk
+	rm -rf libtiff/tcl/port
+	rm -rf libtiff/tcl/man
+	rm -rf libtiff/tcl/libtiff
+	rm -f libtiff/tcl/tools/Makefile
+	find . -name "*.so" | xargs rm -f
+	find . -name "*.a" | xargs rm -f
+	find . -name config.status | xargs rm -f
+	find . -name config.log | xargs rm -f
+
+patch: patch-stamp
+patch-stamp:
+	dh_testdir
+	quilt push -a || test $$? = 2
+	touch patch-stamp
+
+configure: configure-stamp
+configure-stamp: patch-stamp
+	dh_testdir
+
+	CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure \
+		--host=$(DEB_HOST_GNU_TYPE) \
+		--build=$(DEB_BUILD_GNU_TYPE) \
+		--prefix=/usr \
+		--mandir=\$${prefix}/share/man \
+		--infodir=\$${prefix}/share/info \
+		--with-tcl=/usr/lib \
+		--with-tk=/usr/lib \
+		--with-tkinclude=/usr/include/tk \
+                --enable-threads
+
+	touch configure-stamp
+
+build-arch: build-stamp
+build-indep: build-stamp
+build: build-stamp
+build-stamp: configure
+	dh_testdir
+
+	$(MAKE) TCL_INC_DIR=/usr/include/tcl/tcl-private/generic \
+		TK_INC_DIR=/usr/include/tk/tk-private/generic
+
+	# Cleanup manpages
+	(cd doc/man && \
+	  for f in *.n ; do \
+	    sed -e'/^\.so man.macros/ d' \
+		-e'/^\.BS/ d' \
+		-e'/^\.BE/ d' \
+		-e's/^\.TH \([^ ]\+\) n/.TH \1 3tk/' \
+		-e's/\xc2\xad //' \
+		$$f > `basename $$f .n`.3tk || exit 1; \
+	  done)
+	
+	# Rename img to img-intro since it's refered as img-intro
+	mv doc/man/img.3tk doc/man/img-intro.3tk
+
+	touch build-stamp
+
+install: build-stamp
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+
+	$(MAKE) install INSTALL_ROOT=$(pkgdir)
+
+	# Fix file permissions
+	find $(libdir) -type f | xargs chmod a-x
+
+	# Fix pkgIndex.tcl to prevent loading package to Tk 8.3 or older
+	sed -i -e'1i\
+	# Tcl package index file\
+	#\
+	# Return if Tcl/Tk is old.\
+	#\
+	if {[package vcompare [info tclversion] 8.4] < 0} return\
+	' $(libdir)/Img*/pkgIndex.tcl
+
+	# Move library into tcltk subdirectory
+	install -m 755 -d $(libdir)/tcltk
+	mv $(libdir)/Img* $(libdir)/tcltk
+
+	# Fix *Config.sh
+	DIR=`ls -d $(libdir)/tcltk/Img*` ; \
+	PKGDIR=`basename $$DIR` ; \
+	for f in $(libdir)/*Config.sh ; do \
+	  sed -i -e "s:/usr/lib/[0-9.a-z]*:/usr/lib/tcltk/$$PKGDIR:" $$f || exit 1; \
+	done
+
+binary-indep: build install
+	dh_testdir
+	dh_testroot
+	dh_installdirs -i
+	dh_install -i
+	dh_installdocs -i
+	dh_installexamples -i
+	dh_installman -i
+	dh_installchangelogs -i ChangeLog
+	dh_link -i
+	dh_strip -i
+	dh_compress -i -X.tcl
+	dh_fixperms -i
+	chmod a-x debian/libtk-img-doc/usr/share/doc/libtk-img-doc/examples/msgs/*
+	dh_makeshlibs -i
+	dh_installdeb -i
+	dh_shlibdeps -i
+	tcltk-depends -i
+	dh_gencontrol -i
+	dh_md5sums -i
+	dh_builddeb -i
+
+
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdirs -a
+	dh_install -a
+	dh_installdocs -a
+	dh_installexamples -a
+	dh_installman -a
+	dh_installchangelogs -a ChangeLog
+	install -m 644 debian/libtk-img.lintian-overrides debian/libtk-img/usr/share/lintian/overrides/libtk-img
+	dh_link -a
+	dh_strip -a
+	dh_compress -a -X.tcl
+	dh_fixperms -a
+	dh_makeshlibs -a
+	dh_installdeb -a
+	dh_shlibdeps -a
+	tcltk-depends -a
+	dh_gencontrol -a
+	dh_md5sums -a
+	dh_builddeb -a
+
+binary: binary-indep binary-arch
+
+get-orig-source:
+	# Can't use version number from debian/changelog because
+	# this target should work from any directory
+	wget -O libtk-img_1.3-release.orig.tar.gz \
+		http://prdownloads.sourceforge.net/tkimg/tkimg1.3.tar.gz
+
+.PHONY: patch unpatch clean-patched configure build build-arch build-indep clean binary-indep \
+	binary-arch binary install get-orig-source
--- libtk-img-1.3-release.orig/debian/TODO
+++ libtk-img-1.3-release/debian/TODO
@@ -0,0 +1 @@
+* Write a standalone manpage or extend and divert photo(3tk)
--- libtk-img-1.3-release.orig/debian/README.Debian
+++ libtk-img-1.3-release/debian/README.Debian
@@ -0,0 +1,26 @@
+libtk-img for Debian
+--------------------
+
+Basic notes on the use of this package:
+
+tclsh% package require Img
+will load the Img library. Once loaded, it adds format handlers so that
+[create image photo -format foo] can handle more formats. Specifically,
+Img provides support for bmp, gif, jpeg, png, tiff, xbm, xpm, postscript,
+and pdf image formats.
+
+For more information on the image handlers and usage, see
+/usr/share/doc/libtk-img/README or /usr/share/libtk-img/doc/html/index.html .
+
+--
+
+Another point of interest may be the extreme amounts of hacking done to
+the source tree. Upstream includes their own copies of libjpeg, libpng,
+libtiff, and libz, to be used in case they're missing on the system. I've
+excised these as much as possible, so the source tarball isn't exactly
+pristine.
+
+The principal exception to this pruning is a bunch of libtiff header files
+needed for the tiff support.
+
+ -- Mike Markley <mike@markley.org>, Tue, 12 Jun 2001 18:34:47 -0700
--- libtk-img-1.3-release.orig/debian/control
+++ libtk-img-1.3-release/debian/control
@@ -0,0 +1,54 @@
+Source: libtk-img
+Section: libs
+Priority: optional
+Maintainer: Sergei Golovan <sgolovan@debian.org>
+Build-Depends: debhelper (>= 5.0.0), dpkg-dev (>=1.16.1~), tk-dev (>= 8.5.0), zlib1g-dev (>= 1:1.2.1), libjpeg-dev, libtiff4-dev, libpng-dev, quilt
+Standards-Version: 3.9.3
+Homepage: http://sourceforge.net/projects/tkimg/
+
+Package: libtk-img
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${wish:Depends}, ${misc:Depends}
+Suggests: libtk-img-doc
+Description: Extended image format support for Tcl/Tk (runtime)
+ Img is a package to enhance Tk by providing support for various image
+ formats such as XPM, GIF (transparency supported, but not LZW), PNG,
+ JPEG, TIFF, and PostScript.
+ .
+ The libimg library can be loaded dynamically into Tcl/Tk scripts to
+ provide the image handling functions.
+ .
+ This package includes runtime libraries.
+
+Package: libtk-img-dev
+Section: libdevel
+Architecture: any
+Depends: libtk-img (= ${binary:Version}), ${misc:Depends}
+Description: Extended image format support for Tcl/Tk (development files)
+ Img is a package to enhance Tk by providing support for various image
+ formats such as XPM, GIF (transparency supported, but not LZW), PNG,
+ JPEG, TIFF, and PostScript.
+ .
+ The libimg library can be loaded dynamically into Tcl/Tk scripts to
+ provide the image handling functions.
+ .
+ This package includes Tcl stub libraries and headers, which are necessary
+ to develop C-based extensions using Img.
+
+Package: libtk-img-doc
+Section: doc
+Architecture: all
+Depends: ${misc:Depends}
+Suggests: libtk-img
+Conflicts: libtk-img (<< 1:1.3-release-6)
+Replaces: libtk-img (<< 1:1.3-release-6)
+Description: Extended image format support for Tcl/Tk (manual pages)
+ Img is a package to enhance Tk by providing support for various image
+ formats such as XPM, GIF (transparency supported, but not LZW), PNG,
+ JPEG, TIFF, and PostScript.
+ .
+ The libimg library can be loaded dynamically into Tcl/Tk scripts to
+ provide the image handling functions.
+ .
+ This package includes manual pages and examples.
--- libtk-img-1.3-release.orig/debian/libtk-img-dev.install
+++ libtk-img-1.3-release/debian/libtk-img-dev.install
@@ -0,0 +1,3 @@
+debian/tmp/usr/include/*
+debian/tmp/usr/lib/*.sh
+debian/tmp/usr/lib/tcltk/Img*/*.a
--- libtk-img-1.3-release.orig/debian/tkv.1
+++ libtk-img-1.3-release/debian/tkv.1
@@ -0,0 +1,27 @@
+.TH TKV 1 "2001-06-14"
+.\" Please adjust this date whenever revising the manpage.
+.SH NAME
+tkv \- Tcl/Tk image viewer
+.SH SYNOPSIS
+.B tkv
+.RI [filename]
+.SH DESCRIPTION
+The
+.B tkv
+script is an image viewer written in Tcl/Tk and utilizing the Img
+library. It can be invoked with the optional filename of an image
+that will be displayed upon startup, or can simply be invoked by
+itself.
+.B tkv
+is intended primarily as a functioning demo/proof of concept of
+using the Img library.
+.SH OPTIONS
+There are no options to
+.B tkv
+.
+.SH SEE ALSO
+.BR image (3tk),
+.BR photo (3tk).
+.SH AUTHOR
+This manual page was written by Mike Markley <mike@markley.org>
+for the Debian GNU/Linux system (but may be used by others).
--- libtk-img-1.3-release.orig/debian/README.source
+++ libtk-img-1.3-release/debian/README.source
@@ -0,0 +1,8 @@
+This package uses quilt to manage all modifications to the upstream
+source. Changes are stored in the source package as diffs in
+debian/patches and applied during the build.
+
+To get detailed instructions on how to apply the series of patches
+and modify them, please read /usr/share/doc/quilt/README.source
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sat, 05 Sep 2009 11:33:56 +0400
--- libtk-img-1.3-release.orig/debian/libtk-img-doc.docs
+++ libtk-img-1.3-release/debian/libtk-img-doc.docs
@@ -0,0 +1,2 @@
+README
+doc/html
--- libtk-img-1.3-release.orig/debian/libtk-img-doc.doc-base
+++ libtk-img-1.3-release/debian/libtk-img-doc.doc-base
@@ -0,0 +1,11 @@
+Document: libtk-img
+Title: Debian libtk-img Manual
+Author: Jan Nijtmans
+Abstract: This manual describes what libtk-img is and
+ how it extends the Tk image commands to support various
+ additional image formats
+Section: Programming
+
+Format: HTML
+Index: /usr/share/doc/libtk-img-doc/html/index.html
+Files: /usr/share/doc/libtk-img-doc/html/*.html
--- libtk-img-1.3-release.orig/debian/libtk-img-doc.manpages
+++ libtk-img-1.3-release/debian/libtk-img-doc.manpages
@@ -0,0 +1 @@
+doc/man/*.3tk
--- libtk-img-1.3-release.orig/debian/changelog
+++ libtk-img-1.3-release/debian/changelog
@@ -0,0 +1,269 @@
+libtk-img (1:1.3-release-12) unstable; urgency=low
+
+  * Enabled hardened build flags through dpkg-buildflags (closes: #657209).
+  * Switched to libpng-dev from libpng12-dev in build dependencies (closes:
+    #662413).
+  * Documented the new pngsuite license in debian/copyright (closes: #615808).
+  * Bumped standards version to 3.9.3.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Thu, 24 May 2012 22:31:27 +0400
+
+libtk-img (1:1.3-release-11) unstable; urgency=low
+
+  * Fixed building with libjpeg8.
+  * Bumped standards version to 3.9.2.
+  * Added build-indep and build-arch targets into debian/rules.
+  * Overridden lintian false positive on embedded tiff library.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Mon, 19 Dec 2011 18:38:35 +0400
+
+libtk-img (1:1.3-release-10) experimental; urgency=low
+
+  * Uplaod to experimental to test compatibility with Tcl/Tk 8.5.
+  * Bumped standards version to 3.9.0.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Thu, 22 Jul 2010 22:29:22 +0400
+
+libtk-img (1:1.3-release-9) unstable; urgency=low
+
+  * Changed libjpeg62-dev to libjpeg-dev in build dependencies.
+  * Added ${misc:Depends} variable to the binary packages dependencies because
+    they are built using debhelper.
+  * Added README.source with a description on how to patch the pristine
+    sources with Debian patches.
+  * Overridden lintian warning on an ancient autotools helper files in
+    libtiff subdirectory because they aren't used when building the binary
+    package.
+  * Bumped standards version to 3.8.4.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sun, 14 Feb 2010 12:59:54 +0300
+
+libtk-img (1:1.3-release-8) unstable; urgency=high
+
+  * Applied patch by Nico Golde (previously created for Tk 8.4) which fixes
+    security vulnerability CVE-2007-5137 arbitrary code execution via
+    multi-frame interlaced GIF.
+  * Applied patch by Nico Golde (previously created for Tk 8.4) which fixes
+    security vulnerability CVE-2007-5378 overflow triggered by crafted
+    GIF file (closes: #519072).
+  * Set urgency to high as this upload fixes security vulnerabilities.
+  * Mangled Debian version and use SF redirector in debian/watch uscan control
+    file.
+  * Overridden lintian warning on an ancient libtool version in libjpeg
+    subdirectory because it isn't used when building the binary package.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sat, 14 Mar 2009 08:42:09 +0300
+
+libtk-img (1:1.3-release-7) unstable; urgency=high
+
+  * Fixed CVE-2008-0553 vulnerability (Stack-based buffer overflow in the
+    ReadImage function in tkImgGIF.c allows remote attackers to execute
+    arbitrary code via a crafted GIF image, a similar issue to CVE-2006-4484.)
+    Thanks Nico Golde for the patch. Closes: #485785.
+  * Set urgency to high as this upload fixes a security vulnerability.
+  * Protected quilt invocation in debian/rules to make it possible to convert
+    bwidget source package to 3.0 (quilt) format (closes: #482710).
+  * Bumped standards version to 3.8.0.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sun, 15 Jun 2008 19:47:36 +0400
+
+libtk-img (1:1.3-release-6) unstable; urgency=low
+
+  * Removed tkv script from /usr/bin since it is not more than an example and
+    isn't suitable for use as an image viewer. This allows to remove bashism
+    echo -e from debian/rules (closes: #478608).
+  * Moved all manpages and examples to a separate package libtk-img-doc to
+    make the main package more lightweight.
+  * Changed libtk-img section to libs and libtk-img-dev package section to
+    libdevel as more appropriate.
+  * Added a copyright notice to debian/copyright.
+  * Fixed section in doc-base.
+  * Use more recent ChangeLog file.
+  * Bumped standards version to 3.7.3.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Thu, 01 May 2008 01:34:53 +0400
+
+libtk-img (1:1.3-release-5) unstable; urgency=low
+
+  * Adapted the package to Debian Tcl/Tk policy. This includes moving the Tcl
+    modules into a subdirectory of /usr/lib/tcltk and switching to default
+    tk package in dependencies.
+  * Added Homepage field in debian/control.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sun, 18 Nov 2007 19:47:26 +0300
+
+libtk-img (1:1.3-release-4) unstable; urgency=low
+
+  * Fixed build on hurd-i386, kfreebsd-i386 and kfreebsd-amd64 architectures.
+  * Rewritten clean target in debian/rules to ignore only missing Makefile
+    error.
+  * Made clean-patched target in debian/rules depend on patch-stamp.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Tue, 11 Sep 2007 18:26:54 +0400
+
+libtk-img (1:1.3-release-3) unstable; urgency=low
+
+  * New maintainer's email address sgolovan@debian.org.
+  * Split the binary package into libtk-img and libtk-img-dev packages, moving
+    development libraries and C-headers to a separate development package.
+  * Added versioned build-dependency on zlib1g-dev.
+  * Removed useless description of BMP image format from the binary package.
+  * Removed tkv manpage from TODO.Debian because it is already written.
+  * Added explicit --host and --build parameters to configure script call. 
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sat, 04 Aug 2007 21:50:58 +0400
+
+libtk-img (1:1.3-release-2) unstable; urgency=low
+
+  * Fixed package directory in jpegtclConfig.sh, tifftclConfig.sh,
+    zlibtclConfig.sh, pngtclConfig.sh and tkimgConfig.sh scripts.
+
+ -- Sergei Golovan <sgolovan@nes.ru>  Tue, 22 May 2007 21:29:47 +0400
+
+libtk-img (1:1.3-release-1) unstable; urgency=low
+
+  * New maintainer Sergei Golovan (closes: #383652).
+  * New upstream release (it's labeled 1.3, so added -release suffix to the
+    upstream version).
+  * Install manual pages.
+  * Install HTML docs to /usr/share/doc/libtk-img/html
+  * Added debian/compat file instead of defining variable DH_COMPAT in
+    debian/rules.
+  * Added colons to bug closing statements in debian/changelog.
+  * Link libjpegtcl, libpngtcl, libzlibtcl dynamically to libjpeg,
+    libpng and zlib respectively instead of building own static libraries.
+  * Updated libtiff to SVN version to make it possible to link libtifftcl
+    to current libtiff4 dynamically.
+  * Overridden lintian error message about outdated autotools helper files
+    because they aren't used for building the package.
+  * Do not install install.tcl (it isn't related to bug #221149).
+  * Fixed demo.tcl and tkv.tcl scripts to run by wish8.4 and not wish8.3
+    because libtk-img is built using tk8.4.
+  * Remove command, which is supposed to run test, from demo.tcl because
+    they aren't available.
+  * Added debian/watch uscan file.
+  * Fixed homepage in debian/copyright and added it to debian/control.
+
+ -- Sergei Golovan <sgolovan@nes.ru>  Sun, 13 May 2007 15:30:20 +0400
+
+libtk-img (1:1.3-15) unstable; urgency=low
+
+  * QA upload.
+  * debian/doc-base: Change section to Apps/Programming.  Thanks to
+    Justin B Rye.  Closes: #311816.
+  * debian/override: Lintian no longer outputs `no-shlibs-control-file';
+    remove.
+
+ -- Matej Vela <vela@debian.org>  Mon,  4 Sep 2006 13:59:17 +0200
+
+libtk-img (1:1.3-14) unstable; urgency=low
+
+  * QA Upload (Ack NMU; Closes: #359289, #355593)
+  * Set Maintainer to QA Group; Orphaned: #383652
+  * Bump COMPAT to 4; Depend on at least dh 4.0.0
+  * Install tools/install.tcl with examples (Closes: 221149)
+  * Conforms with Latest Standards Version 3.7.2
+
+ -- Michael Ablassmeier <abi@debian.org>  Sat,  2 Sep 2006 11:31:28 +0200
+
+libtk-img (1:1.3-13.1) unstable; urgency=high
+
+  * Non-maintainer upload.
+  * Fix syntax error in tcl.m4 (Closes: #355593).
+
+ -- Luk Claes <luk@debian.org>  Mon, 27 Mar 2006 19:09:11 +0200
+
+libtk-img (1:1.3-13) unstable; urgency=low
+
+  * Fixed mistake and now really fix the bug below.
+
+ -- David N. Welton <davidw@debian.org>  Mon, 14 Mar 2005 17:11:23 +0100
+
+libtk-img (1:1.3-12) unstable; urgency=low
+
+  * Bug fix: "libtk-img: segfaults when using with Tcl/Tk 8.3", thanks to
+    Sergei Golovan (Closes: #299444).
+
+ -- David N. Welton <davidw@debian.org>  Mon, 14 Mar 2005 16:31:33 +0100
+
+libtk-img (1:1.3-11) unstable; urgency=high
+
+  * Recompiled against libtiff4.
+
+ -- David N. Welton <davidw@debian.org>  Sun,  8 Aug 2004 19:18:29 +0200
+
+libtk-img (1:1.3-10) unstable; urgency=low
+
+  * Remove config droppings from source file.
+
+  * Compile against latest libpng.
+
+ -- David N. Welton <davidw@debian.org>  Sat, 26 Jul 2003 13:53:41 +0200
+
+libtk-img (1.3rc2-9) unstable; urgency=low
+
+  * Specify version.  Recompile with Debian diff.
+  *  (closes: #186756)
+  *  (closes: #186759)
+
+ -- David N. Welton <davidw@debian.org>  Sun, 30 Mar 2003 01:02:08 -0800
+
+libtk-img (1.3-8) unstable; urgency=low
+
+  * A few more changes for lintian goodness.
+
+ -- David N. Welton <davidw@debian.org>  Wed, 26 Mar 2003 15:53:57 -0800
+
+libtk-img (1.3-7) unstable; urgency=low
+
+  * New upstream version.
+
+ -- David N. Welton <davidw@debian.org>  Wed, 26 Mar 2003 03:01:52 -0800
+
+libtk-img (1.3-6) unstable; urgency=low
+
+  * Recompiled for latest Tcl/Tk.
+
+ -- David N. Welton <davidw@debian.org>  Fri, 21 Mar 2003 11:52:52 -0800
+
+libtk-img (1.3-5) unstable; urgency=low
+
+  * Added patches from Andreas Kupries (upstream) to fix compile bugs.
+    (closes: #177798) (closes: #179088) (closes: #177799)
+
+ -- David N. Welton <davidw@debian.org>  Wed,  5 Feb 2003 13:35:39 -0800
+
+libtk-img (1.3-4) unstable; urgency=low
+
+  * Updates from upstream CVS (closes: #176390).
+
+ -- David N. Welton <davidw@debian.org>  Tue, 14 Jan 2003 11:30:59 -0800
+
+libtk-img (1.3-3) unstable; urgency=low
+
+  * Something went wrong with the last upload.  Let's do a new
+    one. (closes: #175423) (closes: #17425)
+
+ -- David N. Welton <davidw@debian.org>  Sun,  5 Jan 2003 21:12:02 -0800
+
+libtk-img (1.3-2) unstable; urgency=low
+
+  * Make sure .so and .a files are cleaned up. (closes: #17425)
+
+ -- David N. Welton <davidw@debian.org>  Wed,  1 Jan 2003 19:43:21 -0800
+
+libtk-img (1.3-1) unstable; urgency=low
+
+  * New upstream release
+  * New maintainer.
+  * Packaged up sources from CVS. (closes: #172363) (closes: #172420)
+
+ -- David N. Welton <davidw@debian.org>  Thu, 19 Dec 2002 11:46:40 -0800
+
+libtk-img (1.2.4-1) unstable; urgency=low
+
+  * Initial Release (Closes: #100962).
+
+ -- Mike Markley <mike@markley.org>  Tue, 12 Jun 2001 18:34:47 -0700
+
+
--- libtk-img-1.3-release.orig/debian/libtk-img-doc.examples
+++ libtk-img-1.3-release/debian/libtk-img-doc.examples
@@ -0,0 +1,4 @@
+demo/demo.tcl
+demo/imgmsg.tcl
+demo/tkv.tcl
+demo/msgs
--- libtk-img-1.3-release.orig/debian/source.lintian-overrides
+++ libtk-img-1.3-release/debian/source.lintian-overrides
@@ -0,0 +1,5 @@
+# Only headers are used in libtiff/ and libjpeg/ for building the package. So
+# it's harmless to keep old helpers.
+libtk-img source: ancient-autotools-helper-file libtiff/config.sub 2003-10-07
+libtk-img source: ancient-autotools-helper-file libtiff/config.guess 2003-10-07
+libtk-img source: ancient-libtool libjpeg/ltconfig
--- libtk-img-1.3-release.orig/debian/compat
+++ libtk-img-1.3-release/debian/compat
@@ -0,0 +1 @@
+5
--- libtk-img-1.3-release.orig/debian/watch
+++ libtk-img-1.3-release/debian/watch
@@ -0,0 +1,7 @@
+# Watch control file for uscan
+
+# Compulsory line, this is a version 3 file
+version=3
+
+opts=dversionmangle=s/-release$// \
+    http://sf.net/tkimg/tkimg([\d.]*).tar.gz
--- libtk-img-1.3-release.orig/debian/libtk-img-dev.docs
+++ libtk-img-1.3-release/debian/libtk-img-dev.docs
@@ -0,0 +1 @@
+README
--- libtk-img-1.3-release.orig/debian/copyright
+++ libtk-img-1.3-release/debian/copyright
@@ -0,0 +1,61 @@
+This package was debianized by Mike Markley <mike@markley.org> on
+Tue, 12 Jun 2001 18:34:47 -0700.
+
+It was downloaded from http://sourceforge.net/projects/tkimg/
+
+Upstream Author: Jan Nijtmans <j.nijtmans@chello.nl>
+
+Copyright:
+
+Copyright 1997-2004 Jan Nijtmans
+
+This software is copyrighted by Jan Nijtmans (the maintainer)
+and a lot of other people who contributed code (most notably
+Andreas Kupries, Thomas G. Lane, Ioi K. Lam, Mario Weilguni
+and Roger E Critchlow Jr).
+The following terms apply to all files associated with the
+software unless explicitly disclaimed in individual files.
+
+The authors hereby grant permission to use, copy, modify, distribute,
+and license this software and its documentation for any purpose, provided
+that existing copyright notices are retained in all copies and that this
+notice is included verbatim in any distributions. No written agreement,
+license, or royalty fee is required for any of the authorized uses.
+Modifications to this software may be copyrighted by their authors
+and need not follow the licensing terms described here, provided that
+the new terms are clearly indicated on the first page of each file where
+they apply.
+
+IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
+IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
+
+GOVERNMENT USE: If you are acquiring this software on behalf of the
+U.S. government, the Government shall have only "Restricted Rights"
+in the software and related documentation as defined in the Federal 
+Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
+are acquiring the software on behalf of the Department of Defense, the
+software shall be classified as "Commercial Computer Software" and the
+Government shall have only "Restricted Rights" as defined in Clause
+252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
+authors grant the U.S. Government and others acting in its behalf
+permission to use and distribute the software in accordance with the
+terms specified in this license. 
+
+------------------------------------------------------------------
+
+This package includes pngsuite with the following license:
+
+Copyright (c) Willem van Schaik, 1999, 2011
+
+Permission to use, copy, modify, and distribute these images for any
+purpose and without fee is hereby granted.
--- libtk-img-1.3-release.orig/debian/patches/libtifftcl.diff
+++ libtk-img-1.3-release/debian/patches/libtifftcl.diff
@@ -0,0 +1,257 @@
+Patch (partially) updates libtifftcl to version from SVN (it allows to
+link it to the current libtiff4).
+
+Index: libtk-img/libtiff/tcl/configure
+========================================================================
+--- libtk-img.orig/libtiff/tcl/configure
++++ libtk-img/libtiff/tcl/configure
+@@ -1395,8 +1395,8 @@
+ PACKAGE=tifftcl
+ 
+ MAJOR_VERSION=3
+-MINOR_VERSION=6
+-PATCHLEVEL=1
++MINOR_VERSION=8
++PATCHLEVEL=2
+ 
+ VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${PATCHLEVEL}
+ NODOT_VERSION=${MAJOR_VERSION}${MINOR_VERSION}${PATCHLEVEL}
+@@ -1417,7 +1417,7 @@
+ #--------------------------------------------------------------------
+ 
+ eval cat >> confdefs.h <<EOF
+-#define VERSION "${VERSION}"
++#define PACKAGE_VERSION "${VERSION}"
+ EOF
+ 
+ eval cat >> confdefs.h <<EOF
+Index: libtk-img/libtiff/tcl/tifftclStubLib.c
+========================================================================
+--- libtk-img.orig/libtiff/tcl/tifftclStubLib.c
++++ libtk-img/libtiff/tcl/tifftclStubLib.c
+@@ -46,29 +46,17 @@
+ CONST char *
+ Tifftcl_InitStubs(interp, version, exact)
+     Tcl_Interp *interp;
+-    CONST char *version;
++    CONST84 char *version;
+     int exact;
+ {
+     CONST char *result;
++    ClientData data;
+ 
+-    /* HACK: de-CONST 'version' if compiled against 8.3.
+-     * The API has no CONST despite not modifying the argument
+-     * And a debug build with high warning-level on windows
+-     * will abort the compilation.
+-     */
+-
+-#if ((TCL_MAJOR_VERSION < 8) || ((TCL_MAJOR_VERSION == 8) && (TCL_MINOR_VERSION < 4)))
+-#define UNCONST (char*)
+-#else
+-#define UNCONST 
+-#endif
+-
+-    result = Tcl_PkgRequireEx(interp, PACKAGE_NAME, UNCONST version, exact,
+-		(ClientData *) &tifftclStubsPtr);
+-    if (!result || !tifftclStubsPtr) {
++    result = Tcl_PkgRequireEx(interp, PACKAGE_NAME, version, exact, &data);
++    if (!result || !data) {
+         return (char *) NULL;
+     }
+ 
++    tifftclStubsPtr = (TifftclStubs *) data;
+     return result;
+ }
+-#undef UNCONST
+Index: libtk-img/libtiff/tcl/Makefile.in
+========================================================================
+--- libtk-img.orig/libtiff/tcl/Makefile.in
++++ libtk-img/libtiff/tcl/Makefile.in
+@@ -31,7 +31,6 @@
+ 		tifftcl.c		\
+ 		tifftclStubInit.c	\
+ 		tifftclStubLib.c	\
+-		$(tiff_Sources)		\
+ 		@EXTRA_SOURCES@
+ 
+ WIN_SOURCES	= tif_win32.c
+@@ -195,7 +194,7 @@
+ CONFIG_CLEAN_FILES = Makefile tifftclConfig.sh pkgIndex.tcl port.h
+ 
+ CPPFLAGS	= @CPPFLAGS@ -DPACKAGE_NAME=\"$(PACKAGE)\"
+-LIBS		= @LIBS@
++LIBS		= @LIBS@ -ltiff
+ AR		= ar
+ CFLAGS		= @CFLAGS@
+ COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+Index: libtk-img/libtiff/tcl/tifftcl.decls
+========================================================================
+--- libtk-img.orig/libtiff/tcl/tifftcl.decls
++++ libtk-img/libtiff/tcl/tifftcl.decls
+@@ -319,7 +319,7 @@
+ 
+ # Source: tif_dir.h ...
+ declare 110 generic {
+-    void _TIFFSetupFieldInfo(TIFF* tiffptr)
++    void _TIFFSetupFieldInfo(TIFF* tiffptr, const TIFFFieldInfo a[], size_t b)
+ }
+ declare 111 generic {
+     void TIFFMergeFieldInfo(TIFF* tiffptr, const TIFFFieldInfo* a, int b)
+@@ -392,7 +392,7 @@
+     int TIFFSetCompressionScheme(TIFF* tiffptr, int a)
+ }
+ declare 137 generic {
+-    int _TIFFSetDefaultCompressionState(TIFF* tiffptr)
++    void _TIFFSetDefaultCompressionState(TIFF* tiffptr)
+ }
+ declare 138 generic {
+     uint32 _TIFFDefaultStripSize(TIFF* tiffptr, uint32 a)
+@@ -407,16 +407,16 @@
+     void _TIFFsetString(char** a, char* b)
+ }
+ declare 142 generic {
+-    void _TIFFsetShortArray(uint16** a, uint16* b, long c)
++    void _TIFFsetShortArray(uint16** a, uint16* b, uint32 c)
+ }
+ declare 143 generic {
+-    void _TIFFsetLongArray(uint32** a, uint32* b, long c)
++    void _TIFFsetLongArray(uint32** a, uint32* b, uint32 c)
+ }
+ declare 144 generic {
+-    void _TIFFsetFloatArray(float** a, float* b, long c)
++    void _TIFFsetFloatArray(float** a, float* b, uint32 c)
+ }
+ declare 145 generic {
+-    void _TIFFsetDoubleArray(double** a, double* b, long c)
++    void _TIFFsetDoubleArray(double** a, double* b, uint32 c)
+ }
+ declare 146 generic {
+     void _TIFFprintAscii(FILE* a, const char* b)
+Index: libtk-img/libtiff/tcl/tifftclDecls.h
+========================================================================
+--- libtk-img.orig/libtiff/tcl/tifftclDecls.h
++++ libtk-img/libtiff/tcl/tifftclDecls.h
+@@ -15,6 +15,12 @@
+  */
+ 
+ #include <tcl.h>
++/*
++ * The macro INLINE might be defined both in tcl.h and libtiff/port.h,
++ * so better prevent a conflict here.
++ */
++#undef INLINE
++
+ #include <tifftclDeclsMask.h>
+ #include <../libtiff/tiffio.h>
+ #include <../libtiff/tiffiop.h>
+@@ -296,7 +302,8 @@
+ /* Slot 108 is reserved */
+ /* Slot 109 is reserved */
+ /* 110 */
+-EXTERN void		_TIFFSetupFieldInfo _ANSI_ARGS_((TIFF* tiffptr));
++EXTERN void		_TIFFSetupFieldInfo _ANSI_ARGS_((TIFF* tiffptr,
++				const TIFFFieldInfo a[], size_t b));
+ /* 111 */
+ EXTERN void		TIFFMergeFieldInfo _ANSI_ARGS_((TIFF* tiffptr, 
+ 				const TIFFFieldInfo* a, int b));
+@@ -363,7 +370,7 @@
+ EXTERN int		TIFFSetCompressionScheme _ANSI_ARGS_((TIFF* tiffptr, 
+ 				int a));
+ /* 137 */
+-EXTERN int		_TIFFSetDefaultCompressionState _ANSI_ARGS_((
++EXTERN void		_TIFFSetDefaultCompressionState _ANSI_ARGS_((
+ 				TIFF* tiffptr));
+ /* 138 */
+ EXTERN uint32		_TIFFDefaultStripSize _ANSI_ARGS_((TIFF* tiffptr, 
+@@ -373,21 +380,21 @@
+ 				uint32* a, uint32* b));
+ /* 140 */
+ EXTERN void		_TIFFsetByteArray _ANSI_ARGS_((void** a, void* b, 
+-				long c));
++				uint32 c));
+ /* 141 */
+ EXTERN void		_TIFFsetString _ANSI_ARGS_((char** a, char* b));
+ /* 142 */
+ EXTERN void		_TIFFsetShortArray _ANSI_ARGS_((uint16** a, 
+-				uint16* b, long c));
++				uint16* b, uint32 c));
+ /* 143 */
+ EXTERN void		_TIFFsetLongArray _ANSI_ARGS_((uint32** a, uint32* b, 
+-				long c));
++				uint32 c));
+ /* 144 */
+ EXTERN void		_TIFFsetFloatArray _ANSI_ARGS_((float** a, float* b, 
+-				long c));
++				uint32 c));
+ /* 145 */
+ EXTERN void		_TIFFsetDoubleArray _ANSI_ARGS_((double** a, 
+-				double* b, long c));
++				double* b, uint32 c));
+ /* 146 */
+ EXTERN void		_TIFFprintAscii _ANSI_ARGS_((FILE* a, const char* b));
+ /* 147 */
+@@ -539,7 +546,7 @@
+     void *reserved107;
+     void *reserved108;
+     void *reserved109;
+-    void (*_TIFFSetupFieldInfo) _ANSI_ARGS_((TIFF* tiffptr)); /* 110 */
++    void (*_TIFFSetupFieldInfo) _ANSI_ARGS_((TIFF* tiffptr, const TIFFFieldInfo a[], size_t b)); /* 110 */
+     void (*tIFFMergeFieldInfo) _ANSI_ARGS_((TIFF* tiffptr, const TIFFFieldInfo* a, int b)); /* 111 */
+     void (*_TIFFPrintFieldInfo) _ANSI_ARGS_((TIFF* tiffptr, FILE* a)); /* 112 */
+     const TIFFFieldInfo* (*tIFFFindFieldInfo) _ANSI_ARGS_((TIFF* tiffptr, ttag_t a, TIFFDataType b)); /* 113 */
+@@ -566,15 +573,15 @@
+     void (*tIFFFreeDirectory) _ANSI_ARGS_((TIFF* tiffptr)); /* 134 */
+     int (*tIFFDefaultDirectory) _ANSI_ARGS_((TIFF* tiffptr)); /* 135 */
+     int (*tIFFSetCompressionScheme) _ANSI_ARGS_((TIFF* tiffptr, int a)); /* 136 */
+-    int (*_TIFFSetDefaultCompressionState) _ANSI_ARGS_((TIFF* tiffptr)); /* 137 */
++    void (*_TIFFSetDefaultCompressionState) _ANSI_ARGS_((TIFF* tiffptr)); /* 137 */
+     uint32 (*_TIFFDefaultStripSize) _ANSI_ARGS_((TIFF* tiffptr, uint32 a)); /* 138 */
+     void (*_TIFFDefaultTileSize) _ANSI_ARGS_((TIFF* tiffptr, uint32* a, uint32* b)); /* 139 */
+-    void (*_TIFFsetByteArray) _ANSI_ARGS_((void** a, void* b, long c)); /* 140 */
++    void (*_TIFFsetByteArray) _ANSI_ARGS_((void** a, void* b, uint32 c)); /* 140 */
+     void (*_TIFFsetString) _ANSI_ARGS_((char** a, char* b)); /* 141 */
+-    void (*_TIFFsetShortArray) _ANSI_ARGS_((uint16** a, uint16* b, long c)); /* 142 */
+-    void (*_TIFFsetLongArray) _ANSI_ARGS_((uint32** a, uint32* b, long c)); /* 143 */
+-    void (*_TIFFsetFloatArray) _ANSI_ARGS_((float** a, float* b, long c)); /* 144 */
+-    void (*_TIFFsetDoubleArray) _ANSI_ARGS_((double** a, double* b, long c)); /* 145 */
++    void (*_TIFFsetShortArray) _ANSI_ARGS_((uint16** a, uint16* b, uint32 c)); /* 142 */
++    void (*_TIFFsetLongArray) _ANSI_ARGS_((uint32** a, uint32* b, uint32 c)); /* 143 */
++    void (*_TIFFsetFloatArray) _ANSI_ARGS_((float** a, float* b, uint32 c)); /* 144 */
++    void (*_TIFFsetDoubleArray) _ANSI_ARGS_((double** a, double* b, uint32 c)); /* 145 */
+     void (*_TIFFprintAscii) _ANSI_ARGS_((FILE* a, const char* b)); /* 146 */
+     void (*_TIFFprintAsciiTag) _ANSI_ARGS_((FILE* a, const char* b, const char* c)); /* 147 */
+     int (*tIFFInitDumpMode) _ANSI_ARGS_((TIFF* tiffptr, int a)); /* 148 */
+Index: libtk-img/libtiff/tcl/tifftcl.h
+========================================================================
+--- libtk-img.orig/libtiff/tcl/tifftcl.h
++++ libtk-img/libtiff/tcl/tifftcl.h
+@@ -22,14 +22,15 @@
+ #define __TIFFTCL_H__
+ 
+ #include "tcl.h"
++#include "../libtiff/tif_config.h"
+ 
+ #define TIFFTCL_MAJOR_VERSION	3
+-#define TIFFTCL_MINOR_VERSION	6
++#define TIFFTCL_MINOR_VERSION	8
+ #define TIFFTCL_RELEASE_LEVEL	TCL_RELEASE
+-#define TIFFTCL_RELEASE_SERIAL	1
++#define TIFFTCL_RELEASE_SERIAL	2
+ 
+-#define TIFFTCL_VERSION		"3.6.1"
+-#define TIFFTCL_PATCH_LEVEL	"3.6.1"
++#define TIFFTCL_VERSION		"3.8.2"
++#define TIFFTCL_PATCH_LEVEL	"3.8.2"
+ 
+ /*
+  * Used to block the rest of this header file from resource compilers so
+@@ -138,7 +139,7 @@
+ 
+ #ifdef USE_TIFFTCL_STUBS
+ EXTERN CONST char *
+-Tifftcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, CONST char *version, int exact));
++Tifftcl_InitStubs _ANSI_ARGS_((Tcl_Interp *interp, CONST84 char *version, int exact));
+ #else
+ 
+ /*
--- libtk-img-1.3-release.orig/debian/patches/cve-2008-0553.patch
+++ libtk-img-1.3-release/debian/patches/cve-2008-0553.patch
@@ -0,0 +1,13 @@
+--- libtk-img-1.3-release.orig/gif/gif.c
++++ libtk-img-1.3-release/gif/gif.c
+@@ -764,6 +764,10 @@
+ 		Tcl_PosixError(interp), (char *) NULL);
+ 	return TCL_ERROR;
+     }
++    if (initialCodeSize > MAX_LWZ_BITS) {
++	Tcl_AppendResult(interp, "error reading GIF image: malformed image", (char *) NULL);
++	return TCL_ERROR;
++    }
+     if (transparent!=-1) {
+ 	cmap[transparent][CM_RED] = 0;
+ 	cmap[transparent][CM_GREEN] = 0;
--- libtk-img-1.3-release.orig/debian/patches/libpng.diff
+++ libtk-img-1.3-release/debian/patches/libpng.diff
@@ -0,0 +1,23 @@
+Patch enable dynamic linking to system-wide libpng.
+
+Index: libtk-img/libpng/tcl/Makefile.in
+========================================================================
+--- libtk-img.orig/libpng/tcl/Makefile.in
++++ libtk-img/libpng/tcl/Makefile.in
+@@ -31,7 +31,6 @@
+ 		pngtcl.c		\
+ 		pngtclStubInit.c	\
+ 		pngtclStubLib.c	\
+-		$(png_Sources)		\
+ 		@EXTRA_SOURCES@
+ 
+ WIN_SOURCES	= 
+@@ -194,7 +193,7 @@
+ CPPFLAGS	= @CPPFLAGS@					\
+ 		-DZLIBTCL_VERSION=\"$(zlibtcl_VERSION)\"	\
+ 		-DPACKAGE_NAME=\"$(PACKAGE)\"
+-LIBS		= @LIBS@
++LIBS		= @LIBS@ -lpng
+ AR		= ar
+ CFLAGS		= @CFLAGS@
+ COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
--- libtk-img-1.3-release.orig/debian/patches/libtiff.diff
+++ libtk-img-1.3-release/debian/patches/libtiff.diff
@@ -0,0 +1,1629 @@
+Patch updates libtiff headers to version from SVN (it allows to link
+the libraries to current libtiff4).
+
+Index: libtk-img/libtiff/libtiff/tiff.h
+========================================================================
+--- libtk-img.orig/libtiff/libtiff/tiff.h
++++ libtk-img/libtiff/libtiff/tiff.h
+@@ -26,6 +26,9 @@
+ 
+ #ifndef _TIFF_
+ #define	_TIFF_
++
++#include "tiffconf.h"
++
+ /*
+  * Tag Image File Format (TIFF)
+  *
+@@ -36,30 +39,19 @@
+  *    Suite 200
+  *    Seattle, WA  98104
+  *    206-622-5500
++ *    
++ *    (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)
++ *
++ * For Big TIFF design notes see the following link
++ *    http://gdal.maptools.org/twiki/bin/view/libtiff/BigTIFFDesign
+  */
+-#define	TIFF_VERSION	42
++#define	TIFF_VERSION	        42
++#define TIFF_BIGTIFF_VERSION    43
+ 
+ #define	TIFF_BIGENDIAN		0x4d4d
+ #define	TIFF_LITTLEENDIAN	0x4949
+-
+-/*
+- * The so called TIFF types conflict with definitions from inttypes.h 
+- * included from sys/types.h on AIX (at least using VisualAge compiler). 
+- * We try to work around this by detecting this case.  Defining 
+- * _TIFF_DATA_TYPEDEFS_ short circuits the later definitions in tiff.h, and
+- * we will in the holes not provided for by inttypes.h. 
+- *
+- * See http://bugzilla.remotesensing.org/show_bug.cgi?id=39
+- */
+-#if defined(_H_INTTYPES) && defined(_ALL_SOURCE) && defined(USING_VISUALAGE)
+-
+-#define _TIFF_DATA_TYPEDEFS_
+-typedef unsigned char uint8;
+-typedef unsigned short uint16;
+-typedef unsigned int uint32;
+-
+-#endif
+-
++#define	MDI_LITTLEENDIAN        0x5045
++#define	MDI_BIGENDIAN           0x4550
+ /*
+  * Intrinsic data types required by the file format:
+  *
+@@ -68,29 +60,28 @@
+  * 32-bit quantities	int32/uint32
+  * strings		unsigned char*
+  */
+-#ifndef _TIFF_DATA_TYPEDEFS_
+-#define _TIFF_DATA_TYPEDEFS_
+ 
+-#ifndef _AIX
+-#ifdef __STDC__
++#ifndef HAVE_INT8
+ typedef	signed char int8;	/* NB: non-ANSI compilers may not grok */
+-#else
+-typedef	char int8;
+-#endif
+ #endif
+ typedef	unsigned char uint8;
++#ifndef HAVE_INT16
+ typedef	short int16;
++#endif
+ typedef	unsigned short uint16;	/* sizeof (uint16) must == 2 */
+-#if defined(__alpha) || (defined(_MIPS_SZLONG) && _MIPS_SZLONG == 64) || defined(__LP64__) || defined(__arch64__)
++#if SIZEOF_INT == 4
++#ifndef HAVE_INT32
+ typedef	int int32;
++#endif
+ typedef	unsigned int uint32;	/* sizeof (uint32) must == 4 */
+-#else
++#elif SIZEOF_LONG == 4
++#ifndef HAVE_INT32
+ typedef	long int32;
++#endif
+ typedef	unsigned long uint32;	/* sizeof (uint32) must == 4 */
+ #endif
+-#endif /* _TIFF_DATA_TYPEDEFS_ */
+ 
+-/*	For TIFFReassignTagToIgnore */
++/* For TIFFReassignTagToIgnore */
+ enum TIFFIgnoreSense /* IGNORE tag table */
+ {
+ 	TIS_STORE,
+@@ -98,24 +89,29 @@
+ 	TIS_EMPTY
+ };
+ 
++/*
++ * TIFF header.
++ */
+ typedef	struct {
+ 	uint16	tiff_magic;	/* magic number (defines byte order) */
++#define TIFF_MAGIC_SIZE		2
+ 	uint16	tiff_version;	/* TIFF version number */
++#define TIFF_VERSION_SIZE	2
+ 	uint32	tiff_diroff;	/* byte offset to first directory */
++#define TIFF_DIROFFSET_SIZE	4
+ } TIFFHeader;
+ 
++
+ /*
+- * TIFF Image File Directories are comprised of
+- * a table of field descriptors of the form shown
+- * below.  The table is sorted in ascending order
+- * by tag.  The values associated with each entry
+- * are disjoint and may appear anywhere in the file
+- * (so long as they are placed on a word boundary).
++ * TIFF Image File Directories are comprised of a table of field
++ * descriptors of the form shown below.  The table is sorted in
++ * ascending order by tag.  The values associated with each entry are
++ * disjoint and may appear anywhere in the file (so long as they are
++ * placed on a word boundary).
+  *
+- * If the value is 4 bytes or less, then it is placed
+- * in the offset field to save space.  If the value
+- * is less than 4 bytes, it is left-justified in the
+- * offset field.
++ * If the value is 4 bytes or less, then it is placed in the offset
++ * field to save space.  If the value is less than 4 bytes, it is
++ * left-justified in the offset field.
+  */
+ typedef	struct {
+ 	uint16		tdir_tag;	/* see below */
+@@ -130,6 +126,7 @@
+  *  - items marked with a ! are introduced in revision 6.0.
+  *  - items marked with a % are introduced post revision 6.0.
+  *  - items marked with a $ are obsoleted by revision 6.0.
++ *  - items marked with a & are introduced by Adobe DNG specification.
+  */
+ 
+ /*
+@@ -191,7 +188,8 @@
+ #define     COMPRESSION_PIXARFILM	32908   /* Pixar companded 10bit LZW */
+ #define	    COMPRESSION_PIXARLOG	32909   /* Pixar companded 11bit ZIP */
+ #define	    COMPRESSION_DEFLATE		32946	/* Deflate compression */
+-#define     COMPRESSION_ADOBE_DEFLATE   8       /* Deflate compression, as recognized by Adobe */
++#define     COMPRESSION_ADOBE_DEFLATE   8       /* Deflate compression,
++						   as recognized by Adobe */
+ /* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
+ #define     COMPRESSION_DCS             32947   /* Kodak DCS encoding */
+ #define	    COMPRESSION_JBIG		34661	/* ISO JBIG */
+@@ -281,12 +279,15 @@
+ #define	TIFFTAG_ARTIST			315	/* creator of image */
+ #define	TIFFTAG_HOSTCOMPUTER		316	/* machine where created */
+ #define	TIFFTAG_PREDICTOR		317	/* prediction scheme w/ LZW */
++#define     PREDICTOR_NONE		1	/* no prediction scheme used */
++#define     PREDICTOR_HORIZONTAL	2	/* horizontal differencing */
++#define     PREDICTOR_FLOATINGPOINT	3	/* floating point predictor */
+ #define	TIFFTAG_WHITEPOINT		318	/* image white point */
+ #define	TIFFTAG_PRIMARYCHROMATICITIES	319	/* !primary chromaticities */
+ #define	TIFFTAG_COLORMAP		320	/* RGB map for pallette image */
+ #define	TIFFTAG_HALFTONEHINTS		321	/* !highlight+shadow info */
+-#define	TIFFTAG_TILEWIDTH		322	/* !rows/data tile */
+-#define	TIFFTAG_TILELENGTH		323	/* !cols/data tile */
++#define	TIFFTAG_TILEWIDTH		322	/* !tile width in pixels */
++#define	TIFFTAG_TILELENGTH		323	/* !tile height in pixels */
+ #define TIFFTAG_TILEOFFSETS		324	/* !offsets to data tiles */
+ #define TIFFTAG_TILEBYTECOUNTS		325	/* !byte counts for tiles */
+ #define	TIFFTAG_BADFAXLINES		326	/* lines w/ wrong pixel count */
+@@ -316,15 +317,19 @@
+ #define	    SAMPLEFORMAT_COMPLEXIEEEFP	6	/* !complex ieee floating */
+ #define	TIFFTAG_SMINSAMPLEVALUE		340	/* !variable MinSampleValue */
+ #define	TIFFTAG_SMAXSAMPLEVALUE		341	/* !variable MaxSampleValue */
+-#define	TIFFTAG_CLIPPATH		343	/* %ClipPath [Adobe TIFF technote 2] */
+-#define	TIFFTAG_XCLIPPATHUNITS	344	/* %XClipPathUnits [Adobe TIFF technote 2] */
+-#define	TIFFTAG_YCLIPPATHUNITS	344	/* %YClipPathUnits [Adobe TIFF technote 2] */
+-#define	TIFFTAG_INDEXED			345	/* %Indexed [Adobe TIFF Technote 3] */
++#define	TIFFTAG_CLIPPATH		343	/* %ClipPath
++						   [Adobe TIFF technote 2] */
++#define	TIFFTAG_XCLIPPATHUNITS		344	/* %XClipPathUnits
++						   [Adobe TIFF technote 2] */
++#define	TIFFTAG_YCLIPPATHUNITS		345	/* %YClipPathUnits
++						   [Adobe TIFF technote 2] */
++#define	TIFFTAG_INDEXED			346	/* %Indexed
++						   [Adobe TIFF Technote 3] */
+ #define	TIFFTAG_JPEGTABLES		347	/* %JPEG table stream */
+ #define	TIFFTAG_OPIPROXY		351	/* %OPI Proxy [Adobe TIFF technote] */
+ /*
+- * Tags 512-521 are obsoleted by Technical Note #2
+- * which specifies a revised JPEG-in-TIFF scheme.
++ * Tags 512-521 are obsoleted by Technical Note #2 which specifies a
++ * revised JPEG-in-TIFF scheme.
+  */
+ #define	TIFFTAG_JPEGPROC		512	/* !JPEG processing algorithm */
+ #define	    JPEGPROC_BASELINE		1	/* !baseline sequential */
+@@ -343,8 +348,11 @@
+ #define	    YCBCRPOSITION_CENTERED	1	/* !as in PostScript Level 2 */
+ #define	    YCBCRPOSITION_COSITED	2	/* !as in CCIR 601-1 */
+ #define	TIFFTAG_REFERENCEBLACKWHITE	532	/* !colorimetry info */
+-#define	TIFFTAG_XMLPACKET		700		/* %XML packet [Adobe XMP technote 9-14-02] (dkelly@apago.com) */
+-#define TIFFTAG_OPIIMAGEID		32781	/* %OPI ImageID [Adobe TIFF technote] */
++#define	TIFFTAG_XMLPACKET		700	/* %XML packet
++						   [Adobe XMP Specification,
++						   January 2004 */
++#define TIFFTAG_OPIIMAGEID		32781	/* %OPI ImageID
++						   [Adobe TIFF technote] */
+ /* tags 32952-32956 are private tags registered to Island Graphics */
+ #define TIFFTAG_REFPTS			32953	/* image reference points */
+ #define TIFFTAG_REGIONTACKPOINT		32954	/* region-xform tack point */
+@@ -378,7 +386,7 @@
+ /* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
+ #define	TIFFTAG_COPYRIGHT		33432	/* copyright string */
+ /* IPTC TAG from RichTIFF specifications */
+-#define TIFFTAG_RICHTIFFIPTC    33723
++#define TIFFTAG_RICHTIFFIPTC		33723
+ /* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
+ #define TIFFTAG_IT8SITE			34016	/* site name */
+ #define TIFFTAG_IT8COLORSEQUENCE	34017	/* color seq. [RGB,CMYK,etc] */
+@@ -394,38 +402,125 @@
+ #define TIFFTAG_IT8PIXELINTENSITYRANGE	34027	/* MP pixel intensity value */
+ #define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028	/* HC transparency switch */
+ #define TIFFTAG_IT8COLORCHARACTERIZATION 34029	/* color character. table */
+-#define TIFFTAG_IT8HCUSAGE			34030	/* HC usage indicator */
+-#define TIFFTAG_IT8TRAPINDICATOR	34031	/* Trapping indicator (untrapped=0, trapped=1) */
++#define TIFFTAG_IT8HCUSAGE		34030	/* HC usage indicator */
++#define TIFFTAG_IT8TRAPINDICATOR	34031	/* Trapping indicator
++						   (untrapped=0, trapped=1) */
+ #define TIFFTAG_IT8CMYKEQUIVALENT	34032	/* CMYK color equivalents */
+ /* tags 34232-34236 are private tags registered to Texas Instruments */
+ #define TIFFTAG_FRAMECOUNT              34232   /* Sequence Frame Count */
++/* tag 34377 is private tag registered to Adobe for PhotoShop */
++#define TIFFTAG_PHOTOSHOP		34377 
++/* tags 34665, 34853 and 40965 are documented in EXIF specification */
++#define TIFFTAG_EXIFIFD			34665	/* Pointer to EXIF private directory */
+ /* tag 34750 is a private tag registered to Adobe? */
+ #define TIFFTAG_ICCPROFILE		34675	/* ICC profile data */
+-/* tag 34377 is private tag registered to Adobe for PhotoShop */
+-#define TIFFTAG_PHOTOSHOP				34377 
+ /* tag 34750 is a private tag registered to Pixel Magic */
+ #define	TIFFTAG_JBIGOPTIONS		34750	/* JBIG options */
++#define TIFFTAG_GPSIFD			34853	/* Pointer to GPS private directory */
+ /* tags 34908-34914 are private tags registered to SGI */
+ #define	TIFFTAG_FAXRECVPARAMS		34908	/* encoded Class 2 ses. parms */
+ #define	TIFFTAG_FAXSUBADDRESS		34909	/* received SubAddr string */
+ #define	TIFFTAG_FAXRECVTIME		34910	/* receive time (secs) */
++#define	TIFFTAG_FAXDCS			34911	/* encoded fax ses. params, Table 2/T.30 */
+ /* tags 37439-37443 are registered to SGI <gregl@sgi.com> */
+ #define TIFFTAG_STONITS			37439	/* Sample value to Nits */
+ /* tag 34929 is a private tag registered to FedEx */
+ #define	TIFFTAG_FEDEX_EDR		34929	/* unknown use */
++#define TIFFTAG_INTEROPERABILITYIFD	40965	/* Pointer to Interoperability private directory */
++/* Adobe Digital Negative (DNG) format tags */
++#define TIFFTAG_DNGVERSION		50706	/* &DNG version number */
++#define TIFFTAG_DNGBACKWARDVERSION	50707	/* &DNG compatibility version */
++#define TIFFTAG_UNIQUECAMERAMODEL	50708	/* &name for the camera model */
++#define TIFFTAG_LOCALIZEDCAMERAMODEL	50709	/* &localized camera model
++						   name */
++#define TIFFTAG_CFAPLANECOLOR		50710	/* &CFAPattern->LinearRaw space
++						   mapping */
++#define TIFFTAG_CFALAYOUT		50711	/* &spatial layout of the CFA */
++#define TIFFTAG_LINEARIZATIONTABLE	50712	/* &lookup table description */
++#define TIFFTAG_BLACKLEVELREPEATDIM	50713	/* &repeat pattern size for
++						   the BlackLevel tag */
++#define TIFFTAG_BLACKLEVEL		50714	/* &zero light encoding level */
++#define TIFFTAG_BLACKLEVELDELTAH	50715	/* &zero light encoding level
++						   differences (columns) */
++#define TIFFTAG_BLACKLEVELDELTAV	50716	/* &zero light encoding level
++						   differences (rows) */
++#define TIFFTAG_WHITELEVEL		50717	/* &fully saturated encoding
++						   level */
++#define TIFFTAG_DEFAULTSCALE		50718	/* &default scale factors */
++#define TIFFTAG_DEFAULTCROPORIGIN	50719	/* &origin of the final image
++						   area */
++#define TIFFTAG_DEFAULTCROPSIZE		50720	/* &size of the final image 
++						   area */
++#define TIFFTAG_COLORMATRIX1		50721	/* &XYZ->reference color space
++						   transformation matrix 1 */
++#define TIFFTAG_COLORMATRIX2		50722	/* &XYZ->reference color space
++						   transformation matrix 2 */
++#define TIFFTAG_CAMERACALIBRATION1	50723	/* &calibration matrix 1 */
++#define TIFFTAG_CAMERACALIBRATION2	50724	/* &calibration matrix 2 */
++#define TIFFTAG_REDUCTIONMATRIX1	50725	/* &dimensionality reduction
++						   matrix 1 */
++#define TIFFTAG_REDUCTIONMATRIX2	50726	/* &dimensionality reduction
++						   matrix 2 */
++#define TIFFTAG_ANALOGBALANCE		50727	/* &gain applied the stored raw
++						   values*/
++#define TIFFTAG_ASSHOTNEUTRAL		50728	/* &selected white balance in
++						   linear reference space */
++#define TIFFTAG_ASSHOTWHITEXY		50729	/* &selected white balance in
++						   x-y chromaticity
++						   coordinates */
++#define TIFFTAG_BASELINEEXPOSURE	50730	/* &how much to move the zero
++						   point */
++#define TIFFTAG_BASELINENOISE		50731	/* &relative noise level */
++#define TIFFTAG_BASELINESHARPNESS	50732	/* &relative amount of
++						   sharpening */
++#define TIFFTAG_BAYERGREENSPLIT		50733	/* &how closely the values of
++						   the green pixels in the
++						   blue/green rows track the
++						   values of the green pixels
++						   in the red/green rows */
++#define TIFFTAG_LINEARRESPONSELIMIT	50734	/* &non-linear encoding range */
++#define TIFFTAG_CAMERASERIALNUMBER	50735	/* &camera's serial number */
++#define TIFFTAG_LENSINFO		50736	/* info about the lens */
++#define TIFFTAG_CHROMABLURRADIUS	50737	/* &chroma blur radius */
++#define TIFFTAG_ANTIALIASSTRENGTH	50738	/* &relative strength of the
++						   camera's anti-alias filter */
++#define TIFFTAG_SHADOWSCALE		50739	/* &used by Adobe Camera Raw */
++#define TIFFTAG_DNGPRIVATEDATA		50740	/* &manufacturer's private data */
++#define TIFFTAG_MAKERNOTESAFETY		50741	/* &whether the EXIF MakerNote
++						   tag is safe to preserve
++						   along with the rest of the
++						   EXIF data */
++#define	TIFFTAG_CALIBRATIONILLUMINANT1	50778	/* &illuminant 1 */
++#define TIFFTAG_CALIBRATIONILLUMINANT2	50779	/* &illuminant 2 */
++#define TIFFTAG_BESTQUALITYSCALE	50780	/* &best quality multiplier */
++#define TIFFTAG_RAWDATAUNIQUEID		50781	/* &unique identifier for
++						   the raw image data */
++#define TIFFTAG_ORIGINALRAWFILENAME	50827	/* &file name of the original
++						   raw file */
++#define TIFFTAG_ORIGINALRAWFILEDATA	50828	/* &contents of the original
++						   raw file */
++#define TIFFTAG_ACTIVEAREA		50829	/* &active (non-masked) pixels
++						   of the sensor */
++#define TIFFTAG_MASKEDAREAS		50830	/* &list of coordinates
++						   of fully masked pixels */
++#define TIFFTAG_ASSHOTICCPROFILE	50831	/* &these two tags used to */
++#define TIFFTAG_ASSHOTPREPROFILEMATRIX	50832	/* map cameras's color space
++						   into ICC profile space */
++#define TIFFTAG_CURRENTICCPROFILE	50833	/* & */
++#define TIFFTAG_CURRENTPREPROFILEMATRIX	50834	/* & */
+ /* tag 65535 is an undefined tag used by Eastman Kodak */
+ #define TIFFTAG_DCSHUESHIFTVALUES       65535   /* hue shift correction data */
+ 
+ /*
+- * The following are ``pseudo tags'' that can be
+- * used to control codec-specific functionality.
+- * These tags are not written to file.  Note that
+- * these values start at 0xffff+1 so that they'll
+- * never collide with Aldus-assigned tags.
++ * The following are ``pseudo tags'' that can be used to control
++ * codec-specific functionality.  These tags are not written to file.
++ * Note that these values start at 0xffff+1 so that they'll never
++ * collide with Aldus-assigned tags.
+  *
+- * If you want your private pseudo tags ``registered''
+- * (i.e. added to this file), send mail to sam@sgi.com
+- * with the appropriate C definitions to add.
++ * If you want your private pseudo tags ``registered'' (i.e. added to
++ * this file), please post a bug report via the tracking system at
++ * http://www.remotesensing.org/libtiff/bugs.html with the appropriate
++ * C definitions to add.
+  */
+ #define	TIFFTAG_FAXMODE			65536	/* Group 3/4 format control */
+ #define	    FAXMODE_CLASSIC	0x0000		/* default, include RTC */
+@@ -481,4 +576,72 @@
+ #define TIFFTAG_SGILOGENCODE		65561 /* SGILog data encoding control*/
+ #define     SGILOGENCODE_NODITHER	0     /* do not dither encoded values*/
+ #define     SGILOGENCODE_RANDITHER	1     /* randomly dither encd values */
++
++/*
++ * EXIF tags
++ */
++#define EXIFTAG_EXPOSURETIME		33434	/* Exposure time */
++#define EXIFTAG_FNUMBER			33437	/* F number */
++#define EXIFTAG_EXPOSUREPROGRAM		34850	/* Exposure program */
++#define EXIFTAG_SPECTRALSENSITIVITY	34852	/* Spectral sensitivity */
++#define EXIFTAG_ISOSPEEDRATINGS		34855	/* ISO speed rating */
++#define EXIFTAG_OECF			34856	/* Optoelectric conversion
++						   factor */
++#define EXIFTAG_EXIFVERSION		36864	/* Exif version */
++#define EXIFTAG_DATETIMEORIGINAL	36867	/* Date and time of original
++						   data generation */
++#define EXIFTAG_DATETIMEDIGITIZED	36868	/* Date and time of digital
++						   data generation */
++#define EXIFTAG_COMPONENTSCONFIGURATION	37121	/* Meaning of each component */
++#define EXIFTAG_COMPRESSEDBITSPERPIXEL	37122	/* Image compression mode */
++#define EXIFTAG_SHUTTERSPEEDVALUE	37377	/* Shutter speed */
++#define EXIFTAG_APERTUREVALUE		37378	/* Aperture */
++#define EXIFTAG_BRIGHTNESSVALUE		37379	/* Brightness */
++#define EXIFTAG_EXPOSUREBIASVALUE	37380	/* Exposure bias */
++#define EXIFTAG_MAXAPERTUREVALUE	37381	/* Maximum lens aperture */
++#define EXIFTAG_SUBJECTDISTANCE		37382	/* Subject distance */
++#define EXIFTAG_METERINGMODE		37383	/* Metering mode */
++#define EXIFTAG_LIGHTSOURCE		37384	/* Light source */
++#define EXIFTAG_FLASH			37385	/* Flash */
++#define EXIFTAG_FOCALLENGTH		37386	/* Lens focal length */
++#define EXIFTAG_SUBJECTAREA		37396	/* Subject area */
++#define EXIFTAG_MAKERNOTE		37500	/* Manufacturer notes */
++#define EXIFTAG_USERCOMMENT		37510	/* User comments */
++#define EXIFTAG_SUBSECTIME		37520	/* DateTime subseconds */
++#define EXIFTAG_SUBSECTIMEORIGINAL	37521	/* DateTimeOriginal subseconds */
++#define EXIFTAG_SUBSECTIMEDIGITIZED	37522	/* DateTimeDigitized subseconds */
++#define EXIFTAG_FLASHPIXVERSION		40960	/* Supported Flashpix version */
++#define EXIFTAG_COLORSPACE		40961	/* Color space information */
++#define EXIFTAG_PIXELXDIMENSION		40962	/* Valid image width */
++#define EXIFTAG_PIXELYDIMENSION		40963	/* Valid image height */
++#define EXIFTAG_RELATEDSOUNDFILE	40964	/* Related audio file */
++#define EXIFTAG_FLASHENERGY		41483	/* Flash energy */
++#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484	/* Spatial frequency response */
++#define EXIFTAG_FOCALPLANEXRESOLUTION	41486	/* Focal plane X resolution */
++#define EXIFTAG_FOCALPLANEYRESOLUTION	41487	/* Focal plane Y resolution */
++#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488	/* Focal plane resolution unit */
++#define EXIFTAG_SUBJECTLOCATION		41492	/* Subject location */
++#define EXIFTAG_EXPOSUREINDEX		41493	/* Exposure index */
++#define EXIFTAG_SENSINGMETHOD		41495	/* Sensing method */
++#define EXIFTAG_FILESOURCE		41728	/* File source */
++#define EXIFTAG_SCENETYPE		41729	/* Scene type */
++#define EXIFTAG_CFAPATTERN		41730	/* CFA pattern */
++#define EXIFTAG_CUSTOMRENDERED		41985	/* Custom image processing */
++#define EXIFTAG_EXPOSUREMODE		41986	/* Exposure mode */
++#define EXIFTAG_WHITEBALANCE		41987	/* White balance */
++#define EXIFTAG_DIGITALZOOMRATIO	41988	/* Digital zoom ratio */
++#define EXIFTAG_FOCALLENGTHIN35MMFILM	41989	/* Focal length in 35 mm film */
++#define EXIFTAG_SCENECAPTURETYPE	41990	/* Scene capture type */
++#define EXIFTAG_GAINCONTROL		41991	/* Gain control */
++#define EXIFTAG_CONTRAST		41992	/* Contrast */
++#define EXIFTAG_SATURATION		41993	/* Saturation */
++#define EXIFTAG_SHARPNESS		41994	/* Sharpness */
++#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995	/* Device settings description */
++#define EXIFTAG_SUBJECTDISTANCERANGE	41996	/* Subject distance range */
++#define EXIFTAG_GAINCONTROL		41991	/* Gain control */
++#define EXIFTAG_GAINCONTROL		41991	/* Gain control */
++#define EXIFTAG_IMAGEUNIQUEID		42016	/* Unique image ID */
++
+ #endif /* _TIFF_ */
++
++/* vim: set ts=8 sts=8 sw=8 noet: */
+Index: libtk-img/libtiff/libtiff/tif_dir.h
+========================================================================
+--- libtk-img.orig/libtiff/libtiff/tif_dir.h
++++ libtk-img/libtiff/libtiff/tif_dir.h
+@@ -36,7 +36,7 @@
+ typedef	struct {
+ #define	FIELD_SETLONGS	4
+ 	/* bit vector of fields that are set */
+-	u_long	td_fieldsset[FIELD_SETLONGS];
++	unsigned long	td_fieldsset[FIELD_SETLONGS];
+ 
+ 	uint32	td_imagewidth, td_imagelength, td_imagedepth;
+ 	uint32	td_tilewidth, td_tilelength, td_tiledepth;
+@@ -61,66 +61,23 @@
+ 	uint16	td_halftonehints[2];
+ 	uint16	td_extrasamples;
+ 	uint16*	td_sampleinfo;
+-	double	td_stonits;
+-	char*	td_documentname;
+-	char*	td_artist;
+-	char*	td_datetime;
+-	char*	td_hostcomputer;
+-	char*	td_imagedescription;
+-	char*	td_make;
+-	char*	td_model;
+-        char*   td_copyright;
+-	char*	td_pagename;
+ 	tstrip_t td_stripsperimage;
+ 	tstrip_t td_nstrips;		/* size of offset & bytecount arrays */
+ 	uint32*	td_stripoffset;
+ 	uint32*	td_stripbytecount;
+-#if SUBIFD_SUPPORT
++	int	td_stripbytecountsorted; /* is the bytecount array sorted ascending? */
+ 	uint16	td_nsubifd;
+ 	uint32*	td_subifd;
+-#endif
+-#ifdef YCBCR_SUPPORT
+-	float*	td_ycbcrcoeffs;
++	/* YCbCr parameters */
+ 	uint16	td_ycbcrsubsampling[2];
+ 	uint16	td_ycbcrpositioning;
+-#endif
+-#ifdef COLORIMETRY_SUPPORT
+-	float*	td_whitepoint;
+-	float*	td_primarychromas;
+-	float*	td_refblackwhite;
++	/* Colorimetry parameters */
+ 	uint16*	td_transferfunction[3];
+-#endif
+-#ifdef CMYK_SUPPORT
+-	uint16	td_inkset;
+-	uint16	td_ninks;
+-	uint16	td_dotrange[2];
++	/* CMYK parameters */
+ 	int	td_inknameslen;
+ 	char*	td_inknames;
+-	char*	td_targetprinter;
+-#endif
+-#ifdef ICC_SUPPORT
+-	uint32	td_profileLength;
+-	void	*td_profileData;
+-#endif
+-#ifdef PHOTOSHOP_SUPPORT
+-	uint32	td_photoshopLength;
+-	void	*td_photoshopData;
+-#endif
+-#ifdef IPTC_SUPPORT
+-	uint32	td_richtiffiptcLength;
+-	void	*td_richtiffiptcData;
+-#endif
+-        /* Begin Pixar Tag values. */
+-        uint32	td_imagefullwidth, td_imagefulllength;
+- 	char*	td_textureformat;
+- 	char*	td_wrapmodes;
+- 	float	td_fovcot;
+- 	float*	td_matrixWorldToScreen;
+- 	float*	td_matrixWorldToCamera;
+- 	/* End Pixar Tag Values. */
+-	uint32	td_xmlpacketLength;
+-	void	*td_xmlpacketData;
+-		int     td_customValueCount;
++
++	int     td_customValueCount;
+         TIFFTagValue *td_customValues;
+ } TIFFDirectory;
+ 
+@@ -153,26 +110,17 @@
+ #define	FIELD_PHOTOMETRIC		8
+ #define	FIELD_THRESHHOLDING		9
+ #define	FIELD_FILLORDER			10
+-#define	FIELD_DOCUMENTNAME		11
+-#define	FIELD_IMAGEDESCRIPTION		12
+-#define	FIELD_MAKE			13
+-#define	FIELD_MODEL			14
+ #define	FIELD_ORIENTATION		15
+ #define	FIELD_SAMPLESPERPIXEL		16
+ #define	FIELD_ROWSPERSTRIP		17
+ #define	FIELD_MINSAMPLEVALUE		18
+ #define	FIELD_MAXSAMPLEVALUE		19
+ #define	FIELD_PLANARCONFIG		20
+-#define	FIELD_PAGENAME			21
+ #define	FIELD_RESOLUTIONUNIT		22
+ #define	FIELD_PAGENUMBER		23
+ #define	FIELD_STRIPBYTECOUNTS		24
+ #define	FIELD_STRIPOFFSETS		25
+ #define	FIELD_COLORMAP			26
+-#define FIELD_ARTIST			27
+-#define FIELD_DATETIME			28
+-#define FIELD_HOSTCOMPUTER		29
+-/* unused - was FIELD_SOFTWARE          30 */
+ #define	FIELD_EXTRASAMPLES		31
+ #define FIELD_SAMPLEFORMAT		32
+ #define	FIELD_SMINSAMPLEVALUE		33
+@@ -180,33 +128,11 @@
+ #define FIELD_IMAGEDEPTH		35
+ #define FIELD_TILEDEPTH			36
+ #define	FIELD_HALFTONEHINTS		37
+-#define FIELD_YCBCRCOEFFICIENTS		38
+ #define FIELD_YCBCRSUBSAMPLING		39
+ #define FIELD_YCBCRPOSITIONING		40
+-#define	FIELD_REFBLACKWHITE		41
+-#define	FIELD_WHITEPOINT		42
+-#define	FIELD_PRIMARYCHROMAS		43
+ #define	FIELD_TRANSFERFUNCTION		44
+-#define	FIELD_INKSET			45
+ #define	FIELD_INKNAMES			46
+-#define	FIELD_DOTRANGE			47
+-#define	FIELD_TARGETPRINTER		48
+ #define	FIELD_SUBIFD			49
+-#define	FIELD_NUMBEROFINKS		50
+-#define FIELD_ICCPROFILE		51
+-#define FIELD_PHOTOSHOP			52
+-#define FIELD_RICHTIFFIPTC		53
+-#define FIELD_STONITS			54
+-/* Begin PIXAR */
+-#define	FIELD_IMAGEFULLWIDTH		55
+-#define	FIELD_IMAGEFULLLENGTH		56
+-#define FIELD_TEXTUREFORMAT		57
+-#define FIELD_WRAPMODES			58
+-#define FIELD_FOVCOT			59
+-#define FIELD_MATRIX_WORLDTOSCREEN	60
+-#define FIELD_MATRIX_WORLDTOCAMERA	61
+-#define FIELD_COPYRIGHT			62
+-#define FIELD_XMLPACKET			63
+ /*      FIELD_CUSTOM (see tiffio.h)     65 */
+ /* end of support for well-known tags; codec-private tags follow */
+ #define	FIELD_CODEC			66	/* base of codec-private tags */
+@@ -236,7 +162,7 @@
+ 	(v) & (tif)->tif_typemask[type]))
+ 
+ 
+-#define BITn(n)				(((u_long)1L)<<((n)&0x1f)) 
++#define BITn(n)				(((unsigned long)1L)<<((n)&0x1f)) 
+ #define BITFIELDn(tif, n)		((tif)->tif_dir.td_fieldsset[(n)/32]) 
+ #define TIFFFieldSet(tif, field)	(BITFIELDn(tif, field) & BITn(field)) 
+ #define TIFFSetFieldBit(tif, field)	(BITFIELDn(tif, field) |= BITn(field))
+@@ -248,7 +174,9 @@
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+-extern	void _TIFFSetupFieldInfo(TIFF*);
++extern	const TIFFFieldInfo *_TIFFGetFieldInfo(size_t *);
++extern	const TIFFFieldInfo *_TIFFGetExifFieldInfo(size_t *);
++extern	void _TIFFSetupFieldInfo(TIFF*, const TIFFFieldInfo[], size_t);
+ extern	void _TIFFPrintFieldInfo(TIFF*, FILE*);
+ extern	TIFFDataType _TIFFSampleToTagType(TIFF*);
+ extern  const TIFFFieldInfo* _TIFFFindOrRegisterFieldInfo( TIFF *tif,
+@@ -257,11 +185,15 @@
+ extern  TIFFFieldInfo* _TIFFCreateAnonFieldInfo( TIFF *tif, ttag_t tag,
+                                                  TIFFDataType dt );
+ 
+-#define _TIFFMergeFieldInfo TIFFMergeFieldInfo
+-#define _TIFFFindFieldInfo  TIFFFindFieldInfo
+-#define _TIFFFieldWithTag   TIFFFieldWithTag
+-    
++#define _TIFFMergeFieldInfo	    TIFFMergeFieldInfo
++#define _TIFFFindFieldInfo	    TIFFFindFieldInfo
++#define _TIFFFindFieldInfoByName    TIFFFindFieldInfoByName
++#define _TIFFFieldWithTag	    TIFFFieldWithTag
++#define _TIFFFieldWithName	    TIFFFieldWithName
++
+ #if defined(__cplusplus)
+ }
+ #endif
+ #endif /* _TIFFDIR_ */
++
++/* vim: set ts=8 sts=8 sw=8 noet: */
+Index: libtk-img/libtiff/libtiff/tiffvers.h
+========================================================================
+--- libtk-img.orig/libtiff/libtiff/tiffvers.h
++++ libtk-img/libtiff/libtiff/tiffvers.h
+@@ -1,4 +1,4 @@
+-#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.6.1\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
++#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.8.2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
+ /*
+  * This define can be used in code that requires
+  * compilation-related definitions specific to a
+@@ -6,4 +6,4 @@
+  * version checking should be done based on the
+  * string returned by TIFFGetVersion.
+  */
+-#define TIFFLIB_VERSION 20031226
++#define TIFFLIB_VERSION 20060323
+Index: libtk-img/libtiff/libtiff/tiffconf.h
+========================================================================
+--- libtk-img.orig/libtiff/libtiff/tiffconf.h
++++ libtk-img/libtiff/libtiff/tiffconf.h
+@@ -1,152 +1,100 @@
+-/* $Header: /cvsroot/tkimg/tkimg/libtiff/libtiff/tiffconf.h,v 1.1 2004/08/13 22:02:18 andreas_kupries Exp $ */
++/* libtiff/tiffconf.h.  Generated by configure.  */
+ /*
+- * Copyright (c) 1988-1997 Sam Leffler
+- * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+- *
+- * Permission to use, copy, modify, distribute, and sell this software and 
+- * its documentation for any purpose is hereby granted without fee, provided
+- * that (i) the above copyright notices and this permission notice appear in
+- * all copies of the software and related documentation, and (ii) the names of
+- * Sam Leffler and Silicon Graphics may not be used in any advertising or
+- * publicity relating to the software without the specific, prior written
+- * permission of Sam Leffler and Silicon Graphics.
+- * 
+- * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+- * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+- * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+- * 
+- * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+- * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+- * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+- * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+- * OF THIS SOFTWARE.
+- */
++  Configuration defines for installed libtiff.
++  This file maintained for backward compatibility. Do not use definitions
++  from this file in your programs.
++*/
+ 
+ #ifndef _TIFFCONF_
+-#define	_TIFFCONF_
+-/*
+- * Library Configuration Definitions.
+- *
+- * This file defines the default configuration for the library.
+- * If the target system does not have make or a way to specify
+- * #defines on the command line, this file can be edited to
+- * configure the library.  Otherwise, one can override portability
+- * and configuration-related definitions from a Makefile or command
+- * line by defining COMPRESSION_SUPPORT (see below).
+- */
++#define _TIFFCONF_
+ 
+-/*
+- * General portability-related defines:
+- *
+- * HAVE_IEEEFP		define as 0 or 1 according to the floating point
+- *			format suported by the machine
+- * BSDTYPES		define this if your system does NOT define the
+- *			usual 4BSD typedefs u_int et. al.
+- * HAVE_MMAP		enable support for memory mapping read-only files;
+- *			this is typically deduced by the configure script
+- * HOST_FILLORDER	native cpu bit order: one of FILLORDER_MSB2LSB
+- *			or FILLODER_LSB2MSB; this is typically set by the
+- *			configure script
+- * HOST_BIGENDIAN	native cpu byte order: 1 if big-endian (Motorola)
+- *			or 0 if little-endian (Intel); this may be used
+- *			in codecs to optimize code
+- * USE_64BIT_API	set to 1 if tif_unix.c should use lseek64(),
+- *                      fstat64() and stat64 allowing 2-4GB files.
+- */
+-#ifndef HAVE_IEEEFP
+-#define	HAVE_IEEEFP	1
+-#endif
+-#ifndef HOST_FILLORDER
+-#define	HOST_FILLORDER	FILLORDER_MSB2LSB
+-#endif
+-#ifndef	HOST_BIGENDIAN
+-#define	HOST_BIGENDIAN	1
+-#endif
+-
+-#ifndef USE_64BIT_API
+-#  define USE_64BIT_API	0
+-#endif
++/* Define to 1 if the system has the type `int16'. */
++/* #undef HAVE_INT16 */
+ 
+-#ifndef COMPRESSION_SUPPORT
+-/*
+- * Compression support defines:
+- *
+- *    CCITT_SUPPORT	enable support for CCITT Group 3 & 4 algorithms
+- *    PACKBITS_SUPPORT	enable support for Macintosh PackBits algorithm
+- *    LZW_SUPPORT	enable support for LZW algorithm
+- *    THUNDER_SUPPORT	enable support for ThunderScan 4-bit RLE algorithm
+- *    NEXT_SUPPORT	enable support for NeXT 2-bit RLE algorithm
+- *    OJPEG_SUPPORT	enable support for 6.0-style JPEG DCT algorithms
+- *			(requires IJG software)
+- *    JPEG_SUPPORT	enable support for post-6.0-style JPEG DCT algorithms
+- *			(requires freely available IJG software, see tif_jpeg.c)
+- *    ZIP_SUPPORT	enable support for Deflate algorithm
+- *			(requires freely available zlib software, see tif_zip.c)
+- *    PIXARLOG_SUPPORT	enable support for Pixar log-format algorithm
+- *    LOGLUV_SUPPORT	enable support for LogLuv high dynamic range encoding
+- */
+-#define	CCITT_SUPPORT
+-#define	PACKBITS_SUPPORT
+-#define	LZW_SUPPORT
+-#define	THUNDER_SUPPORT
+-#define	NEXT_SUPPORT
+-#define LOGLUV_SUPPORT
+-#endif /* COMPRESSION_SUPPORT */
++/* Define to 1 if the system has the type `int32'. */
++/* #undef HAVE_INT32 */
+ 
+-/*
+- * If JPEG compression is enabled then we must also include
+- * support for the colorimetry and YCbCr-related tags.
+- */
+-#ifdef JPEG_SUPPORT
+-#ifndef YCBCR_SUPPORT
+-#define	YCBCR_SUPPORT
+-#endif
+-#ifndef COLORIMETRY_SUPPORT
+-#define	COLORIMETRY_SUPPORT
+-#endif
+-#endif /* JPEG_SUPPORT */
++/* Define to 1 if the system has the type `int8'. */
++/* #undef HAVE_INT8 */
+ 
+-/*
+- * ``Orthogonal Features''
+- *
+- * STRIPCHOP_DEFAULT	default handling of strip chopping support (whether
+- *			or not to convert single-strip uncompressed images
+- *			to mutiple strips of ~8Kb--to reduce memory use)
+- * SUBIFD_SUPPORT	enable support for SubIFD tag (thumbnails and such)
+- * DEFAULT_EXTRASAMPLE_AS_ALPHA
+- *                      The RGBA interface will treat a fourth sample with
+- *                      no EXTRASAMPLE_ value as being ASSOCALPHA.  Many
+- *                      packages produce RGBA files but don't mark the alpha
+- *                      properly.
+- * CHECK_JPEG_YCBCR_SUBSAMPLING
+- *                      Enable picking up YCbCr subsampling info from the
+- *                      JPEG data stream to support files lacking the tag.
+- *                      See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling()
+- *                      for details. 
+- */
+-#ifndef STRIPCHOP_DEFAULT
+-#define	STRIPCHOP_DEFAULT	TIFF_STRIPCHOP	/* default is to enable */
+-#endif
+-#ifndef SUBIFD_SUPPORT
+-#define	SUBIFD_SUPPORT		1	/* enable SubIFD tag (330) support */
+-#endif
+-#ifndef DEFAULT_EXTRASAMPLE_AS_ALPHA
++/* The size of a `int', as computed by sizeof. */
++#define SIZEOF_INT 4
++
++/* The size of a `long', as computed by sizeof. */
++#define SIZEOF_LONG 4
++
++/* Compatibility stuff. */
++
++/* Define as 0 or 1 according to the floating point format suported by the
++   machine */
++#define HAVE_IEEEFP 1
++
++/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
++#define HOST_FILLORDER FILLORDER_LSB2MSB
++
++/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
++   (Intel) */
++#define HOST_BIGENDIAN 0
++
++/* Support CCITT Group 3 & 4 algorithms */
++#define CCITT_SUPPORT 1
++
++/* Support JPEG compression (requires IJG JPEG library) */
++/* #undef JPEG_SUPPORT */
++
++/* Support LogLuv high dynamic range encoding */
++#define LOGLUV_SUPPORT 1
++
++/* Support LZW algorithm */
++#define LZW_SUPPORT 1
++
++/* Support NeXT 2-bit RLE algorithm */
++#define NEXT_SUPPORT 1
++
++/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
++   fails with unpatched IJG JPEG library) */
++/* #undef OJPEG_SUPPORT */
++
++/* Support Macintosh PackBits algorithm */
++#define PACKBITS_SUPPORT 1
++
++/* Support Pixar log-format algorithm (requires Zlib) */
++/* #undef PIXARLOG_SUPPORT */
++
++/* Support ThunderScan 4-bit RLE algorithm */
++#define THUNDER_SUPPORT 1
++
++/* Support Deflate compression */
++/* #undef ZIP_SUPPORT */
++
++/* Support strip chopping (whether or not to convert single-strip uncompressed
++   images to mutiple strips of ~8Kb to reduce memory usage) */
++#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
++
++/* Enable SubIFD tag (330) support */
++#define SUBIFD_SUPPORT 1
++
++/* Treat extra sample as alpha (default enabled). The RGBA interface will
++   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
++   packages produce RGBA files but don't mark the alpha properly. */
+ #define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
+-#endif
+-#ifndef CHECK_JPEG_YCBCR_SUBSAMPLING
++
++/* Pick up YCbCr subsampling info from the JPEG data stream to support files
++   lacking the tag (default enabled). */
+ #define CHECK_JPEG_YCBCR_SUBSAMPLING 1
+-#endif
++
++/* Support MS MDI magic number files as TIFF */
++#define MDI_SUPPORT 1
+ 
+ /*
+  * Feature support definitions.
+  * XXX: These macros are obsoleted. Don't use them in your apps!
+  * Macros stays here for backward compatibility and should be always defined.
+  */
+-#define	COLORIMETRY_SUPPORT
+-#define	YCBCR_SUPPORT
+-#define	CMYK_SUPPORT
+-#define	ICC_SUPPORT
++#define COLORIMETRY_SUPPORT
++#define YCBCR_SUPPORT
++#define CMYK_SUPPORT
++#define ICC_SUPPORT
+ #define PHOTOSHOP_SUPPORT
+ #define IPTC_SUPPORT
+ 
+Index: libtk-img/libtiff/libtiff/tiffiop.h
+========================================================================
+--- libtk-img.orig/libtiff/libtiff/tiffiop.h
++++ libtk-img/libtiff/libtiff/tiffiop.h
+@@ -29,21 +29,43 @@
+ /*
+  * ``Library-private'' definitions.
+  */
+-/*
+- * UNIX systems should run the configure script to generate
+- * a port.h file that reflects the system capabilities.
+- * Doing this obviates all the dreck done in tiffcomp.h.
+- */
+-#if defined(unix) || defined(__unix)
+-#include "port.h"
+-#include "tiffconf.h"
++
++#include "tif_config.h"
++
++#ifdef HAVE_FCNTL_H
++# include <fcntl.h>
++#endif
++
++#ifdef HAVE_SYS_TYPES_H
++# include <sys/types.h>
++#endif
++
++#ifdef HAVE_STRING_H
++# include <string.h>
++#endif
++
++#ifdef HAVE_ASSERT_H
++# include <assert.h>
+ #else
+-#include "tiffconf.h"
+-#include "tiffcomp.h"
++# define assert(x) 
+ #endif
++
++#ifdef HAVE_SEARCH_H
++# include <search.h>
++#else
++extern void *lfind(const void *, const void *, size_t *, size_t,
++		   int (*)(const void *, const void *));
++#endif
++
+ #include "tiffio.h"
+ #include "tif_dir.h"
+ 
++#ifndef STRIP_SIZE_DEFAULT
++# define STRIP_SIZE_DEFAULT 8192
++#endif
++
++#define    streq(a,b)      (strcmp(a,b) == 0)
++
+ #ifndef TRUE
+ #define	TRUE	1
+ #define	FALSE	0
+@@ -90,6 +112,8 @@
+ #define	TIFF_INSUBIFD		0x2000	/* currently writing a subifd */
+ #define	TIFF_UPSAMPLED		0x4000	/* library is doing data up-sampling */ 
+ #define	TIFF_STRIPCHOP		0x8000	/* enable strip chopping support */
++#define	TIFF_HEADERONLY		0x10000	/* read header only, do not process */
++					/* the first directory */
+ 	toff_t		tif_diroff;	/* file offset of current directory */
+ 	toff_t		tif_nextdiroff;	/* file offset of following directory */
+ 	toff_t*		tif_dirlist;	/* list of offsets to already seen */
+@@ -104,10 +128,9 @@
+ 	tstrip_t	tif_curstrip;	/* current strip for read/write */
+ 	toff_t		tif_curoff;	/* current offset for read/write */
+ 	toff_t		tif_dataoff;	/* current offset for writing dir */
+-#if SUBIFD_SUPPORT
++/* SubIFD support */
+ 	uint16		tif_nsubifd;	/* remaining subifds to write */
+ 	toff_t		tif_subifdoff;	/* offset for patching SubIFD link */
+-#endif
+ /* tiling support */
+ 	uint32 		tif_col;	/* current column (offset by row too) */
+ 	ttile_t		tif_curtile;	/* current tile for read/write */
+@@ -155,7 +178,8 @@
+ 	TIFFPostMethod	tif_postdecode;	/* post decoding routine */
+ /* tag support */
+ 	TIFFFieldInfo**	tif_fieldinfo;	/* sorted table of registered tags */
+-	int		tif_nfields;	/* # entries in registered tag table */
++	size_t		tif_nfields;	/* # entries in registered tag table */
++	const TIFFFieldInfo *tif_foundfield;/* cached pointer to already found tag */
+         TIFFTagMethods  tif_tagmethods; /* tag get/set/print routines */
+         TIFFClientInfoLink *tif_clientinfo; /* extra client information. */
+ };
+@@ -198,12 +222,15 @@
+ #endif
+ 
+ /* NB: the uint32 casts are to silence certain ANSI-C compilers */
+-#define	TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))
+-#define	TIFFroundup(x, y) (TIFFhowmany(x,y)*((uint32)(y)))
++#define TIFFhowmany(x, y) ((((uint32)(x))+(((uint32)(y))-1))/((uint32)(y)))
++#define TIFFhowmany8(x) (((x)&0x07)?((uint32)(x)>>3)+1:(uint32)(x)>>3)
++#define	TIFFroundup(x, y) (TIFFhowmany(x,y)*(y))
+ 
+ #define TIFFmax(A,B) ((A)>(B)?(A):(B))
+ #define TIFFmin(A,B) ((A)<(B)?(A):(B))
+ 
++#define TIFFArrayCount(a) (sizeof (a) / sizeof ((a)[0]))
++
+ #if defined(__cplusplus)
+ extern "C" {
+ #endif
+@@ -218,28 +245,34 @@
+ extern  int  _TIFFNoPreCode (TIFF*, tsample_t); 
+ extern	int _TIFFNoSeek(TIFF*, uint32);
+ extern	void _TIFFSwab16BitData(TIFF*, tidata_t, tsize_t);
++extern	void _TIFFSwab24BitData(TIFF*, tidata_t, tsize_t);
+ extern	void _TIFFSwab32BitData(TIFF*, tidata_t, tsize_t);
+ extern	void _TIFFSwab64BitData(TIFF*, tidata_t, tsize_t);
+ extern	int TIFFFlushData1(TIFF*);
+-extern	void TIFFFreeDirectory(TIFF*);
+ extern	int TIFFDefaultDirectory(TIFF*);
++extern	void _TIFFSetDefaultCompressionState(TIFF*);
+ extern	int TIFFSetCompressionScheme(TIFF*, int);
+ extern	int TIFFSetDefaultCompressionState(TIFF*);
+ extern	uint32 _TIFFDefaultStripSize(TIFF*, uint32);
+ extern	void _TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
++extern	int _TIFFDataSize(TIFFDataType);
+ 
+-extern	void _TIFFsetByteArray(void**, void*, long);
++extern	void _TIFFsetByteArray(void**, void*, uint32);
+ extern	void _TIFFsetString(char**, char*);
+-extern	void _TIFFsetShortArray(uint16**, uint16*, long);
+-extern	void _TIFFsetLongArray(uint32**, uint32*, long);
+-extern	void _TIFFsetFloatArray(float**, float*, long);
+-extern	void _TIFFsetDoubleArray(double**, double*, long);
++extern	void _TIFFsetShortArray(uint16**, uint16*, uint32);
++extern	void _TIFFsetLongArray(uint32**, uint32*, uint32);
++extern	void _TIFFsetFloatArray(float**, float*, uint32);
++extern	void _TIFFsetDoubleArray(double**, double*, uint32);
+ 
+ extern	void _TIFFprintAscii(FILE*, const char*);
+ extern	void _TIFFprintAsciiTag(FILE*, const char*, const char*);
+ 
+-GLOBALDATA(TIFFErrorHandler,_TIFFwarningHandler);
+-GLOBALDATA(TIFFErrorHandler,_TIFFerrorHandler);
++extern	TIFFErrorHandler _TIFFwarningHandler;
++extern	TIFFErrorHandler _TIFFerrorHandler;
++extern	TIFFErrorHandlerExt _TIFFwarningHandlerExt;
++extern	TIFFErrorHandlerExt _TIFFerrorHandlerExt;
++
++extern	tdata_t _TIFFCheckMalloc(TIFF*, size_t, size_t, const char*);
+ 
+ extern	int TIFFInitDumpMode(TIFF*, int);
+ #ifdef PACKBITS_SUPPORT
+@@ -286,3 +319,5 @@
+ }
+ #endif
+ #endif /* _TIFFIOP_ */
++
++/* vim: set ts=8 sts=8 sw=8 noet: */
+Index: libtk-img/libtiff/libtiff/tiffio.h
+========================================================================
+--- libtk-img.orig/libtiff/libtiff/tiffio.h
++++ libtk-img/libtiff/libtiff/tiffio.h
+@@ -19,8 +19,8 @@
+  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+- * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+- * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
++ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
++ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+  * OF THIS SOFTWARE.
+  */
+ 
+@@ -75,29 +75,29 @@
+  * On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
+  * or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
+  *
+- * By default tif_win32.c is assumed on windows if not using the cygwin
+- * environment.
++ * By default tif_unix.c is assumed.
+  */
+ 
+ #if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
+-#  if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILIO)
+-#    define USE_WIN32_FILEIO
++#  if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
++#    define AVOID_WIN32_FILEIO
+ #  endif
+ #endif
+ 
+ #if defined(USE_WIN32_FILEIO)
+-#include <windows.h>
+-#ifdef __WIN32__
++# define VC_EXTRALEAN
++# include <windows.h>
++# ifdef __WIN32__
+ DECLARE_HANDLE(thandle_t);	/* Win32 file handle */
+-#else
++# else
+ typedef	HFILE thandle_t;	/* client data handle */
+-#endif
++# endif /* __WIN32__ */
+ #else
+ typedef	void* thandle_t;	/* client data handle */
+-#endif
++#endif /* USE_WIN32_FILEIO */
+ 
+ #ifndef NULL
+-#define	NULL	0
++# define NULL	(void *)0
+ #endif
+ 
+ /*
+@@ -167,16 +167,6 @@
+ 	float	Yb2b[CIELABTORGB_TABLE_RANGE + 1];  /* Conversion of Yb to b */
+ } TIFFCIELabToRGB;
+ 
+-extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
+-extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
+-			    float *, float *, float *);
+-extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
+-			 uint32 *, uint32 *, uint32 *);
+-
+-extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
+-extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
+-			   uint32 *, uint32 *, uint32 *);
+-
+ /*
+  * RGBA-style image support.
+  */
+@@ -260,13 +250,14 @@
+ 
+ /* share internal LogLuv conversion routines? */
+ #ifndef LOGLUV_PUBLIC
+-#define LOGLUV_PUBLIC		1	
++#define LOGLUV_PUBLIC		1
+ #endif
+ 
+-#if defined(__cplusplus)
++#if defined(c_plusplus) || defined(__cplusplus)
+ extern "C" {
+ #endif
+ typedef	void (*TIFFErrorHandler)(const char*, const char*, va_list);
++typedef	void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
+ typedef	tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
+ typedef	toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
+ typedef	int (*TIFFCloseProc)(thandle_t);
+@@ -281,6 +272,11 @@
+ extern	TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
+ extern	void TIFFUnRegisterCODEC(TIFFCodec*);
+ extern  int TIFFIsCODECConfigured(uint16);
++extern	TIFFCodec* TIFFGetConfiguredCODECs(void);
++
++/*
++ * Auxiliary functions.
++ */
+ 
+ extern	tdata_t _TIFFmalloc(tsize_t);
+ extern	tdata_t _TIFFrealloc(tdata_t, tsize_t);
+@@ -289,6 +285,58 @@
+ extern	int _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);
+ extern	void _TIFFfree(tdata_t);
+ 
++/*
++** Stuff, related to tag handling and creating custom tags.
++*/
++extern  int  TIFFGetTagListCount( TIFF * );
++extern  ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );
++    
++#define	TIFF_ANY	TIFF_NOTYPE	/* for field descriptor searching */
++#define	TIFF_VARIABLE	-1		/* marker for variable length tags */
++#define	TIFF_SPP	-2		/* marker for SamplesPerPixel tags */
++#define	TIFF_VARIABLE2	-3		/* marker for uint32 var-length tags */
++
++#define FIELD_CUSTOM    65    
++
++typedef	struct {
++	ttag_t	field_tag;		/* field's tag */
++	short	field_readcount;	/* read count/TIFF_VARIABLE/TIFF_SPP */
++	short	field_writecount;	/* write count/TIFF_VARIABLE */
++	TIFFDataType field_type;	/* type of associated data */
++        unsigned short field_bit;	/* bit in fieldsset bit vector */
++	unsigned char field_oktochange;	/* if true, can change while writing */
++	unsigned char field_passcount;	/* if true, pass dir count on set */
++	char	*field_name;		/* ASCII name */
++} TIFFFieldInfo;
++
++typedef struct _TIFFTagValue {
++    const TIFFFieldInfo  *info;
++    int             count;
++    void           *value;
++} TIFFTagValue;
++
++extern	void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
++extern	const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
++extern  const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,
++						     TIFFDataType);
++extern	const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);
++extern	const TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);
++
++typedef	int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
++typedef	int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
++typedef	void (*TIFFPrintMethod)(TIFF*, FILE*, long);
++    
++typedef struct {
++    TIFFVSetMethod	vsetfield;	/* tag set routine */
++    TIFFVGetMethod	vgetfield;	/* tag get routine */
++    TIFFPrintMethod	printdir;	/* directory print routine */
++} TIFFTagMethods;
++        
++extern  TIFFTagMethods *TIFFAccessTagMethods( TIFF * );
++extern  void *TIFFGetClientInfo( TIFF *, const char * );
++extern  void TIFFSetClientInfo( TIFF *, void *, const char * );
++
++extern	void TIFFCleanup(TIFF*);
+ extern	void TIFFClose(TIFF*);
+ extern	int TIFFFlush(TIFF*);
+ extern	int TIFFFlushData(TIFF*);
+@@ -297,6 +345,9 @@
+ extern	int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);
+ extern	int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);
+ extern	int TIFFReadDirectory(TIFF*);
++extern	int TIFFReadCustomDirectory(TIFF*, toff_t, const TIFFFieldInfo[],
++				    size_t);
++extern	int TIFFReadEXIFDirectory(TIFF*, toff_t);
+ extern	tsize_t TIFFScanlineSize(TIFF*);
+ extern	tsize_t TIFFRasterScanlineSize(TIFF*);
+ extern	tsize_t TIFFStripSize(TIFF*);
+@@ -308,11 +359,23 @@
+ extern	uint32 TIFFDefaultStripSize(TIFF*, uint32);
+ extern	void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
+ extern	int TIFFFileno(TIFF*);
++extern  int TIFFSetFileno(TIFF*, int);
++extern  thandle_t TIFFClientdata(TIFF*);
++extern  thandle_t TIFFSetClientdata(TIFF*, thandle_t);
+ extern	int TIFFGetMode(TIFF*);
++extern	int TIFFSetMode(TIFF*, int);
+ extern	int TIFFIsTiled(TIFF*);
+ extern	int TIFFIsByteSwapped(TIFF*);
+ extern	int TIFFIsUpSampled(TIFF*);
+ extern	int TIFFIsMSB2LSB(TIFF*);
++extern	int TIFFIsBigEndian(TIFF*);
++extern	TIFFReadWriteProc TIFFGetReadProc(TIFF*);
++extern	TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
++extern	TIFFSeekProc TIFFGetSeekProc(TIFF*);
++extern	TIFFCloseProc TIFFGetCloseProc(TIFF*);
++extern	TIFFSizeProc TIFFGetSizeProc(TIFF*);
++extern	TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
++extern	TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
+ extern	uint32 TIFFCurrentRow(TIFF*);
+ extern	tdir_t TIFFCurrentDirectory(TIFF*);
+ extern	tdir_t TIFFNumberOfDirectories(TIFF*);
+@@ -323,6 +386,7 @@
+ extern	int TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);
+ extern	int TIFFSetupStrips(TIFF *);
+ extern  int TIFFWriteCheck(TIFF*, int, const char *);
++extern	void TIFFFreeDirectory(TIFF*);
+ extern  int TIFFCreateDirectory(TIFF*);
+ extern	int TIFFLastDirectory(TIFF*);
+ extern	int TIFFSetDirectory(TIFF*, tdir_t);
+@@ -357,6 +421,9 @@
+ extern	int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
+ extern	void TIFFRGBAImageEnd(TIFFRGBAImage*);
+ extern	TIFF* TIFFOpen(const char*, const char*);
++# ifdef __WIN32__
++extern	TIFF* TIFFOpenW(const wchar_t*, const char*);
++# endif /* __WIN32__ */
+ extern	TIFF* TIFFFdOpen(int, const char*, const char*);
+ extern	TIFF* TIFFClientOpen(const char*, const char*,
+ 	    thandle_t,
+@@ -365,10 +432,15 @@
+ 	    TIFFSizeProc,
+ 	    TIFFMapFileProc, TIFFUnmapFileProc);
+ extern	const char* TIFFFileName(TIFF*);
++extern	const char* TIFFSetFileName(TIFF*, const char *);
+ extern	void TIFFError(const char*, const char*, ...);
++extern	void TIFFErrorExt(thandle_t, const char*, const char*, ...);
+ extern	void TIFFWarning(const char*, const char*, ...);
++extern	void TIFFWarningExt(thandle_t, const char*, const char*, ...);
+ extern	TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
++extern	TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
+ extern	TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
++extern	TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
+ extern	TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
+ extern	ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);
+ extern	int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);
+@@ -393,6 +465,7 @@
+ extern	void TIFFSwabLong(uint32*);
+ extern	void TIFFSwabDouble(double*);
+ extern	void TIFFSwabArrayOfShort(uint16*, unsigned long);
++extern	void TIFFSwabArrayOfTriples(uint8*, unsigned long);
+ extern	void TIFFSwabArrayOfLong(uint32*, unsigned long);
+ extern	void TIFFSwabArrayOfDouble(double*, unsigned long);
+ extern	void TIFFReverseBits(unsigned char *, unsigned long);
+@@ -422,56 +495,21 @@
+ extern	uint32 LogLuv32fromXYZ(float*, int);
+ #endif
+ #endif /* LOGLUV_PUBLIC */
+-
+-/*
+-** New stuff going public in 3.6.x.
+-*/
+-extern  int  TIFFGetTagListCount( TIFF * );
+-extern  ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );
+     
+-#define	TIFF_ANY	TIFF_NOTYPE	/* for field descriptor searching */
+-#define	TIFF_VARIABLE	-1		/* marker for variable length tags */
+-#define	TIFF_SPP	-2		/* marker for SamplesPerPixel tags */
+-#define	TIFF_VARIABLE2	-3		/* marker for uint32 var-length tags */
+-
+-#define FIELD_CUSTOM    65    
+-
+-typedef	struct {
+-	ttag_t	field_tag;		/* field's tag */
+-	short	field_readcount;	/* read count/TIFF_VARIABLE/TIFF_SPP */
+-	short	field_writecount;	/* write count/TIFF_VARIABLE */
+-	TIFFDataType field_type;	/* type of associated data */
+-        unsigned short field_bit;	/* bit in fieldsset bit vector */
+-	unsigned char field_oktochange;	/* if true, can change while writing */
+-	unsigned char field_passcount;	/* if true, pass dir count on set */
+-	char	*field_name;		/* ASCII name */
+-} TIFFFieldInfo;
+-
+-typedef struct _TIFFTagValue {
+-    const TIFFFieldInfo  *info;
+-    int             count;
+-    void           *value;
+-} TIFFTagValue;
++extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
++extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
++			    float *, float *, float *);
++extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
++			 uint32 *, uint32 *, uint32 *);
+ 
+-extern	void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
+-extern	const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
+-extern	const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);
++extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
++extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
++			   uint32 *, uint32 *, uint32 *);
+ 
+-typedef	int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
+-typedef	int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
+-typedef	void (*TIFFPrintMethod)(TIFF*, FILE*, long);
+-    
+-typedef struct {
+-    TIFFVSetMethod	vsetfield;	/* tag set routine */
+-    TIFFVGetMethod	vgetfield;	/* tag get routine */
+-    TIFFPrintMethod	printdir;	/* directory print routine */
+-} TIFFTagMethods;
+-        
+-extern  TIFFTagMethods *TIFFAccessTagMethods( TIFF * );
+-extern  void *TIFFGetClientInfo( TIFF *, const char * );
+-extern  void TIFFSetClientInfo( TIFF *, void *, const char * );
+-    
+-#if defined(__cplusplus)
++#if defined(c_plusplus) || defined(__cplusplus)
+ }
+ #endif
++
+ #endif /* _TIFFIO_ */
++
++/* vim: set ts=8 sts=8 sw=8 noet: */
+Index: libtk-img/libtiff/libtiff/tif_config.h
+========================================================================
+--- libtk-img.orig/libtiff/libtiff/tif_config.h
++++ libtk-img/libtiff/libtiff/tif_config.h
+@@ -0,0 +1,246 @@
++/* libtiff/tif_config.h.  Generated by configure.  */
++/* libtiff/tif_config.h.in.  Generated from configure.ac by autoheader.  */
++
++/* Support CCITT Group 3 & 4 algorithms */
++#define CCITT_SUPPORT 1
++
++/* Pick up YCbCr subsampling info from the JPEG data stream to support files
++   lacking the tag (default enabled). */
++#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
++
++/* Support C++ stream API (requires C++ compiler) */
++#define CXX_SUPPORT 1
++
++/* Treat extra sample as alpha (default enabled). The RGBA interface will
++   treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
++   packages produce RGBA files but don't mark the alpha properly. */
++#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
++
++/* Use the Apple OpenGL framework. */
++/* #undef HAVE_APPLE_OPENGL_FRAMEWORK */
++
++/* Define to 1 if you have the <assert.h> header file. */
++#define HAVE_ASSERT_H 1
++
++/* Define to 1 if you have the <dlfcn.h> header file. */
++#define HAVE_DLFCN_H 1
++
++/* Define to 1 if you have the <fcntl.h> header file. */
++#define HAVE_FCNTL_H 1
++
++/* Define to 1 if you have the `floor' function. */
++#define HAVE_FLOOR 1
++
++/* Define to 1 if you have the `getopt' function. */
++#define HAVE_GETOPT 1
++
++/* Define as 0 or 1 according to the floating point format suported by the
++   machine */
++#define HAVE_IEEEFP 1
++
++/* Define to 1 if the system has the type `int16'. */
++/* #undef HAVE_INT16 */
++
++/* Define to 1 if the system has the type `int32'. */
++/* #undef HAVE_INT32 */
++
++/* Define to 1 if the system has the type `int8'. */
++/* #undef HAVE_INT8 */
++
++/* Define to 1 if you have the <inttypes.h> header file. */
++#define HAVE_INTTYPES_H 1
++
++/* Define to 1 if you have the `isascii' function. */
++#define HAVE_ISASCII 1
++
++/* Define to 1 if you have the `lfind' function. */
++#define HAVE_LFIND 1
++
++/* Define to 1 if you have the `c' library (-lc). */
++#define HAVE_LIBC 1
++
++/* Define to 1 if you have the `m' library (-lm). */
++#define HAVE_LIBM 1
++
++/* Define to 1 if you have the <limits.h> header file. */
++#define HAVE_LIMITS_H 1
++
++/* Define to 1 if you have the <malloc.h> header file. */
++#define HAVE_MALLOC_H 1
++
++/* Define to 1 if you have the `memmove' function. */
++#define HAVE_MEMMOVE 1
++
++/* Define to 1 if you have the <memory.h> header file. */
++#define HAVE_MEMORY_H 1
++
++/* Define to 1 if you have the `memset' function. */
++#define HAVE_MEMSET 1
++
++/* Define to 1 if you have the `mmap' function. */
++#define HAVE_MMAP 1
++
++/* Define to 1 if you have the `pow' function. */
++#define HAVE_POW 1
++
++/* Define if you have POSIX threads libraries and header files. */
++#define HAVE_PTHREAD 1
++
++/* Define to 1 if you have the <search.h> header file. */
++#define HAVE_SEARCH_H 1
++
++/* Define to 1 if you have the `sqrt' function. */
++#define HAVE_SQRT 1
++
++/* Define to 1 if you have the <stdint.h> header file. */
++#define HAVE_STDINT_H 1
++
++/* Define to 1 if you have the <stdlib.h> header file. */
++#define HAVE_STDLIB_H 1
++
++/* Define to 1 if you have the `strcasecmp' function. */
++#define HAVE_STRCASECMP 1
++
++/* Define to 1 if you have the `strchr' function. */
++#define HAVE_STRCHR 1
++
++/* Define to 1 if you have the <strings.h> header file. */
++#define HAVE_STRINGS_H 1
++
++/* Define to 1 if you have the <string.h> header file. */
++#define HAVE_STRING_H 1
++
++/* Define to 1 if you have the `strrchr' function. */
++#define HAVE_STRRCHR 1
++
++/* Define to 1 if you have the `strstr' function. */
++#define HAVE_STRSTR 1
++
++/* Define to 1 if you have the `strtol' function. */
++#define HAVE_STRTOL 1
++
++/* Define to 1 if you have the `strtoul' function. */
++#define HAVE_STRTOUL 1
++
++/* Define to 1 if you have the <sys/stat.h> header file. */
++#define HAVE_SYS_STAT_H 1
++
++/* Define to 1 if you have the <sys/time.h> header file. */
++#define HAVE_SYS_TIME_H 1
++
++/* Define to 1 if you have the <sys/types.h> header file. */
++#define HAVE_SYS_TYPES_H 1
++
++/* Define to 1 if you have the <unistd.h> header file. */
++#define HAVE_UNISTD_H 1
++
++/* Define to 1 if you have the <windows.h> header file. */
++/* #undef HAVE_WINDOWS_H */
++
++/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
++   (Intel) */
++#define HOST_BIGENDIAN 0
++
++/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
++#define HOST_FILLORDER FILLORDER_LSB2MSB
++
++/* Support JPEG compression (requires IJG JPEG library) */
++/* #undef JPEG_SUPPORT */
++
++/* Support LogLuv high dynamic range encoding */
++#define LOGLUV_SUPPORT 1
++
++/* Define to the sub-directory in which libtool stores uninstalled libraries.
++   */
++#define LT_OBJDIR ".libs/"
++
++/* Support LZW algorithm */
++#define LZW_SUPPORT 1
++
++/* Support Microsoft Document Imaging format */
++#define MDI_SUPPORT 1
++
++/* Support NeXT 2-bit RLE algorithm */
++#define NEXT_SUPPORT 1
++
++/* Define to 1 if your C compiler doesn't accept -c and -o together. */
++/* #undef NO_MINUS_C_MINUS_O */
++
++/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
++   fails with unpatched IJG JPEG library) */
++/* #undef OJPEG_SUPPORT */
++
++/* Name of package */
++#define PACKAGE "tiff"
++
++/* Support Macintosh PackBits algorithm */
++#define PACKBITS_SUPPORT 1
++
++/* Support Pixar log-format algorithm (requires Zlib) */
++/* #undef PIXARLOG_SUPPORT */
++
++/* Define to necessary symbol if this constant uses a non-standard name on
++   your system. */
++/* #undef PTHREAD_CREATE_JOINABLE */
++
++/* The size of a `int', as computed by sizeof. */
++#define SIZEOF_INT 4
++
++/* The size of a `long', as computed by sizeof. */
++#define SIZEOF_LONG 4
++
++/* Define to 1 if you have the ANSI C header files. */
++#define STDC_HEADERS 1
++
++/* Support strip chopping (whether or not to convert single-strip uncompressed
++   images to mutiple strips of specified size to reduce memory usage) */
++#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
++
++/* Default size of the strip in bytes (when strip chopping enabled) */
++#define STRIP_SIZE_DEFAULT 8192
++
++/* Enable SubIFD tag (330) support */
++#define SUBIFD_SUPPORT 1
++
++/* Support ThunderScan 4-bit RLE algorithm */
++#define THUNDER_SUPPORT 1
++
++/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
++#define TIME_WITH_SYS_TIME 1
++
++/* Define to 1 if your <sys/time.h> declares `struct tm'. */
++/* #undef TM_IN_SYS_TIME */
++
++/* Version number of package */
++#define VERSION "3.8.2"
++
++/* Define to 1 if your processor stores words with the most significant byte
++   first (like Motorola and SPARC, unlike Intel and VAX). */
++/* #undef WORDS_BIGENDIAN */
++
++/* Define to 1 if the X Window System is missing or not being used. */
++/* #undef X_DISPLAY_MISSING */
++
++/* Support Deflate compression */
++/* #undef ZIP_SUPPORT */
++
++/* Number of bits in a file offset, on hosts where this is settable. */
++#define _FILE_OFFSET_BITS 64
++
++/* Define for large files, on AIX-style hosts. */
++/* #undef _LARGE_FILES */
++
++/* Define to empty if `const' does not conform to ANSI C. */
++/* #undef const */
++
++/* Define to `__inline__' or `__inline' if that's what the C compiler
++   calls it, or to nothing if 'inline' is not supported under any name.  */
++#ifndef __cplusplus
++/* #undef inline */
++#endif
++
++/* Define to `long' if <sys/types.h> does not define. */
++/* #undef off_t */
++
++/* Define to `unsigned' if <sys/types.h> does not define. */
++/* #undef size_t */
+Index: libtk-img/libtiff/libtiff/tif_predict.h
+========================================================================
+--- libtk-img.orig/libtiff/libtiff/tif_predict.h
++++ libtk-img/libtiff/libtiff/tif_predict.h
+@@ -36,9 +36,9 @@
+  * the predictor code can cast tif_data to find its state.
+  */
+ typedef struct {
+-	int	predictor;		/* predictor tag value */
+-	int	stride;			/* sample stride over data */
+-	tsize_t	rowsize;		/* tile/strip row size */
++	int		predictor;	/* predictor tag value */
++	int		stride;		/* sample stride over data */
++	tsize_t		rowsize;	/* tile/strip row size */
+ 
+ 	TIFFPostMethod	pfunc;		/* horizontal differencer/accumulator */
+ 	TIFFCodeMethod	coderow;	/* parent codec encode/decode row */
+@@ -55,7 +55,10 @@
+ extern "C" {
+ #endif
+ extern	int TIFFPredictorInit(TIFF*);
++extern	int TIFFPredictorCleanup(TIFF*);
+ #if defined(__cplusplus)
+ }
+ #endif
+ #endif /* _TIFFPREDICT_ */
++
++/* vim: set ts=8 sts=8 sw=8 noet: */
+Index: libtk-img/libtiff/RELEASE-DATE
+========================================================================
+--- libtk-img.orig/libtiff/RELEASE-DATE
++++ libtk-img/libtiff/RELEASE-DATE
+@@ -1 +1 @@
+-12/26/2003
++20060323
+Index: libtk-img/libtiff/VERSION
+========================================================================
+--- libtk-img.orig/libtiff/VERSION
++++ libtk-img/libtiff/VERSION
+@@ -1 +1 @@
+-3.6.1
++3.8.2
--- libtk-img-1.3-release.orig/debian/patches/configure.diff
+++ libtk-img-1.3-release/debian/patches/configure.diff
@@ -0,0 +1,462 @@
+Index: libtk-img/base/configure
+========================================================================
+--- libtk-img.orig/base/configure
++++ libtk-img/base/configure
+@@ -3966,7 +3966,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4506,7 +4506,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/bmp/configure
+========================================================================
+--- libtk-img.orig/bmp/configure
++++ libtk-img/bmp/configure
+@@ -4122,7 +4122,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4662,7 +4662,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/gif/configure
+========================================================================
+--- libtk-img.orig/gif/configure
++++ libtk-img/gif/configure
+@@ -4121,7 +4121,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4661,7 +4661,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/ico/configure
+========================================================================
+--- libtk-img.orig/ico/configure
++++ libtk-img/ico/configure
+@@ -4121,7 +4121,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4661,7 +4661,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/jpeg/configure
+========================================================================
+--- libtk-img.orig/jpeg/configure
++++ libtk-img/jpeg/configure
+@@ -4270,7 +4270,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4810,7 +4810,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/libjpeg/tcl/configure
+========================================================================
+--- libtk-img.orig/libjpeg/tcl/configure
++++ libtk-img/libjpeg/tcl/configure
+@@ -3754,7 +3754,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4294,7 +4294,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/libpng/tcl/configure
+========================================================================
+--- libtk-img.orig/libpng/tcl/configure
++++ libtk-img/libpng/tcl/configure
+@@ -3897,7 +3897,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4437,7 +4437,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/libtiff/tcl/configure
+========================================================================
+--- libtk-img.orig/libtiff/tcl/configure
++++ libtk-img/libtiff/tcl/configure
+@@ -3862,7 +3862,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4402,7 +4402,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/libz/tcl/configure
+========================================================================
+--- libtk-img.orig/libz/tcl/configure
++++ libtk-img/libz/tcl/configure
+@@ -3752,7 +3752,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4292,7 +4292,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/pcx/configure
+========================================================================
+--- libtk-img.orig/pcx/configure
++++ libtk-img/pcx/configure
+@@ -4121,7 +4121,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4661,7 +4661,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/pixmap/configure
+========================================================================
+--- libtk-img.orig/pixmap/configure
++++ libtk-img/pixmap/configure
+@@ -4196,7 +4196,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4736,7 +4736,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/png/configure
+========================================================================
+--- libtk-img.orig/png/configure
++++ libtk-img/png/configure
+@@ -4418,7 +4418,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4958,7 +4958,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/ppm/configure
+========================================================================
+--- libtk-img.orig/ppm/configure
++++ libtk-img/ppm/configure
+@@ -4121,7 +4121,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4661,7 +4661,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/ps/configure
+========================================================================
+--- libtk-img.orig/ps/configure
++++ libtk-img/ps/configure
+@@ -4123,7 +4123,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4663,7 +4663,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/sgi/configure
+========================================================================
+--- libtk-img.orig/sgi/configure
++++ libtk-img/sgi/configure
+@@ -4121,7 +4121,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4661,7 +4661,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/sun/configure
+========================================================================
+--- libtk-img.orig/sun/configure
++++ libtk-img/sun/configure
+@@ -4121,7 +4121,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4661,7 +4661,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/tga/configure
+========================================================================
+--- libtk-img.orig/tga/configure
++++ libtk-img/tga/configure
+@@ -4121,7 +4121,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4661,7 +4661,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/tiff/configure
+========================================================================
+--- libtk-img.orig/tiff/configure
++++ libtk-img/tiff/configure
+@@ -4566,7 +4566,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -5106,7 +5106,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/window/configure
+========================================================================
+--- libtk-img.orig/window/configure
++++ libtk-img/window/configure
+@@ -4196,7 +4196,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4736,7 +4736,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/xbm/configure
+========================================================================
+--- libtk-img.orig/xbm/configure
++++ libtk-img/xbm/configure
+@@ -4121,7 +4121,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4661,7 +4661,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
+Index: libtk-img/xpm/configure
+========================================================================
+--- libtk-img.orig/xpm/configure
++++ libtk-img/xpm/configure
+@@ -4121,7 +4121,7 @@
+ 	    # results, and the version is kept in special file).
+ 	
+ 	    if test -r /etc/.relid -a "X`uname -n`" = "X`uname -s`" ; then
+-		system=MP-RAS-`awk '{print }' /etc/.relid'`
++		system=MP-RAS-`awk '{print }' /etc/.relid`
+ 	    fi
+ 	    if test "`uname -s`" = "AIX" ; then
+ 		system=AIX-`uname -v`.`uname -r`
+@@ -4661,7 +4661,7 @@
+ 	        fi
+ 	    fi
+ 	    ;;
+-	Linux*)
++	Linux*|GNU*)
+ 	    SHLIB_CFLAGS="-fPIC"
+ 	    SHLIB_LD_LIBS='${LIBS}'
+ 	    SHLIB_SUFFIX=".so"
--- libtk-img-1.3-release.orig/debian/patches/cve-2007-5378.patch
+++ libtk-img-1.3-release/debian/patches/cve-2007-5378.patch
@@ -0,0 +1,74 @@
+Patch by Nick Golde <nion@debian.org> (modified by Sergei Golovan) fixes
+vulnerability CVE-2007-5378 buffer overflow triggered by crafted GIF file.
+
+--- libtk-img-1.3-release.orig/gif/gif.c
++++ libtk-img-1.3-release/gif/gif.c
+@@ -235,7 +235,7 @@
+     int srcX, srcY;		/* Coordinates of top-left pixel to be used
+ 				 * in image being read. */
+ {
+-    int fileWidth, fileHeight;
++    int fileWidth, fileHeight, imageWidth, imageHeight;
+     int nBytes, index = 0, objc = 0;
+     Tcl_Obj **objv = NULL;
+     myblock bl;
+@@ -368,8 +368,8 @@
+ 	    goto error;
+ 	}
+ 
+-	fileWidth = LM_to_uint(buf[4],buf[5]);
+-	fileHeight = LM_to_uint(buf[6],buf[7]);
++	imageWidth = LM_to_uint(buf[4],buf[5]);
++	imageHeight = LM_to_uint(buf[6],buf[7]);
+ 
+ 	bitPixel = 2<<(buf[8]&0x07);
+ 
+@@ -405,8 +405,8 @@
+ 	     * marginally improve the speed of the less frequent case, I chose
+ 	     * to maintain high performance for the common case.
+ 	     */
+-	    if (ReadImage(interp, trashBuffer, handle, fileWidth,
+-			  fileHeight, colorMap, 0, 0, 0, 0, 0, -1) != TCL_OK) {
++	    if (ReadImage(interp, (char *) trashBuffer, handle, imageWidth,
++			  imageHeight, colorMap, 0, 0, 0, 0, 0, -1) != TCL_OK) {
+ 	      goto error;
+ 	    }
+ 	    continue;
+@@ -432,8 +432,8 @@
+ 	    srcX = 0;
+ 	}
+ 
+-	if (width > fileWidth) {
+-	    width = fileWidth;
++	if (width > imageWidth) {
++	    width = imageWidth;
+ 	}
+ 
+ 	index = LM_to_uint(buf[2],buf[3]);
+@@ -442,8 +442,8 @@
+ 	    destY -= srcY; height += srcY;
+ 	    srcY = 0;
+ 	}
+-	if (height > fileHeight) {
+-	    height = fileHeight;
++	if (height > imageHeight) {
++	    height = imageHeight;
+ 	}
+ 
+ 	if ((width <= 0) || (height <= 0)) {
+@@ -454,12 +454,12 @@
+ 	block.width = width;
+ 	block.height = height;
+ 	block.pixelSize = (transparent>=0)?4:3;
+-	block.pitch = block.pixelSize * fileWidth;
+-	nBytes = block.pitch * fileHeight;
++	block.pitch = block.pixelSize * imageWidth;
++	nBytes = block.pitch * imageHeight;
+ 	pixBuf = (unsigned char *) ckalloc((unsigned) nBytes);
+ 	block.pixelPtr = pixBuf;
+ 
+-	if (ReadImage(interp, (char *) block.pixelPtr, handle, fileWidth, fileHeight,
++	if (ReadImage(interp, (char *) block.pixelPtr, handle, imageWidth, imageHeight,
+ 		colorMap, fileWidth, fileHeight, srcX, srcY,
+ 		BitSet(buf[8], INTERLACE), transparent) != TCL_OK) {
+ 	    goto error;
--- libtk-img-1.3-release.orig/debian/patches/libz.diff
+++ libtk-img-1.3-release/debian/patches/libz.diff
@@ -0,0 +1,23 @@
+Patch enable dynamic linking to system-wide zlib.
+
+Index: libtk-img/libz/tcl/Makefile.in
+========================================================================
+--- libtk-img.orig/libz/tcl/Makefile.in
++++ libtk-img/libz/tcl/Makefile.in
+@@ -31,7 +31,6 @@
+ 		zlibtcl.c		\
+ 		zlibtclStubInit.c	\
+ 		zlibtclStubLib.c	\
+-		$(zlib_Sources)		\
+ 		@EXTRA_SOURCES@
+ 
+ WIN_SOURCES	= 
+@@ -187,7 +186,7 @@
+ CONFIG_CLEAN_FILES = Makefile zlibtclConfig.sh pkgIndex.tcl
+ 
+ CPPFLAGS	= @CPPFLAGS@ -DPACKAGE_NAME=\"$(PACKAGE)\"
+-LIBS		= @LIBS@
++LIBS		= @LIBS@ -lz
+ AR		= ar
+ CFLAGS		= @CFLAGS@
+ COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
--- libtk-img-1.3-release.orig/debian/patches/cve-2007-5137.patch
+++ libtk-img-1.3-release/debian/patches/cve-2007-5137.patch
@@ -0,0 +1,15 @@
+Patch by Nico Golde <nion@debian.org> (initially for Tk 8.3) fixes
+vulnerability CVE-2007-5137 arbitrary code execution via multi-frame
+interlaced GIF.
+
+--- tkimg1.3.orig/gif/gif.c
++++ tkimg1.3/gif/gif.c
+@@ -916,7 +916,7 @@
+ 	/* If interlacing, the next ypos is not just +1 */
+ 	if (interlace) {
+ 	    ypos += interlaceStep[pass];
+-	    while (ypos >= height) {
++	    while (ypos >= rows) {
+ 		pass++;
+ 		if (pass > 3) {
+ 		    return TCL_OK;
--- libtk-img-1.3-release.orig/debian/patches/series
+++ libtk-img-1.3-release/debian/patches/series
@@ -0,0 +1,11 @@
+configure.diff
+libz.diff
+libpng.diff
+libjpeg.diff
+libtiff.diff
+libtifftcl.diff
+tiff.diff
+demos.diff
+cve-2007-5378.patch
+cve-2007-5137.patch
+cve-2008-0553.patch
--- libtk-img-1.3-release.orig/debian/patches/libjpeg.diff
+++ libtk-img-1.3-release/debian/patches/libjpeg.diff
@@ -0,0 +1,38 @@
+Patch enable dynamic linking to system-wide libjpeg.
+
+Index: libtk-img/libjpeg/tcl/Makefile.in
+========================================================================
+--- libtk-img.orig/libjpeg/tcl/Makefile.in
++++ libtk-img/libjpeg/tcl/Makefile.in
+@@ -31,7 +31,6 @@
+ 		jpegtcl.c		\
+ 		jpegtclStubInit.c	\
+ 		jpegtclStubLib.c	\
+-		$(jpeg_Sources)		\
+ 		@EXTRA_SOURCES@
+ 
+ WIN_SOURCES	= 
+@@ -199,7 +198,7 @@
+ CONFIG_CLEAN_FILES = Makefile jpegtclConfig.sh pkgIndex.tcl libjpeg
+ 
+ CPPFLAGS	= @CPPFLAGS@ -DPACKAGE_NAME=\"$(PACKAGE)\"
+-LIBS		= @LIBS@
++LIBS		= @LIBS@ -ljpeg
+ AR		= ar
+ CFLAGS		= @CFLAGS@
+ COMPILE		= $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+Index: libtk-img/libjpeg/tcl/jpegtclDecls.h
+========================================================================
+--- libtk-img.orig/libjpeg/tcl/jpegtclDecls.h
++++ libtk-img/libjpeg/tcl/jpegtclDecls.h
+@@ -20,8 +20,8 @@
+ #undef EXTERN
+ 
+ #include <jpegtclDeclsMask.h>
+-#include <../jpeglib.h>
+-#include <../jerror.h>
++#include "/usr/include/jpeglib.h"
++#include "/usr/include/jerror.h"
+ #include <jpegtclDeclsUnmask.h>
+ 
+ /*
--- libtk-img-1.3-release.orig/debian/patches/tiff.diff
+++ libtk-img-1.3-release/debian/patches/tiff.diff
@@ -0,0 +1,317 @@
+Patch updates img::tiff package to version from SVN (it allows
+to use current libtiff4 package for linking.
+
+Index: libtk-img/tiff/tiffPixar.c
+========================================================================
+--- libtk-img.orig/tiff/tiffPixar.c
++++ libtk-img/tiff/tiffPixar.c
+@@ -697,15 +697,9 @@
+  * Setup state for decoding a strip.
+  */
+ static int
+-#ifdef _USING_PROTOTYPES_
+ PixarLogPreDecode (
+     TIFF* tif,
+     tsample_t s)
+-#else
+-PixarLogPreDecode(tif, s)
+-    TIFF* tif;
+-    tsample_t s;
+-#endif
+ {
+     PixarLogState* sp = DecoderState(tif);
+ 
+@@ -717,19 +711,11 @@
+ }
+ 
+ static int
+-#ifdef _USING_PROTOTYPES_
+ PixarLogDecode(
+     TIFF* tif,
+     tidata_t op,
+     tsize_t occ,
+     tsample_t s)
+-#else
+-PixarLogDecode(tif, op, occ, s)
+-    TIFF* tif;
+-    tidata_t op;
+-    tsize_t occ;
+-    tsample_t s;
+-#endif
+ {
+ 	TIFFDirectory *td = &tif->tif_dir;
+ 	PixarLogState* sp = DecoderState(tif);
+@@ -880,15 +866,9 @@
+  * Reset encoding state at the start of a strip.
+  */
+ static int
+-#ifdef _USING_PROTOTYPES_
+ PixarLogPreEncode (
+     TIFF* tif,
+     tsample_t s)
+-#else
+-PixarLogPreEncode(tif, s)
+-    TIFF* tif;
+-    tsample_t s;
+-#endif
+ {
+ 	PixarLogState *sp = EncoderState(tif);
+ 
+@@ -1077,19 +1057,11 @@
+  * Encode a chunk of pixels.
+  */
+ static	int
+-#ifdef _USING_PROTOTYPES_
+ PixarLogEncode(
+     TIFF* tif,
+     tidata_t bp,
+     tsize_t cc,
+     tsample_t s)
+-#else
+-PixarLogEncode(tif, bp, cc, s)
+-    TIFF* tif;
+-    tidata_t bp;
+-    tsize_t cc;
+-    tsample_t s;
+-#endif
+ {
+ 	TIFFDirectory *td = &tif->tif_dir;
+ 	PixarLogState *sp = EncoderState(tif);
+Index: libtk-img/tiff/tiffJpeg.c
+========================================================================
+--- libtk-img.orig/tiff/tiffJpeg.c
++++ libtk-img/tiff/tiffJpeg.c
+@@ -1,4 +1,4 @@
+-/* $Header: /cvsroot/tkimg/tkimg/tiff/tiffJpeg.c,v 1.2 2004/08/13 22:02:21 andreas_kupries Exp $ */
++/* $Header$ */
+ 
+ /*
+  * Copyright (c) 1994-1996 Sam Leffler
+@@ -225,8 +225,10 @@
+  * values per libtiff practice.
+  */
+ #define	CALLJPEG(sp, fail, op)	(SETJMP((sp)->exit_jmpbuf) ? (fail) : (op))
+-#define	CALLVJPEG(sp, op)	CALLJPEG(sp, 0, ((op),1))
+ 
++#define	CALLVJPEG(sp, op)	CALLJPEG(sp, 0, ((op),1))
++#undef  CALLVJPEG
++#define CALLVJPEG(sp, op)       (SETJMP((sp)->exit_jmpbuf) ? (0) : ((op),1))
+ 
+ static int
+ TIFFjpeg_create_compress(sp)
+@@ -728,15 +730,9 @@
+  */
+ 
+ static int
+-#ifdef _USING_PROTOTYPES_
+ JPEGPreDecode (
+     TIFF* tif,
+     tsample_t s)
+-#else
+-JPEGPreDecode(tif, s)
+-    TIFF* tif;
+-    tsample_t s;
+-#endif
+ {
+ 	JPEGState *sp = JState(tif);
+ 	TIFFDirectory *td = &tif->tif_dir;
+@@ -866,19 +862,11 @@
+  */
+ 
+ static int
+-#ifdef _USING_PROTOTYPES_
+ JPEGDecode (
+     TIFF* tif,
+     tidata_t buf,
+     tsize_t cc,
+     tsample_t s)
+-#else
+-JPEGDecode(tif, buf, cc, s)
+-    TIFF* tif;
+-    tidata_t buf;
+-    tsize_t cc;
+-    tsample_t s;
+-#endif
+ {
+ 	JPEGState *sp = JState(tif);
+ 	tsize_t nrows;
+@@ -911,19 +899,11 @@
+  */
+ 
+ static int
+-#ifdef _USING_PROTOTYPES_
+ JPEGDecodeRaw (
+     TIFF* tif,
+     tidata_t buf,
+     tsize_t cc,
+     tsample_t s)
+-#else
+-JPEGDecodeRaw(tif, buf, cc, s)
+-    TIFF* tif;
+-    tidata_t buf;
+-    tsize_t cc;
+-    tsample_t s;
+-#endif
+ {
+ 	JPEGState *sp = JState(tif);
+ 	JSAMPLE* inptr;
+@@ -1090,19 +1070,22 @@
+ 		 * default value is inappropriate for YCbCr.  Fill in the
+ 		 * proper value if application didn't set it.
+ 		 */
+-#ifdef COLORIMETRY_SUPPORT
+-		if (!TIFFFieldSet(tif, FIELD_REFBLACKWHITE)) {
+-			float refbw[6];
+-			long top = 1L << td->td_bitspersample;
+-			refbw[0] = 0;
+-			refbw[1] = (float)(top-1L);
+-			refbw[2] = (float)(top>>1);
+-			refbw[3] = refbw[1];
+-			refbw[4] = refbw[2];
+-			refbw[5] = refbw[1];
+-			TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE, refbw);
++		{
++			float *ref;
++			if (!TIFFGetField(tif, TIFFTAG_REFERENCEBLACKWHITE,
++					  &ref)) {
++				float refbw[6];
++				long top = 1L << td->td_bitspersample;
++				refbw[0] = 0;
++				refbw[1] = (float)(top-1L);
++				refbw[2] = (float)(top>>1);
++				refbw[3] = refbw[1];
++				refbw[4] = refbw[2];
++				refbw[5] = refbw[1];
++				TIFFSetField(tif, TIFFTAG_REFERENCEBLACKWHITE,
++					     refbw);
++			}
+ 		}
+-#endif
+ 		break;
+ 	case PHOTOMETRIC_PALETTE:		/* disallowed by Tech Note */
+ 	case PHOTOMETRIC_MASK:
+@@ -1178,15 +1161,9 @@
+  */
+ 
+ static int
+-#ifdef _USING_PROTOTYPES_
+ JPEGPreEncode (
+     TIFF* tif,
+     tsample_t s)
+-#else
+-JPEGPreEncode(tif, s)
+-    TIFF* tif;
+-    tsample_t s;
+-#endif
+ {
+ 	JPEGState *sp = JState(tif);
+ 	TIFFDirectory *td = &tif->tif_dir;
+Index: libtk-img/tiff/Makefile.in
+========================================================================
+--- libtk-img.orig/tiff/Makefile.in
++++ libtk-img/tiff/Makefile.in
+@@ -354,7 +354,8 @@
+ 	-e	's/@CPACKAGE@/Tkimgtiff/'		\
+ 	-e	's/%PACKAGE%/$(PACKAGE)/'		\
+ 	-e	"s/%PACKAGE_UP%/`echo $(PACKAGE)| tr 'a-z' 'A-Z'`/"		\
+-	-e	's/%PHIMGTYPE%/"$(PHIMGTYPE)"/'
++	-e	's/%PHIMGTYPE%/"$(PHIMGTYPE)"/' \
++	-e	's/VERSION/"@VERSION@"/'
+ 
+ #========================================================================
+ # Create the pkgIndex.tcl file.
+Index: libtk-img/tiff/tiffZip.c
+========================================================================
+--- libtk-img.orig/tiff/tiffZip.c
++++ libtk-img/tiff/tiffZip.c
+@@ -1,4 +1,4 @@
+-/* $Header: /cvsroot/tkimg/tkimg/tiff/tiffZip.c,v 1.2 2004/08/13 22:02:21 andreas_kupries Exp $ */
++/* $Header$ */
+ 
+ /*
+  * Copyright (c) 1995-1996 Sam Leffler
+@@ -104,15 +104,9 @@
+  */
+ 
+ static int
+-#ifdef _USING_PROTOTYPES_
+ ZIPPreDecode (
+     TIFF* tif,
+     tsample_t s)
+-#else
+-ZIPPreDecode(tif, s)
+-    TIFF* tif;
+-    tsample_t s;
+-#endif
+ {
+     ZIPState* sp = DecoderState(tif);
+ 
+@@ -124,19 +118,11 @@
+ }
+ 
+ static int
+-#ifdef _USING_PROTOTYPES_
+ ZIPDecode (
+     TIFF* tif,
+     tidata_t op,
+     tsize_t occ,
+     tsample_t s)
+-#else
+-ZIPDecode(tif, op, occ, s)
+-    TIFF* tif;
+-    tidata_t op;
+-    tsize_t occ;
+-    tsample_t s;
+-#endif
+ {
+     ZIPState* sp = DecoderState(tif);
+     static char module[] = "ZIPDecode";
+@@ -173,13 +159,8 @@
+ }
+ 
+ static int
+-#ifdef _USING_PROTOTYPES_
+ ZIPSetupEncode (
+     TIFF* tif)
+-#else
+-ZIPSetupEncode(tif)
+-    TIFF* tif;
+-#endif
+ {
+     ZIPState* sp = EncoderState(tif);
+     static char module[] = "ZIPSetupEncode";
+@@ -199,15 +180,9 @@
+  */
+ 
+ static int
+-#ifdef _USING_PROTOTYPES_
+ ZIPPreEncode (
+     TIFF* tif,
+     tsample_t s)
+-#else
+-ZIPPreEncode(tif, s)
+-    TIFF* tif;
+-    tsample_t s;
+-#endif
+ {
+     ZIPState *sp = EncoderState(tif);
+ 
+@@ -223,18 +198,10 @@
+  */
+ 
+ static int
+-#ifdef _USING_PROTOTYPES_
+ ZIPEncode (TIFF* tif,
+     tidata_t bp,
+     tsize_t cc,
+     tsample_t s)
+-#else
+-ZIPEncode(tif, bp, cc, s)
+-    TIFF* tif;
+-    tidata_t bp;
+-    tsize_t cc;
+-    tsample_t s;
+-#endif
+ {
+     ZIPState *sp = EncoderState(tif);
+     static char module[] = "ZIPEncode";
--- libtk-img-1.3-release.orig/debian/patches/demos.diff
+++ libtk-img-1.3-release/debian/patches/demos.diff
@@ -0,0 +1,39 @@
+Patch fixes demos.
+
+Index: libtk-img/demo/tkv.tcl
+========================================================================
+--- libtk-img.orig/demo/tkv.tcl
++++ libtk-img/demo/tkv.tcl
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+-# The next line restarts using wish8.3 \
+-exec wish8.3 $0 ${1+"$@"}
++# The next line restarts using wish \
++exec wish $0 ${1+"$@"}
+ 
+ source [file join [file dirname [info script]] imgmsg.tcl]
+ 
+Index: libtk-img/demo/demo.tcl
+========================================================================
+--- libtk-img.orig/demo/demo.tcl
++++ libtk-img/demo/demo.tcl
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+-# The next line restarts using wish8.3 \
+-exec wish8.3 $0 ${1+"$@"}
++# The next line restarts using wish \
++exec wish $0 ${1+"$@"}
+ 
+ source [file join [file dirname [info script]] imgmsg.tcl]
+ 
+@@ -31,8 +31,8 @@
+ 	}
+     }
+ }
+-button .f.b -text [mc "More tests"] -command run_more_tests
+-pack .f.b -side right
++#button .f.b -text [mc "More tests"] -command run_more_tests
++#pack .f.b -side right
+ pack .f -side top -expand y -fill both
+ message .m -aspect 900 -text [format [mc "This page shows the available\
+ image formats of the Img extension (version %s, using Tcl/Tk %s)"] $img_version $tcl_patchLevel]
