@@ -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.
@@ -1071,8 +1075,14 @@ sub patch_autotools_output {
1071
1075
lt_prog_compiler_static_FC=\' -Bstatic\'
1072
1076
;;' ;
1073
1077
$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
+ ;;
1074
1084
icc* | ifort*)
1075
- #Intel Fortran compiler
1085
+ # Intel Fortran compiler
1076
1086
lt_prog_compiler_wl_FC='-Wl,'
1077
1087
lt_prog_compiler_pic_FC='-fno-common -PIC'
1078
1088
lt_prog_compiler_static_FC=''
@@ -1109,6 +1119,23 @@ sub patch_autotools_output {
1109
1119
$c =~ s / $search_string/ $replace_string / g ;
1110
1120
}
1111
1121
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
+
1112
1139
# Only write out verbose statements and a new configure if the
1113
1140
# configure content actually changed
1114
1141
return
0 commit comments