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
|
##------------------------------------------------------------##
#
# The multiple-architecture stuff in this file is pretty
# cryptic. Read docs/internals/multiple-architectures.txt
# for at least a partial explanation of what is going on.
#
##------------------------------------------------------------##
# Process this file with autoconf to produce a configure script.
AC_INIT([Valgrind],[3.7.0],[valgrind-users@lists.sourceforge.net])
AC_CONFIG_SRCDIR(coregrind/m_main.c)
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign])
AM_MAINTAINER_MODE
#----------------------------------------------------------------------------
# Checks for various programs.
#----------------------------------------------------------------------------
CFLAGS="-Wno-long-long $CFLAGS"
AC_PROG_LN_S
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
AC_PROG_CXX
# AC_PROG_OBJC apparently causes problems on older Linux distros (eg. with
# autoconf 2.59). If we ever have any Objective-C code in the Valgrind code
# base (eg. most likely as Darwin-specific tests) we'll need one of the
# following:
# - put AC_PROG_OBJC in a Darwin-specific part of this file
# - Use AC_PROG_OBJC here and up the minimum autoconf version
# - Use the following, which is apparently equivalent:
# m4_ifdef([AC_PROG_OBJC],
# [AC_PROG_OBJC],
# [AC_CHECK_TOOL([OBJC], [gcc])
# AC_SUBST([OBJC])
# AC_SUBST([OBJCFLAGS])
# ])
AC_PROG_RANLIB
# provide a very basic definition for AC_PROG_SED if it's not provided by
# autoconf (as e.g. in autoconf 2.59).
m4_ifndef([AC_PROG_SED],
[AC_DEFUN([AC_PROG_SED],
[AC_ARG_VAR([SED])
AC_CHECK_PROGS([SED],[gsed sed])])])
AC_PROG_SED
# If no AR variable was specified, look up the name of the archiver. Otherwise
# do not touch the AR variable.
if test "x$AR" = "x"; then
AC_PATH_PROGS([AR], [`echo $LD | $SED 's/ld$/ar/'` "ar"], [ar])
fi
AC_ARG_VAR([AR],[Archiver command])
# Check for the compiler support
if test "${GCC}" != "yes" ; then
AC_MSG_ERROR([Valgrind relies on GCC to be compiled])
fi
# figure out where perl lives
AC_PATH_PROG(PERL, perl)
# figure out where gdb lives
AC_PATH_PROG(GDB, gdb, "/no/gdb/was/found/at/configure/time")
AC_DEFINE_UNQUOTED(GDB_PATH, "$GDB", [path to GDB])
# some older automake's don't have it so try something on our own
ifdef([AM_PROG_AS],[AM_PROG_AS],
[
AS="${CC}"
AC_SUBST(AS)
ASFLAGS=""
AC_SUBST(ASFLAGS)
])
# Check if 'diff' supports -u (universal diffs) and use it if possible.
AC_MSG_CHECKING([for diff -u])
AC_SUBST(DIFF)
# Comparing two identical files results in 0.
tmpfile="tmp-xxx-yyy-zzz"
touch $tmpfile;
if diff -u $tmpfile $tmpfile ; then
AC_MSG_RESULT([yes])
DIFF="diff -u"
else
AC_MSG_RESULT([no])
DIFF="diff"
fi
rm $tmpfile
# We don't want gcc < 3.0
AC_MSG_CHECKING([for a supported version of gcc])
# Try to get the gcc version, sed-ing out some unexpected stuff
# that appears with the default gcc on OSX 10.6 and 10.7 respectively.
# Without this, the version number comes out as 686, 10 or 11 :-(
#
# i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
# i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)
#
[gcc_version=`${CC} --version \
| head -n 1 \
| $SED 's/i686-apple-darwin10//' \
| $SED 's/i686-apple-darwin11//' \
| $SED 's/^[^ ]* [^0-9]*\([0-9.]*\).*$/\1/'`]
is_clang="notclang"
if test "x`${CC} --version | head -n 1 | $SED 's/\(clang\) version.*/\1/'`" = "xclang" ; then
is_clang="clang"
fi
case "${is_clang}-${gcc_version}" in
notclang-3.*)
AC_MSG_RESULT([ok (${gcc_version})])
;;
notclang-4.*)
AC_MSG_RESULT([ok (${gcc_version})])
;;
clang-2.9)
AC_MSG_RESULT([ok (clang-${gcc_version})])
;;
*)
AC_MSG_RESULT([no (${gcc_version})])
AC_MSG_ERROR([please use gcc >= 3.0 or clang >= 2.9])
;;
esac
#----------------------------------------------------------------------------
# Arch/OS/platform tests.
#----------------------------------------------------------------------------
# We create a number of arch/OS/platform-related variables. We prefix them
# all with "VGCONF_" which indicates that they are defined at
# configure-time, and distinguishes them from the VGA_*/VGO_*/VGP_*
# variables used when compiling C files.
AC_CANONICAL_HOST
AC_MSG_CHECKING([for a supported CPU])
# ARCH_MAX reflects the most that this CPU can do: for example if it
# is a 64-bit capable PowerPC, then it must be set to ppc64 and not ppc32.
# Ditto for amd64. It is used for more configuration below, but is not used
# outside this file.
case "${host_cpu}" in
i?86)
AC_MSG_RESULT([ok (${host_cpu})])
ARCH_MAX="x86"
;;
x86_64)
AC_MSG_RESULT([ok (${host_cpu})])
ARCH_MAX="amd64"
;;
powerpc64)
AC_MSG_RESULT([ok (${host_cpu})])
ARCH_MAX="ppc64"
;;
powerpc)
# On Linux this means only a 32-bit capable CPU.
AC_MSG_RESULT([ok (${host_cpu})])
ARCH_MAX="ppc32"
;;
s390x)
AC_MSG_RESULT([ok (${host_cpu})])
ARCH_MAX="s390x"
;;
armv7*)
AC_MSG_RESULT([ok (${host_cpu})])
ARCH_MAX="arm"
;;
*)
AC_MSG_RESULT([no (${host_cpu})])
AC_MSG_ERROR([Unsupported host architecture. Sorry])
;;
esac
#----------------------------------------------------------------------------
# Sometimes it's convenient to subvert the bi-arch build system and
# just have a single build even though the underlying platform is
# capable of both. Hence handle --enable-only64bit and
# --enable-only32bit. Complain if both are issued :-)
# [Actually, if either of these options are used, I think both get built,
# but only one gets installed. So if you use an in-place build, both can be
# used. --njn]
# Check if a 64-bit only build has been requested
AC_CACHE_CHECK([for a 64-bit only build], vg_cv_only64bit,
[AC_ARG_ENABLE(only64bit,
[ --enable-only64bit do a 64-bit only build],
[vg_cv_only64bit=$enableval],
[vg_cv_only64bit=no])])
# Check if a 32-bit only build has been requested
AC_CACHE_CHECK([for a 32-bit only build], vg_cv_only32bit,
[AC_ARG_ENABLE(only32bit,
[ --enable-only32bit do a 32-bit only build],
[vg_cv_only32bit=$enableval],
[vg_cv_only32bit=no])])
# Stay sane
if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
AC_MSG_ERROR(
[Nonsensical: both --enable-only64bit and --enable-only32bit.])
fi
#----------------------------------------------------------------------------
# VGCONF_OS is the primary build OS, eg. "linux". It is passed in to
# compilation of many C files via -VGO_$(VGCONF_OS) and
# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
AC_MSG_CHECKING([for a supported OS])
AC_SUBST(VGCONF_OS)
DEFAULT_SUPP=""
case "${host_os}" in
*linux*)
AC_MSG_RESULT([ok (${host_os})])
VGCONF_OS="linux"
# Ok, this is linux. Check the kernel version
AC_MSG_CHECKING([for the kernel version])
kernel=`uname -r`
case "${kernel}" in
2.6.*|3.*)
AC_MSG_RESULT([2.6.x/3.x family (${kernel})])
AC_DEFINE([KERNEL_2_6], 1, [Define to 1 if you're using Linux 2.6.x or Linux 3.x])
;;
2.4.*)
AC_MSG_RESULT([2.4 family (${kernel})])
AC_DEFINE([KERNEL_2_4], 1, [Define to 1 if you're using Linux 2.4.x])
;;
*)
AC_MSG_RESULT([unsupported (${kernel})])
AC_MSG_ERROR([Valgrind works on kernels 2.4, 2.6])
;;
esac
;;
*darwin*)
AC_MSG_RESULT([ok (${host_os})])
VGCONF_OS="darwin"
AC_DEFINE([DARWIN_10_5], 100500, [DARWIN_VERS value for Mac OS X 10.5])
AC_DEFINE([DARWIN_10_6], 100600, [DARWIN_VERS value for Mac OS X 10.6])
AC_DEFINE([DARWIN_10_7], 100700, [DARWIN_VERS value for Mac OS X 10.7])
AC_MSG_CHECKING([for the kernel version])
kernel=`uname -r`
# Nb: for Darwin we set DEFAULT_SUPP here. That's because Darwin
# has only one relevant version, the OS version. The `uname` check
# is a good way to get that version (i.e. "Darwin 9.6.0" is Mac OS
# X 10.5.6, and "Darwin 10.x" is Mac OS X 10.6.x Snow Leopard,
# and possibly "Darwin 11.x" is Mac OS X 10.7.x Lion),
# and we don't know of an macros similar to __GLIBC__ to get that info.
#
# XXX: `uname -r` won't do the right thing for cross-compiles, but
# that's not a problem yet.
#
# jseward 21 Sept 2011: I seriously doubt whether V 3.7.0 will work
# on OS X 10.5.x; I haven't tested yet, and only plan to test 3.7.0
# on 10.6.8 and 10.7.1. Although tempted to delete the configure
# time support for 10.5 (the 9.* pattern just below), I'll leave it
# in for now, just in case anybody wants to give it a try. But I'm
# assuming that 3.7.0 is a Snow Leopard and Lion-only release.
case "${kernel}" in
9.*)
AC_MSG_RESULT([Darwin 9.x (${kernel}) / Mac OS X 10.5 Leopard])
AC_DEFINE([DARWIN_VERS], DARWIN_10_5, [Darwin / Mac OS X version])
DEFAULT_SUPP="darwin9.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="darwin9-drd.supp ${DEFAULT_SUPP}"
;;
10.*)
AC_MSG_RESULT([Darwin 10.x (${kernel}) / Mac OS X 10.6 Snow Leopard])
AC_DEFINE([DARWIN_VERS], DARWIN_10_6, [Darwin / Mac OS X version])
DEFAULT_SUPP="darwin10.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
;;
11.*)
AC_MSG_RESULT([Darwin 11.x (${kernel}) / Mac OS X 10.7 Lion])
AC_DEFINE([DARWIN_VERS], DARWIN_10_7, [Darwin / Mac OS X version])
# FIXME: change these to xx11.supp
DEFAULT_SUPP="darwin11.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="darwin10-drd.supp ${DEFAULT_SUPP}"
;;
*)
AC_MSG_RESULT([unsupported (${kernel})])
AC_MSG_ERROR([Valgrind works on Darwin 10.x and 11.x (Mac OS X 10.6/7)])
;;
esac
;;
*)
AC_MSG_RESULT([no (${host_os})])
AC_MSG_ERROR([Valgrind is operating system specific. Sorry.])
;;
esac
#----------------------------------------------------------------------------
# If we are building on a 64 bit platform test to see if the system
# supports building 32 bit programs and disable 32 bit support if it
# does not support building 32 bit programs
case "$ARCH_MAX-$VGCONF_OS" in
amd64-linux|ppc64-linux)
AC_MSG_CHECKING([for 32 bit build support])
safe_CFLAGS=$CFLAGS
CFLAGS="-m32"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])], [
AC_MSG_RESULT([yes])
], [
vg_cv_only64bit="yes"
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS;;
esac
if test x$vg_cv_only64bit = xyes -a x$vg_cv_only32bit = xyes; then
AC_MSG_ERROR(
[--enable-only32bit was specified but system does not support 32 bit builds])
fi
#----------------------------------------------------------------------------
# VGCONF_ARCH_PRI is the arch for the primary build target, eg. "amd64". By
# default it's the same as ARCH_MAX. But if, say, we do a build on an amd64
# machine, but --enable-only32bit has been requested, then ARCH_MAX (see
# above) will be "amd64" since that reflects the most that this cpu can do,
# but VGCONF_ARCH_PRI will be downgraded to "x86", since that reflects the
# arch corresponding to the primary build (VGCONF_PLATFORM_PRI_CAPS). It is
# passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_PRI) and
# -VGP_$(VGCONF_ARCH_PRI)_$(VGCONF_OS).
AC_SUBST(VGCONF_ARCH_PRI)
# VGCONF_ARCH_SEC is the arch for the secondary build target, eg. "x86".
# It is passed in to compilation of many C files via -VGA_$(VGCONF_ARCH_SEC)
# and -VGP_$(VGCONF_ARCH_SEC)_$(VGCONF_OS), if there is a secondary target.
# It is empty if there is no secondary target.
AC_SUBST(VGCONF_ARCH_SEC)
# VGCONF_PLATFORM_PRI_CAPS is the primary build target, eg. "AMD64_LINUX".
# The entire system, including regression and performance tests, will be
# built for this target. The "_CAPS" indicates that the name is in capital
# letters, and it also uses '_' rather than '-' as a separator, because it's
# used to create various Makefile variables, which are all in caps by
# convention and cannot contain '-' characters. This is in contrast to
# VGCONF_ARCH_PRI and VGCONF_OS which are not in caps.
AC_SUBST(VGCONF_PLATFORM_PRI_CAPS)
# VGCONF_PLATFORM_SEC_CAPS is the secondary build target, if there is one.
# Valgrind and tools will also be built for this target, but not the
# regression or performance tests.
#
# By default, the primary arch is the same as the "max" arch, as commented
# above (at the definition of ARCH_MAX). We may choose to downgrade it in
# the big case statement just below here, in the case where we're building
# on a 64 bit machine but have been requested only to do a 32 bit build.
AC_SUBST(VGCONF_PLATFORM_SEC_CAPS)
AC_MSG_CHECKING([for a supported CPU/OS combination])
# NB. The load address for a given platform may be specified in more
# than one place, in some cases, depending on whether we're doing a biarch,
# 32-bit only or 64-bit only build. eg see case for amd64-linux below.
# Be careful to give consistent values in all subcases. Also, all four
# valt_load_addres_{pri,sec}_{norml,inner} values must always be set,
# even if it is to "0xUNSET".
#
case "$ARCH_MAX-$VGCONF_OS" in
x86-linux)
VGCONF_ARCH_PRI="x86"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
valt_load_address_pri_norml="0x38000000"
valt_load_address_pri_inner="0x28000000"
valt_load_address_sec_norml="0xUNSET"
valt_load_address_sec_inner="0xUNSET"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
amd64-linux)
valt_load_address_sec_norml="0xUNSET"
valt_load_address_sec_inner="0xUNSET"
if test x$vg_cv_only64bit = xyes; then
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
valt_load_address_pri_norml="0x38000000"
valt_load_address_pri_inner="0x28000000"
elif test x$vg_cv_only32bit = xyes; then
VGCONF_ARCH_PRI="x86"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="X86_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
valt_load_address_pri_norml="0x38000000"
valt_load_address_pri_inner="0x28000000"
else
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC="x86"
VGCONF_PLATFORM_PRI_CAPS="AMD64_LINUX"
VGCONF_PLATFORM_SEC_CAPS="X86_LINUX"
valt_load_address_pri_norml="0x38000000"
valt_load_address_pri_inner="0x28000000"
valt_load_address_sec_norml="0x38000000"
valt_load_address_sec_inner="0x28000000"
fi
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
ppc32-linux)
VGCONF_ARCH_PRI="ppc32"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
valt_load_address_pri_norml="0x38000000"
valt_load_address_pri_inner="0x28000000"
valt_load_address_sec_norml="0xUNSET"
valt_load_address_sec_inner="0xUNSET"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
ppc64-linux)
valt_load_address_sec_norml="0xUNSET"
valt_load_address_sec_inner="0xUNSET"
if test x$vg_cv_only64bit = xyes; then
VGCONF_ARCH_PRI="ppc64"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
valt_load_address_pri_norml="0x38000000"
valt_load_address_pri_inner="0x28000000"
elif test x$vg_cv_only32bit = xyes; then
VGCONF_ARCH_PRI="ppc32"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="PPC32_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
valt_load_address_pri_norml="0x38000000"
valt_load_address_pri_inner="0x28000000"
else
VGCONF_ARCH_PRI="ppc64"
VGCONF_ARCH_SEC="ppc32"
VGCONF_PLATFORM_PRI_CAPS="PPC64_LINUX"
VGCONF_PLATFORM_SEC_CAPS="PPC32_LINUX"
valt_load_address_pri_norml="0x38000000"
valt_load_address_pri_inner="0x28000000"
valt_load_address_sec_norml="0x38000000"
valt_load_address_sec_inner="0x28000000"
fi
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
# Darwin gets identified as 32-bit even when it supports 64-bit.
# (Not sure why, possibly because 'uname' returns "i386"?) Just about
# all Macs support both 32-bit and 64-bit, so we just build both. If
# someone has a really old 32-bit only machine they can (hopefully?)
# build with --enable-only32bit. See bug 243362.
x86-darwin|amd64-darwin)
ARCH_MAX="amd64"
valt_load_address_sec_norml="0xUNSET"
valt_load_address_sec_inner="0xUNSET"
if test x$vg_cv_only64bit = xyes; then
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
VGCONF_PLATFORM_SEC_CAPS=""
valt_load_address_pri_norml="0x138000000"
valt_load_address_pri_inner="0x128000000"
elif test x$vg_cv_only32bit = xyes; then
VGCONF_ARCH_PRI="x86"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="X86_DARWIN"
VGCONF_PLATFORM_SEC_CAPS=""
VGCONF_ARCH_PRI_CAPS="x86"
valt_load_address_pri_norml="0x38000000"
valt_load_address_pri_inner="0x28000000"
else
VGCONF_ARCH_PRI="amd64"
VGCONF_ARCH_SEC="x86"
VGCONF_PLATFORM_PRI_CAPS="AMD64_DARWIN"
VGCONF_PLATFORM_SEC_CAPS="X86_DARWIN"
valt_load_address_pri_norml="0x138000000"
valt_load_address_pri_inner="0x128000000"
valt_load_address_sec_norml="0x38000000"
valt_load_address_sec_inner="0x28000000"
fi
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
arm-linux)
VGCONF_ARCH_PRI="arm"
VGCONF_PLATFORM_PRI_CAPS="ARM_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
valt_load_address_pri_norml="0x38000000"
valt_load_address_pri_inner="0x28000000"
valt_load_address_sec_norml="0xUNSET"
valt_load_address_sec_inner="0xUNSET"
AC_MSG_RESULT([ok (${host_cpu}-${host_os})])
;;
s390x-linux)
VGCONF_ARCH_PRI="s390x"
VGCONF_ARCH_SEC=""
VGCONF_PLATFORM_PRI_CAPS="S390X_LINUX"
VGCONF_PLATFORM_SEC_CAPS=""
# we want to have the generated code close to the dispatcher
valt_load_address_pri_norml="0x401000000"
valt_load_address_pri_inner="0x410000000"
valt_load_address_sec_norml="0xUNSET"
valt_load_address_sec_inner="0xUNSET"
AC_MSG_RESULT([ok (${ARCH_MAX}-${VGCONF_OS})])
;;
*)
VGCONF_ARCH_PRI="unknown"
VGCONF_ARCH_SEC="unknown"
VGCONF_PLATFORM_PRI_CAPS="UNKNOWN"
VGCONF_PLATFORM_SEC_CAPS="UNKNOWN"
valt_load_address_pri_norml="0xUNSET"
valt_load_address_pri_inner="0xUNSET"
valt_load_address_sec_norml="0xUNSET"
valt_load_address_sec_inner="0xUNSET"
AC_MSG_RESULT([no (${ARCH_MAX}-${VGCONF_OS})])
AC_MSG_ERROR([Valgrind is platform specific. Sorry. Please consider doing a port.])
;;
esac
#----------------------------------------------------------------------------
# Set up VGCONF_ARCHS_INCLUDE_<arch>. Either one or two of these become
# defined.
AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_X86,
test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
-o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
-o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN )
AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_AMD64,
test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN )
AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC32,
test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
-o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX )
AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_PPC64,
test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX )
AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_ARM,
test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX )
AM_CONDITIONAL(VGCONF_ARCHS_INCLUDE_S390X,
test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX )
# Set up VGCONF_PLATFORMS_INCLUDE_<platform>. Either one or two of these
# become defined.
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
-o x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC32_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
-o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_PPC64_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_ARM_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_S390X_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX \
-o x$VGCONF_PLATFORM_SEC_CAPS = xS390X_LINUX)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_X86_DARWIN,
test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
-o x$VGCONF_PLATFORM_SEC_CAPS = xX86_DARWIN)
AM_CONDITIONAL(VGCONF_PLATFORMS_INCLUDE_AMD64_DARWIN,
test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
# Similarly, set up VGCONF_OS_IS_<os>. Exactly one of these becomes defined.
# Relies on the assumption that the primary and secondary targets are
# for the same OS, so therefore only necessary to test the primary.
AM_CONDITIONAL(VGCONF_OS_IS_LINUX,
test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX)
AM_CONDITIONAL(VGCONF_OS_IS_DARWIN,
test x$VGCONF_PLATFORM_PRI_CAPS = xX86_DARWIN \
-o x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_DARWIN)
# Sometimes, in the Makefile.am files, it's useful to know whether or not
# there is a secondary target.
AM_CONDITIONAL(VGCONF_HAVE_PLATFORM_SEC,
test x$VGCONF_PLATFORM_SEC_CAPS != x)
#----------------------------------------------------------------------------
# Inner Valgrind?
#----------------------------------------------------------------------------
# Check if this should be built as an inner Valgrind, to be run within
# another Valgrind. Choose the load address accordingly.
AC_SUBST(VALT_LOAD_ADDRESS_PRI)
AC_SUBST(VALT_LOAD_ADDRESS_SEC)
AC_CACHE_CHECK([for use as an inner Valgrind], vg_cv_inner,
[AC_ARG_ENABLE(inner,
[ --enable-inner enables self-hosting],
[vg_cv_inner=$enableval],
[vg_cv_inner=no])])
if test "$vg_cv_inner" = yes; then
AC_DEFINE([ENABLE_INNER], 1, [configured to run as an inner Valgrind])
VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_inner
VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_inner
else
VALT_LOAD_ADDRESS_PRI=$valt_load_address_pri_norml
VALT_LOAD_ADDRESS_SEC=$valt_load_address_sec_norml
fi
#----------------------------------------------------------------------------
# Extra fine-tuning of installation directories
#----------------------------------------------------------------------------
AC_ARG_WITH(tmpdir,
[ --with-tmpdir=PATH Specify path for temporary files],
tmpdir="$withval",
tmpdir="/tmp")
AC_DEFINE_UNQUOTED(VG_TMPDIR, "$tmpdir", [Temporary files directory])
#----------------------------------------------------------------------------
# Libc and suppressions
#----------------------------------------------------------------------------
# This variable will collect the suppression files to be used.
AC_SUBST(DEFAULT_SUPP)
AC_CHECK_HEADER([features.h])
if test x$ac_cv_header_features_h = xyes; then
rm -f conftest.$ac_ext
cat <<_ACEOF >conftest.$ac_ext
#include <features.h>
#if defined(__GNU_LIBRARY__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
glibc version is: __GLIBC__ __GLIBC_MINOR__
#endif
_ACEOF
GLIBC_VERSION="`$CPP conftest.$ac_ext | $SED -n 's/^glibc version is: //p' | $SED 's/ /./g'`"
fi
# not really a version check
AC_EGREP_CPP([DARWIN_LIBC], [
#include <sys/cdefs.h>
#if defined(__DARWIN_VERS_1050)
DARWIN_LIBC
#endif
],
GLIBC_VERSION="darwin")
# not really a version check
AC_EGREP_CPP([BIONIC_LIBC], [
#if defined(__ANDROID__)
BIONIC_LIBC
#endif
],
GLIBC_VERSION="bionic")
AC_MSG_CHECKING([the GLIBC_VERSION version])
case "${GLIBC_VERSION}" in
2.2)
AC_MSG_RESULT(2.2 family)
AC_DEFINE([GLIBC_2_2], 1, [Define to 1 if you're using glibc 2.2.x])
DEFAULT_SUPP="glibc-2.2.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.2-LinuxThreads-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.3)
AC_MSG_RESULT(2.3 family)
AC_DEFINE([GLIBC_2_3], 1, [Define to 1 if you're using glibc 2.3.x])
DEFAULT_SUPP="glibc-2.3.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.4)
AC_MSG_RESULT(2.4 family)
AC_DEFINE([GLIBC_2_4], 1, [Define to 1 if you're using glibc 2.4.x])
DEFAULT_SUPP="glibc-2.4.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.5)
AC_MSG_RESULT(2.5 family)
AC_DEFINE([GLIBC_2_5], 1, [Define to 1 if you're using glibc 2.5.x])
DEFAULT_SUPP="glibc-2.5.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.6)
AC_MSG_RESULT(2.6 family)
AC_DEFINE([GLIBC_2_6], 1, [Define to 1 if you're using glibc 2.6.x])
DEFAULT_SUPP="glibc-2.6.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.7)
AC_MSG_RESULT(2.7 family)
AC_DEFINE([GLIBC_2_7], 1, [Define to 1 if you're using glibc 2.7.x])
DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.8)
AC_MSG_RESULT(2.8 family)
AC_DEFINE([GLIBC_2_8], 1, [Define to 1 if you're using glibc 2.8.x])
DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.9)
AC_MSG_RESULT(2.9 family)
AC_DEFINE([GLIBC_2_9], 1, [Define to 1 if you're using glibc 2.9.x])
DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.10)
AC_MSG_RESULT(2.10 family)
AC_DEFINE([GLIBC_2_10], 1, [Define to 1 if you're using glibc 2.10.x])
DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.11)
AC_MSG_RESULT(2.11 family)
AC_DEFINE([GLIBC_2_11], 1, [Define to 1 if you're using glibc 2.11.x])
DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.12)
AC_MSG_RESULT(2.12 family)
AC_DEFINE([GLIBC_2_12], 1, [Define to 1 if you're using glibc 2.12.x])
DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.13)
AC_MSG_RESULT(2.13 family)
AC_DEFINE([GLIBC_2_13], 1, [Define to 1 if you're using glibc 2.13.x])
DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
2.14)
AC_MSG_RESULT(2.14 family)
AC_DEFINE([GLIBC_2_14], 1, [Define to 1 if you're using glibc 2.14.x])
DEFAULT_SUPP="glibc-2.X.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.34567-NPTL-helgrind.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="glibc-2.X-drd.supp ${DEFAULT_SUPP}"
;;
darwin)
AC_MSG_RESULT(Darwin)
AC_DEFINE([DARWIN_LIBC], 1, [Define to 1 if you're using Darwin])
# DEFAULT_SUPP set by kernel version check above.
;;
bionic)
AC_MSG_RESULT(Bionic)
AC_DEFINE([BIONIC_LIBC], 1, [Define to 1 if you're using Bionic])
DEFAULT_SUPP="bionic.supp ${DEFAULT_SUPP}"
;;
*)
AC_MSG_RESULT([unsupported version ${GLIBC_VERSION}])
AC_MSG_ERROR([Valgrind requires glibc version 2.2 - 2.14])
AC_MSG_ERROR([or Darwin libc])
;;
esac
AC_SUBST(GLIBC_VERSION)
# Add default suppressions for the X client libraries. Make no
# attempt to detect whether such libraries are installed on the
# build machine (or even if any X facilities are present); just
# add the suppressions antidisirregardless.
DEFAULT_SUPP="xfree-4.supp ${DEFAULT_SUPP}"
DEFAULT_SUPP="xfree-3.supp ${DEFAULT_SUPP}"
# Add glibc and X11 suppressions for exp-sgcheck
DEFAULT_SUPP="exp-sgcheck.supp ${DEFAULT_SUPP}"
#----------------------------------------------------------------------------
# Platform variants?
#----------------------------------------------------------------------------
# Normally the PLAT = (ARCH, OS) characterisation of the platform is enough.
# But there are times where we need a bit more control. The motivating
# and currently only case is Android: this is almost identical to arm-linux,
# but not quite. So this introduces the concept of platform variant tags,
# which get passed in the compile as -DVGPV_<arch>_<os>_<variant> along
# with the main -DVGP_<arch>_<os> definition.
#
# In almost all cases, the <variant> bit is "vanilla". But for Android
# it is "android" instead.
#
# Consequently (eg), plain arm-linux would build with
#
# -DVGP_arm_linux -DVGPV_arm_linux_vanilla
#
# whilst an Android build would have
#
# -DVGP_arm_linux -DVGPV_arm_linux_android
#
# The setup of the platform variant is pushed relatively far down this
# file in order that we can inspect any of the variables set above.
# In the normal case ..
VGCONF_PLATVARIANT="vanilla"
# Android on ARM ?
if test "$VGCONF_ARCH_PRI-$VGCONF_OS" = "arm-linux" \
-a "$GLIBC_VERSION" = "bionic";
then
VGCONF_PLATVARIANT="android"
fi
AC_SUBST(VGCONF_PLATVARIANT)
# FIXME: do we also want to define automake variables
# VGCONF_PLATVARIANT_IS_<WHATEVER>, where WHATEVER is (currently)
# VANILLA or ANDROID ? This would be in the style of VGCONF_ARCHS_INCLUDE,
# VGCONF_PLATFORMS_INCLUDE and VGCONF_OS_IS above? Could easily enough
# do that. Problem is that we can't do and-ing in Makefile.am's, but
# that's what we'd need to do to use this, since what we'd want to write
# is something like
#
# VGCONF_PLATFORMS_INCLUDE_ARM_LINUX && VGCONF_PLATVARIANT_IS_ANDROID
#
# Hmm. Can't think of a nice clean solution to this.
AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_VANILLA,
test x$VGCONF_PLATVARIANT = xvanilla)
AM_CONDITIONAL(VGCONF_PLATVARIANT_IS_ANDROID,
test x$VGCONF_PLATVARIANT = xandroid)
#----------------------------------------------------------------------------
# Checking for various library functions and other definitions
#----------------------------------------------------------------------------
# Check for CLOCK_MONOTONIC
AC_MSG_CHECKING([for CLOCK_MONOTONIC])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <time.h>
]], [[
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
return 0;
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CLOCK_MONOTONIC], 1,
[Define to 1 if you have the `CLOCK_MONOTONIC' constant.])
], [
AC_MSG_RESULT([no])
])
# Check for PTHREAD_RWLOCK_T
AC_MSG_CHECKING([for pthread_rwlock_t])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <pthread.h>
]], [[
pthread_rwlock_t rwl;
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_RWLOCK_T], 1,
[Define to 1 if you have the `pthread_rwlock_t' type.])
], [
AC_MSG_RESULT([no])
])
# Check for PTHREAD_MUTEX_ADAPTIVE_NP
AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <pthread.h>
]], [[
return (PTHREAD_MUTEX_ADAPTIVE_NP);
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
[Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant.])
], [
AC_MSG_RESULT([no])
])
# Check for PTHREAD_MUTEX_ERRORCHECK_NP
AC_MSG_CHECKING([for PTHREAD_MUTEX_ERRORCHECK_NP])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <pthread.h>
]], [[
return (PTHREAD_MUTEX_ERRORCHECK_NP);
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_MUTEX_ERRORCHECK_NP], 1,
[Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant.])
], [
AC_MSG_RESULT([no])
])
# Check for PTHREAD_MUTEX_RECURSIVE_NP
AC_MSG_CHECKING([for PTHREAD_MUTEX_RECURSIVE_NP])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <pthread.h>
]], [[
return (PTHREAD_MUTEX_RECURSIVE_NP);
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE_NP], 1,
[Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant.])
], [
AC_MSG_RESULT([no])
])
# Check for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
AC_MSG_CHECKING([for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <pthread.h>
]], [[
pthread_mutex_t m = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
return 0;
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP], 1,
[Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP' constant.])
], [
AC_MSG_RESULT([no])
])
# Check whether pthread_mutex_t has a member called __m_kind.
AC_CHECK_MEMBER([pthread_mutex_t.__m_kind],
[AC_DEFINE([HAVE_PTHREAD_MUTEX_T__M_KIND],
1,
[Define to 1 if pthread_mutex_t has a member called __m_kind.])
],
[],
[#include <pthread.h>])
# Check whether pthread_mutex_t has a member called __data.__kind.
AC_CHECK_MEMBER([pthread_mutex_t.__data.__kind],
[AC_DEFINE([HAVE_PTHREAD_MUTEX_T__DATA__KIND],
1,
[Define to 1 if pthread_mutex_t has a member __data.__kind.])
],
[],
[#include <pthread.h>])
# does this compiler support -maltivec and does it have the include file
# <altivec.h> ?
AC_MSG_CHECKING([for Altivec])
safe_CFLAGS=$CFLAGS
CFLAGS="-maltivec"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <altivec.h>
]], [[
vector unsigned int v;
]])], [
ac_have_altivec=yes
AC_MSG_RESULT([yes])
AC_DEFINE([HAS_ALTIVEC], 1,
[Define to 1 if gcc/as can do Altivec.])
], [
ac_have_altivec=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AM_CONDITIONAL([HAS_ALTIVEC], [test x$ac_have_altivec = xyes])
# Check that both: the compiler supports -mvsx and that the assembler
# understands VSX instructions. If either of those doesn't work,
# conclude that we can't do VSX. NOTE: basically this is a kludge
# in that it conflates two things that should be separate -- whether
# the compiler understands the flag vs whether the assembler
# understands the opcodes. This really ought to be cleaned up
# and done properly, like it is for x86/x86_64.
AC_MSG_CHECKING([for VSX])
safe_CFLAGS=$CFLAGS
CFLAGS="-mvsx"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <altivec.h>
]], [[
vector unsigned int v;
__asm__ __volatile__("xsmaddadp 32, 32, 33" ::: "memory","cc");
]])], [
ac_have_vsx=yes
AC_MSG_RESULT([yes])
], [
ac_have_vsx=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AM_CONDITIONAL(HAS_VSX, test x$ac_have_vsx = xyes)
# Check for pthread_create@GLIBC2.0
AC_MSG_CHECKING([for pthread_create@GLIBC2.0()])
safe_CFLAGS=$CFLAGS
CFLAGS="-lpthread"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
extern int pthread_create_glibc_2_0(void*, const void*,
void *(*)(void*), void*);
__asm__(".symver pthread_create_glibc_2_0, pthread_create@GLIBC_2.0");
]], [[
#ifdef __powerpc__
/*
* Apparently on PowerPC linking this program succeeds and generates an
* executable with the undefined symbol pthread_create@GLIBC_2.0.
*/
#error This test does not work properly on PowerPC.
#else
pthread_create_glibc_2_0(0, 0, 0, 0);
#endif
return 0;
]])], [
ac_have_pthread_create_glibc_2_0=yes
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_PTHREAD_CREATE_GLIBC_2_0], 1,
[Define to 1 if you have the `pthread_create@glibc2.0' function.])
], [
ac_have_pthread_create_glibc_2_0=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AM_CONDITIONAL(HAVE_PTHREAD_CREATE_GLIBC_2_0,
test x$ac_have_pthread_create_glibc_2_0 = xyes)
# Check for eventfd_t, eventfd() and eventfd_read()
AC_MSG_CHECKING([for eventfd()])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <sys/eventfd.h>
]], [[
eventfd_t ev;
int fd;
fd = eventfd(5, 0);
eventfd_read(fd, &ev);
return 0;
]])], [
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_EVENTFD], 1,
[Define to 1 if you have the `eventfd' function.])
AC_DEFINE([HAVE_EVENTFD_READ], 1,
[Define to 1 if you have the `eventfd_read' function.])
], [
AC_MSG_RESULT([no])
])
#----------------------------------------------------------------------------
# Checking for supported compiler flags.
#----------------------------------------------------------------------------
# does this compiler support -m32 ?
AC_MSG_CHECKING([if gcc accepts -m32])
safe_CFLAGS=$CFLAGS
CFLAGS="-m32"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])], [
FLAG_M32="-m32"
AC_MSG_RESULT([yes])
], [
FLAG_M32=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AC_SUBST(FLAG_M32)
# does this compiler support -m64 ?
AC_MSG_CHECKING([if gcc accepts -m64])
safe_CFLAGS=$CFLAGS
CFLAGS="-m64"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])], [
FLAG_M64="-m64"
AC_MSG_RESULT([yes])
], [
FLAG_M64=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AC_SUBST(FLAG_M64)
# does this compiler support -mmmx ?
AC_MSG_CHECKING([if gcc accepts -mmmx])
safe_CFLAGS=$CFLAGS
CFLAGS="-mmmx"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])], [
FLAG_MMMX="-mmmx"
AC_MSG_RESULT([yes])
], [
FLAG_MMMX=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AC_SUBST(FLAG_MMMX)
# does this compiler support -msse ?
AC_MSG_CHECKING([if gcc accepts -msse])
safe_CFLAGS=$CFLAGS
CFLAGS="-msse"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])], [
FLAG_MSSE="-msse"
AC_MSG_RESULT([yes])
], [
FLAG_MSSE=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AC_SUBST(FLAG_MSSE)
# does this compiler support -mpreferred-stack-boundary=2 ?
AC_MSG_CHECKING([if gcc accepts -mpreferred-stack-boundary])
safe_CFLAGS=$CFLAGS
CFLAGS="-mpreferred-stack-boundary=2"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])], [
PREFERRED_STACK_BOUNDARY="-mpreferred-stack-boundary=2"
AC_MSG_RESULT([yes])
], [
PREFERRED_STACK_BOUNDARY=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AC_SUBST(PREFERRED_STACK_BOUNDARY)
# does this compiler support -Wno-pointer-sign ?
AC_MSG_CHECKING([if gcc accepts -Wno-pointer-sign])
safe_CFLAGS=$CFLAGS
CFLAGS="-Wno-pointer-sign"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])], [
no_pointer_sign=yes
AC_MSG_RESULT([yes])
], [
no_pointer_sign=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
if test x$no_pointer_sign = xyes; then
CFLAGS="$CFLAGS -Wno-pointer-sign"
fi
# does this compiler support -Wno-empty-body ?
AC_MSG_CHECKING([if gcc accepts -Wno-empty-body])
safe_CFLAGS=$CFLAGS
CFLAGS="-Wno-empty-body"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
return 0;
]])], [
AC_SUBST([FLAG_W_NO_EMPTY_BODY], [-Wno-empty-body])
AC_MSG_RESULT([yes])
], [
AC_SUBST([FLAG_W_NO_EMPTY_BODY], [])
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
# does this compiler support -Wno-format-zero-length ?
AC_MSG_CHECKING([if gcc accepts -Wno-format-zero-length])
safe_CFLAGS=$CFLAGS
CFLAGS="-Wno-format-zero-length"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
return 0;
]])], [
AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [-Wno-format-zero-length])
AC_MSG_RESULT([yes])
], [
AC_SUBST([FLAG_W_NO_FORMAT_ZERO_LENGTH], [])
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
# does this compiler support -Wno-nonnull ?
AC_MSG_CHECKING([if gcc accepts -Wno-nonnull])
safe_CFLAGS=$CFLAGS
CFLAGS="-Wno-nonnull"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
return 0;
]])], [
AC_SUBST([FLAG_W_NO_NONNULL], [-Wno-nonnull])
AC_MSG_RESULT([yes])
], [
AC_SUBST([FLAG_W_NO_NONNULL], [])
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
# does this compiler support -Wno-overflow ?
AC_MSG_CHECKING([if gcc accepts -Wno-overflow])
safe_CFLAGS=$CFLAGS
CFLAGS="-Wno-overflow"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
return 0;
]])], [
AC_SUBST([FLAG_W_NO_OVERFLOW], [-Wno-overflow])
AC_MSG_RESULT([yes])
], [
AC_SUBST([FLAG_W_NO_OVERFLOW], [])
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
# does this compiler support -Wno-uninitialized ?
AC_MSG_CHECKING([if gcc accepts -Wno-uninitialized])
safe_CFLAGS=$CFLAGS
CFLAGS="-Wno-uninitialized"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
return 0;
]])], [
AC_SUBST([FLAG_W_NO_UNINITIALIZED], [-Wno-uninitialized])
AC_MSG_RESULT([yes])
], [
AC_SUBST([FLAG_W_NO_UNINITIALIZED], [])
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
# does this compiler support -Wextra or the older -W ?
AC_MSG_CHECKING([if gcc accepts -Wextra or -W])
safe_CFLAGS=$CFLAGS
CFLAGS="-Wextra"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
return 0;
]])], [
AC_SUBST([FLAG_W_EXTRA], [-Wextra])
AC_MSG_RESULT([-Wextra])
], [
CFLAGS="-W"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
return 0;
]])], [
AC_SUBST([FLAG_W_EXTRA], [-W])
AC_MSG_RESULT([-W])
], [
AC_SUBST([FLAG_W_EXTRA], [])
AC_MSG_RESULT([not supported])
])
])
CFLAGS=$safe_CFLAGS
# does this compiler support -fno-stack-protector ?
AC_MSG_CHECKING([if gcc accepts -fno-stack-protector])
safe_CFLAGS=$CFLAGS
CFLAGS="-fno-stack-protector"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
return 0;
]])], [
no_stack_protector=yes
FLAG_FNO_STACK_PROTECTOR="-fno-stack-protector"
AC_MSG_RESULT([yes])
], [
no_stack_protector=no
FLAG_FNO_STACK_PROTECTOR=""
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AC_SUBST(FLAG_FNO_STACK_PROTECTOR)
if test x$no_stack_protector = xyes; then
CFLAGS="$CFLAGS -fno-stack-protector"
fi
# does this compiler support --param inline-unit-growth=... ?
AC_MSG_CHECKING([if gcc accepts --param inline-unit-growth])
safe_CFLAGS=$CFLAGS
CFLAGS="--param inline-unit-growth=900"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ ]], [[
return 0;
]])], [
AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH],
["--param inline-unit-growth=900"])
AC_MSG_RESULT([yes])
], [
AC_SUBST([FLAG_UNLIMITED_INLINE_UNIT_GROWTH], [""])
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
# does the linker support -Wl,--build-id=none ? Note, it's
# important that we test indirectly via whichever C compiler
# is selected, rather than testing /usr/bin/ld or whatever
# directly.
AC_MSG_CHECKING([if the linker accepts -Wl,--build-id=none])
safe_CFLAGS=$CFLAGS
CFLAGS="-Wl,--build-id=none"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([ ], [return 0;])],
[
AC_SUBST([FLAG_NO_BUILD_ID], ["-Wl,--build-id=none"])
AC_MSG_RESULT([yes])
], [
AC_SUBST([FLAG_NO_BUILD_ID], [""])
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
# does the ppc assembler support "mtocrf" et al?
AC_MSG_CHECKING([if ppc32/64 as supports mtocrf/mfocrf])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
__asm__ __volatile__("mtocrf 4,0");
__asm__ __volatile__("mfocrf 0,4");
]])], [
ac_have_as_ppc_mftocrf=yes
AC_MSG_RESULT([yes])
], [
ac_have_as_ppc_mftocrf=no
AC_MSG_RESULT([no])
])
if test x$ac_have_as_ppc_mftocrf = xyes ; then
AC_DEFINE(HAVE_AS_PPC_MFTOCRF, 1, [Define to 1 if as supports mtocrf/mfocrf.])
fi
CFLAGS=$safe_CFLAGS
# does the x86/amd64 assembler understand SSE3 instructions?
# Note, this doesn't generate a C-level symbol. It generates a
# automake-level symbol (BUILD_SSE3_TESTS), used in test Makefile.am's
AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE3])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
do { long long int x;
__asm__ __volatile__("fisttpq (%0)" : :"r"(&x) ); }
while (0)
]])], [
ac_have_as_sse3=yes
AC_MSG_RESULT([yes])
], [
ac_have_as_sse3=no
AC_MSG_RESULT([no])
])
AM_CONDITIONAL(BUILD_SSE3_TESTS, test x$ac_have_as_sse3 = xyes)
# Ditto for SSSE3 instructions (note extra S)
# Note, this doesn't generate a C-level symbol. It generates a
# automake-level symbol (BUILD_SSSE3_TESTS), used in test Makefile.am's
AC_MSG_CHECKING([if x86/amd64 assembler speaks SSSE3])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
do { long long int x;
__asm__ __volatile__(
"pabsb (%0),%%xmm7" : : "r"(&x) : "xmm7" ); }
while (0)
]])], [
ac_have_as_ssse3=yes
AC_MSG_RESULT([yes])
], [
ac_have_as_ssse3=no
AC_MSG_RESULT([no])
])
AM_CONDITIONAL(BUILD_SSSE3_TESTS, test x$ac_have_as_ssse3 = xyes)
# does the x86/amd64 assembler understand the PCLMULQDQ instruction?
# Note, this doesn't generate a C-level symbol. It generates a
# automake-level symbol (BUILD_PCLMULQDQ_TESTS), used in test Makefile.am's
AC_MSG_CHECKING([if x86/amd64 assembler supports 'pclmulqdq'])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
do {
__asm__ __volatile__(
"pclmulqdq \$17,%%xmm6,%%xmm7" : : : "xmm6", "xmm7" ); }
while (0)
]])], [
ac_have_as_pclmulqdq=yes
AC_MSG_RESULT([yes])
], [
ac_have_as_pclmulqdq=no
AC_MSG_RESULT([no])
])
AM_CONDITIONAL(BUILD_PCLMULQDQ_TESTS, test x$ac_have_as_pclmulqdq = xyes)
# does the x86/amd64 assembler understand the LZCNT instruction?
# Note, this doesn't generate a C-level symbol. It generates a
# automake-level symbol (BUILD_LZCNT_TESTS), used in test Makefile.am's
AC_MSG_CHECKING([if x86/amd64 assembler supports 'lzcnt'])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
do {
__asm__ __volatile__("lzcnt %rax,%rax");
} while (0)
]])], [
ac_have_as_lzcnt=yes
AC_MSG_RESULT([yes])
], [
ac_have_as_lzcnt=no
AC_MSG_RESULT([no])
])
AM_CONDITIONAL([BUILD_LZCNT_TESTS], [test x$ac_have_as_lzcnt = xyes])
# does the x86/amd64 assembler understand SSE 4.2 instructions?
# Note, this doesn't generate a C-level symbol. It generates a
# automake-level symbol (BUILD_SSE42_TESTS), used in test Makefile.am's
AC_MSG_CHECKING([if x86/amd64 assembler speaks SSE4.2])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
do { long long int x;
__asm__ __volatile__(
"crc32q %%r15,%%r15" : : : "r15" ); }
while (0)
]])], [
ac_have_as_sse42=yes
AC_MSG_RESULT([yes])
], [
ac_have_as_sse42=no
AC_MSG_RESULT([no])
])
AM_CONDITIONAL(BUILD_SSE42_TESTS, test x$ac_have_as_sse42 = xyes)
# XXX JRS 2010 Oct 13: what is this for? For sure, we don't need this
# when building the tool executables. I think we should get rid of it.
#
# Check for TLS support in the compiler and linker
AC_LINK_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
[[return foo;]])],
[vg_cv_linktime_tls=yes],
[vg_cv_linktime_tls=no])
# Native compilation: check whether running a program using TLS succeeds.
# Linking only is not sufficient -- e.g. on Red Hat 7.3 linking TLS programs
# succeeds but running programs using TLS fails.
# Cross-compiling: check whether linking a program using TLS succeeds.
AC_CACHE_CHECK([for TLS support], vg_cv_tls,
[AC_ARG_ENABLE(tls, [ --enable-tls platform supports TLS],
[vg_cv_tls=$enableval],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([[static __thread int foo;]],
[[return foo;]])],
[vg_cv_tls=yes],
[vg_cv_tls=no],
[vg_cv_tls=$vg_cv_linktime_tls])])])
if test "$vg_cv_tls" = yes; then
AC_DEFINE([HAVE_TLS], 1, [can use __thread to define thread-local variables])
fi
#----------------------------------------------------------------------------
# Checks for C header files.
#----------------------------------------------------------------------------
AC_HEADER_STDC
AC_CHECK_HEADERS([ \
asm/unistd.h \
endian.h \
mqueue.h \
sys/endian.h \
sys/epoll.h \
sys/eventfd.h \
sys/klog.h \
sys/poll.h \
sys/signal.h \
sys/signalfd.h \
sys/syscall.h \
sys/time.h \
sys/types.h \
])
# Verify whether the <linux/futex.h> header is usable.
AC_MSG_CHECKING([if <linux/futex.h> is usable])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <linux/futex.h>
]], [[
return FUTEX_WAIT;
]])], [
AC_DEFINE([HAVE_USABLE_LINUX_FUTEX_H], 1,
[Define to 1 if you have a usable <linux/futex.h> header file.])
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])
#----------------------------------------------------------------------------
# Checks for typedefs, structures, and compiler characteristics.
#----------------------------------------------------------------------------
AC_TYPE_UID_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_HEADER_TIME
#----------------------------------------------------------------------------
# Checks for library functions.
#----------------------------------------------------------------------------
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_CHECK_LIB([pthread], [pthread_create])
AC_CHECK_LIB([rt], [clock_gettime])
AC_CHECK_FUNCS([ \
clock_gettime\
epoll_create \
epoll_pwait \
klogctl \
mallinfo \
memchr \
memset \
mkdir \
mremap \
ppoll \
pthread_barrier_init \
pthread_condattr_setclock \
pthread_mutex_timedlock \
pthread_rwlock_timedrdlock \
pthread_rwlock_timedwrlock \
pthread_spin_lock \
pthread_yield \
readlinkat \
semtimedop \
signalfd \
sigwaitinfo \
strchr \
strdup \
strpbrk \
strrchr \
strstr \
syscall \
utimensat \
])
# AC_CHECK_LIB adds any library found to the variable LIBS, and links these
# libraries with any shared object and/or executable. This is NOT what we
# want for e.g. vgpreload_core-x86-linux.so
LIBS=""
AM_CONDITIONAL([HAVE_PTHREAD_BARRIER],
[test x$ac_cv_func_pthread_barrier_init = xyes])
AM_CONDITIONAL([HAVE_PTHREAD_MUTEX_TIMEDLOCK],
[test x$ac_cv_func_pthread_mutex_timedlock = xyes])
AM_CONDITIONAL([HAVE_PTHREAD_SPINLOCK],
[test x$ac_cv_func_pthread_spin_lock = xyes])
#----------------------------------------------------------------------------
# MPI checks
#----------------------------------------------------------------------------
# Do we have a useable MPI setup on the primary and/or secondary targets?
# On Linux, by default, assumes mpicc and -m32/-m64
# Note: this is a kludge in that it assumes the specified mpicc
# understands -m32/-m64 regardless of what is specified using
# --with-mpicc=.
MPI_CC="mpicc"
mflag_primary=
if test x$VGCONF_PLATFORM_PRI_CAPS = xX86_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xPPC32_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xARM_LINUX ; then
mflag_primary=$FLAG_M32
elif test x$VGCONF_PLATFORM_PRI_CAPS = xAMD64_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xPPC64_LINUX \
-o x$VGCONF_PLATFORM_PRI_CAPS = xS390X_LINUX ; then
mflag_primary=$FLAG_M64
fi
mflag_secondary=
if test x$VGCONF_PLATFORM_SEC_CAPS = xX86_LINUX \
-o x$VGCONF_PLATFORM_SEC_CAPS = xPPC32_LINUX ; then
mflag_secondary=$FLAG_M32
fi
AC_ARG_WITH(mpicc,
[ --with-mpicc= Specify name of MPI2-ised C compiler],
MPI_CC=$withval
)
AC_SUBST(MPI_CC)
## See if MPI_CC works for the primary target
##
AC_MSG_CHECKING([primary target for usable MPI2-compliant C compiler and mpi.h])
saved_CC=$CC
saved_CFLAGS=$CFLAGS
CC=$MPI_CC
CFLAGS=$mflag_primary
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <mpi.h>
#include <stdio.h>
]], [[
int r = MPI_Init(NULL,NULL);
r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
return r;
]])], [
ac_have_mpi2_pri=yes
AC_MSG_RESULT([yes, $MPI_CC])
], [
ac_have_mpi2_pri=no
AC_MSG_RESULT([no])
])
CC=$saved_CC
CFLAGS=$saved_CFLAGS
AM_CONDITIONAL(BUILD_MPIWRAP_PRI, test x$ac_have_mpi2_pri = xyes)
## See if MPI_CC works for the secondary target. Complication: what if
## there is no secondary target? We need this to then fail.
## Kludge this by making MPI_CC something which will surely fail in
## such a case.
##
AC_MSG_CHECKING([secondary target for usable MPI2-compliant C compiler and mpi.h])
saved_CC=$CC
saved_CFLAGS=$CFLAGS
if test x$VGCONF_PLATFORM_SEC_CAPS = x ; then
CC="$MPI_CC this will surely fail"
else
CC=$MPI_CC
fi
CFLAGS=$mflag_secondary
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <mpi.h>
#include <stdio.h>
]], [[
int r = MPI_Init(NULL,NULL);
r |= MPI_Type_get_contents( MPI_INT, 0,0,0, NULL,NULL,NULL );
return r;
]])], [
ac_have_mpi2_sec=yes
AC_MSG_RESULT([yes, $MPI_CC])
], [
ac_have_mpi2_sec=no
AC_MSG_RESULT([no])
])
CC=$saved_CC
CFLAGS=$saved_CFLAGS
AM_CONDITIONAL(BUILD_MPIWRAP_SEC, test x$ac_have_mpi2_sec = xyes)
#----------------------------------------------------------------------------
# Other library checks
#----------------------------------------------------------------------------
# There now follow some tests for Boost, and OpenMP. These
# tests are present because Drd has some regression tests that use
# these packages. All regression test programs all compiled only
# for the primary target. And so it is important that the configure
# checks that follow, use the correct -m32 or -m64 flag for the
# primary target (called $mflag_primary). Otherwise, we can end up
# in a situation (eg) where, on amd64-linux, the test for Boost checks
# for usable 64-bit Boost facilities, but because we are doing a 32-bit
# only build (meaning, the primary target is x86-linux), the build
# of the regtest programs that use Boost fails, because they are
# build as 32-bit (IN THIS EXAMPLE).
#
# Hence: ALWAYS USE $mflag_primary FOR CONFIGURE TESTS FOR FACILITIES
# NEEDED BY THE REGRESSION TEST PROGRAMS.
# Check whether the boost library 1.35 or later has been installed.
# The Boost.Threads library has undergone a major rewrite in version 1.35.0.
AC_MSG_CHECKING([for boost])
AC_LANG(C++)
safe_CXXFLAGS=$CXXFLAGS
CXXFLAGS="-lboost_thread-mt $mflag_primary"
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <boost/thread.hpp>
static void thread_func(void)
{ }
int main(int argc, char** argv)
{
boost::thread t(thread_func);
return 0;
}
])],
[
ac_have_boost_1_35=yes
AC_SUBST([BOOST_CFLAGS], [])
AC_SUBST([BOOST_LIBS], ["${CXXFLAGS}"])
AC_MSG_RESULT([yes])
], [
ac_have_boost_1_35=no
AC_MSG_RESULT([no])
])
CXXFLAGS=$safe_CXXFLAGS
AC_LANG(C)
AM_CONDITIONAL([HAVE_BOOST_1_35], [test x$ac_have_boost_1_35 = xyes])
# does this compiler support -fopenmp, does it have the include file
# <omp.h> and does it have libgomp ?
AC_MSG_CHECKING([for OpenMP])
safe_CFLAGS=$CFLAGS
CFLAGS="-fopenmp $mflag_primary"
AC_LINK_IFELSE([AC_LANG_SOURCE([
#include <omp.h>
int main(int argc, char** argv)
{
omp_set_dynamic(0);
return 0;
}
])],
[
ac_have_openmp=yes
AC_MSG_RESULT([yes])
], [
ac_have_openmp=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AM_CONDITIONAL([HAVE_OPENMP], [test x$ac_have_openmp = xyes])
# does this compiler have built-in functions for atomic memory access ?
AC_MSG_CHECKING([if gcc supports __sync_bool_compare_and_swap])
safe_CFLAGS=$CFLAGS
CFLAGS="$mflag_primary"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
int variable = 1;
return (__sync_bool_compare_and_swap(&variable, 1, 2)
&& __sync_add_and_fetch(&variable, 1) ? 1 : 0)
]])], [
ac_have_builtin_atomic=yes
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_BUILTIN_ATOMIC, 1, [Define to 1 if gcc supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
], [
ac_have_builtin_atomic=no
AC_MSG_RESULT([no])
])
CFLAGS=$safe_CFLAGS
AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC], [test x$ac_have_builtin_atomic = xyes])
# does g++ have built-in functions for atomic memory access ?
AC_MSG_CHECKING([if g++ supports __sync_bool_compare_and_swap])
safe_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$mflag_primary"
AC_LANG_PUSH(C++)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[
int variable = 1;
return (__sync_bool_compare_and_swap(&variable, 1, 2)
&& __sync_add_and_fetch(&variable, 1) ? 1 : 0)
]])], [
ac_have_builtin_atomic_cxx=yes
AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_BUILTIN_ATOMIC_CXX, 1, [Define to 1 if g++ supports __sync_bool_compare_and_swap() and __sync_add_and_fetch()])
], [
ac_have_builtin_atomic_cxx=no
AC_MSG_RESULT([no])
])
AC_LANG_POP(C++)
CXXFLAGS=$safe_CXXFLAGS
AM_CONDITIONAL([HAVE_BUILTIN_ATOMIC_CXX], [test x$ac_have_builtin_atomic_cxx = xyes])
#----------------------------------------------------------------------------
# Ok. We're done checking.
#----------------------------------------------------------------------------
# Nb: VEX/Makefile is generated from Makefile.vex.in.
AC_CONFIG_FILES([
Makefile
VEX/Makefile:Makefile.vex.in
valgrind.spec
valgrind.pc
glibc-2.X.supp
docs/Makefile
tests/Makefile
tests/vg_regtest
perf/Makefile
perf/vg_perf
gdbserver_tests/Makefile
include/Makefile
auxprogs/Makefile
mpi/Makefile
coregrind/Makefile
memcheck/Makefile
memcheck/tests/Makefile
memcheck/tests/amd64/Makefile
memcheck/tests/x86/Makefile
memcheck/tests/linux/Makefile
memcheck/tests/darwin/Makefile
memcheck/tests/amd64-linux/Makefile
memcheck/tests/x86-linux/Makefile
memcheck/tests/ppc32/Makefile
memcheck/tests/ppc64/Makefile
memcheck/perf/Makefile
cachegrind/Makefile
cachegrind/tests/Makefile
cachegrind/tests/x86/Makefile
cachegrind/cg_annotate
cachegrind/cg_diff
callgrind/Makefile
callgrind/callgrind_annotate
callgrind/callgrind_control
callgrind/tests/Makefile
helgrind/Makefile
helgrind/tests/Makefile
massif/Makefile
massif/tests/Makefile
massif/perf/Makefile
massif/ms_print
lackey/Makefile
lackey/tests/Makefile
none/Makefile
none/tests/Makefile
none/tests/amd64/Makefile
none/tests/ppc32/Makefile
none/tests/ppc64/Makefile
none/tests/x86/Makefile
none/tests/arm/Makefile
none/tests/s390x/Makefile
none/tests/linux/Makefile
none/tests/darwin/Makefile
none/tests/x86-linux/Makefile
exp-sgcheck/Makefile
exp-sgcheck/tests/Makefile
drd/Makefile
drd/scripts/download-and-build-splash2
drd/tests/Makefile
exp-bbv/Makefile
exp-bbv/tests/Makefile
exp-bbv/tests/x86/Makefile
exp-bbv/tests/x86-linux/Makefile
exp-bbv/tests/amd64-linux/Makefile
exp-bbv/tests/ppc32-linux/Makefile
exp-bbv/tests/arm-linux/Makefile
exp-dhat/Makefile
exp-dhat/tests/Makefile
])
AC_CONFIG_FILES([coregrind/link_tool_exe_linux],
[chmod +x coregrind/link_tool_exe_linux])
AC_CONFIG_FILES([coregrind/link_tool_exe_darwin],
[chmod +x coregrind/link_tool_exe_darwin])
AC_OUTPUT
cat<<EOF
Maximum build arch: ${ARCH_MAX}
Primary build arch: ${VGCONF_ARCH_PRI}
Secondary build arch: ${VGCONF_ARCH_SEC}
Build OS: ${VGCONF_OS}
Primary build target: ${VGCONF_PLATFORM_PRI_CAPS}
Secondary build target: ${VGCONF_PLATFORM_SEC_CAPS}
Platform variant: ${VGCONF_PLATVARIANT}
Primary -DVGPV string: -DVGPV_${VGCONF_ARCH_PRI}_${VGCONF_OS}_${VGCONF_PLATVARIANT}=1
Default supp files: ${DEFAULT_SUPP}
EOF
|