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
|
#
# Keepalived OpenSource project.
#
# Configuration template file for keepalived.
# autoconf will generate & check deps for proper compilation
#
# Copyright (C) 2001-2018 Alexandre Cassen, <acassen@linux-vs.org>
AC_DEFUN([add_to_var], [$1="$$1 $2"])
AC_DEFUN([add_to_var_ind], [eval $1=\"\$$1 $2\"]) dnl "
AC_DEFUN([add_to_var_ind_unique],
ADD_NEW=
[ eval var=\$$1
for item in $2; do
echo " $var " | $GREP -q " $item "
if test $? -ne 0; then
add_to_var([ADD_NEW], [$item])
fi
done
add_to_var_ind([$1], [$ADD_NEW])
])
AC_DEFUN([add_pkg_config],
[ if test -n "$2"; then
KA_PKG_PFX=$2
else
KA_PKG_PFX=KA
fi
add_to_var_ind_unique([${KA_PKG_PFX}_CPPFLAGS], [`$PKG_CONFIG --cflags-only-I $1`])
add_to_var_ind_unique([${KA_PKG_PFX}_CFLAGS], [`$PKG_CONFIG --cflags-only-other $1`])
if test .$3 = .remove-requires; then
REQUIRES=`$PKG_CONFIG --print-requires $1`
var=`$PKG_CONFIG --libs-only-l $1`
for r in $REQUIRES; do
REQ_LIBS=`$PKG_CONFIG --libs-only-l $r`
for l in $REQ_LIBS; do
var=`echo " $var " | sed -e "s: $l : :g"`
done
done
var=`echo $var | sed -e "s:^ *::" -e "s: *$::"`
eval ${KA_PKG_PFX}_LIBS="\"$var\""
var=`echo $var | sed -e "s/-l//g"`
eval ${KA_PKG_PFX}_LIB_NAMES="\"$var\""
else
add_to_var_ind_unique([${KA_PKG_PFX}_LIBS], [`$PKG_CONFIG --libs $1`])
fi
])
AC_DEFUN([add_pkg_config_without_libs],
[ if test -n "$2"; then
KA_PKG_PFX=$2
else
KA_PKG_PFX=KA
fi
add_to_var_ind_unique([${KA_PKG_PFX}_CPPFLAGS], [$($PKG_CONFIG --cflags-only-I $1)])
add_to_var_ind_unique([${KA_PKG_PFX}_CFLAGS], [$($PKG_CONFIG --cflags-only-other $1)])
])
AC_DEFUN([add_config_opt], [add_to_var([CONFIG_OPTIONS], [$1])])
AC_DEFUN([add_system_opt], [add_to_var([SYSTEM_OPTIONS], [$1])])
AC_DEFUN([get_lib_name],
[
if test $LDD = :; then
AC_MSG_ERROR([ldd is required for dynamic run-time linking support])
fi
SAV_LIBS="$LIBS"
LIBS="$LIBS -l$1"
AC_LINK_IFELSE([AC_LANG_SOURCE([[
extern void $2(void);
int main(void)
{
$2();
return 0;
}
]])], [
LIB_DETAILS=`$LDD ./conftest$EXEEXT | grep $1.so | sed -e "s/^[[ \t]]*//"`
LIB_NAME=`echo $LIB_DETAILS | sed -e "s/ .*//"`
],[
])
LIBS="$SAV_LIBS"
])
# AS_VAR_COPY was introduced in autoconf 2.63b.
# Remove the following definition once require autoconf >= 2.64.
m4_ifndef([AS_VAR_COPY],
[m4_define([AS_VAR_COPY],
[AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])])
dnl ----[ Process this file with autoconf to produce a configure script ]----
AC_PREREQ([2.63])
AC_INIT([Keepalived], [2.1.5], [keepalived-users@groups.io], [], [http://www.keepalived.org/])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([-Wall -Werror -Woverride foreign])
AC_CONFIG_SRCDIR([keepalived/core/main.c])
AC_CONFIG_HEADERS([lib/config.h lib/config_warnings.h])
AH_TOP(
[
#ifndef _CONFIG_H
#define _CONFIG_H
])
AH_BOTTOM(
[
#include "config_warnings.h"
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#endif])
AC_CONFIG_FILES([Makefile keepalived/Makefile lib/Makefile keepalived/core/Makefile keepalived.spec \
genhash/Makefile keepalived/check/Makefile keepalived/vrrp/Makefile \
keepalived/bfd/Makefile doc/Makefile bin_install/Makefile keepalived/dbus/Makefile \
keepalived/etc/Makefile keepalived/etc/init/Makefile keepalived/etc/init.d/Makefile \
keepalived/trackers/Makefile \
doc/man/man8/Makefile])
MAINTAINERCLEANFILES="*~ *.orig *.rej core core.*"
AC_SUBST(MAINTAINERCLEANFILES)
CONFIG_OPTIONS=
SYSTEM_OPTIONS=
AM_SILENT_RULES([yes])
PKG_PROG_PKG_CONFIG
dnl ----[ Keepalived specific configure options ]----
AC_ARG_ENABLE(lvs-syncd,
[AS_HELP_STRING([--disable-lvs-syncd], [do not use LVS synchronization daemon])])
AC_ARG_ENABLE(lvs,
[AS_HELP_STRING([--disable-lvs], [do not use the LVS framework])])
AC_ARG_ENABLE(lvs-64bit-stats,
[AS_HELP_STRING([--disable-lvs-64bit-stats], [do not use the LVS 64-bit stats])])
AC_ARG_ENABLE(vrrp,
[AS_HELP_STRING([--disable-vrrp], [do not use the VRRP framework])])
AC_ARG_ENABLE(bfd,
[AS_HELP_STRING([--enable-bfd], [use the BFD framework])])
AC_ARG_WITH(kernel-dir,
[AS_HELP_STRING([--with-kernel-dir=DIR], [path to linux kernel source directory])],
[AS_HELP_STRING([kernel_src_path="$withval"],], [[kernel_src_path=""])])
AC_ARG_ENABLE(fwmark,
[AS_HELP_STRING([--disable-fwmark], [compile without SO_MARK support])])
AC_ARG_ENABLE(snmp,
[AS_HELP_STRING([--enable-snmp], [compile with SNMP support])])
AC_ARG_ENABLE(snmp-vrrp,
[AS_HELP_STRING([--enable-snmp-vrrp], [compile with SNMP vrrp support])])
AC_ARG_ENABLE(snmp-keepalived,
[AS_HELP_STRING([--enable-snmp-keepalived], [obsolete - use --enable-snmp-vrrp])])
AC_ARG_ENABLE(snmp-checker,
[AS_HELP_STRING([--enable-snmp-checker], [compile with SNMP checker support])])
AC_ARG_ENABLE(snmp-rfc,
[AS_HELP_STRING([--enable-snmp-rfc], [compile with SNMP RFC2787 (VRRPv2) and SNMP RFC6527 (VRRPv3) support])])
AC_ARG_ENABLE(snmp-rfcv2,
[AS_HELP_STRING([--enable-snmp-rfcv2], [compile with SNMP RFC2787 (VRRPv2) support])])
AC_ARG_ENABLE(snmp-rfcv3,
[AS_HELP_STRING([--enable-snmp-rfcv3], [compile with SNMP RFC6527 (VRRPv3) support])])
AC_ARG_ENABLE(snmp-reply-v3-for-v2,
[AS_HELP_STRING([--disable-snmp-reply-v3-for-v2], [disable RFC6527 responses for VRRPv2 instances])])
AC_ARG_ENABLE(dbus,
[AS_HELP_STRING([--enable-dbus], [compile with dbus support])])
AC_ARG_ENABLE(dbus-create-instance,
[AS_HELP_STRING([--enable-dbus-create-instance], [compile with dbus support for creating instances])])
AC_ARG_ENABLE(sha1,
[AS_HELP_STRING([--enable-sha1], [compile with SHA1 support])])
AC_ARG_ENABLE(regex,
[AS_HELP_STRING([--enable-regex], [build with HTTP_GET regex checking])])
AC_ARG_ENABLE(vmac,
[AS_HELP_STRING([--disable-vmac], [build without VMAC support])])
AC_ARG_ENABLE(regex-timers,
[AS_HELP_STRING([--enable-regex-timers], [build with HTTP_GET regex timers])])
AC_ARG_ENABLE(json,
[AS_HELP_STRING([--enable-json], [compile with signal to dump configuration and stats as json])])
AC_ARG_WITH(init,
[AS_HELP_STRING([--with-init=(upstart|systemd|SYSV|SUSE|openrc)], [specify init type])],
[init_type="$withval"], [init_type=""])
AC_ARG_ENABLE(vrrp-auth,
[AS_HELP_STRING([--disable-vrrp-auth], [compile without VRRP authentication])])
AC_ARG_ENABLE(checksum_compat,
[AS_HELP_STRING([--disable-checksum-compat], [compile without v1.3.6 and earlier VRRPv3 unicast checksum compatibility])])
AC_ARG_ENABLE(routes,
[AS_HELP_STRING([--disable-routes], [compile without ip rules/routes])])
AC_ARG_ENABLE(linkbeat,
[AS_HELP_STRING([--disable-linkbeat], [build without linkbeat support])])
AC_ARG_ENABLE(gnu-std-paths,
[AS_HELP_STRING([--enable-gnu-std-paths], [use GNU standard paths for pid files etc])])
AC_ARG_ENABLE(dynamic-linking,
[AS_HELP_STRING([--enable-dynamic-linking], [compile with/without dynamically linked libiptc/libipset/libnl])])
AC_ARG_ENABLE(iptables,
[AS_HELP_STRING([--disable-iptables], [compile without iptables support])],
[], [IPTABLES_SILENT=Yes])
AC_ARG_ENABLE(libiptc-dynamic,
[AS_HELP_STRING([--enable-libiptc-dynamic], [compile with libiptc dynamically linked])])
AC_ARG_ENABLE(libipset-dynamic,
[AS_HELP_STRING([--disable-libipset-dynamic], [compile with libipset statically linked])])
AC_ARG_ENABLE(libnl-dynamic,
[AS_HELP_STRING([--enable-libnl-dynamic], [compile with libnl dynamically linked])])
AC_ARG_ENABLE(libipset,
[AS_HELP_STRING([--disable-libipset], [compile without libipset])])
AC_ARG_ENABLE(nftables,
[AS_HELP_STRING([--disable-nftables], [build without nftables support])],
[], [NFTABLES_SILENT=Yes])
AC_ARG_ENABLE(libnl,
[AS_HELP_STRING([--disable-libnl], [compile without libnl])])
AC_ARG_ENABLE(track-process,
[AS_HELP_STRING([--disable-track-process], [build without track-process functionality])])
AC_ARG_WITH(run-dir,
[AS_HELP_STRING([--with-run-dir=PATH_TO_RUN], [specify directory where /run is located])],
[RUN_DIR_SPECIFIED=Y], [RUN_DIR_SPECIFIED=N])
AC_ARG_ENABLE(strict-config-checks,
[AS_HELP_STRING([--enable-strict-config-checks], [build with strict configuration checking])])
AC_ARG_ENABLE(hardening,
[AS_HELP_STRING([--disable-hardening], [do not build with security hardening])])
AC_ARG_ENABLE(optimise,
[AS_HELP_STRING([--enable-optimise], [compiler optimisation level])], [], [enable_optimise=not-specified])
AC_ARG_ENABLE(warnings,
[AS_HELP_STRING([--enable-warnings[[=WARNINGS]]], [additional compiler warnings, disable for reduced set])], [], [enable_warnings=yes])
AC_ARG_ENABLE(extra-warnings,
[AS_HELP_STRING([--enable-extra-warnings], [extra compiler warnings that will probably produce many warnings])])
AC_ARG_ENABLE(mem-check,
[AS_HELP_STRING([--enable-mem-check], [compile with memory alloc checking])])
AC_ARG_ENABLE(mem-check-log,
[AS_HELP_STRING([--enable-mem-check-log], [compile with memory alloc checking writing to syslog])])
AC_ARG_ENABLE(timer-check,
[AS_HELP_STRING([--enable-timer-check], [compile with set time logging])])
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug], [compile with most debugging options])])
AC_ARG_ENABLE(netlink-timers,
[AS_HELP_STRING([--enable-netlink-timers], [compile with netlink command timers])])
AC_ARG_ENABLE(smtp-alert-debug,
[AS_HELP_STRING([--enable-smtp-alert-debug], [compile with smtp-alert debugging])])
AC_ARG_ENABLE(stacktrace,
[AS_HELP_STRING([--enable-stacktrace], [compile with stacktrace support])])
AC_ARG_ENABLE(perf,
[AS_HELP_STRING([--enable-perf], [compile with perf performance data recording support for vrrp process])])
AC_ARG_ENABLE(log-file,
[AS_HELP_STRING([--enable-log-file], [enable logging to file (-g)])])
AC_ARG_ENABLE(dump-threads,
[AS_HELP_STRING([--enable-dump-threads], [compile with thread dumping support])])
AC_ARG_ENABLE(epoll-debug,
[AS_HELP_STRING([--enable-epoll-debug], [compile with epoll_wait() debugging support])])
AC_ARG_ENABLE(epoll-thread-dump,
[AS_HELP_STRING([--enable-epoll-thread-dump], [compile with epoll thread dumping support])])
AC_ARG_ENABLE(regex-debug,
[AS_HELP_STRING([--enable-regex-debug], [compile with regex debugging support])])
AC_ARG_ENABLE(tsm-debug,
[AS_HELP_STRING([--enable-tsm-debug], [compile with TSM debugging support])])
AC_ARG_ENABLE(vrrp-fd-debug,
[AS_HELP_STRING([--enable-vrrp-fd-debug], [compile with vrrp fd debugging support])])
AC_ARG_ENABLE(eintr-debug,
[AS_HELP_STRING([--enable-eintr-debug], [compile with EINTR debugging support, set to check/not check for EINTR])])
AC_ARG_ENABLE(track-process-debug,
[AS_HELP_STRING([--enable-track-process-debug], [compile with track process debugging support, set to log all process connector events])])
AC_ARG_ENABLE(parser-debug,
[AS_HELP_STRING([--enable-parser-debug], [compile with parser debugging support])])
AC_ARG_ENABLE(checksum-debug,
[AS_HELP_STRING([--enable-checksum-debug], [compile with checksum debugging support])])
AC_ARG_ENABLE(genhash-debug,
[AS_HELP_STRING([--enable-genhash-debug], [compile with genhash debugging support])])
AC_ARG_ENABLE(checker-debug,
[AS_HELP_STRING([--enable-checker-debug], [compile with checker debugging support])])
AC_ARG_ENABLE(smtp-connect-debug,
[AS_HELP_STRING([--enable-smtp-connect-debug], [compile with smtp connect debugging support])])
AC_ARG_ENABLE(mem-err-debug,
[AS_HELP_STRING([--enable-mem-err-debug], [compile with MALLOC/FREE error debugging support])])
AC_ARG_ENABLE(script-debug,
[AS_HELP_STRING([--enable-script-debug], [compile with script termination debugging support])])
AC_ARG_ENABLE(one-process-debug,
[AS_HELP_STRING([--enable-one-process-debug], [compile with all functionality running in a single process])])
AC_ARG_ENABLE(dump-keywords,
[AS_HELP_STRING([--enable-dump-keywords], [compile with keyword dumping support])])
AC_ARG_ENABLE(network-timestamp,
[AS_HELP_STRING([--enable-network-timestamp], [compile with network timestamp debugging support])])
AC_ARG_ENABLE(asserts,
[AS_HELP_STRING([--enable-asserts], [compile with assert() enabled])])
AC_ARG_WITH(fixed-if-type,
[AS_HELP_STRING([--with-fixed-if-type=TYPE], [treat interface type TYPE as unchangeable])])
AC_ARG_WITH(default-config-file,
AS_HELP_STRING([--with-default-config-file=FILE], [Default configuration file]),
[default_config_file="$withval"], [default_config_file=""])
AC_ARG_ENABLE(profile,
[AS_HELP_STRING([--enable-profile], [compile with profiling flags])])
AC_ARG_ENABLE(conversion-checks,
[AS_HELP_STRING([--enable-conversion-checks], [compile with conversion warnings if sensible])])
AC_ARG_ENABLE(force-conversion-checks,
[AS_HELP_STRING([--enable-force-conversion-checks], [compile with conversion warnings])])
AC_ARG_ENABLE(Werror,
[AS_HELP_STRING([--enable-Werror], [compile with warnings being errors])])
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files])])
# Set the kernel headers path
if test -n "$kernel_src_path"; then
if test ! -d $kernel_src_path/include; then
AC_MSG_ERROR([kernel source path $kernel_src_path/include does not exist])
fi
if test ! -d $kernel_src_path/include/linux; then
AC_MSG_ERROR([kernel source path $kernel_src_path/include does not appear to include linux header files])
fi
if test -d $kernel_src_path/include/uapi/linux; then
AC_MSG_ERROR([kernel source path $kernel_src_path appears to be an unprocessed kernel source tree])
fi
kernelinc="-isystem $kernel_src_path/include"
elif test ! -d /usr/include/linux -a \
-d /usr/src/linux/include; then
kernelinc="-isystem /usr/src/linux/include"
else
kernelinc=
fi
CPPFLAGS="$kernelinc $CPPFLAGS"
# Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_RANLIB
AC_PROG_GREP
AC_PROG_LN_S
AC_PROG_SED
AC_CHECK_TOOL(STRIP,strip)
AC_CHECK_TOOL(LDD,ldd)
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
ARFLAGS=cr
AC_SUBST(ARFLAGS)
# Default settings
ENABLE_LOG_FILE_APPEND=No
# AC_PROG_LIBTOOL
#
# save the configure arguments
#
args=`echo $ac_configure_args | $SED -e "s/'//g"`
AC_DEFINE_UNQUOTED(KEEPALIVED_CONFIGURE_OPTIONS,"$args", [configure options specified])
# Save the CPPFLAGS, CFLAGS, LDFLAGS and LDLIBS settings for make time
KA_CPPFLAGS="$kernelinc -D_GNU_SOURCE $CPPFLAGS"
KA_CFLAGS="-g $CFLAGS"
KA_LDFLAGS=$LDFLAGS
KA_LIBS=$LDLIBS
NEED_LIBDL=No
#KA_LIBTOOLFLAGS =
# Set up the compiler warnings we want
dnl -- Unused warnings - traditional
MAX_FRAME_SIZE=5120
WARNINGS_BASIC="all extra unused strict-prototypes"
WARNINGS_STD="absolute-value address-of-packed-member alloca alloc-zero array-bounds=2 attribute-alias bad-function-cast cast-align cast-qual chkp date-time disabled-optimization double-promotion duplicated-branches duplicated-cond float-conversion float-equal format-overflow format-security format-signedness format-truncation frame-larger-than=$MAX_FRAME_SIZE implicit-fallthrough=3 init-self inline jump-misses-init logical-op missing-declarations missing-field-initializers missing-prototypes nested-externs normalized null-dereference old-style-definition overlength-strings pointer-arith redundant-decls shadow shift-overflow=2 stack-protector strict-overflow=4 strict-prototypes stringop-overflow=2 suggest-attribute=cold suggest-attribute=const suggest-attribute=format suggest-attribute=malloc suggest-attribute=noreturn suggest-attribute=pure sync-nand trampolines undef uninitialized unknown-pragmas unsuffixed-float-constants unused-const-variable=2 unused-macros variadic-macros write-strings"
WARNINGS_EXTRA="aggregate-return cast-align= strict conversion format-nonliteral format-overflow=2 format-truncation=2 padded pedantic sign-conversion stack-usage=$MAX_FRAME_SIZE strict-overflow=5 stringop-overflow=3 stringop-overflow=4 switch-enum system-headers traditional-conversion"
# We want _GNU_SOURCE defined always
add_to_var([CPPFLAGS], [-D_GNU_SOURCE])
# fpclassify() needs -lm
add_to_var([KA_LIBS], [-lm])
# Some sanity checks on configure options
AS_IF([test .$enable_vrrp = .no],
AS_IF([test .$IPTABLES_SILENT == .Yes], [enable_iptables=no])
AS_IF([test .$NFTABLES_SILENT == .Yes], [enable_nftables=no])
AS_IF([test .$enable_perf != .], [AC_MSG_ERROR([enable-perf requires vrrp])])
AS_IF([test $with_fixed_if_type], [AC_MSG_ERROR([with-fixed-if-type requires vrrp])])
AS_IF([test .$enable_vrrp_fd_debug != .], [AC_MSG_ERROR([enable-vrrp-fd-debug requires vrrp])])
AS_IF([test .$enable_tsm_debug != .], [AC_MSG_ERROR([enable-tsm-debug requires vrrp])])
AS_IF([test .$enable_json != .], [AC_MSG_ERROR([enable-json requires vrrp])])
AS_IF([test .$enable_snmp_vrrp != .], [AC_MSG_ERROR([enable-snmp-vrrp requires vrrp])])
AS_IF([test .$enable_snmp_keepalived != .], [AC_MSG_ERROR([enable-snmp-keepalived requires vrrp])])
AS_IF([test .$enable_snmp_rfc != .], [AC_MSG_ERROR([enable-snmp-rfc requires vrrp])])
AS_IF([test .$enable_snmp_rfcv2 != .], [AC_MSG_ERROR([enable-snmp-rfcv2 requires vrrp])])
AS_IF([test .$enable_snmp_rfcv3 != .], [AC_MSG_ERROR([enable-snmp-rfcv3 requires vrrp])])
AS_IF([test .$enable_dbus != .], [AC_MSG_ERROR([enable-dbus requires vrrp])])
AS_IF([test .$enable_vrrp_auth != .], [AC_MSG_ERROR([disable-vrrp-auth requires vrrp])])
AS_IF([test .$enable_checksum_compat != .], [AC_MSG_ERROR([disable-checksum-compat requires vrrp])])
AS_IF([test .$enable_routes != .], [AC_MSG_ERROR([disable-routes requires vrrp])])
AS_IF([test .$enable_linkbeat != .], [AC_MSG_ERROR([disable-linkbeat requires vrrp])])
AS_IF([test .$enable_bfd != .], [AC_MSG_ERROR([enable-bfd requires vrrp])])
AS_IF([test .$enable_iptables != .no], [AC_MSG_ERROR([enable-iptables requires vrrp])])
AS_IF([test .$enable_nftables != .no], [AC_MSG_ERROR([enable-nftables requires vrrp])])
AS_IF([test .$enable_track_process != .], [AC_MSG_ERROR([enable-track-process requires vrrp])])
AS_IF([test .$enable_network_timestamp != .], [AC_MSG_ERROR([enable-network-timestamp requires vrrp])])
AS_IF([test .$enable_netlink_timers != .], [AC_MSG_ERROR([enable-netlink-timers requires vrrp])])
)
AS_IF([test .$enable_iptables = .no],
AS_IF([test .$enable_libipset != .], [AC_MSG_ERROR([disable-libipset requires vrrp and iptables])])
)
AS_IF([test .$enable_libipset = .no],
AS_IF([test .$enable_libipset_dynamic != .], [AC_MSG_ERROR([disable-libipset-dynamic requires ipsets])])
)
AS_IF([test .$enable_snmp_rfc != .yes -a .$enable_snmp_rfcv3 != yes],
AS_IF([test .$enable_snmp_reply_v3_for_v2 != .], [AC_MSG_ERROR([enable-snmp-reply-v3-for-v2 requires enable-snmp-rfcv3 or enable-snmp-rfc])])
)
AS_IF([test .$enable_dbus != .yes],
AS_IF([test .$enable_dbus_create_instance != .], [AC_MSG_ERROR([enable-dbus-create-instance requires enable-dbus])])
)
AS_IF([test .$enable_lvs = .no],
AS_IF([test .$enable_regex != .], [AC_MSG_ERROR([enable-regex requires lvs])])
AS_IF([test .$enable_libnl != .], [AC_MSG_ERROR([disable-libnl requires lvs])])
AS_IF([test .$enable_lvs_syncd != .], [AC_MSG_ERROR([disable-lvs-syncd requires lvs])])
AS_IF([test .$enable_lvs_64bit_stats != .], [AC_MSG_ERROR([disable-lvs-64bit-stats requires lvs])])
AS_IF([test .$enable_fwmark != .], [AC_MSG_ERROR([enable-fwmark requires lvs])])
AS_IF([test .$enable_checker_debug != .], [AC_MSG_ERROR([enable-checker-debug requires lvs])])
)
AS_IF([test .$enable_libnl = .no],
AS_IF([test .$enable_libnl_dynamic != .], [AC_MSG_ERROR([enable-libnl-dynamic requires lvs and libnl])])
)
AS_IF([test .$enable_regex != .yes],
AS_IF([test .$enable_regex_timers != .], [AC_MSG_ERROR([enable-regex-timers requires enable-regex])])
AS_IF([test .$enable_regex_debug != .], [AC_MSG_ERROR([enable-regex-debug requires enable-regex])])
)
AS_IF([test .$enable_track_process = .no],
AS_IF([test .$enable_track_process_debug != .], [AC_MSG_ERROR([enable-track-process-debug incompatible with disable-track-process])])
)
AS_IF([test .$enable_mem_check != .yes],
AS_IF([test .$enable_mem_err_debug != .], [AC_MSG_ERROR([enable-mem-err-debug requires --enable-mem-check])])
)
# --enable-debug enables most debugging if not explicitly disabled, but NOT one-process-debug or genhash-debug
AS_IF([test .$enable_debug = .yes],
[
# If we are debugging, we want to be able to write logs to files
AS_IF([test .$enable_log_file = .], [enable_log_file=yes])
AS_IF([test .$enable_asserts = .], [enable_asserts=yes])
AS_IF([test .$enable_epoll_debug = .], [enable_epoll_debug=yes])
AS_IF([test .$enable_epoll_thread_dump = .], [enable_epoll_thread_dump=yes])
AS_IF([test .$enable_eintr_debug = .], [enable_eintr_debug=yes])
AS_IF([test .$enable_parser_debug = .], [enable_parser_debug=yes])
AS_IF([test .$enable_timer_check = .], [enable_timer_check=yes])
AS_IF([test .$enable_smtp_alert_debug = .], [enable_smtp_alert_debug=yes])
AS_IF([test .$enable_smtp_connect_debug = .], [enable_smtp_connect_debug=yes])
AS_IF([test .$enable_dump_keywords = .], [enable_dump_keywords=yes])
AS_IF([test .$enable_script_debug = .], [enable_script_debug=yes])
AS_IF([test .$enable_vrrp != .no],
[
AS_IF([test .$enable_vrrp_fd_debug = .], [enable_vrrp_fd_debug=yes])
AS_IF([test .$enable_tsm_debug = .], [enable_tsm_debug=yes])
AS_IF([test .$enable_track_process_debug = .], [enable_track_process_debug=yes])
AS_IF([test .$enable_checksum_debug = .], [enable_checksum_debug=yes])
AS_IF([test .$enable_netlink_timers = .], [enable_netlink_timers=yes])
AS_IF([test .$enable_network_timestamp = .], [enable_network_timestamp=yes])
])
AS_IF([test .$enable_lvs != .no],
[
AS_IF([test .$enable_checker_debug = .], [enable_checker_debug=yes])
AS_IF([test .$enable_regex = .yes],
[
AS_IF([test .$enable_regex_timers = .], [enable_regex_timers=yes])
AS_IF([test .$enable_regex_debug = .], [enable_regex_debug=yes])
])
])
AS_IF([test .$enable_mem_check = .yes],
[
AS_IF([test .$enable_mem_err_debug = .], [enable_mem_err_debug=yes])
])
])
dnl -- ulibc/glibc differences
AC_MSG_CHECKING([msghdr.msg_controllen is size_t])
SAV_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/socket.h>
#include <stdio.h>
int main(int argc, char**argv)
{
struct msghdr msgh = { .msg_controllen = 0 };
printf("%zu", msgh.msg_controllen);
}
]])],
[
AC_MSG_RESULT([yes])
AC_DEFINE([PRI_MSG_CONTROLLEN], [ "zu" ], [Define to zu if msghdr.msg_controllen is size_t, else u])
],
[
AC_MSG_RESULT([no])
AC_DEFINE([PRI_MSG_CONTROLLEN], [ "u" ], [Define to zu if msghdr.msg_controllen is size_t, else u])
])
CFLAGS=$SAV_CFLAGS
dnl -- Check for diagnostic pragmas in functions - GCC 4.6.0
AC_MSG_CHECKING([diagnostic pragmas in functions])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main(int argc, char**argv)
{
_Pragma("GCC diagnostic warning \"-Wall\"")
}
]])],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_FUNCTION_DIAGNOSTIC_PRAGMAS_], [ 1 ], [Define to 1 if can have _Pragma GCC diagnostic in functions])
],
[
AC_MSG_RESULT([no])
])
AM_CONDITIONAL([DEBUG], [test .$enable_debug = .yes])
dnl -- Check for diagnostic push/pop pragmas - GCC 4.6.0
AC_MSG_CHECKING([diagnostic push/pop pragmas])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main(int argc, char**argv)
{
_Pragma("GCC diagnostic push")
}
]])],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_DIAGNOSTIC_PUSH_POP_PRAGMAS_], [ 1 ], [Define to 1 if can have _Pragma GCC diagnostic push/pop])
],
[
AC_MSG_RESULT([no])
])
dnl - Set up warnings list
AS_IF([test ".$enable_warnings" = .no],
[WARNINGS_ENABLED=$WARNINGS_BASIC],
[WARNINGS_ENABLED="$WARNINGS_BASIC $WARNINGS_STD"
AS_IF([test ".$enable_warnings" != .yes],
[WARN_LIST=`echo $enable_warnings | sed -e "s/-W//g"`
add_to_var([WARNINGS_ENABLED], ["$WARN_LIST"])
])
]
)
AS_IF([test .$enable_extra_warnings = .yes],
[add_to_var([WARNINGS_ENABLED], ["$WARNINGS_EXTRA"])])
if test "$enable_conversion_checks" = yes; then
# Check if we can sensibly enable -Wconversion
AC_MSG_CHECKING([for usable -Wconversion])
SAV_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wconversion -O2 -Wp,-D_FORTIFY_SOURCE=2 -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <sys/types.h>
#include <sys/select.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/socket.h>
#include <linux/rtnetlink.h>
#define VAL 255
static void
fun(uint8_t val)
{
}
int main(int argc, char**argv)
{
fd_set set;
uint8_t val = 42;
unsigned u;
bool b;
size_t size = 17;
char c[2];
char *c_ptr = c;
struct rtattr rta;
struct rtattr *rta_p = &rta;
FD_SET(argc+1, &set);
fun(argc == VAL ? VAL : val);
// vrrp->lower_prio_no_advert = vrrp->strict_mode ? true : global_data->vrrp_lower_prio_no_advert;
u = u ? true : b;
size = RTA_LENGTH(size);
c_ptr = RTA_DATA(c_ptr);
rta_p = RTA_NEXT(rta_p, size);
val = (u < 256 ) ? u & 0xff : 0;
}
]])],
[
AC_MSG_RESULT([yes])
add_to_var([WARNINGS_ENABLED], [conversion])
],
[
AC_MSG_RESULT([no])
AC_MSG_WARN([-Wconversion is not sensible with this compiler. Use --enable-force-conversion-checks to override.])
])
CFLAGS="$SAV_CFLAGS"
elif test "$enable_force_conversion_checks" = yes; then
add_to_var([WARNINGS_ENABLED], [conversion])
fi
if test "$enable_Werror" = yes; then
add_to_var([WARNINGS_ENABLED], [error])
fi
CONFIG_WARNINGS=lib/config_warnings.h.in
# Save (or restore) lib/config_warnings.h.in
AS_IF([test ! -f ${CONFIG_WARNINGS}.sav],
[cp -p ${CONFIG_WARNINGS} ${CONFIG_WARNINGS}.sav],
[cp -p ${CONFIG_WARNINGS}.sav ${CONFIG_WARNINGS}])
SAV_CFLAGS="$CFLAGS"
for WARN in $WARNINGS_ENABLED
do
AC_MSG_CHECKING([for -W$WARN])
CFLAGS="$SAV_CFLAGS -W$WARN"
WARN_VAR=_HAVE_WARNING_`echo $WARN | tr "a-z=-" "A-Z__"`_
LOCAL_WARN_VAR=HAVE_WARNING_`echo $WARN | sed -e "s/=.*//" | tr "a-z-" "A-Z_"`
grep -q "^#undef $WARN_VAR$" $CONFIG_WARNINGS
AS_IF([test $? -ne 0],
[echo -e "\n/* Define to 1 if -W$WARN in use */\n#undef $WARN_VAR" >>$CONFIG_WARNINGS]
)
test `echo $WARN | grep "=[[0-9]][[0-9]]*$"`
AS_IF([test $? -eq 0],
[ WARN_SHORT=`echo $WARN | sed -e 's/=[[0-9]][[0-9]]*$//'`
WARN_VAR_SHORT=_HAVE_WARNING_`echo $WARN_SHORT | tr "a-z=-" "A-Z__"`_
grep -q "^#undef $WARN_VAR_SHORT$" $CONFIG_WARNINGS
AS_IF([test $? -ne 0],
[echo -e "\n/* Define to 1 if -W$WARN_SHORT in use */\n#undef $WARN_VAR_SHORT" >>$CONFIG_WARNINGS]
)
],
[ unset WARN_VAR_SHORT ]
)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int main(int argc, char**argv)
{
}
]])],
[
# gcc 9 removed -Wchkp and doesn't error if it is specified,
# but rather outputs:
# warning: switch '-Wchkp' is no longer supported
# so check for the warning.
touch conftest.err
grep -q "is no longer supported" conftest.err
AS_IF([test $? -ne 0],
[
AC_MSG_RESULT([yes])
eval $LOCAL_WARN_VAR=yes
add_to_var([KA_CFLAGS], [-W$WARN])
AC_DEFINE_UNQUOTED([$WARN_VAR], [ 1 ])
AS_IF([test -z "$WARN_VAR_SHORT"], [],
[AC_DEFINE_UNQUOTED([$WARN_VAR_SHORT], [ 1 ])]
)
],
[
AC_MSG_RESULT([no])
eval $LOCAL_WARN_VAR=no
])
],
[
AC_MSG_RESULT([no])
eval $LOCAL_WARN_VAR=no
])
done
AS_IF([test .$HAVE_WARNING_STRICT_OVERFLOW = .yes],
[
# The following is not supported in gcc 5.4.0
CFLAGS="$CFLAGS -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
_Pragma("GCC diagnostic warning \"-Wstrict-overflow=1\"")
int main(int argc, char**argv)
{
}
]])],
[AC_DEFINE([_HAVE_PRAGMA_WARN_STRICT_OVERFLOW_1_], [ 1 ], [Define to 1 if _Pragma("GCC diagnostic warning \"-Wstrict-overflow=1\"") supported])
])
]
)
CFLAGS="$SAV_CFLAGS"
dnl ---- [ Do we want stricter configuration checking? ] ----
STRICT_CONFIG=No
if test "$enable_strict_config_checks" = yes; then
AC_DEFINE([_STRICT_CONFIG_], [ 1 ], [Define to 1 if want stricter configuration checking])
STRICT_CONFIG=Yes
add_config_opt([STRICT_CONFIG])
fi
AM_CONDITIONAL([WITH_STRICT_CONFIG_CHECKS], [test $STRICT_CONFIG = Yes])
if test "$enable_hardening" != no; then
AC_MSG_CHECKING([for PIE support])
SAV_CFLAGS="$CFLAGS"
SAV_LDFLAGS="$LDFLAGS"
CFLAGS="$CFLAGS -fPIE"
if test "${enable_profile}" = yes; then
# RHEL 7 and others have a problem with profiling with PIE
CFLAGS="$CFLAGS -pg"
fi
LDFLAGS="$LDFLAGS -pie"
AC_LINK_IFELSE([AC_LANG_SOURCE([[
int main(int argc, char **argv)
{
int i = 0;
}
]])],
AC_MSG_RESULT([yes])
add_to_var([KA_CFLAGS], [-fPIE])
add_to_var([KA_LDFLAGS], [-pie]),
AC_MSG_RESULT([no]))
CFLAGS=$SAV_CFLAGS
LDFLAGS=$SAV_LDFLAGS
for FLAG in \
"-Wformat -Werror=format-security" \
"-Wp,-D_FORTIFY_SOURCE=2" \
"-fexceptions" \
"-fstack-protector-strong" \
"--param=ssp-buffer-size=4" \
"-grecord-gcc-switches"
do
AC_MSG_CHECKING([for $FLAG support])
CFLAGS="$CFLAGS $FLAG"
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([[ ]])],
[AC_MSG_RESULT([yes])]
add_to_var([KA_CFLAGS], [$FLAG]),
[AC_MSG_RESULT([no])])
CFLAGS=$SAV_CFLAGS
done
WL_FLAGS=
for FLAG in \
"-z,relro" \
"-z,now"
do
AC_MSG_CHECKING([for -Wl,$FLAG support])
LDFLAGS="$LDFLAGS -Wl,$FLAG"
AC_LINK_IFELSE(
[AC_LANG_SOURCE([[
int main(int argc, char **argv)
{
int i = 0;
}
]])],
[
AC_MSG_RESULT([yes])
WL_FLAGS="$WL_FLAGS -Wl,$FLAG"
],
[AC_MSG_RESULT([no])]
)
CFLAGS=$SAV_CFLAGS
LDFLAGS=$SAV_LDFLAGS
done
if test -n "$WL_FLAGS"; then
add_to_var([KA_LDFLAGS], [$WL_FLAGS])
fi
fi
# enable-optimise
AS_IF([test "$enable_optimise" = yes -o "$enable_optimise" = not-specified], [optimise_level=2], [optimise_level=$enable_optimise])
AS_IF([test "$enable_optimise" = no], [optimise_level=0])
AS_IF([test "$optimise_level" -eq 0],
[
echo $KA_CFLAGS | $GREP -q -- "-D_FORTIFY_SOURCE=[[^0]]"
AS_IF([test $? -eq 0], [AC_MSG_WARN([--disable-optimise requires --disable-hardening])])
])
FLAG="-O$optimise_level"
AC_MSG_CHECKING([for $FLAG support])
SAV_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $FLAG"
AC_COMPILE_IFELSE(
[AC_LANG_SOURCE([[ ]])],
[AC_MSG_RESULT([yes])]
add_to_var([KA_CFLAGS], [$FLAG]),
[
AC_MSG_RESULT([no])
AS_IF([test "$enable_optimise" != not-specified], [AC_MSG_ERROR([Invalid optimisation level specified])])
])
CFLAGS=$SAV_CFLAGS
AC_SUBST(KA_CPPFLAGS)
AC_SUBST(KA_CFLAGS)
AC_SUBST(KA_LDFLAGS)
AC_SUBST(KA_LIBS)
# AC_SUBST(KA_LIBTOOLFLAGS)
# Check if unaligned memory access is supported (for ARM not supported prior to ARMv6 processors)
AC_MSG_CHECKING([for unaligned memory access])
AC_RUN_IFELSE(
[
AC_LANG_PROGRAM(
[[
#include <limits.h>
#include <endian.h>
#if __BYTE_ORDER == __BIG_ENDIAN
#if ULONG_MAX == 0xffffffffffffffffUL
#define CHK_VAL 0x1234567890abcdefUL
#elif ULONG_MAX == 0xffffffffUL
#define CHK_VAL 0x12345678UL
#else
#define CHK_VAL 0x1234UL
#endif
#elif __BYTE_ORDER == __LITTLE_ENDIAN
#if ULONG_MAX == 0xffffffffffffffffUL
#define CHK_VAL 0xefcdab9078563412UL
#elif ULONG_MAX == 0xffffffffUL
#define CHK_VAL 0x78563412UL
#else
#define CHK_VAL 0x3412UL
#endif
#else
#error Neither big nor little endian - unsupported
#endif
]],
[[
unsigned long arr[2] = { 0, 0 };
unsigned char *p = (unsigned char *)arr + 1;
unsigned i;
*(unsigned long *)p = CHK_VAL;
return !!(arr[0] == CHK_VAL || p[0] != 0x12 || p[1] != 0x34 || p[2] != 0x56);
]]
)
],
[AC_MSG_RESULT([yes])],
[
AC_MSG_RESULT([no])
AC_DEFINE([_NO_UNALIGNED_ACCESS_], [ 1 ], [Define to 1 if unaligned memory access not supported])
],
[
AC_MSG_RESULT([unknown])
AC_MSG_WARN([Cannot determine if unaligned access supported. Assuming yes.])
]
)
# Checks for libraries.
dnl clock_gettime() required -lt before glibc 2.17
AC_MSG_CHECKING([for clock_gettime() requires -lrt])
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
int main(int argc, char **argv)
{
int i;
struct timespec ts;
i = clock_gettime(CLOCK_MONOTONIC, &ts);
}
]])],
[AC_MSG_RESULT([no])],
[
SAV_LIBS="$LIBS"
LIBS="$LIBS -lrt"
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
int main(int argc, char **argv)
{
int i;
struct timespec ts;
i = clock_gettime(CLOCK_MONOTONIC, &ts);
}
]])],
[AC_MSG_RESULT([yes])]
add_to_var([KA_LIBS], [-lrt]),
[AC_MSG_ERROR([clock_gettime() not supported])])
LIBS=$SAV_LIBS
])
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/ioctl.h sys/param.h sys/prctl.h sys/socket.h sys/time.h syslog.h unistd.h],
[], [AC_MSG_ERROR([Missing/unusable system header file <$ac_header>])])
# check for kernel headers
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
dnl -- <linux/netlink.h> needed <sys/socket.h> until Linux 3.1
dnl -- using AC_CHECK_HEADER causes a horrible error message for the user
NETLINK_EXTRA_INCLUDE=
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/netlink.h>
]])], [],
[AC_CHECK_HEADER([linux/netlink.h],
[
AC_DEFINE([NETLINK_H_NEEDS_SYS_SOCKET_H], [ 1 ], [Define to 1 if <linux/netlink.h> needs <sys/socket.h>])
NETLINK_EXTRA_INCLUDE="#include <sys/socket.h>"
], [AC_MSG_ERROR([Missing/unusable kernel header file <linux/netlink.h>])],
[[#include <sys/socket.h>]])])
dnl -- <linux/rtnetlink.h> needed <sys/socket.h> until ? Linux 3.1
dnl -- using AC_CHECK_HEADER causes a horrible error message for the user
RTNETLINK_EXTRA_INCLUDE=
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/rtnetlink.h>
]])], [],
[AC_CHECK_HEADER([linux/rtnetlink.h],
[
AC_DEFINE([RTNETLINK_H_NEEDS_SYS_SOCKET_H], [ 1 ], [Define to 1 if <linux/rtnetlink.h> needs <sys/socket.h>])
RTNETLINK_EXTRA_INCLUDE="#include <sys/socket.h>"
], [AC_MSG_ERROR([Missing/unusable kernel header file <linux/rtnetlink.h>])],
[[#include <sys/socket.h>]])])
dnl -- Does linux/errqueue.h need sys/time.h?
AC_MSG_CHECKING([linux/errqueue.h needs sys/time.h])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <fcntl.h>
#include <linux/errqueue.h>
int main(int argc, char**argv)
{
}
]])],
[
AC_MSG_RESULT([no])
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([ERRQUEUE_NEEDS_SYS_TIME], [ 1 ], [Define to 1 if linux/errqueue.h needs sys/time.h])
])
AC_CHECK_HEADERS([asm/types.h linux/ethtool.h linux/icmpv6.h linux/if_ether.h linux/if_packet.h linux/ip.h linux/sockios.h linux/types.h],
[], [AC_MSG_ERROR([Missing/unusable kernel header file <$ac_header>])])
AC_CHECK_HEADERS([linux/fib_rules.h linux/if_addr.h linux/if_link.h],
[], [AC_MSG_ERROR([Missing/unusable kernel header file <$ac_header>])],
[[$NETLINK_EXTRA_INCLUDE]])
AC_CHECK_HEADERS([linux/if_arp.h],
[], [AC_MSG_ERROR([Missing/unusable <$ac_header>])],
[[#include <sys/socket.h>]])
CPPFLAGS="$SAV_CPPFLAGS"
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT64_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_C_CONST
# Checks for library functions.
AC_FUNC_FORK
# We don't want the following two, since autoconf, if malloc(0) returns NULL, refines malloc as rpl_malloc
# and we have to provide our own rpl_malloc() and likewise rpl_realloc() functions.
# keepalived doesn't do 0 length malloc()s so it is not an issue.
# We add malloc and realloc to AC_CHECK_FUNCS instead.
#AC_FUNC_MALLOC
#AC_FUNC_REALLOC
AC_CHECK_FUNCS([dup2 getcwd gettimeofday malloc memmove memset realloc select setenv socket strcasecmp strchr strdup strerror strpbrk strstr strtol strtoul uname])
dnl - pipe2() since Linux 2.6.27 and glibc 2.9.
AC_CHECK_FUNCS([pipe2], [add_system_opt([PIPE2])])
dnl - signalfd() since Linux 2.6.22 and glibc 2.8
AC_CHECK_FUNCS([signalfd], [add_system_opt([SIGNALFD])])
dnl - inotify_init1() since Linux 2.6.27
AC_CHECK_FUNCS([inotify_init1], [add_system_opt([INOTIFY_INIT1])])
dnl - vsyslog() Not defined by Posix, but available in glibc and musl
AC_CHECK_FUNCS([vsyslog], [add_system_opt([VSYSLOG])])
dnl - epoll_create1() since Linux 2.6.27 and glibc 2.9
AC_CHECK_FUNCS([epoll_create1], [add_system_opt([EPOLL_CREATE1])])
# glibc uses unsigned int as 3rd parameter to __assert_fail(), musl uses int.
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <assert.h>
#include <stdlib.h>
void __assert_fail(const char * a, const char *b, unsigned int l, const char *c)
{
exit(a[0] + b[0] + c[0] + l == 0);
}
]])],
[LINE_type="unsigned int"], [LINE_type="int"])
AC_DEFINE_UNQUOTED([LINE_type], [ $LINE_type ], [The type of parameter __line passed to __assert_fail()])
dnl Check if libc supports __always_inline
dnl See glibc sys/cdefs.h definition of __always_inline and comment
SAV_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wattributes -Werror"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
static __always_inline int
test_func(int val)
{
return val;
}
int
main(int argc, char **argv)
{
int val = test_func(3);
return val;
}
]])],
[],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
static __inline __attribute__ ((__always_inline__)) int
test_func(int val)
{
return val;
}
int
main(int argc, char **argv)
{
int val = test_func(3);
return val;
}
]])],
[AC_DEFINE([__always_inline], [__inline __attribute__ ((__always_inline__))], [Define __always_inline if libc does not define it])],
[AC_DEFINE([__always_inline], [inline], [Define __always_inline if libc does not define it])]
)])
CFLAGS="$SAV_CFLAGS"
dnl - Do we want to override dynamic/static linking?
AS_IF([test "$enable_dynamic_linking"],
[
AS_IF([test .$enable_vrrp != .no],
[
enable_libiptc_dynamic=$enable_dynamic_linking
enable_libipset_dynamic=$enable_dynamic_linking
])
AS_IF([test .$enable_lvs != .no],
[
enable_libnl_dynamic=$enable_dynamic_linking
])
])
# check for missing definition - added in glibc 2.8
AC_CHECK_DECLS([ETHERTYPE_IPV6], [],
[
AC_DEFINE([ETHERTYPE_IPV6], [0x86dd], [Defined here if not found in <net/ethernet.h>.])
],
[[#include <net/ethernet.h>]])
BUILD_GENHASH=Yes
dnl ----[ Checks for openssl ]----
# check for openssl headers
NEED_MD5=no
NEED_SSL=no
if test "$enable_vrrp" != no -a \
"$enable_vrrp_auth" != no; then
NEED_MD5=yes
fi
if test "$enable_lvs" != no; then
NEED_MD5=yes
NEED_SSL=yes
fi
AC_CHECK_HEADERS([openssl/ssl.h openssl/err.h], [],
[
if test $NEED_SSL = yes; then
AC_MSG_ERROR([
!!! OpenSSL is not properly installed on your system. !!!
!!! Can not include OpenSSL headers files. !!!])
fi
BUILD_GENHASH=No
NEED_SSL=no
break
])
AC_CHECK_HEADERS([openssl/md5.h], [],
[
if test $NEED_MD5 = yes; then
AC_MSG_ERROR([
!!! OpenSSL is not properly installed on your system. !!!
!!! Can not include OpenSSL MD5 headers files. !!!])
fi
BUILD_GENHASH=No
NEED_MD5=no
break
])
unset LIBS
$PKG_CONFIG --exists openssl
if test $? -eq 0; then
add_pkg_config([openssl], [OPENSSL])
else
OPENSSL_LIBS="-lssl -lcrypto"
fi
EXTRA_LIBS=`echo $OPENSSL_LIBS | sed -e "s/-lcrypto//"`
AC_CHECK_LIB(crypto, MD5_Init, [],
[
if test $NEED_MD5 = yes; then
AC_MSG_ERROR([OpenSSL MD5 libraries are required])
fi
BUILD_GENHASH=No
], [$EXTRA_LIBS])
if test $NEED_MD5 = yes; then
add_to_var([KA_LIBS], [$LIBS])
fi
add_to_var([GENHASH_LIBS], [$LIBS])
unset LIBS
EXTRA_LIBS=`echo $OPENSSL_LIBS | sed -e "s/-lssl//"`
AC_CHECK_LIB(ssl, SSL_CTX_new, [],
[
if test $NEED_SSL = yes; then
AC_MSG_ERROR([OpenSSL libraries are required])
fi
BUILD_GENHASH=No
], [$EXTRA_LIBS])
if test $NEED_SSL = yes; then
add_to_var([KA_LIBS], [$LIBS])
fi
add_to_var([GENHASH_LIBS], [$LIBS])
unset LIBS
# Introduced in OpenSSL ver 0.9.9
LIBS=$OPENSSL_LIBS
AC_MSG_CHECKING([SSL_set_tlsext_host_name() - may be a definition])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <openssl/ssl.h>
int main(void)
{
request_t req;
SSL_set_tlsext_host_name(req.ssl, "SSL");
}
]])], [
AC_MSG_RESULT([no])
], [
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_SSL_SET_TLSEXT_HOST_NAME_], [ 1 ], [Define to 1 if have SSL_set_tlsext_host_name()])
])
# SSL_CTX_set_verify_depth() introduced OpenSSL v0.9.5a
AC_CHECK_FUNCS([SSL_CTX_set_verify_depth])
# SSL_set0_rbio(), SSL_set0_wbio() OPENSSL_init_crypto() and TLS_method() introduced OpenSSL v1.1.0
AC_CHECK_FUNCS([SSL_set0_rbio OPENSSL_init_crypto TLS_method])
# In OpenSSL v1.1.1 the call to SSL_CTX_new() fails if OPENSSL_init_crypto() has been called with
# OPENSSL_INIT_NO_LOAD_CONFIG. It does not fail in v1.1.0h and v1.1.1b.
AS_IF([test .$ac_cv_func_OPENSSL_init_crypto = .yes],
[
AS_IF([test .$ac_cv_func_TLS_method = .yes], [method_func=TLS_method], [method_func=SSLv23_method])
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <openssl/ssl.h>]],
[[
const SSL_METHOD *meth;
SSL_CTX *ctx;
if (!OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL))
return 1;
/* Initialize SSL context */
meth = $method_func();
if (!(ctx = SSL_CTX_new(meth)))
return 1;
return 0;
]])],
[openssl_init_no_load_bug=0],
[openssl_init_no_load_bug=1],
[
AC_MSG_WARN([Cannot determine if need to OPENSSL_init_crypto() problem. Assuming yes for safety.])
openssl_init_no_load_bug=1
]
)
AS_IF([test $openssl_init_no_load_bug -eq 1],
[AC_DEFINE([HAVE_OPENSSL_INIT_NO_LOAD_CONFIG_BUG], [ 1 ], [Define to 1 if OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG) bug)])])
])
unset LIBS
if test $BUILD_GENHASH = No; then
AC_MSG_NOTICE([Unable to build genhash due to missing openssl headers/libraries])
GENHASH_LIBS=
fi
AC_SUBST([GENHASH_LIBS])
AM_CONDITIONAL([BUILD_GENHASH], [test $BUILD_GENHASH = Yes])
dnl ----[ Check for IPv4 devconf netlink support ]----
IPV4_DEVCONF=No
if test .$enable_vrrp != .no; then
dnl ----[Check have IPV4_DEVCONF defines - since Linux 3.11]----
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
IPV4_DEVCONF=Yes
AC_CHECK_DECLS([
IPV4_DEVCONF_ARP_IGNORE,
IPV4_DEVCONF_ACCEPT_LOCAL,
IPV4_DEVCONF_RP_FILTER,
IPV4_DEVCONF_ARPFILTER],
[],
[
IPV4_DEVCONF=No
break
],
[[#include <linux/ip.h>]])
if test $IPV4_DEVCONF = Yes; then
AC_DEFINE([_HAVE_IPV4_DEVCONF_], [ 1 ], [Define to 1 if have IPv4 netlink device configuration])
add_system_opt([IPV4_DEVCONF])
fi
AC_CHECK_HEADERS([linux/rtnetlink.h], [], [AC_MSG_ERROR([Unusable linux/rtnetlink.h])], [$RTNETLINK_EXTRA_INCLUDE])
CPPFLAGS="$SAV_CPPFLAGS"
fi
dnl ----[ Check for IPv6 Advanced API (RFC3542) - since Linux 2.6.14 ]----
IPV6_ADVANCED_API=No
AC_CHECK_DECLS([
IPV6_RECVHOPLIMIT,
IPV6_RECVPKTINFO],
[IPV6_ADVANCED_API=Yes],
[],
[[#include <netinet/ip6.h>]])
AS_IF([test $IPV6_ADVANCED_API = Yes], [add_system_opt([IPV6_ADVANCED_API])])
dnl ----[ Checks for libraries ]----
NETLINK_VER=0
IPVS_USE_NL=No
if test .$enable_lvs != .no -a .${enable_libnl} != .no; then
$PKG_CONFIG --exists libnl-3.0
if test $? -eq 0; then
add_pkg_config([libnl-3.0], [NL3], [remove-requires])
AC_CHECK_LIB($NL3_LIB_NAMES, nl_socket_alloc,
[
NETLINK_VER=3
AC_DEFINE([_HAVE_LIBNL3_], [ 1 ], [Define to 1 if using libnl-3])
add_system_opt([LIBNL3])
if test .$enable_libnl_dynamic = .yes; then
add_system_opt([LIBNL_DYNAMIC])
add_pkg_config_without_libs([libnl-3.0])
AC_DEFINE([_LIBNL_DYNAMIC_], [ 1 ], [Define to 1 if building with libnl dynamic linking])
NEED_LIBDL=Yes
get_lib_name([$NL3_LIB_NAMES], [nl_socket_alloc])
AC_DEFINE_UNQUOTED([NL3_LIB_NAME], [ "$LIB_NAME" ], [Define the nl-3 library name])
else
add_pkg_config([libnl-3.0])
fi
add_pkg_config([libnl-genl-3.0], [GENL], [remove-requires])
AC_CHECK_LIB($GENL_LIB_NAMES, genl_connect, [],
[AC_MSG_ERROR([libnl-3 is installed but not libnl-gen-3. Please, install libnl-gen-3/libnl-genl-3.])],
[$NL3_LIBS])
IPVS_USE_NL=Yes
if test .$enable_libnl_dynamic = .yes; then
add_pkg_config_without_libs([libnl-genl-3.0])
get_lib_name([$GENL_LIB_NAMES], [genl_connect])
AC_DEFINE_UNQUOTED([NL3_GENL_LIB_NAME], [ "$LIB_NAME" ], [Define the nl-genl-3.0 library name])
else
add_pkg_config([libnl-genl-3.0])
fi
], [])
fi
if test $NETLINK_VER -eq 0; then
AC_CHECK_LIB(nl, nl_socket_modify_cb,
[
IPVS_USE_NL=Yes
NETLINK_VER=1
AC_DEFINE([_HAVE_LIBNL1_], [ 1 ], [Define to 1 if using libnl-1])
add_system_opt([LIBNL1])
if test .$enable_libnl_dynamic = .yes; then
add_pkg_config_without_libs([libnl-1])
add_config_opt([LIBNL_DYNAMIC])
AC_DEFINE([_LIBNL_DYNAMIC_], [ 1 ], [Define to 1 if building with libnl dynamic linking])
NEED_LIBDL=Yes
get_lib_name([nl], [nl_socket_modify_cb])
AC_DEFINE_UNQUOTED([NL_LIB_NAME], [ "$LIB_NAME" ], [Define the nl library name])
else
add_pkg_config([libnl-1])
fi
],
[AC_MSG_WARN([keepalived will be built without libnl support.])
])
fi
if test $NETLINK_VER -ne 0; then
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernel_inc $NL3_CPPFLAGS"
AC_CHECK_HEADERS([netlink/netlink.h], [], [AC_MSG_ERROR([netlink headers missing])])
AC_CHECK_HEADERS([netlink/genl/ctrl.h netlink/genl/genl.h], [], [AC_MSG_ERROR([netlink genl headers missing])])
CPPFLAGS="$SAV_CPPFLAGS"
fi
fi
AM_CONDITIONAL([LIBNL1], [test $NETLINK_VER -eq 1])
AM_CONDITIONAL([LIBNL3], [test $NETLINK_VER -eq 3])
AM_CONDITIONAL([LIBNL_DYNAMIC], [test .$enable_lvs != .no -a .$enable_libnl_dynamic = .yes -a $NETLINK_VER -ne 0])
unset LIBS
AC_CHECK_LIB(magic, magic_open,
[
AC_DEFINE([_HAVE_LIBMAGIC_], [ 1 ], [Define to 1 if have magic library])
add_to_var([KA_LIBS], [-lmagic])
])
unset LIBS
dnl -- Check for the following variables introduced at various times into Linux
dnl --FRA_OIFNAME dnl -- Linux 2.6.33
dnl --RTAX_QUICKACK dnl -- Linux 3.11
dnl --FRA_SUPPRESS_PREFIXLEN dnl -- Linux 3.12
dnl --FRA_SUPPRESS_IFGROUP dnl -- Linux 3.12
dnl --RTAX_CC_ALGO dnl -- Linux 4.0
dnl --RTA_VIA dnl -- Linux 4.1
dnl --RTA_NEWDST dnl -- Linux 4.1
dnl --RTA_PREF dnl -- Linux 4.1
dnl --FRA_TUN_ID dnl -- Linux 4.3
dnl --RTA_ENCAP dnl -- Linux 4.3
dnl --RTEXT_FILTER_SKIP_STATS dnl -- Linux 4.4
dnl --RTA_EXPIRES dnl -- Linux 4.5
dnl --FRA_L3MDEV dnl -- Linux 4.8
dnl --FRA_UID_RANGE dnl -- Linux 4.10
dnl --RTAX_FASTOPEN_NO_COOKIE dnl -- Linux 4.15
dnl --FRA_PROTOCOL dnl -- Linux 4.17
dnl --FRA_IP_PROTO dnl -- Linux 4.17
dnl --FRA_SPORT_RANGE dnl -- Linux 4.17
dnl --FRA_DPORT_RANGE dnl -- Linux 4.17
dnl --RTA_TTL_PROPAGATE dnl -- Linux 4.12
AC_CHECK_DECLS([RTA_ENCAP, RTA_EXPIRES, RTA_NEWDST, RTA_PREF, FRA_SUPPRESS_PREFIXLEN, FRA_SUPPRESS_IFGROUP, FRA_TUN_ID, RTAX_CC_ALGO, RTAX_QUICKACK, RTEXT_FILTER_SKIP_STATS, FRA_L3MDEV, FRA_UID_RANGE, RTAX_FASTOPEN_NO_COOKIE, RTA_VIA, FRA_OIFNAME, FRA_PROTOCOL, FRA_IP_PROTO, FRA_SPORT_RANGE, FRA_DPORT_RANGE, RTA_TTL_PROPAGATE], [], [],
[[$RTNETLINK_EXTRA_INCLUDES
#include <linux/rtnetlink.h>
#include <sys/socket.h>
#include <linux/fib_rules.h>]])
for flag in RTA_ENCAP RTA_EXPIRES RTA_NEWDST RTA_PREF FRA_SUPPRESS_PREFIXLEN FRA_SUPPRESS_IFGROUP FRA_TUN_ID RTAX_CC_ALGO RTAX_QUICKACK RTEXT_FILTER_SKIP_STATS FRA_L3MDEV FRA_UID_RANGE RTAX_FASTOPEN_NO_COOKIE RTA_VIA FRA_OIFNAME FRA_PROTOCOL FRA_IP_PROTO FRA_SPORT_RANGE FRA_DPORT_RANGE RTA_TTL_PROPAGATE; do
AS_VAR_COPY([decl_var], [ac_cv_have_decl_$flag])
if test ${decl_var} = yes; then
add_system_opt[${flag}]
fi
done
dnl - Introduced in Linux 3.14
AC_CHECK_DECLS([IFA_FLAGS], [], [], [[#include <linux/if_addr.h>]])
for flag in IFA_FLAGS; do
AS_VAR_COPY([decl_var], [ac_cv_have_decl_$flag])
if test ${decl_var} = yes; then
add_system_opt[${flag}]
fi
done
dnl - Introduced in Linux 2.6.31, but not until glibc 2.17
AC_CHECK_DECLS([IP_MULTICAST_ALL],
[
add_system_opt[IP_MULTICAST_ALL]
# Check if definition is in netinet/in.h, since we can't include linux/in.h
# due to conflicting definitions
AC_LINK_IFELSE(
[
AC_LANG_SOURCE(
[[
#include <netinet/in.h>
int main(int argc, char **argv)
{
int i = IP_MULTICAST_ALL;
}
]])
],
[],
[
# No - netinet/in.h doesn't have IP_MULTICAST_ALL
# Build a program that will output the value of the kernel's IP_MULTICAST_ALL
AC_LINK_IFELSE(
[
AC_LANG_SOURCE(
[[
#include <sys/socket.h>
#include <linux/in.h>
#include <stdio.h>
int main(int argc, char **argv)
{
printf("%d\n", IP_MULTICAST_ALL);
}
]])
],
[
# Create local definition of IP_MULTICAST_ALL
IMA=$(./conftest$EXEEXT)
AC_DEFINE_UNQUOTED([IP_MULTICAST_ALL], [ $IMA ], [Defined to value in <linux/in.h> if not in <netinet/in.h>])
])
]
)
],
[],
[[
#include <sys/socket.h>
#include <linux/in.h>
]])
dnl -- RedHat backported ENCAP_IP and ENCAP_IP6 without MPLS and ILA
AS_IF([test $ac_cv_have_decl_RTA_ENCAP = yes],
[
AC_CHECK_DECLS([LWTUNNEL_ENCAP_MPLS, LWTUNNEL_ENCAP_ILA], [], [],
[[#include <linux/lwtunnel.h>]])
for flag in LWTUNNEL_ENCAP_MPLS LWTUNNEL_ENCAP_ILA; do
AS_VAR_COPY([decl_var], [ac_cv_have_decl_$flag])
if test ${decl_var} = yes; then
add_system_opt([${flag}])
fi
done
])
dnl ----[Check for iptables libraries]----
USE_IPTABLES=No
USE_LIBIPSET=No
AS_IF([test .$enable_iptables != .no],
[
USE_IPTABLES=Yes
dnl -- linux/netfilter/x_tables.h since Linux 2.6.16
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_CHECK_HEADERS([linux/netfilter/x_tables.h libiptc/libip6tc.h libiptc/libiptc.h libiptc/libxtc.h], [],
[
USE_IPTABLES=No
break
])
CPPFLAGS="$SAV_CPPFLAGS"
if test $USE_IPTABLES = Yes; then
PKG_CONFIG_IP4TC=Yes
$PKG_CONFIG --exists libip4tc
AS_IF([test $? -eq 0],
[
add_pkg_config([--static libip4tc], [IP4TC], [remove-requires])
add_pkg_config([--static libip6tc], [IP6TC], [remove-requires])
IPTC_LIBS="$IP4TC_LIBS $IP6TC_LIBS"
IPTC_LIB_NAMES="$IP4TC_LIB_NAMES $IP6TC_LIB_NAMES"
],
[
PKG_CONFIG_IP4TC=No
add_pkg_config([--static libiptc], [IPTC], [remove-requires])
])
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_SEARCH_LIBS(iptc_init, $IPTC_LIB_NAMES,
[
if test .${enable_libiptc_dynamic} != .yes; then
AS_IF([test $PKG_CONFIG_IP4TC = Yes],
[
add_pkg_config([--static libip4tc])
add_pkg_config([--static libip6tc])
],
[add_pkg_config([--static libiptc])])
dnl - Older versions of libiptc produced a requirement for -liptc, but we don't need it
KA_LIBS=`echo $KA_LIBS | sed -e "s/ -liptc//"`
dnl - Even older versions of libiptc don't produce any requirement other than -liptc
IPTC_LIBS=`echo $IPTC_LIBS | sed -e "s/ *-L[[^ ]]* */ /" -e "s/ *-liptc */ /" -e "s/^ *$//"`
if test ".$IPTC_LIBS" = .; then
KA_LIBS="$KA_LIBS -lip4tc -lip6tc"
fi
else
AS_IF([test $PKG_CONFIG_IP4TC = Yes],
[
add_pkg_config_without_libs([libip4tc])
add_pkg_config_without_libs([libip6tc])
],
[
add_pkg_config_without_libs([libiptc])
])
add_config_opt([LIBIPTC_DYNAMIC])
AC_DEFINE([_LIBIPTC_DYNAMIC_], [ 1 ], [Define to 1 if building with libiptc dynamic linking])
NEED_LIBDL=Yes
AC_SEARCH_LIBS(ip6tc_init, $IPTC_LIB_NAMES)
IP4TC_NAME=`echo $ac_cv_search_iptc_init | sed -e "s/-l//"`
IP6TC_NAME=`echo $ac_cv_search_ip6tc_init | sed -e "s/-l//"`
get_lib_name([$IP4TC_NAME], [iptc_init])
AC_DEFINE_UNQUOTED([IP4TC_LIB_NAME], [ "$LIB_NAME" ], [Define the ip4tc library name])
get_lib_name([$IP6TC_NAME], [ip6tc_init])
AC_DEFINE_UNQUOTED([IP6TC_LIB_NAME], [ "$LIB_NAME" ], [Define the ip6tc library name])
LIBIPTC_DYNAMIC=Yes
fi
],
[USE_IPTABLES=No])
CPPFLAGS="$SAV_CPPFLAGS"
fi
if test $USE_IPTABLES = Yes; then
dnl ----[Check for ipset libraries]----
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
if test "${enable_libipset}" != no; then
$PKG_CONFIG --exists libipset
if test $? -eq 0; then
add_pkg_config([libipset], [IPSET], [remove-requires])
else
IPSET_LIBS="-lipset"
IPSET_LIB_NAMES=ipset
fi
SAV_LIBS=$LIBS
AC_SEARCH_LIBS(ipset_session_init, $IPSET_LIB_NAMES,
[
USE_LIBIPSET=Yes
AC_CHECK_HEADERS([libipset/data.h libipset/linux_ip_set.h libipset/session.h libipset/types.h], [],
[
USE_LIBIPSET=No
break
])
if test $USE_LIBIPSET = Yes; then
dnl -- Need to use <libipset/linux_ip_set.h> for <linux/netfilter/xt_set.h> prior to Linux 3.4
EXTRA_INCLUDE=
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/netfilter/xt_set.h>
]])],
[AC_CHECK_HEADERS([linux/netfilter/xt_set.h], [], [USE_LIBIPSET=No], [])],
[AC_CHECK_HEADER([linux/netfilter/xt_set.h],
[
AC_DEFINE([USE_LIBIPSET_LINUX_IP_SET_H], [ 1 ], [Define to 1 if <linux/netfilter/xt_set.h> needs <libipset/linux_ip_set.h>])
EXTRA_INCLUDE="#include <libipset/linux_ip_set.h>"
], [USE_LIBIPSET=No],
[[#include <libipset/linux_ip_set.h>]])
]
)
fi
if test $USE_LIBIPSET = Yes; then
AC_DEFINE([_HAVE_LIBIPSET_], [ 1 ], [Define to 1 if have ipset library])
$PKG_CONFIG --exists libipset
if test $? -eq 0; then
if test .${enable_libipset_dynamic} = .no; then
add_pkg_config([libipset])
else
add_pkg_config_without_libs([libipset])
fi
elif test .${enable_libipset_dynamic} = .no; then
add_to_var([KA_LIBS], [$ac_cv_search_ipset_session_init])
fi
if test .${enable_libipset_dynamic} != .no; then
AC_DEFINE([_LIBIPSET_DYNAMIC_], [ 1 ], [Define to 1 if building with libipset dynamic linking])
add_config_opt([LIBIPSET_DYNAMIC])
NEED_LIBDL=Yes
LIBIPSET_NAME=`echo $ac_cv_search_ipset_session_init | sed -e "s/-l//"`
get_lib_name([$LIBIPSET_NAME], [ipset_session_init])
AC_DEFINE_UNQUOTED([IPSET_LIB_NAME], [ "$LIB_NAME" ], [Define the ipset library name])
else
add_config_opt([LIBIPSET])
fi
dnl -- xt_set_info_match first introduced in Linux 2.6.39 (initial implementation of ipsets)
dnl -- xt_set_info_match_v1 declared since Linux 3.1
AC_CHECK_MEMBER([struct xt_set_info_match_v1.match_set.index], [AC_DEFINE([HAVE_XT_SET_INFO_MATCH_V1], [ 1 ], [Define to 1 if have struct xt_set_info_match_v1])], [],
[
$EXTRA_INCLUDE
#include <linux/netfilter/xt_set.h>
])
dnl -- xt_set_info_match_v3 declared since Linux 3.10
AC_CHECK_MEMBER([struct xt_set_info_match_v3.match_set.index], [AC_DEFINE([HAVE_XT_SET_INFO_MATCH_V3], [ 1 ], [Define to 1 if have struct xt_set_info_match_v3])], [],
[
$EXTRA_INCLUDE
#include <linux/netfilter/xt_set.h>
])
dnl -- xt_set_info_match_v4 declared since Linux 3.19
AC_CHECK_MEMBER([struct xt_set_info_match_v4.match_set.index], [AC_DEFINE([HAVE_XT_SET_INFO_MATCH_V4], [ 1 ], [Define to 1 if have struct xt_set_info_match_v4])], [],
[
$EXTRA_INCLUDE
#include <linux/netfilter/xt_set.h>
])
dnl - ipset type iface introduced in Linux 3.1
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/netfilter/ipset/ip_set.h>
int main(void) { int var = IPSET_ATTR_IFACE; }
]])],
[AC_DEFINE([HAVE_IPSET_ATTR_IFACE], [ 1 ], [Define to 1 if ipset supports iface type])])
dnl - The include guard for <linux/netfilter/ipset/ip_set.h> has the leading _UAPI remove when
dnl - the source code is processed to produce the actual header files.
dnl - Unfortunately libipset provides a copy of the kernel headers, as <libipset/linux_ip_set*.h>,
dnl - but it doesn't remove the _UAPI from the header files when installing them.
dnl - Unfortunately we need to include some libipset header files, which include the
dnl - libipset version, and also <linux/netfilter/xt_set.h> which includes the kernel version.
dnl - To get around this problem, after include one of these we need to define the header guard
dnl - for the other, to stop it being included as well.
dnl - This is reported as a bug against ipset at https://bugzilla.netfilter.org/show_bug.cgi?id=1139
dnl - We will take the kernel version if there is an inclusion collision.
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/netfilter/ipset/ip_set.h>
#include <libipset/linux_ip_set.h>
int main(void) {}
]])], [],
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/netfilter/ipset/ip_set.h>
#ifdef _UAPI_IP_SET_H
#error _UAPI_IP_SET_H defined
#endif
int main(void) {}
]])],
[AC_DEFINE([LIBIPSET_H_ADD_UAPI_IP_SET_H_GUARD], [1], [Define to add guard _UAPI_IP_SET_H before including <libipset/linux_ip_set.h>])],
[AC_DEFINE([LIBIPSET_H_ADD_IP_SET_H_GUARD], [1], [Define to add guard _IP_SET_H before including <libipset/linux_ip_set.h>])])
])
fi
if test $USE_LIBIPSET = Yes; then
AC_MSG_CHECKING([for libipset version 7 or later])
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
[[
#include <libipset/session.h>
void test_func(void)
{
ipset_session_init(NULL, NULL);
}
]])],
[
AC_MSG_RESULT([yes])
],
[
AC_MSG_RESULT([no])
AC_DEFINE([LIBIPSET_PRE_V7_COMPAT], [ 1 ], [Define to 1 if libipset library version prior to v7])
add_system_opt[LIBIPSET_PRE_V7]
])
fi
])
LIBS="$SAV_LIBS"
fi
dnl -- XT_EXTENSION_MAXNAMELEN not defined until Linux 2.6.35
AC_CHECK_DECL([XT_EXTENSION_MAXNAMELEN], [],
[AC_DEFINE([XT_EXTENSION_MAXNAMELEN], [ (XT_FUNCTION_MAXNAMELEN - 1) ], [Define if <linux/netfilter/x_tables.h> doesnt define it])],
[#include <linux/netfilter/x_tables.h>])
CPPFLAGS="$SAV_CPPFLAGS"
fi
if test $USE_IPTABLES = Yes; then
AC_DEFINE([_WITH_IPTABLES_], [ 1 ], [Define to 1 if want iptables support])
add_system_opt([IPTABLES])
fi
])
AM_CONDITIONAL([LIBIPSET], [test $USE_LIBIPSET = Yes])
AM_CONDITIONAL([IPTABLES], [test $USE_IPTABLES = Yes])
AM_CONDITIONAL([LIBIPTC_DYNAMIC], [test $USE_IPTABLES = Yes -a .$LIBIPTC_DYNAMIC = .Yes])
AM_CONDITIONAL([LIBIPSET_DYNAMIC], [test $USE_LIBIPSET = Yes -a .${enable_libipset_dynamic} != .no])
unset LIBS
dnl ----[Check for nftables libraries]----
USE_NFTABLES=No
if test .${enable_nftables} != .no; then
USE_NFTABLES=Yes
dnl -- linux/netfilter/nf_tables.h since Linux 3.13
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_CHECK_DECL([NFTA_TABLE_MAX], [],
[
AS_IF([test .${enable_nftables} = .yes], [AC_MSG_ERROR([nftables header files missing/not useable])])
USE_NFTABLES=No
],
[#include <linux/netfilter/nf_tables.h>])
if test $USE_NFTABLES = Yes; then
$PKG_CONFIG --exists libnftnl
if test $? -ne 0; then
USE_NFTABLES=No
AC_MSG_WARN([libnftnl missing])
fi
$PKG_CONFIG --exists libmnl
if test $? -ne 0; then
USE_NFTABLES=No
AC_MSG_WARN([libmnl missing])
fi
if test $USE_NFTABLES = Yes; then
# nft prior to version 0.8.3 does not support type ifname in sets. We can't check the version of
# nft, but we can check the version of libnftnl. nft v0.8.3 required libnftnl v1.0.9, but so did
# nft v0.8.2. So play safe, and require the next version.
LIBNFTNL_VERSION=`printf "0x%2.2x%2.2x%2.2xU" \`pkg-config --modversion libnftnl | sed -e "s/\./ /g"\``
AC_DEFINE_UNQUOTED([LIBNFTNL_VERSION], [ $LIBNFTNL_VERSION ], [libnftnl version in hex])
add_pkg_config([libnftnl])
add_pkg_config([libmnl])
AC_DEFINE([_WITH_NFTABLES_], [ 1 ], [Define to 1 if want nftables support])
add_config_opt([NFTABLES])
AC_MSG_CHECKING([whether NFTNL_EXPR_LOOKUP_FLAGS and NFT_LOOKUP_F_INV are defined])
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h> // libnftnl/expr.h requires this
#include <libnftnl/expr.h>
#include <linux/netfilter/nf_tables.h>
int main(void)
{
int i = NFTNL_EXPR_LOOKUP_FLAGS | NFT_LOOKUP_F_INV;
return 0;
}
]])], [
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_NFTNL_EXPR_LOOKUP_FLAG_INV], [ 1 ], [Define to 1 if NFTNL_EXPR_LOOKUP_FLAGS and NFT_LOOKUP_F_INV defined])
],[
AC_MSG_RESULT(no)
])
# nft dup from Linux 4.3
AC_CHECK_DECLS([NFTA_DUP_MAX], [], [],
[#include <linux/netfilter/nf_tables.h>])
# NFT_USERDATA_MAXLEN since Linux 3.15. Check nftnl_udata_buf_alloc for libnftnl support of userdata
USE_NFT_USERDATA=Yes
AC_CHECK_DECLS([NFT_USERDATA_MAXLEN, nftnl_udata_buf_alloc],
[], [USE_NFT_USERDATA=No],
[
#include <linux/netfilter/nf_tables.h>
#include <libnftnl/udata.h>
]
)
AS_IF([test $USE_NFT_USERDATA = Yes],
[
AC_DEFINE([HAVE_NFTNL_UDATA], [ 1 ], [Define to 1 if have nftnl udata support])
AC_CHECK_DECLS([nftnl_udata_put_u32],
[], [],
[
#include <linux/netfilter/nf_tables.h>
#include <libnftnl/udata.h>
])
])
fi
fi
CPPFLAGS="$SAV_CPPFLAGS"
fi
AM_CONDITIONAL([NFTABLES], [test $USE_NFTABLES = Yes])
unset LIBS
AS_IF([test $USE_IPTABLES = Yes -o $USE_NFTABLES = Yes], [AC_DEFINE([_WITH_FIREWALL_], [ 1 ], [Define to 1 if using iptables or nftables])])
AM_CONDITIONAL([FIREWALL], [test $USE_IPTABLES = Yes -o $USE_NFTABLES = Yes])
dnl ----[Check if have linux/if.h and net/if.h namespace collision]----
# Including <linux/if.h> and <net/if.h> can cause a namespace collision.
# Later versions of the headers are OK if linux/if.h is included second
AC_MSG_CHECKING([for linux/if.h and net/if.h namespace collision])
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/if.h>
#include <net/if.h>
]])],
[
AC_MSG_RESULT([no])
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_NET_LINUX_IF_H_COLLISION_], [ 1 ], [Define to 1 if have linux/if.h followed by net/if.h namespace collision])
add_system_opt([NET_LINUX_IF_H_COLLISION])
])
CPPFLAGS="$SAV_CPPFLAGS"
dnl ----[Check if linux/if_ether.h then netinet/in.h then linux/if.h namespace collision]----
# This issue was resolved in Linux 4.15.7/4.16
AC_MSG_CHECKING([for linux/if_ether.h then netinet/in.h then linux/if.h namespace collision])
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/if_ether.h>
#include <netinet/in.h>
#include <linux/in.h>
]])],
[
AC_MSG_RESULT([no])
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_LINUX_IF_ETHER_H_COLLISION_], [ 1 ], [Define to 1 if have linux/if_ether.h then netinet/in.h then linux/in.h namespace collision])
add_system_opt([NET_LINUX_IF_ETHER_H_COLLISION])
])
CPPFLAGS="$SAV_CPPFLAGS"
dnl ----[Check if have linux/if_ether.h and netinet/if_ether.h namespace collision]----
# Including <linux/if_ether.h> and <netinet/if_ether.h> causes a namespace collision
# with musl libc, but the collision only occurs if linux/ip_ether.h is included
# before netinet/if_ether.h. The problem is that we want to include them in that
# order.
AC_MSG_CHECKING([for linux/if_ether.h then netinet/if_ether.h namespace collision])
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/if_ether.h>
#include <netinet/if_ether.h>
]])],
[
AC_MSG_RESULT([no])
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_NETINET_LINUX_IF_ETHER_H_COLLISION_], [ 1 ], [Define to 1 if have linux/if_ether.h then netinet/if_ether.h namespace collision])
add_system_opt([NETINET_LINUX_IF_ETHER_H_COLLISION])
])
CPPFLAGS="$SAV_CPPFLAGS"
# Linux 4.5 to 4.5.4 has <libiptc/libiptc.h> indirectly including <net/if.h>
# and <linux/if.h> which causes a namespace collision.
AC_MSG_CHECKING([for libiptc/libiptc.h linux/if.h and net/if.h namespace collision])
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <libiptc/libiptc.h>
]])],
[
AC_MSG_RESULT([no])
],
[
AC_MSG_RESULT([yes])
AC_DEFINE([_HAVE_LIBIPTC_LINUX_NET_IF_H_COLLISION_], [ 1 ], [Define to 1 if have libiptc/libiptc.h linux/if.h and net/if.h namespace collision])
add_system_opt([LIBIPTC_LINUX_NET_IF_H_COLLISION])
])
CPPFLAGS="$SAV_CPPFLAGS"
dnl ----[ Checks for LVS, VRRP and BFD support ]----
IPVS_SYNCD_ATTRIBUTES=No
IPVS_64BIT_STATS=No
WITH_REGEX=No
ENABLE_REGEX_DEBUG=No
if test "$enable_lvs" != no; then
IPVS_SUPPORT=Yes
add_config_opt([LVS])
AC_DEFINE([_WITH_LVS_], [ 1 ], [Define to 1 if have IPVS support])
dnl -- <linux/ip_vs.h> exists from Linux 2.6.27; prior to that <net/ip_vs.h> is used
AC_CHECK_HEADERS([linux/ip_vs.h],
[
dnl -- From Linux 2.6.35 (but CentOS has it in 2.6.32)
AC_CHECK_DECLS([IP_VS_SVC_F_ONEPACKET], [], [],
[[#include <linux/ip_vs.h>]])
])
if test $IPVS_USE_NL = Yes; then
AC_DEFINE([LIBIPVS_USE_NL], [ 1 ], [Define to 1 if libipvs can use netlink])
add_system_opt([LIBIPVS_NETLINK])
fi
dnl ----[ IPVS syncd options ]---
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
dnl -- Since Linux 3.18
AC_CHECK_DECLS([IPVS_DEST_ATTR_ADDR_FAMILY], [add_system_opt([IPVS_DEST_ATTR_ADDR_FAMILY])], [], [#include <linux/ip_vs.h>])
dnl -- Since Linux 4.3
IPVS_SYNCD_ATTRIBUTES=Yes
AC_CHECK_DECLS([
IPVS_DAEMON_ATTR_SYNC_MAXLEN,
IPVS_DAEMON_ATTR_MCAST_GROUP,
IPVS_DAEMON_ATTR_MCAST_GROUP6,
IPVS_DAEMON_ATTR_MCAST_PORT,
IPVS_DAEMON_ATTR_MCAST_TTL], [],
[
IPVS_SYNCD_ATTRIBUTES=No
break
],
[[#include <linux/ip_vs.h>]])
if test $IPVS_SYNCD_ATTRIBUTES = Yes; then
AC_DEFINE([_HAVE_IPVS_SYNCD_ATTRIBUTES_], [ 1 ], [Define to 1 if have IPVS syncd attributes])
add_system_opt([IPVS_SYNCD_ATTRIBUTES])
fi
dnl ----[ IPVS 64-bit stats ]----
dnl -- Since Linux 4.1
if test "$enable_lvs_64bit_stats" != "no"; then
IPVS_64BIT_STATS=Yes
AC_CHECK_DECLS([
IPVS_SVC_ATTR_STATS64,
IPVS_DEST_ATTR_STATS64], [],
[
IPVS_64BIT_STATS=No
break
],
[[#include <linux/ip_vs.h>]])
if test $IPVS_64BIT_STATS = Yes; then
AC_DEFINE([_WITH_LVS_64BIT_STATS_], [ 1 ], [Define to 1 if have IPVS 64 bit stats])
add_system_opt([IPVS_64BIT_STATS])
fi
fi
dnl ----[ IPVS tunnel type ]----
dnl -- Since Linux 5.2
AC_CHECK_DECLS([IPVS_DEST_ATTR_TUN_TYPE],
[
AC_DEFINE([_HAVE_IPVS_TUN_TYPE_], [ 1 ], [Define to 1 if have IPVS tunnel type])
add_system_opt([IPVS_TUN_TYPE])
], [],
[[#include <linux/ip_vs.h>]])
dnl -- Since Linux 5.3
AC_CHECK_DECLS([IP_VS_TUNNEL_ENCAP_FLAG_NOCSUM],
[
AC_DEFINE([_HAVE_IPVS_TUN_CSUM_], [ 1 ], [Define to 1 if have IPVS tunnel checksum options])
add_system_opt([IPVS_TUN_CSUM])
], [],
[[#include <linux/ip_vs.h>]])
dnl -- Since Linux 5.3
AC_CHECK_DECLS([IP_VS_CONN_F_TUNNEL_TYPE_GRE],
[
AC_DEFINE([_HAVE_IPVS_TUN_GRE_], [ 1 ], [Define to 1 if have IPVS gre tunnel])
add_system_opt([IPVS_TUN_GRE])
], [],
[[#include <linux/ip_vs.h>]])
CPPFLAGS="$SAV_CPPFLAGS"
dnl ----[ Is HTTP_GET regex checking wanted? ]----
AS_IF([test "$enable_regex" = yes],
[
$PKG_CONFIG --exists libpcre2-8
HAVE_PCRE2=$?
AS_IF([test $HAVE_PCRE2 -ne 0], [AC_MSG_ERROR([cannot find pcre library])])
AC_MSG_CHECKING([for pcre.h])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
]])],
[
AC_MSG_RESULT([yes])
WITH_REGEX=Yes
add_pkg_config([libpcre2-8])
AC_DEFINE([_WITH_REGEX_CHECK_], [ 1 ], [Define to 1 to build with HTTP_GET regex checking])
add_config_opt([REGEX])
],
[
AC_MSG_RESULT([no])
AC_MSG_ERROR([pcre2.h is missing])
])
if test "$enable_regex_timers" = yes; then
AC_DEFINE([_WITH_REGEX_TIMERS_], [ 1 ], [Define to 1 to include regex timers])
fi
if test "${enable_regex_debug}" = yes; then
AC_DEFINE([_REGEX_DEBUG_], [ 1 ], [Define to 1 to build with regex debugging support])
ENABLE_REGEX_DEBUG=Yes
add_config_opt([REGEX_DEBUG])
fi
])
else
IPVS_SUPPORT=No
fi
AM_CONDITIONAL([WITH_IPVS], [test $IPVS_SUPPORT = Yes])
AM_CONDITIONAL([WITH_REGEX], [test $WITH_REGEX = Yes])
dnl ----[ Checks for kernel netlink support ]----
VRRP_SUPPORT=No
VRRP_AUTH_SUPPORT=No
MACVLAN_SUPPORT=No
ENABLE_JSON=No
BFD_SUPPORT=No
HAVE_CN_PROC=No
if test "$enable_vrrp" != no; then
VRRP_SUPPORT=Yes
AC_DEFINE([_WITH_VRRP_], [ 1 ], [Define to 1 if have VRRP support])
add_config_opt([VRRP])
dnl ----[ check for VRRP authentication support ]----
if test "${enable_vrrp_auth}" != no; then
VRRP_AUTH_SUPPORT=Yes
AC_DEFINE([_WITH_VRRP_AUTH_], [ 1 ], [Define to 1 if want ARRP authentication support])
add_config_opt([VRRP_AUTH])
fi
dnl ----[ Checks for kernel VMAC support ]----
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
MACVLAN_SUPPORT=No
if test "${enable_vmac}" != no; then
MACVLAN_SUPPORT=Yes
dnl -- Since Linux 2.6.33
AC_CHECK_DECLS([
IFLA_MACVLAN_MODE,
MACVLAN_MODE_PRIVATE], [],
[
MACVLAN_SUPPORT=No
break
], [[
#include <sys/socket.h>
#include <linux/if_link.h>
]])
fi
if test $MACVLAN_SUPPORT = Yes; then
AC_DEFINE([_HAVE_VRRP_VMAC_], [ 1 ], [Define to 1 if have MAC VLAN support])
add_system_opt([VRRP_VMAC])
dnl ----[ Checks for kernel IPVLAN support ]----
IPVLAN_SUPPORT=Yes
dnl -- Since Linux 3.19
AC_CHECK_DECLS([IFLA_IPVLAN_MODE], [],
[
IPVLAN_SUPPORT=No
break
], [[
#include <sys/socket.h>
#include <linux/if_link.h>
]])
if test $IPVLAN_SUPPORT = Yes; then
AC_DEFINE([_HAVE_VRRP_IPVLAN_], [ 1 ], [Define to 1 if have IP VLAN support])
add_system_opt([VRRP_IPVLAN])
fi
dnl ----[ Check for IFLA_LINK_NETNSID support ]---- since Linux v4.0
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <linux/if_link.h>
int main(void) { int var = IFLA_LINK_NETNSID; }
]])],
[
AC_DEFINE([HAVE_IFLA_LINK_NETNSID], [ 1 ], [Define to 1 if IFLA_LINK_NETNSID supported])
add_system_opt([IFLA_LINK_NETNSID])
])
fi
CPPFLAGS="$SAV_CPPFLAGS"
dnl ----[ JSON output or not ? ]----
if test "${enable_json}" = yes; then
ENABLE_JSON=Yes
AC_DEFINE([_WITH_JSON_], [ 1 ], [Define to 1 to build with JSON output support])
add_config_opt([JSON])
fi
dnl ----[ BFD support ? ]----
if test "${enable_bfd}" = yes; then
BFD_SUPPORT=Yes
AC_DEFINE([_WITH_BFD_], [ 1 ], [Define to 1 if have BFD support])
add_config_opt([BFD])
fi
dnl -- Check for process events connector - Linux v2.6.15
AS_IF([test .$enable_track_process != .no],
[
add_system_opt([CN_PROC])
HAVE_CN_PROC=Yes
AC_DEFINE([_WITH_CN_PROC_], [ 1 ], [Define to 1 if have linux/cn_proc.h and track-process not disabled])
dnl -- PROC_EVENT_SID since Linux v2.6.32
dnl -- PROC_EVENT_PTRACE since Linux v3.1
dnl -- PROC_EVENT_COMM since Linux v3.2
dnl -- PROC_EVENT_COREDUMP since Linux v3.10
AC_CHECK_DECLS([PROC_EVENT_SID, PROC_EVENT_PTRACE, PROC_EVENT_COMM, PROC_EVENT_COREDUMP], [], [], [[#include <linux/cn_proc.h>]])
],
[add_config_opt([DISABLE_TRACK_PROCESS])])
fi
AM_CONDITIONAL([WITH_VRRP], [test $VRRP_SUPPORT = Yes])
AM_CONDITIONAL([VRRP_AUTH], [test $VRRP_AUTH_SUPPORT = Yes])
AM_CONDITIONAL([VMAC], [test $MACVLAN_SUPPORT = Yes])
AM_CONDITIONAL([WITH_JSON], [test $ENABLE_JSON = Yes])
AM_CONDITIONAL([WITH_BFD], [test $BFD_SUPPORT = Yes])
AM_CONDITIONAL([CN_PROC], [test $HAVE_CN_PROC = Yes])
if test ${IPVS_SUPPORT} = No -a ${VRRP_SUPPORT} = No; then
AC_MSG_ERROR([keepalived MUST be compiled with at least one of LVS or VRRP framework])
fi
dnl ----[ Checks for glibc SOCK_NONBLOCK support ]----
# Introduced in Linux 2.6.27 and glibc 2.9
AC_CHECK_DECLS([SOCK_NONBLOCK], [add_system_opt([SOCK_NONBLOCK])], [],[[#include <sys/socket.h>]])
AM_CONDITIONAL([SOCK_NONBLOCK], [test $ac_cv_have_decl_SOCK_NONBLOCK = yes])
dnl ----[ Checks for glibc SOCK_CLOEXEC support ]----
# Introduced in Linux 2.6.27 and glibc 2.9
AC_CHECK_DECLS([SOCK_CLOEXEC], [add_system_opt([SOCK_CLOEXEC])], [],[[#include <sys/socket.h>]])
dnl ----[ Checks for pe support ]----
# Introduced in Linux 2.6.37
AC_CHECK_DECL([IPVS_SVC_ATTR_PE_NAME],
[
AC_DEFINE([_HAVE_PE_NAME_], [ 1 ], [Define to 1 if have pe selection support])
],
[], [[#include <linux/ip_vs.h>]])
dnl ----[ Checks for O_PATH support ]----
# Introduced in Linux 2.6.39
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernel_inc -D_GNU_SOURCE"
AC_CHECK_DECLS([O_PATH],
[
add_system_opt([O_PATH])
], [],[[#include <fcntl.h>]])
CPPFLAGS="$SAV_CPPFLAGS"
dnl ----[ Check for GLOB_BRACE support ]----
AC_CHECK_DECLS([GLOB_BRACE], [add_system_opt([GLOB_BRACE])], [], [[#include <glob.h>]])
dnl ----[ Check for timegm() support ]----
AC_MSG_CHECKING([for timegm()])
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$KA_CPPFLAGS $kernel_inc"
AC_LINK_IFELSE([AC_LANG_SOURCE([[
#include <time.h>
int main(void)
{
timegm(NULL);
return 0;
}
]])], [
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_TIMEGM], [ 1 ], [Define to 1 if have timegm()])
],[
AC_MSG_RESULT(no)
])
CPPFLAGS="$SAV_CPPFLAGS"
dnl ----[ Do we want v1.3.6 and earlier VRRPv3 unicast checksum compatibility support ]----
UNICAST_CHKSUM_COMPAT_SUPPORT=No
if test .$enable_checksum_compat != .no; then
UNICAST_CHKSUM_COMPAT_SUPPORT=Yes
AC_DEFINE([_WITH_UNICAST_CHKSUM_COMPAT_], [ 1 ], [Define to 1 to enable v1.3.6 and earlier VRRPv3 unicast checksum compatibility])
add_config_opt([OLD_CHKSUM_COMPAT])
fi
dnl ----[ Checks for FIB routing support ]----
FIB_ROUTING_SUPPORT=No
if test .$enable_vrrp != .no -a .$enable_routes != .no; then
# Introduced in Linux 2.6.19
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
AC_CHECK_DECL([FRA_SRC],
[
FIB_ROUTING_SUPPORT=Yes
AC_DEFINE([_HAVE_FIB_ROUTING_], [ 1 ], [Define to 1 if have FIB routing support])
add_config_opt([FIB_ROUTING])
], [],
[[#include <sys/socket.h>
#include <linux/fib_rules.h>]])
CPPFLAGS="$SAV_CPPFLAGS"
fi
AM_CONDITIONAL([FIB_ROUTING], [test $FIB_ROUTING_SUPPORT = Yes])
dnl ----[ Check if linkbeat wanted ]----
AS_IF([test .$enable_linkbeat = .no],
[
LINKBEAT_SUPPORT=No
add_config_opt([NO_LINKBEAT])
],
[
LINKBEAT_SUPPORT=Yes
AC_DEFINE([_WITH_LINKBEAT_], [ 1 ], [Define to 1 if have linkbeat support])
])
dnl ----[ Checks for kernel IFLA_INET6_ADDR_GEN_MODE support ]----
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
if test ${MACVLAN_SUPPORT} = Yes; then
# Introduced in Linux 3.17
AC_CHECK_DECLS([IFLA_INET6_ADDR_GEN_MODE],
[
add_system_opt([INET6_ADDR_GEN_MODE])
], [], [[
#include <linux/if_link.h>
]])
fi
CPPFLAGS="$SAV_CPPFLAGS"
dnl ----[ Checks for kernel IFLA_VRF_... support ]----
if test ${MACVLAN_SUPPORT} = Yes; then
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernelinc"
# Introduced in Linux 4.3
AC_CHECK_DECLS([IFLA_VRF_MAX],
[
add_system_opt([VRF])
AC_DEFINE([_HAVE_VRF_], [ 1 ], [Define to 1 if have kernel VRF support])
], [], [[
#include <linux/if_link.h>
]])
CPPFLAGS="$SAV_CPPFLAGS"
fi
dnl ----[ Checks for SNMP support ]----
SNMP_SUPPORT=No
SNMP_KEEPALIVED_SUPPORT=No
SNMP_VRRP_SUPPORT=No
SNMP_RFC_SUPPORT=No
SNMP_RFCV2_SUPPORT=No
SNMP_RFCV3_SUPPORT=No
SNMP_CHECKER_SUPPORT=No
SNMP_V3_FOR_V2=No
if test "$enable_snmp_keepalived" = yes; then
AC_MSG_WARN([--enable-snmp-keepalived is obsolete. Use --enable-snmp-vrrp.])
enable_snmp_vrrp=$enable_snmp_keepalived
fi
if test "$enable_snmp" = yes -o \
"$enable_snmp_vrrp" = yes -o \
"$enable_snmp_checker" = yes -o \
"$enable_snmp_rfc" = yes -o \
"$enable_snmp_rfcv2" = yes -o \
"$enable_snmp_rfcv3" = yes; then
AC_PATH_TOOL([NETSNMP_CONFIG], [net-snmp-config], [no])
if test "$NETSNMP_CONFIG" = no; then
AC_MSG_ERROR([*** unable to find net-snmp-config])
fi
NETSNMP_LIBS_AGENT=`${NETSNMP_CONFIG} --netsnmp-agent-libs`
NETSNMP_LIBS_EXT=`${NETSNMP_CONFIG} --external-libs`
NETSNMP_LIBS="$NETSNMP_LIBS_AGENT $NETSNMP_LIBS_EXT"
NETSNMP_CFLAGS="`${NETSNMP_CONFIG} --base-cflags`"
NETSNMP_CPPFLAGS="-DNETSNMP_NO_INLINE"
# net-snmp-config can add -I/usr/include, so remove it
NETSNMP_CFLAGS=`echo $NETSNMP_CFLAGS " " | sed -e "s:-I */usr/include ::"`
# net-snmp-config adds compiler and linker options that were set at the time
# net-snmp was built, and this can include spec files that may not exist
# on the system building keepalived. We need to check if any spec files
# are specified, and if they do not exist on this system, then remove them
# from NETSNMP_LIBS or NETSNMP_CFLAGS.
# For further information, see https://bugzilla.redhat.com/show_bug.cgi?id=1544527
# and the other bugs referred to in it.
for spec in `echo $NETSNMP_LIBS | sed -e "s? ?\n?g" | grep "^-specs="`; do
SPEC_FILE=`echo $spec | sed -e "s?^-specs=??"`
if test ! -f $SPEC_FILE; then
NETSNMP_LIBS=`echo $NETSNMP_LIBS | sed -e "s? *$spec *? ?"`
AC_MSG_WARN([Removing $spec from NETSNMP_LIBS since spec file not installed])
fi
done
for spec in `echo $NETSNMP_CFLAGS | sed -e "s? ?\n?g" | grep "^-specs="`; do
SPEC_FILE=`echo $spec | sed -e "s?^-specs=??"`
if test ! -f $SPEC_FILE; then
NETSNMP_CFLAGS=`echo $NETSNMP_CFLAGS | sed -e "s? *$spec *? ?"`
AC_MSG_WARN([Removing $spec from NETSNMP_CFLAGS since spec file not installed])
fi
done
SAV_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS ${NETSNMP_CFLAGS}"
SAV_LIBS="$LIBS"
LIBS="$LIBS ${NETSNMP_LIBS}"
AC_MSG_CHECKING([whether C compiler supports flag "${NETSNMP_CFLAGS} ${NETSNMP_LIBS}" from Net-SNMP])
AC_LINK_IFELSE([AC_LANG_SOURCE([[
int main(void)
{
return 0;
}
]])], [
AC_MSG_RESULT(yes)
],[
AC_MSG_RESULT(no)
AC_MSG_ERROR([*** incorrect CFLAGS from net-snmp-config])
])
# Do we have subagent support?
AC_CHECK_FUNCS([netsnmp_enable_subagent], [],
[AC_MSG_ERROR([*** no subagent support in net-snmp])])
# check for net-snmp headers
# Some ancient distributions may miss <net-snmp/agent/util_funcs.h> header
SAV_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $kernel_inc $NETSNMP_CFLAGS"
AC_CHECK_HEADERS(net-snmp/agent/agent_sysORTable.h net-snmp/agent/snmp_vars.h net-snmp/agent/util_funcs.h,[],
[AC_MSG_ERROR([missing net-snmp headers])],[[
#include <net-snmp/net-snmp-config.h>
#include <net-snmp/net-snmp-includes.h>
#include <net-snmp/agent/net-snmp-agent-includes.h>
]])
SNMP_SUPPORT=Yes
# NETSNMP_CFLAGS can have CPPFLAGS options, so separate them
NETSNMP_CPPFLAGS_XTRA=`echo " $NETSNMP_CFLAGS " | sed -e "s/ / /g" -e "s/ -[[^IDU]] *-/ -/g" -e "s/ -[[^IDU]] *[[^-]][[^ ]]* / /g" -e "s/ */ /g"`
NETSNMP_CFLAGS=`echo " $NETSNMP_CFLAGS " | sed -e "s/ / /g" -e "s/ -[[IDU]] *[[^ ]]* / /g" -e "s/ */ /g"`
add_to_var([KA_CFLAGS], [$NETSNMP_CFLAGS])
add_to_var([KA_CPPFLAGS], [$NETSNMP_CPPFLAGS $NETSNMP_CPPFLAGS_XTRA])
# NETSNMP_LIBS may have some LDFLAGS options, so separate them
NETSNMP_LDFLAGS_XTRA=`echo " $NETSNMP_LIBS " | sed -e "s/ / /g" -e "s/ -l *[[^ ]]* / /g" -e "s/ */ /g" -e "s/ -/ @-/g" | tr "@" "\n" | sed -e "s/^ *//" -e "s/ *$//" | sort -u | tr "\n" " "`
NETSNMP_LIBS=`echo " $NETSNMP_LIBS " | sed -e "s/ / /g" -e "s/ \(-l *[[^ ]]*\) /@\1@/g" | tr "@" "\n" | grep "^-l" | tr "\n" " " | sed -e "s/ */ /g"`
add_to_var([KA_LDFLAGS], [$NETSNMP_LDFLAGS $NETSNMP_LDFLAGS_XTRA])
add_to_var([KA_LIBS], [$NETSNMP_LIBS])
if test "$enable_snmp_rfc" = yes; then
SNMP_RFCV2_SUPPORT=Yes
SNMP_RFCV3_SUPPORT=Yes
else
if test "$enable_snmp_rfcv2" = yes; then
SNMP_RFCV2_SUPPORT=Yes
fi
if test "$enable_snmp_rfcv3" = yes; then
SNMP_RFCV3_SUPPORT=Yes
fi
fi
if test ${SNMP_RFCV2_SUPPORT} = Yes -o \
${SNMP_RFCV3_SUPPORT} = Yes; then
if test ${VRRP_SUPPORT} != Yes; then
AC_MSG_ERROR([RFC SNMP support requires VRRP])
fi
SNMP_RFC_SUPPORT=Yes
fi
if test ${SNMP_RFCV3_SUPPORT} = Yes -a \
"$enable_snmp_reply_v3_for_v2" != no; then
AC_DEFINE([_SNMP_REPLY_V3_FOR_V2_], [ 1 ], [Define to 1 to have keepalived send RFC6527 SNMP responses for VRRPv2 instances])
SNMP_V3_FOR_V2=Yes
add_config_opt([SNMP_V3_FOR_V2])
fi
if test "$enable_snmp" = yes; then
if test ${VRRP_SUPPORT} = Yes; then
SNMP_VRRP_SUPPORT=Yes
fi
if test ${IPVS_SUPPORT} = Yes; then
SNMP_CHECKER_SUPPORT=Yes
fi
else
if test "$enable_snmp_vrrp" = yes; then
SNMP_VRRP_SUPPORT=Yes
fi
if test "$enable_snmp_checker" = yes; then
SNMP_CHECKER_SUPPORT=Yes
fi
fi
if test ${VRRP_SUPPORT} != Yes -a \
${SNMP_VRRP_SUPPORT} = Yes; then
AC_MSG_ERROR([VRRP SNMP support requires VRRP])
fi
if test ${IPVS_SUPPORT} = No -a \
${SNMP_CHECKER_SUPPORT} = Yes; then
AC_MSG_ERROR([CHECKER SNMP support requires checker])
fi
if test ${SNMP_VRRP_SUPPORT} = Yes -o \
${SNMP_CHECKER_SUPPORT} = Yes; then
SNMP_KEEPALIVED_SUPPORT=Yes
fi
CPPFLAGS="$SAV_CPPFLAGS"
CFLAGS="$SAV_CFLAGS"
LIBS="$SAV_LIBS"
fi
dnl ----[What SNMP support is required]----
if test $SNMP_SUPPORT = Yes; then
AC_DEFINE([_WITH_SNMP_], [ 1 ], [Define to 1 to have SNMP support])
fi
if test $SNMP_KEEPALIVED_SUPPORT = Yes; then
AC_DEFINE([_WITH_SNMP_KEEPALIVED_], [ 1 ], [Define to 1 to have keepalived SNMP support])
fi
if test $SNMP_VRRP_SUPPORT = Yes; then
AC_DEFINE([_WITH_SNMP_VRRP_], [ 1 ], [Define to 1 to have keepalived SNMP VRRP support])
add_config_opt([SNMP_VRRP])
fi
if test $SNMP_CHECKER_SUPPORT = Yes; then
AC_DEFINE([_WITH_SNMP_CHECKER_], [ 1 ], [Define to 1 to have keepalived SNMP checker support])
add_config_opt([SNMP_CHECKER])
fi
if test $SNMP_RFC_SUPPORT = Yes; then
AC_DEFINE([_WITH_SNMP_RFC_], [ 1 ], [Define to 1 to have RFC SNMP support])
fi
if test $SNMP_RFCV2_SUPPORT = Yes; then
AC_DEFINE([_WITH_SNMP_RFCV2_], [ 1 ], [Define to 1 to have RFCv2 SNMP support])
add_config_opt([SNMP_RFCV2])
fi
if test $SNMP_RFCV3_SUPPORT = Yes; then
AC_DEFINE([_WITH_SNMP_RFCV3_], [ 1 ], [Define to 1 to have RFCv3 SNMP support])
add_config_opt([SNMP_RFCV3])
fi
AM_CONDITIONAL([SNMP], [test $SNMP_SUPPORT = Yes])
AM_CONDITIONAL([SNMP_KEEPALIVED], [test $SNMP_KEEPALIVED_SUPPORT = Yes])
AM_CONDITIONAL([SNMP_VRRP], [test $SNMP_VRRP_SUPPORT = Yes -o $SNMP_RFC_SUPPORT = Yes])
AM_CONDITIONAL([SNMP_CHECKER], [test $SNMP_CHECKER_SUPPORT = Yes])
AM_CONDITIONAL([SNMP_RFC], [test $SNMP_RFCV2_SUPPORT = Yes -o $SNMP_RFCV3_SUPPORT = Yes])
AM_CONDITIONAL([SNMP_RFCV2], [test $SNMP_RFCV2_SUPPORT = Yes])
AM_CONDITIONAL([SNMP_RFCV3], [test $SNMP_RFCV3_SUPPORT = Yes])
AM_CONDITIONAL([SNMP_REPLY_V3_FOR_V2], [test $SNMP_V3_FOR_V2 = Yes])
AS_IF([test $SNMP_SUPPORT = Yes], [SNMP_SERVICE=snmpd.service], [SNMP_SERVICE=])
AC_SUBST([SNMP_SERVICE])
dnl ----[ Check for Dbus support ]----
DBUS_SUPPORT=No
DBUS_CREATE_INSTANCE=No
if test "$enable_dbus" = yes; then
AC_CHECK_LIB(gio-2.0, g_bus_own_name,
[
add_pkg_config([gio-2.0])
DBUS_SUPPORT=Yes
AC_DEFINE([_WITH_DBUS_], [ 1 ], [Define to 1 to have DBUS support])
add_config_opt([DBUS])
dnl -- g_type_init() not needed and deprecated since glib 2.36
SAV_CFLAGS=$CFLAGS
CFLAGS="$($PKG_CONFIG --cflags gio-2.0)"
SAV_LIBS=$LIBS
LIBS="$($PKG_CONFIG --libs gio-2.0)"
AC_RUN_IFELSE(
[
AC_LANG_PROGRAM(
[[#include <gio/gio.h>]],
[[return !g_thread_functions_for_glib_use.mutex_lock;]])],
[need_g_type_init=0],
[need_g_type_init=1],
[
AC_MSG_WARN([Cannot determine if need to call g_type_init(). Assuming yes for safety.])
need_g_type_init=1
])
if test $need_g_type_init -eq 1; then
AC_DEFINE([DBUS_NEED_G_TYPE_INIT], [ 1 ], [Define to 1 if need to call g_type_init()])
fi
LIBS=$SAV_LIBS
CFLAGS=$SAV_CFLAGS
if test "$enable_dbus_create_instance" = yes; then
AC_DEFINE([_WITH_DBUS_CREATE_INSTANCE_], [ 1 ], [Define to 1 to have DBus create instance support])
DBUS_CREATE_INSTANCE=Yes
add_config_opt([DBUS_CREATE_INSTANCE])
AC_MSG_WARN([DBus create instance functionality is dangerous - why do you want it?])
fi
],
[AC_MSG_ERROR([DBUS support requested but libgio-2.0 not found.])])
unset LIBS
fi
AM_CONDITIONAL([WITH_DBUS], [test $DBUS_SUPPORT = Yes])
AM_CONDITIONAL([DBUS_CREATE_INSTANCE], [test $DBUS_CREATE_INSTANCE = Yes])
dnl ----[ SHA1 or not ? ]----
SHA1_SUPPORT=No
if test "${enable_sha1}" = yes; then
AC_CHECK_HEADERS(openssl/sha.h,,AC_MSG_ERROR([unable to find openssl/sha.h]))
AC_CHECK_LIB(crypto, SHA1_Init,,
[
dnl libcrypto can require -fpic
AS_UNSET([ac_cv_lib_crypto_SHA1_Init])
SAV_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -fpic"
AC_CHECK_LIB(crypto, SHA1_Init,,AC_MSG_ERROR([SHA1 in OpenSSL required]))
CFLAGS=$SAV_CFLAGS
add_to_var([KA_CFLAGS],[-fpic])
])
SHA1_SUPPORT=Yes
AC_DEFINE([_WITH_SHA1_], [ 1 ], [Define to 1 to have SHA1 support])
fi
AM_CONDITIONAL([WITH_SHA1], [test $SHA1_SUPPORT = Yes])
unset LIBS
dnl ----[ check for SO_MARK support ]----
dnl -- Since Linux 2.6.25
SO_MARK_SUPPORT=No
if test "${enable_fwmark}" != no; then
AC_CHECK_DECLS([SO_MARK],
[
SO_MARK_SUPPORT=Yes
AC_DEFINE([_WITH_SO_MARK_], [ 1 ], [Define to 1 if have SO_MARK])
add_system_opt([SO_MARK])
], [],
[[#include <sys/socket.h>]])
fi
dnl ---[ check for setns() ]----
dnl -- CLONE_NEWNET defined from Linux 3.0
SAV_CFLAGS="$CFLAGS"
AC_CHECK_DECLS([CLONE_NEWNET], [], [], [[#include <sched.h>]])
dnl -- From glibc 2.14. Otherwise use setns syscall, since Linux 2.4.x
AC_CHECK_FUNCS([setns])
dnl -- When building a RedHat RPM with hardening enabled, -pie is specified,
dnl -- and for setns this requires -fPIC
AS_IF([test $ac_cv_func_setns = no],
[
AS_UNSET([ac_cv_func_setns])
CFLAGS="$CFLAGS -fPIC"
AC_CHECK_FUNCS([setns])
])
CFLAGS="$SAV_CFLAGS"
AM_CONDITIONAL([WITH_NAMESPACES], [test $ac_cv_have_decl_CLONE_NEWNET = yes])
dnl -- RLIMIT_RTTIME since Linux 2.6.25 - not supported with musl libc
AC_CHECK_DECLS([RLIMIT_RTTIME], [], [], [[#include <sys/resource.h>]])
dnl -- SCHED_RESET_ON_FORK since Linux 2.6.32
AC_CHECK_DECLS([SCHED_RESET_ON_FORK],
[add_system_opt([SCHED_RESET_ON_FORK])],
[AC_DEFINE([SCHED_RESET_ON_FORK], [ 0 ], [Dummy definition if not defined in system headers])],
[[#include <sched.h>]])
dnl -- Do we want GNU standard paths (moves .pid files)
GNU_STD_PATHS=No
if test "${enable_gnu_std_paths}" = "yes"; then
AC_DEFINE([GNU_STD_PATHS], [ 1 ], [set to enforce GNU standard paths, for .pid files etc])
RUN_DIR=$localstatedir
elif test $RUN_DIR_SPECIFIED = Y -a .${with_run_dir} != .no; then
RUN_DIR=`echo ${with_run_dir} | sed -e "s:/run/*$::"` # Remove a trailing /run - somewill will include it sometime
elif test -d /run; then
RUN_DIR=
else
RUN_DIR=/var
fi
AC_DEFINE_UNQUOTED([RUN_DIR_ROOT], [ "${RUN_DIR}" ], [Parent directory of /run])
AC_SUBST([RUN_DIR])
dnl - Check type of rlim_t for printf() - this check needs to be late on
dnl - since _FILE_OFFSET_BITS (set when using netsnmp) alters sizeof(rlim_t)
SAV_CFLAGS="$CFLAGS"
CFLAGS="-Wformat -Werror=format $SAV_CPPFLAGS $KA_CPPFLAGS"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <sys/resource.h>
int
main(int argc, char **argv)
{
rlim_t val = 23U;
printf("%lu %d %p", val, argc, argv);
return 0;
}
]])],
[AC_DEFINE([PRI_rlim_t], ["lu"], [Define printf format specifier for rlim_t])],
[AC_DEFINE([PRI_rlim_t], ["llu"], [Define printf format specifier for rlim_t])],
)
CFLAGS="$SAV_CFLAGS"
dnl ---[ check for sphinx-build executable ]----
if test -z "$SPHINXBUILD"; then
SPHINXBUILDNAME=sphinx-build
else
SPHINXBUILDNAME=${SPHINXBUILD}
fi
AC_SUBST(SPHINXBUILDNAME)
AC_CHECK_PROG([HAVE_SPHINX_BUILD], [$SPHINXBUILDNAME], [Yes], [No])
AM_CONDITIONAL([BUILD_DOCS], [test $HAVE_SPHINX_BUILD = Yes])
dnl ----[ Memory alloc check or not ? ]----
MEM_CHECK=No
MEM_CHECK_LOG=No
if test "${enable_mem_check}" = "yes"; then
MEM_CHECK=Yes
AC_DEFINE([_MEM_CHECK_], [ 1 ], [Define to 1 to build with malloc/free checks])
add_config_opt([MEM_CHECK])
if test "${enable_mem_check_log}" = "yes"; then
MEM_CHECK_LOG=Yes
AC_DEFINE([_MEM_CHECK_LOG_], [ 1 ], [Define to 1 to log malloc/free checks to syslog])
add_config_opt([MEM_CHECK_LOG])
fi
fi
dnl ----[ Log calls to set_time or not ? ]----
TIMER_CHECK=No
if test "${enable_timer_check}" = "yes"; then
TIMER_CHECK=Yes
AC_DEFINE([_TIMER_CHECK_], [ 1 ], [Define to 1 to build with set time logging])
add_config_opt([TIMER_CHECK])
fi
dnl ----[ Debug in one process or not ? ]----
if test "${enable_one_process_debug}" = yes; then
AC_DEFINE([_ONE_PROCESS_DEBUG_], [ 1 ], [Define to 1 to build with debugging support])
ENABLE_ONE_PROCESS_DEBUG=Yes
add_config_opt([ONE_PROCESS_DEBUG])
else
ENABLE_ONE_PROCESS_DEBUG=No
fi
AM_CONDITIONAL([ONE_PROCESS_DEBUG], [test $ENABLE_ONE_PROCESS_DEBUG = Yes])
dnl ----[ Netlink command timers or not ? ]----
if test "${enable_netlink_timers}" = yes; then
AC_DEFINE([_NETLINK_TIMERS_], [ 1 ], [Define to 1 to build with netlink command timers support])
ENABLE_NETLINK_TIMERS=Yes
add_config_opt([NETLINK_TIMERS])
else
ENABLE_NETLINK_TIMERS=No
fi
dnl ----[ smtp-alert debugging or not ? ]----
if test "${enable_smtp_alert_debug}" = yes; then
AC_DEFINE([_SMTP_ALERT_DEBUG_], [ 1 ], [Define to 1 to build with smtp-alert debugging support])
ENABLE_SMTP_ALERT_DEBUG=Yes
add_config_opt([SMTP_ALERT_DEBUG])
ENABLE_LOG_FILE_APPEND=Yes
else
ENABLE_SMTP_ALERT_DEBUG=No
fi
dnl ----[ Stacktrace support or not ? ]----
if test "${enable_stacktrace}" = yes; then
AC_DEFINE([_WITH_STACKTRACE_], [ 1 ], [Define to 1 to build with stacktrace support])
ENABLE_STACKTRACE=Yes
add_config_opt([STACKTRACE])
add_to_var([KA_LDFLAGS], [-rdynamic])
else
ENABLE_STACKTRACE=No
fi
dnl ----[ Thread dumping support or not ? ]----
if test "${enable_dump_threads}" = yes; then
AC_DEFINE([_WITH_DUMP_THREADS_], [ 1 ], [Define to 1 to build with thread dumping support])
ENABLE_DUMP_THREADS=Yes
add_config_opt([DUMP_THREADS])
else
ENABLE_DUMP_THREADS=No
fi
dnl ----[ epoll() debugging support or not ? ]----
if test "${enable_epoll_debug}" = yes; then
AC_DEFINE([_EPOLL_DEBUG_], [ 1 ], [Define to 1 to build with epoll_wait() debugging support])
ENABLE_EPOLL_DEBUG=Yes
add_config_opt([EPOLL_DEBUG])
else
ENABLE_EPOLL_DEBUG=No
fi
dnl ----[ epoll() thread dumping support or not ? ]----
if test "${enable_epoll_thread_dump}" = yes; then
AC_DEFINE([_EPOLL_THREAD_DUMP_], [ 1 ], [Define to 1 to build with epoll thread dumping support])
ENABLE_EPOLL_THREAD_DUMP=Yes
add_config_opt([EPOLL_THREAD_DUMP])
else
ENABLE_EPOLL_THREAD_DUMP=No
fi
if test $ENABLE_EPOLL_THREAD_DUMP = Yes -o $ENABLE_DUMP_THREADS = Yes -o $ENABLE_EPOLL_DEBUG = Yes; then
AC_DEFINE([THREAD_DUMP], [ 1 ], [Define to 1 to build with thread dumping support])
fi
dnl ----[ TSM debugging support or not ? ]----
if test "${enable_tsm_debug}" = yes; then
AC_DEFINE([_TSM_DEBUG_], [ 1 ], [Define to 1 to build with TSM debugging support])
ENABLE_TSM_DEBUG=Yes
add_config_opt([TSM_DEBUG])
else
ENABLE_TSM_DEBUG=No
fi
dnl ----[ VRRP FD debugging support or not ? ]----
if test "${enable_vrrp_fd_debug}" = yes; then
AC_DEFINE([_VRRP_FD_DEBUG_], [ 1 ], [Define to 1 to build with vrrp fd debugging support])
ENABLE_VRRP_FD_DEBUG=Yes
add_config_opt([VRRP_FD_DEBUG])
else
ENABLE_VRRP_FD_DEBUG=No
fi
dnl ----[ network timestamp support or not ? ]----
if test "${enable_network_timestamp}" = yes; then
AC_DEFINE([_NETWORK_TIMESTAMP_], [ 1 ], [Define to 1 to build with network timestamp support])
ENABLE_NETWORK_TIMESTAMP=Yes
add_config_opt([NETWORK_TIMESTAMP])
else
ENABLE_NETWORK_TIMESTAMP=No
fi
dnl ----[ asserts enabled or not ? ]----
if test "${enable_asserts}" = yes; then
AC_DEFINE([_ENABLE_ASSERT_], [ 1 ], [Define to 1 to enable asserts])
ENABLE_ASSERT=Yes
add_config_opt([ASSERT])
else
ENABLE_ASSERT=No
fi
AM_CONDITIONAL([ASSERTS], [test $ENABLE_ASSERT = Yes])
dnl ----[ Specify interface type to be unchangeable ]----
if test "${with_fixed_if_type}"; then
if test "${with_fixed_if_type}" = yes -o ${with_fixed_if_type} = no; then
AC_MSG_ERROR([An interface type must be specified with --with-fixed-if-type])
fi
AC_DEFINE_UNQUOTED([_FIXED_IF_TYPE_], [ "${with_fixed_if_type}" ], [Consider ${with_fixed_if_type} interfaces to be unchangeable])
FIXED_IF_TYPE=${with_fixed_if_type}
add_config_opt([FIXED_IF_TYPE=${with_fixed_if_type}])
else
FIXED_IF_TYPE=
fi
dnl ----[ Profiling or not ? ]----
WITH_PROFILING=No
if test "${enable_profile}" = yes; then
WITH_PROFILING=Yes
add_config_opt([PROFILING])
add_to_var([KA_CFLAGS], [-pg])
fi
AM_CONDITIONAL([PROFILE], [test $WITH_PROFILING = Yes])
dnl ----[ perf support or not? keepalived provides runtime options ]----
if test "${enable_perf}" = yes; then
AC_DEFINE([_WITH_PERF_], [ 1 ], [Define to 1 to build with perf support])
ENABLE_PERF=Yes
add_config_opt([PERF])
add_to_var([KA_CFLAGS], [-pg])
else
ENABLE_PERF=No
fi
if test "${enable_log_file}" = yes; then
AC_DEFINE([ENABLE_LOG_TO_FILE], [ 1 ], [Define if enabling logging to files])
ENABLE_LOG_FILE_APPEND=Yes
add_config_opt([FILE_LOGGING])
fi
if test "${ENABLE_LOG_FILE_APPEND}" = Yes; then
AC_DEFINE([ENABLE_LOG_FILE_APPEND], [ 1 ], [Define if appending to log files is allowed])
add_config_opt([LOG_FILE_APPEND])
fi
dnl ----[ Do we need to check for EINTR, or enable EINTR debugging code]----
ENABLE_EINTR_DEBUG=No
AS_IF([test .$enable_eintr_debug = .yes],
[
AC_DEFINE([_EINTR_DEBUG_], [ 1 ], [Define to test for and log errno == EINTR when no asynchronous signal handlers])
add_config_opt([EINTR_DEBUG])
ENABLE_EINTR_DEBUG=Yes
],
[
dnl --- We need to check for EINTR if we are not using signalfd
AS_IF([test .$ac_cv_func_signalfd != .yes -o .$enable_eintr_debug = .check],
[
AC_DEFINE([CHECK_EINTR], [ 1 ], [Define if need to check for EINTR errno])
AS_IF([test .$ac_cv_func_signalfd = .yes], [add_config_opt([EINTR_CHECK])])
])
])
dnl ----[ Do we enable script debugging code]----
ENABLE_SCRIPT_DEBUG=No
AS_IF([test .$enable_script_debug = .yes],
[
AC_DEFINE([_SCRIPT_DEBUG_], [ 1 ], [Define to enable script debugging support])
add_config_opt([SCRIPT_DEBUG])
ENABLE_SCRIPT_DEBUG=Yes
])
dnl ----[ Do we want to enable track process debugging code]----
ENABLE_TRACK_PROCESS_DEBUG=No
AS_IF([test .$enable_track_process_debug = .yes],
[
AC_DEFINE([_TRACK_PROCESS_DEBUG_], [ 1 ], [Define to enable logging all process connector events])
add_config_opt([TRACK_PROCESS_DEBUG])
ENABLE_TRACK_PROCESS_DEBUG=Yes
])
dnl ----[ Do we want to enable parser debugging code]----
ENABLE_PARSER_DEBUG=No
AS_IF([test .$enable_parser_debug = .yes],
[
AC_DEFINE([_PARSER_DEBUG_], [ 1 ], [Define to enable parser debugging])
add_config_opt([PARSER_DEBUG])
ENABLE_PARSER_DEBUG=Yes
])
dnl ----[ Do we want to enable checksum debugging code]----
ENABLE_CHECKSUM_DEBUG=No
AS_IF([test .$enable_checksum_debug = .yes],
[
AC_DEFINE([_CHECKSUM_DEBUG_], [ 1 ], [Define to enable checksum debugging])
add_config_opt([CHECKSUM_DEBUG])
ENABLE_CHECKSUM_DEBUG=Yes
])
dnl ----[ Do we want to enable genhash debugging code]----
ENABLE_GENHASH_DEBUG=No
AS_IF([test .$enable_genhash_debug = .yes],
[
AC_DEFINE([_GENHASH_DEBUG_], [ 1 ], [Define to enable genhash debugging])
add_config_opt([GENHASH_DEBUG])
ENABLE_GENHASH_DEBUG=Yes
])
dnl ----[ Do we want to enable checker debugging code]----
ENABLE_CHECKER_DEBUG=No
AS_IF([test .$enable_checker_debug = .yes],
[
AC_DEFINE([_CHECKER_DEBUG_], [ 1 ], [Define to enable checker debugging])
add_config_opt([CHECKER_DEBUG])
ENABLE_CHECKER_DEBUG=Yes
])
dnl ----[ Do we want to enable SMTP connect debugging code]----
ENABLE_SMTP_CONNECT_DEBUG=No
AS_IF([test .$enable_smtp_connect_debug = .yes],
[
AC_DEFINE([_SMTP_CONNECT_DEBUG_], [ 1 ], [Define to enable SMTP connection debugging])
add_config_opt([SMTP_CONNECT_DEBUG])
ENABLE_SMTP_CONNECT_DEBUG=Yes
])
dnl ----[ Do we want to enable memory alloc/free error debugging code]----
ENABLE_MEM_ERR_DEBUG=No
AS_IF([test .$enable_mem_err_debug = .yes],
[
AC_DEFINE([_MEM_ERR_DEBUG_], [ 1 ], [Define to enable memory alloc/free error debugging])
add_config_opt([MEM_ERR_DEBUG])
ENABLE_MEM_ERR_DEBUG=Yes
])
dnl ----[ Do we want to enable dump keywords code]----
AS_IF([test .$enable_dump_keywords = .yes],
[
AC_DEFINE([_DUMP_KEYWORDS_], [ 1 ], [Define to enable keyword dumping])
add_config_opt([DUMP_KEYWORDS])
])
if test "${NEED_LIBDL}" = Yes; then
add_to_var([KA_LIBS], [-ldl])
fi
dnl ----[ Determine if we are using pthreads ]----
echo " $KA_LIBS" | grep -qE -- " -l?pthread "
if test $? -eq 0 ;then
AC_DEFINE([_WITH_PTHREADS_], [ 1 ], [Define to 1 if using pthreads])
fi
dnl ----[ Check if rpmbuild supports --build-in-place ]----
RPM_NO_BIP=1
AC_CHECK_PROG([HAVE_RPM], [rpm], [Yes], [No])
if test $HAVE_RPM = Yes; then
AC_CHECK_PROG([HAVE_RPMBUILD], [rpmbuild], [Yes], [No])
RPM_SRC_DIR=`rpm --eval "%{_sourcedir}"`
if ! test -d $RPM_SRC_DIR; then
HAVE_RPMBUILD=No
fi
if test $HAVE_RPMBUILD = Yes; then
rpmbuild --help | grep -q -- --build-in-place
RPM_NO_BIP=$?
fi
fi
AM_CONDITIONAL([RPM], [test $HAVE_RPM = Yes])
AM_CONDITIONAL([RPM_BIP], [test $RPM_NO_BIP -eq 0])
dnl ----[ Determine system init type]----
INIT_TYPE=
AS_IF(
[test -n "$init_type"], [INIT_TYPE=$init_type],
[test -n "$with_systemdsystemunitdir"], [INIT_TYPE=systemd],
[
/sbin/init --version 2>/dev/null | grep -q upstart
AS_IF(
[test $? -eq 0], [INIT_TYPE=upstart],
[
init_path=`which systemctl 2>/dev/null`
AS_IF([test \( $? -eq 0 -a -x "$init_path" \)],
[
systemctl | grep -q -- "-\.mount"
AS_IF([test $? -eq 0], [INIT_TYPE=systemd])
])
AS_IF([test \( -z "$INIT_TYPE" -a -f /etc/init.d/networking \)],
[
init_path=`which openrc-run 2>/dev/null`
AS_IF([test \( $? -eq 0 -a -x "$init_path" \)],
[
head -1 /etc/init.d/networking | grep -q "^#! */.*/openrc-run$"
AS_IF([test $? -eq 0], [INIT_TYPE=openrc])
])
])
AS_IF([test \( -z "$INIT_TYPE" -a -f /etc/init.d/cron -a ! -h /etc/init.d/cron \)], [INIT_TYPE=SYSV])
])
])
AS_IF([test \( .$INIT_TYPE = .systemd -a -z "$with_systemdsystemunitdir" \)], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
dnl ----[Default keepalived configuration file]----
AS_IF([test $default_config_file],
[
AS_IF([test $default_config_file = yes -o $default_config_file = no],
[AC_MSG_ERROR([A filename must be specified for default-config-file])])
CONFIG_FILE=$default_config_file
add_config_opt([DEFAULT_CONFIG_FILE=${default_config_file}])
],
[default_config_file="/etc/$PACKAGE/$PACKAGE.conf"])
AC_DEFINE_UNQUOTED([DEFAULT_CONFIG_FILE], ["$default_config_file"], [The default configuration file])
AC_SUBST([DEFAULT_CONFIG_FILE], [$default_config_file])
if test -z "$INIT_TYPE"; then
INIT_TYPE=undetected
elif test $INIT_TYPE = systemd; then
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
fi
AM_CONDITIONAL([INIT_UPSTART], [test $INIT_TYPE = upstart])
AM_CONDITIONAL([INIT_SYSTEMD], [test $INIT_TYPE = systemd])
AM_CONDITIONAL([INIT_SYSV], [test $INIT_TYPE = SYSV])
AM_CONDITIONAL([INIT_OPENRC], [test $INIT_TYPE = openrc])
AM_CONDITIONAL([INIT_SUSE], [test $INIT_TYPE = SUSE])
AC_DEFINE_UNQUOTED([CONFIGURATION_OPTIONS], ["$CONFIG_OPTIONS"], [The configuration options from which the package is built])
AC_DEFINE_UNQUOTED([SYSTEM_OPTIONS], ["$SYSTEM_OPTIONS"], [The system options from which the package is built])
if test $NETLINK_VER -eq 0; then
NETLINK_VER=None
fi
dnl ----[ Process output target ]----
echo
# Tidy up some strings
KA_CPPFLAGS=`echo $KA_CPPFLAGS | sed -e "s/ */ /g" -e "s/^ //" -e "s/ $//"`
KA_CFLAGS=`echo $KA_CFLAGS | sed -e "s/ */ /g" -e "s/^ //" -e "s/ $//"`
KA_LDFLAGS=`echo $KA_LDFLAGS | sed -e "s/ */ /g" -e "s/^ //" -e "s/ $//"`
KA_LIBS=`echo $KA_LIBS | sed -e "s/ */ /g" -e "s/^ //" -e "s/ $//"`
# Tidy up some strings
KA_CPPFLAGS=`echo $KA_CPPFLAGS | sed -e "s/ */ /g" -e "s/^ //" -e "s/ $//"`
KA_CFLAGS=`echo $KA_CFLAGS | sed -e "s/ */ /g" -e "s/^ //" -e "s/ $//"`
KA_LDFLAGS=`echo $KA_LDFLAGS | sed -e "s/ */ /g" -e "s/^ //" -e "s/ $//"`
KA_LIBS=`echo $KA_LIBS | sed -e "s/ */ /g" -e "s/^ //" -e "s/ $//"`
AC_OUTPUT
# Restore lib/config_warnings.h.in
mv ${CONFIG_WARNINGS}.sav ${CONFIG_WARNINGS}
dnl ----[ Display current configuration ]----
cat <<EOF;
Keepalived configuration
------------------------
Keepalived version : ${VERSION}
Compiler : ${CC}
Preprocessor flags : ${KA_CPPFLAGS}
Compiler flags : ${KA_CFLAGS}
EOF
dnl ----[ display optional vars ]----
if test -n "$KA_LDFLAGS$KA_LIBS"; then
echo "Linker flags : $KA_LDFLAGS"
echo "Extra Lib : $KA_LIBS"
fi
echo "Use IPVS Framework : ${IPVS_SUPPORT}"
if test ${IPVS_SUPPORT} = Yes; then
echo "IPVS use libnl : ${IPVS_USE_NL}"
echo "IPVS syncd attributes : ${IPVS_SYNCD_ATTRIBUTES}"
echo "IPVS 64 bit stats : ${IPVS_64BIT_STATS}"
echo "HTTP_GET regex support : ${WITH_REGEX}"
fi
echo "fwmark socket support : ${SO_MARK_SUPPORT}"
echo "Use VRRP Framework : ${VRRP_SUPPORT}"
if test ${VRRP_SUPPORT} = Yes; then
echo "Use VRRP VMAC : ${MACVLAN_SUPPORT}"
echo "Use VRRP authentication : ${VRRP_AUTH_SUPPORT}"
echo "With ip rules/routes : ${FIB_ROUTING_SUPPORT}"
echo "With track_process : ${HAVE_CN_PROC}"
echo "With linkbeat : ${LINKBEAT_SUPPORT}"
fi
echo "Use BFD Framework : ${BFD_SUPPORT}"
echo "SNMP vrrp support : ${SNMP_VRRP_SUPPORT}"
echo "SNMP checker support : ${SNMP_CHECKER_SUPPORT}"
echo "SNMP RFCv2 support : ${SNMP_RFCV2_SUPPORT}"
echo "SNMP RFCv3 support : ${SNMP_RFCV3_SUPPORT}"
if test ${SNMP_RFCV3_SUPPORT} = Yes; then
echo "SNMP send V3 for V2 : ${SNMP_V3_FOR_V2}"
fi
echo "DBUS support : ${DBUS_SUPPORT}"
if test ${DBUS_SUPPORT} = Yes; then
echo "DBUS create instance : ${DBUS_CREATE_INSTANCE}"
fi
echo "SHA1 support : ${SHA1_SUPPORT}"
echo "Use JSON output : ${ENABLE_JSON}"
echo "libnl version : ${NETLINK_VER}"
echo "Use IPv4 devconf : ${IPV4_DEVCONF}"
echo "Use iptables : ${USE_IPTABLES}"
if test .$USE_IPTABLES = .Yes; then
echo "Use libipset : ${USE_LIBIPSET}"
fi
echo "Use nftables : ${USE_NFTABLES}"
echo "init type : ${INIT_TYPE}"
echo "Strict config checks : ${STRICT_CONFIG}"
echo "Build genhash : ${BUILD_GENHASH}"
echo "Build documentation : ${HAVE_SPHINX_BUILD}"
if test ${ENABLE_STACKTRACE} = Yes; then
echo "Stacktrace support : Yes"
fi
if test ${ENABLE_PERF} = Yes; then
echo "Perf support : Yes"
fi
if test ${MEM_CHECK} = Yes; then
echo "Memory alloc check : Yes"
echo "Memory alloc check log : ${MEM_CHECK_LOG}"
fi
if test ${TIMER_CHECK} = Yes; then
echo "Set time logging : Yes"
fi
if test ${ENABLE_DUMP_THREADS} = Yes; then
echo "Thread debugging : Yes"
fi
if test ${ENABLE_EPOLL_DEBUG} = Yes; then
echo "epoll_wait() debugging : Yes"
fi
if test ${ENABLE_EPOLL_THREAD_DUMP} = Yes; then
echo "epoll thread dumping : Yes"
fi
if test ${ENABLE_REGEX_DEBUG} = Yes; then
echo "regex debugging : Yes"
fi
if test ${ENABLE_TSM_DEBUG} = Yes; then
echo "TSM debugging : Yes"
fi
if test ${ENABLE_VRRP_FD_DEBUG} = Yes; then
echo "VRRP_FD debugging : Yes"
fi
if test ${ENABLE_NETWORK_TIMESTAMP} = Yes; then
echo "network timestamping : Yes"
fi
if test ${ENABLE_ASSERT} = Yes; then
echo "asserts enabled : Yes"
fi
if test ${ENABLE_ONE_PROCESS_DEBUG} = Yes; then
echo "Use one process debuging : Yes"
fi
if test ${ENABLE_NETLINK_TIMERS} = Yes; then
echo "Netlink command timers : Yes"
fi
if test ${ENABLE_SMTP_ALERT_DEBUG} = Yes; then
echo "smtp-alert debugging : Yes"
fi
if test ${ENABLE_EINTR_DEBUG} = Yes; then
echo "EINTR debugging : Yes"
fi
if test ${ENABLE_SCRIPT_DEBUG} = Yes; then
echo "Script debugging : Yes"
fi
if test ${ENABLE_TRACK_PROCESS_DEBUG} = Yes; then
echo "track process debugging : Yes"
fi
if test ${ENABLE_PARSER_DEBUG} = Yes; then
echo "Parser debugging : Yes"
fi
if test ${ENABLE_CHECKSUM_DEBUG} = Yes; then
echo "Checksum debugging : Yes"
fi
if test ${ENABLE_GENHASH_DEBUG} = Yes; then
echo "genhash debugging : Yes"
fi
if test ${ENABLE_CHECKER_DEBUG} = Yes; then
echo "checker debugging : Yes"
fi
if test ${ENABLE_SMTP_CONNECT_DEBUG} = Yes; then
echo "SMTP connect debugging : Yes"
fi
if test ${ENABLE_MEM_ERR_DEBUG} = Yes; then
echo "memory alloc error debug : Yes"
fi
if test "${FIXED_IF_TYPE}"; then
echo "Fixed interface type : ${FIXED_IF_TYPE}"
fi
if test "${CONFIG_FILE}"; then
echo "Default config file : ${CONFIG_FILE}"
fi
dnl ----[ end configure ]---
if test ${IPVS_SUPPORT} = Yes -a ${IPVS_USE_NL} = No; then
echo
echo "*** WARNING - this build will not support IPVS with IPv6. Please install libnl/libnl-3 dev libraries to support IPv6 with IPVS."
echo
fi
if test ${ENABLE_ONE_PROCESS_DEBUG} = Yes; then
echo
echo "*** WARNING --enable-one-process-debug is only for debugging purposes and isn't expected to work properly"
echo
fi
|