1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2<html> 3<head> 4<title>How to build Ghostscript from source code</title> 5<!-- $Id: Make.htm,v 1.90 2005/10/20 19:46:23 ray Exp $ --> 6<!-- Originally: make.txt --> 7<link rel="stylesheet" type="text/css" href="gs.css" title="Ghostscript Style"> 8</head> 9 10<body> 11<!-- [1.0 begin visible header] ============================================ --> 12 13<!-- [1.1 begin headline] ================================================== --> 14 15<h1>How to build Ghostscript from source code</h1> 16 17<!-- [1.1 end headline] ==================================================== --> 18 19<!-- [1.2 begin table of contents] ========================================= --> 20 21<h2>Table of contents</h2> 22 23<blockquote><ul> 24<li><a href="#General_overview">General overview</a> 25<li><a href="#Acquiring">How to acquire the source code</a> 26<ul> 27<li><a href="#Ghostscript_source">Ghostscript source code</a> 28<li><a href="#Third-party_libraries">Third-party library source code</a> 29</ul> 30<li><a href="#Unpack">How to unpack the source code</a> 31<ul> 32<li><a href="#Tarfiles">How to unpack compressed tar files generally</a> 33<li><a href="#Zipfiles">How to unpack zip files generally</a> 34<li><a href="#Unpack_Ghostscript">How to unpack Ghostscript itself</a> 35<li><a href="#Unpack_libraries">How to unpack the third-party libraries</a> 36</ul> 37<li><a href="#Bug_check">How to check for post-release bug fixes</a> 38<li><a href="#Makefile_overview">How to prepare the makefiles</a> 39<ul> 40<li><a href="#Preparing_makefiles">Changes for your environment</a> 41<li><a href="#Features_and_devices">Selecting features and devices</a> 42<ul> 43<li><a href="#Precompiled_data">Precompiled run-time data</a> 44<li><a href="#GNU_readline">GNU readline</a> 45</ul> 46<li><a href="#Makefile_setup">Setting up "makefile"</a> 47<li><a href="#Invoke_make">Invoking "make"</a> 48<li><a href="#Cross-compiling">Cross-compiling</a> 49</ul> 50<li><a href="#PC_build">How to build Ghostscript from source (PC version)</a> 51<ul> 52<li><a href="#Borland_build">Borland/Inprise environment</a> 53<li><a href="#Microsoft_build">Microsoft environment</a> 54<li><a href="#Microsoft_build_64">Microsoft environment 64-bit</a> 55<li><a href="#Self-extracting_executables">Making self-extracting executables</a> 56<li><a href="#Watcom_build">Watcom environment</a> 57<li><a href="#Cygwin32_build">Cygwin32 gcc</a> 58<li><a href="#IntelWin32_build">Intel C/C++ compiler</a> 59</ul> 60<li><a href="#Mac_build">How to build Ghostscript from source (MacOS version)</a> 61<ul> 62<li><a href="#MacOS">Traditional MacOS</a> 63<li><a href="#MacOSX">MacOS X</a> 64</ul> 65<li><a href="#Unix_build">How to build Ghostscript from source (Unix version)</a> 66<ul> 67<li><a href="#Multi_architecture_makefile">The multi-architecture makefile</a> 68<li><a href="#UNIX_makefile">Setting up "makefile"</a> 69<li><a href="#Shared_object">Shared object</a> 70<li><a href="#Tool_specific_issues">Tool-specific issues</a> 71<ul> 72<li><a href="#gcc_27x">gcc 2.7.*</a> 73<li><a href="#GNU_make">GNU make</a> 74</ul> 75<li><a href="#OS_specific_issues">OS-specific issues</a> 76<ul> 77<li><a href="#386_Unix">386 Unix</a> 78<li><a href="#BSDI">BSDI</a> 79<li><a href="#Digital_Unix">Digital Unix (Alpha)</a> 80<li><a href="#Linux">Linux</a> 81<li><a href="#NeXTSTEP">NeXTSTEP / OpenSTEP</a> 82<li><a href="#SCO">SCO Unix/Xenix</a> 83<li><a href="#SVR4">SVR4 Unix</a> 84<li><a href="#System_V">System V Unix platforms</a> 85<li><a href="#Unixware">Unixware</a> 86</ul> 87<li><a href="#Hardware_specific_issues">Hardware-specific issues</a> 88<ul> 89<li><a href="#Alpha_with_gcc">Alpha with gcc</a> 90<li><a href="#Apollo">H-P Apollo</a> 91<li><a href="#ATT_7040">AT&T 7040 R3</a> 92<li><a href="#Convex">Convex</a> 93<li><a href="#DECStations">DECStations with Ultrix</a> 94<li><a href="#HP_RISC">H-P RISC workstations</a> 95<li><a href="#Intergraph">Intergraph Clipper</a> 96<li><a href="#MIPS">MIPS</a> 97<li><a href="#NCR_3550">NCR 3550</a> 98<li><a href="#Pyramid">Pyramid MIServer-S</a> 99<li><a href="#RS6000">IBM RS/6000 with AIX</a> 100<li><a href="#Silicon_Graphics">Silicon Graphics</a> 101<li><a href="#Sun">Sun</a> 102<li><a href="#SunOS">SunOS</a> 103<li><a href="#Solaris">Solaris</a> 104<li><a href="#VAX_Ultrix">VAX with Ultrix</a> 105</ul> 106</ul> 107<li><a href="#OS2_build">How to build Ghostscript from source (OS/2 version)</a> 108<li><a href="#VMS_build">How to build Ghostscript from source (OpenVMS version)</a> 109<ul> 110<li><a href="#GNU_make_VMS">Building with GNU make on OpenVMS</a> 111<li><a href="#MMK_MMS_VMS">Building with MMK or MMS on OpenVMS</a> 112</ul> 113<li><a href="#Other_environments">Other environments</a> 114<ul> 115<li><a href="#No_multi_thread">Environments lacking multi-threading</a> 116<li><a href="#Plan_9">Plan 9</a> 117<li><a href="#QNX">QNX</a> 118</ul> 119<li><a href="#UFST_build">How to build Ghostscript with UFST</a> 120<li><a href="#FT_build">How to build Ghostscript with Free Type</a> 121</ul></blockquote> 122 123<!-- [1.2 end table of contents] =========================================== --> 124 125<!-- [1.3 begin hint] ====================================================== --> 126 127<p>For other information, see the <a href="Readme.htm">Ghostscript 128overview</a> and the instructions on how to <a href="Install.htm">install 129Ghostscript</a>. 130 131<!-- [1.3 end hint] ======================================================== --> 132 133<hr> 134 135<!-- [1.0 end visible header] ============================================== --> 136 137<!-- [2.0 begin contents] ================================================== --> 138 139<h2><a name="General_overview"></a>General overview</h2> 140 141<p> 142This document describes how to build a Ghostscript executable from source 143code. There are four major steps to building Ghostscript: 144 145<ol> 146<li>Acquire the compressed archive files of source code for Ghostscript and 147the required third-party libraries. 148<li>Unpack the archive files into the Ghostscript directory and correctly 149named subdirectories. 150<li>Configure the build to match your system and desired configuration options. 151<li>Invoke "<b><tt>make</tt></b>" to build the software. 152</ol> 153 154<p> 155The remainder of this document describes each of these steps in detail. 156Note that some of this process is platform-dependent. After building 157Ghostscript you must then install it; for that, see the 158<a href="Install.htm">installation instructions</a>. 159 160<hr> 161 162<h2><a name="Acquiring"></a>How to acquire the source code</h2> 163 164<p> 165Building Ghostscript requires the Ghostscript source code itself, and also 166the source code for some third-party libraries that Ghostscript uses. 167 168<h3><a name="Ghostscript_source"></a>Ghostscript source code</h3> 169 170<p><a name="Authoritative_distribution_site"></a> 171There are two kinds of Ghostscript distributions available, called "AFPL 172Ghostscript" and "GPL Ghostscript"; the distinction between them is 173explained in the <a href="Commprod.htm">conditions for distributing 174Ghostscript</a>. The authoritative distribution site for AFPL 175Ghostscript is 176 177<blockquote> 178<a href="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/" 179class="offsite">ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/</a>gs### 180</blockquote> 181 182<p> 183where "###" is the unpunctuated version number. GPL Ghostscript is 184available from the same site at 185 186<blockquote> 187<a href="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/" 188class="offsite">ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/GPL/</a> 189</blockquote> 190 191<p> 192Ghostscript source code is packaged in two different formats: 193gzip-compressed tar files (*<b><tt>.tar.gz</tt></b>) and zip files 194(*<b><tt>.zip</tt></b>). For all versions there are gzip-compressed tar 195files: 196 197<blockquote> 198<b><tt>ghostscript-</tt></b>#.##<b><tt>.tar.gz</tt></b><br> 199<b><tt>ghostscript-fonts-std-</tt></b>#.##<b><tt>.tar.gz</tt></b><br> 200<b><tt>ghostscript-fonts-other-</tt></b>#.##<b><tt>.tar.gz</tt></b> 201</blockquote> 202 203<p>For recent versions of Ghostscript there are also zip files 204 205<blockquote> 206<b><tt>gs</tt></b>###<b><tt>src.zip</tt></b><br> 207<b><tt>gs</tt></b>###<b><tt>w32.exe</tt></b> 208</blockquote> 209 210<p> 211("#.##" and "###" are version numbers in punctuated and unpunctuated form.) 212Software to decompress and extract both formats is available for almost 213every platform for which Ghostscript is available -- including Unix, DOS, 214MS Windows, and VMS -- so you can choose the format most convenient for 215you; but it's up to you to locate that software. See the section on <a 216href="#Unpack">unpacking the source code</a>. 217 218<h3><a name="Third-party_libraries"></a>Third-party library source code</h3> 219 220<p> 221To build Ghostscript you need the source code for the <a 222href="http://www.ijg.org/">Independent JPEG Group</a> (IJG) library, the 223<a href="http://www.libpng.org/pub/png/">Portable Network Graphics</a> 224(PNG) 225library, and the <a 226href="http://www.gzip.org/zlib/">zlib</a> 227compression and decompression library. The default build also expects source 228for the <a href="http://jbig2dec.sourceforge.net">jbig2dec</a> JBIG2 decompression 229library. 230 231<p> 232On Windows and MacOS, the .zip and .sit source archives include the appropriate 233source versions of these libraries, so no additional downloads are necessary. 234Unix tarballs may also contain appropriate library source; the configure script 235will tell you if it cannot find the appropriate libraries. 236 237<p> 238Here are authoritative distribution points for these libraries, should you need 239to obtain the source yourself. As elsewhere, "#" is used for version 240numbers. The JPEG source code is quite stable, so the reference 241here includes the latest version number. Versions of the zlib source are 242not compatible between the 1.1.x and 1.2.x series; if you wish to 243compile in zlib (as opposed to linking to a separately build dynamic 244library) you must use a 1.2.x version. 245 246<blockquote><table cellpadding=0 cellspacing=0> 247<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Third-party libraries: authoritative sources</font><hr> 248<tr> <td valign=top>JPEG 249 <td> 250 <td><a href="ftp://ftp.uu.net/graphics/jpeg/" 251class="offsite">ftp://ftp.uu.net/graphics/jpeg/</a><a 252href="ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz" 253class="offsite">jpegsrc.v6b.tar.gz</a><br> 254 <a href="ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/" 255class="offsite">ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/</a><a 256href="ftp://ftp.simtel.net/pub/simtelnet/msdos/graphics/jpegsr6b.zip">jpegsr6b.zip</a> 257 258<tr> <td valign=top>PNG 259 <td> 260 <td><a href="http://www.libpng.org/pub/png/src/" 261class="offsite">http://www.libpng.org/pub/png/src/</a>libpng-#.#.#.tar.gz<br> 262 <a href="http://www.libpng.org/pub/png/src/" 263class="offsite">http://www.libpng.org/pub/png/src/</a>lpng###.zip<br> 264 <a href="ftp://swrinde.nde.swri.edu/pub/png/src/" 265class="offsite">ftp://swrinde.nde.swri.edu/pub/png/src/</a>libpng-#.#.#.tar.gz<br> 266 <a href="ftp://swrinde.nde.swri.edu/pub/png/src/" 267class="offsite">ftp://swrinde.nde.swri.edu/pub/png/src/</a>lpng###.zip 268 269<tr> <td valign=top>zlib (latest) 270 <td> 271 <td> <a href="http://www.gzip.org/zlib/zlib-1.2.1.tar.gz" 272class="offsite">http://www.gzip.org/zlib/zlib-1.2.1.tar.gz</a><br> 273 <a href="http://www.gzip.org/zlib/zlib121.zip" 274class="offsite">http://www.gzip.org/zlib/zlib121.zip</a><br> 275 See the <a href="http://www.gzip.org/zlib/">official website</a> 276for a list of mirrors. 277<tr> <td valign=top>jbig2dec 278 <td> 279 <td> <a href="http://sourceforge.net/project/showfiles.php?group_id=28301" 280class="offsite">http://sourceforge.net/project/showfiles.php?group_id=28301</a><br> 281</table></blockquote> 282 283<p> 284On DOS or MS Windows one ordinarily uses the zip file kits, in other 285environments the compressed tar files, but this is simply a matter of 286convenience, since for the same version of the software the compressed tar 287file has the same contents as the zip file. Note that each of these 288libraries has <b><em>its own version number</em></b> that has 289<b><em>nothing to do with Ghostscript's version number</em></b>; you should 290get the highest numbered version. (If you encounter difficulties in the 291build process you might have to use a lower-numbered version, but don't 292worry about this yet.) If you're running Linux, you might check whether 293these libraries are already available in source form on your system, since 294many Linux distributors include them; but we advise you to get the highest 295version from the Net if you can. 296 297<hr> 298 299<h2><a name="Unpack"></a>How to unpack the source code</h2> 300 301<p> 302Unfortunately there are no generally accepted standards for how to package 303source code into archives, so the instructions for unpacking Ghostscript are 304longer than they should be. We begin with a brief explanation of how to 305extract the two kinds of archive files. 306 307<h3><a name="Tarfiles"></a>How to unpack compressed tar files generally</h3> 308 309<p> 310Tar (<b><tt>.tar</tt></b>) files are the <em>de facto</em> standard for 311archiving files on Unix (every Unix system has the <b><tt>tar</tt></b> 312program), and programs to extract their contents are also widely available 313for DOS, MS Windows, and VMS. To economize on space and downloading time, 314Ghostscript's tar files are compressed with GNU <b><tt>gzip</tt></b>, which 315adds the suffix "<b><tt>.gz</tt></b>" to the file name, giving 316"<b><tt>.tar.gz</tt></b>". 317 318<p> 319To unpack a compressed tar file <b><tt>MyArchive.tar.gz</tt></b> you 320must both decompress it and extract the contents. You can do this in two 321steps, one to decompress the file and another to unpack it: 322 323<blockquote> 324<b><tt>gzip -d MyArchive.tar.gz</tt></b> 325<br><b><tt>tar -xf MyArchive.tar</tt></b> 326</blockquote> 327 328<p> 329or in a pipeline: 330 331<blockquote> 332<b><tt>gzip -d -c MyArchive.tar.gz | tar -xf -</tt></b> 333</blockquote> 334 335<p> 336or, if you have a program like GNU <b><tt>tar</tt></b> that can handle 337compressed tar files, with a single command: 338 339<blockquote> 340<b><tt>tar -zxf MyArchive.tar.gz</tt></b> 341</blockquote> 342 343<p> 344The <b><tt>tar</tt></b> program automatically preserves directory structure 345in extracting files. The Ghostscript source archive puts all files under a 346directory <b><tt>gs</tt></b>#.##, so using <b><tt>tar</tt></b> to unpack a 347compressed archive should always properly create that directory, which we 348will call the "gs directory". Make sure you're positioned in the 349<b><em>parent</em></b> of the gs directory <b><em>before</em></b> unpacking 350the files. If a subdirectory doesn't already exist, <b><tt>tar</tt></b> 351creates it. 352 353<p> 354Some other programs -- under MS Windows, for instance -- can also unpack 355compressed tar files, but they may not automatically preserve directory 356structure nor even extract files into the current directory. If you use 357one of these, you must 358 359<ul> 360<li>set the program's options to "Use folder names" or the equivalent, and 361<li>check that it is extracting files into the right place. 362</ul> 363 364<h3><a name="Zipfiles"></a>How to unpack zip files generally</h3> 365 366<p> 367Zip files are the <em>de facto</em> standard for archiving files on DOS and 368MS Windows, and programs to extract their contents are widely available for 369DOS, MS Windows, Unix, VMS, and other platforms. Zip files are at once an 370archive format and a compressed format, so an unzipping program 371decompresses and extracts archived files as a single step. 372 373<p> 374One common 16-bit DOS program is <b><tt>pkunzip</tt></b>, which comes in 375the <b><tt>pkzip</tt></b> package. If you use this, you should ensure that 376you have at least version 2.04g, because with its <b><tt>-d</tt></b> 377switch, that version of <b><tt>pkunzip</tt></b> preserves the directory 378structure of archived files when extracting them; see below. Another 379popular free program to unpack zip archives, available for DOS and MS 380Windows (16-bit and 32-bit), Unix, VMS, and other platforms, is InfoZIP 381<b><tt>unzip</tt></b>: 382 383<blockquote> 384<a href="http://www.info-zip.org/pub/infozip/UnZip.html" 385class="offsite">http://www.info-zip.org/pub/infozip/UnZip.html</a> 386</blockquote> 387 388<p> 389Unlike <b><tt>pkunzip</tt></b>, InfoZIP <b><tt>unzip</tt></b> automatically 390preserves the directory structure of extracted files. So if you have a zip 391archive <b><tt>MyArchive.zip</tt></b>: 392 393<blockquote><table cellpadding=0 cellspacing=0> 394<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Extracting zipped files</font><hr> 395<tr valign=bottom> 396 <th align=left>Command 397 <td> 398 <th align=left>Preserves directory structure 399<tr> <td colspan=3><hr> 400<tr valign=top> <td><b><tt>pkunzip MyArchive.zip</tt></b> 401 <td> 402 <td>Does <b><em>NOT</em></b> 403<tr valign=top> <td><b><tt>pkunzip -d MyArchive.zip</tt></b> 404 <td> 405 <td><b><em>DOES</em></b> (note the <b><tt>-d</tt></b> switch) 406<tr valign=top> <td><b><tt>unzip MyArchive.zip</tt></b> 407 <td> 408 <td><b><em>DOES</em></b> 409</table></blockquote> 410 411<p> 412As with the compressed tar files, make sure you're positioned in the 413<b><em>parent</em></b> of the gs directory <b><em>before</em></b> unpacking 414the files. If a subdirectory doesn't already exist, <b><tt>zip</tt></b> or 415<b><tt>pkunzip -d</tt></b> creates it. 416 417<h3><a name="Unpack_Ghostscript"></a>How to unpack Ghostscript itself</h3> 418 419<p> 420At this point you have <a href="#Acquiring">acquired all the source code</a> 421and are ready to unpack it according to the preceding guidelines for <a 422href="#Tarfiles">tar files</a> or <a href="#Zipfiles">zip files</a>. To 423unpack the Ghostscript source, make the <b><em>parent</em></b> of the (new) 424gs directory the current directory. 425 426<blockquote><table cellpadding=0 cellspacing=0> 427<tr> <th align=left valign=top>2-step: 428 <td> 429 <td><b><tt>gzip -d ghostscript-</tt></b>#.##<b><tt>.tar.gz</tt></b><br><b><tt>tar -xf ghostscript-</tt></b>#.##<b><tt>.tar</tt></b> 430<tr><td> 431<tr> <th align=left valign=top>Pipe: 432 <td> 433 <td><b><tt>gzip -d -c ghostscript-</tt></b>#.##<b><tt>.tar.gz | tar -xf -</tt></b> 434<tr><td> 435<tr> <th align=left valign=top>GNU <b><tt>tar</tt></b>: 436 <td> 437 <td><b><tt>tar -zxf ghostscript-</tt></b>#.##<b><tt>.tar.gz</tt></b> 438<tr><td> 439<tr> <th align=left valign=top><b><tt>pkunzip</tt></b>: 440 <td> 441 <td><b><tt>pkunzip -d gs</tt></b>###<b><tt>sr1.zip</tt></b><br><b><tt>pkunzip -d gs</tt></b>###<b><tt>sr2.zip</tt></b><br>... 442<tr><td> 443<tr> <th align=left valign=top><tt>unzip</tt>: 444 <td> 445 <td><b><tt>unzip gs</tt></b>###<b><tt>src.zip</tt></b> 446</table></blockquote> 447 448<p> 449All the Ghostscript source files are now in subdirectories of the gs 450directory. 451 452<blockquote><table cellpadding=0 cellspacing=0> 453<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">Source subdirectories</font><hr> 454<tr> <th valign=bottom align=left>Subdirectory 455 <td> 456 <th valign=bottom align=left>Contents 457<tr> <td colspan=5><hr> 458<tr> <td><b><tt>src/</tt></b> 459 <td> 460 <td>C source code and makefiles 461<tr> <td><b><tt>lib/</tt></b> 462 <td> 463 <td>PostScript files and scripts used when running Ghostscript 464<tr> <td><b><tt>doc/</tt></b> 465 <td> 466 <td>Documentation 467<tr> <td><b><tt>man/</tt></b> 468 <td> 469 <td>Unix <b><tt>man</tt></b> pages 470<tr> <td><b><tt>examples/</tt></b> 471 <td> 472 <td>Sample PostScript files 473</table></blockquote> 474 475<h3><a name="Unpack_libraries"></a>How to unpack the third-party libraries</h3> 476 477<p> 478The Ghostscript makefiles expect to find the JPEG, PNG, and zlib source code 479in specific subdirectories of the <b><tt>gs</tt></b> directory, and this 480means you must pay careful attention to unpacking the source code for these 481packages. Use the same method for all of them, no matter how they're 482packaged: 483 484<ol> 485<li>Make the gs directory current. 486<li>Unpack the archive file, creating a subdirectory (which will include a 487version number). 488<li>Whatever the subdirectory's original name, rename it to the versionless 489name shown just below. 490</ol> 491 492<p> 493If you're uncertain how to unpack an archive, review the sections on <a 494href="#Tarfiles">compressed tar files</a> and <a href="#Zipfiles">zip 495files</a>. 496 497<blockquote><table cellpadding=0 cellspacing=0> 498<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">3d-party software subdirectories</font><hr> 499<tr> <th valign=bottom align=left>Package 500 <td> 501 <th valign=bottom align=left>Possible<br>original name 502 <td> 503 <th valign=bottom align=left>Rename to 504<tr> <td colspan=5><hr> 505<tr> <td>JPEG 506 <td> 507 <td><b><tt>./jpeg-6b</tt></b> 508 <td> 509 <td><b><tt>./jpeg</tt></b> 510<tr> <td>PNG 511 <td> 512 <td><b><tt>./libpng-</tt></b>#.## 513 <td> 514 <td><b><tt>./libpng</tt></b> 515<tr> <td>zlib 516 <td> 517 <td><b><tt>./zlib-</tt></b>#.#.# 518 <td> 519 <td><b><tt>./zlib</tt></b> 520</table></blockquote> 521 522<hr> 523 524<h2><a name="Bug_check"></a>How to check for post-release bug fixes</h2> 525 526<p> 527Bug information and fixes are tracked on Ghostscript Bugzilla. 528For more information, please visit 529 530<blockquote> 531<a href="http://bugs.ghostscript.com"> 532http://bugs.ghostscript.com</a> 533</blockquote> 534 535<hr> 536 537<h2><a name="Makefile_overview"></a>How to prepare the makefiles</h2> 538 539<p> 540The Ghostscript makefiles are very large and complex in order to deal with 541the diverse requirements of all the different systems where they may be 542used. 543 544<p> 545Ghostscript has an automatic configuration script. If you're on unix or 546a system that supports unix shell scripts, this is the easiest option to use. 547Simply type: 548 549<blockquote><pre> 550./configure 551</blockquote> 552 553from the top level of the ghostscript source directory. It should configure 554itself based on what's available on your system, warn you of any missing 555dependencies, and generate a Makefile. At this point you can skip to the 556section <a href="#Invoke_make">invoking make</a> below. Also, many common 557configuration options (like install location) can be set through options 558to the configure script. Type '<tt>./configure --help</tt>' for a complete 559listing. Note that the configuration option is only available with the 560unix .tar distributions of the source. 561 562<p> 563Note that if you're building Ghostscript from development source out of 564a repository instead of from a released source package, you should run 565'<tt>./autogen.sh</tt>' instead of <tt>./configure.</tt> This script 566takes all the same options that configure does. 567 568<p> 569If your system doesn't support the configure script or you don't wish to 570use it, you can use the traditional ghostscript makefile system, editing 571the options by hand to match your system as described below. 572Fortunately, the only makefiles you're likely to want to change are 573relatively small ones containing platform-specific information. 574 575<blockquote><a name="Platform-specific_makefiles"></a><table cellpadding=0 cellspacing=0> 576<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Platform-specific makefiles</font><hr> 577<tr> <th align=left>Makefile 578 <td> 579 <th align=left>Used for 580<tr> <td colspan=3><hr> 581<tr> <td><b><tt>Makefile.in</tt></b> 582 <td> 583 <td>Template makefile for the autoconf build 584<tr> <td><b><tt>bcwin32.mak</tt></b> 585 <td> 586 <td>MS Windows with Borland/Inprise compilers 587<tr> <td><b><tt>msvc32.mak</tt></b> 588 <td> 589 <td>MS Windows with Microsoft Visual C++ version 4 to 7. 590<tr> <td><b><tt>openvms.mak</tt></b> 591 <td> 592 <td>OpenVMS 593<tr> <td><b><tt>os2.mak</tt></b> 594 <td> 595 <td>OS/2 with the gcc/emx compiler 596<tr> <td><b><tt>unix-gcc.mak</tt></b> 597 <td> 598 <td>Unix with gcc 599<tr> <td><b><tt>unixansi.mak</tt></b> 600 <td> 601 <td>Unix with ANSI C compilers other than gcc 602<tr> <td><b><tt>watcw32.mak</tt></b> 603 <td> 604 <td>MS Windows with Watcom compilers 605<tr> <td> 606<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Platform-independent makefiles</font><hr> 607<tr> <td><b><tt>contrib.mak</tt></b> 608 <td> 609 <td>Contributed device drivers 610<tr> <td><b><tt>devs.mak</tt></b> 611 <td> 612 <td>Maintained device drivers 613<tr> <td><b><tt>gs.mak</tt></b> 614 <td> 615 <td>Documentation and miscellany 616<tr> <td><b><tt>icclib.mak</tt></b> 617 <td> 618 <td>ICC color correction library 619<tr> <td><b><tt>ijs.mak</tt></b> 620 <td> 621 <td>IJS raster driver library 622<tr> <td><b><tt>int.mak</tt></b> 623 <td> 624 <td>Main makefile for the PostScript & PDF interpreter 625<tr> <td><b><tt>jpeg.mak</tt></b> 626 <td> 627 <td>JPEG library 628<tr> <td><b><tt>lib.mak</tt></b> 629 <td> 630 <td>Graphics engine 631<tr> <td><b><tt>libpng.mak</tt></b> 632 <td> 633 <td>PNG library 634<tr> <td><b><tt>version.mak</tt></b> 635 <td> 636 <td>Version and release date 637<tr> <td><b><tt>zlib.mak</tt></b> 638 <td> 639 <td>zlib library 640</table></blockquote> 641 642<p> 643Since these files change from one Ghostscript version to another, sometimes 644substantially, and since they all include documentation for the various 645options, here we don't duplicate most of that documentation: we recommend 646strongly that you review the entire makefile specific for your operating 647system and compiler before building Ghostscript. 648 649<h3><a name="Preparing_makefiles"></a>Changes for your environment</h3> 650 651<p> 652You must edit the platform-specific makefile to change any of these: 653 654<ul> 655<li>The name of the makefile itself (<b><tt>MAKEFILE</tt></b> macro) 656<li>The locations to install Ghostscript files (<b><tt>prefix</tt></b> etc.) 657<li>The default search paths for the initialization and font files 658(<b><tt>GS_LIB_DEFAULT</tt></b> macro) 659<li>The debugging options (<b><tt>DEBUG</tt></b> and <b><tt>TDEBUG</tt></b> 660macros) 661<li>Which optional features to include (<b><tt>FEATURE_DEVS</tt></b>) 662<li>Which device drivers to include (<b><tt>DEVICE_DEVS</tt></b> and 663<b><tt>DEVICE_DEVS</tt></b>{<em>1--20</em>} macros) 664<li>Default resolution parameters for some printer drivers 665(<b><tt>devs.mak</tt></b> or <b><tt>contrib.mak</tt></b>, whichever defines 666the driver) 667 668</ul> 669 670<p> 671The <a href="#Platform-specific_makefiles">platform-specific makefiles</a> 672include comments describing all these except the 673<b><tt>DEVICE_DEVS</tt></b> options. These are described in 674<b><tt>devs.mak</tt></b> and <b><tt>contrib.mak</tt></b>, even though the 675file that must be edited to select them is the <a 676href="#Platform-specific_makefiles">platform-specific makefile</a>. Check 677also the <b><tt>JVERSION</tt></b> and <b><tt>PVERSION</tt></b> macros in 678the platform-specific makefile, and adjust them if they don't match the 679JPEG and PNG library versions you're using: see <b><tt>jpeg.mak</tt></b> 680and <b><tt>libpng.mak</tt></b> for more information. 681 682<p> 683Some platform-specific options are described in the sections for individual 684platforms. See the "Options" section near the beginning of the relevant 685makefile for more information. 686 687<h3><a name="Features_and_devices"></a>Selecting features and devices</h3> 688 689<p> 690You may build Ghostscript with any of a variety of features and with any 691subset of the available device drivers. The complete list of features is 692in a comment at the beginning of <b><tt>gs.mak</tt></b>, and the complete 693list of drivers in comments at the beginning of <b><tt>devs.mak</tt></b> 694and <b><tt>contrib.mak</tt></b>. To find what devices a platform-specific 695makefile selects to include in the executable, look in it for all lines of 696the form 697 698<blockquote> 699<b><tt>FEATURE_DEVS=</tt></b><em>{list of features}</em><br> 700<b><tt>DEVICE_DEVS</tt></b>*<b><tt>=</tt></b><em>{list of devices}</em> 701</blockquote> 702 703<p> 704For example, if the makefile has 705 706<blockquote><b><tt> 707FEATURE_DEVS=$(PSD)level2.dev 708</tt></b></blockquote> 709 710<p> 711indicating that only the PostScript Level 2 facilities should be included, 712you might make it 713 714<blockquote><b><tt> 715FEATURE_DEVS=$(PSD)level2.dev $(PSD)pdf.dev 716</tt></b></blockquote> 717 718<p> 719to add the ability to interpret PDF files. (In fact, 720<b><tt>FEATURE_DEVS</tt></b> in the current Unix makefiles already includes 721<b><tt>$(PSD)pdf.dev</tt></b>.) The Unix makefile also defines 722 723<blockquote><b><tt> 724DEVICE_DEVS=$(DD)x11.dev 725</tt></b></blockquote> 726 727<p> 728indicating that the X Windows driver should be included, but since 729platform-specific makefiles as distributed normally include many of the 730possible features and drivers, you will probably rather remove from the 731makefile the features and drivers you don't want. It does no harm to 732include unneeded features and devices, but the resulting executable will be 733larger than needed. 734 735<p> 736You may edit the <b><tt>FEATURE_DEVS</tt></b> line to select or omit any of 737the features listed near the beginning of <b><tt>gs.mak</tt></b>, and the 738<b><tt>DEVICE_DEVS</tt></b>* lines to select or omit any of the device 739drivers listed near the beginning of <b><tt>devs.mak</tt></b> and 740<b><tt>contrib.mak</tt></b>. The first device listed in the definition of 741<b><tt>DEVICE_DEVS</tt></b> becomes the default device for this executable; 742see the usage documentation for <a href="Use.htm#Output_device">how to 743select an output device</a> at run time using the 744<a href="Use.htm#DEVICE_switch"><b><tt>-sDEVICE=</tt></b></a> switch. If 745you can't fit all the devices on a single line, you may add lines defining 746 747<blockquote> 748<b><tt>DEVICE_DEVS1=$(DD)</tt></b><em>{dev11}</em><b><tt>.dev</tt></b> ... <b><tt>$(DD)</tt></b><em>{dev1n}</em><b><tt>.dev</tt></b> 749<br><b><tt>DEVICE_DEVS2=$(DD)</tt></b><em>{dev21}</em><b><tt>.dev</tt></b> ... <b><tt>$(DD)</tt></b><em>{dev2n}</em><b><tt>.dev</tt></b> 750</blockquote> 751 752<p> 753etc., up to <b><tt>DEVICE_DEVS15</tt></b>. Don't use continuation lines -- 754on some platforms they don't work. 755 756<p> 757Note that if you want to include a driver named <em>xxx</em>, you must put 758<b><tt>$(DD)</tt></b><em>xxx</em><b><tt>.dev</tt></b> in 759<b><tt>DEVICE_DEVS</tt></b>*. Similarly, if you want to include a feature 760related to the PostScript or PDF language interpreters (PostScript level 7611 .. 3, or other language features such as the ability to read EPSF files or 762TrueType font files), you must represent it as 763<b><tt>$(PSD)</tt></b><em>xxx</em><b><tt>.dev</tt></b>. If you are linking 764only the graphics library -- not the language interpreter(s) -- with an 765application and want to include optional graphics library features such as 766CIE color, you represent them as 767<b><tt>$(GLD)</tt></b><em>xxx</em><b><tt>.dev</tt></b>. 768 769<h4><a name="Precompiled_data"></a>Precompiled run-time data</h4> 770 771<p> 772Ghostscript normally reads a number of external data files at run time: 773initialization files containing PostScript code, fonts, and other resources 774such as halftones. By changing options in the top-level makefile for the 775platform, you can cause some of these files to be compiled into the 776executable: this simplifies installation, improves security, may reduce 777memory requirements, and may be essential if you are planning on putting 778Ghostscript into ROM. 779 780<p> 781To compile the initialization files (<b><tt>lib/gs_init.ps</tt></b>, etc.) 782into the executable, change the <b><tt>0</tt></b> to a <b><tt>1</tt></b> in 783the line 784 785<blockquote><b><tt> 786COMPILE_INITS=0 787</tt></b></blockquote> 788 789<p> 790Compiled initialization includes the default font map. 791It is used only if Ghostscript cannot find or open the default font 792map file at run time. 793 794<p> 795To compile fonts into the executable, see <a 796href="Fonts.htm#Precompiling">Precompiling fonts</a>. 797 798<p> 799To compile threshold-array halftones into the executable, see the "Compiled 800halftone" section of <b><tt>int.mak</tt></b> for a sample makefile fragment, 801<b><tt>genht.c</tt></b> for the syntax of halftone data files, and 802<b><tt>lib/ht_ccsto.ps</tt></b> for a sample data file. Note that even 803though the data files use PostScript syntax, compiled halftones do not 804require the PostScript interpreter and may be used with the graphics library 805alone. 806 807<h4><a name="GNU_readline"></a>GNU readline</h4> 808 809<p> 810AFPL Ghostscript does not include an interface to GNU readline. A user 811contributed code for this purpose, which we spent significant time debugging 812and then updating to track internal architectural changes in Ghostscript. 813The contributor was willing to assign the copyright to Aladdin Enterprises 814(the copyright holder of Ghostscript at the time), and to allow the code to 815be distributed with the Aladdin Free Public License (AFPL) as well as the 816GNU License (GPL). However, even though the GPL allows linking GPLed code 817(such as the GNU readline library package) with non-GPLed code (such as all 818the rest of AFPL Ghostscript) if one doesn't distribute the result, the Free 819Software Foundation, creators of the GPL, have told us that in their 820opinion, the GPL forbids distributing non-GPLed code that is merely 821<em>intended</em> to be linked with GPLed code. We understand that FSF 822takes this position in order to prevent the construction of software that is 823partly GPLed and partly not GPLed, even though the text of the GPL does not 824actually forbid this (it only forbids <em>distribution</em> of such 825software). We think that FSF's position is legally questionable and not in 826the best interest of users, but we do not have the resources to challenge 827it, especially since FSF's attorney apparently supports it. Therefore, even 828though we added the user-contributed interface to GNU readline in internal 829Aladdin Ghostscript version 5.71 and had it working in version 5.93 (one of 830the last beta versions before the 6.0 release), we removed it from the 831Aladdin Ghostscript 6.0 distribution. 832 833<p> 834GPL Ghostscript distributions will include support for GNU readline. As 835with other GPL Ghostscript components that are not included in AFPL 836Ghostscript, the maintainers of Ghostscript will not attempt to run, link, 837or even compile this code, or keep it current across changes in the rest of 838Ghostscript. We will, however, welcome bug fixes or updates, and distribute 839them with subsequent releases of GPL Ghostscript. 840 841<p> 842The first Ghostscript distribution to include GPL readline 843support was GNU Ghostscript 6.0. Support has unfortunately 844been spotty since then. 845 846<p> 847We put considerable work into making it possible for Ghostscript to use GNU 848readline, including the creation and adjustment of internal software 849interfaces specifically to serve this purpose. In principle, we should have 850undone this work in AFPL Ghostscript, lest FSF object to it too as 851intended to facilitate linking AFPL Ghostscript with GNU readline (as the 852U.S. government has been said to do for code that merely provides APIs where 853encryption may be added). However, we are willing to take this risk rather 854than spend the time to undo the interface changes. 855 856<p> 857If you have comments or questions about this situation, please feel free to 858contact the Free Software Foundation, authors of the GPL and copyright 859holders of GNU readline, at <a href="mailto:gnu@gnu.org">gnu@gnu.org</a>, 860and/or artofcode LLC, copyright holder of Ghostscript, at <a 861href="mailto:raph@artofcode.com">raph@artofcode.com</a>. 862 863<h3><a name="Makefile_setup"></a>Setting up "makefile"</h3> 864 865<p> 866After going through the steps just described to <a href="#Unpack">unpack 867the 868sources</a>, configure the build and make any desired 869<a href="#Preparing_makefiles">changes to the 870makefiles</a>, and unpack or create links to the <a 871href="#Unpack_libraries">third party libraries</a>, as the final step in 872preparing to build Ghostscript you must usually associate the name 873"<b><tt>makefile</tt></b>" with the correct makefile for your environment so 874the <b><tt>make</tt></b> command can find it. See the section on your 875particular platform for how to do that if necessary. 876 877<h3><a name="Invoke_make"></a>Invoking "make"</h3> 878 879<dl> 880<dt><b><tt>make</tt></b> 881<dd>Builds Ghostscript without debugging options. 882</dl> 883 884<dl> 885<dt><a name="Debugging"></a><b><tt>make debug</tt></b> 886<dd>Builds Ghostscript with debugging options and additional internal error 887checks. The program will be somewhat larger and slower, but it will behave 888no differently unless you actually turn on debugging options at execution 889time with the <b><tt>-DDEBUG</tt></b> or 890<a href="Use.htm#Debugging"><b><tt>-Z</tt></b> command line switches</a> 891described in the usage documentation. 892</dl> 893 894<dl> 895<dt><b><tt>make pg</tt></b> 896<dd>On Unix platforms, builds with the <b><tt>-pg</tt></b> compiler 897switch, creating an executable for time profiling. 898</dl> 899 900<dl> 901<dt><b><tt>make begin</tt></b> 902<dd>On PC platforms, attempts a quick and dirty compilation of all the 903<b><tt>.c</tt></b> files in the current directory. See the 904<a href="#Make_begin">more detailed explanation</a>. 905</dl> 906 907<dl> 908<dt><b><tt>make install</tt></b> 909<dd>After building, installs the Ghostscript executables, support files, 910and documentation, but does <b><em>not</em></b> install fonts. See the 911<a href="Install.htm">installation documentation</a>. 912</dl> 913 914<dl> 915<dt><b><tt>make clean</tt></b> 916<dd>Deletes all the files created by the build process (relocatables, 917executables, and miscellaneous temporary files). If you've built an 918executable and want to save it, move it first to another place, because 919"<b><tt>make clean</tt></b>" deletes it. 920</dl> 921 922<p> 923<b><em>Note:</em></b> on most platforms some of these simple instructions don't 924quite work in one way or another. Read the section on your specific 925platform. 926 927<h3><a name="Cross-compiling"></a>Cross-compiling</h3> 928 929<p> 930If you are compiling Ghostscript on machines <b>X1</b> ... <b>X</b><em>n</em> with 931cross-compilers that generate code for machine <b>Y</b>, you must first 932perform several extra steps on some machine <b>Z</b> (not necessarily of the 933same type as either <b>X</b><em>i</em> or <b>Y</b>). First of all, choose a makefile 934appropriate for <b>Z</b> and edit it to reflect the run-time options you 935wish to include (<b><tt>FEATURE_DEVS</tt></b>, <b><tt>DEVICE_DEVS*</tt></b>, 936and any other relevant options), just as for non-cross-compilation. 937 938<p> 939If <b>Z</b> runs Unix, perform the following steps: 940<ol> 941<li>On <b>Z</b>, 942<blockquote> 943<b><tt>make clean</tt></b><br> 944<b><tt>make obj/arch.h obj/genconf obj/echogs</tt></b> 945</blockquote> 946 947<li>Edit <b><tt>obj/arch.h</tt></b> to reflect the architecture of <b>Y</b>. 948 949<li>On <b>Z</b>, 950<blockquote> 951<b><tt>make CC=: CCLD=:</tt></b> 952</blockquote> 953 954<li>Copy the files <b><tt>obj/*.h</tt></b> from <b>Z</B> to the directory on 955each <b>X</b><em>i</em> that will be used for compilation. 956 957<li>Extract from the file <b><tt>obj/ldt.tr</tt></b> (on <b>Z</b>) the list 958of <b><tt>.o</tt></b> files that will be linked: this gives the list of 959source files that must be compiled. 960 961<li>Do the compilations on <b>X</b><em>i</em>. 962</ol> 963 964<p> 965If <b>Z</b> runs some version of Microsoft Windows with Microsoft Visual 966C++, use the following steps. <em>NOTE: We have not actually tested 967this.</em> 968 969<ol> 970<li>On <b>Z</b>, 971<blockquote> 972<b><tt>nmake clean</tt></b><br> 973<b><tt>nmake obj\arch.h obj\genconf.exe obj\echogs.exe</tt></b> 974</blockquote> 975 976<li>Edit <b><tt>obj\arch.h</tt></b> to reflect the architecture of <b>Y</b>. 977 978<li>On <b>Z</b>, 979<blockquote> 980<b><tt>nmake CC=rem LINK=rem</tt></b> 981</blockquote> 982 983<li>Copy the files <b><tt>obj\*.h</tt></b> from <b>Z</B> to the directory on 984each <b>X</b><em>i</em> that will be used for compilation. 985 986<li>Extract from the file <b><tt>obj\ldt.tr</tt></b> (on <b>Z</b>) the list 987of <b><tt>.obj</tt></b> files that will be linked: this gives the list of 988source files that must be compiled. 989 990<li>Do the compilations on <b>X</b><em>i</em>. 991</ol> 992 993<hr> 994 995<h2><a name="PC_build"></a>How to build Ghostscript from source (PC version)</h2> 996 997<p> 998All Ghostscript builds in PC (DOS and MS Windows) environments are 32- or 99964-bit: 16-bit builds are not supported. The relevant makefiles are 1000 1001<blockquote><table cellpadding=0 cellspacing=0> 1002<tr><th colspan=5 bgcolor="#CCCC00"><hr><font size="+1">PC makefiles</font><hr> 1003<tr> <th align=left>Makefile 1004 <td> 1005 <th align=left>Construction tools 1006 <td> 1007 <th align=left>For environment 1008<tr> <td colspan=5><hr> 1009<tr> <td valign=top><b><tt>bcwin32.mak</tt></b> 1010 <td> 1011 <td valign=top><a href="#Borland_build">Borland/Inprise C++ 4.x</a> 1012 <td> 1013 <td valign=top>32-bit MS Windows 3.1 + Win32s, 95, 98, NT 1014<tr> <td valign=top><b><tt>msvc32.mak</tt></b> 1015 <td> 1016 <td valign=top><a href="#Microsoft_build">Microsoft Visual C++ 4 to 8</a> 1017 <td> 1018 <td valign=top>MS Windows 32-bit 1019<tr> <td valign=top><b><tt>watcw32.mak</tt></b> 1020 <td> 1021 <td valign=top><a href="#Watcom_build">Watcom C/386 or C++</a> 1022 <td> 1023 <td valign=top>MS Windows 32-bit 1024<tr> <td valign=top><b><tt>unix-gcc.mak</tt></b> 1025 <td> 1026 <td valign=top><a href="#Cygwin32_build">Cygnus gcc</a> 1027 <td> 1028 <td valign=top><a href="http://sourceware.cygnus.com/cygwin/">Cygnus gnu-win32</a> 1029</table></blockquote> 1030 1031<p> 1032To build Ghostscript you need MS-DOS version 3.3 or later and 1033Borland/Inprise C/C++ (4.0 or later); Microsoft Visual C++ (version 4.0 or 1034later); Watcom C/386 (version 8.5 or later) or C++ (any version); or the 1035free djgpp + go32 development system. The options in the makefiles are 1036chosen to strike a balance between RAM consumption and likely usefulness. 1037If you run <b><tt>make</tt></b> in directory <em>{dir}</em>, the default 1038configuration generates an executable that assumes the Ghostscript 1039initialization and font files are in directory 1040<em>{dir}</em><b><tt>\lib</tt></b>. 1041 1042<p> 1043Note that the <b><tt>make</tt></b> program supplied with each PC compiler 1044has a different name. We refer to this program generically as 1045<b><tt>make</tt></b> everywhere else in this document, but you will find the 1046correct name for each compiler in the relevant section below that discusses 1047that compiler. 1048 1049<p> 1050You must have <b><tt>COMMAND.COM</tt></b> in your path to build Ghostscript. 1051After making the changes needed to choose features and devices to build into 1052the executable, you must create the directory where the compiler will do its 1053work (normally the <b><tt>obj</tt></b> subdirectory of the current 1054directory) and the directory where the compiled code will be placed 1055(normally the <b><tt>bin</tt></b> subdirectory). Then to build the 1056Ghostscript executable all you need do is give the <b><tt>make</tt></b> 1057command. 1058 1059<p><a name="Make_begin"></a> 1060A special make target "<b><tt>begin</tt></b>" attempts to compile all the 1061<b><tt>.c</tt></b> files in the current directory. Some of these 1062compilations will fail, but the ones that succeed will go considerably 1063faster because they don't individually pay the overhead of starting up the 1064compiler. So a good strategy for building the executable for the first 1065time, or after changing a widely used <b><tt>.h</tt></b> file, is to do the 1066fast compilation of everything possible, then the controlled compilation of 1067everything that failed in the first step: 1068 1069<blockquote><b><tt> 1070make begin<br> 1071make 1072</tt></b></blockquote> 1073 1074<p> 1075<b><em>Note:</em></b> if you unpack the Ghostscript sources on a DOS or MS Windows 1076system from a Unix tar file, the unpacked files have linefeed alone as the 1077line terminator (the Unix convention) instead of carriage return + linefeed 1078(the Microsoft convention), which may make the C compiler unhappy. One 1079simple way to fix this, if you have the InfoZIP <b><tt>zip</tt></b> and 1080<b><tt>unzip</tt></b> programs, is 1081 1082<blockquote><table cellpadding=0 cellspacing=0> 1083<tr> <td><b><tt>zip -l CVTEMP.zip *.bat *.c *.h *.def *.rc</tt></b> 1084 <td> 1085 <td>(Letter "l", not the digit "1") 1086<tr> <td><b><tt>unzip -o CVTEMP.zip</tt></b> 1087 <td> 1088 <td>(Rewrite all the same files correctly) 1089<tr> <td><b><tt>del CVTEMP.zip</tt></b> 1090 <td> 1091 <td>(Delete the temporary zip file) 1092</table></blockquote> 1093 1094<h3><a name="Borland_build"></a>Borland/Inprise environment</h3> 1095 1096<p> 1097To compile Ghostscript with the Borland/Inprise environment (hereafter 1098referred to as just "Borland"), you need Borland C++ (version 4.0 or later); 1099specifically the compiler, <b><tt>make</tt></b> utility, and linker. You 1100also need either the Borland assembler (version 1.0 or later) or the 1101Microsoft assembler (version 4.0 or later). 1102 1103<p> 1104To create "<b><tt>makefile</tt></b>", give the command 1105 1106<blockquote><b><tt> 1107echo !include "src\bcwin32.mak" >makefile 1108</tt></b></blockquote> 1109 1110<p> 1111To run the <b><tt>make</tt></b> program, give the commmand 1112 1113<blockquote><b><tt> 1114make 1115</tt></b></blockquote> 1116 1117<p> 1118Besides the source files and the makefiles, you need: 1119 1120<blockquote><table cellpadding=0 cellspacing=0> 1121<tr valign=top> <td>*<b><tt>.bat</tt></b> 1122 <td> 1123 <td>(a variety of batch files used in the build process) 1124</table></blockquote> 1125 1126<p> 1127Comments in the makefiles describe the configuration parameters. If your 1128configuration is different from the following, you should definitely read 1129those comments and see if you want or need to change any of this: 1130<ul> 1131<li>The compiler files are in <b><tt>C:\BC</tt></b> and its subdirectories. 1132<li>You are using the Borland assembler <b><tt>tasm</tt></b>. 1133<li>You want an executable that will run on any 32-bit PC-compatible, 1134regardless of processor type (80386, 80486, Pentium, or compatible) and 1135regardless of whether a math coprocessor (80x87) is present -- an issue only 1136with 80386 processors. 1137</ul> 1138 1139<p> 1140<b>Notes</b> 1141 1142<ul> 1143<li>A user reports that the Borland C++ 4.00 with patch 1-6 doesn't 1144produce a working executable of Ghostscript 5.03. We can't test this, 1145since we no longer have this compiler. 1146 1147<li>Borland C++ 4.5 has a bug or bugs that cause(s) the 32-bit Windows 1148executable to crash if you give any @-files on the command line. Among 1149other things, this makes the uniprint driver unusable, because it references 1150the .upp configuration files this way. This problem may possibly be fixed 1151by one or more of the patch files on 1152 1153<blockquote> 1154<a href="ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/" 1155class="offsite">ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/</a> 1156</blockquote> 1157 1158<li>Borland C++ 4.52 has a bug that causes the 32-bit Windows executable to 1159fail during startup. Borland provides a patch for this bug in 1160 1161<blockquote> 1162<a 1163href="ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/bc45xp1.zip" 1164class="offsite">ftp://ftp.borland.com/pub/borlandcpp/devsupport/patches/bc4_5/bc45xp1.zip</a> 1165</blockquote> 1166 1167<li>Borland C++ 5.0 and 5.01 have a code generator bug that generates 1168incorrect code for the construct <b><tt>!file_is_valid()</tt></b>. Do not 1169attempt to compile Ghostscript with these compilers. If you want to report 1170this bug to Borland, send them the result of compiling 1171<b><tt>ziodev.c</tt></b> and tell them to look at the code generated for 1172<b><tt>file_is_valid()</tt></b> and <b><tt>!file_is_valid()</tt></b>. We 1173don't know whether Borland C++ 5.02 still has this problem. The problem 1174does not appear to exist in Borland C++Builder 4 or 5.</li> 1175 1176<li>When building for the MS Windows Win32s environment, the make 1177process will stop after it has created <b><tt>genarch.exe</tt></b>. 1178You should then run "<b><tt>_genarch.bat</tt></b>", wait until 1179<b><tt>genarch</tt></b> has finished and then exit MS Windows. Then type 1180"<b><tt>make</tt></b>" again to restart the make process. 1181 1182<li>Borland C++Builder 5 and above require <strong><tt>BUILDER_VERSION</tt></strong> 1183to be set explicitly to 5 in the make file because the version of MAKE which ships 1184with this product (Version 5.2) is the same as that shipped with Version 4.5. Therefore, 1185there is no way to automatically establish the compiler version that is in use. Note that 1186because a 16 bit compile does not ship with Version 5.5, conditionals have been added to 1187prevent attempts to compile 16 bit code when <tt><strong>BUILDER_VERSION = 5</strong></tt></li> 1188<li>Note that under Borland C++Builder 5, MAKE 1189does not stop when <tt><strong>_genarch.bat</strong></tt> should be run as described 1190above. It is necessary for the user to Abort the make by pressing Control-C. You should 1191then run "<b><tt>_genarch.bat</tt></b>", wait until <b><tt>genarch</tt></b> has 1192finished and then exit MS Windows. Then type "<b><tt>make</tt></b>" again to 1193restart the make process. All targets are built succesfully if this step is ignored. <tt><strong>I 1194don't know if the targets are correct although they seem to run OK.</strong></tt></li> 1195<li>To prevent the compiler terminating because too 1196many warning messages have been generated, copy the file file <tt><strong>bcc32.cfg </strong></tt>to 1197the top level directory using the following command:</li> 1198 1199</ul> 1200 1201<h3><a name="Microsoft_build"></a>Microsoft Environment</h3> 1202 1203<p> NOTE: We have received reports that the Microsoft Visual C++ 5.0 and 6.0 compilers 1204 produce incorrect code for Ghostscript version 6.0 and later, from the same 1205 source code that compiles and runs correctly with other compilers. In spite 1206 of these reports, several members of the Artifex staff use version 6.0 of the 1207 MSVC compiler on a regular basis and we have not found any problems. You may 1208 also want to try out the <a href="#IntelWin32_build">Intel C/C++ compiler</a>, 1209 which can be integrated into the Microsoft Visual C++ environment. 1210<p>To compile Ghostscript using the Microsoft environment, you need Microsoft 1211 Visual C++ 4.0 or later with its associated "<b><tt>nmake</tt></b>" utility 1212 and linker. 1213<h4><a name="Using_the_MS_Development_Environment"> </a>Using Microsoft Developer 1214 Studio</h4> 1215<p>Microsoft Developer Studio is the Microsoft Visual C++ integrated development 1216 environment. To use it to build Ghostscript: it is first necessary to create 1217 a new workspace/project. To create the workspace/project, open Microsoft Developer 1218 Studio and select <b><tt>File/New</tt></b>. In the dialog window that is opened, 1219 select 'Makefile' as the type of project. Specify a name for the project. (Microsoft 1220 does not allow special characters such as ., *, ?, /, or \ as part of project 1221 names.) Also specify the location of the master directory for your Ghostscript 1222 files. Then select OK. 1223<p> In the next dialog window, specify the build command line as <b><tt>nmake 1224 /f src/msvc32.mak DEVSTUDIO= </tt></b> Note the value for <b><tt>DEVSTUDIO</tt></b> 1225 is empty. Then select <b><tt>Finish</tt></b>. 1226<p>At this point, it is now possible to build Ghostscript using Developer Studio. 1227 To build, press F7 or select the build icon. Note: multiple warnings will also 1228 given about things like double to float data conversions. Ignore them. We have 1229 not found a way to create a single set of sources that does not create warnings 1230 with the different compilers and operating systems supported by Ghostscript. 1231 We are working to reduce the number of the warning messages. 1232<p>To run Ghostscript inside of Developer Studio, it is necessary to specify the 1233 name of the executable program . Select <b><tt>Project/Settings</tt></b>. Select 1234 the <b><tt>Debug</tt></b> tab. Then for <b><tt>Executable for debug session:</tt></b> 1235 specify <b><tt>bin/gswin32.exe</tt></b> 1236<p>To use all of the features of Microsoft Developer Studio for debugging, and 1237 modifying Ghostscriptt, you need to finish the remaining steps. 1238<p>To add the Ghostscript DLL to the project, select <b><tt>Project/Settings</tt></b>. 1239 Select the <b><tt>Debug</tt></b> tab. Change the <b><tt>Category</tt></b> to 1240 <b><tt>Additional DLLs</tt></b>. Then specify <b><tt>bin/gsdll32.dll</tt></b>. 1241<p> To specify the Ghostscript program arguments, select <b><tt>Project/Settings</tt></b>. 1242 Select the <b><tt>Debug</tt></b> tab. Change the <b><tt>Category</tt></b> to 1243 <b><tt>General</tt></b>. Then specify the desired program arguments. For example, 1244 specifying: <b><tt>examples/tiger.eps</tt></b> will result in the tiger example 1245 file being displayed when Ghostscript is executed. . 1246<p> A final note: it is possible to create a command file (build.bat) to be used 1247 for the build command line. If many different workspaces/projects are created, 1248 it is simpler to use a build batch command file rather than retyping the build 1249 command line for each new project. Here is an example used by one of Artifex's 1250 staff members. This file is one line: 1251<blockquote><b><tt> nmake -f src/msvc32.mak DEVSTUDIO= DEBUG=1 TDEBUG=1 GS_LIB_DEFAULT="./lib/;./font;$(GSROOTDIR)/lib;$(AROOTDIR)/fonts" 1252 </tt></b></blockquote> 1253<p>Please note the double quotes around the value for <b><tt>GS_LIB_DEFAULT</tt></b> 1254 and the addition of <b><tt>./lib;./fonts;</tt></b> to its definition. This uses 1255 the local (within the project) copy of the <b><tt>lib</tt></b> and <b><tt>fonts</tt></b> 1256 directories. This is convenient if any changes need to be made in these directories. 1257 1258<p> Setting <b><tt>DEBUG=1</tt></b> includes debugging features in the build: 1259<ul> 1260<li> It defines the C preprocessor symbol <b><tt>DEBUG</tt></b>. The latter includes 1261 tracing and self-validation code fragments into compilation. 1262 Particularly it enables the <b><tt>-Z</tt></b> and <b><tt>-T</tt></b> 1263 switches in Ghostscript. 1264<li> It compiles code fragments for the C stack overflow checks. 1265</ul> 1266 Code produced with this option is somewhat larger and runs 1267 somewhat slower. 1268 1269<p>Setting <b><tt>TDEBUG=1</tt></b> disables code optimization in the C compiler and 1270includes symbol table information for the debugger. 1271Code becomes substantially slower and larger. 1272 1273<p> An optional setting <b><tt>DEBUGSYM=1</tt></b> is only useful with <b><tt>TDEBUG=0</tt></b> 1274for advanced developers. It includes symbol table information for the debugger 1275in an optimized (release) build. 1276<em> 1277NOTE: The debug information generated for the optimized code may be 1278significantly misleading. For general MSVC users we recommend TDEBUG=1. 1279</em> 1280 1281<h4><a name="Using_the_command_line"></a>Using the command line</h4> 1282<p>Ghostscript can be made using either the DOS shell or one one of the various 1283 command line shells made for Windows. 1284<p>In order for the makefiles to work properly, two items may have to be changed. 1285 An attempt is made to select the correct version of Microsoft Visual C++ 1286 based on the version of nmake. If this doesn't work it will default 1287 to version 6.x. 1288 If you are not using version 6.x then before building, in <b><tt>src\msvc32.mak</tt></b> 1289 find the line "<b><tt>#MSVC_VERSION=6</tt></b>" and change it to "<b><tt>MSVC_VERSION=4</tt></b>", 1290 "<b><tt>MSVC_VERSION=5</tt></b>", "<b><tt>MSVC_VERSION=7</tt></b>" 1291 or "<b><tt>MSVC_VERSION=8</tt></b>". . 1292<p>In some cases the location of the Microsoft Developer Studio, needs to be changed. 1293 The location of Microsoft Developer Studio is defined by the value of <b><tt>DEVSTUDIO</tt></b>. 1294 There are several different definitions of <b><tt>DEVSTUDIO</tt></b> in src\msvc32.mak. 1295 There is one for each of the currently supported versions of Microsoft Visual 1296 C++ (4, 5, 6, 7, 7.1 and 8). 1297<p>The normal installation process for Microsoft Visual C++ includes setting the 1298 location of the Microsoft Visual C++ executables (cl.exe, link.exe, nmake.exe, 1299 rc.exe) in your PATH definition and the LIB and INCLUDE environment variables 1300 are set to point to the Microsoft Visual C++ directories. If this is true then 1301 the value for <b><tt>DEVSTUDIO</tt></b> can be changed to empty. I.e. <b><tt>DEVSTUDIO=</tt></b> 1302<p> If PATH, LIB, and INCLUDE are not correctly set then the value for <b><tt>DEVSTUDIO</tt></b> 1303 needs to be defined. For example, for version 6.0, the default definition for 1304 the location for the Microsoft Developer Studio is: <b><tt>DEVSTUDIO=C:\Program 1305 Files\Microsoft Visual Studio </tt></b> If the path to Microsoft Developer Studio 1306 on your system differs from the default then change the appropriate definition 1307 of <b><tt>DEVSTUDIO</tt></b>. (Remember that there is a separate definition 1308 of <b><tt>DEVSTUDIO</tt></b> for each version of MSVC, so be sure to change 1309 the correct definition.) 1310<p>To run the <b><tt>make</tt></b> program, give the command 1311<blockquote><b><tt> 1312nmake -f src\msvc32.mak 1313</tt></b></blockquote> 1314 1315<p> 1316Rather than changing src/msvc32.mak, these values can be specified on the make 1317command line, I.e. 1318 1319<blockquote><b><tt> nmake -f src\msvc32.mak MSVC_VERSION=6 DEVSTUDIO="C:\Program Files\Microsoft Visual Studio" <br> 1320nmake -f src\msvc32.mak MSVC_VERSION=7 DEVSTUDIO="C:\Program Files\Microsoft Visual Studio .NET" 1321 </tt></b></blockquote> 1322 1323<p> Note that double quotes have been added around the path for <b><tt>DEVSTUDIO</tt></b> 1324 due to the spaces in the path value. 1325<p> 1326This command line can also be put into a batch file. 1327 1328<p> You may get warning messages during compilation about <b><tt>/QI0f</tt></b> 1329 being an undefined switch, or the message "dwmain32.def: EXETYPE not supported 1330 for platform; ignored" during linking. Multiple warnings will also given about 1331 things like double to float data conversions. Ignore them. We have not found 1332 a way to create a single set of sources that does not create warnings with the 1333 different compilers and operating systems supported by Ghostscript. 1334<p> 1335The Microsoft VC++ 5.0 compiler locks up when compiling 1336<b><tt>gxi12bit.c</tt></b> with <b><tt>/O2</tt></b>. Compile this file 1337without <b><tt>/O2</tt></b>. 1338 1339<p> The Microsoft VC++ 5.0 compiler produces a non-working executable if compiling 1340 without stack checking. Don't change the setting <b><tt>TDEBUG=1</tt></b> in 1341 <b><tt>msvc32.mak</tt></b>. 1342 1343<h3><a name="Microsoft_build_64"></a>Microsoft Environment for 64-bit</h3> 1344 1345Building Ghostscript for 64-bit Windows (AMD64 processor) requires 1346Microsoft Visual Studio .NET 2005 beta on 64-bit Windows, 1347or Microsoft Visual Studio .NET 2003 and Windows Server 2003 DDK 1348on 32-bit Windows (cross-compile). 1349<p> 1350Compiling for 64-bit is similar to the 1351<a href="#Microsoft_build">Microsoft Environment</a> instructions above, 1352but with the addition of a WIN64 define. 1353 1354<h4><a name="Microsoft_64on32"></a>Cross compile on 32-bit Windows XP</h4> 1355Microsoft Visual Studio .NET 2003 is used for 32-bit compilation 1356of auxiliary programs used by the compile process, 1357while Windows Server 2003 Device Driver Kit (DDK) 1358is used for 64-bit compilation. 1359The DDK cross compilers for the IA64 and AMD64 processors, 1360however only AMD64 is supported by the makefile. 1361The DDK is not installed correctly by the setup program. 1362You need to copy <b><tt>msobj10.dll</tt></b> to the compiler 1363directory from a nearby directory. 1364<p> 1365To make ghostscript use 1366<blockquote><b><tt> 1367 nmake -f src/msvc32.mak WIN64= 1368</tt></b></blockquote> 1369This will fail when it tries to run genconf.exe. 1370Move <b><tt>./obj/genconf.exe</tt></b> to 64-bit Windows, then run it 1371<blockquote><b><tt> 1372 genconf arch.h 1373</tt></b></blockquote> 1374Move <b><tt>arch.h</tt></b> back to <b><tt>./obj/arch.h</tt></b>. 1375(Alternatively, use arch.h created by a 32-bit build and change 1376ARCH_ALIGN_PTR_MOD to 8, 1377ARCH_ALIGN_STRUCT_MOD to 16, 1378ARCH_SIZEOF_PTR to 8, 1379and ARCH_CACHE1_SIZE to 4194304). 1380Then restart the build 1381<blockquote><b><tt> 1382 nmake -f src/msvc32.mak WIN64= 1383</tt></b></blockquote> 1384 1385<p> 1386You can also use Microsoft Visual Studio .NET 2005 beta 1387to do a similar cross compile, but you will need to 1388change the DEVSTUDIO path. 1389 1390<h4><a name="Microsoft_64on64"></a>Compile on 64-bit Windows XP</h4> 1391To make ghostscript use 1392<blockquote><b><tt> 1393 nmake -f src/msvc32.mak WIN64= 1394</tt></b></blockquote> 1395The Microsoft Visual Studio .NET 2005 beta does not have 1396a "go live" licence. You are not permitted to distribute 1397executables created by this compiler. 1398<p> 1399The makefile currently uses the cross compiler (x86_amd64) 1400rather than the native compiler (amd64). 1401<p> 1402You can install Microsoft Visual Studio .NET 2003 on 140364-bit Windows, but you can't install Windows Server 2003 DDK. 1404You may be able to copy the DDK directory <b><tt>c:\winddk</tt></b> 1405from a 32-bit system to a 64-bit system and compile GS. 1406 1407<h4><a name="Self-extracting_executables"></a>Making self-extracting executables</h4> 1408 1409<p> 1410You can build self-extracting Windows executables of Ghostscript. (This is 1411not needed to use Ghostscript.) Currently this requires both the 1412Borland/Inprise and the Microsoft compilers, and also two pieces of 1413third-party software: 1414 1415<ul> 1416<li><b><tt>WinZipSE</tt></b>, available from <a 1417href="http://www.winzip.com/winzipse.html" 1418class="offsite">http://www.winzip.com/winzipse.html</a>. 1419This is not free. 1420<li><b><tt>zip</tt></b>, available from <a 1421href="http://www.info-zip.org/pub/infozip/Zip.html" class="offsite"> 1422http://www.info-zip.org/pub/infozip/Zip.html</a>. This is free. 1423</ul> 1424 1425<p> 1426You will have to edit <b><tt>src/winint.mak</tt></b> to define 1427<b><tt>WINZIPSE_XE</tt></b> and <b><tt>ZIP_XE</tt></b> respectively as the 1428path names of these programs. See <a href="Release.htm">Release.htm</a> for 1429the detailed procedure. 1430 1431<h3><a name="Watcom_build"></a>Watcom environment</h3> 1432 1433<p> 1434To use the Watcom compiler, add to <b><tt>AUTOEXEC.BAT</tt></b> the line 1435"<b><tt>set DOS4G=quiet</tt></b>". Check that 1436<b><tt>AUTOEXEC.BAT</tt></b> also contains a line of the form 1437"<b><tt>set WATCOM=</tt></b><em>{wcdir}</em>" where <em>{wcdir}</em> is 1438the directory where you installed the Watcom tools, and that the setting of 1439<b><tt>PATH</tt></b> includes <em>{wcdir}</em><b><tt>\binnt</tt></b> (or 1440<b><tt>%WATCOM%\binnt</tt></b>) before <em>{wcdir}</em><b><tt>\binw</tt></b> 1441(or <b><tt>%WATCOM%\binw</tt></b>). Then to create 1442"<b><tt>makefile</tt></b>": 1443 1444<blockquote><table cellpadding=0 cellspacing=0> 1445<tr> <th align=left>For 1446 <td> 1447 <th align=left>Give the command 1448<tr> <td colspan=3><hr> 1449<tr> <td>MS Windows 1450 <td> 1451 <td nowrap><b><tt>echo !include src\watcw32.mak >makefile</tt></b> 1452</table></blockquote> 1453 1454<p> 1455Before compiling, change the definition of the <b><tt>WCVERSION</tt></b> 1456macro in the makefile (<b><tt>watcw32.mak</tt></b>) to the version of the Watcom compiler you are 1457using. This is necessary to handle some minor incompatibilities between 1458versions. 1459 1460<p> 1461To run the <b><tt>make</tt></b> program, give the commmand 1462 1463<blockquote> 1464<b><tt>wmake -u</tt></b> 1465</blockquote> 1466 1467<h3><a name="Cygwin32_build"></a>Cygwin32 gcc</h3> 1468 1469<p> 1470A user reports that it is possible to compile Ghostscript for MS Windows NT 1471using the Cygwin32 gcc compiler, GNU <b><tt>make</tt></b>, and the 1472<b><tt>unix-gcc.mak</tt></b> makefile, with only two small source code 1473changes: 1474 1475<ul> 1476<li>Add "<b><tt>b</tt></b>" to the call to <b><tt>fopen</tt></b> in <b><tt>gp_open_scratch</tt></b> 1477<li>Mirror the <b><tt>gp_ntfs</tt></b> logic for <b><tt>gp_pathstring_not_bare</tt></b> 1478</ul> 1479 1480<p> 1481Information about this compiler and environment is at the Cygnus site: 1482 1483<blockquote> 1484<a href="http://sources.redhat.com/cygwin/">http://sources.redhat.com/cygwin/</a> 1485</blockquote> 1486 1487<p> 1488Please note that Cygnus's licensing terms aren't quite as liberal about 1489redistribution as either the GNU 1490<a href="http://www.gnu.org/copyleft/gpl.html">General Public License</a> 1491or the Aladdin <a href="Public.htm">Free Public License</a>, so read their 1492license carefully if you want to redistribute the results of using their 1493compiler. 1494 1495<h3><a name="IntelWin32_build"></a>Intel C/C++ environment</h3> 1496 1497<p> 1498Intel provides a C/C++ compiler that is compatible with the <a 1499href="#Microsoft_build">Microsoft Visual C++ environment</a>. The main 1500advantage of this compiler over MSVC 5.0 and 6.0 is that it produces 1501working code even when all optimizations are enabled and when stack checking 1502is disabled. 1503 1504<p> 1505To build Ghostscript using the Intel C/C++ compiler, you have to make the 1506following small changes in the makefiles: 1507 1508<ul> 1509<li>Find and change the second occurrence of 1510"<b><tt>COMPILE_FULL_OPTIMIZED</tt></b>" to "<b><tt>/O2</tt></b>" in file 1511<b><tt>msvccmd.mak</tt></b>. <li>Override "<b><tt>TDEBUG</tt></b>", 1512"<b><tt>COMP</tt></b>", and "<b><tt>COMPAUX</tt></b>" when invoking 1513<b><tt>nmake</tt></b>. 1514</ul> 1515 1516<p> 1517More specifically, use "<b><tt>TDEBUG=0</tt></b>" and set both 1518"<b><tt>COMP</tt></b>" and "<b><tt>COMPAUX</tt></b>" to the full path of 1519<b><tt>icl</tt></b> (for example 1520"<b><tt>COMP=C:\intel\compiler45\bin\icl</tt></b>" if the Intel C/C++ 1521compiler V4.5 was installed to <b><tt>C:\intel</tt></b>). It is suggested 1522that you use a batch file to launch <b><tt>nmake</tt></b>, since the command 1523line processes the "<b><tt>=</tt></b>" on its own. Also, you may need to 1524execute <b><tt>vcvars32.bat</tt></b> and <b><tt>iccvars.bat</tt></b> to 1525register the proper paths for the compiler, its include files and its 1526libraries. 1527 1528<p> 1529You can buy or download a 30-day evaluation version of the Intel C/C++ 1530compiler from Intel's Software Performance Tools web site: 1531 1532<blockquote> 1533<a href="http://www.intel.com/vtune/">http://www.intel.com/vtune/</a> 1534</blockquote> 1535 1536<hr> 1537 1538<h2><a name="Mac_build"></a>How to build Ghostscript from source (MacOS version)</h2> 1539 1540<h3><a name="MacOS"></a>Traditional MacOS</h3> 1541 1542<p> 1543The Macintosh version of Ghostscript requires the <a href="http://www.metrowerks.com/" 1544class="offsite">Metrowerks Codewarrior</a> development suite. Download the 1545<tt>macgs-7xx-src.sit</tt> source archive from the location listed 1546below. This includes a Codewarrior .mcp project file than can be used to build both 1547Carbon and CFM versions of the ghostscript shared library component. 1548 1549<blockquote> 1550<a href="ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/currenti/" 1551 class="offsite">ftp://mirror.cs.wisc.edu/pub/mirrors/ghost/AFPL/current/</a> 1552</blockquote> 1553 1554<p> 1555If your system doesn't automatically unpack the source archive, you can 1556download the free <a href="http://stuffit.com/download.html" 1557class="offsite">Stuffit Expander</a> to open it. 1558 1559<p> 1560This archive includes appropriate versions of the jpeg, zlib and libpng 3rd party 1561library source for convenience. You must still download the fonts and place them in an 1562appropriate location, along with the contents of the <tt>lib</tt> directory from the source 1563archive. 1564 1565<p> 1566Note that since this is just a library component, you will need a front-end application, such as 1567MacGSView, to actually view or convert postscript and pdf documents. 1568 1569 1570<h3><a name="MacOSX"></a>MacOS X</h3> 1571 1572<p> 1573The unix source distribution (.tar.gz) builds fine on Darwin/MacOS X, 1574albeit without a display device. You can generally just use the <tt>Makefile</tt> 1575generated by ./configure or <tt>macosx.mak</tt> 1576as your top-level makefile and get a reasonable default build. This will 1577allow you to use Ghostscript from the command line as a BSD-layer tool 1578to rasterize postscript and pdf to image files, and convert between the 1579high-level formats supported by Ghostscript. See the instructions for the 1580unix build below for details of how to customize this build. 1581 1582<p> 1583There is also a support for building Ghostscript as a framework. This is 1584a special encapsulated shared library format specific to MacOS X. To build 1585the framework, copy <tt>macosx.mak</tt> to the top-level directory, rename it to 1586<tt>makefile</tt> and issue 'make framework' from Terminal.app. This will result 1587in a <tt>Ghostscript.framework</tt> in the <tt>sobin</tt> directory. It must be 1588manually copied to /Library/Frameworks/ before applications 1589can use it. You may need to create the Frameworks/ directory on some systems. 1590 1591<p> 1592Finally, there is a <tt>macos-mcp.mak</tt> makefile that can be 1593used to set up the Codewarrior shared library component build described 1594in the section on <a href="#MacOS">Classic MacOS</a> above. Currently 1595this makefile is distributed only with the MacOS-specific <tt>.sit</tt> 1596source archive, but with be included generally in future releases. 1597 1598<p> 1599To set up the shlib build, download and uncompress the Ghostscript source. 1600If the archive doesn't contain the 3rd party jpeg, png, and zlib source, 1601you must download them as described at the beginning of this document and 1602unpack them under the macgs-###-src directory under the specific names 1603<tt>jpeg</tt>, <tt>zlib</tt> and <tt>libpng</tt>. You cannot use symlinks as 1604Codewarrior will not be able to follow them for some of the needed header 1605files. 1606 1607<p> 1608Copy <tt>src/macos-mcp.mak</tt> to the top-level directory and rename 1609it <tt>makefile</tt>. Then run 'make' in that directory, either from 1610within Terminal.app or through Project Builder. This will set up the 1611generated code required for the build and run a shell script to generate 1612<tt>ghostscript.mcp.xml</tt>. Launch Metrowerks Codewarrior, and select 1613'Import Project...' from the File menu, and open the xml project file. 1614When asked, save the results as <tt>ghostscript.mcp</tt> in the same 1615directory and you should be ready to build the shared library component. 1616 1617</p> 1618Tradtional ('PPC') applications based on the Code Fragment Manager 1619will not be able to open the shlib linked with CarbonLib, so two 1620targets are provided, one with carbon and one without. 1621 1622<hr> 1623 1624<h2><a name="Unix_build"></a>How to build Ghostscript from source (Unix version)</h2> 1625 1626<p> 1627Ghostscript now ships with a build system for unix-like operating systems 1628based on GNU Autoconf. In general the following should work to configure 1629and build Ghostscript: 1630 1631<blockquote><pre> 1632./configure 1633make 1634</pre></blockquote> 1635 1636Please report any problems with this method on your system as a bug. 1637 1638<p> 1639For the convenience of those already familiar with Ghostscript, the old method 1640based on hand-edited makefiles is still supported. It may also be helpful in 1641getting Ghostscript to build on very old platforms. This section deals exclusively 1642with that older method and includes numerous pointers regarding legacy systems. 1643 1644<p> 1645Before issuing the <b><tt>make</tt></b> command to build Ghostscript, you 1646have to make some choices, for instance 1647<ul> 1648<li>which compiler to use; 1649<li>what features and devices to include; 1650<li>whether to use system libraries for PNG and zlib; 1651<li>and how to handle issues for your particular platform. 1652</ul> 1653 1654<p> 1655Be sure to check the sections on <a 1656href="#Tool_specific_issues">tool-</a>, <a 1657href="#OS_specific_issues">OS-</a>, and <a 1658href="#Hardware_specific_issues">hardware-</a>specific issues for notes 1659on your particular platform and compiler. In fact, that is the 1660<b><em>first</em></b> place to check if you build Ghostscript and it crashes 1661or produces obviously incorrect results. 1662 1663<h3><a name="Multi_architecture_makefile"></a>The multi-architecture makefile</h3> 1664 1665<p> 1666Especially if you are working in a Unix environment with multiple CPU types, 1667operating systems, and/or C compilers, you may find the file 1668<b><tt>all-arch.mak</tt></b> useful. This user-contributed file includes 1669"wrappers" for the Unix makefiles for many different common environments. 1670The author of this file notes: 1671 1672<blockquote> 1673 1674<p> 1675This makefile allows you to execute 1676 1677<pre> 1678 make `hostname` 1679</pre> 1680 1681<p> 1682on any machine on a network, without having to examine the Makefile for a 1683specific target name. Also, some of the targets in the Makefile incorporate 1684special changes in compiler options for certain files, to work around 1685compiler bugs that Ghostscript has been so good at exposing. Having that 1686special handling written down in a Makefile proves very convenient. 1687 1688<p> 1689I don't do "make install" until I've done 1690 1691<pre> 1692 cd ...build-directory.../gs-x.yz 1693 cd lib 1694 ../bin/gs ../examples/tiger.eps 1695</pre> 1696 1697<p> 1698and verified that the famous tiger can be correctly displayed. Also, the 1699"make install" step is careful to first remove any existing 1700<b><tt>$(BINDIR)/gs</tt></b>, then install a new gs there with a hard link 1701to gs-x.yz. 1702 1703<p> 1704That way, each installation makes gs a synonym for the latest release, 1705but earlier ones remain in place in case backtracking is needed, which 1706I've fairly often wanted to do when investigating changed behavior, or 1707a suspected bug. 1708 1709<p> 1710When I've been experimenting with a new feature, such as GNU readline 1711support, I change the setting of GS from gs to ngs (new gs), so as not 1712to break any existing programs by the installation of an experimental 1713version. 1714 1715</blockquote> 1716 1717<h3><a name="UNIX_makefile"></a>Setting up "makefile"</h3> 1718 1719<p> 1720The files <b><tt>src/unix</tt></b>*<b><tt>.mak</tt></b> are the makefiles for 1721Unix platforms, and you choose one based on what compiler you use. To 1722build Ghostscript, however, you must use the simple command 1723"<b><tt>make</tt></b>", which must find the file "<b><tt>makefile</tt></b>" 1724(or "<b><tt>Makefile</tt></b>"). If your system supports symbolic links, 1725set up "<b><tt>makefile</tt></b>" like this. 1726 1727<blockquote><table cellpadding=0 cellspacing=0> 1728<tr> <td>GNU gcc: 1729 <td> 1730 <td nowrap><b><tt>ln -s src/unix-gcc.mak makefile</tt></b> 1731<tr> <td>Non-gcc ANSI C compiler: 1732 <td> 1733 <td nowrap><b><tt>ln -s src/unixansi.mak makefile</tt></b> 1734</table></blockquote> 1735 1736<p> 1737If your system doesn't support symbolic links, first finish all changes to 1738the compiler-specific makefile, then make a hard link, omitting the 1739<b><tt>-s</tt></b> switch. 1740 1741<p> 1742The makefile distributed with Ghostscript selects the following devices 1743to include in the build: 1744 1745<blockquote><table cellpadding=0 cellspacing=0> 1746<tr><th colspan=3 bgcolor="#CCCC00"><hr><font size="+1">Devices included as distributed</font><hr> 1747<tr valign=bottom> 1748 <th align=left>Type 1749 <td> 1750 <th align=left>Devices 1751<tr> <td colspan=3><hr> 1752<tr valign=top> <td>Display 1753 <td> 1754 <td>X Windows 1755<tr valign=top> <td>Printers 1756 <td> 1757 <td>H-P DeskJets, LaserJets, and color DeskJets and PaintJets; Canon BubbleJets 1758<tr valign=top> <td>File formats 1759 <td> 1760 <td>Group 3 & Group 4 fax; JPEG; PCX; PBM, PGM, PKM, & PPM; TIFF; PostScript images; PNG; distilled PDF, PostScript, and EPS; PCL XL ("PCL 6") 1761</table></blockquote> 1762 1763<p> 1764The <b><tt>unix</tt></b>*<b><tt>.mak</tt></b> files explicitly compile and 1765link the JPEG, PNG, and zlib libraries into the executable. If your Unix 1766system already includes the PNG and zlib libraries -- probably in 1767<b><tt>/usr/lib/libpng.</tt></b>{<b><tt>a</tt></b>,<b><tt>so</tt></b>} and 1768<b><tt>/usr/lib/libz.</tt></b>{<b><tt>a</tt></b>,<b><tt>so</tt></b>} -- and 1769you would rather use those copies, change the definition of 1770<b><tt>SHARE_LIBPNG</tt></b> and <b><tt>SHARE_ZLIB</tt></b> from 0 to 1 in 1771the relevant <b><tt>unix</tt></b>*<b><tt>.mak</tt></b> file before 1772compiling. Note that if you do this, you will get non-debug versions of 1773these libraries even if you selected <b><tt>DEBUG</tt></b> in the makefile. 1774At the insistence of some users, we have also provided the ability to do 1775this with the JPEG library (<b><tt>SHARE_JPEG</tt></b>), but should not use 1776it: in order to be compatible with Adobe interpreters (which do not follow 1777the JPEG standard exactly), Ghostscript has to compile the IJG code with 1778the non-standard definition 1779 1780<blockquote><b><tt> 1781#define D_MAX_BLOCKS_IN_MCU 64 1782</tt></b></blockquote> 1783 1784<p> 1785and since shared versions of this library will not have been compiled this 1786way, you will get errors on some valid PostScript and PDF input files. Note 1787also that because not all the JPEG library header files that Ghostscript 1788uses are normally installed in <b><tt>/usr/include</tt></b>, you must have 1789the source code for this library available even if you set 1790<b><tt>SHARE_JPEG</tt></b> to 1. 1791 1792<p> 1793If the X11 client header files are located in some directory which your 1794compiler does not automatically search, you must change the 1795<b><tt>XINCLUDE</tt></b> macro in the makefile to include a specific 1796<b><tt>-I</tt></b> switch. See the comment preceding 1797<b><tt>XINCLUDE</tt></b> in the makefile. 1798 1799<p> 1800Currently Ghostscript is set up to compile and link in a generic Unix 1801environment. Some Unix environments may require changing the 1802<b><tt>LDFLAGS</tt></b> macro in the makefile; be sure to check the <a 1803href="#Unix_build">Unix section</a> for your specific tools, operating 1804system, and hardware. 1805 1806<h3><a name="Shared_object"></a>Shared object</h3> 1807To build Ghostscript as a shared object with gcc 1808(instead of as a single large executable) use: 1809<pre> 1810 ln -s src/unix-gcc.mak makefile 1811 make so 1812</pre> 1813<p> 1814This will build <b><tt>libgs.so</tt></b> and two programs which use the 1815shared object, <b><tt>gsx</tt></b> which uses Gtk+ and <b><tt>gsc</tt></b> 1816which does not. 1817 1818<p> 1819Do not use <tt>make -f src/unix-gcc.mak</tt> because this will 1820break the recursive make used in building the shared object. 1821<p> 1822To install the shared object and these two programs: 1823<pre> 1824 make soinstall 1825</pre> 1826To delete files created by the build process: 1827<pre> 1828 make soclean 1829</pre> 1830<p> 1831For more details see <a href="../src/unix-dll.mak">unix-dll.mak</a>. 1832 1833<h3><a name="Tool_specific_issues"></a>Tool-specific issues</h3> 1834 1835<h4><a name="gcc_27x"></a>gcc 2.7.*</h4> 1836 1837<p> 1838Some of the issues in using gcc are very specific to the particular 1839computer, the particular version of the operating system, and the 1840particular version of gcc available to you. You can check the version of 1841gcc with the <b><tt>gcc --version</tt></b> command. 1842 1843<p> 1844An optimizer bug in gcc versions 2.7.0, 2.7.1, and 2.7.2 causes the 1845compiler to generate incorrect code. The makefile works around this, but 1846we recommend that if possible you use either an earlier or a later version 1847of gcc; for instance, gcc 2.5.8, gcc 2.6.3, 2.7.2.1 or later which don't 1848have this bug. Note, however, that gcc has other problems on some 1849platforms, so please read the section for your specific platform. 1850 1851<h4><a name="GNU_make"></a>GNU make</h4> 1852 1853<p> 1854Current versions of GNU <b><tt>make</tt></b> have no problems, but GNU 1855<b><tt>make</tt></b> 3.59 can't handle the final linking step in some 1856cases; if this happens, use the platform's standard <b><tt>make</tt></b>, 1857typically <b><tt>/bin/make</tt></b>. 1858 1859<h3><a name="OS_specific_issues"></a>OS-specific issues</h3> 1860 1861<h4><a name="386_Unix"></a>386 Unix</h4> 1862 1863<ul> 1864<li>gcc versions older than 1.38 on Intel 80386 systems do not compile 1865Ghostscript correctly with the <b><tt>-O</tt></b> option. 1866 1867<li>gcc 1.39 under <b><tt>386BSD</tt></b> has a bug that causes 1868float-to-integer conversions to compile incorrectly, rendering the 1869executable unusable. 1870 1871<li>X11R5 may need "<b><tt>#include <stddef.h></tt></b>" in <b><tt>x_.h</tt></b>. 1872 1873<li>Also see regarding <a href="#System_V">System V</a> platforms. 1874</ul> 1875 1876<h4><a name="BSDI"></a>BSDI</h4> 1877 1878<ul> 1879 1880<li>Use <b><tt>unix-gcc.mak</tt></b> and set<blockquote><b><tt> 1881STDLIBS=-lm<br> 1882XINCLUDE=-I/usr/X11R6/include<br> 1883XLIBDIRS=-L/usr/X11R6/lib<br> 1884XLIBS=Xt SM ICE Xext X11<br></tt></b></blockquote> 1885 1886<li>If you want to use the shared versions of the PNG and zlib libraries, set 1887<b><tt>SHARE_LIBPNG=1</tt></b> and <b><tt>SHARE_ZLIB=1</tt></b> 1888as discussed <a href="#UNIX_makefile">previously</a>. 1889 1890<li>BSD <b><tt>make</tt></b> uses a different syntax for its 1891<b><tt>include</tt></b> directive than Ghostscript; 1892use <b><tt>gmake</tt></b> instead. 1893</ul> 1894 1895<h4><a name="Digital_Unix"></a>Digital Unix (Alpha)</h4> 1896 1897<ul> 1898 1899<li>Use <b><tt>unixansi.mak</tt></b> for all Digital Unix compilers. 1900 1901<li>For versions of Digital Unix before 4.0, set 1902 1903<p> 1904<b><tt>CFLAGS=-std -migrate -Olimit 1000 -g3 -O2 $(XCFLAGS)<br> 1905LDFLAGS=-lots $(XLDFLAGS)</tt></b> 1906 1907<p> 1908You may be able to omit <b><tt>-g3</tt></b>. For later versions of Digital 1909Unix, users have reported that the proper flags are 1910 1911<p> 1912<b><tt>CFLAGS=-std1 -Olimit 1000 -g3 -O2 $(XCFLAGS)</tt></b> 1913 1914<p> 1915again, optionally omitting the <b><tt>-g3</tt></b>. 1916 1917<li>If you get compiler error messages about "ANSI aliasing rules", please 1918see the section about <a href="#VMS_build">building under OpenVMS</a> below. 1919 1920</ul> 1921 1922<h4><a name="Linux"></a>Linux</h4> 1923 1924<ul> 1925<li>If you build on Linux with X11 R6 or later, you may get link-time error 1926messages about undefined references to various functions beginning with 1927"SMC" and "ICE". If this happens, make sure that <b><tt>XLIBS</tt></b> in 1928the makefile is set to 1929"<b><tt>Xt SM ICE Xext X11</tt></b>" rather than 1930"<b><tt>Xt Xext X11</tt></b>". 1931 1932<li>On very old systems (circa gcc version 2.6.3), you may encounter an incompatibility 1933in object formats (a.out vs. ELF) with the XFree86 library. 1934Typically, <b><tt>ld</tt></b> complains that some X library is not found, 1935or that many <b><tt>Xlib</tt></b> or <b><tt>Xt</tt></b> functions are not 1936found in the library (similar to the messages for omitting 1937<b><tt>SM</tt></b> and <b><tt>ICE</tt></b> from <b><tt>XLIBS</tt></b>). Or 1938you get a message when you start Ghostscript that the program or the shared 1939library is an unrecognized format. 1940If this happens, edit your top-level makefile to add the switches 1941"<b><tt>-b i486-linuxaout</tt></b>" to both <b><tt>CFLAGS</tt></b> and 1942<b><tt>LDFLAGS</tt></b>, then "<b><tt>make clean</tt></b>" followed by 1943"<b><tt>make</tt></b>"). If this doesn't help, or if other strange things 1944happen, contact your Linux supplier or support resource. 1945 1946<li>A few of Ghostscript's drivers are multi-threaded. None of them are 1947in the default build. Currently the only ones are the "bmpa" series. 1948These drivers require <b><tt>libc</tt></b> 1949version 6 or higher. Most distributions include this, but it may be 1950an issue on very old systems. 1951</ul> 1952 1953 1954<h4><a name="NeXTSTEP"></a>NeXTSTEP / OpenSTEP</h4> 1955 1956<ul> 1957<li>If you are using a NeXTSTEP version before 3.3, please get a no-cost 1958upgrade (along with Y2K patches) from Apple. 1959 1960<li>If '<tt>./configure && make</tt>' fails, then for all NeXTSTEP systems, use 1961<b><tt>unix-gcc.mak</tt></b> and make the following changes: 1962 1963<ul> 1964<li>In <b><tt>unix-aux.mak</tt></b> (and <b><tt>ugcclib.mak</tt></b>, if you 1965are using only the library) change the definition of <b><tt>INCLUDE</tt></b> 1966to "<b><tt>INCLUDE=/usr/include/bsd</tt></b>"; 1967 1968<li>in <b><tt>unix-gcc.mak</tt></b>: 1969 1970<ul> 1971<li>change <b><tt>CC=gcc</tt></b> to <b><tt>CC=cc</tt></b>; 1972 1973<li>change the definition of <b><tt>STDLIBS</tt></b> to only 1974<b><tt>-lm</tt></b>; 1975 1976<li>change <b><tt>SYNC=posync</tt></b> to <b><tt>SYNC=nosync</tt></b>; 1977 1978<li>add <b><tt>-D_POSIX_SOURCE</tt></b> to <b><tt>CFLAGS</tt></b> and remove 1979<b><tt>-g</tt></b>; 1980 1981<li>remove <b><tt>-Wstrict-prototypes</tt></b> from <b><tt>GCFLAGS</tt></b>, 1982and if you are using NeXTSTEP 3.3 (with gcc 2.5.8), also remove 1983<b><tt>-Wmissing-declarations</tt></b>; 1984</ul> 1985 1986<li>to the end of <b><tt>Fontmap.GS</tt></b> add the line 1987"<b><tt>/Ohlfs /Courier ;</tt></b>". 1988</ul> 1989 1990<li>If you are running the Pencom co-Xist X server (development version), 1991the X headers and libraries are in the default places, so change the 1992makefile definitions of <b><tt>XINCLUDE</tt></b> and 1993<b><tt>XLIBDIRS</tt></b> to empty strings. 1994</ul> 1995 1996<h4><a name="SCO"></a>SCO Unix/Xenix</h4> 1997 1998<ul> 1999<li>See also "<a href="#386_Unix">386 Unix</a>" and 2000"<a href="#System_V">System V Unix platforms</a>". 2001 2002<li>The standard cc compiler on SCO OpenServer v5 has optimizer bugs. 2003Compile without -O. 2004 2005<li>The SCO Unix C compiler apparently can't handle the 2006<b><tt>P</tt></b><em>n</em> macros in <b><tt>std.h</tt></b>. If you get 2007strange compilation errors on SCO Unix, ask SCO for a compiler fix. 2008 2009<li>Meanwhile, to use gcc with SCO ODT, see <b><tt>unix-gcc.mak</tt></b> 2010for the appropriate switch settings. 2011 2012<li>Because of a bug in SCO's floating point emulator, gcc 2.3.3 produces 2013code that causes crashes on machines without hardware floating point. Use 2014a different compiler on these machines. 2015 2016<li>If you aren't using the X11 driver, you must add 2017<b><tt>-lsocket</tt></b> to the value of <b><tt>EXTRALIBS</tt></b> to link 2018the date and time functions. 2019 2020<li>If you want to use direct frame buffer addressing instead of X Windows, 2021include the relevant frame buffer devices (<b><tt>$(DD)ega.dev</tt></b>, 2022<b><tt>$(DD)vga.dev</tt></b>, etc.) and change the definition of 2023<b><tt>EGAVGA</tt></b> to <b><tt>$(EGAVGA_SCO)</tt></b> as indicated in 2024<b><tt>devs.mak</tt></b>. <b>Note</b>: this works with SuperVGA displays 2025only for 800x600x16 mode. 2026 2027<li>If the display looks "smeared", try recompiling 2028<b><tt>gdevpcfb.c</tt></b> with <b><tt>-O0</tt></b>. 2029 2030<li>If Ghostscript crashes, use the <b><tt>-q</tt></b> switch or redirect 2031console output to a file. 2032 2033<li>If your compiler accepts both the <b><tt>-Xt</tt></b> and 2034<b><tt>-Xa</tt></b> switches, use <b><tt>-Xt</tt></b>. Even though this 2035causes the compiler to use incorrect rules for computing the result types 2036of "<b><tt><<</tt></b>" and "<b><tt>>></tt></b>", 2037<b><tt>-Xa</tt></b> enables optimizations that produce incorrect code. 2038 2039<li>For SCO ODT 2.0, in addition to <b><tt>-D__SVR3</tt></b> and 2040<b><tt>-DSYSV</tt></b>, you need to specify <b><tt>-Dsco</tt></b>, 2041<b><tt>-DUSG</tt></b>, and <b><tt>-DMALLOC_0_RETURNS_NULL</tt></b>. For 2042SCO ODT, you need 2043"<b><tt>EXTRALIBS=-lX11 -lsocket -lmalloc</tt></b>", or maybe 2044only <b><tt>-lsocket</tt></b> depending on the version), and for SCO ODT 20452.0, you must also specify <b><tt>-lc_s</tt></b>. For SCO Xenix, you need 2046"<b><tt>EXTRALIBS=-lmalloc</tt></b>". 2047 2048<li>For SCO OpenServer 5.0.5, add <b><tt>-L/usr/local/lib</tt></b> to 2049<b><tt>LDFLAGS</tt></b>. 2050 2051<li>For all SCO systems, set "<b><tt>XINCLUDE=</tt></b>" and 2052"<b><tt>XLIBDIRS=</tt></b>". 2053</ul> 2054 2055<h4><a name="SVR4"></a>SVR4 Unix</h4> 2056 2057<ul> 2058<li>You may need to set <b><tt>EXTRALIBS=-lnsl</tt></b>. 2059 2060<li>Do <b><em>not</em></b> change <b><tt>PLATFORM=unix_</tt></b> to <b><tt>PLATFORM=sysv_</tt></b>. 2061 2062<li>On SVR4 Unix platforms with dynamic linking, you may need to define 2063<b><tt>XLIBDIR</tt></b> as the name of the directory that holds the X 2064Windows libraries. Do <b><em>not</em></b> prefix the name with 2065"<b><tt>-L</tt></b>". 2066 2067<li>For SVR4.0 systems, set <b><tt>-DSVR4</tt></b> and 2068<b><tt>-DSVR4_0</tt></b> in the makefile; do <b><em>not</em></b> set 2069<b><tt>-DSYSV</tt></b>. For SVR4.2 (or later) and Solaris 2.<em>n</em> 2070systems, set only <b><tt>-DSVR4</tt></b> (<b><em>not</em></b> 2071<b><tt>-DSVR4_0</tt></b> nor <b><tt>-DSYSV</tt></b>). 2072</ul> 2073 2074<h4><a name="System_V"></a>System V Unix platforms</h4> 2075 2076<ul> 2077<li>If you are using a stock System V platform that lacks 2078<b><tt>rename</tt></b> and <b><tt>gettimeofday</tt></b>, in the makefile 2079change "<b><tt>PLATFORM=unix_</tt></b>" to 2080"<b><tt>PLATFORM=sysv_</tt></b>". 2081 2082<li>You will probably need to change the definition of 2083<b><tt>INSTALL</tt></b> from "<b><tt>install</tt></b>" to 2084"<b><tt>/usr/ucb/install</tt></b>". 2085</ul> 2086 2087<h4><a name="Unixware"></a>Unixware</h4> 2088 2089<ul> 2090<li>The standard cc compiler has optimizer bugs. Compile without 2091<b><tt>-O</tt></b>. 2092</ul> 2093 2094<h3><a name="Hardware_specific_issues"></a>Hardware-specific issues</h3> 2095 2096<h4><a name="Alpha_with_gcc"></a>Alpha with gcc</h4> 2097 2098<ul> 2099<li>You don't have to use gcc on Alpha systems, because the bundled 2100compiler works. 2101 2102<li>The Alpha code generator in gcc 2.7.2.1 is broken. gcc 2.5.8 and 2.6.3 2103are probably usable. Versions before 2.5.0 are believed not to work. We 2104suggest you use a recent version. 2105</ul> 2106 2107<h4><a name="Apollo"></a>H-P Apollo</h4> 2108 2109<ul> 2110 2111<li>You must run the compiler in ANSI-compatible mode (that is, set <b><tt>AK=</tt></b>{null string} in the makefile); otherwise it gives incorrect error 2112messages for any function declared as returning a float value. 2113 2114<li>The H-P Apollo compiler may not compile Ghostscript correctly. If you 2115get unexpected crashes at run time, use gcc. 2116</ul> 2117 2118<h4><a name="ATT_7040"></a>AT&T 7040 R3</h4> 2119 2120<ul> 2121<li>If Ghostscript crashes on startup, recompile with <b><tt>-O0</tt></b> 2122to work around compiler bugs. 2123</ul> 2124 2125<h4><a name="Convex"></a>Convex</h4> 2126 2127<ul> 2128 2129<li>Use <b><tt>unixansi.mak</tt></b>. Do not invoke optimization 2130(<b><tt>-O1</tt></b>) because the compiler will produce incorrect code. 2131 2132<li>Set <b><tt>CFLAGS</tt></b> to 2133"<b><tt>-no -fn -tm c1</tt></b>". 2134</ul> 2135 2136<h4><a name="DECStations"></a>DECStations with Ultrix</h4> 2137 2138<ul> 2139 2140<li>If you get the compiler message "cfe: Fatal: _temp_19086.c: 2141Segmentation violation" or a similar one, try compiling with the 2142<b><tt>-oldc</tt></b> switch. 2143 2144<li>You may wish to set 2145 2146<p> 2147<b><tt>GS_LIB_DEFAULT=$(gsdatadir):/usr/lib/DPS/outline/decwin:$(gsdatadir)/fonts</tt></b> 2148 2149<p> 2150in the makefile to add the Display PostScript font directory to the font 2151search path. 2152 2153<li>Set 2154 2155<p> 2156<b><tt>CFLAGS="-Olimit 2500"</tt></b> 2157 2158<p> 2159to make the optimizer allocate enough table space. 2160 2161<li>The Ultrix 4.4 C compiler compiles <b><tt>gdevm1.c</tt></b> 2162incorrectly. Insert the following line in the makefile rule for 2163"<b><tt>gdevm1.$(OBJ)</tt></b>" (the body of the rule is empty in the 2164standard distribution): 2165 2166<p> 2167<b><tt>$(CCC) -oldc gdevm1.c</tt></b> 2168</ul> 2169 2170<h4><a name="HP_RISC"></a>H-P RISC workstations</h4> 2171 2172<ul> 2173 2174<li>HP-UX versions before 11.0 do not support POSIX threads. Set 2175<b><tt>SYNC=nosync</tt></b> in the makefile before building. 2176 2177<li>Ghostscript builds on H-P machines with either GNU gcc or H-P's 2178ANSI-capable <b><tt>cc</tt></b>. The minimal, non-ANSI-capable 2179<b><tt>cc</tt></b> that shiped with some basic HPUX system does <em>not</em> 2180work. If <b><tt>cc</tt></b> on your system doesn't accept the 2181<b><tt>-Aa</tt></b> switch, then you need to get the full 2182<b><tt>cc</tt></b> or gcc. 2183 2184<li>If you use H-P's compiler, be sure you have upgraded to a recent 2185release. Many bizarre symptoms have been reported trying to build 2186Ghostscript with older, buggier compilers, for example: 2187<ul> 2188<li>The link step fails with a message about "<b><tt>max</tt></b>" not being defined. 2189<li>The build succeeds, but the resulting executable fails to start up, 2190with an error message like "Initializing... Unrecoverable error: typecheck 2191in .registerencoding". 2192<li>The build succeeds, but the resulting executable produces a black 2193background on the first page of output. 2194</ul> 2195 2196<li>It is reported that On HPUX 9.* you need at least compiler patch 2197PHSS_5723 and dld.sl patch PHSS_5734 to build Ghostscript. (As of late 21981997, those patches are long obsolete; the current patches are compiler 2199PHSS_10357 and dld.sl PHSS_11246. It is unknown whether current 2200Ghostscript releases work with compiler/dld.sl versions older than these.) 2201 2202<li>On HPUX 10.*, we don't know what combinations of compiler version and 2203switches work. It is reported that On HPUX 10.20, setting 2204"<b><tt>CC=c89</tt></b>" and "<b><tt>CFLAGS=+O3 $(XCFLAGS)</tt></b>" 2205works, contradicting the information in the next paragraph, but this may be 2206dependent on the specific compiler version. 2207 2208<li>In either HPUX version, you need to set 2209"<b><tt>CC=cc -Aa</tt></b>" (or use <b><tt>-Ae</tt></b> if you 2210prefer), and set 2211"<b><tt>CFLAGS=-D_HPUX_SOURCE -O $(XCFLAGS)</tt></b>". Higher 2212levels of optimization than <b><tt>-O</tt></b> may work depending on your 2213compiler revision; some users have reported success with 2214<b><tt>+O3</tt></b>, some have not. 2215 2216<li>Some users have reported needing <b><tt>-DNOSYSTIME</tt></b> and 2217<b><tt>-D_POSIX_SOURCE</tt></b> in <b><tt>CFLAGS</tt></b>, but recent tests 2218do not show these to be necessary. 2219 2220<li>If you use gcc, it's a good idea to have a recent release -- at the 2221very least 2.7.2.1 or later.You may be able to get a working 2222executable with an older gcc by removing <b><tt>-O</tt></b> from 2223<b><tt>CFLAGS</tt></b>. 2224</ul> 2225 2226<h4><a name="Intergraph"></a>Intergraph Clipper</h4> 2227 2228<ul> 2229<li>Recommended settings are: 2230 2231<p> 2232<b><tt>XCFLAGS=-w -Q -DSYSV -D__SVR3<br> 2233EXTRALIBS=-lbsd -lc_s<br> 2234CC=acc -knr<br> 2235PLATFORM=sysv_</tt></b><br> 2236 2237<li>You will probably need to change the value of <b><tt>XLIBS</tt></b> from 2238"<b><tt>XLIBS=Xt X11 Xext</tt></b>" to "<b><tt>XLIBS=Xt_s X11_s Xext</tt></b>". 2239</ul> 2240 2241<h4><a name="MIPS"></a>MIPS</h4> 2242 2243<ul> 2244<li>There is apparently a bug in older versions of the MIPS C compiler 2245which causes <b><tt>gxdither.c</tt></b> to compile incorrectly if 2246optimization is enabled (<b><tt>-O</tt></b>). However, this bug is 2247definitely fixed in MipsPRO C version 6.00; with this version, compiling 2248with "<b><tt>-O2 -mips2</tt></b>" produces good output. 2249</ul> 2250 2251<h4><a name="NCR_3550"></a>NCR 3550</h4> 2252 2253<ul> 2254<li>With the NCR C Development Toolkit you must use <b><tt>-O0</tt></b>. 2255</ul> 2256 2257<h4><a name="Pyramid"></a>Pyramid MIServer-S</h4> 2258 2259<p> 2260See "<a href="#ATT_7040">AT&T 7040 R3</a>". 2261 2262<h4><a name="RS6000"></a>IBM RS/6000 with AIX</h4> 2263 2264<ul> 2265 2266<li>Many versions of the AIX C compiler have bugs that have prevented 2267Ghostscript from compiling and linking properly. We believe that the 2268current Ghostscript release works around these bugs, and that 2269<b><tt>unixansi.mak</tt></b> with <b><tt>CC=cc</tt></b> should work. 2270 2271<li>You must also edit the makefile (<b><tt>unixansi.mak</tt></b>) to change 2272<b><tt>INSTALL</tt></b> to <b><tt>/usr/ucb/install</tt></b>. 2273 2274<li>AIX doesn't use a separate library for multi-thread support: set 2275<b><tt>STDLIBS=-lm</tt></b> in the makefile. 2276 2277<li>If <b><tt>-DSYSV</tt></b> produces a complaint about the functions 2278<b><tt>index</tt></b> and <b><tt>rindex</tt></b> not being defined, try 2279removing it. 2280 2281<li>If the xlc 1.2.1 optimizer runs out of memory, you may need to add 2282<b><tt>-qmaxmem=4000</tt></b> to <b><tt>CFLAGS</tt></b>. 2283 2284<li>A user reports that the AIX C compiler shipped with AIX 3.2.5 compiles 2285Ghostscript only if invoked with "<b><tt>c89 -D_POSIX_SOURCE</tt></b>" 2286and <b><em>without</em></b> <b><tt>-O</tt></b>. On the other hand, another 2287user reports successful compilation using <b><tt>unix-ansi.mak</tt></b> and 2288the command line 2289 2290<p> 2291<b><tt>make CC=c89 XCFLAGS="-DOSY_AIX -D_ALL_SOURCE -qnoro -qmaxmem=3000 -bfl" $*</tt></b><br> 2292 2293<li>Apparently some (but not all) releases of the C library declare the 2294<b><tt>hypot</tt></b> function: if the declaration in 2295<b><tt>math_.h</tt></b> produces an error message, try removing it. 2296 2297<li>The IBM X11R3 server is known to be buggy: use the MIT X server if 2298possible. 2299 2300<li>The xlc 1.3.0.x compiler provided in AIX 3.2.5+ definitely will not 2301compile Ghostscript correctly if <b><tt>-O</tt></b> is used on all files. 2302A user reports that compiling <b><tt>z</tt></b>*<b><tt>.c</tt></b>, 2303<b><tt>gsmatrix.c</tt></b>, <b><tt>gxstroke.c</tt></b> without 2304<b><tt>-O</tt></b> is sufficient to produce a working executable:. 2305 2306<li>Some installations of AIX 3.2.5 have what appears to be an incorrect or 2307inconsistent version of <b><tt>libXt.a</tt></b> in 2308<b><tt>/usr/lpp/X11/lib</tt></b>. If linking shows 2309<b><tt>XtShellStrings</tt></b> and <b><tt>XtStrings</tt></b> as unresolved 2310externals, set 2311"<b><tt>XLIBDIRS=-L/usr/lpp/X11/lib/R5 -L/usr/lpp/X11/lib</tt></b>" 2312rather than just "<b><tt>XLIBDIRS=-L/usr/lpp/X11/lib</tt></b>". 2313 2314<li>Ghostscript has been successfully compiled and runs under AIX 4.3.3 and 2315the IBM C compiler version 5. The following changes were required in 2316unixansi.mak: 2317 2318<p> 2319<b><tt>CC=xlc</tt></b> 2320<br> 2321<b><tt>XCFLAGS=-qalign=natural</tt></b> 2322 2323</ul> 2324 2325<h4> 2326<a NAME="Silicon_Graphics"></a>Silicon Graphics</h4> 2327 2328<p> 2329Users have had a lot of problems with the MIPSpro compilers on SGI systems. 2330We recommend using gcc. If you do choose to use the MIPSpro compiler, 2331please read the following carefully. 2332 2333<ul> 2334<li> 2335To make the optimizer allocate enough table space, set 2336 2337<p><b><tt>CFLAGS="-Olimit 2500"</tt></b> (for older compilers) 2338<br><b><tt>CFLAGS="-OPT:Olimit=2500"</tt></b> (for newer compilers) 2339 2340<p> 2341MIPSpro compiler version 3.19 is "older", and 7.1 is "newer"; we aren't 2342sure at what point in between the latter syntax was introduced. 2343 2344<li> 2345With the compiler shipped with Irix 5.2, use the <b><tt>-ansi</tt></b> 2346option. 2347 2348<li> 2349The SGI C compiler may produce warnings about "Undefined the ANSI standard 2350library defined macro stdin/stdout/stderr". To suppress these warnings, add 2351"<b><tt>-woff 608</tt></b>" to the definition of <b><tt>CFLAGS</tt></b>. 2352 2353<li> 2354The SGI C compiler shipped with Irix 6.1 and 6.2 will not compile 2355<b><tt>zlib/deflate.c</tt></b> properly with optimization. Compile this file 2356separately without <b><tt>-O</tt></b>. 2357 2358<li> 2359With IRIX 6.5.x and the MIPSpro 7.x compilers there have been reports about 2360incorrect output and binaries that cause segmentation faults. Various 2361solutions have been suggested and you may want to try them in this order, 2362until you get a working binary: 2363 2364<ul> 2365<li> 2366Compile <b><tt>idict.c</tt></b> and <b><tt>isave.c</tt></b> separately 2367without optimization after doing a normal compile; then relink.e.g.: 2368 2369<p> 2370<b><tt>cc -OPT:Olimit=2500 -I. -I./obj -o ./obj/idict.o -c ./idict.c</tt></b><br> 2371<b><tt>cc -OPT:Olimit=2500 -I. -I./obj -o ./obj/isave.o -c ./isave.c</tt></b> 2372 2373<li> 2374Set <b><tt>CFLAGS=</tt></b> (no optimization). 2375 2376<li> 2377Use only <b><tt>-O2</tt></b>. Compiler produces incorrect output 2378with <b><tt>-O3</tt></b> or "<b><tt>-Ofast=ip32 -show</tt></b>". 2379 2380<li> 2381Irix 6.5.1m with MIPSpro compiler 7.2.1.1m, Irix 6.5.3m with MIPSpro 2382compiler 7.2.1, and probably other 6.5x / 7.2x combinations require 2383compiling with the <b><tt>-o32</tt></b> option. Compiling with the (default) 2384<b><tt>-n32</tt></b> option produces non-working executables. 2385<b><tt>-O2</tt></b> is OK (possibly except for <b><tt>idict.c</tt></b>), but 2386not <b><tt>-O3</tt></b>. 2387</ul> 2388</ul> 2389 2390<h4><a name="Sun"></a>Sun</h4> 2391 2392<ul> 2393<li>The Sun unbundled C compiler (SC1.0) doesn't compile Ghostscript 2394properly with the <b><tt>-fast</tt></b> option: Ghostscript core-dumps in 2395<b><tt>build_gs_font</tt></b>. With that compiler use <b><tt>-g</tt></b>, 2396or use gcc instead. 2397 2398<li>The Sun version of <b><tt>dbx</tt></b> often gives up with an error 2399message when trying to load Ghostscript. If this happens, use GNU 2400<b><tt>gdb</tt></b> instead. (<b><tt>gdb</tt></b> is more reliable than 2401<b><tt>dbx</tt></b> in other ways as well.) 2402 2403<li>A bug in some versions of <b><tt>zlib</tt></b> results in an undefined 2404symbol <b><tt>zmemcmp</tt></b> when compiling with Sun cc. Use gcc 2405instead. 2406</ul> 2407 2408<h4><a name="SunOS"></a>SunOS</h4> 2409 2410<ul> 2411<li>The <tt><b>tar</b></tt> program provided with SunOS 4.1.3 may not be 2412able to unpack the archives in the standard Ghostscript distribution. 2413Get a more recent version of <tt><b>tar</b></tt>, such as GNU 2414<tt><b>tar</b></tt>. 2415 2416<li>In SunOS 4.1.[23], you may get undefined symbols 2417<b><tt>_get_wmShellWidgetClass</tt></b> and 2418<b><tt>_get_applicationShellWidgetClass</tt></b> when linking. Compiling 2419"<b><tt>-Bstatic -lXmu -Bdynamic</tt></b>" appears to work for 2420SC1.0. For gcc, try adding <b><tt>-static</tt></b> to 2421<b><tt>CFLAGS</tt></b>. To solve the problem if you are using OpenWindows 24223.0 (X11R4-based Xt), ask Sun for patches 100512-02 and 100573-03. 2423</ul> 2424 2425<h4><a name="Solaris"></a>Solaris</h4> 2426 2427<ul> 2428<li>Solaris 2.2 may require setting "<b><tt>EXTRALIBS=-lsocket</tt></b>". 2429Solaris 2.3 and later seem to require "<b><tt>EXTRALIBS=-lnsl -lsocket -lposix4</tt></b>". 2430 2431<li>For Solaris 2.6 (and possibly some other versions), if you set 2432<b><tt>SHARE_LIBPNG=1</tt></b>, <b><tt>SHARE_ZLIB=1</tt></b>, or 2433<b><tt>SHARE_JPEG=1</tt></b>, you may need to set 2434 2435<p> 2436<b><tt>XLDFLAGS=-R /usr/local/</tt></b>xxx<b><tt>/lib:/usr/local/lib</tt></b> 2437 2438<p> 2439using the full path names of the relevant directories. 2440 2441<li>Solaris 2.<em>n</em> uses <b><tt>/usr/openwin/share/include</tt></b> 2442for the X11 libraries rather than <b><tt>/usr/local/X/include</tt></b>. 2443 2444<li>Solaris 2.<em>n</em> typically has Type 1 fonts in 2445<b><tt>/usr/openwin/lib/X11/fonts/Type1/outline</tt></b>. 2446 2447<li>For Solaris 2.<b><tt>n</tt></b> in the makefile you must change 2448the definition of <b><tt>INSTALL</tt></b> from "<b><tt>install -c</tt></b>" to 2449"<b><tt>/usr/ucb/install -c</tt></b>". 2450 2451<li>You may need to set <b><tt>XLIBDIR</tt></b> to the directory that holds 2452the X11 libraries, as for other SVR4 systems. Set <b><tt>-DSVR4</tt></b> 2453in <b><tt>CFLAGS</tt></b>. 2454 2455<li>If you are using the SunPRO C compiler, don't use optimization level 2456<b><tt>-xO3</tt></b>. On SPARC platforms the compiler hangs; on Intel 2457platforms the generated code is incorrect. With this compiler on Intel, do 2458not use the <b><tt>-native</tt></b> flag: floating point computations 2459become unacceptably inaccurate. You can use <b><tt>-xcg92</tt></b> (SPARC 2460V8) and <b><tt>-dalign</tt></b> for better performance. 2461</ul> 2462 2463<h4><a name="VAX_Ultrix"></a>VAX with Ultrix</h4> 2464 2465<ul> 2466<li>You may wish to set 2467 2468<p> 2469<b><tt>GS_LIB_DEFAULT=$(gsdatadir):/usr/lib/DPS/outline/decwin:$(gsdatadir)/fonts</tt></b> 2470 2471<p> 2472in the makefile to add the Display PostScript font directory to the font 2473search path. 2474</ul> 2475 2476<hr> 2477 2478<h2><a name="OS2_build"></a>How to build Ghostscript from source (OS/2 version)</h2> 2479 2480<p> 2481<em>Note: This section was contributed by a user: please e-mail Hermann 2482Ulrichsk�tter <<a 2483href="mailto:ulrichsk@t-online.de">ulrichsk@t-online.de</a>> if you have 2484questions or problems.</em> 2485 2486<p> 2487The following instructions are for building with emx 0.9d/Fix2. Be warned 2488that with this version of gcc/emx, compiler optimization flags '-O' or '-O1' 2489will produce non-working output. 2490 2491<ul> 2492<li>The relevant makefile is <b><tt>os2.mak</tt></b> The gcc/emx 0.9b (or 2493later) compiler and IBM <b><tt>NMAKE.EXE</tt></b> are required. 2494 2495<li>For gcc/emx versions 0.9c and later, the <b><tt>LINK386</tt></b> 2496command must <b><em>include</em></b> 2497"<b><tt>$(COMPBASE)\lib\end.lib</tt></b>"; version 0.9b requires 2498<b><em>omitting</em></b> it. The current <b><tt>os2.mak</tt></b> file does 2499include this file in the <b><tt>LINK386</tt></b> command, so if you are 2500using 0.9b, delete this file reference before building. 2501 2502<li>Be sure you are using the standard OS/2 shell, <b><tt>CMD.EXE</tt></b>. 2503Some other shells have bugs or differences that cause the makefile not to 2504work. 2505 2506<li>Make sure you followed the instructions in "How to unpack the source 2507code" and "How to unpack the third-party libraries". 2508 2509<li>Use jpegsrc_v6b.tar.gz, zlib-1.2.x.tar.gz and libpng-1.2.x.tar.gz. 2510Earlier versions may not work. 2511 2512<li>If you wish to include support for XFree86, edit the makefile 2513to change <b>BUILD_X11=0</b> to <b>BUILD_X11=1</b>. 2514XFree86 for OS/2 can be obtained from 2515<a href="http://borneo.gmd.de/~veit/os2/xf86os2.html"> 2516http://borneo.gmd.de/~veit/os2/xf86os2.html</a> 2517You must use emx 0.9d. 2518</ul> 2519 2520<p> 2521Before compiling or linking, execute <b><tt>md bin</tt></b> and <b><tt>md 2522obj</tt></b> in the <b><tt>gs</tt></b> directory to create the directories 2523for the binaries. 2524 2525<p> 2526First, build the standard configuration: 2527 2528<ul> 2529<li>Edit gs/src/os2.mak: find line with 'CO=-O' (Optimizer flag) and edit 2530this line to 'CO=-O2' (-O or -O1 do not work!). 2531 2532<li>To start the make process, type <b><tt>nmake -f .\src\os2.mak</tt></b>, 2533from the gs-directory. 2534 2535<li>One DLL and two EXEs will be produced in <b><tt>gs/bin</tt></b>: 2536<b><tt>gsdll2.dll</tt></b> (the Ghostscript DLL), <b><tt>gsos2.exe</tt></b> 2537(the Ghostscript executable) and <b><tt>gspmdrv.exe</tt></b> (the 2538Presentation Manager display driver). All other newly generated files will 2539be produced in <b><tt>gs/obj</tt></b>. 2540</ul> 2541 2542<p> 2543Now, if you wish, you can edit OS2.MAK to suit your needs, and then perform 2544<b><tt>nmake -f .\src\os2.mak clean</tt></b> and then <b><tt>nmake -f 2545.\src\os2.mak</tt></b>. 2546 2547<hr> 2548 2549<h2><a name="VMS_build"></a>How to build Ghostscript from source (OpenVMS version)</h2> 2550 2551<p>The DECC6.2-003 compiler has an optimization problem that may lead to 2552warnings about the "ANSI aliasing rules". DEC (Compaq) can provide a fix 2553for this problem. The DECC6.2-006 compiler apparently does not have the 2554problem. 2555 2556<p> 2557DEC C runtime library versions 5.5 and newer have an <b><tt>exit</tt></b> 2558function that is compatible with all other C systems, but some older ones 2559don't. If you get error messages from VMS when auxiliary programs such as 2560<b><tt>genarch</tt></b> or <b><tt>echogs</tt></b> finish executing, find the 2561line in stdpre.h that reads 2562 2563<blockquote><b><tt> 2564/*#define OLD_VMS_C*/ 2565</tt></b></blockquote> 2566 2567and remove the <b><tt>/*</tt></b> and <b><tt>*/</tt></b>, changing it to 2568 2569<blockquote><b><tt> 2570#define OLD_VMS_C 2571</tt></b></blockquote> 2572 2573<p> 2574Some versions of DEC's X server have bugs that produce broad bands of color 2575where dither patterns should appear, or characters displayed white on top 2576of black rectangles or not displayed at all. If this happens, consult the 2577usage documentation for how to <a href="Use.htm#X_server_bugs">work around 2578X server bugs</a> using X resources; also report the problem to DEC, or 2579whomever supplied your X server. 2580 2581<p> 2582You may also wish to turn off the use of a backing pixmap with Ghostscript, 2583either to work around X server memory limitations or bugs, or to obtain 2584faster displaying at the expense of no redrawing when a Ghostscript window 2585is restored from an icon or exposed after being occluded by another window. 2586Again, the <a href="Use.htm">usage documentation</a> tells how to do this. 2587 2588<p> 2589You can <a href="Fonts.htm#Precompiling">precompile any Type 1 font</a> 2590into C, then compile and build it into Ghostscript, as described in the 2591<a href="Fonts.htm">fonts documentation</a>. If you do this, then add 2592"<b><tt>$(PSD)ccfonts.dev</tt></b>" to <b><tt>FEATURE_DEVS</tt></b> in 2593<b><tt>OPENVMS.MAK</tt></b>: 2594 2595<blockquote><b><tt> 2596$ FEATURE_DEVS = "$(PSD)psl3.dev $(PSD)pdf.dev $(PSD)dpsnext.dev $(PSD)ttfont.dev $(PSD)ccfonts.dev" 2597</tt></b></blockquote> 2598 2599<p> 2600Specify the font names with <b><tt>ccfonts1</tt></b>: 2601 2602<blockquote><b><tt> 2603$ ccfonts1 = "Courier Courier_Oblique Courier_Bold Courier_BoldOblique" 2604</tt></b></blockquote> 2605 2606<p> 2607If this makes the line too long, add another line of the same form, such as 2608 2609<blockquote><b><tt> 2610$ ccfonts1 = "Courier Courier_Oblique Courier_Bold Courier_BoldOblique" 2611$ ccfonts2 = "Times_Roman Times_Italic Times_Bold Times_BoldItalic" 2612</tt></b></blockquote> 2613 2614<h3><a name="GNU_make_VMS"></a>Building with GNU make on OpenVMS</h3> 2615 2616<p> 2617<em>Note: GNU make on OpenVMS apparently has bugs that make it stop with an 2618error when building Ghostscript version 5.80 or later. Until further 2619notice, use MMS or MMK for building Ghostscript on OpenVMS. See <a 2620href="#MMK_MMS_VMS">below</a> for details.</em> 2621 2622<p> 2623As of Ghostscript version 5.0 you can use GNU make -- with the file 2624<b><tt>OPENVMS.MAK</tt></b> and some auxiliary <b><tt>.COM</tt></b> files 2625-- to build Ghostscript on OpenVMS. Use the command: 2626 2627<blockquote> 2628<b><tt>make -fopenvms.mak "DECWINDOWS=</tt></b><em>[</em><b><tt>1.2</tt></b><em>]</em><b><tt>"</tt></b> 2629</blockquote> 2630 2631<p> 2632That is, specify either "<b><tt>1.2</tt></b>" or nothing (blank) as the 2633value of <b><tt>DECWINDOWS</tt></b>. In Europe and other parts of the world 2634where ISO standard paper sizes are used, append "<b><tt>A4_PAPER=1</tt></b>" 2635to that line to make A4 the default paper size at run time. 2636 2637<p> 2638If you haven't a prebuilt copy of GNU make, you'll have to build it 2639yourself; as of Version 3.76 (but not earlier) it is said to build properly 2640under OpenVMS on both VAX and Alpha. The kit is available at the 2641<a href="http://www.gnu.org/">Free Software Foundation's</a> ftp site and 2642its mirrors. See 2643 2644<blockquote> 2645<a href="ftp://ftp.gnu.org/pub/gnu/" 2646class="offsite">ftp://ftp.gnu.org/pub/gnu/</a> 2647</blockquote> 2648 2649<h3><a name="MMK_MMS_VMS"></a>Building with MMK or MMS on OpenVMS</h3> 2650 2651<p> 2652As of Ghostscript version 5.68 you can use MMK or MMS to build Ghostscript on 2653OpenVMS. MMS is a utility available from Compaq (Digital); 2654MMK is a free program largely compatible with MMS. 2655 2656<p> 2657Building Ghostscript with MMK or MMS uses the file 2658<b><tt>OPENVMS.MMK</tt></b> and some auxiliary <b><tt>.COM</tt></b> files. 2659To build Ghostscript with MMK or MMS, use the command: 2660 2661<blockquote> 2662<b><tt>###/descrip=[.src]openvms.mmk/macro=("DECWINDOWS1_2=</tt></b><em>{</em><b><tt>0</tt></b>,<b><tt>1</tt></b><em>}</em><b><tt>")</tt></b> 2663</blockquote> 2664 2665where <b><tt>###</tt></b> is either <b><tt>mmk</tt></b> or <b><tt>mms</tt></b>. 2666 2667<p> 2668Specify <b><tt>DECWINDOWS1_2=1</tt></b> for DECWINDOWS 1.2, 2669<b><tt>DECWINDOWS1_2=0</tt></b> for other DECWINDOWS versions. In Europe 2670and other parts of the world where ISO standard paper sizes are used, add 2671<b><tt>,"A4_PAPER=1"</tt></b> just before the final closing parenthesis to 2672make A4 the default paper size at run time. 2673 2674<p> 2675To download MMK (source code, and VAX and Alpha executables), visit 2676 2677<blockquote> 2678<a href="http://www.madgoat.com/mmk.html">http://www.madgoat.com/mmk.html</a> 2679</blockquote> 2680 2681<hr> 2682 2683<h2><a name="Other_environments"></a>Other environments</h2> 2684 2685<h3><a name="No_multi_thread"></a>Environments lacking multi-threading</h3> 2686 2687<p> 2688All environments mentioned here by name have multi-threading capability. 2689However, if your environment doesn't, you can remove all need for 2690multi-threading by setting <b><tt>SYNC=nosync</tt></b> in the top-level 2691makefile. Note that you will not be able to use any so-called "async" 2692drivers (drivers that overlap interpretation and rasterization) if you do 2693this. No such drivers are in the <b><tt>DEVICE_DEVS*</tt></b> lists of any 2694makefile that we distribute. 2695 2696<h3><a name="Plan_9"></a>Plan 9</h3> 2697 2698<p> 2699Use <b><tt>unix-gcc.mak</tt></b>, editing it to define 2700 2701<blockquote><b><tt> 2702CC=cc 2703GCFLAGS=-D_BSD_EXTENSION -DPlan9 2704</tt></b></blockquote> 2705 2706<p> 2707You will also probably have to edit many path names. 2708 2709<h3><a name="QNX"></a>QNX</h3> 2710 2711<p> 2712David J. Hawkey Jr. writes that he built Ghostscript 4.03 and 5.0 under QNX 27134.22, 4.23, and 4.24 using Watcom C 10.6 and that "it works quite well, 2714after figuring out the <b><tt>/etc/config/lpsrvr</tt></b> directives, 2715except for color printing to my HP DeskJet some-number-or-another". Here 2716is a concise presentation of changes based on the ones he made for 2717Ghostscript 4.03. 2718 2719<dl> 2720<dt><b><tt>unixansi.mak</tt></b> 2721<dd><table cellpadding=0 cellspacing=0> 2722<tr valign=bottom> 2723 <th align=left>Original lines 2724 <td> 2725 <th align=left>Change to 2726<tr> <td colspan=3><hr> 2727<tr valign=top> <td><b><tt>INSTALL = install -c<br>INSTALL_PROGRAM = $(INSTALL) -m 755<br>INSTALL_DATA = $(INSTALL) -m 644</tt></b> 2728 <td> 2729 <td><b><tt>INSTALL = cp<br>INSTALL_PROGRAM = $(INSTALL)<br>INSTALL_DATA = $(INSTALL)</tt></b> 2730<tr> <td colspan=3><hr> 2731<tr valign=top> <td><b><tt>datadir = $(prefix)/share</tt></b> 2732 <td> 2733 <td><b><tt>datadir = $(prefix)/lib</tt></b> 2734<tr> <td colspan=3><hr> 2735<tr valign=top> <td><b><tt>CFLAGS_STANDARD=-O</tt></b> 2736 <td> 2737 <td><b><tt>CFLAGS_STANDARD=-Otx -zp1 -mf</tt></b> 2738<tr> <td colspan=3><hr> 2739<tr valign=top> <td><b><tt>LDFLAGS=$(XLDFLAGS)</tt></b> 2740 <td> 2741 <td><b><tt>LDFLAGS=-mf -N32k $(XLDFLAGS)</tt></b> 2742<tr> <td colspan=3><hr> 2743<tr valign=top> <td><b><tt>EXTRALIBS=</tt></b> 2744 <td> 2745 <td><b><tt>EXTRALIBS=-lXqnx_s -lsocket</tt></b> 2746<tr> <td colspan=3><hr> 2747<tr valign=top> <td><b><tt>XINCLUDE=-I/usr/local/X/include</tt></b> 2748 <td> 2749 <td><b><tt>#XINCLUDE=-I/usr/local/X/include</tt></b> 2750<tr> <td colspan=3><hr> 2751<tr valign=top> <td><b><tt>XLIBDIRS=-L/usr/local/X/lib<br>XLIBDIR=<br>XLIBS=Xt Xext X11</tt></b> 2752 <td> 2753 <td><b><tt>#XLIBDIRS=-L/usr/local/X/lib<br>#XLIBDIR=<br>XLIBS=Xt_s Xext X11_s</tt></b> 2754<tr> <td colspan=3><hr> 2755</table> 2756</dl> 2757 2758<dl> 2759<dt><b><tt>gp_unifs.c</tt></b> 2760<dd>After the line 2761 2762<blockquote> 2763<b><tt>#include <sys/param.h></tt></b> 2764</blockquote> 2765 2766<p> 2767add these lines: 2768 2769<blockquote> 2770<b><tt>#if defined(__QNX__)<br> 2771#include <unix.h><br> 2772#endif</tt></b><br> 2773</blockquote> 2774</dl> 2775 2776<dl> 2777<dt><b><tt>gp_unix.c</tt></b> 2778<dd>After the line 2779 2780<blockquote> 2781<b><tt>#include "time.h"</tt></b> 2782</blockquote> 2783 2784<p> 2785add these lines: 2786 2787<blockquote> 2788<b><tt>#if defined(__QNX__)<br> 2789#include <sys/time.h><br> 2790#endif</tt></b><br> 2791</blockquote> 2792</dl> 2793 2794<dl> 2795<dt><b><tt>time_.h</tt></b> 2796<dd>Modify the line beginning 2797 2798<blockquote> 2799<b><tt># if defined(Plan9) ||</tt></b> 2800</blockquote> 2801 2802<p> 2803to begin 2804 2805<blockquote> 2806<b><tt># if defined(__QNX__) || defined(Plan9) ||</tt></b> 2807</blockquote> 2808</dl> 2809 2810<dl> 2811<dt><b><tt>/etc/config/lpsrvr</tt></b> 2812<dd>Here is Hawkey's <b><tt>lpsrvr</tt></b> as an example. 2813 2814<blockquote> 2815<pre># lpsrvr 2816# 2817# Defines the print queues and their devices 2818# 2819# Queues 2820 2821# ink-jet: Ghostscript interpreter for mono DeskJet - LaserJet works 2822# better than DeskJet! 2823 2824[ij-monops] 2825 ta=lpt1 2826 co=/usr/local/bin/gs -q -sDEVICE=laserjet -sOutputFile=- -dNOPAUSE $(spfile) quit.ps | cat > $(device) 2827 2828# Devices 2829 2830[-lpt1] 2831 dv=/dev/par1 2832 2833[-lpt2] 2834 dv=/dev/par2 2835</pre></blockquote> 2836</dl> 2837 2838 2839<h2><a name="UFST_build"></a>How to build Ghostscript with UFST</h2> 2840 2841<p> 2842<em>Note: This section is only for customers who have licensed Agfa's UFST. 2843Other users please skip this section. 2844</em> 2845 2846<p> 2847Ghostscript sources do not include UFST sources. You need to obtain them from Agfa. 2848Ghostscript includes only some source modules that provide a bridge to UFST. 2849 2850<p> 2851Ghostscript makefiles do not include any script for building UFST libraries. 2852Refer to Agfa's manual how to build them. UFST object libraries must be built 2853before building Ghostscript with the UFST bridge. 2854 2855<p> 2856To build Ghostscript with UFST, specify additional options for "make": 2857 2858<dl> 2859<dt><b><tt>UFST_BRIDGE=1</tt></b> 2860<dd>forces the UFST bridge to build. 2861 2862<dt><b><tt>UFST_ROOT=path</tt></b> 2863<dd>specifies the path to UFST root directory or folder. 2864 2865<dt><b><tt>UFST_CFLAGS=options</tt></b> 2866<dd>specifies C compiler options for UFST library. Refer to Agfa's manual for information about them. 2867 2868<dt><b><tt>UFST_LIB_EXT=extension</tt></b> 2869<dd>sets the file name extension for object libraries. You must use the appropriate one for your platform and linker. 2870</dl> 2871 2872<p>An example for Unix/GCC : 2873<blockquote> 2874<tt>UFST_BRIDGE=1 UFST_ROOT=../Agfa UFST_CFLAGS=-DGCCx86 UFST_LIB_EXT=.a</tt> 2875</blockquote> 2876 2877<p>For Windows/MSVC you need only specify UFST_ROOT. 2878msvc32.mak sets the other options automatically. 2879 2880<p> 2881 2882<h2><a name="FT_build"></a>How to build Ghostscript with Free Type</h2> 2883 2884<p> 2885<em>Note: This section is only for users who wish to use Ghostscript with Free Type font renderer. 2886Other users please skip this section. 2887</em> 2888 2889<p> 2890Ghostscript sources do not include Free Type sources. You need to obtain them from Free Type group. 2891Ghostscript includes only some source modules that provide a bridge to Free Type. 2892 2893<p> 2894Ghostscript makefiles do not include any script for building Free Type libraries. 2895Refer to Free Type manual how to build them. Free Type object libraries must be built 2896before building Ghostscript with the Free Type bridge. 2897 2898<p> 2899To build Ghostscript with Free Type, specify additional options for "make": 2900 2901<dl> 2902<dt><b><tt>FT_BRIDGE=1</tt></b> 2903<dd>forces the Free Type bridge to build. 2904 2905<dt><b><tt>FT_ROOT=path</tt></b> 2906<dd>specifies the path to Free Type root directory or folder. 2907 2908<dt><b><tt>FT_CFLAGS=options</tt></b> 2909<dd>specifies C compiler options for Free Type library. Refer to Free Type manual for information about them. 2910 2911<dt><b><tt>FT_LIB_EXT=extension</tt></b> 2912<dd>sets the file name extension for object libraries. You must use the appropriate one for your platform and linker. 2913</dl> 2914 2915<p>An example for Unix/GCC : 2916<blockquote> 2917<tt>FT_BRIDGE=1 FT_ROOT=../FreeType FT_CFLAGS=-DGCCx86 FT_LIB_EXT=.a</tt> 2918</blockquote> 2919 2920<p>For Windows/MSVC you need only specify FT_ROOT. 2921msvc32.mak sets the other options automatically. 2922 2923<p> 2924 2925<!-- [2.0 end contents] ==================================================== --> 2926 2927<!-- [3.0 begin visible trailer] =========================================== --> 2928<hr> 2929 2930<p> 2931<small>Copyright © 1996, 2000 Aladdin Enterprises. 2932All rights reserved.</small> 2933 2934<p> 2935This software is provided AS-IS with no warranty, either express or 2936implied. 2937 2938This software is distributed under license and may not be copied, 2939modified or distributed except as expressly authorized under the terms 2940of the license contained in the file LICENSE in this distribution. 2941 2942For more information about licensing, please refer to 2943http://www.ghostscript.com/licensing/. For information on 2944commercial licensing, go to http://www.artifex.com/licensing/ or 2945contact Artifex Software, Inc., 101 Lucas Valley Road #110, 2946San Rafael, CA 94903, U.S.A., +1(415)492-9861. 2947 2948<p> 2949<small>Ghostscript version 8.53, 20 October 2005 2950 2951<!-- [3.0 end visible trailer] ============================================= --> 2952 2953</body> 2954</html> 2955