@@ -867,6 +867,10 @@ sub patch_autotools_output {
867867        verbose " $indent_str " " Patching \" -pthread\"  option for NAG compiler in ltmain.sh\n " 
868868        system (" $patch_prog  -N -p0 < $topdir /config/ltmain_nag_pthread.diff >/dev/null 2>&1" 
869869        unlink (" config/ltmain.sh.rej" 
870+ 
871+         verbose " $indent_str " " Patching \" -framework\"  option for flang compiler in ltmain.sh\n " 
872+         system (" $patch_prog  -N -p0 < $topdir /config/ltmain_flang_darwin.diff >/dev/null 2>&1" 
873+         unlink (" config/ltmain.sh.rej" 
870874    }
871875
872876    #  If there's no configure script, there's nothing else to do.
@@ -1053,8 +1057,14 @@ sub patch_autotools_output {
10531057        lt_prog_compiler_static_FC=\' -Bstatic\'  
10541058        ;;'  ;
10551059    $replace_string  = " case \$ cc_basename in
1060+       flang*) 
1061+         # flang compiler 
1062+         lt_prog_compiler_wl_FC='-Wl,' 
1063+         lt_prog_compiler_pic_FC='-fPIC' 
1064+         lt_prog_compiler_static_FC='-static' 
1065+         ;; 
10561066      icc* | ifort*) 
1057-         #Intel Fortran compiler 
1067+         #  Intel Fortran compiler 
10581068        lt_prog_compiler_wl_FC='-Wl,' 
10591069        lt_prog_compiler_pic_FC='-fno-common -PIC' 
10601070        lt_prog_compiler_static_FC='' 
@@ -1091,6 +1101,23 @@ sub patch_autotools_output {
10911101        $c  =~ s // $replace_string / g 
10921102    }
10931103
1104+     $search_string  = ' case \$cc_basename in
1105+      ifort\*\|nagfor\*\) _lt_dar_can_shared=yes ;; 
1106+      \*\) _lt_dar_can_shared=\$GCC ;; 
1107+   esac'  ;
1108+     $replace_string  = " case \$ cc_basename in
1109+      flang*|ifort*|nagfor*) _lt_dar_can_shared=yes ;; 
1110+      *) _lt_dar_can_shared=\$ GCC ;; 
1111+   esac"  ;
1112+     push (@verbose_out , $indent_str  . " Patching configure for flang compiler on Darwin (FC)\n " 
1113+     $c  =~ s // $replace_string / g 
1114+ 
1115+     $search_string  = ' archive_cmds_FC="\\\\\\ $CC -dynamiclib' 
1116+     $replace_string  = ' archive_cmds_FC="\$CC --shared' 
1117+     push (@verbose_out , $indent_str  . " Patching configure for flang compiler on Darwin (FC)\n " 
1118+     $c  =~ s // $replace_string / g 
1119+     $c  =~ s /\\\$ rpath/ $1 -Wl,-install_name,\\\` echo \\\$ rpath | sed \' s%^[ ]*%%\'\\\` / g 
1120+ 
10941121    #  Only write out verbose statements and a new configure if the
10951122    #  configure content actually changed
10961123    return 
0 commit comments