Replace vpermpd with vpermilpd
[platform/upstream/openblas.git] / f_check
diff --git a/f_check b/f_check
index e7e4688..b05db85 100644 (file)
--- a/f_check
+++ b/f_check
@@ -1,5 +1,7 @@
 #!/usr/bin/perl
 
+$hostos   = `uname -s | sed -e s/\-.*//`;    chop($hostos);
+
 #
 # 1. Not specified
 #   1.1 Automatically detect, then check compiler
@@ -31,6 +33,7 @@ if ($compiler eq "") {
               "ppuf77", "ppuf95", "ppuf90", "ppuxlf",
              "pathf90", "pathf95",
              "pgf95", "pgf90", "pgf77",
+             "flang",
               "ifort");
 
 OUTER:
@@ -76,8 +79,13 @@ if ($compiler eq "") {
                $vendor = GFORTRAN;
                $openmp = "-fopenmp";
            } else {
-               $vendor = G77;
-               $openmp = "";
+               if ($compiler =~ /flang/) {
+                   $vendor = FLANG;
+                   $openmp = "-fopenmp";
+               } else {
+                   $vendor = G77;
+                   $openmp = "";
+               }
            }
 
        }
@@ -89,7 +97,7 @@ if ($compiler eq "") {
 
        if ($data =~ /Intel/) {
            $vendor = INTEL;
-           $openmp = "-openmp";
+           $openmp = "-fopenmp";
        }
 
         if ($data =~ /Sun Fortran/) {
@@ -112,14 +120,14 @@ if ($compiler eq "") {
            $openmp = "-mp";
        }
 
-       if ($data =~ /IBM/) {
+       if ($data =~ /IBM XL/) {
            $vendor = IBM;
            $openmp = "-openmp";
        }
 
-       # for embeded underscore name, e.g. zho_ge, it may append 2 underscores.
+       # for embedded underscore name, e.g. zho_ge, it may append 2 underscores.
        $data = `$compiler -O2 -S ftest3.f > /dev/null 2>&1 && cat ftest3.s && rm -f ftest3.s`;
-       if ($data =~ /zho_ge__/) {
+       if ($data =~ / zho_ge__/) {
            $need2bu       = 1;
        }
     }
@@ -147,7 +155,7 @@ if ($compiler eq "") {
        if ($compiler =~ /ifort/) {
            $vendor = INTEL;
            $bu       = "_";
-           $openmp = "-openmp";
+           $openmp = "-fopenmp";
        }
 
        if ($compiler =~ /pathf/) {
@@ -195,6 +203,12 @@ if ($compiler eq "") {
            $openmp = "-mp";
        }
 
+       if ($compiler =~ /flang/) {
+           $vendor = FLANG;
+           $bu     = "_";
+           $openmp = "-fopenmp";
+       }
+
        if ($vendor eq "") {
            $nofortran = 1;
            $compiler = "gfortran";
@@ -219,9 +233,18 @@ if (!$?) {
        if ($?) {
            $link = `$compiler $openmp -q32 -v ftest2.f 2>&1 && rm -f a.out a.exe`;
        }
+        # for AIX
+       if ($?) {
+           $link = `$compiler $openmp -maix32 -v ftest2.f 2>&1 && rm -f a.out a.exe`;
+       }
        #For gfortran MIPS
        if ($?) {
-           $link = `$compiler $openmp -mabi=n32 -v ftest2.f 2>&1 && rm -f a.out a.exe`;
+    $mips_data = `$compiler_bin -E -dM - < /dev/null`;
+    if ($mips_data =~ /_MIPS_ISA_MIPS64/) {
+        $link = `$compiler $openmp -mabi=n32 -v ftest2.f 2>&1 && rm -f a.out a.exe`;
+    } else {
+        $link = `$compiler $openmp -mabi=32 -v ftest2.f 2>&1 && rm -f a.out a.exe`;
+    }
        }
        $binary = "" if ($?);
     }
@@ -231,6 +254,10 @@ if (!$?) {
        if ($?) {
            $link = `$compiler $openmp -q64 -v ftest2.f 2>&1 && rm -f a.out a.exe`;
        }
+        # for AIX
+       if ($?) {
+           $link = `$compiler $openmp -maix64 -v ftest2.f 2>&1 && rm -f a.out a.exe`;
+       }
        #For gfortran MIPS
        if ($?) {
            $link = `$compiler $openmp -mabi=64 -v ftest2.f 2>&1 && rm -f a.out a.exe`;
@@ -265,29 +292,27 @@ if ($link ne "") {
            && ($flags !~ /^-LIST:/)
            && ($flags !~ /^-LANG:/)
            ) {
-           if ($vendor eq "PGI") {
-               $flags =~ s/lib$/libso/;
-           }
            $linker_L .= $flags . " ";
        }
 
        if ($flags =~ /^\-Y/) {
+           next if ($hostos eq 'SunOS');
            $linker_L .= "-Wl,". $flags . " ";
-           }
+        }
+
+       if ($flags =~ /^\--exclude-libs/) {
+           $linker_L .= "-Wl,". $flags . " ";
+           $flags="";
+       }
+
 
        if ($flags =~ /^\-rpath\@/) {
            $flags =~ s/\@/\,/g;
-           if ($vendor eq "PGI") {
-               $flags =~ s/lib$/libso/;
-           }
            $linker_L .= "-Wl,". $flags . " " ;
        }
 
        if ($flags =~ /^\-rpath-link\@/) {
            $flags =~ s/\@/\,/g;
-           if ($vendor eq "PGI") {
-               $flags =~ s/lib$/libso/;
-           }
            $linker_L .= "-Wl,". $flags . " " ;
        }
 
@@ -296,7 +321,6 @@ if ($link ne "") {
            && ($flags !~ /gfortranbegin/)
            && ($flags !~ /frtbegin/)
            && ($flags !~ /pathfstart/)
-           && ($flags !~ /numa/)
            && ($flags !~ /crt[0-9]/)
            && ($flags !~ /gcc/)
            && ($flags !~ /user32/)
@@ -317,6 +341,10 @@ if ($vendor eq "INTEL"){
     $linker_a .= "-lgfortran"
 }
 
+if ($vendor eq "FLANG"){
+    $linker_a .= "-lflang"
+}
+
 open(MAKEFILE, ">> $makefile") || die "Can't append $makefile";
 open(CONFFILE, ">> $config"  ) || die "Can't append $config";