From 9f345bd22f72583d3cbcffad10a4ee1ca062610e Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Fri, 21 Aug 2015 07:26:11 -0700 Subject: [PATCH] fortran: moar fixes for the Fortran MPI_SIZEOF debacle Ensure to define ompi/pompi versions for platforms that don't have weak symbols. Also make fortran/mpif-h/profile build a separate sizeof library, just like fortran/mpifh-h does. --- ompi/mpi/fortran/base/gen-mpi-sizeof.pl | 14 +++++++++++--- ompi/mpi/fortran/mpif-h/profile/Makefile.am | 18 ++++++++++++++++-- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/ompi/mpi/fortran/base/gen-mpi-sizeof.pl b/ompi/mpi/fortran/base/gen-mpi-sizeof.pl index 1d3b914482..d4fe34402a 100755 --- a/ompi/mpi/fortran/base/gen-mpi-sizeof.pl +++ b/ompi/mpi/fortran/base/gen-mpi-sizeof.pl @@ -227,16 +227,24 @@ sub output_file { ! compiler to build Open MPI.\n\n"; if ($want_bodies) { + my $name = "ompi_sad_panda"; + $name = "pompi_sad_panda" + if ($pmpi_arg); print OUT "! ! Dummy subroutine, just so that there is *some* Fortran in this file -! (some compilers are unhappy if there are no Fortran statements in this +! (this is defensive programming: since the Fortran compiler doesn't +! support enough mojo, configure should set some AM_CONDITIONALs such +! that this file should not end up being compiled, but just in case +! that logic changes someday and this file *does* end up getting +! compiled, make sure that it's not entirely empty because some +! compilers are unhappy if there are no Fortran statements in this ! file). -subroutine ompi_sad_panda() +subroutine $name() implicit none print *, 'Open MPI is a sad panda because your Fortran compiler' print *, 'does not support enough Fortran mojo for MPI_SIZEOF' -end subroutine ompi_sad_panda\n\n"; +end subroutine $name\n\n"; } } diff --git a/ompi/mpi/fortran/mpif-h/profile/Makefile.am b/ompi/mpi/fortran/mpif-h/profile/Makefile.am index 7c0002ddfb..c3ef50362a 100644 --- a/ompi/mpi/fortran/mpif-h/profile/Makefile.am +++ b/ompi/mpi/fortran/mpif-h/profile/Makefile.am @@ -10,7 +10,7 @@ # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. -# Copyright (c) 2009-2014 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved. # Copyright (c) 2011-2013 Inria. All rights reserved. # Copyright (c) 2011-2013 Universite Bordeaux 1 # Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights @@ -26,6 +26,9 @@ include $(top_srcdir)/Makefile.ompi-rules +CLEANFILES= +libmpi_mpifh_pmpi_la_LIBADD = + # # OMPI_PROFILING_DEFINES flag is enabled when we want our MPI_* symbols # to be replaced by PMPI_*. In other words, this flag decides @@ -432,7 +435,19 @@ $(linked_files): # psizeof_f.f90 is generated based on some results from configure tests. CLEANFILES += psizeof_f.f90 + +# Build the MPI_SIZEOF code in a separate convenience library (see +# lengthy comment in ompi/mpi/fortran/mpif-h/Makefile.am for an +# explanation why). +#if BUILD_FORTRAN_SIZEOF +noinst_LTLIBRARIES += libmpi_mpifh_psizeof.la +# Do not dist this file; it is generated +nodist_libmpi_mpifh_psizeof_la_SOURCES = psizeof_f.f90 +libmpi_mpifh_pmpi_la_LIBADD += libmpi_mpifh_psizeof.la +#endif + sizeof_pl=$(top_srcdir)/ompi/mpi/fortran/base/gen-mpi-sizeof.pl + psizeof_f.f90: $(top_builddir)/config.status psizeof_f.f90: $(sizeof_pl) psizeof_f.f90: @@ -447,7 +462,6 @@ psizeof_f.f90: # The library itself # nodist_libmpi_mpifh_pmpi_la_SOURCES = \ - psizeof_f.f90 \ $(linked_files) # Conditionally install the header files