1<HTML> 2<HEAD> 3<TITLE> 4Building the TIFF Software Distribution 5</TITLE> 6</HEAD> 7<BODY BGCOLOR=white> 8<FONT FACE="Arial, Helvetica, Sans"> 9<H1> 10<IMG SRC=images/cramps.gif WIDTH=159 HEIGHT=203 ALIGN=left BORDER=1 HSPACE=6> 11Building the Software Distribution 12</H1> 13 14<UL> 15<LI><A HREF=#UNIX>Building on a UNIX system</A>. 16<LI><A HREf=#MacMPW>Building on a Macintosh system with MPW</A>. 17<LI><A HREf=#MacCW>Building on a Macintosh system with CodeWarrior</A>. 18<LI><A HREF=#PC>Building on an MS-DOS or Windows system</A>. 19<LI><A HREF=#DJGPP>Building on MS-DOS with the DJGPP v2 compiler</A>. 20<LI><A HREF=#VMS>Building on a VMS system</A>. 21<LI><A HREF=#Acorn>Building on an Acorn RISC OS system</A>. 22<LI><A HREF=#Other>Building the Software on Other Systems</A> 23</UL> 24 25<BR CLEAR=left> 26 27This chapter contains step-by-step instructions on how to configure 28and build the TIFF software distribution. 29The software is most easily built on a UNIX system, but with a little 30bit of work it can easily be built and used on other non-UNIX platforms. 31 32<A NAME=UNIX><HR><H2>Building on a UNIX System</H2></A> 33 34To build the software on a UNIX system you need to first run the configure 35shell script that is located in the top level of the source directory. This 36script probes the target system for necessary tools and functions and 37constructs a build environment in which the software may be compiled. 38 39Once configuration is done, you simply run <TT>make</TT> (or <TT>gmake</TT>) 40to build the software and then <TT>make install</TT> to do the installation; 41for example: 42 43<UL><PRE> 44hyla% <B>cd tiff-v3.4beta099</B> 45hyla% <B>./configure</B> 46 <I>...lots of messages...</I> 47hyla% <B>make</B> 48 <I>...lots of messages...</I> 49hyla# <B>make install</B> 50</PRE></UL> 51 52Supplied makefiles are depend on GNU <TT>make</TT> utility, so you will need 53the one. Depending on your installation <B>make</B> command may invoke 54standard system <TT>make</TT> and <B>gmake</B> invoke GNU make. In this case 55you should use former. If you don't have <TT>make</TT> at all, but only 56<TT>gmake</TT>, you should export environment variable <TT>MAKE=gmake</TT> 57before <B>./configure</B>. 58 59<P> 60 61In general, the software is designed such that the following should 62be ``<I>make-able</I>'' in each directory: 63 64<UL><PRE> 65make [all] build stuff 66make install build&install stuff 67make clean remove .o files and cruft, but not executables 68make clobber remove everything that can be recreated 69make distclean remove <EM>absolutely everything</EM> that can be recreated 70</PRE></UL> 71 72Note that after running "<TT>make clobber</TT>" or 73"<TT>make distclean</TT>" the <TT>configure</TT> script must 74be run again to create the Makefiles and other make-related files. 75 76<A NAME="BuildTrees"><P><HR WIDTH=65% ALIGN=right><H3>Build Trees</H3></A> 77 78There are two schemes for configuring and building the software. 79If you intend to build the software for only one target system, you 80can configure the software so that it is built in the same directories 81as the source code. 82 83<UL><PRE> 84hyla% <B>cd tiff-v3.4beta099</B> 85hyla% <B>ls</B> 86COPYRIGHT VERSION config.sub dist man 87Makefile.in config.guess configure html port 88README config.site contrib libtiff tools 89hyla% <B>./configure</B> 90</PRE></UL> 91 92<P> 93Otherwise, you can configure a build tree that 94is parallel to the source tree hierarchy but which contains only 95configured files and files created during the build procedure. 96 97<UL><PRE> 98hyla% <B>cd tiff-v3.4beta099</B> 99hyla% <B>mkdir obj obj/mycpu</B> 100hyla% <B>cd obj/mycpu</B> 101hyla% <B>../../configure</B> 102</PRE></UL> 103 104This second scheme is useful for: 105 106<UL> 107<LI>building multiple targets from a single source tree 108<LI>building from a read-only source tree (e.g. if you receive 109 the distribution on CD-ROM) 110</UL> 111 112<A NAME="ConfigFiles"><P><HR WIDTH=65% ALIGN=right><H3>Configuration Files</H3></A> 113 114The configuration process is critical to the proper compilation, 115installation, and operation of the software. 116The configure script runs a series of tests to 117decide whether or not the target system 118supports required functionality and, if it does not, whether it 119can emulate or workaround the missing functions. 120This procedure is fairly complicated and, due to the nonstandard 121nature of most UNIX systems, prone to error. 122The first time that you configure the software for use you should 123check the output from the configure script and look for anything 124that does not make sense for your system. 125A sample configure run is shown below together with an explanation 126of some of the work that is done. 127 128<P> 129A second function of the configure script is to set the default 130configuration parameters for the software. 131Of particular note are the directories where the software is to be 132installed. 133By default the software is installed in the <B>/usr/local</B> hierarchy. 134To change this behaviour the appropriate parameters can be 135specified either: 136<UL> 137<LI>on the command line to configure, 138<LI>in a site-wide configuration file, or 139<LI>in a target-specific configuration file. 140</UL> 141configure reads any site-wide configure file first, and 142then any target-specific configuration file. 143This permits target-specific definitions to override 144site-wide definitions. 145 146<P> 147Site-wide configuration files are named 148<B>config.site</B> and are automatically searched for first 149in any directory specified on the command line to configure 150(using the <TT>-site</TT> option), or if that fails, in 151the directory in in which the configure script is located. 152 153<P> 154Target-specific configuration files are named <B>config.local</B> 155and are looked for first in the top-level configuration directory, 156or, if that fails, in the directory in which the configure script 157is located. 158 159<P> 160Configuration files are just shell scripts that define 161shell variables that control the configuration process. 162For example, the following file might be used on a BSDI system to 163configure the software for installation in the <B>/usr/contrib</B> area. 164 165<PRE> 166# 167# Parameters suitable for BSDI 1.1 168# 169DIR_BIN="/usr/contrib/bin" # directory for client apps 170DIR_LIB="/usr/contrib/lib" # directory for libraries 171DIR_MAN="/usr/contrib/man" # directory for manual pages 172</PRE> 173 174<P> 175For a complete list of the possible configuration parameters look 176at the sample <B>config.site</B> file provided in the distribution; the 177section below describes some of the more important parameters. 178 179<A NAME="Packages"><P><HR WIDTH=65% ALIGN=right><H3>Configuring Optional Packages/Support</H3></A> 180 181The TIFF software comes with several packages that are installed only 182as needed, or only if specifically configured at the time 183the configure script is run. Packages can be configured in a 184<B>config.site</B> or <B>config.local</B> file, or by using a 185<TT>-with-<PACKAGE></TT> option when invoking configure; 186e.g. <TT>configure -with-AFM</TT>. 187 188<DL> 189<DT><I>DSO Support</I> 190<DD>The <TT>DSO</TT> support controls whether or not to 191configure the software 192to build a Dynamic Shared Object for the TIFF library. 193Use of DSOs can significantly reduce the disk space needed for 194users of the TIFF software. 195If DSOs are not used then the code is statically linked into 196each application that uses it. 197By default this support is configured only if the system appears 198to suport DSOs in a way that fits into the normal build scheme 199(<TT>auto</TT>). 200If DSO support is <EM>explicitly enabled</EM> and there is no 201support for using DSOs in the expected way then DSOs are not used. 202 203<P> 204<DT><I>JPEG Support</I> 205<DD>The <TT>JPEG</TT> package enables support for the handling 206of TIFF images with JPEG-encoded data. 207Support for JPEG-encoded data requires the Independent JPEG Group (IJG) 208<TT>libjpeg</TT> distribution; this software is available at 209<A HREF=ftp://ftp.uu.net/graphics/jpeg/>ftp.uu.net:/graphics/jpeg/</A>. 210If JPEG support is enabled the <TT>DIRS_LIBINC</TT> and <TT>DIR_JPEGLIB</TT> 211parameters should also be set (see below). 212By default JPEG support is not configured. 213 214<P> 215<DT><I>ZIP Support</I> 216<DD>The <TT>ZIP</TT> support enables support for the handling 217of TIFF images with deflate-encoded data. 218Support for deflate-encoded data requires the freely available 219<TT>zlib</TT> distribution written by Jean-loup Gailly and Mark Adler; 220this software is available at 221<A HREF=ftp://ftp.uu.net/pub/archiving/zip/zlib/>ftp.uu.net:/pub/archiving/zip/zlib/</A> 222(or try <A HREF=ftp://quest.jpl.nasa.gov/beta/zlib/>quest.jpl.nasa.gov:/beta/zlib/</A>). 223If ZIP support is enabled the <TT>DIRS_LIBINC</TT> and <TT>DIR_GZLIB</TT> 224parameters should also be set (see below). 225By default this package is not configured. 226 227</DL> 228 229<A NAME="Sample"><P><HR WIDTH=65% ALIGN=right><H3>A Sample Configuration Session</H3></A> 230 231This section shows a sample configuration session and describes 232the work done. The session is shown indented in a <TT>fixed width 233font</TT> with user-supplied input in a <TT><B>bold font</B></TT>. 234Comments are shown in a normal or <I>italic</I> font. 235This session was collected on a 486 machine running BSDI 1.1. 236 237<UL><PRE><TT> 238wullbrandt% <B>mkdir tiff</B> 239wullbrandt% <B>cd tiff</B> 240wullbrandt% <B>ln -s /hosts/oxford/usr/people/sam/tiff src</B> 241</TT></PRE></UL> 242 243A build tree separate from the source tree is used here. 244In fact, in this case the distribution is accessed from 245a read-only NFS-mounted filesystem. 246 247<UL><PRE><TT> 248wullbrandt% <B>src/configure</B> 249Configuring TIFF Software v3.4beta015. 250 251Reading site-wide parameters from ../tiff-v3.4beta015/config.site. 252Reading local parameters from config.local. 253Gosh, aren't you lucky to have a i386-unknown-bsdi1.1 system! 254</TT></PRE></UL> 255 256Note that configure announces the distribution version and the 257deduced target configuration (<TT>i386-unknown-bsdi1.1</TT> here). 258 259<UL><PRE><TT> 260Using /usr/local/bin/gcc for a C compiler (set CC to override). 261Looks like /usr/local/bin/gcc supports the -g option. 262Using " -g" for C compiler options. 263</TT></PRE></UL> 264 265configure checked the normal shell search path for potential 266ANSI C compilers. The compiler is selected according to it properly 267compiling a small ANSI C test program. A specific compiler may be requested 268by setting the <TT>CC</TT> environment variable to the appropriate 269pathname, by supplying the parameter on the command line, e.g. 270<TT>-with-CC=gcc</TT>, or by setting <TT>CC</TT> in a configuration 271file. 272 273<P> 274<IMG SRC="images/info.gif" ALIGN=left HSPACE=10> 275<EM>Note that an ANSI C compiler is required to build the software. 276If a C compiler requires options to enable ANSI C compilation, they 277can be specified with the <TT>ENVOPTS</TT> parameter.</EM> 278 279<P> 280Once a compiler is selected configure checks to see 281if the compiler accepts a -g option to enable the generation 282 of debugging symbols, and 283if the compiler includes an ANSI C preprocessor. 284 285<UL><PRE><TT> 286Using /usr/ucb/make to configure the software. 287</TT></PRE></UL> 288 289Next various system-specific libraries that may or may not be needed 290are checked for (none are needed in this case). 291If your system requires a library that is not 292automatically included it can be specified by setting the 293<TT>MACHDEPLIBS</TT> parameter. 294 295<P><I>Creating port.h.</I> 296The <B>port.h</B> file is included by all the C code 297in the library (but not the tools). 298It includes definitions for functions and type 299definitions that are missing from system include files, <TT>#defines</TT> 300to enable or disable system-specific functionality, and other 301odds and ends. 302 303<UL><PRE><TT> 304Creating libtiff/port.h with necessary definitions. 305... using LSB2MSB bit order for your i386 cpu 306... using big-endian byte order for your i386 cpu 307... configure use of mmap for memory-mapped files 308... O_RDONLY is in <fcntl.h> 309... using double for promoted floating point parameters 310... enabling use of inline functions 311Done creating libtiff/port.h. 312</TT></PRE></UL> 313 314This file can take a long time to create so configure 315generates the file only when it is needed, either because the 316file does not exist or because a different target or compiler 317is to be used. 318Note that running "<TT>make distclean</TT>" in the top-level directory 319of the build tree will remove the <B>port.h</B> file (along 320with all the other files generated by configure). 321 322<P><I>Selecting emulated library functions.</I> 323Certain library functions used by the tools are not present on all systems 324and can be emulated using other system functionality. 325configure checks for the presence of such functions and if they are 326missing, will configure emulation code from the <B>port</B> directory 327to use instead. Building the TIFF 328software on unsupported systems may require 329adding to the code to the <B>port</B> directory. 330 331<UL><PRE><TT> 332Checking system libraries for functionality to emulate. 333Done checking system libraries. 334</TT></PRE></UL> 335 336If a routine must be emulated and configure does not automatically 337check for it, the routine name can be specified using the <TT>PORTFUNCS</TT> 338parameter. To add emulation support for a new function <TT>foo</TT>, 339create a file <B>port/foo.c</B> that contains the emulation code 340and then set <TT>PORTFUNCS=foo</TT> in a configuration file or modify 341the configure script to automatically check for the missing function. 342 343<UL><PRE><TT> 344Checking for Dynamic Shared Object (DSO) support. 345Done checking for DSO support. 346</TT></PRE></UL> 347 348If the <TT>DSO</TT> package is enabled (<TT>DSO=auto</TT> or 349<TT>DSO=yes</TT>), then 350configure will verify the system and compiler are capable of 351constructing SVR4-style DSO's in the expected way. Note that 352while a system may support DSO's the compiler may not be 353capable of generating the required position-independent 354code and/or the compiler may not pass the needed options 355through to the loader. 356 357<P><I>Selecting utility programs.</I> 358configure locates various system utility programs that are 359used during installation of the software. 360 361<UL><PRE><TT> 362Selecting programs used during installation. 363Looks like mv supports the -f option to force a move. 364Looks like /bin/ln supports the -s option to create a symbolic link. 365Done selecting programs. 366</TT></PRE></UL> 367 368<P><I>Selecting default configuration parameters.</I> 369The remainder of the work done by configure involves setting up 370configuration parameters that control the placement and 371setup of files during the installation procedure. 372 373<UL><PRE><TT> 374Selecting default TIFF configuration parameters. 375 376Looks like manual pages go in /usr/contrib/man. 377Looks like manual pages should be installed with bsd-nroff-gzip-0.gz. 378 379TIFF configuration parameters are: 380 381[ 1] Directory for tools: /usr/contrib/bin 382[ 2] Directory for libraries: /usr/contrib/lib 383[ 3] Directory for include files: /usr/contrib/include 384[ 4] Directory for manual pages: /usr/contrib/man 385[ 5] Manual page installation scheme: bsd-nroff-gzip-0.gz 386 387Are these ok [yes]? 388</TT></PRE></UL> 389 390 391 392At this point you can interactively modify any of the 393displayed parameters. Hitting a carriage return or typing 394<TT>yes</TT> will accept the current parameters. Typing one 395of the number displayed along the left hand side causes 396configure to prompt for a new value of the specified parameter. 397Typing anything else causes configure to prompt for a new 398value <EM>for each parameter</EM>. 399In general hitting carriage return will accept the current 400value and typing anything that is unacceptable will cause a 401help message to be displayed. 402A description of each of the configuration parameters is given below. 403 404<P> 405Once acceptable parameters are setup configure will generate 406all the files that depend on these parameters. Note that certain 407files may or may not be created based on the configuration of 408optional packages and/or the functions supported by target system. 409 410<UL><PRE><TT> 411Creating Makefile from ../tiff-v3.4beta015/Makefile.in 412Creating libtiff/Makefile from ../tiff-v3.4beta015/libtiff/Makefile.in 413Creating man/Makefile from ../tiff-v3.4beta015/man/Makefile.in 414Creating tools/Makefile from ../tiff-v3.4beta015/tools/Makefile.in 415Creating port/install.sh from ../tiff-v3.4beta015/port/install.sh.in 416Done. 417</TT></PRE></UL> 418 419<A NAME=DSOSupport><P><HR><H3>Shared Library Support</H3></A> 420 421It is desirable to make the TIFF library be a shared object 422on systems that have support for shared libraries. 423Unfortunately the rules to use to build a shared library 424vary between operating systems and even compilers. 425The distributed software includes support for building a shared 426version of the library on a number of different systems. 427This support is split between rules in the file 428<B>libtiff/Makefile.in</B> that construct the shared library 429and checks done by the <TT>configure</TT> script to verify that 430the expected rules are supported by compilation tools for 431the target system. 432 433<P> 434To add new support for building a shared library both these files 435must be updated. 436In the configure script search for the section where the autoconfiguration 437setting of the <TT>DSO</TT> parameter is handled and 438add a new case for the target system that sets the 439<TT>DSOSUF</TT>, 440<TT>DSOLD</TT>, 441<TT>DSOOPTS</TT>, 442and 443<TT>LIBCOPTS</TT> 444options as appropriate for the system. 445<TT>DSOSUF</TT> specifies the filename suffix used for the shared 446library (e.g. ``.so'' for Dynamic Shared Objects on most SVR4-based 447systems). 448<TT>DSOLD</TT> specifies the program to use to build the shared library 449from a compiled object file; typically ``${LD}'' though on some systems 450it is better to use the C compiler directly so system-dependent options and 451libraries are automatically supplied. 452<TT>DSOOPTS</TT> are options that must be specified to <TT>DSOLD</TT> 453when building the shared library. 454<TT>LIBCOPTS</TT> are options to pass to the C compiler when constructing 455a relocatable object file to include in a shared library; e.g. ``-K PIC'' 456on a Sun system. 457The <TT>DSO</TT> parameter must also be set to a unique label that identifies 458the target system and compilation tools. 459This label is used to select 460a target in <B>libtiff/Makefile.in</B> to do the actual work in building 461the shared library. 462Finally, to complete support for the shared library added the appropriate 463rules to <B>libtiff/Makefile.in</B> under the target specified in the 464<TT>configure</TT> script. 465 466 467 468 469<A NAME="Parameters"><P><HR WIDTH=65% ALIGN=right><H3>Configuration Parameters</H3></A> 470 471This section gives a brief description of the less obvious 472configuration parameters. Consult the distributed <B>config.site</B> 473for a <EM>complete list of parameters</EM>. 474The list here is sorted alphabetically. 475 476<P> 477<TABLE BORDER CELLPADDING=3> 478 479<TR> 480<TD VALIGN=top><TT>AROPTS</TT></TD> 481<TD>The options passed to ar when creating an archive. 482Note that configure will automatically check to see if ar 483supports an <TT>s</TT> to create a symbol table instead of 484using ranlib.</TD> 485</TR> 486 487<TR> 488<TD VALIGN=top><TT>DIR_BIN</TT></TD> 489<TD>The directory where client applications should be installed; by 490default this is <B>/usr/local/bin</B>.</TD> 491</TR> 492 493<TR> 494<TD VALIGN=top><TT>DIR_GZLIB</TT></TD> 495<TD>The pathname of the directory containing the zlib library 496(when ZIP or PixarLog compression support is enabled); 497e.g. ``<TT>../src/zlib</TT>''.</TD> 498</TR> 499 500<TR> 501<TD VALIGN=top><TT>DIR_JPEGLIB</TT></TD> 502<TD>The pathname of the directory containing the JPEG library 503(when JPEG support is enabled); e.g. ``<TT>/usr/local/lib</TT>''.</TD> 504</TR> 505 506<TR> 507<TD VALIGN=top><TT>DIR_LIB</TT></TD> 508<TD>The directory to install libraries and DSO's; by default 509this is <B>/usr/local/lib</B>.</TD> 510</TR> 511 512<TR> 513<TD VALIGN=top><TT>DIR_MAN</TT></TD> 514<TD>The top-most directory of the manual area where manual 515pages should be installed.</TD> 516</TR> 517 518<TR> 519<TD VALIGN=top><TT>DIRS_LIBINC</TT></TD> 520<TD>A space-separated list of directories in which to search for 521include files when building the library and tools. 522If JPEG or ZIP support is configured this parameter should include 523the directories where the associated include files are located.</TD> 524</TR> 525 526<TR> 527<TD VALIGN=top><TT>DIST_POINT</TT></TD> 528<TD>The most point release number for the distribution; e.g. if this 529is version 3.5.4 then the the point release number is 4.</TD> 530</TR> 531 532<TR> 533<TD VALIGN=top><TT>DIST_MAJOR</TT></TD> 534<TD>The major version number for the distribution; e.g. if this 535is version 3.5.4 then the the major number is 3.</TD> 536</TR> 537 538<TR> 539<TD VALIGN=top><TT>DIST_MINOR</TT></TD> 540<TD>The minor version number for the distribution; e.g. if this 541is version 3.5.4 then the the major number is 5.</TD> 542</TR> 543 544<TR> 545<TD VALIGN=top><TT>DSOSUF</TT></TD> 546<TD>When DSO's are built, the filename suffix for a DSO. 547If this is set to <TT>"a"</TT> then statically linked archives are used.</TD> 548</TR> 549 550<TR> 551<TD VALIGN=top><TT>DSOSUF_VERSION</TT></TD> 552<TD>When DSO's are built, a version-specific filename suffix for a DSO. 553If this is set to something other than the value of <TT>DSO</TT> then 554the file <B>libtiff.<TT>DSOSUF_VERSION</TT></B> will be installed and 555a link to it named <B>libtiff.<TT>DSOSUF</TT></B> will automatically 556be created. (Note that this means that rule for building the target 557DSO must generate a file named <B>libtiff.<TT>DSOSUF_VERSION</TT></B>.)</TD> 558</TR> 559 560<TR> 561<TD VALIGN=top><TT>ENVOPTS</TT></TD> 562<TD>Options to pass to <TT>CC</TT> to force ANSI C compilation.</TD> 563</TR> 564 565<TR> 566<TD VALIGN=top><TT>FILLORDER</TT></TD> 567<TD>The order of bits in a byte on the server machine; 568either LSB2MSB or MSB2LSB. 569This is normally selected according to the target system.</TD> 570</TR> 571 572<TR> 573<TD VALIGN=top><TT>GCOPTS</TT></TD> 574<TD>Special options to pass the C compiler. If this parameter 575is set, then configure may append other options to this list.</TD> 576</TR> 577 578<TR> 579<TD VALIGN=top><TT>INSTALL</TT></TD> 580<TD>The pathname of the install program to use. Note that this program 581must emulate the command line interface used by the IRIX install program.</TD> 582</TR> 583 584<TR> 585<TD VALIGN=top><TT>LIBPORT</TT></TD> 586<TD>The pathname of the library that holds code to emulate missing 587system functionality. 588Normally this parameter is set by configure based on whether or 589not emulation code is required for the target. 590</TR> 591 592<TR> 593<TD VALIGN=top><TT>LLDOPTS</TT> 594<TD>Extra command line options passed to <TT>CC</TT> 595when linking an executable. 596This option is usually set only when DSO support is enabled 597(to force the executable to search for the TIFF DSO 598in non-standard locations in the filesystem.)</TD> 599</TR> 600 601<TR> 602<TD VALIGN=top><TT>MACHDEPLIBS</TT></TD> 603<TD>Target-dependent libraries that should be used when linking 604tools. 605Note that if this parameter is specified configure will append to 606the list of libraries.</TD> 607</TR> 608 609<TR> 610<TD VALIGN=top><TT>MANSCHEME</TT></TD> 611<TD>The scheme to use when preparing and installing manual pages. 612Schemes are constructed according to: 613<UL> 614<<I>organization</I>>-<<I>formatting</I>>-<<I>compression</I>>[-<<I>suffix</I>>] 615</UL> 616where: 617<<I>organization</I>> is either <TT>bsd</TT> 618for BSD-style section organization (e.g. file formats in 619section 5) or <TT>sysv</TT> for System V-style 620organization (e.g. file formats in section 4). 621<<I>formatting</I>> is either <TT>nroff</TT> to force 622installation of formatted materials (using nroff) or 623<TT>source</TT> to get the nroff source installed. 624<<I>compression</I>> is either the name of a program 625to compress the manual pages (gipz, compress, pack) or 626<TT>cat</TT> for uncompressed data. 627<<I>suffix</I>> is either the file suffix to convert 628installed pages to (e.g. 0.gz for gzip-compressed pages under BSD) 629or <TT>strip</TT> to force the normal ".4f" suffix to be converted to ".4" 630(or ".5" if using the BSD organization). If no -<suffix> 631is specified then filenames are not converted when they are installed.</TD> 632</TR> 633 634<TR> 635<TD VALIGN=top><TT>PORTFUNCS</TT></TD> 636<TD>A list of non-standard functions that should be emulated. 637Normally this list is constructed by configure based on checks it does. 638If this parameter is set, configure will append to the specified list.</TD> 639</TR> 640 641<TR> 642<TD VALIGN=top><TT>SETMAKE</TT></TD> 643<TD>If make does not automatically set <TT>$MAKE</TT> to 644the name of the make program to invoke for subdirectories, then 645configure will create an explicit definition. 646If this parameter is set, then it will be used instead. 647by default <TT>bin</TT> is used.</TD> 648</TR> 649 650</TABLE> 651 652 653<A NAME=PC><P><HR><H2>Building the Software under Windows 95/98/NT/2000 with MS VC++</H2></A> 654 655With Microsoft Visual C++ installed, and properly configured for commandline 656use (you will likely need to source VCVARS32.BAT in AUTOEXEC.bAT or somewhere 657similar) you should be able to use the provided <tt>makefile.vc</tt>.<p> 658 659<pre> 660C:\LIBTIFF\LIBTIFF> nmake /f makefile.vc 661C:\LIBTIFF\LIBTIFF> cd ..\tools 662C:\LIBTIFF\TOOLS> nmake /f makefile.vc 663</pre> 664 665This will build the library file <tt>LIBTIFF\LIBTIFF\LIBTIFF.LIB</tt>. This 666can be used in Win32 programs. If used in a project using the /MD compiler 667switch (using the runtime C library), it may be necessary to modify the 668CFLAGS macro in makefile.vc to correspond.<p> 669 670The makefile also builds a DLL (libtiff.dll) with an associated import 671library (libtiff_i.lib). Any builds using libtiff will need to include 672the LIBTIFF\LIBTIFF directory in the include path.<p> 673 674The <tt>libtiff\tools\makefile.vc</tt> should build .exe's for all the 675standard TIFF tool programs.<p> 676 677NOTE: The contents of the contrib/win32 directory should no longer be 678needed, and are kept in the distribution temporarily.<p> 679 680<A NAME=DJGPP><P><HR><H2>Building the Software under MS/DOS with the DJGPP v2 compiler</H2></A> 681 682[<I>From the file <B>contrib/dosdjgpp/README</B>.</I>] 683 684<P> 685The directory <B>contrib/dosdjgpp</B> 686contains the files necessary to build the library and tools 687with the DJGPP v2 compiler under MSDOS. 688 689<P> 690All you have to do is copy the files in the directory 691into the respective directories and run 692make. If you want, you can use the <B>conf.bat</B> script 693to do that for you, make sure that 694the file is stored with MSDOS text EOL-convention (CR/LF), otherwise the 695<B>command.com</B> will not do anything. 696 697<P> 698Note that you probably will not be able to build the library with the v1.x 699versions of djgpp, due to two problems. First, the top makefile calls a 700sub-make for each directory and you are likely to run out of memory, since 701each recursive invocation of a djgpp v1.x program requires about 130k, to 702avoid that, you can enter the directories manually and call make (well, there 703are only two dirs). The 2nd problem is that djgpp 1.x doesn't call the 704coff2exe (stubify) program when creating an executable. This means that all 705programs compiled are not converted to exe and consequently are not available 706for calling directly. For the tools directory, you can just call coff2exe for 707each program after make finishes, but in the libtiff directory, a few programs 708are created during the make process that have to be called for make to 709continue (e.g. mkg3states). Make will probably report an error at each 710such stage. To fix that, either add a coff2exe call before each program is 711called or call coff2exe manually and rerun make (there 2-3 such programs). 712 713 714<A NAME=MacMPW><P><HR><H2>Building the Software on a Macintosh with MPW</H2></A> 715 716The directory <B>contrib/mac-mpw</B> contains support for 717compiling the library and tools under the MPW Shell on a 718Macintosh system. 719This support was contributed by Niles Ritter 720(<A HREF=mailto:[email protected]>[email protected]</A>). 721 722<P> 723[<I>From the file <B>contrib/mac-mpw/README</B>.</I>] 724 725<P> 726This directory contains all of the utilities and makefile source 727to build the LIBTIFF library and tools from the MPW Shell. The 728file BUILD.mpw in this directory is an executable script 729which uses all of these files to create the MPW makefiles and 730run them. 731 732<P> 733The <file>.make files are not MPW makefiles as such, 734but are when run through the "mactrans" program, which turns 735the ascii "%nn" metacharacters into the standard weird MPW 736make characters. 737 738<P> 739This translation trick is necessary to protect the files when 740they are put into unix tarfiles, which tend to mangle the 741special characters. 742 743 744 745<A NAME=MacCW><P><HR><H2>Building the Software on a Macintosh with CodeWarrior</H2></A> 746 747The directory <B>contrib/mac-cw</B> contains support for 748compiling the library and tools with MetroWerks CodeWarrior 6.1 749on a Macintosh system. 750This support was contributed by Niles Ritter 751(<A HREF=mailto:[email protected]>[email protected]</A>). 752 753<P> 754[<I>From the file <B>contrib/mac-cw/README</B>.</I>] 755 756In this directory you will find a Makefile.script Applescript 757file, which should be run in order to build the libtiff code 758using MetroWerks CodeWarrior. 759 760Refer to the "metrowerks.note" instructions on building the 761library for 68k and PowerPC native code, as well as building 762some of the libtiff tools, which are rather unix-like, but 763at least give an example of how to link everything together. 764 765 766 767<A NAME=VMS><P><HR><H2>Building the Software on a VMS System</H2></A> 768 769The VMS port was done by Karsten Spang 770(<A HREF="mailto:[email protected]">[email protected]</a>), who also 771"sort of" maintains it. 772The VMS specific files are not in the main directories. Instead they 773are placed under <TT>[.CONTRIB.VMS...]</TT> in the distribution tree. 774 775Installation: 776 777It is assumed that you have unpacked the tar file into a VMS directory 778tree, in this text called DISK:[TIFF]. 779 780<OL> 781<LI>Move the VMS specific files to their proper directories. 782<PRE> 783$ SET DEFAULT DISK:[TIFF.CONTRIB.VMS] 784$ RENAME [.LIBTIFF]*.* [-.-.LIBTIFF] 785$ RENAME [.TOOLS]*.* [-.-.TOOLS] 786</PRE> 787<LI>Compile the library. 788<PRE> 789$ SET DEFAULT DISK:[TIFF.LIBTIFF] 790$ @MAKEVMS 791</PRE> 792<LI>Compile the tools. 793<PRE> 794$ SET DEFAULT DISK:[TIFF.TOOLS] 795$ @MAKEVMS 796</PRE> 797<LI>Define the programs. 798<PRE> 799$ DEFINE TIFFSHR DISK:[TIFF.LIBTIFF]TIFFSHR 800$ FAX2PS :==$DISK:[TIFF.TOOLS]FAX2PS 801$ FAX2TIFF :==$DISK:[TIFF.TOOLS]FAX2TIFF 802$ GIF2TIFF :==$DISK:[TIFF.TOOLS]GIF2TIFF 803$ PAL2RGB :==$DISK:[TIFF.TOOLS]PAL2RGB 804$ PPM2TIFF :==$DISK:[TIFF.TOOLS]PPM2TIFF 805$ RAS2TIFF :==$DISK:[TIFF.TOOLS]RAS2TIFF 806$ RGB2YCBCR :==$DISK:[TIFF.TOOLS]RGB2YCBCR 807$ THUMBNAIL :==$DISK:[TIFF.TOOLS]THUMBNAIL 808$ TIFF2BW :==$DISK:[TIFF.TOOLS]TIFF2BW 809$ TIFF2PS :==$DISK:[TIFF.TOOLS]TIFF2PS 810$ TIFFCMP :==$DISK:[TIFF.TOOLS]TIFFCMP 811$ TIFFCP :==$DISK:[TIFF.TOOLS]TIFFCP 812$ TIFFDITHER:==$DISK:[TIFF.TOOLS]TIFFDITHER 813$ TIFFDUMP :==$DISK:[TIFF.TOOLS]TIFFDUMP 814$ TIFFINFO :==$DISK:[TIFF.TOOLS]TIFFINFO 815$ TIFFMEDIAN:==$DISK:[TIFF.TOOLS]TIFFMEDIAN 816$ TIFFSPLIT :==$DISK:[TIFF.TOOLS]TIFFSPLIT 817$ YCBCR :==$DISK:[TIFF.TOOLS]YCBCR 818</PRE> 819</OL> 820 821You will want to add these lines to your <TT>LOGIN.COM</TT> file, after 822changing the name of the directory that you have used on your machine. 823 824<P> 825This release has been tested on OpenVMS/VAX 5.5-2, using VAX C 3.2. 826A previous release was tested under OpenVMS/AXP ?.? using DEC C ?.?, it is 827believed that this release as well works on AXP. 828The code contains some GNU C specific things. This does *not* imply, 829however, that the VAX/GCC configuration has been tested, *it has not*. 830 831<P> 832The command procedures (<TT>MAKEVMS.COM</TT>) for building the 833library and tools, 834is believed to choose the correct options for the VAX and AXP cases 835automatically. 836 837<P> 838On the AXP, IEEE floating point is used by default. If you want VAX 839floating point, remove the <TT>/FLOAT=IEEE_FLOAT</TT> qualifier, and change 840<TT>HAVE_IEEEFP=1</TT> to <TT>HAVE_IEEEFP=0</TT> in the <TT>MAKEVMS.COM</TT> 841files in both the <B>libtiff</B> and <B>tools</B> directories. 842 843 844<H3>Compiling your own program on a VMS system:</H3> 845 846When compiling a source file in which you 847<TT>"#include <tiffio.h>"</TT>, use the 848following command 849<PRE> 850 $ CC/INCLUDE=DISK:[TIFF.LIBTIFF] 851</PRE> 852This ensures that the header file is found. 853On the AXP, also add <TT>/FLOAT=IEEE_FLOAT</TT> 854(if used when building the library). 855 856 857<H3>Linking your own program to the TIFF library on a VMS system:</H3> 858 859You can link to the library in two ways: Either using the shareable 860library, or using the object library. 861On the VAX these possibilities are: 862 863<OL> 864<LI>Using the shareable TIFF library. 865<PRE> 866$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/OPTIONS,SYS$INPUT:/OPTIONS 867 SYS$SHARE:VAXCRTL/SHAREABLE 868</PRE> 869<LI>Using the TIFF object library. 870<PRE> 871$ LINK MY_PROGRAM, - 872 DISK:[TIFF.LIBTIFF]TIFF/LIBRARY/INCLUDE=(TIF_FAX3SM,TIF_CODEC), - 873 SYS$INPUT:/OPTIONS 874 SYS$SHARE:VAXCRTL/SHAREABLE 875</PRE> 876</OL> 877 878On AXP (and possibly also using DEC C on VAX) the corresponding commands are 879<OL> 880<LI>Using the shareable TIFF library. 881<PRE> 882$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/OPTIONS 883</PRE> 884<LI>Using the TIFF object library. 885<PRE> 886$ LINK MY_PROGRAM,DISK:[TIFF.LIBTIFF]TIFF/LIBRARY 887</PRE> 888</OL> 889 890Method 1 uses the shortest link time and smallest <TT>.EXE</TT> 891files, but it 892requires that <TT>TIFFSHR</TT> is defined as above at link time and 893<STRONG>at run time</STRONG>. 894Using the compilation procedure above, the tools are linked in this way. 895 896<P> 897Method 2 gives somewhat longer link time and larger <TT>.EXE</TT> 898files, but does 899not require <TT>TIFFSHR</TT> to be defined. This method is recommended if you 900want to run your program on another machine, and for some reason don't 901want to have the library on that machine. If you plan to have more than 902one program (including the tools) on the machine, it is recommended that 903you copy the library to the other machine and use method 1. 904 905 906 907<A NAME=Acorn><P><HR><H2>Building the Software on an Acorn RISC OS system</H2></A> 908 909The directory <B>contrib/acorn</B> contains support for compiling the library 910under Acorn C/C++ under Acorn's RISC OS 3.10 or above. Subsequent pathnames 911will use the Acorn format: The full-stop or period character is a pathname 912delimeter, and the slash character is not interpreted; the reverse position 913from Unix. Thus "libtiff/tif_acorn.c" becomes "libtiff.tif_acorn/c". 914 915<P> 916This support was contributed by Peter Greenham. (<A HREF=mailto:[email protected]>[email protected]</A>). 917 918<P> 919<H3>Installing LibTIFF:</H3> 920 921<P> 922LIBTIFF uses several files which have names longer than the normal RISC OS 923maximum of ten characters. This complicates matters. Maybe one day Acorn will 924address the problem and implement long filenames properly. Until then this 925gets messy, especially as I'm trying to do this with obeyfiles and not have 926to include binaries in this distribution. 927 928<P> 929First of all, ensure you have Truncate configured on (type <TT>*Configure 930Truncate On</TT>) 931 932<P> 933Although it is, of course, preferable to have long filenames, LIBTIFF can be 934installed with short filenames, and it will compile and link without 935problems. However, <I>getting</I> it there is more problematic. 936<B>contrib.acorn.install</B> is an installation obeyfile which will create a normal 937Acorn-style library from the source (ie: with c, h and o folders etc.), but 938needs the distribution library to have been unpacked into a location which is 939capable of supporting long filenames, even if only temporarily. 940 941<P> 942My recommendation, until Acorn address this problem properly, is to use Jason 943Tribbeck's <A 944HREF=ftp://ftp.demon.co.uk/pub/mirrors/hensa/micros/arch/riscos/c/c020/longfiles.arc>LongFilenames</A>, or any other 945working system that gives you long filenames, like a nearby NFS server for 946instance. 947 948<P> 949If you are using Longfilenames, even if only temporarily to install LIBTIFF, 950unpack the TAR into a RAMDisc which has been longfilenamed (ie: <TT>*addlongfs 951ram</TT>) and then install from there to the hard disk. Unfortunately 952Longfilenames seems a bit unhappy about copying a bunch of long-named files 953across the same filing system, but is happy going between systems. You'll 954need to create a ramdisk of about 2Mb. 955 956<P> 957Now you can run the installation script I've supplied (in contrib.acorn), 958which will automate the process of installing LIBTIFF as an Acorn-style 959library. The syntax is as follows: 960 961<P><TT> 962install <source_dir> <dest_dir> 963 964</TT><P> 965Install will then create <dest_dir> and put the library in there. For 966example, having used LongFilenames on the RAMDisk and unpacked the library 967into there, you can then type: 968 969<P><TT> 970Obey RAM::RamDisc0.$.contrib.acorn.install RAM::RamDisc0.$ ADFS::4.$.LIBTIFF 971</TT><P> 972 973It doesn't matter if the destination location can cope with long filenames or 974not. The filenames will be truncated if necessary (*Configure Truncate On if 975you get errors) and all will be well. 976 977<P> 978<H3>Compiling LibTIFF:</H3> 979 980<P> 981Once the LibTIFF folder has been created and the files put inside, making the 982library should be just a matter of running '<B>SetVars</B>' to set the 983appropriate system variables, then running '<B>Makefile</B>'. 984 985<P> 986<B>OSLib</B> 987 988<P> 989<A HREF=ftp://ftp.acorn.co.uk/pub/riscos/releases/oslib/oslib.arc>OSLib</A> 990is a comprehensive API for RISC OS machines, written by Jonathan Coxhead of 991Acorn Computers (although OSLib is not an official Acorn product). Using the 992OSLib SWI veneers produces code which is more compact and more efficient than 993code written using _kernel_swi or _swi. The Acorn port of LibTIFF can take 994advantage of this if present. Edit the Makefile and go to the Static 995dependencies section. The first entry is: 996 997<PRE> 998# Static dependencies: 999@.o.tif_acorn: @.c.tif_acorn 1000 cc $(ccflags) -o @.o.tif_acorn @.c.tif_acorn 1001</PRE> 1002<P> 1003Change the cc line to: 1004<PRE> 1005 cc $(ccflags) -DINCLUDE_OSLIB -o @.o.tif_acorn @.c.tif_acorn 1006</PRE> 1007<P> 1008Remember, however, that OSLib is only <I>recommended</I> for efficiency's 1009sake. It is not required. 1010 1011 1012 1013<A NAME=Other><P><HR><H2>Building the Software on Other Systems</H2></A> 1014 1015This section contains information that might be useful 1016if you are working on a non-UNIX system that is not directly supported. 1017All library-related files described below are located in the <B>libtiff</B> 1018directory. 1019 1020<P> 1021The library requires two files that are generated <I>on-the-fly</I>. 1022The file <B>tif_fax3sm.c</B> has the state tables for the 1023Group 3 and Group 4 decoders. 1024This file is generated by the <TT>mkg3states</TT> program 1025on a UNIX system; for example, 1026 1027<UL><PRE><TT> 1028cd libtiff 1029cc -o mkg3states mkg3states.c 1030rm -f tif_fax3sm.c 1031./mkg3states -c const tif_fax3sm.c 1032</TT></PRE></UL> 1033 1034The <TT>-c</TT> option can be used to control whether or not the 1035resutling tables are generated with a <TT>const</TT> declaration. 1036The <TT>-s</TT> option can be used to specify a C storage class 1037for the table declarations. 1038The <TT>-b</TT> option can be used to force data values to be 1039explicitly bracketed with ``{}'' (apparently needed for some 1040MS-Windows compilers); otherwise the structures are emitted in 1041as compact a format as possible. 1042Consult the source code for this program if you have questions. 1043 1044<P> 1045The second file required to build the library, <B>version.h</B>, 1046contains the version 1047information returned by the <TT>TIFFGetVersion</TT> routine. 1048This file is built on most systems using the 1049<TT>mkversion</TT> program and the contents of the 1050<TT>VERSION</TT> and <TT>tiff.alpha</TT> files; for example, 1051 1052<UL><PRE> 1053cd libtiff 1054cc -o mkversion mkversion.c 1055rm -f version.h 1056./mkversion -v ../VERSION -a ../dist/tiff.alpha version.h 1057</PRE></UL> 1058 1059<P> 1060Otherwise, when building the library on a non-UNIX system be sure to 1061consult the files <B>tiffcomp.h</B> and <B>tiffconf.h</B>. 1062The former contains system compatibility definitions while the latter 1063is provided so that the software configuration can be controlled 1064on systems that do not support the make facility for building 1065the software. 1066 1067<P> 1068Systems without a 32-bit compiler may not be able to handle some 1069of the codecs in the library; especially the Group 3 and 4 decoder. 1070If you encounter problems try disabling support for a particular 1071codec; consult the <A HREF=internals.html#Config>documentation</A>. 1072 1073<P> 1074Programs in the tools directory are written to assume an ANSI C 1075compilation environment. 1076There may be a few POSIX'isms as well. 1077The code in the <B>port</B> directory is provided to emulate routines 1078that may be missing on some systems. 1079On UNIX systems the <TT>configure</TT> script automatically figures 1080out which routines are not present on a system and enables the use 1081of the equivalent emulation routines from the <B>port</B> directory. 1082It may be necessary to manually do this work on a non-UNIX system. 1083 1084 1085<A NAME=Testing><P><HR><H2>Checking out the Software</H2></A> 1086 1087<P> 1088Assuming you have working versions of <TT>tiffgt</TT> and <TT>tiffsv</TT>, 1089you can just 1090use them to view any of the sample images available for testing 1091(see the <A HREF=images.html>section on obtaining the test images</A>). 1092Otherwise, you can do a cursory check of the library with 1093the <TT>tiffcp</TT> and <TT>tiffcmp</TT> programs. For example, 1094 1095<UL><PRE> 1096tiffcp -lzw cramps.tif x.tif 1097tiffcmp cramps.tif x.tif 1098</PRE></UL> 1099 1100<P> 1101(<TT>tiffcmp</TT> should be silent if the files compare correctly). 1102 1103 1104 1105<A NAME=TOC><P><HR><H2>Table of Contents</H2></A> 1106 1107The following files makup the core library: 1108 1109<PRE> 1110libtiff/tiff.h TIFF spec definitions 1111libtiff/tiffcomp.h non-UNIX OS-compatibility definitions 1112libtiff/tiffconf.h non-UNIX configuration definitions 1113libtiff/tiffio.h public TIFF library definitions 1114libtiff/tiffiop.h private TIFF library definitions 1115libtiff/t4.h CCITT Group 3/4 code tables+definitions 1116libtiff/tif_dir.h private defs for TIFF directory handling 1117libtiff/tif_fax3.h CCITT Group 3/4-related definitions 1118libtiff/tif_predict.h private defs for Predictor tag support 1119libtiff/uvcode.h LogL/LogLuv codec-specific definitions 1120libtiff/version.h version string (generated by Makefile) 1121 1122libtiff/tif_acorn.c Acorn-related OS support 1123libtiff/tif_apple.c Apple-related OS support 1124libtiff/tif_atari.c Atari-related OS support 1125libtiff/tif_aux.c auxilary directory-related functions 1126libtiff/tif_close.c close an open TIFF file 1127libtiff/tif_codec.c configuration table of builtin codecs 1128libtiff/tif_compress.c compression scheme support 1129libtiff/tif_dir.c directory tag interface code 1130libtiff/tif_dirinfo.c directory known tag support code 1131libtiff/tif_dirread.c directory reading code 1132libtiff/tif_dirwrite.c directory writing code 1133libtiff/tif_dumpmode.c "no" compression codec 1134libtiff/tif_error.c library error handler 1135libtiff/tif_fax3.c CCITT Group 3 and 4 codec 1136libtiff/tif_fax3sm.c G3/G4 state tables (generated by mkg3states) 1137libtiff/tif_flush.c i/o and directory state flushing 1138libtiff/tif_getimage.c TIFFRGBAImage support 1139libtiff/tif_jpeg.c JPEG codec (interface to the IJG distribution) 1140libtiff/tif_luv.c SGI LogL/LogLuv codec 1141libtiff/tif_lzw.c LZW codec 1142libtiff/tif_msdos.c MSDOS-related OS support 1143libtiff/tif_next.c NeXT 2-bit scheme codec (decoding only) 1144libtiff/tif_open.c open and simply query code 1145libtiff/tif_packbits.c Packbits codec 1146libtiff/tif_pixarlog.c Pixar codec 1147libtiff/tif_predict.c Predictor tag support 1148libtiff/tif_print.c directory printing support 1149libtiff/tif_read.c image data reading support 1150libtiff/tif_strip.c some strip-related code 1151libtiff/tif_swab.c byte and bit swapping support 1152libtiff/tif_thunder.c Thunderscan codec (decoding only) 1153libtiff/tif_tile.c some tile-related code 1154libtiff/tif_unix.c UNIX-related OS support 1155libtiff/tif_version.c library version support 1156libtiff/tif_vms.c VMS-related OS support 1157libtiff/tif_warning.c library warning handler 1158libtiff/tif_win3.c Windows-3.1-related OS support 1159libtiff/tif_win32.c Win32 (95/98/NT) related OS support 1160libtiff/tif_write.c image data writing support 1161libtiff/tif_zip.c Deflate codec 1162 1163libtiff/mkg3states.c program to generate G3/G4 decoder state tables 1164libtiff/mkspans.c program to generate black-white span tables 1165libtiff/mkversion.c program to generate libtiff/version.h. 1166</PRE> 1167 1168<P> 1169<HR> 1170 1171Last updated: $Date: 2003-10-29 10:12:32 $ 1172 1173</BODY> 1174</HTML> 1175