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
|
AC_INIT(ESPRESSO, 5.0.0, , espresso)
# ----------------------------
# Non-standart precious variables
# ----------------------------
AC_ARG_VAR(EXTLIB_FLAGS, This variable controls the flags passed to internal BLAS and LAPACK libraries)
# -----------------------------
# options
# -----------------------------
AC_ARG_ENABLE(parallel,
[AS_HELP_STRING([--enable-parallel],
[compile for parallel execution if possible (default: yes)])],
[set_use_parallel=1
if test "$enableval" = "yes" ; then
use_parallel=1
else
use_parallel=0
fi],
[set_use_parallel=0 use_parallel=1])
AC_ARG_ENABLE(openmp,
[AS_HELP_STRING([--enable-openmp],
[compile for openmp execution if possible (default: no)])],
[if test "$enableval" = "yes" ; then
use_openmp=1
else
use_openmp=0
fi],
[use_openmp=0])
# debug flags are implemented only for a few cases
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug],
[compile Fortran with debug flags (default: no)])],
[if test "$enableval" = "yes" ; then
use_debug=1
else
use_debug=0
fi],
[use_debug=0])
# shared library flags are implemented only for a few (untested) cases
AC_ARG_ENABLE(shared,
[AS_HELP_STRING([--enable-shared],
[use shared libraries if available (default: yes)])],
[if test "$enableval" = "yes" ; then
use_shared=1
else
use_shared=0
fi],
[use_shared=1])
# the C-to-Fortran wrapper check may cause trouble on some machines
AC_ARG_ENABLE(wrappers,
[AS_HELP_STRING([--disable-wrappers],
[disable C to fortran wrapper check (default: enabled)])],
[if test "$enableval" = "yes" ; then
check_wrappers=1
else
check_wrappers=0
fi],
[check_wrappers=1])
AC_ARG_ENABLE(signals,
[AS_HELP_STRING([--enable-signals],
[enable signal trapping (default: no)])],
[if test "$enableval" = "yes" ; then
use_signals=1
else
use_signals=0
fi],
[use_signals=0])
# -----------------------------
# packages
# ----------------------------
AC_ARG_WITH(scalapack,
[AS_HELP_STRING([--with-scalapack],
[use scalapack if available (default: yes)])],
[if test "$withval" = "yes" ; then
with_scalapack=1
else
with_scalapack=0
fi],
[with_scalapack=1])
AC_ARG_WITH(internal-blas,
[AS_HELP_STRING([--with-internal-blas],
[compile with internal blas (default: no)])],
[if test "$withval" = "yes" ; then
use_internal_blas=1
else
use_internal_blas=0
fi],
[use_internal_blas=0])
AC_ARG_WITH(internal-lapack,
[AS_HELP_STRING([--with-internal-lapack],
[compile with internal lapack (default: no)])],
[if test "$withval" = "yes" ; then
use_internal_lapack=1
else
use_internal_lapack=0
fi],
[use_internal_lapack=0])
# -----------------------------
# more options
# ----------------------------
AC_ARG_ENABLE(environment,
[AS_HELP_STRING([--enable-environment],
[compile solvent-related stuff (default: no)])],
[if test "$enableval" = "yes" ; then
enable_environment=1
else
enable_environment=0
fi],
[enable_environment=0])
# store variables from the environment, if set (may be or not be set)
# If set, they take precedence over configure internal choice.
# Flags and libraries are accepted without further testing;
# compilers are tested. Specify compiler name only, not the full path
# (i.e. F90=/usr/local/bin/f90 may not work, use F90=f90)
topdir=$TOPDIR # current directory
arch=$ARCH # see below for recognized architectures
env_cc=$CC # C compiler (must be in the execution path)
cpp=$CPP # C preprocessor (as above)
cflags=$CFLAGS # Flags for C compiler
cppflags=$CPPFLAGS # Flags for C preprocessor
dflags=$DFLAGS # Fortran file preprocessing options, e.g. -D__DEFINE_THIS
iflags=$IFLAGS # Location of include files - shouldn't be needed
f77=$F77 # Fortran 77 serial compiler (must be in execution path)
f90=$F90 # Fortran 90 serial compiler (must be in execution path)
mpif90=$MPIF90 # Fortran 90 parallel compiler (must be in execution path)
fflags=$FFLAGS # Flags for Fortran 77 and 90 compilers
fflags_nomain=$FFLAGS_NOMAIN # Flags for linking Fortran sources with main in a different language
fflags_noopt=$FFLAGS_NOOPT # as FFLAGS With optimization disabled
f90flags=$F90FLAGS # Flags for Fortran 90 compiler only
ld=$LD # Loader (must be in the execution path)
ldflags=$LDFLAGS # Flags for loader
ld_libs=$LD_LIBS # Additional libraries
blas_libs=$BLAS_LIBS # blas library - specify e.g. /my/blas/lib/libmyblas.a
# or -L/my/blas/lib -lmyblas
lapack_libs=$LAPACK_LIBS # lapack library, similar to above
fft_libs=$FFT_LIBS # FFT libraries - may depend upon DFLAGS
mpi_libs=$MPI_LIBS # MPI libraries - shouldn't be needed
mass_libs=$MASS_LIBS # MASS libraries (IBM only)
libdirs=$LIBDIRS # Where to look for libraries (e.g. /my/blas/lib)
scalapack_libs=$SCALAPACK_LIBS # scalapack libs
scalapack_dir=$SCALAPACK_LIB # Where to look for scalapack libs
blacs_dir=$BLACS_LIB # Where to look for libblacs.a
ar=$AR # ar (shouldn't be needed)
arflags=$ARFLAGS # Flags for ar (as above)
extlib_flags=$EXTLIB_FLAGS # Flags for internal copies of lapack and blas
# configure for current directory by default
if test "$topdir" = "" ; then topdir="`pwd`" ; fi
# check system type (no cross-compilation for now)
AC_CANONICAL_BUILD
# many HPC systems are configured so that running parallel programs
# interactively is disabled: on those systems, AC_PROG_FC / _F77 / _CC
# would fail because they can't run the compiled executables.
# to work around that, let's pretend we are cross-compiling even if we aren't
# !!! this relies on undocumented Autoconf behavior !!!
# This is used to distinguish between true and fake cross compilation
# (only on NEC SX8 actually)
if test "$host" != "" ; then ranlib=echo; fi
cross_compiling=yes
if test "$host" = "" ; then host=$build; fi
# identify architecture
if test "$arch" = ""
then
case $host in
ia64-*-linux-gnu ) arch=ia64 ;;
x86_64-*-linux-gnu ) arch=x86_64 ;;
*-pc-linux-gnu ) arch=ia32 ;;
*-ibm-aix* ) arch=aix ;;
sparc-sun-* ) arch=sparc ;;
i386-pc-solaris* ) arch=solaris;;
i686-apple-darwin* ) arch=mac686 ;;
*-pc-cygwin ) arch=cygwin ;;
sx*-nec* ) arch=necsx ;;
powerpc64-*-linux-gnu ) arch=ppc64 ;;
* ) AC_MSG_WARN(incorrect host name ?)
;;
esac
# workaround for Cray-XT machines
test -d /proc/cray_xt && arch=crayxt
# workaround for IBM BG machines
test -d /bgsys && arch=ppc64-bg
fi
echo checking architecture... $arch
# candidate archiver and archiver flags
try_ar="ar"
try_arflags="ruv"
try_iflags="-I../include"
# candidate fortran compilers good for all cases
try_mpif90="mpif90"
try_f90="gfortran g95 f90"
# add all needed -D options to try_dflags
try_dflags=""
# candidate compilers and flags based on architecture
case $arch in
ia32 | ia64 | x86_64 )
try_f90="ifort pgf90 pathf95 sunf95 openf95 $try_f90"
;;
solaris )
try_f90="sunf95 $try_f90"
;;
aix )
try_mpif90="mpxlf90_r mpxlf90"
try_f90="xlf90_r xlf90 $try_f90"
try_arflags="-X64 ruv"
try_dflags="-D__AIX -D__XLF"
;;
crayxt* )
try_f90="ftn"
try_mpif90="ftn"
;;
mac686 | cygwin )
try_f90="ifort $try_f90"
;;
necsx )
sxopt=`echo $host|awk '{print substr($1,1,3)}'`
echo $sxopt $host
try_mpif90="sxmpif90"
try_f90="sxf90"
try_ar="sxar"
try_arflags="rv"
try_dflags='-D__SX6 '
use_fft_asl=0
use_fft_mathkeisan=1
use_fft_para=0
# default for Nec: no parallel unless explicitly required
if test "$set_use_parallel" -ne 1 ; then use_parallel=0 ; fi
if test "$use_parallel" -eq 1 ; then use_fft_para=1 ; fi
try_dflags_fft_asl='-DASL'
try_dflags_fft_mathkeisan=' '
try_dflags_fft_para='-D__USE_3D_FFT'
;;
ppc64 )
try_mpif90="mpxlf90_r mpf90_r mpif90"
try_f90="xlf90_r $try_f90"
try_dflags="-D__XLF"
try_arflags="ruv"
;;
# PowerPC MareNostrum
ppc64-mn )
try_f90="xlf90_r"
try_dflags="-D__XLF"
try_arflags="ruv"
;;
# IBM BlueGene
ppc64-bg )
if test "$use_openmp" -eq 0 ; then
try_mpif90="mpixlf90"
try_f90="bgxlf90"
else
try_mpif90="mpixlf90_r"
try_f90="bgxlf90_r"
fi
try_arflags="ruv"
try_dflags="-D__AIX -D__XLF"
;;
* )
AC_MSG_WARN($arch : unsupported architecture?)
;;
esac
if test "$enable_environment" -eq 1 ;
then
try_dflags="$try_dflags -D__ENVIRONMENT"
fi
# check serial Fortran 90 compiler. This must be done before performing
# the check for the parallel compiler (section below) because option
# --disable-parallel will do very strange things otherwise. The reason
# seems to be that autoconf does not repeat all tests for the second
# occurrence of AC_PROG_FC. So the first occurrence is the one that
# must always be performed, the second is optional. PG & CC sep.2006
# use F90 if set
if test "$f90" = "" ; then f90="$try_f90" ; fi
AC_PROG_FC($f90)
f90=$FC
AC_FC_SRCEXT(f90)
# check parallel Fortran 90 compiler
if test "$use_parallel" -eq 0 ;
then
mpif90=$f90
else
# clear cached values (not sure when and why this is needed)
unset FC ac_cv_prog_ac_ct_FC ac_cv_fc_compiler_gnu ac_cv_prog_fc_g
if test "$mpif90" = "" ; then
mpif90="$try_mpif90 $f90"
AC_PROG_FC($mpif90)
else
AC_PROG_FC($mpif90)
# this avoids that an empty MPIF90 field is produced if the corresponding
# environment variable MPIF90 does not contain an acceptable compiler
if test "$FC" = "" ; then
AC_MSG_WARN([MPIF90 not found: using MPIF90 anyway])
FC=$MPIF90
fi
fi
mpif90=$FC
fi
# check which compiler does mpif90 wrap
case "$arch" in
ia32 | ia64 | x86_64 | mac686 )
echo $ECHO_N "checking version of $mpif90... $ECHO_C"
ifort_version=`$mpif90 -V 2>&1 | grep "Intel(R)"`
sunf95_version=`$mpif90 -V 2>&1 | grep "^sunf95"`
openf95_version=`$mpif90 -V 2>&1 | grep "^Open64"`
pgf_version=`$mpif90 -V 2>&1 | grep "^pgf"`
g95_version=`$mpif90 -v 2>&1 | grep "g95"`
eko_version=`$mpif90 -v 2>&1 | grep "EKOPath"` # obsolescent
pathf95_version=`$mpif90 -v 2>&1 | grep "PathScale(TM)"`
gfortran_version=`$mpif90 -v 2>&1 | grep "gcc version"`
#
if test "$ifort_version" != ""
then
version=`$mpif90 -V 2>&1 | grep Version |
sed 's/.*Version//' | awk '{print $1}'`
ifort_version=`echo $version | sed 's/\..*//'`
echo "${ECHO_T}ifort $version"
f90_in_mpif90="ifort"
if test "$ifort_version" -gt 8; then
# flags for MKL - ifort 9 and later
MKL_LIBS=""
if test "$ifort_version" -gt 9; then
MKL_FLAGS="-static-intel"
else
MKL_FLAGS="-i-static"
fi
else
# flags for MKL - ifort 8 and earlier, obsolescent
MKL_LIBS="-lguide -lpthread"
MKL_FLAGS=""
fi
elif test "$sunf95_version" != ""
then
version=`echo $sunf95_version | awk '{print $5}'`
echo "${ECHO_T}sunf95 $version"
f90_in_mpif90="sunf95"
elif test "$openf95_version" != ""
then
version=`echo $openf95_version | awk '{print $5}'`
echo "${ECHO_T}openf95 $version"
f90_in_mpif90="openf95"
elif test "$pgf_version" != ""
then
version=`echo $pgf_version | awk '{print $2}'`
echo "${ECHO_T}pgf90 $version"
f90_in_mpif90="pgf90"
elif test "$eko_version" != ""
then
# obsolescent
version=`echo $eko_version | awk '{print $6}'`
echo "${ECHO_T}pathf95 $version"
f90_in_mpif90="pathf95"
elif test "$g95_version" != ""
then
version=`echo $g95_version | awk '{print $3}'`
echo "${ECHO_T}g95 $version"
f90_in_mpif90="g95"
elif test "$pathf95_version" != ""
then
version=`echo $pathf95_version | awk '{print $5}'`
echo "${ECHO_T}pathf95 $version"
f90_in_mpif90="pathf95"
elif test "$gfortran_version" != ""
then
version=`echo $gfortran_version | awk '{print $3}'`
echo "${ECHO_T}gfortran $version"
f90_in_mpif90="gfortran"
else
echo "${ECHO_T}unknown, assuming gfortran"
f90_in_mpif90="gfortran"
fi
# check if serial and parallel compiler are the same
if test "$f90" != "$f90_in_mpif90"; then
AC_MSG_WARN([parallel compiler $mpif90 uses $f90_in_mpif90, but serial compiler $f90 was detected])
AC_MSG_WARN([assuming F90=$f90_in_mpif90, discarding $f90])
fi
f90=$f90_in_mpif90
;;
esac
echo setting F90... $f90
echo setting MPIF90... $mpif90
case "$f90" in
f90 | fc | ftn )
echo $ECHO_N "checking version wrapped by $f90 command... $ECHO_C"
if $f90 -V 2>&1 | grep -q "Intel(R)" ; then
f90_version=ifort
elif $f90 -V 2>&1 | grep -q "^sunf95" ; then
f90_version=sunf95
elif $f90 -V 2>&1 | grep -q "^Open64" ; then
f90_version=openf95
elif $f90 -V 2>&1 | grep -q "^pgf" ; then
f90_version=pgf
elif $f90 -v 2>&1 | grep -q "EKOPath" ; then # obsolescent
f90_version=pathf95
elif $f90 -v 2>&1 | grep -q "g95" ; then
f90_version=g95
elif $f90 -version 2>&1 | grep -q "PathScale(TM)" ; then
f90_version=pathf95
elif $f90 -v 2>&1 | grep -q "gcc version" ; then
f90_version=gfortran
else
echo $ECHO_N "unknown, leaving as... $ECHO_C"
f90_version=$f90
fi
echo $f90_version
;;
* )
f90_version=$f90
;;
esac
# candidate C and f77 compilers good for all cases
try_cc="cc gcc"
try_f77="$f90"
case "$arch:$f90_version" in
*:ifort* )
try_cc="icc ecc $try_cc"
;;
*:pgf90 )
try_cc="pgcc $try_cc"
try_f77="pgf77 $f90"
;;
*:pathf95 )
try_cc="pathcc $try_cc"
;;
*:sunf95 )
try_cc="suncc $try_cc"
;;
*:openf95 )
try_cc="opencc $try_cc"
;;
aix:*xlf*_r )
try_cc="xlc_r $try_cc"
try_f77="xlf_r $f90"
;;
aix:*xlf* )
try_cc="xlc $try_cc"
try_f77="xlf $f90"
;;
sparc:* | solaris:sunf95 )
try_f77="f77 $f90"
;;
cray*:* )
try_cc="cc"
;;
necsx:* )
try_cc="sxcc"
;;
ppc64-bg:*xlf90_r )
try_cc="bgxlc_r"
try_f77="bgxlf_r"
;;
ppc64-bg:*xlf90 )
try_cc="bgxlc"
try_f77="bgxlf"
;;
ppc64:*xlf* | ppc64-mn:*xlf* )
try_cc="xlc_r $try_cc"
try_f77="xlf_r $f90"
;;
esac
# check serial C compiler
if test "$env_cc" = "" ; then cc="$try_cc" ; else cc="$env_cc"; fi
AC_PROG_CC($cc)
cc=$CC
echo setting CC... $cc
# check size of pointers to int - needed to decide the size of integer
# arrays in fortran holding C pointers for FFTW
AC_CHECK_SIZEOF([int *])
SIZEOF_INT_P=$ac_cv_sizeof_int_p
AC_SUBST(SIZEOF_INT_P)
AC_CONFIG_FILES([include/fft_defs.h:include/fft_defs.h.in])
# check if the structure mallinfo is present in malloc.h
AC_CHECK_HEADER(malloc.h,have_malloc_h=1,have_malloc_h=0, )
if test "$have_malloc_h" -ne 0
then
AC_CHECK_MEMBER([struct mallinfo.arena],
[AC_DEFINE(HAVE_MALLINFO)],
,
[#include <malloc.h>])
fi
# check serial Fortran 77 compiler (use F77 if it was set)
if test "$f77" = "" ; then f77="$try_f77" ; fi
AC_PROG_F77($f77)
f77=$F77
echo setting F77... $f77
# check Fortran compiler flags
# have_cpp=0: use external C preprocessing for fortran code
# have_cpp=1: use C-like preprocessing in fortran compiler
have_cpp=1
xlf_flags=0
echo using F90... $f90
case "$arch:$f90_version" in
ia32:ifort* | ia64:ifort* | x86_64:ifort* | mac686:ifort* )
try_fflags="-O2 -assume byterecl -g -traceback -par-report0 -vec-report0"
if test "$use_debug" -eq 1; then
try_fflags="$try_fflags -fpe0 -CB"
fi
try_fflags_nomain="-nofor_main"
try_fflags_openmp="-openmp"
try_f90flags="\$(FFLAGS) -nomodule"
try_fflags_noopt="-O0 -assume byterecl -g -traceback"
try_ldflags=""
try_ldflags_static="-static"
try_ldflags_openmp="-openmp"
try_dflags="$try_dflags -D__INTEL"
pre_fdflags="-fpp "
;;
ia32:pgf* | ia64:pgf* | x86_64:pgf* )
# in try_fflags we use -O3 instead of -fast because some *.f files in Multigrid
# confuse the optimizer when option -fast is enabled
try_fflags_nomain="-Mnomain"
try_fflags="-O3 -r8"
try_fflags_openmp="-mp"
try_f90flags="-fast -Mcache_align -r8"
try_fflags_noopt="-O0"
try_ldflags=""
try_ldflags_openmp="-mp"
try_ldflags_static="-Bstatic"
try_dflags="$try_dflags -D__PGI"
have_cpp=0
;;
ia32:path* | ia64:path* | x86_64:path* )
try_fflags="-march=auto -O2"
try_f90flags="\$(FFLAGS)"
try_fflags_noopt="-O0"
try_ldflags=""
try_ldflags_static="-static"
have_cpp=0
;;
*:g95 )
if test "$use_debug" -eq 1; then
try_fflags="-O3 -g -freal=nan -finteger=12345678 -flogical=none -cpp"
else
try_fflags="-O3 -cpp"
fi
try_f90flags="\$(FFLAGS)"
try_fflags_noopt="-O0 -cpp"
try_ldflags=""
try_ldflags_static="-static"
;;
*:gfortran )
if test "$use_debug" -eq 1; then
try_fflags="-O3 -g -Wall -fbounds-check -frange-check"
else
try_fflags="-O3 -g"
fi
try_fflags_openmp="-fopenmp"
try_f90flags="\$(FFLAGS) -x f95-cpp-input"
try_fflags_noopt="-O0 -g"
try_ldflags="-g"
try_dflags="$try_dflags -D__GFORTRAN -D__STD_F95"
try_ldflags_static="-static"
;;
*:sunf95 )
try_fflags="-O4"
try_fflags_openmp="-openmp"
try_f90flags="\$(FFLAGS) -fpp"
try_fflags_noopt="-O0"
try_ldflags="-fast"
try_ldflags_static="-Bstatic"
imod="-M"
;;
*:openf95 )
try_fflags="-O3"
try_f90flags="\$(FFLAGS) -ftpp"
try_fflags_noopt="-O0"
try_ldflags=""
imod="-I"
;;
aix:*xlf* )
if test "$use_debug" -eq 1; then
try_fflags="-q64 -qalias=noaryovrlp -g -C \
-qarch=auto -qtune=auto -qdpc -Q -qalias=nointptr"
else
try_fflags="-q64 -qalias=noaryovrlp -O3 -qstrict \
-qarch=auto -qtune=auto -qdpc -Q -qalias=nointptr"
fi
try_fflags_openmp="-qsmp=omp"
try_f90flags="\$(FFLAGS) -qsuffix=cpp=f90 -qfree=f90"
try_fflags_noopt="-q64 -O0"
try_ldflags="-q64"
try_ldflags_openmp="-qsmp=omp"
# try_ldflags_static="-bstatic"
pre_fdflags="-WF,"
xlf_flags=1
;;
solaris:sunf95 )
try_fflags="-fast -O2 -fpp"
try_f90flags="\$(FFLAGS)"
try_fflags_noopt="-O0 "
try_ldflags=""
imod="-M"
;;
sparc:f90 )
try_fflags="-fast -O1 -nodepend -xvector=no -xchip=ultra3 \
-xarch=v8plusb -xlic_lib=sunperf"
try_f90flags="\$(FFLAGS)"
try_fflags_noopt="-O0 -xlic_lib=sunperf"
try_ldflags=""
imod="-M"
have_cpp=0
;;
crayxt*:pgf* )
# see comment above for pgf*
try_fflags_nomain="-Mnomain"
try_fflags_openmp="-mp"
try_fflags="-O3 -r8"
try_f90flags="-fast -Mcache_align -r8 -Mpreprocess"
try_fflags_noopt="-O0"
try_ldflags_openmp="-mp"
try_ldflags="-v"
try_dflags="$try_dflags -D__PGI"
have_cpp=1
;;
crayxt*:pathf* )
try_fflags="-march=auto -O2 -cpp"
try_f90flags="\$(FFLAGS)"
try_fflags_noopt="-O0"
try_ldflags=""
try_ldflags_static="-static"
have_cpp=1
;;
necsx:* )
try_fflags=' -float0 -Cvopt -eab -R5 -Wf,-Ncont,-A dbl4,-P nh,-ptr byte,-pvctl noifopt loopcnt=9999999 expand=12 fullmsg vwork=stack,-fusion,-O noif,-init stack=nan heap=nan'
try_f90flags=' -f2003 -float0 -Cvopt -eab -R5 -Wf,-Ncont,-A dbl4,-P nh,-ptr byte,-pvctl noifopt loopcnt=9999999 expand=12 fullmsg vwork=stack,-fusion,-O noif,-init stack=nan heap=nan'
try_f90flags="-$sxopt $try_f90flags"
try_fflags_noopt='-float0 '
try_f90flags_noopt='-f2003 -float0 -eab -R5 -C debug -Wf,-Ncont,-A dbl4,-P nh ,ptr byte,-init stack=nan heap=nan'
try_f90flags_noopt="$try_f90flags_noopt"
try_f90flags_inline='-f2003 -float0 -Cvopt -eab -R5 -pi noauto incdir exp=w0gauss -Wf,-Ncont,-A dbl4,-P nh,-ptr byte,-pvctl noifopt loopcnt=9999999 expand=12 fullmsg vwork=stack,-fusion,-O noif,-init stack=nan heap=nan'
try_f90flags_inline="$try_f90flags_inline"
try_ldflags_static='-P static'
try_ldflags='-Wl,-f zero'
try_ldflags="-p $try_ldflags"
pre_fdflags=""
;;
ppc64:*xlf* )
if test "$use_debug" -eq 1; then
try_fflags="-g -C -qsuffix=cpp=f90 -qdpc -qalias=nointptr -Q"
else
try_fflags="-q64 -qthreaded -O4 -qsuffix=cpp=f90 -qdpc -qalias=nointptr -Q"
fi
try_f90flags="\$(FFLAGS) -qfree=f90"
try_fflags_noopt="-q64 -qthreaded -O0"
try_ldflags="-q64 -qthreaded"
pre_fdflags="-WF,"
xlf_flags=1
;;
ppc64-mn:*xlf* )
if test "$use_debug" -eq 1; then
try_fflags="-g -C -q64 -qstrict -qsuffix=cpp=f90 -qdpc -qalias=nointptr -Q -qtune=ppc970 -qarch=ppc970 -qcache=auto -qhot=vector,simd -qenablevmx"
else
try_fflags="-O3 -q64 -qstrict -qsuffix=cpp=f90 -qdpc -qalias=nointptr -Q -qtune=ppc970 -qarch=ppc970 -qcache=auto -qhot=vector,simd -qenablevmx"
fi
try_f90flags="\$(FFLAGS) -qfree=f90"
try_fflags_noopt="-O0 -q64"
try_ldflags=""
pre_fdflags="-WF,"
xlf_flags=1
;;
ppc64-bg:*xlf* )
if test "$use_debug" -eq 1; then
try_fflags="-q32 -qalias=noaryovrlp:nointptr -g -C -qdpc=e"
else
try_fflags="-q32 -qalias=noaryovrlp:nointptr -O3 -qstrict -qdpc=e"
fi
try_fflags_openmp="-qsmp=omp -qthreaded"
try_f90flags="\$(FFLAGS) -qsuffix=cpp=f90"
try_fflags_noopt="-q32 -O0"
try_ldflags="-q32"
try_ldflags_openmp="-qsmp -qthreaded"
pre_fdflags="-WF,"
xlf_flags=1
;;
* )
# unknown, try these
try_fflags="-O"
try_f90flags="\$(FFLAGS)"
try_fflags_noopt="-O0"
try_ldflags=""
have_cpp=0
;;
esac
if test "$use_shared" -eq 0 ; then
try_ldflags="$try_ldflags $try_ldflags_static" ; fi
if test "$use_openmp" -eq 1 ; then
try_f90flags="$try_f90flags $try_fflags_openmp"
try_fflags="$try_fflags $try_fflags_openmp"
try_ldflags="$try_ldflags $try_ldflags_openmp"
fi
if test "$fflags" = "" ; then fflags=$try_fflags ; fi
if test "$f90flags" = "" ; then f90flags=$try_f90flags ; fi
if test "$fflags_noopt" = "" ; then fflags_noopt=$try_fflags_noopt ; fi
if test "$fflags_nomain" = "" ; then fflags_nomain=$try_fflags_nomain ; fi
echo setting FFLAGS... $fflags
echo setting F90FLAGS... $f90flags
echo setting FFLAGS_NOOPT... $fflags_noopt
if test "$fflags_nomain" != "" ; then echo setting FFLAGS_NOMAIN... $fflags_nomain ; fi
if test "$imod" = "" ; then imod="-I" ; fi
# tentative C and loader flags, good for many cases
try_cflags="-O3"
c_ldflags=""
try_cpp="cpp"
case "$arch:$cc" in
*:pgcc )
try_cflags="-fast"
;;
# pathcc -E seems to give problems when preprocessing iotk
#*:pathcc )
# try_cpp="pathcc -E"
# ;;
aix:xlc* | aix:cc )
try_cflags="-q64 -O2"
c_ldflags="-q64"
;;
*:suncc )
try_cflags="-fast -O"
;;
sparc:cc )
try_cflags="-fast -dalign -xchip=ultra3 -xarch=v8plusb \
-xlic_lib=sunperf"
try_cpp="fpp"
;;
crayxt*:cc )
try_cflags="-fast"
;;
necsx:* )
#try_cflags="-D__SX6 \$(IFLAGS) \$(MODFLAGS)"
try_cflags=""
try_ar="sxar"
;;
ppc64-mn:* )
try_cflags="-O3 -q64"
;;
ppc64-bg:* )
try_cflags="-O3 -q32"
;;
ppc64:xlc*)
try_cflags="-O3 -q64 -qthreaded"
c_ldflags="-q64"
;;
esac
if test "$cflags" = "" ; then cflags=$try_cflags ; fi
echo setting CFLAGS... $cflags
# preprocessor - try cpp in all cases; the preprocessor returned by
# AC_PROG_CPP
# may sometimes refuse to preprocess fortran files
if test "$cpp" = "" ; then cpp=$try_cpp; fi
# if test "$cpp" = "" ; then cpp=$CPP; fi
echo setting CPP... $cpp
echo $ECHO_N "setting CPPFLAGS... $ECHO_C"
case $cpp in
cpp) try_cppflags="-P -traditional" ;;
fpp) try_cppflags="-P" ;;
*) try_cppflags="" ;;
esac
if test "$cppflags" = "" ; then cppflags=$try_cppflags ; fi
echo "${ECHO_T}$cppflags"
# linker and archiver
# note that from this point on, further additions to
# linker flags should be added to ldflags rather than try_ldflags
if test "$ld" = "" ; then ld="$mpif90" ; fi
if test "$ldflags" = "" ; then ldflags="$try_ldflags" ; fi
if test "$ar" = "" ; then ar="$try_ar" ; fi
if test "$arflags" = "" ; then arflags="$try_arflags" ; fi
echo setting LD... $ld
echo setting LDFLAGS... $ldflags
echo setting AR... $ar
echo setting ARFLAGS... $arflags
# compilation rules
AC_PROG_MAKE_SET
echo $ECHO_N "checking whether Fortran files must be preprocessed... $ECHO_C"
if test "$have_cpp" -ne 0
then
f90rule="\$(MPIF90) \$(F90FLAGS) -c \$<"
echo "${ECHO_T}no"
else
f90rule="\$(CPP) \$(CPPFLAGS) \$< -o \$*.F90 ; \\
\$(MPIF90) \$(F90FLAGS) -c \$*.F90 -o \$*.o"
echo "${ECHO_T}yes"
fi
# compilation flags for all subsequent tests
# remove all $(...) because at least one compiler doesn't like them
# but if f90flags contains $(FFLAGS), substitute it
test_cflags="`echo $cflags | sed 's/\$([[^)]]*)//g'`"
test_cppflags="$test_cflags"
if test "`echo $f90flags | grep '$(FFLAGS)'`" != ""
then
test_fflags="`echo $fflags $f90flags | sed 's/\$([[^)]]*)//g'`"
else
test_fflags="`echo $f90flags | sed 's/\$([[^)]]*)//g'`"
fi
test_ldflags="`echo $ldflags | sed 's/\$([[^)]]*)//g'`"
# find Fortran to C wrappers
if test "$check_wrappers" -ne 0; then
AC_F77_WRAPPERS
fi
AC_LANG_PUSH(Fortran 77)
F77=$f90 # use Fortran 90 actually
# Search for libraries
# Flags for needed libraries
have_blas=0
have_lapack=0
have_fft=0
have_mpi=0
have_scalapack=0
# Flags for machine-specific libraries
have_acml=0
have_atlas=0
have_essl=0
have_mkl=0
# check for blas
# supported vendor replacements:
# mkl and acml on Intel/AMD architectures
# essl on aix
# SUNperf on sparc
# atlas is used over blas if available
# internal version is used if none is found
if test "$use_internal_blas" -eq 0
then
if test "$blas_libs" = ""
then
# check directories in LD_LIBRARY_PATH too
# (maybe they are already searched by default, but I'm not sure)
ld_library_path=`echo $LD_LIBRARY_PATH | sed 's/:/ /g'`
case "$arch:$f90" in
x86_64:pgf* | x86_64:path* | x86_64:openf95 | crayxt*:* )
# check for acml - note that it contains lapack as well
try_libdirs="/opt/acml*/pathscale64/lib/"
try_libdirs="$ld_library_path $libdirs $try_libdirs"
for dir in none $try_libdirs
do
unset ac_cv_search_dgemm # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags $try_loption"
LIBS=""
if test "$use_openmp" -eq 0; then
AC_SEARCH_LIBS(dgemm, acml, have_blas=1 have_lapack=1
have_acml=1 blas_libs="$try_loption $LIBS")
else
AC_SEARCH_LIBS(dgemm, acml_mp, have_blas=1 have_lapack=1
have_acml=1 blas_libs="$try_loption $LIBS")
fi
if test "$ac_cv_search_dgemm" != "no"
then break ; fi
done
;;
ia64:* )
# check for mkl (in several directories)
try_libdirs="/opt/intel/Compiler/*/*/mkl/lib/64
/opt/intel/mkl/*/lib/64
/opt/intel/mkl*/lib/64"
try_libdirs="$libdirs $try_libdirs $ld_library_path"
for dir in none $try_libdirs
do
unset ac_cv_search_dgemm # clear cached value
if test "$dir" = "none"
then
try_loption=" "
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$MKL_FLAGS $test_ldflags $try_loption"
LIBS="$MKL_LIBS"
#
# should work for recent MKL versions only
#
if test "$use_openmp" -eq 0; then
AC_SEARCH_LIBS(dgemm, mkl_intel_ipf,
have_blas=1 have_mkl=1
blas_libs="$try_loption $LIBS -lmkl_sequential -lmkl_core"
ldflags="$MKL_FLAGS $ldflags",
echo "MKL not found",
-lmkl_sequential -lmkl_core)
else
AC_SEARCH_LIBS(dgemm, mkl_intel_ipf,
have_blas=1 have_mkl=1
blas_libs="$try_loption $LIBS -lmkl_intel_thread -lmkl_core"
ldflags="$MKL_FLAGS $ldflags",
echo "MKL not found",
-lmkl_intel_thread -lmkl_core)
fi
if test "$ac_cv_search_dgemm" != "no"
then break ; fi
done
;;
*:sunf95 )
# check for acml - note that it contains lapack as well
if test "$arch" = "x86_64"
then
try_libdirs="/usr/local/sunstudio*/lib/amd64/"
else
try_libdirs="/usr/local/sunstudio*/lib/"
fi
try_libdirs="$libdirs $ld_library_path $try_libdirs"
for dir in none $try_libdirs
do
unset ac_cv_search_dgemm # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags $try_loption"
LIBS=""
AC_SEARCH_LIBS(dgemm, sunperf, have_blas=1 have_lapack=1
blas_libs="$try_loption $LIBS")
if test "$ac_cv_search_dgemm" != "no"
then break ; fi
done
;;
x86_64:* )
try_libdirs="/opt/intel/Compiler/*/*/mkl/lib/em64t
/opt/intel/mkl/*/lib/em64t
/opt/intel/mkl*/lib/em64t"
try_libdirs="$libdirs $try_libdirs $ld_library_path"
for dir in none $try_libdirs
do
unset ac_cv_search_dgemm # clear cached value
if test "$dir" = "none"
then
try_loption=" "
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$MKL_FLAGS $test_ldflags $try_loption"
LIBS="$MKL_LIBS"
#
# should work for recent MKL versions only
#
if test "$use_openmp" -eq 0; then
AC_SEARCH_LIBS(dgemm, mkl_intel_lp64,
have_blas=1 have_mkl=1
blas_libs="$try_loption $LIBS -lmkl_sequential -lmkl_core"
ldflags="$MKL_FLAGS $ldflags",
echo "MKL not found",
-lmkl_sequential -lmkl_core)
else
AC_SEARCH_LIBS(dgemm, mkl_intel_lp64,
have_blas=1 have_mkl=1
blas_libs="$try_loption $LIBS -lmkl_intel_thread -lmkl_core"
ldflags="$MKL_FLAGS $ldflags",
echo "MKL not found",
-lmkl_intel_thread -lmkl_core)
fi
if test "$ac_cv_search_dgemm" != "no"
then break ; fi
done
;;
ia32:* )
# check for mkl (in several directories)
try_libdirs="/opt/intel/Compiler/*/*/mkl/lib/32
/opt/intel/mkl/*/lib/32
/opt/intel/mkl*/lib/32"
try_libdirs="$libdirs $try_libdirs $ld_library_path"
for dir in none $try_libdirs
do
unset ac_cv_search_dgemm # clear cached value
if test "$dir" = "none"
then
try_loption="-L "
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$MKL_FLAGS $test_ldflags $try_loption"
LIBS="$MKL_LIBS"
#
# should work for recent MKL versions only
#
if test "$use_openmp" -eq 0; then
AC_SEARCH_LIBS(dgemm, mkl_intel,
have_blas=1 have_mkl=1
blas_libs="$try_loption $LIBS -lmkl_sequential -lmkl_core"
ldflags="$MKL_FLAGS $ldflags",
echo "MKL not found",
-lmkl_sequential -lmkl_core)
else
AC_SEARCH_LIBS(dgemm, mkl_intel,
have_blas=1 have_mkl=1
blas_libs="$try_loption $LIBS -lmkl_intel_thread -lmkl_core"
ldflags="$MKL_FLAGS $ldflags",
echo "MKL not found",
-lmkl_intel_thread -lmkl_core)
fi
if test "$ac_cv_search_dgemm" != "no"
then break ; fi
done
;;
aix:* )
# check for essl
unset ac_cv_search_dgemm # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
LIBS=""
AC_SEARCH_LIBS(dgemm, essl, have_blas=1
blas_libs="$LIBS" )
# notice that some IBM machines may not need -lessl
# to load blas so the above test may fail
if test "`echo $blas_libs | grep essl`" != ""
then
have_essl=1
try_dflags="$try_dflags -D__ESSL"
fi
# we need esslsmp for hybrid (MPI+OpenMP) build
if test "$have_essl"="1"; then
if test "$use_openmp" -ne 0 ; then
blas_libs="-lesslsmp"
fi
fi
;;
sparc:* | solaris:* )
# check for SUNperf library
unset ac_cv_search_dgemm # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
LIBS=""
AC_SEARCH_LIBS(dgemm, sunperf, have_blas=1 have_lapack=1
blas_libs="-xlic_lib=sunperf $LIBS")
;;
necsx:* )
#sx5-nec or sx6-nec or sx8-nec: check in (/SX)/usr/lib
#sx8-nec-idris: check in /SX/opt/mathkeisan/inst/lib0
try_libdirs="/SX/usr/lib /SX/opt/mathkeisan/inst/lib0"
for dir in none $try_libdirs
do
unset ac_cv_search_dgemm # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags $try_loption"
LIBS=""
AC_SEARCH_LIBS(dgemm, blas, have_blas=1
blas_libs="$try_loption $LIBS")
if test "$ac_cv_search_dgemm" != "no"
then break ; fi
done
;;
ppc64:* )
# check for essl
unset ac_cv_search_dgemm # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
LIBS=""
AC_SEARCH_LIBS(dgemm, essl, have_blas=1
blas_libs="$LIBS" )
# notice that some IBM machines may not need -lessl
# to load blas so the above test may fail
if test "`echo $blas_libs | grep essl`" != ""
then
have_essl=1
try_dflags="$try_dflags -D__LINUX_ESSL"
fi
# OBM:Yet another work-around if the above search
# returns "none required"
if test "$ac_cv_search_dgemm" == "none required"
then
echo "There is no need for -lessl in this machine"
have_essl=1
try_dflags="$try_dflags -D__LINUX_ESSL"
fi
# we need esslsmp for hybrid (MPI+OpenMP) build
if test "$have_essl"="1"; then
if test "$use_openmp" -ne 0 ; then
blas_libs="-lesslsmp"
fi
fi
;;
ppc64-*:* )
# assume essl
unset ac_cv_search_dgemm # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
have_blas=1
have_essl=1
# BlueGene: for some obscure reason there is no need to
# specify a library path to have essl linked, while
# in reality it is needed to specify where essl are
if test "$arch"="ppc64-bg"; then
try_dflags="$try_dflags -D__ESSL"
if test "$blas_libs"=""; then
if test "$use_openmp" -eq 0 ; then
blas_libs="-L/opt/ibmmath/essl/4.4/lib/ -lesslbg"
else
blas_libs="-L/opt/ibmmath/essl/4.4/lib/ -lesslsmpbg"
fi
fi
else
try_dflags="$try_dflags -D__LINUX_ESSL"
fi
;;
mac686:ifort* )
#This solution is tested with MacOs 10.6 and Intel 11.1
try_libdirs="/Developer/opt/intel/Compiler/*/*/Frameworks/mkl/lib/universal
/opt/intel/Compiler/*/*/Frameworks/mkl/lib/universal
/opt/intel/mkl*/lib/em64t"
try_libdirs="$libdirs $try_libdirs $ld_library_path"
for dir in none $try_libdirs
do
unset ac_cv_search_dgemm # clear cached value
if test "$dir" = "none"
then
try_loption=""
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$MKL_FLAGS $test_ldflags $try_loption"
LIBS="$MKL_LIBS"
# First, a by-the-apple-book search of MKL... >10.2 requires multiple libraries
# 64 bit is buggy as of 11.1.088
if test "$use_openmp" -eq 0; then
AC_SEARCH_LIBS(dgemm, mkl_intel,
have_blas=1 have_mkl=1
blas_libs="$try_loption $LIBS -lmkl_sequential -lmkl_core -lpthread"
ldflags="$MKL_FLAGS $ldflags",
echo "MKL not found",
-lmkl_sequential -lmkl_core -lpthread)
else
AC_SEARCH_LIBS(dgemm, mkl_intel,
have_blas=1 have_mkl=1
blas_libs="$try_loption $LIBS -lmkl_intel_thread -lmkl_core -openmp -lpthread"
ldflags="$MKL_FLAGS $ldflags",
echo "MKL not found",
-lmkl_intel_thread -lmkl_core -openmp -lpthread)
fi
# 32 bit
if test "$ac_cv_search_dgemm" != "no"
then break ; fi
done
;;
esac
# blas not (yet) found: look for more possibilities
if test "$have_blas" -eq 0
then
case "$f90" in
pgf* )
# check for PGI blas
unset ac_cv_search_dgemm # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
LIBS=""
AC_SEARCH_LIBS(dgemm, blas, have_blas=1 blas_libs="$LIBS")
;;
esac
fi
if test "$have_blas" -eq 0
then
# check for atlas (in several directories)
try_libdirs="/usr/local/lib"
try_libdirs="$libdirs $try_libdirs $ld_library_path"
for dir in none $try_libdirs
do
unset ac_cv_search_dgemm # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags $try_loption"
LIBS="-latlas"
AC_SEARCH_LIBS(dgemm, f77blas, have_blas=1 have_atlas=1
blas_libs="$try_loption $LIBS", , -lg2c)
if test "$ac_cv_search_dgemm" != "no"
then break ; fi
done
fi
# blas still not found
if test "$have_blas" -eq 0
then
# check for blas (in several directories)
try_libdirs="/usr/local/lib"
try_libdirs="$libdirs $try_libdirs $ld_library_path"
for dir in none $try_libdirs
do
unset ac_cv_search_dgemm # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags $try_loption"
LIBS=""
AC_SEARCH_LIBS(dgemm, blas-3 blas, have_blas=1
blas_libs="$try_loption $LIBS")
if test "$ac_cv_search_dgemm" != "no"
then break ; fi
done
fi
else
# blas provided in BLAS_LIBS - not checked!
have_blas=1
fi
fi
# check for lapack
#
# same supported vendor replacements as for blas
# internal version is used if none is found
if test "$use_internal_lapack" -eq 0
then
if test "$lapack_libs" = ""
then
# check directories in LD_LIBRARY_PATH too
# (maybe they are already searched by default, but I'm not sure)
ld_library_path=`echo $LD_LIBRARY_PATH | sed 's/:/ /g'`
case "$arch:$f90" in
ia32:* | ia64:*| x86_64:* )
# check for mkl_lapack (if mkl found and acml not found)
# OBSOLESCENT - recent versions of mkl contain lapack
if test "$have_mkl" -ne 0 && test "$have_acml" -eq 0
then
unset ac_cv_search_dspev ac_lib # clear cached value
FFLAGS="$test_fflags"
LIBS=" $blas_libs"
LDFLAGS="$MKL_FLAGS $test_ldflags"
AC_SEARCH_LIBS(dspev, mkl_lapack, have_lapack=1)
if test "$ac_lib" != "" ; then lapack_libs="-l$ac_lib"; fi
fi
;;
sparc:* )
# check for SUNperf library
unset ac_cv_search_dspev # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
LIBS="$blas_libs"
AC_SEARCH_LIBS(dspev, sunperf, have_lapack=1
lapack_libs="-xlic_lib=sunperf $LIBS")
;;
aix:* )
# check for essl
unset ac_cv_search_dspev # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
LIBS="$blas_libs"
AC_SEARCH_LIBS(dspev, essl, have_lapack=1
lapack_libs="$try_loption $LIBS"
try_dflags="$try_dflags -D__ESSL")
# essl may not have been found in previous test on blas
if test "$have_lapack" -eq 1; then have_essl=1; fi
;;
ppc64:* )
# check for essl
unset ac_cv_search_dspev # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
LIBS="$blas_libs"
AC_SEARCH_LIBS(dspev, essl, have_lapack=1
lapack_libs="$try_loption $LIBS"
try_dflags="$try_dflags -D__LINUX_ESSL")
# essl may not have been found in previous test on blas
if test "$have_lapack" -eq 1; then have_essl=1; fi
;;
necsx:* )
#sx5-nec or sx6-nec or sx8-nec: check in (/SX)/usr/lib
#sx8-nec-idris: check in /SX/opt/mathkeisan/inst/lib0
try_libdirs="/SX/usr/lib /SX/opt/mathkeisan/inst/lib0"
for dir in none $try_libdirs
do
unset ac_cv_search_dspev # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags $try_loption $blas_libs"
LIBS=""
AC_SEARCH_LIBS(dspev, lapack, have_lapack=1
lapack_libs="$try_loption $LIBS")
if test "$ac_cv_search_dspev" != "no"
then break ; fi
done
;;
esac
if test "$have_lapack" -eq 0
then
# check for lapack (in several directories)
try_libdirs="/usr/local/lib"
try_libdirs="$libdirs $try_libdirs $ld_library_path"
for dir in none $try_libdirs
do
unset ac_cv_search_dspev # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags $try_loption"
LIBS="$blas_libs"
AC_SEARCH_LIBS(dspev, lapack-3 lapack, have_lapack=1
lapack_libs="$try_loption $LIBS")
if test "$ac_cv_search_dspev" != "no"; then
# essl must precede lapack (if present)
if test "$have_essl" -ne 0 ; then
lapack_libs="$blas_libs $lapack_libs"
fi
break
fi
done
fi
else
# lapack provided in LAPACK_LIBS - not checked!
have_lapack=1
fi
fi
# no blas library found, or internal blas required: use the built-in blas
# (blas_libs is used in the above lapack tests: do not move the following
# settings above lapack tests, which would seem a more logical place)
if test "$have_blas" -eq 0 -o "$use_internal_blas" -eq 1 ; then
blas_libs="$topdir/BLAS/blas.a"
blas_libs_switch="internal"
else
blas_libs_switch="external"
fi
# no lapack library found, or incomplete lapack found (atlas, essl),
# or internal lapack esplicitly required
if test "$have_lapack" -eq 0 -o "$use_internal_lapack" -eq 1 ; then
lapack_libs="$topdir/lapack-3.2/lapack.a"
lapack_libs_switch="internal"
else
if test "$have_essl" -eq 1 -o "$have_atlas" -eq 1 ; then
# IBM essl or atlas: add missing lapack routines - must be loaded after lib
# atlas: add missing lapack routines so as to complete atlas
# note that some compilers do not like to have multiple symbols
lapack_libs="$lapack_libs $topdir/lapack-3.2/lapack.a"
lapack_libs_switch="internal"
else
lapack_libs_switch="external"
fi
fi
echo setting BLAS_LIBS... $blas_libs
echo setting LAPACK_LIBS... $lapack_libs
# check for FFT libraries (no check for explicit openmp)
# supported vendor replacements:
# essl on aix and some IBM linux machines
# SUNperf on sparc
# ASL/Mathkeisan on Nec
# acml on amd
if test "$fft_libs" = "" && test "$use_openmp" -eq 0
then
# check directories in LD_LIBRARY_PATH too
# (maybe they are already searched by default, but I'm not sure)
ld_library_path=`echo $LD_LIBRARY_PATH | sed 's/:/ /g'`
case "$arch" in
aix )
# check for essl
unset ac_cv_search_dcft # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
LIBS="$fft_libs"
AC_SEARCH_LIBS(dcft, essl, have_fft=1 fft_libs="$LIBS")
;;
ppc64 | ppc64-mn )
# check for essl
unset ac_cv_search_dcft # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
LIBS="$fft_libs"
AC_SEARCH_LIBS(dcft, essl, have_fft=1 fft_libs="$LIBS")
;;
ppc64-bg )
# check for esslbg
unset ac_cv_search_dcft # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
LIBS="$fft_libs $blas_libs"
AC_SEARCH_LIBS(dcft, esslbg, have_fft=1 fft_libs="$LIBS")
;;
sparc )
# check for SUNperf FFT library on Sun Sparcs
# but not on solaris PC! it is slower than FFTW
unset ac_cv_search_zfft3i # clear cached value
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
LIBS="$libs"
AC_SEARCH_LIBS(zfft3i, sunperf, have_fft=1
try_dflags="$try_dflags -D__SUNPERF"
fft_libs="-xlic_lib=sunperf $LIBS")
;;
necsx )
if test "$use_fft_mathkeisan" -ne 0
then
#sx5-nec or sx6-nec or sx8-nec: check in (/SX)/usr/lib
#sx8-nec-idris: check in /SX/opt/mathkeisan/inst/lib0
try_libdirs="/SX/usr/lib /SX/opt/mathkeisan/inst/lib0"
#check for Mathkeisan (Cray simple precision )
#search for initialization subroutine
echo $ECHO_N "Searching in Mathkeisan" $ECHO_C
for dir in none $try_libdirs
do
unset ac_cv_search_zftfax # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags $try_loption"
LIBS=""
AC_SEARCH_LIBS(zftfax, fft, have_fft=1
try_dflags="$try_dflags try_dflags_fft_mathkeisan"
fft_libs="$try_loption $LIBS")
if test "$ac_cv_search_zftfax" != "no"
then break ; fi
done
fi
if test "$use_fft_asl" -ne 0
then
#check for asl in (/SX)/usr/lib
try_libdirs="/SX/usr/lib"
#search for initialization subroutine
echo $ECHO_N "Searching in Asl" $ECHO_C
for dir in none $try_libdirs
do
unset ac_cv_search_zfc3cl # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags $try_loption"
LIBS=""
AC_SEARCH_LIBS(zfc3cl, asl, have_fft=1
asl_libs="$try_loption $LIBS"
try_dflags="$try_dflags $try_dflags_fft_asl"
fft_libs="$fft_libs $asl_libs")
if test "$ac_cv_search_zfc3cl" != "no"
then break ; fi
done
fi
if test "$use_fft_para" -ne 0
then
try_dflags="$try_dflags $try_dflags_fft_para"
fi
;;
esac
fi
if test "$have_fft" -eq 0 && test "$use_openmp" -eq 0
then
# check for fftw v.3 (in several directories)
try_libdirs="/usr/local/lib"
try_libdirs="$libdirs $try_libdirs $ld_library_path"
for dir in none $try_libdirs
do
unset ac_cv_search_dfftw_execute_dft # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
CFLAGS="$test_cflags"
CPPFLAGS="$test_cppflags"
LDFLAGS="$c_ldflags $try_loption"
LIBS="$fft_libs"
AC_SEARCH_LIBS(dfftw_execute_dft, fftw3, have_fft=1
fft_libs="$try_loption $LIBS", , -lm)
if test "$ac_cv_search_dfftw_execute_dft" != "no"
then
try_dflags="$try_dflags -D__FFTW3"
break
fi
done
fi
echo setting FFT_LIBS... $fft_libs
# if no valid FFT library was found, use the local copy
if test "$have_fft" -eq 0
then
try_dflags="$try_dflags -D__FFTW"
fi
F77=$f90
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags"
# check for mass on aix
if test "$mass_libs" = ""
then
# check directories in LD_LIBRARY_PATH too
# (maybe they are already searched by default, but I'm not sure)
ld_library_path=`echo $LD_LIBRARY_PATH | sed 's/:/ /g'`
case "$arch" in
aix | ppc64-bg )
# check for mass (in several directories)
try_libdirs="/opt/ibmcmp/xlmass/bg/4.4/bglib /cineca/lib /cineca/lib/mass"
try_libdirs="$libdirs $try_libdirs $ld_library_path"
for dir in none $try_libdirs
do
unset ac_cv_search_vexp # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags $try_loption"
LIBS=""
AC_SEARCH_LIBS(vexp, massvp4 massv, , , -lmass)
if test "$ac_cv_search_vexp" = "-lmassvp4" \
-o "$ac_cv_search_vexp" = "-lmassv"
then mass_libs="$try_loption $ac_cv_search_vexp -lmass"
fi
if test "$ac_cv_search_vexp" != "no" ; then break ; fi
done
;;
ppc64* )
# check for mass (in several directories)
try_libdirs="/usr/local/lib /opt/ibmcmp/xlmass/*/lib64"
try_libdirs="$libdirs $try_libdirs $ld_library_path"
for dir in none $try_libdirs
do
unset ac_cv_search_vexp # clear cached value
if test "$dir" = "none"
then
try_loption=
else
echo $ECHO_N "in $dir: " $ECHO_C
try_loption="-L$dir"
fi
FFLAGS="$test_fflags"
LDFLAGS="$test_ldflags $try_loption"
LIBS=""
AC_SEARCH_LIBS(vexp, massvp4_64, , , -lmass_64)
if test "$ac_cv_search_vexp" = "-lmassvp4_64"
then mass_libs="$try_loption $ac_cv_search_vexp -lmass_64"
fi
if test "$ac_cv_search_vexp" != "no" ; then break ; fi
done
;;
esac
fi
if test "$mass_libs" != ""; then
try_dflags="$try_dflags -D__MASS"
if test "$arch" = "ppc64-bg"; then
# BlueGene wants this when mass libs are loaded, SP6 doesn't want this!
ldflags="$ldflags -Wl,--allow-multiple-definition"
fi
fi
echo setting MASS_LIBS... $mass_libs
# check for mpi
# some architectures require to link mpi libraries explicitly
F77=$mpif90 # use parallel compiler
if test "$mpi_libs" = ""
then
# check directories in LD_LIBRARY_PATH too
# (maybe they are already searched by default, but I'm not sure)
ld_library_path=`echo $LD_LIBRARY_PATH | sed 's/:/ /g'`
if test "$use_parallel" -ne 0
then
if test "$have_mpi" -eq 0
# check for mpi
then
unset ac_cv_search_mpi_init # clear cached value
LDFLAGS="$test_ldflags"
LIBS="$mpi_libs"
AC_SEARCH_LIBS(mpi_init, mpi,
have_mpi=1 mpi_libs="$LIBS")
fi
fi
fi
echo setting MPI_LIBS... $mpi_libs
# final check on availability of parallel environment
parallel=0
for dummy in x # to allow simple 'break'
do
test "$use_parallel" -eq 0 && break
F77=$mpif90
LIBS="$mpi_libs"
AC_SEARCH_LIBS(mpi_init, "", parallel=1
try_dflags="$try_dflags -D__MPI -D__PARA")
# look for scalapack if required
test "$parallel" -eq 0 && break
test "$with_scalapack" -eq 0 && break
if test "$scalapack_libs" = "" ; then
# no additional libraries needed
AC_SEARCH_LIBS(pdgemr2d, "" , have_scalapack=1
try_dflags="$try_dflags -D__SCALAPACK")
test "$have_scalapack" -eq 1 && break
# Intel MKL blacs&scalapack - Norbert Nemec 2010/08/20
#
# Carlo Cavazzoni writes
# If you want to use the version of scalapack distributed with MKL
# you should be careful about:
# 1) the size of the integer variable when calling MKL subroutine,
# QE (up to now) uses integer*4, so you should link version with
# the suffix: lp64 and NOT ilp64 .
# 2) you should link the appropriate blacs for your MPI library:
# INTEL MPI -> libmkl_blacs_intelmpi_lp64.a
# OpenMPI -> libmkl_blacs_openmpi_lp64.a
# SGI MPI -> libmkl_blacs_sgimpt_lp64.a
#
# if you are in doubt or if you have another version of MPI
# you can always build BLACS by yourself.
#
if test "$have_mkl" -eq 1
then
unset ac_cv_search_pdgemr2d # clear cached value
LIBS="-lmkl_blacs_lp64 $mpi_libs $blas_libs"
AC_SEARCH_LIBS(pdgemr2d, "mkl_scalapack_lp64" , have_scalapack=1
try_dflags="$try_dflags -D__SCALAPACK"
scalapack_libs="-lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64" )
test "$have_scalapack" -eq 1 && break
fi
#
# sci libraries (e.g. cray xt)
unset ac_cv_search_pdgemr2d # clear cached value
scalapack_libs="-lsci"
LIBS="$mpi_libs $scalapack_libs"
AC_SEARCH_LIBS(pdgemr2d, "" , have_scalapack=1
try_dflags="$try_dflags -D__SCALAPACK")
test "$have_scalapack" -eq 1 && break
# scalapack + blacs, no -L options
unset ac_cv_search_pdgemr2d # clear cached value
blacs_libs="-lblacs -lblacsF77init -lblacs"
scalapack_libs="-lscalapack $blacs_libs"
LIBS="$mpi_libs $scalapack_libs"
LDFLAGS=""
AC_SEARCH_LIBS(pdgemr2d, "" , have_scalapack=1
try_dflags="$try_dflags -D__SCALAPACK")
test "$have_scalapack" -eq 1 && break
# scalapack + blacs with -L options
unset ac_cv_search_pdgemr2d # clear cached value
if test "$scalapack_dir" = ""; then scalapack_dir="/bgsys/local/scalapack/lib"; fi
if test "$blacs_dir" = ""; then blacs_dir="/bgsys/local/blacs/lib"; fi
blacs_libs="-L$blacs_dir -lblacs -lblacsF77init -lblacs"
scalapack_libs="-L$scalapack_dir -lscalapack $blacs_libs"
LIBS="$mpi_libs $scalapack_libs"
LDFLAGS=""
AC_SEARCH_LIBS(pdgemr2d, "" , have_scalapack=1
try_dflags="$try_dflags -D__SCALAPACK")
fi
done
# preprocessing flag for openmp (experimental)
if test "$use_openmp" -eq 1 ; then try_dflags="$try_dflags -D__OPENMP" ; fi
# preprocessing flag for signal trapping (experimental)
if test "$use_signals" -eq 1 ; then try_dflags="$try_dflags -D__TRAP_SIGUSR1" ; fi
#OBM - This is yet another variable for internal copy of BLAS/LAPACK
if test "$extlib_flags" = "" ; then
case "$arch" in
ppc64 )
extlib_flags="-q64 -qthreaded"
echo setting extlib_flags ... $extlib_flags
;;
esac
fi
##
if test "$dflags" = "" ; then dflags="$try_dflags" ; fi
echo setting DFLAGS... $dflags
if test "$iflags" = "" ; then iflags="$try_iflags" ; fi
echo setting IFLAGS... $iflags
# xlf compilers (AIX and powerpc) want comma-separated -D directives
if test "$xlf_flags" -ne 0
then
fdflags="`echo $dflags | sed 's/ */,/g'`"
else
fdflags="\$(DFLAGS)"
fi
echo setting FDFLAGS... $fdflags
if test "$ranlib" != "echo"
then
AC_CHECK_PROG(ranlib,ranlib,ranlib,echo)
fi
# MacOs walkaround for ranlib
if test "$arch" == "mac686"; then
if test "$ranlib" == "ranlib"; then
ranlib="ranlib -c"
fi
fi
echo setting RANLIB... $ranlib
# check if wget or curl work
AC_CHECK_PROG(wget, wget, wget -O)
if test "$wget" = ""; then
AC_CHECK_PROG(wget, curl, curl -o)
fi
echo setting WGET... $wget
# configure output messages
blas_line="BLAS_LIBS=$blas_libs"
if test "$have_scalapack" -eq 1; then
scalapack_line="SCALAPACK_LIBS=$scalapack_libs"
else
scalapack_libs=""
scalapack_line="@delete@"
fi
lapack_line="LAPACK_LIBS=$lapack_libs"
fft_line="FFT_LIBS=$fft_libs"
if test "$mpi_libs" != "" ; then
mpi_line="MPI_LIBS=$mpi_libs"
else
mpi_line="@delete@"
fi
if test "$mass_libs" != "" ; then
mass_line="MASS_LIBS=$mass_libs"
else
mass_line="@delete@"
fi
if test "$use_parallel" -ne 0
then
if test "$parallel" -ne 0
then
parallel_report="Parallel environment detected successfully.\\
Configured for compilation of parallel executables."
else
parallel_report="Parallel environment not detected \
\(is this a parallel machine?\).\\
Configured for compilation of serial executables."
fi
else
parallel_report="Configured for compilation of serial executables."
fi
# export settings to generated files
AC_SUBST(cc)
AC_SUBST(cflags)
AC_SUBST(dflags)
AC_SUBST(fdflags)
AC_SUBST(cpp)
AC_SUBST(cppflags)
AC_SUBST(f90)
AC_SUBST(mpif90)
AC_SUBST(f90flags)
AC_SUBST(f77)
AC_SUBST(fflags)
AC_SUBST(fflags_noopt)
AC_SUBST(fflags_nomain)
AC_SUBST(pre_fdflags)
AC_SUBST(imod)
AC_SUBST(iflags)
AC_SUBST(ld)
AC_SUBST(ldflags)
AC_SUBST(ld_libs)
AC_SUBST(blas_libs)
AC_SUBST(blas_libs_switch)
AC_SUBST(lapack_libs)
AC_SUBST(lapack_libs_switch)
AC_SUBST(fft_libs)
AC_SUBST(mpi_libs)
AC_SUBST(mass_libs)
AC_SUBST(scalapack_libs)
AC_SUBST(ar)
AC_SUBST(arflags)
AC_SUBST(ranlib)
AC_SUBST(f90rule)
AC_SUBST(blas_line)
AC_SUBST(lapack_line)
AC_SUBST(scalapack_line)
AC_SUBST(fft_line)
AC_SUBST(mpi_line)
AC_SUBST(mass_line)
AC_SUBST(parallel_report)
AC_SUBST(wget)
AC_SUBST(topdir)
AC_SUBST(extlib_flags)
AC_CONFIG_HEADERS([include/c_defs.h:include/c_defs.h.in])
AC_CONFIG_FILES(make.sys)
AC_CONFIG_FILES(configure.msg)
AC_CONFIG_FILES(install/make_wannier90.sys)
AC_CONFIG_FILES(install/make_blas.inc)
AC_CONFIG_FILES(install/make_lapack.inc)
AC_OUTPUT
# final messages
sed '/@delete@/d' configure.msg
echo configure: success
|