From c5aac757e46c64ce8c4d6335755422c478e8cbb2 Mon Sep 17 00:00:00 2001
From: Pietro Incardona <i-bird@localhost.localdomain>
Date: Wed, 23 Mar 2016 00:54:36 +0100
Subject: [PATCH] activate multiprecision only if libquadmath present

---
 configure.ac                   | 9 +++++++++
 src/PSE/Kernels_unit_tests.hpp | 7 +++++++
 2 files changed, 16 insertions(+)

diff --git a/configure.ac b/configure.ac
index fd294d1e..e513eefe 100755
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,14 @@ if test x"$with_hdf5" = x"no"; then
 fi
 
 
+##########
+
+## Check for quadmath
+
+AC_CHECK_LIB(quadmath, sinq, [AC_DEFINE(HAVE_LIBQUADMATH,[],[Have quad math lib])
+				LIBQUADMATH=" -lquadmath "
+				], [])
+
 ####### include OpenFPM_numerics include path"
 
 INCLUDES_PATH+=" -I/usr/local/include -I. -Iconfig -I../../openfpm_devices/src -I../../openfpm_data/src -I../../openfpm_io/src -I../../openfpm_vcluster/src -I../../src"
@@ -311,6 +319,7 @@ AC_DEFINE([HAVE_MPI],[],[MPI Enabled])
 
 AC_SUBST(NVCCFLAGS)
 AC_SUBST(INCLUDES_PATH)
+AC_SUBST(LIBQUADMATH)
 
 # Checks for typedefs, structures, and compiler characteristics.
 
diff --git a/src/PSE/Kernels_unit_tests.hpp b/src/PSE/Kernels_unit_tests.hpp
index 80e9b105..3029d253 100644
--- a/src/PSE/Kernels_unit_tests.hpp
+++ b/src/PSE/Kernels_unit_tests.hpp
@@ -9,7 +9,9 @@
 #define OPENFPM_NUMERICS_SRC_PSE_KERNELS_UNIT_TESTS_HPP_
 
 #include "PSE/Kernels_test_util.hpp"
+#ifdef HAVE_LIBQUADMATH
 #include <boost/multiprecision/float128.hpp>
+#endif
 
 BOOST_AUTO_TEST_SUITE( pse_kernels_unit_tests )
 
@@ -36,11 +38,13 @@ BOOST_AUTO_TEST_CASE( pse_ker )
 
 		/////// Order 2 //////////////
 
+#ifdef HAVE_LIBQUADMATH
 		PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,2>>(i,2,err);
 		y.last().add(err.linf_error);
 
 		PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,2>>(i,4,err);
 		y.last().add(err.linf_error);
+#endif
 
 		PSE_test<double,Lap_PSE<1,double,2>>(i,2,err);
 		y.last().add(err.linf_error);
@@ -56,6 +60,7 @@ BOOST_AUTO_TEST_CASE( pse_ker )
 
 		//////// Order 4 /////////////
 
+#ifdef HAVE_LIBQUADMATH
 		PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,4>>(i,2,err);
 		y.last().add(err.linf_error);
 
@@ -78,6 +83,8 @@ BOOST_AUTO_TEST_CASE( pse_ker )
 
 		PSE_test<boost::multiprecision::float128,Lap_PSE<1,boost::multiprecision::float128,8>>(i,16,err);
 		y.last().add(err.linf_error);
+
+#endif
 	}
 
 	// Check the result
-- 
GitLab