1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772
|
dnl acinclude.m4 -- extra macros for configuring Octave
dnl
dnl --------------------------------------------------------------------
dnl
dnl Copyright (C) 1995-2025 The Octave Project Developers
dnl
dnl See the file COPYRIGHT.md in the top-level directory of this
dnl distribution or <https://octave.org/copyright/>.
dnl
dnl This file is part of Octave.
dnl
dnl Octave is free software: you can redistribute it and/or modify it
dnl under the terms of the GNU General Public License as published by
dnl the Free Software Foundation, either version 3 of the License, or
dnl (at your option) any later version.
dnl
dnl Octave is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with Octave; see the file COPYING. If not, see
dnl <https://www.gnu.org/licenses/>.
dnl
dnl --------------------------------------------------------------------
dnl
dnl Alphabetical list of macros in the OCTAVE_ namespace
dnl
dnl
dnl Figure out the hardware-vendor-os info.
dnl
AC_DEFUN([OCTAVE_CANONICAL_HOST], [
AC_CANONICAL_HOST
if test -z "$host"; then
host=unknown-unknown-unknown
AC_MSG_WARN([configuring Octave for unknown system type])
fi
canonical_host_type=$host
AC_SUBST(canonical_host_type)
if test -z "$host_cpu"; then
host_cpu=unknown
fi
if test -z "$host_vendor"; then
host_vendor=unknown
fi
if test -z "$host_os"; then
host_os=unknown
fi
])
dnl
dnl Check if the Carbon Framework defines CGDisplayBitsPerPixel.
dnl
AC_DEFUN([OCTAVE_CARBON_CGDISPLAYBITSPERPIXEL], [
AC_CACHE_CHECK([whether CGDisplayBitsPerPixel is defined in the Carbon Framework],
[octave_cv_func_carbon_cgdisplaybitsperpixel],
[AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <Carbon/Carbon.h>
]], [[
CGDirectDisplayID display = CGMainDisplayID ();
size_t depth = CGDisplayBitsPerPixel (display);
]])],
octave_cv_func_carbon_cgdisplaybitsperpixel=yes,
octave_cv_func_carbon_cgdisplaybitsperpixel=no)
AC_LANG_POP(C++)
])
if test $octave_cv_func_carbon_cgdisplaybitsperpixel = yes; then
AC_DEFINE(HAVE_CARBON_CGDISPLAYBITSPERPIXEL, 1,
[Define to 1 if Carbon Framework has CGDisplayBitsPerPixel.])
fi
])
dnl
dnl Check if C compiler handles FLAG command line option. If two
dnl arguments are specified, execute the second arg as shell commands.
dnl Otherwise, add FLAG to CFLAGS if the compiler accepts the flag.
dnl
AC_DEFUN([OCTAVE_CC_FLAG], [
ac_safe=`echo "$1" | $SED 'y% ./+-:=%___p___%'`
AC_MSG_CHECKING([whether ${CC-cc} accepts $1])
AC_CACHE_VAL([octave_cv_cc_flag_$ac_safe],
[AC_LANG_PUSH(C)
ac_octave_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $1"
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
[eval "octave_cv_cc_flag_$ac_safe=yes"],
[eval "octave_cv_cc_flag_$ac_safe=no"])
CFLAGS="$ac_octave_save_CFLAGS"
AC_LANG_POP(C)
])
if eval "test \"`echo '$octave_cv_cc_flag_'$ac_safe`\" = yes"; then
AC_MSG_RESULT([yes])
ifelse([$2], ,
[CFLAGS="$CFLAGS $1"
AC_MSG_RESULT([adding $1 to CFLAGS])], [$2])
else
AC_MSG_RESULT([no])
ifelse([$3], , , [$3])
fi
])
dnl
dnl Check if pthread stack size accounts for thread-local storage.
dnl
dnl This program should succeed if the pthread library allocates memory
dnl for thread-local (__thread) variables independently of the
dnl requested thread stack size.
dnl
dnl It will fail if (as in the current version of glibc) the storage
dnl for thread-local variables is subtracted from the memory allocated
dnl for the thread stack. (This can cause problems for Java and for
dnl other libraries.)
dnl
dnl This bug is tracked in glibc at:
dnl https://sourceware.org/bugzilla/show_bug.cgi?id=11787
dnl
AC_DEFUN([OCTAVE_CHECK_BROKEN_PTHREAD_STACKSIZE], [
AC_CACHE_CHECK([whether pthread stack size does not account for thread-local storage],
[octave_cv_broken_pthread_stacksize],
[AC_LANG_PUSH(C)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <string.h>
#include <pthread.h>
static char __thread data[100 * 1024];
static void * threadfunc(void *arg)
{
return data;
}
]], [[
pthread_attr_t attr;
pthread_t thread;
int errnum;
pthread_attr_init (&attr);
errnum = pthread_attr_setstacksize (&attr, 64 * 1024);
if (errnum != 0)
{
fprintf (stderr, "pthread_attr_setstacksize: %s\n", strerror(errnum));
return 1;
}
errnum = pthread_create (&thread, &attr, &threadfunc, NULL);
if (errnum != 0)
{
fprintf (stderr, "pthread_create: %s\n", strerror(errnum));
return 1;
}
errnum = pthread_join (thread, NULL);
if (errnum != 0)
{
fprintf (stderr, "pthread_join: %s\n", strerror(errnum));
return 1;
}
pthread_attr_destroy (&attr);
return 0;
]])],
octave_cv_broken_pthread_stacksize=no,
octave_cv_broken_pthread_stacksize=yes,
octave_cv_broken_pthread_stacksize=no)
AC_LANG_POP(C)
])
if test $octave_cv_broken_pthread_stacksize = yes; then
AC_DEFINE(HAVE_BROKEN_PTHREAD_STACKSIZE, 1,
[Define to 1 if pthread stack size does not account for thread-local storage.])
fi
])
dnl
dnl Check for LLVM or Apple libc++ library.
dnl
AC_DEFUN([OCTAVE_LLVM_LIBCXX], [
AC_CACHE_CHECK([whether using STL from LLVM or Apple],
[octave_cv_llvm_libcxx],
[AC_LANG_PUSH(C++)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
// Include any header from the STL
#include <iostream>
]], [[
#if defined (_LIBCPP_VERSION)
return (0);
#else
return (1);
#endif
]])],
octave_cv_llvm_libcxx=yes,
octave_cv_llvm_libcxx=no,
octave_cv_llvm_libcxx=no)
AC_LANG_POP(C++)
])
if test $octave_cv_llvm_libcxx = yes; then
AC_DEFINE(HAVE_LLVM_LIBCXX, 1,
[Define to 1 if linking to LLVM or Apple libc++.])
fi
])
dnl
dnl Check whether std::pmr::polymorphic_allocator is available.
dnl
AC_DEFUN([OCTAVE_CHECK_STD_PMR_POLYMORPHIC_ALLOCATOR], [
AC_CACHE_CHECK([whether std::pmr::polymorphic_allocator is available],
[octave_cv_std_pmr_polymorphic_allocator],
[AC_LANG_PUSH(C++)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <cstdlib>
#include <memory_resource>
#include <vector>
class mx_memory_resource : public std::pmr::memory_resource
{
private:
void * do_allocate (std::size_t bytes, size_t /*alignment*/)
{
void *ptr = std::malloc (bytes);
if (! ptr)
throw std::bad_alloc ();
return ptr;
}
void do_deallocate (void* ptr, std::size_t /*bytes*/,
std::size_t /*alignment*/)
{
std::free (ptr);
}
bool do_is_equal (const std::pmr::memory_resource& other) const noexcept
{
return this == dynamic_cast<const mx_memory_resource *> (&other);
return true;
}
};
mx_memory_resource the_mx_memory_resource;
]], [[
std::pmr::vector<int> my_int_vec { &the_mx_memory_resource };
]])],
octave_cv_std_pmr_polymorphic_allocator=yes,
octave_cv_std_pmr_polymorphic_allocator=no,
[## On macOS, we need to run an executable to check if polymorphic
## allocators are working.
## When cross-compiling to that target, the following test might succeed
## even if polymorphic allocators are not actually implemented. In that
## case, users would need to manually configure with
## `--disable-std-pmr-polymorphic-allocator`.
## When cross-compiling to any other target, the following test should be
## giving accurate results.
## FIXME: Is there a way to not repeat the same code from above?
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <cstdlib>
#include <memory_resource>
#include <vector>
class mx_memory_resource : public std::pmr::memory_resource
{
private:
void * do_allocate (std::size_t bytes, size_t /*alignment*/)
{
void *ptr = std::malloc (bytes);
if (! ptr)
throw std::bad_alloc ();
return ptr;
}
void do_deallocate (void* ptr, std::size_t /*bytes*/,
std::size_t /*alignment*/)
{
std::free (ptr);
}
bool do_is_equal (const std::pmr::memory_resource& other) const noexcept
{
return this == dynamic_cast<const mx_memory_resource *> (&other);
return true;
}
};
mx_memory_resource the_mx_memory_resource;
]], [[
std::pmr::vector<int> my_int_vec { &the_mx_memory_resource };
]])],
octave_cv_std_pmr_polymorphic_allocator=yes,
octave_cv_std_pmr_polymorphic_allocator=no)])
AC_LANG_POP(C++)
])
if test $octave_cv_std_pmr_polymorphic_allocator = yes; then
AC_DEFINE(OCTAVE_HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR, 1,
[Define to 1 if std::pmr::polymorphic_allocator is available.])
HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR="yes"
else
HAVE_STD_PMR_POLYMORPHIC_ALLOCATOR="no"
fi
])
dnl
dnl Check whether CXSparse is version 2.2 or later
dnl FIXME: This test uses a version number. It potentially could
dnl be re-written to actually call a function, but is it worth it?
dnl
AC_DEFUN([OCTAVE_CHECK_CXSPARSE_VERSION_OK], [
AC_CACHE_CHECK([whether CXSparse is version 2.2 or later],
[octave_cv_cxsparse_version_ok],
[ac_octave_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CXSPARSE_CPPFLAGS $CPPFLAGS"
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
#if defined (HAVE_SUITESPARSE_CS_H)
#include <suitesparse/cs.h>
#elif defined (HAVE_CXSPARSE_CS_H)
#include <cxsparse/cs.h>
#elif defined (HAVE_CS_H)
#include <cs.h>
#endif
]], [[
#if (defined (HAVE_CXSPARSE) \
&& (! defined (CS_VER) \
|| CS_VER < 2 \
|| (CS_VER == 2 && CS_SUBVER < 2)))
#error "Octave requires CXSparse version 2.2 or later"
#endif
]])],
octave_cv_cxsparse_version_ok=yes,
octave_cv_cxsparse_version_ok=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
])
if test $octave_cv_cxsparse_version_ok = yes; then
AC_DEFINE(HAVE_CXSPARSE_VERSION_OK, 1,
[Define to 1 if CXSparse is version 2.2 or later.])
fi
])
dnl
dnl Check whether the FFTW library supports multi-threading. This macro
dnl should be called once per FFTW precision passing in the library
dnl variant (e.g. "fftw3") and a function in the thread support API
dnl (e.g. "fftw_plan_with_nthreads"). Depending on how FFTW was built,
dnl the thread functions could be compiled into the main FFTW library or
dnl could be a separate add-on library that is passed to the linker
dnl ahead of the main FFTW library.
dnl
AC_DEFUN([OCTAVE_CHECK_FFTW_THREADS], [
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_LDFLAGS="$LDFLAGS"
ac_octave_save_LIBS="$LIBS"
CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS"
LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS"
LIBS="$m4_toupper([$1])_LIBS $LIBS"
AC_CACHE_CHECK([for $1 multi-threading support],
[octave_cv_[$1]_threads_lib],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <fftw3.h>
]], [[
$2 (2);
]])],
[octave_cv_[$1]_threads_lib=yes],
[LIBS="-l[$1]_threads $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <fftw3.h>
]], [[
$2 (2);
]])],
[octave_cv_[$1]_threads_lib="-l[$1]_threads"],
[octave_cv_[$1]_threads_lib=no])
])
])
case $octave_cv_[$1]_threads_lib in
-l*)
m4_toupper([$1])_LIBS="$octave_cv_[$1]_threads_lib $m4_toupper([$1])_LIBS"
;;
no)
AC_MSG_WARN([No $1 multi-threading support found.])
AC_MSG_WARN([The single-threaded library will be used instead.])
;;
esac
if test $octave_cv_[$1]_threads_lib != no; then
AC_DEFINE([HAVE_]m4_toupper([$1])[_THREADS], 1,
[Define to 1 if ]m4_toupper([$1])[ has multi-threading support.])
fi
CPPFLAGS="$ac_octave_save_CPPFLAGS"
LDFLAGS="$ac_octave_save_LDFLAGS"
LIBS="$ac_octave_save_LIBS"
])
dnl
dnl OCTAVE_CHECK_FORTRAN_SYMBOL_AND_CALLING_CONVENTIONS
dnl
dnl Set variables related to Fortran symbol names (append underscore,
dnl use uppercase names, etc.) and calling convention (mostly used for
dnl determining how character strings are passed).
dnl
AC_DEFUN([OCTAVE_CHECK_FORTRAN_SYMBOL_AND_CALLING_CONVENTIONS], [
F77_TOLOWER=yes
F77_APPEND_UNDERSCORE=yes
F77_APPEND_EXTRA_UNDERSCORE=yes
case $ac_cv_f77_mangling in
"upper case") F77_TOLOWER=no ;;
esac
case $ac_cv_f77_mangling in
"no underscore") F77_APPEND_UNDERSCORE=no ;;
esac
case $ac_cv_f77_mangling in
"no extra underscore") F77_APPEND_EXTRA_UNDERSCORE=no ;;
esac
case $canonical_host_type in
i[[3456789]]86-*-*)
if test $ac_cv_f77_compiler_gnu = yes; then
OCTAVE_F77_FLAG([-mieee-fp])
fi
;;
alpha*-*-*)
if test $ac_cv_f77_compiler_gnu = yes; then
OCTAVE_F77_FLAG([-mieee])
else
OCTAVE_F77_FLAG([-ieee])
OCTAVE_F77_FLAG([-fpe1])
fi
;;
powerpc-apple-machten*)
FFLAGS=
;;
esac
if test $ac_cv_f77_compiler_gnu = yes; then
FORTRAN_CALLING_CONVENTION=gfortran
else
FORTRAN_CALLING_CONVENTION=unknown
fi
AC_ARG_ENABLE([fortran-calling-convention],
[AS_HELP_STRING([--enable-fortran-calling-convention=OPTION],
[Select C++ to Fortran calling convention. "gfortran" should be detected automatically. Other options are "cray", "visual-fortran", or "f2c".])],
[FORTRAN_CALLING_CONVENTION="$enableval"], [])
case $FORTRAN_CALLING_CONVENTION in
gfortran)
AC_DEFINE(F77_USES_GFORTRAN_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the gfortran calling convention.])
;;
cray)
AC_DEFINE(F77_USES_CRAY_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the Cray Fortran calling convention.])
;;
visual-fortran)
AC_DEFINE(F77_USES_VISUAL_FORTRAN_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the Visual Fortran calling convention.])
;;
f2c)
AC_DEFINE(F77_USES_F2C_CALLING_CONVENTION, 1, [Define to 1 if calling Fortran from C++ should use the f2c calling convention.])
;;
*)
AC_MSG_ERROR([to build Octave, the C++ to Fortran calling convention must be known.])
;;
esac
if test -n "$FFLAGS"; then
AC_MSG_NOTICE([defining FFLAGS to be $FFLAGS])
fi
AC_SUBST(F77_TOLOWER)
AC_SUBST(F77_APPEND_UNDERSCORE)
AC_SUBST(F77_APPEND_EXTRA_UNDERSCORE)
])
dnl
dnl Check if function gluTessCallback is called with "(...)".
dnl
AC_DEFUN([OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS], [
AC_CACHE_CHECK([whether gluTessCallback is called with "(...)"],
[octave_cv_func_glutesscallback_threedots],
[AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if defined (HAVE_GL_GLU_H)
# include <GL/glu.h>
#elif defined HAVE_OPENGL_GLU_H || defined HAVE_FRAMEWORK_OPENGL
# include <OpenGL/glu.h>
#endif
]], [[
GLvoid (*func)(...);
gluTessCallback(0, 0, func);
]])],
octave_cv_func_glutesscallback_threedots=yes,
octave_cv_func_glutesscallback_threedots=no)
AC_LANG_POP(C++)
])
if test $octave_cv_func_glutesscallback_threedots = yes; then
AC_DEFINE(HAVE_GLUTESSCALLBACK_THREEDOTS, 1,
[Define to 1 if gluTessCallback is called with (...).])
fi
])
dnl
dnl Check whether the Qt class QList has a constructor that accepts
dnl a pair of iterators. This constructor was introduced in Qt 5.14.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 5.13 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_FUNC_QFONTMETRICS_HORIZONTAL_ADVANCE], [
AC_CACHE_CHECK([for QFontMetrics::horizontalAdvance function],
[octave_cv_func_qfontmetrics_horizontal_advance],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QFont>
#include <QFontMetrics>
#include <QString>
]], [[
QFont font;
QFontMetrics fm (font);
fm.horizontalAdvance ('x');
fm.horizontalAdvance (QString ("string"));
]])],
octave_cv_func_qfontmetrics_horizontal_advance=yes,
octave_cv_func_qfontmetrics_horizontal_advance=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_func_qfontmetrics_horizontal_advance = yes; then
AC_DEFINE(HAVE_QFONTMETRICS_HORIZONTAL_ADVANCE, 1,
[Define to 1 if you have the `QFontMetrics::horizontalAdvance' function.])
fi
])
dnl
dnl Check whether the Qt class QHelpEngine has the documentsForIdentifier
dnl function. This member function was introduced in Qt 5.15.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 5.14 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_FUNC_QHELPENGINE_DOCUMENTSFORIDENTIFIER], [
AC_CACHE_CHECK([for QHelpEngine::documentsForIdentifier in <QHelpEngine>],
[octave_cv_func_qhelpengine_documentsforidentifier],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QHelpEngine>
#include <QHelpLink>
#include <QList>
#include <QString>
#include <QUrl>
]], [[
QString collection_file;
QHelpEngine eng (collection_file);
QString id;
eng.documentsForIdentifier (id);
]])],
octave_cv_func_qhelpengine_documentsforidentifier=yes,
octave_cv_func_qhelpengine_documentsforidentifier=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_func_qhelpengine_documentsforidentifier = yes; then
AC_DEFINE(HAVE_QHELPENGINE_DOCUMENTSFORIDENTIFIER, 1,
[Define to 1 if you have the `QHelpEngine::documentsForIdentifier' member function.])
fi
])
dnl
dnl Check whether the Qt QHelpSearchQueryWidget class has the searchInput
dnl member function. This function was introduced in Qt 5.9.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 5.8 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_FUNC_QHELPSEARCHQUERYWIDGET_SEARCHINPUT], [
AC_CACHE_CHECK([for QHelpSearchQueryWidget::searchInput],
[octave_cv_func_qhelpsearchquerywidget_searchinput],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QHelpSearchQueryWidget>
#include <QString>
]], [[
QHelpSearchQueryWidget *query_widget = new QHelpSearchQueryWidget ();
QString search_input = query_widget->searchInput ();
]])],
octave_cv_func_qhelpsearchquerywidget_searchinput=yes,
octave_cv_func_qhelpsearchquerywidget_searchinput=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_func_qhelpsearchquerywidget_searchinput = yes; then
AC_DEFINE(HAVE_QHELPSEARCHQUERYWIDGET_SEARCHINPUT, 1,
[Define to 1 if you have the `QHelpSearchQueryWidget::searchInput' member function.])
fi
])
dnl
dnl Check whether the Qt class QList has a constructor that accepts
dnl a pair of iterators. This constructor was introduced in Qt 5.14.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 5.13 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_FUNC_QLIST_ITERATOR_CONSTRUCTOR], [
AC_CACHE_CHECK([for QList<T>::QList (iterator, iterator) constructor],
[octave_cv_func_qlist_iterator_constructor],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QList>
]], [[
QList<int> lst_one;
QList<int> lst_two (lst_one.begin (), lst_one.end ());
]])],
octave_cv_func_qlist_iterator_constructor=yes,
octave_cv_func_qlist_iterator_constructor=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_func_qlist_iterator_constructor = yes; then
AC_DEFINE(HAVE_QLIST_ITERATOR_CONSTRUCTOR, 1,
[Define to 1 if you have the `QList<T>::QList (iterator, iterator)' constructor.])
fi
])
dnl
dnl Check whether the Qt class QWheelEvent has the position member function.
dnl This member function was introduced in Qt 5.14.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 5.13 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_FUNC_QWHEELEVENT_POSITION], [
AC_CACHE_CHECK([for QWheelEvent::position in <QWheelEvent>],
[octave_cv_func_qwheelevent_position],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QWheelEvent>
void foo (const QWheelEvent& ev)
{
ev.position ();
};
]])],
octave_cv_func_qwheelevent_position=yes,
octave_cv_func_qwheelevent_position=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_func_qwheelevent_position = yes; then
AC_DEFINE(HAVE_QWHEELEVENT_POSITION, 1,
[Define to 1 if you have the `QWheelEvent::position' member function.])
fi
])
dnl
dnl Check whether the Qt method QPainter::setRenderHint accepts the
dnl QPainter::LosslessImageRendering flag. This flag was introduced in
dnl Qt 5.13.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 5.12 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_FUNC_QPAINTER_SETRENDERHINT_LOSSLESS], [
AC_CACHE_CHECK([for QPainter::LosslessImageRendering flag],
[octave_cv_func_qpainter_setrenderhint_lossless],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QPainter>
]], [[
QPainter painter;
painter.setRenderHint (QPainter::LosslessImageRendering);
]])],
octave_cv_func_qpainter_setrenderhint_lossless=yes,
octave_cv_func_qpainter_setrenderhint_lossless=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_func_qpainter_setrenderhint_lossless = yes; then
AC_DEFINE(HAVE_QPAINTER_RENDERHINT_LOSSLESS, 1,
[Define to 1 if you have the `QPainter::LosslessImageRendering' flag.])
fi
])
dnl
dnl Check whether the Qt methods QColor::getRgbF and QColor::getHslF
dnl use float types as their arguments. The type of the arguments
dnl changed from qreal to float in Qt6.
dnl
dnl FIXME: Delete this check when we drop support for any version of Qt5.
dnl
AC_DEFUN([OCTAVE_CHECK_FUNC_QCOLOR_FLOAT_TYPE], [
AC_CACHE_CHECK([for QColor::getRgbF and QColor::getHslF with float arguments],
[octave_cv_func_qcolor_float_type],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QColor>
]], [[
QColor color;
float r, g, b, h, s, l, a;
color.getRgbF (&r, &g, &b);
color.getHslF (&h, &s, &l, &a);
]])],
octave_cv_func_qcolor_float_type=yes,
octave_cv_func_qcolor_float_type=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_func_qcolor_float_type = yes; then
AC_DEFINE(HAVE_QCOLOR_FLOAT_TYPE, 1,
[Define to 1 if QColor::getRgbF and QColor::getHslF use float type arguments.])
fi
])
dnl
dnl Check whether Qt provides a QStringView class. This class was first
dnl introduced in Qt 5.10 and finally replaced QStringRef in Qt6.
dnl
dnl FIXME: Delete this check when we drop support for Qt 5.9 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_CLASS_QSTRINGVIEW], [
AC_CACHE_CHECK([for class QStringView],
[octave_cv_class_qstringview],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QStringView>
]], [[
QStringView qstrv {};
]])],
octave_cv_class_qstringview=yes,
octave_cv_class_qstringview=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_class_qstringview = yes; then
AC_DEFINE(HAVE_QSTRINGVIEW, 1,
[Define to 1 if Qt provides the class QStringView.])
fi
])
dnl
dnl Check whether the Qt class QTextStream has the setEncoding function.
dnl This function was introduced replacing QTextStream::setCodec in Qt6.
dnl
dnl FIXME: Delete this check when we drop support for any version of Qt5.
dnl
AC_DEFUN([OCTAVE_CHECK_FUNC_QTEXTSTREAM_SETENCODING], [
AC_CACHE_CHECK([for QTextStream::setEncoding],
[octave_cv_func_qtextstream_setencoding],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QStringConverter>
#include <QTextStream>
]], [[
QTextStream textstream;
textstream.setEncoding (QStringConverter::Utf8);
]])],
octave_cv_func_qtextstream_setencoding=yes,
octave_cv_func_qtextstream_setencoding=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_func_qtextstream_setencoding = yes; then
AC_DEFINE(HAVE_QTEXTSTREAM_SETENCODING, 1,
[Define to 1 if you have the `QTextStream::setEncoding' member function.])
fi
])
dnl
dnl Check whether the Qt namespace contains a member Key_micro. This
dnl value was introduced in Qt 6.7.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 6.6 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_ENUM_QT_KEY_MICRO], [
AC_CACHE_CHECK([for Qt::Key_micro enum value],
[octave_cv_enum_qt_key_micro],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <Qt>
]], [[
Qt::Key key = Qt::Key_micro;
]])],
octave_cv_enum_qt_key_micro=yes,
octave_cv_enum_qt_key_micro=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_enum_qt_key_micro = yes; then
AC_DEFINE(HAVE_QT_KEY_MICRO, 1,
[Define to 1 if you have the `Qt::Key_micro' enum value.])
fi
])
dnl
dnl Check whether the Qt class QCheckBox has the checkStateChanged
dnl signal. This signal was introduced in Qt 6.7.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 6.6 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_SIGNAL_QCHECKBOX_CHECKSTATECHANGED], [
AC_CACHE_CHECK([for QCheckBox::checkStateChanged signal],
[octave_cv_signal_qcheckbox_checkstatechanged],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QCheckBox>
]], [[
QCheckBox checkbox;
QObject::connect (&checkbox, &QCheckBox::checkStateChanged,
[] (Qt::CheckState) {});
]])],
octave_cv_signal_qcheckbox_checkstatechanged=yes,
octave_cv_signal_qcheckbox_checkstatechanged=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_signal_qcheckbox_checkstatechanged = yes; then
AC_DEFINE(HAVE_QCHECKBOX_CHECKSTATECHANGED, 1,
[Define to 1 if you have the `QCheckBox::checkStateChanged' signal.])
fi
])
dnl
dnl Check whether the Qt class QColor has the fromString member function.
dnl This member function was introduced in Qt 6.4.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 6.3 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_FUNC_QCOLOR_FROMSTRING], [
AC_CACHE_CHECK([for QColor::fromString],
[octave_cv_func_qcolor_fromstring],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QColor>
]], [[
QColor color;
color.fromString ("green");
]])],
octave_cv_func_qcolor_fromstring=yes,
octave_cv_func_qcolor_fromstring=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_func_qcolor_fromstring = yes; then
AC_DEFINE(HAVE_QCOLOR_FROMSTRING, 1,
[Define to 1 if you have the `QColor::fromString' member function.])
fi
])
dnl
dnl Check whether HDF5 library has version 1.6 API functions.
dnl
AC_DEFUN([OCTAVE_CHECK_HDF5_HAS_VER_16_API], [
AC_CACHE_CHECK([whether HDF5 library has enforced version 1.6 API],
[octave_cv_hdf5_has_ver_16_api],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <hdf5.h>
]], [[
H5Eset_auto (0, 0);
]])],
octave_cv_hdf5_has_ver_16_api=yes,
octave_cv_hdf5_has_ver_16_api=no)
])
if test $octave_cv_hdf5_has_ver_16_api != yes; then
AC_DEFINE(HAVE_HDF5_18, 1, [Define to 1 if >=HDF5-1.8 is available.])
fi
])
dnl
dnl Check whether HDF5 library has UTF-8 file API.
dnl
AC_DEFUN([OCTAVE_CHECK_HDF5_HAS_UTF8_API], [
AC_CACHE_CHECK([whether HDF5 library has UTF-8 file API],
[octave_cv_hdf5_has_utf8_api],
[case $host_os in
msdosmsvc | mingw*)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stddef.h>
const wchar_t *H5_get_utf16_str(const char *s);
]], [[
H5_get_utf16_str ("");
]])],
octave_cv_hdf5_has_utf8_api=yes,
octave_cv_hdf5_has_utf8_api=no)
;;
*)
## Assume yes on all other platforms
octave_cv_hdf5_has_utf8_api=yes
;;
esac
])
if test $octave_cv_hdf5_has_utf8_api = yes; then
AC_DEFINE(HAVE_HDF5_UTF8, 1, [Define to 1 if HDF5 has UTF-8 file API.])
fi
])
dnl
dnl Usage:
dnl OCTAVE_CHECK_LIB(LIBRARY, DOC-NAME, WARN-MSG, HEADER, FUNC,
dnl LANG, DOC-STRING, EXTRA-CHECK, PKG-CONFIG-NAME,
dnl REQUIRED)
dnl
AC_DEFUN([OCTAVE_CHECK_LIB], [
AC_ARG_WITH([m4_tolower($1)-includedir],
[AS_HELP_STRING([--with-m4_tolower($1)-includedir=DIR],
[look for $2 include files in DIR])],
[m4_toupper([$1])_CPPFLAGS="-I$withval"])
AC_SUBST(m4_toupper([$1])_CPPFLAGS)
AC_ARG_WITH([m4_tolower($1)-libdir],
[AS_HELP_STRING([--with-m4_tolower($1)-libdir=DIR],
[look for $2 libraries in DIR])],
[m4_toupper([$1])_LDFLAGS="-L$withval"])
AC_SUBST(m4_toupper([$1])_LDFLAGS)
AC_ARG_WITH([m4_tolower($1)],
[ifelse([$#], 10,
[m4_ifblank([$7],
[AS_HELP_STRING([--with-m4_tolower($1)=<lib>], [use $2 library <lib>])],
[AS_HELP_STRING([--with-m4_tolower($1)], [$7])])],
[m4_ifblank([$7],
[AS_HELP_STRING([--without-m4_tolower($1)], [don't use $2 library])],
[AS_HELP_STRING([--without-m4_tolower($1)], [$7])])])],
with_$1=$withval, with_$1=yes)
ac_octave_$1_pkg_check=no
m4_toupper([$1])_LIBS=
warn_$1="$3"
case $with_$1 in
no)
ifelse([$#], 10,
[AC_MSG_ERROR([--without-m4_tolower($1) specified but $2 is required.])],
[warn_$1=""
m4_toupper([$1])_LIBS=])
;;
yes | "")
ac_octave_$1_pkg_check=yes
m4_toupper([$1])_LIBS="-l$1"
;;
-* | */* | *.a | *.so | *.so.* | *.o)
m4_toupper([$1])_LIBS="$with_$1"
;;
*)
m4_toupper([$1])_LIBS="-l$with_$1"
;;
esac
if test $ac_octave_$1_pkg_check = yes; then
PKG_CHECK_EXISTS(m4_default([$9], [$1]), [
if test -z "$m4_toupper([$1])_CPPFLAGS"; then
m4_toupper([$1])_CPPFLAGS="$($PKG_CONFIG --cflags-only-I m4_default([$9], [$1]) | $SED -e 's/^ *$//')"
fi
if test -z "$m4_toupper([$1])_LDFLAGS"; then
m4_toupper([$1])_LDFLAGS="$($PKG_CONFIG --libs-only-L m4_default([$9], [$1]) | $SED -e 's/^ *$//')"
fi
m4_toupper([$1])_LIBS="$($PKG_CONFIG --libs-only-l m4_default([$9], [$1]) | $SED -e 's/^ *$//')"
])
fi
if test -n "$m4_toupper([$1])_LIBS"; then
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_LDFLAGS="$LDFLAGS"
ac_octave_save_LIBS="$LIBS"
CPPFLAGS="$m4_toupper([$1])_CPPFLAGS $CPPFLAGS"
LDFLAGS="$m4_toupper([$1])_LDFLAGS $LDFLAGS"
LIBS="$m4_toupper([$1])_LIBS $LIBS"
m4_ifnblank([$6], [AC_LANG_PUSH($6)])
ac_octave_$1_check_for_lib=no
m4_ifblank([$4], [ac_octave_$1_check_for_lib=yes],
[AC_CHECK_HEADERS([$4], [ac_octave_$1_check_for_lib=yes; break])])
if test $ac_octave_$1_check_for_lib = yes; then
AC_CACHE_CHECK([for $5 in $m4_toupper([$1])_LIBS],
[octave_cv_lib_$1],
[AC_LINK_IFELSE([AC_LANG_CALL([], [$5])],
[octave_cv_lib_$1=yes], [octave_cv_lib_$1=no])
])
if test "$octave_cv_lib_$1" = yes; then
m4_ifblank([$8], [
warn_$1=
AC_DEFINE([HAVE_]m4_toupper([$1]), 1,
[Define to 1 if $2 is available.])], [$8])
else
m4_toupper([$1])_LIBS=
fi
else
octave_cv_lib_$1=no
m4_toupper([$1])_LIBS=
fi
m4_ifnblank([$6], [AC_LANG_POP($6)])
CPPFLAGS="$ac_octave_save_CPPFLAGS"
LDFLAGS="$ac_octave_save_LDFLAGS"
LIBS="$ac_octave_save_LIBS"
else
octave_cv_lib_$1=no
fi
ifelse([$#], 10, [
if test $octave_cv_lib_$1 = no; then
AC_MSG_ERROR([to build Octave, you must have the $2 library and header files installed])
fi])
AC_SUBST(m4_toupper([$1])_LIBS)
if test -n "$warn_$1"; then
OCTAVE_CONFIGURE_WARNING([warn_$1])
fi
])
dnl
dnl Check whether ARPACK works (does not crash).
dnl
dnl Using a pure Fortran program doesn't seem to crash when linked
dnl with the buggy ARPACK library, but the C++ program does. Maybe it
dnl is the memory allocation that exposes the bug and using statically
dnl allocated arrays in Fortran does not?
dnl
dnl FIXME: it would be nice to avoid the duplication of F77 macros
dnl and typedefs here and in the f77-fcn.h header file. Also, the
dnl definition of the character handling macros are not right for
dnl all systems (but should work on most modern systems in use today).
dnl
AC_DEFUN([OCTAVE_CHECK_LIB_ARPACK_OK_1], [
AC_CACHE_CHECK([whether the arpack library works],
[octave_cv_lib_arpack_ok_1],
[AC_LANG_PUSH(C++)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <cfloat>
#include <stdint.h>
typedef int F77_RET_T;
#define F77_CHAR_ARG2(x, l) x
#define F77_CONST_CHAR_ARG2(x, l) F77_CHAR_ARG2 (x, l)
#define F77_CHAR_ARG_LEN(l) , l
#define F77_CONST_CHAR_ARG_DECL const char *
#define F77_CHAR_ARG_LEN_DECL , long
#define F77_INT $OCTAVE_F77_INT_TYPE
#define F77_DBLE double
extern "C"
{
F77_RET_T
F77_FUNC (dnaupd, DNAUPD) (F77_INT&,
F77_CONST_CHAR_ARG_DECL,
const F77_INT&,
F77_CONST_CHAR_ARG_DECL,
F77_INT&, const F77_DBLE&,
F77_DBLE*, const F77_INT&, F77_DBLE*,
const F77_INT&, F77_INT*,
F77_INT*, F77_DBLE*, F77_DBLE*,
const F77_INT&, F77_INT&
F77_CHAR_ARG_LEN_DECL
F77_CHAR_ARG_LEN_DECL);
F77_RET_T
F77_FUNC (dneupd, DNEUPD) (const F77_INT&,
F77_CONST_CHAR_ARG_DECL,
F77_INT*, F77_DBLE*, F77_DBLE*,
F77_DBLE*, const F77_INT&, const F77_DBLE&,
const F77_DBLE&, F77_DBLE*,
F77_CONST_CHAR_ARG_DECL,
const F77_INT&,
F77_CONST_CHAR_ARG_DECL,
F77_INT&, const F77_DBLE&, F77_DBLE*,
const F77_INT&, F77_DBLE*,
const F77_INT&, F77_INT*,
F77_INT*, F77_DBLE*, F77_DBLE*,
const F77_INT&, F77_INT&
F77_CHAR_ARG_LEN_DECL
F77_CHAR_ARG_LEN_DECL
F77_CHAR_ARG_LEN_DECL);
F77_RET_T
F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG_DECL,
const F77_INT&, const F77_INT&,
const F77_DBLE&, const F77_DBLE*,
const F77_INT&, const F77_DBLE*,
const F77_INT&, const F77_DBLE&,
F77_DBLE*, const F77_INT&
F77_CHAR_ARG_LEN_DECL);
}
void
doit (void)
{
// Based on function EigsRealNonSymmetricMatrix from liboctave/eigs-base.cc.
// Problem matrix. See bug #31479.
F77_INT n = 4;
double *m = new double [n * n];
m[0] = 1, m[4] = 0, m[8] = 0, m[12] = -1;
m[1] = 0, m[5] = 1, m[9] = 0, m[13] = 0;
m[2] = 0, m[6] = 0, m[10] = 1, m[14] = 0;
m[3] = 0, m[7] = 0, m[11] = 2, m[15] = 1;
double *resid = new double [4];
resid[0] = 0.960966;
resid[1] = 0.741195;
resid[2] = 0.150143;
resid[3] = 0.868067;
F77_INT *ip = new F77_INT [11];
ip[0] = 1; // ishift
ip[1] = 0; // ip[1] not referenced
ip[2] = 300; // mxiter, maximum number of iterations
ip[3] = 1; // NB blocksize in recurrence
ip[4] = 0; // nconv, number of Ritz values that satisfy convergence
ip[5] = 0; // ip[5] not referenced
ip[6] = 1; // mode
ip[7] = 0; // ip[7] to ip[10] are return values
ip[8] = 0;
ip[9] = 0;
ip[10] = 0;
F77_INT *ipntr = new F77_INT [14];
F77_INT k = 1;
F77_INT p = 3;
F77_INT lwork = 3 * p * (p + 2);
double *v = new double [n * (p + 1)];
double *workl = new double [lwork + 1];
double *workd = new double [3 * n + 1];
F77_INT ido = 0;
F77_INT info = 0;
double tol = DBL_EPSILON;
do
{
F77_FUNC (dnaupd, DNAUPD) (ido, F77_CONST_CHAR_ARG2 ("I", 1),
n, F77_CONST_CHAR_ARG2 ("LM", 2),
k, tol, resid, p, v, n, ip, ipntr,
workd, workl, lwork, info
F77_CHAR_ARG_LEN (1)
F77_CHAR_ARG_LEN (2));
if (ido == -1 || ido == 1 || ido == 2)
{
double *x = workd + ipntr[0] - 1;
double *y = workd + ipntr[1] - 1;
F77_FUNC (dgemv, DGEMV) (F77_CONST_CHAR_ARG2 ("N", 1),
n, n, 1.0, m, n, x, 1, 0.0, y, 1
F77_CHAR_ARG_LEN (1));
}
else
{
if (info < 0)
return; // Error
break;
}
}
while (1);
F77_INT *sel = new F77_INT [p];
// In Octave, the dimensions of dr and di are k+1, but k+2 avoids segfault
double *dr = new double [k + 1];
double *di = new double [k + 1];
double *workev = new double [3 * p];
for (F77_INT i = 0; i < k + 1; i++)
dr[i] = di[i] = 0.0;
F77_INT rvec = 1;
double sigmar = 0.0;
double sigmai = 0.0;
// In Octave, this is n*(k+1), but n*(k+2) avoids segfault
double *z = new double [n * (k + 1)];
F77_FUNC (dneupd, DNEUPD) (rvec, F77_CONST_CHAR_ARG2 ("A", 1),
sel, dr, di, z, n, sigmar, sigmai, workev,
F77_CONST_CHAR_ARG2 ("I", 1), n,
F77_CONST_CHAR_ARG2 ("LM", 2), k, tol,
resid, p, v, n, ip, ipntr, workd,
workl, lwork, info
F77_CHAR_ARG_LEN (1)
F77_CHAR_ARG_LEN (1)
F77_CHAR_ARG_LEN (2));
}
]], [[
for (int i = 0; i < 10; i++)
doit ();
]])],
octave_cv_lib_arpack_ok_1=yes,
octave_cv_lib_arpack_ok_1=no,
octave_cv_lib_arpack_ok_1=yes)
AC_LANG_POP(C++)
])
if test $octave_cv_lib_arpack_ok_1 = yes; then
$1
:
else
$2
:
fi
])
dnl
dnl Check whether ARPACK is buggy (it doesn't crash, but gets wrong answers).
dnl
dnl ARPACK versions < 3.3.0 have a bug which results in different eigenvalues
dnl being calculated depending on whether eigenvectors are also requested.
dnl See bug #52425.
dnl
AC_DEFUN([OCTAVE_CHECK_LIB_ARPACK_OK_2], [
AC_CACHE_CHECK([whether the arpack library is free of bugs],
[octave_cv_lib_arpack_ok_2],
[save_FFLAGS="$FFLAGS"
FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
AC_LANG_PUSH(Fortran 77)
AC_RUN_IFELSE([[
program bug_52425
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
$ ldv=maxn )
c
Double precision
& v(ldv,maxncv), workl(maxncv*(maxncv+8)),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& ax(maxn)
logical select(maxncv)
integer iparam(11), ipntr(11)
c
character bmat*1, which*2
integer ido, n, nev, ncv, lworkl, info, ierr, j,
& nx, nconv, maxitr, mode, ishfts
logical rvec
Double precision
& tol, sigma
c
Double precision
& zero
parameter (zero = 0.0D+0)
c
Double precision
& dnrm2
external dnrm2, daxpy
c
intrinsic abs
c
n = 20
nev = 4
ncv = 20
bmat = 'I'
which = 'BE'
c
lworkl = ncv*(ncv+8)
tol = zero
info = 1
do j = 1,n
resid (j) = 1.0d0
end do
ido = 0
c
ishfts = 1
maxitr = 300
mode = 1
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
10 continue
c
call dsaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, info )
c
if (ido .eq. -1 .or. ido .eq. 1) then
call av (n, workd(ipntr(1)), workd(ipntr(2)))
go to 10
end if
c
if ( info .lt. 0 ) then
stop 1
else
rvec = .false.
c
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
if ( ierr .ne. 0) then
stop 1
else
nconv = iparam(5)
do 20 j=1, nconv
call av(n, v(1,j), ax)
call daxpy(n, -d(j,1), v(1,j), 1, ax, 1)
d(j,2) = dnrm2(n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
20 continue
c
c | Litmus test: return 1 or 0 based on returned eigenvalue
c
if (abs(d(1,1) - 2.0810) > 1.0d-4) then
stop 1
else
stop 0
end if
end if
end if
c
end
c
subroutine av (n, v, w)
integer n, j
Double precision v(n), w(n)
c
w(1) = 4*v(1) + v(3)
w(2) = 4*v(2) + v(4)
do 10 j = 3, n - 2
w(j) = v(j-2) + 4*v(j) + v(j+2)
10 continue
w(n-1) = v(n-3) + 4 * v(n-1)
w(n) = v(n-2) + 4 * v(n)
return
end
]],
octave_cv_lib_arpack_ok_2=yes,
octave_cv_lib_arpack_ok_2=no,
octave_cv_lib_arpack_ok_2=yes)
## Restore FFLAGS.
FFLAGS="$save_FFLAGS"
AC_LANG_POP(Fortran 77)
])
if test $octave_cv_lib_arpack_ok_2 = yes; then
$1
:
else
$2
:
fi
])
dnl
dnl Check whether GLPK provides the latest API functions required
dnl for the glpk function. The glp_iptcp structure was introduced
dnl in GLPK version 4.38.
dnl
AC_DEFUN([OCTAVE_CHECK_LIB_GLPK_OK], [
AC_CACHE_CHECK([whether the glpk library has glp_interior(glp_prob*, glp_iptcp*)],
[octave_cv_lib_glpk_ok],
[AC_LANG_PUSH(C++)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
extern "C"
{
#if defined (HAVE_GLPK_GLPK_H)
#include <glpk/glpk.h>
#else
#include <glpk.h>
#endif
}
]], [[
glp_prob *lp = glp_create_prob ();
glp_iptcp iptcp;
glp_init_iptcp (&iptcp);
int retval = glp_interior (lp, &iptcp);
]])],
octave_cv_lib_glpk_ok=yes,
octave_cv_lib_glpk_ok=no)
AC_LANG_POP(C++)
])
if test $octave_cv_lib_glpk_ok = yes; then
$1
:
else
$2
:
fi
])
dnl
dnl Check whether iconv provides the function iconvlist.
dnl
AC_DEFUN([OCTAVE_CHECK_ICONVLIST], [
AC_CACHE_CHECK([whether the function iconvlist is available],
[octave_cv_iconvlist],
[ac_octave_save_LIBS="$LIBS"
LIBS="$LIBICONV $LIBS"
AC_LANG_PUSH(C++)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_ICONV
extern "C"
{
# include <iconv.h>
}
#endif
]], [[
iconvlist (
[] (unsigned int, const char * const *, void *) -> int
{
return 0;
},
nullptr);
]])],
octave_cv_iconvlist=yes,
octave_cv_iconvlist=no)
AC_LANG_POP(C++)
LIBS="$ac_octave_save_LIBS"
])
if test $octave_cv_iconvlist = yes; then
AC_DEFINE(HAVE_ICONVLIST, 1, [Define to 1 if iconvlist is available.])
fi
])
dnl
dnl Check whether iconv provides the function iconv_canonicalize.
dnl
AC_DEFUN([OCTAVE_CHECK_ICONV_CANONICALIZE], [
AC_CACHE_CHECK([whether the function iconv_canonicalize is available],
[octave_cv_iconv_canonicalize],
[ac_octave_save_LIBS="$LIBS"
LIBS="$LIBICONV $LIBS"
AC_LANG_PUSH(C++)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_ICONV
extern "C"
{
# include <iconv.h>
}
#endif
]], [[
iconv_canonicalize ("UTF-8");
]])],
octave_cv_iconv_canonicalize=yes,
octave_cv_iconv_canonicalize=no)
AC_LANG_POP(C++)
LIBS="$ac_octave_save_LIBS"
])
if test $octave_cv_iconv_canonicalize = yes; then
AC_DEFINE(HAVE_ICONV_CANONICALIZE, 1,
[Define to 1 if iconv_canonicalize is available.])
fi
])
dnl
dnl Check whether using HDF5 DLL under Windows. This is done by
dnl testing for a data symbol in the HDF5 library, which would
dnl require the definition of _HDF5USEDL_ under MSVC compiler.
dnl
AC_DEFUN([OCTAVE_CHECK_LIB_HDF5_DLL], [
AC_CACHE_CHECK([if _HDF5USEDLL_ needs to be defined],
[octave_cv_lib_hdf5_dll],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <hdf5.h>
]], [[
hid_t x = H5T_NATIVE_DOUBLE;
return x
]])],
[octave_cv_lib_hdf5_dll=no],
[save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -DWIN32 -D_HDF5USEDLL_"
ac_octave_save_LIBS="$LIBS"
LIBS="$HDF5_LIBS $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <hdf5.h>
]], [[
hid_t x = H5T_NATIVE_DOUBLE;
return x
]])],
octave_cv_lib_hdf5_dll=yes,
octave_cv_lib_hdf5_dll=no)
CFLAGS="$save_CFLAGS"
LIBS="$ac_octave_save_LIBS"
])
])
if test $octave_cv_lib_hdf5_dll = yes; then
AC_DEFINE(_HDF5USEDLL_, 1, [Define to 1 if using HDF5 dll (Win32).])
fi
])
dnl
dnl Check for OpenGL. If found, define OPENGL_LIBS.
dnl
dnl FIXME: The following tests should probably check for the
dnl libraries separately.
dnl
dnl FIXME: Should we allow a way to specify a directory for OpenGL
dnl libraries and header files?
dnl
AC_DEFUN([OCTAVE_CHECK_LIB_OPENGL], [
OPENGL_LIBS=
## On MacOSX systems the OpenGL framework can be used
OCTAVE_HAVE_FRAMEWORK(OpenGL, [[
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
]], [[
GLint par; glGetIntegerv (GL_VIEWPORT, &par);
]],
have_framework_opengl=yes, have_framework_opengl=no)
if test $have_framework_opengl = yes; then
AC_DEFINE(HAVE_FRAMEWORK_OPENGL, 1,
[Define to 1 if framework OPENGL is available.])
OPENGL_LIBS="-framework OpenGL"
AC_MSG_NOTICE([adding -framework OpenGL to OPENGL_LIBS])
OCTAVE_CHECK_FUNC_GLUTESSCALLBACK_THREEDOTS
else
case $canonical_host_type in
*-*-mingw32* | *-*-msdosmsvc)
AC_CHECK_HEADERS([windows.h])
;;
esac
have_opengl_incs=no
AC_CHECK_HEADERS([GL/gl.h OpenGL/gl.h],
[AC_CHECK_HEADERS([GL/glu.h OpenGL/glu.h],
[have_opengl_incs=yes; break], [], [
#if defined (HAVE_WINDOWS_H)
#include <windows.h>
#endif
])
break
], [], [
#if defined (HAVE_WINDOWS_H)
# include <windows.h>
#endif
])
if test $have_opengl_incs = yes; then
AC_CHECK_HEADERS([GL/glext.h OpenGL/glext.h], [], [], [
#if defined (HAVE_WINDOWS_H)
# include <windows.h>
#endif
#if defined (HAVE_GL_GL_H)
# include <GL/gl.h>
#elif defined (HAVE_OPENGL_GL_H)
# include <OpenGL/gl.h>
#endif
])
case $canonical_host_type in
*-*-mingw32* | *-*-msdosmsvc)
ac_octave_save_LIBS="$LIBS"
LIBS="$LIBS -lopengl32"
AC_MSG_CHECKING([for glEnable in -lopengl32])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#if HAVE_WINDOWS_H
# include <windows.h>
#endif
#if defined (HAVE_GL_GL_H)
# include <GL/gl.h>
#elif defined (HAVE_OPENGL_GL_H)
# include <OpenGL/gl.h>
#endif
]], [[
glEnable(GL_SMOOTH);
]])], [OPENGL_LIBS="-lopengl32 -lglu32"])
LIBS="$ac_octave_save_LIBS"
if test -n "$OPENGL_LIBS"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
;;
*)
## Non-Mac, Non-Windows systems use this check
AC_CHECK_LIB([GL], [glEnable], [OPENGL_LIBS="-lGL -lGLU"])
;;
esac
fi
fi
AC_SUBST(OPENGL_LIBS)
if test -n "$OPENGL_LIBS"; then
AC_DEFINE(HAVE_OPENGL, 1, [Define to 1 if OpenGL is available.])
fi
])
dnl
dnl Check whether PCRE is compiled with --enable-utf.
dnl
AC_DEFUN([OCTAVE_CHECK_LIB_PCRE_OK], [
AC_CACHE_CHECK([whether PCRE library was compiled with UTF support],
[octave_cv_lib_pcre_ok],
[AC_LANG_PUSH(C++)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#if defined (HAVE_PCRE_H)
# include <pcre.h>
#elif defined (HAVE_PCRE_PCRE_H)
# include <pcre/pcre.h>
#endif
]], [[
const char *pattern = "test";
const char *err;
int erroffset;
pcre *data = pcre_compile (pattern, PCRE_UTF8, &err, &erroffset, nullptr);
return (! data);
]])],
octave_cv_lib_pcre_ok=yes,
octave_cv_lib_pcre_ok=no,
octave_cv_lib_pcre_ok=yes)
AC_LANG_POP(C++)
])
if test $octave_cv_lib_pcre_ok = yes; then
$1
:
else
$2
:
fi
])
dnl
dnl Check whether PCRE2 is compiled with --enable-utf.
dnl
AC_DEFUN([OCTAVE_CHECK_LIB_PCRE2_OK], [
AC_CACHE_CHECK([whether PCRE2 library was compiled with UTF support],
[octave_cv_lib_pcre2_ok],
[AC_LANG_PUSH(C++)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#define PCRE2_CODE_UNIT_WIDTH 8
#if defined (HAVE_PCRE2_H)
# include <pcre2.h>
#elif defined (HAVE_PCRE2_PCRE2_H)
# include <pcre2/pcre2.h>
#endif
]], [[
const char *pattern = "test";
int err;
PCRE2_SIZE erroffset;
pcre2_code *data = pcre2_compile ((PCRE2_SPTR) pattern, PCRE2_ZERO_TERMINATED, PCRE2_UTF, &err, &erroffset, nullptr);
return (! data);
]])],
octave_cv_lib_pcre2_ok=yes,
octave_cv_lib_pcre2_ok=no,
octave_cv_lib_pcre2_ok=yes)
AC_LANG_POP(C++)
])
if test $octave_cv_lib_pcre2_ok = yes; then
$1
:
else
$2
:
fi
])
dnl
dnl Check whether Qhull works (does not crash).
dnl
AC_DEFUN([OCTAVE_CHECK_LIB_QHULL_OK], [
AC_CACHE_CHECK([whether the qhull_r library works],
[octave_cv_lib_qhull_r_ok],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#if defined (HAVE_LIBQHULL_R_LIBQHULL_R_H)
# include <libqhull_r/libqhull_r.h>
# include <libqhull_r/qset_r.h>
# include <libqhull_r/geom_r.h>
# include <libqhull_r/poly_r.h>
# include <libqhull_r/io_r.h>
#elif defined (HAVE_LIBQHULL_R_H)
# include <libqhull_r.h>
# include <qset_r.h>
# include <geom_r.h>
# include <poly_r.h>
# include <io_r.h>
#endif
#if defined (NEED_QHULL_R_VERSION)
char *qh_version = "version";
#endif
]], [[
int dim = 2;
int n = 4;
coordT points[8] = { -0.5, -0.5, -0.5, 0.5, 0.5, -0.5, 0.5, 0.5 };
boolT ismalloc = 0;
qhT context = { };
qhT* qh = &context;
return qh_new_qhull (qh, dim, n, points, ismalloc, "qhull ", 0, stderr);
]])],
octave_cv_lib_qhull_r_ok=yes,
octave_cv_lib_qhull_r_ok=no,
octave_cv_lib_qhull_r_ok=yes)
])
if test $octave_cv_lib_qhull_r_ok = yes; then
$1
:
else
$2
:
fi
])
dnl
dnl Check whether sndfile library is modern enough to include things like Ogg
dnl
AC_DEFUN([OCTAVE_CHECK_LIB_SNDFILE_OK], [
AC_CACHE_CHECK([whether sndfile library is modern enough],
[octave_cv_lib_sndfile_ok],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sndfile.h>
]], [[
int x = SF_FORMAT_OGG;
]])],
octave_cv_lib_sndfile_ok=yes,
octave_cv_lib_sndfile_ok=no)
])
if test $octave_cv_lib_sndfile_ok = yes; then
$1
:
else
$2
:
fi
])
dnl
dnl Check for support of some specific formats in sndfile library
dnl
AC_DEFUN([OCTAVE_CHECK_LIB_SNDFILE_FORMATS], [
AC_CACHE_CHECK([whether sndfile library supports mp3],
[octave_cv_lib_sndfile_format_mp3],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sndfile.h>
]], [[
int x = SF_FORMAT_MPEG;
]])],
octave_cv_lib_sndfile_format_mp3=yes,
octave_cv_lib_sndfile_format_mp3=no)
])
if test $octave_cv_lib_sndfile_format_mp3 = yes; then
AC_DEFINE(HAVE_LIB_SNDFILE_FORMAT_MP3, 1,
[Define to 1 if libsndfile supports mp3.])
fi
])
dnl
dnl Check whether new API is used with QHelpIndexWidget.
dnl Under new API, QHelpIndexWidget emits documentActivates.
dnl Under old API, QHelpIndexWidget emits linkActivated.
dnl New structure/signal API was introduced in Qt 5.15.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 5.14 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_NEW_QHELPINDEXWIDGET_API], [
AC_CACHE_CHECK([for new QHelpIndexWidget API],
[octave_cv_new_qhelpindexwidget_api],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QHelpLink>
]], [[
QHelpLink link;
]])],
octave_cv_new_qhelpindexwidget_api=yes,
octave_cv_new_qhelpindexwidget_api=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_new_qhelpindexwidget_api = yes; then
AC_DEFINE(HAVE_NEW_QHELPINDEXWIDGET_API, 1,
[Define to 1 if using new QHelpIndexWidget API.])
fi
])
dnl
dnl Check for the Qhull version.
dnl
AC_DEFUN([OCTAVE_CHECK_QHULL_VERSION], [
AC_CACHE_CHECK([for qh_version in $QHULL_R_LIBS],
[octave_cv_lib_qhull_r_version],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#if defined (HAVE_LIBQHULL_R_LIBQHULL_R_H)
# include <libqhull_r/libqhull_r.h>
# include <libqhull_r/qset_r.h>
# include <libqhull_r/geom_r.h>
# include <libqhull_r/poly_r.h>
# include <libqhull_r/io_r.h>
#elif defined (HAVE_LIBQHULL_R_H)
# include <libqhull_r.h>
# include <qset_r.h>
# include <geom_r.h>
# include <poly_r.h>
# include <io_r.h>
#endif
]], [[
const char *tmp = qh_version;
]])],
octave_cv_lib_qhull_r_version=yes, octave_cv_lib_qhull_r_version=no)
])
if test $octave_cv_lib_qhull_r_version = no; then
AC_DEFINE(NEED_QHULL_R_VERSION, 1,
[Define to 1 if the Qhull library needs a qh_version variable defined.])
fi
])
dnl
dnl Check whether the Qt class QRegion has the iterators and related
dnl functions introduced in Qt 5.8.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 5.7 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_QREGION_ITERATORS], [
AC_CACHE_CHECK([for QRegion iterators and related functions],
[octave_cv_qregion_iterators],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QRegion>
]], [[
QRegion region;
QRegion::const_iterator it;
it = region.begin ();
it = region.end ();
it = region.cbegin ();
it = region.cend ();
QRegion::const_reverse_iterator rit;
rit = region.rbegin ();
rit = region.rend ();
rit = region.crbegin ();
rit = region.crend ();
]])],
octave_cv_qregion_iterators=yes,
octave_cv_qregion_iterators=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_qregion_iterators = yes; then
AC_DEFINE(HAVE_QREGION_ITERATORS, 1,
[Define to 1 if you have the `QFontMetrics::horizontalAdvance' function.])
fi
])
dnl
dnl Check whether we have QScintilla for the given Qt VERSION.
dnl
AC_DEFUN([OCTAVE_CHECK_QSCINTILLA], [
qt_version="$1";
use_qscintilla=no
warn_qscintilla=""
## Check for Qt libraries
case "$qt_version" in
5)
octave_qscintilla_libnames="qscintilla2-qt5 qscintilla2_qt5 qt5scintilla2"
;;
6)
octave_qscintilla_libnames="qscintilla2-qt6 qscintilla2_qt6 qt6scintilla2"
;;
*)
AC_MSG_ERROR([Unrecognized Qt version $qt_version])
;;
esac
if test $build_qt_gui = yes && test $check_qscintilla = yes; then
## Check for QScintilla library which is used in the Qt GUI editor.
AC_CACHE_CHECK([for the QScintilla library for Qt $qt_version],
[octave_cv_lib_qscintilla],
[save_CPPFLAGS="$CPPFLAGS"
save_CXXFLAGS="$CXXFLAGS"
save_LDFLAGS="$LDFLAGS"
ac_octave_save_LIBS="$LIBS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
LDFLAGS="$QT_LDFLAGS $LDFLAGS"
AC_LANG_PUSH(C++)
for octave_qscintilla_try in $octave_qscintilla_libnames; do
LIBS="$QT_LIBS -l$octave_qscintilla_try"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <Qsci/qsciapis.h>
#include <Qsci/qscilexercpp.h>
]], [[
QsciLexer *lexer = new QsciLexerCPP ();
QsciAPIs *lexer_apis = new QsciAPIs (lexer);
]])],
octave_cv_lib_qscintilla="-l$octave_qscintilla_try",
octave_cv_lib_qscintilla=no)
if test $octave_cv_lib_qscintilla != no; then
break
fi
done
CPPFLAGS="$save_CPPFLAGS"
CXXFLAGS="$save_CXXFLAGS"
LDFLAGS="$save_LDFLAGS"
LIBS="$ac_octave_save_LIBS"
AC_LANG_POP([C++])
])
if test $octave_cv_lib_qscintilla = no; then
warn_qscintilla="QScintilla library not found; disabling built-in Qt GUI editor"
else
## Let's assume QScintilla library is at the same location as
## other regular Qt libraries.
QT_LIBS="$QT_LIBS $octave_cv_lib_qscintilla"
OCTAVE_CHECK_QSCINTILLA_VERSION
AC_DEFINE(HAVE_QSCINTILLA, 1,
[Define to 1 if the QScintilla library and header files are available.])
save_CPPFLAGS="$CPPFLAGS"
save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS([Qsci/qscilexeroctave.h Qsci/qscilexermatlab.h])
AC_LANG_POP(C++)
CPPFLAGS="$save_CPPFLAGS"
CXXFLAGS="$save_CXXFLAGS"
use_qscintilla=yes
fi
fi
])
dnl
dnl Check whether QScintilla has version 2.6.0 or later
dnl FIXME: This test uses a version number. It potentially could
dnl be re-written to actually call the function, but is it worth it?
dnl
AC_DEFUN([OCTAVE_CHECK_QSCINTILLA_VERSION], [
AC_CACHE_CHECK([whether QScintilla has version 2.6.0 or later],
[octave_cv_version_2_6_0],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
#include <Qsci/qsciglobal.h>
]], [[
#if QSCINTILLA_VERSION < 0x020600
#error Old FindFirst function found.
#endif
]])],
octave_cv_version_2_6_0=yes,
octave_cv_version_2_6_0=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_version_2_6_0 = yes; then
AC_DEFINE(HAVE_QSCI_VERSION_2_6_0, 1,
[Define to 1 if QScintilla is of Version 2.6.0 or later.])
fi
])
dnl
dnl OCTAVE_CHECK_QT
dnl
AC_DEFUN([OCTAVE_CHECK_QT], [
octave_qt_versions="$1"
build_qt_gui=no
use_qscintilla=no
win32_terminal=no
for ver in $octave_qt_versions; do
OCTAVE_CHECK_QT_VERSION([$ver])
if test $build_qt_gui = yes; then
have_qt_version=$ver
break
elif test -n "$QT_MODULES_AVAILABLE"; then
## If some modules were found for $ver, then warn about possible
## incomplete or broken Qt installation instead of checking for
## next version in the list. Don't attempt a similar check for
## tools here because Qt5 and Qt6 tools may be installed with
## the same name so determining whether there is a mix of versions
## will require more work than just looking which tools are installed.
warn_qt_modules="Your installation of Qt version $ver appears incomplete or broken in some way. Fix that or use --with-qt=VER to use another version."
break
fi
done
if test $build_qt_gui = yes; then
BUILD_QT_SUMMARY_MSG="yes (version: $have_qt_version)"
if test x"$have_qt_version" = x5; then
AC_DEFINE(HAVE_QT5, 1, [Define to 1 if using Qt version 5.])
fi
if test x"$have_qt_version" = x6; then
AC_DEFINE(HAVE_QT6, 1, [Define to 1 if using Qt version 6.])
fi
else
if test -n "$QT_MODULES_MISSING" || test -n "$QT_TOOLS_MISSING"; then
qt_missing=`echo $QT_MODULES_MISSING$QT_TOOLS_MISSING | sed 's/ *$//'`
BUILD_QT_SUMMARY_MSG="no (missing:$qt_missing)"
else
BUILD_QT_SUMMARY_MSG="no"
fi
if test -n "$warn_qt_modules"; then
OCTAVE_CONFIGURE_WARNING([warn_qt_modules])
fi
if test -n "$warn_qt_cxx17"; then
OCTAVE_CONFIGURE_WARNING([warn_qt_cxx17])
fi
if test -n "$warn_qt_libraries"; then
OCTAVE_CONFIGURE_WARNING([warn_qt_libraries])
fi
if test -n "$warn_qt_version"; then
OCTAVE_CONFIGURE_WARNING([warn_qt_version])
fi
if test -n "$warn_qt_tools"; then
OCTAVE_CONFIGURE_WARNING([warn_qt_tools])
fi
if test -n "$warn_qt_setvbuf"; then
OCTAVE_CONFIGURE_WARNING([warn_qt_setvbuf])
fi
if test -n "$warn_qt_lib_fcns"; then
OCTAVE_CONFIGURE_WARNING([warn_qt_lib_fcns])
fi
if test -n "$warn_qt_abstract_item_model"; then
OCTAVE_CONFIGURE_WARNING([warn_qt_abstract_item_model])
fi
if test -n "$warn_qt_opengl"; then
OCTAVE_CONFIGURE_WARNING([warn_qt_opengl])
fi
if test -n "$warn_qscintilla"; then
OCTAVE_CONFIGURE_WARNING([warn_qscintilla])
fi
fi
AM_CONDITIONAL([AMCOND_BUILD_QT_GUI], [test $build_qt_gui = yes])
AM_CONDITIONAL([AMCOND_HAVE_QSCINTILLA], [test $use_qscintilla = yes])
AM_CONDITIONAL([WIN32_TERMINAL], [test $win32_terminal = yes])
])
dnl
dnl Check whether the Qt::ImCursorRectangle enum value exists.
dnl It replaces the Qt::ImMicroFocus enum value that was deprecated
dnl in Qt 5.14.
dnl
AC_DEFUN([OCTAVE_CHECK_QT_IMCURSORRECTANGLE_ENUM_VALUE], [
AC_CACHE_CHECK([for Qt::ImCursorRectangle enum value],
[octave_cv_qt_imcursorrectangle_enum_value],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <Qt>
]], [[
Qt::InputMethodQuery method_query = Qt::ImCursorRectangle;
]])],
octave_cv_qt_imcursorrectangle_enum_value=yes,
octave_cv_qt_imcursorrectangle_enum_value=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_qt_imcursorrectangle_enum_value = yes; then
AC_DEFINE(HAVE_QT_IMCURSORRECTANGLE_ENUM_VALUE, 1,
[Define to 1 if you have the `Qt::ImCursorRectangle' enum value.])
fi
])
dnl
dnl Check whether the Qt::SplitBehavior enum exists and has
dnl Qt::KeepEmptyParts and Qt::SkipEmptyParts members. This enum
dnl was introduced or modified in Qt 5.14.
dnl
dnl FIXME: Delete this entirely when we drop support for Qt 5.13 or older.
dnl
AC_DEFUN([OCTAVE_CHECK_QT_SPLITBEHAVIOR_ENUM], [
AC_CACHE_CHECK([for Qt::SplitBehavior enum],
[octave_cv_qt_splitbehavior_enum],
[AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
CXXFLAGS="$CXXPICFLAG $CXXFLAGS"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <Qt>
]], [[
Qt::SplitBehavior sb_keep = Qt::KeepEmptyParts;
Qt::SplitBehavior sb_skip = Qt::SkipEmptyParts;
]])],
octave_cv_qt_splitbehavior_enum=yes,
octave_cv_qt_splitbehavior_enum=no)
CPPFLAGS="$ac_octave_save_CPPFLAGS"
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if test $octave_cv_qt_splitbehavior_enum = yes; then
AC_DEFINE(HAVE_QT_SPLITBEHAVIOR_ENUM, 1,
[Define to 1 if you have the `Qt::SplitBehavior' enum.])
fi
])
dnl
dnl OCTAVE_CHECK_QT_TOOL(TOOL)
dnl
AC_DEFUN([OCTAVE_CHECK_QT_TOOL], [
AC_CHECK_TOOLS(m4_toupper([$1])_QTVER, [$1-qt$qt_version])
if test -z "$m4_toupper([$1])_QTVER"; then
AC_PATH_TOOL(m4_toupper([$1]), [$1], [],
[$QT_HOST_LIBEXECS$PATH_SEPARATOR$QT_HOST_BINS$PATH_SEPARATOR])
if test -z "$m4_toupper([$1])"; then
AC_CHECK_TOOLS(m4_toupper([$1]), [$1])
fi
if test -n "$m4_toupper([$1])"; then
if test -n "$QTCHOOSER"; then
m4_toupper([$1])FLAGS="-qt=$qt_version"
fi
QT_TOOLS_AVAILABLE="$QT_TOOLS_AVAILABLE $1"
else
QT_TOOLS_MISSING="$QT_TOOLS_MISSING $1"
fi
else
m4_toupper([$1])="$m4_toupper([$1])_QTVER"
QT_TOOLS_AVAILABLE="$QT_TOOLS_AVAILABLE $1"
fi
])
dnl
dnl Check whether Qt VERSION is present, supports QScintilla,
dnl and will work for Octave.
dnl
dnl OCTAVE_CHECK_QT_VERSION(VERSION)
dnl
AC_DEFUN([OCTAVE_CHECK_QT_VERSION], [AC_MSG_CHECKING([Qt version $1])
qt_version="$1";
build_qt_gui=yes
win32_terminal=no
warn_qt_libraries=""
warn_qt_version=""
warn_qt_tools=""
warn_qt_setvbuf=""
warn_qt_lib_fcns=""
warn_qt_abstract_item_model=""
warn_qt_opengl=""
if test $build_qt_gui = yes; then
## Check for Qt libraries
case "$qt_version" in
5)
QT_MODULES="Qt5Core Qt5Gui Qt5Help Qt5Network Qt5OpenGL Qt5PrintSupport Qt5Widgets Qt5Xml"
;;
6)
QT_MODULES="Qt6Core Qt6Gui Qt6Help Qt6Network Qt6OpenGL Qt6OpenGLWidgets Qt6PrintSupport Qt6Widgets Qt6Xml"
case $host_os in
mingw* | msdosmsvc*)
;;
*)
# FIXME: Remove Qt6Core5Compat when we no longer rely on classes that
# have been removed in Qt6:
# https://www.qt.io/blog/porting-from-qt-5-to-qt-6-using-qt5compat-library
# It is still needed for the terminal implementation in
# libgui/qterminal/libqterminal/unix
QT_MODULES="$QT_MODULES Qt6Core5Compat"
;;
esac
;;
*)
AC_MSG_ERROR([Unrecognized Qt version $qt_version])
;;
esac
fi
if test $build_qt_gui = yes \
&& test -n "$QT_CPPFLAGS" \
&& test -n "$QT_LIBS"; then
## Don't use pkg-config but assume the provided flags are correct
## and match the --with-qt value.
AC_MSG_WARN("Using provided values for QT_CPPFLAGS, QT_LIBS, and QT_LDFLAGS for Qt$qt_version")
else
if test $build_qt_gui = yes; then
## Use this check to get info in the log file.
PKG_CHECK_MODULES(QT, [$QT_MODULES],
[],
[build_qt_gui=no
warn_qt_libraries="Qt libraries not found; disabling Qt GUI"])
## Check the modules again individually to get lists of modules that
## are available and/or missing
QT_MODULES_AVAILABLE=
QT_MODULES_MISSING=
for qt_mod in $QT_MODULES; do
if $PKG_CONFIG --exists $qt_mod; then
QT_MODULES_AVAILABLE="$QT_MODULES_AVAILABLE $qt_mod"
else
QT_MODULES_MISSING="$QT_MODULES_MISSING $qt_mod"
fi
done
fi
if test $build_qt_gui = yes; then
## Retrieve Qt compilation and linker flags
QT_CPPFLAGS="$($PKG_CONFIG --cflags-only-I $QT_MODULES | $SED -e 's/^ *$//')"
QT_LDFLAGS="$($PKG_CONFIG --libs-only-L $QT_MODULES | $SED -e 's/^ *$//')"
QT_LIBS="$($PKG_CONFIG --libs-only-l $QT_MODULES | $SED -e 's/^ *$//')"
case $host_os in
*darwin*)
## Qt might be installed in framework
if test -z "$QT_LIBS"; then
QT_LDFLAGS="`$PKG_CONFIG --libs-only-other $QT_MODULES | tr ' ' '\n' | $GREP -e '-F' | uniq | tr '\n' ' '`"
QT_LIBS="`$PKG_CONFIG --libs-only-other $QT_MODULES | tr ' ' '\n' | $GREP -v -e '-F' | uniq | tr '\n' ' '`"
fi
;;
esac
fi
fi
QT_TOOLS_AVAILABLE=
QT_TOOLS_MISSING=
if test $build_qt_gui = yes; then
case "$qt_version" in
5)
AC_CHECK_TOOLS(QTCHOOSER, [qtchooser])
;;
6)
ac_octave_save_QT_HOST_LIBEXECS="$QT_HOST_LIBEXECS"
if test -z "$QT_HOST_LIBEXECS"; then
AC_CHECK_TOOLS(QTPATHS6, [qtpaths6 qtpaths-qt6])
if test -n "$QTPATHS6"; then
QT_HOST_LIBEXECS="`$QTPATHS6 --query QT_HOST_LIBEXECS`"
fi
fi
if test -z "$QT_HOST_LIBEXECS"; then
AC_CHECK_TOOLS(QMAKE6, [qmake6 qmake-qt6])
if test -n "$QMAKE6"; then
QT_HOST_LIBEXECS="`$QMAKE6 -query QT_HOST_LIBEXECS`"
fi
fi
if test -n "$QT_HOST_LIBEXECS"; then
case $host_os in
mingw*)
AC_CHECK_TOOL(CYGPATH, [cygpath])
if test -n "$CYGPATH"; then
QT_HOST_LIBEXECS="`$CYGPATH -u $QT_HOST_LIBEXECS`"
fi
;;
esac
fi
ac_octave_save_QT_HOST_BINS="$QT_HOST_BINS"
if test -z "$QT_HOST_BINS"; then
AC_CHECK_TOOLS(QTPATHS6, [qtpaths6 qtpaths-qt6])
if test -n "$QTPATHS6"; then
QT_HOST_BINS="`$QTPATHS6 --query QT_HOST_BINS`"
fi
fi
if test -z "$QT_HOST_BINS"; then
AC_CHECK_TOOLS(QMAKE6, [qmake6 qmake-qt6])
if test -n "$QMAKE6"; then
QT_HOST_BINS="`$QMAKE6 -query QT_HOST_BINS`"
fi
fi
if test -n "$QT_HOST_BINS"; then
case $host_os in
mingw*)
AC_CHECK_TOOL(CYGPATH, [cygpath])
if test -n "$CYGPATH"; then
QT_HOST_BINS="`$CYGPATH -u $QT_HOST_BINS`"
fi
;;
esac
fi
;;
esac
OCTAVE_CHECK_QT_TOOL([moc])
OCTAVE_CHECK_QT_TOOL([uic])
OCTAVE_CHECK_QT_TOOL([rcc])
OCTAVE_CHECK_QT_TOOL([lrelease])
OCTAVE_CHECK_QT_TOOL([qhelpgenerator])
case "$qt_version" in
5)
OCTAVE_CHECK_QT_TOOL([qcollectiongenerator])
;;
6)
QCOLLECTIONGENERATOR="$QHELPGENERATOR"
;;
esac
if test -n "$QT_TOOLS_MISSING"; then
warn_qt_tools="one or more of the Qt utilities moc, uic, rcc, lrelease, qcollectiongenerator, and qhelpgenerator not found; disabling Qt GUI"
build_qt_gui=no
MOC_QTVER=
UIC_QTVER=
RCC_QTVER=
LRELEASE_QTVER=
QCOLLECTIONGENERATOR_QTVER=
QHELPGENERATOR_QTVER=
MOCFLAGS=
UICFLAGS=
RCCFLAGS=
LRELEASEFLAGS=
QCOLLECTIONGENERATORFLAGS=
QHELPGENERATORFLAGS=
QT_HOST_LIBEXECS="$ac_octave_save_QT_HOST_LIBEXECS"
QT_HOST_BINS="$ac_octave_save_QT_HOST_BINS"
$as_unset ac_cv_prog_MOC_QTVER
$as_unset ac_cv_prog_ac_ct_MOC_QTVER
$as_unset ac_cv_prog_UIC_QTVER
$as_unset ac_cv_prog_ac_ct_UIC_QTVER
$as_unset ac_cv_prog_RCC_QTVER
$as_unset ac_cv_prog_ac_ct_RCC_QTVER
$as_unset ac_cv_prog_LRELEASE_QTVER
$as_unset ac_cv_prog_ac_ct_LRELEASE_QTVER
$as_unset ac_cv_prog_QCOLLECTIONGENERATOR_QTVER
$as_unset ac_cv_prog_ac_ct_QCOLLECTIONGENERATOR_QTVER
$as_unset ac_cv_prog_QHELPGENERATOR_QTVER
$as_unset ac_cv_prog_ac_ct_QHELPGENERATOR_QTVER
fi
fi
if test $build_qt_gui = yes; then
case $host_os in
mingw* | msdosmsvc*)
AC_CHECK_FUNCS([setvbuf], [win32_terminal=yes],
[build_qt_gui=no
warn_qt_setvbuf="setvbuf not found; disabling Qt GUI"])
;;
*)
AC_CHECK_HEADERS([pty.h libutil.h util.h])
AC_SEARCH_LIBS([openpty], [util],
[AC_DEFINE(HAVE_OPENPTY, 1, [Define to 1 if openpty exists])])
AC_CHECK_FUNCS([chmod chown ftruncate mmap munmap], [],
[build_qt_gui=no
warn_qt_lib_fcns="At least one of chmod, chown, ftruncate, mmap, and munmap not found; disabling Qt GUI"])
;;
esac
fi
if test $build_qt_gui = yes; then
## We have what we need to build the Qt GUI. The remaining
## checks below are for optional features related to the Qt GUI.
AC_DEFINE(HAVE_QT, 1,
[Define to 1 if Qt is available, with all required functions, libraries, developer header files, and utilities.])
AC_LANG_PUSH(C++)
ac_octave_save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$QT_CPPFLAGS $CXXPICFLAG $CPPFLAGS"
AC_CHECK_HEADERS([QStandardPaths])
CPPFLAGS="$ac_octave_save_CPPFLAGS"
AC_LANG_POP(C++)
## We don't need to unset cache variables for any of the remaining
## tests if they fail because we have already decided that the Qt
## version that we are testing now will be the one used.
OCTAVE_CHECK_FUNC_QFONTMETRICS_HORIZONTAL_ADVANCE
OCTAVE_CHECK_FUNC_QHELPSEARCHQUERYWIDGET_SEARCHINPUT
OCTAVE_CHECK_NEW_QHELPINDEXWIDGET_API
OCTAVE_CHECK_FUNC_QLIST_ITERATOR_CONSTRUCTOR
OCTAVE_CHECK_FUNC_QHELPENGINE_DOCUMENTSFORIDENTIFIER
OCTAVE_CHECK_FUNC_QWHEELEVENT_POSITION
OCTAVE_CHECK_FUNC_QPAINTER_SETRENDERHINT_LOSSLESS
OCTAVE_CHECK_FUNC_QCOLOR_FLOAT_TYPE
OCTAVE_CHECK_CLASS_QSTRINGVIEW
OCTAVE_CHECK_FUNC_QTEXTSTREAM_SETENCODING
OCTAVE_CHECK_ENUM_QT_KEY_MICRO
OCTAVE_CHECK_SIGNAL_QCHECKBOX_CHECKSTATECHANGED
OCTAVE_CHECK_FUNC_QCOLOR_FROMSTRING
OCTAVE_CHECK_QREGION_ITERATORS
OCTAVE_CHECK_QT_IMCURSORRECTANGLE_ENUM_VALUE
OCTAVE_CHECK_QT_SPLITBEHAVIOR_ENUM
OCTAVE_CHECK_QSCINTILLA([$qt_version])
fi
if test $build_qt_gui = no; then
QT_CPPFLAGS=
QT_LDFLAGS=
QT_LIBS=
fi
AC_SUBST(MOCFLAGS)
AC_SUBST(UICFLAGS)
AC_SUBST(RCCFLAGS)
AC_SUBST(LRELEASEFLAGS)
AC_SUBST(QCOLLECTIONGENERATORFLAGS)
AC_SUBST(QHELPGENERATORFLAGS)
AC_SUBST(QT_CPPFLAGS)
AC_SUBST(QT_LDFLAGS)
AC_SUBST(QT_LIBS)
])
dnl
dnl Check if the default Fortran INTEGER is 64 bits wide.
dnl If cross-compiling, assume 4 bytes unless the cache value
dnl is already set.
dnl
AC_DEFUN([OCTAVE_CHECK_SIZEOF_FORTRAN_INTEGER], [
AC_CACHE_CHECK([default size of Fortran INTEGER],
[octave_cv_sizeof_fortran_integer],
[ac_octave_save_FFLAGS="$FFLAGS"
FFLAGS="$FFLAGS $F77_INTEGER_8_FLAG"
AC_LANG_PUSH(Fortran 77)
AC_RUN_IFELSE([AC_LANG_PROGRAM(,[[
integer*8 n8
integer n
c Generate -2**33 + 1.
n8 = 2
n8 = -4 * (n8 ** 30)
n8 = n8 + 1
c Convert to default integer type. If the values are no longer equal,
c assume the default integer size is 32-bits.
n = n8
if (n .ne. n8) stop 1
]])],
octave_cv_sizeof_fortran_integer=8,
octave_cv_sizeof_fortran_integer=4,
octave_cv_sizeof_fortran_integer=4)
AC_LANG_POP(Fortran 77)
FFLAGS="$ac_octave_save_FFLAGS"
])
])
dnl
dnl Check for library that exports SUNContext_Create.
dnl
AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SUNCONTEXT_CREATE], [
ac_octave_save_LIBS=$LIBS
LIBS="$SUNDIALS_IDA_LIBS $SUNDIALS_NVECSERIAL_LIBS $LIBS"
dnl Check for SUNContext_Create without linking to libsundials_core.
dnl That should succeed for SUNDIALS version 6.
AC_CHECK_FUNC([SUNContext_Create])
LIBS="$ac_octave_save_LIBS"
if test "x$ac_cv_func_SUNContext_Create" != xyes; then
## SUNDIALS version 7 exports SUNContext_Create from libsundials_core
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_LDFLAGS="$LDFLAGS"
ac_octave_save_LIBS="$LIBS"
LIBS="$SUNDIALS_CORE_LIBS $LIBS"
LDFLAGS="$SUNDIALS_CORE_LDFLAGS $LDFLAGS"
CPPFLAGS="$SUNDIALS_CORE_CPPFLAGS $CPPFLAGS"
## Unset cache variable from previous check
unset ac_cv_func_SUNContext_Create
OCTAVE_CHECK_LIB(sundials_core, [SUNDIALS core], [],
[sundials_core.h sundials/sundials_core.h], [SUNContext_Create],
[], [])
CPPFLAGS="$ac_octave_save_CPPFLAGS"
LDFLAGS="$ac_octave_save_LDFLAGS"
LIBS="$ac_octave_save_LIBS"
fi
if test "x$ac_cv_func_SUNContext_Create" = xyes \
|| test "x$octave_cv_lib_sundials_core" = xyes; then
## SUNDIALS prior to version 6 does not need SUNContext_Create
AC_DEFINE(HAVE_SUNDIALS_SUNCONTEXT, 1,
[Define to 1 if SUNDIALS API uses a SUNContext object.])
fi
])
dnl
dnl Check whether SUNDIALS libraries provide a compatible interface.
dnl The current recommended interface was introduced in SUNDIALS version 4.
dnl The deprecated interface that Octave currently works to be compatible with
dnl was introduced in SUNDIALS version 3.
dnl
AC_DEFUN([OCTAVE_CHECK_SUNDIALS_COMPATIBLE_API], [
ac_octave_save_LIBS=$LIBS
LIBS="$SUNDIALS_IDA_LIBS $SUNDIALS_NVECSERIAL_LIBS $LIBS"
dnl Current API functions present in SUNDIALS version 4
AC_CHECK_FUNCS([IDASetJacFn IDASetLinearSolver SUNLinSol_Dense SUNSparseMatrix_Reallocate])
dnl FIXME: The purpose of the following tests is to detect the deprecated
dnl API from SUNDIALS version 3, which should only be used if the current
dnl API tests above failed. For now, always test for ida_direct.h.
AC_CHECK_HEADERS([ida/ida_direct.h ida_direct.h])
dnl Each of these is a deprecated analog to the functions listed above.
AC_CHECK_FUNCS([IDADlsSetJacFn IDADlsSetLinearSolver SUNDenseLinearSolver])
LIBS=$ac_octave_save_LIBS
AC_MSG_CHECKING([whether SUNDIALS API provides the necessary functions])
if test "x$ac_cv_func_IDASetJacFn" = xyes \
&& test "x$ac_cv_func_IDASetLinearSolver" = xyes \
&& test "x$ac_cv_func_SUNLinSol_Dense" = xyes; then
octave_have_sundials_compatible_api=yes
elif test "x$ac_cv_func_IDADlsSetJacFn" = xyes \
&& test "x$ac_cv_func_IDADlsSetLinearSolver" = xyes \
&& test "x$ac_cv_func_SUNDenseLinearSolver" = xyes; then
octave_have_sundials_compatible_api=yes
else
octave_have_sundials_compatible_api=no
fi
AC_MSG_RESULT([$octave_have_sundials_compatible_api])
if test $octave_have_sundials_compatible_api = no; then
warn_sundials_disabled="SUNDIALS libraries do not provide an API that is compatible with Octave. The solvers ode15i and ode15s will be disabled."
OCTAVE_CONFIGURE_WARNING([warn_sundials_disabled])
fi
])
dnl
dnl Check whether SUNDIALS IDA uses sunrealtype.
dnl
AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SUNREALTYPE], [
AC_CACHE_CHECK([whether SUNDIALS IDA uses sunrealtype],
[octave_cv_sundials_has_sunrealtype],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if defined (HAVE_IDA_IDA_H)
# include <ida/ida.h>
#endif
]], [[
sunrealtype test;
]])],
octave_cv_sundials_has_sunrealtype=yes,
octave_cv_sundials_has_sunrealtype=no)
])
if test $octave_cv_sundials_has_sunrealtype = no; then
OCTAVE_SUNREALTYPE=realtype
else
OCTAVE_SUNREALTYPE=sunrealtype
fi
AC_SUBST(OCTAVE_SUNREALTYPE)
AC_DEFINE_UNQUOTED(OCTAVE_SUNREALTYPE, [$OCTAVE_SUNREALTYPE],
[Define to the type used for real numbers by SUNDIALS.])
])
dnl
dnl Check whether SUNDIALS IDA library is configured with double
dnl precision realtype.
dnl
AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SIZEOF_REALTYPE], [
AC_CACHE_CHECK([whether SUNDIALS IDA is configured with double precision realtype],
[octave_cv_sundials_realtype_is_double],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if defined (HAVE_IDA_IDA_H)
# include <ida/ida.h>
#endif
#include <assert.h>
]], [[
static_assert (sizeof (OCTAVE_SUNREALTYPE) == sizeof (double),
"SUNDIALS is not configured for double precision");
]])],
octave_cv_sundials_realtype_is_double=yes,
octave_cv_sundials_realtype_is_double=no)
])
if test $octave_cv_sundials_realtype_is_double = no; then
warn_sundials_disabled="SUNDIALS IDA library not configured with double precision realtype. The solvers ode15i and ode15s will be disabled."
OCTAVE_CONFIGURE_WARNING([warn_sundials_disabled])
fi
])
dnl
dnl Check whether SUNDIALS IDA library has the SUNLINSOL_DENSE linear solver.
dnl
AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SUNLINSOL_DENSE], [
AC_CHECK_HEADERS([sunlinsol/sunlinsol_dense.h],
octave_cv_sundials_sunlinsol_dense=yes,
octave_cv_sundials_sunlinsol_dense=no)
])
if test $octave_cv_sundials_sunlinsol_dense = yes; then
AC_DEFINE(HAVE_SUNDIALS_SUNLINSOL_DENSE, 1,
[Define to 1 if SUNDIALS IDA includes the SUNLINSOL_DENSE linear solver.])
else
warn_sundials_disabled="SUNDIALS IDA library does not include the SUNLINSOL_DENSE linear solver. The solvers ode15i and ode15s will be disabled."
OCTAVE_CONFIGURE_WARNING([warn_sundials_disabled])
fi
])
dnl
dnl Check whether SUNDIALS IDA library is configured with SUNLINSOL_KLU
dnl enabled.
dnl
AC_DEFUN([OCTAVE_CHECK_SUNDIALS_SUNLINSOL_KLU], [
## Including <sunlinsol/sunlinsol_klu.h> may depend on including klu.h
## first. So perform the check as follows using several different
## possible locations for klu.h instead of using OCTAVE_CHECK_LIB to
## check for sunlinsol_klu.h.
AC_CHECK_HEADERS([klu.h klu/klu.h suitesparse/klu.h ufsparse/klu.h])
AC_CHECK_HEADERS([sunlinsol/sunlinsol_klu.h], [], [],
[#if defined (HAVE_KLU_H)
# include <klu.h>
#elif defined (HAVE_KLU_KLU_H)
# include <klu/klu.h>
#elif defined (HAVE_SUITESPARSE_KLU_H)
# include <suitesparse/klu.h>
#elif defined (HAVE_UFSPARSE_KLU_H)
# include <ufsparse/klu.h>
#endif
])
## Check for library that exports SUNContext_Create
OCTAVE_CHECK_SUNDIALS_SUNCONTEXT_CREATE
## Check for current KLU function name first.
ac_octave_save_CPPFLAGS="$CPPFLAGS"
ac_octave_save_LDFLAGS="$LDFLAGS"
ac_octave_save_LIBS="$LIBS"
CPPFLAGS="$SUNDIALS_CORE_CPPFLAGS $CPPFLAGS"
LDFLAGS="$SUNDIALS_CORE_LDFLAGS $LDFLAGS"
LIBS="$SUNDIALS_CORE_LIBS $LIBS"
OCTAVE_CHECK_LIB(sundials_sunlinsolklu, SUNLINSOL_KLU, [],
[], [SUNLinSol_KLU], [],
[don't use SUNDIALS SUNLINSOL_KLU library, disable ode15i and ode15s sparse Jacobian],
[AC_CHECK_FUNCS([SUNLinSol_KLU])
AC_CACHE_CHECK([whether compiling a program that calls SUNLinSol_KLU works],
[octave_cv_sundials_sunlinsol_klu],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if defined (HAVE_IDA_IDA_H)
#include <ida/ida.h>
#endif
#if defined (HAVE_KLU_H)
#include <klu.h>
#endif
#if defined (HAVE_KLU_KLU_H)
#include <klu/klu.h>
#endif
#if defined (HAVE_SUITESPARSE_KLU_H)
#include <suitesparse/klu.h>
#endif
#if defined (HAVE_UFPARSE_KLU_H)
#include <ufsparse/klu.h>
#endif
#if defined (HAVE_SUNLINSOL_SUNLINSOL_KLU_H)
#include <sunlinsol/sunlinsol_klu.h>
#endif
]], [[
#if defined (HAVE_SUNDIALS_SUNCONTEXT)
# if ! defined (SUN_COMM_NULL)
# define SUN_COMM_NULL NULL
# endif
SUNContext *sunContext;
if (SUNContext_Create (SUN_COMM_NULL, sunContext) < 0)
1/0; // provoke an error
SUNLinSol_KLU (0, 0, *sunContext);
SUNContext_Free (sunContext);
#else
SUNLinSol_KLU (0, 0);
#endif
]])],
octave_cv_sundials_sunlinsol_klu=yes,
octave_cv_sundials_sunlinsol_klu=no)
])])
if test "x$octave_cv_sundials_sunlinsol_klu" = xno; then
## Check for deprecated KLU function name second.
OCTAVE_CHECK_LIB(sundials_sunlinsolklu, SUNLINSOL_KLU, [],
[], [SUNKLU], [],
[don't use SUNDIALS SUNLINSOL_KLU library, disable ode15i and ode15s sparse Jacobian],
[AC_CHECK_FUNCS([SUNKLU])
AC_CACHE_CHECK([whether compiling a program that calls SUNKLU works],
[octave_cv_sundials_sunlinsol_klu],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#if defined (HAVE_IDA_IDA_H)
#include <ida/ida.h>
#endif
#if defined (HAVE_KLU_H)
#include <klu.h>
#endif
#if defined (HAVE_KLU_KLU_H)
#include <klu/klu.h>
#endif
#if defined (HAVE_SUITESPARSE_KLU_H)
#include <suitesparse/klu.h>
#endif
#if defined (HAVE_UFPARSE_KLU_H)
#include <ufsparse/klu.h>
#endif
#if defined (HAVE_SUNLINSOL_SUNLINSOL_KLU_H)
#include <sunlinsol/sunlinsol_klu.h>
#endif
]], [[
SUNKLU (0, 0);
]])],
octave_cv_sundials_sunlinsol_klu=yes,
octave_cv_sundials_sunlinsol_klu=no)
])])
fi
if test "x$ac_cv_header_sunlinsol_sunlinsol_klu_h" = xyes \
&& test "x$octave_cv_sundials_sunlinsol_klu" = xyes; then
AC_DEFINE(HAVE_SUNDIALS_SUNLINSOL_KLU, 1,
[Define to 1 if SUNDIALS IDA is configured with SUNLINSOL_KLU enabled.])
else
warn_sundials_sunlinsol_klu="SUNDIALS IDA library not configured with SUNLINSOL_KLU or sunlinsol_klu.h is not usable. The solvers ode15i and ode15s will not support the sparse Jacobian feature."
OCTAVE_CONFIGURE_WARNING([warn_sundials_sunlinsol_klu])
fi
CPPFLAGS="$ac_octave_save_CPPFLAGS"
LDFLAGS="$ac_octave_save_LDFLAGS"
LIBS="$ac_octave_save_LIBS"
])
dnl
dnl Like AC_CONFIG_FILES, but don't touch the output file if it already
dnl exists and hasn't changed.
dnl
AC_DEFUN([OCTAVE_CONFIG_MOVE_IF_CHANGE_FILES], [
m4_foreach_w([elt], [$1], [
AC_CONFIG_FILES(elt[-tmp:]patsubst(elt, [.sh$], [.in.sh]))
AC_CONFIG_COMMANDS(elt,
[$SHELL $srcdir/build-aux/move-if-change ]elt[-tmp ]elt)])])
dnl
dnl Add warning to final summary.
dnl
AC_DEFUN([OCTAVE_CONFIGURE_WARNING], [
AC_MSG_WARN([$][$1])
m4_set_add([summary_warning_list], [$1])
])
dnl
dnl Print final summary.
dnl
AC_DEFUN([OCTAVE_CONFIGURE_WARNING_SUMMARY], [
m4_set_foreach([summary_warning_list], [elt], [
if test -n "[$]elt"; then
AC_MSG_WARN([$]elt)
warn_msg_printed=true
fi])
])
dnl
dnl Check if the C++ library has the bit_and, bit_or, and bit_xor
dnl templates defined.
dnl
AC_DEFUN([OCTAVE_CXX_BITWISE_OP_TEMPLATES], [
AC_CACHE_CHECK([whether bit_and, bit_or, bit_xor are defined in the C++ library],
[octave_cv_cxx_bitwise_op_templates],
[AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <functional>
]], [[
int x = 0;
int y = 1;
int z1 = std::bit_and<int>() (x, y);
int z2 = std::bit_or<int>() (x, y);
int z3 = std::bit_xor<int>() (x, y);
]])],
octave_cv_cxx_bitwise_op_templates=yes,
octave_cv_cxx_bitwise_op_templates=no)
AC_LANG_POP(C++)
])
if test $octave_cv_cxx_bitwise_op_templates = yes; then
AC_DEFINE(HAVE_CXX_BITWISE_OP_TEMPLATES, 1,
[Define to 1 if C++ library has templated bitwise operators.])
fi
])
dnl
dnl Check if the C++ library has functions to access real and imaginary
dnl parts of complex numbers independently via references.
dnl
AC_DEFUN([OCTAVE_CXX_COMPLEX_REFERENCE_ACCESSORS], [
AC_CACHE_CHECK([whether complex class can reference components independently],
[octave_cv_cxx_complex_reference_accessors],
[AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <complex>
]], [[
std::complex<double> x;
x.real () = 1.0;
x.imag () = 1.0;
]])],
octave_cv_cxx_complex_reference_accessors=yes,
octave_cv_cxx_complex_reference_accessors=no)
AC_LANG_POP(C++)
])
if test $octave_cv_cxx_complex_reference_accessors = yes; then
AC_DEFINE(HAVE_CXX_COMPLEX_REFERENCE_ACCESSORS, 1,
[Define to 1 if C++ complex class has T& real () and T& imag () methods.])
fi
])
dnl
dnl Check if the C++ library has functions to set real and imaginary
dnl parts of complex numbers independently.
dnl
AC_DEFUN([OCTAVE_CXX_COMPLEX_SETTERS], [
AC_CACHE_CHECK([whether complex class can set components independently],
[octave_cv_cxx_complex_setters],
[AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <complex>
]], [[
std::complex<double> x;
x.real (1.0);
x.imag (2.0);
]])],
octave_cv_cxx_complex_setters=yes, octave_cv_cxx_complex_setters=no)
AC_LANG_POP(C++)
])
if test $octave_cv_cxx_complex_setters = yes; then
AC_DEFINE(HAVE_CXX_COMPLEX_SETTERS, 1,
[Define to 1 if C++ complex class has void real (T) and void imag (T) methods.])
fi
])
dnl
dnl Check if the compiler supports dynamic auto arrays.
dnl
AC_DEFUN([OCTAVE_CXX_DYNAMIC_AUTO_ARRAYS], [
AC_CACHE_CHECK([whether C++ supports dynamic auto arrays],
[octave_cv_cxx_dynamic_auto_arrays],
[AC_LANG_PUSH(C++)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
void test(char *);
int length();
char x[length()];
test(x);
]])],
octave_cv_cxx_dynamic_auto_arrays=yes,
octave_cv_cxx_dynamic_auto_arrays=no)
AC_LANG_POP(C++)
])
if test $octave_cv_cxx_dynamic_auto_arrays = yes; then
AC_DEFINE(HAVE_DYNAMIC_AUTO_ARRAYS, 1,
[Define to 1 if C++ supports dynamic auto arrays.])
fi
])
dnl
dnl Check if C++ compiler handles FLAG command line option. If two
dnl arguments are specified, execute the second arg as shell commands.
dnl Otherwise, add FLAG to CXXFLAGS if the compiler accepts the flag.
dnl
AC_DEFUN([OCTAVE_CXX_FLAG], [
ac_safe=`echo "$1" | $SED 'y%./+-:=%__p___%'`
AC_MSG_CHECKING([whether ${CXX-g++} accepts $1])
AC_CACHE_VAL([octave_cv_cxx_flag_$ac_safe],
[AC_LANG_PUSH(C++)
ac_octave_save_CXXFLAGS="$CXXFLAGS"
CXXFLAGS="$CXXFLAGS $1"
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
eval "octave_cv_cxx_flag_$ac_safe=yes",
eval "octave_cv_cxx_flag_$ac_safe=no")
CXXFLAGS="$ac_octave_save_CXXFLAGS"
AC_LANG_POP(C++)
])
if eval "test \"`echo '$octave_cv_cxx_flag_'$ac_safe`\" = yes"; then
AC_MSG_RESULT([yes])
ifelse([$2], ,
[CXXFLAGS="$CXXFLAGS $1"
AC_MSG_RESULT([adding $1 to CXXFLAGS])], [$2])
else
AC_MSG_RESULT([no])
ifelse([$3], , , [$3])
fi
])
dnl
dnl OCTAVE_DEFINE_MKOCTFILE_DYNAMIC_LINK_OPTIONS
dnl
dnl Requires the following variables to already be set:
dnl
dnl AR
dnl CFLAGS
dnl CXX
dnl CXXFLAGS
dnl EXEEXT
dnl GCC
dnl GREP
dnl GXX
dnl LDFLAGS
dnl ac_cv_f77_compiler_gnu
dnl canonical_host_type
dnl have_msvc
dnl
AC_DEFUN_ONCE([OCTAVE_DEFINE_MKOCTFILE_DYNAMIC_LINK_OPTIONS], [
### Set system-dependent options for building shared libraries.
### These are used by mkoctfile to create dynamically loadable
### .oct and .mex files. It would be great if we could somehow
### use libtool to get this information.
CPICFLAG=-fPIC
CXXPICFLAG=-fPIC
FPICFLAG=-fPIC
SH_LDFLAGS=-shared
DL_LDFLAGS="${SH_LDFLAGS}"
MKOCTFILE_DL_LDFLAGS="${DL_LDFLAGS}"
NO_OCT_FILE_STRIP=false
TEMPLATE_AR="${AR}"
TEMPLATE_ARFLAGS="${ARFLAGS}"
library_path_var=LD_LIBRARY_PATH
ldpreloadsep=" "
case $canonical_host_type in
*-*-386bsd* | *-*-netbsd*)
SH_LDFLAGS=-Bshareable
;;
*-*-openbsd*)
SH_LDFLAGS="-shared -fPIC"
;;
*-*-freebsd*)
SH_LDFLAGS="-shared -Wl,-x"
;;
alpha*-dec-osf*)
CPICFLAG=
CXXPICFLAG=
FPICFLAG=
SH_LDFLAGS="-shared -Wl,-expect_unresolved -Wl,'*'"
;;
*-*-darwin*)
DL_LDFLAGS="-bundle -undefined dynamic_lookup -bind_at_load"
MKOCTFILE_DL_LDFLAGS="-bundle -undefined dynamic_lookup -bind_at_load"
SH_LDFLAGS="-dynamiclib -single_module"
case $canonical_host_type in
powerpc-*)
CXXPICFLAG=
CPICFLAG=
FPICFLAG=
;;
esac
NO_OCT_FILE_STRIP=true
library_path_var=DYLD_LIBRARY_PATH
;;
*-*-cygwin*)
CPICFLAG=
CXXPICFLAG=
FPICFLAG=
DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
ldpreloadsep=":"
;;
*-*-mingw*)
if test $have_msvc = yes; then
DL_LDFLAGS="-shared"
CPICFLAG=
CXXPICFLAG=
FPICFLAG=
SH_LDFLAGS="-shared"
if test -n "`echo $CFLAGS | $GREP -e '-g'`" || test -n "`echo $CXXFLAGS | $GREP -e '-g'`"; then
DL_LDFLAGS="$DL_LDFLAGS -g"
SH_LDFLAGS="$SH_LDFLAGS -g"
fi
NO_OCT_FILE_STRIP=true
library_path_var=PATH
else
CPICFLAG=
CXXPICFLAG=
FPICFLAG=
DL_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc"
SH_LDFLAGS="-shared -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--enable-auto-image-base"
library_path_var=PATH
fi
;;
*-*-msdosmsvc)
DL_LDFLAGS="-shared"
CPICFLAG=
CXXPICFLAG=
FPICFLAG=
SH_LDFLAGS="-shared"
if test -n "`echo $CFLAGS | $GREP -e '-g'`" || test -n "`echo $CXXFLAGS | $GREP -e '-g'`"; then
DL_LDFLAGS="$DL_LDFLAGS -g"
SH_LDFLAGS="$SH_LDFLAGS -g"
fi
NO_OCT_FILE_STRIP=true
library_path_var=PATH
;;
*-*-linux* | *-*-gnu*)
MKOCTFILE_DL_LDFLAGS="-shared -Wl,-Bsymbolic"
;;
i[[3456]]86-*-sco3.2v5*)
SH_LDFLAGS=-G
;;
rs6000-ibm-aix* | powerpc-ibm-aix*)
CPICFLAG=
CXXPICFLAG=
FPICFLAG=
library_path_var=LIBPATH
;;
hppa*-hp-hpux*)
if test $ac_cv_f77_compiler_gnu = yes; then
FPICFLAG=-fPIC
else
FPICFLAG=+Z
fi
SH_LDFLAGS="-shared -fPIC"
library_path_var=SHLIB_PATH
;;
ia64*-hp-hpux*)
if test $ac_cv_f77_compiler_gnu = yes; then
FPICFLAG=-fPIC
else
FPICFLAG=+Z
fi
SH_LDFLAGS="-shared -fPIC"
;;
*-sgi-*)
CPICFLAG=
CXXPICFLAG=
FPICFLAG=
;;
sparc-sun-sunos4*)
if test $ac_cv_f77_compiler_gnu = yes; then
FPICFLAG=-fPIC
else
FPICFLAG=-PIC
fi
SH_LDFLAGS="-assert nodefinitions"
;;
sparc-sun-solaris2* | i386-pc-solaris2*)
if test $ac_cv_f77_compiler_gnu = yes; then
FPICFLAG=-fPIC
else
FPICFLAG=-KPIC
fi
if test "$GCC" = yes; then
CPICFLAG=-fPIC
else
CPICFLAG=-KPIC
fi
if test "$GXX" = yes; then
CXXPICFLAG=-fPIC
SH_LDFLAGS=-shared
else
CXXPICFLAG=-KPIC
SH_LDFLAGS=-G
fi
## Template closures in archive libraries need a different mechanism.
if test "$GXX" != yes; then
TEMPLATE_AR="${CXX}"
TEMPLATE_ARFLAGS="-xar -o"
fi
;;
esac
AC_MSG_NOTICE([defining FPICFLAG to be $FPICFLAG])
AC_MSG_NOTICE([defining CPICFLAG to be $CPICFLAG])
AC_MSG_NOTICE([defining CXXPICFLAG to be $CXXPICFLAG])
AC_MSG_NOTICE([defining SH_LDFLAGS to be $SH_LDFLAGS])
AC_MSG_NOTICE([defining DL_LDFLAGS to be $DL_LDFLAGS])
AC_MSG_NOTICE([defining MKOCTFILE_DL_LDFLAGS to be $MKOCTFILE_DL_LDFLAGS])
AC_MSG_NOTICE([defining NO_OCT_FILE_STRIP to be $NO_OCT_FILE_STRIP])
AC_MSG_NOTICE([defining TEMPLATE_AR to be $TEMPLATE_AR])
AC_MSG_NOTICE([defining TEMPLATE_ARFLAGS to be $TEMPLATE_ARFLAGS])
AC_MSG_NOTICE([defining library_path_var to be $library_path_var])
AC_SUBST(FPICFLAG)
AC_SUBST(CPICFLAG)
AC_SUBST(CXXPICFLAG)
AC_SUBST(SH_LDFLAGS)
AC_SUBST(DL_LDFLAGS)
AC_SUBST(MKOCTFILE_DL_LDFLAGS)
AC_SUBST(NO_OCT_FILE_STRIP)
AC_SUBST(TEMPLATE_AR)
AC_SUBST(TEMPLATE_ARFLAGS)
AC_SUBST(library_path_var)
AC_SUBST(ldpreloadsep)
AM_SUBST_NOTMAKE(ldpreloadsep)
])
dnl
dnl Allow the user disable support for command line editing using GNU
dnl readline.
dnl
AC_DEFUN([OCTAVE_ENABLE_READLINE], [
USE_READLINE=yes
AC_ARG_ENABLE([readline],
[AS_HELP_STRING([--disable-readline],
[do not use readline library])],
[if test "$enableval" = no; then
USE_READLINE=no
warn_readline="command editing and history features require GNU Readline"
fi])
if test $USE_READLINE = yes; then
gl_FUNC_READLINE
if test "$gl_cv_lib_readline" != no; then
AC_DEFINE(USE_READLINE, 1, [Define to 1 to use the readline library.])
else
AC_MSG_WARN([I need GNU Readline 4.2 or later])
AC_MSG_ERROR([this is fatal unless you specify --disable-readline])
fi
fi
])
dnl
dnl Check if Fortran compiler handles FLAG command line option. If
dnl two arguments are specified, execute the second arg as shell
dnl commands. Otherwise, add FLAG to FFLAGS if the compiler accepts
dnl the flag.
dnl
AC_DEFUN([OCTAVE_F77_FLAG], [
ac_safe=`echo "$1" | $SED 'y%./+-:=%__p___%'`
AC_MSG_CHECKING([whether ${F77-g77} accepts $1])
AC_CACHE_VAL([octave_cv_f77_flag_$ac_safe], [
AC_LANG_PUSH(Fortran 77)
ac_octave_save_FFLAGS="$FFLAGS"
FFLAGS="$FFLAGS $1"
AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
eval "octave_cv_f77_flag_$ac_safe=yes",
eval "octave_cv_f77_flag_$ac_safe=no")
FFLAGS="$ac_octave_save_FFLAGS"
AC_LANG_POP(Fortran 77)
])
if eval "test \"`echo '$octave_cv_f77_flag_'$ac_safe`\" = yes"; then
AC_MSG_RESULT([yes])
ifelse([$2], ,
[FFLAGS="$FFLAGS $1"
AC_MSG_RESULT([adding $1 to FFLAGS])], [$2])
else
AC_MSG_RESULT([no])
ifelse([$3], , , [$3])
fi
])
dnl
dnl Check to see if the compiler and the linker can handle the flags
dnl "-framework $1" for the given prologue $2 and the given body $3 of
dnl a source file. Arguments 2 and 3 optionally can also be empty.
dnl Add options (lower case letters $1) "--with-framework-$1" and
dnl "--without-framework-$1". If this test is successful then perform
dnl $4, otherwise do $5.
dnl
AC_DEFUN([OCTAVE_HAVE_FRAMEWORK], [
AC_MSG_CHECKING([whether ${LD-ld} accepts -framework $1])
AC_CACHE_VAL([octave_cv_framework_$1],
[ac_octave_save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -framework $1"
AC_LANG_PUSH(C++)
AC_LINK_IFELSE([AC_LANG_PROGRAM([$2], [$3])],
eval "octave_cv_framework_$1=yes",
eval "octave_cv_framework_$1=no")
AC_LANG_POP(C++)
LDFLAGS="$ac_octave_save_LDFLAGS"
])
if test "$octave_cv_framework_$1" = yes; then
AC_MSG_RESULT([yes])
AC_ARG_WITH(framework-m4_tolower($1),
[AS_HELP_STRING([--without-framework-m4_tolower($1)],
[don't use framework $1])],
with_have_framework=$withval, with_have_framework=yes)
if test "$with_have_framework" = yes; then
[$4]
:
else
AC_MSG_NOTICE([framework rejected by --without-framework-m4_tolower($1)])
[$5]
fi
else
AC_MSG_RESULT([no])
[$5]
fi
])
dnl
dnl Check for IEEE 754 data format.
dnl
AC_DEFUN([OCTAVE_IEEE754_DATA_FORMAT], [
AC_MSG_CHECKING([for IEEE 754 data format])
AC_CACHE_VAL([octave_cv_ieee754_data_format],
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
int
main (void)
{
typedef union { unsigned char c[8]; double d; } ieeebytes;
ieeebytes l = {0x1c, 0xbc, 0x6e, 0xf2, 0x54, 0x8b, 0x11, 0x43};
ieeebytes b = {0x43, 0x11, 0x8b, 0x54, 0xf2, 0x6e, 0xbc, 0x1c};
return l.d != 1234567891234567.0 && b.d != 1234567891234567.0;
}
]])],
octave_cv_ieee754_data_format=yes,
octave_cv_ieee754_data_format=no,
octave_cv_ieee754_data_format=yes)
])
if test "$cross_compiling" = yes; then
AC_MSG_RESULT([$octave_cv_ieee754_data_format assumed for cross compilation])
else
AC_MSG_RESULT([$octave_cv_ieee754_data_format])
fi
if test $octave_cv_ieee754_data_format = yes; then
AC_DEFINE(HAVE_IEEE754_DATA_FORMAT, 1,
[Define to 1 if your system uses IEEE 754 data format.])
else
## If the format is unknown, then you will probably not have a
## useful system, so we will abort here. Anyone wishing to
## experiment with building Octave on a system without IEEE
## floating point should be capable of removing this check and
## the one in the octave_ieee_init function in liboctave/lo-ieee.cc.
AC_MSG_ERROR([IEEE 754 data format required for building Octave])
fi
])
dnl
dnl Check if MIPS processor is target and quiet signalling NaN value is
dnl opposite of IEEE 754-2008 standard used by all other architectures.
dnl
AC_DEFUN([OCTAVE_MIPS_NAN], [
AC_CACHE_CHECK([whether MIPS processor is using non-standard NaN encoding],
[octave_cv_mips_nan],
[AC_LANG_PUSH(C++)
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <cmath>
#include <limits>
]], [[
/* FIXME: Only test is that MIPS is the target architecture.
* This should be AND'ed with a test for whether the actual NaN
* value for the high word (LO_IEEE_NA_HW) has the value
* 0x7FF840F4 (normal) or 0x7FF040F4 (non-standard). Template code
* that could work is in liboctave/utils/lo-ieee.cc but it also
* depends on knowing whether the architecture is big-endian or
* little-endian. */
#if defined (__mips__)
return (0);
#else
return (1);
#endif
]])],
octave_cv_mips_nan=yes,
octave_cv_mips_nan=no,
octave_cv_mips_nan=no)
AC_LANG_POP(C++)
])
if test $octave_cv_mips_nan = yes; then
AC_DEFINE(HAVE_MIPS_NAN, 1,
[Define to 1 if MIPS processor is using non-standard NaN encoding.])
fi
])
dnl
dnl Check for ar.
dnl
AC_DEFUN([OCTAVE_PROG_AR], [
if test -z "$AR"; then
AR=ar
fi
AC_SUBST(AR)
if test -z "$ARFLAGS"; then
ARFLAGS="cr"
fi
AC_SUBST(ARFLAGS)
dnl FIXME: Remove when libtool updated (placed 4/15/2017).
dnl This silences the following unnecessary warning during compile:
dnl ar: `u' modifier ignored since `D' is the default (see `U')
if test -z "$AR_FLAGS"; then
AR_FLAGS="$ARFLAGS"
fi
])
dnl
dnl Check for bison.
dnl
AC_DEFUN([OCTAVE_PROG_BISON], [
dnl FIXME: What is our actual required minimum version for Bison?
gl_PROG_BISON([BISON], [3.0])
WARN_BISONFLAGS=
case "`$BISON --version`" in
*bison*) tmp_have_bison=yes ;;
*) tmp_have_bison=no ;;
esac
if test $tmp_have_bison = yes; then
WARN_BISONFLAGS="-Wno-yacc"
AC_CACHE_CHECK([syntax of bison api.prefix (or name-prefix) declaration],
[octave_cv_bison_api_prefix_decl_style], [
style="api name"
quote="quote brace"
for s in $style; do
for q in $quote; do
if test $s = "api"; then
if test $q = "quote"; then
def='%define api.prefix "foo_"'
else
def='%define api.prefix {foo_}'
fi
else
if test $q = "quote"; then
def='%name-prefix="foo_"'
else
def='%name-prefix {foo_}'
fi
fi
cat << EOF > conftest.yy
$def
%start input
%%
input:;
%%
EOF
## Older versions of bison only warn and exit with success.
octave_bison_output=`$BISON $WARN_BISONFLAGS conftest.yy 2>&1`
ac_status=$?
if test $ac_status -eq 0 && test -z "$octave_bison_output"; then
octave_cv_bison_api_prefix_decl_style="$s $q"
break
fi
done
if test -n "$octave_cv_bison_api_prefix_decl_style"; then
break
fi
done
rm -f conftest.yy y.tab.h y.tab.c
])
AC_CACHE_CHECK([whether api.prefix applies to yysymbol_kind_t],
[octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t], [
[case "$octave_cv_bison_api_prefix_decl_style" in
"api brace")
def='%define api.prefix {PREFIX_}'
;;
"api quote")
def='%define api.prefix "PREFIX_"'
;;
"name brace")
def='%define name-prefix {PREFIX_}'
;;
"name quote")
def='%define name-prefix "PREFIX_"'
;;
esac]
cat << EOF > conftest.yy
$def
%start input
%%
input:;
%%
EOF
## Older versions of bison only warn and exit with success.
$BISON $WARN_BISONFLAGS --defines --output conftest.cc conftest.yy
if grep PREFIX_symbol_kind_t conftest.cc > /dev/null; then
octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t=yes
else
octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t=no
fi
rm -f conftest.yy y.tab.h conftest.cc
])
fi
if test -z "$octave_cv_bison_api_prefix_decl_style" \
|| test "$octave_cv_bison_api_prefix_decl_style" != "api brace"; then
tmp_have_bison=no
warn_bison_api_prefix_decl_style="
I wasn't able to find a suitable style for declaring the api prefix
in a bison input file so I'm disabling bison. We expect bison to
understand the '%define api.prefix { PREFIX }' syntax.
"
OCTAVE_CONFIGURE_WARNING([warn_bison_api_prefix_decl_style])
fi
if test $tmp_have_bison = no; then
BISON='${top_srcdir}/build-aux/missing bison'
warn_bison="
I didn't find bison, or the version of bison that I found does not
support all the features that are required, but it's only a problem
if you need to reconstruct parse.cc, which is the case if you're
building from VCS sources.
"
OCTAVE_CONFIGURE_WARNING([warn_bison])
fi
if test "$octave_cv_bison_api_prefix_applies_to_yysymbol_kind_t" = no; then
OCTAVE_PARSER_CPPFLAGS="-Dyysymbol_kind_t=octave_symbol_kind_t"
OCTAVE_TEX_PARSER_CPPFLAGS="-Dyysymbol_kind_t=octave_tex_symbol_kind_t"
fi
AC_SUBST(OCTAVE_PARSER_CPPFLAGS)
AC_SUBST(OCTAVE_TEX_PARSER_CPPFLAGS)
])
dnl
dnl Find find program.
dnl
## Prefer GNU find if found.
AN_MAKEVAR([FIND], [OCTAVE_PROG_FIND])
AN_PROGRAM([gfind], [OCTAVE_PROG_FIND])
AN_PROGRAM([find], [OCTAVE_PROG_FIND])
AC_DEFUN([OCTAVE_PROG_FIND], [
AC_CHECK_PROGS(FIND, [gfind find])
])
dnl
dnl Check for flex.
dnl
AC_DEFUN([OCTAVE_PROG_FLEX], [
## For now, don't define LEXLIB to be -lfl -- we don't use anything in
## it, and it might not be installed.
##
## Also make sure that we generate an interactive scanner if we are
## using flex.
dnl We declare %noyywrap in the lexer files so we use the noyywrap
dnl option here to skip the search for that function.
AC_PROG_LEX([noyywrap])
case "`$LEX --version`" in
*flex*)
LFLAGS="-I"
AC_MSG_RESULT([defining LFLAGS to be $LFLAGS])
LEXLIB=
;;
*)
LEX='${top_srcdir}/build-aux/missing flex'
warn_flex="
I didn't find flex, but it's only a problem if you need to reconstruct
lex.cc, which is the case if you're building from VCS sources.
"
OCTAVE_CONFIGURE_WARNING([warn_flex])
;;
esac
AC_SUBST(LFLAGS)
])
dnl
dnl Check for ghostscript.
dnl
AC_DEFUN([OCTAVE_PROG_GHOSTSCRIPT], [
case "$canonical_host_type" in
*-*-mingw* | *-*-msdosmsvc)
ac_octave_gs_names="gs gswin32c gswin64c mgs"
;;
*)
ac_octave_gs_names="gs"
;;
esac
AC_CHECK_PROGS(GHOSTSCRIPT, [$ac_octave_gs_names])
if test -z "$GHOSTSCRIPT"; then
GHOSTSCRIPT='${top_srcdir}/build-aux/missing gs'
warn_ghostscript="
I didn't find ghostscript, so reconstructing figures for the manual
will fail, and saving graphics in some output formats will fail when
using Octave
"
OCTAVE_CONFIGURE_WARNING([warn_ghostscript])
fi
AC_SUBST(GHOSTSCRIPT)
])
dnl
dnl Check for gnuplot.
dnl
AC_DEFUN([OCTAVE_PROG_GNUPLOT], [
ac_octave_gp_names="gnuplot"
ac_octave_gp_default="gnuplot"
if test "$cross_compiling" = yes; then
GNUPLOT="$ac_octave_gp_default"
GNUPLOT_BINARY=$GNUPLOT
AC_MSG_RESULT([assuming $GNUPLOT exists on $canonical_host_type host])
else
AC_CHECK_PROGS(GNUPLOT, [$ac_octave_gp_names])
GNUPLOT_BINARY=$GNUPLOT
if test -z "$GNUPLOT"; then
GNUPLOT="$ac_octave_gp_default"
GNUPLOT_BINARY=""
warn_gnuplot="
gnuplot not found. It isn't necessary to have gnuplot installed, but
without native graphics or gnuplot you won't be able to use any of
Octave's plotting commands.
"
OCTAVE_CONFIGURE_WARNING([warn_gnuplot])
fi
fi
AC_SUBST(GNUPLOT)
])
dnl
dnl Check for gperf.
dnl
AC_DEFUN([OCTAVE_PROG_GPERF], [
AC_CHECK_PROG(GPERF, gperf, gperf, [])
if test -z "$GPERF"; then
GPERF='${top_srcdir}/build-aux/missing gperf'
warn_gperf="
I didn't find gperf, but it's only a problem if you need to
reconstruct oct-gperf.h
"
OCTAVE_CONFIGURE_WARNING([warn_gperf])
GPERF='${top_srcdir}/build-aux/missing gperf'
fi
AC_SUBST(GPERF)
])
dnl
dnl Find icotool program.
dnl
AC_DEFUN([OCTAVE_PROG_ICOTOOL], [
AC_CHECK_PROG(ICOTOOL, icotool, icotool, [])
if test -z "$ICOTOOL"; then
ICOTOOL='${top_srcdir}/build-aux/missing icotool'
warn_icotool="
I didn't find icotool, but it's only a problem if you need to
reconstruct octave-logo.ico, which is the case if you're building from
VCS sources.
"
OCTAVE_CONFIGURE_WARNING([warn_icotool])
fi
AC_SUBST(ICOTOOL)
])
dnl
dnl Check for makeinfo.
dnl
AC_DEFUN([OCTAVE_PROG_MAKEINFO], [
dnl use MKINFO, not MAKEINFO, for variable name because Automake
dnl automatically defines a value for MAKEINFO even when it does not
dnl exist which will then fool the 'test -z' line.
AC_CHECK_PROG(MKINFO, makeinfo, makeinfo, [])
if test -z "$MKINFO"; then
warn_makeinfo="
I didn't find makeinfo, which is required for reading documentation.
You may install a copy later for Octave to use.
"
OCTAVE_CONFIGURE_WARNING([warn_makeinfo])
fi
dnl If we have a GNU makeinfo program, see if it supports the @sortas command
dnl for defining a custom sort key for an index entry.
if test -n "$MKINFO"; then
AC_CACHE_CHECK([for makeinfo support for @sortas command],
[octave_cv_makeinfo_sortas_command],
[cat << EOF > conftest.texi
\input texinfo
@node Top
@top Document
@menu
* Chapter::
* Index::
@end menu
@node Chapter
@chapter Chapter
@cindex @sortas{a} foo
@node Index
@unnumbered Index
@printindex cp
@bye
EOF
if $MKINFO --no-warn conftest.texi 2>/dev/null; then
octave_cv_makeinfo_sortas_command=yes
else
octave_cv_makeinfo_sortas_command=no
fi
rm -f conftest.info conftest.texi
])
if test $octave_cv_makeinfo_sortas_command = no; then
warn_makeinfo="
I wasn't able to find a version of GNU makeinfo that supports the
@sortas command, but it's only a problem if you need to build the
manual, which is the case if you're building from VCS sources.
"
OCTAVE_CONFIGURE_WARNING([warn_makeinfo])
fi
fi
])
dnl
dnl What pager should we use?
dnl
AC_DEFUN([OCTAVE_PROG_PAGER], [
if test "$cross_compiling" = yes; then
DEFAULT_PAGER=less
AC_MSG_RESULT([assuming $DEFAULT_PAGER exists on $canonical_host_type host])
AC_SUBST(DEFAULT_PAGER)
else
ac_octave_possible_pagers="less more page pg"
case "$canonical_host_type" in
*-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc)
ac_octave_possible_pagers="$ac_octave_possible_pagers more.com"
;;
esac
AC_CHECK_PROGS(DEFAULT_PAGER, [$ac_octave_possible_pagers], [])
if test -z "$DEFAULT_PAGER"; then
warn_less="I couldn't find \`less', \`more', \`page', or \`pg'"
OCTAVE_CONFIGURE_WARNING([warn_less])
fi
fi
])
dnl
dnl Find Perl program.
dnl
AC_DEFUN([OCTAVE_PROG_PERL], [
AC_CHECK_PROG(PERL, perl, perl, [])
AC_SUBST(PERL)
])
dnl
dnl Find Python program.
dnl
AC_DEFUN([OCTAVE_PROG_PYTHON], [
AC_CHECK_PROGS(PYTHON, [python3 python], python, [])
AC_SUBST(PYTHON)
])
dnl
dnl Find rsvg-convert program.
dnl
AC_DEFUN([OCTAVE_PROG_RSVG_CONVERT], [
AC_CHECK_PROG(RSVG_CONVERT, rsvg-convert, rsvg-convert, [])
if test -z "$RSVG_CONVERT"; then
RSVG_CONVERT='${top_srcdir}/build-aux/missing rsvg-convert'
warn_rsvg_convert="
I didn't find rsvg-convert, but it's only a problem if you need to
reconstruct octave-logo-*.png, which is the case if you're building
from VCS sources.
"
OCTAVE_CONFIGURE_WARNING([warn_rsvg_convert])
fi
AC_SUBST(RSVG_CONVERT)
])
dnl
dnl Find sed program.
dnl
# Check for a fully-functional sed program, that truncates
# as few characters as possible and that supports "\(X\|Y\)"
# style regular expression alternation. Prefer GNU sed if found.
AC_DEFUN([OCTAVE_PROG_SED], [
AC_MSG_CHECKING([for a usable sed])
if test -z "$SED"; then
AC_CACHE_VAL([octave_cv_prog_sed],
[# Loop through the user's path and search for sed and gsed.
# Next, test potential sed programs in list for truncation.
_AS_PATH_WALK([$PATH],
[for ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
if AS_EXECUTABLE_P(["$as_dir/$ac_prog$ac_exec_ext"]); then
_sed_list="$_sed_list $as_dir/$ac_prog$ac_exec_ext"
fi
done
done
])
AS_TMPDIR(sed)
_max=0
_count=0
# Add /usr/xpg4/bin/sed as it is typically found on Solaris
# along with /bin/sed that truncates output.
for _sed in $_sed_list /usr/xpg4/bin/sed; do
test ! -f ${_sed} && break
cat /dev/null > "$tmp/sed.in"
_count=0
echo $ECHO_N "0123456789$ECHO_C" >"$tmp/sed.in"
# Check for GNU sed and select it if it is found.
if "${_sed}" --version 2>&1 < /dev/null | $EGREP '(GNU)' > /dev/null; then
octave_cv_prog_sed=${_sed}
break;
fi
# Reject if RE alternation is not handled.
if test "`echo 'this and that' | ${_sed} -n 's/\(this\|that\).*$/\1/p'`" != "this"; then
continue;
fi
while true; do
cat "$tmp/sed.in" "$tmp/sed.in" >"$tmp/sed.tmp"
mv "$tmp/sed.tmp" "$tmp/sed.in"
cp "$tmp/sed.in" "$tmp/sed.nl"
echo >>"$tmp/sed.nl"
${_sed} -e 's/a$//' < "$tmp/sed.nl" >"$tmp/sed.out" || break
cmp -s "$tmp/sed.out" "$tmp/sed.nl" || break
# 10000 chars as input seems more than enough
test $_count -gt 10 && break
_count=`expr $_count + 1`
if test $_count -gt $_max; then
_max=$_count
octave_cv_prog_sed=$_sed
fi
done
done
rm -rf "$tmp"
])
SED=$octave_cv_prog_sed
if test -z "$SED"; then
AC_MSG_ERROR([no usable version of sed found])
fi
fi
AC_SUBST(SED)
AC_MSG_RESULT([$SED])
])
dnl
dnl Check for options that can be passed to tar to make archives reproducible.
dnl
AC_DEFUN([OCTAVE_PROG_TAR_REPRODUCIBLE], [
AC_MSG_CHECKING([for options to make reproducible archives with GNU tar])
AC_CACHE_VAL([octave_cv_tar_flags],
[octave_cv_tar_flags=
dnl This uses Automake's logic for finding GNU tar under various names
for octave_tar in tar gnutar gtar :; do
$octave_tar --version >/dev/null 2>&1 && break
done
dnl If we have a valid GNU tar program, see if it supports sets of options
if test x"$octave_tar" != x:; then
echo > conftest.txt
for octave_tar_flag in --owner=0 --group=0 --numeric-owner --sort=name; do
$octave_tar -cf conftest.tar $octave_cv_tar_flags $octave_tar_flag conftest.txt 2>/dev/null
if test $? -eq 0; then
octave_cv_tar_flags="${octave_cv_tar_flags:+$octave_cv_tar_flags }$octave_tar_flag"
fi
done
rm -f conftest.tar conftest.txt
fi
])
REPRODUCIBLE_TAR_FLAGS="$octave_cv_tar_flags"
AC_SUBST(REPRODUCIBLE_TAR_FLAGS)
AC_MSG_RESULT([$REPRODUCIBLE_TAR_FLAGS])
])
dnl
dnl Check for texi2dvi.
dnl
AC_DEFUN([OCTAVE_PROG_TEXI2DVI], [
AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, [])
if test -z "$TEXI2DVI"; then
TEXI2DVI='${top_srcdir}/build-aux/missing texi2dvi'
warn_texi2dvi="
I didn't find texi2dvi, but it's only a problem if you need to
reconstruct the DVI version of the manual
"
OCTAVE_CONFIGURE_WARNING([warn_texi2dvi])
fi
AC_SUBST(TEXI2DVI)
])
dnl
dnl Check for texi2pdf.
dnl
AC_DEFUN([OCTAVE_PROG_TEXI2PDF], [
AC_REQUIRE([OCTAVE_PROG_TEXI2DVI])
AC_CHECK_PROG(TEXI2PDF, texi2pdf, texi2pdf, [])
if test -z "$TEXI2PDF"; then
ac_octave_texi2pdf_missing=yes;
if test -n "$TEXI2DVI"; then
TEXI2PDF="$TEXI2DVI --pdf"
ac_octave_texi2pdf_missing=no;
fi
else
ac_octave_texi2pdf_missing=no;
fi
if test $ac_octave_texi2pdf_missing = yes; then
TEXI2PDF='${top_srcdir}/build-aux/missing texi2pdf'
warn_texi2pdf="
I didn't find texi2pdf, but it's only a problem if you need to
reconstruct the PDF version of the manual
"
OCTAVE_CONFIGURE_WARNING([warn_texi2pdf])
fi
AC_SUBST(TEXI2PDF)
])
dnl
dnl Set default value for a variable and substitute it.
dnl
AC_DEFUN([OCTAVE_SET_DEFAULT], [
ifelse($#, 2, [: ${$1=$2}
])dnl
AC_MSG_RESULT([defining $1 to be $$1])
AC_SUBST($1)
])
dnl
dnl Check for UMFPACK separately split complex matrix and RHS.
dnl
dnl Macro assumes that the check for umfpack has already been performed.
dnl
AC_DEFUN([OCTAVE_UMFPACK_SEPARATE_SPLIT], [
AC_MSG_CHECKING([for UMFPACK separate complex matrix and rhs split])
AC_CACHE_VAL([octave_cv_umfpack_separate_split],
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdint.h>
#include <stdlib.h>
#include <math.h>
#if defined (HAVE_SUITESPARSE_UMFPACK_H)
# include <suitesparse/umfpack.h>
#elif defined (HAVE_UMFPACK_UMFPACK_H)
# include <umfpack/umfpack.h>
#elif defined (HAVE_UMFPACK_H)
# include <umfpack.h>
#endif
#if defined (OCTAVE_ENABLE_64)
typedef uint64_t idx_type;
#define UMFPACK_NAME(name) umfpack_zl_ ## name
#else
typedef int idx_type;
#define UMFPACK_NAME(name) umfpack_zi_ ## name
#endif
idx_type n = 5;
idx_type Ap[] = {0, 2, 5, 9, 10, 12};
idx_type Ai[] = {0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4};
double Ax[] = {2., 0., 3., 0., 3., 0., -1., 0., 4., 0., 4., 0.,
-3., 0., 1., 0., 2., 0., 2., 0., 6., 0., 1., 0.};
double br[] = {8., 45., -3., 3., 19.};
double bi[] = {0., 0., 0., 0., 0.};
int main (void)
{
double *null = (double *) NULL ;
double *x = (double *)malloc (2 * n * sizeof(double));
idx_type i ;
void *Symbolic, *Numeric ;
(void) UMFPACK_NAME (symbolic) (n, n, Ap, Ai, Ax, null, &Symbolic, null, null) ;
(void) UMFPACK_NAME (numeric) (Ap, Ai, Ax, null, Symbolic, &Numeric, null, null) ;
UMFPACK_NAME (free_symbolic) (&Symbolic) ;
(void) UMFPACK_NAME (solve) (0, Ap, Ai, Ax, null, x, null, br, bi,
Numeric, null, null) ;
UMFPACK_NAME (free_numeric) (&Numeric) ;
for (i = 0; i < n; i++, x+=2)
if (fabs (*x - i - 1.) > 1.e-13)
return (1);
return (0) ;
}
]])],
octave_cv_umfpack_separate_split=yes,
octave_cv_umfpack_separate_split=no,
octave_cv_umfpack_separate_split=yes)
])
if test "$cross_compiling" = yes; then
AC_MSG_RESULT([$octave_cv_umfpack_separate_split assumed for cross compilation])
else
AC_MSG_RESULT([$octave_cv_umfpack_separate_split])
fi
if test $octave_cv_umfpack_separate_split = yes; then
AC_DEFINE(UMFPACK_SEPARATE_SPLIT, 1,
[Define to 1 if the UMFPACK Complex solver allows matrix and RHS to be split independently.])
fi
])
|