diff --git a/NEWS b/NEWS index 08da1df533..fe81062700 100644 --- a/NEWS +++ b/NEWS @@ -25,13 +25,16 @@ version 1.0. 1.2 --- +- Allow building the F90 MPI bindings as shared libraries for most + compilers / platforms. Explicitly disallow building the F90 + bindings as shared libraries on OS X because of complicated + situations with Fortran common blocks and lack of support for + unresolved common symbols in shared libraries. - Addition of "dr" (data reliability) PML. - Added stacktrace support for Solaris and Mac OS X. - Update event library to libevent-1.1a - Fixed standards conformance issues with MPI_ERR_TRUNCATED and setting MPI_ERROR during MPI_TEST/MPI_WAIT. -- Added support for building the Fortran 90 bindings library as - a shared library. - Addition of "cm" PML to better support library-level matching interconnects, with initial support for Myrinet/MX and Portals. - Really check that the $CXX given to configure is a C++ compiler diff --git a/config/ompi_setup_f90.m4 b/config/ompi_setup_f90.m4 index 0e08f2cab6..6d9aa4a8ec 100644 --- a/config/ompi_setup_f90.m4 +++ b/config/ompi_setup_f90.m4 @@ -112,6 +112,39 @@ AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1], fi ]) +# BWB - FIX ME - remove once everyone updates to LT 2.0. +# +AS_IF([test $OMPI_WANT_F90_BINDINGS -eq 1], + [if test $OMPI_F77 != $OMPI_F90; then + lt_ver=`grep '^VERSION' $srcdir/config/ltmain.sh | cut -f2 -d= | cut -f1 -d'.'` + if test $lt_ver -lt 2 ; then + AC_MSG_ERROR([You appear to be trying to build the Fortran 90 + layer with Libtool 1.5.x or earlier and a Fortran 77 / Fortran 90 compiler + combination that will not work with this configuration. You must either + use a different Fortran 77 / Fortran 90 compiler (one where it is the same + compiler for both languages), upgrade to Libtool 2.x, or disable the + Fortran 90 bindings.]) + fi + fi + ]) + +# OS X does not allow undefined common symbols in shared libraries. +# Because we can't figure out how to implement MPI_STATUSES_IGNORE and +# friends wihtout common symbols, on OS X we can't build the F90 +# bindings as a shared library. +AC_MSG_CHECKING([if need to force static library]) +case "$host" in + *apple-darwin*) + AC_MSG_RESULT([yes]) + ompi_f90_force_static="yes" + ;; + *) + AC_MSG_RESULT([no]) + ompi_f90_force_static="no" + ;; +esac +AM_CONDITIONAL(OMPI_F90_FORCE_STATIC, test "$ompi_f90_force_static" = "yes") + # if we're still good, then save the extra file types. Do this last # because it implies tests that should be invoked by the above tests # (e.g., running the fortran compiler). diff --git a/config/ompi_setup_wrappers.m4 b/config/ompi_setup_wrappers.m4 index 0c5cb3ef24..d068f91d69 100644 --- a/config/ompi_setup_wrappers.m4 +++ b/config/ompi_setup_wrappers.m4 @@ -255,7 +255,7 @@ AC_DEFUN([OMPI_SETUP_WRAPPER_FINAL],[ AC_SUBST([OMPI_WRAPPER_F77_REQUIRED_FILE]) if test "$OMPI_WANT_F90_BINDINGS" = "1" ; then - OMPI_WRAPPER_F90_REQUIRED_FILE="libmpi_f90.a" + OMPI_WRAPPER_F90_REQUIRED_FILE="libmpi_f90.la" else OMPI_WRAPPER_F90_REQUIRED_FILE="not supported" fi diff --git a/ompi/mpi/f90/Makefile.am b/ompi/mpi/f90/Makefile.am index d483085501..1561cf89d8 100644 --- a/ompi/mpi/f90/Makefile.am +++ b/ompi/mpi/f90/Makefile.am @@ -50,33 +50,19 @@ SUBDIRS = scripts -AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include $(OMPI_FC_MODULE_FLAG). -I$(srcdir) - -# Override the default f90 rules because we have to insert -# $(FCFLAGS_f90) right before the source filename. This is necessary -# for cases where the compiler expects source files to end in .f, and -# if we want our .f90 files to be compilable, we have to insert a -# special flag right before the source filename (e.g., xlf). - -.f90.o: - $(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) $< - -.f90.obj: - $(FCCOMPILE) -c -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'` - -.f90.lo: - $(LTFCCOMPILE) -c -o $@ $(FCFLAGS_f90) $< - +AM_FCFLAGS = -I$(top_builddir)/ompi/include -I$(top_srcdir)/ompi/include \ + $(OMPI_FC_MODULE_FLAG). -I$(srcdir) \ + -I$(top_builddir)/ompi/mpi/f90 # Do different things if the top-level configure decided that we're # going to build F90 bindings or not. -lib_LIBRARIES = +lib_LTLIBRARIES = if OMPI_WANT_F90_BINDINGS # Add the f90 library to the list of libraries to build -lib_LIBRARIES += libmpi_f90.a +lib_LTLIBRARIES += libmpi_f90.la # Ensure that the F90 interfaces are re-generated based on the values # that come in from configure @@ -107,7 +93,7 @@ mpi-f90-interfaces.h: $(srcdir)/scripts/mpi-f90-interfaces.h.sh # So we have to pass in the pwd to the scripts so that they know where # some_script is. -$(nodist_libmpi_f90_a_SOURCES): fortran_kinds.sh +$(nodist_libmpi_f90_la_SOURCES): fortran_kinds.sh @ p="`pwd`"; \ echo $(srcdir)/scripts/$@.sh $$p \> $@; \ $(srcdir)/scripts/$@.sh $$p > $@ ; @@ -143,15 +129,17 @@ mpi.obj: mpi.f90 mpi-f90-interfaces.h @echo "***************************************************************" $(FCCOMPILE) -c -I. -o $@ $(FCFLAGS_f90) `$(CYGPATH_W) '$<'` +BUILT_SOURCES = mpi-f90-interfaces.h + else -lib_LIBRARIES += +lib_LTLIBRARIES += endif # mpi.f90 is the only f90 source file directly in libmpif90 that gets # distributed. This file is always in the library, regardless of the # size that we're building. -libmpi_f90_a_SOURCES = \ +libmpi_f90_la_SOURCES = \ attr_fn-f90-interfaces.h \ mpi.f90 @@ -249,15 +237,22 @@ large_sources = \ # The rest of the files that are in the library depend on which size # we're building. -nodist_libmpi_f90_a_SOURCES = $(trivial_sources) +nodist_libmpi_f90_la_SOURCES = $(trivial_sources) if OMPI_WANT_BUILD_F90_SMALL -nodist_libmpi_f90_a_SOURCES += $(small_sources) +nodist_libmpi_f90_la_SOURCES += $(small_sources) endif if OMPI_WANT_BUILD_F90_MEDIUM -nodist_libmpi_f90_a_SOURCES += $(small_sources) $(medium_sources) +nodist_libmpi_f90_la_SOURCES += $(small_sources) $(medium_sources) endif if OMPI_WANT_BUILD_F90_LARGE -nodist_libmpi_f90_a_SOURCES += $(small_sources) $(medium_sources) $(large_sources) +nodist_libmpi_f90_la_SOURCES += $(small_sources) $(medium_sources) $(large_sources) +endif + +# see note in config/ompi_setup_f90.m4 +if OMPI_F90_FORCE_STATIC +libmpi_f90_la_LDFLAGS = -static +else +libmpi_f90_la_LDFLAGS = endif # @@ -265,7 +260,7 @@ endif # MOSTLYCLEANFILES = *.mod *.ompi_module -DISTCLEANFILES = $(nodist_libmpi_f90_a_SOURCES) +DISTCLEANFILES = $(nodist_libmpi_f90_la_SOURCES) # # Install the generated .mod files. Unfortunately, each F90 compiler