1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<html> 3<head> 4<meta name="generator" content= 5"HTML Tidy for Solaris (vers 12 April 2005), see www.w3.org"> 6<title>Building the TIFF Software Distribution</title> 7</head> 8<body bgcolor="white"> 9<h1><font face="Arial, Helvetica, Sans"><img src= 10"images/cramps.gif" width="159" height="203" align="left" border= 11"1" hspace="6"> Building the Software Distribution</font></h1> 12<ul> 13<li><a href="#UNIX">Building on a UNIX system</a>.</li> 14<li><a href="#MacMPW">Building on a Macintosh system with 15MPW</a>.</li> 16<li><a href="#MacCW">Building on a Macintosh system with 17CodeWarrior</a>.</li> 18<li><a href="#PC">Building on an MS-DOS or Windows system</a>.</li> 19<li><a href="#DJGPP">Building on MS-DOS with the DJGPP v2 20compiler</a>.</li> 21<li><a href="#VMS">Building on a VMS system</a>.</li> 22<li><a href="#Acorn">Building on an Acorn RISC OS system</a>.</li> 23<li><a href="#Other">Building the Software on Other 24Systems</a></li> 25</ul> 26<br clear="left"> 27This chapter contains step-by-step instructions on how to configure 28and build the TIFF software distribution. The software is most 29easily built on a UNIX system, but with a little bit of work it can 30easily be built and used on other non-UNIX platforms. <a name= 31"UNIX" id="UNIX"></a> 32<hr> 33<h2>Building on a UNIX System</h2> 34To build the software on a UNIX system you need to first run the 35configure shell script that is located in the top level of the 36source directory. This script probes the target system for 37necessary tools and functions and constructs a build environment in 38which the software may be compiled. Once configuration is done, you 39simply run <tt>make</tt> (or <tt>gmake</tt>) to build the software 40and then <tt>make install</tt> to do the installation; for example: 41<div style="margin-left: 2em"> 42<pre> 43hyla% <b>cd tiff-v3.4beta099</b> 44hyla% <b>./configure</b> 45 <i>...lots of messages...</i> 46hyla% <b>make</b> 47 <i>...lots of messages...</i> 48hyla# <b>make install</b> 49</pre></div> 50Supplied makefiles are depend on GNU <tt>make</tt> utility, so you 51will need the one. Depending on your installation <b>make</b> 52command may invoke standard system <tt>make</tt> and <b>gmake</b> 53invoke GNU make. In this case you should use former. If you don't 54have <tt>make</tt> at all, but only <tt>gmake</tt>, you should 55export environment variable <tt>MAKE=gmake</tt> before 56<b>./configure</b>. 57<p>In general, the software is designed such that the following 58should be ``<i>make-able</i>'' in each directory:</p> 59<div style="margin-left: 2em"> 60<pre> 61make [all] build stuff 62make install build&install stuff 63make clean remove .o files, executables and cruft 64make distclean remove everything, that can be recreated 65</pre></div> 66Note that after running "<tt>make distclean</tt>" the 67<tt>configure</tt> script must be run again to create the Makefiles 68and other make-related files. <a name="BuildTrees" id= 69"BuildTrees"></a> 70<hr width="65%" align="right"> 71<h3>Build Trees</h3> 72There are two schemes for configuring and building the software. If 73you intend to build the software for only one target system, you 74can configure the software so that it is built in the same 75directories as the source code. 76<div style="margin-left: 2em"> 77<pre> 78hyla% <b>cd tiff-v3.4beta099</b> 79hyla% <b>ls</b> 80COPYRIGHT VERSION config.sub dist man 81Makefile.in config.guess configure html port 82README config.site contrib libtiff tools 83hyla% <b>./configure</b> 84</pre></div> 85<p>Otherwise, you can configure a build tree that is parallel to 86the source tree hierarchy but which contains only configured files 87and files created during the build procedure.</p> 88<div style="margin-left: 2em"> 89<pre> 90hyla% <b>cd tiff-v3.4beta099</b> 91hyla% <b>mkdir obj obj/mycpu</b> 92hyla% <b>cd obj/mycpu</b> 93hyla% <b>../../configure</b> 94</pre></div> 95This second scheme is useful for: 96<ul> 97<li>building multiple targets from a single source tree</li> 98<li>building from a read-only source tree (e.g. if you receive the 99distribution on CD-ROM)</li> 100</ul> 101<a name="ConfigOptions" id="ConfigOptions"></a> 102<hr width="65%" align="right"> 103<h3>Configuration Options</h3> 104The configuration process is critical to the proper compilation, 105installation, and operation of the software. The configure script 106runs a series of tests to decide whether or not the target system 107supports required functionality and, if it does not, whether it can 108emulate or workaround the missing functions. This procedure is 109fairly complicated and, due to the nonstandard nature of most UNIX 110systems, prone to error. The first time that you configure the 111software for use you should check the output from the configure 112script and look for anything that does not make sense for your 113system. 114<p>A second function of the configure script is to set the default 115configuration parameters for the software. Of particular note are 116the directories where the software is to be installed. By default 117the software is installed in the <b>/usr/local</b> hierarchy. To 118change this behaviour the appropriate parameters can be specified 119on the command line to configure. Run <b>./configure --help</b> to 120get a list of possible options. Installation related options are 121shown below.</p> 122<pre> 123<tt> 124Installation directories: 125 --prefix=PREFIX install architecture-independent files in PREFIX 126 [/usr/local] 127 --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX 128 [PREFIX] 129 130By default, `make install' will install all the files in 131`/usr/local/bin', `/usr/local/lib' etc. You can specify 132an installation prefix other than `/usr/local' using `--prefix', 133for instance `--prefix=$HOME'. 134 135For better control, use the options below. 136 137Fine tuning of the installation directories: 138 --bindir=DIR user executables [EPREFIX/bin] 139 --sbindir=DIR system admin executables [EPREFIX/sbin] 140 --libexecdir=DIR program executables [EPREFIX/libexec] 141 --datadir=DIR read-only architecture-independent data [PREFIX/share] 142 --sysconfdir=DIR read-only single-machine data [PREFIX/etc] 143 --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] 144 --localstatedir=DIR modifiable single-machine data [PREFIX/var] 145 --libdir=DIR object code libraries [EPREFIX/lib] 146 --includedir=DIR C header files [PREFIX/include] 147 --oldincludedir=DIR C header files for non-gcc [/usr/include] 148 --infodir=DIR info documentation [PREFIX/info] 149 --mandir=DIR man documentation [PREFIX/man] 150 151Program names: 152 --program-prefix=PREFIX prepend PREFIX to installed program names 153 --program-suffix=SUFFIX append SUFFIX to installed program names 154 --program-transform-name=PROGRAM run sed PROGRAM on installed program names 155</tt> 156</pre> 157<a name="Packages" id="Packages"></a> 158<hr width="65%" align="right"> 159<h3>Configuring Optional Packages/Support</h3> 160The TIFF software comes with several packages that are installed 161only as needed, or only if specifically configured at the time the 162configure script is run. Packages can be configured via the 163<b>configure</b> script commandline parameters. 164<dl> 165<dt><i>Static/Shared Objects Support</i></dt> 166<dd><tt>--enable-shared[=PKGS] build shared 167libraries [default=yes]<br> 168--enable-static[=PKGS] build static 169libraries [default=yes]</tt> 170<p>These options control whether or not to configure the software 171to build a shared and static binaries for the TIFF library. Use of 172shared libraries can significantly reduce the disk space needed for 173users of the TIFF software. If shared libarries are not used then 174the code is statically linked into each application that uses it. 175By default both types of binaries is configured.</p> 176<p><tt>--enable-rpath Enable runtime linker 177paths (-R libtool option)</tt></p> 178<p>Add library directories (see other options below) to the TIFF 179library run-time linker path.</p> 180</dd> 181<dt><i>JPEG Support</i></dt> 182<dd><tt>--disable-jpeg disable IJG JPEG 183library usage (required for JPEG compression, enabled by default) 184--with-jpeg-include-dir=DIR location of IJG 185JPEG library headers 186--with-jpeg-lib-dir=DIR location of IJG JPEG 187library binary)</tt></dd> 188<dd>The <tt>JPEG</tt> package enables support for the handling of 189TIFF images with JPEG-encoded data. Support for JPEG-encoded data 190requires the Independent JPEG Group (IJG) <tt>libjpeg</tt> 191distribution; this software is available at <a href= 192"ftp://ftp.uu.net/graphics/jpeg/">ftp.uu.net:/graphics/jpeg/</a>. 193<b>configure</b> script automatically tries to search the working 194IJG JPEG installation. If it fails to find library, JPEG support 195will be automatically disabled.If you want specify the exact paths 196to library binary and headers, use above switches for that.</dd> 197<dt><i>ZIP Support</i></dt> 198<dd>The <tt>ZIP</tt> support enables support for the handling of 199TIFF images with deflate-encoded data. Support for deflate-encoded 200data requires the freely available <tt>zlib</tt> distribution 201written by Jean-loup Gailly and Mark Adler; this software is 202available at <a href= 203"ftp://ftp.uu.net/pub/archiving/zip/zlib/">ftp.uu.net:/pub/archiving/zip/zlib/</a> 204(or try <a href= 205"ftp://quest.jpl.nasa.gov/beta/zlib/">quest.jpl.nasa.gov:/beta/zlib/</a>). 206If ZIP support is enabled the <tt>DIRS_LIBINC</tt> and 207<tt>DIR_GZLIB</tt> parameters should also be set (see below). By 208default this package is not configured.</dd> 209</dl> 210<a name="Sample" id="Sample"></a> 211<hr width="65%" align="right"> 212<h3>A Sample Configuration Session</h3> 213This section shows a sample configuration session and describes the 214work done. The session is shown indented in a <tt>fixed width 215font</tt> with user-supplied input in a <tt><b>bold font</b></tt>. 216Comments are shown in a normal or <i>italic</i> font. This session 217was collected on a 486 machine running BSDI 1.1. 218<div style="margin-left: 2em"> 219<pre> 220<tt> 221wullbrandt% <b>mkdir tiff</b> 222wullbrandt% <b>cd tiff</b> 223wullbrandt% <b>ln -s /hosts/oxford/usr/people/sam/tiff src</b> 224</tt> 225</pre></div> 226A build tree separate from the source tree is used here. In fact, 227in this case the distribution is accessed from a read-only 228NFS-mounted filesystem. 229<div style="margin-left: 2em"> 230<pre> 231<tt> 232wullbrandt% <b>src/configure</b> 233Configuring TIFF Software v3.4beta015. 234 235Reading site-wide parameters from ../tiff-v3.4beta015/config.site. 236Reading local parameters from config.local. 237Gosh, aren't you lucky to have a i386-unknown-bsdi1.1 system! 238</tt> 239</pre></div> 240Note that configure announces the distribution version and the 241deduced target configuration (<tt>i386-unknown-bsdi1.1</tt> here). 242<div style="margin-left: 2em"> 243<pre> 244<tt> 245Using /usr/local/bin/gcc for a C compiler (set CC to override). 246Looks like /usr/local/bin/gcc supports the -g option. 247Using " -g" for C compiler options. 248</tt> 249</pre></div> 250configure checked the normal shell search path for potential ANSI C 251compilers. The compiler is selected according to it properly 252compiling a small ANSI C test program. A specific compiler may be 253requested by setting the <tt>CC</tt> environment variable to the 254appropriate pathname, by supplying the parameter on the command 255line, e.g. <tt>-with-CC=gcc</tt>, or by setting <tt>CC</tt> in a 256configuration file. 257<p><img src="images/info.gif" align="left" hspace="10"> <em>Note 258that an ANSI C compiler is required to build the software. If a C 259compiler requires options to enable ANSI C compilation, they can be 260specified with the <tt>ENVOPTS</tt> parameter.</em></p> 261<p>Once a compiler is selected configure checks to see if the 262compiler accepts a -g option to enable the generation of debugging 263symbols, and if the compiler includes an ANSI C preprocessor.</p> 264<div style="margin-left: 2em"> 265<pre> 266<tt> 267Using /usr/ucb/make to configure the software. 268</tt> 269</pre></div> 270Next various system-specific libraries that may or may not be 271needed are checked for (none are needed in this case). If your 272system requires a library that is not automatically included it can 273be specified by setting the <tt>MACHDEPLIBS</tt> parameter. 274<p><i>Creating port.h.</i> The <b>port.h</b> file is included by 275all the C code in the library (but not the tools). It includes 276definitions for functions and type definitions that are missing 277from system include files, <tt>#defines</tt> to enable or disable 278system-specific functionality, and other odds and ends.</p> 279<div style="margin-left: 2em"> 280<pre> 281<tt> 282Creating libtiff/port.h with necessary definitions. 283... using LSB2MSB bit order for your i386 cpu 284... using big-endian byte order for your i386 cpu 285... configure use of mmap for memory-mapped files 286... O_RDONLY is in <fcntl.h> 287... using double for promoted floating point parameters 288... enabling use of inline functions 289Done creating libtiff/port.h. 290</tt> 291</pre></div> 292This file can take a long time to create so configure generates the 293file only when it is needed, either because the file does not exist 294or because a different target or compiler is to be used. Note that 295running "<tt>make distclean</tt>" in the top-level directory of the 296build tree will remove the <b>port.h</b> file (along with all the 297other files generated by configure). 298<p><i>Selecting emulated library functions.</i> Certain library 299functions used by the tools are not present on all systems and can 300be emulated using other system functionality. configure checks for 301the presence of such functions and if they are missing, will 302configure emulation code from the <b>port</b> directory to use 303instead. Building the TIFF software on unsupported systems may 304require adding to the code to the <b>port</b> directory.</p> 305<div style="margin-left: 2em"> 306<pre> 307<tt> 308Checking system libraries for functionality to emulate. 309Done checking system libraries. 310</tt> 311</pre></div> 312If a routine must be emulated and configure does not automatically 313check for it, the routine name can be specified using the 314<tt>PORTFUNCS</tt> parameter. To add emulation support for a new 315function <tt>foo</tt>, create a file <b>port/foo.c</b> that 316contains the emulation code and then set <tt>PORTFUNCS=foo</tt> in 317a configuration file or modify the configure script to 318automatically check for the missing function. 319<div style="margin-left: 2em"> 320<pre> 321<tt> 322Checking for Dynamic Shared Object (DSO) support. 323Done checking for DSO support. 324</tt> 325</pre></div> 326If the <tt>DSO</tt> package is enabled (<tt>DSO=auto</tt> or 327<tt>DSO=yes</tt>), then configure will verify the system and 328compiler are capable of constructing SVR4-style DSO's in the 329expected way. Note that while a system may support DSO's the 330compiler may not be capable of generating the required 331position-independent code and/or the compiler may not pass the 332needed options through to the loader. 333<p><i>Selecting utility programs.</i> configure locates various 334system utility programs that are used during installation of the 335software.</p> 336<div style="margin-left: 2em"> 337<pre> 338<tt> 339Selecting programs used during installation. 340Looks like mv supports the -f option to force a move. 341Looks like /bin/ln supports the -s option to create a symbolic link. 342Done selecting programs. 343</tt> 344</pre></div> 345<p><i>Selecting default configuration parameters.</i> The remainder 346of the work done by configure involves setting up configuration 347parameters that control the placement and setup of files during the 348installation procedure.</p> 349<div style="margin-left: 2em"> 350<pre> 351<tt> 352Selecting default TIFF configuration parameters. 353 354Looks like manual pages go in /usr/contrib/man. 355Looks like manual pages should be installed with bsd-nroff-gzip-0.gz. 356 357TIFF configuration parameters are: 358 359[ 1] Directory for tools: /usr/contrib/bin 360[ 2] Directory for libraries: /usr/contrib/lib 361[ 3] Directory for include files: /usr/contrib/include 362[ 4] Directory for manual pages: /usr/contrib/man 363[ 5] Manual page installation scheme: bsd-nroff-gzip-0.gz 364 365Are these ok [yes]? 366</tt> 367</pre></div> 368At this point you can interactively modify any of the displayed 369parameters. Hitting a carriage return or typing <tt>yes</tt> will 370accept the current parameters. Typing one of the number displayed 371along the left hand side causes configure to prompt for a new value 372of the specified parameter. Typing anything else causes configure 373to prompt for a new value <em>for each parameter</em>. In general 374hitting carriage return will accept the current value and typing 375anything that is unacceptable will cause a help message to be 376displayed. A description of each of the configuration parameters is 377given below. 378<p>Once acceptable parameters are setup configure will generate all 379the files that depend on these parameters. Note that certain files 380may or may not be created based on the configuration of optional 381packages and/or the functions supported by target system.</p> 382<div style="margin-left: 2em"> 383<pre> 384<tt> 385Creating Makefile from ../tiff-v3.4beta015/Makefile.in 386Creating libtiff/Makefile from ../tiff-v3.4beta015/libtiff/Makefile.in 387Creating man/Makefile from ../tiff-v3.4beta015/man/Makefile.in 388Creating tools/Makefile from ../tiff-v3.4beta015/tools/Makefile.in 389Creating port/install.sh from ../tiff-v3.4beta015/port/install.sh.in 390Done. 391</tt> 392</pre></div> 393<a name="DSOSupport" id="DSOSupport"></a> 394<hr> 395<h3>Shared Library Support</h3> 396It is desirable to make the TIFF library be a shared object on 397systems that have support for shared libraries. Unfortunately the 398rules to use to build a shared library vary between operating 399systems and even compilers. The distributed software includes 400support for building a shared version of the library on a number of 401different systems. This support is split between rules in the file 402<b>libtiff/Makefile.in</b> that construct the shared library and 403checks done by the <tt>configure</tt> script to verify that the 404expected rules are supported by compilation tools for the target 405system. 406<p>To add new support for building a shared library both these 407files must be updated. In the configure script search for the 408section where the autoconfiguration setting of the <tt>DSO</tt> 409parameter is handled and add a new case for the target system that 410sets the <tt>DSOSUF</tt>, <tt>DSOLD</tt>, <tt>DSOOPTS</tt>, and 411<tt>LIBCOPTS</tt> options as appropriate for the system. 412<tt>DSOSUF</tt> specifies the filename suffix used for the shared 413library (e.g. ``.so'' for Dynamic Shared Objects on most SVR4-based 414systems). <tt>DSOLD</tt> specifies the program to use to build the 415shared library from a compiled object file; typically ``${LD}'' 416though on some systems it is better to use the C compiler directly 417so system-dependent options and libraries are automatically 418supplied. <tt>DSOOPTS</tt> are options that must be specified to 419<tt>DSOLD</tt> when building the shared library. <tt>LIBCOPTS</tt> 420are options to pass to the C compiler when constructing a 421relocatable object file to include in a shared library; e.g. ``-K 422PIC'' on a Sun system. The <tt>DSO</tt> parameter must also be set 423to a unique label that identifies the target system and compilation 424tools. This label is used to select a target in 425<b>libtiff/Makefile.in</b> to do the actual work in building the 426shared library. Finally, to complete support for the shared library 427added the appropriate rules to <b>libtiff/Makefile.in</b> under the 428target specified in the <tt>configure</tt> script. <a name="PC" id= 429"PC"></a></p> 430<hr> 431<h2>Building the Software under Windows 95/98/NT/2000 with MS 432VC++</h2> 433With Microsoft Visual C++ installed, and properly configured for 434commandline use (you will likely need to source VCVARS32.BAT in 435AUTOEXEC.bAT or somewhere similar) you should be able to use the 436provided <tt>makefile.vc</tt>. 437<p>The source package is delivered using Unix line termination 438conventions, which work with MSVC but do not work with Windows 439'notepad'. If you use unzip from the <a href= 440"http://www.info-zip.org/pub/infozip/">Info-Zip</a> package, you 441can extract the files using Windows normal line termination 442conventions with a command similar to:</p> 443<pre> 444 unzip -aa -a tiff-3.7.4.zip 445</pre> 446<p>By default libtiff expects that a pre-built zlib and jpeg 447library are provided by the user. If this is not the case, then you 448may edit libtiff\tiffconf.h using a text editor (e.g. notepad) and 449comment out the entries for JPEG_SUPPORT, PIXARLOG_SUPPORT, and 450ZIP_SUPPORT. Ignore the comment at the top of the file which says 451that it has no influence on the build, because the statement is not 452true for Windows. However, by taking this approach, libtiff will 453not be able to open some TIFF files.</p> 454<p>To build using the provided makefile.vc you may use:</p> 455<pre> 456 C:\tiff-3.7.4> nmake /f makefile.vc clean 457 C:\tiff-3.7.4> nmake /f makefile.vc 458 459 or (the hard way) 460 461 C:\tiff-3.7.4> cd port 462 C:\tiff-3.7.4\port> nmake /f makefile.vc clean 463 C:\tiff-3.7.4\port> nmake /f makefile.vc 464 C:\tiff-3.7.4> cd ../libtiff 465 C:\tiff-3.7.4\libtiff> nmake /f makefile.vc clean 466 C:\tiff-3.7.4\libtiff> nmake /f makefile.vc 467 C:\tiff-3.7.4\libtiff> cd ..\tools 468 C:\tiff-3.7.4\tools> nmake /f makefile.vc clean 469 C:\tiff-3.7.4\tools> nmake /f makefile.vc 470</pre> 471<p>This will build the library file 472<tt>libtiff\libtiff\libtiff.lib</tt>. This can be used in Win32 473programs. You may want to adjust the build options before start 474compiling. All parameters contained in the <tt>nmake.opt</tt> 475file.This is a plain text file you can open with your favorite text 476editor.</p> 477<p>The makefile also builds a DLL (libtiff.dll) with an associated 478import library (libtiff_i.lib). Any builds using libtiff will need 479to include the LIBTIFF\LIBTIFF directory in the include path.</p> 480<p>The <tt>libtiff\tools\makefile.vc</tt> should build .exe's for 481all the standard TIFF tool programs.</p> 482<p><a name="DJGPP" id="DJGPP"></a></p> 483<hr> 484<h2>Building the Software under MS/DOS with the DJGPP v2 485compiler</h2> 486[<i>From the file <b>contrib/dosdjgpp/README</b>.</i>] 487<p>The directory <b>contrib/dosdjgpp</b> contains the files 488necessary to build the library and tools with the DJGPP v2 compiler 489under MSDOS.</p> 490<p>All you have to do is copy the files in the directory into the 491respective directories and run make. If you want, you can use the 492<b>conf.bat</b> script to do that for you, make sure that the file 493is stored with MSDOS text EOL-convention (CR/LF), otherwise the 494<b>command.com</b> will not do anything.</p> 495<p>Note that you probably will not be able to build the library 496with the v1.x versions of djgpp, due to two problems. First, the 497top makefile calls a sub-make for each directory and you are likely 498to run out of memory, since each recursive invocation of a djgpp 499v1.x program requires about 130k, to avoid that, you can enter the 500directories manually and call make (well, there are only two dirs). 501The 2nd problem is that djgpp 1.x doesn't call the coff2exe 502(stubify) program when creating an executable. This means that all 503programs compiled are not converted to exe and consequently are not 504available for calling directly. For the tools directory, you can 505just call coff2exe for each program after make finishes, but in the 506libtiff directory, a few programs are created during the make 507process that have to be called for make to continue (e.g. 508mkg3states). Make will probably report an error at each such stage. 509To fix that, either add a coff2exe call before each program is 510called or call coff2exe manually and rerun make (there 2-3 such 511programs). <a name="MacMPW" id="MacMPW"></a></p> 512<hr> 513<h2>Building the Software on a Macintosh with MPW</h2> 514The directory <b>contrib/mac-mpw</b> contains support for compiling 515the library and tools under the MPW Shell on a Macintosh system. 516This support was contributed by Niles Ritter (<a href= 517"mailto:[email protected]">[email protected]</a>). 518<p>[<i>From the file <b>contrib/mac-mpw/README</b>.</i>]</p> 519<p>This directory contains all of the utilities and makefile source 520to build the LIBTIFF library and tools from the MPW Shell. The file 521BUILD.mpw in this directory is an executable script which uses all 522of these files to create the MPW makefiles and run them.</p> 523<p>The <file>.make files are not MPW makefiles as such, but 524are when run through the "mactrans" program, which turns the ascii 525"%nn" metacharacters into the standard weird MPW make 526characters.</p> 527<p>This translation trick is necessary to protect the files when 528they are put into unix tarfiles, which tend to mangle the special 529characters. <a name="MacCW" id="MacCW"></a></p> 530<hr> 531<h2>Building the Software on a Macintosh with CodeWarrior</h2> 532The directory <b>contrib/mac-cw</b> contains support for compiling 533the library and tools with MetroWerks CodeWarrior 6.1 on a 534Macintosh system. This support was contributed by Niles Ritter 535(<a href= 536"mailto:[email protected]">[email protected]</a>). 537<p>[<i>From the file <b>contrib/mac-cw/README</b>.</i>] In this 538directory you will find a Makefile.script Applescript file, which 539should be run in order to build the libtiff code using MetroWerks 540CodeWarrior. Refer to the "metrowerks.note" instructions on 541building the library for 68k and PowerPC native code, as well as 542building some of the libtiff tools, which are rather unix-like, but 543at least give an example of how to link everything together. 544<a name="VMS" id="VMS"></a></p> 545<hr> 546<h2>Building the Software on a VMS System</h2> 547The VMS port was done by Karsten Spang (<a href= 548"mailto:[email protected]">[email protected]</a>), who also "sort of" 549maintains it. The VMS specific files are not in the main 550directories. Instead they are placed under 551<tt>[.CONTRIB.VMS...]</tt> in the distribution tree. Installation: 552It is assumed that you have unpacked the tar file into a VMS 553directory tree, in this text called DISK:[TIFF]. 554<ol> 555<li>Move the VMS specific files to their proper directories. 556<pre> 557$ SET DEFAULT DISK:[TIFF.CONTRIB.VMS] 558$ RENAME [.LIBTIFF]*.* [-.-.LIBTIFF] 559$ RENAME [.TOOLS]*.* [-.-.TOOLS] 560</pre></li> 561<li>Compile the library. 562<pre> 563$ SET DEFAULT DISK:[TIFF.LIBTIFF] 564$ @MAKEVMS 565</pre></li> 566<li>Compile the tools. 567<pre> 568$ SET DEFAULT DISK:[TIFF.TOOLS] 569$ @MAKEVMS 570</pre></li> 571<li>Define the programs. 572<pre> 573$ DEFINE TIFFSHR DISK:[TIFF.LIBTIFF]TIFFSHR 574$ FAX2PS :==$DISK:[TIFF.TOOLS]FAX2PS 575$ FAX2TIFF :==$DISK:[TIFF.TOOLS]FAX2TIFF 576$ GIF2TIFF :==$DISK:[TIFF.TOOLS]GIF2TIFF 577$ PAL2RGB :==$DISK:[TIFF.TOOLS]PAL2RGB 578$ PPM2TIFF :==$DISK:[TIFF.TOOLS]PPM2TIFF 579$ RAS2TIFF :==$DISK:[TIFF.TOOLS]RAS2TIFF 580$ RGB2YCBCR :==$DISK:[TIFF.TOOLS]RGB2YCBCR 581$ THUMBNAIL :==$DISK:[TIFF.TOOLS]THUMBNAIL 582$ TIFF2BW :==$DISK:[TIFF.TOOLS]TIFF2BW 583$ TIFF2PS :==$DISK:[TIFF.TOOLS]TIFF2PS 584$ TIFFCMP :==$DISK:[TIFF.TOOLS]TIFFCMP 585$ TIFFCP :==$DISK:[TIFF.TOOLS]TIFFCP 586$ TIFFDITHER:==$DISK:[TIFF.TOOLS]TIFFDITHER 587$ TIFFDUMP :==$DISK:[TIFF.TOOLS]TIFFDUMP 588$ TIFFINFO :==$DISK:[TIFF.TOOLS]TIFFINFO 589$ TIFFMEDIAN:==$DISK:[TIFF.TOOLS]TIFFMEDIAN 590$ TIFFSPLIT :==$DISK:[TIFF.TOOLS]TIFFSPLIT 591$ YCBCR :==$DISK:[TIFF.TOOLS]YCBCR 592</pre></li> 593</ol> 594You will want to add these lines to your <tt>LOGIN.COM</tt> file, 595after changing the name of the directory that you have used on your 596machine. 597<p>This release has been tested on OpenVMS/VAX 5.5-2, using VAX C 5983.2. A previous release was tested under OpenVMS/AXP ?.? using DEC 599C ?.?, it is believed that this release as well works on AXP. The 600code contains some GNU C specific things. This does *not* imply, 601however, that the VAX/GCC configuration has been tested, *it has 602not*.</p> 603<p>The command procedures (<tt>MAKEVMS.COM</tt>) for building the 604library and tools, is believed to choose the correct options for 605the VAX and AXP cases automatically.</p> 606<p>On the AXP, IEEE floating point is used by default. If you want 607VAX floating point, remove the <tt>/FLOAT=IEEE_FLOAT</tt> 608qualifier, and change <tt>HAVE_IEEEFP=1</tt> to 609<tt>HAVE_IEEEFP=0</tt> in the <tt>MAKEVMS.COM</tt> files in both 610the <b>libtiff</b> and <b>tools</b> directories.</p> 611<h3>Compiling your own program on a VMS system:</h3> 612When compiling a source file in which you <tt>"#include 613<tiffio.h>"</tt>, use the following command 614<pre> 615 $ CC/INCLUDE=DISK:[TIFF.LIBTIFF] 616</pre> 617This ensures that the header file is found. On the AXP, also add 618<tt>/FLOAT=IEEE_FLOAT</tt> (if used when building the library). 619<h3>Linking your own program to the TIFF library on a VMS 620system:</h3> 621You can link to the library in two ways: Either using the shareable 622library, or using the object library. On the VAX these 623possibilities are: 624<ol> 625<li>Using the shareable TIFF library. 626<pre> 627$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/OPTIONS,SYS$INPUT:/OPTIONS 628 SYS$SHARE:VAXCRTL/SHAREABLE 629</pre></li> 630<li>Using the TIFF object library. 631<pre> 632$ LINK MY_PROGRAM, - 633 DISK:[TIFF.LIBTIFF]TIFF/LIBRARY/INCLUDE=(TIF_FAX3SM,TIF_CODEC), - 634 SYS$INPUT:/OPTIONS 635 SYS$SHARE:VAXCRTL/SHAREABLE 636</pre></li> 637</ol> 638On AXP (and possibly also using DEC C on VAX) the corresponding 639commands are 640<ol> 641<li>Using the shareable TIFF library. 642<pre> 643$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/OPTIONS 644</pre></li> 645<li>Using the TIFF object library. 646<pre> 647$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/LIBRARY 648</pre></li> 649</ol> 650Method 1 uses the shortest link time and smallest <tt>.EXE</tt> 651files, but it requires that <tt>TIFFSHR</tt> is defined as above at 652link time and <strong>at run time</strong>. Using the compilation 653procedure above, the tools are linked in this way. 654<p>Method 2 gives somewhat longer link time and larger 655<tt>.EXE</tt> files, but does not require <tt>TIFFSHR</tt> to be 656defined. This method is recommended if you want to run your program 657on another machine, and for some reason don't want to have the 658library on that machine. If you plan to have more than one program 659(including the tools) on the machine, it is recommended that you 660copy the library to the other machine and use method 1. <a name= 661"Acorn" id="Acorn"></a></p> 662<hr> 663<h2>Building the Software on an Acorn RISC OS system</h2> 664The directory <b>contrib/acorn</b> contains support for compiling 665the library under Acorn C/C++ under Acorn's RISC OS 3.10 or above. 666Subsequent pathnames will use the Acorn format: The full-stop or 667period character is a pathname delimeter, and the slash character 668is not interpreted; the reverse position from Unix. Thus 669"libtiff/tif_acorn.c" becomes "libtiff.tif_acorn/c". 670<p>This support was contributed by Peter Greenham. (<a href= 671"mailto:[email protected]">[email protected]</a>).</p> 672<h3>Installing LibTIFF:</h3> 673<p>LIBTIFF uses several files which have names longer than the 674normal RISC OS maximum of ten characters. This complicates matters. 675Maybe one day Acorn will address the problem and implement long 676filenames properly. Until then this gets messy, especially as I'm 677trying to do this with obeyfiles and not have to include binaries 678in this distribution.</p> 679<p>First of all, ensure you have Truncate configured on (type 680<tt>*Configure Truncate On</tt>)</p> 681<p>Although it is, of course, preferable to have long filenames, 682LIBTIFF can be installed with short filenames, and it will compile 683and link without problems. However, <i>getting</i> it there is more 684problematic. <b>contrib.acorn.install</b> is an installation 685obeyfile which will create a normal Acorn-style library from the 686source (ie: with c, h and o folders etc.), but needs the 687distribution library to have been unpacked into a location which is 688capable of supporting long filenames, even if only temporarily.</p> 689<p>My recommendation, until Acorn address this problem properly, is 690to use Jason Tribbeck's <a href= 691"ftp://ftp.demon.co.uk/pub/mirrors/hensa/micros/arch/riscos/c/c020/longfiles.arc"> 692LongFilenames</a>, or any other working system that gives you long 693filenames, like a nearby NFS server for instance.</p> 694<p>If you are using Longfilenames, even if only temporarily to 695install LIBTIFF, unpack the TAR into a RAMDisc which has been 696longfilenamed (ie: <tt>*addlongfs ram</tt>) and then install from 697there to the hard disk. Unfortunately Longfilenames seems a bit 698unhappy about copying a bunch of long-named files across the same 699filing system, but is happy going between systems. You'll need to 700create a ramdisk of about 2Mb.</p> 701<p>Now you can run the installation script I've supplied (in 702contrib.acorn), which will automate the process of installing 703LIBTIFF as an Acorn-style library. The syntax is as follows:</p> 704<p><tt>install <source_dir> <dest_dir></tt></p> 705<p>Install will then create <dest_dir> and put the library in 706there. For example, having used LongFilenames on the RAMDisk and 707unpacked the library into there, you can then type:</p> 708<p><tt>Obey RAM::RamDisc0.$.contrib.acorn.install RAM::RamDisc0.$ 709ADFS::4.$.LIBTIFF</tt></p> 710<p>It doesn't matter if the destination location can cope with long 711filenames or not. The filenames will be truncated if necessary 712(*Configure Truncate On if you get errors) and all will be 713well.</p> 714<h3>Compiling LibTIFF:</h3> 715<p>Once the LibTIFF folder has been created and the files put 716inside, making the library should be just a matter of running 717'<b>SetVars</b>' to set the appropriate system variables, then 718running '<b>Makefile</b>'.</p> 719<p><b>OSLib</b></p> 720<p><a href= 721"ftp://ftp.acorn.co.uk/pub/riscos/releases/oslib/oslib.arc">OSLib</a> 722is a comprehensive API for RISC OS machines, written by Jonathan 723Coxhead of Acorn Computers (although OSLib is not an official Acorn 724product). Using the OSLib SWI veneers produces code which is more 725compact and more efficient than code written using _kernel_swi or 726_swi. The Acorn port of LibTIFF can take advantage of this if 727present. Edit the Makefile and go to the Static dependencies 728section. The first entry is:</p> 729<pre> 730# Static dependencies: 731@.o.tif_acorn: @.c.tif_acorn 732 cc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn 733</pre> 734<p>Change the cc line to:</p> 735<pre> 736 cc $(ccflags) -DINCLUDE_OSLIB -o @.o.tif_acorn @.c.tif_acorn 737</pre> 738<p>Remember, however, that OSLib is only <i>recommended</i> for 739efficiency's sake. It is not required. <a name="Other" id= 740"Other"></a></p> 741<hr> 742<h2>Building the Software on Other Systems</h2> 743This section contains information that might be useful if you are 744working on a non-UNIX system that is not directly supported. All 745library-related files described below are located in the 746<b>libtiff</b> directory. 747<p>The library requires two files that are generated 748<i>on-the-fly</i>. The file <b>tif_fax3sm.c</b> has the state 749tables for the Group 3 and Group 4 decoders. This file is generated 750by the <tt>mkg3states</tt> program on a UNIX system; for 751example,</p> 752<div style="margin-left: 2em"> 753<pre> 754<tt> 755cd libtiff 756cc -o mkg3states mkg3states.c 757rm -f tif_fax3sm.c 758./mkg3states -c const tif_fax3sm.c 759</tt> 760</pre></div> 761The <tt>-c</tt> option can be used to control whether or not the 762resutling tables are generated with a <tt>const</tt> declaration. 763The <tt>-s</tt> option can be used to specify a C storage class for 764the table declarations. The <tt>-b</tt> option can be used to force 765data values to be explicitly bracketed with ``{}'' (apparently 766needed for some MS-Windows compilers); otherwise the structures are 767emitted in as compact a format as possible. Consult the source code 768for this program if you have questions. 769<p>The second file required to build the library, <b>version.h</b>, 770contains the version information returned by the 771<tt>TIFFGetVersion</tt> routine. This file is built on most systems 772using the <tt>mkversion</tt> program and the contents of the 773<tt>VERSION</tt> and <tt>tiff.alpha</tt> files; for example,</p> 774<div style="margin-left: 2em"> 775<pre> 776cd libtiff 777cc -o mkversion mkversion.c 778rm -f version.h 779./mkversion -v ../VERSION -a ../dist/tiff.alpha version.h 780</pre></div> 781<p>Otherwise, when building the library on a non-UNIX system be 782sure to consult the files <b>tiffcomp.h</b> and <b>tiffconf.h</b>. 783The former contains system compatibility definitions while the 784latter is provided so that the software configuration can be 785controlled on systems that do not support the make facility for 786building the software.</p> 787<p>Systems without a 32-bit compiler may not be able to handle some 788of the codecs in the library; especially the Group 3 and 4 decoder. 789If you encounter problems try disabling support for a particular 790codec; consult the <a href= 791"internals.html#Config">documentation</a>.</p> 792<p>Programs in the tools directory are written to assume an ANSI C 793compilation environment. There may be a few POSIX'isms as well. The 794code in the <b>port</b> directory is provided to emulate routines 795that may be missing on some systems. On UNIX systems the 796<tt>configure</tt> script automatically figures out which routines 797are not present on a system and enables the use of the equivalent 798emulation routines from the <b>port</b> directory. It may be 799necessary to manually do this work on a non-UNIX system. <a name= 800"Testing" id="Testing"></a></p> 801<hr> 802<h2>Checking out the Software</h2> 803<p>Assuming you have working versions of <tt>tiffgt</tt> and 804<tt>tiffsv</tt>, you can just use them to view any of the sample 805images available for testing (see the <a href="images.html">section 806on obtaining the test images</a>). Otherwise, you can do a cursory 807check of the library with the <tt>tiffcp</tt> and <tt>tiffcmp</tt> 808programs. For example,</p> 809<div style="margin-left: 2em"> 810<pre> 811tiffcp -lzw cramps.tif x.tif 812tiffcmp cramps.tif x.tif 813</pre></div> 814<p>(<tt>tiffcmp</tt> should be silent if the files compare 815correctly). <a name="TOC" id="TOC"></a></p> 816<hr> 817<h2>Table of Contents</h2> 818The following files makup the core library: 819<pre> 820libtiff/tiff.h TIFF spec definitions 821libtiff/tiffcomp.h non-UNIX OS-compatibility definitions 822libtiff/tiffconf.h non-UNIX configuration definitions 823libtiff/tiffio.h public TIFF library definitions 824libtiff/tiffiop.h private TIFF library definitions 825libtiff/t4.h CCITT Group 3/4 code tables+definitions 826libtiff/tif_dir.h private defs for TIFF directory handling 827libtiff/tif_fax3.h CCITT Group 3/4-related definitions 828libtiff/tif_predict.h private defs for Predictor tag support 829libtiff/uvcode.h LogL/LogLuv codec-specific definitions 830libtiff/version.h version string (generated by Makefile) 831 832libtiff/tif_acorn.c Acorn-related OS support 833libtiff/tif_apple.c Apple-related OS support 834libtiff/tif_atari.c Atari-related OS support 835libtiff/tif_aux.c auxilary directory-related functions 836libtiff/tif_close.c close an open TIFF file 837libtiff/tif_codec.c configuration table of builtin codecs 838libtiff/tif_compress.c compression scheme support 839libtiff/tif_dir.c directory tag interface code 840libtiff/tif_dirinfo.c directory known tag support code 841libtiff/tif_dirread.c directory reading code 842libtiff/tif_dirwrite.c directory writing code 843libtiff/tif_dumpmode.c "no" compression codec 844libtiff/tif_error.c library error handler 845libtiff/tif_fax3.c CCITT Group 3 and 4 codec 846libtiff/tif_fax3sm.c G3/G4 state tables (generated by mkg3states) 847libtiff/tif_flush.c i/o and directory state flushing 848libtiff/tif_getimage.c TIFFRGBAImage support 849libtiff/tif_jpeg.c JPEG codec (interface to the IJG distribution) 850libtiff/tif_luv.c SGI LogL/LogLuv codec 851libtiff/tif_lzw.c LZW codec 852libtiff/tif_msdos.c MSDOS-related OS support 853libtiff/tif_next.c NeXT 2-bit scheme codec (decoding only) 854libtiff/tif_open.c open and simply query code 855libtiff/tif_packbits.c Packbits codec 856libtiff/tif_pixarlog.c Pixar codec 857libtiff/tif_predict.c Predictor tag support 858libtiff/tif_print.c directory printing support 859libtiff/tif_read.c image data reading support 860libtiff/tif_strip.c some strip-related code 861libtiff/tif_swab.c byte and bit swapping support 862libtiff/tif_thunder.c Thunderscan codec (decoding only) 863libtiff/tif_tile.c some tile-related code 864libtiff/tif_unix.c UNIX-related OS support 865libtiff/tif_version.c library version support 866libtiff/tif_vms.c VMS-related OS support 867libtiff/tif_warning.c library warning handler 868libtiff/tif_win3.c Windows-3.1-related OS support 869libtiff/tif_win32.c Win32 (95/98/NT) related OS support 870libtiff/tif_write.c image data writing support 871libtiff/tif_zip.c Deflate codec 872 873libtiff/mkg3states.c program to generate G3/G4 decoder state tables 874libtiff/mkspans.c program to generate black-white span tables 875libtiff/mkversion.c program to generate libtiff/version.h. 876</pre> 877<hr> 878Last updated: $Date: 2005-12-24 22:25:05 $ 879</body> 880</html> 881