summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/netcdf-fortran/nag_libtool_2.4.6.patch
blob: dfb47fd5f2de1960358b9b1d0b441d7ba09c684f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
--- a/configure
+++ b/configure
@@ -9034,6 +9034,12 @@ func_cc_basename ()
       esac
     done
     func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+    # Set result to 'nagfor-wrapper' when NAG compiler is called via a wrapper (e.g. mpif90).
+    case $func_cc_basename_result in
+      nagfor*) ;;
+      *) $cc_temp -V 2>&1 | $GREP '^NAG Fortran Compiler Release' >/dev/null 2>&1 && func_cc_basename_result='nagfor-wrapper' ;;
+    esac
 }
 
 # Check whether --enable-libtool-lock was given.
@@ -11811,6 +11817,8 @@ _LT_EOF
 	  whole_archive_flag_spec=
 	  tmp_sharedflag='--shared' ;;
         nagfor*)                        # NAGFOR 5.3
+          whole_archive_flag_spec='$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'
+          compiler_needs_object=yes
           tmp_sharedflag='-Wl,-shared' ;;
 	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
@@ -15663,6 +15671,8 @@ _LT_EOF
 	  whole_archive_flag_spec_F77=
 	  tmp_sharedflag='--shared' ;;
         nagfor*)                        # NAGFOR 5.3
+          whole_archive_flag_spec_F77='$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'
+          compiler_needs_object_F77=yes
           tmp_sharedflag='-Wl,-shared' ;;
 	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
@@ -18788,6 +18798,8 @@ _LT_EOF
 	  whole_archive_flag_spec_FC=
 	  tmp_sharedflag='--shared' ;;
         nagfor*)                        # NAGFOR 5.3
+          whole_archive_flag_spec_FC='$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'
+          compiler_needs_object_FC=yes
           tmp_sharedflag='-Wl,-shared' ;;
 	xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
 	  tmp_sharedflag='-qmkshrobj'
@@ -26086,6 +26098,12 @@ func_cc_basename ()
       esac
     done
     func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+
+    # Set result to 'nagfor-wrapper' when NAG compiler is called via a wrapper (e.g. mpif90).
+    case $func_cc_basename_result in
+      nagfor*) ;;
+      *) $cc_temp -V 2>&1 | $GREP '^NAG Fortran Compiler Release' >/dev/null 2>&1 && func_cc_basename_result='nagfor-wrapper' ;;
+    esac
 }
 
 
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -7868,6 +7868,13 @@ func_mode_link ()
 	# Convert "-framework foo" to "foo.ltframework"
 	if test -n "$inherited_linker_flags"; then
 	  tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+
+	  # Additionally convert " -pthread" to " -Wl,-pthread" for nagfor
+	  func_cc_basename $CC
+	  case $func_cc_basename_result in
+	    nagfor*) tmp_inherited_linker_flags=`$ECHO "$tmp_inherited_linker_flags" | $SED 's/ -pthread/ -Wl,-pthread/g'` ;;
+	  esac
+
 	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
 	    case " $new_inherited_linker_flags " in
 	      *" $tmp_inherited_linker_flag "*) ;;
@@ -8890,7 +8897,8 @@ func_mode_link ()
 	  xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
 	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
           # On Darwin other compilers
-          case $CC in
+          func_cc_basename $CC
+          case $func_cc_basename_result in
               nagfor*)
                   verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision"
                   ;;
@@ -9502,6 +9510,14 @@ EOF
 	  ;;
       esac
 
+      # Time to revert the changes made for nagfor.
+
+      func_cc_basename $CC
+      case $func_cc_basename_result in
+        nagfor*)
+          new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% -Wl,-pthread% -pthread%g'` ;;
+      esac
+
       # move library search paths that coincide with paths to not yet
       # installed libraries to the beginning of the library search list
       new_libs=