[DebianGIS-dev] r1081 - in packages/geotiff: . libgeotiff-dfsg libgeotiff-dfsg/branches libgeotiff-dfsg/branches/upstream libgeotiff-dfsg/branches/upstream/current libgeotiff-dfsg/branches/upstream/current/bin libgeotiff-dfsg/branches/upstream/current/docs libgeotiff-dfsg/branches/upstream/current/docs/api libgeotiff-dfsg/branches/upstream/current/libxtiff

frankie at alioth.debian.org frankie at alioth.debian.org
Wed Sep 19 11:46:09 UTC 2007


Author: frankie
Date: 2007-09-19 11:46:09 +0000 (Wed, 19 Sep 2007)
New Revision: 1081

Added:
   packages/geotiff/libgeotiff-dfsg/
   packages/geotiff/libgeotiff-dfsg/branches/
   packages/geotiff/libgeotiff-dfsg/branches/upstream/
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/.cvsignore
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/ChangeLog
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/Doxyfile
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/HOWTO-RELEASE
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/LICENSE
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/Makefile.in
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README.WIN
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README_BIN
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/aclocal.m4
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/.cvsignore
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/Makefile.in
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/csv2html.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/geotifcp.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/getopt.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/listgeo.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/makefile.mpw
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/makegeo.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/config.guess
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/config.sub
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/configure
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/configure.in
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/cpl_csv.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/cpl_csv_incode.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/cpl_serv.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/cpl_serv.h
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/defs.h
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/docs/
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/docs/api/
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/docs/api/.cvsignore
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/docs/geotifcp.html
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/docs/index.dox
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/docs/listgeo.html
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/docs/manual.txt
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/epsg_datum.inc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/epsg_ellipse.inc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/epsg_gcs.inc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/epsg_pcs.inc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/epsg_pm.inc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/epsg_proj.inc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/epsg_units.inc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/epsg_vertcs.inc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_config.h.in
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_config.h.vc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_ctrans.inc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_extra.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_free.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_get.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_keyp.h
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_names.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_new.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_normalize.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_normalize.h
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_print.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_set.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_tiffp.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_tiffp.h
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_trans.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geo_write.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geokeys.h
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geokeys.inc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geonames.h
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geotiff.h
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geotiff_proj4.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geotiffio.h
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/geovalues.h
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/install-sh
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/libtiff_private/
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/libxtiff/
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/libxtiff/xtiff.c
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/libxtiff/xtiffio.h
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/makefile.mpw
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/makefile.vc
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/mkbindist.sh
   packages/geotiff/libgeotiff-dfsg/branches/upstream/current/mkdist.sh
   packages/geotiff/libgeotiff-dfsg/tags/
Log:
[svn-inject] Installing original source of libgeotiff-dfsg

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/.cvsignore
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/.cvsignore	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/.cvsignore	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,13 @@
+config.log
+geo_config.h
+config.cache
+config.status
+Makefile
+*.lib
+*.ilk
+*.pdb
+*.exp
+*.dll
+libgeotiff-*.so
+libgeotiff.so*
+

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/ChangeLog
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/ChangeLog	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/ChangeLog	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,660 @@
+2007-07-28  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Issue libgeotiff 1.2.4 release.
+
+	* geo_normalize.c: Fix name for GCS_WGS_72 per gdal bug #1715.
+
+2007-07-20  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* csv/*.csv,*.c: Upgrade to EPSG 6.13.  Avoid applying pcs.override.csv
+	and gcs.override.csv to pcs.csv and gcs.csv as this sort of dataset
+	change is discouraged by the EPSG folks.
+
+	* geo_normalize.c: Pre-search pcs.override.csv and gcs.override.csv.
+
+	* cpl_csv_incode.c: Handle unexpected .csv files, and missing
+	records more gracefully.
+
+2007-06-05  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Modified GTIFGetUOMLengthInfo() (for normalization) to have
+	built in known values for foot and us survey foot.
+
+2007-03-13  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geotiff_proj4.c, geo_normalize.c: Added support for new zealand
+	map grid per http://bugzilla.remotesensing.org/show_bug.cgi?id=1519
+
+2007-02-04  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Makefile.in: Fix Progs dependency so parallel makes work properly.
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1475
+
+2006-12-18  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* bin/listgeo.c: Don't report hemispheres *and* signs when using -d.
+
+2006-11-11  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* xtiff.c, xtiffio.h: Made XTIFFInitialize() public so that 
+	applications can call it themselves when using alternate opens.
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1296
+
+2006-10-18  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Upgraded csv files to EPSG 6.11.1.
+
+2006-10-13  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Makefile.in: Avoid running configure or autoconf automatically.
+	It is nothing but heartache.
+
+2006-07-20  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* bin/Makefile.in: Fix prefix handling.
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=1245
+
+2006-06-26  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_new.c: If the ascii parameters list is too short for the declared
+	  size of an ascii parameter, but it doesn't start off the end of the
+          available string then just trim the length.  This is to make the
+          ESRI sample data file 34105h2.tif work properly.  I wish we had
+          a way of issuing warnings!
+
+==============================================================================
+
+2006-03-02  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Issuing libgeotif 1.2.3 release.
+
+2005-08-16  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Makefile.in: Include @C_PIC@ in CFLAGS so -fPIC will be used.
+
+2005-03-15  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_normalize.c: If a zero inverse flattening is encountered, 
+	interprete this as implying a semiminor axis equal to the semimajor.
+
+2005-03-03  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geotiff_proj4.c: added CT_CylindricalEqualArea support.
+
+	* geo_normalize.c: Added CT_CylindricalEqualArea support.
+
+	* geo_ctrans.c: added CT_CyldricalEqualArea.
+
+2005-02-16  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_normalize.c: check for ProjFalseOriginEastingGeoKey and
+	ProjFalseOriginNorthingGeoKey in GTIFFetchProjParms().  Otherwise
+	we miss the false easting/northing for LCC2SP when reading with
+	normalization.
+
+2004-12-16  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* aclocal.m4, Makefile.in: added MacOSX/Darwin related logic for
+	shared libraries.
+
+	* bin/Makefile.in: fixed problem in setting libdir.
+
+2004-12-01  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_normalize.c: GTIFGetGCSInfo() changed to work even if an 
+	illegal PM code encountered ... as long as pm info not requested.
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=698
+
+2004-11-21  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* configure.in: bug 649 - add LDFLAGS into LIBS, and ensure we
+	can link against libproj.so even if no libproj.a is provided.
+
+2004-10-19  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_print.c: fixed serious bug with reporting large numbers of
+	GCPs.  Patch from Oliver Colin (ESA). 
+
+2004-07-09  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_normalize.c: added 9122 as a simple degree alias in 
+	GTIFGetUOMAngleInfo().
+
+2004-06-07  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_normalize.c: fallback to using gdal_datum.csv if datum.csv 
+	not found.
+
+==============================================================================
+
+2004-04-30  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Prepare 1.2.2 release.
+
+2004-04-29  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* xtiffio.h: Avoid including cpl_serv.h, moved to geo_tiffp.h 
+	so that only libgeotiff code will end up seeing cpl_serv defines.
+
+2004-04-27  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_new.c, geo_write.c, geo_print.c: Make it possible to 
+	create a GTIF information object *without* an associated TIFF *. 
+
+2004-03-23  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* cpl_csv_incode.c: include dummy version on CPLReadParseLine().
+
+	* Reconvert the EPSG 6.5 files to C.
+
+	* Wrote csv/csv2c.py for converting .csv file to .c. 
+
+	* Capture EPSG 6.5 csv files.
+
+2003-10-21  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_print.c: fixed bug with long message text with embedded newlines
+	which happen to straddle the end of the message buffer when expanded
+	with escape characters.  (as reported by Leica - not in bugzilla).
+
+2003-09-23  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_print.c: fixed PrintKey() to work for constant names longer
+	than the message buffer.  
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=399
+
+2003-09-02  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_new.c: various hacks so that with improperly terminated ascii
+	parameters such as "34737 (0x87b1) ASCII (2) 9<Mercator\0>" will 
+	still work.  eg. 1164-0.tif
+
+2003-07-08  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_normalize.c, geo_print.c, geo_set.c, geo_tiffp.c, geo_trans.c, 
+	geo_write.c, geotiff_proj4.c: fix various warnings.
+
+==============================================================================
+
+2003-06-20  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* bin/Makefile.in: Removed the "prep" target for copying the geotiff
+	shared library ... not necessary with -L.. (I hope).
+
+	* configure.in: don't let -ltiff get added to LIBS multiple times. 
+
+	* Prepared 1.2.1 release
+
+2003-06-19  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_new.c: Fixed bug that can corrupt memory when an invalid 
+	GeoTIFF file with a zero length ascii parms strings is read (like 
+	bruce.tif).
+
+2003-06-03  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* bin/Makefile: added -L${libdir} before $(LIBS) per suggestion by
+	Tommy Andreassen.
+
+2003-02-25  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* bin/Makefile.in: Replace $< with the object file names.  Apparently
+	this makes the makefile be compatible with Sun's make.
+
+2003-01-28  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_normalize.c: Default dfInDegrees in GTIFAngleToDD().
+
+2003-01-26  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* bin/geotifcp.c: fixed bug if the metadata file specified does not
+	exist.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=258
+
+2003-01-20  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* cpl_csv_incode.c: fixed bug CSVGetField() which could cause
+	a crash if a missing record was requested.
+
+	* cpl_csv_incode.c, Makefile.in, csv/*: Reincorporated "incode"
+	support as per patches from Derrick. 
+
+	* cpl_serv.h: added #define for gtGetFileFieldId.
+
+	* cpl_csv.c: changed CSVFilename() to search for pcs.csv, not
+	horiz_cs.csv.
+	
+2003-01-19  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Makefile.in, bin/Makefile.in: added dist-clean target.
+
+==============================================================================
+
+2003-01-15  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Preparing 1.2.0 libgeotiff release.
+
+	* removed libtiff_private contents.
+
+	* geotiff.h: added LIBGEOTIFF_VERSION macro.
+
+	* geo_normalize.c/h: Added GTIFFreeMemory() for freeing memory
+	allocated by GTIF CSV lookup functions.  Added GTIFDeaccessCSV()
+	call for applications to force all CSV files to be de-cached.
+
+	* cpl_serv.h: renamed lots of CPL functions with gt prefixes using
+	macros. 
+
+2003-01-07  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* configure.in: fixed some stuff with last changes.  The --with-libtiff
+	option can now be used to give a base directory with libtiff installed
+	into /include and /lib directories under that.
+
+2003-01-02  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* configure.in: Remove logic to insert /usr/local/ in include and lib
+	path.  Remove configure switch for in-code EPSG tables since that 
+	option is broken for now.
+
+2002-12-01  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* cpl_csv.c: rewritten to support in memory caching of tables, and
+	fast searches. 
+
+	* geo_extra.c: tweaked to favor fixed EPSG codes for Kentucky North
+	(NAD83), and Tennesse (NAD27).  The original entries have incorrect
+	values. Also modified epsg_pcs.inc and epsg_proj.inc.
+
+	* geo_normalize.c: Major restructuring to use EPSG 6.2.2 database.
+
+2002-11-23  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_free.c: don't read past end of keys list. Introduced by 
+	changes from Rainer.
+
+	* geo_new.c: fix memory leak of tempData.tk_asciiParams.  Introduced
+	by changes from Rainer. 
+
+2002-09-27  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* libxtiff/{xtiff.c,xtiffio.h}: Added XTIFFClientOpen() function
+	as per supplied implementation from John Novak.
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=204
+
+	* geo_free.c, geo_names.c, geo_keyp.h, geo_new.c, geo_set.c, 
+	geo_write.c: Rainer Wiesenfarth (wiesi at ngi dot de) submitted
+	patches to support deletion, and changes to ascii tags.  To accomplish
+	this the ASCII tags are now allocated dynamically.  The
+	GTIFF_ASCIIPARAMS are split up when read, and recombined when written.
+
+2002-09-21  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_names.c: added support for VerticalUnitsGeoKey as per bug 203.
+
+2002-07-19  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* bin/listgeo.c: Added -d (report corners in decimal degrees) flag
+	to listgeo as submitted by Derrick Brashear. 
+
+2002-07-09  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geotiff_proj4.c: Fixed translation of polar stereographic to PROJ.4
+	as per http://bugzilla.remotesensing.org/show_bug.cgi?id=172.
+
+2002-06-18  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* cpl_csv.h, cpl_serv.h, cpl_csv.c, cpl_csv_incode.c, geo_normalize.c:
+	Removed the cpl_csv.h file, and merged it into cpl_serv.h.  Modified
+	all modules including cpl_csv.h to include cpl_serv.h instead.  This
+	is to avoid a conflict with the cpl_csv.h in GDAL.
+
+2002-05-31  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_print.c: modified to using backslash escaping for backslashes,
+	and newlines handle newlines in citations (as occur in Erdas generated
+	files, for instance).  Also resolved some problems with processing
+	long string values though very long strings will still blow up
+	GTIFImport().
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=139
+
+2002-02-25  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* configure.in: added setting of EXEEXT macro - allow .exe files on
+	Cygwin.
+
+	* libxtiff/xtiff.c: Rewrote to use new "custom field" interface to
+	libtiff (requires libtiff 3.6.x).   Removed xtiffiop.h.  No longer
+	a dependence on private libtiff include files.
+
+2002-02-12  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* configure.in, Makefile.in, bin/Makefile.in: extensive updates to
+	support building libgeotiff as a DLL on Cygwin.
+
+2002-02-11  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Added CSVDeaccess() stub ... submitted by Derrick Brashear.
+
+	* README: Fixed url.
+
+2002-02-04  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* configure.in: fixed up zip/jpeg arg so that --with-jpeg will work
+	as reported by Julien Demaria.
+
+2002-01-03  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Prepare 1.1.5 release.
+
+	* geo_normalize.c: call CSVDeaccess() at end of GTIFPrintDefn() so that
+	listgeo has closed all file handles by the end. 
+
+2001-11-28  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_trans.c: fixed memory leak of transform in GTIFPCSToImage()
+	as reported by Ng Lay Keow (Nicole).
+
+2001-07-09  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* cpl_serv.c: Another bug with pszRLBuffer being freed but not set
+	to NULL.  
+
+2001-06-28  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* cpl_csv_incode.c: Use EQUAL instead of strcasecmp() to ensure code 
+	builds on windows.  As per 
+
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=59
+
+2001-05-02  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_set.c: modified so that a count of -1 means to delete
+	the tag from the list.
+
+2001-04-17  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* geo_normalize.c: fixed memory leaks in GTIFGetDefn().
+
+	* cpl_serv.c: Fixed failure to set pointer to NULL when freeing
+	line buffer in CPLReadLine(). 
+
+	* geo_normalize.c: added support for reading custom ellipsoid 
+	definitions.
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=42
+
+2001-04-06  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* listgeo.c: added -i flag to report inverse transformation results,
+	testing the PCSToImage() function.  Not documented for user though.
+
+	* GTIFPCSToImage(): added support for inverting matrix transformations.
+
+	* Fixed GTIFGetDefn() to support custom ellipsoid definition.
+
+2001-03-04  Frank Warmerdam  <warmerdam at pobox.com>
+
+	Fixed various memory leaks bugs thanks to Alan Gray. 
+	
+	* GTIFGetDefn() now calls CSVDeaccess() to avoid memory/file leaks.
+
+	* Added docs/api, and related for Doxygen generated API docs.
+
+	* Fixed memory leaks in GTIFPrintDefn() (geo_normalize.c), and
+	GTIFImageToPCS(), GTIFPCSToImage() (geo_trans.c).  
+
+2001-03-01  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Added PCS_GGRS87_Greek_Grid for Dr. Irwin Scollar.
+
+2001-02-28  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Added PCS_HD72_EOV to epsg_pcs.inc, and added GCS_GGRS87 to 
+	epsg_gcs.inc at the request of Prof. Dr. Irwin Scollar. 
+
+2001-02-23  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Fixed GTIFPrintDefn() to use fprintf( fp ), instead of printf(), 
+	as per fixes from Alan Gray.
+
+2001-01-19  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Added tiffconf.h to libtiff_private.  Secretly reissue 1.1.4 source
+	release.
+
+2001-01-17  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Prepare 1.1.4 final release.
+
+	* Added README_BIN, and mkbindist.sh.
+
+	* Modified csv search code to include a search of 
+	share/epsg_csv and /usr/share/epsg_csv
+
+2001-01-02  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Added support for .tfw files with rotatational coefficents in
+	geotifcp.c.
+
+	* Updated README.WIN to mention VCVARS32.BAT.
+
+2000-12-28  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Prepare 1.1.4beta release.
+
+	* Added HOWTO-RELEASE file. 
+
+	* Removed getopt.h from geotifcp.c to build on windows.
+
+2000-12-12  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Fix geotifcp.c to avoid u_char problems, include getopt.h.
+
+	* Made configure use "-L... -llibname" for libproj and libtiff
+	so we will use the shared library when possible.
+
+	* Fixed up Makefile.in so it works if . is not in the path.
+
+	* Added CSV_DATA_DIR define to control where to look for csv files.
+
+	Todays fixes courtesy of Dave Johnson, ddj at cascv.brown.edu and 
+	are summarized in:
+	
+	http://bugzilla.remotesensing.org/show_bug.cgi?id=29
+
+2000-12-05  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Added cassini support in geotiff_proj4.c.
+
+	* modified geotiff_proj4.c to use +R_A to use spherical radius
+	of equal area, similar to other systems like GCTP for the
+	Miller Cylindrical and VanDerGrinten.  Should also do for any
+	other spherical projections as identified.
+
+2000-11-30  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Fixed Makefile.in to install all the .inc files with the include
+	files.
+
+2000-11-24  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Added configure/makefile logic to build a shared library, 
+	currently libgeotiff.so.1.1.5, and intall it with appropriate links.
+
+	* Modified configure to use --with-libtiff, and to ignore TIFF_HOME.
+	Now it is preferred to use an installed libtiff instead of one sitting
+	in a build directory.  
+
+	* Added libtiff_private directory with required libtiff include
+	files, to make it easier to build libgeotiff if only the standard
+	libtiff development environment was installed.
+
+2000-11-23  Frank Warmerdam  <warmerdam at pobox.com>
+
+	* Based loosely on suggestions from Curt Mills, I have reworked
+	the configure.in logic for PROJ.4.  I add -I/usr/local/include to 
+	CFLAGS and -L/usr/local/lib to LIBS right off the start so /usr/local
+	is included in the default search path.  The user no longer 
+	specifies the PROJ_HOME environment variable, and instead uses
+	the --with-proj configure switch.  Updated notes for building 
+	PROJ_HOME set in README.
+
+2000-10-13  Frank Warmerdam  <warmerda at cs46980-c>
+
+	* Added EquidistantConic support in PROJ.4 translation.
+
+	* Fixed order of parameters for LCC when read directly from a 
+	file to match that when read from EPSG tables.  This is now
+	always: 0-NatOriginLat, 1-NatOriginLong, 2-StdParallel1, 3-StdParallel2
+	This change is only in geo_normalize.c.
+
+2000-09-29  Frank Warmerdam  <warmerda at cs46980-c>
+
+	* Fixed bug in CPLReadLine() that primarily affects windows, and
+	SunOS 4.x.  Bug fix courtesy of shumilin at scanex.ru.
+
+2000-09-15  Frank Warmerdam  <warmerda at cs46980-c>
+
+	* Added the -proj4 option to listgeo to report it's selected
+	PROJ.4 string.
+
+	* Fixed order of parameters for LCC 2SP.  When parameters
+	were read from EPSG CSV files the standard parallels and origin
+	were mixed up.  This affects alot of state plane zones!
+
+==============================================================================
+
+2000-08-22  Frank Warmerdam  <warmerda at cs46980-c>
+
+	* Prepare 1.1.3 release.
+
+	* Added install target to makefile.  Defaults to /usr/local/...
+
+	* Added libjpeg to configure, and fixed up libjpeg/libz ordering.
+
+2000-08-21  Frank Warmerdam  <warmerda at cs46980-c>
+
+	* Removed the GTIFTiepointTranslate() code because it it badly
+	broken.
+
+2000-06-09    <warmerda at CS46980-B>
+
+	* Added knowledge of NAD27, NAD83, WGS72, WGS84, their datums,
+	  and ellipsoids. 
+
+2000-05-21  Frank Warmerdam  <warmerda at cs46980-c>
+
+	* Added -e option to geotifcp to intialize tiepoint+pixelscale
+	based on an ESRI world file. 
+
+==============================================================================
+
+Sun Feb 20 16:43:03 2000  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Prepare 1.1.2 release.
+
+Tue Jan  4 10:59:48 2000  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Fixed inclusion of geoparms in object file list at Derricks
+	  suggestion.
+
+	* Added --with-zip support to configure and makefiles at the 
+	  suggestion of Derrick Brashear.
+
+Fri Dec 10 13:24:21 1999  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Upgraded .csv and .c files to EPSG 4.4.
+
+	* Fixed bug setting the false northing for files with 
+	ProjCenterNorthingGeoKey set in GTIFGetDefn().
+
+	* Added "--with-incode-epsg" support to configure, added 
+	cpl_csv_incode.c and csv/*.c tables.
+
+Wed Sep 29 10:10:39 1999  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Upgraded CSV files to EPSG 4.3 from EPSG 4.2.  
+
+Fri Sep 17 10:53:52 1999  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Added ProjRectifiedGridAngleGeoKey(3096) and support for it's
+	  use with Oblique Mercator in geo_normalize.c.
+
+Thu Sep 16 17:22:55 1999  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Added support for pure tiepoints, and the transformation
+	matrix in GTIFImageToPCS(), and GTIFPCSToImage(). 
+
+Wed Sep 15 10:19:34 1999  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* CT_TransvMercator_SouthOriented now CT_TransvMercator_SouthOrientated
+	  to match EPSG.  SouthOriented name remains as an alias.
+
+	* Fixed serious bug in geo_normalize.c with translation of
+	DD.MMSSsss values.  Return value was seriously off if any 
+	fraction of a second was included in the string.
+
+Tue Sep  7 15:57:47 1999  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Fixed count/tiepoint_count mixup in GTIFPCSToImage().  Thanks
+	  to Eric Brown of Universal Systems.
+
+Mon Jul 12 12:56:51 1999  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Made scale a parameter of CT_Stereographic.
+
+	* geotifcp modified to copy existing geotiff information by default.
+
+==============================================================================
+
+Tue May  4 09:25:12 1999  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Prepared Version 1.1.1 release.
+
+Mon May  3 14:10:30 1999  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Added corner coordinate reporting to listgeo, and made full
+	  report the default.
+
+	* Added geo_trans.c with image<->PCS transformations.
+
+	* Fixed serious bug with parsing DMSmmsss.ss coordinates from
+	  CSV files which could make many results wrong.
+
+	* Cleaned up warnings with gcc -Wall, and IRIX native compiler. 
+
+	* Added support for -Wall for GCC in when running configure. This
+	also resulted in the addition of aclocal.m4 to the dist.
+
+Wed Apr 28 14:12:25 1999  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Added geo_extra.c, for special handling of UTM and state plane 
+	map systems. 
+
+	* Changed to have api help inline with the code, and extracted with 
+	doxygen.
+
+Thu Mar 25 23:25:22 1999  Frank Warmerdam  <warmerda at gdal.velocet.ca>
+
+	* Added ChangeLog and LICENSE file to distribution.
+
+March 18
+	
+	* Added support for PROJ.4 in configure.  Added cover functions
+	for Proj.4 in geotiff_proj.c, added lat/long reporting to listgeo.c. 
+
+
+==============================================================================
+
+-- 1.1.0a Release (circa March 10, 1999) --
+
+	* This release is considered alpha (not release) quality. 
+	
+	* Includes new CSV files, ``geo_normalize'' support, and a new
+	configure script (using autoconf). 
+
+-- 1.02 Release (1995 or so) 	

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/Doxyfile
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/Doxyfile	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/Doxyfile	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,255 @@
+# This file describes the settings to be used by doxygen for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# General configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of word surrounded
+# by quotes) that should identify the project. 
+
+PROJECT_NAME         =	libgeotiff
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER       =	
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY     =
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT          = docs/api
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT          =
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+
+HTML_HEADER          =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER          =
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each page. A value of NO (the default) enables the index and the
+# value YES disables it.
+
+DISABLE_INDEX        = NO
+
+# If the EXTRACT_ALL tag is set to YES all classes and functions will be
+# included in the documentation, even if no documentation was available.
+
+EXTRACT_ALL          = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE      = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members inside documented classes or files.
+
+HIDE_UNDOC_MEMBERS   = YES
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX       = NO
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output
+
+GENERATE_HTML        = YES
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the FULL_PATH_NAMES tag is set to YES Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used
+
+FULL_PATH_NAMES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag is used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT            =	. libxtiff/xtiff.c docs/index.dox
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+FILE_PATTERNS    =	*.h *.cpp *.c *.dox 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH     = .
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE        = NO
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output.
+
+INPUT_FILTER     = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor 
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed.
+
+MACRO_EXPANSION = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). In the former case 1 is used as the
+# definition.
+
+PREDEFINED =
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED tag.
+
+EXPAND_ONLY_PREDEF = NO
+
+#---------------------------------------------------------------------------
+# Configuration options related to external references 
+#---------------------------------------------------------------------------
+
+# The TAGFILES tag can be used to specify one or more tagfiles. 
+
+TAGFILES         =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS     = NO
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH        = /usr/local/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the search engine 
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE     = NO
+
+# The CGI_NAME tag should be the name of the CGI script that
+# starts the search engine (doxysearch) with the correct parameters.
+# A script with this name will be generated by doxygen.
+
+CGI_NAME         = search.cgi
+
+# The CGI_URL tag should be the absolute URL to the directory where the
+# cgi binaries are located. See the documentation of your http daemon for 
+# details.
+
+CGI_URL          =
+
+# The DOC_URL tag should be the absolute URL to the directory where the
+# documentation is located. If left blank the absolute path to the 
+# documentation, with file:// prepended to it, will be used.
+
+DOC_URL          =
+
+# The DOC_ABSPATH tag should be the absolute path to the directory where the
+# documentation is located. If left blank the directory on the local machine
+# will be used.
+
+DOC_ABSPATH      =
+
+# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
+# is installed.
+
+BIN_ABSPATH      = /usr/local/bin/
+
+# The EXT_DOC_PATHS tag can be used to specify one or more paths to 
+# documentation generated for other projects. This allows doxysearch to search
+# the documentation for these projects as well.
+
+EXT_DOC_PATHS    =

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/HOWTO-RELEASE
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/HOWTO-RELEASE	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/HOWTO-RELEASE	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,42 @@
+	Preparing a libgeotiff Release
+	==============================
+
+ 1) Update the VERSION_MAJOR/MINOR/POINT information in configure.in.
+
+ 2) Update the LIBGEOTIFF_VERSION macro in geotiff.h.
+
+ 3) Add a note to the ChangeLog that a new release is being issued, and what
+    the release number is.
+
+ 4) Tag the release with a command like "cvs tag libgeotiff_1_1_4" from the
+    libgeotiff directory.
+
+ 5) Prepare a zip and tar.gz file using a command like "mkdist.sh 1.1.5" 
+    from within the geotiff/libgeotiff directory. 
+
+ 6) Test build and install on at least one Unix platform.  Test build on a
+    Windows system.
+
+ 7) The resulting files (eg. libgeotiff-1.1.5.tar.gz and libgeotiff115.zip) 
+    should be copied to the distribution directory (geotiff/libgeotiff on 
+    ftp.remotesensing.org).  Update the README file in that directory to 
+    indicate the new current release.
+
+ 8) Build binary distributions of libgeotiff, and utilities for various
+    Unix platforms (usually Linux, Solaris and IRIX).  This can be accomplished
+    using a command like "mkbindist.sh 1.1.5 linux -install".  The -install
+    option only works if you have scp locally, and a matching account on 
+    remotesensing.org.
+
+ 9) Build binary distribution for Windows.  Normally prepared by downloading
+    the last distribution, and overlaying the most recent .exe files, and 
+    csv files over the ones from the last distribution, and renaming things
+    based on the version number.
+
+10) Announce on GeoTIFF mailing list: geotiff at lists.maptools.org
+    Include a summary of the ChangeLog items for the most recent release.
+
+11) Update entry at http://www.freshmeat.net/projects/libgeotiff
+
+12) Update html/geotiff.html to point to most recent release, including
+    the most recent release version number.

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/LICENSE
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/LICENSE	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/LICENSE	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,83 @@
+
+	libgeotiff Licensing
+	====================
+
+All the source code in this toolkit are either in the public domain, or under 
+an X style license.  In any event it is all considered to be free to use
+for any purpose (including commercial software).  No credit is required 
+though some of the code requires that the specific source code modules 
+retain their existing copyright statements.  The CSV files, and other tables
+derived from the EPSG coordinate system database are also free to use.  In 
+particular, no part of this code is "copyleft", nor does it imply any 
+requirement for users to disclose this or their own source code.
+
+All components not carrying their own copyright message, but distributed
+with libgeotiff should be considered to be under the same license as
+Niles' code.
+
+---------
+
+Code by Frank Warmerdam has this copyright notice (directly copied from
+X Consortium licence):
+
+ * Copyright (c) 1999, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+
+-----------
+
+Code by Niles Ritter is under this licence:
+
+ *    Written By: Niles D. Ritter.
+ *
+ *  copyright (c) 1995   Niles D. Ritter
+ *
+ *  Permission granted to use this software, so long as this copyright
+ *  notice accompanies any products derived therefrom.
+
+-----------
+
+The EPSG Tables (from which the CSV files, and .inc files are derived)
+carried this statement on use of the data (from the EPSG web site):
+
+  Use of the Data 
+
+  The user assumes the entire risk as to the accuracy and the use of this 
+  data. The data may be copied and distributed subject to the following 
+  conditions: 
+
+      1.All data pertinent to a specific coordinate system must be copied 
+        without modification and all related pages must be included; 
+
+      2.All components of this data set pertinent to any given coordinate 
+        system must be distributed together (complete distribution of all 
+        components of the data set is preferred, but the EPSG recognises 
+        the need for a more limited distribution); 
+
+      3.The data may not be distributed for profit by any third party; and 
+      4.The original source [EPSG] must be acknowledged.
+
+      INFORMATION PROVIDED IN THIS DOCUMENT IS PROVIDED "AS
+      IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
+      IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+      WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
+      PARTICULAR PURPOSE. 
+
+
+

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/Makefile.in
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/Makefile.in	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/Makefile.in	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,214 @@
+#
+# GeoTIFF Library source for Makefile
+#
+DEPTH   = .
+
+SRCDIR  = ${DEPTH}
+
+#
+SHELL   = /bin/sh
+NULL    =
+CD      = cd
+CC      = @CC@
+AR      = ar
+LN      = @LN_S@
+AROPTS  = r
+RANLIB  = @RANLIB@
+INSTALL = @INSTALL@
+RM      = rm -f
+MAKE    = make
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir	= @bindir@
+libdir	= @libdir@
+includedir = @includedir@
+datadir = @datadir@/epsg_csv
+
+BIN=${SRCDIR}/bin
+LIB_XTIFF=${SRCDIR}/libxtiff
+XTIFF=xtiff.o
+XTIFFINC= xtiffio.h
+EXEEXT=@EXEEXT@
+
+VERSION_MAJOR	=	@VERSION_MAJOR@
+VERSION_MINOR	=	@VERSION_MINOR@
+VERSION_POINT	=	@VERSION_POINT@
+
+LIBS=   @LIBS@
+GEOTIFF_SO=@GEOTIFF_SO@
+GEOTIFF_DLL=@GEOTIFF_DLL@
+GEOTIFF_IMP=@GEOTIFF_IMP@
+LD_SHARED=@LD_SHARED@
+SO_EXT=@SO_EXT@
+
+GT_INCLUDE_FILES = xtiffio.h geotiff.h geotiffio.h geovalues.h \
+	geonames.h geokeys.h geo_tiffp.h geo_config.h geo_keyp.h \
+	geo_normalize.h cpl_serv.h \
+	epsg_datum.inc epsg_gcs.inc epsg_pm.inc epsg_units.inc geo_ctrans.inc\
+	epsg_ellipse.inc epsg_pcs.inc epsg_proj.inc epsg_vertcs.inc geokeys.inc
+
+
+#
+IPATH   = -I. -I${SRCDIR} @TIFF_INC@ @PROJ_INC@
+#
+CONF_LIBRARY=\
+	${NULL}
+COPTS	= @CFLAGS@ @C_PIC@ -DCSV_DATA_DIR=\"$(datadir)\"
+CFLAGS  = ${COPTS} ${IPATH} ${CONF_LIBRARY}
+#
+SRCS    = \
+	${NULL}
+CORE_OBJS    = \
+	${XTIFF} \
+	geo_free.o \
+	geo_get.o \
+	geo_names.o \
+	geo_new.o \
+	geo_print.o \
+	geo_set.o \
+	geo_tiffp.o \
+	geo_write.o \
+	geo_trans.o \
+	geo_normalize.o \
+	geotiff_proj4.o \
+	geo_extra.o \
+	cpl_serv.o \
+	${NULL}
+
+CSV_INCODE_OBJS = \
+	cpl_csv_incode.o \
+	csv/pcs.o \
+	csv/gcs.o \
+	csv/ellipsoid.o \
+	csv/prime_meridian.o \
+	csv/datum.o \
+	csv/unit_of_measure.o \
+	csv/projop_wparm.o
+
+CSV_FILE_OBJS = \
+	cpl_csv.o
+
+# CSV_SOURCE can be either $(CSV_FILE_OBJS) or $(CSV_INCODE_OBJS)
+OBJS  =	$(CORE_OBJS) @CSV_SOURCE@
+
+TARGETS = libgeotiff.a
+
+all:    Makefile ${TARGETS} ${GEOTIFF_SO} Progs
+
+libgeotiff.a: ${OBJS}
+	${AR} ${AROPTS} libgeotiff.a $?
+	${RANLIB} libgeotiff.a
+
+$(GEOTIFF_SO): ${OBJS}
+	${LD_SHARED} ${OBJS} ${LIBS} -o $(GEOTIFF_SO)
+	rm -f libgeotiff.$(SO_EXT)
+	${LN} $(GEOTIFF_SO) libgeotiff.$(SO_EXT)
+
+Progs:	$(GEOTIFF_SO)
+	${CD} ${BIN};\
+	${MAKE}
+
+${OBJS}: ${SRCDIR}/geotiff.h ${SRCDIR}/geotiffio.h ${SRCDIR}/geo_config.h
+
+${XTIFFINC}:
+	${RM} ${XTIFFINC}
+	${LN} ${LIB_XTIFF}/*.h .
+
+${XTIFF}: ${LIB_XTIFF}/xtiff.c  ${XTIFFINC}
+	${CC} -c ${CFLAGS}  ${LIB_XTIFF}/xtiff.c
+
+geo_free.o: ${SRCDIR}/geo_free.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geo_free.c
+
+geo_get.o: ${SRCDIR}/geo_get.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geo_get.c
+
+geo_names.o: ${SRCDIR}/geo_names.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geo_names.c
+
+geo_new.o: ${SRCDIR}/geo_new.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geo_new.c
+
+geo_print.o: ${SRCDIR}/geo_print.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geo_print.c
+
+geo_set.o: ${SRCDIR}/geo_set.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geo_set.c
+
+geo_tiffp.o: ${SRCDIR}/geo_tiffp.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geo_tiffp.c
+
+geo_write.o: ${SRCDIR}/geo_write.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geo_write.c
+
+geo_trans.o: ${SRCDIR}/geo_trans.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geo_trans.c
+
+geo_normalize.o: ${SRCDIR}/geo_normalize.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geo_normalize.c
+
+geo_extra.o: ${SRCDIR}/geo_extra.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geo_extra.c
+
+cpl_csv.o: ${SRCDIR}/cpl_csv.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/cpl_csv.c
+
+cpl_serv.o: ${SRCDIR}/cpl_serv.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/cpl_serv.c
+
+geotiff_proj4.o: ${SRCDIR}/geotiff_proj4.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/geotiff_proj4.c
+
+${SRCDIR}/csv/%.o:	${SRCDIR}/csv/%.c
+	${CC} -c ${CFLAGS} ${SRCDIR}/csv/$*.c -o ${SRCDIR}/csv/$*.o
+
+clean:
+	(cd bin; $(MAKE) clean)
+	rm -f ${TARGETS} ${OBJS} ${XTIFFINC} core a.out libgeotiff.$(SO_EXT)*
+	rm -f ${GEOTIFF_IMP} ${GEOTIFF_SO}
+
+dist-clean: clean
+	(cd bin; $(MAKE) dist-clean)
+	rm -rf config.log config.status config.cache geo_config.h
+	rm -f Makefile
+
+geo_config.h: geo_config.h.in config.status
+	./config.status
+	touch geo_config.h
+
+Makefile:	Makefile.in config.status
+	./config.status
+
+dox:
+	doxygen
+	if test -d ../../geotiff-ht/api ; then \
+	  cp docs/api/*.* ../../geotiff-ht/api; \
+	  cp docs/*.html ../../geotiff-ht; \
+	fi
+
+install:
+	$(INSTALL) -d $(DESTDIR)$(libdir)
+	$(INSTALL) libgeotiff.a $(GEOTIFF_IMP) $(DESTDIR)${libdir}
+	$(INSTALL) -d $(DESTDIR)$(includedir)
+	$(INSTALL) $(GT_INCLUDE_FILES) $(DESTDIR)$(includedir)
+	$(INSTALL) -d $(DESTDIR)$(datadir)
+	$(INSTALL) csv/*.csv $(DESTDIR)$(datadir)
+	$(INSTALL) -d $(DESTDIR)$(bindir)
+	$(INSTALL) bin/listgeo$(EXEEXT) bin/geotifcp$(EXEEXT) $(DESTDIR)$(bindir)
+	if test ! -z "$(GEOTIFF_SO)" ; then \
+		if test ! -z "$(GEOTIFF_DLL)" ; then \
+			$(INSTALL) $(GEOTIFF_SO) $(DESTDIR)${bindir}; \
+		else \
+			$(INSTALL) $(GEOTIFF_SO) $(DESTDIR)${libdir}; \
+			(cd $(DESTDIR)${libdir} ; \
+			rm -f libgeotiff.$(SO_EXT).$(VERSION_MAJOR).$(VERSION_MINOR); \
+			${LN} $(GEOTIFF_SO) libgeotiff.$(SO_EXT).$(VERSION_MAJOR).$(VERSION_MINOR); \
+			rm -f libgeotiff.$(SO_EXT).$(VERSION_MAJOR); \
+			${LN} libgeotiff.$(SO_EXT).$(VERSION_MAJOR).$(VERSION_MINOR) \
+			libgeotiff.$(SO_EXT).$(VERSION_MAJOR); \
+			rm -f libgeotiff.$(SO_EXT); \
+			${LN} libgeotiff.$(SO_EXT).$(VERSION_MAJOR) libgeotiff.$(SO_EXT); );\
+		fi;\
+	fi
+
+

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,192 @@
+About LIBGEOTIFF:
+-----------------
+
+This library is designed to permit the extraction and parsing of the
+"GeoTIFF" Key directories, as well as definition and installation
+of GeoTIFF keys in new files. For more information about GeoTIFF
+specifications, projection codes and use, see the WWW web page at:
+
+   http://www.remotesensing.org/geotiff/geotiff.html
+
+or at:
+
+   http://www.geotiff.org/
+   
+or the FTP archive at:
+
+   ftp://ftp.remotesensing.org/pub/geotiff
+
+or the older FTP archive at:
+
+   ftp://ftpmcmc.cr.usgs.gov/release/geotiff/jpl_mirror/
+
+
+Use of LIBTIFF
+--------------
+
+The default configuration assumes that the public-domain LIBTIFF
+package for reading and writing TIFF files has been installed, with
+the development kit (include files).  The latest version of libtiff may 
+be found at:
+
+   http://www.libtiff.org/
+   
+For this build to work you must use libtiff version v3.6.0 alpha or newer.
+
+
+Building LIBGEOTIFF:
+--------------------
+
+Assuming that whatever TIFF library you use has been built, and installed
+may now build the rest of the geotiff library with:
+
+   % cd libgeotiff
+   % ./configure
+   % make 
+
+Common Configuration Issues:
+
+ o If you want to alter the compiler used, set the CC environment variable
+   before running configure.  
+
+   % setenv CC cc
+   % rm config.status
+   % ./configure
+   % make clean 
+   % make 
+
+ o If you want to control the compiler files, set the CFLAGS environment 
+   variable.  This can be used to override the default optimization/debug
+   flags for instance.
+
+   % setenv CFLAGS -O4
+   % rm config.status
+   % ./configure
+   % make clean 
+   % make
+
+ o If you want to force use of a locally built libtiff that was never 
+   "installed" you can point to the directory like this:
+
+   % rm config.status
+   % ./configure --with-libtiff=/u/contrib/libtiff-3.6.0/libtiff
+   % make clean 
+   % make
+
+ o If you have installed libtiff in a location other than /usr, then you can
+   point to the install tree like this:
+
+   % rm config.status
+   % ./configure --with-libtiff=/usr/local
+   % make clean 
+   % make
+
+ o If you want to use EPSG tables compiled into the code, use the
+   --enable-incode-epsg configure switch.  It will make the library and
+   resulting executables substantially larger (~600K), but will avoid any 
+   configuration issues with finding the .csv files. 
+
+   % rm config.status
+   % ./configure --enable-incode-epsg
+   % make clean
+   % make
+
+ o If you want to build in support for the PROJ.4 library, so that listgeo
+   can report corner coordinates in lat/long, it may be necessary to 
+   specify the directory containing the libproj include files, and library.
+   (PROJ.4 can also be disabled by passing --without-proj).  PROJ.4 info 
+   can be found at http://www.remotesensing.org/proj .
+
+   % rm config.status
+   % ./configure --with-proj=/contrib/proj-4.4.1
+   % make clean
+   % make
+
+ o The logic to build shared libraries is pretty weak, and is likely to
+   only work on systems with the GNU tool chain (gcc, and ld) installed. 
+   On other systems you can try hacking on Makefile after running configure.
+   It may be necessary to set the GEOTIFF_SO macro to "libgeotiff.1.2.x"
+   as it is made empty by default on systems configure doesn't think can 
+   build shared libraries.
+
+
+Test Programs:
+
+There are two demonstration test programs "makegeo" and "listgeo"
+that create and list-out the GeoTIFF tags and keys associated 
+with a small TIFF file, as well as a full-featured utility called
+"geotifcp". These will all be built in the bin/ directory as a matter of 
+course, though may require modification if you are not using LIBTIFF, as they
+make explicit calls to LIBTIFF for opening the files and setting the
+tags. To run them simply call:
+
+  % bin/makegeo
+  % bin/listgeo newgeo.tif
+
+to generate and list an example GeoTIFF file. To see the
+"geotifcp" utility in action, first call:
+
+  %  bin/listgeo newgeo.tif > metadata.txt
+ 
+to create a GeoTIFF metadata file "metadata.txt", and then
+
+  %  bin/geotifcp  -g  metadata.txt  newgeo.tif  newer.tif
+ 
+to copy the TIFF file newgeo.tif to newer.tif, using the
+GeoTIFF metadata as stored in "metadata.txt". See "docs/manual.txt"
+for further uses of geotifcp.
+
+To use the new normalization capability of listgeo, the program needs
+to be able to find the CSV files.  Use something like the following, 
+but indicating the correct path to the CSV directory (libgeotiff/csv). 
+
+  % bin/listgeo -t csv -norm newgeo.tif
+
+To convert a projection metafile, an ESRI world file, and a raw TIFF file
+into a GeoTIFF file do something like the following:
+
+  % bin/tiffcp -g metadata.txt -e abc.tfw abc.tif geo_abc.tif
+
+
+ 
+Non-Standard Configuration:
+---------------------------
+
+If you are using a TIFF software package other than libtiff, then you
+must override the TIFF file methods used in LIBGEOTIFF. To do this, 
+go into directory libgeotiff and edit the files:
+
+    "geo_tiffp.h"
+    "geo_tiffp.c"
+    
+which contain all of the TIFF externals. You will need to define your
+own versions of the TIFF tag reading, writing, and memory allocation
+calls. See the comments of those two files to see what needs to be
+changed. Also, whatever software package you use will have to 
+recognize the GeoTIFF tags listed in the include files, and permit
+variable-length arrays to be passed in to those tags.
+
+
+Credits
+-------
+
+ o This library was originally written by Niles Ritter (also the primary
+   author of the GeoTIFF specification).  
+
+ o It is currently being maintained by Frank Warmerdam (warmerdam at pobox.com),
+   who also added the "normalization" capability of GTIFGetDefn() using 
+   EPSG CSV files. 
+
+ o Support for "incode" CSV files was submitted by Derrick J Brashear 
+   <shadow at dementia.org>. 
+
+ o Eric Brown of Universal Systems, who contributed a bug fix to 
+   GTIFPCSToImage().
+
+ o Safe Software (www.safe.com) who supported by upgrade to use the 
+   EPSG 6.2.2 database for libgeotiff 1.2.0.
+
+ o Many others who contributed before it occured to me to maintain credits.
+
+
+

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README.WIN
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README.WIN	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README.WIN	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,17 @@
+    Windows Build
+    -------------
+
+Most of the notes in the README apply on Windows as well; however, to 
+configure and build follow the following steps:
+
+ o Make sure you have the required environment variables set for VC++.  Often
+   this is accomplished by running the VCVARS32.BAT file from the VC++ bin
+   directory.
+
+ o Edit makefile.vc, updating the TIFF_DIR (or TIFF_LIB and TIFF_INC) variable
+   to point to the location of the tiff build tree.
+
+ o Build using the command ``nmake -f makefile.vc''
+
+If you don't use makefile.vc, you will need to copy geo_config.h.vc to
+geo_config.h by hand. 

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README_BIN
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README_BIN	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/README_BIN	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,42 @@
+	libgeotiff Binary Distribution for Unix
+	---------------------------------------
+
+This tree contains a binary distribution of libgeotiff, and related
+utilities (listgeo, and geotifcp) for a Unix platform (as indicated in 
+the distribution filename).  
+
+The distribution should consist of:
+
+README: this file
+bin/listgeo: utility program
+bin/geotifcp: utility program
+lib/libgeotiff.a: static library for libgeotiff, applications also have
+                  to link against libtiff.
+lib/libgeotiff-$VERSION.so: Shared library version of the above.
+lib/libgeotiff.so: link to the specific shared library.
+include: The include files for libgeotiff.
+share/epsg_csv: The EPSG CSV files used to decompose projection systems.
+
+This distribution is intended to be suitable to untar directly under
+/usr/local or /usr to give a rough equivelent to having done a "make install" 
+from the libgeotiff source, though this README should be removed.
+
+If this distribution is not installed under /usr/local, it will likely be
+necessary to define the GEOTIFF_CSV environment variable to point at
+the share/epsg_csv directory.  For reporting of lat/long equivelents of
+
+
+User documentation for listgeo and geotifcp can be found at:
+
+  http://www.remotesensing.org/geotiff/listgeo.html
+  http://www.remotesensing.org/geotiff/geotifcp.html
+
+General information on libgeotiff, and GeoTIFF can be found at:
+
+  http://www.remotesensing.org/geotiff/geotiff.html 
+
+or 
+
+  http://www.geotiff.org/
+
+

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/aclocal.m4
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/aclocal.m4	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/aclocal.m4	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,184 @@
+AC_DEFUN(AC_COMPILER_WFLAGS,
+[
+	# Remove -g from compile flags, we will add via CFG variable if
+	# we need it.
+	CXXFLAGS=`echo "$CXXFLAGS " | sed "s/-g //"`
+	CFLAGS=`echo "$CFLAGS " | sed "s/-g //"`
+
+	# check for GNU compiler, and use -Wall
+	if test "$GCC" = "yes"; then
+		C_WFLAGS="-Wall"
+		CFLAGS="$CFLAGS -Wall"
+		AC_DEFINE(USE_GNUCC)
+	fi
+	if test "$GXX" = "yes"; then
+		CXX_WFLAGS="-Wall"
+		CXXFLAGS="$CXXFLAGS -Wall"
+		AC_DEFINE(USE_GNUCC)
+	fi
+	AC_SUBST(CXX_WFLAGS,$CXX_WFLAGS)
+	AC_SUBST(C_WFLAGS,$C_WFLAGS)
+])
+
+AC_DEFUN(AC_COMPILER_PIC,
+[
+	echo 'void f(){}' > conftest.c
+	if test -z "`${CC-cc} -fPIC -c conftest.c 2>&1`"; then
+	  C_PIC=-fPIC
+	else
+	  C_PIC=
+	fi
+	if test -z "`${CXX-g++} -fPIC -c conftest.c 2>&1`"; then
+	  CXX_PIC=-fPIC
+	else
+	  CXX_PIC=
+	fi
+	rm -f conftest*
+
+	AC_SUBST(CXX_PIC,$CXX_PIC)
+	AC_SUBST(C_PIC,$C_PIC)
+])
+
+dnl
+dnl Try to find something to link shared libraries with.  Use "c++ -shared"
+dnl in preference to "ld -shared" because it will link in required c++
+dnl run time support for us. 
+dnl
+AC_DEFUN(AC_LD_SHARED,
+[
+  echo 'void g(); int main(){ g(); return 0; }' > conftest1.c
+
+  echo '#include <stdio.h>' > conftest2.c
+  echo 'void g(); void g(){printf("");}' >> conftest2.c
+  ${CC} ${C_PIC} -c conftest2.c
+
+  SO_EXT="so"
+  export SO_EXT
+  LD_SHARED="/bin/true"
+  if test ! -z "`uname -a | grep IRIX`" ; then
+    IRIX_ALL=-all
+  else
+    IRIX_ALL=
+  fi
+
+  AC_ARG_WITH(ld-shared,[  --without-ld-shared   Disable shared library support],,)
+
+  if test "$with_ld_shared" != "" ; then
+    if test "$with_ld_shared" = "no" ; then
+      echo "user disabled shared library support."	
+    else
+      echo "using user supplied .so link command ... $with_ld_shared"	
+    fi
+    LD_SHARED="$with_ld_shared"
+  fi
+
+  dnl Check For Cygwin case.  Actually verify that the produced DLL works.
+
+  if test ! -z "`uname -a | grep CYGWIN`" \
+        -a "$LD_SHARED" = "/bin/true" \
+	-a -z "`gcc -shared conftest2.o -o libconftest.dll`" ; then
+    if test -z "`${CC} conftest1.c -L./ -lconftest -o conftest1 2>&1`"; then
+      LD_LIBRARY_PATH_OLD="$LD_LIBRARY_PATH"
+      if test -z "$LD_LIBRARY_PATH" ; then
+        LD_LIBRARY_PATH="`pwd`"
+      else
+        LD_LIBRARY_PATH="`pwd`:$LD_LIBRARY_PATH"
+      fi
+      export LD_LIBRARY_PATH
+      if test -z "`./conftest1 2>&1`" ; then
+        echo "checking for Cygwin gcc -shared ... yes"
+        LD_SHARED="c++ -shared"
+        SO_EXT="dll"
+      fi
+      LD_LIBRARY_PATH="$LD_LIBRARY_PATH_OLD"
+    fi
+  fi
+
+  dnl Test special MacOS (Darwin) case. 
+
+  if test ! -z "`uname | grep Darwin`" \
+          -a "$LD_SHARED" = "/bin/true" \
+          -a -z "`${CXX} -dynamiclib conftest2.o -o libconftest.so 2>&1`" ; then
+    ${CC} -c conftest1.c
+    if test -z "`${CXX} conftest1.o libconftest.so -o conftest1 2>&1`"; then
+      DYLD_LIBRARY_PATH_OLD="$DYLD_LIBRARY_PATH"
+      if test -z "$DYLD_LIBRARY_PATH" ; then
+        DYLD_LIBRARY_PATH="`pwd`"
+      else
+        DYLD_LIBRARY_PATH="`pwd`:$DYLD_LIBRARY_PATH"
+      fi
+      export DYLD_LIBRARY_PATH
+      if test -z "`./conftest1 2>&1`" ; then
+        echo "checking for ${CXX} -dynamiclib ... yes"
+        LD_SHARED="${CXX} -dynamiclib"
+	SO_EXT=dylib
+      fi
+      DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH_OLD"
+    fi
+    rm -f conftest1.o
+  fi
+
+  if test "$LD_SHARED" = "/bin/true" \
+	-a -z "`${CXX} -shared $IRIX_ALL conftest2.o -o libconftest.so 2>&1|grep -v WARNING`" ; then
+    if test -z "`${CC} conftest1.c libconftest.so -o conftest1 2>&1`"; then
+      LD_LIBRARY_PATH_OLD="$LD_LIBRARY_PATH"
+      if test -z "$LD_LIBRARY_PATH" ; then
+        LD_LIBRARY_PATH="`pwd`"
+      else
+        LD_LIBRARY_PATH="`pwd`:$LD_LIBRARY_PATH"
+      fi
+      export LD_LIBRARY_PATH
+      if test -z "`./conftest1 2>&1`" ; then
+        echo "checking for ${CXX} -shared ... yes"
+        LD_SHARED="${CXX} -shared $IRIX_ALL"
+      else
+        echo "checking for ${CXX} -shared ... no(3)"
+      fi
+      LD_LIBRARY_PATH="$LD_LIBRARY_PATH_OLD"
+    else
+      echo "checking for ${CXX} -shared ... no(2)"
+    fi
+  else 
+    if test "$LD_SHARED" = "/bin/true" ; then
+      echo "checking for ${CXX} -shared ... no(1)"
+    fi
+  fi
+
+  if test "$LD_SHARED" = "/bin/true" \
+          -a -z "`ld -shared conftest2.o -o libconftest.so 2>&1`" ; then
+    if test -z "`${CC} conftest1.c libconftest.so -o conftest1 2>&1`"; then
+      LD_LIBRARY_PATH_OLD="$LD_LIBRARY_PATH"
+      if test -z "$LD_LIBRARY_PATH" ; then
+        LD_LIBRARY_PATH="`pwd`"
+      else
+        LD_LIBRARY_PATH="`pwd`:$LD_LIBRARY_PATH"
+      fi
+      export LD_LIBRARY_PATH
+      if test -z "`./conftest1 2>&1`" ; then
+        echo "checking for ld -shared ... yes"
+        LD_SHARED="ld -shared"
+      fi
+      LD_LIBRARY_PATH="$LD_LIBRARY_PATH_OLD"
+    fi
+  fi
+
+  if test "$LD_SHARED" = "/bin/true" ; then
+    echo "checking for ld -shared ... no"
+    if test ! -x /bin/true ; then
+      LD_SHARED=/usr/bin/true
+    fi
+  fi
+  if test "$LD_SHARED" = "no" ; then
+    if test -x /bin/true ; then
+      LD_SHARED=/bin/true
+    else
+      LD_SHARED=/usr/bin/true
+    fi
+  fi
+
+  rm -f conftest* libconftest* 
+
+  AC_SUBST(LD_SHARED,$LD_SHARED)
+  AC_SUBST(SO_EXT,$SO_EXT)
+])
+

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/.cvsignore
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/.cvsignore	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/.cvsignore	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,4 @@
+Makefile
+makegeo
+listgeo
+geotifcp

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/Makefile.in
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/Makefile.in	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/Makefile.in	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,64 @@
+#
+# GeoTIFF Library source for Makefile
+#
+DEPTH	= ..
+
+GEOTIFFDIR	= $(DEPTH)
+GEOTIFF_SO=@GEOTIFF_SO@
+
+LIBS=   -L$(GEOTIFFDIR) -lgeotiff @LIBS@
+
+#
+SHELL	= /bin/sh
+NULL	=
+CC	= @CC@
+AR	= ar
+LN	= @LN_S@
+AROPTS	= r
+RANLIB	= @RANLIB@
+INSTALL	= @INSTALL@
+
+EXEEXT=@EXEEXT@
+
+prefix = @prefix@
+libdir  = @libdir@
+
+PROGS=${BIN}/makegeo$(EXEEXT) ${BIN}/listgeo$(EXEEXT) ${BIN}/geotifcp$(EXEEXT)
+
+#
+IPATH	= -I. -I${GEOTIFFDIR} @TIFF_INC@ @ZIP_INC@
+
+#
+
+COPTS	= @CFLAGS@
+CFLAGS  = ${COPTS} ${IPATH}
+#
+SRCS	= \
+	${NULL}
+OBJS	= \
+	makegeo.o \
+	listgeo.o \
+	geotifcp.o \
+	${NULL}
+
+ALL=	makegeo$(EXEEXT) listgeo$(EXEEXT) geotifcp$(EXEEXT)
+  
+all:	${ALL} 
+  
+makegeo$(EXEEXT): makegeo.o  ${GEOTIFFDIR}/libgeotiff.a
+	${CC} ${COPTS} makegeo.o -L${libdir} ${LIBS} -o $@
+  
+geotifcp$(EXEEXT): geotifcp.o  ${GEOTIFFDIR}/libgeotiff.a
+	${CC} ${COPTS} geotifcp.o -L${libdir} ${LIBS} -o $@
+  
+listgeo$(EXEEXT): listgeo.o  ${GEOTIFFDIR}/libgeotiff.a
+	${CC} ${COPTS} listgeo.o -L${libdir} ${LIBS} -o $@
+  
+csv2html$(EXEEXT): csv2html.o  ${GEOTIFFDIR}/libgeotiff.a
+	${CC} ${COPTS} csv2html.o -L${libdir} ${LIBS} -o $@
+
+clean:
+	rm -f ${ALL} ${OBJS} core a.out newgeo.tif ${GEOTIFF_SO}
+
+dist-clean: clean
+	rm -f Makefile

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/csv2html.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/csv2html.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/csv2html.c	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,279 @@
+/******************************************************************************
+ * $Id: csv2html.c,v 1.3 2000/12/28 23:26:56 warmerda Exp $
+ *
+ * Project:  libgeotiff
+ * Purpose:  CGI BIN to view CSV files on the web.
+ * Author:   Frank Warmerdam, warmerda at home.com
+ *
+ ******************************************************************************
+ * Copyright (c) 1999, Frank Warmerdam
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ ******************************************************************************
+ *
+ * $Log: csv2html.c,v $
+ * Revision 1.3  2000/12/28 23:26:56  warmerda
+ * Changed to default csv path.
+ *
+ * Revision 1.2  1999/07/28 22:11:31  warmerda
+ * lots more changes
+ *
+ * Revision 1.1  1999/06/25 05:50:24  warmerda
+ * New
+ *
+ */
+
+#include "cpl_csv.h"
+
+static void
+CSV2HTML( const char * pszFilename, int nColumns, int * panColumns, char**,
+          int );
+
+/************************************************************************/
+/*                                main()                                */
+/************************************************************************/
+int main( int nArgc, char ** papszArgv )
+
+{
+    int		nColumns = 0;
+    int		*panColumnList = NULL;
+    const char *pszTable = "horiz_cs";
+    const char *pszTablePath = "/usr/local/share/epsg_csv";
+    char	**papszOptions = NULL;
+    char	szFilename[1024];
+    int		i, bSingletons = FALSE;
+
+    printf( "Content-type: text/html\n\n" );
+    
+/* -------------------------------------------------------------------- */
+/*      Parse the PATH_INFO.                                            */
+/* -------------------------------------------------------------------- */
+    if( getenv( "PATH_INFO" ) != NULL )
+    {
+        papszOptions = CSLTokenizeStringComplex( getenv("PATH_INFO") + 1,
+                                                 "/", TRUE, TRUE );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Add commandline switch to the option list.                      */
+/* -------------------------------------------------------------------- */
+    for( i = 1; i < nArgc; i++ )
+        papszOptions = CSLAddString( papszOptions, papszArgv[i] );
+
+/* -------------------------------------------------------------------- */
+/*      Process program options.                                        */
+/* -------------------------------------------------------------------- */
+    for( i = 0; papszOptions != NULL && papszOptions[i] != NULL; i++ )
+    {
+        if( EQUALN(papszOptions[i],"FIELDS=",7) )
+        {
+            char	**papszList;
+            int		j;
+
+            papszList = CSLTokenizeStringComplex( papszOptions[i]+7, ",",
+                                                TRUE, TRUE );
+            nColumns = CSLCount( papszList );
+            panColumnList = (int *) CPLRealloc(panColumnList,
+                                               sizeof(int) * nColumns);
+
+            for( j = 0; j < nColumns; j++ )
+                panColumnList[j] = atoi(papszList[j]);
+
+            CSLDestroy( papszList );
+        }
+
+        else if( EQUALN(papszOptions[i],"TABLE=",6) )
+        {
+            pszTable = papszOptions[i] + 6;
+        }
+
+        else if( EQUALN(papszOptions[i],"CODE=",5) )
+        {
+            bSingletons = TRUE;
+        }
+
+        else if( EQUALN(papszOptions[i],"SINGLETON",6) )
+        {
+            bSingletons = TRUE;
+        }
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Derive the full filename.                                       */
+/* -------------------------------------------------------------------- */
+    sprintf( szFilename, "%s/%s.csv", pszTablePath, pszTable );
+
+/* -------------------------------------------------------------------- */
+/*      Call function to translate to HTML.                             */
+/* -------------------------------------------------------------------- */
+    CSV2HTML( szFilename, nColumns, panColumnList, papszOptions,
+              bSingletons );
+
+    return 0;
+}
+
+/************************************************************************/
+/*                              CSV2HTML()                              */
+/*                                                                      */
+/*      Translate file to HTML.                                         */
+/************************************************************************/
+
+static void
+CSV2HTML( const char * pszFilename, int nColumns, int * panColumns,
+          char ** papszOptions, int bSingletons )
+
+{
+    FILE	*fp;
+    char	**papszFields, **papszFieldNames;
+    int		iCol, nColCount;
+
+/* -------------------------------------------------------------------- */
+/*      Open the source file.                                           */
+/* -------------------------------------------------------------------- */
+    fp = VSIFOpen( pszFilename, "rt" );
+
+    if( fp == NULL )
+    {
+        perror( "fopen" );
+        return;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Read and emit the title line specially.                         */
+/* -------------------------------------------------------------------- */
+    papszFieldNames = CSVReadParseLine( fp );
+    nColCount = CSLCount( papszFieldNames );
+
+    if( nColumns == 0 )
+    {
+        nColumns = nColCount;
+        panColumns = (int *) CPLMalloc(sizeof(int) * nColCount);
+        for( iCol = 0; iCol < nColCount; iCol++ )
+            panColumns[iCol] = iCol;
+    }
+
+    printf( "<table border>\n" );
+
+    if( !bSingletons )
+    {
+        for( iCol = 0; iCol < nColumns; iCol++ )
+        {
+            if( panColumns[iCol] < nColCount )
+            {
+                printf( "<th>%s\n", papszFieldNames[panColumns[iCol]] );
+            }
+        }
+        printf( "<tr>\n" );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Read and emit normal records.                                   */
+/* -------------------------------------------------------------------- */
+    while( (papszFields = CSVReadParseLine( fp )) != NULL )
+    {
+        int	bDisplay=TRUE, i;
+        
+        nColCount = CSLCount( papszFields );
+
+        for( i = 0; papszOptions != NULL && papszOptions[i] != NULL; i++ )
+        {
+            if( EQUALN(papszOptions[i],"CODE=",5) )
+            {
+                if( atoi(papszOptions[i]+5) != atoi(papszFields[0]) )
+                    bDisplay = FALSE;
+            }
+            else if( EQUALN(papszOptions[i],"CODE<",5) )
+            {
+                if( atoi(papszOptions[i]+5) <= atoi(papszFields[0]) )
+                    bDisplay = FALSE;
+            }
+            else if( EQUALN(papszOptions[i],"CODE>",5) )
+            {
+                if( atoi(papszOptions[i]+5) >= atoi(papszFields[0]) )
+                    bDisplay = FALSE;
+            }
+            else if( EQUALN(papszOptions[i],"NAMEKEY=",8) )
+            {
+                if( strstr(papszFields[1],papszOptions[i]+8) == NULL )
+                    bDisplay = FALSE;
+            }
+        }
+
+        if( bDisplay )
+        {
+            for( iCol = 0; iCol < nColumns; iCol++ )
+            {
+                const char	*pszSubTable = NULL;
+                const char  *pszFieldName;
+                
+                if( panColumns[iCol] < 0
+                    || panColumns[iCol] >= nColCount )
+                    continue;
+                
+                pszFieldName = papszFieldNames[panColumns[iCol]];
+
+                if( bSingletons )
+                {
+                    printf( "<td>%s\n", pszFieldName );
+                }
+                
+
+                if( EQUAL(pszFieldName,"PRIME_MERIDIAN_CODE") )
+                    pszSubTable = "p_meridian";
+                else if( EQUAL(pszFieldName,"GEOD_DATUM_CODE") )
+                    pszSubTable = "geod_datum";
+                else if( EQUAL(pszFieldName,"UOM_LENGTH_CODE") )
+                    pszSubTable = "uom_length";
+                else if( EQUAL(pszFieldName,"UOM_ANGLE_CODE") )
+                    pszSubTable = "uom_angle";
+                else if( EQUAL(pszFieldName,"SOURCE_GEOGCS_CODE") )
+                    pszSubTable = "horiz_cs";
+                else if( EQUAL(pszFieldName,"PROJECTION_TRF_CODE") )
+                    pszSubTable = "trf_nonpolynomial";
+                else if( EQUAL(pszFieldName,"ELLIPSOID_CODE") )
+                    pszSubTable = "ellipsoid";
+                else if( EQUAL(pszFieldName,"COORD_TRF_METHOD_CODE") )
+                    pszSubTable = "trf_method";
+                
+                if( pszSubTable != NULL )
+                    printf( "<td><a href="
+                            "\"/cgi-bin/csv2html/TABLE=%s/CODE=%s/\">"
+                            "%s</a>\n",
+                            pszSubTable,papszFields[panColumns[iCol]],
+                            papszFields[panColumns[iCol]] );
+                else
+                    printf( "<td>%s\n", papszFields[panColumns[iCol]] );
+
+                if( bSingletons )
+                    printf( "<tr>\n" );
+            }
+
+            if( !bSingletons )
+                printf( "<tr>\n" );
+        }
+
+        CSLDestroy( papszFields );
+    }
+
+    printf( "</table>\n" );
+
+    CSLDestroy( papszFieldNames );
+
+    VSIFClose( fp );
+}

Added: packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/geotifcp.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/geotifcp.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/branches/upstream/current/bin/geotifcp.c	2007-09-19 11:46:09 UTC (rev 1081)
@@ -0,0 +1,1419 @@
+/* geotifcp.c -- based on Sam Leffler's "tiffcp" code */
+
+/*
+ *  Original code had this copyright notice: 
+ *
+ * Copyright (c) 1988-1995 Sam Leffler
+ * Copyright (c) 1991-1995 Silicon Graphics, Inc.
+ *
+ * and a lot of legal stuff denying liability for anything.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+/* GeoTIFF overrides */
+
+#include "geotiff.h"
+#include "geo_tiffp.h"
+#include "geo_keyp.h"
+#include "xtiffio.h"
+#include "cpl_serv.h"
+
+#define TIFFOpen XTIFFOpen
+#define TIFFClose XTIFFClose
+
+#if defined(VMS)
+#define unlink delete
+#endif
+
+#define	streq(a,b)	(strcmp(a,b) == 0)
+#define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
+
+#define	TRUE	1
+#define	FALSE	0
+
+int getopt();
+
+static  int outtiled = -1;
+static  uint32 tilewidth;
+static  uint32 tilelength;
+static  int convert_8_to_4 = 0;
+
+static	uint16 config;
+static	uint16 compression;
+static	uint16 predictor;
+static	uint16 fillorder;
+static	uint32 rowsperstrip;
+static	uint32 g3opts;
+static	int ignore = FALSE;		/* if true, ignore read errors */
+static	uint32 defg3opts = (uint32) -1;
+static	int quality = 75;		/* JPEG quality */
+static	int jpegcolormode = JPEGCOLORMODE_RGB;
+static	uint16 defcompression = (uint16) -1;
+static	uint16 defpredictor = (uint16) -1;
+static 	char *geofile=(char *)0;
+static  char *worldfile=(char *)0;
+
+static  void ApplyWorldFile(const char *worldfile, TIFF *out);
+static	int tiffcp(TIFF*, TIFF*);
+static	int processCompressOptions(char*);
+static	void usage(void);
+
+
+int
+main(int argc, char* argv[])
+{
+	uint16 defconfig = (uint16) -1;
+	uint16 deffillorder = 0;
+	uint32 deftilewidth = (uint32) -1;
+	uint32 deftilelength = (uint32) -1;
+	uint32 defrowsperstrip = (uint32) -1;
+	uint32 diroff = 0;
+	TIFF* in;
+	TIFF* out;
+	const char* mode = "w";
+	int c;
+	extern int optind;
+	extern char* optarg;
+
+	while ((c = getopt(argc, argv, "c:f:l:o:p:r:w:e:g:aistd")) != -1)
+		switch (c) {
+		case 'a':		/* append to output */
+			mode = "a";
+			break;
+		case 'd':		/* down cast 8bit to 4bit */
+                        convert_8_to_4 = 1;
+			break;
+		case 'c':		/* compression scheme */
+			if (!processCompressOptions(optarg))
+				usage();
+			break;
+                case 'e':
+                        worldfile = optarg;
+                        break;
+		case 'f':		/* fill order */
+			if (streq(optarg, "lsb2msb"))
+				deffillorder = FILLORDER_LSB2MSB;
+			else if (streq(optarg, "msb2lsb"))
+				deffillorder = FILLORDER_MSB2LSB;
+			else
+				usage();
+			break;
+		case 'i':		/* ignore errors */
+			ignore = TRUE;
+			break;
+		case 'g':		/* GeoTIFF metadata file */
+			geofile = optarg;
+			break;
+		case 'l':		/* tile length */
+			outtiled = TRUE;
+			deftilelength = atoi(optarg);
+			break;
+		case 'o':		/* initial directory offset */
+			diroff = strtoul(optarg, NULL, 0);
+			break;
+		case 'p':		/* planar configuration */
+			if (streq(optarg, "separate"))
+				defconfig = PLANARCONFIG_SEPARATE;
+			else if (streq(optarg, "contig"))
+				defconfig = PLANARCONFIG_CONTIG;
+			else
+				usage();
+			break;
+		case 'r':		/* rows/strip */
+			defrowsperstrip = atoi(optarg);
+			break;
+		case 's':		/* generate stripped output */
+			outtiled = FALSE;
+			break;
+		case 't':		/* generate tiled output */
+			outtiled = TRUE;
+			break;
+		case 'w':		/* tile width */
+			outtiled = TRUE;
+			deftilewidth = atoi(optarg);
+			break;
+		case '?':
+			usage();
+			/*NOTREACHED*/
+		}
+	if (argc - optind < 2)
+		usage();
+	out = TIFFOpen(argv[argc-1], mode);
+	if (out == NULL)
+		return (-2);
+	for (; optind < argc-1 ; optind++) {
+		in = TIFFOpen(argv[optind], "r");
+		if (in == NULL)
+			return (-3);
+		if (diroff != 0 && !TIFFSetSubDirectory(in, diroff)) {
+			TIFFError(TIFFFileName(in),
+			    "Error, setting subdirectory at %#x", diroff);
+			(void) TIFFClose(out);
+			return (1);
+		}
+		do {
+			config = defconfig;
+			compression = defcompression;
+			predictor = defpredictor;
+			fillorder = deffillorder;
+			rowsperstrip = defrowsperstrip;
+			tilewidth = deftilewidth;
+			tilelength = deftilelength;
+			g3opts = defg3opts;
+			if (!tiffcp(in, out) || !TIFFWriteDirectory(out)) {
+				(void) TIFFClose(out);
+				return (1);
+			}
+		} while (TIFFReadDirectory(in));
+		(void) TIFFClose(in);
+	}
+	(void) TIFFClose(out);
+	return (0);
+}
+
+static void ApplyWorldFile(const char *worldfilename, TIFF *out)
+
+{
+    FILE	*tfw;
+    double	pixsize[3], xoff, yoff, tiepoint[6], x_rot, y_rot;
+
+    /* 
+     * Read the world file.  Note we currently ignore rotational coefficients!
+     */
+    tfw = fopen( worldfilename, "rt" );
+    if( tfw == NULL )
+    {
+        perror( worldfilename );
+        return;
+    }
+
+    fscanf( tfw, "%lf", pixsize + 0 );
+    fscanf( tfw, "%lf", &y_rot );
+    fscanf( tfw, "%lf", &x_rot );
+    fscanf( tfw, "%lf", pixsize + 1 );
+    fscanf( tfw, "%lf", &xoff );
+    fscanf( tfw, "%lf", &yoff );
+
+    fclose( tfw );
+
+    /*
+     * Write out pixel scale, and tiepoint information.
+     */
+    if( x_rot == 0.0 && y_rot == 0.0 )
+    {
+        pixsize[1] = ABS(pixsize[1]);
+        pixsize[2] = 0.0;
+        TIFFSetField(out, GTIFF_PIXELSCALE, 3, pixsize);
+
+        tiepoint[0] = 0.5;
+        tiepoint[1] = 0.5;
+        tiepoint[2] = 0.0;
+        tiepoint[3] = xoff;
+        tiepoint[4] = yoff;
+        tiepoint[5] = 0.0;
+        TIFFSetField(out, GTIFF_TIEPOINTS, 6, tiepoint);
+    }
+    else
+    {
+        double	adfMatrix[16];
+        
+        memset(adfMatrix,0,sizeof(double) * 16);
+        
+        adfMatrix[0] = pixsize[0];
+        adfMatrix[1] = x_rot;
+        adfMatrix[3] = xoff - (pixsize[0]+x_rot) * 0.5;
+        adfMatrix[4] = y_rot;
+        adfMatrix[5] = pixsize[1];
+        adfMatrix[7] = yoff - (pixsize[1]+y_rot) * 0.5;
+        adfMatrix[15] = 1.0;
+        
+        TIFFSetField( out, TIFFTAG_GEOTRANSMATRIX, 16, adfMatrix );
+    }
+}
+
+static void InstallGeoTIFF(TIFF *out)
+{
+    GTIF *gtif=(GTIF*)0; /* GeoKey-level descriptor */
+    FILE *fd;
+
+    gtif = GTIFNew(out);
+    if (!gtif)
+    {
+        printf("failed in GTIFNew\n");
+        return;
+    }
+
+    /* Install keys and tags */
+    fd = fopen(geofile,"r");
+    if( fd == NULL )
+    {
+        perror( geofile );
+        exit( -1 );
+    }
+    if (!GTIFImport(gtif,0,fd)) goto bad;
+    fclose(fd);
+    GTIFWriteKeys(gtif);
+    GTIFFree(gtif);
+    return;
+  bad:
+    fprintf(stderr,"Failure in GTIFImport\n");
+    exit (-1);
+}
+
+static void CopyGeoTIFF(TIFF * in, TIFF *out)
+{
+    GTIF *gtif=(GTIF*)0; /* GeoKey-level descriptor */
+    double *d_list = NULL;
+    int16   d_list_count;
+
+    /* read definition from source file. */
+    gtif = GTIFNew(in);
+    if (!gtif)
+        return;
+
+    if (TIFFGetField(in, GTIFF_TIEPOINTS, &d_list_count, &d_list))
+        TIFFSetField(out, GTIFF_TIEPOINTS, d_list_count, d_list);
+    if (TIFFGetField(in, GTIFF_PIXELSCALE, &d_list_count, &d_list))
+        TIFFSetField(out, GTIFF_PIXELSCALE, d_list_count, d_list);
+    if (TIFFGetField(in, GTIFF_TRANSMATRIX, &d_list_count, &d_list))
+        TIFFSetField(out, GTIFF_TRANSMATRIX, d_list_count, d_list);
+            
+    /* Here we violate the GTIF abstraction to retarget on another file.
+       We should just have a function for copying tags from one GTIF object
+       to another. */
+    gtif->gt_tif = out;
+    gtif->gt_flags |= FLAG_FILE_MODIFIED;
+
+    /* Install keys and tags */
+    GTIFWriteKeys(gtif);
+    GTIFFree(gtif);
+    return;
+}
+
+static void
+processG3Options(char* cp)
+{
+    if( (cp = strchr(cp, ':')) != NULL ) {
+        if (defg3opts == (uint32) -1)
+            defg3opts = 0;
+        do {
+            cp++;
+            if (strneq(cp, "1d", 2))
+                defg3opts &= ~GROUP3OPT_2DENCODING;
+            else if (strneq(cp, "2d", 2))
+                defg3opts |= GROUP3OPT_2DENCODING;
+            else if (strneq(cp, "fill", 4))
+                defg3opts |= GROUP3OPT_FILLBITS;
+            else
+                usage();
+        } while( (cp = strchr(cp, ':')) != NULL );
+    }
+}
+
+static int
+processCompressOptions(char* opt)
+{
+    if (streq(opt, "none"))
+        defcompression = COMPRESSION_NONE;
+    else if (streq(opt, "packbits"))
+        defcompression = COMPRESSION_PACKBITS;
+    else if (strneq(opt, "jpeg", 4)) {
+        char* cp = strchr(opt, ':');
+        if (cp && isdigit(cp[1]))
+            quality = atoi(cp+1);
+        if (cp && strchr(cp, 'r'))
+            jpegcolormode = JPEGCOLORMODE_RAW;
+        defcompression = COMPRESSION_JPEG;
+    } else if (strneq(opt, "g3", 2)) {
+        processG3Options(opt);
+        defcompression = COMPRESSION_CCITTFAX3;
+    } else if (streq(opt, "g4"))
+        defcompression = COMPRESSION_CCITTFAX4;
+    else if (strneq(opt, "lzw", 3)) {
+        char* cp = strchr(opt, ':');
+        if (cp)
+            defpredictor = atoi(cp+1);
+        defcompression = COMPRESSION_LZW;
+    } else if (strneq(opt, "zip", 3)) {
+        char* cp = strchr(opt, ':');
+        if (cp)
+            defpredictor = atoi(cp+1);
+        defcompression = COMPRESSION_DEFLATE;
+    } else
+        return (0);
+    return (1);
+}
+
+char* stuff[] = {
+"usage: gtiffcp [options] input... output",
+"where options are:",
+" -g file	install GeoTIFF metadata from <file>",
+" -e file	install positioning info from ESRI Worldfile <file>",
+" -a		append to output instead of overwriting",
+" -o offset	set initial directory offset",
+" -p contig	pack samples contiguously (e.g. RGBRGB...)",
+" -p separate	store samples separately (e.g. RRR...GGG...BBB...)",
+" -s		write output in strips",
+" -t		write output in tiles",
+" -i		ignore read errors",
+" -d		truncate 8 bitspersample to 4bitspersample",
+"",
+" -r #		make each strip have no more than # rows",
+" -w #		set output tile width (pixels)",
+" -l #		set output tile length (pixels)",
+"",
+" -f lsb2msb	force lsb-to-msb FillOrder for output",
+" -f msb2lsb	force msb-to-lsb FillOrder for output",
+"",
+" -c lzw[:opts]	compress output with Lempel-Ziv & Welch encoding",
+" -c zip[:opts]	compress output with deflate encoding",
+" -c jpeg[:opts]compress output with JPEG encoding",
+" -c packbits	compress output with packbits encoding",
+" -c g3[:opts]	compress output with CCITT Group 3 encoding",
+" -c g4		compress output with CCITT Group 4 encoding",
+" -c none	use no compression algorithm on output",
+"",
+"Group 3 options:",
+" 1d		use default CCITT Group 3 1D-encoding",
+" 2d		use optional CCITT Group 3 2D-encoding",
+" fill		byte-align EOL codes",
+"For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs",
+"",
+"JPEG options:",
+" #		set compression quality level (0-100, default 75)",
+" r		output color image as RGB rather than YCbCr",
+"For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
+"",
+"LZW and deflate options:",
+" #		set predictor value",
+"For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
+NULL
+};
+
+static void
+usage(void)
+{
+	char buf[BUFSIZ];
+	int i;
+
+	setbuf(stderr, buf);
+	for (i = 0; stuff[i] != NULL; i++)
+		fprintf(stderr, "%s\n", stuff[i]);
+	exit(-1);
+}
+
+static void
+CheckAndCorrectColormap(TIFF* tif, int n, uint16* r, uint16* g, uint16* b)
+{
+	int i;
+
+	for (i = 0; i < n; i++)
+		if (r[i] >= 256 || g[i] >= 256 || b[i] >= 256)
+			return;
+	TIFFWarning(TIFFFileName(tif), "Scaling 8-bit colormap");
+#define	CVT(x)		(((x) * ((1L<<16)-1)) / 255)
+	for (i = 0; i < n; i++) {
+		r[i] = CVT(r[i]);
+		g[i] = CVT(g[i]);
+		b[i] = CVT(b[i]);
+	}
+#undef CVT
+}
+
+#define	CopyField(tag, v) \
+    if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
+#define	CopyField2(tag, v1, v2) \
+    if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)
+#define	CopyField3(tag, v1, v2, v3) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)
+#define	CopyField4(tag, v1, v2, v3, v4) \
+    if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
+
+static struct cpTag {
+	uint16	tag;
+	uint16	count;
+	TIFFDataType type;
+} tags[] = {
+	{ TIFFTAG_SUBFILETYPE,		1, TIFF_LONG },
+	{ TIFFTAG_THRESHHOLDING,	1, TIFF_SHORT },
+	{ TIFFTAG_DOCUMENTNAME,		1, TIFF_ASCII },
+	{ TIFFTAG_IMAGEDESCRIPTION,	1, TIFF_ASCII },
+	{ TIFFTAG_MAKE,			1, TIFF_ASCII },
+	{ TIFFTAG_MODEL,		1, TIFF_ASCII },
+	{ TIFFTAG_ORIENTATION,		1, TIFF_SHORT },
+	{ TIFFTAG_MINSAMPLEVALUE,	1, TIFF_SHORT },
+	{ TIFFTAG_MAXSAMPLEVALUE,	1, TIFF_SHORT },
+	{ TIFFTAG_XRESOLUTION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_YRESOLUTION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_PAGENAME,		1, TIFF_ASCII },
+	{ TIFFTAG_XPOSITION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_YPOSITION,		1, TIFF_RATIONAL },
+	{ TIFFTAG_GROUP4OPTIONS,	1, TIFF_LONG },
+	{ TIFFTAG_RESOLUTIONUNIT,	1, TIFF_SHORT },
+	{ TIFFTAG_PAGENUMBER,		2, TIFF_SHORT },
+	{ TIFFTAG_SOFTWARE,		1, TIFF_ASCII },
+	{ TIFFTAG_DATETIME,		1, TIFF_ASCII },
+	{ TIFFTAG_ARTIST,		1, TIFF_ASCII },
+	{ TIFFTAG_HOSTCOMPUTER,		1, TIFF_ASCII },
+	{ TIFFTAG_WHITEPOINT,		1, TIFF_RATIONAL },
+	{ TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },
+	{ TIFFTAG_HALFTONEHINTS,	2, TIFF_SHORT },
+	{ TIFFTAG_BADFAXLINES,		1, TIFF_LONG },
+	{ TIFFTAG_CLEANFAXDATA,		1, TIFF_SHORT },
+	{ TIFFTAG_CONSECUTIVEBADFAXLINES,1, TIFF_LONG },
+	{ TIFFTAG_INKSET,		1, TIFF_SHORT },
+	{ TIFFTAG_INKNAMES,		1, TIFF_ASCII },
+	{ TIFFTAG_DOTRANGE,		2, TIFF_SHORT },
+	{ TIFFTAG_TARGETPRINTER,	1, TIFF_ASCII },
+	{ TIFFTAG_SAMPLEFORMAT,		1, TIFF_SHORT },
+	{ TIFFTAG_YCBCRCOEFFICIENTS,	(uint16) -1,TIFF_RATIONAL },
+	{ TIFFTAG_YCBCRSUBSAMPLING,	2, TIFF_SHORT },
+	{ TIFFTAG_YCBCRPOSITIONING,	1, TIFF_SHORT },
+	{ TIFFTAG_REFERENCEBLACKWHITE,	(uint16) -1,TIFF_RATIONAL },
+	{ TIFFTAG_EXTRASAMPLES,		(uint16) -1, TIFF_SHORT },
+	{ TIFFTAG_SMINSAMPLEVALUE,	1, TIFF_DOUBLE },
+	{ TIFFTAG_SMAXSAMPLEVALUE,	1, TIFF_DOUBLE },
+};
+#define	NTAGS	(sizeof (tags) / sizeof (tags[0]))
+
+static void
+cpOtherTags(TIFF* in, TIFF* out)
+{
+	struct cpTag *p;
+
+	for (p = tags; p < &tags[NTAGS]; p++)
+		switch (p->type) {
+		case TIFF_SHORT:
+			if (p->count == 1) {
+				uint16 shortv;
+				CopyField(p->tag, shortv);
+			} else if (p->count == 2) {
+				uint16 shortv1, shortv2;
+				CopyField2(p->tag, shortv1, shortv2);
+			} else if (p->count == (uint16) -1) {
+				uint16 shortv1;
+				uint16* shortav;
+				CopyField2(p->tag, shortv1, shortav);
+			}
+			break;
+		case TIFF_LONG:
+			{ uint32 longv;
+			  CopyField(p->tag, longv);
+			}
+			break;
+		case TIFF_RATIONAL:
+			if (p->count == 1) {
+				float floatv;
+				CopyField(p->tag, floatv);
+			} else if (p->count == (uint16) -1) {
+				float* floatav;
+				CopyField(p->tag, floatav);
+			}
+			break;
+		case TIFF_ASCII:
+			{ char* stringv;
+			  CopyField(p->tag, stringv);
+			}
+			break;
+		case TIFF_DOUBLE:
+			if (p->count == 1) {
+				double doublev;
+				CopyField(p->tag, doublev);
+			} else if (p->count == (uint16) -1) {
+				double* doubleav;
+				CopyField(p->tag, doubleav);
+			}
+			break;
+                default:
+	                break;
+		}
+}
+
+typedef int (*copyFunc)
+    (TIFF* in, TIFF* out, uint32 l, uint32 w, uint16 samplesperpixel);
+static	copyFunc pickCopyFunc(TIFF*, TIFF*, uint16, uint16);
+
+static int
+tiffcp(TIFF* in, TIFF* out)
+{
+	uint16 bitspersample, samplesperpixel, shortv;
+	copyFunc cf;
+	uint32 w, l;
+
+	CopyField(TIFFTAG_IMAGEWIDTH, w);
+	CopyField(TIFFTAG_IMAGELENGTH, l);
+        if( convert_8_to_4 )
+        {
+            TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 4);
+        }
+        else
+        {
+            CopyField(TIFFTAG_BITSPERSAMPLE, bitspersample);
+        }
+	if (compression != (uint16)-1)
+		TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
+	else
+		CopyField(TIFFTAG_COMPRESSION, compression);
+	if (compression == COMPRESSION_JPEG && jpegcolormode == JPEGCOLORMODE_RGB)
+		TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);
+	else
+		CopyField(TIFFTAG_PHOTOMETRIC, shortv);
+	if (fillorder != 0)
+		TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
+	else
+		CopyField(TIFFTAG_FILLORDER, shortv);
+	CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
+	/*
+	 * Choose tiles/strip for the output image according to
+	 * the command line arguments (-tiles, -strips) and the
+	 * structure of the input image.
+	 */
+	if (outtiled == -1)
+		outtiled = TIFFIsTiled(in);
+	if (outtiled) {
+		/*
+		 * Setup output file's tile width&height.  If either
+		 * is not specified, use either the value from the
+		 * input image or, if nothing is defined, use the
+		 * library default.
+		 */
+		if (tilewidth == (uint32) -1)
+			TIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth);
+		if (tilelength == (uint32) -1)
+			TIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength);
+		TIFFDefaultTileSize(out, &tilewidth, &tilelength);
+		TIFFSetField(out, TIFFTAG_TILEWIDTH, tilewidth);
+		TIFFSetField(out, TIFFTAG_TILELENGTH, tilelength);
+	} else {
+		/*
+		 * RowsPerStrip is left unspecified: use either the
+		 * value from the input image or, if nothing is defined,
+		 * use the library default.
+		 */
+		if (rowsperstrip == (uint32) -1)
+			TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
+		rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);
+		TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
+	}
+	if (config != (uint16) -1)
+		TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
+	else
+		CopyField(TIFFTAG_PLANARCONFIG, config);
+	if (g3opts != (uint32) -1)
+		TIFFSetField(out, TIFFTAG_GROUP3OPTIONS, g3opts);
+	else
+		CopyField(TIFFTAG_GROUP3OPTIONS, g3opts);
+	if (samplesperpixel <= 4) {
+		uint16 *tr, *tg, *tb, *ta;
+		CopyField4(TIFFTAG_TRANSFERFUNCTION, tr, tg, tb, ta);
+	}
+	{ uint16 *red, *green, *blue;
+	  if (TIFFGetField(in, TIFFTAG_COLORMAP, &red, &green, &blue)) {
+		CheckAndCorrectColormap(in, 1<<bitspersample, red, green, blue);
+		TIFFSetField(out, TIFFTAG_COLORMAP, red, green, blue);
+	  }
+	}
+/* SMinSampleValue & SMaxSampleValue */
+	switch (compression) {
+	case COMPRESSION_JPEG:
+		TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
+		TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
+		break;
+	case COMPRESSION_LZW:
+	case COMPRESSION_DEFLATE:
+		if (predictor != (uint16)-1)
+			TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
+		else
+			CopyField(TIFFTAG_PREDICTOR, predictor);
+		break;
+	}
+	cpOtherTags(in, out);
+
+	if (geofile)
+            InstallGeoTIFF(out);
+        else
+            CopyGeoTIFF(in,out);
+
+        if( worldfile )
+            ApplyWorldFile( worldfile, out);
+
+	cf = pickCopyFunc(in, out, bitspersample, samplesperpixel);
+	return (cf ? (*cf)(in, out, l, w, samplesperpixel) : FALSE);
+}
+
+/*
+ * Copy Functions.
+ */
+#define	DECLAREcpFunc(x) \
+static int x(TIFF* in, TIFF* out, \
+    uint32 imagelength, uint32 imagewidth, tsample_t spp)
+
+#define	DECLAREreadFunc(x) \
+static void x(TIFF* in, \
+    unsigned char* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)
+typedef void (*readFunc)(TIFF*, unsigned char*, uint32, uint32, tsample_t);
+
+#define	DECLAREwriteFunc(x) \
+static int x(TIFF* out, \
+    unsigned char* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)
+typedef int (*writeFunc)(TIFF*, unsigned char*, uint32, uint32, tsample_t);
+
+/*
+ * Contig -> contig by scanline for rows/strip change.
+ */
+DECLAREcpFunc(cpContig2ContigByRow)
+{
+	unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
+	uint32 row;
+
+	(void) imagewidth; (void) spp;
+	for (row = 0; row < imagelength; row++) {
+		if (TIFFReadScanline(in, buf, row, 0) < 0 && !ignore)
+			goto done;
+		if (TIFFWriteScanline(out, buf, row, 0) < 0)
+			goto bad;
+	}
+done:
+	_TIFFfree(buf);
+	return (TRUE);
+bad:
+	_TIFFfree(buf);
+	return (FALSE);
+}
+
+/*
+ * Contig -> contig by scanline for rows/strip change.
+ */
+DECLAREcpFunc(cpContig2ContigByRow_8_to_4)
+{
+    unsigned char *buf_in = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
+    unsigned char *buf_out = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
+    uint32 row;
+
+    printf( "Downsample\n" );
+
+    (void) imagewidth; (void) spp;
+    for (row = 0; row < imagelength; row++) {
+        int i_in, i_out_byte;
+            
+        if (TIFFReadScanline(in, buf_in, row, 0) < 0 && !ignore)
+            goto done;
+
+        for( i_in = 0, i_out_byte = 0;
+             i_in < imagewidth;
+             i_in += 2, i_out_byte++ )
+        {
+            buf_out[i_out_byte] =
+                (buf_in[i_in] & 0xf)*16 + (buf_in[i_in+1] & 0xf);
+        }
+        
+        if (TIFFWriteScanline(out, buf_out, row, 0) < 0)
+            goto bad;
+    }
+  done:
+    _TIFFfree(buf_in);
+    _TIFFfree(buf_out);
+    return (TRUE);
+  bad:
+    _TIFFfree(buf_in);
+    _TIFFfree(buf_out);
+    return (FALSE);
+}
+
+/*
+ * Strip -> strip for change in encoding.
+ */
+DECLAREcpFunc(cpDecodedStrips)
+{
+	tsize_t stripsize  = TIFFStripSize(in);
+	unsigned char *buf = (unsigned char *)_TIFFmalloc(stripsize);
+
+	(void) imagewidth; (void) spp;
+	if (buf) {
+		tstrip_t s, ns = TIFFNumberOfStrips(in);
+		uint32 row = 0;
+		for (s = 0; s < ns; s++) {
+			tsize_t cc = (row + rowsperstrip > imagelength) ?
+			    TIFFVStripSize(in, imagelength - row) : stripsize;
+			if (TIFFReadEncodedStrip(in, s, buf, cc) < 0 && !ignore)
+				break;
+			if (TIFFWriteEncodedStrip(out, s, buf, cc) < 0) {
+				_TIFFfree(buf);
+				return (FALSE);
+			}
+			row += rowsperstrip;
+		}
+		_TIFFfree(buf);
+		return (TRUE);
+	}
+	return (FALSE);
+}
+
+/*
+ * Separate -> separate by row for rows/strip change.
+ */
+DECLAREcpFunc(cpSeparate2SeparateByRow)
+{
+	unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
+	uint32 row;
+	tsample_t s;
+
+	(void) imagewidth;
+	for (s = 0; s < spp; s++) {
+		for (row = 0; row < imagelength; row++) {
+			if (TIFFReadScanline(in, buf, row, s) < 0 && !ignore)
+				goto done;
+			if (TIFFWriteScanline(out, buf, row, s) < 0)
+				goto bad;
+		}
+	}
+done:
+	_TIFFfree(buf);
+	return (TRUE);
+bad:
+	_TIFFfree(buf);
+	return (FALSE);
+}
+
+/*
+ * Contig -> separate by row.
+ */
+DECLAREcpFunc(cpContig2SeparateByRow)
+{
+	unsigned char *inbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
+	unsigned char *outbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
+	register unsigned char *inp, *outp;
+	register uint32 n;
+	uint32 row;
+	tsample_t s;
+
+	/* unpack channels */
+	for (s = 0; s < spp; s++) {
+		for (row = 0; row < imagelength; row++) {
+			if (TIFFReadScanline(in, inbuf, row, 0) < 0 && !ignore)
+				goto done;
+			inp = inbuf + s;
+			outp = outbuf;
+			for (n = imagewidth; n-- > 0;) {
+				*outp++ = *inp;
+				inp += spp;
+			}
+			if (TIFFWriteScanline(out, outbuf, row, s) < 0)
+				goto bad;
+		}
+	}
+done:
+	if (inbuf) _TIFFfree(inbuf);
+	if (outbuf) _TIFFfree(outbuf);
+	return (TRUE);
+bad:
+	if (inbuf) _TIFFfree(inbuf);
+	if (outbuf) _TIFFfree(outbuf);
+	return (FALSE);
+}
+
+/*
+ * Separate -> contig by row.
+ */
+DECLAREcpFunc(cpSeparate2ContigByRow)
+{
+	unsigned char *inbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
+	unsigned char *outbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
+	register unsigned char *inp, *outp;
+	register uint32 n;
+	uint32 row;
+	tsample_t s;
+
+	for (row = 0; row < imagelength; row++) {
+		/* merge channels */
+		for (s = 0; s < spp; s++) {
+			if (TIFFReadScanline(in, inbuf, row, s) < 0 && !ignore)
+				goto done;
+			inp = inbuf;
+			outp = outbuf + s;
+			for (n = imagewidth; n-- > 0;) {
+				*outp = *inp++;
+				outp += spp;
+			}
+		}
+		if (TIFFWriteScanline(out, outbuf, row, 0) < 0)
+			goto bad;
+	}
+done:
+	if (inbuf) _TIFFfree(inbuf);
+	if (outbuf) _TIFFfree(outbuf);
+	return (TRUE);
+bad:
+	if (inbuf) _TIFFfree(inbuf);
+	if (outbuf) _TIFFfree(outbuf);
+	return (FALSE);
+}
+
+static void
+cpStripToTile(unsigned char* out, unsigned char* in,
+	uint32 rows, uint32 cols, int outskew, int inskew)
+{
+	while (rows-- > 0) {
+		uint32 j = cols;
+		while (j-- > 0)
+			*out++ = *in++;
+		out += outskew;
+		in += inskew;
+	}
+}
+
+static void
+cpContigBufToSeparateBuf(unsigned char* out, unsigned char* in,
+	uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp)
+{
+	while (rows-- > 0) {
+		uint32 j = cols;
+		while (j-- > 0)
+			*out++ = *in, in += spp;
+		out += outskew;
+		in += inskew;
+	}
+}
+
+static void
+cpSeparateBufToContigBuf(unsigned char* out, unsigned char* in,
+	uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp)
+{
+	while (rows-- > 0) {
+		uint32 j = cols;
+		while (j-- > 0)
+			*out = *in++, out += spp;
+		out += outskew;
+		in += inskew;
+	}
+}
+
+static int
+cpImage(TIFF* in, TIFF* out, readFunc fin, writeFunc fout,
+	uint32 imagelength, uint32 imagewidth, tsample_t spp)
+{
+	int status = FALSE;
+	unsigned char* buf = (unsigned char *)
+	    _TIFFmalloc(TIFFRasterScanlineSize(in) * imagelength);
+	if (buf) {
+		(*fin)(in, buf, imagelength, imagewidth, spp);
+		status = (fout)(out, buf, imagelength, imagewidth, spp);
+		_TIFFfree(buf);
+	}
+	return (status);
+}
+
+DECLAREreadFunc(readContigStripsIntoBuffer)
+{
+	tsize_t scanlinesize = TIFFScanlineSize(in);
+     	unsigned char *bufp = buf;
+	uint32 row;
+
+	(void) imagewidth; (void) spp;
+	for (row = 0; row < imagelength; row++) {
+		if (TIFFReadScanline(in, bufp, row, 0) < 0 && !ignore)
+			break;
+		bufp += scanlinesize;
+	}
+}
+
+DECLAREreadFunc(readSeparateStripsIntoBuffer)
+{
+	tsize_t scanlinesize = TIFFScanlineSize(in);
+	unsigned char* scanline = (unsigned char *) _TIFFmalloc(scanlinesize);
+
+	(void) imagewidth;
+	if (scanline) {
+		unsigned char *bufp = buf;
+		uint32 row;
+		tsample_t s;
+
+		for (row = 0; row < imagelength; row++) {
+			/* merge channels */
+			for (s = 0; s < spp; s++) {
+				unsigned char* sp = scanline;
+				unsigned char* bp = bufp + s;
+				tsize_t n = scanlinesize;
+
+				if (TIFFReadScanline(in, sp, row, s) < 0 && !ignore)
+					goto done;
+				while (n-- > 0)
+					*bp = *bufp++, bp += spp;
+			}
+			bufp += scanlinesize;
+		}
+done:
+		_TIFFfree(scanline);
+	}
+}
+
+DECLAREreadFunc(readContigTilesIntoBuffer)
+{
+	unsigned char* tilebuf = (unsigned char *) _TIFFmalloc(TIFFTileSize(in));
+	uint32 imagew = TIFFScanlineSize(in);
+	uint32 tilew  = TIFFTileRowSize(in);
+	int iskew = imagew - tilew;
+	unsigned char *bufp = buf;
+	uint32 tw, tl;
+	uint32 row;
+
+	(void) spp;
+	if (tilebuf == 0)
+		return;
+	(void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
+	(void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
+	for (row = 0; row < imagelength; row += tl) {
+		uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
+		uint32 colb = 0;
+		uint32 col;
+
+		for (col = 0; col < imagewidth; col += tw) {
+			if (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0 &&
+			    !ignore)
+				goto done;
+			if (colb + tilew > imagew) {
+				uint32 width = imagew - colb;
+				uint32 oskew = tilew - width;
+				cpStripToTile(bufp + colb,
+					tilebuf, nrow, width,
+					oskew + iskew, oskew);
+			} else
+				cpStripToTile(bufp + colb,
+					tilebuf, nrow, tilew,
+					iskew, 0);
+			colb += tilew;
+		}
+		bufp += imagew * nrow;
+	}
+done:
+	_TIFFfree(tilebuf);
+}
+
+DECLAREreadFunc(readSeparateTilesIntoBuffer)
+{
+	uint32 imagew = TIFFScanlineSize(in);
+	uint32 tilew = TIFFTileRowSize(in);
+	int iskew  = imagew - tilew;
+	unsigned char* tilebuf = (unsigned char *) _TIFFmalloc(TIFFTileSize(in));
+	unsigned char *bufp = buf;
+	uint32 tw, tl;
+	uint32 row;
+
+	if (tilebuf == 0)
+		return;
+	(void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
+	(void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
+	for (row = 0; row < imagelength; row += tl) {
+		uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
+		uint32 colb = 0;
+		uint32 col;
+
+		for (col = 0; col < imagewidth; col += tw) {
+			tsample_t s;
+
+			for (s = 0; s < spp; s++) {
+				if (TIFFReadTile(in, tilebuf, col, row, 0, s) < 0 && !ignore)
+					goto done;
+				/*
+				 * Tile is clipped horizontally.  Calculate
+				 * visible portion and skewing factors.
+				 */
+				if (colb + tilew > imagew) {
+					uint32 width = imagew - colb;
+					int oskew = tilew - width;
+					cpSeparateBufToContigBuf(bufp+colb+s,
+					    tilebuf, nrow, width,
+					    oskew + iskew, oskew, spp);
+				} else
+					cpSeparateBufToContigBuf(bufp+colb+s,
+					    tilebuf, nrow, tw,
+					    iskew, 0, spp);
+			}
+			colb += tilew;
+		}
+		bufp += imagew * nrow;
+	}
+done:
+	_TIFFfree(tilebuf);
+}
+
+DECLAREwriteFunc(writeBufferToContigStrips)
+{
+	tsize_t scanline = TIFFScanlineSize(out);
+	uint32 row;
+
+	(void) imagewidth; (void) spp;
+	for (row = 0; row < imagelength; row++) {
+		if (TIFFWriteScanline(out, buf, row, 0) < 0)
+			return (FALSE);
+		buf += scanline;
+	}
+	return (TRUE);
+}
+
+DECLAREwriteFunc(writeBufferToSeparateStrips)
+{
+	unsigned char *obuf = (unsigned char *) _TIFFmalloc(TIFFScanlineSize(out));
+	tsample_t s;
+
+	if (obuf == NULL)
+		return (0);
+	for (s = 0; s < spp; s++) {
+		uint32 row;
+		for (row = 0; row < imagelength; row++) {
+			unsigned char* inp = buf + s;
+			unsigned char* outp = obuf;
+			uint32 n = imagewidth;
+
+			while (n-- > 0)
+				*outp++ = *inp, inp += spp;
+			if (TIFFWriteScanline(out, obuf, row, s) < 0) {
+				_TIFFfree(obuf);
+				return (FALSE);
+			}
+		}
+	}
+	_TIFFfree(obuf);
+	return (TRUE);
+
+}
+
+DECLAREwriteFunc(writeBufferToContigTiles)
+{
+	uint32 imagew = TIFFScanlineSize(out);
+	uint32 tilew  = TIFFTileRowSize(out);
+	int iskew = imagew - tilew;
+	unsigned char* obuf = (unsigned char *) _TIFFmalloc(TIFFTileSize(out));
+	unsigned char* bufp = buf;
+	uint32 tl, tw;
+	uint32 row;
+
+	(void) spp;
+	if (obuf == NULL)
+		return (FALSE);
+	(void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
+	(void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
+	for (row = 0; row < imagelength; row += tilelength) {
+		uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
+		uint32 colb = 0;
+		uint32 col;
+
+		for (col = 0; col < imagewidth; col += tw) {
+			/*
+			 * Tile is clipped horizontally.  Calculate
+			 * visible portion and skewing factors.
+			 */
+			if (colb + tilew > imagew) {
+				uint32 width = imagew - colb;
+				int oskew = tilew - width;
+				cpStripToTile(obuf, bufp + colb, nrow, width,
+				    oskew, oskew + iskew);
+			} else
+				cpStripToTile(obuf, bufp + colb, nrow, tilew,
+				    0, iskew);
+			if (TIFFWriteTile(out, obuf, col, row, 0, 0) < 0) {
+				_TIFFfree(obuf);
+				return (FALSE);
+			}
+			colb += tilew;
+		}
+		bufp += nrow * imagew;
+	}
+	_TIFFfree(obuf);
+	return (TRUE);
+}
+
+DECLAREwriteFunc(writeBufferToSeparateTiles)
+{
+	uint32 imagew = TIFFScanlineSize(out);
+	tsize_t tilew  = TIFFTileRowSize(out);
+	int iskew = imagew - tilew;
+	unsigned char *obuf = (unsigned char*) _TIFFmalloc(TIFFTileSize(out));
+	unsigned char *bufp = buf;
+	uint32 tl, tw;
+	uint32 row;
+
+	if (obuf == NULL)
+		return (FALSE);
+	(void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
+	(void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
+	for (row = 0; row < imagelength; row += tl) {
+		uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
+		uint32 colb = 0;
+		uint32 col;
+
+		for (col = 0; col < imagewidth; col += tw) {
+			tsample_t s;
+			for (s = 0; s < spp; s++) {
+				/*
+				 * Tile is clipped horizontally.  Calculate
+				 * visible portion and skewing factors.
+				 */
+				if (colb + tilew > imagew) {
+					uint32 width = imagew - colb;
+					int oskew = tilew - width;
+
+					cpContigBufToSeparateBuf(obuf,
+					    bufp + colb + s,
+					    nrow, width,
+					    oskew/spp, oskew + imagew, spp);
+				} else
+					cpContigBufToSeparateBuf(obuf,
+					    bufp + colb + s,
+					    nrow, tilewidth,
+					    0, iskew, spp);
+				if (TIFFWriteTile(out, obuf, col, row, 0, s) < 0) {
+					_TIFFfree(obuf);
+					return (FALSE);
+				}
+			}
+			colb += tilew;
+		}
+		bufp += nrow * imagew;
+	}
+	_TIFFfree(obuf);
+	return (TRUE);
+}
+
+/*
+ * Contig strips -> contig tiles.
+ */
+DECLAREcpFunc(cpContigStrips2ContigTiles)
+{
+	return cpImage(in, out,
+	    readContigStripsIntoBuffer,
+	    writeBufferToContigTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Contig strips -> separate tiles.
+ */
+DECLAREcpFunc(cpContigStrips2SeparateTiles)
+{
+	return cpImage(in, out,
+	    readContigStripsIntoBuffer,
+	    writeBufferToSeparateTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate strips -> contig tiles.
+ */
+DECLAREcpFunc(cpSeparateStrips2ContigTiles)
+{
+	return cpImage(in, out,
+	    readSeparateStripsIntoBuffer,
+	    writeBufferToContigTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate strips -> separate tiles.
+ */
+DECLAREcpFunc(cpSeparateStrips2SeparateTiles)
+{
+	return cpImage(in, out,
+	    readSeparateStripsIntoBuffer,
+	    writeBufferToSeparateTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Contig strips -> contig tiles.
+ */
+DECLAREcpFunc(cpContigTiles2ContigTiles)
+{
+	return cpImage(in, out,
+	    readContigTilesIntoBuffer,
+	    writeBufferToContigTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Contig tiles -> separate tiles.
+ */
+DECLAREcpFunc(cpContigTiles2SeparateTiles)
+{
+	return cpImage(in, out,
+	    readContigTilesIntoBuffer,
+	    writeBufferToSeparateTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate tiles -> contig tiles.
+ */
+DECLAREcpFunc(cpSeparateTiles2ContigTiles)
+{
+	return cpImage(in, out,
+	    readSeparateTilesIntoBuffer,
+	    writeBufferToContigTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate tiles -> separate tiles (tile dimension change).
+ */
+DECLAREcpFunc(cpSeparateTiles2SeparateTiles)
+{
+	return cpImage(in, out,
+	    readSeparateTilesIntoBuffer,
+	    writeBufferToSeparateTiles,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Contig tiles -> contig tiles (tile dimension change).
+ */
+DECLAREcpFunc(cpContigTiles2ContigStrips)
+{
+	return cpImage(in, out,
+	    readContigTilesIntoBuffer,
+	    writeBufferToContigStrips,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Contig tiles -> separate strips.
+ */
+DECLAREcpFunc(cpContigTiles2SeparateStrips)
+{
+	return cpImage(in, out,
+	    readContigTilesIntoBuffer,
+	    writeBufferToSeparateStrips,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate tiles -> contig strips.
+ */
+DECLAREcpFunc(cpSeparateTiles2ContigStrips)
+{
+	return cpImage(i