Skip to content

Commit

Permalink
configury: add option to disable enable-new-dtags
Browse files Browse the repository at this point in the history
The --enable-new-dtags option for the compiler wrappers is
often great, but for some particular install/usage scenarios
causes issues.

This commit provides a new configury option to use of rpath
in the compiler wrappers, but disables the
use of --enable-new-dtags in the link line.

The new configury option is

--enable-wrappers-runpath

To disable use of --enable-new-dtags in the wrappers, add

--disable-wrappers-runpath

to the Open MPI configury line.

Fixes #1089

Signed-off-by: Howard Pritchard <[email protected]>
(cherry picked from commit ebb30c1)
  • Loading branch information
hppritcha committed Oct 5, 2019
1 parent 317d3e9 commit db88ba1
Showing 1 changed file with 35 additions and 6 deletions.
41 changes: 35 additions & 6 deletions config/opal_setup_wrappers.m4
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_INIT],[

AC_MSG_CHECKING([if want wrapper compiler runpath support])
AC_ARG_ENABLE([wrapper-runpath],
[AS_HELP_STRING([--enable-wrapper-runpath],
[AS_HELP_STRING([--enable--wrapper-runpath],
[enable runpath in the wrapper compilers if linker supports it (default: enabled, unless wrapper-rpath is disabled).])])
AS_IF([test "$enable_wrapper_runpath" != "no"], [enable_wrapper_runpath=yes])
AC_MSG_RESULT([$enable_wrapper_runpath])
Expand Down Expand Up @@ -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 <<EOF
#!/bin/sh

# Slurp in the libtool config into my environment

# Apparently, "libtoool --config" calls "exit", so we can't source it
# (because if script A sources script B, and B calls "exit", then both
# B and A will exit). Instead, we have to send the output to a file
# and then source that.
$OPAL_TOP_BUILDDIR/libtool --tag=FC --config > $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=""])
Expand Down

0 comments on commit db88ba1

Please sign in to comment.