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
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
|
dnl Copyright (C) 2001-2020 Artifex Software, Inc.
dnl All Rights Reserved.
dnl
dnl This software is provided AS-IS with no warranty, either express or
dnl implied.
dnl
dnl This software is distributed under license and may not be copied,
dnl modified or distributed except as expressly authorized under the terms
dnl of the license contained in the file LICENSE in this distribution.
dnl
dnl Refer to licensing information at http://www.artifex.com or contact
dnl Artifex Software, Inc., 1305 Grant Avenue - Suite 200, Novato,
dnl CA 94945, U.S.A., +1(415)492-9861, for further information.
dnl Process this file with autoconf to produce a configure script
dnl ------------------------------------------------
dnl Initialization and Versioning
dnl ------------------------------------------------
AC_INIT
AC_PREREQ(2.63)
AC_LANG(C)
AC_CONFIG_SRCDIR(psi/gs.c)
AC_CANONICAL_HOST
dnl Inherit compiler flags from the environment...
CFLAGS="${CFLAGS:=}"
CPPFLAGS="${CPPFLAGS:=}"
CXXFLAGS="${CXXFLAGS:=}"
LDFLAGS="${LDFLAGS:=}"
if test x"$host" != x"$build" ; then
CFLAGSAUX="${CFLAGSAUX:=}"
CPPFLAGSAUX="${CPPFLAGSAUX:=}"
LDFLAGSAUX="${LDFLAGSAUX:=}"
else
CFLAGSAUX="${CFLAGSAUX:-$CFLAGS}"
CPPFLAGSAUX="${CPPFLAGSAUX:-$CPPFLAGS}"
LDFLAGSAUX="${LDFLAGSAUX:-$LDFLAGS}"
fi
THEMAKEFILE="${MAKEFILE:-Makefile}"
AUXFLAGS_MAK=auxflags.mak
ARCH_AUTOCONF_HEADER=arch-config/arch_autoconf.h
ARCH_AUTOCONF_HEADER_PROTO=arch/arch_autoconf.h.in
dnl --------------------------------------------------
dnl List of non-threadsafe devices
dnl defined at the top of the file for ease of access
dnl --------------------------------------------------
NTS_DEVS='opvp oprp'
NTS_DEVS="$NTS_DEVS uniprint"
NTS_DEVS="$NTS_DEVS x11 x11alpha"
NTS_DEVS="$NTS_DEVS pcl3 hpdjplus hpdjportable hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510 hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c hpdj690c hpdj850c hpdj855c hpdj870c hpdj890c hpdj1120c"
# We use this to store a list of devices we have excluded
# and emit a warning on completion.
NTS_EXCLUDES=""
dnl --------------------------------------------------
dnl Local utilities
dnl --------------------------------------------------
dnl GS_SPLIT_LIBS( LIBS, LINKLINE )
dnl Split a unix-style link line into a list of
dnl bare library names. For example, the line
dnl '-L/usr/X11R6/lib -lX11 -lXt' splits into
dnl LIB='X11 Xt'
dnl
AC_DEFUN([GS_SPLIT_LIBS], [
# the makefile wants a list of just the library names
for gs_item in $2; do
gs_stripped_item=`echo "$gs_item" | sed -e 's/^-l//'`
if test "x$gs_stripped_item" != "x$gs_item"; then
$1="$[$1] $gs_stripped_item"
fi
done
])
dnl GS_SPLIT_LIBPATHS( LIBPATHS, LINKLINE )
dnl Split a unix-style link line into a list of
dnl bare search path entries. For example,
dnl '-L/usr/X11R6/lib -lX11 -L/opt/lib -lXt'
dnl splits to LIBPATHS='/usr/X11R6/lib /opt/lib'
dnl
AC_DEFUN([GS_SPLIT_LIBPATHS], [
for gs_item in $2; do
gs_stripped_item=`echo "$gs_item" | sed -e 's/-L//'`
if test "x$gs_stripped_item" != "x$gs_item"; then
$1="$[$1] $gs_stripped_item"
fi
done
])
dnl --------------------------------------------------
dnl Check for programs
dnl --------------------------------------------------
dnl AC_PROG_CC likes to add '-g -O2' to CFLAGS. however,
dnl we ignore those flags and construct our own.
save_cflags="$CFLAGS"
AC_PROG_CC
AC_PROG_CPP
CFLAGS="$save_cflags"
AUXFLAGS_MAK_LINE00="CCAUX=@CC@"
AUXFLAGS_MAK_LINE01="GCFLAGSAUX=@CPPFLAGS@ @GCFLAGS@ @CFLAGS@"
AUXFLAGS_MAK_LINE02="CAPOPTAUX="
AUXFLAGS_MAK_LINE03="CFLAGSAUX_STANDARD=@OPT_CFLAGS@"
AUXFLAGS_MAK_LINE04="CFLAGSAUX_DEBUG=@DBG_CFLAGS@"
AUXFLAGS_MAK_LINE05="CFLAGSAUX_PROFILE=-pg @OPT_CFLAGS@"
AUXFLAGS_MAK_LINE06="LDFLAGSAUX=@LDFLAGS@"
AUXFLAGS_MAK_LINE07="AUXEXTRALIBS=@LIBS@"
GCFLAGSAUXTMP="\$(GCFLAGS)"
CAPOPTAUXTMP="\$(CAPOPT)"
CFLAGSAUX_STANDARDTMP="\$(CFLAGS_STANDARD)"
CFLAGSAUX_DEBUGTMP="\$(CFLAGS_DEBUG)"
CFLAGSAUX_PROFILETMP="\$(CFLAGS_PROFILE)"
LDFLAGSAUXTMP="\$(LDFLAGS)"
AUXEXTRALIBSTMP="\$(EXTRALIBS)"
# purposefully do not include "help" output for this
AC_ARG_ENABLE([save_confaux])
AC_ARG_ENABLE([auxtools_only])
absolute_source_path=$(cd "$(dirname "$0")" && pwd)
if test x"$host" != x"$build" ; then
# rerun configure for the AUX tools, disabling a load of tests not relevant for CCAUX
olddir=`pwd`
if test x"$enable_save_confaux" = x"yes"; then
CONFAUXDIR=auxtmp
else
CONFAUXDIR=auxtmp$RANDOM$RANDOM
fi
mkdir $CONFAUXDIR
cd $CONFAUXDIR
echo -e $AUXFLAGS_MAK_CONTENTS > $AUXFLAGS_MAK.in
echo $AUXFLAGS_MAK_LINE00 > $AUXFLAGS_MAK.in
echo $AUXFLAGS_MAK_LINE01 >> $AUXFLAGS_MAK.in
echo $AUXFLAGS_MAK_LINE02 >> $AUXFLAGS_MAK.in
echo $AUXFLAGS_MAK_LINE03 >> $AUXFLAGS_MAK.in
echo $AUXFLAGS_MAK_LINE04 >> $AUXFLAGS_MAK.in
echo $AUXFLAGS_MAK_LINE05 >> $AUXFLAGS_MAK.in
echo $AUXFLAGS_MAK_LINE06 >> $AUXFLAGS_MAK.in
echo $AUXFLAGS_MAK_LINE07 >> $AUXFLAGS_MAK.in
AC_MSG_NOTICE([Begin recursive call to configure script (for auxiliary tools)])
"$absolute_source_path/configure" CC="$CCAUX" CFLAGS="$CFLAGSAUX" CPPFLAGS="$CPPFLAGSAUX" LDFLAGS="$LDFLAGSAUX" CCAUX= CFLAGSAUX= CFLAGSAUX= MAKEFILE=$AUXFLAGS_MAK --host=$build --build=$build --enable-auxtools_only --disable-hidden-visibility --with-local-zlib --without-libtiff --disable-contrib --disable-fontconfig --disable-dbus --disable-freetype --disable-fapi --disable-cups --disable-openjpeg --disable-gtk --with-libiconv=no --without-libidn --without-libpaper --without-pdftoraster --without-ijs --without-luratech --without-jbig2dec --without-x --with-drivers=""
status=$?
cp config.log "$olddir/configaux.log"
if test $status -eq 0 ; then
CCAUX=$(grep CCAUX $AUXFLAGS_MAK | sed "s/CCAUX=//g")
GCFLAGSAUXTMP=$(grep GCFLAGSAUX $AUXFLAGS_MAK | sed "s/GCFLAGSAUX=//g")
CAPOPTAUXTMP=$(grep CAPOPTAUX $AUXFLAGS_MAK | sed "s/CAPOPTAUX=//g")
CFLAGSAUX_STANDARDTMP=$(grep CFLAGSAUX_STANDARD $AUXFLAGS_MAK | sed "s/CFLAGSAUX_STANDARD=//g")
CFLAGSAUX_DEBUGTMP=$(grep CFLAGSAUX_DEBUG $AUXFLAGS_MAK | sed "s/CFLAGSAUX_DEBUG=//g")
CFLAGS_PROFILETMP=$(grep CFLAGS_PROFILE $AUXFLAGS_MAK | sed "s/CFLAGS_PROFILE=//g")
LDFLAGSAUXTMP=$(grep LDFLAGSAUX $AUXFLAGS_MAK | sed "s/LDFLAGSAUX=//g")
AUXEXTRALIBSTMP=$(grep AUXEXTRALIBS$ $AUXFLAGS_MAK | sed "s/AUXEXTRALIBS$=//g")
fi
cd "$olddir"
if test x"$enable_save_confaux" != x"yes"; then
rm -rf $CONFAUXDIR
fi
if test $status -ne 0 ; then
AC_MSG_ERROR([Recursive call to configure script failed], $status)
else
AC_MSG_NOTICE([Recursive call to configure script succeeded])
fi
fi
GCFLAGSAUX=$GCFLAGSAUXTMP
CAPOPTAUX=$CAPOPTAUXTMP
CFLAGSAUX_STANDARD=$CFLAGSAUX_STANDARDTMP
CFLAGSAUX_DEBUG=$CFLAGSAUX_DEBUGTMP
CFLAGS_PROFILE=$CFLAGS_PROFILETMP
LDFLAGSAUX=$LDFLAGSAUXTMP
AUXEXTRALIBS=$AUXEXTRALIBSTMP
# we have to do this here in case it took
# AC_PROG_CC to set CC (as it usually does)
CCAUX="${CCAUX:-$CC}"
AC_PROG_SED
dnl See if it is GNU sed or else.
dnl - need more work to tell SED features.
SED_EXTENDED_REGEX_OPT=-nre
sed_variant=`sed --version 2>&1`
sed_variant=`echo $sed_variant|sed -e 's/ .*//'`
if test "$sed_variant" != GNU ; then
SED_EXTENDED_REGEX_OPT=-nEe
fi
AC_SUBST(SED_EXTENDED_REGEX_OPT)
AC_PROG_RANLIB
#AC_PROG_INSTALL
# If the caller has gives a specific pkg-config to use, then
# use it, and skip the tests.
if test x"$PKGCONFIG" != x"" ; then
AC_MSG_NOTICE([Using $PKGCONFIG])
else
# this is an unpleasant hack
# but if we are cross compiling, and there isn't a matching
# pkconfig for the --host setting, then don't use the 'local'
# pkconfig at all
AC_PATH_TOOL(PKGCONFIG, pkg-config)
if test x"$host" != x"$build" ; then
dnl pkg-config is used for several tests now...
AC_PATH_PROG(BUILD_PKGCONFIG, pkg-config)
if test x"$BUILD_PKGCONFIG" = x"$PKGCONFIG" ; then
PKGCONFIG=
fi
fi
fi
AC_PATH_TOOL(STRIP_XE, strip)
# this is an unpleasant hack
# but if we are cross compiling, and there isn't a matching
# pkconfig for the --host setting, then don't use the 'local'
# pkconfig at all
if test x"$host" != x"$build" ; then
AC_PATH_PROG(BUILD_STRIP_XE, strip)
if test x"$BUILD_STRIP_XE" = x"$STRIP_XE" ; then
STRIP_XE=
fi
fi
dnl --------------------------------------------------
dnl Allow excluding the contributed drivers
dnl --------------------------------------------------
AC_ARG_ENABLE([contrib], AC_HELP_STRING([--disable-contrib], [Do not include contributed drivers]))
CONTRIBINCLUDE="include $srcdir/contrib/contrib.mak"
INSTALL_CONTRIB="install-contrib-extras"
if test x"$enable_contrib" = x; then
case $host in
*-mingw*|*-msys*)
AC_MSG_WARN([disabling contrib devices])
enable_contrib=no
;;
*)
;;
esac
fi
if test x"$enable_contrib" != x"no"; then
# This is just an arbitrary file in contrib to check
if test -f $srcdir/contrib/gdevbjc_.c; then
enable_contrib=yes
else
enable_contrib=no
fi
fi
if test x$enable_contrib = xno; then
CONTRIBINCLUDE=""
INSTALL_CONTRIB=""
CFLAGS="$CFLAGS -DNOCONTRIB"
fi
AC_SUBST(CONTRIBINCLUDE)
AC_SUBST(INSTALL_CONTRIB)
dnl --------------------------------------------------
dnl Set build flags based on environment
dnl --------------------------------------------------
CC_OPT_FLAGS_TO_TRY="-O -DNDEBUG"
CC_VISIBILITY_FLAGS_TO_TRY=""
SET_DT_SONAME="-soname="
CFLAGS_LARGEFILE=""
case $host in
*-linux*|*-gnu)
if test $GCC = yes; then
CC_OPT_FLAGS_TO_TRY="-O2 -DNDEBUG"
CC_DBG_FLAGS_TO_TRY="-gdwarf-2 -g3 -O0"
CC_VISIBILITY_FLAGS_TO_TRY="-fvisibility=hidden"
fi
;;
*bsd*)
if test $GCC = yes; then
CC_OPT_FLAGS_TO_TRY="-O2 -DNDEBUG"
CC_DBG_FLAGS_TO_TRY="-gdwarf-2 -g3 -O0"
CC_VISIBILITY_FLAGS_TO_TRY="-fvisibility=hidden"
fi
;;
*-darwin*)
if test $GCC = yes; then
CC_OPT_FLAGS_TO_TRY="-O2 -DNDEBUG"
CC_DBG_FLAGS_TO_TRY="-gdwarf-2 -g3 -O0"
CC_VISIBILITY_FLAGS_TO_TRY="-fvisibility=hidden"
fi
SET_DT_SONAME=""
;;
*-mingw*|*-msys*)
if test $GCC = yes; then
CC_OPT_FLAGS_TO_TRY="-O2 -DNDEBUG"
CC_DBG_FLAGS_TO_TRY="-gdwarf-2 -g3 -O0"
CC_VISIBILITY_FLAGS_TO_TRY="-fvisibility=hidden"
fi
SET_DT_SONAME=""
;;
*-sun*|*-solaris*)
CC_OPT_FLAGS_TO_TRY="-O2 -DNDEBUG"
CFLAGS_LARGEFILE="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
# the trailing space is required!
if test $GCC = no; then
SET_DT_SONAME="-h "
fi
if test $GCC = yes; then
CC_OPT_FLAGS_TO_TRY="-O2 -DNDEBUG"
CC_DBG_FLAGS_TO_TRY="-gdwarf-2 -g3 -O0"
CC_VISIBILITY_FLAGS_TO_TRY="-fvisibility=hidden"
else
CC_DBG_FLAGS_TO_TRY="-g -O0"
fi
;;
*-aix*)
if test $GCC = yes; then
CC_OPT_FLAGS_TO_TRY="-O2 -DNDEBUG"
CC_DBG_FLAGS_TO_TRY="-gdwarf-2 -g3 -O0"
SET_DT_SONAME="so"
CC_VISIBILITY_FLAGS_TO_TRY="-fvisibility=hidden"
fi
;;
esac
AC_SUBST(SET_DT_SONAME)
if test $GCC = yes; then
cflags_to_try="-Wall -Wstrict-prototypes -Wundef \
-Wmissing-declarations -Wmissing-prototypes -Wwrite-strings \
-fno-strict-aliasing -Werror=declaration-after-statement \
-fno-builtin -fno-common -Werror=return-type $CFLAGS_LARGEFILE"
optflags_to_try="$CC_OPT_FLAGS_TO_TRY"
dbgflags_to_try="$CC_DBG_FLAGS_TO_TRY"
else
cflags_to_try="$CFLAGS_LARGEFILE"
optflags_to_try="$CC_OPT_FLAGS_TO_TRY"
dbgflags_to_try="$CC_DBG_FLAGS_TO_TRY"
fi
AC_MSG_CHECKING([if compiler supports restrict])
AC_TRY_COMPILE([
#if defined(__STDC_VERSION__) && __STDC_VERSION__ == 199901L
void test (char * restrict p){}
#else
void test (char * __restrict p){}
#endif
],[
#if defined(__STDC_VERSION__) && __STDC_VERSION__ == 199901L
char *restrict t;
#else
char * __restrict t;
#endif
test(t);
return 1;
],[
CFLAGS="$CFLAGS -DHAVE_RESTRICT=1"
if test x"$host" = x"$build" ; then
CFLAGSAUX="$CFLAGSAUX -DHAVE_RESTRICT=1"
fi
AC_MSG_RESULT([yes])],[
CFLAGS="$CFLAGS -DHAVE_RESTRICT=0"
if test x"$host" = x"$build" ; then
CFLAGSAUX="$CFLAGSAUX -DHAVE_RESTRICT=0"
fi
AC_MSG_RESULT([no])])
AC_ARG_WITH([arch_h], AC_HELP_STRING([--with-arch_h=<arch.h to use>],
[Use a custom arch.h (must be an absolute path)]),[], [with_arch_h=])
ARCH_CONF_HEADER=
if test x"$with_arch_h" = x""; then
case $host in
x86_64*-mingw*|x86_64*-msys*)
ARCH_CONF_HEADER="\$(GLSRCDIR)/../arch/windows-x64-msvc.h"
;;
*-mingw*|*-msys*)
ARCH_CONF_HEADER="\$(GLSRCDIR)/../arch/windows-x86-msvc.h"
;;
*-darwin*)
ARCH_CONF_HEADER="\$(GLSRCDIR)/../arch/osx-x86-x86_64-ppc-gcc.h"
;;
*)
ARCH_CONF_HEADER=
if test x"$host" != x"$build"; then
ARCH_CONF_HEADER="\$(GLSRCDIR)/../$ARCH_AUTOCONF_HEADER"
else
ARCH_CONF_HEADER=
fi
;;
esac
else
ARCH_CONF_HEADER=$with_arch_h
fi
AC_SUBST(ARCH_CONF_HEADER)
# debug configurarion is available by default with "make debug"
#AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug],
# [turn on debugging]))
#if test x$enable_debug = xyes; then
# optflags_to_try="-g"
# CFLAGS="-DDEBUG $CFLAGS"
#fi
# NOTE: To correctly disable GCC's strict aliasing with '-fno-strict-aliasing'
# option, the 'cflags_to_try' have to be checked after 'optflags_to_try'.
AC_MSG_CHECKING([supported compiler flags])
old_cflags=$CFLAGS
for flag in $optflags_to_try; do
CFLAGS="$CFLAGS $flag"
AC_TRY_COMPILE(, [return 0;], [
echo " $flag"
OPT_CFLAGS="$OPT_CFLAGS $flag"
])
CFLAGS=$old_cflags
done
for flag in $cflags_to_try; do
CFLAGS="$CFLAGS $flag"
AC_TRY_COMPILE(, [return 0;], [
echo " $flag"
GCFLAGS="$GCFLAGS $flag"
])
CFLAGS=$old_cflags
done
old_cflags=$CFLAGS
for flag in $dbgflags_to_try; do
CFLAGS="$CFLAGS $flag"
AC_TRY_COMPILE(, [return 0;], [
echo " $flag"
DBG_CFLAGS="$DBG_CFLAGS $flag"
])
CFLAGS=$old_cflags
done
CFLAGS_VISIBILITY=""
for flag in $CC_VISIBILITY_FLAGS_TO_TRY; do
CFLAGS="$CFLAGS $flag"
AC_TRY_COMPILE(, [return 0;], [
echo " $flag"
CFLAGS_VISIBILITY="$CFLAGS_VISIBILITY $flag"
])
CFLAGS=$old_cflags
done
AC_MSG_RESULT([ ...done.])
dnl ----------------------------
dnl check for sanitize support
dnl ----------------------------
AC_MSG_CHECKING([compiler/linker address santizer support])
CFLAGS_SANITIZE=""
CFLAGS_SANITIZE_TRY="-fsanitize=address -fno-omit-frame-pointer"
CFLAGS_SAVED="$CFLAGS"
CFLAGS="$CFLAGS_SANITIZE_TRY"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <stdio.h>], [
return(0);
])],
[CFLAGS_SANITIZE="$CFLAGS"], [CFLAGS_SANITIZE="'****************ADDRESS_SANITIZER_NOT_SUPPORTED*********************'"])
CFLAGS="$CFLAGS_SAVED"
AC_MSG_RESULT([ ...done.])
dnl ----------------------------
dnl check for sanitize build warnings support
dnl ----------------------------
AC_MSG_CHECKING([compiler/linker address santizer build warnings support])
CFLAGS_SANITIZE_TRY="$CFLAGS_SANITIZE -W -Wall -Wno-unused-parameter -Wno-sign-compare -Wno-implicit-fallthrough -Wno-missing-field-initializers -Wno-shift-negative-value -Wno-old-style-declaration -Wno-unused-but-set-parameter"
CFLAGS_SAVED="$CFLAGS"
CFLAGS="$CFLAGS_SANITIZE_TRY"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <stdio.h>], [
return(0);
])],
[CFLAGS_SANITIZE="$CFLAGS"], [echo 'extra warnings not supported'])
CFLAGS="$CFLAGS_SAVED"
AC_MSG_RESULT([ ...done.])
dnl ----------------------------
dnl check for big/little endian
dnl ----------------------------
AC_C_BIGENDIAN([BIGENDIAN=1], [BIGENDIAN=0])
dnl --------------------------------------------------
dnl check for sse2 intrinsics
dnl --------------------------------------------------
AC_MSG_CHECKING([sse2 support])
save_cflags=$CFLAGS
CFLAGS="$CFLAGS $OPT_CFLAGS"
HAVE_SSE2=""
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <emmintrin.h>], [
__m128i input1;
unsigned char buf1[[128]];
input1 = _mm_loadu_si128((const __m128i *)buf1);
return(0);
])],
[HAVE_SSE2="-DHAVE_SSE2"], [HAVE_SSE2=""])
AC_ARG_ENABLE([sse2], AC_HELP_STRING([--disable-sse2],
[Do not use sse2 instrinsics]), [
if test "x$enable_sse2" = xno; then
HAVE_SSE2=""
fi])
if test "x$HAVE_SSE2" != x; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(HAVE_SSE2)
CFLAGS=$save_cflags
dnl --------------------------------------------------
dnl Enable thread safe build
dnl --------------------------------------------------
AC_ARG_ENABLE([threadsafe], AC_HELP_STRING([--enable-threadsafe],
[enable a thread safe build - NOTE: this will exclude non-threadsafe devices]))
if test x$enable_threadsafe = xyes ; then
CFLAGS="-DGS_THREADSAFE"
fi
dnl --------------------------------------------------
dnl Check for headers
dnl --------------------------------------------------
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([errno.h fcntl.h limits.h malloc.h memory.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/time.h sys/times.h syslog.h unistd.h dirent.h ndir.h sys/dir.h sys/ndir.h inttypes.h])
dnl --------------------------------------------------
dnl Sun, BSD possibly other makes don't have quite the
dnl feature set of GNU make. We still prefer GNU make,
dnl but......
dnl --------------------------------------------------
OBJDIR_BSDMAKE_WORKAROUND=obj
SUB_MAKE_OPTION=
ORDER_ONLY=""
AC_MSG_CHECKING(if make is GNU make)
if make --version 2> /dev/null | grep GNU 2>&1 > /dev/null ; then
AC_MSG_RESULT(yes)
SUB_MAKE_OPTION="-f \$(MAKEFILE)"
ORDER_ONLY="|"
else
AC_MSG_RESULT(no)
# BSD Make treats obj special and cd into it first
OBJDIR_BSDMAKEWORKAOROUND="notobj"
fi
AC_SUBST(OBJDIR_BSDMAKE_WORKAROUND)
AC_SUBST(ORDER_ONLY)
AC_SUBST(SUB_MAKE_OPTION)
AC_CHECK_HEADER([sys/window.h])
dnl --------------------------------------------------
dnl Check for typedefs, structures, etc
dnl --------------------------------------------------
AC_C_CONST
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_STRUCT_ST_BLOCKS
AC_HEADER_TIME
AC_STRUCT_TM
dnl see if we're on a system that puts the *int*_t types
dnl from stdint.h in sys/types.h
if test "x$ac_cv_header_stdint_h" != xyes; then
AC_CHECK_TYPES([int8_t, int16_t, int32_t, uint8_t, uint16_t, uint32_t],,,[#include <sys/types.h>])
if test "$ac_cv_type_uint8_t" = yes; then
AC_DEFINE([SYS_TYPES_HAS_STDINT_TYPES])
GCFLAGS="$GCFLAGS -DSYS_TYPES_HAS_STDINT_TYPES"
fi
fi
dnl we aren't interested in all of DEFS, so manually insert
dnl the flags we care about
if test "$ac_cv_c_const" != yes; then
GCFLAGS="$GCFLAGS -Dconst="
fi
if test "x$ac_cv_header_stdint_h" = xyes; then
GCFLAGS="$GCFLAGS -DHAVE_STDINT_H=1"
fi
if test "x$ac_cv_header_dirent_h" = xyes; then
GCFLAGS="$GCFLAGS -DHAVE_DIRENT_H=1"
fi
if test "x$ac_cv_header_ndir_h" = xyes; then
GCFLAGS="$GCFLAGS -DHAVE_NDIR_H=1"
fi
if test "x$ac_cv_header_sys_dir_h" = xyes; then
GCFLAGS="$GCFLAGS -DHAVE_SYS_DIR_H=1"
fi
if test "x$ac_cv_header_sys_ndir_h" = xyes; then
GCFLAGS="$GCFLAGS -DHAVE_SYS_NDIR_H=1"
fi
if test "x$ac_cv_header_sys_time_h" = xyes; then
GCFLAGS="$GCFLAGS -DHAVE_SYS_TIME_H=1"
fi
if test "x$ac_cv_header_sys_times_h" = xyes; then
GCFLAGS="$GCFLAGS -DHAVE_SYS_TIMES_H=1"
fi
if test "x$ac_cv_header_inttypes_h" = xyes; then
GCFLAGS="$GCFLAGS -DHAVE_INTTYPES_H=1"
fi
AC_CHECK_LIB([dl], [dlopen],
[AC_CHECK_HEADER([dlfcn.h], [GCFLAGS="$GCFLAGS -DHAVE_LIBDL=1";LIBS="-ldl $LIBS"])]
)
large_color_index=1
AC_ARG_WITH([large_color_index],, large_color_index="$with_large_color_index")
if test x"$large_color_index" != "x0"; then
dnl try to find a 64 bit type for devicen color index
color_ind_type="none"
AC_CHECK_SIZEOF(unsigned long long)
if test $ac_cv_sizeof_unsigned_long_long = 8; then
color_ind_type="unsigned long long"
color_ind_size=$ac_cv_sizeof_unsigned_long_long
else
AC_CHECK_SIZEOF(unsigned long int)
if test $ac_cv_sizeof_unsigned_long_int = 8; then
color_ind_type="unsigned long int"
color_ind_size=$ac_cv_sizeof_unsigned_long_int
else
AC_CHECK_SIZEOF(unsigned __int64)
if test $ac_cv_sizeof_unsigned___int64 = 8; then
color_ind_type="unsigned __int64"
color_ind_size=$ac_cv_sizeof_unsigned___int64
else
AC_CHECK_SIZEOF(u_int64_t)
if test $ac_cv_sizeof_u_int64_t = 8; then
color_ind_type="u_int64_t"
color_ind_size=$ac_cv_sizeof_u_int64_t
fi
fi
fi
fi
else
dnl try to find a 32 bit type for devicen color index
color_ind_type="none"
AC_CHECK_SIZEOF(unsigned long int)
if test $ac_cv_sizeof_unsigned_long_int = 4; then
color_ind_type="unsigned long int"
color_ind_size=$ac_cv_sizeof_unsigned_long_int
else
AC_CHECK_SIZEOF(unsigned int)
if test $ac_cv_sizeof_unsigned_int = 4; then
color_ind_type="unsigned int"
color_ind_size=$ac_cv_sizeof_unsigned_int
else
AC_CHECK_SIZEOF(unsigned __int32)
if test $ac_cv_sizeof_unsigned___int32 = 4; then
color_ind_type="unsigned __int32"
color_in_size=$ac_cv_sizeof_unsigned___int32
else
AC_CHECK_SIZEOF(u_int32_t)
if test $ac_cv_sizeof_u_int32_t = 4; then
color_ind_type="u_int32_t"
color_ind_size=$ac_cv_sizeof_u_int32_t
fi
fi
fi
fi
fi
dnl if a suitable type wasn't found above, we fall back to
dnl a default in genarch.
if test "$color_ind_type" != "none"; then
GCFLAGS="$GCFLAGS -DGX_COLOR_INDEX_TYPE=\"$color_ind_type\""
ARCH_SIZEOF_GX_COLOR_INDEX=$color_ind_size
fi
AC_SUBST(ARCH_SIZEOF_GX_COLOR_INDEX)
dnl --------------------------------------------------
dnl Set options that we want to pass into all other
dnl configure scripts we might call
dnl --------------------------------------------------
SUBCONFIG_OPTS="--build=$build --host=$host"
#SUBCONFIG_OPTS=""
#if test x"$build_alias" != x""; then
# SUBCONFIG_OPTS="$SUBCONFIG_OPTS --build=$build_alias"
#fi
#if test x"$host_alias" != x""; then
# SUBCONFIG_OPTS="$SUBCONFIG_OPTS --host=$host_alias"
#fi
dnl --------------------------------------------------
dnl Check for libraries
dnl --------------------------------------------------
AC_CHECK_LIB(m, cos)
AC_CHECK_FUNCS([pread pwrite], [HAVE_PREAD_PWRITE="-DHAVE_PREAD_PWRITE=1"], [HAVE_PREAD_PWRITE=])
if test "x$HAVE_PREAD_PWRITE" != "x"; then
save_cflags=$CFLAGS
CFLAGS="$CFLAGS -D__USE_UNIX98=1 -D_XOPEN_SOURCE=500"
AC_CHECK_DECLS([pwrite,pread], [], [HAVE_PREAD_PWRITE=])
CFLAGS=$save_cflags
if test "x$HAVE_PREAD_PWRITE" != "x"; then
GCFLAGS="$GCFLAGS -D__USE_UNIX98=1"
fi
fi
AC_SUBST(HAVE_PREAD_PWRITE)
AC_CHECK_DECL([popen], [HAVE_POPEN_PROTO="-DHAVE_POPEN_PROTO=1"], [AVE_POPEN_PROTO=])
AC_SUBST(HAVE_POPEN_PROTO)
SYNC="nosync"
PTHREAD_LIBS=""
RECURSIVE_MUTEXATTR=""
AC_ARG_ENABLE([threading], AC_HELP_STRING([--disable-threading],
[disable support for multithreaded rendering]))
# if you haven't got pread/pwrite, we can't use multithreading
if test "x$HAVE_PREAD_PWRITE" != "x"; then
if test "$enable_threading" != "no"; then
mutex_result="no"
AC_CHECK_LIB(pthread, pthread_create, [
SYNC=posync;
PTHREAD_LIBS="-lpthread"
])
AC_MSG_CHECKING([for recursive mutexes])
AC_TRY_COMPILE([#include <pthread.h>],
[
static int k = PTHREAD_MUTEX_RECURSIVE;
#ifndef pthread_mutexattr_settype
#ifdef __cplusplus
(void) pthread_mutexattr_settype;
#else
(void) pthread_mutexattr_settype;
#endif
#endif
;
return 0;
],
[RECURSIVE_MUTEXATTR="-DGS_RECURSIVE_MUTEXATTR=PTHREAD_MUTEX_RECURSIVE"
mutex_result="PTHREAD_MUTEX_RECURSIVE"],
[AC_TRY_COMPILE([#include <pthread.h>],
[
static int k = PTHREAD_MUTEX_RECURSIVE_NP;
#ifndef pthread_mutexattr_settype
#ifdef __cplusplus
(void) pthread_mutexattr_settype;
#else
(void) pthread_mutexattr_settype;
#endif
#endif
;
return 0;
],
[RECURSIVE_MUTEXATTR="-DGS_RECURSIVE_MUTEXATTR=PTHREAD_MUTEX_RECURSIVE_NP"
mutex_result="PTHREAD_MUTEX_RECURSIVE_NP"])])
AC_MSG_RESULT($mutex_result)
fi
fi
AC_SUBST(SYNC)
AC_SUBST(PTHREAD_LIBS)
AC_SUBST(RECURSIVE_MUTEXATTR)
dnl Tesseract/Leptonica detection
TESSERACTDIR=tesseract
LEPTONICADIR=leptonica
OCR_VERSION=0
LEPTONICAINCLUDE=
TESSERACTINCLUDE=
TESSERACT_LIBS=
OCR_DEVS=
AC_ARG_WITH([tesseract], AC_HELP_STRING([--without-tesseract],
[do not try to use the Tesseract library for OCR]))
if test x$with_tesseract != xno; then
AC_MSG_CHECKING([for local Tesseract library source])
if test -d $srcdir/tesseract && test -d $srcdir/leptonica; then
AC_MSG_RESULT([yes])
AC_LANG_PUSH(C++)
AC_TRY_COMPILE([],
[return 0;],
[HAVE_CXX_COMPILER=yes],
[HAVE_CXX_COMPILER=no])
if test x$HAVE_CXX_COMPILER != xyes; then
AC_MSG_WARN([Disabling tesseract as no working C++ compiler])
else
dnl --------------------------------------------------
dnl check for sse4.1, avx, avx2 or fma
dnl --------------------------------------------------
AC_MSG_CHECKING([sse4.1 support])
save_cxxflags=$CXXFLAGS
TESS_CXXFLAGS=""
CXXFLAGS="$CXXFLAGS -msse4.1"
TESS_SSE4_1=""
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <emmintrin.h>
#include <smmintrin.h>],
[__m128i input1;
unsigned char buf1[[128]];
input1 = _mm_loadu_si128((const __m128i *)buf1);
input1 = _mm_hadd_epi32(input1, input1);
return(0);
])],
[TESS_SSE4_1="-msse4.1"],
[TESS_SSE4_1=""])
if test "x$TESS_SSE4_1" != x; then
AC_MSG_RESULT(yes)
TESS_CXXFLAGS="$TESS_CXXFLAGS -DHAVE_SSE4_1"
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([avx support])
CXXFLAGS="$save_cxxflags -mavx"
TESS_AVX=""
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <immintrin.h>],
[__m256d input1 = _mm256_setzero_pd();
input1 = _mm256_hadd_pd(input1, input1);
return(0);])],
[TESS_AVX="-mavx"],
[TESS_AVX=""])
if test "x$TESS_AVX" != x; then
AC_MSG_RESULT(yes)
TESS_CXXFLAGS="$TESS_CXXFLAGS -DHAVE_AVX"
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([avx2 support])
CXXFLAGS="$save_cxxflags -mavx2"
TESS_AVX2=""
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <immintrin.h>],
[__m256i input1;
unsigned char buf1[[256]];
input1 = _mm256_loadu_si256((const __m256i *)buf1);
input1 = _mm256_adds_epu8(input1, input1);
return(0);])],
[TESS_AVX2="-mavx2"],
[TESS_AVX2=""])
if test "x$TESS_AVX2" != x; then
AC_MSG_RESULT(yes)
TESS_CXXFLAGS="$TESS_CXXFLAGS -DHAVE_AVX2"
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([fma support])
CXXFLAGS="$save_cxxflags -mfma"
TESS_FMA=""
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <immintrin.h>],
[__m256d input1 = _mm256_setzero_pd();
input1 = _mm256_fmadd_pd(input1, input1, input1);
return(0);])],
[TESS_FMA="-mfma"],
[TESS_FMA=""])
if test "x$TESS_FMA" != x; then
AC_MSG_RESULT(yes)
TESS_CXXFLAGS="$TESS_CXXFLAGS -DHAVE_FMA"
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([neon support])
CXXFLAGS="$save_cxxflags -mfpu=neon -mcpu=cortex-a53"
TESS_NEON=""
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include "arm_neon.h"],
[int32x4_t round = vdupq_n_s32(10);
return(0);])],
[TESS_NEON="-mfpu=neon -mcpu=cortex-a53 -D__ARM_NEON__"],
[TESS_NEON=""])
if test "x$TESS_NEON" != x; then
AC_MSG_RESULT(yes)
TESS_CXXFLAGS="$TESS_CXXFLAGS -DHAVE_NEON"
else
AC_MSG_RESULT(no)
fi
CXXFLAGS="$save_cxxflags"
OCR_VERSION=1
OCR_DEVS="\$(DD)ocr.dev \$(DD)hocr.dev \$(DD)pdfocr8.dev \$(DD)pdfocr24.dev \$(DD)pdfocr32.dev"
LEPTONICAINCLUDE="include base/leptonica.mak"
TESSERACTINCLUDE="include base/tesseract.mak"
TESSERACT_LIBS="-lstdc++"
fi
AC_LANG_POP()
else
AC_MSG_RESULT([no])
fi
fi
AC_SUBST(TESSERACT_LIBS)
AC_SUBST(LEPTONICAINCLUDE)
AC_SUBST(TESSERACTINCLUDE)
AC_SUBST(LEPTONICADIR)
AC_SUBST(TESSERACTDIR)
AC_SUBST(OCR_DEVS)
AC_SUBST(OCR_VERSION)
AC_SUBST(TESS_AVX)
AC_SUBST(TESS_AVX2)
AC_SUBST(TESS_FMA)
AC_SUBST(TESS_SSE4_1)
AC_SUBST(TESS_NEON)
AC_SUBST(TESS_CXXFLAGS)
dnl Tests for iconv (Needed for OpenPrinting Vector, "opvp" output device)
AC_ARG_WITH(libiconv,
[AC_HELP_STRING([--with-libiconv=@<:@no/gnu/native@:>@],
[use the libiconv library])],,
[with_libiconv=maybe])
found_iconv=no
case $with_libiconv in
maybe)
# Check in the C library first
AC_CHECK_FUNC(iconv_open, [with_libiconv=no; found_iconv=yes])
# Check if we have GNU libiconv
if test $found_iconv = "no"; then
AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
fi
# Check if we have a iconv in -liconv, possibly from vendor
if test $found_iconv = "no"; then
AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
fi
;;
no)
found_iconv=no
;;
gnu|yes)
AC_CHECK_LIB(iconv, libiconv_open, [with_libiconv=gnu; found_iconv=yes])
;;
native)
AC_CHECK_LIB(iconv, iconv_open, [with_libiconv=native; found_iconv=yes])
;;
esac
if test x$found_iconv != xno -a x$with_libiconv != xno ; then
LIBS="$LIBS -liconv"
fi
case $with_libiconv in
gnu)
AC_DEFINE(USE_LIBICONV_GNU, 1, [Using GNU libiconv])
CFLAGS="$CFLAGS -DUSE_LIBICONV_GNU"
;;
native)
AC_DEFINE(USE_LIBICONV_NATIVE, 1, [Using a native implementation of iconv in a separate library])
;;
esac
dnl Check for libidn (needed for Unicode password support)
AC_ARG_WITH(libidn,
[AC_HELP_STRING([--without-libidn],
[Do not use libidn to support Unicode passwords])],,
[with_libidn=maybe])
if test x$with_libidn != xno; then
if test x"$PKGCONFIG" != x""; then
AC_MSG_CHECKING(for libidn with pkg-config)
if $PKGCONFIG --exists libidn; then
AC_MSG_RESULT(yes)
LIBS="$LIBS `$PKGCONFIG --libs libidn`"
HAVE_LIBIDN=-DHAVE_LIBIDN
else
AC_MSG_RESULT(no)
fi
fi
if test -z "$HAVE_LIBIDN"; then
AC_CHECK_LIB(idn, stringprep, [
with_libidn=no
AC_CHECK_HEADER([stringprep.h],
[
with_libidn=yes
HAVE_LIBIDN="-DHAVE_LIBIDN"
LIBS="$LIBS -lidn"
])
], [
if test x$with_libidn != xmaybe; then
AC_MSG_ERROR([libidn not found])
fi
with_libidn=no
])
fi
fi
UTF8DEVS=''
if test x$with_libidn != xno; then
if test x$found_iconv != xno; then
UTF8DEVS='$(PSD)utf8.dev'
fi
fi
AC_SUBST(HAVE_LIBIDN)
AC_SUBST(UTF8DEVS)
dnl Tests for libpaper (to determine system default paper size)
AC_ARG_WITH([libpaper],
AC_HELP_STRING([--without-libpaper],
[disable libpaper support]))
if test x$with_libpaper != xno; then
AC_CHECK_LIB(paper, systempapername, [with_libpaper=yes],
[
AC_MSG_WARN([disabling support for libpaper])
with_libpaper=no
])
fi
if test x$with_libpaper != xno; then
AC_CHECK_HEADER([paper.h], [with_libpaper=yes],
[
AC_MSG_WARN([disabling support for libpaper])
with_libpaper=no
])
fi
if test x$with_libpaper != xno; then
LIBS="$LIBS -lpaper"
AC_DEFINE(USE_LIBPAPER, 1, [Using libpaper])
CFLAGS="$CFLAGS -DUSE_LIBPAPER"
fi
dnl Fontconfig support
HAVE_FONTCONFIG=""
FONTCONFIG_CFLAGS=""
FONTCONFIG_LIBS=""
AC_ARG_ENABLE([fontconfig], AC_HELP_STRING([--disable-fontconfig],
[Do not use fontconfig to list system fonts]))
if test "$enable_fontconfig" != "no"; then
# We MUST NOT use PKG_CHECK_MODULES since it is a) not a standard
# autoconf macro and b) requires pkg-config on the system, which is
# NOT standard on ANY OS, including Linux!
if test "x$PKGCONFIG" != x; then
AC_MSG_CHECKING(for fontconfig with pkg-config)
if $PKGCONFIG --exists fontconfig; then
AC_MSG_RESULT(yes)
FONTCONFIG_CFLAGS="$CFLAGS `$PKGCONFIG --cflags fontconfig`"
FONTCONFIG_LIBS="`$PKGCONFIG --libs-only-l fontconfig`"
HAVE_FONTCONFIG=-DHAVE_FONTCONFIG
else
AC_MSG_RESULT(no)
fi
fi
if test -z "$HAVE_FONTCONFIG"; then
AC_CHECK_LIB([fontconfig], [FcInitLoadConfigAndFonts], [
AC_CHECK_HEADER([fontconfig/fontconfig.h], [
FONTCONFIG_LIBS="-lfontconfig"
HAVE_FONTCONFIG="-DHAVE_FONTCONFIG"
])
])
fi
fi
AC_SUBST(HAVE_FONTCONFIG)
AC_SUBST(FONTCONFIG_CFLAGS)
AC_SUBST(FONTCONFIG_LIBS)
dnl DBus support
HAVE_DBUS=""
DBUS_CFLAGS=""
DBUS_LIBS=""
AC_ARG_ENABLE([dbus], AC_HELP_STRING([--disable-dbus],
[Do not use dbus to communicate with external services]))
if test "$enable_dbus" != "no"; then
if test "x$PKGCONFIG" != x; then
AC_MSG_CHECKING(for dbus with pkg-config)
if $PKGCONFIG --exists dbus-1; then
AC_MSG_RESULT(yes)
DBUS_CFLAGS="$CFLAGS `$PKGCONFIG --cflags dbus-1`"
DBUS_LIBS="`$PKGCONFIG --libs dbus-1`"
HAVE_DBUS=-DHAVE_DBUS
else
AC_MSG_RESULT(no)
fi
fi
if test -z "$HAVE_DBUS"; then
AC_CHECK_LIB([dbus], [dbus_message_iter_get_basic], [
AC_CHECK_HEADER([dbus-1.0/dbus/dbus.h], [
DBUS_LIBS="-ldbus-1 -lpthread -lrt"
HAVE_DBUS="-DHAVE_DBUS"
])
])
fi
fi
AC_SUBST(HAVE_DBUS)
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
AC_ARG_ENABLE([freetype], AC_HELP_STRING([--disable-freetype],
[Disable freetype for font rasterization]))
FT_BRIDGE=0
SHARE_FT=0
FTSRCDIR=src
FT_CFLAGS=
FT_LIBS=
INSERT_UFST_BRIDGE_EQUAL_ONE=
UFST_ROOT=
UFST_CFLAGS=
UFST_LIB_EXT=
FAPIUFST_MAK="\$(GLSRCDIR)\$(D)stub.mak"
if test x"$enable_fapi" != xno; then
dnl UFST detection
AC_ARG_WITH([ufst], AC_HELP_STRING([--with-ufst=UFST_ROOT_DIR],
[Use UFST]),
[], [with_ufst=no])
if test x"$with_ufst" != xno; then
if test -d $with_ufst; then
INSERT_UFST_BRIDGE_EQUAL_ONE="UFST_BRIDGE=1"
case $with_ufst in
/*) UFST_ROOT=$with_ufst ;;
*) UFST_ROOT=`pwd`/$with_ufst ;;
esac
# Various versions of UFST fail to build with -Werror=return-type so
# strip that off our GCFLAGS if it's there.
tmp_cflags=""
for tmp_cflag in $GCFLAGS ; do
echo $tmp_cflag
tmp_cflags="$tmp_cflags $(echo $tmp_cflag | grep -v "Werror=return-type")"
done
GCFLAGS="$tmp_cflags"
FAPIUFST_MAK="\$(UFST_ROOT)\$(D)fapiufst.mak"
if ! test -f $UFST_ROOT/fapiufst.mak ; then
echo $UFST_ROOT/fapiufst.mak
AC_MSG_ERROR([UFST: fapiufst.mak not found])
fi
# Check pointer size
AC_CHECK_SIZEOF(char*)
# UFST 5.x uses strcmpi() but on GNU systems the equivalent is
# strcasecmp()
if test "x$ac_cv_sizeof_charp" = "x8"; then
UFST_CFLAGS="-DGCCx86_64 -DO_BINARY=0 -Dstrcmpi=strcasecmp"
else
if test "x$ac_cv_sizeof_charp" = "x4"; then
UFST_CFLAGS="-DGCCx86 -DO_BINARY=0 -Dstrcmpi=strcasecmp"
fi
fi
UFST_LIB_EXT=.a
else
AC_MSG_ERROR([UFST source directory not found])
fi
fi
if test x"$enable_freetype" != xno; then
AC_MSG_CHECKING([for local freetype library source])
dnl We prefer freetype2 over freetype, so it is easy to override
dnl the included freetype source with a checkout from upstream.
for dir in $srccdir/freetype2 $srcdir/freetype; do
if test -f $dir/src/base/ftbbox.c; then
AC_MSG_RESULT(yes)
SHARE_FT=0
FTSRCDIR="$dir"
FT_CFLAGS="-I$dir/include"
FT_BRIDGE=1
break;
fi
done
if test x"$FTSRCDIR" = x"src"; then
AC_MSG_RESULT([no])
if test x"$PKGCONFIG" != x""; then
AC_MSG_CHECKING(for system freetype2 >= 2.4.2 with pkg-config)
# pkg-config needs the libtool version, which != the freetype2 version <sigh!>
# There is a table of corresponding ft2<->libtool numbers in freetype/docs/VERSION.DLL
if $PKGCONFIG --atleast-version=12.0.6 freetype2; then
AC_MSG_RESULT(yes)
FT_CFLAGS="$CFLAGS `$PKGCONFIG --cflags freetype2`"
FT_LIBS="`$PKGCONFIG --libs-only-l freetype2`"
FT_BRIDGE=1
SHARE_FT=1
else
AC_MSG_RESULT(no)
AFS=1
fi
else
AC_CHECK_HEADER([ft2build.h], [FT_BRIDGE=1], [AFS=1])
if test "x$FT_BRIDGE" = x1; then
AC_CHECK_LIB(freetype, FT_Init_FreeType,
[FT_BRIDGE=1], [FT_BRIDGE=0; AFS=1])
if test "x$FT_BRIDGE" = x1; then
AC_MSG_CHECKING(for system freetype2 library >= 2.4.2)
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include "ft2build.h"
#include FT_FREETYPE_H], [
#if FREETYPE_MAJOR < 2
FAIL
#endif
#if FREETYPE_MINOR < 4
FAIL
#endif
#if FREETYPE_PATCH < 2
FAIL
#endif
return(0);
])],
[FT_BRIDGE=1;AC_MSG_RESULT(yes)], [FT_BRIDGE=0; AFS=1;AC_MSG_RESULT(no)])
fi
fi
fi
fi
fi
fi
if test x"$FT_BRIDGE" != x"1"; then
if test x"$enable_auxtools_only" != x"yes" ; then
AC_MSG_ERROR([No usable Freetype source or library found])
fi
fi
AC_SUBST(INSERT_UFST_BRIDGE_EQUAL_ONE)
AC_SUBST(UFST_ROOT)
AC_SUBST(UFST_CFLAGS)
AC_SUBST(UFST_LIB_EXT)
AC_SUBST(FAPIUFST_MAK)
AC_SUBST(FT_BRIDGE)
AC_SUBST(SHARE_FT)
AC_SUBST(FTSRCDIR)
AC_SUBST(FT_CFLAGS)
AC_SUBST(FT_LIBS)
TIFF_JPEG_INCLUDE=
if test x"$enable_auxtools_only" = x"yes" ; then
LIBJPEGDIR=
SHARE_LIBJPEG=0
AC_DEFINE([DONT_HAVE_JMEMSYS_H], 1, [])
AC_SUBST(SHARE_LIBJPEG)
AC_SUBST(LIBJPEGDIR)
else
AC_MSG_CHECKING([for local jpeg library source])
dnl At present, we give the local source priority over the shared
dnl build, so that the D_MAX_BLOCKS_IN_MCU patch will be applied.
dnl A more sophisticated approach would be to test the shared lib
dnl to see whether it has already been patched.
LIBJPEGDIR=src
if test -f $srcdir/jpeg/jpeglib.h; then
AC_MSG_RESULT([jpeg])
SHARE_LIBJPEG=0
LIBJPEGDIR=$srcdir/jpeg
elif test -f $srcdir/jpeg-6b/jpeglib.h; then
AC_MSG_RESULT([jpeg-6b])
SHARE_LIBJPEG=0
LIBJPEGDIR=$srcdir/jpeg-6b
else
AC_MSG_RESULT([no])
AC_CHECK_LIB(jpeg, jpeg_set_defaults, [
AC_CHECK_HEADERS([jpeglib.h], [SHARE_LIBJPEG=1])
])
fi
if test x"$LIBJPEGDIR" != x"src" ; then
TIFF_JPEG_INCLUDE="$LIBJPEGDIR"
fi
if test -z "$SHARE_LIBJPEG"; then
AC_MSG_ERROR([I wasn't able to find a copy
of the jpeg library. This is required for compiling
ghostscript. Please download a copy of the source,
e.g. from http://www.ijg.org/, unpack it at the
top level of the gs source tree, and rename
the directory to 'jpeg'.
])
fi
AC_SUBST(SHARE_LIBJPEG)
AC_SUBST(LIBJPEGDIR)
dnl check for the internal jpeg memory header
AC_MSG_CHECKING([for jmemsys.h])
if test -r $LIBJPEGDIR/jmemsys.h; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
AC_DEFINE([DONT_HAVE_JMEMSYS_H], 1,
[define if the libjpeg memory system prototypes aren't available])
fi
fi
# this option is useful if you're cross-compiling and want to use
# your toolchain's zlib for $host but the local one for $build
AC_ARG_WITH([local-zlib], AC_HELP_STRING([--without-local-zlib],
[do not check for local zlib sources (has no effect on AUX toolchain when cross-building)]))
AC_MSG_CHECKING([for local zlib source])
dnl zlib is needed for language level 3, and libpng
# we must define ZLIBDIR regardless because png.mak does a -I$(ZLIBDIR)
# this seems a harmless default
ZLIBDIR=src
AUX_SHARED_ZLIB=
ZLIBCFLAGS=""
if test x"$with_local_zlib" = x"no" ; then
AC_MSG_RESULT([skip])
AC_CHECK_LIB(z, deflate, [
AC_CHECK_HEADERS(zlib.h, [SHARE_ZLIB=1; AUX_SHARED_ZLIB="-l\$(ZLIB_NAME)"])
])
else
if test -d $srcdir/zlib; then
AC_MSG_RESULT([yes])
SHARE_ZLIB=0
ZLIBDIR=$srcdir/zlib
if test x"$GCC" = x"yes"; then
ZLIBCFLAGS="-Wno-write-strings"
fi
else
AC_MSG_RESULT([no])
AC_CHECK_LIB(z, deflate, [
AC_CHECK_HEADERS(zlib.h, [SHARE_ZLIB=1; AUX_SHARED_ZLIB="-l\$(ZLIB_NAME)"])
])
fi
fi
if test -z "$SHARE_ZLIB"; then
AC_MSG_ERROR([I did not find a copy of zlib on your system.
Please either install it, or unpack a copy of the source in a
local directory named 'zlib'. See http://www.gzip.org/zlib/
for more information.
])
fi
dnl if GS is to use the system zlib, freetype
dnl should do the same
FT_SYS_ZLIB=""
if test x$FT_BRIDGE != x0; then
if test xx$SHARE_FT != x1; then
if test x$SHARE_ZLIB != x0; then
FT_SYS_ZLIB="-DFT_CONFIG_OPTION_SYSTEM_ZLIB"
fi
fi
fi
AC_SUBST(SHARE_ZLIB)
AC_SUBST(AUX_SHARED_ZLIB)
AC_SUBST(ZLIBCFLAGS)
AC_SUBST(ZLIBDIR)
AC_SUBST(FT_SYS_ZLIB)
dnl png for the png output device; it also requires zlib
if test x"$enable_auxtools_only" = x"yes" ; then
LIBPNGDIR=""
SHARE_LIBPNG=0
else
LIBPNGDIR=src
PNGDEVS=''
PNGDEVS_ALL='png48 png16m pnggray pngmono pngmonod png256 png16 pngalpha'
AC_MSG_CHECKING([for local png library source])
if test -f $srcdir/libpng/pngread.c; then
AC_MSG_RESULT([yes])
SHARE_LIBPNG=0
LIBPNGDIR=$srcdir/libpng
PNGDEVS="$PNGDEVS_ALL"
case $host in
*powerpc*)
# Building on PPC with gcc, disable libpng's PPC specific
# optimizations: we don't include the source file for it
# and it only applies to reading, which we don't use.
if test $GCC = yes; then
CFLAGS="$CFLAGS -DPNG_POWERPC_VSX_OPT=0"
fi
;;
*arm64*|*aarch64*)
# Building on arm64 with gcc, disable libpng's neon
# optimizations.
if test $GCC = yes; then
CFLAGS="$CFLAGS -DPNG_ARM_NEON_OPT=0"
fi
;;
esac
else
AC_MSG_RESULT([no])
AC_CHECK_LIB(png, png_create_write_struct, [
AC_CHECK_HEADERS(png.h, [
SHARE_LIBPNG=1
PNGDEVS="$PNGDEVS_ALL"
], [SHARE_LIBPNG=0])
], [SHARE_LIBPNG=0], [-lz])
fi
if test -z "$PNGDEVS"; then
AC_MSG_NOTICE([disabling png output devices])
fi
fi
AC_SUBST(SHARE_LIBPNG)
AC_SUBST(LIBPNGDIR)
#AC_SUBST(PNGDEVS)
WHICHLCMS=
AC_MSG_CHECKING([for local lcms2mt library source])
LCMS2DIR=src
LCMS2MTDIR=src
if test x"$enable_auxtools_only" = x"yes" ; then
SHARELCMS=0
LCMS2DIR=
LCMS2MTDIR=
else
# First check for Artifex version
LCMS2MTSRC=$srcdir/lcms2mt
if test -f $LCMS2MTSRC/include/lcms2mt.h; then
AC_MSG_RESULT([yes])
SHARELCMS=0
WHICHLCMS=lcms2mt
LCMS2MTDIR=$LCMS2MTSRC
else
AC_MSG_RESULT([no])
# Now check for local lcms2 (non-Artifex)
AC_MSG_CHECKING([for local lcms2 library source])
LCMS2SRC=$srcdir/lcms2
if test -f $LCMS2SRC/include/lcms2.h; then
AC_MSG_RESULT([yes])
SHARELCMS=0
WHICHLCMS=lcms2
LCMS2DIR=$LCMS2SRC
else
# See if we have system library of lcms2
AC_MSG_RESULT([no])
AC_MSG_CHECKING([for system lcms2 library])
AC_CHECK_LIB(lcms2, _cmsCreateMutex, [
AC_CHECK_HEADERS([lcms2.h], [SHARELCMS=1;WHICHLCMS=lcms2])
])
if test x$WHICHLCMS = x; then
AC_MSG_ERROR([lcms2 not found, or too old])
fi
fi
fi
fi
AC_SUBST(SHARELCMS)
AC_SUBST(WHICHLCMS)
AC_SUBST(LCMS2DIR)
AC_SUBST(LCMS2MTDIR)
dnl look for libtiff, it also requires lib
dnl png for the png output device; it also requires zlib
AC_ARG_WITH([libtiff], AC_HELP_STRING([--without-libtiff],
[disable use of libtiff]), with_libtiff=no)
AC_ARG_WITH([system-libtiff], AC_HELP_STRING([--with-system-libtiff],
[Force using the systems libtiff]),
[], [with_system_libtiff=check])
if test x"$with_libtiff" = x"no" ; then
with_system_libtiff=none
fi
TIFFDEVS=''
FAX_DEVS=''
XPSWRITEDEVICE=''
LIBTIFFDIR='src'
LIBTIFFCONFDIR=''
TIFFCFLAGS=''
TIFFDEVS_ALL='tiffs tiff12nc tiff24nc tiff48nc tiff32nc tiff64nc tiffcrle tifflzw tiffpack tiffgray tiffsep tiffsep1 tiffscaled tiffscaled4 tiffscaled8 tiffscaled24 tiffscaled32'
FAX_DEVS_ALL='cfax dfaxlow dfaxhigh fax faxg3 faxg32d faxg4 tiffg3 tiffg32d tiffg4 tfax'
case "x$with_system_libtiff" in
xcheck)
if test -d $srcdir/tiff; then
LIBTIFFDIR=$srcdir/tiff
LIBTIFFCONFDIR=tiff-config
HAVE_LOCAL_LIBTIFF=1
SHARE_LIBTIFF=0
ENABLETIFF="\$(D_)TIFF_INCLUDED\$(_D)"
else
# We MUST NOT use PKG_CHECK_MODULES since it is a) not a standard
# autoconf macro and b) requires pkg-config on the system, which is
# NOT standard on ANY OS, including Linux!
if test "x$PKGCONFIG" != x; then
AC_MSG_CHECKING(for libtiff with pkg-config)
if $PKGCONFIG --exists libtiff-4; then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags libtiff-4`"
LIBS="$LIBS `$PKGCONFIG --libs libtiff-4`"
HAVE_SYSTEM_LIBTIFF=1
fi
fi
if test "x$HAVE_SYSTEM_LIBTIFF" = "x1"; then
AC_CHECK_LIB(tiff, TIFFOpen,
[AC_CHECK_HEADERS(tiff.h, [HAVE_SYSTEM_LIBTIFF=1;SHARE_LIBTIFF=1])],
[], [-ljpeg])
fi
fi
if test "x$HAVE_LOCAL_LIBTIFF" = x && test "x$HAVE_SYSTEM_LIBTIFF" = x; then
AC_MSG_NOTICE([Could not find a copy of libtiff on your system. Disabling tiff and xps output devices.])
else
TIFFDEVS="$TIFFDEVS_ALL"
FAX_DEVS="$FAX_DEVS_ALL"
XPSWRITEDEVICE='xpswrite'
ENABLETIFF="\$(D_)TIFF_INCLUDED\$(_D)"
fi
;;
xyes)
# We MUST NOT use PKG_CHECK_MODULES since it is a) not a standard
# autoconf macro and b) requires pkg-config on the system, which is
# NOT standard on ANY OS, including Linux!
if test "x$PKGCONFIG" != x; then
AC_MSG_CHECKING(for libtiff with pkg-config)
if $PKGCONFIG --exists libtiff-4; then
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS `$PKGCONFIG --cflags libtiff-4`"
LIBS="$LIBS `$PKGCONFIG --libs libtiff-4`"
HAVE_SYSTEM_LIBTIFF=1
fi
fi
if test -z "$HAVE_SYSTEM_LIBTIFF"; then
AC_CHECK_LIB(tiff, TIFFOpen,
[AC_CHECK_HEADERS(tiff.h, [HAVE_SYSTEM_LIBTIFF=1;SHARE_LIBTIFF=1])],
[], [-ljpeg])
fi
if test "x$HAVE_SYSTEM_LIBTIFF" != x; then
SHARE_LIBTIFF=1
TIFFDEVS="$TIFFDEVS_ALL"
FAX_DEVS="$FAX_DEVS_ALL"
XPSWRITEDEVICE='xpswrite'
ENABLETIFF="\$(D_)TIFF_INCLUDED\$(_D)"
else
AC_MSG_NOTICE([Could not find a copy of libtiff on your system. Disabling tiff and xps output devices.])
fi
;;
xno)
AC_MSG_CHECKING([for local libtiff source])
if test -d $srcdir/tiff; then
AC_MSG_RESULT([yes])
LIBTIFFDIR=$srcdir/tiff
LIBTIFFCONFDIR=tiff-config
SHARE_LIBTIFF=0
TIFFDEVS="$TIFFDEVS_ALL"
FAX_DEVS="$FAX_DEVS_ALL"
XPSWRITEDEVICE='xpswrite'
ENABLETIFF="\$(D_)TIFF_INCLUDED\$(_D)"
else
AC_MSG_RESULT([no])
AC_MSG_NOTICE([Could not find local copy of libtiff. Disabling tiff and xps output devices.])
fi
;;
xnone)
;;
esac
if test x"$SHARE_LIBTIFF" != x"$SHARE_LIBJPEG" ; then
AC_MSG_ERROR([Mixing local libtiff with shared libjpeg not supported])
fi
CGLAGS_STORE=$CFLAGS
CFLAGS=-Wno-misleading-indentation
AC_TRY_COMPILE([], [return 0;],
[CFLAGS_NMI="-Wno-misleading-indentation"],[CFLAGS_NMI=""])
CFLAGS=-Wno-undef
AC_TRY_COMPILE([], [return 0;],
[CFLAGS_NUD="-Wno-undef"],[CFLAGS_NUD=""])
CFLAGS=$CGLAGS_STORE
if test x"$SHARE_LIBTIFF" = x"0" ; then
echo "Running libtiff configure script..."
olddir=`pwd`
if ! test -d "$LIBTIFFCONFDIR" ; then
mkdir "$LIBTIFFCONFDIR"
fi
cd "$LIBTIFFCONFDIR" && "$absolute_source_path/$LIBTIFFDIR/configure" --disable-jbig --disable-lzma --disable-zstd --disable-webp $SUBCONFIG_OPTS
status=$?
if test $status -ne 0 ; then
AC_MSG_ERROR([libtiff configure script failed], $status)
fi
cd "$olddir"
if test x"$GCC" = x"yes"; then
TIFFCFLAGS="-Wno-write-strings $CFLAGS_NMI $CFLAGS_NUD -DJPEG_LIB_MK1_OR_12BIT=0"
fi
# if we're building with our own libjpeg, or we have another libjpeg available, allow jpeg compression in TIFF
if test x"$SHARE_LIBJPEG" = x"1" ; then
TIFFCFLAGS="-DJPEG_SUPPORT -DOJPEG_SUPPORT -DJPEG_LIB_MK1_OR_12BIT=0 $TIFFCFLAGS"
fi
echo
echo "Continuing with Ghostscript configuration..."
fi
AC_SUBST(SHARE_LIBTIFF)
AC_SUBST(LIBTIFFDIR)
AC_SUBST(LIBTIFFCONFDIR)
AC_SUBST(TIFFCFLAGS)
AC_SUBST(ENABLETIFF)
SHARE_EXPAT=0
EXPATDIR=src
EXPAT_CFLAGS=
EXPAT_LIBS=
if test x"$with_xps" != x"no" -a x"$enable_auxtools_only" != x"yes" ; then
if test -f $srcdir/xps/xps.mak; then
AC_MSG_CHECKING([for local expat library source])
if test -f $srcdir/expat/lib/expat.h ; then
AC_MSG_RESULT([yes])
SHARE_EXPAT=0
EXPATDIR=$srcdir/expat
EXPAT_CFLAGS="-DHAVE_MEMMOVE"
if test x"$BIGENDIAN" != x"0"; then
EXPAT_CFLAGS="$EXPAT_CFLAGS -DBYTEORDER=4321"
else
EXPAT_CFLAGS="$EXPAT_CFLAGS -DBYTEORDER=1234"
fi
else
AC_CHECK_LIB(expat, XML_ParserCreateNS, [
AC_CHECK_HEADER([expat.h], [SHARE_EXPAT=1])
], [
AC_MSG_ERROR([expat lib not found])
])
if test $SHARE_EXPAT = 1; then
if test "x$PKGCONFIG" != x; then
if $PKGCONFIG --exists expat; then
EXPAT_LIBS="`$PKGCONFIG --libs expat`"
CFLAGS="$CFLAGS `$PKGCONFIG --cflags expat`"
fi
fi
if test x"$XPS_LDFLAGS" = x ; then
EXPAT_LIBS="-lexpat"
fi
fi
fi
fi
fi
AC_SUBST(SHARE_EXPAT)
AC_SUBST(EXPATDIR)
AC_SUBST(EXPAT_CFLAGS)
AC_SUBST(EXPAT_LIBS)
dnl look for CUPS...
AC_ARG_ENABLE([cups], AC_HELP_STRING([--disable-cups],
[Do not include CUPS support]))
AC_ARG_WITH([pdftoraster], AC_HELP_STRING([--without-pdftoraster],
[Do not include CUPS' pdftoraster filter]))
AC_ARG_WITH([local-cups], AC_HELP_STRING([--with-local-cups],
[Force using the GS supplied cups code - only useful for debugging]),
[with_local_cups=yes], [with_local_cups=no])
AC_ARG_WITH([cups-serverbin], AC_HELP_STRING([--with-cups-serverbin],
[override the "cups-config --serverbin" path]), CUPS_SERVERBIN="$withval", CUPS_SERVERBIN="")
AC_ARG_WITH([cups-serverroot], AC_HELP_STRING([--with-cups-serverroot],
[override the "cups-config --serverroot" path]), CUPS_SERVERROOT="$withval", CUPS_SERVERROOT="")
AC_ARG_WITH([cups-datadir], AC_HELP_STRING([--with-cups-datadir],
[override the "cups-config --datadir" path]), CUPS_DATADIR="$withval", CUPS_DATADIR="")
CUPSDEV=""
CUPSINCLUDE=""
CUPSCFLAGS=""
CUPSLIBS=""
CUPSLIBDIRS=""
CUPSCONFIG="${CUPSCONFIG:=}"
CUPSSERVERBIN=""
CUPSSERVERROOT=""
CUPSDATA=""
CUPSVERSION="0"
CUPSPDFTORASTER="0"
CUPS_DIR=""
cups_hard_fail=0
SHARELCUPS=1
SHARELCUPSI=1
case $host in
*-mingw*|*-msys*|*-cygwin*)
AC_MSG_WARN([disabling cups])
enable_cups=no
;;
*)
;;
esac
if ( test -f $srcdir/cups/gdevcups.c ); then
CUPS_DIR="$srcdir/cups"
# If the user explicitly enabled cups, hard fail if not found
if test x"$enable_cups" = x"yes"; then
cups_hard_fail=1
fi
if test x$enable_cups != xno; then
if test x$with_local_cups != xyes; then
if test x"$CUPSCONFIG" = x""; then
AC_PATH_TOOL(CUPSCONFIG,cups-config)
if test x"$build" != x"$host"; then
AC_PATH_PROG(BUILD_CUPSCONFIG, cups-config)
if test x"$BUILD_CUPSCONFIG" = x"$CUPSCONFIG" ; then
CUPSCONFIG=
fi
fi
else
# We were given a cups-config on the command line, assume the user intends to
# include cups, and make not finding a hard fail.
cups_hard_fail=1
fi
# check for a libcups header
AC_CHECK_HEADER([cups/cups.h],[],[CUPSCONFIG=""])
# And check for a libcupsimage header
if test "x$CUPSCONFIG" != x; then
AC_CHECK_HEADER([cups/raster.h],[],[CUPSCONFIG=""])
fi
if test "x$CUPSCONFIG" != x; then
dnl Use values from CUPS config...
CUPSCFLAGS="`$CUPSCONFIG --cflags` $CFLAGS"
# CUPSLINK="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --static --image --libs | sed -e '1,$s/-lssl//'` $LIBS"
CUPSLINK="`$CUPSCONFIG --ldflags` `$CUPSCONFIG --image --libs`"
CUPSAPIVERSION="`$CUPSCONFIG --api-version`"
GS_SPLIT_LIBS([CUPSLIBS], [$CUPSLINK])
GS_SPLIT_LIBPATHS([CUPSLIBDIRS],[$CUPSLINK])
if test "x$CUPS_SERVERROOT" != "x"; then
CUPSSERVERROOT="$CUPS_SERVERROOT"
else
CUPSSERVERROOT="`$CUPSCONFIG --serverroot`"
fi
if test "x$CUPS_SERVERBIN" != "x"; then
CUPSSERVERBIN="$CUPS_SERVERBIN"
else
CUPSSERVERBIN="`$CUPSCONFIG --serverbin`"
fi
if test "x$CUPS_DATADIR" != "x"; then
CUPSDATA="$CUPS_DATADIR"
else
CUPSDATA="`$CUPSCONFIG --datadir`"
fi
CUPSINCLUDE="include $srcdir/cups/cups.mak"
CUPSDEV="cups"
# pwgraster support arrived in cups 1.5.x
if test "$CUPSAPIVERSION" ">" "1.4" ; then
CUPSDEV="$CUPSDEV pwgraster"
fi
CUPSVERSION="`$CUPSCONFIG --version`"
LCUPSINCLUDE="include \$(GLSRCDIR)/lcups.mak"
LCUPSIINCLUDE="include \$(GLSRCDIR)/lcupsi.mak"
if ( test x$with_pdftoraster != xno ); then
if test "$CUPSVERSION" ">" "1.2"; then
CUPSPDFTORASTER="1"
fi
fi
else
if test x"$cups_hard_fail" = x"1" ; then
AC_MSG_ERROR([libcups/libcupsimage not found])
fi
fi
else
AC_MSG_WARN([USING LOCAL CUPS SOURCE])
SHARELCUPS=0
SHARELCUPSI=0
LCUPSBUILDTYPE=linux
LCUPSINCLUDE="include \$(GLSRCDIR)/lcups.mak"
LCUPSIINCLUDE="include \$(GLSRCDIR)/lcupsi.mak"
CUPSDEV="cups pwgraster"
fi
fi
fi
#AC_SUBST(CUPSDEV)
AC_SUBST(CUPSCFLAGS)
AC_SUBST(CUPSLIBS)
AC_SUBST(CUPSLIBDIRS)
AC_SUBST(CUPSINCLUDE)
AC_SUBST(CUPSSERVERBIN)
AC_SUBST(CUPSSERVERROOT)
AC_SUBST(CUPSDATA)
AC_SUBST(CUPSINSTALL)
AC_SUBST(CUPS_DIR)
AC_SUBST(SHARELCUPS)
AC_SUBST(SHARELCUPSI)
AC_SUBST(LCUPSBUILDTYPE)
AC_SUBST(LCUPSINCLUDE)
AC_SUBST(LCUPSIINCLUDE)
AC_SUBST(CUPSPDFTORASTER)
dnl look for IJS implementation
AC_ARG_WITH([ijs], AC_HELP_STRING([--without-ijs],
[disable IJS driver support]))
case $host in
*-mingw*|*-msys*)
AC_MSG_WARN([disabling the ijs device])
with_ijs=no
;;
*)
;;
esac
dnl set safe defaults
IJSDIR=src
IJSDEVS=''
SHAREIJS=0
if test x$with_ijs != xno; then
AC_MSG_CHECKING([for local ijs library source])
if test -d $srcdir/ijs; then
AC_MSG_RESULT([yes])
IJSDIR=$srcdir/ijs
IJSDEVS='ijs'
else
AC_MSG_RESULT([no])
AC_CHECK_LIB(ijs, ijs_server_init, [
AC_CHECK_HEADERS(ijs/ijs.h, [SHAREIJS=1])
])
if test $SHAREIJS -eq 1 ; then
IJSLIB=ijs
# This is for safety - it prevents our header search path going outside the GS source tree
IJSDIR='$(GLOBJDIR)'
IJSDEVS='ijs'
fi
fi
fi
AC_SUBST(IJSDIR)
AC_SUBST(SHAREIJS)
AC_SUBST(IJSLIB)
#AC_SUBST(IJSDEVS)
JBIG2_DECODER=
JBIG2DIR=src
SHARE_JBIG2=0
JBIG2DEVS=''
JBIG2_AUTOCONF_CFLAGS=
dnl Luratech detection
LURATECHDIR=luratech
AC_ARG_WITH([luratech], AC_HELP_STRING([--without-luratech],
[do not try to use the Luratech library for JBIG2 nor JPX decoding]))
if test x$with_luratech != xno; then
AC_MSG_CHECKING([for local Luratech JBIG2 library source])
if test -d $srcdir/luratech/ldf_jb2; then
AC_MSG_RESULT([yes])
JBIG2_DECODER=luratech
SHARE_JBIG2=0
JBIG2DIR=$srcdir/luratech/ldf_jb2
if test x"$JBIG2_CFLAGS" != x""; then
JBIG2_AUTOCONF_CFLAGS="$JBIG2_CFLAGS"
else
case $host in
*-darwin*)
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -DMAC -DMAC_OS_X_BUILD -fsigned-char"
;;
*-aix*)
if test $GCC = yes; then
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -fsigned-char -DLINUX=1 -DFORTE"
else
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -qchars=signed -DLINUX=1 -DFORTE"
fi
;;
*)
JBIG2_AUTOCONF_CFLAGS="-DUSE_LDF_JB2 -fsigned-char -DLINUX=1 -DFORTE"
;;
esac
fi
JBIG2FILEDEVS='$(DD)gdevjbig2.dev'
JBIG2DEVS='$(PSD)jbig2.dev'
else
AC_MSG_RESULT([no])
fi
fi
JB2_STDINT_TYPES_IN=
JBIG2DEC_REQ=0.19
if test "x$JBIG2_DECODER" = x; then
dnl look for jbig2dec
AC_ARG_WITH([jbig2dec], AC_HELP_STRING([--without-jbig2dec],
[disable JBIG2 decode support]))
if test x$with_jbig2dec != xno; then
AC_MSG_CHECKING([for local jbig2dec library source])
for d in $srcdir/jbig2dec $srcdir/jbig2dec-0.2 $srcdir/jbig2dec-0.3; do
test -d "$d" && JBIG2DIR=$d && break
done
if test "x$JBIG2DIR" != xsrc; then
JBIG2_DECODER=jbig2dec
if test x$ac_cv_header_stdint_h = xyes ; then
JBIG2_AUTOCONF_CFLAGS="-DHAVE_STDINT_H=1"
else
for include in sys/types.h inttypes.h sys/inttypes.h sys/int_types.h ; do
AC_MSG_CHECKING([for uint32_t in $include])
AC_TRY_COMPILE([#include <$include>], [uint32_t canary;], [
AC_MSG_RESULT([yes])
stdint_types_in="$include"
break;
], AC_MSG_RESULT([no])
)
done
case "$stdint_types_in" in
"sys/types.h")
JBIG2_AUTOCONF_CFLAGS="$JBIG2_AUTOCONF_CFLAGS -DSTD_INT_USE_SYS_TYPES_H"
;;
"inttypes.h")
JBIG2_AUTOCONF_CFLAGS="$JBIG2_AUTOCONF_CFLAGS -DSTD_INT_USE_INTTYPES_H"
;;
"sys/inttypes.h")
JBIG2_AUTOCONF_CFLAGS="$JBIG2_AUTOCONF_CFLAGS -DSTD_INT_USE_SYS_INTTYPES_H"
;;
"sys/int_types.h")
JBIG2_AUTOCONF_CFLAGS="$JBIG2_AUTOCONF_CFLAGS -DSTD_INT_USE_SYS_INT_TYPES_H"
;;
*)
AC_MSG_ERROR([
Unable to find suitable definitions of the stdint.h types (uint32_t and friends).
These are required by jbig2dec.
])
esac
fi
if test "x$BIGENDIAN" != "x0"; then
JBIG2_AUTOCONF_CFLAGS="$JBIG2_AUTOCONF_CFLAGS -DWORDS_BIGENDIAN"
fi
AC_MSG_RESULT([$JBIG2DIR])
echo "Continuing with Ghostscript configuration..."
else
AC_MSG_RESULT([no])
# We MUST NOT use PKG_CHECK_MODULES since it is a) not a standard
# autoconf macro and b) requires pkg-config on the system, which is
# NOT standard on ANY OS, including Linux!
if test "x$PKGCONFIG" != x; then
AC_MSG_CHECKING(for jbig2dec $JBIG2DEC_REQ with pkg-config)
if $PKGCONFIG --atleast-version=$JBIG2DEC_REQ jbig2dec; then
AC_MSG_RESULT(yes)
JBIG2DEC_CFLAGS="$CFLAGS `$PKGCONFIG --cflags jbig2dec`"
JBIG2DEC_LIBS="`$PKGCONFIG --libs jbig2dec`"
SHARE_JBIG2=1
else
AC_MSG_ERROR([jbig2 decoder not found, or too old])
fi
else
AC_MSG_CHECKING(for jbig2dec library)
AC_CHECK_LIB([jbig2dec], [jbig2_page_out], [
SHARE_JBIG2=1
], [
AC_MSG_ERROR([jbig2 decoder not found, or too old])
])
fi
if test x$with_jbig2dec != xno; then
JBIG2_DECODER=jbig2dec
fi
fi
fi
if test x$with_jbig2dec != xno; then
# I *think* jbig2dec handles these being missing gracefully
# if test x$ac_cv_header_stdint_h != xyes && test x$ac_cv_header_inttypes_h != xyes; then
# AC_MSG_WARN([JBIG2 support requires stdint types which do not seem to be available.])
# else
JBIG2DEVS='$(PSD)jbig2.dev'
# fi
fi
fi
AC_SUBST(JBIG2_DECODER)
AC_SUBST(JBIG2DIR)
AC_SUBST(SHARE_JBIG2)
AC_SUBST(JBIG2DEVS)
AC_SUBST(JBIG2_AUTOCONF_CFLAGS)
JPXDIR=src
SHARE_JPX=0
JPXDEVS=''
JPX_DECODER=
JPX_AUTOCONF_CFLAGS=
JPX_LRINTF_SUBST=
if test x$with_luratech != xno; then
AC_MSG_CHECKING([for local Luratech JPEG2K library source])
if test -d $srcdir/luratech/lwf_jp2; then
AC_MSG_RESULT([yes])
JPX_DECODER=luratech
SHARE_JPX=0
JPXDIR=$srcdir/luratech/lwf_jp2
if test x"$JPX_CFLAGS" != x""; then
JPX_AUTOCONF_CFLAGS="$JPX_CFLAGS"
else
case $host in
*-darwin*)
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DMAC -DMAC_OS_X_BUILD"
;;
*-aix*)
if test $GCC = yes; then
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -fsigned-char -DLINUX=1 -DFORTE"
else
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -qchars=signed -DLINUX=1 -DFORTE"
fi
;;
*)
JPX_AUTOCONF_CFLAGS="-DUSE_LWF_JP2 -DLINUX=1 -DFORTE"
;;
esac
fi
JPXDEVS='$(PSD)jpx.dev'
else
AC_MSG_RESULT([no])
fi
fi
if test "x$ac_cv_header_stdint_h" = "xyes"; then
CFLAGS_OPJ_HAVE_STDINT_H="-DOPJ_HAVE_STDINT_H=1"
else
CFLAGS_OPJ_HAVE_STDINT_H=
fi
if test "x$ac_cv_header_inttypes_h" = "xyes"; then
CFLAGS_OPJ_HAVE_INTTYPES_H="-DOPJ_HAVE_INTTYPES_H=1"
else
CFLAGS_OPJ_HAVE_INTTYPES_H=
fi
if test "x$BIGENDIAN" != "x0"; then
CFLAGS_OPJ_BIGENDIAN="-DOPJ_BIG_ENDIAN"
else
CFLAGS_OPJ_BIGENDIAN=
fi
AC_CHECK_FUNCS([fseeko], [CFLAGS_OPJ_HAVE_FSEEKO="-DOPJ_HAVE_FSEEKO=1"], [CFLAGS_OPJ_HAVE_STDINT_H=])
JPX_SSE_CFLAGS=""
if test "x$HAVE_SSE2" = "x" ; then
if test $GCC = yes; then
JPX_SSE_CFLAGS="-U__SSE__"
fi
fi
AC_CHECK_DECL(lrintf, , [OPJ_LRINTF_SUBST="-D\"lrintf(a)\"=\"((long)(a+0.5))\"]",[[#include <math.h>]])
AC_ARG_ENABLE([openjpeg], AC_HELP_STRING([--disable-openjpeg],
[Do not use OpenJPEG for JPX decoding]))
OPENJPEGDIR=$srcdir/openjpeg
if test "x$JPX_DECODER" = "x"; then
if test "x$enable_openjpeg" != "xno"; then
AC_MSG_CHECKING([for local OpenJPEG library source])
if test -e $OPENJPEGDIR/src/lib/openjp2/openjpeg.h; then
AC_MSG_RESULT([yes])
JPXDIR="$OPENJPEGDIR"
JPX_DECODER=openjpeg
SHARE_JPX=0
AC_CHECK_FUNCS([memalign], [have_memalign=1])
if test "x$have_memalign" = "x1"; then
JPX_AUTOCONF_CFLAGS=""
else
JPX_AUTOCONF_CFLAGS="-D\"memalign(a,b)=malloc(b)\""
fi
CFLAGS_old="$CFLAGS"
CFLAGS="-Wno-attributes"
AC_TRY_COMPILE([], [return 0;], [JPX_AUTOCONF_CFLAGS="$JPX_AUTOCONF_CFLAGS -Wno-attributes"])
CFLAGS="$CFLAGS_old"
JPX_AUTOCONF_CFLAGS="$JPX_AUTOCONF_CFLAGS -DOPJ_STATIC -DMUTEX_pthread=0 $OPJ_LRINTF_SUBST -DUSE_JPIP -DUSE_OPENJPEG_JP2 $CFLAGS_OPJ_HAVE_STDINT_H $CFLAGS_OPJ_HAVE_INTTYPES_H $CFLAGS_OPJ_BIGENDIAN $CFLAGS_OPJ_HAVE_FSEEKO"
JPXDEVS='$(PSD)jpx.dev'
else
AC_MSG_RESULT([no])
check_for_opj_stream_set_user_data=no
if test x"$PKGCONFIG" != x""; then
AC_MSG_CHECKING(for OpenJPEG2)
if $PKGCONFIG --exists libopenjp2; then
JPX_AUTOCONF_CFLAGS="`$PKGCONFIG libopenjp2 --cflags` -DUSE_OPENJPEG_JP2"
JPX_AUTOCONF_LIBS="`$PKGCONFIG libopenjp2 --libs`"
SHARE_JPX=1
JPX_DECODER=openjpeg
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
check_for_opj_stream_set_user_data=yes
fi
else
check_for_opj_stream_set_user_data=yes
fi
if test x"$check_for_opj_stream_set_user_data" != x"no"; then
AC_CHECK_LIB(openjp2, opj_stream_set_user_data,
[JPX_AUTOCONF_CFLAGS="$JPX_AUTOCONF_CFLAGS $OPJ_LRINTF_SUBST -DUSE_JPIP -DUSE_OPENJPEG_JP2 $CFLAGS_OPJ_HAVE_STDINT_H $CFLAGS_OPJ_HAVE_INTTYPES_H $CFLAGS_OPJ_BIGENDIAN $CFLAGS_OPJ_HAVE_FSEEKO";
JPX_AUTOCONF_LIBS="-lopenjp2";
SHARE_JPX=1]
)
fi
fi
fi
fi
AC_SUBST(JPX_DECODER)
AC_SUBST(JPX_AUTOCONF_CFLAGS)
AC_SUBST(JPX_AUTOCONF_LIBS)
AC_SUBST(JPXDIR)
AC_SUBST(SHARE_JPX)
AC_SUBST(JPXDEVS)
ENABLEURF=
URF_DEVS=''
URF_INCLUDE=
URF_DEV=
SURFX_H=
AC_ARG_WITH([urf], AC_HELP_STRING([--without-urf],
[do not try to include URF support]))
if test x$with_urf != xno; then
AC_MSG_CHECKING([for URF support])
if test -d $srcdir/urf; then
AC_MSG_RESULT([yes])
ENABLEURF="\$(D_)URF_INCLUDED\$(_D)"
URF_DEVS='urfgray urfrgb urfcmyk'
GPDL_URF_TOP_OBJ="\$(GPDLOBJ)/\$(GPDL_URF_TOP_OBJ_FILE)"
URF_INCLUDE="\$(I_)\$(URFSRCDIR)\$(_I)"
URF_DEV="\$(GLD)urfd.dev"
SURFX_H="\$(URFSRCDIR)\$(D)surfx.h"
fi
fi
AC_SUBST(ENABLEURF)
AC_SUBST(GPDL_URF_TOP_OBJ)
AC_SUBST(URF_INCLUDE)
AC_SUBST(URF_DEV)
AC_SUBST(SURFX_H)
AC_ARG_WITH([cal], AC_HELP_STRING([--without-cal],
[do not try to use the CAL library for acceleration]))
CALSRCDIR=$srcdir/cal
if test x$with_cal != xno; then
AC_MSG_CHECKING([for local CAL library source])
if test -d $srcdir/cal; then
AC_MSG_RESULT([yes])
WITH_CAL=1
else
WITH_CAL=0
AC_MSG_RESULT([no])
fi
else
WITH_CAL=0
fi
if test x$WITH_CAL != x0; then
dnl --------------------------------------------------
dnl check for sse4.2, avx2 or neon
dnl --------------------------------------------------
AC_MSG_CHECKING([sse4.2 support])
save_cflags=$CFLAGS
CFLAGS="$CFLAGS $OPT_CFLAGS -msse4.2"
HAVE_SSE4_2=""
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <emmintrin.h>
#include <smmintrin.h>], [
__m128i input1;
unsigned char buf1[[128]];
input1 = _mm_loadu_si128((const __m128i *)buf1);
input1 = _mm_hadd_epi32(input1, input1);
return(0);
])],
[HAVE_SSE4_2="-DHAVE_SSE4_2"], [HAVE_SSE4_2=""])
#AC_ARG_ENABLE([sse4.2], AC_HELP_STRING([--disable-sse4.2],
# [Do not use sse4.2 instrinsics]), [
# if test "x$enable_sse4.2" = xno; then
# HAVE_SSE4_2=""
# fi])
if test "x$HAVE_SSE4_2" != x; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([avx2 support])
CFLAGS="$save_cflags $OPT_CFLAGS -mavx2"
HAVE_AVX2=""
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <immintrin.h>], [
__m256i input1;
unsigned char buf1[[256]];
input1 = _mm256_loadu_si256((const __m256i *)buf1);
input1 = _mm256_adds_epu8(input1, input1);
return(0);
])],
[HAVE_AVX2="-DHAVE_AVX2"], [HAVE_AVX2=""])
#AC_ARG_ENABLE([sse4.2], AC_HELP_STRING([--disable-sse4.2],
# [Do not use sse4.2 instrinsics]), [
# if test "x$enable_sse4.2" = xno; then
# HAVE_SSE4_2=""
# fi])
if test "x$HAVE_AVX2" != x; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_MSG_CHECKING([neon support])
CFLAGS="$save_cflags $OPT_CFLAGS -mfpu=neon -mcpu=cortex-a53"
HAVE_NEON=""
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include "arm_neon.h"], [
int32x4_t round = vdupq_n_s32(10);
return(0);
])],
[HAVE_NEON="-DHAVE_NEON"], [HAVE_NEON=""])
#AC_ARG_ENABLE([neon], AC_HELP_STRING([--disable-neon],
# [Do not use neon instrinsics]), [
# if test "x$enable_neon" = xno; then
# HAVE_NEON=""
# fi])
if test "x$HAVE_NEON" != x; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
#AC_SUBST(HAVE_SSE4_2)
#AC_SUBST(HAVE_NEON)
CFLAGS=$save_cflags
CAL_CFLAGS=""
CAL_SSE4_2_CFLAGS=""
CAL_AVX2_CFLAGS=""
CAL_NEON_CFLAGS=""
if test "x$HAVE_SSE4_2" != x; then
CAL_SSE4_2_CFLAGS="-msse4.2"
fi
if test "x$HAVE_AVX2" != x; then
CAL_AVX2_CFLAGS="-mavx2"
fi
if test "x$HAVE_NEON" != x; then
CAL_NEON_CFLAGS="-mfpu=neon -mcpu=cortex-a53"
fi
fi
AC_SUBST(CALSRCDIR)
AC_SUBST(WITH_CAL)
AC_SUBST(CAL_CFLAGS)
AC_SUBST(CAL_SSE4_2_CFLAGS)
AC_SUBST(CAL_AVX2_CFLAGS)
AC_SUBST(CAL_NEON_CFLAGS)
dnl check if we can/should build the gtk loader
AC_ARG_ENABLE([gtk], AC_HELP_STRING([--disable-gtk],
[Do not build the gtk loader]))
SOC_CFLAGS=""
SOC_LIBS=""
SOC_LOADER=""
if test "x$enable_gtk" != "xno"; then
# Try GTK+ 3.x first...
if test "x$PKGCONFIG" != x; then
AC_MSG_CHECKING(for GTK+ 3.x)
if $PKGCONFIG --exists gtk+-3.0; then
SOC_LOADER="dxmain"
SOC_CFLAGS="`$PKGCONFIG gtk+-3.0 --cflags`"
SOC_LIBS="`$PKGCONFIG gtk+-3.0 --libs`"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
# Or resort to GTK+ 2.x
if test "x$SOC_LOADER" = "x"; then
AC_MSG_CHECKING(for GTK+ 2.x)
if $PKGCONFIG --exists gtk+-2.0; then
SOC_LOADER="dxmain"
SOC_CFLAGS="`$PKGCONFIG gtk+-2.0 --cflags`"
SOC_LIBS="`$PKGCONFIG gtk+-2.0 --libs`"
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
fi
fi
if test "x$SOC_LOADER" = "x"; then
SOC_LOADER="dxmainc"
fi
AC_SUBST(SOC_CFLAGS)
AC_SUBST(SOC_LIBS)
AC_SUBST(SOC_LOADER)
dnl optional X11 for display devices
if test x"$enable_auxtools_only" = x"yes" ; then
no_x=yes
else
AC_PATH_XTRA
fi
X_LDFLAGS=""
X_CFLAGS=""
X_DEVS=""
X_LIBS=""
if test x$no_x != xyes; then
if test "$x_libraries" = "/usr/lib"; then
echo "Ignoring X library directory \"$x_libraries\" requested by configure."
x_libraries="NONE"
fi
if test ! "$x_libraries" = "NONE" -a ! "$x_libraries" = ""; then
X_LDFLAGS="-L$x_libraries"
case $host in
*-sun*|*-solaris*)
X_LDFLAGS="$X_LDFLAGS -R$x_libraries"
;;
*)
;;
esac
fi
if test "$x_includes" = "/usr/include"; then
echo "Ignoring X include directory \"$x_includes\" requested by configure."
x_includes="NONE"
fi
if test ! "$x_includes" = "NONE" -a ! "$x_includes" = ""; then
X_CFLAGS="-I$x_includes"
fi
SAVELIBS="$LIBS"
SAVELDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $X_LDFLAGS"
AC_CHECK_LIB(X11,XOpenDisplay)
AC_CHECK_LIB(Xext,XdbeQueryExtension)
AC_CHECK_LIB(Xt,XtAppCreateShell)
LDFLAGS="$SAVELDFLAGS"
LIBS="$SAVELIBS"
if test "$ac_cv_lib_Xt_XtAppCreateShell" = yes; then
X11DEVS="x11 x11alpha x11cmyk x11mono x11_ x11alt_ x11cmyk2 x11cmyk4 x11cmyk8 x11rg16x x11rg32x x11gray2 x11gray4"
X_DEVS=$X11DEVS
# the makefile wants a list of just the library names in X_LIBS
GS_SPLIT_LIBS([X_LIBS],
[-lXt $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS])
fi
fi
AC_SUBST(X_LDFLAGS)
AC_SUBST(X_CFLAGS)
AC_SUBST(X_LIBS)
#AC_SUBST(X_DEVS)
#AC_SUBST(X11DEVS)
AC_SUBST(XLIBS)
dnl executible name
AC_ARG_WITH([gs], AC_HELP_STRING([--with-gs=NAME],
[name of the Ghostscript executible [[gs]]]),
[GS="$with_gs"],[GS='gs'])
AC_SUBST(GS)
PCL=no_gpcl6
PCL_TARGET=
PLROMFS_MAK="\$(GLSRCDIR)\$(D)stub.mak"
PL_MAK="\$(GLSRCDIR)\$(D)stub.mak"
PCL_MAK="\$(GLSRCDIR)\$(D)stub.mak"
PCL_TOP_MAK="\$(GLSRCDIR)\$(D)stub.mak"
PXL_MAK="\$(GLSRCDIR)\$(D)stub.mak"
if test x"$with_pcl" != x"no" ; then
if test -f $srcdir/pcl/pl/pl.mak; then
AC_ARG_WITH([pcl], AC_HELP_STRING([--with-pcl=NAME],
[name of the GhostPCL executible (if the source is available, ignored otherwise) [[gpcl6]]]),
[PCL="$with_pcl"],[PCL='gpcl6'])
PCL_TARGET=gpcl6
PLROMFS_MAK="\$(PLSRCDIR)\$(D)plromfs.mak"
PL_MAK="\$(PLSRCDIR)\$(D)pl.mak"
PCL_MAK="\$(PCL5SRCDIR)\$(D)pcl.mak"
PCL_TOP_MAK="\$(PCL5SRCDIR)\$(D)pcl_top.mak"
PXL_MAK="\$(PXLSRCDIR)\$(D)pxl.mak"
fi
fi
AC_SUBST(PCL)
AC_SUBST(PCL_TARGET)
AC_SUBST(PLROMFS_MAK)
AC_SUBST(PL_MAK)
AC_SUBST(PCL_MAK)
AC_SUBST(PCL_TOP_MAK)
AC_SUBST(PXL_MAK)
XPS=no_gxps
XPS_TARGET=
XPS_MAK="\$(GLSRCDIR)\$(D)stub.mak"
XPSROMFS_MAK="\$(GLSRCDIR)\$(D)stub.mak"
# gxps currently depends on code in pl
if test x"$with_xps" != x"no" ; then
if test x"$PCL_TARGET" != x ; then
if test -f $srcdir/xps/xps.mak; then
AC_ARG_WITH([xps], AC_HELP_STRING([--with-xps=NAME],
[name of the GhostXPS executible (if the source is available, ignored otherwise) [[gxps]]]),
[XPS="$with_xps"],[XPS='gxps'])
XPS_TARGET=gxps
XPS_MAK="\$(XPSSRCDIR)\$(D)xps.mak"
XPSROMFS_MAK="\$(XPSSRCDIR)\$(D)xpsromfs.mak"
fi
fi
fi
AC_SUBST(XPS)
AC_SUBST(XPS_TARGET)
AC_SUBST(XPS_MAK)
AC_SUBST(XPSROMFS_MAK)
GPDL=no_gpdl
GPDL_TARGET=
GPDL_TARGET_VAR=
GPDL_MAK="\$(GLSRCDIR)\$(D)stub.mak"
# in order to build gpdl we need the pdls available
if test "x$XPS_TARGET" != "x" && test "x$PCL_TARGET" != "x" ; then
if test -f $srcdir/gpdl/gpdl.mak; then
AC_ARG_WITH([gpdl], AC_HELP_STRING([--with-gpdl=NAME],
[name of the GhostPDL executible (if the source is available, ignored otherwise) [[gpdl]]]),
[GPDL="$with_gpdl"],[GPDL='gpdl'])
GPDL_TARGET=gpdl
GPDL_MAK="\$(GPDLSRCDIR)\$(D)gpdl.mak"
fi
fi
AC_SUBST(GPDL)
AC_SUBST(GPDL_TARGET)
AC_SUBST(GPDL_MAK)
dnl do we compile the postscript initialization files into Ghostscript?
COMPILE_INITS="1"
AC_ARG_ENABLE([compile-inits], AC_HELP_STRING([--disable-compile-inits],
[Do not compile in initialization files]),[
if test "x$enable_compile_inits" = xno; then
COMPILE_INITS="0"
fi])
AC_SUBST(COMPILE_INITS)
dnl look for drivers to compile...
APPLE_DEVICES_REQUESTED="no"
AC_ARG_WITH(drivers,
[ --with-drivers=LIST Drivers to support, separated by commas.
Either list the drivers or use aliases:
ALL = all drivers
FILES = all file format drivers
PRINTERS = all printer drivers
Printers:
APPLE = all Apple printers
BROTHER = all Brother printers
CANON = all Canon printers
EPSON = all Epson printers
HP = all HP printers
IBM = all IBM printers
JAPAN = older japanese printers
LEXMARK = all Lexmark printers
OKI = all OKI printers
PCLXL = all PCL XL/6 printers
File formats:
BMP = Output to bmp files
FAX = Output to fax files
JPEG = Output to JPEG files
PBM = Output to PBM/PNM
PCX = Output to PCX
PNG = Output to PNG
PS = Output to PostScript/PDF
TIFF = Output to TIFF
You can mix both variants, e.g.
--with-drivers=HP,stcolor would build HP drivers and
the Epson stcolor driver.
Aliases must be uppercase (a 3rd party driver might
have the same name).
Default: ALL],drivers="$withval",drivers="ALL")
AC_ARG_WITH(driversfile,
[ --with-driversfile=FILE Drivers to support from file, separated by newlines.],
driversfile="$withval",driversfile="")
if test "x$driversfile" != x; then
# Add drivers from file...
drivers="`tr '\n' ',' <$driversfile`"
fi
if echo $drivers | grep 'APPLE\|iwhi\|iwlo\|iwlq' >/dev/null; then
APPLE_DEVICES_REQUESTED="yes"
fi
dnl Check which drivers we'd like to support.
P_DEVS0=""
F_DEVS0=""
CUPS_DEVS0=""
XPS_DEVS0=""
JBIG2_DEVS=""
IJS_DEVS0=""
PNG_DEVS0=""
X11_DEVS0=""
dnl Known printers
HP_DEVS='cdj500 djet500 djet500c dnj650c cljet5pr deskjet laserjet ljetplus ljet2p ljet3 ljet3d ljet4 ljet4d lj4dith lj5mono lj5gray cdeskjet cdjcolor cdjmono cdj550 pj pjxl pjxl300 lp2563 paintjet pjetxl cljet5 cljet5c pxlmono pxlcolor cdj670 cdj850 cdj880 cdj890 cdj970 cdj1600 cdnj500 chp2200 pcl3 hpdjplus hpdjportable hpdj310 hpdj320 hpdj340 hpdj400 hpdj500 hpdj500c hpdj510 hpdj520 hpdj540 hpdj550c hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c hpdj690c hpdj850c hpdj855c hpdj870c hpdj890c hpdj1120c lj3100sw'
PCLXL_DEVS='pxlmono pxlcolor'
EPSON_DEVS='eps9high eps9mid epson epsonc escp lp8000 lq850 photoex st800 stcolor alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 lp3000c lp8000c lp8200c lp8300c lp8500c lp8800c lp9000c lp9200c lp9500c lp9800c lps6500 epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900 epl6100 epl6200 lp1800 lp1900 lp2200 lp2400 lp2500 lp7500 lp7700 lp7900 lp8100 lp8300f lp8400f lp8600 lp8600f lp8700 lp8900 lp9000b lp9100 lp9200b lp9300 lp9400 lp9600 lp9600s lps4500 eplcolor eplmono'
CANON_DEVS='bj10e bj200 bjc600 bjc800 lbp8 lips3 bjcmono bjcgray bjccmyk bjccolor'
LEXMARK_DEVS='lxm5700m lxm3200 lex2050 lex3200 lex5700 lex7000'
BROTHER_DEVS='hl7x0 hl1240 hl1250'
APPLE_DEVS='appledmp iwhi iwlo iwlq'
IBM_DEVS='ibmpro jetp3852'
OKI_DEVS='oki182 okiibm oki4w'
JAPAN_DEVS='lips4 lips4v ljet4pjl lj4dithp dj505j picty180 lips2p bjc880j pr201 pr150 pr1000 pr1000_4 jj100 bj10v bj10vh mj700v2c mj500c mj6000c mj8000c fmpr fmlbp ml600 lbp310 lbp320 md50Mono md50Eco md1xMono escpage lp2000 npdl rpdl'
MISC_PDEVS='uniprint ap3250 atx23 atx24 atx38 itk24i itk38 coslw2p coslwxl declj250 fs600 imagen lj250 m8510 necp6 oce9050 r4081 sj48 tek4696 t4693d2 t4693d4 t4693d8 dl2100 la50 la70 la75 la75plus ln03 xes md2k md5k gdi samsunggdi'
AC_ARG_WITH([openprinting],, OPVP_DEVS='opvp oprp', OPVP_DEVS='')
ETS_HALFTONING_DEVS='rinkj'
dnl Known file formats
BMP_DEVS='bmpmono bmpgray bmpsep1 bmpsep8 bmp16 bmp256 bmp16m bmp32b'
JPEG_DEVS='jpeg jpeggray jpegcmyk'
# PNG_DEVS='png16 png16m png256 pngalpha pnggray pngmono'
PCX_DEVS='pcxmono pcxgray pcx16 pcx256 pcx24b pcxcmyk'
PBM_DEVS='pbm pbmraw pgm pgmraw pgnm pgnmraw pnm pnmraw ppm ppmraw pkm pkmraw pksm pksmraw pam pamcmyk4 pamcmyk32 plan plang planm planc plank'
PS_DEVS='psdf psdcmyk psdrgb psdcmyk16 psdrgb16 pdfwrite ps2write eps2write bbox txtwrite inkcov ink_cov psdcmykog fpng pdfimage8 pdfimage24 pdfimage32 PCLm'
# the "display" device isn't an ideal fit in the list below, but it saves adding a "list" for just that one entry
MISC_FDEVS='ccr cif inferno mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8 mgrmono miff24 plan9bm bit bitrgb bitrgbtags bitcmyk devicen spotcmyk xcf plib plibg plibm plibc plibk display'
XPSDEV=$XPSWRITEDEVICE
while test -n "$drivers"; do
if echo $drivers |grep "," >/dev/null; then
THIS="`echo $drivers |sed -e 's/,.*//'`"
SEDCMD="s/$THIS,//"
drivers="`echo $drivers |sed -e $SEDCMD`"
else
THIS=$drivers
drivers=""
fi
case "$THIS" in
ALL)
# ALL = PRINTERS + FILES...
if test -z "$drivers"; then
drivers="PRINTERS,FILES,X11"
else
drivers="$drivers,PRINTERS,FILES,X11"
fi
;;
PRINTERS)
P_DEVS0="$P_DEVS0 $CANON_DEVS $EPSON_DEVS $HP_DEVS $LEXMARK_DEVS $BROTHER_DEVS $APPLE_DEVS $IBM_DEVS $OKI_DEVS $JAPAN_DEVS $MISC_PDEVS $ETS_HALFTONING_DEVS $URF_DEVS"
IJS_DEVS0="$IJSDEVS"
if test x"$OPVP_DEVS" != x"" ; then
if test x$ac_cv_lib_dl_dlopen != xno -a x$found_iconv != xno; then
P_DEVS0="$P_DEVS0 $OPVP_DEVS"
else
AC_MSG_ERROR(Unable to include opvp/oprp driver due to missing or disabled prerequisites...)
fi
fi
;;
FILES)
F_DEVS0="$F_DEVS0 $BMP_DEVS $FAX_DEVS $JPEG_DEVS $TIFFDEVS $PCX_DEVS $PBM_DEVS $PS_DEVS $MISC_FDEVS $XPSDEV"
CUPS_DEVS0="$CUPSDEV"
JBIG2_DEVS="$JBIG2FILEDEVS"
PNG_DEVS0="$PNGDEVS"
;;
APPLE)
# All Apple printers
P_DEVS0="$P_DEVS0 $APPLE_DEVS"
;;
BMP)
# BMP file format
F_DEVS0="$F_DEVS0 $BMP_DEVS"
;;
CANON)
# All Canon printers
P_DEVS0="$P_DEVS0 $CANON_DEVS"
;;
EPSON)
# All Epson printers
P_DEVS0="$P_DEVS0 $EPSON_DEVS"
;;
FAX)
# Fax file formats
F_DEVS0="$F_DEVS0 $FAX_DEVS"
;;
JPEG)
# Jpeg file formats
F_DEVS0="$F_DEVS0 $JPEG_DEVS"
;;
JBIG2)
# JBIG file formats
JBIG2_DEVS="$JBIG2DEVS"
;;
PNG)
# PNG file formats
PNG_DEVS0="$PNGDEVS"
;;
TIFF)
# TIFF file formats
F_DEVS0="$F_DEVS0 $TIFFDEVS"
;;
PCLXL)
# PCL XL/PCL 6 drivers
F_DEVS0="$F_DEVS0 $PCLXL_DEVS"
;;
PCX)
# PCX file formats
F_DEVS0="$F_DEVS0 $PCX_DEVS"
;;
PBM)
# PBM file formats
F_DEVS0="$F_DEVS0 $PBM_DEVS"
;;
CUPS)
# CUPS file format
CUPS_DEVS0="$CUPSDEV"
;;
HP)
# All HP printers
P_DEVS0="$P_DEVS0 $HP_DEVS"
;;
LEXMARK)
# All Lexmark printers
P_DEVS0="$P_DEVS0 $LEXMARK_DEVS"
;;
BROTHER)
# All Brother printers
P_DEVS0="$P_DEVS0 $BROTHER_DEVS"
;;
OKI)
# All OKI printers
P_DEVS0="$P_DEVS0 $OKI_DEVS"
;;
IBM)
# All IBM printers
P_DEVS0="$P_DEVS0 $IBM_DEVS"
;;
IJS)
# IJS printers
IJS_DEVS0="$IJSDEVS"
;;
JAPAN)
# All old japanese printers
P_DEVS0="$P_DEVS0 $JAPAN_DEVS"
;;
PS)
# PostScript/PDF writing
F_DEVS0="$F_DEVS0 $PS_DEVS"
;;
XPS)
# XPS writing
XPS_DEVS0="$XPSDEV"
;;
ETS)
# ETS Halftoning devices
F_DEVS0="$F_DEVS0 $ETS_HALFTONING_DEVS"
;;
X11)
# X11 display devices
X11_DEVS0="$X_DEVS"
;;
opvp)
# Open Vector Printing driver...
if test x$ac_cv_lib_dl_dlopen != xno -a x$found_iconv != xno; then
P_DEVS0="$P_DEVS0 $OPVP_DEVS"
else
AC_MSG_WARN(Unable to include opvp/oprp driver due to missing or disabled prerequisites...)
fi
;;
*)
# It's a driver name (or a user messup)
P_DEVS0="$P_DEVS0 `echo $THIS |sed -e 's,\.dev$,,'`"
;;
esac
done
if test x$enable_threadsafe = xyes; then
for ntsdev in $NTS_DEVS ; do
NTS_EXCLUDES="$(echo \"$P_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
P_DEVS0=`echo $P_DEVS0 | sed "s/\b$ntsdev\b//g"`
done
for ntsdev in $NTS_DEVS ; do
NTS_EXCLUDES="$(echo \"$F_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
F_DEVS0=`echo $F_DEVS0 | sed "s/\b$ntsdev\b//g"`
done
for ntsdev in $NTS_DEVS ; do
NTS_EXCLUDES="$(echo \"$CUPS_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
CUPS_DEVS0=`echo $CUPS_DEVS0 | sed "s/\b$ntsdev\b//g"`
done
for ntsdev in $NTS_DEVS ; do
NTS_EXCLUDES="$(echo \"$XPS_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
XPS_DEVS0=`echo $XPS_DEVS0 | sed "s/\b$ntsdev\b//g"`
done
for ntsdev in $NTS_DEVS ; do
NTS_EXCLUDES="$(echo \"$IJS_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
IJS_DEVS0=`echo $IJS_DEVS0 | sed "s/\b$ntsdev\b//g"`
done
for ntsdev in $NTS_DEVS ; do
NTS_EXCLUDES="$(echo \"$PNG_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
PNG_DEVS0=`echo $PNG_DEVS0 | sed "s/\b$ntsdev\b//g"`
done
for ntsdev in $NTS_DEVS ; do
NTS_EXCLUDES="$(echo \"$X11_DEVS0{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
X11_DEVS0=`echo $X11_DEVS0 | sed "s/\b$ntsdev\b//g"`
done
for ntsdev in $NTS_DEVS ; do
NTS_EXCLUDES="$(echo \"$JBIG2_DEVS{[@]:0}\" | grep -o $ntsdev) $NTS_EXCLUDES"
JBIG2_DEVS=`echo $JBIG2_DEVS | sed "s/\b$ntsdev\b//g"`
done
NTS_EXCLUDES=`echo "$NTS_EXCLUDES" | tr " " "\n" | sort | uniq | tr "\n" " "`
fi # x$enable_threadsafe = xyes
noncontribmakefiles=`find $srcdir -name '*.mak' -print | grep -v '/contrib/'`
# No need to include opvp/oprp driver without iconv/libiconv.
if test -n "$P_DEVS0"; then
if test x$found_iconv = xno ; then
P_DEVS0=`echo $P_DEVS0 | sed -e 's|opvp||' -e 's|oprp||'`
AC_MSG_WARN(Unable to include opvp/oprp driver due to missing iconv/libiconv...)
fi
# Remove contributed drivers if requested and make sure we don't have any
# duplicates in there, add $(DD)foo.dev constructs
P_DEVS=`(for i in $P_DEVS0; do d='$(DD)'${i}.dev; if ( grep '^'$d $noncontribmakefiles 2>&1 >/dev/null ) || ( ! test -z "$CONTRIBINCLUDE" ); then echo $d; fi; done) | sort | uniq | tr '\012\015' ' '`
fi
if test -n "$F_DEVS0"; then
F_DEVS=`(for i in $F_DEVS0; do d='$(DD)'${i}.dev; if ( grep '^'$d $noncontribmakefiles 2>&1 >/dev/null) || ( ! test -z "$CONTRIBINCLUDE" ); then echo $d; fi; done) | sort | uniq | tr '\012\015' ' '`
fi
if test -n "$CUPS_DEVS0"; then
CUPS_DEVS=`(for i in $CUPS_DEVS0; do d='$(DD)'${i}.dev; if ( grep '^'$d $noncontribmakefiles 2>&1 >/dev/null) || ( ! test -z "$CONTRIBINCLUDE" ); then echo $d; fi; done) | sort | uniq | tr '\012\015' ' '`
fi
if test -n "$XPS_DEVS0"; then
XPS_DEVS=`(for i in $XPS_DEVS0; do d='$(DD)'${i}.dev; if ( grep '^'$d $noncontribmakefiles 2>&1 >/dev/null) || ( ! test -z "$CONTRIBINCLUDE" ); then echo $d; fi; done) | sort | uniq | tr '\012\015' ' '`
fi
if test -n "$IJS_DEVS0"; then
IJS_DEVS=`(for i in $IJS_DEVS0; do d='$(DD)'${i}.dev; if ( grep '^'$d $noncontribmakefiles 2>&1 >/dev/null) || ( ! test -z "$CONTRIBINCLUDE" ); then echo $d; fi; done) | sort | uniq | tr '\012\015' ' '`
fi
if test -n "$PNG_DEVS0"; then
PNG_DEVS=`(for i in $PNG_DEVS0; do d='$(DD)'${i}.dev; if ( grep '^'$d $noncontribmakefiles 2>&1 >/dev/null) || ( ! test -z "$CONTRIBINCLUDE" ); then echo $d; fi; done) | sort | uniq | tr '\012\015' ' '`
fi
if test -n "$X11_DEVS0"; then
X11_DEVS=`(for i in $X11_DEVS0; do d='$(DD)'${i}.dev; if ( grep '^'$d $noncontribmakefiles 2>&1 >/dev/null) || ( ! test -z "$CONTRIBINCLUDE" ); then echo $d; fi; done) | sort | uniq | tr '\012\015' ' '`
fi
# if the user explicitly requested the Apple devices, then hard fail if they aren't available
if test x"$APPLE_DEVICES_REQUESTED" = x"yes" ; then
APDEVS=`echo $P_DEVS | grep 'APPLE\|iwhi\|iwlo\|iwlq'`
if test -z "$APDEVS" ; then
AC_MSG_ERROR([Requested Apple device(s) not available (iwhi, iwlo, and/or iwlq)])
fi
fi
AC_SUBST(P_DEVS)
AC_SUBST(F_DEVS)
AC_SUBST(CUPS_DEVS)
AC_SUBST(XPS_DEVS)
AC_SUBST(JBIG2_DEVS)
AC_SUBST(IJS_DEVS)
AC_SUBST(PNG_DEVS)
# This now gets done after handling --enable-dynamic
# AC_SUBST(X11_DEVS)
dnl Dynamic device support.
DYNAMIC_CFLAGS=""
DYNAMIC_DEVS=""
DYNAMIC_FLAGS=""
GS_DYNAMIC_LDFLAGS=""
PCL_DYNAMIC_LDFLAGS=""
XPS_DYNAMIC_LDFLAGS=""
PDL_DYNAMIC_LDFLAGS=""
DYNAMIC_LIBS=""
INSTALL_SHARED=""
SO_LIB_EXT=".so"
DLL_EXT=""
SO_LIB_VERSION_SEPARATOR="."
libname1="_SO_BASE)\$(GS_SOEXT)\$(DLL_EXT)"
libname2="_SO_BASE)\$(GS_SOEXT)\$(SO_LIB_VERSION_SEPARATOR)\$(GS_VERSION_MAJOR)\$(DLL_EXT)"
libname3="_SO_BASE)\$(GS_SOEXT)\$(SO_LIB_VERSION_SEPARATOR)\$(GS_VERSION_MAJOR)\$(SO_LIB_VERSION_SEPARATOR)\$(GS_VERSION_MINOR)\$(DLL_EXT)"
GS_SONAME="lib\$(GS${libname1}"
GS_SONAME_MAJOR="lib\$(GS${libname2}"
GS_SONAME_MAJOR_MINOR="lib\$(GS${libname3}"
PCL_SONAME="lib\$(PCL${libname1}"
PCL_SONAME_MAJOR="lib\$(PCL${libname2}"
PCL_SONAME_MAJOR_MINOR="lib\$(PCL${libname3}"
XPS_SONAME="lib\$(XPS${libname1}"
XPS_SONAME_MAJOR="lib\$(XPS${libname2}"
XPS_SONAME_MAJOR_MINOR="lib\$(XPS${libname3}"
GPDL_SONAME="lib\$(GPDL${libname1}"
GPDL_SONAME_MAJOR="lib\$(GPDL${libname2}"
GPDL_SONAME_MAJOR_MINOR="lib\$(GPDL${libname3}"
hide_symbols=no
attr_default=
attr_hidden=
_ldflags=
AC_ARG_ENABLE([hidden-visibility],
AC_HELP_STRING([--enable-hidden-visibility],
[hide all shared library symbols which are not part of its public API]),
[hide_symbols=yes])
if test x$hide_symbols = xyes -a $GCC = yes; then
attr_default="__attribute__((visibility(\\\"default\\\")))"
attr_hidden="__attribute__((visibility(\\\"hidden\\\")))"
fi
case $host in
*-linux*|*-gnu)
DYNAMIC_CFLAGS="-fPIC $DYNAMIC_CFLAGS"
GS_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(GS_SONAME_MAJOR)"
PCL_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(PCL_SONAME_MAJOR)"
XPS_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(XPS_SONAME_MAJOR)"
PDL_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(GPDL_SONAME_MAJOR)"
if test $GCC = yes; then
# GCC high level flag
DYNAMIC_LIBS="-rdynamic"
else
DYNAMIC_LIBS=""
fi
SO_LIB_EXT=".so"
;;
*-mingw*|*-msys*)
if test x$hide_symbols = xyes; then
attr_default="__declspec(dllexport)"
attr_hidden=""
else
_ldflags="-Wl,--export-all-symbols"
fi
_ldflags="$_ldflags -Wl,--enable-auto-import"
GS_DYNAMIC_LDFLAGS="-shared -Wl,--out-implib=\$(BINDIR)/lib\$(GS_SO_BASE).dll.a $_ldflags"
PCL_DYNAMIC_LDFLAGS="-shared -Wl,--out-implib=\$(BINDIR)/lib\$(PCL_SO_BASE).dll.a $_ldflags"
XPS_DYNAMIC_LDFLAGS="-shared -Wl,--out-implib=\$(BINDIR)/lib\$(XPS_SO_BASE).dll.a $_ldflags"
PDL_DYNAMIC_LDFLAGS="-shared -Wl,--out-implib=\$(BINDIR)/lib\$(PDL_SO_BASE).dll.a $_ldflags"
SO_LIB_EXT=""
DLL_EXT=".dll"
SO_LIB_VERSION_SEPARATOR="-"
# make sure the import library doesn't link a program against the DLL with the minor version in it
GS_SONAME="lib\$(GS${libname1}"
GS_SONAME_MAJOR="lib\$(GS${libname3}"
GS_SONAME_MAJOR_MINOR="lib\$(GS${libname2}"
PCL_SONAME="lib\$(PCL${libname1}"
PCL_SONAME_MAJOR="lib\$(PCL${libname3}"
PCL_SONAME_MAJOR_MINOR="lib\$(PCL${libname2}"
XPS_SONAME="lib\$(XPS${libname1}"
XPS_SONAME_MAJOR="lib\$(XPS${libname3}"
XPS_SONAME_MAJOR_MINOR="lib\$(XPS${libname2}"
GPDL_SONAME="lib\$(GPDL${libname1}"
GPDL_SONAME_MAJOR="lib\$(GPDL${libname3}"
GPDL_SONAME_MAJOR_MINOR="lib\$(GPDL${libname2}"
;;
*-cygwin*)
if test x$hide_symbols = xyes; then
attr_default="__declspec(dllexport)"
attr_hidden=""
fi
GS_DYNAMIC_LDFLAGS="-shared -Wl,--out-implib=\$(BINDIR)/lib\$(GS_SO_BASE).dll.a $_ldflags"
PCL_DYNAMIC_LDFLAGS="-shared -Wl,--out-implib=\$(BINDIR)/lib\$(PCL_SO_BASE).dll.a $_ldflags"
XPS_DYNAMIC_LDFLAGS="-shared -Wl,--out-implib=\$(BINDIR)/lib\$(XPS_SO_BASE).dll.a $_ldflags"
PDL_DYNAMIC_LDFLAGS="-shared -Wl,--out-implib=\$(BINDIR)/lib\$(PDL_SO_BASE).dll.a $_ldflags"
SO_LIB_EXT=""
DLL_EXT=".dll"
SO_LIB_VERSION_SEPARATOR="-"
# make sure the import library doesn't link a program against the DLL with the minor version in it
GS_SONAME="lib\$(GS${libname1}"
GS_SONAME_MAJOR="lib\$(GS${libname3}"
GS_SONAME_MAJOR_MINOR="cyg\$(GS${libname2}"
PCL_SONAME="lib\$(PCL${libname1}"
PCL_SONAME_MAJOR="lib\$(PCL${libname3}"
PCL_SONAME_MAJOR_MINOR="cyg\$(PCL${libname2}"
XPS_SONAME="lib\$(XPS${libname1}"
XPS_SONAME_MAJOR="lib\$(XPS${libname3}"
XPS_SONAME_MAJOR_MINOR="cyg\$(XPS${libname2}"
GPDL_SONAME="lib\$(GPDL${libname1}"
GPDL_SONAME_MAJOR="lib\$(GPDL${libname3}"
GPDL_SONAME_MAJOR_MINOR="cyg\$(GPDL${libname2}"
;;
*bsd*)
DYNAMIC_CFLAGS="-fPIC $DYNAMIC_CFLAGS"
GS_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(GS_SONAME_MAJOR)"
PCL_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(PCL_SONAME_MAJOR)"
XPS_DYNAMIC_LDFLAGS="-shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(XPS_SONAME_MAJOR)"
DYNAMIC_LIBS=""
SO_LIB_EXT=".so"
;;
*-darwin*)
DYNAMIC_CFLAGS="-fPIC $DYNAMIC_CFLAGS"
GS_DYNAMIC_LDFLAGS="-dynamiclib -install_name $DARWIN_LDFLAGS_SO_PREFIX\$(GS_SONAME_MAJOR_MINOR)"
PCL_DYNAMIC_LDFLAGS="-dynamiclib -install_name $DARWIN_LDFLAGS_SO_PREFIX\$(PCL_SONAME_MAJOR_MINOR)"
XPS_DYNAMIC_LDFLAGS="-dynamiclib -install_name $DARWIN_LDFLAGS_SO_PREFIX\$(XPS_SONAME_MAJOR_MINOR)"
PDL_DYNAMIC_LDFLAGS="-dynamiclib -install_name $DARWIN_LDFLAGS_SO_PREFIX\$(GPDL_SONAME_MAJOR_MINOR)"
DYNAMIC_LIBS=""
SO_LIB_EXT=".dylib"
;;
*-sun*|*-solaris*)
if test $GCC = yes; then
DYNAMIC_CFLAGS="-fPIC $DYNAMIC_CFLAGS"
else
DYNAMIC_CFLAGS="-KPIC $DYNAMIC_CFLAGS"
#if test x$hide_symbols = xyes; then
# attr_default="__global"
# attr_hidden="__hidden"
# _ldflags="-xldscope=hidden"
#fi
# ^^^ untested
fi
GS_DYNAMIC_LDFLAGS="-G -shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(GS_SONAME_MAJOR) $_ldflags"
PCL_DYNAMIC_LDFLAGS="-G -shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(PCL_SONAME_MAJOR) $_ldflags"
XPS_DYNAMIC_LDFLAGS="-G -shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(XPS_SONAME_MAJOR) $_ldflags"
PDL_DYNAMIC_LDFLAGS="-G -shared -Wl,\$(LD_SET_DT_SONAME)\$(LDFLAGS_SO_PREFIX)\$(GPDL_SONAME_MAJOR) $_ldflags"
DYNAMIC_LIBS=""
SO_LIB_EXT=".so"
;;
*-aix*)
if test $GCC = yes; then
DYNAMIC_CFLAGS="-fPIC $DYNAMIC_CFLAGS"
GCFLAGS="-Wl,-brtl -D_LARGE_FILES $GCFLAGS"
GS_DYNAMIC_LDFLAGS="-shared -Wl,-brtl,-G -fPIC"
PCL_DYNAMIC_LDFLAGS="-shared -Wl,-brtl,-G -fPIC"
XPS_DYNAMIC_LDFLAGS="-shared -Wl,-brtl,-G -fPIC"
PDL_DYNAMIC_LDFLAGS="-shared -Wl,-brtl,-G -fPIC"
else
DYNAMIC_CFLAGS="$DYNAMIC_CFLAGS"
GCFLAGS="-Wl,-brtl -D_LARGE_FILES $GCFLAGS"
GS_DYNAMIC_LDFLAGS="-G -qmkshrobj -Wl,-brtl,-G"
PCL_DYNAMIC_LDFLAGS="-G -qmkshrobj -Wl,-brtl,-G"
XPS_DYNAMIC_LDFLAGS="-G -qmkshrobj -Wl,-brtl,-G"
fi
SO_LIB_EXT=".so"
;;
esac
if test x$hide_symbols = xyes ; then
if test $GCC = yes; then
DYNAMIC_CFLAGS="$DYNAMIC_CFLAGS -fvisibility=hidden"
fi
DYNAMIC_CFLAGS="$DYNAMIC_CFLAGS -DGSDLLEXPORT=\"$attr_default\""
if test "x$FT_BRIDGE" = x1 -a "x$SHARE_FT" = x0 ; then
DYNAMIC_CFLAGS="$DYNAMIC_CFLAGS -D\"FT_EXPORT(x)\"=\"$attr_hidden x\""
fi
if test "x$SHARE_EXPAT" = x0 ; then
DYNAMIC_CFLAGS="$DYNAMIC_CFLAGS -DXML_STATIC -DXMLIMPORT=\"$attr_hidden\""
fi
fi
AC_SUBST(GS_SONAME)
AC_SUBST(GS_SONAME_MAJOR)
AC_SUBST(GS_SONAME_MAJOR_MINOR)
AC_SUBST(PCL_SONAME)
AC_SUBST(PCL_SONAME_MAJOR)
AC_SUBST(PCL_SONAME_MAJOR_MINOR)
AC_SUBST(XPS_SONAME)
AC_SUBST(XPS_SONAME_MAJOR)
AC_SUBST(XPS_SONAME_MAJOR_MINOR)
AC_SUBST(GPDL_SONAME)
AC_SUBST(GPDL_SONAME_MAJOR)
AC_SUBST(GPDL_SONAME_MAJOR_MINOR)
AC_ARG_ENABLE([dynamic], AC_HELP_STRING([--enable-dynamic],
[Enable dynamically loaded drivers]),
[
if test "x$enable_dynamic" != xno; then
case $host in
*-linux*|*-gnu)
INSTALL_SHARED="install-shared"
if test "x$X_DEVS" != x; then
DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so"
else
DYNAMIC_DEVS=""
fi
DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
X11_DEVS=""
OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS"
DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS"
;;
*bsd*)
DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so"
DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
X11_DEVS=""
OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS"
DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS"
;;
*-darwin*)
INSTALL_SHARED="install-shared"
DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
X11_DEVS=""
OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS"
DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS"
;;
*-sun*|*-solaris*)
DYNAMIC_DEVS="\$(GLOBJDIR)/X11.so"
DYNAMIC_FLAGS="-DGS_DEVS_SHARED -DGS_DEVS_SHARED_DIR=\\\"\$(gssharedir)\\\""
OPT_CFLAGS="$DYNAMIC_CFLAGS $OPT_CFLAGS"
DBG_CFLAGS="$DYNAMIC_CFLAGS $DBG_CFLAGS"
;;
*)
AC_MSG_ERROR([Sorry, dynamic driver support not available on this platform!])
;;
esac
fi
])
AC_SUBST(DYNAMIC_CFLAGS)
AC_SUBST(DYNAMIC_DEVS)
AC_SUBST(DYNAMIC_FLAGS)
AC_SUBST(GS_DYNAMIC_LDFLAGS)
AC_SUBST(PCL_DYNAMIC_LDFLAGS)
AC_SUBST(XPS_DYNAMIC_LDFLAGS)
AC_SUBST(PDL_DYNAMIC_LDFLAGS)
AC_SUBST(DYNAMIC_LIBS)
AC_SUBST(INSTALL_SHARED)
AC_SUBST(X11_DEVS)
AC_SUBST(SO_LIB_EXT)
AC_SUBST(DLL_EXT)
AC_SUBST(SO_LIB_VERSION_SEPARATOR)
dnl look for default font path...
AC_ARG_WITH([fontpath], AC_HELP_STRING([--with-fontpath],
[set font search path for gs]), fontpath="$withval", fontpath="")
dnl Fix "prefix" variable...
if test "x$prefix" = xNONE; then
prefix=/usr/local
fi
dnl Fix "datadir" variable...
if test "x$datadir" = 'x${prefix}/share'; then
datadir="$prefix/share"
fi
dnl Fix "fontpath" variable...
if test "x$fontpath" = "x"; then
# These font directories are used by various Linux distributions...
fontpath="$datadir/fonts/default/ghostscript"
fontpath="${fontpath}:$datadir/fonts/default/Type1"
fontpath="${fontpath}:$datadir/fonts/default/TrueType"
# These font directories are used by IRIX...
fontpath="${fontpath}:/usr/lib/DPS/outline/base"
# These font directories are used by Solaris...
fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/Type1"
fontpath="${fontpath}:/usr/openwin/lib/X11/fonts/TrueType"
# This font directory is used by CUPS...
if test "x$CUPSCONFIG" != x; then
fontpath="${fontpath}:`$CUPSCONFIG --datadir`/fonts"
fi
fi
AC_SUBST(fontpath)
dnl --------------------------------------------------
dnl Check for library functions
dnl --------------------------------------------------
AC_CHECK_FUNCS([mkstemp], [HAVE_MKSTEMP=-DHAVE_MKSTEMP])
AC_SUBST(HAVE_MKSTEMP)
AC_CHECK_FUNCS([fopen64], [HAVE_FILE64=-DHAVE_FILE64])
AC_SUBST(HAVE_FILE64)
AC_CHECK_FUNCS([fseeko], [HAVE_FSEEKO=-DHAVE_FSEEKO])
AC_SUBST(HAVE_FSEEKO)
AC_CHECK_FUNCS([mkstemp64], [HAVE_MKSTEMP64=-DHAVE_MKSTEMP64])
AC_SUBST(HAVE_MKSTEMP64)
AC_CHECK_FUNCS([setlocale], [HAVE_SETLOCALE=-DHAVE_SETLOCALE])
AC_SUBST(HAVE_SETLOCALE)
AC_CHECK_FUNCS([strerror], [HAVE_STRERROR=-DHAVE_STRERROR])
AC_SUBST(HAVE_STRERROR)
AC_CHECK_FUNCS([isnan], [HAVE_ISNAN=-DHAVE_ISNAN])
AC_SUBST(HAVE_ISNAN)
AC_CHECK_FUNCS([isinf], [HAVE_ISINF=-DHAVE_ISINF])
AC_SUBST(HAVE_ISINF)
AC_CHECK_FUNCS([fpclassify], [HAVE_FPCLASSIFY=-DHAVE_FPCLASSIFY])
AC_SUBST(HAVE_FPCLASSIFY)
AC_PROG_GCC_TRADITIONAL
dnl NB: We don't actually provide autoconf-switched fallbacks for any
dnl of these functions, so the checks are purely informational.
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_TYPE_SIGNAL
AC_FUNC_STAT
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([bzero dup2 floor gettimeofday memchr memmove memset mkdir mkfifo modf pow putenv rint setenv sqrt strchr strrchr strspn strstr])
dnl --------------------------------------------------
dnl disable the memory header ID code on SPARC
dnl --------------------------------------------------
case $host in
*sparc*)
GCFLAGS="$GCFLAGS -DGS_USE_MEMORY_HEADER_ID=0"
;;
esac
dnl --------------------------------------------------
dnl set big/little endian for LCMS
dnl --------------------------------------------------
LCMS_ENDIAN=
LCMS2_ENDIAN=
if test x"$BIGENDIAN" != x"0"; then
LCMS_ENDIAN="-DUSE_BIG_ENDIAN=$BIGENDIAN"
LCMS2_ENDIAN="-DCMS_USE_BIG_ENDIAN=$BIGENDIAN"
fi
AC_SUBST(LCMS_ENDIAN)
AC_SUBST(LCMS2_ENDIAN)
dnl --------------------------------------------------
dnl set memory manager's ptr alignment
dnl --------------------------------------------------
ALIGN_TEXT_PROG_INCS="\
#include <stdio.h> \
#include <stdlib.h>"
ALIGN_TEXT_PROG="\
struct altest \
{ \
char a; \
int b; \
long c; \
long long d; \
float e; \
double f; \
void *g; \
}; \
struct altest *a; \
struct altest d; \
char *b, *c, *lim; \
int ret = 0; \
c = b = malloc(64 * sizeof(struct altest)); \
lim = b + (64 * sizeof(struct altest)); \
do \
{ \
b++; \
if ((b >= lim) || \
((((unsigned int)b) & 4) == 0 && (((unsigned int)b) & 8) != 0)) \
{ \
break; \
} \
} while(1); \
if (b >= lim) \
{ \
ret = -1; \
} \
else \
{ \
a = (struct altest *)b; \
b = a->g; \
ret = 0; \
} \
free(c); \
exit(ret);"
GS_MEMPTR_ALIGNMENT=
AC_ARG_WITH(memory-alignment,
[AC_HELP_STRING([--with-memory-alignment],
[Allows setting minimum alignment for the memory manager (4 or 8 bytes]))],
[GS_MEMPTR_ALIGNMENT=$with_memory_alignment],[GS_MEMPTR_ALIGNMENT=check])
if test x"$GS_MEMPTR_ALIGNMENT" = xcheck ; then
case $host in
*hpux*|*-sun*|*-aix*|*-solaris*)
GS_MEMPTR_ALIGNMENT=8
;;
*)
;;
esac
fi
if test x"$GS_MEMPTR_ALIGNMENT" = xcheck ; then
AC_MSG_CHECKING([minimum memory pointer alignment])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM([$ALIGN_TEXT_PROG_INCS], [
$ALIGN_TEXT_PROG
])],
[GS_MEMPTR_ALIGNMENT=4;AC_MSG_RESULT(done)],
[GS_MEMPTR_ALIGNMENT=8;AC_MSG_RESULT(done)],
[GS_MEMPTR_ALIGNMENT=4;AC_MSG_RESULT(cross compiling: assuming 4 byte - otherwise use "--with-memory-alignment=")])
fi
if test x"$GS_MEMPTR_ALIGNMENT" != x4 && test x"$GS_MEMPTR_ALIGNMENT" != x8 ; then
AC_MSG_ERROR([4 and 8 are the only valid values for "--with-memory-alignment"], -1)
fi
if test x"$GS_MEMPTR_ALIGNMENT" != x4 || test x"$with_memory_alignment" != x ; then
LCMS2_PTR_ALIGNMENT="-DCMS_PTR_ALIGNMENT=$GS_MEMPTR_ALIGNMENT"
GCFLAGS="$GCFLAGS -DGS_MEMPTR_ALIGNMENT=$GS_MEMPTR_ALIGNMENT"
fi
AC_SUBST(LCMS2_PTR_ALIGNMENT)
dnl --------------------------------------------------
dnl decide if we have to "hack" sqrtf() for lcms2
dnl --------------------------------------------------
AC_CHECK_FUNC([sqrtf], [SQRTF_SUBST=], [SQRTF_SUBST="-Dsqrtf=\"(float)sqrt\""])
AC_SUBST(SQRTF_SUBST)
dnl --------------------------------------------------
dnl check for and possibly replace strnlen
dnl --------------------------------------------------
AC_CHECK_FUNCS([strnlen], [HAVE_STRNLEN=],[HAVE_STRNLEN="-D\"strnlen(a,b)=strlen(a)\""])
GCFLAGS="$GCFLAGS $HAVE_STRNLEN"
dnl --------------------------------------------------
dnl check for byte swap intrinsics
dnl --------------------------------------------------
AC_MSG_CHECKING([byteswap support])
HAVE_BSWAP32=""
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([], [
int a = 0;
int b = __builtin_bswap32(a);
return(0);
])],
[HAVE_BSWAP32="-DHAVE_BSWAP32"], [HAVE_BSWAP32=""])
AC_ARG_ENABLE([bswap32], AC_HELP_STRING([--disable-bswap32],
[Do not use bswap32 instrinsic]), [
if test "x$enable_bswap32" = xno; then
HAVE_BSWAP32=""
fi])
if test "x$HAVE_BSWAP32" != x; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(HAVE_BSWAP32)
dnl --------------------------------------------------
dnl check for byte swap header
dnl --------------------------------------------------
AC_MSG_CHECKING([for byteswap.h])
HAVE_BYTESWAP_H=""
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include "byteswap.h"], [
int a = 0;
int b = __builtin_bswap32(a);
return(0);
])],
[HAVE_BYTESWAP_H="-DHAVE_BYTESWAP_H"], [HAVE_BYTESWAP_H=""])
AC_ARG_ENABLE([byteswap-h], AC_HELP_STRING([--disable-byteswap-h],
[Do not use byteswap.h functions]), [
if test "x$enable_byteswap-h" = xno; then
HAVE_BYTESWAP_H=""
fi])
if test "x$HAVE_BYTESWAP_H" != x; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
AC_SUBST(HAVE_BYTESWAP_H)
# --------------------------------------------------
# Sun, BSD possibly other makes don't have quite the
# feature set of GNU make. We still prefer GNU make,
# but......
# --------------------------------------------------
AC_ARG_WITH([gnu-make], AC_HELP_STRING([--without-gnu-make],
[disable GNU make features]), gnu_make=no)
if test "x$gnu_make" != "xno"; then
SUB_MAKE_OPTION="-f \$(MAKEFILE)"
ORDER_ONLY="|"
else
SUB_MAKE_OPTION=
ORDER_ONLY=""
fi
AC_SUBST(ORDER_ONLY)
AC_SUBST(SUB_MAKE_OPTION)
# --------------------------------------------------
# annoying: Windows doesn't allow "aux" as a
# directory nor file name, so if we're building in
# mingw, add the same prefix as the VS build uses
# --------------------------------------------------
AUXDIRPOSTFIX=""
case $build in
*-mingw*|*-msys*|*-cygwin*)
AUXDIRPOSTFIX="_"
;;
esac
AC_SUBST(AUXDIRPOSTFIX)
# --------------------------------------------------
# Set executable name extention
# usually empty on Unix-like systems
# --------------------------------------------------
EXEEXT=""
case $host in
*-mingw*|*-msys*)
EXEEXT=".exe"
;;
*)
;;
esac
AC_ARG_WITH([exe-ext], AC_HELP_STRING([--with-exe-ext=EXT],
[set the file name executable extension (must include any separator e.g. the period in ".exe")]),
[EXEEXT="$with_exe_ext"])
AC_SUBST(EXEEXT)
# --------------------------------------------------
# Set executable name extention for aux binaries
# usually empty on Unix-like systems
# --------------------------------------------------
AUXEXEEXT=""
case $build in
*-mingw*|*-msys*)
AUXEXEEXT=".exe"
;;
*)
;;
esac
AC_ARG_WITH([aux-exe-ext], AC_HELP_STRING([--with-aux-exe-ext=EXT],
[set the file name executable extension for auxiliary binaries (must include any separator e.g. the period in ".exe")]),
[AUXEXEEXT="$with_aux_exe_ext"])
AC_SUBST(AUXEXEEXT)
# --------------------------------------------------
# Check for disabling of versioned path option.
# By default the versioned path must be enabled!
# Using this option is user's own risk & responsibility.
# --------------------------------------------------
AC_ARG_WITH([versioned-path],
[ --without-versioned-path
Do not use file paths containing the version of GS.
WARNING: This option is dangerous & unsupported, and
you take full responsibility for using it!],
versioned_path=no)
if test "x$versioned_path" != "xno"; then
VERSIONED_PATH='/$(GS_DOT_VERSION)'
else
VERSIONED_PATH=''
fi
AC_SUBST(VERSIONED_PATH)
# --------------------------------------------------
# Check if we are using GCC, and disable strict
# aliasing optimization if GCC supports it...
#
# NOTE: Strict aliasing can cause some parts
# of Ghostscript to malfunction.
# --------------------------------------------------
if test $GCC = yes; then
AC_MSG_CHECKING([whether to explicitly disable strict aliasing])
CFLAGS_backup="$CFLAGS"
CFLAGSAUX_backup="$CFLAGSAUX"
CFLAGS="$CFLAGS -fno-strict-aliasing"
AC_TRY_COMPILE(, [return 0;], [
AC_MSG_RESULT([yes])
CFLAGS_backup="$CFLAGS"
if test x"$host" = x"$build" ; then
CFLAGSAUX_backup="$CFLAGSAUX -fno-strict-aliasing"
fi
])
CFLAGS="$CFLAGS_backup"
CFLAGSAUX="$CFLAGSAUX_backup"
fi
# --------------------------------------------------
# Modify build for internal cluster testing.
# DO NOT USE THIS OPTION OUTSIDE OF ARTIFEX!
# --------------------------------------------------
AC_ARG_ENABLE([cluster])
if test "x"$enable_cluster != "x"; then
CLUSTER_CFLAGS="-DCLUSTER"
else
CLUSTER_CFLAGS=""
fi
AC_SUBST(CLUSTER_CFLAGS)
if test x"$build" != x"$host"; then
ilog2()
{
ILOG2_VAL=$1
ILOG2_RES=0
while test $ILOG2_VAL -gt 1 ; do
ILOG2_VAL=$((ILOG2_VAL + 1))
ILOG2_VAL=$((ILOG2_VAL >> 1))
ILOG2_RES=$((ILOG2_RES + 1))
done
return $ILOG2_RES
};
# --------------------------------------------------
# Generate arch.h headers
# --------------------------------------------------
AC_CHECK_ALIGNOF([short])
AC_CHECK_ALIGNOF([int])
AC_CHECK_ALIGNOF([long])
AC_CHECK_ALIGNOF([size_t])
AC_CHECK_ALIGNOF([void *])
AC_CHECK_ALIGNOF([float])
AC_CHECK_ALIGNOF([double])
AC_SUBST(ARCH_ALIGN_SHORT_MOD, $ac_cv_alignof_short)
AC_SUBST(ARCH_ALIGN_INT_MOD, $ac_cv_alignof_int)
AC_SUBST(ARCH_ALIGN_LONG_MOD, $ac_cv_alignof_long)
AC_SUBST(ARCH_ALIGN_SIZE_T_MOD, $ac_cv_alignof_size_t)
AC_SUBST(ARCH_ALIGN_PTR_MOD, $ac_cv_alignof_void_p)
AC_SUBST(ARCH_ALIGN_FLOAT_MOD, $ac_cv_alignof_float)
AC_SUBST(ARCH_ALIGN_DOUBLE_MOD, $ac_cv_alignof_double)
AC_CHECK_SIZEOF([char])
AC_CHECK_SIZEOF([short])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([size_t])
AC_CHECK_SIZEOF([void *])
AC_CHECK_SIZEOF([float])
AC_CHECK_SIZEOF([double])
ilog2 $ac_cv_sizeof_char
AC_SUBST(ARCH_LOG2_SIZEOF_CHAR, $?)
ilog2 $ac_cv_sizeof_short
AC_SUBST(ARCH_LOG2_SIZEOF_SHORT, $?)
ilog2 $ac_cv_sizeof_int
AC_SUBST(ARCH_LOG2_SIZEOF_INT, $?)
ilog2 $ac_cv_sizeof_long
AC_SUBST(ARCH_LOG2_SIZEOF_LONG, $?)
ilog2 $ac_cv_sizeof_long_long
AC_SUBST(ARCH_LOG2_SIZEOF_LONG_LONG, $?)
ilog2 $ac_cv_sizeof_size_t
AC_SUBST(ARCH_LOG2_SIZEOF_SIZE_T, $?)
AC_SUBST(ARCH_SIZEOF_SIZE_T, $ac_cv_sizeof_size_t)
AC_SUBST(ARCH_SIZEOF_PTR, $ac_cv_sizeof_void_p)
ilog2 $ac_cv_sizeof_void_p
AC_SUBST(ARCH_LOG2_SIZEOF_PTR, $?)
AC_SUBST(ARCH_SIZEOF_FLOAT, $ac_cv_sizeof_float)
ilog2 $ac_cv_sizeof_float
AC_SUBST(ARCH_LOG2_SIZEOF_FLOAT, $?)
AC_SUBST(ARCH_SIZEOF_DOUBLE, $ac_cv_sizeof_double)
ilog2 $ac_cv_sizeof_double
AC_SUBST(ARCH_LOG2_SIZEOF_DOUBLE, $?)
AC_SUBST(ARCH_IS_BIG_ENDIAN, $BIGENDIAN)
AC_MSG_CHECKING([if pointers are signed])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([#include <stdint.h>], [
char b[[(char *)(uintptr_t)-1 < (char *)(uintptr_t)0 ? -1 : 0]];
return sizeof(b);
])],
[ARCH_PTRS_ARE_SIGNED=0; AC_MSG_RESULT(no)], [ARCH_PTRS_ARE_SIGNED=1; AC_MSG_RESULT(yes)])
AC_SUBST(ARCH_PTRS_ARE_SIGNED)
AC_MSG_CHECKING([if dividing negative by positive truncates])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [
char b[[-1 / 2 == 0 ? -1 : 0]];
return sizeof(b);
])],
[ARCH_DIV_NEG_POS_TRUNCATES=0; AC_MSG_RESULT(no)], [ARCH_DIV_NEG_POS_TRUNCATES=1; AC_MSG_RESULT(yes)])
AC_SUBST(ARCH_DIV_NEG_POS_TRUNCATES)
AC_MSG_CHECKING([if arithmetic shift works properly])
ARCH_ARITH_RSHIFT=""
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [
char b[[(-1L >> 2) != -1 || (-1 >> 1) != -1 || (-1 >> 2) != -1 ? 0 : -1]];
return sizeof(b);
])],
[ARCH_ARITH_RSHIFT=0; AC_MSG_RESULT(no)])
if test "x${ARCH_ARITH_RSHIFT}" = "x"; then
# Turbo C problem
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [
char b[[(-1L >> 2) != -1 ? 0 : -1]];
return sizeof(b);
])],
[ARCH_ARITH_RSHIFT=1; AC_MSG_RESULT(no)])
fi
if test "x${ARCH_ARITH_RSHIFT}" = "x"; then
AC_MSG_RESULT(yes)
ARCH_ARITH_RSHIFT=2
fi
AC_SUBST(ARCH_ARITH_RSHIFT)
AC_SUBST(ARCH_SIZEOF_GX_COLOR_INDEX)
CONFIG_FILES_LIST="$CONFIG_FILES_LIST $ARCH_AUTOCONF_HEADER:$ARCH_AUTOCONF_HEADER_PROTO"
fi
dnl --------------------------------------------------
dnl AUX tool options
dnl --------------------------------------------------
AC_ARG_ENABLE([mkromfs-quiet], AC_HELP_STRING([--enable-mkromfs-quiet],
[Do not emit mkromfs verbose output]), [MKROMFS_FLAGS="-q $MKROMFS_FLAGS"])
AC_SUBST(MKROMFS_FLAGS)
if test x"$GCFLAGSAUX" = x"\$(GCFLAGS)" ; then
GCFLAGSAUX="$GCFLAGS"
fi
CFLAGSAUX=$(echo $CFLAGSAUX | sed -e 's/-DGS_NO_FILESYSTEM//g')
dnl --------------------------------------------------
dnl Do substitutions
dnl --------------------------------------------------
SRCDIR="$srcdir"
AC_SUBST(SRCDIR)
AC_SUBST(OPT_CFLAGS)
AC_SUBST(DBG_CFLAGS)
AC_SUBST(GCFLAGS)
AC_SUBST(CFLAGS_SANITIZE)
AC_SUBST(STRIP_XE)
AC_SUBST(JPX_SSE_CFLAGS)
AC_SUBST(CCAUX)
AC_SUBST(CFLAGSAUX)
AC_SUBST(GCFLAGSAUX)
AC_SUBST(CAPOPTAUX)
AC_SUBST(CFLAGSAUX_STANDARD)
AC_SUBST(CFLAGSAUX_DEBUG)
AC_SUBST(CFLAGSAUX_PROFILE)
AC_SUBST(LDFLAGSAUX)
AC_SUBST(AUXEXTRALIBS)
AC_SUBST(ARCH_AUTOCONF_HEADER)
AC_SUBST(CFLAGS_VISIBILITY)
CONFIG_FILES_LIST="$CONFIG_FILES_LIST $THEMAKEFILE"
if test x"$THEMAKEFILE" != x"$MAKEFILE" && test x"$build" = x"$host"; then
CONFIG_FILES_LIST="$CONFIG_FILES_LIST"
fi
if test "x$AFS" = "x1"; then
AC_MSG_WARN([Using "native" font scaler which is now deprecated (rather than freetype),])
AC_MSG_WARN([Support for this will be removed in a future release])
fi
if test "x$NTS_EXCLUDES" != "x" ; then
AC_MSG_WARN([Due to the --enable-threadsafe option, the following devices have been excluded because they are not threadsafe:])
echo "$NTS_EXCLUDES"
fi
AC_CONFIG_FILES($CONFIG_FILES_LIST)
AC_OUTPUT
|