@@ -867,6 +867,10 @@ sub patch_autotools_output {
867
867
verbose " $indent_str " ." Patching \" -pthread\" option for NAG compiler in ltmain.sh\n " ;
868
868
system (" $patch_prog -N -p0 < $topdir /config/ltmain_nag_pthread.diff >/dev/null 2>&1" );
869
869
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" );
870
874
}
871
875
872
876
# If there's no configure script, there's nothing else to do.
@@ -1053,8 +1057,14 @@ sub patch_autotools_output {
1053
1057
lt_prog_compiler_static_FC=\' -Bstatic\'
1054
1058
;;' ;
1055
1059
$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
+ ;;
1056
1066
icc* | ifort*)
1057
- #Intel Fortran compiler
1067
+ # Intel Fortran compiler
1058
1068
lt_prog_compiler_wl_FC='-Wl,'
1059
1069
lt_prog_compiler_pic_FC='-fno-common -PIC'
1060
1070
lt_prog_compiler_static_FC=''
@@ -1091,6 +1101,23 @@ sub patch_autotools_output {
1091
1101
$c =~ s / $search_string/ $replace_string / g ;
1092
1102
}
1093
1103
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 / $search_string/ $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 / $search_string/ $replace_string / g ;
1119
+ $c =~ s / (archive_cmds_FC.*)-install_name \\\$ rpath/ $1 -Wl,-install_name,\\\` echo \\\$ rpath | sed \' s%^[ ]*%%\'\\\` / g ;
1120
+
1094
1121
# Only write out verbose statements and a new configure if the
1095
1122
# configure content actually changed
1096
1123
return
0 commit comments