Re: Patches for libtool support on NAG Fortran compiler for Darwin OS
Hello, * Jürgen Reuter wrote on Tue, Mar 01, 2011 at 12:24:39PM CET: > as discussed with Peter I send to you a diff (compared to the > 2.4 official version of libtool) to support the NAG Fortran compiler > on Darwin 64bit machines. > --- libtool.m4 2010-10-01 20:57:54.0 +0200 > +++ ../../nag_trunk/m4/libtool.m4 2011-02-28 09:44:50.0 +0100 > @@ -1053,7 +1053,7 @@ >_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 ;; The issue is not new with your patch, but if we can distinguish compilers based on something like '$CC -V' output or similar, then these code bits can reliably keep working even with MPI (or other) wrappers to the compilers. We've moved this way for a couple of other compilers recently. Since this is typically a strict improvement, a patch to add support is fine even without it, but while you're testing anyway, you might be interested to fix it right away. Your choice. Thanks, Ralf
Re: Patches for libtool support on NAG Fortran compiler for Darwin OS
On 1 Mar 2011, at 16:11, Peter O'Gorman wrote: > On 03/01/2011 05:24 AM, Jürgen Reuter wrote: >> Dear libtool team (cc to Peter) >> as discussed with Peter I send to you a diff (compared to the >> 2.4 official version of libtool) to support the NAG Fortran compiler >> on Darwin 64bit machines. > > > Thanks for your work on this. > >>case $cc_basename in >> - ifort*) _lt_dar_can_shared=yes ;; >> + ifort*|nagfor*) _lt_dar_can_shared=yes ;; >> *) _lt_dar_can_shared=$GCC ;; > > This hunk is OK. Cool. > >> @@ -4245,6 +4245,19 @@ >>fi >>;; >> >> + darwin* | rhapsody*) >> + # PIC is the default on this platform >> + # Common symbols not allowed in MH_DYLIB files >> + 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 >> + ;; >> + > test-suite.log Description: Binary data > This one isn't. Either this matches and then the default case that sets > lt_prog_compiler_pic to -fno-common later does not match, or vice versa. I > haven't looked at where this comes in libtool.m4. Something like this would > keep the default case working too: > > @@ -4234,6 +4234,14 @@ m4_if([$1], [CXX], [ > # 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 > ;; > > haiku*) > > Though, recent Mac OS X does not require -fno-common, because -single_module > is the default, it's mostly harmless to keep it there IMO. OK, you are right Peter, I added the missing additional line, everything works fine with it, so please take your version. > >> diff -u ltmain.sh ../nag_trunk/ltmain.sh >> --- ltmain.sh 2011-03-01 12:18:13.0 +0100 >> +++ ../nag_trunk/ltmain.sh 2011-03-01 11:49:34.0 +0100 >> @@ -7390,7 +7390,15 @@ >> func_arith $current + 1 >> 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 >> ;; > > I am a little confused by this because it seems strange that > -compatibility_version and -current_version would need -Wl, quoting, but > -dynamiclib, -bundle etc. do not. Did you happen to run the libtool test > suite with this patch? Please do so and post the results. > This confuses me too. But somehow I was not able to wrap these options, it always gave error messages. And somehow our program does work with this setup. I attached the test-suite.log for the modifications I made inside libtool, it looks good to me. But if you come up with a solution about how to wrap -dynamiclib I am fine with this. In fact, the compiler warns me about Option warning: Unrecognised option -dynamiclib passed to loader Option warning: Unrecognised option -install_name passed to loader > Thanks again, sorry for asking you to do more work, > Peter No problem, we are highly interested to keep our autotools versions synchronized with your repository. Cheers, JRR
Patches for libtool support on NAG Fortran compiler for Darwin OS
Dear libtool team (cc to Peter) as discussed with Peter I send to you a diff (compared to the 2.4 official version of libtool) to support the NAG Fortran compiler on Darwin 64bit machines. The two changes are (also attached as diff patches): -- in the file libtool.m4: * diff -u libtool.m4 ../nag_trunk/libtool.m4 --- libtool.m4 2010-10-01 20:57:54.0 +0200 +++ ../../nag_trunk/m4/libtool.m4 2011-02-28 09:44:50.0 +0100 @@ -1053,7 +1053,7 @@ _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 "$_lt_dar_can_shared" = "yes"; then @@ -4245,6 +4245,19 @@ fi ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + 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). * sowie in ltmain.sh (as I explained in my email to Peter the nagfor uses gcc as a linker which then uses ld. This demands a double wrapping through -Wl,-Wl flags) * diff -u ltmain.sh ../nag_trunk/ltmain.sh --- ltmain.sh 2011-03-01 12:18:13.0 +0100 +++ ../nag_trunk/ltmain.sh 2011-03-01 11:49:34.0 +0100 @@ -7390,7 +7390,15 @@ func_arith $current + 1 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) libtool.m4.diff Description: Binary data ltmain.sh.diff Description: Binary data Cheers, Juergen Jürgen Reuter +++ +++ +++ DESY Theory Group Notkestraße 85 D-22607 Hamburg, Germany Bldg. 2a, Room 304 Tel. +49 (0)40 8998 3895 +++ +++ +++ +++ +++ Universität Freiburg Physikalisches Institut Hermann-Herder-Str. 3 D-79104 Freiburg, Germany Room 803, Tel. +49 (0)761 203 8407 +++ +++ +++ +++ +++ skype: jr_reuter
Re: Patches for libtool support on NAG Fortran compiler for Darwin OS
On 03/01/2011 05:24 AM, Jürgen Reuter wrote: Dear libtool team (cc to Peter) as discussed with Peter I send to you a diff (compared to the 2.4 official version of libtool) to support the NAG Fortran compiler on Darwin 64bit machines. Thanks for your work on this. case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; + ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; This hunk is OK. @@ -4245,6 +4245,19 @@ fi ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + 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 + ;; + This one isn't. Either this matches and then the default case that sets lt_prog_compiler_pic to -fno-common later does not match, or vice versa. I haven't looked at where this comes in libtool.m4. Something like this would keep the default case working too: @@ -4234,6 +4234,14 @@ m4_if([$1], [CXX], [ # 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 ;; haiku*) Though, recent Mac OS X does not require -fno-common, because -single_module is the default, it's mostly harmless to keep it there IMO. diff -u ltmain.sh ../nag_trunk/ltmain.sh --- ltmain.sh 2011-03-01 12:18:13.0 +0100 +++ ../nag_trunk/ltmain.sh 2011-03-01 11:49:34.0 +0100 @@ -7390,7 +7390,15 @@ func_arith $current + 1 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 ;; I am a little confused by this because it seems strange that -compatibility_version and -current_version would need -Wl, quoting, but -dynamiclib, -bundle etc. do not. Did you happen to run the libtool test suite with this patch? Please do so and post the results. Thanks again, sorry for asking you to do more work, Peter