1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326
|
#!/usr/bin/perl -w
#
# java-gnome, a UI library for writing GTK and GNOME programs from Java!
#
# Copyright © 2005-2011 Operational Dynamics Consulting, Pty Ltd and Others
#
# The code in this file, and the program it is a part of, is made available
# to you by its authors as open source software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License version
# 2 ("GPL") as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GPL for more details.
#
# You should have received a copy of the GPL along with this program. If not,
# see http://www.gnu.org/licenses/. The authors of this program may be
# contacted through http://java-gnome.sourceforge.net/.
#
#
# configure
# part of Equivalence, version 0.2.x
#
# THIS IS A PROTOTYPE. Although functional enough, this has grown to the point
# of being a somewhat embarrassing and monolithic piece of code. Patches are
# gladly accepted to this file to fix bugs and improve prerequisite detection,
# but be aware that a new and refactored version is in progress. With any
# luck, it will be easier to extend and suitable for use by other projects. See
# http://research.operationaldynamics.com/projects/equivalence/ In the mean
# time, see README for instructions on how to use this one.
#
use strict;
use File::Basename;
use Cwd 'abs_path';
#
# Configure java-gnome for building. We:
#
# - determine the operating system
#
# - set known defaults that correspond to that OS
#
# - for items where we have multiple possibilities, work through the
# possibilities until we find one
#
# - for items where there are options to choose from (notably which java
# compiler and VM we're using), we select a sensible default unless
# instructed otherwise on the command line.
#
my $os;
my $cpu_arch = ""; # set only when needed
my $quiet;
# There's nothing worse than having an old config file, getting half way
# through this, having it break, and then being able to build, but getting
# errors because configure really didn't finish. We do leave .config.tmp
# in place on error to facilitate troubleshooting.
`rm -f .config`;
`rm -f Hello.java Hello.class`;
# --------------------------------------------------------------------
# Utility and checking functions
# --------------------------------------------------------------------
#
# Very simply: if the msg does not contain a newline, then it is assumed
# to introduce a statement, so we print it and left pad it with spaces.
# If the text does contain a newline, then probably it is concluding a
# statement (ok, failed, whatever) but not necessarily - just print the thing
# without any padding.
#
sub output {
my $str = shift;
if ($str =~ /\n/) {
print $str unless $quiet;
} else {
printf "%-35s", $str unless $quiet;
}
}
sub which {
my $program = shift;
my $path = $ENV{'PATH'};
my @path_dirs = split /:+/, $path;
foreach my $dir (@path_dirs) {
if (-f "$dir/$program") {
return abs_path("$dir/$program");
}
}
return $program;
}
sub bail {
my $status = shift || "failed";
my $msg = shift || "";
# assuming that we're in an incomplete line
output "$status\n\n";
print "$msg\n\n" if $msg;
print "Failed to complete configuration.\n";
exit(1);
}
# Check for all the required gnome development libraries. Distributions such as
# Ubuntu/Debian and Fedora don't always install the gnome development libs
# (for whatever reason). If they aren't installed, we bomb here in configure
# instead of dying unceremoniously while make'ing.
sub check_system_library(\@$$@) {
my ($gnomedevref, $pkgconfig, $item, $package) = @_;
output " - ".$item;
my $found;
my $str = "";
my $tries = "";
$found = system("pkg-config --exists '$pkgconfig'");
if ($found) {
my $msg;
$msg = `pkg-config --modversion --errors-to-stdout '$pkgconfig'`;
$str .= "$msg\n" if ($msg =~ /^Requested /);
$str .= "In order to build java-gnome, you will need the GNOME\n";
$str .= "development libraries. Depending on what you have installed,\n";
$str .= "this could be a considerable set of packages, but if you\n";
$str .= "want to be a GNOME hacker, that's the way it is.\n\n";
$str .= "On a ".ucfirst($os)." system, you should be able to satisfy this\n";
$str .= "requirement by doing:\n\n";
$str .= " # ";
if ($os eq "gentoo") {
$str .= "emerge";
} elsif ($os eq "debian") {
$str .= "apt-get install";
} elsif ($os eq "fedora") {
$str .= "yum install";
} elsif ($os eq "suse") {
$str .= "zypper install";
} elsif ($os eq "arch") {
$str .= "FIXME";
} elsif ($os eq "mandriva") {
$str .= "urpmi";
} elsif ($os eq "solaris") {
$str .= "pkgadd";
} elsif ($os eq "slackware") {
$str .= "slackpkg install";
} else {
$str .= "[FIXME fetch and install command for this OS]";
}
$str .= " $package";
bail "not found!", $str;
}
print "found\n";
push(@$gnomedevref, $found);
}
# The files (jars) to check for should be listed in order of preference, as the
# first one found will be the one selected. For example, if you want version 3
# but version 2 will do, list them in that order. Typically, this means that
# you list newer libraries first, on the presumption that you'd rather use the
# newer one than the older one; when adding upgrades put them above the
# already present entries.
sub check_prereq (\@$$@) {
my ($jararrayref, $item, $package, @files) = @_;
output " - ".$item;
my $str;
my $tries = "";
my $found = "";
foreach my $file ( @files ) {
if ( -f "$file" ) {
$found = $file;
last;
}
$tries .= ($tries ? ", or" : "" ) . "\n\t". basename($file) . "\t(looked in ".dirname($file).")";
}
if ( ! "$found" ) {
$str = "In order to build java-gnome, you need\n".$tries;
$str .= "\n\nwhich is part of the $item Java library.\n";
$str .= "On a ".ucfirst($os)." system, you should be able to get this requirement by doing:\n\n";
$str .= " # ";
if ($os eq "gentoo") {
$str .= "emerge";
} elsif ($os eq "debian") {
$str .= "apt-get install";
} elsif ($os eq "fedora") {
$str .= "yum install";
} elsif ($os eq "suse") {
$str .= "zypper install";
} elsif ($os eq "arch") {
$str .= "FIXME";
} elsif ($os eq "mandriva") {
$str .= "urpmi";
} elsif ($os eq "solaris") {
$str .= "pkgadd";
} elsif ($os eq "slackware") {
$str .= "slackpkg install";
} else {
$str .= "[FIXME fetch and install command for this OS]";
}
$str .= " $package";
bail "not found!", $str;
}
print "found\n";
push (@$jararrayref, $found);
}
# if we return without setting the variable pointed at by scalarref, its being
# empty will be used later to indicate that this compiler wasn't present /
# usable.
#
# The "not present" check is somewhat spurious given the input in many cases
# is the result of a `which` call.
sub check_compiler (\$$$$) {
my $scalarref = $_[0];
my $item = $_[1];
my $program = $_[2];
my $args = $_[3];
chomp $program;
if ( ! -f "$program") {
$$scalarref = "";
return;
}
# appealing to my sense of economy, we only print something out if
# it's there - that way we can list lots of options to check without
# cluttering things endlessly.
output " - ".$item;
if ( ! -x "$program") {
output "found but not executable\n";
$$scalarref = "";
return;
}
# Ok, so inline code is lame, but it's so small, and only one,
# and, avoids having a file in tests/ that will be picked up later
# as neededing compiling.
if (! -f "Hello.java") {
open HELLO, ">Hello.java";
print HELLO <<HERE ;
public class Hello {
public static void main(String[] args) {
System.out.println("Hello");
}
}
HERE
close HELLO;
}
`$program $args -sourcepath . Hello.java >/dev/null 2>&1`;
if ($? != 0) {
output "doesn't work\n";
$$scalarref = "";
return
}
output "works\n";
$$scalarref = "$program $args";
}
#
# Check that a jar program somewhere works.
#
sub check_jar (\$$$$) {
my $scalarref = $_[0];
my $item = $_[1];
my $program = $_[2];
my $args = $_[3];
chomp $program;
if ( ! -f "$program") {
$$scalarref = "";
return;
}
# appealing to my sense of economy, we only print something out if
# it's there - that way we can list lots of options to check without
# cluttering things endlessly.
output " - ".$item;
if ( ! -x "$program") {
output "found but not executable\n";
$$scalarref = "";
return;
}
`$program cf Hello.jar $args Hello.class >/dev/null 2>&1`;
if (($? != 0) || (! -f "Hello.jar")) {
output "doesn't work\n";
$$scalarref = "";
return
}
# TODO validate the result
output "works\n";
$$scalarref = "$program $args";
}
#
# Check that a javadoc program somewhere works.
#
sub check_javadoc (\$$$$) {
my $scalarref = $_[0];
my $item = $_[1];
my $program = $_[2];
my $args = $_[3];
chomp $program;
if ( ! -f "$program") {
$$scalarref = "";
return;
}
# appealing to my sense of economy, we only print something out if
# it's there - that way we can list lots of options to check without
# cluttering things endlessly.
output " - ".$item;
if ( ! -x "$program") {
output "found but not executable\n";
$$scalarref = "";
return;
}
# TODO validate the result
output "found\n";
$$scalarref = "$program $args";
}
sub check_runtime (\$$$$) {
my $scalarref = $_[0];
my $item = $_[1];
my $program = $_[2];
my $args = $_[3];
chomp $program;
if ( ! -f "$program") {
$$scalarref = "";
return;
}
output " - ".$item;
if ( ! -x "$program") {
output "found but not executable\n";
$$scalarref = "";
return;
}
my $output = `$program -version 2>&1 | grep 'version "'`;
$output =~ s/.*version \"(.*)\".*/$1/g;
my @version = split(/[\.\-\_]/, $output);
for (my $i = 0; $i < 3; $i++) {
chomp $version[$i];
if (!($version[$i] =~ /^\d+$/)) {
output "can't parse version\n";
$$scalarref = "";
return
}
}
if (
($version[0] < 1) ||
($version[0] == 1 && ($version[1] < 4))
) {
output "not >= 1.5.0\n";
$$scalarref = "";
return
}
$output = `$program $args Hello 2>/dev/null`;
chomp $output;
if (($? != 0) || ($output ne "Hello")) {
output "doesn't work\n";
$$scalarref = "";
return
}
output "works\n";
$$scalarref = "$program $args";
}
sub check_jni_header_generator(\$$$$) {
my $scalarref = $_[0];
my $item = $_[1];
my $program = $_[2];
my $args = $_[3];
chomp $program;
if ( ! -f "$program") {
$$scalarref = "";
return;
}
# appealing to my sense of economy, we only print something out if
# it's there - that way we can list lots of options to check without
# cluttering things endlessly.
output " - ".$item;
if ( ! -x "$program") {
output "found but not executable\n";
$$scalarref = "";
return;
}
# FIXME do a test!
output "found\n";
$$scalarref = "$program $args";
}
# test for C compiler
sub check_CC (\$$$$) {
my $scalarref = $_[0];
my $item = $_[1];
my $program = $_[2];
my $args = $_[3];
chomp $program;
if ( ! -f "$program") {
$$scalarref = "";
return;
}
# appealing to my sense of economy, we only print something out if
# it's there - that way we can list lots of options to check without
# cluttering things endlessly.
output " - ".$item;
if ( ! -x "$program") {
output "found but not executable\n";
$$scalarref = "";
return;
}
# Hello.java should already available.
open HELLO, ">Hello.c";
print HELLO <<HERE ;
#include <stdio.h>
int main(int argc, char **argv) {
printf("Hello");
return 0;
}
HERE
close HELLO;
# compile
`$program $args -o Hello.o -c Hello.c >/dev/null 2>&1`;
if ($? != 0) {
output "compiling doesn't work\n";
$$scalarref = "";
return
}
if ( ! -f "Hello.o") {
bail "internal error","why isn't Hello.o present?";
}
# link
`$program $args -o Hello Hello.o >/dev/null 2>&1`;
if ($? != 0) {
output "linking doesn't work\n";
$$scalarref = "";
return
}
# run
my $output = `./Hello 2>/dev/null`;
chomp $output;
if (($? != 0) || ($output ne "Hello")) {
output "executable doesn't work\n";
$$scalarref = "";
return
}
output "works\n";
$$scalarref = "$program $args";
}
# --------------------------------------------------------------------
# Process command line arguments for overrides
# --------------------------------------------------------------------
my $prefix;
my $libdir;
my $jardir;
my $compiler;
my $runtime;
my $jdk_home;
my $gcj_home;
my $jamvm_bin;
my $cacao_bin;
my $strict = "";
foreach my $arg (@ARGV) {
my ($key, $value) = split /=/, "$arg";
if ($key eq "quiet") {
$quiet = 1;
} elsif (($key =~ /^-\?$/) ||
($key =~ /^-h$/) ||
($key =~ /^--help$/) ||
($key =~ /^-help$/) ||
($key =~ /^help$/)) {
print <<HERE ;
This is Equivalence, a simple build system suited to the
unique needs of configuring and compiling Java programs on
Linux and Unix.
Look at the README file in this directory for information
about this project and instructions on how to adjust the
./configure script's behaviour.
HERE
exit 4;
} elsif (($key =~ /^--prefix$/) ||
($key =~ /^prefix$/)) {
$prefix="$value";
} elsif (($key =~ /^--libdir$/) ||
($key =~ /^libdir$/)) {
$libdir="$value";
} elsif (($key =~ /^--jardir$/) ||
($key =~ /^jardir$/)) {
$jardir="$value";
} elsif ($key =~ /^runtime/) {
$runtime="$value";
} elsif ($key =~ /^compiler/) {
$compiler="$value";
} elsif ($key =~ /^jdk/) {
$jdk_home="$value";
} elsif ($key =~ /^gcj/) {
$gcj_home="$value";
} elsif ($key =~ /^cacao/) {
$cacao_bin="$value";
} elsif ($key =~ /^jamvm/) {
$jamvm_bin="$value";
} elsif ($key =~ /^strict/) {
$strict="yes";
}
}
# check jdk_home and gcj_home overrides. compiler and runtime are checked
# later (at the end) against choices that have been validated.
if ($jdk_home) {
$jdk_home =~ s/\/$//;
if (! -x "$jdk_home/bin/javac") {
bail "bad override", "jdk_home specified doesn't seem to be a Java Development Kit home directory!";
}
}
if ($gcj_home) {
$gcj_home =~ s/\/$//;
if (! -x "$gcj_home/bin/gcj") {
bail "bad override", "gcj_home specified doesn't seem to be a GCJ install!";
}
}
# --------------------------------------------------------------------
# Determine Operating System
# --------------------------------------------------------------------
output "\n";
open CONFIG, ">.config.tmp";
print CONFIG <<HERE ;
# This is an automatically generated Makefile fragment which is used
# to configure java-gnome for building. Do not edit (your changes will
# be overwritten next time ./configure is run), do not commit to
# repository. Anyone packaging java-gnome on any operating system:
# please do not override this file by patching it! Figure out what the
# problem is, and let us know so we can improve the ./configure perl
# script which generates it.
HERE
output "equivalence, v0.2\n";
output "...configuring Java projects to build and run on Linux & Unix\n";
output "\n";
output "Identify operating system:";
if (( -f "/etc/gentoo-release" ) || ( -f "/etc/make.conf" )) {
output "Gentoo\n";
$os = "gentoo";
} elsif ( -f "/etc/debian_version") {
output "Debian\n";
# and Ubuntu
$os = "debian";
} elsif ( -f "/etc/fedora-release" ) {
output "Fedora";
$os = "fedora";
} elsif ( -f "/etc/SuSE-release" ) {
output "Open SuSE";
$os = "suse";
} elsif ( -f "/etc/arch-release" ) {
output "Arch";
$os = "arch";
} elsif ( -f "/etc/mandriva-release" ) {
output "Mandriva";
$os = "mandriva";
# Mandriva Linux has different package names
# for 64-bit CPU architectures
if (-x "/bin/arch") {
my $arch = `/bin/arch`;
if ($arch =~ m/_64/) { # 64-bit OS
$cpu_arch = "64";
}
}
} elsif ( -f "/etc/release" ) {
if (`grep Solaris /etc/release`) {
output "Solaris";
$os = "solaris";
}
} elsif ( -f "/etc/slackware-version" ) {
output "Slackware";
$os = "slackware";
} elsif ( -f "/usr/bin/cygwin1.dll" ) {
output "Cygwin";
$os = "cygwin";
} elsif ( -f "/etc/centos-release" ) {
output "CentOS";
$os = "fedora";
} elsif ( -f "/etc/redhat-release" ) {
output "RedHat";
$os = "fedora";
} elsif ( -f "/etc/java/jpackage-release" ) {
output "JPackage";
$os = "fedora";
}
if ($os) {
print CONFIG "OS=$os\n\n";
} else {
bail "unknown!", <<HERE ;
What we really need you to do is to look into this configure program,
and tell us what to add. Based on the examples of what is specified
for other distributions, you can probably quickly figure out what the
appropriate settings are for your platform.
Letting us know what changes you had to make here (ie, whatever
actions resulted in a .config that allows you to build and test
java-gnome, and run the java-gnome demo) we can help others with your
operating system take advantage of this program.
HERE
}
output "\n";
# --------------------------------------------------------------------
# Specify locations of dependencies, by operating system, and
# verify pre-requisites are present.
# --------------------------------------------------------------------
my @junit_jars;
my $jni_path;
output "Check for required jar files:\n";
# ADVICE TO PEOPLE EXTENDING THIS SECTION FOR THEIR OWN OPERATING SYSTEM:
# You might as well list things in such an order that you tell the builder
# the package whose dependencies will bring the rest of the pre-requisites
# in along the way...
if ($os eq "gentoo") {
check_prereq(@junit_jars,
"JUnit test framework",
"junit",
"/usr/share/junit/lib/junit.jar");
} elsif ($os eq "debian") {
check_prereq(@junit_jars,
"JUnit test framework",
"junit",
"/usr/share/java/junit.jar");
} elsif ($os eq "fedora") {
check_prereq(@junit_jars,
"JUnit test framework",
"junit",
"/usr/share/java/junit.jar");
} elsif ($os eq "arch") {
check_prereq(@junit_jars,
"JUnit test framework",
"junit",
"/usr/share/java/junit.jar");
} elsif ($os eq "mandriva") {
check_prereq(@junit_jars,
"JUnit test framework",
"junit",
"/usr/share/java/junit.jar");
} elsif ($os eq "suse") {
check_prereq(@junit_jars,
"JUnit test framework",
"junit",
"/usr/share/java/junit.jar");
} elsif ($os eq "solaris") {
check_prereq(@junit_jars,
"JUnit test framework",
"junit",
"/usr/share/lib/java/junit.jar");
} elsif ($os eq "slackware") {
check_prereq(@junit_jars,
"JUnit test framework",
"junit",
"/usr/share/java/junit.jar");
} elsif ($os eq "cygwin") {
check_prereq(@junit_jars,
"JUnit test framework",
"junit",
"/usr/share/java/junit.jar");
} else {
bail "failed!", "This OS not configured with defaults!\nTHIS IS AN INTERNAL ERROR, PLEASE FILE A BUG.";
}
# This section checks for all the GNOME pre requisites.
# Paths mentioned here, are relative to the prefix.
my @gnomedev_libs;
output "\nCheck for required system libraries:\n";
if ($os eq "gentoo") {
check_system_library(@gnomedev_libs,
"glib-2.0 >= 2.28
gtk+-3.0 >= 3.0.0
pango >= 1.28
librsvg-2.0
atk
gdk-3.0
gtk+-unix-print-3.0
cairo-svg >= 1.10.0
gtksourceview-3.0",
"GNOME",
"gnome");
check_system_library(@gnomedev_libs,
"enchant",
"Enchant",
"app-text/enchant");
# check_system_library(@gnomedev_libs,
# "gtkspell-3.0",
# "GtkSpell",
# "gtkspell");
check_system_library(@gnomedev_libs,
"libnotify >= 0.7.0",
"LibNotify",
"libnotify");
check_system_library(@gnomedev_libs,
"unique-3.0",
"LibUnique",
"libunique");
} elsif ($os eq "slackware") {
# on slackware gdk-2.0 and gtk+-unix-print-2.0 are part of gtk+-2.0
# use http://packages.slackware.it/ for more details.
check_system_library(@gnomedev_libs,
"glib-2.0 >= 2.28",
"GLib",
"FIXME");
check_system_library(@gnomedev_libs,
"gtk+-3.0 >= 3.0.0",
"GTK+",
"gtk+2");
check_system_library(@gnomedev_libs,
"pango >= 1.28",
"Pango",
"pango");
check_system_library(@gnomedev_libs,
"librsvg-2.0",
"RSVG",
"FIXME");
check_system_library(@gnomedev_libs,
"atk",
"ATK",
"atk");
check_system_library(@gnomedev_libs,
"gtksourceview-3.0",
"GtkSourceView",
"FIXME");
check_system_library(@gnomedev_libs,
"libnotify >= 0.7.0",
"LibNotify",
"FIXME");
# check_system_library(@gnomedev_libs,
# "gtkspell-3.0",
# "GtkSpell",
# "FIXME");
check_system_library(@gnomedev_libs,
"unique-3.0",
"LibUnique",
"FIXME");
check_system_library(@gnomedev_libs,
"enchant",
"Enchant",
"FIXME");
} elsif ($os eq "debian") {
check_system_library(@gnomedev_libs,
"cairo-svg >= 1.10",
"Cairo",
"libcairo2-dev");
check_system_library(@gnomedev_libs,
"glib-2.0 >= 2.28",
"GLib",
"libglib2.0-dev");
check_system_library(@gnomedev_libs,
"gtk+-3.0 >= 3.0
gdk-3.0
gtk+-unix-print-3.0",
"GTK+",
"libgtk3.0-dev");
check_system_library(@gnomedev_libs,
"pango >= 1.28",
"Pango",
"libpango1.0-dev");
check_system_library(@gnomedev_libs,
"librsvg-2.0",
"RSVG",
"librsvg2-dev");
check_system_library(@gnomedev_libs,
"atk",
"ATK",
"libatk1.0-dev");
check_system_library(@gnomedev_libs,
"gtksourceview-3.0",
"GtkSourceView",
"libgtksourceview-3.0-dev");
check_system_library(@gnomedev_libs,
"libnotify >= 0.7.0",
"LibNotify",
"libnotify-dev");
check_system_library(@gnomedev_libs,
"enchant",
"Enchant",
"libenchant-dev");
# check_system_library(@gnomedev_libs,
# "gtkspell-3.0",
# "GtkSpell",
# "libgtkspell-dev");
check_system_library(@gnomedev_libs,
"unique-3.0",
"LibUnique",
"libunique-3.0-dev");
} elsif ($os eq "suse") {
check_system_library(@gnomedev_libs,
"cairo-svg >= 1.10",
"Cairo",
"libcairo2-dev");
check_system_library(@gnomedev_libs,
"glib-2.0 >= 2.28
gtk+-3.0 >= 3.0.0
pango >= 1.22
atk
gdk-3.0
gtk+-unix-print-3.0",
"GNOME development libraries",
"libgnome-devel");
check_system_library(@gnomedev_libs,
"librsvg-2.0",
"RSVG",
"librsvg-devel");
check_system_library(@gnomedev_libs,
"gtksourceview-3.0",
"GtkSourceView",
"FIXME");
check_system_library(@gnomedev_libs,
"libnotify >= 0.7.0",
"LibNotify",
"FIXME");
# check_system_library(@gnomedev_libs,
# "gtkspell-3.0",
# "GtkSpell",
# "FIXME");
check_system_library(@gnomedev_libs,
"unique-3.0",
"LibUnique",
"FIXME");
check_system_library(@gnomedev_libs,
"enchant",
"Enchant",
"FIXME");
} elsif ($os eq "mandriva") {
check_system_library(@gnomedev_libs,
"cairo-svg >= 1.10",
"Cairo",
"lib{$cpu_arch}cairo-devel");
# lib64cairo-devel-1.10.2-2-mdv2011.0.x86_64
check_system_library(@gnomedev_libs,
"glib-2.0 >= 2.28
gtk+-3.0
pango >= 1.22
atk
gdk-3.0
gtk+-unix-print-3.0",
"GTK development libraries",
"lib${cpu_arch}gtk+3.0-devel");
check_system_library(@gnomedev_libs,
"librsvg-2.0",
"RSVG",
"lib${cpu_arch}rsvg2-devel");
check_system_library(@gnomedev_libs,
"gtksourceview-3.0",
"GtkSourceView",
"lib${cpu_arch}gtksourceview-3.0-devel");
check_system_library(@gnomedev_libs,
"libnotify >= 0.7.0",
"LibNotify",
"lib${cpu_arch}notify-devel");
# check_system_library(@gnomedev_libs,
# "gtkspell-3.0",
# "GtkSpell",
# "lib${cpu_arch}gtkspell-devel");
check_system_library(@gnomedev_libs,
"unique-3.0",
"LibUnique",
"lib${cpu_arch}unique-devel");
check_system_library(@gnomedev_libs,
"enchant",
"Enchant",
"lib${cpu_arch}enchant-devel");
} elsif ($os eq "fedora") {
check_system_library(@gnomedev_libs,
"cairo-svg >= 1.10",
"Cairo",
"FIXME");
check_system_library(@gnomedev_libs,
"glib-2.0 >= 2.28",
"GLib",
"FIXME");
check_system_library(@gnomedev_libs,
"gtk+-3.0 >= 3.0
gdk-3.0
gtk+-unix-print-3.0",
"GTK+",
"FIXME");
check_system_library(@gnomedev_libs,
"pango >= 1.28",
"Pango",
"FIXME");
check_system_library(@gnomedev_libs,
"librsvg-2.0",
"RSVG",
"FIXME");
check_system_library(@gnomedev_libs,
"atk",
"ATK",
"FIXME");
check_system_library(@gnomedev_libs,
"gtksourceview-3.0",
"GtkSourceView",
"FIXME");
check_system_library(@gnomedev_libs,
"libnotify >= 0.7.0",
"LibNotify",
"FIXME");
check_system_library(@gnomedev_libs,
"enchant",
"Enchant",
"FIXME");
# check_system_library(@gnomedev_libs,
# "gtkspell-3.0",
# "GtkSpell",
# "FIXME");
check_system_library(@gnomedev_libs,
"unique-3.0",
"LibUnique",
"FIXME");
}
# --------------------------------------------------------------------
# Record jar locations
# --------------------------------------------------------------------
print CONFIG <<HERE ;
# The lists of jars are colon separated, suitable for being
# concatenated into a CLASSPATH
HERE
print CONFIG "JUNIT_JARS=".join(":",@junit_jars)."\n";
output "\n";
# --------------------------------------------------------------------
# Check compilers: locations, necessary arguments, and that they work
# --------------------------------------------------------------------
output "Check Java compilers:\n";
# compilers we will check for:
my $javac;
my $ecj;
my $gcjC; # The moniker $gcjC refers to `gcj -C`
my $kaffec;
# tools we check at same time (not switchable)
my $javah;
my $jar;
my $javadoc;
if ($os eq "gentoo") {
if ( ! -x "/usr/bin/java-config") {
bail "", "INTERNAL ERROR couldn't find java-config";
}
# this is getting ridiculous
my $java_home;
if ($jdk_home) {
$java_home = "$jdk_home";
} else {
$java_home = `java-config -O`;
chomp $java_home;
}
# check ecj, the standalone Eclipse compiler.
check_compiler($ecj, "Eclipse ecj", "/usr/bin/ecj-3.4", "-g -preserveAllLocals -nowarn -source 1.5 -target 1.5");
check_compiler($ecj, "Eclipse ecj", "/usr/bin/ecj-3.3", "-g -preserveAllLocals -nowarn -source 1.5 -target 1.5") unless $ecj;
# check javac (the one specified by Gentoo's java-config tool)
# The $vendor business is just some precision prettiness for the
# display.
my $javac_candidate;
my $javah_candidate;
my $jar_candidate;
my $javadoc_candidate;
my $vendor;
if ($jdk_home) {
$javac_candidate = "$jdk_home/bin/javac";
$javah_candidate = "$jdk_home/bin/javah";
$jar_candidate = "$jdk_home/bin/jar";
$javadoc_candidate = "$jdk_home/bin/javadoc";
$vendor = "Specified";
} else {
$javac_candidate = `java-config --javac`;
$javah_candidate = `java-config -O`;
chomp $javah_candidate;
$javadoc_candidate = $javah_candidate;
$javah_candidate .= "/bin/javah";
$javadoc_candidate .= "/bin/javadoc";
$jar_candidate = `java-config --jar`;
$vendor = "System";
}
if ($javac_candidate =~ /sun/i) {
$vendor = "Sun";
} elsif ($javac_candidate =~ /blackdown/i) {
$vendor = "Blackdown";
} elsif ($javac_candidate =~ /ibm/i) {
$vendor = "IBM";
}
check_compiler($javac, "$vendor javac", $javac_candidate, "-g -source 1.5 -target 1.5");
# check gcj. -C means generate .class files, not .o files (which are
# for linking into native executables.
my $gcj_candidate;
if ($gcj_home) {
$gcj_candidate = "$gcj_home/bin/gcj";
} else {
$gcj_candidate = which("gcj");
}
check_compiler($gcjC, "GNU gcj -C (bytecode mode)", $gcj_candidate, "-C");
# check tools
check_jni_header_generator($javah, "$vendor javah", $javah_candidate, "-jni");
check_jar($jar, "$vendor jar", $jar_candidate, "");
check_javadoc($javadoc, "$vendor javadoc", $javadoc_candidate, "");
} elsif ($os eq "debian") {
# we can do much better than this, especially for java/javac.
# Do we access the alternatives system, or just go with known
# paths, or...? `which` is lame
# check ecj, the standalone Eclipse compiler.
check_compiler($ecj, "Eclipse ecj", which("ecj"), "-g -preserveAllLocals -nowarn -source 1.5 -target 1.5");
# check for a proper "real" JDK's javac as installed (and maybe
# selected in the alternatives system) by the user. In other words,
# javac -> /opt/sun-jdk-1.4.2.02/bin/javac, not javac -> kaffec.
my $javac_candidate;
my $javah_candidate;
my $jar_candidate;
my $javadoc_candidate;
my $vendor;
if ($jdk_home) {
$javac_candidate = "$jdk_home/bin/javac";
$javah_candidate = "$jdk_home/bin/javah";
$jar_candidate = "$jdk_home/bin/jar";
$javadoc_candidate = "$jdk_home/bin/javadoc";
$vendor = "Specified";
} else {
$javac_candidate = which("javac");
$javah_candidate = "";
$jar_candidate = "";
$javadoc_candidate = "";
$vendor = "System";
}
if ($javac_candidate =~ /sun/i) {
$vendor = "Sun";
} elsif ($javac_candidate =~ /blackdown/i) {
$vendor = "Blackdown";
} elsif ($javac_candidate =~ /ibm/i) {
$vendor = "IBM";
}
check_compiler($javac, "$vendor javac", $javac_candidate, "-g -source 1.5 -target 1.5");
# check gcj. The moniker $gcjC refers to `gcj -C`. See HACKING.
my $gcj_candidate;
if ($gcj_home) {
$gcj_candidate = "$gcj_home/bin/gcj";
} else {
$gcj_candidate = which("gcj");
}
check_compiler($gcjC, "GNU gcj -C (bytecode mode)", $gcj_candidate, "-C -g");
# check for kaffe's compiler
check_compiler($kaffec, "Kaffe javac", "/usr/lib/kaffe/bin/javac", "");
# check for JDK tools. To suit Debian prejudices, use GNU tools if found.
check_jni_header_generator($javah, "$vendor javah", $javah_candidate, "-jni");
check_jni_header_generator($javah, "GNU gcjh", which("gcjh"), "-jni") unless $javah;
check_jni_header_generator($javah, "System javah", which("javah"), "-jni") unless $javah;
check_jar($jar, "$vendor jar", $jar_candidate, "");
check_jar($jar, "GNU fastjar", which("fastjar"), "") unless $jar;
check_jar($jar, "System jar", which("jar"), "") unless $jar;
check_javadoc($javadoc, "$vendor javadoc", $javadoc_candidate, "");
check_javadoc($javadoc, "GNU gjdoc", which("gjdoc"), "");
check_javadoc($javadoc, "System javadoc", which("javadoc"), "") unless $javadoc;
} elsif ($os eq "fedora") {
# we can do much better than this, especially for java/javac.
# Should we just go with known paths, or...? `which` is so lame
# check ecj, the standalone Eclipse compiler.
check_compiler($ecj, "Eclipse ecj", which("ecj"), "-g -preserveAllLocals -nowarn -source 1.5 -target 1.5");
my $javac_candidate;
my $javah_candidate;
my $jar_candidate;
my $javadoc_candidate;
my $vendor;
if ($jdk_home) {
$javac_candidate = "$jdk_home/bin/javac";
$javah_candidate = "$jdk_home/bin/javah";
$jar_candidate = "$jdk_home/bin/jar";
$javadoc_candidate = "$jdk_home/bin/javadoc";
$vendor = "Specified";
} else {
$javac_candidate = "/usr/bin/javac";
$javah_candidate = "/usr/bin/javah";
$jar_candidate = "/usr/bin/jar";
$javadoc_candidate = "/usr/bin/javadoc";
$vendor = "System Default";
}
check_compiler($javac, "$vendor javac", $javac_candidate, "-g -source 1.5 -target 1.5");
# check for gcj
my $gcj_candidate;
if ($gcj_home) {
$gcj_candidate = "$gcj_home/bin/gcj";
} else {
$gcj_candidate = which("gcj");
}
check_compiler($gcjC, "GNU gcj -C (bytecode mode)", $gcj_candidate, "-C");
# check for kaffe's compiler
check_compiler($kaffec, "Kaffe javac", which("kaffec"), "");
check_jni_header_generator($javah, "$vendor javah", $javah_candidate, "-jni");
check_jar($jar, "$vendor jar", $jar_candidate, "");
check_javadoc($javadoc, "$vendor javadoc", $javadoc_candidate, "");
} elsif ($os eq "suse") {
# check ecj, the standalone Eclipse compiler.
check_compiler($ecj, "Eclipse ecj", which("ecj"), "-g -preserveAllLocals -nowarn -source 1.5 -target 1.5");
my $javac_candidate;
my $javah_candidate;
my $jar_candidate;
my $javadoc_candidate;
my $vendor;
if ($jdk_home) {
$javac_candidate = "$jdk_home/bin/javac";
$javah_candidate = "$jdk_home/bin/javah";
$jar_candidate = "$jdk_home/bin/jar";
$javadoc_candidate = "$jdk_home/bin/javadoc";
$vendor = "Specified";
} else {
$javac_candidate = "/usr/lib/jvm/java/bin/javac";
$javah_candidate = "/usr/lib/jvm/java/bin/javah";
$jar_candidate = "/usr/lib/jvm/java/bin/jar";
$javadoc_candidate = "/usr/lib/jvm/java/bin/javadoc";
$vendor = "Sun";
}
check_compiler($javac, "$vendor javac", $javac_candidate, "-g -source 1.5 -target 1.5");
# check for gcj
my $gcj_candidate;
if ($gcj_home) {
$gcj_candidate = "$gcj_home/bin/gcj";
} else {
$gcj_candidate = which("gcj");
}
check_compiler($gcjC, "GNU gcj -C (bytecode mode)", $gcj_candidate, "-C");
# check for kaffe's compiler
check_compiler($kaffec, "Kaffe javac", which("kaffec"), "");
check_jni_header_generator($javah, "$vendor javah", $javah_candidate, "-jni");
check_jar($jar, "$vendor jar", $jar_candidate, "");
check_javadoc($javadoc, "$vendor javadoc", $javadoc_candidate, "");
} elsif ($os eq "arch") {
# we can do much better than this, especially for java/javac.
# Should we just go with known paths, or...? `which` is so lame
# check ecj, the standalone Eclipse compiler.
check_compiler($ecj, "Eclipse ecj", which("ecj"), "-g -preserveAllLocals -nowarn -source 1.5 -target 1.5");
my $javac_candidate;
my $javah_candidate;
my $jar_candidate;
my $javadoc_candidate;
my $vendor;
if ($jdk_home) {
$javac_candidate = "$jdk_home/bin/javac";
$javah_candidate = "$jdk_home/bin/javah";
$jar_candidate = "$jdk_home/bin/jar";
$javadoc_candidate = "$jdk_home/bin/javadoc";
$vendor = "Specified";
} else {
$javac_candidate = "/opt/java/bin/javac";
$javah_candidate = "/opt/java/bin/javah";
$jar_candidate = "/opt/java/bin/jar";
$javadoc_candidate = "/opt/java/bin/javadoc";
$vendor = "Sun";
}
check_compiler($javac, "$vendor javac", $javac_candidate, "-g -source 1.5 -target 1.5");
# check for gcj
my $gcj_candidate;
if ($gcj_home) {
$gcj_candidate = "$gcj_home/bin/gcj";
} else {
$gcj_candidate = which("gcj");
}
check_compiler($gcjC, "GNU gcj -C (bytecode mode)", $gcj_candidate, "-C");
# check for kaffe's compiler
check_compiler($kaffec, "Kaffe javac", which("kaffec"), "");
check_jni_header_generator($javah, "$vendor javah", $javah_candidate, "-jni");
check_jar($jar, "$vendor jar", $jar_candidate, "");
check_javadoc($javadoc, "$vendor javadoc", $javadoc_candidate, "");
} elsif ($os eq "mandriva") {
# check ecj, the standalone Eclipse compiler.
check_compiler($ecj, "Eclipse ecj", which("ecj"), "-g -preserveAllLocals -nowarn -source 1.5 -target 1.5");
my $javac_candidate;
my $javah_candidate;
my $jar_candidate;
my $javadoc_candidate;
my $vendor;
if ($jdk_home) {
$javac_candidate = "$jdk_home/bin/javac";
$javah_candidate = "$jdk_home/bin/javah";
$jar_candidate = "$jdk_home/bin/jar";
$javadoc_candidate = "$jdk_home/bin/javadoc";
$vendor = "Specified";
} else {
$javac_candidate = which("javac");
$javah_candidate = which("javah");
$jar_candidate = which("jar");
$javadoc_candidate = which("javadoc");
$vendor = "System";
}
check_compiler($javac, "$vendor javac", $javac_candidate, "-g -source 1.5 -target 1.5");
check_jni_header_generator($javah, "$vendor javah", $javah_candidate, "-jni");
check_jar($jar, "$vendor jar", $jar_candidate, "");
check_javadoc($javadoc, "$vendor javadoc", $javadoc_candidate, "");
} elsif ($os eq "solaris") {
check_compiler($ecj, "Eclipse ecj", which("ecj"), "-g -preserveAllLocals -nowarn -source 1.5 -target 1.5");
my $javac_candidate;
my $javah_candidate;
my $jar_candidate;
my $javadoc_candidate;
my $vendor;
if ($jdk_home) {
$javac_candidate = "$jdk_home/bin/javac";
$javah_candidate = "$jdk_home/bin/javah";
$jar_candidate = "$jdk_home/bin/jar";
$javadoc_candidate = "$jdk_home/bin/javadoc";
$vendor = "Specified";
} else {
$javac_candidate = "/usr/java/bin/javac";
$javah_candidate = "/usr/java/bin/javah";
$jar_candidate = "/usr/java/bin/jar";
$javadoc_candidate = "/usr/java/bin/javadoc";
$vendor = "Sun";
}
check_compiler($javac, "$vendor javac", $javac_candidate, "-g -source 1.5 -target 1.5");
# check for gcj
my $gcj_candidate;
if ($gcj_home) {
$gcj_candidate = "$gcj_home/bin/gcj";
} else {
$gcj_candidate = which("gcj");
}
check_compiler($gcjC, "GNU gcj -C (bytecode mode)", $gcj_candidate, "-C -g");
# check for kaffe's compiler
check_compiler($kaffec, "Kaffe javac", which("kaffec"), "");
check_jni_header_generator($javah, "$vendor javah", $javah_candidate, "-jni");
check_jar($jar, "$vendor jar", $jar_candidate, "");
check_javadoc($javadoc, "$vendor javadoc", $javadoc_candidate, "");
} elsif ($os eq "slackware") {
# we can do much better than this, especially for java/javac.
# Should we just go with known paths, or...? `which` is so lame
# check ecj, the standalone Eclipse compiler.
check_compiler($ecj, "Eclipse ecj", which("ecj"), "-g -preserveAllLocals -nowarn -source 1.5 -target 1.5");
my $javac_candidate;
my $javah_candidate;
my $jar_candidate;
my $javadoc_candidate;
my $vendor;
if ($jdk_home) {
$javac_candidate = "$jdk_home/bin/javac";
$javah_candidate = "$jdk_home/bin/javah";
$jar_candidate = "$jdk_home/bin/jar";
$javadoc_candidate = "$jdk_home/bin/javadoc";
$vendor = "Specified";
} else {
$javac_candidate = "/usr/lib/java/bin/javac";
$javah_candidate = "/usr/lib/java/bin/javah";
$jar_candidate = "/usr/lib/java/bin/jar";
$javadoc_candidate = "/usr/lib/java/bin/javadoc";
$vendor = "Sun";
}
check_compiler($javac, "$vendor javac", $javac_candidate, "-g -source 1.5 -target 1.5");
# check for gcj
my $gcj_candidate;
if ($gcj_home) {
$gcj_candidate = "$gcj_home/bin/gcj";
} else {
$gcj_candidate = which("gcj");
}
check_compiler($gcjC, "GNU gcj -C (bytecode mode)", $gcj_candidate, "-C");
# check for kaffe's compiler
check_compiler($kaffec, "Kaffe javac", which("kaffec"), "");
check_jni_header_generator($javah, "$vendor javah", $javah_candidate, "-jni");
check_jar($jar, "$vendor jar", $jar_candidate, "");
check_javadoc($javadoc, "$vendor javadoc", $javadoc_candidate, "");
} elsif ($os eq "cygwin") {
# check ecj, the standalone Eclipse compiler.
check_compiler($ecj, "Eclipse ecj", which("ecj"), "-g -preserveAllLocals -nowarn -source 1.5 -target 1.5");
my $javac_candidate;
my $javah_candidate;
my $jar_candidate;
my $javadoc_candidate;
my $vendor;
if ($jdk_home) {
$javac_candidate = "$jdk_home/bin/javac";
$javah_candidate = "$jdk_home/bin/javah";
$jar_candidate = "$jdk_home/bin/jar";
$javadoc_candidate = "$jdk_home/bin/javadoc";
$vendor = "Specified";
} else {
$javac_candidate = "/usr/bin/javac";
$javah_candidate = "/usr/bin/javah";
$jar_candidate = "/usr/bin/jar";
$javadoc_candidate = "/usr/bin/javadoc";
$vendor = "GNU Classpath";
}
check_compiler($javac, "$vendor javac", $javac_candidate, "-g -source 1.5 -target 1.5");
# check for gcj
my $gcj_candidate;
if ($gcj_home) {
$gcj_candidate = "$gcj_home/bin/gcj";
} else {
$gcj_candidate = which("gcj");
}
check_compiler($gcjC, "GNU gcj -C (bytecode mode)", $gcj_candidate, "-C");
# check for kaffe's compiler
check_compiler($kaffec, "Kaffe javac", which("kaffec"), "");
check_jni_header_generator($javah, "$vendor javah", $javah_candidate, "-jni");
check_jar($jar, "$vendor jar", $jar_candidate, "");
check_javadoc($javadoc, "$vendor javadoc", $javadoc_candidate, "");
} else {
bail "failed!", "This OS not configured with a workable Java compiler checks!\nTHIS IS AN INTERNAL ERROR, PLEASE FILE A BUG.";
}
output "\n";
# --------------------------------------------------------------------
# Check runtimes
# --------------------------------------------------------------------
output "Check Java virtual machines:\n";
# runtimes we will check for:
my $java;
my $gij;
my $kaffe;
my $cacao;
my $jamvm;
if ($os eq "gentoo") {
# check java (the one specified by Gentoo's java-config tool)
# Is there any actual scenario where the javac would be from one
# vendor's JDK and the java from anther's JRE? I can't imagine, but
# do the $vendor check again. It's only cosmetic in any event.
my $java_candidate;
my $vendor;
if ($jdk_home) {
$java_candidate = "$jdk_home/bin/java";
} else {
$java_candidate = `java-config --java`;
}
if ($java_candidate =~ /sun/i) {
$vendor = "Sun";
} elsif ($java_candidate =~ /blackdown/i) {
$vendor = "Blackdown";
} elsif ($java_candidate =~ /ibm/i) {
$vendor = "IBM";
} else {
$vendor = "System";
}
check_runtime($java, "$vendor java VM", $java_candidate, "-client -ea");
# check gij (the bytecode interpreter from the GCJ project)
my $gij_candidate;
if ($gcj_home) {
$gij_candidate = "$gcj_home/bin/gij";
} else {
$gij_candidate = which("gij");
}
check_runtime($gij, "GNU gij", $gij_candidate, "");
# check kaffe
check_runtime($kaffe, "kaffe VM", which("kaffe"), "");
# check jamvm (an elegant bytecode interpreter used by many in the
# CLASSPATH project to test new releases)
my $jamvm_candidate;
if ($jamvm_bin) {
$jamvm_candidate = "$jamvm_bin";
} else {
$jamvm_candidate = "/usr/bin/jamvm";
}
check_runtime($jamvm, "JamVM VM", $jamvm_candidate, "");
my $cacao_candidate;
if ($cacao_bin) {
$cacao_candidate = "$cacao_bin";
} else {
$cacao_candidate = "/usr/bin/cacao";
}
check_runtime($cacao, "CACAO VM", $cacao_candidate, "");
} elsif ($os eq "debian") {
# check for a proper JDK/JRE java Virtual Machine (presumably either
# blackdown, or the real thing from Sun or IBM, as installed by the
# user). NOTE that this does *NOT* mean Sable VM or kaffe (so, if the
# Debian alternatives system can say that's what's providing
# java-runtime, then we need to take advantage of that. This is for a
# real JRE only, ie java -> /opt/sun-jdk-1.4.2.02/bin/java, not for
# java -> kaffe.
my $java_candidate;
my $vendor;
if ($jdk_home) {
$java_candidate = "$jdk_home/bin/java";
$vendor = "Specified";
} else {
$java_candidate = which("java");
$vendor = "System";
}
check_runtime($java, "$vendor java VM", $java_candidate, "-client -ea");
# check gij (the bytecode interpreter from the GCJ project). In Debian
# and Ubuntu the default version is provided by package gij.
my $gij_candidate;
if ($gcj_home) {
$gij_candidate = "$gcj_home/bin/gij";
} else {
$gij_candidate = which("gij");
}
check_runtime($gij, "GNU gij", $gij_candidate, "");
# check kaffe. Don't take it personally, but kaffe is not meant as a
# robust production ready VM. It's a research tool (so described on
# their home page) but given the progress in GNU classpath lately it
# *may* work, so we do check for it - we just don't pick it by
# preference.
check_runtime($kaffe, "Kaffe VM", "/usr/lib/kaffe/bin/java", "");
# check jamvm (an elegant bytecode interpreter used by many in the
# CLASSPATH project to test new releases)
my $jamvm_candidate;
if ($jamvm_bin) {
$jamvm_candidate = "$jamvm_bin";
} else {
$jamvm_candidate = "/usr/bin/jamvm";
}
check_runtime($jamvm, "JamVM VM", $jamvm_candidate, "");
my $cacao_candidate;
if ($cacao_bin) {
$cacao_candidate = "$cacao_bin";
} else {
$cacao_candidate = "/usr/bin/cacao";
}
check_runtime($cacao, "CACAO VM", $cacao_candidate, "");
} elsif ($os eq "fedora") {
# check for a proper JDK/JRE java Virtual Machine. Red Hat is using
# the alternatives system symlinks to select JVMs, and then *again*
# to select versions. All the symlinks end up back in /usr/lib/jvm with
# predictable names, which makes this workable.
my $java_candidate;
my $vendor;
if ($jdk_home) {
$java_candidate = "$jdk_home/bin/java";
$vendor = "Specified";
} else {
$java_candidate = "/usr/bin/java";
$vendor = "System Default";
}
check_runtime($java, "$vendor java VM", $java_candidate, "-client -ea");
# check gij (the bytecode interpreter from the GCJ project)
my $gij_candidate;
if ($gcj_home) {
$gij_candidate = "$gcj_home/bin/gij";
} else {
$gij_candidate = which("gij");
}
check_runtime($gij, "GNU gij", $gij_candidate, "");
# check kaffe. See the comment about Kaffe above in the Debian block.
check_runtime($kaffe, "Kaffe VM", which("kaffe"), "");
# check jamvm (an elegant bytecode interpreter used by many in the
# CLASSPATH project to test new releases)
my $jamvm_candidate;
if ($jamvm_bin) {
$jamvm_candidate = "$jamvm_bin";
} else {
$jamvm_candidate = "/usr/bin/jamvm";
}
check_runtime($jamvm, "JamVM VM", $jamvm_candidate, "");
my $cacao_candidate;
if ($cacao_bin) {
$cacao_candidate = "$cacao_bin";
} else {
$cacao_candidate = "/usr/bin/cacao";
}
check_runtime($cacao, "CACAO VM", $cacao_candidate, "");
} elsif ($os eq "suse") {
# check for a proper JDK/JRE java Virtual Machine.
my $java_candidate;
my $vendor;
if ($jdk_home) {
$java_candidate = "$jdk_home/bin/java";
$vendor = "Specified";
} else {
$java_candidate = "/usr/lib/jvm/java/bin/java";
$vendor = "Sun";
}
check_runtime($java, "$vendor java VM", $java_candidate, "-client -ea");
# check gij (the bytecode interpreter from the GCJ project)
my $gij_candidate;
if ($gcj_home) {
$gij_candidate = "$gcj_home/bin/gij";
} else {
$gij_candidate = which("gij");
}
check_runtime($gij, "GNU gij", $gij_candidate, "");
# check kaffe. See the comment about Kaffe above in the Debian block.
check_runtime($kaffe, "Kaffe VM", which("kaffe"), "");
# check jamvm (an elegant bytecode interpreter used by many in the
# CLASSPATH project to test new releases)
my $jamvm_candidate;
if ($jamvm_bin) {
$jamvm_candidate = "$jamvm_bin";
} else {
$jamvm_candidate = "/usr/bin/jamvm";
}
check_runtime($jamvm, "JamVM VM", $jamvm_candidate, "");
my $cacao_candidate;
if ($cacao_bin) {
$cacao_candidate = "$cacao_bin";
} else {
$cacao_candidate = "/usr/bin/cacao";
}
check_runtime($cacao, "CACAO VM", $cacao_candidate, "");
} elsif ($os eq "arch") {
# check for a proper JDK/JRE java Virtual Machine. Red Hat is using
# the alternatives system symlinks to select JVMs, and then *again*
# to select versions. All the symlinks end up back in /usr/lib/jvm with
# predictable names, which makes this workable.
my $java_candidate;
my $vendor;
if ($jdk_home) {
$java_candidate = "$jdk_home/bin/java";
$vendor = "Specified";
} else {
$java_candidate = "/opt/java/bin/java";
$vendor = "IBM";
}
check_runtime($java, "$vendor java VM", $java_candidate, "-client -ea");
# check gij (the bytecode interpreter from the GCJ project)
my $gij_candidate;
if ($gcj_home) {
$gij_candidate = "$gcj_home/bin/gij";
} else {
$gij_candidate = which("gij");
}
check_runtime($gij, "GNU gij", $gij_candidate, "");
# check kaffe. See the comment about Kaffe above in the Debian block.
check_runtime($kaffe, "Kaffe VM", which("kaffe"), "");
# check jamvm (an elegant bytecode interpreter used by many in the
# CLASSPATH project to test new releases)
my $jamvm_candidate;
if ($jamvm_bin) {
$jamvm_candidate = "$jamvm_bin";
} else {
$jamvm_candidate = "/usr/bin/jamvm";
}
check_runtime($jamvm, "JamVM VM", $jamvm_candidate, "");
my $cacao_candidate;
if ($cacao_bin) {
$cacao_candidate = "$cacao_bin";
} else {
$cacao_candidate = "/usr/bin/cacao";
}
check_runtime($cacao, "CACAO VM", $cacao_candidate, "");
} elsif ($os eq "mandriva") {
# check for a proper JDK/JRE java Virtual Machine.
my $java_candidate;
my $vendor;
if ($jdk_home) {
$java_candidate = "$jdk_home/bin/java";
$vendor = "Specified";
} else {
$java_candidate = which("java");
$vendor = "System";
}
check_runtime($java, "$vendor java VM", $java_candidate, "-client -ea");
# check jamvm (an elegant bytecode interpreter used by many in the
# CLASSPATH project to test new releases)
my $jamvm_candidate;
if ($jamvm_bin) {
$jamvm_candidate = "$jamvm_bin";
} else {
$jamvm_candidate = "/usr/bin/jamvm";
}
check_runtime($jamvm, "JamVM VM", $jamvm_candidate, "");
my $cacao_candidate;
if ($cacao_bin) {
$cacao_candidate = "$cacao_bin";
} else {
$cacao_candidate = "/usr/bin/cacao";
}
check_runtime($cacao, "CACAO VM", $cacao_candidate, "");
} elsif ($os eq "solaris") {
# check for a JDK/JRE java Virtual Machine, allowing an alternate to be set
# (no reason to disable that)
my $java_candidate;
if ($jdk_home) {
$java_candidate = "$jdk_home/bin/java";
} else {
$java_candidate = "/usr/java/bin/java";
}
check_runtime($java, "Sun java VM", $java_candidate, "-client -ea");
# check gij (the bytecode interpreter from the GCJ project)
my $gij_candidate;
if ($gcj_home) {
$gij_candidate = "$gcj_home/bin/gij";
} else {
$gij_candidate = which("gij");
}
check_runtime($gij, "GNU gij", $gij_candidate, "");
# check kaffe
check_runtime($kaffe, "kaffe VM", which("kaffe"), "");
# check jamvm (an elegant bytecode interpreter used by many in the
# CLASSPATH project to test new releases)
my $jamvm_candidate;
if ($jamvm_bin) {
$jamvm_candidate = "$jamvm_bin";
} else {
$jamvm_candidate = "/usr/bin/jamvm";
}
check_runtime($jamvm, "JamVM VM", $jamvm_candidate, "");
my $cacao_candidate;
if ($cacao_bin) {
$cacao_candidate = "$cacao_bin";
} else {
$cacao_candidate = "/usr/bin/cacao";
}
check_runtime($cacao, "CACAO VM", $cacao_candidate, "");
} elsif ($os eq "slackware") {
# check for a proper JDK/JRE java Virtual Machine.
my $java_candidate;
my $vendor;
if ($jdk_home) {
$java_candidate = "$jdk_home/bin/java";
$vendor = "Specified";
} else {
$java_candidate = "/usr/lib/java/bin/java";
$vendor = "Sun";
}
check_runtime($java, "$vendor java VM", $java_candidate, "-client -ea");
# check gij (the bytecode interpreter from the GCJ project)
my $gij_candidate;
if ($gcj_home) {
$gij_candidate = "$gcj_home/bin/gij";
} else {
$gij_candidate = which("gij");
}
check_runtime($gij, "GNU gij", $gij_candidate, "");
# check kaffe. See the comment about Kaffe above in the Debian block.
check_runtime($kaffe, "Kaffe VM", which("kaffe"), "");
# check jamvm (an elegant bytecode interpreter used by many in the
# CLASSPATH project to test new releases)
my $jamvm_candidate;
if ($jamvm_bin) {
$jamvm_candidate = "$jamvm_bin";
} else {
$jamvm_candidate = "/usr/bin/jamvm";
}
check_runtime($jamvm, "JamVM VM", $jamvm_candidate, "");
my $cacao_candidate;
if ($cacao_bin) {
$cacao_candidate = "$cacao_bin";
} else {
$cacao_candidate = "/usr/bin/cacao";
}
check_runtime($cacao, "CACAO VM", $cacao_candidate, "");
} elsif ($os eq "cygwin") {
# check for a proper JDK/JRE java Virtual Machine.
my $java_candidate;
my $vendor;
if ($jdk_home) {
$java_candidate = "$jdk_home/bin/java";
$vendor = "Specified";
} else {
$java_candidate = "/usr/bin/java";
$vendor = "Sun";
}
check_runtime($java, "$vendor java VM", $java_candidate, "-client -ea");
# check gij (the bytecode interpreter from the GCJ project)
my $gij_candidate;
if ($gcj_home) {
$gij_candidate = "$gcj_home/bin/gij";
} else {
$gij_candidate = which("gij");
}
check_runtime($gij, "GNU gij", $gij_candidate, "");
# check kaffe. See the comment about Kaffe above in the Debian block.
check_runtime($kaffe, "Kaffe VM", which("kaffe"), "");
# check jamvm (an elegant bytecode interpreter used by many in the
# CLASSPATH project to test new releases)
my $jamvm_candidate;
if ($jamvm_bin) {
$jamvm_candidate = "$jamvm_bin";
} else {
$jamvm_candidate = "/usr/bin/jamvm";
}
check_runtime($jamvm, "JamVM VM", $jamvm_candidate, "");
my $cacao_candidate;
if ($cacao_bin) {
$cacao_candidate = "$cacao_bin";
} else {
$cacao_candidate = "/usr/bin/cacao";
}
check_runtime($cacao, "CACAO VM", $cacao_candidate, "");
} else {
bail "failed!", "This OS not configured with appropriate Java VM checks!\nTHIS IS AN INTERNAL ERROR, PLEASE FILE A BUG.";
}
output "\n";
# --------------------------------------------------------------------
# Check for GCJ native Java compiler and for a C compiler
# --------------------------------------------------------------------
output "Check native compiler:\n";
# these are initialized as, unlike javac which is populated with *something*,
# even if gcj is not found we still need a variable for it.
my $gcc;
my $cc;
if ($os eq "solaris") {
# this should result in something with gcc in its name
check_CC($gcc, "GNU gcc", abs_path("/usr/gnu/bin/cc"), "");
# otherwise, we use Sun's compiler and linker
check_CC($cc, "Sun cc", abs_path("/usr/bin/cc"), "") unless $gcc;
# and if things are completely out to lunch,
check_CC($cc, "Path cc", which("cc"), "") unless $cc;
} elsif ($os) {
my $gcc_candidate;
if (($gcj_home) && ($gcjC)) {
$gcc_candidate = "$gcj_home/bin/gcc";
} else {
$gcc_candidate = which("gcc");
# Workaround ccache needing to be symlinked as gcc
# to perform _as_ gcc. Gentoo bug #180353
if (basename($gcc_candidate) eq "ccache") {
$gcc_candidate = `which gcc`;
}
}
check_CC($gcc, "GNU gcc", $gcc_candidate, "");
}
output "\n";
# --------------------------------------------------------------------
# Choose between java compilers and VMs, reviewing overrides
# --------------------------------------------------------------------
# if gij isn't sufficient version, then knock out gcj
if (!$gij) {
if ($gcjC) {
output "Can't use GCJ, insufficiently recent version\n\n";
}
undef $gcjC;
undef $gij;
}
print CONFIG <<HERE ;
# the JAVAC variable contains the path to the java source compiler,
# the JAVA variable contains the path to the java runtime virtual
# machine. In both cases, the _CMD variable is for the terse output
# when make commands are running.
HERE
output "Select compiler:";
if ($compiler) {
# if overridden, check override...
if ($compiler eq "javac") {
bail "bad override", "javac specified but not detected as a workable compiler." unless $javac;
} elsif ($compiler eq "ecj") {
bail "bad override", "ecj specified but not detected as a workable compiler." unless $ecj;
} elsif ($compiler eq "gcj") {
bail "bad override", "gcj (-C) specified but gcj not detected as a workable compiler." unless $gcjC;
} else {
bail "bad override", <<HERE ;
You specified compiler=$compiler on the command line, but that's not an option.
Valid choices are ecj, javac, or gcj - but of course that compiler must be
installed (and detected!) in order to be able to specify it.
HERE
}
} else {
# otherwise, pick a compiler.
if ($ecj) {
$compiler = "ecj";
} elsif ($javac) {
$compiler = "javac";
} elsif ($gcjC) {
$compiler = "gcj";
} else {
bail "failed", "No java compiler was detected.";
}
}
if ($compiler eq "javac") {
print CONFIG "JAVAC=$javac\n";
print CONFIG "JAVAC_CMD=JAVAC \n";
} elsif ($compiler eq "ecj") {
print CONFIG "JAVAC=$ecj\n";
print CONFIG "JAVAC_CMD=ECJ \n";
} elsif ($compiler eq "gcj") {
print CONFIG "JAVAC=$gcjC\n";
print CONFIG "JAVAC_CMD=GCJ [-C] \n";
} else {
bail "failed", "INTERNAL ERROR no compiler selected.";
}
print CONFIG <<HERE ;
# the JAVAH, JAR, and JAVADOC variables simply contains a usable jar
# and javah executable, respectively, while the JAVAH_CMD, JAR_CMD,
# and JAVADOC_CMD variables is for display purposes, matching the
# pattern above.
HERE
if ($javah) {
print CONFIG "JAVAH=$javah\n";
print CONFIG "JAVAH_CMD=JAVAH \n";
} else {
bail "failed", "No JNI header generator detected.";
}
if ($jar) {
print CONFIG "JAR=$jar\n";
print CONFIG "JAR_CMD=JAR \n";
} else {
bail "failed", "No Java archive tool detected.";
}
if ($javadoc) {
print CONFIG "JAVADOC=$javadoc\n";
print CONFIG "JAVADOC_CMD=JAVADOC \n";
} else {
bail "failed", "No JavaDoc tool detected.";
}
output "$compiler\n";
output "Select runtime:";
# Note that java is favoured over gij only because the error messages
# are better! (Ok, and, frankly, the compliance is obviously better
# if its a real Java VM). The Free ones are getting there...
if ($runtime) {
# if overridden, check override...
if ($runtime eq "java") {
bail "bad override", "java specified but not detected." unless $java;
} elsif ($runtime eq "gij") {
bail "bad override", "gij specified but not detected." unless $gij;
} elsif ($runtime eq "kaffe") {
bail "bad override", "kaffe specified but not detected." unless $kaffe;
} elsif ($runtime eq "cacao") {
bail "bad override", "cacao specified but not detected." unless $cacao;
} elsif ($runtime eq "jamvm") {
bail "bad override", "jamvm specified but not detected." unless $jamvm;
} else {
bail "bad override", <<HERE ;
You specified runtime=$runtime on the command line, but that's not an option.
Valid choices are java, gij, or kaffe - but of course that virtual machine
must be installed (and detected!) before you can specify it.
HERE
}
} else {
if ($java) {
$runtime = "java";
} elsif ($cacao) {
$runtime = "cacao";
} elsif ($jamvm) {
$runtime = "jamvm";
} elsif ($gij) {
$runtime = "gij";
} elsif ($kaffe) {
$runtime = "kaffe";
} else {
bail "failed", "No usable Java runtime environment was detected.";
}
}
$java="$java -Djava.awt.headless=true";
if ($runtime eq "java") {
print CONFIG "JAVA=$java\n";
print CONFIG "JAVA_CMD=JAVA \n";
} elsif ($runtime eq "gij") {
print CONFIG "JAVA=$gij\n";
print CONFIG "JAVA_CMD=GIJ \n";
} elsif ($runtime eq "kaffe") {
print CONFIG "JAVA=$kaffe\n";
print CONFIG "JAVA_CMD=KAFFE \n";
} elsif ($runtime eq "cacao") {
print CONFIG "JAVA=$cacao\n";
print CONFIG "JAVA_CMD=CACAO \n";
} elsif ($runtime eq "jamvm") {
print CONFIG "JAVA=$jamvm\n";
print CONFIG "JAVA_CMD=JAMVM \n";
} else {
bail "failed", "INTERNAL ERROR no virtual machine selected";
}
output "$runtime\n";
# --------------------------------------------------------------------
# Output native build information
# --------------------------------------------------------------------
print CONFIG <<HERE ;
# the path to the C compiler
HERE
if ($gcc) {
use File::Basename;
my $jni_include = "";
my $java_home = dirname($java);
$java_home =~ s/\/bin$//;
if ($os eq "fedora" && $java_home eq "/usr") {
$java_home = "/usr/lib/jvm/java";
}
if (!-d "$java_home"."/include") {
$java_home =~ s/\/jre//;
}
if (-f "$java_home"."/include/jni.h") {
if ($os eq "solaris") {
$jni_include = "-I$java_home/include -I$java_home/include/solaris";
} else {
$jni_include = "-I$java_home/include -I$java_home/include/linux";
}
} elsif (-f "/usr/include/jni.h") {
# good, but that's default search path - no -I required.
} else {
bail "failed", "Can't locate the JNI header file";
}
my $ccache = which("ccache");
if ( -x $ccache) {
print CONFIG "CCACHE=$ccache\n";
}
my $deprecations;
if ( "$strict" ) {
$deprecations = "-DGTK_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGDK_PIXBUF_DISABLE_DEPRECATED -DG_DISABLE_DEPRECATED -DGSEAL_ENABLE";
} else {
$deprecations = "";
}
my $pic_flag;
if ($os eq "cygwin") {
$pic_flag = "-DPIC";
} else {
$pic_flag = "-fPIC";
}
print CONFIG "CC=$gcc -g -Wall $pic_flag $jni_include -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast $deprecations -Werror-implicit-function-declaration -Wfatal-errors\n";
print CONFIG "CC_CMD=GCC \n";
print CONFIG "LINK=$gcc -g -shared -Wall $pic_flag\n";
print CONFIG "LINK_CMD=LINK \n";
} elsif (($cc) && ($os eq "solaris")) {
print CONFIG "CC=$cc -Kpic -I/usr/java/include -I/usr/java/include/solaris\n";
print CONFIG "CC_CMD=CC \n";
print CONFIG "LINK=$cc -G -zdefs -Kpic -lc\n";
print CONFIG "LINK_CMD=LINK \n";
} else {
bail "failed", "C compiler not detected";
}
`rm -f Hello.java Hello.class Hello.o Hello Hello.c Hello.jar`;
print CONFIG <<HERE ;
# the install prefix. This *only* affects the location that installed
# files are sent to during the `make install` step. You can, as it
# happens, override it on the make command line the same way you
# specify DESTDIR, ie by doing `make PREFIX=/blah install`.
HERE
if (!$prefix) {
$prefix = "/usr/local";
}
print CONFIG "PREFIX=$prefix\n";
if (!$libdir) {
$libdir = "$prefix/lib";
}
print CONFIG "LIBDIR=$libdir\n";
if (!$jardir) {
$jardir = "$prefix/share/java";
}
print CONFIG "JARDIR=$jardir\n";
# --------------------------------------------------------------------
# Get version constant
# --------------------------------------------------------------------
my $apiversion;
my $version;
open SOURCE, "src/bindings/org/freedesktop/bindings/Version.java";
while (<SOURCE>) {
chomp;
if (/.* APIVERSION = \"([\d\.]+)\";/) {
$apiversion = $1;
}
if (/.* VERSION = \"([\d\.\-rcdev]+)\";/) {
$version = $1;
}
}
close SOURCE;
if (!$apiversion) {
bail("","Couldn't find the API version");
}
if (!$version) {
bail("","Couldn't find the release version");
}
print CONFIG <<HERE ;
# finally, we extract the version strings from the source code, for
# use in naming the target library files.
HERE
print CONFIG "APIVERSION=$apiversion\n";
print CONFIG "VERSION=$version\n";
# --------------------------------------------------------------------
# Done! Create .config file
# --------------------------------------------------------------------
output "\n";
output "Output:\n";
output " - configuration data";
close CONFIG;
system "mv .config.tmp .config";
output "ok\n";
# --------------------------------------------------------------------
# Output text file with library location
# --------------------------------------------------------------------
output " - native library location";
open LIBRARY, ">.libdir";
print LIBRARY <<HERE ;
$libdir
HERE
close LIBRARY;
output "ok\n";
output "\n";
|