From 6c7b81cb5bf619f41d4292a34c0bcc7ebc9ecc6f Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Wed, 22 Nov 2006 21:18:08 +0000
Subject: [PATCH] BugID: 947

Added checks for HAVE_BOOST in several files, so that the Boost package can be
optinal again.
---
 LCS/Common/configure.in                   |  2 +-
 LCS/Common/include/Common/ObjectFactory.h |  3 +++
 LCS/Common/include/Common/Singleton.h     |  2 +-
 LCS/Common/test/Coordinates.cc            |  4 ++++
 LCS/Common/test/Shapes.cc                 |  4 ++++
 LCS/Common/test/tObjectFactory.cc         | 13 +++++++++++++
 6 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/LCS/Common/configure.in b/LCS/Common/configure.in
index f93228dd319..c8d9bcef89c 100644
--- a/LCS/Common/configure.in
+++ b/LCS/Common/configure.in
@@ -53,7 +53,7 @@ dnl
 lofar_GENERAL
 lofar_MPI
 lofar_INTERNAL(LCS/Tools,Tools,,,,"")
-lofar_EXTERNAL(boost,1,boost/preprocessor/repetition.hpp,"")
+lofar_EXTERNAL(boost,0,boost/preprocessor/repetition.hpp,"")
 dnl
 dnl Output Makefiles
 dnl
diff --git a/LCS/Common/include/Common/ObjectFactory.h b/LCS/Common/include/Common/ObjectFactory.h
index cf55bd3d51f..8d89ee81b23 100644
--- a/LCS/Common/include/Common/ObjectFactory.h
+++ b/LCS/Common/include/Common/ObjectFactory.h
@@ -53,6 +53,9 @@
 #  ifndef LOFAR_COMMON_OBJECT_FACTORY_H
 #    define LOFAR_COMMON_OBJECT_FACTORY_H
 
+#    ifndef HAVE_BOOST
+#      error The Boost.Preprocessor metaprogramming tools are required
+#    endif
 
 #    include <Common/lofar_map.h>
 #    include <Common/lofar_vector.h>
diff --git a/LCS/Common/include/Common/Singleton.h b/LCS/Common/include/Common/Singleton.h
index 3ce1cd76505..511196f01b2 100644
--- a/LCS/Common/include/Common/Singleton.h
+++ b/LCS/Common/include/Common/Singleton.h
@@ -34,7 +34,7 @@ namespace LOFAR
   // @{
 
   // Singleton implements the so-called Meyers singleton (see Item 26 in
-  // <em>More Effective C++<em>, by Scott Meyers).
+  // <em>More Effective C++</em>, by Scott Meyers).
   //
   // \attention The Meyers singleton is \e not thread-safe. So, you can only
   // safely use this Singleton class <em>as long as</em> there is only one
diff --git a/LCS/Common/test/Coordinates.cc b/LCS/Common/test/Coordinates.cc
index ec05c5e57d5..e1bf2470f6f 100644
--- a/LCS/Common/test/Coordinates.cc
+++ b/LCS/Common/test/Coordinates.cc
@@ -24,6 +24,9 @@
 //# Always #include <lofar_config.h> first!
 #include <lofar_config.h>
 
+//# This code can only be compiled if Boost is available.
+#ifdef HAVE_BOOST
+
 //# Includes
 #include "Coordinates.h"
 #include <Common/lofar_iostream.h>
@@ -69,3 +72,4 @@ namespace LOFAR
 
 }
 
+#endif
diff --git a/LCS/Common/test/Shapes.cc b/LCS/Common/test/Shapes.cc
index b1169f777dd..f5a071fbf7b 100644
--- a/LCS/Common/test/Shapes.cc
+++ b/LCS/Common/test/Shapes.cc
@@ -23,6 +23,9 @@
 //# Always #include <lofar_config.h> first!
 #include <lofar_config.h>
 
+//# This code can only be compiled if Boost is available.
+#ifdef HAVE_BOOST
+
 //# Includes
 #include "Shapes.h"
 #include <Common/lofar_iostream.h>
@@ -71,3 +74,4 @@ namespace LOFAR
 
 }
 
+#endif
diff --git a/LCS/Common/test/tObjectFactory.cc b/LCS/Common/test/tObjectFactory.cc
index 26970008b40..03118fa1d82 100644
--- a/LCS/Common/test/tObjectFactory.cc
+++ b/LCS/Common/test/tObjectFactory.cc
@@ -23,6 +23,9 @@
 //# Always #include <lofar_config.h> first!
 #include <lofar_config.h>
 
+//# This program can only be compiled if Boost is available.
+#ifdef HAVE_BOOST
+
 //# Includes
 #include "Shapes.h"
 #include "Coordinates.h"
@@ -86,3 +89,13 @@ int main()
   cout << endl;
   return 0;
 }
+
+#else
+
+int main()
+{
+  // Test skipped.
+  return 3;
+}
+
+#endif
-- 
GitLab