diff --git a/config/opal_setup_wrappers.m4 b/config/opal_setup_wrappers.m4 index 6a3be1fc80b..73c16fc36b8 100644 --- a/config/opal_setup_wrappers.m4 +++ b/config/opal_setup_wrappers.m4 @@ -227,12 +227,41 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[ AC_MSG_RESULT([yes (-Wl,--enable-new-dtags)])], [AC_MSG_RESULT([no])]) AC_LANG_POP([C])]) - m4_ifdef([project_ompi],[ - OPAL_LIBTOOL_CONFIG([wl],[wl_fc],[--tag=FC],[]) +m4_ifdef([project_ompi],[ + # 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 + 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=""])