Skip to content

Commit 137cd73

Browse files
authored
Merge pull request #6378 from skosukhin/fix_nag_pthread
Fix inherited_linker_flags processing when building with NAG compiler
2 parents 1e4bf9e + 3b624db commit 137cd73

File tree

2 files changed

+53
-13
lines changed

2 files changed

+53
-13
lines changed

autogen.pl

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,10 +1045,28 @@ sub patch_autotools_output {
10451045
whole_archive_flag_spec${tag}=
10461046
tmp_sharedflag='--shared' ;;
10471047
nagfor*) # NAGFOR 5.3
1048-
tmp_sharedflag='-Wl,-shared';;
1048+
tmp_sharedflag='-Wl,-shared' ;;
10491049
xl";
10501050

1051-
push(@verbose_out, $indent_str . "Patching configure for NAG compiler ($tag)\n");
1051+
push(@verbose_out, $indent_str . "Patching configure for NAG compiler #1 ($tag)\n");
1052+
$c =~ s/$search_string/$replace_string/;
1053+
1054+
# Newer versions of Libtool have the previous patch already. Therefore,
1055+
# we add the support for convenience libraries separetly
1056+
my $search_string = "whole_archive_flag_spec${tag}=" . '\n\s+' .
1057+
"tmp_sharedflag='--shared' ;;" . '\n\s+' .
1058+
'nagfor\052.*# NAGFOR 5.3\n\s+' .
1059+
"tmp_sharedflag='-Wl,-shared' ;;" . '\n\s+' .
1060+
'xl';
1061+
my $replace_string = "whole_archive_flag_spec${tag}=
1062+
tmp_sharedflag='--shared' ;;
1063+
nagfor*) # NAGFOR 5.3
1064+
whole_archive_flag_spec${tag}='\$wl--whole-archive`for conv in \$convenience\\\"\\\"; do test -n \\\"\$conv\\\" && new_convenience=\\\"\$new_convenience,\$conv\\\"; done; func_echo_all \\\"\$new_convenience\\\"` \$wl--no-whole-archive'
1065+
compiler_needs_object=yes
1066+
tmp_sharedflag='-Wl,-shared' ;;
1067+
xl";
1068+
1069+
push(@verbose_out, $indent_str . "Patching configure for NAG compiler #2 ($tag)\n");
10521070
$c =~ s/$search_string/$replace_string/;
10531071
}
10541072

config/ltmain_nag_pthread.diff

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,40 @@
11
--- config/ltmain.sh
22
+++ config/ltmain.sh
3-
@@ -6417,8 +6417,14 @@
4-
func_source "$lib"
5-
3+
@@ -7862,6 +7862,13 @@ func_mode_link ()
64
# Convert "-framework foo" to "foo.ltframework"
7-
+ # and "-pthread" to "-Wl,-pthread" if NAG compiler
85
if test -n "$inherited_linker_flags"; then
9-
- tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
10-
+ case "$CC" in
11-
+ *nagfor*)
12-
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g' | $SED 's/-pthread/-Wl,-pthread/g'`;;
13-
+ *)
14-
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`;;
15-
+ esac
6+
tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
7+
+
8+
+ # Additionally convert " -pthread" to " -Wl,-pthread" for nagfor
9+
+ func_cc_basename $CC
10+
+ case $func_cc_basename_result in
11+
+ nagfor*) tmp_inherited_linker_flags=`$ECHO "$tmp_inherited_linker_flags" | $SED 's/ -pthread/ -Wl,-pthread/g'` ;;
12+
+ esac
13+
+
1614
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
1715
case " $new_inherited_linker_flags " in
1816
*" $tmp_inherited_linker_flag "*) ;;
17+
@@ -8881,7 +8888,8 @@ func_mode_link ()
18+
xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
19+
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
20+
# On Darwin other compilers
21+
- case $CC in
22+
+ func_cc_basename $CC
23+
+ case $func_cc_basename_result in
24+
nagfor*)
25+
verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
26+
;;
27+
@@ -9493,6 +9501,13 @@ EOF
28+
;;
29+
esac
30+
31+
+ # Time to revert the changes made for nagfor.
32+
+ func_cc_basename $CC
33+
+ case $func_cc_basename_result in
34+
+ nagfor*)
35+
+ new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% -Wl,-pthread% -pthread%g'` ;;
36+
+ esac
37+
+
38+
# move library search paths that coincide with paths to not yet
39+
# installed libraries to the beginning of the library search list
40+
new_libs=

0 commit comments

Comments
 (0)