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