[DebianGIS-dev] r1077 - in packages/geotiff: . libgeotiff-dfsg libgeotiff-dfsg/trunk libgeotiff-dfsg/trunk/bin libgeotiff-dfsg/trunk/debian libgeotiff-dfsg/trunk/debian/patches libgeotiff-dfsg/trunk/docs libgeotiff-dfsg/trunk/docs/api libgeotiff-dfsg/trunk/libxtiff

frankie at alioth.debian.org frankie at alioth.debian.org
Wed Sep 19 11:39:06 UTC 2007


Author: frankie
Date: 2007-09-19 11:39:06 +0000 (Wed, 19 Sep 2007)
New Revision: 1077

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

Added: packages/geotiff/libgeotiff-dfsg/trunk/.cvsignore
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/.cvsignore	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/.cvsignore	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/ChangeLog
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/ChangeLog	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/ChangeLog	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/Doxyfile
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/Doxyfile	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/Doxyfile	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/HOWTO-RELEASE
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/HOWTO-RELEASE	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/HOWTO-RELEASE	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/LICENSE
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/LICENSE	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/LICENSE	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/Makefile.in
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/Makefile.in	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/Makefile.in	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/README
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/README	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/README	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/README.WIN
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/README.WIN	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/README.WIN	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/README_BIN
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/README_BIN	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/README_BIN	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/aclocal.m4
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/aclocal.m4	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/aclocal.m4	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/bin/.cvsignore
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/bin/.cvsignore	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/bin/.cvsignore	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,4 @@
+Makefile
+makegeo
+listgeo
+geotifcp

Added: packages/geotiff/libgeotiff-dfsg/trunk/bin/Makefile.in
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/bin/Makefile.in	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/bin/Makefile.in	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/bin/csv2html.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/bin/csv2html.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/bin/csv2html.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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/trunk/bin/geotifcp.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/bin/geotifcp.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/bin/geotifcp.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -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(in, out,
+	    readSeparateTilesIntoBuffer,
+	    writeBufferToContigStrips,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Separate tiles -> separate strips.
+ */
+DECLAREcpFunc(cpSeparateTiles2SeparateStrips)
+{
+	return cpImage(in, out,
+	    readSeparateTilesIntoBuffer,
+	    writeBufferToSeparateStrips,
+	    imagelength, imagewidth, spp);
+}
+
+/*
+ * Select the appropriate copy function to use.
+ */
+static copyFunc
+pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel)
+{
+	uint16 shortv;
+	uint32 w, l, tw, tl;
+	int bychunk;
+
+	(void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv);
+	if (shortv != config && bitspersample != 8 && samplesperpixel > 1) {
+		fprintf(stderr,
+"%s: Can not handle different planar configuration w/ bits/sample != 8\n",
+		    TIFFFileName(in));
+		return (NULL);
+	}
+	TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w);
+	TIFFGetField(in, TIFFTAG_IMAGELENGTH, &l);
+	if (TIFFIsTiled(out)) {
+		if (!TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw))
+			tw = w;
+		if (!TIFFGetField(in, TIFFTAG_TILELENGTH, &tl))
+			tl = l;
+		bychunk = (tw == tilewidth && tl == tilelength);
+	} else if (TIFFIsTiled(in)) {
+		TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
+		TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
+		bychunk = (tw == w && tl == rowsperstrip);
+	} else {
+		uint32 irps = (uint32) -1L;
+		TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &irps);
+		bychunk = (rowsperstrip == irps);
+	}
+#define	T 1
+#define	F 0
+#define pack(a,b,c,d,e)	((long)(((a)<<11)|((b)<<3)|((c)<<2)|((d)<<1)|(e)))
+	switch(pack(shortv,config,TIFFIsTiled(in),TIFFIsTiled(out),bychunk)) {
+/* Strips -> Tiles */
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,T,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,T,T):
+		return cpContigStrips2ContigTiles;
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, F,T,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, F,T,T):
+		return cpContigStrips2SeparateTiles;
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,T,F):
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,T,T):
+		return cpSeparateStrips2ContigTiles;
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,F):
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,T):
+		return cpSeparateStrips2SeparateTiles;
+/* Tiles -> Tiles */
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,T,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,T,T):
+		return cpContigTiles2ContigTiles;
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,T,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,T,T):
+		return cpContigTiles2SeparateTiles;
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,T,F):
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,T,T):
+		return cpSeparateTiles2ContigTiles;
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,F):
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,T):
+		return cpSeparateTiles2SeparateTiles;
+/* Tiles -> Strips */
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,F,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   T,F,T):
+		return cpContigTiles2ContigStrips;
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,F,F):
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_SEPARATE, T,F,T):
+		return cpContigTiles2SeparateStrips;
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,F,F):
+        case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   T,F,T):
+		return cpSeparateTiles2ContigStrips;
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,F):
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,T):
+		return cpSeparateTiles2SeparateStrips;
+/* Strips -> Strips */
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,F,F):
+          if( convert_8_to_4 )
+              return cpContig2ContigByRow_8_to_4;
+          else
+              return cpContig2ContigByRow;
+          
+	case pack(PLANARCONFIG_CONTIG,   PLANARCONFIG_CONTIG,   F,F,T):
+          if( convert_8_to_4 )
+              return cpContig2ContigByRow_8_to_4;
+          else
+              return cpDecodedStrips;
+	case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE,   F,F,F):
+	case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE,   F,F,T):
+		return cpContig2SeparateByRow;
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,F,F):
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG,   F,F,T):
+		return cpSeparate2ContigByRow;
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,F):
+	case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,T):
+		return cpSeparate2SeparateByRow;
+	}
+#undef pack
+#undef F
+#undef T
+	fprintf(stderr, "tiffcp: %s: Don't know how to copy/convert image.\n",
+	    TIFFFileName(in));
+	return (NULL);
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/bin/getopt.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/bin/getopt.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/bin/getopt.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 1987 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *	This product includes software developed by the University of
+ *	California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+static char sccsid[] = "@(#)getopt.c	4.13 (Berkeley) 2/23/91";
+#endif /* LIBC_SCCS and not lint */
+
+#include <stdio.h>
+#include <string.h>
+
+/*
+ * get option letter from argument vector
+ */
+int	opterr = 1,		/* if error message should be printed */
+	optind = 1,		/* index into parent argv vector */
+	optopt;			/* character checked for validity */
+char	*optarg;		/* argument associated with option */
+
+#define	BADCH	(int)'?'
+#define	EMSG	""
+
+int
+getopt(int nargc, char** nargv, char* ostr)
+{
+	static char *place = EMSG;		/* option letter processing */
+	register char *oli;			/* option letter list index */
+	char *p;
+
+	if (!*place) {				/* update scanning pointer */
+		if (optind >= nargc || *(place = nargv[optind]) != '-') {
+			place = EMSG;
+			return(EOF);
+		}
+		if (place[1] && *++place == '-') {	/* found "--" */
+			++optind;
+			place = EMSG;
+			return(EOF);
+		}
+	}					/* option letter okay? */
+	if ((optopt = (int)*place++) == (int)':' ||
+	    !(oli = strchr(ostr, optopt))) {
+		/*
+		 * if the user didn't specify '-' as an option,
+		 * assume it means EOF.
+		 */
+		if (optopt == (int)'-')
+			return(EOF);
+		if (!*place)
+			++optind;
+		if (opterr) {
+			if (!(p = strrchr(*nargv, '/')))
+				p = *nargv;
+			else
+				++p;
+			(void)fprintf(stderr, "%s: illegal option -- %c\n",
+			    p, optopt);
+		}
+		return(BADCH);
+	}
+	if (*++oli != ':') {			/* don't need argument */
+		optarg = NULL;
+		if (!*place)
+			++optind;
+	}
+	else {					/* need an argument */
+		if (*place)			/* no white space */
+			optarg = place;
+		else if (nargc <= ++optind) {	/* no arg */
+			place = EMSG;
+			if (!(p = strrchr(*nargv, '/')))
+				p = *nargv;
+			else
+				++p;
+			if (opterr)
+				(void)fprintf(stderr,
+				    "%s: option requires an argument -- %c\n",
+				    p, optopt);
+			return(BADCH);
+		}
+	 	else				/* white space */
+			optarg = nargv[optind];
+		place = EMSG;
+		++optind;
+	}
+	return(optopt);				/* dump back option letter */
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/bin/listgeo.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/bin/listgeo.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/bin/listgeo.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,310 @@
+/*
+ * listgeo.c -- example client code for LIBGEO geographic
+ *     TIFF tag support. Dumps info to GeoTIFF metadata file.
+ *
+ *  Author: Niles D. Ritter
+ *
+ */
+
+#include "geotiff.h"
+#include "xtiffio.h"
+#include "geo_normalize.h"
+#include "geovalues.h"
+#include "tiffio.h"
+#include "cpl_serv.h"
+#include <stdio.h>
+
+static void WriteTFWFile( GTIF * gtif, const char * tif_filename );
+static void GTIFPrintCorners( GTIF *, GTIFDefn *, FILE *, int, int, int, int );
+static const char *CSVFileOverride( const char * );
+static const char *CSVDirName = NULL;
+
+void Usage()
+
+{
+    printf( 
+        "%s", 
+        "Usage: listgeo [-d] [-tfw] [-proj4] [-no_norm] [-t tabledir] filename\n"
+        "\n"
+        "  -d: report lat/long corners in decimal degrees instead of DMS.\n"
+        "  -tfw: Generate a .tfw (ESRI TIFF World) file for the target file.\n"
+        "  -proj4: Report PROJ.4 equivelent projection definition.\n"
+        "  -no_norm: Don't report 'normalized' parameter values.\n"
+        "  filename: Name of the GeoTIFF file to report on.\n" );
+        
+    exit( 1 );
+}
+
+int main(int argc, char *argv[])
+{
+    char	*fname = NULL;
+    TIFF 	*tif=(TIFF*)0;  /* TIFF-level descriptor */
+    GTIF	*gtif=(GTIF*)0; /* GeoKey-level descriptor */
+    int		i, norm_print_flag = 1, proj4_print_flag = 0;
+    int		tfw_flag = 0, inv_flag = 0, dec_flag = 0;
+
+    /*
+     * Handle command line options.
+     */
+    for( i = 1; i < argc; i++ )
+    {
+        if( strcmp(argv[i],"-no_norm") == 0 )
+            norm_print_flag = 0;
+        else if( strcmp(argv[i],"-t") == 0 )
+        {
+            CSVDirName = argv[++i];
+            SetCSVFilenameHook( CSVFileOverride );
+        }
+        else if( strcmp(argv[i],"-tfw") == 0 )
+            tfw_flag = 1;
+        else if( strcmp(argv[i],"-proj4") == 0 )
+            proj4_print_flag = 1;
+        else if( strcmp(argv[i],"-i") == 0 )
+            inv_flag = 1;
+        else if( strcmp(argv[i],"-d") == 0 )
+            dec_flag = 1;
+        else if( fname == NULL && argv[i][0] != '-' )
+            fname = argv[i];
+        else
+        {
+            Usage();
+        }
+    }
+
+    if( fname == NULL )
+        Usage();
+
+    /*
+     * Open the file, read the GeoTIFF information, and print to stdout. 
+     */
+
+    tif=XTIFFOpen(fname,"r");
+    if (!tif) goto failure;
+	
+    gtif = GTIFNew(tif);
+    if (!gtif)
+    {
+        fprintf(stderr,"failed in GTIFNew\n");
+        goto failure;
+    }
+
+    if( tfw_flag )
+    {
+        WriteTFWFile( gtif, fname );
+
+        goto Success;
+    }
+	
+    /* dump the GeoTIFF metadata to std out */
+
+    GTIFPrint(gtif,0,0);
+
+    /*
+     * Capture, and report normalized information if requested.
+     */
+
+    if( norm_print_flag )
+    {
+        GTIFDefn	defn;
+        
+        if( GTIFGetDefn( gtif, &defn ) )
+        {
+            int		xsize, ysize;
+            
+            printf( "\n" );
+            GTIFPrintDefn( &defn, stdout );
+
+            if( proj4_print_flag )
+            {
+                printf( "\n" );
+                printf( "PROJ.4 Definition: %s\n", GTIFGetProj4Defn(&defn));
+            }
+            
+            TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &xsize );
+            TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &ysize );
+            GTIFPrintCorners( gtif, &defn, stdout, xsize, ysize, inv_flag, dec_flag );
+        }
+
+    }
+
+  Success:
+    GTIFFree(gtif);
+    XTIFFClose(tif);
+    return 0;
+		
+  failure:
+    fprintf(stderr,"failure in listgeo\n");
+    if (tif) XTIFFClose(tif);
+    if (gtif) GTIFFree(gtif);
+    return 1;
+}
+
+static const char *CSVFileOverride( const char * pszInput )
+
+{
+    static char		szPath[1024];
+
+#ifdef WIN32
+    sprintf( szPath, "%s\\%s", CSVDirName, pszInput );
+#else    
+    sprintf( szPath, "%s/%s", CSVDirName, pszInput );
+#endif    
+
+    return( szPath );
+}
+
+/*
+ * Report the file(s) corner coordinates in projected coordinates, and
+ * if possible lat/long.
+ */
+
+static int GTIFReportACorner( GTIF *gtif, GTIFDefn *defn, FILE * fp_out,
+                              const char * corner_name,
+                              double x, double y, int inv_flag, int dec_flag )
+
+{
+    double	x_saved, y_saved;
+
+    /* Try to transform the coordinate into PCS space */
+    if( !GTIFImageToPCS( gtif, &x, &y ) )
+        return FALSE;
+    
+    x_saved = x;
+    y_saved = y;
+
+    fprintf( fp_out, "%-13s ", corner_name );
+
+    if( defn->Model == ModelTypeGeographic )
+    {
+	if (dec_flag) 
+	{
+	    fprintf( fp_out, "(%.7f,", x );
+	    fprintf( fp_out, "%.7f)\n", y );
+	} 
+	else 
+	{
+	    fprintf( fp_out, "(%s,", GTIFDecToDMS( x, "Long", 2 ) );
+	    fprintf( fp_out, "%s)\n", GTIFDecToDMS( y, "Lat", 2 ) );
+	}
+    }
+    else
+    {
+        fprintf( fp_out, "(%12.3f,%12.3f)", x, y );
+
+        if( GTIFProj4ToLatLong( defn, 1, &x, &y ) )
+        {
+	    if (dec_flag) 
+	    {
+                fprintf( fp_out, "  (%.7f,", x );
+                fprintf( fp_out, "%.7f)", y );
+	    } 
+	    else 
+	    {
+		fprintf( fp_out, "  (%s,", GTIFDecToDMS( x, "Long", 2 ) );
+		fprintf( fp_out, "%s)", GTIFDecToDMS( y, "Lat", 2 ) );
+	    }
+        }
+
+        fprintf( fp_out, "\n" );
+    }
+
+    if( inv_flag && GTIFPCSToImage( gtif, &x_saved, &y_saved ) )
+    {
+        fprintf( fp_out, "      inverse (%11.3f,%11.3f)\n", x_saved, y_saved );
+    }
+    
+    return TRUE;
+}
+
+static void GTIFPrintCorners( GTIF *gtif, GTIFDefn *defn, FILE * fp_out,
+                              int xsize, int ysize, int inv_flag, int dec_flag )
+
+{
+    printf( "\nCorner Coordinates:\n" );
+    if( !GTIFReportACorner( gtif, defn, fp_out,
+                            "Upper Left", 0.0, 0.0, inv_flag, dec_flag ) )
+    {
+        printf( " ... unable to transform points between pixel/line and PCS space\n" );
+        return;
+    }
+
+    GTIFReportACorner( gtif, defn, fp_out, "Lower Left", 0.0, ysize, 
+                       inv_flag, dec_flag );
+    GTIFReportACorner( gtif, defn, fp_out, "Upper Right", xsize, 0.0,
+                       inv_flag, dec_flag );
+    GTIFReportACorner( gtif, defn, fp_out, "Lower Right", xsize, ysize,
+                       inv_flag, dec_flag );
+    GTIFReportACorner( gtif, defn, fp_out, "Center", xsize/2.0, ysize/2.0,
+                       inv_flag, dec_flag );
+}
+
+/*
+ * Write the defining matrix for this file to a .tfw file with the same
+ * basename.
+ */
+
+static void WriteTFWFile( GTIF * gtif, const char * tif_filename )
+
+{
+    char	tfw_filename[1024];
+    int		i;
+    double	adfCoeff[6], x, y;
+    FILE	*fp;
+
+    /*
+     * form .tfw filename
+     */
+    strncpy( tfw_filename, tif_filename, sizeof(tfw_filename)-4 );
+    for( i = strlen(tfw_filename)-1; i > 0; i-- )
+    {
+        if( tfw_filename[i] == '.' )
+        {
+            strcpy( tfw_filename + i, ".tfw" );
+            break;
+        }
+    }
+
+    if( i <= 0 )
+        strcat( tfw_filename, ".tfw" );
+
+    /*
+     * Compute the coefficients.
+     */
+    x = 0.5;
+    y = 0.5;
+    if( !GTIFImageToPCS( gtif, &x, &y ) )
+        return;
+    adfCoeff[4] = x;
+    adfCoeff[5] = y;
+
+    x = 1.5;
+    y = 0.5;
+    if( !GTIFImageToPCS( gtif, &x, &y ) )
+        return;
+    adfCoeff[0] = x - adfCoeff[4];
+    adfCoeff[1] = y - adfCoeff[5];
+
+    x = 0.5;
+    y = 1.5;
+    if( !GTIFImageToPCS( gtif, &x, &y ) )
+        return;
+    adfCoeff[2] = x - adfCoeff[4];
+    adfCoeff[3] = y - adfCoeff[5];
+
+    /*
+     * Write out the coefficients.
+     */
+
+    fp = fopen( tfw_filename, "wt" );
+    if( fp == NULL )
+    {
+        perror( "fopen" );
+        fprintf( stderr, "Failed to open TFW file `%s'\n", tfw_filename );
+        return;
+    }
+
+    for( i = 0; i < 6; i++ )
+        fprintf( fp, "%24.10f\n", adfCoeff[i] );
+
+    fclose( fp );
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/bin/makefile.mpw
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/bin/makefile.mpw	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/bin/makefile.mpw	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,58 @@
+#***********************************************************************
+#
+#  MPW build file for example GeoTIFF utilities
+#
+#  written by Niles D. Ritter.
+#
+CC = c
+AR = lib -o
+RM = delete -y
+LN = duplicate -y
+
+#debug option
+#DEBUG= -sym full
+DEBUG=
+
+# data/code model options
+#MODEL=
+MODEL= -model far
+
+TIFFLIB = :::libtiff:
+GEOTIFFLIB = ::
+PORT = :::port:
+
+LINK.c = Link   {LDFLAGS}
+.o Ä .c
+	{CC} {DEBUG} {CFLAGS} {CPPFLAGS}     {Default}.c -o {Default}.o
+LDFLAGS = {DEBUG} {MODEL} -c 'MPS ' -t MPST -w 
+CFLAGS = {MODEL}
+CPPFLAGS =  -I {TIFFLIB}  -I {GEOTIFFLIB}               
+OBJS = makegeo.o  listgeo.o geotifcp.o
+CLEANOBJS = makegeo.o      
+CLEANOTHER = newtif.tif 
+CLEANINC =
+LIBS =          {TIFFLIB}libtiff.o ¶
+		{GEOTIFFLIB}libgeotiff.o ¶
+		"{CLibraries}"StdClib.o ¶
+		"{Libraries}"Stubs.o ¶
+		"{Libraries}"Runtime.o ¶
+		"{Libraries}"Interface.o
+
+ALL = makegeo listgeo geotifcp
+
+all Ä {ALL} 
+
+compile Ä  {OBJS}
+
+makegeo Ä  makegeo.o {GEOTIFFLIB}libgeotiff.o
+	{LINK.c} -o makegeo makegeo.o {LIBS}
+	
+listgeo Ä  listgeo.o {GEOTIFFLIB}libgeotiff.o
+	{LINK.c} -o listgeo listgeo.o {LIBS}
+
+geotifcp Ä  geotifcp.o {GEOTIFFLIB}libgeotiff.o {PORT}libport.o
+	{LINK.c} -o geotifcp geotifcp.o {LIBS} {PORT}libport.o
+
+clean Ä 
+	{RM} {ALL} {CLEANOBJS} {CLEANOTHER}
+	

Added: packages/geotiff/libgeotiff-dfsg/trunk/bin/makegeo.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/bin/makegeo.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/bin/makegeo.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,102 @@
+/*
+ * makegeo.c -- example client code for LIBGEO geographic
+ *     TIFF tag support.
+ *
+ *  Author: Niles D. Ritter
+ *
+ * Revision History:
+ *   31 October, 1995    Fixed reversed lat-long coordinates   NDR
+ *
+ */
+
+#include "geotiffio.h"
+#include "xtiffio.h"
+#include <stdlib.h>
+#include <string.h>
+
+void SetUpTIFFDirectory(TIFF *tif);
+void SetUpGeoKeys(GTIF *gtif);
+void WriteImage(TIFF *tif);
+
+#define WIDTH 20L
+#define HEIGHT 20L
+
+int main()
+{
+	char *fname = "newgeo.tif";
+	TIFF *tif=(TIFF*)0;  /* TIFF-level descriptor */
+	GTIF *gtif=(GTIF*)0; /* GeoKey-level descriptor */
+	
+	tif=XTIFFOpen(fname,"w");
+	if (!tif) goto failure;
+	
+	gtif = GTIFNew(tif);
+	if (!gtif)
+	{
+		printf("failed in GTIFNew\n");
+		goto failure;
+	}
+	
+	SetUpTIFFDirectory(tif);
+	SetUpGeoKeys(gtif);
+	WriteImage(tif);
+	
+	GTIFWriteKeys(gtif);
+	GTIFFree(gtif);
+	XTIFFClose(tif);
+	return 0;
+	
+failure:
+	printf("failure in makegeo\n");
+	if (tif) TIFFClose(tif);
+	if (gtif) GTIFFree(gtif);
+	return -1;
+}
+
+
+void SetUpTIFFDirectory(TIFF *tif)
+{
+	double tiepoints[6]={0,0,0,130.0,32.0,0.0};
+	double pixscale[3]={1,1,0};
+	
+	TIFFSetField(tif,TIFFTAG_IMAGEWIDTH,    WIDTH);
+	TIFFSetField(tif,TIFFTAG_IMAGELENGTH,   HEIGHT);
+	TIFFSetField(tif,TIFFTAG_COMPRESSION,   COMPRESSION_NONE);
+	TIFFSetField(tif,TIFFTAG_PHOTOMETRIC,   PHOTOMETRIC_MINISBLACK);
+	TIFFSetField(tif,TIFFTAG_PLANARCONFIG,  PLANARCONFIG_CONTIG);
+	TIFFSetField(tif,TIFFTAG_BITSPERSAMPLE, 8);
+	TIFFSetField(tif,TIFFTAG_ROWSPERSTRIP,  20L);
+	
+	TIFFSetField(tif,TIFFTAG_GEOTIEPOINTS, 6,tiepoints);
+	TIFFSetField(tif,TIFFTAG_GEOPIXELSCALE, 3,pixscale);
+}
+
+void SetUpGeoKeys(GTIF *gtif)
+{
+	GTIFKeySet(gtif, GTModelTypeGeoKey, TYPE_SHORT, 1, ModelGeographic);
+	GTIFKeySet(gtif, GTRasterTypeGeoKey, TYPE_SHORT, 1, RasterPixelIsArea);
+	GTIFKeySet(gtif, GTCitationGeoKey, TYPE_ASCII, 0, "Just An Example");
+	GTIFKeySet(gtif, GeographicTypeGeoKey, TYPE_SHORT,  1, KvUserDefined);
+	GTIFKeySet(gtif, GeogCitationGeoKey, TYPE_ASCII, 0, "Everest Ellipsoid Used.");
+	GTIFKeySet(gtif, GeogAngularUnitsGeoKey, TYPE_SHORT,  1, Angular_Degree);
+	GTIFKeySet(gtif, GeogLinearUnitsGeoKey, TYPE_SHORT,  1, Linear_Meter);
+	GTIFKeySet(gtif, GeogGeodeticDatumGeoKey, TYPE_SHORT,     1, KvUserDefined);
+	GTIFKeySet(gtif, GeogEllipsoidGeoKey, TYPE_SHORT,     1, Ellipse_Everest_1830_1967_Definition);
+	GTIFKeySet(gtif, GeogSemiMajorAxisGeoKey, TYPE_DOUBLE, 1, (double)6377298.556);
+	GTIFKeySet(gtif, GeogInvFlatteningGeoKey, TYPE_DOUBLE, 1, (double)300.8017);
+}
+
+void WriteImage(TIFF *tif)
+{
+	int i;
+	char buffer[WIDTH];
+	
+	memset(buffer,0,(size_t)WIDTH);
+	for (i=0;i<HEIGHT;i++)
+		if (!TIFFWriteScanline(tif, buffer, i, 0))
+			TIFFError("WriteImage","failure in WriteScanline\n");
+}
+
+
+
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/config.guess
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/config.guess	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/config.guess	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,1516 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2007-07-22'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per at bothner.com>.
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    sh5el) machine=sh5le-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	# Debian GNU/NetBSD machines have a different userland, and
+	# thus, need a distinct triplet. However, they do not need
+	# kernel version information, so it can be replaced with a
+	# suitable tag, in the style of linux-gnu.
+	case "${UNAME_VERSION}" in
+	    Debian*)
+		release='-gnu'
+		;;
+	    *)
+		release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+		;;
+	esac
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit ;;
+    *:OpenBSD:*:*)
+	UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+	echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+	exit ;;
+    *:ekkoBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+	exit ;;
+    *:SolidBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+	exit ;;
+    macppc:MirBSD:*:*)
+	echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    *:MirBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+	exit ;;
+    alpha:OSF1:*:*)
+	case $UNAME_RELEASE in
+	*4.0)
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+		;;
+	*5.*)
+	        UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+		;;
+	esac
+	# According to Compaq, /usr/sbin/psrinfo has been available on
+	# OSF/1 and Tru64 systems produced since 1995.  I hope that
+	# covers most systems running today.  This code pipes the CPU
+	# types through head -n 1, so we only detect the type of CPU 0.
+	ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+	case "$ALPHA_CPU_TYPE" in
+	    "EV4 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV4.5 (21064)")
+		UNAME_MACHINE="alpha" ;;
+	    "LCA4 (21066/21068)")
+		UNAME_MACHINE="alpha" ;;
+	    "EV5 (21164)")
+		UNAME_MACHINE="alphaev5" ;;
+	    "EV5.6 (21164A)")
+		UNAME_MACHINE="alphaev56" ;;
+	    "EV5.6 (21164PC)")
+		UNAME_MACHINE="alphapca56" ;;
+	    "EV5.7 (21164PC)")
+		UNAME_MACHINE="alphapca57" ;;
+	    "EV6 (21264)")
+		UNAME_MACHINE="alphaev6" ;;
+	    "EV6.7 (21264A)")
+		UNAME_MACHINE="alphaev67" ;;
+	    "EV6.8CB (21264C)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8AL (21264B)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.8CX (21264D)")
+		UNAME_MACHINE="alphaev68" ;;
+	    "EV6.9A (21264/EV69A)")
+		UNAME_MACHINE="alphaev69" ;;
+	    "EV7 (21364)")
+		UNAME_MACHINE="alphaev7" ;;
+	    "EV7.9 (21364A)")
+		UNAME_MACHINE="alphaev79" ;;
+	esac
+	# A Pn.n version is a patched version.
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit ;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit ;;
+    *:z/VM:*:*)
+	echo s390-ibm-zvmoe
+	exit ;;
+    *:OS400:*:*)
+        echo powerpc-ibm-os400
+	exit ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit ;;
+    arm:riscos:*:*|arm:RISCOS:*:*)
+	echo arm-unknown-riscos
+	exit ;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit ;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit ;;
+    DRS?6000:unix:4.0:6*)
+	echo sparc-icl-nx6
+	exit ;;
+    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7; exit ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit ;;
+    m68k:machten:*:*)
+	echo m68k-apple-machten${UNAME_RELEASE}
+	exit ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c &&
+	  dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+	  SYSTEM_NAME=`$dummy $dummyarg` &&
+	    { echo "$SYSTEM_NAME"; exit; }
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+	echo powerpc-harris-powermax
+	exit ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
+	exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+		then
+			echo "$SYSTEM_NAME"
+		else
+			echo rs6000-ibm-aix3.2.5
+		fi
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit ;;                             # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+		    test -z "$HP_ARCH" && HP_ARCH=hppa
+		fi ;;
+	esac
+	if [ ${HP_ARCH} = "hppa2.0w" ]
+	then
+	    eval $set_cc_for_build
+
+	    # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+	    # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
+	    # generating 64-bit code.  GNU and HP use different nomenclature:
+	    #
+	    # $ CC_FOR_BUILD=cc ./config.guess
+	    # => hppa2.0w-hp-hpux11.23
+	    # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+	    # => hppa64-hp-hpux11.23
+
+	    if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+		grep __LP64__ >/dev/null
+	    then
+		HP_ARCH="hppa2.0w"
+	    else
+		HP_ARCH="hppa64"
+	    fi
+	fi
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+		{ echo "$SYSTEM_NAME"; exit; }
+	echo unknown-hitachi-hiuxwe2
+	exit ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    *:UNICOS/mp:*:*)
+	echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit ;;
+    5000:UNIX_System_V:4.*:*)
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+	exit ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit ;;
+    *:FreeBSD:*:*)
+	case ${UNAME_MACHINE} in
+	    pc98)
+		echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    amd64)
+		echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	    *)
+		echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+	esac
+	exit ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit ;;
+    *:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit ;;
+    i*:windows32*:*)
+    	# uname -m includes "-pc" on this system.
+    	echo ${UNAME_MACHINE}-mingw32
+	exit ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit ;;
+    *:Interix*:[3456]*)
+    	case ${UNAME_MACHINE} in
+	    x86)
+		echo i586-pc-interix${UNAME_RELEASE}
+		exit ;;
+	    EM64T | authenticamd)
+		echo x86_64-unknown-interix${UNAME_RELEASE}
+		exit ;;
+	esac ;;
+    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+	echo i${UNAME_MACHINE}-pc-mks
+	exit ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i586-pc-interix
+	exit ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit ;;
+    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+	echo x86_64-unknown-cygwin
+	exit ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit ;;
+    *:GNU:*:*)
+	# the GNU system
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit ;;
+    *:GNU/*:*:*)
+	# other systems with GNU libc and userland
+	echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+	exit ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    avr32*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    cris:Linux:*:*)
+	echo cris-axis-linux-gnu
+	exit ;;
+    crisv32:Linux:*:*)
+	echo crisv32-axis-linux-gnu
+	exit ;;
+    frv:Linux:*:*)
+    	echo frv-unknown-linux-gnu
+	exit ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m32r*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    mips64:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips64
+	#undef mips64el
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mips64el
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips64
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^CPU/{
+		s: ::g
+		p
+	    }'`"
+	test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+	;;
+    or32:Linux:*:*)
+	echo or32-unknown-linux-gnu
+	exit ;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit ;;
+    sh64*:Linux:*:*)
+    	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit ;;
+    vax:Linux:*:*)
+	echo ${UNAME_MACHINE}-dec-linux-gnu
+	exit ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit ;;
+    xtensa:Linux:*:*)
+    	echo xtensa-unknown-linux-gnu
+	exit ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+	#ifdef __dietlibc__
+	LIBC=dietlibc
+	#endif
+EOF
+	eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+	    /^LIBC/{
+		s: ::g
+		p
+	    }'`"
+	test x"${LIBC}" != x && {
+		echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+		exit
+	}
+	test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit ;;
+    i*86:syllable:*:*)
+	echo ${UNAME_MACHINE}-pc-syllable
+	exit ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit ;;
+    i*86:*:5:[678]*)
+    	# UnixWare 7.x, OpenUNIX and OpenServer 6.
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit ;;
+    M680?0:D-NIX:5.3:*)
+	echo m68k-diab-dnix
+	exit ;;
+    M68*:*:R3V[5678]*:*)
+	test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && { echo i486-ncr-sysv4; exit; } ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel at ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes at openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit ;;
+    *:*:*:FTX*)
+	# From seanf at swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit ;;
+    i*86:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo ${UNAME_MACHINE}-stratus-vos
+	exit ;;
+    *:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo hppa1.1-stratus-vos
+	exit ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-7:SUPER-UX:*:*)
+	echo sx7-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8:SUPER-UX:*:*)
+	echo sx8-nec-superux${UNAME_RELEASE}
+	exit ;;
+    SX-8R:SUPER-UX:*:*)
+	echo sx8r-nec-superux${UNAME_RELEASE}
+	exit ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit ;;
+    *:Darwin:*:*)
+	UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+	case $UNAME_PROCESSOR in
+	    unknown) UNAME_PROCESSOR=powerpc ;;
+	esac
+	echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+	exit ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+	echo nse-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    NSR-?:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit ;;
+    SEI:*:*:SEIUX)
+        echo mips-sei-seiux${UNAME_RELEASE}
+	exit ;;
+    *:DragonFly:*:*)
+	echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+	exit ;;
+    *:*VMS:*:*)
+    	UNAME_MACHINE=`(uname -p) 2>/dev/null`
+	case "${UNAME_MACHINE}" in
+	    A*) echo alpha-dec-vms ; exit ;;
+	    I*) echo ia64-dec-vms ; exit ;;
+	    V*) echo vax-dec-vms ; exit ;;
+	esac ;;
+    *:XENIX:*:SysV)
+	echo i386-pc-xenix
+	exit ;;
+    i*86:skyos:*:*)
+	echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+	exit ;;
+    i*86:rdos:*:*)
+	echo ${UNAME_MACHINE}-pc-rdos
+	exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+	{ echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit ;;
+    c34*)
+	echo c34-convex-bsd
+	exit ;;
+    c38*)
+	echo c38-convex-bsd
+	exit ;;
+    c4*)
+	echo c4-convex-bsd
+	exit ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:

Added: packages/geotiff/libgeotiff-dfsg/trunk/config.sub
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/config.sub	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/config.sub	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,1626 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+#   Inc.
+
+timestamp='2007-06-28'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit ;;
+    --version | -v )
+       echo "$version" ; exit ;;
+    --help | --h* | -h )
+       echo "$usage"; exit ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit ;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+  uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+  storm-chaos* | os2-emx* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis | -knuth | -cray)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco6)
+		os=-sco5v6
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco5v6*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| am33_2.0 \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+	| bfin \
+	| c4x | clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fido | fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k | iq2000 \
+	| m32c | m32r | m32rle | m68000 | m68k | m88k \
+	| maxq | mb | microblaze | mcore | mep \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mips64vr5900 | mips64vr5900el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa32r2 | mipsisa32r2el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64r2 | mipsisa64r2el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| mt \
+	| msp430 \
+	| nios | nios2 \
+	| ns16k | ns32k \
+	| or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| score \
+	| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+	| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+	| spu | strongarm \
+	| tahoe | thumb | tic4x | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+	ms1)
+		basic_machine=mt-unknown
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* | avr32-* \
+	| bfin-* | bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+	| clipper-* | craynv-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* | iq2000-* \
+	| m32c-* | m32r-* | m32rle-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | maxq-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mips64vr5900-* | mips64vr5900el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa32r2-* | mipsisa32r2el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64r2-* | mipsisa64r2el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39-* | mipstx39el-* \
+	| mmix-* \
+	| mt-* \
+	| msp430-* \
+	| nios-* | nios2-* \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+	| sparclite-* \
+	| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* \
+	| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+	| tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+	| xstormy16-* | xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+    	abacus)
+		basic_machine=abacus-unknown
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amd64)
+		basic_machine=x86_64-pc
+		;;
+	amd64-*)
+		basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	craynv)
+		basic_machine=craynv-cray
+		os=-unicosmp
+		;;
+	cr16)
+		basic_machine=cr16-unknown
+		os=-elf
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	crisv32 | crisv32-* | etraxfs*)
+		basic_machine=crisv32-axis
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	crx)
+		basic_machine=crx-unknown
+		os=-elf
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	djgpp)
+		basic_machine=i586-pc
+		os=-msdosdjgpp
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	mingw32ce)
+		basic_machine=arm-unknown
+		os=-mingw32ce
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	ms1-*)
+		basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	openrisc | openrisc-*)
+		basic_machine=or32-unknown
+		;;
+	os400)
+		basic_machine=powerpc-ibm
+		os=-os400
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pc98)
+		basic_machine=i386-pc
+		;;
+	pc98-*)
+		basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2 | pentiumiii | pentium3)
+		basic_machine=i686-pc
+		;;
+	pentium4)
+		basic_machine=i786-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentium4-*)
+		basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rdos)
+		basic_machine=i386-pc
+		os=-rdos
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sde)
+		basic_machine=mipsisa32-sde
+		os=-elf
+		;;
+	sei)
+		basic_machine=mips-sei
+		os=-seiux
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sh5el)
+		basic_machine=sh5le-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tic55x | c55x*)
+		basic_machine=tic55x-unknown
+		os=-coff
+		;;
+	tic6x | c6x*)
+		basic_machine=tic6x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	tpf)
+		basic_machine=s390x-ibm
+		os=-tpf
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	xbox)
+		basic_machine=i686-pc
+		os=-mingw32
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	mmix)
+		basic_machine=mmix-knuth
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+		basic_machine=sh-unknown
+		;;
+	sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+	      | -openbsd* | -solidbsd* \
+	      | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+	      | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+	      | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+	      | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+	      | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto-qnx*)
+		;;
+	-nto*)
+		os=`echo $os | sed -e 's|nto|nto-qnx|'`
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux-dietlibc)
+		os=-linux-dietlibc
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+        -os400*)
+		os=-os400
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-syllable*)
+		os=-syllable
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+        -tpf*)
+		os=-tpf
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-aros*)
+		os=-aros
+		;;
+	-kaos*)
+		os=-kaos
+		;;
+	-zvmoe)
+		os=-zvmoe
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+        score-*)
+		os=-elf
+		;;
+        spu-*)
+		os=-elf
+		;;
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+        c4x-* | tic4x-*)
+        	os=-coff
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+        mep-*)
+		os=-elf
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-haiku)
+		os=-haiku
+		;;
+	*-ibm)
+		os=-aix
+		;;
+    	*-knuth)
+		os=-mmixware
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-os400*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-tpf*)
+				vendor=ibm
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:

Added: packages/geotiff/libgeotiff-dfsg/trunk/configure
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/configure	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/configure	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,5585 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.59.
+#
+# Copyright (C) 2003 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="geotiff.h"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os VERSION_MAJOR VERSION_MINOR VERSION_POINT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX_WFLAGS C_WFLAGS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN_S RANLIB ac_ct_RANLIB CXX_PIC C_PIC LD_SHARED SO_EXT GEOTIFF_SO GEOTIFF_IMP GEOTIFF_DLL CPP EGREP ZIP_INC TIFF_INC PROJ_INC CSV_SOURCE LIBOBJS LTLIBOBJS'
+ac_subst_files=''
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+ac_prev=
+for ac_option
+do
+  # If the previous option needs an argument, assign it.
+  if test -n "$ac_prev"; then
+    eval "$ac_prev=\$ac_option"
+    ac_prev=
+    continue
+  fi
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    build_alias=$ac_optarg ;;
+
+  -cache-file | --cache-file | --cache-fil | --cache-fi \
+  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+    ac_prev=cache_file ;;
+  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
+
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir=$ac_optarg ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
+
+  -enable-* | --enable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "enable_$ac_feature='$ac_optarg'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
+
+  -host | --host | --hos | --ho)
+    ac_prev=host_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    host_alias=$ac_optarg ;;
+
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir=$ac_optarg ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir=$ac_optarg ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir=$ac_optarg ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir=$ac_optarg ;;
+
+  -nfp | --nfp | --nf)
+    # Obsolete; use --without-fp.
+    with_fp=no ;;
+
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    prefix=$ac_optarg ;;
+
+  -program-prefix | --program-prefix | --program-prefi | --program-pref \
+  | --program-pre | --program-pr | --program-p)
+    ac_prev=program_prefix ;;
+  -program-prefix=* | --program-prefix=* | --program-prefi=* \
+  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+    program_prefix=$ac_optarg ;;
+
+  -program-suffix | --program-suffix | --program-suffi | --program-suff \
+  | --program-suf | --program-su | --program-s)
+    ac_prev=program_suffix ;;
+  -program-suffix=* | --program-suffix=* | --program-suffi=* \
+  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+    program_suffix=$ac_optarg ;;
+
+  -program-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    srcdir=$ac_optarg ;;
+
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir=$ac_optarg ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package| sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
+
+  --x)
+    # Obsolete; use --with-x.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    ac_prev=x_includes ;;
+  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+    x_includes=$ac_optarg ;;
+
+  -x-libraries | --x-libraries | --x-librarie | --x-librari \
+  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+    ac_prev=x_libraries ;;
+  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+    x_libraries=$ac_optarg ;;
+
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
+    ;;
+
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
+  *)
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+    ;;
+
+  esac
+done
+
+if test -n "$ac_prev"; then
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+	      localstatedir libdir includedir oldincludedir infodir mandir
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+  ac_srcdir_defaulted=yes
+  # Try the directory containing this script, then its parent.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$0" : 'X\(//\)[^/]' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  srcdir=$ac_confdir
+  if test ! -r $srcdir/$ac_unique_file; then
+    srcdir=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+			  [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+			  [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+  --target=TARGET   configure for building compilers for TARGET [HOST]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --enable-incode-epsg	  Use C code EPSG tables
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --without-ld-shared   Disable shared library support
+  --with-zip=dir          Use ZIP library in directory dir
+  --with-jpeg=dir         Use JPEG library in directory dir
+  --with-libtiff=dir      Use libtiff in directory dir
+  --with-proj=ARG       Use PROJ.4 library (ARG=no or path)
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+	   test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd "$ac_popdir"
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+	ac_must_keep_next=false # Got value, back to normal.
+      else
+	case $ac_arg in
+	  *=* | --config-cache | -C | -disable-* | --disable-* \
+	  | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+	  | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+	  | -with-* | --with-* | -without-* | --without-* | --x)
+	    case "$ac_configure_args0 " in
+	      "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+	    esac
+	    ;;
+	  -* ) ac_must_keep_next=true ;;
+	esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+	"s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=$`echo $ac_var`
+	echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+  if test "x$prefix" != xNONE; then
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
+    . "$ac_site_file"
+  fi
+done
+
+if test -r "$cache_file"; then
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
+else
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+	       sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+	{ echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+	{ echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+	{ echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+	ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+          ac_config_headers="$ac_config_headers geo_config.h"
+
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
+
+# Make sure we can run config.sub.
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+echo "$as_me:$LINENO: checking target system type" >&5
+echo $ECHO_N "checking target system type... $ECHO_C" >&6
+if test "${ac_cv_target+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_target_alias=$target_alias
+test "x$ac_cv_target_alias" = "x" &&
+  ac_cv_target_alias=$ac_cv_host_alias
+ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_target" >&5
+echo "${ECHO_T}$ac_cv_target" >&6
+target=$ac_cv_target
+target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+# The aliases save the names the user supplied, while $host etc.
+# will get canonicalized.
+test -n "$target_alias" &&
+  test "$program_prefix$program_suffix$program_transform_name" = \
+    NONENONEs,x,x, &&
+  program_prefix=${target_alias}-
+
+VERSION_MAJOR=1
+VERSION_MINOR=2
+VERSION_POINT=4
+VERSION_MAJOR=$VERSION_MAJOR
+
+VERSION_MINOR=$VERSION_MINOR
+
+VERSION_POINT=$VERSION_POINT
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+	;;
+    conftest.$ac_ext )
+	# This is the source file.
+	;;
+    [ab].out )
+	# We found the default executable, but exeext='' is most
+	# certainly right.
+	break;;
+    *.* )
+	ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	# FIXME: I believe we export ac_cv_exeext for Libtool,
+	# but it would be cool to find out if it's true.  Does anybody
+	# maintain Libtool? --akim.
+	export ac_cv_exeext
+	break;;
+    * )
+	break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+	  export ac_cv_exeext
+	  break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_compiler_gnu=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std1 is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std1.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX			-qlanglvl=ansi
+# Ultrix and OSF/1	-std1
+# HP-UX 10.20 and later	-Ae
+# HP-UX older versions	-Aa -D_HPUX_SOURCE
+# SVR4			-Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   '' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+#include <stdlib.h>
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+	# 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"
+		cat >>confdefs.h <<\_ACEOF
+#define USE_GNUCC 1
+_ACEOF
+
+	fi
+	if test "$GXX" = "yes"; then
+		CXX_WFLAGS="-Wall"
+		CXXFLAGS="$CXXFLAGS -Wall"
+		cat >>confdefs.h <<\_ACEOF
+#define USE_GNUCC 1
+_ACEOF
+
+	fi
+	CXX_WFLAGS=$CXX_WFLAGS
+
+	C_WFLAGS=$C_WFLAGS
+
+
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+	if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+	  if test $ac_prog = install &&
+	    grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # AIX install.  It has an incompatible calling convention.
+	    :
+	  elif test $ac_prog = install &&
+	    grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+	    # program-specific install script used by HP pwplus--don't use.
+	    :
+	  else
+	    ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+	    break 3
+	  fi
+	fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6
+fi
+
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$RANLIB"; then
+  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+  echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+  ac_ct_RANLIB=$RANLIB
+  # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_RANLIB"; then
+  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+  echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  RANLIB=$ac_ct_RANLIB
+else
+  RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+
+	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*
+
+	CXX_PIC=$CXX_PIC
+
+	C_PIC=$C_PIC
+
+
+
+  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
+
+
+# Check whether --with-ld-shared or --without-ld-shared was given.
+if test "${with_ld_shared+set}" = set; then
+  withval="$with_ld_shared"
+
+fi;
+
+  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
+
+
+  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
+
+
+  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*
+
+  LD_SHARED=$LD_SHARED
+
+  SO_EXT=$SO_EXT
+
+
+
+#
+#	If we have shared library support define that we want to build
+# 	the libgeotiff.so
+
+GEOTIFF_SO=
+GEOTIFF_DLL=
+GEOTIFF_IMP=
+EXEEXT=
+if test "$LD_SHARED" != "/bin/true" ; then
+  case $host in
+    *-pc-cygwin*) EXEEXT=.exe
+		  GEOTIFF_SO=cyggeotiff-1.dll
+	          GEOTIFF_DLL=cyggeotiff-1.dll
+	          GEOTIFF_IMP=libgeotiff.dll.a
+                  LD_SHARED="gcc -shared -Wl,--export-all -Wl,--out-implib=\$(GEOTIFF_IMP)" ;;
+    *) GEOTIFF_SO=libgeotiff.${SO_EXT}.$VERSION_MAJOR.$VERSION_MINOR.$VERSION_POINT ;;
+  esac
+fi
+GEOTIFF_SO=$GEOTIFF_SO
+
+GEOTIFF_IMP=$GEOTIFF_IMP
+
+GEOTIFF_DLL=$GEOTIFF_DLL
+
+EXEEXT=$EXEEXT
+
+
+
+
+echo "$as_me:$LINENO: checking for exp in -lm" >&5
+echo $ECHO_N "checking for exp in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_exp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char exp ();
+int
+main ()
+{
+exp ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_m_exp=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_exp=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_m_exp" >&5
+echo "${ECHO_T}$ac_cv_lib_m_exp" >&6
+if test $ac_cv_lib_m_exp = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+fi
+
+
+LIBS="$LDFLAGS $LIBS"
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+  CPP=
+fi
+if test -z "$CPP"; then
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+		     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
+else
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+		   (('a' <= (c) && (c) <= 'i') \
+		     || ('j' <= (c) && (c) <= 'r') \
+		     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+	|| toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+		  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+for ac_header in string.h strings.h stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+# Check whether --with-zip or --without-zip was given.
+if test "${with_zip+set}" = set; then
+  withval="$with_zip"
+  ZIP=$withval
+else
+  ZIP=yes
+fi;
+if test "$ZIP" = "yes" ; then
+
+echo "$as_me:$LINENO: checking for inflateInit_ in -lz" >&5
+echo $ECHO_N "checking for inflateInit_ in -lz... $ECHO_C" >&6
+if test "${ac_cv_lib_z_inflateInit_+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz -lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char inflateInit_ ();
+int
+main ()
+{
+inflateInit_ ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_z_inflateInit_=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_z_inflateInit_=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflateInit_" >&5
+echo "${ECHO_T}$ac_cv_lib_z_inflateInit_" >&6
+if test $ac_cv_lib_z_inflateInit_ = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
+_ACEOF
+
+  LIBS="-lz $LIBS"
+
+fi
+
+
+for ac_header in zlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_ZIP 1
+_ACEOF
+
+else
+  if test "$ZIP" != "no" ; then
+    LIBS="${LIBS} -L${ZIP}/lib -lz"
+    ZIP_INC="-I${ZIP}/include"
+    ZIP_INC=$ZIP_INC
+
+    cat >>confdefs.h <<\_ACEOF
+#define HAVE_ZIP 1
+_ACEOF
+
+    echo "Using user supplied libzip directory: "$ZIP
+  fi
+fi
+
+
+# Check whether --with-jpeg or --without-jpeg was given.
+if test "${with_jpeg+set}" = set; then
+  withval="$with_jpeg"
+  JPEG=$withval
+else
+  JPEG=yes
+fi;
+if test "$JPEG" = "yes" ; then
+
+echo "$as_me:$LINENO: checking for jinit_compress_master in -ljpeg" >&5
+echo $ECHO_N "checking for jinit_compress_master in -ljpeg... $ECHO_C" >&6
+if test "${ac_cv_lib_jpeg_jinit_compress_master+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ljpeg -lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char jinit_compress_master ();
+int
+main ()
+{
+jinit_compress_master ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_jpeg_jinit_compress_master=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_jpeg_jinit_compress_master=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jinit_compress_master" >&5
+echo "${ECHO_T}$ac_cv_lib_jpeg_jinit_compress_master" >&6
+if test $ac_cv_lib_jpeg_jinit_compress_master = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBJPEG 1
+_ACEOF
+
+  LIBS="-ljpeg $LIBS"
+
+fi
+
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_JPEG 1
+_ACEOF
+
+else
+  if test "$JPEG" != "no" ; then
+    LIBS="${LIBS} -L${JPEG} -ljpeg"
+    cat >>confdefs.h <<\_ACEOF
+#define HAVE_JPEG 1
+_ACEOF
+
+    echo "Using user supplied libjpeg directory: "$JPEG
+  fi
+fi
+
+
+# Check whether --with-libtiff or --without-libtiff was given.
+if test "${with_libtiff+set}" = set; then
+  withval="$with_libtiff"
+
+fi;
+
+if test "$with_libtiff" != "" ; then
+  if test -f $with_libtiff/include/tiffio.h -a -d $with_libtiff/lib ; then
+    LIBS="-L$with_libtiff/lib -ltiff $LIBS"
+    TIFF_INC=-I$with_libtiff/include
+  else
+    LIBS="-L$with_libtiff -ltiff $LIBS"
+    TIFF_INC=-I$with_libtiff
+  fi
+  LIBS_SAVED="$LIBS"
+
+echo "$as_me:$LINENO: checking for TIFFOpen in -ltiff" >&5
+echo $ECHO_N "checking for TIFFOpen in -ltiff... $ECHO_C" >&6
+if test "${ac_cv_lib_tiff_TIFFOpen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltiff -lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char TIFFOpen ();
+int
+main ()
+{
+TIFFOpen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_tiff_TIFFOpen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_tiff_TIFFOpen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_tiff_TIFFOpen" >&5
+echo "${ECHO_T}$ac_cv_lib_tiff_TIFFOpen" >&6
+if test $ac_cv_lib_tiff_TIFFOpen = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBTIFF 1
+_ACEOF
+
+  LIBS="-ltiff $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: failed to link with -ltiff to find TIFFOpen" >&5
+echo "$as_me: error: failed to link with -ltiff to find TIFFOpen" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+echo "$as_me:$LINENO: checking for TIFFMergeFieldInfo in -ltiff" >&5
+echo $ECHO_N "checking for TIFFMergeFieldInfo in -ltiff... $ECHO_C" >&6
+if test "${ac_cv_lib_tiff_TIFFMergeFieldInfo+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltiff -lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char TIFFMergeFieldInfo ();
+int
+main ()
+{
+TIFFMergeFieldInfo ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_tiff_TIFFMergeFieldInfo=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_tiff_TIFFMergeFieldInfo=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_tiff_TIFFMergeFieldInfo" >&5
+echo "${ECHO_T}$ac_cv_lib_tiff_TIFFMergeFieldInfo" >&6
+if test $ac_cv_lib_tiff_TIFFMergeFieldInfo = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBTIFF 1
+_ACEOF
+
+  LIBS="-ltiff $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: Libtiff 3.6.0 Beta or later required for this version of
+libgeotiff. Please upgrade or use an older version of libgeotiff." >&5
+echo "$as_me: error: Libtiff 3.6.0 Beta or later required for this version of
+libgeotiff. Please upgrade or use an older version of libgeotiff." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+  LIBS="$LIBS_SAVED"
+else
+
+echo "$as_me:$LINENO: checking for TIFFOpen in -ltiff" >&5
+echo $ECHO_N "checking for TIFFOpen in -ltiff... $ECHO_C" >&6
+if test "${ac_cv_lib_tiff_TIFFOpen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltiff -lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char TIFFOpen ();
+int
+main ()
+{
+TIFFOpen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_tiff_TIFFOpen=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_tiff_TIFFOpen=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_tiff_TIFFOpen" >&5
+echo "${ECHO_T}$ac_cv_lib_tiff_TIFFOpen" >&6
+if test $ac_cv_lib_tiff_TIFFOpen = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBTIFF 1
+_ACEOF
+
+  LIBS="-ltiff $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: You will need to substantially rewrite libxtiff to
+build libgeotiff without libtiff" >&5
+echo "$as_me: error: You will need to substantially rewrite libxtiff to
+build libgeotiff without libtiff" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+  LIBS_SAVED="$LIBS"
+
+echo "$as_me:$LINENO: checking for TIFFMergeFieldInfo in -ltiff" >&5
+echo $ECHO_N "checking for TIFFMergeFieldInfo in -ltiff... $ECHO_C" >&6
+if test "${ac_cv_lib_tiff_TIFFMergeFieldInfo+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltiff -lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char TIFFMergeFieldInfo ();
+int
+main ()
+{
+TIFFMergeFieldInfo ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_tiff_TIFFMergeFieldInfo=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_tiff_TIFFMergeFieldInfo=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_tiff_TIFFMergeFieldInfo" >&5
+echo "${ECHO_T}$ac_cv_lib_tiff_TIFFMergeFieldInfo" >&6
+if test $ac_cv_lib_tiff_TIFFMergeFieldInfo = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBTIFF 1
+_ACEOF
+
+  LIBS="-ltiff $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: Libtiff 3.6.0 Beta or later required for this version of
+libgeotiff. Please upgrade libtiff or use an older version of libgeotiff." >&5
+echo "$as_me: error: Libtiff 3.6.0 Beta or later required for this version of
+libgeotiff. Please upgrade libtiff or use an older version of libgeotiff." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+  LIBS="$LIBS_SAVED"
+  TIFF_INC=
+fi
+
+TIFF_INC=$TIFF_INC
+
+
+
+
+# Check whether --with-proj or --without-proj was given.
+if test "${with_proj+set}" = set; then
+  withval="$with_proj"
+  PROJ_HOME=$withval
+else
+  PROJ_HOME=
+fi;
+
+if test "$PROJ_HOME" != "" -a "$PROJ_HOME" != "no" ; then
+  if test -d "$PROJ_HOME/src/pj_init.c" ; then
+    PROJ_HOME=$PROJ_HOME/src
+  fi
+
+    if test -f "$PROJ_HOME/libproj.a" -a -f "$PROJ_HOME/projects.h" ; then
+    PROJ_LIB=$PROJ_HOME/libproj.a
+    PROJ_INC=$PROJ_HOME
+
+    elif test -f "$PROJ_HOME/.libs/libproj.a" -a -f "$PROJ_HOME/projects.h" ; then
+    PROJ_LIB=$PROJ_HOME/.libs/libproj.a
+    PROJ_INC=$PROJ_HOME
+
+    elif test \( -f "$PROJ_HOME/lib/libproj.a" -o -f "$PROJ_HOME/lib/libproj.so" \) -a -f "$PROJ_HOME/include/proj_api.h"; then
+    PROJ_LIB="-L$PROJ_HOME/lib -lproj"
+    PROJ_INC=$PROJ_HOME/include
+  else
+    echo "PROJ_HOME=$PROJ_HOME, but either projects.h or libproj.a not found!"
+  fi
+fi
+
+if test "$PROJ_HOME" = "no" ; then
+  echo "PROJ.4 support disabled."
+
+elif test "$PROJ_LIB" != "" -a "$PROJ_INC" != "" ; then
+  echo "Found $PROJ_LIB"
+  echo "Found $PROJ_INC/projects.h"
+
+  LIBS="$PROJ_LIB $LIBS"
+  PROJ_INC=-I$PROJ_INC
+
+  PROJ_INC=$PROJ_INC
+
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_PROJECTS_H 1
+_ACEOF
+
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBPROJ 1
+_ACEOF
+
+else
+
+echo "$as_me:$LINENO: checking for pj_init in -lproj" >&5
+echo $ECHO_N "checking for pj_init in -lproj... $ECHO_C" >&6
+if test "${ac_cv_lib_proj_pj_init+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lproj -lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char pj_init ();
+int
+main ()
+{
+pj_init ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_proj_pj_init=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_proj_pj_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_proj_pj_init" >&5
+echo "${ECHO_T}$ac_cv_lib_proj_pj_init" >&6
+if test $ac_cv_lib_proj_pj_init = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPROJ 1
+_ACEOF
+
+  LIBS="-lproj $LIBS"
+
+fi
+
+
+for ac_header in projects.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------------ ##
+## Report this to the AC_PACKAGE_NAME lists.  ##
+## ------------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+fi
+
+
+# Check whether --enable-incode-epsg or --disable-incode-epsg was given.
+if test "${enable_incode_epsg+set}" = set; then
+  enableval="$enable_incode_epsg"
+
+else
+  enable_incode_epsg=no
+fi;
+
+if test "$enable_incode_epsg" != "yes" ; then
+   echo "EPSG tables will be read from .csv files."
+   CSV_SOURCE="\$(CSV_FILE_OBJS)"
+else
+   echo "EPSG tables will be linked into library."
+   CSV_SOURCE="\$(CSV_INCODE_OBJS)"
+fi
+CSV_SOURCE=$CSV_SOURCE
+
+
+
+
+
+                    ac_config_files="$ac_config_files Makefile bin/Makefile"
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+	"s/'/'\\\\''/g;
+	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+	"s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
+  else
+    echo "not updating unwritable cache $cache_file"
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[	 ]*VPATH[	 ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[	 ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[	 ]*$//;
+}'
+fi
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+	 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.59.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+		   instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+		   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Report bugs to <bug-autoconf at gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.59,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2003 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "bin/Makefile" ) CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;;
+  "geo_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS geo_config.h" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s, at SHELL@,$SHELL,;t t
+s, at PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s, at PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s, at PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s, at PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s, at PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s, at PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s, at exec_prefix@,$exec_prefix,;t t
+s, at prefix@,$prefix,;t t
+s, at program_transform_name@,$program_transform_name,;t t
+s, at bindir@,$bindir,;t t
+s, at sbindir@,$sbindir,;t t
+s, at libexecdir@,$libexecdir,;t t
+s, at datadir@,$datadir,;t t
+s, at sysconfdir@,$sysconfdir,;t t
+s, at sharedstatedir@,$sharedstatedir,;t t
+s, at localstatedir@,$localstatedir,;t t
+s, at libdir@,$libdir,;t t
+s, at includedir@,$includedir,;t t
+s, at oldincludedir@,$oldincludedir,;t t
+s, at infodir@,$infodir,;t t
+s, at mandir@,$mandir,;t t
+s, at build_alias@,$build_alias,;t t
+s, at host_alias@,$host_alias,;t t
+s, at target_alias@,$target_alias,;t t
+s, at DEFS@,$DEFS,;t t
+s, at ECHO_C@,$ECHO_C,;t t
+s, at ECHO_N@,$ECHO_N,;t t
+s, at ECHO_T@,$ECHO_T,;t t
+s, at LIBS@,$LIBS,;t t
+s, at build@,$build,;t t
+s, at build_cpu@,$build_cpu,;t t
+s, at build_vendor@,$build_vendor,;t t
+s, at build_os@,$build_os,;t t
+s, at host@,$host,;t t
+s, at host_cpu@,$host_cpu,;t t
+s, at host_vendor@,$host_vendor,;t t
+s, at host_os@,$host_os,;t t
+s, at target@,$target,;t t
+s, at target_cpu@,$target_cpu,;t t
+s, at target_vendor@,$target_vendor,;t t
+s, at target_os@,$target_os,;t t
+s, at VERSION_MAJOR@,$VERSION_MAJOR,;t t
+s, at VERSION_MINOR@,$VERSION_MINOR,;t t
+s, at VERSION_POINT@,$VERSION_POINT,;t t
+s, at CC@,$CC,;t t
+s, at CFLAGS@,$CFLAGS,;t t
+s, at LDFLAGS@,$LDFLAGS,;t t
+s, at CPPFLAGS@,$CPPFLAGS,;t t
+s, at ac_ct_CC@,$ac_ct_CC,;t t
+s, at EXEEXT@,$EXEEXT,;t t
+s, at OBJEXT@,$OBJEXT,;t t
+s, at CXX_WFLAGS@,$CXX_WFLAGS,;t t
+s, at C_WFLAGS@,$C_WFLAGS,;t t
+s, at INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s, at INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s, at INSTALL_DATA@,$INSTALL_DATA,;t t
+s, at LN_S@,$LN_S,;t t
+s, at RANLIB@,$RANLIB,;t t
+s, at ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
+s, at CXX_PIC@,$CXX_PIC,;t t
+s, at C_PIC@,$C_PIC,;t t
+s, at LD_SHARED@,$LD_SHARED,;t t
+s, at SO_EXT@,$SO_EXT,;t t
+s, at GEOTIFF_SO@,$GEOTIFF_SO,;t t
+s, at GEOTIFF_IMP@,$GEOTIFF_IMP,;t t
+s, at GEOTIFF_DLL@,$GEOTIFF_DLL,;t t
+s, at CPP@,$CPP,;t t
+s, at EGREP@,$EGREP,;t t
+s, at ZIP_INC@,$ZIP_INC,;t t
+s, at TIFF_INC@,$TIFF_INC,;t t
+s, at PROJ_INC@,$PROJ_INC,;t t
+s, at CSV_SOURCE@,$CSV_SOURCE,;t t
+s, at LIBOBJS@,$LIBOBJS,;t t
+s, at LTLIBOBJS@,$LTLIBOBJS,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+	cat >$tmp/stdin
+	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+
+# Do not use `cd foo && pwd` to compute absolute paths, because
+# the directories may not exist.
+case `pwd` in
+.) ac_abs_builddir="$ac_dir";;
+*)
+  case "$ac_dir" in
+  .) ac_abs_builddir=`pwd`;;
+  [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
+  *) ac_abs_builddir=`pwd`/"$ac_dir";;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_builddir=${ac_top_builddir}.;;
+*)
+  case ${ac_top_builddir}. in
+  .) ac_abs_top_builddir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
+  *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_srcdir=$ac_srcdir;;
+*)
+  case $ac_srcdir in
+  .) ac_abs_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
+  *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
+  esac;;
+esac
+case $ac_abs_builddir in
+.) ac_abs_top_srcdir=$ac_top_srcdir;;
+*)
+  case $ac_top_srcdir in
+  .) ac_abs_top_srcdir=$ac_abs_builddir;;
+  [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
+  *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
+  esac;;
+esac
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+				     sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+	 # Absolute (can't be DOS-style, as IFS=:)
+	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 echo "$f";;
+      *) # Relative
+	 if test -f "$f"; then
+	   # Build tree
+	   echo "$f"
+	 elif test -f "$srcdir/$f"; then
+	   # Source tree
+	   echo "$srcdir/$f"
+	 else
+	   # /dev/null tree
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s, at configure_input@,$configure_input,;t t
+s, at srcdir@,$ac_srcdir,;t t
+s, at abs_srcdir@,$ac_abs_srcdir,;t t
+s, at top_srcdir@,$ac_top_srcdir,;t t
+s, at abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s, at builddir@,$ac_builddir,;t t
+s, at abs_builddir@,$ac_abs_builddir,;t t
+s, at top_builddir@,$ac_top_builddir,;t t
+s, at abs_top_builddir@,$ac_abs_top_builddir,;t t
+s, at INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
+
+# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
+# NAME is the cpp macro being defined and VALUE is the value it is being given.
+#
+# ac_d sets the value in "#define NAME VALUE" lines.
+ac_dA='s,^\([	 ]*\)#\([	 ]*define[	 ][	 ]*\)'
+ac_dB='[	 ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([	 ]*\)#\([	 ]*\)undef\([	 ][	 ]*\)'
+ac_uB='$,\1#\2define\3'
+ac_uC=' '
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
+  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+	cat >$tmp/stdin
+	ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+	ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+	 # Absolute (can't be DOS-style, as IFS=:)
+	 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 # Do quote $f, to prevent DOS paths from being IFS'd.
+	 echo "$f";;
+      *) # Relative
+	 if test -f "$f"; then
+	   # Build tree
+	   echo "$f"
+	 elif test -f "$srcdir/$f"; then
+	   # Source tree
+	   echo "$srcdir/$f"
+	 else
+	   # /dev/null tree
+	   { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+	 fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+  # Remove the trailing spaces.
+  sed 's/[	 ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h.  The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status.  Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 (][^	 (]*\)\(([^)]*)\)[	 ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[	 ]*#[	 ]*define[	 ][	 ]*\([^	 ][^	 ]*\)[	 ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless.  Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
+
+# This sed command replaces #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+cat >>conftest.undefs <<\_ACEOF
+s,^[	 ]*#[	 ]*undef[	 ][	 ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo '  if grep "^[	 ]*#[	 ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo '  :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+  # Write a limited-size here document to $tmp/defines.sed.
+  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#define' lines.
+  echo '/^[	 ]*#[	 ]*define/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/defines.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo '  fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+  # Write a limited-size here document to $tmp/undefs.sed.
+  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#undef'
+  echo '/^[	 ]*#[	 ]*undef/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+  rm -f conftest.undefs
+  mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    echo "/* Generated by configure.  */" >$tmp/config.h
+  else
+    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
+  fi
+  cat $tmp/in >>$tmp/config.h
+  rm -f $tmp/in
+  if test x"$ac_file" != x-; then
+    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$ac_file" : 'X\(//\)[^/]' \| \
+	 X"$ac_file" : 'X\(//\)$' \| \
+	 X"$ac_file" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+      { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+	 X"$as_dir" : 'X\(//\)[^/]' \| \
+	 X"$as_dir" : 'X\(//\)$' \| \
+	 X"$as_dir" : 'X\(/\)' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+      rm -f $ac_file
+      mv $tmp/config.h $ac_file
+    fi
+  else
+    cat $tmp/config.h
+    rm -f $tmp/config.h
+  fi
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+


Property changes on: packages/geotiff/libgeotiff-dfsg/trunk/configure
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/geotiff/libgeotiff-dfsg/trunk/configure.in
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/configure.in	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/configure.in	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,194 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(geotiff.h)
+AC_CONFIG_HEADER(geo_config.h)
+AC_CANONICAL_HOST
+AC_CANONICAL_TARGET
+
+VERSION_MAJOR=1
+VERSION_MINOR=2
+VERSION_POINT=4
+AC_SUBST(VERSION_MAJOR,$VERSION_MAJOR)
+AC_SUBST(VERSION_MINOR,$VERSION_MINOR)
+AC_SUBST(VERSION_POINT,$VERSION_POINT)
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_COMPILER_WFLAGS
+
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_RANLIB
+AC_COMPILER_PIC
+AC_LD_SHARED
+
+#
+#	If we have shared library support define that we want to build
+# 	the libgeotiff.so
+
+GEOTIFF_SO=
+GEOTIFF_DLL=
+GEOTIFF_IMP=
+EXEEXT=
+if test "$LD_SHARED" != "/bin/true" ; then
+  case $host in
+    *-pc-cygwin*) EXEEXT=.exe
+		  GEOTIFF_SO=cyggeotiff-1.dll
+	          GEOTIFF_DLL=cyggeotiff-1.dll
+	          GEOTIFF_IMP=libgeotiff.dll.a
+                  LD_SHARED="gcc -shared -Wl,--export-all -Wl,--out-implib=\$(GEOTIFF_IMP)" ;;
+    *) GEOTIFF_SO=libgeotiff.${SO_EXT}.$VERSION_MAJOR.$VERSION_MINOR.$VERSION_POINT ;;
+  esac
+fi
+AC_SUBST(GEOTIFF_SO,$GEOTIFF_SO)
+AC_SUBST(GEOTIFF_IMP,$GEOTIFF_IMP)
+AC_SUBST(GEOTIFF_DLL,$GEOTIFF_DLL)
+AC_SUBST(EXEEXT,$EXEEXT)
+
+dnl Checks for libraries.
+AC_CHECK_LIB(m,exp,,,)
+
+dnl We want to honor the users wishes with regard to linking.
+LIBS="$LDFLAGS $LIBS"
+
+dnl We check for headers
+AC_HEADER_STDC
+AC_CHECK_HEADERS(string.h strings.h stdlib.h)
+ 
+dnl
+dnl Add option to include libz in library list for use of libtiff.
+dnl
+AC_ARG_WITH(zip, [  --with-zip=dir          Use ZIP library in directory dir],[ZIP=$withval],[ZIP=yes])
+if test "$ZIP" = "yes" ; then
+  AC_CHECK_LIB(z,inflateInit_,,,-lm)
+  AC_CHECK_HEADERS(zlib.h,,)
+  AC_DEFINE(HAVE_ZIP)
+else
+  if test "$ZIP" != "no" ; then 
+    LIBS="${LIBS} -L${ZIP}/lib -lz"       
+    ZIP_INC="-I${ZIP}/include"            
+    AC_SUBST(ZIP_INC,$ZIP_INC)
+    AC_DEFINE(HAVE_ZIP)
+    echo "Using user supplied libzip directory: "$ZIP
+  fi
+fi
+
+dnl
+dnl Add option to include libjpeg in library list for use of libtiff.
+dnl
+AC_ARG_WITH(jpeg, [  --with-jpeg=dir         Use JPEG library in directory dir],[JPEG=$withval],[JPEG=yes])
+if test "$JPEG" = "yes" ; then
+  AC_CHECK_LIB(jpeg,jinit_compress_master,,,-lm)
+  AC_DEFINE(HAVE_JPEG)
+else
+  if test "$JPEG" != "no" ; then 
+    LIBS="${LIBS} -L${JPEG} -ljpeg"       
+    AC_DEFINE(HAVE_JPEG)
+    echo "Using user supplied libjpeg directory: "$JPEG
+  fi
+fi
+
+dnl
+dnl Special logic to try and find a user specified libtiff tree.  If not
+dnl available check if the system directories have the library, _and_ the
+dnl required private include files.  Normally these private include files
+dnl (tiffiop.h) are not installed with the public interface.
+dnl
+AC_ARG_WITH(libtiff, [  --with-libtiff=dir      Use libtiff in directory dir],,)
+
+if test "$with_libtiff" != "" ; then
+  if test -f $with_libtiff/include/tiffio.h -a -d $with_libtiff/lib ; then
+    LIBS="-L$with_libtiff/lib -ltiff $LIBS"
+    TIFF_INC=-I$with_libtiff/include
+  else
+    LIBS="-L$with_libtiff -ltiff $LIBS"
+    TIFF_INC=-I$with_libtiff
+  fi
+  LIBS_SAVED="$LIBS"
+  AC_CHECK_LIB(tiff,TIFFOpen,,
+               AC_MSG_ERROR([failed to link with -ltiff to find TIFFOpen]),-lm)
+  AC_CHECK_LIB(tiff,TIFFMergeFieldInfo,,
+               AC_MSG_ERROR([Libtiff 3.6.0 Beta or later required for this version of
+libgeotiff. Please upgrade or use an older version of libgeotiff.]),-lm)
+  LIBS="$LIBS_SAVED"
+else
+  AC_CHECK_LIB(tiff,TIFFOpen,,
+               AC_MSG_ERROR([You will need to substantially rewrite libxtiff to
+build libgeotiff without libtiff]),-lm)
+  LIBS_SAVED="$LIBS"
+  AC_CHECK_LIB(tiff,TIFFMergeFieldInfo,,
+               AC_MSG_ERROR([Libtiff 3.6.0 Beta or later required for this version of
+libgeotiff. Please upgrade libtiff or use an older version of libgeotiff.]),-lm)
+  LIBS="$LIBS_SAVED"
+  TIFF_INC=
+fi
+
+AC_SUBST(TIFF_INC,$TIFF_INC)
+
+dnl
+dnl Try and find libproj.a, and projects.h
+dnl
+
+AC_ARG_WITH(proj, [  --with-proj[=ARG]       Use PROJ.4 library (ARG=no or path)],[PROJ_HOME=$withval],[PROJ_HOME=])
+
+if test "$PROJ_HOME" != "" -a "$PROJ_HOME" != "no" ; then
+  if test -d "$PROJ_HOME/src/pj_init.c" ; then
+    PROJ_HOME=$PROJ_HOME/src
+  fi
+
+  dnl Old PROJ.4 build tree, without automake
+  if test -f "$PROJ_HOME/libproj.a" -a -f "$PROJ_HOME/projects.h" ; then
+    PROJ_LIB=$PROJ_HOME/libproj.a
+    PROJ_INC=$PROJ_HOME
+
+  dnl New PROJ.4 build tree, with automake
+  elif test -f "$PROJ_HOME/.libs/libproj.a" -a -f "$PROJ_HOME/projects.h" ; then
+    PROJ_LIB=$PROJ_HOME/.libs/libproj.a
+    PROJ_INC=$PROJ_HOME
+
+  dnl Installed tree in an odd place
+  elif test \( -f "$PROJ_HOME/lib/libproj.a" -o -f "$PROJ_HOME/lib/libproj.so" \) -a -f "$PROJ_HOME/include/proj_api.h"; then
+    PROJ_LIB="-L$PROJ_HOME/lib -lproj"
+    PROJ_INC=$PROJ_HOME/include 
+  else
+    echo "PROJ_HOME=$PROJ_HOME, but either projects.h or libproj.a not found!"
+  fi
+fi
+
+if test "$PROJ_HOME" = "no" ; then
+  echo "PROJ.4 support disabled."
+
+elif test "$PROJ_LIB" != "" -a "$PROJ_INC" != "" ; then
+  echo "Found $PROJ_LIB"
+  echo "Found $PROJ_INC/projects.h"
+
+  LIBS="$PROJ_LIB $LIBS"
+  PROJ_INC=-I$PROJ_INC
+
+  AC_SUBST(PROJ_INC,$PROJ_INC)
+  AC_DEFINE(HAVE_PROJECTS_H)
+  AC_DEFINE(HAVE_LIBPROJ)
+else
+  AC_CHECK_LIB(proj,pj_init,,,-lm)
+  AC_CHECK_HEADERS(projects.h,,)
+fi
+
+dnl
+dnl Has the user requested "incode" EPSG tables, overriding the
+dnl default use of EPSG tables in csv files?  Temporarily unvailable.
+dnl
+
+AC_ARG_ENABLE(incode-epsg, [  --enable-incode-epsg	  Use C code EPSG tables],, enable_incode_epsg=no)
+
+if test "$enable_incode_epsg" != "yes" ; then
+   echo "EPSG tables will be read from .csv files."
+   CSV_SOURCE="\$(CSV_FILE_OBJS)"
+else
+   echo "EPSG tables will be linked into library."
+   CSV_SOURCE="\$(CSV_INCODE_OBJS)"
+fi
+AC_SUBST(CSV_SOURCE,$CSV_SOURCE)
+
+
+
+
+AC_OUTPUT(Makefile bin/Makefile)

Added: packages/geotiff/libgeotiff-dfsg/trunk/cpl_csv.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/cpl_csv.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/cpl_csv.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,1016 @@
+/******************************************************************************
+ * 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.
+ ******************************************************************************
+ *
+ * cpl_csv.c: Support functions for accessing CSV files.
+ *
+ * $Log: cpl_csv.c,v $
+ * Revision 1.16  2003/07/10 18:03:28  warmerda
+ * don't crash if NULL passed to gtCSVAccess()
+ *
+ * Revision 1.15  2003/01/20 06:46:35  warmerda
+ * search for pcs.csv, not horiz_cs.csv
+ *
+ * Revision 1.14  2003/01/15 04:39:58  warmerda
+ * change internal name of CSVAccess
+ *
+ * Revision 1.13  2002/11/28 22:26:41  warmerda
+ * upgraded to proper CSV formatting, and in-memory caching
+ *
+ * Revision 1.12  2002/06/19 03:51:15  warmerda
+ * migrated cpl_csv.h into cpl_serv.h
+ *
+ * Revision 1.11  2001/03/05 04:49:56  warmerda
+ * try to clear CPLReadLine buffer on deaccess
+ *
+ * Revision 1.10  2001/01/17 15:32:19  warmerda
+ * Include /usr/share/epsg_csv and share/epsg_csv in csv search path.
+ *
+ * Revision 1.9  2000/12/12 19:34:36  warmerda
+ * Use CSV_DATA_DIR if defined.
+ *
+ * Revision 1.8  2000/08/22 04:33:33  warmerda
+ * added support for /usr/local/shared/epsg_csv
+ *
+ * Revision 1.7  1999/12/03 14:42:59  warmerda
+ * Passing a NULL filename into CSVAccess() now results in a graceful
+ * failure to open the file.
+ *
+ * Revision 1.6  1999/06/26 17:28:51  warmerda
+ * Fixed reading of records with newlines embedded in quoted strings.
+ *
+ * Revision 1.5  1999/05/04 03:07:24  warmerda
+ * avoid warning
+ *
+ * Revision 1.4  1999/04/28 19:59:56  warmerda
+ * added some doxygen style documentation
+ *
+ * Revision 1.3  1999/03/17 19:53:15  geotiff
+ * sys includes moved to cpl_serv.h
+ *
+ * Revision 1.2  1999/03/10 16:54:42  geotiff
+ * Added use of the GEOTIFF_CSV environment variable to locate CSV files.
+ *
+ * Revision 1.1  1999/03/09 15:57:04  geotiff
+ * New
+ *
+ * Revision 1.2  1999/02/24 16:23:21  warmerda
+ * added lots
+ *
+ * Revision 1.1  1999/01/05 16:52:36  warmerda
+ * New
+ *
+ */
+
+#include "cpl_serv.h"
+#include "geo_tiffp.h"
+
+/* ==================================================================== */
+/*      The CSVTable is a persistant set of info about an open CSV      */
+/*      table.  While it doesn't currently maintain a record index,     */
+/*      or in-memory copy of the table, it could be changed to do so    */
+/*      in the future.                                                  */
+/* ==================================================================== */
+typedef struct ctb {
+    FILE        *fp;
+
+    struct ctb *psNext;
+
+    char        *pszFilename;
+
+    char        **papszFieldNames;
+
+    char        **papszRecFields;
+
+    int         iLastLine;
+
+    /* Cache for whole file */
+    int         nLineCount;
+    char        **papszLines;
+    int         *panLineIndex;
+    char        *pszRawData;
+} CSVTable;
+
+static CSVTable *psCSVTableList = NULL;
+
+/************************************************************************/
+/*                             CSVAccess()                              */
+/*                                                                      */
+/*      This function will fetch a handle to the requested table.       */
+/*      If not found in the ``open table list'' the table will be       */
+/*      opened and added to the list.  Eventually this function may     */
+/*      become public with an abstracted return type so that            */
+/*      applications can set options about the table.  For now this     */
+/*      isn't done.                                                     */
+/************************************************************************/
+
+static CSVTable *gtCSVAccess( const char * pszFilename )
+
+{
+    CSVTable    *psTable;
+    FILE        *fp;
+
+    if( pszFilename == NULL )
+        return NULL;
+
+/* -------------------------------------------------------------------- */
+/*      Is the table already in the list.                               */
+/* -------------------------------------------------------------------- */
+    for( psTable = psCSVTableList; psTable != NULL; psTable = psTable->psNext )
+    {
+        if( EQUAL(psTable->pszFilename,pszFilename) )
+        {
+            /*
+             * Eventually we should consider promoting to the front of
+             * the list to accelerate frequently accessed tables.
+             */
+            
+            return( psTable );
+        }
+    }
+
+/* -------------------------------------------------------------------- */
+/*      If not, try to open it.                                         */
+/* -------------------------------------------------------------------- */
+    fp = VSIFOpen( pszFilename, "rb" );
+    if( fp == NULL )
+        return NULL;
+
+/* -------------------------------------------------------------------- */
+/*      Create an information structure about this table, and add to    */
+/*      the front of the list.                                          */
+/* -------------------------------------------------------------------- */
+    psTable = (CSVTable *) CPLCalloc(sizeof(CSVTable),1);
+
+    psTable->fp = fp;
+    psTable->pszFilename = CPLStrdup( pszFilename );
+    psTable->psNext = psCSVTableList;
+    
+    psCSVTableList = psTable;
+
+/* -------------------------------------------------------------------- */
+/*      Read the table header record containing the field names.        */
+/* -------------------------------------------------------------------- */
+    psTable->papszFieldNames = CSVReadParseLine( fp );
+
+    return( psTable );
+}
+
+/************************************************************************/
+/*                            CSVDeaccess()                             */
+/************************************************************************/
+
+void CSVDeaccess( const char * pszFilename )
+
+{
+    CSVTable    *psLast, *psTable;
+    
+/* -------------------------------------------------------------------- */
+/*      A NULL means deaccess all tables.                               */
+/* -------------------------------------------------------------------- */
+    if( pszFilename == NULL )
+    {
+        while( psCSVTableList != NULL )
+            CSVDeaccess( psCSVTableList->pszFilename );
+        
+        return;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Find this table.                                                */
+/* -------------------------------------------------------------------- */
+    psLast = NULL;
+    for( psTable = psCSVTableList;
+         psTable != NULL && !EQUAL(psTable->pszFilename,pszFilename);
+         psTable = psTable->psNext )
+    {
+        psLast = psTable;
+    }
+
+    if( psTable == NULL )
+    {
+        return;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Remove the link from the list.                                  */
+/* -------------------------------------------------------------------- */
+    if( psLast != NULL )
+        psLast->psNext = psTable->psNext;
+    else
+        psCSVTableList = psTable->psNext;
+
+/* -------------------------------------------------------------------- */
+/*      Free the table.                                                 */
+/* -------------------------------------------------------------------- */
+    if( psTable->fp != NULL )
+        VSIFClose( psTable->fp );
+
+    CSLDestroy( psTable->papszFieldNames );
+    CSLDestroy( psTable->papszRecFields );
+    CPLFree( psTable->pszFilename );
+    CPLFree( psTable->panLineIndex );
+    CPLFree( psTable->pszRawData );
+    CPLFree( psTable->papszLines );
+
+    CPLFree( psTable );
+
+    CPLReadLine( NULL );
+}
+
+/************************************************************************/
+/*                            CSVSplitLine()                            */
+/*                                                                      */
+/*      Tokenize a CSV line into fields in the form of a string         */
+/*      list.  This is used instead of the CPLTokenizeString()          */
+/*      because it provides correct CSV escaping and quoting            */
+/*      semantics.                                                      */
+/************************************************************************/
+
+static char **CSVSplitLine( const char *pszString )
+
+{
+    char        **papszRetList = NULL;
+    char        *pszToken;
+    int         nTokenMax, nTokenLen;
+
+    pszToken = (char *) CPLCalloc(10,1);
+    nTokenMax = 10;
+    
+    while( pszString != NULL && *pszString != '\0' )
+    {
+        int     bInString = FALSE;
+
+        nTokenLen = 0;
+        
+        /* Try to find the next delimeter, marking end of token */
+        for( ; *pszString != '\0'; pszString++ )
+        {
+
+            /* End if this is a delimeter skip it and break. */
+            if( !bInString && *pszString == ',' )
+            {
+                pszString++;
+                break;
+            }
+            
+            if( *pszString == '"' )
+            {
+                if( !bInString || pszString[1] != '"' )
+                {
+                    bInString = !bInString;
+                    continue;
+                }
+                else  /* doubled quotes in string resolve to one quote */
+                {
+                    pszString++;
+                }
+            }
+
+            if( nTokenLen >= nTokenMax-2 )
+            {
+                nTokenMax = nTokenMax * 2 + 10;
+                pszToken = (char *) CPLRealloc( pszToken, nTokenMax );
+            }
+
+            pszToken[nTokenLen] = *pszString;
+            nTokenLen++;
+        }
+
+        pszToken[nTokenLen] = '\0';
+        papszRetList = CSLAddString( papszRetList, pszToken );
+
+        /* If the last token is an empty token, then we have to catch
+         * it now, otherwise we won't reenter the loop and it will be lost. 
+         */
+        if ( *pszString == '\0' && *(pszString-1) == ',' )
+        {
+            papszRetList = CSLAddString( papszRetList, "" );
+        }
+    }
+
+    if( papszRetList == NULL )
+        papszRetList = (char **) CPLCalloc(sizeof(char *),1);
+
+    CPLFree( pszToken );
+
+    return papszRetList;
+}
+
+/************************************************************************/
+/*                          CSVFindNextLine()                           */
+/*                                                                      */
+/*      Find the start of the next line, while at the same time zero    */
+/*      terminating this line.  Take into account that there may be     */
+/*      newline indicators within quoted strings, and that quotes       */
+/*      can be escaped with a backslash.                                */
+/************************************************************************/
+
+static char *CSVFindNextLine( char *pszThisLine )
+
+{
+    int  nQuoteCount = 0, i;
+
+    for( i = 0; pszThisLine[i] != '\0'; i++ )
+    {
+        if( pszThisLine[i] == '\"'
+            && (i == 0 || pszThisLine[i-1] != '\\') )
+            nQuoteCount++;
+
+        if( (pszThisLine[i] == 10 || pszThisLine[i] == 13)
+            && (nQuoteCount % 2) == 0 )
+            break;
+    }
+
+    while( pszThisLine[i] == 10 || pszThisLine[i] == 13 )
+        pszThisLine[i++] = '\0';
+
+    if( pszThisLine[i] == '\0' )
+        return NULL;
+    else
+        return pszThisLine + i;
+}
+
+/************************************************************************/
+/*                             CSVIngest()                              */
+/*                                                                      */
+/*      Load entire file into memory and setup index if possible.       */
+/************************************************************************/
+
+static void CSVIngest( const char *pszFilename )
+
+{
+    CSVTable *psTable = gtCSVAccess( pszFilename );
+    int       nFileLen, i, nMaxLineCount, iLine = 0;
+    char *pszThisLine;
+
+    if( psTable->pszRawData != NULL )
+        return;
+
+/* -------------------------------------------------------------------- */
+/*      Ingest whole file.                                              */
+/* -------------------------------------------------------------------- */
+    VSIFSeek( psTable->fp, 0, SEEK_END );
+    nFileLen = VSIFTell( psTable->fp );
+    VSIRewind( psTable->fp );
+
+    psTable->pszRawData = (char *) CPLMalloc(nFileLen+1);
+    if( (int) VSIFRead( psTable->pszRawData, 1, nFileLen, psTable->fp ) 
+        != nFileLen )
+    {
+        CPLFree( psTable->pszRawData );
+        psTable->pszRawData = NULL;
+
+        CPLError( CE_Failure, CPLE_FileIO, "Read of file %s failed.", 
+                  psTable->pszFilename );
+        return;
+    }
+
+    psTable->pszRawData[nFileLen] = '\0';
+
+/* -------------------------------------------------------------------- */
+/*      Get count of newlines so we can allocate line array.            */
+/* -------------------------------------------------------------------- */
+    nMaxLineCount = 0;
+    for( i = 0; i < nFileLen; i++ )
+    {
+        if( psTable->pszRawData[i] == 10 )
+            nMaxLineCount++;
+    }
+
+    psTable->papszLines = (char **) CPLCalloc(sizeof(char*),nMaxLineCount);
+    
+/* -------------------------------------------------------------------- */
+/*      Build a list of record pointers into the raw data buffer        */
+/*      based on line terminators.  Zero terminate the line             */
+/*      strings.                                                        */
+/* -------------------------------------------------------------------- */
+    /* skip header line */
+    pszThisLine = CSVFindNextLine( psTable->pszRawData );
+
+    while( pszThisLine != NULL && iLine < nMaxLineCount )
+    {
+        psTable->papszLines[iLine++] = pszThisLine;
+        pszThisLine = CSVFindNextLine( pszThisLine );
+    }
+
+    psTable->nLineCount = iLine;
+
+/* -------------------------------------------------------------------- */
+/*      Allocate and populate index array.  Ensure they are in          */
+/*      ascending order so that binary searches can be done on the      */
+/*      array.                                                          */
+/* -------------------------------------------------------------------- */
+    psTable->panLineIndex = (int *) CPLMalloc(sizeof(int)*psTable->nLineCount);
+    for( i = 0; i < psTable->nLineCount; i++ )
+    {
+        psTable->panLineIndex[i] = atoi(psTable->papszLines[i]);
+
+        if( i > 0 && psTable->panLineIndex[i] < psTable->panLineIndex[i-1] )
+        {
+            CPLFree( psTable->panLineIndex );
+            psTable->panLineIndex = NULL;
+            break;
+        }
+    }
+
+    psTable->iLastLine = -1;
+
+/* -------------------------------------------------------------------- */
+/*      We should never need the file handle against, so close it.      */
+/* -------------------------------------------------------------------- */
+    VSIFClose( psTable->fp );
+    psTable->fp = NULL;
+}
+
+/************************************************************************/
+/*                          CSVReadParseLine()                          */
+/*                                                                      */
+/*      Read one line, and return split into fields.  The return        */
+/*      result is a stringlist, in the sense of the CSL functions.      */
+/************************************************************************/
+
+char **CSVReadParseLine( FILE * fp )
+
+{
+    const char  *pszLine;
+    char        *pszWorkLine;
+    char        **papszReturn;
+
+    CPLAssert( fp != NULL );
+    if( fp == NULL )
+        return( NULL );
+    
+    pszLine = CPLReadLine( fp );
+    if( pszLine == NULL )
+        return( NULL );
+
+/* -------------------------------------------------------------------- */
+/*      If there are no quotes, then this is the simple case.           */
+/*      Parse, and return tokens.                                       */
+/* -------------------------------------------------------------------- */
+    if( strchr(pszLine,'\"') == NULL )
+        return CSVSplitLine( pszLine );
+
+/* -------------------------------------------------------------------- */
+/*      We must now count the quotes in our working string, and as      */
+/*      long as it is odd, keep adding new lines.                       */
+/* -------------------------------------------------------------------- */
+    pszWorkLine = CPLStrdup( pszLine );
+
+    while( TRUE )
+    {
+        int             i, nCount = 0;
+
+        for( i = 0; pszWorkLine[i] != '\0'; i++ )
+        {
+            if( pszWorkLine[i] == '\"'
+                && (i == 0 || pszWorkLine[i-1] != '\\') )
+                nCount++;
+        }
+
+        if( nCount % 2 == 0 )
+            break;
+
+        pszLine = CPLReadLine( fp );
+        if( pszLine == NULL )
+            break;
+
+        pszWorkLine = (char *)
+            CPLRealloc(pszWorkLine,
+                       strlen(pszWorkLine) + strlen(pszLine) + 1);
+        strcat( pszWorkLine, pszLine );
+    }
+    
+    papszReturn = CSVSplitLine( pszWorkLine );
+
+    CPLFree( pszWorkLine );
+
+    return papszReturn;
+}
+
+/************************************************************************/
+/*                             CSVCompare()                             */
+/*                                                                      */
+/*      Compare a field to a search value using a particular            */
+/*      criteria.                                                       */
+/************************************************************************/
+
+static int CSVCompare( const char * pszFieldValue, const char * pszTarget,
+                       CSVCompareCriteria eCriteria )
+
+{
+    if( eCriteria == CC_ExactString )
+    {
+        return( strcmp( pszFieldValue, pszTarget ) == 0 );
+    }
+    else if( eCriteria == CC_ApproxString )
+    {
+        return( EQUAL( pszFieldValue, pszTarget ) );
+    }
+    else if( eCriteria == CC_Integer )
+    {
+        return( atoi(pszFieldValue) == atoi(pszTarget) );
+    }
+
+    return FALSE;
+}
+
+/************************************************************************/
+/*                            CSVScanLines()                            */
+/*                                                                      */
+/*      Read the file scanline for lines where the key field equals     */
+/*      the indicated value with the suggested comparison criteria.     */
+/*      Return the first matching line split into fields.               */
+/************************************************************************/
+
+char **CSVScanLines( FILE *fp, int iKeyField, const char * pszValue,
+                     CSVCompareCriteria eCriteria )
+
+{
+    char        **papszFields = NULL;
+    int         bSelected = FALSE, nTestValue;
+
+    CPLAssert( pszValue != NULL );
+    CPLAssert( iKeyField >= 0 );
+    CPLAssert( fp != NULL );
+    
+    nTestValue = atoi(pszValue);
+    
+    while( !bSelected ) {
+        papszFields = CSVReadParseLine( fp );
+        if( papszFields == NULL )
+            return( NULL );
+
+        if( CSLCount( papszFields ) < iKeyField+1 )
+        {
+            /* not selected */
+        }
+        else if( eCriteria == CC_Integer
+                 && atoi(papszFields[iKeyField]) == nTestValue )
+        {
+            bSelected = TRUE;
+        }
+        else
+        {
+            bSelected = CSVCompare( papszFields[iKeyField], pszValue,
+                                    eCriteria );
+        }
+
+        if( !bSelected )
+        {
+            CSLDestroy( papszFields );
+            papszFields = NULL;
+        }
+    }
+    
+    return( papszFields );
+}
+
+/************************************************************************/
+/*                        CSVScanLinesIndexed()                         */
+/*                                                                      */
+/*      Read the file scanline for lines where the key field equals     */
+/*      the indicated value with the suggested comparison criteria.     */
+/*      Return the first matching line split into fields.               */
+/************************************************************************/
+
+static char **
+CSVScanLinesIndexed( CSVTable *psTable, int nKeyValue )
+
+{
+    int         iTop, iBottom, iMiddle, iResult = -1;
+
+    CPLAssert( psTable->panLineIndex != NULL );
+
+/* -------------------------------------------------------------------- */
+/*      Find target record with binary search.                          */
+/* -------------------------------------------------------------------- */
+    iTop = psTable->nLineCount-1;
+    iBottom = 0;
+
+    while( iTop >= iBottom )
+    {
+        iMiddle = (iTop + iBottom) / 2;
+        if( psTable->panLineIndex[iMiddle] > nKeyValue )
+            iTop = iMiddle - 1;
+        else if( psTable->panLineIndex[iMiddle] < nKeyValue )
+            iBottom = iMiddle + 1;
+        else
+        {
+            iResult = iMiddle;
+            break;
+        }
+    }
+
+    if( iResult == -1 )
+        return NULL;
+
+/* -------------------------------------------------------------------- */
+/*      Parse target line, and update iLastLine indicator.              */
+/* -------------------------------------------------------------------- */
+    psTable->iLastLine = iResult;
+    
+    return CSVSplitLine( psTable->papszLines[iResult] );
+}
+
+/************************************************************************/
+/*                        CSVScanLinesIngested()                        */
+/*                                                                      */
+/*      Read the file scanline for lines where the key field equals     */
+/*      the indicated value with the suggested comparison criteria.     */
+/*      Return the first matching line split into fields.               */
+/************************************************************************/
+
+static char **
+CSVScanLinesIngested( CSVTable *psTable, int iKeyField, const char * pszValue,
+                      CSVCompareCriteria eCriteria )
+
+{
+    char        **papszFields = NULL;
+    int         bSelected = FALSE, nTestValue;
+
+    CPLAssert( pszValue != NULL );
+    CPLAssert( iKeyField >= 0 );
+
+    nTestValue = atoi(pszValue);
+    
+/* -------------------------------------------------------------------- */
+/*      Short cut for indexed files.                                    */
+/* -------------------------------------------------------------------- */
+    if( iKeyField == 0 && eCriteria == CC_Integer 
+        && psTable->panLineIndex != NULL )
+        return CSVScanLinesIndexed( psTable, nTestValue );
+    
+/* -------------------------------------------------------------------- */
+/*      Scan from in-core lines.                                        */
+/* -------------------------------------------------------------------- */
+    while( !bSelected && psTable->iLastLine+1 < psTable->nLineCount ) {
+        psTable->iLastLine++;
+        papszFields = CSVSplitLine( psTable->papszLines[psTable->iLastLine] );
+
+        if( CSLCount( papszFields ) < iKeyField+1 )
+        {
+            /* not selected */
+        }
+        else if( eCriteria == CC_Integer
+                 && atoi(papszFields[iKeyField]) == nTestValue )
+        {
+            bSelected = TRUE;
+        }
+        else
+        {
+            bSelected = CSVCompare( papszFields[iKeyField], pszValue,
+                                    eCriteria );
+        }
+
+        if( !bSelected )
+        {
+            CSLDestroy( papszFields );
+            papszFields = NULL;
+        }
+    }
+    
+    return( papszFields );
+}
+
+/************************************************************************/
+/*                            CSVScanFile()                             */
+/*                                                                      */
+/*      Scan a whole file using criteria similar to above, but also     */
+/*      taking care of file opening and closing.                        */
+/************************************************************************/
+
+char **CSVScanFile( const char * pszFilename, int iKeyField,
+                    const char * pszValue, CSVCompareCriteria eCriteria )
+
+{
+    CSVTable    *psTable;
+
+/* -------------------------------------------------------------------- */
+/*      Get access to the table.                                        */
+/* -------------------------------------------------------------------- */
+    CPLAssert( pszFilename != NULL );
+
+    if( iKeyField < 0 )
+        return NULL;
+
+    psTable = gtCSVAccess( pszFilename );
+    if( psTable == NULL )
+        return NULL;
+    
+    CSVIngest( pszFilename );
+
+/* -------------------------------------------------------------------- */
+/*      Does the current record match the criteria?  If so, just        */
+/*      return it again.                                                */
+/* -------------------------------------------------------------------- */
+    if( iKeyField >= 0
+        && iKeyField < CSLCount(psTable->papszRecFields)
+        && CSVCompare(pszValue,psTable->papszRecFields[iKeyField],eCriteria) )
+    {
+        return psTable->papszRecFields;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Scan the file from the beginning, replacing the ``current       */
+/*      record'' in our structure with the one that is found.           */
+/* -------------------------------------------------------------------- */
+    psTable->iLastLine = -1;
+    CSLDestroy( psTable->papszRecFields );
+
+    if( psTable->pszRawData != NULL )
+        psTable->papszRecFields = 
+            CSVScanLinesIngested( psTable, iKeyField, pszValue, eCriteria );
+    else
+    {
+        VSIRewind( psTable->fp );
+        CPLReadLine( psTable->fp );         /* throw away the header line */
+    
+        psTable->papszRecFields =
+            CSVScanLines( psTable->fp, iKeyField, pszValue, eCriteria );
+    }
+
+    return( psTable->papszRecFields );
+}
+
+/************************************************************************/
+/*                           CPLGetFieldId()                            */
+/*                                                                      */
+/*      Read the first record of a CSV file (rewinding to be sure),     */
+/*      and find the field with the indicated name.  Returns -1 if      */
+/*      it fails to find the field name.  Comparison is case            */
+/*      insensitive, but otherwise exact.  After this function has      */
+/*      been called the file pointer will be positioned just after      */
+/*      the first record.                                               */
+/************************************************************************/
+
+int CSVGetFieldId( FILE * fp, const char * pszFieldName )
+
+{
+    char        **papszFields;
+    int         i;
+    
+    CPLAssert( fp != NULL && pszFieldName != NULL );
+
+    VSIRewind( fp );
+
+    papszFields = CSVReadParseLine( fp );
+    for( i = 0; papszFields != NULL && papszFields[i] != NULL; i++ )
+    {
+        if( EQUAL(papszFields[i],pszFieldName) )
+        {
+            CSLDestroy( papszFields );
+            return i;
+        }
+    }
+
+    CSLDestroy( papszFields );
+
+    return -1;
+}
+
+/************************************************************************/
+/*                         CSVGetFileFieldId()                          */
+/*                                                                      */
+/*      Same as CPLGetFieldId(), except that we get the file based      */
+/*      on filename, rather than having an existing handle.             */
+/************************************************************************/
+
+int CSVGetFileFieldId( const char * pszFilename, const char * pszFieldName )
+
+{
+    CSVTable    *psTable;
+    int         i;
+    
+/* -------------------------------------------------------------------- */
+/*      Get access to the table.                                        */
+/* -------------------------------------------------------------------- */
+    CPLAssert( pszFilename != NULL );
+
+    psTable = gtCSVAccess( pszFilename );
+    if( psTable == NULL )
+        return -1;
+
+/* -------------------------------------------------------------------- */
+/*      Find the requested field.                                       */
+/* -------------------------------------------------------------------- */
+    for( i = 0;
+         psTable->papszFieldNames != NULL
+             && psTable->papszFieldNames[i] != NULL;
+         i++ )
+    {
+        if( EQUAL(psTable->papszFieldNames[i],pszFieldName) )
+        {
+            return i;
+        }
+    }
+
+    return -1;
+}
+
+
+/************************************************************************/
+/*                         CSVScanFileByName()                          */
+/*                                                                      */
+/*      Same as CSVScanFile(), but using a field name instead of a      */
+/*      field number.                                                   */
+/************************************************************************/
+
+char **CSVScanFileByName( const char * pszFilename,
+                          const char * pszKeyFieldName,
+                          const char * pszValue, CSVCompareCriteria eCriteria )
+
+{
+    int         iKeyField;
+
+    iKeyField = CSVGetFileFieldId( pszFilename, pszKeyFieldName );
+    if( iKeyField == -1 )
+        return NULL;
+
+    return( CSVScanFile( pszFilename, iKeyField, pszValue, eCriteria ) );
+}
+
+/************************************************************************/
+/*                            CSVGetField()                             */
+/*                                                                      */
+/*      The all-in-one function to fetch a particular field value       */
+/*      from a CSV file.  Note this function will return an empty       */
+/*      string, rather than NULL if it fails to find the desired        */
+/*      value for some reason.  The caller can't establish that the     */
+/*      fetch failed.                                                   */
+/************************************************************************/
+
+const char *CSVGetField( const char * pszFilename,
+                         const char * pszKeyFieldName,
+                         const char * pszKeyFieldValue,
+                         CSVCompareCriteria eCriteria,
+                         const char * pszTargetField )
+
+{
+    CSVTable    *psTable;
+    char        **papszRecord;
+    int         iTargetField;
+    
+/* -------------------------------------------------------------------- */
+/*      Find the table.                                                 */
+/* -------------------------------------------------------------------- */
+    psTable = gtCSVAccess( pszFilename );
+    if( psTable == NULL )
+        return "";
+
+/* -------------------------------------------------------------------- */
+/*      Find the correct record.                                        */
+/* -------------------------------------------------------------------- */
+    papszRecord = CSVScanFileByName( pszFilename, pszKeyFieldName,
+                                     pszKeyFieldValue, eCriteria );
+
+    if( papszRecord == NULL )
+        return "";
+
+/* -------------------------------------------------------------------- */
+/*      Figure out which field we want out of this.                     */
+/* -------------------------------------------------------------------- */
+    iTargetField = CSVGetFileFieldId( pszFilename, pszTargetField );
+    if( iTargetField < 0 )
+        return "";
+
+    if( iTargetField >= CSLCount( papszRecord ) )
+        return "";
+
+    return( papszRecord[iTargetField] );
+}
+
+/************************************************************************/
+/*                            CSVFilename()                             */
+/*                                                                      */
+/*      Return the full path to a particular CSV file.  This will       */
+/*      eventually be something the application can override.           */
+/************************************************************************/
+
+static const char *(*pfnCSVFilenameHook)(const char *) = NULL;
+
+const char * CSVFilename( const char *pszBasename )
+
+{
+    static char		szPath[512];
+
+    if( pfnCSVFilenameHook == NULL )
+    {
+        FILE	*fp = NULL;
+
+        if( getenv("GEOTIFF_CSV") != NULL )
+        {
+            sprintf( szPath, "%s/%s", getenv("GEOTIFF_CSV"), pszBasename );
+        }
+#ifdef CSV_DATA_DIR
+        else 
+        {
+            sprintf( szPath, "%s/%s", CSV_DATA_DIR, pszBasename );
+        }
+#else
+        else if( (fp = fopen( "/usr/local/share/epsg/csv/pcs.csv", "rt" )) != NULL )
+        {
+            sprintf( szPath, "/usr/local/share/epsg/csv/%s", pszBasename );
+        }
+        else if( (fp = fopen( "csv/pcs.csv", "rt" )) != NULL )
+        {
+            sprintf( szPath, "csv/%s", pszBasename );
+        }
+        else if( (fp = fopen( "share/epsg_csv/pcs.csv", "rt" )) != NULL )
+        {
+            sprintf( szPath, "share/epsg_csv/%s", pszBasename );
+        }
+        else if( (fp = fopen( "/usr/share/epsg_csv/pcs.csv", "rt" )) != NULL )
+        {
+            sprintf( szPath, "/usr/share/epsg_csv/%s", pszBasename );
+        }
+        else
+        {
+            sprintf( szPath, "/usr/local/share/epsg_csv/%s", pszBasename );
+        }
+#endif
+
+        if( fp != NULL )
+            fclose( fp );
+        
+        return( szPath );
+    }
+    else
+        return( pfnCSVFilenameHook( pszBasename ) );
+}
+
+/************************************************************************/
+/*                         SetCSVFilenameHook()                         */
+/*                                                                      */
+/*      Applications can use this to set a function that will           */
+/*      massage CSV filenames.                                          */
+/************************************************************************/
+
+/**
+ * Override CSV file search method.
+ *
+ * @param CSVFileOverride The pointer to a function which will return the
+ * full path for a given filename.
+  *
+
+This function allows an application to override how the GTIFGetDefn() and related function find the CSV (Comma Separated
+Value) values required. The pfnHook argument should be a pointer to a function that will take in a CSV filename and return a
+full path to the file. The returned string should be to an internal static buffer so that the caller doesn't have to free the result.
+
+<b>Example:</b><br>
+
+The listgeo utility uses the following override function if the user
+specified a CSV file directory with the -t commandline switch (argument
+put into CSVDirName).  <p>
+
+<pre>
+
+    ...
+
+
+    SetCSVFilenameHook( CSVFileOverride );
+
+    ...
+
+
+static const char *CSVFileOverride( const char * pszInput )
+
+{
+    static char         szPath[1024];
+
+#ifdef WIN32
+    sprintf( szPath, "%s\\%s", CSVDirName, pszInput );
+#else    
+    sprintf( szPath, "%s/%s", CSVDirName, pszInput );
+#endif    
+
+    return( szPath );
+}
+</pre>
+
+*/
+
+void SetCSVFilenameHook( const char *(*pfnNewHook)( const char * ) )
+
+{
+    pfnCSVFilenameHook = pfnNewHook;
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/cpl_csv_incode.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/cpl_csv_incode.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/cpl_csv_incode.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,230 @@
+/**********************************************************************
+ * $Id: cpl_csv_incode.c,v 1.8 2007/07/20 18:08:29 fwarmerdam Exp $
+ *
+ * Name:     cpl_struct.c
+ * Project:  libgeotiff
+ * Purpose:  Provide "CSV API" interface to in-code EPSG CSV tables.
+ * Author:   Derrick J Brashear <shadow at dementia.org>
+ *
+ ******************************************************************************
+ * 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: cpl_csv_incode.c,v $
+ * Revision 1.8  2007/07/20 18:08:29  fwarmerdam
+ * Handle unexpected .csv files, and missing records more gracefully.
+ *
+ * Revision 1.7  2004/03/23 18:21:56  warmerda
+ * Added CSVReadParseLine() stub
+ *
+ * Revision 1.6  2003/01/20 21:42:52  warmerda
+ * Ensure CSVGetField() does not crash if record not found.
+ *
+ * Revision 1.5  2003/01/20 07:11:04  warmerda
+ * updated csv-incode support to 6.2.2
+ *
+ * Revision 1.4  2002/06/19 03:51:15  warmerda
+ * migrated cpl_csv.h into cpl_serv.h
+ *
+ * Revision 1.3  2002/02/11 14:22:22  warmerda
+ * Added stub CSVDeaccess().
+ *
+ * Revision 1.2  2001/06/28 17:53:20  warmerda
+ * Use EQUAL instead of strcasecmp() to ensure code builds on windows.
+ * As per http://bugzilla.remotesensing.org/show_bug.cgi?id=59
+ *
+ * Revision 1.1  1999/12/10 18:00:58  warmerda
+ * New
+ *
+ */
+
+#include "cpl_serv.h"
+
+#include "defs.h"
+
+extern const datafile_rows_t *pcs_rows[];
+extern const datafile_rows_t *gcs_rows[];
+extern const datafile_rows_t *ellipsoid_rows[];
+extern const datafile_rows_t *prime_meridian_rows[];
+extern const datafile_rows_t *datum_rows[];
+extern const datafile_rows_t *unit_of_measure_rows[];
+extern const datafile_rows_t *projop_wparm_rows[];
+
+
+/* Pointers to data */
+static const datafile_t files[] = {
+  { "pcs", pcs_rows },
+  { "gcs", gcs_rows },
+  { "ellipsoid", ellipsoid_rows },
+  { "prime_meridian", prime_meridian_rows },
+  { "datum", datum_rows },
+  { "unit_of_measure", unit_of_measure_rows },
+  { "projop_wparm", projop_wparm_rows },
+  { NULL, NULL }
+};
+
+#if 0
+main()
+{
+  datafile_t *csvfile;
+  char **papszRecord;
+  int i, row, col;
+
+  papszRecord = CSVScanFileByName( "horiz_cs.csv", "HORIZCS_CODE",
+				   "2200", CC_Integer );
+
+  printf ("%s %s\n", papszRecord[0], papszRecord[1]);
+  csvfile = &files[0];
+  while (csvfile->name != NULL) {
+    printf("file name is %s\n", csvfile->name);
+    for (i = 0; csvfile->cols[i]; i++) {
+      printf("column name is %s\n", csvfile->cols[i]);
+      row = 1; col = 0;
+      if (csvfile->rows[row] && csvfile->rows[row][col])
+	printf("value %d,%d is %s\n", row, col, csvfile->rows[row][col]);
+    }
+    csvfile++;
+  }
+}
+#endif
+
+const char * CSVFilename( const char *pszBasename )
+{
+  return pszBasename;
+}
+
+static int CSVCompare( const char * pszFieldValue, const char * pszTarget,
+                       CSVCompareCriteria eCriteria )
+{
+    if( eCriteria == CC_ExactString )
+    {
+        return( !EQUAL( pszFieldValue, pszTarget ) == 0 );
+    }
+    else if( eCriteria == CC_ApproxString )
+    {
+        return( !EQUAL( pszFieldValue, pszTarget ) );
+    }
+    else if( eCriteria == CC_Integer )
+    {
+        return( atoi(pszFieldValue) == atoi(pszTarget) );
+    }
+    return FALSE;
+}
+
+void CSVDeaccess( const char *pszFilename )
+{
+}
+
+static int __CSVGetFileId( const char * pszFilename)
+{
+  datafile_t *csvfile;
+  int i = 0;
+
+  csvfile = (datafile_t *)&files[i];
+  for (i = 0; csvfile->name; i++, csvfile = (datafile_t *)&files[i])
+  {
+    if (!strncmp(csvfile->name,pszFilename,(strlen(pszFilename)-4)))
+      return i;
+  }
+
+  return -1;
+}
+
+char **CSVScanFileByName( const char * pszFilename,
+                          const char * pszKeyFieldName,
+                          const char * pszValue, 
+                          CSVCompareCriteria eCriteria )
+{
+  datafile_t *csvfile;
+  int row, col, iFile;
+
+  iFile = __CSVGetFileId(pszFilename);
+  if( iFile == -1 )
+      return NULL;
+
+  col = CSVGetFileFieldId(pszFilename, pszKeyFieldName);
+
+  csvfile = (datafile_t *)&files[iFile];
+  for (row = 1; ((csvfile->rows[row] != 0) && (csvfile->rows[row][col] != 0));
+       row++) {
+    if (CSVCompare(csvfile->rows[row][col], pszValue, eCriteria))
+      return ((char **)csvfile->rows[row]);
+  }
+
+  return NULL;
+}
+
+int CSVGetFileFieldId( const char * pszFilename, const char * pszFieldName)
+{
+    datafile_t *csvfile;
+    int i, iFile;
+
+    iFile = __CSVGetFileId(pszFilename);
+    if( iFile == -1 )
+        return -1;
+
+    csvfile = (datafile_t *)&files[iFile];
+    if (!strncmp(csvfile->name,pszFilename,(strlen(pszFilename)-4)))
+    {
+        for (i = 0; csvfile->rows[0][i]; i++) 
+            if (EQUAL(pszFieldName, csvfile->rows[0][i]))
+                return i;
+    }
+
+    return -1;
+}
+
+const char *CSVGetField( const char * pszFilename,
+                         const char * pszKeyFieldName,
+                         const char * pszKeyFieldValue,
+                         CSVCompareCriteria eCriteria,
+                         const char * pszTargetField )
+{
+  char **papszRecord;
+  int  iField;
+
+  papszRecord = CSVScanFileByName( pszFilename, pszKeyFieldName,
+				   pszKeyFieldValue, CC_Integer );
+
+  if( papszRecord == NULL )
+      return "";
+
+  iField = CSVGetFileFieldId(pszFilename, pszTargetField);
+
+  if( iField == -1 )
+      return "";
+  else
+      return (papszRecord[iField]);
+}
+
+/* Dummy function */
+void SetCSVFilenameHook( const char *(*pfnNewHook)( const char * ) )
+
+{
+}
+
+/* dummy function */
+
+char **CSVReadParseLine( FILE * fp )
+
+{
+    return NULL;
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/cpl_serv.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/cpl_serv.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/cpl_serv.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,596 @@
+/******************************************************************************
+ * Copyright (c) 1998, 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.
+ ******************************************************************************
+ *
+ * cpl_serv.c: Various Common Portability Library derived convenience functions
+ *
+ * $Log: cpl_serv.c,v $
+ * Revision 1.8  2001/07/09 20:14:37  warmerda
+ * Another problem freeing pszRLBuffer and not setting to NULL.
+ *
+ * Revision 1.7  2001/04/17 13:40:43  warmerda
+ * fixed freeing of line buffer in CPLReadLine(), init ptr to NULL
+ *
+ * Revision 1.6  2001/03/05 04:56:17  warmerda
+ * make it possible to deallocate CPLReadLine buffer
+ *
+ * Revision 1.5  2000/09/30 03:35:05  warmerda
+ * Fixed CPLReadLine() to use avoid calling VSIRealloc() on a NULL pointer.
+ *
+ * Revision 1.4  1999/06/25 04:35:26  warmerda
+ * Fixed to actually support long lines.
+ *
+ * Revision 1.3  1999/03/17 20:43:03  geotiff
+ * Avoid use of size_t keyword
+ *
+ * Revision 1.2  1999/03/10 18:22:39  geotiff
+ * Added string.h, fixed backslash escaping
+ *
+ * Revision 1.1  1999/03/09 15:57:04  geotiff
+ * New
+ *
+ */
+
+#include "cpl_serv.h"
+#include "geo_tiffp.h"
+
+#ifdef HAVE_STRING_H
+#  include <string.h>
+#endif
+#if defined(HAVE_STRINGS_H) && !defined(HAVE_STRING_H)
+#  include <strings.h>
+#endif
+
+/************************************************************************/
+/*                             CPLCalloc()                              */
+/************************************************************************/
+
+void *CPLCalloc( int nCount, int nSize )
+
+{
+    void	*pReturn;
+
+    if( nSize == 0 )
+        return NULL;
+    
+    pReturn = VSICalloc( nCount, nSize );
+    if( pReturn == NULL )
+    {
+        CPLError( CE_Fatal, CPLE_OutOfMemory,
+                  "CPLCalloc(): Out of memory allocating %d bytes.\n",
+                  nSize * nCount );
+    }
+
+    return pReturn;
+}
+
+/************************************************************************/
+/*                             CPLMalloc()                              */
+/************************************************************************/
+
+void *CPLMalloc( int nSize )
+
+{
+    void	*pReturn;
+
+    if( nSize == 0 )
+        return NULL;
+    
+    pReturn = VSIMalloc( nSize );
+    if( pReturn == NULL )
+    {
+        CPLError( CE_Fatal, CPLE_OutOfMemory,
+                  "CPLMalloc(): Out of memory allocating %d bytes.\n",
+                  nSize );
+    }
+
+    return pReturn;
+}
+
+/************************************************************************/
+/*                             CPLRealloc()                             */
+/************************************************************************/
+
+void * CPLRealloc( void * pData, int nNewSize )
+
+{
+    void	*pReturn;
+
+    if( pData == NULL )
+        pReturn = VSIMalloc( nNewSize );
+    else
+        pReturn = VSIRealloc( pData, nNewSize );
+    
+    if( pReturn == NULL )
+    {
+        CPLError( CE_Fatal, CPLE_OutOfMemory,
+                  "CPLRealloc(): Out of memory allocating %d bytes.\n",
+                  nNewSize );
+    }
+
+    return pReturn;
+}
+
+/************************************************************************/
+/*                             CPLStrdup()                              */
+/************************************************************************/
+
+char *CPLStrdup( const char * pszString )
+
+{
+    char	*pszReturn;
+
+    if( pszString == NULL )
+        pszString = "";
+
+    pszReturn = VSIMalloc( strlen(pszString)+1 );
+        
+    if( pszReturn == NULL )
+    {
+        CPLError( CE_Fatal, CPLE_OutOfMemory,
+                  "CPLStrdup(): Out of memory allocating %d bytes.\n",
+                  strlen(pszString) );
+        
+    }
+
+    strcpy( pszReturn, pszString );
+    
+    return( pszReturn );
+}
+
+/************************************************************************/
+/*                            CPLReadLine()                             */
+/*                                                                      */
+/*      Read a line of text from the given file handle, taking care     */
+/*      to capture CR and/or LF and strip off ... equivelent of         */
+/*      DKReadLine().  Pointer to an internal buffer is returned.       */
+/*      The application shouldn't free it, or depend on it's value      */
+/*      past the next call to CPLReadLine()                             */
+/************************************************************************/
+
+const char *CPLReadLine( FILE * fp )
+
+{
+    static char	*pszRLBuffer = NULL;
+    static int	nRLBufferSize = 0;
+    int		nLength, nReadSoFar = 0;
+
+/* -------------------------------------------------------------------- */
+/*      Cleanup case.                                                   */
+/* -------------------------------------------------------------------- */
+    if( fp == NULL )
+    {
+        CPLFree( pszRLBuffer );
+        pszRLBuffer = NULL;
+        nRLBufferSize = 0;
+        return NULL;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Loop reading chunks of the line till we get to the end of       */
+/*      the line.                                                       */
+/* -------------------------------------------------------------------- */
+    do {
+/* -------------------------------------------------------------------- */
+/*      Grow the working buffer if we have it nearly full.  Fail out    */
+/*      of read line if we can't reallocate it big enough (for          */
+/*      instance for a _very large_ file with no newlines).             */
+/* -------------------------------------------------------------------- */
+        if( nRLBufferSize-nReadSoFar < 128 )
+        {
+            nRLBufferSize = nRLBufferSize*2 + 128;
+            if( pszRLBuffer == NULL )
+                pszRLBuffer = (char *) VSIMalloc(nRLBufferSize);
+            else
+                pszRLBuffer = (char *) VSIRealloc(pszRLBuffer, nRLBufferSize);
+            if( pszRLBuffer == NULL )
+            {
+                nRLBufferSize = 0;
+                return NULL;
+            }
+        }
+
+/* -------------------------------------------------------------------- */
+/*      Do the actual read.                                             */
+/* -------------------------------------------------------------------- */
+        if( VSIFGets( pszRLBuffer+nReadSoFar, nRLBufferSize-nReadSoFar, fp )
+            == NULL )
+        {
+            CPLFree( pszRLBuffer );
+            pszRLBuffer = NULL;
+            nRLBufferSize = 0;
+
+            return NULL;
+        }
+
+        nReadSoFar = strlen(pszRLBuffer);
+
+    } while( nReadSoFar == nRLBufferSize - 1
+             && pszRLBuffer[nRLBufferSize-2] != 13
+             && pszRLBuffer[nRLBufferSize-2] != 10 );
+
+/* -------------------------------------------------------------------- */
+/*      Clear CR and LF off the end.                                    */
+/* -------------------------------------------------------------------- */
+    nLength = strlen(pszRLBuffer);
+    if( nLength > 0
+        && (pszRLBuffer[nLength-1] == 10 || pszRLBuffer[nLength-1] == 13) )
+    {
+        pszRLBuffer[--nLength] = '\0';
+    }
+    
+    if( nLength > 0
+        && (pszRLBuffer[nLength-1] == 10 || pszRLBuffer[nLength-1] == 13) )
+    {
+        pszRLBuffer[--nLength] = '\0';
+    }
+
+    return( pszRLBuffer );
+}
+
+
+/*=====================================================================
+                    StringList manipulation functions.
+ =====================================================================*/
+
+/**********************************************************************
+ *                       CSLAddString()
+ *
+ * Append a string to a StringList and return a pointer to the modified
+ * StringList.
+ * If the input StringList is NULL, then a new StringList is created.
+ **********************************************************************/
+char **CSLAddString(char **papszStrList, const char *pszNewString)
+{
+    int nItems=0;
+
+    if (pszNewString == NULL)
+        return papszStrList;    /* Nothing to do!*/
+
+    /* Allocate room for the new string */
+    if (papszStrList == NULL)
+        papszStrList = (char**) CPLCalloc(2,sizeof(char*));
+    else
+    {
+        nItems = CSLCount(papszStrList);
+        papszStrList = (char**)CPLRealloc(papszStrList, 
+                                          (nItems+2)*sizeof(char*));
+    }
+
+    /* Copy the string in the list */
+    papszStrList[nItems] = CPLStrdup(pszNewString);
+    papszStrList[nItems+1] = NULL;
+
+    return papszStrList;
+}
+
+/**********************************************************************
+ *                       CSLCount()
+ *
+ * Return the number of lines in a Stringlist.
+ **********************************************************************/
+int CSLCount(char **papszStrList)
+{
+    int nItems=0;
+
+    if (papszStrList)
+    {
+        while(*papszStrList != NULL)
+        {
+            nItems++;
+            papszStrList++;
+        }
+    }
+
+    return nItems;
+}
+
+
+/************************************************************************/
+/*                            CSLGetField()                             */
+/*                                                                      */
+/*      Fetches the indicated field, being careful not to crash if      */
+/*      the field doesn't exist within this string list.  The           */
+/*      returned pointer should not be freed, and doesn't               */
+/*      necessarily last long.                                          */
+/************************************************************************/
+
+const char * CSLGetField( char ** papszStrList, int iField )
+
+{
+    int         i;
+
+    if( papszStrList == NULL || iField < 0 )
+        return( "" );
+
+    for( i = 0; i < iField+1; i++ )
+    {
+        if( papszStrList[i] == NULL )
+            return "";
+    }
+
+    return( papszStrList[iField] );
+}
+
+/**********************************************************************
+ *                       CSLDestroy()
+ *
+ * Free all memory used by a StringList.
+ **********************************************************************/
+void CSLDestroy(char **papszStrList)
+{
+    char **papszPtr;
+
+    if (papszStrList)
+    {
+        papszPtr = papszStrList;
+        while(*papszPtr != NULL)
+        {
+            CPLFree(*papszPtr);
+            papszPtr++;
+        }
+
+        CPLFree(papszStrList);
+    }
+}
+
+
+/**********************************************************************
+ *                       CSLDuplicate()
+ *
+ * Allocate and return a copy of a StringList.
+ **********************************************************************/
+char    **CSLDuplicate(char **papszStrList)
+{
+    char **papszNewList, **papszSrc, **papszDst;
+    int  nLines;
+
+    nLines = CSLCount(papszStrList);
+
+    if (nLines == 0)
+        return NULL;
+
+    papszNewList = (char **)CPLMalloc((nLines+1)*sizeof(char*));
+    papszSrc = papszStrList;
+    papszDst = papszNewList;
+
+    while(*papszSrc != NULL)
+    {
+        *papszDst = CPLStrdup(*papszSrc);
+
+        papszSrc++;
+        papszDst++;
+    }
+    *papszDst = NULL;
+
+    return papszNewList;
+}
+
+/**********************************************************************
+ *                       CSLTokenizeString()
+ *
+ * Tokenizes a string and returns a StringList with one string for
+ * each token.
+ **********************************************************************/
+char    **CSLTokenizeString( const char *pszString )
+{
+    return CSLTokenizeStringComplex( pszString, " ", TRUE, FALSE );
+}
+
+/************************************************************************/
+/*                      CSLTokenizeStringComplex()                      */
+/*                                                                      */
+/*      The ultimate tokenizer?                                         */
+/************************************************************************/
+
+char ** CSLTokenizeStringComplex( const char * pszString,
+                                  const char * pszDelimiters,
+                                  int bHonourStrings, int bAllowEmptyTokens )
+
+{
+    char	**papszRetList = NULL;
+    char 	*pszToken;
+    int		nTokenMax, nTokenLen;
+
+    pszToken = (char *) CPLCalloc(10,1);
+    nTokenMax = 10;
+    
+    while( pszString != NULL && *pszString != '\0' )
+    {
+        int	bInString = FALSE;
+
+        nTokenLen = 0;
+        
+        /* Try to find the next delimeter, marking end of token */
+        for( ; *pszString != '\0'; pszString++ )
+        {
+
+            /* End if this is a delimeter skip it and break. */
+            if( !bInString && strchr(pszDelimiters, *pszString) != NULL )
+            {
+                pszString++;
+                break;
+            }
+            
+            /* If this is a quote, and we are honouring constant
+               strings, then process the constant strings, with out delim
+               but don't copy over the quotes */
+            if( bHonourStrings && *pszString == '"' )
+            {
+                if( bInString )
+                {
+                    bInString = FALSE;
+                    continue;
+                }
+                else
+                {
+                    bInString = TRUE;
+                    continue;
+                }
+            }
+
+            /* Within string constants we allow for escaped quotes, but
+               in processing them we will unescape the quotes */
+            if( bInString && pszString[0] == '\\' && pszString[1] == '"' )
+            {
+                pszString++;
+            }
+
+            /* Within string constants a \\ sequence reduces to \ */
+            else if( bInString
+                     && pszString[0] == '\\' && pszString[1] == '\\' )
+            {
+                pszString++;
+            }
+
+            if( nTokenLen >= nTokenMax-1 )
+            {
+                nTokenMax = nTokenMax * 2 + 10;
+                pszToken = (char *) CPLRealloc( pszToken, nTokenMax );
+            }
+
+            pszToken[nTokenLen] = *pszString;
+            nTokenLen++;
+        }
+
+        pszToken[nTokenLen] = '\0';
+
+        if( pszToken[0] != '\0' || bAllowEmptyTokens )
+        {
+            papszRetList = CSLAddString( papszRetList, pszToken );
+        }
+    }
+
+    if( papszRetList == NULL )
+        papszRetList = (char **) CPLCalloc(sizeof(char *),1);
+
+    CPLFree( pszToken );
+
+    return papszRetList;
+}
+
+/* static buffer to store the last error message.  We'll assume that error
+ * messages cannot be longer than 2000 chars... which is quite reasonable
+ * (that's 25 lines of 80 chars!!!)
+ */
+static char gszCPLLastErrMsg[2000] = "";
+static int  gnCPLLastErrNo = 0;
+
+static void (*gpfnCPLErrorHandler)(CPLErr, int, const char *) = NULL;
+
+/**********************************************************************
+ *                          CPLError()
+ *
+ * This function records an error code and displays the error message
+ * to stderr.
+ *
+ * The error code can be accessed later using CPLGetLastErrNo()
+ **********************************************************************/
+void    CPLError(CPLErr eErrClass, int err_no, const char *fmt, ...)
+{
+    va_list args;
+
+    /* Expand the error message 
+     */
+    va_start(args, fmt);
+    vsprintf(gszCPLLastErrMsg, fmt, args);
+    va_end(args);
+
+    /* If the user provided his own error handling function, then call
+     * it, otherwise print the error to stderr and return.
+     */
+    gnCPLLastErrNo = err_no;
+
+    if (gpfnCPLErrorHandler != NULL)
+    {
+        gpfnCPLErrorHandler(eErrClass, err_no, gszCPLLastErrMsg);
+    }
+    else
+    {
+        fprintf(stderr, "ERROR %d: %s\n", gnCPLLastErrNo, gszCPLLastErrMsg);
+    }
+
+    if( eErrClass == CE_Fatal )
+        abort();
+}
+
+/**********************************************************************
+ *                          CPLErrorReset()
+ *
+ * Erase any traces of previous errors.
+ **********************************************************************/
+void    CPLErrorReset()
+{
+    gnCPLLastErrNo = 0;
+    gszCPLLastErrMsg[0] = '\0';
+}
+
+
+/**********************************************************************
+ *                          CPLGetLastErrorNo()
+ *
+ **********************************************************************/
+int     CPLGetLastErrorNo()
+{
+    return gnCPLLastErrNo;
+}
+
+/**********************************************************************
+ *                          CPLGetLastErrorMsg()
+ *
+ **********************************************************************/
+const char* CPLGetLastErrorMsg()
+{
+    return gszCPLLastErrMsg;
+}
+
+/**********************************************************************
+ *                          CPLSetErrorHandler()
+ *
+ * Allow the library's user to specify his own error handler function.
+ *
+ * A valid error handler is a C function with the following prototype:
+ *
+ *     void MyErrorHandler(int errno, const char *msg)
+ *
+ * Pass NULL to come back to the default behavior.
+ **********************************************************************/
+
+void     CPLSetErrorHandler(void (*pfnErrorHandler)(CPLErr, int, const char *))
+{
+    gpfnCPLErrorHandler = pfnErrorHandler;
+}
+
+/************************************************************************/
+/*                             _CPLAssert()                             */
+/*                                                                      */
+/*      This function is called only when an assertion fails.           */
+/************************************************************************/
+
+void _CPLAssert( const char * pszExpression, const char * pszFile,
+                 int iLine )
+
+{
+    CPLError( CE_Fatal, CPLE_AssertionFailed,
+              "Assertion `%s' failed\n"
+              "in file `%s', line %d\n",
+              pszExpression, pszFile, iLine );
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/cpl_serv.h
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/cpl_serv.h	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/cpl_serv.h	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,276 @@
+/******************************************************************************
+ * Copyright (c) 1998, 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.
+ ******************************************************************************
+ *
+ * cpl_serv.h
+ *
+ * This include file derived and simplified from the GDAL Common Portability
+ * Library.
+ */
+
+#ifndef CPL_SERV_H_INCLUDED
+#define CPL_SERV_H_INCLUDED
+
+/* ==================================================================== */
+/*	Standard include files.						*/
+/* ==================================================================== */
+
+#include "geo_config.h"
+#include <stdio.h>
+
+#include <math.h>
+
+#ifdef HAVE_STRING_H
+#  include <string.h>
+#endif
+#if defined(HAVE_STRINGS_H) && !defined(HAVE_STRING_H)
+#  include <strings.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#  include <stdlib.h>
+#endif
+
+/**********************************************************************
+ * Do we want to build as a DLL on windows?
+ **********************************************************************/
+#if !defined(CPL_DLL)
+#  if defined(_WIN32) && defined(BUILD_AS_DLL)
+#    define CPL_DLL     __declspec(dllexport)
+#  else
+#    define CPL_DLL
+#  endif
+#endif
+
+/* ==================================================================== */
+/*      Other standard services.                                        */
+/* ==================================================================== */
+#ifdef __cplusplus
+#  define CPL_C_START		extern "C" {
+#  define CPL_C_END		}
+#else
+#  define CPL_C_START
+#  define CPL_C_END
+#endif
+
+#ifndef NULL
+#  define NULL	0
+#endif
+
+#ifndef FALSE
+#  define FALSE	0
+#endif
+
+#ifndef TRUE
+#  define TRUE	1
+#endif
+
+#ifndef MAX
+#  define MIN(a,b)      ((a<b) ? a : b)
+#  define MAX(a,b)      ((a>b) ? a : b)
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef ABS
+#  define ABS(x)        ((x<0) ? (-1*(x)) : x)
+#endif
+
+#ifndef EQUAL
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#  define EQUALN(a,b,n)           (strnicmp(a,b,n)==0)
+#  define EQUAL(a,b)              (stricmp(a,b)==0)
+#else
+#  define EQUALN(a,b,n)           (strncasecmp(a,b,n)==0)
+#  define EQUAL(a,b)              (strcasecmp(a,b)==0)
+#endif
+#endif
+
+/* ==================================================================== */
+/*      VSI Services (just map directly onto Standard C services.       */
+/* ==================================================================== */
+
+#define VSIFOpen	fopen
+#define VSIFClose	fclose
+#define VSIFEof		feof
+#define VSIFPrintf	fprintf
+#define VSIFPuts	fputs
+#define VSIFPutc	fputc
+#define VSIFGets	fgets
+#define VSIRewind	rewind
+#define VSIFSeek        fseek
+#define VSIFTell        ftell
+#define VSIFRead        fread
+
+#ifndef notdef
+#define VSICalloc(x,y)	_GTIFcalloc(x*y)
+#define VSIMalloc	_GTIFcalloc
+#define VSIFree	        _GTIFFree
+#define VSIRealloc      _GTIFrealloc
+#else
+#define VSICalloc(x,y)	(((char *) _GTIFcalloc(x*y+4)) + 4)
+#define VSIMalloc(x)	(((char *) _GTIFcalloc((x)+4)) + 4)
+#define VSIFree(x)      _GTIFFree(((char *) (x)) - 4)
+#define VSIRealloc(p,n) (((char *) _GTIFrealloc(((char *)p)-4,(n)+4)) + 4)
+#endif
+
+/* -------------------------------------------------------------------- */
+/*      Safe malloc() API.  Thin cover over VSI functions with fatal    */
+/*      error reporting if memory allocation fails.                     */
+/* -------------------------------------------------------------------- */
+CPL_C_START
+
+#define CPLMalloc  gtCPLMalloc
+#define CPLCalloc  gtCPLCalloc
+#define CPLRealloc gtCPLRealloc
+#define CPLStrdup  gtCPLStrdup
+
+void CPL_DLL *CPLMalloc( int );
+void CPL_DLL *CPLCalloc( int, int );
+void CPL_DLL *CPLRealloc( void *, int );
+char CPL_DLL *CPLStrdup( const char * );
+
+#define CPLFree(x)	{ if( x != NULL ) VSIFree(x); }
+
+/* -------------------------------------------------------------------- */
+/*      Read a line from a text file, and strip of CR/LF.               */
+/* -------------------------------------------------------------------- */
+
+#define CPLReadLine gtCPLReadLine
+
+const char CPL_DLL *CPLReadLine( FILE * );
+
+/*=====================================================================
+                   Error handling functions (cpl_error.c)
+ =====================================================================*/
+
+typedef enum
+{
+    CE_None = 0,
+    CE_Log = 1,
+    CE_Warning = 2,
+    CE_Failure = 3,
+    CE_Fatal = 4
+} CPLErr;
+
+#define CPLError      gtCPLError
+#define CPLErrorReset gtCPLErrorReset
+#define CPLGetLastErrorNo gtCPLGetLastErrorNo
+#define CPLGetLastErrorMsg gtCPLGetLastErrorMsg
+#define CPLSetErrorHandler gtCPLSetErrorHandler
+#define _CPLAssert    gt_CPLAssert
+
+void CPL_DLL CPLError(CPLErr eErrClass, int err_no, const char *fmt, ...);
+void CPL_DLL CPLErrorReset();
+int  CPL_DLL CPLGetLastErrorNo();
+const char CPL_DLL * CPLGetLastErrorMsg();
+void CPL_DLL CPLSetErrorHandler(void(*pfnErrorHandler)(CPLErr,int,
+                                                       const char *));
+void CPL_DLL _CPLAssert( const char *, const char *, int );
+
+#ifdef DEBUG
+#  define CPLAssert(expr)  ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__))
+#else
+#  define CPLAssert(expr)
+#endif
+
+CPL_C_END
+
+/* ==================================================================== */
+/*      Well known error codes.                                         */
+/* ==================================================================== */
+
+#define CPLE_AppDefined			1
+#define CPLE_OutOfMemory		2
+#define CPLE_FileIO			3
+#define CPLE_OpenFailed			4
+#define CPLE_IllegalArg			5
+#define CPLE_NotSupported		6
+#define CPLE_AssertionFailed		7
+#define CPLE_NoWriteAccess		8
+
+/*=====================================================================
+                   Stringlist functions (strlist.c)
+ =====================================================================*/
+CPL_C_START
+
+#define CSLAddString gtCSLAddString
+#define CSLCount     gtCSLCount
+#define CSLGetField  gtCSLGetField
+#define CSLDestroy   gtCSLDestroy
+#define CSLDuplicate gtCSLDuplicate
+#define CSLTokenizeString gtCSLTokenizeString
+#define CSLTokenizeStringComplex gtCSLTokenizeStringComplex
+
+char CPL_DLL   **CSLAddString(char **papszStrList, const char *pszNewString);
+int  CPL_DLL   CSLCount(char **papszStrList);
+const char CPL_DLL *CSLGetField( char **, int );
+void CPL_DLL   CSLDestroy(char **papszStrList);
+char CPL_DLL   **CSLDuplicate(char **papszStrList);
+
+char CPL_DLL   **CSLTokenizeString(const char *pszString );
+char CPL_DLL   **CSLTokenizeStringComplex(const char *pszString,
+                                   const char *pszDelimiter,
+                                   int bHonourStrings, int bAllowEmptyTokens );
+
+/* ==================================================================== */
+/*      .csv file related functions (from cpl_csv.c)                    */
+/* ==================================================================== */
+
+typedef enum {
+    CC_ExactString,
+    CC_ApproxString,
+    CC_Integer
+} CSVCompareCriteria;
+
+#define CSVFilename gtCSVFilename
+#define CSVReadParseLine gtCSVReadParseLine
+#define CSVScanLines gtCSVScanLines
+#define CSVScanFile gtCSVScanFile
+#define CSVScanFileByName gtCSVScanFileByName
+#define CSVGetFieldId gtCSVGetFieldId
+#define CSVDeaccess gtCSVDeaccess
+#define CSVGetField gtCSVGetField
+#define SetCSVFilenameHook gtSetCSVFilenameHook
+#define CSVGetFileFieldId gtCSVGetFileFieldId
+
+const char CPL_DLL *CSVFilename( const char * );
+
+char CPL_DLL **CSVReadParseLine( FILE * );
+char CPL_DLL **CSVScanLines( FILE *, int, const char *, CSVCompareCriteria );
+char CPL_DLL **CSVScanFile( const char *, int, const char *,
+                            CSVCompareCriteria );
+char CPL_DLL **CSVScanFileByName( const char *, const char *, const char *,
+                                  CSVCompareCriteria );
+int CPL_DLL CSVGetFieldId( FILE *, const char * );
+int CPL_DLL CSVGetFileFieldId( const char *, const char * );
+
+void CPL_DLL CSVDeaccess( const char * );
+
+const char CPL_DLL *CSVGetField( const char *, const char *, const char *,
+                                 CSVCompareCriteria, const char * );
+
+void CPL_DLL SetCSVFilenameHook( const char *(*)(const char *) );
+
+CPL_C_END
+
+#endif /* ndef CPL_SERV_H_INCLUDED */

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/README.Debian
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/README.Debian	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/README.Debian	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,13 @@
+libgeotiff for Debian
+---------------------
+
+** IMPORTANT ** IMPORTANT ** IMPORTANT ** IMPORTANT **
+
+This version of the GeoTIFF library lacks the EPSG data files which are distributed
+in a separate non-free package libgeotiff-epsg due to license limitations. 
+The library is anyway working and usable also without those files. If you need 
+to have reference information for standard projections, you have to install 
+that additional package.
+
+ -- Francesco Paolo Lovergine <frankie at debian.org>  Wed, 19 Sep 2007 10:51:31 +0200
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/changelog
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/changelog	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/changelog	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,6 @@
+libgeotiff-dfsg (1.2.4-1) UNRELEASED; urgency=low
+
+  * Initial release (closes: #418184)
+
+ -- Francesco Paolo Lovergine <frankie at debian.org>  Wed,  4 Apr 2007 20:45:27 +0200
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/compat
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/compat	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/compat	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1 @@
+5

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/control
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/control	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/control	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,53 @@
+Source: libgeotiff-dfsg
+Priority: extra
+Maintainer: Debian GIS Project <pkg-grass-devel at lists.alioth.debian.org>
+Uploaders: Francesco Paolo Lovergine <frankie at debian.org>
+Build-Depends: debhelper (>= 5), autotools-dev, proj, zlib1g-dev, libjpeg62-dev, libtiff4-dev, dpatch
+Standards-Version: 3.7.2
+Section: science
+
+Package: libgeotiff-dev
+Section: libdevel
+Architecture: any
+Depends: libgeotiff1.2 (= ${Source-Version})
+Suggests: libgeotiff-epsg
+Description: the GeoTIFF library -- development files
+ This C library supports TIFF 6.0 based interchange format for georeferenced 
+ raster imagery. The GeoTIFF standard has been developed for reading, and writing
+ geographic meta-information tags on top of TIFF raster.
+ .
+  Home page: http://geotiff.maptools.org/
+ .
+ This package contains stuff to be used to develop programs based 
+ on the GeoTIFF library.
+
+Package: libgeotiff1.2
+Section: libs
+Architecture: any
+Suggests: geotiff-bin, gdal-bin, libgeotiff-epsg
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: the GeoTIFF library -- run-time files
+ This C library supports TIFF 6.0 based interchange format for georeferenced 
+ raster imagery. The GeoTIFF standard has been developed for reading, and writing
+ geographic meta-information tags on top of TIFF raster.
+ .
+  Home page: http://geotiff.maptools.org/
+ .
+ This package contains the shared library only.
+
+Package: geotiff-bin
+Section: science
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Suggests: gdal-bin, libgeotiff-epsg
+Description: the GeoTIFF library -- tools
+ This C library supports TIFF 6.0 based interchange format for georeferenced 
+ raster imagery. The GeoTIFF standard has been developed for reading, and writing
+ geographic meta-information tags on top of TIFF raster.
+ .
+ The GeoTIFF library comes with two utility programs here included:
+ .
+  listgeo - dumps the metadata of a GeoTIFF file.
+  geotifcp - applies metadata to a TIFF file, making it a GeoTIFF file.
+ .
+  Home page: http://geotiff.maptools.org/

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/copyright
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/copyright	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/copyright	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,66 @@
+This package was debianized by Francesco Paolo Lovergine <frankie at debian.org> on
+Wed,  4 Apr 2007 20:45:27 +0200.
+
+It was downloaded from http://remotesensing.org/geotiff/geotiff.html
+
+Upstream Author: Frank Warmerdam et al <warmerdam at pobox.com>
+
+Copyright: Copyright (c) 1999, Frank Warmerdam
+	   Copyright (c) 1995, Niles D. Ritter
+
+License:
+
+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 Debian packaging is (C) 2007, Francesco Paolo Lovergine <frankie at debian.org> and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/geotiff-bin.dirs
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/geotiff-bin.dirs	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/geotiff-bin.dirs	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1 @@
+usr/bin

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/geotiff-bin.docs
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/geotiff-bin.docs	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/geotiff-bin.docs	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,3 @@
+README
+docs/geotifcp.html
+docs/listgeo.html

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/geotiff-bin.install
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/geotiff-bin.install	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/geotiff-bin.install	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1 @@
+usr/bin/*

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff-dev.dirs
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff-dev.dirs	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff-dev.dirs	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,3 @@
+usr/lib
+usr/include/geotiff
+usr/share/doc/libgeotiff-dev

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff-dev.docs
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff-dev.docs	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff-dev.docs	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,3 @@
+README
+docs/index.dox
+docs/manual.txt

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff-dev.install
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff-dev.install	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff-dev.install	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,2 @@
+usr/include/*.h	usr/include/geotiff
+usr/lib/lib*.a

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff1.2.dirs
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff1.2.dirs	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff1.2.dirs	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,2 @@
+usr/lib
+usr/share/doc/libgeotiff1.2

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff1.2.docs
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff1.2.docs	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff1.2.docs	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,2 @@
+README
+README_BIN

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff1.2.install
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff1.2.install	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/libgeotiff1.2.install	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1 @@
+usr/lib/lib*.so.*

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/patches/00list
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/patches/00list	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/patches/00list	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,2 @@
+soname
+Makefile.in

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/patches/Makefile.in.dpatch
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/patches/Makefile.in.dpatch	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/patches/Makefile.in.dpatch	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,21 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## Makefile.in.dpatch by Francesco Paolo Lovergine <frankie at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+ at DPATCH@
+diff -urNad libgeotiff-1.2.4~/Makefile.in libgeotiff-1.2.4/Makefile.in
+--- libgeotiff-1.2.4~/Makefile.in	2007-09-19 11:23:28.000000000 +0200
++++ libgeotiff-1.2.4/Makefile.in	2007-09-19 11:24:01.000000000 +0200
+@@ -191,8 +191,8 @@
+ 	$(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)$(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 \


Property changes on: packages/geotiff/libgeotiff-dfsg/trunk/debian/patches/Makefile.in.dpatch
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/patches/soname.dpatch
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/patches/soname.dpatch	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/patches/soname.dpatch	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,19 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## soname.dpatch by Francesco Paolo Lovergine <frankie at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Add soname for this version of the library
+
+ at DPATCH@
+diff -urNad libgeotiff-1.2.3~/Makefile.in libgeotiff-1.2.3/Makefile.in
+--- libgeotiff-1.2.3~/Makefile.in	2005-08-16 17:21:20.000000000 +0200
++++ libgeotiff-1.2.3/Makefile.in	2007-04-05 13:47:19.000000000 +0200
+@@ -38,7 +38,7 @@
+ GEOTIFF_SO=@GEOTIFF_SO@
+ GEOTIFF_DLL=@GEOTIFF_DLL@
+ GEOTIFF_IMP=@GEOTIFF_IMP@
+-LD_SHARED=@LD_SHARED@
++LD_SHARED=@LD_SHARED@ -soname=libgeotiff. at SO_EXT@. at VERSION_MAJOR@. at VERSION_MINOR@
+ SO_EXT=@SO_EXT@
+ 
+ GT_INCLUDE_FILES = xtiffio.h geotiff.h geotiffio.h geovalues.h \


Property changes on: packages/geotiff/libgeotiff-dfsg/trunk/debian/patches/soname.dpatch
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/rules
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/rules	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/rules	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,96 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+include /usr/share/dpatch/dpatch.make
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+
+# shared library versions, option 1
+version=1.2.4
+major=1.2
+
+config.status: patch-stamp
+	dh_testdir
+	# Add here commands to configure the package.
+	CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+		    --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info
+
+build: build-stamp
+build-stamp:  config.status
+
+	dh_testdir
+
+	# Add here commands to compile the package.
+	$(MAKE)
+
+	touch $@
+
+clean: true-clean unpatch
+true-clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp 
+
+	# Add here commands to clean up after the build process.
+	-$(MAKE) dist-clean
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+	cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+	cp -f /usr/share/misc/config.guess config.guess
+endif
+	rm -f config.status
+	rm -f libgeotiff.* xtiffio.h newgeo.tif
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	# Add here commands to install the package into debian/tmp
+	$(MAKE) prefix=$(CURDIR)/debian/tmp/usr install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs ChangeLog
+	dh_installdocs
+	dh_installexamples
+	dh_install --sourcedir=$(CURDIR)/debian/tmp
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install patch unpatch true-clean


Property changes on: packages/geotiff/libgeotiff-dfsg/trunk/debian/rules
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/geotiff/libgeotiff-dfsg/trunk/debian/watch
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/debian/watch	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/debian/watch	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,4 @@
+# Compulsory line, this is a version 3 file
+version=3
+ftp://ftp.remotesensing.org/pub/geotiff/libgeotiff/libgeotiff-([\d\.]+)\.tar\.gz debian uupdate
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/defs.h
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/defs.h	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/defs.h	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,13 @@
+
+/*
+ * This file is included by the CSV ".c" files in the csv directory.
+ */
+
+#include <stdio.h>
+
+/* Data structures */
+typedef const char * datafile_rows_t;
+typedef struct datafile_s {
+  const char *name;
+  const datafile_rows_t **rows; 
+} datafile_t;

Added: packages/geotiff/libgeotiff-dfsg/trunk/docs/api/.cvsignore
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/docs/api/.cvsignore	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/docs/api/.cvsignore	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1 @@
+*.*

Added: packages/geotiff/libgeotiff-dfsg/trunk/docs/geotifcp.html
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/docs/geotifcp.html	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/docs/geotifcp.html	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,48 @@
+<html>
+<head>
+<title>geotifcp - Copy TIFF, Installing GeoTIFF Metadata</title>
+</head>
+
+<body  BGCOLOR="#FFFFFF">
+
+<h1>geotifcp - Copy TIFF with updated GeoTIFF Metadata</h1>
+
+<pre>
+Syntax:   geotifcp [options] [-e esri_worldfile] [-g metadata] input output
+</pre>
+
+The program geotifcp is identical in function to the LIBTIFF program
+"tiffcp", with the additional feature that if the "-g <metadata>"
+option is used the GeoTIFF information from the file <metadata> 
+will be installed into the output file.  The "-e worldfile" option will 
+override the tiepoint and scale information from the metadata file based
+on the contents of the ESRI worldfile. <p>
+
+If the "-g" option is not used the geotiff information from the source
+file is preserved in the new output file.<p>
+
+"geotifcp" inherits all the other file-transformation capabilities
+of the tiffcp program; for help on the additional parameters give
+the command:<p>
+<pre>
+  %  geotifcp -h
+</pre>
+
+The metadata format is the same as is described in the <a href="listgeo.html">
+listgeo</a> program.  Normally metadata files for use with geotifcp are
+generated from a similar file with listgeo, and then modified by hand
+as required. <p>
+
+<h2>See Also:</h2>
+
+<ol> 
+<li>
+<a href="listgeo.html">listgeo</a> - Dump GeoTIFF Metadata<p>
+
+<li>
+<a href="http://www.remotesensing.org/geotiff/geotiff.html">
+http://www.remotesensing.org/geotiff/geotiff.html</a> - GeoTIFF/libgeotiff Home Page<p>
+
+</ol>
+</body>
+</html>

Added: packages/geotiff/libgeotiff-dfsg/trunk/docs/index.dox
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/docs/index.dox	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/docs/index.dox	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,67 @@
+/*! \page index
+
+<center><title>
+LIBGEOTIFF
+</title></center>
+
+<h2>Functions</h2>
+
+<ul>
+<li> GTIFFree(): Free GeoTIFF access handle.
+<li> GTIFGetDefn(): Read and Normalize GeoTIFF Definition.
+<li> GTIFKeyGet(): Read GeoTIFF GeoKey.
+<li> GTIFKeySet(): Write GeoTIFF GeoKey.
+<li> GTIFNew(): Create GeoTIFF access handle.
+<li> GTIFWriteKeys(): Flush GeoTIFF Keys.
+<li> SetCSVFilenameHook(): Override CSV File Searching.
+<li> XTIFFClose(): Close GeoTIFF file.
+<li> XTIFFOpen(): Open GeoTIFF file.
+</ul>
+
+<h2>General Notes</h2>
+
+The libgeotiff library should compile cleanly with most ANSI-C or 
+ANSI C++ compilers.  All headers have appropriate <b>extern "C" {}</b>
+protection to ensure that entry points retain C linkage even if compiled
+with a C++ compiler. <p>
+
+<h2>Source Tree</h2>
+
+The <a href="http://www.remotesensing.org/cgi-bin/cvsweb.cgi/osrs/geotiff">
+current CVS tree</a> is available on the web.  The source can be 
+downloaded anonymously using the <tt>cvs checkout osrs/geotiff/libgeotiff</tt>
+command after logging in using the instructions on the remotesensing.org
+<a href="/docs/howto-cvs.php3">CVS howto page</a>.<p>
+
+<h2>Include Files</h2>
+
+<ul>
+<li> xtiffio.h: the primary interface header file for all TIFF
+routines, using the extended GeoTIFF tags.<p>
+
+<li> geotiffio.h: the primary interface header file for all GTIF 
+routines, keys and code values.<p>
+
+<li> geotiff.h: an interface header file for all GTIF 
+routines, if code values are not required.<p>
+
+<li> geokeys.h:   defines all valid GEOTIFF GeoKeys.<p>
+
+<li> geo_normalize.h: Defined all functions and structures related
+to normalization of GeoTIFF information based on CSV files.<p>
+
+</ul>
+
+<h2>Licensing</h2>
+
+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 for commercial
+and non-commercial use.  In particular, no part of this code is 
+<i>copyleft</i>, nor does it imply any requirement for users to disclose
+this or their own source code.<p>
+
+*/

Added: packages/geotiff/libgeotiff-dfsg/trunk/docs/listgeo.html
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/docs/listgeo.html	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/docs/listgeo.html	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,170 @@
+<html>
+<head>
+<title>listgeo - Dump GeoTIFF Metadata</title>
+</head>
+
+<body  BGCOLOR="#FFFFFF">
+
+<h1>listgeo - Dump GeoTIFF Metadata</h1>
+
+<pre><b>
+Usage: listgeo [-tfw] [-no_norm] [-proj4] [-t tabledir] inputfile
+</b></pre>
+
+The program listgeo takes a GeoTIFF file as input and dumps to
+the standard output a GeoTIFF "metadata" file, which is human
+readable, and may also be used as input to other programs which
+use the "GTIFImport" routine, such as <a href="geotiff.html">geotifcp</a>.<p>
+
+The <b>-tfw</b> flag may be passed to force generation of an ESRI style .tfw
+file as well as the metadata file.  The ESRI world file is always given
+the same basename as the input file, with the extension .tfw.  If one 
+exists already it will be overwritten.<p>
+
+The <b>-no_norm</b> flag will supress reporting of normalized parameters, and
+reporting of corner points. <p>
+
+The <b>-proj4</b> flag forces listgeo to report the PROJ.4 projection
+string it uses for reprojecting corners to lat/long.<p>
+
+The <b>-t tabledir</b> flag overrides the programs concept of how to file the
+EPSG CSV files, causing it to look in directory "tabledir".  <p>
+
+<h2>GeoTIFF Metadata Format</h2>
+
+For the formalist junkies, we will define a GeoTIFF metadata format
+in an unambiguous fashion, and follow that by a concrete example.<p>
+
+The metadata format is defined as follows (all strings not placed
+between <braces> are string literals, case-sensitive, and any entry
+followed by "*" or "*<number>" indicates multiple entries):<p>
+
+<pre>
+&lt;Geotiff_Metadata&gt; = &lt;Geotiff_Header&gt; + &lt;GeoTIFF_Body&gt; + &lt;GeoTIFF_Trailer&gt;
+
+   &lt;Geotiff_Header&gt; = &lt;White_Space&gt; + Geotiff_Information: + &lt;Return&gt;
+   &lt;GeoTIFF_Trailer&gt; = &lt;White_Space&gt; + End_Of_Geotiff. + &lt;Return&gt;
+   &lt;GeoTIFF_Body&gt; = &lt;GeoTIFF_Info&gt; + &lt;GeoTIFF_Tags&gt; + &lt;GeoTIFF_Keys&gt;
+      &lt;GeoTIFF_Info&gt; = &lt;GeoTIFF_Version&gt; + &lt;GeoTIFF_Revision&gt;
+         &lt;GeoTIFF_Version&gt; = Version: + &lt;Single_Space&gt; + &lt;Version&gt; + &lt;Return&gt;
+            &lt;Version&gt; = &lt;Integer&gt;
+         &lt;GeoTIFF_Revision&gt; = Revision: + 
+               &lt;Single_Space&gt; + &lt;Major_Rev&gt; + &lt;Period&gt; + &lt;Minor_Rev&gt; + &lt;Return&gt;
+               &lt;Major_Rev&gt; = &lt;Integer&gt;
+               &lt;Minor_Rev&gt; = &lt;Integer&gt;
+      &lt;GeoTIFF_Tags&gt; =  &lt;Tag_Header&gt; + &lt;Tag_Entry&gt;* + &lt;Tag_Trailer&gt;
+         &lt;Tag_Header&gt; = &lt;White_Space&gt; + Tagged_Information: + &lt;Return&gt;
+         &lt;Tag_Trailer&gt; = &lt;White_Space&gt; + End_Of_Tags. + &lt;Return&gt;
+         &lt;Tag_Entry&gt; = &lt;Tag_Entry_Header&gt; + &lt;Tag_Entry_Row&gt;*
+            &lt;Tag_Entry_Header&gt; = &lt;White_Space&gt; + 
+                     &lt;Tag_Name&gt; + &lt;Tag_Dimension&gt; + &lt;Colon&gt; + &lt;Return&gt;
+               &lt;Tag_Dimension&gt;  = "(" + &lt;NRows&gt; + &lt;Comma&gt; + &lt;NCols&gt; + ")"
+		 	      &lt;NRows&gt; = &lt;Integer&gt;
+		 	      &lt;NCols&gt; = &lt;Integer&gt;
+            &lt;Tag_Entry_Row&gt; = &lt;White_Space&gt; + &lt;Double_Float&gt;*&lt;NCols&gt; + &lt;Return&gt;
+      &lt;GeoTIFF_Keys&gt; =  &lt;Key_Header&gt; + &lt;Key_Entry&gt;* + &lt;Key_Trailer&gt;
+         &lt;Key_Header&gt; = &lt;White_Space&gt; + Keyed_Information: + &lt;Return&gt;
+         &lt;Key_Trailer&gt; = &lt;White_Space&gt; + End_Of_Keys. + &lt;Return&gt;
+         &lt;Key_Entry&gt; = &lt;Key_Entry_Header&gt; + &lt;Key_Entry_Value&gt;
+            &lt;Key_Entry_Header&gt; = &lt;White_Space&gt; + 
+                     &lt;Key_Name&gt; + &lt;Key_Dimension&gt; + &lt;Colon&gt; + &lt;Return&gt;
+              &lt;Key_Dimension&gt; = "(" + &lt;Key_Format&gt; + &lt;Comma&gt; + &lt;Key_Count&gt; + ")"
+            &lt;Key_Entry_Value&gt; = (&lt;Key_Value&gt; | &lt;Numeric_Value&gt; | &lt;Ascii_Value&gt;)
+               &lt;Numeric_Value&gt; = (&lt;Integer&gt; | &lt;Double_Float&gt;)
+               &lt;Ascii_Value&gt; = &lt;Double_Quote&gt; + &lt;String&gt; + &lt;Double_Quote&gt;
+
+   &lt;Tag_Name&gt; = All symbolic tag names defined in GeoTIFF spec.
+   &lt;Key_Name&gt; = All symbolic key names defined in GeoTIFF spec.
+   &lt;Key_Value&gt; = All symbolic value names defined in GeoTIFF spec.
+   &lt;Key_Format&gt; = (Short | Ascii | Double)
+</pre>
+   
+And for the pedantic:
+<pre>
+   &lt;White_Space&gt; = (&lt;Single_Space&gt; | &lt;Tab&gt;)*
+   &lt;Double_Float&gt; = &lt;Mantissa&gt;&lt;Exponent&gt;
+   &lt;Mantissa&gt; = &lt;Sign&gt;&lt;Integer&gt;&lt;Period&gt;&lt;Integer&gt;
+   &lt;Exponent&gt; = ( |e&lt;Sign&gt;&lt;Integer&gt;)
+   &lt;Sign&gt; = ( |+|-)
+   &lt;Integer&gt; = (0|1|2|3|4|5|6|7|8|9)*
+   ...
+</pre>
+
+Following the formal metadata report, there is an optional (use -no_norm 
+to supress) report on the <i>normalized</i> projection parameters for the
+file.  This is an attempt to lookup PCS and GCS definitions to get detailed
+datum, ellipsoid, and projection definitions for the file.  In general it
+requires access to the EPSG CSV files to work properly.  The GEOTIFF_CSV 
+environment variable can be used to point to directory containing the EPSG
+CSV files (normally distributed with libgeotiff, or this executable).  If
+GEOTIFF_CSV is not defined listgeo will look for a csv subdirectory, or
+the /usr/local/shared/epsg_csv directory.  The -t commandline switch can
+also be used to indicate where the CSV files are located.<p>
+
+Following the normalized projection information listgeo will report the
+positions of the four corner coordinates, and if possible their lat/long
+equivelents.  The corner coordinates are reported for tiepoint+scale and
+transformation matrix formulations of GeoTIFF files, but not for multiple
+tiepoint formulations.  The lat/long coordinates are only available if 
+listgeo is compiled with PROJ.4, if the projection definition can be 
+normalized, and if it is a projection supported by the listgeo PROJ.4 
+binding.<p>
+
+Example (default output of listgeo):<p>
+
+<pre>
+Geotiff_Information:
+   Version: 1
+   Key_Revision: 1.0
+   Tagged_Information:
+      ModelTiepointTag (2,3):
+         0                0                0                
+         440720           3751320          0                
+      ModelPixelScaleTag (1,3):
+         60               60               0                
+      End_Of_Tags.
+   Keyed_Information:
+      GTModelTypeGeoKey (Short,1): ModelTypeProjected
+      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
+      GTCitationGeoKey (Ascii,17): "UTM    11 S E000"
+      GeogLinearUnitsGeoKey (Short,1): Linear_Meter
+      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
+      ProjectedCSTypeGeoKey (Short,1): PCS_NAD27_UTM_zone_11N
+      End_Of_Keys.
+   End_Of_Geotiff.
+
+PCS = 26711 (NAD27 / UTM zone 11N)
+Projection = 16011 (UTM zone 11N)
+Projection Method: CT_TransverseMercator
+   ProjNatOriginLatGeoKey: 0.000000 (  0d 0' 0.00"N)
+   ProjNatOriginLongGeoKey: -117.000000 (117d 0' 0.00"W)
+   ProjScaleAtNatOriginGeoKey: 0.999600
+   ProjFalseEastingGeoKey: 500000.000000
+   ProjFalseNorthingGeoKey: 0.000000
+GCS: 4267/NAD27
+Datum: 6267/North American Datum 1927
+Ellipsoid: 7008/Clarke 1866 (6378206.40,6356583.80)
+Prime Meridian: 8901/Greenwich (0.000000/  0d 0' 0.00"E)
+Projection Linear Units: 9001/metre (1.000000m)
+
+Corner Coordinates:
+Upper Left    ( 440720.000,3751320.000)  (117d38'28.21"W, 33d54' 8.47"N)
+Lower Left    ( 440720.000,3720600.000)  (117d38'20.79"W, 33d37'31.04"N)
+Upper Right   ( 471440.000,3751320.000)  (117d18'32.07"W, 33d54'13.08"N)
+Lower Right   ( 471440.000,3720600.000)  (117d18'28.50"W, 33d37'35.61"N)
+Center        ( 456080.000,3735960.000)  (117d28'27.39"W, 33d45'52.46"N)
+</pre>
+
+<h2>See Also:</h2>
+
+<ol> 
+<li>
+<a href="geotifcp.html">geotiffcp</a> - Copy TIFF installing GeoTIFF 
+metadata.<p>
+<li>
+<a href="http://www.remotesensing.org/geotiff/geotiff.html">
+http://www.remotesensing.org/geotiff/geotiff.html</a> - GeoTIFF/libgeotiff Home Page<p>
+
+</ol>
+</body>
+</html>

Added: packages/geotiff/libgeotiff-dfsg/trunk/docs/manual.txt
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/docs/manual.txt	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/docs/manual.txt	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,456 @@
+-------------------------------------------------------------
+
+          Manual for Libgeotiff Library and Utilities
+
+-------------------------------------------------------------
+
+Documentation Author: Niles Ritter
+Last Modified: 31 Jul 95
+  
+See: http://www.remotesensing.org/geotiff/api/index.html 
+  for up to date API documentation
+  
+-------------------------------------------------------------
+Contents:
+
+  1. The LibGeoTIFF library
+  
+     1.1 Preliminaries
+     1.2 Calling Sequences
+	 1.3 Examples
+
+  2. The LibGeoTIFF Utilities
+  
+     2.1 listgeo   - dump a GeoTIFF metadata file
+	 2.2 geotifcp  - install GeoTIFF from metadata
+
+-------------------------------------------------------------
+1. The LibGeoTIFF library
+
+-------------------------------------------------------------
+1.1 Preliminaries
+
+-------------------
+1.1.1 Compliance:
+
+    ANSI-C:  The GeoTIFF library is fully ANSI compliant and
+	   should compile under any ANSI compiler. It is not guaranteed
+	   to compile under K&R compilers.
+	
+	C++:   All headers have the appropriate C++ bindings permitting
+	   the correct linkage to C++ routines.
+	   
+-------------------
+1.1.2 Interfaces:
+
+	xtiffio.h: the primary interface header file for all TIFF
+				routines, using the extended GeoTIFF tags.
+				
+	geotiffio.h: the primary interface header file for all GTIF 
+				 routines, keys and code values.
+
+	geotiff.h:  an interface header file for all GTIF 
+				 routines, if code values are not required.
+
+	geokeys.h:   defines all valid GEOTIFF GeoKeys.
+	
+-------------------
+1.1.3 Defined macros:
+
+  All of the tag, key and key-value symbolic names in the GeoTIFF spec are
+  supported and defined by the inclusion of "geotiffio.h". In addition,
+  the following useful values are defined:
+  
+	GvCurrentVersion:  The current GeoTIFF Directory version. Should always be 1.
+	GvCurrentRevision: The current GeoTIFF Key Revision.
+	GvCurrentMinorRev: The current GeoTIFF Key-Value (minor) Revision.
+	
+	KvUndefined:      The universal Key value for "undefined" items.
+	KvUserDefined:    The universal Key value for "user-defined" items.
+
+	
+-------------------
+1.1.4 Defined Types:  
+
+	TIFF             the type of a TIFF file descriptor (if LIBTIFF is used).
+	GTIF             the type of a GeoTIFF file descriptor.
+	GTIFPrintMethod  the type of a print method passed to GTIFPrint().
+	GTIFReadMethod   the type of a read method passed to GTIFImport().
+	geokey_t         the type of a GeoTIFF key variable.
+	tagtype_t        the type of a TIFF tag variable, such as TYPE_DOUBLE.
+
+
+-------------------
+1.1.5 Key and Code Databases:
+
+	All geokeys are defined and named in the database file
+	"geokeys.inc", which in turn is included in "geokeys.h"
+	and several other files. The symbolic enumerated names are identical
+	to those used in the Appendix of the GeoTIFF spec.
+	
+	The geokey code values are stored in the other database files
+	having the ".inc" suffix, which in turn are all referenced by
+	the file "geovalues.h". The ones with names beginning with
+	"epsg_" are codes registered in the EPSG/POSC tables, while
+	those beginning with "geo_" are specific to GeoTIFF.
+	
+
+-------------------------------------------------------------
+1.2 Calling Sequences
+
+-------------------
+1.2.1 TIFF-level interface
+
+
+1.2.1.1  GTIFNew  -- Set up a new GeoTIFF file Descriptor
+	GTIF*     GTIFNew(void *tif);
+
+GTIFNew() takes an existing TIFF file descriptor and creates
+a GTIF GeoTIFF file-I/O object for reading and writing
+GeoTIFF keys and values. The TIFF file must currently be open,
+though it may be either read or write mode.
+
+
+1.2.1.2 GTIFFree
+	void      GTIFFree(GTIF *gtif);
+
+Destroys the GeoTIFF file descriptor following reading or writing
+the keys.
+
+
+1.2.1.3 GTIFWriteKeys
+	int       GTIFWriteKeys(GTIF *gtif);
+
+This routine must be called for a new GeoTIFF file after all of 
+the desired Keys are defined and set with GTIFSetKey(). This does
+not explicitly write anything out to the file, but it does call
+the TIFF-level routines to install the TIFF tag values, which
+in turn are written to the file when the TIFF file descriptor
+is closed. A GeoTIFF file cannot be opened for updating; only
+pure read or write is supported.
+
+
+1.2.1.4 GTIFDirectoryInfo
+	void      GTIFDirectoryInfo(GTIF *gtif, int *versions, int *keycount);
+
+Returns header information about the GeoTIFF file directory. The <versions>
+is an array of 3 integers, giving the GeoTIFF Version, followed by
+the major and minor revisions. The <keycount> argument returns the number
+of keys currently defined in this file. 
+
+-------------------
+1.2.2 GeoKey Access 
+
+
+1.2.2.1 GTIFKeyInfo
+	int       GTIFKeyInfo(GTIF *gtif, geokey_t key, int *size, tagtype_t* type);
+
+Returns the number of values defined for key <key> if currently defined in the file, and 
+returns in <size> the size of individual key values, and the <type>. If the
+key is not defined, 0 is returned. You may pass in NULL pointers to any parameters
+you do not need (such as the type).
+
+
+1.2.2.1 GTIFKeyGet
+	int       GTIFKeyGet(GTIF *gtif, geokey_t key, void *val, int index, int count);
+
+Accesses the key value(s). If there are multiple values (such as ASCII), they
+may be accessed individually, starting at <index> and returning <count> values.
+The total number of values accessed is returned. Note: unline TIFFGetField() 
+memory is not allocated for multiple-value arrays such as ASCII. To get the
+length of an array call GTIFKeyInfo first, which returns the size and count
+of the data.  If the values are key-codes they should be declared of type
+"geocode_t", which is unsigned SHORT.
+
+
+1.2.2.1 GTIFKeySet
+	int       GTIFKeySet(GTIF *gtif, geokey_t keyID, tagtype_t type, int count,...);
+
+Defines and sets the specified key values. Note that this does not install the
+tag-level information in the file; to do that you must call GTIFWriteKeys().
+For single-valued non-ASCII keys (which are most of them), you must pass the
+values in by value not reference. You must use the correct type for the
+values: doubles for floating point, strings for ASCII, and "geocode_t" for
+SHORT codes (the symbolic names may be used in most cases).
+
+
+1.2.3 Metadata Import-Export utilities 
+
+	void      GTIFPrint(GTIF *gtif, GTIFPrintMethod print, void *fd);
+	int       GTIFImport(GTIF *gtif, GTIFReadMethod scan, void *fd);
+	
+	char*     GTIFKeyName(geokey_t key);
+	char*     GTIFValueName(geokey_t key,int value);
+	char*     GTIFTypeName(tagtype_t type);
+	char*     GTIFTagName(int tag);
+	int       GTIFKeyCode(char * key);
+	int       GTIFValueCode(geokey_t key,char *value);
+	int       GTIFTypeCode(char *type);
+	int       GTIFTagCode(char *tag);
+
+The GTIFPrint() routine dumps a GeoTIFF metadata stream out to
+a specified file <fd>, either for human interpretation or for
+input to another program. If <fd> is NULL the data is written
+to the standard output.  
+
+The GTIFImport() routine performs the inverse; given a metadata file
+specified by <fd> (or stdin if <fd> is NULL) install the corresponding
+tags and keys into the current GeoTIFF file. Note that the 
+import routine only calls GTIFKeySet(), and so it is up to the
+client program to call GTIFWriteKey() in order to explicitly
+write the keys out to the file.
+
+The GTIFxxxName() routines all take a numeric code, key or tag and
+return a pointer to a static string name associated with the value.
+In the case of Key-Values, the key must be explicitly defined in
+order to establish the scope of the name-search. A string is always
+returned; however, if the code is not recognized the string is
+of the format "Unknown-%d", where %d is the input code value.
+
+The GTIFxxxCode() routines perform the reverse operation; given
+an ASCII string name it tries to find the corresponding code,
+key or tag numerical value, in a case-sensitive manner. If the
+string is not recognized the value -1 is return (no valid codes
+are negative). For consistency, any strings of the form "Unknown-%d"
+where %d is a decimal integer will return the specified integer. 
+
+Note: be careful when assigning variables to GTIFxxxCode; for example,
+the geokey_t type is unsigned, and so if -1 is returned, this will
+result in a value of 65535. To be safe, always use signed integers
+for the assignment, and pass them on to an unsigned type after
+checking that the value is positive.
+
+
+-------------------------------------------------------------
+1.3 Examples
+
+
+A typical use of LIBGEOTIFF for creating a GeoTIFF file is
+
+	#include "xtiffio.h"  /* for TIFF */
+	#include "geotiffio.h" /* for GeoTIFF */
+	void main()
+	{
+		TIFF *tif=(TIFF*)0;  /* TIFF-level descriptor */
+		GTIF *gtif=(GTIF*)0; /* GeoKey-level descriptor */
+		
+		/* Open TIFF descriptor to write GeoTIFF tags */
+		tif=XTIFFOpen(fname,"w");  
+		if (!tif) goto failure;
+		
+		/* Open GTIF Key parser */
+		gtif = GTIFNew(tif);
+		if (!gtif) goto failure;
+		
+		/* Set up standar TIFF file */
+		TIFFSetField(tif,TIFFTAG_IMAGEWIDTH,    WIDTH);
+		/* set other TIFF tags and write out image ... */
+				
+		/* Set GeoTIFF information */
+		GTIFKeySet(gtif, GTModelTypeGeoKey, TYPE_SHORT, 1, ModelGeographic);
+		/* set other GeoTIFF keys ... */
+		
+		/* Store the keys into the TIFF Tags */
+		GTIFWriteKeys(gtif);
+		
+		/* get rid of the key parser */
+		GTIFFree(gtif);
+		
+		/* save and close the TIFF file descriptor */
+		XTIFFClose(tif);
+		
+		exit (0);
+	failure:
+		exit (-1);
+	}
+
+While a typical use of the code for reading tags is:
+
+	#include "xtiffio.h"  /* for TIFF */
+	#include "geotiffio.h" /* for GeoTIFF */
+	enum {VERSION=0,MAJOR,MINOR};
+	void main()
+	{
+		TIFF *tif=(TIFF*)0;  /* TIFF-level descriptor */
+		GTIF *gtif=(GTIF*)0; /* GeoKey-level descriptor */
+		int versions[3];
+		int cit_length;
+		geocode_t model;    /* all key-codes are of this type */
+		char *citation;
+		
+		/* Open TIFF descriptor to read GeoTIFF tags */
+		tif=XTIFFOpen(fname,"r");  
+		if (!tif) goto failure;
+		
+		/* Open GTIF Key parser; keys will be read at this time. */
+		gtif = GTIFNew(tif);
+		if (!gtif) goto failure;
+
+		/* Get the GeoTIFF directory info */
+		GTIFDirectoryInfo(gtif,versions,0);
+		if (versions[MAJOR] > 1)
+		{
+			printf("this file is too new for me\n"); goto failure;
+		}
+		if (!GTIFKeyGet(gtif, GTModelTypeGeoKey, &model, 0, 1))
+		{
+			printf("Yikes! no Model Type\n") goto failure;
+		}
+		
+		/* ASCII keys are variable-length; compute size */
+		cit_length = GTIFKeyInfo(gtif,GTCitationGeoKey,&size,&type);
+		if (cit_length > 0)
+		{
+			citation = malloc(size*cit_length);
+			if (!citation) goto failure;
+			GTIFKeyGet(gtif, GTCitationGeoKey, citation, 0, cit_length);
+			printf("Citation:%s\n",citation);
+		}
+
+		/* Get some TIFF info on this image */
+		TIFFGetField(tif,TIFFTAG_IMAGEWIDTH,    &width);
+		
+		/* get rid of the key parser */
+		GTIFFree(gtif);
+		
+		/* close the TIFF file descriptor */
+		XTIFFClose(tif);
+		
+		exit (0);
+	failure:
+		exit (-1);
+	}
+
+
+
+-------------------------------------------------------------
+2. The LibGeoTIFF Utilities
+
+-------------------------------------------------------------
+2.1 listgeo   - dump a GeoTIFF metadata file
+
+Syntax:   listgeo [-tfw] [-no_norm] [-t tabledir] inputfile
+
+The program listgeo takes a GeoTIFF file as input and dumps to
+the standard output a GeoTIFF "metadata" file, which is human
+readable, and may also be used as input to other programs which
+use the "GTIFImport" routine, such as geotifcp, below.
+
+The -tfw flag may be passed to force generation of an ESRI style .tfw
+file as well as the metadata file.  
+
+The -no_norm flag will supress reporting of normalized parameters, and
+reporting of corner points. 
+
+The "-t tabledir" flag overrides the programs concept of how to file the
+EPSG CSV files, causing it to look in directory "tabledir". 
+
+------------------------
+GeoTIFF Metadata Format:
+
+For the formalist junkies, we will define a GeoTIFF metadata format
+in an unambiguous fashion, and follow that by a concrete example.
+
+The metadata format is defined as follows (all strings not placed
+between <braces> are string literals, case-sensitive, and any entry
+followed by "*" or "*<number>" indicates multiple entries):
+
+<Geotiff_Metadata> = <Geotiff_Header> + <GeoTIFF_Body> + <GeoTIFF_Trailer>
+
+   <Geotiff_Header> = <White_Space> + Geotiff_Information: + <Return>
+   <GeoTIFF_Trailer> = <White_Space> + End_Of_Geotiff. + <Return>
+   <GeoTIFF_Body> = <GeoTIFF_Info> + <GeoTIFF_Tags> + <GeoTIFF_Keys>
+      <GeoTIFF_Info> = <GeoTIFF_Version> + <GeoTIFF_Revision>
+         <GeoTIFF_Version> = Version: + <Single_Space> + <Version> + <Return>
+            <Version> = <Integer>
+         <GeoTIFF_Revision> = Revision: + 
+               <Single_Space> + <Major_Rev> + <Period> + <Minor_Rev> + <Return>
+               <Major_Rev> = <Integer>
+               <Minor_Rev> = <Integer>
+      <GeoTIFF_Tags> =  <Tag_Header> + <Tag_Entry>* + <Tag_Trailer>
+         <Tag_Header> = <White_Space> + Tagged_Information: + <Return>
+         <Tag_Trailer> = <White_Space> + End_Of_Tags. + <Return>
+         <Tag_Entry> = <Tag_Entry_Header> + <Tag_Entry_Row>*
+            <Tag_Entry_Header> = <White_Space> + 
+                     <Tag_Name> + <Tag_Dimension> + <Colon> + <Return>
+               <Tag_Dimension>  = "(" + <NRows> + <Comma> + <NCols> + ")"
+		 	      <NRows> = <Integer>
+		 	      <NCols> = <Integer>
+            <Tag_Entry_Row> = <White_Space> + <Double_Float>*<NCols> + <Return>
+      <GeoTIFF_Keys> =  <Key_Header> + <Key_Entry>* + <Key_Trailer>
+         <Key_Header> = <White_Space> + Keyed_Information: + <Return>
+         <Key_Trailer> = <White_Space> + End_Of_Keys. + <Return>
+         <Key_Entry> = <Key_Entry_Header> + <Key_Entry_Value>
+            <Key_Entry_Header> = <White_Space> + 
+                     <Key_Name> + <Key_Dimension> + <Colon> + <Return>
+              <Key_Dimension> = "(" + <Key_Format> + <Comma> + <Key_Count> + ")"
+            <Key_Entry_Value> = (<Key_Value> | <Numeric_Value> | <Ascii_Value>)
+               <Numeric_Value> = (<Integer> | <Double_Float>)
+               <Ascii_Value> = <Double_Quote> + <String> + <Double_Quote>
+
+   <Tag_Name> = All symbolic tag names defined in GeoTIFF spec.
+   <Key_Name> = All symbolic key names defined in GeoTIFF spec.
+   <Key_Value> = All symbolic value names defined in GeoTIFF spec.
+   <Key_Format> = (Short | Ascii | Double)
+   
+And for the pedantic:
+   <White_Space> = (<Single_Space> | <Tab>)*
+   <Double_Float> = <Mantissa><Exponent>
+   <Mantissa> = <Sign><Integer><Period><Integer>
+   <Exponent> = ( |e<Sign><Integer>)
+   <Sign> = ( |+|-)
+   <Integer> = (0|1|2|3|4|5|6|7|8|9)*
+   ...
+
+
+Example (default output of listgeo):
+
+Geotiff_Information:
+   Version: 1
+   Key_Revision: 0.2
+   Tagged_Information:
+      ModelTiepointTag (2,3):
+         0                  0                  0
+       130                 32                  0
+      ModelPixelScaleTag (1,3):
+         1                  1                  0
+      End_Of_Tags.
+   Keyed_Information:
+      GTModelTypeGeoKey (Short,1): ModelTypeGeographic
+      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
+      GTCitationGeoKey (Ascii,16): "Just An Example"
+      GeographicTypeGeoKey (Short,1): User-Defined
+      GeogCitationGeoKey (Ascii,24): "Everest Ellipsoid Used."
+      GeogGeodeticDatumGeoKey (Short,1): User-Defined
+      GeogLinearUnitsGeoKey (Short,1): Linear_Meter
+      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
+      GeogEllipsoidGeoKey (Short,1): Ellipse_Everest_1830_1967_Definition
+      GeogSemiMajorAxisGeoKey (Double,1): 6377298.556
+      GeogInvFlatteningGeoKey (Double,1): 300.8017
+      End_Of_Keys.
+   End_Of_Geotiff.
+   
+   
+-------------------------------------------------------------
+2.2 geotifcp  - Copy a TIFF file and install GeoTIFF info from metadata.
+
+Syntax:   geotifcp [options] [-e esri_worldfile] [-g metadata] input output
+
+The program geotifcp is identical in function to the LIBTIFF program
+"tiffcp", with the additional feature that if the "-g <metadata>"
+option is used the GeoTIFF information from the file <metadata> 
+will be installed into the output file.  The "-e worldfile" option will 
+override the tiepoint and scale information from the metadata file based
+on the contents of the ESRI worldfile. 
+
+If the "-g" option is not used, the opposite effect occurs: all 
+GeoTIFF information is filtered out of the input file before being
+written to the new output file.
+
+"geotifcp" inherits all the other file-transformation capabilities
+of the tiffcp program; for help on the additional parameters give
+the command:
+
+  %  geotifcp -h
+
+-------------------------------------------------------------

Added: packages/geotiff/libgeotiff-dfsg/trunk/epsg_datum.inc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/epsg_datum.inc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/epsg_datum.inc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,174 @@
+/*
+ *  EPSG/POSC Datum database -- GeoTIFF Rev. 0.2
+ */
+ 
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_datum.inc
+#endif /* OLD Codes */
+
+/* New datums */
+ValuePair(Datum_Dealul_Piscului_1970,6317)
+
+/* Datums for which only the ellipsoid is known */
+ValuePair(DatumE_Airy1830,	6001)
+ValuePair(DatumE_AiryModified1849,	6002)
+ValuePair(DatumE_AustralianNationalSpheroid,	6003)
+ValuePair(DatumE_Bessel1841,	6004)
+ValuePair(DatumE_BesselModified,	6005)
+ValuePair(DatumE_BesselNamibia,	6006)
+ValuePair(DatumE_Clarke1858,	6007)
+ValuePair(DatumE_Clarke1866,	6008)
+ValuePair(DatumE_Clarke1866Michigan,	6009)
+ValuePair(DatumE_Clarke1880_Benoit,	6010)
+ValuePair(DatumE_Clarke1880_IGN,	6011)
+ValuePair(DatumE_Clarke1880_RGS,	6012)
+ValuePair(DatumE_Clarke1880_Arc,	6013)
+ValuePair(DatumE_Clarke1880_SGA1922,	6014)
+ValuePair(DatumE_Everest1830_1937Adjustment,	6015)
+ValuePair(DatumE_Everest1830_1967Definition,	6016)
+ValuePair(DatumE_Everest1830_1975Definition,	6017)
+ValuePair(DatumE_Everest1830Modified,	6018)
+ValuePair(DatumE_GRS1980,	6019)
+ValuePair(DatumE_Helmert1906,	6020)
+ValuePair(DatumE_IndonesianNationalSpheroid,	6021)
+ValuePair(DatumE_International1924,	6022)
+ValuePair(DatumE_International1967,	6023)
+ValuePair(DatumE_Krassowsky1960,	6024)
+ValuePair(DatumE_NWL9D,	6025)
+ValuePair(DatumE_NWL10D,	6026)
+ValuePair(DatumE_Plessis1817,	6027)
+ValuePair(DatumE_Struve1860,	6028)
+ValuePair(DatumE_WarOffice,	6029)
+ValuePair(DatumE_WGS84,	6030)
+ValuePair(DatumE_GEM10C,	6031)
+ValuePair(DatumE_OSU86F,	6032)
+ValuePair(DatumE_OSU91A,	6033)
+ValuePair(DatumE_Clarke1880,	6034)
+ValuePair(DatumE_Sphere,	6035)
+
+/* standard datums */
+ValuePair(Datum_Adindan,	6201)
+ValuePair(Datum_Australian_Geodetic_Datum_1966,	6202)
+ValuePair(Datum_Australian_Geodetic_Datum_1984,	6203)
+ValuePair(Datum_Ain_el_Abd_1970,	6204)
+ValuePair(Datum_Afgooye,	6205)
+ValuePair(Datum_Agadez,	6206)
+ValuePair(Datum_Lisbon,	6207)
+ValuePair(Datum_Aratu,	6208)
+ValuePair(Datum_Arc_1950,	6209)
+ValuePair(Datum_Arc_1960,	6210)
+ValuePair(Datum_Batavia,	6211)
+ValuePair(Datum_Barbados,	6212)
+ValuePair(Datum_Beduaram,	6213)
+ValuePair(Datum_Beijing_1954,	6214)
+ValuePair(Datum_Reseau_National_Belge_1950,	6215)
+ValuePair(Datum_Bermuda_1957,	6216)
+ValuePair(Datum_Bern_1898,	6217)
+ValuePair(Datum_Bogota,	6218)
+ValuePair(Datum_Bukit_Rimpah,	6219)
+ValuePair(Datum_Camacupa,	6220)
+ValuePair(Datum_Campo_Inchauspe,	6221)
+ValuePair(Datum_Cape,	6222)
+ValuePair(Datum_Carthage,	6223)
+ValuePair(Datum_Chua,	6224)
+ValuePair(Datum_Corrego_Alegre,	6225)
+ValuePair(Datum_Cote_d_Ivoire,	6226)
+ValuePair(Datum_Deir_ez_Zor,	6227)
+ValuePair(Datum_Douala,	6228)
+ValuePair(Datum_Egypt_1907,	6229)
+ValuePair(Datum_European_Datum_1950,	6230)
+ValuePair(Datum_European_Datum_1987,	6231)
+ValuePair(Datum_Fahud,	6232)
+ValuePair(Datum_Gandajika_1970,	6233)
+ValuePair(Datum_Garoua,	6234)
+ValuePair(Datum_Guyane_Francaise,	6235)
+ValuePair(Datum_Hu_Tzu_Shan,	6236)
+ValuePair(Datum_Hungarian_Datum_1972,	6237)
+ValuePair(Datum_Indonesian_Datum_1974,	6238)
+ValuePair(Datum_Indian_1954,	6239)
+ValuePair(Datum_Indian_1975,	6240)
+ValuePair(Datum_Jamaica_1875,	6241)
+ValuePair(Datum_Jamaica_1969,	6242)
+ValuePair(Datum_Kalianpur,	6243)
+ValuePair(Datum_Kandawala,	6244)
+ValuePair(Datum_Kertau,	6245)
+ValuePair(Datum_Kuwait_Oil_Company,	6246)
+ValuePair(Datum_La_Canoa,	6247)
+ValuePair(Datum_Provisional_S_American_Datum_1956,	6248)
+ValuePair(Datum_Lake,	6249)
+ValuePair(Datum_Leigon,	6250)
+ValuePair(Datum_Liberia_1964,	6251)
+ValuePair(Datum_Lome,	6252)
+ValuePair(Datum_Luzon_1911,	6253)
+ValuePair(Datum_Hito_XVIII_1963,	6254)
+ValuePair(Datum_Herat_North,	6255)
+ValuePair(Datum_Mahe_1971,	6256)
+ValuePair(Datum_Makassar,	6257)
+ValuePair(Datum_European_Reference_System_1989,	6258)
+ValuePair(Datum_Malongo_1987,	6259)
+ValuePair(Datum_Manoca,	6260)
+ValuePair(Datum_Merchich,	6261)
+ValuePair(Datum_Massawa,	6262)
+ValuePair(Datum_Minna,	6263)
+ValuePair(Datum_Mhast,	6264)
+ValuePair(Datum_Monte_Mario,	6265)
+ValuePair(Datum_M_poraloko,	6266)
+ValuePair(Datum_North_American_Datum_1927,	6267)
+ValuePair(Datum_NAD_Michigan,	6268)
+ValuePair(Datum_North_American_Datum_1983,	6269)
+ValuePair(Datum_Nahrwan_1967,	6270)
+ValuePair(Datum_Naparima_1972,	6271)
+ValuePair(Datum_New_Zealand_Geodetic_Datum_1949,	6272)
+ValuePair(Datum_NGO_1948,	6273)
+ValuePair(Datum_Datum_73,	6274)
+ValuePair(Datum_Nouvelle_Triangulation_Francaise,	6275)
+ValuePair(Datum_NSWC_9Z_2,	6276)
+ValuePair(Datum_OSGB_1936,	6277)
+ValuePair(Datum_OSGB_1970_SN,	6278)
+ValuePair(Datum_OS_SN_1980,	6279)
+ValuePair(Datum_Padang_1884,	6280)
+ValuePair(Datum_Palestine_1923,	6281)
+ValuePair(Datum_Pointe_Noire,	6282)
+ValuePair(Datum_Geocentric_Datum_of_Australia_1994,	6283)
+ValuePair(Datum_Pulkovo_1942,	6284)
+ValuePair(Datum_Qatar,	6285)
+ValuePair(Datum_Qatar_1948,	6286)
+ValuePair(Datum_Qornoq,	6287)
+ValuePair(Datum_Loma_Quintana,	6288)
+ValuePair(Datum_Amersfoort,	6289)
+ValuePair(Datum_RT38,	6290)
+ValuePair(Datum_South_American_Datum_1969,	6291)
+ValuePair(Datum_Sapper_Hill_1943,	6292)
+ValuePair(Datum_Schwarzeck,	6293)
+ValuePair(Datum_Segora,	6294)
+ValuePair(Datum_Serindung,	6295)
+ValuePair(Datum_Sudan,	6296)
+ValuePair(Datum_Tananarive_1925,	6297)
+ValuePair(Datum_Timbalai_1948,	6298)
+ValuePair(Datum_TM65,	6299)
+ValuePair(Datum_TM75,	6300)
+ValuePair(Datum_Tokyo,	6301)
+ValuePair(Datum_Trinidad_1903,	6302)
+ValuePair(Datum_Trucial_Coast_1948,	6303)
+ValuePair(Datum_Voirol_1875,	6304)
+ValuePair(Datum_Voirol_Unifie_1960,	6305)
+ValuePair(Datum_Bern_1938,	6306)
+ValuePair(Datum_Nord_Sahara_1959,	6307)
+ValuePair(Datum_Stockholm_1938,	6308)
+ValuePair(Datum_Yacare,	6309)
+ValuePair(Datum_Yoff,	6310)
+ValuePair(Datum_Zanderij,	6311)
+ValuePair(Datum_Militar_Geographische_Institut,	6312)
+ValuePair(Datum_Reseau_National_Belge_1972,	6313)
+ValuePair(Datum_Deutsche_Hauptdreiecksnetz,	6314)
+ValuePair(Datum_Conakry_1905,	6315)
+ValuePair(Datum_WGS72,	6322)
+ValuePair(Datum_WGS72_Transit_Broadcast_Ephemeris,	6324)
+ValuePair(Datum_WGS84,	6326)
+ValuePair(Datum_Ancienne_Triangulation_Francaise,	6901)
+ValuePair(Datum_Nord_de_Guerre,	6902)
+/* end of list */

Added: packages/geotiff/libgeotiff-dfsg/trunk/epsg_ellipse.inc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/epsg_ellipse.inc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/epsg_ellipse.inc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,48 @@
+/*
+ *  GeoTIFF Rev. 0.2  Ellipsoids
+ */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_ellipse.inc
+#endif /* OLD Codes */
+
+ValuePair(Ellipse_Airy_1830,	7001)
+ValuePair(Ellipse_Airy_Modified_1849,	7002)
+ValuePair(Ellipse_Australian_National_Spheroid,	7003)
+ValuePair(Ellipse_Bessel_1841,	7004)
+ValuePair(Ellipse_Bessel_Modified,	7005)
+ValuePair(Ellipse_Bessel_Namibia,	7006)
+ValuePair(Ellipse_Clarke_1858,	7007)
+ValuePair(Ellipse_Clarke_1866,	7008)
+ValuePair(Ellipse_Clarke_1866_Michigan,	7009)
+ValuePair(Ellipse_Clarke_1880_Benoit,	7010)
+ValuePair(Ellipse_Clarke_1880_IGN,	7011)
+ValuePair(Ellipse_Clarke_1880_RGS,	7012)
+ValuePair(Ellipse_Clarke_1880_Arc,	7013)
+ValuePair(Ellipse_Clarke_1880_SGA_1922,	7014)
+ValuePair(Ellipse_Everest_1830_1937_Adjustment,	7015)
+ValuePair(Ellipse_Everest_1830_1967_Definition,	7016)
+ValuePair(Ellipse_Everest_1830_1975_Definition,	7017)
+ValuePair(Ellipse_Everest_1830_Modified,	7018)
+ValuePair(Ellipse_GRS_1980,	7019)
+ValuePair(Ellipse_Helmert_1906,	7020)
+ValuePair(Ellipse_Indonesian_National_Spheroid,	7021)
+ValuePair(Ellipse_International_1924,	7022)
+ValuePair(Ellipse_International_1967,	7023)
+ValuePair(Ellipse_Krassowsky_1940,	7024)
+ValuePair(Ellipse_NWL_9D,	7025)
+ValuePair(Ellipse_NWL_10D,	7026)
+ValuePair(Ellipse_Plessis_1817,	7027)
+ValuePair(Ellipse_Struve_1860,	7028)
+ValuePair(Ellipse_War_Office,	7029)
+ValuePair(Ellipse_WGS_84,	7030)
+ValuePair(Ellipse_GEM_10C,	7031)
+ValuePair(Ellipse_OSU86F,	7032)
+ValuePair(Ellipse_OSU91A,	7033)
+ValuePair(Ellipse_Clarke_1880,	7034)
+ValuePair(Ellipse_Sphere,	7035)
+/* end of list */

Added: packages/geotiff/libgeotiff-dfsg/trunk/epsg_gcs.inc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/epsg_gcs.inc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/epsg_gcs.inc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,193 @@
+/*
+ *  EPSG/POSC GCS Codes -- GeoTIFF Rev. 0.2
+ */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_gcs.inc
+#endif /* OLD Codes */
+
+/* Unspecified GCS based on ellipsoid */
+ValuePair(GCSE_Airy1830,	4001)
+ValuePair(GCSE_AiryModified1849,	4002)
+ValuePair(GCSE_AustralianNationalSpheroid,	4003)
+ValuePair(GCSE_Bessel1841,	4004)
+ValuePair(GCSE_BesselModified,	4005)
+ValuePair(GCSE_BesselNamibia,	4006)
+ValuePair(GCSE_Clarke1858,	4007)
+ValuePair(GCSE_Clarke1866,	4008)
+ValuePair(GCSE_Clarke1866Michigan,	4009)
+ValuePair(GCSE_Clarke1880_Benoit,	4010)
+ValuePair(GCSE_Clarke1880_IGN,	4011)
+ValuePair(GCSE_Clarke1880_RGS,	4012)
+ValuePair(GCSE_Clarke1880_Arc,	4013)
+ValuePair(GCSE_Clarke1880_SGA1922,	4014)
+ValuePair(GCSE_Everest1830_1937Adjustment,	4015)
+ValuePair(GCSE_Everest1830_1967Definition,	4016)
+ValuePair(GCSE_Everest1830_1975Definition,	4017)
+ValuePair(GCSE_Everest1830Modified,	4018)
+ValuePair(GCSE_GRS1980,	4019)
+ValuePair(GCSE_Helmert1906,	4020)
+ValuePair(GCSE_IndonesianNationalSpheroid,	4021)
+ValuePair(GCSE_International1924,	4022)
+ValuePair(GCSE_International1967,	4023)
+ValuePair(GCSE_Krassowsky1940,	4024)
+ValuePair(GCSE_NWL9D,	4025)
+ValuePair(GCSE_NWL10D,	4026)
+ValuePair(GCSE_Plessis1817,	4027)
+ValuePair(GCSE_Struve1860,	4028)
+ValuePair(GCSE_WarOffice,	4029)
+ValuePair(GCSE_WGS84,	4030)
+ValuePair(GCSE_GEM10C,	4031)
+ValuePair(GCSE_OSU86F,	4032)
+ValuePair(GCSE_OSU91A,	4033)
+ValuePair(GCSE_Clarke1880,	4034)
+ValuePair(GCSE_Sphere,	4035)
+
+/* New GCS */
+ValuePair(GCS_Greek,4120)
+ValuePair(GCS_GGRS87,4121)
+ValuePair(GCS_KKJ,4123)
+ValuePair(GCS_RT90,4124)
+ValuePair(GCS_EST92,4133)
+ValuePair(GCS_Dealul_Piscului_1970,4317)
+ValuePair(GCS_Greek_Athens,4815)
+
+/* Standard GCS */
+ValuePair(GCS_Adindan,	4201)
+ValuePair(GCS_AGD66,	4202)
+ValuePair(GCS_AGD84,	4203)
+ValuePair(GCS_Ain_el_Abd,	4204)
+ValuePair(GCS_Afgooye,	4205)
+ValuePair(GCS_Agadez,	4206)
+ValuePair(GCS_Lisbon,	4207)
+ValuePair(GCS_Aratu,	4208)
+ValuePair(GCS_Arc_1950,	4209)
+ValuePair(GCS_Arc_1960,	4210)
+ValuePair(GCS_Batavia,	4211)
+ValuePair(GCS_Barbados,	4212)
+ValuePair(GCS_Beduaram,	4213)
+ValuePair(GCS_Beijing_1954,	4214)
+ValuePair(GCS_Belge_1950,	4215)
+ValuePair(GCS_Bermuda_1957,	4216)
+ValuePair(GCS_Bern_1898,	4217)
+ValuePair(GCS_Bogota,	4218)
+ValuePair(GCS_Bukit_Rimpah,	4219)
+ValuePair(GCS_Camacupa,	4220)
+ValuePair(GCS_Campo_Inchauspe,	4221)
+ValuePair(GCS_Cape,	4222)
+ValuePair(GCS_Carthage,	4223)
+ValuePair(GCS_Chua,	4224)
+ValuePair(GCS_Corrego_Alegre,	4225)
+ValuePair(GCS_Cote_d_Ivoire,	4226)
+ValuePair(GCS_Deir_ez_Zor,	4227)
+ValuePair(GCS_Douala,	4228)
+ValuePair(GCS_Egypt_1907,	4229)
+ValuePair(GCS_ED50,	4230)
+ValuePair(GCS_ED87,	4231)
+ValuePair(GCS_Fahud,	4232)
+ValuePair(GCS_Gandajika_1970,	4233)
+ValuePair(GCS_Garoua,	4234)
+ValuePair(GCS_Guyane_Francaise,	4235)
+ValuePair(GCS_Hu_Tzu_Shan,	4236)
+ValuePair(GCS_HD72,	4237)
+ValuePair(GCS_ID74,	4238)
+ValuePair(GCS_Indian_1954,	4239)
+ValuePair(GCS_Indian_1975,	4240)
+ValuePair(GCS_Jamaica_1875,	4241)
+ValuePair(GCS_JAD69,	4242)
+ValuePair(GCS_Kalianpur,	4243)
+ValuePair(GCS_Kandawala,	4244)
+ValuePair(GCS_Kertau,	4245)
+ValuePair(GCS_KOC,	4246)
+ValuePair(GCS_La_Canoa,	4247)
+ValuePair(GCS_PSAD56,	4248)
+ValuePair(GCS_Lake,	4249)
+ValuePair(GCS_Leigon,	4250)
+ValuePair(GCS_Liberia_1964,	4251)
+ValuePair(GCS_Lome,	4252)
+ValuePair(GCS_Luzon_1911,	4253)
+ValuePair(GCS_Hito_XVIII_1963,	4254)
+ValuePair(GCS_Herat_North,	4255)
+ValuePair(GCS_Mahe_1971,	4256)
+ValuePair(GCS_Makassar,	4257)
+ValuePair(GCS_EUREF89,	4258)
+ValuePair(GCS_Malongo_1987,	4259)
+ValuePair(GCS_Manoca,	4260)
+ValuePair(GCS_Merchich,	4261)
+ValuePair(GCS_Massawa,	4262)
+ValuePair(GCS_Minna,	4263)
+ValuePair(GCS_Mhast,	4264)
+ValuePair(GCS_Monte_Mario,	4265)
+ValuePair(GCS_M_poraloko,	4266)
+ValuePair(GCS_NAD27,	4267)
+ValuePair(GCS_NAD_Michigan,	4268)
+ValuePair(GCS_NAD83,	4269)
+ValuePair(GCS_Nahrwan_1967,	4270)
+ValuePair(GCS_Naparima_1972,	4271)
+ValuePair(GCS_GD49,	4272)
+ValuePair(GCS_NGO_1948,	4273)
+ValuePair(GCS_Datum_73,	4274)
+ValuePair(GCS_NTF,	4275)
+ValuePair(GCS_NSWC_9Z_2,	4276)
+ValuePair(GCS_OSGB_1936,	4277)
+ValuePair(GCS_OSGB70,	4278)
+ValuePair(GCS_OS_SN80,	4279)
+ValuePair(GCS_Padang,	4280)
+ValuePair(GCS_Palestine_1923,	4281)
+ValuePair(GCS_Pointe_Noire,	4282)
+ValuePair(GCS_GDA94,	4283)
+ValuePair(GCS_Pulkovo_1942,	4284)
+ValuePair(GCS_Qatar,	4285)
+ValuePair(GCS_Qatar_1948,	4286)
+ValuePair(GCS_Qornoq,	4287)
+ValuePair(GCS_Loma_Quintana,	4288)
+ValuePair(GCS_Amersfoort,	4289)
+ValuePair(GCS_RT38,	4290)
+ValuePair(GCS_SAD69,	4291)
+ValuePair(GCS_Sapper_Hill_1943,	4292)
+ValuePair(GCS_Schwarzeck,	4293)
+ValuePair(GCS_Segora,	4294)
+ValuePair(GCS_Serindung,	4295)
+ValuePair(GCS_Sudan,	4296)
+ValuePair(GCS_Tananarive,	4297)
+ValuePair(GCS_Timbalai_1948,	4298)
+ValuePair(GCS_TM65,	4299)
+ValuePair(GCS_TM75,	4300)
+ValuePair(GCS_Tokyo,	4301)
+ValuePair(GCS_Trinidad_1903,	4302)
+ValuePair(GCS_TC_1948,	4303)
+ValuePair(GCS_Voirol_1875,	4304)
+ValuePair(GCS_Voirol_Unifie,	4305)
+ValuePair(GCS_Bern_1938,	4306)
+ValuePair(GCS_Nord_Sahara_1959,	4307)
+ValuePair(GCS_Stockholm_1938,	4308)
+ValuePair(GCS_Yacare,	4309)
+ValuePair(GCS_Yoff,	4310)
+ValuePair(GCS_Zanderij,	4311)
+ValuePair(GCS_MGI,	4312)
+ValuePair(GCS_Belge_1972,	4313)
+ValuePair(GCS_DHDN,	4314)
+ValuePair(GCS_Conakry_1905,	4315)
+ValuePair(GCS_WGS_72,	4322)
+ValuePair(GCS_WGS_72BE,	4324)
+ValuePair(GCS_WGS_84,	4326)
+ValuePair(GCS_Bern_1898_Bern,	4801)
+ValuePair(GCS_Bogota_Bogota,	4802)
+ValuePair(GCS_Lisbon_Lisbon,	4803)
+ValuePair(GCS_Makassar_Jakarta,	4804)
+ValuePair(GCS_MGI_Ferro,	4805)
+ValuePair(GCS_Monte_Mario_Rome,	4806)
+ValuePair(GCS_NTF_Paris,	4807)
+ValuePair(GCS_Padang_Jakarta,	4808)
+ValuePair(GCS_Belge_1950_Brussels,	4809)
+ValuePair(GCS_Tananarive_Paris,	4810)
+ValuePair(GCS_Voirol_1875_Paris,	4811)
+ValuePair(GCS_Voirol_Unifie_Paris,	4812)
+ValuePair(GCS_Batavia_Jakarta,	4813)
+ValuePair(GCS_ATF_Paris,	4901)
+ValuePair(GCS_NDG_Paris,	4902)
+/* End of list */

Added: packages/geotiff/libgeotiff-dfsg/trunk/epsg_pcs.inc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/epsg_pcs.inc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/epsg_pcs.inc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,1012 @@
+/*
+ *  EPSG PCS Codes - GeoTIFF Rev 0.2
+ */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_pcs.inc
+#endif /* OLD Codes */
+
+/* Newer PCS */
+ValuePair(PCS_Hjorsey_1955_Lambert, 3053)
+ValuePair(PCS_ISN93_Lambert_1993, 3057)
+ValuePair(PCS_ETRS89_Poland_CS2000_zone_5,2176)
+ValuePair(PCS_ETRS89_Poland_CS2000_zone_6,2177)
+ValuePair(PCS_ETRS89_Poland_CS2000_zone_7,2177)
+ValuePair(PCS_ETRS89_Poland_CS2000_zone_8,2178)
+ValuePair(PCS_ETRS89_Poland_CS92,2180)
+
+/* New PCS */
+ValuePair(PCS_GGRS87_Greek_Grid,2100)
+ValuePair(PCS_KKJ_Finland_zone_1,2391)
+ValuePair(PCS_KKJ_Finland_zone_2,2392)
+ValuePair(PCS_KKJ_Finland_zone_3,2393)
+ValuePair(PCS_KKJ_Finland_zone_4,2394)
+ValuePair(PCS_RT90_2_5_gon_W,2400)
+ValuePair(PCS_Lietuvos_Koordinoei_Sistema_1994,2600)
+ValuePair(PCS_Estonian_Coordinate_System_of_1992,3300)
+ValuePair(PCS_HD72_EOV,23700)
+ValuePair(PCS_Dealul_Piscului_1970_Stereo_70,31700)
+
+ValuePair(PCS_Adindan_UTM_zone_37N,	20137)
+ValuePair(PCS_Adindan_UTM_zone_38N,	20138)
+ValuePair(PCS_AGD66_AMG_zone_48,	20248)
+ValuePair(PCS_AGD66_AMG_zone_49,	20249)
+ValuePair(PCS_AGD66_AMG_zone_50,	20250)
+ValuePair(PCS_AGD66_AMG_zone_51,	20251)
+ValuePair(PCS_AGD66_AMG_zone_52,	20252)
+ValuePair(PCS_AGD66_AMG_zone_53,	20253)
+ValuePair(PCS_AGD66_AMG_zone_54,	20254)
+ValuePair(PCS_AGD66_AMG_zone_55,	20255)
+ValuePair(PCS_AGD66_AMG_zone_56,	20256)
+ValuePair(PCS_AGD66_AMG_zone_57,	20257)
+ValuePair(PCS_AGD66_AMG_zone_58,	20258)
+ValuePair(PCS_AGD84_AMG_zone_48,	20348)
+ValuePair(PCS_AGD84_AMG_zone_49,	20349)
+ValuePair(PCS_AGD84_AMG_zone_50,	20350)
+ValuePair(PCS_AGD84_AMG_zone_51,	20351)
+ValuePair(PCS_AGD84_AMG_zone_52,	20352)
+ValuePair(PCS_AGD84_AMG_zone_53,	20353)
+ValuePair(PCS_AGD84_AMG_zone_54,	20354)
+ValuePair(PCS_AGD84_AMG_zone_55,	20355)
+ValuePair(PCS_AGD84_AMG_zone_56,	20356)
+ValuePair(PCS_AGD84_AMG_zone_57,	20357)
+ValuePair(PCS_AGD84_AMG_zone_58,	20358)
+ValuePair(PCS_Ain_el_Abd_UTM_zone_37N,	20437)
+ValuePair(PCS_Ain_el_Abd_UTM_zone_38N,	20438)
+ValuePair(PCS_Ain_el_Abd_UTM_zone_39N,	20439)
+ValuePair(PCS_Ain_el_Abd_Bahrain_Grid,	20499)
+ValuePair(PCS_Afgooye_UTM_zone_38N,	20538)
+ValuePair(PCS_Afgooye_UTM_zone_39N,	20539)
+ValuePair(PCS_Lisbon_Portugese_Grid,	20700)
+ValuePair(PCS_Aratu_UTM_zone_22S,	20822)
+ValuePair(PCS_Aratu_UTM_zone_23S,	20823)
+ValuePair(PCS_Aratu_UTM_zone_24S,	20824)
+ValuePair(PCS_Arc_1950_Lo13,	20973)
+ValuePair(PCS_Arc_1950_Lo15,	20975)
+ValuePair(PCS_Arc_1950_Lo17,	20977)
+ValuePair(PCS_Arc_1950_Lo19,	20979)
+ValuePair(PCS_Arc_1950_Lo21,	20981)
+ValuePair(PCS_Arc_1950_Lo23,	20983)
+ValuePair(PCS_Arc_1950_Lo25,	20985)
+ValuePair(PCS_Arc_1950_Lo27,	20987)
+ValuePair(PCS_Arc_1950_Lo29,	20989)
+ValuePair(PCS_Arc_1950_Lo31,	20991)
+ValuePair(PCS_Arc_1950_Lo33,	20993)
+ValuePair(PCS_Arc_1950_Lo35,	20995)
+ValuePair(PCS_Batavia_NEIEZ,	21100)
+ValuePair(PCS_Batavia_UTM_zone_48S,	21148)
+ValuePair(PCS_Batavia_UTM_zone_49S,	21149)
+ValuePair(PCS_Batavia_UTM_zone_50S,	21150)
+ValuePair(PCS_Beijing_Gauss_zone_13,	21413)
+ValuePair(PCS_Beijing_Gauss_zone_14,	21414)
+ValuePair(PCS_Beijing_Gauss_zone_15,	21415)
+ValuePair(PCS_Beijing_Gauss_zone_16,	21416)
+ValuePair(PCS_Beijing_Gauss_zone_17,	21417)
+ValuePair(PCS_Beijing_Gauss_zone_18,	21418)
+ValuePair(PCS_Beijing_Gauss_zone_19,	21419)
+ValuePair(PCS_Beijing_Gauss_zone_20,	21420)
+ValuePair(PCS_Beijing_Gauss_zone_21,	21421)
+ValuePair(PCS_Beijing_Gauss_zone_22,	21422)
+ValuePair(PCS_Beijing_Gauss_zone_23,	21423)
+ValuePair(PCS_Beijing_Gauss_13N,	21473)
+ValuePair(PCS_Beijing_Gauss_14N,	21474)
+ValuePair(PCS_Beijing_Gauss_15N,	21475)
+ValuePair(PCS_Beijing_Gauss_16N,	21476)
+ValuePair(PCS_Beijing_Gauss_17N,	21477)
+ValuePair(PCS_Beijing_Gauss_18N,	21478)
+ValuePair(PCS_Beijing_Gauss_19N,	21479)
+ValuePair(PCS_Beijing_Gauss_20N,	21480)
+ValuePair(PCS_Beijing_Gauss_21N,	21481)
+ValuePair(PCS_Beijing_Gauss_22N,	21482)
+ValuePair(PCS_Beijing_Gauss_23N,	21483)
+ValuePair(PCS_Belge_Lambert_50,	21500)
+ValuePair(PCS_Bern_1898_Swiss_Old,	21790)
+ValuePair(PCS_Bogota_UTM_zone_17N,	21817)
+ValuePair(PCS_Bogota_UTM_zone_18N,	21818)
+ValuePair(PCS_Bogota_Colombia_3W,	21891)
+ValuePair(PCS_Bogota_Colombia_Bogota,	21892)
+ValuePair(PCS_Bogota_Colombia_3E,	21893)
+ValuePair(PCS_Bogota_Colombia_6E,	21894)
+ValuePair(PCS_Camacupa_UTM_32S,	22032)
+ValuePair(PCS_Camacupa_UTM_33S,	22033)
+ValuePair(PCS_C_Inchauspe_Argentina_1,	22191)
+ValuePair(PCS_C_Inchauspe_Argentina_2,	22192)
+ValuePair(PCS_C_Inchauspe_Argentina_3,	22193)
+ValuePair(PCS_C_Inchauspe_Argentina_4,	22194)
+ValuePair(PCS_C_Inchauspe_Argentina_5,	22195)
+ValuePair(PCS_C_Inchauspe_Argentina_6,	22196)
+ValuePair(PCS_C_Inchauspe_Argentina_7,	22197)
+ValuePair(PCS_Carthage_UTM_zone_32N,	22332)
+ValuePair(PCS_Carthage_Nord_Tunisie,	22391)
+ValuePair(PCS_Carthage_Sud_Tunisie,	22392)
+ValuePair(PCS_Corrego_Alegre_UTM_23S,	22523)
+ValuePair(PCS_Corrego_Alegre_UTM_24S,	22524)
+ValuePair(PCS_Douala_UTM_zone_32N,	22832)
+ValuePair(PCS_Egypt_1907_Red_Belt,	22992)
+ValuePair(PCS_Egypt_1907_Purple_Belt,	22993)
+ValuePair(PCS_Egypt_1907_Ext_Purple,	22994)
+ValuePair(PCS_ED50_UTM_zone_28N,	23028)
+ValuePair(PCS_ED50_UTM_zone_29N,	23029)
+ValuePair(PCS_ED50_UTM_zone_30N,	23030)
+ValuePair(PCS_ED50_UTM_zone_31N,	23031)
+ValuePair(PCS_ED50_UTM_zone_32N,	23032)
+ValuePair(PCS_ED50_UTM_zone_33N,	23033)
+ValuePair(PCS_ED50_UTM_zone_34N,	23034)
+ValuePair(PCS_ED50_UTM_zone_35N,	23035)
+ValuePair(PCS_ED50_UTM_zone_36N,	23036)
+ValuePair(PCS_ED50_UTM_zone_37N,	23037)
+ValuePair(PCS_ED50_UTM_zone_38N,	23038)
+ValuePair(PCS_Fahud_UTM_zone_39N,	23239)
+ValuePair(PCS_Fahud_UTM_zone_40N,	23240)
+ValuePair(PCS_Garoua_UTM_zone_33N,	23433)
+ValuePair(PCS_ID74_UTM_zone_46N,	23846)
+ValuePair(PCS_ID74_UTM_zone_47N,	23847)
+ValuePair(PCS_ID74_UTM_zone_48N,	23848)
+ValuePair(PCS_ID74_UTM_zone_49N,	23849)
+ValuePair(PCS_ID74_UTM_zone_50N,	23850)
+ValuePair(PCS_ID74_UTM_zone_51N,	23851)
+ValuePair(PCS_ID74_UTM_zone_52N,	23852)
+ValuePair(PCS_ID74_UTM_zone_53N,	23853)
+ValuePair(PCS_ID74_UTM_zone_46S,	23886)
+ValuePair(PCS_ID74_UTM_zone_47S,	23887)
+ValuePair(PCS_ID74_UTM_zone_48S,	23888)
+ValuePair(PCS_ID74_UTM_zone_49S,	23889)
+ValuePair(PCS_ID74_UTM_zone_50S,	23890)
+ValuePair(PCS_ID74_UTM_zone_51S,	23891)
+ValuePair(PCS_ID74_UTM_zone_52S,	23892)
+ValuePair(PCS_ID74_UTM_zone_53S,	23893)
+ValuePair(PCS_ID74_UTM_zone_54S,	23894)
+ValuePair(PCS_Indian_1954_UTM_47N,	23947)
+ValuePair(PCS_Indian_1954_UTM_48N,	23948)
+ValuePair(PCS_Indian_1975_UTM_47N,	24047)
+ValuePair(PCS_Indian_1975_UTM_48N,	24048)
+ValuePair(PCS_Jamaica_1875_Old_Grid,	24100)
+ValuePair(PCS_JAD69_Jamaica_Grid,	24200)
+ValuePair(PCS_Kalianpur_India_0,	24370)
+ValuePair(PCS_Kalianpur_India_I,	24371)
+ValuePair(PCS_Kalianpur_India_IIa,	24372)
+ValuePair(PCS_Kalianpur_India_IIIa,	24373)
+ValuePair(PCS_Kalianpur_India_IVa,	24374)
+ValuePair(PCS_Kalianpur_India_IIb,	24382)
+ValuePair(PCS_Kalianpur_India_IIIb,	24383)
+ValuePair(PCS_Kalianpur_India_IVb,	24384)
+ValuePair(PCS_Kertau_Singapore_Grid,	24500)
+ValuePair(PCS_Kertau_UTM_zone_47N,	24547)
+ValuePair(PCS_Kertau_UTM_zone_48N,	24548)
+ValuePair(PCS_La_Canoa_UTM_zone_20N,	24720)
+ValuePair(PCS_La_Canoa_UTM_zone_21N,	24721)
+ValuePair(PCS_PSAD56_UTM_zone_18N,	24818)
+ValuePair(PCS_PSAD56_UTM_zone_19N,	24819)
+ValuePair(PCS_PSAD56_UTM_zone_20N,	24820)
+ValuePair(PCS_PSAD56_UTM_zone_21N,	24821)
+ValuePair(PCS_PSAD56_UTM_zone_17S,	24877)
+ValuePair(PCS_PSAD56_UTM_zone_18S,	24878)
+ValuePair(PCS_PSAD56_UTM_zone_19S,	24879)
+ValuePair(PCS_PSAD56_UTM_zone_20S,	24880)
+ValuePair(PCS_PSAD56_Peru_west_zone,	24891)
+ValuePair(PCS_PSAD56_Peru_central,	24892)
+ValuePair(PCS_PSAD56_Peru_east_zone,	24893)
+ValuePair(PCS_Leigon_Ghana_Grid,	25000)
+ValuePair(PCS_Lome_UTM_zone_31N,	25231)
+ValuePair(PCS_Luzon_Philippines_I,	25391)
+ValuePair(PCS_Luzon_Philippines_II,	25392)
+ValuePair(PCS_Luzon_Philippines_III,	25393)
+ValuePair(PCS_Luzon_Philippines_IV,	25394)
+ValuePair(PCS_Luzon_Philippines_V,	25395)
+ValuePair(PCS_Makassar_NEIEZ,	25700)
+ValuePair(PCS_Malongo_1987_UTM_32S,	25932)
+ValuePair(PCS_Merchich_Nord_Maroc,	26191)
+ValuePair(PCS_Merchich_Sud_Maroc,	26192)
+ValuePair(PCS_Merchich_Sahara,	26193)
+ValuePair(PCS_Massawa_UTM_zone_37N,	26237)
+ValuePair(PCS_Minna_UTM_zone_31N,	26331)
+ValuePair(PCS_Minna_UTM_zone_32N,	26332)
+ValuePair(PCS_Minna_Nigeria_West,	26391)
+ValuePair(PCS_Minna_Nigeria_Mid_Belt,	26392)
+ValuePair(PCS_Minna_Nigeria_East,	26393)
+ValuePair(PCS_Mhast_UTM_zone_32S,	26432)
+ValuePair(PCS_Monte_Mario_Italy_1,	26591)
+ValuePair(PCS_Monte_Mario_Italy_2,	26592)
+ValuePair(PCS_M_poraloko_UTM_32N,	26632)
+ValuePair(PCS_M_poraloko_UTM_32S,	26692)
+ValuePair(PCS_NAD27_UTM_zone_3N,	26703)
+ValuePair(PCS_NAD27_UTM_zone_4N,	26704)
+ValuePair(PCS_NAD27_UTM_zone_5N,	26705)
+ValuePair(PCS_NAD27_UTM_zone_6N,	26706)
+ValuePair(PCS_NAD27_UTM_zone_7N,	26707)
+ValuePair(PCS_NAD27_UTM_zone_8N,	26708)
+ValuePair(PCS_NAD27_UTM_zone_9N,	26709)
+ValuePair(PCS_NAD27_UTM_zone_10N,	26710)
+ValuePair(PCS_NAD27_UTM_zone_11N,	26711)
+ValuePair(PCS_NAD27_UTM_zone_12N,	26712)
+ValuePair(PCS_NAD27_UTM_zone_13N,	26713)
+ValuePair(PCS_NAD27_UTM_zone_14N,	26714)
+ValuePair(PCS_NAD27_UTM_zone_15N,	26715)
+ValuePair(PCS_NAD27_UTM_zone_16N,	26716)
+ValuePair(PCS_NAD27_UTM_zone_17N,	26717)
+ValuePair(PCS_NAD27_UTM_zone_18N,	26718)
+ValuePair(PCS_NAD27_UTM_zone_19N,	26719)
+ValuePair(PCS_NAD27_UTM_zone_20N,	26720)
+ValuePair(PCS_NAD27_UTM_zone_21N,	26721)
+ValuePair(PCS_NAD27_UTM_zone_22N,	26722)
+ValuePair(PCS_NAD27_Alabama_East,	26729)
+ValuePair(PCS_NAD27_Alabama_West,	26730)
+ValuePair(PCS_NAD27_Alaska_zone_1,	26731)
+ValuePair(PCS_NAD27_Alaska_zone_2,	26732)
+ValuePair(PCS_NAD27_Alaska_zone_3,	26733)
+ValuePair(PCS_NAD27_Alaska_zone_4,	26734)
+ValuePair(PCS_NAD27_Alaska_zone_5,	26735)
+ValuePair(PCS_NAD27_Alaska_zone_6,	26736)
+ValuePair(PCS_NAD27_Alaska_zone_7,	26737)
+ValuePair(PCS_NAD27_Alaska_zone_8,	26738)
+ValuePair(PCS_NAD27_Alaska_zone_9,	26739)
+ValuePair(PCS_NAD27_Alaska_zone_10,	26740)
+ValuePair(PCS_NAD27_California_I,	26741)
+ValuePair(PCS_NAD27_California_II,	26742)
+ValuePair(PCS_NAD27_California_III,	26743)
+ValuePair(PCS_NAD27_California_IV,	26744)
+ValuePair(PCS_NAD27_California_V,	26745)
+ValuePair(PCS_NAD27_California_VI,	26746)
+ValuePair(PCS_NAD27_California_VII,	26747)
+ValuePair(PCS_NAD27_Arizona_East,	26748)
+ValuePair(PCS_NAD27_Arizona_Central,	26749)
+ValuePair(PCS_NAD27_Arizona_West,	26750)
+ValuePair(PCS_NAD27_Arkansas_North,	26751)
+ValuePair(PCS_NAD27_Arkansas_South,	26752)
+ValuePair(PCS_NAD27_Colorado_North,	26753)
+ValuePair(PCS_NAD27_Colorado_Central,	26754)
+ValuePair(PCS_NAD27_Colorado_South,	26755)
+ValuePair(PCS_NAD27_Connecticut,	26756)
+ValuePair(PCS_NAD27_Delaware,	26757)
+ValuePair(PCS_NAD27_Florida_East,	26758)
+ValuePair(PCS_NAD27_Florida_West,	26759)
+ValuePair(PCS_NAD27_Florida_North,	26760)
+ValuePair(PCS_NAD27_Hawaii_zone_1,	26761)
+ValuePair(PCS_NAD27_Hawaii_zone_2,	26762)
+ValuePair(PCS_NAD27_Hawaii_zone_3,	26763)
+ValuePair(PCS_NAD27_Hawaii_zone_4,	26764)
+ValuePair(PCS_NAD27_Hawaii_zone_5,	26765)
+ValuePair(PCS_NAD27_Georgia_East,	26766)
+ValuePair(PCS_NAD27_Georgia_West,	26767)
+ValuePair(PCS_NAD27_Idaho_East,	26768)
+ValuePair(PCS_NAD27_Idaho_Central,	26769)
+ValuePair(PCS_NAD27_Idaho_West,	26770)
+ValuePair(PCS_NAD27_Illinois_East,	26771)
+ValuePair(PCS_NAD27_Illinois_West,	26772)
+ValuePair(PCS_NAD27_Indiana_East,	26773)
+ValuePair(PCS_NAD27_BLM_14N_feet,	26774)
+ValuePair(PCS_NAD27_Indiana_West,	26774)
+ValuePair(PCS_NAD27_BLM_15N_feet,	26775)
+ValuePair(PCS_NAD27_Iowa_North,	26775)
+ValuePair(PCS_NAD27_BLM_16N_feet,	26776)
+ValuePair(PCS_NAD27_Iowa_South,	26776)
+ValuePair(PCS_NAD27_BLM_17N_feet,	26777)
+ValuePair(PCS_NAD27_Kansas_North,	26777)
+ValuePair(PCS_NAD27_Kansas_South,	26778)
+ValuePair(PCS_NAD27_Kentucky_North,	26779)
+ValuePair(PCS_NAD27_Kentucky_South,	26780)
+ValuePair(PCS_NAD27_Louisiana_North,	26781)
+ValuePair(PCS_NAD27_Louisiana_South,	26782)
+ValuePair(PCS_NAD27_Maine_East,	26783)
+ValuePair(PCS_NAD27_Maine_West,	26784)
+ValuePair(PCS_NAD27_Maryland,	26785)
+ValuePair(PCS_NAD27_Massachusetts,	26786)
+ValuePair(PCS_NAD27_Massachusetts_Is,	26787)
+ValuePair(PCS_NAD27_Michigan_North,	26788)
+ValuePair(PCS_NAD27_Michigan_Central,	26789)
+ValuePair(PCS_NAD27_Michigan_South,	26790)
+ValuePair(PCS_NAD27_Minnesota_North,	26791)
+ValuePair(PCS_NAD27_Minnesota_Cent,	26792)
+ValuePair(PCS_NAD27_Minnesota_South,	26793)
+ValuePair(PCS_NAD27_Mississippi_East,	26794)
+ValuePair(PCS_NAD27_Mississippi_West,	26795)
+ValuePair(PCS_NAD27_Missouri_East,	26796)
+ValuePair(PCS_NAD27_Missouri_Central,	26797)
+ValuePair(PCS_NAD27_Missouri_West,	26798)
+ValuePair(PCS_NAD_Michigan_Michigan_East,	26801)
+ValuePair(PCS_NAD_Michigan_Michigan_Old_Central,	26802)
+ValuePair(PCS_NAD_Michigan_Michigan_West,	26803)
+ValuePair(PCS_NAD83_UTM_zone_3N,	26903)
+ValuePair(PCS_NAD83_UTM_zone_4N,	26904)
+ValuePair(PCS_NAD83_UTM_zone_5N,	26905)
+ValuePair(PCS_NAD83_UTM_zone_6N,	26906)
+ValuePair(PCS_NAD83_UTM_zone_7N,	26907)
+ValuePair(PCS_NAD83_UTM_zone_8N,	26908)
+ValuePair(PCS_NAD83_UTM_zone_9N,	26909)
+ValuePair(PCS_NAD83_UTM_zone_10N,	26910)
+ValuePair(PCS_NAD83_UTM_zone_11N,	26911)
+ValuePair(PCS_NAD83_UTM_zone_12N,	26912)
+ValuePair(PCS_NAD83_UTM_zone_13N,	26913)
+ValuePair(PCS_NAD83_UTM_zone_14N,	26914)
+ValuePair(PCS_NAD83_UTM_zone_15N,	26915)
+ValuePair(PCS_NAD83_UTM_zone_16N,	26916)
+ValuePair(PCS_NAD83_UTM_zone_17N,	26917)
+ValuePair(PCS_NAD83_UTM_zone_18N,	26918)
+ValuePair(PCS_NAD83_UTM_zone_19N,	26919)
+ValuePair(PCS_NAD83_UTM_zone_20N,	26920)
+ValuePair(PCS_NAD83_UTM_zone_21N,	26921)
+ValuePair(PCS_NAD83_UTM_zone_22N,	26922)
+ValuePair(PCS_NAD83_UTM_zone_23N,	26923)
+ValuePair(PCS_NAD83_Alabama_East,	26929)
+ValuePair(PCS_NAD83_Alabama_West,	26930)
+ValuePair(PCS_NAD83_Alaska_zone_1,	26931)
+ValuePair(PCS_NAD83_Alaska_zone_2,	26932)
+ValuePair(PCS_NAD83_Alaska_zone_3,	26933)
+ValuePair(PCS_NAD83_Alaska_zone_4,	26934)
+ValuePair(PCS_NAD83_Alaska_zone_5,	26935)
+ValuePair(PCS_NAD83_Alaska_zone_6,	26936)
+ValuePair(PCS_NAD83_Alaska_zone_7,	26937)
+ValuePair(PCS_NAD83_Alaska_zone_8,	26938)
+ValuePair(PCS_NAD83_Alaska_zone_9,	26939)
+ValuePair(PCS_NAD83_Alaska_zone_10,	26940)
+ValuePair(PCS_NAD83_California_1,	26941)
+ValuePair(PCS_NAD83_California_2,	26942)
+ValuePair(PCS_NAD83_California_3,	26943)
+ValuePair(PCS_NAD83_California_4,	26944)
+ValuePair(PCS_NAD83_California_5,	26945)
+ValuePair(PCS_NAD83_California_6,	26946)
+ValuePair(PCS_NAD83_Arizona_East,	26948)
+ValuePair(PCS_NAD83_Arizona_Central,	26949)
+ValuePair(PCS_NAD83_Arizona_West,	26950)
+ValuePair(PCS_NAD83_Arkansas_North,	26951)
+ValuePair(PCS_NAD83_Arkansas_South,	26952)
+ValuePair(PCS_NAD83_Colorado_North,	26953)
+ValuePair(PCS_NAD83_Colorado_Central,	26954)
+ValuePair(PCS_NAD83_Colorado_South,	26955)
+ValuePair(PCS_NAD83_Connecticut,	26956)
+ValuePair(PCS_NAD83_Delaware,	26957)
+ValuePair(PCS_NAD83_Florida_East,	26958)
+ValuePair(PCS_NAD83_Florida_West,	26959)
+ValuePair(PCS_NAD83_Florida_North,	26960)
+ValuePair(PCS_NAD83_Hawaii_zone_1,	26961)
+ValuePair(PCS_NAD83_Hawaii_zone_2,	26962)
+ValuePair(PCS_NAD83_Hawaii_zone_3,	26963)
+ValuePair(PCS_NAD83_Hawaii_zone_4,	26964)
+ValuePair(PCS_NAD83_Hawaii_zone_5,	26965)
+ValuePair(PCS_NAD83_Georgia_East,	26966)
+ValuePair(PCS_NAD83_Georgia_West,	26967)
+ValuePair(PCS_NAD83_Idaho_East,	26968)
+ValuePair(PCS_NAD83_Idaho_Central,	26969)
+ValuePair(PCS_NAD83_Idaho_West,	26970)
+ValuePair(PCS_NAD83_Illinois_East,	26971)
+ValuePair(PCS_NAD83_Illinois_West,	26972)
+ValuePair(PCS_NAD83_Indiana_East,	26973)
+ValuePair(PCS_NAD83_Indiana_West,	26974)
+ValuePair(PCS_NAD83_Iowa_North,	26975)
+ValuePair(PCS_NAD83_Iowa_South,	26976)
+ValuePair(PCS_NAD83_Kansas_North,	26977)
+ValuePair(PCS_NAD83_Kansas_South,	26978)
+ValuePair(PCS_NAD83_Kentucky_North,	2205)
+ValuePair(PCS_NAD83_Kentucky_South,	26980)
+ValuePair(PCS_NAD83_Louisiana_North,	26981)
+ValuePair(PCS_NAD83_Louisiana_South,	26982)
+ValuePair(PCS_NAD83_Maine_East,	26983)
+ValuePair(PCS_NAD83_Maine_West,	26984)
+ValuePair(PCS_NAD83_Maryland,	26985)
+ValuePair(PCS_NAD83_Massachusetts,	26986)
+ValuePair(PCS_NAD83_Massachusetts_Is,	26987)
+ValuePair(PCS_NAD83_Michigan_North,	26988)
+ValuePair(PCS_NAD83_Michigan_Central,	26989)
+ValuePair(PCS_NAD83_Michigan_South,	26990)
+ValuePair(PCS_NAD83_Minnesota_North,	26991)
+ValuePair(PCS_NAD83_Minnesota_Cent,	26992)
+ValuePair(PCS_NAD83_Minnesota_South,	26993)
+ValuePair(PCS_NAD83_Mississippi_East,	26994)
+ValuePair(PCS_NAD83_Mississippi_West,	26995)
+ValuePair(PCS_NAD83_Missouri_East,	26996)
+ValuePair(PCS_NAD83_Missouri_Central,	26997)
+ValuePair(PCS_NAD83_Missouri_West,	26998)
+ValuePair(PCS_Nahrwan_1967_UTM_38N,	27038)
+ValuePair(PCS_Nahrwan_1967_UTM_39N,	27039)
+ValuePair(PCS_Nahrwan_1967_UTM_40N,	27040)
+ValuePair(PCS_Naparima_UTM_20N,	27120)
+ValuePair(PCS_GD49_NZ_Map_Grid,	27200)
+ValuePair(PCS_GD49_North_Island_Grid,	27291)
+ValuePair(PCS_GD49_South_Island_Grid,	27292)
+ValuePair(PCS_Datum_73_UTM_zone_29N,	27429)
+ValuePair(PCS_ATF_Nord_de_Guerre,	27500)
+ValuePair(PCS_NTF_France_I,	27581)
+ValuePair(PCS_NTF_France_II,	27582)
+ValuePair(PCS_NTF_France_III,	27583)
+ValuePair(PCS_NTF_Nord_France,	27591)
+ValuePair(PCS_NTF_Centre_France,	27592)
+ValuePair(PCS_NTF_Sud_France,	27593)
+ValuePair(PCS_British_National_Grid,	27700)
+ValuePair(PCS_Point_Noire_UTM_32S,	28232)
+ValuePair(PCS_GDA94_MGA_zone_48,	28348)
+ValuePair(PCS_GDA94_MGA_zone_49,	28349)
+ValuePair(PCS_GDA94_MGA_zone_50,	28350)
+ValuePair(PCS_GDA94_MGA_zone_51,	28351)
+ValuePair(PCS_GDA94_MGA_zone_52,	28352)
+ValuePair(PCS_GDA94_MGA_zone_53,	28353)
+ValuePair(PCS_GDA94_MGA_zone_54,	28354)
+ValuePair(PCS_GDA94_MGA_zone_55,	28355)
+ValuePair(PCS_GDA94_MGA_zone_56,	28356)
+ValuePair(PCS_GDA94_MGA_zone_57,	28357)
+ValuePair(PCS_GDA94_MGA_zone_58,	28358)
+ValuePair(PCS_Pulkovo_Gauss_zone_4,	28404)
+ValuePair(PCS_Pulkovo_Gauss_zone_5,	28405)
+ValuePair(PCS_Pulkovo_Gauss_zone_6,	28406)
+ValuePair(PCS_Pulkovo_Gauss_zone_7,	28407)
+ValuePair(PCS_Pulkovo_Gauss_zone_8,	28408)
+ValuePair(PCS_Pulkovo_Gauss_zone_9,	28409)
+ValuePair(PCS_Pulkovo_Gauss_zone_10,	28410)
+ValuePair(PCS_Pulkovo_Gauss_zone_11,	28411)
+ValuePair(PCS_Pulkovo_Gauss_zone_12,	28412)
+ValuePair(PCS_Pulkovo_Gauss_zone_13,	28413)
+ValuePair(PCS_Pulkovo_Gauss_zone_14,	28414)
+ValuePair(PCS_Pulkovo_Gauss_zone_15,	28415)
+ValuePair(PCS_Pulkovo_Gauss_zone_16,	28416)
+ValuePair(PCS_Pulkovo_Gauss_zone_17,	28417)
+ValuePair(PCS_Pulkovo_Gauss_zone_18,	28418)
+ValuePair(PCS_Pulkovo_Gauss_zone_19,	28419)
+ValuePair(PCS_Pulkovo_Gauss_zone_20,	28420)
+ValuePair(PCS_Pulkovo_Gauss_zone_21,	28421)
+ValuePair(PCS_Pulkovo_Gauss_zone_22,	28422)
+ValuePair(PCS_Pulkovo_Gauss_zone_23,	28423)
+ValuePair(PCS_Pulkovo_Gauss_zone_24,	28424)
+ValuePair(PCS_Pulkovo_Gauss_zone_25,	28425)
+ValuePair(PCS_Pulkovo_Gauss_zone_26,	28426)
+ValuePair(PCS_Pulkovo_Gauss_zone_27,	28427)
+ValuePair(PCS_Pulkovo_Gauss_zone_28,	28428)
+ValuePair(PCS_Pulkovo_Gauss_zone_29,	28429)
+ValuePair(PCS_Pulkovo_Gauss_zone_30,	28430)
+ValuePair(PCS_Pulkovo_Gauss_zone_31,	28431)
+ValuePair(PCS_Pulkovo_Gauss_zone_32,	28432)
+ValuePair(PCS_Pulkovo_Gauss_4N,	28464)
+ValuePair(PCS_Pulkovo_Gauss_5N,	28465)
+ValuePair(PCS_Pulkovo_Gauss_6N,	28466)
+ValuePair(PCS_Pulkovo_Gauss_7N,	28467)
+ValuePair(PCS_Pulkovo_Gauss_8N,	28468)
+ValuePair(PCS_Pulkovo_Gauss_9N,	28469)
+ValuePair(PCS_Pulkovo_Gauss_10N,	28470)
+ValuePair(PCS_Pulkovo_Gauss_11N,	28471)
+ValuePair(PCS_Pulkovo_Gauss_12N,	28472)
+ValuePair(PCS_Pulkovo_Gauss_13N,	28473)
+ValuePair(PCS_Pulkovo_Gauss_14N,	28474)
+ValuePair(PCS_Pulkovo_Gauss_15N,	28475)
+ValuePair(PCS_Pulkovo_Gauss_16N,	28476)
+ValuePair(PCS_Pulkovo_Gauss_17N,	28477)
+ValuePair(PCS_Pulkovo_Gauss_18N,	28478)
+ValuePair(PCS_Pulkovo_Gauss_19N,	28479)
+ValuePair(PCS_Pulkovo_Gauss_20N,	28480)
+ValuePair(PCS_Pulkovo_Gauss_21N,	28481)
+ValuePair(PCS_Pulkovo_Gauss_22N,	28482)
+ValuePair(PCS_Pulkovo_Gauss_23N,	28483)
+ValuePair(PCS_Pulkovo_Gauss_24N,	28484)
+ValuePair(PCS_Pulkovo_Gauss_25N,	28485)
+ValuePair(PCS_Pulkovo_Gauss_26N,	28486)
+ValuePair(PCS_Pulkovo_Gauss_27N,	28487)
+ValuePair(PCS_Pulkovo_Gauss_28N,	28488)
+ValuePair(PCS_Pulkovo_Gauss_29N,	28489)
+ValuePair(PCS_Pulkovo_Gauss_30N,	28490)
+ValuePair(PCS_Pulkovo_Gauss_31N,	28491)
+ValuePair(PCS_Pulkovo_Gauss_32N,	28492)
+ValuePair(PCS_Qatar_National_Grid,	28600)
+ValuePair(PCS_RD_Netherlands_Old,	28991)
+ValuePair(PCS_RD_Netherlands_New,	28992)
+ValuePair(PCS_SAD69_UTM_zone_18N,	29118)
+ValuePair(PCS_SAD69_UTM_zone_19N,	29119)
+ValuePair(PCS_SAD69_UTM_zone_20N,	29120)
+ValuePair(PCS_SAD69_UTM_zone_21N,	29121)
+ValuePair(PCS_SAD69_UTM_zone_22N,	29122)
+ValuePair(PCS_SAD69_UTM_zone_17S,	29177)
+ValuePair(PCS_SAD69_UTM_zone_18S,	29178)
+ValuePair(PCS_SAD69_UTM_zone_19S,	29179)
+ValuePair(PCS_SAD69_UTM_zone_20S,	29180)
+ValuePair(PCS_SAD69_UTM_zone_21S,	29181)
+ValuePair(PCS_SAD69_UTM_zone_22S,	29182)
+ValuePair(PCS_SAD69_UTM_zone_23S,	29183)
+ValuePair(PCS_SAD69_UTM_zone_24S,	29184)
+ValuePair(PCS_SAD69_UTM_zone_25S,	29185)
+ValuePair(PCS_Sapper_Hill_UTM_20S,	29220)
+ValuePair(PCS_Sapper_Hill_UTM_21S,	29221)
+ValuePair(PCS_Schwarzeck_UTM_33S,	29333)
+ValuePair(PCS_Sudan_UTM_zone_35N,	29635)
+ValuePair(PCS_Sudan_UTM_zone_36N,	29636)
+ValuePair(PCS_Tananarive_Laborde,	29700)
+ValuePair(PCS_Tananarive_UTM_38S,	29738)
+ValuePair(PCS_Tananarive_UTM_39S,	29739)
+ValuePair(PCS_Timbalai_1948_Borneo,	29800)
+ValuePair(PCS_Timbalai_1948_UTM_49N,	29849)
+ValuePair(PCS_Timbalai_1948_UTM_50N,	29850)
+ValuePair(PCS_TM65_Irish_Nat_Grid,	29900)
+ValuePair(PCS_Trinidad_1903_Trinidad,	30200)
+ValuePair(PCS_TC_1948_UTM_zone_39N,	30339)
+ValuePair(PCS_TC_1948_UTM_zone_40N,	30340)
+ValuePair(PCS_Voirol_N_Algerie_ancien,	30491)
+ValuePair(PCS_Voirol_S_Algerie_ancien,	30492)
+ValuePair(PCS_Voirol_Unifie_N_Algerie,	30591)
+ValuePair(PCS_Voirol_Unifie_S_Algerie,	30592)
+ValuePair(PCS_Bern_1938_Swiss_New,	30600)
+ValuePair(PCS_Nord_Sahara_UTM_29N,	30729)
+ValuePair(PCS_Nord_Sahara_UTM_30N,	30730)
+ValuePair(PCS_Nord_Sahara_UTM_31N,	30731)
+ValuePair(PCS_Nord_Sahara_UTM_32N,	30732)
+ValuePair(PCS_Yoff_UTM_zone_28N,	31028)
+ValuePair(PCS_Zanderij_UTM_zone_21N,	31121)
+ValuePair(PCS_MGI_Austria_West,	31291)
+ValuePair(PCS_MGI_Austria_Central,	31292)
+ValuePair(PCS_MGI_Austria_East,	31293)
+ValuePair(PCS_Belge_Lambert_72,	31300)
+ValuePair(PCS_DHDN_Germany_zone_1,	31491)
+ValuePair(PCS_DHDN_Germany_zone_2,	31492)
+ValuePair(PCS_DHDN_Germany_zone_3,	31493)
+ValuePair(PCS_DHDN_Germany_zone_4,	31494)
+ValuePair(PCS_DHDN_Germany_zone_5,	31495)
+ValuePair(PCS_NAD27_Montana_North,	32001)
+ValuePair(PCS_NAD27_Montana_Central,	32002)
+ValuePair(PCS_NAD27_Montana_South,	32003)
+ValuePair(PCS_NAD27_Nebraska_North,	32005)
+ValuePair(PCS_NAD27_Nebraska_South,	32006)
+ValuePair(PCS_NAD27_Nevada_East,	32007)
+ValuePair(PCS_NAD27_Nevada_Central,	32008)
+ValuePair(PCS_NAD27_Nevada_West,	32009)
+ValuePair(PCS_NAD27_New_Hampshire,	32010)
+ValuePair(PCS_NAD27_New_Jersey,	32011)
+ValuePair(PCS_NAD27_New_Mexico_East,	32012)
+ValuePair(PCS_NAD27_New_Mexico_Cent,	32013)
+ValuePair(PCS_NAD27_New_Mexico_West,	32014)
+ValuePair(PCS_NAD27_New_York_East,	32015)
+ValuePair(PCS_NAD27_New_York_Central,	32016)
+ValuePair(PCS_NAD27_New_York_West,	32017)
+ValuePair(PCS_NAD27_New_York_Long_Is,	32018)
+ValuePair(PCS_NAD27_North_Carolina,	32019)
+ValuePair(PCS_NAD27_North_Dakota_N,	32020)
+ValuePair(PCS_NAD27_North_Dakota_S,	32021)
+ValuePair(PCS_NAD27_Ohio_North,	32022)
+ValuePair(PCS_NAD27_Ohio_South,	32023)
+ValuePair(PCS_NAD27_Oklahoma_North,	32024)
+ValuePair(PCS_NAD27_Oklahoma_South,	32025)
+ValuePair(PCS_NAD27_Oregon_North,	32026)
+ValuePair(PCS_NAD27_Oregon_South,	32027)
+ValuePair(PCS_NAD27_Pennsylvania_N,	32028)
+ValuePair(PCS_NAD27_Pennsylvania_S,	32029)
+ValuePair(PCS_NAD27_Rhode_Island,	32030)
+ValuePair(PCS_NAD27_South_Carolina_N,	32031)
+ValuePair(PCS_NAD27_South_Carolina_S,	32033)
+ValuePair(PCS_NAD27_South_Dakota_N,	32034)
+ValuePair(PCS_NAD27_South_Dakota_S,	32035)
+ValuePair(PCS_NAD27_Tennessee,		2204)
+ValuePair(PCS_NAD27_Texas_North,	32037)
+ValuePair(PCS_NAD27_Texas_North_Cen,	32038)
+ValuePair(PCS_NAD27_Texas_Central,	32039)
+ValuePair(PCS_NAD27_Texas_South_Cen,	32040)
+ValuePair(PCS_NAD27_Texas_South,	32041)
+ValuePair(PCS_NAD27_Utah_North,	32042)
+ValuePair(PCS_NAD27_Utah_Central,	32043)
+ValuePair(PCS_NAD27_Utah_South,	32044)
+ValuePair(PCS_NAD27_Vermont,	32045)
+ValuePair(PCS_NAD27_Virginia_North,	32046)
+ValuePair(PCS_NAD27_Virginia_South,	32047)
+ValuePair(PCS_NAD27_Washington_North,	32048)
+ValuePair(PCS_NAD27_Washington_South,	32049)
+ValuePair(PCS_NAD27_West_Virginia_N,	32050)
+ValuePair(PCS_NAD27_West_Virginia_S,	32051)
+ValuePair(PCS_NAD27_Wisconsin_North,	32052)
+ValuePair(PCS_NAD27_Wisconsin_Cen,	32053)
+ValuePair(PCS_NAD27_Wisconsin_South,	32054)
+ValuePair(PCS_NAD27_Wyoming_East,	32055)
+ValuePair(PCS_NAD27_Wyoming_E_Cen,	32056)
+ValuePair(PCS_NAD27_Wyoming_W_Cen,	32057)
+ValuePair(PCS_NAD27_Wyoming_West,	32058)
+ValuePair(PCS_NAD27_Puerto_Rico,	32059)
+ValuePair(PCS_NAD27_St_Croix,	32060)
+ValuePair(PCS_NAD83_Montana,	32100)
+ValuePair(PCS_NAD83_Nebraska,	32104)
+ValuePair(PCS_NAD83_Nevada_East,	32107)
+ValuePair(PCS_NAD83_Nevada_Central,	32108)
+ValuePair(PCS_NAD83_Nevada_West,	32109)
+ValuePair(PCS_NAD83_New_Hampshire,	32110)
+ValuePair(PCS_NAD83_New_Jersey,	32111)
+ValuePair(PCS_NAD83_New_Mexico_East,	32112)
+ValuePair(PCS_NAD83_New_Mexico_Cent,	32113)
+ValuePair(PCS_NAD83_New_Mexico_West,	32114)
+ValuePair(PCS_NAD83_New_York_East,	32115)
+ValuePair(PCS_NAD83_New_York_Central,	32116)
+ValuePair(PCS_NAD83_New_York_West,	32117)
+ValuePair(PCS_NAD83_New_York_Long_Is,	32118)
+ValuePair(PCS_NAD83_North_Carolina,	32119)
+ValuePair(PCS_NAD83_North_Dakota_N,	32120)
+ValuePair(PCS_NAD83_North_Dakota_S,	32121)
+ValuePair(PCS_NAD83_Ohio_North,	32122)
+ValuePair(PCS_NAD83_Ohio_South,	32123)
+ValuePair(PCS_NAD83_Oklahoma_North,	32124)
+ValuePair(PCS_NAD83_Oklahoma_South,	32125)
+ValuePair(PCS_NAD83_Oregon_North,	32126)
+ValuePair(PCS_NAD83_Oregon_South,	32127)
+ValuePair(PCS_NAD83_Pennsylvania_N,	32128)
+ValuePair(PCS_NAD83_Pennsylvania_S,	32129)
+ValuePair(PCS_NAD83_Rhode_Island,	32130)
+ValuePair(PCS_NAD83_South_Carolina,	32133)
+ValuePair(PCS_NAD83_South_Dakota_N,	32134)
+ValuePair(PCS_NAD83_South_Dakota_S,	32135)
+ValuePair(PCS_NAD83_Tennessee,	32136)
+ValuePair(PCS_NAD83_Texas_North,	32137)
+ValuePair(PCS_NAD83_Texas_North_Cen,	32138)
+ValuePair(PCS_NAD83_Texas_Central,	32139)
+ValuePair(PCS_NAD83_Texas_South_Cen,	32140)
+ValuePair(PCS_NAD83_Texas_South,	32141)
+ValuePair(PCS_NAD83_Utah_North,	32142)
+ValuePair(PCS_NAD83_Utah_Central,	32143)
+ValuePair(PCS_NAD83_Utah_South,	32144)
+ValuePair(PCS_NAD83_Vermont,	32145)
+ValuePair(PCS_NAD83_Virginia_North,	32146)
+ValuePair(PCS_NAD83_Virginia_South,	32147)
+ValuePair(PCS_NAD83_Washington_North,	32148)
+ValuePair(PCS_NAD83_Washington_South,	32149)
+ValuePair(PCS_NAD83_West_Virginia_N,	32150)
+ValuePair(PCS_NAD83_West_Virginia_S,	32151)
+ValuePair(PCS_NAD83_Wisconsin_North,	32152)
+ValuePair(PCS_NAD83_Wisconsin_Cen,	32153)
+ValuePair(PCS_NAD83_Wisconsin_South,	32154)
+ValuePair(PCS_NAD83_Wyoming_East,	32155)
+ValuePair(PCS_NAD83_Wyoming_E_Cen,	32156)
+ValuePair(PCS_NAD83_Wyoming_W_Cen,	32157)
+ValuePair(PCS_NAD83_Wyoming_West,	32158)
+ValuePair(PCS_NAD83_Puerto_Rico_Virgin_Is,	32161)
+ValuePair(PCS_WGS72_UTM_zone_1N,	32201)
+ValuePair(PCS_WGS72_UTM_zone_2N,	32202)
+ValuePair(PCS_WGS72_UTM_zone_3N,	32203)
+ValuePair(PCS_WGS72_UTM_zone_4N,	32204)
+ValuePair(PCS_WGS72_UTM_zone_5N,	32205)
+ValuePair(PCS_WGS72_UTM_zone_6N,	32206)
+ValuePair(PCS_WGS72_UTM_zone_7N,	32207)
+ValuePair(PCS_WGS72_UTM_zone_8N,	32208)
+ValuePair(PCS_WGS72_UTM_zone_9N,	32209)
+ValuePair(PCS_WGS72_UTM_zone_10N,	32210)
+ValuePair(PCS_WGS72_UTM_zone_11N,	32211)
+ValuePair(PCS_WGS72_UTM_zone_12N,	32212)
+ValuePair(PCS_WGS72_UTM_zone_13N,	32213)
+ValuePair(PCS_WGS72_UTM_zone_14N,	32214)
+ValuePair(PCS_WGS72_UTM_zone_15N,	32215)
+ValuePair(PCS_WGS72_UTM_zone_16N,	32216)
+ValuePair(PCS_WGS72_UTM_zone_17N,	32217)
+ValuePair(PCS_WGS72_UTM_zone_18N,	32218)
+ValuePair(PCS_WGS72_UTM_zone_19N,	32219)
+ValuePair(PCS_WGS72_UTM_zone_20N,	32220)
+ValuePair(PCS_WGS72_UTM_zone_21N,	32221)
+ValuePair(PCS_WGS72_UTM_zone_22N,	32222)
+ValuePair(PCS_WGS72_UTM_zone_23N,	32223)
+ValuePair(PCS_WGS72_UTM_zone_24N,	32224)
+ValuePair(PCS_WGS72_UTM_zone_25N,	32225)
+ValuePair(PCS_WGS72_UTM_zone_26N,	32226)
+ValuePair(PCS_WGS72_UTM_zone_27N,	32227)
+ValuePair(PCS_WGS72_UTM_zone_28N,	32228)
+ValuePair(PCS_WGS72_UTM_zone_29N,	32229)
+ValuePair(PCS_WGS72_UTM_zone_30N,	32230)
+ValuePair(PCS_WGS72_UTM_zone_31N,	32231)
+ValuePair(PCS_WGS72_UTM_zone_32N,	32232)
+ValuePair(PCS_WGS72_UTM_zone_33N,	32233)
+ValuePair(PCS_WGS72_UTM_zone_34N,	32234)
+ValuePair(PCS_WGS72_UTM_zone_35N,	32235)
+ValuePair(PCS_WGS72_UTM_zone_36N,	32236)
+ValuePair(PCS_WGS72_UTM_zone_37N,	32237)
+ValuePair(PCS_WGS72_UTM_zone_38N,	32238)
+ValuePair(PCS_WGS72_UTM_zone_39N,	32239)
+ValuePair(PCS_WGS72_UTM_zone_40N,	32240)
+ValuePair(PCS_WGS72_UTM_zone_41N,	32241)
+ValuePair(PCS_WGS72_UTM_zone_42N,	32242)
+ValuePair(PCS_WGS72_UTM_zone_43N,	32243)
+ValuePair(PCS_WGS72_UTM_zone_44N,	32244)
+ValuePair(PCS_WGS72_UTM_zone_45N,	32245)
+ValuePair(PCS_WGS72_UTM_zone_46N,	32246)
+ValuePair(PCS_WGS72_UTM_zone_47N,	32247)
+ValuePair(PCS_WGS72_UTM_zone_48N,	32248)
+ValuePair(PCS_WGS72_UTM_zone_49N,	32249)
+ValuePair(PCS_WGS72_UTM_zone_50N,	32250)
+ValuePair(PCS_WGS72_UTM_zone_51N,	32251)
+ValuePair(PCS_WGS72_UTM_zone_52N,	32252)
+ValuePair(PCS_WGS72_UTM_zone_53N,	32253)
+ValuePair(PCS_WGS72_UTM_zone_54N,	32254)
+ValuePair(PCS_WGS72_UTM_zone_55N,	32255)
+ValuePair(PCS_WGS72_UTM_zone_56N,	32256)
+ValuePair(PCS_WGS72_UTM_zone_57N,	32257)
+ValuePair(PCS_WGS72_UTM_zone_58N,	32258)
+ValuePair(PCS_WGS72_UTM_zone_59N,	32259)
+ValuePair(PCS_WGS72_UTM_zone_60N,	32260)
+ValuePair(PCS_WGS72_UTM_zone_1S,	32301)
+ValuePair(PCS_WGS72_UTM_zone_2S,	32302)
+ValuePair(PCS_WGS72_UTM_zone_3S,	32303)
+ValuePair(PCS_WGS72_UTM_zone_4S,	32304)
+ValuePair(PCS_WGS72_UTM_zone_5S,	32305)
+ValuePair(PCS_WGS72_UTM_zone_6S,	32306)
+ValuePair(PCS_WGS72_UTM_zone_7S,	32307)
+ValuePair(PCS_WGS72_UTM_zone_8S,	32308)
+ValuePair(PCS_WGS72_UTM_zone_9S,	32309)
+ValuePair(PCS_WGS72_UTM_zone_10S,	32310)
+ValuePair(PCS_WGS72_UTM_zone_11S,	32311)
+ValuePair(PCS_WGS72_UTM_zone_12S,	32312)
+ValuePair(PCS_WGS72_UTM_zone_13S,	32313)
+ValuePair(PCS_WGS72_UTM_zone_14S,	32314)
+ValuePair(PCS_WGS72_UTM_zone_15S,	32315)
+ValuePair(PCS_WGS72_UTM_zone_16S,	32316)
+ValuePair(PCS_WGS72_UTM_zone_17S,	32317)
+ValuePair(PCS_WGS72_UTM_zone_18S,	32318)
+ValuePair(PCS_WGS72_UTM_zone_19S,	32319)
+ValuePair(PCS_WGS72_UTM_zone_20S,	32320)
+ValuePair(PCS_WGS72_UTM_zone_21S,	32321)
+ValuePair(PCS_WGS72_UTM_zone_22S,	32322)
+ValuePair(PCS_WGS72_UTM_zone_23S,	32323)
+ValuePair(PCS_WGS72_UTM_zone_24S,	32324)
+ValuePair(PCS_WGS72_UTM_zone_25S,	32325)
+ValuePair(PCS_WGS72_UTM_zone_26S,	32326)
+ValuePair(PCS_WGS72_UTM_zone_27S,	32327)
+ValuePair(PCS_WGS72_UTM_zone_28S,	32328)
+ValuePair(PCS_WGS72_UTM_zone_29S,	32329)
+ValuePair(PCS_WGS72_UTM_zone_30S,	32330)
+ValuePair(PCS_WGS72_UTM_zone_31S,	32331)
+ValuePair(PCS_WGS72_UTM_zone_32S,	32332)
+ValuePair(PCS_WGS72_UTM_zone_33S,	32333)
+ValuePair(PCS_WGS72_UTM_zone_34S,	32334)
+ValuePair(PCS_WGS72_UTM_zone_35S,	32335)
+ValuePair(PCS_WGS72_UTM_zone_36S,	32336)
+ValuePair(PCS_WGS72_UTM_zone_37S,	32337)
+ValuePair(PCS_WGS72_UTM_zone_38S,	32338)
+ValuePair(PCS_WGS72_UTM_zone_39S,	32339)
+ValuePair(PCS_WGS72_UTM_zone_40S,	32340)
+ValuePair(PCS_WGS72_UTM_zone_41S,	32341)
+ValuePair(PCS_WGS72_UTM_zone_42S,	32342)
+ValuePair(PCS_WGS72_UTM_zone_43S,	32343)
+ValuePair(PCS_WGS72_UTM_zone_44S,	32344)
+ValuePair(PCS_WGS72_UTM_zone_45S,	32345)
+ValuePair(PCS_WGS72_UTM_zone_46S,	32346)
+ValuePair(PCS_WGS72_UTM_zone_47S,	32347)
+ValuePair(PCS_WGS72_UTM_zone_48S,	32348)
+ValuePair(PCS_WGS72_UTM_zone_49S,	32349)
+ValuePair(PCS_WGS72_UTM_zone_50S,	32350)
+ValuePair(PCS_WGS72_UTM_zone_51S,	32351)
+ValuePair(PCS_WGS72_UTM_zone_52S,	32352)
+ValuePair(PCS_WGS72_UTM_zone_53S,	32353)
+ValuePair(PCS_WGS72_UTM_zone_54S,	32354)
+ValuePair(PCS_WGS72_UTM_zone_55S,	32355)
+ValuePair(PCS_WGS72_UTM_zone_56S,	32356)
+ValuePair(PCS_WGS72_UTM_zone_57S,	32357)
+ValuePair(PCS_WGS72_UTM_zone_58S,	32358)
+ValuePair(PCS_WGS72_UTM_zone_59S,	32359)
+ValuePair(PCS_WGS72_UTM_zone_60S,	32360)
+ValuePair(PCS_WGS72BE_UTM_zone_1N,	32401)
+ValuePair(PCS_WGS72BE_UTM_zone_2N,	32402)
+ValuePair(PCS_WGS72BE_UTM_zone_3N,	32403)
+ValuePair(PCS_WGS72BE_UTM_zone_4N,	32404)
+ValuePair(PCS_WGS72BE_UTM_zone_5N,	32405)
+ValuePair(PCS_WGS72BE_UTM_zone_6N,	32406)
+ValuePair(PCS_WGS72BE_UTM_zone_7N,	32407)
+ValuePair(PCS_WGS72BE_UTM_zone_8N,	32408)
+ValuePair(PCS_WGS72BE_UTM_zone_9N,	32409)
+ValuePair(PCS_WGS72BE_UTM_zone_10N,	32410)
+ValuePair(PCS_WGS72BE_UTM_zone_11N,	32411)
+ValuePair(PCS_WGS72BE_UTM_zone_12N,	32412)
+ValuePair(PCS_WGS72BE_UTM_zone_13N,	32413)
+ValuePair(PCS_WGS72BE_UTM_zone_14N,	32414)
+ValuePair(PCS_WGS72BE_UTM_zone_15N,	32415)
+ValuePair(PCS_WGS72BE_UTM_zone_16N,	32416)
+ValuePair(PCS_WGS72BE_UTM_zone_17N,	32417)
+ValuePair(PCS_WGS72BE_UTM_zone_18N,	32418)
+ValuePair(PCS_WGS72BE_UTM_zone_19N,	32419)
+ValuePair(PCS_WGS72BE_UTM_zone_20N,	32420)
+ValuePair(PCS_WGS72BE_UTM_zone_21N,	32421)
+ValuePair(PCS_WGS72BE_UTM_zone_22N,	32422)
+ValuePair(PCS_WGS72BE_UTM_zone_23N,	32423)
+ValuePair(PCS_WGS72BE_UTM_zone_24N,	32424)
+ValuePair(PCS_WGS72BE_UTM_zone_25N,	32425)
+ValuePair(PCS_WGS72BE_UTM_zone_26N,	32426)
+ValuePair(PCS_WGS72BE_UTM_zone_27N,	32427)
+ValuePair(PCS_WGS72BE_UTM_zone_28N,	32428)
+ValuePair(PCS_WGS72BE_UTM_zone_29N,	32429)
+ValuePair(PCS_WGS72BE_UTM_zone_30N,	32430)
+ValuePair(PCS_WGS72BE_UTM_zone_31N,	32431)
+ValuePair(PCS_WGS72BE_UTM_zone_32N,	32432)
+ValuePair(PCS_WGS72BE_UTM_zone_33N,	32433)
+ValuePair(PCS_WGS72BE_UTM_zone_34N,	32434)
+ValuePair(PCS_WGS72BE_UTM_zone_35N,	32435)
+ValuePair(PCS_WGS72BE_UTM_zone_36N,	32436)
+ValuePair(PCS_WGS72BE_UTM_zone_37N,	32437)
+ValuePair(PCS_WGS72BE_UTM_zone_38N,	32438)
+ValuePair(PCS_WGS72BE_UTM_zone_39N,	32439)
+ValuePair(PCS_WGS72BE_UTM_zone_40N,	32440)
+ValuePair(PCS_WGS72BE_UTM_zone_41N,	32441)
+ValuePair(PCS_WGS72BE_UTM_zone_42N,	32442)
+ValuePair(PCS_WGS72BE_UTM_zone_43N,	32443)
+ValuePair(PCS_WGS72BE_UTM_zone_44N,	32444)
+ValuePair(PCS_WGS72BE_UTM_zone_45N,	32445)
+ValuePair(PCS_WGS72BE_UTM_zone_46N,	32446)
+ValuePair(PCS_WGS72BE_UTM_zone_47N,	32447)
+ValuePair(PCS_WGS72BE_UTM_zone_48N,	32448)
+ValuePair(PCS_WGS72BE_UTM_zone_49N,	32449)
+ValuePair(PCS_WGS72BE_UTM_zone_50N,	32450)
+ValuePair(PCS_WGS72BE_UTM_zone_51N,	32451)
+ValuePair(PCS_WGS72BE_UTM_zone_52N,	32452)
+ValuePair(PCS_WGS72BE_UTM_zone_53N,	32453)
+ValuePair(PCS_WGS72BE_UTM_zone_54N,	32454)
+ValuePair(PCS_WGS72BE_UTM_zone_55N,	32455)
+ValuePair(PCS_WGS72BE_UTM_zone_56N,	32456)
+ValuePair(PCS_WGS72BE_UTM_zone_57N,	32457)
+ValuePair(PCS_WGS72BE_UTM_zone_58N,	32458)
+ValuePair(PCS_WGS72BE_UTM_zone_59N,	32459)
+ValuePair(PCS_WGS72BE_UTM_zone_60N,	32460)
+ValuePair(PCS_WGS72BE_UTM_zone_1S,	32501)
+ValuePair(PCS_WGS72BE_UTM_zone_2S,	32502)
+ValuePair(PCS_WGS72BE_UTM_zone_3S,	32503)
+ValuePair(PCS_WGS72BE_UTM_zone_4S,	32504)
+ValuePair(PCS_WGS72BE_UTM_zone_5S,	32505)
+ValuePair(PCS_WGS72BE_UTM_zone_6S,	32506)
+ValuePair(PCS_WGS72BE_UTM_zone_7S,	32507)
+ValuePair(PCS_WGS72BE_UTM_zone_8S,	32508)
+ValuePair(PCS_WGS72BE_UTM_zone_9S,	32509)
+ValuePair(PCS_WGS72BE_UTM_zone_10S,	32510)
+ValuePair(PCS_WGS72BE_UTM_zone_11S,	32511)
+ValuePair(PCS_WGS72BE_UTM_zone_12S,	32512)
+ValuePair(PCS_WGS72BE_UTM_zone_13S,	32513)
+ValuePair(PCS_WGS72BE_UTM_zone_14S,	32514)
+ValuePair(PCS_WGS72BE_UTM_zone_15S,	32515)
+ValuePair(PCS_WGS72BE_UTM_zone_16S,	32516)
+ValuePair(PCS_WGS72BE_UTM_zone_17S,	32517)
+ValuePair(PCS_WGS72BE_UTM_zone_18S,	32518)
+ValuePair(PCS_WGS72BE_UTM_zone_19S,	32519)
+ValuePair(PCS_WGS72BE_UTM_zone_20S,	32520)
+ValuePair(PCS_WGS72BE_UTM_zone_21S,	32521)
+ValuePair(PCS_WGS72BE_UTM_zone_22S,	32522)
+ValuePair(PCS_WGS72BE_UTM_zone_23S,	32523)
+ValuePair(PCS_WGS72BE_UTM_zone_24S,	32524)
+ValuePair(PCS_WGS72BE_UTM_zone_25S,	32525)
+ValuePair(PCS_WGS72BE_UTM_zone_26S,	32526)
+ValuePair(PCS_WGS72BE_UTM_zone_27S,	32527)
+ValuePair(PCS_WGS72BE_UTM_zone_28S,	32528)
+ValuePair(PCS_WGS72BE_UTM_zone_29S,	32529)
+ValuePair(PCS_WGS72BE_UTM_zone_30S,	32530)
+ValuePair(PCS_WGS72BE_UTM_zone_31S,	32531)
+ValuePair(PCS_WGS72BE_UTM_zone_32S,	32532)
+ValuePair(PCS_WGS72BE_UTM_zone_33S,	32533)
+ValuePair(PCS_WGS72BE_UTM_zone_34S,	32534)
+ValuePair(PCS_WGS72BE_UTM_zone_35S,	32535)
+ValuePair(PCS_WGS72BE_UTM_zone_36S,	32536)
+ValuePair(PCS_WGS72BE_UTM_zone_37S,	32537)
+ValuePair(PCS_WGS72BE_UTM_zone_38S,	32538)
+ValuePair(PCS_WGS72BE_UTM_zone_39S,	32539)
+ValuePair(PCS_WGS72BE_UTM_zone_40S,	32540)
+ValuePair(PCS_WGS72BE_UTM_zone_41S,	32541)
+ValuePair(PCS_WGS72BE_UTM_zone_42S,	32542)
+ValuePair(PCS_WGS72BE_UTM_zone_43S,	32543)
+ValuePair(PCS_WGS72BE_UTM_zone_44S,	32544)
+ValuePair(PCS_WGS72BE_UTM_zone_45S,	32545)
+ValuePair(PCS_WGS72BE_UTM_zone_46S,	32546)
+ValuePair(PCS_WGS72BE_UTM_zone_47S,	32547)
+ValuePair(PCS_WGS72BE_UTM_zone_48S,	32548)
+ValuePair(PCS_WGS72BE_UTM_zone_49S,	32549)
+ValuePair(PCS_WGS72BE_UTM_zone_50S,	32550)
+ValuePair(PCS_WGS72BE_UTM_zone_51S,	32551)
+ValuePair(PCS_WGS72BE_UTM_zone_52S,	32552)
+ValuePair(PCS_WGS72BE_UTM_zone_53S,	32553)
+ValuePair(PCS_WGS72BE_UTM_zone_54S,	32554)
+ValuePair(PCS_WGS72BE_UTM_zone_55S,	32555)
+ValuePair(PCS_WGS72BE_UTM_zone_56S,	32556)
+ValuePair(PCS_WGS72BE_UTM_zone_57S,	32557)
+ValuePair(PCS_WGS72BE_UTM_zone_58S,	32558)
+ValuePair(PCS_WGS72BE_UTM_zone_59S,	32559)
+ValuePair(PCS_WGS72BE_UTM_zone_60S,	32560)
+ValuePair(PCS_WGS84_UTM_zone_1N,	32601)
+ValuePair(PCS_WGS84_UTM_zone_2N,	32602)
+ValuePair(PCS_WGS84_UTM_zone_3N,	32603)
+ValuePair(PCS_WGS84_UTM_zone_4N,	32604)
+ValuePair(PCS_WGS84_UTM_zone_5N,	32605)
+ValuePair(PCS_WGS84_UTM_zone_6N,	32606)
+ValuePair(PCS_WGS84_UTM_zone_7N,	32607)
+ValuePair(PCS_WGS84_UTM_zone_8N,	32608)
+ValuePair(PCS_WGS84_UTM_zone_9N,	32609)
+ValuePair(PCS_WGS84_UTM_zone_10N,	32610)
+ValuePair(PCS_WGS84_UTM_zone_11N,	32611)
+ValuePair(PCS_WGS84_UTM_zone_12N,	32612)
+ValuePair(PCS_WGS84_UTM_zone_13N,	32613)
+ValuePair(PCS_WGS84_UTM_zone_14N,	32614)
+ValuePair(PCS_WGS84_UTM_zone_15N,	32615)
+ValuePair(PCS_WGS84_UTM_zone_16N,	32616)
+ValuePair(PCS_WGS84_UTM_zone_17N,	32617)
+ValuePair(PCS_WGS84_UTM_zone_18N,	32618)
+ValuePair(PCS_WGS84_UTM_zone_19N,	32619)
+ValuePair(PCS_WGS84_UTM_zone_20N,	32620)
+ValuePair(PCS_WGS84_UTM_zone_21N,	32621)
+ValuePair(PCS_WGS84_UTM_zone_22N,	32622)
+ValuePair(PCS_WGS84_UTM_zone_23N,	32623)
+ValuePair(PCS_WGS84_UTM_zone_24N,	32624)
+ValuePair(PCS_WGS84_UTM_zone_25N,	32625)
+ValuePair(PCS_WGS84_UTM_zone_26N,	32626)
+ValuePair(PCS_WGS84_UTM_zone_27N,	32627)
+ValuePair(PCS_WGS84_UTM_zone_28N,	32628)
+ValuePair(PCS_WGS84_UTM_zone_29N,	32629)
+ValuePair(PCS_WGS84_UTM_zone_30N,	32630)
+ValuePair(PCS_WGS84_UTM_zone_31N,	32631)
+ValuePair(PCS_WGS84_UTM_zone_32N,	32632)
+ValuePair(PCS_WGS84_UTM_zone_33N,	32633)
+ValuePair(PCS_WGS84_UTM_zone_34N,	32634)
+ValuePair(PCS_WGS84_UTM_zone_35N,	32635)
+ValuePair(PCS_WGS84_UTM_zone_36N,	32636)
+ValuePair(PCS_WGS84_UTM_zone_37N,	32637)
+ValuePair(PCS_WGS84_UTM_zone_38N,	32638)
+ValuePair(PCS_WGS84_UTM_zone_39N,	32639)
+ValuePair(PCS_WGS84_UTM_zone_40N,	32640)
+ValuePair(PCS_WGS84_UTM_zone_41N,	32641)
+ValuePair(PCS_WGS84_UTM_zone_42N,	32642)
+ValuePair(PCS_WGS84_UTM_zone_43N,	32643)
+ValuePair(PCS_WGS84_UTM_zone_44N,	32644)
+ValuePair(PCS_WGS84_UTM_zone_45N,	32645)
+ValuePair(PCS_WGS84_UTM_zone_46N,	32646)
+ValuePair(PCS_WGS84_UTM_zone_47N,	32647)
+ValuePair(PCS_WGS84_UTM_zone_48N,	32648)
+ValuePair(PCS_WGS84_UTM_zone_49N,	32649)
+ValuePair(PCS_WGS84_UTM_zone_50N,	32650)
+ValuePair(PCS_WGS84_UTM_zone_51N,	32651)
+ValuePair(PCS_WGS84_UTM_zone_52N,	32652)
+ValuePair(PCS_WGS84_UTM_zone_53N,	32653)
+ValuePair(PCS_WGS84_UTM_zone_54N,	32654)
+ValuePair(PCS_WGS84_UTM_zone_55N,	32655)
+ValuePair(PCS_WGS84_UTM_zone_56N,	32656)
+ValuePair(PCS_WGS84_UTM_zone_57N,	32657)
+ValuePair(PCS_WGS84_UTM_zone_58N,	32658)
+ValuePair(PCS_WGS84_UTM_zone_59N,	32659)
+ValuePair(PCS_WGS84_UTM_zone_60N,	32660)
+ValuePair(PCS_WGS84_UTM_zone_1S,	32701)
+ValuePair(PCS_WGS84_UTM_zone_2S,	32702)
+ValuePair(PCS_WGS84_UTM_zone_3S,	32703)
+ValuePair(PCS_WGS84_UTM_zone_4S,	32704)
+ValuePair(PCS_WGS84_UTM_zone_5S,	32705)
+ValuePair(PCS_WGS84_UTM_zone_6S,	32706)
+ValuePair(PCS_WGS84_UTM_zone_7S,	32707)
+ValuePair(PCS_WGS84_UTM_zone_8S,	32708)
+ValuePair(PCS_WGS84_UTM_zone_9S,	32709)
+ValuePair(PCS_WGS84_UTM_zone_10S,	32710)
+ValuePair(PCS_WGS84_UTM_zone_11S,	32711)
+ValuePair(PCS_WGS84_UTM_zone_12S,	32712)
+ValuePair(PCS_WGS84_UTM_zone_13S,	32713)
+ValuePair(PCS_WGS84_UTM_zone_14S,	32714)
+ValuePair(PCS_WGS84_UTM_zone_15S,	32715)
+ValuePair(PCS_WGS84_UTM_zone_16S,	32716)
+ValuePair(PCS_WGS84_UTM_zone_17S,	32717)
+ValuePair(PCS_WGS84_UTM_zone_18S,	32718)
+ValuePair(PCS_WGS84_UTM_zone_19S,	32719)
+ValuePair(PCS_WGS84_UTM_zone_20S,	32720)
+ValuePair(PCS_WGS84_UTM_zone_21S,	32721)
+ValuePair(PCS_WGS84_UTM_zone_22S,	32722)
+ValuePair(PCS_WGS84_UTM_zone_23S,	32723)
+ValuePair(PCS_WGS84_UTM_zone_24S,	32724)
+ValuePair(PCS_WGS84_UTM_zone_25S,	32725)
+ValuePair(PCS_WGS84_UTM_zone_26S,	32726)
+ValuePair(PCS_WGS84_UTM_zone_27S,	32727)
+ValuePair(PCS_WGS84_UTM_zone_28S,	32728)
+ValuePair(PCS_WGS84_UTM_zone_29S,	32729)
+ValuePair(PCS_WGS84_UTM_zone_30S,	32730)
+ValuePair(PCS_WGS84_UTM_zone_31S,	32731)
+ValuePair(PCS_WGS84_UTM_zone_32S,	32732)
+ValuePair(PCS_WGS84_UTM_zone_33S,	32733)
+ValuePair(PCS_WGS84_UTM_zone_34S,	32734)
+ValuePair(PCS_WGS84_UTM_zone_35S,	32735)
+ValuePair(PCS_WGS84_UTM_zone_36S,	32736)
+ValuePair(PCS_WGS84_UTM_zone_37S,	32737)
+ValuePair(PCS_WGS84_UTM_zone_38S,	32738)
+ValuePair(PCS_WGS84_UTM_zone_39S,	32739)
+ValuePair(PCS_WGS84_UTM_zone_40S,	32740)
+ValuePair(PCS_WGS84_UTM_zone_41S,	32741)
+ValuePair(PCS_WGS84_UTM_zone_42S,	32742)
+ValuePair(PCS_WGS84_UTM_zone_43S,	32743)
+ValuePair(PCS_WGS84_UTM_zone_44S,	32744)
+ValuePair(PCS_WGS84_UTM_zone_45S,	32745)
+ValuePair(PCS_WGS84_UTM_zone_46S,	32746)
+ValuePair(PCS_WGS84_UTM_zone_47S,	32747)
+ValuePair(PCS_WGS84_UTM_zone_48S,	32748)
+ValuePair(PCS_WGS84_UTM_zone_49S,	32749)
+ValuePair(PCS_WGS84_UTM_zone_50S,	32750)
+ValuePair(PCS_WGS84_UTM_zone_51S,	32751)
+ValuePair(PCS_WGS84_UTM_zone_52S,	32752)
+ValuePair(PCS_WGS84_UTM_zone_53S,	32753)
+ValuePair(PCS_WGS84_UTM_zone_54S,	32754)
+ValuePair(PCS_WGS84_UTM_zone_55S,	32755)
+ValuePair(PCS_WGS84_UTM_zone_56S,	32756)
+ValuePair(PCS_WGS84_UTM_zone_57S,	32757)
+ValuePair(PCS_WGS84_UTM_zone_58S,	32758)
+ValuePair(PCS_WGS84_UTM_zone_59S,	32759)
+ValuePair(PCS_WGS84_UTM_zone_60S,	32760)
+/* end of list */

Added: packages/geotiff/libgeotiff-dfsg/trunk/epsg_pm.inc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/epsg_pm.inc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/epsg_pm.inc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,22 @@
+/* EPSG/GeoTIFF Rev 0.2 Prime Meridian Database */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_pm.inc
+#endif /* OLD Codes */
+
+ValuePair(PM_Greenwich,	8901)
+ValuePair(PM_Lisbon,	8902)
+ValuePair(PM_Paris,	8903)
+ValuePair(PM_Bogota,	8904)
+ValuePair(PM_Madrid,	8905)
+ValuePair(PM_Rome,	8906)
+ValuePair(PM_Bern,	8907)
+ValuePair(PM_Jakarta,	8908)
+ValuePair(PM_Ferro,	8909)
+ValuePair(PM_Brussels,	8910)
+ValuePair(PM_Stockholm,	8911)
+/* end of list */

Added: packages/geotiff/libgeotiff-dfsg/trunk/epsg_proj.inc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/epsg_proj.inc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/epsg_proj.inc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,443 @@
+/*
+ *  EPSG/POSC Projection Codes - GeoTIFF Rev 0.2
+ */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+#ifdef INCLUDE_OLD_CODES
+#include old_proj.inc
+#endif /* OLD Codes */
+
+/* New codes */
+
+ValuePair(Proj_Stereo_70,19926)
+
+/* old codes */
+
+ValuePair(Proj_Alabama_CS27_East,	10101)
+ValuePair(Proj_Alabama_CS27_West,	10102)
+ValuePair(Proj_Alabama_CS83_East,	10131)
+ValuePair(Proj_Alabama_CS83_West,	10132)
+ValuePair(Proj_Arizona_Coordinate_System_east,	10201)
+ValuePair(Proj_Arizona_Coordinate_System_Central,	10202)
+ValuePair(Proj_Arizona_Coordinate_System_west,	10203)
+ValuePair(Proj_Arizona_CS83_east,	10231)
+ValuePair(Proj_Arizona_CS83_Central,	10232)
+ValuePair(Proj_Arizona_CS83_west,	10233)
+ValuePair(Proj_Arkansas_CS27_North,	10301)
+ValuePair(Proj_Arkansas_CS27_South,	10302)
+ValuePair(Proj_Arkansas_CS83_North,	10331)
+ValuePair(Proj_Arkansas_CS83_South,	10332)
+ValuePair(Proj_California_CS27_I,	10401)
+ValuePair(Proj_California_CS27_II,	10402)
+ValuePair(Proj_California_CS27_III,	10403)
+ValuePair(Proj_California_CS27_IV,	10404)
+ValuePair(Proj_California_CS27_V,	10405)
+ValuePair(Proj_California_CS27_VI,	10406)
+ValuePair(Proj_California_CS27_VII,	10407)
+ValuePair(Proj_California_CS83_1,	10431)
+ValuePair(Proj_California_CS83_2,	10432)
+ValuePair(Proj_California_CS83_3,	10433)
+ValuePair(Proj_California_CS83_4,	10434)
+ValuePair(Proj_California_CS83_5,	10435)
+ValuePair(Proj_California_CS83_6,	10436)
+ValuePair(Proj_Colorado_CS27_North,	10501)
+ValuePair(Proj_Colorado_CS27_Central,	10502)
+ValuePair(Proj_Colorado_CS27_South,	10503)
+ValuePair(Proj_Colorado_CS83_North,	10531)
+ValuePair(Proj_Colorado_CS83_Central,	10532)
+ValuePair(Proj_Colorado_CS83_South,	10533)
+ValuePair(Proj_Connecticut_CS27,	10600)
+ValuePair(Proj_Connecticut_CS83,	10630)
+ValuePair(Proj_Delaware_CS27,	10700)
+ValuePair(Proj_Delaware_CS83,	10730)
+ValuePair(Proj_Florida_CS27_East,	10901)
+ValuePair(Proj_Florida_CS27_West,	10902)
+ValuePair(Proj_Florida_CS27_North,	10903)
+ValuePair(Proj_Florida_CS83_East,	10931)
+ValuePair(Proj_Florida_CS83_West,	10932)
+ValuePair(Proj_Florida_CS83_North,	10933)
+ValuePair(Proj_Georgia_CS27_East,	11001)
+ValuePair(Proj_Georgia_CS27_West,	11002)
+ValuePair(Proj_Georgia_CS83_East,	11031)
+ValuePair(Proj_Georgia_CS83_West,	11032)
+ValuePair(Proj_Idaho_CS27_East,	11101)
+ValuePair(Proj_Idaho_CS27_Central,	11102)
+ValuePair(Proj_Idaho_CS27_West,	11103)
+ValuePair(Proj_Idaho_CS83_East,	11131)
+ValuePair(Proj_Idaho_CS83_Central,	11132)
+ValuePair(Proj_Idaho_CS83_West,	11133)
+ValuePair(Proj_Illinois_CS27_East,	11201)
+ValuePair(Proj_Illinois_CS27_West,	11202)
+ValuePair(Proj_Illinois_CS83_East,	11231)
+ValuePair(Proj_Illinois_CS83_West,	11232)
+ValuePair(Proj_Indiana_CS27_East,	11301)
+ValuePair(Proj_Indiana_CS27_West,	11302)
+ValuePair(Proj_Indiana_CS83_East,	11331)
+ValuePair(Proj_Indiana_CS83_West,	11332)
+ValuePair(Proj_Iowa_CS27_North,	11401)
+ValuePair(Proj_Iowa_CS27_South,	11402)
+ValuePair(Proj_Iowa_CS83_North,	11431)
+ValuePair(Proj_Iowa_CS83_South,	11432)
+ValuePair(Proj_Kansas_CS27_North,	11501)
+ValuePair(Proj_Kansas_CS27_South,	11502)
+ValuePair(Proj_Kansas_CS83_North,	11531)
+ValuePair(Proj_Kansas_CS83_South,	11532)
+ValuePair(Proj_Kentucky_CS27_North,	11601)
+ValuePair(Proj_Kentucky_CS27_South,	11602)
+ValuePair(Proj_Kentucky_CS83_North,	15303)
+ValuePair(Proj_Kentucky_CS83_South,	11632)
+ValuePair(Proj_Louisiana_CS27_North,	11701)
+ValuePair(Proj_Louisiana_CS27_South,	11702)
+ValuePair(Proj_Louisiana_CS83_North,	11731)
+ValuePair(Proj_Louisiana_CS83_South,	11732)
+ValuePair(Proj_Maine_CS27_East,	11801)
+ValuePair(Proj_Maine_CS27_West,	11802)
+ValuePair(Proj_Maine_CS83_East,	11831)
+ValuePair(Proj_Maine_CS83_West,	11832)
+ValuePair(Proj_Maryland_CS27,	11900)
+ValuePair(Proj_Maryland_CS83,	11930)
+ValuePair(Proj_Massachusetts_CS27_Mainland,	12001)
+ValuePair(Proj_Massachusetts_CS27_Island,	12002)
+ValuePair(Proj_Massachusetts_CS83_Mainland,	12031)
+ValuePair(Proj_Massachusetts_CS83_Island,	12032)
+ValuePair(Proj_Michigan_State_Plane_East,	12101)
+ValuePair(Proj_Michigan_State_Plane_Old_Central,	12102)
+ValuePair(Proj_Michigan_State_Plane_West,	12103)
+ValuePair(Proj_Michigan_CS27_North,	12111)
+ValuePair(Proj_Michigan_CS27_Central,	12112)
+ValuePair(Proj_Michigan_CS27_South,	12113)
+ValuePair(Proj_Michigan_CS83_North,	12141)
+ValuePair(Proj_Michigan_CS83_Central,	12142)
+ValuePair(Proj_Michigan_CS83_South,	12143)
+ValuePair(Proj_Minnesota_CS27_North,	12201)
+ValuePair(Proj_Minnesota_CS27_Central,	12202)
+ValuePair(Proj_Minnesota_CS27_South,	12203)
+ValuePair(Proj_Minnesota_CS83_North,	12231)
+ValuePair(Proj_Minnesota_CS83_Central,	12232)
+ValuePair(Proj_Minnesota_CS83_South,	12233)
+ValuePair(Proj_Mississippi_CS27_East,	12301)
+ValuePair(Proj_Mississippi_CS27_West,	12302)
+ValuePair(Proj_Mississippi_CS83_East,	12331)
+ValuePair(Proj_Mississippi_CS83_West,	12332)
+ValuePair(Proj_Missouri_CS27_East,	12401)
+ValuePair(Proj_Missouri_CS27_Central,	12402)
+ValuePair(Proj_Missouri_CS27_West,	12403)
+ValuePair(Proj_Missouri_CS83_East,	12431)
+ValuePair(Proj_Missouri_CS83_Central,	12432)
+ValuePair(Proj_Missouri_CS83_West,	12433)
+ValuePair(Proj_Montana_CS27_North,	12501)
+ValuePair(Proj_Montana_CS27_Central,	12502)
+ValuePair(Proj_Montana_CS27_South,	12503)
+ValuePair(Proj_Montana_CS83,	12530)
+ValuePair(Proj_Nebraska_CS27_North,	12601)
+ValuePair(Proj_Nebraska_CS27_South,	12602)
+ValuePair(Proj_Nebraska_CS83,	12630)
+ValuePair(Proj_Nevada_CS27_East,	12701)
+ValuePair(Proj_Nevada_CS27_Central,	12702)
+ValuePair(Proj_Nevada_CS27_West,	12703)
+ValuePair(Proj_Nevada_CS83_East,	12731)
+ValuePair(Proj_Nevada_CS83_Central,	12732)
+ValuePair(Proj_Nevada_CS83_West,	12733)
+ValuePair(Proj_New_Hampshire_CS27,	12800)
+ValuePair(Proj_New_Hampshire_CS83,	12830)
+ValuePair(Proj_New_Jersey_CS27,	12900)
+ValuePair(Proj_New_Jersey_CS83,	12930)
+ValuePair(Proj_New_Mexico_CS27_East,	13001)
+ValuePair(Proj_New_Mexico_CS27_Central,	13002)
+ValuePair(Proj_New_Mexico_CS27_West,	13003)
+ValuePair(Proj_New_Mexico_CS83_East,	13031)
+ValuePair(Proj_New_Mexico_CS83_Central,	13032)
+ValuePair(Proj_New_Mexico_CS83_West,	13033)
+ValuePair(Proj_New_York_CS27_East,	13101)
+ValuePair(Proj_New_York_CS27_Central,	13102)
+ValuePair(Proj_New_York_CS27_West,	13103)
+ValuePair(Proj_New_York_CS27_Long_Island,	13104)
+ValuePair(Proj_New_York_CS83_East,	13131)
+ValuePair(Proj_New_York_CS83_Central,	13132)
+ValuePair(Proj_New_York_CS83_West,	13133)
+ValuePair(Proj_New_York_CS83_Long_Island,	13134)
+ValuePair(Proj_North_Carolina_CS27,	13200)
+ValuePair(Proj_North_Carolina_CS83,	13230)
+ValuePair(Proj_North_Dakota_CS27_North,	13301)
+ValuePair(Proj_North_Dakota_CS27_South,	13302)
+ValuePair(Proj_North_Dakota_CS83_North,	13331)
+ValuePair(Proj_North_Dakota_CS83_South,	13332)
+ValuePair(Proj_Ohio_CS27_North,	13401)
+ValuePair(Proj_Ohio_CS27_South,	13402)
+ValuePair(Proj_Ohio_CS83_North,	13431)
+ValuePair(Proj_Ohio_CS83_South,	13432)
+ValuePair(Proj_Oklahoma_CS27_North,	13501)
+ValuePair(Proj_Oklahoma_CS27_South,	13502)
+ValuePair(Proj_Oklahoma_CS83_North,	13531)
+ValuePair(Proj_Oklahoma_CS83_South,	13532)
+ValuePair(Proj_Oregon_CS27_North,	13601)
+ValuePair(Proj_Oregon_CS27_South,	13602)
+ValuePair(Proj_Oregon_CS83_North,	13631)
+ValuePair(Proj_Oregon_CS83_South,	13632)
+ValuePair(Proj_Pennsylvania_CS27_North,	13701)
+ValuePair(Proj_Pennsylvania_CS27_South,	13702)
+ValuePair(Proj_Pennsylvania_CS83_North,	13731)
+ValuePair(Proj_Pennsylvania_CS83_South,	13732)
+ValuePair(Proj_Rhode_Island_CS27,	13800)
+ValuePair(Proj_Rhode_Island_CS83,	13830)
+ValuePair(Proj_South_Carolina_CS27_North,	13901)
+ValuePair(Proj_South_Carolina_CS27_South,	13902)
+ValuePair(Proj_South_Carolina_CS83,	13930)
+ValuePair(Proj_South_Dakota_CS27_North,	14001)
+ValuePair(Proj_South_Dakota_CS27_South,	14002)
+ValuePair(Proj_South_Dakota_CS83_North,	14031)
+ValuePair(Proj_South_Dakota_CS83_South,	14032)
+ValuePair(Proj_Tennessee_CS27,	15302)
+ValuePair(Proj_Tennessee_CS83,	14130)
+ValuePair(Proj_Texas_CS27_North,	14201)
+ValuePair(Proj_Texas_CS27_North_Central,	14202)
+ValuePair(Proj_Texas_CS27_Central,	14203)
+ValuePair(Proj_Texas_CS27_South_Central,	14204)
+ValuePair(Proj_Texas_CS27_South,	14205)
+ValuePair(Proj_Texas_CS83_North,	14231)
+ValuePair(Proj_Texas_CS83_North_Central,	14232)
+ValuePair(Proj_Texas_CS83_Central,	14233)
+ValuePair(Proj_Texas_CS83_South_Central,	14234)
+ValuePair(Proj_Texas_CS83_South,	14235)
+ValuePair(Proj_Utah_CS27_North,	14301)
+ValuePair(Proj_Utah_CS27_Central,	14302)
+ValuePair(Proj_Utah_CS27_South,	14303)
+ValuePair(Proj_Utah_CS83_North,	14331)
+ValuePair(Proj_Utah_CS83_Central,	14332)
+ValuePair(Proj_Utah_CS83_South,	14333)
+ValuePair(Proj_Vermont_CS27,	14400)
+ValuePair(Proj_Vermont_CS83,	14430)
+ValuePair(Proj_Virginia_CS27_North,	14501)
+ValuePair(Proj_Virginia_CS27_South,	14502)
+ValuePair(Proj_Virginia_CS83_North,	14531)
+ValuePair(Proj_Virginia_CS83_South,	14532)
+ValuePair(Proj_Washington_CS27_North,	14601)
+ValuePair(Proj_Washington_CS27_South,	14602)
+ValuePair(Proj_Washington_CS83_North,	14631)
+ValuePair(Proj_Washington_CS83_South,	14632)
+ValuePair(Proj_West_Virginia_CS27_North,	14701)
+ValuePair(Proj_West_Virginia_CS27_South,	14702)
+ValuePair(Proj_West_Virginia_CS83_North,	14731)
+ValuePair(Proj_West_Virginia_CS83_South,	14732)
+ValuePair(Proj_Wisconsin_CS27_North,	14801)
+ValuePair(Proj_Wisconsin_CS27_Central,	14802)
+ValuePair(Proj_Wisconsin_CS27_South,	14803)
+ValuePair(Proj_Wisconsin_CS83_North,	14831)
+ValuePair(Proj_Wisconsin_CS83_Central,	14832)
+ValuePair(Proj_Wisconsin_CS83_South,	14833)
+ValuePair(Proj_Wyoming_CS27_East,	14901)
+ValuePair(Proj_Wyoming_CS27_East_Central,	14902)
+ValuePair(Proj_Wyoming_CS27_West_Central,	14903)
+ValuePair(Proj_Wyoming_CS27_West,	14904)
+ValuePair(Proj_Wyoming_CS83_East,	14931)
+ValuePair(Proj_Wyoming_CS83_East_Central,	14932)
+ValuePair(Proj_Wyoming_CS83_West_Central,	14933)
+ValuePair(Proj_Wyoming_CS83_West,	14934)
+ValuePair(Proj_Alaska_CS27_1,	15001)
+ValuePair(Proj_Alaska_CS27_2,	15002)
+ValuePair(Proj_Alaska_CS27_3,	15003)
+ValuePair(Proj_Alaska_CS27_4,	15004)
+ValuePair(Proj_Alaska_CS27_5,	15005)
+ValuePair(Proj_Alaska_CS27_6,	15006)
+ValuePair(Proj_Alaska_CS27_7,	15007)
+ValuePair(Proj_Alaska_CS27_8,	15008)
+ValuePair(Proj_Alaska_CS27_9,	15009)
+ValuePair(Proj_Alaska_CS27_10,	15010)
+ValuePair(Proj_Alaska_CS83_1,	15031)
+ValuePair(Proj_Alaska_CS83_2,	15032)
+ValuePair(Proj_Alaska_CS83_3,	15033)
+ValuePair(Proj_Alaska_CS83_4,	15034)
+ValuePair(Proj_Alaska_CS83_5,	15035)
+ValuePair(Proj_Alaska_CS83_6,	15036)
+ValuePair(Proj_Alaska_CS83_7,	15037)
+ValuePair(Proj_Alaska_CS83_8,	15038)
+ValuePair(Proj_Alaska_CS83_9,	15039)
+ValuePair(Proj_Alaska_CS83_10,	15040)
+ValuePair(Proj_Hawaii_CS27_1,	15101)
+ValuePair(Proj_Hawaii_CS27_2,	15102)
+ValuePair(Proj_Hawaii_CS27_3,	15103)
+ValuePair(Proj_Hawaii_CS27_4,	15104)
+ValuePair(Proj_Hawaii_CS27_5,	15105)
+ValuePair(Proj_Hawaii_CS83_1,	15131)
+ValuePair(Proj_Hawaii_CS83_2,	15132)
+ValuePair(Proj_Hawaii_CS83_3,	15133)
+ValuePair(Proj_Hawaii_CS83_4,	15134)
+ValuePair(Proj_Hawaii_CS83_5,	15135)
+ValuePair(Proj_Puerto_Rico_CS27,	15201)
+ValuePair(Proj_St_Croix,	15202)
+ValuePair(Proj_Puerto_Rico_Virgin_Is,	15230)
+ValuePair(Proj_BLM_14N_feet,	15914)
+ValuePair(Proj_BLM_15N_feet,	15915)
+ValuePair(Proj_BLM_16N_feet,	15916)
+ValuePair(Proj_BLM_17N_feet,	15917)
+ValuePair(Proj_UTM_zone_1N,  16001)
+ValuePair(Proj_UTM_zone_2N,  16002)
+ValuePair(Proj_UTM_zone_3N,  16003)
+ValuePair(Proj_UTM_zone_4N,  16004)
+ValuePair(Proj_UTM_zone_5N,  16005)
+ValuePair(Proj_UTM_zone_6N,  16006)
+ValuePair(Proj_UTM_zone_7N,  16007)
+ValuePair(Proj_UTM_zone_8N,  16008)
+ValuePair(Proj_UTM_zone_9N,  16009)
+ValuePair(Proj_UTM_zone_10N, 16010)
+ValuePair(Proj_UTM_zone_11N, 16011)
+ValuePair(Proj_UTM_zone_12N, 16012)
+ValuePair(Proj_UTM_zone_13N, 16013)
+ValuePair(Proj_UTM_zone_14N, 16014)
+ValuePair(Proj_UTM_zone_15N, 16015)
+ValuePair(Proj_UTM_zone_16N, 16016)
+ValuePair(Proj_UTM_zone_17N, 16017)
+ValuePair(Proj_UTM_zone_18N, 16018)
+ValuePair(Proj_UTM_zone_19N, 16019)
+ValuePair(Proj_UTM_zone_20N, 16020)
+ValuePair(Proj_UTM_zone_21N, 16021)
+ValuePair(Proj_UTM_zone_22N, 16022)
+ValuePair(Proj_UTM_zone_23N, 16023)
+ValuePair(Proj_UTM_zone_24N, 16024)
+ValuePair(Proj_UTM_zone_25N, 16025)
+ValuePair(Proj_UTM_zone_26N, 16026)
+ValuePair(Proj_UTM_zone_27N, 16027)
+ValuePair(Proj_UTM_zone_28N, 16028)
+ValuePair(Proj_UTM_zone_29N, 16029)
+ValuePair(Proj_UTM_zone_30N, 16030)
+ValuePair(Proj_UTM_zone_31N, 16031)
+ValuePair(Proj_UTM_zone_32N, 16032)
+ValuePair(Proj_UTM_zone_33N, 16033)
+ValuePair(Proj_UTM_zone_34N, 16034)
+ValuePair(Proj_UTM_zone_35N, 16035)
+ValuePair(Proj_UTM_zone_36N, 16036)
+ValuePair(Proj_UTM_zone_37N, 16037)
+ValuePair(Proj_UTM_zone_38N, 16038)
+ValuePair(Proj_UTM_zone_39N, 16039)
+ValuePair(Proj_UTM_zone_40N, 16040)
+ValuePair(Proj_UTM_zone_41N, 16041)
+ValuePair(Proj_UTM_zone_42N, 16042)
+ValuePair(Proj_UTM_zone_43N, 16043)
+ValuePair(Proj_UTM_zone_44N, 16044)
+ValuePair(Proj_UTM_zone_45N, 16045)
+ValuePair(Proj_UTM_zone_46N, 16046)
+ValuePair(Proj_UTM_zone_47N, 16047)
+ValuePair(Proj_UTM_zone_48N, 16048)
+ValuePair(Proj_UTM_zone_49N, 16049)
+ValuePair(Proj_UTM_zone_50N, 16050)
+ValuePair(Proj_UTM_zone_51N, 16051)
+ValuePair(Proj_UTM_zone_52N, 16052)
+ValuePair(Proj_UTM_zone_53N, 16053)
+ValuePair(Proj_UTM_zone_54N, 16054)
+ValuePair(Proj_UTM_zone_55N, 16055)
+ValuePair(Proj_UTM_zone_56N, 16056)
+ValuePair(Proj_UTM_zone_57N, 16057)
+ValuePair(Proj_UTM_zone_58N, 16058)
+ValuePair(Proj_UTM_zone_59N, 16059)
+ValuePair(Proj_UTM_zone_60N, 16060)
+ValuePair(Proj_UTM_zone_1S,  16101)
+ValuePair(Proj_UTM_zone_2S,  16102)
+ValuePair(Proj_UTM_zone_3S,  16103)
+ValuePair(Proj_UTM_zone_4S,  16104)
+ValuePair(Proj_UTM_zone_5S,  16105)
+ValuePair(Proj_UTM_zone_6S,  16106)
+ValuePair(Proj_UTM_zone_7S,  16107)
+ValuePair(Proj_UTM_zone_8S,  16108)
+ValuePair(Proj_UTM_zone_9S,  16109)
+ValuePair(Proj_UTM_zone_10S, 16110)
+ValuePair(Proj_UTM_zone_11S, 16111)
+ValuePair(Proj_UTM_zone_12S, 16112)
+ValuePair(Proj_UTM_zone_13S, 16113)
+ValuePair(Proj_UTM_zone_14S, 16114)
+ValuePair(Proj_UTM_zone_15S, 16115)
+ValuePair(Proj_UTM_zone_16S, 16116)
+ValuePair(Proj_UTM_zone_17S, 16117)
+ValuePair(Proj_UTM_zone_18S, 16118)
+ValuePair(Proj_UTM_zone_19S, 16119)
+ValuePair(Proj_UTM_zone_20S, 16120)
+ValuePair(Proj_UTM_zone_21S, 16121)
+ValuePair(Proj_UTM_zone_22S, 16122)
+ValuePair(Proj_UTM_zone_23S, 16123)
+ValuePair(Proj_UTM_zone_24S, 16124)
+ValuePair(Proj_UTM_zone_25S, 16125)
+ValuePair(Proj_UTM_zone_26S, 16126)
+ValuePair(Proj_UTM_zone_27S, 16127)
+ValuePair(Proj_UTM_zone_28S, 16128)
+ValuePair(Proj_UTM_zone_29S, 16129)
+ValuePair(Proj_UTM_zone_30S, 16130)
+ValuePair(Proj_UTM_zone_31S, 16131)
+ValuePair(Proj_UTM_zone_32S, 16132)
+ValuePair(Proj_UTM_zone_33S, 16133)
+ValuePair(Proj_UTM_zone_34S, 16134)
+ValuePair(Proj_UTM_zone_35S, 16135)
+ValuePair(Proj_UTM_zone_36S, 16136)
+ValuePair(Proj_UTM_zone_37S, 16137)
+ValuePair(Proj_UTM_zone_38S, 16138)
+ValuePair(Proj_UTM_zone_39S, 16139)
+ValuePair(Proj_UTM_zone_40S, 16140)
+ValuePair(Proj_UTM_zone_41S, 16141)
+ValuePair(Proj_UTM_zone_42S, 16142)
+ValuePair(Proj_UTM_zone_43S, 16143)
+ValuePair(Proj_UTM_zone_44S, 16144)
+ValuePair(Proj_UTM_zone_45S, 16145)
+ValuePair(Proj_UTM_zone_46S, 16146)
+ValuePair(Proj_UTM_zone_47S, 16147)
+ValuePair(Proj_UTM_zone_48S, 16148)
+ValuePair(Proj_UTM_zone_49S, 16149)
+ValuePair(Proj_UTM_zone_50S, 16150)
+ValuePair(Proj_UTM_zone_51S, 16151)
+ValuePair(Proj_UTM_zone_52S, 16152)
+ValuePair(Proj_UTM_zone_53S, 16153)
+ValuePair(Proj_UTM_zone_54S, 16154)
+ValuePair(Proj_UTM_zone_55S, 16155)
+ValuePair(Proj_UTM_zone_56S, 16156)
+ValuePair(Proj_UTM_zone_57S, 16157)
+ValuePair(Proj_UTM_zone_58S, 16158)
+ValuePair(Proj_UTM_zone_59S, 16159)
+ValuePair(Proj_UTM_zone_60S, 16160)
+ValuePair(Proj_Gauss_Kruger_zone_0, 16200)
+ValuePair(Proj_Gauss_Kruger_zone_1, 16201)
+ValuePair(Proj_Gauss_Kruger_zone_2, 16202)
+ValuePair(Proj_Gauss_Kruger_zone_3, 16203)
+ValuePair(Proj_Gauss_Kruger_zone_4, 16204)
+ValuePair(Proj_Gauss_Kruger_zone_5, 16205)
+ValuePair(Proj_Map_Grid_of_Australia_48,	17348)
+ValuePair(Proj_Map_Grid_of_Australia_49,	17349)
+ValuePair(Proj_Map_Grid_of_Australia_50,	17350)
+ValuePair(Proj_Map_Grid_of_Australia_51,	17351)
+ValuePair(Proj_Map_Grid_of_Australia_52,	17352)
+ValuePair(Proj_Map_Grid_of_Australia_53,	17353)
+ValuePair(Proj_Map_Grid_of_Australia_54,	17354)
+ValuePair(Proj_Map_Grid_of_Australia_55,	17355)
+ValuePair(Proj_Map_Grid_of_Australia_56,	17356)
+ValuePair(Proj_Map_Grid_of_Australia_57,	17357)
+ValuePair(Proj_Map_Grid_of_Australia_58,	17358)
+ValuePair(Proj_Australian_Map_Grid_48,	17448)
+ValuePair(Proj_Australian_Map_Grid_49,	17449)
+ValuePair(Proj_Australian_Map_Grid_50,	17450)
+ValuePair(Proj_Australian_Map_Grid_51,	17451)
+ValuePair(Proj_Australian_Map_Grid_52,	17452)
+ValuePair(Proj_Australian_Map_Grid_53,	17453)
+ValuePair(Proj_Australian_Map_Grid_54,	17454)
+ValuePair(Proj_Australian_Map_Grid_55,	17455)
+ValuePair(Proj_Australian_Map_Grid_56,	17456)
+ValuePair(Proj_Australian_Map_Grid_57,	17457)
+ValuePair(Proj_Australian_Map_Grid_58,	17458)
+ValuePair(Proj_Argentina_1,	18031)
+ValuePair(Proj_Argentina_2,	18032)
+ValuePair(Proj_Argentina_3,	18033)
+ValuePair(Proj_Argentina_4,	18034)
+ValuePair(Proj_Argentina_5,	18035)
+ValuePair(Proj_Argentina_6,	18036)
+ValuePair(Proj_Argentina_7,	18037)
+ValuePair(Proj_Colombia_3W,	18051)
+ValuePair(Proj_Colombia_Bogota,	18052)
+ValuePair(Proj_Colombia_3E,	18053)
+ValuePair(Proj_Colombia_6E,	18054)
+ValuePair(Proj_Egypt_Red_Belt,	18072)
+ValuePair(Proj_Egypt_Purple_Belt,	18073)
+ValuePair(Proj_Extended_Purple_Belt,	18074)
+ValuePair(Proj_New_Zealand_North_Island_Nat_Grid,	18141)
+ValuePair(Proj_New_Zealand_South_Island_Nat_Grid,	18142)
+ValuePair(Proj_Bahrain_Grid,	19900)
+ValuePair(Proj_Netherlands_E_Indies_Equatorial,	19905)
+ValuePair(Proj_RSO_Borneo,	19912)
+/* end of list */

Added: packages/geotiff/libgeotiff-dfsg/trunk/epsg_units.inc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/epsg_units.inc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/epsg_units.inc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,35 @@
+/*
+ * Rev. 0.2 EPSG/POSC Units Database.
+ */
+ 
+#ifdef INCLUDE_OLD_CODES
+#include geo_units.inc
+#endif /* OLD Codes */
+
+ValuePair(Linear_Meter,	9001)
+ValuePair(Linear_Foot,	9002)
+ValuePair(Linear_Foot_US_Survey,	9003)
+ValuePair(Linear_Foot_Modified_American,	9004)
+ValuePair(Linear_Foot_Clarke,	9005)
+ValuePair(Linear_Foot_Indian,	9006)
+ValuePair(Linear_Link,	9007)
+ValuePair(Linear_Link_Benoit,	9008)
+ValuePair(Linear_Link_Sears,	9009)
+ValuePair(Linear_Chain_Benoit,	9010)
+ValuePair(Linear_Chain_Sears,	9011)
+ValuePair(Linear_Yard_Sears,	9012)
+ValuePair(Linear_Yard_Indian,	9013)
+ValuePair(Linear_Fathom,	9014)
+ValuePair(Linear_Mile_International_Nautical,	9015)
+/*
+ *  Angular Units
+ */
+ValuePair(Angular_Radian,	9101)
+ValuePair(Angular_Degree,	9102)
+ValuePair(Angular_Arc_Minute,	9103)
+ValuePair(Angular_Arc_Second,	9104)
+ValuePair(Angular_Grad,	9105)
+ValuePair(Angular_Gon,	9106)
+ValuePair(Angular_DMS,	9107)
+ValuePair(Angular_DMS_Hemisphere,	9108)
+/* end of list */

Added: packages/geotiff/libgeotiff-dfsg/trunk/epsg_vertcs.inc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/epsg_vertcs.inc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/epsg_vertcs.inc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,46 @@
+/*
+ *  EPSG/POSC Ellipsoid-referenced Vertical CS
+ *   Note: these should correspond exactly with the Ellipsoid database.
+ */
+ValuePair(VertCS_Airy_1830_ellipsoid,	5001)
+ValuePair(VertCS_Airy_Modified_1849_ellipsoid,	5002)
+ValuePair(VertCS_ANS_ellipsoid,	5003)
+ValuePair(VertCS_Bessel_1841_ellipsoid,	5004)
+ValuePair(VertCS_Bessel_Modified_ellipsoid,	5005)
+ValuePair(VertCS_Bessel_Namibia_ellipsoid,	5006)
+ValuePair(VertCS_Clarke_1858_ellipsoid,	5007)
+ValuePair(VertCS_Clarke_1866_ellipsoid,	5008)
+ValuePair(VertCS_Clarke_1880_Benoit_ellipsoid,	5010)
+ValuePair(VertCS_Clarke_1880_IGN_ellipsoid,	5011)
+ValuePair(VertCS_Clarke_1880_RGS_ellipsoid,	5012)
+ValuePair(VertCS_Clarke_1880_Arc_ellipsoid,	5013)
+ValuePair(VertCS_Clarke_1880_SGA_1922_ellipsoid,	5014)
+ValuePair(VertCS_Everest_1830_1937_Adjustment_ellipsoid,	5015)
+ValuePair(VertCS_Everest_1830_1967_Definition_ellipsoid,	5016)
+ValuePair(VertCS_Everest_1830_1975_Definition_ellipsoid,	5017)
+ValuePair(VertCS_Everest_1830_Modified_ellipsoid,	5018)
+ValuePair(VertCS_GRS_1980_ellipsoid,	5019)
+ValuePair(VertCS_Helmert_1906_ellipsoid,	5020)
+ValuePair(VertCS_INS_ellipsoid,	5021)
+ValuePair(VertCS_International_1924_ellipsoid,	5022)
+ValuePair(VertCS_International_1967_ellipsoid,	5023)
+ValuePair(VertCS_Krassowsky_1940_ellipsoid,	5024)
+ValuePair(VertCS_NWL_9D_ellipsoid,	5025)
+ValuePair(VertCS_NWL_10D_ellipsoid,	5026)
+ValuePair(VertCS_Plessis_1817_ellipsoid,	5027)
+ValuePair(VertCS_Struve_1860_ellipsoid,	5028)
+ValuePair(VertCS_War_Office_ellipsoid,	5029)
+ValuePair(VertCS_WGS_84_ellipsoid,	5030)
+ValuePair(VertCS_GEM_10C_ellipsoid,	5031)
+ValuePair(VertCS_OSU86F_ellipsoid,	5032)
+ValuePair(VertCS_OSU91A_ellipsoid,	5033)
+/*
+ *  Other established Vertical CS
+ */
+ValuePair(VertCS_Newlyn,	5101)
+ValuePair(VertCS_North_American_Vertical_Datum_1929,	5102)
+ValuePair(VertCS_North_American_Vertical_Datum_1988,	5103)
+ValuePair(VertCS_Yellow_Sea_1956,	5104)
+ValuePair(VertCS_Baltic_Sea,	5105)
+ValuePair(VertCS_Caspian_Sea,	5106)
+/* end of list */

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_config.h.in
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_config.h.in	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_config.h.in	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,19 @@
+#ifndef GEO_CONFIG_H
+#define GEO_CONFIG_H
+
+/* Define if you have the ANSI C header files.  */
+#undef STDC_HEADERS
+
+/* Define if you have the <stdlib.h> header file.  */
+#undef HAVE_STDLIB_H
+
+/* Define if you have the <string.h> header file.  */
+#undef HAVE_STRING_H
+
+/* Define if you have the <strings.h> header file.  */
+#undef HAVE_STRINGS_H
+
+#undef HAVE_LIBPROJ
+#undef HAVE_PROJECTS_H
+
+#endif /* ndef GEO_CONFIG_H */

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_config.h.vc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_config.h.vc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_config.h.vc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,24 @@
+/* geo_config.h.  Generated automatically by configure.  */
+#ifndef GEO_CONFIG_H
+#define GEO_CONFIG_H
+
+/* Define if you have the ANSI C header files.  */
+#define STDC_HEADERS 1
+
+/* Define if your processor stores words with the most significant
+   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define if you have the <stdlib.h> header file.  */
+#define HAVE_STDLIB_H 1
+
+/* Define if you have the <string.h> header file.  */
+#define HAVE_STRING_H 1
+
+/* Define if you have the <strings.h> header file.  */
+#define HAVE_STRINGS_H 1
+
+/* Build as DLL */
+#define BUILD_AS_DLL      1
+
+#endif /* ndef GEO_CONFIG_H */

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_ctrans.inc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_ctrans.inc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_ctrans.inc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,91 @@
+/******************************************************************************
+ * $Id: geo_ctrans.inc,v 1.3 2005/03/04 03:59:11 fwarmerdam Exp $
+ *
+ * Project:  libgeotiff
+ * Purpose:  GeoTIFF Projection Method codes. 
+ * Author:   Frank Warmerdam, warmerdam at pobox.com
+ *
+ ******************************************************************************
+ * Copyright (c) 2005, Frank Warmerdam <warmerdam at pobox.com>
+ *
+ * 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: geo_ctrans.inc,v $
+ * Revision 1.3  2005/03/04 03:59:11  fwarmerdam
+ * Added header.
+ *
+ */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+/*
+ *  Revised 12 Jul 1995   NDR -- changed South Oriented to a code 
+ *  Revised 28 Sep 1995   NDR -- Added Rev. 1.0 aliases. 
+ */
+
+ValuePair(CT_TransverseMercator,	1)
+ValuePair(CT_TransvMercator_Modified_Alaska, 2)
+ValuePair(CT_ObliqueMercator,	3)
+ValuePair(CT_ObliqueMercator_Laborde,	4)
+ValuePair(CT_ObliqueMercator_Rosenmund,	5)
+ValuePair(CT_ObliqueMercator_Spherical,	6)   /* not advisable */
+ValuePair(CT_Mercator,	7)
+ValuePair(CT_LambertConfConic_2SP,	8)
+ValuePair(CT_LambertConfConic,CT_LambertConfConic_2SP)         /* Alias */
+ValuePair(CT_LambertConfConic_1SP,	9)
+ValuePair(CT_LambertConfConic_Helmert,CT_LambertConfConic_1SP) /* alias */
+ValuePair(CT_LambertAzimEqualArea,	10)
+ValuePair(CT_AlbersEqualArea,	11)
+ValuePair(CT_AzimuthalEquidistant,	12)
+ValuePair(CT_EquidistantConic,	13)
+ValuePair(CT_Stereographic,	14)
+ValuePair(CT_PolarStereographic,	15)
+ValuePair(CT_ObliqueStereographic,	16)   /* not advisable */
+ValuePair(CT_Equirectangular,	17)
+ValuePair(CT_CassiniSoldner,	18)
+ValuePair(CT_Gnomonic,	19)
+ValuePair(CT_MillerCylindrical,	20)
+ValuePair(CT_Orthographic,	21)
+ValuePair(CT_Polyconic,	22)
+ValuePair(CT_Robinson,	23)
+ValuePair(CT_Sinusoidal,	24)
+ValuePair(CT_VanDerGrinten,	25)
+ValuePair(CT_NewZealandMapGrid,	26)
+/* Added for 1.0 */
+ValuePair(CT_TransvMercator_SouthOrientated, 27)
+
+/* Added Feb 2005 */
+ValuePair(CT_CylindricalEqualArea, 28)
+
+
+/* Aliases */
+
+ValuePair(CT_SouthOrientedGaussConformal,CT_TransvMercator_SouthOrientated)
+ValuePair(CT_AlaskaConformal,	CT_TransvMercator_Modified_Alaska)
+ValuePair(CT_TransvEquidistCylindrical,	CT_CassiniSoldner)
+ValuePair(CT_ObliqueMercator_Hotine,	CT_ObliqueMercator)
+ValuePair(CT_SwissObliqueCylindrical,	CT_ObliqueMercator_Rosenmund)
+ValuePair(CT_GaussBoaga,	CT_TransverseMercator)
+ValuePair(CT_GaussKruger,	CT_TransverseMercator)
+ValuePair(CT_TransvMercator_SouthOriented, CT_TransvMercator_SouthOrientated)
+
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_extra.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_extra.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_extra.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,747 @@
+/******************************************************************************
+ * $Id: geo_extra.c,v 1.4 2002/12/01 23:44:34 warmerda Exp $
+ *
+ * Project:  libgeotiff
+ * Purpose:  Code to normalize a few common PCS values without use of CSV
+ *           files.
+ * 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: geo_extra.c,v $
+ * Revision 1.4  2002/12/01 23:44:34  warmerda
+ * Fixed typo in last fix.
+ *
+ * Revision 1.3  2002/12/01 23:42:06  warmerda
+ * added overrides for two deprecated stateplane zones
+ *
+ * Revision 1.2  1999/05/04 03:09:33  warmerda
+ * avoid warnings
+ *
+ * Revision 1.1  1999/04/28 20:01:29  warmerda
+ * new
+ *
+ */
+
+/*
+#include "geotiff.h"
+#include "geo_tiffp.h"
+#include "geo_keyp.h"
+*/
+
+#include "geo_normalize.h"
+#include "geovalues.h"
+
+static int StatePlaneTable[] = 
+{
+    PCS_NAD83_Alabama_East,		Proj_Alabama_CS83_East,
+    PCS_NAD83_Alabama_West,		Proj_Alabama_CS83_West,
+
+    PCS_NAD83_Alaska_zone_1,		Proj_Alaska_CS83_1,
+    PCS_NAD83_Alaska_zone_2,		Proj_Alaska_CS83_2,
+    PCS_NAD83_Alaska_zone_3,		Proj_Alaska_CS83_3,
+    PCS_NAD83_Alaska_zone_4,		Proj_Alaska_CS83_4,
+    PCS_NAD83_Alaska_zone_5,		Proj_Alaska_CS83_5,
+    PCS_NAD83_Alaska_zone_6,		Proj_Alaska_CS83_6,
+    PCS_NAD83_Alaska_zone_7,		Proj_Alaska_CS83_7,
+    PCS_NAD83_Alaska_zone_8,		Proj_Alaska_CS83_8,
+    PCS_NAD83_Alaska_zone_9,		Proj_Alaska_CS83_9,
+    PCS_NAD83_Alaska_zone_10,		Proj_Alaska_CS83_10,
+
+    PCS_NAD83_California_1,		Proj_California_CS83_1,
+    PCS_NAD83_California_2,		Proj_California_CS83_2,
+    PCS_NAD83_California_3,		Proj_California_CS83_3,
+    PCS_NAD83_California_4,		Proj_California_CS83_4,
+    PCS_NAD83_California_5,		Proj_California_CS83_5,
+    PCS_NAD83_California_6,		Proj_California_CS83_6,
+
+    PCS_NAD83_Arizona_East,		Proj_Arizona_CS83_east,
+    PCS_NAD83_Arizona_Central,		Proj_Arizona_CS83_Central,
+    PCS_NAD83_Arizona_West,		Proj_Arizona_CS83_west,
+
+    PCS_NAD83_Arkansas_North,		Proj_Arkansas_CS83_North,
+    PCS_NAD83_Arkansas_South,		Proj_Arkansas_CS83_South,
+
+    PCS_NAD83_Colorado_North,		Proj_Colorado_CS83_North,
+    PCS_NAD83_Colorado_Central,		Proj_Colorado_CS83_Central,
+    PCS_NAD83_Colorado_South,		Proj_Colorado_CS83_South,
+
+    PCS_NAD83_Connecticut,		Proj_Connecticut_CS83,
+
+    PCS_NAD83_Delaware,			Proj_Delaware_CS83,
+
+    PCS_NAD83_Florida_East,		Proj_Florida_CS83_East,
+    PCS_NAD83_Florida_North,		Proj_Florida_CS83_North,
+    PCS_NAD83_Florida_West,		Proj_Florida_CS83_West,
+
+    PCS_NAD83_Hawaii_zone_1,		Proj_Hawaii_CS83_1,
+    PCS_NAD83_Hawaii_zone_2,		Proj_Hawaii_CS83_2,
+    PCS_NAD83_Hawaii_zone_3,		Proj_Hawaii_CS83_3,
+    PCS_NAD83_Hawaii_zone_4,		Proj_Hawaii_CS83_4,
+    PCS_NAD83_Hawaii_zone_5,		Proj_Hawaii_CS83_5,
+
+    PCS_NAD83_Georgia_East,		Proj_Georgia_CS83_East,
+    PCS_NAD83_Georgia_West,		Proj_Georgia_CS83_West,
+
+    PCS_NAD83_Idaho_East,		Proj_Idaho_CS83_East,
+    PCS_NAD83_Idaho_Central,		Proj_Idaho_CS83_Central,
+    PCS_NAD83_Idaho_West,		Proj_Idaho_CS83_West,
+
+    PCS_NAD83_Illinois_East,		Proj_Illinois_CS83_East,
+    PCS_NAD83_Illinois_West,		Proj_Illinois_CS83_West,
+
+    PCS_NAD83_Indiana_East,		Proj_Indiana_CS83_East,
+    PCS_NAD83_Indiana_West,		Proj_Indiana_CS83_West,
+
+    PCS_NAD83_Iowa_North,      		Proj_Iowa_CS83_North,
+    PCS_NAD83_Iowa_South,      		Proj_Iowa_CS83_South,
+
+    PCS_NAD83_Kansas_North,		Proj_Kansas_CS83_North,
+    PCS_NAD83_Kansas_South,		Proj_Kansas_CS83_South,
+
+    PCS_NAD83_Kentucky_North,		Proj_Kentucky_CS83_North,
+    PCS_NAD83_Kentucky_South,		Proj_Kentucky_CS83_South,
+
+    PCS_NAD83_Louisiana_North,		Proj_Louisiana_CS83_North,
+    PCS_NAD83_Louisiana_South,		Proj_Louisiana_CS83_South,
+
+    PCS_NAD83_Maine_East,		Proj_Maine_CS83_East,
+    PCS_NAD83_Maine_West,		Proj_Maine_CS83_West,
+
+    PCS_NAD83_Maryland,			Proj_Maryland_CS83,
+
+    PCS_NAD83_Massachusetts,		Proj_Massachusetts_CS83_Mainland,
+    PCS_NAD83_Massachusetts_Is,		Proj_Massachusetts_CS83_Island,
+
+    PCS_NAD83_Michigan_North,		Proj_Michigan_CS83_North,
+    PCS_NAD83_Michigan_Central,		Proj_Michigan_CS83_Central,
+    PCS_NAD83_Michigan_South,		Proj_Michigan_CS83_South,
+
+    PCS_NAD83_Minnesota_North,		Proj_Minnesota_CS83_North,
+    PCS_NAD83_Minnesota_Cent,		Proj_Minnesota_CS83_Central,
+    PCS_NAD83_Minnesota_South,		Proj_Minnesota_CS83_South,
+
+    PCS_NAD83_Mississippi_East,		Proj_Mississippi_CS83_East,
+    PCS_NAD83_Mississippi_West,		Proj_Mississippi_CS83_West,
+
+    PCS_NAD83_Missouri_East,		Proj_Missouri_CS83_East,
+    PCS_NAD83_Missouri_Central,		Proj_Missouri_CS83_Central,
+    PCS_NAD83_Missouri_West,		Proj_Missouri_CS83_West,
+
+    PCS_NAD83_Montana,			Proj_Montana_CS83,
+
+    PCS_NAD83_Nebraska,			Proj_Nebraska_CS83,
+
+    PCS_NAD83_Nevada_East,		Proj_Nevada_CS83_East,
+    PCS_NAD83_Nevada_Central,		Proj_Nevada_CS83_Central,
+    PCS_NAD83_Nevada_West,		Proj_Nevada_CS83_West,
+
+    PCS_NAD83_New_Hampshire,		Proj_New_Hampshire_CS83,
+
+    PCS_NAD83_New_Jersey,		Proj_New_Jersey_CS83,
+
+    PCS_NAD83_New_Mexico_East,		Proj_New_Mexico_CS83_East,
+    PCS_NAD83_New_Mexico_Cent,		Proj_New_Mexico_CS83_Central,
+    PCS_NAD83_New_Mexico_West,		Proj_New_Mexico_CS83_West,
+
+    PCS_NAD83_New_York_East,		Proj_New_York_CS83_East,
+    PCS_NAD83_New_York_Central,		Proj_New_York_CS83_Central,
+    PCS_NAD83_New_York_West,		Proj_New_York_CS83_West,
+    PCS_NAD83_New_York_Long_Is,		Proj_New_York_CS83_Long_Island,
+
+    PCS_NAD83_North_Carolina,	       	Proj_North_Carolina_CS83,
+
+    PCS_NAD83_North_Dakota_N,		Proj_North_Dakota_CS83_North,
+    PCS_NAD83_North_Dakota_S,		Proj_North_Dakota_CS83_South,
+
+    PCS_NAD83_Ohio_North,		Proj_Ohio_CS83_North,
+    PCS_NAD83_Ohio_South,		Proj_Ohio_CS83_South,
+
+    PCS_NAD83_Oklahoma_North,		Proj_Oklahoma_CS83_North,
+    PCS_NAD83_Oklahoma_South,		Proj_Oklahoma_CS83_South,
+
+    PCS_NAD83_Oregon_North,		Proj_Oregon_CS83_North,
+    PCS_NAD83_Oregon_South,		Proj_Oregon_CS83_South,
+
+    PCS_NAD83_Pennsylvania_N,		Proj_Pennsylvania_CS83_North,
+    PCS_NAD83_Pennsylvania_S,		Proj_Pennsylvania_CS83_South,
+
+    PCS_NAD83_Rhode_Island,		Proj_Rhode_Island_CS83,
+
+    PCS_NAD83_South_Carolina,		Proj_South_Carolina_CS83,
+
+    PCS_NAD83_South_Dakota_N,		Proj_South_Dakota_CS83_North,
+    PCS_NAD83_South_Dakota_S,		Proj_South_Dakota_CS83_South,
+
+    PCS_NAD83_Tennessee,		Proj_Tennessee_CS83,
+
+    PCS_NAD83_Texas_North,		Proj_Texas_CS83_North,
+    PCS_NAD83_Texas_North_Cen,		Proj_Texas_CS83_North_Central,
+    PCS_NAD83_Texas_Central,		Proj_Texas_CS83_Central,
+    PCS_NAD83_Texas_South_Cen,		Proj_Texas_CS83_South_Central,
+    PCS_NAD83_Texas_South,		Proj_Texas_CS83_South,
+
+    PCS_NAD83_Utah_North,		Proj_Utah_CS83_North,
+    PCS_NAD83_Utah_Central,		Proj_Utah_CS83_Central,
+    PCS_NAD83_Utah_South,		Proj_Utah_CS83_South,
+
+    PCS_NAD83_Vermont,			Proj_Vermont_CS83,
+
+    PCS_NAD83_Virginia_North,		Proj_Virginia_CS83_North,
+    PCS_NAD83_Virginia_South,		Proj_Virginia_CS83_South,
+
+    PCS_NAD83_Washington_North,		Proj_Washington_CS83_North,
+    PCS_NAD83_Washington_South,		Proj_Washington_CS83_South,
+
+    PCS_NAD83_West_Virginia_N,		Proj_West_Virginia_CS83_North,
+    PCS_NAD83_West_Virginia_S,		Proj_West_Virginia_CS83_South,
+
+    PCS_NAD83_Wisconsin_North,		Proj_Wisconsin_CS83_North,
+    PCS_NAD83_Wisconsin_Cen,		Proj_Wisconsin_CS83_Central,
+    PCS_NAD83_Wisconsin_South,		Proj_Wisconsin_CS83_South,
+
+    PCS_NAD83_Wyoming_East,		Proj_Wyoming_CS83_East,
+    PCS_NAD83_Wyoming_E_Cen,		Proj_Wyoming_CS83_East_Central,
+    PCS_NAD83_Wyoming_W_Cen,		Proj_Wyoming_CS83_West_Central,
+    PCS_NAD83_Wyoming_West,		Proj_Wyoming_CS83_West,
+    
+    PCS_NAD83_Puerto_Rico_Virgin_Is,	Proj_Puerto_Rico_Virgin_Is,
+
+    PCS_NAD27_Alabama_East,		Proj_Alabama_CS27_East,
+    PCS_NAD27_Alabama_West,		Proj_Alabama_CS27_West,
+
+    PCS_NAD27_Alaska_zone_1,		Proj_Alaska_CS27_1,
+    PCS_NAD27_Alaska_zone_2,		Proj_Alaska_CS27_2,
+    PCS_NAD27_Alaska_zone_3,		Proj_Alaska_CS27_3,
+    PCS_NAD27_Alaska_zone_4,		Proj_Alaska_CS27_4,
+    PCS_NAD27_Alaska_zone_5,		Proj_Alaska_CS27_5,
+    PCS_NAD27_Alaska_zone_6,		Proj_Alaska_CS27_6,
+    PCS_NAD27_Alaska_zone_7,		Proj_Alaska_CS27_7,
+    PCS_NAD27_Alaska_zone_8,		Proj_Alaska_CS27_8,
+    PCS_NAD27_Alaska_zone_9,		Proj_Alaska_CS27_9,
+    PCS_NAD27_Alaska_zone_10,		Proj_Alaska_CS27_10,
+
+    PCS_NAD27_California_I,		Proj_California_CS27_I,
+    PCS_NAD27_California_II,		Proj_California_CS27_II,
+    PCS_NAD27_California_III,		Proj_California_CS27_III,
+    PCS_NAD27_California_IV,		Proj_California_CS27_IV,
+    PCS_NAD27_California_V,		Proj_California_CS27_V,
+    PCS_NAD27_California_VI,		Proj_California_CS27_VI,
+    PCS_NAD27_California_VII,		Proj_California_CS27_VII,
+
+    PCS_NAD27_Arizona_East,		Proj_Arizona_Coordinate_System_east,
+    PCS_NAD27_Arizona_Central,		Proj_Arizona_Coordinate_System_Central,
+    PCS_NAD27_Arizona_West,		Proj_Arizona_Coordinate_System_west,
+
+    PCS_NAD27_Arkansas_North,		Proj_Arkansas_CS27_North,
+    PCS_NAD27_Arkansas_South,		Proj_Arkansas_CS27_South,
+
+    PCS_NAD27_Colorado_North,		Proj_Colorado_CS27_North,
+    PCS_NAD27_Colorado_Central,		Proj_Colorado_CS27_Central,
+    PCS_NAD27_Colorado_South,		Proj_Colorado_CS27_South,
+
+    PCS_NAD27_Connecticut,		Proj_Connecticut_CS27,
+
+    PCS_NAD27_Delaware,			Proj_Delaware_CS27,
+
+    PCS_NAD27_Florida_East,		Proj_Florida_CS27_East,
+    PCS_NAD27_Florida_North,		Proj_Florida_CS27_North,
+    PCS_NAD27_Florida_West,		Proj_Florida_CS27_West,
+
+    PCS_NAD27_Hawaii_zone_1,		Proj_Hawaii_CS27_1,
+    PCS_NAD27_Hawaii_zone_2,		Proj_Hawaii_CS27_2,
+    PCS_NAD27_Hawaii_zone_3,		Proj_Hawaii_CS27_3,
+    PCS_NAD27_Hawaii_zone_4,		Proj_Hawaii_CS27_4,
+    PCS_NAD27_Hawaii_zone_5,		Proj_Hawaii_CS27_5,
+
+    PCS_NAD27_Georgia_East,		Proj_Georgia_CS27_East,
+    PCS_NAD27_Georgia_West,		Proj_Georgia_CS27_West,
+
+    PCS_NAD27_Idaho_East,		Proj_Idaho_CS27_East,
+    PCS_NAD27_Idaho_Central,		Proj_Idaho_CS27_Central,
+    PCS_NAD27_Idaho_West,		Proj_Idaho_CS27_West,
+
+    PCS_NAD27_Illinois_East,		Proj_Illinois_CS27_East,
+    PCS_NAD27_Illinois_West,		Proj_Illinois_CS27_West,
+
+    PCS_NAD27_Indiana_East,		Proj_Indiana_CS27_East,
+    PCS_NAD27_Indiana_West,		Proj_Indiana_CS27_West,
+
+    PCS_NAD27_Iowa_North,      		Proj_Iowa_CS27_North,
+    PCS_NAD27_Iowa_South,      		Proj_Iowa_CS27_South,
+
+    PCS_NAD27_Kansas_North,		Proj_Kansas_CS27_North,
+    PCS_NAD27_Kansas_South,		Proj_Kansas_CS27_South,
+
+    PCS_NAD27_Kentucky_North,		Proj_Kentucky_CS27_North,
+    PCS_NAD27_Kentucky_South,		Proj_Kentucky_CS27_South,
+
+    PCS_NAD27_Louisiana_North,		Proj_Louisiana_CS27_North,
+    PCS_NAD27_Louisiana_South,		Proj_Louisiana_CS27_South,
+
+    PCS_NAD27_Maine_East,		Proj_Maine_CS27_East,
+    PCS_NAD27_Maine_West,		Proj_Maine_CS27_West,
+
+    PCS_NAD27_Maryland,			Proj_Maryland_CS27,
+
+    PCS_NAD27_Massachusetts,		Proj_Massachusetts_CS27_Mainland,
+    PCS_NAD27_Massachusetts_Is,		Proj_Massachusetts_CS27_Island,
+
+    PCS_NAD27_Michigan_North,		Proj_Michigan_CS27_North,
+    PCS_NAD27_Michigan_Central,		Proj_Michigan_CS27_Central,
+    PCS_NAD27_Michigan_South,		Proj_Michigan_CS27_South,
+
+    PCS_NAD27_Minnesota_North,		Proj_Minnesota_CS27_North,
+    PCS_NAD27_Minnesota_Cent,		Proj_Minnesota_CS27_Central,
+    PCS_NAD27_Minnesota_South,		Proj_Minnesota_CS27_South,
+
+    PCS_NAD27_Mississippi_East,		Proj_Mississippi_CS27_East,
+    PCS_NAD27_Mississippi_West,		Proj_Mississippi_CS27_West,
+
+    PCS_NAD27_Missouri_East,		Proj_Missouri_CS27_East,
+    PCS_NAD27_Missouri_Central,		Proj_Missouri_CS27_Central,
+    PCS_NAD27_Missouri_West,		Proj_Missouri_CS27_West,
+
+    PCS_NAD27_Montana_North,		Proj_Montana_CS27_North,
+    PCS_NAD27_Montana_Central,		Proj_Montana_CS27_Central,
+    PCS_NAD27_Montana_South,		Proj_Montana_CS27_South,
+
+    PCS_NAD27_Nebraska_North,		Proj_Nebraska_CS27_North,
+    PCS_NAD27_Nebraska_South,		Proj_Nebraska_CS27_South,
+
+    PCS_NAD27_Nevada_East,		Proj_Nevada_CS27_East,
+    PCS_NAD27_Nevada_Central,		Proj_Nevada_CS27_Central,
+    PCS_NAD27_Nevada_West,		Proj_Nevada_CS27_West,
+
+    PCS_NAD27_New_Hampshire,		Proj_New_Hampshire_CS27,
+
+    PCS_NAD27_New_Jersey,		Proj_New_Jersey_CS27,
+
+    PCS_NAD27_New_Mexico_East,		Proj_New_Mexico_CS27_East,
+    PCS_NAD27_New_Mexico_Cent,		Proj_New_Mexico_CS27_Central,
+    PCS_NAD27_New_Mexico_West,		Proj_New_Mexico_CS27_West,
+
+    PCS_NAD27_New_York_East,		Proj_New_York_CS27_East,
+    PCS_NAD27_New_York_Central,		Proj_New_York_CS27_Central,
+    PCS_NAD27_New_York_West,		Proj_New_York_CS27_West,
+    PCS_NAD27_New_York_Long_Is,		Proj_New_York_CS27_Long_Island,
+
+    PCS_NAD27_North_Carolina,	       	Proj_North_Carolina_CS27,
+
+    PCS_NAD27_North_Dakota_N,		Proj_North_Dakota_CS27_North,
+    PCS_NAD27_North_Dakota_S,		Proj_North_Dakota_CS27_South,
+
+    PCS_NAD27_Ohio_North,		Proj_Ohio_CS27_North,
+    PCS_NAD27_Ohio_South,		Proj_Ohio_CS27_South,
+
+    PCS_NAD27_Oklahoma_North,		Proj_Oklahoma_CS27_North,
+    PCS_NAD27_Oklahoma_South,		Proj_Oklahoma_CS27_South,
+
+    PCS_NAD27_Oregon_North,		Proj_Oregon_CS27_North,
+    PCS_NAD27_Oregon_South,		Proj_Oregon_CS27_South,
+
+    PCS_NAD27_Pennsylvania_N,		Proj_Pennsylvania_CS27_North,
+    PCS_NAD27_Pennsylvania_S,		Proj_Pennsylvania_CS27_South,
+
+    PCS_NAD27_Rhode_Island,		Proj_Rhode_Island_CS27,
+
+    PCS_NAD27_South_Carolina_N,		Proj_South_Carolina_CS27_North,
+    PCS_NAD27_South_Carolina_S,		Proj_South_Carolina_CS27_South,
+
+    PCS_NAD27_South_Dakota_N,		Proj_South_Dakota_CS27_North,
+    PCS_NAD27_South_Dakota_S,		Proj_South_Dakota_CS27_South,
+
+    PCS_NAD27_Tennessee,		Proj_Tennessee_CS27,
+
+    PCS_NAD27_Texas_North,		Proj_Texas_CS27_North,
+    PCS_NAD27_Texas_North_Cen,		Proj_Texas_CS27_North_Central,
+    PCS_NAD27_Texas_Central,		Proj_Texas_CS27_Central,
+    PCS_NAD27_Texas_South_Cen,		Proj_Texas_CS27_South_Central,
+    PCS_NAD27_Texas_South,		Proj_Texas_CS27_South,
+
+    PCS_NAD27_Utah_North,		Proj_Utah_CS27_North,
+    PCS_NAD27_Utah_Central,		Proj_Utah_CS27_Central,
+    PCS_NAD27_Utah_South,		Proj_Utah_CS27_South,
+
+    PCS_NAD27_Vermont,			Proj_Vermont_CS27,
+
+    PCS_NAD27_Virginia_North,		Proj_Virginia_CS27_North,
+    PCS_NAD27_Virginia_South,		Proj_Virginia_CS27_South,
+
+    PCS_NAD27_Washington_North,		Proj_Washington_CS27_North,
+    PCS_NAD27_Washington_South,		Proj_Washington_CS27_South,
+
+    PCS_NAD27_West_Virginia_N,		Proj_West_Virginia_CS27_North,
+    PCS_NAD27_West_Virginia_S,		Proj_West_Virginia_CS27_South,
+
+    PCS_NAD27_Wisconsin_North,		Proj_Wisconsin_CS27_North,
+    PCS_NAD27_Wisconsin_Cen,		Proj_Wisconsin_CS27_Central,
+    PCS_NAD27_Wisconsin_South,		Proj_Wisconsin_CS27_South,
+
+    PCS_NAD27_Wyoming_East,		Proj_Wyoming_CS27_East,
+    PCS_NAD27_Wyoming_E_Cen,		Proj_Wyoming_CS27_East_Central,
+    PCS_NAD27_Wyoming_W_Cen,		Proj_Wyoming_CS27_West_Central,
+    PCS_NAD27_Wyoming_West,		Proj_Wyoming_CS27_West,
+    
+    PCS_NAD27_Puerto_Rico,		Proj_Puerto_Rico_CS27,
+
+    KvUserDefined
+};
+
+/************************************************************************/
+/*                          GTIFMapSysToPCS()                           */
+/*                                                                      */
+/*      Given a Datum, MapSys and zone value generate the best PCS      */
+/*      code possible.                                                  */
+/************************************************************************/
+
+int	GTIFMapSysToPCS( int MapSys, int Datum, int nZone )
+
+{
+    int		PCSCode = KvUserDefined;
+
+    if( MapSys == MapSys_UTM_North )
+    {
+	if( Datum == GCS_NAD27 )
+	    PCSCode = PCS_NAD27_UTM_zone_3N + nZone - 3;
+	else if( Datum == GCS_NAD83 )
+	    PCSCode = PCS_NAD83_UTM_zone_3N + nZone - 3;
+	else if( Datum == GCS_WGS_72 )
+	    PCSCode = PCS_WGS72_UTM_zone_1N + nZone - 1;
+	else if( Datum == GCS_WGS_72BE )
+	    PCSCode = PCS_WGS72BE_UTM_zone_1N + nZone - 1;
+	else if( Datum == GCS_WGS_84 )
+	    PCSCode = PCS_WGS84_UTM_zone_1N + nZone - 1;
+    }
+    else if( MapSys == MapSys_UTM_South )
+    {
+	if( Datum == GCS_WGS_72 )
+	    PCSCode = PCS_WGS72_UTM_zone_1S + nZone - 1;
+	else if( Datum == GCS_WGS_72BE )
+	    PCSCode = PCS_WGS72BE_UTM_zone_1S + nZone - 1;
+	else if( Datum == GCS_WGS_84 )
+	    PCSCode = PCS_WGS84_UTM_zone_1S + nZone - 1;
+    }
+    else if( MapSys == MapSys_State_Plane_27 )
+    {
+	int		i;
+
+        PCSCode = 10000 + nZone;
+	for( i = 0; StatePlaneTable[i] != KvUserDefined; i += 2 )
+	{
+	    if( StatePlaneTable[i+1] == PCSCode )
+	        PCSCode = StatePlaneTable[i];
+	}
+
+        /* Old EPSG code was in error for Tennesse CS27, override */
+        if( nZone == 4100 )
+            PCSCode = 2204;
+    }
+    else if( MapSys == MapSys_State_Plane_83 )
+    {
+	int		i;
+
+        PCSCode = 10000 + nZone + 30;
+
+	for( i = 0; StatePlaneTable[i] != KvUserDefined; i += 2 )
+	{
+	    if( StatePlaneTable[i+1] == PCSCode )
+	        PCSCode = StatePlaneTable[i];
+	}
+
+        /* Old EPSG code was in error for Kentucky North CS83, override */
+        if( nZone == 1601 )
+            PCSCode = 2205;
+    }
+
+    return( PCSCode );
+}
+
+/************************************************************************/
+/*                          GTIFMapSysToProj()                          */
+/*                                                                      */
+/*      Given a MapSys and zone value generate the best Proj_           */
+/*      code possible.                                                  */
+/************************************************************************/
+
+int	GTIFMapSysToProj( int MapSys, int nZone )
+
+{
+    int		ProjCode = KvUserDefined;
+
+    if( MapSys == MapSys_UTM_North )
+    {
+        ProjCode = Proj_UTM_zone_1N + nZone - 1;
+    }
+    else if( MapSys == MapSys_UTM_South )
+    {
+        ProjCode = Proj_UTM_zone_1S + nZone - 1;
+    }
+    else if( MapSys == MapSys_State_Plane_27 )
+    {
+        ProjCode = 10000 + nZone;
+
+        /* Tennesse override */
+        if( nZone == 4100 )
+            ProjCode = 15302;
+    }
+    else if( MapSys == MapSys_State_Plane_83 )
+    {
+        ProjCode = 10000 + nZone + 30;
+
+        /* Kentucky North override */
+        if( nZone == 1601 )
+            ProjCode = 15303;
+    }
+
+    return( ProjCode );
+}
+
+/************************************************************************/
+/*                          GTIFPCSToMapSys()                           */
+/************************************************************************/
+
+/**
+ * Translate a PCS_ code into a UTM or State Plane map system, a datum,
+ * and a zone if possible.
+ *
+ * @param PCSCode The projection code (PCS_*) as would be stored in the
+ * ProjectedCSTypeGeoKey of a GeoTIFF file.
+ *
+ * @param pDatum Pointer to an integer into which the datum code (GCS_*)
+ * is put if the function succeeds.
+ *
+ * @param pZone Pointer to an integer into which the zone will be placed
+ * if the function is successful.
+ *
+ * @return Returns either MapSys_UTM_North, MapSys_UTM_South,
+ * MapSys_State_Plane_83, MapSys_State_Plane_27 or KvUserDefined.
+ * KvUserDefined indicates that the
+ * function failed to recognise the projection as UTM or State Plane.
+ *
+ * The zone value is only set if the return code is other than KvUserDefined.
+ * For utm map system the returned zone will be between 1 and 60.  For
+ * State Plane, the USGS state plane zone number is returned.  For instance,
+ * Alabama East is zone 101.
+ *
+ * The datum (really this is the GCS) is set to a GCS_ value such as GCS_NAD27.
+ *
+ * This function is useful to recognise (most) UTM and State Plane coordinate
+ * systems, even if CSV files aren't available to translate them automatically.
+ * It is used as a fallback mechanism by GTIFGetDefn() for normalization when
+ * CSV files aren't found. 
+ */
+
+int GTIFPCSToMapSys( int PCSCode, int * pDatum, int * pZone )
+
+{
+    int		Datum = KvUserDefined, Proj = KvUserDefined;
+    int		nZone = KvUserDefined, i;
+
+/* -------------------------------------------------------------------- */
+/*      UTM with various datums.  Note there are lots of PCS UTM        */
+/*      codes not done yet which use strange datums.                    */
+/* -------------------------------------------------------------------- */
+    if( PCSCode >= PCS_NAD27_UTM_zone_3N && PCSCode <= PCS_NAD27_UTM_zone_22N )
+    {
+	Datum = GCS_NAD27;
+	Proj = MapSys_UTM_North;
+	nZone = PCSCode - PCS_NAD27_UTM_zone_3N + 3;
+    }
+    else if( PCSCode >= PCS_NAD83_UTM_zone_3N 
+	     && PCSCode <= PCS_NAD83_UTM_zone_23N )
+    {
+	Datum = GCS_NAD83;
+	Proj = MapSys_UTM_North;
+	nZone = PCSCode - PCS_NAD83_UTM_zone_3N + 3;
+    }
+
+    else if( PCSCode >= PCS_WGS72_UTM_zone_1N
+	     && PCSCode <= PCS_WGS72_UTM_zone_60N )
+    {
+	Datum = GCS_WGS_72;
+	Proj = MapSys_UTM_North;
+	nZone = PCSCode - PCS_WGS72_UTM_zone_1N + 1;
+    }
+    else if( PCSCode >= PCS_WGS72_UTM_zone_1S
+	     && PCSCode <= PCS_WGS72_UTM_zone_60S )
+    {
+	Datum = GCS_WGS_72;
+	Proj = MapSys_UTM_South;
+	nZone = PCSCode - PCS_WGS72_UTM_zone_1S + 1;
+    }
+
+    else if( PCSCode >= PCS_WGS72BE_UTM_zone_1N
+	     && PCSCode <= PCS_WGS72BE_UTM_zone_60N )
+    {
+	Datum = GCS_WGS_72BE;
+	Proj = MapSys_UTM_North;
+	nZone = PCSCode - PCS_WGS72BE_UTM_zone_1N + 1;
+    }
+    else if( PCSCode >= PCS_WGS72BE_UTM_zone_1S
+	     && PCSCode <= PCS_WGS72BE_UTM_zone_60S )
+    {
+	Datum = GCS_WGS_72BE;
+	Proj = MapSys_UTM_South;
+	nZone = PCSCode - PCS_WGS72BE_UTM_zone_1S + 1;
+    }
+
+    else if( PCSCode >= PCS_WGS84_UTM_zone_1N
+	     && PCSCode <= PCS_WGS84_UTM_zone_60N )
+    {
+	Datum = GCS_WGS_84;
+	Proj = MapSys_UTM_North;
+	nZone = PCSCode - PCS_WGS84_UTM_zone_1N + 1;
+    }
+    else if( PCSCode >= PCS_WGS84_UTM_zone_1S
+	     && PCSCode <= PCS_WGS84_UTM_zone_60S )
+    {
+	Datum = GCS_WGS_84;
+	Proj = MapSys_UTM_South;
+	nZone = PCSCode - PCS_WGS84_UTM_zone_1S + 1;
+    }
+    else if( PCSCode >= PCS_SAD69_UTM_zone_18N 
+	     && PCSCode <= PCS_SAD69_UTM_zone_22N )
+    {
+	Datum = KvUserDefined;
+	Proj = MapSys_UTM_North;
+	nZone = PCSCode - PCS_SAD69_UTM_zone_18N + 18;
+    }
+    else if( PCSCode >= PCS_SAD69_UTM_zone_17S
+	     && PCSCode <= PCS_SAD69_UTM_zone_25S )
+    {
+	Datum = KvUserDefined;
+	Proj = MapSys_UTM_South;
+	nZone = PCSCode - PCS_SAD69_UTM_zone_17S + 17;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      State Plane zones, first we translate any PCS_ codes to		*/
+/*	a Proj_ code that we can get a handle on.			*/
+/* -------------------------------------------------------------------- */
+    for( i = 0; StatePlaneTable[i] != KvUserDefined; i += 2 )
+    {
+	if( StatePlaneTable[i] == PCSCode )
+	    PCSCode = StatePlaneTable[i+1];
+    }
+
+    if( PCSCode <= 15900 && PCSCode >= 10000 )
+    {
+	if( (PCSCode % 100) >= 30 )
+        {
+            Proj = MapSys_State_Plane_83;
+	    Datum = GCS_NAD83;
+        }
+	else
+        {
+            Proj = MapSys_State_Plane_27;
+	    Datum = GCS_NAD27;
+        }
+	
+	nZone = PCSCode - 10000;
+	if( Datum == GCS_NAD83 )
+	    nZone -= 30;
+    }
+
+    if( pDatum != NULL )
+        *pDatum = Datum;
+
+    if( pZone != NULL )
+        *pZone = nZone;
+
+    return( Proj );
+}
+
+/************************************************************************/
+/*                          GTIFProjToMapSys()                          */
+/************************************************************************/
+
+/**
+ * Translate a Proj_ code into a UTM or State Plane map system, and a zone
+ * if possible.
+ *
+ * @param ProjCode The projection code (Proj_*) as would be stored in the
+ * ProjectionGeoKey of a GeoTIFF file.
+ * @param pZone Pointer to an integer into which the zone will be placed
+ * if the function is successful.
+ *
+ * @return Returns either MapSys_UTM_North, MapSys_UTM_South,
+ * MapSys_State_Plane_27, MapSys_State_Plane_83 or KvUserDefined.
+ * KvUserDefined indicates that the
+ * function failed to recognise the projection as UTM or State Plane.
+ *
+ * The zone value is only set if the return code is other than KvUserDefined.
+ * For utm map system the returned zone will be between 1 and 60.  For
+ * State Plane, the USGS state plane zone number is returned.  For instance,
+ * Alabama East is zone 101.
+ *
+ * This function is useful to recognise UTM and State Plane coordinate
+ * systems, and to extract zone numbers so the projections can be
+ * represented as UTM rather than as the underlying projection method such
+ * Transverse Mercator for instance.
+ */
+
+int GTIFProjToMapSys( int ProjCode, int * pZone )
+
+{
+    int		nZone = KvUserDefined;
+    int		MapSys = KvUserDefined;
+
+/* -------------------------------------------------------------------- */
+/*      Handle UTM.                                                     */
+/* -------------------------------------------------------------------- */
+    if( ProjCode >= Proj_UTM_zone_1N && ProjCode <= Proj_UTM_zone_60N )
+    {
+	MapSys = MapSys_UTM_North;
+	nZone = ProjCode - Proj_UTM_zone_1N + 1;
+    }
+    else if( ProjCode >= Proj_UTM_zone_1S && ProjCode <= Proj_UTM_zone_60S )
+    {
+	MapSys = MapSys_UTM_South;
+	nZone = ProjCode - Proj_UTM_zone_1S + 1;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Handle State Plane.  I think there are some anomolies in        */
+/*      here, so this is a bit risky.                                   */
+/* -------------------------------------------------------------------- */
+    else if( ProjCode >= 10101 && ProjCode <= 15299 )
+    {
+        if( ProjCode % 100 >= 30 )
+        {
+            MapSys = MapSys_State_Plane_83;
+            nZone = ProjCode - 10000 - 30;
+        }
+        else
+        {
+            MapSys = MapSys_State_Plane_27;
+            nZone = ProjCode - 10000;
+        }
+    }
+    
+    if( pZone != NULL )
+        *pZone = nZone;
+
+    return( MapSys );
+}
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_free.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_free.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_free.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,62 @@
+/**********************************************************************
+ *
+ *  geo_free.c  -- Public routines for GEOTIFF GeoKey access.
+ *
+ *    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.
+ *
+ **********************************************************************/
+
+#include "geotiff.h"   /* public interface        */
+#include "geo_tiffp.h" /* external TIFF interface */
+#include "geo_keyp.h"  /* private interface       */
+
+
+/**********************************************************************
+ *
+ *                        Public Routines
+ *
+ **********************************************************************/
+
+/**
+  
+This function deallocates an existing GeoTIFF access handle previously
+created with GTIFNew().  If the handle was
+used to write GeoTIFF keys to the TIFF file, the 
+GTIFWriteKeys() function should be used
+to flush results to the file before calling GTIFFree().  GTIFFree()
+should be called before XTIFFClose() is
+called on the corresponding TIFF file handle.<p>
+
+*/
+
+void GTIFFree(GTIF* gtif)
+{
+    int     i;
+	
+    if (!gtif) return;
+	
+    /* Free parameter arrays */
+    if (gtif->gt_double) _GTIFFree (gtif->gt_double);
+    if (gtif->gt_short) _GTIFFree (gtif->gt_short);
+	
+    /* Free GeoKey arrays */
+    if (gtif->gt_keys)
+    {
+        for (i = 0; i < MAX_KEYS; i++)
+        {
+            if (gtif->gt_keys[i].gk_type == TYPE_ASCII)
+            {
+                _GTIFFree (gtif->gt_keys[i].gk_data);
+            }
+        }
+        _GTIFFree (gtif->gt_keys);
+    }
+    if (gtif->gt_keyindex) _GTIFFree (gtif->gt_keyindex);
+	
+    _GTIFFree (gtif);
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_get.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_get.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_get.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,176 @@
+/**********************************************************************
+ *
+ *  geo_get.c  -- Public routines for GEOTIFF GeoKey access.
+ *
+ *    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.
+ *
+ *  Revision History;
+ *
+ *    20 June, 1995      Niles D. Ritter         New
+ *    3 July,  1995      Greg Martin             Fix strings and index
+ *    6 July,  1995      Niles D. Ritter         Unfix indexing.
+ *
+ **********************************************************************/
+
+#include "geotiff.h"   /* public interface        */
+#include "geo_tiffp.h" /* external TIFF interface */
+#include "geo_keyp.h"  /* private interface       */
+
+/* return the Header info of this geotiff file */
+
+void GTIFDirectoryInfo(GTIF *gtif, int version[3], int *keycount)
+{
+        if (version)
+        {
+                version[0]  = gtif->gt_version;
+                version[1]  = gtif->gt_rev_major;
+                version[2]  = gtif->gt_rev_minor;
+        }
+        if (keycount) *keycount = gtif->gt_num_keys;
+}
+
+
+int GTIFKeyInfo(GTIF *gtif, geokey_t key, int *size, tagtype_t* type)
+{
+        int index = gtif->gt_keyindex[ key ];
+        GeoKey *keyptr;
+
+        if (!index) return 0;
+
+        keyptr = gtif->gt_keys + index;
+        if (size) *size = (int) keyptr->gk_size;
+        if (type) *type = keyptr->gk_type;
+
+        return keyptr->gk_count;
+}
+
+/** 
+
+This function reads the value of a single GeoKey from a GeoTIFF file.
+
+ at param gtif The geotiff information handle from GTIFNew().
+
+ at param thekey The geokey_t name (such as ProjectedCSTypeGeoKey).
+This must come from the list of legal geokey_t values
+(an enumeration) listed below.
+
+ at param val The <b>val</b> argument is a pointer to the
+variable into which the value should be read.  The type of the variable
+varies depending on the geokey_t given.  While there is no ready mapping
+of geokey_t values onto types, in general code values are of type <i>short</i>,
+citations are strings, and everything else is of type <i>double</i>.  Note
+that pointer's to <i>int</i> should never be passed to GTIFKeyGet() for
+integer values as they will be shorts, and the int's may not be properly
+initialized (and will be grossly wrong on MSB systems).
+
+ at param index Indicates how far into the list of values
+for this geokey to offset. Should normally be zero.
+
+ at param count Indicates how many values
+to read.  At this time all keys except for strings have only one value,
+so <b>index</b> should be zero, and <b>count</b> should be one.
+
+ at return The GTIFKeyGet() function returns the number of values read.  Normally
+this would be one if successful or zero if the key doesn't exist for this
+file.
+
+From geokeys.inc we see the following geokey_t values are possible:<p>
+
+<pre>
+-- 6.2.1 GeoTIFF Configuration Keys --
+
+ValuePair(  GTModelTypeGeoKey,	1024) -- Section 6.3.1.1 Codes       --
+ValuePair(  GTRasterTypeGeoKey,	1025) -- Section 6.3.1.2 Codes       --
+ValuePair(  GTCitationGeoKey,	1026) -- documentation --
+
+-- 6.2.2 Geographic CS Parameter Keys --
+
+ValuePair(  GeographicTypeGeoKey,	2048) -- Section 6.3.2.1 Codes     --
+ValuePair(  GeogCitationGeoKey,	2049) -- documentation             --
+ValuePair(  GeogGeodeticDatumGeoKey,	2050) -- Section 6.3.2.2 Codes     --
+ValuePair(  GeogPrimeMeridianGeoKey,	2051) -- Section 6.3.2.4 codes     --
+ValuePair(  GeogLinearUnitsGeoKey,	2052) -- Section 6.3.1.3 Codes     --
+ValuePair(  GeogLinearUnitSizeGeoKey,	2053) -- meters                    --
+ValuePair(  GeogAngularUnitsGeoKey,	2054) -- Section 6.3.1.4 Codes     --
+ValuePair(  GeogAngularUnitSizeGeoKey,	2055) -- radians                   --
+ValuePair(  GeogEllipsoidGeoKey,	2056) -- Section 6.3.2.3 Codes     --
+ValuePair(  GeogSemiMajorAxisGeoKey,	2057) -- GeogLinearUnits           --
+ValuePair(  GeogSemiMinorAxisGeoKey,	2058) -- GeogLinearUnits           --
+ValuePair(  GeogInvFlatteningGeoKey,	2059) -- ratio                     --
+ValuePair(  GeogAzimuthUnitsGeoKey,	2060) -- Section 6.3.1.4 Codes     --
+ValuePair(  GeogPrimeMeridianLongGeoKey,	2061) -- GeoAngularUnit            --
+
+-- 6.2.3 Projected CS Parameter Keys --
+--    Several keys have been renamed,--
+--    and the deprecated names aliased for backward compatibility --
+
+ValuePair(  ProjectedCSTypeGeoKey,	3072)     -- Section 6.3.3.1 codes   --
+ValuePair(  PCSCitationGeoKey,	3073)     -- documentation           --
+ValuePair(  ProjectionGeoKey,	3074)     -- Section 6.3.3.2 codes   --
+ValuePair(  ProjCoordTransGeoKey,	3075)     -- Section 6.3.3.3 codes   --
+ValuePair(  ProjLinearUnitsGeoKey,	3076)     -- Section 6.3.1.3 codes   --
+ValuePair(  ProjLinearUnitSizeGeoKey,	3077)     -- meters                  --
+ValuePair(  ProjStdParallel1GeoKey,	3078)     -- GeogAngularUnit --
+ValuePair(  ProjStdParallelGeoKey,ProjStdParallel1GeoKey) -- ** alias **   --
+ValuePair(  ProjStdParallel2GeoKey,	3079)     -- GeogAngularUnit --
+ValuePair(  ProjNatOriginLongGeoKey,	3080)     -- GeogAngularUnit --
+ValuePair(  ProjOriginLongGeoKey,ProjNatOriginLongGeoKey) -- ** alias **     --
+ValuePair(  ProjNatOriginLatGeoKey,	3081)     -- GeogAngularUnit --
+ValuePair(  ProjOriginLatGeoKey,ProjNatOriginLatGeoKey)   -- ** alias **     --
+ValuePair(  ProjFalseEastingGeoKey,	3082)     -- ProjLinearUnits --
+ValuePair(  ProjFalseNorthingGeoKey,	3083)     -- ProjLinearUnits --
+ValuePair(  ProjFalseOriginLongGeoKey,	3084)     -- GeogAngularUnit --
+ValuePair(  ProjFalseOriginLatGeoKey,	3085)     -- GeogAngularUnit --
+ValuePair(  ProjFalseOriginEastingGeoKey,	3086)     -- ProjLinearUnits --
+ValuePair(  ProjFalseOriginNorthingGeoKey,	3087)     -- ProjLinearUnits --
+ValuePair(  ProjCenterLongGeoKey,	3088)     -- GeogAngularUnit --
+ValuePair(  ProjCenterLatGeoKey,	3089)     -- GeogAngularUnit --
+ValuePair(  ProjCenterEastingGeoKey,	3090)     -- ProjLinearUnits --
+ValuePair(  ProjCenterNorthingGeoKey,	3091)     -- ProjLinearUnits --
+ValuePair(  ProjScaleAtNatOriginGeoKey,	3092)     -- ratio   --
+ValuePair(  ProjScaleAtOriginGeoKey,ProjScaleAtNatOriginGeoKey)  -- ** alias **   --
+ValuePair(  ProjScaleAtCenterGeoKey,	3093)     -- ratio   --
+ValuePair(  ProjAzimuthAngleGeoKey,	3094)     -- GeogAzimuthUnit --
+ValuePair(  ProjStraightVertPoleLongGeoKey,	3095)     -- GeogAngularUnit --
+
+ 6.2.4 Vertical CS Keys 
+   
+ValuePair(  VerticalCSTypeGeoKey,	4096)  -- Section 6.3.4.1 codes   --
+ValuePair(  VerticalCitationGeoKey,	4097)  -- documentation --
+ValuePair(  VerticalDatumGeoKey,	4098)  -- Section 6.3.4.2 codes   --
+ValuePair(  VerticalUnitsGeoKey,	4099)  -- Section 6.3.1 (.x) codes   --
+</pre>
+*/
+
+int GTIFKeyGet(GTIF *gtif, geokey_t thekey, void *val, int index, int count)
+{
+        int kindex = gtif->gt_keyindex[ thekey ];
+        GeoKey *key;
+        gsize_t size;
+        char *data;
+        tagtype_t type;
+
+        if (!kindex) return 0;
+
+        key = gtif->gt_keys+kindex;
+        if (!count) count = key->gk_count - index;
+        if (count <=0) return 0;
+        if (count > key->gk_count) count = key->gk_count;
+        size = key->gk_size;
+        type = key->gk_type;
+
+        if (count==1 && type==TYPE_SHORT) data = (char *)&key->gk_data;
+        else data = key->gk_data;
+
+        _GTIFmemcpy( val, data + index*size, count*size );
+
+        if (type==TYPE_ASCII)
+           ((char *)val)[count-1] = '\0'; /* replace last char with NULL */
+
+        return count;
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_keyp.h
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_keyp.h	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_keyp.h	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,98 @@
+/**********************************************************************
+ *
+ *  geo_keyp.h - private interface for GeoTIFF geokey tag parsing
+ *
+ *     Written by: Niles D. Ritter
+ *
+ **********************************************************************/
+
+#ifndef __geo_keyp_h_
+#define __geo_keyp_h_
+
+#include <stdlib.h> /* for size_t */
+
+/*
+ * This structure contains the internal program
+ * representation of the key entry.
+ */
+struct GeoKey {
+	int       gk_key;    /* GeoKey ID        */
+	size_t    gk_size;   /* data byte size   */
+	tagtype_t gk_type;   /* TIFF data type   */
+	long      gk_count;  /* number of values */
+	char*     gk_data;   /* pointer to data, or value */
+};
+typedef struct GeoKey GeoKey;
+
+/*
+ *  This structure represents the file-organization of
+ *  the key entry. Note that it assumes that short entries
+ *  are aligned along 2-byte boundaries.
+ */
+struct KeyEntry {
+	pinfo_t ent_key;        /* GeoKey ID            */
+	pinfo_t ent_location;   /* TIFF Tag ID or 0     */
+	pinfo_t ent_count;      /* GeoKey value count   */
+	pinfo_t ent_val_offset; /* value or tag offset  */
+};
+typedef struct KeyEntry KeyEntry;
+
+/*
+ * This is the header of the CoordSystemInfoTag. The 'Version'
+ *  will only change if the CoorSystemInfoTag structure changes;
+ *  The Major Revision will be incremented whenever a new set of
+ *  Keys is added or changed, while the Minor revision will be
+ *  incremented when only the set of Key-values is increased.
+ */
+struct KeyHeader{
+	pinfo_t hdr_version;      /* GeoTIFF Version          */
+	pinfo_t hdr_rev_major;    /* GeoKey Major Revision #  */
+	pinfo_t hdr_rev_minor;    /* GeoKey Minor Revision #  */
+	pinfo_t hdr_num_keys;     /* Number of GeoKeys        */
+};
+typedef struct KeyHeader KeyHeader;
+
+/*
+ * This structure holds temporary data while reading or writing
+ *  the tags.
+ */
+struct TempKeyData {
+    char   *tk_asciiParams;
+    int     tk_asciiParamsLength;
+    int     tk_asciiParamsOffset;
+};
+typedef struct TempKeyData TempKeyData;
+
+
+struct gtiff {
+   tiff_t*    gt_tif;      /* TIFF file descriptor  */
+   TIFFMethod gt_methods;  /* TIFF i/o methods      */
+   int        gt_flags;    /* file flags            */
+   
+   pinfo_t    gt_version;  /* GeoTIFF Version       */
+   pinfo_t    gt_rev_major;/* GeoKey Key Revision   */
+   pinfo_t    gt_rev_minor;/* GeoKey Code Revision  */
+   
+   int        gt_num_keys; /* number of keys        */
+   GeoKey*    gt_keys;     /* array of keys         */
+   int*       gt_keyindex; /* index of a key, if set*/
+   int        gt_keymin;   /* smallest key set      */
+   int        gt_keymax;   /* largest key set       */
+   
+   pinfo_t*   gt_short;    /* array of SHORT vals   */
+   double*    gt_double;   /* array of DOUBLE vals  */
+   int        gt_nshorts;  /* number of SHORT vals  */
+   int        gt_ndoubles; /* number of DOUBLE vals */
+};  
+
+typedef enum {
+	FLAG_FILE_OPEN=1,
+	FLAG_FILE_MODIFIED=2
+} gtiff_flags;
+
+#define MAX_KEYINDEX 65535   /* largest possible key    */
+#define MAX_KEYS 100         /* maximum keys in a file  */
+#define MAX_VALUES 1000      /* maximum values in a tag */
+
+#endif /* __geo_keyp_h_ */
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_names.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_names.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_names.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,175 @@
+/*
+ * geo_names.c
+ *
+ *  This encapsulates all of the value-naming mechanism of 
+ *  libgeotiff. 
+ *
+ *  Written By: Niles Ritter
+ */
+
+#include "geotiffio.h"
+#include "geonames.h"
+#include "geo_tiffp.h" /* for tag names */
+
+static KeyInfo _formatInfo[] =  {
+   {TYPE_BYTE,    "Byte"},
+   {TYPE_SHORT,   "Short"},
+   {TYPE_LONG,    "Long"},
+   {TYPE_RATIONAL,"Rational"},
+   {TYPE_ASCII,   "Ascii"},
+   {TYPE_FLOAT,   "Float"},
+   {TYPE_DOUBLE,  "Double"},
+   {TYPE_SBYTE,   "SignedByte"},
+   {TYPE_SSHORT,  "SignedShort"},
+   {TYPE_SLONG,  "SignedLong"},
+   {TYPE_UNKNOWN, "Unknown"},
+    END_LIST
+};
+
+static KeyInfo _tagInfo[] =  {
+    {GTIFF_PIXELSCALE,  "ModelPixelScaleTag"},
+    {GTIFF_TRANSMATRIX, "ModelTransformationTag"},
+    {GTIFF_TIEPOINTS,   "ModelTiepointTag"},
+     /* This alias maps the Intergraph symbol to the current tag */
+    {GTIFF_TRANSMATRIX, "IntergraphMatrixTag"},
+    END_LIST
+};
+
+static char *FindName(KeyInfo *info,int key)
+{
+   static char errmsg[80];
+   
+   while (info->ki_key>=0 && info->ki_key != key) info++;
+
+   if (info->ki_key<0)
+   {
+	   sprintf(errmsg,"Unknown-%d", key );
+	   return errmsg;
+   }
+   return info->ki_name;
+}
+
+char *GTIFKeyName(geokey_t key)
+{
+   return FindName( &_keyInfo[0],key);
+}
+
+char *GTIFTypeName(tagtype_t type)
+{
+   return FindName( &_formatInfo[0],type);
+}
+
+char *GTIFTagName(int tag)
+{
+   return FindName( &_tagInfo[0],tag);
+}
+
+char *GTIFValueName(geokey_t key, int value)
+{
+   KeyInfo *info;
+   
+   switch (key)
+   {
+	/* All codes using linear/angular/whatever units */
+	case GeogLinearUnitsGeoKey: 
+	case ProjLinearUnitsGeoKey: 
+	case GeogAngularUnitsGeoKey: 
+	case GeogAzimuthUnitsGeoKey: 
+		                      info=_geounitsValue; break;
+
+   	/* put other key-dependent lists here */
+	case GTModelTypeGeoKey:       info=_modeltypeValue; break;
+	case GTRasterTypeGeoKey:      info=_rastertypeValue; break;
+	case GeographicTypeGeoKey:    info=_geographicValue; break;
+	case GeogGeodeticDatumGeoKey: info=_geodeticdatumValue; break;
+	case GeogEllipsoidGeoKey:     info=_ellipsoidValue; break;
+	case GeogPrimeMeridianGeoKey: info=_primemeridianValue; break;
+	case ProjectedCSTypeGeoKey:   info=_pcstypeValue; break;
+	case ProjectionGeoKey:        info=_projectionValue; break;
+	case ProjCoordTransGeoKey:    info=_coordtransValue; break;
+	case VerticalCSTypeGeoKey:    info=_vertcstypeValue; break;
+	case VerticalDatumGeoKey:     info=_vdatumValue; break;
+
+	/* And if all else fails... */
+   	default:                      info = _csdefaultValue;break;
+   }
+   
+   return FindName( info,value);
+}
+
+/* 
+ * Inverse Utilities (name->code) 
+ */
+
+
+static int FindCode(KeyInfo *info,char *key)
+{
+   while (info->ki_key>=0 && strcmp(info->ki_name,key) ) info++;
+
+   if (info->ki_key<0)
+   {
+	/* not a registered key; might be generic code */
+	if (!strncmp(key,"Unknown-",8))
+	{
+		int code=-1;
+		sscanf(key,"Unknown-%d",&code);
+		return code;
+	}
+	else return -1;
+   }
+   return info->ki_key;
+}
+
+int GTIFKeyCode(char *key)
+{
+   return FindCode( &_keyInfo[0],key);
+}
+
+int GTIFTypeCode(char *type)
+{
+   return FindCode( &_formatInfo[0],type);
+}
+
+int GTIFTagCode(char *tag)
+{
+   return FindCode( &_tagInfo[0],tag);
+}
+
+
+/*
+ *  The key must be determined with GTIFKeyCode() before
+ *  the name can be encoded.
+ */
+int GTIFValueCode(geokey_t key, char *name)
+{
+   KeyInfo *info;
+   
+   switch (key)
+   {
+	/* All codes using linear/angular/whatever units */
+	case GeogLinearUnitsGeoKey: 
+	case ProjLinearUnitsGeoKey: 
+	case GeogAngularUnitsGeoKey: 
+	case GeogAzimuthUnitsGeoKey: 
+		                      info=_geounitsValue; break;
+
+   	/* put other key-dependent lists here */
+	case GTModelTypeGeoKey:       info=_modeltypeValue; break;
+	case GTRasterTypeGeoKey:      info=_rastertypeValue; break;
+	case GeographicTypeGeoKey:    info=_geographicValue; break;
+	case GeogGeodeticDatumGeoKey: info=_geodeticdatumValue; break;
+	case GeogEllipsoidGeoKey:     info=_ellipsoidValue; break;
+	case GeogPrimeMeridianGeoKey: info=_primemeridianValue; break;
+	case ProjectedCSTypeGeoKey:   info=_pcstypeValue; break;
+	case ProjectionGeoKey:        info=_projectionValue; break;
+	case ProjCoordTransGeoKey:    info=_coordtransValue; break;
+	case VerticalCSTypeGeoKey:    info=_vertcstypeValue; break;
+	case VerticalDatumGeoKey:     info=_vdatumValue; break;
+
+	/* And if all else fails... */
+   	default:                      info = _csdefaultValue;break;
+   }
+   
+   return FindCode( info,name);
+}
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_new.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_new.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_new.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,255 @@
+/**********************************************************************
+ *
+ *  geo_new.c  -- Public routines for GEOTIFF GeoKey access.
+ *
+ *    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.
+ *
+ *    20 June, 1995      Niles D. Ritter         New
+ *    7 July,  1995      Greg Martin             Fix index
+ *
+ * $Log: geo_new.c,v $
+ * Revision 1.12  2006/06/26 20:03:37  fwarmerdam
+ * 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!
+ *
+ * Revision 1.11  2004/04/27 21:32:08  warmerda
+ * Allow GTIFNew(NULL) to work
+ *
+ * Revision 1.10  2003/09/02 13:52:17  warmerda
+ * various hacks to support improperly terminated asciiparms
+ *
+ * Revision 1.9  2003/06/19 20:04:11  warmerda
+ * fix memory underwrite if ascii parameter string is zero length
+ *
+ * Revision 1.8  2003/06/05 14:20:45  warmerda
+ * cosmetic formatting changes
+ *
+ **********************************************************************/
+
+#include "geotiffio.h"   /* public interface        */
+#include "geo_tiffp.h" /* external TIFF interface */
+#include "geo_keyp.h"  /* private interface       */
+
+/* private local routines */
+static int ReadKey(GTIF* gt, TempKeyData* tempData,
+                   KeyEntry* entptr, GeoKey* keyptr);
+
+
+/**********************************************************************
+ *
+ *                        Public Routines
+ *
+ **********************************************************************/
+
+
+/**
+ * Given an open TIFF file, look for GTIF keys and 
+ *  values and return GTIF structure.
+
+This function creates a GeoTIFF information interpretation handle
+(GTIF *) based on a passed in TIFF handle originally from 
+XTIFFOpen().  Even though the argument 
+(<b>tif</b>) is shown as type <tt>void *</tt>, it is really normally
+of type <tt>TIFF *</tt>.<p>
+
+The returned GTIF handle can be used to read or write GeoTIFF tags 
+using the various GTIF functions.  The handle should be destroyed using
+GTIFFree() before the file is closed with TIFFClose().<p>
+
+If the file accessed has no GeoTIFF keys, an valid (but empty) GTIF is
+still returned.  GTIFNew() is used both for existing files being read, and
+for new TIFF files that will have GeoTIFF tags written to them.<p>
+
+ */
+ 
+GTIF* GTIFNew(void *tif)
+{
+    GTIF* gt=(GTIF*)0;
+    int count,bufcount,index;
+    GeoKey *keyptr;
+    pinfo_t *data;
+    KeyEntry *entptr;
+    KeyHeader *header;
+    TempKeyData tempData;
+	
+    gt = (GTIF*)_GTIFcalloc( sizeof(GTIF));
+    if (!gt) goto failure;	
+	
+    /* install TIFF file and I/O methods */
+    gt->gt_tif = (tiff_t *)tif;
+    _GTIFSetDefaultTIFF(&gt->gt_methods);
+
+    tempData.tk_asciiParams = 0;
+    tempData.tk_asciiParamsLength = 0;
+    tempData.tk_asciiParamsOffset = 0;
+	
+    /* since this is an array, GTIF will allocate the memory */
+    if ( tif == NULL 
+         || !(gt->gt_methods.get)(tif, GTIFF_GEOKEYDIRECTORY, &gt->gt_nshorts, &data ))
+    {
+        /* No ProjectionInfo, create a blank one */
+        data=(pinfo_t*)_GTIFcalloc((4+MAX_VALUES)*sizeof(pinfo_t));
+        if (!data) goto failure;	
+        header = (KeyHeader *)data;
+        header->hdr_version = GvCurrentVersion;
+        header->hdr_rev_major = GvCurrentRevision;
+        header->hdr_rev_minor = GvCurrentMinorRev;
+        gt->gt_nshorts=sizeof(KeyHeader)/sizeof(pinfo_t);
+    }
+    gt->gt_short = data;
+    header = (KeyHeader *)data;
+	
+    if (header->hdr_version > GvCurrentVersion) goto failure;
+    if (header->hdr_rev_major > GvCurrentRevision)
+    {
+        /* issue warning */
+    }
+	
+    /* If we got here, then the geokey can be parsed */
+    count = header->hdr_num_keys;
+    gt->gt_num_keys = count;
+    gt->gt_version  = header->hdr_version;
+    gt->gt_rev_major  = header->hdr_rev_major;
+    gt->gt_rev_minor  = header->hdr_rev_minor;
+
+    bufcount = count+MAX_KEYS; /* allow for expansion */
+
+    /* Get the PARAMS Tags, if any */
+    if (tif == NULL
+        || !(gt->gt_methods.get)(tif, GTIFF_DOUBLEPARAMS,
+                                 &gt->gt_ndoubles, &gt->gt_double ))
+    {
+        gt->gt_double=(double*)_GTIFcalloc(MAX_VALUES*sizeof(double));
+        if (!gt->gt_double) goto failure;	
+    }
+    if ( tif == NULL
+         || !(gt->gt_methods.get)(tif, GTIFF_ASCIIPARAMS,
+                                  &tempData.tk_asciiParamsLength,
+                                  &tempData.tk_asciiParams ))
+    {
+        tempData.tk_asciiParams         = 0;
+        tempData.tk_asciiParamsLength   = 0;
+    }
+    else
+    {
+        /* last NULL doesn't count; "|" used for delimiter */
+        --tempData.tk_asciiParamsLength;
+    }
+
+    /* allocate space for GeoKey array and its index */
+    gt->gt_keys = (GeoKey *)_GTIFcalloc( sizeof(GeoKey)*bufcount);
+    if (!gt->gt_keys) goto failure;
+    gt->gt_keyindex = (int *)_GTIFcalloc( sizeof(int)*(MAX_KEYINDEX+1));
+    if (!gt->gt_keyindex) goto failure;
+	
+    /*  Loop to get all GeoKeys */
+    entptr = ((KeyEntry *)data) + 1;
+    keyptr = gt->gt_keys;
+    gt->gt_keymin = MAX_KEYINDEX;
+    gt->gt_keymax = 0;
+    for (index=1; index<=count; index++,entptr++)
+    {
+        if (!ReadKey(gt, &tempData, entptr, ++keyptr))
+            goto failure;
+			
+        /* Set up the index (start at 1, since 0=unset) */
+        gt->gt_keyindex[entptr->ent_key] = index;		
+    }
+
+    if( tempData.tk_asciiParams != NULL )
+        _GTIFFree( tempData.tk_asciiParams );
+	
+    return gt;
+	
+  failure:
+    /* Notify of error */
+    GTIFFree (gt);
+    return (GTIF *)0;
+}
+
+/**********************************************************************
+ *
+ *                        Private Routines
+ *
+ **********************************************************************/
+
+/*
+ * Given KeyEntry, read in the GeoKey value location and set up
+ *  the Key structure, returning 0 if failure.
+ */
+
+static int ReadKey(GTIF* gt, TempKeyData* tempData,
+                   KeyEntry* entptr, GeoKey* keyptr)
+{
+    int offset,count;
+	
+    keyptr->gk_key = entptr->ent_key;
+    keyptr->gk_count = entptr->ent_count;
+    count = entptr->ent_count;
+    offset = entptr->ent_val_offset;
+    if (gt->gt_keymin > keyptr->gk_key)  gt->gt_keymin=keyptr->gk_key;
+    if (gt->gt_keymax < keyptr->gk_key)  gt->gt_keymax=keyptr->gk_key;
+	
+    if (entptr->ent_location)
+        keyptr->gk_type = (gt->gt_methods.type)(gt->gt_tif,entptr->ent_location);
+    else
+        keyptr->gk_type = (gt->gt_methods.type)(gt->gt_tif,GTIFF_GEOKEYDIRECTORY);
+	  
+    switch (entptr->ent_location)
+    {
+        case GTIFF_LOCAL:
+            /* store value into data value */
+            *(pinfo_t *)(&keyptr->gk_data) = entptr->ent_val_offset;
+            break;
+        case GTIFF_GEOKEYDIRECTORY:
+            keyptr->gk_data = (char *)(gt->gt_short+offset);
+            if (gt->gt_nshorts < offset+count)
+                gt->gt_nshorts = offset+count;
+            break;
+        case GTIFF_DOUBLEPARAMS:
+            keyptr->gk_data = (char *)(gt->gt_double+offset);
+            if (gt->gt_ndoubles < offset+count)
+                gt->gt_ndoubles = offset+count;
+            break;
+        case GTIFF_ASCIIPARAMS:
+            if( offset + count == tempData->tk_asciiParamsLength + 1 
+                && count > 0 )
+            {
+                /* some vendors seem to feel they should not use the 
+                   terminating '|' char, but do include a terminating '\0'
+                   which we lose in the low level reading code.  
+                   If this is the case, drop the extra character */
+                count--;
+            }
+            else if (offset < tempData->tk_asciiParamsLength
+                     && offset + count > tempData->tk_asciiParamsLength )
+            {
+                count = tempData->tk_asciiParamsLength - offset;
+                /* issue warning... if we could */
+            }
+            else if (offset + count > tempData->tk_asciiParamsLength)
+                return (0);
+
+            keyptr->gk_data = (char *) _GTIFcalloc (MAX(1,count+1));
+            _GTIFmemcpy (keyptr->gk_data,
+                         tempData->tk_asciiParams + offset, count);
+            if( keyptr->gk_data[MAX(0,count-1)] == '|' )
+                keyptr->gk_data[MAX(0,count-1)] = '\0';
+            else
+                keyptr->gk_data[MAX(0,count)] = '\0';
+            break;
+        default:
+            return 0; /* failure */
+    }
+    keyptr->gk_size = _gtiff_size[keyptr->gk_type];
+	
+    return 1; /* success */
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_normalize.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_normalize.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_normalize.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,2468 @@
+/******************************************************************************
+ * $Id: geo_normalize.c,v 1.50 2007/07/28 13:55:21 fwarmerdam Exp $
+ *
+ * Project:  libgeotiff
+ * Purpose:  Code to normalize PCS and other composite codes in a GeoTIFF file.
+ * 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: geo_normalize.c,v $
+ * Revision 1.50  2007/07/28 13:55:21  fwarmerdam
+ * Fix name for GCS_WGS_72 per gdal bug #1715.
+ *
+ * Revision 1.49  2007/07/20 18:10:41  fwarmerdam
+ * Pre-search pcs.override.csv and gcs.override.csv.
+ *
+ * Revision 1.48  2007/06/06 02:17:04  fwarmerdam
+ * added builtin known values for foot and us survey foot
+ *
+ * Revision 1.47  2007/03/13 18:04:33  fwarmerdam
+ * added new zealand map grid support per bug 1519
+ *
+ * Revision 1.46  2006/04/11 19:25:06  fwarmerdam
+ * Be careful about falling back to gdal_datum.csv as it can interfere
+ * with incode datum.csv support.
+ *
+ * Revision 1.45  2005/03/15 16:01:18  fwarmerdam
+ * zero inv flattening interpreted as sphere
+ *
+ * Revision 1.44  2005/03/04 04:32:37  fwarmerdam
+ * added cylindricalequalarea support
+ *
+ * Revision 1.43  2005/03/04 04:02:40  fwarmerdam
+ * Fixed initialization of dfStdParallel2 for AEA and EC.
+ *
+ * Revision 1.42  2005/02/17 01:21:38  fwarmerdam
+ * fixed handling of ProjFalseOrigin{Easting,Northing}GeoKey
+ *
+ * Revision 1.41  2004/12/01 22:06:42  fwarmerdam
+ * bug 698: GTIFGetGCSInfo should not fail on missing pm if pm info not req.
+ *
+ * Revision 1.40  2004/07/09 17:27:37  warmerda
+ * Added 9122 as an alias for simple degrees.
+ *
+ * Revision 1.39  2004/06/07 12:57:13  warmerda
+ * fallback to using gdal_datum.csv if datum.csv not found
+ *
+ * Revision 1.38  2004/03/19 12:20:40  dron
+ * Initialize projection parameters in GTIFFetchProjParms() before using.
+ *
+ * Revision 1.37  2003/07/08 17:31:30  warmerda
+ * cleanup various warnings
+ *
+ * Revision 1.36  2003/01/28 18:31:58  warmerda
+ * Default dfInDegrees in GTIFAngleToDD().
+ *
+ * Revision 1.35  2003/01/15 04:39:16  warmerda
+ * Added GTIFDeaccessCSV
+ *
+ * Revision 1.34  2003/01/15 03:37:40  warmerda
+ * added GTIFFreeMemory()
+ *
+ * Revision 1.33  2002/12/05 19:21:01  warmerda
+ * fixed dfInDegrees to actually be in degrees, not radians!
+ *
+ * Revision 1.32  2002/11/30 16:01:11  warmerda
+ * fixed some problems in GTIFGetUOMAngleInfo
+ *
+ * Revision 1.31  2002/11/30 15:44:35  warmerda
+ * fixed GetCTParms EPSG code mappings
+ *
+ * Revision 1.30  2002/11/28 22:27:42  warmerda
+ * preliminary upgrade to EPSG 6.2.2 tables
+ *
+ * Revision 1.29  2002/06/19 03:51:15  warmerda
+ * migrated cpl_csv.h into cpl_serv.h
+ *
+ * Revision 1.28  2002/01/03 21:28:25  warmerda
+ * call CSVDeaccess(NULL) at end of GTIFPrintDefn()
+ *
+ * Revision 1.27  2001/04/17 13:41:10  warmerda
+ * fix memory leaks in GTIFPrintDefn()
+ *
+ * Revision 1.26  2001/04/17 13:23:07  warmerda
+ * added support for reading custom ellipsoid definitions
+ *
+ * Revision 1.25  2001/03/05 04:55:26  warmerda
+ * CVSDeaccess at end of GTIFGetDefn to avoid file leak
+ *
+ * Revision 1.24  2001/03/05 03:26:29  warmerda
+ * fixed memory leaks in GTIFPrintDefn()
+ *
+ * Revision 1.23  2001/02/23 13:49:48  warmerda
+ * Fixed GTIFPrintDefn() to use fprintf( fp ), instead of printf().
+ *
+ * Revision 1.22  2000/10/13 14:30:57  warmerda
+ * fixed LCC parm order when parameters read directly from geotiff file
+ *
+ * Revision 1.21  2000/09/15 19:30:14  warmerda
+ * report units of linear proj parms
+ *
+ * Revision 1.20  2000/09/15 18:21:07  warmerda
+ * 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!
+ *
+ * Revision 1.19  2000/06/09 14:05:43  warmerda
+ * added default knowledge of NAD27/NAD83/WGS72/WGS84
+ *
+ * Revision 1.18  1999/12/10 21:28:12  warmerda
+ * fixed Stereographic to look for ProjCenterLat/Long
+ *
+ * Revision 1.17  1999/12/10 20:06:58  warmerda
+ * fixed up scale geokey used for a couple of projections
+ *
+ * Revision 1.16  1999/12/10 19:50:21  warmerda
+ * Added EquidistantConic support, fixed return of StdParallel2GeoKey for
+ * LCC2, and Albers.
+ *
+ * Revision 1.15  1999/12/10 19:39:26  warmerda
+ * Fixed bug setting the false northing for files with
+ * ProjCenterNorthingGeoKey set in GTIFGetDefn().
+ *
+ * Revision 1.14  1999/09/17 14:58:37  warmerda
+ * Added ProjRectifiedGridAngleGeoKey(3096) and support for it's
+ * use with Oblique Mercator in geo_normalize.c.
+ *
+ * Revision 1.13  1999/09/17 00:55:26  warmerda
+ * added GTIFGetUOMAngleInfo(), and UOMAngle in GTIFDefn
+ *
+ * Revision 1.12  1999/09/15 18:51:31  warmerda
+ * Map 9808 to TM South Oriented, not TM Modified Alaska.
+ *
+ * Revision 1.11  1999/09/15 16:44:06  warmerda
+ * Change meter to metre to match EPSG database in GTIFGetUOMLengthInfo()
+ * shortcut.
+ *
+ * Revision 1.10  1999/09/15 16:35:15  warmerda
+ * Fixed the fractions of second handling properly in GTIFAngleStringToDD().
+ *
+ * Revision 1.9  1999/09/15 14:24:17  warmerda
+ * 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.
+ *
+ * Revision 1.8  1999/07/13 03:12:52  warmerda
+ * Make scale a parameter of CT_Stereographic.
+ *
+ * Revision 1.7  1999/05/04 03:13:22  warmerda
+ * fixed a serious bug in parsing DMSmmss.sss values, and a bug in forming DMS strings
+ *
+ * Revision 1.6  1999/05/03 17:50:31  warmerda
+ * avoid warnings on IRIX
+ *
+ * Revision 1.5  1999/04/28 20:04:51  warmerda
+ * Added doxygen style documentation.
+ * Use GTIFPCSToMapSys() and related functions to partially normalize
+ * projections when we don't have the CSV files.
+ *
+ * Revision 1.4  1999/03/18 21:34:59  geotiff
+ * added GTIFDecToDMS
+ *
+ * Revision 1.3  1999/03/17 19:53:15  geotiff
+ * sys includes moved to cpl_serv.h
+ *
+ * Revision 1.2  1999/03/10 18:24:06  geotiff
+ * corrected to use int'
+ *
+ * Revision 1.1  1999/03/09 15:57:04  geotiff
+ * New
+ *
+ * Revision 1.4  1999/03/03 02:29:38  warmerda
+ * Define PI if not already defined.
+ *
+ * Revision 1.3  1999/03/02 21:10:57  warmerda
+ * added lots of projections
+ *
+ * Revision 1.2  1999/02/24 16:24:15  warmerda
+ * Continuing to evolve
+ *
+ * Revision 1.1  1999/02/22 18:51:08  warmerda
+ * New
+ *
+ */
+ 
+#include "cpl_serv.h"
+#include "geo_tiffp.h"
+#include "geovalues.h"
+#include "geo_normalize.h"
+
+#ifndef KvUserDefined
+#  define KvUserDefined 32767
+#endif
+
+#ifndef PI
+#  define PI 3.14159265358979323846
+#endif
+
+/* EPSG Codes for projection parameters.  Unfortunately, these bear no
+   relationship to the GeoTIFF codes even though the names are so similar. */
+
+#define EPSGNatOriginLat         8801
+#define EPSGNatOriginLong        8802
+#define EPSGNatOriginScaleFactor 8805
+#define EPSGFalseEasting         8806
+#define EPSGFalseNorthing        8807
+#define EPSGProjCenterLat        8811
+#define EPSGProjCenterLong       8812
+#define EPSGAzimuth              8813
+#define EPSGAngleRectifiedToSkewedGrid 8814
+#define EPSGInitialLineScaleFactor 8815
+#define EPSGProjCenterEasting    8816
+#define EPSGProjCenterNorthing   8817
+#define EPSGPseudoStdParallelLat 8818
+#define EPSGPseudoStdParallelScaleFactor 8819
+#define EPSGFalseOriginLat       8821
+#define EPSGFalseOriginLong      8822
+#define EPSGStdParallel1Lat      8823
+#define EPSGStdParallel2Lat      8824
+#define EPSGFalseOriginEasting   8826
+#define EPSGFalseOriginNorthing  8827
+#define EPSGSphericalOriginLat   8828
+#define EPSGSphericalOriginLong  8829
+#define EPSGInitialLongitude     8830
+#define EPSGZoneWidth            8831
+
+/************************************************************************/
+/*                           GTIFGetPCSInfo()                           */
+/************************************************************************/
+
+int GTIFGetPCSInfo( int nPCSCode, char **ppszEPSGName, 
+                    short *pnProjOp, short *pnUOMLengthCode, 
+                    short *pnGeogCS )
+
+{
+    char	**papszRecord;
+    char	szSearchKey[24];
+    const char	*pszFilename;
+
+/* -------------------------------------------------------------------- */
+/*      Search the pcs.override table for this PCS.                     */
+/* -------------------------------------------------------------------- */
+    pszFilename = CSVFilename( "pcs.override.csv" );
+    sprintf( szSearchKey, "%d", nPCSCode );
+    papszRecord = CSVScanFileByName( pszFilename, "COORD_REF_SYS_CODE",
+                                     szSearchKey, CC_Integer );
+
+/* -------------------------------------------------------------------- */
+/*      If not found, search the EPSG PCS database.                     */
+/* -------------------------------------------------------------------- */
+    if( papszRecord == NULL )
+    {
+        pszFilename = CSVFilename( "pcs.csv" );
+        
+        sprintf( szSearchKey, "%d", nPCSCode );
+        papszRecord = CSVScanFileByName( pszFilename, "COORD_REF_SYS_CODE",
+                                         szSearchKey, CC_Integer );
+
+        if( papszRecord == NULL )
+            return FALSE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Get the name, if requested.                                     */
+/* -------------------------------------------------------------------- */
+    if( ppszEPSGName != NULL )
+    {
+        *ppszEPSGName =
+            CPLStrdup( CSLGetField( papszRecord,
+                                    CSVGetFileFieldId(pszFilename,
+                                                      "COORD_REF_SYS_NAME") ));
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Get the UOM Length code, if requested.                          */
+/* -------------------------------------------------------------------- */
+    if( pnUOMLengthCode != NULL )
+    {
+        const char	*pszValue;
+
+        pszValue =
+            CSLGetField( papszRecord,
+                         CSVGetFileFieldId(pszFilename,"UOM_CODE"));
+        if( atoi(pszValue) > 0 )
+            *pnUOMLengthCode = (short) atoi(pszValue);
+        else
+            *pnUOMLengthCode = KvUserDefined;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Get the UOM Length code, if requested.                          */
+/* -------------------------------------------------------------------- */
+    if( pnProjOp != NULL )
+    {
+        const char	*pszValue;
+
+        pszValue =
+            CSLGetField( papszRecord,
+                         CSVGetFileFieldId(pszFilename,"COORD_OP_CODE"));
+        if( atoi(pszValue) > 0 )
+            *pnProjOp = (short) atoi(pszValue);
+        else
+            *pnUOMLengthCode = KvUserDefined;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Get the GeogCS (Datum with PM) code, if requested.		*/
+/* -------------------------------------------------------------------- */
+    if( pnGeogCS != NULL )
+    {
+        const char	*pszValue;
+
+        pszValue =
+            CSLGetField( papszRecord,
+                         CSVGetFileFieldId(pszFilename,"SOURCE_GEOGCRS_CODE"));
+        if( atoi(pszValue) > 0 )
+            *pnGeogCS = (short) atoi(pszValue);
+        else
+            *pnGeogCS = KvUserDefined;
+    }
+
+    return TRUE;
+}
+
+/************************************************************************/
+/*                           GTIFAngleToDD()                            */
+/*                                                                      */
+/*      Convert a numeric angle to decimal degress.                     */
+/************************************************************************/
+
+double GTIFAngleToDD( double dfAngle, int nUOMAngle )
+
+{
+    if( nUOMAngle == 9110 )		/* DDD.MMSSsss */
+    {
+        char	szAngleString[32];
+
+        sprintf( szAngleString, "%12.7f", dfAngle );
+        dfAngle = GTIFAngleStringToDD( szAngleString, nUOMAngle );
+    }
+    else
+    {
+        double		dfInDegrees = 1.0;
+        
+        GTIFGetUOMAngleInfo( nUOMAngle, NULL, &dfInDegrees );
+        dfAngle = dfAngle * dfInDegrees;
+    }
+
+    return( dfAngle );
+}
+
+/************************************************************************/
+/*                        GTIFAngleStringToDD()                         */
+/*                                                                      */
+/*      Convert an angle in the specified units to decimal degrees.     */
+/************************************************************************/
+
+double GTIFAngleStringToDD( const char * pszAngle, int nUOMAngle )
+
+{
+    double	dfAngle;
+    
+    if( nUOMAngle == 9110 )		/* DDD.MMSSsss */
+    {
+        char	*pszDecimal;
+        
+        dfAngle = ABS(atoi(pszAngle));
+        pszDecimal = strchr(pszAngle,'.');
+        if( pszDecimal != NULL && strlen(pszDecimal) > 1 )
+        {
+            char	szMinutes[3];
+            char	szSeconds[64];
+
+            szMinutes[0] = pszDecimal[1];
+            if( pszDecimal[2] >= '0' && pszDecimal[2] <= '9' )
+                szMinutes[1] = pszDecimal[2];
+            else
+                szMinutes[1] = '0';
+            
+            szMinutes[2] = '\0';
+            dfAngle += atoi(szMinutes) / 60.0;
+
+            if( strlen(pszDecimal) > 3 )
+            {
+                szSeconds[0] = pszDecimal[3];
+                if( pszDecimal[4] >= '0' && pszDecimal[4] <= '9' )
+                {
+                    szSeconds[1] = pszDecimal[4];
+                    szSeconds[2] = '.';
+                    strcpy( szSeconds+3, pszDecimal + 5 );
+                }
+                else
+                {
+                    szSeconds[1] = '0';
+                    szSeconds[2] = '\0';
+                }
+                dfAngle += atof(szSeconds) / 3600.0;
+            }
+        }
+
+        if( pszAngle[0] == '-' )
+            dfAngle *= -1;
+    }
+    else if( nUOMAngle == 9105 || nUOMAngle == 9106 )	/* grad */
+    {
+        dfAngle = 180 * (atof(pszAngle ) / 200);
+    }
+    else if( nUOMAngle == 9101 )			/* radians */
+    {
+        dfAngle = 180 * (atof(pszAngle ) / PI);
+    }
+    else if( nUOMAngle == 9103 )			/* arc-minute */
+    {
+        dfAngle = atof(pszAngle) / 60;
+    }
+    else if( nUOMAngle == 9104 )			/* arc-second */
+    {
+        dfAngle = atof(pszAngle) / 3600;
+    }
+    else /* decimal degrees ... some cases missing but seeminly never used */
+    {
+        CPLAssert( nUOMAngle == 9102 || nUOMAngle == KvUserDefined
+                   || nUOMAngle == 0 );
+        
+        dfAngle = atof(pszAngle );
+    }
+
+    return( dfAngle );
+}
+
+/************************************************************************/
+/*                           GTIFGetGCSInfo()                           */
+/*                                                                      */
+/*      Fetch the datum, and prime meridian related to a particular     */
+/*      GCS.                                                            */
+/************************************************************************/
+
+int GTIFGetGCSInfo( int nGCSCode, char ** ppszName,
+                    short * pnDatum, short * pnPM, short *pnUOMAngle )
+
+{
+    char	szSearchKey[24];
+    int		nDatum, nPM, nUOMAngle;
+    const char *pszFilename;
+
+/* -------------------------------------------------------------------- */
+/*      Search the database for the corresponding datum code.           */
+/* -------------------------------------------------------------------- */
+    pszFilename = CSVFilename("gcs.override.csv");
+    sprintf( szSearchKey, "%d", nGCSCode );
+    nDatum = atoi(CSVGetField( pszFilename,
+                               "COORD_REF_SYS_CODE", szSearchKey, 
+                               CC_Integer, "DATUM_CODE" ) );
+
+    if( nDatum < 1 )
+    {
+        pszFilename = CSVFilename("gcs.csv");
+        sprintf( szSearchKey, "%d", nGCSCode );
+        nDatum = atoi(CSVGetField( pszFilename,
+                                   "COORD_REF_SYS_CODE", szSearchKey, 
+                                   CC_Integer, "DATUM_CODE" ) );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Handle some "well known" GCS codes directly if the table        */
+/*      wasn't found.                                                   */
+/* -------------------------------------------------------------------- */
+    if( nDatum < 1 )
+    {
+        const char * pszName = NULL;
+        nPM = PM_Greenwich;
+        nUOMAngle = Angular_DMS_Hemisphere; 
+        if( nGCSCode == GCS_NAD27 )
+        {
+            nDatum = Datum_North_American_Datum_1927;
+            pszName = "NAD27";
+        }
+        else if( nGCSCode == GCS_NAD83 )
+        {
+            nDatum = Datum_North_American_Datum_1983;
+            pszName = "NAD83";
+        }
+        else if( nGCSCode == GCS_WGS_84 )
+        {
+            nDatum = Datum_WGS84;
+            pszName = "WGS 84";
+        }
+        else if( nGCSCode == GCS_WGS_72 )
+        {
+            nDatum = Datum_WGS72;
+            pszName = "WGS 72";
+        }
+        else
+            return FALSE;
+
+        if( ppszName != NULL )
+            *ppszName = CPLStrdup( pszName );
+        if( pnDatum != NULL )
+            *pnDatum = (short) nDatum;
+        if( pnPM != NULL )
+            *pnPM = (short) nPM;
+        if( pnUOMAngle != NULL )
+            *pnUOMAngle = (short) nUOMAngle;
+
+        return TRUE;
+    }
+
+    if( pnDatum != NULL )
+        *pnDatum = (short) nDatum;
+    
+/* -------------------------------------------------------------------- */
+/*      Get the PM.                                                     */
+/* -------------------------------------------------------------------- */
+    if( pnPM != NULL )
+    {
+        nPM = atoi(CSVGetField( pszFilename,
+                                "COORD_REF_SYS_CODE", szSearchKey, CC_Integer,
+                                "PRIME_MERIDIAN_CODE" ) );
+
+        if( nPM < 1 )
+            return FALSE;
+
+        *pnPM = (short) nPM;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Get the angular units.                                          */
+/* -------------------------------------------------------------------- */
+    nUOMAngle = atoi(CSVGetField( pszFilename,
+                                  "COORD_REF_SYS_CODE",szSearchKey, CC_Integer,
+                                  "UOM_CODE" ) );
+
+    if( nUOMAngle < 1 )
+        return FALSE;
+
+    if( pnUOMAngle != NULL )
+        *pnUOMAngle = (short) nUOMAngle;
+
+/* -------------------------------------------------------------------- */
+/*      Get the name, if requested.                                     */
+/* -------------------------------------------------------------------- */
+    if( ppszName != NULL )
+        *ppszName =
+            CPLStrdup(CSVGetField( pszFilename,
+                                   "COORD_REF_SYS_CODE",szSearchKey,CC_Integer,
+                                   "COORD_REF_SYS_NAME" ));
+    
+    return( TRUE );
+}
+
+/************************************************************************/
+/*                        GTIFGetEllipsoidInfo()                        */
+/*                                                                      */
+/*      Fetch info about an ellipsoid.  Axes are always returned in     */
+/*      meters.  SemiMajor computed based on inverse flattening         */
+/*      where that is provided.                                         */
+/************************************************************************/
+
+int GTIFGetEllipsoidInfo( int nEllipseCode, char ** ppszName,
+                          double * pdfSemiMajor, double * pdfSemiMinor )
+
+{
+    char	szSearchKey[24];
+    double	dfSemiMajor, dfToMeters = 1.0;
+    int		nUOMLength;
+    
+/* -------------------------------------------------------------------- */
+/*      Get the semi major axis.                                        */
+/* -------------------------------------------------------------------- */
+    sprintf( szSearchKey, "%d", nEllipseCode );
+
+    dfSemiMajor =
+        atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
+                          "ELLIPSOID_CODE", szSearchKey, CC_Integer,
+                          "SEMI_MAJOR_AXIS" ) );
+
+/* -------------------------------------------------------------------- */
+/*      Try some well known ellipsoids.                                 */
+/* -------------------------------------------------------------------- */
+    if( dfSemiMajor == 0.0 )
+    {
+        double     dfInvFlattening, dfSemiMinor;
+        const char *pszName = NULL;
+        
+        if( nEllipseCode == Ellipse_Clarke_1866 )
+        {
+            pszName = "Clarke 1866";
+            dfSemiMajor = 6378206.4;
+            dfSemiMinor = 6356583.8;
+            dfInvFlattening = 0.0;
+        }
+        else if( nEllipseCode == Ellipse_GRS_1980 )
+        {
+            pszName = "GRS 1980";
+            dfSemiMajor = 6378137.0;
+            dfSemiMinor = 0.0;
+            dfInvFlattening = 298.257222101;
+        }
+        else if( nEllipseCode == Ellipse_WGS_84 )
+        {
+            pszName = "WGS 84";
+            dfSemiMajor = 6378137.0;
+            dfSemiMinor = 0.0;
+            dfInvFlattening = 298.257223563;
+        }
+        else if( nEllipseCode == 7043 )
+        {
+            pszName = "WGS 72";
+            dfSemiMajor = 6378135.0;
+            dfSemiMinor = 0.0;
+            dfInvFlattening = 298.26;
+        }
+        else
+            return FALSE;
+
+        if( dfSemiMinor == 0.0 )
+            dfSemiMinor = dfSemiMajor * (1 - 1.0/dfInvFlattening);
+
+        if( pdfSemiMinor != NULL )
+            *pdfSemiMinor = dfSemiMinor;
+        if( pdfSemiMajor != NULL )
+            *pdfSemiMajor = dfSemiMajor;
+        if( ppszName != NULL )
+            *ppszName = CPLStrdup( pszName );
+
+        return TRUE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*	Get the translation factor into meters.				*/
+/* -------------------------------------------------------------------- */
+    nUOMLength = atoi(CSVGetField( CSVFilename("ellipsoid.csv" ),
+                                   "ELLIPSOID_CODE", szSearchKey, CC_Integer,
+                                   "UOM_CODE" ));
+    GTIFGetUOMLengthInfo( nUOMLength, NULL, &dfToMeters );
+
+    dfSemiMajor *= dfToMeters;
+    
+    if( pdfSemiMajor != NULL )
+        *pdfSemiMajor = dfSemiMajor;
+    
+/* -------------------------------------------------------------------- */
+/*      Get the semi-minor if requested.  If the Semi-minor axis        */
+/*      isn't available, compute it based on the inverse flattening.    */
+/* -------------------------------------------------------------------- */
+    if( pdfSemiMinor != NULL )
+    {
+        *pdfSemiMinor =
+            atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
+                              "ELLIPSOID_CODE", szSearchKey, CC_Integer,
+                              "SEMI_MINOR_AXIS" )) * dfToMeters;
+
+        if( *pdfSemiMinor == 0.0 )
+        {
+            double	dfInvFlattening;
+            
+            dfInvFlattening = 
+                atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
+                                  "ELLIPSOID_CODE", szSearchKey, CC_Integer,
+                                  "INV_FLATTENING" ));
+            *pdfSemiMinor = dfSemiMajor * (1 - 1.0/dfInvFlattening);
+        }
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Get the name, if requested.                                     */
+/* -------------------------------------------------------------------- */
+    if( ppszName != NULL )
+        *ppszName =
+            CPLStrdup(CSVGetField( CSVFilename("ellipsoid.csv" ),
+                                   "ELLIPSOID_CODE", szSearchKey, CC_Integer,
+                                   "ELLIPSOID_NAME" ));
+    
+    return( TRUE );
+}
+
+/************************************************************************/
+/*                           GTIFGetPMInfo()                            */
+/*                                                                      */
+/*      Get the offset between a given prime meridian and Greenwich     */
+/*      in degrees.                                                     */
+/************************************************************************/
+
+int GTIFGetPMInfo( int nPMCode, char ** ppszName, double *pdfOffset )
+
+{
+    char	szSearchKey[24];
+    int		nUOMAngle;
+    const char *pszFilename = CSVFilename("prime_meridian.csv");
+
+/* -------------------------------------------------------------------- */
+/*      Use a special short cut for Greenwich, since it is so common.   */
+/* -------------------------------------------------------------------- */
+    if( nPMCode == PM_Greenwich )
+    {
+        if( pdfOffset != NULL )
+            *pdfOffset = 0.0;
+        if( ppszName != NULL )
+            *ppszName = CPLStrdup( "Greenwich" );
+        return TRUE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Search the database for the corresponding datum code.           */
+/* -------------------------------------------------------------------- */
+    sprintf( szSearchKey, "%d", nPMCode );
+
+    nUOMAngle =
+        atoi(CSVGetField( pszFilename, 
+                          "PRIME_MERIDIAN_CODE", szSearchKey, CC_Integer,
+                          "UOM_CODE" ) );
+    if( nUOMAngle < 1 )
+        return FALSE;
+
+/* -------------------------------------------------------------------- */
+/*      Get the PM offset.                                              */
+/* -------------------------------------------------------------------- */
+    if( pdfOffset != NULL )
+    {
+        *pdfOffset =
+            GTIFAngleStringToDD(
+                CSVGetField( pszFilename, 
+                             "PRIME_MERIDIAN_CODE", szSearchKey, CC_Integer,
+                             "GREENWICH_LONGITUDE" ),
+                nUOMAngle );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      Get the name, if requested.                                     */
+/* -------------------------------------------------------------------- */
+    if( ppszName != NULL )
+        *ppszName =
+            CPLStrdup(
+                CSVGetField( pszFilename, 
+                             "PRIME_MERIDIAN_CODE", szSearchKey, CC_Integer,
+                             "PRIME_MERIDIAN_NAME" ));
+    
+    return( TRUE );
+}
+
+/************************************************************************/
+/*                          GTIFGetDatumInfo()                          */
+/*                                                                      */
+/*      Fetch the ellipsoid, and name for a datum.                      */
+/************************************************************************/
+
+int GTIFGetDatumInfo( int nDatumCode, char ** ppszName, short * pnEllipsoid )
+
+{
+    char	szSearchKey[24];
+    int		nEllipsoid;
+    const char *pszFilename = CSVFilename( "datum.csv" );
+    FILE       *fp;
+
+/* -------------------------------------------------------------------- */
+/*      If we can't find datum.csv then gdal_datum.csv is an            */
+/*      acceptable fallback.  Mostly this is for GDAL.                  */
+/* -------------------------------------------------------------------- */
+    if( (fp = VSIFOpen(pszFilename,"r")) == NULL )
+    {
+        if( (fp = VSIFOpen(CSVFilename("gdal_datum.csv"), "r")) != NULL )
+        {
+            pszFilename = CSVFilename( "gdal_datum.csv" );
+            VSIFClose( fp );
+        }        
+    }
+    else
+        VSIFClose( fp );
+
+/* -------------------------------------------------------------------- */
+/*      Search the database for the corresponding datum code.           */
+/* -------------------------------------------------------------------- */
+    sprintf( szSearchKey, "%d", nDatumCode );
+
+    nEllipsoid = atoi(CSVGetField( pszFilename,
+                                   "DATUM_CODE", szSearchKey, CC_Integer,
+                                   "ELLIPSOID_CODE" ) );
+
+    if( pnEllipsoid != NULL )
+        *pnEllipsoid = (short) nEllipsoid;
+    
+/* -------------------------------------------------------------------- */
+/*      Handle a few built-in datums.                                   */
+/* -------------------------------------------------------------------- */
+    if( nEllipsoid < 1 )
+    {
+        const char *pszName = NULL;
+        
+        if( nDatumCode == Datum_North_American_Datum_1927 )
+        {
+            nEllipsoid = Ellipse_Clarke_1866;
+            pszName = "North American Datum 1927";
+        }
+        else if( nDatumCode == Datum_North_American_Datum_1983 )
+        {
+            nEllipsoid = Ellipse_GRS_1980;
+            pszName = "North American Datum 1983";
+        }
+        else if( nDatumCode == Datum_WGS84 )
+        {
+            nEllipsoid = Ellipse_WGS_84;
+            pszName = "World Geodetic System 1984";
+        }
+        else if( nDatumCode == Datum_WGS72 )
+        {
+            nEllipsoid = 7043; /* WGS7 */
+            pszName = "World Geodetic System 1972";
+        }
+        else
+            return FALSE;
+
+        if( pnEllipsoid != NULL )
+            *pnEllipsoid = (short) nEllipsoid;
+
+        if( ppszName != NULL )
+            *ppszName = CPLStrdup( pszName );
+
+        return TRUE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Get the name, if requested.                                     */
+/* -------------------------------------------------------------------- */
+    if( ppszName != NULL )
+        *ppszName =
+            CPLStrdup(CSVGetField( pszFilename,
+                                   "DATUM_CODE", szSearchKey, CC_Integer,
+                                   "DATUM_NAME" ));
+    
+    return( TRUE );
+}
+
+
+/************************************************************************/
+/*                        GTIFGetUOMLengthInfo()                        */
+/*                                                                      */
+/*      Note: This function should eventually also know how to          */
+/*      lookup length aliases in the UOM_LE_ALIAS table.                */
+/************************************************************************/
+
+int GTIFGetUOMLengthInfo( int nUOMLengthCode,
+                          char **ppszUOMName,
+                          double * pdfInMeters )
+
+{
+    char	**papszUnitsRecord;
+    char	szSearchKey[24];
+    int		iNameField;
+    const char *pszFilename;
+
+/* -------------------------------------------------------------------- */
+/*      We short cut meter to save work and avoid failure for missing   */
+/*      in the most common cases.       				*/
+/* -------------------------------------------------------------------- */
+    if( nUOMLengthCode == 9001 )
+    {
+        if( ppszUOMName != NULL )
+            *ppszUOMName = CPLStrdup( "metre" );
+        if( pdfInMeters != NULL )
+            *pdfInMeters = 1.0;
+
+        return TRUE;
+    }
+
+    if( nUOMLengthCode == 9002 )
+    {
+        if( ppszUOMName != NULL )
+            *ppszUOMName = CPLStrdup( "foot" );
+        if( pdfInMeters != NULL )
+            *pdfInMeters = 0.3048;
+
+        return TRUE;
+    }
+
+    if( nUOMLengthCode == 9003 )
+    {
+        if( ppszUOMName != NULL )
+            *ppszUOMName = CPLStrdup( "US survey foot" );
+        if( pdfInMeters != NULL )
+            *pdfInMeters = 12.0 / 39.37;
+
+        return TRUE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Search the units database for this unit.  If we don't find      */
+/*      it return failure.                                              */
+/* -------------------------------------------------------------------- */
+    pszFilename = CSVFilename( "unit_of_measure.csv" );
+
+    sprintf( szSearchKey, "%d", nUOMLengthCode );
+    papszUnitsRecord =
+        CSVScanFileByName( pszFilename,
+                           "UOM_CODE", szSearchKey, CC_Integer );
+
+    if( papszUnitsRecord == NULL )
+        return FALSE;
+
+/* -------------------------------------------------------------------- */
+/*      Get the name, if requested.                                     */
+/* -------------------------------------------------------------------- */
+    if( ppszUOMName != NULL )
+    {
+        iNameField = CSVGetFileFieldId( pszFilename,
+                                        "UNIT_OF_MEAS_NAME" );
+        *ppszUOMName = CPLStrdup( CSLGetField(papszUnitsRecord, iNameField) );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      Get the A and B factor fields, and create the multiplicative    */
+/*      factor.                                                         */
+/* -------------------------------------------------------------------- */
+    if( pdfInMeters != NULL )
+    {
+        int	iBFactorField, iCFactorField;
+        
+        iBFactorField = CSVGetFileFieldId( pszFilename, "FACTOR_B" );
+        iCFactorField = CSVGetFileFieldId( pszFilename, "FACTOR_C" );
+
+        if( atof(CSLGetField(papszUnitsRecord, iCFactorField)) > 0.0 )
+            *pdfInMeters = atof(CSLGetField(papszUnitsRecord, iBFactorField))
+                / atof(CSLGetField(papszUnitsRecord, iCFactorField));
+        else
+            *pdfInMeters = 0.0;
+    }
+    
+    return( TRUE );
+}
+
+/************************************************************************/
+/*                        GTIFGetUOMAngleInfo()                         */
+/************************************************************************/
+
+int GTIFGetUOMAngleInfo( int nUOMAngleCode,
+                         char **ppszUOMName,
+                         double * pdfInDegrees )
+
+{
+    const char	*pszUOMName = NULL;
+    double	dfInDegrees = 1.0;
+    const char *pszFilename = CSVFilename( "unit_of_measure.csv" );
+    char	szSearchKey[24];
+
+    sprintf( szSearchKey, "%d", nUOMAngleCode );
+    pszUOMName = CSVGetField( pszFilename,
+                              "UOM_CODE", szSearchKey, CC_Integer,
+                              "UNIT_OF_MEAS_NAME" );
+
+/* -------------------------------------------------------------------- */
+/*      If the file is found, read from there.  Note that FactorC is    */
+/*      an empty field for any of the DMS style formats, and in this    */
+/*      case we really want to return the default InDegrees value       */
+/*      (1.0) from above.                                               */
+/* -------------------------------------------------------------------- */
+    if( pszUOMName != NULL )
+    {
+        double dfFactorB, dfFactorC, dfInRadians;
+        
+        dfFactorB = 
+            atof(CSVGetField( pszFilename,
+                              "UOM_CODE", szSearchKey, CC_Integer,
+                              "FACTOR_B" ));
+        
+        dfFactorC = 
+            atof(CSVGetField( pszFilename,
+                              "UOM_CODE", szSearchKey, CC_Integer,
+                              "FACTOR_C" ));
+
+        if( dfFactorC != 0.0 )
+        {
+            dfInRadians = (dfFactorB / dfFactorC);
+            dfInDegrees = dfInRadians * 180.0 / PI;
+        }
+                          
+
+        /* We do a special override of some of the DMS formats name */
+        if( nUOMAngleCode == 9102 || nUOMAngleCode == 9107
+            || nUOMAngleCode == 9108 || nUOMAngleCode == 9110
+            || nUOMAngleCode == 9122 )
+        {
+            dfInDegrees = 1.0;
+            pszUOMName = "degree";
+        }
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Otherwise handle a few well known units directly.               */
+/* -------------------------------------------------------------------- */
+    else
+    {
+        switch( nUOMAngleCode )
+        {
+          case 9101:
+            pszUOMName = "radian";
+            dfInDegrees = 180.0 / PI;
+            break;
+        
+          case 9102:
+          case 9107:
+          case 9108:
+          case 9110:
+            pszUOMName = "degree";
+            dfInDegrees = 1.0;
+            break;
+
+          case 9103:
+            pszUOMName = "arc-minute";
+            dfInDegrees = 1 / 60.0;
+            break;
+
+          case 9104:
+            pszUOMName = "arc-second";
+            dfInDegrees = 1 / 3600.0;
+            break;
+        
+          case 9105:
+            pszUOMName = "grad";
+            dfInDegrees = 180.0 / 200.0;
+            break;
+
+          case 9106:
+            pszUOMName = "gon";
+            dfInDegrees = 180.0 / 200.0;
+            break;
+        
+          case 9109:
+            pszUOMName = "microradian";
+            dfInDegrees = 180.0 / (PI * 1000000.0);
+            break;
+
+          default:
+            return FALSE;
+        }
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Return to caller.                                               */
+/* -------------------------------------------------------------------- */
+    if( ppszUOMName != NULL )
+    {
+        if( pszUOMName != NULL )
+            *ppszUOMName = CPLStrdup( pszUOMName );
+        else
+            *ppszUOMName = NULL;
+    }
+
+    if( pdfInDegrees != NULL )
+        *pdfInDegrees = dfInDegrees;
+
+    return( TRUE );
+}
+
+/************************************************************************/
+/*                    EPSGProjMethodToCTProjMethod()                    */
+/*                                                                      */
+/*      Convert between the EPSG enumeration for projection methods,    */
+/*      and the GeoTIFF CT codes.                                       */
+/************************************************************************/
+
+static int EPSGProjMethodToCTProjMethod( int nEPSG )
+
+{
+    /* see trf_method.csv for list of EPSG codes */
+    
+    switch( nEPSG )
+    {
+      case 9801:
+        return( CT_LambertConfConic_1SP );
+
+      case 9802:
+        return( CT_LambertConfConic_2SP );
+
+      case 9803:
+        return( CT_LambertConfConic_2SP ); /* Belgian variant not supported */
+
+      case 9804:
+        return( CT_Mercator );  /* 1SP and 2SP not differentiated */
+
+      case 9805:
+        return( CT_Mercator );  /* 1SP and 2SP not differentiated */
+
+      case 9806:
+        return( CT_CassiniSoldner );
+
+      case 9807:
+        return( CT_TransverseMercator );
+
+      case 9808:
+        return( CT_TransvMercator_SouthOriented );
+
+      case 9809:
+        return( CT_ObliqueStereographic );
+
+      case 9810:
+        return( CT_PolarStereographic );
+
+      case 9811:
+        return( CT_NewZealandMapGrid );
+
+      case 9812:
+        return( CT_ObliqueMercator ); /* is hotine actually different? */
+
+      case 9813:
+        return( CT_ObliqueMercator_Laborde );
+
+      case 9814:
+        return( CT_ObliqueMercator_Rosenmund ); /* swiss  */
+
+      case 9815:
+        return( CT_ObliqueMercator );
+
+      case 9816: /* tunesia mining grid has no counterpart */
+        return( KvUserDefined );
+    }
+
+    return( KvUserDefined );
+}
+
+/************************************************************************/
+/*                            SetGTParmIds()                            */
+/*                                                                      */
+/*      This is hardcoded logic to set the GeoTIFF parmaeter            */
+/*      identifiers for all the EPSG supported projections.  As the     */
+/*      trf_method.csv table grows with new projections, this code      */
+/*      will need to be updated.                                        */
+/************************************************************************/
+
+static int SetGTParmIds( int nCTProjection, 
+                         int *panProjParmId, 
+                         int *panEPSGCodes )
+
+{
+    int anWorkingDummy[7];
+
+    if( panEPSGCodes == NULL )
+        panEPSGCodes = anWorkingDummy;
+    if( panProjParmId == NULL )
+        panProjParmId = anWorkingDummy;
+
+    memset( panEPSGCodes, 0, sizeof(int) * 7 );
+
+    /* psDefn->nParms = 7; */
+    
+    switch( nCTProjection )
+    {
+      case CT_CassiniSoldner:
+      case CT_NewZealandMapGrid:
+        panProjParmId[0] = ProjNatOriginLatGeoKey;
+        panProjParmId[1] = ProjNatOriginLongGeoKey;
+        panProjParmId[5] = ProjFalseEastingGeoKey;
+        panProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        panEPSGCodes[0] = EPSGNatOriginLat;
+        panEPSGCodes[1] = EPSGNatOriginLong;
+        panEPSGCodes[5] = EPSGFalseEasting;
+        panEPSGCodes[6] = EPSGFalseNorthing;
+        return TRUE;
+
+      case CT_ObliqueMercator:
+        panProjParmId[0] = ProjCenterLatGeoKey;
+        panProjParmId[1] = ProjCenterLongGeoKey;
+        panProjParmId[2] = ProjAzimuthAngleGeoKey;
+        panProjParmId[3] = ProjRectifiedGridAngleGeoKey;
+        panProjParmId[4] = ProjScaleAtCenterGeoKey;
+        panProjParmId[5] = ProjFalseEastingGeoKey;
+        panProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        panEPSGCodes[0] = EPSGProjCenterLat;
+        panEPSGCodes[1] = EPSGProjCenterLong;
+        panEPSGCodes[2] = EPSGAzimuth;
+        panEPSGCodes[3] = EPSGAngleRectifiedToSkewedGrid;
+        panEPSGCodes[4] = EPSGInitialLineScaleFactor;
+        panEPSGCodes[5] = EPSGProjCenterEasting;
+        panEPSGCodes[6] = EPSGProjCenterNorthing;
+        return TRUE;
+
+      case CT_ObliqueMercator_Laborde:
+        panProjParmId[0] = ProjCenterLatGeoKey;
+        panProjParmId[1] = ProjCenterLongGeoKey;
+        panProjParmId[2] = ProjAzimuthAngleGeoKey;
+        panProjParmId[4] = ProjScaleAtCenterGeoKey;
+        panProjParmId[5] = ProjFalseEastingGeoKey;
+        panProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        panEPSGCodes[0] = EPSGProjCenterLat;
+        panEPSGCodes[1] = EPSGProjCenterLong;
+        panEPSGCodes[2] = EPSGAzimuth;
+        panEPSGCodes[4] = EPSGInitialLineScaleFactor;
+        panEPSGCodes[5] = EPSGProjCenterEasting;
+        panEPSGCodes[6] = EPSGProjCenterNorthing;
+        return TRUE;
+        
+      case CT_LambertConfConic_1SP:
+      case CT_Mercator:
+      case CT_ObliqueStereographic:
+      case CT_PolarStereographic:
+      case CT_TransverseMercator:
+      case CT_TransvMercator_SouthOriented:
+        panProjParmId[0] = ProjNatOriginLatGeoKey;
+        panProjParmId[1] = ProjNatOriginLongGeoKey;
+        panProjParmId[4] = ProjScaleAtNatOriginGeoKey;
+        panProjParmId[5] = ProjFalseEastingGeoKey;
+        panProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        panEPSGCodes[0] = EPSGNatOriginLat;
+        panEPSGCodes[1] = EPSGNatOriginLong;
+        panEPSGCodes[4] = EPSGNatOriginScaleFactor;
+        panEPSGCodes[5] = EPSGFalseEasting;
+        panEPSGCodes[6] = EPSGFalseNorthing;
+        return TRUE;
+
+      case CT_LambertConfConic_2SP:
+        panProjParmId[0] = ProjFalseOriginLatGeoKey;
+        panProjParmId[1] = ProjFalseOriginLongGeoKey;
+        panProjParmId[2] = ProjStdParallel1GeoKey;
+        panProjParmId[3] = ProjStdParallel2GeoKey;
+        panProjParmId[5] = ProjFalseEastingGeoKey;
+        panProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        panEPSGCodes[0] = EPSGFalseOriginLat;
+        panEPSGCodes[1] = EPSGFalseOriginLong;
+        panEPSGCodes[2] = EPSGStdParallel1Lat;
+        panEPSGCodes[3] = EPSGStdParallel2Lat;
+        panEPSGCodes[5] = EPSGFalseOriginEasting;
+        panEPSGCodes[6] = EPSGFalseOriginNorthing;
+        return TRUE;
+
+      case CT_SwissObliqueCylindrical:
+        panProjParmId[0] = ProjCenterLatGeoKey;
+        panProjParmId[1] = ProjCenterLongGeoKey;
+        panProjParmId[5] = ProjFalseEastingGeoKey;
+        panProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        /* EPSG codes? */
+        return TRUE;
+
+      default:
+        return( FALSE );
+    }
+}
+
+/************************************************************************/
+/*                         GTIFGetProjTRFInfo()                         */
+/*                                                                      */
+/*      Transform a PROJECTION_TRF_CODE into a projection method,       */
+/*      and a set of parameters.  The parameters identify will          */
+/*      depend on the returned method, but they will all have been      */
+/*      normalized into degrees and meters.                             */
+/************************************************************************/
+
+int GTIFGetProjTRFInfo( /* COORD_OP_CODE from coordinate_operation.csv */
+                        int nProjTRFCode, 
+                        char **ppszProjTRFName,
+                        short * pnProjMethod,
+                        double * padfProjParms )
+
+{
+    int		nProjMethod, i, anEPSGCodes[7];
+    double	adfProjParms[7];
+    char	szTRFCode[16];
+    int         nCTProjMethod;
+    char       *pszFilename = CPLStrdup(CSVFilename("projop_wparm.csv"));
+
+/* -------------------------------------------------------------------- */
+/*      Get the proj method.  If this fails to return a meaningful      */
+/*      number, then the whole function fails.                          */
+/* -------------------------------------------------------------------- */
+    sprintf( szTRFCode, "%d", nProjTRFCode );
+    nProjMethod =
+        atoi( CSVGetField( pszFilename,
+                           "COORD_OP_CODE", szTRFCode, CC_Integer,
+                           "COORD_OP_METHOD_CODE" ) );
+    if( nProjMethod == 0 )
+    {
+        CPLFree( pszFilename );
+        return FALSE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Initialize a definition of what EPSG codes need to be loaded    */
+/*      into what fields in adfProjParms.                               */
+/* -------------------------------------------------------------------- */
+    nCTProjMethod = EPSGProjMethodToCTProjMethod( nProjMethod );
+    SetGTParmIds( nCTProjMethod, NULL, anEPSGCodes );
+
+/* -------------------------------------------------------------------- */
+/*      Get the parameters for this projection.  For the time being     */
+/*      I am assuming the first four parameters are angles, the         */
+/*      fifth is unitless (normally scale), and the remainder are       */
+/*      linear measures.  This works fine for the existing              */
+/*      projections, but is a pretty fragile approach.                  */
+/* -------------------------------------------------------------------- */
+
+    for( i = 0; i < 7; i++ )
+    {
+        char    szParamUOMID[32], szParamValueID[32], szParamCodeID[32];
+        const char *pszValue;
+        int     nUOM;
+        int     nEPSGCode = anEPSGCodes[i];
+        int     iEPSG;
+
+        /* Establish default */
+        if( nEPSGCode == EPSGAngleRectifiedToSkewedGrid )
+            adfProjParms[i] = 90.0;
+        else if( nEPSGCode == EPSGNatOriginScaleFactor
+                 || nEPSGCode == EPSGInitialLineScaleFactor
+                 || nEPSGCode == EPSGPseudoStdParallelScaleFactor )
+            adfProjParms[i] = 1.0;
+        else
+            adfProjParms[i] = 0.0;
+
+        /* If there is no parameter, skip */
+        if( nEPSGCode == 0 )
+            continue;
+
+        /* Find the matching parameter */
+        for( iEPSG = 0; iEPSG < 7; iEPSG++ )
+        {
+            sprintf( szParamCodeID, "PARAMETER_CODE_%d", iEPSG+1 );
+
+            if( atoi(CSVGetField( pszFilename,
+                                  "COORD_OP_CODE", szTRFCode, CC_Integer, 
+                                  szParamCodeID )) == nEPSGCode )
+                break;
+        }
+
+        /* not found, accept the default */
+        if( iEPSG == 7 )
+            continue;
+
+        /* Get the value, and UOM */
+        sprintf( szParamUOMID, "PARAMETER_UOM_%d", iEPSG+1 );
+        sprintf( szParamValueID, "PARAMETER_VALUE_%d", iEPSG+1 );
+
+        nUOM = atoi(CSVGetField( pszFilename,
+                                 "COORD_OP_CODE", szTRFCode, CC_Integer, 
+                                 szParamUOMID ));
+        pszValue = CSVGetField( pszFilename,
+                                "COORD_OP_CODE", szTRFCode, CC_Integer, 
+                                szParamValueID );
+
+        /* Transform according to the UOM */
+        if( nUOM >= 9100 && nUOM < 9200 )
+            adfProjParms[i] = GTIFAngleStringToDD( pszValue, nUOM );
+        else if( nUOM > 9000 && nUOM < 9100 )
+        {
+            double dfInMeters;
+
+            if( !GTIFGetUOMLengthInfo( nUOM, NULL, &dfInMeters ) )
+                dfInMeters = 1.0;
+            adfProjParms[i] = atof(pszValue) * dfInMeters;
+        }
+        else
+            adfProjParms[i] = atof(pszValue);
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Get the name, if requested.                                     */
+/* -------------------------------------------------------------------- */
+    if( ppszProjTRFName != NULL )
+    {
+        *ppszProjTRFName =
+            CPLStrdup(CSVGetField( pszFilename,
+                                   "COORD_OP_CODE", szTRFCode, CC_Integer,
+                                   "COORD_OP_NAME" ));
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      Transfer requested data into passed variables.                  */
+/* -------------------------------------------------------------------- */
+    if( pnProjMethod != NULL )
+        *pnProjMethod = (short) nProjMethod;
+
+    if( padfProjParms != NULL )
+    {
+        for( i = 0; i < 7; i++ )
+            padfProjParms[i] = adfProjParms[i];
+    }
+
+    CPLFree( pszFilename );
+
+    return TRUE;
+}
+
+/************************************************************************/
+/*                         GTIFFetchProjParms()                         */
+/*                                                                      */
+/*      Fetch the projection parameters for a particular projection     */
+/*      from a GeoTIFF file, and fill the GTIFDefn structure out        */
+/*      with them.                                                      */
+/************************************************************************/
+
+static void GTIFFetchProjParms( GTIF * psGTIF, GTIFDefn * psDefn )
+
+{
+    double dfNatOriginLong = 0.0, dfNatOriginLat = 0.0, dfRectGridAngle = 0.0;
+    double dfFalseEasting = 0.0, dfFalseNorthing = 0.0, dfNatOriginScale = 1.0;
+    double dfStdParallel1 = 0.0, dfStdParallel2 = 0.0, dfAzimuth = 0.0;
+
+/* -------------------------------------------------------------------- */
+/*      Get the false easting, and northing if available.               */
+/* -------------------------------------------------------------------- */
+    if( !GTIFKeyGet(psGTIF, ProjFalseEastingGeoKey, &dfFalseEasting, 0, 1)
+        && !GTIFKeyGet(psGTIF, ProjCenterEastingGeoKey,
+                       &dfFalseEasting, 0, 1) 
+        && !GTIFKeyGet(psGTIF, ProjFalseOriginEastingGeoKey,
+                       &dfFalseEasting, 0, 1) )
+        dfFalseEasting = 0.0;
+        
+    if( !GTIFKeyGet(psGTIF, ProjFalseNorthingGeoKey, &dfFalseNorthing,0,1)
+        && !GTIFKeyGet(psGTIF, ProjCenterNorthingGeoKey,
+                       &dfFalseNorthing, 0, 1)
+        && !GTIFKeyGet(psGTIF, ProjFalseOriginNorthingGeoKey,
+                       &dfFalseNorthing, 0, 1) )
+        dfFalseNorthing = 0.0;
+        
+    switch( psDefn->CTProjection )
+    {
+/* -------------------------------------------------------------------- */
+      case CT_Stereographic:
+/* -------------------------------------------------------------------- */
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey, 
+                       &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0 )
+            dfNatOriginLong = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey, 
+                       &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0 )
+            dfNatOriginLat = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjScaleAtNatOriginGeoKey,
+                       &dfNatOriginScale, 0, 1 ) == 0 )
+            dfNatOriginScale = 1.0;
+            
+        /* notdef: should transform to decimal degrees at this point */
+
+        psDefn->ProjParm[0] = dfNatOriginLat;
+        psDefn->ProjParmId[0] = ProjCenterLatGeoKey;
+        psDefn->ProjParm[1] = dfNatOriginLong;
+        psDefn->ProjParmId[1] = ProjCenterLongGeoKey;
+        psDefn->ProjParm[4] = dfNatOriginScale;
+        psDefn->ProjParmId[4] = ProjScaleAtNatOriginGeoKey;
+        psDefn->ProjParm[5] = dfFalseEasting;
+        psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
+        psDefn->ProjParm[6] = dfFalseNorthing;
+        psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        psDefn->nParms = 7;
+        break;
+
+/* -------------------------------------------------------------------- */
+      case CT_LambertConfConic_1SP:
+      case CT_Mercator:
+      case CT_ObliqueStereographic:
+      case CT_TransverseMercator:
+      case CT_TransvMercator_SouthOriented:
+/* -------------------------------------------------------------------- */
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey, 
+                       &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0 )
+            dfNatOriginLong = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey, 
+                       &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0 )
+            dfNatOriginLat = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjScaleAtNatOriginGeoKey,
+                       &dfNatOriginScale, 0, 1 ) == 0 )
+            dfNatOriginScale = 1.0;
+            
+        /* notdef: should transform to decimal degrees at this point */
+
+        psDefn->ProjParm[0] = dfNatOriginLat;
+        psDefn->ProjParmId[0] = ProjNatOriginLatGeoKey;
+        psDefn->ProjParm[1] = dfNatOriginLong;
+        psDefn->ProjParmId[1] = ProjNatOriginLongGeoKey;
+        psDefn->ProjParm[4] = dfNatOriginScale;
+        psDefn->ProjParmId[4] = ProjScaleAtNatOriginGeoKey;
+        psDefn->ProjParm[5] = dfFalseEasting;
+        psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
+        psDefn->ProjParm[6] = dfFalseNorthing;
+        psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        psDefn->nParms = 7;
+        break;
+
+/* -------------------------------------------------------------------- */
+      case CT_ObliqueMercator: /* hotine */
+/* -------------------------------------------------------------------- */
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey, 
+                       &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0 )
+            dfNatOriginLong = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey, 
+                       &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0 )
+            dfNatOriginLat = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjAzimuthAngleGeoKey, 
+                       &dfAzimuth, 0, 1 ) == 0 )
+            dfAzimuth = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjRectifiedGridAngleGeoKey,
+                       &dfRectGridAngle, 0, 1 ) == 0 )
+            dfRectGridAngle = 90.0;
+
+        if( GTIFKeyGet(psGTIF, ProjScaleAtNatOriginGeoKey,
+                       &dfNatOriginScale, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjScaleAtCenterGeoKey,
+                          &dfNatOriginScale, 0, 1 ) == 0 )
+            dfNatOriginScale = 1.0;
+            
+        /* notdef: should transform to decimal degrees at this point */
+
+        psDefn->ProjParm[0] = dfNatOriginLat;
+        psDefn->ProjParmId[0] = ProjCenterLatGeoKey;
+        psDefn->ProjParm[1] = dfNatOriginLong;
+        psDefn->ProjParmId[1] = ProjCenterLongGeoKey;
+        psDefn->ProjParm[2] = dfAzimuth;
+        psDefn->ProjParmId[2] = ProjAzimuthAngleGeoKey;
+        psDefn->ProjParm[3] = dfRectGridAngle;
+        psDefn->ProjParmId[3] = ProjRectifiedGridAngleGeoKey;
+        psDefn->ProjParm[4] = dfNatOriginScale;
+        psDefn->ProjParmId[4] = ProjScaleAtCenterGeoKey;
+        psDefn->ProjParm[5] = dfFalseEasting;
+        psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
+        psDefn->ProjParm[6] = dfFalseNorthing;
+        psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        psDefn->nParms = 7;
+        break;
+
+/* -------------------------------------------------------------------- */
+      case CT_CassiniSoldner:
+      case CT_Polyconic:
+/* -------------------------------------------------------------------- */
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey, 
+                       &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0 )
+            dfNatOriginLong = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey, 
+                       &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0 )
+            dfNatOriginLat = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjScaleAtNatOriginGeoKey,
+                       &dfNatOriginScale, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjScaleAtCenterGeoKey,
+                          &dfNatOriginScale, 0, 1 ) == 0 )
+            dfNatOriginScale = 1.0;
+            
+        /* notdef: should transform to decimal degrees at this point */
+
+        psDefn->ProjParm[0] = dfNatOriginLat;
+        psDefn->ProjParmId[0] = ProjNatOriginLatGeoKey;
+        psDefn->ProjParm[1] = dfNatOriginLong;
+        psDefn->ProjParmId[1] = ProjNatOriginLongGeoKey;
+        psDefn->ProjParm[4] = dfNatOriginScale;
+        psDefn->ProjParmId[4] = ProjScaleAtNatOriginGeoKey;
+        psDefn->ProjParm[5] = dfFalseEasting;
+        psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
+        psDefn->ProjParm[6] = dfFalseNorthing;
+        psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        psDefn->nParms = 7;
+        break;
+
+/* -------------------------------------------------------------------- */
+      case CT_AzimuthalEquidistant:
+      case CT_MillerCylindrical:
+      case CT_Equirectangular:
+      case CT_Gnomonic:
+      case CT_LambertAzimEqualArea:
+      case CT_Orthographic:
+      case CT_NewZealandMapGrid:
+/* -------------------------------------------------------------------- */
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey, 
+                       &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0 )
+            dfNatOriginLong = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey, 
+                       &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0 )
+            dfNatOriginLat = 0.0;
+
+        /* notdef: should transform to decimal degrees at this point */
+
+        psDefn->ProjParm[0] = dfNatOriginLat;
+        psDefn->ProjParmId[0] = ProjCenterLatGeoKey;
+        psDefn->ProjParm[1] = dfNatOriginLong;
+        psDefn->ProjParmId[1] = ProjCenterLongGeoKey;
+        psDefn->ProjParm[5] = dfFalseEasting;
+        psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
+        psDefn->ProjParm[6] = dfFalseNorthing;
+        psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        psDefn->nParms = 7;
+        break;
+
+/* -------------------------------------------------------------------- */
+      case CT_Robinson:
+      case CT_Sinusoidal:
+      case CT_VanDerGrinten:
+/* -------------------------------------------------------------------- */
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey, 
+                       &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0 )
+            dfNatOriginLong = 0.0;
+
+        /* notdef: should transform to decimal degrees at this point */
+
+        psDefn->ProjParm[1] = dfNatOriginLong;
+        psDefn->ProjParmId[1] = ProjCenterLongGeoKey;
+        psDefn->ProjParm[5] = dfFalseEasting;
+        psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
+        psDefn->ProjParm[6] = dfFalseNorthing;
+        psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        psDefn->nParms = 7;
+        break;
+
+/* -------------------------------------------------------------------- */
+      case CT_PolarStereographic:
+/* -------------------------------------------------------------------- */
+        if( GTIFKeyGet(psGTIF, ProjStraightVertPoleLongGeoKey, 
+                       &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0 )
+            dfNatOriginLong = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey, 
+                       &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0 )
+            dfNatOriginLat = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjScaleAtNatOriginGeoKey,
+                       &dfNatOriginScale, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjScaleAtCenterGeoKey,
+                          &dfNatOriginScale, 0, 1 ) == 0 )
+            dfNatOriginScale = 1.0;
+            
+        /* notdef: should transform to decimal degrees at this point */
+
+        psDefn->ProjParm[0] = dfNatOriginLat;
+        psDefn->ProjParmId[0] = ProjNatOriginLatGeoKey;;
+        psDefn->ProjParm[1] = dfNatOriginLong;
+        psDefn->ProjParmId[1] = ProjStraightVertPoleLongGeoKey;
+        psDefn->ProjParm[4] = dfNatOriginScale;
+        psDefn->ProjParmId[4] = ProjScaleAtNatOriginGeoKey;
+        psDefn->ProjParm[5] = dfFalseEasting;
+        psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
+        psDefn->ProjParm[6] = dfFalseNorthing;
+        psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        psDefn->nParms = 7;
+        break;
+
+/* -------------------------------------------------------------------- */
+      case CT_LambertConfConic_2SP:
+/* -------------------------------------------------------------------- */
+        if( GTIFKeyGet(psGTIF, ProjStdParallel1GeoKey, 
+                       &dfStdParallel1, 0, 1 ) == 0 )
+            dfStdParallel1 = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjStdParallel2GeoKey, 
+                       &dfStdParallel2, 0, 1 ) == 0 )
+            dfStdParallel1 = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey, 
+                       &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0 )
+            dfNatOriginLong = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey, 
+                       &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0 )
+            dfNatOriginLat = 0.0;
+
+        /* notdef: should transform to decimal degrees at this point */
+
+        psDefn->ProjParm[0] = dfNatOriginLat;
+        psDefn->ProjParmId[0] = ProjFalseOriginLatGeoKey;
+        psDefn->ProjParm[1] = dfNatOriginLong;
+        psDefn->ProjParmId[1] = ProjFalseOriginLongGeoKey;
+        psDefn->ProjParm[2] = dfStdParallel1;
+        psDefn->ProjParmId[2] = ProjStdParallel1GeoKey;
+        psDefn->ProjParm[3] = dfStdParallel2;
+        psDefn->ProjParmId[3] = ProjStdParallel2GeoKey;
+        psDefn->ProjParm[5] = dfFalseEasting;
+        psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
+        psDefn->ProjParm[6] = dfFalseNorthing;
+        psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        psDefn->nParms = 7;
+        break;
+
+/* -------------------------------------------------------------------- */
+      case CT_AlbersEqualArea:
+      case CT_EquidistantConic:
+/* -------------------------------------------------------------------- */
+        if( GTIFKeyGet(psGTIF, ProjStdParallel1GeoKey, 
+                       &dfStdParallel1, 0, 1 ) == 0 )
+            dfStdParallel1 = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjStdParallel2GeoKey, 
+                       &dfStdParallel2, 0, 1 ) == 0 )
+            dfStdParallel2 = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey, 
+                       &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0 )
+            dfNatOriginLong = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey, 
+                       &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey, 
+                          &dfNatOriginLat, 0, 1 ) == 0 )
+            dfNatOriginLat = 0.0;
+
+        /* notdef: should transform to decimal degrees at this point */
+
+        psDefn->ProjParm[0] = dfStdParallel1;
+        psDefn->ProjParmId[0] = ProjStdParallel1GeoKey;
+        psDefn->ProjParm[1] = dfStdParallel2;
+        psDefn->ProjParmId[1] = ProjStdParallel2GeoKey;
+        psDefn->ProjParm[2] = dfNatOriginLat;
+        psDefn->ProjParmId[2] = ProjNatOriginLatGeoKey;
+        psDefn->ProjParm[3] = dfNatOriginLong;
+        psDefn->ProjParmId[3] = ProjNatOriginLongGeoKey;
+        psDefn->ProjParm[5] = dfFalseEasting;
+        psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
+        psDefn->ProjParm[6] = dfFalseNorthing;
+        psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        psDefn->nParms = 7;
+        break;
+
+/* -------------------------------------------------------------------- */
+      case CT_CylindricalEqualArea:
+/* -------------------------------------------------------------------- */
+        if( GTIFKeyGet(psGTIF, ProjStdParallel1GeoKey, 
+                       &dfStdParallel1, 0, 1 ) == 0 )
+            dfStdParallel1 = 0.0;
+
+        if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey, 
+                       &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0
+            && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey, 
+                          &dfNatOriginLong, 0, 1 ) == 0 )
+            dfNatOriginLong = 0.0;
+
+        /* notdef: should transform to decimal degrees at this point */
+
+        psDefn->ProjParm[0] = dfStdParallel1;
+        psDefn->ProjParmId[0] = ProjStdParallel1GeoKey;
+        psDefn->ProjParm[1] = dfNatOriginLong;
+        psDefn->ProjParmId[1] = ProjNatOriginLongGeoKey;
+        psDefn->ProjParm[5] = dfFalseEasting;
+        psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
+        psDefn->ProjParm[6] = dfFalseNorthing;
+        psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        psDefn->nParms = 7;
+        break;
+    }
+}
+
+/************************************************************************/
+/*                            GTIFGetDefn()                             */
+/************************************************************************/
+
+/**
+ at param psGTIF GeoTIFF information handle as returned by GTIFNew.
+ at param psDefn Pointer to an existing GTIFDefn structure.  This structure
+does not need to have been pre-initialized at all.
+
+ at return TRUE if the function has been successful, otherwise FALSE.
+
+This function reads the coordinate system definition from a GeoTIFF file,
+and <i>normalizes</i> it into a set of component information using 
+definitions from CSV (Comma Seperated Value ASCII) files derived from 
+EPSG tables.  This function is intended to simplify correct support for
+reading files with defined PCS (Projected Coordinate System) codes that
+wouldn't otherwise be directly known by application software by reducing
+it to the underlying projection method, parameters, datum, ellipsoid, 
+prime meridian and units.<p>
+
+The application should pass a pointer to an existing uninitialized 
+GTIFDefn structure, and GTIFGetDefn() will fill it in.  The fuction 
+currently always returns TRUE but in the future will return FALSE if 
+CSV files are not found.  In any event, all geokeys actually found in the
+file will be copied into the GTIFDefn.  However, if the CSV files aren't
+found codes implied by other codes will not be set properly.<p>
+
+GTIFGetDefn() will not generally work if the EPSG derived CSV files cannot
+be found.  By default a modest attempt will be made to find them, but 
+in general it is necessary for the calling application to override the
+logic to find them.  This can be done by calling the 
+SetCSVFilenameHook() function to
+override the search method based on application knowledge of where they are
+found.<p>
+
+The normalization methodology operates by fetching tags from the GeoTIFF
+file, and then setting all other tags implied by them in the structure.  The
+implied relationships are worked out by reading definitions from the 
+various EPSG derived CSV tables.<p>
+
+For instance, if a PCS (ProjectedCSTypeGeoKey) is found in the GeoTIFF file
+this code is used to lookup a record in the <tt>horiz_cs.csv</tt> CSV
+file.  For example given the PCS 26746 we can find the name
+(NAD27 / California zone VI), the GCS 4257 (NAD27), and the ProjectionCode
+10406 (California CS27 zone VI).  The GCS, and ProjectionCode can in turn
+be looked up in other tables until all the details of units, ellipsoid, 
+prime meridian, datum, projection (LambertConfConic_2SP) and projection
+parameters are established.  A full listgeo dump of a file 
+for this result might look like the following, all based on a single PCS
+value:<p>
+
+<pre>
+% listgeo -norm ~/data/geotiff/pci_eg/spaf27.tif
+Geotiff_Information:
+   Version: 1
+   Key_Revision: 1.0
+   Tagged_Information:
+      ModelTiepointTag (2,3):
+         0                0                0                
+         1577139.71       634349.176       0                
+      ModelPixelScaleTag (1,3):
+         195.509321       198.32184        0                
+      End_Of_Tags.
+   Keyed_Information:
+      GTModelTypeGeoKey (Short,1): ModelTypeProjected
+      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
+      ProjectedCSTypeGeoKey (Short,1): PCS_NAD27_California_VI
+      End_Of_Keys.
+   End_Of_Geotiff.
+
+PCS = 26746 (NAD27 / California zone VI)
+Projection = 10406 (California CS27 zone VI)
+Projection Method: CT_LambertConfConic_2SP
+   ProjStdParallel1GeoKey: 33.883333
+   ProjStdParallel2GeoKey: 32.766667
+   ProjFalseOriginLatGeoKey: 32.166667
+   ProjFalseOriginLongGeoKey: -116.233333
+   ProjFalseEastingGeoKey: 609601.219202
+   ProjFalseNorthingGeoKey: 0.000000
+GCS: 4267/NAD27
+Datum: 6267/North American Datum 1927
+Ellipsoid: 7008/Clarke 1866 (6378206.40,6356583.80)
+Prime Meridian: 8901/Greenwich (0.000000)
+Projection Linear Units: 9003/US survey foot (0.304801m)
+</pre>
+
+Note that GTIFGetDefn() does not inspect or return the tiepoints and scale.
+This must be handled seperately as it normally would.  It is intended to
+simplify capture and normalization of the coordinate system definition.  
+Note that GTIFGetDefn() also does the following things:
+
+<ol>
+<li> Convert all angular values to decimal degrees.
+<li> Convert all linear values to meters. 
+<li> Return the linear units and conversion to meters for the tiepoints and
+scale (though the tiepoints and scale remain in their native units). 
+<li> When reading projection parameters a variety of differences between
+different GeoTIFF generators are handled, and a normalized set of parameters
+for each projection are always returned.
+</ol>
+
+Code fields in the GTIFDefn are filled with KvUserDefined if there is not
+value to assign.  The parameter lists for each of the underlying projection
+transform methods can be found at the
+<a href="http://www.remotesensing.org/geotiff/proj_list">Projections</a>
+page.  Note that nParms will be set based on the maximum parameter used.
+Some of the parameters may not be used in which case the
+GTIFDefn::ProjParmId[] will
+be zero.  This is done to retain correspondence to the EPSG parameter
+numbering scheme.<p>
+
+The 
+<a href="http://www.remotesensing.org/cgi-bin/cvsweb.cgi/~checkout~/osrs/geotiff/libgeotiff/geotiff_proj4.c">geotiff_proj4.c</a> module distributed with libgeotiff can 
+be used as an example of code that converts a GTIFDefn into another projection
+system.<p>
+
+ at see GTIFKeySet(), SetCSVFilenameHook()
+
+*/
+
+int GTIFGetDefn( GTIF * psGTIF, GTIFDefn * psDefn )
+
+{
+    int		i;
+    short	nGeogUOMLinear;
+    double	dfInvFlattening;
+    
+/* -------------------------------------------------------------------- */
+/*      Initially we default all the information we can.                */
+/* -------------------------------------------------------------------- */
+    psDefn->Model = KvUserDefined;
+    psDefn->PCS = KvUserDefined;
+    psDefn->GCS = KvUserDefined;
+    psDefn->UOMLength = KvUserDefined;
+    psDefn->UOMLengthInMeters = 1.0;
+    psDefn->UOMAngle = KvUserDefined;
+    psDefn->UOMAngleInDegrees = 1.0;
+    psDefn->Datum = KvUserDefined;
+    psDefn->Ellipsoid = KvUserDefined;
+    psDefn->SemiMajor = 0.0;
+    psDefn->SemiMinor = 0.0;
+    psDefn->PM = KvUserDefined;
+    psDefn->PMLongToGreenwich = 0.0;
+
+    psDefn->ProjCode = KvUserDefined;
+    psDefn->Projection = KvUserDefined;
+    psDefn->CTProjection = KvUserDefined;
+
+    psDefn->nParms = 0;
+    for( i = 0; i < MAX_GTIF_PROJPARMS; i++ )
+    {
+        psDefn->ProjParm[i] = 0.0;
+        psDefn->ProjParmId[i] = 0;
+    }
+
+    psDefn->MapSys = KvUserDefined;
+    psDefn->Zone = 0;
+
+/* -------------------------------------------------------------------- */
+/*	Try to get the overall model type.				*/
+/* -------------------------------------------------------------------- */
+    GTIFKeyGet(psGTIF,GTModelTypeGeoKey,&(psDefn->Model),0,1);
+
+/* -------------------------------------------------------------------- */
+/*	Extract the Geog units.  					*/
+/* -------------------------------------------------------------------- */
+    nGeogUOMLinear = 9001; /* Linear_Meter */
+    GTIFKeyGet(psGTIF, GeogLinearUnitsGeoKey, &nGeogUOMLinear, 0, 1 );
+
+/* -------------------------------------------------------------------- */
+/*      Try to get a PCS.                                               */
+/* -------------------------------------------------------------------- */
+    if( GTIFKeyGet(psGTIF,ProjectedCSTypeGeoKey, &(psDefn->PCS),0,1) == 1
+        && psDefn->PCS != KvUserDefined )
+    {
+        /*
+         * Translate this into useful information.
+         */
+        GTIFGetPCSInfo( psDefn->PCS, NULL, &(psDefn->ProjCode),
+                        &(psDefn->UOMLength), &(psDefn->GCS) );
+    }
+
+/* -------------------------------------------------------------------- */
+/*       If we have the PCS code, but didn't find it in the CSV files   */
+/*      (likely because we can't find them) we will try some ``jiffy    */
+/*      rules'' for UTM and state plane.                                */
+/* -------------------------------------------------------------------- */
+    if( psDefn->PCS != KvUserDefined && psDefn->ProjCode == KvUserDefined )
+    {
+        int	nMapSys, nZone;
+        int	nGCS = psDefn->GCS;
+
+        nMapSys = GTIFPCSToMapSys( psDefn->PCS, &nGCS, &nZone );
+        if( nMapSys != KvUserDefined )
+        {
+            psDefn->ProjCode = (short) GTIFMapSysToProj( nMapSys, nZone );
+            psDefn->GCS = (short) nGCS;
+        }
+    }
+
+/* -------------------------------------------------------------------- */
+/*      If the Proj_ code is specified directly, use that.              */
+/* -------------------------------------------------------------------- */
+    if( psDefn->ProjCode == KvUserDefined )
+        GTIFKeyGet(psGTIF, ProjectionGeoKey, &(psDefn->ProjCode), 0, 1 );
+    
+    if( psDefn->ProjCode != KvUserDefined )
+    {
+        /*
+         * We have an underlying projection transformation value.  Look
+         * this up.  For a PCS of ``WGS 84 / UTM 11'' the transformation
+         * would be Transverse Mercator, with a particular set of options.
+         * The nProjTRFCode itself would correspond to the name
+         * ``UTM zone 11N'', and doesn't include datum info.
+         */
+        GTIFGetProjTRFInfo( psDefn->ProjCode, NULL, &(psDefn->Projection),
+                            psDefn->ProjParm );
+        
+        /*
+         * Set the GeoTIFF identity of the parameters.
+         */
+        psDefn->CTProjection = (short) 
+            EPSGProjMethodToCTProjMethod( psDefn->Projection );
+
+        SetGTParmIds( psDefn->CTProjection, psDefn->ProjParmId, NULL);
+        psDefn->nParms = 7;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Try to get a GCS.  If found, it will override any implied by    */
+/*      the PCS.                                                        */
+/* -------------------------------------------------------------------- */
+    GTIFKeyGet(psGTIF, GeographicTypeGeoKey, &(psDefn->GCS), 0, 1 );
+
+/* -------------------------------------------------------------------- */
+/*      Derive the datum, and prime meridian from the GCS.              */
+/* -------------------------------------------------------------------- */
+    if( psDefn->GCS != KvUserDefined )
+    {
+        GTIFGetGCSInfo( psDefn->GCS, NULL, &(psDefn->Datum), &(psDefn->PM),
+                        &(psDefn->UOMAngle) );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      Handle the GCS angular units.  GeogAngularUnitsGeoKey           */
+/*      overrides the GCS or PCS setting.                               */
+/* -------------------------------------------------------------------- */
+    GTIFKeyGet(psGTIF, GeogAngularUnitsGeoKey, &(psDefn->UOMAngle), 0, 1 );
+    if( psDefn->UOMAngle != KvUserDefined )
+    {
+        GTIFGetUOMAngleInfo( psDefn->UOMAngle, NULL,
+                             &(psDefn->UOMAngleInDegrees) );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Check for a datum setting, and then use the datum to derive     */
+/*      an ellipsoid.                                                   */
+/* -------------------------------------------------------------------- */
+    GTIFKeyGet(psGTIF, GeogGeodeticDatumGeoKey, &(psDefn->Datum), 0, 1 );
+
+    if( psDefn->Datum != KvUserDefined )
+    {
+        GTIFGetDatumInfo( psDefn->Datum, NULL, &(psDefn->Ellipsoid) );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Check for an explicit ellipsoid.  Use the ellipsoid to          */
+/*      derive the ellipsoid characteristics, if possible.              */
+/* -------------------------------------------------------------------- */
+    GTIFKeyGet(psGTIF, GeogEllipsoidGeoKey, &(psDefn->Ellipsoid), 0, 1 );
+
+    if( psDefn->Ellipsoid != KvUserDefined )
+    {
+        GTIFGetEllipsoidInfo( psDefn->Ellipsoid, NULL,
+                              &(psDefn->SemiMajor), &(psDefn->SemiMinor) );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Check for overridden ellipsoid parameters.  It would be nice    */
+/*      to warn if they conflict with provided information, but for     */
+/*      now we just override.                                           */
+/* -------------------------------------------------------------------- */
+    GTIFKeyGet(psGTIF, GeogSemiMajorAxisGeoKey, &(psDefn->SemiMajor), 0, 1 );
+    GTIFKeyGet(psGTIF, GeogSemiMinorAxisGeoKey, &(psDefn->SemiMinor), 0, 1 );
+    
+    if( GTIFKeyGet(psGTIF, GeogInvFlatteningGeoKey, &dfInvFlattening, 
+                   0, 1 ) == 1 )
+    {
+        if( dfInvFlattening != 0.0 )
+            psDefn->SemiMinor = 
+                psDefn->SemiMajor * (1 - 1.0/dfInvFlattening);
+        else
+            psDefn->SemiMinor = psDefn->SemiMajor;
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      Get the prime meridian info.                                    */
+/* -------------------------------------------------------------------- */
+    GTIFKeyGet(psGTIF, GeogPrimeMeridianGeoKey, &(psDefn->PM), 0, 1 );
+
+    if( psDefn->PM != KvUserDefined )
+    {
+        GTIFGetPMInfo( psDefn->PM, NULL, &(psDefn->PMLongToGreenwich) );
+    }
+    else
+    {
+        GTIFKeyGet(psGTIF, GeogPrimeMeridianLongGeoKey,
+                   &(psDefn->PMLongToGreenwich), 0, 1 );
+
+        psDefn->PMLongToGreenwich =
+            GTIFAngleToDD( psDefn->PMLongToGreenwich,
+                           psDefn->UOMAngle );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Have the projection units of measure been overridden?  We       */
+/*      should likely be doing something about angular units too,       */
+/*      but these are very rarely not decimal degrees for actual        */
+/*      file coordinates.                                               */
+/* -------------------------------------------------------------------- */
+    GTIFKeyGet(psGTIF,ProjLinearUnitsGeoKey,&(psDefn->UOMLength),0,1);
+
+    if( psDefn->UOMLength != KvUserDefined )
+    {
+        GTIFGetUOMLengthInfo( psDefn->UOMLength, NULL,
+                              &(psDefn->UOMLengthInMeters) );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Handle a variety of user defined transform types.               */
+/* -------------------------------------------------------------------- */
+    if( GTIFKeyGet(psGTIF,ProjCoordTransGeoKey,
+                   &(psDefn->CTProjection),0,1) == 1)
+    {
+        GTIFFetchProjParms( psGTIF, psDefn );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Try to set the zoned map system information.                    */
+/* -------------------------------------------------------------------- */
+    psDefn->MapSys = GTIFProjToMapSys( psDefn->ProjCode, &(psDefn->Zone) );
+
+/* -------------------------------------------------------------------- */
+/*      If this is UTM, and we were unable to extract the projection    */
+/*      parameters from the CSV file, just set them directly now,       */
+/*      since it's pretty easy, and a common case.                      */
+/* -------------------------------------------------------------------- */
+    if( (psDefn->MapSys == MapSys_UTM_North
+         || psDefn->MapSys == MapSys_UTM_South)
+        && psDefn->CTProjection == KvUserDefined )
+    {
+        psDefn->CTProjection = CT_TransverseMercator;
+        psDefn->nParms = 7;
+        psDefn->ProjParmId[0] = ProjNatOriginLatGeoKey;
+        psDefn->ProjParm[0] = 0.0;
+            
+        psDefn->ProjParmId[1] = ProjNatOriginLongGeoKey;
+        psDefn->ProjParm[1] = psDefn->Zone*6 - 183.0;
+        
+        psDefn->ProjParmId[4] = ProjScaleAtNatOriginGeoKey;
+        psDefn->ProjParm[4] = 0.9996;
+        
+        psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
+        psDefn->ProjParm[5] = 500000.0;
+        
+        psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
+
+        if( psDefn->MapSys == MapSys_UTM_North )
+            psDefn->ProjParm[6] = 0.0;
+        else
+            psDefn->ProjParm[6] = 10000000.0;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      For now we forceable deaccess all CSV files to reduce the       */
+/*      chance of "leakage".  Really, this should be application        */
+/*      controlled.                                                     */
+/* -------------------------------------------------------------------- */
+    CSVDeaccess( NULL );
+
+    return TRUE;
+}
+
+/************************************************************************/
+/*                            GTIFDecToDMS()                            */
+/*                                                                      */
+/*      Convenient function to translate decimal degrees to DMS         */
+/*      format for reporting to a user.                                 */
+/************************************************************************/
+
+const char *GTIFDecToDMS( double dfAngle, const char * pszAxis,
+                          int nPrecision )
+
+{
+    int		nDegrees, nMinutes;
+    double	dfSeconds;
+    char	szFormat[30];
+    static char szBuffer[50];
+    const char	*pszHemisphere = NULL;
+    double	dfRound;
+    int		i;
+
+    dfRound = 0.5/60;
+    for( i = 0; i < nPrecision; i++ )
+        dfRound = dfRound * 0.1;
+
+    nDegrees = (int) ABS(dfAngle);
+    nMinutes = (int) ((ABS(dfAngle) - nDegrees) * 60 + dfRound);
+    dfSeconds = ABS((ABS(dfAngle) * 3600 - nDegrees*3600 - nMinutes*60));
+
+    if( EQUAL(pszAxis,"Long") && dfAngle < 0.0 )
+        pszHemisphere = "W";
+    else if( EQUAL(pszAxis,"Long") )
+        pszHemisphere = "E";
+    else if( dfAngle < 0.0 )
+        pszHemisphere = "S";
+    else
+        pszHemisphere = "N";
+
+    sprintf( szFormat, "%%3dd%%2d\'%%%d.%df\"%s",
+             nPrecision+3, nPrecision, pszHemisphere );
+    sprintf( szBuffer, szFormat, nDegrees, nMinutes, dfSeconds );
+
+    return( szBuffer );
+}
+
+/************************************************************************/
+/*                           GTIFPrintDefn()                            */
+/*                                                                      */
+/*      Report the contents of a GTIFDefn structure ... mostly for      */
+/*      debugging.                                                      */
+/************************************************************************/
+
+void GTIFPrintDefn( GTIFDefn * psDefn, FILE * fp )
+
+{
+/* -------------------------------------------------------------------- */
+/*      Get the PCS name if possible.                                   */
+/* -------------------------------------------------------------------- */
+    if( psDefn->PCS != KvUserDefined )
+    {
+        char	*pszPCSName = NULL;
+    
+        GTIFGetPCSInfo( psDefn->PCS, &pszPCSName, NULL, NULL, NULL );
+        if( pszPCSName == NULL )
+            pszPCSName = CPLStrdup("name unknown");
+        
+        fprintf( fp, "PCS = %d (%s)\n", psDefn->PCS, pszPCSName );
+        CPLFree( pszPCSName );
+    }
+
+/* -------------------------------------------------------------------- */
+/*	Dump the projection code if possible.				*/
+/* -------------------------------------------------------------------- */
+    if( psDefn->ProjCode != KvUserDefined )
+    {
+        char	*pszTRFName = NULL;
+
+        GTIFGetProjTRFInfo( psDefn->ProjCode, &pszTRFName, NULL, NULL );
+        if( pszTRFName == NULL )
+            pszTRFName = CPLStrdup("");
+                
+        fprintf( fp, "Projection = %d (%s)\n",
+                 psDefn->ProjCode, pszTRFName );
+
+        CPLFree( pszTRFName );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Try to dump the projection method name, and parameters if possible.*/
+/* -------------------------------------------------------------------- */
+    if( psDefn->CTProjection != KvUserDefined )
+    {
+        char	*pszName = GTIFValueName(ProjCoordTransGeoKey,
+                                         psDefn->CTProjection);
+        int     i;
+
+        if( pszName == NULL )
+            pszName = "(unknown)";
+            
+        fprintf( fp, "Projection Method: %s\n", pszName );
+
+        for( i = 0; i < psDefn->nParms; i++ )
+        {
+            if( psDefn->ProjParmId[i] == 0 )
+                continue;
+
+            pszName = GTIFKeyName((geokey_t) psDefn->ProjParmId[i]);
+            if( pszName == NULL )
+                pszName = "(unknown)";
+
+            if( i < 4 )
+            {
+                char	*pszAxisName;
+                
+                if( strstr(pszName,"Long") != NULL )
+                    pszAxisName = "Long";
+                else if( strstr(pszName,"Lat") != NULL )
+                    pszAxisName = "Lat";
+                else
+                    pszAxisName = "?";
+                
+                fprintf( fp, "   %s: %f (%s)\n",
+                         pszName, psDefn->ProjParm[i],
+                         GTIFDecToDMS( psDefn->ProjParm[i], pszAxisName, 2 ) );
+            }
+            else if( i == 4 )
+                fprintf( fp, "   %s: %f\n", pszName, psDefn->ProjParm[i] );
+            else
+                fprintf( fp, "   %s: %f m\n", pszName, psDefn->ProjParm[i] );
+        }
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Report the GCS name, and number.                                */
+/* -------------------------------------------------------------------- */
+    if( psDefn->GCS != KvUserDefined )
+    {
+        char	*pszName = NULL;
+
+        GTIFGetGCSInfo( psDefn->GCS, &pszName, NULL, NULL, NULL );
+        if( pszName == NULL )
+            pszName = CPLStrdup("(unknown)");
+        
+        fprintf( fp, "GCS: %d/%s\n", psDefn->GCS, pszName );
+        CPLFree( pszName );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Report the datum name.                                          */
+/* -------------------------------------------------------------------- */
+    if( psDefn->Datum != KvUserDefined )
+    {
+        char	*pszName = NULL;
+
+        GTIFGetDatumInfo( psDefn->Datum, &pszName, NULL );
+        if( pszName == NULL )
+            pszName = CPLStrdup("(unknown)");
+        
+        fprintf( fp, "Datum: %d/%s\n", psDefn->Datum, pszName );
+        CPLFree( pszName );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Report the ellipsoid.                                           */
+/* -------------------------------------------------------------------- */
+    if( psDefn->Ellipsoid != KvUserDefined )
+    {
+        char	*pszName = NULL;
+
+        GTIFGetEllipsoidInfo( psDefn->Ellipsoid, &pszName, NULL, NULL );
+        if( pszName == NULL )
+            pszName = CPLStrdup("(unknown)");
+        
+        fprintf( fp, "Ellipsoid: %d/%s (%.2f,%.2f)\n",
+                 psDefn->Ellipsoid, pszName,
+                 psDefn->SemiMajor, psDefn->SemiMinor );
+        CPLFree( pszName );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      Report the prime meridian.                                      */
+/* -------------------------------------------------------------------- */
+    if( psDefn->PM != KvUserDefined )
+    {
+        char	*pszName = NULL;
+
+        GTIFGetPMInfo( psDefn->PM, &pszName, NULL );
+
+        if( pszName == NULL )
+            pszName = CPLStrdup("(unknown)");
+        
+        fprintf( fp, "Prime Meridian: %d/%s (%f/%s)\n",
+                 psDefn->PM, pszName,
+                 psDefn->PMLongToGreenwich,
+                 GTIFDecToDMS( psDefn->PMLongToGreenwich, "Long", 2 ) );
+        CPLFree( pszName );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Report the projection units of measure (currently just          */
+/*      linear).                                                        */
+/* -------------------------------------------------------------------- */
+    if( psDefn->UOMLength != KvUserDefined )
+    {
+        char	*pszName = NULL;
+
+        GTIFGetUOMLengthInfo( psDefn->UOMLength, &pszName, NULL );
+        if( pszName == NULL )
+            pszName = CPLStrdup( "(unknown)" );
+        
+        fprintf( fp, "Projection Linear Units: %d/%s (%fm)\n",
+                 psDefn->UOMLength, pszName, psDefn->UOMLengthInMeters );
+        CPLFree( pszName );
+    }
+
+    CSVDeaccess( NULL );
+}
+
+/************************************************************************/
+/*                           GTIFFreeMemory()                           */
+/*                                                                      */
+/*      Externally visible function to free memory allocated within     */
+/*      geo_normalize.c.                                                */
+/************************************************************************/
+
+void GTIFFreeMemory( char * pMemory )
+
+{
+    if( pMemory != NULL )
+        VSIFree( pMemory );
+}
+
+/************************************************************************/
+/*                          GTIFDeaccessCSV()                           */
+/*                                                                      */
+/*      Free all cached CSV info.                                       */
+/************************************************************************/
+
+void GTIFDeaccessCSV()
+
+{
+    CSVDeaccess( NULL );
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_normalize.h
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_normalize.h	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_normalize.h	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,238 @@
+/******************************************************************************
+ * $Id: geo_normalize.h,v 1.12 2005/08/26 16:08:14 fwarmerdam Exp $
+ *
+ * Project:  libgeotiff
+ * Purpose:  Include file related to geo_normalize.c containing Code to
+ *           normalize PCS and other composite codes in a GeoTIFF file.
+ * 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: geo_normalize.h,v $
+ * Revision 1.12  2005/08/26 16:08:14  fwarmerdam
+ * Include void in empty argument list for prototype.
+ *
+ * Revision 1.11  2004/02/03 17:19:50  warmerda
+ * export GTIFAngleToDD() - used by GDAL mrsiddataset.cpp
+ *
+ * Revision 1.10  2003/01/15 04:39:16  warmerda
+ * Added GTIFDeaccessCSV
+ *
+ * Revision 1.9  2003/01/15 03:37:40  warmerda
+ * added GTIFFreeMemory()
+ *
+ * Revision 1.8  2002/11/28 22:27:42  warmerda
+ * preliminary upgrade to EPSG 6.2.2 tables
+ *
+ * Revision 1.7  1999/09/17 00:55:26  warmerda
+ * added GTIFGetUOMAngleInfo(), and UOMAngle in GTIFDefn
+ *
+ * Revision 1.6  1999/05/04 03:13:42  warmerda
+ * Added prototype
+ *
+ * Revision 1.5  1999/04/29 23:02:55  warmerda
+ * added docs, and MapSys related stuff
+ *
+ * Revision 1.4  1999/03/18 21:35:19  geotiff
+ * Added PROJ.4 related stuff
+ *
+ * Revision 1.3  1999/03/17 20:44:04  geotiff
+ * added CPL_DLL related support
+ *
+ * Revision 1.2  1999/03/10 18:24:06  geotiff
+ * corrected to use int'
+ *
+ */
+
+#ifndef GEO_NORMALIZE_H_INCLUDED
+#define GEO_NORMALIZE_H_INCLUDED
+
+#include <stdio.h>
+#include "geotiff.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \file geo_normalize.h
+ *
+ * Include file for extended projection definition normalization api.
+ */
+    
+#define MAX_GTIF_PROJPARMS 	10
+
+/**
+ * Holds a definition of a coordinate system in normalized form.
+ */
+
+typedef struct {
+    /** From GTModelTypeGeoKey tag.  Can have the values ModelTypeGeographic
+        or ModelTypeProjected. */
+    short	Model;
+
+    /** From ProjectedCSTypeGeoKey tag.  For example PCS_NAD27_UTM_zone_3N.*/
+    short	PCS;
+
+    /** From GeographicTypeGeoKey tag.  For example GCS_WGS_84 or
+        GCS_Voirol_1875_Paris.  Includes datum and prime meridian value. */
+    short	GCS;	      
+
+    /** From ProjLinearUnitsGeoKey.  For example Linear_Meter. */
+    short	UOMLength;
+
+    /** One UOMLength = UOMLengthInMeters meters. */
+    double	UOMLengthInMeters;
+
+    /** The angular units of the GCS. */
+    short       UOMAngle;
+
+    /** One UOMAngle = UOMLengthInDegrees degrees. */
+    double      UOMAngleInDegrees;
+    
+    /** Datum from GeogGeodeticDatumGeoKey tag. For example Datum_WGS84 */
+    short	Datum;
+
+    /** Prime meridian from GeogPrimeMeridianGeoKey.  For example PM_Greenwich
+        or PM_Paris. */
+    short	PM;
+
+    /** Decimal degrees of longitude between this prime meridian and
+        Greenwich.  Prime meridians to the west of Greenwich are negative. */
+    double	PMLongToGreenwich;
+
+    /** Ellipsoid identifier from GeogELlipsoidGeoKey.  For example
+        Ellipse_Clarke_1866. */
+    short	Ellipsoid;
+
+    /** The length of the semi major ellipse axis in meters. */
+    double	SemiMajor;
+
+    /** The length of the semi minor ellipse axis in meters. */
+    double	SemiMinor;
+
+    /** Projection id from ProjectionGeoKey.  For example Proj_UTM_11S. */
+    short	ProjCode;
+
+    /** EPSG identifier for underlying projection method.  From the EPSG
+        TRF_METHOD table.  */
+    short	Projection;
+
+    /** GeoTIFF identifier for underlying projection method.  While some of
+      these values have corresponding vlaues in EPSG (Projection field),
+      others do not.  For example CT_TransverseMercator. */
+    short	CTProjection;   
+
+    /** Number of projection parameters in ProjParm and ProjParmId. */
+    int		nParms;
+
+    /** Projection parameter value.  The identify of this parameter
+        is established from the corresponding entry in ProjParmId.  The
+        value will be measured in meters, or decimal degrees if it is a
+        linear or angular measure. */
+    double	ProjParm[MAX_GTIF_PROJPARMS];
+
+    /** Projection parameter identifier.  For example ProjFalseEastingGeoKey.
+        The value will be 0 for unused table entries. */
+    int		ProjParmId[MAX_GTIF_PROJPARMS]; /* geokey identifier,
+                                                   eg. ProjFalseEastingGeoKey*/
+
+    /** Special zone map system code (MapSys_UTM_South, MapSys_UTM_North,
+        MapSys_State_Plane or KvUserDefined if none apply. */
+    int		MapSys;
+
+    /** UTM, or State Plane Zone number, zero if not known. */
+    int		Zone;
+
+} GTIFDefn;
+
+int CPL_DLL GTIFGetPCSInfo( int nPCSCode, char **ppszEPSGName,
+                            short *pnProjOp, 
+                            short *pnUOMLengthCode, short *pnGeogCS );
+int CPL_DLL GTIFGetProjTRFInfo( int nProjTRFCode,
+                                char ** ppszProjTRFName,
+                                short * pnProjMethod,
+                                double * padfProjParms );
+int CPL_DLL GTIFGetGCSInfo( int nGCSCode, char **ppszName,
+                            short *pnDatum, short *pnPM, short *pnUOMAngle );
+int CPL_DLL GTIFGetDatumInfo( int nDatumCode, char **ppszName,
+                              short * pnEllipsoid );
+int CPL_DLL GTIFGetEllipsoidInfo( int nEllipsoid, char ** ppszName,
+                                  double * pdfSemiMajor,
+                                  double * pdfSemiMinor );
+int CPL_DLL GTIFGetPMInfo( int nPM, char **ppszName,
+                           double * pdfLongToGreenwich );
+
+double CPL_DLL GTIFAngleStringToDD( const char *pszAngle, int nUOMAngle );
+int CPL_DLL GTIFGetUOMLengthInfo( int nUOMLengthCode,
+                                  char **ppszUOMName,
+                                  double * pdfInMeters );
+int CPL_DLL GTIFGetUOMAngleInfo( int nUOMAngleCode,
+                                 char **ppszUOMName,
+                                 double * pdfInDegrees );
+double CPL_DLL GTIFAngleToDD( double dfAngle, int nUOMAngle );
+    
+
+/* this should be used to free strings returned by GTIFGet... funcs */
+void CPL_DLL GTIFFreeMemory( char * );
+void CPL_DLL GTIFDeaccessCSV( void );
+
+int CPL_DLL GTIFGetDefn( GTIF *psGTIF, GTIFDefn * psDefn );
+void CPL_DLL GTIFPrintDefn( GTIFDefn *, FILE * );
+void CPL_DLL GTIFFreeDefn( GTIF * );
+
+void CPL_DLL SetCSVFilenameHook( const char *(*CSVFileOverride)(const char *) );
+
+const char CPL_DLL *GTIFDecToDMS( double, const char *, int );
+
+/*
+ * These are useful for recognising UTM and State Plane, with or without
+ * CSV files being found.
+ */
+
+#define MapSys_UTM_North	-9001
+#define MapSys_UTM_South	-9002
+#define MapSys_State_Plane_27	-9003
+#define MapSys_State_Plane_83	-9004
+
+int CPL_DLL   GTIFMapSysToPCS( int MapSys, int Datum, int nZone );
+int CPL_DLL   GTIFMapSysToProj( int MapSys, int nZone );
+int CPL_DLL   GTIFPCSToMapSys( int PCSCode, int * pDatum, int * pZone );
+int CPL_DLL   GTIFProjToMapSys( int ProjCode, int * pZone );
+
+/*
+ * These are only useful if using libgeotiff with libproj (PROJ.4+).
+ */
+char CPL_DLL *GTIFGetProj4Defn( GTIFDefn * );
+int  CPL_DLL  GTIFProj4ToLatLong( GTIFDefn *, int, double *, double * );
+int  CPL_DLL  GTIFProj4FromLatLong( GTIFDefn *, int, double *, double * );
+
+#if defined(HAVE_LIBPROJ) && defined(HAVE_PROJECTS_H)
+#  define HAVE_GTIFPROJ4
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+    
+#endif /* ndef GEO_NORMALIZE_H_INCLUDED */

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_print.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_print.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_print.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,517 @@
+/**********************************************************************
+ *
+ *  geo_print.c  -- Key-dumping routines for GEOTIFF files.
+ *
+ *    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.
+ *
+ *  Revision History;
+ *
+ *    20 June,  1995      Niles D. Ritter      New
+ *     7 July,  1995      NDR                  Fix indexing
+ *    27 July,  1995      NDR                  Added Import utils
+ *    28 July,  1995      NDR                  Made parser more strict.
+ *    29  Sep,  1995      NDR                  Fixed matrix printing.
+ *
+ * $Log: geo_print.c,v $
+ * Revision 1.9  2004/10/19 14:24:09  fwarmerdam
+ * dynamically allocate tag list so large lists work: Oliver Colin
+ *
+ * Revision 1.8  2004/04/27 21:31:31  warmerda
+ * avoid crash if gt_tif is NULL
+ *
+ * Revision 1.7  2003/10/21 19:19:53  warmerda
+ * fixed bug with large message texts sometimes causing a crash
+ *
+ * Revision 1.6  2003/09/23 18:27:30  warmerda
+ * fixed bug with long datum names: bug 399
+ *
+ * Revision 1.5  2003/07/08 17:31:30  warmerda
+ * cleanup various warnings
+ *
+ * Revision 1.4  2002/05/31 14:27:26  warmerda
+ * added escaping in metadata for string key values
+ *
+ * Revision 1.3  1999/05/04 03:14:35  warmerda
+ * avoid warnings
+ *
+ * Revision 1.2  1999/05/03 17:50:31  warmerda
+ * avoid warnings on IRIX
+ *
+ *
+ **********************************************************************/
+
+#include "geotiff.h"   /* public interface        */
+#include "geo_tiffp.h" /* external TIFF interface */
+#include "geo_keyp.h"  /* private interface       */
+#include "geokeys.h"
+
+#include <stdio.h>     /* for sprintf             */
+
+#define FMT_GEOTIFF "Geotiff_Information:"
+#define FMT_VERSION "Version: %hd"
+#define FMT_REV     "Key_Revision: %1hd.%hd"
+#define FMT_TAGS    "Tagged_Information:"
+#define FMT_TAGEND  "End_Of_Tags."
+#define FMT_KEYS    "Keyed_Information:"
+#define FMT_KEYEND  "End_Of_Keys."
+#define FMT_GEOEND  "End_Of_Geotiff."
+#define FMT_DOUBLE  "%-17.9g"
+#define FMT_SHORT   "%-11hd"
+
+static void DefaultPrint(char *string, void *aux);
+static void PrintKey(GeoKey *key, GTIFPrintMethod print,void *aux);
+static void PrintGeoTags(GTIF *gtif,GTIFReadMethod scan,void *aux);
+static void PrintTag(int tag, int nrows, double *data, int ncols, 
+					GTIFPrintMethod print,void *aux);
+static void DefaultRead(char *string, void *aux);
+static int  ReadKey(GTIF *gt, GTIFReadMethod scan, void *aux);
+static int  ReadTag(GTIF *gt,GTIFReadMethod scan,void *aux);
+
+/*
+ * Print off the directory info, using whatever method is specified
+ * (defaults to fprintf if null). The "aux" parameter is provided for user
+ * defined method for passing parameters or whatever.
+ *
+ * The output format is a "GeoTIFF meta-data" file, which may be
+ * used to import information with the GTIFFImport() routine.
+ */
+ 
+void GTIFPrint(GTIF *gtif, GTIFPrintMethod print,void *aux)
+{
+    int i;
+    int numkeys = gtif->gt_num_keys;
+    GeoKey *key = gtif->gt_keys;
+    char message[1024];
+	
+    if (!print) print = (GTIFPrintMethod) &DefaultPrint;
+    if (!aux) aux=stdout;	
+
+    sprintf(message,FMT_GEOTIFF "\n"); 
+    print(message,aux);
+    sprintf(message, "Version: %hd" ,gtif->gt_version);
+    sprintf(message, FMT_VERSION,gtif->gt_version);
+    print("   ",aux); print(message,aux); print("\n",aux);
+    sprintf(message, FMT_REV,gtif->gt_rev_major,
+            gtif->gt_rev_minor); 
+    print("   ",aux); print(message,aux); print("\n",aux);
+
+    sprintf(message,"   %s\n",FMT_TAGS); print(message,aux);
+    PrintGeoTags(gtif,print,aux);
+    sprintf(message,"      %s\n",FMT_TAGEND); print(message,aux);
+
+    sprintf(message,"   %s\n",FMT_KEYS); print(message,aux);
+    for (i=0; i<numkeys; i++)
+        PrintKey(++key,print,aux);
+    sprintf(message,"      %s\n",FMT_KEYEND); print(message,aux);
+
+    sprintf(message,"   %s\n",FMT_GEOEND); print(message,aux);
+}
+
+static void PrintGeoTags(GTIF *gt, GTIFPrintMethod print,void *aux)
+{
+	double *data;
+	int count;
+	tiff_t *tif=gt->gt_tif;
+
+        if( tif == NULL )
+            return;
+
+	if ((gt->gt_methods.get)(tif, GTIFF_TIEPOINTS, &count, &data ))
+		PrintTag(GTIFF_TIEPOINTS,count/3, data, 3, print, aux);
+	if ((gt->gt_methods.get)(tif, GTIFF_PIXELSCALE, &count, &data ))
+		PrintTag(GTIFF_PIXELSCALE,count/3, data, 3, print, aux);
+	if ((gt->gt_methods.get)(tif, GTIFF_TRANSMATRIX, &count, &data ))
+		PrintTag(GTIFF_TRANSMATRIX,count/4, data, 4, print, aux);
+}
+
+static void PrintTag(int tag, int nrows, double *dptr, int ncols, 
+					GTIFPrintMethod print,void *aux)
+{
+	int i,j;
+	double *data=dptr;
+        char message[1024];
+
+	print("      ",aux);
+	print(GTIFTagName(tag),aux);
+	sprintf(message," (%d,%d):\n",nrows,ncols);
+	print(message,aux);
+	for (i=0;i<nrows;i++)
+	{
+		print("         ",aux);
+		for (j=0;j<ncols;j++)
+		{
+			sprintf(message,FMT_DOUBLE,*data++);
+			print(message,aux);
+		}
+		print("\n",aux);
+	}
+	_GTIFFree(dptr); /* free up the allocated memory */
+}
+
+
+static void PrintKey(GeoKey *key, GTIFPrintMethod print, void *aux)
+{
+    char *data;
+    geokey_t keyid = (geokey_t) key->gk_key;
+    int count = key->gk_count;
+    int vals_now,i;
+    pinfo_t *sptr;
+    double *dptr;
+    char message[40];
+
+    print("      ",aux);
+    print(GTIFKeyName(keyid),aux);
+	
+    sprintf(message," (%s,%d): ",GTIFTypeName(key->gk_type),count);
+    print(message,aux);
+	
+    if (key->gk_type==TYPE_SHORT && count==1)
+        data = (char *)&key->gk_data;
+    else
+        data = key->gk_data;
+		
+    switch (key->gk_type)
+    {
+      case TYPE_ASCII: 
+      {
+          int  in_char, out_char;
+
+          print("\"",aux);
+
+          in_char = 0;
+          out_char = 0;
+          while( in_char < count-1 )
+          {
+              char ch = ((char *) data)[in_char++];
+
+              if( ch == '\n' )
+              {
+                  message[out_char++] = '\\';
+                  message[out_char++] = 'n';
+              }
+              else if( ch == '\\' )
+              {
+                  message[out_char++] = '\\';
+                  message[out_char++] = '\\';
+              }
+              else
+                  message[out_char++] = ch;
+
+              /* flush message if buffer full */
+              if( out_char >= sizeof(message)-3 )
+              {
+                  message[out_char] = '\0';
+                  print(message,aux);
+                  out_char = 0;
+              }
+          }
+
+          message[out_char]='\0';
+          print(message,aux);
+
+          print("\"\n",aux);
+      }
+      break;
+        
+      case TYPE_DOUBLE: 
+        for (dptr = (double *)data; count > 0; count-= vals_now)
+        {
+            vals_now = count > 3? 3: count;
+            for (i=0; i<vals_now; i++,dptr++)
+            {
+                sprintf(message,FMT_DOUBLE ,*dptr);
+                print(message,aux);
+            }
+            print("\n",aux);
+        }
+        break;
+        
+      case TYPE_SHORT: 
+        sptr = (pinfo_t *)data;
+        if (count==1)
+        {
+            print( GTIFValueName(keyid,*sptr), aux );
+            print( "\n", aux );
+        }
+        else
+            for (; count > 0; count-= vals_now)
+            {
+                vals_now = count > 3? 3: count;
+                for (i=0; i<vals_now; i++,sptr++)
+                {
+                    sprintf(message,FMT_SHORT,*sptr);
+                    print(message,aux);
+                }
+                print("\n",aux);
+            }
+        break;
+        
+      default: 
+        sprintf(message, "Unknown Type (%d)\n",key->gk_type);
+        print(message,aux);
+        break;
+    }
+}
+
+static void DefaultPrint(char *string, void *aux)
+{
+    /* Pretty boring */
+    fprintf((FILE *)aux,string);
+}
+
+
+/*
+ *  Importing metadata file
+ */
+
+/*
+ * Import the directory info, using whatever method is specified
+ * (defaults to fscanf if null). The "aux" parameter is provided for user
+ * defined method for passing file or whatever.
+ *
+ * The input format is a "GeoTIFF meta-data" file, which may be
+ * generated by the GTIFFPrint() routine.
+ */
+ 
+int GTIFImport(GTIF *gtif, GTIFReadMethod scan,void *aux)
+{
+    int status;
+    char message[1024];
+	
+    if (!scan) scan = (GTIFReadMethod) &DefaultRead;
+    if (!aux) aux=stdin;	
+	
+    scan(message,aux);
+    if (strncmp(message,FMT_GEOTIFF,8)) return 0; 
+    scan(message,aux);
+    if (!sscanf(message,FMT_VERSION,&gtif->gt_version)) return 0;
+    scan(message,aux);
+    if (sscanf(message,FMT_REV,&gtif->gt_rev_major,
+               &gtif->gt_rev_minor) !=2) return 0;
+
+    scan(message,aux);
+    if (strncmp(message,FMT_TAGS,8)) return 0;
+    while ((status=ReadTag(gtif,scan,aux))>0);
+    if (status < 0) return 0;
+
+    scan(message,aux);
+    if (strncmp(message,FMT_KEYS,8)) return 0;
+    while ((status=ReadKey(gtif,scan,aux))>0);
+	
+    return (status==0); /* success */
+}
+
+static int StringError(char *string)
+{
+    fprintf(stderr,"Parsing Error at \'%s\'\n",string);
+    return -1;
+}
+
+#define SKIPWHITE(vptr) \
+  while (*vptr && (*vptr==' '||*vptr=='\t')) vptr++
+#define FINDCHAR(vptr,c) \
+  while (*vptr && *vptr!=(c)) vptr++
+
+static int ReadTag(GTIF *gt,GTIFReadMethod scan,void *aux)
+{
+    int i,j,tag;
+    char *vptr;
+    char tagname[100];
+    double *data,*dptr;
+    int count,nrows,ncols,num;
+    char message[1024];
+
+    scan(message,aux);
+    if (!strncmp(message,FMT_TAGEND,8)) return 0;
+
+    num=sscanf(message,"%[^( ] (%d,%d):\n",tagname,&nrows,&ncols);
+    if (num!=3) return StringError(message);
+	
+    tag = GTIFTagCode(tagname);
+    if (tag < 0) return StringError(tagname);
+
+    count = nrows*ncols;
+
+    data = (double *) _GTIFcalloc(count * sizeof(double));
+    dptr = data;
+	
+    for (i=0;i<nrows;i++)
+    {
+        scan(message,aux);
+        vptr = message;
+        for (j=0;j<ncols;j++)
+        {
+            if (!sscanf(vptr,"%lg",dptr++))
+                return StringError(vptr);
+            FINDCHAR(vptr,' ');
+            SKIPWHITE(vptr);
+        }
+    }	
+    (gt->gt_methods.set)(gt->gt_tif, (pinfo_t) tag, count, data );	
+
+    _GTIFFree( data );
+
+    return 1;
+}
+
+
+static int ReadKey(GTIF *gt, GTIFReadMethod scan, void *aux)
+{
+    tagtype_t ktype;
+    int count,outcount;
+    int vals_now,i;
+    geokey_t key;
+    int icode;
+    pinfo_t code;
+    short  *sptr;
+    char name[1000];
+    char type[20];
+    double data[100];
+    double *dptr;
+    char *vptr;
+    int num;
+    char message[2048];
+
+    scan(message,aux); 
+    if (!strncmp(message,FMT_KEYEND,8)) return 0;
+
+    num=sscanf(message,"%[^( ] (%[^,],%d):\n",name,type,&count);
+    if (num!=3) return StringError(message);
+
+    vptr = message;
+    FINDCHAR(vptr,':'); 
+    if (!*vptr) return StringError(message);
+    vptr+=2;
+
+    if( GTIFKeyCode(name) < 0 )
+        return StringError(name);
+    else
+        key = (geokey_t) GTIFKeyCode(name);
+
+    if( GTIFTypeCode(type) < 0 )
+        return StringError(type);
+    else
+        ktype = (tagtype_t) GTIFTypeCode(type);
+
+    /* skip white space */
+    SKIPWHITE(vptr);
+    if (!*vptr) return StringError(message);
+			
+    switch (ktype)
+    {
+      case TYPE_ASCII: 
+      {
+          char *cdata;
+          int out_char = 0;
+
+          FINDCHAR(vptr,'"');
+          if (!*vptr) return StringError(message);
+
+          cdata = (char *) _GTIFcalloc( count+1 );
+
+          vptr++;
+          while( out_char < count-1 )
+          {
+              if( *vptr == '\0' )
+                  break;
+
+              else if( vptr[0] == '\\' && vptr[1] == 'n' )
+              {
+                  cdata[out_char++] = '\n';
+                  vptr += 2;
+              }
+              else if( vptr[0] == '\\' && vptr[1] == '\\' )
+              {
+                  cdata[out_char++] = '\\';
+                  vptr += 2;
+              }
+              else
+                  cdata[out_char++] = *(vptr++);
+          }
+
+          if( out_char < count-1 ) return StringError(message);
+          if( *vptr != '"' ) return StringError(message);
+
+          cdata[count-1] = '\0';
+          GTIFKeySet(gt,key,ktype,count,cdata);
+
+          _GTIFFree( cdata );
+      }
+      break;
+        
+      case TYPE_DOUBLE: 
+        outcount = count;
+        for (dptr = data; count > 0; count-= vals_now)
+        {
+            vals_now = count > 3? 3: count;
+            for (i=0; i<vals_now; i++,dptr++)
+            {
+                if (!sscanf(vptr,"%lg" ,dptr))
+                    StringError(vptr);
+                FINDCHAR(vptr,' ');
+                SKIPWHITE(vptr);
+            }
+            if (vals_now<count)
+            {
+                scan(message,aux);
+                vptr = message;
+            }
+        }
+        if (outcount==1)
+            GTIFKeySet(gt,key,ktype,outcount,data[0]);
+        else
+            GTIFKeySet(gt,key,ktype,outcount,data);
+        break;
+        
+      case TYPE_SHORT: 
+        if (count==1)
+        {
+            icode = GTIFValueCode(key,vptr);
+            if (icode < 0) return StringError(vptr);
+            code = (pinfo_t) icode;
+            GTIFKeySet(gt,key,ktype,count,code);
+        }
+        else  /* multi-valued short - no such thing yet */
+        {
+            sptr = (short *)data;
+            outcount = count;
+            for (; count > 0; count-= vals_now)
+            {
+                vals_now = count > 3? 3: count;
+                for (i=0; i<vals_now; i++,sptr++)
+                {
+                    int		work_int;
+
+                    /* note: FMT_SHORT (%11hd) not supported on IRIX */
+                    sscanf(message,"%11d",&work_int);
+                    *sptr = (short) work_int;
+                    scan(message,aux);
+                }
+                if (vals_now<count)
+                {
+                    scan(message,aux);
+                    vptr = message;
+                }
+            }
+            GTIFKeySet(gt,key,ktype,outcount,sptr);			
+        }
+        break;
+        
+      default: 
+        return -1;
+    }
+    return 1;
+}
+
+
+static void DefaultRead(char *string, void *aux)
+{
+	/* Pretty boring */
+	fscanf((FILE *)aux,"%[^\n]\n",string);
+}
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_set.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_set.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_set.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,262 @@
+/**********************************************************************
+ *
+ *  geo_set.c  -- Public routines for GEOTIFF GeoKey access.
+ *
+ *    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.
+ *
+ * $Log: geo_set.c,v $
+ * Revision 1.11  2004/04/27 21:32:33  warmerda
+ * reformat for clarity
+ *
+ * Revision 1.10  2003/07/08 17:31:30  warmerda
+ * cleanup various warnings
+ *
+ * Revision 1.9  2003/01/15 03:37:19  warmerda
+ * avoid warning
+ *
+ * Revision 1.8  2002/09/27 13:05:33  warmerda
+ * allow dynamic set/delete of ASCII tags. ASCIIPARAMS now kept split
+ *
+ * Revision 1.7  2001/05/02 16:48:22  warmerda
+ * fixed a couple bugs in delete code
+ *
+ * Revision 1.6  2001/05/02 13:54:34  warmerda
+ * updated geo_set.c to support deleting tags
+ *
+ * Revision 1.5  1999/05/04 03:09:33  warmerda
+ * avoid warnings
+ *
+ * Revision 1.4  1999/05/03 17:50:31  warmerda
+ * avoid warnings on IRIX
+ *
+ * Revision 1.3  1999/04/28 19:59:38  warmerda
+ * added some doxygen style documentation
+ *
+ * Revision 1.2  1999/03/11 17:39:38  geotiff
+ * Added fix for case where a key is being overwritten.
+ *
+ **********************************************************************/
+
+#include "geotiff.h"   /* public interface        */
+#include "geo_tiffp.h" /* external TIFF interface */
+#include "geo_keyp.h"  /* private interface       */
+
+#include <assert.h>
+
+/**
+This function writes a geokey_t value to a GeoTIFF file.
+
+ at param gtif The geotiff information handle from GTIFNew().
+
+ at param keyID The geokey_t name (such as ProjectedCSTypeGeoKey).
+This must come from the list of legal geokey_t values
+(an enumeration) listed below.
+
+ at param val The <b>val</b> argument is a pointer to the
+variable into which the value should be read.  The type of the variable
+varies depending on the geokey_t given.  While there is no ready mapping
+of geokey_t values onto types, in general code values are of type <i>short</i>,
+citations are strings, and everything else is of type <i>double</i>.  Note
+that pointer's to <i>int</i> should never be passed to GTIFKeyGet() for
+integer values as they will be shorts, and the int's may not be properly
+initialized (and will be grossly wrong on MSB systems).
+
+ at param index Indicates how far into the list of values
+for this geokey to offset. Should normally be zero.
+
+ at param count Indicates how many values
+to read.  At this time all keys except for strings have only one value,
+so <b>index</b> should be zero, and <b>count</b> should be one.<p>
+
+The <b>key</b> indicates the key name to be written to the
+file and should from the geokey_t enumeration 
+(eg. <tt>ProjectedCSTypeGeoKey</tt>).  The full list of possible geokey_t
+values can be found in geokeys.inc, or in the online documentation for
+GTIFKeyGet().<p>
+
+The <b>type</b> should be one of TYPE_SHORT, TYPE_ASCII, or TYPE_DOUBLE and
+will indicate the type of value being passed at the end of the argument
+list (the key value).  The <b>count</b> should be one except for strings
+when it should be the length of the string (or zero to for this to be
+computed internally).  As a special case a <b>count</b> of -1 can be
+used to request an existing key be deleted, in which no value is passed.<p>
+
+The actual value is passed at the end of the argument list, and should be
+a short, a double, or a char * value.  Note that short and double values
+are passed as is, not as pointers.<p>
+
+Note that key values aren't actually flushed to the file until
+GTIFWriteKeys() is called.  Till then 
+the new values are just kept with the GTIF structure.<p>
+
+<b>Example:</b><p>
+
+<pre>
+    GTIFKeySet(gtif, GTRasterTypeGeoKey, TYPE_SHORT, 1, 
+               RasterPixelIsArea);
+    GTIFKeySet(gtif, GTCitationGeoKey, TYPE_ASCII, 0, 
+               "UTM 11 North / NAD27" );
+</pre>
+
+ */
+
+int GTIFKeySet(GTIF *gtif, geokey_t keyID, tagtype_t type, int count,...)
+{
+    va_list ap;
+    int index = gtif->gt_keyindex[ keyID ];
+    int newvalues = 0;
+    GeoKey *key;
+    char *data = NULL;
+    char *val = NULL;
+    pinfo_t sval;
+    double dval;
+
+    va_start(ap, count);
+    /* pass singleton keys by value */
+    if (count>1 && type!=TYPE_ASCII) 
+    {
+        val = va_arg(ap, char*);
+    }
+    else if( count == -1 )
+    {
+        /* delete the indicated tag */
+        va_end(ap);
+
+        if( index < 1 )
+            return 0;
+
+        if (gtif->gt_keys[index].gk_type == TYPE_ASCII)
+        {
+            _GTIFFree (gtif->gt_keys[index].gk_data);
+        }
+
+        while( index < gtif->gt_num_keys )
+        {
+            _GTIFmemcpy( gtif->gt_keys + index, 
+                         gtif->gt_keys + index + 1, 
+                         sizeof(GeoKey) );
+            gtif->gt_keyindex[gtif->gt_keys[index].gk_key] = index;
+            index++;
+        }
+
+        gtif->gt_num_keys--;
+        gtif->gt_nshorts -= sizeof(KeyEntry)/sizeof(pinfo_t);
+        gtif->gt_keyindex[keyID] = 0;
+        gtif->gt_flags |= FLAG_FILE_MODIFIED;
+
+        return 1;
+    }
+    else switch (type)
+    {
+      case TYPE_SHORT:  sval=(pinfo_t) va_arg(ap, int); val=(char *)&sval;     break;
+      case TYPE_DOUBLE: dval=va_arg(ap, dblparam_t); val=(char *)&dval;  break;
+      case TYPE_ASCII: 
+        val=va_arg(ap, char*);
+        count = strlen(val) + 1; /* force = string length */
+        break;
+      default:
+        assert( FALSE );
+        break;
+    }
+    va_end(ap);
+    
+    /* We assume here that there are no multi-valued SHORTS ! */
+    if (index)
+    {
+        /* Key already exists */
+        key = gtif->gt_keys+index;
+        if (type!=key->gk_type || count > key->gk_count)
+        {
+            /* need to reset data pointer */
+            key->gk_type = type;
+            key->gk_count = count;
+            key->gk_size = _gtiff_size[ type ];
+            newvalues = 1;
+        }
+    }
+    else
+    {
+        /* We need to create the key */
+        if (gtif->gt_num_keys == MAX_KEYS) return 0;
+        key = gtif->gt_keys + ++gtif->gt_num_keys;
+        index = gtif->gt_num_keys;
+        gtif->gt_keyindex[ keyID ] = index;
+        key->gk_key = keyID;
+        key->gk_type = type;
+        key->gk_count = count;
+        key->gk_size = _gtiff_size[ type ];
+        if (gtif->gt_keymin > keyID)  gtif->gt_keymin=keyID;
+        if (gtif->gt_keymax < keyID)  gtif->gt_keymax=keyID;
+        newvalues = 1;
+    }
+
+    if (newvalues)
+    {
+        switch (type)
+        {
+          case TYPE_SHORT:  
+            if (count > 1) return 0;
+            data = (char *)&key->gk_data; /* store value *in* data */
+            break;
+          case TYPE_DOUBLE:
+            key->gk_data = (char *)(gtif->gt_double + gtif->gt_ndoubles);
+            data = key->gk_data;
+            gtif->gt_ndoubles += count;
+            break;
+          case TYPE_ASCII:
+            break;
+          default:
+            va_end(ap);
+            return 0;
+        }
+        gtif->gt_nshorts += sizeof(KeyEntry)/sizeof(pinfo_t);
+    }
+
+    /* this fixes a bug where if a request is made to write a duplicate
+       key, we must initialize the data to a valid value.
+       Bryan Wells (bryan at athena.bangor.autometric.com) */
+        
+    else /* no new values, but still have something to write */
+    {
+        switch (type)
+        {
+          case TYPE_SHORT:  
+            if (count > 1) return 0;
+            data = (char *)&key->gk_data; /* store value *in* data */
+            break;
+          case TYPE_DOUBLE:
+            data = key->gk_data;
+            break;
+          case TYPE_ASCII:
+            break;
+          default:
+            return 0;
+        }
+    }
+        
+    switch (type)
+    {
+      case TYPE_ASCII:
+        /* throw away existing data and allocate room for new data */
+        if (key->gk_data != 0)
+        {
+            _GTIFFree(key->gk_data);
+        }
+        key->gk_data = (char *)_GTIFcalloc(count);
+        key->gk_count = count;
+        data = key->gk_data;
+        break;
+      default:
+        break;
+    }
+
+    _GTIFmemcpy(data, val, count*key->gk_size);
+    
+    gtif->gt_flags |= FLAG_FILE_MODIFIED;
+    return 1;
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_tiffp.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_tiffp.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_tiffp.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,140 @@
+/**********************************************************************
+ *
+ *  geo_tiffp.c  Private TIFF interface module for GEOTIFF
+ *
+ *    This module implements the interface between the GEOTIFF
+ *    tag parser and the TIFF i/o module. The current setup
+ *    relies on the "libtiff" code, but if you use your own
+ *    TIFF reader software, you may replace the module implementations
+ *    here with your own calls. No "libtiff" dependencies occur
+ *    anywhere else in this code.
+ *
+ **********************************************************************/
+ 
+#include "geotiff.h"    /* public GTIFF interface */
+
+#include "geo_tiffp.h"  /* Private TIFF interface */
+#include "geo_keyp.h"   /* Private GTIFF interface */
+
+/* tiff size array global */
+gsize_t _gtiff_size[] = { 0, 1, 2, 4, 8, 1, 4, 8, 1, 2, 4, 1 };
+
+static int        _GTIFGetField (tiff_t *tif, pinfo_t tag, int *count, void *value );
+static int        _GTIFSetField (tiff_t *tif, pinfo_t tag, int  count, void *value );
+static tagtype_t  _GTIFTagType  (tiff_t *tif, pinfo_t tag);
+
+/*
+ * Set up default TIFF handlers. 
+ */
+void _GTIFSetDefaultTIFF(TIFFMethod *method)
+{
+	if (!method) return;
+	
+	method->get = _GTIFGetField;
+	method->set = _GTIFSetField;
+	method->type = _GTIFTagType;
+}
+
+gdata_t _GTIFcalloc(gsize_t size)
+{
+    gdata_t data=(gdata_t)_TIFFmalloc((tsize_t)size);
+	if (data) _TIFFmemset((tdata_t)data,0,(tsize_t)size);
+	return data;
+}
+
+gdata_t _GTIFrealloc(gdata_t ptr, gsize_t size)
+{
+    return( _TIFFrealloc((tdata_t)ptr, (tsize_t) size) );
+}
+
+void _GTIFmemcpy(gdata_t out,gdata_t in,gsize_t size)
+{
+	_TIFFmemcpy((tdata_t)out,(tdata_t)in,(tsize_t)size);
+}
+
+void _GTIFFree(gdata_t data)
+{
+	if (data) _TIFFfree((tdata_t)data);
+}
+
+
+
+/* returns the value of TIFF tag <tag>, or if
+ * the value is an array, returns an allocated buffer
+ * containing the values. Allocate a copy of the actual
+ * buffer, sized up for updating.
+ */
+static int _GTIFGetField (tiff_t *tif, pinfo_t tag, int *count, void *val )
+{
+	int status;
+	unsigned short scount=0;
+	char *tmp;
+	char *value;
+	gsize_t size = _gtiff_size[_GTIFTagType (tif,tag)];
+	
+	if (_GTIFTagType(tif,  tag) == TYPE_ASCII)
+	{
+		status = TIFFGetField((TIFF *)tif,tag,&tmp);
+		if (!status) return status;
+		scount = (unsigned short) (strlen(tmp)+1);
+	}
+	else status = TIFFGetField((TIFF *)tif,tag,&scount,&tmp);
+	if (!status) return status;
+	
+	*count = scount;
+
+	value = (char *)_GTIFcalloc( (scount+MAX_VALUES)*size);
+	if (!value) return 0;
+	
+	_TIFFmemcpy( value, tmp,  size * scount);
+	
+	*(char **)val = value;
+	return status;
+}
+
+/* 
+ * Set a GeoTIFF TIFF field.
+ */
+static int _GTIFSetField (tiff_t *tif, pinfo_t tag, int count, void *value )
+{
+	int status;
+	unsigned short scount = (unsigned short) count;
+
+	/* libtiff ASCII uses null-delimiter */
+	if (_GTIFTagType(tif,  tag) == TYPE_ASCII)
+		status = TIFFSetField((TIFF *)tif,tag,value);
+	else 
+		status = TIFFSetField((TIFF *)tif,tag,scount,value);
+	return status;
+}
+
+
+/*
+ *  This routine is supposed to return the TagType of the <tag>
+ *  TIFF tag. Unfortunately, "libtiff" does not provide this
+ *  service by default, so we just have to "know" what type of tags
+ *  we've got, and how many. We only define the ones Geotiff
+ *  uses here, and others return UNKNOWN. The "tif" parameter
+ *  is provided for those TIFF implementations that provide
+ *  for tag-type queries.
+ */
+static tagtype_t  _GTIFTagType  (tiff_t *tif, pinfo_t tag)
+{
+	tagtype_t ttype;
+
+	(void) tif; /* dummy reference */
+	
+	switch (tag)
+	{
+		case GTIFF_ASCIIPARAMS:    ttype=TYPE_ASCII; break;
+		case GTIFF_PIXELSCALE:
+		case GTIFF_TRANSMATRIX:
+		case GTIFF_TIEPOINTS:
+		case GTIFF_DOUBLEPARAMS:   ttype=TYPE_DOUBLE; break;
+		case GTIFF_GEOKEYDIRECTORY: ttype=TYPE_SHORT; break;
+		default: ttype = TYPE_UNKNOWN;
+	}
+	
+	return ttype;
+}
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_tiffp.h
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_tiffp.h	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_tiffp.h	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,114 @@
+/**********************************************************************
+ *
+ *  geo_tiffp.h - Private interface for TIFF tag parsing.
+ *
+ *   Written by: Niles D. Ritter
+ *
+ *   This interface file encapsulates the interface to external TIFF
+ *   file-io routines and definitions. The current configuration
+ *   assumes that the "libtiff" module is used, but if you have your
+ *   own TIFF reader, you may replace the definitions with your own
+ *   here, and replace the implementations in geo_tiffp.c. No other
+ *   modules have any explicit dependence on external TIFF modules.
+ *
+ *  Revision History;
+ *
+ *    20 June, 1995      Niles D. Ritter         New
+ *    6 July,  1995      Niles D. Ritter         Fix prototypes
+ *
+ **********************************************************************/
+
+#ifndef __geo_tiffp_h_
+#define __geo_tiffp_h_
+
+/**********************************************************************
+ *
+ *                        Private includes
+ *
+ *   If you are not using libtiff and XTIFF, replace this include file
+ *    with the appropriate one for your own TIFF parsing routines.
+ *
+ *   Revision History
+ * 
+ *      19 September 1995   ndr    Demoted Intergraph trans matrix.
+ *
+ **********************************************************************/
+
+#include "geotiff.h"
+#include "xtiffio.h"
+#include "cpl_serv.h"
+
+/*
+ * dblparam_t is the type that a double precision
+ * floating point value will have on the parameter
+ * stack (when coerced by the compiler). You shouldn't
+ * have to change this.
+ */
+#ifdef applec
+typedef extended dblparam_t;
+#else
+typedef double dblparam_t;
+#endif
+
+
+/**********************************************************************
+ *
+ *                        Private defines
+ *
+ *   If you are not using "libtiff"/LIBXTIFF, replace these definitions
+ *   with the appropriate definitions to access the geo-tags
+ *
+ **********************************************************************/
+ 
+typedef unsigned short pinfo_t;    /* SHORT ProjectionInfo tag type */
+typedef TIFF    tiff_t;            /* TIFF file descriptor          */
+typedef tdata_t  gdata_t;          /* pointer to data */
+typedef tsize_t  gsize_t;          /* data allocation size */
+ 
+#define GTIFF_GEOKEYDIRECTORY   TIFFTAG_GEOKEYDIRECTORY /* from xtiffio.h */
+#define GTIFF_DOUBLEPARAMS      TIFFTAG_GEODOUBLEPARAMS
+#define GTIFF_ASCIIPARAMS       TIFFTAG_GEOASCIIPARAMS
+#define GTIFF_PIXELSCALE        TIFFTAG_GEOPIXELSCALE
+#define GTIFF_TRANSMATRIX       TIFFTAG_GEOTRANSMATRIX
+#define GTIFF_INTERGRAPH_MATRIX TIFFTAG_INTERGRAPH_MATRIX
+#define GTIFF_TIEPOINTS         TIFFTAG_GEOTIEPOINTS
+#define GTIFF_LOCAL          0
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*
+ * Method function pointer types
+ */
+typedef int        (*GTGetFunction) (tiff_t *tif, pinfo_t tag, int *count, void *value );
+typedef int        (*GTSetFunction) (tiff_t *tif, pinfo_t tag, int  count, void *value );
+typedef tagtype_t  (*GTTypeFunction) (tiff_t *tif, pinfo_t tag);
+typedef struct     _TIFFMethod {
+	GTGetFunction get;
+	GTSetFunction set;
+	GTTypeFunction type;
+} TIFFMethod;
+
+/**********************************************************************
+ *
+ *               Protected Function Declarations  
+ *
+ *   These routines are exposed implementations, and should not
+ *   be used by external GEOTIFF client programs.
+ *
+ **********************************************************************/
+
+extern gsize_t _gtiff_size[]; /* TIFF data sizes */
+extern void CPL_DLL _GTIFSetDefaultTIFF(TIFFMethod *method);
+extern gdata_t CPL_DLL _GTIFcalloc(gsize_t);
+extern gdata_t CPL_DLL _GTIFrealloc(gdata_t,gsize_t);
+extern void CPL_DLL _GTIFFree(gdata_t data);
+extern void CPL_DLL _GTIFmemcpy(gdata_t out,gdata_t in,gsize_t size);
+
+#if defined(__cplusplus)
+} 
+#endif
+
+
+#endif /* __geo_tiffp_h_ */

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_trans.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_trans.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_trans.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,334 @@
+/******************************************************************************
+ * $Id: geo_trans.c,v 1.10 2003/07/08 17:31:30 warmerda Exp $
+ *
+ * Project:  libgeotiff
+ * Purpose:  Code to abstract translation between pixel/line and PCS
+ *           coordinates.
+ * 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: geo_trans.c,v $
+ * Revision 1.10  2003/07/08 17:31:30  warmerda
+ * cleanup various warnings
+ *
+ * Revision 1.9  2001/11/28 14:20:30  warmerda
+ * fixed transform memory leak in GTIFPCSToImage
+ *
+ * Revision 1.8  2001/04/06 16:56:22  warmerda
+ * added support for PCSToImage with matrix
+ *
+ * Revision 1.7  2001/03/05 03:25:23  warmerda
+ * restructure cleanup, and apply to GTIFPCSToImage()
+ *
+ * Revision 1.6  2001/03/04 22:37:39  warmerda
+ * fixed memory leak for fields fetched with gt_methods.get - Alan Gray
+ *
+ * Revision 1.5  2000/08/22 03:32:46  warmerda
+ * removed GTIFTiepointTranslate code
+ *
+ * Revision 1.4  1999/09/17 01:19:51  warmerda
+ * Fixed bug in use of transform matrix.
+ *
+ * Revision 1.3  1999/09/16 21:25:40  warmerda
+ * Added tiepoint, and transformation matrix based translation.  Note
+ * that we don't try to invert the transformation matrix for
+ * GTIFPCSToImage().
+ *
+ * Revision 1.2  1999/09/07 20:00:40  warmerda
+ * Fixed count/tiepoint_count bug in GTIFPCSToImage().
+ *
+ * Revision 1.1  1999/05/04 03:07:57  warmerda
+ * New
+ *
+ */
+ 
+#include "geotiff.h"
+#include "geo_tiffp.h" /* external TIFF interface */
+#include "geo_keyp.h"  /* private interface       */
+#include "geokeys.h"
+
+/************************************************************************/
+/*                          inv_geotransform()                          */
+/*                                                                      */
+/*      Invert a 6 term geotransform style matrix.                      */
+/************************************************************************/
+
+static int inv_geotransform( double *gt_in, double *gt_out )
+
+{
+    double	det, inv_det;
+
+    /* we assume a 3rd row that is [0 0 1] */
+
+    /* Compute determinate */
+
+    det = gt_in[0] * gt_in[4] - gt_in[1] * gt_in[3];
+
+    if( fabs(det) < 0.000000000000001 )
+        return 0;
+
+    inv_det = 1.0 / det;
+
+    /* compute adjoint, and devide by determinate */
+
+    gt_out[0] =  gt_in[4] * inv_det;
+    gt_out[3] = -gt_in[3] * inv_det;
+
+    gt_out[1] = -gt_in[1] * inv_det;
+    gt_out[4] =  gt_in[0] * inv_det;
+
+    gt_out[2] = ( gt_in[1] * gt_in[5] - gt_in[2] * gt_in[4]) * inv_det;
+    gt_out[5] = (-gt_in[0] * gt_in[5] + gt_in[2] * gt_in[3]) * inv_det;
+
+    return 1;
+}
+
+/************************************************************************/
+/*                       GTIFTiepointTranslate()                        */
+/************************************************************************/
+
+int GTIFTiepointTranslate( int gcp_count, double * gcps_in, double * gcps_out,
+                           double x_in, double y_in,
+                           double *x_out, double *y_out )
+
+{
+    (void) gcp_count;
+    (void) gcps_in;
+    (void) gcps_out;
+    (void) x_in;
+    (void) y_in;
+    (void) x_out;
+    (void) y_out;
+    
+    /* I would appreciate a _brief_ block of code for doing second order
+       polynomial regression here! */
+    return FALSE;
+}
+
+
+/************************************************************************/
+/*                           GTIFImageToPCS()                           */
+/************************************************************************/
+
+/**
+ * Translate a pixel/line coordinate to projection coordinates.
+ *
+ * At this time this function does not support image to PCS translations for
+ * tiepoints-only definitions,  only pixelscale and transformation matrix
+ * formulations.
+ *
+ * @param gtif The handle from GTIFNew() indicating the target file.
+ * @param x A pointer to the double containing the pixel offset on input,
+ * and into which the easting/longitude will be put on completion.
+ * @param y A pointer to the double containing the line offset on input,
+ * and into which the northing/latitude will be put on completion.
+ *
+ * @return TRUE if the transformation succeeds, or FALSE if it fails.  It may
+ * fail if the file doesn't have properly setup transformation information,
+ * or it is in a form unsupported by this function.
+ */
+
+int GTIFImageToPCS( GTIF *gtif, double *x, double *y )
+
+{
+    int     res = FALSE;
+    int     tiepoint_count, count, transform_count;
+    tiff_t *tif=gtif->gt_tif;
+    double *tiepoints   = 0;
+    double *pixel_scale = 0;
+    double *transform   = 0;
+
+
+    if (!(gtif->gt_methods.get)(tif, GTIFF_TIEPOINTS,
+                              &tiepoint_count, &tiepoints ))
+        tiepoint_count = 0;
+
+    if (!(gtif->gt_methods.get)(tif, GTIFF_PIXELSCALE, &count, &pixel_scale ))
+        count = 0;
+
+    if (!(gtif->gt_methods.get)(tif, GTIFF_TRANSMATRIX,
+                                &transform_count, &transform ))
+        transform_count = 0;
+
+/* -------------------------------------------------------------------- */
+/*      If the pixelscale count is zero, but we have tiepoints use      */
+/*      the tiepoint based approach.                                    */
+/* -------------------------------------------------------------------- */
+    if( tiepoint_count > 6 && count == 0 ) 
+    {
+        res = GTIFTiepointTranslate( tiepoint_count / 6,
+                                     tiepoints, tiepoints + 3,
+                                     *x, *y, x, y );
+    }
+
+/* -------------------------------------------------------------------- */
+/*	If we have a transformation matrix, use it. 			*/
+/* -------------------------------------------------------------------- */
+    else if( transform_count == 16 ) 
+    {
+        double x_in = *x, y_in = *y;
+
+        *x = x_in * transform[0] + y_in * transform[1] + transform[3];
+        *y = x_in * transform[4] + y_in * transform[5] + transform[7];
+        
+        res = TRUE;
+    } 
+
+/* -------------------------------------------------------------------- */
+/*      For now we require one tie point, and a valid pixel scale.      */
+/* -------------------------------------------------------------------- */
+    else if( count < 3 || tiepoint_count < 6 ) 
+    {
+        res = FALSE;
+    } 
+
+    else 
+    {
+        *x = (*x - tiepoints[0]) * pixel_scale[0] + tiepoints[3];
+        *y = (*y - tiepoints[1]) * (-1 * pixel_scale[1]) + tiepoints[4];
+
+        res = TRUE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Cleanup                                                         */
+/* -------------------------------------------------------------------- */
+    if(tiepoints)   
+        _GTIFFree(tiepoints);
+    if(pixel_scale)
+        _GTIFFree(pixel_scale);
+    if(transform)  
+        _GTIFFree(transform);
+
+    return res;
+}
+
+/************************************************************************/
+/*                           GTIFPCSToImage()                           */
+/************************************************************************/
+
+/**
+ * Translate a projection coordinate to pixel/line coordinates.
+ *
+ * At this time this function does not support PCS to image translations for
+ * tiepoints-only based definitions, only matrix and pixelscale/tiepoints 
+ * formulations are supposed.
+ *
+ * @param gtif The handle from GTIFNew() indicating the target file.
+ * @param x A pointer to the double containing the pixel offset on input,
+ * and into which the easting/longitude will be put on completion.
+ * @param y A pointer to the double containing the line offset on input,
+ * and into which the northing/latitude will be put on completion.
+ *
+ * @return TRUE if the transformation succeeds, or FALSE if it fails.  It may
+ * fail if the file doesn't have properly setup transformation information,
+ * or it is in a form unsupported by this function.
+ */
+
+int GTIFPCSToImage( GTIF *gtif, double *x, double *y )
+
+{
+    double 	*tiepoints = NULL;
+    int 	tiepoint_count, count, transform_count = 0;
+    double	*pixel_scale = NULL;
+    double 	*transform   = NULL;
+    tiff_t 	*tif=gtif->gt_tif;
+    int		result = FALSE;
+
+/* -------------------------------------------------------------------- */
+/*      Fetch tiepoints and pixel scale.                                */
+/* -------------------------------------------------------------------- */
+    if (!(gtif->gt_methods.get)(tif, GTIFF_TIEPOINTS,
+                              &tiepoint_count, &tiepoints ))
+        tiepoint_count = 0;
+
+    if (!(gtif->gt_methods.get)(tif, GTIFF_PIXELSCALE, &count, &pixel_scale ))
+        count = 0;
+
+    if (!(gtif->gt_methods.get)(tif, GTIFF_TRANSMATRIX,
+                                &transform_count, &transform ))
+        transform_count = 0;
+
+/* -------------------------------------------------------------------- */
+/*      If the pixelscale count is zero, but we have tiepoints use      */
+/*      the tiepoint based approach.                                    */
+/* -------------------------------------------------------------------- */
+    if( tiepoint_count > 6 && count == 0 )
+    {
+        result = GTIFTiepointTranslate( tiepoint_count / 6,
+                                        tiepoints + 3, tiepoints,
+                                        *x, *y, x, y );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Handle matrix - convert to "geotransform" format, invert and    */
+/*      apply.                                                          */
+/* -------------------------------------------------------------------- */
+    else if( transform_count == 16 )
+    {
+        double  x_in = *x, y_in = *y;
+        double	gt_in[6], gt_out[6];
+        
+        gt_in[0] = transform[0];
+        gt_in[1] = transform[1];
+        gt_in[2] = transform[3];
+        gt_in[3] = transform[4];
+        gt_in[4] = transform[5];
+        gt_in[5] = transform[7];
+
+        if( !inv_geotransform( gt_in, gt_out ) )
+            result = FALSE;
+        else
+        {
+            *x = x_in * gt_out[0] + y_in * gt_out[1] + gt_out[2];
+            *y = x_in * gt_out[3] + y_in * gt_out[4] + gt_out[5];
+            
+            result = TRUE;
+        }
+    }
+
+/* -------------------------------------------------------------------- */
+/*      For now we require one tie point, and a valid pixel scale.      */
+/* -------------------------------------------------------------------- */
+    else if( count >= 3 && tiepoint_count >= 6 )
+    {
+        *x = (*x - tiepoints[3]) / pixel_scale[0] + tiepoints[0];
+        *y = (*y - tiepoints[4]) / (-1 * pixel_scale[1]) + tiepoints[1];
+
+        result = TRUE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Cleanup.                                                        */
+/* -------------------------------------------------------------------- */
+    if(tiepoints)   
+        _GTIFFree(tiepoints);
+    if(pixel_scale)
+        _GTIFFree(pixel_scale);
+    if(transform)  
+        _GTIFFree(transform);
+
+    return result;
+}
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/geo_write.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geo_write.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geo_write.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,193 @@
+/**********************************************************************
+ *
+ *  geo_write.c  -- Public routines for GEOTIFF GeoKey access.
+ *
+ *    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 source code derived therefrom.
+ *
+ **********************************************************************/
+
+#include "geotiffio.h"   /* public interface        */
+#include "geo_tiffp.h" /* external TIFF interface */
+#include "geo_keyp.h"  /* private interface       */
+
+static int WriteKey(GTIF* gt, TempKeyData* tempData,
+                    KeyEntry* entptr, GeoKey* keyptr);
+static int SortKeys(GTIF* gt,int *sortkeys);
+
+
+/**
+This function flushes all the GeoTIFF keys that have been set with the 
+GTIFKeySet() function into the associated 
+TIFF file.
+
+ at param gt The GeoTIFF handle returned by GTIFNew.
+
+GTIFWriteKeys() should be called before 
+GTIFFree() is used to deallocate a GeoTIFF access handle.
+ */
+
+int GTIFWriteKeys(GTIF *gt)
+{
+    int i;
+    GeoKey *keyptr;
+    KeyEntry *entptr;
+    KeyHeader *header;
+    TempKeyData tempData;
+    int sortkeys[MAX_KEYS];
+	
+    if (!(gt->gt_flags & FLAG_FILE_MODIFIED)) return 1;
+
+    if( gt->gt_tif == NULL )
+        return 0;
+	
+    tempData.tk_asciiParams = 0;
+    tempData.tk_asciiParamsLength = 0;
+    tempData.tk_asciiParamsOffset = 0;
+
+    /*  Sort the Keys into numerical order */
+    if (!SortKeys(gt,sortkeys))
+    {
+        /* XXX error: a key was not recognized */
+    }
+	
+    /* Set up header of ProjectionInfo tag */
+    header = (KeyHeader *)gt->gt_short;
+    header->hdr_num_keys = (pinfo_t) gt->gt_num_keys;
+    header->hdr_version  = GvCurrentVersion;
+    header->hdr_rev_major  = GvCurrentRevision;
+    header->hdr_rev_minor  = GvCurrentMinorRev;
+	
+    /* Sum up the ASCII tag lengths */
+    for (i = 0; i < gt->gt_num_keys; i++)
+    {
+        keyptr = gt->gt_keys + sortkeys[i];
+        if (keyptr->gk_type == TYPE_ASCII)
+        {
+            tempData.tk_asciiParamsLength += keyptr->gk_count;
+        }
+    }
+    if (tempData.tk_asciiParamsLength > 0)
+    {
+        tempData.tk_asciiParams =
+            (char *)_GTIFcalloc(tempData.tk_asciiParamsLength + 1);
+        tempData.tk_asciiParams[tempData.tk_asciiParamsLength] = '\0';
+    }
+
+    /* Set up the rest of SHORT array properly */
+    keyptr = gt->gt_keys;
+    entptr = (KeyEntry*)(gt->gt_short + 4);
+    for (i=0; i< gt->gt_num_keys; i++,entptr++)
+    {
+        if (!WriteKey(gt,&tempData,entptr,keyptr+sortkeys[i])) return 0;
+    }	
+	
+    /* Write out the Key Directory */
+    (gt->gt_methods.set)(gt->gt_tif, GTIFF_GEOKEYDIRECTORY, gt->gt_nshorts, gt->gt_short );	
+	
+    /* Write out the params directories */
+    if (gt->gt_ndoubles)
+        (gt->gt_methods.set)(gt->gt_tif, GTIFF_DOUBLEPARAMS, gt->gt_ndoubles, gt->gt_double );
+    if (tempData.tk_asciiParamsLength > 0)
+    {
+        /* just to be safe */
+        tempData.tk_asciiParams[tempData.tk_asciiParamsLength] = '\0';
+        (gt->gt_methods.set)(gt->gt_tif,
+                             GTIFF_ASCIIPARAMS, 0, tempData.tk_asciiParams);
+    }
+	
+    gt->gt_flags &= ~FLAG_FILE_MODIFIED;
+
+    if (tempData.tk_asciiParamsLength > 0)
+    {
+        _GTIFFree (tempData.tk_asciiParams);
+    }
+    return 1;
+}
+
+/**********************************************************************
+ *
+ *                        Private Routines
+ *
+ **********************************************************************/
+ 
+/*
+ * Given GeoKey, write out the KeyEntry entries, returning 0 if failure.
+ *  This is the exact complement of ReadKey().
+ */
+
+static int WriteKey(GTIF* gt, TempKeyData* tempData,
+                    KeyEntry* entptr, GeoKey* keyptr)
+{
+    int count;
+	
+    entptr->ent_key = (pinfo_t) keyptr->gk_key;
+    entptr->ent_count = (pinfo_t) keyptr->gk_count;
+    count = entptr->ent_count;
+	
+    if (count==1 && keyptr->gk_type==TYPE_SHORT)
+    {
+        entptr->ent_location = GTIFF_LOCAL;
+        entptr->ent_val_offset = *(pinfo_t*)&keyptr->gk_data;
+        return 1;
+    }
+		  
+    switch (keyptr->gk_type)
+    {
+      case TYPE_SHORT:
+        entptr->ent_location = GTIFF_GEOKEYDIRECTORY;
+        entptr->ent_val_offset = (pinfo_t)
+            ((pinfo_t*)keyptr->gk_data - gt->gt_short);
+        break;
+      case TYPE_DOUBLE:
+        entptr->ent_location = GTIFF_DOUBLEPARAMS;
+        entptr->ent_val_offset = (pinfo_t) 
+            ((double*)keyptr->gk_data - gt->gt_double);
+        break;
+      case TYPE_ASCII:
+        entptr->ent_location = GTIFF_ASCIIPARAMS;
+        entptr->ent_val_offset = (pinfo_t) tempData->tk_asciiParamsOffset;
+        _GTIFmemcpy (tempData->tk_asciiParams + tempData->tk_asciiParamsOffset
+                     , keyptr->gk_data, keyptr->gk_count);
+        tempData->tk_asciiParams[tempData->tk_asciiParamsOffset+keyptr->gk_count-1] = '|';
+        tempData->tk_asciiParamsOffset += keyptr->gk_count;
+        break;
+      default:
+        return 0; /* failure */
+    }
+	
+    return 1; /* success */
+}
+
+
+/* 
+ * Numerically sort the GeoKeys.
+ * We just do a linear search through
+ * the list and pull out the keys that were set.
+ */
+
+static int SortKeys(GTIF* gt,int *sortkeys)
+{
+    int loc;
+    int nkeys=0;
+    geokey_t key,kmin,kmax;
+    int *index = gt->gt_keyindex;
+	
+    kmin = (geokey_t) gt->gt_keymin;
+    kmax = (geokey_t) gt->gt_keymax;
+    for (key=kmin; key<=kmax; key++)
+    {
+        if ( (loc=index[key]) != 0 )
+        {
+            sortkeys[nkeys] = loc;
+            nkeys++;
+        }
+    }
+	
+    return nkeys==gt->gt_num_keys;
+}
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/geokeys.h
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geokeys.h	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geokeys.h	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,54 @@
+/**********************************************************************
+ *
+ *  geokeys.h - Public registry for valid GEOTIFF GeoKeys.
+ *
+ *   Written By: Niles D. Ritter
+ *
+ *  Revision History:
+ *
+ *     Rev.#  Author  M/D/Y Date     Key Changes/Additions
+ *     -----  ------  ----------  -------------------------------------
+ *       0      ndr    06/10/95      Inital Beta Release
+ *       1      ndr    09/18/95      Final 1.0 Release
+ *
+ **********************************************************************/
+
+#ifndef __geokeys_h_
+#define __geokeys_h_
+
+/* The GvCurrentRevision number should be incremented whenever a 
+ * new set of Keys are defined or modified in "geokeys.inc", and comments 
+ * added to the "Revision History" section above. If only code
+ * _values_ are augmented, the "GvCurrentMinorRev" number should
+ * be incremented instead (see "geovalues.h"). Whenever the 
+ * GvCurrentRevision is incremented, the GvCurrentMinorRev should
+ * be reset to zero.
+ *
+ *
+ * The Section Numbers below refer to the GeoTIFF Spec sections
+ * in which these values are documented.
+ *
+ */
+#define GvCurrentRevision  1  /* Final 1.0 Release */
+
+#ifdef ValuePair
+#  undef ValuePair
+#endif
+#define ValuePair(name,value)    name = value,
+
+typedef enum {
+   BaseGeoKey   =  1024,               /* First valid code */
+
+#  include "geokeys.inc"         /* geokey database */
+
+   ReservedEndGeoKey  =  32767,
+   
+   /* Key space available for Private or internal use */
+   PrivateBaseGeoKey = 32768,    /* Consistent with TIFF Private tags */
+   PrivateEndGeoKey  = 65535,    
+   
+   EndGeoKey = 65535             /* Largest Possible GeoKey ID */
+} geokey_t;
+
+
+#endif /* __geokeys_h_ */

Added: packages/geotiff/libgeotiff-dfsg/trunk/geokeys.inc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geokeys.inc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geokeys.inc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,76 @@
+/* GeoTIFF GeoKey Database */
+
+/* Note: Any changes/additions to this database require */
+/* a change in the revision value in geokeys.h          */
+
+/* C database for Geotiff include files.   */
+/* the macro ValuePair() must be defined   */
+/* by the enclosing include file           */
+
+/*  Revised 28 Sep 1995   NDR -- Added Rev. 1.0 aliases. */
+
+/* 6.2.1 GeoTIFF Configuration Keys */
+
+ValuePair(  GTModelTypeGeoKey,	1024) /* Section 6.3.1.1 Codes       */
+ValuePair(  GTRasterTypeGeoKey,	1025) /* Section 6.3.1.2 Codes       */
+ValuePair(  GTCitationGeoKey,	1026) /* documentation */
+
+/* 6.2.2 Geographic CS Parameter Keys */
+
+ValuePair(  GeographicTypeGeoKey,	2048) /* Section 6.3.2.1 Codes     */
+ValuePair(  GeogCitationGeoKey,	2049) /* documentation             */
+ValuePair(  GeogGeodeticDatumGeoKey,	2050) /* Section 6.3.2.2 Codes     */
+ValuePair(  GeogPrimeMeridianGeoKey,	2051) /* Section 6.3.2.4 codes     */
+ValuePair(  GeogLinearUnitsGeoKey,	2052) /* Section 6.3.1.3 Codes     */
+ValuePair(  GeogLinearUnitSizeGeoKey,	2053) /* meters                    */
+ValuePair(  GeogAngularUnitsGeoKey,	2054) /* Section 6.3.1.4 Codes     */
+ValuePair(  GeogAngularUnitSizeGeoKey,	2055) /* radians                   */
+ValuePair(  GeogEllipsoidGeoKey,	2056) /* Section 6.3.2.3 Codes     */
+ValuePair(  GeogSemiMajorAxisGeoKey,	2057) /* GeogLinearUnits           */
+ValuePair(  GeogSemiMinorAxisGeoKey,	2058) /* GeogLinearUnits           */
+ValuePair(  GeogInvFlatteningGeoKey,	2059) /* ratio                     */
+ValuePair(  GeogAzimuthUnitsGeoKey,	2060) /* Section 6.3.1.4 Codes     */
+ValuePair(  GeogPrimeMeridianLongGeoKey,	2061) /* GeoAngularUnit            */
+
+/* 6.2.3 Projected CS Parameter Keys */
+/*    Several keys have been renamed,*/
+/*    and the deprecated names aliased for backward compatibility */
+
+ValuePair(  ProjectedCSTypeGeoKey,	3072)     /* Section 6.3.3.1 codes   */
+ValuePair(  PCSCitationGeoKey,	3073)     /* documentation           */
+ValuePair(  ProjectionGeoKey,	3074)     /* Section 6.3.3.2 codes   */
+ValuePair(  ProjCoordTransGeoKey,	3075)     /* Section 6.3.3.3 codes   */
+ValuePair(  ProjLinearUnitsGeoKey,	3076)     /* Section 6.3.1.3 codes   */
+ValuePair(  ProjLinearUnitSizeGeoKey,	3077)     /* meters                  */
+ValuePair(  ProjStdParallel1GeoKey,	3078)     /* GeogAngularUnit */
+ValuePair(  ProjStdParallelGeoKey,ProjStdParallel1GeoKey) /* ** alias **   */
+ValuePair(  ProjStdParallel2GeoKey,	3079)     /* GeogAngularUnit */
+ValuePair(  ProjNatOriginLongGeoKey,	3080)     /* GeogAngularUnit */
+ValuePair(  ProjOriginLongGeoKey,ProjNatOriginLongGeoKey) /* ** alias **     */
+ValuePair(  ProjNatOriginLatGeoKey,	3081)     /* GeogAngularUnit */
+ValuePair(  ProjOriginLatGeoKey,ProjNatOriginLatGeoKey)   /* ** alias **     */
+ValuePair(  ProjFalseEastingGeoKey,	3082)     /* ProjLinearUnits */
+ValuePair(  ProjFalseNorthingGeoKey,	3083)     /* ProjLinearUnits */
+ValuePair(  ProjFalseOriginLongGeoKey,	3084)     /* GeogAngularUnit */
+ValuePair(  ProjFalseOriginLatGeoKey,	3085)     /* GeogAngularUnit */
+ValuePair(  ProjFalseOriginEastingGeoKey,	3086)     /* ProjLinearUnits */
+ValuePair(  ProjFalseOriginNorthingGeoKey,	3087)     /* ProjLinearUnits */
+ValuePair(  ProjCenterLongGeoKey,	3088)     /* GeogAngularUnit */
+ValuePair(  ProjCenterLatGeoKey,	3089)     /* GeogAngularUnit */
+ValuePair(  ProjCenterEastingGeoKey,	3090)     /* ProjLinearUnits */
+ValuePair(  ProjCenterNorthingGeoKey,	3091)     /* ProjLinearUnits */
+ValuePair(  ProjScaleAtNatOriginGeoKey,	3092)     /* ratio   */
+ValuePair(  ProjScaleAtOriginGeoKey,ProjScaleAtNatOriginGeoKey)  /* ** alias **   */
+ValuePair(  ProjScaleAtCenterGeoKey,	3093)     /* ratio   */
+ValuePair(  ProjAzimuthAngleGeoKey,	3094)     /* GeogAzimuthUnit */
+ValuePair(  ProjStraightVertPoleLongGeoKey, 3095) /* GeogAngularUnit */
+ValuePair(  ProjRectifiedGridAngleGeoKey, 3096)   /* GeogAngularUnit */
+
+/* 6.2.4 Vertical CS Keys */
+   
+ValuePair(  VerticalCSTypeGeoKey,	4096)  /* Section 6.3.4.1 codes   */
+ValuePair(  VerticalCitationGeoKey,	4097)  /* documentation */
+ValuePair(  VerticalDatumGeoKey,	4098)  /* Section 6.3.4.2 codes   */
+ValuePair(  VerticalUnitsGeoKey,	4099)  /* Section 6.3.1 (.x) codes   */
+
+/* End of Data base */

Added: packages/geotiff/libgeotiff-dfsg/trunk/geonames.h
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geonames.h	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geonames.h	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,146 @@
+/*
+ * geonames.h
+ *
+ *  This encapsulates all of the value-naming mechanism of 
+ *  libgeotiff. 
+ *
+ *  Written By: Niles Ritter
+ *
+ *  Revision History:
+ *
+ *      Author     Date     Key Changes/Additions
+ *      ------  ----------  -------------------------------------
+ *      ndr    10 Jun 95     Inital Beta Release
+ *      ndr    28 Jul 95     Added ModelType aliases, Kv aliases.
+ */
+
+#ifndef __geonames_h
+#define __geonames_h
+
+struct _KeyInfo {
+	int ki_key;
+	char *ki_name;
+};
+typedef struct _KeyInfo KeyInfo;
+
+/* If memory is a premium, then omitting the 
+ * long name lists may save some space; simply 
+ * #define OMIT_GEOTIFF_NAMES in the compile statement
+ * to remove all key->string translation.
+ */
+#ifdef ValuePair
+#  undef ValuePair
+#endif
+
+#ifndef OMIT_GEOTIFF_NAMES
+#define ValuePair(token,value)  {token,#token},
+#else
+#define ValuePair(token,value)
+#endif
+
+#define END_LIST { -1, (char *)0}
+
+/************************************************************
+ *         6.2.x GeoTIFF Keys
+ ************************************************************/
+
+static KeyInfo _keyInfo[] =  {
+#   include "geokeys.inc"   /* geokey database */
+    END_LIST
+};
+
+#define COMMON_VALUES \
+   {KvUndefined, "Undefined"}, \
+   {KvUserDefined,"User-Defined"}, \
+   ValuePair(KvUndefined,KvUndefined) \
+   ValuePair(KvUserDefined,KvUserDefined) 
+
+static KeyInfo _csdefaultValue[] = {
+   COMMON_VALUES
+   END_LIST  
+};
+
+/************************************************************
+ *         6.3.x GeoTIFF Key Values
+ ************************************************************/
+
+static KeyInfo _modeltypeValue[] = {
+   COMMON_VALUES
+    ValuePair(ModelTypeProjected,1)
+    ValuePair(ModelTypeGeographic,2)
+    ValuePair(ModelTypeGeocentric,3)
+    ValuePair(ModelProjected,1)     /* aliases */
+    ValuePair(ModelGeographic,2)    /* aliases */
+    ValuePair(ModelGeocentric,3)    /* aliases */
+   END_LIST  
+};
+
+static KeyInfo _rastertypeValue[] = {
+   COMMON_VALUES
+    ValuePair(RasterPixelIsArea,1)
+    ValuePair(RasterPixelIsPoint,2)
+   END_LIST  
+};
+
+static KeyInfo _geounitsValue[] = {
+   COMMON_VALUES
+#  include "epsg_units.inc"
+   END_LIST  
+};
+
+static KeyInfo _geographicValue[] = {
+   COMMON_VALUES
+#  include "epsg_gcs.inc"
+   END_LIST  
+};
+
+static KeyInfo _geodeticdatumValue[] = {
+   COMMON_VALUES
+#  include "epsg_datum.inc"
+   END_LIST  
+};
+
+static KeyInfo _ellipsoidValue[] = {
+   COMMON_VALUES
+#  include "epsg_ellipse.inc"
+   END_LIST  
+};
+
+static KeyInfo _primemeridianValue[] = {
+   COMMON_VALUES
+#  include "epsg_pm.inc"
+   END_LIST  
+};
+
+static KeyInfo _pcstypeValue[] = {
+   COMMON_VALUES
+#  include "epsg_pcs.inc"
+   END_LIST  
+};
+
+static KeyInfo _projectionValue[] = {
+   COMMON_VALUES
+#  include "epsg_proj.inc"
+   END_LIST  
+};
+
+static KeyInfo _coordtransValue[] = {
+   COMMON_VALUES
+#  include "geo_ctrans.inc"
+   END_LIST  
+};
+
+static KeyInfo _vertcstypeValue[] = {
+   COMMON_VALUES
+#  include "epsg_vertcs.inc"
+   END_LIST  
+};
+
+static KeyInfo _vdatumValue[] = {
+   COMMON_VALUES
+    ValuePair(VDatumBase,1)
+   END_LIST  
+};
+
+#endif /* __geonames_h */
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/geotiff.h
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geotiff.h	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geotiff.h	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,117 @@
+/**********************************************************************
+ *
+ *  geotiff.h - Public interface for Geotiff tag parsing.
+ *
+ *
+ *   Written By: Niles D. Ritter
+ *
+ **********************************************************************/
+
+#ifndef __geotiff_h_
+#define __geotiff_h_
+
+/**
+ * \file geotiff.h
+ *
+ * Primary libgeotiff include file.
+ *
+ * This is the defacto registry for valid GEOTIFF GeoKeys
+ * and their associated symbolic values. This is also the only file
+ * of the GeoTIFF library which needs to be included in client source
+ * code.
+ */
+
+/* This Version code should only change if a drastic
+ * alteration is made to the GeoTIFF key structure. Readers
+ * encountering a larger value should give up gracefully.
+ */
+#define GvCurrentVersion   1
+
+#define LIBGEOTIFF_VERSION 1240
+
+#include "geo_config.h"
+#include "geokeys.h"
+
+/**********************************************************************
+ * Do we want to build as a DLL on windows?
+ **********************************************************************/
+#if !defined(CPL_DLL)
+#  if defined(_WIN32) && defined(BUILD_AS_DLL)
+#    define CPL_DLL     __declspec(dllexport)
+#  else
+#    define CPL_DLL
+#  endif
+#endif
+
+/**********************************************************************
+ *
+ *                 Public Structures & Definitions
+ *
+ **********************************************************************/
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+typedef struct gtiff GTIF;   /* struct gtiff is private */
+typedef unsigned short tifftag_t;
+typedef unsigned short geocode_t;
+typedef int (*GTIFPrintMethod)(char *string, void *aux);
+typedef int (*GTIFReadMethod)(char *string, void *aux);
+
+typedef enum {
+   TYPE_BYTE=1,
+   TYPE_SHORT=2,
+   TYPE_LONG=3,
+   TYPE_RATIONAL=4,
+   TYPE_ASCII=5,
+   TYPE_FLOAT=6,
+   TYPE_DOUBLE=7,
+   TYPE_SBYTE=8,
+   TYPE_SSHORT=9,
+   TYPE_SLONG=10,
+   TYPE_UNKNOWN=11
+} tagtype_t;
+
+
+/**********************************************************************
+ *
+ *                 Public Function Declarations
+ *
+ **********************************************************************/
+
+/* TIFF-level interface */
+GTIF CPL_DLL *GTIFNew(void *tif);
+void CPL_DLL  GTIFFree(GTIF *gtif);
+int  CPL_DLL  GTIFWriteKeys(GTIF *gtif);
+void CPL_DLL  GTIFDirectoryInfo(GTIF *gtif, int *versions, int *keycount);
+
+/* GeoKey Access */
+int  CPL_DLL  GTIFKeyInfo(GTIF *gtif, geokey_t key, int *size, tagtype_t* type);
+int  CPL_DLL  GTIFKeyGet(GTIF *gtif, geokey_t key, void *val, int index,
+                         int count);
+int  CPL_DLL  GTIFKeySet(GTIF *gtif, geokey_t keyID, tagtype_t type,
+                         int count,...);
+
+/* Metadata Import-Export utilities */
+void  CPL_DLL  GTIFPrint(GTIF *gtif, GTIFPrintMethod print, void *aux);
+int   CPL_DLL  GTIFImport(GTIF *gtif, GTIFReadMethod scan, void *aux);
+char  CPL_DLL *GTIFKeyName(geokey_t key);
+char  CPL_DLL *GTIFValueName(geokey_t key,int value);
+char  CPL_DLL *GTIFTypeName(tagtype_t type);
+char  CPL_DLL *GTIFTagName(int tag);
+int   CPL_DLL  GTIFKeyCode(char * key);
+int   CPL_DLL  GTIFValueCode(geokey_t key,char *value);
+int   CPL_DLL  GTIFTypeCode(char *type);
+int   CPL_DLL  GTIFTagCode(char *tag);
+
+/* Translation between image/PCS space */
+
+int CPL_DLL    GTIFImageToPCS( GTIF *gtif, double *x, double *y );
+int CPL_DLL    GTIFPCSToImage( GTIF *gtif, double *x, double *y );
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __geotiff_h_ */

Added: packages/geotiff/libgeotiff-dfsg/trunk/geotiff_proj4.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geotiff_proj4.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geotiff_proj4.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,725 @@
+/******************************************************************************
+ * $Id: geotiff_proj4.c,v 1.23 2007/03/13 18:04:33 fwarmerdam Exp $
+ *
+ * Project:  libgeotiff
+ * Purpose:  Code to convert a normalized GeoTIFF definition into a PROJ.4
+ *           (OGDI) compatible projection string.
+ * 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: geotiff_proj4.c,v $
+ * Revision 1.23  2007/03/13 18:04:33  fwarmerdam
+ * added new zealand map grid support per bug 1519
+ *
+ * Revision 1.22  2005/03/04 04:32:37  fwarmerdam
+ * added cylindricalequalarea support
+ *
+ * Revision 1.21  2003/08/21 18:42:39  warmerda
+ * fixed support for ModelTypeGeographic as per email from Young Su, Cha
+ *
+ * Revision 1.20  2003/07/08 17:31:30  warmerda
+ * cleanup various warnings
+ *
+ * Revision 1.19  2002/11/29 20:57:09  warmerda
+ * added LCC1SP mapping
+ *
+ * Revision 1.18  2002/07/09 14:47:53  warmerda
+ * fixed translation of polar stereographic
+ *
+ * Revision 1.17  2001/11/23 19:53:56  warmerda
+ * free PROJ.4 definitions after use
+ *
+ * Revision 1.16  2000/12/05 19:21:45  warmerda
+ * added cassini support
+ *
+ * Revision 1.15  2000/12/05 17:44:41  warmerda
+ * Use +R_A for Miller and VanDerGrinten
+ *
+ * Revision 1.14  2000/10/13 18:06:51  warmerda
+ * added econic support for PROJ.4 translation
+ *
+ * Revision 1.13  2000/09/15 19:30:48  warmerda
+ * *** empty log message ***
+ *
+ * Revision 1.12  2000/09/15 18:21:07  warmerda
+ * 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!
+ *
+ * Revision 1.11  2000/06/06 17:39:45  warmerda
+ * Modify to work with projUV version of library.
+ *
+ * Revision 1.10  1999/07/06 15:05:51  warmerda
+ * Fixed up LCC_1SP notes.
+ *
+ * Revision 1.9  1999/05/04 16:24:49  warmerda
+ * Fixed projection string formating with zones.
+ *
+ * Revision 1.8  1999/05/04 12:27:01  geotiff
+ * only emit proj unsupported warning if DEBUG defined
+ *
+ * Revision 1.7  1999/05/04 03:14:59  warmerda
+ * fixed use of foot instead of ft for units
+ *
+ * Revision 1.6  1999/05/03 17:50:31  warmerda
+ * avoid warnings on IRIX
+ *
+ * Revision 1.5  1999/04/29 23:02:24  warmerda
+ * added mapsys utm test.
+ *
+ * Revision 1.4  1999/03/18 21:35:42  geotiff
+ * Added reprojection functions
+ *
+ * Revision 1.3  1999/03/10 18:11:17  geotiff
+ * Removed comment about this not being the master ... now it is.
+ *
+ * Revision 1.2  1999/03/10 18:10:27  geotiff
+ * Avoid use of cpl_serv.h and CPLStrdup().
+ *
+ * Revision 1.1  1999/03/10 15:20:43  geotiff
+ * New
+ *
+ */
+
+#include "cpl_serv.h"
+#include "geotiff.h"
+#include "geo_normalize.h"
+#include "geovalues.h"
+
+/************************************************************************/
+/*                          GTIFGetProj4Defn()                          */
+/************************************************************************/
+
+char * GTIFGetProj4Defn( GTIFDefn * psDefn )
+
+{
+    char	szProjection[512];
+    char	szUnits[24];
+    double      dfFalseEasting, dfFalseNorthing;
+
+    szProjection[0] = '\0';
+    
+/* ==================================================================== */
+/*      Translate the units of measure.                                 */
+/*                                                                      */
+/*      Note that even with a +units, or +to_meter in effect, it is     */
+/*      still assumed that all the projection parameters are in         */
+/*      meters.                                                         */
+/* ==================================================================== */
+    if( psDefn->UOMLength == Linear_Meter )
+    {
+        strcpy( szUnits, "+units=m " ); 
+    }
+    else if( psDefn->UOMLength == Linear_Foot )
+    {
+        strcpy( szUnits, "+units=ft " );
+    }
+    else if( psDefn->UOMLength == Linear_Foot_US_Survey )
+    {
+        strcpy( szUnits, "+units=us-ft " );
+    }
+    else if( psDefn->UOMLength == Linear_Foot_Indian )
+    {
+        strcpy( szUnits, "+units=ind-ft " );
+    }
+    else if( psDefn->UOMLength == Linear_Link )
+    {
+        strcpy( szUnits, "+units=link " );
+    }
+    else if( psDefn->UOMLength == Linear_Yard_Indian)
+    {
+        strcpy( szUnits, "+units=ind-yd " );
+    }
+    else if( psDefn->UOMLength == Linear_Fathom )
+    {
+        strcpy( szUnits, "+units=fath " );
+    }
+    else if( psDefn->UOMLength == Linear_Mile_International_Nautical )
+    {
+        strcpy( szUnits, "+units=kmi " );
+    }
+    else
+    {
+        sprintf( szUnits, "+to_meter=%.10f", psDefn->UOMLengthInMeters );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      false easting and northing are in meters and that is what       */
+/*      PROJ.4 wants regardless of the linear units.                    */
+/* -------------------------------------------------------------------- */
+    dfFalseEasting = psDefn->ProjParm[5];
+    dfFalseNorthing = psDefn->ProjParm[6];
+    
+/* ==================================================================== */
+/*      Handle general projection methods.                              */
+/* ==================================================================== */
+ 
+/* -------------------------------------------------------------------- */
+/*      Geographic.                                                     */
+/* -------------------------------------------------------------------- */
+    if(psDefn->Model==ModelTypeGeographic)
+    {
+        sprintf(szProjection+strlen(szProjection),"+proj=latlong ");
+        
+    }
+ 
+/* -------------------------------------------------------------------- */
+/*      UTM - special case override on transverse mercator so things    */
+/*      will be more meaningful to the user.                            */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->MapSys == MapSys_UTM_North )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=utm +zone=%d ",
+                 psDefn->Zone );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      Transverse Mercator                                             */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_TransverseMercator )
+    {
+        sprintf( szProjection+strlen(szProjection),
+           "+proj=tmerc +lat_0=%.9f +lon_0=%.9f +k=%f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 psDefn->ProjParm[4],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Mercator							*/
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_Mercator )
+    {
+        sprintf( szProjection+strlen(szProjection),
+           "+proj=merc +lat_ts=%.9f +lon_0=%.9f +k=%f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 psDefn->ProjParm[4],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Cassini/Soldner                                                 */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_CassiniSoldner )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=cass +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Oblique Stereographic - Should this really map onto             */
+/*      Stereographic?                                                  */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_ObliqueStereographic )
+    {
+        sprintf( szProjection+strlen(szProjection),
+           "+proj=stere +lat_0=%.9f +lon_0=%.9f +k=%f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 psDefn->ProjParm[4],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Stereographic                                                   */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_Stereographic )
+    {
+        sprintf( szProjection+strlen(szProjection),
+           "+proj=stere +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Polar Stereographic                                             */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_PolarStereographic )
+    {
+        if( psDefn->ProjParm[0] > 0.0 )
+            sprintf( szProjection+strlen(szProjection),
+                     "+proj=stere +lat_0=90 +lat_ts=%.9f +lon_0=%.9f "
+                     "+k=%.9f +x_0=%.3f +y_0=%.3f ",
+                     psDefn->ProjParm[0],
+                     psDefn->ProjParm[1],
+                     psDefn->ProjParm[4],
+                     dfFalseEasting,
+                     dfFalseNorthing );
+        else
+            sprintf( szProjection+strlen(szProjection),
+                     "+proj=stere +lat_0=-90 +lat_ts=%.9f +lon_0=%.9f "
+                     "+k=%.9f +x_0=%.3f +y_0=%.3f ",
+                     psDefn->ProjParm[0],
+                     psDefn->ProjParm[1],
+                     psDefn->ProjParm[4],
+                     dfFalseEasting,
+                     dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Equirectangular                                                 */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_Equirectangular )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=eqc +lat_ts=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Gnomonic                                                        */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_Gnomonic )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=gnom +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Orthographic                                                    */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_Orthographic )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=ortho +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Lambert Azimuthal Equal Area                                    */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_LambertAzimEqualArea )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=laea +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Azimuthal Equidistant                                           */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_AzimuthalEquidistant )
+    {
+        sprintf( szProjection+strlen(szProjection),
+           "+proj=aeqd +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Miller Cylindrical                                              */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_MillerCylindrical )
+    {
+        sprintf( szProjection+strlen(szProjection),
+           "+proj=mill +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f +R_A ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Polyconic                                                       */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_Polyconic )
+    {
+        sprintf( szProjection+strlen(szProjection),
+           "+proj=poly +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+
+/* -------------------------------------------------------------------- */
+/*      AlbersEqualArea                                                 */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_AlbersEqualArea )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=aea +lat_1=%.9f +lat_2=%.9f +lat_0=%.9f +lon_0=%.9f"
+                 " +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 psDefn->ProjParm[2],
+                 psDefn->ProjParm[3],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      EquidistantConic                                                */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_EquidistantConic )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=eqdc +lat_1=%.9f +lat_2=%.9f +lat_0=%.9f +lon_0=%.9f"
+                 " +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 psDefn->ProjParm[2],
+                 psDefn->ProjParm[3],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      Robinson                                                        */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_Robinson )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=robin +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      VanDerGrinten                                                   */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_VanDerGrinten )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=vandg +lon_0=%.9f +x_0=%.3f +y_0=%.3f +R_A ",
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      Sinusoidal                                                      */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_Sinusoidal )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=sinu +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[1],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      LambertConfConic_2SP                                            */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_LambertConfConic_2SP )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=lcc +lat_0=%.9f +lon_0=%.9f +lat_1=%.9f +lat_2=%.9f "
+                 " +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 psDefn->ProjParm[2],
+                 psDefn->ProjParm[3],
+                 dfFalseEasting,
+                 dfFalseNorthing );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      LambertConfConic_1SP                                            */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_LambertConfConic_1SP )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=lcc +lat_0=%.9f +lat_1=%.9f +lon_0=%.9f"
+                 " +k_0=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 psDefn->ProjParm[4],
+                 psDefn->ProjParm[5],
+                 psDefn->ProjParm[6] );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      CT_CylindricalEqualArea                                         */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_CylindricalEqualArea )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=cea +lat_ts=%.9f +lon_0=%.9f "
+                 " +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 psDefn->ProjParm[5],
+                 psDefn->ProjParm[6] );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      NewZealandMapGrid                                               */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_NewZealandMapGrid )
+    {
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=nzmg +lat_0=%.9f +lon_0=%.9f"
+                 " +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 psDefn->ProjParm[5],
+                 psDefn->ProjParm[6] );
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      Transverse Mercator - south oriented.                           */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_TransvMercator_SouthOriented )
+    {
+        /* this appears to be an unsupported formulation with PROJ.4 */
+    }
+    
+/* -------------------------------------------------------------------- */
+/*      ObliqueMercator (Hotine)                                        */
+/* -------------------------------------------------------------------- */
+    else if( psDefn->CTProjection == CT_ObliqueMercator )
+    {
+        /* not clear how ProjParm[3] - angle from rectified to skewed grid -
+           should be applied ... see the +not_rot flag for PROJ.4.
+           Just ignoring for now. */
+
+        sprintf( szProjection+strlen(szProjection),
+                 "+proj=omerc +lat_0=%.9f +lonc=%.9f +alpha=%.9f"
+                 " +k=%.9f +x_0=%.3f +y_0=%.3f ",
+                 psDefn->ProjParm[0],
+                 psDefn->ProjParm[1],
+                 psDefn->ProjParm[2],
+                 psDefn->ProjParm[4],
+                 psDefn->ProjParm[5],
+                 psDefn->ProjParm[6] );
+    }
+
+/* ==================================================================== */
+/*      Handle ellipsoid information.                                   */
+/* ==================================================================== */
+    if( psDefn->Ellipsoid == Ellipse_WGS_84 )
+        strcat( szProjection, "+ellps=WGS84 " );
+    else if( psDefn->Ellipsoid == Ellipse_Clarke_1866 )
+        strcat( szProjection, "+ellps=clrk66 " );
+    else if( psDefn->Ellipsoid == Ellipse_Clarke_1880 )
+        strcat( szProjection, "+ellps=clrk80 " );
+    else if( psDefn->Ellipsoid == Ellipse_GRS_1980 )
+        strcat( szProjection, "+ellps=GRS80 " );
+    else
+    {
+        if( psDefn->SemiMajor != 0.0 && psDefn->SemiMinor != 0.0 )
+        {
+            sprintf( szProjection+strlen(szProjection),
+                     "+a=%.3f +b=%.3f ",
+                     psDefn->SemiMajor,
+                     psDefn->SemiMinor );
+        }
+    }
+
+    strcat( szProjection, szUnits );
+
+    return( strdup( szProjection ) );
+}
+
+#if !defined(HAVE_LIBPROJ) || !defined(HAVE_PROJECTS_H)
+
+int GTIFProj4ToLatLong( GTIFDefn * psDefn, int nPoints,
+                        double *padfX, double *padfY )
+{
+    (void) psDefn;
+    (void) nPoints;
+    (void) padfX;
+    (void) padfY;
+#ifdef DEBUG    
+    fprintf( stderr,
+             "GTIFProj4ToLatLong() - PROJ.4 support not compiled in.\n" );
+#endif    
+    return FALSE;
+}
+
+int GTIFProj4FromLatLong( GTIFDefn * psDefn, int nPoints,
+                          double *padfX, double *padfY )
+{
+    (void) psDefn;
+    (void) nPoints;
+    (void) padfX;
+    (void) padfY;
+#ifdef DEBUG    
+    fprintf( stderr,
+             "GTIFProj4FromLatLong() - PROJ.4 support not compiled in.\n" );
+#endif    
+    return FALSE;
+}
+#else
+
+#include "projects.h"
+
+#ifdef USE_PROJUV
+#  define UV projUV
+#endif
+
+/************************************************************************/
+/*                        GTIFProj4FromLatLong()                        */
+/*                                                                      */
+/*      Convert lat/long values to projected coordinate for a           */
+/*      particular definition.                                          */
+/************************************************************************/
+
+int GTIFProj4FromLatLong( GTIFDefn * psDefn, int nPoints,
+                          double *padfX, double *padfY )
+
+{
+    char	*pszProjection, **papszArgs;
+    PJ		*psPJ;
+    int		i;
+    
+/* -------------------------------------------------------------------- */
+/*      Get a projection definition.                                    */
+/* -------------------------------------------------------------------- */
+    pszProjection = GTIFGetProj4Defn( psDefn );
+
+    if( pszProjection == NULL )
+        return FALSE;
+
+/* -------------------------------------------------------------------- */
+/*      Parse into tokens for pj_init(), and initialize the projection. */
+/* -------------------------------------------------------------------- */
+    
+    papszArgs = CSLTokenizeStringComplex( pszProjection, " +", TRUE, FALSE );
+    free( pszProjection );
+
+    psPJ = pj_init( CSLCount(papszArgs), papszArgs );
+
+    CSLDestroy( papszArgs );
+
+    if( psPJ == NULL )
+    {
+        return FALSE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Process each of the points.                                     */
+/* -------------------------------------------------------------------- */
+    for( i = 0; i < nPoints; i++ )
+    {
+        UV	sUV;
+
+        sUV.u = padfX[i] * DEG_TO_RAD;
+        sUV.v = padfY[i] * DEG_TO_RAD;
+
+        sUV = pj_fwd( sUV, psPJ );
+
+        padfX[i] = sUV.u;
+        padfY[i] = sUV.v;
+    }
+
+    pj_free( psPJ );
+
+    return TRUE;
+}
+
+/************************************************************************/
+/*                         GTIFProj4ToLatLong()                         */
+/*                                                                      */
+/*      Convert projection coordinates to lat/long for a particular     */
+/*      definition.                                                     */
+/************************************************************************/
+
+int GTIFProj4ToLatLong( GTIFDefn * psDefn, int nPoints,
+                        double *padfX, double *padfY )
+
+{
+    char	*pszProjection, **papszArgs;
+    PJ		*psPJ;
+    int		i;
+    
+/* -------------------------------------------------------------------- */
+/*      Get a projection definition.                                    */
+/* -------------------------------------------------------------------- */
+    pszProjection = GTIFGetProj4Defn( psDefn );
+
+    if( pszProjection == NULL )
+        return FALSE;
+
+/* -------------------------------------------------------------------- */
+/*      Parse into tokens for pj_init(), and initialize the projection. */
+/* -------------------------------------------------------------------- */
+    
+    papszArgs = CSLTokenizeStringComplex( pszProjection, " +", TRUE, FALSE );
+    free( pszProjection );
+
+    psPJ = pj_init( CSLCount(papszArgs), papszArgs );
+
+    CSLDestroy( papszArgs );
+
+    if( psPJ == NULL )
+    {
+        return FALSE;
+    }
+
+/* -------------------------------------------------------------------- */
+/*      Process each of the points.                                     */
+/* -------------------------------------------------------------------- */
+    for( i = 0; i < nPoints; i++ )
+    {
+        UV	sUV;
+
+        sUV.u = padfX[i];
+        sUV.v = padfY[i];
+
+        sUV = pj_inv( sUV, psPJ );
+
+        padfX[i] = sUV.u * RAD_TO_DEG;
+        padfY[i] = sUV.v * RAD_TO_DEG;
+    }
+
+    pj_free( psPJ );
+
+    return TRUE;
+}
+
+
+#endif /* has projects.h and -lproj */
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/geotiffio.h
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geotiffio.h	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geotiffio.h	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,16 @@
+/* 
+ * geotiffio.h
+ * 
+ * Standard include file for geotiff, including all
+ *  key and code definitions.
+ */
+
+
+#ifndef __geotiffio_h
+#define __geotiffio_h
+
+#include "geotiff.h"  /* public key interface */
+#include "geovalues.h" /* key code definitions */
+
+#endif /* __geotiffio_h */
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/geovalues.h
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/geovalues.h	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/geovalues.h	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,120 @@
+/**********************************************************************
+ *
+ *  geovalues.h - Public registry for valid GEOTIFF  key-values.
+ *
+ *   Written By: Niles D. Ritter
+ *
+ *  Revision History:
+ *
+ *     Rev.#  Author     Date     Key Changes/Additions
+ *     -----  ------  ----------  -------------------------------------
+ *      0.1     ndr    10 Jun 95     Inital Beta Release
+ *      0.2     ndr    12 Jul 95     New EPSG Tables installed.
+ *      0.2.1   ndr    28 Jul 95     Added ModelType aliases to Model's
+ *      1.0     ndr    18 Sep 95     Promoted to Revision 1.0
+ *
+ **********************************************************************/
+
+#ifndef __geovalues_h_
+#define __geovalues_h_
+
+/* If code values are added or modified, the "GvCurrentMinorRev" 
+ * number should be incremented here. If new Keys are added, then the
+ * GvCurrentRevision number should be incremented instead, and the
+ * GvCurrentMinorRev should be reset to zero (see "geokeys.h").
+ *
+ * In addition, any changes here should be reflected in "geo_names.c"
+ *
+ */
+ 
+#define GvCurrentMinorRev  0  /* First Major Rev EPSG Code Release  */
+
+
+/*
+ * Universal key values -- defined for consistency
+ */
+#define KvUndefined         0
+#define KvUserDefined   32767
+
+#ifdef ValuePair
+#  undef ValuePair
+#endif
+#define ValuePair(name,value)    name = value,
+
+/*
+ * The section numbers refer to the GeoTIFF Specification section
+ * in which the code values are documented.
+ */
+ 
+/************************************************************
+ *         6.3.1 GeoTIFF General Codes
+ ************************************************************/
+
+/* 6.3.1.1 Model Type Codes */
+typedef enum {
+	ModelTypeProjected  = 1,  /* Projection Coordinate System */
+	ModelTypeGeographic = 2,  /* Geographic latitude-longitude System */
+	ModelTypeGeocentric = 3,   /* Geocentric (X,Y,Z) Coordinate System */
+	ModelProjected  = ModelTypeProjected,   /* alias */
+	ModelGeographic = ModelTypeGeographic,  /* alias */
+	ModelGeocentric = ModelTypeGeocentric   /* alias */
+} modeltype_t;
+
+/* 6.3.1.2 Raster Type Codes */
+typedef enum {
+	RasterPixelIsArea   = 1,  /* Standard pixel-fills-grid-cell */
+	RasterPixelIsPoint  = 2   /* Pixel-at-grid-vertex */
+} rastertype_t;
+
+typedef enum {
+#  include "epsg_gcs.inc"
+  geographic_end
+} geographic_t;
+
+typedef enum {
+#  include "epsg_datum.inc"
+   geodeticdatum_end
+} geodeticdatum_t;
+
+typedef enum {
+#  include "epsg_units.inc"
+   Unit_End
+} geounits_t;
+
+typedef enum {
+#  include "epsg_ellipse.inc"
+    ellipsoid_end
+} ellipsoid_t;
+
+typedef enum {
+#  include "epsg_pm.inc"
+   primemeridian_end
+} primemeridian_t;
+
+typedef enum {
+#  include "epsg_pcs.inc"
+   pcstype_end
+} pcstype_t;
+
+typedef enum {
+#  include "epsg_proj.inc"
+   projection_end
+} projection_t;
+
+typedef enum {
+#  include "geo_ctrans.inc"
+   coordtrans_end
+} coordtrans_t;
+
+typedef enum {
+#  include "epsg_vertcs.inc"
+   vertcs_end
+} vertcstype_t;
+
+
+typedef enum {
+	VDatumBase = 1
+} vdatum_t;
+
+#endif /* __geovalues_h_ */
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/install-sh
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/install-sh	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/install-sh	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,251 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission.  M.I.T. makes no representations about the
+# suitability of this software for any purpose.  It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-c) instcmd="$cpprog"
+	    shift
+	    continue;;
+
+	-d) dir_arg=true
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd="$stripprog"
+	    shift
+	    continue;;
+
+	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
+	    shift
+	    continue;;
+
+	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+	    shift
+	    continue;;
+
+	*)  if [ x"$src" = x ]
+	    then
+		src=$1
+	    else
+		# this colon is to work around a 386BSD /bin/sh bug
+		:
+		dst=$1
+	    fi
+	    shift
+	    continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+	echo "install:	no input file specified"
+	exit 1
+else
+	true
+fi
+
+if [ x"$dir_arg" != x ]; then
+	dst=$src
+	src=""
+	
+	if [ -d $dst ]; then
+		instcmd=:
+		chmodcmd=""
+	else
+		instcmd=mkdir
+	fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+	if [ -f $src -o -d $src ]
+	then
+		true
+	else
+		echo "install:  $src does not exist"
+		exit 1
+	fi
+	
+	if [ x"$dst" = x ]
+	then
+		echo "install:	no destination specified"
+		exit 1
+	else
+		true
+	fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+	if [ -d $dst ]
+	then
+		dst="$dst"/`basename $src`
+	else
+		true
+	fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='	
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+	pathcomp="${pathcomp}${1}"
+	shift
+
+	if [ ! -d "${pathcomp}" ] ;
+        then
+		$mkdirprog "${pathcomp}"
+	else
+		true
+	fi
+
+	pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+	$doit $instcmd $dst &&
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+	if [ x"$transformarg" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		dstfile=`basename $dst $transformbasename | 
+			sed $transformarg`$transformbasename
+	fi
+
+# don't allow the sed command to completely eliminate the filename
+
+	if [ x"$dstfile" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		true
+	fi
+
+# Make a temp file name in the proper directory.
+
+	dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+	$doit $instcmd $src $dsttmp &&
+
+	trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+	$doit $rmcmd -f $dstdir/$dstfile &&
+	$doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0


Property changes on: packages/geotiff/libgeotiff-dfsg/trunk/install-sh
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/geotiff/libgeotiff-dfsg/trunk/libxtiff/xtiff.c
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/libxtiff/xtiff.c	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/libxtiff/xtiff.c	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,205 @@
+/*
+ * xtiff.c
+ *
+ * Extended TIFF Directory GEO Tag Support.
+ *
+ *  You may use this file as a template to add your own
+ *  extended tags to the library. Only the parts of the code
+ *  marked with "XXX" require modification.
+ *
+ *  Author: Niles D. Ritter
+ *
+ *  Revisions:
+ *    18 Sep 1995   -- Deprecated Integraph Matrix tag with new one.
+ *                     Backward compatible support provided.  --NDR.
+ */
+ 
+#include "xtiffio.h"
+#include <stdio.h>
+#include "cpl_serv.h"
+
+/*  Tiff info structure.
+ *
+ *     Entry format:
+ *        { TAGNUMBER, ReadCount, WriteCount, DataType, FIELDNUM, 
+ *          OkToChange, PassDirCountOnSet, AsciiName }
+ *
+ *     For ReadCount, WriteCount, -1 = unknown.
+ */
+
+static const TIFFFieldInfo xtiffFieldInfo[] = {
+  
+  /* XXX Insert Your tags here */
+    { TIFFTAG_GEOPIXELSCALE,	-1,-1, TIFF_DOUBLE,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"GeoPixelScale" },
+    { TIFFTAG_INTERGRAPH_MATRIX,-1,-1, TIFF_DOUBLE,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"Intergraph TransformationMatrix" },
+    { TIFFTAG_GEOTRANSMATRIX,	-1,-1, TIFF_DOUBLE,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"GeoTransformationMatrix" },
+    { TIFFTAG_GEOTIEPOINTS,	-1,-1, TIFF_DOUBLE,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"GeoTiePoints" },
+    { TIFFTAG_GEOKEYDIRECTORY,-1,-1, TIFF_SHORT,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"GeoKeyDirectory" },
+    { TIFFTAG_GEODOUBLEPARAMS,	-1,-1, TIFF_DOUBLE,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"GeoDoubleParams" },
+    { TIFFTAG_GEOASCIIPARAMS,	-1,-1, TIFF_ASCII,	FIELD_CUSTOM,
+      TRUE,	FALSE,	"GeoASCIIParams" },
+#ifdef JPL_TAG_SUPPORT
+    { TIFFTAG_JPL_CARTO_IFD,	 1, 1, TIFF_LONG,	FIELD_CUSTOM,
+      TRUE,	TRUE,	"JPL Carto IFD offset" },  /** Don't use this! **/
+#endif
+};
+
+#define	N(a)	(sizeof (a) / sizeof (a[0]))
+static void _XTIFFLocalDefaultDirectory(TIFF *tif)
+{
+    /* Install the extended Tag field info */
+    TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));
+}
+
+
+/**********************************************************************
+ *    Nothing below this line should need to be changed.
+ **********************************************************************/
+
+static TIFFExtendProc _ParentExtender;
+
+/*
+ *  This is the callback procedure, and is
+ *  called by the DefaultDirectory method
+ *  every time a new TIFF directory is opened.
+ */
+
+static void
+_XTIFFDefaultDirectory(TIFF *tif)
+{
+    /* set up our own defaults */
+    _XTIFFLocalDefaultDirectory(tif);
+
+    /* Since an XTIFF client module may have overridden
+     * the default directory method, we call it now to
+     * allow it to set up the rest of its own methods.
+     */
+
+    if (_ParentExtender) 
+        (*_ParentExtender)(tif);
+}
+
+
+/**
+Registers an extension with libtiff for adding GeoTIFF tags.
+After this one-time intialization, any TIFF open function may be called in
+the usual manner to create a TIFF file that compatible with libgeotiff.
+The XTIFF open functions are simply for convenience: they call this
+and then pass their parameters on to the appropriate TIFF open function.
+
+<p>This function may be called any number of times safely, since it will
+only register the extension the first time it is called.
+**/
+
+void XTIFFInitialize(void)
+{
+    static int first_time=1;
+	
+    if (! first_time) return; /* Been there. Done that. */
+    first_time = 0;
+	
+    /* Grab the inherited method and install */
+    _ParentExtender = TIFFSetTagExtender(_XTIFFDefaultDirectory);
+}
+
+
+/**
+ * GeoTIFF compatible TIFF file open function.
+ *
+ * @param name The filename of a TIFF file to open.
+ * @param mode The open mode ("r", "w" or "a").
+ *
+ * @return a TIFF * for the file, or NULL if the open failed.
+ *
+This function is used to open GeoTIFF files instead of TIFFOpen() from
+libtiff.  Internally it calls TIFFOpen(), but sets up some extra hooks
+so that GeoTIFF tags can be extracted from the file.  If XTIFFOpen() isn't
+used, GTIFNew() won't work properly.  Files opened
+with XTIFFOpen() should be closed with XTIFFClose().
+
+The name of the file to be opened should be passed as <b>name</b>, and an
+opening mode ("r", "w" or "a") acceptable to TIFFOpen() should be passed as the
+<b>mode</b>.<p>
+
+If XTIFFOpen() fails it will return NULL.  Otherwise, normal TIFFOpen()
+error reporting steps will have already taken place.<p>
+ */
+
+TIFF*
+XTIFFOpen(const char* name, const char* mode)
+{
+    TIFF *tif;
+
+    /* Set up the callback */
+    XTIFFInitialize();	
+	
+    /* Open the file; the callback will set everything up
+     */
+    tif = TIFFOpen(name, mode);
+    if (!tif) return tif;
+	
+    return tif;
+}
+
+TIFF*
+XTIFFFdOpen(int fd, const char* name, const char* mode)
+{
+    TIFF *tif;
+
+    /* Set up the callback */
+    XTIFFInitialize();	
+
+    /* Open the file; the callback will set everything up
+     */
+    tif = TIFFFdOpen(fd, name, mode);
+    if (!tif) return tif;
+	
+    return tif;
+}
+
+TIFF*
+XTIFFClientOpen(const char* name, const char* mode, thandle_t thehandle,
+	    TIFFReadWriteProc RWProc, TIFFReadWriteProc RWProc2,
+	    TIFFSeekProc SProc, TIFFCloseProc CProc,
+	    TIFFSizeProc SzProc,
+	    TIFFMapFileProc MFProvc, TIFFUnmapFileProc UMFProc )
+{
+    TIFF *tif;
+    
+    /* Set up the callback */
+    XTIFFInitialize();	
+    
+    /* Open the file; the callback will set everything up
+     */
+    tif = TIFFClientOpen(name, mode, thehandle,
+                         RWProc, RWProc2,
+                         SProc, CProc,
+                         SzProc,
+                         MFProvc, UMFProc);
+    
+    if (!tif) return tif;
+    
+    return tif;
+}
+
+/**
+ * Close a file opened with XTIFFOpen().
+ *
+ * @param tif The file handle returned by XTIFFOpen().
+ * 
+ * If a GTIF structure was created with GTIFNew()
+ * for this file, it should be freed with GTIFFree()
+ * <i>before</i> calling XTIFFClose().
+*/
+
+void
+XTIFFClose(TIFF *tif)
+{
+    TIFFClose(tif);
+}

Added: packages/geotiff/libgeotiff-dfsg/trunk/libxtiff/xtiffio.h
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/libxtiff/xtiffio.h	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/libxtiff/xtiffio.h	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,84 @@
+/*
+ *  xtiffio.h -- Public interface to Extended GEO TIFF tags
+ *
+ *    written by: Niles D. Ritter
+ */
+
+#ifndef __xtiffio_h
+#define __xtiffio_h
+
+#include "tiffio.h"
+#include "geo_config.h"
+
+/**
+ * \file xtiffio.h
+ *
+ * Definitions relating GeoTIFF functions from geotiff.h to the TIFF
+ * library (usually libtiff).
+ */
+
+/* 
+ *  Define public Tag names and values here 
+ */
+
+/* tags 33550 is a private tag registered to SoftDesk, Inc */
+#define TIFFTAG_GEOPIXELSCALE       33550
+/* tags 33920-33921 are private tags registered to Intergraph, Inc */
+#define TIFFTAG_INTERGRAPH_MATRIX    33920   /* $use TIFFTAG_GEOTRANSMATRIX ! */
+#define TIFFTAG_GEOTIEPOINTS         33922
+/* tags 34263-34264 are private tags registered to NASA-JPL Carto Group */
+#ifdef JPL_TAG_SUPPORT
+#define TIFFTAG_JPL_CARTO_IFD        34263    /* $use GeoProjectionInfo ! */
+#endif
+#define TIFFTAG_GEOTRANSMATRIX       34264    /* New Matrix Tag replaces 33920 */
+/* tags 34735-3438 are private tags registered to SPOT Image, Inc */
+#define TIFFTAG_GEOKEYDIRECTORY      34735
+#define TIFFTAG_GEODOUBLEPARAMS      34736
+#define TIFFTAG_GEOASCIIPARAMS       34737
+
+/* 
+ *  Define Printing method flags. These
+ *  flags may be passed in to TIFFPrintDirectory() to
+ *  indicate that those particular field values should
+ *  be printed out in full, rather than just an indicator
+ *  of whether they are present or not.
+ */
+#define	TIFFPRINT_GEOKEYDIRECTORY	0x80000000
+#define	TIFFPRINT_GEOKEYPARAMS		0x40000000
+
+/**********************************************************************
+ *    Nothing below this line should need to be changed by the user.
+ **********************************************************************/
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/**********************************************************************
+ * Do we want to build as a DLL on windows?
+ **********************************************************************/
+#if !defined(CPL_DLL)
+#  if defined(_WIN32) && defined(BUILD_AS_DLL)
+#    define CPL_DLL     __declspec(dllexport)
+#  else
+#    define CPL_DLL
+#  endif
+#endif
+
+extern void CPL_DLL XTIFFInitialize();
+extern TIFF CPL_DLL * XTIFFOpen(const char* name, const char* mode);
+extern TIFF CPL_DLL * XTIFFFdOpen(int fd, const char* name, const char* mode);
+extern void CPL_DLL XTIFFClose(TIFF *tif);
+
+extern TIFF CPL_DLL * XTIFFClientOpen(const char* name, const char* mode, 
+                                      thandle_t thehandle,
+                                      TIFFReadWriteProc, TIFFReadWriteProc,
+                                      TIFFSeekProc, TIFFCloseProc,
+                                      TIFFSizeProc,
+                                      TIFFMapFileProc, TIFFUnmapFileProc);
+#if defined(__cplusplus)
+}
+#endif
+
+#endif /* __xtiffio_h */
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/makefile.mpw
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/makefile.mpw	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/makefile.mpw	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,49 @@
+# MPW C Makefile for libgeotiff
+
+.o Ä .c
+	C -o {default}.o -I ::libtiff:  {default}.c
+
+XTIFF = :libxtiff:xtiff.o
+
+CLEANINC= xtiffio.h xtiffiop.h
+
+OBJECTS = ¶
+	{XTIFF} ¶
+	geo_free.o ¶
+	geo_get.o ¶
+	geo_new.o ¶
+	geo_names.o ¶
+	geo_print.o ¶
+	geo_set.o ¶
+	geo_tiffp.o ¶
+	geo_write.o
+
+INCLUDES = ¶
+	geo_keyp.h ¶
+	geo_tiffp.h ¶
+	geokeys.h ¶
+	geovalues.h ¶
+	geonames.h ¶
+	geotiff.h
+
+
+ALL = libgeotiff.o
+
+all Ä {ALL}
+
+XINCLUDES ÄÄ
+	cd :libxtiff:
+	cp -y Å.h ::
+	cd ::
+
+
+{OBJECTS} ÄÄ {INCLUDES}
+
+{ALL} Ä  XINCLUDES {OBJECTS}
+	lib -o {ALL} {OBJECTS}
+
+clean Ä
+	rm -i {ALL}
+	rm -i {CLEANINC}
+	rm -i {OBJECTS}
+

Added: packages/geotiff/libgeotiff-dfsg/trunk/makefile.vc
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/makefile.vc	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/makefile.vc	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,143 @@
+#
+# Typically the only thing that needs to be changed are the paths to the
+# TIFF tree.  Note that we expect an existing build tree, in part because we
+# need private include files from libtiff, but also we need access to getopt.h.
+# in the ports directory.
+#
+# You may want to add optimization options to the CFLAGS macro as well. 
+#
+TIFF_DIR = ..\libtiff\libtiff
+
+TIFF_INC = -I$(TIFF_DIR)
+TIFF_LIB = $(TIFF_DIR)\libtiff.lib
+TIFF_LIB_DLL = $(TIFF_DIR)\libtiff_i.lib
+
+# Installation locations (with install, or devinstall targets)
+PREFIX =	c:\usr
+BINDIR =	$(PREFIX)\bin
+LIBDIR =	$(PREFIX)\lib
+INCDIR =	$(PREFIX)\include
+DATADIR =	$(PREFIX)\share\epsg_csv
+
+#
+CC      = cl
+INCL	= -I. -Ilibxtiff $(TIFF_INC)
+
+
+# Pick the first LIBS definition for a static libtiff.lib or the second
+# to link against the libtiff DLL.
+
+#LIBS    = geotiff.lib $(TIFF_LIB)
+LIBS    = geotiff_i.lib $(TIFF_LIB_DLL)
+
+DLLNAME = geotiff.dll
+
+# Set optimization or debug flags here.
+CFLAGS  = $(INCL) /MD /Ox /nologo
+#CFLAGS  = $(INCL) /MD /Zi /nologo
+
+#
+OBJS    = \
+	xtiff.obj \
+	geo_free.obj \
+	geo_get.obj \
+	geo_names.obj \
+	geo_new.obj \
+	geo_print.obj \
+	geo_set.obj \
+	geo_tiffp.obj \
+	geo_write.obj \
+	geo_extra.obj \
+	geo_trans.obj \
+	geo_normalize.obj \
+	geotiff_proj4.obj \
+	cpl_csv.obj \
+	cpl_serv.obj
+
+all:    geo_config.h geotiff.lib $(DLLNAME) listgeo.exe geotifcp.exe
+
+listgeo.exe:	bin\listgeo.c geotiff.lib
+	$(CC) $(CFLAGS) bin\listgeo.c $(LIBS)
+	
+geotifcp.exe:	bin\geotifcp.c geotiff.lib
+	$(CC) $(CFLAGS) bin\geotifcp.c bin\getopt.c $(LIBS)
+	
+gt_update.exe:	bin\gt_update.c geotiff.lib
+	$(CC) $(CFLAGS) bin\gt_update.c bin\getopt.c geotiff.lib $(LIBS)
+	
+geotiff.lib:	$(OBJS)
+	lib /out:geotiff.lib $(OBJS)
+
+#
+$(DLLNAME):    $(OBJS)
+	link /dll /out:$(DLLNAME) /implib:geotiff_i.lib $(OBJS) $(TIFF_LIB_DLL)
+
+geo_config.h:	geo_config.h.vc
+	copy geo_config.h.vc geo_config.h
+
+xtiff.obj: libxtiff\xtiff.c
+	$(CC) -c $(CFLAGS) libxtiff\xtiff.c
+
+geo_free.obj: geo_free.c
+	$(CC) -c $(CFLAGS) geo_free.c
+
+geo_get.obj: geo_get.c
+	$(CC) -c $(CFLAGS) geo_get.c
+
+geo_names.obj: geo_names.c
+	$(CC) -c $(CFLAGS) geo_names.c
+
+geo_new.obj: geo_new.c
+	$(CC) -c $(CFLAGS) geo_new.c
+
+geo_print.obj: geo_print.c
+	$(CC) -c $(CFLAGS) geo_print.c
+
+geo_set.obj: geo_set.c
+	$(CC) -c $(CFLAGS) geo_set.c
+
+geo_tiffp.obj: geo_tiffp.c
+	$(CC) -c $(CFLAGS) geo_tiffp.c
+
+geo_write.obj: geo_write.c
+	$(CC) -c $(CFLAGS) geo_write.c
+
+geo_trans.obj: geo_trans.c
+	$(CC) -c $(CFLAGS) geo_trans.c
+
+geo_extra.obj: geo_extra.c
+	$(CC) -c $(CFLAGS) geo_extra.c
+
+geo_normalize.obj: geo_normalize.c
+	$(CC) -c $(CFLAGS) geo_normalize.c
+
+geotiff_proj4.obj: geotiff_proj4.c
+	$(CC) -c $(CFLAGS) geotiff_proj4.c
+
+cpl_csv.obj: cpl_csv.c
+	$(CC) -c $(CFLAGS) cpl_csv.c
+
+cpl_serv.obj: cpl_serv.c
+	$(CC) -c $(CFLAGS) cpl_serv.c
+
+clean:
+	-del *.obj
+	-del *.exe
+	-del *.lib
+	-del *.dll
+
+install:	all
+	-mkdir $(PREFIX)
+	-mkdir $(BINDIR)
+	-mkdir $(DATADIR)
+	copy *.dll $(BINDIR)
+	copy *.exe $(BINDIR)
+	-copy csv\*.csv $(DATADIR)	
+
+devinstall:	install
+	-mkdir $(INCDIR)
+	-mkdir $(LIBDIR)
+	copy *.lib $(LIBDIR)
+	copy *.h $(INCDIR)
+	copy *.inc $(INCDIR)
+	

Added: packages/geotiff/libgeotiff-dfsg/trunk/mkbindist.sh
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/mkbindist.sh	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/mkbindist.sh	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+if [ $# -lt 2 ] ; then
+  echo "Usage: mkbindist.sh version platform [-install]"
+  echo
+  echo "Example: mkbindist.sh 1.1.5 linux"
+  exit
+fi
+
+VERSION=$1
+PLATFORM=$2
+
+# Ensure all required components are built.
+
+if test \! make ; then
+  exit
+fi
+
+#
+#	Prepare tree.
+#
+
+DIST_DIR=libgeotiff-${PLATFORM}-bin.${VERSION}
+
+rm -rf $DIST_DIR
+mkdir $DIST_DIR
+
+mkdir $DIST_DIR/bin
+cp bin/geotifcp bin/listgeo $DIST_DIR/bin
+
+# The file list is copied from Makefile.in:GT_INCLUDE_FILES
+
+mkdir $DIST_DIR/include
+cp xtiffio.h xtiffiop.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 cpl_csv.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 \
+    $DIST_DIR/include
+
+mkdir $DIST_DIR/lib
+cp libgeotiff.a $DIST_DIR/lib
+if test -f libgeotiff.so.$VERSION ; then
+  cp libgeotiff.so.$VERSION $DIST_DIR/lib
+  (cd $DIST_DIR/lib ; ln -s libgeotiff.so.$VERSION libgeotiff.so)
+fi
+
+mkdir $DIST_DIR/share
+mkdir $DIST_DIR/share/epsg_csv
+cp csv/*.csv $DIST_DIR/share/epsg_csv
+
+cp README_BIN $DIST_DIR/README
+
+rm -f ${DIST_DIR}.tar.gz
+tar cf ${DIST_DIR}.tar ${DIST_DIR}
+gzip -9 ${DIST_DIR}.tar
+
+echo "Prepared: "${DIST_DIR}.tar.gz
+
+TARGETDIR=remotesensing.org:/ftp/remotesensing/pub/geotiff/libgeotiff
+
+if test "$3" = "-install" ; then
+  scp ${DIST_DIR}.tar.gz $TARGETDIR
+fi


Property changes on: packages/geotiff/libgeotiff-dfsg/trunk/mkbindist.sh
___________________________________________________________________
Name: svn:executable
   + 

Added: packages/geotiff/libgeotiff-dfsg/trunk/mkdist.sh
===================================================================
--- packages/geotiff/libgeotiff-dfsg/trunk/mkdist.sh	                        (rev 0)
+++ packages/geotiff/libgeotiff-dfsg/trunk/mkdist.sh	2007-09-19 11:39:06 UTC (rev 1077)
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+if [ $# -lt 1 ] ; then
+  echo "Usage: mkdist.sh version [-install]"
+  echo
+  echo "Example: mkdist.sh 1.1.5"
+  exit
+fi
+
+VERSION=$1
+COMPRESSED_VERSION=`echo $VERSION | tr -d .`
+
+rm -rf dist_wrk  
+mkdir dist_wrk
+cd dist_wrk
+
+export CVSROOT=:pserver:cvsanon at cvs.maptools.org:/cvs/maptools/cvsroot
+
+echo "Please type anonymous if prompted for a password."
+cvs login
+
+cvs checkout geotiff/libgeotiff
+
+if [ \! -d geotiff/libgeotiff ] ; then
+  echo "cvs checkout reported an error ... abandoning mkdist.sh"
+  exit
+fi
+
+find geotiff -name CVS -exec rm -rf {} \;
+
+mv geotiff/libgeotiff libgeotiff-${VERSION}
+touch libgeotiff-${VERSION}/configure
+
+rm -f ../libgeotiff-${VERSION}.tar.gz ../libgeotiff${COMPRESSED_VERSION}.zip
+
+tar cf ../libgeotiff-${VERSION}.tar libgeotiff-${VERSION}
+gzip -9 ../libgeotiff-${VERSION}.tar
+zip -r ../libgeotiff${COMPRESSED_VERSION}.zip libgeotiff-${VERSION}
+
+
+cd ..
+rm -rf dist_wrk
+
+TARGETDIR=remotesensing.org:/ftp/remotesensing/pub/geotiff/libgeotiff
+if test "$2" = "-install" ; then
+  scp libgeotiff-${VERSION}.tar.gz libgeotiff${COMPRESSED_VERSION}.zip \
+	$TARGETDIR
+fi


Property changes on: packages/geotiff/libgeotiff-dfsg/trunk/mkdist.sh
___________________________________________________________________
Name: svn:executable
   + 




More information about the Pkg-grass-devel mailing list