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
  
     | 
    
      #! /bin/sh /usr/share/dpatch/dpatch-run
## 304-update-Imake-config-files.dpatch by  <kmccarty@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Use Imake.cf stolen from recent XFree86 code, as it is much more
## DP: up-to-date than the Imake.cf in CERNLIB source.  Also update linux.cf
## DP: to support most Linux architectures.
@DPATCH@
--- a/src/config/Imake.cf
+++ b/src/config/Imake.cf
@@ -1,27 +1,5 @@
-/* $Id: Imake.cf,v 1.6 2006/09/15 09:34:47 mclareni Exp $
- *
- * $Log: Imake.cf,v $
- * Revision 1.6  2006/09/15 09:34:47  mclareni
- * Submitted mods for gcc4/gfortran and MacOSX, corrected to work also on slc4 with gcc3.4 and 4.1
- *
- * Revision 1.5  2004/10/05 15:54:40  mclareni
- * Add configuration file linux-lp64 for Linux 64-bit pointer systems like AMD Opteron and Intel IA64.
- *
- * Revision 1.4  1998/09/25 09:23:38  mclareni
- * Modifications for the Mklinux port flagged by CERNLIB_PPC
- *
- * Revision 1.3  1998/06/09 13:54:39  cernlib
- * Make sure unix is properly undefined to compile kernlib/unix
- *
- * Revision 1.2  1995/12/21 11:31:57  cernlib
- * Imake files end 1995
- *
- * Revision 1.1.1.1  1995/12/20  15:26:44  cernlib
- * X11R6 config files unmodified
- *
- *
- */
-XCOMM $XConsortium: Imake.cf,v 1.19 95/01/05 19:24:32 kaleb Exp $
+XCOMM $XdotOrg: util/cf/Imake.cf,v 1.12 2005/11/08 06:33:24 jkj Exp $
+XCOMM $Xorg: Imake.cf,v 1.4 2000/08/17 19:41:45 cpqbld Exp $
 /*
  * To add support for another platform:
  * 
@@ -40,257 +18,586 @@
  *
  *     4.  Create a .cf file with the name given by MacroFile.
  */
+XCOMM $XFree86: xc/config/cf/Imake.cf,v 3.88 2003/12/16 21:30:21 herrb Exp $
 
-#ifdef ultrix
-#define MacroIncludeFile <ultrix.cf>
-#define MacroFile ultrix.cf
-#ifdef vax
-#undef vax
-#define VaxArchitecture
-#endif
-#ifdef mips
-#undef mips
-#define MipsArchitecture
+#if defined(__APPLE__)
+# undef __APPLE__
+# define MacroIncludeFile <MacOSX.cf>
+# define MacroFile MacOSX.cf
+# define MacOSXArchitecture
+# define DarwinArchitecture
+# ifdef __ppc__
+#  define PpcDarwinArchitecture
+#  undef __ppc__
+# endif
+# ifdef __i386__
+#  define i386DarwinArchitecture
+#  undef __i386__
+# endif
 #endif
-#undef ultrix
-#define UltrixArchitecture
+
+#if defined(clipper) || defined(__clipper__)
+# undef clipper
+# define MacroIncludeFile <ingr.cf>
+# define MacroFile ingr.cf
+# define IngrArchitecture
+#endif /* clipper */
+
+#ifdef __CYGWIN__
+#define MacroIncludeFile <cygwin.cf>
+#define MacroFile cygwin.cf
+#define cygwinArchitecture
+#define i386Architecture
+#undef i386
+#undef i486
+#undef i586
+#undef i686
+#undef __i386__
+#undef _X86_
+#undef __CYGWIN__
+#endif /* CYGWIN */
+
+#ifdef ultrix
+# define MacroIncludeFile <ultrix.cf>
+# define MacroFile ultrix.cf
+# ifdef vax
+#  undef vax
+#  define VaxArchitecture
+# endif
+# ifdef mips
+#  undef mips
+#  define MipsArchitecture
+#  define MipselArchitecture
+# endif
+# undef ultrix
+# define UltrixArchitecture
 #endif /* ultrix */
 
-#if defined(vax) && !defined(UltrixArchitecture)
-#define MacroIncludeFile <bsd.cf>
-#define MacroFile bsd.cf
-#undef vax
-#define BSDArchitecture
-#define VaxArchitecture
+#if defined(vax) && !defined(UltrixArchitecture) && !defined(__OpenBSD__)
+# define MacroIncludeFile <bsd.cf>
+# define MacroFile bsd.cf
+# undef vax
+# define BSDArchitecture
+# define VaxArchitecture
 #endif /* vax */
 
-#ifdef bsdi
-#define MacroIncludeFile <bsdi.cf>
-#define MacroFile bsdi.cf
-#undef bsdi
-#define BSD386Architecture
-#define i386BsdArchitecture
-#define i386Architecture
+#ifdef __bsdi__
+# define MacroIncludeFile <bsdi.cf>
+# define MacroFile bsdi.cf
+# undef __bsdi__
+# ifdef bsdi
+#  undef bsdi
+# endif
+# define BSDOSArchitecture
+# if defined(__i386__) || defined(i386)
+#  define i386BsdArchitecture
+#  define i386Architecture
+#  undef i386
+#  undef __i386__
+# endif
+# if defined(__ppc__) || defined(ppc)
+#  define PpcBsdArchitecture
+#  define PpcArchitecture
+#  undef ppc
+#  undef __ppc__
+# endif
+# if defined(__sparc__) || defined(__sparc_v9__) || defined(sparc)
+#  define SparcBsdArchitecture
+#  define SparcArchitecture
+#  undef sparc
+#  undef __sparc__
+#  undef __sparc_v9__
+# endif
 #endif /* bsdi */
 
-#ifdef __NetBSD__
-#define MacroIncludeFile <NetBSD.cf>
-#define MacroFile NetBSD.cf
-#undef __NetBSD__
-#define NetBSDArchitecture
-#ifdef __i386__
-#define i386BsdArchitecture
-#define i386Architecture
-#endif
-#if defined(__sparc__) || defined(sparc)
-#define SparcArchitecture
-#undef sparc
+#ifdef __OpenBSD__
+# undef __OpenBSD__
+# undef __NetBSD__
+# define OpenBSDArchitecture
+# define KOpenBSDArchitecture
+# define MacroIncludeFile <OpenBSD.cf>
+# define MacroFile OpenBSD.cf
+# ifdef __i386__
+#  define i386BsdArchitecture
+#  define i386Architecture
+#  undef i386
+# endif
+# if defined(__sparc__) || defined(sparc)
+#  if !defined(__arch64__)
+#   define SparcArchitecture
+#  else
+#   define Sparc64Architecture
+#  endif
+#  undef sparc
+# endif
+# if defined(__mips__) || defined(mips)
+#   define MipsArchitecture
+#   ifdef arc
+#     define ArcArchitecture
+#     undef arc
+#   endif
+#   ifdef pmax
+#     define PmaxArchitecture
+#     undef pmax
+#   endif
+#   undef mips
+# endif
+# if defined(__alpha__) || defined(alpha)
+#   define AlphaArchitecture
+#   undef __alpha__
+#   undef alpha
+# endif
+# if defined(__amd64__) || defined(__x86_64__)
+#   define AMD64Architecture
+#   undef __amd64__
+#   undef __x86_64__
+#   undef amd64
+# endif
+# if defined(__mc68020__) || defined(mc68020)
+#  define Mc68020Architecture
+#  if defined(amiga)
+#   define AmigaArchitecture
+#   undef amiga
+#  endif
+#  if defined(hp300)
+#   define Hp300Architecture
+#   undef hp300
+#  endif
+#  if defined(mac68k)
+#    define Mac68kArchitecture
+#    undef mac68k
+#  endif
+#  if defined(mvme68k)
+#   define Mvme68kArchitecture
+#   undef mvme68k
+#  endif
+#  if defined(sun3) 
+#   define Sun3Architecture
+#   undef sun3
+#  endif
+#  undef mc68000
+# endif
+# ifdef __powerpc__
+#  define PpcArchitecture
+#  undef __powerpc__
+#  undef __macppc__
+#  undef macppc
+# endif
+# ifdef __vax__
+#  undef vax
+#  undef __vax__
+#  define VaxArchitecture
+# endif
+# ifdef __hppa__
+#  ifndef HPArchitecture
+#   define HPArchitecture
+#  endif
+#  undef __hppa__
+# endif /* __hppa__ */
+#endif /* OpenBSD */
+
+/* Systems based on kernel of OpenBSD */
+#if defined(__OpenBSD_kernel__)
+#define KOpenBSDArchitecture
 #endif
+
+#ifdef __NetBSD__
+# define MacroIncludeFile <NetBSD.cf>
+# define MacroFile NetBSD.cf
+# undef __NetBSD__
+# define NetBSDArchitecture
+# define KNetBSDArchitecture
+# ifdef __i386__
+#  define i386BsdArchitecture
+#  define i386Architecture
+#  undef i386
+# endif
+# if defined(__sparc64__) || defined(__sparc_v9__) || defined(__arch64__)
+#  define Sparc64Architecture
+# endif
+# if defined(__sparc__) || defined(sparc)
+#  define SparcArchitecture
+#  undef sparc
+#  if defined(__sparc_v9__) || defined(__arch64__)
+#    define Sparc64Architecture
+#  endif
+# endif
+# ifdef mips
+#   define MipsArchitecture
+#   define ArcArchitecture
+#   undef mips
+# endif
+# ifdef __alpha__
+#   define AlphaArchitecture
+#   define AlphaBsdArchitecture
+#   undef __alpha__
+# endif
+# ifdef mc68000
+#   define Mc68020Architecture
+# endif
+# ifdef __arm32__
+#   define Arm32Architecture
+#   undef __arm32__
+# endif
+# ifdef __vax__
+#   define VaxArchitecture
+#   undef __vax__
+# endif
+# ifdef __powerpc__
+#   define PpcArchitecture
+#   undef __powerpc__
+# endif
 #endif /* NetBSD */
 
-#ifdef __FreeBSD__
-#define MacroIncludeFile <FreeBSD.cf>
-#define MacroFile FreeBSD.cf
-#undef __FreeBSD__
-#define FreeBSDArchitecture
-#ifdef __i386__
-#define i386BsdArchitecture
-#define i386Architecture
+/* Systems based on kernel of NetBSD */
+#if defined(__NetBSD_kernel__)
+#define KNetBSDArchitecture
 #endif
+
+#ifdef __DragonFly__
+# define MacroIncludeFile <DragonFly.cf>
+# define MacroFile DragonFly.cf
+# undef __DragonFly__
+# undef __FreeBSD__
+# define DragonFlyArchitecture
+# define FreeBSDArchitecture
+# ifdef __i386__
+#  define i386BsdArchitecture
+#  define i386Architecture
+#  undef i386
+# endif
+# ifdef __sparc64__
+#  define Sparc64Architecture
+#  undef __sparc64__
+# endif
+# ifdef __ia64__
+#  define ia64Architecture
+#  undef __ia64__
+# endif
+# ifdef __amd64__
+#  define x86_64Architecture
+#  undef __amd64__
+#  undef __x86_64__
+# endif
+#endif /* __DragonFly__ */
+
+#ifdef __FreeBSD__
+# define MacroIncludeFile <FreeBSD.cf>
+# define MacroFile FreeBSD.cf
+# undef __FreeBSD__
+# define FreeBSDArchitecture
+# define KFreeBSDArchitecture
+# ifdef __i386__
+#  define i386BsdArchitecture
+#  define i386Architecture
+#  undef i386
+# endif
+# ifdef __alpha__
+#  define AlphaBsdArchitecture
+#  define AlphaArchitecture
+#  undef __alpha__
+# endif
+# ifdef __sparc64__
+#  define Sparc64Architecture
+#  undef __sparc64__
+# endif
+# ifdef __ia64__
+#  define ia64Architecture
+#  undef __ia64__
+# endif
+# ifdef __amd64__
+#  define AMD64Architecture
+#  undef __amd64__
+#  undef __x86_64__
+# endif
+# ifdef __powerpc__
+#  define PpcArchitecture
+#  undef __powerpc__
+# endif
 #endif /* __FreeBSD__ */
 
-#ifdef AMOEBA
-/* Should be before the 'sun' entry because we may be cross-compiling */
-#define MacroIncludeFile <Amoeba.cf>
-#define MacroFile Amoeba.cf
-#if defined(i80386) || defined(__i80386__)
-#define i386Architecture
-#else
-#if defined(mc68000) || defined(__mc68000__)
-#define Sun3Architecture
-#define SunArchitecture
-#else
-#if defined(sparc) || defined(__sparc__)
-#define SparcArchitecture
-#define SunArchitecture
-#endif
+/* Systems based on kernel of FreeBSD */
+#if defined(__FreeBSD_kernel__)
+#define KFreeBSDArchitecture
 #endif
-#endif
-#undef i80386
-#undef mc68000
-#undef sparc
-#undef sun
+
+#ifdef AMOEBA
+ /* Should be before the 'sun' entry because we may be cross-compiling */
+# define MacroIncludeFile <Amoeba.cf>
+# define MacroFile Amoeba.cf
+# if defined(i80386) || defined(__i80386__)
+#  undef i80386
+#  define i386Architecture
+# else
+#  if defined(mc68000) || defined(__mc68000__)
+#   undef mc68000
+#   define Sun3Architecture
+#   define SunArchitecture
+#  else
+#   if defined(sparc) || defined(__sparc__)
+#    undef sparc
+#    define SparcArchitecture
+#    define SunArchitecture
+#   endif
+#  endif
+#  undef sun
+# endif
 #endif /* AMOEBA */
 
 #ifdef sun
-#define MacroIncludeFile <sun.cf>
-#define MacroFile sun.cf
-#ifdef SVR4
-#undef SVR4
-#define SVR4Architecture
-#endif
-#ifdef sparc
-#undef sparc
-#define SparcArchitecture
-#endif
-#ifdef mc68000
-#undef mc68000
-#define Sun3Architecture
-#endif
-#ifdef i386
-#undef i386
-#define i386Architecture
-#endif
-#undef sun
-#define SunArchitecture
+# define MacroIncludeFile <sun.cf>
+# define MacroFile sun.cf
+# ifdef SVR4
+#  undef SVR4
+#  define SVR4Architecture
+# endif
+# ifdef sparc
+#  undef sparc
+#  define SparcArchitecture
+# endif
+# ifdef __sparcv9
+#  undef __sparcv9
+#  define Sparc64Architecture
+# endif
+# ifdef mc68000
+#  undef mc68000
+#  define Sun3Architecture
+# endif
+# if defined(__amd64) || defined(__x86_64)
+#  undef __amd64
+#  undef __x86_64
+#  undef amd64
+#  undef i386
+#  define AMD64Architecture
+# endif
+# ifdef i386
+#  undef i386
+#  define i386Architecture
+# endif
+# undef sun
+# define SunArchitecture
 #endif /* sun */
 
 #ifdef hpux
-#define MacroIncludeFile <hp.cf>
-#define MacroFile hp.cf
-#undef hpux
-#define HPArchitecture
+# define MacroIncludeFile <hp.cf>
+# define MacroFile hp.cf
+# undef hpux
+# define HPArchitecture
 #endif /* hpux */
 
-#ifdef USL
-#define MacroIncludeFile <usl.cf>
-#define MacroFile usl.cf
-#undef USL
-#undef SVR4
-#define SVR4Architecture
-#define i386Architecture
-#endif /* USL */
+#ifdef __SCO__
+# define MacroIncludeFile <sco5.cf>
+# define MacroFile sco5.cf
+# undef __SCO__
+# undef sco
+# undef USL
+# undef SYSV
+# undef i386
+# undef SCO
+# undef SVR4
+# define i386Architecture
+# define SCOArchitecture
+# define i386SVR3Architecture
+# define SVR3Architecture
+# define i386ScoArchitecture
+# define i386Sco325Architecture
+# undef i386
+# undef i486
+# undef i586
+# undef i686
+# undef k6
+# undef __i386__
+# undef __i486__
+# undef __i586__
+# undef __i686__
+# undef __k6__
+# undef __i386
+# undef __i486
+# undef __i586
+# undef __i686
+# undef __k6
+# undef pentium
+# undef __pentium
+# undef pentiumpro
+# undef __pentiumpro
+#endif /* __SCO__ - SCO Open Server 5 */
+
+#ifdef __UNIXWARE__
+# define MacroIncludeFile <usl.cf>
+# define MacroFile usl.cf
+# undef __UNIXWARE__
+# undef USL
+# undef SVR4
+# undef i386
+# undef SVR5
+# undef SYSV5
+# define SVR4Architecture
+# define i386Architecture
+# define USLArchitecture
+# define UnixWareArchitecture
+# undef i386
+# undef i486
+# undef i586
+# undef i686
+# undef k6
+# undef __i386__
+# undef __i486__
+# undef __i586__
+# undef __i686__
+# undef __k6__
+# undef __i386
+# undef __i486
+# undef __i586
+# undef __i686
+# undef __k6
+# undef pentium
+# undef __pentium
+# undef pentiumpro
+# undef __pentiumpro
+#endif /* __UNIXWARE__ */
 
 #ifdef NCR
-#define MacroIncludeFile <ncr.cf>
-#define MacroFile ncr.cf
-#undef NCR
-#undef SVR4
-#define SVR4Architecture
-#define i386Architecture
+# define MacroIncludeFile <ncr.cf>
+# define MacroFile ncr.cf
+# undef NCR
+# undef SVR4
+# undef i386
+# define SVR4Architecture
+# define i386Architecture
+# define NCRArchitecture
 #endif /* NCR */
 
 #ifdef apollo
-#define MacroIncludeFile <apollo.cf>
-#define MacroFile apollo.cf
-#undef apollo
-#define ApolloArchitecture
+# define MacroIncludeFile <apollo.cf>
+# define MacroFile apollo.cf
+# undef apollo
+# define ApolloArchitecture
 #endif /* apollo */
 
 #ifdef sony
-#define MacroIncludeFile <sony.cf>
-#define MacroFile sony.cf
-#undef sony
-#undef sony_news
-#define SonyArchitecture
-#ifdef mc68020
-#undef mc68020
-#undef mc68030
-#define Mc68020Architecture
-#endif
-#ifdef mips
-#undef mips
-#define MipsArchitecture
-#endif
-#if !defined(bsd43) || defined(SYSTYPE_SYSV) || defined(_SYSTYPE_SYSV)
-#define SonySysvArchitecture
-#else
-#define SonyBsdArchitecture
-#endif
+# define MacroIncludeFile <sony.cf>
+# define MacroFile sony.cf
+# undef sony
+# undef sony_news
+# define SonyArchitecture
+# ifdef mc68020
+#  undef mc68020
+#  undef mc68030
+#  define Mc68020Architecture
+# endif
+# ifdef mips
+#  undef mips
+#  define MipsArchitecture
+# endif
+# ifdef __svr4
+#  define SVR4Architecture
+# else
+#  if !defined(bsd43) || defined(SYSTYPE_SYSV) || defined(_SYSTYPE_SYSV)
+#   define SonySysvArchitecture
+#  else
+#   define SonyBsdArchitecture
+#  endif
+# endif
 #endif /* sony */
 
 #ifdef M4310
-#define MacroIncludeFile <pegasus.cf>
-#define MacroFile pegasus.cf
-#undef M4310
-#define PegasusArchitecture
+# define MacroIncludeFile <pegasus.cf>
+# define MacroFile pegasus.cf
+# undef M4310
+# define PegasusArchitecture
 #endif /* M4310 */
 
 #ifdef M4330
-#define MacroIncludeFile <m4330.cf>
-#define MacroFile m4330.cf
-#undef  M4330
-#define M4330Architecture
+# define MacroIncludeFile <m4330.cf>
+# define MacroFile m4330.cf
+# undef  M4330
+# define M4330Architecture
 #endif /* M4330 */
 
 #ifdef macII
-#define MacroIncludeFile <macII.cf>
-#define MacroFile macII.cf
-#undef  macII
-#define MacIIArchitecture
+# define MacroIncludeFile <macII.cf>
+# define MacroFile macII.cf
+# undef  macII
+# define MacIIArchitecture
 #endif /* macII */
 
-#ifdef __APPLE__
-# define MacroIncludeFile <MacOSX.cf>
-# define MacroFile MacOSX.cf
-# define MacOSXArchitecture
-# define DarwinArchitecture
-#endif
-
 #ifdef _CRAY
-#define MacroIncludeFile <cray.cf>
-#define MacroFile cray.cf
-#undef cray
-#undef CRAY
-#undef CRAY1
-#undef CRAY2
-#undef YMP
-#define CrayArchitecture
+# define MacroIncludeFile <cray.cf>
+# define MacroFile cray.cf
+# undef cray
+# undef CRAY
+# undef CRAY1
+# undef CRAY2
+# undef YMP
+# define CrayArchitecture
 #endif /* _CRAY */
 
 #ifdef sgi
-#define MacroIncludeFile <sgi.cf>
-#define MacroFile sgi.cf
-#undef sgi
-#define SGIArchitecture
-#undef mips
-#define MipsArchitecture
+# define MacroIncludeFile <sgi.cf>
+# define MacroFile sgi.cf
+# undef sgi
+# define SGIArchitecture
+# undef mips
+# undef __mips
+# define MipsArchitecture
+# ifdef _SVR4
+#  undef _SVR4
+#  define SVR4Architecture
+# endif
+# ifdef _SYSTYPE_SVR4
+#  undef _SYSTYPE_SVR4
+#  define SVR4Architecture
+# endif
 #endif /* sgi */
 
 #ifdef stellar
-#define MacroIncludeFile <stellar.cf>
-#define MacroFile stellar.cf
-#undef stellar
-#define StellarArchitecture
+# define MacroIncludeFile <stellar.cf>
+# define MacroFile stellar.cf
+# undef stellar
+# define StellarArchitecture
 #endif /* stellar */
 
 #if defined(ibm) || defined(_IBMR2) || defined(ibm032) || defined(aix)
-#define MacroIncludeFile <ibm.cf>
-#define MacroFile ibm.cf
-#ifdef ibm
-#undef ibm
-#endif
-#define IBMArchitecture
-#ifdef i386
-#undef i386
-#define PS2Architecture
-#endif
-#ifdef ibm032
-#undef ibm032
-#define RtArchitecture
-#endif
-#ifdef aix
-#undef aix
-#define AIXArchitecture
-#endif
-#ifdef _IBMR2
-#undef _IBMR2
-#define RsArchitecture
-#endif
+# define MacroIncludeFile <ibm.cf>
+# define MacroFile ibm.cf
+# ifdef ibm
+#  undef ibm
+# endif
+# define IBMArchitecture
+# ifdef i386
+#  undef i386
+#  define PS2Architecture
+# endif
+# ifdef ibm032
+#  undef ibm032
+#  define RtArchitecture
+# endif
+# ifdef aix
+#  undef aix
+#  define AIXArchitecture
+# endif
+# ifdef _IBMR2
+#  undef _IBMR2
+#  if (DefaultOSMajorVersion < 5)
+#   define RsArchitecture
+#  else
+#   define PpcArchitecture
+#  endif
+# endif
 #endif /* ibm */
 
 #ifdef luna
-#undef luna
-#define MacroIncludeFile <luna.cf>
-#define MacroFile luna.cf
-#define LunaArchitecture
-#ifdef mc68000
-#undef mc68000
-#define Mc68000Architecture
-#else
-#undef mc88000
-#define Mc88000Architecture
-#endif
+# undef luna
+# define MacroIncludeFile <luna.cf>
+# define MacroFile luna.cf
+# define LunaArchitecture
+# ifdef mc68000
+#  undef mc68000
+#  define Mc68000Architecture
+# else
+#  undef mc88000
+#  define Mc88000Architecture
+# endif
 #endif /* luna */
 
 #ifdef Mips
@@ -317,9 +624,14 @@
 # endif
 #endif /* MOTOROLA */
 
-#ifdef SVR4
+#if defined(SVR4) && !defined(DGUX)
 # ifdef i386
 #  define i386Architecture
+#  undef i386
+# endif
+# ifdef PC98
+#  define PANIX98Architecture
+#  undef PC98
 # endif
 # define SVR4Architecture
 # define MacroIncludeFile <svr4.cf>
@@ -329,13 +641,42 @@
 
 #ifdef SYSV
 # ifdef i386
-#  define MacroIncludeFile <x386.cf>
-#  define MacroFile x386.cf
-#  define i386SVR3Architecture
-# endif
+# undef i386
+#  ifdef ISC
+#   define i386Architecture	
+#   define i386SVR3Architecture	
+#   define MacroIncludeFile <isc.cf>
+#   define MacroFile isc.cf
+#   define i386IscArchitecture
+#   undef ISC
+#   ifdef ISC202
+#    define IscVersion 202
+#    undef ISC202
+#   else
+#    ifdef ISC30
+#     define IscVersion 300
+#     undef ISC30
+#    else
+#     ifdef ISC40
+#      define IscVersion 400
+#      undef ISC40
+#     else
+#      define IscVersion 221
+#     endif /* ISC40 */
+#    endif /* ISC30 */
+#   endif /* ISC202 */
+#  endif /* ISC */
+#  ifndef MacroFile
+#   define i386SVR3Architecture
+#   define MacroIncludeFile <x386.cf>
+#   define MacroFile x386.cf
+#  endif /* MacroFile */
+# endif /* i386 */
 #endif /* SYSV */
 
+/* SYSV386 is here for backward compatibility only */
 #ifdef SYSV386
+# undef i386
 # ifdef SVR4
 #  define i386Architecture
 #  define SVR4Architecture
@@ -343,18 +684,46 @@
 #  define MacroIncludeFile <svr4.cf>
 #  define MacroFile svr4.cf
 #  undef SVR4
-# else
-#  define MacroIncludeFile <x386.cf>
-#  define MacroFile x386.cf
-#  define i386SVR3Architecture
-# endif
+# else /* ! SVR4 */
+#  ifdef ISC
+#   define i386Architecture	
+#   define i386SVR3Architecture	
+#   define MacroIncludeFile <isc.cf>
+#   define MacroFile isc.cf
+#   define i386IscArchitecture
+#   undef ISC
+#   ifdef ISC202
+#    define IscVersion 202
+#    undef ISC202
+#   else
+#    ifdef ISC30
+#     define IscVersion 300
+#     undef ISC30
+#    else
+#     ifdef ISC40
+#      define IscVersion 400
+#      undef ISC40
+#     else
+#      define IscVersion 221
+#     endif /* ISC40 */
+#    endif /* ISC30 */
+#   endif /* ISC202 */
+#  endif /* ISC */
+#  ifndef MacroFile
+#   define i386SVR3Architecture
+#   define MacroIncludeFile <x386.cf>
+#   define MacroFile x386.cf
+#  endif /* MacroFile */
+# endif /* ! SVR4 */
 #endif /* SYSV386 */
 
 #ifdef DGUX
-#define MacroIncludeFile <DGUX.cf>
-#define MacroFile DGUX.cf
-#undef DGUX
-#define DguxArchitecture
+# define i386Architecture
+# define SVR4Architecture
+# define MacroIncludeFile <DGUX.cf>
+# define MacroFile DGUX.cf
+# undef DGUX
+# define DguxArchitecture
 #endif /* DGUX */
 
 #ifdef __convex__
@@ -366,101 +735,452 @@
 # define ConvexArchitecture
 #endif /* _convex_ */
 
-/*  GF. #ifdef __osf__ */
-#if defined(__osf__) || defined(__alpha)
-#define MacroIncludeFile <osf1.cf>
-#define MacroFile osf1.cf
-#define OSF1Architecture
-#undef __osf__
-#ifdef __mips__
-#undef __mips__
-#define MipsArchitecture
-#endif
-#ifdef __alpha
-#undef __alpha
-#define AlphaArchitecture
-#endif
+#ifdef __osf__
+# define MacroIncludeFile <osf1.cf>
+# define MacroFile osf1.cf
+# define OSF1Architecture
+# undef __osf__
+# ifdef __mips__
+#  undef __mips__
+#  define MipsArchitecture
+#  define MipselArchitecture
+# endif
+# ifdef __alpha
+#  undef __alpha
+#  define AlphaArchitecture
+# endif
 #endif /* __osf__ */
 
 #ifdef Oki
-#define MacroIncludeFile <Oki.cf>
-#define MacroFile Oki.cf
-#undef Oki
-#define i860SVR4Architecture
+# define MacroIncludeFile <Oki.cf>
+# define MacroFile Oki.cf
+# undef Oki
+# define i860SVR4Architecture
+# define SVR4Architecture
+# undef SVR4
 #endif /* Oki */
 
-#ifdef WIN32
-#define MacroIncludeFile <Win32.cf>
-#define MacroFile Win32.cf
-#define Win32Architecture
+#if defined(WIN32) && !defined(__GNUC__)
+# define MacroIncludeFile <Win32.cf>
+# define MacroFile Win32.cf
+# define Win32Architecture
 #endif /* WIN32 */
 
-#ifdef linux 
-#ifdef  PPC
-#define MacroIncludeFile <linux-pmac.cf>
-#define MacroFile       linux-pmac.cf
-#undef linux
-#undef PPC
-#define LinuxArchitecture
-#define PPCArchitecture
-#elif _LP64
-#define MacroIncludeFile <linux-lp64.cf>
-#define MacroFile linux-lp64.cf
-#undef linux
-#undef _LP64
-#define LinuxArchitecture
-#else
-#define MacroIncludeFile <linux.cf>
-#define MacroFile linux.cf
-#undef linux
-#define LinuxArchitecture
+#if defined(WIN32) && defined(__GNUC__)
+#define MacroIncludeFile <mingw.cf>
+#define MacroFile mingw.cf
+#define Win32Architecture
+#define mingwArchitecture
 #define i386Architecture
-#endif
-#endif /* linux */
+#undef i386
+#undef i486
+#undef i586
+#undef i686
+#undef __i386__
+#undef _X86_
+#undef __MINGW32__
+#endif /* CYGWIN */
+
+#if defined(linux) || defined(__GLIBC__)
+# define MacroIncludeFile <linux.cf>
+# define MacroFile linux.cf
+# undef linux
+# ifdef __linux__
+#  define LinuxArchitecture
+# endif
+# ifdef __GLIBC__
+#  define GNUArchitecture
+# endif
+# ifdef i386
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef i386
+XCOMM Keep cpp from replacing path elements containing i486/i586/i686
+#  ifdef i486
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#   undef i486
+#  endif
+#  ifdef i586
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#   undef i586
+#  endif
+#  ifdef i686
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#   undef i686
+#  endif
+#  ifdef k6
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#   undef k6
+#  endif
+# endif /* k6 */
+# ifdef __i386__
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef __i386__
+# endif /* __i386__ */
+# ifdef __i486__
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef __i486__
+# endif /* __i486__ */
+# ifdef __i586__
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef __i586__
+# endif /* __i586__ */
+# ifdef __i686__
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef __i686__
+# endif /* __i686__ */
+# ifdef __k6__
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef __k6__
+# endif /* __k6__ */
+# ifdef __i386
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef __i386
+# endif /* __i386 */
+# ifdef __i486
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef __i486
+# endif /* __i486 */
+# ifdef __i586
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef __i586
+# endif /* __i586 */
+# ifdef __i686
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef __i686
+# endif /* __i686 */
+# ifdef __k6
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef __k6
+# endif /* __k6 */
+/* Keep this order! s390x has also __s390__ defined */
+# if defined(__s390x__)
+#  define s390xArchitecture
+#  undef __s390x__
+#  undef __s390__
+# endif
+# ifdef __s390__
+#   define s390Architecture
+#  undef __s390__
+# endif /* s390 */
+# ifdef __alpha
+#  define AlphaArchitecture
+#  undef __alpha
+# endif /* __alpha */
+# ifdef __alpha__
+#  ifndef AlphaArchitecture
+#   define AlphaArchitecture
+#  endif
+#  undef __alpha__
+# endif /* __alpha__ */
+# ifdef __arm__
+#  define Arm32Architecture
+#  undef arm
+#  undef __arm
+#  undef __arm__
+#  if defined(__ARMEB__)
+#   define Arm32ebArchitecture
+#  endif
+#  undef __ARMEB__
+# endif
+# ifdef mc68000
+#  define Mc68020Architecture
+#  undef mc68000
+# endif /* mc68000 */
+# if defined (powerpc) && !defined(__powerpc64__) && !defined (powerpc64)
+#  define PpcArchitecture
+#  undef powerpc
+# endif
+# if defined (__powerpc__) && !defined(__powerpc64__) && !defined (powerpc64)
+#  ifndef PpcArchitecture
+#   define PpcArchitecture
+#  endif
+#  undef __powerpc__
+# endif
+# ifdef __powerpc64__
+#  ifndef Ppc64Architecture
+#   define Ppc64Architecture
+#  endif
+#  undef __powerpc64__
+# endif
+# ifdef sparc
+#  define SparcArchitecture
+#  undef sparc
+# endif
+# ifdef __sparc__
+#  ifndef SparcArchitecture
+#   define SparcArchitecture
+#  endif
+#  undef __sparc__
+# endif
+# ifdef ia64 
+#  define ia64Architecture
+#  undef ia64 
+# endif
+# ifdef __ia64__
+#  ifndef ia64Architecture
+#   define ia64Architecture
+#  endif
+#  undef __ia64__
+# endif
+# if defined(mips) || defined(__mips__)
+#  define MipsArchitecture
+#  undef mips
+#  undef __mips__
+#  if defined(MIPSEL) || defined(_MIPSEL)
+#   define MipselArchitecture
+#  endif
+#  undef MIPSEL
+#  undef _MIPSEL
+# endif
+# ifdef __hppa__
+#  ifndef HPArchitecture
+#   define HPArchitecture
+#  endif
+#  undef __hppa__
+# endif /* __hppa__ */
+# ifdef __sh__
+#  ifndef SuperHArchitecture
+#   define SuperHArchitecture
+#  endif
+#  ifdef __BIG_ENDIAN__
+#   ifndef SuperHebArchitecture
+#    define SuperHebArchitecture
+#   endif
+#  endif
+#  undef __sh__
+# endif /* __sh__ */
+# if defined(__SH3__) || defined(__sh3__)
+#  ifndef SuperH3Architecture
+#   define SuperH3Architecture
+#  endif
+#  undef __SH3__
+#  undef __sh3__
+# endif /* __SH3__ or __sh3__ */
+# ifdef __SH4__
+#  ifdef __SH4_NOFPU__
+#   ifndef SuperH4NOFPUArchitecture
+#    define SuperH4NOFPUArchitecture
+#   endif
+#   undef __SH4_NOFPU__
+#  else
+#   ifndef SuperH4Architecture
+#    define SuperH4Architecture
+#   endif
+#  endif
+#  undef __SH4__
+# endif /* __SH4__ */
+/* for compatibility with 3.3.x */
+# ifdef PpcArchitecture
+#  define PowerPCArchitecture
+# endif
+# if defined(__s390x__)
+#  define s390xArchitecture
+#  undef __s390x__
+# endif
+# if defined(__amd64__) || defined (__x86_64__)
+#  undef __amd64__
+#  undef __x86_64__
+#  define AMD64Architecture
+# endif
+# if defined(amd64__) || defined (x86_64__)
+#  undef amd64__
+#  undef x86_64__
+#  ifndef AMD64Architecture
+#   define AMD64Architecture
+#  endif
+# endif
+# if defined(__aarch64__)
+#  undef __aarch64__
+#  ifndef ARM64Architecture
+#   define ARM64Architecture
+#  endif
+# endif
+#endif /* linux || __GLIBC__ */
+
+#if (defined(__Lynx__) || defined(Lynx)) && (defined(i386) || defined(__i386__) || defined(__x86__) || defined(__powerpc__) || defined(__sparc__) || defined(sparc))
+# define MacroIncludeFile <lynx.cf>
+# define MacroFile lynx.cf
+# define LynxOSArchitecture
+# undef __Lynx__
+# undef Lynx
+# undef lynx
+# if defined(i386) || defined(__i386__) || defined(__x86__)
+#  define i386Architecture
+#  undef i386
+#  undef __i386__
+#  undef __x86__
+# endif
+# ifdef __powerpc__
+#  define PpcArchitecture
+#  undef __powerpc__
+# endif
+# if defined(sparc) || defined(__sparc__)
+#  define SparcArchitecture
+#  undef sparc
+#  undef __sparc__
+# endif
+/* for compatibility with 3.3.x */
+# ifdef PpcArchitecture
+#  define PowerPCArchitecture
+# endif
+#endif /* LynxOS AT/PPC/microSPARC */
 
 #ifdef __uxp__
-#define MacroIncludeFile <fujitsu.cf>
-#define MacroFile fujitsu.cf
-#undef __uxp__
-#ifdef sparc
-#undef sparc
-#define SparcArchitecture
-#endif
+# define MacroIncludeFile <fujitsu.cf>
+# define MacroFile fujitsu.cf
+# define FujitsuArchitecture
+# undef __uxp__
+# define UXPArchitecture
+# define SVR4Architecture
+# ifdef sparc
+#  undef sparc
+#  define SparcArchitecture
+# endif
 #endif /* __uxp__ */
 
 #ifdef __sxg__
-#define MacroIncludeFile <fujitsu.cf>
-#define MacroFile fujitsu.cf
-#undef __sxg__
-#define mc68000Architecture
+# define MacroIncludeFile <fujitsu.cf>
+# define MacroFile fujitsu.cf
+# define FujitsuArchitecture
+# undef __sxg__
+# define mc68000Architecture
 #endif /* __sxg__ */
 
-#if defined(sequent) || defined(_SEQUENT_)
+#ifdef _SEQUENT_
+/* undefine assignments resulting from -DSVR4 */
+# undef MacroIncludeFile
 # define MacroIncludeFile <sequent.cf>
+# undef MacroFile
 # define MacroFile sequent.cf
-# ifdef sequent
-#  undef sequent
-#  define Dynix3Architecture
-# endif
-# ifdef _SEQUENT_
-#  undef _SEQUENT_
-#  define DynixPtxArchitecture
-# endif
+# undef _SEQUENT_
+# define DynixPtxArchitecture
 # define SequentArchitecture
 #endif
 
 #if defined(_nec_ews_svr4) || defined(nec_ews_svr4) || defined(nec_ews_svr2) || defined(SX) || defined(_nec_up) || defined(_nec_ft) || defined(PC_UX)
-#ifdef nec
-#undef nec
+# ifdef nec
+#  undef nec
+# endif
+# define MacroIncludeFile <nec.cf>
+# define MacroFile nec.cf
+# define NecArchitecture
+#endif
+
+#ifdef minix 
+#define MacroIncludeFile <minix.cf>
+#define MacroFile minix.cf
+#undef minix
+#define MinixArchitecture
+#define i386Architecture
+#endif /* minix */
+
+/* Systems with GNU libc and userland */
+#if defined(__GNU__)
+#define GNUArchitecture
+#define MacroIncludeFile <gnu.cf>
+#define MacroFile gnu.cf
+#ifdef __i386__
+#define i386Architecture
 #endif
-#define MacroIncludeFile <nec.cf>
-#define MacroFile nec.cf
-#define NecArchitecture
 #endif
 
+#ifdef MACH
+#ifdef __GNU__
+/* Mach-based GNU system */
+#define GNUMachArchitecture
+#else
+#define MacroIncludeFile <mach.cf>
+#define MacroFile mach.cf
+#endif
+#undef MACH
+#ifdef	i386
+#define i386MachArchitecture
+#define i386Architecture
+#endif	/* i386 */
+#undef i386
+#endif /* MACH */
+
+/* On NetBSD, `unix' is not defined, and cpp emits a warning every time
+ * it sees a test using the `unix' symbol */
+#if !defined(NetBSDArchitecture) || (defined(NetBSDArchitecture) && DefaultOSMajorVersion == 1 && DefaultOSMinorVersion <= 3)
 #ifdef unix
 #undef unix
-#endif /* unix */
+#endif
+#endif
+
+#ifdef emxos2
+#define MacroIncludeFile <os2.cf>
+#define MacroFile os2.cf
+#define OS2Architecture
+#define i386Architecture
+#endif /* emxos2 */
+
+#if defined(__QNX__) && !defined(__QNXNTO__)
+#define MacroIncludeFile <QNX4.cf>
+#define MacroFile QNX4.cf
+#define QNX4Architecture
+#define i386Architecture
+#endif /* QNX4 */
+
+#ifdef __QNXNTO__
+#define MacroIncludeFile <nto.cf>
+#define MacroFile nto.cf
+#define NTOArchitecture
+# ifdef PPC
+#  define PPCArchitecture
+#  undef PPC
+# endif
+# ifdef MIPS
+#  define mipsArchitecture
+#  undef MIPS
+# endif
+# ifdef i386
+#  define i386Architecture
+#  undef i386
+# endif /* i386 */
+# ifdef __i386__
+#  ifndef i386Architecture
+#   define i386Architecture
+#  endif
+#  undef __i386__
+# endif /* __i386__ */
+#endif /* QNX/Neutrino */
+
+#ifdef SparcArchitecture
+# if defined(__sparc_v9) || defined(__arch64__)
+#  define Sparc64Architecture
+# endif
+#endif
 
 #ifndef MacroIncludeFile
 XCOMM WARNING:  Imake.cf not configured; guessing at definitions!!!
--- a/src/config/linux-lp64.cf
+++ b/src/config/linux-lp64.cf
@@ -153,7 +153,7 @@
 # define XargsCmd               xargs
 # define FortranSaveFlags       -fno-automatic
 # define OptimisedFortranFlags  -O0 -g -funroll-loops -fomit-frame-pointer
-# define DefaultFCOptions       -fno-second-underscore
+# define DefaultFCOptions       -fno-automatic -fno-second-underscore
 # define NoOpFortranDebugFlags  -O0
 # define CernlibSystem          -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC -DCERNLIB_GFORTRAN -DCERNLIB_QMLXIA64
 
--- a/src/config/linux.cf
+++ b/src/config/linux.cf
@@ -68,20 +68,20 @@
 #define OSVendor		/**/
 #define OSMajorVersion		2
 #define OSMinorVersion		4
-#define OSTeenyVersion		2020
+#define OSTeenyVersion		21
 
 #undef unix			/* GF. this is not needed anywhere */
 
 #ifndef UseElfFormat
-#define UseElfFormat		NO
+#define UseElfFormat		YES
 #endif
 #define HasGcc2ForCplusplus	YES
 #define GccUsesGas		YES
 #define UseGas			YES
 #define GnuCpp			YES
-#define HasShadowPasswd		NO
+#define HasShadowPasswd		YES
 #ifndef HasLibCrypt
-# define HasLibCrypt		NO
+# define HasLibCrypt		YES
 #endif
 #define HasPutenv		YES
 #define HasShm			YES
@@ -97,38 +97,320 @@
 #define NeedVarargsPrototypes	YES
 #define NeedWidePrototypes	NO
 
+/* The following modified to match (more or less) linux.cf in XFree86 4.3.0.
+   -- Kevin McCarty
+*/
+
 #if UseElfFormat
-#define CcCmd			gcc -b i486-linuxelf
-#define AsCmd			/usr/i486-linuxelf/bin/as
-#define LdCmd			ld -m elf_i386
-#define AsmDefines		-D__ELF__
-#define CplusplusCmd		g++ -b i486-linuxelf
-#else
-#define CcCmd			gcc
+#ifdef MipsArchitecture
+#ifndef AsCmd
+#define AsCmd			gcc -c -x assembler-with-cpp
+#endif
+#endif /* MipsArchitecture */
+#ifndef CcCmd
+#define CcCmd			gcc -g
+#endif
+#ifndef AsCmd
 #define AsCmd			as
+#endif
+#ifndef LdCmd
 #define LdCmd			ld
-#define AsmDefines		-DUSE_GAS
 #endif
+#define AsmDefines		-D__ELF__
+#define CplusplusCmd		c++ -g
+#else /* no UseElfFormat */
+#define CcCmd			gcc -g
+#define AsCmd			as
+#define LdCmd			ld
+#define AsmDefines		-DUSE_GAS -U__ELF__
+#define CplusplusCmd		g++ -g
+#endif /* UseElfFormat */
+
+#ifndef CppCmd
 #define CppCmd			/lib/cpp
+#endif
 #define YaccCmd			bison -y
 #define LexCmd			flex -l
 #define LexLib			-lfl
 #define PreProcessCmd		CcCmd -E
 #define PostIncDir		`CcCmd --print-libgcc-file-name | sed 's/libgcc.a/include/'`
 #define LdCombineFlags		-r
-#define OptimizedCDebugFlags	-O2 -m486 -fno-strength-reduce\
-					-fomit-frame-pointer
-#define StandardDefines		-Dlinux -D__i386__ -D_POSIX_SOURCE \
-				-D_BSD_SOURCE -D_GNU_SOURCE -DX_LOCALE
+#define LinuxSourceDefines	-D_POSIX_SOURCE -D_BSD_SOURCE -D_GNU_SOURCE \
+				-DX_LOCALE
 #define XawI18nDefines		-DUSE_XWCHAR_STRING -DUSE_XMBTOWC
 #define HasWChar32		YES
 #define StandardCppDefines	-traditional StandardDefines
-#define ServerOSDefines		XFree86ServerOSDefines -DDDXTIME
+#define ServerOSDefines		XFree86ServerOSDefines -DDDXTIME -DPART_NET
 #define ExtensionOSDefines	-DXTESTEXT1
-#define ServerExtraDefines	-DGCCUSESGAS XFree86ServerDefines
+/* #define ServerExtraDefines	-DGCCUSESGAS XFree86ServerDefines */
 #define ConnectionFlags		-DUNIXCONN -DTCPCONN
 #define InstUidFlags		-s -m 4755
 
+/* Arch-specific flags here copied from linux.cf for XFree86 4.3.0,
+   Debian patched (version 4.3.0.dfsg.1-4), plus additional
+   OptimizationLevel macro.
+   
+   Additional CERNLIB-specific per-architecture flags also added.
+   --Kevin McCarty */
+
+/* Note: we are now using CERNLIB_PPC as an endianness test (which is about
+   all that the CERNLIB source uses it for); I introduced a new define
+   CERNLIB_POWERPC for the three occasions when we specifically want to
+   test for powerpc chips.
+*/
+
+#ifdef i386Architecture
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O3
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel -fno-strength-reduce
+# endif
+# define LinuxMachineDefines    -D__i386__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines
+#endif /* i386Architecture */
+
+#ifdef s390Architecture
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O3
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel
+# endif
+# define LinuxMachineDefines    -D__s390__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines
+# define CernlibMachineDefines	-DCERNLIB_PPC
+# define CERNLIB_PPC
+#endif /* s390Architecture */
+
+#ifdef s390xArchitecture
+/*#define DefaultCCOptions      -fsigned-char */
+#ifndef OptimizationLevel
+#define OptimizationLevel	-O3
+#endif
+#define OptimizedCDebugFlags    OptimizationLevel
+#define LinuxMachineDefines     -D__s390x__
+#define ServerOSDefines         XFree86ServerOSDefines -DDDXTIME -DPART_NET
+#define ServerExtraDefines      -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64
+#define CernlibMachineDefines	-DCERNLIB_PPC -DCERNLIB_QMLXIA64
+#define CERNLIB_PPC
+#define CERNLIB_QMLXIA64
+#endif /* s390xArchitecture */
+
+#ifdef AlphaArchitecture
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O3
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel
+# endif
+# define LinuxMachineDefines    -D__alpha__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64 -DJENSEN_SUPPORT
+# define CernlibMachineDefines  -DCERNLIB_QMLXIA64
+# define CERNLIB_QMLXIA64
+# ifdef UseCompaqMathLibrary
+#  define MathLibrary           -lcpml -lm
+# endif
+#endif /* AlphaArchitecture */
+
+#ifdef Arm32Architecture
+# define DefaultCCOptions       -fsigned-char
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O2
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel
+# endif
+# define LinuxMachineDefines    -D__arm__ -D__arm32__ -U__arm -Uarm
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines
+# if defined(__ARMEB__) || defined(Arm32ebArchitecture)
+  /* test for big-endianness */
+#  define CernlibMachineDefines	-DCERNLIB_PPC
+#  define CERNLIB_PPC
+# endif
+#endif /* Arm32Achitecture */
+
+#ifdef ia64Architecture
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O2
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel
+# endif
+# define LinuxMachineDefines    -D__ia64__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64
+# define CernlibMachineDefines  -DCERNLIB_QMLXIA64
+# define CERNLIB_QMLXIA64
+#endif /* ia64Architecture */
+
+#ifdef Mc68020Architecture
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O3
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel
+# endif
+# define DefaultCCOptions       -malign-int
+# define DefaultFCOptions       -malign-int -fno-automatic \
+                                -fno-second-underscore
+# define LinuxMachineDefines    -D__mc68000__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines
+# define CernlibMachineDefines	-DCERNLIB_PPC
+# define CERNLIB_PPC
+# define CERNLIB_M68K
+/* # define PositionIndependentCplusplusFlags -fpic */
+#endif /* Mc68020Architecture */
+
+#if defined(PpcArchitecture) || defined(Ppc64Architecture)
+# define DefaultCCOptions       -fsigned-char
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O3
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel
+# endif
+# define LinuxMachineDefines    -D__powerpc__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# ifdef Ppc64Architecture
+#  define ServerExtraDefines    -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64
+#  define CernlibMachineDefines	-DCERNLIB_PPC -DCERNLIB_POWERPC \
+				-DCERNLIB_QMLXIA64
+#  define CERNLIB_QMLXIA64
+# else
+#  define CernlibMachineDefines	-DCERNLIB_PPC -DCERNLIB_POWERPC
+#  define ServerExtraDefines    -DGCCUSESGAS XFree86ServerDefines
+# endif
+# define CERNLIB_PPC
+# define CERNLIB_POWERPC
+#endif /* PpcArchitecture || Ppc64Architecture */
+
+#ifdef SparcArchitecture
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O3
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel
+# endif
+# define LinuxMachineDefines    -D__sparc__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines
+# define AsVISOption            -Av9a
+# ifdef Sparc64Architecture
+#  define AsOutputArchSize      64
+#  define CernlibMachineDefines -DCERNLIB_PPC -DCERNLIB_QMLXIA64
+#  define CERNLIB_QMLXIA64
+# else
+#  define AsOutputArchSize      32
+#  define CernlibMachineDefines	-DCERNLIB_PPC
+# endif
+# define CERNLIB_PPC
+#endif
+
+#ifdef MipsArchitecture
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O2
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel
+# endif
+# define LinuxMachineDefines    -D__mips__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines
+# if !defined(MipselArchitecture) /* then big-endian, i.e. mips */
+#  define CernlibMachineDefines	-DCERNLIB_PPC
+#  define CERNLIB_PPC
+# endif
+#endif
+
+#ifdef HPArchitecture
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O3
+# endif
+# define OptimizedCDebugFlags   OptimizationLevel
+# define LinuxMachineDefines    -D__hppa__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines
+# define CernlibMachineDefines	-DCERNLIB_PPC
+# define CERNLIB_PPC
+#endif
+
+#ifdef SuperHArchitecture
+# ifndef SuperHArchOptFlags
+#  ifdef SuperH4Architecture
+#   define SuperHArchOptFlags   -m4
+#  elif defined(SuperH4NOFPUArchitecture)
+#   define SuperHArchOptFlags   -m4-nofpu
+#  else
+#   define SuperHArchOptFlags   -m3
+#  endif
+# endif 
+# ifndef SuperHebArchitecture
+#  ifdef SuperHebArchitecture
+#   define SuperHEndianFlags    -mb
+#   define CernlibMachineDefines -DCERNLIB_PPC
+#   define CERNLIB_PPC
+#  else
+#   define SuperHEndianFlags    -ml
+#  endif
+# endif
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O3
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel SuperHArchOptFlags SuperHEndianFlags
+# endif
+# define LinuxMachineDefines    -D__sh__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines
+#endif
+
+#ifdef AMD64Architecture
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel
+# endif
+# define LinuxMachineDefines    -D__x86_64__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64
+# define CernlibMachineDefines  -DCERNLIB_QMLXIA64
+# define CERNLIB_QMLXIA64
+#endif /* AMD64Architecture */
+
+#ifdef ARM64Architecture
+# ifndef OptimizationLevel
+#  define OptimizationLevel	-O3
+# endif
+# ifndef OptimizedCDebugFlags
+#  define OptimizedCDebugFlags  OptimizationLevel
+# endif
+# define LinuxMachineDefines    -D__aarch64__
+# define ServerOSDefines        XFree86ServerOSDefines -DDDXTIME -DPART_NET
+# define ServerExtraDefines     -DGCCUSESGAS XFree86ServerDefines -D_XSERVER64
+#endif /* ARM64Architecture */
+
+#ifndef StandardDefines
+# define StandardDefines        -Dlinux LinuxMachineDefines LinuxSourceDefines
+#endif
+
+#ifndef CernlibMachineDefines
+#define CernlibMachineDefines
+#endif
+
+#ifndef CernlibLocalDefines
+#define CernlibLocalDefines
+#endif
+
+#define CernlibDefaultDefines	-DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX \
+				-DCERNLIB_QMGLIBC
+
 /* Some of these man page defaults are overriden in the above OS sections */
 #ifndef ManSuffix
 # define ManSuffix	1x
@@ -163,7 +433,7 @@
 #define FortranSaveFlags	/* */ /* Everything static !? */
 #define OptimisedFortranFlags   -g -pc 64 -tp p6
 #define DefaultFCOptions        -Msave -fpic -Kieee
-#define CernlibSystem           -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC -DCERNLIB_QFPGF77
+#define CernlibSystem           CernlibDefaultDefines -DCERNLIB_QFPGF77
 
 #else
 
@@ -174,19 +444,18 @@
 #  undef StandardDefines
 #  undef NeedFunctionPrototypes
 #  undef NeedWidePrototypes
-# define CcCmd			icc
-# define DefaultCCOptions	
-# define OptimizedCDebugFlags	-O
-
-# define FortranDoesCpp         NO
-#define FortranCppCmd           /usr/bin/cpp -traditional -C
-# define FortranCmd             ifc
-# define XargsCmd               xargs
-# define FortranSaveFlags	-save
-# define OptimisedFortranFlags  -O -mp1 -fp_port
-# define NoOpFortranDebugFlags  -O0
-# define DefaultFCOptions       
-# define CernlibSystem          -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC
+#  define CcCmd			icc
+#  define DefaultCCOptions	
+#  define OptimizedCDebugFlags	-O
+#  define FortranDoesCpp         NO
+#  define FortranCppCmd           /usr/bin/cpp -traditional -C
+#  define FortranCmd             ifort
+#  define XargsCmd               xargs
+#  define FortranSaveFlags	-save
+#  define OptimisedFortranFlags  -O -mp1 -fp_port
+#  define NoOpFortranDebugFlags  -O0
+#  define DefaultFCOptions       
+#  define CernlibSystem          CernlibDefaultDefines
  
 #else
 
@@ -197,19 +466,18 @@
 #  undef StandardDefines
 #  undef NeedFunctionPrototypes
 #  undef NeedWidePrototypes
-# define CcCmd			ecc
-# define DefaultCCOptions	-KPIC
-# define OptimizedCDebugFlags	-O
-
-# define FortranDoesCpp         NO
-#define FortranCppCmd           /lib/cpp -traditional -C
-# define FortranCmd             efc
-# define XargsCmd               xargs
-# define FortranSaveFlags	-save
-# define OptimisedFortranFlags  -O
-# define DefaultFCOptions       -KPIC
-# define CernlibSystem          -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC
-# define CERNLIB_SHIFT NO
+#  define CcCmd			ecc
+#  define DefaultCCOptions	-KPIC
+#  define OptimizedCDebugFlags	-O
+#  define FortranDoesCpp         NO
+#  define FortranCppCmd           /lib/cpp -traditional -C
+#  define FortranCmd             efc
+#  define XargsCmd               xargs
+#  define FortranSaveFlags	-save
+#  define OptimisedFortranFlags  -O
+#  define DefaultFCOptions       -KPIC
+#  define CernlibSystem          CernlibDefaultDefines
+#  define CERNLIB_SHIFT NO
 /*
  *  Create a Make Variable to allow building with/out Motif
  */
@@ -222,25 +490,30 @@
 #else
 
 # ifdef Hasgfortran
-#  undef CcCmd
-#  undef DefaultCCOptions
-#  undef OptimizedCDebugFlags
 #  undef StandardDefines
 #  undef NeedFunctionPrototypes
 #  undef NeedWidePrototypes
-# define CcCmd			gcc4
-# define DefaultCCOptions	
-# define OptimizedCDebugFlags	-O -g -fomit-frame-pointer
+# ifndef DefaultCCOptions
+# define DefaultCCOptions	-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security
+# endif
+# ifndef OptimizedCDebugFlags
+# define OptimizedCDebugFlags	OptimizationLevel DefaultCCOptions
+# endif
 
 # define FortranDoesCpp         YES
 # define f2cFortran             YES
-# define FortranCmd             gfortran
+# define gFortran               YES
+# define FortranCmd             gfortran -g
 # define XargsCmd               xargs
 # define FortranSaveFlags       -fno-automatic
-# define OptimisedFortranFlags  -O0 -g -funroll-loops -fomit-frame-pointer
-# define DefaultFCOptions       -fno-second-underscore
+# define OptimisedFortranFlags  OptimizedCDebugFlags /* -funroll-loops */
+/* Remove -fomit-frame-pointer since -O implies it and it inhibits debugging */
+# ifndef DefaultFCOptions
+# define DefaultFCOptions       -D_FORTIFY_SOURCE=2 -fno-range-check -fno-automatic -fno-second-underscore -fstack-protector --param=ssp-buffer-size=4
+# endif
 # define NoOpFortranDebugFlags  -O0
-# define CernlibSystem          -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC -DCERNLIB_GFORTRAN
+# define CernlibSystem          CernlibDefaultDefines CernlibMachineDefines \
+                                CernlibLocalDefines -DCERNLIB_GFORTRAN
 
 #define CERNLIB_GFORTRAN
  
@@ -249,17 +522,32 @@
 /* Start CERNLIB changes A.Waananen 15. Apr. 1996 */
 /*  Adapted to CERN style GF. 20-Sep-96 */
 
+/*
 #  undef DefaultCCOptions
 #  undef OptimizedCDebugFlags
 #  undef StandardDefines
 # define OptimizedCDebugFlags	-O1 -fomit-frame-pointer
+*/
+
+#ifndef DefaultCCOptions
+# define DefaultCCOptions
+#endif
+#ifndef OptimizedCDebugFlags
+# define OptimizedCDebugFlags	OptimizationLevel DefaultCCOptions
+#endif
 
 #define f2cFortran	        YES
-#define FortranCmd		g77
+#define FortranCmd		g77 -g
 #define XargsCmd		xargs
 #define FortranSaveFlags	/* */ /* Everything static !? */
-#define DefaultFCOptions	-fno-automatic -fno-second-underscore -fugly-complex
-#define CernlibSystem	        -DCERNLIB_LINUX -DCERNLIB_UNIX -DCERNLIB_LNX -DCERNLIB_QMGLIBC
+#define OptimisedFortranFlags	OptimizedCDebugFlags -funroll-loops
+/* Remove -fomit-frame-pointer since -O implies it and it inhibits debugging */
+#ifndef DefaultFCOptions
+# define DefaultFCOptions	-fno-automatic -fno-second-underscore \
+				-fugly-complex
+#endif
+#define CernlibSystem	        CernlibDefaultDefines CernlibMachineDefines \
+				CernlibLocalDefines
 
 # endif
 # endif
@@ -280,7 +568,7 @@
 /*
  *  Create a Make Variable to allow building with/out Motif
  */
-
+#define MotifDependantMakeVar(variable,value) variable=value
 
 /* End  CERNLIB changes */
 
--- a/src/config/Imake.tmpl
+++ b/src/config/Imake.tmpl
@@ -813,7 +813,7 @@
 #endif
 #endif
 #ifndef ExtraLoadOptions
-#define ExtraLoadOptions /**/
+#define ExtraLoadOptions -Wl,-z,relro
 #endif
 #ifndef ExtraLoadFlags
 #define ExtraLoadFlags /**/
@@ -1100,7 +1100,7 @@
     PROOFOPTIONS = ProofOptions
 #endif
      STD_INCLUDES = StandardIncludes
-  STD_CPP_DEFINES = StandardCppDefines
+  STD_CPP_DEFINES = StandardCppDefines -D_FORTIFY_SOURCE=2
       STD_DEFINES = StandardDefines
  EXTRA_LOAD_FLAGS = ExtraLoadFlags
   EXTRA_LDOPTIONS = ExtraLoadOptions
 
     |