ltmain.sh.nag_pthread.patch 1.75 KB
Newer Older
Sergey Kosukhin's avatar
Sergey Kosukhin committed
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
--- a/config/ltmain.sh
+++ b/config/ltmain.sh
@@ -7862,6 +7862,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 "*) ;;
@@ -9493,6 +9500,22 @@ EOF
 	  ;;
       esac
 
+      # Time to revert the changes made for nagfor. This might be required if
+      # we need to make the output '*.la' file to be correctly interpreted for
+      # gcc (e.g. the output library that we are linking now with nagfor needs
+      # to be linked by gcc later). In this case, the libtool script of a
+      # package that will try to link our library will have to make similar
+      # non-standard nagfor-specific modifications of the '-pthread' flag.
+      # Thus, if we are creating a Fortran library for nagfor only, it is
+      # better not to revert the changes, otherwise, uncomment the following
+      # lines.
+
+      # 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=