Subject: bug#10236: Enhancement: support for the nagfor compiler in Libtool

From: Juergen Reuter <[email-masked]>
Date: Tue, 13 Dec 2011 19:33:10 +0100

On Thursday 08 December 2011 06:32:23 you wrote:
> On 12/06/2011 08:20 AM, Juergen Reuter wrote:
> 
> Hi,
> 
> > Dear all,
> > this is a bug report, but a feature request. In order to have support for
> > the nagfor Fortran compiler which is used in the quality assignment of
> > our software project it would be great to have included the following two
> > minor changes in the libtool setup w.r.t. to  the stable version 2.4.2:
> >
> > in ltmain.sh (for linking on Darwin systems only)
> 
> If you send a git format-patch type patch for current git libtool, I'd
> be happy to push it for you.
> 
> Peter
> 

Hi Peter,
here is the the git-type patch file for you w.r.t. to the recent git repo.
Hope I did it correctly.
Would be great to have this in libtool in the future, thanks a lot in advance!
Cheers,
	JRR

-- 
-------------------------------------
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
-------------------------------------
 
From 12fd3fca8a1f09a2b3816a07fb2044fbf5358a43 Mon Sep 17 00:00:00 2001
From: Juergen Reuter <[email-masked]>
Date: Tue, 13 Dec 2011 19:18:08 +0100
Subject: [PATCH] Enable nagfor fortran compiler support

---
 build-aux/ltmain.m4sh |    9 +++++++++
 m4/libtool.m4         |   16 +++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/build-aux/ltmain.m4sh b/build-aux/ltmain.m4sh
index 922e957..5916423 100644
--- a/build-aux/ltmain.m4sh
+++ b/build-aux/ltmain.m4sh
@@ -6645,6 +6645,15 @@ func_mode_link ()
 	  minor_current=$func_arith_result
 	  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
+              nagfor*)
+                  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
+                  ;;
+              *)
+                  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
+                  ;;
+          esac
 	  ;;
 
 	freebsd-aout)
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 9c2574f..24c03ad 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -1094,7 +1094,7 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
   _LT_TAGVAR(link_all_deplibs, $1)=yes
   _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined
   case $cc_basename in
-     ifort*) _lt_dar_can_shared=yes ;;
+     ifort*|nagfor*) _lt_dar_can_shared=yes ;;
      *) _lt_dar_can_shared=$GCC ;;
   esac
   if test yes = "$_lt_dar_can_shared"; then
@@ -4304,6 +4304,20 @@ m4_if([$1], [CXX], [
       fi
       ;;
 
+    darwin* | rhapsody*)
+      # PIC is the default on this platform
+      # Common symbols not allowed in MH_DYLIB files
+      _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+      case $cc_basename in
+      nagfor*)
+        # NAG Fortran compiler
+        _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
+        _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+        _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+        ;;
+      esac
+      ;;
+
     mingw* | cygwin* | pw32* | os2* | cegcc*)
       # This hack is so that the source file can tell whether it is being
       # built for inclusion in a dll (and should export symbols for example).
-- 
1.7.1