Subject: bug#25368: Libtool patch concerning using the NAG fortran compiler as linker

From: Juergen Reuter <[email-masked]>
Date: Thu, 5 Jan 2017 19:41:50 +0100

Dear libtool developers,
here is a patch for the current libtool git repo when using the NAG 
Fortran compiler
(nagfor) to link exectuables or libraries. nagfor doesn't accept 
arguments passed twice,
but a setup in the ltmain.in does exactly this when using -openmp as a 
flag. To avoid
hiccups, I added the following patch  (below).
I would be grateful if you could push this to the libtool git repo!
Thanks a lot in advance!
Cheers,
     JRR

Patch:
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 4cd3818..d65ea72 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5176,12 +5176,24 @@ func_mode_link ()

-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
-       func_append compiler_flags " $arg"
+        case $CC in
+           nagfor*) ;;
+           *)
+               func_append compiler_flags " $arg"
+               ;;
+       esac
         func_append compile_command " $arg"
         func_append finalize_command " $arg"
         case "$new_inherited_linker_flags " in
             *" $arg "*) ;;
-           * ) func_append new_inherited_linker_flags " $arg" ;;
+           *)
+               case $CC in
+                   nagfor*) ;;
+                   *)
+                       func_append new_inherited_linker_flags " $arg"
+                   ;;
+               esac
+               ;;
         esac
         continue
         ;;

-- 
-------------------------------------
Juergen Reuter
*****
DESY Theory Group
Notkestrasse 85
D-22603 Hamburg
Phone: +49 (0)40 8998-3895
Fax  : +49 (0)40 8998-2777

*****
Skype: jr_reuter
-------------------------------------

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 4cd3818..d65ea72 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5176,12 +5176,24 @@ func_mode_link ()
 
       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
       |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
-	func_append compiler_flags " $arg"
+        case $CC in
+	    nagfor*) ;;
+	    *)
+		func_append compiler_flags " $arg"
+		;;
+	esac
 	func_append compile_command " $arg"
 	func_append finalize_command " $arg"
 	case "$new_inherited_linker_flags " in
 	    *" $arg "*) ;;
-	    * ) func_append new_inherited_linker_flags " $arg" ;;
+	    *) 
+		case $CC in 
+		    nagfor*) ;;
+		    *)
+			func_append new_inherited_linker_flags " $arg"
+		    ;;
+		esac
+		;;
 	esac
 	continue
 	;;