[Debian-astro-commits] [gyoto] 38/221: Better detection and error handling of MPI prerequisites

Thibaut Jean-Claude Paumard thibaut at moszumanska.debian.org
Fri May 22 20:52:31 UTC 2015


This is an automated email from the git hooks/post-receive script.

thibaut pushed a commit to branch master
in repository gyoto.

commit d935adb36db5ac409692f0b5585ae6c97d35a15a
Author: Thibaut Paumard <paumard at users.sourceforge.net>
Date:   Sun Oct 12 12:18:34 2014 +0200

    Better detection and error handling of MPI prerequisites
---
 configure       | 51 +++++++++++++++++++++++++++++++++++++++++----------
 configure.ac    | 29 ++++++++++++++++++++---------
 lib/Makefile.am |  6 +++++-
 lib/Makefile.in |  8 ++++----
 4 files changed, 70 insertions(+), 24 deletions(-)

diff --git a/configure b/configure
index 97c2f0b..4bd9a94 100755
--- a/configure
+++ b/configure
@@ -15680,10 +15680,6 @@ else
 fi
 
 
-if test "x$with_mpi" == xyes; then :
-  with_boost=yes
-fi
-
 # Check for boost
 
 if test "x$HAVE_CXX11" = "x1"; then :
@@ -15930,24 +15926,59 @@ fi
 
   test -n "$MPICXX" && break
 done
-,
+
   if test "x$MPICXX" != x; then :
 
+    if test "x$have_boost" == xyes; then :
+
+      ax_save_CXX=$CXX
+      CXX=$MPICXX
+      saved_libs="$LIBS"
+      LIBS="$LIBS -lboost_mpi"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <boost/mpi/environment.hpp>
+int
+main ()
+{
+boost::mpi::environment()
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  have_mpi=yes
+else
+  CXX=$ax_save_CXX
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+      LIBS="$saved_libs"
+
+else
+   if test "x$with_mpi" == xyes; then :
+   as_fn_error $? "MPI features require boost.mpi" "$LINENO" 5
+
+fi
+
+fi
+
+fi
+
+fi
+
+if test "x$have_mpi" == xyes; then :
 
 
 $as_echo "#define HAVE_MPI 1" >>confdefs.h
 
-    have_mpi=yes
-    CXX=$MPICXX
 else
-   if test "x$with_mpi"=xyes; then :
+   if test "x$with_mpi" == xyes; then :
    as_fn_error $? "MPI requested but not found" "$LINENO" 5
 
 fi
 
 fi
-]
-fi
 
  if test "x$have_mpi" == xyes; then
   HAVE_MPI_TRUE=
diff --git a/configure.ac b/configure.ac
index 488f700..453cb5a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,8 +39,6 @@ AC_ARG_WITH(mpi, [AS_HELP_STRING([--with-mpi],
     MPI is not used. Default: auto])
 ],,[with_mpi=auto])
 
-AS_IF([test "x$with_mpi" == xyes], [with_boost=yes])
-
 # Check for boost
 AS_IF([test "x$HAVE_CXX11" = "x1"],
   [have_boost=yes
@@ -61,18 +59,31 @@ AS_IF([test "x$with_boost" != "x" && test "x$with_boost" != "xno"],
 
 have_mpi=no
 AS_IF([test "x$with_mpi" != xno],
-[ AC_CHECK_PROGS([MPICXX], [mpic++ mpicxx]),
+[ AC_CHECK_PROGS([MPICXX], [mpic++ mpicxx])
   AS_IF([test "x$MPICXX" != x], [
-    AC_SUBST(MPICXX)
-    AC_DEFINE([HAVE_MPI], [1], [Define to 1 if you have MPI])]
-    have_mpi=yes
-    CXX=$MPICXX],
-  [ AS_IF([test "x$with_mpi"=xyes],
-    [ AC_ERROR([MPI requested but not found])
+    AS_IF([test "x$have_boost" == xyes], [
+      ax_save_CXX=$CXX
+      CXX=$MPICXX
+      saved_libs="$LIBS"
+      LIBS="$LIBS -lboost_mpi"
+      AC_TRY_LINK([#include <boost/mpi/environment.hpp>], [boost::mpi::environment()], [have_mpi=yes], [CXX=$ax_save_CXX])
+      LIBS="$saved_libs"
+    ],
+    [ AS_IF([test "x$with_mpi" == xyes],
+      [ AC_MSG_ERROR([MPI features require boost.mpi])
+      ])
     ])
   ])
 ])
 
+AS_IF([test "x$have_mpi" == xyes],
+[ AC_SUBST(MPICXX)
+  AC_DEFINE([HAVE_MPI], [1], [Define to 1 if you have MPI])],
+[ AS_IF([test "x$with_mpi" == xyes],
+  [ AC_ERROR([MPI requested but not found])
+  ])
+])
+
 AM_CONDITIONAL(HAVE_MPI, [test "x$have_mpi" == xyes])
 
 AC_PROG_INSTALL
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 5dfec09..2481968 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,8 +1,12 @@
 ACLOCAL_AMFLAGS = -I m4 
 AM_CPPFLAGS = -I at top_srcdir@/include $(XERCESCPPFLAGS) $(UDUNITS_CPPFLAGS) $(BOOST_CPPFLAGS)
 AM_LDFLAGS  = $(XERCESLDFLAGS) -export-dynamic $(PTHREAD_LIBS) \
-	      $(UDUNITS_LDFLAGS) -lboost_mpi -lboost_serialization
+	      $(UDUNITS_LDFLAGS)
 AM_CXXFLAGS = $(PTHREAD_CFLAGS) -DGYOTO_PREFIX=\"${prefix}\"
+if HAVE_MPI
+AM_LDFLAGS += -lboost_mpi -lboost_serialization
+endif
+
 
 # HEADERS: where they are, where to install them
 library_includedir=$(includedir)/Gyoto
diff --git a/lib/Makefile.in b/lib/Makefile.in
index c73c7d4..c55bad7 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -81,9 +81,10 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 target_triplet = @target@
+ at HAVE_MPI_TRUE@am__append_1 = -lboost_mpi -lboost_serialization
 
 # LORENE PLUGIN
- at HAVE_LORENE_TRUE@am__append_1 = libgyoto-lorene.la
+ at HAVE_LORENE_TRUE@am__append_2 = libgyoto-lorene.la
 subdir = lib
 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
 	$(srcdir)/gyoto.pc.in $(srcdir)/gyoto-uninstalled.pc.in \
@@ -411,8 +412,7 @@ top_srcdir = @top_srcdir@
 ACLOCAL_AMFLAGS = -I m4 
 AM_CPPFLAGS = -I at top_srcdir@/include $(XERCESCPPFLAGS) $(UDUNITS_CPPFLAGS) $(BOOST_CPPFLAGS)
 AM_LDFLAGS = $(XERCESLDFLAGS) -export-dynamic $(PTHREAD_LIBS) \
-	      $(UDUNITS_LDFLAGS) -lboost_mpi -lboost_serialization
-
+	$(UDUNITS_LDFLAGS) $(am__append_1)
 AM_CXXFLAGS = $(PTHREAD_CFLAGS) -DGYOTO_PREFIX=\"${prefix}\"
 
 # HEADERS: where they are, where to install them
@@ -432,7 +432,7 @@ libgyoto_la_LDFLAGS = $(AM_LDFLAGS) -version-info $(VERSINFO)
 
 # STANDARD PLUGIN
 soverdir = $(pkglibdir)/@sovers@
-sover_LTLIBRARIES = libgyoto-stdplug.la $(am__append_1)
+sover_LTLIBRARIES = libgyoto-stdplug.la $(am__append_2)
 libgyoto_stdplug_la_SOURCES = KerrBL.C KerrKS.C Minkowski.C Star.C \
 	StarTrace.C FixedStar.C Torus.C PowerLawSpectrum.C \
 	BlackBodySpectrum.C ComplexAstrobj.C UniformSphere.C \

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-astro/packages/gyoto.git



More information about the Debian-astro-commits mailing list