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