Skip to content

Commit 1fd5fbd

Browse files
committed
mpifort: only -lompi_mpifh if Fortran bindings built
We will install mpifort (and friends) if we find a Fortran compiler, even if we're not building the Fortran MPI bindings (e.g., if gfortran is available, but the user specified --disable-mpi-fortran). NOTE: the user can explicitly disable installing mpifort (and friends) -- even if there is a Fortran compiler available -- via: ./configure FC=no ... Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
1 parent e1df5de commit 1fd5fbd

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

config/ompi_setup_mpi_fortran.m4

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,18 @@ end type test_mpi_handle],
649649
[$OMPI_FORTRAN_HAVE_STORAGE_SIZE],
650650
[Whether the compiler supports STORAGE_SIZE on relevant types])
651651

652+
# This token is used in the mpifort wrapper compiler data file.
653+
# If we are building the Fortran bindings, then include
654+
# -lompi_mpifh in the link line. If we're not building the
655+
# Fortran bindings, then do not include that token in the link
656+
# line (because we'll still install mpifort to link Fortran
657+
# applications with the C bindings, even if the Fortran MPI
658+
# bindings are not being built).
659+
AS_IF([test $OMPI_BUILD_FORTRAN_BINDINGS -gt $OMPI_FORTRAN_NO_BINDINGS],
660+
[OMPI_FORTRAN_MPIFH_LINK=-l${OMPI_LIBMPI_NAME}_mpifh],
661+
[OMPI_FORTRAN_MPIFH_LINK=])
662+
AC_SUBST(OMPI_FORTRAN_MPIFH_LINK)
663+
652664
# This conditional is used to determine whether we compile the
653665
# various .f90 files that contain MPI_SIZEOF implementations.
654666
AM_CONDITIONAL([BUILD_FORTRAN_SIZEOF],

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ linker_flags=@OMPI_WRAPPER_EXTRA_FC_LDFLAGS@
1919
# intentionally only link in the MPI libraries (OPAL, etc. are
2020
# pulled in implicitly) because we intend MPI applications to only use
2121
# the MPI API.
22-
libs=@OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ -l@OMPI_LIBMPI_NAME@_mpifh -l@OMPI_LIBMPI_NAME@
23-
libs_static=@OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ -l@OMPI_LIBMPI_NAME@_mpifh -l@OMPI_LIBMPI_NAME@ -l@OPAL_LIB_PREFIX@open-pal @OMPI_WRAPPER_EXTRA_LIBS@
22+
libs=@OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ @OMPI_FORTRAN_MPIFH_LINK@ -l@OMPI_LIBMPI_NAME@
23+
libs_static=@OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ @OMPI_FORTRAN_MPIFH_LINK@ -l@OMPI_LIBMPI_NAME@ -l@OPAL_LIB_PREFIX@open-pal @OMPI_WRAPPER_EXTRA_LIBS@
2424
dyn_lib_file=lib@OMPI_LIBMPI_NAME@.@OPAL_DYN_LIB_SUFFIX@
2525
static_lib_file=lib@OMPI_LIBMPI_NAME@.a
2626
required_file=@OMPI_WRAPPER_FORTRAN_REQUIRED_FILE@

ompi/tools/wrappers/ompi-fort.pc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ pkgincludedir=@opalincludedir@
1616
# static linking (they're pulled in by libopen-rte.so's implicit
1717
# dependencies), so only list these in Libs.private.
1818
#
19-
Libs: -L${libdir} @OMPI_PKG_CONFIG_LDFLAGS@ @OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ -l@OMPI_LIBMPI_NAME@_mpifh -l@OMPI_LIBMPI_NAME@
19+
Libs: -L${libdir} @OMPI_PKG_CONFIG_LDFLAGS@ @OMPI_FORTRAN_USEMPIF08_LIB@ @OMPI_FORTRAN_USEMPI_LIB@ @OMPI_FORTRAN_MPIFH_LINK@ -l@OMPI_LIBMPI_NAME@
2020
Libs.private: -lopen-rte -lopen-pal @OMPI_WRAPPER_EXTRA_LIBS@
2121
Cflags: -I${includedir} @OMPI_WRAPPER_EXTRA_CPPFLAGS@ @OMPI_WRAPPER_EXTRA_FCFLAGS@

0 commit comments

Comments
 (0)