@@ -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.
@@ -1071,8 +1075,14 @@ sub patch_autotools_output {
10711075 lt_prog_compiler_static_FC=\' -Bstatic\'
10721076 ;;' ;
10731077 $replace_string = " case \$ cc_basename in
1078+ flang*)
1079+ # flang compiler
1080+ lt_prog_compiler_wl_FC='-Wl,'
1081+ lt_prog_compiler_pic_FC='-fPIC'
1082+ lt_prog_compiler_static_FC='-static'
1083+ ;;
10741084 icc* | ifort*)
1075- #Intel Fortran compiler
1085+ # Intel Fortran compiler
10761086 lt_prog_compiler_wl_FC='-Wl,'
10771087 lt_prog_compiler_pic_FC='-fno-common -PIC'
10781088 lt_prog_compiler_static_FC=''
@@ -1109,6 +1119,23 @@ sub patch_autotools_output {
11091119 $c =~ s / $search_string/ $replace_string / g ;
11101120 }
11111121
1122+ $search_string = ' case \$cc_basename in
1123+ ifort\*\|nagfor\*\) _lt_dar_can_shared=yes ;;
1124+ \*\) _lt_dar_can_shared=\$GCC ;;
1125+ esac' ;
1126+ $replace_string = " case \$ cc_basename in
1127+ flang*|ifort*|nagfor*) _lt_dar_can_shared=yes ;;
1128+ *) _lt_dar_can_shared=\$ GCC ;;
1129+ esac" ;
1130+ push (@verbose_out , $indent_str . " Patching configure for flang compiler on Darwin (FC)\n " );
1131+ $c =~ s / $search_string/ $replace_string / g ;
1132+
1133+ $search_string = ' archive_cmds_FC="\\\\\\ $CC -dynamiclib' ;
1134+ $replace_string = ' archive_cmds_FC="\$CC --shared' ;
1135+ push (@verbose_out , $indent_str . " Patching configure for flang compiler on Darwin (FC)\n " );
1136+ $c =~ s / $search_string/ $replace_string / g ;
1137+ $c =~ s / (archive_cmds_FC.*)-install_name \\\$ rpath/ $1 -Wl,-install_name,\\\` echo \\\$ rpath | sed \' s%^[ ]*%%\'\\\` / g ;
1138+
11121139 # Only write out verbose statements and a new configure if the
11131140 # configure content actually changed
11141141 return
0 commit comments