386BSD 0.1 development
[unix-history] / usr / othersrc / public / ghostscript-2.4.1 / make.doc
CommitLineData
7e21d4fd
WJ
1 Copyright (C) 1989, 1990, 1991 Aladdin Enterprises. All rights reserved.
2 Distributed by Free Software Foundation, Inc.
3
4This file is part of Ghostscript.
5
6Ghostscript is distributed in the hope that it will be useful, but
7WITHOUT ANY WARRANTY. No author or distributor accepts responsibility
8to anyone for the consequences of using it or for whether it serves any
9particular purpose or works at all, unless he says so in writing. Refer
10to the Ghostscript General Public License for full details.
11
12Everyone is granted permission to copy, modify and redistribute
13Ghostscript, but only under the conditions described in the Ghostscript
14General Public License. A copy of this license is supposed to have been
15given to you along with Ghostscript so you can know your rights and
16responsibilities. It should be in a file named COPYING. Among other
17things, the copyright notice and this notice must be preserved on all
18copies.
19
20- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21
22This file, make.doc, describes how to install Ghostscript, and how to
23build Ghostscript executables from source.
24
25For an overview of Ghostscript and a list of the documentation files, see
26README.
27
28********
29******** Installing Ghostscript
30********
31
32To install the interpreter, you need:
33 - The interpreter executable:
34 - On MS-DOS and VMS systems, gs.exe.
35 - On MS-DOS systems, if you are using the Watcom compiler,
36 the DOS extender, dos4gw.exe.
37 - On Unix systems, gs.
38 - The interpreter initialization files: gs_*.ps and sym__enc.ps.
39 - The font map: Fontmap.
40 - The default font: uglyr.gsf.
41
42See use.doc for a description of the search algorithm used to find these
43files.
44
45You do not need any of these files when using the library; however, the
46library currently provides no way to install fonts. This is obviously
47ridiculous and will be fixed sometime in the future.
48
49********
50******** Building Ghostscript from source
51********
52
53Ghostscript is generally distributed in the form of a compressed tar file.
54When unpacked, this file puts all the Ghostscript files in a directory
55called gs. Ghostscript is also available in the form of PC-compatible ZIP
56files.
57
58Ghostscript is described by a collection of several makefiles:
59
60 gs.mak - a generic makefile used on all platforms (except VMS).
61 devs.mak - a makefile listing all the device drivers.
62 *.mak - the makefiles for specific platforms.
63
64You may need to edit the platform-specific makefile if you wish to change
65any of the following options:
66
67 - The default search path(s) for the initialization and font files
68(macro GS_LIB_DEFAULT);
69
70 - The debugging options (macro TDEBUG);
71
72 - The set of device drivers to be included (DEVICE_DEVS
73 and DEVICE_DEVS2..5 macros);
74
75 - The set of optional features to be included (FEATURE_DEVS macro).
76
77The platform-specific makefile will include comments describing all of
78these items except the DEVICE_DEVS options. The DEVICE_DEVS options are
79described in devs.mak, even though the file that must be edited is the
80platform-specific makefile.
81
82The makefiles distributed with Ghostscript define these options as
83follows:
84
85 - GS_LIB_DEFAULT: on Unix systems, the current directory at build
86time; on MS-DOS systems, C:\GS.
87
88 - TDEBUG: no debugging code included in the build.
89
90 - DEVICE_DEVS: platform-specific, see below.
91
92 - FEATURE_DEVS: platform-specific.
93
94There are also platform-specific options described below under the
95individual platforms. See the "Options" section near the beginning of the
96relevant makefile for more information.
97
98If you are including a dot-matrix printer driver, you may wish to
99customize the default resolution parameters in devs.mak.
100
101To build the interpreter, you need all the .h and .c files (and .asm files
102for MS-DOS) included in the distribution, as well as the makefiles.
103
104The command
105 make clean
106removes all the files created by the build process (relocatables,
107executables, and miscellaneous scratch files). If you want to save the
108executable, you should move it to another directory first.
109
110********
111******** How to build Ghostscript from source (MS-DOS version) ********
112********
113
114The makefiles distributed with Ghostscript select the following
115devices for inclusion in the executable:
116
117 Turbo C:
118 VGA and EGA displays
119 Epson-compatible dot matrix printers
120 (default resolution 180 x 180 DPI)
121 Canon BJ-10e (BubbleJet) printer
122 (default resolution 360 x 360 DPI)
123 Borland C++: all of the above, plus:
124 H-P DeskJet and LaserJet family printers
125 (default resolution 300 DPI)
126 GIF file format
127 Watcom C/386: all of the above, plus:
128 (partial) Display PostScript and PostScript Level 2 features
129 Tseng ET3000/ET4000 SuperVGA displays
130 H-P PaintJet printer
131 PBM/PGM/PPM file formats
132 PCX file format
133
134These options were chosen to strike a balance between RAM consumption and
135likely usefulness. (Turbo C is limited to 640K and does not support code
136overlaying; Borland C++ is limited to 640K, but supports code overlaying;
137Watcom C/386 is not limited to 640K.)
138
139To build Ghostscript, you need MS-DOS version 3.3 or later, and a Borland
140C/C++ development system or the Watcom C/386 development system. Details
141are given below.
142
143As noted above, the default configuration generates an executable that
144assumes the directory where 'make' was run should be the final default
145directory for looking up the Ghostscript initialization and font files.
146
147To build the Ghostscript executable, all you need to do is give the
148command
149 make
150You must have COMMAND.COM in your path to build Ghostscript.
151
152There is a special 'make' target that simply attempts to compile all the
153.c files in the current directory. Some of these compilations will fail,
154but the ones that succeed will go considerably faster, because they don't
155individually pay the overhead of loading the compiler into memory. So a
156good strategy for building the executable for the first time, or after a
157change to a very widely used .h file, is:
158 make begin
159and then
160 make
161to do the compilations that failed the first time.
162
163Note: if you get the Ghostscript sources from a Unix 'tar' file and unpack
164the file on a MS-DOS machine, the files will all have linefeed instead of
165carriage return + linefeed as the line terminator, which will make the C
166compiler unhappy. I don't know the simplest way to fix this: just reading
167each file into an editor and writing it back out again may be sufficient.
168
169Borland environment
170-------------------
171
172To compile Ghostscript with the Borland environment, you need either Turbo
173C (version 2.0 or later) or Turbo C++ or Borland C++ (version 1.0 or
174later); specifically, the compiler, 'make' utility, and linker. You also
175need either the Borland assembler (version 1.0 or later) or the Microsoft
176assembler (version 4.0 or later). Before compiling or linking, you should
177execute
178
179 echo !include "turboc.mak" >makefile
180(for Turbo C), or
181 echo !include "tbcplus.mak" >makefile
182(for Turbo C++ or Borland C++).
183
184Besides the source files and the makefiles, you need:
185 turboc.cfg (the flags and switches for Turbo C)
186 gt.tr (the linker commands for the library test program - optional)
187 gs.tr (the linker commands for the interpreter)
188 *.bat (a variety of batch files used in the build process)
189
190There are extensive comments in the turboc.mak and tbcplus.mak files
191regarding various configuration parameters. If your configuration is
192different from the following, you should definitely read those comments
193and see if you want or need to change any of the parameters:
194 - The compiler files are in c:\tc (for Turbo C) or c:\bc (for
195Turbo C++ or Borland C++) and its subdirectories.
196 - You are using the Borland assembler (tasm).
197 - You want an executable that will run on any PC-compatible,
198regardless of processor type (8088, 8086, V20, 80186, 80286, V30, 80386,
19980486) and regardless of whether a math coprocessor (80x87) is present.
200
201Watcom environment
202------------------
203
204To avoid annoying messages from the DOS extender, add the line
205 set DOS4G=quiet
206to your autoexec.bat file.
207
208To compile Ghostscript with the Watcom C/386 compiler, you need to create
209a makefile by executing
210
211 echo !include watc.mak >makefile
212
213To build Ghostscript, execute
214
215 wmake -u
216
217********
218******** How to build Ghostscript from source (Unix version) ********
219********
220
221The makefile distributed with Ghostscript selects the following devices
222for inclusion in the build:
223 X Windows driver only.
224
225Before compiling or linking, you should execute
226
227 ln -s unix-cc.mak makefile
228or ln -s unix-gcc.mak makefile
229or ln -s unix-ansi.mak makefile
230
231depending on whether your C compiler is a standard Kernighan & Ritchie C
232compiler, gcc being used in ANSI mode, or an ANSI C compiler other than
233gcc respectively. (If you want to use gcc in non-ANSI mode, use
234unix-cc.mak and define the CC macro to refer to gcc.)
235
236If the X11 client header files are located in some directory which your
237compiler does not automatically search, you must change the XINCLUDE macro
238the makefile to include a specific -I switch. See the comment preceding
239XINCLUDE in the makefile.
240
241The only important customization of the X11 driver is the choice of
242whether or not to use a backing pixmap. If you use a backing pixmap,
243Ghostscript windows will redisplay properly when they are covered and
244exposed, but drawing operations will go slower. This choice is controlled
245by a line in the file gdevx.c that says
246 private int use_backing = 1;
247Changing this line to read
248 private int use_backing = 0;
249will disable the use of a backing pixmap. However, portions of the
250Ghostscript window may not be properly redrawn after the window is
251restored from an icon or exposed after being occluded by another window.
252
253Some versions of the X server do not implement tiling properly. This will
254show up as broad bands of color where dither patterns should appear. If
255this happens, change
256 private int use_XSetTile = 1;
257to
258 private int use_XSetTile = 0;
259and recompile. The result will run a lot slower, but the output should be
260correct. If this fixes the problem, report it to whoever made your X
261server.
262
263Similarly, some versions of the X server do not implement bitmap/pixmap
264displaying properly. This may show up as white or black rectangles where
265characters should appear, or characters may appear in "inverse video"
266(e.g., white on a black rectangle). If this happens, it may help you to
267change
268 private int use_XPutImage = 1;
269to
270 private int use_XPutImage = 0;
271and recompile. Again, there will be a serious performance penalty; again,
272if this fixes the problem, notify the supplier of your X server.
273
274Currently Ghostscript is set up to compile and link in a generic Unix
275environment. Some Unix environments may require changing the LDFLAGS
276macro in the makefile.
277
278All you need to do to make an executable is invoke the shell command
279 make
280
281Ghostscript uses ANSI syntax for function definitions. Because of this,
282when compiling with cc, it must preprocess each .c file to convert it to
283the older syntax defined in Kernighan and Ritchie, which is what most
284current Unix compilers (other than gcc) support. This step is
285automatically performed by a utility called ansi2knr, which is included in
286the Ghostscript distribution. The makefile automatically builds ansi2knr.
287
288The ansi2knr preprocessing step is included in the makefile rule for
289compiling .c files. ansi2knr creates a file called _temp_.c to hold the
290converted code. If you want to change this name for some reason, it is
291defined in unix-cc.mak.
292
293Note that the abovementioned makefiles are actually generated mechanically
294from *head.mak, *tail.mak, gs.mak, and devs.mak. If you want to change
295the makefile, edit the appropriate one of these files, and then invoke the
296 tar_cat
297shell script to reconstruct the unix-*.mak makefile.
298
299Platform-specific notes
300-----------------------
301
302MIPS:
303 There is apparently a bug in the MIPS C compiler which causes
304gxdither.c to compile incorrectly if optimization is enabled (-O). Until
305a work-around is found, do not use -O with the MIPS C compiler.
306
307Apollo:
308 You must run the compiler in ANSI-compatible mode (i.e., set AK=
309<null string> in the makefile); otherwise, it gives incorrect error
310messages for any function declared as returning a float value.
311
312386 Unix:
313 Due to a compiler bug, if you are building Ghostscript on an Intel
31480386 system using a version of gcc older than version 1.38, you must not
315use the -O option.
316
317Any platform with GNU make:
318 GNU make 3.59 can't handle the final linking step in some cases;
319use the platform's standard make (e.g., /bin/make) if this happens.
320
321Sun:
322 The Sun unbundled C compiler (SC1.0) doesn't compile Ghostscript
323properly if the -fast option is selected: Ghostscript core-dumps in
324build_gs_font. Use -g, or use gcc.
325 The standard Sun cc may not compile iscan.c correctly if
326optimization (-O) is selected. One symptom is that numbers such as 1.e-3
327give a syntax error. This has been observed on a SPARCstation running
328SunOS 4.1.1. If this happens, use -g for this file, or use gcc.
329
330RS/6000:
331 IBM RS/6000, you must define _POSIX_SOURCE and you must use the
332c89 compiler, not cc, e.g.:
333
334 make -f unix-ansi.mak CC=c89 XCFLAGS=-D_POSIX_SOURCE \
335 XINCLUDE=-I/usr/misc/X11/include XLIBDIRS=-L/usr/misc/X11/lib
336
337Apparently some (but not all) releases of the C library declare the hypot
338function: if the declaration in math_.h produces an error message, try
339removing it. Also, the IBM X11R3 server is known to be buggy: use the MIT
340X server if possible. Even beyond all this, many people have trouble with
341Ghostscript on the RS/6000. The usual symptom is that it compiles and
342links OK, but produces garbaged output on the screen. The problem may be
343related to particular versions of AIX or the X server; we don't have
344enough information at this time. The following combinations of AIX and X
345are known to fail:
346 AIX 3.1.5, MIT X11R4, c89
347The following combinations are known to work:
348 AIX 3.1.5, MIT X11R5, c89
349
350ISC Unix:
351 For ISC Unix with gcc, an appropriate make invocation is:
352 make XCFLAGS="-D__SVR3 -posix" LDFLAGS="-shlib -posix" \
353 EXTRALIBS="-linet -lnsl_s"
354If this doesn't work for you, try removing the -shlib.
355
356SCO Unix:
357 The SCO Unix C compiler apparently can't handle the Pn macros in
358std.h. If you get strange compilation errors on SCO Unix, see if you can
359get a compiler fix from SCO. Meanwhile, to use gcc with SCO ODT, see
360gcc-head.mak for the appropriate switch settings.
361
362DEC (Ultrix):
363 Many versions of DEC's X server (DECwindows) have bugs that
364require setting use_XPutImage or use_XSetTile to 0, as described above.
365
366H-P 700 series:
367 You may need to use +O1 rather than -O to get the compiler to
368produce correct code.
369
370********
371******** How to build Ghostscript from source (VAX/VMS version) ********
372********
373
374The files VMS-CC.MAK and VMS-GCC.MAK are VMS DCL command files which
375build Ghostscript from scratch using either the DEC C compiler, CC, or
376the Free Software Foundation's GNU C compiler, GCC. Accordingly, you
377must have one of these two compilers installed in order to build
378Ghostscript. (Other C compilers may work: CC and GCC are the only two
379compilers tested to date.) These two command files build and store
380the Ghostscript library in the object library GS.OLB. If you have
381DECwindows (X11) installed on your system, the executable images GS.EXE,
382GT.EXE, and XLIB.EXE will also be built.
383
384The only important customization of the X11 driver is the choice of
385whether or not to use a backing pixmap. If you use a backing pixmap,
386Ghostscript windows will redisplay properly when they are covered and
387exposed, but drawing operations will go slower. This choice is controlled
388by the line in the file gdevx.c that reads
389 private int use_backing = 1;
390Changing this line to read
391 private int use_backing = 0;
392will disable the use of a backing pixmap. However, portions of the
393Ghostscript window may not be properly redrawn after the window is
394restored from an icon or exposed after being occluded by another window.
395
396Many versions of DEC's X server (DECwindows) have bugs that require
397setting use_XPutImage or use_XSetTile to 0, as described above. These
398show up as broad bands of color where dither patterns should appear, or
399characters displayed white on top of black rectangles or not displayed at
400all. If this happens, change use_XSetTile or use_XPutImage to 0 as
401described above. The result will run a lot slower, but the output will be
402correct. Report the problem to DEC, or whoever supplied your X server.
403
404Ghostscript uses ANSI syntax for function definitions. Thus, when using
405the DEC C compiler, each .C file is converted to the older C syntax defined
406in the first edition of Kernighan and Ritchie and stored in a .CC file.
407This step is performed by VMS-CC.MAK using the ansi2knr utility included
408in the Ghostscript distribution. If you are building a debuggable
409configuration, the .CC files will be left behind by VMS-CC.MAK for use by
410the VMS Debugger; otherwise, they will be deleted.
411
412If you have DEC's C compiler, issue the DCL command
413 $ @VMS-CC.MAK
414to build Ghostscript. If you have GNU C, issue the DCL command
415 $ @VMS-GCC.MAK
416to build Ghostscript.
417
418The option "DEBUG" may be specified with either command file in order to
419build a debuggable Ghostscript configuration:
420 $ @VMS-CC.MAK DEBUG -or- $ @VMS-GCC.MAK DEBUG
421
422In order to specify switches and file names when invoking the interpreter,
423define GS as a foreign command:
424 $ GS == "$disk:[directory]GS.EXE"
425where "disk" and "directory" specify the disk and directory where Ghostscript
426is located. For instance,
427 $ GS == "$DUA1:[GHOSTSCRIPT]GS.EXE"
428To allow the interpreter to be run from any directory, define the logical
429GS_LIB which points to the Ghostscript directory
430 $ DEFINE GS_LIB disk:[directory]
431This allows Ghostscript to locate its initialization files stored in the
432Ghostscript directory -- see use.doc for further details. Finally, to
433invoke the interpreter, merely type GS. Although DCL normally converts
434unquoted parameters to upper case, C programs receive their parameters in
435lower case. That is, the command
436 $ GS -Isys$login:
437passes the switch "-isys$login" to the interpreter. To preserve the
438case of switches, enclose them in double quotes; e.g.,
439 $ GS "-Isys$login:"
440
441********
442******** A guide to the files ********
443********
444
445General
446-------
447
448There are very few machine dependencies in Ghostscript. A few of the .c
449files are machine-specific. These have names of the form
450 gp_<platform>.c
451specifically
452 gp_dos.c
453 gp_unix.c
454 gp_vms.c
455There are also some machine-specific conditionals in files with names
456<something>_.h, and in gdevmem.c. If you are going to extend Ghostscript
457to new machines or operating systems, you should check all the source
458files (both .c and .h) for ifdef's on things other than DEBUG, and you
459should probably count on making a new makefile and a new gp_ file.
460
461Library
462-------
463
464gt.c is a test driver for the library.
465
466Files beginning with gs, gx, or gz (both .c and .h), other than gs.c, are
467the Ghostscript library. Files beginning with gdev are device drivers or
468related code, also part of the library. Other files beginning with g are
469library files that don't fall neatly into either the kernel or the driver
470category.
471
472Interpreter
473-----------
474
475gs.c is the main program for the language interpreter.
476
477Files beginning with z are Ghostscript operator files. The names of the
478files generally follow the section headings of the operator summary in
479section 6.2 of the PostScript manual.
480
481.c files beginning with i, and .h files not beginning with g, are the
482rest of the interpreter. See the makefile for a little more information
483on how the files are divided functionally.
484
485There are a few files that are logically part of the interpreter, but that
486are potentially useful outside Ghostscript, whose names don't begin with
487either g, z, or i:
488
489 s*.c (a flexible stream package, including the Level 2 PostScript
490'filters' supported by Ghostscript);
491
492 trace.c (a procedure tracing package for debugging) and utrace.c
493(the Unix stub for trace.c).