1
1

Merge pull request #1295 from ggouaillardet/poc/nag_configury

configury: add support for NAG compilers
Этот коммит содержится в:
Gilles Gouaillardet 2016-06-06 13:42:49 +09:00
родитель c976559877 dc5adc5a91
Коммит 01591626b3
7 изменённых файлов: 134 добавлений и 11 удалений

Просмотреть файл

@ -901,10 +901,15 @@ sub patch_autotools_output {
# enough Libtool that dosn't need this patch. But don't alarm the
# user and make them think that autogen failed if this patch fails --
# make the errors be silent.
# Also patch ltmain.sh for NAG compiler
if (-f "config/ltmain.sh") {
verbose "$indent_str"."Patching PGI compiler version numbers in ltmain.sh\n";
system("$patch_prog -N -p0 < $topdir/config/ltmain_pgi_tp.diff >/dev/null 2>&1");
unlink("config/ltmain.sh.rej");
verbose "$indent_str"."Patching \"-pthread\" option for NAG compiler in ltmain.sh\n";
system("$patch_prog -N -p0 < $topdir/config/ltmain_nag_pthread.diff >/dev/null 2>&1");
unlink("config/ltmain.sh.rej");
}
# If there's no configure script, there's nothing else to do.
@ -977,6 +982,25 @@ sub patch_autotools_output {
$c =~ s/$search_string/$replace_string/;
}
foreach my $tag (("", "_FC")) {
# We have to change the search pattern and substitution on each
# iteration to take into account the tag changing
my $search_string = 'lf95\052.*# Lahey Fortran 8.1\n\s+' .
"whole_archive_flag_spec${tag}=" . '\n\s+' .
"tmp_sharedflag='--shared' ;;" . '\n\s+' .
'xl';
my $replace_string = "lf95*) # Lahey Fortran 8.1
whole_archive_flag_spec${tag}=
tmp_sharedflag='--shared' ;;
nagfor*) # NAGFOR 5.3
tmp_sharedflag='-Wl,-shared';;
xl";
push(@verbose_out, $indent_str . "Patching configure for NAG compiler ($tag)\n");
$c =~ s/$search_string/$replace_string/;
}
# Oracle has apparently begun (as of 12.5-beta) removing the "Sun" branding.
# So this patch (cumulative over the previous one) is required.
push(@verbose_out, $indent_str . "Patching configure for Oracle Studio Fortran version strings\n");

Просмотреть файл

@ -13,6 +13,8 @@
# Copyright (c) 2010 Oracle and/or its affiliates. All rights
# reserved.
# Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
# Copyright (c) 2016 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -23,6 +25,7 @@
EXTRA_DIST = \
distscript.sh \
opal_get_version.m4sh \
ltmain_nag_pthread.diff \
ltmain_pgi_tp.diff \
opal_mca_priority_sort.pl \
find_common_syms

18
config/ltmain_nag_pthread.diff Обычный файл
Просмотреть файл

@ -0,0 +1,18 @@
--- config/ltmain.sh
+++ config/ltmain.sh
@@ -6417,8 +6417,14 @@
func_source "$lib"
# Convert "-framework foo" to "foo.ltframework"
+ # and "-pthread" to "-Wl,-pthread" if NAG compiler
if test -n "$inherited_linker_flags"; then
- tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
+ case "$CC" in
+ nagfor*)
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g' | $SED 's/-pthread/-Wl,-pthread'`;;
+ *)
+ tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`;;
+ esac
for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
case " $new_inherited_linker_flags " in
*" $tmp_inherited_linker_flag "*) ;;

Просмотреть файл

@ -14,7 +14,7 @@ dnl Copyright (c) 2007 Los Alamos National Security, LLC. All rights
dnl reserved.
dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
dnl Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl Copyright (c) 2015-2016 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
@ -43,7 +43,7 @@ AC_DEFUN_ONCE([_OMPI_SETUP_FC_COMPILER],[
# Fortran compilers (excluding the f77 compiler names) from AC's
# default list of compilers and use it here. This is the main
# reason we have an OMPI-ized version of the PROG_FC macro.
AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgfortran pgf95 lf95 f90 xlf90 pgf90 epcf90])
AC_PROG_FC([gfortran f95 fort xlf95 ifort ifc efc pgfortran pgf95 lf95 f90 xlf90 pgf90 epcf90 nagfor])
FCFLAGS="$ompi_fcflags_save"
OPAL_VAR_SCOPE_POP
])
@ -114,6 +114,8 @@ AC_DEFUN([OMPI_SETUP_FC],[
# "ignore TKR" comment pragmas that it doesn't understand, and
# will warn about them. From Tony Goetz at Absoft, we can use the
# -Z790 flag to quell these warnings.
# The NAG compiler is too picky about naming conventions, so use the
# -mismatch flag to keep it happy
AC_MSG_CHECKING([for $FC warnings flags])
fc_version=`$FC --version 2>&1`
case "$fc_version" in
@ -121,6 +123,10 @@ AC_DEFUN([OMPI_SETUP_FC],[
AC_MSG_RESULT([-Z790])
FCFLAGS="$FCFLAGS -Z790"
;;
*NAG*)
AC_MSG_RESULT([-mismatch])
FCFLAGS="$FCFLAGS -mismatch"
;;
*)
AC_MSG_RESULT([none])
;;

Просмотреть файл

@ -12,7 +12,7 @@ dnl Copyright (c) 2004-2005 The Regents of the University of California.
dnl All rights reserved.
dnl Copyright (c) 2006-2010 Oracle and/or its affiliates. All rights reserved.
dnl Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
dnl Copyright (c) 2015 Research Organization for Information Science
dnl Copyright (c) 2015-2016 Research Organization for Information Science
dnl and Technology (RIST). All rights reserved.
dnl $COPYRIGHT$
dnl
@ -172,7 +172,33 @@ EOF
AS_IF([test -n "$rpath_args"],
[WRAPPER_RPATH_SUPPORT=rpath
AC_MSG_RESULT([yes ($rpath_args)])],
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
# Evaluate \$hardcode_libdir_flag_spec, and substitute in LIBDIR for \$libdir
libdir=LIBDIR
flags="\`eval echo \$hardcode_libdir_flag_spec\`"
echo \$flags
# Done
exit 0
EOF
chmod +x $rpath_script
rpath_fc_args=`./$rpath_script`
rm -f $rpath_script
AC_MSG_RESULT([yes ($rpath_args + $rpath_fc_args)])],
[WRAPPER_RPATH_SUPPORT=unnecessary
AC_MSG_RESULT([yes (no extra flags needed)])])
@ -191,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
@ -205,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 <<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
end program]])],
[runpath_fc_args="${wl_fc}--enable-new-dtags"],
[runpath_fc_args=""])
AC_LANG_POP([Fortran])
LDFLAGS=$LDFLAGS_save
OPAL_VAR_SCOPE_POP
@ -214,7 +278,7 @@ AC_DEFUN([OPAL_SETUP_RUNPATH],[
# for each of them. Then also add in an RPATH for @{libdir} (which
# will be replaced by the wrapper compile to the installdir libdir at
# runtime), and the RUNPATH args, if we have them.
AC_DEFUN([RPATHIFY_LDFLAGS],[
AC_DEFUN([RPATHIFY_LDFLAGS_INTERNAL],[
OPAL_VAR_SCOPE_PUSH([rpath_out rpath_dir rpath_tmp])
AS_IF([test "$enable_wrapper_rpath" = "yes" && test "$WRAPPER_RPATH_SUPPORT" != "disabled" && test "$WRAPPER_RPATH_SUPPORT" != "unnecessary"], [
rpath_out=""
@ -222,19 +286,23 @@ AC_DEFUN([RPATHIFY_LDFLAGS],[
case $val in
-L*)
rpath_dir=`echo $val | cut -c3-`
rpath_tmp=`echo $rpath_args | sed -e s@LIBDIR@$rpath_dir@`
rpath_tmp=`echo ${$2} | sed -e s@LIBDIR@$rpath_dir@`
rpath_out="$rpath_out $rpath_tmp"
;;
esac
done
# Now add in the RPATH args for @{libdir}, and the RUNPATH args
rpath_tmp=`echo $rpath_args | sed -e s/LIBDIR/@{libdir}/`
$1="${$1} $rpath_out $rpath_tmp $runpath_args"
rpath_tmp=`echo ${$2} | sed -e s/LIBDIR/@{libdir}/`
$1="${$1} $rpath_out $rpath_tmp ${$3}"
])
OPAL_VAR_SCOPE_POP
])
AC_DEFUN([RPATHIFY_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_args], [runpath_args])])
AC_DEFUN([RPATHIFY_FC_LDFLAGS],[RPATHIFY_LDFLAGS_INTERNAL([$1], [rpath_fc_args], [runpath_fc_args])])
dnl
dnl Avoid some repetitive code below
@ -409,9 +477,12 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
AC_MSG_CHECKING([for OMPI LDFLAGS])
OMPI_WRAPPER_EXTRA_LDFLAGS="$ompi_mca_wrapper_extra_ldflags $wrapper_extra_ldflags $with_wrapper_ldflags"
OMPI_WRAPPER_EXTRA_FC_LDFLAGS=$OMPI_WRAPPER_EXTRA_LDFLAGS
RPATHIFY_LDFLAGS([OMPI_WRAPPER_EXTRA_LDFLAGS])
AC_SUBST([OMPI_WRAPPER_EXTRA_LDFLAGS])
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LDFLAGS])
RPATHIFY_FC_LDFLAGS([OMPI_WRAPPER_EXTRA_FC_LDFLAGS])
AC_SUBST([OMPI_WRAPPER_EXTRA_FC_LDFLAGS])
# Convert @{libdir} to ${libdir} for pkg-config
_OPAL_SETUP_WRAPPER_FINAL_PKGCONFIG([OMPI])
@ -420,6 +491,7 @@ AC_DEFUN([OPAL_SETUP_WRAPPER_FINAL],[
OMPI_WRAPPER_EXTRA_LIBS="$ompi_mca_wrapper_extra_libs"
OPAL_FLAGS_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$wrapper_extra_libs])
OMPI_WRAPPER_EXTRA_LIBS="$OMPI_WRAPPER_EXTRA_LIBS $with_wrapper_libs"
OPAL_FLAGS_APPEND_UNIQ([OMPI_WRAPPER_EXTRA_LIBS], [$LIBS])
AC_SUBST([OMPI_WRAPPER_EXTRA_LIBS])
AC_MSG_RESULT([$OMPI_WRAPPER_EXTRA_LIBS])

Просмотреть файл

@ -14,7 +14,7 @@ compiler_flags_env=FCFLAGS
compiler=@FC@
preprocessor_flags=
compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@
linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@
linker_flags=@OMPI_WRAPPER_EXTRA_FC_LDFLAGS@
# Note that per https://svn.open-mpi.org/trac/ompi/ticket/3422, we
# intentionally only link in the MPI libraries (ORTE, OPAL, etc. are
# pulled in implicitly) because we intend MPI applications to only use

Просмотреть файл

@ -23,7 +23,7 @@ compiler_flags_env=FCFLAGS
compiler=@FC@
preprocessor_flags=
compiler_flags=@OMPI_WRAPPER_EXTRA_FCFLAGS@
linker_flags=@OMPI_WRAPPER_EXTRA_LDFLAGS@
linker_flags=@OMPI_WRAPPER_EXTRA_FC_LDFLAGS@
# Note that per https://svn.open-mpi.org/trac/ompi/ticket/3422, we
# intentionally only link in the SHMEM and MPI libraries (ORTE, OPAL,
# etc. are pulled in implicitly) because we intend SHMEM/MPI