Skip to content

Commit 544a2f1

Browse files
committed
configury: fix mpifort and oshmemfort wrapper data
NAG compiler use gcc (and not ld) as a linker, so in order to pass an option to the linker, the flag is -Wl,-Wl,,<option> and not -Wl,<option> Thanks Paul Hargrove for the report
1 parent bbed1d4 commit 544a2f1

File tree

4 files changed

+58
-6
lines changed

4 files changed

+58
-6
lines changed

autogen.pl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,25 @@ sub patch_autotools_output {
977977
$c =~ s/$search_string/$replace_string/;
978978
}
979979

980+
foreach my $tag (("", "_FC")) {
981+
982+
# We have to change the search pattern and substitution on each
983+
# iteration to take into account the tag changing
984+
my $search_string = 'lf95\052.*# Lahey Fortran 8.1\n\s+' .
985+
"whole_archive_flag_spec${tag}=" . '\n\s+' .
986+
"tmp_sharedflag='--shared' ;;" . '\n\s+' .
987+
'xl';
988+
my $replace_string = "lf95*) # Lahey Fortran 8.1
989+
whole_archive_flag_spec${tag}=
990+
tmp_sharedflag='--shared' ;;
991+
nagfor*) # NAGFOR 5.3
992+
tmp_sharedflag='-Wl,-shared';;
993+
xl";
994+
995+
push(@verbose_out, $indent_str . "Patching configure for NAG compiler ($tag)\n");
996+
$c =~ s/$search_string/$replace_string/;
997+
}
998+
980999
# Oracle has apparently begun (as of 12.5-beta) removing the "Sun" branding.
9811000
# So this patch (cumulative over the previous one) is required.
9821001
push(@verbose_out, $indent_str . "Patching configure for Oracle Studio Fortran version strings\n");

config/opal_setup_wrappers.m4

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,33 @@ EOF
172172

173173
AS_IF([test -n "$rpath_args"],
174174
[WRAPPER_RPATH_SUPPORT=rpath
175-
AC_MSG_RESULT([yes ($rpath_args)])],
175+
cat > $rpath_script <<EOF
176+
#!/bin/sh
177+
178+
# Slurp in the libtool config into my environment
179+
180+
# Apparently, "libtoool --config" calls "exit", so we can't source it
181+
# (because if script A sources script B, and B calls "exit", then both
182+
# B and A will exit). Instead, we have to send the output to a file
183+
# and then source that.
184+
$OPAL_TOP_BUILDDIR/libtool --tag=FC --config > $rpath_outfile
185+
186+
chmod +x $rpath_outfile
187+
. ./$rpath_outfile
188+
rm -f $rpath_outfile
189+
190+
# Evaluate \$hardcode_libdir_flag_spec, and substitute in LIBDIR for \$libdir
191+
libdir=LIBDIR
192+
flags="\`eval echo \$hardcode_libdir_flag_spec\`"
193+
echo \$flags
194+
195+
# Done
196+
exit 0
197+
EOF
198+
chmod +x $rpath_script
199+
rpath_fc_args=`./$rpath_script`
200+
rm -f $rpath_script
201+
AC_MSG_RESULT([yes ($rpath_args + $rpath_fc_args)])],
176202
[WRAPPER_RPATH_SUPPORT=unnecessary
177203
AC_MSG_RESULT([yes (no extra flags needed)])])
178204

@@ -214,27 +240,31 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[
214240
# for each of them. Then also add in an RPATH for @{libdir} (which
215241
# will be replaced by the wrapper compile to the installdir libdir at
216242
# runtime), and the RUNPATH args, if we have them.
217-
AC_DEFUN([RPATHIFY_LDFLAGS],[
243+
AC_DEFUN([RPATHIFY_LDFLAGS_INTERNAL],[
218244
OPAL_VAR_SCOPE_PUSH([rpath_out rpath_dir rpath_tmp])
219245
AS_IF([test "$enable_wrapper_rpath" = "yes" && test "$WRAPPER_RPATH_SUPPORT" != "disabled" && test "$WRAPPER_RPATH_SUPPORT" != "unnecessary"], [
220246
rpath_out=""
221247
for val in ${$1}; do
222248
case $val in
223249
-L*)
224250
rpath_dir=`echo $val | cut -c3-`
225-
rpath_tmp=`echo $rpath_args | sed -e s@LIBDIR@$rpath_dir@`
251+
rpath_tmp=`echo ${$2} | sed -e s@LIBDIR@$rpath_dir@`
226252
rpath_out="$rpath_out $rpath_tmp"
227253
;;
228254
esac
229255
done
230256

231257
# Now add in the RPATH args for @{libdir}, and the RUNPATH args
232-
rpath_tmp=`echo $rpath_args | sed -e s/LIBDIR/@{libdir}/`
258+
rpath_tmp=`echo ${$2} | sed -e s/LIBDIR/@{libdir}/`
233259
$1="${$1} $rpath_out $rpath_tmp $runpath_args"
234260
])
235261
OPAL_VAR_SCOPE_POP
236262
])
237263

264+
AC_DEFUN([RPATHIFY_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_args])])
265+
266+
AC_DEFUN([RPATHIFY_FC_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_fc_args])])
267+
238268

239269
dnl
240270
dnl Avoid some repetitive code below
@@ -409,9 +439,12 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
409439

410440
AC_MSG_CHECKING([for OMPI LDFLAGS])
411441
OMPI_WRAPPER_EXTRA_LDFLAGS="$ompi_mca_wrapper_extra_ldflags $wrapper_extra_ldflags $with_wrapper_ldflags"
442+
OMPI_WRAPPER_EXTRA_FC_LDFLAGS=$OMPI_WRAPPER_EXTRA_LDFLAGS
412443
RPATHIFY_LDFLAGS([OMPI_WRAPPER_EXTRA_LDFLAGS])
413444
AC_SUBST([OMPI_WRAPPER_EXTRA_LDFLAGS])
414445
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LDFLAGS])
446+
RPATHIFY_FC_LDFLAGS([OMPI_WRAPPER_EXTRA_FC_LDFLAGS])
447+
AC_SUBST([OMPI_WRAPPER_EXTRA_FC_LDFLAGS])
415448

416449
# Convert @{libdir} to ${libdir} for pkg-config
417450
_OPAL_SETUP_WRAPPER_FINAL_PKGCONFIG([OMPI])

ompi/tools/wrappers/mpifort-wrapper-data.txt.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ compiler_flags_env=FCFLAGS
1414
compiler=@FC@
1515
preprocessor_flags=
1616
compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@
17-
linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@
17+
linker_flags=@OMPI_WRAPPER_EXTRA_FC_LDFLAGS@
1818
# Note that per https://svn.open-mpi.org/trac/ompi/ticket/3422, we
1919
# intentionally only link in the MPI libraries (ORTE, OPAL, etc. are
2020
# pulled in implicitly) because we intend MPI applications to only use

oshmem/tools/wrappers/shmemfort-wrapper-data.txt.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ compiler_flags_env=FCFLAGS
2323
compiler=@FC@
2424
preprocessor_flags=
2525
compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@
26-
linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@
26+
linker_flags=@OMPI_WRAPPER_EXTRA_FC_LDFLAGS@
2727
# Note that per https://svn.open-mpi.org/trac/ompi/ticket/3422, we
2828
# intentionally only link in the SHMEM and MPI libraries (ORTE, OPAL,
2929
# etc. are pulled in implicitly) because we intend SHMEM/MPI

0 commit comments

Comments
 (0)