From dc5adc5a91b4682a8e0de492350745eb01fa37d0 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 13 Jan 2016 11:58:14 +0900 Subject: [PATCH] configury: pass -Wl,-Wl,,--enable-new-dtags when NAG compiler is used for linking Thanks Paul Hargrove for the report --- config/opal_setup_wrappers.m4 | 46 ++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/config/opal_setup_wrappers.m4 b/config/opal_setup_wrappers.m4 index fa7aa9cd7b..9b5052b5cc 100644 --- a/config/opal_setup_wrappers.m4 +++ b/config/opal_setup_wrappers.m4 @@ -217,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 @@ -231,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 @@ -256,14 +294,14 @@ AC_DEFUN([RPATHIFY_LDFLAGS_INTERNAL],[ # Now add in the RPATH args for @{libdir}, and the RUNPATH args rpath_tmp=`echo ${$2} | sed -e s/LIBDIR/@{libdir}/` - $1="${$1} $rpath_out $rpath_tmp $runpath_args" + $1="${$1} $rpath_out $rpath_tmp ${$3}" ]) OPAL_VAR_SCOPE_POP ]) -AC_DEFUN([RPATHIFY_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_args])]) +AC_DEFUN([RPATHIFY_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_args], [runpath_args])]) -AC_DEFUN([RPATHIFY_FC_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_fc_args])]) +AC_DEFUN([RPATHIFY_FC_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_fc_args], [runpath_fc_args])]) dnl