Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit d99bdc6

Browse files
author
rhc54
authored
Merge pull request #1216 from ggouaillardet/topic/v1.10/nag_configury
Topic/v1.10/nag configury
2 parents 60e9b26 + b9f647f commit d99bdc6

File tree

7 files changed

+155
-14
lines changed

7 files changed

+155
-14
lines changed

autogen.pl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,10 +899,15 @@ sub patch_autotools_output {
899899
# enough Libtool that dosn't need this patch. But don't alarm the
900900
# user and make them think that autogen failed if this patch fails --
901901
# make the errors be silent.
902+
# Also patch ltmain.sh for NAG compiler
902903
if (-f "config/ltmain.sh") {
903904
verbose "$indent_str"."Patching PGI compiler version numbers in ltmain.sh\n";
904905
system("$patch_prog -N -p0 < $topdir/config/ltmain_pgi_tp.diff >/dev/null 2>&1");
905906
unlink("config/ltmain.sh.rej");
907+
908+
verbose "$indent_str"."Patching \"-pthread\" option for NAG compiler in ltmain.sh\n";
909+
system("$patch_prog -N -p0 < $topdir/config/ltmain_nag_pthread.diff >/dev/null 2>&1");
910+
unlink("config/ltmain.sh.rej");
906911
}
907912

908913
# Total ugh. We have to patch the configure script itself. See below
@@ -969,6 +974,25 @@ sub patch_autotools_output {
969974
$c =~ s/$search_string/$replace_string/;
970975
}
971976

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

config/Makefile.am

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# Copyright (c) 2006-2015 Cisco Systems, Inc. All rights reserved.
1313
# Copyright (c) 2010 Oracle and/or its affiliates. All rights
1414
# reserved.
15+
# Copyright (c) 2016 Research Organization for Information Science
16+
# and Technology (RIST). All rights reserved.
1517
# $COPYRIGHT$
1618
#
1719
# Additional copyrights may follow
@@ -21,8 +23,9 @@
2123

2224
EXTRA_DIST = \
2325
distscript.csh \
24-
opal_get_version.m4sh \
25-
ltmain_pgi_tp.diff \
26+
opal_get_version.m4sh \
27+
ltmain_nag_pthread.diff \
28+
ltmain_pgi_tp.diff \
2629
ompi_mca_priority_sort.pl
2730

2831
maintainer-clean-local:

config/ltmain_nag_pthread.diff

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--- config/ltmain.sh
2+
+++ config/ltmain.sh
3+
@@ -6417,8 +6417,14 @@
4+
func_source "$lib"
5+
6+
# Convert "-framework foo" to "foo.ltframework"
7+
+ # and "-pthread" to "-Wl,-pthread" if NAG compiler
8+
if test -n "$inherited_linker_flags"; then
9+
- tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
10+
+ case "$CC" in
11+
+ nagfor*)
12+
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g' | $SED 's/-pthread/-Wl,-pthread'`;;
13+
+ *)
14+
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`;;
15+
+ esac
16+
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
17+
case " $new_inherited_linker_flags " in
18+
*" $tmp_inherited_linker_flag "*) ;;

config/ompi_setup_fc.m4

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
1414
dnl reserved.
1515
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
1616
dnl Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
17+
dnl Copyright (c) 2016 Research Organization for Information Science
18+
dnl and Technology (RIST). All rights reserved.
1719
dnl $COPYRIGHT$
1820
dnl
1921
dnl Additional copyrights may follow
@@ -41,7 +43,7 @@ AC_DEFUN_ONCE([_OMPI_SETUP_FC_COMPILER],[
4143
# Fortran compilers (excluding the f77 compiler names) from AC's
4244
# default list of compilers and use it here. This is the main
4345
# reason we have an OMPI-ized version of the PROG_FC macro.
44-
AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgfortran pgf95 lf95 f90 xlf90 pgf90 epcf90])
46+
AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgfortran pgf95 lf95 f90 xlf90 pgf90 epcf90 nagfor])
4547
FCFLAGS="$ompi_fcflags_save"
4648
OPAL_VAR_SCOPE_POP
4749
])
@@ -107,7 +109,29 @@ AC_DEFUN([OMPI_SETUP_FC],[
107109
;;
108110
esac])
109111
AC_SUBST(OMPI_FORTRAN_EXTRA_SHARED_LIBRARY_FLAGS)
110-
112+
113+
# The Absoft compiler does not like the fact that we use lots of
114+
# "ignore TKR" comment pragmas that it doesn't understand, and
115+
# will warn about them. From Tony Goetz at Absoft, we can use the
116+
# -Z790 flag to quell these warnings.
117+
# The NAG compiler is too picky about naming conventions, so use the
118+
# -mismatch flag to keep it happy
119+
AC_MSG_CHECKING([for $FC warnings flags])
120+
fc_version=`$FC --version 2>&1`
121+
case "$fc_version" in
122+
*Absoft*)
123+
AC_MSG_RESULT([-Z790])
124+
FCFLAGS="$FCFLAGS -Z790"
125+
;;
126+
*NAG*)
127+
AC_MSG_RESULT([-mismatch])
128+
FCFLAGS="$FCFLAGS -mismatch"
129+
;;
130+
*)
131+
AC_MSG_RESULT([none])
132+
;;
133+
esac
134+
111135
# If we're still good, then save the extra file types. Do this last
112136
# because it implies tests that should be invoked by the above tests
113137
# (e.g., running the fortran compiler).

config/opal_setup_wrappers.m4

Lines changed: 79 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California.
1212
dnl All rights reserved.
1313
dnl Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved.
1414
dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
15-
dnl Copyright (c) 2015 Research Organization for Information Science
15+
dnl Copyright (c) 2015-2016 Research Organization for Information Science
1616
dnl and Technology (RIST). All rights reserved.
1717
dnl $COPYRIGHT$
1818
dnl
@@ -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

@@ -191,7 +217,7 @@ EOF
191217
# If DT_RUNPATH is supported, then we'll use *both* the RPATH and
192218
# RUNPATH flags in the LDFLAGS.
193219
AC_DEFUN([OPAL_SETUP_RUNPATH],[
194-
OPAL_VAR_SCOPE_PUSH([LDFLAGS_save])
220+
OPAL_VAR_SCOPE_PUSH([LDFLAGS_save rpath_script rpath_outfile wl_fc])
195221

196222
AC_MSG_CHECKING([if linker supports RUNPATH])
197223
# Set the output in $runpath_args
@@ -205,6 +231,44 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[
205231
AC_MSG_RESULT([yes (-Wl,--enable-new-dtags)])],
206232
[AC_MSG_RESULT([no])])
207233
AC_LANG_POP([C])
234+
# Output goes into globally-visible $rpath_args. Run this in a
235+
# sub-process so that we don't pollute the current process
236+
# environment.
237+
rpath_script=conftest.$$.sh
238+
rpath_outfile=conftest.$$.out
239+
rm -f $rpath_script $rpath_outfile
240+
cat > $rpath_script <<EOF
241+
#!/bin/sh
242+
243+
# Slurp in the libtool config into my environment
244+
245+
# Apparently, "libtoool --config" calls "exit", so we can't source it
246+
# (because if script A sources script B, and B calls "exit", then both
247+
# B and A will exit). Instead, we have to send the output to a file
248+
# and then source that.
249+
$OPAL_TOP_BUILDDIR/libtool --tag=FC--config > $rpath_outfile
250+
251+
chmod +x $rpath_outfile
252+
. ./$rpath_outfile
253+
rm -f $rpath_outfile
254+
255+
wl="\`eval echo \$wl\`"
256+
echo \$wl
257+
258+
# Done
259+
exit 0
260+
EOF
261+
chmod +x $rpath_script
262+
wl_fc=`./$rpath_script`
263+
rm -f $rpath_script
264+
265+
LDFLAGS="$LDFLAGS_save ${wl_fc}--enable-new-dtags"
266+
AC_LANG_PUSH([Fortran])
267+
AC_LINK_IFELSE([AC_LANG_SOURCE([[program test
268+
end program]])],
269+
[runpath_fc_args="${wl_fc}--enable-new-dtags"],
270+
[runpath_fc_args=""])
271+
AC_LANG_POP([Fortran])
208272
LDFLAGS=$LDFLAGS_save
209273

210274
OPAL_VAR_SCOPE_POP
@@ -214,27 +278,31 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[
214278
# for each of them. Then also add in an RPATH for @{libdir} (which
215279
# will be replaced by the wrapper compile to the installdir libdir at
216280
# runtime), and the RUNPATH args, if we have them.
217-
AC_DEFUN([RPATHIFY_LDFLAGS],[
281+
AC_DEFUN([RPATHIFY_LDFLAGS_INTERNAL],[
218282
OPAL_VAR_SCOPE_PUSH([rpath_out rpath_dir rpath_tmp])
219283
AS_IF([test "$enable_wrapper_rpath" = "yes" && test "$WRAPPER_RPATH_SUPPORT" != "disabled" && test "$WRAPPER_RPATH_SUPPORT" != "unnecessary"], [
220284
rpath_out=""
221285
for val in ${$1}; do
222286
case $val in
223287
-L*)
224288
rpath_dir=`echo $val | cut -c3-`
225-
rpath_tmp=`echo $rpath_args | sed -e s@LIBDIR@$rpath_dir@`
289+
rpath_tmp=`echo ${$2} | sed -e s@LIBDIR@$rpath_dir@`
226290
rpath_out="$rpath_out $rpath_tmp"
227291
;;
228292
esac
229293
done
230294

231295
# Now add in the RPATH args for @{libdir}, and the RUNPATH args
232-
rpath_tmp=`echo $rpath_args | sed -e s/LIBDIR/@{libdir}/`
233-
$1="${$1} $rpath_out $rpath_tmp $runpath_args"
296+
rpath_tmp=`echo ${$2} | sed -e s/LIBDIR/@{libdir}/`
297+
$1="${$1} $rpath_out $rpath_tmp ${$3}"
234298
])
235299
OPAL_VAR_SCOPE_POP
236300
])
237301

302+
AC_DEFUN([RPATHIFY_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_args], [runpath_args])])
303+
304+
AC_DEFUN([RPATHIFY_FC_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_fc_args], [runpath_fc_args])])
305+
238306

239307
dnl
240308
dnl Avoid some repetitive code below
@@ -430,9 +498,12 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
430498

431499
AC_MSG_CHECKING([for OMPI LDFLAGS])
432500
OMPI_WRAPPER_EXTRA_LDFLAGS="$ompi_mca_wrapper_extra_ldflags $wrapper_extra_ldflags $with_wrapper_ldflags"
501+
OMPI_WRAPPER_EXTRA_FC_LDFLAGS=$OMPI_WRAPPER_EXTRA_LDFLAGS
433502
RPATHIFY_LDFLAGS([OMPI_WRAPPER_EXTRA_LDFLAGS])
434503
AC_SUBST([OMPI_WRAPPER_EXTRA_LDFLAGS])
435504
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LDFLAGS])
505+
RPATHIFY_FC_LDFLAGS([OMPI_WRAPPER_EXTRA_FC_LDFLAGS])
506+
AC_SUBST([OMPI_WRAPPER_EXTRA_FC_LDFLAGS])
436507

437508
# Convert @{libdir} to ${libdir} for pkg-config
438509
_OPAL_SETUP_WRAPPER_FINAL_PKGCONFIG([OMPI])
@@ -441,6 +512,7 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
441512
OMPI_WRAPPER_EXTRA_LIBS="$ompi_mca_wrapper_extra_libs"
442513
OPAL_FLAGS_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs])
443514
OMPI_WRAPPER_EXTRA_LIBS="$OMPI_WRAPPER_EXTRA_LIBS $with_wrapper_libs"
515+
OPAL_FLAGS_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$LIBS])
444516
AC_SUBST([OMPI_WRAPPER_EXTRA_LIBS])
445517
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LIBS])
446518

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ compiler=@FC@
1515
module_option=@OMPI_FC_MODULE_FLAG@
1616
extra_includes=
1717
preprocessor_flags=
18-
compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@
19-
linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@
18+
compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@
19+
linker_flags=@OMPI_WRAPPER_EXTRA_FC_LDFLAGS@
2020
# Note that per https://svn.open-mpi.org/trac/ompi/ticket/3422, we
2121
# intentionally only link in the MPI libraries (ORTE, OPAL, etc. are
2222
# 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)