File: makemake.in

package info (click to toggle)
clisp 1%3A2.49.20180218%2Breally2.49.92-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster
  • size: 52,096 kB
  • sloc: lisp: 92,398; ansic: 65,192; xml: 27,344; sh: 10,790; fortran: 7,308; makefile: 1,420; perl: 164; sed: 13
file content (4664 lines) | stat: -rw-r--r-- 170,273 bytes parent folder | download
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
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
#! @SHELL@
# -*- coding: utf-8; mode: shell-script -*- vim:filetype=sh
CONFIG_SHELL="@SHELL@"  # mind the quoting, for args like -x.
# Creation of the Makefile used for compiling CLISP
# Bruno Haible 1991-2010
# Sam Steingold 1999-2012, 2016

# Simple usage:
#        ./makemake [--with-PACKAGE] > Makefile

HSDEFAULT="http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/"
hyperspec=${CLHSROOT:-${HSDEFAULT}}

fail () { echo "$0: $*" >&2; exit 1; }

info_help () {
cat << EOP
Usage: ./makemake [options] > Makefile
options:
    The following general options are recognized:
       --help                  print this message and exit
       --version               print the CLISP version and exit
       --verbose               print some config information to the stderr
    The following options set installation parameters:
       --srcdir=SRCDIR         sets the source directory to SRCDIR
       --prefix=PREFIX         sets the installation directory prefix to PREFIX
       --exec-prefix=EXECPREFIX  sets the architecture dependent installation
                                  directory prefix to EXECPREFIX
       --fsstnd=std            installation according to FileSystem Standards:
                               suse - SuSE-Linux conventions
                               redhat - RedHat
                               debian - Debian, Slackware
                               *bsd - NetBSD, OpenBSD, FreeBSD
       --hyperspec=URL         the path to the Common Lisp HyperSpec
           (the default is ${HSDEFAULT}
            or the value of the environment variable CLHSROOT, if set).
      Fine tuning of the installation directories:
       --bindir=DIR            user executables
       --libdir=DIR            object code libraries
       --includedir=DIR        C header files
       --datarootdir=DIR       read-only arch.-independent data root
       --datadir=DIR           read-only architecture-independent data
       --localedir=DIR         locale-dependent data
       --docdir=DIR            documentation root
       --mandir=DIR            man documentation
       --infodir=DIR           GNU Info documentation
       --htmldir=DIR           html documentation
       --dvidir=DIR            TeX DVI documentation
       --psdir=DIR             PostScript documentation
       --pdfdir=DIR            PDF documentation
       --elispdir=DIR          Emacs Lisp files
       --vimdir=DIR            VIM files
       --aclocaldir=DIR        autoconf files
    The following options add support for specific separate packages. See the
    main INSTALL file for how to get them.
       --with-noreadline       do not use readline library (even when present)
       --with-gettext          internationalization, needs GNU gettext
       --with-nogettext        static internationalization (en only)
       --without-unicode       no Unicode character set, only 8-bit characters
       --with-dynamic-ffi      a foreign language interface
       --without-dynamic-modules  no dynamic loading of foreign modules
       --with-threads=FLAVOR   MT [_experimental_!]
                      FLAVOR: POSIX_THREADS SOLARIS_THREADS WIN32_THREADS
       --with-jitc=FLAVOR      use a given Just-In-Time Compiler.
                The only flavor at this time is lightning
                  (GNU lightning must be installed in the standard place).
       --enable-portability    favour portability over optimization: disable
                               optimizations that could lead to build failures
       --with-gmalloc          use the GNU malloc instead of the libc one
                               (needed on HP-UX and OpenBSD)
       --with-debug            if you will need to debug the C sources.
    See modules/ directory for available modules and add them to the full
    linking set using --with-module option, e.g.,
       --with-module=bindings/glibc
       --with-module=pari
Example:
       ./makemake --with-dynamic-ffi > Makefile
EOP
}

# Advanced usage:
#        ./makemake [--with-PACKAGE] [cross] TARGET COMPILER > Makefile
#  where PACKAGE is one of
#        noreadline       no readline library
#        gettext          internationalization, needs GNU gettext
#        nogettext        static internationalization (en only)
#        unicode          Unicode character set
#        dynamic-ffi      a dynamic foreign language interface
#        dynamic-modules  dynamic loading of foreign language modules
#        module=MODULE    an add-on module
#  where TARGET is one of
#        master
#        win32msvc
#  and COMPILER is one of
#        gcc       (GNU C under the name gcc)
#        cc        (any other ANSI C compliant cc)

# Examples:
#   makemake > Makefile
#   makemake --with-debug > Makefile
#   makemake --with-noreadline --with-debug > Makefile
#   makemake master gcc > make.gcc/makefile
#   makemake --win32gcc gcc > make.win32gcc/makefile
#   makemake --with-dynamic-ffi win32msvc msvc4 > make.win32msvc/makefile.msvc4
#   makemake --with-dynamic-ffi win32msvc msvc5 > make.win32msvc/makefile.msvc5
#   makemake --with-dynamic-ffi win32msvc msvc6 > make.win32msvc/makefile.msvc6


# Fix the "echo" command. The SysV /bin/sh (and also ksh, and also bash if
# built with --enable-usg-echo-default, and also GNU sh-utils-1.16) are broken:
# They have an echo command which interprets backslashes in the string to be
# output. We cannot fix this by defining a function called "echo", because the
# HP/UX, OSF/1, AIX /bin/sh would nevertheless call the builtin, broken "echo".
# `echol' stands for "echo line".
if echo 'rs\tuv' | grep t > /dev/null 2> /dev/null; then
  # Uff. Found a BSD or POSIX compliant "echo" command.
  echol () {
    echo "$*"
  }
elif type printf >/dev/null 2>/dev/null; then
  # The "Single Unix Specification" (which also adheres to this broken
  # "echo") recommends the following workaround.
  echol () {
    printf '%s\n' "$*"
  }
else
  # This one looks harmless, but in Solaris /bin/sh, when called inside
  # shell backquote `...`, it prefixes every character with a backslash!
  # Therefore we use this only as a last resort, if `printf' is missing
  # (for example, on OpenStep V4.2).
echol () {
cat <<ECHOVAL_END
$*
ECHOVAL_END
}
fi

link_dep() {
  echol "$1 : $2"
  echotab "-\$(RM) $1"
  echotab "-\$(LN_S) ${3-$2} $1"
  echol
}

# Handle --help and --version arguments.
for arg do
  case "$arg" in
    --help | --hel | --he | --h)
      info_help
      exit 0 ;;
    --version | --versio | --versi | --vers | --ver | --ve | --v)
      echol "@PACKAGE_STRING@ (@PACKAGE_BUGREPORT@)"
      exit 0 ;;
  esac
done

# Save the argument list for reference.
makemake_args=''
for arg do
  # Approximate a shell-quote.
  case "$arg" in
    *" "* | *"	"* | *[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]* ) makemake_args="$makemake_args '$arg'" ;;
    * ) makemake_args="$makemake_args $arg" ;;
  esac
done
hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`

srcdir='@srcdir@'
prefix=''
exec_prefix=''
fsstnd='' # supported styles: gnu, gnu_ext, suse, redhat, debian, *bsd
bindir=''
libdir=''
includedir=''
datarootdir=''
datadir=''
localedir=''
docdir=''
mandir=''
infodir=''
htmldir=''
dvidir=''
psdir=''
pdfdir=''
MODULES=''
elispdir=''
vimdir=''
aclocaldir=''
CP='cp -p'
LN_S='ln -s'
HLN='ln'

# <http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/13368>
# <https://lists.gnu.org/archive/html/autoconf/2010-09/msg00089.html>
# strip out -srcdir* & -cache-file*
keep_next=maybe
module_configure_flags=''
for arg in @module_configure_flags@; do
  case $arg in
    *\'*) arg=`$echo "$arg" | sed "s/'/'\\\\\\\\''/g"` ;;
  esac
  case $keep_next in
    yes ) module_configure_flags="$module_configure_flags '$arg'";
      keep_next=maybe; ;;
    no ) keep_next=maybe; ;;
    maybe ) case $arg in
      --cache-file=* | --srcdir=*) continue ;;
      --cache-file | --srcdir ) keep_next=no; ;;
      *=* ) module_configure_flags="$module_configure_flags '$arg'"; ;;
      *) module_configure_flags="$module_configure_flags '$arg'";
        keep_next=yes; ;;
    esac ;;
  esac
done
unset arg
unset keep_next

# NLS nuisances.
# Needed e.g. for some versions of `tr' so that character classes in `[]' work.
if test "${LC_ALL+set}" = 'set'; then LC_ALL=C ; export LC_ALL ; fi
if test "${LANG+set}"   = 'set'; then LANG=C   ; export LANG   ; fi
if [ `echo ABC | tr '[A-Z]' '[a-z]'` = "abc" ] ; then
  tolower="tr '[A-Z]' '[a-z]'"
else
  tolower="tr A-Z a-z"
fi
my_eval(){
  eval "$*"
  test "${verbose}" = true -o "${verbose}" = yes && echo "$*" >&2
}

# Set the defaults for the --with and --enable options.
with_termcap_ncurses=yes # no effect if missing termcap/ncurses
with_readline=ifpossible # no effect if no libreadline found
with_gettext=yes         # no effect if no glibc/libintl found
with_unicode=yes
with_dynamic_ffi=no      # often set to yes by the toplevel configure
with_dynamic_modules=default
with_threads=no
enable_portability=ifuseful
with_gmalloc=no
with_debug=no
# i18n: essential for internationalized programs
# syscalls: very useful for scripting
# regexp: useful for scripting and text processing
# readline: additional facilities for REPL, added later if appropriate
BASE_MODULES="i18n syscalls regexp"

verbose=${CLISP_MAKEMAKE_VERBOSE:-false}
# Handle --with-... arguments
while test -z "$endofargs"; do
  case "$1" in
    -verb* | --verb* )
      verbose=`echol "$1"|sed 's/-*v[^=]*=*//'`
      test -n "${verbose}" || verbose=true
      shift
      ;;
    -with-module=* | --with-module=*)
      module=`echol "$1"|sed 's/-*with-module=//'`
      # We don't need to add $module to MODULES if it's already contained
      # in BASE_MODULES.
      case " $BASE_MODULES readline " in
        *" $module "*) cat <<EOF >&2
$0: argument $1 is ignored because $module is a base module
$0: see http://clisp.org/impnotes/modules.html#base-modules
EOF
          ;;
        *) MODULES="$MODULES $module" ;;
      esac
      shift
      ;;
    # Accept --with and --without options like configure does.
    # Extensions:
    # - Accept --with-no-foo and --with-nofoo as synonyms of --without-foo.
    # - Accept --with-foo=off as synonym of --with-foo=no.
    # - Accept --with-foo=on as synonym of --with-foo=yes.
    # Testing for yes:   test "${with_foo}" != no
    # Testing for no:    test "${with_foo}" = no
    -without-* | --without-* | -with-no* | --with-no*)
      package=`echol "$1" | sed -e 's/^-*without-//' -e 's/^-*with-no-*//'`
      # Delete all the valid chars; see if any are left.
      test -n "`echol $package|sed 's/[-a-zA-Z0-9_]*//g'`" && \
        fail "$package: invalid package name"
      my_eval "with_`echol $package|sed s/-/_/g`=no"
      shift
      ;;
    -with-* | --with-*)
      package=`echol "$1"|sed 's/-*with-//'`
      case "$package" in
        *=*) packopt=`echol "${package}" | sed -e 's/^[^=]*=//'` ;;
        *) packopt=yes ;;
      esac
      package=`echol "${package}" | sed -e 's/=.*//'`
      # Delete all the valid chars; see if any are left.
      test -n "`echol $package|sed 's/[-a-zA-Z0-9_]*//g'`" && \
        fail "$package: invalid package name";
      if test "${packopt}" = "on"; then
        packopt=yes
      elif test "${packopt}" = "off"; then
        packopt=no
      fi
      my_eval "with_`echol $package|sed s/-/_/g`=${packopt}"
      shift
      ;;
    -disable-* | --disable-*)
      feature=`echol "$1"|sed 's/-*disable-//'`
      # Delete all the valid chars; see if any are left.
      test -n "`echol $feature|sed 's/[-a-zA-Z0-9_]*//g'`" && \
        fail "$feature: invalid feature name"
      feature=`echol $feature | sed 's/-/_/g'`
      my_eval "enable_$feature=no"
      shift
      ;;
    -enable-* | --enable-*)
      feature=`echol "$1"|sed 's/-*enable-//'`
      # Delete all the valid chars; see if any are left.
      test -n "`echol $feature|sed 's/[-a-zA-Z0-9_]*//g'`" && \
        fail "$feature: invalid feature name"
      feature=`echol $feature | sed 's/-/_/g'`
      my_eval "enable_$feature=yes"
      shift
      ;;
    -srcdir* | --srcdir*)
      srcdir=`echol "$1" | sed 's/-*srcdir=*//'`
      shift
      if test -z "$srcdir" ; then
        srcdir=$1
        shift
      fi
      ;;
    -prefix* | --prefix*)
      prefix=`echol "$1" | sed 's/-*prefix=*//'`
      shift
      if test -z "$prefix" ; then
        prefix=$1
        shift
      fi
      ;;
    -exec-prefix* | --exec-prefix*)
      exec_prefix=`echol "$1" | sed 's/-*exec-prefix=*//'`
      shift
      if test -z "$exec_prefix" ; then
        exec_prefix=$1
        shift
      fi
      ;;
    --fsstnd=*)
      fsstnd=`echol "$1" | sed 's/-*fsstnd=//'`
      shift
      ;;
    -bindir* | --bindir*)
      bindir=`echol "$1" | sed 's/-*bindir=*//'`
      shift
      if test -z "$bindir" ; then
        bindir=$1
        shift
      fi
      ;;
    -libdir* | --libdir*)
      libdir=`echol "$1" | sed 's/-*libdir=*//'`
      shift
      if test -z "$libdir" ; then
        libdir=$1
        shift
      fi
      ;;
    -includedir* | --includedir*)
      includedir=`echol "$1" | sed 's/-*includedir=*//'`
      shift
      if test -z "$includedir" ; then
        includedir=$1
        shift
      fi
      ;;
    -datarootdir* | --datarootdir*)
      datarootdir=`echol "$1" | sed 's/-*datarootdir=*//'`
      shift
      if test -z "$datarootdir" ; then
        datarootdir=$1
        shift
      fi
      ;;
    -datadir* | --datadir*)
      datadir=`echol "$1" | sed 's/-*datadir=*//'`
      shift
      if test -z "$datadir" ; then
        datadir=$1
        shift
      fi
      ;;
    -localedir* | --localedir*)
      localedir=`echol "$1" | sed 's/-*localedir=*//'`
      shift
      if test -z "$localedir" ; then
        localedir=$1
        shift
      fi
      ;;
    -docdir* | --docdir*)
      docdir=`echol "$1" | sed 's/-*docdir=*//'`
      shift
      if test -z "$docdir" ; then
        docdir=$1
        shift
      fi
      ;;
    -mandir* | --mandir*)
      mandir=`echol "$1" | sed 's/-*mandir=*//'`
      shift
      if test -z "$mandir" ; then
        mandir=$1
        shift
      fi
      ;;
    -infodir* | --infodir*)
      infodir=`echol "$1" | sed 's/-*infodir=*//'`
      shift
      if test -z "$infodir" ; then
        infodir=$1
        shift
      fi
      ;;
    -htmldir* | --htmldir*)
      htmldir=`echol "$1" | sed 's/-*htmldir=*//'`
      shift
      if test -z "$htmldir" ; then
        htmldir=$1
        shift
      fi
      ;;
    -dvidir* | --dvidir*)
      dvidir=`echol "$1" | sed 's/-*dvidir=*//'`
      shift
      if test -z "$dvidir" ; then
        dvidir=$1
        shift
      fi
      ;;
    -psdir* | --psdir*)
      psdir=`echol "$1" | sed 's/-*psdir=*//'`
      shift
      if test -z "$psdir" ; then
        psdir=$1
        shift
      fi
      ;;
    -pdfdir* | --pdfdir*)
      pdfdir=`echol "$1" | sed 's/-*pdfdir=*//'`
      shift
      if test -z "$pdfdir" ; then
        pdfdir=$1
        shift
      fi
      ;;
    -elispdir* | --elispdir*)
      elispdir=`echol "$1" | sed 's/-*elispdir=*//'`
      shift
      if test -z "$elispdir" ; then
        elispdir=$1
        shift
      fi
      ;;
    -vimdir* | --vimdir*)
      vimdir=`echol "$1" | sed 's/-*vimdir=*//'`
      shift
      if test -z "$vimdir" ; then
        vimdir=$1
        shift
      fi
      ;;
    -aclocaldir* | --aclocaldir*)
      aclocaldir=`echol "$1" | sed 's/-*aclocaldir=*//'`
      shift
      if test -z "$aclocaldir" ; then
        aclocaldir=$1
        shift
      fi
      ;;
    --win32gcc) HSYS="win32gcc"; shift; ;;
    --hyperspec=*)
      arg=`echol "$1" | sed 's/-*hyperspec=//'`
      case "$arg" in
        */FrontMatter* ) arg=`echo "$arg" | sed -e 's,FrontMatter.*$,,'` ;;
      esac
      case "$arg" in
        *://*) hyperspec="$arg" ;;
        /*) if test -d "$arg" -a -d "${arg}FrontMatter" ; then
              hyperspec="file:${arg}"
            else
              echo "makemake: --hyperspec=${arg} argument ignored, does not point to the Common Lisp HyperSpec" 1>&2
            fi
            ;;
        *)  case "$arg" in
              file:*) arg=`echo "$arg" | sed -e 's,^file:,,'` ;;
            esac
            if test -d "$arg" -a -d "${arg}FrontMatter" ; then
              hyperspec="file:"`cd "$arg" > /dev/null && pwd`
            else
              echo "makemake: --hyperspec=${arg} argument ignored, does not point to the Common Lisp HyperSpec" 1>&2
            fi
            ;;
      esac
      shift
      ;;
    *) endofargs=1 ;;
  esac
done

# Ensure trailing slash in hyperspec URL.
case "$hyperspec" in
  */)  ;;
  *) hyperspec=${hyperspec}/ ;;
esac

# HSYS, HSYSOS = host system
# HOS  = host operating system
# TSYS, TSYSOS = target system
# TOS  = target operating system
# CC, CPPFLAGS, CFLAGS, CLFLAGS, CPP = compiler on host, for host
# XCC, XCPPFLAGS, XCFLAGS, XCLFLAGS, XCPP = cross-compiler on host, for target

# These variables are set by configure:
# srcdir='@srcdir@'                 # either '.' or '../src', see above
CP='cp -p'                          # either 'cp -p' or 'cp'
LN_S='@LN_S@'                       # either 'ln -s' or 'ln' or 'cp -p'
LN='@LN@'                           # either 'ln' or ${CP}
HLN='@HLN@'                         # either 'ln' or 'hln'
CC="@CC@"                           # either 'gcc -O' or 'cc'
CPP="@CPP@"                         # either $CC' -E' or '/lib/cpp'
CPPFLAGS='@CPPFLAGS@'               # additional options for $CC and $CPP
CFLAGS='@CFLAGS@'                   # additional options for $CC
LDFLAGS='@LDFLAGS@'                 # additional options for linking
CC_GCC='@CC_GCC@'                   # either true or false
CC_SUNPRO='@CC_SUNPRO@'             # either true or false
CC_CPLUSPLUS='@CC_CPLUSPLUS@'       # either true or false
CC_NEED_DEEMA='@CC_NEED_DEEMA@'     # either true or false
AS_UNDERSCORE='@AS_UNDERSCORE@'     # either true or false
WINDRES='@WINDRES@'                 # something like i686-w64-mingw32-windres
LD='@LD@'                           # the linker used by $CC, such as 'ld' or '/usr/bin/ld -m elf_i386'
AR='@AR@'                           # usually 'ar'
RANLIB='@RANLIB@'                   # either 'ranlib' or ':'
DSYMUTIL='@DSYMUTIL@'               # either 'dsymutil' or ''
INSTALL='@INSTALL@'                 # either 'install -c' or 'cp'
INSTALL_PROGRAM='@INSTALL_PROGRAM@' # either 'install -c' or 'cp'
INSTALL_SCRIPT='@INSTALL_SCRIPT@'   # either 'install -c' or 'cp', avoid 'strip'
INSTALL_DATA='@INSTALL_DATA@'       # either 'install -c -m 644' or 'cp'
GROFF='@GROFF@'                     # either 'groff' or ''
PS2PDF='@PS2PDF@'                   # either 'ps2pdf' or ''
LIBS='@LIBS@'                       # list of system libraries
LIBTERMCAP='@LIBTERMCAP@'           # '-L/usr/??/lib' or 'broken' or ''
INCTERMCAP='@INCTERMCAP@'           # '-I/usr/??/include' or ''
LIBICONV='@LIBICONV@'               # either '-liconv' or ''
LIBSIGSEGV='@LIBSIGSEGV@'           # '-lsigsegv -L/usr/local/lib' or ''
LIBUNISTRING='@LIBUNISTRING@'       # '-lunistring ...' or ''
LIBSOCKET='@LIBSOCKET@'             # '-lnet' or '-lsocket' or '-lws2_32' or ''
X_CFLAGS='@X_CFLAGS@'               # either '-I/usr/somewhere/include' or ''
X_LIBS='@X_LIBS@'                   # either '-L/usr/somewhere/lib -lX11' or ''
FFCALL_LIBS='@LIBAVCALL@ @LIBCALLBACK@' # libavcall.a libcallback.a
host='@host@'                       # something like 'sparc-sun-sunos4'
host_cpu='@host_cpu@'               # something like 'sparc'
host_cpu_c_abi='@HOST_CPU_C_ABI@'   # ditto
host_vendor='@host_vendor@'         # something like 'sun'
host_os='@host_os@'                 # something like 'sunos4'
GNU_MAKE='@GNU_MAKE_FALSE@'         # '#' if non-gnu; '' if gnu

if test -x ./libtool; then # normal autoconf-based build
  # -rdynamic or -Wl,-E or -Wl,--export-dynamic
  eval "`./libtool --tag=CC --config | grep '^wl='`"
  eval "`./libtool --tag=CC --config | grep '^export_dynamic_flag_spec='`"
  eval EXPORT_DYNAMIC_FLAG_SPEC=\"$export_dynamic_flag_spec\"
else # generating Makefiles for MS compiler from Makefile.devel
  :
fi

# Important: Don't rely on this host classification.
# 1. GNU's database config.guess is not always up to date.
# 2. New operating systems are emerging at every corner.
# 3. People tend to change their systems locally.
# Use this classification ONLY if we know no better way to check for a
# feature or bug than to look at various `uname ...` results and list
# the buggy systems explicitly. ONLY in this case!

UTILCOMPILE="\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(CLFLAGS)"
case $# in
  0 | 1)
     # Assume we are on Unix (or win32gcc); target=host (not cross-compiling).
     CROSS=false
     if [ -z "$HSYS" ]; then # not win32gcc
       # some shells (A/UX and OSF/1) need the parentheses around "arch" below.
       HSYS=`((arch) 2>/dev/null || uname -m 2>/dev/null) | $tolower` # system name in lowercase
       HSYSOS=`((uname) 2>/dev/null || arch 2>/dev/null) | $tolower` # OS name in lowercase
       if [ "$HSYS" = 386bsd -o "$HSYS" = sun386 -o "$HSYS" = "386/at" -o "$HSYS" = i86pc ] ; then
         HSYS='i386'
       fi
       if [ "$HSYS" = sun4m ] ; then
         HSYS='sun4'
       fi
       case "$HSYSOS" in
         # Canonicalize cygwin32/nt and cygwin32/95 to plain cygwin.
         cygwin*) HSYSOS=cygwin ;;
       esac
       HOS='unix'
       COMPILER=??
     else                       # win32gcc
       HSYSOS=$HSYS
       HOS=win32
       COMPILER=gcc
       # Compile the utils as native Windows binaries, even on Cygwin.
       UTILCOMPILE="\$(CC) \$(CPPFLAGS)"
     fi
     TSYS="$HSYS"
     TSYSOS="$HSYSOS"
     case "$host_os" in
       mingw*) TOS=win32 ;;
       *)      TOS="$HOS" ;;
     esac
     ;;
  *) if [ "$1" = cross ] ; then
       CROSS=true
       shift
     else
       CROSS=false
     fi
     TSYS=$1
     COMPILER=$2
     module_configure_flags=${module_configure_flags}" --build=${TSYS}"
     # TSYS should be (master|win32msvc).
     # COMPILER should be <host...>-gcc or cc
     case ${TSYS} in
       win32msvc ) TOS='win32' ;;
       *)          TOS='unix' ;;
     esac
     TSYSOS=$TSYS
     if [ $CROSS = true ] ; then
       HOS='unix'
       HSYS=irrelevant
       HSYSOS=irrelevant
     else
       HOS="$TOS"
       HSYS="$TSYS"
       HSYSOS="$TSYSOS"
     fi
     if [ $TSYS = win32msvc ] ; then
       CC='cl'
       CC_GCC=false
       CFLAGS='$(MFLAGS)'
       CC_NEED_DEEMA=true
       AS_UNDERSCORE=false
       LD='link'
       FFCALL_LIBS='avcall.lib callback.lib'
     else
       CC=${COMPILER}
       case $COMPILER in
         *-gcc ) CC_GCC=true ;;
         *) CC_GCC=false ;;
       esac
       CFLAGS='-O'
       CPP="${CC} -E"
       LD='ld'
     fi
     shift 2
     ;;
esac

# Like WIDE_HARD in lispbibl.d
if [ $CROSS = false ] ; then
  if grep 'define long_bitsize 64' intparam.h > /dev/null && grep 'define long_long_bitsize 64' intparam.h > /dev/null; then
    WIDE_HARD='true'
  else
    WIDE_HARD='false'
  fi
else
  WIDE_HARD='false' # just a guess
fi

if [ "${with_gmalloc}" = yes ]; then GMALLOC=gmalloc; else GMALLOC=""; fi

if [ $CROSS = true ] ; then
  # We can cross-compile only with GCC
  XCC=${COMPILER}  # ${TSYS}-gcc
  XCPP="${XCC} -E"
  XCPPFLAGS=''
  XCFLAGS=''
  XLDFLAGS=''
  XCC_GCC=true
  XCC_NEED_DEEMA=false
else
  TSYS="$HSYS"
  TOS="$HOS"
  XCC="${CC}"
  XCPP="${CPP}"
  XCPPFLAGS="${CPPFLAGS}"
  XCFLAGS="${CFLAGS}"
  XLDFLAGS="${LDFLAGS}"
  XCC_GCC="${CC_GCC}"
  XCC_NEED_DEEMA="${CC_NEED_DEEMA}"
fi

if [ "${with_dynamic_modules}" = default ]; then
  # if --with-dynamic-modules is not supplied:
  # C=yes, C++=no because of symbol mangling:
  # ;; Loading module libsvm from lib-FOO.so
  # SYSTEM::DYNLOAD-MODULES: "dlsym"("module__FOO__init_function_1") ->
  # "lib-FOO.so: undefined symbol: module__FOO__init_function_1"
  # $ nm lib-FOO.so | grep module__FOO__init_function_1
  # 000008f8 T _Z31module__FOO__init_function_1P8module_t
  if [ "${CC_CPLUSPLUS}" = true ]; then
    with_dynamic_modules=no
  else
    # - Don't enable dynamic modules by default on AIX.
    #   libtool's archive_cmds variable is empty on AIX.
    #   Cf. <https://sourceforge.net/p/clisp/bugs/726/>
    # - Don't enable dynamic modules by default on HP-UX.
    #   See the comment regarding HAVE_DYNLOAD in unix.d.
    if [ $CROSS = false ] ; then
      case "$host_os" in
        aix* | hpux*) with_dynamic_modules=no ;;
        *)            with_dynamic_modules=yes ;;
      esac
    else
      with_dynamic_modules=yes
    fi
  fi
elif [ "${with_dynamic_modules}" = yes -a "${CC_CPLUSPLUS}" = true ]; then
  fail "dynamic modules do not work with C++ because of symbol mangling"
fi

# now set appropriate MSVC cflags
if [ $TSYS = win32msvc ] ; then
  # -G5 means to optimize for i586.
  # "-Od -Z7" means to compile for debugging.
  # "-O1" means to optimize on msvc4,
  # "-Os -Oy -Ob1 -Gs -Gf -Gy" means to optimize on msvc5+
  # ("-O1" and "-O2" are buggy in msvc5 ... msvc7).
  # -Zi - include debug info (-ZI for debug-and-continue)
  # -GZ - runtime debug checks
  case $COMPILER in
    msvc6 | msvc7)
      if [ "${with_debug}" = no ] ; then
        CFLAGS=${CFLAGS}" -G5 -Os -Oy -Ob1 -Gs -Gf -Gy"
      else
        CFLAGS=${CFLAGS}" -Zi -Od -GZ"
      fi
      ;;
    *) fail "unsupported compiler [${COMPILER}]"
      ;;
  esac
fi

if [ "$srcdir" = . ] ; then
  SRCDIR=''
else
  SRCDIR="${srcdir}/"
fi

# SRCTOPDIR is the parent directory of $srcdir, ending in a slash.
case "$srcdir" in
  *"/src" ) SRCTOPDIR=`echol "$srcdir" | sed -e 's,src$,,'` ;;
  "." )     SRCTOPDIR="../" ;;
  * )       SRCTOPDIR="$srcdir/../" ;;
esac
case "$SRCTOPDIR" in
  /*) PARENT_SRCTOPDIR="${SRCTOPDIR}" ;;
  *)  PARENT_SRCTOPDIR="../${SRCTOPDIR}" ;;
esac

RECOMPILEDIR=stage
TESTSDIR=tests
SACLATESTSDIR=sacla-tests
ANSITESTSDIR=ansi-tests
BENCHDIR=benchmarks

# Main host OS dependencies:

# DOS-style filenames and file utilities
H_DOS="false"
test $HOS = win32 -a $HSYS != win32gcc && H_DOS="true"

# HEXE = extension for executable files on host
if [ $HOS = win32 ] ; then
  HEXE='.exe'
else
  HEXE=''
fi

# make sure the Darwin foo.dSYM directories are removed by clean et al
# exefile: list of files generated by compilation
#   ("foo.exe" or "foo" or "foo foo.dSYM")
# EXERM: make variable that will remove the above
#   (RMRF on darwin because dSYM is a directory, RM otherwise)
if [ $HSYSOS = darwin ]; then
  exefiles () {
    echo $1 $1.dSYM
  }
  EXERM=RMRF
else
  exefiles () {
    echo $1${HEXE}
  }
  EXERM=RM
fi

# HERE = prefix to ensure that executables are looked up in current directory
HERE='./'

# PREFIX = prefix for installation directories
# (This should not end in a backslash. Add a space to avoid this.)
if [ $HOS = unix ] ; then
  test -n "$prefix" ||
    prefix='@prefix@' # usually '/usr/local'
  PREFIX="${prefix}"
else
  PREFIX=''
fi

# EXEC_PREFIX = prefix for architecture dependent installation directories
brace_to_paren='s,\${\([^{}]*\)},$(\1),g'
if [ $HOS = unix ] ; then
  test -n "$exec_prefix" ||
    exec_prefix='@exec_prefix@' # usually '${prefix}'
  EXEC_PREFIX=`echo "$exec_prefix" | sed -e "$brace_to_paren"`
else
  EXEC_PREFIX='$(prefix)'
fi

# PARENT = piece of path for parent directory
# NEXT = piece of path for next subdirectory
# PARENT, NEXT: For interpretation by CLISP.
# PARENT_, NEXT_: For interpretation by the system's shell (called by make).
# PARENT_M, NEXT_M: For interpretation by the make program.
PARENT='../'
NEXT='/'
if [ $H_DOS = "true" ] ; then
  # Replace '/' with '\':
  PARENT_=`echol $PARENT | sed -e 's,/,\\\\,g'`
  NEXT_=`echol $NEXT | sed -e 's,/,\\\\,g'`
else
  PARENT_=$PARENT
  NEXT_=$NEXT
fi
# Replace '\' with '\\':
#PARENT_2=`echol $PARENT_ | sed -e 's,\\\\,\\\\\\\\,g'`
if [ $HSYS = win32gcc ] ; then
  PARENT_M="$PARENT"
  NEXT_M="$NEXT"
else
  PARENT_M="$PARENT_"
  NEXT_M="$NEXT_"
fi

# Various other installation directories.
if [ $HOS = unix ] ; then
  test -n "$bindir" || bindir='@bindir@' # usually '${exec_prefix}/bin'
  BINDIR=`echo "$bindir" | sed -e "$brace_to_paren"`
else
  bindir="\$(exec_prefix)${NEXT_}bin"
  BINDIR="$bindir"
fi
if [ $HOS = unix ] ; then
  test -n "$libdir" || libdir='@libdir@' # usually '${exec_prefix}/lib'
  LIBDIR=`echo "$libdir" | sed -e "$brace_to_paren"`
else
  libdir="\$(exec_prefix)${NEXT_}lib"
  LIBDIR="$libdir"
fi
if [ $HOS = unix ] ; then
  test -n "$includedir" || includedir='@includedir@' # '${prefix}/include'
  INCLUDEDIR=`echo "$includedir" | sed -e "$brace_to_paren"`
else
  includedir="\$(prefix)${NEXT_}include"
  INCLUDEDIR="$includedir"
fi
if [ $HOS = unix ] ; then
  test -n "$datarootdir" || datarootdir='@datarootdir@' # '${prefix}/share'
  DATAROOTDIR=`echo "$datarootdir" | sed -e "$brace_to_paren"`
else
  datarootdir="\$(prefix)${NEXT_}share"
  DATAROOTDIR="$datarootdir"
fi
if [ $HOS = unix ] ; then
  test -n "$localedir" || localedir='@localedir@' # '${datarootdir}/locale'
  LOCALEDIR=`echo "$localedir" | sed -e "$brace_to_paren"`
else
  localedir="\$(datarootdir)${NEXT_}locale"
  LOCALEDIR="$localedir"
fi
if [ -z "$fsstnd" ]; then       # default fsstnd depends on the OS
  case ${TSYSOS} in
    cygwin | win32gcc )  fsstnd=redhat; ;; # cygwin == redhat!
    *bsd ) fsstnd=bsd; ;;
    linux )
      if test -r /etc/lsb-release; then
        . /etc/lsb-release;
        case "${DISTRIB_ID}" in
          *buntu | Debian | Slackware ) fsstnd=debian; ;;
          Fedora | Redhat ) fsstnd=redhat; ;;
          SuSE ) fsstnd=suse; ;;
          * )  fsstnd=gnu_ext; ;;
        esac
      elif test -r /etc/redhat-release; then
        fsstnd=redhat
      else
        fsstnd=gnu_ext
      fi ;;
    * )  fsstnd=gnu_ext; ;;
  esac
  test "${verbose}" = true -o "${verbose}" = yes && \
    echo "inferred: fsstnd = $fsstnd" >&2
fi

# An explicitly given --docdir overrides the implied value from fsstnd,
# and the implied value from fsstnd overrides the default.
if [ -z "$docdir" ] ; then
  if [ $HOS = unix ] ; then
    docdir='@docdir@' # usually '${datarootdir}/doc/${PACKAGE_TARNAME}'
    if [ "$docdir" = '${datarootdir}/doc/${PACKAGE_TARNAME}' ] ; then
      docdir=
    else
      PACKAGE_TARNAME=clisp ; eval docdir=\"$docdir\"
    fi
    DOCDIR=`echo "$docdir" | sed -e "$brace_to_paren"`
  fi
  if [ -z "$docdir" ] ; then
    case "$fsstnd" in
      suse)
        docdir="\$(datarootdir)${NEXT_}doc${NEXT_}packages${NEXT_}clisp"
        ;;
      redhat)
        docdir="\$(datarootdir)${NEXT_}doc${NEXT_}\$(TOPDIR)"
        ;;
      debian | gnu_ext | *bsd)
        docdir="\$(datarootdir)${NEXT_}doc${NEXT_}clisp"
        ;;
    esac
    DOCDIR="$docdir"
  fi
else
  DOCDIR="$docdir"
fi
if [ $HOS = unix ] ; then
  test -n "$mandir" || mandir='@mandir@' # usually '${datarootdir}/man'
  MANDIR=`echo "$mandir" | sed -e "$brace_to_paren"`
else
  mandir="\$(datarootdir)${NEXT_}man"
  MANDIR="$mandir"
fi
if [ $HOS = unix ] ; then
  test -n "$htmldir" || htmldir='@htmldir@' # usually '${docdir}'
  HTMLDIR=`echo "$htmldir" | sed -e "$brace_to_paren"`
else
  htmldir="\$(docdir)"
  HTMLDIR="$htmldir"
fi
if [ $HOS = unix ] ; then
  test -n "$dvidir" || dvidir='@dvidir@'
  DVIDIR=`echo "$dvidir" | sed -e "$brace_to_paren"`
else
  dvidir="\$(docdir)"
  DVIDIR="$dvidir"
fi
if [ $HOS = unix ] ; then
  test -n "$psdir" || psdir='@psdir@' # usually '${docdir}'
  PSDIR=`echo "$psdir" | sed -e "$brace_to_paren"`
else
  psdir="\$(docdir)"
  PSDIR="$psdir"
fi
if [ $HOS = unix ] ; then
  test -n "$pdfdir" || pdfdir='@pdfdir@' # usually '${docdir}'
  PDFDIR=`echo "$pdfdir" | sed -e "$brace_to_paren"`
else
  pdfdir="\$(docdir)"
  PDFDIR="$pdfdir"
fi
if [ $HOS = unix ] ; then
  test -n "$elispdir" || elispdir='${datarootdir}/emacs/site-lisp'
  ELISPDIR=`echo "$elispdir" | sed -e "$brace_to_paren"`
else
  elispdir="\$(datarootdir)/emacs/site-lisp"
  ELISPDIR="$elispdir"
fi
vimdir_default='vim/vimfiles/after/syntax'
if [ $HOS = unix ] ; then
  test -n "$vimdir" || vimdir='${datarootdir}/'${vimdir_default}
  VIMDIR=`echo "$vimdir" | sed -e "$brace_to_paren"`
else
  vimdir="\$(datarootdir)/${vimdir_default}"
  VIMDIR="$vimdir"
fi
aclocaldir_default='aclocal'
if [ $HOS = unix ] ; then
  test -n "$aclocaldir" || aclocaldir='${datarootdir}/'${aclocaldir_default}
  ACLOCALDIR=`echo "$aclocaldir" | sed -e "$brace_to_paren"`
else
  aclocaldir="\$(datarootdir)/${aclocaldir_default}"
  ACLOCALDIR="$aclocaldir"
fi

if [ $H_DOS = "true" ] ; then
  # Replace '/' with '\':
  SRCTOPDIR_=`echol ${SRCTOPDIR} | sed -e 's,/,\\\\,g'`
  PARENT_SRCTOPDIR_=`echol ${PARENT_SRCTOPDIR} | sed -e 's,/,\\\\,g'`
else
  SRCTOPDIR_=$SRCTOPDIR
  PARENT_SRCTOPDIR_=${PARENT_SRCTOPDIR}
fi
if [ $HSYS = win32gcc ] ; then
  SRCTOPDIR_M="$SRCTOPDIR"
  PARENT_SRCTOPDIR_M="${PARENT_SRCTOPDIR}"
else
  SRCTOPDIR_M="$SRCTOPDIR_"
  PARENT_SRCTOPDIR_M="${PARENT_SRCTOPDIR_}"
fi
UTILDIR="${SRCTOPDIR}utils${NEXT}"
UTILDIR_="${SRCTOPDIR_}utils${NEXT_}"
UTILDIR_M="${SRCTOPDIR_M}utils${NEXT_M}"
SRCDOCDIR="${SRCTOPDIR}doc${NEXT}"
SRCDOCDIR_="${SRCTOPDIR_}doc${NEXT_}"
SRCDOCDIR_M="${SRCTOPDIR_M}doc${NEXT_M}"
MODULESDIR="${SRCTOPDIR}modules${NEXT}"
MODULESDIR_="${SRCTOPDIR_}modules${NEXT_}"
MODULESDIR_M="${SRCTOPDIR_M}modules${NEXT_M}"

if [ $CROSS = false -a $HSYS = win32msvc ] ; then
  NEXT_CC="$NEXT_"
  UTILDIR_CC="$UTILDIR_"
else
  NEXT_CC="$NEXT"
  UTILDIR_CC="$UTILDIR"
fi

# RM = command for deleting files; RMRF - recursively
if [ $H_DOS = "true" ] ; then
  RM='del /q'
  RMRF='del /q /s'
else
  RM='rm -f'
  RMRF='rm -rf'
fi

# CP = command for copying files
if [ $H_DOS = "true" ] ; then
  CP='copy'
# else see above
fi

# LN_S = command for copying read-only files
if [ $H_DOS = "true" ] ; then
  LN_S='copy'
else
  # Set by configure, above.
  # On mingw in the Cygwin environment, the built native Windows programs don't
  # understand the symlinks created by Cygwin's 'ln -s'. Therefore avoid
  # creating such symlinks.
  case "$host_os" in
    mingw*) LN_S=${LN-ln} ;;
  esac
fi

# LN_HARD = command for copying files, saving disk space if possible
LN_HARD=${LN-ln}

# HLN = command for making hard links ($HOS = unix only)
if [ "$HLN" = hln ] ; then
  HLN="`pwd`/hln"
fi

# MV = command for renaming files
if [ $H_DOS = "true" ] ; then
  MV='ren'
else
  MV='mv'
fi

# CAT = command for typing files to stdout
if [ $H_DOS = "true" ] ; then
  CAT='type'
else
  CAT='cat'
fi

# TOUCH = command for pretending files are new
TOUCH='touch'

# GREP = command for filtering text according to regular expressions
GREP='grep'

# SED = command for filtering text according to a script
SED='sed'

# RANLIB = command for finishing libraries
if [ -z "${RANLIB}" ] ; then RANLIB='ranlib'; fi

# INSTALL = command for installing binaries/data
if [ -z "$INSTALL" ] ; then
  INSTALL=$CP
  INSTALL_PROGRAM='$(INSTALL)'
  INSTALL_DATA='$(INSTALL)'
fi

# Main target OS dependencies:

OS_INCLUDES=''
if [ "$TSYSOS" = osf1 ] ; then
  # On OSF/1 4.0, libtool adds -lc, but this -lc flag causes link errors when
  # comes anywhere except at the end of the link command line, complaining
  # about _OtsDivide32, __lc_ctype and others.
  remove_lc () { echo " $1 " | sed -e 's, -lc ,,g' -e 's,^ ,,' -e 's, $,,'; }
  LIBICONV=$(remove_lc " $LIBICONV ")
  LIBINTL=$(remove_lc " $LIBINTL ")
  LIBSIGSEGV=$(remove_lc " $LIBSIGSEGV ")
  LIBUNISTRING=$(remove_lc " $LIBUNISTRING ")
  LIBSOCKET=$(remove_lc " $LIBSOCKET ")
fi
if [ $TSYS = master -o $TOS = unix ] ; then
  OS_INCLUDES=$OS_INCLUDES' unix'
  LIBS=$LIBS" $LIBICONV $LIBSIGSEGV $LIBUNISTRING"
fi
if [ $TSYS = master -o $TOS = win32 ] ; then
  OS_INCLUDES=$OS_INCLUDES' win32'
  if [ $TSYS = win32gcc ] ; then
    LIBS=$LIBS" -luser32 -lole32 -loleaut32 -luuid $LIBICONV $LIBSIGSEGV $LIBUNISTRING"
  else
    if [ $TSYS = win32msvc ] ; then
      LIBS=$LIBS" user32.lib ws2_32.lib advapi32.lib $LIBSIGSEGV $LIBUNISTRING"
    fi
    LIBS=$LIBS' ole32.lib shell32.lib'
  fi
fi
if [ $TSYS = master -o $TOS = unix -o $TOS = win32 ] ; then
  OS_INCLUDES=$OS_INCLUDES' xthread'
fi

# TEXE = extension for executable files on target
# LEXE = extension for executable file LISP on target
# SHREXT = extension for shared object files (a.k.a. shared libraries) on target
PWD_POSTPROC=''
if [ ${TOS} = win32 -o ${HSYSOS} = cygwin ] ; then
  TEXE='.exe'
  LEXE='.exe'
  SHREXT='.dll'
  # no path conversion on msys
  # http://thread.gmane.org/gmane.comp.gnu.mingw.msys/1707/
  # https://sourceforge.net/p/mingw/mailman/mingw-msys/thread/4B9FD2A4.2050805@gnu.org/
  # http://stackoverflow.com/questions/12015348/msys-path-conversion-or-cygpath-for-msys
  if cygpath -v > /dev/null 2>&1; then
    PWD_POSTPROC='cygpath -m'
  fi
else
  TEXE=''
  LEXE='.run'
  case "$host_os" in
    darwin*) SHREXT='.dylib' ;;
    hpux*)   SHREXT='.sl' ;;
    *)       SHREXT='.so' ;;
  esac
fi
HEREP=`pwd`
test -n "${PWD_POSTPROC}" && HEREP=`${PWD_POSTPROC} ${HEREP}`
HERE_="${HEREP}${NEXT_}"

# for systems that lack stdint (or have a broken stdint) (e.g., solaris[89])
# gllib path must be absolute because CPPFLAGS is passed on to module subdirs
# cf m4/clisp.m4: GNULIB_INCLUDE must contain no colons
x=${HEREP}; GNULIB_INCLUDE="-I$(@CLISP_DECOLONIZE@)/gllib"
if [ -n "${SRCDIR}" ] ; then
  x=`cd ${SRCDIR} && pwd`;
  test -n "${PWD_POSTPROC}" && x=`${PWD_POSTPROC} ${x}`
  x="$(@CLISP_DECOLONIZE@)"
  XCPPFLAGS="${XCPPFLAGS} -I$x"
  GNULIB_INCLUDE="${GNULIB_INCLUDE} -I$x/gllib"
fi
CPPFLAGS="${CPPFLAGS} ${GNULIB_INCLUDE}"
XCPPFLAGS="${XCPPFLAGS} ${GNULIB_INCLUDE}"

# TOBJ = extension for compiled modules on target
if [ $TSYS = win32msvc ] ; then
  TOBJ='.obj'
  OUT='/link /out:'
else
  TOBJ='.o'
  OUT='-o '
fi

# Main cpu dependencies:
cpu="${host_cpu_c_abi}"
if test -z "$cpu"; then
  echo "$0: WARNING: host_cpu_c_abi is void; using host_cpu=${host_cpu}" >&2
  cpu="${host_cpu}"
fi

test "${verbose}" = true -o "${verbose}" = yes && \
  cat <<EOF >&2
EXPORT_DYNAMIC_FLAG_SPEC=${EXPORT_DYNAMIC_FLAG_SPEC}
module_configure_flags=${module_configure_flags}
# host system:
 hostname = "${hostname}"
     HSYS = "${HSYS}"
   HSYSOS = "${HSYSOS}"
      HOS = "${HOS}"
 host_cpu = "${host_cpu}"
 host_ABI = "${host_cpu_c_abi}"
      cpu = "${cpu}"
  host_os = "${host_os}"
     host = "${host}"
# target system:
     TSYS = "${TSYS}"
   TSYSOS = "${TSYSOS}"
      TOS = "${TOS}"
EOF
# e.g.:
### msys/mingw
# # host system:
#   hostname = "stnt067"
#       HSYS = "win32gcc"
#     HSYSOS = "win32gcc"
#        HOS = "win32"
#   host_cpu = "i686"
#        cpu = "i386"
#    host_os = "mingw32"
#       host = "i686-pc-mingw32"
# # target system:
#       TSYS = "win32gcc"
#     TSYSOS = "win32gcc"
#        TOS = "win32"
### cygwin/--with-mingw
# # host system:
#  hostname = "nyc-qsv-term01"
#      HSYS = "win32gcc"
#    HSYSOS = "win32gcc"
#       HOS = "win32"
#  host_cpu = "i686"
#       cpu = "i386"
#   host_os = "cygwin"
#      host = "i686-pc-cygwin"
# # target system:
#      TSYS = "win32gcc"
#    TSYSOS = "win32gcc"
#       TOS = "win32"
### cygwin
# # host system:
#  hostname = "nyc-qsv-term01"
#      HSYS = "i686"
#    HSYSOS = "cygwin"
#       HOS = "unix"
#  host_cpu = "i686"
#       cpu = "i386"
#   host_os = "cygwin"
#      host = "i686-pc-cygwin"
# # target system:
#      TSYS = "i686"
#    TSYSOS = "cygwin"
#       TOS = "unix"
### linux
# # host system:
#  hostname = "nyc-qws-005"
#      HSYS = "x86_64"
#    HSYSOS = "linux"
#       HOS = "unix"
#  host_cpu = "x86_64"
#       cpu = "x86_64"
#   host_os = "linux-gnu"
#      host = "x86_64-unknown-linux-gnu"
# # target system:
#      TSYS = "x86_64"
#    TSYSOS = "linux"
#       TOS = "unix"

# Main compiler dependencies:

if [ $XCC_GCC = true ] ; then
  XCC_SUNPRO=false
  # Recognize clang. It disguises as GCC.
  if LC_ALL=C $XCC --version | grep 'Apple LLVM' > /dev/null; then
    XCC_BRAND=clang
  else
    XCC_BRAND=`LC_ALL=C $XCC --version | sed -e '2,$d' -e 's/ .*//'` # either gcc or clang
  fi
  XCC_GCC_VERSION=`LC_ALL=C $XCC -v 2>&1 | grep version | sed -n -e '$p' | sed -e 's/.*version //g' -e 's/gcc //'`
  # Assume gcc 2.95 or newer.
  # Diagnostic flags:
  # Syntax errors at identifiers that are produced by macro expansion
  # (e.g. at 'local', which expands to 'static') are shown with the
  # location of the macro only, in gcc 5.x at least, which is confusing.
  # Use option '-no-integrated-cpp' to provide better syntax error reporting.
  if [ "$XCC_BRAND" = gcc ] ; then
    case "$XCC_GCC_VERSION" in
      2.* | 3.* | 4.[0-7]*) ;;
      *)
        XCFLAGS=$XCFLAGS' -no-integrated-cpp'
        ;;
    esac
  fi
  # Warnings flags:
  XCFLAGS=${XCFLAGS}' -W -Wswitch -Wcomment -Wpointer-arith -Wreturn-type'
  if [ $CC_CPLUSPLUS = false ] ; then
    XCFLAGS=${XCFLAGS}' -Wmissing-declarations -Wimplicit'
  fi
  # gcc 2.7 introduced an annoying warning, but gcc 2.8 has a workaround:
  XCFLAGS=$XCFLAGS' -Wno-sign-compare -Wno-format-nonliteral'
  # clisp assumes two's complement arithmetic, therefore disable
  # "warning: left shift of negative value".
  # https://gcc.gnu.org/ml/gcc-patches/2015-04/msg01353.html
  if [ $CROSS = false ] ; then
    case "$XCC_GCC_VERSION" in
      2.* | 3.* | 4.* | 5.*) ;;
      *)
        XCFLAGS=$XCFLAGS' -Wno-shift-negative-value'
        ;;
    esac
  fi
  if [ $CROSS = false -a $CC_CPLUSPLUS = true ] ; then
    # g++ 3.4 introduced an annoying warning, but has a workaround:
    case "$XCC_GCC_VERSION" in
      2.* | 3.[1-3]*) ;;
      *)
        XCFLAGS=$XCFLAGS' -Wno-invalid-offsetof'
        ;;
    esac
  fi
  # Code generation flags:
  # Select optimizations.
  if [ "${with_debug}" = no ] ; then
    if [ "$cpu" = i386 ] ; then
      XCFLAGS=$XCFLAGS' -O2 -fexpensive-optimizations'
    elif [ "$cpu" = sparc ] ; then
      XCFLAGS=$XCFLAGS' -O2'
    elif [ "$cpu" = sparc64 ] ; then
      # gcc-3.3.1 produces incorrect code when -O2 is used, even with
      # -fno-schedule-insns and -fno-gcse.
      XCFLAGS=$XCFLAGS' -O'
    elif [ "$cpu" = x86_64 ] ; then
      # gcc-3.2.2 produces incorrect code when -O2 is used.
      XCFLAGS=$XCFLAGS' -O'
    else
      XCFLAGS=$XCFLAGS' -O2'
    fi
    # For platforms that use global register variables...
    case "$cpu" in
      m68k | i386 | sparc | sparc64 | hppa | arm | armhf | alpha | s390*)
        if [ $CROSS = false ] ; then
          case "$XCC_GCC_VERSION" in
            3.1*)
              # gcc-3.1 produces incorrect code when compiling record
              # (function C_make_instance).
              XCFLAGS=$XCFLAGS' -fno-gcse' ;;
          esac
        fi
        ;;
    esac
  fi # with_debug
  # clisp assumes two's complement arithmetic. Therefore use -fwrapv.
  # No need to use -fno-strict-overflow, since we only need to disable
  # strict overflow rules for integer types, not for pointer types, and
  # for integer types it's already implied by -fwrapv.
  if [ $CROSS = false ] ; then
    case "$XCC_GCC_VERSION" in
      2.* | 3.[1-3]*) ;;
      *)
        XCFLAGS=$XCFLAGS' -fwrapv'
        ;;
    esac
  fi
  # On arm64, gcc 4.8.4 with binutils 2.24 produces code that, when TYPECODES
  # is used, leads to a link error when linking lisp.run:
  #   relocation truncated to fit: R_AARCH64_ADR_PREL_PG_HI21 against symbol `symbol_tab_data' defined in .data section in spvwtabs.o
  # The option -fPIC is a workaround.
  if [ "$cpu" = arm64 ] ; then
    XCFLAGS=$XCFLAGS' -fPIC'
  fi
  if [ $TSYS = win32gcc ] ; then
    XCFLAGS=$XCFLAGS' -D_WIN32'
  fi
  if [ $TSYS = sun4 ] ; then
    XCLFLAGS='-static'
  else
    XCLFLAGS=''
  fi
  # Override any "-x c++" options which may be present in $XCC or $XCFLAGS.
  XCLFLAGS="$XLDFLAGS $XCLFLAGS"
  XCC_NOOPTFLAGS=' -O0'

  if [ "${with_threads}" = "POSIX_THREADS" ]; then
    XCFLAGS=${XCFLAGS}" -pthread"
  fi

else

  if [ $CROSS = false ] ; then
    # Detect SUNWspro C compiler - defines __SUNPRO_C
    XCC_SUNPRO=${CC_SUNPRO}
  else
    XCC_SUNPRO=false
  fi
  if [ $TSYS = win32msvc ] ; then
    XCPP="cl -E"
    case ${COMPILER} in
      msvc6) XCPP="$XCPP -D_MSC_VER=1200 -D_INTEGRAL_MAX_BITS=64"
        ;;
      msvc7) XCPP="$XCPP -D_MSC_VER=1300 -D_INTEGRAL_MAX_BITS=64 -I\$(MSVCDIR)/PlatformSDK/include"
        ;;
      *) fail "unsupported compiler [${COMPILER}]"
        ;;
    esac
    XCFLAGS="$CFLAGS -U__GNUC__ -DANSI -D_M_IX86=500 -D_WIN32 -I\$(MSVCDIR)/include"
  elif "$XCC_SUNPRO" ; then
    # SUNWspro cc flags:
    XCFLAGS=${XCFLAGS}' -xO3 -xstrconst'
  elif [ "$HSYSOS" = hp-ux -o $TSYS = sun4 ] ; then
    # HP's HPPA compilers crash when optimizing.
    # SUN's cc is buggy when optimizing spvw.d, even with only -O1.
    # we do not reset XCFLAGS so that the user can pass -xarch=v8 et al
    # XCFLAGS=''
    :
  else
    XCFLAGS=${XCFLAGS}' -O'
  fi
  case "$host_os" in
    hpux*)
      # HP's C compiler (HP C B.11.11.24 on hppa) crashes when compiling
      # stream.d with -g. So remove -g if it was specified.
      XCFLAGS=`echo " $XCFLAGS " | sed -e 's/ -g //' -e 's/^ *//' -e 's/ *$//'`
      ;;
  esac
  XCLFLAGS=''
  if [ $TSYS = sun4 ] ; then
    XCFLAGS=$XCFLAGS' -dalign'
    if [ $CC_CPLUSPLUS = false ] ; then
      XCFLAGS=$XCFLAGS' -fsingle'
    fi
    XCLFLAGS=$XCLFLAGS' -Bstatic'
  fi
  XCC_NOOPTFLAGS=''

fi

# Relocatable machine pointers are machine pointers that are visible to the GC.
# In the HEAPCODES object representation, they must satisfy alignment
# constraints. When these constraints are not defined, we run into
#   C_CODE_ALIGNMENT is wrong. &equal = 0x4c8de7.
# This can happen
# - with gcc on Linux, when not optimizing,
# - with Apple's gcc 4 on MacOS X,
# - with gcc >= 4 when "gcc -Os" is used,
# - with clang when "clang -Os" is used.
# gcc has an option to fix this. clang 3.9 doesn't.
if [ $XCC_GCC = true ] && [ "$XCC_BRAND" != clang ] ; then
  if $WIDE_HARD; then
    # GENERIC64C_HEAPCODES requires an 8-byte alignment of all C functions
    # that are used as relocatable machine pointers.
    FALIGNFLAGS='-falign-functions=8'
  else
    if [ "$cpu" = arm -o "$cpu" = armhf ] ; then
      # On ARM, function pointer alignment depends on the arm/thumb mode:
      # C_CODE_ALIGNMENT is 4 with -marm, but only 1 with -mthumb.
      XCFLAGS=${XCFLAGS}' -marm'
      FALIGNFLAGS=''
    else
      FALIGNFLAGS='-falign-functions=4'
    fi
  fi
else
  FALIGNFLAGS=''
fi

# We access the same memory through pointers of different types, for example
# as TheVarobject(obj)->..., TheRecord(obj)->..., TheInstance(obj)->... .
# This violates the strict type-based aliasing rules of C. In other words, we
# still use C as a portable assembler, but now the compilers want to outsmart
# us. There are two ways to tell them not to do this: to use union types, or
# specific compiler options. I prefer to do it through compiler options.
if [ $XCC_GCC = true ] ; then
  XCFLAGS=$XCFLAGS' -fno-strict-aliasing'
else
  if [ "$HSYSOS" = aix ] ; then # for xlc
    XCFLAGS=$XCFLAGS' -qalias=noansi'
  fi
  if "$XCC_SUNPRO" ; then # for SUNWspro cc
    XCFLAGS=$XCFLAGS' -xalias_level=weak'
  fi
fi

if [ "${with_dynamic_modules}" != no ]; then # not on msvc
  # Support for dynamic loading.
  eval "`./libtool --tag=CC --config | grep '^pic_flag='`"
  eval XCC_PICFLAG=\"${pic_flag}\"
  if [ "$HSYSOS" != cygwin ]; then
    eval "`./libtool --tag=CC --config | grep '^allow_undefined_flag='`"
    eval "`./libtool --tag=CC --config | grep '^archive_cmds='`"
  else
    archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname'
  fi
  # http://article.gmane.org/gmane.comp.shells.bash.bugs:17158
  # http://lists.gnu.org/archive/html/bug-bash/2011-08/msg00280.html
  CC_set=${CC+set}
  CC_save=$CC
  CC='${CC}' libobjs='$libs' deplibs='${CLFLAGS}' compiler_flags='${CFLAGS}' \
    soname='$dll' lib='$lib' output_objdir='$dyndir' \
    eval XCC_CREATESHARED=\"${archive_cmds}\"
  # archive_cmds can contain several commands, separated by ~.
  # But here we need only the first one. The second command occurs only on
  # Mac OS X, and is a $DSYMUTIL invocation that merely extracts debugging
  # information to the file system.
  XCC_CREATESHARED=`echo "$XCC_CREATESHARED" | sed -e 's/~.*//'`
  if test "$CC_set" = set
  then CC=$CC_save
  else unset CC
  fi
  test "${verbose}" = true -o "${verbose}" = yes && \
    echo "XCC_CREATESHARED = ${XCC_CREATESHARED}" >&2
fi

if [ "${with_debug}" != no ] ; then
  if [ $TSYS = sun4 -a $XCC_GCC = true ] ; then
    XCFLAGS=$XCFLAGS' -gstabs'
  elif [ ${HSYS} != "win32msvc" ]; then
    XCFLAGS=$XCFLAGS' -ggdb -O0'
  fi
  XCFLAGS=$XCFLAGS' -DDEBUG_OS_ERROR -DDEBUG_SPVW -DDEBUG_BYTECODE -DSAFETY=3'
  case "$CC" in
    *"g++"* ) XCFLAGS=$XCFLAGS' -DDEBUG_GCSAFETY'; ;;
  esac
fi

if [ $CC_CPLUSPLUS = true -a \( ${HSYSOS} = win32gcc -o ${HSYSOS} = cygwin \) ]
then # This is necessary for g++ to handle w32shell.c:
  # The member lpVtbl is not defined by the w32api include files if
  #   defined(__cplusplus) && !defined(CINTERFACE)
  # cf <http://article.gmane.org/gmane.comp.gnu.mingw.user/8213>
  #    <https://sourceforge.net/p/mingw/mailman/message/14900754/>
  XCFLAGS=$XCFLAGS' -DCINTERFACE'
fi

if [ "$cpu" = i386 -a "$TSYSOS" = "sunos" ] ; then # Solaris 2
  XCFLAGS=$XCFLAGS'' # maybe add -DUSL
fi

# uname -r may contain arbitrary junk not suitable for pathnames:
# cygwin: 1.5.18(0.132/4/2)
UNAME_R=`uname -r | $tolower | sed 's/[^A-Za-z0-9.].*//'`

if [ "${enable_mmap}" = no ]; then
  XCFLAGS=${XCFLAGS}" -DNO_SINGLEMAP -DNO_TRIVIALMAP"
fi

# When to define BINARY_DISTRIB?
# There is no general pro or cons of distributing an executable versus a
# static library, except for the unavailability of the compiler and linker
# on some platforms.
# Other than that, it mostly depends on whether the host you are building
# on has a recent or an old set of system shared libraries. Old is better
# here, since vendors usually only add functions to libc and rarely remove
# some functions. If the host you use for the build is not the oldest OS
# version, then distributing the static library is better: when you distribute
# a Unix executable, it is _certain_ to not run on older versions of the OS
# (thanks to the shared library versioning check), whereas when you distribute
# a static library, it has good chances to link and work fine on older versions
# of the OS.
# So the general rule is:
#   IF platform frequently comes without compiler and linker
#     THEN use BINARY_DISTRIB
#     ELSE
#       IF platform has strict libc version checking
#         THEN use static library distribution
#         ELSE use BINARY_DISTRIB
# cf <http://article.gmane.org/gmane.lisp.clisp.devel:10411>
#    <https://sourceforge.net/p/clisp/mailman/message/12562837/>
if [ $CROSS = false ] ; then
  case "$host_os" in
    solaris*)
      # Newer versions of Solaris (Solaris 2.2 and newer) don't have
      # libdl_stubs.a any more. This means that you cannot link -static !
      XCLFLAGS=`echol "$XCLFLAGS" | sed -e 's/-B*static//g'`
      SOLARIS_LINKING=1 # Even more hacks needed??
      BINARY_DISTRIB=1
    ;;
    hpux*)
      # Newer versions of HP-UX (HP-UX 10.20 and HP-UX 11) ship with no ANSI C
      # compiler, only with K&R "cc" whose only use may be to bootstrap gcc.
      BINARY_DISTRIB=1
    ;;
    darwin*)
      # Douglas Philips <dgou@mac.com>:
      # Mac OS/X does not come with developer tools
      BINARY_DISTRIB=1; ;;
  esac
fi
test -n "$BINARY_DISTRIB" && XCFLAGS=$XCFLAGS' -DUNIX_BINARY_DISTRIB'


# Handle --enable-portability:
# --enable-portability disables several optimizations.
# --disable-portability allows these optimizations.
# The default is to allow those optimizations that we have tested to work fine,
# on a per-platform basis.
if [ "${enable_portability}" = no ]; then
  :
else
  if [ "${enable_portability}" != yes ]; then
    case "$host_os--$host_cpu_c_abi" in
      # Sort order: Keep this list sorted by
      #   1. word size (32-bit before 64-bit),
      #   2. operating system (Linux, *BSD, Mac OS X, proprietary Unices, Windows)
      #   3. CPU and ABI (alphabetically, x86_64 mapping to amd64, like in
      #      lispbibl.d and Makefile.devel)

      # 32-bit platforms

      # Linux/x86_64 with 32-bit x32 ABI
      linux*--x86_64-x32)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/arm
      linux*--arm | linux*--armhf)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/hppa
      linux*--hppa)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/i386
      linux*--i386)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/m68k
      linux*--m68k)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/mipseb and Linux/mipsel with o32 ABI
      linux*--mips)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/mips64eb and Linux/mips64el with n32 ABI
      linux*--mipsn32)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/powerpc64 with 32-bit ABI
      linux*--powerpc)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/s390x with 32-bit ABI
      linux*--s390)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/sparc64 with 32-bit ABI
      linux*--sparc)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Hurd/i386
      gnu*--i386)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # FreeBSD/i386
      freebsd*--i386)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # GNU/kFreeBSD/i386
      kfreebsd*-gnu*--i386)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # DragonFly/i386
      dragonfly*--i386)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # NetBSD/i386
      netbsd*--i386)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # NetBSD/sparc
      netbsd*--sparc)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # OpenBSD/i386
      openbsd*--i386)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Mac OS X/x86_64 with 32-bit ABI
      darwin*--i386)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Mac OS X/PowerPC
      darwin*--powerpc)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # AIX/POWER with 32-bit ABI
      aix*--powerpc)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # HP-UX/hppa with 32-bit ABI
      hpux*--hppa)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # HP-UX/ia64 with 32-bit ABI
      hpux*--ia64-ilp32)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # IRIX 6.5 with o32 ABI
      irix*--mips)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # IRIX 6.5 with n32 ABI
      irix*--mipsn32)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Solaris 10/x86_64 with 32-bit ABI
      solaris2.10--i386)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Solaris 11/x86_64 with 32-bit ABI
      solaris2.11--i386)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Solaris 10/sparc64 with 32-bit ABI
      solaris2.10--sparc)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Haiku (32-bit)
      haiku*--i386) # TODO
        XCFLAGS="$XCFLAGS -DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM"
        XCFLAGS="$XCFLAGS -DNO_FAST_DISPATCH"
        XCFLAGS="$XCFLAGS -DNO_FAST_FLOAT -DNO_FAST_DOUBLE"
        XCFLAGS="$XCFLAGS -DNO_ALLOCA"
        XCFLAGS="$XCFLAGS -DNO_ADDRESS_SPACE_ASSUMPTIONS"
        XCFLAGS="$XCFLAGS -DNO_GENERATIONAL_GC"
        XCFLAGS="$XCFLAGS -DNO_SYMBOLFLAGS"
        ;;

      # Minix/i386
      minix*--i386)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Cygwin, running on Windows 10 (64-bit)
      cygwin--i386) # TODO
        XCFLAGS="$XCFLAGS -DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM"
        XCFLAGS="$XCFLAGS -DNO_FAST_DISPATCH"
        XCFLAGS="$XCFLAGS -DNO_FAST_FLOAT -DNO_FAST_DOUBLE"
        XCFLAGS="$XCFLAGS -DNO_ALLOCA"
        XCFLAGS="$XCFLAGS -DNO_ADDRESS_SPACE_ASSUMPTIONS"
        XCFLAGS="$XCFLAGS -DNO_GENERATIONAL_GC"
        XCFLAGS="$XCFLAGS -DNO_SYMBOLFLAGS"
        ;;

      # mingw, running on Windows 10 (64-bit)
      mingw*--i386) # TODO
        XCFLAGS="$XCFLAGS -DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM"
        XCFLAGS="$XCFLAGS -DNO_FAST_DISPATCH"
        XCFLAGS="$XCFLAGS -DNO_FAST_FLOAT -DNO_FAST_DOUBLE"
        XCFLAGS="$XCFLAGS -DNO_ALLOCA"
        XCFLAGS="$XCFLAGS -DNO_ADDRESS_SPACE_ASSUMPTIONS"
        XCFLAGS="$XCFLAGS -DNO_GENERATIONAL_GC"
        XCFLAGS="$XCFLAGS -DNO_SYMBOLFLAGS"
        ;;

      # 64-bit platforms

      # Linux/x86_64
      linux*--x86_64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/arm64
      linux*--arm64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/alpha
      linux*--alpha)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/ia64
      linux*--ia64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/mips64eb and Linux/mips64el with 64-bit ABI
      linux*--mips64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/powerpc64
      linux*--powerpc64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/powerpc64le
      linux*--powerpc64-elfv2)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/s390x
      linux*--s390x)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Linux/sparc64
      linux*--sparc64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # FreeBSD/x86_64
      freebsd*--x86_64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # GNU/kFreeBSD/x86_64
      kfreebsd*-gnu*--x86_64)
        XCFLAGS="$XCFLAGS -DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM"
        ;;

      # FreeBSD/arm64
      freebsd*--arm64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # NetBSD/x86_64
      netbsd*--x86_64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # NetBSD/sparc64
      netbsd*--sparc64) # TODO
        XCFLAGS="$XCFLAGS -DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM"
        XCFLAGS="$XCFLAGS -DNO_FAST_DISPATCH"
        XCFLAGS="$XCFLAGS -DNO_FAST_FLOAT -DNO_FAST_DOUBLE"
        XCFLAGS="$XCFLAGS -DNO_ALLOCA"
        XCFLAGS="$XCFLAGS -DNO_ADDRESS_SPACE_ASSUMPTIONS"
        XCFLAGS="$XCFLAGS -DNO_GENERATIONAL_GC"
        XCFLAGS="$XCFLAGS -DNO_SYMBOLFLAGS"
        ;;

      # OpenBSD/x86_64
      openbsd*--x86_64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Mac OS X/x86_64
      darwin*--x86_64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # AIX/POWER with 64-bit ABI
      aix*--powerpc64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # HP-UX/hppa64 with 64-bit ABI
      hpux*--hppa64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # HP-UX/ia64 with 64-bit ABI
      hpux*--ia64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Solaris 10/x86_64
      solaris2.10--x86_64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Solaris 11/x86_64
      solaris2.11--x86_64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Solaris 10/sparc64
      solaris2.10--sparc64)
        XCFLAGS="$XCFLAGS -DNO_ASM"
        ;;

      # Cygwin, running on Windows 10
      cygwin--x86_64) # TODO
        XCFLAGS="$XCFLAGS -DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM"
        XCFLAGS="$XCFLAGS -DNO_FAST_DISPATCH"
        XCFLAGS="$XCFLAGS -DNO_FAST_FLOAT -DNO_FAST_DOUBLE"
        XCFLAGS="$XCFLAGS -DNO_ALLOCA"
        XCFLAGS="$XCFLAGS -DNO_ADDRESS_SPACE_ASSUMPTIONS"
        XCFLAGS="$XCFLAGS -DNO_GENERATIONAL_GC"
        XCFLAGS="$XCFLAGS -DNO_SYMBOLFLAGS"
        ;;

      *) # On unknown platforms, use --enable-portability.
         enable_portability=yes
         ;;
    esac
  fi
  if [ "${enable_portability}" = yes ]; then
    # Do NOT enable -DSAFETY=3 here, because -DSAFETY=3 not only disables some
    # optimizations but also enables some debugging features (STACKCHECKs), which
    # is not in the scope of --enable-portability.
    XCFLAGS="$XCFLAGS -DNO_ASM -DNO_ARI_ASM -DNO_SP_ASM"
    XCFLAGS="$XCFLAGS -DNO_FAST_DISPATCH"
    XCFLAGS="$XCFLAGS -DNO_FAST_FLOAT -DNO_FAST_DOUBLE"
    XCFLAGS="$XCFLAGS -DNO_ALLOCA"
    XCFLAGS="$XCFLAGS -DNO_ADDRESS_SPACE_ASSUMPTIONS"
    XCFLAGS="$XCFLAGS -DNO_GENERATIONAL_GC"
    XCFLAGS="$XCFLAGS -DNO_SYMBOLFLAGS"
  fi
fi


# Other dependencies:

FILES=''

if [ "${with_unicode}" != no ]; then
  XCFLAGS="$XCFLAGS -DENABLE_UNICODE"
fi
if [ "${with_threads}" != no ]; then
  XCFLAGS="$XCFLAGS -DMULTITHREAD -D${with_threads}"
fi
if [ "${with_jitc}" != "" ]; then
  XCFLAGS="$XCFLAGS -DHEAPCODES -DUSE_JITC -D${with_jitc}"
fi

if [ "${with_termcap_ncurses}" = no -o "${LIBTERMCAP}" = "broken" ] ; then
  XCFLAGS=$XCFLAGS' -DNO_TERMCAP_NCURSES'
  LIBTERMCAP=""
fi
if [ "${LIBTERMCAP}" != "broken" -a -n "${LIBTERMCAP}" ]; then
  XCFLAGS=${XCFLAGS}" ${INCTERMCAP}"
  XLDFLAGS=${XLDFLAGS}" ${LIBTERMCAP}"
fi

test "${with_dynamic_ffi}" != no && XCFLAGS="$XCFLAGS -DDYNAMIC_FFI"

test "${with_dynamic_modules}" != no && XCFLAGS="$XCFLAGS -DDYNAMIC_MODULES"

if [ "${with_readline}" = no ]; then
  # --without-readline was supplied
  XCFLAGS=$XCFLAGS' -DNO_READLINE'
else
  FILES='libnoreadline.a '$FILES
  if grep "#undef HAVE_READLINE" config.h >/dev/null 2>&1; then
    # --with-readline was supplied ==> barf when readline is missing
    test "${with_readline}" != ifpossible && \
      fail "configure failed to detect readline"
  else                          # readline is present
    test "${with_dynamic_ffi}" != no && \
      BASE_MODULES=${BASE_MODULES}" readline"
  fi
fi

USE_GETTEXT=''
XCL_GETTEXTLIB=''
if [ "${with_gettext}" = no -o "@USE_NLS@" != yes ]; then
  XCFLAGS=$XCFLAGS' -DNO_GETTEXT'
else
  USE_GETTEXT=yes
  LIBS='@LIBINTL@ '$LIBS
  XCL_GETTEXTLIB=$XCL_GETTEXTLIB' locale'
fi

# For 32-bit builds, determine whether lispbibl.d will enable WIDE_SOFT.
USE_WIDE_SOFT=''
case " ${XCPPFLAGS} ${XCFLAGS} " in
  *" -DWIDE "* | *" -DWIDE_SOFT "* | *" -DNO_ADDRESS_SPACE_ASSUMPTIONS "*)
    USE_WIDE_SOFT=yes
    ;;
esac

GLLIB_A=libgnu.a
# libgnu.a must come _before_ -lws2_32 -lintl &c
LIBS="${GLLIB_A} ${LIBS} ${LIBSOCKET}"
FILES="${GLLIB_A} "${FILES}

FILES='lisp.a '$FILES

CPARTS='        spvw spvwtabf spvwtabs spvwtabo'
CPARTS=$CPARTS' eval control'
CPARTS=$CPARTS' encoding pathname stream'
test $TSYS = master -o $TOS = unix -o $TOS = win32 && CPARTS=$CPARTS' socket'
CPARTS=$CPARTS' io funarg'
CPARTS=$CPARTS' array hashtabl list package record weak sequence'
CPARTS=$CPARTS' charstrg debug error misc time predtype symbol lisparit i18n'
test $TSYS = master -o "${with_dynamic_ffi}" != no && CPARTS=$CPARTS' foreign'
test $TSYS = master -o $TOS = unix && CPARTS=$CPARTS' unixaux'
test $TSYS = master -o $TOS = win32 && CPARTS=$CPARTS' win32aux'
test "${with_threads}" != no && CPARTS=$CPARTS' zthread'
CPARTS=$CPARTS' built'

EVERY_INCLUDES='lispbibl fsubr subr pseudofun constsym constobj constobj_tl '$OS_INCLUDES

EVERY_INCLUDES_C=''
for f in $EVERY_INCLUDES ; do
  EVERY_INCLUDES_C=$EVERY_INCLUDES_C' '$f'.c'
done

# on UNIX and MINGW PACKAGE_* (and OS capabilities!) is in config.h,
# otherwise PACKAGE_* is in version.h and OS capabilities are in win32.c
if [ ${TOS} = unix -o ${HSYS} = win32gcc ]; then
  EVERY_INCLUDES_H=' config.h'
  SPVW_VERSION=''
else
  EVERY_INCLUDES_H=''
  SPVW_VERSION=version.h
fi

OTHER_INCLUDES=' constpack avl sort bytecode'

SPVW_INCLUDES=' spvw_module spvw_debug spvw_alloca spvw_mmap spvw_singlemap spvw_page spvw_heap spvw_heap_old spvw_global spvw_global_old spvw_gcstat spvw_space spvw_mark spvw_objsize spvw_update spvw_fault spvw_fault_old spvw_sigsegv spvw_sigcld spvw_sigpipe spvw_sigint spvw_sigwinch spvw_sigterm spvw_garcol spvw_garcol_old spvw_genera1 spvw_genera1_old spvw_gcmark spvw_genera2 spvw_weak spvw_genera3 spvw_genera3_old spvw_allocate spvw_allocate_old spvw_typealloc spvw_circ spvw_circ_old spvw_walk spvw_ctype spvw_language spvw_memfile'

UNICODE_INCLUDES=''
if [ "${with_unicode}" != no ] ; then
  UNICODE_INCLUDES=$UNICODE_INCLUDES' uni_upcase uni_downcase uni_attribute'
fi

NLS_INCLUDES=''
if [ "${with_unicode}" != no ] ; then
  NLS_INCLUDES=$NLS_INCLUDES' nls_ascii'
  NLS_INCLUDES=$NLS_INCLUDES' nls_iso8859_1 nls_iso8859_2 nls_iso8859_3'
  NLS_INCLUDES=$NLS_INCLUDES' nls_iso8859_4 nls_iso8859_5 nls_iso8859_6'
  NLS_INCLUDES=$NLS_INCLUDES' nls_iso8859_7 nls_iso8859_8 nls_iso8859_9'
  NLS_INCLUDES=$NLS_INCLUDES' nls_iso8859_10 nls_iso8859_13 nls_iso8859_14'
  NLS_INCLUDES=$NLS_INCLUDES' nls_iso8859_15 nls_iso8859_16'
  NLS_INCLUDES=$NLS_INCLUDES' nls_koi8_r nls_koi8_u'
  NLS_INCLUDES=$NLS_INCLUDES' nls_mac_arabic nls_mac_centraleurope'
  NLS_INCLUDES=$NLS_INCLUDES' nls_mac_croatian nls_mac_cyrillic nls_mac_dingbat'
  NLS_INCLUDES=$NLS_INCLUDES' nls_mac_greek nls_mac_hebrew nls_mac_iceland'
  NLS_INCLUDES=$NLS_INCLUDES' nls_mac_roman nls_mac_romania nls_mac_symbol'
  NLS_INCLUDES=$NLS_INCLUDES' nls_mac_thai nls_mac_turkish nls_mac_ukraine'
  NLS_INCLUDES=$NLS_INCLUDES' nls_cp437_ms nls_cp437_ibm nls_cp737 nls_cp775'
  NLS_INCLUDES=$NLS_INCLUDES' nls_cp850 nls_cp852_ms nls_cp852_ibm nls_cp855'
  NLS_INCLUDES=$NLS_INCLUDES' nls_cp857 nls_cp860_ms nls_cp860_ibm nls_cp861_ms'
  NLS_INCLUDES=$NLS_INCLUDES' nls_cp861_ibm nls_cp862_ms nls_cp862_ibm'
  NLS_INCLUDES=$NLS_INCLUDES' nls_cp863_ms nls_cp863_ibm nls_cp864_ms'
  NLS_INCLUDES=$NLS_INCLUDES' nls_cp864_ibm nls_cp865_ms nls_cp865_ibm'
  NLS_INCLUDES=$NLS_INCLUDES' nls_cp866 nls_cp869_ms nls_cp869_ibm nls_cp874_ms'
  NLS_INCLUDES=$NLS_INCLUDES' nls_cp874_ibm'
  NLS_INCLUDES=$NLS_INCLUDES' nls_cp1250 nls_cp1251 nls_cp1252 nls_cp1253'
  NLS_INCLUDES=$NLS_INCLUDES' nls_cp1254 nls_cp1256 nls_cp1257'
  NLS_INCLUDES=$NLS_INCLUDES' nls_hp_roman8'
  NLS_INCLUDES=$NLS_INCLUDES' nls_jisx0201'
fi

if [ -n "${SRCDIR}" ] ; then
  INCLUDES="${UNICODE_INCLUDES}"
  UNICODE_INCLUDES=''
  for i in ${INCLUDES}; do
    UNICODE_INCLUDES="${UNICODE_INCLUDES} ${SRCDIR}${i}"
  done
  INCLUDES="${NLS_INCLUDES}"
  NLS_INCLUDES=''
  for i in ${INCLUDES}; do
    NLS_INCLUDES="${NLS_INCLUDES} ${SRCDIR}${i}"
  done
fi

ERROR_INCLUDES='errunix'
test $TSYS = master -o $TOS = win32 && ERROR_INCLUDES=$ERROR_INCLUDES' errwin32'

LISPARIT_SUBFILES=' aridecl arilev0 arilev1 intelem intlog intplus intcomp intbyte intmal intdiv intgcd int2adic intsqrt intprint intread intserial rational'
LISPARIT_SUBFILES=$LISPARIT_SUBFILES' sfloat ffloat dfloat lfloat flo_konv flo_rest realelem realrand realtran compelem comptran'
LISPARIT_INCLUDES=$LISPARIT_SUBFILES' arilev1c arilev1e arilev1i arilev1dbg'

EXTRA_CPARTS='arilev1_asm_proto noreadline'

DFILES="$CPARTS $EVERY_INCLUDES $OTHER_INCLUDES $SPVW_INCLUDES $ERROR_INCLUDES $LISPARIT_INCLUDES genclisph $EXTRA_CPARTS"

ARI_ASMD=''
ARI_ASMC=''
ARI_ASMS=''
case " ${XCPPFLAGS} ${XCFLAGS} " in
  *" -DNO_ARI_ASM "*) ;;
  *)
    if [ "$cpu" = sparc ] ; then
      ARI_ASMD=$ARI_ASMD' ari_asm_sparc'
      ARI_ASMS=$ARI_ASMS' ari_asm_sparc'
    fi
    if [ "$cpu" = sparc64 ] ; then
      ARI_ASMD=$ARI_ASMD' ari_asm_sparc64'
      ARI_ASMS=$ARI_ASMS' ari_asm_sparc64'
    fi
    if [ "$cpu" = mips -o "$cpu" = mipsn32 ] ; then
      ARI_ASMD=$ARI_ASMD' ari_asm_mips'
      ARI_ASMS=$ARI_ASMS' ari_asm_mips'
    fi
    if [ "$cpu" = mips64 ] ; then
      ARI_ASMD=$ARI_ASMD' ari_asm_mips64'
      ARI_ASMS=$ARI_ASMS' ari_asm_mips64'
    fi
    if [ "$cpu" = i386 ] ; then
      ARI_ASMD=$ARI_ASMD' ari_asm_i386'
      ARI_ASMS=$ARI_ASMS' ari_asm_i386'
    fi
    if [ "$cpu" = hppa ] ; then
      ARI_ASMD=$ARI_ASMD' ari_asm_hppa'
      ARI_ASMS=$ARI_ASMS' ari_asm_hppa'
    fi
    if [ "$cpu" = arm -o "$cpu" = armhf ] ; then
      ARI_ASMD=$ARI_ASMD' ari_asm_arm'
      ARI_ASMS=$ARI_ASMS' ari_asm_arm'
    fi
    ;;
esac

SP_ASMD=''
SP_ASMS=''
case " ${XCPPFLAGS} ${XCFLAGS} " in
  *" -DNO_SP_ASM "*) ;;
  *)
    if [ "$cpu" = m68k ] ; then
      SP_ASMD=$SP_ASMD' sp_asm_m68k'
      SP_ASMS=$SP_ASMS' sp_asm_m68k'
    fi
    if [ "$cpu" = sparc ] ; then
      SP_ASMD=$SP_ASMD" sp_asm_sparc"
      SP_ASMS=$SP_ASMS" sp_asm_sparc"
    fi
    if [ "$cpu" = sparc64 ] ; then
      SP_ASMD=$SP_ASMD" sp_asm_sparc64"
      SP_ASMS=$SP_ASMS" sp_asm_sparc64"
    fi
    if [ "$cpu" = mips -o "$cpu" = mipsn32 -o "$cpu" = mips64 ] ; then
      SP_ASMD=$SP_ASMD' sp_asm_mips'
      SP_ASMS=$SP_ASMS' sp_asm_mips'
    fi
    if [ "$cpu" = i386 ] ; then
      SP_ASMD=$SP_ASMD' sp_asm_i386'
      SP_ASMS=$SP_ASMS' sp_asm_i386'
    fi
    ;;
esac

COMMENTS=''

LPARTS='        init defseq backquote defmacro macros1 macros2 defs1'
test ${TOS} = unix -o ${TOS} = win32 || LPARTS=$LPARTS' timezone'
LPARTS=$LPARTS' lambdalist places floatprint defpackage type subtypep'
LPARTS=$LPARTS' clos-package clos-macros clos-class0 clos-metaobject1'
LPARTS=$LPARTS' clos-slotdef1 clos-stablehash1 clos-specializer1 clos-class1'
LPARTS=$LPARTS' clos-class2 clos-class3 defstruct format'
LPARTS=$LPARTS' international savemem functions trace cmacros compiler'
LPARTS=$LPARTS' defs2 loop clos'
LPARTS=$LPARTS' clos-stablehash2'
LPARTS=$LPARTS' clos-specializer2 clos-specializer3'
LPARTS=$LPARTS' clos-class4 clos-class5 clos-class6'
LPARTS=$LPARTS' clos-slotdef2 clos-slotdef3 clos-slots1 clos-slots2'
LPARTS=$LPARTS' clos-method1 clos-method2 clos-method3 clos-method4'
LPARTS=$LPARTS' clos-methcomb1 clos-methcomb2 clos-methcomb3 clos-methcomb4'
LPARTS=$LPARTS' clos-genfun1 clos-genfun2a clos-genfun2b clos-genfun3 clos-genfun4 clos-genfun5'
LPARTS=$LPARTS' clos-dependent clos-print clos-custom documentation'
LPARTS=$LPARTS' fill-out disassem condition loadform gstream xcharin keyboard'
LPARTS=$LPARTS' screen runprog query reploop dribble complete'
LPARTS=$LPARTS' pprint describe room edit macros3 clhs inspect gray'
test "${with_threads}" = no || LPARTS=$LPARTS' threads'
LPARTS=$LPARTS' case-sensitive'
test $TSYS = master -o "${with_dynamic_ffi}" != no && LPARTS=$LPARTS' foreign1'
LPARTS=$LPARTS' exporting '
test "${with_unicode}" = no -o "${with_gettext}" = no || \
  LPARTS=$LPARTS' german french spanish russian danish dutch'
LPARTS=$LPARTS' deprecated'

TXT_DOCS='LISP-tutorial.txt CLOS-guide.txt'

TXT_FILES='README README.de README.es clisp.c'
test $CROSS = false -a $HOS = unix && TXT_FILES=$TXT_FILES' distmakefile'
MANPAGES="clisp clisp-link"
for f in ${MANPAGES}; do
  TXT_FILES="$TXT_FILES $f.1 $f.html $f-1.html"
done

OBSOLETE=''

# Output the makefile:

# echotab line
# outputs a line, preceding it with a tab. cat is needed to output tabs.
if [ $HSYS != win32msvc ] ; then
echotab () {
cat <<!!
	$1
!!
}
else
# Win32 "nmake" stupidly passes the command lines through `printf', thus
# interpreting % characters.
echotab () {
cmd=`echol "$1" | sed -e 's,%,%%,g'`
cat <<!!
	$cmd
!!
}
fi

# echolist prefix list suffix prefix
# outputs a list of items, prefixed by backslashes and newlines to break long
# lines.
echolist () {
line="$1"
suffix="$3"
prefix="$4"
for f in $2 ; do
  echol $line" \\"
  line="${prefix}${f}${suffix}"
done
echol $line
}

# echodummyrule target
# outputs a dummy rule for the given target.
case "$host_os" in
  aix*) # GNU make on AIX starts an interactive shell for every empty rule
echodummyrule () {
echotab "true"
}
  ;;
  *)
echodummyrule () {
:
}
  ;;
esac

echol "# -*- Makefile -*- for the CLISP binaries"
echol "# DO NOT EDIT! GENERATED AUTOMATICALLY!"
echol "# This file was created on host $hostname as the output of the command:"
echol "# $0$makemake_args"
echol
echol '# -------------- Start of configurable section --------------------'
echol "srcdir = ${srcdir}"
# cannot do this: "Circular ../src/build-aux <- ../src/build-aux dependency dropped."
#echol "VPATH = ${srcdir}"
echol
if [ $TSYS = win32msvc ] ; then
  echol "# Flags that can be set on the nmake command line:"
  echol "#   MFLAGS={-ML|-MT|-MD} for defining the compilation model"
  echol "#     MFLAGS=-ML (the default)  Single-threaded, statically linked - libc.lib"
  echol "#     MFLAGS=-MT                Multi-threaded, statically linked  - libcmt.lib"
  echol "#     MFLAGS=-MD                Multi-threaded, dynamically linked - msvcrt.lib"
  echol '!if !defined(MFLAGS)'
  echol 'MFLAGS='
  echol '!endif'
  echol
fi

PACKAGE_VERSION="@PACKAGE_VERSION@"
VERSION_NUMBER=`echo "${PACKAGE_VERSION}" | sed -e 's, .*,,'`
echol "# The official version number"
echol "PACKAGE_VERSION=${PACKAGE_VERSION}"
echol "VERSION=${VERSION_NUMBER}"
echol "# The official package name"
echol "PACKAGE_NAME=@PACKAGE_NAME@"
echol "# If you want to distribute a modified version of CLISP,"
echol "# use this to distinguish your distribution from the official one."
echol "# This can also be used for pre-test and post-release distributions:"
echol "#   make distrib VERSION_SUFFIX=pre"
echol "VERSION_SUFFIX="
echol "# The distribution's top directory"
echol 'TOPDIR=clisp-$(VERSION)$(VERSION_SUFFIX)'
echol
echol '# Directories used by "make install":'
echol "prefix = ${PREFIX}"
echol "exec_prefix = ${EXEC_PREFIX}"
echol "bindir  = ${BINDIR}"
echol "datarootdir = ${DATAROOTDIR}"
echol "mandir  = ${MANDIR}"
echol "docdir  = ${DOCDIR}"
echol "htmldir = ${HTMLDIR}"
echol "psdir   = ${PSDIR}"
echol "pdfdir  = ${PDFDIR}"
echol "libdir  = ${LIBDIR}"
echol "lisplibdir = \$(libdir)${NEXT_}\$(TOPDIR)"
test -n "$USE_GETTEXT" && echol "localedir = ${LOCALEDIR}"
echol "elispdir = ${ELISPDIR}"
echol "vimdir = ${VIMDIR}"
echol "aclocaldir = ${ACLOCALDIR}"
echol "# The value of following variable is prepended to all the paths for"
echol "# installation. This is useful when preparing a binary distribution."
echol "DESTDIR ="
echol
echol     "# (partial) list of available add-on modules"
echol     "# (see directory modules/ for the full list"
echol     "#  or pass --help-modules to top-level configure):"
echol     "# asdf                 Another System Definition Facility"
echol     "# queens               the queens function (a toy example)"
echol     "# dirkey               the directory access (LDAP, win32 registry)"
echol     "# berkeley-db          the Berkeley DB access"
echol     "# gdbm                 the GNU DataBase manager"
echol     "# rawsock              raw socket access"
echol     "# pcre                 Perl-compatible regular expressions"
if [ "${with_dynamic_ffi}" != no ]; then
  echol   "# libsvm               build Support Vector Machine models"
  echol   "# postgresql           interface to PostgreSQL ODBMS"
  echol   "# fastcgi              FastCGI (http://www.fastcgi.com/) interface"
  echol   "# oracle               Oracle (http://www.oracle.com/) interface"
  echol   "# netica               Netica (http://norsys.com/netica_c_api.htm)"
  echol   "# pari                 PARI/gp (http://pari.math.u-bordeaux.fr/)"
  echol   "# zlib                 ZLIB (http://www.zlib.org)"
  test "$cpu" = i386 -a "$TSYSOS" = linux && \
    echol "# bindings/glibc       Linux glibc bindings (GNU libc version 2)"
  test "$cpu" = i386 -a \( "$TSYSOS" = win32gcc -o "$TSYSOS" = cygwin \) && \
    echol "# bindings/win32       win32 bindings"
  echol   "# gtk2                 GTK2 interface"
fi
test $TOS = unix -o $TOS = win32 && \
  echol   "# clx/mit-clx          classical X11 interface"
test $TOS = unix && \
  echol   "# clx/new-clx          faster X11 interface (replaces clx/mit-clx)"
echol "MODULES = ${MODULES}"
echol
echol "# Command line options passed to the configure files of add-on modules"
echol "MODULE_CONFIGURE_FLAGS = ${module_configure_flags}"
echol
echol '# Programs used by "make":'
if [ $CROSS = true ] ; then
  echol "CC = ${CC}"
  echol "CPPFLAGS = ${CPPFLAGS}"
  echol "CFLAGS = ${CFLAGS}"
  echol "CLFLAGS = ${CLFLAGS}"
  echol "CPP = ${CPP}"
  echol "XCC = ${XCC}"
  echol "XCPPFLAGS = ${XCPPFLAGS}"
  echol "XCFLAGS = ${XCFLAGS}"
  echol "XCPP = ${XCPP}"
  echol "XCLFLAGS = ${XCLFLAGS}"
  echol "XLIBS = ${LIBS}"
  XCC="\$(XCC)"
  XCPPFLAGS="\$(XCPPFLAGS)"
  XCFLAGS="\$(XCFLAGS)"
  XCPP="\$(XCPP)"
  XCLFLAGS="\$(XCLFLAGS)"
  LIBS="\$(XLIBS)"
else
  echol "CC = ${XCC}"
  echol "CPPFLAGS = ${XCPPFLAGS}"
  echol "CFLAGS = ${XCFLAGS}"
  echol "CPP = ${XCPP}"
  echol "CLFLAGS = ${XCLFLAGS}"
  echol "LIBS = ${LIBS}"
  XCC="\$(CC)"
  XCPPFLAGS="\$(CPPFLAGS)"
  XCFLAGS="\$(CFLAGS)"
  XCPP="\$(CPP)"
  XCLFLAGS="\$(CLFLAGS)"
  LIBS="\$(LIBS)"
fi
echol "X_LIBS = ${X_LIBS}"
X_LIBS="\$(X_LIBS)"
echol "FALIGNFLAGS = ${FALIGNFLAGS}"
FALIGNFLAGS="\$(FALIGNFLAGS)"
echol "LD = ${LD}"
LD="\$(LD)"
echol 'MODULE_CPPFLAGS = $(CPPFLAGS)' # this includes ${GNULIB_INCLUDE}
if [ "${with_dynamic_modules}" != no ]; then
  echol 'MODULE_CFLAGS = $(CFLAGS) '"${XCC_PICFLAG}"
  echol 'MODULE_CLFLAGS = $(CLFLAGS) '"${EXPORT_DYNAMIC_FLAG_SPEC}"
  MODULE_CFLAGS_VAR='MODULE_CFLAGS'
  MODULE_CLFLAGS_VAR='MODULE_CLFLAGS'
  XCLFLAGS="\$(MODULE_CLFLAGS)"
else
  MODULE_CFLAGS_VAR='CFLAGS'
  MODULE_CLFLAGS_VAR='CLFLAGS'
fi
if [ $HSYS = win32msvc ] ; then
  echol "#MSVCDIR = d:/msdev"
  echol "#MSVCDIR = d:/devstudio/vc"
  echol "#MSVCDIR = c:/msvs/vc98"
  echol "#MSVCDIR = \"C:/Program Files/Microsoft Visual Studio/VC98\""
  echol '#MSVCDIR = "C:\Programme\Microsoft Visual Studio\VC98"'
fi
# echotab_to_HEXE command source target
# outputs a `make' statement that executes "command source" and creates
# target${HEXE}.
if [ $HSYS != win32msvc ] ; then
  echotab_to_HEXE () {
    echotab "$1 $2 -o $3${HEXE}"
  }
else
  echotab_to_HEXE () {
    echotab "$1 $2 /Fe$3${HEXE}"
  }
fi
echol
if [ $HOS = win32 -a $HSYS != win32gcc ] ; then
  if [ $HSYS = win32msvc ] ; then
    echol "MAKE = nmake"
  else
    echol "MAKE = amake"
  fi
  echol "RM = -${RM}"
  echol "RMRF = -${RMRF}"
  echol "TOUCH = -${TOUCH}"
else
  SET_MAKE="@SET_MAKE@"
  test -n "${SET_MAKE}" && echol "${SET_MAKE}"
  echol "RM = ${RM}"
  echol "RMRF = ${RMRF}"
  echol "TOUCH = ${TOUCH}"
fi
echol "CP = ${CP}"
echol "LN_S = ${LN_S}"
echol "MV = ${MV}"
echol "CAT = ${CAT}"
echol "GREP = ${GREP}"
echol "SED = ${SED}"
echol "AR = ${AR}"
echol "RANLIB = ${RANLIB}"
echol
echol '# Programs used by "make install":'
echol "INSTALL = ${INSTALL}"
echol "INSTALL_PROGRAM = ${INSTALL_PROGRAM}"
echol "INSTALL_SCRIPT = ${INSTALL_SCRIPT}"
echol "INSTALL_DATA = ${INSTALL_DATA}"
echol
echol '# Programs used by "make distrib":'
echol
# Auxiliary routines for linking lisp.a:
if [ $HOS = unix -a $XCC_GCC = true ] ; then
  # We need the full libgcc.a in general. But we don't know its location.
  LIBGCC='`'"${XCC} -print-libgcc-file-name"'` # something like /usr/somewhere/libgcc.a'
  if [ $CROSS = false ] ; then
    if [ "$HSYSOS" = linux -o "$HSYSOS" = beos -o "$HSYSOS" = cygwin ] ; then
      # gcc2 is cc on Linux, BeOS and Cygwin. Don't need libgcc.a
      LIBGCC=''
    fi
  fi
else
  LIBGCC=''
fi
test -n "$LIBGCC" && echol "LIBGCC = ${LIBGCC}"
if test -n "$GROFF"; then
  ROFF_MAN="$GROFF -Tascii -mandoc"
  ROFF_PS="$GROFF -Tps -mandoc"
else
  ROFF_MAN="nroff -man"
  if [ $HSYS = sun4 -a $CROSS = false ] ; then
    if [ "$UNAME_S" = sunos ] ; then
      case "$UNAME_R" in 4*)
        # SunOS 4
        ROFF_MAN="nroff -a -man" ;;
      esac
    fi
  fi
fi
echol '# formatter for manual page'
echol "ROFF_MAN = ${ROFF_MAN}"' # try "groff -Tascii -mandoc" or "nroff -man"'
if test -n "$GROFF"; then
  echol "ROFF_PS  = ${ROFF_PS}"' # try "groff -Tps -mandoc"'
  test -n "$PS2PDF" && echol "PS2PDF = ${PS2PDF}"
fi
echol
echol '# -------------- End of configurable section --------------------'
echol
cat <<\!!
#
#                       Requirements for add-on modules
#                       -------------------------------
#
# The general layout of add-on modules is described in
#  <http://clisp.org/impnotes/modules.html>.
# The requirements made there (i.e. the existence of a "link.sh" file
# which defines certain variables) make sure that such an add-on module
# can be distributed with CLISP.
#
# If you want an add-on module to be _built_ automatically with CLISP,
# the following additional requirements have to be obeyed.
#
# 1. The module must be located in a subdirectory of clisp's build
#    directory.
#    Examples: clisp/build/regexp/
#              clisp/build/bindings/glibc/
#
# 2. If the module contains a file called "configure", it is assumed
#    to be a GNU autoconf generated configuration file, and is called
#    with a "--cache-file=..." argument. It should generate platform
#    dependent header files, Makefiles and the like.
#
# 3. The module should contain a Makefile (maybe generated by requirement 2),
#    which defines the following targets:
#
#     clisp-module
#
#      This target builds the file(s) mentioned by the link.sh file.
#      The following makefile variables can be used:
#        CC        the C compiler used to compile the CLISP source
#        CPPFLAGS  the C compiler flags when compiling some source
#        CFLAGS    the C compiler flags
#        CLFLAGS   the C compiler flags when linking an executable
#        LIBS      the libraries used when linking an executable
#        RANLIB    the name of the "ranlib" command
#        CLISP     a command which calls the already built "boot" clisp.
#        CLISP_LINKKIT  the directory containing the CLISP header file clisp.h
#                       (defaults to $$($(CLISP) -b)/linkkit)
#        SHREXT    the shared object extension (.so or .dll)
#      Typically, you will have rules like this in your Makefile:
#        foo.o : foo.c
#                $(CC) $(CPPFLAGS) $(CFLAGS) -I$(CLISP_LINKKIT) -c foo.c
#        foo.fas : foo.lisp
#                $(CLISP) -c foo.lisp
#
#     clisp-module-distrib
#
#      This target copies the module into a temporary distribution
#      directory, on the same disk.
#      The following makefile variables can be used:
#        distribdir  the name of temporary distribution directory
#        LN          command to make hard links (works also for symbolic links)
#      Typically, this target will look like this:
#        DISTRIBFILES = <the NEW_FILES mentioned in link.sh> <doc files>
#        clisp-module-distrib : clisp-module force
#               $(LN) $(DISTRIBFILES) $(distribdir)
#
# If these requirements are obeyed, this Makefile will automatically build
# the add-on module and make it part of the "full" distribution -- all you
# need to do is to add its name to the MODULES definition line above.
#
!!
echol
if [ $HOS = unix ] ; then
  # On some systems (IRIX SVR3 and others) the default shell is csh.
  # The sh and ksh on HP-UX 10 have severe bugs that cause
  #   1. Most invocations of lisp.run crash like this (from HP-UX make):
  #        ./lisp.run ...
  #        /bin/sh: 18546 Bus error
  #      or like this (from GNU make):
  #        ./lisp.run ...
  #        *** Termination signal 11
  #   2. A command such as  'grep -v "^ *$$"'  to be executed incorrectly.
  # As a workaround, we use GNU bash instead.
  case "$host_os" in
    hpux*) echol "SHELL = "`which bash` ;;
    *)     echol "SHELL = ${CONFIG_SHELL-/bin/sh}" ;;
  esac
  echol
fi
echol "# Add-on modules that are present in all linking sets (including base)"
echol "# syscalls             export some POSIX (and other) system calls"
echol "# regexp               POSIX regular expressions"
echol "# i18n                 Lisp program internationalization"
echol "# readline             extra fine REPL controls"
echol "BASE_MODULES = ${BASE_MODULES}"
echol
echol "COMMENT5 = ${HERE}comment5"

if "$XCC_SUNPRO" ; then
  XASM_NEED_CCPAUX=true
else
  XASM_NEED_CCPAUX=false
fi

if [ $XASM_NEED_CCPAUX = true ] ; then
  NEED_CCPAUX=true
else
  NEED_CCPAUX=false
fi
XDECL_FILTER="| \$(GCTRIGGER) | \$(VARBRACE)"
XDECL_DEPENDENCIES=" gctrigger${HEXE} varbrace${HEXE}"

echol "GCTRIGGER = ${HERE}gctrigger"
echol "VARBRACE = ${HERE}varbrace"
if [ $XASM_NEED_CCPAUX = true ] ; then
  XASMCCPAUX='ccpaux'$HEXE
  XASMCCPAUX_FILTER=' | '$HERE'ccpaux'
else
  XASMCCPAUX=''
  XASMCCPAUX_FILTER=''
fi
if [ $XCC_NEED_DEEMA = true ] ; then
  if [ $HOS = unix ] ; then
    echol "DEEMA = sed -e 's/, *)/,_EMA_)/g' -e 's/, *,/,_EMA_,/g'"
  else
    echol "DEEMA = deema"
    XDECL_DEPENDENCIES="${XDECL_DEPENDENCIES} deema${HEXE}"
  fi
  XDECL_FILTER="${XDECL_FILTER} | \$(DEEMA)"
fi

if [ -n "${SRCDIR}" ] ; then
  TXT2CINCL="-I${SRCDIR}"
else
  TXT2CINCL=""
fi
echol "TXT2C = ${HERE}txt2c ${TXT2CINCL}"
if [ $CROSS = true ] ; then
  TXT2CFLAGS="${TXT2CFLAGS} -DCROSS"
  TXT_INCLUDES=' lispbibl.h'
else
  TXT2CFLAGS="${TXT2CFLAGS}"
  TXT_INCLUDES="${EVERY_INCLUDES_C}${EVERY_INCLUDES_H}"
fi

echol

echolist "CFILES =" "$DFILES $ARI_ASMD $ARI_ASMC $SP_ASMD gen.lispbibl" ".c"
echol

echolist "OBJECTS =" "$CPARTS $ARI_ASMS $SP_ASMS $GMALLOC" "${TOBJ}"
echol

echolist "LISPFILES =" "$LPARTS" ".lisp" "${SRCDIR}"
echol

echolist "FASFILES =" "$LPARTS config" ".fas"
echol

echolist "TXTFILES =" "$TXT_DOCS" ""
echol

echolist "TESTFASFILES =" "$LPARTS config" ".fas" "${RECOMPILEDIR}${NEXT_M}"
echol

echol

SUBDIRS=gllib
needs="gllib/libgnu.a init allc allo lisp${LEXE} marc.out interpreted.mem halfcompiled.mem lispinit.mem manual"
if [ \( $HOS = unix -o ${HSYS} = win32gcc \) -a $CROSS = false ] ; then
  needs=".gdbinit "$needs' modular $(BASE_MODULES) $(MODULES) '"clisp${TEXE} boot base full"
fi
if [ $TSYS = win32msvc -a "${with_debug}" != no ] ; then
  needs=$needs" lisp.bsc"
fi
echol "all : $needs"
echodummyrule all
echol
echol "SUBDIRS = ${SUBDIRS}"
echol '.PHONY: subdirs clean0 clean1 clean2 clean3 clean4 clean5 clean6 clean7 clean8 mostlyclean distclean clean maintainer-clean clean-modules am--refresh'
echol
echol 'subdirs: gllib/libgnu.a'
echol
# gnulib cannot be compiled with C++, thus NO_CXX
echol 'SUBDIR_CFLAGS = $(CFLAGS) '"${XCC_PICFLAG} @NO_CXX@"
echol 'gllib/libgnu.a: config.status build-aux'
echotab 'mkdir -p gllib'
echotab 'test -f gllib/Makefile || sh config.status gllib/Makefile depfiles'
top_srcdir=`cd "${SRCDIR}"; pwd`
echotab 'cd gllib && $(MAKE) CFLAGS="$(SUBDIR_CFLAGS)" top_srcdir="'"${top_srcdir}"'"'
echol
echol "${GLLIB_A}: gllib/libgnu.a"
echotab "test -r ${GLLIB_A} || \$(LN_S) gllib/${GLLIB_A} ${GLLIB_A}"
echol

# in the toplevel Makefile.devel, makemake depends also on version.sh.
# we do not need that here because makemake depends on config.status -
# depends on src/configure - depends on version.sh in Makefile.devel
echol "makemake : ${SRCDIR}makemake.in config.status"
echotab "sh config.status --file=makemake"
echol
echol "config.h : ${SRCDIR}config.h.in config.status"
echotab "sh config.status --header=config.h"
# when config.status detects that it did not change config.h, it
# will not touch it, and on the next make config.h will be remade
# again and again ... - avoid it
echotab "touch config.h"
echol
echol "Makefile : makemake"
echotab "$0$makemake_args > Makefile.tmp"
echotab "\$(MV) Makefile Makefile~"
echotab "\$(MV) Makefile.tmp Makefile"
OBSOLETE="$OBSOLETE Makefile~"
echol
echol "config.status : ${SRCDIR}configure"
echotab "\$(RMRF) config.cache \$(SUBDIRS)"
echotab "sh config.status --recheck"
echol
echol "libtool : @LIBTOOL_DEPS@"
echotab "sh config.status --recheck"
echol
echol "am--refresh : config.status Makefile config.h"
echol

if [ $TSYS = win32msvc ] ; then
  # quote for command arguments when they are unnecessary on DOS
  ARGQ=""
  # .. when they are mandatory
  ARGQ1="\""
  # quotes to pass to a command escaped
  QQUOT="\\\""
else
  ARGQ="'"
  ARGQ1="'"
  QQUOT="\""
fi

# cf. ac_precious_vars in configure
PRECIOUS_VARS='CC CFLAGS LDFLAGS CLFLAGS LIBS CPPFLAGS CPP CXX CXXFLAGS X_LIBS'
# Do not touch cflags.h when the changes to Makefile do not modify it.
# Cost: maybe a few extra "echo"s on each make
# Benefit: lispinit.mem is not re-dumped when we add something to MODULES
echol "cflags.h : cflags.h.stamp"
echodummyrule "cflags.h"
echol
echol "cflags.h.stamp : Makefile"
echotab "echo $ARGQ/* generated from Makefile */$ARGQ > cflags.h.new"
for x in ${PRECIOUS_VARS}; do
  echotab "echo $ARGQ#define $x \"\$($x)\"$ARGQ >> cflags.h.new"
done
if [ $TSYS = win32msvc ] ; then
  echotab '$(RM) cflags.h'
  echotab '$(MV) cflags.h.new cflags.h'
else
  echotab 'if cmp cflags.h.new cflags.h > /dev/null 2>&1; then $(RM) cflags.h.new; else $(MV) cflags.h.new cflags.h; fi'
fi
echotab '$(TOUCH) cflags.h.stamp'
echol

UTILS=''
test $NEED_CCPAUX = true && UTILS=$UTILS' ccpaux'
UTILS=$UTILS' comment5'
UTILS=$UTILS' gctrigger'
UTILS=$UTILS' varbrace'
test $XCC_NEED_DEEMA = true -a $HOS != unix && UTILS=$UTILS' deema'
UTILS=$UTILS' txt2c'
UTILS=$UTILS' ccmp2c' # needed by clx module
LUTILS='modprep'

PARAMS="intparam floatparam"
PARAMS_H=""
line="init :"
for parf in ${PARAMS}; do
  test ${TOS} != win32 && line=$line" "${parf}.h
  PARAMS_H=${PARAMS_H}" "${parf}.h
done
test $CROSS = true && line=$line" config.h"
for util in ${UTILS} ; do line=$line" ${util}${HEXE}"; done
line=$line" modules.h"
echol $line
echodummyrule init
echol
for parf in ${PARAMS}; do
  if [ $CROSS = true ]; then
    # everything is in config.h
    echol "${parf}.h : ${SRCDIR}${parf}.c config.h"
    echotab '$(TOUCH) '"${parf}.h"
  else
    echol "${parf}.h : ${SRCDIR}${parf}.c config.h"
    echotab "{ echo '#include \"config.h\"' && cat '${SRCDIR}${parf}.c'; } > gen-${parf}.c"
    echotab_to_HEXE "\$(CC)" "gen-${parf}.c" "${parf}"
    echotab "${HERE}${parf}${HEXE} ${parf}.h"
    echotab "\$($EXERM) $(exefiles ${parf}) gen-${parf}.c"
  fi
  echol
done
for util in ${UTILS} ; do
  echol "${util}${HEXE} : ${UTILDIR_M}${util}.c ${GLLIB_A}"
  echotab_to_HEXE "${UTILCOMPILE} -I." "${UTILDIR_CC}${util}.c ${GLLIB_A}" "${util}"
  echol
done

echol

echol "modules.h :"
echotab "touch modules.h"
echol

if [ -n "${SRCDIR}" ] ; then
  if [ ${HSYS} = win32gcc ] ; then
    # install.lisp requires dirkey module which is built by mingw but not msvc
    for f in install.lisp install.bat ; do
      link_dep "${f}" "${SRCDIR}${f}"
    done
  fi
fi

if [ ${HOS} = win32 ]; then
  for f in env_var_update.nsh is_user_admin.nsh; do
    link_dep "${f}" "${SRCTOPDIR_}win32msvc/nsis/${f}"
  done
  echol "install.nsi : ${SRCTOPDIR_}win32msvc/nsis/install.nsi config.status"
  # comma used as separator in patterns below to allow embedded
  # slashes in module names (e.g., bindings/win32)
  echotab "sed -e 's/\@NAME\@/\$(PACKAGE_NAME)/g' -e 's/\@VERSION\@/\$(VERSION)/g' -e 's,\@BASE_MODULES\@,\$(BASE_MODULES),g' -e 's,\@MODULES\@,\$(MODULES),g' ${SRCTOPDIR_}win32msvc/nsis/install.nsi > install.nsi"
  echol
  echol "COPYRIGHT.rtf : COPYRIGHT ${SRCTOPDIR_}win32msvc/nsis/text_to_rtf.lisp config.status"
  echotab "\$(RUN) -M lispinit.mem -q ${SRCTOPDIR_}win32msvc/nsis/text_to_rtf.lisp COPYRIGHT COPYRIGHT.tmp"
  echotab "sed -e 's/\@NAME\@/\$(PACKAGE_NAME)/g' -e 's/\@VERSION\@/\$(VERSION)/g' COPYRIGHT.tmp > COPYRIGHT.rtf"
  echotab '$(RM) COPYRIGHT.tmp'
  echol
fi

echol "allc : init \$(CFILES)"
echodummyrule allc
echol

for f in $DFILES ; do
  echol "${f}.c : ${SRCDIR}${f}.d comment5${HEXE}${XDECL_DEPENDENCIES}"
  gen_filter=
  case "${f}" in
    lispbibl) gen_filter=" | sed -e 's/^\\(%% .*\\)//'" ;;
  esac
  echotab "\$(COMMENT5) ${SRCDIR}${f}.d${gen_filter} ${XDECL_FILTER} > ${f}.c"
  echol
done

for f in $ARI_ASMD $SP_ASMD ; do
  echol "${f}.c : ${SRCDIR}${f}.d comment5${HEXE} ${XASMCCPAUX}"
  echotab "\$(COMMENT5) ${SRCDIR}${f}.d${XASMCCPAUX_FILTER} > ${f}.c"
  echol
done

if [ $TSYS != win32msvc ] ; then
  if [ $AS_UNDERSCORE = true ] ; then
    ASMFLAGS=' -DASM_UNDERSCORE'
  else
    ASMFLAGS=''
  fi
  # The assembly-language syntax processing is CPU specific.
  # Makefile.devel uses asm-${asmsyntax}.sh and asm-${asmsyntax}.h (if present).
  # Keep this computation of asmsyntax consistent with Makefile.devel!
  case "$cpu" in
    arm | armhf | arm64)
      asmsyntax=arm ;;
    mips | mipsn32 | mips64)
      asmsyntax=mips ;;
    powerpc | powerpc64 | powerpc64-elfv2)
      asmsyntax=powerpc ;;
    s390 | s390x)
      asmsyntax=s390 ;;
    sparc | sparc64)
      asmsyntax=sparc ;;
    *)
      asmsyntax="$cpu" ;;
  esac
  for f in $ARI_ASMS $SP_ASMS ; do
    # The preprocessor barfs on ari_asm_hppa: "unterminated character constant".
    # This gets ignored, because it occurs in a pipe.
    echol "${f}.s : ${SRCDIR}${f}-macro.c"
    # Preprocess, then remove the line number information etc. and convert
    # "% ecx" back to "%ecx" and ". align" to ".align" and ". Lxxx" to ".Lxxx":
    if test -n "${SRCDIR}"; then
      i_option="-I${SRCDIR} "
    else
      i_option=''
    fi
    case "$asmsyntax" in
      i386 | x86_64 | sparc)
        # Use "- <" because the Sun Studio 11 compiler should not assume C syntax of the input.
        cpp_from='- < '
        ;;
      *)
        cpp_from=''
        ;;
    esac
    case "$asmsyntax" in
      arm)
        asmfilter2="\$(SED) -e 's,% ,%,g' -e 's,//,@,g' -e 's,\\\$\$,#,g'"
        ;;
      hppa)
        asmfilter2="\$(SED) -e \"s,!,',g\""
        ;;
      i386 | x86_64)
        asmfilter2="\$(SED) -e 's,% ,%,g' -e 's,\\. ,.,g' -e 's,@ ,@,g' -e 's,//.*\$\$,,' -e 's/##//g'"
        ;;
      m68k)
        if [ $AS_UNDERSCORE = true ] ; then
          final_sed_invocation="\$(SED) -e 's/\\\$\$//g'"
        else
          final_sed_invocation="\$(SED) -e 's/\\\$\$/%/g'"
        fi
        asmfilter2="\$(SED) -e 's,% ,%,g' -e 's,//.*\$\$,,' | ${final_sed_invocation}"
        ;;
      sparc)
        asmfilter2="\$(SED) -e 's,% ,%,g' -e 's,\\. ,.,g' -e 's,//.*\$\$,,' -e 's,\\\$\$,#,g' -e 's,# ,#,g'"
        ;;
      *)
        asmfilter2="\$(SED) -e 's,% ,%,g' -e 's,//.*\$\$,,'"
        ;;
    esac
    echotab "${XCPP}${ASMFLAGS} ${i_option}${cpp_from}${SRCDIR}${f}-macro.c | \$(GREP) -v '^ *#line' | \$(GREP) -v '^#' | ${asmfilter2} > ${f}.s"
    echol
  done
fi

for f in lispbibl; do
  echol "gen.${f}.c : ${SRCDIR}${f}.d comment5${HEXE}"
  echotab "\$(COMMENT5) ${SRCDIR}${f}.d | sed -e '/^%% /{s///;p;d;}' -e '/^#line /!s/.*//' | sed -e 's/puts(/fprintf(header_f,\"%s\\\\n\",/g' -e 's/print(\"/fprint(header_f,\"/g' -e 's/printf(\"/fprintf(header_f,\"/g' > gen.${f}.c"
  echol
done

line="allo : allc"
for f in $CPARTS ; do
  line=$line" ${f}${TOBJ}"
done
echol $line
echodummyrule allo
echol

line="alls : allc"
for f in $CPARTS ; do
  line=$line" ${f}.s"
done
echol $line
echodummyrule alls
echol

echol "# Normally not used (just for debugging)."
line="alli : allc"
for f in $CPARTS ; do
  line=$line" ${f}.i"
done
echol $line
echodummyrule alli
echol

for f in $CPARTS genclisph modules $EXTRA_CPARTS ; do
  depends=$EVERY_INCLUDES
  dependsc=''
  c=${f}.c
  test $f = spvw -o $f = package && depends=$depends' constpack'
  test $f = spvw -o $f = predtype && depends=$depends' avl'
  test $f = spvw && depends=$depends''$SPVW_INCLUDES" sort ${SRCDIR}spvw_calendar"
  test $f = eval && depends=$depends' bytecode '${with_jitc}
  test $f = array -o $f = hashtabl -o $f = io -o $f = time -o $f = package -o $f = spvw -o $f = stream -o $f = foreign && depends=$depends' arilev0'
  test $f = spvw -o $f = hashtabl && depends=$depends' aridecl'
  if [ $f = charstrg -a "${with_unicode}" != no ] ; then
    depends=$depends${UNICODE_INCLUDES}
    dependsc=${dependsc}' '${GLLIB_A}
  fi
  test $f = encoding && depends=$depends''$NLS_INCLUDES
  test $f = error && depends=$depends' '$ERROR_INCLUDES
  test $f = lisparit -o $f = arilev1_asm_proto && depends=$depends''$LISPARIT_INCLUDES''$ARI_ASMS
  test $f = genclisph && depends=$depends' gen.lispbibl'
  for g in $depends ; do
    dependsc=$dependsc' '$g'.c'
  done
  dependsc=$dependsc''$EVERY_INCLUDES_H
  test $f = spvw -a -n "${SPVW_VERSION}" && dependsc=$dependsc' '${SPVW_VERSION}
  if [ $f = pathname ] ; then
    dependsc=$dependsc" ${SRCDIR}execname.c"
    test ${TOS} = win32 && dependsc=$dependsc" ${SRCDIR}w32shell.c"
  fi
  test $f = built && dependsc=${dependsc}' cflags.h'
  flags="$XCPPFLAGS $XCFLAGS"
  # HP-UX cc and Sun cc don't look for include files in the current directory
  # any more after a preprocessor directive '#line 1 "../src/file.d"'.
  flags=$flags" -I."
  test $f = foreign -a $HOS = win32 && flags=$flags" -I${SRCTOPDIR}ffcall"
  test $f = genclisph && flags=$flags" -DCOMPILE_STANDALONE"
  if [ $f = modules ] ; then
    c=${SRCDIR}${c}
    if [ $HOS = unix -a $CROSS = false ] ; then
      dependsc=$dependsc' clisp.h'
    else
      flags=$flags' -DNO_CLISP_H'
    fi
    flags="${flags} -I."
    dependsc=$dependsc' modules.h'
  fi
  flags2=$flags
  # Reduce optimizations in special cases.
  if [ $XCC_GCC = true ] ; then
    case " $XCFLAGS " in
      *" -O0 "*) ;;
      *)
        if [ $f = eval -a "$cpu" = ia64 ] ; then
          # gcc-2.96 on Linux/ia64 miscompiles eval.d when -O is used.
          flags2=$flags2' -O0'
        fi
        if [ $f = eval -a "$cpu" = sparc ] ; then
          # gcc-7.2.0 on Linux/sparc appears to miscompile eval.d when -O2 is used.
          flags2=$flags2' -O1'
        fi
        if [ $f = eval -a "$cpu" = sparc64 ] ; then
          # gcc-4.6.3 on Linux/sparc64 miscompiles eval.d when -O is used.
          flags2=$flags2' -O0'
        fi
        if [ "$cpu" = mips -a -n "$USE_WIDE_SOFT" ] ; then
          # gcc-4.9.2 on Linux/mips (o32 ABI) miscompiles spvw.o, eval.o,
          # control.o, list.o and others when -DWIDE and -O is used.
          flags2=$flags2' -O0'
        fi
        if [ "$cpu" = mipsn32 -a -n "$USE_WIDE_SOFT" ] ; then
          # gcc-3.4.6 on IRIX/mips (n32 ABI) miscompiles something
          # when -DWIDE and -O2 is used.
          flags2=$flags2' -O1'
        fi
        if [ "$cpu" = i386 -a -n "$USE_WIDE_SOFT" ] ; then
          # gcc-6.3.0 on Hurd/i386 miscompiles something when -DWIDE is in use
          # and -O2 is used on all of spvw.o eval.o control.o encoding.o stream.o io.o
          # array.o hashtabl.o list.o record.o sequence.o charstrg.o predtype.o symbol.o.
          # The effect is a crash in loadmem_from_handle.
          # Also, clang 3.8.0 on FreeBSD/i386 miscompiles stream.o when -DWIDE is in
          # use and -O2.
          flags2=$flags2' -O1'
        fi
        if [ $f = lisparit -a "$cpu" = s390x ] ; then
          # gcc-4.9.2 on Linux/s390x miscompiles lisparit.d when -O2 is used.
          flags2=$flags2' -O1'
        fi
        if [ \( $f = hashtabl -o $f = package \) -a "$cpu" = powerpc64-elfv2 ] ; then
          # gcc-7.3.0 on Linux/powerpc64le miscompiles hashtabl.d and package.d
          # when -O2 is used.
          flags2=$flags2' -O1'
        fi
        ;;
    esac
  else
    case "$host_os" in
      aix*)
        if [ $f = lisparit -a -n "$USE_WIDE_SOFT" ] ; then
          # xlc 12.01 on AIX/powerpc miscompiles lisparit.o when -DWIDE is in use
          # and -O.
          flags2=$flags2' -O0'
        fi
        ;;
    esac
  fi
  if [ $f = eval -a "${with_jitc}" = lightning ]; then
    flags2=$flags2' -Wno-unused' # should be gone - eventually...
  fi
  if [ $f = arilev1_asm_proto -a $XCC_GCC = true ]; then
    # We don't want debugging information in arilev1_asm_proto.s.
    flags2=$flags2' -g0 -fno-dwarf2-cfi-asm'
  fi
  # Files that define C functions that are used as argument of make_machine_code
  # (such as the PSEUDOFUNs) need to make sure to align them properly for the
  # HEAPCODES object representation. Fortunately, modules cannot define
  # PSEUDOFUNs, therefore we don't need to apply this to the MODULE_CFLAGS.
  # encoding.d, stream.d, hashtabl.d, predtype.d define PSEUDOFUNs.
  # funarg.d defines test functions for list.d.
  # socket.d needs this flag, too, for ONE_FREE_BIT_HEAPCODES on Linux/x86_64. Very bizarre.
  if [ $f = encoding -o $f = stream -o $f = hashtabl -o $f = predtype -o $f = funarg -o $f = socket ] ; then
    flags2=$flags2" ${FALIGNFLAGS}"
  fi
  if [ $f = genclisph -a $XCC_GCC = true ] ; then
    # When using -O2 or higher, the compilation of genclisph.c takes several
    # minutes, which is unnecessary since it gets run only once.
    # When using -O0, the compilation of genclisph.c fails on AIX:
    # "1252-171 The displacement must be greater than or equal to -32768 and less than or equal to 32767."
    flags2=$flags2' -O1'
  fi
  echol "${f}.i : ${c}${dependsc}"
  echotab "${XCPP} ${flags} ${c} > ${f}.i"
  echol
  echol "${f}.s : ${c}${dependsc}"
  echotab "${XCC} ${flags2} -S ${c}"
  echol
  echol "${f}${TOBJ} : ${c}${dependsc}"
  echotab "${XCC} ${flags2} -c ${c}"
  echol
done

if [ "${with_gmalloc}" = yes ]; then
  for f in $GMALLOC ; do
    echol "${f}${TOBJ} : ${SRCDIR}${f}.c"
    # gmalloc.c needs -DUSG on Solaris and then needs -DMEMMOVE_MISSING for SunOS 4.
    echotab "${XCC} ${XCPPFLAGS} ${XCFLAGS} -DUSG -DMEMMOVE_MISSING -c ${SRCDIR}${f}.c -o ${f}${TOBJ}"
    echol
  done
fi

for f in $ARI_ASMS $SP_ASMS ; do
  if [ $TSYS = win32msvc ] ; then
    echol "${f}.i : ${SRCDIR}${f}-macro.c"
    echotab "${XCPP} ${XCPPFLAGS} ${XCFLAGS} ${SRCDIR}${f}-macro.c > ${f}.i"
    echol
    echol "${f}.s : ${SRCDIR}${f}-macro.c"
    if false; then # old
      echotab "${XCPP} ${XCPPFLAGS} ${XCFLAGS} ${SRCDIR}${f}-macro.c > ${f}.i.c"
      echotab "${XCC} ${XCFLAGS} -c ${f}.i.c /FAs /Fa${f}.s"
      echotab "\$(RM) ${f}.i${TOBJ}"
      echotab "\$(RM) ${f}.i.c"
    else
      echotab "${XCC} ${XCPPFLAGS} ${XCFLAGS} -c ${SRCDIR}${f}-macro.c /FAs /Fa${f}.s"
      echotab "\$(RM) ${f}-macro${TOBJ}"
    fi
    echol
    echol "${f}${TOBJ} : ${SRCDIR}${f}-macro.c"
    if false; then # old
      echotab "${XCPP} ${XCPPFLAGS} ${XCFLAGS} ${SRCDIR}${f}-macro.c > ${f}.i.c"
      echotab "${XCC} ${XCFLAGS} -c ${f}.i.c /Fo${f}${TOBJ}"
      echotab "\$(RM) ${f}.i.c"
    else
      echotab "${XCC} ${XCPPFLAGS} ${XCFLAGS} -c ${SRCDIR}${f}-macro.c /Fo${f}${TOBJ}"
    fi
    echol
  else
    echol "${f}${TOBJ} : ${f}.s"
    # Call the assembler, preferrably through the C compiler:
    if [ $f = ari_asm_hppa ] ; then
      # Only the native as groks the .SHORTDATA statements in ari_asm_hppa.d
      echotab "${XCC} ${XCPPFLAGS} ${XCFLAGS} -c ${f}.s || /usr/ccs/bin/as ${f}.s -o ${f}${TOBJ} || /bin/as ${f}.s -o ${f}${TOBJ}"
    elif [ $XCC_GCC = true ] ; then
      echotab "${XCC} ${XCPPFLAGS} ${XCFLAGS} -x assembler -c ${f}.s"
    else
      echotab "${XCC} ${XCPPFLAGS} ${XCFLAGS} -c ${f}.s"
    fi
    echol
  fi
done

if [ $HOS = unix -o $HSYS = win32gcc ] ; then
  # on w32 -g, using lisp.o leads to a crash on the first statement in main()
  test $HSYSOS = win32gcc -o $HSYSOS = cygwin; no_lisp_o=$?
  echol "lisp.a : \$(OBJECTS)"
  if [ $no_lisp_o = 1 ]; then
    echotab "\$(LD) -r -o lisp.o \$(OBJECTS)"
    echotab "chmod a-x lisp.o"
  fi
  if test -z "$LIBGCC"; then
    if [ $no_lisp_o = 1 ]; then
      echotab "\$(AR) rcv lisp.a lisp.o"
    else
      echotab "\$(AR) rcv lisp.a \$(OBJECTS)"
    fi
  else
    # Test for libgcc.a because NeXT cc does not have it.
    echotab "if test -f \$(LIBGCC) ; then mkdir libgcc ; (cd libgcc ; \$(AR) xv \$(LIBGCC)) ; \$(AR) rcv lisp.a lisp.o libgcc/*.o* ; \$(RM) -r libgcc ; else \$(AR) rcv lisp.a lisp.o ; fi"
  fi
  test $no_lisp_o = 1 && echotab "\$(RM) lisp.o"
  echotab "\$(RANLIB) lisp.a"
  echol
  echol "libnoreadline.a : noreadline.o"
  echotab "\$(AR) rcv libnoreadline.a noreadline.o"
  echotab "\$(RANLIB) libnoreadline.a"
  echol
fi
if [ ${SHREXT} = .dll -a "${with_dynamic_modules}" != no ]; then
  # win32 (SHREXT=.dll) requires all accessed libraries when linking a DLL.
  # i.e. when creating a dynamic module dll, we must give lisp.dll to the
  # linker, and when creating lisp.dll, we must give $(LIBS) to it.
  # Some unixes (SHREXT=.so) need -fPIC when compiling clisp core for a DLL,
  # which loses performance; besides, we do not need lisp.so on unix anyway.
  echol "lisp${SHREXT} : ${GLLIB_A} \$(OBJECTS) modules.o"
  CLISP_DEF=" lisp.def"
  XCC_CREATESHARED_=`echo ${XCC_CREATESHARED} | sed -e 's/\\${/\\\\$\\\\(/g' -e 's/}/\\\\)/g'`
  echotab "`eval \"lib=\$\@; libs=\$^\ \$\(LIBS\); echo ${XCC_CREATESHARED_}\"`"
  echol
else
  CLISP_DEF=""
fi
FILES="${FILES}${CLISP_DEF}"

if [ -n "$USE_GETTEXT" ] ; then
  echol "po : config.status ${SRCDIR}po/LINGUAS ${SRCDIR}po/Makefile.in.in"
  echotab "mkdir -p po"
  echotab "test -f po/Makefile.in || sh config.status po/Makefile.in po-directories"
  echol
  echol "LN_HARD=${LN_HARD}"
  echol "locale : po"
  if [ $HOS = unix ] ; then
    echotab "if test -d locale; then \$(RMRF) locale; fi"
    echotab "mkdir locale"
    echotab "(cd po && \$(MAKE) && \$(MAKE) install datarootdir=.. localedir='\$\$(datarootdir)/locale' INSTALL_DATA='\$(LN_HARD)') || (\$(RMRF) locale ; exit 1)"
    case "$host_os" in
      solaris*)
        # The non-GNU dgettext() function in Solaris libc needs symbolic links.
        # For the list of locale names, see spvw_language:init_language().
        for localename in en_US de_DE fr_FR es_ES nl_NL ru_RU da_DK sv_SE; do
          ll=`echo "${localename}" | sed -e 's/_.*//'`
          echotab "test -d 'locale/${localename}.UTF-8/LC_MESSAGES' || ln -s '${ll}' 'locale/${localename}.UTF-8'"
        done
        ;;
    esac
  else
    echotab "mkdir locale"
    if test -f ${SRCDIR}po/LINGUAS; then
      LINGUAS=`sed 's/#.*//' ${SRCDIR}po/LINGUAS`
    else fail "missing ${SRCDIR}po/LINGUAS"
    fi
    for lang in ${LINGUAS}; do
      echotab "mkdir -p locale${NEXT_}${lang}${NEXT_}LC_MESSAGES"
      echotab "\$(LN_S) ${SRCDIR}po${NEXT_}${lang}.gmo locale${NEXT_}${lang}${NEXT_}LC_MESSAGES${NEXT_}clisp.mo"
    done
  fi
  echol
fi

DATA_FILES="UnicodeDataFull.txt Symbol-Table.text"
DATA_FILES_TOP_PATH="utils${NEXT_}unicode${NEXT_}UnicodeDataFull.txt doc${NEXT_}Symbol-Table.text"
data_target="data :"
for f in ${DATA_FILES_TOP_PATH}; do
  data_target="${data_target} ${SRCTOPDIR_}${f}"
done
echol "${data_target}"
echotab "\$(RMRF) data"
echotab "mkdir data"
for f in ${DATA_FILES_TOP_PATH}; do
  echotab "cd data && \$(LN_S) ${PARENT_SRCTOPDIR_}${f} ."
done
echol

if [ ${HSYS} = win32gcc -a "${with_debug}" = no ]; then
finish_runtime () {
  # woe32 users do not have gcc, so they cannot disassemble CAR anyway
  echotab "strip -s lisp${LEXE}"
  echol
}
else
finish_runtime () {
  echol
}
fi

echol "lisp${LEXE} : ${GLLIB_A} \$(OBJECTS) modules${TOBJ} ${XCL_GETTEXTLIB} data"
if [ $HOS != win32 ] ; then
  if [ $XCC_GCC = true -a -n "$SOLARIS_LINKING" ] ; then
    # Dynamically linking on Solaris 2.[23] is a pain.
    LIBGCC_DIR='`'"${XCC} -print-libgcc-file-name"' | sed -e '"'"'s,[^/]*$$,,'"'"'`'
    echotab "${XCC} ${XCFLAGS} ${XCLFLAGS} \$(OBJECTS) modules${TOBJ} ${LIBS} -o lisp${LEXE} || /usr/ccs/bin/ld -V -dy -Bdynamic -Y P,/usr/ccs/lib:/usr/lib -Qy -o lisp${LEXE} ${LIBGCC_DIR}crt1.o ${LIBGCC_DIR}crti.o /usr/ccs/lib/values-Xa.o ${LIBGCC_DIR}crtbegin.o \$(OBJECTS) modules${TOBJ} -L${LIBGCC_DIR} -L/usr/ccs/bin ${LIBS} -lgcc -lc ${LIBGCC_DIR}crtend.o ${LIBGCC_DIR}crtn.o -lgcc"
  else
    echotab "${XCC} ${XCFLAGS} ${XCLFLAGS} \$(OBJECTS) modules${TOBJ} ${LIBS} ${OUT}lisp${LEXE}"
  fi
else
  # MSVC's incremental linking is buggy, avoid it.
  if [ $HSYS = win32msvc ] ; then echotab "\$(RM) lisp.ilk"; fi
  echotab "${XCC} ${XCFLAGS} ${XCLFLAGS} \$(OBJECTS) modules${TOBJ} ${LIBS} ${OUT}lisp${LEXE}"
  # With msvc4/5, need at least 1200 KB stack for creating the first
  # interpreted.mem, but the default stack size is only 1 MB.
  # With msvc6, need more than 2 MB for compiling compiler.lisp.
  if [ $HSYS = win32msvc -a ${COMPILER} != msvc7 ]; then
    # Jay Kint <jkint@icosahedron.org> says that msvc7(.NET) does not need this
    echotab "editbin /stack:3145728 lisp${LEXE}"
  fi
fi
finish_runtime lisp${LEXE}

if [ $TSYS = win32msvc -a "${with_debug}" != no ] ; then
  echol "${SRCDIR}lisp.bsc : lisp${LEXE}"
  echotab "bscmake /n /o lisp *.sbr"
  echol
fi

echol "marc.out : lisp${LEXE}"
echotab "${HERE}lisp${LEXE} -marc > marc.out"
echol

CONFIG=cfg${TOS}
echol "config.lisp : ${SRCDIR}${CONFIG}.lisp"
echotab "\$(CP) ${SRCDIR}${CONFIG}.lisp config.lisp"
if [ $TOS = unix ] ; then
  echotab "chmod +w config.lisp"
  echotab "echo '(setq *clhs-root-default* \"${hyperspec}\")' >> config.lisp"
  if [ ${TSYSOS} = cygwin ]; then
    # maybe convert the cygwin cygdrive pathnames
    # http://article.gmane.org/gmane.os.cygwin:67868
    # https://cygwin.com/ml/cygwin/2005-08/msg00460.html
    DEVPREFIX=`mount -p | sed -nr '2s,/([^ ]+) +\S+ +\S+$,\1,p'`
    echotab "echo '(setq *device-prefix* \"${DEVPREFIX}\")' >> config.lisp"
  fi
fi
echol

if [ -n "$USE_GETTEXT" ] ; then
  localeflags='-B . -N locale'
else
  localeflags='-B .'
fi
if [ "${with_unicode}" != no ] ; then
  # make sure that no encoding is left as ASCII (the C locale encoding)
  # The first "-E" sets all encodings to UTF-8, so that we can read
  #   CLISP source files and dump everything to the terminal;
  #   this is also important for the regexp test suite.
  # The second "-E" ensures that syscalls tests pass (user names may be 8bit)
  encflags=' -E UTF-8 -Emisc 1:1'
  if [ "${TSYSOS}" != darwin ]; then # utf-8 on Darwin is good enough
    # The last "-E" ensures that we can parse all pathnames.
    encflags=${encflags}' -Epathname 1:1'
  fi
else
  encflags=''
fi
someflags=${encflags}' -norc'
echol "RUN= ${HERE}lisp${LEXE} ${localeflags}${someflags}"
echol

for f in ${LUTILS} ; do
  echol "${f}.fas : ${UTILDIR_M}${f}.lisp lisp${LEXE} lispinit.mem"
  echotab "\$(RUN) -M lispinit.mem -q -c ${UTILDIR}${f}.lisp -o ./"
  echol
done

# The strict minimum needed for building interpreted.mem is between 1400KW
# and 1500KW. To reduce GCs, we spend 30% more than this. 8MB is not a big deal.
MEMOPT="-m 2MW"

if [ $CROSS = false ] ; then

  if [ "$HSYS" = win32gcc ]; then
    # work around an msys "feature": ":" after "/" is converted to a ";"
    # <http://article.gmane.org/gmane.comp.gnu.mingw.msys/4281>
    # <https://sourceforge.net/p/mingw/mailman/message/18351247/>
    # <http://article.gmane.org/gmane.lisp.clisp.devel/17589>
    # <https://sourceforge.net/p/clisp/mailman/message/18541077/>
    # <http://article.gmane.org/gmane.lisp.clisp.devel/17895>
    # <https://sourceforge.net/p/clisp/mailman/message/18996399/>
    SAFE_SRCDIR=`echo ${SRCDIR} | sed 's,/,\\\\\\\\,g'`
  else
    SAFE_SRCDIR=${SRCDIR}
  fi

  echol "interpreted.mem : lisp${LEXE} \$(LISPFILES) config.lisp"
  test $HOS != unix && echotab "-\$(RM) interpreted.mem"
  if [ $HSYSOS = beos ] ; then
    # Work around BeOS 5 kernel bug which causes subsequent invocations
    # of lisp${LEXE} to be incorrectly relocated. On BeOS, executables and
    # shared libraries are relocated page-by-page by a kernel routine.
    echotab "cp -p lisp${LEXE} lisp.tmp"
    echotab "mv lisp.tmp lisp${LEXE}"
  fi
  echotab "\$(RUN) ${MEMOPT} -lp ${SAFE_SRCDIR} -x '(and (load \"${SAFE_SRCDIR}init.lisp\") (sys::%saveinitmem) (ext::exit)) (ext::exit t)'"
  echotab "\$(MV) lispimag.mem interpreted.mem"
  echol

fi

if [ $CROSS = false ] ; then

  for f in $LPARTS ; do
    if [ $f = "compiler" ]; then
      image=interpreted.mem
    else
      image=halfcompiled.mem
    fi
    echol "${f}.fas : ${SRCDIR}${f}.lisp lisp${LEXE} $image"
    echotab "\$(RUN) ${MEMOPT} -M ${image} -q -c ${SRCDIR}${f}.lisp -o ./"
    echol
  done
  echol "config.fas : config.lisp lisp${LEXE} halfcompiled.mem"
  echotab "\$(RUN) ${MEMOPT} -M ${image} -q -c config.lisp"
  echol

  echol "halfcompiled.mem : lisp${LEXE} \$(LISPFILES) config.lisp compiler.fas"
  test $HOS != unix && echotab "-\$(RM) halfcompiled.mem"
  if [ $HSYSOS = beos ] ; then
    # Workaround BeOS 5 kernel bug, see explanation above.
    echotab "cp -p lisp${LEXE} lisp.tmp"
    echotab "mv lisp.tmp lisp${LEXE}"
  fi
  echotab "\$(RUN) ${MEMOPT} -lp ${SAFE_SRCDIR} -x '(and (load \"${SAFE_SRCDIR}init.lisp\") (sys::%saveinitmem) (ext::exit)) (ext::exit t)'"
  echotab "\$(MV) lispimag.mem halfcompiled.mem"
  echol

  echol "lispinit.mem : lisp${LEXE} \$(FASFILES)"
  test $HOS != unix && echotab "-\$(RM) lispinit.mem"
  if [ $HSYSOS = beos ] ; then
    # Workaround BeOS 5 kernel bug, see explanation above.
    echotab "cp -p lisp${LEXE} lisp.tmp"
    echotab "mv lisp.tmp lisp${LEXE}"
  fi
  echotab '$(RUN) -x "(and (load \"init.fas\") (ext::saveinitmem) (ext::exit)) (ext::exit t)"'
  echol

fi

echol

if [ -n "$USE_GETTEXT" ] ; then
  localeflags="-B ${HEREP} -N ${HERE_}locale"
else
  localeflags="-B ${HEREP}"
fi
CLISP_="${HERE_}lisp${LEXE} -M ${HERE_}lispinit.mem ${localeflags}${someflags}"

if [ $CROSS = false ] ; then
  CHECK_DEPS="check-recompile check-fresh-line check-script check-tests"

  echol "# check the sources:"
  echol "# 1. subr.d, fsubr.d and all the LISPFUNs must add up"
  echol "# 2. no variables of type gcv_object_t - only pointers to it"
  echol "check-sources : # lisp${LEXE} lispinit.mem"
  echotab '$(RUN) -M lispinit.mem -C -i '"${SRCDIR}"'check-lispfun.lisp -x "(check-lisp-defs \"'"${SRCDIR}"'\")"'
  echotab "if egrep ' var gcv_object_t *[^* ]' ${SRCDIR}*.d; then false; else true; fi"
  echol

  echol "# Test: recompile \$(LISPFILES) and compare their contents."
  echol "check-recompile : lispinit.mem ${RECOMPILEDIR} \$(TESTFASFILES)"
  if [ $HOS = unix -o $HSYS = win32gcc ] ; then
    for f in $LPARTS config; do
      echotab "cmp -s ${f}.fas ${RECOMPILEDIR}/${f}.fas "' || (echo "Test failed." ; exit 1)'
    done
    echotab 'echo "Test passed."'
    echol
  elif [ $HSYS = win32msvc ] ; then
    echotab "comp *.fas ${RECOMPILEDIR}"
    echotab "echo The test passed if only GENSYM differences were found."
    echol
  else
    echotab 'echo "Compare the .fas files by hand."'
    echol
  fi

  echol "${RECOMPILEDIR} :"
  echotab "-mkdir ${RECOMPILEDIR}"
  echol

  for f in $LPARTS; do
    echol "${RECOMPILEDIR}${NEXT_M}${f}.fas : ${SRCDIR}${f}.lisp lisp${LEXE} lispinit.mem"
    echotab "\$(RUN) -m 1MW -M lispinit.mem -q -d -c ${SRCDIR}${f}.lisp -o ${RECOMPILEDIR}${NEXT_}"
    echol
  done
  echol "${RECOMPILEDIR}${NEXT_M}config.fas : config.lisp lisp${LEXE} lispinit.mem"
  echotab "\$(RUN) -m 1MW -M lispinit.mem -q -d -c config.lisp -o ${RECOMPILEDIR}${NEXT_}"
  echol

  echol "lispinit2.mem : lisp${LEXE} \$(TESTFASFILES)"
  if [ $HSYSOS = beos ] ; then
    # Workaround BeOS 5 kernel bug, see explanation above.
    echotab "cp -p lisp${LEXE} lisp.tmp"
    echotab "mv lisp.tmp lisp${LEXE}"
  fi
  echotab '$(RUN) -x "(and (cd \"'"${RECOMPILEDIR}${NEXT}"'\") (load \"init.fas\") (cd \"'"${PARENT}"'\") (sys::%saveinitmem) (ext::exit)) (ext::exit t)"'
  echotab "-\$(RM) lispinit2.mem"
  echotab "\$(MV) lispimag.mem lispinit2.mem"
  echol

  echol

  # Check that fresh-line works, when clisp is used in batch mode (option -x)
  # and when the stdout and stderr are the same (2>&1), even when this output
  # is a pipe.
  # On win32, this test fails, and we cannot fix it, because given two pipe
  # handle for stdout and stderr, we cannot determine equality. Instead test
  # only the (easier) case of stdout and stderr going to a file.
  echol "check-fresh-line : lisp${LEXE} lispinit.mem"
  OBSOLETE="$OBSOLETE fresh-line.out"
  echotab "-\$(RM) fresh-line.out"
  if [ "$HOS" = win32 -o "$HSYS" = win32gcc ] ; then
    echotab "\$(RUN) -q -M lispinit.mem -x '(progn (dolist (s (quote (*terminal-io* *standard-output* *error-output* *query-io* *debug-io* *trace-output*))) (format t \"~S = ~S~%\" s (symbol-value s))) (values))' 2>&1 > fresh-line.out"
    for stream1 in '*terminal-io*' '*standard-output*' '*error-output*' '*query-io*' '*debug-io*' '*trace-output*'; do
      for stream2 in '*terminal-io*' '*standard-output*' '*error-output*' '*query-io*' '*debug-io*' '*trace-output*'; do
        echotab "\$(RUN) -q -M lispinit.mem -x '(progn (format ${stream1} \"~&Line1 to ${stream1}\") (format ${stream2} \"~&Line2 to ${stream2}\") (values))' 2>&1 >> fresh-line.out"
      done
    done
  else
    echotab "\$(RUN) -q -M lispinit.mem -x '(progn (dolist (s (quote (*terminal-io* *standard-output* *error-output* *query-io* *debug-io* *trace-output*))) (format t \"~S = ~S~%\" s (symbol-value s))) (values))' 2>&1 | cat > fresh-line.out"
    for stream1 in '*terminal-io*' '*standard-output*' '*error-output*' '*query-io*' '*debug-io*' '*trace-output*'; do
      for stream2 in '*terminal-io*' '*standard-output*' '*error-output*' '*query-io*' '*debug-io*' '*trace-output*'; do
        echotab "\$(RUN) -q -M lispinit.mem -x '(progn (format ${stream1} \"~&Line1 to ${stream1}\") (format ${stream2} \"~&Line2 to ${stream2}\") (values))' 2>&1 | cat >> fresh-line.out"
      done
    done
  fi
  echotab "if grep 'Line1.*Line2' fresh-line.out > /dev/null; then exit 1; fi"
  echotab "\$(RM) fresh-line.out"
  echol

  # check that the scripting works
  echol "check-script : lisp${LEXE} lispinit.mem"
  # Check for decent behaviour when stdin is not readable
  # (cf. https://sourceforge.net/p/clisp/bugs/523/)
  case "$host_os" in
    aix* | irix*)
      # On AIX 7.1 and IRIX 6.5, inside 'make' or 'gmake', a command that has
      # stdin with mode O_RDWR gets the current stdin or tty assigned to stdin
      # instead. This would make the test hang. 'bash -c' is the workaround.
      # Whereas 'sh -c' would not help.
      if type bash >/dev/null 2>/dev/null; then
        echotab "bash -c '\$(RUN) -q -M lispinit.mem 0>/dev/null'"
      fi
      ;;
    *)
      echotab "\$(RUN) -q -M lispinit.mem 0>/dev/null"
      ;;
  esac
  TRCR="| tr -d '\r'"; TRLF="| tr '\n' '_'"
  echotab "output=\`echo '(princ (+ 11 99))' | \$(RUN) -q -M lispinit.mem - ${TRCR}\`; test \"\$\$output\" = 110 || exit 1"
  echotab "test \"\`echo '(+ foo bar)' | \$(RUN) -q -M lispinit.mem -x '(setq foo 11 bar 99)' -repl ${TRCR}${TRLF}\`\" = '99_[1]> _110_' || exit 1"
  echotab "\$(RM) script.lisp; echo '(error \"loading script.lisp\")' > script.lisp"
  echotab "if \$(RUN) -q -M lispinit.mem -x '(load \"script.lisp\")' -repl < /dev/null; then exit 1; else :; fi"
  echotab "\$(RM) script.lisp; echo '(eval-when (:compile-toplevel) (princ *args*))' > script.lisp"
  echotab "output=\`\$(RUN) -q -q -M lispinit.mem -c script.lisp foo bar\`; test \"\$\$output\" = '(foo bar)' || exit 1"
  if [ "$HOS" != win32 ]; then # woe32 has unpredictable exit codes
    # http://article.gmane.org/gmane.lisp.clisp.devel/18967
    # https://sourceforge.net/p/clisp/mailman/message/20318073/
    echotab "(echo '(progn (setf (stream-element-type *standard-input*) (quote (unsigned-byte 8))) (exit 42))' | \$(RUN) -q -M lispinit.mem -; test \$\$? = 42) || exit 1"
  fi
  if [ "${with_unicode}" = no ]; then
    seq42="(map (quote (vector (unsigned-byte 8))) (function char-code) \"42\")"
  else
    seq42='(convert-string-to-bytes "42" charset:ascii)'
  fi
  echotab "output=\`echo '(setf (stream-element-type *standard-output*) (quote (unsigned-byte 8))) (write-sequence ${seq42} *standard-output*) (setf (stream-element-type *standard-output*) (quote character)) (terpri)' | \$(RUN) -q -M lispinit.mem - ${TRCR}\`; test \"\$\$output\" = 42 || exit 1"
  echotab "\$(RM) script.lisp; echo '(+ 11 99)' > script.lisp"
  echotab "output=\`\$(RUN) -q -M lispinit.mem < script.lisp ${TRCR}\`; test \"\$\$output\" = 110 || exit 1"
  echotab "\$(RM) script.lisp; echo '(princ (+ 11 99))' > script.lisp"
  echotab "output=\`\$(RUN) -q -M lispinit.mem script.lisp ${TRCR}\`; test \"\$\$output\" = 110 || exit 1"
  echotab "\$(RM) script.lisp; echo '(+ foo bar)' > script.lisp"
  echotab "output=\`\$(RUN) -q -M lispinit.mem -x '(setq foo 11 bar 99)' -repl < script.lisp ${TRCR}${TRLF}\`; test \"\$\$output\" = 99_110_ || exit 1"
  # "-x with lisp-file is invalid"
  # echotab "\$(RM) script.lisp; echo '(princ (+ foo bar))' > script.lisp"
  # echotab "output=\`\$(RUN) -q -M lispinit.mem -x '(setq foo 11 bar 99)' -repl script.lisp ${TRCR}${TRLF}\`; test \"\$\$output\" = 99_110_ || exit 1"
  if [ "$HOS" != win32 ]; then # woe32 has unpredictable exit codes (see above)
    echotab "\$(RM) script.lisp; echo '(progn (setf (stream-element-type *standard-input*) (quote (unsigned-byte 8))) (exit 42))' > script.lisp"
    echotab "(\$(RUN) -q -M lispinit.mem < script.lisp; test \$\$? = 42) || exit 1"
    echotab "(\$(RUN) -q -M lispinit.mem script.lisp; test \$\$? = 42) || exit 1"
  fi
  echotab "\$(RM) script.lisp; echo '(setf (stream-element-type *standard-output*) (quote (unsigned-byte 8))) (write-sequence ${seq42} *standard-output*) (setf (stream-element-type *standard-output*) (quote character)) (terpri)' > script.lisp"
  # ??? echotab "output=\`\$(RUN) -q -M lispinit.mem < script.lisp ${TRCR}\`; test \"\$\$output\" = 42 || exit 1"
  echotab "output=\`\$(RUN) -q -M lispinit.mem script.lisp ${TRCR}\`; test \"\$\$output\" = 42 || exit 1"
  echotab "\$(RM) script.lisp; echo '(with-open-stream (s (make-stream :output :element-type (quote (unsigned-byte 8)))) (write-sequence ${seq42} s) (values))' > script.lisp"
  echotab "output=\`\$(RUN) -q -M lispinit.mem < script.lisp ${TRCR}\`; test \"\$\$output\" = 42 || exit 1"
  echotab "output=\`\$(RUN) -q -M lispinit.mem script.lisp ${TRCR}\`; test \"\$\$output\" = 42 || exit 1"
  case "$host_os"  in
    darwin* )
      # http://stackoverflow.com/questions/29112446/nohup-doesnt-work-with-os-x-yosmite-get-error-cant-detach-from-console-no-s
      # http://stackoverflow.com/questions/23898623/nohup-cant-detach-from-console
      ;;
    * )
      echotab "\$(RM) script.lisp; nohup \$(RUN) -q -M lispinit.mem -x 42 2>&1 > script.lisp; output_last_line=\`sed -n -e '\$\$p' script.lisp ${TRCR}\`; test \"\$\$output_last_line\" = 42 || exit 1 "
      ;;
  esac
  echotab "\$(RM) script.lisp script.fas script.lib"
  RAISE='(setq *error-output* *standard-output*) (error "myerror")'
  echotab "output=\"\`\$(RUN) -q -M lispinit.mem -x '(progn ${RAISE})' ${TRCR}\`\"; test \"\$\$output\" = '*** - myerror' || exit 1"
  echotab "if \$(RUN) -q -M lispinit.mem -x '(progn ${RAISE})'; then exit 1; fi"
  case "$host_os" in
    aix* | hpux* | beos* | haiku* | minix* | mingw*)
      # On these platforms, there is no /dev/fd/1.
      ;;
    *)
      echotab "\$(RUN) -q -M lispinit.mem -x '(truename (make-stream :output))'"
      echotab "\$(RUN) -q -M lispinit.mem -x '(truename (make-stream :output))'|cat"
      ;;
  esac
  echol

  echol "check-tests : ${TESTSDIR} lisp${LEXE} lispinit.mem"
  echotab "cd ${TESTSDIR} && \$(MAKE) SHELL='\$(SHELL)' LEXE=${LEXE}"
  echol
  echol "check-tests-all : ${TESTSDIR} lisp${LEXE} lispinit.mem"
  echotab "cd ${TESTSDIR} && \$(MAKE) SHELL='\$(SHELL)' LEXE=${LEXE} clean complete compare"
  echol
  if [ "${with_threads}" != no ]; then
    CHECK_DEPS=${CHECK_DEPS}" check-tests-parallel"
    echol "check-tests-parallel : ${TESTSDIR} lisp${LEXE} lispinit.mem"
    echotab "cd ${TESTSDIR} && \$(MAKE) SHELL='\$(SHELL)' LEXE=${LEXE} clean parallel compare"
    echol
  fi
  echol "${TESTSDIR} :"
  echotab "-mkdir ${TESTSDIR}"
  # on win32, LN_S=copy and it accepts exactly 2 arguments
  for f in Makefile '*.lisp' '*.tst'; do
    echotab "cd ${TESTSDIR} && \$(LN_S) ${PARENT_SRCTOPDIR_}tests${NEXT_}${f} ."
  done
  echol

  # sacla-tests are not included in the source distribution
  if test -d "${SRCTOPDIR_}sacla-tests"; then
    CHECK_DEPS=${CHECK_DEPS}" check-sacla-tests"
    SACLA_CLISP="../lisp${LEXE} -ansi -B .. -M ../lispinit.mem -N ../locale ${someflags} -i tests.lisp"
    echol "check-sacla-tests : ${SACLATESTSDIR} lisp${LEXE} lispinit.mem"
    echotab "cd ${SACLATESTSDIR} && ${SACLA_CLISP} -x '(ext:exit (plusp (run-all-tests)))'"
    echol
    echol "${SACLATESTSDIR} :"
    echotab "-mkdir ${SACLATESTSDIR}"
    # on win32, LN_S=copy and it accepts exactly 2 arguments
    for f in '*.lisp'; do
      echotab "cd ${SACLATESTSDIR} && \$(LN_S) ${PARENT_SRCTOPDIR_}sacla-tests${NEXT_}${f} ."
    done
    echol
  fi

  # ansi-tests are not included in the source distribution
  if test -d "${SRCTOPDIR_}ansi-tests"; then
    CHECK_DEPS=${CHECK_DEPS}" check-ansi-tests check-ansi-tests-compiled"
    ANSI_CLISP="../lisp${LEXE} -B .. -M ../lispinit.mem -N ../locale ${someflags} -m 30000KW -ansi -i clispload.lisp -p CL-TEST"
    echol "check-ansi-tests : ${ANSITESTSDIR} lisp${LEXE} lispinit.mem"
    echotab "cd ${ANSITESTSDIR} && ${ANSI_CLISP} -x '(time (regression-test:do-tests)) (ext:exit (regression-test:pending-tests))' 2>&1 | tee ../ansi-tests-log"
    echol
    echol "check-ansi-tests-debug : ${ANSITESTSDIR} lisp${LEXE} lispinit.mem"
    echotab "cd ${ANSITESTSDIR} && ${ANSI_CLISP}"
    echol
    echol "check-ansi-tests-compiled : ${ANSITESTSDIR} lisp${LEXE} lispinit.mem"
    echotab "cd ${ANSITESTSDIR} && ${ANSI_CLISP} -x '(setq regression-test::*compile-tests* t) (time (regression-test:do-tests)) (ext:exit (regression-test:pending-tests))' 2>&1 | tee ../ansi-tests-compiled-log"
    echol
    echol "check-ansi-tests-compiled-debug : ${ANSITESTSDIR} lisp${LEXE} lispinit.mem"
    echotab "cd ${ANSITESTSDIR} && ${ANSI_CLISP} -x '(setq regression-test::*compile-tests* t)' -repl"
    echol
    echol "${ANSITESTSDIR} :"
  # Do NOT update the ansi-tests directory automatically, because
  # 1. "make check-ansi-tests" would fail as soon as Paul Dietz adds a test
  #    that happens to fail in clisp. But we don't want to put out new releases
  #    on a weekly or monthly basis, nor do we want to get flooded by reports
  #    of failing "make check".
  # 2. 'svn' does not work on machines that are not connected to the internet.
  # 3. Makefile.devel does not work if 'make' is not GNU make.
  # echotab "cd ${SRCTOPDIR_} && \$(MAKE) -f Makefile.devel update-ansi-tests"
    echotab "-mkdir ${ANSITESTSDIR}"
    # on win32, LN_S=copy and it accepts exactly 2 arguments
    for f in Makefile '*.lsp'; do
      echotab "cd ${ANSITESTSDIR} && \$(LN_S) ${PARENT_SRCTOPDIR_}ansi-tests${NEXT_}${f} ."
    done
    echotab "cd ${ANSITESTSDIR} && \$(LN_S) ${PARENT_SRCTOPDIR_}utils${NEXT_}clispload.lisp ."
    echol
  fi

  # benchmarks are not included in the source distribution
  if [ -d "${SRCTOPDIR_}benchmarks" -a -n "${GNU_MAKE}" ]; then
    CHECK_DEPS=${CHECK_DEPS}" bench"
    echol "bench : ${BENCHDIR}"
    echotab "CLISP=\"`pwd`/clisp -norc\"; export CLISP; cd ${BENCHDIR}; \$(MAKE) CLISP=\"\$\$CLISP\" clisp"
    echol
    echol "${BENCHDIR} :"
    echotab "-mkdir ${BENCHDIR}"
    for f in Makefile '*.lisp'; do
      echotab "cd ${BENCHDIR} && \$(LN_S) ${PARENT_SRCTOPDIR_}benchmarks${NEXT_}${f} ."
    done
    echol
  fi

  # have .hg + developer with a network connection => check id-href.map
  # Try wget, lynx, curl in order. wget is common, but MacOS X only has curl.
  # use beta pages for the latest id-href.map
  # NB: keep in sync with doc/Makefile:DIST
  MYIMPROOT=http://clisp.org/beta/impnotes/
  MYTESTURL=${MYIMPROOT}id-href.map
  if test -d "${SRCTOPDIR_}.hg" \
     && { if wget --version >/dev/null 2>/dev/null ; then \
            wget --execute netrc=off --tries=1 --timeout=10 -q ${MYTESTURL}; \
          elif lynx --version >/dev/null 2>/dev/null ; then \
            lynx -connect_timeout=10 -source ${MYTESTURL} > id-href.map; \
          elif curl --version >/dev/null 2>/dev/null ; then \
            curl --max-time 10 --silent ${MYTESTURL} > id-href.map; \
          else false; \
          fi; \
        }; then
    rm -f id-href.map
    CHECK_DEPS=${CHECK_DEPS}" check-doc"
    echol "IMPNOTES = \"${MYIMPROOT}\""
    echol "CLHSROOT = \"${hyperspec}\""
    echol "check-doc: clisp${TEXE} base"
    echotab 'IMPNOTES=$(IMPNOTES) ./clisp'" ${someflags} -x '(sys::ensure-impnotes-map t)'"
    echotab 'CLHSROOT=$(CLHSROOT) ./clisp'" ${someflags} -x '(sys::ensure-clhs-map)'"
    echol
  fi

  echol "# Perform self-tests."
  echol "check : ${CHECK_DEPS}"
  echodummyrule check
  echol

  EXTRACHECK_DEPS=
  # TODO: Enable this check only on those platforms where it is
  # supported (Linux, FreeBSD, etc.), or disable it on those platforms
  # where it is known to be not supported (OpenBSD, etc.).
  EXTRACHECK_DEPS="${EXTRACHECK_DEPS} check-exec-image"

  # check that the executable images work
  EXEIMG=image
  OBSOLETE="$OBSOLETE $(exefiles ${EXEIMG}) ${EXEIMG}.mem"
  echol "check-exec-image: lisp${LEXE} lispinit.mem"
  echotab '$(RUN) -M lispinit.mem -x "(saveinitmem \"'"${EXEIMG}"'\" :executable t :norc t)"'
  echotab "${HERE}${EXEIMG}${HEXE}"' -x "(setq zz 10) (saveinitmem \"'"${EXEIMG}"'\")"'
  # check that the executable image still honors -M
  echotab "${HERE}${EXEIMG}${HEXE} -norc -M ${EXEIMG}.mem -x zz"
  # check that *ARGS* do not seep from image to image (https://sourceforge.net/p/clisp/bugs/519/)
  echotab '$(RUN) -M lispinit.mem -x "(saveinitmem \"'"${EXEIMG}"'\" :executable t :norc t :quiet t :init-function (lambda () (prin1 *args*) (exit)))" -- a 1'
  echotab "test \"\`${HERE}${EXEIMG}${HEXE} b ${TRCR}\`\" = '(\"b\")' || exit 1"
  echotab "test \"\`${HERE}${EXEIMG}${HEXE} b 2 ${TRCR}\`\" = '(\"b\" \"2\")' || exit 1"
  echotab '$(RUN) -M lispinit.mem -x "(saveinitmem \"'"${EXEIMG}"'\" :executable t :norc t :quiet t :init-function (function exit))"'
  echotab ${HERE}${EXEIMG}${HEXE}
  echotab "test -z \"\`${HERE}${EXEIMG}${HEXE}\`\" || exit 1"
  echotab '$(RUN) -M lispinit.mem -x '"'"'(saveinitmem "'"${EXEIMG}"'" :executable t :norc t :quiet t :init-function (lambda () '"${RAISE}))'"
  echotab "output=\"\`${HERE}${EXEIMG}${HEXE} -on-error exit ${TRCR}\`\"; test \"\$\$output\" = '*** - myerror' || exit 1"
  echotab "if ${HERE}${EXEIMG}${HEXE} -on-error exit; then exit 1; fi"
  echotab '$(RUN) -M lispinit.mem -x '"'"'(saveinitmem "'"${EXEIMG}"'" :executable t :norc t :quiet t :init-function (lambda () (exit-on-error '"${RAISE})))'"
  echotab "output=\"\`${HERE}${EXEIMG}${HEXE} ${TRCR}\`\"; test \"\$\$output\" = '*** - myerror' || exit 1"
  echotab "if ${HERE}${EXEIMG}${HEXE}; then exit 1; fi"
  echotab "-ls -l lisp${LEXE} lispinit.mem ${EXEIMG}${HEXE} ${EXEIMG}.mem"
  echotab "\$(RM) ${EXEIMG}${HEXE} ${EXEIMG}.mem"
  echol

  echol "# Perform extra tests."
  echol "# Failure of these does not indicate that the built clisp is unusable,"
  echol "# but rather than some non-vital features are not supported."
  echol "extracheck : ${EXTRACHECK_DEPS}"
  echodummyrule extracheck
  echol
  echol
fi

if [ $XCC_GCC = true ] ; then
  echol "lispbibl.h :${EVERY_INCLUDES_C}${EVERY_INCLUDES_H}"
  echotab "( (${XCPP} ${XCPPFLAGS} ${XCFLAGS} -P lispbibl.c | \$(GREP) -v \"^ *\$\$\") ; (${XCPP} ${XCPPFLAGS} ${XCFLAGS} -P -dM lispbibl.c | sort) ) > lispbibl.h"
  echol
  echol "gc : lispbibl.h # show GC-related definitions"
  echotab "egrep '[^[:alpha:]](MEMORY|SPVW|GC|SIGSEGV|SAFETY|ASM|FAST|DEBUG)[^[:alpha:]]' lispbibl.h | grep -v 'define _' | egrep '^#define'"
  echol
  echol
fi

echol "clisp.h clisp-test.c${CLISP_DEF} : genclisph.o config.h ${PARAMS_H} ${GLLIB_A}"
echotab_to_HEXE "\$(CC) \$(CFLAGS) \$(CLFLAGS)" "genclisph.o" "genclisph"
if test -z "${CLISP_DEF}"; then
  echotab "${HERE}genclisph clisp.h.tmp clisp-test.c"
else
  echotab "${HERE}genclisph clisp.h.tmp clisp-test.c ${CLISP_DEF}"
  # new-clx depends on the symbol "hostent_to_lisp", which is defined in the
  # syscalls module and therefore doesn't get put into lisp.def on Cygwin.
  # So we just force it.
  echotab "echo -e \"\tlisp.exe.hostent_to_lisp\" >> ${CLISP_DEF}"
fi
echotab "(echo '#ifndef _CLISP_H' ; echo '#define _CLISP_H' ; echo; echo '/* ==== config.h ==== */' ; cat config.h ) > clisp.h"
for parf in ${PARAMS_H}; do
  echotab "(echo; echo '/* '${parf}' */' ; grep '^#' ${parf} ) >> clisp.h"
done
echotab "(echo; echo '/* genclisph */' ; cat clisp.h.tmp; echo ; echo '#endif /* _CLISP_H */') >> clisp.h"
echotab_to_HEXE "\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(CLFLAGS) -I. -DUSE_CLISP_H=1 -DCOMPILE_STANDALONE" "clisp-test.c ${GLLIB_A}" "clisp-test-clisp"
echotab_to_HEXE "\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(CLFLAGS) -I. -DUSE_CLISP_H=0 -DCOMPILE_STANDALONE" "clisp-test.c ${GLLIB_A}" "clisp-test-lispbibl"
echotab "${HERE}clisp-test-clisp > clisp-test-clisp.out"
echotab "${HERE}clisp-test-lispbibl > clisp-test-lispbibl.out"
if [ $HOS = unix -o $HSYS = win32gcc ]; then
  echotab  "cmp clisp-test-clisp.out clisp-test-lispbibl.out"
else
  echotab "comp clisp-test-clisp.out clisp-test-lispbibl.out"
fi
echotab "if grep lispbibl.d clisp.h; then false; else true; fi"
echotab "\$($EXERM) $(exefiles genclisph) clisp.h.tmp $(exefiles clisp-test-clisp) $(exefiles clisp-test-lispbibl) clisp-test-clisp.out clisp-test-lispbibl.out"
OBSOLETE="$OBSOLETE clisp-test.c $(exefiles genclisph)"
echol
LINKKIT_SOURCES="${SRCDIR}modules.c clisp.h ${UTILDIR}modprep.lisp"
LINKKIT=''
echol "linkkit : ${LINKKIT_SOURCES}"
echotab "-\$(RMRF) linkkit"
echotab "mkdir linkkit"
for f in ${LINKKIT_SOURCES}; do
  b=`basename $f`
  d=`dirname $f`; d=`cd $d; pwd`
  LINKKIT="${LINKKIT} ${b}"
  echotab "cd linkkit && \$(LN_S) ${d}/${b} ${b}"
done
echol

# scripts in build-aux
MODULE_CONFIGURES=`find ${MODULESDIR_} -name configure`
BUILD_AUX_ALL=`grep '$ac_aux_dir/' ${MODULE_CONFIGURES} | sed 's,.*$ac_aux_dir/\([a-z.-]*\).*,\1,' | sort -u`
BUILD_AUX=''
# must have build-aux in build directory because it is the lisplibdir for
# building modules, see src/m4/general.m4:CL_MODULE_COMMON_CHECKS:
#   AC_CONFIG_AUX_DIR([$cl_cv_clisp_libdir/build-aux])
test -n "${SRCDIR}" && case "${LN_S}" in
  cp* )                         # ln is not available
    echol "build-aux : ${SRCDIR}build-aux"
    echotab "-\$(RMRF) build-aux"
    echotab "-cp -r ${SRCDIR}build-aux build-aux"
    echol
    ;;
  * ) link_dep "build-aux" "${SRCDIR}build-aux"
    ;;
esac
for f in ${BUILD_AUX_ALL}; do
  test -r ${SRCDIR}build-aux/$f && BUILD_AUX="${BUILD_AUX} $f"
done

test "${verbose}" = true -o "${verbose}" = yes && \
  echo "BUILD_AUX =${BUILD_AUX}" >&2

echol "modular : ${FILES} clisp-link linkkit modules.h modules.o makevars build-aux"
echodummyrule modular
echol
# while the top-level makevars can contain arbitrary paths in LIBS and FILES,
# makevars in each linking set (boot/base/full) must point to local files only
echol "makevars : Makefile"
echotab "(echo 'CC='\"'\"'\$(CC)'\"'\" ;\\"
echotab " echo 'CPPFLAGS='\"'\"'\$(MODULE_CPPFLAGS)'\"'\" ;\\"
echotab " echo 'CFLAGS='\"'\"'\$(${MODULE_CFLAGS_VAR})'\"'\" ;\\"
echotab " echo 'CLFLAGS='\"'\"'\$(${MODULE_CLFLAGS_VAR})'\"'\" ;\\"
echotab " echo 'LIBS='\"'\"'lisp.a${CLISP_DEF} \$(LIBS)'\"'\" ;\\"
echotab " echo 'X_LIBS='\"'\"'\$(X_LIBS)'\"'\" ;\\"
echotab " echo 'RANLIB='\"'\"'\$(RANLIB)'\"'\" ;\\"
echotab " echo 'FILES='\"'\"'${FILES}'\"'\") > makevars"
echol
for f in clisp-link ; do
  echol "${f} : ${SRCDIR}${f}.in"
  # On IRIX, clisp-link must be executed through /bin/ksh or bash, not /bin/sh.
  case "$host_os" in
    irix*) goodshell="$CONFIG_SHELL" ;;
    *)     goodshell='/bin/sh' ;;
  esac
  XCC_CREATESHARED_=`echo "$XCC_CREATESHARED" | sed -e 's,\\$,$$,g'`
  echotab "sed -e 's%@''SHELL''@%${goodshell}%' \\"
  echotab "    -e 's%@with_dynamic_modules@%${with_dynamic_modules}%' \\"
  echotab "    -e 's%@createsharedlib@%$XCC_CREATESHARED_%' \\"
  echotab "    -e 's%@LEXE@%${LEXE}%' -e 's%@SHREXT@%${SHREXT}%' \\"
  # On Cygwin, "-L$sourcedir$" is not enough for the linker to find
  # lisp.def.  So just give the absolute path to lisp.def.
  if test -z "${CLISP_DEF}"; then
    echotab "    -e 's%@CLISP_DEF@%%' \\"
  elif [ "${HSYSOS}" = cygwin ]; then
    echotab "    -e 's%@CLISP_DEF@%\$\$absolute_sourcedir/lisp.def%' \\"
  else
    echotab "    -e 's%@CLISP_DEF@%-L\$\$sourcedir${CLISP_DEF}%' \\"
  fi
  echotab "  < ${SRCDIR}${f}.in > ${f}"
  echotab "chmod a+x ${f}"
  echol
done
echol "boot : modular lispinit.mem"
echotab "test -d boot || (mkdir boot && cd boot && for f in ${FILES} modules.h modules.o lisp${LEXE} lispinit.mem; do \$(LN_S) ${PARENT_}\$\$f .; done && (\$(GREP) -v '^FILES=' ${PARENT_}makevars; fl=''; for f in ${FILES}; do fl=\$\$fl' '\`basename \$\$f\`; done; echo 'FILES='\"'\"\$\$fl\"'\") > makevars) || (\$(RMRF) boot ; exit 1)"
echol
make_modules() {
  MODULES_VAR=$1
  LINKING_SET=$2
  MODULE_NAME=$3         # Some "make"s don't support empty target lists
  echol "${MODULE_NAME} \$(${MODULES_VAR}) : ${LINKING_SET} clisp${TEXE} linkkit force"
  echotab 'mkdir -p $@'
  echotab "m=\`cd ${MODULESDIR_}\$@; pwd\`; \\"
  # srcdir has to be passed to ./configure because it must be able to find
  # src/build-aux/install-sh _AND_ also its own sources, thus we must
  # point it to modules/... in the original source tree.
  # The 'if' condition here tests whether $$m/configure is newer than $@/config.status.
  echotab "if test -f \$\$m/configure && { test ! -f \$@/config.status || test -n \"\`find \$\$m/configure -prune -newer \$@/config.status\`\"; } ; then ( cd \$@ ;\\"
  echotab "    cache="'`'"echo \$@/ | sed -e 's,[^/][^/]*//*,../,g'"'`'"config.cache; \\"
  echotab "    if test -f \$\${cache} ; then \\"
  echotab "      . \$\${cache}; \\"
  for var in ${PRECIOUS_VARS}; do
    echotab "      if test \"\$\${ac_cv_env_${var}_set}\" = set; then ${var}=\"\$\${ac_cv_env_${var}_value}\"; export ${var}; fi; \\"
  done
  # we must use $(SHELL) for sub-configures because when the top CONFIG_SHELL
  # is bash, config.cache may be unparsable with sh on Solaris
  echotab "      \$(SHELL) \$\$m/configure --with-clisp=\"${HEREP}/clisp -K ${LINKING_SET} ${someflags}\" --cache-file=\$\${cache} --srcdir=\$\$m \$(MODULE_CONFIGURE_FLAGS);\\"
  echotab "    else \\"
  echotab "      \$(SHELL) \$\$m/configure --srcdir=\$\$m \$(MODULE_CONFIGURE_FLAGS); \\"
  echotab "    fi ) ;\\"
  echotab "fi; \\"
  # srcdir must be correct in Makefile because clisp-link calls link.sh
  # which cannot pass srcdir to make on the command line.
  # The 'if' condition here tests whether $$m/Makefile is newer than $@/Makefile.
  echotab "if test -f \$\$m/Makefile && { test ! -f \$@/Makefile || test -n \"\`find \$\$m/Makefile -prune -newer \$@/Makefile\`\"; } ; then \\"
  echotab "  sed \"s,srcdir = .,srcdir = \$\$m,\" \"\$\$m/Makefile\" > \$@/Makefile ; \\"
  echotab "fi ; \\"
  echotab "CLISP=\"${HEREP}/clisp -K ${LINKING_SET} ${someflags}\" ; \\"
  echotab "cd \$@ ; \$(MAKE) clisp-module CC=\"\$(CC)\" CPPFLAGS=\"\$(MODULE_CPPFLAGS)\" CFLAGS=\"\$(${MODULE_CFLAGS_VAR})\" CLFLAGS=\"\$(${MODULE_CLFLAGS_VAR})\" LIBS=\"\$(LIBS)\" RANLIB=\"\$(RANLIB)\" CLISP=\"\$\$CLISP -q\" SHREXT=${SHREXT}"
  echol
}
make_modules BASE_MODULES boot basemodule
make_modules MODULES base fullmodule

cygwin_finish() {
  # make sure no cygwin libraries crept into the mingw distribution
  if [ "$host_os" = cygwin -a "${TSYS}" = win32gcc ]; then
    # cygcheck can fail with symlinks so resolve them
    # 'cyg[^/\\\\]*\$\$' here should look as 'cyg[^/\]*$' for grep
    echotab "if cygcheck \`realpath $1/lisp.exe | cygpath --windows -f -\` | grep 'cyg[^/\\\\]*\$\$'; then false; else true; fi"
  fi
  finish_runtime $1/lisp${LEXE}
}

# base is always linked statically
echol "base : modular boot \$(BASE_MODULES)"
echotab "\$(RMRF) base"
echotab "MAKE=\$(MAKE) CLISP=\"${HEREP}/clisp -K boot ${someflags}\" with_dynamic_modules=no ${HERE}clisp-link add boot base \$(BASE_MODULES) || (\$(RMRF) base ; exit 1)"
cygwin_finish base

# full is built dynamically unless explicitly requested otherwise
echol "full : modular base \$(MODULES)"
echotab "\$(RMRF) full"
test "${with_dynamic_modules}" = no || echotab "rm -rf dynmod; mkdir dynmod"
echotab "MAKE=\$(MAKE) CLISP=\"${HEREP}/clisp ${someflags}\" ${HERE}clisp-link add base full \$(MODULES) || (\$(RMRF) full ; exit 1)"
# show which system supplied functionality is replaced by gnulib
test "${verbose}" = true -o "${verbose}" = yes && \
  echotab 'grep "^REPLACE_.*='"'1'"'" `find . -name config.log` || true'
cygwin_finish full

echol "mod-check : base-mod-check full-mod-check"
echol
modcheck(){                     # $1=clisp command; $2=MODULES variable
  echotab 'for m in "" $('$2'); do test -n "$$m" && $(RM) $$m/*.erg; done'
  echotab 'z=""; for m in "" $('$2'); do test -n "$$m" && z=$$z" \""$$m/\"; done; '"$1${someflags} -C -i ${TESTSDIR}/tests"' -x "(ext:exit (plusp (or (run-some-tests :dirlist '"'"'($$z) :srcdir \"'${MODULESDIR_}'\" :outdir \"./\") 0)))"'
  echol
}
echol "base-mod-check : clisp${TEXE} ${TESTSDIR} # base"
modcheck "./clisp" BASE_MODULES
echol "full-mod-check : clisp${TEXE} ${TESTSDIR} # full"
if [ "${with_dynamic_modules}" = no ]; then
  modcheck "./clisp -K full" MODULES
else
  modcheck "./clisp" MODULES
fi

manual_print=''
if test -n "$GROFF"; then
  for f in ${MANPAGES}; do
    manual_print="${manual_print} $f.ps"
    test -n "$PS2PDF" && manual_print="$manual_print $f.pdf"
  done
fi
TOP_DOC="ANNOUNCE COPYRIGHT GNU-GPL SUMMARY"
READMES="${TOP_DOC} NEWS README README.de README.es"
test $TOS = unix && READMES=${READMES}' MAGIC.add'
test ${HSYSOS} = cygwin && READMES=${READMES}' cygwin.README'
echol "READMES = ${READMES}"
IMPNOTES_FILES="impnotes.html impnotes.css clisp.png"
test ${HOS} = win32 && IMPNOTES_FILES=${IMPNOTES_FILES}" clisp.ico"
echol "IMPNOTES_FILES = ${IMPNOTES_FILES}"
manpages1html=''
manpages_less=''
for f in ${MANPAGES}; do
  manpages1html="${manpages1html} $f.1 $f.html";
  manpages_less="${manpages_less} $f.man";
done
echol "MANUALS =${manpages1html} \$(TXTFILES) \$(IMPNOTES_FILES)"
echol
for f in ${IMPNOTES_FILES} ${TXT_DOCS}; do
  link_dep "${f}" "${SRCDOCDIR_M}${f}" "${SRCDOCDIR_}${f}"
done
EMACS_FILES="clhs.el clisp-coding.el clisp-indent.el clisp-indent.lisp clisp-ffi.el"
VIM_FILES="lisp.vim"
ACLOCAL_FILES="clisp.m4"

# On Unix, clisp.ps & clisp.pdf must be built by "make all",
# because "make install" needs it and "make install" must not create files in
# the current directory, for compliance with the GNU standards.
# On other OSes, clisp.ps & clisp.pdf must be built manually on another
# machine, so don't make it part of "make all".
if [ $HOS = unix ] ; then
  echol "manual : \$(READMES) \$(MANUALS) ${manual_print}"
  echodummyrule manual
  echol
  echol "manualx : manual${manpages_less}"
  echodummyrule manualx
  echol
else
  echol "manual : \$(READMES) \$(MANUALS)"
  echodummyrule manual
  echol
  echol "manualx : manual${manpages_less} ${manual_print}"
  echodummyrule manualx
  echol
fi

for f in ${TOP_DOC} ; do
  link_dep "${f}" "${SRCTOPDIR_M}${f}" "${SRCTOPDIR_}${f}"
done

if [ -n "${SRCDIR}" ] ; then
  for f in NEWS .gdbinit ; do
    echol "${f} : ${SRCDIR}${f}"
    if [ $f = .gdbinit -a $LEXE != ".run" ]; then
      echotab "sed 's/lisp.run/lisp$LEXE/g' ${SRCDIR}${f} > ${f}"
    else
      echotab "-\$(LN_S) ${SRCDIR}${f} ${f}"
    fi
    echol
  done
fi

if [ $TOS = unix ] ; then
  for f in MAGIC.add ; do
    link_dep "${f}" "${SRCTOPDIR}unix${NEXT}${f}"
  done
fi

for f in $TXT_FILES ; do
  depends=''
  flags=' -I. -DCOMPILE_STANDALONE'
  test $f = README && depends=$depends" ${SRCDIR}_${f}.de ${SRCDIR}_${f}.en"
  platform_line=""
  case $f in
    clisp.html | clisp.1 | clisp-1.html | \
    clisp-link.html | clisp-link.1 | clisp-link-1.html )
      if [ $HOS = win32 ]; then
        platform_line=" | sed -e \"s,@PLATFORM@,${TSYS},g\""
      else
        platform_line=" | sed -e \"s,@PLATFORM@,${host},g\""
      fi
      sourcedir=${SRCDOCDIR} ;;
    *) sourcedir=${SRCDIR} ;;
  esac
  echol "${f} : ${sourcedir}_${f}${TXT_INCLUDES}${depends} txt2c${HEXE} ${GLLIB_A}"
  g="gen-${f}"
  # The naïve choice of the executable name g would lead to the error
  # "xlc: 1501-218 (S) file gen-clisp.c contains an incorrect file suffix" on AIX.
  g=`echo "${g}" | sed -e 's/[.]//g'`
  echotab "\$(TXT2C) < ${sourcedir}_${f} > ${g}.c"
  echotab_to_HEXE "\$(CC) \$(CPPFLAGS) \$(CFLAGS)${flags} \$(CLFLAGS)${XCC_NOOPTFLAGS}" "${g}.c ${GLLIB_A}" "${g}"
  line="${HERE}${g}"
  test $f = clisp.1 -o $f = clisp-link.1 && \
    line=$line" | \$(GREP) -v ${ARGQ1}^ *\$\$${ARGQ1}"
  # *-1.html is for chunked impnotes and does not depend on user hyperspec
  test \( $f = clisp.html -o $f = clisp-link.html \) \
       -a "${HSDEFAULT}" != "${hyperspec}" && \
    line=$line" | sed -e ${ARGQ}s,=${QQUOT}${HSDEFAULT},=${QQUOT}${hyperspec},${ARGQ}"
  test $f = distmakefile && line=$line" | sed -e \"s,@@LEXE@@,${LEXE},g\" -e \"s:@@EXPORT_DYNAMIC_FLAG_SPEC@@:${EXPORT_DYNAMIC_FLAG_SPEC}:g\""
  line=$line$platform_line
  echotab "${line} > ${f}"
  echotab "\$($EXERM) ${g}.c $(exefiles ${g})"
  echol
  OBSOLETE=$OBSOLETE" ${g}.c $(exefiles ${g})"
done

for f in ${MANPAGES}; do
  if test -n "$GROFF"; then
    echol "$f.ps : $f.1"
    echotab "-\$(ROFF_PS) $f.1 > $f.ps"
    echol
    if test -n "$PS2PDF"; then
      echol "$f.pdf : $f.ps"
      echotab "-\$(PS2PDF) $f.ps $f.pdf"
      echol
    fi
  fi
  echol "$f.man : $f.1"
  echotab "\$(ROFF_MAN) $f.1 > $f.man"
  echol
done

if [ $CROSS = false ] ; then
  DRIVER_DEP=''; DRIVER_RES=''
  if [ $HOS = win32 ]; then
    DRIVER_RES=" clispres${TOBJ}"
    DRIVER_DEP=${DRIVER_RES}" ${SRCDIR}w32shell.c ${SRCDIR}execname.c"
    echol "clispres${TOBJ} : clisp.rc clisp.ico"
    if [ ${TSYS} = win32gcc ]; then
      echotab "${WINDRES} -i clisp.rc -o clispres.o"
    else
      echotab "rc /v /foclisp.res clisp.rc"
      echotab "cvtres /verbose /out:clispres.obj clisp.res"
      echotab "-\$(RM) clisp.res"
    fi
    echol
    # NB: we link clisp.rc into the driver clisp.exe but _not_ into the
    #     run-time lisp.exe because then the latter does not have an icon
    #     and the users are less likely to run it without the memory image
    echol "clisp.rc : ${SRCDIR}clisp.rc.in Makefile"
    PRODUCTVERSION=`echo ${VERSION_NUMBER} | sed -e 's/\./,/g' -e 's/\+//g'`
    case "${PRODUCTVERSION}" in
      *,*,*,* ) ;;
      *,*,* ) PRODUCTVERSION="${PRODUCTVERSION},0" ;;
      *,* ) PRODUCTVERSION="${PRODUCTVERSION},0,0" ;;
    esac
    FILEFLAGS="0"
    if [ "${with_debug}" != no ] ; then
      FILEFLAGS="${FILEFLAGS}|VS_FF_DEBUG"
    fi
    case "${VERSION_NUMBER}" in
      *++) FILEFLAGS="${FILEFLAGS}|VS_FF_PRERELEASE|VS_FF_PATCHED" ;;
      *+)  FILEFLAGS="${FILEFLAGS}|VS_FF_PATCHED" ;;
    esac
    if [ "${with_unicode}" != no ];
    then CHARSET=04B0           # Unicode
    else CHARSET=0000           # 7-bit ASCII
    fi
    echotab "sed -e 's/\@CLISP_PRODUCTVERSION\@/${PRODUCTVERSION}/g' \\"
    echotab "    -e 's/\@CLISP_FILEFLAGS\@/${FILEFLAGS}/g' \\"
    echotab "    -e 's/\@CLISP_CHARSET\@/${CHARSET}/g' \\"
    echotab "    -e 's/\@CLISP_NAME\@/\$(PACKAGE_NAME)/g' \\"
    echotab "    -e 's/\@CLISP_VERSION\@/\$(PACKAGE_VERSION)/g' \\"
    echotab "    ${SRCDIR}clisp.rc.in > clisp.rc"
    echol
  fi
  DRIVERFLAGS=''
  case "$host_os" in
    hpux*)
      # gcc-2.95.2 on HP-UX 10 miscompiles clisp.c when optimization -O is used.
      test $XCC_GCC = true && DRIVERFLAGS=' -O0'
      ;;
  esac
  echol "clisp${TEXE} : clisp.c${DRIVER_DEP}"
  echotab "\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(CLFLAGS)${DRIVERFLAGS} -DENABLE_RELOCATABLE clisp.c${DRIVER_RES} ${LIBS} ${OUT}clisp${TEXE}"
  echol
  if [ $HOS = unix ] ; then
    echol "install : install-bin install-man install-doc"
    echodummyrule install
    echol
    echol "installdirs : force"
    echotab "mkdir -p \$(DESTDIR)\$(prefix)"
    echotab "mkdir -p \$(DESTDIR)\$(exec_prefix)"
    echotab "mkdir -p \$(DESTDIR)\$(libdir)"
    echotab "mkdir -p \$(DESTDIR)\$(lisplibdir)"
    echotab "mkdir -p \$(DESTDIR)\$(lisplibdir)/data"
    echotab "mkdir -p \$(DESTDIR)\$(lisplibdir)/linkkit"
    echotab "mkdir -p \$(DESTDIR)\$(lisplibdir)/base"
    echotab "mkdir -p \$(DESTDIR)\$(lisplibdir)/full"
    echotab "mkdir -p \$(DESTDIR)\$(bindir)"
    if test -n "$USE_GETTEXT"; then
      echotab "cd po && \$(MAKE) installdirs DESTDIR='\$(DESTDIR)' prefix='\$(prefix)' exec_prefix='\$(exec_prefix)'"
      case "$host_os" in
        solaris*)
          # The non-GNU dgettext() function in Solaris libc needs symbolic links.
          # For the list of locale names, see spvw_language:init_language().
          for localename in en_US de_DE fr_FR es_ES nl_NL ru_RU da_DK sv_SE; do
            ll=`echo "${localename}" | sed -e 's/_.*//'`
            echotab "test -d '\$(DESTDIR)\$(prefix)/locale/${localename}.UTF-8/LC_MESSAGES' || ln -s '${ll}' '\$(DESTDIR)\$(prefix)/locale/${localename}.UTF-8'"
          done
          ;;
      esac
    fi
    echotab "mkdir -p \$(DESTDIR)\$(datarootdir)"
    echotab "mkdir -p \$(DESTDIR)\$(elispdir)"
    echotab "mkdir -p \$(DESTDIR)\$(vimdir)"
    echotab "mkdir -p \$(DESTDIR)\$(aclocaldir)"
    echotab "mkdir -p \$(DESTDIR)\$(mandir)"
    echotab "mkdir -p \$(DESTDIR)\$(mandir)/man1"
    case "$fsstnd" in
      gnu_ext)
        echotab "mkdir -p \$(DESTDIR)\$(htmldir)"
        echotab "mkdir -p \$(DESTDIR)\$(psdir)"
        echotab "mkdir -p \$(DESTDIR)\$(pdfdir)"
        ;;
      *bsd)
        echotab "mkdir -p \$(DESTDIR)\$(docdir)"
        ;;
    esac
    echotab "mkdir -p \$(DESTDIR)\$(docdir)"
    case "$fsstnd" in
      *bsd)
        ;;
      *)
        echotab "mkdir -p \$(DESTDIR)\$(docdir)/doc"
        ;;
    esac
    echol
    if [ "${with_dynamic_modules}" != no ]; then
      depends="full install-modules force"
      line='linkkit base'
      echol "install-modules : full force"
      echotab "mkdir -p \$(DESTDIR)\$(lisplibdir)/dynmod"
      echotab "DESTDIR=\`cd \"\$(DESTDIR)\$(lisplibdir)\"; pwd\` CLISP='./clisp -q -norc' ./clisp-link install \$(MODULES)"
      echol
    else
      depends="full force"
      line='linkkit base full'
    fi
    echol "install-bin : ${depends}"
    echotab "mkdir -p \$(DESTDIR)\$(prefix)"
    echotab "mkdir -p \$(DESTDIR)\$(exec_prefix)"
    echotab "mkdir -p \$(DESTDIR)\$(libdir)"
    echotab "mkdir -p \$(DESTDIR)\$(lisplibdir)"
    echotab "mkdir -p \$(DESTDIR)\$(lisplibdir)/data"
    for f in ${DATA_FILES}; do
      echotab "\$(INSTALL_DATA) data/${f} \$(DESTDIR)\$(lisplibdir)/data/${f}"
    done
    echotab "(cd \$(DESTDIR)\$(lisplibdir) && \$(RMRF) base full)"
    echotab "mkdir -p \$(DESTDIR)\$(lisplibdir)/build-aux"
    echotab "for f in ${BUILD_AUX}; do \$(INSTALL_DATA) build-aux/\$\$f \$(DESTDIR)\$(lisplibdir)/build-aux/\$\$f; done"
    echotab "for d in ${line}; do for f in \$\$d/*; do \\"
    echotab "  mkdir -p \$(DESTDIR)\$(lisplibdir)/\$\$d; \\"
    echotab "  case \$\$f in \\"
    echotab "    */lisp${LEXE}) \$(INSTALL_PROGRAM) \$\$f \$(DESTDIR)\$(lisplibdir)/\$\$f;; \\"
    echotab "    *) \$(INSTALL_DATA) \$\$f \$(DESTDIR)\$(lisplibdir)/\$\$f;; \\"
    echotab "  esac; \\"
    echotab "done; done"
    echotab "mkdir -p \$(DESTDIR)\$(bindir)"
    echotab "\$(INSTALL_SCRIPT) clisp-link \$(DESTDIR)\$(bindir)/clisp-link"
    # Don't strip the executables, otherwise (disassemble #'cons)
    # and saveinitmem/:executable won't work.
    # echotab "strip \$(DESTDIR)\$(lisplibdir)/base/lisp${LEXE}"
    if test -n "$USE_GETTEXT"; then
      echotab "cd po && \$(MAKE) install DESTDIR='\$(DESTDIR)' prefix='\$(prefix)' exec_prefix='\$(exec_prefix)'"
      case "$host_os" in
        solaris*)
          # The non-GNU dgettext() function in Solaris libc needs symbolic links.
          # For the list of locale names, see spvw_language:init_language().
          for localename in en_US de_DE fr_FR es_ES nl_NL ru_RU da_DK sv_SE; do
            ll=`echo "${localename}" | sed -e 's/_.*//'`
            echotab "test -d '\$(DESTDIR)\$(prefix)/locale/${localename}.UTF-8/LC_MESSAGES' || ln -s '${ll}' '\$(DESTDIR)\$(prefix)/locale/${localename}.UTF-8'"
          done
          ;;
      esac
    fi
    echotab "\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(CLFLAGS)${DRIVERFLAGS} -DLISPLIBDIR='\"\$(lisplibdir)\"' -DLOCALEDIR='\"\$(localedir)\"' clisp.c ${GLLIB_A} -o \$(DESTDIR)\$(bindir)/clisp"
    echotab "mkdir -p \$(DESTDIR)\$(elispdir)"
    for f in ${EMACS_FILES}; do
      echotab "\$(INSTALL_DATA) ${SRCTOPDIR}emacs/$f \$(DESTDIR)\$(elispdir)/$f"
    done
    echotab "mkdir -p \$(DESTDIR)\$(vimdir)"
    for f in ${VIM_FILES}; do
      echotab "\$(INSTALL_DATA) ${SRCTOPDIR}emacs/$f \$(DESTDIR)\$(vimdir)/$f"
    done
    echotab "mkdir -p \$(DESTDIR)\$(aclocaldir)"
    for f in ${ACLOCAL_FILES}; do
      echotab "\$(INSTALL_DATA) ${SRCDIR}m4/$f \$(DESTDIR)\$(aclocaldir)/$f"
    done
    echol
    echol "install-man : ${manpages1html} ${manual_print} force"
    echotab "mkdir -p \$(DESTDIR)\$(prefix)"
    echotab "mkdir -p \$(DESTDIR)\$(exec_prefix)"
    echotab "mkdir -p \$(DESTDIR)\$(datarootdir)"
    echotab "mkdir -p \$(DESTDIR)\$(mandir)"
    echotab "mkdir -p \$(DESTDIR)\$(mandir)/man1"
    for f in ${MANPAGES}; do
      echotab "\$(INSTALL_DATA) $f.1 \$(DESTDIR)\$(mandir)/man1/$f.1"
    done
    case "$fsstnd" in
      gnu_ext)
        echotab "mkdir -p \$(DESTDIR)\$(htmldir)"
        echotab "mkdir -p \$(DESTDIR)\$(psdir)"
        echotab "mkdir -p \$(DESTDIR)\$(pdfdir)"
        for f in ${MANPAGES}; do
          echotab "\$(INSTALL_DATA) $f.html \$(DESTDIR)\$(htmldir)/$f.html"
          if test -n "$GROFF"; then
            echotab "\$(INSTALL_DATA) $f.ps  \$(DESTDIR)\$(psdir)/$f.ps"
            test -n "$PS2PDF" && \
              echotab "\$(INSTALL_DATA) $f.pdf \$(DESTDIR)\$(pdfdir)/$f.pdf"
          fi
        done
        ;;
      *bsd)
        echotab "mkdir -p \$(DESTDIR)\$(docdir)"
        for f in ${MANPAGES}; do
          echotab "\$(INSTALL_DATA) $f.html \$(DESTDIR)\$(docdir)/$f.html"
        done
        ;;
    esac
    echol
    echol "install-doc : \$(READMES) \$(MANUALS) ${manual_print} force"
    echotab "mkdir -p \$(DESTDIR)\$(prefix)"
    echotab "mkdir -p \$(DESTDIR)\$(exec_prefix)"
    echotab "mkdir -p \$(DESTDIR)\$(docdir)"
    echotab "\$(INSTALL_DATA) \$(READMES) \$(DESTDIR)\$(docdir)/"
    case "$fsstnd" in
      *bsd)
        echotab "\$(INSTALL_DATA) \$(MANUALS) ${manual_print} \$(DESTDIR)\$(docdir)/"
        ;;
      *)
        echotab "mkdir -p \$(DESTDIR)\$(docdir)/doc"
        echotab "\$(INSTALL_DATA) \$(MANUALS) ${manual_print} \$(DESTDIR)\$(docdir)/doc/"
        ;;
    esac
    if [ ${HSYSOS} = cygwin ]; then
      echotab "mkdir -p \$(DESTDIR)\$(docdir)/../Cygwin"
      echotab "\$(INSTALL_DATA) cygwin.README \$(DESTDIR)\$(docdir)/../Cygwin/clisp-\$(VERSION).README"
    fi
    echol
    echol
    echol "installcheck : ${TESTSDIR} force"
    echotab "cd ${TESTSDIR} && \$(MAKE) LISP=\"\$(bindir)/clisp ${someflags}\""
    echol
    echol
    echol "uninstall : uninstall-bin uninstall-man"
    echodummyrule uninstall
    echol
    echol "uninstall-bin : force"
    echotab "\$(RMRF) \$(DESTDIR)\$(lisplibdir)"
    if [ ${HSYSOS} = cygwin ]; then
      echotab "\$(RM) \$(DESTDIR)\$(docdir)/Cygwin/clisp-\$(VERSION).README"
      echotab "\$(RM) \$(DESTDIR)\$(bindir)/clisp.exe"
    else
      echotab "\$(RM) \$(DESTDIR)\$(bindir)/clisp"
    fi
    echotab "\$(RM) \$(DESTDIR)\$(bindir)/clisp-link"
    test -n "$USE_GETTEXT" && \
      echotab "cd po && \$(MAKE) uninstall DESTDIR='\$(DESTDIR)' prefix='\$(prefix)' exec_prefix='\$(exec_prefix)'"
    echol
    echol "uninstall-man : force"
    for f in ${MANPAGES}; do
      echotab "\$(RM) \$(DESTDIR)\$(mandir)/man1/$f.1"
      case "$fsstnd" in
        gnu_ext)
          echotab "\$(RM) \$(DESTDIR)\$(htmldir)/$f.html"
          echotab "\$(RM) \$(DESTDIR)\$(psdir)/$f.ps"
          echotab "\$(RM) \$(DESTDIR)\$(pdfdir)/$f.pdf"
          ;;
      esac
    done
    echotab "\$(RMRF) \$(DESTDIR)\$(docdir)"
    for f in ${EMACS_FILES}; do
      echotab "\$(RMRF) \$(DESTDIR)\$(elispdir)/$f*"
    done
    for f in ${VIM_FILES}; do
      echotab "\$(RMRF) \$(DESTDIR)\$(vimdir)/$f"
    done
    for f in ${ACLOCAL_FILES}; do
      echotab "\$(RMRF) \$(DESTDIR)\$(aclocaldir)/$f"
    done
    echol
    echol
  fi
fi

echo_dist_modules () {
  echotab "for module in '' \$(BASE_MODULES) \$(MODULES); do if test -n \"\$\$module\"; then \\"
  echotab "  (dir=$1/ ; for subdir in "'`'"echo \$\$module/ | sed -e 's,/, ,g'"'`'" ; do dir=\$\${dir}\$\${subdir} ; test -d \$\${dir} || mkdir \$\${dir} ; dir=\$\${dir}/ ; done ; cd \$\$module ; \$(MAKE) SHREXT=${SHREXT} clisp-module-distrib distribdir=$1/\$\$module/ LN="$2") \\"
  echotab "fi; done$3"
}
if [ ${HSYSOS} = cygwin ]; then
  echol "full/lisp.exe : full"
  echol
  echol "# Makefile: \$(MODULES)"
  echol "# full/lisp.exe: dependencies"
  echol "setup.hint : SUMMARY # Makefile full/lisp.exe"
  echotab "\$(RM) setup.hint"
  echol "# normally curr/prev/test are not needed"
  echol "# but if one is present, at least curr+prev are required"
  echol "# echo 'curr : \$(VERSION)-1' >> setup.hint"
  echol "# echo 'prev : \$(VERSION)-1' >> setup.hint"
  echol "# echo 'test : \$(VERSION)-1' >> setup.hint"
  echotab "echo 'sdesc: \"an ANSI Common Lisp implementation\"' >> setup.hint"
  echotab "echo 'category: Devel Interpreters Math Shells' >> setup.hint"
  echotab 'REQ=""; for f in `cygcheck full/lisp.exe`; do echo "* "$$f; f=`cygpath -u $$f`; REQ=$${REQ}" "`cygcheck -f $$f|sed "s/-.*//"`; done; REQ=`echo $${REQ} | tr " " "\012" | sort -u`; echo "="$${REQ}; echo "requires: "$${REQ} >> setup.hint'
  echotab "echo 'ldesc: \"' >> setup.hint"
  echotab "cat SUMMARY >> setup.hint"
  echotab "echo >> setup.hint"
  echotab "echo 'This binary distribution was built with the following modules:' >> setup.hint"
  echotab "echo ' '\$(MODULES) >> setup.hint"
  echotab "echo '\"' >> setup.hint"
  echol
  echol "cygwin.README : setup.hint makemake"
  echotab "echo 'CLISP: an ANSI Common Lisp implementation' > cygwin.README"
  echotab "echo '' >> cygwin.README"
  echotab "grep requires setup.hint >> cygwin.README"
  echotab "echo 'recommended: libsigsegv http://sourceforge.net/projects/libsigsegv' >> cygwin.README"
  echotab "echo '' >> cygwin.README"
  echotab "echo 'builds \"out of the box\" on cygwin:' >> cygwin.README"
  echotab "echo './configure$makemake_args --cbc --install build-cygwin' >> cygwin.README"
  echotab "echo 'will configure, build and install CLISP' >> cygwin.README"
  echotab "echo 'see unix/INSTALL for details' >> cygwin.README"
  echotab "echo '' >> cygwin.README"
  echotab "cat SUMMARY >> cygwin.README"
  echol
  echol "CLISP_VR=\$(TOPDIR)-1"
  echol "CLISP_SCRIPT=\$(CLISP_VR).sh"
  echol "CLISP_CYGWIN=\$(TOPDIR)-cygwin-${UNAME_R}.tar.bz2"
  echol "DEST_TMP=/tmp/clisp-install"
  echol "distrib : setup.hint cygwin.README force"
  echotab "\$(RMRF) \$(DEST_TMP) \$(CLISP_VR).tar.bz2; mkdir -p \$(DEST_TMP)"
  echotab "\$(MAKE) install prefix=/usr DESTDIR=\$(DEST_TMP)"
  echotab "builddir=\"\`pwd\`\"; cd \$(DEST_TMP); tar cvfj \"\$\$builddir\"/\$(CLISP_CYGWIN) *"
  echotab "ln \$(CLISP_CYGWIN) \$(CLISP_VR).tar.bz2"
  echotab "\$(RMRF) \$(DEST_TMP)"
  echol
  echol "TAR_SRC=\"../../archives/\$(VERSION)/\$(TOPDIR).tar.bz2\""
  echol "cygwin-src : setup.hint force"
  echotab "touch \$(CLISP_VR).patch"
  echotab "echo '#!/bin/sh' > \$(CLISP_SCRIPT)"
  echotab "echo './configure$makemake_args --cbc build-cygwin' >> \$(CLISP_SCRIPT)"
  echotab "echo 'cd build-cygwin' >> \$(CLISP_SCRIPT)"
  echotab "echo 'make distrib' >> \$(CLISP_SCRIPT)"
  echotab "ln -s \$(TAR_SRC) ."
  echotab "tar cvfjh \$(CLISP_VR)-src.tar.bz2 \$(CLISP_SCRIPT) \$(CLISP_VR).patch setup.hint cygwin.README \$(TOPDIR).tar.bz2"
  echotab "\$(RMRF) \$(TOPDIR).tar.bz2 \$(CLISP_SCRIPT) \$(CLISP_VR).patch"
  echol
elif [ ${HOS} = unix ] ; then   # but not cygwin!
COMPRESS=@COMPRESS@
if [ -z "${COMPRESS}" ]; then
  echol "# tar"
  echol "PACKEXT=.tar"
else
  echol "# tar+gzip"
  echol "PACKEXT=.tar.gz"
  echol "COMPRESS=${COMPRESS}"
fi
echol
echol "# Temporary directory for packing"
echol "PACKDIR = ."
echol
echol "# Distribution file"
echol "DISTFILE=\$(PACKDIR)/\$(TOPDIR)-${host}-${UNAME_R}\$(PACKEXT)"
echol
needs='all'
if test "$HLN" != ln; then
  needs=$needs' hln'
  echol "hln : ${SRCTOPDIR}utils/hln.lisp"
  echotab "-\$(RM) hln"
  echotab "sed 's,@''CLISP''@,`pwd`/clisp,' ${SRCTOPDIR}utils/hln.lisp > hln"
  echotab "chmod +x hln"
  echol
fi
# hln merges pathnames, which means that if the source pathname is absolute,
# the destination must be absolute as well!
echol "FULLTOPDIR = `pwd`/\$(TOPDIR)"
echol "distrib : force $needs modular manualx clisp.c distmakefile"
echotab "\$(RMRF) \$(TOPDIR) \$(DISTFILE) clisp\$(PACKEXT)"
echotab "mkdir \$(TOPDIR)"
# General documentation files.
echotab "${HLN} ${READMES} \$(TOPDIR)/"
# The linking sets: base and full.
for dir in base full; do
  echotab "mkdir \$(TOPDIR)/${dir}"
  echotab "${HLN} "'`'". ${dir}/makevars ; for f in \$\$FILES modules.h modules.o makevars lispinit.mem ; do echo ${dir}/\$\$f ; done"'`'" \$(TOPDIR)/${dir}/"
  # make sure base & full do not link to anything outside
  echotab ". ./makevars; for f in \$\$LIBS ; do case \$\$f in -*) ;; \\"
  echotab "   *) b=\`basename \$\$f\`; \\"
  echotab "      if test ! -f ${dir}/\$\$b; then \\"
  if [ "${dir}" = base ]; then
    echotab "        ${HLN} \$\$f \$(FULLTOPDIR)/${dir}/; fi; \\"
  else
    echotab "        if test -f base/\$\$b; then \\"
    echotab "          ${HLN} base/\$\$b \$(FULLTOPDIR)/${dir}/; \\"
    echotab "        else \\"
    echotab "          ${HLN} \$\$f \$(FULLTOPDIR)/${dir}/; fi; \\"
    echotab "        fi ;; \\"
  fi
  echotab "esac ; done"
  if test -n "$BINARY_DISTRIB"; then
    echotab "cp ${dir}/lisp${LEXE} \$(TOPDIR)/${dir}/lisp${LEXE}"
    # Don't strip the executable, otherwise (disassemble #'cons)
    # and (saveinitmem ... :executable t) won't work.
    # echotab "strip \$(TOPDIR)/${dir}/lisp${LEXE}"
    echotab "chmod a+x \$(TOPDIR)/${dir}/lisp${LEXE}"
  fi
done
# The Makefile, generated from distmakefile.
if test -z "$BINARY_DISTRIB"; then
  echotab "cat distmakefile \\"
  for dir in base full; do
    DIR=`echo "${dir}" | tr '[a-z]' '[A-Z]'`
    echotab "| { . ${dir}/makevars ; ${dir}_files='' ; \\"
    echotab " for f in modules.o \$\$FILES ; do \\"
    echotab "   ${dir}_files=\"\$\$${dir}_files\"' ${dir}/'\"\$\$f\" ; \\"
    echotab " done ; \\"
    echotab " ${dir}_libs='' ; \\"
    echotab " for f in modules.o \$\$LIBS ; do \\"
    echotab "   case \$\$f in \\"
    echotab "     -*) ${dir}_libs=\"\$\$${dir}_libs \$\$f\";; \\"
    echotab "     *) ${dir}_libs=\"\$\$${dir}_libs\"' ${dir}/'\"\`basename \$\$f\`\";; \\"
    echotab "   esac ; \\"
    echotab " done ; \\"
    echotab " sed_escape_commas='s/,/\\\\,/g' ; \\"
    echotab " ${dir}_libs=\`echo \"\$\$${dir}_libs\" | sed -e \"\$\$sed_escape_commas\"\` ; \\"
    echotab " sed -e \"s,@@${DIR}_FILES@@,\$\$${dir}_files,\" -e \"s,@@${DIR}_LIBS@@,\$\$${dir}_libs,\"; } \\"
  done
  echotab "   > \$(TOPDIR)/Makefile"
else
  echotab "${HLN} distmakefile \$(TOPDIR)/Makefile"
fi
# Architecture independent data files.
if [ -n "$USE_GETTEXT" ] ; then
  echotab "for f in \`find locale -type d -print\`; do mkdir \$(TOPDIR)/\$\$f; done"
  echotab "for f in \`find locale -type f -print\`; do ${HLN} \$\$f \$(TOPDIR)/\$\$f; done"
fi
if [ "${with_dynamic_modules}" != no ]; then
  echotab "mkdir \$(TOPDIR)/dynmod"
  echotab "${HLN} dynmod/* \$(TOPDIR)/dynmod/"
fi
echotab "mkdir \$(TOPDIR)/data"
echotab "${HLN} data/* \$(TOPDIR)/data/"
echotab "mkdir \$(TOPDIR)/doc"
echotab "${HLN} ${manpages1html} ${manpages_less} ${manual_print} \$(TXTFILES) \$(IMPNOTES_FILES) \$(TOPDIR)/doc/"
echotab "mkdir \$(TOPDIR)/emacs"
line="${HLN}";
for f in ${EMACS_FILES} ${VIM_FILES}; do
  line="${line} ${SRCTOPDIR}emacs/${f}"
done
echotab "${line} \$(FULLTOPDIR)/emacs/"
echotab "mkdir \$(TOPDIR)/misc"
line="${HLN}";
for f in ${ACLOCAL_FILES}; do line="${line} ${SRCDIR}m4/$f"; done
echotab "${line} \$(FULLTOPDIR)/misc/"
echotab "mkdir \$(TOPDIR)/src"
echotab "${HLN} \$(LISPFILES) \$(FASFILES) \$(FULLTOPDIR)/src/"
echotab "${HLN} clisp-link \$(TOPDIR)/"
echotab "mkdir \$(TOPDIR)/linkkit"
echotab "for f in ${LINKKIT}; do ${HLN} linkkit/\$\$f \$(TOPDIR)/linkkit/; done"
echotab "mkdir \$(TOPDIR)/build-aux"
echotab "cd build-aux && ${HLN} ${BUILD_AUX} \$(FULLTOPDIR)/build-aux"
echo_dist_modules "\$(FULLTOPDIR)" ${HLN} ""
# For building the `clisp' executable.
if test -z "$BINARY_DISTRIB"; then
  echotab "${HLN} clisp.c ${SRCDIR}execname.c \$(TOPDIR)/src/"
else
  echotab_to_HEXE "\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(CLFLAGS) -DLISPLIBDIR='\"\$(lisplibdir)\"' -DLOCALEDIR='\"\$(localedir)\"'" "clisp.c ${GLLIB_A}" "\$(TOPDIR)/clisp"
  echotab_to_HEXE "\$(CC) \$(CPPFLAGS) \$(CFLAGS) \$(CLFLAGS) -I." "${UTILDIR_CC}hardcode.c ${GLLIB_A}" "\$(TOPDIR)/hardcode"
fi
# Final packing.
echotab "chmod a+r \$(TOPDIR) \$(TOPDIR)/* \$(TOPDIR)/*/*"
echotab "chmod a+x \$(TOPDIR)/. \$(TOPDIR)/*/."
if [ -z "${COMPRESS}" ]; then
  echotab "tar cvfh \$(DISTFILE) \$(TOPDIR)"
else
  echotab "tar cvfh - \$(TOPDIR) | \$(COMPRESS) > \$(DISTFILE)"
fi
echotab "${HLN} \$(DISTFILE) clisp\$(PACKEXT)"
echotab "\$(RMRF) \$(TOPDIR)"
echol
echol
elif [ $HOS = win32 ] ; then
  echol "# Distribution, to be executed on a Unix host or using Cygwin."
  echol "distrib : install.lisp install.bat config.lisp ${manpages_less} clisp.html COPYRIGHT.rtf env_var_update.nsh install.nsi is_user_admin.nsh force"
  echotab "version=\$(VERSION) ; \\"
  echotab "distdir=clisp-\$\$version ; \\"
  echotab "rm -rf \$\$distdir; \\"
  echotab "mkdir \$\$distdir ; \\"
  echotab "for f in ${READMES} install.bat ; do \\"
  echotab "  if test -f \$\$f ; then cp -p \$\$f \$\$distdir/\$\$f ; else cp -p \`echo \$\$f | tr '[A-Z]' '[a-z]'\` \$\$distdir/\$\$f ; fi ; \\"
  echotab "done ; \\"
  if [ $TSYS = win32msvc ] ; then
    echotab "distfile=clisp-\$\$version-msvc-win32.zip ; \\"
    echotab "for f in lisp.exe lispinit.mem install.bat clisp.exe ; do \\"
    echotab "  cp -p \$\$f \$\$distdir/\$\$f ; \\"
    echotab "done ; \\"
  else
    echotab "distfile=clisp-\$\$version-win32.zip ; \\"
    echotab "installfile=clisp-\$\$version-win32-install.exe ; \\"
    echotab "for d in base full ; do \\"
    echotab "  mkdir \$\$distdir/\$\$d ; \\"
    echotab "  for f in lisp.exe lispinit.mem ; do \\"
    echotab "    cp -p \$\$d/\$\$f \$\$distdir/\$\$d/\$\$f ; \\"
    echotab "  done ; \\"
    echotab "done ; \\"
    echotab "mkdir \$\$distdir/linkkit; \\"
    echotab "for f in ${LINKKIT}; do \\"
    echotab "  cp -p linkkit/\$\$f \$\$distdir/linkkit/\$\$f; \\"
    echotab "done ; \\"
    echotab "mkdir \$\$distdir/build-aux; \\"
    echotab "for f in ${BUILD_AUX}; do \\"
    echotab "  cp -p build-aux/\$\$f \$\$distdir/build-aux/\$\$f; \\"
    echotab "done ; \\"
    echotab "cp clisp-link clisp.exe \$\$distdir/; \\"
    echo_dist_modules `pwd`/"\$\$distdir" ln "; \\"
  fi
  test -n "${USE_GETTEXT}" && echotab "cp -r locale/ \$\$distdir/; \\"
  test "${with_dynamic_modules}" != no && \
    echotab "cp -r dynmod/ \$\$distdir/; \\"
  echotab "mkdir \$\$distdir/data ; \\"
  for f in ${DATA_FILES}; do
    echotab "cp -p data/${f} \$\$distdir/data/${f} ; \\"
  done
  echotab "mkdir \$\$distdir/doc ; \\"
  echotab "for f in ${manpages1html} ${manpages_less} \$(TXTFILES) \$(IMPNOTES_FILES) ; do \\"
  echotab "  if test -f \$\$f ; then cp -p \$\$f \$\$distdir/doc/\$\$f ; else cp -p \`echo \$\$f | tr '[A-Z]' '[a-z]'\` \$\$distdir/doc/\$\$f ; fi ; \\"
  echotab "done ; \\"
  echotab "mkdir \$\$distdir/emacs; \\"
  for f in ${EMACS_FILES} ${VIM_FILES}; do
    echotab "cp -p ${SRCTOPDIR}emacs/${f} \$\$distdir/emacs/${f} ; \\"
  done
  echotab "mkdir \$\$distdir/misc; \\"
  for f in ${ACLOCAL_FILES}; do
    echotab "cp -p ${SRCDIR}m4/${f} \$\$distdir/misc/${f} ; \\"
  done
  echotab "mkdir \$\$distdir/src ; \\"
  echotab "cp -p \$(LISPFILES) config.lisp install.lisp install.bat \$\$distdir/src/ ; \\"
  echotab "chmod 755 \$\$distdir/. \$\$distdir/*/. ; \\"
  echotab "find \$\$distdir -type f -exec chmod 664 {} ';' ; \\"
  echotab "rm -f \$\$distfile \$\$installfile ; \\"
  echotab "(echo \"\$(PACKAGE_NAME) version \$(PACKAGE_VERSION) for Win32.\"; echo \".\") | zip -r -9 -z \$\$distfile \$\$distdir ; \\"
  echotab "cd \$\$distdir; cp ../*.ns[hi] ../COPYRIGHT.rtf .; makensis install.nsi; mv \$\$installfile .. ; cd ..; \\"
  echotab "rm -rf \$\$distdir"
  echol
fi

cat <<!!
# clean0 is harmless: removes only superfluous things: temporary files.
clean0 : force
	-\$($EXERM) core *.core *.stackdump${OBSOLETE}

# clean1 removes everything that becomes obsolete once lisp${LEXE} is recompiled
# without changing the bytecode format and the tables in
# constobj.d, constpack.d, constsym.d, subr.d, fsubr.d, pseudofun.d.
clean1 : clean0
	-\$(RM) lispbibl.h clisp.h *.i *.s *${TOBJ} *.a lisp${LEXE} marc.out clisp-link makevars ansi-tests-log ${CLISP_DEF}
	for m in "" \$(BASE_MODULES) \$(MODULES); do test -n "\$\$m" && \$(RM) \$\$m/*${TOBJ}; done
	-\$(RMRF) ${RECOMPILEDIR}
	-\$(RMRF) ${TESTSDIR}
	-\$(RMRF) ${ANSITESTSDIR}
	-\$(RMRF) ${SACLATESTSDIR}
	-\$(RMRF) boot base full linkkit dynmod
	-\$(RM) ${TXT_FILES} ${manpages_less} ${manual_print} \$(IMPNOTES_FILES) \$(TXTFILES) COPYRIGHT.rtf install.nsi

# clean2 removes everything that becomes obsolete once lisp${LEXE}
# is recompiled without changing the bytecode format.
clean2 : clean1
	-\$(RM) interpreted.mem halfcompiled.mem lispinit.mem lispinit2.mem

# clean3 removes everything that becomes obsolete once lisp${LEXE}
# is recompiled. It leaves everything generated by "make allc".
clean3 : clean2
	-\$(RM) \$(FASFILES) *.lib
!!
line="-\$(RM)"
for f in ${LUTILS}; do line=$line" ${f}.fas"; done
echotab "$line"
echotab 'for m in "" $(BASE_MODULES) $(MODULES); do test -n "$$m" && $(RM) $$m/*.fas $$m/*.lib $$m/*.erg; done'
cat <<!!

# clean4 removes everything that becomes obsolete
# when switching to a new version of the C compiler.
# It leaves everything generated by "make init".
clean4 : clean3
	-\$(RM) cflags.h cflags.h.stamp
	-\$(RM) \$(CFILES)
!!
test -n "$USE_GETTEXT" && \
  cat <<!!
	cd po && \$(MAKE) clean
	-\$(RMRF) locale
!!

echol '# clean5 even undoes "make init".'
echol "clean5 : clean4"
echotab "-\$(RM) ${TOP_DOC} modules.h"
if [ -n "${SRCDIR}" ] ; then
  line="-\$(RM) NEWS clisp.png"
  test ${HOS} = win32 && line="$line clisp.ico"
  echotab "$line"
  test $HOS = unix -a $CROSS = false && echotab "-\$(RM) .gdbinit"
  echotab "-\$(RMRF) build-aux"
fi
test $TOS = unix && echotab "-\$(RM) MAGIC.add"
echotab "-\$(RMRF) data"
line="$(exefiles clisp) clisp.rc"
for f in ${UTILS}; do line=$line" $(exefiles ${f})"; done
echotab "-\$($EXERM) ${line}"
echol
cat <<!!
# clean6 lets us go back to "makemake > Makefile".
clean6 : clean5
	-\$(RM) config.lisp

# clean-modules remove the copies of modules, do it if you change modprep and such
clean-modules :
	-\$(RMRF) \`ls -d ${MODULESDIR_}*/. | sed -e 's,/\.\$\$,,' -e 's,^.*/,,'\`

# clean7 lets us go back to the main "configure".
clean7 : clean6 clean-modules distclean-subdirs
	-\$(RM) config.status config.log config.cache ${PARAMS_H} config.h stamp-h1 libtool makemake Makefile
!!
test -n "$USE_GETTEXT" && \
  cat <<!!
	cd po && \$(MAKE) distclean
	-\$(RMRF) locale
!!
echol
echol "clean-subdirs :"
for dir in ${SUBDIRS}; do
  echotab "if test -d ${dir}; then cd ${dir} && \$(MAKE) clean; fi"
done
echol
# this must be run before clean7 because it runs "cd ..; make am--refresh"
echol "distclean-subdirs :"
for dir in ${SUBDIRS}; do
  echotab "if test -d ${dir}; then cd ${dir} && \$(MAKE) distclean; fi"
done
echol
cat <<!!

# clean8 moreover cleans up the SRCDIR.
clean8 : clean7

# The normal "start over" command:
mostlyclean : clean4

# Clear all files that are built by "make ...":
clean : clean5 clean-subdirs

# Make "clear for distribution":
distclean : clean7

# Remove everything that can be generated otherwise:
maintainer-clean : clean8

!!

echol

# Without this NeXT's make program tries to compile via c -> s -> o
echol ".SUFFIXES:"
echodummyrule .SUFFIXES
echol

echol "force:"
echodummyrule force

echol