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
|
dnl Process this file with autoconf to produce a configure script.
dnl There are two types of comments in this file.
dnl Comments that refer to Autoconf macros begin with "dnl", and m4
dnl discards them. Other comments begin with "#", and they get copied
dnl to the configure script, hopefully making it easier to read.
dnl Autoconf 2.13 generates an incomplete config.h.in; see ELinks bug 936.
dnl Autoconf 2.61 is installed in the computer that generates our nightly
dnl snapshots, so we need to be compatible with that. (Also, some files
dnl in Autoconf 2.62 and 2.63 sources are not GPLv2 compatible.)
AC_PREREQ(2.61)
AC_INIT
AC_CONFIG_SRCDIR([src/main/main.c])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([config/m4])
PACKAGE=elinks
VERSION=0.19.0
AC_SUBST(PACKAGE)
AC_SUBST(VERSION)
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Package version])
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Package version])
AC_CONFIG_HEADERS(config.h)
AC_CHECK_PROG(ACLOCAL,[aclocal],[aclocal],[config/missing aclocal])
AC_CHECK_PROG(AUTOCONF,[autoconf],[autoconf],[config/missing autoconf])
AC_CHECK_PROG(AUTOHEADER,[autoheader],[autoheader],[config/missing autoheader])
AC_USE_SYSTEM_EXTENSIONS
MAKE=
for make in gnumake gmake make false; do
if test "x$MAKE" = x; then
AC_PATH_PROGS(MAKE, "$make")
fi
done
builddir="`pwd`"
# Cleanup if we are configuring with a previous build in the tree
if test -e Makefile.config; then
AC_MSG_CHECKING([for previous build to clean])
"$MAKE" -C "$builddir/src" cleanall >/dev/null 2>/dev/null
AC_MSG_RESULT(done)
fi
# ===================================================================
# Load feature configuration file and start logging features.
# ===================================================================
features="features.conf"
test -f "$srcdir/$features" && . "$srcdir/$features"
test -f "$builddir/$features" && . "$builddir/$features"
echo "Feature summary:" > features.log
# ===================================================================
# Checks for programs.
# ===================================================================
AC_PROG_CC
AC_PROG_CXX
AC_CHECK_TOOL([LD], [ld])
AC_PROG_AWK
AC_PATH_PROGS(AWK, "$AWK")
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PATH_PROGS(GIT, "git")
AC_PATH_PROGS(SPARSE, "sparse")
PKG_PROG_PKG_CONFIG
CONFIG_ASCIIDOC="no"
CONFIG_POD2HTML="no"
CONFIG_XMLTO="no"
CONFIG_DBLATEX="no"
if test "x$CONFIG_DOC" != xno; then
AC_PATH_PROGS(PYTHON3, "python3")
if test "x$PYTHON3" != "x"; then
EL_CONFIG(CONFIG_ASCIIDOC, [AsciiDoc])
EL_CONFIG(MANUAL_ASCIIDOC, [HTML (one file)])
EL_CONFIG(MAN_ASCIIDOC, [HTML])
fi
AC_PATH_PROGS(XMLTO, "xmlto")
if test "x$XMLTO" != "x"; then
EL_CONFIG(CONFIG_XMLTO, [XmlTo])
EL_CONFIG(MANUAL_XMLTO, [HTML (multiple files)])
EL_CONFIG(MAN_XMLTO, [man (groff)])
fi
AC_PATH_PROGS(DBLATEX, "dblatex")
if test "x$DBLATEX" != "x"; then
EL_CONFIG(CONFIG_DBLATEX, [dblatex])
EL_CONFIG(MANUAL_DBLATEX, [PDF])
fi
AC_PATH_PROGS(POD2HTML, "pod2html")
if test "x$POD2HTML" != "x"; then
EL_CONFIG(CONFIG_POD2HTML, [Pod2HTML])
fi
AC_PATH_PROGS(DOXYGEN, "doxygen")
if test "x$DOXYGEN" != "x"; then
EL_CONFIG(CONFIG_DOXYGEN, [Doxygen])
api_srcdir="$(cd "$srcdir" && pwd)/src"
AC_SUBST(api_srcdir)
fi
fi
AC_SUBST(CONFIG_ASCIIDOC)
AC_SUBST(CONFIG_DOXYGEN)
AC_SUBST(CONFIG_POD2HTML)
AC_SUBST(CONFIG_XMLTO)
AC_SUBST(CONFIG_DBLATEX)
EL_CONFIG_DEPENDS(CONFIG_DOC, [CONFIG_ASCIIDOC CONFIG_XMLTO CONFIG_DBLATEX CONFIG_POD2HTML], [Documentation Tools])
EL_CONFIG_DEPENDS(CONFIG_MANUAL, [MANUAL_ASCIIDOC MANUAL_XMLTO MANUAL_DBLATEX], [Manual Formats])
EL_CONFIG_DEPENDS(CONFIG_MANPAGE, [MAN_ASCIIDOC MAN_XMLTO], [Man Page Formats])
EL_CONFIG_DEPENDS(CONFIG_APIDOCS, [CONFIG_DOXYGEN], [API Documentation])
# gcc specific options (to be continued at the bottom of configure)
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
# We want to see all warnings and live with none.
# We can't set up -Werror here as there may be some warnings in test
# suite of configure, and we don't want to fail them.
CFLAGS="$CFLAGS -Wall"
fi
# ===================================================================
# static binary
# ===================================================================
enable_static=no
pkg_config_static=
AC_ARG_WITH(static, [ --with-static enable build of static binary],
[ if test "x$withval" != xno; then enable_static=yes; fi ])
if test "$enable_static" = yes; then
CFLAGS="$CFLAGS -static"
pkg_config_static="--static"
fi
# ===================================================================
# Checks for special OSes.
# ===================================================================
dnl EL_CHECK_COMPILER_MACRO(define, name, flagname)
AC_DEFUN([EL_CHECK_COMPILER_MACROS],
[
AC_MSG_CHECKING([for $2])
for flag in $3; do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[#ifndef $flag
kill me!
#endif ]])],[$1=yes],[$1=no])
if test "[$]$1" = yes; then
EL_CONFIG([$1], [$2])
break
fi
done
AC_MSG_RESULT([$]$1)
])
EL_CHECK_COMPILER_MACROS(CONFIG_OS_BEOS, [BEOS], [__BEOS__])
AC_SUBST(CONFIG_OS_BEOS)
EL_CHECK_COMPILER_MACROS(CONFIG_OS_DOS, [DOS], [__DJGPP])
AC_SUBST(CONFIG_OS_DOS)
EL_CHECK_COMPILER_MACROS(CONFIG_OS_RISCOS, [RISCOS], [__riscos__])
AC_SUBST(CONFIG_OS_RISCOS)
EL_CHECK_COMPILER_MACROS(CONFIG_OS_WIN32, [WIN32], [_WIN32 __WIN32__])
AC_SUBST(CONFIG_OS_WIN32)
EL_CHECK_COMPILER_MACROS(CONFIG_OS_OS2, [EMX], [__EMX__])
AC_SUBST(CONFIG_OS_OS2)
test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zexe//g"`
AC_MSG_CHECKING([for UNIX])
dnl FIXME: some depend kind of mechanism
if test "$CONFIG_OS_BEOS" = no && \
test "$CONFIG_OS_DOS" = no && \
test "$CONFIG_OS_RISCOS" = no && \
test "$CONFIG_OS_WIN32" = no && \
test "$CONFIG_OS_OS2" = no; then
EL_CONFIG(CONFIG_OS_UNIX, [UNIX])
else
CONFIG_OS_UNIX=no
fi
AC_MSG_RESULT($CONFIG_OS_UNIX)
AC_SUBST(CONFIG_OS_UNIX)
# ===================================================================
# Checks for header files.
# ===================================================================
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_CHECK_HEADERS(wchar.h wctype.h)
AC_CHECK_HEADERS(fcntl.h time.h unistd.h)
AC_CHECK_HEADERS(libgen.h)
AC_CHECK_HEADERS(sigaction.h)
AC_CHECK_HEADERS(arpa/inet.h)
AC_CHECK_HEADERS(netinet/in_systm.h netinet/in_system.h netinet/ip.h)
AC_CHECK_HEADERS(netdb.h netinet/in.h netinet/in6_var.h)
AC_CHECK_HEADERS(ifaddrs.h)
AC_CHECK_HEADERS(sys/cygwin.h io.h)
AC_CHECK_HEADERS(sys/fmutex.h)
AC_CHECK_HEADERS(sys/ioctl.h sys/sockio.h)
AC_CHECK_HEADERS(sys/kd.h)
AC_CHECK_HEADERS(sys/resource.h)
AC_CHECK_HEADERS(sys/select.h)
AC_CHECK_HEADERS(sys/socket.h)
AC_CHECK_HEADERS(sys/time.h)
AC_CHECK_HEADERS(sys/utsname.h)
AC_CHECK_HEADERS([net/if.h], [], [],
[[#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h> /* <net/if.h> on Mac OS X 10.5.4 needs this */
#endif
]])
AC_CHECK_HEADERS(stdint.h inttypes.h)
AC_CHECK_HEADERS(pwd.h)
AC_CHECK_HEADERS(termios.h)
AC_CHECK_HEADERS(poll.h)
AC_CHECK_HEADERS(stdalign.h)
if test "$CONFIG_OS_DOS" = no; then
AC_CHECK_HEADERS(sys/un.h,
[CONFIG_INTERLINK=yes
EL_CONFIG([CONFIG_INTERLINK], [interlinking])],
[CONFIG_INTERLINK=no])
else
CONFIG_INTERLINK=no
fi
AC_SUBST(CONFIG_INTERLINK)
# ===================================================================
# Checks for typedefs, structures, and compiler characteristics.
# ===================================================================
AC_STRUCT_TM
AC_C_CONST
AC_C_INLINE
AC_MSG_CHECKING([[for C99-conforming inline]])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef __cplusplus
#error noinline
#endif
int add(int change);
static int sum;
inline int
add(int change)
{
sum += change;
return sum;
}
int
sub(int change)
{
return add(-change);
}]])],
[AC_MSG_RESULT([[yes]])
AC_DEFINE([NONSTATIC_INLINE], [inline],
[Define as inline if the compiler lets you declare a function without inline, then define it with inline, and have that definition refer to identifiers with internal linkage. This is allowed by C99 6.7.4p6 and 6.7.4p3 together. Otherwise define as nothing.])],
[AC_MSG_RESULT([[no]])
AC_DEFINE([NONSTATIC_INLINE], [])])
EL_CHECK_CODE(typeof, HAVE_TYPEOF, [], [int a; typeof(a) b;])
AC_SYS_LARGEFILE
AC_TYPE_SIZE_T
AC_TYPE_OFF_T
EL_CHECK_TYPE(ssize_t, int)
EL_CHECK_SYS_TYPE(long long, HAVE_LONG_LONG, [])
EL_CHECK_SYS_TYPE(off_t, HAVE_OFF_T, [])
EL_CHECK_INT_TYPE(int32_t, HAVE_INT32_T)
EL_CHECK_INT_TYPE(uint32_t, HAVE_UINT32_T)
EL_CHECK_INT_TYPE(uint16_t, HAVE_UINT16_T)
AC_CHECK_SIZEOF(char, 1)
AC_CHECK_SIZEOF(short, 2)
AC_CHECK_SIZEOF(int, 4)
AC_CHECK_SIZEOF(long, 4)
test "x$HAVE_LONG_LONG" = xyes && AC_CHECK_SIZEOF(long long, 8)
test "x$HAVE_OFF_T" = xyes && AC_CHECK_SIZEOF(off_t, 4)
AC_CHECK_SIZEOF(intptr_t, 8, [#include <stdint.h> ])
# Check for variadic macros
EL_CHECK_CODE([variadic macros], HAVE_VARIADIC_MACROS,
[#include <stdio.h>
#define a(b,c...) printf(b,##c)],
[a("foo");a("%s","bar");a("%s%s","baz","quux");])
# ===================================================================
# Checks for library functions.
# ===================================================================
AC_PROG_GCC_TRADITIONAL
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_FUNC_STRFTIME
AC_CHECK_FUNCS(strptime)
AC_CHECK_FUNCS(atoll gethostbyaddr herror strerror)
AC_CHECK_FUNCS(popen uname access chmod alarm timegm mremap)
AC_CHECK_FUNCS(strcasecmp strncasecmp strcasestr strstr strchr strrchr)
AC_CHECK_FUNCS(memmove bcopy stpcpy strdup index isdigit mempcpy memrchr)
AC_CHECK_FUNCS(snprintf vsnprintf asprintf vasprintf)
AC_CHECK_FUNCS(getifaddrs getpwnam inet_aton inet_pton inet_ntop)
AC_CHECK_FUNCS(fflush fsync fseeko ftello sigaction)
AC_CHECK_FUNCS(gettimeofday clock_gettime)
AC_CHECK_FUNCS(setitimer, HAVE_SETITIMER=yes)
AC_CHECK_FUNCS([cygwin_conv_to_full_win32_path])
AC_CHECK_FUNCS(setenv putenv, HAVE_SETENV_OR_PUTENV=yes)
AC_CHECK_FUNCS(unsetenv)
AC_CHECK_FUNCS(getuid, HAVE_GETUID=yes)
AC_CHECK_FUNCS(geteuid, HAVE_GETEUID=yes)
AC_CHECK_FUNCS(wcwidth, HAVE_WCWIDTH=yes)
AC_CHECK_FUNCS(fork)
AC_CHECK_FUNCS(mkstemps)
# These aren't probably needed now, as they are commented in links.h.
# I've no idea about their historical background, but I keep them here
# just in the case they will help later. --pasky
AC_CHECK_FUNCS(setpgid getpgid setpgrp getpgrp)
AC_CHECK_FUNCS(raise, HAVE_RAISE=yes)
AC_CHECK_FUNCS(kill, HAVE_KILL=yes)
AC_CHECK_FUNCS(fpathconf, HAVE_FPATHCONF=yes)
AC_CHECK_FUNCS(poll, HAVE_POLL=yes)
if test x"$HAVE_RAISE" = x; then
if test x"$HAVE_KILL" = x; then
AC_MSG_ERROR([Unable to emulate raise()])
fi
fi
AC_CACHE_CHECK([for sysconf(_SC_PAGE_SIZE)],el_cv_HAVE_SC_PAGE_SIZE,[
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>
]], [[int page_size = sysconf(_SC_PAGE_SIZE);]])],[el_cv_HAVE_SC_PAGE_SIZE=yes],[el_cv_HAVE_SC_PAGE_SIZE=no])])
if test x"$el_cv_HAVE_SC_PAGE_SIZE" = x"yes"; then
EL_DEFINE(HAVE_SC_PAGE_SIZE, _SC_PAGE_SIZE)
fi
AC_CACHE_CHECK([for C99 vsnprintf],el_cv_HAVE_C99_VSNPRINTF,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
char buf[8];
int bar(char *buf, const char *format, va_list ap)
{
return vsnprintf(buf, 0, format, ap);
}
void foo(const char *format, ...) {
va_list ap;
int len;
va_start(ap, format);
len = bar(buf, format, ap);
va_end(ap);
if ((len != 6) && (len != 7)) exit(1); /* \n -> \r\n */
va_start(ap, format);
len = bar(buf, format, ap);
va_end(ap);
if ((len != 6) && (len != 7)) exit(1);
if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
exit(0);
}
int main() { foo("hello\n"); }
]])],[el_cv_HAVE_C99_VSNPRINTF=yes],[el_cv_HAVE_C99_VSNPRINTF=no],[el_cv_HAVE_C99_VSNPRINTF=cross])])
if test x"$el_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
EL_DEFINE(HAVE_C99_VSNPRINTF, [C99 compliant vsnprintf()])
fi
# OpenSSL and Lua frequently need dlopen
AC_CHECK_LIB(dl, dlopen)
# ===================================================================
# Checks for libraries.
# ===================================================================
AC_CHECK_FUNC(socket, cf_result=yes, cf_result=no)
if test "$cf_result" = no; then
AC_CHECK_LIB(socket, socket)
fi
AC_CHECK_FUNC(setsockopt, cf_result=yes, cf_result=no)
if test "$cf_result" = no; then
AC_CHECK_LIB(socket, setsockopt)
fi
AC_CHECK_FUNC(gethostbyname, cf_result=yes, cf_result=no)
if test "$cf_result" = no; then
AC_CHECK_LIB(socket, gethostbyname, cf_result=yes, cf_result=no)
if test "$cf_result" = no; then
AC_CHECK_LIB(nsl, gethostbyname)
else
test -z "`echo $LIBS | grep -- -lsocket`" && LIBS="$LIBS -lsocket"
fi
fi
# ===================================================================
# Checks for packaging specific options.
# ===================================================================
AC_ARG_WITH(xterm, [ --with-xterm how to invoke the X terminal emulator],
[ if test "$withval" != no && test "$withval" != yes; then
AC_DEFINE_UNQUOTED(CONFIG_XTERM, "$withval", [How to invoke XTerm])
fi ])
# ===================================================================
# Checks for a libraries, optional even if installed.
# ===================================================================
dnl EL_CHECK_OPTIONAL_LIBRARY(define, name, header, lib, function)
AC_DEFUN([EL_CHECK_OPTIONAL_LIBRARY],
[
AC_MSG_CHECKING([for $2 support])
if test "[$]$1" != no; then
AC_MSG_RESULT(yes)
EL_SAVE_FLAGS
if test -n "$withval" && test -d "$withval"; then
# Be a little more careful when setting
# include and lib directories. This way
# $withval will work when includes are
# there but the library is in the common
# /usr/lib ... Does the right thing when
# looking for gc on Debian.
if test -d "$withval/include"; then
CFLAGS="$CFLAGS -I$withval/include"
CPPFLAGS="$CPPFLAGS -I$withval/include"
else
CFLAGS="$CFLAGS -I$withval"
CPPFLAGS="$CPPFLAGS -I$withval"
fi
if test -d "$withval/lib"; then
LDFLAGS="$LDFLAGS -L$withval/lib"
fi
fi
AC_CHECK_HEADERS([$3], [$1=yes], [$1=no; break;])
if test "[$]$1" = yes; then
AC_CHECK_LIB([$4], [$5], [$1=yes], [$1=no])
fi
if test "[$]$1" = yes; then
EL_CONFIG([$1], [$2])
LIBS="-l$4 $LIBS"
else
if test -n "[$]WITHVAL_$1" &&
test "x[$]WITHVAL_$1" != xno; then
AC_MSG_ERROR([$2 not found])
fi
EL_RESTORE_FLAGS
fi
else
AC_MSG_RESULT(disabled)
fi
])
dnl EL_CONFIG_OPTIONAL_LIBRARY(define, name, header, lib, function, confhelp)
AC_DEFUN([EL_CONFIG_OPTIONAL_LIBRARY],
[
if test "x[$]$1" != xno; then $1=yes; fi
WITHVAL_$1=
AC_ARG_WITH([$2], [$6], [WITHVAL_$1="[$]withval"])
if test "x[$]WITHVAL_$1" = xno; then $1=no; fi
if test "x[$]WITHVAL_$1" = xyes; then $1=yes; fi
EL_CHECK_OPTIONAL_LIBRARY([$1], [$2], [$3], [$4], [$5])
EL_LOG_CONFIG([$1], [$2], [])
])
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GPM, gpm, gpm.h, gpm, Gpm_Open,
[ --without-gpm disable gpm (mouse) support])
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_TERMINFO, terminfo, term.h, tinfo, setupterm,
[ --with-terminfo enable terminfo support])
# ELinks calls deflateInit2 with windowBits = MAX_WBITS | 32, to
# enable automatic decoding of both zlib and gzip headers. This
# feature was added in zlib 1.2.0.2; earlier versions return an error.
# The gzclearerr function was also added in zlib 1.2.0.2, so check for
# that, even though ELinks does not actually call gzclearerr.
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_GZIP, zlib, zlib.h, z, gzclearerr,
[ --without-zlib disable zlib support])
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_BZIP2, bzlib, bzlib.h, bz2, BZ2_bzReadOpen,
[ --without-bzlib disable bzlib support])
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_ZSTD, zstd, zstd.h, zstd, ZSTD_createDCtx,
[ --with-zstd enable experimental zstd support])
# ===================================================================
# brotli
# ===================================================================
BROTLI_CFLAGS=
BROTLI_LIBS=
CONFIG_BROTLI=no
enable_brotli=no
AC_ARG_WITH(brotli, [ --with-brotli enable brotli],
[ if test "x$withval" != xno; then enable_brotli=yes; fi ])
if test "$enable_brotli" = no; then
AC_MSG_CHECKING([[for brotli]])
AC_MSG_RESULT([[disabled]])
else
AC_MSG_CHECKING([[for brotli in pkg-config]])
if $PKG_CONFIG $pkg_config_static libbrotlidec; then
BROTLI_CFLAGS=`$PKG_CONFIG $pkg_config_static --cflags libbrotlidec`
BROTLI_LIBS=`$PKG_CONFIG $pkg_config_static --libs libbrotlidec`
LIBS="$BROTLI_LIBS $LIBS"
CONFIG_BROTLI=yes
AC_DEFINE([CONFIG_BROTLI], [1], [Define as 1 to use the libbrotli library.])
AC_MSG_RESULT([[yes]])
else
enable_brotli=no
fi
fi
AC_SUBST(BROTLI_CFLAGS)
AC_SUBST(BROTLI_LIBS)
EL_LOG_CONFIG([CONFIG_BROTLI], [[brotli]], [[$enable_brotli]])
# LZMA disabled by default, because of little usability and compilation problems
# with new xz
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_LZMA, lzma, lzma.h, lzma, lzma_code,
[ --with-lzma enable lzma encoding support])
EL_CONFIG_OPTIONAL_LIBRARY(CONFIG_IDN2, idn2, idn2.h, idn2, idn2_lookup_ul,
[ --without-idn2 disable international domain names support])
# ===================================================================
# Check for GSSAPI, optional even if installed.
# ===================================================================
enable_gssapi="no";
AC_ARG_WITH(gssapi, [ --with-gssapi enable GSSAPI support],
[ if test "x$withval" != xno; then enable_gssapi=yes; fi ])
AC_MSG_CHECKING([for GSSAPI])
if test "$enable_gssapi" = "yes"; then
AC_MSG_RESULT(yes)
GSSAPI_CFLAGS=`krb5-config --cflags gssapi`
GSSAPI_LIBS=`krb5-config --libs gssapi`
CFLAGS="$GSSAPI_CFLAGS $CFLAGS"
LIBS="$GSSAPI_LIBS $LIBS"
EL_CONFIG(CONFIG_GSSAPI, [GssApi])
else
AC_MSG_RESULT(no)
fi
AC_SUBST(CONFIG_GSSAPI)
# ===================================================================
# Bookmark and XBEL support
# ===================================================================
EL_SAVE_FLAGS
EL_ARG_ENABLE(CONFIG_BOOKMARKS, bookmarks, [Bookmarks],
[ --disable-bookmarks disable bookmark support])
# Check whether --enable-xbel or --disable-xbel was given.
if test "x${enable_xbel}" != xno; then
AC_CHECK_HEADERS(expat.h, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
if test "$HAVE_LIBEXPAT" = yes; then
AC_CHECK_LIB(expat, XML_ParserCreate, HAVE_LIBEXPAT=yes, HAVE_LIBEXPAT=no)
if test "$HAVE_LIBEXPAT" = yes; then
LIBS="$LIBS -lexpat"
fi
fi
fi
EL_ARG_DEPEND(CONFIG_XBEL_BOOKMARKS, xbel, [CONFIG_BOOKMARKS:yes HAVE_LIBEXPAT:yes],
[XBEL bookmarks],
[ --disable-xbel disable XBEL bookmark support (requires expat)])
if test "$CONFIG_XBEL_BOOKMARKS" != yes; then
EL_RESTORE_FLAGS
fi
# ===================================================================
# Checks for BSD sysmouse
# ===================================================================
HAVE_SYSMOUSE_HEADER="no"
# Either of these header files provides the (same) sysmouse interface
AC_CHECK_HEADERS(sys/consio.h machine/console.h, [HAVE_SYSMOUSE_HEADER="yes"])
# ===================================================================
# Checks for OS/2
# ===================================================================
if test "$CONFIG_OS_OS2" = yes; then
EL_CONFIG_OS_OS2
fi
# ===================================================================
# Checks for Win32
# ===================================================================
if test "$CONFIG_OS_WIN32" = yes; then
EL_CONFIG_OS_WIN32
fi
# ===================================================================
# Check for MuJS
# ===================================================================
AC_ARG_WITH([mujs],
[AS_HELP_STRING([--with-mujs],
[enable MuJS engine])])
CONFIG_MUJS=
CONFIG_LIBCURL=
case "$with_mujs" in
"" | no)
# The user specified --without-mujs.
AC_MSG_CHECKING([for MuJS])
AC_MSG_RESULT([disabled])
CONFIG_MUJS="no"
;;
yes)
;;
*)
;;
esac
if test "x$CONFIG_MUJS" = x; then
AC_MSG_CHECKING([for MuJS in pkg-config])
if $PKG_CONFIG $pkg_config_static --cflags --libs mujs > /dev/null 2>&AS_MESSAGE_LOG_FD; then
DB_LOCALSTORAGE_LIBS="$($PKG_CONFIG $pkg_config_static --libs sqlite3)"
CURL_LIBS="$($PKG_CONFIG $pkg_config_static --libs libcurl)"
MUJS_LIBS="$($PKG_CONFIG $pkg_config_static --libs mujs) $DB_LOCALSTORAGE_LIBS $XMLPLUSPLUS_LIBS $CURL_LIBS"
DB_LOCALSTORAGE_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags sqlite3)"
CURL_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libcurl)"
MUJS_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags mujs) $DB_LOCALSTORAGE_CFLAGS $XMLPLUSPLUS_CFLAGS $CURL_CFLAGS"
LIBS="$LIBS $MUJS_LIBS"
CPPFLAGS="$CPPFLAGS_X $MUJS_CFLAGS"
CFLAGS="$CFLAGS $MUJS_CFLAGS"
CONFIG_MUJS=yes
CONFIG_LIBCURL=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
# ===================================================================
# Check for QuickJS
# ===================================================================
AC_ARG_WITH([quickjs],
[AS_HELP_STRING([--with-quickjs],
[enable Quickjs engine])])
CONFIG_QUICKJS=
case "$with_quickjs" in
"" | no)
# The user specified --without-quickjs.
AC_MSG_CHECKING([for QuickJS])
AC_MSG_RESULT([disabled])
CONFIG_QUICKJS="no"
;;
yes)
;;
*)
;;
esac
if test "x$CONFIG_QUICKJS" = x; then
AC_MSG_CHECKING([for QuickJS])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[
#include <quickjs/quickjs.h>
]], [])],
[CONFIG_QUICKJS=yes
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([not found])]
)
if test "x$CONFIG_QUICKJS" = xyes; then
DB_LOCALSTORAGE_LIBS="$($PKG_CONFIG $pkg_config_static --libs sqlite3)"
CURL_LIBS="$($PKG_CONFIG $pkg_config_static --libs libcurl)"
DB_LOCALSTORAGE_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags sqlite3)"
CURL_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libcurl)"
CFLAGS="$CFLAGS $DB_LOCALSTORAGE_CFLAGS $XMLPLUSPLUS_CFLAGS $CURL_CFLAGS"
QUICKJS_LIB="/usr/local/lib/quickjs/libquickjs.a"
for p in $(echo "$LIBRARY_PATH" | tr ':' '\n'); do
if test -f "$p/quickjs/libquickjs.a" ; then
QUICKJS_LIB="$p/quickjs/libquickjs.a"
break
fi
done
LIBS="$LIBS $DB_LOCALSTORAGE_LIBS $XMLPLUSPLUS_LIBS $QUICKJS_LIB $CURL_LIBS"
CONFIG_LIBCURL=yes
else
AC_MSG_RESULT([no])
fi
fi
# ===================================================================
# Check for SpiderMonkey, optional even if installed.
# ===================================================================
# This option sets the $with_spidermonkey variable.
AC_ARG_WITH([spidermonkey],
[AS_HELP_STRING([--with-spidermonkey],
[enable SpiderMonkey Mozilla Javascript engine])])
# CONFIG_SPIDERMONKEY is initially blank. We change it to "yes" or "no"
# when we know for sure whether we're going to use SpiderMonkey or not.
# (features.conf is not supposed to define it.)
CONFIG_SPIDERMONKEY=
CONFIG_LIBDOM=
CONFIG_SCRIPTING_SPIDERMONKEY=
EL_SAVE_FLAGS
# ===================================================================
# Optional Spidermonkey-based ECMAScript browser scripting
# ===================================================================
AC_ARG_ENABLE(sm-scripting,
[ --enable-sm-scripting enable ECMAScript browser scripting],
[if test "$enableval" != no; then enableval="yes"; fi
CONFIG_SCRIPTING_SPIDERMONKEY="$enableval";])
case "$with_spidermonkey" in
"" | no)
# The user specified --without-spidermonkey.
# That overrides the other SpiderMonkey options.
AC_MSG_CHECKING([for SpiderMonkey])
AC_MSG_RESULT([disabled])
CONFIG_SPIDERMONKEY="no"
;;
yes)
CONFIG_SPIDERMONKEY="yes"
;;
*)
AC_MSG_WARN([This version of ELinks does not support --with-spidermonkey=DIRECTORY.])
;;
esac
SPIDERMONKEY_FOUND=
if test "x$CONFIG_SPIDERMONKEY" = xyes ||
test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
package=mozjs-128
AC_MSG_CHECKING([for SpiderMonkey (mozjs-128) in pkg-config $package])
if $PKG_CONFIG $pkg_config_static --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then
DB_LOCALSTORAGE_LIBS="$($PKG_CONFIG $pkg_config_static --libs sqlite3)"
CURL_LIBS="$($PKG_CONFIG $pkg_config_static --libs libcurl)"
SPIDERMONKEY_LIBS="$($PKG_CONFIG $pkg_config_static --libs $package) $DB_LOCALSTORAGE_LIBS $XMLPLUSPLUS_LIBS $CURL_LIBS"
DB_LOCALSTORAGE_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags sqlite3)"
CURL_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libcurl)"
SPIDERMONKEY_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags $package) $DB_LOCALSTORAGE_CFLAGS $XMLPLUSPLUS_CFLAGS $CURL_CFLAGS"
LIBS="$SPIDERMONKEY_LIBS $LIBS_X"
CPPFLAGS="$CPPFLAGS_X $SPIDERMONKEY_CFLAGS"
SPIDERMONKEY_FOUND=yes
CONFIG_LIBCURL=yes
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
fi
if test -z "$SPIDERMONKEY_FOUND"; then
# Didn't find SpiderMonkey anywhere.
CONFIG_SPIDERMONKEY=no
CONFIG_SCRIPTING_SPIDERMONKEY=no
fi
EL_RESTORE_FLAGS
if test "x$CONFIG_SPIDERMONKEY" = xyes; then
CONFIG_LIBDOM=yes
EL_CONFIG(CONFIG_ECMASCRIPT_SMJS, [SpiderMonkey document scripting])
else
CONFIG_ECMASCRIPT_SMJS=no
fi
EL_CONFIG_DEPENDS(CONFIG_ECMASCRIPT, [CONFIG_ECMASCRIPT_SMJS CONFIG_MUJS CONFIG_QUICKJS CONFIG_SCRIPTING_SPIDERMONKEY], [ECMAScript (JavaScript)])
AC_SUBST(CONFIG_ECMASCRIPT_SMJS)
if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes &&
test "x$HAVE_JS_TRIGGEROPERATIONCALLBACK" = xyes &&
test "x$HAVE_SETITIMER" = xyes; then
EL_CONFIG(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT, [ECMAScript heartbeat support])
else
CONFIG_ECMASCRIPT_SMJS_HEARTBEAT=no
fi
AC_SUBST(CONFIG_ECMASCRIPT_SMJS_HEARTBEAT)
if test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
EL_CONFIG(CONFIG_SCRIPTING_SPIDERMONKEY, [SpiderMonkey])
else
CONFIG_SCRIPTING_SPIDERMONKEY=no
fi
CXXFLAGS="$CXXFLAGS -fpermissive -Wno-sign-compare"
if test "x$CONFIG_ECMASCRIPT_SMJS" = xyes ||
test "x$CONFIG_SCRIPTING_SPIDERMONKEY" = xyes; then
LIBS="$LIBS $SPIDERMONKEY_LIBS"
EL_CONFIG(CONFIG_LIBCURL, [libcurl])
AC_SUBST(SPIDERMONKEY_LIBS)
AC_SUBST(SPIDERMONKEY_CFLAGS)
AC_SUBST(CONFIG_SPIDERMONKEY)
AC_SUBST(CONFIG_LIBCURL)
CXXFLAGS="$CXXFLAGS $SPIDERMONKEY_CFLAGS"
fi
if test "x$CONFIG_MUJS" = xyes; then
CONFIG_LIBDOM=yes
EL_CONFIG(CONFIG_MUJS, [mujs])
EL_CONFIG(CONFIG_LIBCURL, [libcurl])
AC_SUBST(MUJS_LIBS)
AC_SUBST(MUJS_CFLAGS)
AC_SUBST(CONFIG_MUJS)
AC_SUBST(CONFIG_LIBCURL)
fi
if test "x$CONFIG_QUICKJS" = xyes; then
CONFIG_LIBDOM=yes
EL_CONFIG(CONFIG_QUICKJS, [quickjs])
EL_CONFIG(CONFIG_LIBCURL, [libcurl])
AC_SUBST(CONFIG_QUICKJS)
AC_SUBST(CONFIG_LIBCURL)
fi
# ===================================================================
# Check for libcurl
# ===================================================================
AC_ARG_WITH([libcurl],
[AS_HELP_STRING([--with-libcurl],
[enable curl])])
if test "x$CONFIG_LIBCURL" = x; then
case "$with_libcurl" in
"" | no)
# The user specified --without-libcurl.
AC_MSG_CHECKING([for libcurl])
AC_MSG_RESULT([disabled])
CONFIG_LIBCURL="no"
;;
yes | *)
AC_MSG_CHECKING([for libcurl])
CURL_LIBS="$($PKG_CONFIG $pkg_config_static --libs libcurl)"
CURL_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libcurl)"
CONFIG_LIBCURL=yes
LIBS="$LIBS $CURL_LIBS"
CFLAGS="$CFLAGS $CURL_CFLAGS"
EL_CONFIG(CONFIG_LIBCURL, [libcurl])
AC_MSG_RESULT([yes])
;;
esac
AC_SUBST(CONFIG_LIBCURL)
fi
# ===================================================================
# Check for libcss
# ===================================================================
AC_ARG_WITH([libcss],
[AS_HELP_STRING([--with-libcss],
[compile with libcss])])
CONFIG_LIBCSS=
case "$with_libcss" in
"" | no)
;;
yes)
CONFIG_LIBDOM=yes
;;
*)
;;
esac
if test "x$CONFIG_LIBDOM" = xyes; then
LIBCSS_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libcss)"
LIBCSS_LIBS="$($PKG_CONFIG $pkg_config_static --libs libcss)"
LIBS="$LIBCSS_LIBS $LIBS"
CFLAGS="$CFLAGS $LIBCSS_CFLAGS"
CONFIG_LIBCSS=yes
EL_CONFIG(CONFIG_LIBCSS, [libcss])
AC_SUBST(LIBCSS_CFLAGS)
AC_SUBST(LIBCSS_LIBS)
AC_SUBST(CONFIG_LIBCSS)
fi
# ===================================================================
# Check for libdom
# ===================================================================
if test "x$CONFIG_LIBDOM" = xyes; then
LIBDOM_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libdom)"
LIBDOM_LIBS="$($PKG_CONFIG $pkg_config_static --libs libdom)"
LIBS="$LIBDOM_LIBS $LIBS"
CFLAGS="$CFLAGS $LIBDOM_CFLAGS"
CONFIG_LIBDOM=yes
EL_CONFIG(CONFIG_LIBDOM, [libdom])
AC_SUBST(LIBDOM_CFLAGS)
AC_SUBST(LIBDOM_LIBS)
AC_SUBST(CONFIG_LIBDOM)
fi
# ===================================================================
# Check for libsixel
# ===================================================================
AC_ARG_WITH([libsixel],
[AS_HELP_STRING([--with-libsixel],
[enable sixel graphics])])
CONFIG_LIBSIXEL=
case "$with_libsixel" in
"" | no)
# The user specified --without-libsixel.
AC_MSG_CHECKING([for libsixel])
AC_MSG_RESULT([disabled])
CONFIG_LIBSIXEL="no"
;;
yes)
;;
*)
;;
esac
if test "x$CONFIG_LIBSIXEL" = x; then
LIBSIXEL_CFLAGS="$($PKG_CONFIG $pkg_config_static --cflags libsixel)"
LIBSIXEL_LIBS="$($PKG_CONFIG $pkg_config_static --libs libsixel)"
LIBS="$LIBSIXEL_LIBS $LIBS"
CFLAGS="$CFLAGS $LIBSIXEL_CFLAGS"
CONFIG_LIBSIXEL=yes
EL_CONFIG(CONFIG_LIBSIXEL, [libsixel])
AC_SUBST(CONFIG_LIBSIXEL)
fi
# ===================================================================
# Check for Guile, optional even if installed.
# ===================================================================
enable_guile="no";
AC_ARG_WITH(guile, [ --with-guile enable Guile support],
[ if test "x$withval" != xno; then enable_guile=yes; fi ])
# The following is probably bad, ugly and so on. Stolen from Guile's (1.4)
# GUILE_FLAGS but I really don't want to require people to have Guile in order
# to compile CVS. Also, the macro seems to be really stupid regarding searching
# for Guile in $PATH etc. --pasky
AC_MSG_CHECKING([for Guile])
if test "$enable_guile" = "yes"; then
AC_MSG_RESULT(yes);
## Based on the GUILE_FLAGS macro.
if test -d "$withval"; then
GUILE_PATH="$withval:$PATH"
else
GUILE_PATH="$PATH"
fi
AC_PATH_PROG(GUILE_CONFIG, guile-config, no, $GUILE_PATH)
## First, let's just see if we can find Guile at all.
if test "$GUILE_CONFIG" != no; then
cf_result="yes";
GUILE_LIBS="`guile-config link`"
GUILE_CFLAGS="`guile-config compile`"
LIBS="$GUILE_LIBS $LIBS"
EL_CONFIG(CONFIG_SCRIPTING_GUILE, [Guile])
AC_SUBST(GUILE_CFLAGS)
cat <<EOF
***********************************************************************
The Guile support is incomplete and not so well integrated to ELinks
yet. That means, e.g., that you have no Guile console and there might
not be all the necessary hooks. Also, the Guile interface is not too
well tested (success stories heartily welcomed!). See
src/scripting/guile/README for further details and hints.
***********************************************************************
EOF
else
if test -n "$withval" && test "x$withval" != xno; then
AC_MSG_ERROR([Guile not found])
else
AC_MSG_WARN([Guile support disabled])
fi
fi
else
AC_MSG_RESULT(no);
fi
# ===================================================================
# Check for Perl
# ===================================================================
enable_perl="no";
AC_ARG_WITH(perl, [ --with-perl enable Perl support],
[
if test "$withval" = yes; then
# FIXME: If withval is a valid directory append it to PATH
# so that you can specify one of several perl installations.
withval="";
enable_perl=yes;
fi
])
AC_MSG_CHECKING([for Perl])
cf_result=no
EL_SAVE_FLAGS
if test "$enable_perl" = "yes"; then
PERL_LIBS="`perl -MExtUtils::Embed -e ldopts`"
PERL_CFLAGS="`perl -MExtUtils::Embed -e ccopts`"
LIBS="$PERL_LIBS $LIBS"
CFLAGS="$PERL_CFLAGS $CFLAGS"
CPPFLAGS="$CPPFLAGS $PERL_CFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <EXTERN.h>
#include <perl.h>
#include <perlapi.h>
]], [[PerlInterpreter *my_perl = perl_alloc();]])],[cf_result=yes],[cf_result=no])
fi
if test "$cf_result"; then AC_MSG_RESULT($cf_result); fi
AC_MSG_CHECKING([whether POPpx works without an n_a variable])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <EXTERN.h>
#include <perl.h>
extern PerlInterpreter *my_perl;
]], [[dSP; (void) POPpx;]])],[AC_MSG_RESULT([yes])
AC_DEFINE([CONFIG_PERL_POPPX_WITHOUT_N_A], [1],
[Define if using Perl 5.8.8 or later, where the "POPpx" macro
no longer needs an "n_a" variable like it did in 5.8.7])],[AC_MSG_RESULT([no])])
if test "$cf_result" != "yes"; then
EL_RESTORE_FLAGS
else
EL_CONFIG(CONFIG_SCRIPTING_PERL, [Perl])
CFLAGS="$CFLAGS_X"
CPPFLAGS="$CPPFLAGS_X"
AC_SUBST(PERL_LIBS)
AC_SUBST(PERL_CFLAGS)
fi
# ===================================================================
# Check for Python
# ===================================================================
enable_python="no";
AC_ARG_WITH(python, [[ --with-python[=DIR] enable Python support]],
[ if test "x$withval" != xno; then enable_python=yes; fi ])
EL_SAVE_FLAGS
cf_result=no
AC_MSG_CHECKING([for Python3])
if test "$enable_python" = "yes"; then
AC_MSG_RESULT(yes);
if test -d "$withval"; then
PYTHON_PATH="$withval:$PATH"
else
PYTHON_PATH="$PATH"
fi
AC_PATH_PROG(PYTHON3, python3, no, $PYTHON_PATH)
if test "$PYTHON3" != no; then
cf_result="yes";
PYTHON_CFLAGS="`$PYTHON3 -c 'from distutils import sysconfig; print("-I%s -I%s" % (sysconfig.get_python_inc(), sysconfig.get_python_inc(plat_specific=True)))'`"
PYTHON_LIBS="`$PYTHON3 -c 'from distutils import sysconfig; var = sysconfig.get_config_var; print("%s %s %s -L%s -lpython%s" % (var("LINKFORSHARED"), var("LIBS"), var("SYSLIBS"), var("LIBPL"), var("VERSION")))'`"
LIBS="$PYTHON_LIBS $LIBS"
CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <Python.h>]], [[Py_Initialize();]])],[cf_result=yes],[cf_result=no])
if test "$cf_result" != "yes"; then
EL_RESTORE_FLAGS
else
EL_CONFIG(CONFIG_SCRIPTING_PYTHON, [Python3])
AC_SUBST(PYTHON_LIBS)
AC_SUBST(PYTHON_CFLAGS)
CPPFLAGS="$CPPFLAGS_X"
cat <<EOF
***********************************************************************
The Python support is incomplete and not so well integrated to ELinks
yet. That means, e.g., that you have no Python console and there might
not be all the necessary hooks. Also, the Python interface is not too
well tested (success stories heartily welcomed!).
***********************************************************************
EOF
fi
else
if test -n "$withval" && test "x$withval" != xno; then
AC_MSG_ERROR([Python3 not found])
else
AC_MSG_WARN([Python3 support disabled])
fi
fi
else
AC_MSG_RESULT(no);
fi
# ===================================================================
# Check for Lua, optional even if installed.
# ===================================================================
luapkg=
AC_ARG_WITH(luapkg, [ --with-luapkg=name choose Lua version],
[luapkg="$withval"])
AC_MSG_CHECKING([for Lua])
EL_SAVE_FLAGS
cf_result=no
if test -n "$luapkg" && $PKG_CONFIG $pkg_config_static "$luapkg"; then
LUA_CFLAGS=`$PKG_CONFIG $pkg_config_static --cflags "$luapkg"`
LUA_LIBS=`$PKG_CONFIG $pkg_config_static --libs "$luapkg"`
CFLAGS="$CFLAGS_X $LUA_CFLAGS"
CPPFLAGS="$CPPFLAGS_X $LUA_CFLAGS"
LIBS="$LUA_LIBS $LIBS_X"
# Check that it is a compatible Lua version
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef __cplusplus
extern "C" {
#endif
#include <lauxlib.h>
#include <lua.h>
#include <lualib.h>
#ifdef __cplusplus
}
#endif
]], [[lua_State *L = luaL_newstate();
luaL_openlibs(L);
lua_pushboolean(L, 1);
lua_close(L);]])],[cf_result=yes],[cf_result=no])
fi
AC_MSG_RESULT($cf_result)
if test "$cf_result" != yes; then
EL_RESTORE_FLAGS
else
EL_CONFIG(CONFIG_SCRIPTING_LUA, [Lua])
AC_CHECK_HEADERS(lauxlib.h)
CFLAGS="$CFLAGS_X"
CPPFLAGS="$CPPFLAGS_X"
AC_SUBST(LUA_LIBS)
AC_SUBST(LUA_CFLAGS)
fi
# ===================================================================
# Check for TRE library
# ===================================================================
#
# This section only checks that --without-tre is not given and the
# library seems to work, and sets TRE_CFLAGS, TRE_LIBS, and
# tre_log. It does not define CONFIG_TRE, and always resets
# LIBS and CFLAGS back to their original values.
#
# After any --enable-utf-8 and --disable-utf-8 options have been
# handled, a separate section decides whether to actually use TRE.
#
# tre version 0.8.0 or higher is required which have the "tre_" prefix
# for functions.
AC_ARG_WITH([[tre]], [[ --without-tre disable TRE regex search support]])
if test "$with_tre" = no; then
AC_MSG_CHECKING([[for TRE]])
AC_MSG_RESULT([[disabled]])
tre_log="no (explicitly disabled)"
else
AC_MSG_CHECKING([[for TRE in pkg-config]])
if $PKG_CONFIG $pkg_config_static tre; then
TRE_CFLAGS=`$PKG_CONFIG $pkg_config_static --cflags tre`
TRE_LIBS=`$PKG_CONFIG $pkg_config_static --libs tre`
AC_MSG_RESULT([[yes]])
else
# <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=513055>
# "libtre-dev: /usr/lib/pkgconfig/tre.pc missing"
# so we look for the library even if pkg-config doesn't know about it.
TRE_CFLAGS=
TRE_LIBS=-ltre
AC_MSG_RESULT([[no, but let's try defaults]])
fi
AC_MSG_CHECKING([[for TRE header and library]])
EL_SAVE_FLAGS
CFLAGS="$TRE_CFLAGS $CFLAGS"
LIBS="$TRE_LIBS $LIBS" # must be first, because of regfree conflict
AC_TRY_LINK([#include <tre/tre.h>],
[regex_t re;
regmatch_t match[1];
tre_regwcomp(&re, L"zap", REG_ICASE);
tre_regwexec(&re, L"ELIZAPROGRAM", 1, match, 0);],
[AC_MSG_RESULT([[yes]])
tre_log="available"],
[AC_MSG_RESULT([[no]])
tre_log="no (TRE not found)"])
EL_RESTORE_FLAGS
fi
# ===================================================================
# Check for Ruby, optional even if installed.
# ===================================================================
EL_CONFIG_SCRIPTING_RUBY
# ===================================================================
# Setup global scripting
# ===================================================================
EL_CONFIG_DEPENDS(CONFIG_SCRIPTING, [CONFIG_SCRIPTING_GUILE CONFIG_SCRIPTING_LUA CONFIG_SCRIPTING_PERL CONFIG_SCRIPTING_PYTHON CONFIG_SCRIPTING_RUBY CONFIG_SCRIPTING_SPIDERMONKEY], [Browser scripting])
AC_SUBST(CONFIG_SCRIPTING_GUILE)
AC_SUBST(CONFIG_SCRIPTING_LUA)
AC_SUBST(CONFIG_SCRIPTING_PERL)
AC_SUBST(CONFIG_SCRIPTING_PYTHON)
AC_SUBST(CONFIG_SCRIPTING_RUBY)
AC_SUBST(CONFIG_SCRIPTING_SPIDERMONKEY)
AC_SUBST(CONFIG_SCRIPTING)
# ===================================================================
# Check for SSL support.
# ===================================================================
# We by default use OpenSSL, and we always prefer it. However, when GNUTLS
# is enabled, we won't try to use OpenSSL anymore.
# For wiping SSL hooks..
#ifdef CONFIG_SSL
chosen_ssl_library=""
AC_ARG_WITH(gnutls, [[ --without-gnutls disable GNUTLS SSL support]])
AC_ARG_WITH(gnutls, [[ --with-gnutls enable GNUTLS SSL support]],
[case "$with_gnutls" in
"no") : ;;
"yes") chosen_ssl_library="GNUTLS" ;;
*) chosen_ssl_library="GNUTLS"
AC_MSG_WARN([[Support for --with-gnutls=DIR has been removed.
You may have to set the PKG_CONFIG $pkg_config_static_PATH environment variable instead.]]) ;;
esac])
AC_ARG_WITH(openssl, [[ --without-openssl disable OpenSSL support]])
AC_ARG_WITH(openssl, [[ --with-openssl[=DIR] enable OpenSSL support (default)]],
[case "$with_openssl" in
"no") : ;;
*) chosen_ssl_library="OpenSSL" ;;
esac])
AC_ARG_WITH(nss_compat_ossl, [[ --with-nss_compat_ossl[=DIR]
NSS compatibility SSL libraries/include files]],
[case "$with_nss_compat_ossl" in
"no") : ;;
*) chosen_ssl_library="nss_compat_ossl" ;;
esac])
# ---- nss_compat_ossl
if test "$with_nss_compat_ossl" = no; then
# explicitly disabled
:
elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "nss_compat_ossl"; then
# not used, because $chosen_ssl_library was chosen
:
elif test -z "${with_nss_compat_ossl+set}"; then
# SSL_library_init() in nss_compat_ossl 0.9.2 calls exit(1)
# with no error message if there is no certificate database.
# https://bugzilla.redhat.com/show_bug.cgi?id=463437
# So ELinks uses nss_compat_ossl only if explicitly requested.
:
else
EL_SAVE_FLAGS
if test "$with_nss_compat_ossl" = yes; then
if $PKG_CONFIG $pkg_config_static nss; then
CFLAGS="$CFLAGS_X `$PKG_CONFIG $pkg_config_static --cflags nss`"
LIBS="$LIBS_X `$PKG_CONFIG $pkg_config_static --libs nss`"
else
with_nss_compat_ossl=no
fi
else
# Without pkg-config, we'll kludge in some defaults
CFLAGS="$CFLAGS_X -I$with_nss_compat_ossl/include -I/usr/include/nss3 -I/usr/include/nspr4"
LIBS="$LIBS_X -L$with_nss_compat_ossl/lib -lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lpthread -ldl"
fi
AC_CHECK_HEADERS(nss_compat_ossl/nss_compat_ossl.h,, [with_nss_compat_ossl=no], [#define NSS_COMPAT_OSSL_H])
AC_CHECK_LIB(nss_compat_ossl, X509_free,, [with_nss_compat_ossl=no])
if test "$with_nss_compat_ossl" = "no"; then
EL_RESTORE_FLAGS
else
LIBS="$LIBS -lnss_compat_ossl"
EL_CONFIG(CONFIG_NSS_COMPAT_OSSL, [nss_compat_ossl])
chosen_ssl_library="nss_compat_ossl"
fi
fi
# ---- OpenSSL
AC_MSG_CHECKING([for OpenSSL])
EL_SAVE_FLAGS
if test "$with_openssl" = no; then
cf_result="explicitly disabled"
elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "OpenSSL"; then
cf_result="not used, because $chosen_ssl_library was chosen"
else
cf_result=no
for ssldir in "$with_openssl" "" /usr /usr/local/openssl \
/usr/lib/openssl /usr/local/ssl \
/usr/local/www /usr/lib/ssl /usr/local \
/usr/pkg /opt /opt/openssl; do
if test "$cf_result" = no; then
if test -d "$ssldir"; then
OPENSSL_CFLAGS="-I$ssldir/include"
LIBS="-L$ssldir/lib -lssl -lcrypto $LIBS_X"
CFLAGS="$CFLAGS_X $OPENSSL_CFLAGS"
CPPFLAGS="$CPPFLAGS_X $OPENSSL_CFLAGS"
# # FIXME: This created serious portability problems. --pasky
# if test "$CC" == "gcc"; then
# # I'm not sure about compatibility here. --pasky
# LIBS="$LIBS -R$ssldir/lib"
# fi
else
LIBS="-lssl -lcrypto $LIBS_X"
fi
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[OpenSSL_add_all_algorithms()]])],[cf_result=yes],[cf_result=no])
if test "$cf_result" != yes; then
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <openssl/ssl.h>]], [[SSLeay_add_ssl_algorithms()]])],[cf_result=yes],[cf_result=no])
fi
fi
done
if test "$cf_result" != yes; then
if test "${with_openssl-no}" != "no"; then
AC_MSG_ERROR([OpenSSL not found])
fi
EL_RESTORE_FLAGS
else
EL_CONFIG(CONFIG_OPENSSL, [OpenSSL])
chosen_ssl_library="OpenSSL"
AC_CHECK_FUNCS(RAND_bytes RAND_add)
AC_CHECK_FUNCS(ASN1_STRING_get0_data)
CFLAGS="$CFLAGS_X"
AC_SUBST(OPENSSL_CFLAGS)
fi
fi
AC_MSG_RESULT($cf_result)
# ---- GNU TLS
# GnuTLS 2.2.0 changed libgnutls-openssl from GPLv2+
# to GPLv3+. Don't link that with the GPLv2 ELinks.
# ELinks will use its internal MD5 code instead.
CONFIG_GNUTLS_OPENSSL_COMPAT=no
if test "$with_gnutls" = no; then
AC_MSG_CHECKING([[for GNUTLS]])
AC_MSG_RESULT([[explicitly disabled]])
elif test -n "$chosen_ssl_library" && test "$chosen_ssl_library" != "GNUTLS"; then
AC_MSG_CHECKING([[for GNUTLS]])
AC_MSG_RESULT([[not used, because $chosen_ssl_library was chosen]])
else
cf_result=no
AC_MSG_CHECKING([[for GNUTLS (1.2 or later) in pkg-config]])
if $PKG_CONFIG $pkg_config_static --atleast-version=1.2 gnutls; then
GNUTLS_CFLAGS=`$PKG_CONFIG $pkg_config_static --cflags gnutls`
GNUTLS_LIBS=`$PKG_CONFIG $pkg_config_static --libs gnutls`
AC_MSG_RESULT([[yes: $GNUTLS_CFLAGS $GNUTLS_LIBS]])
EL_SAVE_FLAGS
LIBS="$GNUTLS_LIBS $LIBS"
CFLAGS="$CFLAGS $GNUTLS_CFLAGS"
CPPFLAGS="$CPPFLAGS $GNUTLS_CFLAGS"
# Verify if it's really usable. gnutls_session was
# renamed to gnutls_session_t before GNU TLS 1.2.0
# (on 2004-06-13); ELinks now requires this.
AC_MSG_CHECKING([[whether GNUTLS can be linked with]])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gnutls/gnutls.h>]],
[[gnutls_session_t dummy;
gnutls_check_version(NULL)]])],
[cf_result=yes],
[cf_result=no])
AC_MSG_RESULT([[$cf_result]])
if test "$cf_result" = yes; then
# According to gnutls/NEWS, the function was originally
# added as gnutls_set_default_priority2 in GNUTLS 2.1.4
# (released 2007-10-27) and then renamed to
# gnutls_priority_set_direct in GNUTLS 2.1.7 (released
# 2007-11-29).
AC_CHECK_FUNCS([gnutls_priority_set_direct])
AC_CHECK_FUNCS([gnutls_certificate_set_x509_system_trust])
fi
EL_RESTORE_FLAGS
else
AC_MSG_RESULT([[$cf_result]])
fi
if test "$cf_result" = yes; then
EL_CONFIG(CONFIG_GNUTLS, [GNUTLS])
chosen_ssl_library="GNUTLS"
AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no, $PATH)
if test "$LIBGCRYPT_CONFIG" = no; then
AC_MSG_ERROR([[libgcrypt-config not found.]])
fi
# gcry_create_nounce is part of libgcrypt
LIBGCRYPT_CFLAGS=`libgcrypt-config --cflags`
LIBGCRYPT_LIBS=`libgcrypt-config --libs`
LIBS="$LIBGCRYPT_LIBS $GNUTLS_LIBS $LIBS"
AC_SUBST(LIBGCRYPT_CFLAGS)
AC_SUBST(GNUTLS_CFLAGS)
elif test "${with_gnutls-no}" != "no"; then
AC_MSG_ERROR([[GNUTLS (1.2 or later) not found. ELinks no longer supports GNUTLS 1.1.]])
fi
fi
# ========
# libevent
# ========
CONFIG_LIBEV=no
AC_ARG_WITH(libev, [ --with-libev compile with libev (libevent compatibility mode)],
[if test "$withval" = yes; then enable_libev=yes; else enable_libev=no; fi])
cf_have_libev=no
if test "$enable_libev" = yes; then
AC_CHECK_HEADERS(event.h libev/event.h)
if test "$ac_cv_header_event_h" = yes -o "$ac_cv_header_libev_event_h"; then
AC_CHECK_LIB(ev, event_loop)
if test "$ac_cv_lib_ev_event_loop" = yes; then
cf_have_libev=yes
EL_CONFIG(CONFIG_LIBEV, [libev])
fi
fi
fi
AC_SUBST(CONFIG_LIBEV)
AC_ARG_WITH(libevent, [ --with-libevent compile with libevent. Note that --with-libev has precedence],
[if test "$withval" = yes; then enable_libevent=yes; else enable_libevent=no; fi])
CONFIG_LIBEVENT=no
cf_have_libevent=no
if test "$enable_libevent" = yes -a "$cf_have_libev" = no; then
AC_CHECK_HEADERS(event2/event.h ev-event.h)
if test "$ac_cv_header_event2_event_h" = yes; then
AC_CHECK_LIB(event, event_loop)
if test "$ac_cv_lib_event_event_loop" = yes; then
cf_have_libevent=yes
EL_CONFIG(CONFIG_LIBEVENT, [libevent])
fi
fi
fi
AC_SUBST(CONFIG_LIBEVENT)
if test "$cf_have_libev" = yes -o "$cf_have_libevent" = yes; then
AC_HAVE_FUNCS(event_base_set event_get_version event_get_method event_base_free event_base_new event_reinit event_base_get_method event_config_set_flag event_get_struct_event_size)
fi
EL_LOG_CONFIG([CONFIG_LIBEV], [[libev]], [[$cf_have_libev]])
EL_LOG_CONFIG([CONFIG_LIBEVENT], [[libevent]], [[$cf_have_libevent]])
# Final SSL setup
EL_CONFIG_DEPENDS(CONFIG_SSL, [CONFIG_OPENSSL CONFIG_GNUTLS CONFIG_NSS_COMPAT_OSSL], [SSL])
AC_SUBST(CONFIG_GNUTLS_OPENSSL_COMPAT)
AC_SUBST(CONFIG_OPENSSL)
AC_SUBST(CONFIG_GNUTLS)
AC_SUBST(CONFIG_NSS_COMPAT_OSSL)
#endif
AC_MSG_CHECKING([whether to be or not to be])
AC_MSG_RESULT([needs to be determined experimentally])
# ===================================================================
# Check for IPv6 support and related functions.
# ===================================================================
EL_CHECK_NET_TYPE(struct sockaddr_storage, HAVE_SA_STORAGE, [])
EL_CHECK_NET_TYPE(struct sockaddr_in6, HAVE_SA_IN6, [#include <netinet/in.h>])
EL_CHECK_NET_TYPE(struct addrinfo, HAVE_ADDRINFO, [#include <netdb.h>])
AC_CHECK_FUNC(getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
if test "$HAVE_GETADDRINFO" != yes; then
AC_CHECK_LIB(inet6, getaddrinfo, HAVE_GETADDRINFO=yes, HAVE_GETADDRINFO=no)
if test "$HAVE_GETADDRINFO" = yes; then
LIBS="$LIBS -linet6"
fi
fi
# ===================================================================
# Checking for X11 (window title restoring).
# ===================================================================
AC_PATH_X
if test x"$no_x" != xyes; then
EL_SAVE_FLAGS
if test -n "$x_includes"; then
X_CFLAGS="-I$x_includes"
CPPFLAGS="$CPPLAGS $X_CFLAGS"
CFLAGS="$CFLAGS $X_CFLAGS"
fi
if test -n "$x_libraries"; then
LDFLAGS="$LDFLAGS -L$x_libraries"
fi
LIBS="-lX11 $LIBS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlib.h>]], [[XrmInitialize()]])],[cf_result=yes],[cf_result=no])
EL_RESTORE_FLAGS
if test "$cf_result" = yes; then
if test -n "$x_libraries"; then
LDFLAGS="$LDFLAGS -L$x_libraries"
fi
LIBS="-lX11 $LIBS"
EL_DEFINE(HAVE_X11, [X11 for restoring window titles])
AC_SUBST(X_CFLAGS)
fi
fi
# ===================================================================
# Backtraces displaying support.
# ===================================================================
AC_CHECK_HEADERS(execinfo.h, HAVE_EXECINFO=yes, HAVE_EXECINFO=no)
# possible checks for other system-specific means go here
# ===================================================================
# Gettext grey zone. Beware.
# ===================================================================
ALL_LINGUAS="af be bg ca cs da de el es et fi fr gl hr hu id is it ja lt nl nb pl pt pt_BR ro ru sk sr sv tr uk"
AM_GNU_GETTEXT
# iconv is always used
LIBS="$LIBS $LIBICONV"
dnl AC_MSG_CHECKING([how many characters your English alphabet has])
dnl # f33r d4 l33t... I hope it's portable. :)
dnl cf_result=$((48#z - 48#a + 1));
dnl AC_MSG_RESULT($cf_result)
# ===================================================================
# Compile-time features control
# ===================================================================
EL_ARG_ENABLE(CONFIG_GETTEXT, gettext, [System gettext],
[ --enable-gettext use System gettext for Native Language Support])
EL_ARG_ENABLE(CONFIG_COOKIES, cookies, [Cookies],
[ --disable-cookies disable cookie support])
EL_ARG_ENABLE(CONFIG_FORMHIST, formhist, [Form history],
[ --disable-formhist disable form history support])
EL_ARG_ENABLE(CONFIG_GLOBHIST, globhist, [Global history],
[ --disable-globhist disable global history support])
EL_ARG_ENABLE(CONFIG_MAILCAP, mailcap, [Mailcap],
[ --disable-mailcap disable mailcap support])
EL_ARG_ENABLE(CONFIG_MIMETYPES, mimetypes, [Mimetypes files],
[ --disable-mimetypes disable mimetypes files support])
EL_ARG_DEPEND(CONFIG_IPV6, ipv6,
[HAVE_SA_STORAGE:yes HAVE_SA_IN6:yes HAVE_ADDRINFO:yes HAVE_GETADDRINFO:yes],
[IPv6],
[ --disable-ipv6 disable IPv6 support])
EL_ARG_ENABLE(CONFIG_BITTORRENT, bittorrent, [BitTorrent protocol],
[ --enable-bittorrent enable BitTorrent protocol support])
EL_ARG_ENABLE(CONFIG_DATA, data, [Data protocol],
[ --disable-data disable data protocol support])
EL_ARG_ENABLE(CONFIG_URI_REWRITE, uri-rewrite, [URI rewriting],
[ --disable-uri-rewrite disable URI rewrite support])
EL_ARG_DEPEND(CONFIG_CGI, cgi, [HAVE_SETENV_OR_PUTENV:yes], [Local CGI],
[ --enable-cgi enable local CGI support])
EL_ARG_ENABLE(CONFIG_DGI, dgi, [DOS Gateway Interface],
[ --enable-dgi enable DGI support])
EL_ARG_ENABLE(CONFIG_FINGER, finger, [Finger protocol],
[ --enable-finger enable finger protocol support])
# ===================================================================
# FSP protocol
# ===================================================================
EL_SAVE_FLAGS
if test "x${enable_fsp}" != xno; then
AC_CHECK_HEADERS(fsplib.h, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
if test "$HAVE_FSPLIB" = yes; then
AC_CHECK_LIB(fsplib, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
if test "$HAVE_FSPLIB" = yes; then
LIBS="$LIBS -lfsplib"
else
AC_CHECK_LIB(fsp, fsp_open_session, HAVE_FSPLIB=yes, HAVE_FSPLIB=no)
if test "$HAVE_FSPLIB" = yes; then
LIBS="$LIBS -lfsp"
fi
fi
fi
fi
EL_ARG_DEPEND(CONFIG_FSP, fsp, [HAVE_FSPLIB:yes], [FSP protocol],
[ --enable-fsp enable FSP protocol support])
if test "x$CONFIG_FSP" = xno; then
EL_RESTORE_FLAGS
fi
EL_ARG_ENABLE(CONFIG_FTP, ftp, [FTP protocol],
[ --disable-ftp disable ftp protocol support])
EL_ARG_ENABLE(CONFIG_SFTP, sftp, [SFTP protocol],
[ --disable-sftp disable sftp protocol support])
EL_ARG_ENABLE(CONFIG_GEMINI, gemini, [Gemini protocol],
[ --enable-gemini enable gemini protocol support])
EL_ARG_ENABLE(CONFIG_GOPHER, gopher, [Gopher protocol],
[ --enable-gopher enable gopher protocol support])
EL_ARG_ENABLE(CONFIG_NNTP, nntp, [NNTP protocol],
[ --enable-nntp enable nntp protocol support])
# ===================================================================
# SMB protocol support.
# ===================================================================
EL_SAVE_FLAGS
if test "x${enable_smb}" != xno; then
AC_CHECK_HEADERS(libsmbclient.h, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
if test "$HAVE_SMBCLIENT" = yes; then
AC_CHECK_LIB(smbclient, smbc_init, HAVE_SMBCLIENT=yes, HAVE_SMBCLIENT=no)
if test "$HAVE_SMBCLIENT" = yes; then
LIBS="$LIBS -lsmbclient"
fi
fi
fi
EL_ARG_DEPEND(CONFIG_SMB, smb, [HAVE_SMBCLIENT:yes], [Samba protocol],
[ --enable-smb enable Samba protocol support])
if test "x$CONFIG_SMB" = xno; then
EL_RESTORE_FLAGS
fi
EL_ARG_ENABLE(CONFIG_MOUSE, mouse, [Mouse handling],
[ --disable-mouse disable mouse support])
# GPM mouse is Linux specific, so ...
CONFIG_SYSMOUSE=yes
EL_ARG_DEPEND(CONFIG_SYSMOUSE, sysmouse,
[CONFIG_MOUSE:yes CONFIG_GPM:no HAVE_SYSMOUSE_HEADER:yes],
[BSD sysmouse],
[ --disable-sysmouse disable BSD sysmouse support])
EL_ARG_ENABLE(CONFIG_88_COLORS, 88-colors, [88 colors],
[ --enable-88-colors enable 88 color support])
EL_ARG_ENABLE(CONFIG_256_COLORS, 256-colors, [256 colors],
[ --enable-256-colors enable 256 color support])
EL_ARG_ENABLE(CONFIG_TRUE_COLOR, true-color, [true color],
[ --enable-true-color enable true color support])
EL_ARG_ENABLE(CONFIG_EXMODE, exmode, [Exmode interface],
[ --enable-exmode enable exmode (CLI) interface])
EL_ARG_ENABLE(CONFIG_LEDS, leds, [LEDs],
[ --disable-leds disable LEDs support])
EL_ARG_ENABLE(CONFIG_MARKS, marks, [Marks],
[ --disable-marks disable document marks support])
EL_ARG_ENABLE(CONFIG_CSS, css, [Cascading Style Sheets],
[ --disable-css disable Cascading Style Sheet support])
EL_ARG_DEPEND(CONFIG_HTML_HIGHLIGHT, html-highlight, [CONFIG_CSS:yes], [HTML highlighting],
[ --enable-html-highlight HTML highlighting using DOM engine])
# Everything in the tree already uses CONFIG_DOM
# so resolve CONFIG_HTML_HIGHLIGHT to CONFIG_DOM
EL_CONFIG_DEPENDS(CONFIG_DOM, [CONFIG_HTML_HIGHLIGHT], [DOM engine])
EL_ARG_DEPEND(CONFIG_BACKTRACE, backtrace, [HAVE_EXECINFO:yes], [Backtrace],
[ --disable-backtrace disable backtrace support])
EL_ARG_DEPEND(CONFIG_NO_ROOT_EXEC, no-root, [HAVE_GETUID:yes HAVE_GETEUID:yes], [No root exec],
[ --enable-no-root enable prevention of usage by root])
EL_ARG_ENABLE(CONFIG_DEBUG, debug, [Debug mode],
[ --enable-debug enable leak debug and internal error checking])
EL_ARG_DEPEND(CONFIG_FASTMEM, fastmem, [CONFIG_DEBUG:no], [Fast mode],
[ --enable-fastmem enable direct use of system allocation functions, not usable with --enable-debug])
EL_ARG_ENABLE(CONFIG_OWN_LIBC, own-libc, [Own libc stubs],
[ --enable-own-libc force use of internal functions instead of those of system libc])
EL_ARG_ENABLE(CONFIG_SMALL, small, [Small binary],
[ --enable-small reduce binary size as far as possible (but see the bottom of doc/small.txt!)])
EL_ARG_ENABLE(CONFIG_UTF8, utf-8, [UTF-8],
[ --disable-utf-8 disable UTF-8 support])
EL_ARG_ENABLE(CONFIG_REPRODUCIBLE, reproducible, [Reproducible builds],
[ --enable-reproducible enable reproducible build])
EL_ARG_ENABLE(CONFIG_CODEPOINT, codepoint, [Check codepoints],
[ --disable-codepoint disable codepoint lookup])
AC_ARG_ENABLE(weehoofooboomookerchoo,
[
Also check out the features.conf file for more information about features!
],
[AC_MSG_ERROR(Are you strange, or what?)])
SOURCE_DATE_EPOCH=
AC_ARG_WITH(source-date-epoch, [ --with-source-date-epoch=[TIME]
set source date epoch for reproducible builds],
[SOURCE_DATE_EPOCH="$withval"])
AC_SUBST(SOURCE_DATE_EPOCH)
# ===================================================================
# Decide whether to use TRE
# ===================================================================
#
# This must be done after the CONFIG_UTF8 check above.
# The first part of the TRE check is separate, to get
# the configure --help output in a sensible order.
#
# After this section, nothing else must be added to the
# beginning of $LIBS.
if test "$tre_log" = "available"; then
if test "$CONFIG_UTF8" = "yes"; then
# When CONFIG_UTF8 and CONFIG_TRE are both defined,
# src/viewer/text/search.c makes a string of
# unicode_val_T and gives it to regwexec(), which
# expects a string of wchar_t. If the unicode_val_T
# and wchar_t types are too different, this won't
# work, so try to detect that and disable regexp
# operations entirely in that case.
#
# Currently, this code only compares the sizes of the
# types. src/intl/charsets.h defines unicode_val_T as
# uint32_t, so we check whether wchar_t has exactly 32
# bits. But don't use AC_CHECK_SIZEOF for this, because
# there doesn't seem to be a documented way to get the
# result of that for use in the configure script.
#
# C99 says the implementation can define
# __STDC_ISO_10646__ if wchar_t values match ISO 10646
# (or Unicode) numbers in all locales. Do not check
# that macro here, because it is too restrictive: it
# should be enough for ELinks if the values match in
# the locales where ELinks is actually run.
AC_MSG_CHECKING([[whether wchar_t is exactly 32-bit]])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <limits.h>
#include <stddef.h>
int dummy[(sizeof(wchar_t) * CHAR_BIT == 32) ? 1 : -1];]], [])],
[AC_MSG_RESULT([[yes]])
tre_log="TRE"],
[AC_MSG_RESULT([[no]])
tre_log="no (unsuitable wchar_t)"])
else
# If UTF-8 is not used, then wchar_t doesn't matter.
tre_log="TRE"
fi
fi
if test "$tre_log" = "TRE"; then
AC_DEFINE([CONFIG_TRE], [1],
[Define as 1 to use the TRE library for regular expression searching. This requires the <tre/regex.h> header file. If you define CONFIG_UTF8 too, then wchar_t must be exactly 32-bit so that it matches unicode_val_T.])
# TRE_CFLAGS will be used only where needed.
#
# Bug 1081: If both TRE and libc define the regfree function,
# ELinks needs to use the version defined by TRE because
# that's the one compatible with regex_t initialized by the
# regwcomp function of TRE. Therefore put $TRE_LIBS at the
# very beginning of $LIBS so that the linker hopefully finds
# regfree there before it examines libc. In particular,
# $PERL_LIBS appears to often include "-lc".
#
# This scheme still risks a crash if ELinks is linked with
# some static library that uses GNU <regex.h> extensions that
# TRE does not implement. For example, the library might call
# re_compile_pattern, which is found in GNU libc, and then
# regfree, which is found in TRE and probably crashes with the
# GNU-initialized regex_t. Ways to avoid such crashes:
#
# - Change TRE so it defines only tre_... functions and does
# not attempt to override the POSIX names by default.
#
# - Change ELinks to access TRE only via dlopen and dlsym.
# The problem then is how to find the correct file name.
# There might be libtre.so.4 and libtre.so.5 with different
# ABI. How can this configure script detect which of them
# matches the <tre/regex.h> in the include path?
#
# - Replace the static library with a shared library. At
# least on GNU/Linux, when the shared library is built, the
# linker should note that e.g. regfree is defined in libc
# and has the GLIBC_2.0 version there, and write that
# version string to the shared library as well; because TRE
# does not provide regfree with that version, any regfree
# calls at run time should then get resolved to libc.
LIBS="$TRE_LIBS $LIBS"
else
TRE_LIBS=
TRE_CFLAGS=
fi
AC_SUBST(TRE_CFLAGS)
AC_SUBST(TRE_LIBS)
EL_LOG_CONFIG([CONFIG_TRE], [[Regexp searching]], [[$tre_log]])
# ===================================================================
# Further LDFLAGS tweaks
# ===================================================================
# == EMX hack
test "$CONFIG_OS_OS2" = yes && LDFLAGS="$LDFLAGS -Zexe"
test "$CONFIG_OS_OS2" = yes && LDFLAGS=`echo "$LDFLAGS" | sed "s/-Zbin-files//g"`
# Check for -rdynamic
#
# gcc -rdynamic calls ld -export-dynamic, which adds all symbols of
# the executable to its dynamic symbol table. ELinks uses this for
# two purposes:
#
# 1. If ELinks detects a bug, it can try to display a backtrace by
# calling backtrace_symbols_fd() in the GNU libc. The glibc-2.3.6
# manual states users of GNU ld must pass -rdynamic to make the
# symbols available to the program.
#
# 2. It would eventually be nice to dynamically load shared
# libraries as plugins (bug 73). The plugins must be able to
# call ELinks functions. This can be implemented either by
# registering all callable functions in ELinks-specific data
# structures, or by letting the dynamic linker handle them.
# The latter way requires something equivalent to -rdynamic.
#
# Because backtraces are not needed for correct operation, and bug
# 73 is not yet being fixed, the configure script and makefiles
# should not complain to the user if they find that -rdynamic does
# not work. Besides, it was reported at elinks-users on 2006-09-12
# that gcc-3.4.2 with "ld: Software Generation Utilities - Solaris
# Link Editors: 5.8-1.284" on Sun Solaris 8 Sparc does not support
# -rdynamic but does something equivalent automatically. (This was
# tested with "nm -D elinks | grep redraw_from_window".)
#
# With Sun Studio 11 on Solaris 9, we get "cc: Warning: illegal option
# -dynamic"; then, cc proceeds anyway, but the option can prevent the
# linker from finding the libraries listed in -l operands. So this
# -rdynamic check needs to happen after the libraries have already
# been added to $LDFLAGS.
have_rdynamic=no
AC_MSG_CHECKING([for -rdynamic])
if test "$enable_static" = no; then
LDFLAGS_X="$LDFLAGS"
LDFLAGS="-rdynamic $LDFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[have_rdynamic=yes],[have_rdynamic=no])
test "$have_rdynamic" = no && LDFLAGS="$LDFLAGS_X"
fi
AC_MSG_RESULT($have_rdynamic)
# ===================================================================
# Export directory paths
# ===================================================================
# Set up the ``entry points'' if they were not supplied by builder
test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
# Create CONFDIR #define for config.h
# XXX: This may be dependent on a particular version of autoconf. Whatever,
# it's autoconf fault to force us to do such hacks ;p.
if test x"$sysconfdir" = x"\${prefix}/etc"; then
# sysconfdir is set to its default value... fine, let's append /elinks/
# XXX: We can't modify listing of the default in ./configure --help :-(
sysconfdir_n=`eval echo "$sysconfdir"`
sysconfdir=$sysconfdir_n
(echo "$sysconfdir" | grep elinks >/dev/null 2>/dev/null) || \
sysconfdir="$sysconfdir/elinks"
fi
CONFDIR=$sysconfdir
AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR", [Directory containing default config])
AC_SUBST(CONFDIR)
# Create LOCALEDIR #define for config.h
LOCALEDIR=`eval echo "$datadir/locale"`
while echo "$LOCALEDIR" | grep "\\$"
do
LOCALEDIR=`eval echo "$LOCALEDIR"`
done > /dev/null 2> /dev/null
AC_DEFINE_UNQUOTED(LOCALEDIR, "$LOCALEDIR", [Directory containing locales])
AC_SUBST(LOCALEDIR)
# Create LIBDIR #define for config.h
LIBDIR=`eval echo "$libdir"`
AC_DEFINE_UNQUOTED(LIBDIR, "$LIBDIR", [Directory containing libraries])
AC_SUBST(LIBDIR)
EL_LOG_CONFIG(CONFDIR, [System configuration directory], [])
EL_LOG_CONFIG(LOCALEDIR, [Locale catalogs directory], [])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stddef.h>
]], [[#if !defined(__TINYC__) || !defined(alloca)
#error not tcc
#endif ]])],[cf_result=yes],[cf_result=no])
if test "$cf_result" = "yes"; then
AC_DEFINE([HAVE_ALLOCA])
AC_DEFINE([_ALLOCA_H], [1], [Define as 1 if you are using Tiny C Compiler
with the GNU C Library, and <alloca.h> of glibc would otherwise
override the alloca macro defined in <stddef.h> of TCC.
If <alloca.h> of glibc sees the _ALLOCA_H macro, it assumes
it has already been included, and does not redefine alloca.
This might not work in future glibc versions though, because
the names of the #include guard macros are not documented.
The incompatibility has been reported to the tinycc-devel
mailing list on 2008-07-14. If a future version of TCC provides
an <alloca.h> of its own, this hack won't be needed.])
fi
# ===================================================================
# A little fine tuning of gcc specific options (continued)
# ===================================================================
GETTEXT_CFLAGS=
if test "x$ac_cv_c_compiler_gnu" = "xyes"; then
if test "$CONFIG_DEBUG" = "yes"; then
# We want to see all warnings and live with none (in debug mode).
CFLAGS="$CFLAGS"
fi
GETTEXT_CFLAGS="-Wno-uninitialized"
case "`$CC -dumpversion`" in
3.0|3.1|3.2)
# These should be ok using -Werror
;;
3.*)
# If gcc is version 3.3 (or higher?) it emits lots of false positive
# "dereferencing type-punned pointer will break strict-aliasing rules"
# warnings. Disable them by not doing any strict-aliasing. The
# alternative is just too ugly. Thanks gcc guys!! ;)
CFLAGS="$CFLAGS -fno-strict-aliasing"
;;
4.5*)
CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-enum-compare"
;;
4.*|5.*|6.*|7.*|8|8.*|9|9.*)
# Do not show warnings related to (char * | unsigned char *) type
# difference.
CFLAGS="$CFLAGS -fno-strict-aliasing"
;;
10|10.*|11|11.*|12|12.*|13|13.*|14|14.*)
# gettext
CFLAGS="$CFLAGS -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Wno-array-bounds"
;;
*)
# These should be ok using -Werror
;;
esac
# GCC 4.2.1 warns if we use the address of an object in Boolean context:
# warning: the address of `builtin_modules' will always evaluate as `true'
# This hits the object_lock and foreach_module macros in particular.
# It would be okay to put something in the macros to avoid the warning,
# but currently this seems to require defining parallel macros that skip
# the NULL check, and that's too ugly. So we instead disable the warning.
# GCC 4.2.1 needs -Wno-address, but GCC 4.2 snapshots need -Wno-always-true.
# GCC 4.1.3 recognizes neither and exits with code 1 if they are given.
for warning_flag in -Wno-address -Wno-always-true; do
AC_MSG_CHECKING([whether $CC accepts $warning_flag])
EL_SAVE_FLAGS
CFLAGS="$CFLAGS $warning_flag"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[AC_MSG_RESULT([yes])
break],
[AC_MSG_RESULT([no])])
EL_RESTORE_FLAGS
done
# Bug 1012: Some parts of ELinks do arithmetic with signed integers
# in such a way that an overflow is possible. GCC 4.2.1 warns
# "warning: assuming signed overflow does not occur when assuming
# that (X + c) > X is always true", which may be an incorrect
# optimization (although allowed by the standard), and breaks the
# build with -Werror.
#
# All of the following tests included -S -Wall -Wextra:
#
# GCC: (GNU) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
# * gcc-4.0 -O0: OK, compares the values
# * gcc-4.0 -O2: assumes no overflow, does not warn
# * gcc-4.0 -O0 -fno-strict-overflow: unrecognized command line option
# * gcc-4.0 -O0 -fwrapv: OK, compares the values
# * gcc-4.0 -O2 -fwrapv: OK, compares the values
# * gcc-4.0 -O0 -ftrapv: OK, calls __addvsi3
# * gcc-4.0 -O2 -ftrapv: assumes no overflow, does not warn
# * gcc-4.0 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
# * gcc-4.0 -O2 -fwrapv -ftrapv: compares the values
#
# GCC: (GNU) 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)
# * gcc-4.1 -O0: assumes no overflow, does not warn
# * gcc-4.1 -O2: assumes no overflow, does not warn
# * gcc-4.1 -O0 -fno-strict-overflow: unrecognized command line option
# * gcc-4.1 -O0 -fwrapv: OK, compares the values
# * gcc-4.1 -O2 -fwrapv: OK, compares the values
# * gcc-4.1 -O0 -ftrapv: OK, calls __addvsi3
# * gcc-4.1 -O2 -ftrapv: compares the values
# * gcc-4.1 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
# * gcc-4.1 -O2 -fwrapv -ftrapv: compares the values
#
# GCC: (GNU) 4.2.1 (Debian 4.2.1-5)
# * gcc-4.2 -O0: OK, compares the values
# * gcc-4.2 -O2: assumes no overflow, warns about it
# * gcc-4.2 -O0 -fno-strict-overflow: OK, compares the values
# * gcc-4.2 -O2 -fno-strict-overflow: OK, compares the values
# * gcc-4.2 -O0 -fwrapv: OK, compares the values
# * gcc-4.2 -O2 -fwrapv: OK, compares the values
# * gcc-4.2 -O0 -ftrapv: OK, calls __addvsi3
# * gcc-4.2 -O2 -ftrapv: compares the values
# * gcc-4.2 -O0 -fwrapv -ftrapv: OK, calls __addvsi3
# * gcc-4.2 -O2 -fwrapv -ftrapv: compares the values
#
# Apparently, -ftrapv does not work reliably at all.
for overflow_flag in -fno-strict-overflow -fwrapv; do
AC_MSG_CHECKING([whether $CC accepts $overflow_flag])
EL_SAVE_FLAGS
CFLAGS="$CFLAGS $overflow_flag"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
[AC_MSG_RESULT([yes])
break],
[AC_MSG_RESULT([no])])
EL_RESTORE_FLAGS
done
fi
AC_SUBST(GETTEXT_CFLAGS)
EL_LOG_CONFIG(CFLAGS, [Compiler flags (CFLAGS)], [])
EL_LOG_CONFIG(CPPFLAGS, [Preprocessor flags (CPPFLAGS)], [])
EL_LOG_CONFIG(CXXFLAGS, [C++ compiler flags (CXXFLAGS)], [])
EL_LOG_CONFIG(LDFLAGS, [Linker flags (LDFLAGS)], [])
EL_LOG_CONFIG(LIBS, [Library flags (LIBS)], [])
# ===================================================================
# Colored make output
# ===================================================================
if test $(`which tput` colors 2> /dev/null || echo 0) -ge 4; then
MAKE_COLOR=1
AC_SUBST(MAKE_COLOR)
fi
# ===================================================================
# Generated files
# ===================================================================
AC_CONFIG_FILES([ \
Makefile.config \
contrib/elinks.spec \
contrib/lua/hooks.lua \
doc/Doxyfile \
doc/man/man1/elinks.1 \
src/intl/gettext/ref-add.sed \
src/intl/gettext/ref-del.sed
])
AC_OUTPUT
abs_srcdir="$(cd "$srcdir" && pwd)"
# builddir is always absolute!
if test "$abs_srcdir" != "$builddir"; then
# Bootstrap the Makefile creation
echo "include $abs_srcdir/Makefile" > "$builddir/Makefile"
"$MAKE" "SRC=$abs_srcdir" init
# Make cg-status ignore this build directory
echo "*" > "$builddir/.gitignore"
fi
# ===================================================================
# Configuration summary
# ===================================================================
AC_MSG_RESULT(The following feature summary has been saved to features.log)
cat features.log
|