From af5babce6efb89ca274c799d73318f16164fee64 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <gruenich@dune-project.org>
Date: Fri, 31 Aug 2012 11:30:17 +0000
Subject: [PATCH] [doc/comm] Check all programs even if MPI was not found.
 (similar to dune/common/test) Fix poosc08_test to compile without MPI.

[[Imported from SVN: r1681]]
---
 doc/comm/.gitignore      |  1 +
 doc/comm/Makefile.am     |  6 ++----
 doc/comm/poosc08_test.cc | 14 ++++++++------
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/doc/comm/.gitignore b/doc/comm/.gitignore
index f8fc761f3..ceb1fa1f0 100644
--- a/doc/comm/.gitignore
+++ b/doc/comm/.gitignore
@@ -18,3 +18,4 @@ indexset
 Makefile.dist.in
 Makefile.dist
 poosc08_test
+poosc08
diff --git a/doc/comm/Makefile.am b/doc/comm/Makefile.am
index 243c741fe..309ce9113 100644
--- a/doc/comm/Makefile.am
+++ b/doc/comm/Makefile.am
@@ -2,10 +2,8 @@
 
 SUBDIRS = figures
 
-# only build these programs if an MPI-implementation was found
-if MPI
-  MPIPROGRAMS = indexset poosc08 poosc08_test
-endif
+MPIPROGRAMS = indexset poosc08 poosc08_test
+
 # programs just to build when "make check" is used
 check_PROGRAMS = $(MPIPROGRAMS)
 # list of tests to run (indicestest is special case)
diff --git a/doc/comm/poosc08_test.cc b/doc/comm/poosc08_test.cc
index 953c1c1e6..5d95ee445 100644
--- a/doc/comm/poosc08_test.cc
+++ b/doc/comm/poosc08_test.cc
@@ -45,6 +45,7 @@ struct CopyData {
 template<class T>
 void doCalculations(T& t){}
 
+#if HAVE_MPI
 void test()
 {
   int rank;
@@ -128,21 +129,22 @@ void test()
   doCalculations(t);
   //bCommRedist.backward<AddData<Container> >(s,t);
 }
+#endif // HAVE_MPI
 
 int main(int argc, char** argv)
 {
   try{
     using namespace Dune;
-
+#if HAVE_MPI
     //Maybe initialize Mpi
     MPIHelper& helper = MPIHelper::instance(argc, argv);
     std::cout << "Hello World! This is poosc08. rank=" <<helper.rank()<< std::endl;
-    if(Dune::MPIHelper::isFake)
-      std::cout<< "This is a sequential program." << std::endl;
-    else{
-      test();
-    }
+    test();
     return 0;
+#else
+    std::cout<< "Test poosc08_test disabled because MPI is not available." << std::endl;
+    return 77;
+#endif // HAVE_MPI
   }
   catch (Dune::Exception &e) {
     std::cerr << "Dune reported error: " << e << std::endl;
-- 
GitLab