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