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
|
## This is an -*- Autoconf -*- file to be processed with autoconf
## to obtain a configure script.
## Copyright (C) 2016-2022 Luca Saiu
## Copyright (C) 2021 pEp foundation (Android port)
## Written by Luca Saiu
## This file is part of GNU Jitter.
## GNU Jitter is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
## GNU Jitter is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
## You should have received a copy of the GNU General Public License
## along with GNU Jitter. If not, see <http://www.gnu.org/licenses/>.
# Early definitions.
################################################################
# The following definitions need to come very early, as they are used in the
# AC_INIT call.
# Expand to the git branch name preceded by '--', or to nothing if the branch
# name is either unknown or 'master'.
m4_define([jitter_git_branch_suffix],
[m4_esyscmd_s([git branch --show-current 2> /dev/null \
| sed 's/^master$//;s/^\(.\)/--\1/' ])])
# Expand to a version number extracted from the most recent tag whose name
# starts with 'v', relying on git-version-gen from Gnulib.
m4_define([jitter_version_from_git_tag],
[m4_esyscmd_s([build-aux/git-version-gen .tarball-version])])
# Expand to a nice-looking version string containing the branch name as well,
# when it is not a distraction.
m4_define([jitter_version],
[jitter_version_from_git_tag()][jitter_git_branch_suffix()])
# Global initialization.
################################################################
# We do not explicitly need to call AC_PREREQ here and specify a minimum
# Autoconf version: AC_PREREQ is requried by the macros from jitter.m4 we use
# below for tests.
AC_INIT([GNU Jitter],
jitter_version(),
[bug-jitter@gnu.org],
[jitter],
[https://www.gnu.org/software/jitter])
AC_CONFIG_SRCDIR([NO-WARRANTY])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIRS([build-aux])
AC_REQUIRE_AUX_FILE([trivial-source.c])
AC_MSG_NOTICE([configuring $PACKAGE_NAME $PACKAGE_VERSION])
# Generated C headers.
################################################################
# config.h is the typical header file generated by config.status . Here I am
# just generating it in a directory different from the build directory, so that
# in sub-package mode there will be no possible conflict between Jitter's
# config.h (which the super-package will not be able to access) and the
# super-package's own config.h .
#
# jitter/jitter-config.h is meant to be installed in non-sub-package mode (or
# available to the super-package in sub-package mode) as it is required when
# compiling generated VM code.
# For this reason jitter/jitter-config.h requires JITTER_ prefixes to prevent
# collisions with user macros.
AC_CONFIG_HEADERS([config-private/config.h jitter/jitter-config.h])
# Autoconf macros for Jitter.
################################################################
# We will not use JITTER here, since we are building Jitter itself rather
# than checking for an installed Jitter; however some of our Autoconf macros,
# which of course are not installed yet, will come in handy.
m4_include([autoconf/jitter.m4])
# Automake initialisation.
################################################################
# About the default filename-length-max limit: it is convenient to be able to
# generate tarballs containing long path names on GNU systems, where GNU tar has
# no hardcoded limit; in practice long path names will only occur with code
# compiled from branches, which is not meant to be distributed as tarballs to be
# used on weak systems: silencing the warning is acceptable in this
# circumstance. Notice that the genrated configure tests for a suitable tar.
m4_define([jitter_filename_length_limit_options],
[m4_if([jitter_git_branch_suffix()], [],
[],
[tar-pax])])
AM_INIT_AUTOMAKE(jitter_filename_length_limit_options())
# Make the source and build directory names visible here.
################################################################
# Define jitter_abs_top_builddir and jitter_abs_top_srcdir as ordinary
# shell variables, for internal use here in configure.
#
# The equivalent variables ac_abs_top_srcddir and ac_abs_top_builddir
# are defined very late in the generated configure script, and not
# documented anyway.
jitter_abs_top_builddir="$(pwd)"
cd "${srcdir}"
jitter_abs_top_srcdir="$(pwd)"
cd "${jitter_abs_top_builddir}"
# Utility functions for configure.
################################################################
# Check for tr, which is used very early.
AC_PATH_PROG([JITTER_TR], [tr])
if test "x$JITTER_TR" = "x"; then
AC_MSG_ERROR([you need the Unix tr utility])
fi
# Output stdin, translating every lower-case ASCII character into its upper-case
# version, and - into _; every other character is left unchanged.
jitter_lowercase_characters='abcdefghijklmnopqrstuvwxyz-'
jitter_uppercase_characters='ABCDEFGHIJKLMNOPQRSTUVWXYZ_'
jitter_to_upper ()
{
$JITTER_TR "$jitter_lowercase_characters" "$jitter_uppercase_characters"
}
# Perform a translation which is the reverse of the one in jitter_to_upper .
jitter_to_lower ()
{
$JITTER_TR "$jitter_uppercase_characters" "$jitter_lowercase_characters"
}
# If the given $CC command-line option is supported (its actual effect is not
# tested) then append the option, after a space, to the named shell veriable.
# Two arguments: the name of a shell variable to possibly modify, and a
# candidate $CC option.
jitter_check_cc_option ()
{
jitter_flag_variable_name="$1"
jitter_compiler_option="$2"
# We cache the result of an option being supported (as "yes" or "no") in a
# shell variable named after the option. Read the appropriate variable for
# $jitter_compiler_option into jitter_cached_value .
jitter_variable_name="jitter_cc_option_supported_"AS_TR_SH($jitter_compiler_option)
AS_VAR_COPY([jitter_cached_value], [$jitter_variable_name])
# If we lack a cached value then perform the test, and set jitter_result ;
# otherwise set jitter_result from the cached value.
if test "x$jitter_cached_value" = "x"; then
AC_MSG_CHECKING([if $CC supports the option $jitter_compiler_option])
if $CC \
-c -o conftest.o \
"$jitter_compiler_option" \
"$srcdir/build-aux/trivial-source.c" \
> /dev/null \
2> /dev/null; then
jitter_result=yes
rm conftest.o
else
jitter_result=no
fi
AS_VAR_SET([$jitter_variable_name], [$jitter_result])
AC_MSG_RESULT([$jitter_result])
else
jitter_result="$jitter_cached_value"
fi
# Now $jitter_result is either "yes" or "no". Use it to decide whether to
# append the option to the flag variable.
if test "x$jitter_result" = "xyes"; then
AS_VAR_COPY([jitter_flag_variable_old_value], [$jitter_flag_variable_name])
AS_VAR_SET([$jitter_flag_variable_name],
"$jitter_flag_variable_old_value $jitter_compiler_option")
fi
}
# Like jitter_check_cc_option , but working on zero or more $CC candidate options.
# One or more arguments: the first is the name of a shell variable, as in the
# first argument of jitter_check_cc_option ; all the other arguments are individual
# candidate $CC options.
jitter_check_cc_options ()
{
jitter_flag_variable_name="$1"
shift
for jitter_compiler_option in $@; do
jitter_check_cc_option "$jitter_flag_variable_name" "$jitter_compiler_option"
done
}
# Preprocess stdin into stdout using the C preprocessor. Cut out any line starting
# with "#" and whitespace-only lines.
# This is mostly intended to check the expansion of single macros.
jitter_cpp_preprocess ()
{
$CC -E - | grep -v '^@%:@' | grep -v '^@<:@ \t\n\r@:>@*$'
}
# Print the definition of the CPP macro given as the sole argument. Print
# nothing if the macro has no defintion.
# This may not work with compilers other than GCC.
jitter_gcc_print_cpp_macro ()
{
$CC -dM -E -P - < /dev/null \
| grep "^#define $1 " \
| sed "s/^#define $1 //"
}
# Sub-package mode support.
################################################################
# Check whether we should configure Jitter in "sub-package mode". In
# sub-package mode a copy of the Jitter source is distributed in the style of
# Gnulib, as a subdirectory along with another software package using it, so
# that the two are built together.
# Sub-package mode is meant for users of Jitter, and not for developing Jitter
# itself: in order to speed up Jitter's compilation and its test suite, only the
# best available dispatch is enabled.
# In sub-package mode installation does nothing, and both static and dynamic
# libraries are always enabled, but only static libraries are actually used.
# Libraries meant for the user are built as Libtool convenience libraries,
# suitable to be integrated within other user libraries and compatible with
# either kind; on modern platforms this means in practice that there is a PIC
# version built for every compilation unit.
# Sub-package mode is enabled if the environment variable
# JITTER_SUBPACKAGE_DIRECTORY is defined to any non-empty value. This is meant
# to be defined, and exported, by the configure script of the super-package
# using Jitter as a subpackage; the value is meant to be the Jitter subdirectory
# name relative to the super-package source directory, but the actual value is
# only useful for the super-package configuration: here any non-empty value will
# do, and the source and build directories are known in any case.
# Define the feature macro and change the kind of libraries to build by default
# if sub-package mode is enabled.
# In case the command line contradicts the default, I will still force static
# libraries to be enabled and shared libraries to be also enabled, just giving a
# warning: see "Libtool support" below.
# Define JITTER_SUBPACKAGE_DIRECTORY as a precious variable, so that it is
# described by --help and, more importantly, its value at the time of the first
# configuration is kept around in case of an automatic re-configuration. This
# is very useful in case some Autoconf or Automake source in a sub-package
# Jitter source directory is modified.
AC_ARG_VAR([JITTER_SUBPACKAGE_DIRECTORY],
[define to a non-empty value to configure Jitter as a
sub-package rather than as a dependency])
# Change library defaults.
if test "x$JITTER_SUBPACKAGE_DIRECTORY" != 'x'; then
AC_DEFINE_UNQUOTED([JITTER_SUBPACKAGE_MODE], [1],
[Jitter is configured in sub-package mode])
AC_ENABLE_STATIC
AC_ENABLE_SHARED
fi
# Define a substitution holding the relative path of the sub-package directory.
# This is intended for Makefile.am .
# The value of the substitution is a directory name, to be used as a relative
# path from the top super-package source, build or dist directory.
#
# In non-sub-package mode this will be defined as an empty string.
#
# FIXME: sub-sub-packages, or sub-packages at any depth different from 1, are
# not supported. The desired semantics is not completely clear, particularly
# for packages not using Jitter's autoconf machineary at every embedding level.
AC_SUBST([JITTER_SUBPACKAGE_DIRECTORY], [$JITTER_SUBPACKAGE_DIRECTORY])
# Define an Automake conditional.
AM_CONDITIONAL([JITTER_SUBPACKAGE],
[test "x$JITTER_SUBPACKAGE_DIRECTORY" != 'x'])
# Provide feedback.
AC_MSG_CHECKING([if we are configuring in sub-package mode])
if test "x$JITTER_SUBPACKAGE_DIRECTORY" != 'x'; then
AC_MSG_RESULT([yes: the subdirectory is "$JITTER_SUBPACKAGE_DIRECTORY"])
else
AC_MSG_RESULT([no])
fi
# Check for the C compiler and its features.
################################################################
# Indeed, we rely on a C compiler.
AC_PROG_CC
# In order to benefit from LTO here we would need to define RANLIB and AR to the
# host version of gcc-ranlib and gcc-ar -- and then assure that they actually
# work (as Bruno Haible helfully reminded me, on some configurations gcc-ranlib
# and gcc-ar may be non-functional and always respond with
# sorry - this program has been built without plugin support
# ).
# All this said LTO, impressive as it is, is a bad match for Jitter and
# arranging for special provisions for its sake feels unwarranted.
# Run the early part of the Gnulib initialization. This is recommended
# right after AC_PROG_CC .
gl_EARLY
# In order to compile Jitter we need a recent C compiler. This macro, also used
# internally by JITTER_JITTER and JITTER_JITTER_SUBPACKAGE for packages
# compiling Jittery VMs, takes care of calling AC_PROG_CC and checking the
# supported C dialect.
JITTER_PROG_CC_AND_CHECK_C_DIALECT
# Check that we can use -c and -o together with the compiler. I currently don't
# bother supporting compilers lacking this basic feature, but I could if it were
# actually needed.
AC_PROG_CC_C_O
if test "x$NO_MINUS_C_MINUS_O" != "x"; then
AC_MSG_NOTICE([your C compiler doesn't accept -c and -o together.
Such a compiler is currently not supported, but support would
be easy to add -- in case this were the only problem])
AC_MSG_ERROR([please write to $PACKAGE_BUGREPORT if you want to help])
fi
# We do support cross-compiling.
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
# Define a feature CPP macro if we are cross-compiling; also set a shell
# variable holding "yes" or "no" to use in this script.
AC_MSG_CHECKING([if we are cross-compiling])
if test "x$build" = "x$host"; then
AC_MSG_RESULT([no, native compiling on $host .])
jitter_cross_compiling=no
else
AC_DEFINE_UNQUOTED([JITTER_CROSS_COMPILING], [1],
[Defined if Jitter was cross-compiled.])
AC_MSG_RESULT([yes, cross-compiling from $build to $host .])
jitter_cross_compiling=yes
fi
AC_SUBST([JITTER_CROSS_COMPILING], [$jitter_cross_compiling])
# I never test on weird systems not supporting shebangs.
AC_SYS_INTERPRETER
if test "x$interpval" != "xyes"; then
AC_MSG_WARN([your system doesn't support shebang. Trying to go on anyway])
fi
# Installed shell scripts will have to work with a Bourne shell on the host
# system. In case of native compilation that is simply $SHELL as detected
# here (AS_INIT , called by AC_INIT , sets SHELL to a sensible value), but
# for cross-compiled installations we can only guess.
AC_MSG_CHECKING([what shell scripts should use as their shebang line])
jitter_warn_about_shebang='no'
jitter_shebang_prefix='#! '
if test "x$interpval" != "xyes"; then
AC_SUBST([JITTER_SHEBANG], [# Shebang unsupported on this system])
jitter_comment_about_JITTER_SHEBANG=' (very primitive shell -- untested)'
elif test "x$jitter_cross_compiling" = "xno"; then
if test "x$SHELL" != 'x'; then
AC_SUBST([JITTER_SHEBANG], [$jitter_shebang_prefix$SHELL])
jitter_comment_about_JITTER_SHEBANG=''
else
# Fallback case for systems where AS_INIT for some reason fails to set
# $SHELL to a resaonable value. This should not happen.
AC_SUBST([JITTER_SHEBANG], [$jitter_shebang_prefix/bin/sh])
jitter_comment_about_JITTER_SHEBANG=' (guessed, as $SHELL is empty)'
jitter_warn_about_shebang='yes'
fi
else
AC_SUBST([JITTER_SHEBANG], [$jitter_shebang_prefix/bin/sh])
jitter_comment_about_JITTER_SHEBANG=' (guessed, for cross-compiling)'
fi
AC_MSG_RESULT([$JITTER_SHEBANG$jitter_comment_about_JITTER_SHEBANG])
if test "x$jitter_warn_about_shebang" != 'xno'; then
AC_MSG_WARN([the Autoconf logic failed to find a sensible value for SHELL;
this should never happen. Trying to proceed anyway with a guess])
fi
# We have preprocessed assembly files (for some architectures).
AM_PROG_AS
# Can we actually run on something other than GCC? Probably, as long as the
# compiler supports a recent version of the C standard.
if test "x$GCC" = 'x'; then
AC_MSG_WARN([not using GCC. Going on anyway, but GCC is recommended])
fi
# Checks for C type support.
AC_TYPE_LONG_LONG_INT
AC_TYPE_UNSIGNED_LONG_LONG_INT
AC_TYPE_LONG_DOUBLE
# Checks for C type sizes.
AC_CHECK_SIZEOF([void *])
AC_CHECK_SIZEOF([short])
AC_CHECK_SIZEOF([int])
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([float])
AC_CHECK_SIZEOF([double])
AC_CHECK_SIZEOF([long double])
AC_TYPE_SIZE_T
# Checks for C type alignment. Checking for those at configure time is more
# convenient than checking for __alignof__ and then invent some default where
# it is not supported. I think I could live with those not being constant at
# CPP time, but why not.
AC_CHECK_ALIGNOF([void *])
AC_CHECK_ALIGNOF([void * *])
AC_CHECK_ALIGNOF([short])
AC_CHECK_ALIGNOF([int])
AC_CHECK_ALIGNOF([long])
AC_CHECK_ALIGNOF([long long])
AC_CHECK_ALIGNOF([float])
AC_CHECK_ALIGNOF([double])
AC_CHECK_ALIGNOF([long double])
# By definition we will take the size of a pointer as the host machine "word
# size". This information is also used in the test suite, so define a
# substitution as well.
AC_SUBST([SIZEOF_VOID_P], [$ac_cv_sizeof_void_p])
# Check for typeof.
AC_C_TYPEOF
# Check for a compiler which is actually GCC, and for versions.
################################################################
# This check for specific versions is not really in the spirit of Autoconf,
# but is necessary on cross configuration and when the feature to test cannot
# be observed in a simple or deterministic enough way.
# Some compilers claim to be GCC in feature macro, but they actually lie.
# Jitter's advanced dispatches require some features present in the actual GNU
# Compiler Collection, and not its imitations.
# Define a substitution ("yes" or "no"), CPP feature macro (1 or undefiend) and
# Automake conditional, all named JITTER_HAVE_ACTUAL_GCC.
AC_MSG_CHECKING([if the compiler is *really* GCC])
JITTER_HAVE_CLANG=no
if test "x$GCC" = 'x'; then
JITTER_HAVE_ACTUAL_GCC=no
AC_MSG_RESULT([no])
elif ! ${CC} --version > /dev/null 2> /dev/null; then
AC_MSG_RESULT([no (something not supporting --version)])
JITTER_HAVE_ACTUAL_GCC=no
else
JITTER_CLAIMED_GCC_VERSION=$(${CC} --version | jitter_to_lower)
# Clang does not play well with inline Gas assembly the way it is used in
# Jitter. However it does support computed goto, which is enough for
# direct-threading dispatch.
if echo "$JITTER_CLAIMED_GCC_VERSION" | grep 'clang' > /dev/null 2> /dev/null; then
AC_MSG_RESULT([no (clang pretending to be GCC)])
JITTER_HAVE_ACTUAL_GCC=no
JITTER_HAVE_CLANG=yes
# If other compilers lie in a way similar to Clang and cause problems in a
# similar way I can add checks here.
else
AC_MSG_RESULT([yes])
JITTER_HAVE_ACTUAL_GCC=yes
fi
fi
AC_SUBST([JITTER_HAVE_ACTUAL_GCC])
if test "x$JITTER_HAVE_ACTUAL_GCC" = 'xyes'; then
AC_DEFINE_UNQUOTED([JITTER_HAVE_ACTUAL_GCC], [1],
[Defined if using GCC and not something "compatibile".])
elif test "x$JITTER_HAVE_CLANG" = 'xyes'; then
AC_DEFINE_UNQUOTED([JITTER_HAVE_CLANG], [1],
[Defined if using clang.])
fi
AM_CONDITIONAL([JITTER_HAVE_ACTUAL_GCC],
[test "x$JITTER_HAVE_ACTUAL_GCC" = 'xyes'])
# If the compiler is actually GCC I can check its version as well.
if test "x$JITTER_HAVE_ACTUAL_GCC" = 'xyes'; then
AC_MSG_CHECKING([for GCC's version])
JITTER_GCC_MAJOR_VERSION=$(echo '__GNUC__' | jitter_cpp_preprocess)
JITTER_GCC_MINOR_VERSION=$(echo '__GNUC_MINOR__' | jitter_cpp_preprocess)
JITTER_GCC_PATCHLEVEL_VERSION=$(echo '__GNUC_PATCHLEVEL__' | jitter_cpp_preprocess)
JITTER_GCC_COMBINED_VERSION=$(( ${JITTER_GCC_MAJOR_VERSION} * 10000 + ${JITTER_GCC_MINOR_VERSION} * 100 + ${JITTER_GCC_PATCHLEVEL_VERSION}))
AC_DEFINE_UNQUOTED([JITTER_GCC_MAJOR_VERSION],
[${JITTER_GCC_MAJOR_VERSION}],
[The GCC major version, if GCC is being used])
AC_DEFINE_UNQUOTED([JITTER_GCC_MINOR_VERSION],
[${JITTER_GCC_MINOR_VERSION}],
[The GCC minor version, if GCC is being used])
AC_DEFINE_UNQUOTED([JITTER_GCC_PATCHLEVEL_VERSION],
[${JITTER_GCC_PATCHLEVEL_VERSION}],
[The GCC patchlevel version, if GCC is being used])
AC_DEFINE_UNQUOTED([JITTER_GCC_COMBINED_VERSION],
[${JITTER_GCC_COMBINED_VERSION}],
[The GCC version as a combined integer, if GCC is being
used])
AC_MSG_RESULT([major ${JITTER_GCC_MAJOR_VERSION}, minor ${JITTER_GCC_MINOR_VERSION}, patchlevel ${JITTER_GCC_PATCHLEVEL_VERSION}, combined ${JITTER_GCC_COMBINED_VERSION}])
fi
# If the compiler is clang I can check its version as well.
if test "x$JITTER_HAVE_CLANG" = 'xyes'; then
AC_MSG_CHECKING([for clang's version])
JITTER_CLANG_MAJOR_VERSION=$(echo '__clang_major__' | jitter_cpp_preprocess)
JITTER_CLANG_MINOR_VERSION=$(echo '__clang_minor__' | jitter_cpp_preprocess)
JITTER_CLANG_PATCHLEVEL_VERSION=$(echo '__clang_patchlevel__' | jitter_cpp_preprocess)
JITTER_CLANG_COMBINED_VERSION=$(( ${JITTER_CLANG_MAJOR_VERSION} * 10000 + ${JITTER_CLANG_MINOR_VERSION} * 100 + ${JITTER_CLANG_PATCHLEVEL_VERSION}))
AC_DEFINE_UNQUOTED([JITTER_CLANG_MAJOR_VERSION],
[${JITTER_CLANG_MAJOR_VERSION}],
[The clang major version, if clang is being used])
AC_DEFINE_UNQUOTED([JITTER_CLANG_MINOR_VERSION],
[${JITTER_CLANG_MINOR_VERSION}],
[The clang minor version, if clang is being used])
AC_DEFINE_UNQUOTED([JITTER_CLANG_PATCHLEVEL_VERSION],
[${JITTER_CLANG_PATCHLEVEL_VERSION}],
[The clang patchlevel version, if clang is being used])
AC_DEFINE_UNQUOTED([JITTER_CLANG_COMBINED_VERSION],
[${JITTER_CLANG_COMBINED_VERSION}],
[The clang version as a combined integer, if clang is being
used])
AC_MSG_RESULT([major ${JITTER_CLANG_MAJOR_VERSION}, minor ${JITTER_CLANG_MINOR_VERSION}, patchlevel ${JITTER_CLANG_PATCHLEVEL_VERSION}, combined ${JITTER_CLANG_COMBINED_VERSION}])
fi
# FIXME: the GCC version will be useful in advanced dispatches to enable or
# disable features which are too difficult to check for at configure time,
# particularly when cross-compiling.
# Check for the GNU assembler.
################################################################
# Jitter can use Gas features, and ideally I would like to disable them when
# some other assembler is being used, even if this is low-priority.
AC_CHECK_TOOL([JITTER_GNU_ASSEMBLER], [as], [no])
if test "x$JITTER_GNU_ASSEMBLER" != "xno"; then
if $JITTER_GNU_ASSEMBLER --version > /dev/null \
&& $JITTER_GNU_ASSEMBLER --version \
| grep 'GNU [aA]ssembler' > /dev/null; then
# We found an asembler, but it either doesn't accept --version or the output
# of --version does not say anything similar to "GNU assembler". I am
# accepting a capitalized variant as an alternative and not requiring the
# string to occur at the beginning of a line just to account for some
# possible future changes in the format of gas --version .
JITTER_GNU_ASSEMBLER=no
fi
fi
if test "x$JITTER_GNU_ASSEMBLER" = "xno"; then
AC_MSG_WARN([the host assembler is not the GNU assembler. Going on anyway.])
else
AC_DEFINE_UNQUOTED([JITTER_HOST_ASSEMBLER_IS_GNU], [1],
[Defined if the host assembler is the GNU assembler.])
AC_MSG_NOTICE([the host assembler is the GNU assembler. Good.])
fi
# Check for system characteristics.
################################################################
# I never test on systems limiting file name length to 14 characters.
AC_SYS_LONG_FILE_NAMES
if test "x$ac_cv_sys_long_file_names" != "xyes"; then
AC_MSG_WARN([file names are limited to 14 characters. Things may break])
fi
# Check for programs.
################################################################
# Check for sed. This defines the substitution SED and the shell variable
# ac_cv_path_SED .
AC_PROG_SED
# Unfortunately when cross-compiling we cannot use the build-time sed we have
# found here on the host machine, about which we can only guess:
if test "x$jitter_cross_compiling" = 'xyes'; then
AC_SUBST([JITTER_HOST_SED], [sed])
AC_MSG_WARN([cross-compiling: guessing that the host machine sed will be \
$JITTER_HOST_SED])
else
AC_SUBST([JITTER_HOST_SED], [$SED])
fi
# mkdir -p is convenient. It is currently used in the makefile and in
# vm/generate-instructions.in .
AC_PROG_MKDIR_P
# We call objdump at runtime when disassembling. Even not having it installed
# is not fatal, and the problem is easy to fix anyway after compiling Jitter.
AC_PATH_PROG([JITTER_OBJDUMP], [objdump])
if test "x$jitter_cross_compiling" = "xyes"; then
AC_DEFINE_UNQUOTED([JITTER_OBJDUMP],
["objdump"],
[name of the native objdump utility on the host system])
elif test "$JITTER_OBJDUMP" = ""; then
AC_MSG_WARN([no native objdump found. \
Assuming it will be installed and called "objdump", if disassembling is \
desired])
AC_DEFINE_UNQUOTED([JITTER_OBJDUMP],
["objdump"],
[name of the native objdump utility (not actually found)])
else
AC_DEFINE_UNQUOTED([JITTER_OBJDUMP],
["$JITTER_OBJDUMP"],
[name of the native objdump utility])
fi
# We also check for a cross-objdump, which is very convenient when debugging and
# can be invoked from cross-compiled programs run on the build machine thru
# qemu-user.
AC_CHECK_TOOLS([JITTER_CROSS_OBJDUMP], [objdump])
if test "x$JITTER_CROSS_OBJDUMP" = "x"; then
AC_MSG_WARN([no cross-objdump found])
else
AC_DEFINE_UNQUOTED([JITTER_CROSS_OBJDUMP],
["$JITTER_CROSS_OBJDUMP"],
[name of the cross-objdump utility from GNU binutils])
fi
# Check for flex.
JITTER_PROG_FLEX
if test "x$LEX" = 'x'; then
if test -e "$srcdir/jitterc/jitterc-scanner.c"; then
AC_MSG_WARN([you will need flex (instead of $LEX) if you modify the
distributed C scanners])
else
AC_MSG_ERROR([you need flex (instead of $LEX) to generate scanners,
if you compile from git])
fi
fi
# Check for Bison.
JITTER_PROG_BISON
if test "x$YACC" = 'x'; then
if test -e "$srcdir/jitterc/jitterc-parser.c"; then
AC_MSG_WARN([you will need GNU Bison (instead of $YACC) if you modify
the distributed C parsers])
else
AC_MSG_ERROR([you need GNU Bison (instead of $YACC) to generate parsers,
if you compile from git])
fi
fi
# Allow the user to disable Texinfo tools from the configure command line.
dnl AC_MSG_CHECKING([if Texinfo documentation should be generated])
dnl AC_ARG_ENABLE([texinfo],
dnl AS_HELP_STRING([--enable-texinfo],
dnl [Build documentation from Texinfo (default: auto)]),
dnl jitter_enable_texinfo="$enableval",
dnl jitter_enable_texinfo="auto")
dnl if test "x$jitter_enable_texinfo" != 'xno' \
dnl && test "x$jitter_enable_texinfo" != 'xyes' \
dnl && test "x$jitter_enable_texinfo" != 'xauto'; then
dnl AC_MSG_RESULT([invalid: $jitter_enable_texinfo])
dnl AC_MSG_ERROR([--enable-texinfo: parameter different from yes, no, auto])
dnl fi
dnl AC_MSG_RESULT([$jitter_enable_texinfo])
dnl AC_MSG_CHECKING([if we can build hardcopy documentation])
dnl AC_ARG_ENABLE([hardcopy],
dnl AS_HELP_STRING([--enable-hardcopy],
dnl [Enable generation of the manual in hardcopy formats (default:
dnl auto) (ignored on --disable-texinfo)]),
dnl jitter_enable_hardcopy="$enableval",
dnl jitter_enable_hardcopy="auto")
dnl AC_MSG_RESULT([$jitter_enable_hardcopy])
# Check for Texinfo commands. In practice makeinfo is more important than
# texi2dvi, as Info is the default format.
dnl AC_PATH_PROG([JITTER_MAKEINFO], [makeinfo])
dnl if test "x$jitter_enable_texinfo" = 'xno'; then
dnl AC_MSG_WARN([Texinfo support was disabled from the command line])
dnl elif test "x$JITTER_MAKEINFO" != 'x'; then
dnl # Check that makeinfo understands a sufficiently recent dialect of Texinfo.
dnl # I have had prolems on some BSD system shipping with a version of makeinfo
dnl # which was too old to recognise @part.
dnl # I want to detect such problems and prevent build failures but I will not
dnl # make the manuals uglier just to support such systems...
dnl AC_MSG_CHECKING([that the available Texinfo tools are recent enough])
dnl mkdir "${jitter_abs_top_builddir}/build-aux" 2> /dev/null || true
dnl cat > "${jitter_abs_top_builddir}/build-aux/foo.texi" <<EOF
dnl @node Top
dnl @top foo
dnl @menu
dnl * bar::.
dnl @end menu
dnl @part foo
dnl @node bar
dnl @chapter bar
dnl EOF
dnl # ...If makeinfo is too old just disable it and behave as if it were not
dnl # present at all.
dnl if "$JITTER_MAKEINFO" \
dnl --output "${jitter_abs_top_builddir}/build-aux/foo.info" \
dnl "${jitter_abs_top_builddir}/build-aux/foo.texi" \
dnl > /dev/null 2> /dev/null; then
dnl AC_MSG_RESULT([yes])
dnl else
dnl AC_MSG_RESULT([no: some feature, likely @part, is not supported])
dnl AC_MSG_WARN([disabling Texinfo support, ignoring $JITTER_MAKEINFO])
dnl JITTER_MAKEINFO=''
dnl fi
dnl rm -f \
dnl ${jitter_abs_top_builddir}/build-aux/foo.texi \
dnl ${jitter_abs_top_builddir}/build-aux/foo.info
dnl fi
dnl if test "x$JITTER_MAKEINFO" = "x"; then
dnl if test -e "$srcdir/doc/jitter.info"; then
dnl AC_MSG_WARN([you will need a reasonably recent GNU Texinfo to regenerate \
dnl the Info documentation, in case you change the Texinfo source])
dnl else
dnl AC_MSG_ERROR([you need a reasonably recent GNU Texinfo to generate the \
dnl Info documentation, if you compile from git; release tarballs contain the \
dnl documentation pre-generated])
dnl fi
dnl fi
dnl AC_PATH_PROG([JITTER_TEX], [tex])
dnl if test "x$JITTER_TEX" = "x"; then
dnl AC_MSG_WARN([you will need a TeX executable (tex) for building the manual
dnl in hardcopy formats such as DVI, PostScript and PDF])
dnl fi
dnl AC_PATH_PROG([JITTER_TEXI2DVI], [texi2dvi])
dnl if test "x$JITTER_TEXI2DVI" = "x"; then
dnl AC_MSG_WARN([you will need texi2dvi, from GNU Texinfo, if you want to \
dnl generate DVI, PostScript or PDF documentation])
dnl fi
dnl # Define an Automake conditional saying whether it is possible to generate Info
dnl # documentation. Notice that (when building from git without a usable makeinfo)
dnl # we may have alraedy failed fatally before arriving here: the value of this
dnl # conditionsl is only decided by the command-line option.
dnl AM_CONDITIONAL([JITTER_HAVE_TEXINFO],
dnl [test "x$jitter_enable_texinfo" != 'xno'])
dnl # Define an Automake conditional saying whether it is possible to generate
dnl # hardcopy documentation. This way failures will be cleaner.
dnl AM_CONDITIONAL([JITTER_HAVE_TEXI2DVI],
dnl [test "x$jitter_enable_texinfo" != 'xno' \
dnl && test "x$jitter_enable_hardcopy" != 'x' \
dnl && test "x$JITTER_TEX" != 'x' \
dnl && test "x$JITTER_TEXI2DVI" != 'x'])
dnl # Check for GNU help2man. That is not required for the user: pre-generated man
dnl # pages are included in the distribution.
dnl AC_CHECK_PROG(HAS_HELP2MAN, help2man, yes, no)
dnl if test "x$HAS_HELP2MAN" != "xyes"; then
dnl jitter_has_help2man="no"
dnl if test -e "$srcdir/jitterc/jitterc.1"; then
dnl AC_MSG_WARN([You need GNU help2man if you want to rebuild manual pages])
dnl else
dnl AC_MSG_WARN([You need GNU help2man to build manual pages if you compile
dnl from git and you are not content with just man page stubs])
dnl fi
dnl else
dnl jitter_has_help2man="yes"
dnl fi
dnl AM_MISSING_PROG(HELP2MAN, help2man)
# Check for programs only used in the test suite.
################################################################
# JITTER_CHECK_TESTSUITE_PROGS
# ----------------------------
# Check the availability of a program only used for the test suite in the
# predefined binary paths. The first program is the name of the substitution to
# define (empty if the program is not found, otherwise its pathname); the second
# argument is a list of possible basenames. If the program is not found then
# the first argument is added to the shell variable , and a warning message is
# printed.
# jitter_test_suite_missing_progs.
# Example:
# JITTER_CHECK_TESTSUITE_PROG([JITTER_CMP], [some-other-weird-cmp cmp])
AC_DEFUN([JITTER_CHECK_TESTSUITE_PROGS],
[AC_PATH_PROGS([$1], [$2])
if test "x$$1" = "x"; then
AC_MSG_WARN([none of {$2} found. Cannot run the test suite])
jitter_test_suite_missing_progs="$jitter_test_suite_missing_progs $1"
fi])
# Check for optional programs only used by the test suite.
JITTER_CHECK_TESTSUITE_PROGS([JITTER_AWK], [gawk mawk nawk awk])
JITTER_CHECK_TESTSUITE_PROGS([JITTER_CMP], [cmp])
JITTER_CHECK_TESTSUITE_PROGS([JITTER_BASENAME], [basename])
JITTER_CHECK_TESTSUITE_PROGS([JITTER_DIRNAME], [dirname])
#JITTER_CHECK_TESTSUITE_PROGS([JITTER_SEQ], [seq]) # not currently used.
# Some other programs we can live without, still useful (but not mandatory) for
# the test suite:
AC_PATH_PROGS([JITTER_TIMEOUT], [timeout])
# Libtool support.
################################################################
# In case this is a sub-package build force static libraries to be enabled and
# shared libraries to be also enabled, even if this is different from what the
# user asked. See "Sub-package mode support" above for an explanation.
# This is reasonable in a sub-package: of course the super-package remains free
# to choose differently.
# REMARK: enable_static and enable_shared are not explicitly documented.
if test "x$JITTER_SUBPACKAGE_DIRECTORY" != 'x'; then
if test "x${enable_static}" = 'xno'; then
AC_MSG_WARN([forcing static libraries to be enabled in sub-package mode])
enable_static=yes
fi
if test "x${enable_shared}" = 'xno'; then
AC_MSG_WARN([forcing shared library compilation to be enabled in sub-package
mode, for compatibility's sake, even if they will not be used])
enable_shared=yes
fi
fi
# Initialize Libtool.
LT_INIT
# Update the libtool script if it becomes out of date.
AC_SUBST([LIBTOOL_DEPS])
# Initialize Gnulib.
################################################################
gl_INIT
# Emacs Lisp support.
################################################################
# Check for the Emacs Lisp installation path.
AM_PATH_LISPDIR
# Check for headers.
################################################################
# Check for C language features.
################################################################
# Check for mixed declarations and statements, which have been standards in C
# since 1999 and widely supported even earlier.
AC_CACHE_CHECK([for C99 mixed declarations and statements],
[ac_cv_have_mixed_declarations_and_statements],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[],
[[int a = 10;
a ++;
int b = 7;
b += a;
return a + b;]])],
[ac_cv_have_mixed_declarations_and_statements=yes],
[ac_cv_have_mixed_declarations_and_statements=no])])
if test "x$ac_cv_have_mixed_declarations_and_statements" = "xyes"; then
AC_DEFINE([JITTER_HAVE_MIXED_DECLARATIONS_AND_STATEMENTS], [1],
[Define if the compiler supports mixing declarations and statements])
else
AC_MSG_WARN([This compiler does not support mixing C declarations and
statements. It must be extremely old, and it will probably never be
supported by Jitter. Trying to go on anyway, but expect disasters.])
fi
# Check for statement expressions in the style of GNU C.
AC_CACHE_CHECK([for GNU C statement expressions],
[ac_cv_have_gnu_c_statement_expressions],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[],
[[return ({int a = 10; a -= 10; a;});]])],
[ac_cv_have_gnu_c_statement_expressions=yes],
[ac_cv_have_gnu_c_statement_expressions=no])])
if test "x$ac_cv_have_gnu_c_statement_expressions" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GNU_C_STATEMENT_EXPRESSIONS], [1],
[Define if the compiler supports GNU C's statement expressions.])
fi
# Check for computed goto in the style of GNU C.
AC_CACHE_CHECK([for GNU C computed goto], [ac_cv_have_gnu_c_computed_goto],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[],
[[ goto * && there;
there:
return 0;]])],
[ac_cv_have_gnu_c_computed_goto=yes],
[ac_cv_have_gnu_c_computed_goto=no])])
if test "x$ac_cv_have_gnu_c_computed_goto" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GNU_C_COMPUTED_GOTO], [1],
[Define if the compiler supports GNU C's computed goto .])
fi
# Check for (GNU C) label address difference constantness.
AC_CACHE_CHECK([for GNU label address differences being constant],
[ac_cv_have_gnu_c_constant_label_difference],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[],
[[ goto * && somewhere_else_again;
static int difference = && there - && somewhere_else_again;
there:
return 0;
elsewhere:
return 1;
somewhere_else_again:
return difference;
]])],
[ac_cv_have_gnu_c_constant_label_difference=yes],
[ac_cv_have_gnu_c_constant_label_difference=no])])
if test "x$ac_cv_have_gnu_c_constant_label_difference" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GNU_C_CONSTANT_LABEL_DIFFERENCE], [1],
[Define if the compiler supports GNU C's computed goto and the
difference between two label addresses (in the same function) is
a constant expression; unfortunately some compilers support GNU
C's computed goto without label address differences being
constant.])
fi
# Check for alignas.
AC_CACHE_CHECK([for alignas], [ac_cv_have_alignas],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <stdalign.h>],
[[struct s { alignas(16) int i; } foo;
return foo.i = 42;]])],
[ac_cv_have_alignas=yes],
[ac_cv_have_alignas=no])])
if test "x$ac_cv_have_alignas" = "xyes"; then
AC_DEFINE([JITTER_HAVE_ALIGNAS], [1],
[Define if the compiler supports alignas .])
fi
# Check for offsetof.
AC_CACHE_CHECK([for offsetof], [ac_cv_have_offsetof],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[#include <stddef.h>],
[[struct s { int i; char c; float f; };
return (int) offsetof (struct s, f);]])],
[ac_cv_have_offsetof=yes],
[ac_cv_have_offsetof=no])])
if test "x$ac_cv_have_offsetof" = "xyes"; then
AC_DEFINE([JITTER_HAVE_OFFSETOF], [1],
[Define if the compiler supports offsetof .])
fi
# Check for GNU C's inline asm with modern syntax.
AC_CACHE_CHECK([for GNU C inline asm with modern syntax],
[ac_cv_have_gnu_c_inline_asm],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[],
[[int to, from = 42;
asm ("/* Pretend to set %[the_to] reading from %[the_from] . */"
: [the_to] "=r" (to)
: [the_from] "r" (from));
return to;]])],
[ac_cv_have_gnu_c_inline_asm=yes],
[ac_cv_have_gnu_c_inline_asm=no])])
if test "x$ac_cv_have_gnu_c_inline_asm" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GNU_C_INLINE_ASM], [1],
[Define if the compiler supports GNU C's asm goto .])
fi
# Check for GNU C's "inline" qualifier for inline asm.
AC_CACHE_CHECK([for GNU C "inline" qualifier for inline asm],
[ac_cv_have_gnu_c_asm_inline],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[],
[[int to, from = 42;
asm inline ("/* Pretend to set %[the_to] reading from %[the_from] . */"
: [the_to] "=r" (to)
: [the_from] "r" (from));
return to;]])],
[ac_cv_have_gnu_c_asm_inline=yes],
[ac_cv_have_gnu_c_asm_inline=no])])
if test "x$ac_cv_have_gnu_c_asm_inline" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GNU_C_ASM_INLINE], [1],
[Define if the compiler supports GNU C's asm "inline" qualfiier.])
fi
# Check for GNU C's asm goto.
AC_CACHE_CHECK([for GNU C asm goto], [ac_cv_have_gnu_c_asm_goto],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[],
[[here:
asm goto ("/* Pretend to do something. */"
: : : : here, there);
return 1;
there:
return 12;]])],
[ac_cv_have_gnu_c_asm_goto=yes],
[ac_cv_have_gnu_c_asm_goto=no])])
if test "x$ac_cv_have_gnu_c_asm_goto" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GNU_C_ASM_GOTO], [1],
[Define if the compiler supports GNU C's asm goto .])
fi
# Check whether #pragma GCC diagnostic is usable inside functions.
AC_CACHE_CHECK([for @%:@pragma GCC diagnostic insude functions],
[ac_cv_have_pragma_gcc_diagnostic_in_functions],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[],
[[# pragma GCC diagnostic push
# pragma GCC diagnostic pop
]])],
[ac_cv_have_pragma_gcc_diagnostic_in_functions=yes],
[ac_cv_have_pragma_gcc_diagnostic_in_functions=no])])
if test "x$ac_cv_have_pragma_gcc_diagnostic_in_functions" = "xyes"; then
AC_DEFINE([JITTER_HAVE_PRAGMA_GCC_DIAGNOSTIC_IN_FUNCTIONS], [1],
[Define if the compiler supports #pragma GCC diagnostic inside
functions.])
fi
# Check whether the compiler supports assembler names for functions.
AC_CACHE_CHECK([assembly names for functions],
[ac_cv_have_assembly_names_for_functions],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[int
foo (int x) asm ("foobar");]
[int
foo (int x)
{
return x + 1;
}]],
[[return foo (42);]])],
[ac_cv_have_assembly_names_for_functions=yes],
[ac_cv_have_assembly_names_for_functions=no])])
if test "x$ac_cv_have_assembly_names_for_functions" = "xyes"; then
AC_DEFINE([JITTER_HAVE_ASSEMBLY_NAMES_FOR_FUNCTIONS], [1],
[Define if the compiler supports assembly names for functions in
the style of GNU C])
fi
# Check whether the compiler supports assembler names for nonfunctions.
AC_CACHE_CHECK([assembly names for non-functions],
[ac_cv_have_assembly_names_for_non_functions],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[int
foo asm ("foobarquux") = 42;]],
[[return foo;]])],
[ac_cv_have_assembly_names_for_non_functions=yes],
[ac_cv_have_assembly_names_for_non_functions=no])])
if test "x$ac_cv_have_assembly_names_for_non_functions" = "xyes"; then
AC_DEFINE([JITTER_HAVE_ASSEMBLY_NAMES_FOR_NON_FUNCTIONS], [1],
[Define if the compiler supports assembly names for non-functions in
the style of GNU C])
fi
# Check for GCC attributes.
################################################################
# Check if the GNU C attribute syntax is recognized at all.
AC_CACHE_CHECK([for GNU C attributes], [ac_cv_have_gnu_c_attribute],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[__attribute__ (())
int
f (int x)
{
return x;
}]],
[[return f (0);]])],
[ac_cv_have_gnu_c_attribute=yes],
[ac_cv_have_gnu_c_attribute=no])])
if test "x$ac_cv_have_gnu_c_attribute" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GNU_C_ATTRIBUTE], [1],
[Define if the compiler supports __attribute__.])
fi
# Check for specific attributes not supported by older versions of GCC;
# and possibly by other compilers. Notice that we have to temporarily
# change CFLAGS (in a subshell, so as not to affect the rest of this
# script) to force -Werror. If -Werror is not supported than the tests
# will all fail, which is the correct conservative behavior.
# Out of the subshell, define the shell variable ac_cv_have_ATTRIBUTE ,
# in order for the test result to be visible in the following.
# FIXME: I should factor the following with M4.
# Check for attribute no_reorder .
ac_cv_have_no_reorder=$(CFLAGS="$CFLAGS -Werror"; export CFLAGS
AC_CACHE_CHECK([for the no_reorder attribute],
[ac_cv_have_no_reorder],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[long n = 7;
__attribute__ ((no_reorder))
long *
f (void)
{
return & n;
}]],
[[return * f () != 0;]])],
[ac_cv_have_no_reorder=yes],
[ac_cv_have_no_reorder=no])])
if test "x$ac_cv_have_no_reorder" = "xyes"; then
AC_DEFINE([JITTER_HAVE_ATTRIBUTE_NO_REORDER], [1],
[Define if the no_reorder attribute works])
fi;
echo "$ac_cv_have_no_reorder")
# Check for attribute returns_nonnull .
ac_cv_have_returns_nonnull=$(CFLAGS="$CFLAGS -Werror"; export CFLAGS
AC_CACHE_CHECK([for the returns_nonnull attribute],
[ac_cv_have_returns_nonnull],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[long n = 7;
__attribute__ ((returns_nonnull))
long *
f (void)
{
return & n;
}]],
[[return * f () != 0;]])],
[ac_cv_have_returns_nonnull=yes],
[ac_cv_have_returns_nonnull=no])])
if test "x$ac_cv_have_returns_nonnull" = "xyes"; then
AC_DEFINE([JITTER_HAVE_ATTRIBUTE_RETURNS_NONNULL], [1],
[Define if the returns_nonnull attribute works])
fi
echo "$ac_cv_have_returns_nonnull")
# Many people like to compile with -Werror. This is a way of redefining
# attributes not supported by the compiler so that they expand to nothing.
# Check for GCC builtins.
################################################################
# Checking for builtins with AC_CHECK_FUNCS does not work for me, which is
# reasonable since they are not usually implemented as C functions.
# Overflow-checking builtins are fairly recent, and it is better to check their
# presence rather than assuming that they are always available with GCC.
AC_CACHE_CHECK([for GCC overflow-checking builtins], [ac_cv_have_gcc_overflow],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#include <stdio.h>]],
[[int foo = __builtin_add_overflow_p (1, 2, 42);
printf ("%i\n", foo); /* -Werror: avoid unused variable warnings. */
]])],
[ac_cv_have_gcc_overflow=yes],
[ac_cv_have_gcc_overflow=no])])
if test "x$ac_cv_have_gcc_overflow" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GCC_OVERFLOW_CHECKING], [1],
[Define if __builtin_add_overflow_p and friends are usable.])
fi
# Very old GCCs or non-GCC compilers will not have __builtin_constant_p.
AC_CACHE_CHECK([for GCC __builtin_constant_p],
[ac_cv_have_gcc_builtin_constant_p],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[const int x = __builtin_constant_p (2 + 2); return x;
]])],
[ac_cv_have_gcc_builtin_constant_p=yes],
[ac_cv_have_gcc_builtin_constant_p=no])])
if test "x$ac_cv_have_gcc_builtin_constant_p" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GCC_BUILTIN_CONSTANT_P], [1],
[Define if __builtin_constant_p exists.])
fi
# Very old GCCs or non-GCC compilers will not have __builtin_expect.
AC_CACHE_CHECK([for GCC __builtin_expect],
[ac_cv_have_gcc_builtin_expect],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[volatile int foo = 10;
return __builtin_expect (foo, 10);
]])],
[ac_cv_have_gcc_builtin_expect=yes],
[ac_cv_have_gcc_builtin_expect=no])])
if test "x$ac_cv_have_gcc_builtin_expect" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GCC_BUILTIN_EXPECT], [1],
[Define if __builtin_expect exists.])
fi
# Very old GCCs or non-GCC compilers will not have __builtin_unreachable.
AC_CACHE_CHECK([for GCC __builtin_unreachable],
[ac_cv_have_gcc_builtin_unreachable],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[volatile int foo = 0;
if (foo)
__builtin_unreachable ();
]])],
[ac_cv_have_gcc_builtin_unreachable=yes],
[ac_cv_have_gcc_builtin_unreachable=no])])
if test "x$ac_cv_have_gcc_builtin_unreachable" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GCC_BUILTIN_UNREACHABLE], [1],
[Define if __builtin_unreachable exists.])
fi
# Very old GCCs (pre-3.1) or non-GCC compilers will not have
# __builtin_types_compatible_p.
AC_CACHE_CHECK([for GCC __builtin_types_compatible_p],
[ac_cv_have_gcc_builtin_types_compatible_p],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[return __builtin_types_compatible_p (int, const int);
]])],
[ac_cv_have_gcc_builtin_types_compatible_p=yes],
[ac_cv_have_gcc_builtin_types_compatible_p=no])])
if test "x$ac_cv_have_gcc_builtin_types_compatible_p" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GCC_BUILTIN_TYPES_COMPATIBLE_P], [1],
[Define if __builtin_types_compatible_p exists.])
fi
# Very old GCCs (pre-3.1) or non-GCC compilers will not have
# __builtin_choose_expr.
AC_CACHE_CHECK([for GCC __builtin_choose_expr],
[ac_cv_have_gcc_builtin_choose_expr],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[return __builtin_choose_expr (1, 2, 3);
]])],
[ac_cv_have_gcc_builtin_choose_expr=yes],
[ac_cv_have_gcc_builtin_choose_expr=no])])
if test "x$ac_cv_have_gcc_builtin_choose_expr" = "xyes"; then
AC_DEFINE([JITTER_HAVE_GCC_BUILTIN_CHOOSE_EXPR], [1],
[Define if __builtin_choose_expr exists.])
fi
# Check for features depending on previous checks.
################################################################
# Function wrappers depend on the following GNU C features, which have all been
# available for a very long time:
# * typeof ;
# * statement expression ;
# * __builtin_types_compatible_p ;
# * __builtin_choose_expr .
AC_CACHE_CHECK([for function wrappers requirements],
[ac_cv_have_function_wrappers_requirements],
[if test "x$ac_cv_c_typeof" != '' \
&& test "x$ac_cv_have_gnu_c_statement_expressions" != '' \
&& test "x$ac_cv_have_gcc_builtin_types_compatible_p" != '' \
&& test "x$ac_cv_have_gcc_builtin_choose_expr" != ''; then
ac_cv_have_function_wrappers_requirements=yes
else
ac_cv_have_function_wrappers_requirements=no
fi])
if test "x$ac_cv_have_function_wrappers_requirements" = 'xyes'; then
AC_DEFINE([JITTER_HAVE_FUNCTION_WRAPPERS_REQUIREMENTS], [1],
[Define if the platform supports the GNU C extensions necessray
for function wrappers])
fi
# Local poisoning depends on the following GNU C features:
# * statement expressions;
# * pragma GCC diagnostic in function bodies.
AC_CACHE_CHECK([for local poisoning requirements],
[ac_cv_have_local_poisoning_requirements],
[if test "x$ac_cv_have_gnu_c_statement_expressions" != '' \
&& test "x$ac_cv_have_pragma_gcc_diagnostic_in_functions" != ''; then
ac_cv_have_local_poisoning_requirements=yes
else
ac_cv_have_local_poisoning_requirements=no
fi])
if test "x$ac_cv_have_local_poisoning_requirements" = 'xyes'; then
AC_DEFINE([JITTER_HAVE_LOCAL_POISONING_REQUIREMENTS], [1],
[Define if the platform supports the GNU C extensions necessray
for local poisoning])
fi
# Check for inline assembly or binary format features.
################################################################
# Check whether the assembler understands ".section .note.GNU-stack", which
# is needed on some platforms relying on executable stack support.
AC_CACHE_CHECK([for .note-GNU-stack section support],
[ac_cv_have_section_note_gnu_stack],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[asm volatile (".section .note.GNU-stack, \"\", @progbits\n"
".previous");
]])],
[ac_cv_have_section_note_gnu_stack=yes],
[ac_cv_have_section_note_gnu_stack=no])])
if test "x$ac_cv_have_section_note_gnu_stack" = "xyes"; then
AC_DEFINE([JITTER_HAVE_SECTION_NOTE_GNU_STACK], [1],
[Define if the platform supports a .note.GNU-stack section.])
fi
# Check for specific functions or "declarations" in the C library.
##################################################################
# Check for functions letting me know the page size and other system
# parameters.
AC_CHECK_FUNCS([sysconf getpagesize])
# Check for possible arguments to sysconf. This defines, for every SYMBOL which
# is "declared", a shell variable named ac_cv_have_decl_SYMBOL to "yes", where
# SYMBOL is adapted by capitalizing lower-case letters and replacing each
# non-alphanumeric character with an underscore.
AC_CHECK_DECLS([_SC_PAGESIZE,
_SC_PHYS_PAGES, _SC_AVPHYS_PAGES,
_SC_NPROCESSORS_CONF, _SC_NPROCESSORS_ONLN,
_SC_LEVEL1_ICACHE_SIZE, _SC_LEVEL1_DCACHE_SIZE,
_SC_LEVEL2_CACHE_SIZE,
_SC_LEVEL3_CACHE_SIZE,
_SC_LEVEL4_CACHE_SIZE],,,
[[#include <unistd.h>]])
# Check for functions letting me allocate executable space.
AC_CHECK_FUNCS([mmap64 mmap mremap munmap])
# Check for libc functions to allocate aligned blocks which can actually be
# freed. On inferior systems when none of these is available I have to resort
# to my own inefficient wrapper around malloc.
# Notice that memalign and valloc do not qualify, as there is no way to free
# the buffer they allocate.
AC_CHECK_FUNCS([aligned_alloc posix_memalign])
# Check for functions letting me set permissions on memory pages.
AC_CHECK_FUNCS([mprotect])
# Check for getrlimit/setrlimit and alarm.
AC_CHECK_FUNCS([getrlimit setrlimit alarm])
# Check for pipes. These are currently used for disassembling by
# communicating with an objdump process.
AC_CHECK_FUNCS([popen pclose])
# Check for a sane signal-handling API.
AC_CHECK_FUNCS([sigaction])
# Check for optional high-resolution timing functions.
AC_CHECK_FUNCS([clock_gettime])
# Check for timer functions needed for profiling.
AC_CHECK_FUNCS([setitimer])
# System-dependent configuration.
################################################################
# Define a few macros describing the host and the build systems.
AC_DEFINE_UNQUOTED([JITTER_HOST_CPU], ["$host_cpu"],
[The host CPU architecture, as per the GNU convention.])
AC_DEFINE_UNQUOTED([JITTER_HOST_VENDOR], ["$host_vendor"],
[The host vendor, as per the GNU convention.])
AC_DEFINE_UNQUOTED([JITTER_HOST_OS], ["$host_os"],
[The host operating system, as per the GNU convention.])
AC_DEFINE_UNQUOTED([JITTER_HOST_TRIPLET], ["$host"],
[The host system triplet, as per the GNU convention.])
AC_DEFINE_UNQUOTED([JITTER_BUILD_CPU], ["$build_cpu"],
[The build CPU architecture, as per the GNU convention.])
AC_DEFINE_UNQUOTED([JITTER_BUILD_VENDOR], ["$build_vendor"],
[The build vendor, as per the GNU convention.])
AC_DEFINE_UNQUOTED([JITTER_BUILD_OS], ["$build_os"],
[The build operating system, as per the GNU convention.])
AC_DEFINE_UNQUOTED([JITTER_BUILD_TRIPLET], ["$build"],
[The build system triplet, as per the GNU convention.])
# Define a feature macro if the host system is GNU. This is useful for
# conditionalizing on GNU libc features.
if echo "$host_os" | grep gnu > /dev/null; then
AC_DEFINE_UNQUOTED([JITTER_HOST_OS_IS_GNU], [1],
[Is the host operating system GNU?])
fi
# Check endianness.
AC_C_BIGENDIAN
# First define objdump options for the host architecture -- some of these are
# necessary, others a matter of preference. When the architecture is unknown
# guess some default which will probably work.
#
# This is independent from enabling assembly, and only relies on $host_cpu.
AC_MSG_CHECKING([for objdump options for "$host_cpu"])
AS_CASE([$host_cpu],
[aarch64*],
[jitter_objdump_options="--architecture=aarch64 --disassembler-options=reg-names-raw"],
[alpha*],
[jitter_objdump_options="--architecture= --disassembler-options=no-aliases"],
[arm*],
[jitter_objdump_options="--architecture=arm --disassembler-options=reg-names-raw"],
[i?86],
[jitter_objdump_options="--architecture=i386 --disassembler-options=att,suffix"],
[m68k*],
[jitter_objdump_options="--architecture= --disassembler-options=no-aliases"],
[mips|mipsel],
[if echo "$host_cpu" | grep 64 > /dev/null; then
jitter_bitness=64;
else
jitter_bitness=32;
fi;
# This feature test unfortunately relies on GCC (and also contains some
# duplicated code with the MIPSr6 test below, which would be
# avoidable). I know of no more portable way to distinguish MIPS r6
# from MIPS pre-r6.
if test "x$JITTER_HAVE_ACTUAL_GCC" = 'xyes'; then
jitter_mips_release=$(jitter_gcc_print_cpp_macro \
__mips_isa_rev);
fi;
if test "x$jitter_mips_release" = 'x'; then
jitter_mips_release=0;
fi;
if test "$jitter_mips_release" -ge 6; then
jitter_mips_architecture=mips:isa${jitter_bitness}r6;
else
jitter_mips_architecture=mips:isa${jitter_bitness};
fi;
jitter_objdump_options="--architecture=$jitter_mips_architecture --disassembler-options=no-aliases,reg-names=numeric"],
[mips64|mips64el],
[jitter_objdump_options="--architecture= --disassembler-options=no-aliases,reg-names=numeric"],
[parisc*],
[jitter_objdump_options="--architecture= --disassembler-options=no-aliases"],
[powerpc64|powerpc64le],
[jitter_objdump_options="--architecture=powerpc:common64"],
[ppc|powerpc|powerpcle],
[jitter_objdump_options="--architecture=powerpc:common"],
[riscv*],
[jitter_objdump_options="--architecture=riscv:rv64 --disassembler-options=no-aliases,numeric"],
[s390*],
[jitter_objdump_options="--architecture= --disassembler-options=no-aliases"],
[sh4*],
[jitter_objdump_options="--architecture=sh4a --disassembler-options=no-aliases"],
[sparc*],
[jitter_objdump_options="--architecture=sparc:v9b --disassembler-options=no-aliases"],
[x86_64],
[jitter_objdump_options="--architecture=i386:x86-64 --disassembler-options=x86-64,att,suffix"],
# Default case. Notice that, as a fallback case, we call objdump with
# "--architecture=" , without actually specifying an architecture name.
# Using a default architecture might not be completely reliable in the
# case of ISA extensions, but appears to work well in practice; in any
# case this is a fallback case: it is easy to provide a sensible default
# for supported architectures by adding cases above. There is no need
# for objdump to guess endianness, as the information is always provided
# as a separate option by the Jittery program, which knows the correct
# value from configure.
[jitter_objdump_options="--architecture= --disassembler-options=no-aliases"])
AC_MSG_RESULT([$jitter_objdump_options])
# Use a command-line option to explicitly disable assembly support. I've needed
# this for a version of FreeBSD, which shipped with a very old Gas.
# This is used to compute $jitter_enable_host_assembly ; a check below
# will decide if support for the host machine is actually available.
AC_MSG_CHECKING([if assembly support is (potentially) enabled])
AC_ARG_ENABLE([assembly],
AS_HELP_STRING([--enable-assembly@<:@=CPU@:>@],
[force the use of the named assembly (as in the first part of
a GNU-style target triplet), even if not detected.
With --disable-assembly or --enable-assembly=no, disable assembly support even
if available for the host machine.
With --enable-assembly or --enable-assembly=auto, enable assembly support if
automatically found. (default: auto)]),
jitter_enable_host_assembly="$enableval",
jitter_enable_host_assembly="auto")
AC_MSG_RESULT([$jitter_enable_host_assembly])
# Check whether we have assembly support for the host architecture, and an
# actual GCC to compile it.
#
# At this point jitter_enable_host_assembly is defined to one of "no", "auto",
# or an architecture name. If assembly support is not found "auto" will turn
# into "no" after this check, but "no" will not turn into "auto": the option
# above is conceived to *disable* assembly support when available.
#
# An architecture name given by the user will be used in place of the
# detected $host_cpu .
# At the end of the case statement jitter_supports_minimal_threading and
# jitter_supports_no_threading will be defined.
if test "x$jitter_enable_host_assembly" = 'xno' \
|| test "x$JITTER_HAVE_ACTUAL_GCC" = 'xno'; then \
default_host_cpu="no-assembly"
elif test "x$jitter_enable_host_assembly" = "xauto"; then
default_host_cpu="$host_cpu"
else
default_host_cpu="$jitter_enable_host_assembly"
fi
jitter_supports_minimal_threading='no'
jitter_supports_no_threading='no'
AC_MSG_CHECKING([if we have assembly support for "$default_host_cpu"])
AS_CASE([$default_host_cpu],
[aarch64*], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_AARCH64], [1], []
) # No ";": see the Autoconf manual
# near the end of "Defining C
# Preprocessor Symbols".
JITTER_ASSEMBLY_SUBDIRECTORY=aarch64
jitter_supports_minimal_threading=yes],
[alpha*], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_ALPHA], [1], []
) # No ";": see the Autoconf manual.
JITTER_ASSEMBLY_SUBDIRECTORY=alpha
jitter_supports_minimal_threading=yes],
[arm*], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_ARM], [1], []
) # No ";": see the Autoconf manual.
JITTER_ASSEMBLY_SUBDIRECTORY=arm
jitter_supports_minimal_threading=yes],
[i?86], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_I386], [1], []
) # No ";": see the Autoconf manual.
#JITTER_ASSEMBLY_SUBDIRECTORY=i386
true],
[m68k*], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_M68K], [1], []
) # No ";": see the Autoconf manual.
JITTER_ASSEMBLY_SUBDIRECTORY=m68k;
jitter_supports_minimal_threading=yes;
jitter_supports_no_threading=yes],
[mips|mipsel], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_MIPS], [1], []
) # No ";": see the Autoconf manual.
JITTER_ASSEMBLY_SUBDIRECTORY=mips;
jitter_supports_minimal_threading=yes;
jitter_supports_no_threading=yes;
# We reuse jitter_bitness and jitter_mips_release from
# the test above.
if test "$jitter_mips_release" -ge 6; then
AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_MIPS_R6_OR_LATER],
[1], []
) # No ";": see the Autoconf manual.
fi],
[mips64|mips64el],
[AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_MIPS], [1], []
) # No ";": see the Autoconf manual.
#JITTER_ASSEMBLY_SUBDIRECTORY=mips;
true],
[parisc*], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_PARISC], [1], []
) # No ";": see the Autoconf manual.
#JITTER_ASSEMBLY_SUBDIRECTORY=parisc
true],
[powerpc64|powerpc64le],
[AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_POWERPC], [1], []
) # No ";": see the Autoconf manual.
#JITTER_ASSEMBLY_SUBDIRECTORY=powerpc
true],
[ppc|powerpc|powerpcle],
[AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_POWERPC], [1], []
) # No ";": see the Autoconf manual.
JITTER_ASSEMBLY_SUBDIRECTORY=powerpc;
jitter_supports_minimal_threading=yes;
jitter_supports_no_threading=yes],
[riscv*], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_RISCV], [1], []
) # No ";": see the Autoconf manual.
JITTER_ASSEMBLY_SUBDIRECTORY=riscv;
jitter_supports_minimal_threading=yes;
jitter_supports_no_threading=yes],
[s390x], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_S390], [1], []
) # No ";": see the Autoconf manual.
JITTER_ASSEMBLY_SUBDIRECTORY=s390x
jitter_supports_minimal_threading=yes],
[s390], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_S390], [1], []
) # No ";": see the Autoconf manual.
true],
[sh4*], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_SH], [1], []
) # No ";": see the Autoconf manual.
JITTER_ASSEMBLY_SUBDIRECTORY=sh
# Assembly support is not ready for SH, and sadly it
# might never be. It is very difficult to support.
# See the manual.
jitter_supports_minimal_threading=no;
jitter_supports_no_threading=no],
[sparc*], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_SPARC], [1], []
) # No ";": see the Autoconf manual.
JITTER_ASSEMBLY_SUBDIRECTORY=sparc
jitter_supports_minimal_threading=yes;
jitter_supports_no_threading=yes],
[x86_64], [AC_DEFINE_UNQUOTED([JITTER_HOST_CPU_IS_X86_64], [1], []
) # No ";": see the Autoconf manual.
# x86_64 is used in several unusual ways where the
# pointer size is not 64 bits. Check.
if test "x$ac_cv_sizeof_void_p" = 'x8'; then
# Ordinary x86_64 in long mode, sizeof (void *) == 8.
JITTER_ASSEMBLY_SUBDIRECTORY=x86_64
jitter_supports_minimal_threading=yes
jitter_supports_no_threading=yes
elif test "x$ac_cv_sizeof_void_p" = 'x4'; then
# Special case, for handling -m32: if sizeof (void *)
# is not 64 bits, treat this as i386.
# Presumably we are using -m32.
# FIXME: i386
true
else
AC_MSG_ERROR([this should never happen: on x86_64 we
have that sizeof (void *) is $ac_cv_sizeof_void_p instead of 8 nor 4])
fi],
# Default case.
[])
# Define jitter_has_host_assembly . We still have to give feedback about
# whether we have host assembly support...
if test "x$JITTER_ASSEMBLY_SUBDIRECTORY" = 'x'; then
jitter_has_host_assembly=no
else
jitter_has_host_assembly=yes
fi
# Define objdump options unconditionally, even if the user disabled host
# assembly. This is harmless enough, as the code is defensive and will
# revert to a sensible fallback solution when objdump fails.
# Finally give feedback about having assembly support.
AC_DEFINE_UNQUOTED([JITTER_OBJDUMP_OPTIONS],
["$jitter_objdump_options"],
[architecture-specific options for objdump])
if test "x$jitter_has_host_assembly" = "xno"; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes: $JITTER_ASSEMBLY_SUBDIRECTORY])
fi
# Temporarily, as of 2022-02, disable minimal-threading by default on every
# architecture: there is some bug that I have not time to fix now but GNU poke
# is being released. It is better to ship with no-threading on but
# minimal-threading disabled.
AC_MSG_WARN([temporarily disabling minimal-threading by default on every \
architecture including $default_host_cpu, in order to avoid surprising the \
GNU poke friends with mysterious errors. I still have bugs to fix.])
jitter_supports_minimal_threading=no
# GNU poke, which is currently the main Jitter client, uses far branches which
# are only well supported on two architectures where the instruction encodings
# is generous enough. It is a pity, but I am temporarily disabling this until
# my code generator suppots indirect branches to cover this case.
AC_MSG_CHECKING([if this architecture has too narrow branch displacements])
AS_CASE([$JITTER_ASSEMBLY_SUBDIRECTORY],
[''],
[AC_MSG_RESULT([irrelevant, no-threading is not supported anyway])],
[m68k*],
[AC_MSG_RESULT([m68k does allow for 32-bit displacements, which \
would be good; but as of early February 2022 there is a bug we are still \
chasing; disabling])
jitter_supports_no_threading=no],
[x86_64],
[AC_MSG_RESULT([no: $JITTER_ASSEMBLY_SUBDIRECTORY allows for 32-bit \
displacements, which is good])],
# Default case
[AC_MSG_RESULT([yes, unfortunately: disabling no-threading on \
$JITTER_ASSEMBLY_SUBDIRECTORY for the time being, to avoid surprising the \
GNU poke friends. I need to automatically generate indirect branches where \
needed])
jitter_supports_no_threading=no])
# If the user explicitly requested support for an architecture but that
# was not found, fail.
if test "x$jitter_enable_host_assembly" != "xno" \
&& test "x$jitter_enable_host_assembly" != "xauto" \
&& test "x$JITTER_ASSEMBLY_SUBDIRECTORY" = "x"; then
AC_MSG_ERROR([could not find assembly for $jitter_enable_host_assembly])
fi
# Give feedback about minimal-threading and no-threading support.
AC_MSG_CHECKING([if the architecture supports minimal-threading])
AC_MSG_RESULT([$jitter_supports_minimal_threading])
AC_MSG_CHECKING([if the architecture supports no-threading])
AC_MSG_RESULT([$jitter_supports_no_threading])
# Check if assembly support exists for the host machine.
################################################################
# The CPP feature macro JITTER_HAVE_ASSEMBLY will be defined iff there is
# support for the host machine. If so JITTER_ASSEMBLY_SUBDIRECTORY will be
# AC_SUBST'ed to be the subdirectory holding configuration-specific files.
if test "x$jitter_has_host_assembly" = "xyes"; then
AC_SUBST([JITTER_ASSEMBLY_SUBDIRECTORY])
AC_DEFINE_UNQUOTED([JITTER_HAVE_ASSEMBLY], [1],
[Define if we have assembly for the host architecture.])
AC_DEFINE_UNQUOTED([JITTER_ASSEMBLY_SUBDIRECTORY], ["$JITTER_ASSEMBLY_SUBDIRECTORY"],
[the subdirectory containing assembly files.])
else
# Having an existing assembly subdirectory as the value of the substitution,
# even if the source files it contains are useless, helps with the dist make
# target.
# Thanks to this trick I can use variables inside pathnames within
# Makefile.am , which makes the code a lot simpler. Notice that in this case
# the CPP feature macro definition JITTER_HAVE_ASSEMBLY remains undefined,
# and the Automake conditional JITTER_ENABLE_ASSEMBLY remains false.
# Notice that the directory simply named "dummy" here is in fact a recursive
# copy of a directory with a longer name, generated by the bootstrap script.
# This serves to keep path names shorter, which is useful for the dist
# target.
AC_SUBST([JITTER_ASSEMBLY_SUBDIRECTORY], [dummy])
fi
# Configuration-dependent features not directly relying on assembly support.
############################################################################
# According to the architecture some operations (defined in C, and still
# portable to any archtiecture) may be faster or slower. Jitter contains
# conditional code to support different solutions.
#
# This is independent from architecture-specific assembly support.
# Some architectures support a good way of computing a conditional expression
# based on the negative sign of a disciminand without using branches; other
# architectures do not.
AC_MSG_CHECKING([if straight-line negativity tests are fast])
# By default, let us say that the straight-line version is better.
jitter_have_fast_straight_line_negativity=yes
AS_CASE([$default_host_cpu],
# Only on these few archtiectures my hand-optimized straight-line
# version is slower than the naïve alternative.
[x86_64|i?86|sh4*],
[jitter_have_fast_straight_line_negativity=no])
AC_MSG_RESULT([$jitter_have_fast_straight_line_negativity])
if test "x$jitter_have_fast_straight_line_negativity" = "xyes"; then
AC_DEFINE_UNQUOTED([JITTER_HAVE_FAST_STRAIGHT_LINE_NEGATIVITY], [1],
[Define to 1 iff negativity tests are faster straight-line])
fi
# On some architectures it is efficient to "mask off" a tag in the low-order
# bits, in the sense of bitwise and-ing with a literal constant having zeroes
# only in the significant bits. This in practice require an and instruction
# with a sign-extended immediate, large immediate operands, an and instruction
# with a negated zero-extended immedate, or something equivalent.
AC_MSG_CHECKING([if and-ing with a sign-extended negative immediate is fast])
# By default, let us say that the operation is efficient.
jitter_have_fast_mask_off=yes
AS_CASE([$default_host_cpu],
# On these archtiectures the "masking off" operation has a faster
# alternative, because the bitwise and instruction with an immediate
# zero-extends its argument instead of sign-extending it, or there is
# no immediate version at all working on an arbitrary register, or
# because of some other restriction.
#
# Notes on specific architectures:
# SH, while not ideal in this sense, has particularly limited shifting
# instructions, making the mask alternative better even if it requires
# a separate instruction to load an immediate into a temporary before
# and-ing; the immediate, at least, is sign-extended.
[mips*],
[jitter_have_fast_mask_off=no])
AC_MSG_RESULT([$jitter_have_fast_mask_off])
if test "x$jitter_have_fast_mask_off" = "xyes"; then
AC_DEFINE_UNQUOTED([JITTER_HAVE_FAST_MASK_OFF], [1],
[Define to 1 iff masking off low-order bits is efficient])
fi
# Binary format.
################################################################
# Determine whether the host OS uses the ELF binary format.
# This is crude in many cases but probably sufficient for most configurations.
AC_MSG_CHECKING([if the host OS uses the ELF binary format])
AS_CASE([$host_os],
# We know that some systems are not ELF...
[*aout*|*coff*],
[jitter_host_os_is_elf=no],
# ...Others, with "ELF" in the system name, definitely are.
[*elf*],
[jitter_host_os_is_elf=yes],
# Specific known-ELF systems.
[*linux-android*],
[jitter_host_os_is_elf=yes],
# Do not add GNU systems as a special case: very old GNU/Linux systems
# use non-ELF formats, and GNU is covered by the fallback case below in
# any case.
[*uclibc*],
[jitter_host_os_is_elf=yes],
# Fallback: check for the __ELF__ macro suppored by GCC's preprocessor
# and by other preprocessors trying to be compatible with it. When the
# macro use survives preprocessing we deduce the macro is *not* defined.
[jitter_host_os_is_elf=$( (echo __ELF__ | jitter_cpp_preprocess \
| grep __ELF__ > /dev/null) \
&& echo no \
|| echo yes)])
AC_MSG_RESULT([$jitter_host_os_is_elf])
# In case we found the ELF format, compile a little snippet to make sure that
# the GNU Assembler section stack machinery works, including subsection numbers
# after section names. This is not supported by old binutils, and we
# critically depend on it for advanced dispatches on ELF systems.
if test "x$jitter_host_os_is_elf" = 'xyes' \
&& test "x$JITTER_GNU_ASSEMBLER" != 'xno'; then
AC_CACHE_CHECK([if the assembler recognizes .pushsection with a subsection],
[ac_cv_jitter_elf_subsection_stack],
[AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[]],
[[asm volatile (".pushsection .text, 10");
asm volatile (".byte 1, 2, 3, 4");
asm volatile (".popsection");]])],
[ac_cv_jitter_elf_subsection_stack=yes],
[ac_cv_jitter_elf_subsection_stack=no])])
# Change jitter_host_os_is_elf: what we just discovered determines if
# we can actually use ELF, or if the support is not adequate.
jitter_host_os_is_elf="$ac_cv_jitter_elf_subsection_stack"
if test "x$jitter_host_os_is_elf" = 'xyes'; then
AC_MSG_NOTICE([We can actually use ELF: good.])
else
AC_MSG_WARN([We cannot really use ELF on this platform])
fi
fi
# Determine whether the host OS uses the COFF binary format.
# Again, this is crude but should suffice.
AC_MSG_CHECKING([if the host OS uses the COFF binary format])
AS_CASE([$host_os],
[*coff*],
[jitter_host_os_is_coff=yes],
[*mingw*],
[jitter_host_os_is_coff=yes],
[jitter_host_os_is_coff=no])
AC_MSG_RESULT([$jitter_host_os_is_coff])
# Determine whether the host OS uses the Mach-O binary format.
# Once more, this is crude but enough for the common case.
AC_MSG_CHECKING([if the host OS uses the Mach-O binary format])
AS_CASE([$host_os],
[*darwin*],
[jitter_host_os_is_macho=yes],
[jitter_host_os_is_macho=no])
AC_MSG_RESULT([$jitter_host_os_is_macho])
# Define C feature macros telling whether we can rely on the binary format
# being one of the supported ones.
if test "x$jitter_host_os_is_elf" = "xyes"; then
AC_DEFINE_UNQUOTED([JITTER_HOST_OS_IS_ELF], [1],
[Define to 1 iff the host OS uses the ELF format])
fi
if test "x$jitter_host_os_is_coff" = "xyes"; then
AC_DEFINE_UNQUOTED([JITTER_HOST_OS_IS_COFF], [1],
[Define to 1 iff the host OS uses the COFF format])
fi
if test "x$jitter_host_os_is_macho" = "xyes"; then
AC_DEFINE_UNQUOTED([JITTER_HOST_OS_IS_MACHO], [1],
[Define to 1 iff the host OS uses the MACHO format])
fi
AC_MSG_CHECKING([if the host OS uses a known binary format])
if test "x$jitter_host_os_is_elf" = "xyes" \
|| test "x$jitter_host_os_is_coff" = "xyes"; then
jitter_have_known_binary_format='yes'
# FIXME: If I ever add support for Mach-O sections I will need another
# clause in the condition above.
AC_DEFINE_UNQUOTED([JITTER_HAVE_KNOWN_BINARY_FORMAT], [1],
[Define to 1 iff we can handle globals/sections in asm])
else
jitter_have_known_binary_format='no'
fi
AC_MSG_RESULT([$jitter_have_known_binary_format])
# ELF symbol visibility.
################################################################
# This is an experimental feature requested by the poke people. The API may
# change in the future.
# If the option is passed, compile with -fvisibility=hidden. This is the
# default only on ELF systems, with either GCC version 4 or later or clang
# version 2 or later, in sub-package mode.
if test "x$jitter_host_os_is_elf" = "xyes" \
&& ( (test "x$JITTER_HAVE_ACTUAL_GCC" = "xyes" \
&& test "$JITTER_GCC_MAJOR_VERSION" -ge 4) \
|| (test "x$JITTER_HAVE_CLANG" = "xyes" \
&& test "$JITTER_CLANG_MAJOR_VERSION" -ge 2)) \
&& test "x$JITTER_SUBPACKAGE_DIRECTORY" != 'x'; then
jitter_enable_visibility_hidden_default=yes
else
jitter_enable_visibility_hidden_default=no
fi
AC_MSG_CHECKING([if libraries should be compiled with -fvisibility=hidden])
AC_ARG_ENABLE([visibility-hidden],
AS_HELP_STRING([--enable-visibility-hidden],
[experimental: compile passing the GCC option
-fvisibility=hidden. Default: yes on ELF systems using GCC 4
or later in sub-package mode; no elsewhere.]),
jitter_enable_visibility_hidden="$enableval",
jitter_enable_visibility_hidden="$jitter_enable_visibility_hidden_default")
AC_MSG_RESULT([$jitter_enable_visibility_hidden])
AM_CONDITIONAL([JITTER_ENABLE_VISIBILITY_HIDDEN],
[test "x$jitter_enable_visibility_hidden" = "xyes"])
# Recognize specific operating systems.
################################################################
# Recognize specific operating systems or kernels by library features, without
# trusting the triplet...
AC_CHECK_FUNCS([VirtualAlloc VirtualProtect])
if test "x$ac_cv_func_VirtualAlloc" = "xyes" \
&& test "x$ac_cv_func_VirtualProtect" = "xyes"; then
AC_DEFINE_UNQUOTED([JITTER_HOST_OS_IS_WINDOWS], [1],
[Define to 1 iff the host system is windows])
fi
# ...and some other systems that are more difficult to match by the triplet.
jitter_host_os_is_android='no'
jitter_host_os_is_freebsd='no'
jitter_host_os_is_openbsd='no'
jitter_host_os_is_netbsd='no'
AS_CASE([$host_os],
[*linux-android*], [jitter_host_os_is_android='yes'],
[*freebsd*], [jitter_host_os_is_freebsd='yes'],
[*netbsd*], [jitter_host_os_is_netbsd='yes'],
[*openbsd*], [jitter_host_os_is_openbsd='yes'])
if test "x$jitter_host_os_is_android" = 'xyes'; then
AC_DEFINE_UNQUOTED([JITTER_HOST_OS_IS_ANDROID], [1],
[Define to 1 iff the host system is android])
fi
if test "x$jitter_host_os_is_freebsd" = 'xyes'; then
AC_DEFINE_UNQUOTED([JITTER_HOST_OS_IS_FREEBSD], [1],
[Define to 1 iff the host system is FreeBSD])
fi
if test "x$jitter_host_os_is_netbsd" = 'xyes'; then
AC_DEFINE_UNQUOTED([JITTER_HOST_OS_IS_NETBSD], [1],
[Define to 1 iff the host system is NetBSD])
fi
if test "x$jitter_host_os_is_openbsd" = 'xyes'; then
AC_DEFINE_UNQUOTED([JITTER_HOST_OS_IS_OPENBSD], [1],
[Define to 1 iff the host system is OpenBSD])
fi
# M4sh machinery.
################################################################
# For portability and for better factoring I generate shell scripts with M4sh.
# The actual source files are ".m4sh.in" scripts, to be preprocessed by autom4te
# into ".in" scripts, for aclocal to perform @-substitutions into ordinary
# scripts (no file extension).
# The first step of this double translation relies on autom4te, which is not
# required on the user's machine; therefore I distribute ".in" scripts, but
# the user needs autom4te if she wants to regenerate them.
AC_CHECK_PROG(HAS_AUTOM4TE, autom4te, yes, no)
if test "x$HAS_AUTOM4TE" != "xyes"; then
AC_MSG_WARN([You need autom4te, coming from GNU Autoconf, if you want to
rebuild scripts from their M4sh source])
fi
AM_MISSING_PROG(AUTOM4TE, autom4te)
AM_CONDITIONAL([JITTER_HAVE_AUTOM4TE],
[test "x$HAS_AUTOM4TE" = "xyes"])
# Emulator support for running cross-compilied binaries.
################################################################
# We optionally support qemu-user emulation for running cross-compiled binaries
# for the host on the build system; other user binary emulators might work as
# well.
# This is particularly useful for running the test suite when cross-compiling.
# The option argument is the emulator command line included options, to be
# followed by the emulated program with its own options: for example
# "qemu-ppc -L /my-cross-path/powerpc-unknown-linux-gnu/sysroot" .
AC_MSG_CHECKING([if host emulator support is used])
AC_ARG_WITH([emulator],
AS_HELP_STRING([--with-emulator="EMULATOR WITH OPTIONS"],
[use an emulator running cross-compiled binaries,
including the test suite, on the build platform: default no]),
jitter_with_emulator="$withval",
jitter_with_emulator="")
if test "x$jitter_with_emulator" = "x" \
|| test "x$jitter_with_emulator" = "xno"; then
jitter_with_emulator=""
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes, $jitter_with_emulator])
fi
AC_SUBST([JITTER_EMULATOR], $jitter_with_emulator)
# Can we actually rebuild man pages?
################################################################
# GNU help2man could be made to work even when cross-compiling, as long as there
# is a usable emulator. Still, there is very little gain in doing this and lots
# of gratuitous headaches when using the missing script with an emulator. I
# will keep things simple for now.
# For the same reason, and to reduce wasted time, do not bother bulding man
# pages in sub-package mode.
AC_MSG_CHECKING([if we should use help2man to rebuild man pages])
if test "x$jitter_cross_compiling" != "xyes" \
&& test "x$jitter_has_help2man" = "xyes" \
&& test "x$JITTER_SUBPACKAGE_DIRECTORY" = 'x'; then
jitter_can_rebuild_man_pages="yes"
AC_MSG_RESULT([yes])
else
jitter_can_rebuild_man_pages="no"
AC_MSG_RESULT([no (cross-compiling, or no help2man, or sub-package mode)])
fi
AM_CONDITIONAL([JITTER_CAN_REBUILD_MAN_PAGES],
[test "x$jitter_can_rebuild_man_pages" = "xyes"])
# Valgrind support.
################################################################
# We optionally support valgrind in the test suite. First use a configure
# option to override the default.
AC_MSG_CHECKING([if Valgrind is supported])
AC_ARG_WITH([valgrind],
AS_HELP_STRING([--with-valgrind@<:@=VALGRINDNAME@:>@],
[use Valgrind for the test suite (default:
detected)]),
jitter_with_valgrind="$withval",
jitter_with_valgrind="detect")
# At this point $jitter_with_valgrind may be defined as "yes" , "no" ,
# "detect" , or the program name.
# Decide whether to actually enable valgrind. Right now we disable
# valgrind when cross-compilation or an emulator is enabled at the
# same time.
if test "x$jitter_cross_compiling" = "xyes"; then
AC_MSG_RESULT([no, disabled because we are cross-compiling])
AC_SUBST([JITTER_VALGRIND], [])
elif ! test "x$JITTER_EMULATOR" = "x"; then
AC_MSG_RESULT([no, disabled because an emulator is also used])
AC_SUBST([JITTER_VALGRIND], [])
elif test "x$jitter_with_valgrind" = "xno"; then
AC_MSG_RESULT([no, disabled by configure option])
AC_SUBST([JITTER_VALGRIND], [])
elif test "x$jitter_with_valgrind" = "xdetect" \
|| test "x$jitter_with_valgrind" = "xyes"; then
AC_PATH_PROG([JITTER_VALGRIND], [valgrind])
if test "x$JITTER_VALGRIND" = "x"; then
AC_MSG_RESULT([no, not found])
if test "x$jitter_with_valgrind" = "xyes"; then
AC_MSG_ERROR([Valgrind requested but not found])
fi
else
AC_MSG_RESULT([yes, found as $JITTER_VALGRIND])
fi
else
AC_MSG_RESULT([yes, defined by configure option as $jitter_with_valgrind])
AC_SUBST([JITTER_VALGRIND], [$jitter_with_valgrind])
fi
# Test suite support.
################################################################
# Decide whether we should enable the test suite...
AC_MSG_CHECKING([if we should enable the test suite])
# By default we can run the test suite if we have all the needed utilites
# *and* either we are not cross-compiling, or if an emulator is enabled,
# *and* we are not in sub-package mode...
if test "x$jitter_test_suite_missing_progs" = "x" \
&& ( test "x$jitter_cross_compiling" = "xno" \
|| ! test "x$JITTER_EMULATOR" = "x") \
&& test "x$JITTER_SUBPACKAGE_DIRECTORY" = 'x'; then
default=yes
else
default=no
fi
# ... But this default can be overridden with a configure option.
AC_ARG_ENABLE([jitter-test-suite],
AS_HELP_STRING([--enable-jitter-test-suite],
[enable the test suite (default: automatically
detected in non-sub-package mode; no in
sub-package mode). The name includes "jitter"
to prevent collisions with configure options
in a super-package]),
jitter_enable_test_suite="$enableval",
jitter_enable_test_suite="$default")
if ! test "x$jitter_enable_test_suite" = "xyes" \
&& ! test "x$jitter_enable_test_suite" = "xno"; then
AC_MSG_ERROR([invalid option argument for --enable-jitter-test-suite])
fi
# Now we know if the test suite is enabled or not. Define a substitution and
# an Automake conditional about it.
AC_SUBST([JITTER_ENABLE_TEST_SUITE], [$jitter_enable_test_suite])
AC_MSG_RESULT([$JITTER_ENABLE_TEST_SUITE])
AM_CONDITIONAL([JITTER_ENABLE_TEST_SUITE],
[test "x$JITTER_ENABLE_TEST_SUITE" = "xyes"])
# If the test suite was enabled despite a missing dependency, print a warning.
if test "x$jitter_enable_test_suite" = "xyes" \
&& ! test "x$jitter_test_suite_missing_progs" = "x"; then
AC_MSG_WARN([enabling the test suite despite missing programs, as \
requested. You can expect some spurious failures])
fi
# Print a warning about skipped test cases if we can run the test suite but
# Valgrind is disabled.
if test "x$jitter_enable_test_suite" = "xyes" \
&& test "x$JITTER_VALGRIND" = "x"; then
AC_MSG_WARN([the test suite will skip Valgrind test cases])
fi
# In sub-package mode when the test suite is disabled, running it anyway (as it
# may well happen because of recursion from the super-package) should be
# successful but also as silent as possible.
# A good way of ensuring this is redefining TEST_SUITE_LOG to have an empty
# value instead of the default test-suite.log: this will take precedence
# over any setting of the same variable by Automake.
# Explicitly defining TEST_SUITE_LOG in Makefile.am would also work, but at
# the cost of generating a warning when Automake is run.
# This way of using AC_SUBST to override Automake default behavior is in fact
# supported and documented in the Automake manual (§"Extending Automake Rules").
if test "x$JITTER_SUBPACKAGE_DIRECTORY" != 'x' \
&& test "x$jitter_enable_test_suite" = 'xno'; then
jitter_test_suite_log_value=''
else
jitter_test_suite_log_value='test-suite.log'
fi
AC_SUBST([TEST_SUITE_LOG], [$jitter_test_suite_log_value])
# Dispatches to be enabled.
################################################################
# Check whether each dispatch is available and enabled, in order of
# increasing preference. The last found to be enabled is also considered the
# best.
jitter_enabled_dispatches=""
jitter_best_dispatch=""
# Define a disclaimer to be printed to the user when checking which dispatches
# are enabled, showing that the decision is not final in sub-package mode.
if test "x$JITTER_SUBPACKAGE_DIRECTORY" != 'x'; then
jitter_subpackage_disclaimer=', provisionally (sub-package mode)'
else
jitter_subpackage_disclaimer=''
fi
# Is the switch dispatch enabled? Check the default and the configure
# command-line option.
AC_MSG_CHECKING([if switch dispatching is enabled])
default=yes
AC_ARG_ENABLE([dispatch-switch],
AS_HELP_STRING([--enable-dispatch-switch],
[enable switch dispatching (default: yes)]),
jitter_enable_dispatch_switch="$enableval",
jitter_enable_dispatch_switch="$default")
if test "x$jitter_enable_dispatch_switch" = "xyes"; then
jitter_best_dispatch="switch"
jitter_enabled_dispatches="$jitter_enabled_dispatches switch"
fi
AC_MSG_RESULT([$jitter_enable_dispatch_switch$jitter_subpackage_disclaimer])
# Is the direct-threading dispatch enabled? Check the default and the configure
# command-line option.
AC_MSG_CHECKING([if direct-threading dispatch is enabled])
default=$(test "x$ac_cv_have_gnu_c_computed_goto" = 'xyes' \
&& echo yes || echo no)
AC_ARG_ENABLE([dispatch-direct-threading],
AS_HELP_STRING([--enable-dispatch-direct-threading],
[enable direct-threading dispatch: default yes if and
only if the compiler supports GNU C's computed goto]),
jitter_enable_dispatch_direct_threading="$enableval",
jitter_enable_dispatch_direct_threading="$default")
if test "x$jitter_enable_dispatch_direct_threading" = "xyes"; then
jitter_best_dispatch="direct-threading"
jitter_enabled_dispatches="$jitter_enabled_dispatches direct-threading"
fi
AC_MSG_RESULT([$jitter_enable_dispatch_direct_threading$jitter_subpackage_disclaimer])
# Is the minimal-threading dispatch enabled? Check the default and the
# configure command-line option.
AC_MSG_CHECKING([if minimal-threading dispatch is enabled])
if test "x$JITTER_HAVE_ACTUAL_GCC" = 'xyes' \
&& test "x$jitter_have_known_binary_format" = 'xyes' \
&& test "x$jitter_has_host_assembly" = 'xyes' \
&& test "x$jitter_supports_minimal_threading" = 'xyes' \
&& test "x$ac_cv_have_assembly_names_for_non_functions" = 'xyes' \
&& test "x$ac_cv_have_function_wrappers_requirements" = 'xyes'; then
default=yes
else
default=no
fi
AC_ARG_ENABLE([dispatch-minimal-threading],
AS_HELP_STRING([--enable-dispatch-minimal-threading],
[enable minimal-threading dispatch: default yes if and
only if a sufficiently recent GCC (not an imitation) is used, the
host architecture has assembly and minimal-threading support, function
wrapper prerequisites are satisfied and the binary format is supported]),
jitter_enable_dispatch_minimal_threading="$enableval",
jitter_enable_dispatch_minimal_threading="$default")
if test "x$jitter_enable_dispatch_minimal_threading" = "xyes"; then
jitter_best_dispatch="minimal-threading"
jitter_enabled_dispatches="$jitter_enabled_dispatches minimal-threading"
fi
AC_MSG_RESULT([$jitter_enable_dispatch_minimal_threading$jitter_subpackage_disclaimer])
# Is the no-threading dispatch enabled? Check the default and the configure
# command-line option.
# I see a problem with GCC 4 and no-threading that I still have to
# investigate. It might not be worth the trouble, as GCC 4 is now
# very old.
AC_MSG_CHECKING([if no-threading dispatch is enabled])
if test "x$JITTER_HAVE_ACTUAL_GCC" = 'xyes' \
&& test "$JITTER_GCC_MAJOR_VERSION" -ge 5 \
&& test "x$jitter_have_known_binary_format" = 'xyes' \
&& test "x$jitter_has_host_assembly" = 'xyes' \
&& test "x$jitter_supports_no_threading" = 'xyes' \
&& test "x$ac_cv_have_assembly_names_for_non_functions" = 'xyes' \
&& test "x$ac_cv_have_function_wrappers_requirements" = 'xyes'; then
default=yes
else
default=no
fi
AC_ARG_ENABLE([dispatch-no-threading],
AS_HELP_STRING([--enable-dispatch-no-threading],
[enable no-threading dispatch: default yes if and
only if GCC (not an imitation) version 5 or later is used, the host
architecture has assembly and no-threading support, function
wrapper prerequisites are satisfied and the binary format is
supported]),
jitter_enable_dispatch_no_threading="$enableval",
jitter_enable_dispatch_no_threading="$default")
if test "x$jitter_enable_dispatch_no_threading" = "xyes"; then
jitter_best_dispatch="no-threading"
jitter_enabled_dispatches="$jitter_enabled_dispatches no-threading"
fi
AC_MSG_RESULT([$jitter_enable_dispatch_no_threading$jitter_subpackage_disclaimer])
# Fail if no-threading dispatch was enabled without assembly support.
if test "x$jitter_has_host_assembly" = "xno" \
&& test "x$jitter_enable_dispatch_no_threading" = "xyes"; then
AC_MSG_ERROR([no-threading dispatch requires assembly support])
fi
# Fail if there is no best dispatch: this means that none was enabled.
if test "x$jitter_best_dispatch" = 'x'; then
AC_MSG_ERROR([no dispatch was enabled, but you need at least one])
fi
# In sub-package mode disable every dispatch except for the best one, in order
# to speed up compilation and testing.
if test "x$JITTER_SUBPACKAGE_DIRECTORY" != 'x'; then
AC_MSG_NOTICE([sub-package mode: disabling every dispatch except]
[$jitter_best_dispatch])
AC_MSG_NOTICE([ (the following dispatches could have been enabled:]
[ $jitter_enabled_dispatches)])
jitter_enabled_dispatches=" $jitter_best_dispatch"
jitter_enable_dispatch_switch=no
jitter_enable_dispatch_direct_threading=no
jitter_enable_dispatch_minimal_threading=no
jitter_enable_dispatch_no_threading=no
case "$jitter_best_dispatch" in
switch)
jitter_enable_dispatch_switch=yes;;
direct-threading)
jitter_enable_dispatch_direct_threading=yes;;
minimal-threading)
jitter_enable_dispatch_minimal_threading=yes;;
no-threading)
jitter_enable_dispatch_no_threading=yes;;
*) AC_MSG_ERROR([this should never happen]);;
esac
fi
# Now that we have finally decided which dispatches will be enabled, define a
# substitution, a CPP feature macro and an Automake conditional for each of them.
AC_SUBST([JITTER_ENABLE_DISPATCH_SWITCH],
[$(test "x$jitter_enable_dispatch_switch" = 'xyes' && echo '1')])
AC_SUBST([JITTER_ENABLE_DISPATCH_DIRECT_THREADING],
[$(test "x$jitter_enable_dispatch_direct_threading" = 'xyes' && echo '1')])
AC_SUBST([JITTER_ENABLE_DISPATCH_MINIMAL_THREADING],
[$(test "x$jitter_enable_dispatch_minimal_threading" = 'xyes' && echo '1')])
AC_SUBST([JITTER_ENABLE_DISPATCH_NO_THREADING],
[$(test "x$jitter_enable_dispatch_no_threading" = 'xyes' && echo '1')])
if test "x$jitter_enable_dispatch_switch" = 'xyes'; then
AC_DEFINE_UNQUOTED([JITTER_ENABLE_DISPATCH_SWITCH], [1],
[enable switch dispatch])
fi
if test "x$jitter_enable_dispatch_direct_threading" = 'xyes'; then
AC_DEFINE_UNQUOTED([JITTER_ENABLE_DISPATCH_DIRECT_THREADING], [1],
[enable direct-threading dispatch])
fi
if test "x$jitter_enable_dispatch_minimal_threading" = 'xyes'; then
AC_DEFINE_UNQUOTED([JITTER_ENABLE_DISPATCH_MINIMAL_THREADING], [1],
[enable minimal-threading dispatch])
fi
if test "x$jitter_enable_dispatch_no_threading" = 'xyes'; then
AC_DEFINE_UNQUOTED([JITTER_ENABLE_DISPATCH_NO_THREADING], [1],
[enable no-threading dispatch])
fi
AM_CONDITIONAL([JITTER_ENABLE_DISPATCH_SWITCH],
[test "x$jitter_enable_dispatch_switch" = 'xyes'])
AM_CONDITIONAL([JITTER_ENABLE_DISPATCH_DIRECT_THREADING],
[test "x$jitter_enable_dispatch_direct_threading" = 'xyes'])
AM_CONDITIONAL([JITTER_ENABLE_DISPATCH_MINIMAL_THREADING],
[test "x$jitter_enable_dispatch_minimal_threading" = 'xyes'])
AM_CONDITIONAL([JITTER_ENABLE_DISPATCH_NO_THREADING],
[test "x$jitter_enable_dispatch_no_threading" = 'xyes'])
# AC_SUBST the list of all the enabled dispatches, and the best one;
# these don't use quotes as they are meant for jitter-config and shell scripts,
# not for C code.
AC_SUBST([JITTER_ENABLED_DISPATCHES],
[$jitter_enabled_dispatches])
AC_SUBST([JITTER_BEST_DISPATCH],
[$jitter_best_dispatch])
# Define a substitution holding the best dispatch name, and a a CPP
# feature macro named after the best dispatch.
# We also need an Autoheader template for every possible CPP "best-distpatching"
# macro name, as the actual name is computed with a shell expansion and
# autoheader cannot discover every possibility.
AH_TEMPLATE([JITTER_BEST_DISPATCH_IS_SWITCH],
[Defined if switch is the best enabled dispatch.])
AH_TEMPLATE([JITTER_BEST_DISPATCH_IS_DIRECT_THREADING],
[Defined if direct-threading is the best enabled dispatch.])
AH_TEMPLATE([JITTER_BEST_DISPATCH_IS_MINIMAL_THREADING],
[Defined if minimal-threading is the best enabled dispatch.])
AH_TEMPLATE([JITTER_BEST_DISPATCH_IS_NO_THREADING],
[Defined if no-threading is the best enabled dispatch.])
if test "x$jitter_best_dispatch" = "x"; then
AC_MSG_ERROR([no dispatch is enabled])
else
AC_MSG_NOTICE([enabled dispatches are:]
[ $jitter_enabled_dispatches])
AC_MSG_NOTICE([the best enabled dispatch is:]
[ $jitter_best_dispatch])
AC_SUBST([JITTER_BEST_DISPATCH], [$jitter_best_dispatch])
JITTER_BEST_DISPATCH_NAME_UPPER=$(echo $jitter_best_dispatch | jitter_to_upper)
AC_DEFINE_UNQUOTED([JITTER_BEST_DISPATCH_NAME_LOWER],
["$jitter_best_dispatch"],
[The name of the best dispatch, lower-case.])
AC_DEFINE_UNQUOTED([JITTER_BEST_DISPATCH_NAME_UPPER],
["$JITTER_BEST_DISPATCH_NAME_UPPER"],
[The name of the best dispatch, upper-case with
'-' replaced by '_'.])
AC_DEFINE_UNQUOTED([JITTER_BEST_DISPATCH_IS_$JITTER_BEST_DISPATCH_NAME_UPPER],
[1],
[Defined if $jitter_best_dispatch is the best
enabled dispatch.])
fi
# Automake conditional enabling assembly.
############################################################################
# Define an Automake conditional stating whether the assembly support, which may
# be present or not, is to be used. This is particularly important for
# combinations of supported architectures and unsupported binary formats.
AC_MSG_CHECKING([if we are actually using any assembly support])
if test "x$jitter_has_host_assembly" = "xyes" \
&& test "x$jitter_have_known_binary_format" = 'xyes' \
&& (test "x$jitter_enable_dispatch_minimal_threading" = 'xyes' \
|| test "x$jitter_enable_dispatch_no_threading" = 'xyes'); then
jitter_enable_assembly=yes
AC_DEFINE_UNQUOTED([JITTER_ENABLE_ASSEMBLY], [1],
[Define iff assembly support is to be actually used])
else
jitter_enable_assembly=no
fi
AM_CONDITIONAL([JITTER_ENABLE_ASSEMBLY],
[test "x$jitter_enable_assembly" = 'xyes'])
AC_MSG_RESULT([$jitter_enable_assembly])
# Defect and replacement debugging.
################################################################
AC_MSG_CHECKING([for defect replacement])
default=yes
AC_ARG_ENABLE([defect-replacement],
AS_HELP_STRING([--enable-defect-replacement@<:@=yes|all|no@:>@],
[enable defect-replacement: yes (default), to be
used in production, replaces defective instructions
plus every call-related instructions if any
call-relative instruction is defective; all (for
Jitter debugging) replaces every instruction which
has the potential of ever being compiled as
defective; no (for Jitter debugging, *DANGEROUS*)
performs no replacement at all and allows the user
to run subtly incorrect code. This option only has
effect with minimal-threading and no-threading
dispatches.]),
jitter_enable_defect_replacement="$enableval",
jitter_enable_defect_replacement="$default")
case "$jitter_enable_defect_replacement" in
yes)
comment='replace defective instructions and every call-related instruction where any call-related instruction is defective'
;;
all)
AC_DEFINE_UNQUOTED([JITTER_DEFECT_REPLACEMENT_ALL_POSSIBLE], [1],
[Replace every possibly defective instruction]) # No ";": see the Autoconf manual.
comment='replace every potentially defective instructions (for debugging Jitter)'
;;
no)
AC_DEFINE_UNQUOTED([JITTER_DEFECT_REPLACEMENT_NEVER], [1],
[Never perform any replacement (DANGEROUS!)]) # No ";": see the Autoconf manual.
comment='do not perform any defect replacement (DANGEROUS!)'
;;
*)
AC_MSG_ERROR([invalid argument "$jitter_enable_defect_replacement" for --enable-defect-replacement])
;;
esac
AC_MSG_RESULT([$comment])
if test "x$jitter_enable_defect_replacement" = 'xno'; then
AC_MSG_WARN([Disabled defect replacement. This is DANGEROUS and the
configuration should never be used in production, as it
may generate INCORRECT code])
fi
# Installation paths, relative to installation prefixes.
################################################################
# According to the GNU Coding Standards installation prefixes can be decided
# very late, at make time; therefore there are no AC_SUBST or AC_DEFINE calls
# fixing complete paths here. However we can establish once and for all some
# subdirectories, relative to prefixes we don't know yet.
AC_SUBST([JITTER_FLAG_SUBDIRECTORY],
[lib/$PACKAGE_TARNAME/$PACKAGE_VERSION/flags])
AC_SUBST([JITTER_TEMPLATE_SUBDIRECTORY],
[$PACKAGE_TARNAME/$PACKAGE_VERSION/templates])
# Flags.
################################################################
# Some flags such as -fno-reorder-blocks are useful with switch and
# direct-threading dispatches only to make disassembly of VM instructions
# possible, by reading the assembly code starting from a given point up to
# another given point; they actually make performance worse, so they are not
# enabled by default.
AC_MSG_CHECKING([if disassemble-friendly CFLAGS should be enabled])
AC_ARG_ENABLE([disassemble-friendly-cflags],
AS_HELP_STRING([--enable-disassemble-friendly-cflags],
[Compile VM code with some GCC options which make disassembly
possible, even if they make performance worse. This is only
relevant to switch and direct-threading dispatches.
(default: no)]),
jitter_enable_disassemble_friendly_cflags="$enableval",
jitter_enable_disassemble_friendly_cflags="no")
AC_MSG_RESULT([$jitter_enable_disassemble_friendly_cflags])
# Generate flag files in $builddir/flags/$dispatch , for every enabled
# dispatch . Cleanup at the beginning, cd back to $builddir at the end.
rm -rf flags
mkdir flags
for dispatch in $jitter_enabled_dispatches; do
DISPATCH="$(echo $dispatch | jitter_to_upper)"
# Generate flags for $dispatch
mkdir "flags/$dispatch"
AC_MSG_NOTICE([generating flags for dispatch "$dispatch"...])
JITTER_FLAGS_CFLAGS=""
# We always want these options. See the comment below about why
# -fno-reorder-functions is not desirable.
jitter_check_cc_options JITTER_FLAGS_CFLAGS -O2 -fomit-frame-pointer
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-reorder-functions
# In order to force "asm headers" and "asm footers" (see
# jitterc/jitterc-generate.c ) to be generated in the correct order with
# respect to the executor function, the generated code in vm2.c uses the
# no_reorder function attribute.
# But GCCs older then version 5 do not suport the attribute. In that case
# can fall back to a more brutal solution, preventing the reordering of
# any function:
if test "x$ac_cv_have_no_reorder" = 'xno'; then
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-toplevel-reorder
fi
# We want ELF visibility flags when enabled, independently from the dispatch.
if test "x$jitter_enable_visibility_hidden" = 'xyes'; then
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fvisibility=hidden
jitter_check_cc_options JITTER_FLAGS_LDFLAGS -fvisibility=hidden
fi
# Use disassemble-friendly flags for simple dispatches, if the user requested
# them.
case "$dispatch" in
switch|direct-threading)
if test "x$jitter_enable_disassemble_friendly_cflags" != 'xno'; then
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-reorder-blocks
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-reorder-blocks-and-partition
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-crossjumping
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-thread-jumps
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-tree-tail-merge
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-isolate-erroneous-paths-dereference
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-split-paths
fi;;
esac
# LTO, impressive as it is in general, is a bad match for Jitter, for
# correctness reasons on complex dispatches and for performance reasons with
# switch and direct-threading dispatches.
if test "x$jitter_host_os_is_netbsd" != 'xyes'; then
# NetBSD, at least version 9, has a problem with this option, as the
# compiler (a custom variant of GCC 7.4.0) accepts the option but then fails
# at link time. I noticed this with NetBSD version 9. I may want to
# conditionalize differently in the future if other versions actually
# supporting LTO come out.
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-lto
fi
# Experimental: disable debugging options which appear to be expensive at
# compile time.
jitter_check_cc_options JITTER_FLAGS_CFLAGS -g0
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-var-tracking
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-var-tracking-assignments
# I like register names to be visually distinct from numeric immediates --
# this is particularly important for data locations, which are text strings
# visible to the user containing assembly operands in the syntax generated by
# GCC. I know this option to exist on PowerPC, but it does no harm to try it
# on other architectures as well.
jitter_check_cc_options JITTER_FLAGS_CFLAGS -mregnames
# In C division and remainder by zero have undefined semantics; however GCC
# defaults to generate a conditional trap or break instruction on MIPS, which
# has a cost. Avoid it.
# Safe languages compiled to the VM will need to add their own check anyway,
# which will just add to the cost. This is not the place for being friendly
# to the human debugger at the cost of performance.
case "$host_cpu" in
mips*)
jitter_check_cc_options JITTER_FLAGS_CFLAGS -mno-check-zero-division
;;
esac
if test "x$jitter_host_os_is_elf" != "xyes" \
&& test "x$JITTER_GNU_ASSEMBLER" != "xno"; then
# Jitter's section-changing mechanism on non-ELF systems relies on changing
# subsections using Gas ".text SUBSECTION" directives, which don't play well
# with CFI directives. In this case we also need all the code to be
# generated in .text, and not in ".text.hot" or ".text.unlikely", as
# -freorder-functions does.
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-dwarf2-cfi-asm
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-reorder-functions
fi
# jitter_check_cc_options JITTER_FLAGS_CFLAGS -frename-registers
# jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-plt
case "$dispatch" in
minimal-threading)
# As or early 2021 when using GCC 10 with minimal-threading (at least on
# x86_64 and SPARC) -fno-tree-vrp seems to prevent tail merging, for
# reasons I do not fully understand. I could obtain the same effect in
# my test cases by using -O1 or -Os instead of -O2, but this solution
# should lead to better code. Notice that -fno-tree-vrp is enabled by
# default at -O2.
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-tree-vrp
;;
esac
# The GCC manual recommends -fno-gcse for code relying heavily on computed
# goto. Jittery VMs would qualify at least with direct-threading and
# minimal-threading dispatches (the situation with no-threading is less
# clear since the inline asm goto code systematically lies to the compiler
# about branch destinations but there are few reachable computed goto
# statements); however in my tests -fno-gcse appears to only have a little
# *negative* effect on performance.
# Disabling it for the time being.
# if test "$dispatch" != "switch"; then
# jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-gcse
# fi
case "$dispatch" in
minimal-threading|no-threading)
# The same options which were just disassemble-friendly with switch and
# direct-threading are important for correctness here.
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-reorder-blocks
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-reorder-blocks-and-partition
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-crossjumping
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-thread-jumps
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-tree-tail-merge
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-isolate-erroneous-paths-dereference
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-split-paths
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fPIC
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-align-loops
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-align-jumps
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-align-labels
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-jump-tables
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-tree-switch-conversion
jitter_check_cc_options JITTER_FLAGS_CFLAGS -flive-range-shrinkage
# jitter_check_cc_options JITTER_FLAGS_CFLAGS -fsched-pressure
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-ipa-icf
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-ipa-cp
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-ipa-cp-clone
;;
esac
case "$host_cpu" in
x86_64)
if test "$dispatch" = "minimal-threading" \
|| test "$dispatch" = "no-threading" ; then
jitter_check_cc_options JITTER_FLAGS_CFLAGS -mcmodel=large
fi
;;
*)
case "$dispatch" in
minimal-threading|no-threading)
# GCC generates calls to intrinsics/libc functions such as memcpy to
# pass parameters. At least on PowerPC GNU/Linux these resolve to
# calls via the GOT or PLT which then get optimized into PC-relative
# branch-and-link instructions, I suppose by ld.so . That is all very
# good in normal circumastances, but the last optimization breaks my
# relocatable code. Generate inline code for such calls instead, for
# the kind of smallish buffer lengths one might find in VM
# instructions.
jitter_check_cc_options JITTER_FLAGS_CFLAGS \
-mblock-move-inline-limit=8192
;;
esac
;;
esac
# I see some crashes with GCC 4, quite difficult to explain and debug and
# unrelated to my low-level code; in fact some C code (for example
# JitterLisp's library initialisation) crashes before doing anything with the
# VM. This problem is reliably worked around, for minimal-threading, by
# disabling sibling call optimisation. I suspect the problem comes in fact
# from some other option I am using for minimal-threading and no-threading.
# Since GCC 4 is now very old it is probably not worth to investigate too
# hard.
if test "x$JITTER_HAVE_ACTUAL_GCC" = 'xyes' \
&& test "$JITTER_GCC_MAJOR_VERSION" -le 4; then
case "$dispatch" in
minimal-threading|no-threading)
jitter_check_cc_options JITTER_FLAGS_CFLAGS -fno-optimize-sibling-calls
;;
esac
fi
JITTER_FLAGS_CPPFLAGS="-DJITTER_DISPATCH_$DISPATCH=1"
# In sub-package mode Jitter's C headers are not installed in any particular
# include path, so I need to let the compiler find them via -I options in the
# source directory and, for files generated by config.status , in the build
# directory as well.
# This holds for two kinds of headers:
# * headers following the pattern
# jitter/FILE.h
# , included in C as <jitter/FILE.h>;
# * (where assembly support exists) headers following the more complex pattern
# machine/${JITTER_ASSEMBLY_SUBDIRECTORY}/jitter/machine/FILE.h
# , included in C as <jitter/machine/FILE.h> .
# Makefile.am (see section "Native-code libjitter sources for supported
# architectures") uses this same trick to compile examples when Jitter may not
# be installed.
if test "x$JITTER_SUBPACKAGE_DIRECTORY" != 'x'; then
JITTER_FLAGS_CPPFLAGS="$JITTER_FLAGS_CPPFLAGS -I ${jitter_abs_top_srcdir}"
JITTER_FLAGS_CPPFLAGS="$JITTER_FLAGS_CPPFLAGS -I ${jitter_abs_top_builddir}"
if test "x$JITTER_ASSEMBLY_SUBDIRECTORY" != 'x'; then
JITTER_FLAGS_CPPFLAGS="$JITTER_FLAGS_CPPFLAGS -I ${jitter_abs_top_srcdir}/machine/${JITTER_ASSEMBLY_SUBDIRECTORY}"
fi
fi
JITTER_FLAGS_LDADD="-ljitter--$dispatch"
if test "x$JITTER_SUBPACKAGE_DIRECTORY" != 'x'; then
JITTER_FLAGS_LIBADD="${jitter_abs_top_builddir}/lib/libjitter--$dispatch.la"
else
# If the library is installed we can avoid specifying an explicit directory
# for the convenience library (it would be ${libdir}) and instead rely on
# JITTER_FLAGS_LDFLAGS containing the correct -L option. This prevents
# problems with non-installed libararies in non-sub-package mode.
JITTER_FLAGS_LIBADD="libjitter--$dispatch.la"
fi
# Search for Jitter runtime libraries in the right place.
if test "x$JITTER_SUBPACKAGE_DIRECTORY" != 'x'; then
# See the comment above for sub-package mode and include paths. This case
# is simpler.
JITTER_FLAGS_LDFLAGS="-L${jitter_abs_top_builddir}/lib"
else
JITTER_FLAGS_LDFLAGS="-L${libdir}"
fi
export JITTER_FLAGS_LDFLAGS
echo "$CC" > flags/$dispatch/CC
echo "$JITTER_FLAGS_CPPFLAGS" > flags/$dispatch/CPPFLAGS
echo "$JITTER_FLAGS_CFLAGS" > flags/$dispatch/CFLAGS
echo "$JITTER_FLAGS_LDADD" > flags/$dispatch/LDADD
echo "$JITTER_FLAGS_LDFLAGS" > flags/$dispatch/LDFLAGS
echo "$JITTER_FLAGS_LIBADD" > flags/$dispatch/LIBADD
# Also AC_SUBST flag variables for the best dispatch, if the best
# happens to be the one we're handling now.
if test "x$jitter_best_dispatch" = "x$dispatch"; then
AC_SUBST([JITTER_CFLAGS],
[$(cat flags/$dispatch/CFLAGS)])
AC_SUBST([JITTER_CPPFLAGS],
[$(cat flags/$dispatch/CPPFLAGS)])
AC_SUBST([JITTER_LDADD],
[$(cat flags/$dispatch/LDADD)])
AC_SUBST([JITTER_LDFLAGS],
[$(cat flags/$dispatch/LDFLAGS)])
AC_SUBST([JITTER_LIBADD],
[$(cat flags/$dispatch/LIBADD)])
# AC_SUBST([JITTER_MAKE_FLAGS],
# '$(MAKEFLAGS) CFLAGS="$(AM_CFLAGS) $(JITTER_CFLAGS)" CPPFLAGS="$(AM_CPPFLAGS) $(JITTER_CPPFLAGS)" LDFLAGS="$(AM_LDFLAGS) $(JITTER_LDFLAGS)" LDADD="$(JITTER_LDADD)"') # There is no AM_LDADD
fi
done
# AC_SUBST flag variables for every dispatch. FIXME: the first
# argument of AC_SUBST must be literal , therefore a shell loop doesn't work
# here, but it shouldn't be hard with m4 macros.
if test "x$jitter_enable_dispatch_switch" = "xyes"; then
AC_SUBST([JITTER_SWITCH_CFLAGS],
[$(cat flags/switch/CFLAGS)])
AC_SUBST([JITTER_SWITCH_CPPFLAGS],
[$(cat flags/switch/CPPFLAGS)])
AC_SUBST([JITTER_SWITCH_LDADD],
[$(cat flags/switch/LDADD)])
AC_SUBST([JITTER_SWITCH_LDFLAGS],
[$(cat flags/switch/LDFLAGS)])
AC_SUBST([JITTER_SWITCH_LIBADD],
[$(cat flags/switch/LIBADD)])
# AC_SUBST([JITTER_SWITCH_MAKE_FLAGS],
# '$(MAKEFLAGS) CFLAGS="$(AM_CFLAGS) $(JITTER_SWITCH_CFLAGS)" CPPFLAGS="$(AM_CPPFLAGS) $(JITTER_SWITCH_CPPFLAGS)" LDFLAGS="$(AM_LDFLAGS) $(JITTER_SWITCH_LDFLAGS)" LDADD="$(JITTER_SWITCH_LDADD)"') # There is no AM_LDADD
fi
if test "x$jitter_enable_dispatch_direct_threading" = "xyes"; then
AC_SUBST([JITTER_DIRECT_THREADING_CFLAGS],
[$(cat flags/direct-threading/CFLAGS)])
AC_SUBST([JITTER_DIRECT_THREADING_CPPFLAGS],
[$(cat flags/direct-threading/CPPFLAGS)])
AC_SUBST([JITTER_DIRECT_THREADING_LDADD],
[$(cat flags/direct-threading/LDADD)])
AC_SUBST([JITTER_DIRECT_THREADING_LDFLAGS],
[$(cat flags/direct-threading/LDFLAGS)])
AC_SUBST([JITTER_DIRECT_THREADING_LIBADD],
[$(cat flags/direct-threading/LIBADD)])
# AC_SUBST([JITTER_DIRECT_THREADING_MAKE_FLAGS],
# '$(MAKEFLAGS) CFLAGS="$(AM_CFLAGS) $(JITTER_DIRECT_THREADING_CFLAGS)" CPPFLAGS="$(AM_CPPFLAGS) $(JITTER_DIRECT_THREADING_CPPFLAGS)" LDFLAGS="$(AM_LDFLAGS) $(JITTER_DIRECT_THREADING_LDFLAGS)" LDADD="$(JITTER_DIRECT_THREADING_LDADD)"') # There is no AM_LDADD
fi
if test "x$jitter_enable_dispatch_minimal_threading" = "xyes"; then
AC_SUBST([JITTER_MINIMAL_THREADING_CFLAGS],
[$(cat flags/minimal-threading/CFLAGS)])
AC_SUBST([JITTER_MINIMAL_THREADING_CPPFLAGS],
[$(cat flags/minimal-threading/CPPFLAGS)])
AC_SUBST([JITTER_MINIMAL_THREADING_LDADD],
[$(cat flags/minimal-threading/LDADD)])
AC_SUBST([JITTER_MINIMAL_THREADING_LDFLAGS],
[$(cat flags/minimal-threading/LDFLAGS)])
AC_SUBST([JITTER_MINIMAL_THREADING_LIBADD],
[$(cat flags/minimal-threading/LIBADD)])
# AC_SUBST([JITTER_MINIMAL_THREADING_MAKE_FLAGS],
# '$(MAKEFLAGS) CFLAGS="$(AM_CFLAGS) $(JITTER_MINIMAL_THREADING_CFLAGS)" CPPFLAGS="$(AM_CPPFLAGS) $(JITTER_MINIMAL_THREADING_CPPFLAGS)" LDFLAGS="$(AM_LDFLAGS) $(JITTER_MINIMAL_THREADING_LDFLAGS)" LDADD="$(JITTER_MINIMAL_THREADING_LDADD)"') # There is no AM_LDADD
fi
if test "x$jitter_enable_dispatch_no_threading" = "xyes"; then
AC_SUBST([JITTER_NO_THREADING_CFLAGS],
[$(cat flags/no-threading/CFLAGS)])
AC_SUBST([JITTER_NO_THREADING_CPPFLAGS],
[$(cat flags/no-threading/CPPFLAGS)])
AC_SUBST([JITTER_NO_THREADING_LDADD],
[$(cat flags/no-threading/LDADD)])
AC_SUBST([JITTER_NO_THREADING_LDFLAGS],
[$(cat flags/no-threading/LDFLAGS)])
AC_SUBST([JITTER_NO_THREADING_LIBADD],
[$(cat flags/no-threading/LIBADD)])
# AC_SUBST([JITTER_NO_THREADING_MAKE_FLAGS],
# '$(MAKEFLAGS) CFLAGS="$(AM_CFLAGS) $(JITTER_NO_THREADING_CFLAGS)" CPPFLAGS="$(AM_CPPFLAGS) $(JITTER_NO_THREADING_CPPFLAGS)" LDFLAGS="$(AM_LDFLAGS) $(JITTER_NO_THREADING_LDFLAGS)" LDADD="$(JITTER_NO_THREADING_LDADD)"') # There is no AM_LDADD
fi
# AC_SUBST a set of LDFLAGS to be prepended to the ordinary ones, only useful
# for linking from an non-installed build directory.
# @JITTER_NON_INSTALLED_LDFLAGS@ must always come before other *_LDFLAGS
# variables, since the first -L option takes precedence.
AC_SUBST([JITTER_NON_INSTALLED_LDFLAGS],
[-L$jitter_abs_top_builddir/non-convenience-lib])
# Debugging support.
################################################################
# We generate readable assembly files for debugging; on some architectures I
# prefer an alternative non-default format, which I find more readable. These
# options are passed to the compiler only when generating textual assembly as
# a make target.
case "$host_cpu" in
powerpc*|ppc*)
# I like register names to be visually distinct from numeric immediates.
AC_SUBST([JITTER_MACHINE_SPECIFIC_READABLE_ASSEMBLY_FLAGS], [-mregnames]);;
esac
# FIXME: use AC_PATH_PROGS_FEATURE_CHECK to check for command line argument
# support in specific programs.
# Test suite.
################################################################
# Use the TAP interface to exchange data with tests. This requires a script,
# distributed with Automake.
AC_REQUIRE_AUX_FILE([tap-driver.sh])
# Select files generated by config.status.
################################################################
# Generate test suite scripts.
AC_CONFIG_FILES([tests/utility]) # This should not be made executable.
AC_CONFIG_FILES([tests/elementary/init-fini.test],
[chmod +x tests/elementary/init-fini.test])
AC_CONFIG_FILES([tests/uninspired/fundamental.test],
[chmod +x tests/uninspired/fundamental.test])
AC_CONFIG_FILES([tests/uninspired/programs.test],
[chmod +x tests/uninspired/programs.test])
AC_CONFIG_FILES([tests/structured/programs.test],
[chmod +x tests/structured/programs.test])
AC_CONFIG_FILES([tests/jitterlisp/jitterlisp.test],
[chmod +x tests/jitterlisp/jitterlisp.test])
# Generate convenience emulator script.
AC_CONFIG_FILES([scripts/emulator],
[chmod +x scripts/emulator])
# Generate the jitter-config script.
AC_CONFIG_FILES([bin/jitter-config],
[chmod +x bin/jitter-config])
# Generate the shell script generating high-level fast-branch macros.
AC_CONFIG_FILES([scripts/generate-fast-branches],
[chmod +x scripts/generate-fast-branches])
# Library wrappers/replacements, not part of libjitter.
################################################################
# Check for GNU libtextstyle, unless it is explicitly disabled by an option.
# Define a feature macro and an Automake conditional.
AC_ARG_WITH([libtextstyle],
AS_HELP_STRING([--with-libtextstyle],
[use GNU Libtextstyle if available and build
the separate libjitter-libtextstyle wrapper
library (default: detected)]),
jitter_check_libtextstyle="$withval",
jitter_check_libtextstyle="yes")
if test "x$jitter_check_libtextstyle" = 'xyes'; then
# Save the current value for LIBS before temporary changing it.
jitter_backup_LIBS="$LIBS"
# Check for possible dependencies of Libtextstyle. Do not use any library
# other than the ones I am mentioning here.
# FIXME: shall I use AC_LIB_LINKFLAGS or AC_LIB_HAVE_LINKFLAGS from Gnulib
# instead?
# https://www.gnu.org/software/gnulib/manual/html_node/Searching-for-Libraries.html
AC_MSG_NOTICE([checking for libraries GNU Libtextstyle may possibly depend on])
LIBS=''
AC_SEARCH_LIBS([sin], [m])
AC_SEARCH_LIBS([tputs], [termcap])
AC_SEARCH_LIBS([initscr], [ncurses])
AC_SEARCH_LIBS([initscr], [xcurses])
AC_SEARCH_LIBS([initscr], [curses])
AC_SEARCH_LIBS([iconv], [iconv])
# Remove unsightly duplicates from $LIBS , without changing the order of
# its elements.
LIBS=$(echo $(for x in $LIBS; do echo $x; done | uniq))' '
# Check for Libtextstyle itself using the dependencies. This may mention
# more library than are needed in the command line, but should be enough.
AC_SEARCH_LIBS([ostream_flush], [textstyle])
AC_CHECK_HEADERS([textstyle.h], [jitter_have_libtextstyle_header=yes])
AC_MSG_CHECKING([if GNU Libtextstyle is usable])
if test "x$ac_cv_search_ostream_flush" != 'xno' \
&& test "x$jitter_have_libtextstyle_header" = 'xyes'; then
jitter_have_libtextstyle=yes
AC_DEFINE_UNQUOTED([JITTER_HAVE_LIBTEXTSTYLE], [1],
[Define iff GNU Libtextstyle is usable and enabled])
AC_SUBST([JITTER_LIBTEXTSTYLE_CPPFLAGS],
[-DJITTER_WITH_LIBTEXTSTYLE=1])
AC_SUBST([JITTER_LIBTEXTSTYLE_LDADD],
["-ljitter-libtextstyle $LIBS"])
AC_SUBST([JITTER_LIBTEXTSTYLE_LIBADD],
["$jitter_abs_top_builddir/non-convenience-lib/libjitter-libtextstyle.la $LIBS"])
# Forget about the libraries found by the check for libtextstlye and its
# dependencies: they should not be linked by default.
LIBS="$jitter_backup_LIBS"
else
jitter_have_libtextstyle=no
fi
AC_MSG_RESULT([$jitter_have_libtextstyle])
else
AC_MSG_NOTICE([not checking for GNU Libtextstyle: disabled by configure option])
fi
AM_CONDITIONAL([JITTER_HAVE_LIBTEXTSTYLE],
[test "x$jitter_have_libtextstyle" = 'xyes'])
# Notice that JITTER_WITH_LIBTEXTSTYLE is not automatically defined. See
# the comment in jitter/jitter-config.h.in .
# Check for libraries: GNU Readline
################################################################
# Jitter comes with a separate library called libjitter-readline.la , which
# is always built but is not part of the Jitter runtime. The library may
# either actually use GNU Readline, and therefore depend on it, or implement
# a compatible but crude replacement which performs no line editing.
#
# Anyway, do not check for Readline and refuse to use it if we got
# --without-readline or --with-readline=no as a configure option.
AC_ARG_WITH([readline],
AS_HELP_STRING([--with-readline],
[actually use GNU Readline in the separate
library libjitter-readline, which is always
built (default: detected)]),
jitter_check_readline="$withval",
jitter_check_readline="yes")
if test "x$jitter_check_readline" = 'xyes'; then
# Save the current value for LIBS before temporary changing it.
jitter_backup_LIBS="$LIBS"
# Check for possible dependencies of Readline. Do not use any library
# other than the ones I am mentioning here.
# FIXME: shall I use AC_LIB_LINKFLAGS or AC_LIB_HAVE_LINKFLAGS from Gnulib
# instead?
# https://www.gnu.org/software/gnulib/manual/html_node/Searching-for-Libraries.html
AC_MSG_NOTICE([checking for libraries GNU Readline may possibly depend on])
LIBS=''
AC_SEARCH_LIBS([tputs], [termcap])
AC_SEARCH_LIBS([tinfo], [setupterm])
AC_SEARCH_LIBS([initscr], [ncurses])
AC_SEARCH_LIBS([initscr], [xcurses])
AC_SEARCH_LIBS([initscr], [curses])
# Remove unsightly duplicates from $LIBS , without changing the order of
# its elements.
LIBS=$(echo $(for x in $LIBS; do echo $x; done | uniq))' '
# Check for Readline itself using the dependencies. This may mention
# more library than are needed in the command line, but should be enough.
AC_SEARCH_LIBS([readline], [readline])
AC_CHECK_HEADERS([readline/readline.h], [jitter_have_readline_header=yes])
AC_MSG_CHECKING([if GNU readline is usable])
if test "x$ac_cv_search_readline" != 'xno' \
&& test "x$jitter_have_readline_header" = 'xyes'; then
jitter_have_readline=yes
AC_DEFINE_UNQUOTED([JITTER_HAVE_READLINE], [1],
[Define iff GNU Readline is usable and enabled])
AC_SUBST([JITTER_READLINE_LDADD],
["-ljitter-readline $LIBS"])
AC_SUBST([JITTER_READLINE_LIBADD],
["$jitter_abs_top_builddir/non-convenience-lib/libjitter-readline.la $LIBS"])
# Forget about the libraries found by the check for libtextstlye and its
# dependencies: they should not be linked by default.
LIBS="$jitter_backup_LIBS"
else
jitter_have_readline=no
fi
AC_MSG_RESULT([$jitter_have_readline])
else
AC_MSG_NOTICE([not checking for GNU Readline: disabled by configure option])
fi # if test "x$jitter_check_readline" = "xyes"
if test "x$jitter_have_readline" != "xyes"; then
# Define substitutions for using libjitter-readline without not linking the
# actual GNU Readline.
AC_SUBST([JITTER_READLINE_LDADD], ["-ljitter-readline"])
AC_SUBST([JITTER_READLINE_LIBADD],
["$jitter_abs_top_builddir/non-convenience-lib/libjitter-readline.la"])
fi
AM_CONDITIONAL([JITTER_HAVE_READLINE],
[test "x$jitter_have_readline" = 'xyes'])
# Optional dependencies, for examples only.
################################################################
# JitterLisp can optionally use Boehm's garbage collector. I use AC_CHECK_LIB
# with an explicit ACTION-IF-FOUND rather than AC_SEARCH_LIBS , because I don't
# want to modify the LIBS variable. This is specific to some examples.
AC_CHECK_LIB([gc], [GC_malloc], [JITTER_HAVE_BOEHM_GC_LIBRARY=yes])
AC_CHECK_HEADERS([gc/gc.h], [JITTER_HAVE_BOEHM_GC_HEADER=yes])
if test "x$JITTER_HAVE_BOEHM_GC_LIBRARY" = "xyes" \
&& test "x$JITTER_HAVE_BOEHM_GC_HEADER" = "xyes"; then
JITTER_HAVE_BOEHM_GC=yes
else
JITTER_HAVE_BOEHM_GC=no
fi
AC_MSG_CHECKING([if Boehm's GC is usable for JitterLisp])
AC_MSG_RESULT([$JITTER_HAVE_BOEHM_GC])
AM_CONDITIONAL([JITTER_HAVE_BOEHM_GC],
[test "x$JITTER_HAVE_BOEHM_GC" = "xyes"])
# Also set a substitution telling whether Boehm's GC is used, which is useful
# to check from the test suite.
if test "x$JITTER_HAVE_BOEHM_GC" = "xyes"; then
AC_SUBST([JITTER_HAVE_BOEHM_GC_SUBST], [1])
else
AC_SUBST([JITTER_HAVE_BOEHM_GC_SUBST], [])
true
fi
# ChangeLog generation.
################################################################
# Define an Automake conditional telling whether we're building from git.
# This is useful to decide whether to rebuild the ChangeLog file on dist.
# Notice that when a sub-package Jitter exists in a subdirectory of a
# super-package as a git submodule the $srcdir/.git object exists but is a
# *file* instead of a directory.
AM_CONDITIONAL([JITTER_BUILDING_FROM_GIT],
[test -d "$srcdir/.git" || test -f "$srcdir/.git"])
# Define non-colliding alternatives to Autoconf feature macros.
################################################################
# See the comment above in "Generated C headers": define CPP feature macros with
# the same name as the ones defined by predefined Autoconf tests, by Gnulib
# tests or by my own, with a JITTER_ prefix preventing collisions. These will
# end up in jitter/jitter-config.h , which is installed and included by user
# code.
# Define prefixed alternatives for some macros which are not meant to be used
# with #ifdef , but rather have a meaningful non-Boolean value.
# It is harmless to use this even for macros which are meant to be conditionally
# defined, as long as user code checks for the associated feature macro as well
# -- which it needs to anyway.
#
# Arguments:
# * shell variable;
# * unprefixed feature macro name.
m4_define([jitter_define_prefixed_macro],
[AC_DEFINE([JITTER_$2],
[@S|@$1],
[Same as $2 with a JITTER_ prefix suitable for an
installed header.])
AC_MSG_NOTICE([defining prefixed macro JITTER_$2 as @S|@$1])])
jitter_define_prefixed_macro([ac_cv_sizeof_void_p], [SIZEOF_VOID_P])
jitter_define_prefixed_macro([ac_cv_sizeof_short], [SIZEOF_SHORT])
jitter_define_prefixed_macro([ac_cv_sizeof_int], [SIZEOF_INT])
jitter_define_prefixed_macro([ac_cv_sizeof_long], [SIZEOF_LONG])
jitter_define_prefixed_macro([ac_cv_sizeof_long_long], [SIZEOF_LONG_LONG])
jitter_define_prefixed_macro([ac_cv_sizeof_float], [SIZEOF_FLOAT])
jitter_define_prefixed_macro([ac_cv_sizeof_double], [SIZEOF_DOUBLE])
jitter_define_prefixed_macro([ac_cv_sizeof_long_double], [SIZEOF_LONG_DOUBLE])
jitter_define_prefixed_macro([ac_cv_alignof_void_p], [ALIGNOF_VOID_P])
jitter_define_prefixed_macro([ac_cv_alignof_void_p_p], [ALIGNOF_VOID_P_P])
jitter_define_prefixed_macro([ac_cv_alignof_short], [ALIGNOF_SHORT])
jitter_define_prefixed_macro([ac_cv_alignof_int], [ALIGNOF_INT])
jitter_define_prefixed_macro([ac_cv_alignof_long], [ALIGNOF_LONG])
jitter_define_prefixed_macro([ac_cv_alignof_long_long], [ALIGNOF_LONG_LONG])
jitter_define_prefixed_macro([ac_cv_alignof_float], [ALIGNOF_FLOAT])
jitter_define_prefixed_macro([ac_cv_alignof_double], [ALIGNOF_DOUBLE])
jitter_define_prefixed_macro([ac_cv_alignof_long_double], [ALIGNOF_LONG_DOUBLE])
# Define prefixed alternatives for macros expanding to string literals in C,
# or actually for any shell variable meant to be used in this way.
#
# This is like jitter_define_prefixed_macro, but defines CPP macros to have
# the shell variable value *within double quotes* as their value.
# Arguments:
# * shell variable;
# * unprefixed feature macro name.
m4_define([jitter_define_prefixed_macro_string],
[AC_DEFINE([JITTER_$2],
["@S|@$1"],
[The value of the shell variable $1 as found by the
configure script, with a JITTER_ prefix suitable for
an installed header.])
AC_MSG_NOTICE([defining prefixed macro JITTER_$2 as "@S|@$1"])])
jitter_define_prefixed_macro_string([PACKAGE_NAME], [PACKAGE_NAME])
jitter_define_prefixed_macro_string([PACKAGE_VERSION], [PACKAGE_VERSION])
jitter_define_prefixed_macro_string([PACKAGE_BUGREPORT], [PACKAGE_BUGREPORT])
jitter_define_prefixed_macro_string([PACKAGE_URL], [PACKAGE_URL])
# Also define substitutions for the few macros also used in Makefile.am , or
# in generated scripts.
AC_SUBST([JITTER_PACKAGE_NAME], [$PACKAGE_NAME])
AC_SUBST([JITTER_PACKAGE_VERSION], [$PACKAGE_VERSION])
AC_SUBST([JITTER_PACKAGE_BUGREPORT], [$PACKAGE_BUGREPORT])
AC_SUBST([JITTER_PACKAGE_URL], [$PACKAGE_URL])
# Define prefixed versions of conditionally-defined feature macros.
# Arguments:
# * shell variable;
# * shell value for yes;
# * unprefixed feature macro name.
m4_define([jitter_define_prefixed_feature_macro],
[if test "x@S|@$1" = 'x$2'; then
AC_DEFINE([JITTER_$3],
[1],
[Same as $3 with a JITTER_ prefix suitable for an
installed header.])
AC_MSG_NOTICE([defining prefixed feature macro JITTER_$3])
else
AC_MSG_NOTICE([not defining prefixed feature macro JITTER_$3])
fi])
jitter_define_prefixed_feature_macro([ac_cv_c_typeof], [typeof],
[HAVE_TYPEOF])
jitter_define_prefixed_feature_macro([ac_cv_c_bigendian], [yes],
[WORDS_BIGENDIAN])
jitter_define_prefixed_feature_macro([ac_cv_type_long_long_int], [yes],
[HAVE_LONG_LONG_INT])
jitter_define_prefixed_feature_macro([ac_cv_type_unsigned_long_long_int], [yes],
[HAVE_UNSIGNED_LONG_LONG_INT])
jitter_define_prefixed_feature_macro([ac_cv_type_long_double], [yes],
[HAVE_LONG_DOUBLE])
jitter_define_prefixed_feature_macro([ac_cv_func_alarm], [yes], [HAVE_ALARM])
jitter_define_prefixed_feature_macro([ac_cv_func_aligned_alloc], [yes],
[HAVE_ALIGNED_ALLOC])
jitter_define_prefixed_feature_macro([ac_cv_func_posix_memalign], [yes],
[HAVE_POSIX_MEMALIGN])
jitter_define_prefixed_feature_macro([gl_have_mmap_anonymous], [yes],
[HAVE_MMAP_ANONYMOUS])
jitter_define_prefixed_feature_macro([ac_cv_func_mprotect], [yes],
[HAVE_MPROTECT])
jitter_define_prefixed_feature_macro([ac_cv_func_setrlimit], [yes],
[HAVE_SETRLIMIT])
jitter_define_prefixed_feature_macro([ac_cv_func_flockfile], [yes],
[HAVE_FLOCKFILE])
jitter_define_prefixed_feature_macro([ac_cv_func_popen], [yes],
[HAVE_POPEN])
jitter_define_prefixed_feature_macro([ac_cv_func_sigaction], [yes],
[HAVE_SIGACTION])
jitter_define_prefixed_feature_macro([ac_cv_func_sysconf], [yes],
[HAVE_SYSCONF])
jitter_define_prefixed_feature_macro([ac_cv_func_getpagesize], [yes],
[HAVE_GETPAGESIZE])
jitter_define_prefixed_feature_macro([ac_cv_func_clock_gettime], [yes],
[HAVE_CLOCK_GETTIME])
jitter_define_prefixed_feature_macro([ac_cv_func_setitimer], [yes],
[HAVE_SETITIMER])
jitter_define_prefixed_feature_macro([ac_cv_have_decl__SC_PAGESIZE], [yes],
[HAVE__SC_PAGESIZE])
jitter_define_prefixed_feature_macro([ac_cv_have_decl__SC_PHYS_PAGES], [yes],
[HAVE__SC_PHYS_PAGES])
jitter_define_prefixed_feature_macro([ac_cv_have_decl__SC_AVPHYS_PAGES], [yes],
[HAVE__SC_AVPHYS_PAGES])
jitter_define_prefixed_feature_macro([ac_cv_have_decl__SC_NPROCESSORS_CONF], [yes],
[HAVE__SC_NPROCESSORS_CONF])
jitter_define_prefixed_feature_macro([ac_cv_have_decl__SC_NPROCESSORS_ONLN], [yes],
[HAVE__SC_NPROCESSORS_ONLN])
jitter_define_prefixed_feature_macro([ac_cv_have_decl__SC_LEVEL1_ICACHE_SIZE], [yes],
[HAVE__SC_LEVEL1_ICACHE_SIZE])
jitter_define_prefixed_feature_macro([ac_cv_have_decl__SC_LEVEL1_DCACHE_SIZE], [yes],
[HAVE__SC_LEVEL1_DCACHE_SIZE])
jitter_define_prefixed_feature_macro([ac_cv_have_decl__SC_LEVEL2_CACHE_SIZE], [yes],
[HAVE__SC_LEVEL2_CACHE_SIZE])
jitter_define_prefixed_feature_macro([ac_cv_have_decl__SC_LEVEL3_CACHE_SIZE], [yes],
[HAVE__SC_LEVEL3_CACHE_SIZE])
jitter_define_prefixed_feature_macro([ac_cv_have_decl__SC_LEVEL4_CACHE_SIZE], [yes],
[HAVE__SC_LEVEL4_CACHE_SIZE])
# Output.
################################################################
AC_CONFIG_FILES([Makefile])
AC_CONFIG_FILES([gnulib-local/Makefile])
AC_OUTPUT
|