diff --git a/autogen.pl b/autogen.pl index dde09dbfa7..e86e6337cc 100755 --- a/autogen.pl +++ b/autogen.pl @@ -899,10 +899,15 @@ sub patch_autotools_output { # enough Libtool that dosn't need this patch. But don't alarm the # user and make them think that autogen failed if this patch fails -- # make the errors be silent. + # Also patch ltmain.sh for NAG compiler if (-f "config/ltmain.sh") { verbose "$indent_str"."Patching PGI compiler version numbers in ltmain.sh\n"; system("$patch_prog -N -p0 < $topdir/config/ltmain_pgi_tp.diff >/dev/null 2>&1"); unlink("config/ltmain.sh.rej"); + + verbose "$indent_str"."Patching \"-pthread\" option for NAG compiler in ltmain.sh\n"; + system("$patch_prog -N -p0 < $topdir/config/ltmain_nag_pthread.diff >/dev/null 2>&1"); + unlink("config/ltmain.sh.rej"); } # Total ugh. We have to patch the configure script itself. See below @@ -969,6 +974,25 @@ sub patch_autotools_output { $c =~ s/$search_string/$replace_string/; } + foreach my $tag (("", "_FC")) { + + # We have to change the search pattern and substitution on each + # iteration to take into account the tag changing + my $search_string = 'lf95\052.*# Lahey Fortran 8.1\n\s+' . + "whole_archive_flag_spec${tag}=" . '\n\s+' . + "tmp_sharedflag='--shared' ;;" . '\n\s+' . + 'xl'; + my $replace_string = "lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec${tag}= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared';; + xl"; + + verbose "$indent_str"."Patching configure for NAG compiler ($tag)\n"; + $c =~ s/$search_string/$replace_string/; + } + # Oracle has apparently begun (as of 12.5-beta) removing the "Sun" branding. # So this patch (cumulative over the previous one) is required. verbose "$indent_str"."Patching configure for Oracle Studio Fortran version strings\n"; diff --git a/config/Makefile.am b/config/Makefile.am index 16cd5ae62e..e2dbfc3f03 100644 --- a/config/Makefile.am +++ b/config/Makefile.am @@ -12,6 +12,8 @@ # Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2010 Oracle and/or its affiliates. All rights # reserved. +# Copyright (c) 2016 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -21,8 +23,9 @@ EXTRA_DIST = \ distscript.csh \ - opal_get_version.m4sh \ - ltmain_pgi_tp.diff \ + opal_get_version.m4sh \ + ltmain_nag_pthread.diff \ + ltmain_pgi_tp.diff \ ompi_mca_priority_sort.pl maintainer-clean-local: diff --git a/config/ltmain_nag_pthread.diff b/config/ltmain_nag_pthread.diff new file mode 100644 index 0000000000..bba4d09b02 --- /dev/null +++ b/config/ltmain_nag_pthread.diff @@ -0,0 +1,18 @@ +--- config/ltmain.sh ++++ config/ltmain.sh +@@ -6417,8 +6417,14 @@ + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" ++ # and "-pthread" to "-Wl,-pthread" if NAG compiler + if test -n "$inherited_linker_flags"; then +- tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` ++ case "$CC" in ++ nagfor*) ++ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g' | $SED 's/-pthread/-Wl,-pthread'`;; ++ *) ++ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`;; ++ esac + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; diff --git a/config/ompi_setup_fc.m4 b/config/ompi_setup_fc.m4 index 1165b21de5..7cff394147 100644 --- a/config/ompi_setup_fc.m4 +++ b/config/ompi_setup_fc.m4 @@ -14,6 +14,8 @@ dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights dnl reserved. dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. dnl Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. +dnl Copyright (c) 2016 Research Organization for Information Science +dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -41,7 +43,7 @@ AC_DEFUN_ONCE([_OMPI_SETUP_FC_COMPILER],[ # Fortran compilers (excluding the f77 compiler names) from AC's # default list of compilers and use it here. This is the main # reason we have an OMPI-ized version of the PROG_FC macro. - AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgfortran pgf95 lf95 f90 xlf90 pgf90 epcf90]) + AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgfortran pgf95 lf95 f90 xlf90 pgf90 epcf90 nagfor]) FCFLAGS="$ompi_fcflags_save" OPAL_VAR_SCOPE_POP ]) @@ -107,7 +109,29 @@ AC_DEFUN([OMPI_SETUP_FC],[ ;; esac]) AC_SUBST(OMPI_FORTRAN_EXTRA_SHARED_LIBRARY_FLAGS) - + + # The Absoft compiler does not like the fact that we use lots of + # "ignore TKR" comment pragmas that it doesn't understand, and + # will warn about them. From Tony Goetz at Absoft, we can use the + # -Z790 flag to quell these warnings. + # The NAG compiler is too picky about naming conventions, so use the + # -mismatch flag to keep it happy + AC_MSG_CHECKING([for $FC warnings flags]) + fc_version=`$FC --version 2>&1` + case "$fc_version" in + *Absoft*) + AC_MSG_RESULT([-Z790]) + FCFLAGS="$FCFLAGS -Z790" + ;; + *NAG*) + AC_MSG_RESULT([-mismatch]) + FCFLAGS="$FCFLAGS -mismatch" + ;; + *) + AC_MSG_RESULT([none]) + ;; + esac + # If we're still good, then save the extra file types. Do this last # because it implies tests that should be invoked by the above tests # (e.g., running the fortran compiler). diff --git a/config/opal_setup_wrappers.m4 b/config/opal_setup_wrappers.m4 index a85e08a11f..d666c3f7fa 100644 --- a/config/opal_setup_wrappers.m4 +++ b/config/opal_setup_wrappers.m4 @@ -12,7 +12,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. -dnl Copyright (c) 2015 Research Organization for Information Science +dnl Copyright (c) 2015-2016 Research Organization for Information Science dnl and Technology (RIST). All rights reserved. dnl $COPYRIGHT$ dnl @@ -172,7 +172,33 @@ EOF AS_IF([test -n "$rpath_args"], [WRAPPER_RPATH_SUPPORT=rpath - AC_MSG_RESULT([yes ($rpath_args)])], + cat > $rpath_script < $rpath_outfile + +chmod +x $rpath_outfile +. ./$rpath_outfile +rm -f $rpath_outfile + +# Evaluate \$hardcode_libdir_flag_spec, and substitute in LIBDIR for \$libdir +libdir=LIBDIR +flags="\`eval echo \$hardcode_libdir_flag_spec\`" +echo \$flags + +# Done +exit 0 +EOF + chmod +x $rpath_script + rpath_fc_args=`./$rpath_script` + rm -f $rpath_script + AC_MSG_RESULT([yes ($rpath_args + $rpath_fc_args)])], [WRAPPER_RPATH_SUPPORT=unnecessary AC_MSG_RESULT([yes (no extra flags needed)])]) @@ -191,7 +217,7 @@ EOF # If DT_RUNPATH is supported, then we'll use *both* the RPATH and # RUNPATH flags in the LDFLAGS. AC_DEFUN([OPAL_SETUP_RUNPATH],[ - OPAL_VAR_SCOPE_PUSH([LDFLAGS_save]) + OPAL_VAR_SCOPE_PUSH([LDFLAGS_save rpath_script rpath_outfile wl_fc]) AC_MSG_CHECKING([if linker supports RUNPATH]) # Set the output in $runpath_args @@ -205,6 +231,44 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[ AC_MSG_RESULT([yes (-Wl,--enable-new-dtags)])], [AC_MSG_RESULT([no])]) AC_LANG_POP([C]) + # Output goes into globally-visible $rpath_args. Run this in a + # sub-process so that we don't pollute the current process + # environment. + rpath_script=conftest.$$.sh + rpath_outfile=conftest.$$.out + rm -f $rpath_script $rpath_outfile + cat > $rpath_script < $rpath_outfile + +chmod +x $rpath_outfile +. ./$rpath_outfile +rm -f $rpath_outfile + +wl="\`eval echo \$wl\`" +echo \$wl + +# Done +exit 0 +EOF + chmod +x $rpath_script + wl_fc=`./$rpath_script` + rm -f $rpath_script + + LDFLAGS="$LDFLAGS_save ${wl_fc}--enable-new-dtags" + AC_LANG_PUSH([Fortran]) + AC_LINK_IFELSE([AC_LANG_SOURCE([[program test +end program]])], + [runpath_fc_args="${wl_fc}--enable-new-dtags"], + [runpath_fc_args=""]) + AC_LANG_POP([Fortran]) LDFLAGS=$LDFLAGS_save OPAL_VAR_SCOPE_POP @@ -214,7 +278,7 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[ # for each of them. Then also add in an RPATH for @{libdir} (which # will be replaced by the wrapper compile to the installdir libdir at # runtime), and the RUNPATH args, if we have them. -AC_DEFUN([RPATHIFY_LDFLAGS],[ +AC_DEFUN([RPATHIFY_LDFLAGS_INTERNAL],[ OPAL_VAR_SCOPE_PUSH([rpath_out rpath_dir rpath_tmp]) AS_IF([test "$enable_wrapper_rpath" = "yes" && test "$WRAPPER_RPATH_SUPPORT" != "disabled" && test "$WRAPPER_RPATH_SUPPORT" != "unnecessary"], [ rpath_out="" @@ -222,19 +286,23 @@ AC_DEFUN([RPATHIFY_LDFLAGS],[ case $val in -L*) rpath_dir=`echo $val | cut -c3-` - rpath_tmp=`echo $rpath_args | sed -e s@LIBDIR@$rpath_dir@` + rpath_tmp=`echo ${$2} | sed -e s@LIBDIR@$rpath_dir@` rpath_out="$rpath_out $rpath_tmp" ;; esac done # Now add in the RPATH args for @{libdir}, and the RUNPATH args - rpath_tmp=`echo $rpath_args | sed -e s/LIBDIR/@{libdir}/` - $1="${$1} $rpath_out $rpath_tmp $runpath_args" + rpath_tmp=`echo ${$2} | sed -e s/LIBDIR/@{libdir}/` + $1="${$1} $rpath_out $rpath_tmp ${$3}" ]) OPAL_VAR_SCOPE_POP ]) +AC_DEFUN([RPATHIFY_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_args], [runpath_args])]) + +AC_DEFUN([RPATHIFY_FC_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_fc_args], [runpath_fc_args])]) + dnl dnl Avoid some repetitive code below @@ -430,9 +498,12 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[ AC_MSG_CHECKING([for OMPI LDFLAGS]) OMPI_WRAPPER_EXTRA_LDFLAGS="$ompi_mca_wrapper_extra_ldflags $wrapper_extra_ldflags $with_wrapper_ldflags" + OMPI_WRAPPER_EXTRA_FC_LDFLAGS=$OMPI_WRAPPER_EXTRA_LDFLAGS RPATHIFY_LDFLAGS([OMPI_WRAPPER_EXTRA_LDFLAGS]) AC_SUBST([OMPI_WRAPPER_EXTRA_LDFLAGS]) AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LDFLAGS]) + RPATHIFY_FC_LDFLAGS([OMPI_WRAPPER_EXTRA_FC_LDFLAGS]) + AC_SUBST([OMPI_WRAPPER_EXTRA_FC_LDFLAGS]) # Convert @{libdir} to ${libdir} for pkg-config _OPAL_SETUP_WRAPPER_FINAL_PKGCONFIG([OMPI]) @@ -441,6 +512,7 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[ OMPI_WRAPPER_EXTRA_LIBS="$ompi_mca_wrapper_extra_libs" OPAL_FLAGS_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs]) OMPI_WRAPPER_EXTRA_LIBS="$OMPI_WRAPPER_EXTRA_LIBS $with_wrapper_libs" + OPAL_FLAGS_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$LIBS]) AC_SUBST([OMPI_WRAPPER_EXTRA_LIBS]) AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LIBS]) diff --git a/ompi/tools/wrappers/mpifort-wrapper-data.txt.in b/ompi/tools/wrappers/mpifort-wrapper-data.txt.in index b1b86a42bb..c466217e92 100644 --- a/ompi/tools/wrappers/mpifort-wrapper-data.txt.in +++ b/ompi/tools/wrappers/mpifort-wrapper-data.txt.in @@ -15,8 +15,8 @@ compiler=@FC@ module_option=@OMPI_FC_MODULE_FLAG@ extra_includes= preprocessor_flags= -compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@ -linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@ +compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@ +linker_flags=@OMPI_WRAPPER_EXTRA_FC_LDFLAGS@ # Note that per https://svn.open-mpi.org/trac/ompi/ticket/3422, we # intentionally only link in the MPI libraries (ORTE, OPAL, etc. are # pulled in implicitly) because we intend MPI applications to only use diff --git a/oshmem/tools/wrappers/shmemfort-wrapper-data.txt.in b/oshmem/tools/wrappers/shmemfort-wrapper-data.txt.in index c8f64f93e9..4ebce2a5bf 100644 --- a/oshmem/tools/wrappers/shmemfort-wrapper-data.txt.in +++ b/oshmem/tools/wrappers/shmemfort-wrapper-data.txt.in @@ -23,7 +23,7 @@ compiler_flags_env=FCFLAGS compiler=@FC@ preprocessor_flags= compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@ -linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@ +linker_flags=@OMPI_WRAPPER_EXTRA_FC_LDFLAGS@ # Note that per https://svn.open-mpi.org/trac/ompi/ticket/3422, we # intentionally only link in the SHMEM and MPI libraries (ORTE, OPAL, # etc. are pulled in implicitly) because we intend SHMEM/MPI