Codebase list libgeotiff / 2b8bf3f
[svn-inject] Installing original source of libgeotiff-dfsg Francesco Paolo Lovergine 16 years ago
71 changed file(s) with 25832 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 config.log
1 geo_config.h
2 config.cache
3 config.status
4 Makefile
5 *.lib
6 *.ilk
7 *.pdb
8 *.exp
9 *.dll
10 libgeotiff-*.so
11 libgeotiff.so*
12
0 2007-07-28 Frank Warmerdam <warmerdam@pobox.com>
1
2 * Issue libgeotiff 1.2.4 release.
3
4 * geo_normalize.c: Fix name for GCS_WGS_72 per gdal bug #1715.
5
6 2007-07-20 Frank Warmerdam <warmerdam@pobox.com>
7
8 * csv/*.csv,*.c: Upgrade to EPSG 6.13. Avoid applying pcs.override.csv
9 and gcs.override.csv to pcs.csv and gcs.csv as this sort of dataset
10 change is discouraged by the EPSG folks.
11
12 * geo_normalize.c: Pre-search pcs.override.csv and gcs.override.csv.
13
14 * cpl_csv_incode.c: Handle unexpected .csv files, and missing
15 records more gracefully.
16
17 2007-06-05 Frank Warmerdam <warmerdam@pobox.com>
18
19 * Modified GTIFGetUOMLengthInfo() (for normalization) to have
20 built in known values for foot and us survey foot.
21
22 2007-03-13 Frank Warmerdam <warmerdam@pobox.com>
23
24 * geotiff_proj4.c, geo_normalize.c: Added support for new zealand
25 map grid per http://bugzilla.remotesensing.org/show_bug.cgi?id=1519
26
27 2007-02-04 Frank Warmerdam <warmerdam@pobox.com>
28
29 * Makefile.in: Fix Progs dependency so parallel makes work properly.
30 http://bugzilla.remotesensing.org/show_bug.cgi?id=1475
31
32 2006-12-18 Frank Warmerdam <warmerdam@pobox.com>
33
34 * bin/listgeo.c: Don't report hemispheres *and* signs when using -d.
35
36 2006-11-11 Frank Warmerdam <warmerdam@pobox.com>
37
38 * xtiff.c, xtiffio.h: Made XTIFFInitialize() public so that
39 applications can call it themselves when using alternate opens.
40 http://bugzilla.remotesensing.org/show_bug.cgi?id=1296
41
42 2006-10-18 Frank Warmerdam <warmerdam@pobox.com>
43
44 * Upgraded csv files to EPSG 6.11.1.
45
46 2006-10-13 Frank Warmerdam <warmerdam@pobox.com>
47
48 * Makefile.in: Avoid running configure or autoconf automatically.
49 It is nothing but heartache.
50
51 2006-07-20 Frank Warmerdam <warmerdam@pobox.com>
52
53 * bin/Makefile.in: Fix prefix handling.
54 http://bugzilla.remotesensing.org/show_bug.cgi?id=1245
55
56 2006-06-26 Frank Warmerdam <warmerdam@pobox.com>
57
58 * geo_new.c: If the ascii parameters list is too short for the declared
59 size of an ascii parameter, but it doesn't start off the end of the
60 available string then just trim the length. This is to make the
61 ESRI sample data file 34105h2.tif work properly. I wish we had
62 a way of issuing warnings!
63
64 ==============================================================================
65
66 2006-03-02 Frank Warmerdam <warmerdam@pobox.com>
67
68 * Issuing libgeotif 1.2.3 release.
69
70 2005-08-16 Frank Warmerdam <warmerdam@pobox.com>
71
72 * Makefile.in: Include @C_PIC@ in CFLAGS so -fPIC will be used.
73
74 2005-03-15 Frank Warmerdam <warmerdam@pobox.com>
75
76 * geo_normalize.c: If a zero inverse flattening is encountered,
77 interprete this as implying a semiminor axis equal to the semimajor.
78
79 2005-03-03 Frank Warmerdam <warmerdam@pobox.com>
80
81 * geotiff_proj4.c: added CT_CylindricalEqualArea support.
82
83 * geo_normalize.c: Added CT_CylindricalEqualArea support.
84
85 * geo_ctrans.c: added CT_CyldricalEqualArea.
86
87 2005-02-16 Frank Warmerdam <warmerdam@pobox.com>
88
89 * geo_normalize.c: check for ProjFalseOriginEastingGeoKey and
90 ProjFalseOriginNorthingGeoKey in GTIFFetchProjParms(). Otherwise
91 we miss the false easting/northing for LCC2SP when reading with
92 normalization.
93
94 2004-12-16 Frank Warmerdam <warmerdam@pobox.com>
95
96 * aclocal.m4, Makefile.in: added MacOSX/Darwin related logic for
97 shared libraries.
98
99 * bin/Makefile.in: fixed problem in setting libdir.
100
101 2004-12-01 Frank Warmerdam <warmerdam@pobox.com>
102
103 * geo_normalize.c: GTIFGetGCSInfo() changed to work even if an
104 illegal PM code encountered ... as long as pm info not requested.
105 http://bugzilla.remotesensing.org/show_bug.cgi?id=698
106
107 2004-11-21 Frank Warmerdam <warmerdam@pobox.com>
108
109 * configure.in: bug 649 - add LDFLAGS into LIBS, and ensure we
110 can link against libproj.so even if no libproj.a is provided.
111
112 2004-10-19 Frank Warmerdam <warmerdam@pobox.com>
113
114 * geo_print.c: fixed serious bug with reporting large numbers of
115 GCPs. Patch from Oliver Colin (ESA).
116
117 2004-07-09 Frank Warmerdam <warmerdam@pobox.com>
118
119 * geo_normalize.c: added 9122 as a simple degree alias in
120 GTIFGetUOMAngleInfo().
121
122 2004-06-07 Frank Warmerdam <warmerdam@pobox.com>
123
124 * geo_normalize.c: fallback to using gdal_datum.csv if datum.csv
125 not found.
126
127 ==============================================================================
128
129 2004-04-30 Frank Warmerdam <warmerdam@pobox.com>
130
131 * Prepare 1.2.2 release.
132
133 2004-04-29 Frank Warmerdam <warmerdam@pobox.com>
134
135 * xtiffio.h: Avoid including cpl_serv.h, moved to geo_tiffp.h
136 so that only libgeotiff code will end up seeing cpl_serv defines.
137
138 2004-04-27 Frank Warmerdam <warmerdam@pobox.com>
139
140 * geo_new.c, geo_write.c, geo_print.c: Make it possible to
141 create a GTIF information object *without* an associated TIFF *.
142
143 2004-03-23 Frank Warmerdam <warmerdam@pobox.com>
144
145 * cpl_csv_incode.c: include dummy version on CPLReadParseLine().
146
147 * Reconvert the EPSG 6.5 files to C.
148
149 * Wrote csv/csv2c.py for converting .csv file to .c.
150
151 * Capture EPSG 6.5 csv files.
152
153 2003-10-21 Frank Warmerdam <warmerdam@pobox.com>
154
155 * geo_print.c: fixed bug with long message text with embedded newlines
156 which happen to straddle the end of the message buffer when expanded
157 with escape characters. (as reported by Leica - not in bugzilla).
158
159 2003-09-23 Frank Warmerdam <warmerdam@pobox.com>
160
161 * geo_print.c: fixed PrintKey() to work for constant names longer
162 than the message buffer.
163 http://bugzilla.remotesensing.org/show_bug.cgi?id=399
164
165 2003-09-02 Frank Warmerdam <warmerdam@pobox.com>
166
167 * geo_new.c: various hacks so that with improperly terminated ascii
168 parameters such as "34737 (0x87b1) ASCII (2) 9<Mercator\0>" will
169 still work. eg. 1164-0.tif
170
171 2003-07-08 Frank Warmerdam <warmerdam@pobox.com>
172
173 * geo_normalize.c, geo_print.c, geo_set.c, geo_tiffp.c, geo_trans.c,
174 geo_write.c, geotiff_proj4.c: fix various warnings.
175
176 ==============================================================================
177
178 2003-06-20 Frank Warmerdam <warmerdam@pobox.com>
179
180 * bin/Makefile.in: Removed the "prep" target for copying the geotiff
181 shared library ... not necessary with -L.. (I hope).
182
183 * configure.in: don't let -ltiff get added to LIBS multiple times.
184
185 * Prepared 1.2.1 release
186
187 2003-06-19 Frank Warmerdam <warmerdam@pobox.com>
188
189 * geo_new.c: Fixed bug that can corrupt memory when an invalid
190 GeoTIFF file with a zero length ascii parms strings is read (like
191 bruce.tif).
192
193 2003-06-03 Frank Warmerdam <warmerdam@pobox.com>
194
195 * bin/Makefile: added -L${libdir} before $(LIBS) per suggestion by
196 Tommy Andreassen.
197
198 2003-02-25 Frank Warmerdam <warmerdam@pobox.com>
199
200 * bin/Makefile.in: Replace $< with the object file names. Apparently
201 this makes the makefile be compatible with Sun's make.
202
203 2003-01-28 Frank Warmerdam <warmerdam@pobox.com>
204
205 * geo_normalize.c: Default dfInDegrees in GTIFAngleToDD().
206
207 2003-01-26 Frank Warmerdam <warmerdam@pobox.com>
208
209 * bin/geotifcp.c: fixed bug if the metadata file specified does not
210 exist.
211
212 http://bugzilla.remotesensing.org/show_bug.cgi?id=258
213
214 2003-01-20 Frank Warmerdam <warmerdam@pobox.com>
215
216 * cpl_csv_incode.c: fixed bug CSVGetField() which could cause
217 a crash if a missing record was requested.
218
219 * cpl_csv_incode.c, Makefile.in, csv/*: Reincorporated "incode"
220 support as per patches from Derrick.
221
222 * cpl_serv.h: added #define for gtGetFileFieldId.
223
224 * cpl_csv.c: changed CSVFilename() to search for pcs.csv, not
225 horiz_cs.csv.
226
227 2003-01-19 Frank Warmerdam <warmerdam@pobox.com>
228
229 * Makefile.in, bin/Makefile.in: added dist-clean target.
230
231 ==============================================================================
232
233 2003-01-15 Frank Warmerdam <warmerdam@pobox.com>
234
235 * Preparing 1.2.0 libgeotiff release.
236
237 * removed libtiff_private contents.
238
239 * geotiff.h: added LIBGEOTIFF_VERSION macro.
240
241 * geo_normalize.c/h: Added GTIFFreeMemory() for freeing memory
242 allocated by GTIF CSV lookup functions. Added GTIFDeaccessCSV()
243 call for applications to force all CSV files to be de-cached.
244
245 * cpl_serv.h: renamed lots of CPL functions with gt prefixes using
246 macros.
247
248 2003-01-07 Frank Warmerdam <warmerdam@pobox.com>
249
250 * configure.in: fixed some stuff with last changes. The --with-libtiff
251 option can now be used to give a base directory with libtiff installed
252 into /include and /lib directories under that.
253
254 2003-01-02 Frank Warmerdam <warmerdam@pobox.com>
255
256 * configure.in: Remove logic to insert /usr/local/ in include and lib
257 path. Remove configure switch for in-code EPSG tables since that
258 option is broken for now.
259
260 2002-12-01 Frank Warmerdam <warmerdam@pobox.com>
261
262 * cpl_csv.c: rewritten to support in memory caching of tables, and
263 fast searches.
264
265 * geo_extra.c: tweaked to favor fixed EPSG codes for Kentucky North
266 (NAD83), and Tennesse (NAD27). The original entries have incorrect
267 values. Also modified epsg_pcs.inc and epsg_proj.inc.
268
269 * geo_normalize.c: Major restructuring to use EPSG 6.2.2 database.
270
271 2002-11-23 Frank Warmerdam <warmerdam@pobox.com>
272
273 * geo_free.c: don't read past end of keys list. Introduced by
274 changes from Rainer.
275
276 * geo_new.c: fix memory leak of tempData.tk_asciiParams. Introduced
277 by changes from Rainer.
278
279 2002-09-27 Frank Warmerdam <warmerdam@pobox.com>
280
281 * libxtiff/{xtiff.c,xtiffio.h}: Added XTIFFClientOpen() function
282 as per supplied implementation from John Novak.
283
284 http://bugzilla.remotesensing.org/show_bug.cgi?id=204
285
286 * geo_free.c, geo_names.c, geo_keyp.h, geo_new.c, geo_set.c,
287 geo_write.c: Rainer Wiesenfarth (wiesi at ngi dot de) submitted
288 patches to support deletion, and changes to ascii tags. To accomplish
289 this the ASCII tags are now allocated dynamically. The
290 GTIFF_ASCIIPARAMS are split up when read, and recombined when written.
291
292 2002-09-21 Frank Warmerdam <warmerdam@pobox.com>
293
294 * geo_names.c: added support for VerticalUnitsGeoKey as per bug 203.
295
296 2002-07-19 Frank Warmerdam <warmerdam@pobox.com>
297
298 * bin/listgeo.c: Added -d (report corners in decimal degrees) flag
299 to listgeo as submitted by Derrick Brashear.
300
301 2002-07-09 Frank Warmerdam <warmerdam@pobox.com>
302
303 * geotiff_proj4.c: Fixed translation of polar stereographic to PROJ.4
304 as per http://bugzilla.remotesensing.org/show_bug.cgi?id=172.
305
306 2002-06-18 Frank Warmerdam <warmerdam@pobox.com>
307
308 * cpl_csv.h, cpl_serv.h, cpl_csv.c, cpl_csv_incode.c, geo_normalize.c:
309 Removed the cpl_csv.h file, and merged it into cpl_serv.h. Modified
310 all modules including cpl_csv.h to include cpl_serv.h instead. This
311 is to avoid a conflict with the cpl_csv.h in GDAL.
312
313 2002-05-31 Frank Warmerdam <warmerdam@pobox.com>
314
315 * geo_print.c: modified to using backslash escaping for backslashes,
316 and newlines handle newlines in citations (as occur in Erdas generated
317 files, for instance). Also resolved some problems with processing
318 long string values though very long strings will still blow up
319 GTIFImport().
320
321 http://bugzilla.remotesensing.org/show_bug.cgi?id=139
322
323 2002-02-25 Frank Warmerdam <warmerdam@pobox.com>
324
325 * configure.in: added setting of EXEEXT macro - allow .exe files on
326 Cygwin.
327
328 * libxtiff/xtiff.c: Rewrote to use new "custom field" interface to
329 libtiff (requires libtiff 3.6.x). Removed xtiffiop.h. No longer
330 a dependence on private libtiff include files.
331
332 2002-02-12 Frank Warmerdam <warmerdam@pobox.com>
333
334 * configure.in, Makefile.in, bin/Makefile.in: extensive updates to
335 support building libgeotiff as a DLL on Cygwin.
336
337 2002-02-11 Frank Warmerdam <warmerdam@pobox.com>
338
339 * Added CSVDeaccess() stub ... submitted by Derrick Brashear.
340
341 * README: Fixed url.
342
343 2002-02-04 Frank Warmerdam <warmerdam@pobox.com>
344
345 * configure.in: fixed up zip/jpeg arg so that --with-jpeg will work
346 as reported by Julien Demaria.
347
348 2002-01-03 Frank Warmerdam <warmerdam@pobox.com>
349
350 * Prepare 1.1.5 release.
351
352 * geo_normalize.c: call CSVDeaccess() at end of GTIFPrintDefn() so that
353 listgeo has closed all file handles by the end.
354
355 2001-11-28 Frank Warmerdam <warmerdam@pobox.com>
356
357 * geo_trans.c: fixed memory leak of transform in GTIFPCSToImage()
358 as reported by Ng Lay Keow (Nicole).
359
360 2001-07-09 Frank Warmerdam <warmerdam@pobox.com>
361
362 * cpl_serv.c: Another bug with pszRLBuffer being freed but not set
363 to NULL.
364
365 2001-06-28 Frank Warmerdam <warmerdam@pobox.com>
366
367 * cpl_csv_incode.c: Use EQUAL instead of strcasecmp() to ensure code
368 builds on windows. As per
369
370 http://bugzilla.remotesensing.org/show_bug.cgi?id=59
371
372 2001-05-02 Frank Warmerdam <warmerdam@pobox.com>
373
374 * geo_set.c: modified so that a count of -1 means to delete
375 the tag from the list.
376
377 2001-04-17 Frank Warmerdam <warmerdam@pobox.com>
378
379 * geo_normalize.c: fixed memory leaks in GTIFGetDefn().
380
381 * cpl_serv.c: Fixed failure to set pointer to NULL when freeing
382 line buffer in CPLReadLine().
383
384 * geo_normalize.c: added support for reading custom ellipsoid
385 definitions.
386
387 http://bugzilla.remotesensing.org/show_bug.cgi?id=42
388
389 2001-04-06 Frank Warmerdam <warmerdam@pobox.com>
390
391 * listgeo.c: added -i flag to report inverse transformation results,
392 testing the PCSToImage() function. Not documented for user though.
393
394 * GTIFPCSToImage(): added support for inverting matrix transformations.
395
396 * Fixed GTIFGetDefn() to support custom ellipsoid definition.
397
398 2001-03-04 Frank Warmerdam <warmerdam@pobox.com>
399
400 Fixed various memory leaks bugs thanks to Alan Gray.
401
402 * GTIFGetDefn() now calls CSVDeaccess() to avoid memory/file leaks.
403
404 * Added docs/api, and related for Doxygen generated API docs.
405
406 * Fixed memory leaks in GTIFPrintDefn() (geo_normalize.c), and
407 GTIFImageToPCS(), GTIFPCSToImage() (geo_trans.c).
408
409 2001-03-01 Frank Warmerdam <warmerdam@pobox.com>
410
411 * Added PCS_GGRS87_Greek_Grid for Dr. Irwin Scollar.
412
413 2001-02-28 Frank Warmerdam <warmerdam@pobox.com>
414
415 * Added PCS_HD72_EOV to epsg_pcs.inc, and added GCS_GGRS87 to
416 epsg_gcs.inc at the request of Prof. Dr. Irwin Scollar.
417
418 2001-02-23 Frank Warmerdam <warmerdam@pobox.com>
419
420 * Fixed GTIFPrintDefn() to use fprintf( fp ), instead of printf(),
421 as per fixes from Alan Gray.
422
423 2001-01-19 Frank Warmerdam <warmerdam@pobox.com>
424
425 * Added tiffconf.h to libtiff_private. Secretly reissue 1.1.4 source
426 release.
427
428 2001-01-17 Frank Warmerdam <warmerdam@pobox.com>
429
430 * Prepare 1.1.4 final release.
431
432 * Added README_BIN, and mkbindist.sh.
433
434 * Modified csv search code to include a search of
435 share/epsg_csv and /usr/share/epsg_csv
436
437 2001-01-02 Frank Warmerdam <warmerdam@pobox.com>
438
439 * Added support for .tfw files with rotatational coefficents in
440 geotifcp.c.
441
442 * Updated README.WIN to mention VCVARS32.BAT.
443
444 2000-12-28 Frank Warmerdam <warmerdam@pobox.com>
445
446 * Prepare 1.1.4beta release.
447
448 * Added HOWTO-RELEASE file.
449
450 * Removed getopt.h from geotifcp.c to build on windows.
451
452 2000-12-12 Frank Warmerdam <warmerdam@pobox.com>
453
454 * Fix geotifcp.c to avoid u_char problems, include getopt.h.
455
456 * Made configure use "-L... -llibname" for libproj and libtiff
457 so we will use the shared library when possible.
458
459 * Fixed up Makefile.in so it works if . is not in the path.
460
461 * Added CSV_DATA_DIR define to control where to look for csv files.
462
463 Todays fixes courtesy of Dave Johnson, ddj@cascv.brown.edu and
464 are summarized in:
465
466 http://bugzilla.remotesensing.org/show_bug.cgi?id=29
467
468 2000-12-05 Frank Warmerdam <warmerdam@pobox.com>
469
470 * Added cassini support in geotiff_proj4.c.
471
472 * modified geotiff_proj4.c to use +R_A to use spherical radius
473 of equal area, similar to other systems like GCTP for the
474 Miller Cylindrical and VanDerGrinten. Should also do for any
475 other spherical projections as identified.
476
477 2000-11-30 Frank Warmerdam <warmerdam@pobox.com>
478
479 * Fixed Makefile.in to install all the .inc files with the include
480 files.
481
482 2000-11-24 Frank Warmerdam <warmerdam@pobox.com>
483
484 * Added configure/makefile logic to build a shared library,
485 currently libgeotiff.so.1.1.5, and intall it with appropriate links.
486
487 * Modified configure to use --with-libtiff, and to ignore TIFF_HOME.
488 Now it is preferred to use an installed libtiff instead of one sitting
489 in a build directory.
490
491 * Added libtiff_private directory with required libtiff include
492 files, to make it easier to build libgeotiff if only the standard
493 libtiff development environment was installed.
494
495 2000-11-23 Frank Warmerdam <warmerdam@pobox.com>
496
497 * Based loosely on suggestions from Curt Mills, I have reworked
498 the configure.in logic for PROJ.4. I add -I/usr/local/include to
499 CFLAGS and -L/usr/local/lib to LIBS right off the start so /usr/local
500 is included in the default search path. The user no longer
501 specifies the PROJ_HOME environment variable, and instead uses
502 the --with-proj configure switch. Updated notes for building
503 PROJ_HOME set in README.
504
505 2000-10-13 Frank Warmerdam <warmerda@cs46980-c>
506
507 * Added EquidistantConic support in PROJ.4 translation.
508
509 * Fixed order of parameters for LCC when read directly from a
510 file to match that when read from EPSG tables. This is now
511 always: 0-NatOriginLat, 1-NatOriginLong, 2-StdParallel1, 3-StdParallel2
512 This change is only in geo_normalize.c.
513
514 2000-09-29 Frank Warmerdam <warmerda@cs46980-c>
515
516 * Fixed bug in CPLReadLine() that primarily affects windows, and
517 SunOS 4.x. Bug fix courtesy of shumilin@scanex.ru.
518
519 2000-09-15 Frank Warmerdam <warmerda@cs46980-c>
520
521 * Added the -proj4 option to listgeo to report it's selected
522 PROJ.4 string.
523
524 * Fixed order of parameters for LCC 2SP. When parameters
525 were read from EPSG CSV files the standard parallels and origin
526 were mixed up. This affects alot of state plane zones!
527
528 ==============================================================================
529
530 2000-08-22 Frank Warmerdam <warmerda@cs46980-c>
531
532 * Prepare 1.1.3 release.
533
534 * Added install target to makefile. Defaults to /usr/local/...
535
536 * Added libjpeg to configure, and fixed up libjpeg/libz ordering.
537
538 2000-08-21 Frank Warmerdam <warmerda@cs46980-c>
539
540 * Removed the GTIFTiepointTranslate() code because it it badly
541 broken.
542
543 2000-06-09 <warmerda@CS46980-B>
544
545 * Added knowledge of NAD27, NAD83, WGS72, WGS84, their datums,
546 and ellipsoids.
547
548 2000-05-21 Frank Warmerdam <warmerda@cs46980-c>
549
550 * Added -e option to geotifcp to intialize tiepoint+pixelscale
551 based on an ESRI world file.
552
553 ==============================================================================
554
555 Sun Feb 20 16:43:03 2000 Frank Warmerdam <warmerda@gdal.velocet.ca>
556
557 * Prepare 1.1.2 release.
558
559 Tue Jan 4 10:59:48 2000 Frank Warmerdam <warmerda@gdal.velocet.ca>
560
561 * Fixed inclusion of geoparms in object file list at Derricks
562 suggestion.
563
564 * Added --with-zip support to configure and makefiles at the
565 suggestion of Derrick Brashear.
566
567 Fri Dec 10 13:24:21 1999 Frank Warmerdam <warmerda@gdal.velocet.ca>
568
569 * Upgraded .csv and .c files to EPSG 4.4.
570
571 * Fixed bug setting the false northing for files with
572 ProjCenterNorthingGeoKey set in GTIFGetDefn().
573
574 * Added "--with-incode-epsg" support to configure, added
575 cpl_csv_incode.c and csv/*.c tables.
576
577 Wed Sep 29 10:10:39 1999 Frank Warmerdam <warmerda@gdal.velocet.ca>
578
579 * Upgraded CSV files to EPSG 4.3 from EPSG 4.2.
580
581 Fri Sep 17 10:53:52 1999 Frank Warmerdam <warmerda@gdal.velocet.ca>
582
583 * Added ProjRectifiedGridAngleGeoKey(3096) and support for it's
584 use with Oblique Mercator in geo_normalize.c.
585
586 Thu Sep 16 17:22:55 1999 Frank Warmerdam <warmerda@gdal.velocet.ca>
587
588 * Added support for pure tiepoints, and the transformation
589 matrix in GTIFImageToPCS(), and GTIFPCSToImage().
590
591 Wed Sep 15 10:19:34 1999 Frank Warmerdam <warmerda@gdal.velocet.ca>
592
593 * CT_TransvMercator_SouthOriented now CT_TransvMercator_SouthOrientated
594 to match EPSG. SouthOriented name remains as an alias.
595
596 * Fixed serious bug in geo_normalize.c with translation of
597 DD.MMSSsss values. Return value was seriously off if any
598 fraction of a second was included in the string.
599
600 Tue Sep 7 15:57:47 1999 Frank Warmerdam <warmerda@gdal.velocet.ca>
601
602 * Fixed count/tiepoint_count mixup in GTIFPCSToImage(). Thanks
603 to Eric Brown of Universal Systems.
604
605 Mon Jul 12 12:56:51 1999 Frank Warmerdam <warmerda@gdal.velocet.ca>
606
607 * Made scale a parameter of CT_Stereographic.
608
609 * geotifcp modified to copy existing geotiff information by default.
610
611 ==============================================================================
612
613 Tue May 4 09:25:12 1999 Frank Warmerdam <warmerda@gdal.velocet.ca>
614
615 * Prepared Version 1.1.1 release.
616
617 Mon May 3 14:10:30 1999 Frank Warmerdam <warmerda@gdal.velocet.ca>
618
619 * Added corner coordinate reporting to listgeo, and made full
620 report the default.
621
622 * Added geo_trans.c with image<->PCS transformations.
623
624 * Fixed serious bug with parsing DMSmmsss.ss coordinates from
625 CSV files which could make many results wrong.
626
627 * Cleaned up warnings with gcc -Wall, and IRIX native compiler.
628
629 * Added support for -Wall for GCC in when running configure. This
630 also resulted in the addition of aclocal.m4 to the dist.
631
632 Wed Apr 28 14:12:25 1999 Frank Warmerdam <warmerda@gdal.velocet.ca>
633
634 * Added geo_extra.c, for special handling of UTM and state plane
635 map systems.
636
637 * Changed to have api help inline with the code, and extracted with
638 doxygen.
639
640 Thu Mar 25 23:25:22 1999 Frank Warmerdam <warmerda@gdal.velocet.ca>
641
642 * Added ChangeLog and LICENSE file to distribution.
643
644 March 18
645
646 * Added support for PROJ.4 in configure. Added cover functions
647 for Proj.4 in geotiff_proj.c, added lat/long reporting to listgeo.c.
648
649
650 ==============================================================================
651
652 -- 1.1.0a Release (circa March 10, 1999) --
653
654 * This release is considered alpha (not release) quality.
655
656 * Includes new CSV files, ``geo_normalize'' support, and a new
657 configure script (using autoconf).
658
659 -- 1.02 Release (1995 or so)
0 # This file describes the settings to be used by doxygen for a project
1 #
2 # All text after a hash (#) is considered a comment and will be ignored
3 # The format is:
4 # TAG = value [value, ...]
5 # Values that contain spaces should be placed between quotes (" ")
6
7 #---------------------------------------------------------------------------
8 # General configuration options
9 #---------------------------------------------------------------------------
10
11 # The PROJECT_NAME tag is a single word (or a sequence of word surrounded
12 # by quotes) that should identify the project.
13
14 PROJECT_NAME = libgeotiff
15
16 # The PROJECT_NUMBER tag can be used to enter a project or revision number.
17 # This could be handy for archiving the generated documentation or
18 # if some version control system is used.
19
20 PROJECT_NUMBER =
21
22 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
23 # base path where the generated documentation will be put.
24 # If a relative path is entered, it will be relative to the location
25 # where doxygen was started. If left blank the current directory will be used.
26
27 OUTPUT_DIRECTORY =
28
29 # The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
30 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
31 # put in front of it. If left blank `html' will be used as the default path.
32
33 HTML_OUTPUT = docs/api
34
35 # The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
36 # If a relative path is entered the value of OUTPUT_DIRECTORY will be
37 # put in front of it. If left blank `latex' will be used as the default path.
38
39 LATEX_OUTPUT =
40
41 # The HTML_HEADER tag can be used to specify a personal HTML header for
42 # each generated HTML page. If it is left blank doxygen will generate a
43 # standard header.
44
45 HTML_HEADER =
46
47 # The HTML_FOOTER tag can be used to specify a personal HTML footer for
48 # each generated HTML page. If it is left blank doxygen will generate a
49 # standard footer.
50
51 HTML_FOOTER =
52
53 # The QUIET tag can be used to turn on/off the messages that are generated
54 # by doxygen. Possible values are YES and NO. If left blank NO is used.
55
56 QUIET = NO
57
58 # The WARNINGS tag can be used to turn on/off the warning messages that are
59 # generated by doxygen. Possible values are YES and NO. If left blank
60 # NO is used.
61
62 WARNINGS = NO
63
64 # The DISABLE_INDEX tag can be used to turn on/off the condensed index at
65 # top of each page. A value of NO (the default) enables the index and the
66 # value YES disables it.
67
68 DISABLE_INDEX = NO
69
70 # If the EXTRACT_ALL tag is set to YES all classes and functions will be
71 # included in the documentation, even if no documentation was available.
72
73 EXTRACT_ALL = NO
74
75 # If the EXTRACT_PRIVATE tag is set to YES all private members of a class
76 # will be included in the documentation.
77
78 EXTRACT_PRIVATE = NO
79
80 # If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
81 # undocumented members inside documented classes or files.
82
83 HIDE_UNDOC_MEMBERS = YES
84
85 # If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
86 # generate Latex output.
87
88 GENERATE_LATEX = NO
89
90 # If the GENERATE_HTML tag is set to YES (the default) Doxygen will
91 # generate HTML output
92
93 GENERATE_HTML = YES
94
95 # If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
96 # include brief member descriptions after the members that are listed in
97 # the file and class documentation (similar to JavaDoc).
98 # Set to NO to disable this.
99
100 BRIEF_MEMBER_DESC = YES
101
102 # If the FULL_PATH_NAMES tag is set to YES Doxygen will prepend the full
103 # path before files name in the file list and in the header files. If set
104 # to NO the shortest path that makes the file name unique will be used
105
106 FULL_PATH_NAMES = NO
107
108 #---------------------------------------------------------------------------
109 # configuration options related to the input files
110 #---------------------------------------------------------------------------
111
112 # The INPUT tag is used to specify the files and/or directories that contain
113 # documented source files. You may enter file names like "myfile.cpp" or
114 # directories like "/usr/src/myproject". Separate the files or directories
115 # with spaces.
116
117 INPUT = . libxtiff/xtiff.c docs/index.dox
118
119 # If the value of the INPUT tag contains directories, you can use the
120 # FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp
121 # and *.h) to filter out the source-files in the directories. If left
122 # blank all files are included.
123
124 FILE_PATTERNS = *.h *.cpp *.c *.dox
125
126 # The EXAMPLE_PATH tag can be used to specify one or more files or
127 # directories that contain example code fragments that are included (see
128 # the \include command).
129
130 EXAMPLE_PATH = .
131
132 # The RECURSIVE tag can be used to turn specify whether or not subdirectories
133 # should be searched for input files as well. Possible values are YES and NO.
134 # If left blank NO is used.
135
136 RECURSIVE = NO
137
138 # The INPUT_FILTER tag can be used to specify a program that doxygen should
139 # invoke to filter for each input file. Doxygen will invoke the filter program
140 # by executing (via popen()) the command <filter> <input-file>, where <filter>
141 # is the value of the INPUT_FILTER tag, and <input-file> is the name of an
142 # input file. Doxygen will then use the output that the filter program writes
143 # to standard output.
144
145 INPUT_FILTER =
146
147 #---------------------------------------------------------------------------
148 # Configuration options related to the preprocessor
149 #---------------------------------------------------------------------------
150
151 # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
152 # evaluate all C-preprocessor directives found in the sources and include
153 # files.
154
155 ENABLE_PREPROCESSING = YES
156
157 # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
158 # names in the source code. If set to NO (the default) only conditional
159 # compilation will be performed.
160
161 MACRO_EXPANSION = NO
162
163 # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
164 # in the INCLUDE_PATH (see below) will be search if a #include is found.
165
166 SEARCH_INCLUDES = YES
167
168 # The INCLUDE_PATH tag can be used to specify one or more directories that
169 # contain include files that are not input files but should be processed by
170 # the preprocessor.
171
172 INCLUDE_PATH =
173
174 # The PREDEFINED tag can be used to specify one or more macro names that
175 # are defined before the preprocessor is started (similar to the -D option of
176 # gcc). The argument of the tag is a list of macros of the form: name
177 # or name=definition (no spaces). In the former case 1 is used as the
178 # definition.
179
180 PREDEFINED =
181
182 # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
183 # then the macro expansion is limited to the macros specified with the
184 # PREDEFINED tag.
185
186 EXPAND_ONLY_PREDEF = NO
187
188 #---------------------------------------------------------------------------
189 # Configuration options related to external references
190 #---------------------------------------------------------------------------
191
192 # The TAGFILES tag can be used to specify one or more tagfiles.
193
194 TAGFILES =
195
196 # When a file name is specified after GENERATE_TAGFILE, doxygen will create
197 # a tag file that is based on the input files it reads.
198
199 GENERATE_TAGFILE =
200
201 # If the ALLEXTERNALS tag is set to YES all external classes will be listed
202 # in the class index. If set to NO only the inherited external classes
203 # will be listed.
204
205 ALLEXTERNALS = NO
206
207 # The PERL_PATH should be the absolute path and name of the perl script
208 # interpreter (i.e. the result of `which perl').
209
210 PERL_PATH = /usr/local/bin/perl
211
212 #---------------------------------------------------------------------------
213 # Configuration options related to the search engine
214 #---------------------------------------------------------------------------
215
216 # The SEARCHENGINE tag specifies whether or not a search engine should be
217 # used. If set to NO the values of all tags below this one will be ignored.
218
219 SEARCHENGINE = NO
220
221 # The CGI_NAME tag should be the name of the CGI script that
222 # starts the search engine (doxysearch) with the correct parameters.
223 # A script with this name will be generated by doxygen.
224
225 CGI_NAME = search.cgi
226
227 # The CGI_URL tag should be the absolute URL to the directory where the
228 # cgi binaries are located. See the documentation of your http daemon for
229 # details.
230
231 CGI_URL =
232
233 # The DOC_URL tag should be the absolute URL to the directory where the
234 # documentation is located. If left blank the absolute path to the
235 # documentation, with file:// prepended to it, will be used.
236
237 DOC_URL =
238
239 # The DOC_ABSPATH tag should be the absolute path to the directory where the
240 # documentation is located. If left blank the directory on the local machine
241 # will be used.
242
243 DOC_ABSPATH =
244
245 # The BIN_ABSPATH tag must point to the directory where the doxysearch binary
246 # is installed.
247
248 BIN_ABSPATH = /usr/local/bin/
249
250 # The EXT_DOC_PATHS tag can be used to specify one or more paths to
251 # documentation generated for other projects. This allows doxysearch to search
252 # the documentation for these projects as well.
253
254 EXT_DOC_PATHS =
0 Preparing a libgeotiff Release
1 ==============================
2
3 1) Update the VERSION_MAJOR/MINOR/POINT information in configure.in.
4
5 2) Update the LIBGEOTIFF_VERSION macro in geotiff.h.
6
7 3) Add a note to the ChangeLog that a new release is being issued, and what
8 the release number is.
9
10 4) Tag the release with a command like "cvs tag libgeotiff_1_1_4" from the
11 libgeotiff directory.
12
13 5) Prepare a zip and tar.gz file using a command like "mkdist.sh 1.1.5"
14 from within the geotiff/libgeotiff directory.
15
16 6) Test build and install on at least one Unix platform. Test build on a
17 Windows system.
18
19 7) The resulting files (eg. libgeotiff-1.1.5.tar.gz and libgeotiff115.zip)
20 should be copied to the distribution directory (geotiff/libgeotiff on
21 ftp.remotesensing.org). Update the README file in that directory to
22 indicate the new current release.
23
24 8) Build binary distributions of libgeotiff, and utilities for various
25 Unix platforms (usually Linux, Solaris and IRIX). This can be accomplished
26 using a command like "mkbindist.sh 1.1.5 linux -install". The -install
27 option only works if you have scp locally, and a matching account on
28 remotesensing.org.
29
30 9) Build binary distribution for Windows. Normally prepared by downloading
31 the last distribution, and overlaying the most recent .exe files, and
32 csv files over the ones from the last distribution, and renaming things
33 based on the version number.
34
35 10) Announce on GeoTIFF mailing list: geotiff@lists.maptools.org
36 Include a summary of the ChangeLog items for the most recent release.
37
38 11) Update entry at http://www.freshmeat.net/projects/libgeotiff
39
40 12) Update html/geotiff.html to point to most recent release, including
41 the most recent release version number.
0
1 libgeotiff Licensing
2 ====================
3
4 All the source code in this toolkit are either in the public domain, or under
5 an X style license. In any event it is all considered to be free to use
6 for any purpose (including commercial software). No credit is required
7 though some of the code requires that the specific source code modules
8 retain their existing copyright statements. The CSV files, and other tables
9 derived from the EPSG coordinate system database are also free to use. In
10 particular, no part of this code is "copyleft", nor does it imply any
11 requirement for users to disclose this or their own source code.
12
13 All components not carrying their own copyright message, but distributed
14 with libgeotiff should be considered to be under the same license as
15 Niles' code.
16
17 ---------
18
19 Code by Frank Warmerdam has this copyright notice (directly copied from
20 X Consortium licence):
21
22 * Copyright (c) 1999, Frank Warmerdam
23 *
24 * Permission is hereby granted, free of charge, to any person obtaining a
25 * copy of this software and associated documentation files (the "Software"),
26 * to deal in the Software without restriction, including without limitation
27 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
28 * and/or sell copies of the Software, and to permit persons to whom the
29 * Software is furnished to do so, subject to the following conditions:
30 *
31 * The above copyright notice and this permission notice shall be included
32 * in all copies or substantial portions of the Software.
33 *
34 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
35 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
37 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
40 * DEALINGS IN THE SOFTWARE.
41
42 -----------
43
44 Code by Niles Ritter is under this licence:
45
46 * Written By: Niles D. Ritter.
47 *
48 * copyright (c) 1995 Niles D. Ritter
49 *
50 * Permission granted to use this software, so long as this copyright
51 * notice accompanies any products derived therefrom.
52
53 -----------
54
55 The EPSG Tables (from which the CSV files, and .inc files are derived)
56 carried this statement on use of the data (from the EPSG web site):
57
58 Use of the Data
59
60 The user assumes the entire risk as to the accuracy and the use of this
61 data. The data may be copied and distributed subject to the following
62 conditions:
63
64 1.All data pertinent to a specific coordinate system must be copied
65 without modification and all related pages must be included;
66
67 2.All components of this data set pertinent to any given coordinate
68 system must be distributed together (complete distribution of all
69 components of the data set is preferred, but the EPSG recognises
70 the need for a more limited distribution);
71
72 3.The data may not be distributed for profit by any third party; and
73 4.The original source [EPSG] must be acknowledged.
74
75 INFORMATION PROVIDED IN THIS DOCUMENT IS PROVIDED "AS
76 IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR
77 IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
78 WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
79 PARTICULAR PURPOSE.
80
81
82
0 #
1 # GeoTIFF Library source for Makefile
2 #
3 DEPTH = .
4
5 SRCDIR = ${DEPTH}
6
7 #
8 SHELL = /bin/sh
9 NULL =
10 CD = cd
11 CC = @CC@
12 AR = ar
13 LN = @LN_S@
14 AROPTS = r
15 RANLIB = @RANLIB@
16 INSTALL = @INSTALL@
17 RM = rm -f
18 MAKE = make
19 prefix = @prefix@
20 exec_prefix = @exec_prefix@
21 bindir = @bindir@
22 libdir = @libdir@
23 includedir = @includedir@
24 datadir = @datadir@/epsg_csv
25
26 BIN=${SRCDIR}/bin
27 LIB_XTIFF=${SRCDIR}/libxtiff
28 XTIFF=xtiff.o
29 XTIFFINC= xtiffio.h
30 EXEEXT=@EXEEXT@
31
32 VERSION_MAJOR = @VERSION_MAJOR@
33 VERSION_MINOR = @VERSION_MINOR@
34 VERSION_POINT = @VERSION_POINT@
35
36 LIBS= @LIBS@
37 GEOTIFF_SO=@GEOTIFF_SO@
38 GEOTIFF_DLL=@GEOTIFF_DLL@
39 GEOTIFF_IMP=@GEOTIFF_IMP@
40 LD_SHARED=@LD_SHARED@
41 SO_EXT=@SO_EXT@
42
43 GT_INCLUDE_FILES = xtiffio.h geotiff.h geotiffio.h geovalues.h \
44 geonames.h geokeys.h geo_tiffp.h geo_config.h geo_keyp.h \
45 geo_normalize.h cpl_serv.h \
46 epsg_datum.inc epsg_gcs.inc epsg_pm.inc epsg_units.inc geo_ctrans.inc\
47 epsg_ellipse.inc epsg_pcs.inc epsg_proj.inc epsg_vertcs.inc geokeys.inc
48
49
50 #
51 IPATH = -I. -I${SRCDIR} @TIFF_INC@ @PROJ_INC@
52 #
53 CONF_LIBRARY=\
54 ${NULL}
55 COPTS = @CFLAGS@ @C_PIC@ -DCSV_DATA_DIR=\"$(datadir)\"
56 CFLAGS = ${COPTS} ${IPATH} ${CONF_LIBRARY}
57 #
58 SRCS = \
59 ${NULL}
60 CORE_OBJS = \
61 ${XTIFF} \
62 geo_free.o \
63 geo_get.o \
64 geo_names.o \
65 geo_new.o \
66 geo_print.o \
67 geo_set.o \
68 geo_tiffp.o \
69 geo_write.o \
70 geo_trans.o \
71 geo_normalize.o \
72 geotiff_proj4.o \
73 geo_extra.o \
74 cpl_serv.o \
75 ${NULL}
76
77 CSV_INCODE_OBJS = \
78 cpl_csv_incode.o \
79 csv/pcs.o \
80 csv/gcs.o \
81 csv/ellipsoid.o \
82 csv/prime_meridian.o \
83 csv/datum.o \
84 csv/unit_of_measure.o \
85 csv/projop_wparm.o
86
87 CSV_FILE_OBJS = \
88 cpl_csv.o
89
90 # CSV_SOURCE can be either $(CSV_FILE_OBJS) or $(CSV_INCODE_OBJS)
91 OBJS = $(CORE_OBJS) @CSV_SOURCE@
92
93 TARGETS = libgeotiff.a
94
95 all: Makefile ${TARGETS} ${GEOTIFF_SO} Progs
96
97 libgeotiff.a: ${OBJS}
98 ${AR} ${AROPTS} libgeotiff.a $?
99 ${RANLIB} libgeotiff.a
100
101 $(GEOTIFF_SO): ${OBJS}
102 ${LD_SHARED} ${OBJS} ${LIBS} -o $(GEOTIFF_SO)
103 rm -f libgeotiff.$(SO_EXT)
104 ${LN} $(GEOTIFF_SO) libgeotiff.$(SO_EXT)
105
106 Progs: $(GEOTIFF_SO)
107 ${CD} ${BIN};\
108 ${MAKE}
109
110 ${OBJS}: ${SRCDIR}/geotiff.h ${SRCDIR}/geotiffio.h ${SRCDIR}/geo_config.h
111
112 ${XTIFFINC}:
113 ${RM} ${XTIFFINC}
114 ${LN} ${LIB_XTIFF}/*.h .
115
116 ${XTIFF}: ${LIB_XTIFF}/xtiff.c ${XTIFFINC}
117 ${CC} -c ${CFLAGS} ${LIB_XTIFF}/xtiff.c
118
119 geo_free.o: ${SRCDIR}/geo_free.c
120 ${CC} -c ${CFLAGS} ${SRCDIR}/geo_free.c
121
122 geo_get.o: ${SRCDIR}/geo_get.c
123 ${CC} -c ${CFLAGS} ${SRCDIR}/geo_get.c
124
125 geo_names.o: ${SRCDIR}/geo_names.c
126 ${CC} -c ${CFLAGS} ${SRCDIR}/geo_names.c
127
128 geo_new.o: ${SRCDIR}/geo_new.c
129 ${CC} -c ${CFLAGS} ${SRCDIR}/geo_new.c
130
131 geo_print.o: ${SRCDIR}/geo_print.c
132 ${CC} -c ${CFLAGS} ${SRCDIR}/geo_print.c
133
134 geo_set.o: ${SRCDIR}/geo_set.c
135 ${CC} -c ${CFLAGS} ${SRCDIR}/geo_set.c
136
137 geo_tiffp.o: ${SRCDIR}/geo_tiffp.c
138 ${CC} -c ${CFLAGS} ${SRCDIR}/geo_tiffp.c
139
140 geo_write.o: ${SRCDIR}/geo_write.c
141 ${CC} -c ${CFLAGS} ${SRCDIR}/geo_write.c
142
143 geo_trans.o: ${SRCDIR}/geo_trans.c
144 ${CC} -c ${CFLAGS} ${SRCDIR}/geo_trans.c
145
146 geo_normalize.o: ${SRCDIR}/geo_normalize.c
147 ${CC} -c ${CFLAGS} ${SRCDIR}/geo_normalize.c
148
149 geo_extra.o: ${SRCDIR}/geo_extra.c
150 ${CC} -c ${CFLAGS} ${SRCDIR}/geo_extra.c
151
152 cpl_csv.o: ${SRCDIR}/cpl_csv.c
153 ${CC} -c ${CFLAGS} ${SRCDIR}/cpl_csv.c
154
155 cpl_serv.o: ${SRCDIR}/cpl_serv.c
156 ${CC} -c ${CFLAGS} ${SRCDIR}/cpl_serv.c
157
158 geotiff_proj4.o: ${SRCDIR}/geotiff_proj4.c
159 ${CC} -c ${CFLAGS} ${SRCDIR}/geotiff_proj4.c
160
161 ${SRCDIR}/csv/%.o: ${SRCDIR}/csv/%.c
162 ${CC} -c ${CFLAGS} ${SRCDIR}/csv/$*.c -o ${SRCDIR}/csv/$*.o
163
164 clean:
165 (cd bin; $(MAKE) clean)
166 rm -f ${TARGETS} ${OBJS} ${XTIFFINC} core a.out libgeotiff.$(SO_EXT)*
167 rm -f ${GEOTIFF_IMP} ${GEOTIFF_SO}
168
169 dist-clean: clean
170 (cd bin; $(MAKE) dist-clean)
171 rm -rf config.log config.status config.cache geo_config.h
172 rm -f Makefile
173
174 geo_config.h: geo_config.h.in config.status
175 ./config.status
176 touch geo_config.h
177
178 Makefile: Makefile.in config.status
179 ./config.status
180
181 dox:
182 doxygen
183 if test -d ../../geotiff-ht/api ; then \
184 cp docs/api/*.* ../../geotiff-ht/api; \
185 cp docs/*.html ../../geotiff-ht; \
186 fi
187
188 install:
189 $(INSTALL) -d $(DESTDIR)$(libdir)
190 $(INSTALL) libgeotiff.a $(GEOTIFF_IMP) $(DESTDIR)${libdir}
191 $(INSTALL) -d $(DESTDIR)$(includedir)
192 $(INSTALL) $(GT_INCLUDE_FILES) $(DESTDIR)$(includedir)
193 $(INSTALL) -d $(DESTDIR)$(datadir)
194 $(INSTALL) csv/*.csv $(DESTDIR)$(datadir)
195 $(INSTALL) -d $(DESTDIR)$(bindir)
196 $(INSTALL) bin/listgeo$(EXEEXT) bin/geotifcp$(EXEEXT) $(DESTDIR)$(bindir)
197 if test ! -z "$(GEOTIFF_SO)" ; then \
198 if test ! -z "$(GEOTIFF_DLL)" ; then \
199 $(INSTALL) $(GEOTIFF_SO) $(DESTDIR)${bindir}; \
200 else \
201 $(INSTALL) $(GEOTIFF_SO) $(DESTDIR)${libdir}; \
202 (cd $(DESTDIR)${libdir} ; \
203 rm -f libgeotiff.$(SO_EXT).$(VERSION_MAJOR).$(VERSION_MINOR); \
204 ${LN} $(GEOTIFF_SO) libgeotiff.$(SO_EXT).$(VERSION_MAJOR).$(VERSION_MINOR); \
205 rm -f libgeotiff.$(SO_EXT).$(VERSION_MAJOR); \
206 ${LN} libgeotiff.$(SO_EXT).$(VERSION_MAJOR).$(VERSION_MINOR) \
207 libgeotiff.$(SO_EXT).$(VERSION_MAJOR); \
208 rm -f libgeotiff.$(SO_EXT); \
209 ${LN} libgeotiff.$(SO_EXT).$(VERSION_MAJOR) libgeotiff.$(SO_EXT); );\
210 fi;\
211 fi
212
213
0 About LIBGEOTIFF:
1 -----------------
2
3 This library is designed to permit the extraction and parsing of the
4 "GeoTIFF" Key directories, as well as definition and installation
5 of GeoTIFF keys in new files. For more information about GeoTIFF
6 specifications, projection codes and use, see the WWW web page at:
7
8 http://www.remotesensing.org/geotiff/geotiff.html
9
10 or at:
11
12 http://www.geotiff.org/
13
14 or the FTP archive at:
15
16 ftp://ftp.remotesensing.org/pub/geotiff
17
18 or the older FTP archive at:
19
20 ftp://ftpmcmc.cr.usgs.gov/release/geotiff/jpl_mirror/
21
22
23 Use of LIBTIFF
24 --------------
25
26 The default configuration assumes that the public-domain LIBTIFF
27 package for reading and writing TIFF files has been installed, with
28 the development kit (include files). The latest version of libtiff may
29 be found at:
30
31 http://www.libtiff.org/
32
33 For this build to work you must use libtiff version v3.6.0 alpha or newer.
34
35
36 Building LIBGEOTIFF:
37 --------------------
38
39 Assuming that whatever TIFF library you use has been built, and installed
40 may now build the rest of the geotiff library with:
41
42 % cd libgeotiff
43 % ./configure
44 % make
45
46 Common Configuration Issues:
47
48 o If you want to alter the compiler used, set the CC environment variable
49 before running configure.
50
51 % setenv CC cc
52 % rm config.status
53 % ./configure
54 % make clean
55 % make
56
57 o If you want to control the compiler files, set the CFLAGS environment
58 variable. This can be used to override the default optimization/debug
59 flags for instance.
60
61 % setenv CFLAGS -O4
62 % rm config.status
63 % ./configure
64 % make clean
65 % make
66
67 o If you want to force use of a locally built libtiff that was never
68 "installed" you can point to the directory like this:
69
70 % rm config.status
71 % ./configure --with-libtiff=/u/contrib/libtiff-3.6.0/libtiff
72 % make clean
73 % make
74
75 o If you have installed libtiff in a location other than /usr, then you can
76 point to the install tree like this:
77
78 % rm config.status
79 % ./configure --with-libtiff=/usr/local
80 % make clean
81 % make
82
83 o If you want to use EPSG tables compiled into the code, use the
84 --enable-incode-epsg configure switch. It will make the library and
85 resulting executables substantially larger (~600K), but will avoid any
86 configuration issues with finding the .csv files.
87
88 % rm config.status
89 % ./configure --enable-incode-epsg
90 % make clean
91 % make
92
93 o If you want to build in support for the PROJ.4 library, so that listgeo
94 can report corner coordinates in lat/long, it may be necessary to
95 specify the directory containing the libproj include files, and library.
96 (PROJ.4 can also be disabled by passing --without-proj). PROJ.4 info
97 can be found at http://www.remotesensing.org/proj .
98
99 % rm config.status
100 % ./configure --with-proj=/contrib/proj-4.4.1
101 % make clean
102 % make
103
104 o The logic to build shared libraries is pretty weak, and is likely to
105 only work on systems with the GNU tool chain (gcc, and ld) installed.
106 On other systems you can try hacking on Makefile after running configure.
107 It may be necessary to set the GEOTIFF_SO macro to "libgeotiff.1.2.x"
108 as it is made empty by default on systems configure doesn't think can
109 build shared libraries.
110
111
112 Test Programs:
113
114 There are two demonstration test programs "makegeo" and "listgeo"
115 that create and list-out the GeoTIFF tags and keys associated
116 with a small TIFF file, as well as a full-featured utility called
117 "geotifcp". These will all be built in the bin/ directory as a matter of
118 course, though may require modification if you are not using LIBTIFF, as they
119 make explicit calls to LIBTIFF for opening the files and setting the
120 tags. To run them simply call:
121
122 % bin/makegeo
123 % bin/listgeo newgeo.tif
124
125 to generate and list an example GeoTIFF file. To see the
126 "geotifcp" utility in action, first call:
127
128 % bin/listgeo newgeo.tif > metadata.txt
129
130 to create a GeoTIFF metadata file "metadata.txt", and then
131
132 % bin/geotifcp -g metadata.txt newgeo.tif newer.tif
133
134 to copy the TIFF file newgeo.tif to newer.tif, using the
135 GeoTIFF metadata as stored in "metadata.txt". See "docs/manual.txt"
136 for further uses of geotifcp.
137
138 To use the new normalization capability of listgeo, the program needs
139 to be able to find the CSV files. Use something like the following,
140 but indicating the correct path to the CSV directory (libgeotiff/csv).
141
142 % bin/listgeo -t csv -norm newgeo.tif
143
144 To convert a projection metafile, an ESRI world file, and a raw TIFF file
145 into a GeoTIFF file do something like the following:
146
147 % bin/tiffcp -g metadata.txt -e abc.tfw abc.tif geo_abc.tif
148
149
150
151 Non-Standard Configuration:
152 ---------------------------
153
154 If you are using a TIFF software package other than libtiff, then you
155 must override the TIFF file methods used in LIBGEOTIFF. To do this,
156 go into directory libgeotiff and edit the files:
157
158 "geo_tiffp.h"
159 "geo_tiffp.c"
160
161 which contain all of the TIFF externals. You will need to define your
162 own versions of the TIFF tag reading, writing, and memory allocation
163 calls. See the comments of those two files to see what needs to be
164 changed. Also, whatever software package you use will have to
165 recognize the GeoTIFF tags listed in the include files, and permit
166 variable-length arrays to be passed in to those tags.
167
168
169 Credits
170 -------
171
172 o This library was originally written by Niles Ritter (also the primary
173 author of the GeoTIFF specification).
174
175 o It is currently being maintained by Frank Warmerdam (warmerdam@pobox.com),
176 who also added the "normalization" capability of GTIFGetDefn() using
177 EPSG CSV files.
178
179 o Support for "incode" CSV files was submitted by Derrick J Brashear
180 <shadow@dementia.org>.
181
182 o Eric Brown of Universal Systems, who contributed a bug fix to
183 GTIFPCSToImage().
184
185 o Safe Software (www.safe.com) who supported by upgrade to use the
186 EPSG 6.2.2 database for libgeotiff 1.2.0.
187
188 o Many others who contributed before it occured to me to maintain credits.
189
190
191
0 Windows Build
1 -------------
2
3 Most of the notes in the README apply on Windows as well; however, to
4 configure and build follow the following steps:
5
6 o Make sure you have the required environment variables set for VC++. Often
7 this is accomplished by running the VCVARS32.BAT file from the VC++ bin
8 directory.
9
10 o Edit makefile.vc, updating the TIFF_DIR (or TIFF_LIB and TIFF_INC) variable
11 to point to the location of the tiff build tree.
12
13 o Build using the command ``nmake -f makefile.vc''
14
15 If you don't use makefile.vc, you will need to copy geo_config.h.vc to
16 geo_config.h by hand.
0 libgeotiff Binary Distribution for Unix
1 ---------------------------------------
2
3 This tree contains a binary distribution of libgeotiff, and related
4 utilities (listgeo, and geotifcp) for a Unix platform (as indicated in
5 the distribution filename).
6
7 The distribution should consist of:
8
9 README: this file
10 bin/listgeo: utility program
11 bin/geotifcp: utility program
12 lib/libgeotiff.a: static library for libgeotiff, applications also have
13 to link against libtiff.
14 lib/libgeotiff-$VERSION.so: Shared library version of the above.
15 lib/libgeotiff.so: link to the specific shared library.
16 include: The include files for libgeotiff.
17 share/epsg_csv: The EPSG CSV files used to decompose projection systems.
18
19 This distribution is intended to be suitable to untar directly under
20 /usr/local or /usr to give a rough equivelent to having done a "make install"
21 from the libgeotiff source, though this README should be removed.
22
23 If this distribution is not installed under /usr/local, it will likely be
24 necessary to define the GEOTIFF_CSV environment variable to point at
25 the share/epsg_csv directory. For reporting of lat/long equivelents of
26
27
28 User documentation for listgeo and geotifcp can be found at:
29
30 http://www.remotesensing.org/geotiff/listgeo.html
31 http://www.remotesensing.org/geotiff/geotifcp.html
32
33 General information on libgeotiff, and GeoTIFF can be found at:
34
35 http://www.remotesensing.org/geotiff/geotiff.html
36
37 or
38
39 http://www.geotiff.org/
40
41
0 AC_DEFUN(AC_COMPILER_WFLAGS,
1 [
2 # Remove -g from compile flags, we will add via CFG variable if
3 # we need it.
4 CXXFLAGS=`echo "$CXXFLAGS " | sed "s/-g //"`
5 CFLAGS=`echo "$CFLAGS " | sed "s/-g //"`
6
7 # check for GNU compiler, and use -Wall
8 if test "$GCC" = "yes"; then
9 C_WFLAGS="-Wall"
10 CFLAGS="$CFLAGS -Wall"
11 AC_DEFINE(USE_GNUCC)
12 fi
13 if test "$GXX" = "yes"; then
14 CXX_WFLAGS="-Wall"
15 CXXFLAGS="$CXXFLAGS -Wall"
16 AC_DEFINE(USE_GNUCC)
17 fi
18 AC_SUBST(CXX_WFLAGS,$CXX_WFLAGS)
19 AC_SUBST(C_WFLAGS,$C_WFLAGS)
20 ])
21
22 AC_DEFUN(AC_COMPILER_PIC,
23 [
24 echo 'void f(){}' > conftest.c
25 if test -z "`${CC-cc} -fPIC -c conftest.c 2>&1`"; then
26 C_PIC=-fPIC
27 else
28 C_PIC=
29 fi
30 if test -z "`${CXX-g++} -fPIC -c conftest.c 2>&1`"; then
31 CXX_PIC=-fPIC
32 else
33 CXX_PIC=
34 fi
35 rm -f conftest*
36
37 AC_SUBST(CXX_PIC,$CXX_PIC)
38 AC_SUBST(C_PIC,$C_PIC)
39 ])
40
41 dnl
42 dnl Try to find something to link shared libraries with. Use "c++ -shared"
43 dnl in preference to "ld -shared" because it will link in required c++
44 dnl run time support for us.
45 dnl
46 AC_DEFUN(AC_LD_SHARED,
47 [
48 echo 'void g(); int main(){ g(); return 0; }' > conftest1.c
49
50 echo '#include <stdio.h>' > conftest2.c
51 echo 'void g(); void g(){printf("");}' >> conftest2.c
52 ${CC} ${C_PIC} -c conftest2.c
53
54 SO_EXT="so"
55 export SO_EXT
56 LD_SHARED="/bin/true"
57 if test ! -z "`uname -a | grep IRIX`" ; then
58 IRIX_ALL=-all
59 else
60 IRIX_ALL=
61 fi
62
63 AC_ARG_WITH(ld-shared,[ --without-ld-shared Disable shared library support],,)
64
65 if test "$with_ld_shared" != "" ; then
66 if test "$with_ld_shared" = "no" ; then
67 echo "user disabled shared library support."
68 else
69 echo "using user supplied .so link command ... $with_ld_shared"
70 fi
71 LD_SHARED="$with_ld_shared"
72 fi
73
74 dnl Check For Cygwin case. Actually verify that the produced DLL works.
75
76 if test ! -z "`uname -a | grep CYGWIN`" \
77 -a "$LD_SHARED" = "/bin/true" \
78 -a -z "`gcc -shared conftest2.o -o libconftest.dll`" ; then
79 if test -z "`${CC} conftest1.c -L./ -lconftest -o conftest1 2>&1`"; then
80 LD_LIBRARY_PATH_OLD="$LD_LIBRARY_PATH"
81 if test -z "$LD_LIBRARY_PATH" ; then
82 LD_LIBRARY_PATH="`pwd`"
83 else
84 LD_LIBRARY_PATH="`pwd`:$LD_LIBRARY_PATH"
85 fi
86 export LD_LIBRARY_PATH
87 if test -z "`./conftest1 2>&1`" ; then
88 echo "checking for Cygwin gcc -shared ... yes"
89 LD_SHARED="c++ -shared"
90 SO_EXT="dll"
91 fi
92 LD_LIBRARY_PATH="$LD_LIBRARY_PATH_OLD"
93 fi
94 fi
95
96 dnl Test special MacOS (Darwin) case.
97
98 if test ! -z "`uname | grep Darwin`" \
99 -a "$LD_SHARED" = "/bin/true" \
100 -a -z "`${CXX} -dynamiclib conftest2.o -o libconftest.so 2>&1`" ; then
101 ${CC} -c conftest1.c
102 if test -z "`${CXX} conftest1.o libconftest.so -o conftest1 2>&1`"; then
103 DYLD_LIBRARY_PATH_OLD="$DYLD_LIBRARY_PATH"
104 if test -z "$DYLD_LIBRARY_PATH" ; then
105 DYLD_LIBRARY_PATH="`pwd`"
106 else
107 DYLD_LIBRARY_PATH="`pwd`:$DYLD_LIBRARY_PATH"
108 fi
109 export DYLD_LIBRARY_PATH
110 if test -z "`./conftest1 2>&1`" ; then
111 echo "checking for ${CXX} -dynamiclib ... yes"
112 LD_SHARED="${CXX} -dynamiclib"
113 SO_EXT=dylib
114 fi
115 DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH_OLD"
116 fi
117 rm -f conftest1.o
118 fi
119
120 if test "$LD_SHARED" = "/bin/true" \
121 -a -z "`${CXX} -shared $IRIX_ALL conftest2.o -o libconftest.so 2>&1|grep -v WARNING`" ; then
122 if test -z "`${CC} conftest1.c libconftest.so -o conftest1 2>&1`"; then
123 LD_LIBRARY_PATH_OLD="$LD_LIBRARY_PATH"
124 if test -z "$LD_LIBRARY_PATH" ; then
125 LD_LIBRARY_PATH="`pwd`"
126 else
127 LD_LIBRARY_PATH="`pwd`:$LD_LIBRARY_PATH"
128 fi
129 export LD_LIBRARY_PATH
130 if test -z "`./conftest1 2>&1`" ; then
131 echo "checking for ${CXX} -shared ... yes"
132 LD_SHARED="${CXX} -shared $IRIX_ALL"
133 else
134 echo "checking for ${CXX} -shared ... no(3)"
135 fi
136 LD_LIBRARY_PATH="$LD_LIBRARY_PATH_OLD"
137 else
138 echo "checking for ${CXX} -shared ... no(2)"
139 fi
140 else
141 if test "$LD_SHARED" = "/bin/true" ; then
142 echo "checking for ${CXX} -shared ... no(1)"
143 fi
144 fi
145
146 if test "$LD_SHARED" = "/bin/true" \
147 -a -z "`ld -shared conftest2.o -o libconftest.so 2>&1`" ; then
148 if test -z "`${CC} conftest1.c libconftest.so -o conftest1 2>&1`"; then
149 LD_LIBRARY_PATH_OLD="$LD_LIBRARY_PATH"
150 if test -z "$LD_LIBRARY_PATH" ; then
151 LD_LIBRARY_PATH="`pwd`"
152 else
153 LD_LIBRARY_PATH="`pwd`:$LD_LIBRARY_PATH"
154 fi
155 export LD_LIBRARY_PATH
156 if test -z "`./conftest1 2>&1`" ; then
157 echo "checking for ld -shared ... yes"
158 LD_SHARED="ld -shared"
159 fi
160 LD_LIBRARY_PATH="$LD_LIBRARY_PATH_OLD"
161 fi
162 fi
163
164 if test "$LD_SHARED" = "/bin/true" ; then
165 echo "checking for ld -shared ... no"
166 if test ! -x /bin/true ; then
167 LD_SHARED=/usr/bin/true
168 fi
169 fi
170 if test "$LD_SHARED" = "no" ; then
171 if test -x /bin/true ; then
172 LD_SHARED=/bin/true
173 else
174 LD_SHARED=/usr/bin/true
175 fi
176 fi
177
178 rm -f conftest* libconftest*
179
180 AC_SUBST(LD_SHARED,$LD_SHARED)
181 AC_SUBST(SO_EXT,$SO_EXT)
182 ])
183
0 Makefile
1 makegeo
2 listgeo
3 geotifcp
0 #
1 # GeoTIFF Library source for Makefile
2 #
3 DEPTH = ..
4
5 GEOTIFFDIR = $(DEPTH)
6 GEOTIFF_SO=@GEOTIFF_SO@
7
8 LIBS= -L$(GEOTIFFDIR) -lgeotiff @LIBS@
9
10 #
11 SHELL = /bin/sh
12 NULL =
13 CC = @CC@
14 AR = ar
15 LN = @LN_S@
16 AROPTS = r
17 RANLIB = @RANLIB@
18 INSTALL = @INSTALL@
19
20 EXEEXT=@EXEEXT@
21
22 prefix = @prefix@
23 libdir = @libdir@
24
25 PROGS=${BIN}/makegeo$(EXEEXT) ${BIN}/listgeo$(EXEEXT) ${BIN}/geotifcp$(EXEEXT)
26
27 #
28 IPATH = -I. -I${GEOTIFFDIR} @TIFF_INC@ @ZIP_INC@
29
30 #
31
32 COPTS = @CFLAGS@
33 CFLAGS = ${COPTS} ${IPATH}
34 #
35 SRCS = \
36 ${NULL}
37 OBJS = \
38 makegeo.o \
39 listgeo.o \
40 geotifcp.o \
41 ${NULL}
42
43 ALL= makegeo$(EXEEXT) listgeo$(EXEEXT) geotifcp$(EXEEXT)
44
45 all: ${ALL}
46
47 makegeo$(EXEEXT): makegeo.o ${GEOTIFFDIR}/libgeotiff.a
48 ${CC} ${COPTS} makegeo.o -L${libdir} ${LIBS} -o $@
49
50 geotifcp$(EXEEXT): geotifcp.o ${GEOTIFFDIR}/libgeotiff.a
51 ${CC} ${COPTS} geotifcp.o -L${libdir} ${LIBS} -o $@
52
53 listgeo$(EXEEXT): listgeo.o ${GEOTIFFDIR}/libgeotiff.a
54 ${CC} ${COPTS} listgeo.o -L${libdir} ${LIBS} -o $@
55
56 csv2html$(EXEEXT): csv2html.o ${GEOTIFFDIR}/libgeotiff.a
57 ${CC} ${COPTS} csv2html.o -L${libdir} ${LIBS} -o $@
58
59 clean:
60 rm -f ${ALL} ${OBJS} core a.out newgeo.tif ${GEOTIFF_SO}
61
62 dist-clean: clean
63 rm -f Makefile
0 /******************************************************************************
1 * $Id: csv2html.c,v 1.3 2000/12/28 23:26:56 warmerda Exp $
2 *
3 * Project: libgeotiff
4 * Purpose: CGI BIN to view CSV files on the web.
5 * Author: Frank Warmerdam, warmerda@home.com
6 *
7 ******************************************************************************
8 * Copyright (c) 1999, Frank Warmerdam
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 * DEALINGS IN THE SOFTWARE.
27 ******************************************************************************
28 *
29 * $Log: csv2html.c,v $
30 * Revision 1.3 2000/12/28 23:26:56 warmerda
31 * Changed to default csv path.
32 *
33 * Revision 1.2 1999/07/28 22:11:31 warmerda
34 * lots more changes
35 *
36 * Revision 1.1 1999/06/25 05:50:24 warmerda
37 * New
38 *
39 */
40
41 #include "cpl_csv.h"
42
43 static void
44 CSV2HTML( const char * pszFilename, int nColumns, int * panColumns, char**,
45 int );
46
47 /************************************************************************/
48 /* main() */
49 /************************************************************************/
50 int main( int nArgc, char ** papszArgv )
51
52 {
53 int nColumns = 0;
54 int *panColumnList = NULL;
55 const char *pszTable = "horiz_cs";
56 const char *pszTablePath = "/usr/local/share/epsg_csv";
57 char **papszOptions = NULL;
58 char szFilename[1024];
59 int i, bSingletons = FALSE;
60
61 printf( "Content-type: text/html\n\n" );
62
63 /* -------------------------------------------------------------------- */
64 /* Parse the PATH_INFO. */
65 /* -------------------------------------------------------------------- */
66 if( getenv( "PATH_INFO" ) != NULL )
67 {
68 papszOptions = CSLTokenizeStringComplex( getenv("PATH_INFO") + 1,
69 "/", TRUE, TRUE );
70 }
71
72 /* -------------------------------------------------------------------- */
73 /* Add commandline switch to the option list. */
74 /* -------------------------------------------------------------------- */
75 for( i = 1; i < nArgc; i++ )
76 papszOptions = CSLAddString( papszOptions, papszArgv[i] );
77
78 /* -------------------------------------------------------------------- */
79 /* Process program options. */
80 /* -------------------------------------------------------------------- */
81 for( i = 0; papszOptions != NULL && papszOptions[i] != NULL; i++ )
82 {
83 if( EQUALN(papszOptions[i],"FIELDS=",7) )
84 {
85 char **papszList;
86 int j;
87
88 papszList = CSLTokenizeStringComplex( papszOptions[i]+7, ",",
89 TRUE, TRUE );
90 nColumns = CSLCount( papszList );
91 panColumnList = (int *) CPLRealloc(panColumnList,
92 sizeof(int) * nColumns);
93
94 for( j = 0; j < nColumns; j++ )
95 panColumnList[j] = atoi(papszList[j]);
96
97 CSLDestroy( papszList );
98 }
99
100 else if( EQUALN(papszOptions[i],"TABLE=",6) )
101 {
102 pszTable = papszOptions[i] + 6;
103 }
104
105 else if( EQUALN(papszOptions[i],"CODE=",5) )
106 {
107 bSingletons = TRUE;
108 }
109
110 else if( EQUALN(papszOptions[i],"SINGLETON",6) )
111 {
112 bSingletons = TRUE;
113 }
114 }
115
116 /* -------------------------------------------------------------------- */
117 /* Derive the full filename. */
118 /* -------------------------------------------------------------------- */
119 sprintf( szFilename, "%s/%s.csv", pszTablePath, pszTable );
120
121 /* -------------------------------------------------------------------- */
122 /* Call function to translate to HTML. */
123 /* -------------------------------------------------------------------- */
124 CSV2HTML( szFilename, nColumns, panColumnList, papszOptions,
125 bSingletons );
126
127 return 0;
128 }
129
130 /************************************************************************/
131 /* CSV2HTML() */
132 /* */
133 /* Translate file to HTML. */
134 /************************************************************************/
135
136 static void
137 CSV2HTML( const char * pszFilename, int nColumns, int * panColumns,
138 char ** papszOptions, int bSingletons )
139
140 {
141 FILE *fp;
142 char **papszFields, **papszFieldNames;
143 int iCol, nColCount;
144
145 /* -------------------------------------------------------------------- */
146 /* Open the source file. */
147 /* -------------------------------------------------------------------- */
148 fp = VSIFOpen( pszFilename, "rt" );
149
150 if( fp == NULL )
151 {
152 perror( "fopen" );
153 return;
154 }
155
156 /* -------------------------------------------------------------------- */
157 /* Read and emit the title line specially. */
158 /* -------------------------------------------------------------------- */
159 papszFieldNames = CSVReadParseLine( fp );
160 nColCount = CSLCount( papszFieldNames );
161
162 if( nColumns == 0 )
163 {
164 nColumns = nColCount;
165 panColumns = (int *) CPLMalloc(sizeof(int) * nColCount);
166 for( iCol = 0; iCol < nColCount; iCol++ )
167 panColumns[iCol] = iCol;
168 }
169
170 printf( "<table border>\n" );
171
172 if( !bSingletons )
173 {
174 for( iCol = 0; iCol < nColumns; iCol++ )
175 {
176 if( panColumns[iCol] < nColCount )
177 {
178 printf( "<th>%s\n", papszFieldNames[panColumns[iCol]] );
179 }
180 }
181 printf( "<tr>\n" );
182 }
183
184 /* -------------------------------------------------------------------- */
185 /* Read and emit normal records. */
186 /* -------------------------------------------------------------------- */
187 while( (papszFields = CSVReadParseLine( fp )) != NULL )
188 {
189 int bDisplay=TRUE, i;
190
191 nColCount = CSLCount( papszFields );
192
193 for( i = 0; papszOptions != NULL && papszOptions[i] != NULL; i++ )
194 {
195 if( EQUALN(papszOptions[i],"CODE=",5) )
196 {
197 if( atoi(papszOptions[i]+5) != atoi(papszFields[0]) )
198 bDisplay = FALSE;
199 }
200 else if( EQUALN(papszOptions[i],"CODE<",5) )
201 {
202 if( atoi(papszOptions[i]+5) <= atoi(papszFields[0]) )
203 bDisplay = FALSE;
204 }
205 else if( EQUALN(papszOptions[i],"CODE>",5) )
206 {
207 if( atoi(papszOptions[i]+5) >= atoi(papszFields[0]) )
208 bDisplay = FALSE;
209 }
210 else if( EQUALN(papszOptions[i],"NAMEKEY=",8) )
211 {
212 if( strstr(papszFields[1],papszOptions[i]+8) == NULL )
213 bDisplay = FALSE;
214 }
215 }
216
217 if( bDisplay )
218 {
219 for( iCol = 0; iCol < nColumns; iCol++ )
220 {
221 const char *pszSubTable = NULL;
222 const char *pszFieldName;
223
224 if( panColumns[iCol] < 0
225 || panColumns[iCol] >= nColCount )
226 continue;
227
228 pszFieldName = papszFieldNames[panColumns[iCol]];
229
230 if( bSingletons )
231 {
232 printf( "<td>%s\n", pszFieldName );
233 }
234
235
236 if( EQUAL(pszFieldName,"PRIME_MERIDIAN_CODE") )
237 pszSubTable = "p_meridian";
238 else if( EQUAL(pszFieldName,"GEOD_DATUM_CODE") )
239 pszSubTable = "geod_datum";
240 else if( EQUAL(pszFieldName,"UOM_LENGTH_CODE") )
241 pszSubTable = "uom_length";
242 else if( EQUAL(pszFieldName,"UOM_ANGLE_CODE") )
243 pszSubTable = "uom_angle";
244 else if( EQUAL(pszFieldName,"SOURCE_GEOGCS_CODE") )
245 pszSubTable = "horiz_cs";
246 else if( EQUAL(pszFieldName,"PROJECTION_TRF_CODE") )
247 pszSubTable = "trf_nonpolynomial";
248 else if( EQUAL(pszFieldName,"ELLIPSOID_CODE") )
249 pszSubTable = "ellipsoid";
250 else if( EQUAL(pszFieldName,"COORD_TRF_METHOD_CODE") )
251 pszSubTable = "trf_method";
252
253 if( pszSubTable != NULL )
254 printf( "<td><a href="
255 "\"/cgi-bin/csv2html/TABLE=%s/CODE=%s/\">"
256 "%s</a>\n",
257 pszSubTable,papszFields[panColumns[iCol]],
258 papszFields[panColumns[iCol]] );
259 else
260 printf( "<td>%s\n", papszFields[panColumns[iCol]] );
261
262 if( bSingletons )
263 printf( "<tr>\n" );
264 }
265
266 if( !bSingletons )
267 printf( "<tr>\n" );
268 }
269
270 CSLDestroy( papszFields );
271 }
272
273 printf( "</table>\n" );
274
275 CSLDestroy( papszFieldNames );
276
277 VSIFClose( fp );
278 }
0 /* geotifcp.c -- based on Sam Leffler's "tiffcp" code */
1
2 /*
3 * Original code had this copyright notice:
4 *
5 * Copyright (c) 1988-1995 Sam Leffler
6 * Copyright (c) 1991-1995 Silicon Graphics, Inc.
7 *
8 * and a lot of legal stuff denying liability for anything.
9 */
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <ctype.h>
15
16 /* GeoTIFF overrides */
17
18 #include "geotiff.h"
19 #include "geo_tiffp.h"
20 #include "geo_keyp.h"
21 #include "xtiffio.h"
22 #include "cpl_serv.h"
23
24 #define TIFFOpen XTIFFOpen
25 #define TIFFClose XTIFFClose
26
27 #if defined(VMS)
28 #define unlink delete
29 #endif
30
31 #define streq(a,b) (strcmp(a,b) == 0)
32 #define strneq(a,b,n) (strncmp(a,b,n) == 0)
33
34 #define TRUE 1
35 #define FALSE 0
36
37 int getopt();
38
39 static int outtiled = -1;
40 static uint32 tilewidth;
41 static uint32 tilelength;
42 static int convert_8_to_4 = 0;
43
44 static uint16 config;
45 static uint16 compression;
46 static uint16 predictor;
47 static uint16 fillorder;
48 static uint32 rowsperstrip;
49 static uint32 g3opts;
50 static int ignore = FALSE; /* if true, ignore read errors */
51 static uint32 defg3opts = (uint32) -1;
52 static int quality = 75; /* JPEG quality */
53 static int jpegcolormode = JPEGCOLORMODE_RGB;
54 static uint16 defcompression = (uint16) -1;
55 static uint16 defpredictor = (uint16) -1;
56 static char *geofile=(char *)0;
57 static char *worldfile=(char *)0;
58
59 static void ApplyWorldFile(const char *worldfile, TIFF *out);
60 static int tiffcp(TIFF*, TIFF*);
61 static int processCompressOptions(char*);
62 static void usage(void);
63
64
65 int
66 main(int argc, char* argv[])
67 {
68 uint16 defconfig = (uint16) -1;
69 uint16 deffillorder = 0;
70 uint32 deftilewidth = (uint32) -1;
71 uint32 deftilelength = (uint32) -1;
72 uint32 defrowsperstrip = (uint32) -1;
73 uint32 diroff = 0;
74 TIFF* in;
75 TIFF* out;
76 const char* mode = "w";
77 int c;
78 extern int optind;
79 extern char* optarg;
80
81 while ((c = getopt(argc, argv, "c:f:l:o:p:r:w:e:g:aistd")) != -1)
82 switch (c) {
83 case 'a': /* append to output */
84 mode = "a";
85 break;
86 case 'd': /* down cast 8bit to 4bit */
87 convert_8_to_4 = 1;
88 break;
89 case 'c': /* compression scheme */
90 if (!processCompressOptions(optarg))
91 usage();
92 break;
93 case 'e':
94 worldfile = optarg;
95 break;
96 case 'f': /* fill order */
97 if (streq(optarg, "lsb2msb"))
98 deffillorder = FILLORDER_LSB2MSB;
99 else if (streq(optarg, "msb2lsb"))
100 deffillorder = FILLORDER_MSB2LSB;
101 else
102 usage();
103 break;
104 case 'i': /* ignore errors */
105 ignore = TRUE;
106 break;
107 case 'g': /* GeoTIFF metadata file */
108 geofile = optarg;
109 break;
110 case 'l': /* tile length */
111 outtiled = TRUE;
112 deftilelength = atoi(optarg);
113 break;
114 case 'o': /* initial directory offset */
115 diroff = strtoul(optarg, NULL, 0);
116 break;
117 case 'p': /* planar configuration */
118 if (streq(optarg, "separate"))
119 defconfig = PLANARCONFIG_SEPARATE;
120 else if (streq(optarg, "contig"))
121 defconfig = PLANARCONFIG_CONTIG;
122 else
123 usage();
124 break;
125 case 'r': /* rows/strip */
126 defrowsperstrip = atoi(optarg);
127 break;
128 case 's': /* generate stripped output */
129 outtiled = FALSE;
130 break;
131 case 't': /* generate tiled output */
132 outtiled = TRUE;
133 break;
134 case 'w': /* tile width */
135 outtiled = TRUE;
136 deftilewidth = atoi(optarg);
137 break;
138 case '?':
139 usage();
140 /*NOTREACHED*/
141 }
142 if (argc - optind < 2)
143 usage();
144 out = TIFFOpen(argv[argc-1], mode);
145 if (out == NULL)
146 return (-2);
147 for (; optind < argc-1 ; optind++) {
148 in = TIFFOpen(argv[optind], "r");
149 if (in == NULL)
150 return (-3);
151 if (diroff != 0 && !TIFFSetSubDirectory(in, diroff)) {
152 TIFFError(TIFFFileName(in),
153 "Error, setting subdirectory at %#x", diroff);
154 (void) TIFFClose(out);
155 return (1);
156 }
157 do {
158 config = defconfig;
159 compression = defcompression;
160 predictor = defpredictor;
161 fillorder = deffillorder;
162 rowsperstrip = defrowsperstrip;
163 tilewidth = deftilewidth;
164 tilelength = deftilelength;
165 g3opts = defg3opts;
166 if (!tiffcp(in, out) || !TIFFWriteDirectory(out)) {
167 (void) TIFFClose(out);
168 return (1);
169 }
170 } while (TIFFReadDirectory(in));
171 (void) TIFFClose(in);
172 }
173 (void) TIFFClose(out);
174 return (0);
175 }
176
177 static void ApplyWorldFile(const char *worldfilename, TIFF *out)
178
179 {
180 FILE *tfw;
181 double pixsize[3], xoff, yoff, tiepoint[6], x_rot, y_rot;
182
183 /*
184 * Read the world file. Note we currently ignore rotational coefficients!
185 */
186 tfw = fopen( worldfilename, "rt" );
187 if( tfw == NULL )
188 {
189 perror( worldfilename );
190 return;
191 }
192
193 fscanf( tfw, "%lf", pixsize + 0 );
194 fscanf( tfw, "%lf", &y_rot );
195 fscanf( tfw, "%lf", &x_rot );
196 fscanf( tfw, "%lf", pixsize + 1 );
197 fscanf( tfw, "%lf", &xoff );
198 fscanf( tfw, "%lf", &yoff );
199
200 fclose( tfw );
201
202 /*
203 * Write out pixel scale, and tiepoint information.
204 */
205 if( x_rot == 0.0 && y_rot == 0.0 )
206 {
207 pixsize[1] = ABS(pixsize[1]);
208 pixsize[2] = 0.0;
209 TIFFSetField(out, GTIFF_PIXELSCALE, 3, pixsize);
210
211 tiepoint[0] = 0.5;
212 tiepoint[1] = 0.5;
213 tiepoint[2] = 0.0;
214 tiepoint[3] = xoff;
215 tiepoint[4] = yoff;
216 tiepoint[5] = 0.0;
217 TIFFSetField(out, GTIFF_TIEPOINTS, 6, tiepoint);
218 }
219 else
220 {
221 double adfMatrix[16];
222
223 memset(adfMatrix,0,sizeof(double) * 16);
224
225 adfMatrix[0] = pixsize[0];
226 adfMatrix[1] = x_rot;
227 adfMatrix[3] = xoff - (pixsize[0]+x_rot) * 0.5;
228 adfMatrix[4] = y_rot;
229 adfMatrix[5] = pixsize[1];
230 adfMatrix[7] = yoff - (pixsize[1]+y_rot) * 0.5;
231 adfMatrix[15] = 1.0;
232
233 TIFFSetField( out, TIFFTAG_GEOTRANSMATRIX, 16, adfMatrix );
234 }
235 }
236
237 static void InstallGeoTIFF(TIFF *out)
238 {
239 GTIF *gtif=(GTIF*)0; /* GeoKey-level descriptor */
240 FILE *fd;
241
242 gtif = GTIFNew(out);
243 if (!gtif)
244 {
245 printf("failed in GTIFNew\n");
246 return;
247 }
248
249 /* Install keys and tags */
250 fd = fopen(geofile,"r");
251 if( fd == NULL )
252 {
253 perror( geofile );
254 exit( -1 );
255 }
256 if (!GTIFImport(gtif,0,fd)) goto bad;
257 fclose(fd);
258 GTIFWriteKeys(gtif);
259 GTIFFree(gtif);
260 return;
261 bad:
262 fprintf(stderr,"Failure in GTIFImport\n");
263 exit (-1);
264 }
265
266 static void CopyGeoTIFF(TIFF * in, TIFF *out)
267 {
268 GTIF *gtif=(GTIF*)0; /* GeoKey-level descriptor */
269 double *d_list = NULL;
270 int16 d_list_count;
271
272 /* read definition from source file. */
273 gtif = GTIFNew(in);
274 if (!gtif)
275 return;
276
277 if (TIFFGetField(in, GTIFF_TIEPOINTS, &d_list_count, &d_list))
278 TIFFSetField(out, GTIFF_TIEPOINTS, d_list_count, d_list);
279 if (TIFFGetField(in, GTIFF_PIXELSCALE, &d_list_count, &d_list))
280 TIFFSetField(out, GTIFF_PIXELSCALE, d_list_count, d_list);
281 if (TIFFGetField(in, GTIFF_TRANSMATRIX, &d_list_count, &d_list))
282 TIFFSetField(out, GTIFF_TRANSMATRIX, d_list_count, d_list);
283
284 /* Here we violate the GTIF abstraction to retarget on another file.
285 We should just have a function for copying tags from one GTIF object
286 to another. */
287 gtif->gt_tif = out;
288 gtif->gt_flags |= FLAG_FILE_MODIFIED;
289
290 /* Install keys and tags */
291 GTIFWriteKeys(gtif);
292 GTIFFree(gtif);
293 return;
294 }
295
296 static void
297 processG3Options(char* cp)
298 {
299 if( (cp = strchr(cp, ':')) != NULL ) {
300 if (defg3opts == (uint32) -1)
301 defg3opts = 0;
302 do {
303 cp++;
304 if (strneq(cp, "1d", 2))
305 defg3opts &= ~GROUP3OPT_2DENCODING;
306 else if (strneq(cp, "2d", 2))
307 defg3opts |= GROUP3OPT_2DENCODING;
308 else if (strneq(cp, "fill", 4))
309 defg3opts |= GROUP3OPT_FILLBITS;
310 else
311 usage();
312 } while( (cp = strchr(cp, ':')) != NULL );
313 }
314 }
315
316 static int
317 processCompressOptions(char* opt)
318 {
319 if (streq(opt, "none"))
320 defcompression = COMPRESSION_NONE;
321 else if (streq(opt, "packbits"))
322 defcompression = COMPRESSION_PACKBITS;
323 else if (strneq(opt, "jpeg", 4)) {
324 char* cp = strchr(opt, ':');
325 if (cp && isdigit(cp[1]))
326 quality = atoi(cp+1);
327 if (cp && strchr(cp, 'r'))
328 jpegcolormode = JPEGCOLORMODE_RAW;
329 defcompression = COMPRESSION_JPEG;
330 } else if (strneq(opt, "g3", 2)) {
331 processG3Options(opt);
332 defcompression = COMPRESSION_CCITTFAX3;
333 } else if (streq(opt, "g4"))
334 defcompression = COMPRESSION_CCITTFAX4;
335 else if (strneq(opt, "lzw", 3)) {
336 char* cp = strchr(opt, ':');
337 if (cp)
338 defpredictor = atoi(cp+1);
339 defcompression = COMPRESSION_LZW;
340 } else if (strneq(opt, "zip", 3)) {
341 char* cp = strchr(opt, ':');
342 if (cp)
343 defpredictor = atoi(cp+1);
344 defcompression = COMPRESSION_DEFLATE;
345 } else
346 return (0);
347 return (1);
348 }
349
350 char* stuff[] = {
351 "usage: gtiffcp [options] input... output",
352 "where options are:",
353 " -g file install GeoTIFF metadata from <file>",
354 " -e file install positioning info from ESRI Worldfile <file>",
355 " -a append to output instead of overwriting",
356 " -o offset set initial directory offset",
357 " -p contig pack samples contiguously (e.g. RGBRGB...)",
358 " -p separate store samples separately (e.g. RRR...GGG...BBB...)",
359 " -s write output in strips",
360 " -t write output in tiles",
361 " -i ignore read errors",
362 " -d truncate 8 bitspersample to 4bitspersample",
363 "",
364 " -r # make each strip have no more than # rows",
365 " -w # set output tile width (pixels)",
366 " -l # set output tile length (pixels)",
367 "",
368 " -f lsb2msb force lsb-to-msb FillOrder for output",
369 " -f msb2lsb force msb-to-lsb FillOrder for output",
370 "",
371 " -c lzw[:opts] compress output with Lempel-Ziv & Welch encoding",
372 " -c zip[:opts] compress output with deflate encoding",
373 " -c jpeg[:opts]compress output with JPEG encoding",
374 " -c packbits compress output with packbits encoding",
375 " -c g3[:opts] compress output with CCITT Group 3 encoding",
376 " -c g4 compress output with CCITT Group 4 encoding",
377 " -c none use no compression algorithm on output",
378 "",
379 "Group 3 options:",
380 " 1d use default CCITT Group 3 1D-encoding",
381 " 2d use optional CCITT Group 3 2D-encoding",
382 " fill byte-align EOL codes",
383 "For example, -c g3:2d:fill to get G3-2D-encoded data with byte-aligned EOLs",
384 "",
385 "JPEG options:",
386 " # set compression quality level (0-100, default 75)",
387 " r output color image as RGB rather than YCbCr",
388 "For example, -c jpeg:r:50 to get JPEG-encoded RGB data with 50% comp. quality",
389 "",
390 "LZW and deflate options:",
391 " # set predictor value",
392 "For example, -c lzw:2 to get LZW-encoded data with horizontal differencing",
393 NULL
394 };
395
396 static void
397 usage(void)
398 {
399 char buf[BUFSIZ];
400 int i;
401
402 setbuf(stderr, buf);
403 for (i = 0; stuff[i] != NULL; i++)
404 fprintf(stderr, "%s\n", stuff[i]);
405 exit(-1);
406 }
407
408 static void
409 CheckAndCorrectColormap(TIFF* tif, int n, uint16* r, uint16* g, uint16* b)
410 {
411 int i;
412
413 for (i = 0; i < n; i++)
414 if (r[i] >= 256 || g[i] >= 256 || b[i] >= 256)
415 return;
416 TIFFWarning(TIFFFileName(tif), "Scaling 8-bit colormap");
417 #define CVT(x) (((x) * ((1L<<16)-1)) / 255)
418 for (i = 0; i < n; i++) {
419 r[i] = CVT(r[i]);
420 g[i] = CVT(g[i]);
421 b[i] = CVT(b[i]);
422 }
423 #undef CVT
424 }
425
426 #define CopyField(tag, v) \
427 if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
428 #define CopyField2(tag, v1, v2) \
429 if (TIFFGetField(in, tag, &v1, &v2)) TIFFSetField(out, tag, v1, v2)
430 #define CopyField3(tag, v1, v2, v3) \
431 if (TIFFGetField(in, tag, &v1, &v2, &v3)) TIFFSetField(out, tag, v1, v2, v3)
432 #define CopyField4(tag, v1, v2, v3, v4) \
433 if (TIFFGetField(in, tag, &v1, &v2, &v3, &v4)) TIFFSetField(out, tag, v1, v2, v3, v4)
434
435 static struct cpTag {
436 uint16 tag;
437 uint16 count;
438 TIFFDataType type;
439 } tags[] = {
440 { TIFFTAG_SUBFILETYPE, 1, TIFF_LONG },
441 { TIFFTAG_THRESHHOLDING, 1, TIFF_SHORT },
442 { TIFFTAG_DOCUMENTNAME, 1, TIFF_ASCII },
443 { TIFFTAG_IMAGEDESCRIPTION, 1, TIFF_ASCII },
444 { TIFFTAG_MAKE, 1, TIFF_ASCII },
445 { TIFFTAG_MODEL, 1, TIFF_ASCII },
446 { TIFFTAG_ORIENTATION, 1, TIFF_SHORT },
447 { TIFFTAG_MINSAMPLEVALUE, 1, TIFF_SHORT },
448 { TIFFTAG_MAXSAMPLEVALUE, 1, TIFF_SHORT },
449 { TIFFTAG_XRESOLUTION, 1, TIFF_RATIONAL },
450 { TIFFTAG_YRESOLUTION, 1, TIFF_RATIONAL },
451 { TIFFTAG_PAGENAME, 1, TIFF_ASCII },
452 { TIFFTAG_XPOSITION, 1, TIFF_RATIONAL },
453 { TIFFTAG_YPOSITION, 1, TIFF_RATIONAL },
454 { TIFFTAG_GROUP4OPTIONS, 1, TIFF_LONG },
455 { TIFFTAG_RESOLUTIONUNIT, 1, TIFF_SHORT },
456 { TIFFTAG_PAGENUMBER, 2, TIFF_SHORT },
457 { TIFFTAG_SOFTWARE, 1, TIFF_ASCII },
458 { TIFFTAG_DATETIME, 1, TIFF_ASCII },
459 { TIFFTAG_ARTIST, 1, TIFF_ASCII },
460 { TIFFTAG_HOSTCOMPUTER, 1, TIFF_ASCII },
461 { TIFFTAG_WHITEPOINT, 1, TIFF_RATIONAL },
462 { TIFFTAG_PRIMARYCHROMATICITIES,(uint16) -1,TIFF_RATIONAL },
463 { TIFFTAG_HALFTONEHINTS, 2, TIFF_SHORT },
464 { TIFFTAG_BADFAXLINES, 1, TIFF_LONG },
465 { TIFFTAG_CLEANFAXDATA, 1, TIFF_SHORT },
466 { TIFFTAG_CONSECUTIVEBADFAXLINES,1, TIFF_LONG },
467 { TIFFTAG_INKSET, 1, TIFF_SHORT },
468 { TIFFTAG_INKNAMES, 1, TIFF_ASCII },
469 { TIFFTAG_DOTRANGE, 2, TIFF_SHORT },
470 { TIFFTAG_TARGETPRINTER, 1, TIFF_ASCII },
471 { TIFFTAG_SAMPLEFORMAT, 1, TIFF_SHORT },
472 { TIFFTAG_YCBCRCOEFFICIENTS, (uint16) -1,TIFF_RATIONAL },
473 { TIFFTAG_YCBCRSUBSAMPLING, 2, TIFF_SHORT },
474 { TIFFTAG_YCBCRPOSITIONING, 1, TIFF_SHORT },
475 { TIFFTAG_REFERENCEBLACKWHITE, (uint16) -1,TIFF_RATIONAL },
476 { TIFFTAG_EXTRASAMPLES, (uint16) -1, TIFF_SHORT },
477 { TIFFTAG_SMINSAMPLEVALUE, 1, TIFF_DOUBLE },
478 { TIFFTAG_SMAXSAMPLEVALUE, 1, TIFF_DOUBLE },
479 };
480 #define NTAGS (sizeof (tags) / sizeof (tags[0]))
481
482 static void
483 cpOtherTags(TIFF* in, TIFF* out)
484 {
485 struct cpTag *p;
486
487 for (p = tags; p < &tags[NTAGS]; p++)
488 switch (p->type) {
489 case TIFF_SHORT:
490 if (p->count == 1) {
491 uint16 shortv;
492 CopyField(p->tag, shortv);
493 } else if (p->count == 2) {
494 uint16 shortv1, shortv2;
495 CopyField2(p->tag, shortv1, shortv2);
496 } else if (p->count == (uint16) -1) {
497 uint16 shortv1;
498 uint16* shortav;
499 CopyField2(p->tag, shortv1, shortav);
500 }
501 break;
502 case TIFF_LONG:
503 { uint32 longv;
504 CopyField(p->tag, longv);
505 }
506 break;
507 case TIFF_RATIONAL:
508 if (p->count == 1) {
509 float floatv;
510 CopyField(p->tag, floatv);
511 } else if (p->count == (uint16) -1) {
512 float* floatav;
513 CopyField(p->tag, floatav);
514 }
515 break;
516 case TIFF_ASCII:
517 { char* stringv;
518 CopyField(p->tag, stringv);
519 }
520 break;
521 case TIFF_DOUBLE:
522 if (p->count == 1) {
523 double doublev;
524 CopyField(p->tag, doublev);
525 } else if (p->count == (uint16) -1) {
526 double* doubleav;
527 CopyField(p->tag, doubleav);
528 }
529 break;
530 default:
531 break;
532 }
533 }
534
535 typedef int (*copyFunc)
536 (TIFF* in, TIFF* out, uint32 l, uint32 w, uint16 samplesperpixel);
537 static copyFunc pickCopyFunc(TIFF*, TIFF*, uint16, uint16);
538
539 static int
540 tiffcp(TIFF* in, TIFF* out)
541 {
542 uint16 bitspersample, samplesperpixel, shortv;
543 copyFunc cf;
544 uint32 w, l;
545
546 CopyField(TIFFTAG_IMAGEWIDTH, w);
547 CopyField(TIFFTAG_IMAGELENGTH, l);
548 if( convert_8_to_4 )
549 {
550 TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 4);
551 }
552 else
553 {
554 CopyField(TIFFTAG_BITSPERSAMPLE, bitspersample);
555 }
556 if (compression != (uint16)-1)
557 TIFFSetField(out, TIFFTAG_COMPRESSION, compression);
558 else
559 CopyField(TIFFTAG_COMPRESSION, compression);
560 if (compression == COMPRESSION_JPEG && jpegcolormode == JPEGCOLORMODE_RGB)
561 TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);
562 else
563 CopyField(TIFFTAG_PHOTOMETRIC, shortv);
564 if (fillorder != 0)
565 TIFFSetField(out, TIFFTAG_FILLORDER, fillorder);
566 else
567 CopyField(TIFFTAG_FILLORDER, shortv);
568 CopyField(TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
569 /*
570 * Choose tiles/strip for the output image according to
571 * the command line arguments (-tiles, -strips) and the
572 * structure of the input image.
573 */
574 if (outtiled == -1)
575 outtiled = TIFFIsTiled(in);
576 if (outtiled) {
577 /*
578 * Setup output file's tile width&height. If either
579 * is not specified, use either the value from the
580 * input image or, if nothing is defined, use the
581 * library default.
582 */
583 if (tilewidth == (uint32) -1)
584 TIFFGetField(in, TIFFTAG_TILEWIDTH, &tilewidth);
585 if (tilelength == (uint32) -1)
586 TIFFGetField(in, TIFFTAG_TILELENGTH, &tilelength);
587 TIFFDefaultTileSize(out, &tilewidth, &tilelength);
588 TIFFSetField(out, TIFFTAG_TILEWIDTH, tilewidth);
589 TIFFSetField(out, TIFFTAG_TILELENGTH, tilelength);
590 } else {
591 /*
592 * RowsPerStrip is left unspecified: use either the
593 * value from the input image or, if nothing is defined,
594 * use the library default.
595 */
596 if (rowsperstrip == (uint32) -1)
597 TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
598 rowsperstrip = TIFFDefaultStripSize(out, rowsperstrip);
599 TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
600 }
601 if (config != (uint16) -1)
602 TIFFSetField(out, TIFFTAG_PLANARCONFIG, config);
603 else
604 CopyField(TIFFTAG_PLANARCONFIG, config);
605 if (g3opts != (uint32) -1)
606 TIFFSetField(out, TIFFTAG_GROUP3OPTIONS, g3opts);
607 else
608 CopyField(TIFFTAG_GROUP3OPTIONS, g3opts);
609 if (samplesperpixel <= 4) {
610 uint16 *tr, *tg, *tb, *ta;
611 CopyField4(TIFFTAG_TRANSFERFUNCTION, tr, tg, tb, ta);
612 }
613 { uint16 *red, *green, *blue;
614 if (TIFFGetField(in, TIFFTAG_COLORMAP, &red, &green, &blue)) {
615 CheckAndCorrectColormap(in, 1<<bitspersample, red, green, blue);
616 TIFFSetField(out, TIFFTAG_COLORMAP, red, green, blue);
617 }
618 }
619 /* SMinSampleValue & SMaxSampleValue */
620 switch (compression) {
621 case COMPRESSION_JPEG:
622 TIFFSetField(out, TIFFTAG_JPEGQUALITY, quality);
623 TIFFSetField(out, TIFFTAG_JPEGCOLORMODE, jpegcolormode);
624 break;
625 case COMPRESSION_LZW:
626 case COMPRESSION_DEFLATE:
627 if (predictor != (uint16)-1)
628 TIFFSetField(out, TIFFTAG_PREDICTOR, predictor);
629 else
630 CopyField(TIFFTAG_PREDICTOR, predictor);
631 break;
632 }
633 cpOtherTags(in, out);
634
635 if (geofile)
636 InstallGeoTIFF(out);
637 else
638 CopyGeoTIFF(in,out);
639
640 if( worldfile )
641 ApplyWorldFile( worldfile, out);
642
643 cf = pickCopyFunc(in, out, bitspersample, samplesperpixel);
644 return (cf ? (*cf)(in, out, l, w, samplesperpixel) : FALSE);
645 }
646
647 /*
648 * Copy Functions.
649 */
650 #define DECLAREcpFunc(x) \
651 static int x(TIFF* in, TIFF* out, \
652 uint32 imagelength, uint32 imagewidth, tsample_t spp)
653
654 #define DECLAREreadFunc(x) \
655 static void x(TIFF* in, \
656 unsigned char* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)
657 typedef void (*readFunc)(TIFF*, unsigned char*, uint32, uint32, tsample_t);
658
659 #define DECLAREwriteFunc(x) \
660 static int x(TIFF* out, \
661 unsigned char* buf, uint32 imagelength, uint32 imagewidth, tsample_t spp)
662 typedef int (*writeFunc)(TIFF*, unsigned char*, uint32, uint32, tsample_t);
663
664 /*
665 * Contig -> contig by scanline for rows/strip change.
666 */
667 DECLAREcpFunc(cpContig2ContigByRow)
668 {
669 unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
670 uint32 row;
671
672 (void) imagewidth; (void) spp;
673 for (row = 0; row < imagelength; row++) {
674 if (TIFFReadScanline(in, buf, row, 0) < 0 && !ignore)
675 goto done;
676 if (TIFFWriteScanline(out, buf, row, 0) < 0)
677 goto bad;
678 }
679 done:
680 _TIFFfree(buf);
681 return (TRUE);
682 bad:
683 _TIFFfree(buf);
684 return (FALSE);
685 }
686
687 /*
688 * Contig -> contig by scanline for rows/strip change.
689 */
690 DECLAREcpFunc(cpContig2ContigByRow_8_to_4)
691 {
692 unsigned char *buf_in = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
693 unsigned char *buf_out = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
694 uint32 row;
695
696 printf( "Downsample\n" );
697
698 (void) imagewidth; (void) spp;
699 for (row = 0; row < imagelength; row++) {
700 int i_in, i_out_byte;
701
702 if (TIFFReadScanline(in, buf_in, row, 0) < 0 && !ignore)
703 goto done;
704
705 for( i_in = 0, i_out_byte = 0;
706 i_in < imagewidth;
707 i_in += 2, i_out_byte++ )
708 {
709 buf_out[i_out_byte] =
710 (buf_in[i_in] & 0xf)*16 + (buf_in[i_in+1] & 0xf);
711 }
712
713 if (TIFFWriteScanline(out, buf_out, row, 0) < 0)
714 goto bad;
715 }
716 done:
717 _TIFFfree(buf_in);
718 _TIFFfree(buf_out);
719 return (TRUE);
720 bad:
721 _TIFFfree(buf_in);
722 _TIFFfree(buf_out);
723 return (FALSE);
724 }
725
726 /*
727 * Strip -> strip for change in encoding.
728 */
729 DECLAREcpFunc(cpDecodedStrips)
730 {
731 tsize_t stripsize = TIFFStripSize(in);
732 unsigned char *buf = (unsigned char *)_TIFFmalloc(stripsize);
733
734 (void) imagewidth; (void) spp;
735 if (buf) {
736 tstrip_t s, ns = TIFFNumberOfStrips(in);
737 uint32 row = 0;
738 for (s = 0; s < ns; s++) {
739 tsize_t cc = (row + rowsperstrip > imagelength) ?
740 TIFFVStripSize(in, imagelength - row) : stripsize;
741 if (TIFFReadEncodedStrip(in, s, buf, cc) < 0 && !ignore)
742 break;
743 if (TIFFWriteEncodedStrip(out, s, buf, cc) < 0) {
744 _TIFFfree(buf);
745 return (FALSE);
746 }
747 row += rowsperstrip;
748 }
749 _TIFFfree(buf);
750 return (TRUE);
751 }
752 return (FALSE);
753 }
754
755 /*
756 * Separate -> separate by row for rows/strip change.
757 */
758 DECLAREcpFunc(cpSeparate2SeparateByRow)
759 {
760 unsigned char *buf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
761 uint32 row;
762 tsample_t s;
763
764 (void) imagewidth;
765 for (s = 0; s < spp; s++) {
766 for (row = 0; row < imagelength; row++) {
767 if (TIFFReadScanline(in, buf, row, s) < 0 && !ignore)
768 goto done;
769 if (TIFFWriteScanline(out, buf, row, s) < 0)
770 goto bad;
771 }
772 }
773 done:
774 _TIFFfree(buf);
775 return (TRUE);
776 bad:
777 _TIFFfree(buf);
778 return (FALSE);
779 }
780
781 /*
782 * Contig -> separate by row.
783 */
784 DECLAREcpFunc(cpContig2SeparateByRow)
785 {
786 unsigned char *inbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
787 unsigned char *outbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
788 register unsigned char *inp, *outp;
789 register uint32 n;
790 uint32 row;
791 tsample_t s;
792
793 /* unpack channels */
794 for (s = 0; s < spp; s++) {
795 for (row = 0; row < imagelength; row++) {
796 if (TIFFReadScanline(in, inbuf, row, 0) < 0 && !ignore)
797 goto done;
798 inp = inbuf + s;
799 outp = outbuf;
800 for (n = imagewidth; n-- > 0;) {
801 *outp++ = *inp;
802 inp += spp;
803 }
804 if (TIFFWriteScanline(out, outbuf, row, s) < 0)
805 goto bad;
806 }
807 }
808 done:
809 if (inbuf) _TIFFfree(inbuf);
810 if (outbuf) _TIFFfree(outbuf);
811 return (TRUE);
812 bad:
813 if (inbuf) _TIFFfree(inbuf);
814 if (outbuf) _TIFFfree(outbuf);
815 return (FALSE);
816 }
817
818 /*
819 * Separate -> contig by row.
820 */
821 DECLAREcpFunc(cpSeparate2ContigByRow)
822 {
823 unsigned char *inbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(in));
824 unsigned char *outbuf = (unsigned char *)_TIFFmalloc(TIFFScanlineSize(out));
825 register unsigned char *inp, *outp;
826 register uint32 n;
827 uint32 row;
828 tsample_t s;
829
830 for (row = 0; row < imagelength; row++) {
831 /* merge channels */
832 for (s = 0; s < spp; s++) {
833 if (TIFFReadScanline(in, inbuf, row, s) < 0 && !ignore)
834 goto done;
835 inp = inbuf;
836 outp = outbuf + s;
837 for (n = imagewidth; n-- > 0;) {
838 *outp = *inp++;
839 outp += spp;
840 }
841 }
842 if (TIFFWriteScanline(out, outbuf, row, 0) < 0)
843 goto bad;
844 }
845 done:
846 if (inbuf) _TIFFfree(inbuf);
847 if (outbuf) _TIFFfree(outbuf);
848 return (TRUE);
849 bad:
850 if (inbuf) _TIFFfree(inbuf);
851 if (outbuf) _TIFFfree(outbuf);
852 return (FALSE);
853 }
854
855 static void
856 cpStripToTile(unsigned char* out, unsigned char* in,
857 uint32 rows, uint32 cols, int outskew, int inskew)
858 {
859 while (rows-- > 0) {
860 uint32 j = cols;
861 while (j-- > 0)
862 *out++ = *in++;
863 out += outskew;
864 in += inskew;
865 }
866 }
867
868 static void
869 cpContigBufToSeparateBuf(unsigned char* out, unsigned char* in,
870 uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp)
871 {
872 while (rows-- > 0) {
873 uint32 j = cols;
874 while (j-- > 0)
875 *out++ = *in, in += spp;
876 out += outskew;
877 in += inskew;
878 }
879 }
880
881 static void
882 cpSeparateBufToContigBuf(unsigned char* out, unsigned char* in,
883 uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp)
884 {
885 while (rows-- > 0) {
886 uint32 j = cols;
887 while (j-- > 0)
888 *out = *in++, out += spp;
889 out += outskew;
890 in += inskew;
891 }
892 }
893
894 static int
895 cpImage(TIFF* in, TIFF* out, readFunc fin, writeFunc fout,
896 uint32 imagelength, uint32 imagewidth, tsample_t spp)
897 {
898 int status = FALSE;
899 unsigned char* buf = (unsigned char *)
900 _TIFFmalloc(TIFFRasterScanlineSize(in) * imagelength);
901 if (buf) {
902 (*fin)(in, buf, imagelength, imagewidth, spp);
903 status = (fout)(out, buf, imagelength, imagewidth, spp);
904 _TIFFfree(buf);
905 }
906 return (status);
907 }
908
909 DECLAREreadFunc(readContigStripsIntoBuffer)
910 {
911 tsize_t scanlinesize = TIFFScanlineSize(in);
912 unsigned char *bufp = buf;
913 uint32 row;
914
915 (void) imagewidth; (void) spp;
916 for (row = 0; row < imagelength; row++) {
917 if (TIFFReadScanline(in, bufp, row, 0) < 0 && !ignore)
918 break;
919 bufp += scanlinesize;
920 }
921 }
922
923 DECLAREreadFunc(readSeparateStripsIntoBuffer)
924 {
925 tsize_t scanlinesize = TIFFScanlineSize(in);
926 unsigned char* scanline = (unsigned char *) _TIFFmalloc(scanlinesize);
927
928 (void) imagewidth;
929 if (scanline) {
930 unsigned char *bufp = buf;
931 uint32 row;
932 tsample_t s;
933
934 for (row = 0; row < imagelength; row++) {
935 /* merge channels */
936 for (s = 0; s < spp; s++) {
937 unsigned char* sp = scanline;
938 unsigned char* bp = bufp + s;
939 tsize_t n = scanlinesize;
940
941 if (TIFFReadScanline(in, sp, row, s) < 0 && !ignore)
942 goto done;
943 while (n-- > 0)
944 *bp = *bufp++, bp += spp;
945 }
946 bufp += scanlinesize;
947 }
948 done:
949 _TIFFfree(scanline);
950 }
951 }
952
953 DECLAREreadFunc(readContigTilesIntoBuffer)
954 {
955 unsigned char* tilebuf = (unsigned char *) _TIFFmalloc(TIFFTileSize(in));
956 uint32 imagew = TIFFScanlineSize(in);
957 uint32 tilew = TIFFTileRowSize(in);
958 int iskew = imagew - tilew;
959 unsigned char *bufp = buf;
960 uint32 tw, tl;
961 uint32 row;
962
963 (void) spp;
964 if (tilebuf == 0)
965 return;
966 (void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
967 (void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
968 for (row = 0; row < imagelength; row += tl) {
969 uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
970 uint32 colb = 0;
971 uint32 col;
972
973 for (col = 0; col < imagewidth; col += tw) {
974 if (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0 &&
975 !ignore)
976 goto done;
977 if (colb + tilew > imagew) {
978 uint32 width = imagew - colb;
979 uint32 oskew = tilew - width;
980 cpStripToTile(bufp + colb,
981 tilebuf, nrow, width,
982 oskew + iskew, oskew);
983 } else
984 cpStripToTile(bufp + colb,
985 tilebuf, nrow, tilew,
986 iskew, 0);
987 colb += tilew;
988 }
989 bufp += imagew * nrow;
990 }
991 done:
992 _TIFFfree(tilebuf);
993 }
994
995 DECLAREreadFunc(readSeparateTilesIntoBuffer)
996 {
997 uint32 imagew = TIFFScanlineSize(in);
998 uint32 tilew = TIFFTileRowSize(in);
999 int iskew = imagew - tilew;
1000 unsigned char* tilebuf = (unsigned char *) _TIFFmalloc(TIFFTileSize(in));
1001 unsigned char *bufp = buf;
1002 uint32 tw, tl;
1003 uint32 row;
1004
1005 if (tilebuf == 0)
1006 return;
1007 (void) TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
1008 (void) TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
1009 for (row = 0; row < imagelength; row += tl) {
1010 uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
1011 uint32 colb = 0;
1012 uint32 col;
1013
1014 for (col = 0; col < imagewidth; col += tw) {
1015 tsample_t s;
1016
1017 for (s = 0; s < spp; s++) {
1018 if (TIFFReadTile(in, tilebuf, col, row, 0, s) < 0 && !ignore)
1019 goto done;
1020 /*
1021 * Tile is clipped horizontally. Calculate
1022 * visible portion and skewing factors.
1023 */
1024 if (colb + tilew > imagew) {
1025 uint32 width = imagew - colb;
1026 int oskew = tilew - width;
1027 cpSeparateBufToContigBuf(bufp+colb+s,
1028 tilebuf, nrow, width,
1029 oskew + iskew, oskew, spp);
1030 } else
1031 cpSeparateBufToContigBuf(bufp+colb+s,
1032 tilebuf, nrow, tw,
1033 iskew, 0, spp);
1034 }
1035 colb += tilew;
1036 }
1037 bufp += imagew * nrow;
1038 }
1039 done:
1040 _TIFFfree(tilebuf);
1041 }
1042
1043 DECLAREwriteFunc(writeBufferToContigStrips)
1044 {
1045 tsize_t scanline = TIFFScanlineSize(out);
1046 uint32 row;
1047
1048 (void) imagewidth; (void) spp;
1049 for (row = 0; row < imagelength; row++) {
1050 if (TIFFWriteScanline(out, buf, row, 0) < 0)
1051 return (FALSE);
1052 buf += scanline;
1053 }
1054 return (TRUE);
1055 }
1056
1057 DECLAREwriteFunc(writeBufferToSeparateStrips)
1058 {
1059 unsigned char *obuf = (unsigned char *) _TIFFmalloc(TIFFScanlineSize(out));
1060 tsample_t s;
1061
1062 if (obuf == NULL)
1063 return (0);
1064 for (s = 0; s < spp; s++) {
1065 uint32 row;
1066 for (row = 0; row < imagelength; row++) {
1067 unsigned char* inp = buf + s;
1068 unsigned char* outp = obuf;
1069 uint32 n = imagewidth;
1070
1071 while (n-- > 0)
1072 *outp++ = *inp, inp += spp;
1073 if (TIFFWriteScanline(out, obuf, row, s) < 0) {
1074 _TIFFfree(obuf);
1075 return (FALSE);
1076 }
1077 }
1078 }
1079 _TIFFfree(obuf);
1080 return (TRUE);
1081
1082 }
1083
1084 DECLAREwriteFunc(writeBufferToContigTiles)
1085 {
1086 uint32 imagew = TIFFScanlineSize(out);
1087 uint32 tilew = TIFFTileRowSize(out);
1088 int iskew = imagew - tilew;
1089 unsigned char* obuf = (unsigned char *) _TIFFmalloc(TIFFTileSize(out));
1090 unsigned char* bufp = buf;
1091 uint32 tl, tw;
1092 uint32 row;
1093
1094 (void) spp;
1095 if (obuf == NULL)
1096 return (FALSE);
1097 (void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
1098 (void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
1099 for (row = 0; row < imagelength; row += tilelength) {
1100 uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
1101 uint32 colb = 0;
1102 uint32 col;
1103
1104 for (col = 0; col < imagewidth; col += tw) {
1105 /*
1106 * Tile is clipped horizontally. Calculate
1107 * visible portion and skewing factors.
1108 */
1109 if (colb + tilew > imagew) {
1110 uint32 width = imagew - colb;
1111 int oskew = tilew - width;
1112 cpStripToTile(obuf, bufp + colb, nrow, width,
1113 oskew, oskew + iskew);
1114 } else
1115 cpStripToTile(obuf, bufp + colb, nrow, tilew,
1116 0, iskew);
1117 if (TIFFWriteTile(out, obuf, col, row, 0, 0) < 0) {
1118 _TIFFfree(obuf);
1119 return (FALSE);
1120 }
1121 colb += tilew;
1122 }
1123 bufp += nrow * imagew;
1124 }
1125 _TIFFfree(obuf);
1126 return (TRUE);
1127 }
1128
1129 DECLAREwriteFunc(writeBufferToSeparateTiles)
1130 {
1131 uint32 imagew = TIFFScanlineSize(out);
1132 tsize_t tilew = TIFFTileRowSize(out);
1133 int iskew = imagew - tilew;
1134 unsigned char *obuf = (unsigned char*) _TIFFmalloc(TIFFTileSize(out));
1135 unsigned char *bufp = buf;
1136 uint32 tl, tw;
1137 uint32 row;
1138
1139 if (obuf == NULL)
1140 return (FALSE);
1141 (void) TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
1142 (void) TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
1143 for (row = 0; row < imagelength; row += tl) {
1144 uint32 nrow = (row+tl > imagelength) ? imagelength-row : tl;
1145 uint32 colb = 0;
1146 uint32 col;
1147
1148 for (col = 0; col < imagewidth; col += tw) {
1149 tsample_t s;
1150 for (s = 0; s < spp; s++) {
1151 /*
1152 * Tile is clipped horizontally. Calculate
1153 * visible portion and skewing factors.
1154 */
1155 if (colb + tilew > imagew) {
1156 uint32 width = imagew - colb;
1157 int oskew = tilew - width;
1158
1159 cpContigBufToSeparateBuf(obuf,
1160 bufp + colb + s,
1161 nrow, width,
1162 oskew/spp, oskew + imagew, spp);
1163 } else
1164 cpContigBufToSeparateBuf(obuf,
1165 bufp + colb + s,
1166 nrow, tilewidth,
1167 0, iskew, spp);
1168 if (TIFFWriteTile(out, obuf, col, row, 0, s) < 0) {
1169 _TIFFfree(obuf);
1170 return (FALSE);
1171 }
1172 }
1173 colb += tilew;
1174 }
1175 bufp += nrow * imagew;
1176 }
1177 _TIFFfree(obuf);
1178 return (TRUE);
1179 }
1180
1181 /*
1182 * Contig strips -> contig tiles.
1183 */
1184 DECLAREcpFunc(cpContigStrips2ContigTiles)
1185 {
1186 return cpImage(in, out,
1187 readContigStripsIntoBuffer,
1188 writeBufferToContigTiles,
1189 imagelength, imagewidth, spp);
1190 }
1191
1192 /*
1193 * Contig strips -> separate tiles.
1194 */
1195 DECLAREcpFunc(cpContigStrips2SeparateTiles)
1196 {
1197 return cpImage(in, out,
1198 readContigStripsIntoBuffer,
1199 writeBufferToSeparateTiles,
1200 imagelength, imagewidth, spp);
1201 }
1202
1203 /*
1204 * Separate strips -> contig tiles.
1205 */
1206 DECLAREcpFunc(cpSeparateStrips2ContigTiles)
1207 {
1208 return cpImage(in, out,
1209 readSeparateStripsIntoBuffer,
1210 writeBufferToContigTiles,
1211 imagelength, imagewidth, spp);
1212 }
1213
1214 /*
1215 * Separate strips -> separate tiles.
1216 */
1217 DECLAREcpFunc(cpSeparateStrips2SeparateTiles)
1218 {
1219 return cpImage(in, out,
1220 readSeparateStripsIntoBuffer,
1221 writeBufferToSeparateTiles,
1222 imagelength, imagewidth, spp);
1223 }
1224
1225 /*
1226 * Contig strips -> contig tiles.
1227 */
1228 DECLAREcpFunc(cpContigTiles2ContigTiles)
1229 {
1230 return cpImage(in, out,
1231 readContigTilesIntoBuffer,
1232 writeBufferToContigTiles,
1233 imagelength, imagewidth, spp);
1234 }
1235
1236 /*
1237 * Contig tiles -> separate tiles.
1238 */
1239 DECLAREcpFunc(cpContigTiles2SeparateTiles)
1240 {
1241 return cpImage(in, out,
1242 readContigTilesIntoBuffer,
1243 writeBufferToSeparateTiles,
1244 imagelength, imagewidth, spp);
1245 }
1246
1247 /*
1248 * Separate tiles -> contig tiles.
1249 */
1250 DECLAREcpFunc(cpSeparateTiles2ContigTiles)
1251 {
1252 return cpImage(in, out,
1253 readSeparateTilesIntoBuffer,
1254 writeBufferToContigTiles,
1255 imagelength, imagewidth, spp);
1256 }
1257
1258 /*
1259 * Separate tiles -> separate tiles (tile dimension change).
1260 */
1261 DECLAREcpFunc(cpSeparateTiles2SeparateTiles)
1262 {
1263 return cpImage(in, out,
1264 readSeparateTilesIntoBuffer,
1265 writeBufferToSeparateTiles,
1266 imagelength, imagewidth, spp);
1267 }
1268
1269 /*
1270 * Contig tiles -> contig tiles (tile dimension change).
1271 */
1272 DECLAREcpFunc(cpContigTiles2ContigStrips)
1273 {
1274 return cpImage(in, out,
1275 readContigTilesIntoBuffer,
1276 writeBufferToContigStrips,
1277 imagelength, imagewidth, spp);
1278 }
1279
1280 /*
1281 * Contig tiles -> separate strips.
1282 */
1283 DECLAREcpFunc(cpContigTiles2SeparateStrips)
1284 {
1285 return cpImage(in, out,
1286 readContigTilesIntoBuffer,
1287 writeBufferToSeparateStrips,
1288 imagelength, imagewidth, spp);
1289 }
1290
1291 /*
1292 * Separate tiles -> contig strips.
1293 */
1294 DECLAREcpFunc(cpSeparateTiles2ContigStrips)
1295 {
1296 return cpImage(in, out,
1297 readSeparateTilesIntoBuffer,
1298 writeBufferToContigStrips,
1299 imagelength, imagewidth, spp);
1300 }
1301
1302 /*
1303 * Separate tiles -> separate strips.
1304 */
1305 DECLAREcpFunc(cpSeparateTiles2SeparateStrips)
1306 {
1307 return cpImage(in, out,
1308 readSeparateTilesIntoBuffer,
1309 writeBufferToSeparateStrips,
1310 imagelength, imagewidth, spp);
1311 }
1312
1313 /*
1314 * Select the appropriate copy function to use.
1315 */
1316 static copyFunc
1317 pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel)
1318 {
1319 uint16 shortv;
1320 uint32 w, l, tw, tl;
1321 int bychunk;
1322
1323 (void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv);
1324 if (shortv != config && bitspersample != 8 && samplesperpixel > 1) {
1325 fprintf(stderr,
1326 "%s: Can not handle different planar configuration w/ bits/sample != 8\n",
1327 TIFFFileName(in));
1328 return (NULL);
1329 }
1330 TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w);
1331 TIFFGetField(in, TIFFTAG_IMAGELENGTH, &l);
1332 if (TIFFIsTiled(out)) {
1333 if (!TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw))
1334 tw = w;
1335 if (!TIFFGetField(in, TIFFTAG_TILELENGTH, &tl))
1336 tl = l;
1337 bychunk = (tw == tilewidth && tl == tilelength);
1338 } else if (TIFFIsTiled(in)) {
1339 TIFFGetField(in, TIFFTAG_TILEWIDTH, &tw);
1340 TIFFGetField(in, TIFFTAG_TILELENGTH, &tl);
1341 bychunk = (tw == w && tl == rowsperstrip);
1342 } else {
1343 uint32 irps = (uint32) -1L;
1344 TIFFGetField(in, TIFFTAG_ROWSPERSTRIP, &irps);
1345 bychunk = (rowsperstrip == irps);
1346 }
1347 #define T 1
1348 #define F 0
1349 #define pack(a,b,c,d,e) ((long)(((a)<<11)|((b)<<3)|((c)<<2)|((d)<<1)|(e)))
1350 switch(pack(shortv,config,TIFFIsTiled(in),TIFFIsTiled(out),bychunk)) {
1351 /* Strips -> Tiles */
1352 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,T,F):
1353 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,T,T):
1354 return cpContigStrips2ContigTiles;
1355 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,T,F):
1356 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,T,T):
1357 return cpContigStrips2SeparateTiles;
1358 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,T,F):
1359 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,T,T):
1360 return cpSeparateStrips2ContigTiles;
1361 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,F):
1362 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,T,T):
1363 return cpSeparateStrips2SeparateTiles;
1364 /* Tiles -> Tiles */
1365 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,T,F):
1366 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,T,T):
1367 return cpContigTiles2ContigTiles;
1368 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,T,F):
1369 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,T,T):
1370 return cpContigTiles2SeparateTiles;
1371 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,T,F):
1372 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,T,T):
1373 return cpSeparateTiles2ContigTiles;
1374 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,F):
1375 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,T,T):
1376 return cpSeparateTiles2SeparateTiles;
1377 /* Tiles -> Strips */
1378 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,F,F):
1379 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, T,F,T):
1380 return cpContigTiles2ContigStrips;
1381 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,F,F):
1382 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, T,F,T):
1383 return cpContigTiles2SeparateStrips;
1384 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,F,F):
1385 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, T,F,T):
1386 return cpSeparateTiles2ContigStrips;
1387 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,F):
1388 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, T,F,T):
1389 return cpSeparateTiles2SeparateStrips;
1390 /* Strips -> Strips */
1391 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,F,F):
1392 if( convert_8_to_4 )
1393 return cpContig2ContigByRow_8_to_4;
1394 else
1395 return cpContig2ContigByRow;
1396
1397 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_CONTIG, F,F,T):
1398 if( convert_8_to_4 )
1399 return cpContig2ContigByRow_8_to_4;
1400 else
1401 return cpDecodedStrips;
1402 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,F,F):
1403 case pack(PLANARCONFIG_CONTIG, PLANARCONFIG_SEPARATE, F,F,T):
1404 return cpContig2SeparateByRow;
1405 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,F,F):
1406 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_CONTIG, F,F,T):
1407 return cpSeparate2ContigByRow;
1408 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,F):
1409 case pack(PLANARCONFIG_SEPARATE, PLANARCONFIG_SEPARATE, F,F,T):
1410 return cpSeparate2SeparateByRow;
1411 }
1412 #undef pack
1413 #undef F
1414 #undef T
1415 fprintf(stderr, "tiffcp: %s: Don't know how to copy/convert image.\n",
1416 TIFFFileName(in));
1417 return (NULL);
1418 }
0 /*
1 * Copyright (c) 1987 Regents of the University of California.
2 * All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. All advertising materials mentioning features or use of this software
13 * must display the following acknowledgement:
14 * This product includes software developed by the University of
15 * California, Berkeley and its contributors.
16 * 4. Neither the name of the University nor the names of its contributors
17 * may be used to endorse or promote products derived from this software
18 * without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33 #if defined(LIBC_SCCS) && !defined(lint)
34 static char sccsid[] = "@(#)getopt.c 4.13 (Berkeley) 2/23/91";
35 #endif /* LIBC_SCCS and not lint */
36
37 #include <stdio.h>
38 #include <string.h>
39
40 /*
41 * get option letter from argument vector
42 */
43 int opterr = 1, /* if error message should be printed */
44 optind = 1, /* index into parent argv vector */
45 optopt; /* character checked for validity */
46 char *optarg; /* argument associated with option */
47
48 #define BADCH (int)'?'
49 #define EMSG ""
50
51 int
52 getopt(int nargc, char** nargv, char* ostr)
53 {
54 static char *place = EMSG; /* option letter processing */
55 register char *oli; /* option letter list index */
56 char *p;
57
58 if (!*place) { /* update scanning pointer */
59 if (optind >= nargc || *(place = nargv[optind]) != '-') {
60 place = EMSG;
61 return(EOF);
62 }
63 if (place[1] && *++place == '-') { /* found "--" */
64 ++optind;
65 place = EMSG;
66 return(EOF);
67 }
68 } /* option letter okay? */
69 if ((optopt = (int)*place++) == (int)':' ||
70 !(oli = strchr(ostr, optopt))) {
71 /*
72 * if the user didn't specify '-' as an option,
73 * assume it means EOF.
74 */
75 if (optopt == (int)'-')
76 return(EOF);
77 if (!*place)
78 ++optind;
79 if (opterr) {
80 if (!(p = strrchr(*nargv, '/')))
81 p = *nargv;
82 else
83 ++p;
84 (void)fprintf(stderr, "%s: illegal option -- %c\n",
85 p, optopt);
86 }
87 return(BADCH);
88 }
89 if (*++oli != ':') { /* don't need argument */
90 optarg = NULL;
91 if (!*place)
92 ++optind;
93 }
94 else { /* need an argument */
95 if (*place) /* no white space */
96 optarg = place;
97 else if (nargc <= ++optind) { /* no arg */
98 place = EMSG;
99 if (!(p = strrchr(*nargv, '/')))
100 p = *nargv;
101 else
102 ++p;
103 if (opterr)
104 (void)fprintf(stderr,
105 "%s: option requires an argument -- %c\n",
106 p, optopt);
107 return(BADCH);
108 }
109 else /* white space */
110 optarg = nargv[optind];
111 place = EMSG;
112 ++optind;
113 }
114 return(optopt); /* dump back option letter */
115 }
0 /*
1 * listgeo.c -- example client code for LIBGEO geographic
2 * TIFF tag support. Dumps info to GeoTIFF metadata file.
3 *
4 * Author: Niles D. Ritter
5 *
6 */
7
8 #include "geotiff.h"
9 #include "xtiffio.h"
10 #include "geo_normalize.h"
11 #include "geovalues.h"
12 #include "tiffio.h"
13 #include "cpl_serv.h"
14 #include <stdio.h>
15
16 static void WriteTFWFile( GTIF * gtif, const char * tif_filename );
17 static void GTIFPrintCorners( GTIF *, GTIFDefn *, FILE *, int, int, int, int );
18 static const char *CSVFileOverride( const char * );
19 static const char *CSVDirName = NULL;
20
21 void Usage()
22
23 {
24 printf(
25 "%s",
26 "Usage: listgeo [-d] [-tfw] [-proj4] [-no_norm] [-t tabledir] filename\n"
27 "\n"
28 " -d: report lat/long corners in decimal degrees instead of DMS.\n"
29 " -tfw: Generate a .tfw (ESRI TIFF World) file for the target file.\n"
30 " -proj4: Report PROJ.4 equivelent projection definition.\n"
31 " -no_norm: Don't report 'normalized' parameter values.\n"
32 " filename: Name of the GeoTIFF file to report on.\n" );
33
34 exit( 1 );
35 }
36
37 int main(int argc, char *argv[])
38 {
39 char *fname = NULL;
40 TIFF *tif=(TIFF*)0; /* TIFF-level descriptor */
41 GTIF *gtif=(GTIF*)0; /* GeoKey-level descriptor */
42 int i, norm_print_flag = 1, proj4_print_flag = 0;
43 int tfw_flag = 0, inv_flag = 0, dec_flag = 0;
44
45 /*
46 * Handle command line options.
47 */
48 for( i = 1; i < argc; i++ )
49 {
50 if( strcmp(argv[i],"-no_norm") == 0 )
51 norm_print_flag = 0;
52 else if( strcmp(argv[i],"-t") == 0 )
53 {
54 CSVDirName = argv[++i];
55 SetCSVFilenameHook( CSVFileOverride );
56 }
57 else if( strcmp(argv[i],"-tfw") == 0 )
58 tfw_flag = 1;
59 else if( strcmp(argv[i],"-proj4") == 0 )
60 proj4_print_flag = 1;
61 else if( strcmp(argv[i],"-i") == 0 )
62 inv_flag = 1;
63 else if( strcmp(argv[i],"-d") == 0 )
64 dec_flag = 1;
65 else if( fname == NULL && argv[i][0] != '-' )
66 fname = argv[i];
67 else
68 {
69 Usage();
70 }
71 }
72
73 if( fname == NULL )
74 Usage();
75
76 /*
77 * Open the file, read the GeoTIFF information, and print to stdout.
78 */
79
80 tif=XTIFFOpen(fname,"r");
81 if (!tif) goto failure;
82
83 gtif = GTIFNew(tif);
84 if (!gtif)
85 {
86 fprintf(stderr,"failed in GTIFNew\n");
87 goto failure;
88 }
89
90 if( tfw_flag )
91 {
92 WriteTFWFile( gtif, fname );
93
94 goto Success;
95 }
96
97 /* dump the GeoTIFF metadata to std out */
98
99 GTIFPrint(gtif,0,0);
100
101 /*
102 * Capture, and report normalized information if requested.
103 */
104
105 if( norm_print_flag )
106 {
107 GTIFDefn defn;
108
109 if( GTIFGetDefn( gtif, &defn ) )
110 {
111 int xsize, ysize;
112
113 printf( "\n" );
114 GTIFPrintDefn( &defn, stdout );
115
116 if( proj4_print_flag )
117 {
118 printf( "\n" );
119 printf( "PROJ.4 Definition: %s\n", GTIFGetProj4Defn(&defn));
120 }
121
122 TIFFGetField( tif, TIFFTAG_IMAGEWIDTH, &xsize );
123 TIFFGetField( tif, TIFFTAG_IMAGELENGTH, &ysize );
124 GTIFPrintCorners( gtif, &defn, stdout, xsize, ysize, inv_flag, dec_flag );
125 }
126
127 }
128
129 Success:
130 GTIFFree(gtif);
131 XTIFFClose(tif);
132 return 0;
133
134 failure:
135 fprintf(stderr,"failure in listgeo\n");
136 if (tif) XTIFFClose(tif);
137 if (gtif) GTIFFree(gtif);
138 return 1;
139 }
140
141 static const char *CSVFileOverride( const char * pszInput )
142
143 {
144 static char szPath[1024];
145
146 #ifdef WIN32
147 sprintf( szPath, "%s\\%s", CSVDirName, pszInput );
148 #else
149 sprintf( szPath, "%s/%s", CSVDirName, pszInput );
150 #endif
151
152 return( szPath );
153 }
154
155 /*
156 * Report the file(s) corner coordinates in projected coordinates, and
157 * if possible lat/long.
158 */
159
160 static int GTIFReportACorner( GTIF *gtif, GTIFDefn *defn, FILE * fp_out,
161 const char * corner_name,
162 double x, double y, int inv_flag, int dec_flag )
163
164 {
165 double x_saved, y_saved;
166
167 /* Try to transform the coordinate into PCS space */
168 if( !GTIFImageToPCS( gtif, &x, &y ) )
169 return FALSE;
170
171 x_saved = x;
172 y_saved = y;
173
174 fprintf( fp_out, "%-13s ", corner_name );
175
176 if( defn->Model == ModelTypeGeographic )
177 {
178 if (dec_flag)
179 {
180 fprintf( fp_out, "(%.7f,", x );
181 fprintf( fp_out, "%.7f)\n", y );
182 }
183 else
184 {
185 fprintf( fp_out, "(%s,", GTIFDecToDMS( x, "Long", 2 ) );
186 fprintf( fp_out, "%s)\n", GTIFDecToDMS( y, "Lat", 2 ) );
187 }
188 }
189 else
190 {
191 fprintf( fp_out, "(%12.3f,%12.3f)", x, y );
192
193 if( GTIFProj4ToLatLong( defn, 1, &x, &y ) )
194 {
195 if (dec_flag)
196 {
197 fprintf( fp_out, " (%.7f,", x );
198 fprintf( fp_out, "%.7f)", y );
199 }
200 else
201 {
202 fprintf( fp_out, " (%s,", GTIFDecToDMS( x, "Long", 2 ) );
203 fprintf( fp_out, "%s)", GTIFDecToDMS( y, "Lat", 2 ) );
204 }
205 }
206
207 fprintf( fp_out, "\n" );
208 }
209
210 if( inv_flag && GTIFPCSToImage( gtif, &x_saved, &y_saved ) )
211 {
212 fprintf( fp_out, " inverse (%11.3f,%11.3f)\n", x_saved, y_saved );
213 }
214
215 return TRUE;
216 }
217
218 static void GTIFPrintCorners( GTIF *gtif, GTIFDefn *defn, FILE * fp_out,
219 int xsize, int ysize, int inv_flag, int dec_flag )
220
221 {
222 printf( "\nCorner Coordinates:\n" );
223 if( !GTIFReportACorner( gtif, defn, fp_out,
224 "Upper Left", 0.0, 0.0, inv_flag, dec_flag ) )
225 {
226 printf( " ... unable to transform points between pixel/line and PCS space\n" );
227 return;
228 }
229
230 GTIFReportACorner( gtif, defn, fp_out, "Lower Left", 0.0, ysize,
231 inv_flag, dec_flag );
232 GTIFReportACorner( gtif, defn, fp_out, "Upper Right", xsize, 0.0,
233 inv_flag, dec_flag );
234 GTIFReportACorner( gtif, defn, fp_out, "Lower Right", xsize, ysize,
235 inv_flag, dec_flag );
236 GTIFReportACorner( gtif, defn, fp_out, "Center", xsize/2.0, ysize/2.0,
237 inv_flag, dec_flag );
238 }
239
240 /*
241 * Write the defining matrix for this file to a .tfw file with the same
242 * basename.
243 */
244
245 static void WriteTFWFile( GTIF * gtif, const char * tif_filename )
246
247 {
248 char tfw_filename[1024];
249 int i;
250 double adfCoeff[6], x, y;
251 FILE *fp;
252
253 /*
254 * form .tfw filename
255 */
256 strncpy( tfw_filename, tif_filename, sizeof(tfw_filename)-4 );
257 for( i = strlen(tfw_filename)-1; i > 0; i-- )
258 {
259 if( tfw_filename[i] == '.' )
260 {
261 strcpy( tfw_filename + i, ".tfw" );
262 break;
263 }
264 }
265
266 if( i <= 0 )
267 strcat( tfw_filename, ".tfw" );
268
269 /*
270 * Compute the coefficients.
271 */
272 x = 0.5;
273 y = 0.5;
274 if( !GTIFImageToPCS( gtif, &x, &y ) )
275 return;
276 adfCoeff[4] = x;
277 adfCoeff[5] = y;
278
279 x = 1.5;
280 y = 0.5;
281 if( !GTIFImageToPCS( gtif, &x, &y ) )
282 return;
283 adfCoeff[0] = x - adfCoeff[4];
284 adfCoeff[1] = y - adfCoeff[5];
285
286 x = 0.5;
287 y = 1.5;
288 if( !GTIFImageToPCS( gtif, &x, &y ) )
289 return;
290 adfCoeff[2] = x - adfCoeff[4];
291 adfCoeff[3] = y - adfCoeff[5];
292
293 /*
294 * Write out the coefficients.
295 */
296
297 fp = fopen( tfw_filename, "wt" );
298 if( fp == NULL )
299 {
300 perror( "fopen" );
301 fprintf( stderr, "Failed to open TFW file `%s'\n", tfw_filename );
302 return;
303 }
304
305 for( i = 0; i < 6; i++ )
306 fprintf( fp, "%24.10f\n", adfCoeff[i] );
307
308 fclose( fp );
309 }
0 #***********************************************************************
1 #
2 # MPW build file for example GeoTIFF utilities
3 #
4 # written by Niles D. Ritter.
5 #
6 CC = c
7 AR = lib -o
8 RM = delete -y
9 LN = duplicate -y
10
11 #debug option
12 #DEBUG= -sym full
13 DEBUG=
14
15 # data/code model options
16 #MODEL=
17 MODEL= -model far
18
19 TIFFLIB = :::libtiff:
20 GEOTIFFLIB = ::
21 PORT = :::port:
22
23 LINK.c = Link {LDFLAGS}
24 .o Ä .c
25 {CC} {DEBUG} {CFLAGS} {CPPFLAGS} {Default}.c -o {Default}.o
26 LDFLAGS = {DEBUG} {MODEL} -c 'MPS ' -t MPST -w
27 CFLAGS = {MODEL}
28 CPPFLAGS = -I {TIFFLIB} -I {GEOTIFFLIB}
29 OBJS = makegeo.o listgeo.o geotifcp.o
30 CLEANOBJS = makegeo.o
31 CLEANOTHER = newtif.tif
32 CLEANINC =
33 LIBS = {TIFFLIB}libtiff.o ¶
34 {GEOTIFFLIB}libgeotiff.o ¶
35 "{CLibraries}"StdClib.o ¶
36 "{Libraries}"Stubs.o ¶
37 "{Libraries}"Runtime.o ¶
38 "{Libraries}"Interface.o
39
40 ALL = makegeo listgeo geotifcp
41
42 all Ä {ALL}
43
44 compile Ä {OBJS}
45
46 makegeo Ä makegeo.o {GEOTIFFLIB}libgeotiff.o
47 {LINK.c} -o makegeo makegeo.o {LIBS}
48
49 listgeo Ä listgeo.o {GEOTIFFLIB}libgeotiff.o
50 {LINK.c} -o listgeo listgeo.o {LIBS}
51
52 geotifcp Ä geotifcp.o {GEOTIFFLIB}libgeotiff.o {PORT}libport.o
53 {LINK.c} -o geotifcp geotifcp.o {LIBS} {PORT}libport.o
54
55 clean Ä
56 {RM} {ALL} {CLEANOBJS} {CLEANOTHER}
57
0 /*
1 * makegeo.c -- example client code for LIBGEO geographic
2 * TIFF tag support.
3 *
4 * Author: Niles D. Ritter
5 *
6 * Revision History:
7 * 31 October, 1995 Fixed reversed lat-long coordinates NDR
8 *
9 */
10
11 #include "geotiffio.h"
12 #include "xtiffio.h"
13 #include <stdlib.h>
14 #include <string.h>
15
16 void SetUpTIFFDirectory(TIFF *tif);
17 void SetUpGeoKeys(GTIF *gtif);
18 void WriteImage(TIFF *tif);
19
20 #define WIDTH 20L
21 #define HEIGHT 20L
22
23 int main()
24 {
25 char *fname = "newgeo.tif";
26 TIFF *tif=(TIFF*)0; /* TIFF-level descriptor */
27 GTIF *gtif=(GTIF*)0; /* GeoKey-level descriptor */
28
29 tif=XTIFFOpen(fname,"w");
30 if (!tif) goto failure;
31
32 gtif = GTIFNew(tif);
33 if (!gtif)
34 {
35 printf("failed in GTIFNew\n");
36 goto failure;
37 }
38
39 SetUpTIFFDirectory(tif);
40 SetUpGeoKeys(gtif);
41 WriteImage(tif);
42
43 GTIFWriteKeys(gtif);
44 GTIFFree(gtif);
45 XTIFFClose(tif);
46 return 0;
47
48 failure:
49 printf("failure in makegeo\n");
50 if (tif) TIFFClose(tif);
51 if (gtif) GTIFFree(gtif);
52 return -1;
53 }
54
55
56 void SetUpTIFFDirectory(TIFF *tif)
57 {
58 double tiepoints[6]={0,0,0,130.0,32.0,0.0};
59 double pixscale[3]={1,1,0};
60
61 TIFFSetField(tif,TIFFTAG_IMAGEWIDTH, WIDTH);
62 TIFFSetField(tif,TIFFTAG_IMAGELENGTH, HEIGHT);
63 TIFFSetField(tif,TIFFTAG_COMPRESSION, COMPRESSION_NONE);
64 TIFFSetField(tif,TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
65 TIFFSetField(tif,TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
66 TIFFSetField(tif,TIFFTAG_BITSPERSAMPLE, 8);
67 TIFFSetField(tif,TIFFTAG_ROWSPERSTRIP, 20L);
68
69 TIFFSetField(tif,TIFFTAG_GEOTIEPOINTS, 6,tiepoints);
70 TIFFSetField(tif,TIFFTAG_GEOPIXELSCALE, 3,pixscale);
71 }
72
73 void SetUpGeoKeys(GTIF *gtif)
74 {
75 GTIFKeySet(gtif, GTModelTypeGeoKey, TYPE_SHORT, 1, ModelGeographic);
76 GTIFKeySet(gtif, GTRasterTypeGeoKey, TYPE_SHORT, 1, RasterPixelIsArea);
77 GTIFKeySet(gtif, GTCitationGeoKey, TYPE_ASCII, 0, "Just An Example");
78 GTIFKeySet(gtif, GeographicTypeGeoKey, TYPE_SHORT, 1, KvUserDefined);
79 GTIFKeySet(gtif, GeogCitationGeoKey, TYPE_ASCII, 0, "Everest Ellipsoid Used.");
80 GTIFKeySet(gtif, GeogAngularUnitsGeoKey, TYPE_SHORT, 1, Angular_Degree);
81 GTIFKeySet(gtif, GeogLinearUnitsGeoKey, TYPE_SHORT, 1, Linear_Meter);
82 GTIFKeySet(gtif, GeogGeodeticDatumGeoKey, TYPE_SHORT, 1, KvUserDefined);
83 GTIFKeySet(gtif, GeogEllipsoidGeoKey, TYPE_SHORT, 1, Ellipse_Everest_1830_1967_Definition);
84 GTIFKeySet(gtif, GeogSemiMajorAxisGeoKey, TYPE_DOUBLE, 1, (double)6377298.556);
85 GTIFKeySet(gtif, GeogInvFlatteningGeoKey, TYPE_DOUBLE, 1, (double)300.8017);
86 }
87
88 void WriteImage(TIFF *tif)
89 {
90 int i;
91 char buffer[WIDTH];
92
93 memset(buffer,0,(size_t)WIDTH);
94 for (i=0;i<HEIGHT;i++)
95 if (!TIFFWriteScanline(tif, buffer, i, 0))
96 TIFFError("WriteImage","failure in WriteScanline\n");
97 }
98
99
100
101
0 #! /bin/sh
1 # Attempt to guess a canonical system name.
2 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
4 # Inc.
5
6 timestamp='2007-07-22'
7
8 # This file is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
21 # 02110-1301, USA.
22 #
23 # As a special exception to the GNU General Public License, if you
24 # distribute this file as part of a program that contains a
25 # configuration script generated by Autoconf, you may include it under
26 # the same distribution terms that you use for the rest of that program.
27
28
29 # Originally written by Per Bothner <per@bothner.com>.
30 # Please send patches to <config-patches@gnu.org>. Submit a context
31 # diff and a properly formatted ChangeLog entry.
32 #
33 # This script attempts to guess a canonical system name similar to
34 # config.sub. If it succeeds, it prints the system name on stdout, and
35 # exits with 0. Otherwise, it exits with 1.
36 #
37 # The plan is that this can be called by configure scripts if you
38 # don't specify an explicit build system type.
39
40 me=`echo "$0" | sed -e 's,.*/,,'`
41
42 usage="\
43 Usage: $0 [OPTION]
44
45 Output the configuration name of the system \`$me' is run on.
46
47 Operation modes:
48 -h, --help print this help, then exit
49 -t, --time-stamp print date of last modification, then exit
50 -v, --version print version number, then exit
51
52 Report bugs and patches to <config-patches@gnu.org>."
53
54 version="\
55 GNU config.guess ($timestamp)
56
57 Originally written by Per Bothner.
58 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
59 Free Software Foundation, Inc.
60
61 This is free software; see the source for copying conditions. There is NO
62 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
63
64 help="
65 Try \`$me --help' for more information."
66
67 # Parse command line
68 while test $# -gt 0 ; do
69 case $1 in
70 --time-stamp | --time* | -t )
71 echo "$timestamp" ; exit ;;
72 --version | -v )
73 echo "$version" ; exit ;;
74 --help | --h* | -h )
75 echo "$usage"; exit ;;
76 -- ) # Stop option processing
77 shift; break ;;
78 - ) # Use stdin as input.
79 break ;;
80 -* )
81 echo "$me: invalid option $1$help" >&2
82 exit 1 ;;
83 * )
84 break ;;
85 esac
86 done
87
88 if test $# != 0; then
89 echo "$me: too many arguments$help" >&2
90 exit 1
91 fi
92
93 trap 'exit 1' 1 2 15
94
95 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a
96 # compiler to aid in system detection is discouraged as it requires
97 # temporary files to be created and, as you can see below, it is a
98 # headache to deal with in a portable fashion.
99
100 # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
101 # use `HOST_CC' if defined, but it is deprecated.
102
103 # Portable tmp directory creation inspired by the Autoconf team.
104
105 set_cc_for_build='
106 trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
107 trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
108 : ${TMPDIR=/tmp} ;
109 { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
110 { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
111 { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
112 { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
113 dummy=$tmp/dummy ;
114 tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
115 case $CC_FOR_BUILD,$HOST_CC,$CC in
116 ,,) echo "int x;" > $dummy.c ;
117 for c in cc gcc c89 c99 ; do
118 if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
119 CC_FOR_BUILD="$c"; break ;
120 fi ;
121 done ;
122 if test x"$CC_FOR_BUILD" = x ; then
123 CC_FOR_BUILD=no_compiler_found ;
124 fi
125 ;;
126 ,,*) CC_FOR_BUILD=$CC ;;
127 ,*,*) CC_FOR_BUILD=$HOST_CC ;;
128 esac ; set_cc_for_build= ;'
129
130 # This is needed to find uname on a Pyramid OSx when run in the BSD universe.
131 # (ghazi@noc.rutgers.edu 1994-08-24)
132 if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
133 PATH=$PATH:/.attbin ; export PATH
134 fi
135
136 UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
137 UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
138 UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
139 UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
140
141 # Note: order is significant - the case branches are not exclusive.
142
143 case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
144 *:NetBSD:*:*)
145 # NetBSD (nbsd) targets should (where applicable) match one or
146 # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
147 # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
148 # switched to ELF, *-*-netbsd* would select the old
149 # object file format. This provides both forward
150 # compatibility and a consistent mechanism for selecting the
151 # object file format.
152 #
153 # Note: NetBSD doesn't particularly care about the vendor
154 # portion of the name. We always set it to "unknown".
155 sysctl="sysctl -n hw.machine_arch"
156 UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
157 /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
158 case "${UNAME_MACHINE_ARCH}" in
159 armeb) machine=armeb-unknown ;;
160 arm*) machine=arm-unknown ;;
161 sh3el) machine=shl-unknown ;;
162 sh3eb) machine=sh-unknown ;;
163 sh5el) machine=sh5le-unknown ;;
164 *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
165 esac
166 # The Operating System including object format, if it has switched
167 # to ELF recently, or will in the future.
168 case "${UNAME_MACHINE_ARCH}" in
169 arm*|i386|m68k|ns32k|sh3*|sparc|vax)
170 eval $set_cc_for_build
171 if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
172 | grep __ELF__ >/dev/null
173 then
174 # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
175 # Return netbsd for either. FIX?
176 os=netbsd
177 else
178 os=netbsdelf
179 fi
180 ;;
181 *)
182 os=netbsd
183 ;;
184 esac
185 # The OS release
186 # Debian GNU/NetBSD machines have a different userland, and
187 # thus, need a distinct triplet. However, they do not need
188 # kernel version information, so it can be replaced with a
189 # suitable tag, in the style of linux-gnu.
190 case "${UNAME_VERSION}" in
191 Debian*)
192 release='-gnu'
193 ;;
194 *)
195 release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
196 ;;
197 esac
198 # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
199 # contains redundant information, the shorter form:
200 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
201 echo "${machine}-${os}${release}"
202 exit ;;
203 *:OpenBSD:*:*)
204 UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
205 echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
206 exit ;;
207 *:ekkoBSD:*:*)
208 echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
209 exit ;;
210 *:SolidBSD:*:*)
211 echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
212 exit ;;
213 macppc:MirBSD:*:*)
214 echo powerpc-unknown-mirbsd${UNAME_RELEASE}
215 exit ;;
216 *:MirBSD:*:*)
217 echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
218 exit ;;
219 alpha:OSF1:*:*)
220 case $UNAME_RELEASE in
221 *4.0)
222 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
223 ;;
224 *5.*)
225 UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
226 ;;
227 esac
228 # According to Compaq, /usr/sbin/psrinfo has been available on
229 # OSF/1 and Tru64 systems produced since 1995. I hope that
230 # covers most systems running today. This code pipes the CPU
231 # types through head -n 1, so we only detect the type of CPU 0.
232 ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
233 case "$ALPHA_CPU_TYPE" in
234 "EV4 (21064)")
235 UNAME_MACHINE="alpha" ;;
236 "EV4.5 (21064)")
237 UNAME_MACHINE="alpha" ;;
238 "LCA4 (21066/21068)")
239 UNAME_MACHINE="alpha" ;;
240 "EV5 (21164)")
241 UNAME_MACHINE="alphaev5" ;;
242 "EV5.6 (21164A)")
243 UNAME_MACHINE="alphaev56" ;;
244 "EV5.6 (21164PC)")
245 UNAME_MACHINE="alphapca56" ;;
246 "EV5.7 (21164PC)")
247 UNAME_MACHINE="alphapca57" ;;
248 "EV6 (21264)")
249 UNAME_MACHINE="alphaev6" ;;
250 "EV6.7 (21264A)")
251 UNAME_MACHINE="alphaev67" ;;
252 "EV6.8CB (21264C)")
253 UNAME_MACHINE="alphaev68" ;;
254 "EV6.8AL (21264B)")
255 UNAME_MACHINE="alphaev68" ;;
256 "EV6.8CX (21264D)")
257 UNAME_MACHINE="alphaev68" ;;
258 "EV6.9A (21264/EV69A)")
259 UNAME_MACHINE="alphaev69" ;;
260 "EV7 (21364)")
261 UNAME_MACHINE="alphaev7" ;;
262 "EV7.9 (21364A)")
263 UNAME_MACHINE="alphaev79" ;;
264 esac
265 # A Pn.n version is a patched version.
266 # A Vn.n version is a released version.
267 # A Tn.n version is a released field test version.
268 # A Xn.n version is an unreleased experimental baselevel.
269 # 1.2 uses "1.2" for uname -r.
270 echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
271 exit ;;
272 Alpha\ *:Windows_NT*:*)
273 # How do we know it's Interix rather than the generic POSIX subsystem?
274 # Should we change UNAME_MACHINE based on the output of uname instead
275 # of the specific Alpha model?
276 echo alpha-pc-interix
277 exit ;;
278 21064:Windows_NT:50:3)
279 echo alpha-dec-winnt3.5
280 exit ;;
281 Amiga*:UNIX_System_V:4.0:*)
282 echo m68k-unknown-sysv4
283 exit ;;
284 *:[Aa]miga[Oo][Ss]:*:*)
285 echo ${UNAME_MACHINE}-unknown-amigaos
286 exit ;;
287 *:[Mm]orph[Oo][Ss]:*:*)
288 echo ${UNAME_MACHINE}-unknown-morphos
289 exit ;;
290 *:OS/390:*:*)
291 echo i370-ibm-openedition
292 exit ;;
293 *:z/VM:*:*)
294 echo s390-ibm-zvmoe
295 exit ;;
296 *:OS400:*:*)
297 echo powerpc-ibm-os400
298 exit ;;
299 arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
300 echo arm-acorn-riscix${UNAME_RELEASE}
301 exit ;;
302 arm:riscos:*:*|arm:RISCOS:*:*)
303 echo arm-unknown-riscos
304 exit ;;
305 SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
306 echo hppa1.1-hitachi-hiuxmpp
307 exit ;;
308 Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
309 # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
310 if test "`(/bin/universe) 2>/dev/null`" = att ; then
311 echo pyramid-pyramid-sysv3
312 else
313 echo pyramid-pyramid-bsd
314 fi
315 exit ;;
316 NILE*:*:*:dcosx)
317 echo pyramid-pyramid-svr4
318 exit ;;
319 DRS?6000:unix:4.0:6*)
320 echo sparc-icl-nx6
321 exit ;;
322 DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
323 case `/usr/bin/uname -p` in
324 sparc) echo sparc-icl-nx7; exit ;;
325 esac ;;
326 sun4H:SunOS:5.*:*)
327 echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
328 exit ;;
329 sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
330 echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
331 exit ;;
332 i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
333 echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
334 exit ;;
335 sun4*:SunOS:6*:*)
336 # According to config.sub, this is the proper way to canonicalize
337 # SunOS6. Hard to guess exactly what SunOS6 will be like, but
338 # it's likely to be more like Solaris than SunOS4.
339 echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
340 exit ;;
341 sun4*:SunOS:*:*)
342 case "`/usr/bin/arch -k`" in
343 Series*|S4*)
344 UNAME_RELEASE=`uname -v`
345 ;;
346 esac
347 # Japanese Language versions have a version number like `4.1.3-JL'.
348 echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
349 exit ;;
350 sun3*:SunOS:*:*)
351 echo m68k-sun-sunos${UNAME_RELEASE}
352 exit ;;
353 sun*:*:4.2BSD:*)
354 UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
355 test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
356 case "`/bin/arch`" in
357 sun3)
358 echo m68k-sun-sunos${UNAME_RELEASE}
359 ;;
360 sun4)
361 echo sparc-sun-sunos${UNAME_RELEASE}
362 ;;
363 esac
364 exit ;;
365 aushp:SunOS:*:*)
366 echo sparc-auspex-sunos${UNAME_RELEASE}
367 exit ;;
368 # The situation for MiNT is a little confusing. The machine name
369 # can be virtually everything (everything which is not
370 # "atarist" or "atariste" at least should have a processor
371 # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
372 # to the lowercase version "mint" (or "freemint"). Finally
373 # the system name "TOS" denotes a system which is actually not
374 # MiNT. But MiNT is downward compatible to TOS, so this should
375 # be no problem.
376 atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
377 echo m68k-atari-mint${UNAME_RELEASE}
378 exit ;;
379 atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
380 echo m68k-atari-mint${UNAME_RELEASE}
381 exit ;;
382 *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
383 echo m68k-atari-mint${UNAME_RELEASE}
384 exit ;;
385 milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
386 echo m68k-milan-mint${UNAME_RELEASE}
387 exit ;;
388 hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
389 echo m68k-hades-mint${UNAME_RELEASE}
390 exit ;;
391 *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
392 echo m68k-unknown-mint${UNAME_RELEASE}
393 exit ;;
394 m68k:machten:*:*)
395 echo m68k-apple-machten${UNAME_RELEASE}
396 exit ;;
397 powerpc:machten:*:*)
398 echo powerpc-apple-machten${UNAME_RELEASE}
399 exit ;;
400 RISC*:Mach:*:*)
401 echo mips-dec-mach_bsd4.3
402 exit ;;
403 RISC*:ULTRIX:*:*)
404 echo mips-dec-ultrix${UNAME_RELEASE}
405 exit ;;
406 VAX*:ULTRIX*:*:*)
407 echo vax-dec-ultrix${UNAME_RELEASE}
408 exit ;;
409 2020:CLIX:*:* | 2430:CLIX:*:*)
410 echo clipper-intergraph-clix${UNAME_RELEASE}
411 exit ;;
412 mips:*:*:UMIPS | mips:*:*:RISCos)
413 eval $set_cc_for_build
414 sed 's/^ //' << EOF >$dummy.c
415 #ifdef __cplusplus
416 #include <stdio.h> /* for printf() prototype */
417 int main (int argc, char *argv[]) {
418 #else
419 int main (argc, argv) int argc; char *argv[]; {
420 #endif
421 #if defined (host_mips) && defined (MIPSEB)
422 #if defined (SYSTYPE_SYSV)
423 printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
424 #endif
425 #if defined (SYSTYPE_SVR4)
426 printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
427 #endif
428 #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
429 printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
430 #endif
431 #endif
432 exit (-1);
433 }
434 EOF
435 $CC_FOR_BUILD -o $dummy $dummy.c &&
436 dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
437 SYSTEM_NAME=`$dummy $dummyarg` &&
438 { echo "$SYSTEM_NAME"; exit; }
439 echo mips-mips-riscos${UNAME_RELEASE}
440 exit ;;
441 Motorola:PowerMAX_OS:*:*)
442 echo powerpc-motorola-powermax
443 exit ;;
444 Motorola:*:4.3:PL8-*)
445 echo powerpc-harris-powermax
446 exit ;;
447 Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
448 echo powerpc-harris-powermax
449 exit ;;
450 Night_Hawk:Power_UNIX:*:*)
451 echo powerpc-harris-powerunix
452 exit ;;
453 m88k:CX/UX:7*:*)
454 echo m88k-harris-cxux7
455 exit ;;
456 m88k:*:4*:R4*)
457 echo m88k-motorola-sysv4
458 exit ;;
459 m88k:*:3*:R3*)
460 echo m88k-motorola-sysv3
461 exit ;;
462 AViiON:dgux:*:*)
463 # DG/UX returns AViiON for all architectures
464 UNAME_PROCESSOR=`/usr/bin/uname -p`
465 if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
466 then
467 if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
468 [ ${TARGET_BINARY_INTERFACE}x = x ]
469 then
470 echo m88k-dg-dgux${UNAME_RELEASE}
471 else
472 echo m88k-dg-dguxbcs${UNAME_RELEASE}
473 fi
474 else
475 echo i586-dg-dgux${UNAME_RELEASE}
476 fi
477 exit ;;
478 M88*:DolphinOS:*:*) # DolphinOS (SVR3)
479 echo m88k-dolphin-sysv3
480 exit ;;
481 M88*:*:R3*:*)
482 # Delta 88k system running SVR3
483 echo m88k-motorola-sysv3
484 exit ;;
485 XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
486 echo m88k-tektronix-sysv3
487 exit ;;
488 Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
489 echo m68k-tektronix-bsd
490 exit ;;
491 *:IRIX*:*:*)
492 echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
493 exit ;;
494 ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
495 echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
496 exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
497 i*86:AIX:*:*)
498 echo i386-ibm-aix
499 exit ;;
500 ia64:AIX:*:*)
501 if [ -x /usr/bin/oslevel ] ; then
502 IBM_REV=`/usr/bin/oslevel`
503 else
504 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
505 fi
506 echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
507 exit ;;
508 *:AIX:2:3)
509 if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
510 eval $set_cc_for_build
511 sed 's/^ //' << EOF >$dummy.c
512 #include <sys/systemcfg.h>
513
514 main()
515 {
516 if (!__power_pc())
517 exit(1);
518 puts("powerpc-ibm-aix3.2.5");
519 exit(0);
520 }
521 EOF
522 if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
523 then
524 echo "$SYSTEM_NAME"
525 else
526 echo rs6000-ibm-aix3.2.5
527 fi
528 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
529 echo rs6000-ibm-aix3.2.4
530 else
531 echo rs6000-ibm-aix3.2
532 fi
533 exit ;;
534 *:AIX:*:[45])
535 IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
536 if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
537 IBM_ARCH=rs6000
538 else
539 IBM_ARCH=powerpc
540 fi
541 if [ -x /usr/bin/oslevel ] ; then
542 IBM_REV=`/usr/bin/oslevel`
543 else
544 IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
545 fi
546 echo ${IBM_ARCH}-ibm-aix${IBM_REV}
547 exit ;;
548 *:AIX:*:*)
549 echo rs6000-ibm-aix
550 exit ;;
551 ibmrt:4.4BSD:*|romp-ibm:BSD:*)
552 echo romp-ibm-bsd4.4
553 exit ;;
554 ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
555 echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
556 exit ;; # report: romp-ibm BSD 4.3
557 *:BOSX:*:*)
558 echo rs6000-bull-bosx
559 exit ;;
560 DPX/2?00:B.O.S.:*:*)
561 echo m68k-bull-sysv3
562 exit ;;
563 9000/[34]??:4.3bsd:1.*:*)
564 echo m68k-hp-bsd
565 exit ;;
566 hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
567 echo m68k-hp-bsd4.4
568 exit ;;
569 9000/[34678]??:HP-UX:*:*)
570 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
571 case "${UNAME_MACHINE}" in
572 9000/31? ) HP_ARCH=m68000 ;;
573 9000/[34]?? ) HP_ARCH=m68k ;;
574 9000/[678][0-9][0-9])
575 if [ -x /usr/bin/getconf ]; then
576 sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
577 sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
578 case "${sc_cpu_version}" in
579 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
580 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
581 532) # CPU_PA_RISC2_0
582 case "${sc_kernel_bits}" in
583 32) HP_ARCH="hppa2.0n" ;;
584 64) HP_ARCH="hppa2.0w" ;;
585 '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
586 esac ;;
587 esac
588 fi
589 if [ "${HP_ARCH}" = "" ]; then
590 eval $set_cc_for_build
591 sed 's/^ //' << EOF >$dummy.c
592
593 #define _HPUX_SOURCE
594 #include <stdlib.h>
595 #include <unistd.h>
596
597 int main ()
598 {
599 #if defined(_SC_KERNEL_BITS)
600 long bits = sysconf(_SC_KERNEL_BITS);
601 #endif
602 long cpu = sysconf (_SC_CPU_VERSION);
603
604 switch (cpu)
605 {
606 case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
607 case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
608 case CPU_PA_RISC2_0:
609 #if defined(_SC_KERNEL_BITS)
610 switch (bits)
611 {
612 case 64: puts ("hppa2.0w"); break;
613 case 32: puts ("hppa2.0n"); break;
614 default: puts ("hppa2.0"); break;
615 } break;
616 #else /* !defined(_SC_KERNEL_BITS) */
617 puts ("hppa2.0"); break;
618 #endif
619 default: puts ("hppa1.0"); break;
620 }
621 exit (0);
622 }
623 EOF
624 (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
625 test -z "$HP_ARCH" && HP_ARCH=hppa
626 fi ;;
627 esac
628 if [ ${HP_ARCH} = "hppa2.0w" ]
629 then
630 eval $set_cc_for_build
631
632 # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
633 # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
634 # generating 64-bit code. GNU and HP use different nomenclature:
635 #
636 # $ CC_FOR_BUILD=cc ./config.guess
637 # => hppa2.0w-hp-hpux11.23
638 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
639 # => hppa64-hp-hpux11.23
640
641 if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
642 grep __LP64__ >/dev/null
643 then
644 HP_ARCH="hppa2.0w"
645 else
646 HP_ARCH="hppa64"
647 fi
648 fi
649 echo ${HP_ARCH}-hp-hpux${HPUX_REV}
650 exit ;;
651 ia64:HP-UX:*:*)
652 HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
653 echo ia64-hp-hpux${HPUX_REV}
654 exit ;;
655 3050*:HI-UX:*:*)
656 eval $set_cc_for_build
657 sed 's/^ //' << EOF >$dummy.c
658 #include <unistd.h>
659 int
660 main ()
661 {
662 long cpu = sysconf (_SC_CPU_VERSION);
663 /* The order matters, because CPU_IS_HP_MC68K erroneously returns
664 true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
665 results, however. */
666 if (CPU_IS_PA_RISC (cpu))
667 {
668 switch (cpu)
669 {
670 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
671 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
672 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
673 default: puts ("hppa-hitachi-hiuxwe2"); break;
674 }
675 }
676 else if (CPU_IS_HP_MC68K (cpu))
677 puts ("m68k-hitachi-hiuxwe2");
678 else puts ("unknown-hitachi-hiuxwe2");
679 exit (0);
680 }
681 EOF
682 $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
683 { echo "$SYSTEM_NAME"; exit; }
684 echo unknown-hitachi-hiuxwe2
685 exit ;;
686 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
687 echo hppa1.1-hp-bsd
688 exit ;;
689 9000/8??:4.3bsd:*:*)
690 echo hppa1.0-hp-bsd
691 exit ;;
692 *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
693 echo hppa1.0-hp-mpeix
694 exit ;;
695 hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
696 echo hppa1.1-hp-osf
697 exit ;;
698 hp8??:OSF1:*:*)
699 echo hppa1.0-hp-osf
700 exit ;;
701 i*86:OSF1:*:*)
702 if [ -x /usr/sbin/sysversion ] ; then
703 echo ${UNAME_MACHINE}-unknown-osf1mk
704 else
705 echo ${UNAME_MACHINE}-unknown-osf1
706 fi
707 exit ;;
708 parisc*:Lites*:*:*)
709 echo hppa1.1-hp-lites
710 exit ;;
711 C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
712 echo c1-convex-bsd
713 exit ;;
714 C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
715 if getsysinfo -f scalar_acc
716 then echo c32-convex-bsd
717 else echo c2-convex-bsd
718 fi
719 exit ;;
720 C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
721 echo c34-convex-bsd
722 exit ;;
723 C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
724 echo c38-convex-bsd
725 exit ;;
726 C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
727 echo c4-convex-bsd
728 exit ;;
729 CRAY*Y-MP:*:*:*)
730 echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
731 exit ;;
732 CRAY*[A-Z]90:*:*:*)
733 echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
734 | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
735 -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
736 -e 's/\.[^.]*$/.X/'
737 exit ;;
738 CRAY*TS:*:*:*)
739 echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
740 exit ;;
741 CRAY*T3E:*:*:*)
742 echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
743 exit ;;
744 CRAY*SV1:*:*:*)
745 echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
746 exit ;;
747 *:UNICOS/mp:*:*)
748 echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
749 exit ;;
750 F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
751 FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
752 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
753 FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
754 echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
755 exit ;;
756 5000:UNIX_System_V:4.*:*)
757 FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
758 FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
759 echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
760 exit ;;
761 i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
762 echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
763 exit ;;
764 sparc*:BSD/OS:*:*)
765 echo sparc-unknown-bsdi${UNAME_RELEASE}
766 exit ;;
767 *:BSD/OS:*:*)
768 echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
769 exit ;;
770 *:FreeBSD:*:*)
771 case ${UNAME_MACHINE} in
772 pc98)
773 echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
774 amd64)
775 echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
776 *)
777 echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
778 esac
779 exit ;;
780 i*:CYGWIN*:*)
781 echo ${UNAME_MACHINE}-pc-cygwin
782 exit ;;
783 *:MINGW*:*)
784 echo ${UNAME_MACHINE}-pc-mingw32
785 exit ;;
786 i*:windows32*:*)
787 # uname -m includes "-pc" on this system.
788 echo ${UNAME_MACHINE}-mingw32
789 exit ;;
790 i*:PW*:*)
791 echo ${UNAME_MACHINE}-pc-pw32
792 exit ;;
793 *:Interix*:[3456]*)
794 case ${UNAME_MACHINE} in
795 x86)
796 echo i586-pc-interix${UNAME_RELEASE}
797 exit ;;
798 EM64T | authenticamd)
799 echo x86_64-unknown-interix${UNAME_RELEASE}
800 exit ;;
801 esac ;;
802 [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
803 echo i${UNAME_MACHINE}-pc-mks
804 exit ;;
805 i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
806 # How do we know it's Interix rather than the generic POSIX subsystem?
807 # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
808 # UNAME_MACHINE based on the output of uname instead of i386?
809 echo i586-pc-interix
810 exit ;;
811 i*:UWIN*:*)
812 echo ${UNAME_MACHINE}-pc-uwin
813 exit ;;
814 amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
815 echo x86_64-unknown-cygwin
816 exit ;;
817 p*:CYGWIN*:*)
818 echo powerpcle-unknown-cygwin
819 exit ;;
820 prep*:SunOS:5.*:*)
821 echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
822 exit ;;
823 *:GNU:*:*)
824 # the GNU system
825 echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
826 exit ;;
827 *:GNU/*:*:*)
828 # other systems with GNU libc and userland
829 echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
830 exit ;;
831 i*86:Minix:*:*)
832 echo ${UNAME_MACHINE}-pc-minix
833 exit ;;
834 arm*:Linux:*:*)
835 echo ${UNAME_MACHINE}-unknown-linux-gnu
836 exit ;;
837 avr32*:Linux:*:*)
838 echo ${UNAME_MACHINE}-unknown-linux-gnu
839 exit ;;
840 cris:Linux:*:*)
841 echo cris-axis-linux-gnu
842 exit ;;
843 crisv32:Linux:*:*)
844 echo crisv32-axis-linux-gnu
845 exit ;;
846 frv:Linux:*:*)
847 echo frv-unknown-linux-gnu
848 exit ;;
849 ia64:Linux:*:*)
850 echo ${UNAME_MACHINE}-unknown-linux-gnu
851 exit ;;
852 m32r*:Linux:*:*)
853 echo ${UNAME_MACHINE}-unknown-linux-gnu
854 exit ;;
855 m68*:Linux:*:*)
856 echo ${UNAME_MACHINE}-unknown-linux-gnu
857 exit ;;
858 mips:Linux:*:*)
859 eval $set_cc_for_build
860 sed 's/^ //' << EOF >$dummy.c
861 #undef CPU
862 #undef mips
863 #undef mipsel
864 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
865 CPU=mipsel
866 #else
867 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
868 CPU=mips
869 #else
870 CPU=
871 #endif
872 #endif
873 EOF
874 eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
875 /^CPU/{
876 s: ::g
877 p
878 }'`"
879 test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
880 ;;
881 mips64:Linux:*:*)
882 eval $set_cc_for_build
883 sed 's/^ //' << EOF >$dummy.c
884 #undef CPU
885 #undef mips64
886 #undef mips64el
887 #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
888 CPU=mips64el
889 #else
890 #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
891 CPU=mips64
892 #else
893 CPU=
894 #endif
895 #endif
896 EOF
897 eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
898 /^CPU/{
899 s: ::g
900 p
901 }'`"
902 test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
903 ;;
904 or32:Linux:*:*)
905 echo or32-unknown-linux-gnu
906 exit ;;
907 ppc:Linux:*:*)
908 echo powerpc-unknown-linux-gnu
909 exit ;;
910 ppc64:Linux:*:*)
911 echo powerpc64-unknown-linux-gnu
912 exit ;;
913 alpha:Linux:*:*)
914 case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
915 EV5) UNAME_MACHINE=alphaev5 ;;
916 EV56) UNAME_MACHINE=alphaev56 ;;
917 PCA56) UNAME_MACHINE=alphapca56 ;;
918 PCA57) UNAME_MACHINE=alphapca56 ;;
919 EV6) UNAME_MACHINE=alphaev6 ;;
920 EV67) UNAME_MACHINE=alphaev67 ;;
921 EV68*) UNAME_MACHINE=alphaev68 ;;
922 esac
923 objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
924 if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
925 echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
926 exit ;;
927 parisc:Linux:*:* | hppa:Linux:*:*)
928 # Look for CPU level
929 case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
930 PA7*) echo hppa1.1-unknown-linux-gnu ;;
931 PA8*) echo hppa2.0-unknown-linux-gnu ;;
932 *) echo hppa-unknown-linux-gnu ;;
933 esac
934 exit ;;
935 parisc64:Linux:*:* | hppa64:Linux:*:*)
936 echo hppa64-unknown-linux-gnu
937 exit ;;
938 s390:Linux:*:* | s390x:Linux:*:*)
939 echo ${UNAME_MACHINE}-ibm-linux
940 exit ;;
941 sh64*:Linux:*:*)
942 echo ${UNAME_MACHINE}-unknown-linux-gnu
943 exit ;;
944 sh*:Linux:*:*)
945 echo ${UNAME_MACHINE}-unknown-linux-gnu
946 exit ;;
947 sparc:Linux:*:* | sparc64:Linux:*:*)
948 echo ${UNAME_MACHINE}-unknown-linux-gnu
949 exit ;;
950 vax:Linux:*:*)
951 echo ${UNAME_MACHINE}-dec-linux-gnu
952 exit ;;
953 x86_64:Linux:*:*)
954 echo x86_64-unknown-linux-gnu
955 exit ;;
956 xtensa:Linux:*:*)
957 echo xtensa-unknown-linux-gnu
958 exit ;;
959 i*86:Linux:*:*)
960 # The BFD linker knows what the default object file format is, so
961 # first see if it will tell us. cd to the root directory to prevent
962 # problems with other programs or directories called `ld' in the path.
963 # Set LC_ALL=C to ensure ld outputs messages in English.
964 ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
965 | sed -ne '/supported targets:/!d
966 s/[ ][ ]*/ /g
967 s/.*supported targets: *//
968 s/ .*//
969 p'`
970 case "$ld_supported_targets" in
971 elf32-i386)
972 TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
973 ;;
974 a.out-i386-linux)
975 echo "${UNAME_MACHINE}-pc-linux-gnuaout"
976 exit ;;
977 coff-i386)
978 echo "${UNAME_MACHINE}-pc-linux-gnucoff"
979 exit ;;
980 "")
981 # Either a pre-BFD a.out linker (linux-gnuoldld) or
982 # one that does not give us useful --help.
983 echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
984 exit ;;
985 esac
986 # Determine whether the default compiler is a.out or elf
987 eval $set_cc_for_build
988 sed 's/^ //' << EOF >$dummy.c
989 #include <features.h>
990 #ifdef __ELF__
991 # ifdef __GLIBC__
992 # if __GLIBC__ >= 2
993 LIBC=gnu
994 # else
995 LIBC=gnulibc1
996 # endif
997 # else
998 LIBC=gnulibc1
999 # endif
1000 #else
1001 #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
1002 LIBC=gnu
1003 #else
1004 LIBC=gnuaout
1005 #endif
1006 #endif
1007 #ifdef __dietlibc__
1008 LIBC=dietlibc
1009 #endif
1010 EOF
1011 eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
1012 /^LIBC/{
1013 s: ::g
1014 p
1015 }'`"
1016 test x"${LIBC}" != x && {
1017 echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
1018 exit
1019 }
1020 test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
1021 ;;
1022 i*86:DYNIX/ptx:4*:*)
1023 # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
1024 # earlier versions are messed up and put the nodename in both
1025 # sysname and nodename.
1026 echo i386-sequent-sysv4
1027 exit ;;
1028 i*86:UNIX_SV:4.2MP:2.*)
1029 # Unixware is an offshoot of SVR4, but it has its own version
1030 # number series starting with 2...
1031 # I am not positive that other SVR4 systems won't match this,
1032 # I just have to hope. -- rms.
1033 # Use sysv4.2uw... so that sysv4* matches it.
1034 echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
1035 exit ;;
1036 i*86:OS/2:*:*)
1037 # If we were able to find `uname', then EMX Unix compatibility
1038 # is probably installed.
1039 echo ${UNAME_MACHINE}-pc-os2-emx
1040 exit ;;
1041 i*86:XTS-300:*:STOP)
1042 echo ${UNAME_MACHINE}-unknown-stop
1043 exit ;;
1044 i*86:atheos:*:*)
1045 echo ${UNAME_MACHINE}-unknown-atheos
1046 exit ;;
1047 i*86:syllable:*:*)
1048 echo ${UNAME_MACHINE}-pc-syllable
1049 exit ;;
1050 i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
1051 echo i386-unknown-lynxos${UNAME_RELEASE}
1052 exit ;;
1053 i*86:*DOS:*:*)
1054 echo ${UNAME_MACHINE}-pc-msdosdjgpp
1055 exit ;;
1056 i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
1057 UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
1058 if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
1059 echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
1060 else
1061 echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
1062 fi
1063 exit ;;
1064 i*86:*:5:[678]*)
1065 # UnixWare 7.x, OpenUNIX and OpenServer 6.
1066 case `/bin/uname -X | grep "^Machine"` in
1067 *486*) UNAME_MACHINE=i486 ;;
1068 *Pentium) UNAME_MACHINE=i586 ;;
1069 *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
1070 esac
1071 echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
1072 exit ;;
1073 i*86:*:3.2:*)
1074 if test -f /usr/options/cb.name; then
1075 UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
1076 echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
1077 elif /bin/uname -X 2>/dev/null >/dev/null ; then
1078 UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
1079 (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
1080 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
1081 && UNAME_MACHINE=i586
1082 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
1083 && UNAME_MACHINE=i686
1084 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
1085 && UNAME_MACHINE=i686
1086 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
1087 else
1088 echo ${UNAME_MACHINE}-pc-sysv32
1089 fi
1090 exit ;;
1091 pc:*:*:*)
1092 # Left here for compatibility:
1093 # uname -m prints for DJGPP always 'pc', but it prints nothing about
1094 # the processor, so we play safe by assuming i386.
1095 echo i386-pc-msdosdjgpp
1096 exit ;;
1097 Intel:Mach:3*:*)
1098 echo i386-pc-mach3
1099 exit ;;
1100 paragon:*:*:*)
1101 echo i860-intel-osf1
1102 exit ;;
1103 i860:*:4.*:*) # i860-SVR4
1104 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
1105 echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
1106 else # Add other i860-SVR4 vendors below as they are discovered.
1107 echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
1108 fi
1109 exit ;;
1110 mini*:CTIX:SYS*5:*)
1111 # "miniframe"
1112 echo m68010-convergent-sysv
1113 exit ;;
1114 mc68k:UNIX:SYSTEM5:3.51m)
1115 echo m68k-convergent-sysv
1116 exit ;;
1117 M680?0:D-NIX:5.3:*)
1118 echo m68k-diab-dnix
1119 exit ;;
1120 M68*:*:R3V[5678]*:*)
1121 test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
1122 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)
1123 OS_REL=''
1124 test -r /etc/.relid \
1125 && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
1126 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1127 && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
1128 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
1129 && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
1130 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
1131 /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
1132 && { echo i486-ncr-sysv4; exit; } ;;
1133 m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
1134 echo m68k-unknown-lynxos${UNAME_RELEASE}
1135 exit ;;
1136 mc68030:UNIX_System_V:4.*:*)
1137 echo m68k-atari-sysv4
1138 exit ;;
1139 TSUNAMI:LynxOS:2.*:*)
1140 echo sparc-unknown-lynxos${UNAME_RELEASE}
1141 exit ;;
1142 rs6000:LynxOS:2.*:*)
1143 echo rs6000-unknown-lynxos${UNAME_RELEASE}
1144 exit ;;
1145 PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
1146 echo powerpc-unknown-lynxos${UNAME_RELEASE}
1147 exit ;;
1148 SM[BE]S:UNIX_SV:*:*)
1149 echo mips-dde-sysv${UNAME_RELEASE}
1150 exit ;;
1151 RM*:ReliantUNIX-*:*:*)
1152 echo mips-sni-sysv4
1153 exit ;;
1154 RM*:SINIX-*:*:*)
1155 echo mips-sni-sysv4
1156 exit ;;
1157 *:SINIX-*:*:*)
1158 if uname -p 2>/dev/null >/dev/null ; then
1159 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1160 echo ${UNAME_MACHINE}-sni-sysv4
1161 else
1162 echo ns32k-sni-sysv
1163 fi
1164 exit ;;
1165 PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
1166 # says <Richard.M.Bartel@ccMail.Census.GOV>
1167 echo i586-unisys-sysv4
1168 exit ;;
1169 *:UNIX_System_V:4*:FTX*)
1170 # From Gerald Hewes <hewes@openmarket.com>.
1171 # How about differentiating between stratus architectures? -djm
1172 echo hppa1.1-stratus-sysv4
1173 exit ;;
1174 *:*:*:FTX*)
1175 # From seanf@swdc.stratus.com.
1176 echo i860-stratus-sysv4
1177 exit ;;
1178 i*86:VOS:*:*)
1179 # From Paul.Green@stratus.com.
1180 echo ${UNAME_MACHINE}-stratus-vos
1181 exit ;;
1182 *:VOS:*:*)
1183 # From Paul.Green@stratus.com.
1184 echo hppa1.1-stratus-vos
1185 exit ;;
1186 mc68*:A/UX:*:*)
1187 echo m68k-apple-aux${UNAME_RELEASE}
1188 exit ;;
1189 news*:NEWS-OS:6*:*)
1190 echo mips-sony-newsos6
1191 exit ;;
1192 R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
1193 if [ -d /usr/nec ]; then
1194 echo mips-nec-sysv${UNAME_RELEASE}
1195 else
1196 echo mips-unknown-sysv${UNAME_RELEASE}
1197 fi
1198 exit ;;
1199 BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
1200 echo powerpc-be-beos
1201 exit ;;
1202 BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
1203 echo powerpc-apple-beos
1204 exit ;;
1205 BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
1206 echo i586-pc-beos
1207 exit ;;
1208 SX-4:SUPER-UX:*:*)
1209 echo sx4-nec-superux${UNAME_RELEASE}
1210 exit ;;
1211 SX-5:SUPER-UX:*:*)
1212 echo sx5-nec-superux${UNAME_RELEASE}
1213 exit ;;
1214 SX-6:SUPER-UX:*:*)
1215 echo sx6-nec-superux${UNAME_RELEASE}
1216 exit ;;
1217 SX-7:SUPER-UX:*:*)
1218 echo sx7-nec-superux${UNAME_RELEASE}
1219 exit ;;
1220 SX-8:SUPER-UX:*:*)
1221 echo sx8-nec-superux${UNAME_RELEASE}
1222 exit ;;
1223 SX-8R:SUPER-UX:*:*)
1224 echo sx8r-nec-superux${UNAME_RELEASE}
1225 exit ;;
1226 Power*:Rhapsody:*:*)
1227 echo powerpc-apple-rhapsody${UNAME_RELEASE}
1228 exit ;;
1229 *:Rhapsody:*:*)
1230 echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
1231 exit ;;
1232 *:Darwin:*:*)
1233 UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
1234 case $UNAME_PROCESSOR in
1235 unknown) UNAME_PROCESSOR=powerpc ;;
1236 esac
1237 echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
1238 exit ;;
1239 *:procnto*:*:* | *:QNX:[0123456789]*:*)
1240 UNAME_PROCESSOR=`uname -p`
1241 if test "$UNAME_PROCESSOR" = "x86"; then
1242 UNAME_PROCESSOR=i386
1243 UNAME_MACHINE=pc
1244 fi
1245 echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
1246 exit ;;
1247 *:QNX:*:4*)
1248 echo i386-pc-qnx
1249 exit ;;
1250 NSE-?:NONSTOP_KERNEL:*:*)
1251 echo nse-tandem-nsk${UNAME_RELEASE}
1252 exit ;;
1253 NSR-?:NONSTOP_KERNEL:*:*)
1254 echo nsr-tandem-nsk${UNAME_RELEASE}
1255 exit ;;
1256 *:NonStop-UX:*:*)
1257 echo mips-compaq-nonstopux
1258 exit ;;
1259 BS2000:POSIX*:*:*)
1260 echo bs2000-siemens-sysv
1261 exit ;;
1262 DS/*:UNIX_System_V:*:*)
1263 echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
1264 exit ;;
1265 *:Plan9:*:*)
1266 # "uname -m" is not consistent, so use $cputype instead. 386
1267 # is converted to i386 for consistency with other x86
1268 # operating systems.
1269 if test "$cputype" = "386"; then
1270 UNAME_MACHINE=i386
1271 else
1272 UNAME_MACHINE="$cputype"
1273 fi
1274 echo ${UNAME_MACHINE}-unknown-plan9
1275 exit ;;
1276 *:TOPS-10:*:*)
1277 echo pdp10-unknown-tops10
1278 exit ;;
1279 *:TENEX:*:*)
1280 echo pdp10-unknown-tenex
1281 exit ;;
1282 KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
1283 echo pdp10-dec-tops20
1284 exit ;;
1285 XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
1286 echo pdp10-xkl-tops20
1287 exit ;;
1288 *:TOPS-20:*:*)
1289 echo pdp10-unknown-tops20
1290 exit ;;
1291 *:ITS:*:*)
1292 echo pdp10-unknown-its
1293 exit ;;
1294 SEI:*:*:SEIUX)
1295 echo mips-sei-seiux${UNAME_RELEASE}
1296 exit ;;
1297 *:DragonFly:*:*)
1298 echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
1299 exit ;;
1300 *:*VMS:*:*)
1301 UNAME_MACHINE=`(uname -p) 2>/dev/null`
1302 case "${UNAME_MACHINE}" in
1303 A*) echo alpha-dec-vms ; exit ;;
1304 I*) echo ia64-dec-vms ; exit ;;
1305 V*) echo vax-dec-vms ; exit ;;
1306 esac ;;
1307 *:XENIX:*:SysV)
1308 echo i386-pc-xenix
1309 exit ;;
1310 i*86:skyos:*:*)
1311 echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
1312 exit ;;
1313 i*86:rdos:*:*)
1314 echo ${UNAME_MACHINE}-pc-rdos
1315 exit ;;
1316 esac
1317
1318 #echo '(No uname command or uname output not recognized.)' 1>&2
1319 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
1320
1321 eval $set_cc_for_build
1322 cat >$dummy.c <<EOF
1323 #ifdef _SEQUENT_
1324 # include <sys/types.h>
1325 # include <sys/utsname.h>
1326 #endif
1327 main ()
1328 {
1329 #if defined (sony)
1330 #if defined (MIPSEB)
1331 /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
1332 I don't know.... */
1333 printf ("mips-sony-bsd\n"); exit (0);
1334 #else
1335 #include <sys/param.h>
1336 printf ("m68k-sony-newsos%s\n",
1337 #ifdef NEWSOS4
1338 "4"
1339 #else
1340 ""
1341 #endif
1342 ); exit (0);
1343 #endif
1344 #endif
1345
1346 #if defined (__arm) && defined (__acorn) && defined (__unix)
1347 printf ("arm-acorn-riscix\n"); exit (0);
1348 #endif
1349
1350 #if defined (hp300) && !defined (hpux)
1351 printf ("m68k-hp-bsd\n"); exit (0);
1352 #endif
1353
1354 #if defined (NeXT)
1355 #if !defined (__ARCHITECTURE__)
1356 #define __ARCHITECTURE__ "m68k"
1357 #endif
1358 int version;
1359 version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
1360 if (version < 4)
1361 printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
1362 else
1363 printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
1364 exit (0);
1365 #endif
1366
1367 #if defined (MULTIMAX) || defined (n16)
1368 #if defined (UMAXV)
1369 printf ("ns32k-encore-sysv\n"); exit (0);
1370 #else
1371 #if defined (CMU)
1372 printf ("ns32k-encore-mach\n"); exit (0);
1373 #else
1374 printf ("ns32k-encore-bsd\n"); exit (0);
1375 #endif
1376 #endif
1377 #endif
1378
1379 #if defined (__386BSD__)
1380 printf ("i386-pc-bsd\n"); exit (0);
1381 #endif
1382
1383 #if defined (sequent)
1384 #if defined (i386)
1385 printf ("i386-sequent-dynix\n"); exit (0);
1386 #endif
1387 #if defined (ns32000)
1388 printf ("ns32k-sequent-dynix\n"); exit (0);
1389 #endif
1390 #endif
1391
1392 #if defined (_SEQUENT_)
1393 struct utsname un;
1394
1395 uname(&un);
1396
1397 if (strncmp(un.version, "V2", 2) == 0) {
1398 printf ("i386-sequent-ptx2\n"); exit (0);
1399 }
1400 if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
1401 printf ("i386-sequent-ptx1\n"); exit (0);
1402 }
1403 printf ("i386-sequent-ptx\n"); exit (0);
1404
1405 #endif
1406
1407 #if defined (vax)
1408 # if !defined (ultrix)
1409 # include <sys/param.h>
1410 # if defined (BSD)
1411 # if BSD == 43
1412 printf ("vax-dec-bsd4.3\n"); exit (0);
1413 # else
1414 # if BSD == 199006
1415 printf ("vax-dec-bsd4.3reno\n"); exit (0);
1416 # else
1417 printf ("vax-dec-bsd\n"); exit (0);
1418 # endif
1419 # endif
1420 # else
1421 printf ("vax-dec-bsd\n"); exit (0);
1422 # endif
1423 # else
1424 printf ("vax-dec-ultrix\n"); exit (0);
1425 # endif
1426 #endif
1427
1428 #if defined (alliant) && defined (i860)
1429 printf ("i860-alliant-bsd\n"); exit (0);
1430 #endif
1431
1432 exit (1);
1433 }
1434 EOF
1435
1436 $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
1437 { echo "$SYSTEM_NAME"; exit; }
1438
1439 # Apollos put the system type in the environment.
1440
1441 test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
1442
1443 # Convex versions that predate uname can use getsysinfo(1)
1444
1445 if [ -x /usr/convex/getsysinfo ]
1446 then
1447 case `getsysinfo -f cpu_type` in
1448 c1*)
1449 echo c1-convex-bsd
1450 exit ;;
1451 c2*)
1452 if getsysinfo -f scalar_acc
1453 then echo c32-convex-bsd
1454 else echo c2-convex-bsd
1455 fi
1456 exit ;;
1457 c34*)
1458 echo c34-convex-bsd
1459 exit ;;
1460 c38*)
1461 echo c38-convex-bsd
1462 exit ;;
1463 c4*)
1464 echo c4-convex-bsd
1465 exit ;;
1466 esac
1467 fi
1468
1469 cat >&2 <<EOF
1470 $0: unable to guess system type
1471
1472 This script, last modified $timestamp, has failed to recognize
1473 the operating system you are using. It is advised that you
1474 download the most up to date version of the config scripts from
1475
1476 http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
1477 and
1478 http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
1479
1480 If the version you run ($0) is already up to date, please
1481 send the following data and any information you think might be
1482 pertinent to <config-patches@gnu.org> in order to provide the needed
1483 information to handle your system.
1484
1485 config.guess timestamp = $timestamp
1486
1487 uname -m = `(uname -m) 2>/dev/null || echo unknown`
1488 uname -r = `(uname -r) 2>/dev/null || echo unknown`
1489 uname -s = `(uname -s) 2>/dev/null || echo unknown`
1490 uname -v = `(uname -v) 2>/dev/null || echo unknown`
1491
1492 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
1493 /bin/uname -X = `(/bin/uname -X) 2>/dev/null`
1494
1495 hostinfo = `(hostinfo) 2>/dev/null`
1496 /bin/universe = `(/bin/universe) 2>/dev/null`
1497 /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
1498 /bin/arch = `(/bin/arch) 2>/dev/null`
1499 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
1500 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
1501
1502 UNAME_MACHINE = ${UNAME_MACHINE}
1503 UNAME_RELEASE = ${UNAME_RELEASE}
1504 UNAME_SYSTEM = ${UNAME_SYSTEM}
1505 UNAME_VERSION = ${UNAME_VERSION}
1506 EOF
1507
1508 exit 1
1509
1510 # Local variables:
1511 # eval: (add-hook 'write-file-hooks 'time-stamp)
1512 # time-stamp-start: "timestamp='"
1513 # time-stamp-format: "%:y-%02m-%02d"
1514 # time-stamp-end: "'"
1515 # End:
0 #! /bin/sh
1 # Configuration validation subroutine script.
2 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 # 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
4 # Inc.
5
6 timestamp='2007-06-28'
7
8 # This file is (in principle) common to ALL GNU software.
9 # The presence of a machine in this file suggests that SOME GNU software
10 # can handle that machine. It does not imply ALL GNU software can.
11 #
12 # This file is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
16 #
17 # This program is distributed in the hope that it will be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
25 # 02110-1301, USA.
26 #
27 # As a special exception to the GNU General Public License, if you
28 # distribute this file as part of a program that contains a
29 # configuration script generated by Autoconf, you may include it under
30 # the same distribution terms that you use for the rest of that program.
31
32
33 # Please send patches to <config-patches@gnu.org>. Submit a context
34 # diff and a properly formatted ChangeLog entry.
35 #
36 # Configuration subroutine to validate and canonicalize a configuration type.
37 # Supply the specified configuration type as an argument.
38 # If it is invalid, we print an error message on stderr and exit with code 1.
39 # Otherwise, we print the canonical config type on stdout and succeed.
40
41 # This file is supposed to be the same for all GNU packages
42 # and recognize all the CPU types, system types and aliases
43 # that are meaningful with *any* GNU software.
44 # Each package is responsible for reporting which valid configurations
45 # it does not support. The user should be able to distinguish
46 # a failure to support a valid configuration from a meaningless
47 # configuration.
48
49 # The goal of this file is to map all the various variations of a given
50 # machine specification into a single specification in the form:
51 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
52 # or in some cases, the newer four-part form:
53 # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
54 # It is wrong to echo any other type of specification.
55
56 me=`echo "$0" | sed -e 's,.*/,,'`
57
58 usage="\
59 Usage: $0 [OPTION] CPU-MFR-OPSYS
60 $0 [OPTION] ALIAS
61
62 Canonicalize a configuration name.
63
64 Operation modes:
65 -h, --help print this help, then exit
66 -t, --time-stamp print date of last modification, then exit
67 -v, --version print version number, then exit
68
69 Report bugs and patches to <config-patches@gnu.org>."
70
71 version="\
72 GNU config.sub ($timestamp)
73
74 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
75 Free Software Foundation, Inc.
76
77 This is free software; see the source for copying conditions. There is NO
78 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
79
80 help="
81 Try \`$me --help' for more information."
82
83 # Parse command line
84 while test $# -gt 0 ; do
85 case $1 in
86 --time-stamp | --time* | -t )
87 echo "$timestamp" ; exit ;;
88 --version | -v )
89 echo "$version" ; exit ;;
90 --help | --h* | -h )
91 echo "$usage"; exit ;;
92 -- ) # Stop option processing
93 shift; break ;;
94 - ) # Use stdin as input.
95 break ;;
96 -* )
97 echo "$me: invalid option $1$help"
98 exit 1 ;;
99
100 *local*)
101 # First pass through any local machine types.
102 echo $1
103 exit ;;
104
105 * )
106 break ;;
107 esac
108 done
109
110 case $# in
111 0) echo "$me: missing argument$help" >&2
112 exit 1;;
113 1) ;;
114 *) echo "$me: too many arguments$help" >&2
115 exit 1;;
116 esac
117
118 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
119 # Here we must recognize all the valid KERNEL-OS combinations.
120 maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
121 case $maybe_os in
122 nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
123 uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
124 storm-chaos* | os2-emx* | rtmk-nova*)
125 os=-$maybe_os
126 basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
127 ;;
128 *)
129 basic_machine=`echo $1 | sed 's/-[^-]*$//'`
130 if [ $basic_machine != $1 ]
131 then os=`echo $1 | sed 's/.*-/-/'`
132 else os=; fi
133 ;;
134 esac
135
136 ### Let's recognize common machines as not being operating systems so
137 ### that things like config.sub decstation-3100 work. We also
138 ### recognize some manufacturers as not being operating systems, so we
139 ### can provide default operating systems below.
140 case $os in
141 -sun*os*)
142 # Prevent following clause from handling this invalid input.
143 ;;
144 -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
145 -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
146 -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
147 -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
148 -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
149 -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
150 -apple | -axis | -knuth | -cray)
151 os=
152 basic_machine=$1
153 ;;
154 -sim | -cisco | -oki | -wec | -winbond)
155 os=
156 basic_machine=$1
157 ;;
158 -scout)
159 ;;
160 -wrs)
161 os=-vxworks
162 basic_machine=$1
163 ;;
164 -chorusos*)
165 os=-chorusos
166 basic_machine=$1
167 ;;
168 -chorusrdb)
169 os=-chorusrdb
170 basic_machine=$1
171 ;;
172 -hiux*)
173 os=-hiuxwe2
174 ;;
175 -sco6)
176 os=-sco5v6
177 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
178 ;;
179 -sco5)
180 os=-sco3.2v5
181 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
182 ;;
183 -sco4)
184 os=-sco3.2v4
185 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
186 ;;
187 -sco3.2.[4-9]*)
188 os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
189 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
190 ;;
191 -sco3.2v[4-9]*)
192 # Don't forget version if it is 3.2v4 or newer.
193 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
194 ;;
195 -sco5v6*)
196 # Don't forget version if it is 3.2v4 or newer.
197 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
198 ;;
199 -sco*)
200 os=-sco3.2v2
201 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
202 ;;
203 -udk*)
204 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
205 ;;
206 -isc)
207 os=-isc2.2
208 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
209 ;;
210 -clix*)
211 basic_machine=clipper-intergraph
212 ;;
213 -isc*)
214 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
215 ;;
216 -lynx*)
217 os=-lynxos
218 ;;
219 -ptx*)
220 basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
221 ;;
222 -windowsnt*)
223 os=`echo $os | sed -e 's/windowsnt/winnt/'`
224 ;;
225 -psos*)
226 os=-psos
227 ;;
228 -mint | -mint[0-9]*)
229 basic_machine=m68k-atari
230 os=-mint
231 ;;
232 esac
233
234 # Decode aliases for certain CPU-COMPANY combinations.
235 case $basic_machine in
236 # Recognize the basic CPU types without company name.
237 # Some are omitted here because they have special meanings below.
238 1750a | 580 \
239 | a29k \
240 | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
241 | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
242 | am33_2.0 \
243 | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
244 | bfin \
245 | c4x | clipper \
246 | d10v | d30v | dlx | dsp16xx \
247 | fido | fr30 | frv \
248 | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
249 | i370 | i860 | i960 | ia64 \
250 | ip2k | iq2000 \
251 | m32c | m32r | m32rle | m68000 | m68k | m88k \
252 | maxq | mb | microblaze | mcore | mep \
253 | mips | mipsbe | mipseb | mipsel | mipsle \
254 | mips16 \
255 | mips64 | mips64el \
256 | mips64vr | mips64vrel \
257 | mips64orion | mips64orionel \
258 | mips64vr4100 | mips64vr4100el \
259 | mips64vr4300 | mips64vr4300el \
260 | mips64vr5000 | mips64vr5000el \
261 | mips64vr5900 | mips64vr5900el \
262 | mipsisa32 | mipsisa32el \
263 | mipsisa32r2 | mipsisa32r2el \
264 | mipsisa64 | mipsisa64el \
265 | mipsisa64r2 | mipsisa64r2el \
266 | mipsisa64sb1 | mipsisa64sb1el \
267 | mipsisa64sr71k | mipsisa64sr71kel \
268 | mipstx39 | mipstx39el \
269 | mn10200 | mn10300 \
270 | mt \
271 | msp430 \
272 | nios | nios2 \
273 | ns16k | ns32k \
274 | or32 \
275 | pdp10 | pdp11 | pj | pjl \
276 | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
277 | pyramid \
278 | score \
279 | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
280 | sh64 | sh64le \
281 | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
282 | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
283 | spu | strongarm \
284 | tahoe | thumb | tic4x | tic80 | tron \
285 | v850 | v850e \
286 | we32k \
287 | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
288 | z8k)
289 basic_machine=$basic_machine-unknown
290 ;;
291 m6811 | m68hc11 | m6812 | m68hc12)
292 # Motorola 68HC11/12.
293 basic_machine=$basic_machine-unknown
294 os=-none
295 ;;
296 m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
297 ;;
298 ms1)
299 basic_machine=mt-unknown
300 ;;
301
302 # We use `pc' rather than `unknown'
303 # because (1) that's what they normally are, and
304 # (2) the word "unknown" tends to confuse beginning users.
305 i*86 | x86_64)
306 basic_machine=$basic_machine-pc
307 ;;
308 # Object if more than one company name word.
309 *-*-*)
310 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
311 exit 1
312 ;;
313 # Recognize the basic CPU types with company name.
314 580-* \
315 | a29k-* \
316 | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
317 | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
318 | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
319 | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
320 | avr-* | avr32-* \
321 | bfin-* | bs2000-* \
322 | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
323 | clipper-* | craynv-* | cydra-* \
324 | d10v-* | d30v-* | dlx-* \
325 | elxsi-* \
326 | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
327 | h8300-* | h8500-* \
328 | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
329 | i*86-* | i860-* | i960-* | ia64-* \
330 | ip2k-* | iq2000-* \
331 | m32c-* | m32r-* | m32rle-* \
332 | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
333 | m88110-* | m88k-* | maxq-* | mcore-* \
334 | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
335 | mips16-* \
336 | mips64-* | mips64el-* \
337 | mips64vr-* | mips64vrel-* \
338 | mips64orion-* | mips64orionel-* \
339 | mips64vr4100-* | mips64vr4100el-* \
340 | mips64vr4300-* | mips64vr4300el-* \
341 | mips64vr5000-* | mips64vr5000el-* \
342 | mips64vr5900-* | mips64vr5900el-* \
343 | mipsisa32-* | mipsisa32el-* \
344 | mipsisa32r2-* | mipsisa32r2el-* \
345 | mipsisa64-* | mipsisa64el-* \
346 | mipsisa64r2-* | mipsisa64r2el-* \
347 | mipsisa64sb1-* | mipsisa64sb1el-* \
348 | mipsisa64sr71k-* | mipsisa64sr71kel-* \
349 | mipstx39-* | mipstx39el-* \
350 | mmix-* \
351 | mt-* \
352 | msp430-* \
353 | nios-* | nios2-* \
354 | none-* | np1-* | ns16k-* | ns32k-* \
355 | orion-* \
356 | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
357 | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
358 | pyramid-* \
359 | romp-* | rs6000-* \
360 | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
361 | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
362 | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
363 | sparclite-* \
364 | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
365 | tahoe-* | thumb-* \
366 | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
367 | tron-* \
368 | v850-* | v850e-* | vax-* \
369 | we32k-* \
370 | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
371 | xstormy16-* | xtensa-* \
372 | ymp-* \
373 | z8k-*)
374 ;;
375 # Recognize the various machine names and aliases which stand
376 # for a CPU type and a company and sometimes even an OS.
377 386bsd)
378 basic_machine=i386-unknown
379 os=-bsd
380 ;;
381 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
382 basic_machine=m68000-att
383 ;;
384 3b*)
385 basic_machine=we32k-att
386 ;;
387 a29khif)
388 basic_machine=a29k-amd
389 os=-udi
390 ;;
391 abacus)
392 basic_machine=abacus-unknown
393 ;;
394 adobe68k)
395 basic_machine=m68010-adobe
396 os=-scout
397 ;;
398 alliant | fx80)
399 basic_machine=fx80-alliant
400 ;;
401 altos | altos3068)
402 basic_machine=m68k-altos
403 ;;
404 am29k)
405 basic_machine=a29k-none
406 os=-bsd
407 ;;
408 amd64)
409 basic_machine=x86_64-pc
410 ;;
411 amd64-*)
412 basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
413 ;;
414 amdahl)
415 basic_machine=580-amdahl
416 os=-sysv
417 ;;
418 amiga | amiga-*)
419 basic_machine=m68k-unknown
420 ;;
421 amigaos | amigados)
422 basic_machine=m68k-unknown
423 os=-amigaos
424 ;;
425 amigaunix | amix)
426 basic_machine=m68k-unknown
427 os=-sysv4
428 ;;
429 apollo68)
430 basic_machine=m68k-apollo
431 os=-sysv
432 ;;
433 apollo68bsd)
434 basic_machine=m68k-apollo
435 os=-bsd
436 ;;
437 aux)
438 basic_machine=m68k-apple
439 os=-aux
440 ;;
441 balance)
442 basic_machine=ns32k-sequent
443 os=-dynix
444 ;;
445 c90)
446 basic_machine=c90-cray
447 os=-unicos
448 ;;
449 convex-c1)
450 basic_machine=c1-convex
451 os=-bsd
452 ;;
453 convex-c2)
454 basic_machine=c2-convex
455 os=-bsd
456 ;;
457 convex-c32)
458 basic_machine=c32-convex
459 os=-bsd
460 ;;
461 convex-c34)
462 basic_machine=c34-convex
463 os=-bsd
464 ;;
465 convex-c38)
466 basic_machine=c38-convex
467 os=-bsd
468 ;;
469 cray | j90)
470 basic_machine=j90-cray
471 os=-unicos
472 ;;
473 craynv)
474 basic_machine=craynv-cray
475 os=-unicosmp
476 ;;
477 cr16)
478 basic_machine=cr16-unknown
479 os=-elf
480 ;;
481 crds | unos)
482 basic_machine=m68k-crds
483 ;;
484 crisv32 | crisv32-* | etraxfs*)
485 basic_machine=crisv32-axis
486 ;;
487 cris | cris-* | etrax*)
488 basic_machine=cris-axis
489 ;;
490 crx)
491 basic_machine=crx-unknown
492 os=-elf
493 ;;
494 da30 | da30-*)
495 basic_machine=m68k-da30
496 ;;
497 decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
498 basic_machine=mips-dec
499 ;;
500 decsystem10* | dec10*)
501 basic_machine=pdp10-dec
502 os=-tops10
503 ;;
504 decsystem20* | dec20*)
505 basic_machine=pdp10-dec
506 os=-tops20
507 ;;
508 delta | 3300 | motorola-3300 | motorola-delta \
509 | 3300-motorola | delta-motorola)
510 basic_machine=m68k-motorola
511 ;;
512 delta88)
513 basic_machine=m88k-motorola
514 os=-sysv3
515 ;;
516 djgpp)
517 basic_machine=i586-pc
518 os=-msdosdjgpp
519 ;;
520 dpx20 | dpx20-*)
521 basic_machine=rs6000-bull
522 os=-bosx
523 ;;
524 dpx2* | dpx2*-bull)
525 basic_machine=m68k-bull
526 os=-sysv3
527 ;;
528 ebmon29k)
529 basic_machine=a29k-amd
530 os=-ebmon
531 ;;
532 elxsi)
533 basic_machine=elxsi-elxsi
534 os=-bsd
535 ;;
536 encore | umax | mmax)
537 basic_machine=ns32k-encore
538 ;;
539 es1800 | OSE68k | ose68k | ose | OSE)
540 basic_machine=m68k-ericsson
541 os=-ose
542 ;;
543 fx2800)
544 basic_machine=i860-alliant
545 ;;
546 genix)
547 basic_machine=ns32k-ns
548 ;;
549 gmicro)
550 basic_machine=tron-gmicro
551 os=-sysv
552 ;;
553 go32)
554 basic_machine=i386-pc
555 os=-go32
556 ;;
557 h3050r* | hiux*)
558 basic_machine=hppa1.1-hitachi
559 os=-hiuxwe2
560 ;;
561 h8300hms)
562 basic_machine=h8300-hitachi
563 os=-hms
564 ;;
565 h8300xray)
566 basic_machine=h8300-hitachi
567 os=-xray
568 ;;
569 h8500hms)
570 basic_machine=h8500-hitachi
571 os=-hms
572 ;;
573 harris)
574 basic_machine=m88k-harris
575 os=-sysv3
576 ;;
577 hp300-*)
578 basic_machine=m68k-hp
579 ;;
580 hp300bsd)
581 basic_machine=m68k-hp
582 os=-bsd
583 ;;
584 hp300hpux)
585 basic_machine=m68k-hp
586 os=-hpux
587 ;;
588 hp3k9[0-9][0-9] | hp9[0-9][0-9])
589 basic_machine=hppa1.0-hp
590 ;;
591 hp9k2[0-9][0-9] | hp9k31[0-9])
592 basic_machine=m68000-hp
593 ;;
594 hp9k3[2-9][0-9])
595 basic_machine=m68k-hp
596 ;;
597 hp9k6[0-9][0-9] | hp6[0-9][0-9])
598 basic_machine=hppa1.0-hp
599 ;;
600 hp9k7[0-79][0-9] | hp7[0-79][0-9])
601 basic_machine=hppa1.1-hp
602 ;;
603 hp9k78[0-9] | hp78[0-9])
604 # FIXME: really hppa2.0-hp
605 basic_machine=hppa1.1-hp
606 ;;
607 hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
608 # FIXME: really hppa2.0-hp
609 basic_machine=hppa1.1-hp
610 ;;
611 hp9k8[0-9][13679] | hp8[0-9][13679])
612 basic_machine=hppa1.1-hp
613 ;;
614 hp9k8[0-9][0-9] | hp8[0-9][0-9])
615 basic_machine=hppa1.0-hp
616 ;;
617 hppa-next)
618 os=-nextstep3
619 ;;
620 hppaosf)
621 basic_machine=hppa1.1-hp
622 os=-osf
623 ;;
624 hppro)
625 basic_machine=hppa1.1-hp
626 os=-proelf
627 ;;
628 i370-ibm* | ibm*)
629 basic_machine=i370-ibm
630 ;;
631 # I'm not sure what "Sysv32" means. Should this be sysv3.2?
632 i*86v32)
633 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
634 os=-sysv32
635 ;;
636 i*86v4*)
637 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
638 os=-sysv4
639 ;;
640 i*86v)
641 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
642 os=-sysv
643 ;;
644 i*86sol2)
645 basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
646 os=-solaris2
647 ;;
648 i386mach)
649 basic_machine=i386-mach
650 os=-mach
651 ;;
652 i386-vsta | vsta)
653 basic_machine=i386-unknown
654 os=-vsta
655 ;;
656 iris | iris4d)
657 basic_machine=mips-sgi
658 case $os in
659 -irix*)
660 ;;
661 *)
662 os=-irix4
663 ;;
664 esac
665 ;;
666 isi68 | isi)
667 basic_machine=m68k-isi
668 os=-sysv
669 ;;
670 m88k-omron*)
671 basic_machine=m88k-omron
672 ;;
673 magnum | m3230)
674 basic_machine=mips-mips
675 os=-sysv
676 ;;
677 merlin)
678 basic_machine=ns32k-utek
679 os=-sysv
680 ;;
681 mingw32)
682 basic_machine=i386-pc
683 os=-mingw32
684 ;;
685 mingw32ce)
686 basic_machine=arm-unknown
687 os=-mingw32ce
688 ;;
689 miniframe)
690 basic_machine=m68000-convergent
691 ;;
692 *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
693 basic_machine=m68k-atari
694 os=-mint
695 ;;
696 mips3*-*)
697 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
698 ;;
699 mips3*)
700 basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
701 ;;
702 monitor)
703 basic_machine=m68k-rom68k
704 os=-coff
705 ;;
706 morphos)
707 basic_machine=powerpc-unknown
708 os=-morphos
709 ;;
710 msdos)
711 basic_machine=i386-pc
712 os=-msdos
713 ;;
714 ms1-*)
715 basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
716 ;;
717 mvs)
718 basic_machine=i370-ibm
719 os=-mvs
720 ;;
721 ncr3000)
722 basic_machine=i486-ncr
723 os=-sysv4
724 ;;
725 netbsd386)
726 basic_machine=i386-unknown
727 os=-netbsd
728 ;;
729 netwinder)
730 basic_machine=armv4l-rebel
731 os=-linux
732 ;;
733 news | news700 | news800 | news900)
734 basic_machine=m68k-sony
735 os=-newsos
736 ;;
737 news1000)
738 basic_machine=m68030-sony
739 os=-newsos
740 ;;
741 news-3600 | risc-news)
742 basic_machine=mips-sony
743 os=-newsos
744 ;;
745 necv70)
746 basic_machine=v70-nec
747 os=-sysv
748 ;;
749 next | m*-next )
750 basic_machine=m68k-next
751 case $os in
752 -nextstep* )
753 ;;
754 -ns2*)
755 os=-nextstep2
756 ;;
757 *)
758 os=-nextstep3
759 ;;
760 esac
761 ;;
762 nh3000)
763 basic_machine=m68k-harris
764 os=-cxux
765 ;;
766 nh[45]000)
767 basic_machine=m88k-harris
768 os=-cxux
769 ;;
770 nindy960)
771 basic_machine=i960-intel
772 os=-nindy
773 ;;
774 mon960)
775 basic_machine=i960-intel
776 os=-mon960
777 ;;
778 nonstopux)
779 basic_machine=mips-compaq
780 os=-nonstopux
781 ;;
782 np1)
783 basic_machine=np1-gould
784 ;;
785 nsr-tandem)
786 basic_machine=nsr-tandem
787 ;;
788 op50n-* | op60c-*)
789 basic_machine=hppa1.1-oki
790 os=-proelf
791 ;;
792 openrisc | openrisc-*)
793 basic_machine=or32-unknown
794 ;;
795 os400)
796 basic_machine=powerpc-ibm
797 os=-os400
798 ;;
799 OSE68000 | ose68000)
800 basic_machine=m68000-ericsson
801 os=-ose
802 ;;
803 os68k)
804 basic_machine=m68k-none
805 os=-os68k
806 ;;
807 pa-hitachi)
808 basic_machine=hppa1.1-hitachi
809 os=-hiuxwe2
810 ;;
811 paragon)
812 basic_machine=i860-intel
813 os=-osf
814 ;;
815 pbd)
816 basic_machine=sparc-tti
817 ;;
818 pbb)
819 basic_machine=m68k-tti
820 ;;
821 pc532 | pc532-*)
822 basic_machine=ns32k-pc532
823 ;;
824 pc98)
825 basic_machine=i386-pc
826 ;;
827 pc98-*)
828 basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
829 ;;
830 pentium | p5 | k5 | k6 | nexgen | viac3)
831 basic_machine=i586-pc
832 ;;
833 pentiumpro | p6 | 6x86 | athlon | athlon_*)
834 basic_machine=i686-pc
835 ;;
836 pentiumii | pentium2 | pentiumiii | pentium3)
837 basic_machine=i686-pc
838 ;;
839 pentium4)
840 basic_machine=i786-pc
841 ;;
842 pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
843 basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
844 ;;
845 pentiumpro-* | p6-* | 6x86-* | athlon-*)
846 basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
847 ;;
848 pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
849 basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
850 ;;
851 pentium4-*)
852 basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
853 ;;
854 pn)
855 basic_machine=pn-gould
856 ;;
857 power) basic_machine=power-ibm
858 ;;
859 ppc) basic_machine=powerpc-unknown
860 ;;
861 ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
862 ;;
863 ppcle | powerpclittle | ppc-le | powerpc-little)
864 basic_machine=powerpcle-unknown
865 ;;
866 ppcle-* | powerpclittle-*)
867 basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
868 ;;
869 ppc64) basic_machine=powerpc64-unknown
870 ;;
871 ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
872 ;;
873 ppc64le | powerpc64little | ppc64-le | powerpc64-little)
874 basic_machine=powerpc64le-unknown
875 ;;
876 ppc64le-* | powerpc64little-*)
877 basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
878 ;;
879 ps2)
880 basic_machine=i386-ibm
881 ;;
882 pw32)
883 basic_machine=i586-unknown
884 os=-pw32
885 ;;
886 rdos)
887 basic_machine=i386-pc
888 os=-rdos
889 ;;
890 rom68k)
891 basic_machine=m68k-rom68k
892 os=-coff
893 ;;
894 rm[46]00)
895 basic_machine=mips-siemens
896 ;;
897 rtpc | rtpc-*)
898 basic_machine=romp-ibm
899 ;;
900 s390 | s390-*)
901 basic_machine=s390-ibm
902 ;;
903 s390x | s390x-*)
904 basic_machine=s390x-ibm
905 ;;
906 sa29200)
907 basic_machine=a29k-amd
908 os=-udi
909 ;;
910 sb1)
911 basic_machine=mipsisa64sb1-unknown
912 ;;
913 sb1el)
914 basic_machine=mipsisa64sb1el-unknown
915 ;;
916 sde)
917 basic_machine=mipsisa32-sde
918 os=-elf
919 ;;
920 sei)
921 basic_machine=mips-sei
922 os=-seiux
923 ;;
924 sequent)
925 basic_machine=i386-sequent
926 ;;
927 sh)
928 basic_machine=sh-hitachi
929 os=-hms
930 ;;
931 sh5el)
932 basic_machine=sh5le-unknown
933 ;;
934 sh64)
935 basic_machine=sh64-unknown
936 ;;
937 sparclite-wrs | simso-wrs)
938 basic_machine=sparclite-wrs
939 os=-vxworks
940 ;;
941 sps7)
942 basic_machine=m68k-bull
943 os=-sysv2
944 ;;
945 spur)
946 basic_machine=spur-unknown
947 ;;
948 st2000)
949 basic_machine=m68k-tandem
950 ;;
951 stratus)
952 basic_machine=i860-stratus
953 os=-sysv4
954 ;;
955 sun2)
956 basic_machine=m68000-sun
957 ;;
958 sun2os3)
959 basic_machine=m68000-sun
960 os=-sunos3
961 ;;
962 sun2os4)
963 basic_machine=m68000-sun
964 os=-sunos4
965 ;;
966 sun3os3)
967 basic_machine=m68k-sun
968 os=-sunos3
969 ;;
970 sun3os4)
971 basic_machine=m68k-sun
972 os=-sunos4
973 ;;
974 sun4os3)
975 basic_machine=sparc-sun
976 os=-sunos3
977 ;;
978 sun4os4)
979 basic_machine=sparc-sun
980 os=-sunos4
981 ;;
982 sun4sol2)
983 basic_machine=sparc-sun
984 os=-solaris2
985 ;;
986 sun3 | sun3-*)
987 basic_machine=m68k-sun
988 ;;
989 sun4)
990 basic_machine=sparc-sun
991 ;;
992 sun386 | sun386i | roadrunner)
993 basic_machine=i386-sun
994 ;;
995 sv1)
996 basic_machine=sv1-cray
997 os=-unicos
998 ;;
999 symmetry)
1000 basic_machine=i386-sequent
1001 os=-dynix
1002 ;;
1003 t3e)
1004 basic_machine=alphaev5-cray
1005 os=-unicos
1006 ;;
1007 t90)
1008 basic_machine=t90-cray
1009 os=-unicos
1010 ;;
1011 tic54x | c54x*)
1012 basic_machine=tic54x-unknown
1013 os=-coff
1014 ;;
1015 tic55x | c55x*)
1016 basic_machine=tic55x-unknown
1017 os=-coff
1018 ;;
1019 tic6x | c6x*)
1020 basic_machine=tic6x-unknown
1021 os=-coff
1022 ;;
1023 tx39)
1024 basic_machine=mipstx39-unknown
1025 ;;
1026 tx39el)
1027 basic_machine=mipstx39el-unknown
1028 ;;
1029 toad1)
1030 basic_machine=pdp10-xkl
1031 os=-tops20
1032 ;;
1033 tower | tower-32)
1034 basic_machine=m68k-ncr
1035 ;;
1036 tpf)
1037 basic_machine=s390x-ibm
1038 os=-tpf
1039 ;;
1040 udi29k)
1041 basic_machine=a29k-amd
1042 os=-udi
1043 ;;
1044 ultra3)
1045 basic_machine=a29k-nyu
1046 os=-sym1
1047 ;;
1048 v810 | necv810)
1049 basic_machine=v810-nec
1050 os=-none
1051 ;;
1052 vaxv)
1053 basic_machine=vax-dec
1054 os=-sysv
1055 ;;
1056 vms)
1057 basic_machine=vax-dec
1058 os=-vms
1059 ;;
1060 vpp*|vx|vx-*)
1061 basic_machine=f301-fujitsu
1062 ;;
1063 vxworks960)
1064 basic_machine=i960-wrs
1065 os=-vxworks
1066 ;;
1067 vxworks68)
1068 basic_machine=m68k-wrs
1069 os=-vxworks
1070 ;;
1071 vxworks29k)
1072 basic_machine=a29k-wrs
1073 os=-vxworks
1074 ;;
1075 w65*)
1076 basic_machine=w65-wdc
1077 os=-none
1078 ;;
1079 w89k-*)
1080 basic_machine=hppa1.1-winbond
1081 os=-proelf
1082 ;;
1083 xbox)
1084 basic_machine=i686-pc
1085 os=-mingw32
1086 ;;
1087 xps | xps100)
1088 basic_machine=xps100-honeywell
1089 ;;
1090 ymp)
1091 basic_machine=ymp-cray
1092 os=-unicos
1093 ;;
1094 z8k-*-coff)
1095 basic_machine=z8k-unknown
1096 os=-sim
1097 ;;
1098 none)
1099 basic_machine=none-none
1100 os=-none
1101 ;;
1102
1103 # Here we handle the default manufacturer of certain CPU types. It is in
1104 # some cases the only manufacturer, in others, it is the most popular.
1105 w89k)
1106 basic_machine=hppa1.1-winbond
1107 ;;
1108 op50n)
1109 basic_machine=hppa1.1-oki
1110 ;;
1111 op60c)
1112 basic_machine=hppa1.1-oki
1113 ;;
1114 romp)
1115 basic_machine=romp-ibm
1116 ;;
1117 mmix)
1118 basic_machine=mmix-knuth
1119 ;;
1120 rs6000)
1121 basic_machine=rs6000-ibm
1122 ;;
1123 vax)
1124 basic_machine=vax-dec
1125 ;;
1126 pdp10)
1127 # there are many clones, so DEC is not a safe bet
1128 basic_machine=pdp10-unknown
1129 ;;
1130 pdp11)
1131 basic_machine=pdp11-dec
1132 ;;
1133 we32k)
1134 basic_machine=we32k-att
1135 ;;
1136 sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
1137 basic_machine=sh-unknown
1138 ;;
1139 sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
1140 basic_machine=sparc-sun
1141 ;;
1142 cydra)
1143 basic_machine=cydra-cydrome
1144 ;;
1145 orion)
1146 basic_machine=orion-highlevel
1147 ;;
1148 orion105)
1149 basic_machine=clipper-highlevel
1150 ;;
1151 mac | mpw | mac-mpw)
1152 basic_machine=m68k-apple
1153 ;;
1154 pmac | pmac-mpw)
1155 basic_machine=powerpc-apple
1156 ;;
1157 *-unknown)
1158 # Make sure to match an already-canonicalized machine name.
1159 ;;
1160 *)
1161 echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
1162 exit 1
1163 ;;
1164 esac
1165
1166 # Here we canonicalize certain aliases for manufacturers.
1167 case $basic_machine in
1168 *-digital*)
1169 basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
1170 ;;
1171 *-commodore*)
1172 basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
1173 ;;
1174 *)
1175 ;;
1176 esac
1177
1178 # Decode manufacturer-specific aliases for certain operating systems.
1179
1180 if [ x"$os" != x"" ]
1181 then
1182 case $os in
1183 # First match some system type aliases
1184 # that might get confused with valid system types.
1185 # -solaris* is a basic system type, with this one exception.
1186 -solaris1 | -solaris1.*)
1187 os=`echo $os | sed -e 's|solaris1|sunos4|'`
1188 ;;
1189 -solaris)
1190 os=-solaris2
1191 ;;
1192 -svr4*)
1193 os=-sysv4
1194 ;;
1195 -unixware*)
1196 os=-sysv4.2uw
1197 ;;
1198 -gnu/linux*)
1199 os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
1200 ;;
1201 # First accept the basic system types.
1202 # The portable systems comes first.
1203 # Each alternative MUST END IN A *, to match a version number.
1204 # -sysv* is not here because it comes later, after sysvr4.
1205 -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
1206 | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
1207 | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
1208 | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
1209 | -aos* \
1210 | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
1211 | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
1212 | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
1213 | -openbsd* | -solidbsd* \
1214 | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
1215 | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
1216 | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
1217 | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
1218 | -chorusos* | -chorusrdb* \
1219 | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
1220 | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
1221 | -uxpv* | -beos* | -mpeix* | -udk* \
1222 | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
1223 | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
1224 | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
1225 | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
1226 | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
1227 | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
1228 | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
1229 # Remember, each alternative MUST END IN *, to match a version number.
1230 ;;
1231 -qnx*)
1232 case $basic_machine in
1233 x86-* | i*86-*)
1234 ;;
1235 *)
1236 os=-nto$os
1237 ;;
1238 esac
1239 ;;
1240 -nto-qnx*)
1241 ;;
1242 -nto*)
1243 os=`echo $os | sed -e 's|nto|nto-qnx|'`
1244 ;;
1245 -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
1246 | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
1247 | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
1248 ;;
1249 -mac*)
1250 os=`echo $os | sed -e 's|mac|macos|'`
1251 ;;
1252 -linux-dietlibc)
1253 os=-linux-dietlibc
1254 ;;
1255 -linux*)
1256 os=`echo $os | sed -e 's|linux|linux-gnu|'`
1257 ;;
1258 -sunos5*)
1259 os=`echo $os | sed -e 's|sunos5|solaris2|'`
1260 ;;
1261 -sunos6*)
1262 os=`echo $os | sed -e 's|sunos6|solaris3|'`
1263 ;;
1264 -opened*)
1265 os=-openedition
1266 ;;
1267 -os400*)
1268 os=-os400
1269 ;;
1270 -wince*)
1271 os=-wince
1272 ;;
1273 -osfrose*)
1274 os=-osfrose
1275 ;;
1276 -osf*)
1277 os=-osf
1278 ;;
1279 -utek*)
1280 os=-bsd
1281 ;;
1282 -dynix*)
1283 os=-bsd
1284 ;;
1285 -acis*)
1286 os=-aos
1287 ;;
1288 -atheos*)
1289 os=-atheos
1290 ;;
1291 -syllable*)
1292 os=-syllable
1293 ;;
1294 -386bsd)
1295 os=-bsd
1296 ;;
1297 -ctix* | -uts*)
1298 os=-sysv
1299 ;;
1300 -nova*)
1301 os=-rtmk-nova
1302 ;;
1303 -ns2 )
1304 os=-nextstep2
1305 ;;
1306 -nsk*)
1307 os=-nsk
1308 ;;
1309 # Preserve the version number of sinix5.
1310 -sinix5.*)
1311 os=`echo $os | sed -e 's|sinix|sysv|'`
1312 ;;
1313 -sinix*)
1314 os=-sysv4
1315 ;;
1316 -tpf*)
1317 os=-tpf
1318 ;;
1319 -triton*)
1320 os=-sysv3
1321 ;;
1322 -oss*)
1323 os=-sysv3
1324 ;;
1325 -svr4)
1326 os=-sysv4
1327 ;;
1328 -svr3)
1329 os=-sysv3
1330 ;;
1331 -sysvr4)
1332 os=-sysv4
1333 ;;
1334 # This must come after -sysvr4.
1335 -sysv*)
1336 ;;
1337 -ose*)
1338 os=-ose
1339 ;;
1340 -es1800*)
1341 os=-ose
1342 ;;
1343 -xenix)
1344 os=-xenix
1345 ;;
1346 -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1347 os=-mint
1348 ;;
1349 -aros*)
1350 os=-aros
1351 ;;
1352 -kaos*)
1353 os=-kaos
1354 ;;
1355 -zvmoe)
1356 os=-zvmoe
1357 ;;
1358 -none)
1359 ;;
1360 *)
1361 # Get rid of the `-' at the beginning of $os.
1362 os=`echo $os | sed 's/[^-]*-//'`
1363 echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
1364 exit 1
1365 ;;
1366 esac
1367 else
1368
1369 # Here we handle the default operating systems that come with various machines.
1370 # The value should be what the vendor currently ships out the door with their
1371 # machine or put another way, the most popular os provided with the machine.
1372
1373 # Note that if you're going to try to match "-MANUFACTURER" here (say,
1374 # "-sun"), then you have to tell the case statement up towards the top
1375 # that MANUFACTURER isn't an operating system. Otherwise, code above
1376 # will signal an error saying that MANUFACTURER isn't an operating
1377 # system, and we'll never get to this point.
1378
1379 case $basic_machine in
1380 score-*)
1381 os=-elf
1382 ;;
1383 spu-*)
1384 os=-elf
1385 ;;
1386 *-acorn)
1387 os=-riscix1.2
1388 ;;
1389 arm*-rebel)
1390 os=-linux
1391 ;;
1392 arm*-semi)
1393 os=-aout
1394 ;;
1395 c4x-* | tic4x-*)
1396 os=-coff
1397 ;;
1398 # This must come before the *-dec entry.
1399 pdp10-*)
1400 os=-tops20
1401 ;;
1402 pdp11-*)
1403 os=-none
1404 ;;
1405 *-dec | vax-*)
1406 os=-ultrix4.2
1407 ;;
1408 m68*-apollo)
1409 os=-domain
1410 ;;
1411 i386-sun)
1412 os=-sunos4.0.2
1413 ;;
1414 m68000-sun)
1415 os=-sunos3
1416 # This also exists in the configure program, but was not the
1417 # default.
1418 # os=-sunos4
1419 ;;
1420 m68*-cisco)
1421 os=-aout
1422 ;;
1423 mep-*)
1424 os=-elf
1425 ;;
1426 mips*-cisco)
1427 os=-elf
1428 ;;
1429 mips*-*)
1430 os=-elf
1431 ;;
1432 or32-*)
1433 os=-coff
1434 ;;
1435 *-tti) # must be before sparc entry or we get the wrong os.
1436 os=-sysv3
1437 ;;
1438 sparc-* | *-sun)
1439 os=-sunos4.1.1
1440 ;;
1441 *-be)
1442 os=-beos
1443 ;;
1444 *-haiku)
1445 os=-haiku
1446 ;;
1447 *-ibm)
1448 os=-aix
1449 ;;
1450 *-knuth)
1451 os=-mmixware
1452 ;;
1453 *-wec)
1454 os=-proelf
1455 ;;
1456 *-winbond)
1457 os=-proelf
1458 ;;
1459 *-oki)
1460 os=-proelf
1461 ;;
1462 *-hp)
1463 os=-hpux
1464 ;;
1465 *-hitachi)
1466 os=-hiux
1467 ;;
1468 i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
1469 os=-sysv
1470 ;;
1471 *-cbm)
1472 os=-amigaos
1473 ;;
1474 *-dg)
1475 os=-dgux
1476 ;;
1477 *-dolphin)
1478 os=-sysv3
1479 ;;
1480 m68k-ccur)
1481 os=-rtu
1482 ;;
1483 m88k-omron*)
1484 os=-luna
1485 ;;
1486 *-next )
1487 os=-nextstep
1488 ;;
1489 *-sequent)
1490 os=-ptx
1491 ;;
1492 *-crds)
1493 os=-unos
1494 ;;
1495 *-ns)
1496 os=-genix
1497 ;;
1498 i370-*)
1499 os=-mvs
1500 ;;
1501 *-next)
1502 os=-nextstep3
1503 ;;
1504 *-gould)
1505 os=-sysv
1506 ;;
1507 *-highlevel)
1508 os=-bsd
1509 ;;
1510 *-encore)
1511 os=-bsd
1512 ;;
1513 *-sgi)
1514 os=-irix
1515 ;;
1516 *-siemens)
1517 os=-sysv4
1518 ;;
1519 *-masscomp)
1520 os=-rtu
1521 ;;
1522 f30[01]-fujitsu | f700-fujitsu)
1523 os=-uxpv
1524 ;;
1525 *-rom68k)
1526 os=-coff
1527 ;;
1528 *-*bug)
1529 os=-coff
1530 ;;
1531 *-apple)
1532 os=-macos
1533 ;;
1534 *-atari*)
1535 os=-mint
1536 ;;
1537 *)
1538 os=-none
1539 ;;
1540 esac
1541 fi
1542
1543 # Here we handle the case where we know the os, and the CPU type, but not the
1544 # manufacturer. We pick the logical manufacturer.
1545 vendor=unknown
1546 case $basic_machine in
1547 *-unknown)
1548 case $os in
1549 -riscix*)
1550 vendor=acorn
1551 ;;
1552 -sunos*)
1553 vendor=sun
1554 ;;
1555 -aix*)
1556 vendor=ibm
1557 ;;
1558 -beos*)
1559 vendor=be
1560 ;;
1561 -hpux*)
1562 vendor=hp
1563 ;;
1564 -mpeix*)
1565 vendor=hp
1566 ;;
1567 -hiux*)
1568 vendor=hitachi
1569 ;;
1570 -unos*)
1571 vendor=crds
1572 ;;
1573 -dgux*)
1574 vendor=dg
1575 ;;
1576 -luna*)
1577 vendor=omron
1578 ;;
1579 -genix*)
1580 vendor=ns
1581 ;;
1582 -mvs* | -opened*)
1583 vendor=ibm
1584 ;;
1585 -os400*)
1586 vendor=ibm
1587 ;;
1588 -ptx*)
1589 vendor=sequent
1590 ;;
1591 -tpf*)
1592 vendor=ibm
1593 ;;
1594 -vxsim* | -vxworks* | -windiss*)
1595 vendor=wrs
1596 ;;
1597 -aux*)
1598 vendor=apple
1599 ;;
1600 -hms*)
1601 vendor=hitachi
1602 ;;
1603 -mpw* | -macos*)
1604 vendor=apple
1605 ;;
1606 -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
1607 vendor=atari
1608 ;;
1609 -vos*)
1610 vendor=stratus
1611 ;;
1612 esac
1613 basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
1614 ;;
1615 esac
1616
1617 echo $basic_machine$os
1618 exit
1619
1620 # Local variables:
1621 # eval: (add-hook 'write-file-hooks 'time-stamp)
1622 # time-stamp-start: "timestamp='"
1623 # time-stamp-format: "%:y-%02m-%02d"
1624 # time-stamp-end: "'"
1625 # End:
0 #! /bin/sh
1 # Guess values for system-dependent variables and create Makefiles.
2 # Generated by GNU Autoconf 2.59.
3 #
4 # Copyright (C) 2003 Free Software Foundation, Inc.
5 # This configure script is free software; the Free Software Foundation
6 # gives unlimited permission to copy, distribute and modify it.
7 ## --------------------- ##
8 ## M4sh Initialization. ##
9 ## --------------------- ##
10
11 # Be Bourne compatible
12 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
13 emulate sh
14 NULLCMD=:
15 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
16 # is contrary to our usage. Disable this feature.
17 alias -g '${1+"$@"}'='"$@"'
18 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
19 set -o posix
20 fi
21 DUALCASE=1; export DUALCASE # for MKS sh
22
23 # Support unset when possible.
24 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
25 as_unset=unset
26 else
27 as_unset=false
28 fi
29
30
31 # Work around bugs in pre-3.0 UWIN ksh.
32 $as_unset ENV MAIL MAILPATH
33 PS1='$ '
34 PS2='> '
35 PS4='+ '
36
37 # NLS nuisances.
38 for as_var in \
39 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
40 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
41 LC_TELEPHONE LC_TIME
42 do
43 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
44 eval $as_var=C; export $as_var
45 else
46 $as_unset $as_var
47 fi
48 done
49
50 # Required to use basename.
51 if expr a : '\(a\)' >/dev/null 2>&1; then
52 as_expr=expr
53 else
54 as_expr=false
55 fi
56
57 if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
58 as_basename=basename
59 else
60 as_basename=false
61 fi
62
63
64 # Name of the executable.
65 as_me=`$as_basename "$0" ||
66 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
67 X"$0" : 'X\(//\)$' \| \
68 X"$0" : 'X\(/\)$' \| \
69 . : '\(.\)' 2>/dev/null ||
70 echo X/"$0" |
71 sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
72 /^X\/\(\/\/\)$/{ s//\1/; q; }
73 /^X\/\(\/\).*/{ s//\1/; q; }
74 s/.*/./; q'`
75
76
77 # PATH needs CR, and LINENO needs CR and PATH.
78 # Avoid depending upon Character Ranges.
79 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
80 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
81 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
82 as_cr_digits='0123456789'
83 as_cr_alnum=$as_cr_Letters$as_cr_digits
84
85 # The user is always right.
86 if test "${PATH_SEPARATOR+set}" != set; then
87 echo "#! /bin/sh" >conf$$.sh
88 echo "exit 0" >>conf$$.sh
89 chmod +x conf$$.sh
90 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
91 PATH_SEPARATOR=';'
92 else
93 PATH_SEPARATOR=:
94 fi
95 rm -f conf$$.sh
96 fi
97
98
99 as_lineno_1=$LINENO
100 as_lineno_2=$LINENO
101 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
102 test "x$as_lineno_1" != "x$as_lineno_2" &&
103 test "x$as_lineno_3" = "x$as_lineno_2" || {
104 # Find who we are. Look in the path if we contain no path at all
105 # relative or not.
106 case $0 in
107 *[\\/]* ) as_myself=$0 ;;
108 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
109 for as_dir in $PATH
110 do
111 IFS=$as_save_IFS
112 test -z "$as_dir" && as_dir=.
113 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
114 done
115
116 ;;
117 esac
118 # We did not find ourselves, most probably we were run as `sh COMMAND'
119 # in which case we are not to be found in the path.
120 if test "x$as_myself" = x; then
121 as_myself=$0
122 fi
123 if test ! -f "$as_myself"; then
124 { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
125 { (exit 1); exit 1; }; }
126 fi
127 case $CONFIG_SHELL in
128 '')
129 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
130 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
131 do
132 IFS=$as_save_IFS
133 test -z "$as_dir" && as_dir=.
134 for as_base in sh bash ksh sh5; do
135 case $as_dir in
136 /*)
137 if ("$as_dir/$as_base" -c '
138 as_lineno_1=$LINENO
139 as_lineno_2=$LINENO
140 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
141 test "x$as_lineno_1" != "x$as_lineno_2" &&
142 test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
143 $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
144 $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
145 CONFIG_SHELL=$as_dir/$as_base
146 export CONFIG_SHELL
147 exec "$CONFIG_SHELL" "$0" ${1+"$@"}
148 fi;;
149 esac
150 done
151 done
152 ;;
153 esac
154
155 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
156 # uniformly replaced by the line number. The first 'sed' inserts a
157 # line-number line before each line; the second 'sed' does the real
158 # work. The second script uses 'N' to pair each line-number line
159 # with the numbered line, and appends trailing '-' during
160 # substitution so that $LINENO is not a special case at line end.
161 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
162 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
163 sed '=' <$as_myself |
164 sed '
165 N
166 s,$,-,
167 : loop
168 s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
169 t loop
170 s,-$,,
171 s,^['$as_cr_digits']*\n,,
172 ' >$as_me.lineno &&
173 chmod +x $as_me.lineno ||
174 { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
175 { (exit 1); exit 1; }; }
176
177 # Don't try to exec as it changes $[0], causing all sort of problems
178 # (the dirname of $[0] is not the place where we might find the
179 # original and so on. Autoconf is especially sensible to this).
180 . ./$as_me.lineno
181 # Exit status is that of the last command.
182 exit
183 }
184
185
186 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
187 *c*,-n*) ECHO_N= ECHO_C='
188 ' ECHO_T=' ' ;;
189 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
190 *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
191 esac
192
193 if expr a : '\(a\)' >/dev/null 2>&1; then
194 as_expr=expr
195 else
196 as_expr=false
197 fi
198
199 rm -f conf$$ conf$$.exe conf$$.file
200 echo >conf$$.file
201 if ln -s conf$$.file conf$$ 2>/dev/null; then
202 # We could just check for DJGPP; but this test a) works b) is more generic
203 # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
204 if test -f conf$$.exe; then
205 # Don't use ln at all; we don't have any links
206 as_ln_s='cp -p'
207 else
208 as_ln_s='ln -s'
209 fi
210 elif ln conf$$.file conf$$ 2>/dev/null; then
211 as_ln_s=ln
212 else
213 as_ln_s='cp -p'
214 fi
215 rm -f conf$$ conf$$.exe conf$$.file
216
217 if mkdir -p . 2>/dev/null; then
218 as_mkdir_p=:
219 else
220 test -d ./-p && rmdir ./-p
221 as_mkdir_p=false
222 fi
223
224 as_executable_p="test -f"
225
226 # Sed expression to map a string onto a valid CPP name.
227 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
228
229 # Sed expression to map a string onto a valid variable name.
230 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
231
232
233 # IFS
234 # We need space, tab and new line, in precisely that order.
235 as_nl='
236 '
237 IFS=" $as_nl"
238
239 # CDPATH.
240 $as_unset CDPATH
241
242
243 # Name of the host.
244 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
245 # so uname gets run too.
246 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
247
248 exec 6>&1
249
250 #
251 # Initializations.
252 #
253 ac_default_prefix=/usr/local
254 ac_config_libobj_dir=.
255 cross_compiling=no
256 subdirs=
257 MFLAGS=
258 MAKEFLAGS=
259 SHELL=${CONFIG_SHELL-/bin/sh}
260
261 # Maximum number of lines to put in a shell here document.
262 # This variable seems obsolete. It should probably be removed, and
263 # only ac_max_sed_lines should be used.
264 : ${ac_max_here_lines=38}
265
266 # Identity of this package.
267 PACKAGE_NAME=
268 PACKAGE_TARNAME=
269 PACKAGE_VERSION=
270 PACKAGE_STRING=
271 PACKAGE_BUGREPORT=
272
273 ac_unique_file="geotiff.h"
274 # Factoring default headers for most tests.
275 ac_includes_default="\
276 #include <stdio.h>
277 #if HAVE_SYS_TYPES_H
278 # include <sys/types.h>
279 #endif
280 #if HAVE_SYS_STAT_H
281 # include <sys/stat.h>
282 #endif
283 #if STDC_HEADERS
284 # include <stdlib.h>
285 # include <stddef.h>
286 #else
287 # if HAVE_STDLIB_H
288 # include <stdlib.h>
289 # endif
290 #endif
291 #if HAVE_STRING_H
292 # if !STDC_HEADERS && HAVE_MEMORY_H
293 # include <memory.h>
294 # endif
295 # include <string.h>
296 #endif
297 #if HAVE_STRINGS_H
298 # include <strings.h>
299 #endif
300 #if HAVE_INTTYPES_H
301 # include <inttypes.h>
302 #else
303 # if HAVE_STDINT_H
304 # include <stdint.h>
305 # endif
306 #endif
307 #if HAVE_UNISTD_H
308 # include <unistd.h>
309 #endif"
310
311 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'
312 ac_subst_files=''
313
314 # Initialize some variables set by options.
315 ac_init_help=
316 ac_init_version=false
317 # The variables have the same names as the options, with
318 # dashes changed to underlines.
319 cache_file=/dev/null
320 exec_prefix=NONE
321 no_create=
322 no_recursion=
323 prefix=NONE
324 program_prefix=NONE
325 program_suffix=NONE
326 program_transform_name=s,x,x,
327 silent=
328 site=
329 srcdir=
330 verbose=
331 x_includes=NONE
332 x_libraries=NONE
333
334 # Installation directory options.
335 # These are left unexpanded so users can "make install exec_prefix=/foo"
336 # and all the variables that are supposed to be based on exec_prefix
337 # by default will actually change.
338 # Use braces instead of parens because sh, perl, etc. also accept them.
339 bindir='${exec_prefix}/bin'
340 sbindir='${exec_prefix}/sbin'
341 libexecdir='${exec_prefix}/libexec'
342 datadir='${prefix}/share'
343 sysconfdir='${prefix}/etc'
344 sharedstatedir='${prefix}/com'
345 localstatedir='${prefix}/var'
346 libdir='${exec_prefix}/lib'
347 includedir='${prefix}/include'
348 oldincludedir='/usr/include'
349 infodir='${prefix}/info'
350 mandir='${prefix}/man'
351
352 ac_prev=
353 for ac_option
354 do
355 # If the previous option needs an argument, assign it.
356 if test -n "$ac_prev"; then
357 eval "$ac_prev=\$ac_option"
358 ac_prev=
359 continue
360 fi
361
362 ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
363
364 # Accept the important Cygnus configure options, so we can diagnose typos.
365
366 case $ac_option in
367
368 -bindir | --bindir | --bindi | --bind | --bin | --bi)
369 ac_prev=bindir ;;
370 -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
371 bindir=$ac_optarg ;;
372
373 -build | --build | --buil | --bui | --bu)
374 ac_prev=build_alias ;;
375 -build=* | --build=* | --buil=* | --bui=* | --bu=*)
376 build_alias=$ac_optarg ;;
377
378 -cache-file | --cache-file | --cache-fil | --cache-fi \
379 | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
380 ac_prev=cache_file ;;
381 -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
382 | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
383 cache_file=$ac_optarg ;;
384
385 --config-cache | -C)
386 cache_file=config.cache ;;
387
388 -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
389 ac_prev=datadir ;;
390 -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
391 | --da=*)
392 datadir=$ac_optarg ;;
393
394 -disable-* | --disable-*)
395 ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
396 # Reject names that are not valid shell variable names.
397 expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
398 { echo "$as_me: error: invalid feature name: $ac_feature" >&2
399 { (exit 1); exit 1; }; }
400 ac_feature=`echo $ac_feature | sed 's/-/_/g'`
401 eval "enable_$ac_feature=no" ;;
402
403 -enable-* | --enable-*)
404 ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
405 # Reject names that are not valid shell variable names.
406 expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
407 { echo "$as_me: error: invalid feature name: $ac_feature" >&2
408 { (exit 1); exit 1; }; }
409 ac_feature=`echo $ac_feature | sed 's/-/_/g'`
410 case $ac_option in
411 *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
412 *) ac_optarg=yes ;;
413 esac
414 eval "enable_$ac_feature='$ac_optarg'" ;;
415
416 -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
417 | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
418 | --exec | --exe | --ex)
419 ac_prev=exec_prefix ;;
420 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
421 | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
422 | --exec=* | --exe=* | --ex=*)
423 exec_prefix=$ac_optarg ;;
424
425 -gas | --gas | --ga | --g)
426 # Obsolete; use --with-gas.
427 with_gas=yes ;;
428
429 -help | --help | --hel | --he | -h)
430 ac_init_help=long ;;
431 -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
432 ac_init_help=recursive ;;
433 -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
434 ac_init_help=short ;;
435
436 -host | --host | --hos | --ho)
437 ac_prev=host_alias ;;
438 -host=* | --host=* | --hos=* | --ho=*)
439 host_alias=$ac_optarg ;;
440
441 -includedir | --includedir | --includedi | --included | --include \
442 | --includ | --inclu | --incl | --inc)
443 ac_prev=includedir ;;
444 -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
445 | --includ=* | --inclu=* | --incl=* | --inc=*)
446 includedir=$ac_optarg ;;
447
448 -infodir | --infodir | --infodi | --infod | --info | --inf)
449 ac_prev=infodir ;;
450 -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
451 infodir=$ac_optarg ;;
452
453 -libdir | --libdir | --libdi | --libd)
454 ac_prev=libdir ;;
455 -libdir=* | --libdir=* | --libdi=* | --libd=*)
456 libdir=$ac_optarg ;;
457
458 -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
459 | --libexe | --libex | --libe)
460 ac_prev=libexecdir ;;
461 -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
462 | --libexe=* | --libex=* | --libe=*)
463 libexecdir=$ac_optarg ;;
464
465 -localstatedir | --localstatedir | --localstatedi | --localstated \
466 | --localstate | --localstat | --localsta | --localst \
467 | --locals | --local | --loca | --loc | --lo)
468 ac_prev=localstatedir ;;
469 -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
470 | --localstate=* | --localstat=* | --localsta=* | --localst=* \
471 | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
472 localstatedir=$ac_optarg ;;
473
474 -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
475 ac_prev=mandir ;;
476 -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
477 mandir=$ac_optarg ;;
478
479 -nfp | --nfp | --nf)
480 # Obsolete; use --without-fp.
481 with_fp=no ;;
482
483 -no-create | --no-create | --no-creat | --no-crea | --no-cre \
484 | --no-cr | --no-c | -n)
485 no_create=yes ;;
486
487 -no-recursion | --no-recursion | --no-recursio | --no-recursi \
488 | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
489 no_recursion=yes ;;
490
491 -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
492 | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
493 | --oldin | --oldi | --old | --ol | --o)
494 ac_prev=oldincludedir ;;
495 -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
496 | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
497 | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
498 oldincludedir=$ac_optarg ;;
499
500 -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
501 ac_prev=prefix ;;
502 -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
503 prefix=$ac_optarg ;;
504
505 -program-prefix | --program-prefix | --program-prefi | --program-pref \
506 | --program-pre | --program-pr | --program-p)
507 ac_prev=program_prefix ;;
508 -program-prefix=* | --program-prefix=* | --program-prefi=* \
509 | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
510 program_prefix=$ac_optarg ;;
511
512 -program-suffix | --program-suffix | --program-suffi | --program-suff \
513 | --program-suf | --program-su | --program-s)
514 ac_prev=program_suffix ;;
515 -program-suffix=* | --program-suffix=* | --program-suffi=* \
516 | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
517 program_suffix=$ac_optarg ;;
518
519 -program-transform-name | --program-transform-name \
520 | --program-transform-nam | --program-transform-na \
521 | --program-transform-n | --program-transform- \
522 | --program-transform | --program-transfor \
523 | --program-transfo | --program-transf \
524 | --program-trans | --program-tran \
525 | --progr-tra | --program-tr | --program-t)
526 ac_prev=program_transform_name ;;
527 -program-transform-name=* | --program-transform-name=* \
528 | --program-transform-nam=* | --program-transform-na=* \
529 | --program-transform-n=* | --program-transform-=* \
530 | --program-transform=* | --program-transfor=* \
531 | --program-transfo=* | --program-transf=* \
532 | --program-trans=* | --program-tran=* \
533 | --progr-tra=* | --program-tr=* | --program-t=*)
534 program_transform_name=$ac_optarg ;;
535
536 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
537 | -silent | --silent | --silen | --sile | --sil)
538 silent=yes ;;
539
540 -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
541 ac_prev=sbindir ;;
542 -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
543 | --sbi=* | --sb=*)
544 sbindir=$ac_optarg ;;
545
546 -sharedstatedir | --sharedstatedir | --sharedstatedi \
547 | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
548 | --sharedst | --shareds | --shared | --share | --shar \
549 | --sha | --sh)
550 ac_prev=sharedstatedir ;;
551 -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
552 | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
553 | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
554 | --sha=* | --sh=*)
555 sharedstatedir=$ac_optarg ;;
556
557 -site | --site | --sit)
558 ac_prev=site ;;
559 -site=* | --site=* | --sit=*)
560 site=$ac_optarg ;;
561
562 -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
563 ac_prev=srcdir ;;
564 -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
565 srcdir=$ac_optarg ;;
566
567 -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
568 | --syscon | --sysco | --sysc | --sys | --sy)
569 ac_prev=sysconfdir ;;
570 -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
571 | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
572 sysconfdir=$ac_optarg ;;
573
574 -target | --target | --targe | --targ | --tar | --ta | --t)
575 ac_prev=target_alias ;;
576 -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
577 target_alias=$ac_optarg ;;
578
579 -v | -verbose | --verbose | --verbos | --verbo | --verb)
580 verbose=yes ;;
581
582 -version | --version | --versio | --versi | --vers | -V)
583 ac_init_version=: ;;
584
585 -with-* | --with-*)
586 ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
587 # Reject names that are not valid shell variable names.
588 expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
589 { echo "$as_me: error: invalid package name: $ac_package" >&2
590 { (exit 1); exit 1; }; }
591 ac_package=`echo $ac_package| sed 's/-/_/g'`
592 case $ac_option in
593 *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
594 *) ac_optarg=yes ;;
595 esac
596 eval "with_$ac_package='$ac_optarg'" ;;
597
598 -without-* | --without-*)
599 ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
600 # Reject names that are not valid shell variable names.
601 expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
602 { echo "$as_me: error: invalid package name: $ac_package" >&2
603 { (exit 1); exit 1; }; }
604 ac_package=`echo $ac_package | sed 's/-/_/g'`
605 eval "with_$ac_package=no" ;;
606
607 --x)
608 # Obsolete; use --with-x.
609 with_x=yes ;;
610
611 -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
612 | --x-incl | --x-inc | --x-in | --x-i)
613 ac_prev=x_includes ;;
614 -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
615 | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
616 x_includes=$ac_optarg ;;
617
618 -x-libraries | --x-libraries | --x-librarie | --x-librari \
619 | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
620 ac_prev=x_libraries ;;
621 -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
622 | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
623 x_libraries=$ac_optarg ;;
624
625 -*) { echo "$as_me: error: unrecognized option: $ac_option
626 Try \`$0 --help' for more information." >&2
627 { (exit 1); exit 1; }; }
628 ;;
629
630 *=*)
631 ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
632 # Reject names that are not valid shell variable names.
633 expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
634 { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
635 { (exit 1); exit 1; }; }
636 ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
637 eval "$ac_envvar='$ac_optarg'"
638 export $ac_envvar ;;
639
640 *)
641 # FIXME: should be removed in autoconf 3.0.
642 echo "$as_me: WARNING: you should use --build, --host, --target" >&2
643 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
644 echo "$as_me: WARNING: invalid host type: $ac_option" >&2
645 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
646 ;;
647
648 esac
649 done
650
651 if test -n "$ac_prev"; then
652 ac_option=--`echo $ac_prev | sed 's/_/-/g'`
653 { echo "$as_me: error: missing argument to $ac_option" >&2
654 { (exit 1); exit 1; }; }
655 fi
656
657 # Be sure to have absolute paths.
658 for ac_var in exec_prefix prefix
659 do
660 eval ac_val=$`echo $ac_var`
661 case $ac_val in
662 [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
663 *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
664 { (exit 1); exit 1; }; };;
665 esac
666 done
667
668 # Be sure to have absolute paths.
669 for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
670 localstatedir libdir includedir oldincludedir infodir mandir
671 do
672 eval ac_val=$`echo $ac_var`
673 case $ac_val in
674 [\\/$]* | ?:[\\/]* ) ;;
675 *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
676 { (exit 1); exit 1; }; };;
677 esac
678 done
679
680 # There might be people who depend on the old broken behavior: `$host'
681 # used to hold the argument of --host etc.
682 # FIXME: To remove some day.
683 build=$build_alias
684 host=$host_alias
685 target=$target_alias
686
687 # FIXME: To remove some day.
688 if test "x$host_alias" != x; then
689 if test "x$build_alias" = x; then
690 cross_compiling=maybe
691 echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
692 If a cross compiler is detected then cross compile mode will be used." >&2
693 elif test "x$build_alias" != "x$host_alias"; then
694 cross_compiling=yes
695 fi
696 fi
697
698 ac_tool_prefix=
699 test -n "$host_alias" && ac_tool_prefix=$host_alias-
700
701 test "$silent" = yes && exec 6>/dev/null
702
703
704 # Find the source files, if location was not specified.
705 if test -z "$srcdir"; then
706 ac_srcdir_defaulted=yes
707 # Try the directory containing this script, then its parent.
708 ac_confdir=`(dirname "$0") 2>/dev/null ||
709 $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
710 X"$0" : 'X\(//\)[^/]' \| \
711 X"$0" : 'X\(//\)$' \| \
712 X"$0" : 'X\(/\)' \| \
713 . : '\(.\)' 2>/dev/null ||
714 echo X"$0" |
715 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
716 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
717 /^X\(\/\/\)$/{ s//\1/; q; }
718 /^X\(\/\).*/{ s//\1/; q; }
719 s/.*/./; q'`
720 srcdir=$ac_confdir
721 if test ! -r $srcdir/$ac_unique_file; then
722 srcdir=..
723 fi
724 else
725 ac_srcdir_defaulted=no
726 fi
727 if test ! -r $srcdir/$ac_unique_file; then
728 if test "$ac_srcdir_defaulted" = yes; then
729 { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
730 { (exit 1); exit 1; }; }
731 else
732 { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
733 { (exit 1); exit 1; }; }
734 fi
735 fi
736 (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
737 { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
738 { (exit 1); exit 1; }; }
739 srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
740 ac_env_build_alias_set=${build_alias+set}
741 ac_env_build_alias_value=$build_alias
742 ac_cv_env_build_alias_set=${build_alias+set}
743 ac_cv_env_build_alias_value=$build_alias
744 ac_env_host_alias_set=${host_alias+set}
745 ac_env_host_alias_value=$host_alias
746 ac_cv_env_host_alias_set=${host_alias+set}
747 ac_cv_env_host_alias_value=$host_alias
748 ac_env_target_alias_set=${target_alias+set}
749 ac_env_target_alias_value=$target_alias
750 ac_cv_env_target_alias_set=${target_alias+set}
751 ac_cv_env_target_alias_value=$target_alias
752 ac_env_CC_set=${CC+set}
753 ac_env_CC_value=$CC
754 ac_cv_env_CC_set=${CC+set}
755 ac_cv_env_CC_value=$CC
756 ac_env_CFLAGS_set=${CFLAGS+set}
757 ac_env_CFLAGS_value=$CFLAGS
758 ac_cv_env_CFLAGS_set=${CFLAGS+set}
759 ac_cv_env_CFLAGS_value=$CFLAGS
760 ac_env_LDFLAGS_set=${LDFLAGS+set}
761 ac_env_LDFLAGS_value=$LDFLAGS
762 ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
763 ac_cv_env_LDFLAGS_value=$LDFLAGS
764 ac_env_CPPFLAGS_set=${CPPFLAGS+set}
765 ac_env_CPPFLAGS_value=$CPPFLAGS
766 ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
767 ac_cv_env_CPPFLAGS_value=$CPPFLAGS
768 ac_env_CPP_set=${CPP+set}
769 ac_env_CPP_value=$CPP
770 ac_cv_env_CPP_set=${CPP+set}
771 ac_cv_env_CPP_value=$CPP
772
773 #
774 # Report the --help message.
775 #
776 if test "$ac_init_help" = "long"; then
777 # Omit some internal or obsolete options to make the list less imposing.
778 # This message is too long to be a string in the A/UX 3.1 sh.
779 cat <<_ACEOF
780 \`configure' configures this package to adapt to many kinds of systems.
781
782 Usage: $0 [OPTION]... [VAR=VALUE]...
783
784 To assign environment variables (e.g., CC, CFLAGS...), specify them as
785 VAR=VALUE. See below for descriptions of some of the useful variables.
786
787 Defaults for the options are specified in brackets.
788
789 Configuration:
790 -h, --help display this help and exit
791 --help=short display options specific to this package
792 --help=recursive display the short help of all the included packages
793 -V, --version display version information and exit
794 -q, --quiet, --silent do not print \`checking...' messages
795 --cache-file=FILE cache test results in FILE [disabled]
796 -C, --config-cache alias for \`--cache-file=config.cache'
797 -n, --no-create do not create output files
798 --srcdir=DIR find the sources in DIR [configure dir or \`..']
799
800 _ACEOF
801
802 cat <<_ACEOF
803 Installation directories:
804 --prefix=PREFIX install architecture-independent files in PREFIX
805 [$ac_default_prefix]
806 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
807 [PREFIX]
808
809 By default, \`make install' will install all the files in
810 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
811 an installation prefix other than \`$ac_default_prefix' using \`--prefix',
812 for instance \`--prefix=\$HOME'.
813
814 For better control, use the options below.
815
816 Fine tuning of the installation directories:
817 --bindir=DIR user executables [EPREFIX/bin]
818 --sbindir=DIR system admin executables [EPREFIX/sbin]
819 --libexecdir=DIR program executables [EPREFIX/libexec]
820 --datadir=DIR read-only architecture-independent data [PREFIX/share]
821 --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
822 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
823 --localstatedir=DIR modifiable single-machine data [PREFIX/var]
824 --libdir=DIR object code libraries [EPREFIX/lib]
825 --includedir=DIR C header files [PREFIX/include]
826 --oldincludedir=DIR C header files for non-gcc [/usr/include]
827 --infodir=DIR info documentation [PREFIX/info]
828 --mandir=DIR man documentation [PREFIX/man]
829 _ACEOF
830
831 cat <<\_ACEOF
832
833 System types:
834 --build=BUILD configure for building on BUILD [guessed]
835 --host=HOST cross-compile to build programs to run on HOST [BUILD]
836 --target=TARGET configure for building compilers for TARGET [HOST]
837 _ACEOF
838 fi
839
840 if test -n "$ac_init_help"; then
841
842 cat <<\_ACEOF
843
844 Optional Features:
845 --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
846 --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
847 --enable-incode-epsg Use C code EPSG tables
848
849 Optional Packages:
850 --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
851 --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
852 --without-ld-shared Disable shared library support
853 --with-zip=dir Use ZIP library in directory dir
854 --with-jpeg=dir Use JPEG library in directory dir
855 --with-libtiff=dir Use libtiff in directory dir
856 --with-proj=ARG Use PROJ.4 library (ARG=no or path)
857
858 Some influential environment variables:
859 CC C compiler command
860 CFLAGS C compiler flags
861 LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
862 nonstandard directory <lib dir>
863 CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
864 headers in a nonstandard directory <include dir>
865 CPP C preprocessor
866
867 Use these variables to override the choices made by `configure' or to help
868 it to find libraries and programs with nonstandard names/locations.
869
870 _ACEOF
871 fi
872
873 if test "$ac_init_help" = "recursive"; then
874 # If there are subdirs, report their specific --help.
875 ac_popdir=`pwd`
876 for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
877 test -d $ac_dir || continue
878 ac_builddir=.
879
880 if test "$ac_dir" != .; then
881 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
882 # A "../" for each directory in $ac_dir_suffix.
883 ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
884 else
885 ac_dir_suffix= ac_top_builddir=
886 fi
887
888 case $srcdir in
889 .) # No --srcdir option. We are building in place.
890 ac_srcdir=.
891 if test -z "$ac_top_builddir"; then
892 ac_top_srcdir=.
893 else
894 ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
895 fi ;;
896 [\\/]* | ?:[\\/]* ) # Absolute path.
897 ac_srcdir=$srcdir$ac_dir_suffix;
898 ac_top_srcdir=$srcdir ;;
899 *) # Relative path.
900 ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
901 ac_top_srcdir=$ac_top_builddir$srcdir ;;
902 esac
903
904 # Do not use `cd foo && pwd` to compute absolute paths, because
905 # the directories may not exist.
906 case `pwd` in
907 .) ac_abs_builddir="$ac_dir";;
908 *)
909 case "$ac_dir" in
910 .) ac_abs_builddir=`pwd`;;
911 [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
912 *) ac_abs_builddir=`pwd`/"$ac_dir";;
913 esac;;
914 esac
915 case $ac_abs_builddir in
916 .) ac_abs_top_builddir=${ac_top_builddir}.;;
917 *)
918 case ${ac_top_builddir}. in
919 .) ac_abs_top_builddir=$ac_abs_builddir;;
920 [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
921 *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
922 esac;;
923 esac
924 case $ac_abs_builddir in
925 .) ac_abs_srcdir=$ac_srcdir;;
926 *)
927 case $ac_srcdir in
928 .) ac_abs_srcdir=$ac_abs_builddir;;
929 [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
930 *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
931 esac;;
932 esac
933 case $ac_abs_builddir in
934 .) ac_abs_top_srcdir=$ac_top_srcdir;;
935 *)
936 case $ac_top_srcdir in
937 .) ac_abs_top_srcdir=$ac_abs_builddir;;
938 [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
939 *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
940 esac;;
941 esac
942
943 cd $ac_dir
944 # Check for guested configure; otherwise get Cygnus style configure.
945 if test -f $ac_srcdir/configure.gnu; then
946 echo
947 $SHELL $ac_srcdir/configure.gnu --help=recursive
948 elif test -f $ac_srcdir/configure; then
949 echo
950 $SHELL $ac_srcdir/configure --help=recursive
951 elif test -f $ac_srcdir/configure.ac ||
952 test -f $ac_srcdir/configure.in; then
953 echo
954 $ac_configure --help
955 else
956 echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
957 fi
958 cd "$ac_popdir"
959 done
960 fi
961
962 test -n "$ac_init_help" && exit 0
963 if $ac_init_version; then
964 cat <<\_ACEOF
965
966 Copyright (C) 2003 Free Software Foundation, Inc.
967 This configure script is free software; the Free Software Foundation
968 gives unlimited permission to copy, distribute and modify it.
969 _ACEOF
970 exit 0
971 fi
972 exec 5>config.log
973 cat >&5 <<_ACEOF
974 This file contains any messages produced by compilers while
975 running configure, to aid debugging if configure makes a mistake.
976
977 It was created by $as_me, which was
978 generated by GNU Autoconf 2.59. Invocation command line was
979
980 $ $0 $@
981
982 _ACEOF
983 {
984 cat <<_ASUNAME
985 ## --------- ##
986 ## Platform. ##
987 ## --------- ##
988
989 hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
990 uname -m = `(uname -m) 2>/dev/null || echo unknown`
991 uname -r = `(uname -r) 2>/dev/null || echo unknown`
992 uname -s = `(uname -s) 2>/dev/null || echo unknown`
993 uname -v = `(uname -v) 2>/dev/null || echo unknown`
994
995 /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
996 /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
997
998 /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
999 /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
1000 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
1001 hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
1002 /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
1003 /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
1004 /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
1005
1006 _ASUNAME
1007
1008 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1009 for as_dir in $PATH
1010 do
1011 IFS=$as_save_IFS
1012 test -z "$as_dir" && as_dir=.
1013 echo "PATH: $as_dir"
1014 done
1015
1016 } >&5
1017
1018 cat >&5 <<_ACEOF
1019
1020
1021 ## ----------- ##
1022 ## Core tests. ##
1023 ## ----------- ##
1024
1025 _ACEOF
1026
1027
1028 # Keep a trace of the command line.
1029 # Strip out --no-create and --no-recursion so they do not pile up.
1030 # Strip out --silent because we don't want to record it for future runs.
1031 # Also quote any args containing shell meta-characters.
1032 # Make two passes to allow for proper duplicate-argument suppression.
1033 ac_configure_args=
1034 ac_configure_args0=
1035 ac_configure_args1=
1036 ac_sep=
1037 ac_must_keep_next=false
1038 for ac_pass in 1 2
1039 do
1040 for ac_arg
1041 do
1042 case $ac_arg in
1043 -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
1044 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
1045 | -silent | --silent | --silen | --sile | --sil)
1046 continue ;;
1047 *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
1048 ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
1049 esac
1050 case $ac_pass in
1051 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
1052 2)
1053 ac_configure_args1="$ac_configure_args1 '$ac_arg'"
1054 if test $ac_must_keep_next = true; then
1055 ac_must_keep_next=false # Got value, back to normal.
1056 else
1057 case $ac_arg in
1058 *=* | --config-cache | -C | -disable-* | --disable-* \
1059 | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
1060 | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
1061 | -with-* | --with-* | -without-* | --without-* | --x)
1062 case "$ac_configure_args0 " in
1063 "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
1064 esac
1065 ;;
1066 -* ) ac_must_keep_next=true ;;
1067 esac
1068 fi
1069 ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
1070 # Get rid of the leading space.
1071 ac_sep=" "
1072 ;;
1073 esac
1074 done
1075 done
1076 $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
1077 $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
1078
1079 # When interrupted or exit'd, cleanup temporary files, and complete
1080 # config.log. We remove comments because anyway the quotes in there
1081 # would cause problems or look ugly.
1082 # WARNING: Be sure not to use single quotes in there, as some shells,
1083 # such as our DU 5.0 friend, will then `close' the trap.
1084 trap 'exit_status=$?
1085 # Save into config.log some information that might help in debugging.
1086 {
1087 echo
1088
1089 cat <<\_ASBOX
1090 ## ---------------- ##
1091 ## Cache variables. ##
1092 ## ---------------- ##
1093 _ASBOX
1094 echo
1095 # The following way of writing the cache mishandles newlines in values,
1096 {
1097 (set) 2>&1 |
1098 case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
1099 *ac_space=\ *)
1100 sed -n \
1101 "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
1102 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
1103 ;;
1104 *)
1105 sed -n \
1106 "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
1107 ;;
1108 esac;
1109 }
1110 echo
1111
1112 cat <<\_ASBOX
1113 ## ----------------- ##
1114 ## Output variables. ##
1115 ## ----------------- ##
1116 _ASBOX
1117 echo
1118 for ac_var in $ac_subst_vars
1119 do
1120 eval ac_val=$`echo $ac_var`
1121 echo "$ac_var='"'"'$ac_val'"'"'"
1122 done | sort
1123 echo
1124
1125 if test -n "$ac_subst_files"; then
1126 cat <<\_ASBOX
1127 ## ------------- ##
1128 ## Output files. ##
1129 ## ------------- ##
1130 _ASBOX
1131 echo
1132 for ac_var in $ac_subst_files
1133 do
1134 eval ac_val=$`echo $ac_var`
1135 echo "$ac_var='"'"'$ac_val'"'"'"
1136 done | sort
1137 echo
1138 fi
1139
1140 if test -s confdefs.h; then
1141 cat <<\_ASBOX
1142 ## ----------- ##
1143 ## confdefs.h. ##
1144 ## ----------- ##
1145 _ASBOX
1146 echo
1147 sed "/^$/d" confdefs.h | sort
1148 echo
1149 fi
1150 test "$ac_signal" != 0 &&
1151 echo "$as_me: caught signal $ac_signal"
1152 echo "$as_me: exit $exit_status"
1153 } >&5
1154 rm -f core *.core &&
1155 rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
1156 exit $exit_status
1157 ' 0
1158 for ac_signal in 1 2 13 15; do
1159 trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
1160 done
1161 ac_signal=0
1162
1163 # confdefs.h avoids OS command line length limits that DEFS can exceed.
1164 rm -rf conftest* confdefs.h
1165 # AIX cpp loses on an empty file, so make sure it contains at least a newline.
1166 echo >confdefs.h
1167
1168 # Predefined preprocessor variables.
1169
1170 cat >>confdefs.h <<_ACEOF
1171 #define PACKAGE_NAME "$PACKAGE_NAME"
1172 _ACEOF
1173
1174
1175 cat >>confdefs.h <<_ACEOF
1176 #define PACKAGE_TARNAME "$PACKAGE_TARNAME"
1177 _ACEOF
1178
1179
1180 cat >>confdefs.h <<_ACEOF
1181 #define PACKAGE_VERSION "$PACKAGE_VERSION"
1182 _ACEOF
1183
1184
1185 cat >>confdefs.h <<_ACEOF
1186 #define PACKAGE_STRING "$PACKAGE_STRING"
1187 _ACEOF
1188
1189
1190 cat >>confdefs.h <<_ACEOF
1191 #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
1192 _ACEOF
1193
1194
1195 # Let the site file select an alternate cache file if it wants to.
1196 # Prefer explicitly selected file to automatically selected ones.
1197 if test -z "$CONFIG_SITE"; then
1198 if test "x$prefix" != xNONE; then
1199 CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
1200 else
1201 CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
1202 fi
1203 fi
1204 for ac_site_file in $CONFIG_SITE; do
1205 if test -r "$ac_site_file"; then
1206 { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
1207 echo "$as_me: loading site script $ac_site_file" >&6;}
1208 sed 's/^/| /' "$ac_site_file" >&5
1209 . "$ac_site_file"
1210 fi
1211 done
1212
1213 if test -r "$cache_file"; then
1214 # Some versions of bash will fail to source /dev/null (special
1215 # files actually), so we avoid doing that.
1216 if test -f "$cache_file"; then
1217 { echo "$as_me:$LINENO: loading cache $cache_file" >&5
1218 echo "$as_me: loading cache $cache_file" >&6;}
1219 case $cache_file in
1220 [\\/]* | ?:[\\/]* ) . $cache_file;;
1221 *) . ./$cache_file;;
1222 esac
1223 fi
1224 else
1225 { echo "$as_me:$LINENO: creating cache $cache_file" >&5
1226 echo "$as_me: creating cache $cache_file" >&6;}
1227 >$cache_file
1228 fi
1229
1230 # Check that the precious variables saved in the cache have kept the same
1231 # value.
1232 ac_cache_corrupted=false
1233 for ac_var in `(set) 2>&1 |
1234 sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
1235 eval ac_old_set=\$ac_cv_env_${ac_var}_set
1236 eval ac_new_set=\$ac_env_${ac_var}_set
1237 eval ac_old_val="\$ac_cv_env_${ac_var}_value"
1238 eval ac_new_val="\$ac_env_${ac_var}_value"
1239 case $ac_old_set,$ac_new_set in
1240 set,)
1241 { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
1242 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
1243 ac_cache_corrupted=: ;;
1244 ,set)
1245 { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
1246 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
1247 ac_cache_corrupted=: ;;
1248 ,);;
1249 *)
1250 if test "x$ac_old_val" != "x$ac_new_val"; then
1251 { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
1252 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
1253 { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
1254 echo "$as_me: former value: $ac_old_val" >&2;}
1255 { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
1256 echo "$as_me: current value: $ac_new_val" >&2;}
1257 ac_cache_corrupted=:
1258 fi;;
1259 esac
1260 # Pass precious variables to config.status.
1261 if test "$ac_new_set" = set; then
1262 case $ac_new_val in
1263 *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
1264 ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
1265 *) ac_arg=$ac_var=$ac_new_val ;;
1266 esac
1267 case " $ac_configure_args " in
1268 *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
1269 *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
1270 esac
1271 fi
1272 done
1273 if $ac_cache_corrupted; then
1274 { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
1275 echo "$as_me: error: changes in the environment can compromise the build" >&2;}
1276 { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
1277 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
1278 { (exit 1); exit 1; }; }
1279 fi
1280
1281 ac_ext=c
1282 ac_cpp='$CPP $CPPFLAGS'
1283 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
1284 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
1285 ac_compiler_gnu=$ac_cv_c_compiler_gnu
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305 ac_config_headers="$ac_config_headers geo_config.h"
1306
1307 ac_aux_dir=
1308 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
1309 if test -f $ac_dir/install-sh; then
1310 ac_aux_dir=$ac_dir
1311 ac_install_sh="$ac_aux_dir/install-sh -c"
1312 break
1313 elif test -f $ac_dir/install.sh; then
1314 ac_aux_dir=$ac_dir
1315 ac_install_sh="$ac_aux_dir/install.sh -c"
1316 break
1317 elif test -f $ac_dir/shtool; then
1318 ac_aux_dir=$ac_dir
1319 ac_install_sh="$ac_aux_dir/shtool install -c"
1320 break
1321 fi
1322 done
1323 if test -z "$ac_aux_dir"; then
1324 { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
1325 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
1326 { (exit 1); exit 1; }; }
1327 fi
1328 ac_config_guess="$SHELL $ac_aux_dir/config.guess"
1329 ac_config_sub="$SHELL $ac_aux_dir/config.sub"
1330 ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
1331
1332 # Make sure we can run config.sub.
1333 $ac_config_sub sun4 >/dev/null 2>&1 ||
1334 { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
1335 echo "$as_me: error: cannot run $ac_config_sub" >&2;}
1336 { (exit 1); exit 1; }; }
1337
1338 echo "$as_me:$LINENO: checking build system type" >&5
1339 echo $ECHO_N "checking build system type... $ECHO_C" >&6
1340 if test "${ac_cv_build+set}" = set; then
1341 echo $ECHO_N "(cached) $ECHO_C" >&6
1342 else
1343 ac_cv_build_alias=$build_alias
1344 test -z "$ac_cv_build_alias" &&
1345 ac_cv_build_alias=`$ac_config_guess`
1346 test -z "$ac_cv_build_alias" &&
1347 { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
1348 echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
1349 { (exit 1); exit 1; }; }
1350 ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
1351 { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
1352 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
1353 { (exit 1); exit 1; }; }
1354
1355 fi
1356 echo "$as_me:$LINENO: result: $ac_cv_build" >&5
1357 echo "${ECHO_T}$ac_cv_build" >&6
1358 build=$ac_cv_build
1359 build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
1360 build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
1361 build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
1362
1363
1364 echo "$as_me:$LINENO: checking host system type" >&5
1365 echo $ECHO_N "checking host system type... $ECHO_C" >&6
1366 if test "${ac_cv_host+set}" = set; then
1367 echo $ECHO_N "(cached) $ECHO_C" >&6
1368 else
1369 ac_cv_host_alias=$host_alias
1370 test -z "$ac_cv_host_alias" &&
1371 ac_cv_host_alias=$ac_cv_build_alias
1372 ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
1373 { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
1374 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
1375 { (exit 1); exit 1; }; }
1376
1377 fi
1378 echo "$as_me:$LINENO: result: $ac_cv_host" >&5
1379 echo "${ECHO_T}$ac_cv_host" >&6
1380 host=$ac_cv_host
1381 host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
1382 host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
1383 host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
1384
1385
1386 echo "$as_me:$LINENO: checking target system type" >&5
1387 echo $ECHO_N "checking target system type... $ECHO_C" >&6
1388 if test "${ac_cv_target+set}" = set; then
1389 echo $ECHO_N "(cached) $ECHO_C" >&6
1390 else
1391 ac_cv_target_alias=$target_alias
1392 test "x$ac_cv_target_alias" = "x" &&
1393 ac_cv_target_alias=$ac_cv_host_alias
1394 ac_cv_target=`$ac_config_sub $ac_cv_target_alias` ||
1395 { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5
1396 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;}
1397 { (exit 1); exit 1; }; }
1398
1399 fi
1400 echo "$as_me:$LINENO: result: $ac_cv_target" >&5
1401 echo "${ECHO_T}$ac_cv_target" >&6
1402 target=$ac_cv_target
1403 target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
1404 target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
1405 target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
1406
1407
1408 # The aliases save the names the user supplied, while $host etc.
1409 # will get canonicalized.
1410 test -n "$target_alias" &&
1411 test "$program_prefix$program_suffix$program_transform_name" = \
1412 NONENONEs,x,x, &&
1413 program_prefix=${target_alias}-
1414
1415 VERSION_MAJOR=1
1416 VERSION_MINOR=2
1417 VERSION_POINT=4
1418 VERSION_MAJOR=$VERSION_MAJOR
1419
1420 VERSION_MINOR=$VERSION_MINOR
1421
1422 VERSION_POINT=$VERSION_POINT
1423
1424
1425 ac_ext=c
1426 ac_cpp='$CPP $CPPFLAGS'
1427 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
1428 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
1429 ac_compiler_gnu=$ac_cv_c_compiler_gnu
1430 if test -n "$ac_tool_prefix"; then
1431 # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
1432 set dummy ${ac_tool_prefix}gcc; ac_word=$2
1433 echo "$as_me:$LINENO: checking for $ac_word" >&5
1434 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1435 if test "${ac_cv_prog_CC+set}" = set; then
1436 echo $ECHO_N "(cached) $ECHO_C" >&6
1437 else
1438 if test -n "$CC"; then
1439 ac_cv_prog_CC="$CC" # Let the user override the test.
1440 else
1441 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1442 for as_dir in $PATH
1443 do
1444 IFS=$as_save_IFS
1445 test -z "$as_dir" && as_dir=.
1446 for ac_exec_ext in '' $ac_executable_extensions; do
1447 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1448 ac_cv_prog_CC="${ac_tool_prefix}gcc"
1449 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1450 break 2
1451 fi
1452 done
1453 done
1454
1455 fi
1456 fi
1457 CC=$ac_cv_prog_CC
1458 if test -n "$CC"; then
1459 echo "$as_me:$LINENO: result: $CC" >&5
1460 echo "${ECHO_T}$CC" >&6
1461 else
1462 echo "$as_me:$LINENO: result: no" >&5
1463 echo "${ECHO_T}no" >&6
1464 fi
1465
1466 fi
1467 if test -z "$ac_cv_prog_CC"; then
1468 ac_ct_CC=$CC
1469 # Extract the first word of "gcc", so it can be a program name with args.
1470 set dummy gcc; ac_word=$2
1471 echo "$as_me:$LINENO: checking for $ac_word" >&5
1472 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1473 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
1474 echo $ECHO_N "(cached) $ECHO_C" >&6
1475 else
1476 if test -n "$ac_ct_CC"; then
1477 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
1478 else
1479 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1480 for as_dir in $PATH
1481 do
1482 IFS=$as_save_IFS
1483 test -z "$as_dir" && as_dir=.
1484 for ac_exec_ext in '' $ac_executable_extensions; do
1485 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1486 ac_cv_prog_ac_ct_CC="gcc"
1487 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1488 break 2
1489 fi
1490 done
1491 done
1492
1493 fi
1494 fi
1495 ac_ct_CC=$ac_cv_prog_ac_ct_CC
1496 if test -n "$ac_ct_CC"; then
1497 echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
1498 echo "${ECHO_T}$ac_ct_CC" >&6
1499 else
1500 echo "$as_me:$LINENO: result: no" >&5
1501 echo "${ECHO_T}no" >&6
1502 fi
1503
1504 CC=$ac_ct_CC
1505 else
1506 CC="$ac_cv_prog_CC"
1507 fi
1508
1509 if test -z "$CC"; then
1510 if test -n "$ac_tool_prefix"; then
1511 # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
1512 set dummy ${ac_tool_prefix}cc; ac_word=$2
1513 echo "$as_me:$LINENO: checking for $ac_word" >&5
1514 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1515 if test "${ac_cv_prog_CC+set}" = set; then
1516 echo $ECHO_N "(cached) $ECHO_C" >&6
1517 else
1518 if test -n "$CC"; then
1519 ac_cv_prog_CC="$CC" # Let the user override the test.
1520 else
1521 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1522 for as_dir in $PATH
1523 do
1524 IFS=$as_save_IFS
1525 test -z "$as_dir" && as_dir=.
1526 for ac_exec_ext in '' $ac_executable_extensions; do
1527 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1528 ac_cv_prog_CC="${ac_tool_prefix}cc"
1529 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1530 break 2
1531 fi
1532 done
1533 done
1534
1535 fi
1536 fi
1537 CC=$ac_cv_prog_CC
1538 if test -n "$CC"; then
1539 echo "$as_me:$LINENO: result: $CC" >&5
1540 echo "${ECHO_T}$CC" >&6
1541 else
1542 echo "$as_me:$LINENO: result: no" >&5
1543 echo "${ECHO_T}no" >&6
1544 fi
1545
1546 fi
1547 if test -z "$ac_cv_prog_CC"; then
1548 ac_ct_CC=$CC
1549 # Extract the first word of "cc", so it can be a program name with args.
1550 set dummy cc; ac_word=$2
1551 echo "$as_me:$LINENO: checking for $ac_word" >&5
1552 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1553 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
1554 echo $ECHO_N "(cached) $ECHO_C" >&6
1555 else
1556 if test -n "$ac_ct_CC"; then
1557 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
1558 else
1559 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1560 for as_dir in $PATH
1561 do
1562 IFS=$as_save_IFS
1563 test -z "$as_dir" && as_dir=.
1564 for ac_exec_ext in '' $ac_executable_extensions; do
1565 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1566 ac_cv_prog_ac_ct_CC="cc"
1567 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1568 break 2
1569 fi
1570 done
1571 done
1572
1573 fi
1574 fi
1575 ac_ct_CC=$ac_cv_prog_ac_ct_CC
1576 if test -n "$ac_ct_CC"; then
1577 echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
1578 echo "${ECHO_T}$ac_ct_CC" >&6
1579 else
1580 echo "$as_me:$LINENO: result: no" >&5
1581 echo "${ECHO_T}no" >&6
1582 fi
1583
1584 CC=$ac_ct_CC
1585 else
1586 CC="$ac_cv_prog_CC"
1587 fi
1588
1589 fi
1590 if test -z "$CC"; then
1591 # Extract the first word of "cc", so it can be a program name with args.
1592 set dummy cc; ac_word=$2
1593 echo "$as_me:$LINENO: checking for $ac_word" >&5
1594 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1595 if test "${ac_cv_prog_CC+set}" = set; then
1596 echo $ECHO_N "(cached) $ECHO_C" >&6
1597 else
1598 if test -n "$CC"; then
1599 ac_cv_prog_CC="$CC" # Let the user override the test.
1600 else
1601 ac_prog_rejected=no
1602 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1603 for as_dir in $PATH
1604 do
1605 IFS=$as_save_IFS
1606 test -z "$as_dir" && as_dir=.
1607 for ac_exec_ext in '' $ac_executable_extensions; do
1608 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1609 if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
1610 ac_prog_rejected=yes
1611 continue
1612 fi
1613 ac_cv_prog_CC="cc"
1614 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1615 break 2
1616 fi
1617 done
1618 done
1619
1620 if test $ac_prog_rejected = yes; then
1621 # We found a bogon in the path, so make sure we never use it.
1622 set dummy $ac_cv_prog_CC
1623 shift
1624 if test $# != 0; then
1625 # We chose a different compiler from the bogus one.
1626 # However, it has the same basename, so the bogon will be chosen
1627 # first if we set CC to just the basename; use the full file name.
1628 shift
1629 ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
1630 fi
1631 fi
1632 fi
1633 fi
1634 CC=$ac_cv_prog_CC
1635 if test -n "$CC"; then
1636 echo "$as_me:$LINENO: result: $CC" >&5
1637 echo "${ECHO_T}$CC" >&6
1638 else
1639 echo "$as_me:$LINENO: result: no" >&5
1640 echo "${ECHO_T}no" >&6
1641 fi
1642
1643 fi
1644 if test -z "$CC"; then
1645 if test -n "$ac_tool_prefix"; then
1646 for ac_prog in cl
1647 do
1648 # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
1649 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
1650 echo "$as_me:$LINENO: checking for $ac_word" >&5
1651 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1652 if test "${ac_cv_prog_CC+set}" = set; then
1653 echo $ECHO_N "(cached) $ECHO_C" >&6
1654 else
1655 if test -n "$CC"; then
1656 ac_cv_prog_CC="$CC" # Let the user override the test.
1657 else
1658 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1659 for as_dir in $PATH
1660 do
1661 IFS=$as_save_IFS
1662 test -z "$as_dir" && as_dir=.
1663 for ac_exec_ext in '' $ac_executable_extensions; do
1664 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1665 ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
1666 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1667 break 2
1668 fi
1669 done
1670 done
1671
1672 fi
1673 fi
1674 CC=$ac_cv_prog_CC
1675 if test -n "$CC"; then
1676 echo "$as_me:$LINENO: result: $CC" >&5
1677 echo "${ECHO_T}$CC" >&6
1678 else
1679 echo "$as_me:$LINENO: result: no" >&5
1680 echo "${ECHO_T}no" >&6
1681 fi
1682
1683 test -n "$CC" && break
1684 done
1685 fi
1686 if test -z "$CC"; then
1687 ac_ct_CC=$CC
1688 for ac_prog in cl
1689 do
1690 # Extract the first word of "$ac_prog", so it can be a program name with args.
1691 set dummy $ac_prog; ac_word=$2
1692 echo "$as_me:$LINENO: checking for $ac_word" >&5
1693 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
1694 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
1695 echo $ECHO_N "(cached) $ECHO_C" >&6
1696 else
1697 if test -n "$ac_ct_CC"; then
1698 ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
1699 else
1700 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
1701 for as_dir in $PATH
1702 do
1703 IFS=$as_save_IFS
1704 test -z "$as_dir" && as_dir=.
1705 for ac_exec_ext in '' $ac_executable_extensions; do
1706 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
1707 ac_cv_prog_ac_ct_CC="$ac_prog"
1708 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
1709 break 2
1710 fi
1711 done
1712 done
1713
1714 fi
1715 fi
1716 ac_ct_CC=$ac_cv_prog_ac_ct_CC
1717 if test -n "$ac_ct_CC"; then
1718 echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
1719 echo "${ECHO_T}$ac_ct_CC" >&6
1720 else
1721 echo "$as_me:$LINENO: result: no" >&5
1722 echo "${ECHO_T}no" >&6
1723 fi
1724
1725 test -n "$ac_ct_CC" && break
1726 done
1727
1728 CC=$ac_ct_CC
1729 fi
1730
1731 fi
1732
1733
1734 test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
1735 See \`config.log' for more details." >&5
1736 echo "$as_me: error: no acceptable C compiler found in \$PATH
1737 See \`config.log' for more details." >&2;}
1738 { (exit 1); exit 1; }; }
1739
1740 # Provide some information about the compiler.
1741 echo "$as_me:$LINENO:" \
1742 "checking for C compiler version" >&5
1743 ac_compiler=`set X $ac_compile; echo $2`
1744 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
1745 (eval $ac_compiler --version </dev/null >&5) 2>&5
1746 ac_status=$?
1747 echo "$as_me:$LINENO: \$? = $ac_status" >&5
1748 (exit $ac_status); }
1749 { (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
1750 (eval $ac_compiler -v </dev/null >&5) 2>&5
1751 ac_status=$?
1752 echo "$as_me:$LINENO: \$? = $ac_status" >&5
1753 (exit $ac_status); }
1754 { (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
1755 (eval $ac_compiler -V </dev/null >&5) 2>&5
1756 ac_status=$?
1757 echo "$as_me:$LINENO: \$? = $ac_status" >&5
1758 (exit $ac_status); }
1759
1760 cat >conftest.$ac_ext <<_ACEOF
1761 /* confdefs.h. */
1762 _ACEOF
1763 cat confdefs.h >>conftest.$ac_ext
1764 cat >>conftest.$ac_ext <<_ACEOF
1765 /* end confdefs.h. */
1766
1767 int
1768 main ()
1769 {
1770
1771 ;
1772 return 0;
1773 }
1774 _ACEOF
1775 ac_clean_files_save=$ac_clean_files
1776 ac_clean_files="$ac_clean_files a.out a.exe b.out"
1777 # Try to create an executable without -o first, disregard a.out.
1778 # It will help us diagnose broken compilers, and finding out an intuition
1779 # of exeext.
1780 echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
1781 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6
1782 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
1783 if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
1784 (eval $ac_link_default) 2>&5
1785 ac_status=$?
1786 echo "$as_me:$LINENO: \$? = $ac_status" >&5
1787 (exit $ac_status); }; then
1788 # Find the output, starting from the most likely. This scheme is
1789 # not robust to junk in `.', hence go to wildcards (a.*) only as a last
1790 # resort.
1791
1792 # Be careful to initialize this variable, since it used to be cached.
1793 # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
1794 ac_cv_exeext=
1795 # b.out is created by i960 compilers.
1796 for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
1797 do
1798 test -f "$ac_file" || continue
1799 case $ac_file in
1800 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
1801 ;;
1802 conftest.$ac_ext )
1803 # This is the source file.
1804 ;;
1805 [ab].out )
1806 # We found the default executable, but exeext='' is most
1807 # certainly right.
1808 break;;
1809 *.* )
1810 ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
1811 # FIXME: I believe we export ac_cv_exeext for Libtool,
1812 # but it would be cool to find out if it's true. Does anybody
1813 # maintain Libtool? --akim.
1814 export ac_cv_exeext
1815 break;;
1816 * )
1817 break;;
1818 esac
1819 done
1820 else
1821 echo "$as_me: failed program was:" >&5
1822 sed 's/^/| /' conftest.$ac_ext >&5
1823
1824 { { echo "$as_me:$LINENO: error: C compiler cannot create executables
1825 See \`config.log' for more details." >&5
1826 echo "$as_me: error: C compiler cannot create executables
1827 See \`config.log' for more details." >&2;}
1828 { (exit 77); exit 77; }; }
1829 fi
1830
1831 ac_exeext=$ac_cv_exeext
1832 echo "$as_me:$LINENO: result: $ac_file" >&5
1833 echo "${ECHO_T}$ac_file" >&6
1834
1835 # Check the compiler produces executables we can run. If not, either
1836 # the compiler is broken, or we cross compile.
1837 echo "$as_me:$LINENO: checking whether the C compiler works" >&5
1838 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
1839 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
1840 # If not cross compiling, check that we can run a simple program.
1841 if test "$cross_compiling" != yes; then
1842 if { ac_try='./$ac_file'
1843 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1844 (eval $ac_try) 2>&5
1845 ac_status=$?
1846 echo "$as_me:$LINENO: \$? = $ac_status" >&5
1847 (exit $ac_status); }; }; then
1848 cross_compiling=no
1849 else
1850 if test "$cross_compiling" = maybe; then
1851 cross_compiling=yes
1852 else
1853 { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
1854 If you meant to cross compile, use \`--host'.
1855 See \`config.log' for more details." >&5
1856 echo "$as_me: error: cannot run C compiled programs.
1857 If you meant to cross compile, use \`--host'.
1858 See \`config.log' for more details." >&2;}
1859 { (exit 1); exit 1; }; }
1860 fi
1861 fi
1862 fi
1863 echo "$as_me:$LINENO: result: yes" >&5
1864 echo "${ECHO_T}yes" >&6
1865
1866 rm -f a.out a.exe conftest$ac_cv_exeext b.out
1867 ac_clean_files=$ac_clean_files_save
1868 # Check the compiler produces executables we can run. If not, either
1869 # the compiler is broken, or we cross compile.
1870 echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
1871 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
1872 echo "$as_me:$LINENO: result: $cross_compiling" >&5
1873 echo "${ECHO_T}$cross_compiling" >&6
1874
1875 echo "$as_me:$LINENO: checking for suffix of executables" >&5
1876 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
1877 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
1878 (eval $ac_link) 2>&5
1879 ac_status=$?
1880 echo "$as_me:$LINENO: \$? = $ac_status" >&5
1881 (exit $ac_status); }; then
1882 # If both `conftest.exe' and `conftest' are `present' (well, observable)
1883 # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
1884 # work properly (i.e., refer to `conftest.exe'), while it won't with
1885 # `rm'.
1886 for ac_file in conftest.exe conftest conftest.*; do
1887 test -f "$ac_file" || continue
1888 case $ac_file in
1889 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
1890 *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
1891 export ac_cv_exeext
1892 break;;
1893 * ) break;;
1894 esac
1895 done
1896 else
1897 { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
1898 See \`config.log' for more details." >&5
1899 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
1900 See \`config.log' for more details." >&2;}
1901 { (exit 1); exit 1; }; }
1902 fi
1903
1904 rm -f conftest$ac_cv_exeext
1905 echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
1906 echo "${ECHO_T}$ac_cv_exeext" >&6
1907
1908 rm -f conftest.$ac_ext
1909 EXEEXT=$ac_cv_exeext
1910 ac_exeext=$EXEEXT
1911 echo "$as_me:$LINENO: checking for suffix of object files" >&5
1912 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
1913 if test "${ac_cv_objext+set}" = set; then
1914 echo $ECHO_N "(cached) $ECHO_C" >&6
1915 else
1916 cat >conftest.$ac_ext <<_ACEOF
1917 /* confdefs.h. */
1918 _ACEOF
1919 cat confdefs.h >>conftest.$ac_ext
1920 cat >>conftest.$ac_ext <<_ACEOF
1921 /* end confdefs.h. */
1922
1923 int
1924 main ()
1925 {
1926
1927 ;
1928 return 0;
1929 }
1930 _ACEOF
1931 rm -f conftest.o conftest.obj
1932 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
1933 (eval $ac_compile) 2>&5
1934 ac_status=$?
1935 echo "$as_me:$LINENO: \$? = $ac_status" >&5
1936 (exit $ac_status); }; then
1937 for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
1938 case $ac_file in
1939 *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
1940 *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
1941 break;;
1942 esac
1943 done
1944 else
1945 echo "$as_me: failed program was:" >&5
1946 sed 's/^/| /' conftest.$ac_ext >&5
1947
1948 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
1949 See \`config.log' for more details." >&5
1950 echo "$as_me: error: cannot compute suffix of object files: cannot compile
1951 See \`config.log' for more details." >&2;}
1952 { (exit 1); exit 1; }; }
1953 fi
1954
1955 rm -f conftest.$ac_cv_objext conftest.$ac_ext
1956 fi
1957 echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
1958 echo "${ECHO_T}$ac_cv_objext" >&6
1959 OBJEXT=$ac_cv_objext
1960 ac_objext=$OBJEXT
1961 echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
1962 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
1963 if test "${ac_cv_c_compiler_gnu+set}" = set; then
1964 echo $ECHO_N "(cached) $ECHO_C" >&6
1965 else
1966 cat >conftest.$ac_ext <<_ACEOF
1967 /* confdefs.h. */
1968 _ACEOF
1969 cat confdefs.h >>conftest.$ac_ext
1970 cat >>conftest.$ac_ext <<_ACEOF
1971 /* end confdefs.h. */
1972
1973 int
1974 main ()
1975 {
1976 #ifndef __GNUC__
1977 choke me
1978 #endif
1979
1980 ;
1981 return 0;
1982 }
1983 _ACEOF
1984 rm -f conftest.$ac_objext
1985 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
1986 (eval $ac_compile) 2>conftest.er1
1987 ac_status=$?
1988 grep -v '^ *+' conftest.er1 >conftest.err
1989 rm -f conftest.er1
1990 cat conftest.err >&5
1991 echo "$as_me:$LINENO: \$? = $ac_status" >&5
1992 (exit $ac_status); } &&
1993 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
1994 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
1995 (eval $ac_try) 2>&5
1996 ac_status=$?
1997 echo "$as_me:$LINENO: \$? = $ac_status" >&5
1998 (exit $ac_status); }; } &&
1999 { ac_try='test -s conftest.$ac_objext'
2000 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2001 (eval $ac_try) 2>&5
2002 ac_status=$?
2003 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2004 (exit $ac_status); }; }; then
2005 ac_compiler_gnu=yes
2006 else
2007 echo "$as_me: failed program was:" >&5
2008 sed 's/^/| /' conftest.$ac_ext >&5
2009
2010 ac_compiler_gnu=no
2011 fi
2012 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2013 ac_cv_c_compiler_gnu=$ac_compiler_gnu
2014
2015 fi
2016 echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
2017 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
2018 GCC=`test $ac_compiler_gnu = yes && echo yes`
2019 ac_test_CFLAGS=${CFLAGS+set}
2020 ac_save_CFLAGS=$CFLAGS
2021 CFLAGS="-g"
2022 echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
2023 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
2024 if test "${ac_cv_prog_cc_g+set}" = set; then
2025 echo $ECHO_N "(cached) $ECHO_C" >&6
2026 else
2027 cat >conftest.$ac_ext <<_ACEOF
2028 /* confdefs.h. */
2029 _ACEOF
2030 cat confdefs.h >>conftest.$ac_ext
2031 cat >>conftest.$ac_ext <<_ACEOF
2032 /* end confdefs.h. */
2033
2034 int
2035 main ()
2036 {
2037
2038 ;
2039 return 0;
2040 }
2041 _ACEOF
2042 rm -f conftest.$ac_objext
2043 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2044 (eval $ac_compile) 2>conftest.er1
2045 ac_status=$?
2046 grep -v '^ *+' conftest.er1 >conftest.err
2047 rm -f conftest.er1
2048 cat conftest.err >&5
2049 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2050 (exit $ac_status); } &&
2051 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2052 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2053 (eval $ac_try) 2>&5
2054 ac_status=$?
2055 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2056 (exit $ac_status); }; } &&
2057 { ac_try='test -s conftest.$ac_objext'
2058 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2059 (eval $ac_try) 2>&5
2060 ac_status=$?
2061 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2062 (exit $ac_status); }; }; then
2063 ac_cv_prog_cc_g=yes
2064 else
2065 echo "$as_me: failed program was:" >&5
2066 sed 's/^/| /' conftest.$ac_ext >&5
2067
2068 ac_cv_prog_cc_g=no
2069 fi
2070 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2071 fi
2072 echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
2073 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
2074 if test "$ac_test_CFLAGS" = set; then
2075 CFLAGS=$ac_save_CFLAGS
2076 elif test $ac_cv_prog_cc_g = yes; then
2077 if test "$GCC" = yes; then
2078 CFLAGS="-g -O2"
2079 else
2080 CFLAGS="-g"
2081 fi
2082 else
2083 if test "$GCC" = yes; then
2084 CFLAGS="-O2"
2085 else
2086 CFLAGS=
2087 fi
2088 fi
2089 echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
2090 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
2091 if test "${ac_cv_prog_cc_stdc+set}" = set; then
2092 echo $ECHO_N "(cached) $ECHO_C" >&6
2093 else
2094 ac_cv_prog_cc_stdc=no
2095 ac_save_CC=$CC
2096 cat >conftest.$ac_ext <<_ACEOF
2097 /* confdefs.h. */
2098 _ACEOF
2099 cat confdefs.h >>conftest.$ac_ext
2100 cat >>conftest.$ac_ext <<_ACEOF
2101 /* end confdefs.h. */
2102 #include <stdarg.h>
2103 #include <stdio.h>
2104 #include <sys/types.h>
2105 #include <sys/stat.h>
2106 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
2107 struct buf { int x; };
2108 FILE * (*rcsopen) (struct buf *, struct stat *, int);
2109 static char *e (p, i)
2110 char **p;
2111 int i;
2112 {
2113 return p[i];
2114 }
2115 static char *f (char * (*g) (char **, int), char **p, ...)
2116 {
2117 char *s;
2118 va_list v;
2119 va_start (v,p);
2120 s = g (p, va_arg (v,int));
2121 va_end (v);
2122 return s;
2123 }
2124
2125 /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
2126 function prototypes and stuff, but not '\xHH' hex character constants.
2127 These don't provoke an error unfortunately, instead are silently treated
2128 as 'x'. The following induces an error, until -std1 is added to get
2129 proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
2130 array size at least. It's necessary to write '\x00'==0 to get something
2131 that's true only with -std1. */
2132 int osf4_cc_array ['\x00' == 0 ? 1 : -1];
2133
2134 int test (int i, double x);
2135 struct s1 {int (*f) (int a);};
2136 struct s2 {int (*f) (double a);};
2137 int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
2138 int argc;
2139 char **argv;
2140 int
2141 main ()
2142 {
2143 return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
2144 ;
2145 return 0;
2146 }
2147 _ACEOF
2148 # Don't try gcc -ansi; that turns off useful extensions and
2149 # breaks some systems' header files.
2150 # AIX -qlanglvl=ansi
2151 # Ultrix and OSF/1 -std1
2152 # HP-UX 10.20 and later -Ae
2153 # HP-UX older versions -Aa -D_HPUX_SOURCE
2154 # SVR4 -Xc -D__EXTENSIONS__
2155 for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
2156 do
2157 CC="$ac_save_CC $ac_arg"
2158 rm -f conftest.$ac_objext
2159 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2160 (eval $ac_compile) 2>conftest.er1
2161 ac_status=$?
2162 grep -v '^ *+' conftest.er1 >conftest.err
2163 rm -f conftest.er1
2164 cat conftest.err >&5
2165 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2166 (exit $ac_status); } &&
2167 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2168 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2169 (eval $ac_try) 2>&5
2170 ac_status=$?
2171 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2172 (exit $ac_status); }; } &&
2173 { ac_try='test -s conftest.$ac_objext'
2174 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2175 (eval $ac_try) 2>&5
2176 ac_status=$?
2177 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2178 (exit $ac_status); }; }; then
2179 ac_cv_prog_cc_stdc=$ac_arg
2180 break
2181 else
2182 echo "$as_me: failed program was:" >&5
2183 sed 's/^/| /' conftest.$ac_ext >&5
2184
2185 fi
2186 rm -f conftest.err conftest.$ac_objext
2187 done
2188 rm -f conftest.$ac_ext conftest.$ac_objext
2189 CC=$ac_save_CC
2190
2191 fi
2192
2193 case "x$ac_cv_prog_cc_stdc" in
2194 x|xno)
2195 echo "$as_me:$LINENO: result: none needed" >&5
2196 echo "${ECHO_T}none needed" >&6 ;;
2197 *)
2198 echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
2199 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
2200 CC="$CC $ac_cv_prog_cc_stdc" ;;
2201 esac
2202
2203 # Some people use a C++ compiler to compile C. Since we use `exit',
2204 # in C++ we need to declare it. In case someone uses the same compiler
2205 # for both compiling C and C++ we need to have the C++ compiler decide
2206 # the declaration of exit, since it's the most demanding environment.
2207 cat >conftest.$ac_ext <<_ACEOF
2208 #ifndef __cplusplus
2209 choke me
2210 #endif
2211 _ACEOF
2212 rm -f conftest.$ac_objext
2213 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2214 (eval $ac_compile) 2>conftest.er1
2215 ac_status=$?
2216 grep -v '^ *+' conftest.er1 >conftest.err
2217 rm -f conftest.er1
2218 cat conftest.err >&5
2219 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2220 (exit $ac_status); } &&
2221 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2222 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2223 (eval $ac_try) 2>&5
2224 ac_status=$?
2225 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2226 (exit $ac_status); }; } &&
2227 { ac_try='test -s conftest.$ac_objext'
2228 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2229 (eval $ac_try) 2>&5
2230 ac_status=$?
2231 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2232 (exit $ac_status); }; }; then
2233 for ac_declaration in \
2234 '' \
2235 'extern "C" void std::exit (int) throw (); using std::exit;' \
2236 'extern "C" void std::exit (int); using std::exit;' \
2237 'extern "C" void exit (int) throw ();' \
2238 'extern "C" void exit (int);' \
2239 'void exit (int);'
2240 do
2241 cat >conftest.$ac_ext <<_ACEOF
2242 /* confdefs.h. */
2243 _ACEOF
2244 cat confdefs.h >>conftest.$ac_ext
2245 cat >>conftest.$ac_ext <<_ACEOF
2246 /* end confdefs.h. */
2247 $ac_declaration
2248 #include <stdlib.h>
2249 int
2250 main ()
2251 {
2252 exit (42);
2253 ;
2254 return 0;
2255 }
2256 _ACEOF
2257 rm -f conftest.$ac_objext
2258 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2259 (eval $ac_compile) 2>conftest.er1
2260 ac_status=$?
2261 grep -v '^ *+' conftest.er1 >conftest.err
2262 rm -f conftest.er1
2263 cat conftest.err >&5
2264 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2265 (exit $ac_status); } &&
2266 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2267 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2268 (eval $ac_try) 2>&5
2269 ac_status=$?
2270 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2271 (exit $ac_status); }; } &&
2272 { ac_try='test -s conftest.$ac_objext'
2273 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2274 (eval $ac_try) 2>&5
2275 ac_status=$?
2276 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2277 (exit $ac_status); }; }; then
2278 :
2279 else
2280 echo "$as_me: failed program was:" >&5
2281 sed 's/^/| /' conftest.$ac_ext >&5
2282
2283 continue
2284 fi
2285 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2286 cat >conftest.$ac_ext <<_ACEOF
2287 /* confdefs.h. */
2288 _ACEOF
2289 cat confdefs.h >>conftest.$ac_ext
2290 cat >>conftest.$ac_ext <<_ACEOF
2291 /* end confdefs.h. */
2292 $ac_declaration
2293 int
2294 main ()
2295 {
2296 exit (42);
2297 ;
2298 return 0;
2299 }
2300 _ACEOF
2301 rm -f conftest.$ac_objext
2302 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
2303 (eval $ac_compile) 2>conftest.er1
2304 ac_status=$?
2305 grep -v '^ *+' conftest.er1 >conftest.err
2306 rm -f conftest.er1
2307 cat conftest.err >&5
2308 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2309 (exit $ac_status); } &&
2310 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2311 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2312 (eval $ac_try) 2>&5
2313 ac_status=$?
2314 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2315 (exit $ac_status); }; } &&
2316 { ac_try='test -s conftest.$ac_objext'
2317 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2318 (eval $ac_try) 2>&5
2319 ac_status=$?
2320 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2321 (exit $ac_status); }; }; then
2322 break
2323 else
2324 echo "$as_me: failed program was:" >&5
2325 sed 's/^/| /' conftest.$ac_ext >&5
2326
2327 fi
2328 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2329 done
2330 rm -f conftest*
2331 if test -n "$ac_declaration"; then
2332 echo '#ifdef __cplusplus' >>confdefs.h
2333 echo $ac_declaration >>confdefs.h
2334 echo '#endif' >>confdefs.h
2335 fi
2336
2337 else
2338 echo "$as_me: failed program was:" >&5
2339 sed 's/^/| /' conftest.$ac_ext >&5
2340
2341 fi
2342 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
2343 ac_ext=c
2344 ac_cpp='$CPP $CPPFLAGS'
2345 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
2346 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
2347 ac_compiler_gnu=$ac_cv_c_compiler_gnu
2348
2349
2350 # Remove -g from compile flags, we will add via CFG variable if
2351 # we need it.
2352 CXXFLAGS=`echo "$CXXFLAGS " | sed "s/-g //"`
2353 CFLAGS=`echo "$CFLAGS " | sed "s/-g //"`
2354
2355 # check for GNU compiler, and use -Wall
2356 if test "$GCC" = "yes"; then
2357 C_WFLAGS="-Wall"
2358 CFLAGS="$CFLAGS -Wall"
2359 cat >>confdefs.h <<\_ACEOF
2360 #define USE_GNUCC 1
2361 _ACEOF
2362
2363 fi
2364 if test "$GXX" = "yes"; then
2365 CXX_WFLAGS="-Wall"
2366 CXXFLAGS="$CXXFLAGS -Wall"
2367 cat >>confdefs.h <<\_ACEOF
2368 #define USE_GNUCC 1
2369 _ACEOF
2370
2371 fi
2372 CXX_WFLAGS=$CXX_WFLAGS
2373
2374 C_WFLAGS=$C_WFLAGS
2375
2376
2377
2378 # Find a good install program. We prefer a C program (faster),
2379 # so one script is as good as another. But avoid the broken or
2380 # incompatible versions:
2381 # SysV /etc/install, /usr/sbin/install
2382 # SunOS /usr/etc/install
2383 # IRIX /sbin/install
2384 # AIX /bin/install
2385 # AmigaOS /C/install, which installs bootblocks on floppy discs
2386 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
2387 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
2388 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
2389 # OS/2's system install, which has a completely different semantic
2390 # ./install, which can be erroneously created by make from ./install.sh.
2391 echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
2392 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
2393 if test -z "$INSTALL"; then
2394 if test "${ac_cv_path_install+set}" = set; then
2395 echo $ECHO_N "(cached) $ECHO_C" >&6
2396 else
2397 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2398 for as_dir in $PATH
2399 do
2400 IFS=$as_save_IFS
2401 test -z "$as_dir" && as_dir=.
2402 # Account for people who put trailing slashes in PATH elements.
2403 case $as_dir/ in
2404 ./ | .// | /cC/* | \
2405 /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
2406 ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
2407 /usr/ucb/* ) ;;
2408 *)
2409 # OSF1 and SCO ODT 3.0 have their own names for install.
2410 # Don't use installbsd from OSF since it installs stuff as root
2411 # by default.
2412 for ac_prog in ginstall scoinst install; do
2413 for ac_exec_ext in '' $ac_executable_extensions; do
2414 if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
2415 if test $ac_prog = install &&
2416 grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
2417 # AIX install. It has an incompatible calling convention.
2418 :
2419 elif test $ac_prog = install &&
2420 grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
2421 # program-specific install script used by HP pwplus--don't use.
2422 :
2423 else
2424 ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
2425 break 3
2426 fi
2427 fi
2428 done
2429 done
2430 ;;
2431 esac
2432 done
2433
2434
2435 fi
2436 if test "${ac_cv_path_install+set}" = set; then
2437 INSTALL=$ac_cv_path_install
2438 else
2439 # As a last resort, use the slow shell script. We don't cache a
2440 # path for INSTALL within a source directory, because that will
2441 # break other packages using the cache if that directory is
2442 # removed, or if the path is relative.
2443 INSTALL=$ac_install_sh
2444 fi
2445 fi
2446 echo "$as_me:$LINENO: result: $INSTALL" >&5
2447 echo "${ECHO_T}$INSTALL" >&6
2448
2449 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
2450 # It thinks the first close brace ends the variable substitution.
2451 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
2452
2453 test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
2454
2455 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
2456
2457 echo "$as_me:$LINENO: checking whether ln -s works" >&5
2458 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6
2459 LN_S=$as_ln_s
2460 if test "$LN_S" = "ln -s"; then
2461 echo "$as_me:$LINENO: result: yes" >&5
2462 echo "${ECHO_T}yes" >&6
2463 else
2464 echo "$as_me:$LINENO: result: no, using $LN_S" >&5
2465 echo "${ECHO_T}no, using $LN_S" >&6
2466 fi
2467
2468 if test -n "$ac_tool_prefix"; then
2469 # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
2470 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
2471 echo "$as_me:$LINENO: checking for $ac_word" >&5
2472 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
2473 if test "${ac_cv_prog_RANLIB+set}" = set; then
2474 echo $ECHO_N "(cached) $ECHO_C" >&6
2475 else
2476 if test -n "$RANLIB"; then
2477 ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
2478 else
2479 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2480 for as_dir in $PATH
2481 do
2482 IFS=$as_save_IFS
2483 test -z "$as_dir" && as_dir=.
2484 for ac_exec_ext in '' $ac_executable_extensions; do
2485 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2486 ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
2487 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2488 break 2
2489 fi
2490 done
2491 done
2492
2493 fi
2494 fi
2495 RANLIB=$ac_cv_prog_RANLIB
2496 if test -n "$RANLIB"; then
2497 echo "$as_me:$LINENO: result: $RANLIB" >&5
2498 echo "${ECHO_T}$RANLIB" >&6
2499 else
2500 echo "$as_me:$LINENO: result: no" >&5
2501 echo "${ECHO_T}no" >&6
2502 fi
2503
2504 fi
2505 if test -z "$ac_cv_prog_RANLIB"; then
2506 ac_ct_RANLIB=$RANLIB
2507 # Extract the first word of "ranlib", so it can be a program name with args.
2508 set dummy ranlib; ac_word=$2
2509 echo "$as_me:$LINENO: checking for $ac_word" >&5
2510 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
2511 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
2512 echo $ECHO_N "(cached) $ECHO_C" >&6
2513 else
2514 if test -n "$ac_ct_RANLIB"; then
2515 ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
2516 else
2517 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
2518 for as_dir in $PATH
2519 do
2520 IFS=$as_save_IFS
2521 test -z "$as_dir" && as_dir=.
2522 for ac_exec_ext in '' $ac_executable_extensions; do
2523 if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
2524 ac_cv_prog_ac_ct_RANLIB="ranlib"
2525 echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
2526 break 2
2527 fi
2528 done
2529 done
2530
2531 test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":"
2532 fi
2533 fi
2534 ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
2535 if test -n "$ac_ct_RANLIB"; then
2536 echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
2537 echo "${ECHO_T}$ac_ct_RANLIB" >&6
2538 else
2539 echo "$as_me:$LINENO: result: no" >&5
2540 echo "${ECHO_T}no" >&6
2541 fi
2542
2543 RANLIB=$ac_ct_RANLIB
2544 else
2545 RANLIB="$ac_cv_prog_RANLIB"
2546 fi
2547
2548
2549 echo 'void f(){}' > conftest.c
2550 if test -z "`${CC-cc} -fPIC -c conftest.c 2>&1`"; then
2551 C_PIC=-fPIC
2552 else
2553 C_PIC=
2554 fi
2555 if test -z "`${CXX-g++} -fPIC -c conftest.c 2>&1`"; then
2556 CXX_PIC=-fPIC
2557 else
2558 CXX_PIC=
2559 fi
2560 rm -f conftest*
2561
2562 CXX_PIC=$CXX_PIC
2563
2564 C_PIC=$C_PIC
2565
2566
2567
2568 echo 'void g(); int main(){ g(); return 0; }' > conftest1.c
2569
2570 echo '#include <stdio.h>' > conftest2.c
2571 echo 'void g(); void g(){printf("");}' >> conftest2.c
2572 ${CC} ${C_PIC} -c conftest2.c
2573
2574 SO_EXT="so"
2575 export SO_EXT
2576 LD_SHARED="/bin/true"
2577 if test ! -z "`uname -a | grep IRIX`" ; then
2578 IRIX_ALL=-all
2579 else
2580 IRIX_ALL=
2581 fi
2582
2583
2584 # Check whether --with-ld-shared or --without-ld-shared was given.
2585 if test "${with_ld_shared+set}" = set; then
2586 withval="$with_ld_shared"
2587
2588 fi;
2589
2590 if test "$with_ld_shared" != "" ; then
2591 if test "$with_ld_shared" = "no" ; then
2592 echo "user disabled shared library support."
2593 else
2594 echo "using user supplied .so link command ... $with_ld_shared"
2595 fi
2596 LD_SHARED="$with_ld_shared"
2597 fi
2598
2599
2600 if test ! -z "`uname -a | grep CYGWIN`" \
2601 -a "$LD_SHARED" = "/bin/true" \
2602 -a -z "`gcc -shared conftest2.o -o libconftest.dll`" ; then
2603 if test -z "`${CC} conftest1.c -L./ -lconftest -o conftest1 2>&1`"; then
2604 LD_LIBRARY_PATH_OLD="$LD_LIBRARY_PATH"
2605 if test -z "$LD_LIBRARY_PATH" ; then
2606 LD_LIBRARY_PATH="`pwd`"
2607 else
2608 LD_LIBRARY_PATH="`pwd`:$LD_LIBRARY_PATH"
2609 fi
2610 export LD_LIBRARY_PATH
2611 if test -z "`./conftest1 2>&1`" ; then
2612 echo "checking for Cygwin gcc -shared ... yes"
2613 LD_SHARED="c++ -shared"
2614 SO_EXT="dll"
2615 fi
2616 LD_LIBRARY_PATH="$LD_LIBRARY_PATH_OLD"
2617 fi
2618 fi
2619
2620
2621 if test ! -z "`uname | grep Darwin`" \
2622 -a "$LD_SHARED" = "/bin/true" \
2623 -a -z "`${CXX} -dynamiclib conftest2.o -o libconftest.so 2>&1`" ; then
2624 ${CC} -c conftest1.c
2625 if test -z "`${CXX} conftest1.o libconftest.so -o conftest1 2>&1`"; then
2626 DYLD_LIBRARY_PATH_OLD="$DYLD_LIBRARY_PATH"
2627 if test -z "$DYLD_LIBRARY_PATH" ; then
2628 DYLD_LIBRARY_PATH="`pwd`"
2629 else
2630 DYLD_LIBRARY_PATH="`pwd`:$DYLD_LIBRARY_PATH"
2631 fi
2632 export DYLD_LIBRARY_PATH
2633 if test -z "`./conftest1 2>&1`" ; then
2634 echo "checking for ${CXX} -dynamiclib ... yes"
2635 LD_SHARED="${CXX} -dynamiclib"
2636 SO_EXT=dylib
2637 fi
2638 DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH_OLD"
2639 fi
2640 rm -f conftest1.o
2641 fi
2642
2643 if test "$LD_SHARED" = "/bin/true" \
2644 -a -z "`${CXX} -shared $IRIX_ALL conftest2.o -o libconftest.so 2>&1|grep -v WARNING`" ; then
2645 if test -z "`${CC} conftest1.c libconftest.so -o conftest1 2>&1`"; then
2646 LD_LIBRARY_PATH_OLD="$LD_LIBRARY_PATH"
2647 if test -z "$LD_LIBRARY_PATH" ; then
2648 LD_LIBRARY_PATH="`pwd`"
2649 else
2650 LD_LIBRARY_PATH="`pwd`:$LD_LIBRARY_PATH"
2651 fi
2652 export LD_LIBRARY_PATH
2653 if test -z "`./conftest1 2>&1`" ; then
2654 echo "checking for ${CXX} -shared ... yes"
2655 LD_SHARED="${CXX} -shared $IRIX_ALL"
2656 else
2657 echo "checking for ${CXX} -shared ... no(3)"
2658 fi
2659 LD_LIBRARY_PATH="$LD_LIBRARY_PATH_OLD"
2660 else
2661 echo "checking for ${CXX} -shared ... no(2)"
2662 fi
2663 else
2664 if test "$LD_SHARED" = "/bin/true" ; then
2665 echo "checking for ${CXX} -shared ... no(1)"
2666 fi
2667 fi
2668
2669 if test "$LD_SHARED" = "/bin/true" \
2670 -a -z "`ld -shared conftest2.o -o libconftest.so 2>&1`" ; then
2671 if test -z "`${CC} conftest1.c libconftest.so -o conftest1 2>&1`"; then
2672 LD_LIBRARY_PATH_OLD="$LD_LIBRARY_PATH"
2673 if test -z "$LD_LIBRARY_PATH" ; then
2674 LD_LIBRARY_PATH="`pwd`"
2675 else
2676 LD_LIBRARY_PATH="`pwd`:$LD_LIBRARY_PATH"
2677 fi
2678 export LD_LIBRARY_PATH
2679 if test -z "`./conftest1 2>&1`" ; then
2680 echo "checking for ld -shared ... yes"
2681 LD_SHARED="ld -shared"
2682 fi
2683 LD_LIBRARY_PATH="$LD_LIBRARY_PATH_OLD"
2684 fi
2685 fi
2686
2687 if test "$LD_SHARED" = "/bin/true" ; then
2688 echo "checking for ld -shared ... no"
2689 if test ! -x /bin/true ; then
2690 LD_SHARED=/usr/bin/true
2691 fi
2692 fi
2693 if test "$LD_SHARED" = "no" ; then
2694 if test -x /bin/true ; then
2695 LD_SHARED=/bin/true
2696 else
2697 LD_SHARED=/usr/bin/true
2698 fi
2699 fi
2700
2701 rm -f conftest* libconftest*
2702
2703 LD_SHARED=$LD_SHARED
2704
2705 SO_EXT=$SO_EXT
2706
2707
2708
2709 #
2710 # If we have shared library support define that we want to build
2711 # the libgeotiff.so
2712
2713 GEOTIFF_SO=
2714 GEOTIFF_DLL=
2715 GEOTIFF_IMP=
2716 EXEEXT=
2717 if test "$LD_SHARED" != "/bin/true" ; then
2718 case $host in
2719 *-pc-cygwin*) EXEEXT=.exe
2720 GEOTIFF_SO=cyggeotiff-1.dll
2721 GEOTIFF_DLL=cyggeotiff-1.dll
2722 GEOTIFF_IMP=libgeotiff.dll.a
2723 LD_SHARED="gcc -shared -Wl,--export-all -Wl,--out-implib=\$(GEOTIFF_IMP)" ;;
2724 *) GEOTIFF_SO=libgeotiff.${SO_EXT}.$VERSION_MAJOR.$VERSION_MINOR.$VERSION_POINT ;;
2725 esac
2726 fi
2727 GEOTIFF_SO=$GEOTIFF_SO
2728
2729 GEOTIFF_IMP=$GEOTIFF_IMP
2730
2731 GEOTIFF_DLL=$GEOTIFF_DLL
2732
2733 EXEEXT=$EXEEXT
2734
2735
2736
2737
2738 echo "$as_me:$LINENO: checking for exp in -lm" >&5
2739 echo $ECHO_N "checking for exp in -lm... $ECHO_C" >&6
2740 if test "${ac_cv_lib_m_exp+set}" = set; then
2741 echo $ECHO_N "(cached) $ECHO_C" >&6
2742 else
2743 ac_check_lib_save_LIBS=$LIBS
2744 LIBS="-lm $LIBS"
2745 cat >conftest.$ac_ext <<_ACEOF
2746 /* confdefs.h. */
2747 _ACEOF
2748 cat confdefs.h >>conftest.$ac_ext
2749 cat >>conftest.$ac_ext <<_ACEOF
2750 /* end confdefs.h. */
2751
2752 /* Override any gcc2 internal prototype to avoid an error. */
2753 #ifdef __cplusplus
2754 extern "C"
2755 #endif
2756 /* We use char because int might match the return type of a gcc2
2757 builtin and then its argument prototype would still apply. */
2758 char exp ();
2759 int
2760 main ()
2761 {
2762 exp ();
2763 ;
2764 return 0;
2765 }
2766 _ACEOF
2767 rm -f conftest.$ac_objext conftest$ac_exeext
2768 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
2769 (eval $ac_link) 2>conftest.er1
2770 ac_status=$?
2771 grep -v '^ *+' conftest.er1 >conftest.err
2772 rm -f conftest.er1
2773 cat conftest.err >&5
2774 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2775 (exit $ac_status); } &&
2776 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
2777 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2778 (eval $ac_try) 2>&5
2779 ac_status=$?
2780 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2781 (exit $ac_status); }; } &&
2782 { ac_try='test -s conftest$ac_exeext'
2783 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
2784 (eval $ac_try) 2>&5
2785 ac_status=$?
2786 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2787 (exit $ac_status); }; }; then
2788 ac_cv_lib_m_exp=yes
2789 else
2790 echo "$as_me: failed program was:" >&5
2791 sed 's/^/| /' conftest.$ac_ext >&5
2792
2793 ac_cv_lib_m_exp=no
2794 fi
2795 rm -f conftest.err conftest.$ac_objext \
2796 conftest$ac_exeext conftest.$ac_ext
2797 LIBS=$ac_check_lib_save_LIBS
2798 fi
2799 echo "$as_me:$LINENO: result: $ac_cv_lib_m_exp" >&5
2800 echo "${ECHO_T}$ac_cv_lib_m_exp" >&6
2801 if test $ac_cv_lib_m_exp = yes; then
2802 cat >>confdefs.h <<_ACEOF
2803 #define HAVE_LIBM 1
2804 _ACEOF
2805
2806 LIBS="-lm $LIBS"
2807
2808 fi
2809
2810
2811 LIBS="$LDFLAGS $LIBS"
2812
2813 ac_ext=c
2814 ac_cpp='$CPP $CPPFLAGS'
2815 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
2816 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
2817 ac_compiler_gnu=$ac_cv_c_compiler_gnu
2818 echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
2819 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
2820 # On Suns, sometimes $CPP names a directory.
2821 if test -n "$CPP" && test -d "$CPP"; then
2822 CPP=
2823 fi
2824 if test -z "$CPP"; then
2825 if test "${ac_cv_prog_CPP+set}" = set; then
2826 echo $ECHO_N "(cached) $ECHO_C" >&6
2827 else
2828 # Double quotes because CPP needs to be expanded
2829 for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
2830 do
2831 ac_preproc_ok=false
2832 for ac_c_preproc_warn_flag in '' yes
2833 do
2834 # Use a header file that comes with gcc, so configuring glibc
2835 # with a fresh cross-compiler works.
2836 # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
2837 # <limits.h> exists even on freestanding compilers.
2838 # On the NeXT, cc -E runs the code through the compiler's parser,
2839 # not just through cpp. "Syntax error" is here to catch this case.
2840 cat >conftest.$ac_ext <<_ACEOF
2841 /* confdefs.h. */
2842 _ACEOF
2843 cat confdefs.h >>conftest.$ac_ext
2844 cat >>conftest.$ac_ext <<_ACEOF
2845 /* end confdefs.h. */
2846 #ifdef __STDC__
2847 # include <limits.h>
2848 #else
2849 # include <assert.h>
2850 #endif
2851 Syntax error
2852 _ACEOF
2853 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
2854 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
2855 ac_status=$?
2856 grep -v '^ *+' conftest.er1 >conftest.err
2857 rm -f conftest.er1
2858 cat conftest.err >&5
2859 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2860 (exit $ac_status); } >/dev/null; then
2861 if test -s conftest.err; then
2862 ac_cpp_err=$ac_c_preproc_warn_flag
2863 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
2864 else
2865 ac_cpp_err=
2866 fi
2867 else
2868 ac_cpp_err=yes
2869 fi
2870 if test -z "$ac_cpp_err"; then
2871 :
2872 else
2873 echo "$as_me: failed program was:" >&5
2874 sed 's/^/| /' conftest.$ac_ext >&5
2875
2876 # Broken: fails on valid input.
2877 continue
2878 fi
2879 rm -f conftest.err conftest.$ac_ext
2880
2881 # OK, works on sane cases. Now check whether non-existent headers
2882 # can be detected and how.
2883 cat >conftest.$ac_ext <<_ACEOF
2884 /* confdefs.h. */
2885 _ACEOF
2886 cat confdefs.h >>conftest.$ac_ext
2887 cat >>conftest.$ac_ext <<_ACEOF
2888 /* end confdefs.h. */
2889 #include <ac_nonexistent.h>
2890 _ACEOF
2891 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
2892 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
2893 ac_status=$?
2894 grep -v '^ *+' conftest.er1 >conftest.err
2895 rm -f conftest.er1
2896 cat conftest.err >&5
2897 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2898 (exit $ac_status); } >/dev/null; then
2899 if test -s conftest.err; then
2900 ac_cpp_err=$ac_c_preproc_warn_flag
2901 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
2902 else
2903 ac_cpp_err=
2904 fi
2905 else
2906 ac_cpp_err=yes
2907 fi
2908 if test -z "$ac_cpp_err"; then
2909 # Broken: success on invalid input.
2910 continue
2911 else
2912 echo "$as_me: failed program was:" >&5
2913 sed 's/^/| /' conftest.$ac_ext >&5
2914
2915 # Passes both tests.
2916 ac_preproc_ok=:
2917 break
2918 fi
2919 rm -f conftest.err conftest.$ac_ext
2920
2921 done
2922 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
2923 rm -f conftest.err conftest.$ac_ext
2924 if $ac_preproc_ok; then
2925 break
2926 fi
2927
2928 done
2929 ac_cv_prog_CPP=$CPP
2930
2931 fi
2932 CPP=$ac_cv_prog_CPP
2933 else
2934 ac_cv_prog_CPP=$CPP
2935 fi
2936 echo "$as_me:$LINENO: result: $CPP" >&5
2937 echo "${ECHO_T}$CPP" >&6
2938 ac_preproc_ok=false
2939 for ac_c_preproc_warn_flag in '' yes
2940 do
2941 # Use a header file that comes with gcc, so configuring glibc
2942 # with a fresh cross-compiler works.
2943 # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
2944 # <limits.h> exists even on freestanding compilers.
2945 # On the NeXT, cc -E runs the code through the compiler's parser,
2946 # not just through cpp. "Syntax error" is here to catch this case.
2947 cat >conftest.$ac_ext <<_ACEOF
2948 /* confdefs.h. */
2949 _ACEOF
2950 cat confdefs.h >>conftest.$ac_ext
2951 cat >>conftest.$ac_ext <<_ACEOF
2952 /* end confdefs.h. */
2953 #ifdef __STDC__
2954 # include <limits.h>
2955 #else
2956 # include <assert.h>
2957 #endif
2958 Syntax error
2959 _ACEOF
2960 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
2961 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
2962 ac_status=$?
2963 grep -v '^ *+' conftest.er1 >conftest.err
2964 rm -f conftest.er1
2965 cat conftest.err >&5
2966 echo "$as_me:$LINENO: \$? = $ac_status" >&5
2967 (exit $ac_status); } >/dev/null; then
2968 if test -s conftest.err; then
2969 ac_cpp_err=$ac_c_preproc_warn_flag
2970 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
2971 else
2972 ac_cpp_err=
2973 fi
2974 else
2975 ac_cpp_err=yes
2976 fi
2977 if test -z "$ac_cpp_err"; then
2978 :
2979 else
2980 echo "$as_me: failed program was:" >&5
2981 sed 's/^/| /' conftest.$ac_ext >&5
2982
2983 # Broken: fails on valid input.
2984 continue
2985 fi
2986 rm -f conftest.err conftest.$ac_ext
2987
2988 # OK, works on sane cases. Now check whether non-existent headers
2989 # can be detected and how.
2990 cat >conftest.$ac_ext <<_ACEOF
2991 /* confdefs.h. */
2992 _ACEOF
2993 cat confdefs.h >>conftest.$ac_ext
2994 cat >>conftest.$ac_ext <<_ACEOF
2995 /* end confdefs.h. */
2996 #include <ac_nonexistent.h>
2997 _ACEOF
2998 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
2999 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
3000 ac_status=$?
3001 grep -v '^ *+' conftest.er1 >conftest.err
3002 rm -f conftest.er1
3003 cat conftest.err >&5
3004 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3005 (exit $ac_status); } >/dev/null; then
3006 if test -s conftest.err; then
3007 ac_cpp_err=$ac_c_preproc_warn_flag
3008 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
3009 else
3010 ac_cpp_err=
3011 fi
3012 else
3013 ac_cpp_err=yes
3014 fi
3015 if test -z "$ac_cpp_err"; then
3016 # Broken: success on invalid input.
3017 continue
3018 else
3019 echo "$as_me: failed program was:" >&5
3020 sed 's/^/| /' conftest.$ac_ext >&5
3021
3022 # Passes both tests.
3023 ac_preproc_ok=:
3024 break
3025 fi
3026 rm -f conftest.err conftest.$ac_ext
3027
3028 done
3029 # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
3030 rm -f conftest.err conftest.$ac_ext
3031 if $ac_preproc_ok; then
3032 :
3033 else
3034 { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
3035 See \`config.log' for more details." >&5
3036 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
3037 See \`config.log' for more details." >&2;}
3038 { (exit 1); exit 1; }; }
3039 fi
3040
3041 ac_ext=c
3042 ac_cpp='$CPP $CPPFLAGS'
3043 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
3044 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
3045 ac_compiler_gnu=$ac_cv_c_compiler_gnu
3046
3047
3048 echo "$as_me:$LINENO: checking for egrep" >&5
3049 echo $ECHO_N "checking for egrep... $ECHO_C" >&6
3050 if test "${ac_cv_prog_egrep+set}" = set; then
3051 echo $ECHO_N "(cached) $ECHO_C" >&6
3052 else
3053 if echo a | (grep -E '(a|b)') >/dev/null 2>&1
3054 then ac_cv_prog_egrep='grep -E'
3055 else ac_cv_prog_egrep='egrep'
3056 fi
3057 fi
3058 echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
3059 echo "${ECHO_T}$ac_cv_prog_egrep" >&6
3060 EGREP=$ac_cv_prog_egrep
3061
3062
3063 echo "$as_me:$LINENO: checking for ANSI C header files" >&5
3064 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
3065 if test "${ac_cv_header_stdc+set}" = set; then
3066 echo $ECHO_N "(cached) $ECHO_C" >&6
3067 else
3068 cat >conftest.$ac_ext <<_ACEOF
3069 /* confdefs.h. */
3070 _ACEOF
3071 cat confdefs.h >>conftest.$ac_ext
3072 cat >>conftest.$ac_ext <<_ACEOF
3073 /* end confdefs.h. */
3074 #include <stdlib.h>
3075 #include <stdarg.h>
3076 #include <string.h>
3077 #include <float.h>
3078
3079 int
3080 main ()
3081 {
3082
3083 ;
3084 return 0;
3085 }
3086 _ACEOF
3087 rm -f conftest.$ac_objext
3088 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
3089 (eval $ac_compile) 2>conftest.er1
3090 ac_status=$?
3091 grep -v '^ *+' conftest.er1 >conftest.err
3092 rm -f conftest.er1
3093 cat conftest.err >&5
3094 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3095 (exit $ac_status); } &&
3096 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3097 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3098 (eval $ac_try) 2>&5
3099 ac_status=$?
3100 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3101 (exit $ac_status); }; } &&
3102 { ac_try='test -s conftest.$ac_objext'
3103 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3104 (eval $ac_try) 2>&5
3105 ac_status=$?
3106 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3107 (exit $ac_status); }; }; then
3108 ac_cv_header_stdc=yes
3109 else
3110 echo "$as_me: failed program was:" >&5
3111 sed 's/^/| /' conftest.$ac_ext >&5
3112
3113 ac_cv_header_stdc=no
3114 fi
3115 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
3116
3117 if test $ac_cv_header_stdc = yes; then
3118 # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
3119 cat >conftest.$ac_ext <<_ACEOF
3120 /* confdefs.h. */
3121 _ACEOF
3122 cat confdefs.h >>conftest.$ac_ext
3123 cat >>conftest.$ac_ext <<_ACEOF
3124 /* end confdefs.h. */
3125 #include <string.h>
3126
3127 _ACEOF
3128 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3129 $EGREP "memchr" >/dev/null 2>&1; then
3130 :
3131 else
3132 ac_cv_header_stdc=no
3133 fi
3134 rm -f conftest*
3135
3136 fi
3137
3138 if test $ac_cv_header_stdc = yes; then
3139 # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
3140 cat >conftest.$ac_ext <<_ACEOF
3141 /* confdefs.h. */
3142 _ACEOF
3143 cat confdefs.h >>conftest.$ac_ext
3144 cat >>conftest.$ac_ext <<_ACEOF
3145 /* end confdefs.h. */
3146 #include <stdlib.h>
3147
3148 _ACEOF
3149 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
3150 $EGREP "free" >/dev/null 2>&1; then
3151 :
3152 else
3153 ac_cv_header_stdc=no
3154 fi
3155 rm -f conftest*
3156
3157 fi
3158
3159 if test $ac_cv_header_stdc = yes; then
3160 # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
3161 if test "$cross_compiling" = yes; then
3162 :
3163 else
3164 cat >conftest.$ac_ext <<_ACEOF
3165 /* confdefs.h. */
3166 _ACEOF
3167 cat confdefs.h >>conftest.$ac_ext
3168 cat >>conftest.$ac_ext <<_ACEOF
3169 /* end confdefs.h. */
3170 #include <ctype.h>
3171 #if ((' ' & 0x0FF) == 0x020)
3172 # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
3173 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
3174 #else
3175 # define ISLOWER(c) \
3176 (('a' <= (c) && (c) <= 'i') \
3177 || ('j' <= (c) && (c) <= 'r') \
3178 || ('s' <= (c) && (c) <= 'z'))
3179 # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
3180 #endif
3181
3182 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
3183 int
3184 main ()
3185 {
3186 int i;
3187 for (i = 0; i < 256; i++)
3188 if (XOR (islower (i), ISLOWER (i))
3189 || toupper (i) != TOUPPER (i))
3190 exit(2);
3191 exit (0);
3192 }
3193 _ACEOF
3194 rm -f conftest$ac_exeext
3195 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
3196 (eval $ac_link) 2>&5
3197 ac_status=$?
3198 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3199 (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
3200 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3201 (eval $ac_try) 2>&5
3202 ac_status=$?
3203 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3204 (exit $ac_status); }; }; then
3205 :
3206 else
3207 echo "$as_me: program exited with status $ac_status" >&5
3208 echo "$as_me: failed program was:" >&5
3209 sed 's/^/| /' conftest.$ac_ext >&5
3210
3211 ( exit $ac_status )
3212 ac_cv_header_stdc=no
3213 fi
3214 rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
3215 fi
3216 fi
3217 fi
3218 echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
3219 echo "${ECHO_T}$ac_cv_header_stdc" >&6
3220 if test $ac_cv_header_stdc = yes; then
3221
3222 cat >>confdefs.h <<\_ACEOF
3223 #define STDC_HEADERS 1
3224 _ACEOF
3225
3226 fi
3227
3228 # On IRIX 5.3, sys/types and inttypes.h are conflicting.
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238 for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
3239 inttypes.h stdint.h unistd.h
3240 do
3241 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
3242 echo "$as_me:$LINENO: checking for $ac_header" >&5
3243 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
3244 if eval "test \"\${$as_ac_Header+set}\" = set"; then
3245 echo $ECHO_N "(cached) $ECHO_C" >&6
3246 else
3247 cat >conftest.$ac_ext <<_ACEOF
3248 /* confdefs.h. */
3249 _ACEOF
3250 cat confdefs.h >>conftest.$ac_ext
3251 cat >>conftest.$ac_ext <<_ACEOF
3252 /* end confdefs.h. */
3253 $ac_includes_default
3254
3255 #include <$ac_header>
3256 _ACEOF
3257 rm -f conftest.$ac_objext
3258 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
3259 (eval $ac_compile) 2>conftest.er1
3260 ac_status=$?
3261 grep -v '^ *+' conftest.er1 >conftest.err
3262 rm -f conftest.er1
3263 cat conftest.err >&5
3264 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3265 (exit $ac_status); } &&
3266 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3267 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3268 (eval $ac_try) 2>&5
3269 ac_status=$?
3270 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3271 (exit $ac_status); }; } &&
3272 { ac_try='test -s conftest.$ac_objext'
3273 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3274 (eval $ac_try) 2>&5
3275 ac_status=$?
3276 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3277 (exit $ac_status); }; }; then
3278 eval "$as_ac_Header=yes"
3279 else
3280 echo "$as_me: failed program was:" >&5
3281 sed 's/^/| /' conftest.$ac_ext >&5
3282
3283 eval "$as_ac_Header=no"
3284 fi
3285 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
3286 fi
3287 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
3288 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
3289 if test `eval echo '${'$as_ac_Header'}'` = yes; then
3290 cat >>confdefs.h <<_ACEOF
3291 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
3292 _ACEOF
3293
3294 fi
3295
3296 done
3297
3298
3299
3300
3301
3302 for ac_header in string.h strings.h stdlib.h
3303 do
3304 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
3305 if eval "test \"\${$as_ac_Header+set}\" = set"; then
3306 echo "$as_me:$LINENO: checking for $ac_header" >&5
3307 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
3308 if eval "test \"\${$as_ac_Header+set}\" = set"; then
3309 echo $ECHO_N "(cached) $ECHO_C" >&6
3310 fi
3311 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
3312 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
3313 else
3314 # Is the header compilable?
3315 echo "$as_me:$LINENO: checking $ac_header usability" >&5
3316 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
3317 cat >conftest.$ac_ext <<_ACEOF
3318 /* confdefs.h. */
3319 _ACEOF
3320 cat confdefs.h >>conftest.$ac_ext
3321 cat >>conftest.$ac_ext <<_ACEOF
3322 /* end confdefs.h. */
3323 $ac_includes_default
3324 #include <$ac_header>
3325 _ACEOF
3326 rm -f conftest.$ac_objext
3327 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
3328 (eval $ac_compile) 2>conftest.er1
3329 ac_status=$?
3330 grep -v '^ *+' conftest.er1 >conftest.err
3331 rm -f conftest.er1
3332 cat conftest.err >&5
3333 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3334 (exit $ac_status); } &&
3335 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3336 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3337 (eval $ac_try) 2>&5
3338 ac_status=$?
3339 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3340 (exit $ac_status); }; } &&
3341 { ac_try='test -s conftest.$ac_objext'
3342 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3343 (eval $ac_try) 2>&5
3344 ac_status=$?
3345 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3346 (exit $ac_status); }; }; then
3347 ac_header_compiler=yes
3348 else
3349 echo "$as_me: failed program was:" >&5
3350 sed 's/^/| /' conftest.$ac_ext >&5
3351
3352 ac_header_compiler=no
3353 fi
3354 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
3355 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
3356 echo "${ECHO_T}$ac_header_compiler" >&6
3357
3358 # Is the header present?
3359 echo "$as_me:$LINENO: checking $ac_header presence" >&5
3360 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
3361 cat >conftest.$ac_ext <<_ACEOF
3362 /* confdefs.h. */
3363 _ACEOF
3364 cat confdefs.h >>conftest.$ac_ext
3365 cat >>conftest.$ac_ext <<_ACEOF
3366 /* end confdefs.h. */
3367 #include <$ac_header>
3368 _ACEOF
3369 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
3370 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
3371 ac_status=$?
3372 grep -v '^ *+' conftest.er1 >conftest.err
3373 rm -f conftest.er1
3374 cat conftest.err >&5
3375 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3376 (exit $ac_status); } >/dev/null; then
3377 if test -s conftest.err; then
3378 ac_cpp_err=$ac_c_preproc_warn_flag
3379 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
3380 else
3381 ac_cpp_err=
3382 fi
3383 else
3384 ac_cpp_err=yes
3385 fi
3386 if test -z "$ac_cpp_err"; then
3387 ac_header_preproc=yes
3388 else
3389 echo "$as_me: failed program was:" >&5
3390 sed 's/^/| /' conftest.$ac_ext >&5
3391
3392 ac_header_preproc=no
3393 fi
3394 rm -f conftest.err conftest.$ac_ext
3395 echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
3396 echo "${ECHO_T}$ac_header_preproc" >&6
3397
3398 # So? What about this header?
3399 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
3400 yes:no: )
3401 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
3402 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
3403 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
3404 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
3405 ac_header_preproc=yes
3406 ;;
3407 no:yes:* )
3408 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
3409 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
3410 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
3411 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
3412 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
3413 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
3414 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
3415 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
3416 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
3417 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
3418 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
3419 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
3420 (
3421 cat <<\_ASBOX
3422 ## ------------------------------------------ ##
3423 ## Report this to the AC_PACKAGE_NAME lists. ##
3424 ## ------------------------------------------ ##
3425 _ASBOX
3426 ) |
3427 sed "s/^/$as_me: WARNING: /" >&2
3428 ;;
3429 esac
3430 echo "$as_me:$LINENO: checking for $ac_header" >&5
3431 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
3432 if eval "test \"\${$as_ac_Header+set}\" = set"; then
3433 echo $ECHO_N "(cached) $ECHO_C" >&6
3434 else
3435 eval "$as_ac_Header=\$ac_header_preproc"
3436 fi
3437 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
3438 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
3439
3440 fi
3441 if test `eval echo '${'$as_ac_Header'}'` = yes; then
3442 cat >>confdefs.h <<_ACEOF
3443 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
3444 _ACEOF
3445
3446 fi
3447
3448 done
3449
3450
3451
3452 # Check whether --with-zip or --without-zip was given.
3453 if test "${with_zip+set}" = set; then
3454 withval="$with_zip"
3455 ZIP=$withval
3456 else
3457 ZIP=yes
3458 fi;
3459 if test "$ZIP" = "yes" ; then
3460
3461 echo "$as_me:$LINENO: checking for inflateInit_ in -lz" >&5
3462 echo $ECHO_N "checking for inflateInit_ in -lz... $ECHO_C" >&6
3463 if test "${ac_cv_lib_z_inflateInit_+set}" = set; then
3464 echo $ECHO_N "(cached) $ECHO_C" >&6
3465 else
3466 ac_check_lib_save_LIBS=$LIBS
3467 LIBS="-lz -lm $LIBS"
3468 cat >conftest.$ac_ext <<_ACEOF
3469 /* confdefs.h. */
3470 _ACEOF
3471 cat confdefs.h >>conftest.$ac_ext
3472 cat >>conftest.$ac_ext <<_ACEOF
3473 /* end confdefs.h. */
3474
3475 /* Override any gcc2 internal prototype to avoid an error. */
3476 #ifdef __cplusplus
3477 extern "C"
3478 #endif
3479 /* We use char because int might match the return type of a gcc2
3480 builtin and then its argument prototype would still apply. */
3481 char inflateInit_ ();
3482 int
3483 main ()
3484 {
3485 inflateInit_ ();
3486 ;
3487 return 0;
3488 }
3489 _ACEOF
3490 rm -f conftest.$ac_objext conftest$ac_exeext
3491 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
3492 (eval $ac_link) 2>conftest.er1
3493 ac_status=$?
3494 grep -v '^ *+' conftest.er1 >conftest.err
3495 rm -f conftest.er1
3496 cat conftest.err >&5
3497 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3498 (exit $ac_status); } &&
3499 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3500 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3501 (eval $ac_try) 2>&5
3502 ac_status=$?
3503 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3504 (exit $ac_status); }; } &&
3505 { ac_try='test -s conftest$ac_exeext'
3506 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3507 (eval $ac_try) 2>&5
3508 ac_status=$?
3509 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3510 (exit $ac_status); }; }; then
3511 ac_cv_lib_z_inflateInit_=yes
3512 else
3513 echo "$as_me: failed program was:" >&5
3514 sed 's/^/| /' conftest.$ac_ext >&5
3515
3516 ac_cv_lib_z_inflateInit_=no
3517 fi
3518 rm -f conftest.err conftest.$ac_objext \
3519 conftest$ac_exeext conftest.$ac_ext
3520 LIBS=$ac_check_lib_save_LIBS
3521 fi
3522 echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflateInit_" >&5
3523 echo "${ECHO_T}$ac_cv_lib_z_inflateInit_" >&6
3524 if test $ac_cv_lib_z_inflateInit_ = yes; then
3525 cat >>confdefs.h <<_ACEOF
3526 #define HAVE_LIBZ 1
3527 _ACEOF
3528
3529 LIBS="-lz $LIBS"
3530
3531 fi
3532
3533
3534 for ac_header in zlib.h
3535 do
3536 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
3537 if eval "test \"\${$as_ac_Header+set}\" = set"; then
3538 echo "$as_me:$LINENO: checking for $ac_header" >&5
3539 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
3540 if eval "test \"\${$as_ac_Header+set}\" = set"; then
3541 echo $ECHO_N "(cached) $ECHO_C" >&6
3542 fi
3543 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
3544 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
3545 else
3546 # Is the header compilable?
3547 echo "$as_me:$LINENO: checking $ac_header usability" >&5
3548 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
3549 cat >conftest.$ac_ext <<_ACEOF
3550 /* confdefs.h. */
3551 _ACEOF
3552 cat confdefs.h >>conftest.$ac_ext
3553 cat >>conftest.$ac_ext <<_ACEOF
3554 /* end confdefs.h. */
3555 $ac_includes_default
3556 #include <$ac_header>
3557 _ACEOF
3558 rm -f conftest.$ac_objext
3559 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
3560 (eval $ac_compile) 2>conftest.er1
3561 ac_status=$?
3562 grep -v '^ *+' conftest.er1 >conftest.err
3563 rm -f conftest.er1
3564 cat conftest.err >&5
3565 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3566 (exit $ac_status); } &&
3567 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3568 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3569 (eval $ac_try) 2>&5
3570 ac_status=$?
3571 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3572 (exit $ac_status); }; } &&
3573 { ac_try='test -s conftest.$ac_objext'
3574 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3575 (eval $ac_try) 2>&5
3576 ac_status=$?
3577 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3578 (exit $ac_status); }; }; then
3579 ac_header_compiler=yes
3580 else
3581 echo "$as_me: failed program was:" >&5
3582 sed 's/^/| /' conftest.$ac_ext >&5
3583
3584 ac_header_compiler=no
3585 fi
3586 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
3587 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
3588 echo "${ECHO_T}$ac_header_compiler" >&6
3589
3590 # Is the header present?
3591 echo "$as_me:$LINENO: checking $ac_header presence" >&5
3592 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
3593 cat >conftest.$ac_ext <<_ACEOF
3594 /* confdefs.h. */
3595 _ACEOF
3596 cat confdefs.h >>conftest.$ac_ext
3597 cat >>conftest.$ac_ext <<_ACEOF
3598 /* end confdefs.h. */
3599 #include <$ac_header>
3600 _ACEOF
3601 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
3602 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
3603 ac_status=$?
3604 grep -v '^ *+' conftest.er1 >conftest.err
3605 rm -f conftest.er1
3606 cat conftest.err >&5
3607 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3608 (exit $ac_status); } >/dev/null; then
3609 if test -s conftest.err; then
3610 ac_cpp_err=$ac_c_preproc_warn_flag
3611 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
3612 else
3613 ac_cpp_err=
3614 fi
3615 else
3616 ac_cpp_err=yes
3617 fi
3618 if test -z "$ac_cpp_err"; then
3619 ac_header_preproc=yes
3620 else
3621 echo "$as_me: failed program was:" >&5
3622 sed 's/^/| /' conftest.$ac_ext >&5
3623
3624 ac_header_preproc=no
3625 fi
3626 rm -f conftest.err conftest.$ac_ext
3627 echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
3628 echo "${ECHO_T}$ac_header_preproc" >&6
3629
3630 # So? What about this header?
3631 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
3632 yes:no: )
3633 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
3634 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
3635 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
3636 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
3637 ac_header_preproc=yes
3638 ;;
3639 no:yes:* )
3640 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
3641 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
3642 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
3643 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
3644 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
3645 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
3646 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
3647 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
3648 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
3649 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
3650 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
3651 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
3652 (
3653 cat <<\_ASBOX
3654 ## ------------------------------------------ ##
3655 ## Report this to the AC_PACKAGE_NAME lists. ##
3656 ## ------------------------------------------ ##
3657 _ASBOX
3658 ) |
3659 sed "s/^/$as_me: WARNING: /" >&2
3660 ;;
3661 esac
3662 echo "$as_me:$LINENO: checking for $ac_header" >&5
3663 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
3664 if eval "test \"\${$as_ac_Header+set}\" = set"; then
3665 echo $ECHO_N "(cached) $ECHO_C" >&6
3666 else
3667 eval "$as_ac_Header=\$ac_header_preproc"
3668 fi
3669 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
3670 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
3671
3672 fi
3673 if test `eval echo '${'$as_ac_Header'}'` = yes; then
3674 cat >>confdefs.h <<_ACEOF
3675 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
3676 _ACEOF
3677
3678 fi
3679
3680 done
3681
3682 cat >>confdefs.h <<\_ACEOF
3683 #define HAVE_ZIP 1
3684 _ACEOF
3685
3686 else
3687 if test "$ZIP" != "no" ; then
3688 LIBS="${LIBS} -L${ZIP}/lib -lz"
3689 ZIP_INC="-I${ZIP}/include"
3690 ZIP_INC=$ZIP_INC
3691
3692 cat >>confdefs.h <<\_ACEOF
3693 #define HAVE_ZIP 1
3694 _ACEOF
3695
3696 echo "Using user supplied libzip directory: "$ZIP
3697 fi
3698 fi
3699
3700
3701 # Check whether --with-jpeg or --without-jpeg was given.
3702 if test "${with_jpeg+set}" = set; then
3703 withval="$with_jpeg"
3704 JPEG=$withval
3705 else
3706 JPEG=yes
3707 fi;
3708 if test "$JPEG" = "yes" ; then
3709
3710 echo "$as_me:$LINENO: checking for jinit_compress_master in -ljpeg" >&5
3711 echo $ECHO_N "checking for jinit_compress_master in -ljpeg... $ECHO_C" >&6
3712 if test "${ac_cv_lib_jpeg_jinit_compress_master+set}" = set; then
3713 echo $ECHO_N "(cached) $ECHO_C" >&6
3714 else
3715 ac_check_lib_save_LIBS=$LIBS
3716 LIBS="-ljpeg -lm $LIBS"
3717 cat >conftest.$ac_ext <<_ACEOF
3718 /* confdefs.h. */
3719 _ACEOF
3720 cat confdefs.h >>conftest.$ac_ext
3721 cat >>conftest.$ac_ext <<_ACEOF
3722 /* end confdefs.h. */
3723
3724 /* Override any gcc2 internal prototype to avoid an error. */
3725 #ifdef __cplusplus
3726 extern "C"
3727 #endif
3728 /* We use char because int might match the return type of a gcc2
3729 builtin and then its argument prototype would still apply. */
3730 char jinit_compress_master ();
3731 int
3732 main ()
3733 {
3734 jinit_compress_master ();
3735 ;
3736 return 0;
3737 }
3738 _ACEOF
3739 rm -f conftest.$ac_objext conftest$ac_exeext
3740 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
3741 (eval $ac_link) 2>conftest.er1
3742 ac_status=$?
3743 grep -v '^ *+' conftest.er1 >conftest.err
3744 rm -f conftest.er1
3745 cat conftest.err >&5
3746 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3747 (exit $ac_status); } &&
3748 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3749 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3750 (eval $ac_try) 2>&5
3751 ac_status=$?
3752 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3753 (exit $ac_status); }; } &&
3754 { ac_try='test -s conftest$ac_exeext'
3755 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3756 (eval $ac_try) 2>&5
3757 ac_status=$?
3758 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3759 (exit $ac_status); }; }; then
3760 ac_cv_lib_jpeg_jinit_compress_master=yes
3761 else
3762 echo "$as_me: failed program was:" >&5
3763 sed 's/^/| /' conftest.$ac_ext >&5
3764
3765 ac_cv_lib_jpeg_jinit_compress_master=no
3766 fi
3767 rm -f conftest.err conftest.$ac_objext \
3768 conftest$ac_exeext conftest.$ac_ext
3769 LIBS=$ac_check_lib_save_LIBS
3770 fi
3771 echo "$as_me:$LINENO: result: $ac_cv_lib_jpeg_jinit_compress_master" >&5
3772 echo "${ECHO_T}$ac_cv_lib_jpeg_jinit_compress_master" >&6
3773 if test $ac_cv_lib_jpeg_jinit_compress_master = yes; then
3774 cat >>confdefs.h <<_ACEOF
3775 #define HAVE_LIBJPEG 1
3776 _ACEOF
3777
3778 LIBS="-ljpeg $LIBS"
3779
3780 fi
3781
3782 cat >>confdefs.h <<\_ACEOF
3783 #define HAVE_JPEG 1
3784 _ACEOF
3785
3786 else
3787 if test "$JPEG" != "no" ; then
3788 LIBS="${LIBS} -L${JPEG} -ljpeg"
3789 cat >>confdefs.h <<\_ACEOF
3790 #define HAVE_JPEG 1
3791 _ACEOF
3792
3793 echo "Using user supplied libjpeg directory: "$JPEG
3794 fi
3795 fi
3796
3797
3798 # Check whether --with-libtiff or --without-libtiff was given.
3799 if test "${with_libtiff+set}" = set; then
3800 withval="$with_libtiff"
3801
3802 fi;
3803
3804 if test "$with_libtiff" != "" ; then
3805 if test -f $with_libtiff/include/tiffio.h -a -d $with_libtiff/lib ; then
3806 LIBS="-L$with_libtiff/lib -ltiff $LIBS"
3807 TIFF_INC=-I$with_libtiff/include
3808 else
3809 LIBS="-L$with_libtiff -ltiff $LIBS"
3810 TIFF_INC=-I$with_libtiff
3811 fi
3812 LIBS_SAVED="$LIBS"
3813
3814 echo "$as_me:$LINENO: checking for TIFFOpen in -ltiff" >&5
3815 echo $ECHO_N "checking for TIFFOpen in -ltiff... $ECHO_C" >&6
3816 if test "${ac_cv_lib_tiff_TIFFOpen+set}" = set; then
3817 echo $ECHO_N "(cached) $ECHO_C" >&6
3818 else
3819 ac_check_lib_save_LIBS=$LIBS
3820 LIBS="-ltiff -lm $LIBS"
3821 cat >conftest.$ac_ext <<_ACEOF
3822 /* confdefs.h. */
3823 _ACEOF
3824 cat confdefs.h >>conftest.$ac_ext
3825 cat >>conftest.$ac_ext <<_ACEOF
3826 /* end confdefs.h. */
3827
3828 /* Override any gcc2 internal prototype to avoid an error. */
3829 #ifdef __cplusplus
3830 extern "C"
3831 #endif
3832 /* We use char because int might match the return type of a gcc2
3833 builtin and then its argument prototype would still apply. */
3834 char TIFFOpen ();
3835 int
3836 main ()
3837 {
3838 TIFFOpen ();
3839 ;
3840 return 0;
3841 }
3842 _ACEOF
3843 rm -f conftest.$ac_objext conftest$ac_exeext
3844 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
3845 (eval $ac_link) 2>conftest.er1
3846 ac_status=$?
3847 grep -v '^ *+' conftest.er1 >conftest.err
3848 rm -f conftest.er1
3849 cat conftest.err >&5
3850 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3851 (exit $ac_status); } &&
3852 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3853 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3854 (eval $ac_try) 2>&5
3855 ac_status=$?
3856 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3857 (exit $ac_status); }; } &&
3858 { ac_try='test -s conftest$ac_exeext'
3859 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3860 (eval $ac_try) 2>&5
3861 ac_status=$?
3862 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3863 (exit $ac_status); }; }; then
3864 ac_cv_lib_tiff_TIFFOpen=yes
3865 else
3866 echo "$as_me: failed program was:" >&5
3867 sed 's/^/| /' conftest.$ac_ext >&5
3868
3869 ac_cv_lib_tiff_TIFFOpen=no
3870 fi
3871 rm -f conftest.err conftest.$ac_objext \
3872 conftest$ac_exeext conftest.$ac_ext
3873 LIBS=$ac_check_lib_save_LIBS
3874 fi
3875 echo "$as_me:$LINENO: result: $ac_cv_lib_tiff_TIFFOpen" >&5
3876 echo "${ECHO_T}$ac_cv_lib_tiff_TIFFOpen" >&6
3877 if test $ac_cv_lib_tiff_TIFFOpen = yes; then
3878 cat >>confdefs.h <<_ACEOF
3879 #define HAVE_LIBTIFF 1
3880 _ACEOF
3881
3882 LIBS="-ltiff $LIBS"
3883
3884 else
3885 { { echo "$as_me:$LINENO: error: failed to link with -ltiff to find TIFFOpen" >&5
3886 echo "$as_me: error: failed to link with -ltiff to find TIFFOpen" >&2;}
3887 { (exit 1); exit 1; }; }
3888 fi
3889
3890
3891 echo "$as_me:$LINENO: checking for TIFFMergeFieldInfo in -ltiff" >&5
3892 echo $ECHO_N "checking for TIFFMergeFieldInfo in -ltiff... $ECHO_C" >&6
3893 if test "${ac_cv_lib_tiff_TIFFMergeFieldInfo+set}" = set; then
3894 echo $ECHO_N "(cached) $ECHO_C" >&6
3895 else
3896 ac_check_lib_save_LIBS=$LIBS
3897 LIBS="-ltiff -lm $LIBS"
3898 cat >conftest.$ac_ext <<_ACEOF
3899 /* confdefs.h. */
3900 _ACEOF
3901 cat confdefs.h >>conftest.$ac_ext
3902 cat >>conftest.$ac_ext <<_ACEOF
3903 /* end confdefs.h. */
3904
3905 /* Override any gcc2 internal prototype to avoid an error. */
3906 #ifdef __cplusplus
3907 extern "C"
3908 #endif
3909 /* We use char because int might match the return type of a gcc2
3910 builtin and then its argument prototype would still apply. */
3911 char TIFFMergeFieldInfo ();
3912 int
3913 main ()
3914 {
3915 TIFFMergeFieldInfo ();
3916 ;
3917 return 0;
3918 }
3919 _ACEOF
3920 rm -f conftest.$ac_objext conftest$ac_exeext
3921 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
3922 (eval $ac_link) 2>conftest.er1
3923 ac_status=$?
3924 grep -v '^ *+' conftest.er1 >conftest.err
3925 rm -f conftest.er1
3926 cat conftest.err >&5
3927 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3928 (exit $ac_status); } &&
3929 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
3930 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3931 (eval $ac_try) 2>&5
3932 ac_status=$?
3933 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3934 (exit $ac_status); }; } &&
3935 { ac_try='test -s conftest$ac_exeext'
3936 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
3937 (eval $ac_try) 2>&5
3938 ac_status=$?
3939 echo "$as_me:$LINENO: \$? = $ac_status" >&5
3940 (exit $ac_status); }; }; then
3941 ac_cv_lib_tiff_TIFFMergeFieldInfo=yes
3942 else
3943 echo "$as_me: failed program was:" >&5
3944 sed 's/^/| /' conftest.$ac_ext >&5
3945
3946 ac_cv_lib_tiff_TIFFMergeFieldInfo=no
3947 fi
3948 rm -f conftest.err conftest.$ac_objext \
3949 conftest$ac_exeext conftest.$ac_ext
3950 LIBS=$ac_check_lib_save_LIBS
3951 fi
3952 echo "$as_me:$LINENO: result: $ac_cv_lib_tiff_TIFFMergeFieldInfo" >&5
3953 echo "${ECHO_T}$ac_cv_lib_tiff_TIFFMergeFieldInfo" >&6
3954 if test $ac_cv_lib_tiff_TIFFMergeFieldInfo = yes; then
3955 cat >>confdefs.h <<_ACEOF
3956 #define HAVE_LIBTIFF 1
3957 _ACEOF
3958
3959 LIBS="-ltiff $LIBS"
3960
3961 else
3962 { { echo "$as_me:$LINENO: error: Libtiff 3.6.0 Beta or later required for this version of
3963 libgeotiff. Please upgrade or use an older version of libgeotiff." >&5
3964 echo "$as_me: error: Libtiff 3.6.0 Beta or later required for this version of
3965 libgeotiff. Please upgrade or use an older version of libgeotiff." >&2;}
3966 { (exit 1); exit 1; }; }
3967 fi
3968
3969 LIBS="$LIBS_SAVED"
3970 else
3971
3972 echo "$as_me:$LINENO: checking for TIFFOpen in -ltiff" >&5
3973 echo $ECHO_N "checking for TIFFOpen in -ltiff... $ECHO_C" >&6
3974 if test "${ac_cv_lib_tiff_TIFFOpen+set}" = set; then
3975 echo $ECHO_N "(cached) $ECHO_C" >&6
3976 else
3977 ac_check_lib_save_LIBS=$LIBS
3978 LIBS="-ltiff -lm $LIBS"
3979 cat >conftest.$ac_ext <<_ACEOF
3980 /* confdefs.h. */
3981 _ACEOF
3982 cat confdefs.h >>conftest.$ac_ext
3983 cat >>conftest.$ac_ext <<_ACEOF
3984 /* end confdefs.h. */
3985
3986 /* Override any gcc2 internal prototype to avoid an error. */
3987 #ifdef __cplusplus
3988 extern "C"
3989 #endif
3990 /* We use char because int might match the return type of a gcc2
3991 builtin and then its argument prototype would still apply. */
3992 char TIFFOpen ();
3993 int
3994 main ()
3995 {
3996 TIFFOpen ();
3997 ;
3998 return 0;
3999 }
4000 _ACEOF
4001 rm -f conftest.$ac_objext conftest$ac_exeext
4002 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
4003 (eval $ac_link) 2>conftest.er1
4004 ac_status=$?
4005 grep -v '^ *+' conftest.er1 >conftest.err
4006 rm -f conftest.er1
4007 cat conftest.err >&5
4008 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4009 (exit $ac_status); } &&
4010 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
4011 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4012 (eval $ac_try) 2>&5
4013 ac_status=$?
4014 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4015 (exit $ac_status); }; } &&
4016 { ac_try='test -s conftest$ac_exeext'
4017 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4018 (eval $ac_try) 2>&5
4019 ac_status=$?
4020 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4021 (exit $ac_status); }; }; then
4022 ac_cv_lib_tiff_TIFFOpen=yes
4023 else
4024 echo "$as_me: failed program was:" >&5
4025 sed 's/^/| /' conftest.$ac_ext >&5
4026
4027 ac_cv_lib_tiff_TIFFOpen=no
4028 fi
4029 rm -f conftest.err conftest.$ac_objext \
4030 conftest$ac_exeext conftest.$ac_ext
4031 LIBS=$ac_check_lib_save_LIBS
4032 fi
4033 echo "$as_me:$LINENO: result: $ac_cv_lib_tiff_TIFFOpen" >&5
4034 echo "${ECHO_T}$ac_cv_lib_tiff_TIFFOpen" >&6
4035 if test $ac_cv_lib_tiff_TIFFOpen = yes; then
4036 cat >>confdefs.h <<_ACEOF
4037 #define HAVE_LIBTIFF 1
4038 _ACEOF
4039
4040 LIBS="-ltiff $LIBS"
4041
4042 else
4043 { { echo "$as_me:$LINENO: error: You will need to substantially rewrite libxtiff to
4044 build libgeotiff without libtiff" >&5
4045 echo "$as_me: error: You will need to substantially rewrite libxtiff to
4046 build libgeotiff without libtiff" >&2;}
4047 { (exit 1); exit 1; }; }
4048 fi
4049
4050 LIBS_SAVED="$LIBS"
4051
4052 echo "$as_me:$LINENO: checking for TIFFMergeFieldInfo in -ltiff" >&5
4053 echo $ECHO_N "checking for TIFFMergeFieldInfo in -ltiff... $ECHO_C" >&6
4054 if test "${ac_cv_lib_tiff_TIFFMergeFieldInfo+set}" = set; then
4055 echo $ECHO_N "(cached) $ECHO_C" >&6
4056 else
4057 ac_check_lib_save_LIBS=$LIBS
4058 LIBS="-ltiff -lm $LIBS"
4059 cat >conftest.$ac_ext <<_ACEOF
4060 /* confdefs.h. */
4061 _ACEOF
4062 cat confdefs.h >>conftest.$ac_ext
4063 cat >>conftest.$ac_ext <<_ACEOF
4064 /* end confdefs.h. */
4065
4066 /* Override any gcc2 internal prototype to avoid an error. */
4067 #ifdef __cplusplus
4068 extern "C"
4069 #endif
4070 /* We use char because int might match the return type of a gcc2
4071 builtin and then its argument prototype would still apply. */
4072 char TIFFMergeFieldInfo ();
4073 int
4074 main ()
4075 {
4076 TIFFMergeFieldInfo ();
4077 ;
4078 return 0;
4079 }
4080 _ACEOF
4081 rm -f conftest.$ac_objext conftest$ac_exeext
4082 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
4083 (eval $ac_link) 2>conftest.er1
4084 ac_status=$?
4085 grep -v '^ *+' conftest.er1 >conftest.err
4086 rm -f conftest.er1
4087 cat conftest.err >&5
4088 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4089 (exit $ac_status); } &&
4090 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
4091 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4092 (eval $ac_try) 2>&5
4093 ac_status=$?
4094 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4095 (exit $ac_status); }; } &&
4096 { ac_try='test -s conftest$ac_exeext'
4097 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4098 (eval $ac_try) 2>&5
4099 ac_status=$?
4100 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4101 (exit $ac_status); }; }; then
4102 ac_cv_lib_tiff_TIFFMergeFieldInfo=yes
4103 else
4104 echo "$as_me: failed program was:" >&5
4105 sed 's/^/| /' conftest.$ac_ext >&5
4106
4107 ac_cv_lib_tiff_TIFFMergeFieldInfo=no
4108 fi
4109 rm -f conftest.err conftest.$ac_objext \
4110 conftest$ac_exeext conftest.$ac_ext
4111 LIBS=$ac_check_lib_save_LIBS
4112 fi
4113 echo "$as_me:$LINENO: result: $ac_cv_lib_tiff_TIFFMergeFieldInfo" >&5
4114 echo "${ECHO_T}$ac_cv_lib_tiff_TIFFMergeFieldInfo" >&6
4115 if test $ac_cv_lib_tiff_TIFFMergeFieldInfo = yes; then
4116 cat >>confdefs.h <<_ACEOF
4117 #define HAVE_LIBTIFF 1
4118 _ACEOF
4119
4120 LIBS="-ltiff $LIBS"
4121
4122 else
4123 { { echo "$as_me:$LINENO: error: Libtiff 3.6.0 Beta or later required for this version of
4124 libgeotiff. Please upgrade libtiff or use an older version of libgeotiff." >&5
4125 echo "$as_me: error: Libtiff 3.6.0 Beta or later required for this version of
4126 libgeotiff. Please upgrade libtiff or use an older version of libgeotiff." >&2;}
4127 { (exit 1); exit 1; }; }
4128 fi
4129
4130 LIBS="$LIBS_SAVED"
4131 TIFF_INC=
4132 fi
4133
4134 TIFF_INC=$TIFF_INC
4135
4136
4137
4138
4139 # Check whether --with-proj or --without-proj was given.
4140 if test "${with_proj+set}" = set; then
4141 withval="$with_proj"
4142 PROJ_HOME=$withval
4143 else
4144 PROJ_HOME=
4145 fi;
4146
4147 if test "$PROJ_HOME" != "" -a "$PROJ_HOME" != "no" ; then
4148 if test -d "$PROJ_HOME/src/pj_init.c" ; then
4149 PROJ_HOME=$PROJ_HOME/src
4150 fi
4151
4152 if test -f "$PROJ_HOME/libproj.a" -a -f "$PROJ_HOME/projects.h" ; then
4153 PROJ_LIB=$PROJ_HOME/libproj.a
4154 PROJ_INC=$PROJ_HOME
4155
4156 elif test -f "$PROJ_HOME/.libs/libproj.a" -a -f "$PROJ_HOME/projects.h" ; then
4157 PROJ_LIB=$PROJ_HOME/.libs/libproj.a
4158 PROJ_INC=$PROJ_HOME
4159
4160 elif test \( -f "$PROJ_HOME/lib/libproj.a" -o -f "$PROJ_HOME/lib/libproj.so" \) -a -f "$PROJ_HOME/include/proj_api.h"; then
4161 PROJ_LIB="-L$PROJ_HOME/lib -lproj"
4162 PROJ_INC=$PROJ_HOME/include
4163 else
4164 echo "PROJ_HOME=$PROJ_HOME, but either projects.h or libproj.a not found!"
4165 fi
4166 fi
4167
4168 if test "$PROJ_HOME" = "no" ; then
4169 echo "PROJ.4 support disabled."
4170
4171 elif test "$PROJ_LIB" != "" -a "$PROJ_INC" != "" ; then
4172 echo "Found $PROJ_LIB"
4173 echo "Found $PROJ_INC/projects.h"
4174
4175 LIBS="$PROJ_LIB $LIBS"
4176 PROJ_INC=-I$PROJ_INC
4177
4178 PROJ_INC=$PROJ_INC
4179
4180 cat >>confdefs.h <<\_ACEOF
4181 #define HAVE_PROJECTS_H 1
4182 _ACEOF
4183
4184 cat >>confdefs.h <<\_ACEOF
4185 #define HAVE_LIBPROJ 1
4186 _ACEOF
4187
4188 else
4189
4190 echo "$as_me:$LINENO: checking for pj_init in -lproj" >&5
4191 echo $ECHO_N "checking for pj_init in -lproj... $ECHO_C" >&6
4192 if test "${ac_cv_lib_proj_pj_init+set}" = set; then
4193 echo $ECHO_N "(cached) $ECHO_C" >&6
4194 else
4195 ac_check_lib_save_LIBS=$LIBS
4196 LIBS="-lproj -lm $LIBS"
4197 cat >conftest.$ac_ext <<_ACEOF
4198 /* confdefs.h. */
4199 _ACEOF
4200 cat confdefs.h >>conftest.$ac_ext
4201 cat >>conftest.$ac_ext <<_ACEOF
4202 /* end confdefs.h. */
4203
4204 /* Override any gcc2 internal prototype to avoid an error. */
4205 #ifdef __cplusplus
4206 extern "C"
4207 #endif
4208 /* We use char because int might match the return type of a gcc2
4209 builtin and then its argument prototype would still apply. */
4210 char pj_init ();
4211 int
4212 main ()
4213 {
4214 pj_init ();
4215 ;
4216 return 0;
4217 }
4218 _ACEOF
4219 rm -f conftest.$ac_objext conftest$ac_exeext
4220 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
4221 (eval $ac_link) 2>conftest.er1
4222 ac_status=$?
4223 grep -v '^ *+' conftest.er1 >conftest.err
4224 rm -f conftest.er1
4225 cat conftest.err >&5
4226 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4227 (exit $ac_status); } &&
4228 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
4229 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4230 (eval $ac_try) 2>&5
4231 ac_status=$?
4232 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4233 (exit $ac_status); }; } &&
4234 { ac_try='test -s conftest$ac_exeext'
4235 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4236 (eval $ac_try) 2>&5
4237 ac_status=$?
4238 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4239 (exit $ac_status); }; }; then
4240 ac_cv_lib_proj_pj_init=yes
4241 else
4242 echo "$as_me: failed program was:" >&5
4243 sed 's/^/| /' conftest.$ac_ext >&5
4244
4245 ac_cv_lib_proj_pj_init=no
4246 fi
4247 rm -f conftest.err conftest.$ac_objext \
4248 conftest$ac_exeext conftest.$ac_ext
4249 LIBS=$ac_check_lib_save_LIBS
4250 fi
4251 echo "$as_me:$LINENO: result: $ac_cv_lib_proj_pj_init" >&5
4252 echo "${ECHO_T}$ac_cv_lib_proj_pj_init" >&6
4253 if test $ac_cv_lib_proj_pj_init = yes; then
4254 cat >>confdefs.h <<_ACEOF
4255 #define HAVE_LIBPROJ 1
4256 _ACEOF
4257
4258 LIBS="-lproj $LIBS"
4259
4260 fi
4261
4262
4263 for ac_header in projects.h
4264 do
4265 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
4266 if eval "test \"\${$as_ac_Header+set}\" = set"; then
4267 echo "$as_me:$LINENO: checking for $ac_header" >&5
4268 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
4269 if eval "test \"\${$as_ac_Header+set}\" = set"; then
4270 echo $ECHO_N "(cached) $ECHO_C" >&6
4271 fi
4272 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
4273 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
4274 else
4275 # Is the header compilable?
4276 echo "$as_me:$LINENO: checking $ac_header usability" >&5
4277 echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
4278 cat >conftest.$ac_ext <<_ACEOF
4279 /* confdefs.h. */
4280 _ACEOF
4281 cat confdefs.h >>conftest.$ac_ext
4282 cat >>conftest.$ac_ext <<_ACEOF
4283 /* end confdefs.h. */
4284 $ac_includes_default
4285 #include <$ac_header>
4286 _ACEOF
4287 rm -f conftest.$ac_objext
4288 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
4289 (eval $ac_compile) 2>conftest.er1
4290 ac_status=$?
4291 grep -v '^ *+' conftest.er1 >conftest.err
4292 rm -f conftest.er1
4293 cat conftest.err >&5
4294 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4295 (exit $ac_status); } &&
4296 { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
4297 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4298 (eval $ac_try) 2>&5
4299 ac_status=$?
4300 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4301 (exit $ac_status); }; } &&
4302 { ac_try='test -s conftest.$ac_objext'
4303 { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
4304 (eval $ac_try) 2>&5
4305 ac_status=$?
4306 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4307 (exit $ac_status); }; }; then
4308 ac_header_compiler=yes
4309 else
4310 echo "$as_me: failed program was:" >&5
4311 sed 's/^/| /' conftest.$ac_ext >&5
4312
4313 ac_header_compiler=no
4314 fi
4315 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
4316 echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
4317 echo "${ECHO_T}$ac_header_compiler" >&6
4318
4319 # Is the header present?
4320 echo "$as_me:$LINENO: checking $ac_header presence" >&5
4321 echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
4322 cat >conftest.$ac_ext <<_ACEOF
4323 /* confdefs.h. */
4324 _ACEOF
4325 cat confdefs.h >>conftest.$ac_ext
4326 cat >>conftest.$ac_ext <<_ACEOF
4327 /* end confdefs.h. */
4328 #include <$ac_header>
4329 _ACEOF
4330 if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
4331 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
4332 ac_status=$?
4333 grep -v '^ *+' conftest.er1 >conftest.err
4334 rm -f conftest.er1
4335 cat conftest.err >&5
4336 echo "$as_me:$LINENO: \$? = $ac_status" >&5
4337 (exit $ac_status); } >/dev/null; then
4338 if test -s conftest.err; then
4339 ac_cpp_err=$ac_c_preproc_warn_flag
4340 ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
4341 else
4342 ac_cpp_err=
4343 fi
4344 else
4345 ac_cpp_err=yes
4346 fi
4347 if test -z "$ac_cpp_err"; then
4348 ac_header_preproc=yes
4349 else
4350 echo "$as_me: failed program was:" >&5
4351 sed 's/^/| /' conftest.$ac_ext >&5
4352
4353 ac_header_preproc=no
4354 fi
4355 rm -f conftest.err conftest.$ac_ext
4356 echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
4357 echo "${ECHO_T}$ac_header_preproc" >&6
4358
4359 # So? What about this header?
4360 case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
4361 yes:no: )
4362 { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
4363 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
4364 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
4365 echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
4366 ac_header_preproc=yes
4367 ;;
4368 no:yes:* )
4369 { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
4370 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
4371 { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
4372 echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
4373 { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
4374 echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
4375 { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
4376 echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
4377 { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
4378 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
4379 { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
4380 echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
4381 (
4382 cat <<\_ASBOX
4383 ## ------------------------------------------ ##
4384 ## Report this to the AC_PACKAGE_NAME lists. ##
4385 ## ------------------------------------------ ##
4386 _ASBOX
4387 ) |
4388 sed "s/^/$as_me: WARNING: /" >&2
4389 ;;
4390 esac
4391 echo "$as_me:$LINENO: checking for $ac_header" >&5
4392 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
4393 if eval "test \"\${$as_ac_Header+set}\" = set"; then
4394 echo $ECHO_N "(cached) $ECHO_C" >&6
4395 else
4396 eval "$as_ac_Header=\$ac_header_preproc"
4397 fi
4398 echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
4399 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
4400
4401 fi
4402 if test `eval echo '${'$as_ac_Header'}'` = yes; then
4403 cat >>confdefs.h <<_ACEOF
4404 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
4405 _ACEOF
4406
4407 fi
4408
4409 done
4410
4411 fi
4412
4413
4414 # Check whether --enable-incode-epsg or --disable-incode-epsg was given.
4415 if test "${enable_incode_epsg+set}" = set; then
4416 enableval="$enable_incode_epsg"
4417
4418 else
4419 enable_incode_epsg=no
4420 fi;
4421
4422 if test "$enable_incode_epsg" != "yes" ; then
4423 echo "EPSG tables will be read from .csv files."
4424 CSV_SOURCE="\$(CSV_FILE_OBJS)"
4425 else
4426 echo "EPSG tables will be linked into library."
4427 CSV_SOURCE="\$(CSV_INCODE_OBJS)"
4428 fi
4429 CSV_SOURCE=$CSV_SOURCE
4430
4431
4432
4433
4434
4435 ac_config_files="$ac_config_files Makefile bin/Makefile"
4436 cat >confcache <<\_ACEOF
4437 # This file is a shell script that caches the results of configure
4438 # tests run on this system so they can be shared between configure
4439 # scripts and configure runs, see configure's option --config-cache.
4440 # It is not useful on other systems. If it contains results you don't
4441 # want to keep, you may remove or edit it.
4442 #
4443 # config.status only pays attention to the cache file if you give it
4444 # the --recheck option to rerun configure.
4445 #
4446 # `ac_cv_env_foo' variables (set or unset) will be overridden when
4447 # loading this file, other *unset* `ac_cv_foo' will be assigned the
4448 # following values.
4449
4450 _ACEOF
4451
4452 # The following way of writing the cache mishandles newlines in values,
4453 # but we know of no workaround that is simple, portable, and efficient.
4454 # So, don't put newlines in cache variables' values.
4455 # Ultrix sh set writes to stderr and can't be redirected directly,
4456 # and sets the high bit in the cache file unless we assign to the vars.
4457 {
4458 (set) 2>&1 |
4459 case `(ac_space=' '; set | grep ac_space) 2>&1` in
4460 *ac_space=\ *)
4461 # `set' does not quote correctly, so add quotes (double-quote
4462 # substitution turns \\\\ into \\, and sed turns \\ into \).
4463 sed -n \
4464 "s/'/'\\\\''/g;
4465 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
4466 ;;
4467 *)
4468 # `set' quotes correctly as required by POSIX, so do not add quotes.
4469 sed -n \
4470 "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
4471 ;;
4472 esac;
4473 } |
4474 sed '
4475 t clear
4476 : clear
4477 s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
4478 t end
4479 /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
4480 : end' >>confcache
4481 if diff $cache_file confcache >/dev/null 2>&1; then :; else
4482 if test -w $cache_file; then
4483 test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
4484 cat confcache >$cache_file
4485 else
4486 echo "not updating unwritable cache $cache_file"
4487 fi
4488 fi
4489 rm -f confcache
4490
4491 test "x$prefix" = xNONE && prefix=$ac_default_prefix
4492 # Let make expand exec_prefix.
4493 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
4494
4495 # VPATH may cause trouble with some makes, so we remove $(srcdir),
4496 # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
4497 # trailing colons and then remove the whole line if VPATH becomes empty
4498 # (actually we leave an empty line to preserve line numbers).
4499 if test "x$srcdir" = x.; then
4500 ac_vpsub='/^[ ]*VPATH[ ]*=/{
4501 s/:*\$(srcdir):*/:/;
4502 s/:*\${srcdir}:*/:/;
4503 s/:*@srcdir@:*/:/;
4504 s/^\([^=]*=[ ]*\):*/\1/;
4505 s/:*$//;
4506 s/^[^=]*=[ ]*$//;
4507 }'
4508 fi
4509
4510 DEFS=-DHAVE_CONFIG_H
4511
4512 ac_libobjs=
4513 ac_ltlibobjs=
4514 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
4515 # 1. Remove the extension, and $U if already installed.
4516 ac_i=`echo "$ac_i" |
4517 sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
4518 # 2. Add them.
4519 ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
4520 ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
4521 done
4522 LIBOBJS=$ac_libobjs
4523
4524 LTLIBOBJS=$ac_ltlibobjs
4525
4526
4527
4528 : ${CONFIG_STATUS=./config.status}
4529 ac_clean_files_save=$ac_clean_files
4530 ac_clean_files="$ac_clean_files $CONFIG_STATUS"
4531 { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
4532 echo "$as_me: creating $CONFIG_STATUS" >&6;}
4533 cat >$CONFIG_STATUS <<_ACEOF
4534 #! $SHELL
4535 # Generated by $as_me.
4536 # Run this file to recreate the current configuration.
4537 # Compiler output produced by configure, useful for debugging
4538 # configure, is in config.log if it exists.
4539
4540 debug=false
4541 ac_cs_recheck=false
4542 ac_cs_silent=false
4543 SHELL=\${CONFIG_SHELL-$SHELL}
4544 _ACEOF
4545
4546 cat >>$CONFIG_STATUS <<\_ACEOF
4547 ## --------------------- ##
4548 ## M4sh Initialization. ##
4549 ## --------------------- ##
4550
4551 # Be Bourne compatible
4552 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
4553 emulate sh
4554 NULLCMD=:
4555 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
4556 # is contrary to our usage. Disable this feature.
4557 alias -g '${1+"$@"}'='"$@"'
4558 elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
4559 set -o posix
4560 fi
4561 DUALCASE=1; export DUALCASE # for MKS sh
4562
4563 # Support unset when possible.
4564 if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
4565 as_unset=unset
4566 else
4567 as_unset=false
4568 fi
4569
4570
4571 # Work around bugs in pre-3.0 UWIN ksh.
4572 $as_unset ENV MAIL MAILPATH
4573 PS1='$ '
4574 PS2='> '
4575 PS4='+ '
4576
4577 # NLS nuisances.
4578 for as_var in \
4579 LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
4580 LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
4581 LC_TELEPHONE LC_TIME
4582 do
4583 if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
4584 eval $as_var=C; export $as_var
4585 else
4586 $as_unset $as_var
4587 fi
4588 done
4589
4590 # Required to use basename.
4591 if expr a : '\(a\)' >/dev/null 2>&1; then
4592 as_expr=expr
4593 else
4594 as_expr=false
4595 fi
4596
4597 if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
4598 as_basename=basename
4599 else
4600 as_basename=false
4601 fi
4602
4603
4604 # Name of the executable.
4605 as_me=`$as_basename "$0" ||
4606 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
4607 X"$0" : 'X\(//\)$' \| \
4608 X"$0" : 'X\(/\)$' \| \
4609 . : '\(.\)' 2>/dev/null ||
4610 echo X/"$0" |
4611 sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
4612 /^X\/\(\/\/\)$/{ s//\1/; q; }
4613 /^X\/\(\/\).*/{ s//\1/; q; }
4614 s/.*/./; q'`
4615
4616
4617 # PATH needs CR, and LINENO needs CR and PATH.
4618 # Avoid depending upon Character Ranges.
4619 as_cr_letters='abcdefghijklmnopqrstuvwxyz'
4620 as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
4621 as_cr_Letters=$as_cr_letters$as_cr_LETTERS
4622 as_cr_digits='0123456789'
4623 as_cr_alnum=$as_cr_Letters$as_cr_digits
4624
4625 # The user is always right.
4626 if test "${PATH_SEPARATOR+set}" != set; then
4627 echo "#! /bin/sh" >conf$$.sh
4628 echo "exit 0" >>conf$$.sh
4629 chmod +x conf$$.sh
4630 if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
4631 PATH_SEPARATOR=';'
4632 else
4633 PATH_SEPARATOR=:
4634 fi
4635 rm -f conf$$.sh
4636 fi
4637
4638
4639 as_lineno_1=$LINENO
4640 as_lineno_2=$LINENO
4641 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
4642 test "x$as_lineno_1" != "x$as_lineno_2" &&
4643 test "x$as_lineno_3" = "x$as_lineno_2" || {
4644 # Find who we are. Look in the path if we contain no path at all
4645 # relative or not.
4646 case $0 in
4647 *[\\/]* ) as_myself=$0 ;;
4648 *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4649 for as_dir in $PATH
4650 do
4651 IFS=$as_save_IFS
4652 test -z "$as_dir" && as_dir=.
4653 test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
4654 done
4655
4656 ;;
4657 esac
4658 # We did not find ourselves, most probably we were run as `sh COMMAND'
4659 # in which case we are not to be found in the path.
4660 if test "x$as_myself" = x; then
4661 as_myself=$0
4662 fi
4663 if test ! -f "$as_myself"; then
4664 { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
4665 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
4666 { (exit 1); exit 1; }; }
4667 fi
4668 case $CONFIG_SHELL in
4669 '')
4670 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
4671 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
4672 do
4673 IFS=$as_save_IFS
4674 test -z "$as_dir" && as_dir=.
4675 for as_base in sh bash ksh sh5; do
4676 case $as_dir in
4677 /*)
4678 if ("$as_dir/$as_base" -c '
4679 as_lineno_1=$LINENO
4680 as_lineno_2=$LINENO
4681 as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
4682 test "x$as_lineno_1" != "x$as_lineno_2" &&
4683 test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
4684 $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
4685 $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
4686 CONFIG_SHELL=$as_dir/$as_base
4687 export CONFIG_SHELL
4688 exec "$CONFIG_SHELL" "$0" ${1+"$@"}
4689 fi;;
4690 esac
4691 done
4692 done
4693 ;;
4694 esac
4695
4696 # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
4697 # uniformly replaced by the line number. The first 'sed' inserts a
4698 # line-number line before each line; the second 'sed' does the real
4699 # work. The second script uses 'N' to pair each line-number line
4700 # with the numbered line, and appends trailing '-' during
4701 # substitution so that $LINENO is not a special case at line end.
4702 # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
4703 # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
4704 sed '=' <$as_myself |
4705 sed '
4706 N
4707 s,$,-,
4708 : loop
4709 s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
4710 t loop
4711 s,-$,,
4712 s,^['$as_cr_digits']*\n,,
4713 ' >$as_me.lineno &&
4714 chmod +x $as_me.lineno ||
4715 { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
4716 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
4717 { (exit 1); exit 1; }; }
4718
4719 # Don't try to exec as it changes $[0], causing all sort of problems
4720 # (the dirname of $[0] is not the place where we might find the
4721 # original and so on. Autoconf is especially sensible to this).
4722 . ./$as_me.lineno
4723 # Exit status is that of the last command.
4724 exit
4725 }
4726
4727
4728 case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
4729 *c*,-n*) ECHO_N= ECHO_C='
4730 ' ECHO_T=' ' ;;
4731 *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
4732 *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
4733 esac
4734
4735 if expr a : '\(a\)' >/dev/null 2>&1; then
4736 as_expr=expr
4737 else
4738 as_expr=false
4739 fi
4740
4741 rm -f conf$$ conf$$.exe conf$$.file
4742 echo >conf$$.file
4743 if ln -s conf$$.file conf$$ 2>/dev/null; then
4744 # We could just check for DJGPP; but this test a) works b) is more generic
4745 # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
4746 if test -f conf$$.exe; then
4747 # Don't use ln at all; we don't have any links
4748 as_ln_s='cp -p'
4749 else
4750 as_ln_s='ln -s'
4751 fi
4752 elif ln conf$$.file conf$$ 2>/dev/null; then
4753 as_ln_s=ln
4754 else
4755 as_ln_s='cp -p'
4756 fi
4757 rm -f conf$$ conf$$.exe conf$$.file
4758
4759 if mkdir -p . 2>/dev/null; then
4760 as_mkdir_p=:
4761 else
4762 test -d ./-p && rmdir ./-p
4763 as_mkdir_p=false
4764 fi
4765
4766 as_executable_p="test -f"
4767
4768 # Sed expression to map a string onto a valid CPP name.
4769 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
4770
4771 # Sed expression to map a string onto a valid variable name.
4772 as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
4773
4774
4775 # IFS
4776 # We need space, tab and new line, in precisely that order.
4777 as_nl='
4778 '
4779 IFS=" $as_nl"
4780
4781 # CDPATH.
4782 $as_unset CDPATH
4783
4784 exec 6>&1
4785
4786 # Open the log real soon, to keep \$[0] and so on meaningful, and to
4787 # report actual input values of CONFIG_FILES etc. instead of their
4788 # values after options handling. Logging --version etc. is OK.
4789 exec 5>>config.log
4790 {
4791 echo
4792 sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
4793 ## Running $as_me. ##
4794 _ASBOX
4795 } >&5
4796 cat >&5 <<_CSEOF
4797
4798 This file was extended by $as_me, which was
4799 generated by GNU Autoconf 2.59. Invocation command line was
4800
4801 CONFIG_FILES = $CONFIG_FILES
4802 CONFIG_HEADERS = $CONFIG_HEADERS
4803 CONFIG_LINKS = $CONFIG_LINKS
4804 CONFIG_COMMANDS = $CONFIG_COMMANDS
4805 $ $0 $@
4806
4807 _CSEOF
4808 echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
4809 echo >&5
4810 _ACEOF
4811
4812 # Files that config.status was made for.
4813 if test -n "$ac_config_files"; then
4814 echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
4815 fi
4816
4817 if test -n "$ac_config_headers"; then
4818 echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
4819 fi
4820
4821 if test -n "$ac_config_links"; then
4822 echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
4823 fi
4824
4825 if test -n "$ac_config_commands"; then
4826 echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
4827 fi
4828
4829 cat >>$CONFIG_STATUS <<\_ACEOF
4830
4831 ac_cs_usage="\
4832 \`$as_me' instantiates files from templates according to the
4833 current configuration.
4834
4835 Usage: $0 [OPTIONS] [FILE]...
4836
4837 -h, --help print this help, then exit
4838 -V, --version print version number, then exit
4839 -q, --quiet do not print progress messages
4840 -d, --debug don't remove temporary files
4841 --recheck update $as_me by reconfiguring in the same conditions
4842 --file=FILE[:TEMPLATE]
4843 instantiate the configuration file FILE
4844 --header=FILE[:TEMPLATE]
4845 instantiate the configuration header FILE
4846
4847 Configuration files:
4848 $config_files
4849
4850 Configuration headers:
4851 $config_headers
4852
4853 Report bugs to <bug-autoconf@gnu.org>."
4854 _ACEOF
4855
4856 cat >>$CONFIG_STATUS <<_ACEOF
4857 ac_cs_version="\\
4858 config.status
4859 configured by $0, generated by GNU Autoconf 2.59,
4860 with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
4861
4862 Copyright (C) 2003 Free Software Foundation, Inc.
4863 This config.status script is free software; the Free Software Foundation
4864 gives unlimited permission to copy, distribute and modify it."
4865 srcdir=$srcdir
4866 INSTALL="$INSTALL"
4867 _ACEOF
4868
4869 cat >>$CONFIG_STATUS <<\_ACEOF
4870 # If no file are specified by the user, then we need to provide default
4871 # value. By we need to know if files were specified by the user.
4872 ac_need_defaults=:
4873 while test $# != 0
4874 do
4875 case $1 in
4876 --*=*)
4877 ac_option=`expr "x$1" : 'x\([^=]*\)='`
4878 ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
4879 ac_shift=:
4880 ;;
4881 -*)
4882 ac_option=$1
4883 ac_optarg=$2
4884 ac_shift=shift
4885 ;;
4886 *) # This is not an option, so the user has probably given explicit
4887 # arguments.
4888 ac_option=$1
4889 ac_need_defaults=false;;
4890 esac
4891
4892 case $ac_option in
4893 # Handling of the options.
4894 _ACEOF
4895 cat >>$CONFIG_STATUS <<\_ACEOF
4896 -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
4897 ac_cs_recheck=: ;;
4898 --version | --vers* | -V )
4899 echo "$ac_cs_version"; exit 0 ;;
4900 --he | --h)
4901 # Conflict between --help and --header
4902 { { echo "$as_me:$LINENO: error: ambiguous option: $1
4903 Try \`$0 --help' for more information." >&5
4904 echo "$as_me: error: ambiguous option: $1
4905 Try \`$0 --help' for more information." >&2;}
4906 { (exit 1); exit 1; }; };;
4907 --help | --hel | -h )
4908 echo "$ac_cs_usage"; exit 0 ;;
4909 --debug | --d* | -d )
4910 debug=: ;;
4911 --file | --fil | --fi | --f )
4912 $ac_shift
4913 CONFIG_FILES="$CONFIG_FILES $ac_optarg"
4914 ac_need_defaults=false;;
4915 --header | --heade | --head | --hea )
4916 $ac_shift
4917 CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
4918 ac_need_defaults=false;;
4919 -q | -quiet | --quiet | --quie | --qui | --qu | --q \
4920 | -silent | --silent | --silen | --sile | --sil | --si | --s)
4921 ac_cs_silent=: ;;
4922
4923 # This is an error.
4924 -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
4925 Try \`$0 --help' for more information." >&5
4926 echo "$as_me: error: unrecognized option: $1
4927 Try \`$0 --help' for more information." >&2;}
4928 { (exit 1); exit 1; }; } ;;
4929
4930 *) ac_config_targets="$ac_config_targets $1" ;;
4931
4932 esac
4933 shift
4934 done
4935
4936 ac_configure_extra_args=
4937
4938 if $ac_cs_silent; then
4939 exec 6>/dev/null
4940 ac_configure_extra_args="$ac_configure_extra_args --silent"
4941 fi
4942
4943 _ACEOF
4944 cat >>$CONFIG_STATUS <<_ACEOF
4945 if \$ac_cs_recheck; then
4946 echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
4947 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
4948 fi
4949
4950 _ACEOF
4951
4952
4953
4954
4955
4956 cat >>$CONFIG_STATUS <<\_ACEOF
4957 for ac_config_target in $ac_config_targets
4958 do
4959 case "$ac_config_target" in
4960 # Handling of arguments.
4961 "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
4962 "bin/Makefile" ) CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;;
4963 "geo_config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS geo_config.h" ;;
4964 *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
4965 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
4966 { (exit 1); exit 1; }; };;
4967 esac
4968 done
4969
4970 # If the user did not use the arguments to specify the items to instantiate,
4971 # then the envvar interface is used. Set only those that are not.
4972 # We use the long form for the default assignment because of an extremely
4973 # bizarre bug on SunOS 4.1.3.
4974 if $ac_need_defaults; then
4975 test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
4976 test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
4977 fi
4978
4979 # Have a temporary directory for convenience. Make it in the build tree
4980 # simply because there is no reason to put it here, and in addition,
4981 # creating and moving files from /tmp can sometimes cause problems.
4982 # Create a temporary directory, and hook for its removal unless debugging.
4983 $debug ||
4984 {
4985 trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
4986 trap '{ (exit 1); exit 1; }' 1 2 13 15
4987 }
4988
4989 # Create a (secure) tmp directory for tmp files.
4990
4991 {
4992 tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
4993 test -n "$tmp" && test -d "$tmp"
4994 } ||
4995 {
4996 tmp=./confstat$$-$RANDOM
4997 (umask 077 && mkdir $tmp)
4998 } ||
4999 {
5000 echo "$me: cannot create a temporary directory in ." >&2
5001 { (exit 1); exit 1; }
5002 }
5003
5004 _ACEOF
5005
5006 cat >>$CONFIG_STATUS <<_ACEOF
5007
5008 #
5009 # CONFIG_FILES section.
5010 #
5011
5012 # No need to generate the scripts if there are no CONFIG_FILES.
5013 # This happens for instance when ./config.status config.h
5014 if test -n "\$CONFIG_FILES"; then
5015 # Protect against being on the right side of a sed subst in config.status.
5016 sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
5017 s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
5018 s,@SHELL@,$SHELL,;t t
5019 s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
5020 s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
5021 s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
5022 s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
5023 s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
5024 s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
5025 s,@exec_prefix@,$exec_prefix,;t t
5026 s,@prefix@,$prefix,;t t
5027 s,@program_transform_name@,$program_transform_name,;t t
5028 s,@bindir@,$bindir,;t t
5029 s,@sbindir@,$sbindir,;t t
5030 s,@libexecdir@,$libexecdir,;t t
5031 s,@datadir@,$datadir,;t t
5032 s,@sysconfdir@,$sysconfdir,;t t
5033 s,@sharedstatedir@,$sharedstatedir,;t t
5034 s,@localstatedir@,$localstatedir,;t t
5035 s,@libdir@,$libdir,;t t
5036 s,@includedir@,$includedir,;t t
5037 s,@oldincludedir@,$oldincludedir,;t t
5038 s,@infodir@,$infodir,;t t
5039 s,@mandir@,$mandir,;t t
5040 s,@build_alias@,$build_alias,;t t
5041 s,@host_alias@,$host_alias,;t t
5042 s,@target_alias@,$target_alias,;t t
5043 s,@DEFS@,$DEFS,;t t
5044 s,@ECHO_C@,$ECHO_C,;t t
5045 s,@ECHO_N@,$ECHO_N,;t t
5046 s,@ECHO_T@,$ECHO_T,;t t
5047 s,@LIBS@,$LIBS,;t t
5048 s,@build@,$build,;t t
5049 s,@build_cpu@,$build_cpu,;t t
5050 s,@build_vendor@,$build_vendor,;t t
5051 s,@build_os@,$build_os,;t t
5052 s,@host@,$host,;t t
5053 s,@host_cpu@,$host_cpu,;t t
5054 s,@host_vendor@,$host_vendor,;t t
5055 s,@host_os@,$host_os,;t t
5056 s,@target@,$target,;t t
5057 s,@target_cpu@,$target_cpu,;t t
5058 s,@target_vendor@,$target_vendor,;t t
5059 s,@target_os@,$target_os,;t t
5060 s,@VERSION_MAJOR@,$VERSION_MAJOR,;t t
5061 s,@VERSION_MINOR@,$VERSION_MINOR,;t t
5062 s,@VERSION_POINT@,$VERSION_POINT,;t t
5063 s,@CC@,$CC,;t t
5064 s,@CFLAGS@,$CFLAGS,;t t
5065 s,@LDFLAGS@,$LDFLAGS,;t t
5066 s,@CPPFLAGS@,$CPPFLAGS,;t t
5067 s,@ac_ct_CC@,$ac_ct_CC,;t t
5068 s,@EXEEXT@,$EXEEXT,;t t
5069 s,@OBJEXT@,$OBJEXT,;t t
5070 s,@CXX_WFLAGS@,$CXX_WFLAGS,;t t
5071 s,@C_WFLAGS@,$C_WFLAGS,;t t
5072 s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
5073 s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
5074 s,@INSTALL_DATA@,$INSTALL_DATA,;t t
5075 s,@LN_S@,$LN_S,;t t
5076 s,@RANLIB@,$RANLIB,;t t
5077 s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
5078 s,@CXX_PIC@,$CXX_PIC,;t t
5079 s,@C_PIC@,$C_PIC,;t t
5080 s,@LD_SHARED@,$LD_SHARED,;t t
5081 s,@SO_EXT@,$SO_EXT,;t t
5082 s,@GEOTIFF_SO@,$GEOTIFF_SO,;t t
5083 s,@GEOTIFF_IMP@,$GEOTIFF_IMP,;t t
5084 s,@GEOTIFF_DLL@,$GEOTIFF_DLL,;t t
5085 s,@CPP@,$CPP,;t t
5086 s,@EGREP@,$EGREP,;t t
5087 s,@ZIP_INC@,$ZIP_INC,;t t
5088 s,@TIFF_INC@,$TIFF_INC,;t t
5089 s,@PROJ_INC@,$PROJ_INC,;t t
5090 s,@CSV_SOURCE@,$CSV_SOURCE,;t t
5091 s,@LIBOBJS@,$LIBOBJS,;t t
5092 s,@LTLIBOBJS@,$LTLIBOBJS,;t t
5093 CEOF
5094
5095 _ACEOF
5096
5097 cat >>$CONFIG_STATUS <<\_ACEOF
5098 # Split the substitutions into bite-sized pieces for seds with
5099 # small command number limits, like on Digital OSF/1 and HP-UX.
5100 ac_max_sed_lines=48
5101 ac_sed_frag=1 # Number of current file.
5102 ac_beg=1 # First line for current file.
5103 ac_end=$ac_max_sed_lines # Line after last line for current file.
5104 ac_more_lines=:
5105 ac_sed_cmds=
5106 while $ac_more_lines; do
5107 if test $ac_beg -gt 1; then
5108 sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
5109 else
5110 sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
5111 fi
5112 if test ! -s $tmp/subs.frag; then
5113 ac_more_lines=false
5114 else
5115 # The purpose of the label and of the branching condition is to
5116 # speed up the sed processing (if there are no `@' at all, there
5117 # is no need to browse any of the substitutions).
5118 # These are the two extra sed commands mentioned above.
5119 (echo ':t
5120 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
5121 if test -z "$ac_sed_cmds"; then
5122 ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
5123 else
5124 ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
5125 fi
5126 ac_sed_frag=`expr $ac_sed_frag + 1`
5127 ac_beg=$ac_end
5128 ac_end=`expr $ac_end + $ac_max_sed_lines`
5129 fi
5130 done
5131 if test -z "$ac_sed_cmds"; then
5132 ac_sed_cmds=cat
5133 fi
5134 fi # test -n "$CONFIG_FILES"
5135
5136 _ACEOF
5137 cat >>$CONFIG_STATUS <<\_ACEOF
5138 for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
5139 # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
5140 case $ac_file in
5141 - | *:- | *:-:* ) # input from stdin
5142 cat >$tmp/stdin
5143 ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
5144 ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
5145 *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
5146 ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
5147 * ) ac_file_in=$ac_file.in ;;
5148 esac
5149
5150 # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
5151 ac_dir=`(dirname "$ac_file") 2>/dev/null ||
5152 $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
5153 X"$ac_file" : 'X\(//\)[^/]' \| \
5154 X"$ac_file" : 'X\(//\)$' \| \
5155 X"$ac_file" : 'X\(/\)' \| \
5156 . : '\(.\)' 2>/dev/null ||
5157 echo X"$ac_file" |
5158 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
5159 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
5160 /^X\(\/\/\)$/{ s//\1/; q; }
5161 /^X\(\/\).*/{ s//\1/; q; }
5162 s/.*/./; q'`
5163 { if $as_mkdir_p; then
5164 mkdir -p "$ac_dir"
5165 else
5166 as_dir="$ac_dir"
5167 as_dirs=
5168 while test ! -d "$as_dir"; do
5169 as_dirs="$as_dir $as_dirs"
5170 as_dir=`(dirname "$as_dir") 2>/dev/null ||
5171 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
5172 X"$as_dir" : 'X\(//\)[^/]' \| \
5173 X"$as_dir" : 'X\(//\)$' \| \
5174 X"$as_dir" : 'X\(/\)' \| \
5175 . : '\(.\)' 2>/dev/null ||
5176 echo X"$as_dir" |
5177 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
5178 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
5179 /^X\(\/\/\)$/{ s//\1/; q; }
5180 /^X\(\/\).*/{ s//\1/; q; }
5181 s/.*/./; q'`
5182 done
5183 test ! -n "$as_dirs" || mkdir $as_dirs
5184 fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
5185 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
5186 { (exit 1); exit 1; }; }; }
5187
5188 ac_builddir=.
5189
5190 if test "$ac_dir" != .; then
5191 ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
5192 # A "../" for each directory in $ac_dir_suffix.
5193 ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
5194 else
5195 ac_dir_suffix= ac_top_builddir=
5196 fi
5197
5198 case $srcdir in
5199 .) # No --srcdir option. We are building in place.
5200 ac_srcdir=.
5201 if test -z "$ac_top_builddir"; then
5202 ac_top_srcdir=.
5203 else
5204 ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
5205 fi ;;
5206 [\\/]* | ?:[\\/]* ) # Absolute path.
5207 ac_srcdir=$srcdir$ac_dir_suffix;
5208 ac_top_srcdir=$srcdir ;;
5209 *) # Relative path.
5210 ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
5211 ac_top_srcdir=$ac_top_builddir$srcdir ;;
5212 esac
5213
5214 # Do not use `cd foo && pwd` to compute absolute paths, because
5215 # the directories may not exist.
5216 case `pwd` in
5217 .) ac_abs_builddir="$ac_dir";;
5218 *)
5219 case "$ac_dir" in
5220 .) ac_abs_builddir=`pwd`;;
5221 [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";;
5222 *) ac_abs_builddir=`pwd`/"$ac_dir";;
5223 esac;;
5224 esac
5225 case $ac_abs_builddir in
5226 .) ac_abs_top_builddir=${ac_top_builddir}.;;
5227 *)
5228 case ${ac_top_builddir}. in
5229 .) ac_abs_top_builddir=$ac_abs_builddir;;
5230 [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;;
5231 *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;;
5232 esac;;
5233 esac
5234 case $ac_abs_builddir in
5235 .) ac_abs_srcdir=$ac_srcdir;;
5236 *)
5237 case $ac_srcdir in
5238 .) ac_abs_srcdir=$ac_abs_builddir;;
5239 [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;;
5240 *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;;
5241 esac;;
5242 esac
5243 case $ac_abs_builddir in
5244 .) ac_abs_top_srcdir=$ac_top_srcdir;;
5245 *)
5246 case $ac_top_srcdir in
5247 .) ac_abs_top_srcdir=$ac_abs_builddir;;
5248 [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;;
5249 *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;;
5250 esac;;
5251 esac
5252
5253
5254 case $INSTALL in
5255 [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
5256 *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
5257 esac
5258
5259 # Let's still pretend it is `configure' which instantiates (i.e., don't
5260 # use $as_me), people would be surprised to read:
5261 # /* config.h. Generated by config.status. */
5262 if test x"$ac_file" = x-; then
5263 configure_input=
5264 else
5265 configure_input="$ac_file. "
5266 fi
5267 configure_input=$configure_input"Generated from `echo $ac_file_in |
5268 sed 's,.*/,,'` by configure."
5269
5270 # First look for the input files in the build tree, otherwise in the
5271 # src tree.
5272 ac_file_inputs=`IFS=:
5273 for f in $ac_file_in; do
5274 case $f in
5275 -) echo $tmp/stdin ;;
5276 [\\/$]*)
5277 # Absolute (can't be DOS-style, as IFS=:)
5278 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
5279 echo "$as_me: error: cannot find input file: $f" >&2;}
5280 { (exit 1); exit 1; }; }
5281 echo "$f";;
5282 *) # Relative
5283 if test -f "$f"; then
5284 # Build tree
5285 echo "$f"
5286 elif test -f "$srcdir/$f"; then
5287 # Source tree
5288 echo "$srcdir/$f"
5289 else
5290 # /dev/null tree
5291 { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
5292 echo "$as_me: error: cannot find input file: $f" >&2;}
5293 { (exit 1); exit 1; }; }
5294 fi;;
5295 esac
5296 done` || { (exit 1); exit 1; }
5297
5298 if test x"$ac_file" != x-; then
5299 { echo "$as_me:$LINENO: creating $ac_file" >&5
5300 echo "$as_me: creating $ac_file" >&6;}
5301 rm -f "$ac_file"
5302 fi
5303 _ACEOF
5304 cat >>$CONFIG_STATUS <<_ACEOF
5305 sed "$ac_vpsub
5306 $extrasub
5307 _ACEOF
5308 cat >>$CONFIG_STATUS <<\_ACEOF
5309 :t
5310 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
5311 s,@configure_input@,$configure_input,;t t
5312 s,@srcdir@,$ac_srcdir,;t t
5313 s,@abs_srcdir@,$ac_abs_srcdir,;t t
5314 s,@top_srcdir@,$ac_top_srcdir,;t t
5315 s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
5316 s,@builddir@,$ac_builddir,;t t
5317 s,@abs_builddir@,$ac_abs_builddir,;t t
5318 s,@top_builddir@,$ac_top_builddir,;t t
5319 s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
5320 s,@INSTALL@,$ac_INSTALL,;t t
5321 " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
5322 rm -f $tmp/stdin
5323 if test x"$ac_file" != x-; then
5324 mv $tmp/out $ac_file
5325 else
5326 cat $tmp/out
5327 rm -f $tmp/out
5328 fi
5329
5330 done
5331 _ACEOF
5332 cat >>$CONFIG_STATUS <<\_ACEOF
5333
5334 #
5335 # CONFIG_HEADER section.
5336 #
5337
5338 # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
5339 # NAME is the cpp macro being defined and VALUE is the value it is being given.
5340 #
5341 # ac_d sets the value in "#define NAME VALUE" lines.
5342 ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)'
5343 ac_dB='[ ].*$,\1#\2'
5344 ac_dC=' '
5345 ac_dD=',;t'
5346 # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
5347 ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)'
5348 ac_uB='$,\1#\2define\3'
5349 ac_uC=' '
5350 ac_uD=',;t'
5351
5352 for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
5353 # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
5354 case $ac_file in
5355 - | *:- | *:-:* ) # input from stdin
5356 cat >$tmp/stdin
5357 ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
5358 ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
5359 *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
5360 ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
5361 * ) ac_file_in=$ac_file.in ;;
5362 esac
5363
5364 test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
5365 echo "$as_me: creating $ac_file" >&6;}
5366
5367 # First look for the input files in the build tree, otherwise in the
5368 # src tree.
5369 ac_file_inputs=`IFS=:
5370 for f in $ac_file_in; do
5371 case $f in
5372 -) echo $tmp/stdin ;;
5373 [\\/$]*)
5374 # Absolute (can't be DOS-style, as IFS=:)
5375 test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
5376 echo "$as_me: error: cannot find input file: $f" >&2;}
5377 { (exit 1); exit 1; }; }
5378 # Do quote $f, to prevent DOS paths from being IFS'd.
5379 echo "$f";;
5380 *) # Relative
5381 if test -f "$f"; then
5382 # Build tree
5383 echo "$f"
5384 elif test -f "$srcdir/$f"; then
5385 # Source tree
5386 echo "$srcdir/$f"
5387 else
5388 # /dev/null tree
5389 { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
5390 echo "$as_me: error: cannot find input file: $f" >&2;}
5391 { (exit 1); exit 1; }; }
5392 fi;;
5393 esac
5394 done` || { (exit 1); exit 1; }
5395 # Remove the trailing spaces.
5396 sed 's/[ ]*$//' $ac_file_inputs >$tmp/in
5397
5398 _ACEOF
5399
5400 # Transform confdefs.h into two sed scripts, `conftest.defines' and
5401 # `conftest.undefs', that substitutes the proper values into
5402 # config.h.in to produce config.h. The first handles `#define'
5403 # templates, and the second `#undef' templates.
5404 # And first: Protect against being on the right side of a sed subst in
5405 # config.status. Protect against being in an unquoted here document
5406 # in config.status.
5407 rm -f conftest.defines conftest.undefs
5408 # Using a here document instead of a string reduces the quoting nightmare.
5409 # Putting comments in sed scripts is not portable.
5410 #
5411 # `end' is used to avoid that the second main sed command (meant for
5412 # 0-ary CPP macros) applies to n-ary macro definitions.
5413 # See the Autoconf documentation for `clear'.
5414 cat >confdef2sed.sed <<\_ACEOF
5415 s/[\\&,]/\\&/g
5416 s,[\\$`],\\&,g
5417 t clear
5418 : clear
5419 s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
5420 t end
5421 s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
5422 : end
5423 _ACEOF
5424 # If some macros were called several times there might be several times
5425 # the same #defines, which is useless. Nevertheless, we may not want to
5426 # sort them, since we want the *last* AC-DEFINE to be honored.
5427 uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
5428 sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
5429 rm -f confdef2sed.sed
5430
5431 # This sed command replaces #undef with comments. This is necessary, for
5432 # example, in the case of _POSIX_SOURCE, which is predefined and required
5433 # on some systems where configure will not decide to define it.
5434 cat >>conftest.undefs <<\_ACEOF
5435 s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
5436 _ACEOF
5437
5438 # Break up conftest.defines because some shells have a limit on the size
5439 # of here documents, and old seds have small limits too (100 cmds).
5440 echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
5441 echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
5442 echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
5443 echo ' :' >>$CONFIG_STATUS
5444 rm -f conftest.tail
5445 while grep . conftest.defines >/dev/null
5446 do
5447 # Write a limited-size here document to $tmp/defines.sed.
5448 echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
5449 # Speed up: don't consider the non `#define' lines.
5450 echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS
5451 # Work around the forget-to-reset-the-flag bug.
5452 echo 't clr' >>$CONFIG_STATUS
5453 echo ': clr' >>$CONFIG_STATUS
5454 sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
5455 echo 'CEOF
5456 sed -f $tmp/defines.sed $tmp/in >$tmp/out
5457 rm -f $tmp/in
5458 mv $tmp/out $tmp/in
5459 ' >>$CONFIG_STATUS
5460 sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
5461 rm -f conftest.defines
5462 mv conftest.tail conftest.defines
5463 done
5464 rm -f conftest.defines
5465 echo ' fi # grep' >>$CONFIG_STATUS
5466 echo >>$CONFIG_STATUS
5467
5468 # Break up conftest.undefs because some shells have a limit on the size
5469 # of here documents, and old seds have small limits too (100 cmds).
5470 echo ' # Handle all the #undef templates' >>$CONFIG_STATUS
5471 rm -f conftest.tail
5472 while grep . conftest.undefs >/dev/null
5473 do
5474 # Write a limited-size here document to $tmp/undefs.sed.
5475 echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
5476 # Speed up: don't consider the non `#undef'
5477 echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS
5478 # Work around the forget-to-reset-the-flag bug.
5479 echo 't clr' >>$CONFIG_STATUS
5480 echo ': clr' >>$CONFIG_STATUS
5481 sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
5482 echo 'CEOF
5483 sed -f $tmp/undefs.sed $tmp/in >$tmp/out
5484 rm -f $tmp/in
5485 mv $tmp/out $tmp/in
5486 ' >>$CONFIG_STATUS
5487 sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
5488 rm -f conftest.undefs
5489 mv conftest.tail conftest.undefs
5490 done
5491 rm -f conftest.undefs
5492
5493 cat >>$CONFIG_STATUS <<\_ACEOF
5494 # Let's still pretend it is `configure' which instantiates (i.e., don't
5495 # use $as_me), people would be surprised to read:
5496 # /* config.h. Generated by config.status. */
5497 if test x"$ac_file" = x-; then
5498 echo "/* Generated by configure. */" >$tmp/config.h
5499 else
5500 echo "/* $ac_file. Generated by configure. */" >$tmp/config.h
5501 fi
5502 cat $tmp/in >>$tmp/config.h
5503 rm -f $tmp/in
5504 if test x"$ac_file" != x-; then
5505 if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
5506 { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
5507 echo "$as_me: $ac_file is unchanged" >&6;}
5508 else
5509 ac_dir=`(dirname "$ac_file") 2>/dev/null ||
5510 $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
5511 X"$ac_file" : 'X\(//\)[^/]' \| \
5512 X"$ac_file" : 'X\(//\)$' \| \
5513 X"$ac_file" : 'X\(/\)' \| \
5514 . : '\(.\)' 2>/dev/null ||
5515 echo X"$ac_file" |
5516 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
5517 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
5518 /^X\(\/\/\)$/{ s//\1/; q; }
5519 /^X\(\/\).*/{ s//\1/; q; }
5520 s/.*/./; q'`
5521 { if $as_mkdir_p; then
5522 mkdir -p "$ac_dir"
5523 else
5524 as_dir="$ac_dir"
5525 as_dirs=
5526 while test ! -d "$as_dir"; do
5527 as_dirs="$as_dir $as_dirs"
5528 as_dir=`(dirname "$as_dir") 2>/dev/null ||
5529 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
5530 X"$as_dir" : 'X\(//\)[^/]' \| \
5531 X"$as_dir" : 'X\(//\)$' \| \
5532 X"$as_dir" : 'X\(/\)' \| \
5533 . : '\(.\)' 2>/dev/null ||
5534 echo X"$as_dir" |
5535 sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
5536 /^X\(\/\/\)[^/].*/{ s//\1/; q; }
5537 /^X\(\/\/\)$/{ s//\1/; q; }
5538 /^X\(\/\).*/{ s//\1/; q; }
5539 s/.*/./; q'`
5540 done
5541 test ! -n "$as_dirs" || mkdir $as_dirs
5542 fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
5543 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
5544 { (exit 1); exit 1; }; }; }
5545
5546 rm -f $ac_file
5547 mv $tmp/config.h $ac_file
5548 fi
5549 else
5550 cat $tmp/config.h
5551 rm -f $tmp/config.h
5552 fi
5553 done
5554 _ACEOF
5555
5556 cat >>$CONFIG_STATUS <<\_ACEOF
5557
5558 { (exit 0); exit 0; }
5559 _ACEOF
5560 chmod +x $CONFIG_STATUS
5561 ac_clean_files=$ac_clean_files_save
5562
5563
5564 # configure is writing to config.log, and then calls config.status.
5565 # config.status does its own redirection, appending to config.log.
5566 # Unfortunately, on DOS this fails, as config.log is still kept open
5567 # by configure, so config.status won't be able to write to it; its
5568 # output is simply discarded. So we exec the FD to /dev/null,
5569 # effectively closing config.log, so it can be properly (re)opened and
5570 # appended to by config.status. When coming back to configure, we
5571 # need to make the FD available again.
5572 if test "$no_create" != yes; then
5573 ac_cs_success=:
5574 ac_config_status_args=
5575 test "$silent" = yes &&
5576 ac_config_status_args="$ac_config_status_args --quiet"
5577 exec 5>/dev/null
5578 $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
5579 exec 5>>config.log
5580 # Use ||, not &&, to avoid exiting from the if with $? = 1, which
5581 # would make configure fail if this is the last instruction.
5582 $ac_cs_success || { (exit 1); exit 1; }
5583 fi
5584
0 dnl Process this file with autoconf to produce a configure script.
1 AC_INIT(geotiff.h)
2 AC_CONFIG_HEADER(geo_config.h)
3 AC_CANONICAL_HOST
4 AC_CANONICAL_TARGET
5
6 VERSION_MAJOR=1
7 VERSION_MINOR=2
8 VERSION_POINT=4
9 AC_SUBST(VERSION_MAJOR,$VERSION_MAJOR)
10 AC_SUBST(VERSION_MINOR,$VERSION_MINOR)
11 AC_SUBST(VERSION_POINT,$VERSION_POINT)
12
13 dnl Checks for programs.
14 AC_PROG_CC
15 AC_COMPILER_WFLAGS
16
17 AC_PROG_INSTALL
18 AC_PROG_LN_S
19 AC_PROG_RANLIB
20 AC_COMPILER_PIC
21 AC_LD_SHARED
22
23 #
24 # If we have shared library support define that we want to build
25 # the libgeotiff.so
26
27 GEOTIFF_SO=
28 GEOTIFF_DLL=
29 GEOTIFF_IMP=
30 EXEEXT=
31 if test "$LD_SHARED" != "/bin/true" ; then
32 case $host in
33 *-pc-cygwin*) EXEEXT=.exe
34 GEOTIFF_SO=cyggeotiff-1.dll
35 GEOTIFF_DLL=cyggeotiff-1.dll
36 GEOTIFF_IMP=libgeotiff.dll.a
37 LD_SHARED="gcc -shared -Wl,--export-all -Wl,--out-implib=\$(GEOTIFF_IMP)" ;;
38 *) GEOTIFF_SO=libgeotiff.${SO_EXT}.$VERSION_MAJOR.$VERSION_MINOR.$VERSION_POINT ;;
39 esac
40 fi
41 AC_SUBST(GEOTIFF_SO,$GEOTIFF_SO)
42 AC_SUBST(GEOTIFF_IMP,$GEOTIFF_IMP)
43 AC_SUBST(GEOTIFF_DLL,$GEOTIFF_DLL)
44 AC_SUBST(EXEEXT,$EXEEXT)
45
46 dnl Checks for libraries.
47 AC_CHECK_LIB(m,exp,,,)
48
49 dnl We want to honor the users wishes with regard to linking.
50 LIBS="$LDFLAGS $LIBS"
51
52 dnl We check for headers
53 AC_HEADER_STDC
54 AC_CHECK_HEADERS(string.h strings.h stdlib.h)
55
56 dnl
57 dnl Add option to include libz in library list for use of libtiff.
58 dnl
59 AC_ARG_WITH(zip, [ --with-zip=dir Use ZIP library in directory dir],[ZIP=$withval],[ZIP=yes])
60 if test "$ZIP" = "yes" ; then
61 AC_CHECK_LIB(z,inflateInit_,,,-lm)
62 AC_CHECK_HEADERS(zlib.h,,)
63 AC_DEFINE(HAVE_ZIP)
64 else
65 if test "$ZIP" != "no" ; then
66 LIBS="${LIBS} -L${ZIP}/lib -lz"
67 ZIP_INC="-I${ZIP}/include"
68 AC_SUBST(ZIP_INC,$ZIP_INC)
69 AC_DEFINE(HAVE_ZIP)
70 echo "Using user supplied libzip directory: "$ZIP
71 fi
72 fi
73
74 dnl
75 dnl Add option to include libjpeg in library list for use of libtiff.
76 dnl
77 AC_ARG_WITH(jpeg, [ --with-jpeg=dir Use JPEG library in directory dir],[JPEG=$withval],[JPEG=yes])
78 if test "$JPEG" = "yes" ; then
79 AC_CHECK_LIB(jpeg,jinit_compress_master,,,-lm)
80 AC_DEFINE(HAVE_JPEG)
81 else
82 if test "$JPEG" != "no" ; then
83 LIBS="${LIBS} -L${JPEG} -ljpeg"
84 AC_DEFINE(HAVE_JPEG)
85 echo "Using user supplied libjpeg directory: "$JPEG
86 fi
87 fi
88
89 dnl
90 dnl Special logic to try and find a user specified libtiff tree. If not
91 dnl available check if the system directories have the library, _and_ the
92 dnl required private include files. Normally these private include files
93 dnl (tiffiop.h) are not installed with the public interface.
94 dnl
95 AC_ARG_WITH(libtiff, [ --with-libtiff=dir Use libtiff in directory dir],,)
96
97 if test "$with_libtiff" != "" ; then
98 if test -f $with_libtiff/include/tiffio.h -a -d $with_libtiff/lib ; then
99 LIBS="-L$with_libtiff/lib -ltiff $LIBS"
100 TIFF_INC=-I$with_libtiff/include
101 else
102 LIBS="-L$with_libtiff -ltiff $LIBS"
103 TIFF_INC=-I$with_libtiff
104 fi
105 LIBS_SAVED="$LIBS"
106 AC_CHECK_LIB(tiff,TIFFOpen,,
107 AC_MSG_ERROR([failed to link with -ltiff to find TIFFOpen]),-lm)
108 AC_CHECK_LIB(tiff,TIFFMergeFieldInfo,,
109 AC_MSG_ERROR([Libtiff 3.6.0 Beta or later required for this version of
110 libgeotiff. Please upgrade or use an older version of libgeotiff.]),-lm)
111 LIBS="$LIBS_SAVED"
112 else
113 AC_CHECK_LIB(tiff,TIFFOpen,,
114 AC_MSG_ERROR([You will need to substantially rewrite libxtiff to
115 build libgeotiff without libtiff]),-lm)
116 LIBS_SAVED="$LIBS"
117 AC_CHECK_LIB(tiff,TIFFMergeFieldInfo,,
118 AC_MSG_ERROR([Libtiff 3.6.0 Beta or later required for this version of
119 libgeotiff. Please upgrade libtiff or use an older version of libgeotiff.]),-lm)
120 LIBS="$LIBS_SAVED"
121 TIFF_INC=
122 fi
123
124 AC_SUBST(TIFF_INC,$TIFF_INC)
125
126 dnl
127 dnl Try and find libproj.a, and projects.h
128 dnl
129
130 AC_ARG_WITH(proj, [ --with-proj[=ARG] Use PROJ.4 library (ARG=no or path)],[PROJ_HOME=$withval],[PROJ_HOME=])
131
132 if test "$PROJ_HOME" != "" -a "$PROJ_HOME" != "no" ; then
133 if test -d "$PROJ_HOME/src/pj_init.c" ; then
134 PROJ_HOME=$PROJ_HOME/src
135 fi
136
137 dnl Old PROJ.4 build tree, without automake
138 if test -f "$PROJ_HOME/libproj.a" -a -f "$PROJ_HOME/projects.h" ; then
139 PROJ_LIB=$PROJ_HOME/libproj.a
140 PROJ_INC=$PROJ_HOME
141
142 dnl New PROJ.4 build tree, with automake
143 elif test -f "$PROJ_HOME/.libs/libproj.a" -a -f "$PROJ_HOME/projects.h" ; then
144 PROJ_LIB=$PROJ_HOME/.libs/libproj.a
145 PROJ_INC=$PROJ_HOME
146
147 dnl Installed tree in an odd place
148 elif test \( -f "$PROJ_HOME/lib/libproj.a" -o -f "$PROJ_HOME/lib/libproj.so" \) -a -f "$PROJ_HOME/include/proj_api.h"; then
149 PROJ_LIB="-L$PROJ_HOME/lib -lproj"
150 PROJ_INC=$PROJ_HOME/include
151 else
152 echo "PROJ_HOME=$PROJ_HOME, but either projects.h or libproj.a not found!"
153 fi
154 fi
155
156 if test "$PROJ_HOME" = "no" ; then
157 echo "PROJ.4 support disabled."
158
159 elif test "$PROJ_LIB" != "" -a "$PROJ_INC" != "" ; then
160 echo "Found $PROJ_LIB"
161 echo "Found $PROJ_INC/projects.h"
162
163 LIBS="$PROJ_LIB $LIBS"
164 PROJ_INC=-I$PROJ_INC
165
166 AC_SUBST(PROJ_INC,$PROJ_INC)
167 AC_DEFINE(HAVE_PROJECTS_H)
168 AC_DEFINE(HAVE_LIBPROJ)
169 else
170 AC_CHECK_LIB(proj,pj_init,,,-lm)
171 AC_CHECK_HEADERS(projects.h,,)
172 fi
173
174 dnl
175 dnl Has the user requested "incode" EPSG tables, overriding the
176 dnl default use of EPSG tables in csv files? Temporarily unvailable.
177 dnl
178
179 AC_ARG_ENABLE(incode-epsg, [ --enable-incode-epsg Use C code EPSG tables],, enable_incode_epsg=no)
180
181 if test "$enable_incode_epsg" != "yes" ; then
182 echo "EPSG tables will be read from .csv files."
183 CSV_SOURCE="\$(CSV_FILE_OBJS)"
184 else
185 echo "EPSG tables will be linked into library."
186 CSV_SOURCE="\$(CSV_INCODE_OBJS)"
187 fi
188 AC_SUBST(CSV_SOURCE,$CSV_SOURCE)
189
190
191
192
193 AC_OUTPUT(Makefile bin/Makefile)
0 /******************************************************************************
1 * Copyright (c) 1999, Frank Warmerdam
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included
11 * in all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19 * DEALINGS IN THE SOFTWARE.
20 ******************************************************************************
21 *
22 * cpl_csv.c: Support functions for accessing CSV files.
23 *
24 * $Log: cpl_csv.c,v $
25 * Revision 1.16 2003/07/10 18:03:28 warmerda
26 * don't crash if NULL passed to gtCSVAccess()
27 *
28 * Revision 1.15 2003/01/20 06:46:35 warmerda
29 * search for pcs.csv, not horiz_cs.csv
30 *
31 * Revision 1.14 2003/01/15 04:39:58 warmerda
32 * change internal name of CSVAccess
33 *
34 * Revision 1.13 2002/11/28 22:26:41 warmerda
35 * upgraded to proper CSV formatting, and in-memory caching
36 *
37 * Revision 1.12 2002/06/19 03:51:15 warmerda
38 * migrated cpl_csv.h into cpl_serv.h
39 *
40 * Revision 1.11 2001/03/05 04:49:56 warmerda
41 * try to clear CPLReadLine buffer on deaccess
42 *
43 * Revision 1.10 2001/01/17 15:32:19 warmerda
44 * Include /usr/share/epsg_csv and share/epsg_csv in csv search path.
45 *
46 * Revision 1.9 2000/12/12 19:34:36 warmerda
47 * Use CSV_DATA_DIR if defined.
48 *
49 * Revision 1.8 2000/08/22 04:33:33 warmerda
50 * added support for /usr/local/shared/epsg_csv
51 *
52 * Revision 1.7 1999/12/03 14:42:59 warmerda
53 * Passing a NULL filename into CSVAccess() now results in a graceful
54 * failure to open the file.
55 *
56 * Revision 1.6 1999/06/26 17:28:51 warmerda
57 * Fixed reading of records with newlines embedded in quoted strings.
58 *
59 * Revision 1.5 1999/05/04 03:07:24 warmerda
60 * avoid warning
61 *
62 * Revision 1.4 1999/04/28 19:59:56 warmerda
63 * added some doxygen style documentation
64 *
65 * Revision 1.3 1999/03/17 19:53:15 geotiff
66 * sys includes moved to cpl_serv.h
67 *
68 * Revision 1.2 1999/03/10 16:54:42 geotiff
69 * Added use of the GEOTIFF_CSV environment variable to locate CSV files.
70 *
71 * Revision 1.1 1999/03/09 15:57:04 geotiff
72 * New
73 *
74 * Revision 1.2 1999/02/24 16:23:21 warmerda
75 * added lots
76 *
77 * Revision 1.1 1999/01/05 16:52:36 warmerda
78 * New
79 *
80 */
81
82 #include "cpl_serv.h"
83 #include "geo_tiffp.h"
84
85 /* ==================================================================== */
86 /* The CSVTable is a persistant set of info about an open CSV */
87 /* table. While it doesn't currently maintain a record index, */
88 /* or in-memory copy of the table, it could be changed to do so */
89 /* in the future. */
90 /* ==================================================================== */
91 typedef struct ctb {
92 FILE *fp;
93
94 struct ctb *psNext;
95
96 char *pszFilename;
97
98 char **papszFieldNames;
99
100 char **papszRecFields;
101
102 int iLastLine;
103
104 /* Cache for whole file */
105 int nLineCount;
106 char **papszLines;
107 int *panLineIndex;
108 char *pszRawData;
109 } CSVTable;
110
111 static CSVTable *psCSVTableList = NULL;
112
113 /************************************************************************/
114 /* CSVAccess() */
115 /* */
116 /* This function will fetch a handle to the requested table. */
117 /* If not found in the ``open table list'' the table will be */
118 /* opened and added to the list. Eventually this function may */
119 /* become public with an abstracted return type so that */
120 /* applications can set options about the table. For now this */
121 /* isn't done. */
122 /************************************************************************/
123
124 static CSVTable *gtCSVAccess( const char * pszFilename )
125
126 {
127 CSVTable *psTable;
128 FILE *fp;
129
130 if( pszFilename == NULL )
131 return NULL;
132
133 /* -------------------------------------------------------------------- */
134 /* Is the table already in the list. */
135 /* -------------------------------------------------------------------- */
136 for( psTable = psCSVTableList; psTable != NULL; psTable = psTable->psNext )
137 {
138 if( EQUAL(psTable->pszFilename,pszFilename) )
139 {
140 /*
141 * Eventually we should consider promoting to the front of
142 * the list to accelerate frequently accessed tables.
143 */
144
145 return( psTable );
146 }
147 }
148
149 /* -------------------------------------------------------------------- */
150 /* If not, try to open it. */
151 /* -------------------------------------------------------------------- */
152 fp = VSIFOpen( pszFilename, "rb" );
153 if( fp == NULL )
154 return NULL;
155
156 /* -------------------------------------------------------------------- */
157 /* Create an information structure about this table, and add to */
158 /* the front of the list. */
159 /* -------------------------------------------------------------------- */
160 psTable = (CSVTable *) CPLCalloc(sizeof(CSVTable),1);
161
162 psTable->fp = fp;
163 psTable->pszFilename = CPLStrdup( pszFilename );
164 psTable->psNext = psCSVTableList;
165
166 psCSVTableList = psTable;
167
168 /* -------------------------------------------------------------------- */
169 /* Read the table header record containing the field names. */
170 /* -------------------------------------------------------------------- */
171 psTable->papszFieldNames = CSVReadParseLine( fp );
172
173 return( psTable );
174 }
175
176 /************************************************************************/
177 /* CSVDeaccess() */
178 /************************************************************************/
179
180 void CSVDeaccess( const char * pszFilename )
181
182 {
183 CSVTable *psLast, *psTable;
184
185 /* -------------------------------------------------------------------- */
186 /* A NULL means deaccess all tables. */
187 /* -------------------------------------------------------------------- */
188 if( pszFilename == NULL )
189 {
190 while( psCSVTableList != NULL )
191 CSVDeaccess( psCSVTableList->pszFilename );
192
193 return;
194 }
195
196 /* -------------------------------------------------------------------- */
197 /* Find this table. */
198 /* -------------------------------------------------------------------- */
199 psLast = NULL;
200 for( psTable = psCSVTableList;
201 psTable != NULL && !EQUAL(psTable->pszFilename,pszFilename);
202 psTable = psTable->psNext )
203 {
204 psLast = psTable;
205 }
206
207 if( psTable == NULL )
208 {
209 return;
210 }
211
212 /* -------------------------------------------------------------------- */
213 /* Remove the link from the list. */
214 /* -------------------------------------------------------------------- */
215 if( psLast != NULL )
216 psLast->psNext = psTable->psNext;
217 else
218 psCSVTableList = psTable->psNext;
219
220 /* -------------------------------------------------------------------- */
221 /* Free the table. */
222 /* -------------------------------------------------------------------- */
223 if( psTable->fp != NULL )
224 VSIFClose( psTable->fp );
225
226 CSLDestroy( psTable->papszFieldNames );
227 CSLDestroy( psTable->papszRecFields );
228 CPLFree( psTable->pszFilename );
229 CPLFree( psTable->panLineIndex );
230 CPLFree( psTable->pszRawData );
231 CPLFree( psTable->papszLines );
232
233 CPLFree( psTable );
234
235 CPLReadLine( NULL );
236 }
237
238 /************************************************************************/
239 /* CSVSplitLine() */
240 /* */
241 /* Tokenize a CSV line into fields in the form of a string */
242 /* list. This is used instead of the CPLTokenizeString() */
243 /* because it provides correct CSV escaping and quoting */
244 /* semantics. */
245 /************************************************************************/
246
247 static char **CSVSplitLine( const char *pszString )
248
249 {
250 char **papszRetList = NULL;
251 char *pszToken;
252 int nTokenMax, nTokenLen;
253
254 pszToken = (char *) CPLCalloc(10,1);
255 nTokenMax = 10;
256
257 while( pszString != NULL && *pszString != '\0' )
258 {
259 int bInString = FALSE;
260
261 nTokenLen = 0;
262
263 /* Try to find the next delimeter, marking end of token */
264 for( ; *pszString != '\0'; pszString++ )
265 {
266
267 /* End if this is a delimeter skip it and break. */
268 if( !bInString && *pszString == ',' )
269 {
270 pszString++;
271 break;
272 }
273
274 if( *pszString == '"' )
275 {
276 if( !bInString || pszString[1] != '"' )
277 {
278 bInString = !bInString;
279 continue;
280 }
281 else /* doubled quotes in string resolve to one quote */
282 {
283 pszString++;
284 }
285 }
286
287 if( nTokenLen >= nTokenMax-2 )
288 {
289 nTokenMax = nTokenMax * 2 + 10;
290 pszToken = (char *) CPLRealloc( pszToken, nTokenMax );
291 }
292
293 pszToken[nTokenLen] = *pszString;
294 nTokenLen++;
295 }
296
297 pszToken[nTokenLen] = '\0';
298 papszRetList = CSLAddString( papszRetList, pszToken );
299
300 /* If the last token is an empty token, then we have to catch
301 * it now, otherwise we won't reenter the loop and it will be lost.
302 */
303 if ( *pszString == '\0' && *(pszString-1) == ',' )
304 {
305 papszRetList = CSLAddString( papszRetList, "" );
306 }
307 }
308
309 if( papszRetList == NULL )
310 papszRetList = (char **) CPLCalloc(sizeof(char *),1);
311
312 CPLFree( pszToken );
313
314 return papszRetList;
315 }
316
317 /************************************************************************/
318 /* CSVFindNextLine() */
319 /* */
320 /* Find the start of the next line, while at the same time zero */
321 /* terminating this line. Take into account that there may be */
322 /* newline indicators within quoted strings, and that quotes */
323 /* can be escaped with a backslash. */
324 /************************************************************************/
325
326 static char *CSVFindNextLine( char *pszThisLine )
327
328 {
329 int nQuoteCount = 0, i;
330
331 for( i = 0; pszThisLine[i] != '\0'; i++ )
332 {
333 if( pszThisLine[i] == '\"'
334 && (i == 0 || pszThisLine[i-1] != '\\') )
335 nQuoteCount++;
336
337 if( (pszThisLine[i] == 10 || pszThisLine[i] == 13)
338 && (nQuoteCount % 2) == 0 )
339 break;
340 }
341
342 while( pszThisLine[i] == 10 || pszThisLine[i] == 13 )
343 pszThisLine[i++] = '\0';
344
345 if( pszThisLine[i] == '\0' )
346 return NULL;
347 else
348 return pszThisLine + i;
349 }
350
351 /************************************************************************/
352 /* CSVIngest() */
353 /* */
354 /* Load entire file into memory and setup index if possible. */
355 /************************************************************************/
356
357 static void CSVIngest( const char *pszFilename )
358
359 {
360 CSVTable *psTable = gtCSVAccess( pszFilename );
361 int nFileLen, i, nMaxLineCount, iLine = 0;
362 char *pszThisLine;
363
364 if( psTable->pszRawData != NULL )
365 return;
366
367 /* -------------------------------------------------------------------- */
368 /* Ingest whole file. */
369 /* -------------------------------------------------------------------- */
370 VSIFSeek( psTable->fp, 0, SEEK_END );
371 nFileLen = VSIFTell( psTable->fp );
372 VSIRewind( psTable->fp );
373
374 psTable->pszRawData = (char *) CPLMalloc(nFileLen+1);
375 if( (int) VSIFRead( psTable->pszRawData, 1, nFileLen, psTable->fp )
376 != nFileLen )
377 {
378 CPLFree( psTable->pszRawData );
379 psTable->pszRawData = NULL;
380
381 CPLError( CE_Failure, CPLE_FileIO, "Read of file %s failed.",
382 psTable->pszFilename );
383 return;
384 }
385
386 psTable->pszRawData[nFileLen] = '\0';
387
388 /* -------------------------------------------------------------------- */
389 /* Get count of newlines so we can allocate line array. */
390 /* -------------------------------------------------------------------- */
391 nMaxLineCount = 0;
392 for( i = 0; i < nFileLen; i++ )
393 {
394 if( psTable->pszRawData[i] == 10 )
395 nMaxLineCount++;
396 }
397
398 psTable->papszLines = (char **) CPLCalloc(sizeof(char*),nMaxLineCount);
399
400 /* -------------------------------------------------------------------- */
401 /* Build a list of record pointers into the raw data buffer */
402 /* based on line terminators. Zero terminate the line */
403 /* strings. */
404 /* -------------------------------------------------------------------- */
405 /* skip header line */
406 pszThisLine = CSVFindNextLine( psTable->pszRawData );
407
408 while( pszThisLine != NULL && iLine < nMaxLineCount )
409 {
410 psTable->papszLines[iLine++] = pszThisLine;
411 pszThisLine = CSVFindNextLine( pszThisLine );
412 }
413
414 psTable->nLineCount = iLine;
415
416 /* -------------------------------------------------------------------- */
417 /* Allocate and populate index array. Ensure they are in */
418 /* ascending order so that binary searches can be done on the */
419 /* array. */
420 /* -------------------------------------------------------------------- */
421 psTable->panLineIndex = (int *) CPLMalloc(sizeof(int)*psTable->nLineCount);
422 for( i = 0; i < psTable->nLineCount; i++ )
423 {
424 psTable->panLineIndex[i] = atoi(psTable->papszLines[i]);
425
426 if( i > 0 && psTable->panLineIndex[i] < psTable->panLineIndex[i-1] )
427 {
428 CPLFree( psTable->panLineIndex );
429 psTable->panLineIndex = NULL;
430 break;
431 }
432 }
433
434 psTable->iLastLine = -1;
435
436 /* -------------------------------------------------------------------- */
437 /* We should never need the file handle against, so close it. */
438 /* -------------------------------------------------------------------- */
439 VSIFClose( psTable->fp );
440 psTable->fp = NULL;
441 }
442
443 /************************************************************************/
444 /* CSVReadParseLine() */
445 /* */
446 /* Read one line, and return split into fields. The return */
447 /* result is a stringlist, in the sense of the CSL functions. */
448 /************************************************************************/
449
450 char **CSVReadParseLine( FILE * fp )
451
452 {
453 const char *pszLine;
454 char *pszWorkLine;
455 char **papszReturn;
456
457 CPLAssert( fp != NULL );
458 if( fp == NULL )
459 return( NULL );
460
461 pszLine = CPLReadLine( fp );
462 if( pszLine == NULL )
463 return( NULL );
464
465 /* -------------------------------------------------------------------- */
466 /* If there are no quotes, then this is the simple case. */
467 /* Parse, and return tokens. */
468 /* -------------------------------------------------------------------- */
469 if( strchr(pszLine,'\"') == NULL )
470 return CSVSplitLine( pszLine );
471
472 /* -------------------------------------------------------------------- */
473 /* We must now count the quotes in our working string, and as */
474 /* long as it is odd, keep adding new lines. */
475 /* -------------------------------------------------------------------- */
476 pszWorkLine = CPLStrdup( pszLine );
477
478 while( TRUE )
479 {
480 int i, nCount = 0;
481
482 for( i = 0; pszWorkLine[i] != '\0'; i++ )
483 {
484 if( pszWorkLine[i] == '\"'
485 && (i == 0 || pszWorkLine[i-1] != '\\') )
486 nCount++;
487 }
488
489 if( nCount % 2 == 0 )
490 break;
491
492 pszLine = CPLReadLine( fp );
493 if( pszLine == NULL )
494 break;
495
496 pszWorkLine = (char *)
497 CPLRealloc(pszWorkLine,
498 strlen(pszWorkLine) + strlen(pszLine) + 1);
499 strcat( pszWorkLine, pszLine );
500 }
501
502 papszReturn = CSVSplitLine( pszWorkLine );
503
504 CPLFree( pszWorkLine );
505
506 return papszReturn;
507 }
508
509 /************************************************************************/
510 /* CSVCompare() */
511 /* */
512 /* Compare a field to a search value using a particular */
513 /* criteria. */
514 /************************************************************************/
515
516 static int CSVCompare( const char * pszFieldValue, const char * pszTarget,
517 CSVCompareCriteria eCriteria )
518
519 {
520 if( eCriteria == CC_ExactString )
521 {
522 return( strcmp( pszFieldValue, pszTarget ) == 0 );
523 }
524 else if( eCriteria == CC_ApproxString )
525 {
526 return( EQUAL( pszFieldValue, pszTarget ) );
527 }
528 else if( eCriteria == CC_Integer )
529 {
530 return( atoi(pszFieldValue) == atoi(pszTarget) );
531 }
532
533 return FALSE;
534 }
535
536 /************************************************************************/
537 /* CSVScanLines() */
538 /* */
539 /* Read the file scanline for lines where the key field equals */
540 /* the indicated value with the suggested comparison criteria. */
541 /* Return the first matching line split into fields. */
542 /************************************************************************/
543
544 char **CSVScanLines( FILE *fp, int iKeyField, const char * pszValue,
545 CSVCompareCriteria eCriteria )
546
547 {
548 char **papszFields = NULL;
549 int bSelected = FALSE, nTestValue;
550
551 CPLAssert( pszValue != NULL );
552 CPLAssert( iKeyField >= 0 );
553 CPLAssert( fp != NULL );
554
555 nTestValue = atoi(pszValue);
556
557 while( !bSelected ) {
558 papszFields = CSVReadParseLine( fp );
559 if( papszFields == NULL )
560 return( NULL );
561
562 if( CSLCount( papszFields ) < iKeyField+1 )
563 {
564 /* not selected */
565 }
566 else if( eCriteria == CC_Integer
567 && atoi(papszFields[iKeyField]) == nTestValue )
568 {
569 bSelected = TRUE;
570 }
571 else
572 {
573 bSelected = CSVCompare( papszFields[iKeyField], pszValue,
574 eCriteria );
575 }
576
577 if( !bSelected )
578 {
579 CSLDestroy( papszFields );
580 papszFields = NULL;
581 }
582 }
583
584 return( papszFields );
585 }
586
587 /************************************************************************/
588 /* CSVScanLinesIndexed() */
589 /* */
590 /* Read the file scanline for lines where the key field equals */
591 /* the indicated value with the suggested comparison criteria. */
592 /* Return the first matching line split into fields. */
593 /************************************************************************/
594
595 static char **
596 CSVScanLinesIndexed( CSVTable *psTable, int nKeyValue )
597
598 {
599 int iTop, iBottom, iMiddle, iResult = -1;
600
601 CPLAssert( psTable->panLineIndex != NULL );
602
603 /* -------------------------------------------------------------------- */
604 /* Find target record with binary search. */
605 /* -------------------------------------------------------------------- */
606 iTop = psTable->nLineCount-1;
607 iBottom = 0;
608
609 while( iTop >= iBottom )
610 {
611 iMiddle = (iTop + iBottom) / 2;
612 if( psTable->panLineIndex[iMiddle] > nKeyValue )
613 iTop = iMiddle - 1;
614 else if( psTable->panLineIndex[iMiddle] < nKeyValue )
615 iBottom = iMiddle + 1;
616 else
617 {
618 iResult = iMiddle;
619 break;
620 }
621 }
622
623 if( iResult == -1 )
624 return NULL;
625
626 /* -------------------------------------------------------------------- */
627 /* Parse target line, and update iLastLine indicator. */
628 /* -------------------------------------------------------------------- */
629 psTable->iLastLine = iResult;
630
631 return CSVSplitLine( psTable->papszLines[iResult] );
632 }
633
634 /************************************************************************/
635 /* CSVScanLinesIngested() */
636 /* */
637 /* Read the file scanline for lines where the key field equals */
638 /* the indicated value with the suggested comparison criteria. */
639 /* Return the first matching line split into fields. */
640 /************************************************************************/
641
642 static char **
643 CSVScanLinesIngested( CSVTable *psTable, int iKeyField, const char * pszValue,
644 CSVCompareCriteria eCriteria )
645
646 {
647 char **papszFields = NULL;
648 int bSelected = FALSE, nTestValue;
649
650 CPLAssert( pszValue != NULL );
651 CPLAssert( iKeyField >= 0 );
652
653 nTestValue = atoi(pszValue);
654
655 /* -------------------------------------------------------------------- */
656 /* Short cut for indexed files. */
657 /* -------------------------------------------------------------------- */
658 if( iKeyField == 0 && eCriteria == CC_Integer
659 && psTable->panLineIndex != NULL )
660 return CSVScanLinesIndexed( psTable, nTestValue );
661
662 /* -------------------------------------------------------------------- */
663 /* Scan from in-core lines. */
664 /* -------------------------------------------------------------------- */
665 while( !bSelected && psTable->iLastLine+1 < psTable->nLineCount ) {
666 psTable->iLastLine++;
667 papszFields = CSVSplitLine( psTable->papszLines[psTable->iLastLine] );
668
669 if( CSLCount( papszFields ) < iKeyField+1 )
670 {
671 /* not selected */
672 }
673 else if( eCriteria == CC_Integer
674 && atoi(papszFields[iKeyField]) == nTestValue )
675 {
676 bSelected = TRUE;
677 }
678 else
679 {
680 bSelected = CSVCompare( papszFields[iKeyField], pszValue,
681 eCriteria );
682 }
683
684 if( !bSelected )
685 {
686 CSLDestroy( papszFields );
687 papszFields = NULL;
688 }
689 }
690
691 return( papszFields );
692 }
693
694 /************************************************************************/
695 /* CSVScanFile() */
696 /* */
697 /* Scan a whole file using criteria similar to above, but also */
698 /* taking care of file opening and closing. */
699 /************************************************************************/
700
701 char **CSVScanFile( const char * pszFilename, int iKeyField,
702 const char * pszValue, CSVCompareCriteria eCriteria )
703
704 {
705 CSVTable *psTable;
706
707 /* -------------------------------------------------------------------- */
708 /* Get access to the table. */
709 /* -------------------------------------------------------------------- */
710 CPLAssert( pszFilename != NULL );
711
712 if( iKeyField < 0 )
713 return NULL;
714
715 psTable = gtCSVAccess( pszFilename );
716 if( psTable == NULL )
717 return NULL;
718
719 CSVIngest( pszFilename );
720
721 /* -------------------------------------------------------------------- */
722 /* Does the current record match the criteria? If so, just */
723 /* return it again. */
724 /* -------------------------------------------------------------------- */
725 if( iKeyField >= 0
726 && iKeyField < CSLCount(psTable->papszRecFields)
727 && CSVCompare(pszValue,psTable->papszRecFields[iKeyField],eCriteria) )
728 {
729 return psTable->papszRecFields;
730 }
731
732 /* -------------------------------------------------------------------- */
733 /* Scan the file from the beginning, replacing the ``current */
734 /* record'' in our structure with the one that is found. */
735 /* -------------------------------------------------------------------- */
736 psTable->iLastLine = -1;
737 CSLDestroy( psTable->papszRecFields );
738
739 if( psTable->pszRawData != NULL )
740 psTable->papszRecFields =
741 CSVScanLinesIngested( psTable, iKeyField, pszValue, eCriteria );
742 else
743 {
744 VSIRewind( psTable->fp );
745 CPLReadLine( psTable->fp ); /* throw away the header line */
746
747 psTable->papszRecFields =
748 CSVScanLines( psTable->fp, iKeyField, pszValue, eCriteria );
749 }
750
751 return( psTable->papszRecFields );
752 }
753
754 /************************************************************************/
755 /* CPLGetFieldId() */
756 /* */
757 /* Read the first record of a CSV file (rewinding to be sure), */
758 /* and find the field with the indicated name. Returns -1 if */
759 /* it fails to find the field name. Comparison is case */
760 /* insensitive, but otherwise exact. After this function has */
761 /* been called the file pointer will be positioned just after */
762 /* the first record. */
763 /************************************************************************/
764
765 int CSVGetFieldId( FILE * fp, const char * pszFieldName )
766
767 {
768 char **papszFields;
769 int i;
770
771 CPLAssert( fp != NULL && pszFieldName != NULL );
772
773 VSIRewind( fp );
774
775 papszFields = CSVReadParseLine( fp );
776 for( i = 0; papszFields != NULL && papszFields[i] != NULL; i++ )
777 {
778 if( EQUAL(papszFields[i],pszFieldName) )
779 {
780 CSLDestroy( papszFields );
781 return i;
782 }
783 }
784
785 CSLDestroy( papszFields );
786
787 return -1;
788 }
789
790 /************************************************************************/
791 /* CSVGetFileFieldId() */
792 /* */
793 /* Same as CPLGetFieldId(), except that we get the file based */
794 /* on filename, rather than having an existing handle. */
795 /************************************************************************/
796
797 int CSVGetFileFieldId( const char * pszFilename, const char * pszFieldName )
798
799 {
800 CSVTable *psTable;
801 int i;
802
803 /* -------------------------------------------------------------------- */
804 /* Get access to the table. */
805 /* -------------------------------------------------------------------- */
806 CPLAssert( pszFilename != NULL );
807
808 psTable = gtCSVAccess( pszFilename );
809 if( psTable == NULL )
810 return -1;
811
812 /* -------------------------------------------------------------------- */
813 /* Find the requested field. */
814 /* -------------------------------------------------------------------- */
815 for( i = 0;
816 psTable->papszFieldNames != NULL
817 && psTable->papszFieldNames[i] != NULL;
818 i++ )
819 {
820 if( EQUAL(psTable->papszFieldNames[i],pszFieldName) )
821 {
822 return i;
823 }
824 }
825
826 return -1;
827 }
828
829
830 /************************************************************************/
831 /* CSVScanFileByName() */
832 /* */
833 /* Same as CSVScanFile(), but using a field name instead of a */
834 /* field number. */
835 /************************************************************************/
836
837 char **CSVScanFileByName( const char * pszFilename,
838 const char * pszKeyFieldName,
839 const char * pszValue, CSVCompareCriteria eCriteria )
840
841 {
842 int iKeyField;
843
844 iKeyField = CSVGetFileFieldId( pszFilename, pszKeyFieldName );
845 if( iKeyField == -1 )
846 return NULL;
847
848 return( CSVScanFile( pszFilename, iKeyField, pszValue, eCriteria ) );
849 }
850
851 /************************************************************************/
852 /* CSVGetField() */
853 /* */
854 /* The all-in-one function to fetch a particular field value */
855 /* from a CSV file. Note this function will return an empty */
856 /* string, rather than NULL if it fails to find the desired */
857 /* value for some reason. The caller can't establish that the */
858 /* fetch failed. */
859 /************************************************************************/
860
861 const char *CSVGetField( const char * pszFilename,
862 const char * pszKeyFieldName,
863 const char * pszKeyFieldValue,
864 CSVCompareCriteria eCriteria,
865 const char * pszTargetField )
866
867 {
868 CSVTable *psTable;
869 char **papszRecord;
870 int iTargetField;
871
872 /* -------------------------------------------------------------------- */
873 /* Find the table. */
874 /* -------------------------------------------------------------------- */
875 psTable = gtCSVAccess( pszFilename );
876 if( psTable == NULL )
877 return "";
878
879 /* -------------------------------------------------------------------- */
880 /* Find the correct record. */
881 /* -------------------------------------------------------------------- */
882 papszRecord = CSVScanFileByName( pszFilename, pszKeyFieldName,
883 pszKeyFieldValue, eCriteria );
884
885 if( papszRecord == NULL )
886 return "";
887
888 /* -------------------------------------------------------------------- */
889 /* Figure out which field we want out of this. */
890 /* -------------------------------------------------------------------- */
891 iTargetField = CSVGetFileFieldId( pszFilename, pszTargetField );
892 if( iTargetField < 0 )
893 return "";
894
895 if( iTargetField >= CSLCount( papszRecord ) )
896 return "";
897
898 return( papszRecord[iTargetField] );
899 }
900
901 /************************************************************************/
902 /* CSVFilename() */
903 /* */
904 /* Return the full path to a particular CSV file. This will */
905 /* eventually be something the application can override. */
906 /************************************************************************/
907
908 static const char *(*pfnCSVFilenameHook)(const char *) = NULL;
909
910 const char * CSVFilename( const char *pszBasename )
911
912 {
913 static char szPath[512];
914
915 if( pfnCSVFilenameHook == NULL )
916 {
917 FILE *fp = NULL;
918
919 if( getenv("GEOTIFF_CSV") != NULL )
920 {
921 sprintf( szPath, "%s/%s", getenv("GEOTIFF_CSV"), pszBasename );
922 }
923 #ifdef CSV_DATA_DIR
924 else
925 {
926 sprintf( szPath, "%s/%s", CSV_DATA_DIR, pszBasename );
927 }
928 #else
929 else if( (fp = fopen( "/usr/local/share/epsg/csv/pcs.csv", "rt" )) != NULL )
930 {
931 sprintf( szPath, "/usr/local/share/epsg/csv/%s", pszBasename );
932 }
933 else if( (fp = fopen( "csv/pcs.csv", "rt" )) != NULL )
934 {
935 sprintf( szPath, "csv/%s", pszBasename );
936 }
937 else if( (fp = fopen( "share/epsg_csv/pcs.csv", "rt" )) != NULL )
938 {
939 sprintf( szPath, "share/epsg_csv/%s", pszBasename );
940 }
941 else if( (fp = fopen( "/usr/share/epsg_csv/pcs.csv", "rt" )) != NULL )
942 {
943 sprintf( szPath, "/usr/share/epsg_csv/%s", pszBasename );
944 }
945 else
946 {
947 sprintf( szPath, "/usr/local/share/epsg_csv/%s", pszBasename );
948 }
949 #endif
950
951 if( fp != NULL )
952 fclose( fp );
953
954 return( szPath );
955 }
956 else
957 return( pfnCSVFilenameHook( pszBasename ) );
958 }
959
960 /************************************************************************/
961 /* SetCSVFilenameHook() */
962 /* */
963 /* Applications can use this to set a function that will */
964 /* massage CSV filenames. */
965 /************************************************************************/
966
967 /**
968 * Override CSV file search method.
969 *
970 * @param CSVFileOverride The pointer to a function which will return the
971 * full path for a given filename.
972 *
973
974 This function allows an application to override how the GTIFGetDefn() and related function find the CSV (Comma Separated
975 Value) values required. The pfnHook argument should be a pointer to a function that will take in a CSV filename and return a
976 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.
977
978 <b>Example:</b><br>
979
980 The listgeo utility uses the following override function if the user
981 specified a CSV file directory with the -t commandline switch (argument
982 put into CSVDirName). <p>
983
984 <pre>
985
986 ...
987
988
989 SetCSVFilenameHook( CSVFileOverride );
990
991 ...
992
993
994 static const char *CSVFileOverride( const char * pszInput )
995
996 {
997 static char szPath[1024];
998
999 #ifdef WIN32
1000 sprintf( szPath, "%s\\%s", CSVDirName, pszInput );
1001 #else
1002 sprintf( szPath, "%s/%s", CSVDirName, pszInput );
1003 #endif
1004
1005 return( szPath );
1006 }
1007 </pre>
1008
1009 */
1010
1011 void SetCSVFilenameHook( const char *(*pfnNewHook)( const char * ) )
1012
1013 {
1014 pfnCSVFilenameHook = pfnNewHook;
1015 }
0 /**********************************************************************
1 * $Id: cpl_csv_incode.c,v 1.8 2007/07/20 18:08:29 fwarmerdam Exp $
2 *
3 * Name: cpl_struct.c
4 * Project: libgeotiff
5 * Purpose: Provide "CSV API" interface to in-code EPSG CSV tables.
6 * Author: Derrick J Brashear <shadow@dementia.org>
7 *
8 ******************************************************************************
9 * Copyright (c) 1999, Frank Warmerdam
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 ******************************************************************************
29 *
30 * $Log: cpl_csv_incode.c,v $
31 * Revision 1.8 2007/07/20 18:08:29 fwarmerdam
32 * Handle unexpected .csv files, and missing records more gracefully.
33 *
34 * Revision 1.7 2004/03/23 18:21:56 warmerda
35 * Added CSVReadParseLine() stub
36 *
37 * Revision 1.6 2003/01/20 21:42:52 warmerda
38 * Ensure CSVGetField() does not crash if record not found.
39 *
40 * Revision 1.5 2003/01/20 07:11:04 warmerda
41 * updated csv-incode support to 6.2.2
42 *
43 * Revision 1.4 2002/06/19 03:51:15 warmerda
44 * migrated cpl_csv.h into cpl_serv.h
45 *
46 * Revision 1.3 2002/02/11 14:22:22 warmerda
47 * Added stub CSVDeaccess().
48 *
49 * Revision 1.2 2001/06/28 17:53:20 warmerda
50 * Use EQUAL instead of strcasecmp() to ensure code builds on windows.
51 * As per http://bugzilla.remotesensing.org/show_bug.cgi?id=59
52 *
53 * Revision 1.1 1999/12/10 18:00:58 warmerda
54 * New
55 *
56 */
57
58 #include "cpl_serv.h"
59
60 #include "defs.h"
61
62 extern const datafile_rows_t *pcs_rows[];
63 extern const datafile_rows_t *gcs_rows[];
64 extern const datafile_rows_t *ellipsoid_rows[];
65 extern const datafile_rows_t *prime_meridian_rows[];
66 extern const datafile_rows_t *datum_rows[];
67 extern const datafile_rows_t *unit_of_measure_rows[];
68 extern const datafile_rows_t *projop_wparm_rows[];
69
70
71 /* Pointers to data */
72 static const datafile_t files[] = {
73 { "pcs", pcs_rows },
74 { "gcs", gcs_rows },
75 { "ellipsoid", ellipsoid_rows },
76 { "prime_meridian", prime_meridian_rows },
77 { "datum", datum_rows },
78 { "unit_of_measure", unit_of_measure_rows },
79 { "projop_wparm", projop_wparm_rows },
80 { NULL, NULL }
81 };
82
83 #if 0
84 main()
85 {
86 datafile_t *csvfile;
87 char **papszRecord;
88 int i, row, col;
89
90 papszRecord = CSVScanFileByName( "horiz_cs.csv", "HORIZCS_CODE",
91 "2200", CC_Integer );
92
93 printf ("%s %s\n", papszRecord[0], papszRecord[1]);
94 csvfile = &files[0];
95 while (csvfile->name != NULL) {
96 printf("file name is %s\n", csvfile->name);
97 for (i = 0; csvfile->cols[i]; i++) {
98 printf("column name is %s\n", csvfile->cols[i]);
99 row = 1; col = 0;
100 if (csvfile->rows[row] && csvfile->rows[row][col])
101 printf("value %d,%d is %s\n", row, col, csvfile->rows[row][col]);
102 }
103 csvfile++;
104 }
105 }
106 #endif
107
108 const char * CSVFilename( const char *pszBasename )
109 {
110 return pszBasename;
111 }
112
113 static int CSVCompare( const char * pszFieldValue, const char * pszTarget,
114 CSVCompareCriteria eCriteria )
115 {
116 if( eCriteria == CC_ExactString )
117 {
118 return( !EQUAL( pszFieldValue, pszTarget ) == 0 );
119 }
120 else if( eCriteria == CC_ApproxString )
121 {
122 return( !EQUAL( pszFieldValue, pszTarget ) );
123 }
124 else if( eCriteria == CC_Integer )
125 {
126 return( atoi(pszFieldValue) == atoi(pszTarget) );
127 }
128 return FALSE;
129 }
130
131 void CSVDeaccess( const char *pszFilename )
132 {
133 }
134
135 static int __CSVGetFileId( const char * pszFilename)
136 {
137 datafile_t *csvfile;
138 int i = 0;
139
140 csvfile = (datafile_t *)&files[i];
141 for (i = 0; csvfile->name; i++, csvfile = (datafile_t *)&files[i])
142 {
143 if (!strncmp(csvfile->name,pszFilename,(strlen(pszFilename)-4)))
144 return i;
145 }
146
147 return -1;
148 }
149
150 char **CSVScanFileByName( const char * pszFilename,
151 const char * pszKeyFieldName,
152 const char * pszValue,
153 CSVCompareCriteria eCriteria )
154 {
155 datafile_t *csvfile;
156 int row, col, iFile;
157
158 iFile = __CSVGetFileId(pszFilename);
159 if( iFile == -1 )
160 return NULL;
161
162 col = CSVGetFileFieldId(pszFilename, pszKeyFieldName);
163
164 csvfile = (datafile_t *)&files[iFile];
165 for (row = 1; ((csvfile->rows[row] != 0) && (csvfile->rows[row][col] != 0));
166 row++) {
167 if (CSVCompare(csvfile->rows[row][col], pszValue, eCriteria))
168 return ((char **)csvfile->rows[row]);
169 }
170
171 return NULL;
172 }
173
174 int CSVGetFileFieldId( const char * pszFilename, const char * pszFieldName)
175 {
176 datafile_t *csvfile;
177 int i, iFile;
178
179 iFile = __CSVGetFileId(pszFilename);
180 if( iFile == -1 )
181 return -1;
182
183 csvfile = (datafile_t *)&files[iFile];
184 if (!strncmp(csvfile->name,pszFilename,(strlen(pszFilename)-4)))
185 {
186 for (i = 0; csvfile->rows[0][i]; i++)
187 if (EQUAL(pszFieldName, csvfile->rows[0][i]))
188 return i;
189 }
190
191 return -1;
192 }
193
194 const char *CSVGetField( const char * pszFilename,
195 const char * pszKeyFieldName,
196 const char * pszKeyFieldValue,
197 CSVCompareCriteria eCriteria,
198 const char * pszTargetField )
199 {
200 char **papszRecord;
201 int iField;
202
203 papszRecord = CSVScanFileByName( pszFilename, pszKeyFieldName,
204 pszKeyFieldValue, CC_Integer );
205
206 if( papszRecord == NULL )
207 return "";
208
209 iField = CSVGetFileFieldId(pszFilename, pszTargetField);
210
211 if( iField == -1 )
212 return "";
213 else
214 return (papszRecord[iField]);
215 }
216
217 /* Dummy function */
218 void SetCSVFilenameHook( const char *(*pfnNewHook)( const char * ) )
219
220 {
221 }
222
223 /* dummy function */
224
225 char **CSVReadParseLine( FILE * fp )
226
227 {
228 return NULL;
229 }
0 /******************************************************************************
1 * Copyright (c) 1998, Frank Warmerdam
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included
11 * in all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19 * DEALINGS IN THE SOFTWARE.
20 ******************************************************************************
21 *
22 * cpl_serv.c: Various Common Portability Library derived convenience functions
23 *
24 * $Log: cpl_serv.c,v $
25 * Revision 1.8 2001/07/09 20:14:37 warmerda
26 * Another problem freeing pszRLBuffer and not setting to NULL.
27 *
28 * Revision 1.7 2001/04/17 13:40:43 warmerda
29 * fixed freeing of line buffer in CPLReadLine(), init ptr to NULL
30 *
31 * Revision 1.6 2001/03/05 04:56:17 warmerda
32 * make it possible to deallocate CPLReadLine buffer
33 *
34 * Revision 1.5 2000/09/30 03:35:05 warmerda
35 * Fixed CPLReadLine() to use avoid calling VSIRealloc() on a NULL pointer.
36 *
37 * Revision 1.4 1999/06/25 04:35:26 warmerda
38 * Fixed to actually support long lines.
39 *
40 * Revision 1.3 1999/03/17 20:43:03 geotiff
41 * Avoid use of size_t keyword
42 *
43 * Revision 1.2 1999/03/10 18:22:39 geotiff
44 * Added string.h, fixed backslash escaping
45 *
46 * Revision 1.1 1999/03/09 15:57:04 geotiff
47 * New
48 *
49 */
50
51 #include "cpl_serv.h"
52 #include "geo_tiffp.h"
53
54 #ifdef HAVE_STRING_H
55 # include <string.h>
56 #endif
57 #if defined(HAVE_STRINGS_H) && !defined(HAVE_STRING_H)
58 # include <strings.h>
59 #endif
60
61 /************************************************************************/
62 /* CPLCalloc() */
63 /************************************************************************/
64
65 void *CPLCalloc( int nCount, int nSize )
66
67 {
68 void *pReturn;
69
70 if( nSize == 0 )
71 return NULL;
72
73 pReturn = VSICalloc( nCount, nSize );
74 if( pReturn == NULL )
75 {
76 CPLError( CE_Fatal, CPLE_OutOfMemory,
77 "CPLCalloc(): Out of memory allocating %d bytes.\n",
78 nSize * nCount );
79 }
80
81 return pReturn;
82 }
83
84 /************************************************************************/
85 /* CPLMalloc() */
86 /************************************************************************/
87
88 void *CPLMalloc( int nSize )
89
90 {
91 void *pReturn;
92
93 if( nSize == 0 )
94 return NULL;
95
96 pReturn = VSIMalloc( nSize );
97 if( pReturn == NULL )
98 {
99 CPLError( CE_Fatal, CPLE_OutOfMemory,
100 "CPLMalloc(): Out of memory allocating %d bytes.\n",
101 nSize );
102 }
103
104 return pReturn;
105 }
106
107 /************************************************************************/
108 /* CPLRealloc() */
109 /************************************************************************/
110
111 void * CPLRealloc( void * pData, int nNewSize )
112
113 {
114 void *pReturn;
115
116 if( pData == NULL )
117 pReturn = VSIMalloc( nNewSize );
118 else
119 pReturn = VSIRealloc( pData, nNewSize );
120
121 if( pReturn == NULL )
122 {
123 CPLError( CE_Fatal, CPLE_OutOfMemory,
124 "CPLRealloc(): Out of memory allocating %d bytes.\n",
125 nNewSize );
126 }
127
128 return pReturn;
129 }
130
131 /************************************************************************/
132 /* CPLStrdup() */
133 /************************************************************************/
134
135 char *CPLStrdup( const char * pszString )
136
137 {
138 char *pszReturn;
139
140 if( pszString == NULL )
141 pszString = "";
142
143 pszReturn = VSIMalloc( strlen(pszString)+1 );
144
145 if( pszReturn == NULL )
146 {
147 CPLError( CE_Fatal, CPLE_OutOfMemory,
148 "CPLStrdup(): Out of memory allocating %d bytes.\n",
149 strlen(pszString) );
150
151 }
152
153 strcpy( pszReturn, pszString );
154
155 return( pszReturn );
156 }
157
158 /************************************************************************/
159 /* CPLReadLine() */
160 /* */
161 /* Read a line of text from the given file handle, taking care */
162 /* to capture CR and/or LF and strip off ... equivelent of */
163 /* DKReadLine(). Pointer to an internal buffer is returned. */
164 /* The application shouldn't free it, or depend on it's value */
165 /* past the next call to CPLReadLine() */
166 /************************************************************************/
167
168 const char *CPLReadLine( FILE * fp )
169
170 {
171 static char *pszRLBuffer = NULL;
172 static int nRLBufferSize = 0;
173 int nLength, nReadSoFar = 0;
174
175 /* -------------------------------------------------------------------- */
176 /* Cleanup case. */
177 /* -------------------------------------------------------------------- */
178 if( fp == NULL )
179 {
180 CPLFree( pszRLBuffer );
181 pszRLBuffer = NULL;
182 nRLBufferSize = 0;
183 return NULL;
184 }
185
186 /* -------------------------------------------------------------------- */
187 /* Loop reading chunks of the line till we get to the end of */
188 /* the line. */
189 /* -------------------------------------------------------------------- */
190 do {
191 /* -------------------------------------------------------------------- */
192 /* Grow the working buffer if we have it nearly full. Fail out */
193 /* of read line if we can't reallocate it big enough (for */
194 /* instance for a _very large_ file with no newlines). */
195 /* -------------------------------------------------------------------- */
196 if( nRLBufferSize-nReadSoFar < 128 )
197 {
198 nRLBufferSize = nRLBufferSize*2 + 128;
199 if( pszRLBuffer == NULL )
200 pszRLBuffer = (char *) VSIMalloc(nRLBufferSize);
201 else
202 pszRLBuffer = (char *) VSIRealloc(pszRLBuffer, nRLBufferSize);
203 if( pszRLBuffer == NULL )
204 {
205 nRLBufferSize = 0;
206 return NULL;
207 }
208 }
209
210 /* -------------------------------------------------------------------- */
211 /* Do the actual read. */
212 /* -------------------------------------------------------------------- */
213 if( VSIFGets( pszRLBuffer+nReadSoFar, nRLBufferSize-nReadSoFar, fp )
214 == NULL )
215 {
216 CPLFree( pszRLBuffer );
217 pszRLBuffer = NULL;
218 nRLBufferSize = 0;
219
220 return NULL;
221 }
222
223 nReadSoFar = strlen(pszRLBuffer);
224
225 } while( nReadSoFar == nRLBufferSize - 1
226 && pszRLBuffer[nRLBufferSize-2] != 13
227 && pszRLBuffer[nRLBufferSize-2] != 10 );
228
229 /* -------------------------------------------------------------------- */
230 /* Clear CR and LF off the end. */
231 /* -------------------------------------------------------------------- */
232 nLength = strlen(pszRLBuffer);
233 if( nLength > 0
234 && (pszRLBuffer[nLength-1] == 10 || pszRLBuffer[nLength-1] == 13) )
235 {
236 pszRLBuffer[--nLength] = '\0';
237 }
238
239 if( nLength > 0
240 && (pszRLBuffer[nLength-1] == 10 || pszRLBuffer[nLength-1] == 13) )
241 {
242 pszRLBuffer[--nLength] = '\0';
243 }
244
245 return( pszRLBuffer );
246 }
247
248
249 /*=====================================================================
250 StringList manipulation functions.
251 =====================================================================*/
252
253 /**********************************************************************
254 * CSLAddString()
255 *
256 * Append a string to a StringList and return a pointer to the modified
257 * StringList.
258 * If the input StringList is NULL, then a new StringList is created.
259 **********************************************************************/
260 char **CSLAddString(char **papszStrList, const char *pszNewString)
261 {
262 int nItems=0;
263
264 if (pszNewString == NULL)
265 return papszStrList; /* Nothing to do!*/
266
267 /* Allocate room for the new string */
268 if (papszStrList == NULL)
269 papszStrList = (char**) CPLCalloc(2,sizeof(char*));
270 else
271 {
272 nItems = CSLCount(papszStrList);
273 papszStrList = (char**)CPLRealloc(papszStrList,
274 (nItems+2)*sizeof(char*));
275 }
276
277 /* Copy the string in the list */
278 papszStrList[nItems] = CPLStrdup(pszNewString);
279 papszStrList[nItems+1] = NULL;
280
281 return papszStrList;
282 }
283
284 /**********************************************************************
285 * CSLCount()
286 *
287 * Return the number of lines in a Stringlist.
288 **********************************************************************/
289 int CSLCount(char **papszStrList)
290 {
291 int nItems=0;
292
293 if (papszStrList)
294 {
295 while(*papszStrList != NULL)
296 {
297 nItems++;
298 papszStrList++;
299 }
300 }
301
302 return nItems;
303 }
304
305
306 /************************************************************************/
307 /* CSLGetField() */
308 /* */
309 /* Fetches the indicated field, being careful not to crash if */
310 /* the field doesn't exist within this string list. The */
311 /* returned pointer should not be freed, and doesn't */
312 /* necessarily last long. */
313 /************************************************************************/
314
315 const char * CSLGetField( char ** papszStrList, int iField )
316
317 {
318 int i;
319
320 if( papszStrList == NULL || iField < 0 )
321 return( "" );
322
323 for( i = 0; i < iField+1; i++ )
324 {
325 if( papszStrList[i] == NULL )
326 return "";
327 }
328
329 return( papszStrList[iField] );
330 }
331
332 /**********************************************************************
333 * CSLDestroy()
334 *
335 * Free all memory used by a StringList.
336 **********************************************************************/
337 void CSLDestroy(char **papszStrList)
338 {
339 char **papszPtr;
340
341 if (papszStrList)
342 {
343 papszPtr = papszStrList;
344 while(*papszPtr != NULL)
345 {
346 CPLFree(*papszPtr);
347 papszPtr++;
348 }
349
350 CPLFree(papszStrList);
351 }
352 }
353
354
355 /**********************************************************************
356 * CSLDuplicate()
357 *
358 * Allocate and return a copy of a StringList.
359 **********************************************************************/
360 char **CSLDuplicate(char **papszStrList)
361 {
362 char **papszNewList, **papszSrc, **papszDst;
363 int nLines;
364
365 nLines = CSLCount(papszStrList);
366
367 if (nLines == 0)
368 return NULL;
369
370 papszNewList = (char **)CPLMalloc((nLines+1)*sizeof(char*));
371 papszSrc = papszStrList;
372 papszDst = papszNewList;
373
374 while(*papszSrc != NULL)
375 {
376 *papszDst = CPLStrdup(*papszSrc);
377
378 papszSrc++;
379 papszDst++;
380 }
381 *papszDst = NULL;
382
383 return papszNewList;
384 }
385
386 /**********************************************************************
387 * CSLTokenizeString()
388 *
389 * Tokenizes a string and returns a StringList with one string for
390 * each token.
391 **********************************************************************/
392 char **CSLTokenizeString( const char *pszString )
393 {
394 return CSLTokenizeStringComplex( pszString, " ", TRUE, FALSE );
395 }
396
397 /************************************************************************/
398 /* CSLTokenizeStringComplex() */
399 /* */
400 /* The ultimate tokenizer? */
401 /************************************************************************/
402
403 char ** CSLTokenizeStringComplex( const char * pszString,
404 const char * pszDelimiters,
405 int bHonourStrings, int bAllowEmptyTokens )
406
407 {
408 char **papszRetList = NULL;
409 char *pszToken;
410 int nTokenMax, nTokenLen;
411
412 pszToken = (char *) CPLCalloc(10,1);
413 nTokenMax = 10;
414
415 while( pszString != NULL && *pszString != '\0' )
416 {
417 int bInString = FALSE;
418
419 nTokenLen = 0;
420
421 /* Try to find the next delimeter, marking end of token */
422 for( ; *pszString != '\0'; pszString++ )
423 {
424
425 /* End if this is a delimeter skip it and break. */
426 if( !bInString && strchr(pszDelimiters, *pszString) != NULL )
427 {
428 pszString++;
429 break;
430 }
431
432 /* If this is a quote, and we are honouring constant
433 strings, then process the constant strings, with out delim
434 but don't copy over the quotes */
435 if( bHonourStrings && *pszString == '"' )
436 {
437 if( bInString )
438 {
439 bInString = FALSE;
440 continue;
441 }
442 else
443 {
444 bInString = TRUE;
445 continue;
446 }
447 }
448
449 /* Within string constants we allow for escaped quotes, but
450 in processing them we will unescape the quotes */
451 if( bInString && pszString[0] == '\\' && pszString[1] == '"' )
452 {
453 pszString++;
454 }
455
456 /* Within string constants a \\ sequence reduces to \ */
457 else if( bInString
458 && pszString[0] == '\\' && pszString[1] == '\\' )
459 {
460 pszString++;
461 }
462
463 if( nTokenLen >= nTokenMax-1 )
464 {
465 nTokenMax = nTokenMax * 2 + 10;
466 pszToken = (char *) CPLRealloc( pszToken, nTokenMax );
467 }
468
469 pszToken[nTokenLen] = *pszString;
470 nTokenLen++;
471 }
472
473 pszToken[nTokenLen] = '\0';
474
475 if( pszToken[0] != '\0' || bAllowEmptyTokens )
476 {
477 papszRetList = CSLAddString( papszRetList, pszToken );
478 }
479 }
480
481 if( papszRetList == NULL )
482 papszRetList = (char **) CPLCalloc(sizeof(char *),1);
483
484 CPLFree( pszToken );
485
486 return papszRetList;
487 }
488
489 /* static buffer to store the last error message. We'll assume that error
490 * messages cannot be longer than 2000 chars... which is quite reasonable
491 * (that's 25 lines of 80 chars!!!)
492 */
493 static char gszCPLLastErrMsg[2000] = "";
494 static int gnCPLLastErrNo = 0;
495
496 static void (*gpfnCPLErrorHandler)(CPLErr, int, const char *) = NULL;
497
498 /**********************************************************************
499 * CPLError()
500 *
501 * This function records an error code and displays the error message
502 * to stderr.
503 *
504 * The error code can be accessed later using CPLGetLastErrNo()
505 **********************************************************************/
506 void CPLError(CPLErr eErrClass, int err_no, const char *fmt, ...)
507 {
508 va_list args;
509
510 /* Expand the error message
511 */
512 va_start(args, fmt);
513 vsprintf(gszCPLLastErrMsg, fmt, args);
514 va_end(args);
515
516 /* If the user provided his own error handling function, then call
517 * it, otherwise print the error to stderr and return.
518 */
519 gnCPLLastErrNo = err_no;
520
521 if (gpfnCPLErrorHandler != NULL)
522 {
523 gpfnCPLErrorHandler(eErrClass, err_no, gszCPLLastErrMsg);
524 }
525 else
526 {
527 fprintf(stderr, "ERROR %d: %s\n", gnCPLLastErrNo, gszCPLLastErrMsg);
528 }
529
530 if( eErrClass == CE_Fatal )
531 abort();
532 }
533
534 /**********************************************************************
535 * CPLErrorReset()
536 *
537 * Erase any traces of previous errors.
538 **********************************************************************/
539 void CPLErrorReset()
540 {
541 gnCPLLastErrNo = 0;
542 gszCPLLastErrMsg[0] = '\0';
543 }
544
545
546 /**********************************************************************
547 * CPLGetLastErrorNo()
548 *
549 **********************************************************************/
550 int CPLGetLastErrorNo()
551 {
552 return gnCPLLastErrNo;
553 }
554
555 /**********************************************************************
556 * CPLGetLastErrorMsg()
557 *
558 **********************************************************************/
559 const char* CPLGetLastErrorMsg()
560 {
561 return gszCPLLastErrMsg;
562 }
563
564 /**********************************************************************
565 * CPLSetErrorHandler()
566 *
567 * Allow the library's user to specify his own error handler function.
568 *
569 * A valid error handler is a C function with the following prototype:
570 *
571 * void MyErrorHandler(int errno, const char *msg)
572 *
573 * Pass NULL to come back to the default behavior.
574 **********************************************************************/
575
576 void CPLSetErrorHandler(void (*pfnErrorHandler)(CPLErr, int, const char *))
577 {
578 gpfnCPLErrorHandler = pfnErrorHandler;
579 }
580
581 /************************************************************************/
582 /* _CPLAssert() */
583 /* */
584 /* This function is called only when an assertion fails. */
585 /************************************************************************/
586
587 void _CPLAssert( const char * pszExpression, const char * pszFile,
588 int iLine )
589
590 {
591 CPLError( CE_Fatal, CPLE_AssertionFailed,
592 "Assertion `%s' failed\n"
593 "in file `%s', line %d\n",
594 pszExpression, pszFile, iLine );
595 }
0 /******************************************************************************
1 * Copyright (c) 1998, Frank Warmerdam
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining a
4 * copy of this software and associated documentation files (the "Software"),
5 * to deal in the Software without restriction, including without limitation
6 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 * and/or sell copies of the Software, and to permit persons to whom the
8 * Software is furnished to do so, subject to the following conditions:
9 *
10 * The above copyright notice and this permission notice shall be included
11 * in all copies or substantial portions of the Software.
12 *
13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
14 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
16 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19 * DEALINGS IN THE SOFTWARE.
20 ******************************************************************************
21 *
22 * cpl_serv.h
23 *
24 * This include file derived and simplified from the GDAL Common Portability
25 * Library.
26 */
27
28 #ifndef CPL_SERV_H_INCLUDED
29 #define CPL_SERV_H_INCLUDED
30
31 /* ==================================================================== */
32 /* Standard include files. */
33 /* ==================================================================== */
34
35 #include "geo_config.h"
36 #include <stdio.h>
37
38 #include <math.h>
39
40 #ifdef HAVE_STRING_H
41 # include <string.h>
42 #endif
43 #if defined(HAVE_STRINGS_H) && !defined(HAVE_STRING_H)
44 # include <strings.h>
45 #endif
46 #ifdef HAVE_STDLIB_H
47 # include <stdlib.h>
48 #endif
49
50 /**********************************************************************
51 * Do we want to build as a DLL on windows?
52 **********************************************************************/
53 #if !defined(CPL_DLL)
54 # if defined(_WIN32) && defined(BUILD_AS_DLL)
55 # define CPL_DLL __declspec(dllexport)
56 # else
57 # define CPL_DLL
58 # endif
59 #endif
60
61 /* ==================================================================== */
62 /* Other standard services. */
63 /* ==================================================================== */
64 #ifdef __cplusplus
65 # define CPL_C_START extern "C" {
66 # define CPL_C_END }
67 #else
68 # define CPL_C_START
69 # define CPL_C_END
70 #endif
71
72 #ifndef NULL
73 # define NULL 0
74 #endif
75
76 #ifndef FALSE
77 # define FALSE 0
78 #endif
79
80 #ifndef TRUE
81 # define TRUE 1
82 #endif
83
84 #ifndef MAX
85 # define MIN(a,b) ((a<b) ? a : b)
86 # define MAX(a,b) ((a>b) ? a : b)
87 #endif
88
89 #ifndef NULL
90 #define NULL 0
91 #endif
92
93 #ifndef ABS
94 # define ABS(x) ((x<0) ? (-1*(x)) : x)
95 #endif
96
97 #ifndef EQUAL
98 #if defined(_WIN32) && !defined(__CYGWIN__)
99 # define EQUALN(a,b,n) (strnicmp(a,b,n)==0)
100 # define EQUAL(a,b) (stricmp(a,b)==0)
101 #else
102 # define EQUALN(a,b,n) (strncasecmp(a,b,n)==0)
103 # define EQUAL(a,b) (strcasecmp(a,b)==0)
104 #endif
105 #endif
106
107 /* ==================================================================== */
108 /* VSI Services (just map directly onto Standard C services. */
109 /* ==================================================================== */
110
111 #define VSIFOpen fopen
112 #define VSIFClose fclose
113 #define VSIFEof feof
114 #define VSIFPrintf fprintf
115 #define VSIFPuts fputs
116 #define VSIFPutc fputc
117 #define VSIFGets fgets
118 #define VSIRewind rewind
119 #define VSIFSeek fseek
120 #define VSIFTell ftell
121 #define VSIFRead fread
122
123 #ifndef notdef
124 #define VSICalloc(x,y) _GTIFcalloc(x*y)
125 #define VSIMalloc _GTIFcalloc
126 #define VSIFree _GTIFFree
127 #define VSIRealloc _GTIFrealloc
128 #else
129 #define VSICalloc(x,y) (((char *) _GTIFcalloc(x*y+4)) + 4)
130 #define VSIMalloc(x) (((char *) _GTIFcalloc((x)+4)) + 4)
131 #define VSIFree(x) _GTIFFree(((char *) (x)) - 4)
132 #define VSIRealloc(p,n) (((char *) _GTIFrealloc(((char *)p)-4,(n)+4)) + 4)
133 #endif
134
135 /* -------------------------------------------------------------------- */
136 /* Safe malloc() API. Thin cover over VSI functions with fatal */
137 /* error reporting if memory allocation fails. */
138 /* -------------------------------------------------------------------- */
139 CPL_C_START
140
141 #define CPLMalloc gtCPLMalloc
142 #define CPLCalloc gtCPLCalloc
143 #define CPLRealloc gtCPLRealloc
144 #define CPLStrdup gtCPLStrdup
145
146 void CPL_DLL *CPLMalloc( int );
147 void CPL_DLL *CPLCalloc( int, int );
148 void CPL_DLL *CPLRealloc( void *, int );
149 char CPL_DLL *CPLStrdup( const char * );
150
151 #define CPLFree(x) { if( x != NULL ) VSIFree(x); }
152
153 /* -------------------------------------------------------------------- */
154 /* Read a line from a text file, and strip of CR/LF. */
155 /* -------------------------------------------------------------------- */
156
157 #define CPLReadLine gtCPLReadLine
158
159 const char CPL_DLL *CPLReadLine( FILE * );
160
161 /*=====================================================================
162 Error handling functions (cpl_error.c)
163 =====================================================================*/
164
165 typedef enum
166 {
167 CE_None = 0,
168 CE_Log = 1,
169 CE_Warning = 2,
170 CE_Failure = 3,
171 CE_Fatal = 4
172 } CPLErr;
173
174 #define CPLError gtCPLError
175 #define CPLErrorReset gtCPLErrorReset
176 #define CPLGetLastErrorNo gtCPLGetLastErrorNo
177 #define CPLGetLastErrorMsg gtCPLGetLastErrorMsg
178 #define CPLSetErrorHandler gtCPLSetErrorHandler
179 #define _CPLAssert gt_CPLAssert
180
181 void CPL_DLL CPLError(CPLErr eErrClass, int err_no, const char *fmt, ...);
182 void CPL_DLL CPLErrorReset();
183 int CPL_DLL CPLGetLastErrorNo();
184 const char CPL_DLL * CPLGetLastErrorMsg();
185 void CPL_DLL CPLSetErrorHandler(void(*pfnErrorHandler)(CPLErr,int,
186 const char *));
187 void CPL_DLL _CPLAssert( const char *, const char *, int );
188
189 #ifdef DEBUG
190 # define CPLAssert(expr) ((expr) ? (void)(0) : _CPLAssert(#expr,__FILE__,__LINE__))
191 #else
192 # define CPLAssert(expr)
193 #endif
194
195 CPL_C_END
196
197 /* ==================================================================== */
198 /* Well known error codes. */
199 /* ==================================================================== */
200
201 #define CPLE_AppDefined 1
202 #define CPLE_OutOfMemory 2
203 #define CPLE_FileIO 3
204 #define CPLE_OpenFailed 4
205 #define CPLE_IllegalArg 5
206 #define CPLE_NotSupported 6
207 #define CPLE_AssertionFailed 7
208 #define CPLE_NoWriteAccess 8
209
210 /*=====================================================================
211 Stringlist functions (strlist.c)
212 =====================================================================*/
213 CPL_C_START
214
215 #define CSLAddString gtCSLAddString
216 #define CSLCount gtCSLCount
217 #define CSLGetField gtCSLGetField
218 #define CSLDestroy gtCSLDestroy
219 #define CSLDuplicate gtCSLDuplicate
220 #define CSLTokenizeString gtCSLTokenizeString
221 #define CSLTokenizeStringComplex gtCSLTokenizeStringComplex
222
223 char CPL_DLL **CSLAddString(char **papszStrList, const char *pszNewString);
224 int CPL_DLL CSLCount(char **papszStrList);
225 const char CPL_DLL *CSLGetField( char **, int );
226 void CPL_DLL CSLDestroy(char **papszStrList);
227 char CPL_DLL **CSLDuplicate(char **papszStrList);
228
229 char CPL_DLL **CSLTokenizeString(const char *pszString );
230 char CPL_DLL **CSLTokenizeStringComplex(const char *pszString,
231 const char *pszDelimiter,
232 int bHonourStrings, int bAllowEmptyTokens );
233
234 /* ==================================================================== */
235 /* .csv file related functions (from cpl_csv.c) */
236 /* ==================================================================== */
237
238 typedef enum {
239 CC_ExactString,
240 CC_ApproxString,
241 CC_Integer
242 } CSVCompareCriteria;
243
244 #define CSVFilename gtCSVFilename
245 #define CSVReadParseLine gtCSVReadParseLine
246 #define CSVScanLines gtCSVScanLines
247 #define CSVScanFile gtCSVScanFile
248 #define CSVScanFileByName gtCSVScanFileByName
249 #define CSVGetFieldId gtCSVGetFieldId
250 #define CSVDeaccess gtCSVDeaccess
251 #define CSVGetField gtCSVGetField
252 #define SetCSVFilenameHook gtSetCSVFilenameHook
253 #define CSVGetFileFieldId gtCSVGetFileFieldId
254
255 const char CPL_DLL *CSVFilename( const char * );
256
257 char CPL_DLL **CSVReadParseLine( FILE * );
258 char CPL_DLL **CSVScanLines( FILE *, int, const char *, CSVCompareCriteria );
259 char CPL_DLL **CSVScanFile( const char *, int, const char *,
260 CSVCompareCriteria );
261 char CPL_DLL **CSVScanFileByName( const char *, const char *, const char *,
262 CSVCompareCriteria );
263 int CPL_DLL CSVGetFieldId( FILE *, const char * );
264 int CPL_DLL CSVGetFileFieldId( const char *, const char * );
265
266 void CPL_DLL CSVDeaccess( const char * );
267
268 const char CPL_DLL *CSVGetField( const char *, const char *, const char *,
269 CSVCompareCriteria, const char * );
270
271 void CPL_DLL SetCSVFilenameHook( const char *(*)(const char *) );
272
273 CPL_C_END
274
275 #endif /* ndef CPL_SERV_H_INCLUDED */
0
1 /*
2 * This file is included by the CSV ".c" files in the csv directory.
3 */
4
5 #include <stdio.h>
6
7 /* Data structures */
8 typedef const char * datafile_rows_t;
9 typedef struct datafile_s {
10 const char *name;
11 const datafile_rows_t **rows;
12 } datafile_t;
0 <html>
1 <head>
2 <title>geotifcp - Copy TIFF, Installing GeoTIFF Metadata</title>
3 </head>
4
5 <body BGCOLOR="#FFFFFF">
6
7 <h1>geotifcp - Copy TIFF with updated GeoTIFF Metadata</h1>
8
9 <pre>
10 Syntax: geotifcp [options] [-e esri_worldfile] [-g metadata] input output
11 </pre>
12
13 The program geotifcp is identical in function to the LIBTIFF program
14 "tiffcp", with the additional feature that if the "-g <metadata>"
15 option is used the GeoTIFF information from the file <metadata>
16 will be installed into the output file. The "-e worldfile" option will
17 override the tiepoint and scale information from the metadata file based
18 on the contents of the ESRI worldfile. <p>
19
20 If the "-g" option is not used the geotiff information from the source
21 file is preserved in the new output file.<p>
22
23 "geotifcp" inherits all the other file-transformation capabilities
24 of the tiffcp program; for help on the additional parameters give
25 the command:<p>
26 <pre>
27 % geotifcp -h
28 </pre>
29
30 The metadata format is the same as is described in the <a href="listgeo.html">
31 listgeo</a> program. Normally metadata files for use with geotifcp are
32 generated from a similar file with listgeo, and then modified by hand
33 as required. <p>
34
35 <h2>See Also:</h2>
36
37 <ol>
38 <li>
39 <a href="listgeo.html">listgeo</a> - Dump GeoTIFF Metadata<p>
40
41 <li>
42 <a href="http://www.remotesensing.org/geotiff/geotiff.html">
43 http://www.remotesensing.org/geotiff/geotiff.html</a> - GeoTIFF/libgeotiff Home Page<p>
44
45 </ol>
46 </body>
47 </html>
0 /*! \page index
1
2 <center><title>
3 LIBGEOTIFF
4 </title></center>
5
6 <h2>Functions</h2>
7
8 <ul>
9 <li> GTIFFree(): Free GeoTIFF access handle.
10 <li> GTIFGetDefn(): Read and Normalize GeoTIFF Definition.
11 <li> GTIFKeyGet(): Read GeoTIFF GeoKey.
12 <li> GTIFKeySet(): Write GeoTIFF GeoKey.
13 <li> GTIFNew(): Create GeoTIFF access handle.
14 <li> GTIFWriteKeys(): Flush GeoTIFF Keys.
15 <li> SetCSVFilenameHook(): Override CSV File Searching.
16 <li> XTIFFClose(): Close GeoTIFF file.
17 <li> XTIFFOpen(): Open GeoTIFF file.
18 </ul>
19
20 <h2>General Notes</h2>
21
22 The libgeotiff library should compile cleanly with most ANSI-C or
23 ANSI C++ compilers. All headers have appropriate <b>extern "C" {}</b>
24 protection to ensure that entry points retain C linkage even if compiled
25 with a C++ compiler. <p>
26
27 <h2>Source Tree</h2>
28
29 The <a href="http://www.remotesensing.org/cgi-bin/cvsweb.cgi/osrs/geotiff">
30 current CVS tree</a> is available on the web. The source can be
31 downloaded anonymously using the <tt>cvs checkout osrs/geotiff/libgeotiff</tt>
32 command after logging in using the instructions on the remotesensing.org
33 <a href="/docs/howto-cvs.php3">CVS howto page</a>.<p>
34
35 <h2>Include Files</h2>
36
37 <ul>
38 <li> xtiffio.h: the primary interface header file for all TIFF
39 routines, using the extended GeoTIFF tags.<p>
40
41 <li> geotiffio.h: the primary interface header file for all GTIF
42 routines, keys and code values.<p>
43
44 <li> geotiff.h: an interface header file for all GTIF
45 routines, if code values are not required.<p>
46
47 <li> geokeys.h: defines all valid GEOTIFF GeoKeys.<p>
48
49 <li> geo_normalize.h: Defined all functions and structures related
50 to normalization of GeoTIFF information based on CSV files.<p>
51
52 </ul>
53
54 <h2>Licensing</h2>
55
56 All the source code in this toolkit are either in the public domain, or under
57 an X style license. In any event it is all considered to be free to use
58 for any purpose (including commercial software). No credit is required
59 though some of the code requires that the specific source code modules
60 retain their existing copyright statements. The CSV files, and other tables
61 derived from the EPSG coordinate system database are also free for commercial
62 and non-commercial use. In particular, no part of this code is
63 <i>copyleft</i>, nor does it imply any requirement for users to disclose
64 this or their own source code.<p>
65
66 */
0 <html>
1 <head>
2 <title>listgeo - Dump GeoTIFF Metadata</title>
3 </head>
4
5 <body BGCOLOR="#FFFFFF">
6
7 <h1>listgeo - Dump GeoTIFF Metadata</h1>
8
9 <pre><b>
10 Usage: listgeo [-tfw] [-no_norm] [-proj4] [-t tabledir] inputfile
11 </b></pre>
12
13 The program listgeo takes a GeoTIFF file as input and dumps to
14 the standard output a GeoTIFF "metadata" file, which is human
15 readable, and may also be used as input to other programs which
16 use the "GTIFImport" routine, such as <a href="geotiff.html">geotifcp</a>.<p>
17
18 The <b>-tfw</b> flag may be passed to force generation of an ESRI style .tfw
19 file as well as the metadata file. The ESRI world file is always given
20 the same basename as the input file, with the extension .tfw. If one
21 exists already it will be overwritten.<p>
22
23 The <b>-no_norm</b> flag will supress reporting of normalized parameters, and
24 reporting of corner points. <p>
25
26 The <b>-proj4</b> flag forces listgeo to report the PROJ.4 projection
27 string it uses for reprojecting corners to lat/long.<p>
28
29 The <b>-t tabledir</b> flag overrides the programs concept of how to file the
30 EPSG CSV files, causing it to look in directory "tabledir". <p>
31
32 <h2>GeoTIFF Metadata Format</h2>
33
34 For the formalist junkies, we will define a GeoTIFF metadata format
35 in an unambiguous fashion, and follow that by a concrete example.<p>
36
37 The metadata format is defined as follows (all strings not placed
38 between <braces> are string literals, case-sensitive, and any entry
39 followed by "*" or "*<number>" indicates multiple entries):<p>
40
41 <pre>
42 &lt;Geotiff_Metadata&gt; = &lt;Geotiff_Header&gt; + &lt;GeoTIFF_Body&gt; + &lt;GeoTIFF_Trailer&gt;
43
44 &lt;Geotiff_Header&gt; = &lt;White_Space&gt; + Geotiff_Information: + &lt;Return&gt;
45 &lt;GeoTIFF_Trailer&gt; = &lt;White_Space&gt; + End_Of_Geotiff. + &lt;Return&gt;
46 &lt;GeoTIFF_Body&gt; = &lt;GeoTIFF_Info&gt; + &lt;GeoTIFF_Tags&gt; + &lt;GeoTIFF_Keys&gt;
47 &lt;GeoTIFF_Info&gt; = &lt;GeoTIFF_Version&gt; + &lt;GeoTIFF_Revision&gt;
48 &lt;GeoTIFF_Version&gt; = Version: + &lt;Single_Space&gt; + &lt;Version&gt; + &lt;Return&gt;
49 &lt;Version&gt; = &lt;Integer&gt;
50 &lt;GeoTIFF_Revision&gt; = Revision: +
51 &lt;Single_Space&gt; + &lt;Major_Rev&gt; + &lt;Period&gt; + &lt;Minor_Rev&gt; + &lt;Return&gt;
52 &lt;Major_Rev&gt; = &lt;Integer&gt;
53 &lt;Minor_Rev&gt; = &lt;Integer&gt;
54 &lt;GeoTIFF_Tags&gt; = &lt;Tag_Header&gt; + &lt;Tag_Entry&gt;* + &lt;Tag_Trailer&gt;
55 &lt;Tag_Header&gt; = &lt;White_Space&gt; + Tagged_Information: + &lt;Return&gt;
56 &lt;Tag_Trailer&gt; = &lt;White_Space&gt; + End_Of_Tags. + &lt;Return&gt;
57 &lt;Tag_Entry&gt; = &lt;Tag_Entry_Header&gt; + &lt;Tag_Entry_Row&gt;*
58 &lt;Tag_Entry_Header&gt; = &lt;White_Space&gt; +
59 &lt;Tag_Name&gt; + &lt;Tag_Dimension&gt; + &lt;Colon&gt; + &lt;Return&gt;
60 &lt;Tag_Dimension&gt; = "(" + &lt;NRows&gt; + &lt;Comma&gt; + &lt;NCols&gt; + ")"
61 &lt;NRows&gt; = &lt;Integer&gt;
62 &lt;NCols&gt; = &lt;Integer&gt;
63 &lt;Tag_Entry_Row&gt; = &lt;White_Space&gt; + &lt;Double_Float&gt;*&lt;NCols&gt; + &lt;Return&gt;
64 &lt;GeoTIFF_Keys&gt; = &lt;Key_Header&gt; + &lt;Key_Entry&gt;* + &lt;Key_Trailer&gt;
65 &lt;Key_Header&gt; = &lt;White_Space&gt; + Keyed_Information: + &lt;Return&gt;
66 &lt;Key_Trailer&gt; = &lt;White_Space&gt; + End_Of_Keys. + &lt;Return&gt;
67 &lt;Key_Entry&gt; = &lt;Key_Entry_Header&gt; + &lt;Key_Entry_Value&gt;
68 &lt;Key_Entry_Header&gt; = &lt;White_Space&gt; +
69 &lt;Key_Name&gt; + &lt;Key_Dimension&gt; + &lt;Colon&gt; + &lt;Return&gt;
70 &lt;Key_Dimension&gt; = "(" + &lt;Key_Format&gt; + &lt;Comma&gt; + &lt;Key_Count&gt; + ")"
71 &lt;Key_Entry_Value&gt; = (&lt;Key_Value&gt; | &lt;Numeric_Value&gt; | &lt;Ascii_Value&gt;)
72 &lt;Numeric_Value&gt; = (&lt;Integer&gt; | &lt;Double_Float&gt;)
73 &lt;Ascii_Value&gt; = &lt;Double_Quote&gt; + &lt;String&gt; + &lt;Double_Quote&gt;
74
75 &lt;Tag_Name&gt; = All symbolic tag names defined in GeoTIFF spec.
76 &lt;Key_Name&gt; = All symbolic key names defined in GeoTIFF spec.
77 &lt;Key_Value&gt; = All symbolic value names defined in GeoTIFF spec.
78 &lt;Key_Format&gt; = (Short | Ascii | Double)
79 </pre>
80
81 And for the pedantic:
82 <pre>
83 &lt;White_Space&gt; = (&lt;Single_Space&gt; | &lt;Tab&gt;)*
84 &lt;Double_Float&gt; = &lt;Mantissa&gt;&lt;Exponent&gt;
85 &lt;Mantissa&gt; = &lt;Sign&gt;&lt;Integer&gt;&lt;Period&gt;&lt;Integer&gt;
86 &lt;Exponent&gt; = ( |e&lt;Sign&gt;&lt;Integer&gt;)
87 &lt;Sign&gt; = ( |+|-)
88 &lt;Integer&gt; = (0|1|2|3|4|5|6|7|8|9)*
89 ...
90 </pre>
91
92 Following the formal metadata report, there is an optional (use -no_norm
93 to supress) report on the <i>normalized</i> projection parameters for the
94 file. This is an attempt to lookup PCS and GCS definitions to get detailed
95 datum, ellipsoid, and projection definitions for the file. In general it
96 requires access to the EPSG CSV files to work properly. The GEOTIFF_CSV
97 environment variable can be used to point to directory containing the EPSG
98 CSV files (normally distributed with libgeotiff, or this executable). If
99 GEOTIFF_CSV is not defined listgeo will look for a csv subdirectory, or
100 the /usr/local/shared/epsg_csv directory. The -t commandline switch can
101 also be used to indicate where the CSV files are located.<p>
102
103 Following the normalized projection information listgeo will report the
104 positions of the four corner coordinates, and if possible their lat/long
105 equivelents. The corner coordinates are reported for tiepoint+scale and
106 transformation matrix formulations of GeoTIFF files, but not for multiple
107 tiepoint formulations. The lat/long coordinates are only available if
108 listgeo is compiled with PROJ.4, if the projection definition can be
109 normalized, and if it is a projection supported by the listgeo PROJ.4
110 binding.<p>
111
112 Example (default output of listgeo):<p>
113
114 <pre>
115 Geotiff_Information:
116 Version: 1
117 Key_Revision: 1.0
118 Tagged_Information:
119 ModelTiepointTag (2,3):
120 0 0 0
121 440720 3751320 0
122 ModelPixelScaleTag (1,3):
123 60 60 0
124 End_Of_Tags.
125 Keyed_Information:
126 GTModelTypeGeoKey (Short,1): ModelTypeProjected
127 GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
128 GTCitationGeoKey (Ascii,17): "UTM 11 S E000"
129 GeogLinearUnitsGeoKey (Short,1): Linear_Meter
130 GeogAngularUnitsGeoKey (Short,1): Angular_Degree
131 ProjectedCSTypeGeoKey (Short,1): PCS_NAD27_UTM_zone_11N
132 End_Of_Keys.
133 End_Of_Geotiff.
134
135 PCS = 26711 (NAD27 / UTM zone 11N)
136 Projection = 16011 (UTM zone 11N)
137 Projection Method: CT_TransverseMercator
138 ProjNatOriginLatGeoKey: 0.000000 ( 0d 0' 0.00"N)
139 ProjNatOriginLongGeoKey: -117.000000 (117d 0' 0.00"W)
140 ProjScaleAtNatOriginGeoKey: 0.999600
141 ProjFalseEastingGeoKey: 500000.000000
142 ProjFalseNorthingGeoKey: 0.000000
143 GCS: 4267/NAD27
144 Datum: 6267/North American Datum 1927
145 Ellipsoid: 7008/Clarke 1866 (6378206.40,6356583.80)
146 Prime Meridian: 8901/Greenwich (0.000000/ 0d 0' 0.00"E)
147 Projection Linear Units: 9001/metre (1.000000m)
148
149 Corner Coordinates:
150 Upper Left ( 440720.000,3751320.000) (117d38'28.21"W, 33d54' 8.47"N)
151 Lower Left ( 440720.000,3720600.000) (117d38'20.79"W, 33d37'31.04"N)
152 Upper Right ( 471440.000,3751320.000) (117d18'32.07"W, 33d54'13.08"N)
153 Lower Right ( 471440.000,3720600.000) (117d18'28.50"W, 33d37'35.61"N)
154 Center ( 456080.000,3735960.000) (117d28'27.39"W, 33d45'52.46"N)
155 </pre>
156
157 <h2>See Also:</h2>
158
159 <ol>
160 <li>
161 <a href="geotifcp.html">geotiffcp</a> - Copy TIFF installing GeoTIFF
162 metadata.<p>
163 <li>
164 <a href="http://www.remotesensing.org/geotiff/geotiff.html">
165 http://www.remotesensing.org/geotiff/geotiff.html</a> - GeoTIFF/libgeotiff Home Page<p>
166
167 </ol>
168 </body>
169 </html>
0 -------------------------------------------------------------
1
2 Manual for Libgeotiff Library and Utilities
3
4 -------------------------------------------------------------
5
6 Documentation Author: Niles Ritter
7 Last Modified: 31 Jul 95
8
9 See: http://www.remotesensing.org/geotiff/api/index.html
10 for up to date API documentation
11
12 -------------------------------------------------------------
13 Contents:
14
15 1. The LibGeoTIFF library
16
17 1.1 Preliminaries
18 1.2 Calling Sequences
19 1.3 Examples
20
21 2. The LibGeoTIFF Utilities
22
23 2.1 listgeo - dump a GeoTIFF metadata file
24 2.2 geotifcp - install GeoTIFF from metadata
25
26 -------------------------------------------------------------
27 1. The LibGeoTIFF library
28
29 -------------------------------------------------------------
30 1.1 Preliminaries
31
32 -------------------
33 1.1.1 Compliance:
34
35 ANSI-C: The GeoTIFF library is fully ANSI compliant and
36 should compile under any ANSI compiler. It is not guaranteed
37 to compile under K&R compilers.
38
39 C++: All headers have the appropriate C++ bindings permitting
40 the correct linkage to C++ routines.
41
42 -------------------
43 1.1.2 Interfaces:
44
45 xtiffio.h: the primary interface header file for all TIFF
46 routines, using the extended GeoTIFF tags.
47
48 geotiffio.h: the primary interface header file for all GTIF
49 routines, keys and code values.
50
51 geotiff.h: an interface header file for all GTIF
52 routines, if code values are not required.
53
54 geokeys.h: defines all valid GEOTIFF GeoKeys.
55
56 -------------------
57 1.1.3 Defined macros:
58
59 All of the tag, key and key-value symbolic names in the GeoTIFF spec are
60 supported and defined by the inclusion of "geotiffio.h". In addition,
61 the following useful values are defined:
62
63 GvCurrentVersion: The current GeoTIFF Directory version. Should always be 1.
64 GvCurrentRevision: The current GeoTIFF Key Revision.
65 GvCurrentMinorRev: The current GeoTIFF Key-Value (minor) Revision.
66
67 KvUndefined: The universal Key value for "undefined" items.
68 KvUserDefined: The universal Key value for "user-defined" items.
69
70
71 -------------------
72 1.1.4 Defined Types:
73
74 TIFF the type of a TIFF file descriptor (if LIBTIFF is used).
75 GTIF the type of a GeoTIFF file descriptor.
76 GTIFPrintMethod the type of a print method passed to GTIFPrint().
77 GTIFReadMethod the type of a read method passed to GTIFImport().
78 geokey_t the type of a GeoTIFF key variable.
79 tagtype_t the type of a TIFF tag variable, such as TYPE_DOUBLE.
80
81
82 -------------------
83 1.1.5 Key and Code Databases:
84
85 All geokeys are defined and named in the database file
86 "geokeys.inc", which in turn is included in "geokeys.h"
87 and several other files. The symbolic enumerated names are identical
88 to those used in the Appendix of the GeoTIFF spec.
89
90 The geokey code values are stored in the other database files
91 having the ".inc" suffix, which in turn are all referenced by
92 the file "geovalues.h". The ones with names beginning with
93 "epsg_" are codes registered in the EPSG/POSC tables, while
94 those beginning with "geo_" are specific to GeoTIFF.
95
96
97 -------------------------------------------------------------
98 1.2 Calling Sequences
99
100 -------------------
101 1.2.1 TIFF-level interface
102
103
104 1.2.1.1 GTIFNew -- Set up a new GeoTIFF file Descriptor
105 GTIF* GTIFNew(void *tif);
106
107 GTIFNew() takes an existing TIFF file descriptor and creates
108 a GTIF GeoTIFF file-I/O object for reading and writing
109 GeoTIFF keys and values. The TIFF file must currently be open,
110 though it may be either read or write mode.
111
112
113 1.2.1.2 GTIFFree
114 void GTIFFree(GTIF *gtif);
115
116 Destroys the GeoTIFF file descriptor following reading or writing
117 the keys.
118
119
120 1.2.1.3 GTIFWriteKeys
121 int GTIFWriteKeys(GTIF *gtif);
122
123 This routine must be called for a new GeoTIFF file after all of
124 the desired Keys are defined and set with GTIFSetKey(). This does
125 not explicitly write anything out to the file, but it does call
126 the TIFF-level routines to install the TIFF tag values, which
127 in turn are written to the file when the TIFF file descriptor
128 is closed. A GeoTIFF file cannot be opened for updating; only
129 pure read or write is supported.
130
131
132 1.2.1.4 GTIFDirectoryInfo
133 void GTIFDirectoryInfo(GTIF *gtif, int *versions, int *keycount);
134
135 Returns header information about the GeoTIFF file directory. The <versions>
136 is an array of 3 integers, giving the GeoTIFF Version, followed by
137 the major and minor revisions. The <keycount> argument returns the number
138 of keys currently defined in this file.
139
140 -------------------
141 1.2.2 GeoKey Access
142
143
144 1.2.2.1 GTIFKeyInfo
145 int GTIFKeyInfo(GTIF *gtif, geokey_t key, int *size, tagtype_t* type);
146
147 Returns the number of values defined for key <key> if currently defined in the file, and
148 returns in <size> the size of individual key values, and the <type>. If the
149 key is not defined, 0 is returned. You may pass in NULL pointers to any parameters
150 you do not need (such as the type).
151
152
153 1.2.2.1 GTIFKeyGet
154 int GTIFKeyGet(GTIF *gtif, geokey_t key, void *val, int index, int count);
155
156 Accesses the key value(s). If there are multiple values (such as ASCII), they
157 may be accessed individually, starting at <index> and returning <count> values.
158 The total number of values accessed is returned. Note: unline TIFFGetField()
159 memory is not allocated for multiple-value arrays such as ASCII. To get the
160 length of an array call GTIFKeyInfo first, which returns the size and count
161 of the data. If the values are key-codes they should be declared of type
162 "geocode_t", which is unsigned SHORT.
163
164
165 1.2.2.1 GTIFKeySet
166 int GTIFKeySet(GTIF *gtif, geokey_t keyID, tagtype_t type, int count,...);
167
168 Defines and sets the specified key values. Note that this does not install the
169 tag-level information in the file; to do that you must call GTIFWriteKeys().
170 For single-valued non-ASCII keys (which are most of them), you must pass the
171 values in by value not reference. You must use the correct type for the
172 values: doubles for floating point, strings for ASCII, and "geocode_t" for
173 SHORT codes (the symbolic names may be used in most cases).
174
175
176 1.2.3 Metadata Import-Export utilities
177
178 void GTIFPrint(GTIF *gtif, GTIFPrintMethod print, void *fd);
179 int GTIFImport(GTIF *gtif, GTIFReadMethod scan, void *fd);
180
181 char* GTIFKeyName(geokey_t key);
182 char* GTIFValueName(geokey_t key,int value);
183 char* GTIFTypeName(tagtype_t type);
184 char* GTIFTagName(int tag);
185 int GTIFKeyCode(char * key);
186 int GTIFValueCode(geokey_t key,char *value);
187 int GTIFTypeCode(char *type);
188 int GTIFTagCode(char *tag);
189
190 The GTIFPrint() routine dumps a GeoTIFF metadata stream out to
191 a specified file <fd>, either for human interpretation or for
192 input to another program. If <fd> is NULL the data is written
193 to the standard output.
194
195 The GTIFImport() routine performs the inverse; given a metadata file
196 specified by <fd> (or stdin if <fd> is NULL) install the corresponding
197 tags and keys into the current GeoTIFF file. Note that the
198 import routine only calls GTIFKeySet(), and so it is up to the
199 client program to call GTIFWriteKey() in order to explicitly
200 write the keys out to the file.
201
202 The GTIFxxxName() routines all take a numeric code, key or tag and
203 return a pointer to a static string name associated with the value.
204 In the case of Key-Values, the key must be explicitly defined in
205 order to establish the scope of the name-search. A string is always
206 returned; however, if the code is not recognized the string is
207 of the format "Unknown-%d", where %d is the input code value.
208
209 The GTIFxxxCode() routines perform the reverse operation; given
210 an ASCII string name it tries to find the corresponding code,
211 key or tag numerical value, in a case-sensitive manner. If the
212 string is not recognized the value -1 is return (no valid codes
213 are negative). For consistency, any strings of the form "Unknown-%d"
214 where %d is a decimal integer will return the specified integer.
215
216 Note: be careful when assigning variables to GTIFxxxCode; for example,
217 the geokey_t type is unsigned, and so if -1 is returned, this will
218 result in a value of 65535. To be safe, always use signed integers
219 for the assignment, and pass them on to an unsigned type after
220 checking that the value is positive.
221
222
223 -------------------------------------------------------------
224 1.3 Examples
225
226
227 A typical use of LIBGEOTIFF for creating a GeoTIFF file is
228
229 #include "xtiffio.h" /* for TIFF */
230 #include "geotiffio.h" /* for GeoTIFF */
231 void main()
232 {
233 TIFF *tif=(TIFF*)0; /* TIFF-level descriptor */
234 GTIF *gtif=(GTIF*)0; /* GeoKey-level descriptor */
235
236 /* Open TIFF descriptor to write GeoTIFF tags */
237 tif=XTIFFOpen(fname,"w");
238 if (!tif) goto failure;
239
240 /* Open GTIF Key parser */
241 gtif = GTIFNew(tif);
242 if (!gtif) goto failure;
243
244 /* Set up standar TIFF file */
245 TIFFSetField(tif,TIFFTAG_IMAGEWIDTH, WIDTH);
246 /* set other TIFF tags and write out image ... */
247
248 /* Set GeoTIFF information */
249 GTIFKeySet(gtif, GTModelTypeGeoKey, TYPE_SHORT, 1, ModelGeographic);
250 /* set other GeoTIFF keys ... */
251
252 /* Store the keys into the TIFF Tags */
253 GTIFWriteKeys(gtif);
254
255 /* get rid of the key parser */
256 GTIFFree(gtif);
257
258 /* save and close the TIFF file descriptor */
259 XTIFFClose(tif);
260
261 exit (0);
262 failure:
263 exit (-1);
264 }
265
266 While a typical use of the code for reading tags is:
267
268 #include "xtiffio.h" /* for TIFF */
269 #include "geotiffio.h" /* for GeoTIFF */
270 enum {VERSION=0,MAJOR,MINOR};
271 void main()
272 {
273 TIFF *tif=(TIFF*)0; /* TIFF-level descriptor */
274 GTIF *gtif=(GTIF*)0; /* GeoKey-level descriptor */
275 int versions[3];
276 int cit_length;
277 geocode_t model; /* all key-codes are of this type */
278 char *citation;
279
280 /* Open TIFF descriptor to read GeoTIFF tags */
281 tif=XTIFFOpen(fname,"r");
282 if (!tif) goto failure;
283
284 /* Open GTIF Key parser; keys will be read at this time. */
285 gtif = GTIFNew(tif);
286 if (!gtif) goto failure;
287
288 /* Get the GeoTIFF directory info */
289 GTIFDirectoryInfo(gtif,versions,0);
290 if (versions[MAJOR] > 1)
291 {
292 printf("this file is too new for me\n"); goto failure;
293 }
294 if (!GTIFKeyGet(gtif, GTModelTypeGeoKey, &model, 0, 1))
295 {
296 printf("Yikes! no Model Type\n") goto failure;
297 }
298
299 /* ASCII keys are variable-length; compute size */
300 cit_length = GTIFKeyInfo(gtif,GTCitationGeoKey,&size,&type);
301 if (cit_length > 0)
302 {
303 citation = malloc(size*cit_length);
304 if (!citation) goto failure;
305 GTIFKeyGet(gtif, GTCitationGeoKey, citation, 0, cit_length);
306 printf("Citation:%s\n",citation);
307 }
308
309 /* Get some TIFF info on this image */
310 TIFFGetField(tif,TIFFTAG_IMAGEWIDTH, &width);
311
312 /* get rid of the key parser */
313 GTIFFree(gtif);
314
315 /* close the TIFF file descriptor */
316 XTIFFClose(tif);
317
318 exit (0);
319 failure:
320 exit (-1);
321 }
322
323
324
325 -------------------------------------------------------------
326 2. The LibGeoTIFF Utilities
327
328 -------------------------------------------------------------
329 2.1 listgeo - dump a GeoTIFF metadata file
330
331 Syntax: listgeo [-tfw] [-no_norm] [-t tabledir] inputfile
332
333 The program listgeo takes a GeoTIFF file as input and dumps to
334 the standard output a GeoTIFF "metadata" file, which is human
335 readable, and may also be used as input to other programs which
336 use the "GTIFImport" routine, such as geotifcp, below.
337
338 The -tfw flag may be passed to force generation of an ESRI style .tfw
339 file as well as the metadata file.
340
341 The -no_norm flag will supress reporting of normalized parameters, and
342 reporting of corner points.
343
344 The "-t tabledir" flag overrides the programs concept of how to file the
345 EPSG CSV files, causing it to look in directory "tabledir".
346
347 ------------------------
348 GeoTIFF Metadata Format:
349
350 For the formalist junkies, we will define a GeoTIFF metadata format
351 in an unambiguous fashion, and follow that by a concrete example.
352
353 The metadata format is defined as follows (all strings not placed
354 between <braces> are string literals, case-sensitive, and any entry
355 followed by "*" or "*<number>" indicates multiple entries):
356
357 <Geotiff_Metadata> = <Geotiff_Header> + <GeoTIFF_Body> + <GeoTIFF_Trailer>
358
359 <Geotiff_Header> = <White_Space> + Geotiff_Information: + <Return>
360 <GeoTIFF_Trailer> = <White_Space> + End_Of_Geotiff. + <Return>
361 <GeoTIFF_Body> = <GeoTIFF_Info> + <GeoTIFF_Tags> + <GeoTIFF_Keys>
362 <GeoTIFF_Info> = <GeoTIFF_Version> + <GeoTIFF_Revision>
363 <GeoTIFF_Version> = Version: + <Single_Space> + <Version> + <Return>
364 <Version> = <Integer>
365 <GeoTIFF_Revision> = Revision: +
366 <Single_Space> + <Major_Rev> + <Period> + <Minor_Rev> + <Return>
367 <Major_Rev> = <Integer>
368 <Minor_Rev> = <Integer>
369 <GeoTIFF_Tags> = <Tag_Header> + <Tag_Entry>* + <Tag_Trailer>
370 <Tag_Header> = <White_Space> + Tagged_Information: + <Return>
371 <Tag_Trailer> = <White_Space> + End_Of_Tags. + <Return>
372 <Tag_Entry> = <Tag_Entry_Header> + <Tag_Entry_Row>*
373 <Tag_Entry_Header> = <White_Space> +
374 <Tag_Name> + <Tag_Dimension> + <Colon> + <Return>
375 <Tag_Dimension> = "(" + <NRows> + <Comma> + <NCols> + ")"
376 <NRows> = <Integer>
377 <NCols> = <Integer>
378 <Tag_Entry_Row> = <White_Space> + <Double_Float>*<NCols> + <Return>
379 <GeoTIFF_Keys> = <Key_Header> + <Key_Entry>* + <Key_Trailer>
380 <Key_Header> = <White_Space> + Keyed_Information: + <Return>
381 <Key_Trailer> = <White_Space> + End_Of_Keys. + <Return>
382 <Key_Entry> = <Key_Entry_Header> + <Key_Entry_Value>
383 <Key_Entry_Header> = <White_Space> +
384 <Key_Name> + <Key_Dimension> + <Colon> + <Return>
385 <Key_Dimension> = "(" + <Key_Format> + <Comma> + <Key_Count> + ")"
386 <Key_Entry_Value> = (<Key_Value> | <Numeric_Value> | <Ascii_Value>)
387 <Numeric_Value> = (<Integer> | <Double_Float>)
388 <Ascii_Value> = <Double_Quote> + <String> + <Double_Quote>
389
390 <Tag_Name> = All symbolic tag names defined in GeoTIFF spec.
391 <Key_Name> = All symbolic key names defined in GeoTIFF spec.
392 <Key_Value> = All symbolic value names defined in GeoTIFF spec.
393 <Key_Format> = (Short | Ascii | Double)
394
395 And for the pedantic:
396 <White_Space> = (<Single_Space> | <Tab>)*
397 <Double_Float> = <Mantissa><Exponent>
398 <Mantissa> = <Sign><Integer><Period><Integer>
399 <Exponent> = ( |e<Sign><Integer>)
400 <Sign> = ( |+|-)
401 <Integer> = (0|1|2|3|4|5|6|7|8|9)*
402 ...
403
404
405 Example (default output of listgeo):
406
407 Geotiff_Information:
408 Version: 1
409 Key_Revision: 0.2
410 Tagged_Information:
411 ModelTiepointTag (2,3):
412 0 0 0
413 130 32 0
414 ModelPixelScaleTag (1,3):
415 1 1 0
416 End_Of_Tags.
417 Keyed_Information:
418 GTModelTypeGeoKey (Short,1): ModelTypeGeographic
419 GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
420 GTCitationGeoKey (Ascii,16): "Just An Example"
421 GeographicTypeGeoKey (Short,1): User-Defined
422 GeogCitationGeoKey (Ascii,24): "Everest Ellipsoid Used."
423 GeogGeodeticDatumGeoKey (Short,1): User-Defined
424 GeogLinearUnitsGeoKey (Short,1): Linear_Meter
425 GeogAngularUnitsGeoKey (Short,1): Angular_Degree
426 GeogEllipsoidGeoKey (Short,1): Ellipse_Everest_1830_1967_Definition
427 GeogSemiMajorAxisGeoKey (Double,1): 6377298.556
428 GeogInvFlatteningGeoKey (Double,1): 300.8017
429 End_Of_Keys.
430 End_Of_Geotiff.
431
432
433 -------------------------------------------------------------
434 2.2 geotifcp - Copy a TIFF file and install GeoTIFF info from metadata.
435
436 Syntax: geotifcp [options] [-e esri_worldfile] [-g metadata] input output
437
438 The program geotifcp is identical in function to the LIBTIFF program
439 "tiffcp", with the additional feature that if the "-g <metadata>"
440 option is used the GeoTIFF information from the file <metadata>
441 will be installed into the output file. The "-e worldfile" option will
442 override the tiepoint and scale information from the metadata file based
443 on the contents of the ESRI worldfile.
444
445 If the "-g" option is not used, the opposite effect occurs: all
446 GeoTIFF information is filtered out of the input file before being
447 written to the new output file.
448
449 "geotifcp" inherits all the other file-transformation capabilities
450 of the tiffcp program; for help on the additional parameters give
451 the command:
452
453 % geotifcp -h
454
455 -------------------------------------------------------------
0 /*
1 * EPSG/POSC Datum database -- GeoTIFF Rev. 0.2
2 */
3
4 /* C database for Geotiff include files. */
5 /* the macro ValuePair() must be defined */
6 /* by the enclosing include file */
7
8 #ifdef INCLUDE_OLD_CODES
9 #include old_datum.inc
10 #endif /* OLD Codes */
11
12 /* New datums */
13 ValuePair(Datum_Dealul_Piscului_1970,6317)
14
15 /* Datums for which only the ellipsoid is known */
16 ValuePair(DatumE_Airy1830, 6001)
17 ValuePair(DatumE_AiryModified1849, 6002)
18 ValuePair(DatumE_AustralianNationalSpheroid, 6003)
19 ValuePair(DatumE_Bessel1841, 6004)
20 ValuePair(DatumE_BesselModified, 6005)
21 ValuePair(DatumE_BesselNamibia, 6006)
22 ValuePair(DatumE_Clarke1858, 6007)
23 ValuePair(DatumE_Clarke1866, 6008)
24 ValuePair(DatumE_Clarke1866Michigan, 6009)
25 ValuePair(DatumE_Clarke1880_Benoit, 6010)
26 ValuePair(DatumE_Clarke1880_IGN, 6011)
27 ValuePair(DatumE_Clarke1880_RGS, 6012)
28 ValuePair(DatumE_Clarke1880_Arc, 6013)
29 ValuePair(DatumE_Clarke1880_SGA1922, 6014)
30 ValuePair(DatumE_Everest1830_1937Adjustment, 6015)
31 ValuePair(DatumE_Everest1830_1967Definition, 6016)
32 ValuePair(DatumE_Everest1830_1975Definition, 6017)
33 ValuePair(DatumE_Everest1830Modified, 6018)
34 ValuePair(DatumE_GRS1980, 6019)
35 ValuePair(DatumE_Helmert1906, 6020)
36 ValuePair(DatumE_IndonesianNationalSpheroid, 6021)
37 ValuePair(DatumE_International1924, 6022)
38 ValuePair(DatumE_International1967, 6023)
39 ValuePair(DatumE_Krassowsky1960, 6024)
40 ValuePair(DatumE_NWL9D, 6025)
41 ValuePair(DatumE_NWL10D, 6026)
42 ValuePair(DatumE_Plessis1817, 6027)
43 ValuePair(DatumE_Struve1860, 6028)
44 ValuePair(DatumE_WarOffice, 6029)
45 ValuePair(DatumE_WGS84, 6030)
46 ValuePair(DatumE_GEM10C, 6031)
47 ValuePair(DatumE_OSU86F, 6032)
48 ValuePair(DatumE_OSU91A, 6033)
49 ValuePair(DatumE_Clarke1880, 6034)
50 ValuePair(DatumE_Sphere, 6035)
51
52 /* standard datums */
53 ValuePair(Datum_Adindan, 6201)
54 ValuePair(Datum_Australian_Geodetic_Datum_1966, 6202)
55 ValuePair(Datum_Australian_Geodetic_Datum_1984, 6203)
56 ValuePair(Datum_Ain_el_Abd_1970, 6204)
57 ValuePair(Datum_Afgooye, 6205)
58 ValuePair(Datum_Agadez, 6206)
59 ValuePair(Datum_Lisbon, 6207)
60 ValuePair(Datum_Aratu, 6208)
61 ValuePair(Datum_Arc_1950, 6209)
62 ValuePair(Datum_Arc_1960, 6210)
63 ValuePair(Datum_Batavia, 6211)
64 ValuePair(Datum_Barbados, 6212)
65 ValuePair(Datum_Beduaram, 6213)
66 ValuePair(Datum_Beijing_1954, 6214)
67 ValuePair(Datum_Reseau_National_Belge_1950, 6215)
68 ValuePair(Datum_Bermuda_1957, 6216)
69 ValuePair(Datum_Bern_1898, 6217)
70 ValuePair(Datum_Bogota, 6218)
71 ValuePair(Datum_Bukit_Rimpah, 6219)
72 ValuePair(Datum_Camacupa, 6220)
73 ValuePair(Datum_Campo_Inchauspe, 6221)
74 ValuePair(Datum_Cape, 6222)
75 ValuePair(Datum_Carthage, 6223)
76 ValuePair(Datum_Chua, 6224)
77 ValuePair(Datum_Corrego_Alegre, 6225)
78 ValuePair(Datum_Cote_d_Ivoire, 6226)
79 ValuePair(Datum_Deir_ez_Zor, 6227)
80 ValuePair(Datum_Douala, 6228)
81 ValuePair(Datum_Egypt_1907, 6229)
82 ValuePair(Datum_European_Datum_1950, 6230)
83 ValuePair(Datum_European_Datum_1987, 6231)
84 ValuePair(Datum_Fahud, 6232)
85 ValuePair(Datum_Gandajika_1970, 6233)
86 ValuePair(Datum_Garoua, 6234)
87 ValuePair(Datum_Guyane_Francaise, 6235)
88 ValuePair(Datum_Hu_Tzu_Shan, 6236)
89 ValuePair(Datum_Hungarian_Datum_1972, 6237)
90 ValuePair(Datum_Indonesian_Datum_1974, 6238)
91 ValuePair(Datum_Indian_1954, 6239)
92 ValuePair(Datum_Indian_1975, 6240)
93 ValuePair(Datum_Jamaica_1875, 6241)
94 ValuePair(Datum_Jamaica_1969, 6242)
95 ValuePair(Datum_Kalianpur, 6243)
96 ValuePair(Datum_Kandawala, 6244)
97 ValuePair(Datum_Kertau, 6245)
98 ValuePair(Datum_Kuwait_Oil_Company, 6246)
99 ValuePair(Datum_La_Canoa, 6247)
100 ValuePair(Datum_Provisional_S_American_Datum_1956, 6248)
101 ValuePair(Datum_Lake, 6249)
102 ValuePair(Datum_Leigon, 6250)
103 ValuePair(Datum_Liberia_1964, 6251)
104 ValuePair(Datum_Lome, 6252)
105 ValuePair(Datum_Luzon_1911, 6253)
106 ValuePair(Datum_Hito_XVIII_1963, 6254)
107 ValuePair(Datum_Herat_North, 6255)
108 ValuePair(Datum_Mahe_1971, 6256)
109 ValuePair(Datum_Makassar, 6257)
110 ValuePair(Datum_European_Reference_System_1989, 6258)
111 ValuePair(Datum_Malongo_1987, 6259)
112 ValuePair(Datum_Manoca, 6260)
113 ValuePair(Datum_Merchich, 6261)
114 ValuePair(Datum_Massawa, 6262)
115 ValuePair(Datum_Minna, 6263)
116 ValuePair(Datum_Mhast, 6264)
117 ValuePair(Datum_Monte_Mario, 6265)
118 ValuePair(Datum_M_poraloko, 6266)
119 ValuePair(Datum_North_American_Datum_1927, 6267)
120 ValuePair(Datum_NAD_Michigan, 6268)
121 ValuePair(Datum_North_American_Datum_1983, 6269)
122 ValuePair(Datum_Nahrwan_1967, 6270)
123 ValuePair(Datum_Naparima_1972, 6271)
124 ValuePair(Datum_New_Zealand_Geodetic_Datum_1949, 6272)
125 ValuePair(Datum_NGO_1948, 6273)
126 ValuePair(Datum_Datum_73, 6274)
127 ValuePair(Datum_Nouvelle_Triangulation_Francaise, 6275)
128 ValuePair(Datum_NSWC_9Z_2, 6276)
129 ValuePair(Datum_OSGB_1936, 6277)
130 ValuePair(Datum_OSGB_1970_SN, 6278)
131 ValuePair(Datum_OS_SN_1980, 6279)
132 ValuePair(Datum_Padang_1884, 6280)
133 ValuePair(Datum_Palestine_1923, 6281)
134 ValuePair(Datum_Pointe_Noire, 6282)
135 ValuePair(Datum_Geocentric_Datum_of_Australia_1994, 6283)
136 ValuePair(Datum_Pulkovo_1942, 6284)
137 ValuePair(Datum_Qatar, 6285)
138 ValuePair(Datum_Qatar_1948, 6286)
139 ValuePair(Datum_Qornoq, 6287)
140 ValuePair(Datum_Loma_Quintana, 6288)
141 ValuePair(Datum_Amersfoort, 6289)
142 ValuePair(Datum_RT38, 6290)
143 ValuePair(Datum_South_American_Datum_1969, 6291)
144 ValuePair(Datum_Sapper_Hill_1943, 6292)
145 ValuePair(Datum_Schwarzeck, 6293)
146 ValuePair(Datum_Segora, 6294)
147 ValuePair(Datum_Serindung, 6295)
148 ValuePair(Datum_Sudan, 6296)
149 ValuePair(Datum_Tananarive_1925, 6297)
150 ValuePair(Datum_Timbalai_1948, 6298)
151 ValuePair(Datum_TM65, 6299)
152 ValuePair(Datum_TM75, 6300)
153 ValuePair(Datum_Tokyo, 6301)
154 ValuePair(Datum_Trinidad_1903, 6302)
155 ValuePair(Datum_Trucial_Coast_1948, 6303)
156 ValuePair(Datum_Voirol_1875, 6304)
157 ValuePair(Datum_Voirol_Unifie_1960, 6305)
158 ValuePair(Datum_Bern_1938, 6306)
159 ValuePair(Datum_Nord_Sahara_1959, 6307)
160 ValuePair(Datum_Stockholm_1938, 6308)
161 ValuePair(Datum_Yacare, 6309)
162 ValuePair(Datum_Yoff, 6310)
163 ValuePair(Datum_Zanderij, 6311)
164 ValuePair(Datum_Militar_Geographische_Institut, 6312)
165 ValuePair(Datum_Reseau_National_Belge_1972, 6313)
166 ValuePair(Datum_Deutsche_Hauptdreiecksnetz, 6314)
167 ValuePair(Datum_Conakry_1905, 6315)
168 ValuePair(Datum_WGS72, 6322)
169 ValuePair(Datum_WGS72_Transit_Broadcast_Ephemeris, 6324)
170 ValuePair(Datum_WGS84, 6326)
171 ValuePair(Datum_Ancienne_Triangulation_Francaise, 6901)
172 ValuePair(Datum_Nord_de_Guerre, 6902)
173 /* end of list */
0 /*
1 * GeoTIFF Rev. 0.2 Ellipsoids
2 */
3
4 /* C database for Geotiff include files. */
5 /* the macro ValuePair() must be defined */
6 /* by the enclosing include file */
7
8 #ifdef INCLUDE_OLD_CODES
9 #include old_ellipse.inc
10 #endif /* OLD Codes */
11
12 ValuePair(Ellipse_Airy_1830, 7001)
13 ValuePair(Ellipse_Airy_Modified_1849, 7002)
14 ValuePair(Ellipse_Australian_National_Spheroid, 7003)
15 ValuePair(Ellipse_Bessel_1841, 7004)
16 ValuePair(Ellipse_Bessel_Modified, 7005)
17 ValuePair(Ellipse_Bessel_Namibia, 7006)
18 ValuePair(Ellipse_Clarke_1858, 7007)
19 ValuePair(Ellipse_Clarke_1866, 7008)
20 ValuePair(Ellipse_Clarke_1866_Michigan, 7009)
21 ValuePair(Ellipse_Clarke_1880_Benoit, 7010)
22 ValuePair(Ellipse_Clarke_1880_IGN, 7011)
23 ValuePair(Ellipse_Clarke_1880_RGS, 7012)
24 ValuePair(Ellipse_Clarke_1880_Arc, 7013)
25 ValuePair(Ellipse_Clarke_1880_SGA_1922, 7014)
26 ValuePair(Ellipse_Everest_1830_1937_Adjustment, 7015)
27 ValuePair(Ellipse_Everest_1830_1967_Definition, 7016)
28 ValuePair(Ellipse_Everest_1830_1975_Definition, 7017)
29 ValuePair(Ellipse_Everest_1830_Modified, 7018)
30 ValuePair(Ellipse_GRS_1980, 7019)
31 ValuePair(Ellipse_Helmert_1906, 7020)
32 ValuePair(Ellipse_Indonesian_National_Spheroid, 7021)
33 ValuePair(Ellipse_International_1924, 7022)
34 ValuePair(Ellipse_International_1967, 7023)
35 ValuePair(Ellipse_Krassowsky_1940, 7024)
36 ValuePair(Ellipse_NWL_9D, 7025)
37 ValuePair(Ellipse_NWL_10D, 7026)
38 ValuePair(Ellipse_Plessis_1817, 7027)
39 ValuePair(Ellipse_Struve_1860, 7028)
40 ValuePair(Ellipse_War_Office, 7029)
41 ValuePair(Ellipse_WGS_84, 7030)
42 ValuePair(Ellipse_GEM_10C, 7031)
43 ValuePair(Ellipse_OSU86F, 7032)
44 ValuePair(Ellipse_OSU91A, 7033)
45 ValuePair(Ellipse_Clarke_1880, 7034)
46 ValuePair(Ellipse_Sphere, 7035)
47 /* end of list */
0 /*
1 * EPSG/POSC GCS Codes -- GeoTIFF Rev. 0.2
2 */
3
4 /* C database for Geotiff include files. */
5 /* the macro ValuePair() must be defined */
6 /* by the enclosing include file */
7
8 #ifdef INCLUDE_OLD_CODES
9 #include old_gcs.inc
10 #endif /* OLD Codes */
11
12 /* Unspecified GCS based on ellipsoid */
13 ValuePair(GCSE_Airy1830, 4001)
14 ValuePair(GCSE_AiryModified1849, 4002)
15 ValuePair(GCSE_AustralianNationalSpheroid, 4003)
16 ValuePair(GCSE_Bessel1841, 4004)
17 ValuePair(GCSE_BesselModified, 4005)
18 ValuePair(GCSE_BesselNamibia, 4006)
19 ValuePair(GCSE_Clarke1858, 4007)
20 ValuePair(GCSE_Clarke1866, 4008)
21 ValuePair(GCSE_Clarke1866Michigan, 4009)
22 ValuePair(GCSE_Clarke1880_Benoit, 4010)
23 ValuePair(GCSE_Clarke1880_IGN, 4011)
24 ValuePair(GCSE_Clarke1880_RGS, 4012)
25 ValuePair(GCSE_Clarke1880_Arc, 4013)
26 ValuePair(GCSE_Clarke1880_SGA1922, 4014)
27 ValuePair(GCSE_Everest1830_1937Adjustment, 4015)
28 ValuePair(GCSE_Everest1830_1967Definition, 4016)
29 ValuePair(GCSE_Everest1830_1975Definition, 4017)
30 ValuePair(GCSE_Everest1830Modified, 4018)
31 ValuePair(GCSE_GRS1980, 4019)
32 ValuePair(GCSE_Helmert1906, 4020)
33 ValuePair(GCSE_IndonesianNationalSpheroid, 4021)
34 ValuePair(GCSE_International1924, 4022)
35 ValuePair(GCSE_International1967, 4023)
36 ValuePair(GCSE_Krassowsky1940, 4024)
37 ValuePair(GCSE_NWL9D, 4025)
38 ValuePair(GCSE_NWL10D, 4026)
39 ValuePair(GCSE_Plessis1817, 4027)
40 ValuePair(GCSE_Struve1860, 4028)
41 ValuePair(GCSE_WarOffice, 4029)
42 ValuePair(GCSE_WGS84, 4030)
43 ValuePair(GCSE_GEM10C, 4031)
44 ValuePair(GCSE_OSU86F, 4032)
45 ValuePair(GCSE_OSU91A, 4033)
46 ValuePair(GCSE_Clarke1880, 4034)
47 ValuePair(GCSE_Sphere, 4035)
48
49 /* New GCS */
50 ValuePair(GCS_Greek,4120)
51 ValuePair(GCS_GGRS87,4121)
52 ValuePair(GCS_KKJ,4123)
53 ValuePair(GCS_RT90,4124)
54 ValuePair(GCS_EST92,4133)
55 ValuePair(GCS_Dealul_Piscului_1970,4317)
56 ValuePair(GCS_Greek_Athens,4815)
57
58 /* Standard GCS */
59 ValuePair(GCS_Adindan, 4201)
60 ValuePair(GCS_AGD66, 4202)
61 ValuePair(GCS_AGD84, 4203)
62 ValuePair(GCS_Ain_el_Abd, 4204)
63 ValuePair(GCS_Afgooye, 4205)
64 ValuePair(GCS_Agadez, 4206)
65 ValuePair(GCS_Lisbon, 4207)
66 ValuePair(GCS_Aratu, 4208)
67 ValuePair(GCS_Arc_1950, 4209)
68 ValuePair(GCS_Arc_1960, 4210)
69 ValuePair(GCS_Batavia, 4211)
70 ValuePair(GCS_Barbados, 4212)
71 ValuePair(GCS_Beduaram, 4213)
72 ValuePair(GCS_Beijing_1954, 4214)
73 ValuePair(GCS_Belge_1950, 4215)
74 ValuePair(GCS_Bermuda_1957, 4216)
75 ValuePair(GCS_Bern_1898, 4217)
76 ValuePair(GCS_Bogota, 4218)
77 ValuePair(GCS_Bukit_Rimpah, 4219)
78 ValuePair(GCS_Camacupa, 4220)
79 ValuePair(GCS_Campo_Inchauspe, 4221)
80 ValuePair(GCS_Cape, 4222)
81 ValuePair(GCS_Carthage, 4223)
82 ValuePair(GCS_Chua, 4224)
83 ValuePair(GCS_Corrego_Alegre, 4225)
84 ValuePair(GCS_Cote_d_Ivoire, 4226)
85 ValuePair(GCS_Deir_ez_Zor, 4227)
86 ValuePair(GCS_Douala, 4228)
87 ValuePair(GCS_Egypt_1907, 4229)
88 ValuePair(GCS_ED50, 4230)
89 ValuePair(GCS_ED87, 4231)
90 ValuePair(GCS_Fahud, 4232)
91 ValuePair(GCS_Gandajika_1970, 4233)
92 ValuePair(GCS_Garoua, 4234)
93 ValuePair(GCS_Guyane_Francaise, 4235)
94 ValuePair(GCS_Hu_Tzu_Shan, 4236)
95 ValuePair(GCS_HD72, 4237)
96 ValuePair(GCS_ID74, 4238)
97 ValuePair(GCS_Indian_1954, 4239)
98 ValuePair(GCS_Indian_1975, 4240)
99 ValuePair(GCS_Jamaica_1875, 4241)
100 ValuePair(GCS_JAD69, 4242)
101 ValuePair(GCS_Kalianpur, 4243)
102 ValuePair(GCS_Kandawala, 4244)
103 ValuePair(GCS_Kertau, 4245)
104 ValuePair(GCS_KOC, 4246)
105 ValuePair(GCS_La_Canoa, 4247)
106 ValuePair(GCS_PSAD56, 4248)
107 ValuePair(GCS_Lake, 4249)
108 ValuePair(GCS_Leigon, 4250)
109 ValuePair(GCS_Liberia_1964, 4251)
110 ValuePair(GCS_Lome, 4252)
111 ValuePair(GCS_Luzon_1911, 4253)
112 ValuePair(GCS_Hito_XVIII_1963, 4254)
113 ValuePair(GCS_Herat_North, 4255)
114 ValuePair(GCS_Mahe_1971, 4256)
115 ValuePair(GCS_Makassar, 4257)
116 ValuePair(GCS_EUREF89, 4258)
117 ValuePair(GCS_Malongo_1987, 4259)
118 ValuePair(GCS_Manoca, 4260)
119 ValuePair(GCS_Merchich, 4261)
120 ValuePair(GCS_Massawa, 4262)
121 ValuePair(GCS_Minna, 4263)
122 ValuePair(GCS_Mhast, 4264)
123 ValuePair(GCS_Monte_Mario, 4265)
124 ValuePair(GCS_M_poraloko, 4266)
125 ValuePair(GCS_NAD27, 4267)
126 ValuePair(GCS_NAD_Michigan, 4268)
127 ValuePair(GCS_NAD83, 4269)
128 ValuePair(GCS_Nahrwan_1967, 4270)
129 ValuePair(GCS_Naparima_1972, 4271)
130 ValuePair(GCS_GD49, 4272)
131 ValuePair(GCS_NGO_1948, 4273)
132 ValuePair(GCS_Datum_73, 4274)
133 ValuePair(GCS_NTF, 4275)
134 ValuePair(GCS_NSWC_9Z_2, 4276)
135 ValuePair(GCS_OSGB_1936, 4277)
136 ValuePair(GCS_OSGB70, 4278)
137 ValuePair(GCS_OS_SN80, 4279)
138 ValuePair(GCS_Padang, 4280)
139 ValuePair(GCS_Palestine_1923, 4281)
140 ValuePair(GCS_Pointe_Noire, 4282)
141 ValuePair(GCS_GDA94, 4283)
142 ValuePair(GCS_Pulkovo_1942, 4284)
143 ValuePair(GCS_Qatar, 4285)
144 ValuePair(GCS_Qatar_1948, 4286)
145 ValuePair(GCS_Qornoq, 4287)
146 ValuePair(GCS_Loma_Quintana, 4288)
147 ValuePair(GCS_Amersfoort, 4289)
148 ValuePair(GCS_RT38, 4290)
149 ValuePair(GCS_SAD69, 4291)
150 ValuePair(GCS_Sapper_Hill_1943, 4292)
151 ValuePair(GCS_Schwarzeck, 4293)
152 ValuePair(GCS_Segora, 4294)
153 ValuePair(GCS_Serindung, 4295)
154 ValuePair(GCS_Sudan, 4296)
155 ValuePair(GCS_Tananarive, 4297)
156 ValuePair(GCS_Timbalai_1948, 4298)
157 ValuePair(GCS_TM65, 4299)
158 ValuePair(GCS_TM75, 4300)
159 ValuePair(GCS_Tokyo, 4301)
160 ValuePair(GCS_Trinidad_1903, 4302)
161 ValuePair(GCS_TC_1948, 4303)
162 ValuePair(GCS_Voirol_1875, 4304)
163 ValuePair(GCS_Voirol_Unifie, 4305)
164 ValuePair(GCS_Bern_1938, 4306)
165 ValuePair(GCS_Nord_Sahara_1959, 4307)
166 ValuePair(GCS_Stockholm_1938, 4308)
167 ValuePair(GCS_Yacare, 4309)
168 ValuePair(GCS_Yoff, 4310)
169 ValuePair(GCS_Zanderij, 4311)
170 ValuePair(GCS_MGI, 4312)
171 ValuePair(GCS_Belge_1972, 4313)
172 ValuePair(GCS_DHDN, 4314)
173 ValuePair(GCS_Conakry_1905, 4315)
174 ValuePair(GCS_WGS_72, 4322)
175 ValuePair(GCS_WGS_72BE, 4324)
176 ValuePair(GCS_WGS_84, 4326)
177 ValuePair(GCS_Bern_1898_Bern, 4801)
178 ValuePair(GCS_Bogota_Bogota, 4802)
179 ValuePair(GCS_Lisbon_Lisbon, 4803)
180 ValuePair(GCS_Makassar_Jakarta, 4804)
181 ValuePair(GCS_MGI_Ferro, 4805)
182 ValuePair(GCS_Monte_Mario_Rome, 4806)
183 ValuePair(GCS_NTF_Paris, 4807)
184 ValuePair(GCS_Padang_Jakarta, 4808)
185 ValuePair(GCS_Belge_1950_Brussels, 4809)
186 ValuePair(GCS_Tananarive_Paris, 4810)
187 ValuePair(GCS_Voirol_1875_Paris, 4811)
188 ValuePair(GCS_Voirol_Unifie_Paris, 4812)
189 ValuePair(GCS_Batavia_Jakarta, 4813)
190 ValuePair(GCS_ATF_Paris, 4901)
191 ValuePair(GCS_NDG_Paris, 4902)
192 /* End of list */
0 /*
1 * EPSG PCS Codes - GeoTIFF Rev 0.2
2 */
3
4 /* C database for Geotiff include files. */
5 /* the macro ValuePair() must be defined */
6 /* by the enclosing include file */
7
8 #ifdef INCLUDE_OLD_CODES
9 #include old_pcs.inc
10 #endif /* OLD Codes */
11
12 /* Newer PCS */
13 ValuePair(PCS_Hjorsey_1955_Lambert, 3053)
14 ValuePair(PCS_ISN93_Lambert_1993, 3057)
15 ValuePair(PCS_ETRS89_Poland_CS2000_zone_5,2176)
16 ValuePair(PCS_ETRS89_Poland_CS2000_zone_6,2177)
17 ValuePair(PCS_ETRS89_Poland_CS2000_zone_7,2177)
18 ValuePair(PCS_ETRS89_Poland_CS2000_zone_8,2178)
19 ValuePair(PCS_ETRS89_Poland_CS92,2180)
20
21 /* New PCS */
22 ValuePair(PCS_GGRS87_Greek_Grid,2100)
23 ValuePair(PCS_KKJ_Finland_zone_1,2391)
24 ValuePair(PCS_KKJ_Finland_zone_2,2392)
25 ValuePair(PCS_KKJ_Finland_zone_3,2393)
26 ValuePair(PCS_KKJ_Finland_zone_4,2394)
27 ValuePair(PCS_RT90_2_5_gon_W,2400)
28 ValuePair(PCS_Lietuvos_Koordinoei_Sistema_1994,2600)
29 ValuePair(PCS_Estonian_Coordinate_System_of_1992,3300)
30 ValuePair(PCS_HD72_EOV,23700)
31 ValuePair(PCS_Dealul_Piscului_1970_Stereo_70,31700)
32
33 ValuePair(PCS_Adindan_UTM_zone_37N, 20137)
34 ValuePair(PCS_Adindan_UTM_zone_38N, 20138)
35 ValuePair(PCS_AGD66_AMG_zone_48, 20248)
36 ValuePair(PCS_AGD66_AMG_zone_49, 20249)
37 ValuePair(PCS_AGD66_AMG_zone_50, 20250)
38 ValuePair(PCS_AGD66_AMG_zone_51, 20251)
39 ValuePair(PCS_AGD66_AMG_zone_52, 20252)
40 ValuePair(PCS_AGD66_AMG_zone_53, 20253)
41 ValuePair(PCS_AGD66_AMG_zone_54, 20254)
42 ValuePair(PCS_AGD66_AMG_zone_55, 20255)
43 ValuePair(PCS_AGD66_AMG_zone_56, 20256)
44 ValuePair(PCS_AGD66_AMG_zone_57, 20257)
45 ValuePair(PCS_AGD66_AMG_zone_58, 20258)
46 ValuePair(PCS_AGD84_AMG_zone_48, 20348)
47 ValuePair(PCS_AGD84_AMG_zone_49, 20349)
48 ValuePair(PCS_AGD84_AMG_zone_50, 20350)
49 ValuePair(PCS_AGD84_AMG_zone_51, 20351)
50 ValuePair(PCS_AGD84_AMG_zone_52, 20352)
51 ValuePair(PCS_AGD84_AMG_zone_53, 20353)
52 ValuePair(PCS_AGD84_AMG_zone_54, 20354)
53 ValuePair(PCS_AGD84_AMG_zone_55, 20355)
54 ValuePair(PCS_AGD84_AMG_zone_56, 20356)
55 ValuePair(PCS_AGD84_AMG_zone_57, 20357)
56 ValuePair(PCS_AGD84_AMG_zone_58, 20358)
57 ValuePair(PCS_Ain_el_Abd_UTM_zone_37N, 20437)
58 ValuePair(PCS_Ain_el_Abd_UTM_zone_38N, 20438)
59 ValuePair(PCS_Ain_el_Abd_UTM_zone_39N, 20439)
60 ValuePair(PCS_Ain_el_Abd_Bahrain_Grid, 20499)
61 ValuePair(PCS_Afgooye_UTM_zone_38N, 20538)
62 ValuePair(PCS_Afgooye_UTM_zone_39N, 20539)
63 ValuePair(PCS_Lisbon_Portugese_Grid, 20700)
64 ValuePair(PCS_Aratu_UTM_zone_22S, 20822)
65 ValuePair(PCS_Aratu_UTM_zone_23S, 20823)
66 ValuePair(PCS_Aratu_UTM_zone_24S, 20824)
67 ValuePair(PCS_Arc_1950_Lo13, 20973)
68 ValuePair(PCS_Arc_1950_Lo15, 20975)
69 ValuePair(PCS_Arc_1950_Lo17, 20977)
70 ValuePair(PCS_Arc_1950_Lo19, 20979)
71 ValuePair(PCS_Arc_1950_Lo21, 20981)
72 ValuePair(PCS_Arc_1950_Lo23, 20983)
73 ValuePair(PCS_Arc_1950_Lo25, 20985)
74 ValuePair(PCS_Arc_1950_Lo27, 20987)
75 ValuePair(PCS_Arc_1950_Lo29, 20989)
76 ValuePair(PCS_Arc_1950_Lo31, 20991)
77 ValuePair(PCS_Arc_1950_Lo33, 20993)
78 ValuePair(PCS_Arc_1950_Lo35, 20995)
79 ValuePair(PCS_Batavia_NEIEZ, 21100)
80 ValuePair(PCS_Batavia_UTM_zone_48S, 21148)
81 ValuePair(PCS_Batavia_UTM_zone_49S, 21149)
82 ValuePair(PCS_Batavia_UTM_zone_50S, 21150)
83 ValuePair(PCS_Beijing_Gauss_zone_13, 21413)
84 ValuePair(PCS_Beijing_Gauss_zone_14, 21414)
85 ValuePair(PCS_Beijing_Gauss_zone_15, 21415)
86 ValuePair(PCS_Beijing_Gauss_zone_16, 21416)
87 ValuePair(PCS_Beijing_Gauss_zone_17, 21417)
88 ValuePair(PCS_Beijing_Gauss_zone_18, 21418)
89 ValuePair(PCS_Beijing_Gauss_zone_19, 21419)
90 ValuePair(PCS_Beijing_Gauss_zone_20, 21420)
91 ValuePair(PCS_Beijing_Gauss_zone_21, 21421)
92 ValuePair(PCS_Beijing_Gauss_zone_22, 21422)
93 ValuePair(PCS_Beijing_Gauss_zone_23, 21423)
94 ValuePair(PCS_Beijing_Gauss_13N, 21473)
95 ValuePair(PCS_Beijing_Gauss_14N, 21474)
96 ValuePair(PCS_Beijing_Gauss_15N, 21475)
97 ValuePair(PCS_Beijing_Gauss_16N, 21476)
98 ValuePair(PCS_Beijing_Gauss_17N, 21477)
99 ValuePair(PCS_Beijing_Gauss_18N, 21478)
100 ValuePair(PCS_Beijing_Gauss_19N, 21479)
101 ValuePair(PCS_Beijing_Gauss_20N, 21480)
102 ValuePair(PCS_Beijing_Gauss_21N, 21481)
103 ValuePair(PCS_Beijing_Gauss_22N, 21482)
104 ValuePair(PCS_Beijing_Gauss_23N, 21483)
105 ValuePair(PCS_Belge_Lambert_50, 21500)
106 ValuePair(PCS_Bern_1898_Swiss_Old, 21790)
107 ValuePair(PCS_Bogota_UTM_zone_17N, 21817)
108 ValuePair(PCS_Bogota_UTM_zone_18N, 21818)
109 ValuePair(PCS_Bogota_Colombia_3W, 21891)
110 ValuePair(PCS_Bogota_Colombia_Bogota, 21892)
111 ValuePair(PCS_Bogota_Colombia_3E, 21893)
112 ValuePair(PCS_Bogota_Colombia_6E, 21894)
113 ValuePair(PCS_Camacupa_UTM_32S, 22032)
114 ValuePair(PCS_Camacupa_UTM_33S, 22033)
115 ValuePair(PCS_C_Inchauspe_Argentina_1, 22191)
116 ValuePair(PCS_C_Inchauspe_Argentina_2, 22192)
117 ValuePair(PCS_C_Inchauspe_Argentina_3, 22193)
118 ValuePair(PCS_C_Inchauspe_Argentina_4, 22194)
119 ValuePair(PCS_C_Inchauspe_Argentina_5, 22195)
120 ValuePair(PCS_C_Inchauspe_Argentina_6, 22196)
121 ValuePair(PCS_C_Inchauspe_Argentina_7, 22197)
122 ValuePair(PCS_Carthage_UTM_zone_32N, 22332)
123 ValuePair(PCS_Carthage_Nord_Tunisie, 22391)
124 ValuePair(PCS_Carthage_Sud_Tunisie, 22392)
125 ValuePair(PCS_Corrego_Alegre_UTM_23S, 22523)
126 ValuePair(PCS_Corrego_Alegre_UTM_24S, 22524)
127 ValuePair(PCS_Douala_UTM_zone_32N, 22832)
128 ValuePair(PCS_Egypt_1907_Red_Belt, 22992)
129 ValuePair(PCS_Egypt_1907_Purple_Belt, 22993)
130 ValuePair(PCS_Egypt_1907_Ext_Purple, 22994)
131 ValuePair(PCS_ED50_UTM_zone_28N, 23028)
132 ValuePair(PCS_ED50_UTM_zone_29N, 23029)
133 ValuePair(PCS_ED50_UTM_zone_30N, 23030)
134 ValuePair(PCS_ED50_UTM_zone_31N, 23031)
135 ValuePair(PCS_ED50_UTM_zone_32N, 23032)
136 ValuePair(PCS_ED50_UTM_zone_33N, 23033)
137 ValuePair(PCS_ED50_UTM_zone_34N, 23034)
138 ValuePair(PCS_ED50_UTM_zone_35N, 23035)
139 ValuePair(PCS_ED50_UTM_zone_36N, 23036)
140 ValuePair(PCS_ED50_UTM_zone_37N, 23037)
141 ValuePair(PCS_ED50_UTM_zone_38N, 23038)
142 ValuePair(PCS_Fahud_UTM_zone_39N, 23239)
143 ValuePair(PCS_Fahud_UTM_zone_40N, 23240)
144 ValuePair(PCS_Garoua_UTM_zone_33N, 23433)
145 ValuePair(PCS_ID74_UTM_zone_46N, 23846)
146 ValuePair(PCS_ID74_UTM_zone_47N, 23847)
147 ValuePair(PCS_ID74_UTM_zone_48N, 23848)
148 ValuePair(PCS_ID74_UTM_zone_49N, 23849)
149 ValuePair(PCS_ID74_UTM_zone_50N, 23850)
150 ValuePair(PCS_ID74_UTM_zone_51N, 23851)
151 ValuePair(PCS_ID74_UTM_zone_52N, 23852)
152 ValuePair(PCS_ID74_UTM_zone_53N, 23853)
153 ValuePair(PCS_ID74_UTM_zone_46S, 23886)
154 ValuePair(PCS_ID74_UTM_zone_47S, 23887)
155 ValuePair(PCS_ID74_UTM_zone_48S, 23888)
156 ValuePair(PCS_ID74_UTM_zone_49S, 23889)
157 ValuePair(PCS_ID74_UTM_zone_50S, 23890)
158 ValuePair(PCS_ID74_UTM_zone_51S, 23891)
159 ValuePair(PCS_ID74_UTM_zone_52S, 23892)
160 ValuePair(PCS_ID74_UTM_zone_53S, 23893)
161 ValuePair(PCS_ID74_UTM_zone_54S, 23894)
162 ValuePair(PCS_Indian_1954_UTM_47N, 23947)
163 ValuePair(PCS_Indian_1954_UTM_48N, 23948)
164 ValuePair(PCS_Indian_1975_UTM_47N, 24047)
165 ValuePair(PCS_Indian_1975_UTM_48N, 24048)
166 ValuePair(PCS_Jamaica_1875_Old_Grid, 24100)
167 ValuePair(PCS_JAD69_Jamaica_Grid, 24200)
168 ValuePair(PCS_Kalianpur_India_0, 24370)
169 ValuePair(PCS_Kalianpur_India_I, 24371)
170 ValuePair(PCS_Kalianpur_India_IIa, 24372)
171 ValuePair(PCS_Kalianpur_India_IIIa, 24373)
172 ValuePair(PCS_Kalianpur_India_IVa, 24374)
173 ValuePair(PCS_Kalianpur_India_IIb, 24382)
174 ValuePair(PCS_Kalianpur_India_IIIb, 24383)
175 ValuePair(PCS_Kalianpur_India_IVb, 24384)
176 ValuePair(PCS_Kertau_Singapore_Grid, 24500)
177 ValuePair(PCS_Kertau_UTM_zone_47N, 24547)
178 ValuePair(PCS_Kertau_UTM_zone_48N, 24548)
179 ValuePair(PCS_La_Canoa_UTM_zone_20N, 24720)
180 ValuePair(PCS_La_Canoa_UTM_zone_21N, 24721)
181 ValuePair(PCS_PSAD56_UTM_zone_18N, 24818)
182 ValuePair(PCS_PSAD56_UTM_zone_19N, 24819)
183 ValuePair(PCS_PSAD56_UTM_zone_20N, 24820)
184 ValuePair(PCS_PSAD56_UTM_zone_21N, 24821)
185 ValuePair(PCS_PSAD56_UTM_zone_17S, 24877)
186 ValuePair(PCS_PSAD56_UTM_zone_18S, 24878)
187 ValuePair(PCS_PSAD56_UTM_zone_19S, 24879)
188 ValuePair(PCS_PSAD56_UTM_zone_20S, 24880)
189 ValuePair(PCS_PSAD56_Peru_west_zone, 24891)
190 ValuePair(PCS_PSAD56_Peru_central, 24892)
191 ValuePair(PCS_PSAD56_Peru_east_zone, 24893)
192 ValuePair(PCS_Leigon_Ghana_Grid, 25000)
193 ValuePair(PCS_Lome_UTM_zone_31N, 25231)
194 ValuePair(PCS_Luzon_Philippines_I, 25391)
195 ValuePair(PCS_Luzon_Philippines_II, 25392)
196 ValuePair(PCS_Luzon_Philippines_III, 25393)
197 ValuePair(PCS_Luzon_Philippines_IV, 25394)
198 ValuePair(PCS_Luzon_Philippines_V, 25395)
199 ValuePair(PCS_Makassar_NEIEZ, 25700)
200 ValuePair(PCS_Malongo_1987_UTM_32S, 25932)
201 ValuePair(PCS_Merchich_Nord_Maroc, 26191)
202 ValuePair(PCS_Merchich_Sud_Maroc, 26192)
203 ValuePair(PCS_Merchich_Sahara, 26193)
204 ValuePair(PCS_Massawa_UTM_zone_37N, 26237)
205 ValuePair(PCS_Minna_UTM_zone_31N, 26331)
206 ValuePair(PCS_Minna_UTM_zone_32N, 26332)
207 ValuePair(PCS_Minna_Nigeria_West, 26391)
208 ValuePair(PCS_Minna_Nigeria_Mid_Belt, 26392)
209 ValuePair(PCS_Minna_Nigeria_East, 26393)
210 ValuePair(PCS_Mhast_UTM_zone_32S, 26432)
211 ValuePair(PCS_Monte_Mario_Italy_1, 26591)
212 ValuePair(PCS_Monte_Mario_Italy_2, 26592)
213 ValuePair(PCS_M_poraloko_UTM_32N, 26632)
214 ValuePair(PCS_M_poraloko_UTM_32S, 26692)
215 ValuePair(PCS_NAD27_UTM_zone_3N, 26703)
216 ValuePair(PCS_NAD27_UTM_zone_4N, 26704)
217 ValuePair(PCS_NAD27_UTM_zone_5N, 26705)
218 ValuePair(PCS_NAD27_UTM_zone_6N, 26706)
219 ValuePair(PCS_NAD27_UTM_zone_7N, 26707)
220 ValuePair(PCS_NAD27_UTM_zone_8N, 26708)
221 ValuePair(PCS_NAD27_UTM_zone_9N, 26709)
222 ValuePair(PCS_NAD27_UTM_zone_10N, 26710)
223 ValuePair(PCS_NAD27_UTM_zone_11N, 26711)
224 ValuePair(PCS_NAD27_UTM_zone_12N, 26712)
225 ValuePair(PCS_NAD27_UTM_zone_13N, 26713)
226 ValuePair(PCS_NAD27_UTM_zone_14N, 26714)
227 ValuePair(PCS_NAD27_UTM_zone_15N, 26715)
228 ValuePair(PCS_NAD27_UTM_zone_16N, 26716)
229 ValuePair(PCS_NAD27_UTM_zone_17N, 26717)
230 ValuePair(PCS_NAD27_UTM_zone_18N, 26718)
231 ValuePair(PCS_NAD27_UTM_zone_19N, 26719)
232 ValuePair(PCS_NAD27_UTM_zone_20N, 26720)
233 ValuePair(PCS_NAD27_UTM_zone_21N, 26721)
234 ValuePair(PCS_NAD27_UTM_zone_22N, 26722)
235 ValuePair(PCS_NAD27_Alabama_East, 26729)
236 ValuePair(PCS_NAD27_Alabama_West, 26730)
237 ValuePair(PCS_NAD27_Alaska_zone_1, 26731)
238 ValuePair(PCS_NAD27_Alaska_zone_2, 26732)
239 ValuePair(PCS_NAD27_Alaska_zone_3, 26733)
240 ValuePair(PCS_NAD27_Alaska_zone_4, 26734)
241 ValuePair(PCS_NAD27_Alaska_zone_5, 26735)
242 ValuePair(PCS_NAD27_Alaska_zone_6, 26736)
243 ValuePair(PCS_NAD27_Alaska_zone_7, 26737)
244 ValuePair(PCS_NAD27_Alaska_zone_8, 26738)
245 ValuePair(PCS_NAD27_Alaska_zone_9, 26739)
246 ValuePair(PCS_NAD27_Alaska_zone_10, 26740)
247 ValuePair(PCS_NAD27_California_I, 26741)
248 ValuePair(PCS_NAD27_California_II, 26742)
249 ValuePair(PCS_NAD27_California_III, 26743)
250 ValuePair(PCS_NAD27_California_IV, 26744)
251 ValuePair(PCS_NAD27_California_V, 26745)
252 ValuePair(PCS_NAD27_California_VI, 26746)
253 ValuePair(PCS_NAD27_California_VII, 26747)
254 ValuePair(PCS_NAD27_Arizona_East, 26748)
255 ValuePair(PCS_NAD27_Arizona_Central, 26749)
256 ValuePair(PCS_NAD27_Arizona_West, 26750)
257 ValuePair(PCS_NAD27_Arkansas_North, 26751)
258 ValuePair(PCS_NAD27_Arkansas_South, 26752)
259 ValuePair(PCS_NAD27_Colorado_North, 26753)
260 ValuePair(PCS_NAD27_Colorado_Central, 26754)
261 ValuePair(PCS_NAD27_Colorado_South, 26755)
262 ValuePair(PCS_NAD27_Connecticut, 26756)
263 ValuePair(PCS_NAD27_Delaware, 26757)
264 ValuePair(PCS_NAD27_Florida_East, 26758)
265 ValuePair(PCS_NAD27_Florida_West, 26759)
266 ValuePair(PCS_NAD27_Florida_North, 26760)
267 ValuePair(PCS_NAD27_Hawaii_zone_1, 26761)
268 ValuePair(PCS_NAD27_Hawaii_zone_2, 26762)
269 ValuePair(PCS_NAD27_Hawaii_zone_3, 26763)
270 ValuePair(PCS_NAD27_Hawaii_zone_4, 26764)
271 ValuePair(PCS_NAD27_Hawaii_zone_5, 26765)
272 ValuePair(PCS_NAD27_Georgia_East, 26766)
273 ValuePair(PCS_NAD27_Georgia_West, 26767)
274 ValuePair(PCS_NAD27_Idaho_East, 26768)
275 ValuePair(PCS_NAD27_Idaho_Central, 26769)
276 ValuePair(PCS_NAD27_Idaho_West, 26770)
277 ValuePair(PCS_NAD27_Illinois_East, 26771)
278 ValuePair(PCS_NAD27_Illinois_West, 26772)
279 ValuePair(PCS_NAD27_Indiana_East, 26773)
280 ValuePair(PCS_NAD27_BLM_14N_feet, 26774)
281 ValuePair(PCS_NAD27_Indiana_West, 26774)
282 ValuePair(PCS_NAD27_BLM_15N_feet, 26775)
283 ValuePair(PCS_NAD27_Iowa_North, 26775)
284 ValuePair(PCS_NAD27_BLM_16N_feet, 26776)
285 ValuePair(PCS_NAD27_Iowa_South, 26776)
286 ValuePair(PCS_NAD27_BLM_17N_feet, 26777)
287 ValuePair(PCS_NAD27_Kansas_North, 26777)
288 ValuePair(PCS_NAD27_Kansas_South, 26778)
289 ValuePair(PCS_NAD27_Kentucky_North, 26779)
290 ValuePair(PCS_NAD27_Kentucky_South, 26780)
291 ValuePair(PCS_NAD27_Louisiana_North, 26781)
292 ValuePair(PCS_NAD27_Louisiana_South, 26782)
293 ValuePair(PCS_NAD27_Maine_East, 26783)
294 ValuePair(PCS_NAD27_Maine_West, 26784)
295 ValuePair(PCS_NAD27_Maryland, 26785)
296 ValuePair(PCS_NAD27_Massachusetts, 26786)
297 ValuePair(PCS_NAD27_Massachusetts_Is, 26787)
298 ValuePair(PCS_NAD27_Michigan_North, 26788)
299 ValuePair(PCS_NAD27_Michigan_Central, 26789)
300 ValuePair(PCS_NAD27_Michigan_South, 26790)
301 ValuePair(PCS_NAD27_Minnesota_North, 26791)
302 ValuePair(PCS_NAD27_Minnesota_Cent, 26792)
303 ValuePair(PCS_NAD27_Minnesota_South, 26793)
304 ValuePair(PCS_NAD27_Mississippi_East, 26794)
305 ValuePair(PCS_NAD27_Mississippi_West, 26795)
306 ValuePair(PCS_NAD27_Missouri_East, 26796)
307 ValuePair(PCS_NAD27_Missouri_Central, 26797)
308 ValuePair(PCS_NAD27_Missouri_West, 26798)
309 ValuePair(PCS_NAD_Michigan_Michigan_East, 26801)
310 ValuePair(PCS_NAD_Michigan_Michigan_Old_Central, 26802)
311 ValuePair(PCS_NAD_Michigan_Michigan_West, 26803)
312 ValuePair(PCS_NAD83_UTM_zone_3N, 26903)
313 ValuePair(PCS_NAD83_UTM_zone_4N, 26904)
314 ValuePair(PCS_NAD83_UTM_zone_5N, 26905)
315 ValuePair(PCS_NAD83_UTM_zone_6N, 26906)
316 ValuePair(PCS_NAD83_UTM_zone_7N, 26907)
317 ValuePair(PCS_NAD83_UTM_zone_8N, 26908)
318 ValuePair(PCS_NAD83_UTM_zone_9N, 26909)
319 ValuePair(PCS_NAD83_UTM_zone_10N, 26910)
320 ValuePair(PCS_NAD83_UTM_zone_11N, 26911)
321 ValuePair(PCS_NAD83_UTM_zone_12N, 26912)
322 ValuePair(PCS_NAD83_UTM_zone_13N, 26913)
323 ValuePair(PCS_NAD83_UTM_zone_14N, 26914)
324 ValuePair(PCS_NAD83_UTM_zone_15N, 26915)
325 ValuePair(PCS_NAD83_UTM_zone_16N, 26916)
326 ValuePair(PCS_NAD83_UTM_zone_17N, 26917)
327 ValuePair(PCS_NAD83_UTM_zone_18N, 26918)
328 ValuePair(PCS_NAD83_UTM_zone_19N, 26919)
329 ValuePair(PCS_NAD83_UTM_zone_20N, 26920)
330 ValuePair(PCS_NAD83_UTM_zone_21N, 26921)
331 ValuePair(PCS_NAD83_UTM_zone_22N, 26922)
332 ValuePair(PCS_NAD83_UTM_zone_23N, 26923)
333 ValuePair(PCS_NAD83_Alabama_East, 26929)
334 ValuePair(PCS_NAD83_Alabama_West, 26930)
335 ValuePair(PCS_NAD83_Alaska_zone_1, 26931)
336 ValuePair(PCS_NAD83_Alaska_zone_2, 26932)
337 ValuePair(PCS_NAD83_Alaska_zone_3, 26933)
338 ValuePair(PCS_NAD83_Alaska_zone_4, 26934)
339 ValuePair(PCS_NAD83_Alaska_zone_5, 26935)
340 ValuePair(PCS_NAD83_Alaska_zone_6, 26936)
341 ValuePair(PCS_NAD83_Alaska_zone_7, 26937)
342 ValuePair(PCS_NAD83_Alaska_zone_8, 26938)
343 ValuePair(PCS_NAD83_Alaska_zone_9, 26939)
344 ValuePair(PCS_NAD83_Alaska_zone_10, 26940)
345 ValuePair(PCS_NAD83_California_1, 26941)
346 ValuePair(PCS_NAD83_California_2, 26942)
347 ValuePair(PCS_NAD83_California_3, 26943)
348 ValuePair(PCS_NAD83_California_4, 26944)
349 ValuePair(PCS_NAD83_California_5, 26945)
350 ValuePair(PCS_NAD83_California_6, 26946)
351 ValuePair(PCS_NAD83_Arizona_East, 26948)
352 ValuePair(PCS_NAD83_Arizona_Central, 26949)
353 ValuePair(PCS_NAD83_Arizona_West, 26950)
354 ValuePair(PCS_NAD83_Arkansas_North, 26951)
355 ValuePair(PCS_NAD83_Arkansas_South, 26952)
356 ValuePair(PCS_NAD83_Colorado_North, 26953)
357 ValuePair(PCS_NAD83_Colorado_Central, 26954)
358 ValuePair(PCS_NAD83_Colorado_South, 26955)
359 ValuePair(PCS_NAD83_Connecticut, 26956)
360 ValuePair(PCS_NAD83_Delaware, 26957)
361 ValuePair(PCS_NAD83_Florida_East, 26958)
362 ValuePair(PCS_NAD83_Florida_West, 26959)
363 ValuePair(PCS_NAD83_Florida_North, 26960)
364 ValuePair(PCS_NAD83_Hawaii_zone_1, 26961)
365 ValuePair(PCS_NAD83_Hawaii_zone_2, 26962)
366 ValuePair(PCS_NAD83_Hawaii_zone_3, 26963)
367 ValuePair(PCS_NAD83_Hawaii_zone_4, 26964)
368 ValuePair(PCS_NAD83_Hawaii_zone_5, 26965)
369 ValuePair(PCS_NAD83_Georgia_East, 26966)
370 ValuePair(PCS_NAD83_Georgia_West, 26967)
371 ValuePair(PCS_NAD83_Idaho_East, 26968)
372 ValuePair(PCS_NAD83_Idaho_Central, 26969)
373 ValuePair(PCS_NAD83_Idaho_West, 26970)
374 ValuePair(PCS_NAD83_Illinois_East, 26971)
375 ValuePair(PCS_NAD83_Illinois_West, 26972)
376 ValuePair(PCS_NAD83_Indiana_East, 26973)
377 ValuePair(PCS_NAD83_Indiana_West, 26974)
378 ValuePair(PCS_NAD83_Iowa_North, 26975)
379 ValuePair(PCS_NAD83_Iowa_South, 26976)
380 ValuePair(PCS_NAD83_Kansas_North, 26977)
381 ValuePair(PCS_NAD83_Kansas_South, 26978)
382 ValuePair(PCS_NAD83_Kentucky_North, 2205)
383 ValuePair(PCS_NAD83_Kentucky_South, 26980)
384 ValuePair(PCS_NAD83_Louisiana_North, 26981)
385 ValuePair(PCS_NAD83_Louisiana_South, 26982)
386 ValuePair(PCS_NAD83_Maine_East, 26983)
387 ValuePair(PCS_NAD83_Maine_West, 26984)
388 ValuePair(PCS_NAD83_Maryland, 26985)
389 ValuePair(PCS_NAD83_Massachusetts, 26986)
390 ValuePair(PCS_NAD83_Massachusetts_Is, 26987)
391 ValuePair(PCS_NAD83_Michigan_North, 26988)
392 ValuePair(PCS_NAD83_Michigan_Central, 26989)
393 ValuePair(PCS_NAD83_Michigan_South, 26990)
394 ValuePair(PCS_NAD83_Minnesota_North, 26991)
395 ValuePair(PCS_NAD83_Minnesota_Cent, 26992)
396 ValuePair(PCS_NAD83_Minnesota_South, 26993)
397 ValuePair(PCS_NAD83_Mississippi_East, 26994)
398 ValuePair(PCS_NAD83_Mississippi_West, 26995)
399 ValuePair(PCS_NAD83_Missouri_East, 26996)
400 ValuePair(PCS_NAD83_Missouri_Central, 26997)
401 ValuePair(PCS_NAD83_Missouri_West, 26998)
402 ValuePair(PCS_Nahrwan_1967_UTM_38N, 27038)
403 ValuePair(PCS_Nahrwan_1967_UTM_39N, 27039)
404 ValuePair(PCS_Nahrwan_1967_UTM_40N, 27040)
405 ValuePair(PCS_Naparima_UTM_20N, 27120)
406 ValuePair(PCS_GD49_NZ_Map_Grid, 27200)
407 ValuePair(PCS_GD49_North_Island_Grid, 27291)
408 ValuePair(PCS_GD49_South_Island_Grid, 27292)
409 ValuePair(PCS_Datum_73_UTM_zone_29N, 27429)
410 ValuePair(PCS_ATF_Nord_de_Guerre, 27500)
411 ValuePair(PCS_NTF_France_I, 27581)
412 ValuePair(PCS_NTF_France_II, 27582)
413 ValuePair(PCS_NTF_France_III, 27583)
414 ValuePair(PCS_NTF_Nord_France, 27591)
415 ValuePair(PCS_NTF_Centre_France, 27592)
416 ValuePair(PCS_NTF_Sud_France, 27593)
417 ValuePair(PCS_British_National_Grid, 27700)
418 ValuePair(PCS_Point_Noire_UTM_32S, 28232)
419 ValuePair(PCS_GDA94_MGA_zone_48, 28348)
420 ValuePair(PCS_GDA94_MGA_zone_49, 28349)
421 ValuePair(PCS_GDA94_MGA_zone_50, 28350)
422 ValuePair(PCS_GDA94_MGA_zone_51, 28351)
423 ValuePair(PCS_GDA94_MGA_zone_52, 28352)
424 ValuePair(PCS_GDA94_MGA_zone_53, 28353)
425 ValuePair(PCS_GDA94_MGA_zone_54, 28354)
426 ValuePair(PCS_GDA94_MGA_zone_55, 28355)
427 ValuePair(PCS_GDA94_MGA_zone_56, 28356)
428 ValuePair(PCS_GDA94_MGA_zone_57, 28357)
429 ValuePair(PCS_GDA94_MGA_zone_58, 28358)
430 ValuePair(PCS_Pulkovo_Gauss_zone_4, 28404)
431 ValuePair(PCS_Pulkovo_Gauss_zone_5, 28405)
432 ValuePair(PCS_Pulkovo_Gauss_zone_6, 28406)
433 ValuePair(PCS_Pulkovo_Gauss_zone_7, 28407)
434 ValuePair(PCS_Pulkovo_Gauss_zone_8, 28408)
435 ValuePair(PCS_Pulkovo_Gauss_zone_9, 28409)
436 ValuePair(PCS_Pulkovo_Gauss_zone_10, 28410)
437 ValuePair(PCS_Pulkovo_Gauss_zone_11, 28411)
438 ValuePair(PCS_Pulkovo_Gauss_zone_12, 28412)
439 ValuePair(PCS_Pulkovo_Gauss_zone_13, 28413)
440 ValuePair(PCS_Pulkovo_Gauss_zone_14, 28414)
441 ValuePair(PCS_Pulkovo_Gauss_zone_15, 28415)
442 ValuePair(PCS_Pulkovo_Gauss_zone_16, 28416)
443 ValuePair(PCS_Pulkovo_Gauss_zone_17, 28417)
444 ValuePair(PCS_Pulkovo_Gauss_zone_18, 28418)
445 ValuePair(PCS_Pulkovo_Gauss_zone_19, 28419)
446 ValuePair(PCS_Pulkovo_Gauss_zone_20, 28420)
447 ValuePair(PCS_Pulkovo_Gauss_zone_21, 28421)
448 ValuePair(PCS_Pulkovo_Gauss_zone_22, 28422)
449 ValuePair(PCS_Pulkovo_Gauss_zone_23, 28423)
450 ValuePair(PCS_Pulkovo_Gauss_zone_24, 28424)
451 ValuePair(PCS_Pulkovo_Gauss_zone_25, 28425)
452 ValuePair(PCS_Pulkovo_Gauss_zone_26, 28426)
453 ValuePair(PCS_Pulkovo_Gauss_zone_27, 28427)
454 ValuePair(PCS_Pulkovo_Gauss_zone_28, 28428)
455 ValuePair(PCS_Pulkovo_Gauss_zone_29, 28429)
456 ValuePair(PCS_Pulkovo_Gauss_zone_30, 28430)
457 ValuePair(PCS_Pulkovo_Gauss_zone_31, 28431)
458 ValuePair(PCS_Pulkovo_Gauss_zone_32, 28432)
459 ValuePair(PCS_Pulkovo_Gauss_4N, 28464)
460 ValuePair(PCS_Pulkovo_Gauss_5N, 28465)
461 ValuePair(PCS_Pulkovo_Gauss_6N, 28466)
462 ValuePair(PCS_Pulkovo_Gauss_7N, 28467)
463 ValuePair(PCS_Pulkovo_Gauss_8N, 28468)
464 ValuePair(PCS_Pulkovo_Gauss_9N, 28469)
465 ValuePair(PCS_Pulkovo_Gauss_10N, 28470)
466 ValuePair(PCS_Pulkovo_Gauss_11N, 28471)
467 ValuePair(PCS_Pulkovo_Gauss_12N, 28472)
468 ValuePair(PCS_Pulkovo_Gauss_13N, 28473)
469 ValuePair(PCS_Pulkovo_Gauss_14N, 28474)
470 ValuePair(PCS_Pulkovo_Gauss_15N, 28475)
471 ValuePair(PCS_Pulkovo_Gauss_16N, 28476)
472 ValuePair(PCS_Pulkovo_Gauss_17N, 28477)
473 ValuePair(PCS_Pulkovo_Gauss_18N, 28478)
474 ValuePair(PCS_Pulkovo_Gauss_19N, 28479)
475 ValuePair(PCS_Pulkovo_Gauss_20N, 28480)
476 ValuePair(PCS_Pulkovo_Gauss_21N, 28481)
477 ValuePair(PCS_Pulkovo_Gauss_22N, 28482)
478 ValuePair(PCS_Pulkovo_Gauss_23N, 28483)
479 ValuePair(PCS_Pulkovo_Gauss_24N, 28484)
480 ValuePair(PCS_Pulkovo_Gauss_25N, 28485)
481 ValuePair(PCS_Pulkovo_Gauss_26N, 28486)
482 ValuePair(PCS_Pulkovo_Gauss_27N, 28487)
483 ValuePair(PCS_Pulkovo_Gauss_28N, 28488)
484 ValuePair(PCS_Pulkovo_Gauss_29N, 28489)
485 ValuePair(PCS_Pulkovo_Gauss_30N, 28490)
486 ValuePair(PCS_Pulkovo_Gauss_31N, 28491)
487 ValuePair(PCS_Pulkovo_Gauss_32N, 28492)
488 ValuePair(PCS_Qatar_National_Grid, 28600)
489 ValuePair(PCS_RD_Netherlands_Old, 28991)
490 ValuePair(PCS_RD_Netherlands_New, 28992)
491 ValuePair(PCS_SAD69_UTM_zone_18N, 29118)
492 ValuePair(PCS_SAD69_UTM_zone_19N, 29119)
493 ValuePair(PCS_SAD69_UTM_zone_20N, 29120)
494 ValuePair(PCS_SAD69_UTM_zone_21N, 29121)
495 ValuePair(PCS_SAD69_UTM_zone_22N, 29122)
496 ValuePair(PCS_SAD69_UTM_zone_17S, 29177)
497 ValuePair(PCS_SAD69_UTM_zone_18S, 29178)
498 ValuePair(PCS_SAD69_UTM_zone_19S, 29179)
499 ValuePair(PCS_SAD69_UTM_zone_20S, 29180)
500 ValuePair(PCS_SAD69_UTM_zone_21S, 29181)
501 ValuePair(PCS_SAD69_UTM_zone_22S, 29182)
502 ValuePair(PCS_SAD69_UTM_zone_23S, 29183)
503 ValuePair(PCS_SAD69_UTM_zone_24S, 29184)
504 ValuePair(PCS_SAD69_UTM_zone_25S, 29185)
505 ValuePair(PCS_Sapper_Hill_UTM_20S, 29220)
506 ValuePair(PCS_Sapper_Hill_UTM_21S, 29221)
507 ValuePair(PCS_Schwarzeck_UTM_33S, 29333)
508 ValuePair(PCS_Sudan_UTM_zone_35N, 29635)
509 ValuePair(PCS_Sudan_UTM_zone_36N, 29636)
510 ValuePair(PCS_Tananarive_Laborde, 29700)
511 ValuePair(PCS_Tananarive_UTM_38S, 29738)
512 ValuePair(PCS_Tananarive_UTM_39S, 29739)
513 ValuePair(PCS_Timbalai_1948_Borneo, 29800)
514 ValuePair(PCS_Timbalai_1948_UTM_49N, 29849)
515 ValuePair(PCS_Timbalai_1948_UTM_50N, 29850)
516 ValuePair(PCS_TM65_Irish_Nat_Grid, 29900)
517 ValuePair(PCS_Trinidad_1903_Trinidad, 30200)
518 ValuePair(PCS_TC_1948_UTM_zone_39N, 30339)
519 ValuePair(PCS_TC_1948_UTM_zone_40N, 30340)
520 ValuePair(PCS_Voirol_N_Algerie_ancien, 30491)
521 ValuePair(PCS_Voirol_S_Algerie_ancien, 30492)
522 ValuePair(PCS_Voirol_Unifie_N_Algerie, 30591)
523 ValuePair(PCS_Voirol_Unifie_S_Algerie, 30592)
524 ValuePair(PCS_Bern_1938_Swiss_New, 30600)
525 ValuePair(PCS_Nord_Sahara_UTM_29N, 30729)
526 ValuePair(PCS_Nord_Sahara_UTM_30N, 30730)
527 ValuePair(PCS_Nord_Sahara_UTM_31N, 30731)
528 ValuePair(PCS_Nord_Sahara_UTM_32N, 30732)
529 ValuePair(PCS_Yoff_UTM_zone_28N, 31028)
530 ValuePair(PCS_Zanderij_UTM_zone_21N, 31121)
531 ValuePair(PCS_MGI_Austria_West, 31291)
532 ValuePair(PCS_MGI_Austria_Central, 31292)
533 ValuePair(PCS_MGI_Austria_East, 31293)
534 ValuePair(PCS_Belge_Lambert_72, 31300)
535 ValuePair(PCS_DHDN_Germany_zone_1, 31491)
536 ValuePair(PCS_DHDN_Germany_zone_2, 31492)
537 ValuePair(PCS_DHDN_Germany_zone_3, 31493)
538 ValuePair(PCS_DHDN_Germany_zone_4, 31494)
539 ValuePair(PCS_DHDN_Germany_zone_5, 31495)
540 ValuePair(PCS_NAD27_Montana_North, 32001)
541 ValuePair(PCS_NAD27_Montana_Central, 32002)
542 ValuePair(PCS_NAD27_Montana_South, 32003)
543 ValuePair(PCS_NAD27_Nebraska_North, 32005)
544 ValuePair(PCS_NAD27_Nebraska_South, 32006)
545 ValuePair(PCS_NAD27_Nevada_East, 32007)
546 ValuePair(PCS_NAD27_Nevada_Central, 32008)
547 ValuePair(PCS_NAD27_Nevada_West, 32009)
548 ValuePair(PCS_NAD27_New_Hampshire, 32010)
549 ValuePair(PCS_NAD27_New_Jersey, 32011)
550 ValuePair(PCS_NAD27_New_Mexico_East, 32012)
551 ValuePair(PCS_NAD27_New_Mexico_Cent, 32013)
552 ValuePair(PCS_NAD27_New_Mexico_West, 32014)
553 ValuePair(PCS_NAD27_New_York_East, 32015)
554 ValuePair(PCS_NAD27_New_York_Central, 32016)
555 ValuePair(PCS_NAD27_New_York_West, 32017)
556 ValuePair(PCS_NAD27_New_York_Long_Is, 32018)
557 ValuePair(PCS_NAD27_North_Carolina, 32019)
558 ValuePair(PCS_NAD27_North_Dakota_N, 32020)
559 ValuePair(PCS_NAD27_North_Dakota_S, 32021)
560 ValuePair(PCS_NAD27_Ohio_North, 32022)
561 ValuePair(PCS_NAD27_Ohio_South, 32023)
562 ValuePair(PCS_NAD27_Oklahoma_North, 32024)
563 ValuePair(PCS_NAD27_Oklahoma_South, 32025)
564 ValuePair(PCS_NAD27_Oregon_North, 32026)
565 ValuePair(PCS_NAD27_Oregon_South, 32027)
566 ValuePair(PCS_NAD27_Pennsylvania_N, 32028)
567 ValuePair(PCS_NAD27_Pennsylvania_S, 32029)
568 ValuePair(PCS_NAD27_Rhode_Island, 32030)
569 ValuePair(PCS_NAD27_South_Carolina_N, 32031)
570 ValuePair(PCS_NAD27_South_Carolina_S, 32033)
571 ValuePair(PCS_NAD27_South_Dakota_N, 32034)
572 ValuePair(PCS_NAD27_South_Dakota_S, 32035)
573 ValuePair(PCS_NAD27_Tennessee, 2204)
574 ValuePair(PCS_NAD27_Texas_North, 32037)
575 ValuePair(PCS_NAD27_Texas_North_Cen, 32038)
576 ValuePair(PCS_NAD27_Texas_Central, 32039)
577 ValuePair(PCS_NAD27_Texas_South_Cen, 32040)
578 ValuePair(PCS_NAD27_Texas_South, 32041)
579 ValuePair(PCS_NAD27_Utah_North, 32042)
580 ValuePair(PCS_NAD27_Utah_Central, 32043)
581 ValuePair(PCS_NAD27_Utah_South, 32044)
582 ValuePair(PCS_NAD27_Vermont, 32045)
583 ValuePair(PCS_NAD27_Virginia_North, 32046)
584 ValuePair(PCS_NAD27_Virginia_South, 32047)
585 ValuePair(PCS_NAD27_Washington_North, 32048)
586 ValuePair(PCS_NAD27_Washington_South, 32049)
587 ValuePair(PCS_NAD27_West_Virginia_N, 32050)
588 ValuePair(PCS_NAD27_West_Virginia_S, 32051)
589 ValuePair(PCS_NAD27_Wisconsin_North, 32052)
590 ValuePair(PCS_NAD27_Wisconsin_Cen, 32053)
591 ValuePair(PCS_NAD27_Wisconsin_South, 32054)
592 ValuePair(PCS_NAD27_Wyoming_East, 32055)
593 ValuePair(PCS_NAD27_Wyoming_E_Cen, 32056)
594 ValuePair(PCS_NAD27_Wyoming_W_Cen, 32057)
595 ValuePair(PCS_NAD27_Wyoming_West, 32058)
596 ValuePair(PCS_NAD27_Puerto_Rico, 32059)
597 ValuePair(PCS_NAD27_St_Croix, 32060)
598 ValuePair(PCS_NAD83_Montana, 32100)
599 ValuePair(PCS_NAD83_Nebraska, 32104)
600 ValuePair(PCS_NAD83_Nevada_East, 32107)
601 ValuePair(PCS_NAD83_Nevada_Central, 32108)
602 ValuePair(PCS_NAD83_Nevada_West, 32109)
603 ValuePair(PCS_NAD83_New_Hampshire, 32110)
604 ValuePair(PCS_NAD83_New_Jersey, 32111)
605 ValuePair(PCS_NAD83_New_Mexico_East, 32112)
606 ValuePair(PCS_NAD83_New_Mexico_Cent, 32113)
607 ValuePair(PCS_NAD83_New_Mexico_West, 32114)
608 ValuePair(PCS_NAD83_New_York_East, 32115)
609 ValuePair(PCS_NAD83_New_York_Central, 32116)
610 ValuePair(PCS_NAD83_New_York_West, 32117)
611 ValuePair(PCS_NAD83_New_York_Long_Is, 32118)
612 ValuePair(PCS_NAD83_North_Carolina, 32119)
613 ValuePair(PCS_NAD83_North_Dakota_N, 32120)
614 ValuePair(PCS_NAD83_North_Dakota_S, 32121)
615 ValuePair(PCS_NAD83_Ohio_North, 32122)
616 ValuePair(PCS_NAD83_Ohio_South, 32123)
617 ValuePair(PCS_NAD83_Oklahoma_North, 32124)
618 ValuePair(PCS_NAD83_Oklahoma_South, 32125)
619 ValuePair(PCS_NAD83_Oregon_North, 32126)
620 ValuePair(PCS_NAD83_Oregon_South, 32127)
621 ValuePair(PCS_NAD83_Pennsylvania_N, 32128)
622 ValuePair(PCS_NAD83_Pennsylvania_S, 32129)
623 ValuePair(PCS_NAD83_Rhode_Island, 32130)
624 ValuePair(PCS_NAD83_South_Carolina, 32133)
625 ValuePair(PCS_NAD83_South_Dakota_N, 32134)
626 ValuePair(PCS_NAD83_South_Dakota_S, 32135)
627 ValuePair(PCS_NAD83_Tennessee, 32136)
628 ValuePair(PCS_NAD83_Texas_North, 32137)
629 ValuePair(PCS_NAD83_Texas_North_Cen, 32138)
630 ValuePair(PCS_NAD83_Texas_Central, 32139)
631 ValuePair(PCS_NAD83_Texas_South_Cen, 32140)
632 ValuePair(PCS_NAD83_Texas_South, 32141)
633 ValuePair(PCS_NAD83_Utah_North, 32142)
634 ValuePair(PCS_NAD83_Utah_Central, 32143)
635 ValuePair(PCS_NAD83_Utah_South, 32144)
636 ValuePair(PCS_NAD83_Vermont, 32145)
637 ValuePair(PCS_NAD83_Virginia_North, 32146)
638 ValuePair(PCS_NAD83_Virginia_South, 32147)
639 ValuePair(PCS_NAD83_Washington_North, 32148)
640 ValuePair(PCS_NAD83_Washington_South, 32149)
641 ValuePair(PCS_NAD83_West_Virginia_N, 32150)
642 ValuePair(PCS_NAD83_West_Virginia_S, 32151)
643 ValuePair(PCS_NAD83_Wisconsin_North, 32152)
644 ValuePair(PCS_NAD83_Wisconsin_Cen, 32153)
645 ValuePair(PCS_NAD83_Wisconsin_South, 32154)
646 ValuePair(PCS_NAD83_Wyoming_East, 32155)
647 ValuePair(PCS_NAD83_Wyoming_E_Cen, 32156)
648 ValuePair(PCS_NAD83_Wyoming_W_Cen, 32157)
649 ValuePair(PCS_NAD83_Wyoming_West, 32158)
650 ValuePair(PCS_NAD83_Puerto_Rico_Virgin_Is, 32161)
651 ValuePair(PCS_WGS72_UTM_zone_1N, 32201)
652 ValuePair(PCS_WGS72_UTM_zone_2N, 32202)
653 ValuePair(PCS_WGS72_UTM_zone_3N, 32203)
654 ValuePair(PCS_WGS72_UTM_zone_4N, 32204)
655 ValuePair(PCS_WGS72_UTM_zone_5N, 32205)
656 ValuePair(PCS_WGS72_UTM_zone_6N, 32206)
657 ValuePair(PCS_WGS72_UTM_zone_7N, 32207)
658 ValuePair(PCS_WGS72_UTM_zone_8N, 32208)
659 ValuePair(PCS_WGS72_UTM_zone_9N, 32209)
660 ValuePair(PCS_WGS72_UTM_zone_10N, 32210)
661 ValuePair(PCS_WGS72_UTM_zone_11N, 32211)
662 ValuePair(PCS_WGS72_UTM_zone_12N, 32212)
663 ValuePair(PCS_WGS72_UTM_zone_13N, 32213)
664 ValuePair(PCS_WGS72_UTM_zone_14N, 32214)
665 ValuePair(PCS_WGS72_UTM_zone_15N, 32215)
666 ValuePair(PCS_WGS72_UTM_zone_16N, 32216)
667 ValuePair(PCS_WGS72_UTM_zone_17N, 32217)
668 ValuePair(PCS_WGS72_UTM_zone_18N, 32218)
669 ValuePair(PCS_WGS72_UTM_zone_19N, 32219)
670 ValuePair(PCS_WGS72_UTM_zone_20N, 32220)
671 ValuePair(PCS_WGS72_UTM_zone_21N, 32221)
672 ValuePair(PCS_WGS72_UTM_zone_22N, 32222)
673 ValuePair(PCS_WGS72_UTM_zone_23N, 32223)
674 ValuePair(PCS_WGS72_UTM_zone_24N, 32224)
675 ValuePair(PCS_WGS72_UTM_zone_25N, 32225)
676 ValuePair(PCS_WGS72_UTM_zone_26N, 32226)
677 ValuePair(PCS_WGS72_UTM_zone_27N, 32227)
678 ValuePair(PCS_WGS72_UTM_zone_28N, 32228)
679 ValuePair(PCS_WGS72_UTM_zone_29N, 32229)
680 ValuePair(PCS_WGS72_UTM_zone_30N, 32230)
681 ValuePair(PCS_WGS72_UTM_zone_31N, 32231)
682 ValuePair(PCS_WGS72_UTM_zone_32N, 32232)
683 ValuePair(PCS_WGS72_UTM_zone_33N, 32233)
684 ValuePair(PCS_WGS72_UTM_zone_34N, 32234)
685 ValuePair(PCS_WGS72_UTM_zone_35N, 32235)
686 ValuePair(PCS_WGS72_UTM_zone_36N, 32236)
687 ValuePair(PCS_WGS72_UTM_zone_37N, 32237)
688 ValuePair(PCS_WGS72_UTM_zone_38N, 32238)
689 ValuePair(PCS_WGS72_UTM_zone_39N, 32239)
690 ValuePair(PCS_WGS72_UTM_zone_40N, 32240)
691 ValuePair(PCS_WGS72_UTM_zone_41N, 32241)
692 ValuePair(PCS_WGS72_UTM_zone_42N, 32242)
693 ValuePair(PCS_WGS72_UTM_zone_43N, 32243)
694 ValuePair(PCS_WGS72_UTM_zone_44N, 32244)
695 ValuePair(PCS_WGS72_UTM_zone_45N, 32245)
696 ValuePair(PCS_WGS72_UTM_zone_46N, 32246)
697 ValuePair(PCS_WGS72_UTM_zone_47N, 32247)
698 ValuePair(PCS_WGS72_UTM_zone_48N, 32248)
699 ValuePair(PCS_WGS72_UTM_zone_49N, 32249)
700 ValuePair(PCS_WGS72_UTM_zone_50N, 32250)
701 ValuePair(PCS_WGS72_UTM_zone_51N, 32251)
702 ValuePair(PCS_WGS72_UTM_zone_52N, 32252)
703 ValuePair(PCS_WGS72_UTM_zone_53N, 32253)
704 ValuePair(PCS_WGS72_UTM_zone_54N, 32254)
705 ValuePair(PCS_WGS72_UTM_zone_55N, 32255)
706 ValuePair(PCS_WGS72_UTM_zone_56N, 32256)
707 ValuePair(PCS_WGS72_UTM_zone_57N, 32257)
708 ValuePair(PCS_WGS72_UTM_zone_58N, 32258)
709 ValuePair(PCS_WGS72_UTM_zone_59N, 32259)
710 ValuePair(PCS_WGS72_UTM_zone_60N, 32260)
711 ValuePair(PCS_WGS72_UTM_zone_1S, 32301)
712 ValuePair(PCS_WGS72_UTM_zone_2S, 32302)
713 ValuePair(PCS_WGS72_UTM_zone_3S, 32303)
714 ValuePair(PCS_WGS72_UTM_zone_4S, 32304)
715 ValuePair(PCS_WGS72_UTM_zone_5S, 32305)
716 ValuePair(PCS_WGS72_UTM_zone_6S, 32306)
717 ValuePair(PCS_WGS72_UTM_zone_7S, 32307)
718 ValuePair(PCS_WGS72_UTM_zone_8S, 32308)
719 ValuePair(PCS_WGS72_UTM_zone_9S, 32309)
720 ValuePair(PCS_WGS72_UTM_zone_10S, 32310)
721 ValuePair(PCS_WGS72_UTM_zone_11S, 32311)
722 ValuePair(PCS_WGS72_UTM_zone_12S, 32312)
723 ValuePair(PCS_WGS72_UTM_zone_13S, 32313)
724 ValuePair(PCS_WGS72_UTM_zone_14S, 32314)
725 ValuePair(PCS_WGS72_UTM_zone_15S, 32315)
726 ValuePair(PCS_WGS72_UTM_zone_16S, 32316)
727 ValuePair(PCS_WGS72_UTM_zone_17S, 32317)
728 ValuePair(PCS_WGS72_UTM_zone_18S, 32318)
729 ValuePair(PCS_WGS72_UTM_zone_19S, 32319)
730 ValuePair(PCS_WGS72_UTM_zone_20S, 32320)
731 ValuePair(PCS_WGS72_UTM_zone_21S, 32321)
732 ValuePair(PCS_WGS72_UTM_zone_22S, 32322)
733 ValuePair(PCS_WGS72_UTM_zone_23S, 32323)
734 ValuePair(PCS_WGS72_UTM_zone_24S, 32324)
735 ValuePair(PCS_WGS72_UTM_zone_25S, 32325)
736 ValuePair(PCS_WGS72_UTM_zone_26S, 32326)
737 ValuePair(PCS_WGS72_UTM_zone_27S, 32327)
738 ValuePair(PCS_WGS72_UTM_zone_28S, 32328)
739 ValuePair(PCS_WGS72_UTM_zone_29S, 32329)
740 ValuePair(PCS_WGS72_UTM_zone_30S, 32330)
741 ValuePair(PCS_WGS72_UTM_zone_31S, 32331)
742 ValuePair(PCS_WGS72_UTM_zone_32S, 32332)
743 ValuePair(PCS_WGS72_UTM_zone_33S, 32333)
744 ValuePair(PCS_WGS72_UTM_zone_34S, 32334)
745 ValuePair(PCS_WGS72_UTM_zone_35S, 32335)
746 ValuePair(PCS_WGS72_UTM_zone_36S, 32336)
747 ValuePair(PCS_WGS72_UTM_zone_37S, 32337)
748 ValuePair(PCS_WGS72_UTM_zone_38S, 32338)
749 ValuePair(PCS_WGS72_UTM_zone_39S, 32339)
750 ValuePair(PCS_WGS72_UTM_zone_40S, 32340)
751 ValuePair(PCS_WGS72_UTM_zone_41S, 32341)
752 ValuePair(PCS_WGS72_UTM_zone_42S, 32342)
753 ValuePair(PCS_WGS72_UTM_zone_43S, 32343)
754 ValuePair(PCS_WGS72_UTM_zone_44S, 32344)
755 ValuePair(PCS_WGS72_UTM_zone_45S, 32345)
756 ValuePair(PCS_WGS72_UTM_zone_46S, 32346)
757 ValuePair(PCS_WGS72_UTM_zone_47S, 32347)
758 ValuePair(PCS_WGS72_UTM_zone_48S, 32348)
759 ValuePair(PCS_WGS72_UTM_zone_49S, 32349)
760 ValuePair(PCS_WGS72_UTM_zone_50S, 32350)
761 ValuePair(PCS_WGS72_UTM_zone_51S, 32351)
762 ValuePair(PCS_WGS72_UTM_zone_52S, 32352)
763 ValuePair(PCS_WGS72_UTM_zone_53S, 32353)
764 ValuePair(PCS_WGS72_UTM_zone_54S, 32354)
765 ValuePair(PCS_WGS72_UTM_zone_55S, 32355)
766 ValuePair(PCS_WGS72_UTM_zone_56S, 32356)
767 ValuePair(PCS_WGS72_UTM_zone_57S, 32357)
768 ValuePair(PCS_WGS72_UTM_zone_58S, 32358)
769 ValuePair(PCS_WGS72_UTM_zone_59S, 32359)
770 ValuePair(PCS_WGS72_UTM_zone_60S, 32360)
771 ValuePair(PCS_WGS72BE_UTM_zone_1N, 32401)
772 ValuePair(PCS_WGS72BE_UTM_zone_2N, 32402)
773 ValuePair(PCS_WGS72BE_UTM_zone_3N, 32403)
774 ValuePair(PCS_WGS72BE_UTM_zone_4N, 32404)
775 ValuePair(PCS_WGS72BE_UTM_zone_5N, 32405)
776 ValuePair(PCS_WGS72BE_UTM_zone_6N, 32406)
777 ValuePair(PCS_WGS72BE_UTM_zone_7N, 32407)
778 ValuePair(PCS_WGS72BE_UTM_zone_8N, 32408)
779 ValuePair(PCS_WGS72BE_UTM_zone_9N, 32409)
780 ValuePair(PCS_WGS72BE_UTM_zone_10N, 32410)
781 ValuePair(PCS_WGS72BE_UTM_zone_11N, 32411)
782 ValuePair(PCS_WGS72BE_UTM_zone_12N, 32412)
783 ValuePair(PCS_WGS72BE_UTM_zone_13N, 32413)
784 ValuePair(PCS_WGS72BE_UTM_zone_14N, 32414)
785 ValuePair(PCS_WGS72BE_UTM_zone_15N, 32415)
786 ValuePair(PCS_WGS72BE_UTM_zone_16N, 32416)
787 ValuePair(PCS_WGS72BE_UTM_zone_17N, 32417)
788 ValuePair(PCS_WGS72BE_UTM_zone_18N, 32418)
789 ValuePair(PCS_WGS72BE_UTM_zone_19N, 32419)
790 ValuePair(PCS_WGS72BE_UTM_zone_20N, 32420)
791 ValuePair(PCS_WGS72BE_UTM_zone_21N, 32421)
792 ValuePair(PCS_WGS72BE_UTM_zone_22N, 32422)
793 ValuePair(PCS_WGS72BE_UTM_zone_23N, 32423)
794 ValuePair(PCS_WGS72BE_UTM_zone_24N, 32424)
795 ValuePair(PCS_WGS72BE_UTM_zone_25N, 32425)
796 ValuePair(PCS_WGS72BE_UTM_zone_26N, 32426)
797 ValuePair(PCS_WGS72BE_UTM_zone_27N, 32427)
798 ValuePair(PCS_WGS72BE_UTM_zone_28N, 32428)
799 ValuePair(PCS_WGS72BE_UTM_zone_29N, 32429)
800 ValuePair(PCS_WGS72BE_UTM_zone_30N, 32430)
801 ValuePair(PCS_WGS72BE_UTM_zone_31N, 32431)
802 ValuePair(PCS_WGS72BE_UTM_zone_32N, 32432)
803 ValuePair(PCS_WGS72BE_UTM_zone_33N, 32433)
804 ValuePair(PCS_WGS72BE_UTM_zone_34N, 32434)
805 ValuePair(PCS_WGS72BE_UTM_zone_35N, 32435)
806 ValuePair(PCS_WGS72BE_UTM_zone_36N, 32436)
807 ValuePair(PCS_WGS72BE_UTM_zone_37N, 32437)
808 ValuePair(PCS_WGS72BE_UTM_zone_38N, 32438)
809 ValuePair(PCS_WGS72BE_UTM_zone_39N, 32439)
810 ValuePair(PCS_WGS72BE_UTM_zone_40N, 32440)
811 ValuePair(PCS_WGS72BE_UTM_zone_41N, 32441)
812 ValuePair(PCS_WGS72BE_UTM_zone_42N, 32442)
813 ValuePair(PCS_WGS72BE_UTM_zone_43N, 32443)
814 ValuePair(PCS_WGS72BE_UTM_zone_44N, 32444)
815 ValuePair(PCS_WGS72BE_UTM_zone_45N, 32445)
816 ValuePair(PCS_WGS72BE_UTM_zone_46N, 32446)
817 ValuePair(PCS_WGS72BE_UTM_zone_47N, 32447)
818 ValuePair(PCS_WGS72BE_UTM_zone_48N, 32448)
819 ValuePair(PCS_WGS72BE_UTM_zone_49N, 32449)
820 ValuePair(PCS_WGS72BE_UTM_zone_50N, 32450)
821 ValuePair(PCS_WGS72BE_UTM_zone_51N, 32451)
822 ValuePair(PCS_WGS72BE_UTM_zone_52N, 32452)
823 ValuePair(PCS_WGS72BE_UTM_zone_53N, 32453)
824 ValuePair(PCS_WGS72BE_UTM_zone_54N, 32454)
825 ValuePair(PCS_WGS72BE_UTM_zone_55N, 32455)
826 ValuePair(PCS_WGS72BE_UTM_zone_56N, 32456)
827 ValuePair(PCS_WGS72BE_UTM_zone_57N, 32457)
828 ValuePair(PCS_WGS72BE_UTM_zone_58N, 32458)
829 ValuePair(PCS_WGS72BE_UTM_zone_59N, 32459)
830 ValuePair(PCS_WGS72BE_UTM_zone_60N, 32460)
831 ValuePair(PCS_WGS72BE_UTM_zone_1S, 32501)
832 ValuePair(PCS_WGS72BE_UTM_zone_2S, 32502)
833 ValuePair(PCS_WGS72BE_UTM_zone_3S, 32503)
834 ValuePair(PCS_WGS72BE_UTM_zone_4S, 32504)
835 ValuePair(PCS_WGS72BE_UTM_zone_5S, 32505)
836 ValuePair(PCS_WGS72BE_UTM_zone_6S, 32506)
837 ValuePair(PCS_WGS72BE_UTM_zone_7S, 32507)
838 ValuePair(PCS_WGS72BE_UTM_zone_8S, 32508)
839 ValuePair(PCS_WGS72BE_UTM_zone_9S, 32509)
840 ValuePair(PCS_WGS72BE_UTM_zone_10S, 32510)
841 ValuePair(PCS_WGS72BE_UTM_zone_11S, 32511)
842 ValuePair(PCS_WGS72BE_UTM_zone_12S, 32512)
843 ValuePair(PCS_WGS72BE_UTM_zone_13S, 32513)
844 ValuePair(PCS_WGS72BE_UTM_zone_14S, 32514)
845 ValuePair(PCS_WGS72BE_UTM_zone_15S, 32515)
846 ValuePair(PCS_WGS72BE_UTM_zone_16S, 32516)
847 ValuePair(PCS_WGS72BE_UTM_zone_17S, 32517)
848 ValuePair(PCS_WGS72BE_UTM_zone_18S, 32518)
849 ValuePair(PCS_WGS72BE_UTM_zone_19S, 32519)
850 ValuePair(PCS_WGS72BE_UTM_zone_20S, 32520)
851 ValuePair(PCS_WGS72BE_UTM_zone_21S, 32521)
852 ValuePair(PCS_WGS72BE_UTM_zone_22S, 32522)
853 ValuePair(PCS_WGS72BE_UTM_zone_23S, 32523)
854 ValuePair(PCS_WGS72BE_UTM_zone_24S, 32524)
855 ValuePair(PCS_WGS72BE_UTM_zone_25S, 32525)
856 ValuePair(PCS_WGS72BE_UTM_zone_26S, 32526)
857 ValuePair(PCS_WGS72BE_UTM_zone_27S, 32527)
858 ValuePair(PCS_WGS72BE_UTM_zone_28S, 32528)
859 ValuePair(PCS_WGS72BE_UTM_zone_29S, 32529)
860 ValuePair(PCS_WGS72BE_UTM_zone_30S, 32530)
861 ValuePair(PCS_WGS72BE_UTM_zone_31S, 32531)
862 ValuePair(PCS_WGS72BE_UTM_zone_32S, 32532)
863 ValuePair(PCS_WGS72BE_UTM_zone_33S, 32533)
864 ValuePair(PCS_WGS72BE_UTM_zone_34S, 32534)
865 ValuePair(PCS_WGS72BE_UTM_zone_35S, 32535)
866 ValuePair(PCS_WGS72BE_UTM_zone_36S, 32536)
867 ValuePair(PCS_WGS72BE_UTM_zone_37S, 32537)
868 ValuePair(PCS_WGS72BE_UTM_zone_38S, 32538)
869 ValuePair(PCS_WGS72BE_UTM_zone_39S, 32539)
870 ValuePair(PCS_WGS72BE_UTM_zone_40S, 32540)
871 ValuePair(PCS_WGS72BE_UTM_zone_41S, 32541)
872 ValuePair(PCS_WGS72BE_UTM_zone_42S, 32542)
873 ValuePair(PCS_WGS72BE_UTM_zone_43S, 32543)
874 ValuePair(PCS_WGS72BE_UTM_zone_44S, 32544)
875 ValuePair(PCS_WGS72BE_UTM_zone_45S, 32545)
876 ValuePair(PCS_WGS72BE_UTM_zone_46S, 32546)
877 ValuePair(PCS_WGS72BE_UTM_zone_47S, 32547)
878 ValuePair(PCS_WGS72BE_UTM_zone_48S, 32548)
879 ValuePair(PCS_WGS72BE_UTM_zone_49S, 32549)
880 ValuePair(PCS_WGS72BE_UTM_zone_50S, 32550)
881 ValuePair(PCS_WGS72BE_UTM_zone_51S, 32551)
882 ValuePair(PCS_WGS72BE_UTM_zone_52S, 32552)
883 ValuePair(PCS_WGS72BE_UTM_zone_53S, 32553)
884 ValuePair(PCS_WGS72BE_UTM_zone_54S, 32554)
885 ValuePair(PCS_WGS72BE_UTM_zone_55S, 32555)
886 ValuePair(PCS_WGS72BE_UTM_zone_56S, 32556)
887 ValuePair(PCS_WGS72BE_UTM_zone_57S, 32557)
888 ValuePair(PCS_WGS72BE_UTM_zone_58S, 32558)
889 ValuePair(PCS_WGS72BE_UTM_zone_59S, 32559)
890 ValuePair(PCS_WGS72BE_UTM_zone_60S, 32560)
891 ValuePair(PCS_WGS84_UTM_zone_1N, 32601)
892 ValuePair(PCS_WGS84_UTM_zone_2N, 32602)
893 ValuePair(PCS_WGS84_UTM_zone_3N, 32603)
894 ValuePair(PCS_WGS84_UTM_zone_4N, 32604)
895 ValuePair(PCS_WGS84_UTM_zone_5N, 32605)
896 ValuePair(PCS_WGS84_UTM_zone_6N, 32606)
897 ValuePair(PCS_WGS84_UTM_zone_7N, 32607)
898 ValuePair(PCS_WGS84_UTM_zone_8N, 32608)
899 ValuePair(PCS_WGS84_UTM_zone_9N, 32609)
900 ValuePair(PCS_WGS84_UTM_zone_10N, 32610)
901 ValuePair(PCS_WGS84_UTM_zone_11N, 32611)
902 ValuePair(PCS_WGS84_UTM_zone_12N, 32612)
903 ValuePair(PCS_WGS84_UTM_zone_13N, 32613)
904 ValuePair(PCS_WGS84_UTM_zone_14N, 32614)
905 ValuePair(PCS_WGS84_UTM_zone_15N, 32615)
906 ValuePair(PCS_WGS84_UTM_zone_16N, 32616)
907 ValuePair(PCS_WGS84_UTM_zone_17N, 32617)
908 ValuePair(PCS_WGS84_UTM_zone_18N, 32618)
909 ValuePair(PCS_WGS84_UTM_zone_19N, 32619)
910 ValuePair(PCS_WGS84_UTM_zone_20N, 32620)
911 ValuePair(PCS_WGS84_UTM_zone_21N, 32621)
912 ValuePair(PCS_WGS84_UTM_zone_22N, 32622)
913 ValuePair(PCS_WGS84_UTM_zone_23N, 32623)
914 ValuePair(PCS_WGS84_UTM_zone_24N, 32624)
915 ValuePair(PCS_WGS84_UTM_zone_25N, 32625)
916 ValuePair(PCS_WGS84_UTM_zone_26N, 32626)
917 ValuePair(PCS_WGS84_UTM_zone_27N, 32627)
918 ValuePair(PCS_WGS84_UTM_zone_28N, 32628)
919 ValuePair(PCS_WGS84_UTM_zone_29N, 32629)
920 ValuePair(PCS_WGS84_UTM_zone_30N, 32630)
921 ValuePair(PCS_WGS84_UTM_zone_31N, 32631)
922 ValuePair(PCS_WGS84_UTM_zone_32N, 32632)
923 ValuePair(PCS_WGS84_UTM_zone_33N, 32633)
924 ValuePair(PCS_WGS84_UTM_zone_34N, 32634)
925 ValuePair(PCS_WGS84_UTM_zone_35N, 32635)
926 ValuePair(PCS_WGS84_UTM_zone_36N, 32636)
927 ValuePair(PCS_WGS84_UTM_zone_37N, 32637)
928 ValuePair(PCS_WGS84_UTM_zone_38N, 32638)
929 ValuePair(PCS_WGS84_UTM_zone_39N, 32639)
930 ValuePair(PCS_WGS84_UTM_zone_40N, 32640)
931 ValuePair(PCS_WGS84_UTM_zone_41N, 32641)
932 ValuePair(PCS_WGS84_UTM_zone_42N, 32642)
933 ValuePair(PCS_WGS84_UTM_zone_43N, 32643)
934 ValuePair(PCS_WGS84_UTM_zone_44N, 32644)
935 ValuePair(PCS_WGS84_UTM_zone_45N, 32645)
936 ValuePair(PCS_WGS84_UTM_zone_46N, 32646)
937 ValuePair(PCS_WGS84_UTM_zone_47N, 32647)
938 ValuePair(PCS_WGS84_UTM_zone_48N, 32648)
939 ValuePair(PCS_WGS84_UTM_zone_49N, 32649)
940 ValuePair(PCS_WGS84_UTM_zone_50N, 32650)
941 ValuePair(PCS_WGS84_UTM_zone_51N, 32651)
942 ValuePair(PCS_WGS84_UTM_zone_52N, 32652)
943 ValuePair(PCS_WGS84_UTM_zone_53N, 32653)
944 ValuePair(PCS_WGS84_UTM_zone_54N, 32654)
945 ValuePair(PCS_WGS84_UTM_zone_55N, 32655)
946 ValuePair(PCS_WGS84_UTM_zone_56N, 32656)
947 ValuePair(PCS_WGS84_UTM_zone_57N, 32657)
948 ValuePair(PCS_WGS84_UTM_zone_58N, 32658)
949 ValuePair(PCS_WGS84_UTM_zone_59N, 32659)
950 ValuePair(PCS_WGS84_UTM_zone_60N, 32660)
951 ValuePair(PCS_WGS84_UTM_zone_1S, 32701)
952 ValuePair(PCS_WGS84_UTM_zone_2S, 32702)
953 ValuePair(PCS_WGS84_UTM_zone_3S, 32703)
954 ValuePair(PCS_WGS84_UTM_zone_4S, 32704)
955 ValuePair(PCS_WGS84_UTM_zone_5S, 32705)
956 ValuePair(PCS_WGS84_UTM_zone_6S, 32706)
957 ValuePair(PCS_WGS84_UTM_zone_7S, 32707)
958 ValuePair(PCS_WGS84_UTM_zone_8S, 32708)
959 ValuePair(PCS_WGS84_UTM_zone_9S, 32709)
960 ValuePair(PCS_WGS84_UTM_zone_10S, 32710)
961 ValuePair(PCS_WGS84_UTM_zone_11S, 32711)
962 ValuePair(PCS_WGS84_UTM_zone_12S, 32712)
963 ValuePair(PCS_WGS84_UTM_zone_13S, 32713)
964 ValuePair(PCS_WGS84_UTM_zone_14S, 32714)
965 ValuePair(PCS_WGS84_UTM_zone_15S, 32715)
966 ValuePair(PCS_WGS84_UTM_zone_16S, 32716)
967 ValuePair(PCS_WGS84_UTM_zone_17S, 32717)
968 ValuePair(PCS_WGS84_UTM_zone_18S, 32718)
969 ValuePair(PCS_WGS84_UTM_zone_19S, 32719)
970 ValuePair(PCS_WGS84_UTM_zone_20S, 32720)
971 ValuePair(PCS_WGS84_UTM_zone_21S, 32721)
972 ValuePair(PCS_WGS84_UTM_zone_22S, 32722)
973 ValuePair(PCS_WGS84_UTM_zone_23S, 32723)
974 ValuePair(PCS_WGS84_UTM_zone_24S, 32724)
975 ValuePair(PCS_WGS84_UTM_zone_25S, 32725)
976 ValuePair(PCS_WGS84_UTM_zone_26S, 32726)
977 ValuePair(PCS_WGS84_UTM_zone_27S, 32727)
978 ValuePair(PCS_WGS84_UTM_zone_28S, 32728)
979 ValuePair(PCS_WGS84_UTM_zone_29S, 32729)
980 ValuePair(PCS_WGS84_UTM_zone_30S, 32730)
981 ValuePair(PCS_WGS84_UTM_zone_31S, 32731)
982 ValuePair(PCS_WGS84_UTM_zone_32S, 32732)
983 ValuePair(PCS_WGS84_UTM_zone_33S, 32733)
984 ValuePair(PCS_WGS84_UTM_zone_34S, 32734)
985 ValuePair(PCS_WGS84_UTM_zone_35S, 32735)
986 ValuePair(PCS_WGS84_UTM_zone_36S, 32736)
987 ValuePair(PCS_WGS84_UTM_zone_37S, 32737)
988 ValuePair(PCS_WGS84_UTM_zone_38S, 32738)
989 ValuePair(PCS_WGS84_UTM_zone_39S, 32739)
990 ValuePair(PCS_WGS84_UTM_zone_40S, 32740)
991 ValuePair(PCS_WGS84_UTM_zone_41S, 32741)
992 ValuePair(PCS_WGS84_UTM_zone_42S, 32742)
993 ValuePair(PCS_WGS84_UTM_zone_43S, 32743)
994 ValuePair(PCS_WGS84_UTM_zone_44S, 32744)
995 ValuePair(PCS_WGS84_UTM_zone_45S, 32745)
996 ValuePair(PCS_WGS84_UTM_zone_46S, 32746)
997 ValuePair(PCS_WGS84_UTM_zone_47S, 32747)
998 ValuePair(PCS_WGS84_UTM_zone_48S, 32748)
999 ValuePair(PCS_WGS84_UTM_zone_49S, 32749)
1000 ValuePair(PCS_WGS84_UTM_zone_50S, 32750)
1001 ValuePair(PCS_WGS84_UTM_zone_51S, 32751)
1002 ValuePair(PCS_WGS84_UTM_zone_52S, 32752)
1003 ValuePair(PCS_WGS84_UTM_zone_53S, 32753)
1004 ValuePair(PCS_WGS84_UTM_zone_54S, 32754)
1005 ValuePair(PCS_WGS84_UTM_zone_55S, 32755)
1006 ValuePair(PCS_WGS84_UTM_zone_56S, 32756)
1007 ValuePair(PCS_WGS84_UTM_zone_57S, 32757)
1008 ValuePair(PCS_WGS84_UTM_zone_58S, 32758)
1009 ValuePair(PCS_WGS84_UTM_zone_59S, 32759)
1010 ValuePair(PCS_WGS84_UTM_zone_60S, 32760)
1011 /* end of list */
0 /* EPSG/GeoTIFF Rev 0.2 Prime Meridian Database */
1
2 /* C database for Geotiff include files. */
3 /* the macro ValuePair() must be defined */
4 /* by the enclosing include file */
5
6 #ifdef INCLUDE_OLD_CODES
7 #include old_pm.inc
8 #endif /* OLD Codes */
9
10 ValuePair(PM_Greenwich, 8901)
11 ValuePair(PM_Lisbon, 8902)
12 ValuePair(PM_Paris, 8903)
13 ValuePair(PM_Bogota, 8904)
14 ValuePair(PM_Madrid, 8905)
15 ValuePair(PM_Rome, 8906)
16 ValuePair(PM_Bern, 8907)
17 ValuePair(PM_Jakarta, 8908)
18 ValuePair(PM_Ferro, 8909)
19 ValuePair(PM_Brussels, 8910)
20 ValuePair(PM_Stockholm, 8911)
21 /* end of list */
0 /*
1 * EPSG/POSC Projection Codes - GeoTIFF Rev 0.2
2 */
3
4 /* C database for Geotiff include files. */
5 /* the macro ValuePair() must be defined */
6 /* by the enclosing include file */
7
8 #ifdef INCLUDE_OLD_CODES
9 #include old_proj.inc
10 #endif /* OLD Codes */
11
12 /* New codes */
13
14 ValuePair(Proj_Stereo_70,19926)
15
16 /* old codes */
17
18 ValuePair(Proj_Alabama_CS27_East, 10101)
19 ValuePair(Proj_Alabama_CS27_West, 10102)
20 ValuePair(Proj_Alabama_CS83_East, 10131)
21 ValuePair(Proj_Alabama_CS83_West, 10132)
22 ValuePair(Proj_Arizona_Coordinate_System_east, 10201)
23 ValuePair(Proj_Arizona_Coordinate_System_Central, 10202)
24 ValuePair(Proj_Arizona_Coordinate_System_west, 10203)
25 ValuePair(Proj_Arizona_CS83_east, 10231)
26 ValuePair(Proj_Arizona_CS83_Central, 10232)
27 ValuePair(Proj_Arizona_CS83_west, 10233)
28 ValuePair(Proj_Arkansas_CS27_North, 10301)
29 ValuePair(Proj_Arkansas_CS27_South, 10302)
30 ValuePair(Proj_Arkansas_CS83_North, 10331)
31 ValuePair(Proj_Arkansas_CS83_South, 10332)
32 ValuePair(Proj_California_CS27_I, 10401)
33 ValuePair(Proj_California_CS27_II, 10402)
34 ValuePair(Proj_California_CS27_III, 10403)
35 ValuePair(Proj_California_CS27_IV, 10404)
36 ValuePair(Proj_California_CS27_V, 10405)
37 ValuePair(Proj_California_CS27_VI, 10406)
38 ValuePair(Proj_California_CS27_VII, 10407)
39 ValuePair(Proj_California_CS83_1, 10431)
40 ValuePair(Proj_California_CS83_2, 10432)
41 ValuePair(Proj_California_CS83_3, 10433)
42 ValuePair(Proj_California_CS83_4, 10434)
43 ValuePair(Proj_California_CS83_5, 10435)
44 ValuePair(Proj_California_CS83_6, 10436)
45 ValuePair(Proj_Colorado_CS27_North, 10501)
46 ValuePair(Proj_Colorado_CS27_Central, 10502)
47 ValuePair(Proj_Colorado_CS27_South, 10503)
48 ValuePair(Proj_Colorado_CS83_North, 10531)
49 ValuePair(Proj_Colorado_CS83_Central, 10532)
50 ValuePair(Proj_Colorado_CS83_South, 10533)
51 ValuePair(Proj_Connecticut_CS27, 10600)
52 ValuePair(Proj_Connecticut_CS83, 10630)
53 ValuePair(Proj_Delaware_CS27, 10700)
54 ValuePair(Proj_Delaware_CS83, 10730)
55 ValuePair(Proj_Florida_CS27_East, 10901)
56 ValuePair(Proj_Florida_CS27_West, 10902)
57 ValuePair(Proj_Florida_CS27_North, 10903)
58 ValuePair(Proj_Florida_CS83_East, 10931)
59 ValuePair(Proj_Florida_CS83_West, 10932)
60 ValuePair(Proj_Florida_CS83_North, 10933)
61 ValuePair(Proj_Georgia_CS27_East, 11001)
62 ValuePair(Proj_Georgia_CS27_West, 11002)
63 ValuePair(Proj_Georgia_CS83_East, 11031)
64 ValuePair(Proj_Georgia_CS83_West, 11032)
65 ValuePair(Proj_Idaho_CS27_East, 11101)
66 ValuePair(Proj_Idaho_CS27_Central, 11102)
67 ValuePair(Proj_Idaho_CS27_West, 11103)
68 ValuePair(Proj_Idaho_CS83_East, 11131)
69 ValuePair(Proj_Idaho_CS83_Central, 11132)
70 ValuePair(Proj_Idaho_CS83_West, 11133)
71 ValuePair(Proj_Illinois_CS27_East, 11201)
72 ValuePair(Proj_Illinois_CS27_West, 11202)
73 ValuePair(Proj_Illinois_CS83_East, 11231)
74 ValuePair(Proj_Illinois_CS83_West, 11232)
75 ValuePair(Proj_Indiana_CS27_East, 11301)
76 ValuePair(Proj_Indiana_CS27_West, 11302)
77 ValuePair(Proj_Indiana_CS83_East, 11331)
78 ValuePair(Proj_Indiana_CS83_West, 11332)
79 ValuePair(Proj_Iowa_CS27_North, 11401)
80 ValuePair(Proj_Iowa_CS27_South, 11402)
81 ValuePair(Proj_Iowa_CS83_North, 11431)
82 ValuePair(Proj_Iowa_CS83_South, 11432)
83 ValuePair(Proj_Kansas_CS27_North, 11501)
84 ValuePair(Proj_Kansas_CS27_South, 11502)
85 ValuePair(Proj_Kansas_CS83_North, 11531)
86 ValuePair(Proj_Kansas_CS83_South, 11532)
87 ValuePair(Proj_Kentucky_CS27_North, 11601)
88 ValuePair(Proj_Kentucky_CS27_South, 11602)
89 ValuePair(Proj_Kentucky_CS83_North, 15303)
90 ValuePair(Proj_Kentucky_CS83_South, 11632)
91 ValuePair(Proj_Louisiana_CS27_North, 11701)
92 ValuePair(Proj_Louisiana_CS27_South, 11702)
93 ValuePair(Proj_Louisiana_CS83_North, 11731)
94 ValuePair(Proj_Louisiana_CS83_South, 11732)
95 ValuePair(Proj_Maine_CS27_East, 11801)
96 ValuePair(Proj_Maine_CS27_West, 11802)
97 ValuePair(Proj_Maine_CS83_East, 11831)
98 ValuePair(Proj_Maine_CS83_West, 11832)
99 ValuePair(Proj_Maryland_CS27, 11900)
100 ValuePair(Proj_Maryland_CS83, 11930)
101 ValuePair(Proj_Massachusetts_CS27_Mainland, 12001)
102 ValuePair(Proj_Massachusetts_CS27_Island, 12002)
103 ValuePair(Proj_Massachusetts_CS83_Mainland, 12031)
104 ValuePair(Proj_Massachusetts_CS83_Island, 12032)
105 ValuePair(Proj_Michigan_State_Plane_East, 12101)
106 ValuePair(Proj_Michigan_State_Plane_Old_Central, 12102)
107 ValuePair(Proj_Michigan_State_Plane_West, 12103)
108 ValuePair(Proj_Michigan_CS27_North, 12111)
109 ValuePair(Proj_Michigan_CS27_Central, 12112)
110 ValuePair(Proj_Michigan_CS27_South, 12113)
111 ValuePair(Proj_Michigan_CS83_North, 12141)
112 ValuePair(Proj_Michigan_CS83_Central, 12142)
113 ValuePair(Proj_Michigan_CS83_South, 12143)
114 ValuePair(Proj_Minnesota_CS27_North, 12201)
115 ValuePair(Proj_Minnesota_CS27_Central, 12202)
116 ValuePair(Proj_Minnesota_CS27_South, 12203)
117 ValuePair(Proj_Minnesota_CS83_North, 12231)
118 ValuePair(Proj_Minnesota_CS83_Central, 12232)
119 ValuePair(Proj_Minnesota_CS83_South, 12233)
120 ValuePair(Proj_Mississippi_CS27_East, 12301)
121 ValuePair(Proj_Mississippi_CS27_West, 12302)
122 ValuePair(Proj_Mississippi_CS83_East, 12331)
123 ValuePair(Proj_Mississippi_CS83_West, 12332)
124 ValuePair(Proj_Missouri_CS27_East, 12401)
125 ValuePair(Proj_Missouri_CS27_Central, 12402)
126 ValuePair(Proj_Missouri_CS27_West, 12403)
127 ValuePair(Proj_Missouri_CS83_East, 12431)
128 ValuePair(Proj_Missouri_CS83_Central, 12432)
129 ValuePair(Proj_Missouri_CS83_West, 12433)
130 ValuePair(Proj_Montana_CS27_North, 12501)
131 ValuePair(Proj_Montana_CS27_Central, 12502)
132 ValuePair(Proj_Montana_CS27_South, 12503)
133 ValuePair(Proj_Montana_CS83, 12530)
134 ValuePair(Proj_Nebraska_CS27_North, 12601)
135 ValuePair(Proj_Nebraska_CS27_South, 12602)
136 ValuePair(Proj_Nebraska_CS83, 12630)
137 ValuePair(Proj_Nevada_CS27_East, 12701)
138 ValuePair(Proj_Nevada_CS27_Central, 12702)
139 ValuePair(Proj_Nevada_CS27_West, 12703)
140 ValuePair(Proj_Nevada_CS83_East, 12731)
141 ValuePair(Proj_Nevada_CS83_Central, 12732)
142 ValuePair(Proj_Nevada_CS83_West, 12733)
143 ValuePair(Proj_New_Hampshire_CS27, 12800)
144 ValuePair(Proj_New_Hampshire_CS83, 12830)
145 ValuePair(Proj_New_Jersey_CS27, 12900)
146 ValuePair(Proj_New_Jersey_CS83, 12930)
147 ValuePair(Proj_New_Mexico_CS27_East, 13001)
148 ValuePair(Proj_New_Mexico_CS27_Central, 13002)
149 ValuePair(Proj_New_Mexico_CS27_West, 13003)
150 ValuePair(Proj_New_Mexico_CS83_East, 13031)
151 ValuePair(Proj_New_Mexico_CS83_Central, 13032)
152 ValuePair(Proj_New_Mexico_CS83_West, 13033)
153 ValuePair(Proj_New_York_CS27_East, 13101)
154 ValuePair(Proj_New_York_CS27_Central, 13102)
155 ValuePair(Proj_New_York_CS27_West, 13103)
156 ValuePair(Proj_New_York_CS27_Long_Island, 13104)
157 ValuePair(Proj_New_York_CS83_East, 13131)
158 ValuePair(Proj_New_York_CS83_Central, 13132)
159 ValuePair(Proj_New_York_CS83_West, 13133)
160 ValuePair(Proj_New_York_CS83_Long_Island, 13134)
161 ValuePair(Proj_North_Carolina_CS27, 13200)
162 ValuePair(Proj_North_Carolina_CS83, 13230)
163 ValuePair(Proj_North_Dakota_CS27_North, 13301)
164 ValuePair(Proj_North_Dakota_CS27_South, 13302)
165 ValuePair(Proj_North_Dakota_CS83_North, 13331)
166 ValuePair(Proj_North_Dakota_CS83_South, 13332)
167 ValuePair(Proj_Ohio_CS27_North, 13401)
168 ValuePair(Proj_Ohio_CS27_South, 13402)
169 ValuePair(Proj_Ohio_CS83_North, 13431)
170 ValuePair(Proj_Ohio_CS83_South, 13432)
171 ValuePair(Proj_Oklahoma_CS27_North, 13501)
172 ValuePair(Proj_Oklahoma_CS27_South, 13502)
173 ValuePair(Proj_Oklahoma_CS83_North, 13531)
174 ValuePair(Proj_Oklahoma_CS83_South, 13532)
175 ValuePair(Proj_Oregon_CS27_North, 13601)
176 ValuePair(Proj_Oregon_CS27_South, 13602)
177 ValuePair(Proj_Oregon_CS83_North, 13631)
178 ValuePair(Proj_Oregon_CS83_South, 13632)
179 ValuePair(Proj_Pennsylvania_CS27_North, 13701)
180 ValuePair(Proj_Pennsylvania_CS27_South, 13702)
181 ValuePair(Proj_Pennsylvania_CS83_North, 13731)
182 ValuePair(Proj_Pennsylvania_CS83_South, 13732)
183 ValuePair(Proj_Rhode_Island_CS27, 13800)
184 ValuePair(Proj_Rhode_Island_CS83, 13830)
185 ValuePair(Proj_South_Carolina_CS27_North, 13901)
186 ValuePair(Proj_South_Carolina_CS27_South, 13902)
187 ValuePair(Proj_South_Carolina_CS83, 13930)
188 ValuePair(Proj_South_Dakota_CS27_North, 14001)
189 ValuePair(Proj_South_Dakota_CS27_South, 14002)
190 ValuePair(Proj_South_Dakota_CS83_North, 14031)
191 ValuePair(Proj_South_Dakota_CS83_South, 14032)
192 ValuePair(Proj_Tennessee_CS27, 15302)
193 ValuePair(Proj_Tennessee_CS83, 14130)
194 ValuePair(Proj_Texas_CS27_North, 14201)
195 ValuePair(Proj_Texas_CS27_North_Central, 14202)
196 ValuePair(Proj_Texas_CS27_Central, 14203)
197 ValuePair(Proj_Texas_CS27_South_Central, 14204)
198 ValuePair(Proj_Texas_CS27_South, 14205)
199 ValuePair(Proj_Texas_CS83_North, 14231)
200 ValuePair(Proj_Texas_CS83_North_Central, 14232)
201 ValuePair(Proj_Texas_CS83_Central, 14233)
202 ValuePair(Proj_Texas_CS83_South_Central, 14234)
203 ValuePair(Proj_Texas_CS83_South, 14235)
204 ValuePair(Proj_Utah_CS27_North, 14301)
205 ValuePair(Proj_Utah_CS27_Central, 14302)
206 ValuePair(Proj_Utah_CS27_South, 14303)
207 ValuePair(Proj_Utah_CS83_North, 14331)
208 ValuePair(Proj_Utah_CS83_Central, 14332)
209 ValuePair(Proj_Utah_CS83_South, 14333)
210 ValuePair(Proj_Vermont_CS27, 14400)
211 ValuePair(Proj_Vermont_CS83, 14430)
212 ValuePair(Proj_Virginia_CS27_North, 14501)
213 ValuePair(Proj_Virginia_CS27_South, 14502)
214 ValuePair(Proj_Virginia_CS83_North, 14531)
215 ValuePair(Proj_Virginia_CS83_South, 14532)
216 ValuePair(Proj_Washington_CS27_North, 14601)
217 ValuePair(Proj_Washington_CS27_South, 14602)
218 ValuePair(Proj_Washington_CS83_North, 14631)
219 ValuePair(Proj_Washington_CS83_South, 14632)
220 ValuePair(Proj_West_Virginia_CS27_North, 14701)
221 ValuePair(Proj_West_Virginia_CS27_South, 14702)
222 ValuePair(Proj_West_Virginia_CS83_North, 14731)
223 ValuePair(Proj_West_Virginia_CS83_South, 14732)
224 ValuePair(Proj_Wisconsin_CS27_North, 14801)
225 ValuePair(Proj_Wisconsin_CS27_Central, 14802)
226 ValuePair(Proj_Wisconsin_CS27_South, 14803)
227 ValuePair(Proj_Wisconsin_CS83_North, 14831)
228 ValuePair(Proj_Wisconsin_CS83_Central, 14832)
229 ValuePair(Proj_Wisconsin_CS83_South, 14833)
230 ValuePair(Proj_Wyoming_CS27_East, 14901)
231 ValuePair(Proj_Wyoming_CS27_East_Central, 14902)
232 ValuePair(Proj_Wyoming_CS27_West_Central, 14903)
233 ValuePair(Proj_Wyoming_CS27_West, 14904)
234 ValuePair(Proj_Wyoming_CS83_East, 14931)
235 ValuePair(Proj_Wyoming_CS83_East_Central, 14932)
236 ValuePair(Proj_Wyoming_CS83_West_Central, 14933)
237 ValuePair(Proj_Wyoming_CS83_West, 14934)
238 ValuePair(Proj_Alaska_CS27_1, 15001)
239 ValuePair(Proj_Alaska_CS27_2, 15002)
240 ValuePair(Proj_Alaska_CS27_3, 15003)
241 ValuePair(Proj_Alaska_CS27_4, 15004)
242 ValuePair(Proj_Alaska_CS27_5, 15005)
243 ValuePair(Proj_Alaska_CS27_6, 15006)
244 ValuePair(Proj_Alaska_CS27_7, 15007)
245 ValuePair(Proj_Alaska_CS27_8, 15008)
246 ValuePair(Proj_Alaska_CS27_9, 15009)
247 ValuePair(Proj_Alaska_CS27_10, 15010)
248 ValuePair(Proj_Alaska_CS83_1, 15031)
249 ValuePair(Proj_Alaska_CS83_2, 15032)
250 ValuePair(Proj_Alaska_CS83_3, 15033)
251 ValuePair(Proj_Alaska_CS83_4, 15034)
252 ValuePair(Proj_Alaska_CS83_5, 15035)
253 ValuePair(Proj_Alaska_CS83_6, 15036)
254 ValuePair(Proj_Alaska_CS83_7, 15037)
255 ValuePair(Proj_Alaska_CS83_8, 15038)
256 ValuePair(Proj_Alaska_CS83_9, 15039)
257 ValuePair(Proj_Alaska_CS83_10, 15040)
258 ValuePair(Proj_Hawaii_CS27_1, 15101)
259 ValuePair(Proj_Hawaii_CS27_2, 15102)
260 ValuePair(Proj_Hawaii_CS27_3, 15103)
261 ValuePair(Proj_Hawaii_CS27_4, 15104)
262 ValuePair(Proj_Hawaii_CS27_5, 15105)
263 ValuePair(Proj_Hawaii_CS83_1, 15131)
264 ValuePair(Proj_Hawaii_CS83_2, 15132)
265 ValuePair(Proj_Hawaii_CS83_3, 15133)
266 ValuePair(Proj_Hawaii_CS83_4, 15134)
267 ValuePair(Proj_Hawaii_CS83_5, 15135)
268 ValuePair(Proj_Puerto_Rico_CS27, 15201)
269 ValuePair(Proj_St_Croix, 15202)
270 ValuePair(Proj_Puerto_Rico_Virgin_Is, 15230)
271 ValuePair(Proj_BLM_14N_feet, 15914)
272 ValuePair(Proj_BLM_15N_feet, 15915)
273 ValuePair(Proj_BLM_16N_feet, 15916)
274 ValuePair(Proj_BLM_17N_feet, 15917)
275 ValuePair(Proj_UTM_zone_1N, 16001)
276 ValuePair(Proj_UTM_zone_2N, 16002)
277 ValuePair(Proj_UTM_zone_3N, 16003)
278 ValuePair(Proj_UTM_zone_4N, 16004)
279 ValuePair(Proj_UTM_zone_5N, 16005)
280 ValuePair(Proj_UTM_zone_6N, 16006)
281 ValuePair(Proj_UTM_zone_7N, 16007)
282 ValuePair(Proj_UTM_zone_8N, 16008)
283 ValuePair(Proj_UTM_zone_9N, 16009)
284 ValuePair(Proj_UTM_zone_10N, 16010)
285 ValuePair(Proj_UTM_zone_11N, 16011)
286 ValuePair(Proj_UTM_zone_12N, 16012)
287 ValuePair(Proj_UTM_zone_13N, 16013)
288 ValuePair(Proj_UTM_zone_14N, 16014)
289 ValuePair(Proj_UTM_zone_15N, 16015)
290 ValuePair(Proj_UTM_zone_16N, 16016)
291 ValuePair(Proj_UTM_zone_17N, 16017)
292 ValuePair(Proj_UTM_zone_18N, 16018)
293 ValuePair(Proj_UTM_zone_19N, 16019)
294 ValuePair(Proj_UTM_zone_20N, 16020)
295 ValuePair(Proj_UTM_zone_21N, 16021)
296 ValuePair(Proj_UTM_zone_22N, 16022)
297 ValuePair(Proj_UTM_zone_23N, 16023)
298 ValuePair(Proj_UTM_zone_24N, 16024)
299 ValuePair(Proj_UTM_zone_25N, 16025)
300 ValuePair(Proj_UTM_zone_26N, 16026)
301 ValuePair(Proj_UTM_zone_27N, 16027)
302 ValuePair(Proj_UTM_zone_28N, 16028)
303 ValuePair(Proj_UTM_zone_29N, 16029)
304 ValuePair(Proj_UTM_zone_30N, 16030)
305 ValuePair(Proj_UTM_zone_31N, 16031)
306 ValuePair(Proj_UTM_zone_32N, 16032)
307 ValuePair(Proj_UTM_zone_33N, 16033)
308 ValuePair(Proj_UTM_zone_34N, 16034)
309 ValuePair(Proj_UTM_zone_35N, 16035)
310 ValuePair(Proj_UTM_zone_36N, 16036)
311 ValuePair(Proj_UTM_zone_37N, 16037)
312 ValuePair(Proj_UTM_zone_38N, 16038)
313 ValuePair(Proj_UTM_zone_39N, 16039)
314 ValuePair(Proj_UTM_zone_40N, 16040)
315 ValuePair(Proj_UTM_zone_41N, 16041)
316 ValuePair(Proj_UTM_zone_42N, 16042)
317 ValuePair(Proj_UTM_zone_43N, 16043)
318 ValuePair(Proj_UTM_zone_44N, 16044)
319 ValuePair(Proj_UTM_zone_45N, 16045)
320 ValuePair(Proj_UTM_zone_46N, 16046)
321 ValuePair(Proj_UTM_zone_47N, 16047)
322 ValuePair(Proj_UTM_zone_48N, 16048)
323 ValuePair(Proj_UTM_zone_49N, 16049)
324 ValuePair(Proj_UTM_zone_50N, 16050)
325 ValuePair(Proj_UTM_zone_51N, 16051)
326 ValuePair(Proj_UTM_zone_52N, 16052)
327 ValuePair(Proj_UTM_zone_53N, 16053)
328 ValuePair(Proj_UTM_zone_54N, 16054)
329 ValuePair(Proj_UTM_zone_55N, 16055)
330 ValuePair(Proj_UTM_zone_56N, 16056)
331 ValuePair(Proj_UTM_zone_57N, 16057)
332 ValuePair(Proj_UTM_zone_58N, 16058)
333 ValuePair(Proj_UTM_zone_59N, 16059)
334 ValuePair(Proj_UTM_zone_60N, 16060)
335 ValuePair(Proj_UTM_zone_1S, 16101)
336 ValuePair(Proj_UTM_zone_2S, 16102)
337 ValuePair(Proj_UTM_zone_3S, 16103)
338 ValuePair(Proj_UTM_zone_4S, 16104)
339 ValuePair(Proj_UTM_zone_5S, 16105)
340 ValuePair(Proj_UTM_zone_6S, 16106)
341 ValuePair(Proj_UTM_zone_7S, 16107)
342 ValuePair(Proj_UTM_zone_8S, 16108)
343 ValuePair(Proj_UTM_zone_9S, 16109)
344 ValuePair(Proj_UTM_zone_10S, 16110)
345 ValuePair(Proj_UTM_zone_11S, 16111)
346 ValuePair(Proj_UTM_zone_12S, 16112)
347 ValuePair(Proj_UTM_zone_13S, 16113)
348 ValuePair(Proj_UTM_zone_14S, 16114)
349 ValuePair(Proj_UTM_zone_15S, 16115)
350 ValuePair(Proj_UTM_zone_16S, 16116)
351 ValuePair(Proj_UTM_zone_17S, 16117)
352 ValuePair(Proj_UTM_zone_18S, 16118)
353 ValuePair(Proj_UTM_zone_19S, 16119)
354 ValuePair(Proj_UTM_zone_20S, 16120)
355 ValuePair(Proj_UTM_zone_21S, 16121)
356 ValuePair(Proj_UTM_zone_22S, 16122)
357 ValuePair(Proj_UTM_zone_23S, 16123)
358 ValuePair(Proj_UTM_zone_24S, 16124)
359 ValuePair(Proj_UTM_zone_25S, 16125)
360 ValuePair(Proj_UTM_zone_26S, 16126)
361 ValuePair(Proj_UTM_zone_27S, 16127)
362 ValuePair(Proj_UTM_zone_28S, 16128)
363 ValuePair(Proj_UTM_zone_29S, 16129)
364 ValuePair(Proj_UTM_zone_30S, 16130)
365 ValuePair(Proj_UTM_zone_31S, 16131)
366 ValuePair(Proj_UTM_zone_32S, 16132)
367 ValuePair(Proj_UTM_zone_33S, 16133)
368 ValuePair(Proj_UTM_zone_34S, 16134)
369 ValuePair(Proj_UTM_zone_35S, 16135)
370 ValuePair(Proj_UTM_zone_36S, 16136)
371 ValuePair(Proj_UTM_zone_37S, 16137)
372 ValuePair(Proj_UTM_zone_38S, 16138)
373 ValuePair(Proj_UTM_zone_39S, 16139)
374 ValuePair(Proj_UTM_zone_40S, 16140)
375 ValuePair(Proj_UTM_zone_41S, 16141)
376 ValuePair(Proj_UTM_zone_42S, 16142)
377 ValuePair(Proj_UTM_zone_43S, 16143)
378 ValuePair(Proj_UTM_zone_44S, 16144)
379 ValuePair(Proj_UTM_zone_45S, 16145)
380 ValuePair(Proj_UTM_zone_46S, 16146)
381 ValuePair(Proj_UTM_zone_47S, 16147)
382 ValuePair(Proj_UTM_zone_48S, 16148)
383 ValuePair(Proj_UTM_zone_49S, 16149)
384 ValuePair(Proj_UTM_zone_50S, 16150)
385 ValuePair(Proj_UTM_zone_51S, 16151)
386 ValuePair(Proj_UTM_zone_52S, 16152)
387 ValuePair(Proj_UTM_zone_53S, 16153)
388 ValuePair(Proj_UTM_zone_54S, 16154)
389 ValuePair(Proj_UTM_zone_55S, 16155)
390 ValuePair(Proj_UTM_zone_56S, 16156)
391 ValuePair(Proj_UTM_zone_57S, 16157)
392 ValuePair(Proj_UTM_zone_58S, 16158)
393 ValuePair(Proj_UTM_zone_59S, 16159)
394 ValuePair(Proj_UTM_zone_60S, 16160)
395 ValuePair(Proj_Gauss_Kruger_zone_0, 16200)
396 ValuePair(Proj_Gauss_Kruger_zone_1, 16201)
397 ValuePair(Proj_Gauss_Kruger_zone_2, 16202)
398 ValuePair(Proj_Gauss_Kruger_zone_3, 16203)
399 ValuePair(Proj_Gauss_Kruger_zone_4, 16204)
400 ValuePair(Proj_Gauss_Kruger_zone_5, 16205)
401 ValuePair(Proj_Map_Grid_of_Australia_48, 17348)
402 ValuePair(Proj_Map_Grid_of_Australia_49, 17349)
403 ValuePair(Proj_Map_Grid_of_Australia_50, 17350)
404 ValuePair(Proj_Map_Grid_of_Australia_51, 17351)
405 ValuePair(Proj_Map_Grid_of_Australia_52, 17352)
406 ValuePair(Proj_Map_Grid_of_Australia_53, 17353)
407 ValuePair(Proj_Map_Grid_of_Australia_54, 17354)
408 ValuePair(Proj_Map_Grid_of_Australia_55, 17355)
409 ValuePair(Proj_Map_Grid_of_Australia_56, 17356)
410 ValuePair(Proj_Map_Grid_of_Australia_57, 17357)
411 ValuePair(Proj_Map_Grid_of_Australia_58, 17358)
412 ValuePair(Proj_Australian_Map_Grid_48, 17448)
413 ValuePair(Proj_Australian_Map_Grid_49, 17449)
414 ValuePair(Proj_Australian_Map_Grid_50, 17450)
415 ValuePair(Proj_Australian_Map_Grid_51, 17451)
416 ValuePair(Proj_Australian_Map_Grid_52, 17452)
417 ValuePair(Proj_Australian_Map_Grid_53, 17453)
418 ValuePair(Proj_Australian_Map_Grid_54, 17454)
419 ValuePair(Proj_Australian_Map_Grid_55, 17455)
420 ValuePair(Proj_Australian_Map_Grid_56, 17456)
421 ValuePair(Proj_Australian_Map_Grid_57, 17457)
422 ValuePair(Proj_Australian_Map_Grid_58, 17458)
423 ValuePair(Proj_Argentina_1, 18031)
424 ValuePair(Proj_Argentina_2, 18032)
425 ValuePair(Proj_Argentina_3, 18033)
426 ValuePair(Proj_Argentina_4, 18034)
427 ValuePair(Proj_Argentina_5, 18035)
428 ValuePair(Proj_Argentina_6, 18036)
429 ValuePair(Proj_Argentina_7, 18037)
430 ValuePair(Proj_Colombia_3W, 18051)
431 ValuePair(Proj_Colombia_Bogota, 18052)
432 ValuePair(Proj_Colombia_3E, 18053)
433 ValuePair(Proj_Colombia_6E, 18054)
434 ValuePair(Proj_Egypt_Red_Belt, 18072)
435 ValuePair(Proj_Egypt_Purple_Belt, 18073)
436 ValuePair(Proj_Extended_Purple_Belt, 18074)
437 ValuePair(Proj_New_Zealand_North_Island_Nat_Grid, 18141)
438 ValuePair(Proj_New_Zealand_South_Island_Nat_Grid, 18142)
439 ValuePair(Proj_Bahrain_Grid, 19900)
440 ValuePair(Proj_Netherlands_E_Indies_Equatorial, 19905)
441 ValuePair(Proj_RSO_Borneo, 19912)
442 /* end of list */
0 /*
1 * Rev. 0.2 EPSG/POSC Units Database.
2 */
3
4 #ifdef INCLUDE_OLD_CODES
5 #include geo_units.inc
6 #endif /* OLD Codes */
7
8 ValuePair(Linear_Meter, 9001)
9 ValuePair(Linear_Foot, 9002)
10 ValuePair(Linear_Foot_US_Survey, 9003)
11 ValuePair(Linear_Foot_Modified_American, 9004)
12 ValuePair(Linear_Foot_Clarke, 9005)
13 ValuePair(Linear_Foot_Indian, 9006)
14 ValuePair(Linear_Link, 9007)
15 ValuePair(Linear_Link_Benoit, 9008)
16 ValuePair(Linear_Link_Sears, 9009)
17 ValuePair(Linear_Chain_Benoit, 9010)
18 ValuePair(Linear_Chain_Sears, 9011)
19 ValuePair(Linear_Yard_Sears, 9012)
20 ValuePair(Linear_Yard_Indian, 9013)
21 ValuePair(Linear_Fathom, 9014)
22 ValuePair(Linear_Mile_International_Nautical, 9015)
23 /*
24 * Angular Units
25 */
26 ValuePair(Angular_Radian, 9101)
27 ValuePair(Angular_Degree, 9102)
28 ValuePair(Angular_Arc_Minute, 9103)
29 ValuePair(Angular_Arc_Second, 9104)
30 ValuePair(Angular_Grad, 9105)
31 ValuePair(Angular_Gon, 9106)
32 ValuePair(Angular_DMS, 9107)
33 ValuePair(Angular_DMS_Hemisphere, 9108)
34 /* end of list */
0 /*
1 * EPSG/POSC Ellipsoid-referenced Vertical CS
2 * Note: these should correspond exactly with the Ellipsoid database.
3 */
4 ValuePair(VertCS_Airy_1830_ellipsoid, 5001)
5 ValuePair(VertCS_Airy_Modified_1849_ellipsoid, 5002)
6 ValuePair(VertCS_ANS_ellipsoid, 5003)
7 ValuePair(VertCS_Bessel_1841_ellipsoid, 5004)
8 ValuePair(VertCS_Bessel_Modified_ellipsoid, 5005)
9 ValuePair(VertCS_Bessel_Namibia_ellipsoid, 5006)
10 ValuePair(VertCS_Clarke_1858_ellipsoid, 5007)
11 ValuePair(VertCS_Clarke_1866_ellipsoid, 5008)
12 ValuePair(VertCS_Clarke_1880_Benoit_ellipsoid, 5010)
13 ValuePair(VertCS_Clarke_1880_IGN_ellipsoid, 5011)
14 ValuePair(VertCS_Clarke_1880_RGS_ellipsoid, 5012)
15 ValuePair(VertCS_Clarke_1880_Arc_ellipsoid, 5013)
16 ValuePair(VertCS_Clarke_1880_SGA_1922_ellipsoid, 5014)
17 ValuePair(VertCS_Everest_1830_1937_Adjustment_ellipsoid, 5015)
18 ValuePair(VertCS_Everest_1830_1967_Definition_ellipsoid, 5016)
19 ValuePair(VertCS_Everest_1830_1975_Definition_ellipsoid, 5017)
20 ValuePair(VertCS_Everest_1830_Modified_ellipsoid, 5018)
21 ValuePair(VertCS_GRS_1980_ellipsoid, 5019)
22 ValuePair(VertCS_Helmert_1906_ellipsoid, 5020)
23 ValuePair(VertCS_INS_ellipsoid, 5021)
24 ValuePair(VertCS_International_1924_ellipsoid, 5022)
25 ValuePair(VertCS_International_1967_ellipsoid, 5023)
26 ValuePair(VertCS_Krassowsky_1940_ellipsoid, 5024)
27 ValuePair(VertCS_NWL_9D_ellipsoid, 5025)
28 ValuePair(VertCS_NWL_10D_ellipsoid, 5026)
29 ValuePair(VertCS_Plessis_1817_ellipsoid, 5027)
30 ValuePair(VertCS_Struve_1860_ellipsoid, 5028)
31 ValuePair(VertCS_War_Office_ellipsoid, 5029)
32 ValuePair(VertCS_WGS_84_ellipsoid, 5030)
33 ValuePair(VertCS_GEM_10C_ellipsoid, 5031)
34 ValuePair(VertCS_OSU86F_ellipsoid, 5032)
35 ValuePair(VertCS_OSU91A_ellipsoid, 5033)
36 /*
37 * Other established Vertical CS
38 */
39 ValuePair(VertCS_Newlyn, 5101)
40 ValuePair(VertCS_North_American_Vertical_Datum_1929, 5102)
41 ValuePair(VertCS_North_American_Vertical_Datum_1988, 5103)
42 ValuePair(VertCS_Yellow_Sea_1956, 5104)
43 ValuePair(VertCS_Baltic_Sea, 5105)
44 ValuePair(VertCS_Caspian_Sea, 5106)
45 /* end of list */
0 #ifndef GEO_CONFIG_H
1 #define GEO_CONFIG_H
2
3 /* Define if you have the ANSI C header files. */
4 #undef STDC_HEADERS
5
6 /* Define if you have the <stdlib.h> header file. */
7 #undef HAVE_STDLIB_H
8
9 /* Define if you have the <string.h> header file. */
10 #undef HAVE_STRING_H
11
12 /* Define if you have the <strings.h> header file. */
13 #undef HAVE_STRINGS_H
14
15 #undef HAVE_LIBPROJ
16 #undef HAVE_PROJECTS_H
17
18 #endif /* ndef GEO_CONFIG_H */
0 /* geo_config.h. Generated automatically by configure. */
1 #ifndef GEO_CONFIG_H
2 #define GEO_CONFIG_H
3
4 /* Define if you have the ANSI C header files. */
5 #define STDC_HEADERS 1
6
7 /* Define if your processor stores words with the most significant
8 byte first (like Motorola and SPARC, unlike Intel and VAX). */
9 /* #undef WORDS_BIGENDIAN */
10
11 /* Define if you have the <stdlib.h> header file. */
12 #define HAVE_STDLIB_H 1
13
14 /* Define if you have the <string.h> header file. */
15 #define HAVE_STRING_H 1
16
17 /* Define if you have the <strings.h> header file. */
18 #define HAVE_STRINGS_H 1
19
20 /* Build as DLL */
21 #define BUILD_AS_DLL 1
22
23 #endif /* ndef GEO_CONFIG_H */
0 /******************************************************************************
1 * $Id: geo_ctrans.inc,v 1.3 2005/03/04 03:59:11 fwarmerdam Exp $
2 *
3 * Project: libgeotiff
4 * Purpose: GeoTIFF Projection Method codes.
5 * Author: Frank Warmerdam, warmerdam@pobox.com
6 *
7 ******************************************************************************
8 * Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com>
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 * DEALINGS IN THE SOFTWARE.
27 ******************************************************************************
28 *
29 * $Log: geo_ctrans.inc,v $
30 * Revision 1.3 2005/03/04 03:59:11 fwarmerdam
31 * Added header.
32 *
33 */
34
35 /* C database for Geotiff include files. */
36 /* the macro ValuePair() must be defined */
37 /* by the enclosing include file */
38
39 /*
40 * Revised 12 Jul 1995 NDR -- changed South Oriented to a code
41 * Revised 28 Sep 1995 NDR -- Added Rev. 1.0 aliases.
42 */
43
44 ValuePair(CT_TransverseMercator, 1)
45 ValuePair(CT_TransvMercator_Modified_Alaska, 2)
46 ValuePair(CT_ObliqueMercator, 3)
47 ValuePair(CT_ObliqueMercator_Laborde, 4)
48 ValuePair(CT_ObliqueMercator_Rosenmund, 5)
49 ValuePair(CT_ObliqueMercator_Spherical, 6) /* not advisable */
50 ValuePair(CT_Mercator, 7)
51 ValuePair(CT_LambertConfConic_2SP, 8)
52 ValuePair(CT_LambertConfConic,CT_LambertConfConic_2SP) /* Alias */
53 ValuePair(CT_LambertConfConic_1SP, 9)
54 ValuePair(CT_LambertConfConic_Helmert,CT_LambertConfConic_1SP) /* alias */
55 ValuePair(CT_LambertAzimEqualArea, 10)
56 ValuePair(CT_AlbersEqualArea, 11)
57 ValuePair(CT_AzimuthalEquidistant, 12)
58 ValuePair(CT_EquidistantConic, 13)
59 ValuePair(CT_Stereographic, 14)
60 ValuePair(CT_PolarStereographic, 15)
61 ValuePair(CT_ObliqueStereographic, 16) /* not advisable */
62 ValuePair(CT_Equirectangular, 17)
63 ValuePair(CT_CassiniSoldner, 18)
64 ValuePair(CT_Gnomonic, 19)
65 ValuePair(CT_MillerCylindrical, 20)
66 ValuePair(CT_Orthographic, 21)
67 ValuePair(CT_Polyconic, 22)
68 ValuePair(CT_Robinson, 23)
69 ValuePair(CT_Sinusoidal, 24)
70 ValuePair(CT_VanDerGrinten, 25)
71 ValuePair(CT_NewZealandMapGrid, 26)
72 /* Added for 1.0 */
73 ValuePair(CT_TransvMercator_SouthOrientated, 27)
74
75 /* Added Feb 2005 */
76 ValuePair(CT_CylindricalEqualArea, 28)
77
78
79 /* Aliases */
80
81 ValuePair(CT_SouthOrientedGaussConformal,CT_TransvMercator_SouthOrientated)
82 ValuePair(CT_AlaskaConformal, CT_TransvMercator_Modified_Alaska)
83 ValuePair(CT_TransvEquidistCylindrical, CT_CassiniSoldner)
84 ValuePair(CT_ObliqueMercator_Hotine, CT_ObliqueMercator)
85 ValuePair(CT_SwissObliqueCylindrical, CT_ObliqueMercator_Rosenmund)
86 ValuePair(CT_GaussBoaga, CT_TransverseMercator)
87 ValuePair(CT_GaussKruger, CT_TransverseMercator)
88 ValuePair(CT_TransvMercator_SouthOriented, CT_TransvMercator_SouthOrientated)
89
90
0 /******************************************************************************
1 * $Id: geo_extra.c,v 1.4 2002/12/01 23:44:34 warmerda Exp $
2 *
3 * Project: libgeotiff
4 * Purpose: Code to normalize a few common PCS values without use of CSV
5 * files.
6 * Author: Frank Warmerdam, warmerda@home.com
7 *
8 ******************************************************************************
9 * Copyright (c) 1999, Frank Warmerdam
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 ******************************************************************************
29 *
30 * $Log: geo_extra.c,v $
31 * Revision 1.4 2002/12/01 23:44:34 warmerda
32 * Fixed typo in last fix.
33 *
34 * Revision 1.3 2002/12/01 23:42:06 warmerda
35 * added overrides for two deprecated stateplane zones
36 *
37 * Revision 1.2 1999/05/04 03:09:33 warmerda
38 * avoid warnings
39 *
40 * Revision 1.1 1999/04/28 20:01:29 warmerda
41 * new
42 *
43 */
44
45 /*
46 #include "geotiff.h"
47 #include "geo_tiffp.h"
48 #include "geo_keyp.h"
49 */
50
51 #include "geo_normalize.h"
52 #include "geovalues.h"
53
54 static int StatePlaneTable[] =
55 {
56 PCS_NAD83_Alabama_East, Proj_Alabama_CS83_East,
57 PCS_NAD83_Alabama_West, Proj_Alabama_CS83_West,
58
59 PCS_NAD83_Alaska_zone_1, Proj_Alaska_CS83_1,
60 PCS_NAD83_Alaska_zone_2, Proj_Alaska_CS83_2,
61 PCS_NAD83_Alaska_zone_3, Proj_Alaska_CS83_3,
62 PCS_NAD83_Alaska_zone_4, Proj_Alaska_CS83_4,
63 PCS_NAD83_Alaska_zone_5, Proj_Alaska_CS83_5,
64 PCS_NAD83_Alaska_zone_6, Proj_Alaska_CS83_6,
65 PCS_NAD83_Alaska_zone_7, Proj_Alaska_CS83_7,
66 PCS_NAD83_Alaska_zone_8, Proj_Alaska_CS83_8,
67 PCS_NAD83_Alaska_zone_9, Proj_Alaska_CS83_9,
68 PCS_NAD83_Alaska_zone_10, Proj_Alaska_CS83_10,
69
70 PCS_NAD83_California_1, Proj_California_CS83_1,
71 PCS_NAD83_California_2, Proj_California_CS83_2,
72 PCS_NAD83_California_3, Proj_California_CS83_3,
73 PCS_NAD83_California_4, Proj_California_CS83_4,
74 PCS_NAD83_California_5, Proj_California_CS83_5,
75 PCS_NAD83_California_6, Proj_California_CS83_6,
76
77 PCS_NAD83_Arizona_East, Proj_Arizona_CS83_east,
78 PCS_NAD83_Arizona_Central, Proj_Arizona_CS83_Central,
79 PCS_NAD83_Arizona_West, Proj_Arizona_CS83_west,
80
81 PCS_NAD83_Arkansas_North, Proj_Arkansas_CS83_North,
82 PCS_NAD83_Arkansas_South, Proj_Arkansas_CS83_South,
83
84 PCS_NAD83_Colorado_North, Proj_Colorado_CS83_North,
85 PCS_NAD83_Colorado_Central, Proj_Colorado_CS83_Central,
86 PCS_NAD83_Colorado_South, Proj_Colorado_CS83_South,
87
88 PCS_NAD83_Connecticut, Proj_Connecticut_CS83,
89
90 PCS_NAD83_Delaware, Proj_Delaware_CS83,
91
92 PCS_NAD83_Florida_East, Proj_Florida_CS83_East,
93 PCS_NAD83_Florida_North, Proj_Florida_CS83_North,
94 PCS_NAD83_Florida_West, Proj_Florida_CS83_West,
95
96 PCS_NAD83_Hawaii_zone_1, Proj_Hawaii_CS83_1,
97 PCS_NAD83_Hawaii_zone_2, Proj_Hawaii_CS83_2,
98 PCS_NAD83_Hawaii_zone_3, Proj_Hawaii_CS83_3,
99 PCS_NAD83_Hawaii_zone_4, Proj_Hawaii_CS83_4,
100 PCS_NAD83_Hawaii_zone_5, Proj_Hawaii_CS83_5,
101
102 PCS_NAD83_Georgia_East, Proj_Georgia_CS83_East,
103 PCS_NAD83_Georgia_West, Proj_Georgia_CS83_West,
104
105 PCS_NAD83_Idaho_East, Proj_Idaho_CS83_East,
106 PCS_NAD83_Idaho_Central, Proj_Idaho_CS83_Central,
107 PCS_NAD83_Idaho_West, Proj_Idaho_CS83_West,
108
109 PCS_NAD83_Illinois_East, Proj_Illinois_CS83_East,
110 PCS_NAD83_Illinois_West, Proj_Illinois_CS83_West,
111
112 PCS_NAD83_Indiana_East, Proj_Indiana_CS83_East,
113 PCS_NAD83_Indiana_West, Proj_Indiana_CS83_West,
114
115 PCS_NAD83_Iowa_North, Proj_Iowa_CS83_North,
116 PCS_NAD83_Iowa_South, Proj_Iowa_CS83_South,
117
118 PCS_NAD83_Kansas_North, Proj_Kansas_CS83_North,
119 PCS_NAD83_Kansas_South, Proj_Kansas_CS83_South,
120
121 PCS_NAD83_Kentucky_North, Proj_Kentucky_CS83_North,
122 PCS_NAD83_Kentucky_South, Proj_Kentucky_CS83_South,
123
124 PCS_NAD83_Louisiana_North, Proj_Louisiana_CS83_North,
125 PCS_NAD83_Louisiana_South, Proj_Louisiana_CS83_South,
126
127 PCS_NAD83_Maine_East, Proj_Maine_CS83_East,
128 PCS_NAD83_Maine_West, Proj_Maine_CS83_West,
129
130 PCS_NAD83_Maryland, Proj_Maryland_CS83,
131
132 PCS_NAD83_Massachusetts, Proj_Massachusetts_CS83_Mainland,
133 PCS_NAD83_Massachusetts_Is, Proj_Massachusetts_CS83_Island,
134
135 PCS_NAD83_Michigan_North, Proj_Michigan_CS83_North,
136 PCS_NAD83_Michigan_Central, Proj_Michigan_CS83_Central,
137 PCS_NAD83_Michigan_South, Proj_Michigan_CS83_South,
138
139 PCS_NAD83_Minnesota_North, Proj_Minnesota_CS83_North,
140 PCS_NAD83_Minnesota_Cent, Proj_Minnesota_CS83_Central,
141 PCS_NAD83_Minnesota_South, Proj_Minnesota_CS83_South,
142
143 PCS_NAD83_Mississippi_East, Proj_Mississippi_CS83_East,
144 PCS_NAD83_Mississippi_West, Proj_Mississippi_CS83_West,
145
146 PCS_NAD83_Missouri_East, Proj_Missouri_CS83_East,
147 PCS_NAD83_Missouri_Central, Proj_Missouri_CS83_Central,
148 PCS_NAD83_Missouri_West, Proj_Missouri_CS83_West,
149
150 PCS_NAD83_Montana, Proj_Montana_CS83,
151
152 PCS_NAD83_Nebraska, Proj_Nebraska_CS83,
153
154 PCS_NAD83_Nevada_East, Proj_Nevada_CS83_East,
155 PCS_NAD83_Nevada_Central, Proj_Nevada_CS83_Central,
156 PCS_NAD83_Nevada_West, Proj_Nevada_CS83_West,
157
158 PCS_NAD83_New_Hampshire, Proj_New_Hampshire_CS83,
159
160 PCS_NAD83_New_Jersey, Proj_New_Jersey_CS83,
161
162 PCS_NAD83_New_Mexico_East, Proj_New_Mexico_CS83_East,
163 PCS_NAD83_New_Mexico_Cent, Proj_New_Mexico_CS83_Central,
164 PCS_NAD83_New_Mexico_West, Proj_New_Mexico_CS83_West,
165
166 PCS_NAD83_New_York_East, Proj_New_York_CS83_East,
167 PCS_NAD83_New_York_Central, Proj_New_York_CS83_Central,
168 PCS_NAD83_New_York_West, Proj_New_York_CS83_West,
169 PCS_NAD83_New_York_Long_Is, Proj_New_York_CS83_Long_Island,
170
171 PCS_NAD83_North_Carolina, Proj_North_Carolina_CS83,
172
173 PCS_NAD83_North_Dakota_N, Proj_North_Dakota_CS83_North,
174 PCS_NAD83_North_Dakota_S, Proj_North_Dakota_CS83_South,
175
176 PCS_NAD83_Ohio_North, Proj_Ohio_CS83_North,
177 PCS_NAD83_Ohio_South, Proj_Ohio_CS83_South,
178
179 PCS_NAD83_Oklahoma_North, Proj_Oklahoma_CS83_North,
180 PCS_NAD83_Oklahoma_South, Proj_Oklahoma_CS83_South,
181
182 PCS_NAD83_Oregon_North, Proj_Oregon_CS83_North,
183 PCS_NAD83_Oregon_South, Proj_Oregon_CS83_South,
184
185 PCS_NAD83_Pennsylvania_N, Proj_Pennsylvania_CS83_North,
186 PCS_NAD83_Pennsylvania_S, Proj_Pennsylvania_CS83_South,
187
188 PCS_NAD83_Rhode_Island, Proj_Rhode_Island_CS83,
189
190 PCS_NAD83_South_Carolina, Proj_South_Carolina_CS83,
191
192 PCS_NAD83_South_Dakota_N, Proj_South_Dakota_CS83_North,
193 PCS_NAD83_South_Dakota_S, Proj_South_Dakota_CS83_South,
194
195 PCS_NAD83_Tennessee, Proj_Tennessee_CS83,
196
197 PCS_NAD83_Texas_North, Proj_Texas_CS83_North,
198 PCS_NAD83_Texas_North_Cen, Proj_Texas_CS83_North_Central,
199 PCS_NAD83_Texas_Central, Proj_Texas_CS83_Central,
200 PCS_NAD83_Texas_South_Cen, Proj_Texas_CS83_South_Central,
201 PCS_NAD83_Texas_South, Proj_Texas_CS83_South,
202
203 PCS_NAD83_Utah_North, Proj_Utah_CS83_North,
204 PCS_NAD83_Utah_Central, Proj_Utah_CS83_Central,
205 PCS_NAD83_Utah_South, Proj_Utah_CS83_South,
206
207 PCS_NAD83_Vermont, Proj_Vermont_CS83,
208
209 PCS_NAD83_Virginia_North, Proj_Virginia_CS83_North,
210 PCS_NAD83_Virginia_South, Proj_Virginia_CS83_South,
211
212 PCS_NAD83_Washington_North, Proj_Washington_CS83_North,
213 PCS_NAD83_Washington_South, Proj_Washington_CS83_South,
214
215 PCS_NAD83_West_Virginia_N, Proj_West_Virginia_CS83_North,
216 PCS_NAD83_West_Virginia_S, Proj_West_Virginia_CS83_South,
217
218 PCS_NAD83_Wisconsin_North, Proj_Wisconsin_CS83_North,
219 PCS_NAD83_Wisconsin_Cen, Proj_Wisconsin_CS83_Central,
220 PCS_NAD83_Wisconsin_South, Proj_Wisconsin_CS83_South,
221
222 PCS_NAD83_Wyoming_East, Proj_Wyoming_CS83_East,
223 PCS_NAD83_Wyoming_E_Cen, Proj_Wyoming_CS83_East_Central,
224 PCS_NAD83_Wyoming_W_Cen, Proj_Wyoming_CS83_West_Central,
225 PCS_NAD83_Wyoming_West, Proj_Wyoming_CS83_West,
226
227 PCS_NAD83_Puerto_Rico_Virgin_Is, Proj_Puerto_Rico_Virgin_Is,
228
229 PCS_NAD27_Alabama_East, Proj_Alabama_CS27_East,
230 PCS_NAD27_Alabama_West, Proj_Alabama_CS27_West,
231
232 PCS_NAD27_Alaska_zone_1, Proj_Alaska_CS27_1,
233 PCS_NAD27_Alaska_zone_2, Proj_Alaska_CS27_2,
234 PCS_NAD27_Alaska_zone_3, Proj_Alaska_CS27_3,
235 PCS_NAD27_Alaska_zone_4, Proj_Alaska_CS27_4,
236 PCS_NAD27_Alaska_zone_5, Proj_Alaska_CS27_5,
237 PCS_NAD27_Alaska_zone_6, Proj_Alaska_CS27_6,
238 PCS_NAD27_Alaska_zone_7, Proj_Alaska_CS27_7,
239 PCS_NAD27_Alaska_zone_8, Proj_Alaska_CS27_8,
240 PCS_NAD27_Alaska_zone_9, Proj_Alaska_CS27_9,
241 PCS_NAD27_Alaska_zone_10, Proj_Alaska_CS27_10,
242
243 PCS_NAD27_California_I, Proj_California_CS27_I,
244 PCS_NAD27_California_II, Proj_California_CS27_II,
245 PCS_NAD27_California_III, Proj_California_CS27_III,
246 PCS_NAD27_California_IV, Proj_California_CS27_IV,
247 PCS_NAD27_California_V, Proj_California_CS27_V,
248 PCS_NAD27_California_VI, Proj_California_CS27_VI,
249 PCS_NAD27_California_VII, Proj_California_CS27_VII,
250
251 PCS_NAD27_Arizona_East, Proj_Arizona_Coordinate_System_east,
252 PCS_NAD27_Arizona_Central, Proj_Arizona_Coordinate_System_Central,
253 PCS_NAD27_Arizona_West, Proj_Arizona_Coordinate_System_west,
254
255 PCS_NAD27_Arkansas_North, Proj_Arkansas_CS27_North,
256 PCS_NAD27_Arkansas_South, Proj_Arkansas_CS27_South,
257
258 PCS_NAD27_Colorado_North, Proj_Colorado_CS27_North,
259 PCS_NAD27_Colorado_Central, Proj_Colorado_CS27_Central,
260 PCS_NAD27_Colorado_South, Proj_Colorado_CS27_South,
261
262 PCS_NAD27_Connecticut, Proj_Connecticut_CS27,
263
264 PCS_NAD27_Delaware, Proj_Delaware_CS27,
265
266 PCS_NAD27_Florida_East, Proj_Florida_CS27_East,
267 PCS_NAD27_Florida_North, Proj_Florida_CS27_North,
268 PCS_NAD27_Florida_West, Proj_Florida_CS27_West,
269
270 PCS_NAD27_Hawaii_zone_1, Proj_Hawaii_CS27_1,
271 PCS_NAD27_Hawaii_zone_2, Proj_Hawaii_CS27_2,
272 PCS_NAD27_Hawaii_zone_3, Proj_Hawaii_CS27_3,
273 PCS_NAD27_Hawaii_zone_4, Proj_Hawaii_CS27_4,
274 PCS_NAD27_Hawaii_zone_5, Proj_Hawaii_CS27_5,
275
276 PCS_NAD27_Georgia_East, Proj_Georgia_CS27_East,
277 PCS_NAD27_Georgia_West, Proj_Georgia_CS27_West,
278
279 PCS_NAD27_Idaho_East, Proj_Idaho_CS27_East,
280 PCS_NAD27_Idaho_Central, Proj_Idaho_CS27_Central,
281 PCS_NAD27_Idaho_West, Proj_Idaho_CS27_West,
282
283 PCS_NAD27_Illinois_East, Proj_Illinois_CS27_East,
284 PCS_NAD27_Illinois_West, Proj_Illinois_CS27_West,
285
286 PCS_NAD27_Indiana_East, Proj_Indiana_CS27_East,
287 PCS_NAD27_Indiana_West, Proj_Indiana_CS27_West,
288
289 PCS_NAD27_Iowa_North, Proj_Iowa_CS27_North,
290 PCS_NAD27_Iowa_South, Proj_Iowa_CS27_South,
291
292 PCS_NAD27_Kansas_North, Proj_Kansas_CS27_North,
293 PCS_NAD27_Kansas_South, Proj_Kansas_CS27_South,
294
295 PCS_NAD27_Kentucky_North, Proj_Kentucky_CS27_North,
296 PCS_NAD27_Kentucky_South, Proj_Kentucky_CS27_South,
297
298 PCS_NAD27_Louisiana_North, Proj_Louisiana_CS27_North,
299 PCS_NAD27_Louisiana_South, Proj_Louisiana_CS27_South,
300
301 PCS_NAD27_Maine_East, Proj_Maine_CS27_East,
302 PCS_NAD27_Maine_West, Proj_Maine_CS27_West,
303
304 PCS_NAD27_Maryland, Proj_Maryland_CS27,
305
306 PCS_NAD27_Massachusetts, Proj_Massachusetts_CS27_Mainland,
307 PCS_NAD27_Massachusetts_Is, Proj_Massachusetts_CS27_Island,
308
309 PCS_NAD27_Michigan_North, Proj_Michigan_CS27_North,
310 PCS_NAD27_Michigan_Central, Proj_Michigan_CS27_Central,
311 PCS_NAD27_Michigan_South, Proj_Michigan_CS27_South,
312
313 PCS_NAD27_Minnesota_North, Proj_Minnesota_CS27_North,
314 PCS_NAD27_Minnesota_Cent, Proj_Minnesota_CS27_Central,
315 PCS_NAD27_Minnesota_South, Proj_Minnesota_CS27_South,
316
317 PCS_NAD27_Mississippi_East, Proj_Mississippi_CS27_East,
318 PCS_NAD27_Mississippi_West, Proj_Mississippi_CS27_West,
319
320 PCS_NAD27_Missouri_East, Proj_Missouri_CS27_East,
321 PCS_NAD27_Missouri_Central, Proj_Missouri_CS27_Central,
322 PCS_NAD27_Missouri_West, Proj_Missouri_CS27_West,
323
324 PCS_NAD27_Montana_North, Proj_Montana_CS27_North,
325 PCS_NAD27_Montana_Central, Proj_Montana_CS27_Central,
326 PCS_NAD27_Montana_South, Proj_Montana_CS27_South,
327
328 PCS_NAD27_Nebraska_North, Proj_Nebraska_CS27_North,
329 PCS_NAD27_Nebraska_South, Proj_Nebraska_CS27_South,
330
331 PCS_NAD27_Nevada_East, Proj_Nevada_CS27_East,
332 PCS_NAD27_Nevada_Central, Proj_Nevada_CS27_Central,
333 PCS_NAD27_Nevada_West, Proj_Nevada_CS27_West,
334
335 PCS_NAD27_New_Hampshire, Proj_New_Hampshire_CS27,
336
337 PCS_NAD27_New_Jersey, Proj_New_Jersey_CS27,
338
339 PCS_NAD27_New_Mexico_East, Proj_New_Mexico_CS27_East,
340 PCS_NAD27_New_Mexico_Cent, Proj_New_Mexico_CS27_Central,
341 PCS_NAD27_New_Mexico_West, Proj_New_Mexico_CS27_West,
342
343 PCS_NAD27_New_York_East, Proj_New_York_CS27_East,
344 PCS_NAD27_New_York_Central, Proj_New_York_CS27_Central,
345 PCS_NAD27_New_York_West, Proj_New_York_CS27_West,
346 PCS_NAD27_New_York_Long_Is, Proj_New_York_CS27_Long_Island,
347
348 PCS_NAD27_North_Carolina, Proj_North_Carolina_CS27,
349
350 PCS_NAD27_North_Dakota_N, Proj_North_Dakota_CS27_North,
351 PCS_NAD27_North_Dakota_S, Proj_North_Dakota_CS27_South,
352
353 PCS_NAD27_Ohio_North, Proj_Ohio_CS27_North,
354 PCS_NAD27_Ohio_South, Proj_Ohio_CS27_South,
355
356 PCS_NAD27_Oklahoma_North, Proj_Oklahoma_CS27_North,
357 PCS_NAD27_Oklahoma_South, Proj_Oklahoma_CS27_South,
358
359 PCS_NAD27_Oregon_North, Proj_Oregon_CS27_North,
360 PCS_NAD27_Oregon_South, Proj_Oregon_CS27_South,
361
362 PCS_NAD27_Pennsylvania_N, Proj_Pennsylvania_CS27_North,
363 PCS_NAD27_Pennsylvania_S, Proj_Pennsylvania_CS27_South,
364
365 PCS_NAD27_Rhode_Island, Proj_Rhode_Island_CS27,
366
367 PCS_NAD27_South_Carolina_N, Proj_South_Carolina_CS27_North,
368 PCS_NAD27_South_Carolina_S, Proj_South_Carolina_CS27_South,
369
370 PCS_NAD27_South_Dakota_N, Proj_South_Dakota_CS27_North,
371 PCS_NAD27_South_Dakota_S, Proj_South_Dakota_CS27_South,
372
373 PCS_NAD27_Tennessee, Proj_Tennessee_CS27,
374
375 PCS_NAD27_Texas_North, Proj_Texas_CS27_North,
376 PCS_NAD27_Texas_North_Cen, Proj_Texas_CS27_North_Central,
377 PCS_NAD27_Texas_Central, Proj_Texas_CS27_Central,
378 PCS_NAD27_Texas_South_Cen, Proj_Texas_CS27_South_Central,
379 PCS_NAD27_Texas_South, Proj_Texas_CS27_South,
380
381 PCS_NAD27_Utah_North, Proj_Utah_CS27_North,
382 PCS_NAD27_Utah_Central, Proj_Utah_CS27_Central,
383 PCS_NAD27_Utah_South, Proj_Utah_CS27_South,
384
385 PCS_NAD27_Vermont, Proj_Vermont_CS27,
386
387 PCS_NAD27_Virginia_North, Proj_Virginia_CS27_North,
388 PCS_NAD27_Virginia_South, Proj_Virginia_CS27_South,
389
390 PCS_NAD27_Washington_North, Proj_Washington_CS27_North,
391 PCS_NAD27_Washington_South, Proj_Washington_CS27_South,
392
393 PCS_NAD27_West_Virginia_N, Proj_West_Virginia_CS27_North,
394 PCS_NAD27_West_Virginia_S, Proj_West_Virginia_CS27_South,
395
396 PCS_NAD27_Wisconsin_North, Proj_Wisconsin_CS27_North,
397 PCS_NAD27_Wisconsin_Cen, Proj_Wisconsin_CS27_Central,
398 PCS_NAD27_Wisconsin_South, Proj_Wisconsin_CS27_South,
399
400 PCS_NAD27_Wyoming_East, Proj_Wyoming_CS27_East,
401 PCS_NAD27_Wyoming_E_Cen, Proj_Wyoming_CS27_East_Central,
402 PCS_NAD27_Wyoming_W_Cen, Proj_Wyoming_CS27_West_Central,
403 PCS_NAD27_Wyoming_West, Proj_Wyoming_CS27_West,
404
405 PCS_NAD27_Puerto_Rico, Proj_Puerto_Rico_CS27,
406
407 KvUserDefined
408 };
409
410 /************************************************************************/
411 /* GTIFMapSysToPCS() */
412 /* */
413 /* Given a Datum, MapSys and zone value generate the best PCS */
414 /* code possible. */
415 /************************************************************************/
416
417 int GTIFMapSysToPCS( int MapSys, int Datum, int nZone )
418
419 {
420 int PCSCode = KvUserDefined;
421
422 if( MapSys == MapSys_UTM_North )
423 {
424 if( Datum == GCS_NAD27 )
425 PCSCode = PCS_NAD27_UTM_zone_3N + nZone - 3;
426 else if( Datum == GCS_NAD83 )
427 PCSCode = PCS_NAD83_UTM_zone_3N + nZone - 3;
428 else if( Datum == GCS_WGS_72 )
429 PCSCode = PCS_WGS72_UTM_zone_1N + nZone - 1;
430 else if( Datum == GCS_WGS_72BE )
431 PCSCode = PCS_WGS72BE_UTM_zone_1N + nZone - 1;
432 else if( Datum == GCS_WGS_84 )
433 PCSCode = PCS_WGS84_UTM_zone_1N + nZone - 1;
434 }
435 else if( MapSys == MapSys_UTM_South )
436 {
437 if( Datum == GCS_WGS_72 )
438 PCSCode = PCS_WGS72_UTM_zone_1S + nZone - 1;
439 else if( Datum == GCS_WGS_72BE )
440 PCSCode = PCS_WGS72BE_UTM_zone_1S + nZone - 1;
441 else if( Datum == GCS_WGS_84 )
442 PCSCode = PCS_WGS84_UTM_zone_1S + nZone - 1;
443 }
444 else if( MapSys == MapSys_State_Plane_27 )
445 {
446 int i;
447
448 PCSCode = 10000 + nZone;
449 for( i = 0; StatePlaneTable[i] != KvUserDefined; i += 2 )
450 {
451 if( StatePlaneTable[i+1] == PCSCode )
452 PCSCode = StatePlaneTable[i];
453 }
454
455 /* Old EPSG code was in error for Tennesse CS27, override */
456 if( nZone == 4100 )
457 PCSCode = 2204;
458 }
459 else if( MapSys == MapSys_State_Plane_83 )
460 {
461 int i;
462
463 PCSCode = 10000 + nZone + 30;
464
465 for( i = 0; StatePlaneTable[i] != KvUserDefined; i += 2 )
466 {
467 if( StatePlaneTable[i+1] == PCSCode )
468 PCSCode = StatePlaneTable[i];
469 }
470
471 /* Old EPSG code was in error for Kentucky North CS83, override */
472 if( nZone == 1601 )
473 PCSCode = 2205;
474 }
475
476 return( PCSCode );
477 }
478
479 /************************************************************************/
480 /* GTIFMapSysToProj() */
481 /* */
482 /* Given a MapSys and zone value generate the best Proj_ */
483 /* code possible. */
484 /************************************************************************/
485
486 int GTIFMapSysToProj( int MapSys, int nZone )
487
488 {
489 int ProjCode = KvUserDefined;
490
491 if( MapSys == MapSys_UTM_North )
492 {
493 ProjCode = Proj_UTM_zone_1N + nZone - 1;
494 }
495 else if( MapSys == MapSys_UTM_South )
496 {
497 ProjCode = Proj_UTM_zone_1S + nZone - 1;
498 }
499 else if( MapSys == MapSys_State_Plane_27 )
500 {
501 ProjCode = 10000 + nZone;
502
503 /* Tennesse override */
504 if( nZone == 4100 )
505 ProjCode = 15302;
506 }
507 else if( MapSys == MapSys_State_Plane_83 )
508 {
509 ProjCode = 10000 + nZone + 30;
510
511 /* Kentucky North override */
512 if( nZone == 1601 )
513 ProjCode = 15303;
514 }
515
516 return( ProjCode );
517 }
518
519 /************************************************************************/
520 /* GTIFPCSToMapSys() */
521 /************************************************************************/
522
523 /**
524 * Translate a PCS_ code into a UTM or State Plane map system, a datum,
525 * and a zone if possible.
526 *
527 * @param PCSCode The projection code (PCS_*) as would be stored in the
528 * ProjectedCSTypeGeoKey of a GeoTIFF file.
529 *
530 * @param pDatum Pointer to an integer into which the datum code (GCS_*)
531 * is put if the function succeeds.
532 *
533 * @param pZone Pointer to an integer into which the zone will be placed
534 * if the function is successful.
535 *
536 * @return Returns either MapSys_UTM_North, MapSys_UTM_South,
537 * MapSys_State_Plane_83, MapSys_State_Plane_27 or KvUserDefined.
538 * KvUserDefined indicates that the
539 * function failed to recognise the projection as UTM or State Plane.
540 *
541 * The zone value is only set if the return code is other than KvUserDefined.
542 * For utm map system the returned zone will be between 1 and 60. For
543 * State Plane, the USGS state plane zone number is returned. For instance,
544 * Alabama East is zone 101.
545 *
546 * The datum (really this is the GCS) is set to a GCS_ value such as GCS_NAD27.
547 *
548 * This function is useful to recognise (most) UTM and State Plane coordinate
549 * systems, even if CSV files aren't available to translate them automatically.
550 * It is used as a fallback mechanism by GTIFGetDefn() for normalization when
551 * CSV files aren't found.
552 */
553
554 int GTIFPCSToMapSys( int PCSCode, int * pDatum, int * pZone )
555
556 {
557 int Datum = KvUserDefined, Proj = KvUserDefined;
558 int nZone = KvUserDefined, i;
559
560 /* -------------------------------------------------------------------- */
561 /* UTM with various datums. Note there are lots of PCS UTM */
562 /* codes not done yet which use strange datums. */
563 /* -------------------------------------------------------------------- */
564 if( PCSCode >= PCS_NAD27_UTM_zone_3N && PCSCode <= PCS_NAD27_UTM_zone_22N )
565 {
566 Datum = GCS_NAD27;
567 Proj = MapSys_UTM_North;
568 nZone = PCSCode - PCS_NAD27_UTM_zone_3N + 3;
569 }
570 else if( PCSCode >= PCS_NAD83_UTM_zone_3N
571 && PCSCode <= PCS_NAD83_UTM_zone_23N )
572 {
573 Datum = GCS_NAD83;
574 Proj = MapSys_UTM_North;
575 nZone = PCSCode - PCS_NAD83_UTM_zone_3N + 3;
576 }
577
578 else if( PCSCode >= PCS_WGS72_UTM_zone_1N
579 && PCSCode <= PCS_WGS72_UTM_zone_60N )
580 {
581 Datum = GCS_WGS_72;
582 Proj = MapSys_UTM_North;
583 nZone = PCSCode - PCS_WGS72_UTM_zone_1N + 1;
584 }
585 else if( PCSCode >= PCS_WGS72_UTM_zone_1S
586 && PCSCode <= PCS_WGS72_UTM_zone_60S )
587 {
588 Datum = GCS_WGS_72;
589 Proj = MapSys_UTM_South;
590 nZone = PCSCode - PCS_WGS72_UTM_zone_1S + 1;
591 }
592
593 else if( PCSCode >= PCS_WGS72BE_UTM_zone_1N
594 && PCSCode <= PCS_WGS72BE_UTM_zone_60N )
595 {
596 Datum = GCS_WGS_72BE;
597 Proj = MapSys_UTM_North;
598 nZone = PCSCode - PCS_WGS72BE_UTM_zone_1N + 1;
599 }
600 else if( PCSCode >= PCS_WGS72BE_UTM_zone_1S
601 && PCSCode <= PCS_WGS72BE_UTM_zone_60S )
602 {
603 Datum = GCS_WGS_72BE;
604 Proj = MapSys_UTM_South;
605 nZone = PCSCode - PCS_WGS72BE_UTM_zone_1S + 1;
606 }
607
608 else if( PCSCode >= PCS_WGS84_UTM_zone_1N
609 && PCSCode <= PCS_WGS84_UTM_zone_60N )
610 {
611 Datum = GCS_WGS_84;
612 Proj = MapSys_UTM_North;
613 nZone = PCSCode - PCS_WGS84_UTM_zone_1N + 1;
614 }
615 else if( PCSCode >= PCS_WGS84_UTM_zone_1S
616 && PCSCode <= PCS_WGS84_UTM_zone_60S )
617 {
618 Datum = GCS_WGS_84;
619 Proj = MapSys_UTM_South;
620 nZone = PCSCode - PCS_WGS84_UTM_zone_1S + 1;
621 }
622 else if( PCSCode >= PCS_SAD69_UTM_zone_18N
623 && PCSCode <= PCS_SAD69_UTM_zone_22N )
624 {
625 Datum = KvUserDefined;
626 Proj = MapSys_UTM_North;
627 nZone = PCSCode - PCS_SAD69_UTM_zone_18N + 18;
628 }
629 else if( PCSCode >= PCS_SAD69_UTM_zone_17S
630 && PCSCode <= PCS_SAD69_UTM_zone_25S )
631 {
632 Datum = KvUserDefined;
633 Proj = MapSys_UTM_South;
634 nZone = PCSCode - PCS_SAD69_UTM_zone_17S + 17;
635 }
636
637 /* -------------------------------------------------------------------- */
638 /* State Plane zones, first we translate any PCS_ codes to */
639 /* a Proj_ code that we can get a handle on. */
640 /* -------------------------------------------------------------------- */
641 for( i = 0; StatePlaneTable[i] != KvUserDefined; i += 2 )
642 {
643 if( StatePlaneTable[i] == PCSCode )
644 PCSCode = StatePlaneTable[i+1];
645 }
646
647 if( PCSCode <= 15900 && PCSCode >= 10000 )
648 {
649 if( (PCSCode % 100) >= 30 )
650 {
651 Proj = MapSys_State_Plane_83;
652 Datum = GCS_NAD83;
653 }
654 else
655 {
656 Proj = MapSys_State_Plane_27;
657 Datum = GCS_NAD27;
658 }
659
660 nZone = PCSCode - 10000;
661 if( Datum == GCS_NAD83 )
662 nZone -= 30;
663 }
664
665 if( pDatum != NULL )
666 *pDatum = Datum;
667
668 if( pZone != NULL )
669 *pZone = nZone;
670
671 return( Proj );
672 }
673
674 /************************************************************************/
675 /* GTIFProjToMapSys() */
676 /************************************************************************/
677
678 /**
679 * Translate a Proj_ code into a UTM or State Plane map system, and a zone
680 * if possible.
681 *
682 * @param ProjCode The projection code (Proj_*) as would be stored in the
683 * ProjectionGeoKey of a GeoTIFF file.
684 * @param pZone Pointer to an integer into which the zone will be placed
685 * if the function is successful.
686 *
687 * @return Returns either MapSys_UTM_North, MapSys_UTM_South,
688 * MapSys_State_Plane_27, MapSys_State_Plane_83 or KvUserDefined.
689 * KvUserDefined indicates that the
690 * function failed to recognise the projection as UTM or State Plane.
691 *
692 * The zone value is only set if the return code is other than KvUserDefined.
693 * For utm map system the returned zone will be between 1 and 60. For
694 * State Plane, the USGS state plane zone number is returned. For instance,
695 * Alabama East is zone 101.
696 *
697 * This function is useful to recognise UTM and State Plane coordinate
698 * systems, and to extract zone numbers so the projections can be
699 * represented as UTM rather than as the underlying projection method such
700 * Transverse Mercator for instance.
701 */
702
703 int GTIFProjToMapSys( int ProjCode, int * pZone )
704
705 {
706 int nZone = KvUserDefined;
707 int MapSys = KvUserDefined;
708
709 /* -------------------------------------------------------------------- */
710 /* Handle UTM. */
711 /* -------------------------------------------------------------------- */
712 if( ProjCode >= Proj_UTM_zone_1N && ProjCode <= Proj_UTM_zone_60N )
713 {
714 MapSys = MapSys_UTM_North;
715 nZone = ProjCode - Proj_UTM_zone_1N + 1;
716 }
717 else if( ProjCode >= Proj_UTM_zone_1S && ProjCode <= Proj_UTM_zone_60S )
718 {
719 MapSys = MapSys_UTM_South;
720 nZone = ProjCode - Proj_UTM_zone_1S + 1;
721 }
722
723 /* -------------------------------------------------------------------- */
724 /* Handle State Plane. I think there are some anomolies in */
725 /* here, so this is a bit risky. */
726 /* -------------------------------------------------------------------- */
727 else if( ProjCode >= 10101 && ProjCode <= 15299 )
728 {
729 if( ProjCode % 100 >= 30 )
730 {
731 MapSys = MapSys_State_Plane_83;
732 nZone = ProjCode - 10000 - 30;
733 }
734 else
735 {
736 MapSys = MapSys_State_Plane_27;
737 nZone = ProjCode - 10000;
738 }
739 }
740
741 if( pZone != NULL )
742 *pZone = nZone;
743
744 return( MapSys );
745 }
746
0 /**********************************************************************
1 *
2 * geo_free.c -- Public routines for GEOTIFF GeoKey access.
3 *
4 * Written By: Niles D. Ritter.
5 *
6 * copyright (c) 1995 Niles D. Ritter
7 *
8 * Permission granted to use this software, so long as this copyright
9 * notice accompanies any products derived therefrom.
10 *
11 **********************************************************************/
12
13 #include "geotiff.h" /* public interface */
14 #include "geo_tiffp.h" /* external TIFF interface */
15 #include "geo_keyp.h" /* private interface */
16
17
18 /**********************************************************************
19 *
20 * Public Routines
21 *
22 **********************************************************************/
23
24 /**
25
26 This function deallocates an existing GeoTIFF access handle previously
27 created with GTIFNew(). If the handle was
28 used to write GeoTIFF keys to the TIFF file, the
29 GTIFWriteKeys() function should be used
30 to flush results to the file before calling GTIFFree(). GTIFFree()
31 should be called before XTIFFClose() is
32 called on the corresponding TIFF file handle.<p>
33
34 */
35
36 void GTIFFree(GTIF* gtif)
37 {
38 int i;
39
40 if (!gtif) return;
41
42 /* Free parameter arrays */
43 if (gtif->gt_double) _GTIFFree (gtif->gt_double);
44 if (gtif->gt_short) _GTIFFree (gtif->gt_short);
45
46 /* Free GeoKey arrays */
47 if (gtif->gt_keys)
48 {
49 for (i = 0; i < MAX_KEYS; i++)
50 {
51 if (gtif->gt_keys[i].gk_type == TYPE_ASCII)
52 {
53 _GTIFFree (gtif->gt_keys[i].gk_data);
54 }
55 }
56 _GTIFFree (gtif->gt_keys);
57 }
58 if (gtif->gt_keyindex) _GTIFFree (gtif->gt_keyindex);
59
60 _GTIFFree (gtif);
61 }
0 /**********************************************************************
1 *
2 * geo_get.c -- Public routines for GEOTIFF GeoKey access.
3 *
4 * Written By: Niles D. Ritter.
5 *
6 * copyright (c) 1995 Niles D. Ritter
7 *
8 * Permission granted to use this software, so long as this copyright
9 * notice accompanies any products derived therefrom.
10 *
11 * Revision History;
12 *
13 * 20 June, 1995 Niles D. Ritter New
14 * 3 July, 1995 Greg Martin Fix strings and index
15 * 6 July, 1995 Niles D. Ritter Unfix indexing.
16 *
17 **********************************************************************/
18
19 #include "geotiff.h" /* public interface */
20 #include "geo_tiffp.h" /* external TIFF interface */
21 #include "geo_keyp.h" /* private interface */
22
23 /* return the Header info of this geotiff file */
24
25 void GTIFDirectoryInfo(GTIF *gtif, int version[3], int *keycount)
26 {
27 if (version)
28 {
29 version[0] = gtif->gt_version;
30 version[1] = gtif->gt_rev_major;
31 version[2] = gtif->gt_rev_minor;
32 }
33 if (keycount) *keycount = gtif->gt_num_keys;
34 }
35
36
37 int GTIFKeyInfo(GTIF *gtif, geokey_t key, int *size, tagtype_t* type)
38 {
39 int index = gtif->gt_keyindex[ key ];
40 GeoKey *keyptr;
41
42 if (!index) return 0;
43
44 keyptr = gtif->gt_keys + index;
45 if (size) *size = (int) keyptr->gk_size;
46 if (type) *type = keyptr->gk_type;
47
48 return keyptr->gk_count;
49 }
50
51 /**
52
53 This function reads the value of a single GeoKey from a GeoTIFF file.
54
55 @param gtif The geotiff information handle from GTIFNew().
56
57 @param thekey The geokey_t name (such as ProjectedCSTypeGeoKey).
58 This must come from the list of legal geokey_t values
59 (an enumeration) listed below.
60
61 @param val The <b>val</b> argument is a pointer to the
62 variable into which the value should be read. The type of the variable
63 varies depending on the geokey_t given. While there is no ready mapping
64 of geokey_t values onto types, in general code values are of type <i>short</i>,
65 citations are strings, and everything else is of type <i>double</i>. Note
66 that pointer's to <i>int</i> should never be passed to GTIFKeyGet() for
67 integer values as they will be shorts, and the int's may not be properly
68 initialized (and will be grossly wrong on MSB systems).
69
70 @param index Indicates how far into the list of values
71 for this geokey to offset. Should normally be zero.
72
73 @param count Indicates how many values
74 to read. At this time all keys except for strings have only one value,
75 so <b>index</b> should be zero, and <b>count</b> should be one.
76
77 @return The GTIFKeyGet() function returns the number of values read. Normally
78 this would be one if successful or zero if the key doesn't exist for this
79 file.
80
81 From geokeys.inc we see the following geokey_t values are possible:<p>
82
83 <pre>
84 -- 6.2.1 GeoTIFF Configuration Keys --
85
86 ValuePair( GTModelTypeGeoKey, 1024) -- Section 6.3.1.1 Codes --
87 ValuePair( GTRasterTypeGeoKey, 1025) -- Section 6.3.1.2 Codes --
88 ValuePair( GTCitationGeoKey, 1026) -- documentation --
89
90 -- 6.2.2 Geographic CS Parameter Keys --
91
92 ValuePair( GeographicTypeGeoKey, 2048) -- Section 6.3.2.1 Codes --
93 ValuePair( GeogCitationGeoKey, 2049) -- documentation --
94 ValuePair( GeogGeodeticDatumGeoKey, 2050) -- Section 6.3.2.2 Codes --
95 ValuePair( GeogPrimeMeridianGeoKey, 2051) -- Section 6.3.2.4 codes --
96 ValuePair( GeogLinearUnitsGeoKey, 2052) -- Section 6.3.1.3 Codes --
97 ValuePair( GeogLinearUnitSizeGeoKey, 2053) -- meters --
98 ValuePair( GeogAngularUnitsGeoKey, 2054) -- Section 6.3.1.4 Codes --
99 ValuePair( GeogAngularUnitSizeGeoKey, 2055) -- radians --
100 ValuePair( GeogEllipsoidGeoKey, 2056) -- Section 6.3.2.3 Codes --
101 ValuePair( GeogSemiMajorAxisGeoKey, 2057) -- GeogLinearUnits --
102 ValuePair( GeogSemiMinorAxisGeoKey, 2058) -- GeogLinearUnits --
103 ValuePair( GeogInvFlatteningGeoKey, 2059) -- ratio --
104 ValuePair( GeogAzimuthUnitsGeoKey, 2060) -- Section 6.3.1.4 Codes --
105 ValuePair( GeogPrimeMeridianLongGeoKey, 2061) -- GeoAngularUnit --
106
107 -- 6.2.3 Projected CS Parameter Keys --
108 -- Several keys have been renamed,--
109 -- and the deprecated names aliased for backward compatibility --
110
111 ValuePair( ProjectedCSTypeGeoKey, 3072) -- Section 6.3.3.1 codes --
112 ValuePair( PCSCitationGeoKey, 3073) -- documentation --
113 ValuePair( ProjectionGeoKey, 3074) -- Section 6.3.3.2 codes --
114 ValuePair( ProjCoordTransGeoKey, 3075) -- Section 6.3.3.3 codes --
115 ValuePair( ProjLinearUnitsGeoKey, 3076) -- Section 6.3.1.3 codes --
116 ValuePair( ProjLinearUnitSizeGeoKey, 3077) -- meters --
117 ValuePair( ProjStdParallel1GeoKey, 3078) -- GeogAngularUnit --
118 ValuePair( ProjStdParallelGeoKey,ProjStdParallel1GeoKey) -- ** alias ** --
119 ValuePair( ProjStdParallel2GeoKey, 3079) -- GeogAngularUnit --
120 ValuePair( ProjNatOriginLongGeoKey, 3080) -- GeogAngularUnit --
121 ValuePair( ProjOriginLongGeoKey,ProjNatOriginLongGeoKey) -- ** alias ** --
122 ValuePair( ProjNatOriginLatGeoKey, 3081) -- GeogAngularUnit --
123 ValuePair( ProjOriginLatGeoKey,ProjNatOriginLatGeoKey) -- ** alias ** --
124 ValuePair( ProjFalseEastingGeoKey, 3082) -- ProjLinearUnits --
125 ValuePair( ProjFalseNorthingGeoKey, 3083) -- ProjLinearUnits --
126 ValuePair( ProjFalseOriginLongGeoKey, 3084) -- GeogAngularUnit --
127 ValuePair( ProjFalseOriginLatGeoKey, 3085) -- GeogAngularUnit --
128 ValuePair( ProjFalseOriginEastingGeoKey, 3086) -- ProjLinearUnits --
129 ValuePair( ProjFalseOriginNorthingGeoKey, 3087) -- ProjLinearUnits --
130 ValuePair( ProjCenterLongGeoKey, 3088) -- GeogAngularUnit --
131 ValuePair( ProjCenterLatGeoKey, 3089) -- GeogAngularUnit --
132 ValuePair( ProjCenterEastingGeoKey, 3090) -- ProjLinearUnits --
133 ValuePair( ProjCenterNorthingGeoKey, 3091) -- ProjLinearUnits --
134 ValuePair( ProjScaleAtNatOriginGeoKey, 3092) -- ratio --
135 ValuePair( ProjScaleAtOriginGeoKey,ProjScaleAtNatOriginGeoKey) -- ** alias ** --
136 ValuePair( ProjScaleAtCenterGeoKey, 3093) -- ratio --
137 ValuePair( ProjAzimuthAngleGeoKey, 3094) -- GeogAzimuthUnit --
138 ValuePair( ProjStraightVertPoleLongGeoKey, 3095) -- GeogAngularUnit --
139
140 6.2.4 Vertical CS Keys
141
142 ValuePair( VerticalCSTypeGeoKey, 4096) -- Section 6.3.4.1 codes --
143 ValuePair( VerticalCitationGeoKey, 4097) -- documentation --
144 ValuePair( VerticalDatumGeoKey, 4098) -- Section 6.3.4.2 codes --
145 ValuePair( VerticalUnitsGeoKey, 4099) -- Section 6.3.1 (.x) codes --
146 </pre>
147 */
148
149 int GTIFKeyGet(GTIF *gtif, geokey_t thekey, void *val, int index, int count)
150 {
151 int kindex = gtif->gt_keyindex[ thekey ];
152 GeoKey *key;
153 gsize_t size;
154 char *data;
155 tagtype_t type;
156
157 if (!kindex) return 0;
158
159 key = gtif->gt_keys+kindex;
160 if (!count) count = key->gk_count - index;
161 if (count <=0) return 0;
162 if (count > key->gk_count) count = key->gk_count;
163 size = key->gk_size;
164 type = key->gk_type;
165
166 if (count==1 && type==TYPE_SHORT) data = (char *)&key->gk_data;
167 else data = key->gk_data;
168
169 _GTIFmemcpy( val, data + index*size, count*size );
170
171 if (type==TYPE_ASCII)
172 ((char *)val)[count-1] = '\0'; /* replace last char with NULL */
173
174 return count;
175 }
0 /**********************************************************************
1 *
2 * geo_keyp.h - private interface for GeoTIFF geokey tag parsing
3 *
4 * Written by: Niles D. Ritter
5 *
6 **********************************************************************/
7
8 #ifndef __geo_keyp_h_
9 #define __geo_keyp_h_
10
11 #include <stdlib.h> /* for size_t */
12
13 /*
14 * This structure contains the internal program
15 * representation of the key entry.
16 */
17 struct GeoKey {
18 int gk_key; /* GeoKey ID */
19 size_t gk_size; /* data byte size */
20 tagtype_t gk_type; /* TIFF data type */
21 long gk_count; /* number of values */
22 char* gk_data; /* pointer to data, or value */
23 };
24 typedef struct GeoKey GeoKey;
25
26 /*
27 * This structure represents the file-organization of
28 * the key entry. Note that it assumes that short entries
29 * are aligned along 2-byte boundaries.
30 */
31 struct KeyEntry {
32 pinfo_t ent_key; /* GeoKey ID */
33 pinfo_t ent_location; /* TIFF Tag ID or 0 */
34 pinfo_t ent_count; /* GeoKey value count */
35 pinfo_t ent_val_offset; /* value or tag offset */
36 };
37 typedef struct KeyEntry KeyEntry;
38
39 /*
40 * This is the header of the CoordSystemInfoTag. The 'Version'
41 * will only change if the CoorSystemInfoTag structure changes;
42 * The Major Revision will be incremented whenever a new set of
43 * Keys is added or changed, while the Minor revision will be
44 * incremented when only the set of Key-values is increased.
45 */
46 struct KeyHeader{
47 pinfo_t hdr_version; /* GeoTIFF Version */
48 pinfo_t hdr_rev_major; /* GeoKey Major Revision # */
49 pinfo_t hdr_rev_minor; /* GeoKey Minor Revision # */
50 pinfo_t hdr_num_keys; /* Number of GeoKeys */
51 };
52 typedef struct KeyHeader KeyHeader;
53
54 /*
55 * This structure holds temporary data while reading or writing
56 * the tags.
57 */
58 struct TempKeyData {
59 char *tk_asciiParams;
60 int tk_asciiParamsLength;
61 int tk_asciiParamsOffset;
62 };
63 typedef struct TempKeyData TempKeyData;
64
65
66 struct gtiff {
67 tiff_t* gt_tif; /* TIFF file descriptor */
68 TIFFMethod gt_methods; /* TIFF i/o methods */
69 int gt_flags; /* file flags */
70
71 pinfo_t gt_version; /* GeoTIFF Version */
72 pinfo_t gt_rev_major;/* GeoKey Key Revision */
73 pinfo_t gt_rev_minor;/* GeoKey Code Revision */
74
75 int gt_num_keys; /* number of keys */
76 GeoKey* gt_keys; /* array of keys */
77 int* gt_keyindex; /* index of a key, if set*/
78 int gt_keymin; /* smallest key set */
79 int gt_keymax; /* largest key set */
80
81 pinfo_t* gt_short; /* array of SHORT vals */
82 double* gt_double; /* array of DOUBLE vals */
83 int gt_nshorts; /* number of SHORT vals */
84 int gt_ndoubles; /* number of DOUBLE vals */
85 };
86
87 typedef enum {
88 FLAG_FILE_OPEN=1,
89 FLAG_FILE_MODIFIED=2
90 } gtiff_flags;
91
92 #define MAX_KEYINDEX 65535 /* largest possible key */
93 #define MAX_KEYS 100 /* maximum keys in a file */
94 #define MAX_VALUES 1000 /* maximum values in a tag */
95
96 #endif /* __geo_keyp_h_ */
97
0 /*
1 * geo_names.c
2 *
3 * This encapsulates all of the value-naming mechanism of
4 * libgeotiff.
5 *
6 * Written By: Niles Ritter
7 */
8
9 #include "geotiffio.h"
10 #include "geonames.h"
11 #include "geo_tiffp.h" /* for tag names */
12
13 static KeyInfo _formatInfo[] = {
14 {TYPE_BYTE, "Byte"},
15 {TYPE_SHORT, "Short"},
16 {TYPE_LONG, "Long"},
17 {TYPE_RATIONAL,"Rational"},
18 {TYPE_ASCII, "Ascii"},
19 {TYPE_FLOAT, "Float"},
20 {TYPE_DOUBLE, "Double"},
21 {TYPE_SBYTE, "SignedByte"},
22 {TYPE_SSHORT, "SignedShort"},
23 {TYPE_SLONG, "SignedLong"},
24 {TYPE_UNKNOWN, "Unknown"},
25 END_LIST
26 };
27
28 static KeyInfo _tagInfo[] = {
29 {GTIFF_PIXELSCALE, "ModelPixelScaleTag"},
30 {GTIFF_TRANSMATRIX, "ModelTransformationTag"},
31 {GTIFF_TIEPOINTS, "ModelTiepointTag"},
32 /* This alias maps the Intergraph symbol to the current tag */
33 {GTIFF_TRANSMATRIX, "IntergraphMatrixTag"},
34 END_LIST
35 };
36
37 static char *FindName(KeyInfo *info,int key)
38 {
39 static char errmsg[80];
40
41 while (info->ki_key>=0 && info->ki_key != key) info++;
42
43 if (info->ki_key<0)
44 {
45 sprintf(errmsg,"Unknown-%d", key );
46 return errmsg;
47 }
48 return info->ki_name;
49 }
50
51 char *GTIFKeyName(geokey_t key)
52 {
53 return FindName( &_keyInfo[0],key);
54 }
55
56 char *GTIFTypeName(tagtype_t type)
57 {
58 return FindName( &_formatInfo[0],type);
59 }
60
61 char *GTIFTagName(int tag)
62 {
63 return FindName( &_tagInfo[0],tag);
64 }
65
66 char *GTIFValueName(geokey_t key, int value)
67 {
68 KeyInfo *info;
69
70 switch (key)
71 {
72 /* All codes using linear/angular/whatever units */
73 case GeogLinearUnitsGeoKey:
74 case ProjLinearUnitsGeoKey:
75 case GeogAngularUnitsGeoKey:
76 case GeogAzimuthUnitsGeoKey:
77 info=_geounitsValue; break;
78
79 /* put other key-dependent lists here */
80 case GTModelTypeGeoKey: info=_modeltypeValue; break;
81 case GTRasterTypeGeoKey: info=_rastertypeValue; break;
82 case GeographicTypeGeoKey: info=_geographicValue; break;
83 case GeogGeodeticDatumGeoKey: info=_geodeticdatumValue; break;
84 case GeogEllipsoidGeoKey: info=_ellipsoidValue; break;
85 case GeogPrimeMeridianGeoKey: info=_primemeridianValue; break;
86 case ProjectedCSTypeGeoKey: info=_pcstypeValue; break;
87 case ProjectionGeoKey: info=_projectionValue; break;
88 case ProjCoordTransGeoKey: info=_coordtransValue; break;
89 case VerticalCSTypeGeoKey: info=_vertcstypeValue; break;
90 case VerticalDatumGeoKey: info=_vdatumValue; break;
91
92 /* And if all else fails... */
93 default: info = _csdefaultValue;break;
94 }
95
96 return FindName( info,value);
97 }
98
99 /*
100 * Inverse Utilities (name->code)
101 */
102
103
104 static int FindCode(KeyInfo *info,char *key)
105 {
106 while (info->ki_key>=0 && strcmp(info->ki_name,key) ) info++;
107
108 if (info->ki_key<0)
109 {
110 /* not a registered key; might be generic code */
111 if (!strncmp(key,"Unknown-",8))
112 {
113 int code=-1;
114 sscanf(key,"Unknown-%d",&code);
115 return code;
116 }
117 else return -1;
118 }
119 return info->ki_key;
120 }
121
122 int GTIFKeyCode(char *key)
123 {
124 return FindCode( &_keyInfo[0],key);
125 }
126
127 int GTIFTypeCode(char *type)
128 {
129 return FindCode( &_formatInfo[0],type);
130 }
131
132 int GTIFTagCode(char *tag)
133 {
134 return FindCode( &_tagInfo[0],tag);
135 }
136
137
138 /*
139 * The key must be determined with GTIFKeyCode() before
140 * the name can be encoded.
141 */
142 int GTIFValueCode(geokey_t key, char *name)
143 {
144 KeyInfo *info;
145
146 switch (key)
147 {
148 /* All codes using linear/angular/whatever units */
149 case GeogLinearUnitsGeoKey:
150 case ProjLinearUnitsGeoKey:
151 case GeogAngularUnitsGeoKey:
152 case GeogAzimuthUnitsGeoKey:
153 info=_geounitsValue; break;
154
155 /* put other key-dependent lists here */
156 case GTModelTypeGeoKey: info=_modeltypeValue; break;
157 case GTRasterTypeGeoKey: info=_rastertypeValue; break;
158 case GeographicTypeGeoKey: info=_geographicValue; break;
159 case GeogGeodeticDatumGeoKey: info=_geodeticdatumValue; break;
160 case GeogEllipsoidGeoKey: info=_ellipsoidValue; break;
161 case GeogPrimeMeridianGeoKey: info=_primemeridianValue; break;
162 case ProjectedCSTypeGeoKey: info=_pcstypeValue; break;
163 case ProjectionGeoKey: info=_projectionValue; break;
164 case ProjCoordTransGeoKey: info=_coordtransValue; break;
165 case VerticalCSTypeGeoKey: info=_vertcstypeValue; break;
166 case VerticalDatumGeoKey: info=_vdatumValue; break;
167
168 /* And if all else fails... */
169 default: info = _csdefaultValue;break;
170 }
171
172 return FindCode( info,name);
173 }
174
0 /**********************************************************************
1 *
2 * geo_new.c -- Public routines for GEOTIFF GeoKey access.
3 *
4 * Written By: Niles D. Ritter.
5 *
6 * copyright (c) 1995 Niles D. Ritter
7 *
8 * Permission granted to use this software, so long as this copyright
9 * notice accompanies any products derived therefrom.
10 *
11 * 20 June, 1995 Niles D. Ritter New
12 * 7 July, 1995 Greg Martin Fix index
13 *
14 * $Log: geo_new.c,v $
15 * Revision 1.12 2006/06/26 20:03:37 fwarmerdam
16 * If the ascii parameters list is too short for the declared size
17 * of an ascii parameter, but it doesn't start off the end of the
18 * available string then just trim the length. This is to make the
19 * ESRI sample data file 34105h2.tif work properly. I wish we had
20 * a way of issuing warnings!
21 *
22 * Revision 1.11 2004/04/27 21:32:08 warmerda
23 * Allow GTIFNew(NULL) to work
24 *
25 * Revision 1.10 2003/09/02 13:52:17 warmerda
26 * various hacks to support improperly terminated asciiparms
27 *
28 * Revision 1.9 2003/06/19 20:04:11 warmerda
29 * fix memory underwrite if ascii parameter string is zero length
30 *
31 * Revision 1.8 2003/06/05 14:20:45 warmerda
32 * cosmetic formatting changes
33 *
34 **********************************************************************/
35
36 #include "geotiffio.h" /* public interface */
37 #include "geo_tiffp.h" /* external TIFF interface */
38 #include "geo_keyp.h" /* private interface */
39
40 /* private local routines */
41 static int ReadKey(GTIF* gt, TempKeyData* tempData,
42 KeyEntry* entptr, GeoKey* keyptr);
43
44
45 /**********************************************************************
46 *
47 * Public Routines
48 *
49 **********************************************************************/
50
51
52 /**
53 * Given an open TIFF file, look for GTIF keys and
54 * values and return GTIF structure.
55
56 This function creates a GeoTIFF information interpretation handle
57 (GTIF *) based on a passed in TIFF handle originally from
58 XTIFFOpen(). Even though the argument
59 (<b>tif</b>) is shown as type <tt>void *</tt>, it is really normally
60 of type <tt>TIFF *</tt>.<p>
61
62 The returned GTIF handle can be used to read or write GeoTIFF tags
63 using the various GTIF functions. The handle should be destroyed using
64 GTIFFree() before the file is closed with TIFFClose().<p>
65
66 If the file accessed has no GeoTIFF keys, an valid (but empty) GTIF is
67 still returned. GTIFNew() is used both for existing files being read, and
68 for new TIFF files that will have GeoTIFF tags written to them.<p>
69
70 */
71
72 GTIF* GTIFNew(void *tif)
73 {
74 GTIF* gt=(GTIF*)0;
75 int count,bufcount,index;
76 GeoKey *keyptr;
77 pinfo_t *data;
78 KeyEntry *entptr;
79 KeyHeader *header;
80 TempKeyData tempData;
81
82 gt = (GTIF*)_GTIFcalloc( sizeof(GTIF));
83 if (!gt) goto failure;
84
85 /* install TIFF file and I/O methods */
86 gt->gt_tif = (tiff_t *)tif;
87 _GTIFSetDefaultTIFF(&gt->gt_methods);
88
89 tempData.tk_asciiParams = 0;
90 tempData.tk_asciiParamsLength = 0;
91 tempData.tk_asciiParamsOffset = 0;
92
93 /* since this is an array, GTIF will allocate the memory */
94 if ( tif == NULL
95 || !(gt->gt_methods.get)(tif, GTIFF_GEOKEYDIRECTORY, &gt->gt_nshorts, &data ))
96 {
97 /* No ProjectionInfo, create a blank one */
98 data=(pinfo_t*)_GTIFcalloc((4+MAX_VALUES)*sizeof(pinfo_t));
99 if (!data) goto failure;
100 header = (KeyHeader *)data;
101 header->hdr_version = GvCurrentVersion;
102 header->hdr_rev_major = GvCurrentRevision;
103 header->hdr_rev_minor = GvCurrentMinorRev;
104 gt->gt_nshorts=sizeof(KeyHeader)/sizeof(pinfo_t);
105 }
106 gt->gt_short = data;
107 header = (KeyHeader *)data;
108
109 if (header->hdr_version > GvCurrentVersion) goto failure;
110 if (header->hdr_rev_major > GvCurrentRevision)
111 {
112 /* issue warning */
113 }
114
115 /* If we got here, then the geokey can be parsed */
116 count = header->hdr_num_keys;
117 gt->gt_num_keys = count;
118 gt->gt_version = header->hdr_version;
119 gt->gt_rev_major = header->hdr_rev_major;
120 gt->gt_rev_minor = header->hdr_rev_minor;
121
122 bufcount = count+MAX_KEYS; /* allow for expansion */
123
124 /* Get the PARAMS Tags, if any */
125 if (tif == NULL
126 || !(gt->gt_methods.get)(tif, GTIFF_DOUBLEPARAMS,
127 &gt->gt_ndoubles, &gt->gt_double ))
128 {
129 gt->gt_double=(double*)_GTIFcalloc(MAX_VALUES*sizeof(double));
130 if (!gt->gt_double) goto failure;
131 }
132 if ( tif == NULL
133 || !(gt->gt_methods.get)(tif, GTIFF_ASCIIPARAMS,
134 &tempData.tk_asciiParamsLength,
135 &tempData.tk_asciiParams ))
136 {
137 tempData.tk_asciiParams = 0;
138 tempData.tk_asciiParamsLength = 0;
139 }
140 else
141 {
142 /* last NULL doesn't count; "|" used for delimiter */
143 --tempData.tk_asciiParamsLength;
144 }
145
146 /* allocate space for GeoKey array and its index */
147 gt->gt_keys = (GeoKey *)_GTIFcalloc( sizeof(GeoKey)*bufcount);
148 if (!gt->gt_keys) goto failure;
149 gt->gt_keyindex = (int *)_GTIFcalloc( sizeof(int)*(MAX_KEYINDEX+1));
150 if (!gt->gt_keyindex) goto failure;
151
152 /* Loop to get all GeoKeys */
153 entptr = ((KeyEntry *)data) + 1;
154 keyptr = gt->gt_keys;
155 gt->gt_keymin = MAX_KEYINDEX;
156 gt->gt_keymax = 0;
157 for (index=1; index<=count; index++,entptr++)
158 {
159 if (!ReadKey(gt, &tempData, entptr, ++keyptr))
160 goto failure;
161
162 /* Set up the index (start at 1, since 0=unset) */
163 gt->gt_keyindex[entptr->ent_key] = index;
164 }
165
166 if( tempData.tk_asciiParams != NULL )
167 _GTIFFree( tempData.tk_asciiParams );
168
169 return gt;
170
171 failure:
172 /* Notify of error */
173 GTIFFree (gt);
174 return (GTIF *)0;
175 }
176
177 /**********************************************************************
178 *
179 * Private Routines
180 *
181 **********************************************************************/
182
183 /*
184 * Given KeyEntry, read in the GeoKey value location and set up
185 * the Key structure, returning 0 if failure.
186 */
187
188 static int ReadKey(GTIF* gt, TempKeyData* tempData,
189 KeyEntry* entptr, GeoKey* keyptr)
190 {
191 int offset,count;
192
193 keyptr->gk_key = entptr->ent_key;
194 keyptr->gk_count = entptr->ent_count;
195 count = entptr->ent_count;
196 offset = entptr->ent_val_offset;
197 if (gt->gt_keymin > keyptr->gk_key) gt->gt_keymin=keyptr->gk_key;
198 if (gt->gt_keymax < keyptr->gk_key) gt->gt_keymax=keyptr->gk_key;
199
200 if (entptr->ent_location)
201 keyptr->gk_type = (gt->gt_methods.type)(gt->gt_tif,entptr->ent_location);
202 else
203 keyptr->gk_type = (gt->gt_methods.type)(gt->gt_tif,GTIFF_GEOKEYDIRECTORY);
204
205 switch (entptr->ent_location)
206 {
207 case GTIFF_LOCAL:
208 /* store value into data value */
209 *(pinfo_t *)(&keyptr->gk_data) = entptr->ent_val_offset;
210 break;
211 case GTIFF_GEOKEYDIRECTORY:
212 keyptr->gk_data = (char *)(gt->gt_short+offset);
213 if (gt->gt_nshorts < offset+count)
214 gt->gt_nshorts = offset+count;
215 break;
216 case GTIFF_DOUBLEPARAMS:
217 keyptr->gk_data = (char *)(gt->gt_double+offset);
218 if (gt->gt_ndoubles < offset+count)
219 gt->gt_ndoubles = offset+count;
220 break;
221 case GTIFF_ASCIIPARAMS:
222 if( offset + count == tempData->tk_asciiParamsLength + 1
223 && count > 0 )
224 {
225 /* some vendors seem to feel they should not use the
226 terminating '|' char, but do include a terminating '\0'
227 which we lose in the low level reading code.
228 If this is the case, drop the extra character */
229 count--;
230 }
231 else if (offset < tempData->tk_asciiParamsLength
232 && offset + count > tempData->tk_asciiParamsLength )
233 {
234 count = tempData->tk_asciiParamsLength - offset;
235 /* issue warning... if we could */
236 }
237 else if (offset + count > tempData->tk_asciiParamsLength)
238 return (0);
239
240 keyptr->gk_data = (char *) _GTIFcalloc (MAX(1,count+1));
241 _GTIFmemcpy (keyptr->gk_data,
242 tempData->tk_asciiParams + offset, count);
243 if( keyptr->gk_data[MAX(0,count-1)] == '|' )
244 keyptr->gk_data[MAX(0,count-1)] = '\0';
245 else
246 keyptr->gk_data[MAX(0,count)] = '\0';
247 break;
248 default:
249 return 0; /* failure */
250 }
251 keyptr->gk_size = _gtiff_size[keyptr->gk_type];
252
253 return 1; /* success */
254 }
0 /******************************************************************************
1 * $Id: geo_normalize.c,v 1.50 2007/07/28 13:55:21 fwarmerdam Exp $
2 *
3 * Project: libgeotiff
4 * Purpose: Code to normalize PCS and other composite codes in a GeoTIFF file.
5 * Author: Frank Warmerdam, warmerda@home.com
6 *
7 ******************************************************************************
8 * Copyright (c) 1999, Frank Warmerdam
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining a
11 * copy of this software and associated documentation files (the "Software"),
12 * to deal in the Software without restriction, including without limitation
13 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 * and/or sell copies of the Software, and to permit persons to whom the
15 * Software is furnished to do so, subject to the following conditions:
16 *
17 * The above copyright notice and this permission notice shall be included
18 * in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26 * DEALINGS IN THE SOFTWARE.
27 ******************************************************************************
28 *
29 * $Log: geo_normalize.c,v $
30 * Revision 1.50 2007/07/28 13:55:21 fwarmerdam
31 * Fix name for GCS_WGS_72 per gdal bug #1715.
32 *
33 * Revision 1.49 2007/07/20 18:10:41 fwarmerdam
34 * Pre-search pcs.override.csv and gcs.override.csv.
35 *
36 * Revision 1.48 2007/06/06 02:17:04 fwarmerdam
37 * added builtin known values for foot and us survey foot
38 *
39 * Revision 1.47 2007/03/13 18:04:33 fwarmerdam
40 * added new zealand map grid support per bug 1519
41 *
42 * Revision 1.46 2006/04/11 19:25:06 fwarmerdam
43 * Be careful about falling back to gdal_datum.csv as it can interfere
44 * with incode datum.csv support.
45 *
46 * Revision 1.45 2005/03/15 16:01:18 fwarmerdam
47 * zero inv flattening interpreted as sphere
48 *
49 * Revision 1.44 2005/03/04 04:32:37 fwarmerdam
50 * added cylindricalequalarea support
51 *
52 * Revision 1.43 2005/03/04 04:02:40 fwarmerdam
53 * Fixed initialization of dfStdParallel2 for AEA and EC.
54 *
55 * Revision 1.42 2005/02/17 01:21:38 fwarmerdam
56 * fixed handling of ProjFalseOrigin{Easting,Northing}GeoKey
57 *
58 * Revision 1.41 2004/12/01 22:06:42 fwarmerdam
59 * bug 698: GTIFGetGCSInfo should not fail on missing pm if pm info not req.
60 *
61 * Revision 1.40 2004/07/09 17:27:37 warmerda
62 * Added 9122 as an alias for simple degrees.
63 *
64 * Revision 1.39 2004/06/07 12:57:13 warmerda
65 * fallback to using gdal_datum.csv if datum.csv not found
66 *
67 * Revision 1.38 2004/03/19 12:20:40 dron
68 * Initialize projection parameters in GTIFFetchProjParms() before using.
69 *
70 * Revision 1.37 2003/07/08 17:31:30 warmerda
71 * cleanup various warnings
72 *
73 * Revision 1.36 2003/01/28 18:31:58 warmerda
74 * Default dfInDegrees in GTIFAngleToDD().
75 *
76 * Revision 1.35 2003/01/15 04:39:16 warmerda
77 * Added GTIFDeaccessCSV
78 *
79 * Revision 1.34 2003/01/15 03:37:40 warmerda
80 * added GTIFFreeMemory()
81 *
82 * Revision 1.33 2002/12/05 19:21:01 warmerda
83 * fixed dfInDegrees to actually be in degrees, not radians!
84 *
85 * Revision 1.32 2002/11/30 16:01:11 warmerda
86 * fixed some problems in GTIFGetUOMAngleInfo
87 *
88 * Revision 1.31 2002/11/30 15:44:35 warmerda
89 * fixed GetCTParms EPSG code mappings
90 *
91 * Revision 1.30 2002/11/28 22:27:42 warmerda
92 * preliminary upgrade to EPSG 6.2.2 tables
93 *
94 * Revision 1.29 2002/06/19 03:51:15 warmerda
95 * migrated cpl_csv.h into cpl_serv.h
96 *
97 * Revision 1.28 2002/01/03 21:28:25 warmerda
98 * call CSVDeaccess(NULL) at end of GTIFPrintDefn()
99 *
100 * Revision 1.27 2001/04/17 13:41:10 warmerda
101 * fix memory leaks in GTIFPrintDefn()
102 *
103 * Revision 1.26 2001/04/17 13:23:07 warmerda
104 * added support for reading custom ellipsoid definitions
105 *
106 * Revision 1.25 2001/03/05 04:55:26 warmerda
107 * CVSDeaccess at end of GTIFGetDefn to avoid file leak
108 *
109 * Revision 1.24 2001/03/05 03:26:29 warmerda
110 * fixed memory leaks in GTIFPrintDefn()
111 *
112 * Revision 1.23 2001/02/23 13:49:48 warmerda
113 * Fixed GTIFPrintDefn() to use fprintf( fp ), instead of printf().
114 *
115 * Revision 1.22 2000/10/13 14:30:57 warmerda
116 * fixed LCC parm order when parameters read directly from geotiff file
117 *
118 * Revision 1.21 2000/09/15 19:30:14 warmerda
119 * report units of linear proj parms
120 *
121 * Revision 1.20 2000/09/15 18:21:07 warmerda
122 * Fixed order of parameters for LCC 2SP. When parameters
123 * were read from EPSG CSV files the standard parallels and origin
124 * were mixed up. This affects alot of state plane zones!
125 *
126 * Revision 1.19 2000/06/09 14:05:43 warmerda
127 * added default knowledge of NAD27/NAD83/WGS72/WGS84
128 *
129 * Revision 1.18 1999/12/10 21:28:12 warmerda
130 * fixed Stereographic to look for ProjCenterLat/Long
131 *
132 * Revision 1.17 1999/12/10 20:06:58 warmerda
133 * fixed up scale geokey used for a couple of projections
134 *
135 * Revision 1.16 1999/12/10 19:50:21 warmerda
136 * Added EquidistantConic support, fixed return of StdParallel2GeoKey for
137 * LCC2, and Albers.
138 *
139 * Revision 1.15 1999/12/10 19:39:26 warmerda
140 * Fixed bug setting the false northing for files with
141 * ProjCenterNorthingGeoKey set in GTIFGetDefn().
142 *
143 * Revision 1.14 1999/09/17 14:58:37 warmerda
144 * Added ProjRectifiedGridAngleGeoKey(3096) and support for it's
145 * use with Oblique Mercator in geo_normalize.c.
146 *
147 * Revision 1.13 1999/09/17 00:55:26 warmerda
148 * added GTIFGetUOMAngleInfo(), and UOMAngle in GTIFDefn
149 *
150 * Revision 1.12 1999/09/15 18:51:31 warmerda
151 * Map 9808 to TM South Oriented, not TM Modified Alaska.
152 *
153 * Revision 1.11 1999/09/15 16:44:06 warmerda
154 * Change meter to metre to match EPSG database in GTIFGetUOMLengthInfo()
155 * shortcut.
156 *
157 * Revision 1.10 1999/09/15 16:35:15 warmerda
158 * Fixed the fractions of second handling properly in GTIFAngleStringToDD().
159 *
160 * Revision 1.9 1999/09/15 14:24:17 warmerda
161 * Fixed serious bug in geo_normalize.c with translation of
162 * DD.MMSSsss values. Return value was seriously off if any
163 * fraction of a second was included in the string.
164 *
165 * Revision 1.8 1999/07/13 03:12:52 warmerda
166 * Make scale a parameter of CT_Stereographic.
167 *
168 * Revision 1.7 1999/05/04 03:13:22 warmerda
169 * fixed a serious bug in parsing DMSmmss.sss values, and a bug in forming DMS strings
170 *
171 * Revision 1.6 1999/05/03 17:50:31 warmerda
172 * avoid warnings on IRIX
173 *
174 * Revision 1.5 1999/04/28 20:04:51 warmerda
175 * Added doxygen style documentation.
176 * Use GTIFPCSToMapSys() and related functions to partially normalize
177 * projections when we don't have the CSV files.
178 *
179 * Revision 1.4 1999/03/18 21:34:59 geotiff
180 * added GTIFDecToDMS
181 *
182 * Revision 1.3 1999/03/17 19:53:15 geotiff
183 * sys includes moved to cpl_serv.h
184 *
185 * Revision 1.2 1999/03/10 18:24:06 geotiff
186 * corrected to use int'
187 *
188 * Revision 1.1 1999/03/09 15:57:04 geotiff
189 * New
190 *
191 * Revision 1.4 1999/03/03 02:29:38 warmerda
192 * Define PI if not already defined.
193 *
194 * Revision 1.3 1999/03/02 21:10:57 warmerda
195 * added lots of projections
196 *
197 * Revision 1.2 1999/02/24 16:24:15 warmerda
198 * Continuing to evolve
199 *
200 * Revision 1.1 1999/02/22 18:51:08 warmerda
201 * New
202 *
203 */
204
205 #include "cpl_serv.h"
206 #include "geo_tiffp.h"
207 #include "geovalues.h"
208 #include "geo_normalize.h"
209
210 #ifndef KvUserDefined
211 # define KvUserDefined 32767
212 #endif
213
214 #ifndef PI
215 # define PI 3.14159265358979323846
216 #endif
217
218 /* EPSG Codes for projection parameters. Unfortunately, these bear no
219 relationship to the GeoTIFF codes even though the names are so similar. */
220
221 #define EPSGNatOriginLat 8801
222 #define EPSGNatOriginLong 8802
223 #define EPSGNatOriginScaleFactor 8805
224 #define EPSGFalseEasting 8806
225 #define EPSGFalseNorthing 8807
226 #define EPSGProjCenterLat 8811
227 #define EPSGProjCenterLong 8812
228 #define EPSGAzimuth 8813
229 #define EPSGAngleRectifiedToSkewedGrid 8814
230 #define EPSGInitialLineScaleFactor 8815
231 #define EPSGProjCenterEasting 8816
232 #define EPSGProjCenterNorthing 8817
233 #define EPSGPseudoStdParallelLat 8818
234 #define EPSGPseudoStdParallelScaleFactor 8819
235 #define EPSGFalseOriginLat 8821
236 #define EPSGFalseOriginLong 8822
237 #define EPSGStdParallel1Lat 8823
238 #define EPSGStdParallel2Lat 8824
239 #define EPSGFalseOriginEasting 8826
240 #define EPSGFalseOriginNorthing 8827
241 #define EPSGSphericalOriginLat 8828
242 #define EPSGSphericalOriginLong 8829
243 #define EPSGInitialLongitude 8830
244 #define EPSGZoneWidth 8831
245
246 /************************************************************************/
247 /* GTIFGetPCSInfo() */
248 /************************************************************************/
249
250 int GTIFGetPCSInfo( int nPCSCode, char **ppszEPSGName,
251 short *pnProjOp, short *pnUOMLengthCode,
252 short *pnGeogCS )
253
254 {
255 char **papszRecord;
256 char szSearchKey[24];
257 const char *pszFilename;
258
259 /* -------------------------------------------------------------------- */
260 /* Search the pcs.override table for this PCS. */
261 /* -------------------------------------------------------------------- */
262 pszFilename = CSVFilename( "pcs.override.csv" );
263 sprintf( szSearchKey, "%d", nPCSCode );
264 papszRecord = CSVScanFileByName( pszFilename, "COORD_REF_SYS_CODE",
265 szSearchKey, CC_Integer );
266
267 /* -------------------------------------------------------------------- */
268 /* If not found, search the EPSG PCS database. */
269 /* -------------------------------------------------------------------- */
270 if( papszRecord == NULL )
271 {
272 pszFilename = CSVFilename( "pcs.csv" );
273
274 sprintf( szSearchKey, "%d", nPCSCode );
275 papszRecord = CSVScanFileByName( pszFilename, "COORD_REF_SYS_CODE",
276 szSearchKey, CC_Integer );
277
278 if( papszRecord == NULL )
279 return FALSE;
280 }
281
282 /* -------------------------------------------------------------------- */
283 /* Get the name, if requested. */
284 /* -------------------------------------------------------------------- */
285 if( ppszEPSGName != NULL )
286 {
287 *ppszEPSGName =
288 CPLStrdup( CSLGetField( papszRecord,
289 CSVGetFileFieldId(pszFilename,
290 "COORD_REF_SYS_NAME") ));
291 }
292
293 /* -------------------------------------------------------------------- */
294 /* Get the UOM Length code, if requested. */
295 /* -------------------------------------------------------------------- */
296 if( pnUOMLengthCode != NULL )
297 {
298 const char *pszValue;
299
300 pszValue =
301 CSLGetField( papszRecord,
302 CSVGetFileFieldId(pszFilename,"UOM_CODE"));
303 if( atoi(pszValue) > 0 )
304 *pnUOMLengthCode = (short) atoi(pszValue);
305 else
306 *pnUOMLengthCode = KvUserDefined;
307 }
308
309 /* -------------------------------------------------------------------- */
310 /* Get the UOM Length code, if requested. */
311 /* -------------------------------------------------------------------- */
312 if( pnProjOp != NULL )
313 {
314 const char *pszValue;
315
316 pszValue =
317 CSLGetField( papszRecord,
318 CSVGetFileFieldId(pszFilename,"COORD_OP_CODE"));
319 if( atoi(pszValue) > 0 )
320 *pnProjOp = (short) atoi(pszValue);
321 else
322 *pnUOMLengthCode = KvUserDefined;
323 }
324
325 /* -------------------------------------------------------------------- */
326 /* Get the GeogCS (Datum with PM) code, if requested. */
327 /* -------------------------------------------------------------------- */
328 if( pnGeogCS != NULL )
329 {
330 const char *pszValue;
331
332 pszValue =
333 CSLGetField( papszRecord,
334 CSVGetFileFieldId(pszFilename,"SOURCE_GEOGCRS_CODE"));
335 if( atoi(pszValue) > 0 )
336 *pnGeogCS = (short) atoi(pszValue);
337 else
338 *pnGeogCS = KvUserDefined;
339 }
340
341 return TRUE;
342 }
343
344 /************************************************************************/
345 /* GTIFAngleToDD() */
346 /* */
347 /* Convert a numeric angle to decimal degress. */
348 /************************************************************************/
349
350 double GTIFAngleToDD( double dfAngle, int nUOMAngle )
351
352 {
353 if( nUOMAngle == 9110 ) /* DDD.MMSSsss */
354 {
355 char szAngleString[32];
356
357 sprintf( szAngleString, "%12.7f", dfAngle );
358 dfAngle = GTIFAngleStringToDD( szAngleString, nUOMAngle );
359 }
360 else
361 {
362 double dfInDegrees = 1.0;
363
364 GTIFGetUOMAngleInfo( nUOMAngle, NULL, &dfInDegrees );
365 dfAngle = dfAngle * dfInDegrees;
366 }
367
368 return( dfAngle );
369 }
370
371 /************************************************************************/
372 /* GTIFAngleStringToDD() */
373 /* */
374 /* Convert an angle in the specified units to decimal degrees. */
375 /************************************************************************/
376
377 double GTIFAngleStringToDD( const char * pszAngle, int nUOMAngle )
378
379 {
380 double dfAngle;
381
382 if( nUOMAngle == 9110 ) /* DDD.MMSSsss */
383 {
384 char *pszDecimal;
385
386 dfAngle = ABS(atoi(pszAngle));
387 pszDecimal = strchr(pszAngle,'.');
388 if( pszDecimal != NULL && strlen(pszDecimal) > 1 )
389 {
390 char szMinutes[3];
391 char szSeconds[64];
392
393 szMinutes[0] = pszDecimal[1];
394 if( pszDecimal[2] >= '0' && pszDecimal[2] <= '9' )
395 szMinutes[1] = pszDecimal[2];
396 else
397 szMinutes[1] = '0';
398
399 szMinutes[2] = '\0';
400 dfAngle += atoi(szMinutes) / 60.0;
401
402 if( strlen(pszDecimal) > 3 )
403 {
404 szSeconds[0] = pszDecimal[3];
405 if( pszDecimal[4] >= '0' && pszDecimal[4] <= '9' )
406 {
407 szSeconds[1] = pszDecimal[4];
408 szSeconds[2] = '.';
409 strcpy( szSeconds+3, pszDecimal + 5 );
410 }
411 else
412 {
413 szSeconds[1] = '0';
414 szSeconds[2] = '\0';
415 }
416 dfAngle += atof(szSeconds) / 3600.0;
417 }
418 }
419
420 if( pszAngle[0] == '-' )
421 dfAngle *= -1;
422 }
423 else if( nUOMAngle == 9105 || nUOMAngle == 9106 ) /* grad */
424 {
425 dfAngle = 180 * (atof(pszAngle ) / 200);
426 }
427 else if( nUOMAngle == 9101 ) /* radians */
428 {
429 dfAngle = 180 * (atof(pszAngle ) / PI);
430 }
431 else if( nUOMAngle == 9103 ) /* arc-minute */
432 {
433 dfAngle = atof(pszAngle) / 60;
434 }
435 else if( nUOMAngle == 9104 ) /* arc-second */
436 {
437 dfAngle = atof(pszAngle) / 3600;
438 }
439 else /* decimal degrees ... some cases missing but seeminly never used */
440 {
441 CPLAssert( nUOMAngle == 9102 || nUOMAngle == KvUserDefined
442 || nUOMAngle == 0 );
443
444 dfAngle = atof(pszAngle );
445 }
446
447 return( dfAngle );
448 }
449
450 /************************************************************************/
451 /* GTIFGetGCSInfo() */
452 /* */
453 /* Fetch the datum, and prime meridian related to a particular */
454 /* GCS. */
455 /************************************************************************/
456
457 int GTIFGetGCSInfo( int nGCSCode, char ** ppszName,
458 short * pnDatum, short * pnPM, short *pnUOMAngle )
459
460 {
461 char szSearchKey[24];
462 int nDatum, nPM, nUOMAngle;
463 const char *pszFilename;
464
465 /* -------------------------------------------------------------------- */
466 /* Search the database for the corresponding datum code. */
467 /* -------------------------------------------------------------------- */
468 pszFilename = CSVFilename("gcs.override.csv");
469 sprintf( szSearchKey, "%d", nGCSCode );
470 nDatum = atoi(CSVGetField( pszFilename,
471 "COORD_REF_SYS_CODE", szSearchKey,
472 CC_Integer, "DATUM_CODE" ) );
473
474 if( nDatum < 1 )
475 {
476 pszFilename = CSVFilename("gcs.csv");
477 sprintf( szSearchKey, "%d", nGCSCode );
478 nDatum = atoi(CSVGetField( pszFilename,
479 "COORD_REF_SYS_CODE", szSearchKey,
480 CC_Integer, "DATUM_CODE" ) );
481 }
482
483 /* -------------------------------------------------------------------- */
484 /* Handle some "well known" GCS codes directly if the table */
485 /* wasn't found. */
486 /* -------------------------------------------------------------------- */
487 if( nDatum < 1 )
488 {
489 const char * pszName = NULL;
490 nPM = PM_Greenwich;
491 nUOMAngle = Angular_DMS_Hemisphere;
492 if( nGCSCode == GCS_NAD27 )
493 {
494 nDatum = Datum_North_American_Datum_1927;
495 pszName = "NAD27";
496 }
497 else if( nGCSCode == GCS_NAD83 )
498 {
499 nDatum = Datum_North_American_Datum_1983;
500 pszName = "NAD83";
501 }
502 else if( nGCSCode == GCS_WGS_84 )
503 {
504 nDatum = Datum_WGS84;
505 pszName = "WGS 84";
506 }
507 else if( nGCSCode == GCS_WGS_72 )
508 {
509 nDatum = Datum_WGS72;
510 pszName = "WGS 72";
511 }
512 else
513 return FALSE;
514
515 if( ppszName != NULL )
516 *ppszName = CPLStrdup( pszName );
517 if( pnDatum != NULL )
518 *pnDatum = (short) nDatum;
519 if( pnPM != NULL )
520 *pnPM = (short) nPM;
521 if( pnUOMAngle != NULL )
522 *pnUOMAngle = (short) nUOMAngle;
523
524 return TRUE;
525 }
526
527 if( pnDatum != NULL )
528 *pnDatum = (short) nDatum;
529
530 /* -------------------------------------------------------------------- */
531 /* Get the PM. */
532 /* -------------------------------------------------------------------- */
533 if( pnPM != NULL )
534 {
535 nPM = atoi(CSVGetField( pszFilename,
536 "COORD_REF_SYS_CODE", szSearchKey, CC_Integer,
537 "PRIME_MERIDIAN_CODE" ) );
538
539 if( nPM < 1 )
540 return FALSE;
541
542 *pnPM = (short) nPM;
543 }
544
545 /* -------------------------------------------------------------------- */
546 /* Get the angular units. */
547 /* -------------------------------------------------------------------- */
548 nUOMAngle = atoi(CSVGetField( pszFilename,
549 "COORD_REF_SYS_CODE",szSearchKey, CC_Integer,
550 "UOM_CODE" ) );
551
552 if( nUOMAngle < 1 )
553 return FALSE;
554
555 if( pnUOMAngle != NULL )
556 *pnUOMAngle = (short) nUOMAngle;
557
558 /* -------------------------------------------------------------------- */
559 /* Get the name, if requested. */
560 /* -------------------------------------------------------------------- */
561 if( ppszName != NULL )
562 *ppszName =
563 CPLStrdup(CSVGetField( pszFilename,
564 "COORD_REF_SYS_CODE",szSearchKey,CC_Integer,
565 "COORD_REF_SYS_NAME" ));
566
567 return( TRUE );
568 }
569
570 /************************************************************************/
571 /* GTIFGetEllipsoidInfo() */
572 /* */
573 /* Fetch info about an ellipsoid. Axes are always returned in */
574 /* meters. SemiMajor computed based on inverse flattening */
575 /* where that is provided. */
576 /************************************************************************/
577
578 int GTIFGetEllipsoidInfo( int nEllipseCode, char ** ppszName,
579 double * pdfSemiMajor, double * pdfSemiMinor )
580
581 {
582 char szSearchKey[24];
583 double dfSemiMajor, dfToMeters = 1.0;
584 int nUOMLength;
585
586 /* -------------------------------------------------------------------- */
587 /* Get the semi major axis. */
588 /* -------------------------------------------------------------------- */
589 sprintf( szSearchKey, "%d", nEllipseCode );
590
591 dfSemiMajor =
592 atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
593 "ELLIPSOID_CODE", szSearchKey, CC_Integer,
594 "SEMI_MAJOR_AXIS" ) );
595
596 /* -------------------------------------------------------------------- */
597 /* Try some well known ellipsoids. */
598 /* -------------------------------------------------------------------- */
599 if( dfSemiMajor == 0.0 )
600 {
601 double dfInvFlattening, dfSemiMinor;
602 const char *pszName = NULL;
603
604 if( nEllipseCode == Ellipse_Clarke_1866 )
605 {
606 pszName = "Clarke 1866";
607 dfSemiMajor = 6378206.4;
608 dfSemiMinor = 6356583.8;
609 dfInvFlattening = 0.0;
610 }
611 else if( nEllipseCode == Ellipse_GRS_1980 )
612 {
613 pszName = "GRS 1980";
614 dfSemiMajor = 6378137.0;
615 dfSemiMinor = 0.0;
616 dfInvFlattening = 298.257222101;
617 }
618 else if( nEllipseCode == Ellipse_WGS_84 )
619 {
620 pszName = "WGS 84";
621 dfSemiMajor = 6378137.0;
622 dfSemiMinor = 0.0;
623 dfInvFlattening = 298.257223563;
624 }
625 else if( nEllipseCode == 7043 )
626 {
627 pszName = "WGS 72";
628 dfSemiMajor = 6378135.0;
629 dfSemiMinor = 0.0;
630 dfInvFlattening = 298.26;
631 }
632 else
633 return FALSE;
634
635 if( dfSemiMinor == 0.0 )
636 dfSemiMinor = dfSemiMajor * (1 - 1.0/dfInvFlattening);
637
638 if( pdfSemiMinor != NULL )
639 *pdfSemiMinor = dfSemiMinor;
640 if( pdfSemiMajor != NULL )
641 *pdfSemiMajor = dfSemiMajor;
642 if( ppszName != NULL )
643 *ppszName = CPLStrdup( pszName );
644
645 return TRUE;
646 }
647
648 /* -------------------------------------------------------------------- */
649 /* Get the translation factor into meters. */
650 /* -------------------------------------------------------------------- */
651 nUOMLength = atoi(CSVGetField( CSVFilename("ellipsoid.csv" ),
652 "ELLIPSOID_CODE", szSearchKey, CC_Integer,
653 "UOM_CODE" ));
654 GTIFGetUOMLengthInfo( nUOMLength, NULL, &dfToMeters );
655
656 dfSemiMajor *= dfToMeters;
657
658 if( pdfSemiMajor != NULL )
659 *pdfSemiMajor = dfSemiMajor;
660
661 /* -------------------------------------------------------------------- */
662 /* Get the semi-minor if requested. If the Semi-minor axis */
663 /* isn't available, compute it based on the inverse flattening. */
664 /* -------------------------------------------------------------------- */
665 if( pdfSemiMinor != NULL )
666 {
667 *pdfSemiMinor =
668 atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
669 "ELLIPSOID_CODE", szSearchKey, CC_Integer,
670 "SEMI_MINOR_AXIS" )) * dfToMeters;
671
672 if( *pdfSemiMinor == 0.0 )
673 {
674 double dfInvFlattening;
675
676 dfInvFlattening =
677 atof(CSVGetField( CSVFilename("ellipsoid.csv" ),
678 "ELLIPSOID_CODE", szSearchKey, CC_Integer,
679 "INV_FLATTENING" ));
680 *pdfSemiMinor = dfSemiMajor * (1 - 1.0/dfInvFlattening);
681 }
682 }
683
684 /* -------------------------------------------------------------------- */
685 /* Get the name, if requested. */
686 /* -------------------------------------------------------------------- */
687 if( ppszName != NULL )
688 *ppszName =
689 CPLStrdup(CSVGetField( CSVFilename("ellipsoid.csv" ),
690 "ELLIPSOID_CODE", szSearchKey, CC_Integer,
691 "ELLIPSOID_NAME" ));
692
693 return( TRUE );
694 }
695
696 /************************************************************************/
697 /* GTIFGetPMInfo() */
698 /* */
699 /* Get the offset between a given prime meridian and Greenwich */
700 /* in degrees. */
701 /************************************************************************/
702
703 int GTIFGetPMInfo( int nPMCode, char ** ppszName, double *pdfOffset )
704
705 {
706 char szSearchKey[24];
707 int nUOMAngle;
708 const char *pszFilename = CSVFilename("prime_meridian.csv");
709
710 /* -------------------------------------------------------------------- */
711 /* Use a special short cut for Greenwich, since it is so common. */
712 /* -------------------------------------------------------------------- */
713 if( nPMCode == PM_Greenwich )
714 {
715 if( pdfOffset != NULL )
716 *pdfOffset = 0.0;
717 if( ppszName != NULL )
718 *ppszName = CPLStrdup( "Greenwich" );
719 return TRUE;
720 }
721
722 /* -------------------------------------------------------------------- */
723 /* Search the database for the corresponding datum code. */
724 /* -------------------------------------------------------------------- */
725 sprintf( szSearchKey, "%d", nPMCode );
726
727 nUOMAngle =
728 atoi(CSVGetField( pszFilename,
729 "PRIME_MERIDIAN_CODE", szSearchKey, CC_Integer,
730 "UOM_CODE" ) );
731 if( nUOMAngle < 1 )
732 return FALSE;
733
734 /* -------------------------------------------------------------------- */
735 /* Get the PM offset. */
736 /* -------------------------------------------------------------------- */
737 if( pdfOffset != NULL )
738 {
739 *pdfOffset =
740 GTIFAngleStringToDD(
741 CSVGetField( pszFilename,
742 "PRIME_MERIDIAN_CODE", szSearchKey, CC_Integer,
743 "GREENWICH_LONGITUDE" ),
744 nUOMAngle );
745 }
746
747 /* -------------------------------------------------------------------- */
748 /* Get the name, if requested. */
749 /* -------------------------------------------------------------------- */
750 if( ppszName != NULL )
751 *ppszName =
752 CPLStrdup(
753 CSVGetField( pszFilename,
754 "PRIME_MERIDIAN_CODE", szSearchKey, CC_Integer,
755 "PRIME_MERIDIAN_NAME" ));
756
757 return( TRUE );
758 }
759
760 /************************************************************************/
761 /* GTIFGetDatumInfo() */
762 /* */
763 /* Fetch the ellipsoid, and name for a datum. */
764 /************************************************************************/
765
766 int GTIFGetDatumInfo( int nDatumCode, char ** ppszName, short * pnEllipsoid )
767
768 {
769 char szSearchKey[24];
770 int nEllipsoid;
771 const char *pszFilename = CSVFilename( "datum.csv" );
772 FILE *fp;
773
774 /* -------------------------------------------------------------------- */
775 /* If we can't find datum.csv then gdal_datum.csv is an */
776 /* acceptable fallback. Mostly this is for GDAL. */
777 /* -------------------------------------------------------------------- */
778 if( (fp = VSIFOpen(pszFilename,"r")) == NULL )
779 {
780 if( (fp = VSIFOpen(CSVFilename("gdal_datum.csv"), "r")) != NULL )
781 {
782 pszFilename = CSVFilename( "gdal_datum.csv" );
783 VSIFClose( fp );
784 }
785 }
786 else
787 VSIFClose( fp );
788
789 /* -------------------------------------------------------------------- */
790 /* Search the database for the corresponding datum code. */
791 /* -------------------------------------------------------------------- */
792 sprintf( szSearchKey, "%d", nDatumCode );
793
794 nEllipsoid = atoi(CSVGetField( pszFilename,
795 "DATUM_CODE", szSearchKey, CC_Integer,
796 "ELLIPSOID_CODE" ) );
797
798 if( pnEllipsoid != NULL )
799 *pnEllipsoid = (short) nEllipsoid;
800
801 /* -------------------------------------------------------------------- */
802 /* Handle a few built-in datums. */
803 /* -------------------------------------------------------------------- */
804 if( nEllipsoid < 1 )
805 {
806 const char *pszName = NULL;
807
808 if( nDatumCode == Datum_North_American_Datum_1927 )
809 {
810 nEllipsoid = Ellipse_Clarke_1866;
811 pszName = "North American Datum 1927";
812 }
813 else if( nDatumCode == Datum_North_American_Datum_1983 )
814 {
815 nEllipsoid = Ellipse_GRS_1980;
816 pszName = "North American Datum 1983";
817 }
818 else if( nDatumCode == Datum_WGS84 )
819 {
820 nEllipsoid = Ellipse_WGS_84;
821 pszName = "World Geodetic System 1984";
822 }
823 else if( nDatumCode == Datum_WGS72 )
824 {
825 nEllipsoid = 7043; /* WGS7 */
826 pszName = "World Geodetic System 1972";
827 }
828 else
829 return FALSE;
830
831 if( pnEllipsoid != NULL )
832 *pnEllipsoid = (short) nEllipsoid;
833
834 if( ppszName != NULL )
835 *ppszName = CPLStrdup( pszName );
836
837 return TRUE;
838 }
839
840 /* -------------------------------------------------------------------- */
841 /* Get the name, if requested. */
842 /* -------------------------------------------------------------------- */
843 if( ppszName != NULL )
844 *ppszName =
845 CPLStrdup(CSVGetField( pszFilename,
846 "DATUM_CODE", szSearchKey, CC_Integer,
847 "DATUM_NAME" ));
848
849 return( TRUE );
850 }
851
852
853 /************************************************************************/
854 /* GTIFGetUOMLengthInfo() */
855 /* */
856 /* Note: This function should eventually also know how to */
857 /* lookup length aliases in the UOM_LE_ALIAS table. */
858 /************************************************************************/
859
860 int GTIFGetUOMLengthInfo( int nUOMLengthCode,
861 char **ppszUOMName,
862 double * pdfInMeters )
863
864 {
865 char **papszUnitsRecord;
866 char szSearchKey[24];
867 int iNameField;
868 const char *pszFilename;
869
870 /* -------------------------------------------------------------------- */
871 /* We short cut meter to save work and avoid failure for missing */
872 /* in the most common cases. */
873 /* -------------------------------------------------------------------- */
874 if( nUOMLengthCode == 9001 )
875 {
876 if( ppszUOMName != NULL )
877 *ppszUOMName = CPLStrdup( "metre" );
878 if( pdfInMeters != NULL )
879 *pdfInMeters = 1.0;
880
881 return TRUE;
882 }
883
884 if( nUOMLengthCode == 9002 )
885 {
886 if( ppszUOMName != NULL )
887 *ppszUOMName = CPLStrdup( "foot" );
888 if( pdfInMeters != NULL )
889 *pdfInMeters = 0.3048;
890
891 return TRUE;
892 }
893
894 if( nUOMLengthCode == 9003 )
895 {
896 if( ppszUOMName != NULL )
897 *ppszUOMName = CPLStrdup( "US survey foot" );
898 if( pdfInMeters != NULL )
899 *pdfInMeters = 12.0 / 39.37;
900
901 return TRUE;
902 }
903
904 /* -------------------------------------------------------------------- */
905 /* Search the units database for this unit. If we don't find */
906 /* it return failure. */
907 /* -------------------------------------------------------------------- */
908 pszFilename = CSVFilename( "unit_of_measure.csv" );
909
910 sprintf( szSearchKey, "%d", nUOMLengthCode );
911 papszUnitsRecord =
912 CSVScanFileByName( pszFilename,
913 "UOM_CODE", szSearchKey, CC_Integer );
914
915 if( papszUnitsRecord == NULL )
916 return FALSE;
917
918 /* -------------------------------------------------------------------- */
919 /* Get the name, if requested. */
920 /* -------------------------------------------------------------------- */
921 if( ppszUOMName != NULL )
922 {
923 iNameField = CSVGetFileFieldId( pszFilename,
924 "UNIT_OF_MEAS_NAME" );
925 *ppszUOMName = CPLStrdup( CSLGetField(papszUnitsRecord, iNameField) );
926 }
927
928 /* -------------------------------------------------------------------- */
929 /* Get the A and B factor fields, and create the multiplicative */
930 /* factor. */
931 /* -------------------------------------------------------------------- */
932 if( pdfInMeters != NULL )
933 {
934 int iBFactorField, iCFactorField;
935
936 iBFactorField = CSVGetFileFieldId( pszFilename, "FACTOR_B" );
937 iCFactorField = CSVGetFileFieldId( pszFilename, "FACTOR_C" );
938
939 if( atof(CSLGetField(papszUnitsRecord, iCFactorField)) > 0.0 )
940 *pdfInMeters = atof(CSLGetField(papszUnitsRecord, iBFactorField))
941 / atof(CSLGetField(papszUnitsRecord, iCFactorField));
942 else
943 *pdfInMeters = 0.0;
944 }
945
946 return( TRUE );
947 }
948
949 /************************************************************************/
950 /* GTIFGetUOMAngleInfo() */
951 /************************************************************************/
952
953 int GTIFGetUOMAngleInfo( int nUOMAngleCode,
954 char **ppszUOMName,
955 double * pdfInDegrees )
956
957 {
958 const char *pszUOMName = NULL;
959 double dfInDegrees = 1.0;
960 const char *pszFilename = CSVFilename( "unit_of_measure.csv" );
961 char szSearchKey[24];
962
963 sprintf( szSearchKey, "%d", nUOMAngleCode );
964 pszUOMName = CSVGetField( pszFilename,
965 "UOM_CODE", szSearchKey, CC_Integer,
966 "UNIT_OF_MEAS_NAME" );
967
968 /* -------------------------------------------------------------------- */
969 /* If the file is found, read from there. Note that FactorC is */
970 /* an empty field for any of the DMS style formats, and in this */
971 /* case we really want to return the default InDegrees value */
972 /* (1.0) from above. */
973 /* -------------------------------------------------------------------- */
974 if( pszUOMName != NULL )
975 {
976 double dfFactorB, dfFactorC, dfInRadians;
977
978 dfFactorB =
979 atof(CSVGetField( pszFilename,
980 "UOM_CODE", szSearchKey, CC_Integer,
981 "FACTOR_B" ));
982
983 dfFactorC =
984 atof(CSVGetField( pszFilename,
985 "UOM_CODE", szSearchKey, CC_Integer,
986 "FACTOR_C" ));
987
988 if( dfFactorC != 0.0 )
989 {
990 dfInRadians = (dfFactorB / dfFactorC);
991 dfInDegrees = dfInRadians * 180.0 / PI;
992 }
993
994
995 /* We do a special override of some of the DMS formats name */
996 if( nUOMAngleCode == 9102 || nUOMAngleCode == 9107
997 || nUOMAngleCode == 9108 || nUOMAngleCode == 9110
998 || nUOMAngleCode == 9122 )
999 {
1000 dfInDegrees = 1.0;
1001 pszUOMName = "degree";
1002 }
1003 }
1004
1005 /* -------------------------------------------------------------------- */
1006 /* Otherwise handle a few well known units directly. */
1007 /* -------------------------------------------------------------------- */
1008 else
1009 {
1010 switch( nUOMAngleCode )
1011 {
1012 case 9101:
1013 pszUOMName = "radian";
1014 dfInDegrees = 180.0 / PI;
1015 break;
1016
1017 case 9102:
1018 case 9107:
1019 case 9108:
1020 case 9110:
1021 pszUOMName = "degree";
1022 dfInDegrees = 1.0;
1023 break;
1024
1025 case 9103:
1026 pszUOMName = "arc-minute";
1027 dfInDegrees = 1 / 60.0;
1028 break;
1029
1030 case 9104:
1031 pszUOMName = "arc-second";
1032 dfInDegrees = 1 / 3600.0;
1033 break;
1034
1035 case 9105:
1036 pszUOMName = "grad";
1037 dfInDegrees = 180.0 / 200.0;
1038 break;
1039
1040 case 9106:
1041 pszUOMName = "gon";
1042 dfInDegrees = 180.0 / 200.0;
1043 break;
1044
1045 case 9109:
1046 pszUOMName = "microradian";
1047 dfInDegrees = 180.0 / (PI * 1000000.0);
1048 break;
1049
1050 default:
1051 return FALSE;
1052 }
1053 }
1054
1055 /* -------------------------------------------------------------------- */
1056 /* Return to caller. */
1057 /* -------------------------------------------------------------------- */
1058 if( ppszUOMName != NULL )
1059 {
1060 if( pszUOMName != NULL )
1061 *ppszUOMName = CPLStrdup( pszUOMName );
1062 else
1063 *ppszUOMName = NULL;
1064 }
1065
1066 if( pdfInDegrees != NULL )
1067 *pdfInDegrees = dfInDegrees;
1068
1069 return( TRUE );
1070 }
1071
1072 /************************************************************************/
1073 /* EPSGProjMethodToCTProjMethod() */
1074 /* */
1075 /* Convert between the EPSG enumeration for projection methods, */
1076 /* and the GeoTIFF CT codes. */
1077 /************************************************************************/
1078
1079 static int EPSGProjMethodToCTProjMethod( int nEPSG )
1080
1081 {
1082 /* see trf_method.csv for list of EPSG codes */
1083
1084 switch( nEPSG )
1085 {
1086 case 9801:
1087 return( CT_LambertConfConic_1SP );
1088
1089 case 9802:
1090 return( CT_LambertConfConic_2SP );
1091
1092 case 9803:
1093 return( CT_LambertConfConic_2SP ); /* Belgian variant not supported */
1094
1095 case 9804:
1096 return( CT_Mercator ); /* 1SP and 2SP not differentiated */
1097
1098 case 9805:
1099 return( CT_Mercator ); /* 1SP and 2SP not differentiated */
1100
1101 case 9806:
1102 return( CT_CassiniSoldner );
1103
1104 case 9807:
1105 return( CT_TransverseMercator );
1106
1107 case 9808:
1108 return( CT_TransvMercator_SouthOriented );
1109
1110 case 9809:
1111 return( CT_ObliqueStereographic );
1112
1113 case 9810:
1114 return( CT_PolarStereographic );
1115
1116 case 9811:
1117 return( CT_NewZealandMapGrid );
1118
1119 case 9812:
1120 return( CT_ObliqueMercator ); /* is hotine actually different? */
1121
1122 case 9813:
1123 return( CT_ObliqueMercator_Laborde );
1124
1125 case 9814:
1126 return( CT_ObliqueMercator_Rosenmund ); /* swiss */
1127
1128 case 9815:
1129 return( CT_ObliqueMercator );
1130
1131 case 9816: /* tunesia mining grid has no counterpart */
1132 return( KvUserDefined );
1133 }
1134
1135 return( KvUserDefined );
1136 }
1137
1138 /************************************************************************/
1139 /* SetGTParmIds() */
1140 /* */
1141 /* This is hardcoded logic to set the GeoTIFF parmaeter */
1142 /* identifiers for all the EPSG supported projections. As the */
1143 /* trf_method.csv table grows with new projections, this code */
1144 /* will need to be updated. */
1145 /************************************************************************/
1146
1147 static int SetGTParmIds( int nCTProjection,
1148 int *panProjParmId,
1149 int *panEPSGCodes )
1150
1151 {
1152 int anWorkingDummy[7];
1153
1154 if( panEPSGCodes == NULL )
1155 panEPSGCodes = anWorkingDummy;
1156 if( panProjParmId == NULL )
1157 panProjParmId = anWorkingDummy;
1158
1159 memset( panEPSGCodes, 0, sizeof(int) * 7 );
1160
1161 /* psDefn->nParms = 7; */
1162
1163 switch( nCTProjection )
1164 {
1165 case CT_CassiniSoldner:
1166 case CT_NewZealandMapGrid:
1167 panProjParmId[0] = ProjNatOriginLatGeoKey;
1168 panProjParmId[1] = ProjNatOriginLongGeoKey;
1169 panProjParmId[5] = ProjFalseEastingGeoKey;
1170 panProjParmId[6] = ProjFalseNorthingGeoKey;
1171
1172 panEPSGCodes[0] = EPSGNatOriginLat;
1173 panEPSGCodes[1] = EPSGNatOriginLong;
1174 panEPSGCodes[5] = EPSGFalseEasting;
1175 panEPSGCodes[6] = EPSGFalseNorthing;
1176 return TRUE;
1177
1178 case CT_ObliqueMercator:
1179 panProjParmId[0] = ProjCenterLatGeoKey;
1180 panProjParmId[1] = ProjCenterLongGeoKey;
1181 panProjParmId[2] = ProjAzimuthAngleGeoKey;
1182 panProjParmId[3] = ProjRectifiedGridAngleGeoKey;
1183 panProjParmId[4] = ProjScaleAtCenterGeoKey;
1184 panProjParmId[5] = ProjFalseEastingGeoKey;
1185 panProjParmId[6] = ProjFalseNorthingGeoKey;
1186
1187 panEPSGCodes[0] = EPSGProjCenterLat;
1188 panEPSGCodes[1] = EPSGProjCenterLong;
1189 panEPSGCodes[2] = EPSGAzimuth;
1190 panEPSGCodes[3] = EPSGAngleRectifiedToSkewedGrid;
1191 panEPSGCodes[4] = EPSGInitialLineScaleFactor;
1192 panEPSGCodes[5] = EPSGProjCenterEasting;
1193 panEPSGCodes[6] = EPSGProjCenterNorthing;
1194 return TRUE;
1195
1196 case CT_ObliqueMercator_Laborde:
1197 panProjParmId[0] = ProjCenterLatGeoKey;
1198 panProjParmId[1] = ProjCenterLongGeoKey;
1199 panProjParmId[2] = ProjAzimuthAngleGeoKey;
1200 panProjParmId[4] = ProjScaleAtCenterGeoKey;
1201 panProjParmId[5] = ProjFalseEastingGeoKey;
1202 panProjParmId[6] = ProjFalseNorthingGeoKey;
1203
1204 panEPSGCodes[0] = EPSGProjCenterLat;
1205 panEPSGCodes[1] = EPSGProjCenterLong;
1206 panEPSGCodes[2] = EPSGAzimuth;
1207 panEPSGCodes[4] = EPSGInitialLineScaleFactor;
1208 panEPSGCodes[5] = EPSGProjCenterEasting;
1209 panEPSGCodes[6] = EPSGProjCenterNorthing;
1210 return TRUE;
1211
1212 case CT_LambertConfConic_1SP:
1213 case CT_Mercator:
1214 case CT_ObliqueStereographic:
1215 case CT_PolarStereographic:
1216 case CT_TransverseMercator:
1217 case CT_TransvMercator_SouthOriented:
1218 panProjParmId[0] = ProjNatOriginLatGeoKey;
1219 panProjParmId[1] = ProjNatOriginLongGeoKey;
1220 panProjParmId[4] = ProjScaleAtNatOriginGeoKey;
1221 panProjParmId[5] = ProjFalseEastingGeoKey;
1222 panProjParmId[6] = ProjFalseNorthingGeoKey;
1223
1224 panEPSGCodes[0] = EPSGNatOriginLat;
1225 panEPSGCodes[1] = EPSGNatOriginLong;
1226 panEPSGCodes[4] = EPSGNatOriginScaleFactor;
1227 panEPSGCodes[5] = EPSGFalseEasting;
1228 panEPSGCodes[6] = EPSGFalseNorthing;
1229 return TRUE;
1230
1231 case CT_LambertConfConic_2SP:
1232 panProjParmId[0] = ProjFalseOriginLatGeoKey;
1233 panProjParmId[1] = ProjFalseOriginLongGeoKey;
1234 panProjParmId[2] = ProjStdParallel1GeoKey;
1235 panProjParmId[3] = ProjStdParallel2GeoKey;
1236 panProjParmId[5] = ProjFalseEastingGeoKey;
1237 panProjParmId[6] = ProjFalseNorthingGeoKey;
1238
1239 panEPSGCodes[0] = EPSGFalseOriginLat;
1240 panEPSGCodes[1] = EPSGFalseOriginLong;
1241 panEPSGCodes[2] = EPSGStdParallel1Lat;
1242 panEPSGCodes[3] = EPSGStdParallel2Lat;
1243 panEPSGCodes[5] = EPSGFalseOriginEasting;
1244 panEPSGCodes[6] = EPSGFalseOriginNorthing;
1245 return TRUE;
1246
1247 case CT_SwissObliqueCylindrical:
1248 panProjParmId[0] = ProjCenterLatGeoKey;
1249 panProjParmId[1] = ProjCenterLongGeoKey;
1250 panProjParmId[5] = ProjFalseEastingGeoKey;
1251 panProjParmId[6] = ProjFalseNorthingGeoKey;
1252
1253 /* EPSG codes? */
1254 return TRUE;
1255
1256 default:
1257 return( FALSE );
1258 }
1259 }
1260
1261 /************************************************************************/
1262 /* GTIFGetProjTRFInfo() */
1263 /* */
1264 /* Transform a PROJECTION_TRF_CODE into a projection method, */
1265 /* and a set of parameters. The parameters identify will */
1266 /* depend on the returned method, but they will all have been */
1267 /* normalized into degrees and meters. */
1268 /************************************************************************/
1269
1270 int GTIFGetProjTRFInfo( /* COORD_OP_CODE from coordinate_operation.csv */
1271 int nProjTRFCode,
1272 char **ppszProjTRFName,
1273 short * pnProjMethod,
1274 double * padfProjParms )
1275
1276 {
1277 int nProjMethod, i, anEPSGCodes[7];
1278 double adfProjParms[7];
1279 char szTRFCode[16];
1280 int nCTProjMethod;
1281 char *pszFilename = CPLStrdup(CSVFilename("projop_wparm.csv"));
1282
1283 /* -------------------------------------------------------------------- */
1284 /* Get the proj method. If this fails to return a meaningful */
1285 /* number, then the whole function fails. */
1286 /* -------------------------------------------------------------------- */
1287 sprintf( szTRFCode, "%d", nProjTRFCode );
1288 nProjMethod =
1289 atoi( CSVGetField( pszFilename,
1290 "COORD_OP_CODE", szTRFCode, CC_Integer,
1291 "COORD_OP_METHOD_CODE" ) );
1292 if( nProjMethod == 0 )
1293 {
1294 CPLFree( pszFilename );
1295 return FALSE;
1296 }
1297
1298 /* -------------------------------------------------------------------- */
1299 /* Initialize a definition of what EPSG codes need to be loaded */
1300 /* into what fields in adfProjParms. */
1301 /* -------------------------------------------------------------------- */
1302 nCTProjMethod = EPSGProjMethodToCTProjMethod( nProjMethod );
1303 SetGTParmIds( nCTProjMethod, NULL, anEPSGCodes );
1304
1305 /* -------------------------------------------------------------------- */
1306 /* Get the parameters for this projection. For the time being */
1307 /* I am assuming the first four parameters are angles, the */
1308 /* fifth is unitless (normally scale), and the remainder are */
1309 /* linear measures. This works fine for the existing */
1310 /* projections, but is a pretty fragile approach. */
1311 /* -------------------------------------------------------------------- */
1312
1313 for( i = 0; i < 7; i++ )
1314 {
1315 char szParamUOMID[32], szParamValueID[32], szParamCodeID[32];
1316 const char *pszValue;
1317 int nUOM;
1318 int nEPSGCode = anEPSGCodes[i];
1319 int iEPSG;
1320
1321 /* Establish default */
1322 if( nEPSGCode == EPSGAngleRectifiedToSkewedGrid )
1323 adfProjParms[i] = 90.0;
1324 else if( nEPSGCode == EPSGNatOriginScaleFactor
1325 || nEPSGCode == EPSGInitialLineScaleFactor
1326 || nEPSGCode == EPSGPseudoStdParallelScaleFactor )
1327 adfProjParms[i] = 1.0;
1328 else
1329 adfProjParms[i] = 0.0;
1330
1331 /* If there is no parameter, skip */
1332 if( nEPSGCode == 0 )
1333 continue;
1334
1335 /* Find the matching parameter */
1336 for( iEPSG = 0; iEPSG < 7; iEPSG++ )
1337 {
1338 sprintf( szParamCodeID, "PARAMETER_CODE_%d", iEPSG+1 );
1339
1340 if( atoi(CSVGetField( pszFilename,
1341 "COORD_OP_CODE", szTRFCode, CC_Integer,
1342 szParamCodeID )) == nEPSGCode )
1343 break;
1344 }
1345
1346 /* not found, accept the default */
1347 if( iEPSG == 7 )
1348 continue;
1349
1350 /* Get the value, and UOM */
1351 sprintf( szParamUOMID, "PARAMETER_UOM_%d", iEPSG+1 );
1352 sprintf( szParamValueID, "PARAMETER_VALUE_%d", iEPSG+1 );
1353
1354 nUOM = atoi(CSVGetField( pszFilename,
1355 "COORD_OP_CODE", szTRFCode, CC_Integer,
1356 szParamUOMID ));
1357 pszValue = CSVGetField( pszFilename,
1358 "COORD_OP_CODE", szTRFCode, CC_Integer,
1359 szParamValueID );
1360
1361 /* Transform according to the UOM */
1362 if( nUOM >= 9100 && nUOM < 9200 )
1363 adfProjParms[i] = GTIFAngleStringToDD( pszValue, nUOM );
1364 else if( nUOM > 9000 && nUOM < 9100 )
1365 {
1366 double dfInMeters;
1367
1368 if( !GTIFGetUOMLengthInfo( nUOM, NULL, &dfInMeters ) )
1369 dfInMeters = 1.0;
1370 adfProjParms[i] = atof(pszValue) * dfInMeters;
1371 }
1372 else
1373 adfProjParms[i] = atof(pszValue);
1374 }
1375
1376 /* -------------------------------------------------------------------- */
1377 /* Get the name, if requested. */
1378 /* -------------------------------------------------------------------- */
1379 if( ppszProjTRFName != NULL )
1380 {
1381 *ppszProjTRFName =
1382 CPLStrdup(CSVGetField( pszFilename,
1383 "COORD_OP_CODE", szTRFCode, CC_Integer,
1384 "COORD_OP_NAME" ));
1385 }
1386
1387 /* -------------------------------------------------------------------- */
1388 /* Transfer requested data into passed variables. */
1389 /* -------------------------------------------------------------------- */
1390 if( pnProjMethod != NULL )
1391 *pnProjMethod = (short) nProjMethod;
1392
1393 if( padfProjParms != NULL )
1394 {
1395 for( i = 0; i < 7; i++ )
1396 padfProjParms[i] = adfProjParms[i];
1397 }
1398
1399 CPLFree( pszFilename );
1400
1401 return TRUE;
1402 }
1403
1404 /************************************************************************/
1405 /* GTIFFetchProjParms() */
1406 /* */
1407 /* Fetch the projection parameters for a particular projection */
1408 /* from a GeoTIFF file, and fill the GTIFDefn structure out */
1409 /* with them. */
1410 /************************************************************************/
1411
1412 static void GTIFFetchProjParms( GTIF * psGTIF, GTIFDefn * psDefn )
1413
1414 {
1415 double dfNatOriginLong = 0.0, dfNatOriginLat = 0.0, dfRectGridAngle = 0.0;
1416 double dfFalseEasting = 0.0, dfFalseNorthing = 0.0, dfNatOriginScale = 1.0;
1417 double dfStdParallel1 = 0.0, dfStdParallel2 = 0.0, dfAzimuth = 0.0;
1418
1419 /* -------------------------------------------------------------------- */
1420 /* Get the false easting, and northing if available. */
1421 /* -------------------------------------------------------------------- */
1422 if( !GTIFKeyGet(psGTIF, ProjFalseEastingGeoKey, &dfFalseEasting, 0, 1)
1423 && !GTIFKeyGet(psGTIF, ProjCenterEastingGeoKey,
1424 &dfFalseEasting, 0, 1)
1425 && !GTIFKeyGet(psGTIF, ProjFalseOriginEastingGeoKey,
1426 &dfFalseEasting, 0, 1) )
1427 dfFalseEasting = 0.0;
1428
1429 if( !GTIFKeyGet(psGTIF, ProjFalseNorthingGeoKey, &dfFalseNorthing,0,1)
1430 && !GTIFKeyGet(psGTIF, ProjCenterNorthingGeoKey,
1431 &dfFalseNorthing, 0, 1)
1432 && !GTIFKeyGet(psGTIF, ProjFalseOriginNorthingGeoKey,
1433 &dfFalseNorthing, 0, 1) )
1434 dfFalseNorthing = 0.0;
1435
1436 switch( psDefn->CTProjection )
1437 {
1438 /* -------------------------------------------------------------------- */
1439 case CT_Stereographic:
1440 /* -------------------------------------------------------------------- */
1441 if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey,
1442 &dfNatOriginLong, 0, 1 ) == 0
1443 && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey,
1444 &dfNatOriginLong, 0, 1 ) == 0
1445 && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey,
1446 &dfNatOriginLong, 0, 1 ) == 0 )
1447 dfNatOriginLong = 0.0;
1448
1449 if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey,
1450 &dfNatOriginLat, 0, 1 ) == 0
1451 && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey,
1452 &dfNatOriginLat, 0, 1 ) == 0
1453 && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey,
1454 &dfNatOriginLat, 0, 1 ) == 0 )
1455 dfNatOriginLat = 0.0;
1456
1457 if( GTIFKeyGet(psGTIF, ProjScaleAtNatOriginGeoKey,
1458 &dfNatOriginScale, 0, 1 ) == 0 )
1459 dfNatOriginScale = 1.0;
1460
1461 /* notdef: should transform to decimal degrees at this point */
1462
1463 psDefn->ProjParm[0] = dfNatOriginLat;
1464 psDefn->ProjParmId[0] = ProjCenterLatGeoKey;
1465 psDefn->ProjParm[1] = dfNatOriginLong;
1466 psDefn->ProjParmId[1] = ProjCenterLongGeoKey;
1467 psDefn->ProjParm[4] = dfNatOriginScale;
1468 psDefn->ProjParmId[4] = ProjScaleAtNatOriginGeoKey;
1469 psDefn->ProjParm[5] = dfFalseEasting;
1470 psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
1471 psDefn->ProjParm[6] = dfFalseNorthing;
1472 psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
1473
1474 psDefn->nParms = 7;
1475 break;
1476
1477 /* -------------------------------------------------------------------- */
1478 case CT_LambertConfConic_1SP:
1479 case CT_Mercator:
1480 case CT_ObliqueStereographic:
1481 case CT_TransverseMercator:
1482 case CT_TransvMercator_SouthOriented:
1483 /* -------------------------------------------------------------------- */
1484 if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey,
1485 &dfNatOriginLong, 0, 1 ) == 0
1486 && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey,
1487 &dfNatOriginLong, 0, 1 ) == 0
1488 && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey,
1489 &dfNatOriginLong, 0, 1 ) == 0 )
1490 dfNatOriginLong = 0.0;
1491
1492 if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey,
1493 &dfNatOriginLat, 0, 1 ) == 0
1494 && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey,
1495 &dfNatOriginLat, 0, 1 ) == 0
1496 && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey,
1497 &dfNatOriginLat, 0, 1 ) == 0 )
1498 dfNatOriginLat = 0.0;
1499
1500 if( GTIFKeyGet(psGTIF, ProjScaleAtNatOriginGeoKey,
1501 &dfNatOriginScale, 0, 1 ) == 0 )
1502 dfNatOriginScale = 1.0;
1503
1504 /* notdef: should transform to decimal degrees at this point */
1505
1506 psDefn->ProjParm[0] = dfNatOriginLat;
1507 psDefn->ProjParmId[0] = ProjNatOriginLatGeoKey;
1508 psDefn->ProjParm[1] = dfNatOriginLong;
1509 psDefn->ProjParmId[1] = ProjNatOriginLongGeoKey;
1510 psDefn->ProjParm[4] = dfNatOriginScale;
1511 psDefn->ProjParmId[4] = ProjScaleAtNatOriginGeoKey;
1512 psDefn->ProjParm[5] = dfFalseEasting;
1513 psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
1514 psDefn->ProjParm[6] = dfFalseNorthing;
1515 psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
1516
1517 psDefn->nParms = 7;
1518 break;
1519
1520 /* -------------------------------------------------------------------- */
1521 case CT_ObliqueMercator: /* hotine */
1522 /* -------------------------------------------------------------------- */
1523 if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey,
1524 &dfNatOriginLong, 0, 1 ) == 0
1525 && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey,
1526 &dfNatOriginLong, 0, 1 ) == 0
1527 && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey,
1528 &dfNatOriginLong, 0, 1 ) == 0 )
1529 dfNatOriginLong = 0.0;
1530
1531 if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey,
1532 &dfNatOriginLat, 0, 1 ) == 0
1533 && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey,
1534 &dfNatOriginLat, 0, 1 ) == 0
1535 && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey,
1536 &dfNatOriginLat, 0, 1 ) == 0 )
1537 dfNatOriginLat = 0.0;
1538
1539 if( GTIFKeyGet(psGTIF, ProjAzimuthAngleGeoKey,
1540 &dfAzimuth, 0, 1 ) == 0 )
1541 dfAzimuth = 0.0;
1542
1543 if( GTIFKeyGet(psGTIF, ProjRectifiedGridAngleGeoKey,
1544 &dfRectGridAngle, 0, 1 ) == 0 )
1545 dfRectGridAngle = 90.0;
1546
1547 if( GTIFKeyGet(psGTIF, ProjScaleAtNatOriginGeoKey,
1548 &dfNatOriginScale, 0, 1 ) == 0
1549 && GTIFKeyGet(psGTIF, ProjScaleAtCenterGeoKey,
1550 &dfNatOriginScale, 0, 1 ) == 0 )
1551 dfNatOriginScale = 1.0;
1552
1553 /* notdef: should transform to decimal degrees at this point */
1554
1555 psDefn->ProjParm[0] = dfNatOriginLat;
1556 psDefn->ProjParmId[0] = ProjCenterLatGeoKey;
1557 psDefn->ProjParm[1] = dfNatOriginLong;
1558 psDefn->ProjParmId[1] = ProjCenterLongGeoKey;
1559 psDefn->ProjParm[2] = dfAzimuth;
1560 psDefn->ProjParmId[2] = ProjAzimuthAngleGeoKey;
1561 psDefn->ProjParm[3] = dfRectGridAngle;
1562 psDefn->ProjParmId[3] = ProjRectifiedGridAngleGeoKey;
1563 psDefn->ProjParm[4] = dfNatOriginScale;
1564 psDefn->ProjParmId[4] = ProjScaleAtCenterGeoKey;
1565 psDefn->ProjParm[5] = dfFalseEasting;
1566 psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
1567 psDefn->ProjParm[6] = dfFalseNorthing;
1568 psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
1569
1570 psDefn->nParms = 7;
1571 break;
1572
1573 /* -------------------------------------------------------------------- */
1574 case CT_CassiniSoldner:
1575 case CT_Polyconic:
1576 /* -------------------------------------------------------------------- */
1577 if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey,
1578 &dfNatOriginLong, 0, 1 ) == 0
1579 && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey,
1580 &dfNatOriginLong, 0, 1 ) == 0
1581 && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey,
1582 &dfNatOriginLong, 0, 1 ) == 0 )
1583 dfNatOriginLong = 0.0;
1584
1585 if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey,
1586 &dfNatOriginLat, 0, 1 ) == 0
1587 && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey,
1588 &dfNatOriginLat, 0, 1 ) == 0
1589 && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey,
1590 &dfNatOriginLat, 0, 1 ) == 0 )
1591 dfNatOriginLat = 0.0;
1592
1593 if( GTIFKeyGet(psGTIF, ProjScaleAtNatOriginGeoKey,
1594 &dfNatOriginScale, 0, 1 ) == 0
1595 && GTIFKeyGet(psGTIF, ProjScaleAtCenterGeoKey,
1596 &dfNatOriginScale, 0, 1 ) == 0 )
1597 dfNatOriginScale = 1.0;
1598
1599 /* notdef: should transform to decimal degrees at this point */
1600
1601 psDefn->ProjParm[0] = dfNatOriginLat;
1602 psDefn->ProjParmId[0] = ProjNatOriginLatGeoKey;
1603 psDefn->ProjParm[1] = dfNatOriginLong;
1604 psDefn->ProjParmId[1] = ProjNatOriginLongGeoKey;
1605 psDefn->ProjParm[4] = dfNatOriginScale;
1606 psDefn->ProjParmId[4] = ProjScaleAtNatOriginGeoKey;
1607 psDefn->ProjParm[5] = dfFalseEasting;
1608 psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
1609 psDefn->ProjParm[6] = dfFalseNorthing;
1610 psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
1611
1612 psDefn->nParms = 7;
1613 break;
1614
1615 /* -------------------------------------------------------------------- */
1616 case CT_AzimuthalEquidistant:
1617 case CT_MillerCylindrical:
1618 case CT_Equirectangular:
1619 case CT_Gnomonic:
1620 case CT_LambertAzimEqualArea:
1621 case CT_Orthographic:
1622 case CT_NewZealandMapGrid:
1623 /* -------------------------------------------------------------------- */
1624 if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey,
1625 &dfNatOriginLong, 0, 1 ) == 0
1626 && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey,
1627 &dfNatOriginLong, 0, 1 ) == 0
1628 && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey,
1629 &dfNatOriginLong, 0, 1 ) == 0 )
1630 dfNatOriginLong = 0.0;
1631
1632 if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey,
1633 &dfNatOriginLat, 0, 1 ) == 0
1634 && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey,
1635 &dfNatOriginLat, 0, 1 ) == 0
1636 && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey,
1637 &dfNatOriginLat, 0, 1 ) == 0 )
1638 dfNatOriginLat = 0.0;
1639
1640 /* notdef: should transform to decimal degrees at this point */
1641
1642 psDefn->ProjParm[0] = dfNatOriginLat;
1643 psDefn->ProjParmId[0] = ProjCenterLatGeoKey;
1644 psDefn->ProjParm[1] = dfNatOriginLong;
1645 psDefn->ProjParmId[1] = ProjCenterLongGeoKey;
1646 psDefn->ProjParm[5] = dfFalseEasting;
1647 psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
1648 psDefn->ProjParm[6] = dfFalseNorthing;
1649 psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
1650
1651 psDefn->nParms = 7;
1652 break;
1653
1654 /* -------------------------------------------------------------------- */
1655 case CT_Robinson:
1656 case CT_Sinusoidal:
1657 case CT_VanDerGrinten:
1658 /* -------------------------------------------------------------------- */
1659 if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey,
1660 &dfNatOriginLong, 0, 1 ) == 0
1661 && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey,
1662 &dfNatOriginLong, 0, 1 ) == 0
1663 && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey,
1664 &dfNatOriginLong, 0, 1 ) == 0 )
1665 dfNatOriginLong = 0.0;
1666
1667 /* notdef: should transform to decimal degrees at this point */
1668
1669 psDefn->ProjParm[1] = dfNatOriginLong;
1670 psDefn->ProjParmId[1] = ProjCenterLongGeoKey;
1671 psDefn->ProjParm[5] = dfFalseEasting;
1672 psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
1673 psDefn->ProjParm[6] = dfFalseNorthing;
1674 psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
1675
1676 psDefn->nParms = 7;
1677 break;
1678
1679 /* -------------------------------------------------------------------- */
1680 case CT_PolarStereographic:
1681 /* -------------------------------------------------------------------- */
1682 if( GTIFKeyGet(psGTIF, ProjStraightVertPoleLongGeoKey,
1683 &dfNatOriginLong, 0, 1 ) == 0
1684 && GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey,
1685 &dfNatOriginLong, 0, 1 ) == 0
1686 && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey,
1687 &dfNatOriginLong, 0, 1 ) == 0
1688 && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey,
1689 &dfNatOriginLong, 0, 1 ) == 0 )
1690 dfNatOriginLong = 0.0;
1691
1692 if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey,
1693 &dfNatOriginLat, 0, 1 ) == 0
1694 && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey,
1695 &dfNatOriginLat, 0, 1 ) == 0
1696 && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey,
1697 &dfNatOriginLat, 0, 1 ) == 0 )
1698 dfNatOriginLat = 0.0;
1699
1700 if( GTIFKeyGet(psGTIF, ProjScaleAtNatOriginGeoKey,
1701 &dfNatOriginScale, 0, 1 ) == 0
1702 && GTIFKeyGet(psGTIF, ProjScaleAtCenterGeoKey,
1703 &dfNatOriginScale, 0, 1 ) == 0 )
1704 dfNatOriginScale = 1.0;
1705
1706 /* notdef: should transform to decimal degrees at this point */
1707
1708 psDefn->ProjParm[0] = dfNatOriginLat;
1709 psDefn->ProjParmId[0] = ProjNatOriginLatGeoKey;;
1710 psDefn->ProjParm[1] = dfNatOriginLong;
1711 psDefn->ProjParmId[1] = ProjStraightVertPoleLongGeoKey;
1712 psDefn->ProjParm[4] = dfNatOriginScale;
1713 psDefn->ProjParmId[4] = ProjScaleAtNatOriginGeoKey;
1714 psDefn->ProjParm[5] = dfFalseEasting;
1715 psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
1716 psDefn->ProjParm[6] = dfFalseNorthing;
1717 psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
1718
1719 psDefn->nParms = 7;
1720 break;
1721
1722 /* -------------------------------------------------------------------- */
1723 case CT_LambertConfConic_2SP:
1724 /* -------------------------------------------------------------------- */
1725 if( GTIFKeyGet(psGTIF, ProjStdParallel1GeoKey,
1726 &dfStdParallel1, 0, 1 ) == 0 )
1727 dfStdParallel1 = 0.0;
1728
1729 if( GTIFKeyGet(psGTIF, ProjStdParallel2GeoKey,
1730 &dfStdParallel2, 0, 1 ) == 0 )
1731 dfStdParallel1 = 0.0;
1732
1733 if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey,
1734 &dfNatOriginLong, 0, 1 ) == 0
1735 && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey,
1736 &dfNatOriginLong, 0, 1 ) == 0
1737 && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey,
1738 &dfNatOriginLong, 0, 1 ) == 0 )
1739 dfNatOriginLong = 0.0;
1740
1741 if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey,
1742 &dfNatOriginLat, 0, 1 ) == 0
1743 && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey,
1744 &dfNatOriginLat, 0, 1 ) == 0
1745 && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey,
1746 &dfNatOriginLat, 0, 1 ) == 0 )
1747 dfNatOriginLat = 0.0;
1748
1749 /* notdef: should transform to decimal degrees at this point */
1750
1751 psDefn->ProjParm[0] = dfNatOriginLat;
1752 psDefn->ProjParmId[0] = ProjFalseOriginLatGeoKey;
1753 psDefn->ProjParm[1] = dfNatOriginLong;
1754 psDefn->ProjParmId[1] = ProjFalseOriginLongGeoKey;
1755 psDefn->ProjParm[2] = dfStdParallel1;
1756 psDefn->ProjParmId[2] = ProjStdParallel1GeoKey;
1757 psDefn->ProjParm[3] = dfStdParallel2;
1758 psDefn->ProjParmId[3] = ProjStdParallel2GeoKey;
1759 psDefn->ProjParm[5] = dfFalseEasting;
1760 psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
1761 psDefn->ProjParm[6] = dfFalseNorthing;
1762 psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
1763
1764 psDefn->nParms = 7;
1765 break;
1766
1767 /* -------------------------------------------------------------------- */
1768 case CT_AlbersEqualArea:
1769 case CT_EquidistantConic:
1770 /* -------------------------------------------------------------------- */
1771 if( GTIFKeyGet(psGTIF, ProjStdParallel1GeoKey,
1772 &dfStdParallel1, 0, 1 ) == 0 )
1773 dfStdParallel1 = 0.0;
1774
1775 if( GTIFKeyGet(psGTIF, ProjStdParallel2GeoKey,
1776 &dfStdParallel2, 0, 1 ) == 0 )
1777 dfStdParallel2 = 0.0;
1778
1779 if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey,
1780 &dfNatOriginLong, 0, 1 ) == 0
1781 && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey,
1782 &dfNatOriginLong, 0, 1 ) == 0
1783 && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey,
1784 &dfNatOriginLong, 0, 1 ) == 0 )
1785 dfNatOriginLong = 0.0;
1786
1787 if( GTIFKeyGet(psGTIF, ProjNatOriginLatGeoKey,
1788 &dfNatOriginLat, 0, 1 ) == 0
1789 && GTIFKeyGet(psGTIF, ProjFalseOriginLatGeoKey,
1790 &dfNatOriginLat, 0, 1 ) == 0
1791 && GTIFKeyGet(psGTIF, ProjCenterLatGeoKey,
1792 &dfNatOriginLat, 0, 1 ) == 0 )
1793 dfNatOriginLat = 0.0;
1794
1795 /* notdef: should transform to decimal degrees at this point */
1796
1797 psDefn->ProjParm[0] = dfStdParallel1;
1798 psDefn->ProjParmId[0] = ProjStdParallel1GeoKey;
1799 psDefn->ProjParm[1] = dfStdParallel2;
1800 psDefn->ProjParmId[1] = ProjStdParallel2GeoKey;
1801 psDefn->ProjParm[2] = dfNatOriginLat;
1802 psDefn->ProjParmId[2] = ProjNatOriginLatGeoKey;
1803 psDefn->ProjParm[3] = dfNatOriginLong;
1804 psDefn->ProjParmId[3] = ProjNatOriginLongGeoKey;
1805 psDefn->ProjParm[5] = dfFalseEasting;
1806 psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
1807 psDefn->ProjParm[6] = dfFalseNorthing;
1808 psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
1809
1810 psDefn->nParms = 7;
1811 break;
1812
1813 /* -------------------------------------------------------------------- */
1814 case CT_CylindricalEqualArea:
1815 /* -------------------------------------------------------------------- */
1816 if( GTIFKeyGet(psGTIF, ProjStdParallel1GeoKey,
1817 &dfStdParallel1, 0, 1 ) == 0 )
1818 dfStdParallel1 = 0.0;
1819
1820 if( GTIFKeyGet(psGTIF, ProjNatOriginLongGeoKey,
1821 &dfNatOriginLong, 0, 1 ) == 0
1822 && GTIFKeyGet(psGTIF, ProjFalseOriginLongGeoKey,
1823 &dfNatOriginLong, 0, 1 ) == 0
1824 && GTIFKeyGet(psGTIF, ProjCenterLongGeoKey,
1825 &dfNatOriginLong, 0, 1 ) == 0 )
1826 dfNatOriginLong = 0.0;
1827
1828 /* notdef: should transform to decimal degrees at this point */
1829
1830 psDefn->ProjParm[0] = dfStdParallel1;
1831 psDefn->ProjParmId[0] = ProjStdParallel1GeoKey;
1832 psDefn->ProjParm[1] = dfNatOriginLong;
1833 psDefn->ProjParmId[1] = ProjNatOriginLongGeoKey;
1834 psDefn->ProjParm[5] = dfFalseEasting;
1835 psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
1836 psDefn->ProjParm[6] = dfFalseNorthing;
1837 psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
1838
1839 psDefn->nParms = 7;
1840 break;
1841 }
1842 }
1843
1844 /************************************************************************/
1845 /* GTIFGetDefn() */
1846 /************************************************************************/
1847
1848 /**
1849 @param psGTIF GeoTIFF information handle as returned by GTIFNew.
1850 @param psDefn Pointer to an existing GTIFDefn structure. This structure
1851 does not need to have been pre-initialized at all.
1852
1853 @return TRUE if the function has been successful, otherwise FALSE.
1854
1855 This function reads the coordinate system definition from a GeoTIFF file,
1856 and <i>normalizes</i> it into a set of component information using
1857 definitions from CSV (Comma Seperated Value ASCII) files derived from
1858 EPSG tables. This function is intended to simplify correct support for
1859 reading files with defined PCS (Projected Coordinate System) codes that
1860 wouldn't otherwise be directly known by application software by reducing
1861 it to the underlying projection method, parameters, datum, ellipsoid,
1862 prime meridian and units.<p>
1863
1864 The application should pass a pointer to an existing uninitialized
1865 GTIFDefn structure, and GTIFGetDefn() will fill it in. The fuction
1866 currently always returns TRUE but in the future will return FALSE if
1867 CSV files are not found. In any event, all geokeys actually found in the
1868 file will be copied into the GTIFDefn. However, if the CSV files aren't
1869 found codes implied by other codes will not be set properly.<p>
1870
1871 GTIFGetDefn() will not generally work if the EPSG derived CSV files cannot
1872 be found. By default a modest attempt will be made to find them, but
1873 in general it is necessary for the calling application to override the
1874 logic to find them. This can be done by calling the
1875 SetCSVFilenameHook() function to
1876 override the search method based on application knowledge of where they are
1877 found.<p>
1878
1879 The normalization methodology operates by fetching tags from the GeoTIFF
1880 file, and then setting all other tags implied by them in the structure. The
1881 implied relationships are worked out by reading definitions from the
1882 various EPSG derived CSV tables.<p>
1883
1884 For instance, if a PCS (ProjectedCSTypeGeoKey) is found in the GeoTIFF file
1885 this code is used to lookup a record in the <tt>horiz_cs.csv</tt> CSV
1886 file. For example given the PCS 26746 we can find the name
1887 (NAD27 / California zone VI), the GCS 4257 (NAD27), and the ProjectionCode
1888 10406 (California CS27 zone VI). The GCS, and ProjectionCode can in turn
1889 be looked up in other tables until all the details of units, ellipsoid,
1890 prime meridian, datum, projection (LambertConfConic_2SP) and projection
1891 parameters are established. A full listgeo dump of a file
1892 for this result might look like the following, all based on a single PCS
1893 value:<p>
1894
1895 <pre>
1896 % listgeo -norm ~/data/geotiff/pci_eg/spaf27.tif
1897 Geotiff_Information:
1898 Version: 1
1899 Key_Revision: 1.0
1900 Tagged_Information:
1901 ModelTiepointTag (2,3):
1902 0 0 0
1903 1577139.71 634349.176 0
1904 ModelPixelScaleTag (1,3):
1905 195.509321 198.32184 0
1906 End_Of_Tags.
1907 Keyed_Information:
1908 GTModelTypeGeoKey (Short,1): ModelTypeProjected
1909 GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
1910 ProjectedCSTypeGeoKey (Short,1): PCS_NAD27_California_VI
1911 End_Of_Keys.
1912 End_Of_Geotiff.
1913
1914 PCS = 26746 (NAD27 / California zone VI)
1915 Projection = 10406 (California CS27 zone VI)
1916 Projection Method: CT_LambertConfConic_2SP
1917 ProjStdParallel1GeoKey: 33.883333
1918 ProjStdParallel2GeoKey: 32.766667
1919 ProjFalseOriginLatGeoKey: 32.166667
1920 ProjFalseOriginLongGeoKey: -116.233333
1921 ProjFalseEastingGeoKey: 609601.219202
1922 ProjFalseNorthingGeoKey: 0.000000
1923 GCS: 4267/NAD27
1924 Datum: 6267/North American Datum 1927
1925 Ellipsoid: 7008/Clarke 1866 (6378206.40,6356583.80)
1926 Prime Meridian: 8901/Greenwich (0.000000)
1927 Projection Linear Units: 9003/US survey foot (0.304801m)
1928 </pre>
1929
1930 Note that GTIFGetDefn() does not inspect or return the tiepoints and scale.
1931 This must be handled seperately as it normally would. It is intended to
1932 simplify capture and normalization of the coordinate system definition.
1933 Note that GTIFGetDefn() also does the following things:
1934
1935 <ol>
1936 <li> Convert all angular values to decimal degrees.
1937 <li> Convert all linear values to meters.
1938 <li> Return the linear units and conversion to meters for the tiepoints and
1939 scale (though the tiepoints and scale remain in their native units).
1940 <li> When reading projection parameters a variety of differences between
1941 different GeoTIFF generators are handled, and a normalized set of parameters
1942 for each projection are always returned.
1943 </ol>
1944
1945 Code fields in the GTIFDefn are filled with KvUserDefined if there is not
1946 value to assign. The parameter lists for each of the underlying projection
1947 transform methods can be found at the
1948 <a href="http://www.remotesensing.org/geotiff/proj_list">Projections</a>
1949 page. Note that nParms will be set based on the maximum parameter used.
1950 Some of the parameters may not be used in which case the
1951 GTIFDefn::ProjParmId[] will
1952 be zero. This is done to retain correspondence to the EPSG parameter
1953 numbering scheme.<p>
1954
1955 The
1956 <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
1957 be used as an example of code that converts a GTIFDefn into another projection
1958 system.<p>
1959
1960 @see GTIFKeySet(), SetCSVFilenameHook()
1961
1962 */
1963
1964 int GTIFGetDefn( GTIF * psGTIF, GTIFDefn * psDefn )
1965
1966 {
1967 int i;
1968 short nGeogUOMLinear;
1969 double dfInvFlattening;
1970
1971 /* -------------------------------------------------------------------- */
1972 /* Initially we default all the information we can. */
1973 /* -------------------------------------------------------------------- */
1974 psDefn->Model = KvUserDefined;
1975 psDefn->PCS = KvUserDefined;
1976 psDefn->GCS = KvUserDefined;
1977 psDefn->UOMLength = KvUserDefined;
1978 psDefn->UOMLengthInMeters = 1.0;
1979 psDefn->UOMAngle = KvUserDefined;
1980 psDefn->UOMAngleInDegrees = 1.0;
1981 psDefn->Datum = KvUserDefined;
1982 psDefn->Ellipsoid = KvUserDefined;
1983 psDefn->SemiMajor = 0.0;
1984 psDefn->SemiMinor = 0.0;
1985 psDefn->PM = KvUserDefined;
1986 psDefn->PMLongToGreenwich = 0.0;
1987
1988 psDefn->ProjCode = KvUserDefined;
1989 psDefn->Projection = KvUserDefined;
1990 psDefn->CTProjection = KvUserDefined;
1991
1992 psDefn->nParms = 0;
1993 for( i = 0; i < MAX_GTIF_PROJPARMS; i++ )
1994 {
1995 psDefn->ProjParm[i] = 0.0;
1996 psDefn->ProjParmId[i] = 0;
1997 }
1998
1999 psDefn->MapSys = KvUserDefined;
2000 psDefn->Zone = 0;
2001
2002 /* -------------------------------------------------------------------- */
2003 /* Try to get the overall model type. */
2004 /* -------------------------------------------------------------------- */
2005 GTIFKeyGet(psGTIF,GTModelTypeGeoKey,&(psDefn->Model),0,1);
2006
2007 /* -------------------------------------------------------------------- */
2008 /* Extract the Geog units. */
2009 /* -------------------------------------------------------------------- */
2010 nGeogUOMLinear = 9001; /* Linear_Meter */
2011 GTIFKeyGet(psGTIF, GeogLinearUnitsGeoKey, &nGeogUOMLinear, 0, 1 );
2012
2013 /* -------------------------------------------------------------------- */
2014 /* Try to get a PCS. */
2015 /* -------------------------------------------------------------------- */
2016 if( GTIFKeyGet(psGTIF,ProjectedCSTypeGeoKey, &(psDefn->PCS),0,1) == 1
2017 && psDefn->PCS != KvUserDefined )
2018 {
2019 /*
2020 * Translate this into useful information.
2021 */
2022 GTIFGetPCSInfo( psDefn->PCS, NULL, &(psDefn->ProjCode),
2023 &(psDefn->UOMLength), &(psDefn->GCS) );
2024 }
2025
2026 /* -------------------------------------------------------------------- */
2027 /* If we have the PCS code, but didn't find it in the CSV files */
2028 /* (likely because we can't find them) we will try some ``jiffy */
2029 /* rules'' for UTM and state plane. */
2030 /* -------------------------------------------------------------------- */
2031 if( psDefn->PCS != KvUserDefined && psDefn->ProjCode == KvUserDefined )
2032 {
2033 int nMapSys, nZone;
2034 int nGCS = psDefn->GCS;
2035
2036 nMapSys = GTIFPCSToMapSys( psDefn->PCS, &nGCS, &nZone );
2037 if( nMapSys != KvUserDefined )
2038 {
2039 psDefn->ProjCode = (short) GTIFMapSysToProj( nMapSys, nZone );
2040 psDefn->GCS = (short) nGCS;
2041 }
2042 }
2043
2044 /* -------------------------------------------------------------------- */
2045 /* If the Proj_ code is specified directly, use that. */
2046 /* -------------------------------------------------------------------- */
2047 if( psDefn->ProjCode == KvUserDefined )
2048 GTIFKeyGet(psGTIF, ProjectionGeoKey, &(psDefn->ProjCode), 0, 1 );
2049
2050 if( psDefn->ProjCode != KvUserDefined )
2051 {
2052 /*
2053 * We have an underlying projection transformation value. Look
2054 * this up. For a PCS of ``WGS 84 / UTM 11'' the transformation
2055 * would be Transverse Mercator, with a particular set of options.
2056 * The nProjTRFCode itself would correspond to the name
2057 * ``UTM zone 11N'', and doesn't include datum info.
2058 */
2059 GTIFGetProjTRFInfo( psDefn->ProjCode, NULL, &(psDefn->Projection),
2060 psDefn->ProjParm );
2061
2062 /*
2063 * Set the GeoTIFF identity of the parameters.
2064 */
2065 psDefn->CTProjection = (short)
2066 EPSGProjMethodToCTProjMethod( psDefn->Projection );
2067
2068 SetGTParmIds( psDefn->CTProjection, psDefn->ProjParmId, NULL);
2069 psDefn->nParms = 7;
2070 }
2071
2072 /* -------------------------------------------------------------------- */
2073 /* Try to get a GCS. If found, it will override any implied by */
2074 /* the PCS. */
2075 /* -------------------------------------------------------------------- */
2076 GTIFKeyGet(psGTIF, GeographicTypeGeoKey, &(psDefn->GCS), 0, 1 );
2077
2078 /* -------------------------------------------------------------------- */
2079 /* Derive the datum, and prime meridian from the GCS. */
2080 /* -------------------------------------------------------------------- */
2081 if( psDefn->GCS != KvUserDefined )
2082 {
2083 GTIFGetGCSInfo( psDefn->GCS, NULL, &(psDefn->Datum), &(psDefn->PM),
2084 &(psDefn->UOMAngle) );
2085 }
2086
2087 /* -------------------------------------------------------------------- */
2088 /* Handle the GCS angular units. GeogAngularUnitsGeoKey */
2089 /* overrides the GCS or PCS setting. */
2090 /* -------------------------------------------------------------------- */
2091 GTIFKeyGet(psGTIF, GeogAngularUnitsGeoKey, &(psDefn->UOMAngle), 0, 1 );
2092 if( psDefn->UOMAngle != KvUserDefined )
2093 {
2094 GTIFGetUOMAngleInfo( psDefn->UOMAngle, NULL,
2095 &(psDefn->UOMAngleInDegrees) );
2096 }
2097
2098 /* -------------------------------------------------------------------- */
2099 /* Check for a datum setting, and then use the datum to derive */
2100 /* an ellipsoid. */
2101 /* -------------------------------------------------------------------- */
2102 GTIFKeyGet(psGTIF, GeogGeodeticDatumGeoKey, &(psDefn->Datum), 0, 1 );
2103
2104 if( psDefn->Datum != KvUserDefined )
2105 {
2106 GTIFGetDatumInfo( psDefn->Datum, NULL, &(psDefn->Ellipsoid) );
2107 }
2108
2109 /* -------------------------------------------------------------------- */
2110 /* Check for an explicit ellipsoid. Use the ellipsoid to */
2111 /* derive the ellipsoid characteristics, if possible. */
2112 /* -------------------------------------------------------------------- */
2113 GTIFKeyGet(psGTIF, GeogEllipsoidGeoKey, &(psDefn->Ellipsoid), 0, 1 );
2114
2115 if( psDefn->Ellipsoid != KvUserDefined )
2116 {
2117 GTIFGetEllipsoidInfo( psDefn->Ellipsoid, NULL,
2118 &(psDefn->SemiMajor), &(psDefn->SemiMinor) );
2119 }
2120
2121 /* -------------------------------------------------------------------- */
2122 /* Check for overridden ellipsoid parameters. It would be nice */
2123 /* to warn if they conflict with provided information, but for */
2124 /* now we just override. */
2125 /* -------------------------------------------------------------------- */
2126 GTIFKeyGet(psGTIF, GeogSemiMajorAxisGeoKey, &(psDefn->SemiMajor), 0, 1 );
2127 GTIFKeyGet(psGTIF, GeogSemiMinorAxisGeoKey, &(psDefn->SemiMinor), 0, 1 );
2128
2129 if( GTIFKeyGet(psGTIF, GeogInvFlatteningGeoKey, &dfInvFlattening,
2130 0, 1 ) == 1 )
2131 {
2132 if( dfInvFlattening != 0.0 )
2133 psDefn->SemiMinor =
2134 psDefn->SemiMajor * (1 - 1.0/dfInvFlattening);
2135 else
2136 psDefn->SemiMinor = psDefn->SemiMajor;
2137 }
2138
2139 /* -------------------------------------------------------------------- */
2140 /* Get the prime meridian info. */
2141 /* -------------------------------------------------------------------- */
2142 GTIFKeyGet(psGTIF, GeogPrimeMeridianGeoKey, &(psDefn->PM), 0, 1 );
2143
2144 if( psDefn->PM != KvUserDefined )
2145 {
2146 GTIFGetPMInfo( psDefn->PM, NULL, &(psDefn->PMLongToGreenwich) );
2147 }
2148 else
2149 {
2150 GTIFKeyGet(psGTIF, GeogPrimeMeridianLongGeoKey,
2151 &(psDefn->PMLongToGreenwich), 0, 1 );
2152
2153 psDefn->PMLongToGreenwich =
2154 GTIFAngleToDD( psDefn->PMLongToGreenwich,
2155 psDefn->UOMAngle );
2156 }
2157
2158 /* -------------------------------------------------------------------- */
2159 /* Have the projection units of measure been overridden? We */
2160 /* should likely be doing something about angular units too, */
2161 /* but these are very rarely not decimal degrees for actual */
2162 /* file coordinates. */
2163 /* -------------------------------------------------------------------- */
2164 GTIFKeyGet(psGTIF,ProjLinearUnitsGeoKey,&(psDefn->UOMLength),0,1);
2165
2166 if( psDefn->UOMLength != KvUserDefined )
2167 {
2168 GTIFGetUOMLengthInfo( psDefn->UOMLength, NULL,
2169 &(psDefn->UOMLengthInMeters) );
2170 }
2171
2172 /* -------------------------------------------------------------------- */
2173 /* Handle a variety of user defined transform types. */
2174 /* -------------------------------------------------------------------- */
2175 if( GTIFKeyGet(psGTIF,ProjCoordTransGeoKey,
2176 &(psDefn->CTProjection),0,1) == 1)
2177 {
2178 GTIFFetchProjParms( psGTIF, psDefn );
2179 }
2180
2181 /* -------------------------------------------------------------------- */
2182 /* Try to set the zoned map system information. */
2183 /* -------------------------------------------------------------------- */
2184 psDefn->MapSys = GTIFProjToMapSys( psDefn->ProjCode, &(psDefn->Zone) );
2185
2186 /* -------------------------------------------------------------------- */
2187 /* If this is UTM, and we were unable to extract the projection */
2188 /* parameters from the CSV file, just set them directly now, */
2189 /* since it's pretty easy, and a common case. */
2190 /* -------------------------------------------------------------------- */
2191 if( (psDefn->MapSys == MapSys_UTM_North
2192 || psDefn->MapSys == MapSys_UTM_South)
2193 && psDefn->CTProjection == KvUserDefined )
2194 {
2195 psDefn->CTProjection = CT_TransverseMercator;
2196 psDefn->nParms = 7;
2197 psDefn->ProjParmId[0] = ProjNatOriginLatGeoKey;
2198 psDefn->ProjParm[0] = 0.0;
2199
2200 psDefn->ProjParmId[1] = ProjNatOriginLongGeoKey;
2201 psDefn->ProjParm[1] = psDefn->Zone*6 - 183.0;
2202
2203 psDefn->ProjParmId[4] = ProjScaleAtNatOriginGeoKey;
2204 psDefn->ProjParm[4] = 0.9996;
2205
2206 psDefn->ProjParmId[5] = ProjFalseEastingGeoKey;
2207 psDefn->ProjParm[5] = 500000.0;
2208
2209 psDefn->ProjParmId[6] = ProjFalseNorthingGeoKey;
2210
2211 if( psDefn->MapSys == MapSys_UTM_North )
2212 psDefn->ProjParm[6] = 0.0;
2213 else
2214 psDefn->ProjParm[6] = 10000000.0;
2215 }
2216
2217 /* -------------------------------------------------------------------- */
2218 /* For now we forceable deaccess all CSV files to reduce the */
2219 /* chance of "leakage". Really, this should be application */
2220 /* controlled. */
2221 /* -------------------------------------------------------------------- */
2222 CSVDeaccess( NULL );
2223
2224 return TRUE;
2225 }
2226
2227 /************************************************************************/
2228 /* GTIFDecToDMS() */
2229 /* */
2230 /* Convenient function to translate decimal degrees to DMS */
2231 /* format for reporting to a user. */
2232 /************************************************************************/
2233
2234 const char *GTIFDecToDMS( double dfAngle, const char * pszAxis,
2235 int nPrecision )
2236
2237 {
2238 int nDegrees, nMinutes;
2239 double dfSeconds;
2240 char szFormat[30];
2241 static char szBuffer[50];
2242 const char *pszHemisphere = NULL;
2243 double dfRound;
2244 int i;
2245
2246 dfRound = 0.5/60;
2247 for( i = 0; i < nPrecision; i++ )
2248 dfRound = dfRound * 0.1;
2249
2250 nDegrees = (int) ABS(dfAngle);
2251 nMinutes = (int) ((ABS(dfAngle) - nDegrees) * 60 + dfRound);
2252 dfSeconds = ABS((ABS(dfAngle) * 3600 - nDegrees*3600 - nMinutes*60));
2253
2254 if( EQUAL(pszAxis,"Long") && dfAngle < 0.0 )
2255 pszHemisphere = "W";
2256 else if( EQUAL(pszAxis,"Long") )
2257 pszHemisphere = "E";
2258 else if( dfAngle < 0.0 )
2259 pszHemisphere = "S";
2260 else
2261 pszHemisphere = "N";
2262
2263 sprintf( szFormat, "%%3dd%%2d\'%%%d.%df\"%s",
2264 nPrecision+3, nPrecision, pszHemisphere );
2265 sprintf( szBuffer, szFormat, nDegrees, nMinutes, dfSeconds );
2266
2267 return( szBuffer );
2268 }
2269
2270 /************************************************************************/
2271 /* GTIFPrintDefn() */
2272 /* */
2273 /* Report the contents of a GTIFDefn structure ... mostly for */
2274 /* debugging. */
2275 /************************************************************************/
2276
2277 void GTIFPrintDefn( GTIFDefn * psDefn, FILE * fp )
2278
2279 {
2280 /* -------------------------------------------------------------------- */
2281 /* Get the PCS name if possible. */
2282 /* -------------------------------------------------------------------- */
2283 if( psDefn->PCS != KvUserDefined )
2284 {
2285 char *pszPCSName = NULL;
2286
2287 GTIFGetPCSInfo( psDefn->PCS, &pszPCSName, NULL, NULL, NULL );
2288 if( pszPCSName == NULL )
2289 pszPCSName = CPLStrdup("name unknown");
2290
2291 fprintf( fp, "PCS = %d (%s)\n", psDefn->PCS, pszPCSName );
2292 CPLFree( pszPCSName );
2293 }
2294
2295 /* -------------------------------------------------------------------- */
2296 /* Dump the projection code if possible. */
2297 /* -------------------------------------------------------------------- */
2298 if( psDefn->ProjCode != KvUserDefined )
2299 {
2300 char *pszTRFName = NULL;
2301
2302 GTIFGetProjTRFInfo( psDefn->ProjCode, &pszTRFName, NULL, NULL );
2303 if( pszTRFName == NULL )
2304 pszTRFName = CPLStrdup("");
2305
2306 fprintf( fp, "Projection = %d (%s)\n",
2307 psDefn->ProjCode, pszTRFName );
2308
2309 CPLFree( pszTRFName );
2310 }
2311
2312 /* -------------------------------------------------------------------- */
2313 /* Try to dump the projection method name, and parameters if possible.*/
2314 /* -------------------------------------------------------------------- */
2315 if( psDefn->CTProjection != KvUserDefined )
2316 {
2317 char *pszName = GTIFValueName(ProjCoordTransGeoKey,
2318 psDefn->CTProjection);
2319 int i;
2320
2321 if( pszName == NULL )
2322 pszName = "(unknown)";
2323
2324 fprintf( fp, "Projection Method: %s\n", pszName );
2325
2326 for( i = 0; i < psDefn->nParms; i++ )
2327 {
2328 if( psDefn->ProjParmId[i] == 0 )
2329 continue;
2330
2331 pszName = GTIFKeyName((geokey_t) psDefn->ProjParmId[i]);
2332 if( pszName == NULL )
2333 pszName = "(unknown)";
2334
2335 if( i < 4 )
2336 {
2337 char *pszAxisName;
2338
2339 if( strstr(pszName,"Long") != NULL )
2340 pszAxisName = "Long";
2341 else if( strstr(pszName,"Lat") != NULL )
2342 pszAxisName = "Lat";
2343 else
2344 pszAxisName = "?";
2345
2346 fprintf( fp, " %s: %f (%s)\n",
2347 pszName, psDefn->ProjParm[i],
2348 GTIFDecToDMS( psDefn->ProjParm[i], pszAxisName, 2 ) );
2349 }
2350 else if( i == 4 )
2351 fprintf( fp, " %s: %f\n", pszName, psDefn->ProjParm[i] );
2352 else
2353 fprintf( fp, " %s: %f m\n", pszName, psDefn->ProjParm[i] );
2354 }
2355 }
2356
2357 /* -------------------------------------------------------------------- */
2358 /* Report the GCS name, and number. */
2359 /* -------------------------------------------------------------------- */
2360 if( psDefn->GCS != KvUserDefined )
2361 {
2362 char *pszName = NULL;
2363
2364 GTIFGetGCSInfo( psDefn->GCS, &pszName, NULL, NULL, NULL );
2365 if( pszName == NULL )
2366 pszName = CPLStrdup("(unknown)");
2367
2368 fprintf( fp, "GCS: %d/%s\n", psDefn->GCS, pszName );
2369 CPLFree( pszName );
2370 }
2371
2372 /* -------------------------------------------------------------------- */
2373 /* Report the datum name. */
2374 /* -------------------------------------------------------------------- */
2375 if( psDefn->Datum != KvUserDefined )
2376 {
2377 char *pszName = NULL;
2378
2379 GTIFGetDatumInfo( psDefn->Datum, &pszName, NULL );
2380 if( pszName == NULL )
2381 pszName = CPLStrdup("(unknown)");
2382
2383 fprintf( fp, "Datum: %d/%s\n", psDefn->Datum, pszName );
2384 CPLFree( pszName );
2385 }
2386
2387 /* -------------------------------------------------------------------- */
2388 /* Report the ellipsoid. */
2389 /* -------------------------------------------------------------------- */
2390 if( psDefn->Ellipsoid != KvUserDefined )
2391 {
2392 char *pszName = NULL;
2393
2394 GTIFGetEllipsoidInfo( psDefn->Ellipsoid, &pszName, NULL, NULL );
2395 if( pszName == NULL )
2396 pszName = CPLStrdup("(unknown)");
2397
2398 fprintf( fp, "Ellipsoid: %d/%s (%.2f,%.2f)\n",
2399 psDefn->Ellipsoid, pszName,
2400 psDefn->SemiMajor, psDefn->SemiMinor );
2401 CPLFree( pszName );
2402 }
2403
2404 /* -------------------------------------------------------------------- */
2405 /* Report the prime meridian. */
2406 /* -------------------------------------------------------------------- */
2407 if( psDefn->PM != KvUserDefined )
2408 {
2409 char *pszName = NULL;
2410
2411 GTIFGetPMInfo( psDefn->PM, &pszName, NULL );
2412
2413 if( pszName == NULL )
2414 pszName = CPLStrdup("(unknown)");
2415
2416 fprintf( fp, "Prime Meridian: %d/%s (%f/%s)\n",
2417 psDefn->PM, pszName,
2418 psDefn->PMLongToGreenwich,
2419 GTIFDecToDMS( psDefn->PMLongToGreenwich, "Long", 2 ) );
2420 CPLFree( pszName );
2421 }
2422
2423 /* -------------------------------------------------------------------- */
2424 /* Report the projection units of measure (currently just */
2425 /* linear). */
2426 /* -------------------------------------------------------------------- */
2427 if( psDefn->UOMLength != KvUserDefined )
2428 {
2429 char *pszName = NULL;
2430
2431 GTIFGetUOMLengthInfo( psDefn->UOMLength, &pszName, NULL );
2432 if( pszName == NULL )
2433 pszName = CPLStrdup( "(unknown)" );
2434
2435 fprintf( fp, "Projection Linear Units: %d/%s (%fm)\n",
2436 psDefn->UOMLength, pszName, psDefn->UOMLengthInMeters );
2437 CPLFree( pszName );
2438 }
2439
2440 CSVDeaccess( NULL );
2441 }
2442
2443 /************************************************************************/
2444 /* GTIFFreeMemory() */
2445 /* */
2446 /* Externally visible function to free memory allocated within */
2447 /* geo_normalize.c. */
2448 /************************************************************************/
2449
2450 void GTIFFreeMemory( char * pMemory )
2451
2452 {
2453 if( pMemory != NULL )
2454 VSIFree( pMemory );
2455 }
2456
2457 /************************************************************************/
2458 /* GTIFDeaccessCSV() */
2459 /* */
2460 /* Free all cached CSV info. */
2461 /************************************************************************/
2462
2463 void GTIFDeaccessCSV()
2464
2465 {
2466 CSVDeaccess( NULL );
2467 }
0 /******************************************************************************
1 * $Id: geo_normalize.h,v 1.12 2005/08/26 16:08:14 fwarmerdam Exp $
2 *
3 * Project: libgeotiff
4 * Purpose: Include file related to geo_normalize.c containing Code to
5 * normalize PCS and other composite codes in a GeoTIFF file.
6 * Author: Frank Warmerdam, warmerda@home.com
7 *
8 ******************************************************************************
9 * Copyright (c) 1999, Frank Warmerdam
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 ******************************************************************************
29 *
30 * $Log: geo_normalize.h,v $
31 * Revision 1.12 2005/08/26 16:08:14 fwarmerdam
32 * Include void in empty argument list for prototype.
33 *
34 * Revision 1.11 2004/02/03 17:19:50 warmerda
35 * export GTIFAngleToDD() - used by GDAL mrsiddataset.cpp
36 *
37 * Revision 1.10 2003/01/15 04:39:16 warmerda
38 * Added GTIFDeaccessCSV
39 *
40 * Revision 1.9 2003/01/15 03:37:40 warmerda
41 * added GTIFFreeMemory()
42 *
43 * Revision 1.8 2002/11/28 22:27:42 warmerda
44 * preliminary upgrade to EPSG 6.2.2 tables
45 *
46 * Revision 1.7 1999/09/17 00:55:26 warmerda
47 * added GTIFGetUOMAngleInfo(), and UOMAngle in GTIFDefn
48 *
49 * Revision 1.6 1999/05/04 03:13:42 warmerda
50 * Added prototype
51 *
52 * Revision 1.5 1999/04/29 23:02:55 warmerda
53 * added docs, and MapSys related stuff
54 *
55 * Revision 1.4 1999/03/18 21:35:19 geotiff
56 * Added PROJ.4 related stuff
57 *
58 * Revision 1.3 1999/03/17 20:44:04 geotiff
59 * added CPL_DLL related support
60 *
61 * Revision 1.2 1999/03/10 18:24:06 geotiff
62 * corrected to use int'
63 *
64 */
65
66 #ifndef GEO_NORMALIZE_H_INCLUDED
67 #define GEO_NORMALIZE_H_INCLUDED
68
69 #include <stdio.h>
70 #include "geotiff.h"
71
72 #ifdef __cplusplus
73 extern "C" {
74 #endif
75
76 /**
77 * \file geo_normalize.h
78 *
79 * Include file for extended projection definition normalization api.
80 */
81
82 #define MAX_GTIF_PROJPARMS 10
83
84 /**
85 * Holds a definition of a coordinate system in normalized form.
86 */
87
88 typedef struct {
89 /** From GTModelTypeGeoKey tag. Can have the values ModelTypeGeographic
90 or ModelTypeProjected. */
91 short Model;
92
93 /** From ProjectedCSTypeGeoKey tag. For example PCS_NAD27_UTM_zone_3N.*/
94 short PCS;
95
96 /** From GeographicTypeGeoKey tag. For example GCS_WGS_84 or
97 GCS_Voirol_1875_Paris. Includes datum and prime meridian value. */
98 short GCS;
99
100 /** From ProjLinearUnitsGeoKey. For example Linear_Meter. */
101 short UOMLength;
102
103 /** One UOMLength = UOMLengthInMeters meters. */
104 double UOMLengthInMeters;
105
106 /** The angular units of the GCS. */
107 short UOMAngle;
108
109 /** One UOMAngle = UOMLengthInDegrees degrees. */
110 double UOMAngleInDegrees;
111
112 /** Datum from GeogGeodeticDatumGeoKey tag. For example Datum_WGS84 */
113 short Datum;
114
115 /** Prime meridian from GeogPrimeMeridianGeoKey. For example PM_Greenwich
116 or PM_Paris. */
117 short PM;
118
119 /** Decimal degrees of longitude between this prime meridian and
120 Greenwich. Prime meridians to the west of Greenwich are negative. */
121 double PMLongToGreenwich;
122
123 /** Ellipsoid identifier from GeogELlipsoidGeoKey. For example
124 Ellipse_Clarke_1866. */
125 short Ellipsoid;
126
127 /** The length of the semi major ellipse axis in meters. */
128 double SemiMajor;
129
130 /** The length of the semi minor ellipse axis in meters. */
131 double SemiMinor;
132
133 /** Projection id from ProjectionGeoKey. For example Proj_UTM_11S. */
134 short ProjCode;
135
136 /** EPSG identifier for underlying projection method. From the EPSG
137 TRF_METHOD table. */
138 short Projection;
139
140 /** GeoTIFF identifier for underlying projection method. While some of
141 these values have corresponding vlaues in EPSG (Projection field),
142 others do not. For example CT_TransverseMercator. */
143 short CTProjection;
144
145 /** Number of projection parameters in ProjParm and ProjParmId. */
146 int nParms;
147
148 /** Projection parameter value. The identify of this parameter
149 is established from the corresponding entry in ProjParmId. The
150 value will be measured in meters, or decimal degrees if it is a
151 linear or angular measure. */
152 double ProjParm[MAX_GTIF_PROJPARMS];
153
154 /** Projection parameter identifier. For example ProjFalseEastingGeoKey.
155 The value will be 0 for unused table entries. */
156 int ProjParmId[MAX_GTIF_PROJPARMS]; /* geokey identifier,
157 eg. ProjFalseEastingGeoKey*/
158
159 /** Special zone map system code (MapSys_UTM_South, MapSys_UTM_North,
160 MapSys_State_Plane or KvUserDefined if none apply. */
161 int MapSys;
162
163 /** UTM, or State Plane Zone number, zero if not known. */
164 int Zone;
165
166 } GTIFDefn;
167
168 int CPL_DLL GTIFGetPCSInfo( int nPCSCode, char **ppszEPSGName,
169 short *pnProjOp,
170 short *pnUOMLengthCode, short *pnGeogCS );
171 int CPL_DLL GTIFGetProjTRFInfo( int nProjTRFCode,
172 char ** ppszProjTRFName,
173 short * pnProjMethod,
174 double * padfProjParms );
175 int CPL_DLL GTIFGetGCSInfo( int nGCSCode, char **ppszName,
176 short *pnDatum, short *pnPM, short *pnUOMAngle );
177 int CPL_DLL GTIFGetDatumInfo( int nDatumCode, char **ppszName,
178 short * pnEllipsoid );
179 int CPL_DLL GTIFGetEllipsoidInfo( int nEllipsoid, char ** ppszName,
180 double * pdfSemiMajor,
181 double * pdfSemiMinor );
182 int CPL_DLL GTIFGetPMInfo( int nPM, char **ppszName,
183 double * pdfLongToGreenwich );
184
185 double CPL_DLL GTIFAngleStringToDD( const char *pszAngle, int nUOMAngle );
186 int CPL_DLL GTIFGetUOMLengthInfo( int nUOMLengthCode,
187 char **ppszUOMName,
188 double * pdfInMeters );
189 int CPL_DLL GTIFGetUOMAngleInfo( int nUOMAngleCode,
190 char **ppszUOMName,
191 double * pdfInDegrees );
192 double CPL_DLL GTIFAngleToDD( double dfAngle, int nUOMAngle );
193
194
195 /* this should be used to free strings returned by GTIFGet... funcs */
196 void CPL_DLL GTIFFreeMemory( char * );
197 void CPL_DLL GTIFDeaccessCSV( void );
198
199 int CPL_DLL GTIFGetDefn( GTIF *psGTIF, GTIFDefn * psDefn );
200 void CPL_DLL GTIFPrintDefn( GTIFDefn *, FILE * );
201 void CPL_DLL GTIFFreeDefn( GTIF * );
202
203 void CPL_DLL SetCSVFilenameHook( const char *(*CSVFileOverride)(const char *) );
204
205 const char CPL_DLL *GTIFDecToDMS( double, const char *, int );
206
207 /*
208 * These are useful for recognising UTM and State Plane, with or without
209 * CSV files being found.
210 */
211
212 #define MapSys_UTM_North -9001
213 #define MapSys_UTM_South -9002
214 #define MapSys_State_Plane_27 -9003
215 #define MapSys_State_Plane_83 -9004
216
217 int CPL_DLL GTIFMapSysToPCS( int MapSys, int Datum, int nZone );
218 int CPL_DLL GTIFMapSysToProj( int MapSys, int nZone );
219 int CPL_DLL GTIFPCSToMapSys( int PCSCode, int * pDatum, int * pZone );
220 int CPL_DLL GTIFProjToMapSys( int ProjCode, int * pZone );
221
222 /*
223 * These are only useful if using libgeotiff with libproj (PROJ.4+).
224 */
225 char CPL_DLL *GTIFGetProj4Defn( GTIFDefn * );
226 int CPL_DLL GTIFProj4ToLatLong( GTIFDefn *, int, double *, double * );
227 int CPL_DLL GTIFProj4FromLatLong( GTIFDefn *, int, double *, double * );
228
229 #if defined(HAVE_LIBPROJ) && defined(HAVE_PROJECTS_H)
230 # define HAVE_GTIFPROJ4
231 #endif
232
233 #ifdef __cplusplus
234 }
235 #endif
236
237 #endif /* ndef GEO_NORMALIZE_H_INCLUDED */
0 /**********************************************************************
1 *
2 * geo_print.c -- Key-dumping routines for GEOTIFF files.
3 *
4 * Written By: Niles D. Ritter.
5 *
6 * copyright (c) 1995 Niles D. Ritter
7 *
8 * Permission granted to use this software, so long as this copyright
9 * notice accompanies any products derived therefrom.
10 *
11 * Revision History;
12 *
13 * 20 June, 1995 Niles D. Ritter New
14 * 7 July, 1995 NDR Fix indexing
15 * 27 July, 1995 NDR Added Import utils
16 * 28 July, 1995 NDR Made parser more strict.
17 * 29 Sep, 1995 NDR Fixed matrix printing.
18 *
19 * $Log: geo_print.c,v $
20 * Revision 1.9 2004/10/19 14:24:09 fwarmerdam
21 * dynamically allocate tag list so large lists work: Oliver Colin
22 *
23 * Revision 1.8 2004/04/27 21:31:31 warmerda
24 * avoid crash if gt_tif is NULL
25 *
26 * Revision 1.7 2003/10/21 19:19:53 warmerda
27 * fixed bug with large message texts sometimes causing a crash
28 *
29 * Revision 1.6 2003/09/23 18:27:30 warmerda
30 * fixed bug with long datum names: bug 399
31 *
32 * Revision 1.5 2003/07/08 17:31:30 warmerda
33 * cleanup various warnings
34 *
35 * Revision 1.4 2002/05/31 14:27:26 warmerda
36 * added escaping in metadata for string key values
37 *
38 * Revision 1.3 1999/05/04 03:14:35 warmerda
39 * avoid warnings
40 *
41 * Revision 1.2 1999/05/03 17:50:31 warmerda
42 * avoid warnings on IRIX
43 *
44 *
45 **********************************************************************/
46
47 #include "geotiff.h" /* public interface */
48 #include "geo_tiffp.h" /* external TIFF interface */
49 #include "geo_keyp.h" /* private interface */
50 #include "geokeys.h"
51
52 #include <stdio.h> /* for sprintf */
53
54 #define FMT_GEOTIFF "Geotiff_Information:"
55 #define FMT_VERSION "Version: %hd"
56 #define FMT_REV "Key_Revision: %1hd.%hd"
57 #define FMT_TAGS "Tagged_Information:"
58 #define FMT_TAGEND "End_Of_Tags."
59 #define FMT_KEYS "Keyed_Information:"
60 #define FMT_KEYEND "End_Of_Keys."
61 #define FMT_GEOEND "End_Of_Geotiff."
62 #define FMT_DOUBLE "%-17.9g"
63 #define FMT_SHORT "%-11hd"
64
65 static void DefaultPrint(char *string, void *aux);
66 static void PrintKey(GeoKey *key, GTIFPrintMethod print,void *aux);
67 static void PrintGeoTags(GTIF *gtif,GTIFReadMethod scan,void *aux);
68 static void PrintTag(int tag, int nrows, double *data, int ncols,
69 GTIFPrintMethod print,void *aux);
70 static void DefaultRead(char *string, void *aux);
71 static int ReadKey(GTIF *gt, GTIFReadMethod scan, void *aux);
72 static int ReadTag(GTIF *gt,GTIFReadMethod scan,void *aux);
73
74 /*
75 * Print off the directory info, using whatever method is specified
76 * (defaults to fprintf if null). The "aux" parameter is provided for user
77 * defined method for passing parameters or whatever.
78 *
79 * The output format is a "GeoTIFF meta-data" file, which may be
80 * used to import information with the GTIFFImport() routine.
81 */
82
83 void GTIFPrint(GTIF *gtif, GTIFPrintMethod print,void *aux)
84 {
85 int i;
86 int numkeys = gtif->gt_num_keys;
87 GeoKey *key = gtif->gt_keys;
88 char message[1024];
89
90 if (!print) print = (GTIFPrintMethod) &DefaultPrint;
91 if (!aux) aux=stdout;
92
93 sprintf(message,FMT_GEOTIFF "\n");
94 print(message,aux);
95 sprintf(message, "Version: %hd" ,gtif->gt_version);
96 sprintf(message, FMT_VERSION,gtif->gt_version);
97 print(" ",aux); print(message,aux); print("\n",aux);
98 sprintf(message, FMT_REV,gtif->gt_rev_major,
99 gtif->gt_rev_minor);
100 print(" ",aux); print(message,aux); print("\n",aux);
101
102 sprintf(message," %s\n",FMT_TAGS); print(message,aux);
103 PrintGeoTags(gtif,print,aux);
104 sprintf(message," %s\n",FMT_TAGEND); print(message,aux);
105
106 sprintf(message," %s\n",FMT_KEYS); print(message,aux);
107 for (i=0; i<numkeys; i++)
108 PrintKey(++key,print,aux);
109 sprintf(message," %s\n",FMT_KEYEND); print(message,aux);
110
111 sprintf(message," %s\n",FMT_GEOEND); print(message,aux);
112 }
113
114 static void PrintGeoTags(GTIF *gt, GTIFPrintMethod print,void *aux)
115 {
116 double *data;
117 int count;
118 tiff_t *tif=gt->gt_tif;
119
120 if( tif == NULL )
121 return;
122
123 if ((gt->gt_methods.get)(tif, GTIFF_TIEPOINTS, &count, &data ))
124 PrintTag(GTIFF_TIEPOINTS,count/3, data, 3, print, aux);
125 if ((gt->gt_methods.get)(tif, GTIFF_PIXELSCALE, &count, &data ))
126 PrintTag(GTIFF_PIXELSCALE,count/3, data, 3, print, aux);
127 if ((gt->gt_methods.get)(tif, GTIFF_TRANSMATRIX, &count, &data ))
128 PrintTag(GTIFF_TRANSMATRIX,count/4, data, 4, print, aux);
129 }
130
131 static void PrintTag(int tag, int nrows, double *dptr, int ncols,
132 GTIFPrintMethod print,void *aux)
133 {
134 int i,j;
135 double *data=dptr;
136 char message[1024];
137
138 print(" ",aux);
139 print(GTIFTagName(tag),aux);
140 sprintf(message," (%d,%d):\n",nrows,ncols);
141 print(message,aux);
142 for (i=0;i<nrows;i++)
143 {
144 print(" ",aux);
145 for (j=0;j<ncols;j++)
146 {
147 sprintf(message,FMT_DOUBLE,*data++);
148 print(message,aux);
149 }
150 print("\n",aux);
151 }
152 _GTIFFree(dptr); /* free up the allocated memory */
153 }
154
155
156 static void PrintKey(GeoKey *key, GTIFPrintMethod print, void *aux)
157 {
158 char *data;
159 geokey_t keyid = (geokey_t) key->gk_key;
160 int count = key->gk_count;
161 int vals_now,i;
162 pinfo_t *sptr;
163 double *dptr;
164 char message[40];
165
166 print(" ",aux);
167 print(GTIFKeyName(keyid),aux);
168
169 sprintf(message," (%s,%d): ",GTIFTypeName(key->gk_type),count);
170 print(message,aux);
171
172 if (key->gk_type==TYPE_SHORT && count==1)
173 data = (char *)&key->gk_data;
174 else
175 data = key->gk_data;
176
177 switch (key->gk_type)
178 {
179 case TYPE_ASCII:
180 {
181 int in_char, out_char;
182
183 print("\"",aux);
184
185 in_char = 0;
186 out_char = 0;
187 while( in_char < count-1 )
188 {
189 char ch = ((char *) data)[in_char++];
190
191 if( ch == '\n' )
192 {
193 message[out_char++] = '\\';
194 message[out_char++] = 'n';
195 }
196 else if( ch == '\\' )
197 {
198 message[out_char++] = '\\';
199 message[out_char++] = '\\';
200 }
201 else
202 message[out_char++] = ch;
203
204 /* flush message if buffer full */
205 if( out_char >= sizeof(message)-3 )
206 {
207 message[out_char] = '\0';
208 print(message,aux);
209 out_char = 0;
210 }
211 }
212
213 message[out_char]='\0';
214 print(message,aux);
215
216 print("\"\n",aux);
217 }
218 break;
219
220 case TYPE_DOUBLE:
221 for (dptr = (double *)data; count > 0; count-= vals_now)
222 {
223 vals_now = count > 3? 3: count;
224 for (i=0; i<vals_now; i++,dptr++)
225 {
226 sprintf(message,FMT_DOUBLE ,*dptr);
227 print(message,aux);
228 }
229 print("\n",aux);
230 }
231 break;
232
233 case TYPE_SHORT:
234 sptr = (pinfo_t *)data;
235 if (count==1)
236 {
237 print( GTIFValueName(keyid,*sptr), aux );
238 print( "\n", aux );
239 }
240 else
241 for (; count > 0; count-= vals_now)
242 {
243 vals_now = count > 3? 3: count;
244 for (i=0; i<vals_now; i++,sptr++)
245 {
246 sprintf(message,FMT_SHORT,*sptr);
247 print(message,aux);
248 }
249 print("\n",aux);
250 }
251 break;
252
253 default:
254 sprintf(message, "Unknown Type (%d)\n",key->gk_type);
255 print(message,aux);
256 break;
257 }
258 }
259
260 static void DefaultPrint(char *string, void *aux)
261 {
262 /* Pretty boring */
263 fprintf((FILE *)aux,string);
264 }
265
266
267 /*
268 * Importing metadata file
269 */
270
271 /*
272 * Import the directory info, using whatever method is specified
273 * (defaults to fscanf if null). The "aux" parameter is provided for user
274 * defined method for passing file or whatever.
275 *
276 * The input format is a "GeoTIFF meta-data" file, which may be
277 * generated by the GTIFFPrint() routine.
278 */
279
280 int GTIFImport(GTIF *gtif, GTIFReadMethod scan,void *aux)
281 {
282 int status;
283 char message[1024];
284
285 if (!scan) scan = (GTIFReadMethod) &DefaultRead;
286 if (!aux) aux=stdin;
287
288 scan(message,aux);
289 if (strncmp(message,FMT_GEOTIFF,8)) return 0;
290 scan(message,aux);
291 if (!sscanf(message,FMT_VERSION,&gtif->gt_version)) return 0;
292 scan(message,aux);
293 if (sscanf(message,FMT_REV,&gtif->gt_rev_major,
294 &gtif->gt_rev_minor) !=2) return 0;
295
296 scan(message,aux);
297 if (strncmp(message,FMT_TAGS,8)) return 0;
298 while ((status=ReadTag(gtif,scan,aux))>0);
299 if (status < 0) return 0;
300
301 scan(message,aux);
302 if (strncmp(message,FMT_KEYS,8)) return 0;
303 while ((status=ReadKey(gtif,scan,aux))>0);
304
305 return (status==0); /* success */
306 }
307
308 static int StringError(char *string)
309 {
310 fprintf(stderr,"Parsing Error at \'%s\'\n",string);
311 return -1;
312 }
313
314 #define SKIPWHITE(vptr) \
315 while (*vptr && (*vptr==' '||*vptr=='\t')) vptr++
316 #define FINDCHAR(vptr,c) \
317 while (*vptr && *vptr!=(c)) vptr++
318
319 static int ReadTag(GTIF *gt,GTIFReadMethod scan,void *aux)
320 {
321 int i,j,tag;
322 char *vptr;
323 char tagname[100];
324 double *data,*dptr;
325 int count,nrows,ncols,num;
326 char message[1024];
327
328 scan(message,aux);
329 if (!strncmp(message,FMT_TAGEND,8)) return 0;
330
331 num=sscanf(message,"%[^( ] (%d,%d):\n",tagname,&nrows,&ncols);
332 if (num!=3) return StringError(message);
333
334 tag = GTIFTagCode(tagname);
335 if (tag < 0) return StringError(tagname);
336
337 count = nrows*ncols;
338
339 data = (double *) _GTIFcalloc(count * sizeof(double));
340 dptr = data;
341
342 for (i=0;i<nrows;i++)
343 {
344 scan(message,aux);
345 vptr = message;
346 for (j=0;j<ncols;j++)
347 {
348 if (!sscanf(vptr,"%lg",dptr++))
349 return StringError(vptr);
350 FINDCHAR(vptr,' ');
351 SKIPWHITE(vptr);
352 }
353 }
354 (gt->gt_methods.set)(gt->gt_tif, (pinfo_t) tag, count, data );
355
356 _GTIFFree( data );
357
358 return 1;
359 }
360
361
362 static int ReadKey(GTIF *gt, GTIFReadMethod scan, void *aux)
363 {
364 tagtype_t ktype;
365 int count,outcount;
366 int vals_now,i;
367 geokey_t key;
368 int icode;
369 pinfo_t code;
370 short *sptr;
371 char name[1000];
372 char type[20];
373 double data[100];
374 double *dptr;
375 char *vptr;
376 int num;
377 char message[2048];
378
379 scan(message,aux);
380 if (!strncmp(message,FMT_KEYEND,8)) return 0;
381
382 num=sscanf(message,"%[^( ] (%[^,],%d):\n",name,type,&count);
383 if (num!=3) return StringError(message);
384
385 vptr = message;
386 FINDCHAR(vptr,':');
387 if (!*vptr) return StringError(message);
388 vptr+=2;
389
390 if( GTIFKeyCode(name) < 0 )
391 return StringError(name);
392 else
393 key = (geokey_t) GTIFKeyCode(name);
394
395 if( GTIFTypeCode(type) < 0 )
396 return StringError(type);
397 else
398 ktype = (tagtype_t) GTIFTypeCode(type);
399
400 /* skip white space */
401 SKIPWHITE(vptr);
402 if (!*vptr) return StringError(message);
403
404 switch (ktype)
405 {
406 case TYPE_ASCII:
407 {
408 char *cdata;
409 int out_char = 0;
410
411 FINDCHAR(vptr,'"');
412 if (!*vptr) return StringError(message);
413
414 cdata = (char *) _GTIFcalloc( count+1 );
415
416 vptr++;
417 while( out_char < count-1 )
418 {
419 if( *vptr == '\0' )
420 break;
421
422 else if( vptr[0] == '\\' && vptr[1] == 'n' )
423 {
424 cdata[out_char++] = '\n';
425 vptr += 2;
426 }
427 else if( vptr[0] == '\\' && vptr[1] == '\\' )
428 {
429 cdata[out_char++] = '\\';
430 vptr += 2;
431 }
432 else
433 cdata[out_char++] = *(vptr++);
434 }
435
436 if( out_char < count-1 ) return StringError(message);
437 if( *vptr != '"' ) return StringError(message);
438
439 cdata[count-1] = '\0';
440 GTIFKeySet(gt,key,ktype,count,cdata);
441
442 _GTIFFree( cdata );
443 }
444 break;
445
446 case TYPE_DOUBLE:
447 outcount = count;
448 for (dptr = data; count > 0; count-= vals_now)
449 {
450 vals_now = count > 3? 3: count;
451 for (i=0; i<vals_now; i++,dptr++)
452 {
453 if (!sscanf(vptr,"%lg" ,dptr))
454 StringError(vptr);
455 FINDCHAR(vptr,' ');
456 SKIPWHITE(vptr);
457 }
458 if (vals_now<count)
459 {
460 scan(message,aux);
461 vptr = message;
462 }
463 }
464 if (outcount==1)
465 GTIFKeySet(gt,key,ktype,outcount,data[0]);
466 else
467 GTIFKeySet(gt,key,ktype,outcount,data);
468 break;
469
470 case TYPE_SHORT:
471 if (count==1)
472 {
473 icode = GTIFValueCode(key,vptr);
474 if (icode < 0) return StringError(vptr);
475 code = (pinfo_t) icode;
476 GTIFKeySet(gt,key,ktype,count,code);
477 }
478 else /* multi-valued short - no such thing yet */
479 {
480 sptr = (short *)data;
481 outcount = count;
482 for (; count > 0; count-= vals_now)
483 {
484 vals_now = count > 3? 3: count;
485 for (i=0; i<vals_now; i++,sptr++)
486 {
487 int work_int;
488
489 /* note: FMT_SHORT (%11hd) not supported on IRIX */
490 sscanf(message,"%11d",&work_int);
491 *sptr = (short) work_int;
492 scan(message,aux);
493 }
494 if (vals_now<count)
495 {
496 scan(message,aux);
497 vptr = message;
498 }
499 }
500 GTIFKeySet(gt,key,ktype,outcount,sptr);
501 }
502 break;
503
504 default:
505 return -1;
506 }
507 return 1;
508 }
509
510
511 static void DefaultRead(char *string, void *aux)
512 {
513 /* Pretty boring */
514 fscanf((FILE *)aux,"%[^\n]\n",string);
515 }
516
0 /**********************************************************************
1 *
2 * geo_set.c -- Public routines for GEOTIFF GeoKey access.
3 *
4 * Written By: Niles D. Ritter.
5 *
6 * copyright (c) 1995 Niles D. Ritter
7 *
8 * Permission granted to use this software, so long as this copyright
9 * notice accompanies any products derived therefrom.
10 *
11 * $Log: geo_set.c,v $
12 * Revision 1.11 2004/04/27 21:32:33 warmerda
13 * reformat for clarity
14 *
15 * Revision 1.10 2003/07/08 17:31:30 warmerda
16 * cleanup various warnings
17 *
18 * Revision 1.9 2003/01/15 03:37:19 warmerda
19 * avoid warning
20 *
21 * Revision 1.8 2002/09/27 13:05:33 warmerda
22 * allow dynamic set/delete of ASCII tags. ASCIIPARAMS now kept split
23 *
24 * Revision 1.7 2001/05/02 16:48:22 warmerda
25 * fixed a couple bugs in delete code
26 *
27 * Revision 1.6 2001/05/02 13:54:34 warmerda
28 * updated geo_set.c to support deleting tags
29 *
30 * Revision 1.5 1999/05/04 03:09:33 warmerda
31 * avoid warnings
32 *
33 * Revision 1.4 1999/05/03 17:50:31 warmerda
34 * avoid warnings on IRIX
35 *
36 * Revision 1.3 1999/04/28 19:59:38 warmerda
37 * added some doxygen style documentation
38 *
39 * Revision 1.2 1999/03/11 17:39:38 geotiff
40 * Added fix for case where a key is being overwritten.
41 *
42 **********************************************************************/
43
44 #include "geotiff.h" /* public interface */
45 #include "geo_tiffp.h" /* external TIFF interface */
46 #include "geo_keyp.h" /* private interface */
47
48 #include <assert.h>
49
50 /**
51 This function writes a geokey_t value to a GeoTIFF file.
52
53 @param gtif The geotiff information handle from GTIFNew().
54
55 @param keyID The geokey_t name (such as ProjectedCSTypeGeoKey).
56 This must come from the list of legal geokey_t values
57 (an enumeration) listed below.
58
59 @param val The <b>val</b> argument is a pointer to the
60 variable into which the value should be read. The type of the variable
61 varies depending on the geokey_t given. While there is no ready mapping
62 of geokey_t values onto types, in general code values are of type <i>short</i>,
63 citations are strings, and everything else is of type <i>double</i>. Note
64 that pointer's to <i>int</i> should never be passed to GTIFKeyGet() for
65 integer values as they will be shorts, and the int's may not be properly
66 initialized (and will be grossly wrong on MSB systems).
67
68 @param index Indicates how far into the list of values
69 for this geokey to offset. Should normally be zero.
70
71 @param count Indicates how many values
72 to read. At this time all keys except for strings have only one value,
73 so <b>index</b> should be zero, and <b>count</b> should be one.<p>
74
75 The <b>key</b> indicates the key name to be written to the
76 file and should from the geokey_t enumeration
77 (eg. <tt>ProjectedCSTypeGeoKey</tt>). The full list of possible geokey_t
78 values can be found in geokeys.inc, or in the online documentation for
79 GTIFKeyGet().<p>
80
81 The <b>type</b> should be one of TYPE_SHORT, TYPE_ASCII, or TYPE_DOUBLE and
82 will indicate the type of value being passed at the end of the argument
83 list (the key value). The <b>count</b> should be one except for strings
84 when it should be the length of the string (or zero to for this to be
85 computed internally). As a special case a <b>count</b> of -1 can be
86 used to request an existing key be deleted, in which no value is passed.<p>
87
88 The actual value is passed at the end of the argument list, and should be
89 a short, a double, or a char * value. Note that short and double values
90 are passed as is, not as pointers.<p>
91
92 Note that key values aren't actually flushed to the file until
93 GTIFWriteKeys() is called. Till then
94 the new values are just kept with the GTIF structure.<p>
95
96 <b>Example:</b><p>
97
98 <pre>
99 GTIFKeySet(gtif, GTRasterTypeGeoKey, TYPE_SHORT, 1,
100 RasterPixelIsArea);
101 GTIFKeySet(gtif, GTCitationGeoKey, TYPE_ASCII, 0,
102 "UTM 11 North / NAD27" );
103 </pre>
104
105 */
106
107 int GTIFKeySet(GTIF *gtif, geokey_t keyID, tagtype_t type, int count,...)
108 {
109 va_list ap;
110 int index = gtif->gt_keyindex[ keyID ];
111 int newvalues = 0;
112 GeoKey *key;
113 char *data = NULL;
114 char *val = NULL;
115 pinfo_t sval;
116 double dval;
117
118 va_start(ap, count);
119 /* pass singleton keys by value */
120 if (count>1 && type!=TYPE_ASCII)
121 {
122 val = va_arg(ap, char*);
123 }
124 else if( count == -1 )
125 {
126 /* delete the indicated tag */
127 va_end(ap);
128
129 if( index < 1 )
130 return 0;
131
132 if (gtif->gt_keys[index].gk_type == TYPE_ASCII)
133 {
134 _GTIFFree (gtif->gt_keys[index].gk_data);
135 }
136
137 while( index < gtif->gt_num_keys )
138 {
139 _GTIFmemcpy( gtif->gt_keys + index,
140 gtif->gt_keys + index + 1,
141 sizeof(GeoKey) );
142 gtif->gt_keyindex[gtif->gt_keys[index].gk_key] = index;
143 index++;
144 }
145
146 gtif->gt_num_keys--;
147 gtif->gt_nshorts -= sizeof(KeyEntry)/sizeof(pinfo_t);
148 gtif->gt_keyindex[keyID] = 0;
149 gtif->gt_flags |= FLAG_FILE_MODIFIED;
150
151 return 1;
152 }
153 else switch (type)
154 {
155 case TYPE_SHORT: sval=(pinfo_t) va_arg(ap, int); val=(char *)&sval; break;
156 case TYPE_DOUBLE: dval=va_arg(ap, dblparam_t); val=(char *)&dval; break;
157 case TYPE_ASCII:
158 val=va_arg(ap, char*);
159 count = strlen(val) + 1; /* force = string length */
160 break;
161 default:
162 assert( FALSE );
163 break;
164 }
165 va_end(ap);
166
167 /* We assume here that there are no multi-valued SHORTS ! */
168 if (index)
169 {
170 /* Key already exists */
171 key = gtif->gt_keys+index;
172 if (type!=key->gk_type || count > key->gk_count)
173 {
174 /* need to reset data pointer */
175 key->gk_type = type;
176 key->gk_count = count;
177 key->gk_size = _gtiff_size[ type ];
178 newvalues = 1;
179 }
180 }
181 else
182 {
183 /* We need to create the key */
184 if (gtif->gt_num_keys == MAX_KEYS) return 0;
185 key = gtif->gt_keys + ++gtif->gt_num_keys;
186 index = gtif->gt_num_keys;
187 gtif->gt_keyindex[ keyID ] = index;
188 key->gk_key = keyID;
189 key->gk_type = type;
190 key->gk_count = count;
191 key->gk_size = _gtiff_size[ type ];
192 if (gtif->gt_keymin > keyID) gtif->gt_keymin=keyID;
193 if (gtif->gt_keymax < keyID) gtif->gt_keymax=keyID;
194 newvalues = 1;
195 }
196
197 if (newvalues)
198 {
199 switch (type)
200 {
201 case TYPE_SHORT:
202 if (count > 1) return 0;
203 data = (char *)&key->gk_data; /* store value *in* data */
204 break;
205 case TYPE_DOUBLE:
206 key->gk_data = (char *)(gtif->gt_double + gtif->gt_ndoubles);
207 data = key->gk_data;
208 gtif->gt_ndoubles += count;
209 break;
210 case TYPE_ASCII:
211 break;
212 default:
213 va_end(ap);
214 return 0;
215 }
216 gtif->gt_nshorts += sizeof(KeyEntry)/sizeof(pinfo_t);
217 }
218
219 /* this fixes a bug where if a request is made to write a duplicate
220 key, we must initialize the data to a valid value.
221 Bryan Wells (bryan@athena.bangor.autometric.com) */
222
223 else /* no new values, but still have something to write */
224 {
225 switch (type)
226 {
227 case TYPE_SHORT:
228 if (count > 1) return 0;
229 data = (char *)&key->gk_data; /* store value *in* data */
230 break;
231 case TYPE_DOUBLE:
232 data = key->gk_data;
233 break;
234 case TYPE_ASCII:
235 break;
236 default:
237 return 0;
238 }
239 }
240
241 switch (type)
242 {
243 case TYPE_ASCII:
244 /* throw away existing data and allocate room for new data */
245 if (key->gk_data != 0)
246 {
247 _GTIFFree(key->gk_data);
248 }
249 key->gk_data = (char *)_GTIFcalloc(count);
250 key->gk_count = count;
251 data = key->gk_data;
252 break;
253 default:
254 break;
255 }
256
257 _GTIFmemcpy(data, val, count*key->gk_size);
258
259 gtif->gt_flags |= FLAG_FILE_MODIFIED;
260 return 1;
261 }
0 /**********************************************************************
1 *
2 * geo_tiffp.c Private TIFF interface module for GEOTIFF
3 *
4 * This module implements the interface between the GEOTIFF
5 * tag parser and the TIFF i/o module. The current setup
6 * relies on the "libtiff" code, but if you use your own
7 * TIFF reader software, you may replace the module implementations
8 * here with your own calls. No "libtiff" dependencies occur
9 * anywhere else in this code.
10 *
11 **********************************************************************/
12
13 #include "geotiff.h" /* public GTIFF interface */
14
15 #include "geo_tiffp.h" /* Private TIFF interface */
16 #include "geo_keyp.h" /* Private GTIFF interface */
17
18 /* tiff size array global */
19 gsize_t _gtiff_size[] = { 0, 1, 2, 4, 8, 1, 4, 8, 1, 2, 4, 1 };
20
21 static int _GTIFGetField (tiff_t *tif, pinfo_t tag, int *count, void *value );
22 static int _GTIFSetField (tiff_t *tif, pinfo_t tag, int count, void *value );
23 static tagtype_t _GTIFTagType (tiff_t *tif, pinfo_t tag);
24
25 /*
26 * Set up default TIFF handlers.
27 */
28 void _GTIFSetDefaultTIFF(TIFFMethod *method)
29 {
30 if (!method) return;
31
32 method->get = _GTIFGetField;
33 method->set = _GTIFSetField;
34 method->type = _GTIFTagType;
35 }
36
37 gdata_t _GTIFcalloc(gsize_t size)
38 {
39 gdata_t data=(gdata_t)_TIFFmalloc((tsize_t)size);
40 if (data) _TIFFmemset((tdata_t)data,0,(tsize_t)size);
41 return data;
42 }
43
44 gdata_t _GTIFrealloc(gdata_t ptr, gsize_t size)
45 {
46 return( _TIFFrealloc((tdata_t)ptr, (tsize_t) size) );
47 }
48
49 void _GTIFmemcpy(gdata_t out,gdata_t in,gsize_t size)
50 {
51 _TIFFmemcpy((tdata_t)out,(tdata_t)in,(tsize_t)size);
52 }
53
54 void _GTIFFree(gdata_t data)
55 {
56 if (data) _TIFFfree((tdata_t)data);
57 }
58
59
60
61 /* returns the value of TIFF tag <tag>, or if
62 * the value is an array, returns an allocated buffer
63 * containing the values. Allocate a copy of the actual
64 * buffer, sized up for updating.
65 */
66 static int _GTIFGetField (tiff_t *tif, pinfo_t tag, int *count, void *val )
67 {
68 int status;
69 unsigned short scount=0;
70 char *tmp;
71 char *value;
72 gsize_t size = _gtiff_size[_GTIFTagType (tif,tag)];
73
74 if (_GTIFTagType(tif, tag) == TYPE_ASCII)
75 {
76 status = TIFFGetField((TIFF *)tif,tag,&tmp);
77 if (!status) return status;
78 scount = (unsigned short) (strlen(tmp)+1);
79 }
80 else status = TIFFGetField((TIFF *)tif,tag,&scount,&tmp);
81 if (!status) return status;
82
83 *count = scount;
84
85 value = (char *)_GTIFcalloc( (scount+MAX_VALUES)*size);
86 if (!value) return 0;
87
88 _TIFFmemcpy( value, tmp, size * scount);
89
90 *(char **)val = value;
91 return status;
92 }
93
94 /*
95 * Set a GeoTIFF TIFF field.
96 */
97 static int _GTIFSetField (tiff_t *tif, pinfo_t tag, int count, void *value )
98 {
99 int status;
100 unsigned short scount = (unsigned short) count;
101
102 /* libtiff ASCII uses null-delimiter */
103 if (_GTIFTagType(tif, tag) == TYPE_ASCII)
104 status = TIFFSetField((TIFF *)tif,tag,value);
105 else
106 status = TIFFSetField((TIFF *)tif,tag,scount,value);
107 return status;
108 }
109
110
111 /*
112 * This routine is supposed to return the TagType of the <tag>
113 * TIFF tag. Unfortunately, "libtiff" does not provide this
114 * service by default, so we just have to "know" what type of tags
115 * we've got, and how many. We only define the ones Geotiff
116 * uses here, and others return UNKNOWN. The "tif" parameter
117 * is provided for those TIFF implementations that provide
118 * for tag-type queries.
119 */
120 static tagtype_t _GTIFTagType (tiff_t *tif, pinfo_t tag)
121 {
122 tagtype_t ttype;
123
124 (void) tif; /* dummy reference */
125
126 switch (tag)
127 {
128 case GTIFF_ASCIIPARAMS: ttype=TYPE_ASCII; break;
129 case GTIFF_PIXELSCALE:
130 case GTIFF_TRANSMATRIX:
131 case GTIFF_TIEPOINTS:
132 case GTIFF_DOUBLEPARAMS: ttype=TYPE_DOUBLE; break;
133 case GTIFF_GEOKEYDIRECTORY: ttype=TYPE_SHORT; break;
134 default: ttype = TYPE_UNKNOWN;
135 }
136
137 return ttype;
138 }
139
0 /**********************************************************************
1 *
2 * geo_tiffp.h - Private interface for TIFF tag parsing.
3 *
4 * Written by: Niles D. Ritter
5 *
6 * This interface file encapsulates the interface to external TIFF
7 * file-io routines and definitions. The current configuration
8 * assumes that the "libtiff" module is used, but if you have your
9 * own TIFF reader, you may replace the definitions with your own
10 * here, and replace the implementations in geo_tiffp.c. No other
11 * modules have any explicit dependence on external TIFF modules.
12 *
13 * Revision History;
14 *
15 * 20 June, 1995 Niles D. Ritter New
16 * 6 July, 1995 Niles D. Ritter Fix prototypes
17 *
18 **********************************************************************/
19
20 #ifndef __geo_tiffp_h_
21 #define __geo_tiffp_h_
22
23 /**********************************************************************
24 *
25 * Private includes
26 *
27 * If you are not using libtiff and XTIFF, replace this include file
28 * with the appropriate one for your own TIFF parsing routines.
29 *
30 * Revision History
31 *
32 * 19 September 1995 ndr Demoted Intergraph trans matrix.
33 *
34 **********************************************************************/
35
36 #include "geotiff.h"
37 #include "xtiffio.h"
38 #include "cpl_serv.h"
39
40 /*
41 * dblparam_t is the type that a double precision
42 * floating point value will have on the parameter
43 * stack (when coerced by the compiler). You shouldn't
44 * have to change this.
45 */
46 #ifdef applec
47 typedef extended dblparam_t;
48 #else
49 typedef double dblparam_t;
50 #endif
51
52
53 /**********************************************************************
54 *
55 * Private defines
56 *
57 * If you are not using "libtiff"/LIBXTIFF, replace these definitions
58 * with the appropriate definitions to access the geo-tags
59 *
60 **********************************************************************/
61
62 typedef unsigned short pinfo_t; /* SHORT ProjectionInfo tag type */
63 typedef TIFF tiff_t; /* TIFF file descriptor */
64 typedef tdata_t gdata_t; /* pointer to data */
65 typedef tsize_t gsize_t; /* data allocation size */
66
67 #define GTIFF_GEOKEYDIRECTORY TIFFTAG_GEOKEYDIRECTORY /* from xtiffio.h */
68 #define GTIFF_DOUBLEPARAMS TIFFTAG_GEODOUBLEPARAMS
69 #define GTIFF_ASCIIPARAMS TIFFTAG_GEOASCIIPARAMS
70 #define GTIFF_PIXELSCALE TIFFTAG_GEOPIXELSCALE
71 #define GTIFF_TRANSMATRIX TIFFTAG_GEOTRANSMATRIX
72 #define GTIFF_INTERGRAPH_MATRIX TIFFTAG_INTERGRAPH_MATRIX
73 #define GTIFF_TIEPOINTS TIFFTAG_GEOTIEPOINTS
74 #define GTIFF_LOCAL 0
75
76 #if defined(__cplusplus)
77 extern "C" {
78 #endif
79
80 /*
81 * Method function pointer types
82 */
83 typedef int (*GTGetFunction) (tiff_t *tif, pinfo_t tag, int *count, void *value );
84 typedef int (*GTSetFunction) (tiff_t *tif, pinfo_t tag, int count, void *value );
85 typedef tagtype_t (*GTTypeFunction) (tiff_t *tif, pinfo_t tag);
86 typedef struct _TIFFMethod {
87 GTGetFunction get;
88 GTSetFunction set;
89 GTTypeFunction type;
90 } TIFFMethod;
91
92 /**********************************************************************
93 *
94 * Protected Function Declarations
95 *
96 * These routines are exposed implementations, and should not
97 * be used by external GEOTIFF client programs.
98 *
99 **********************************************************************/
100
101 extern gsize_t _gtiff_size[]; /* TIFF data sizes */
102 extern void CPL_DLL _GTIFSetDefaultTIFF(TIFFMethod *method);
103 extern gdata_t CPL_DLL _GTIFcalloc(gsize_t);
104 extern gdata_t CPL_DLL _GTIFrealloc(gdata_t,gsize_t);
105 extern void CPL_DLL _GTIFFree(gdata_t data);
106 extern void CPL_DLL _GTIFmemcpy(gdata_t out,gdata_t in,gsize_t size);
107
108 #if defined(__cplusplus)
109 }
110 #endif
111
112
113 #endif /* __geo_tiffp_h_ */
0 /******************************************************************************
1 * $Id: geo_trans.c,v 1.10 2003/07/08 17:31:30 warmerda Exp $
2 *
3 * Project: libgeotiff
4 * Purpose: Code to abstract translation between pixel/line and PCS
5 * coordinates.
6 * Author: Frank Warmerdam, warmerda@home.com
7 *
8 ******************************************************************************
9 * Copyright (c) 1999, Frank Warmerdam
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 ******************************************************************************
29 *
30 * $Log: geo_trans.c,v $
31 * Revision 1.10 2003/07/08 17:31:30 warmerda
32 * cleanup various warnings
33 *
34 * Revision 1.9 2001/11/28 14:20:30 warmerda
35 * fixed transform memory leak in GTIFPCSToImage
36 *
37 * Revision 1.8 2001/04/06 16:56:22 warmerda
38 * added support for PCSToImage with matrix
39 *
40 * Revision 1.7 2001/03/05 03:25:23 warmerda
41 * restructure cleanup, and apply to GTIFPCSToImage()
42 *
43 * Revision 1.6 2001/03/04 22:37:39 warmerda
44 * fixed memory leak for fields fetched with gt_methods.get - Alan Gray
45 *
46 * Revision 1.5 2000/08/22 03:32:46 warmerda
47 * removed GTIFTiepointTranslate code
48 *
49 * Revision 1.4 1999/09/17 01:19:51 warmerda
50 * Fixed bug in use of transform matrix.
51 *
52 * Revision 1.3 1999/09/16 21:25:40 warmerda
53 * Added tiepoint, and transformation matrix based translation. Note
54 * that we don't try to invert the transformation matrix for
55 * GTIFPCSToImage().
56 *
57 * Revision 1.2 1999/09/07 20:00:40 warmerda
58 * Fixed count/tiepoint_count bug in GTIFPCSToImage().
59 *
60 * Revision 1.1 1999/05/04 03:07:57 warmerda
61 * New
62 *
63 */
64
65 #include "geotiff.h"
66 #include "geo_tiffp.h" /* external TIFF interface */
67 #include "geo_keyp.h" /* private interface */
68 #include "geokeys.h"
69
70 /************************************************************************/
71 /* inv_geotransform() */
72 /* */
73 /* Invert a 6 term geotransform style matrix. */
74 /************************************************************************/
75
76 static int inv_geotransform( double *gt_in, double *gt_out )
77
78 {
79 double det, inv_det;
80
81 /* we assume a 3rd row that is [0 0 1] */
82
83 /* Compute determinate */
84
85 det = gt_in[0] * gt_in[4] - gt_in[1] * gt_in[3];
86
87 if( fabs(det) < 0.000000000000001 )
88 return 0;
89
90 inv_det = 1.0 / det;
91
92 /* compute adjoint, and devide by determinate */
93
94 gt_out[0] = gt_in[4] * inv_det;
95 gt_out[3] = -gt_in[3] * inv_det;
96
97 gt_out[1] = -gt_in[1] * inv_det;
98 gt_out[4] = gt_in[0] * inv_det;
99
100 gt_out[2] = ( gt_in[1] * gt_in[5] - gt_in[2] * gt_in[4]) * inv_det;
101 gt_out[5] = (-gt_in[0] * gt_in[5] + gt_in[2] * gt_in[3]) * inv_det;
102
103 return 1;
104 }
105
106 /************************************************************************/
107 /* GTIFTiepointTranslate() */
108 /************************************************************************/
109
110 int GTIFTiepointTranslate( int gcp_count, double * gcps_in, double * gcps_out,
111 double x_in, double y_in,
112 double *x_out, double *y_out )
113
114 {
115 (void) gcp_count;
116 (void) gcps_in;
117 (void) gcps_out;
118 (void) x_in;
119 (void) y_in;
120 (void) x_out;
121 (void) y_out;
122
123 /* I would appreciate a _brief_ block of code for doing second order
124 polynomial regression here! */
125 return FALSE;
126 }
127
128
129 /************************************************************************/
130 /* GTIFImageToPCS() */
131 /************************************************************************/
132
133 /**
134 * Translate a pixel/line coordinate to projection coordinates.
135 *
136 * At this time this function does not support image to PCS translations for
137 * tiepoints-only definitions, only pixelscale and transformation matrix
138 * formulations.
139 *
140 * @param gtif The handle from GTIFNew() indicating the target file.
141 * @param x A pointer to the double containing the pixel offset on input,
142 * and into which the easting/longitude will be put on completion.
143 * @param y A pointer to the double containing the line offset on input,
144 * and into which the northing/latitude will be put on completion.
145 *
146 * @return TRUE if the transformation succeeds, or FALSE if it fails. It may
147 * fail if the file doesn't have properly setup transformation information,
148 * or it is in a form unsupported by this function.
149 */
150
151 int GTIFImageToPCS( GTIF *gtif, double *x, double *y )
152
153 {
154 int res = FALSE;
155 int tiepoint_count, count, transform_count;
156 tiff_t *tif=gtif->gt_tif;
157 double *tiepoints = 0;
158 double *pixel_scale = 0;
159 double *transform = 0;
160
161
162 if (!(gtif->gt_methods.get)(tif, GTIFF_TIEPOINTS,
163 &tiepoint_count, &tiepoints ))
164 tiepoint_count = 0;
165
166 if (!(gtif->gt_methods.get)(tif, GTIFF_PIXELSCALE, &count, &pixel_scale ))
167 count = 0;
168
169 if (!(gtif->gt_methods.get)(tif, GTIFF_TRANSMATRIX,
170 &transform_count, &transform ))
171 transform_count = 0;
172
173 /* -------------------------------------------------------------------- */
174 /* If the pixelscale count is zero, but we have tiepoints use */
175 /* the tiepoint based approach. */
176 /* -------------------------------------------------------------------- */
177 if( tiepoint_count > 6 && count == 0 )
178 {
179 res = GTIFTiepointTranslate( tiepoint_count / 6,
180 tiepoints, tiepoints + 3,
181 *x, *y, x, y );
182 }
183
184 /* -------------------------------------------------------------------- */
185 /* If we have a transformation matrix, use it. */
186 /* -------------------------------------------------------------------- */
187 else if( transform_count == 16 )
188 {
189 double x_in = *x, y_in = *y;
190
191 *x = x_in * transform[0] + y_in * transform[1] + transform[3];
192 *y = x_in * transform[4] + y_in * transform[5] + transform[7];
193
194 res = TRUE;
195 }
196
197 /* -------------------------------------------------------------------- */
198 /* For now we require one tie point, and a valid pixel scale. */
199 /* -------------------------------------------------------------------- */
200 else if( count < 3 || tiepoint_count < 6 )
201 {
202 res = FALSE;
203 }
204
205 else
206 {
207 *x = (*x - tiepoints[0]) * pixel_scale[0] + tiepoints[3];
208 *y = (*y - tiepoints[1]) * (-1 * pixel_scale[1]) + tiepoints[4];
209
210 res = TRUE;
211 }
212
213 /* -------------------------------------------------------------------- */
214 /* Cleanup */
215 /* -------------------------------------------------------------------- */
216 if(tiepoints)
217 _GTIFFree(tiepoints);
218 if(pixel_scale)
219 _GTIFFree(pixel_scale);
220 if(transform)
221 _GTIFFree(transform);
222
223 return res;
224 }
225
226 /************************************************************************/
227 /* GTIFPCSToImage() */
228 /************************************************************************/
229
230 /**
231 * Translate a projection coordinate to pixel/line coordinates.
232 *
233 * At this time this function does not support PCS to image translations for
234 * tiepoints-only based definitions, only matrix and pixelscale/tiepoints
235 * formulations are supposed.
236 *
237 * @param gtif The handle from GTIFNew() indicating the target file.
238 * @param x A pointer to the double containing the pixel offset on input,
239 * and into which the easting/longitude will be put on completion.
240 * @param y A pointer to the double containing the line offset on input,
241 * and into which the northing/latitude will be put on completion.
242 *
243 * @return TRUE if the transformation succeeds, or FALSE if it fails. It may
244 * fail if the file doesn't have properly setup transformation information,
245 * or it is in a form unsupported by this function.
246 */
247
248 int GTIFPCSToImage( GTIF *gtif, double *x, double *y )
249
250 {
251 double *tiepoints = NULL;
252 int tiepoint_count, count, transform_count = 0;
253 double *pixel_scale = NULL;
254 double *transform = NULL;
255 tiff_t *tif=gtif->gt_tif;
256 int result = FALSE;
257
258 /* -------------------------------------------------------------------- */
259 /* Fetch tiepoints and pixel scale. */
260 /* -------------------------------------------------------------------- */
261 if (!(gtif->gt_methods.get)(tif, GTIFF_TIEPOINTS,
262 &tiepoint_count, &tiepoints ))
263 tiepoint_count = 0;
264
265 if (!(gtif->gt_methods.get)(tif, GTIFF_PIXELSCALE, &count, &pixel_scale ))
266 count = 0;
267
268 if (!(gtif->gt_methods.get)(tif, GTIFF_TRANSMATRIX,
269 &transform_count, &transform ))
270 transform_count = 0;
271
272 /* -------------------------------------------------------------------- */
273 /* If the pixelscale count is zero, but we have tiepoints use */
274 /* the tiepoint based approach. */
275 /* -------------------------------------------------------------------- */
276 if( tiepoint_count > 6 && count == 0 )
277 {
278 result = GTIFTiepointTranslate( tiepoint_count / 6,
279 tiepoints + 3, tiepoints,
280 *x, *y, x, y );
281 }
282
283 /* -------------------------------------------------------------------- */
284 /* Handle matrix - convert to "geotransform" format, invert and */
285 /* apply. */
286 /* -------------------------------------------------------------------- */
287 else if( transform_count == 16 )
288 {
289 double x_in = *x, y_in = *y;
290 double gt_in[6], gt_out[6];
291
292 gt_in[0] = transform[0];
293 gt_in[1] = transform[1];
294 gt_in[2] = transform[3];
295 gt_in[3] = transform[4];
296 gt_in[4] = transform[5];
297 gt_in[5] = transform[7];
298
299 if( !inv_geotransform( gt_in, gt_out ) )
300 result = FALSE;
301 else
302 {
303 *x = x_in * gt_out[0] + y_in * gt_out[1] + gt_out[2];
304 *y = x_in * gt_out[3] + y_in * gt_out[4] + gt_out[5];
305
306 result = TRUE;
307 }
308 }
309
310 /* -------------------------------------------------------------------- */
311 /* For now we require one tie point, and a valid pixel scale. */
312 /* -------------------------------------------------------------------- */
313 else if( count >= 3 && tiepoint_count >= 6 )
314 {
315 *x = (*x - tiepoints[3]) / pixel_scale[0] + tiepoints[0];
316 *y = (*y - tiepoints[4]) / (-1 * pixel_scale[1]) + tiepoints[1];
317
318 result = TRUE;
319 }
320
321 /* -------------------------------------------------------------------- */
322 /* Cleanup. */
323 /* -------------------------------------------------------------------- */
324 if(tiepoints)
325 _GTIFFree(tiepoints);
326 if(pixel_scale)
327 _GTIFFree(pixel_scale);
328 if(transform)
329 _GTIFFree(transform);
330
331 return result;
332 }
333
0 /**********************************************************************
1 *
2 * geo_write.c -- Public routines for GEOTIFF GeoKey access.
3 *
4 * Written By: Niles D. Ritter.
5 *
6 * copyright (c) 1995 Niles D. Ritter
7 *
8 * Permission granted to use this software, so long as this copyright
9 * notice accompanies any source code derived therefrom.
10 *
11 **********************************************************************/
12
13 #include "geotiffio.h" /* public interface */
14 #include "geo_tiffp.h" /* external TIFF interface */
15 #include "geo_keyp.h" /* private interface */
16
17 static int WriteKey(GTIF* gt, TempKeyData* tempData,
18 KeyEntry* entptr, GeoKey* keyptr);
19 static int SortKeys(GTIF* gt,int *sortkeys);
20
21
22 /**
23 This function flushes all the GeoTIFF keys that have been set with the
24 GTIFKeySet() function into the associated
25 TIFF file.
26
27 @param gt The GeoTIFF handle returned by GTIFNew.
28
29 GTIFWriteKeys() should be called before
30 GTIFFree() is used to deallocate a GeoTIFF access handle.
31 */
32
33 int GTIFWriteKeys(GTIF *gt)
34 {
35 int i;
36 GeoKey *keyptr;
37 KeyEntry *entptr;
38 KeyHeader *header;
39 TempKeyData tempData;
40 int sortkeys[MAX_KEYS];
41
42 if (!(gt->gt_flags & FLAG_FILE_MODIFIED)) return 1;
43
44 if( gt->gt_tif == NULL )
45 return 0;
46
47 tempData.tk_asciiParams = 0;
48 tempData.tk_asciiParamsLength = 0;
49 tempData.tk_asciiParamsOffset = 0;
50
51 /* Sort the Keys into numerical order */
52 if (!SortKeys(gt,sortkeys))
53 {
54 /* XXX error: a key was not recognized */
55 }
56
57 /* Set up header of ProjectionInfo tag */
58 header = (KeyHeader *)gt->gt_short;
59 header->hdr_num_keys = (pinfo_t) gt->gt_num_keys;
60 header->hdr_version = GvCurrentVersion;
61 header->hdr_rev_major = GvCurrentRevision;
62 header->hdr_rev_minor = GvCurrentMinorRev;
63
64 /* Sum up the ASCII tag lengths */
65 for (i = 0; i < gt->gt_num_keys; i++)
66 {
67 keyptr = gt->gt_keys + sortkeys[i];
68 if (keyptr->gk_type == TYPE_ASCII)
69 {
70 tempData.tk_asciiParamsLength += keyptr->gk_count;
71 }
72 }
73 if (tempData.tk_asciiParamsLength > 0)
74 {
75 tempData.tk_asciiParams =
76 (char *)_GTIFcalloc(tempData.tk_asciiParamsLength + 1);
77 tempData.tk_asciiParams[tempData.tk_asciiParamsLength] = '\0';
78 }
79
80 /* Set up the rest of SHORT array properly */
81 keyptr = gt->gt_keys;
82 entptr = (KeyEntry*)(gt->gt_short + 4);
83 for (i=0; i< gt->gt_num_keys; i++,entptr++)
84 {
85 if (!WriteKey(gt,&tempData,entptr,keyptr+sortkeys[i])) return 0;
86 }
87
88 /* Write out the Key Directory */
89 (gt->gt_methods.set)(gt->gt_tif, GTIFF_GEOKEYDIRECTORY, gt->gt_nshorts, gt->gt_short );
90
91 /* Write out the params directories */
92 if (gt->gt_ndoubles)
93 (gt->gt_methods.set)(gt->gt_tif, GTIFF_DOUBLEPARAMS, gt->gt_ndoubles, gt->gt_double );
94 if (tempData.tk_asciiParamsLength > 0)
95 {
96 /* just to be safe */
97 tempData.tk_asciiParams[tempData.tk_asciiParamsLength] = '\0';
98 (gt->gt_methods.set)(gt->gt_tif,
99 GTIFF_ASCIIPARAMS, 0, tempData.tk_asciiParams);
100 }
101
102 gt->gt_flags &= ~FLAG_FILE_MODIFIED;
103
104 if (tempData.tk_asciiParamsLength > 0)
105 {
106 _GTIFFree (tempData.tk_asciiParams);
107 }
108 return 1;
109 }
110
111 /**********************************************************************
112 *
113 * Private Routines
114 *
115 **********************************************************************/
116
117 /*
118 * Given GeoKey, write out the KeyEntry entries, returning 0 if failure.
119 * This is the exact complement of ReadKey().
120 */
121
122 static int WriteKey(GTIF* gt, TempKeyData* tempData,
123 KeyEntry* entptr, GeoKey* keyptr)
124 {
125 int count;
126
127 entptr->ent_key = (pinfo_t) keyptr->gk_key;
128 entptr->ent_count = (pinfo_t) keyptr->gk_count;
129 count = entptr->ent_count;
130
131 if (count==1 && keyptr->gk_type==TYPE_SHORT)
132 {
133 entptr->ent_location = GTIFF_LOCAL;
134 entptr->ent_val_offset = *(pinfo_t*)&keyptr->gk_data;
135 return 1;
136 }
137
138 switch (keyptr->gk_type)
139 {
140 case TYPE_SHORT:
141 entptr->ent_location = GTIFF_GEOKEYDIRECTORY;
142 entptr->ent_val_offset = (pinfo_t)
143 ((pinfo_t*)keyptr->gk_data - gt->gt_short);
144 break;
145 case TYPE_DOUBLE:
146 entptr->ent_location = GTIFF_DOUBLEPARAMS;
147 entptr->ent_val_offset = (pinfo_t)
148 ((double*)keyptr->gk_data - gt->gt_double);
149 break;
150 case TYPE_ASCII:
151 entptr->ent_location = GTIFF_ASCIIPARAMS;
152 entptr->ent_val_offset = (pinfo_t) tempData->tk_asciiParamsOffset;
153 _GTIFmemcpy (tempData->tk_asciiParams + tempData->tk_asciiParamsOffset
154 , keyptr->gk_data, keyptr->gk_count);
155 tempData->tk_asciiParams[tempData->tk_asciiParamsOffset+keyptr->gk_count-1] = '|';
156 tempData->tk_asciiParamsOffset += keyptr->gk_count;
157 break;
158 default:
159 return 0; /* failure */
160 }
161
162 return 1; /* success */
163 }
164
165
166 /*
167 * Numerically sort the GeoKeys.
168 * We just do a linear search through
169 * the list and pull out the keys that were set.
170 */
171
172 static int SortKeys(GTIF* gt,int *sortkeys)
173 {
174 int loc;
175 int nkeys=0;
176 geokey_t key,kmin,kmax;
177 int *index = gt->gt_keyindex;
178
179 kmin = (geokey_t) gt->gt_keymin;
180 kmax = (geokey_t) gt->gt_keymax;
181 for (key=kmin; key<=kmax; key++)
182 {
183 if ( (loc=index[key]) != 0 )
184 {
185 sortkeys[nkeys] = loc;
186 nkeys++;
187 }
188 }
189
190 return nkeys==gt->gt_num_keys;
191 }
192
0 /**********************************************************************
1 *
2 * geokeys.h - Public registry for valid GEOTIFF GeoKeys.
3 *
4 * Written By: Niles D. Ritter
5 *
6 * Revision History:
7 *
8 * Rev.# Author M/D/Y Date Key Changes/Additions
9 * ----- ------ ---------- -------------------------------------
10 * 0 ndr 06/10/95 Inital Beta Release
11 * 1 ndr 09/18/95 Final 1.0 Release
12 *
13 **********************************************************************/
14
15 #ifndef __geokeys_h_
16 #define __geokeys_h_
17
18 /* The GvCurrentRevision number should be incremented whenever a
19 * new set of Keys are defined or modified in "geokeys.inc", and comments
20 * added to the "Revision History" section above. If only code
21 * _values_ are augmented, the "GvCurrentMinorRev" number should
22 * be incremented instead (see "geovalues.h"). Whenever the
23 * GvCurrentRevision is incremented, the GvCurrentMinorRev should
24 * be reset to zero.
25 *
26 *
27 * The Section Numbers below refer to the GeoTIFF Spec sections
28 * in which these values are documented.
29 *
30 */
31 #define GvCurrentRevision 1 /* Final 1.0 Release */
32
33 #ifdef ValuePair
34 # undef ValuePair
35 #endif
36 #define ValuePair(name,value) name = value,
37
38 typedef enum {
39 BaseGeoKey = 1024, /* First valid code */
40
41 # include "geokeys.inc" /* geokey database */
42
43 ReservedEndGeoKey = 32767,
44
45 /* Key space available for Private or internal use */
46 PrivateBaseGeoKey = 32768, /* Consistent with TIFF Private tags */
47 PrivateEndGeoKey = 65535,
48
49 EndGeoKey = 65535 /* Largest Possible GeoKey ID */
50 } geokey_t;
51
52
53 #endif /* __geokeys_h_ */
0 /* GeoTIFF GeoKey Database */
1
2 /* Note: Any changes/additions to this database require */
3 /* a change in the revision value in geokeys.h */
4
5 /* C database for Geotiff include files. */
6 /* the macro ValuePair() must be defined */
7 /* by the enclosing include file */
8
9 /* Revised 28 Sep 1995 NDR -- Added Rev. 1.0 aliases. */
10
11 /* 6.2.1 GeoTIFF Configuration Keys */
12
13 ValuePair( GTModelTypeGeoKey, 1024) /* Section 6.3.1.1 Codes */
14 ValuePair( GTRasterTypeGeoKey, 1025) /* Section 6.3.1.2 Codes */
15 ValuePair( GTCitationGeoKey, 1026) /* documentation */
16
17 /* 6.2.2 Geographic CS Parameter Keys */
18
19 ValuePair( GeographicTypeGeoKey, 2048) /* Section 6.3.2.1 Codes */
20 ValuePair( GeogCitationGeoKey, 2049) /* documentation */
21 ValuePair( GeogGeodeticDatumGeoKey, 2050) /* Section 6.3.2.2 Codes */
22 ValuePair( GeogPrimeMeridianGeoKey, 2051) /* Section 6.3.2.4 codes */
23 ValuePair( GeogLinearUnitsGeoKey, 2052) /* Section 6.3.1.3 Codes */
24 ValuePair( GeogLinearUnitSizeGeoKey, 2053) /* meters */
25 ValuePair( GeogAngularUnitsGeoKey, 2054) /* Section 6.3.1.4 Codes */
26 ValuePair( GeogAngularUnitSizeGeoKey, 2055) /* radians */
27 ValuePair( GeogEllipsoidGeoKey, 2056) /* Section 6.3.2.3 Codes */
28 ValuePair( GeogSemiMajorAxisGeoKey, 2057) /* GeogLinearUnits */
29 ValuePair( GeogSemiMinorAxisGeoKey, 2058) /* GeogLinearUnits */
30 ValuePair( GeogInvFlatteningGeoKey, 2059) /* ratio */
31 ValuePair( GeogAzimuthUnitsGeoKey, 2060) /* Section 6.3.1.4 Codes */
32 ValuePair( GeogPrimeMeridianLongGeoKey, 2061) /* GeoAngularUnit */
33
34 /* 6.2.3 Projected CS Parameter Keys */
35 /* Several keys have been renamed,*/
36 /* and the deprecated names aliased for backward compatibility */
37
38 ValuePair( ProjectedCSTypeGeoKey, 3072) /* Section 6.3.3.1 codes */
39 ValuePair( PCSCitationGeoKey, 3073) /* documentation */
40 ValuePair( ProjectionGeoKey, 3074) /* Section 6.3.3.2 codes */
41 ValuePair( ProjCoordTransGeoKey, 3075) /* Section 6.3.3.3 codes */
42 ValuePair( ProjLinearUnitsGeoKey, 3076) /* Section 6.3.1.3 codes */
43 ValuePair( ProjLinearUnitSizeGeoKey, 3077) /* meters */
44 ValuePair( ProjStdParallel1GeoKey, 3078) /* GeogAngularUnit */
45 ValuePair( ProjStdParallelGeoKey,ProjStdParallel1GeoKey) /* ** alias ** */
46 ValuePair( ProjStdParallel2GeoKey, 3079) /* GeogAngularUnit */
47 ValuePair( ProjNatOriginLongGeoKey, 3080) /* GeogAngularUnit */
48 ValuePair( ProjOriginLongGeoKey,ProjNatOriginLongGeoKey) /* ** alias ** */
49 ValuePair( ProjNatOriginLatGeoKey, 3081) /* GeogAngularUnit */
50 ValuePair( ProjOriginLatGeoKey,ProjNatOriginLatGeoKey) /* ** alias ** */
51 ValuePair( ProjFalseEastingGeoKey, 3082) /* ProjLinearUnits */
52 ValuePair( ProjFalseNorthingGeoKey, 3083) /* ProjLinearUnits */
53 ValuePair( ProjFalseOriginLongGeoKey, 3084) /* GeogAngularUnit */
54 ValuePair( ProjFalseOriginLatGeoKey, 3085) /* GeogAngularUnit */
55 ValuePair( ProjFalseOriginEastingGeoKey, 3086) /* ProjLinearUnits */
56 ValuePair( ProjFalseOriginNorthingGeoKey, 3087) /* ProjLinearUnits */
57 ValuePair( ProjCenterLongGeoKey, 3088) /* GeogAngularUnit */
58 ValuePair( ProjCenterLatGeoKey, 3089) /* GeogAngularUnit */
59 ValuePair( ProjCenterEastingGeoKey, 3090) /* ProjLinearUnits */
60 ValuePair( ProjCenterNorthingGeoKey, 3091) /* ProjLinearUnits */
61 ValuePair( ProjScaleAtNatOriginGeoKey, 3092) /* ratio */
62 ValuePair( ProjScaleAtOriginGeoKey,ProjScaleAtNatOriginGeoKey) /* ** alias ** */
63 ValuePair( ProjScaleAtCenterGeoKey, 3093) /* ratio */
64 ValuePair( ProjAzimuthAngleGeoKey, 3094) /* GeogAzimuthUnit */
65 ValuePair( ProjStraightVertPoleLongGeoKey, 3095) /* GeogAngularUnit */
66 ValuePair( ProjRectifiedGridAngleGeoKey, 3096) /* GeogAngularUnit */
67
68 /* 6.2.4 Vertical CS Keys */
69
70 ValuePair( VerticalCSTypeGeoKey, 4096) /* Section 6.3.4.1 codes */
71 ValuePair( VerticalCitationGeoKey, 4097) /* documentation */
72 ValuePair( VerticalDatumGeoKey, 4098) /* Section 6.3.4.2 codes */
73 ValuePair( VerticalUnitsGeoKey, 4099) /* Section 6.3.1 (.x) codes */
74
75 /* End of Data base */
0 /*
1 * geonames.h
2 *
3 * This encapsulates all of the value-naming mechanism of
4 * libgeotiff.
5 *
6 * Written By: Niles Ritter
7 *
8 * Revision History:
9 *
10 * Author Date Key Changes/Additions
11 * ------ ---------- -------------------------------------
12 * ndr 10 Jun 95 Inital Beta Release
13 * ndr 28 Jul 95 Added ModelType aliases, Kv aliases.
14 */
15
16 #ifndef __geonames_h
17 #define __geonames_h
18
19 struct _KeyInfo {
20 int ki_key;
21 char *ki_name;
22 };
23 typedef struct _KeyInfo KeyInfo;
24
25 /* If memory is a premium, then omitting the
26 * long name lists may save some space; simply
27 * #define OMIT_GEOTIFF_NAMES in the compile statement
28 * to remove all key->string translation.
29 */
30 #ifdef ValuePair
31 # undef ValuePair
32 #endif
33
34 #ifndef OMIT_GEOTIFF_NAMES
35 #define ValuePair(token,value) {token,#token},
36 #else
37 #define ValuePair(token,value)
38 #endif
39
40 #define END_LIST { -1, (char *)0}
41
42 /************************************************************
43 * 6.2.x GeoTIFF Keys
44 ************************************************************/
45
46 static KeyInfo _keyInfo[] = {
47 # include "geokeys.inc" /* geokey database */
48 END_LIST
49 };
50
51 #define COMMON_VALUES \
52 {KvUndefined, "Undefined"}, \
53 {KvUserDefined,"User-Defined"}, \
54 ValuePair(KvUndefined,KvUndefined) \
55 ValuePair(KvUserDefined,KvUserDefined)
56
57 static KeyInfo _csdefaultValue[] = {
58 COMMON_VALUES
59 END_LIST
60 };
61
62 /************************************************************
63 * 6.3.x GeoTIFF Key Values
64 ************************************************************/
65
66 static KeyInfo _modeltypeValue[] = {
67 COMMON_VALUES
68 ValuePair(ModelTypeProjected,1)
69 ValuePair(ModelTypeGeographic,2)
70 ValuePair(ModelTypeGeocentric,3)
71 ValuePair(ModelProjected,1) /* aliases */
72 ValuePair(ModelGeographic,2) /* aliases */
73 ValuePair(ModelGeocentric,3) /* aliases */
74 END_LIST
75 };
76
77 static KeyInfo _rastertypeValue[] = {
78 COMMON_VALUES
79 ValuePair(RasterPixelIsArea,1)
80 ValuePair(RasterPixelIsPoint,2)
81 END_LIST
82 };
83
84 static KeyInfo _geounitsValue[] = {
85 COMMON_VALUES
86 # include "epsg_units.inc"
87 END_LIST
88 };
89
90 static KeyInfo _geographicValue[] = {
91 COMMON_VALUES
92 # include "epsg_gcs.inc"
93 END_LIST
94 };
95
96 static KeyInfo _geodeticdatumValue[] = {
97 COMMON_VALUES
98 # include "epsg_datum.inc"
99 END_LIST
100 };
101
102 static KeyInfo _ellipsoidValue[] = {
103 COMMON_VALUES
104 # include "epsg_ellipse.inc"
105 END_LIST
106 };
107
108 static KeyInfo _primemeridianValue[] = {
109 COMMON_VALUES
110 # include "epsg_pm.inc"
111 END_LIST
112 };
113
114 static KeyInfo _pcstypeValue[] = {
115 COMMON_VALUES
116 # include "epsg_pcs.inc"
117 END_LIST
118 };
119
120 static KeyInfo _projectionValue[] = {
121 COMMON_VALUES
122 # include "epsg_proj.inc"
123 END_LIST
124 };
125
126 static KeyInfo _coordtransValue[] = {
127 COMMON_VALUES
128 # include "geo_ctrans.inc"
129 END_LIST
130 };
131
132 static KeyInfo _vertcstypeValue[] = {
133 COMMON_VALUES
134 # include "epsg_vertcs.inc"
135 END_LIST
136 };
137
138 static KeyInfo _vdatumValue[] = {
139 COMMON_VALUES
140 ValuePair(VDatumBase,1)
141 END_LIST
142 };
143
144 #endif /* __geonames_h */
145
0 /**********************************************************************
1 *
2 * geotiff.h - Public interface for Geotiff tag parsing.
3 *
4 *
5 * Written By: Niles D. Ritter
6 *
7 **********************************************************************/
8
9 #ifndef __geotiff_h_
10 #define __geotiff_h_
11
12 /**
13 * \file geotiff.h
14 *
15 * Primary libgeotiff include file.
16 *
17 * This is the defacto registry for valid GEOTIFF GeoKeys
18 * and their associated symbolic values. This is also the only file
19 * of the GeoTIFF library which needs to be included in client source
20 * code.
21 */
22
23 /* This Version code should only change if a drastic
24 * alteration is made to the GeoTIFF key structure. Readers
25 * encountering a larger value should give up gracefully.
26 */
27 #define GvCurrentVersion 1
28
29 #define LIBGEOTIFF_VERSION 1240
30
31 #include "geo_config.h"
32 #include "geokeys.h"
33
34 /**********************************************************************
35 * Do we want to build as a DLL on windows?
36 **********************************************************************/
37 #if !defined(CPL_DLL)
38 # if defined(_WIN32) && defined(BUILD_AS_DLL)
39 # define CPL_DLL __declspec(dllexport)
40 # else
41 # define CPL_DLL
42 # endif
43 #endif
44
45 /**********************************************************************
46 *
47 * Public Structures & Definitions
48 *
49 **********************************************************************/
50
51 #if defined(__cplusplus)
52 extern "C" {
53 #endif
54
55 typedef struct gtiff GTIF; /* struct gtiff is private */
56 typedef unsigned short tifftag_t;
57 typedef unsigned short geocode_t;
58 typedef int (*GTIFPrintMethod)(char *string, void *aux);
59 typedef int (*GTIFReadMethod)(char *string, void *aux);
60
61 typedef enum {
62 TYPE_BYTE=1,
63 TYPE_SHORT=2,
64 TYPE_LONG=3,
65 TYPE_RATIONAL=4,
66 TYPE_ASCII=5,
67 TYPE_FLOAT=6,
68 TYPE_DOUBLE=7,
69 TYPE_SBYTE=8,
70 TYPE_SSHORT=9,
71 TYPE_SLONG=10,
72 TYPE_UNKNOWN=11
73 } tagtype_t;
74
75
76 /**********************************************************************
77 *
78 * Public Function Declarations
79 *
80 **********************************************************************/
81
82 /* TIFF-level interface */
83 GTIF CPL_DLL *GTIFNew(void *tif);
84 void CPL_DLL GTIFFree(GTIF *gtif);
85 int CPL_DLL GTIFWriteKeys(GTIF *gtif);
86 void CPL_DLL GTIFDirectoryInfo(GTIF *gtif, int *versions, int *keycount);
87
88 /* GeoKey Access */
89 int CPL_DLL GTIFKeyInfo(GTIF *gtif, geokey_t key, int *size, tagtype_t* type);
90 int CPL_DLL GTIFKeyGet(GTIF *gtif, geokey_t key, void *val, int index,
91 int count);
92 int CPL_DLL GTIFKeySet(GTIF *gtif, geokey_t keyID, tagtype_t type,
93 int count,...);
94
95 /* Metadata Import-Export utilities */
96 void CPL_DLL GTIFPrint(GTIF *gtif, GTIFPrintMethod print, void *aux);
97 int CPL_DLL GTIFImport(GTIF *gtif, GTIFReadMethod scan, void *aux);
98 char CPL_DLL *GTIFKeyName(geokey_t key);
99 char CPL_DLL *GTIFValueName(geokey_t key,int value);
100 char CPL_DLL *GTIFTypeName(tagtype_t type);
101 char CPL_DLL *GTIFTagName(int tag);
102 int CPL_DLL GTIFKeyCode(char * key);
103 int CPL_DLL GTIFValueCode(geokey_t key,char *value);
104 int CPL_DLL GTIFTypeCode(char *type);
105 int CPL_DLL GTIFTagCode(char *tag);
106
107 /* Translation between image/PCS space */
108
109 int CPL_DLL GTIFImageToPCS( GTIF *gtif, double *x, double *y );
110 int CPL_DLL GTIFPCSToImage( GTIF *gtif, double *x, double *y );
111
112 #if defined(__cplusplus)
113 }
114 #endif
115
116 #endif /* __geotiff_h_ */
0 /******************************************************************************
1 * $Id: geotiff_proj4.c,v 1.23 2007/03/13 18:04:33 fwarmerdam Exp $
2 *
3 * Project: libgeotiff
4 * Purpose: Code to convert a normalized GeoTIFF definition into a PROJ.4
5 * (OGDI) compatible projection string.
6 * Author: Frank Warmerdam, warmerda@home.com
7 *
8 ******************************************************************************
9 * Copyright (c) 1999, Frank Warmerdam
10 *
11 * Permission is hereby granted, free of charge, to any person obtaining a
12 * copy of this software and associated documentation files (the "Software"),
13 * to deal in the Software without restriction, including without limitation
14 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15 * and/or sell copies of the Software, and to permit persons to whom the
16 * Software is furnished to do so, subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be included
19 * in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27 * DEALINGS IN THE SOFTWARE.
28 ******************************************************************************
29 *
30 * $Log: geotiff_proj4.c,v $
31 * Revision 1.23 2007/03/13 18:04:33 fwarmerdam
32 * added new zealand map grid support per bug 1519
33 *
34 * Revision 1.22 2005/03/04 04:32:37 fwarmerdam
35 * added cylindricalequalarea support
36 *
37 * Revision 1.21 2003/08/21 18:42:39 warmerda
38 * fixed support for ModelTypeGeographic as per email from Young Su, Cha
39 *
40 * Revision 1.20 2003/07/08 17:31:30 warmerda
41 * cleanup various warnings
42 *
43 * Revision 1.19 2002/11/29 20:57:09 warmerda
44 * added LCC1SP mapping
45 *
46 * Revision 1.18 2002/07/09 14:47:53 warmerda
47 * fixed translation of polar stereographic
48 *
49 * Revision 1.17 2001/11/23 19:53:56 warmerda
50 * free PROJ.4 definitions after use
51 *
52 * Revision 1.16 2000/12/05 19:21:45 warmerda
53 * added cassini support
54 *
55 * Revision 1.15 2000/12/05 17:44:41 warmerda
56 * Use +R_A for Miller and VanDerGrinten
57 *
58 * Revision 1.14 2000/10/13 18:06:51 warmerda
59 * added econic support for PROJ.4 translation
60 *
61 * Revision 1.13 2000/09/15 19:30:48 warmerda
62 * *** empty log message ***
63 *
64 * Revision 1.12 2000/09/15 18:21:07 warmerda
65 * Fixed order of parameters for LCC 2SP. When parameters
66 * were read from EPSG CSV files the standard parallels and origin
67 * were mixed up. This affects alot of state plane zones!
68 *
69 * Revision 1.11 2000/06/06 17:39:45 warmerda
70 * Modify to work with projUV version of library.
71 *
72 * Revision 1.10 1999/07/06 15:05:51 warmerda
73 * Fixed up LCC_1SP notes.
74 *
75 * Revision 1.9 1999/05/04 16:24:49 warmerda
76 * Fixed projection string formating with zones.
77 *
78 * Revision 1.8 1999/05/04 12:27:01 geotiff
79 * only emit proj unsupported warning if DEBUG defined
80 *
81 * Revision 1.7 1999/05/04 03:14:59 warmerda
82 * fixed use of foot instead of ft for units
83 *
84 * Revision 1.6 1999/05/03 17:50:31 warmerda
85 * avoid warnings on IRIX
86 *
87 * Revision 1.5 1999/04/29 23:02:24 warmerda
88 * added mapsys utm test.
89 *
90 * Revision 1.4 1999/03/18 21:35:42 geotiff
91 * Added reprojection functions
92 *
93 * Revision 1.3 1999/03/10 18:11:17 geotiff
94 * Removed comment about this not being the master ... now it is.
95 *
96 * Revision 1.2 1999/03/10 18:10:27 geotiff
97 * Avoid use of cpl_serv.h and CPLStrdup().
98 *
99 * Revision 1.1 1999/03/10 15:20:43 geotiff
100 * New
101 *
102 */
103
104 #include "cpl_serv.h"
105 #include "geotiff.h"
106 #include "geo_normalize.h"
107 #include "geovalues.h"
108
109 /************************************************************************/
110 /* GTIFGetProj4Defn() */
111 /************************************************************************/
112
113 char * GTIFGetProj4Defn( GTIFDefn * psDefn )
114
115 {
116 char szProjection[512];
117 char szUnits[24];
118 double dfFalseEasting, dfFalseNorthing;
119
120 szProjection[0] = '\0';
121
122 /* ==================================================================== */
123 /* Translate the units of measure. */
124 /* */
125 /* Note that even with a +units, or +to_meter in effect, it is */
126 /* still assumed that all the projection parameters are in */
127 /* meters. */
128 /* ==================================================================== */
129 if( psDefn->UOMLength == Linear_Meter )
130 {
131 strcpy( szUnits, "+units=m " );
132 }
133 else if( psDefn->UOMLength == Linear_Foot )
134 {
135 strcpy( szUnits, "+units=ft " );
136 }
137 else if( psDefn->UOMLength == Linear_Foot_US_Survey )
138 {
139 strcpy( szUnits, "+units=us-ft " );
140 }
141 else if( psDefn->UOMLength == Linear_Foot_Indian )
142 {
143 strcpy( szUnits, "+units=ind-ft " );
144 }
145 else if( psDefn->UOMLength == Linear_Link )
146 {
147 strcpy( szUnits, "+units=link " );
148 }
149 else if( psDefn->UOMLength == Linear_Yard_Indian)
150 {
151 strcpy( szUnits, "+units=ind-yd " );
152 }
153 else if( psDefn->UOMLength == Linear_Fathom )
154 {
155 strcpy( szUnits, "+units=fath " );
156 }
157 else if( psDefn->UOMLength == Linear_Mile_International_Nautical )
158 {
159 strcpy( szUnits, "+units=kmi " );
160 }
161 else
162 {
163 sprintf( szUnits, "+to_meter=%.10f", psDefn->UOMLengthInMeters );
164 }
165
166 /* -------------------------------------------------------------------- */
167 /* false easting and northing are in meters and that is what */
168 /* PROJ.4 wants regardless of the linear units. */
169 /* -------------------------------------------------------------------- */
170 dfFalseEasting = psDefn->ProjParm[5];
171 dfFalseNorthing = psDefn->ProjParm[6];
172
173 /* ==================================================================== */
174 /* Handle general projection methods. */
175 /* ==================================================================== */
176
177 /* -------------------------------------------------------------------- */
178 /* Geographic. */
179 /* -------------------------------------------------------------------- */
180 if(psDefn->Model==ModelTypeGeographic)
181 {
182 sprintf(szProjection+strlen(szProjection),"+proj=latlong ");
183
184 }
185
186 /* -------------------------------------------------------------------- */
187 /* UTM - special case override on transverse mercator so things */
188 /* will be more meaningful to the user. */
189 /* -------------------------------------------------------------------- */
190 else if( psDefn->MapSys == MapSys_UTM_North )
191 {
192 sprintf( szProjection+strlen(szProjection),
193 "+proj=utm +zone=%d ",
194 psDefn->Zone );
195 }
196
197 /* -------------------------------------------------------------------- */
198 /* Transverse Mercator */
199 /* -------------------------------------------------------------------- */
200 else if( psDefn->CTProjection == CT_TransverseMercator )
201 {
202 sprintf( szProjection+strlen(szProjection),
203 "+proj=tmerc +lat_0=%.9f +lon_0=%.9f +k=%f +x_0=%.3f +y_0=%.3f ",
204 psDefn->ProjParm[0],
205 psDefn->ProjParm[1],
206 psDefn->ProjParm[4],
207 dfFalseEasting,
208 dfFalseNorthing );
209 }
210
211 /* -------------------------------------------------------------------- */
212 /* Mercator */
213 /* -------------------------------------------------------------------- */
214 else if( psDefn->CTProjection == CT_Mercator )
215 {
216 sprintf( szProjection+strlen(szProjection),
217 "+proj=merc +lat_ts=%.9f +lon_0=%.9f +k=%f +x_0=%.3f +y_0=%.3f ",
218 psDefn->ProjParm[0],
219 psDefn->ProjParm[1],
220 psDefn->ProjParm[4],
221 dfFalseEasting,
222 dfFalseNorthing );
223 }
224
225 /* -------------------------------------------------------------------- */
226 /* Cassini/Soldner */
227 /* -------------------------------------------------------------------- */
228 else if( psDefn->CTProjection == CT_CassiniSoldner )
229 {
230 sprintf( szProjection+strlen(szProjection),
231 "+proj=cass +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
232 psDefn->ProjParm[0],
233 psDefn->ProjParm[1],
234 dfFalseEasting,
235 dfFalseNorthing );
236 }
237
238 /* -------------------------------------------------------------------- */
239 /* Oblique Stereographic - Should this really map onto */
240 /* Stereographic? */
241 /* -------------------------------------------------------------------- */
242 else if( psDefn->CTProjection == CT_ObliqueStereographic )
243 {
244 sprintf( szProjection+strlen(szProjection),
245 "+proj=stere +lat_0=%.9f +lon_0=%.9f +k=%f +x_0=%.3f +y_0=%.3f ",
246 psDefn->ProjParm[0],
247 psDefn->ProjParm[1],
248 psDefn->ProjParm[4],
249 dfFalseEasting,
250 dfFalseNorthing );
251 }
252
253 /* -------------------------------------------------------------------- */
254 /* Stereographic */
255 /* -------------------------------------------------------------------- */
256 else if( psDefn->CTProjection == CT_Stereographic )
257 {
258 sprintf( szProjection+strlen(szProjection),
259 "+proj=stere +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
260 psDefn->ProjParm[0],
261 psDefn->ProjParm[1],
262 dfFalseEasting,
263 dfFalseNorthing );
264 }
265
266 /* -------------------------------------------------------------------- */
267 /* Polar Stereographic */
268 /* -------------------------------------------------------------------- */
269 else if( psDefn->CTProjection == CT_PolarStereographic )
270 {
271 if( psDefn->ProjParm[0] > 0.0 )
272 sprintf( szProjection+strlen(szProjection),
273 "+proj=stere +lat_0=90 +lat_ts=%.9f +lon_0=%.9f "
274 "+k=%.9f +x_0=%.3f +y_0=%.3f ",
275 psDefn->ProjParm[0],
276 psDefn->ProjParm[1],
277 psDefn->ProjParm[4],
278 dfFalseEasting,
279 dfFalseNorthing );
280 else
281 sprintf( szProjection+strlen(szProjection),
282 "+proj=stere +lat_0=-90 +lat_ts=%.9f +lon_0=%.9f "
283 "+k=%.9f +x_0=%.3f +y_0=%.3f ",
284 psDefn->ProjParm[0],
285 psDefn->ProjParm[1],
286 psDefn->ProjParm[4],
287 dfFalseEasting,
288 dfFalseNorthing );
289 }
290
291 /* -------------------------------------------------------------------- */
292 /* Equirectangular */
293 /* -------------------------------------------------------------------- */
294 else if( psDefn->CTProjection == CT_Equirectangular )
295 {
296 sprintf( szProjection+strlen(szProjection),
297 "+proj=eqc +lat_ts=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
298 psDefn->ProjParm[0],
299 psDefn->ProjParm[1],
300 dfFalseEasting,
301 dfFalseNorthing );
302 }
303
304 /* -------------------------------------------------------------------- */
305 /* Gnomonic */
306 /* -------------------------------------------------------------------- */
307 else if( psDefn->CTProjection == CT_Gnomonic )
308 {
309 sprintf( szProjection+strlen(szProjection),
310 "+proj=gnom +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
311 psDefn->ProjParm[0],
312 psDefn->ProjParm[1],
313 dfFalseEasting,
314 dfFalseNorthing );
315 }
316
317 /* -------------------------------------------------------------------- */
318 /* Orthographic */
319 /* -------------------------------------------------------------------- */
320 else if( psDefn->CTProjection == CT_Orthographic )
321 {
322 sprintf( szProjection+strlen(szProjection),
323 "+proj=ortho +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
324 psDefn->ProjParm[0],
325 psDefn->ProjParm[1],
326 dfFalseEasting,
327 dfFalseNorthing );
328 }
329
330 /* -------------------------------------------------------------------- */
331 /* Lambert Azimuthal Equal Area */
332 /* -------------------------------------------------------------------- */
333 else if( psDefn->CTProjection == CT_LambertAzimEqualArea )
334 {
335 sprintf( szProjection+strlen(szProjection),
336 "+proj=laea +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
337 psDefn->ProjParm[0],
338 psDefn->ProjParm[1],
339 dfFalseEasting,
340 dfFalseNorthing );
341 }
342
343 /* -------------------------------------------------------------------- */
344 /* Azimuthal Equidistant */
345 /* -------------------------------------------------------------------- */
346 else if( psDefn->CTProjection == CT_AzimuthalEquidistant )
347 {
348 sprintf( szProjection+strlen(szProjection),
349 "+proj=aeqd +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
350 psDefn->ProjParm[0],
351 psDefn->ProjParm[1],
352 dfFalseEasting,
353 dfFalseNorthing );
354 }
355
356 /* -------------------------------------------------------------------- */
357 /* Miller Cylindrical */
358 /* -------------------------------------------------------------------- */
359 else if( psDefn->CTProjection == CT_MillerCylindrical )
360 {
361 sprintf( szProjection+strlen(szProjection),
362 "+proj=mill +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f +R_A ",
363 psDefn->ProjParm[0],
364 psDefn->ProjParm[1],
365 dfFalseEasting,
366 dfFalseNorthing );
367 }
368
369 /* -------------------------------------------------------------------- */
370 /* Polyconic */
371 /* -------------------------------------------------------------------- */
372 else if( psDefn->CTProjection == CT_Polyconic )
373 {
374 sprintf( szProjection+strlen(szProjection),
375 "+proj=poly +lat_0=%.9f +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
376 psDefn->ProjParm[0],
377 psDefn->ProjParm[1],
378 dfFalseEasting,
379 dfFalseNorthing );
380 }
381
382 /* -------------------------------------------------------------------- */
383 /* AlbersEqualArea */
384 /* -------------------------------------------------------------------- */
385 else if( psDefn->CTProjection == CT_AlbersEqualArea )
386 {
387 sprintf( szProjection+strlen(szProjection),
388 "+proj=aea +lat_1=%.9f +lat_2=%.9f +lat_0=%.9f +lon_0=%.9f"
389 " +x_0=%.3f +y_0=%.3f ",
390 psDefn->ProjParm[0],
391 psDefn->ProjParm[1],
392 psDefn->ProjParm[2],
393 psDefn->ProjParm[3],
394 dfFalseEasting,
395 dfFalseNorthing );
396 }
397
398 /* -------------------------------------------------------------------- */
399 /* EquidistantConic */
400 /* -------------------------------------------------------------------- */
401 else if( psDefn->CTProjection == CT_EquidistantConic )
402 {
403 sprintf( szProjection+strlen(szProjection),
404 "+proj=eqdc +lat_1=%.9f +lat_2=%.9f +lat_0=%.9f +lon_0=%.9f"
405 " +x_0=%.3f +y_0=%.3f ",
406 psDefn->ProjParm[0],
407 psDefn->ProjParm[1],
408 psDefn->ProjParm[2],
409 psDefn->ProjParm[3],
410 dfFalseEasting,
411 dfFalseNorthing );
412 }
413
414 /* -------------------------------------------------------------------- */
415 /* Robinson */
416 /* -------------------------------------------------------------------- */
417 else if( psDefn->CTProjection == CT_Robinson )
418 {
419 sprintf( szProjection+strlen(szProjection),
420 "+proj=robin +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
421 psDefn->ProjParm[1],
422 dfFalseEasting,
423 dfFalseNorthing );
424 }
425
426 /* -------------------------------------------------------------------- */
427 /* VanDerGrinten */
428 /* -------------------------------------------------------------------- */
429 else if( psDefn->CTProjection == CT_VanDerGrinten )
430 {
431 sprintf( szProjection+strlen(szProjection),
432 "+proj=vandg +lon_0=%.9f +x_0=%.3f +y_0=%.3f +R_A ",
433 psDefn->ProjParm[1],
434 dfFalseEasting,
435 dfFalseNorthing );
436 }
437
438 /* -------------------------------------------------------------------- */
439 /* Sinusoidal */
440 /* -------------------------------------------------------------------- */
441 else if( psDefn->CTProjection == CT_Sinusoidal )
442 {
443 sprintf( szProjection+strlen(szProjection),
444 "+proj=sinu +lon_0=%.9f +x_0=%.3f +y_0=%.3f ",
445 psDefn->ProjParm[1],
446 dfFalseEasting,
447 dfFalseNorthing );
448 }
449
450 /* -------------------------------------------------------------------- */
451 /* LambertConfConic_2SP */
452 /* -------------------------------------------------------------------- */
453 else if( psDefn->CTProjection == CT_LambertConfConic_2SP )
454 {
455 sprintf( szProjection+strlen(szProjection),
456 "+proj=lcc +lat_0=%.9f +lon_0=%.9f +lat_1=%.9f +lat_2=%.9f "
457 " +x_0=%.3f +y_0=%.3f ",
458 psDefn->ProjParm[0],
459 psDefn->ProjParm[1],
460 psDefn->ProjParm[2],
461 psDefn->ProjParm[3],
462 dfFalseEasting,
463 dfFalseNorthing );
464 }
465
466 /* -------------------------------------------------------------------- */
467 /* LambertConfConic_1SP */
468 /* -------------------------------------------------------------------- */
469 else if( psDefn->CTProjection == CT_LambertConfConic_1SP )
470 {
471 sprintf( szProjection+strlen(szProjection),
472 "+proj=lcc +lat_0=%.9f +lat_1=%.9f +lon_0=%.9f"
473 " +k_0=%.9f +x_0=%.3f +y_0=%.3f ",
474 psDefn->ProjParm[0],
475 psDefn->ProjParm[0],
476 psDefn->ProjParm[1],
477 psDefn->ProjParm[4],
478 psDefn->ProjParm[5],
479 psDefn->ProjParm[6] );
480 }
481
482 /* -------------------------------------------------------------------- */
483 /* CT_CylindricalEqualArea */
484 /* -------------------------------------------------------------------- */
485 else if( psDefn->CTProjection == CT_CylindricalEqualArea )
486 {
487 sprintf( szProjection+strlen(szProjection),
488 "+proj=cea +lat_ts=%.9f +lon_0=%.9f "
489 " +x_0=%.3f +y_0=%.3f ",
490 psDefn->ProjParm[0],
491 psDefn->ProjParm[1],
492 psDefn->ProjParm[5],
493 psDefn->ProjParm[6] );
494 }
495
496 /* -------------------------------------------------------------------- */
497 /* NewZealandMapGrid */
498 /* -------------------------------------------------------------------- */
499 else if( psDefn->CTProjection == CT_NewZealandMapGrid )
500 {
501 sprintf( szProjection+strlen(szProjection),
502 "+proj=nzmg +lat_0=%.9f +lon_0=%.9f"
503 " +x_0=%.3f +y_0=%.3f ",
504 psDefn->ProjParm[0],
505 psDefn->ProjParm[1],
506 psDefn->ProjParm[5],
507 psDefn->ProjParm[6] );
508 }
509
510 /* -------------------------------------------------------------------- */
511 /* Transverse Mercator - south oriented. */
512 /* -------------------------------------------------------------------- */
513 else if( psDefn->CTProjection == CT_TransvMercator_SouthOriented )
514 {
515 /* this appears to be an unsupported formulation with PROJ.4 */
516 }
517
518 /* -------------------------------------------------------------------- */
519 /* ObliqueMercator (Hotine) */
520 /* -------------------------------------------------------------------- */
521 else if( psDefn->CTProjection == CT_ObliqueMercator )
522 {
523 /* not clear how ProjParm[3] - angle from rectified to skewed grid -
524 should be applied ... see the +not_rot flag for PROJ.4.
525 Just ignoring for now. */
526
527 sprintf( szProjection+strlen(szProjection),
528 "+proj=omerc +lat_0=%.9f +lonc=%.9f +alpha=%.9f"
529 " +k=%.9f +x_0=%.3f +y_0=%.3f ",
530 psDefn->ProjParm[0],
531 psDefn->ProjParm[1],
532 psDefn->ProjParm[2],
533 psDefn->ProjParm[4],
534 psDefn->ProjParm[5],
535 psDefn->ProjParm[6] );
536 }
537
538 /* ==================================================================== */
539 /* Handle ellipsoid information. */
540 /* ==================================================================== */
541 if( psDefn->Ellipsoid == Ellipse_WGS_84 )
542 strcat( szProjection, "+ellps=WGS84 " );
543 else if( psDefn->Ellipsoid == Ellipse_Clarke_1866 )
544 strcat( szProjection, "+ellps=clrk66 " );
545 else if( psDefn->Ellipsoid == Ellipse_Clarke_1880 )
546 strcat( szProjection, "+ellps=clrk80 " );
547 else if( psDefn->Ellipsoid == Ellipse_GRS_1980 )
548 strcat( szProjection, "+ellps=GRS80 " );
549 else
550 {
551 if( psDefn->SemiMajor != 0.0 && psDefn->SemiMinor != 0.0 )
552 {
553 sprintf( szProjection+strlen(szProjection),
554 "+a=%.3f +b=%.3f ",
555 psDefn->SemiMajor,
556 psDefn->SemiMinor );
557 }
558 }
559
560 strcat( szProjection, szUnits );
561
562 return( strdup( szProjection ) );
563 }
564
565 #if !defined(HAVE_LIBPROJ) || !defined(HAVE_PROJECTS_H)
566
567 int GTIFProj4ToLatLong( GTIFDefn * psDefn, int nPoints,
568 double *padfX, double *padfY )
569 {
570 (void) psDefn;
571 (void) nPoints;
572 (void) padfX;
573 (void) padfY;
574 #ifdef DEBUG
575 fprintf( stderr,
576 "GTIFProj4ToLatLong() - PROJ.4 support not compiled in.\n" );
577 #endif
578 return FALSE;
579 }
580
581 int GTIFProj4FromLatLong( GTIFDefn * psDefn, int nPoints,
582 double *padfX, double *padfY )
583 {
584 (void) psDefn;
585 (void) nPoints;
586 (void) padfX;
587 (void) padfY;
588 #ifdef DEBUG
589 fprintf( stderr,
590 "GTIFProj4FromLatLong() - PROJ.4 support not compiled in.\n" );
591 #endif
592 return FALSE;
593 }
594 #else
595
596 #include "projects.h"
597
598 #ifdef USE_PROJUV
599 # define UV projUV
600 #endif
601
602 /************************************************************************/
603 /* GTIFProj4FromLatLong() */
604 /* */
605 /* Convert lat/long values to projected coordinate for a */
606 /* particular definition. */
607 /************************************************************************/
608
609 int GTIFProj4FromLatLong( GTIFDefn * psDefn, int nPoints,
610 double *padfX, double *padfY )
611
612 {
613 char *pszProjection, **papszArgs;
614 PJ *psPJ;
615 int i;
616
617 /* -------------------------------------------------------------------- */
618 /* Get a projection definition. */
619 /* -------------------------------------------------------------------- */
620 pszProjection = GTIFGetProj4Defn( psDefn );
621
622 if( pszProjection == NULL )
623 return FALSE;
624
625 /* -------------------------------------------------------------------- */
626 /* Parse into tokens for pj_init(), and initialize the projection. */
627 /* -------------------------------------------------------------------- */
628
629 papszArgs = CSLTokenizeStringComplex( pszProjection, " +", TRUE, FALSE );
630 free( pszProjection );
631
632 psPJ = pj_init( CSLCount(papszArgs), papszArgs );
633
634 CSLDestroy( papszArgs );
635
636 if( psPJ == NULL )
637 {
638 return FALSE;
639 }
640
641 /* -------------------------------------------------------------------- */
642 /* Process each of the points. */
643 /* -------------------------------------------------------------------- */
644 for( i = 0; i < nPoints; i++ )
645 {
646 UV sUV;
647
648 sUV.u = padfX[i] * DEG_TO_RAD;
649 sUV.v = padfY[i] * DEG_TO_RAD;
650
651 sUV = pj_fwd( sUV, psPJ );
652
653 padfX[i] = sUV.u;
654 padfY[i] = sUV.v;
655 }
656
657 pj_free( psPJ );
658
659 return TRUE;
660 }
661
662 /************************************************************************/
663 /* GTIFProj4ToLatLong() */
664 /* */
665 /* Convert projection coordinates to lat/long for a particular */
666 /* definition. */
667 /************************************************************************/
668
669 int GTIFProj4ToLatLong( GTIFDefn * psDefn, int nPoints,
670 double *padfX, double *padfY )
671
672 {
673 char *pszProjection, **papszArgs;
674 PJ *psPJ;
675 int i;
676
677 /* -------------------------------------------------------------------- */
678 /* Get a projection definition. */
679 /* -------------------------------------------------------------------- */
680 pszProjection = GTIFGetProj4Defn( psDefn );
681
682 if( pszProjection == NULL )
683 return FALSE;
684
685 /* -------------------------------------------------------------------- */
686 /* Parse into tokens for pj_init(), and initialize the projection. */
687 /* -------------------------------------------------------------------- */
688
689 papszArgs = CSLTokenizeStringComplex( pszProjection, " +", TRUE, FALSE );
690 free( pszProjection );
691
692 psPJ = pj_init( CSLCount(papszArgs), papszArgs );
693
694 CSLDestroy( papszArgs );
695
696 if( psPJ == NULL )
697 {
698 return FALSE;
699 }
700
701 /* -------------------------------------------------------------------- */
702 /* Process each of the points. */
703 /* -------------------------------------------------------------------- */
704 for( i = 0; i < nPoints; i++ )
705 {
706 UV sUV;
707
708 sUV.u = padfX[i];
709 sUV.v = padfY[i];
710
711 sUV = pj_inv( sUV, psPJ );
712
713 padfX[i] = sUV.u * RAD_TO_DEG;
714 padfY[i] = sUV.v * RAD_TO_DEG;
715 }
716
717 pj_free( psPJ );
718
719 return TRUE;
720 }
721
722
723 #endif /* has projects.h and -lproj */
724
0 /*
1 * geotiffio.h
2 *
3 * Standard include file for geotiff, including all
4 * key and code definitions.
5 */
6
7
8 #ifndef __geotiffio_h
9 #define __geotiffio_h
10
11 #include "geotiff.h" /* public key interface */
12 #include "geovalues.h" /* key code definitions */
13
14 #endif /* __geotiffio_h */
15
0 /**********************************************************************
1 *
2 * geovalues.h - Public registry for valid GEOTIFF key-values.
3 *
4 * Written By: Niles D. Ritter
5 *
6 * Revision History:
7 *
8 * Rev.# Author Date Key Changes/Additions
9 * ----- ------ ---------- -------------------------------------
10 * 0.1 ndr 10 Jun 95 Inital Beta Release
11 * 0.2 ndr 12 Jul 95 New EPSG Tables installed.
12 * 0.2.1 ndr 28 Jul 95 Added ModelType aliases to Model's
13 * 1.0 ndr 18 Sep 95 Promoted to Revision 1.0
14 *
15 **********************************************************************/
16
17 #ifndef __geovalues_h_
18 #define __geovalues_h_
19
20 /* If code values are added or modified, the "GvCurrentMinorRev"
21 * number should be incremented here. If new Keys are added, then the
22 * GvCurrentRevision number should be incremented instead, and the
23 * GvCurrentMinorRev should be reset to zero (see "geokeys.h").
24 *
25 * In addition, any changes here should be reflected in "geo_names.c"
26 *
27 */
28
29 #define GvCurrentMinorRev 0 /* First Major Rev EPSG Code Release */
30
31
32 /*
33 * Universal key values -- defined for consistency
34 */
35 #define KvUndefined 0
36 #define KvUserDefined 32767
37
38 #ifdef ValuePair
39 # undef ValuePair
40 #endif
41 #define ValuePair(name,value) name = value,
42
43 /*
44 * The section numbers refer to the GeoTIFF Specification section
45 * in which the code values are documented.
46 */
47
48 /************************************************************
49 * 6.3.1 GeoTIFF General Codes
50 ************************************************************/
51
52 /* 6.3.1.1 Model Type Codes */
53 typedef enum {
54 ModelTypeProjected = 1, /* Projection Coordinate System */
55 ModelTypeGeographic = 2, /* Geographic latitude-longitude System */
56 ModelTypeGeocentric = 3, /* Geocentric (X,Y,Z) Coordinate System */
57 ModelProjected = ModelTypeProjected, /* alias */
58 ModelGeographic = ModelTypeGeographic, /* alias */
59 ModelGeocentric = ModelTypeGeocentric /* alias */
60 } modeltype_t;
61
62 /* 6.3.1.2 Raster Type Codes */
63 typedef enum {
64 RasterPixelIsArea = 1, /* Standard pixel-fills-grid-cell */
65 RasterPixelIsPoint = 2 /* Pixel-at-grid-vertex */
66 } rastertype_t;
67
68 typedef enum {
69 # include "epsg_gcs.inc"
70 geographic_end
71 } geographic_t;
72
73 typedef enum {
74 # include "epsg_datum.inc"
75 geodeticdatum_end
76 } geodeticdatum_t;
77
78 typedef enum {
79 # include "epsg_units.inc"
80 Unit_End
81 } geounits_t;
82
83 typedef enum {
84 # include "epsg_ellipse.inc"
85 ellipsoid_end
86 } ellipsoid_t;
87
88 typedef enum {
89 # include "epsg_pm.inc"
90 primemeridian_end
91 } primemeridian_t;
92
93 typedef enum {
94 # include "epsg_pcs.inc"
95 pcstype_end
96 } pcstype_t;
97
98 typedef enum {
99 # include "epsg_proj.inc"
100 projection_end
101 } projection_t;
102
103 typedef enum {
104 # include "geo_ctrans.inc"
105 coordtrans_end
106 } coordtrans_t;
107
108 typedef enum {
109 # include "epsg_vertcs.inc"
110 vertcs_end
111 } vertcstype_t;
112
113
114 typedef enum {
115 VDatumBase = 1
116 } vdatum_t;
117
118 #endif /* __geovalues_h_ */
119
0 #!/bin/sh
1 #
2 # install - install a program, script, or datafile
3 # This comes from X11R5 (mit/util/scripts/install.sh).
4 #
5 # Copyright 1991 by the Massachusetts Institute of Technology
6 #
7 # Permission to use, copy, modify, distribute, and sell this software and its
8 # documentation for any purpose is hereby granted without fee, provided that
9 # the above copyright notice appear in all copies and that both that
10 # copyright notice and this permission notice appear in supporting
11 # documentation, and that the name of M.I.T. not be used in advertising or
12 # publicity pertaining to distribution of the software without specific,
13 # written prior permission. M.I.T. makes no representations about the
14 # suitability of this software for any purpose. It is provided "as is"
15 # without express or implied warranty.
16 #
17 # Calling this script install-sh is preferred over install.sh, to prevent
18 # `make' implicit rules from creating a file called install from it
19 # when there is no Makefile.
20 #
21 # This script is compatible with the BSD install script, but was written
22 # from scratch. It can only install one file at a time, a restriction
23 # shared with many OS's install programs.
24
25
26 # set DOITPROG to echo to test this script
27
28 # Don't use :- since 4.3BSD and earlier shells don't like it.
29 doit="${DOITPROG-}"
30
31
32 # put in absolute paths if you don't have them in your path; or use env. vars.
33
34 mvprog="${MVPROG-mv}"
35 cpprog="${CPPROG-cp}"
36 chmodprog="${CHMODPROG-chmod}"
37 chownprog="${CHOWNPROG-chown}"
38 chgrpprog="${CHGRPPROG-chgrp}"
39 stripprog="${STRIPPROG-strip}"
40 rmprog="${RMPROG-rm}"
41 mkdirprog="${MKDIRPROG-mkdir}"
42
43 transformbasename=""
44 transform_arg=""
45 instcmd="$mvprog"
46 chmodcmd="$chmodprog 0755"
47 chowncmd=""
48 chgrpcmd=""
49 stripcmd=""
50 rmcmd="$rmprog -f"
51 mvcmd="$mvprog"
52 src=""
53 dst=""
54 dir_arg=""
55
56 while [ x"$1" != x ]; do
57 case $1 in
58 -c) instcmd="$cpprog"
59 shift
60 continue;;
61
62 -d) dir_arg=true
63 shift
64 continue;;
65
66 -m) chmodcmd="$chmodprog $2"
67 shift
68 shift
69 continue;;
70
71 -o) chowncmd="$chownprog $2"
72 shift
73 shift
74 continue;;
75
76 -g) chgrpcmd="$chgrpprog $2"
77 shift
78 shift
79 continue;;
80
81 -s) stripcmd="$stripprog"
82 shift
83 continue;;
84
85 -t=*) transformarg=`echo $1 | sed 's/-t=//'`
86 shift
87 continue;;
88
89 -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
90 shift
91 continue;;
92
93 *) if [ x"$src" = x ]
94 then
95 src=$1
96 else
97 # this colon is to work around a 386BSD /bin/sh bug
98 :
99 dst=$1
100 fi
101 shift
102 continue;;
103 esac
104 done
105
106 if [ x"$src" = x ]
107 then
108 echo "install: no input file specified"
109 exit 1
110 else
111 true
112 fi
113
114 if [ x"$dir_arg" != x ]; then
115 dst=$src
116 src=""
117
118 if [ -d $dst ]; then
119 instcmd=:
120 chmodcmd=""
121 else
122 instcmd=mkdir
123 fi
124 else
125
126 # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
127 # might cause directories to be created, which would be especially bad
128 # if $src (and thus $dsttmp) contains '*'.
129
130 if [ -f $src -o -d $src ]
131 then
132 true
133 else
134 echo "install: $src does not exist"
135 exit 1
136 fi
137
138 if [ x"$dst" = x ]
139 then
140 echo "install: no destination specified"
141 exit 1
142 else
143 true
144 fi
145
146 # If destination is a directory, append the input filename; if your system
147 # does not like double slashes in filenames, you may need to add some logic
148
149 if [ -d $dst ]
150 then
151 dst="$dst"/`basename $src`
152 else
153 true
154 fi
155 fi
156
157 ## this sed command emulates the dirname command
158 dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
159
160 # Make sure that the destination directory exists.
161 # this part is taken from Noah Friedman's mkinstalldirs script
162
163 # Skip lots of stat calls in the usual case.
164 if [ ! -d "$dstdir" ]; then
165 defaultIFS='
166 '
167 IFS="${IFS-${defaultIFS}}"
168
169 oIFS="${IFS}"
170 # Some sh's can't handle IFS=/ for some reason.
171 IFS='%'
172 set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
173 IFS="${oIFS}"
174
175 pathcomp=''
176
177 while [ $# -ne 0 ] ; do
178 pathcomp="${pathcomp}${1}"
179 shift
180
181 if [ ! -d "${pathcomp}" ] ;
182 then
183 $mkdirprog "${pathcomp}"
184 else
185 true
186 fi
187
188 pathcomp="${pathcomp}/"
189 done
190 fi
191
192 if [ x"$dir_arg" != x ]
193 then
194 $doit $instcmd $dst &&
195
196 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
197 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
198 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
199 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
200 else
201
202 # If we're going to rename the final executable, determine the name now.
203
204 if [ x"$transformarg" = x ]
205 then
206 dstfile=`basename $dst`
207 else
208 dstfile=`basename $dst $transformbasename |
209 sed $transformarg`$transformbasename
210 fi
211
212 # don't allow the sed command to completely eliminate the filename
213
214 if [ x"$dstfile" = x ]
215 then
216 dstfile=`basename $dst`
217 else
218 true
219 fi
220
221 # Make a temp file name in the proper directory.
222
223 dsttmp=$dstdir/#inst.$$#
224
225 # Move or copy the file name to the temp name
226
227 $doit $instcmd $src $dsttmp &&
228
229 trap "rm -f ${dsttmp}" 0 &&
230
231 # and set any options; do chmod last to preserve setuid bits
232
233 # If any of these fail, we abort the whole thing. If we want to
234 # ignore errors from any of these, just make sure not to ignore
235 # errors from the above "$doit $instcmd $src $dsttmp" command.
236
237 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
238 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
239 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
240 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
241
242 # Now rename the file to the real destination.
243
244 $doit $rmcmd -f $dstdir/$dstfile &&
245 $doit $mvcmd $dsttmp $dstdir/$dstfile
246
247 fi &&
248
249
250 exit 0
0 /*
1 * xtiff.c
2 *
3 * Extended TIFF Directory GEO Tag Support.
4 *
5 * You may use this file as a template to add your own
6 * extended tags to the library. Only the parts of the code
7 * marked with "XXX" require modification.
8 *
9 * Author: Niles D. Ritter
10 *
11 * Revisions:
12 * 18 Sep 1995 -- Deprecated Integraph Matrix tag with new one.
13 * Backward compatible support provided. --NDR.
14 */
15
16 #include "xtiffio.h"
17 #include <stdio.h>
18 #include "cpl_serv.h"
19
20 /* Tiff info structure.
21 *
22 * Entry format:
23 * { TAGNUMBER, ReadCount, WriteCount, DataType, FIELDNUM,
24 * OkToChange, PassDirCountOnSet, AsciiName }
25 *
26 * For ReadCount, WriteCount, -1 = unknown.
27 */
28
29 static const TIFFFieldInfo xtiffFieldInfo[] = {
30
31 /* XXX Insert Your tags here */
32 { TIFFTAG_GEOPIXELSCALE, -1,-1, TIFF_DOUBLE, FIELD_CUSTOM,
33 TRUE, TRUE, "GeoPixelScale" },
34 { TIFFTAG_INTERGRAPH_MATRIX,-1,-1, TIFF_DOUBLE, FIELD_CUSTOM,
35 TRUE, TRUE, "Intergraph TransformationMatrix" },
36 { TIFFTAG_GEOTRANSMATRIX, -1,-1, TIFF_DOUBLE, FIELD_CUSTOM,
37 TRUE, TRUE, "GeoTransformationMatrix" },
38 { TIFFTAG_GEOTIEPOINTS, -1,-1, TIFF_DOUBLE, FIELD_CUSTOM,
39 TRUE, TRUE, "GeoTiePoints" },
40 { TIFFTAG_GEOKEYDIRECTORY,-1,-1, TIFF_SHORT, FIELD_CUSTOM,
41 TRUE, TRUE, "GeoKeyDirectory" },
42 { TIFFTAG_GEODOUBLEPARAMS, -1,-1, TIFF_DOUBLE, FIELD_CUSTOM,
43 TRUE, TRUE, "GeoDoubleParams" },
44 { TIFFTAG_GEOASCIIPARAMS, -1,-1, TIFF_ASCII, FIELD_CUSTOM,
45 TRUE, FALSE, "GeoASCIIParams" },
46 #ifdef JPL_TAG_SUPPORT
47 { TIFFTAG_JPL_CARTO_IFD, 1, 1, TIFF_LONG, FIELD_CUSTOM,
48 TRUE, TRUE, "JPL Carto IFD offset" }, /** Don't use this! **/
49 #endif
50 };
51
52 #define N(a) (sizeof (a) / sizeof (a[0]))
53 static void _XTIFFLocalDefaultDirectory(TIFF *tif)
54 {
55 /* Install the extended Tag field info */
56 TIFFMergeFieldInfo(tif, xtiffFieldInfo, N(xtiffFieldInfo));
57 }
58
59
60 /**********************************************************************
61 * Nothing below this line should need to be changed.
62 **********************************************************************/
63
64 static TIFFExtendProc _ParentExtender;
65
66 /*
67 * This is the callback procedure, and is
68 * called by the DefaultDirectory method
69 * every time a new TIFF directory is opened.
70 */
71
72 static void
73 _XTIFFDefaultDirectory(TIFF *tif)
74 {
75 /* set up our own defaults */
76 _XTIFFLocalDefaultDirectory(tif);
77
78 /* Since an XTIFF client module may have overridden
79 * the default directory method, we call it now to
80 * allow it to set up the rest of its own methods.
81 */
82
83 if (_ParentExtender)
84 (*_ParentExtender)(tif);
85 }
86
87
88 /**
89 Registers an extension with libtiff for adding GeoTIFF tags.
90 After this one-time intialization, any TIFF open function may be called in
91 the usual manner to create a TIFF file that compatible with libgeotiff.
92 The XTIFF open functions are simply for convenience: they call this
93 and then pass their parameters on to the appropriate TIFF open function.
94
95 <p>This function may be called any number of times safely, since it will
96 only register the extension the first time it is called.
97 **/
98
99 void XTIFFInitialize(void)
100 {
101 static int first_time=1;
102
103 if (! first_time) return; /* Been there. Done that. */
104 first_time = 0;
105
106 /* Grab the inherited method and install */
107 _ParentExtender = TIFFSetTagExtender(_XTIFFDefaultDirectory);
108 }
109
110
111 /**
112 * GeoTIFF compatible TIFF file open function.
113 *
114 * @param name The filename of a TIFF file to open.
115 * @param mode The open mode ("r", "w" or "a").
116 *
117 * @return a TIFF * for the file, or NULL if the open failed.
118 *
119 This function is used to open GeoTIFF files instead of TIFFOpen() from
120 libtiff. Internally it calls TIFFOpen(), but sets up some extra hooks
121 so that GeoTIFF tags can be extracted from the file. If XTIFFOpen() isn't
122 used, GTIFNew() won't work properly. Files opened
123 with XTIFFOpen() should be closed with XTIFFClose().
124
125 The name of the file to be opened should be passed as <b>name</b>, and an
126 opening mode ("r", "w" or "a") acceptable to TIFFOpen() should be passed as the
127 <b>mode</b>.<p>
128
129 If XTIFFOpen() fails it will return NULL. Otherwise, normal TIFFOpen()
130 error reporting steps will have already taken place.<p>
131 */
132
133 TIFF*
134 XTIFFOpen(const char* name, const char* mode)
135 {
136 TIFF *tif;
137
138 /* Set up the callback */
139 XTIFFInitialize();
140
141 /* Open the file; the callback will set everything up
142 */
143 tif = TIFFOpen(name, mode);
144 if (!tif) return tif;
145
146 return tif;
147 }
148
149 TIFF*
150 XTIFFFdOpen(int fd, const char* name, const char* mode)
151 {
152 TIFF *tif;
153
154 /* Set up the callback */
155 XTIFFInitialize();
156
157 /* Open the file; the callback will set everything up
158 */
159 tif = TIFFFdOpen(fd, name, mode);
160 if (!tif) return tif;
161
162 return tif;
163 }
164
165 TIFF*
166 XTIFFClientOpen(const char* name, const char* mode, thandle_t thehandle,
167 TIFFReadWriteProc RWProc, TIFFReadWriteProc RWProc2,
168 TIFFSeekProc SProc, TIFFCloseProc CProc,
169 TIFFSizeProc SzProc,
170 TIFFMapFileProc MFProvc, TIFFUnmapFileProc UMFProc )
171 {
172 TIFF *tif;
173
174 /* Set up the callback */
175 XTIFFInitialize();
176
177 /* Open the file; the callback will set everything up
178 */
179 tif = TIFFClientOpen(name, mode, thehandle,
180 RWProc, RWProc2,
181 SProc, CProc,
182 SzProc,
183 MFProvc, UMFProc);
184
185 if (!tif) return tif;
186
187 return tif;
188 }
189
190 /**
191 * Close a file opened with XTIFFOpen().
192 *
193 * @param tif The file handle returned by XTIFFOpen().
194 *
195 * If a GTIF structure was created with GTIFNew()
196 * for this file, it should be freed with GTIFFree()
197 * <i>before</i> calling XTIFFClose().
198 */
199
200 void
201 XTIFFClose(TIFF *tif)
202 {
203 TIFFClose(tif);
204 }
0 /*
1 * xtiffio.h -- Public interface to Extended GEO TIFF tags
2 *
3 * written by: Niles D. Ritter
4 */
5
6 #ifndef __xtiffio_h
7 #define __xtiffio_h
8
9 #include "tiffio.h"
10 #include "geo_config.h"
11
12 /**
13 * \file xtiffio.h
14 *
15 * Definitions relating GeoTIFF functions from geotiff.h to the TIFF
16 * library (usually libtiff).
17 */
18
19 /*
20 * Define public Tag names and values here
21 */
22
23 /* tags 33550 is a private tag registered to SoftDesk, Inc */
24 #define TIFFTAG_GEOPIXELSCALE 33550
25 /* tags 33920-33921 are private tags registered to Intergraph, Inc */
26 #define TIFFTAG_INTERGRAPH_MATRIX 33920 /* $use TIFFTAG_GEOTRANSMATRIX ! */
27 #define TIFFTAG_GEOTIEPOINTS 33922
28 /* tags 34263-34264 are private tags registered to NASA-JPL Carto Group */
29 #ifdef JPL_TAG_SUPPORT
30 #define TIFFTAG_JPL_CARTO_IFD 34263 /* $use GeoProjectionInfo ! */
31 #endif
32 #define TIFFTAG_GEOTRANSMATRIX 34264 /* New Matrix Tag replaces 33920 */
33 /* tags 34735-3438 are private tags registered to SPOT Image, Inc */
34 #define TIFFTAG_GEOKEYDIRECTORY 34735
35 #define TIFFTAG_GEODOUBLEPARAMS 34736
36 #define TIFFTAG_GEOASCIIPARAMS 34737
37
38 /*
39 * Define Printing method flags. These
40 * flags may be passed in to TIFFPrintDirectory() to
41 * indicate that those particular field values should
42 * be printed out in full, rather than just an indicator
43 * of whether they are present or not.
44 */
45 #define TIFFPRINT_GEOKEYDIRECTORY 0x80000000
46 #define TIFFPRINT_GEOKEYPARAMS 0x40000000
47
48 /**********************************************************************
49 * Nothing below this line should need to be changed by the user.
50 **********************************************************************/
51
52 #if defined(__cplusplus)
53 extern "C" {
54 #endif
55
56 /**********************************************************************
57 * Do we want to build as a DLL on windows?
58 **********************************************************************/
59 #if !defined(CPL_DLL)
60 # if defined(_WIN32) && defined(BUILD_AS_DLL)
61 # define CPL_DLL __declspec(dllexport)
62 # else
63 # define CPL_DLL
64 # endif
65 #endif
66
67 extern void CPL_DLL XTIFFInitialize();
68 extern TIFF CPL_DLL * XTIFFOpen(const char* name, const char* mode);
69 extern TIFF CPL_DLL * XTIFFFdOpen(int fd, const char* name, const char* mode);
70 extern void CPL_DLL XTIFFClose(TIFF *tif);
71
72 extern TIFF CPL_DLL * XTIFFClientOpen(const char* name, const char* mode,
73 thandle_t thehandle,
74 TIFFReadWriteProc, TIFFReadWriteProc,
75 TIFFSeekProc, TIFFCloseProc,
76 TIFFSizeProc,
77 TIFFMapFileProc, TIFFUnmapFileProc);
78 #if defined(__cplusplus)
79 }
80 #endif
81
82 #endif /* __xtiffio_h */
83
0 # MPW C Makefile for libgeotiff
1
2 .o Ä .c
3 C -o {default}.o -I ::libtiff: {default}.c
4
5 XTIFF = :libxtiff:xtiff.o
6
7 CLEANINC= xtiffio.h xtiffiop.h
8
9 OBJECTS = ¶
10 {XTIFF} ¶
11 geo_free.o ¶
12 geo_get.o ¶
13 geo_new.o ¶
14 geo_names.o ¶
15 geo_print.o ¶
16 geo_set.o ¶
17 geo_tiffp.o ¶
18 geo_write.o
19
20 INCLUDES = ¶
21 geo_keyp.h ¶
22 geo_tiffp.h ¶
23 geokeys.h ¶
24 geovalues.h ¶
25 geonames.h ¶
26 geotiff.h
27
28
29 ALL = libgeotiff.o
30
31 all Ä {ALL}
32
33 XINCLUDES ДД
34 cd :libxtiff:
35 cp -y Ã….h ::
36 cd ::
37
38
39 {OBJECTS} ДД {INCLUDES}
40
41 {ALL} Ä XINCLUDES {OBJECTS}
42 lib -o {ALL} {OBJECTS}
43
44 clean Ä
45 rm -i {ALL}
46 rm -i {CLEANINC}
47 rm -i {OBJECTS}
48
0 #
1 # Typically the only thing that needs to be changed are the paths to the
2 # TIFF tree. Note that we expect an existing build tree, in part because we
3 # need private include files from libtiff, but also we need access to getopt.h.
4 # in the ports directory.
5 #
6 # You may want to add optimization options to the CFLAGS macro as well.
7 #
8 TIFF_DIR = ..\libtiff\libtiff
9
10 TIFF_INC = -I$(TIFF_DIR)
11 TIFF_LIB = $(TIFF_DIR)\libtiff.lib
12 TIFF_LIB_DLL = $(TIFF_DIR)\libtiff_i.lib
13
14 # Installation locations (with install, or devinstall targets)
15 PREFIX = c:\usr
16 BINDIR = $(PREFIX)\bin
17 LIBDIR = $(PREFIX)\lib
18 INCDIR = $(PREFIX)\include
19 DATADIR = $(PREFIX)\share\epsg_csv
20
21 #
22 CC = cl
23 INCL = -I. -Ilibxtiff $(TIFF_INC)
24
25
26 # Pick the first LIBS definition for a static libtiff.lib or the second
27 # to link against the libtiff DLL.
28
29 #LIBS = geotiff.lib $(TIFF_LIB)
30 LIBS = geotiff_i.lib $(TIFF_LIB_DLL)
31
32 DLLNAME = geotiff.dll
33
34 # Set optimization or debug flags here.
35 CFLAGS = $(INCL) /MD /Ox /nologo
36 #CFLAGS = $(INCL) /MD /Zi /nologo
37
38 #
39 OBJS = \
40 xtiff.obj \
41 geo_free.obj \
42 geo_get.obj \
43 geo_names.obj \
44 geo_new.obj \
45 geo_print.obj \
46 geo_set.obj \
47 geo_tiffp.obj \
48 geo_write.obj \
49 geo_extra.obj \
50 geo_trans.obj \
51 geo_normalize.obj \
52 geotiff_proj4.obj \
53 cpl_csv.obj \
54 cpl_serv.obj
55
56 all: geo_config.h geotiff.lib $(DLLNAME) listgeo.exe geotifcp.exe
57
58 listgeo.exe: bin\listgeo.c geotiff.lib
59 $(CC) $(CFLAGS) bin\listgeo.c $(LIBS)
60
61 geotifcp.exe: bin\geotifcp.c geotiff.lib
62 $(CC) $(CFLAGS) bin\geotifcp.c bin\getopt.c $(LIBS)
63
64 gt_update.exe: bin\gt_update.c geotiff.lib
65 $(CC) $(CFLAGS) bin\gt_update.c bin\getopt.c geotiff.lib $(LIBS)
66
67 geotiff.lib: $(OBJS)
68 lib /out:geotiff.lib $(OBJS)
69
70 #
71 $(DLLNAME): $(OBJS)
72 link /dll /out:$(DLLNAME) /implib:geotiff_i.lib $(OBJS) $(TIFF_LIB_DLL)
73
74 geo_config.h: geo_config.h.vc
75 copy geo_config.h.vc geo_config.h
76
77 xtiff.obj: libxtiff\xtiff.c
78 $(CC) -c $(CFLAGS) libxtiff\xtiff.c
79
80 geo_free.obj: geo_free.c
81 $(CC) -c $(CFLAGS) geo_free.c
82
83 geo_get.obj: geo_get.c
84 $(CC) -c $(CFLAGS) geo_get.c
85
86 geo_names.obj: geo_names.c
87 $(CC) -c $(CFLAGS) geo_names.c
88
89 geo_new.obj: geo_new.c
90 $(CC) -c $(CFLAGS) geo_new.c
91
92 geo_print.obj: geo_print.c
93 $(CC) -c $(CFLAGS) geo_print.c
94
95 geo_set.obj: geo_set.c
96 $(CC) -c $(CFLAGS) geo_set.c
97
98 geo_tiffp.obj: geo_tiffp.c
99 $(CC) -c $(CFLAGS) geo_tiffp.c
100
101 geo_write.obj: geo_write.c
102 $(CC) -c $(CFLAGS) geo_write.c
103
104 geo_trans.obj: geo_trans.c
105 $(CC) -c $(CFLAGS) geo_trans.c
106
107 geo_extra.obj: geo_extra.c
108 $(CC) -c $(CFLAGS) geo_extra.c
109
110 geo_normalize.obj: geo_normalize.c
111 $(CC) -c $(CFLAGS) geo_normalize.c
112
113 geotiff_proj4.obj: geotiff_proj4.c
114 $(CC) -c $(CFLAGS) geotiff_proj4.c
115
116 cpl_csv.obj: cpl_csv.c
117 $(CC) -c $(CFLAGS) cpl_csv.c
118
119 cpl_serv.obj: cpl_serv.c
120 $(CC) -c $(CFLAGS) cpl_serv.c
121
122 clean:
123 -del *.obj
124 -del *.exe
125 -del *.lib
126 -del *.dll
127
128 install: all
129 -mkdir $(PREFIX)
130 -mkdir $(BINDIR)
131 -mkdir $(DATADIR)
132 copy *.dll $(BINDIR)
133 copy *.exe $(BINDIR)
134 -copy csv\*.csv $(DATADIR)
135
136 devinstall: install
137 -mkdir $(INCDIR)
138 -mkdir $(LIBDIR)
139 copy *.lib $(LIBDIR)
140 copy *.h $(INCDIR)
141 copy *.inc $(INCDIR)
142
0 #!/bin/sh
1
2 if [ $# -lt 2 ] ; then
3 echo "Usage: mkbindist.sh version platform [-install]"
4 echo
5 echo "Example: mkbindist.sh 1.1.5 linux"
6 exit
7 fi
8
9 VERSION=$1
10 PLATFORM=$2
11
12 # Ensure all required components are built.
13
14 if test \! make ; then
15 exit
16 fi
17
18 #
19 # Prepare tree.
20 #
21
22 DIST_DIR=libgeotiff-${PLATFORM}-bin.${VERSION}
23
24 rm -rf $DIST_DIR
25 mkdir $DIST_DIR
26
27 mkdir $DIST_DIR/bin
28 cp bin/geotifcp bin/listgeo $DIST_DIR/bin
29
30 # The file list is copied from Makefile.in:GT_INCLUDE_FILES
31
32 mkdir $DIST_DIR/include
33 cp xtiffio.h xtiffiop.h geotiff.h geotiffio.h geovalues.h \
34 geonames.h geokeys.h geo_tiffp.h geo_config.h geo_keyp.h \
35 geo_normalize.h cpl_serv.h cpl_csv.h \
36 epsg_datum.inc epsg_gcs.inc epsg_pm.inc epsg_units.inc geo_ctrans.inc \
37 epsg_ellipse.inc epsg_pcs.inc epsg_proj.inc epsg_vertcs.inc geokeys.inc \
38 $DIST_DIR/include
39
40 mkdir $DIST_DIR/lib
41 cp libgeotiff.a $DIST_DIR/lib
42 if test -f libgeotiff.so.$VERSION ; then
43 cp libgeotiff.so.$VERSION $DIST_DIR/lib
44 (cd $DIST_DIR/lib ; ln -s libgeotiff.so.$VERSION libgeotiff.so)
45 fi
46
47 mkdir $DIST_DIR/share
48 mkdir $DIST_DIR/share/epsg_csv
49 cp csv/*.csv $DIST_DIR/share/epsg_csv
50
51 cp README_BIN $DIST_DIR/README
52
53 rm -f ${DIST_DIR}.tar.gz
54 tar cf ${DIST_DIR}.tar ${DIST_DIR}
55 gzip -9 ${DIST_DIR}.tar
56
57 echo "Prepared: "${DIST_DIR}.tar.gz
58
59 TARGETDIR=remotesensing.org:/ftp/remotesensing/pub/geotiff/libgeotiff
60
61 if test "$3" = "-install" ; then
62 scp ${DIST_DIR}.tar.gz $TARGETDIR
63 fi
0 #!/bin/sh
1
2 if [ $# -lt 1 ] ; then
3 echo "Usage: mkdist.sh version [-install]"
4 echo
5 echo "Example: mkdist.sh 1.1.5"
6 exit
7 fi
8
9 VERSION=$1
10 COMPRESSED_VERSION=`echo $VERSION | tr -d .`
11
12 rm -rf dist_wrk
13 mkdir dist_wrk
14 cd dist_wrk
15
16 export CVSROOT=:pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot
17
18 echo "Please type anonymous if prompted for a password."
19 cvs login
20
21 cvs checkout geotiff/libgeotiff
22
23 if [ \! -d geotiff/libgeotiff ] ; then
24 echo "cvs checkout reported an error ... abandoning mkdist.sh"
25 exit
26 fi
27
28 find geotiff -name CVS -exec rm -rf {} \;
29
30 mv geotiff/libgeotiff libgeotiff-${VERSION}
31 touch libgeotiff-${VERSION}/configure
32
33 rm -f ../libgeotiff-${VERSION}.tar.gz ../libgeotiff${COMPRESSED_VERSION}.zip
34
35 tar cf ../libgeotiff-${VERSION}.tar libgeotiff-${VERSION}
36 gzip -9 ../libgeotiff-${VERSION}.tar
37 zip -r ../libgeotiff${COMPRESSED_VERSION}.zip libgeotiff-${VERSION}
38
39
40 cd ..
41 rm -rf dist_wrk
42
43 TARGETDIR=remotesensing.org:/ftp/remotesensing/pub/geotiff/libgeotiff
44 if test "$2" = "-install" ; then
45 scp libgeotiff-${VERSION}.tar.gz libgeotiff${COMPRESSED_VERSION}.zip \
46 $TARGETDIR
47 fi