summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/multiprecision/config
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/multiprecision/config')
-rw-r--r--src/boost/libs/multiprecision/config/Jamfile.v289
-rw-r--r--src/boost/libs/multiprecision/config/has_constexpr_limits_cmd.cpp16
-rw-r--r--src/boost/libs/multiprecision/config/has_eigen.cpp15
-rw-r--r--src/boost/libs/multiprecision/config/has_f2c.cpp11
-rw-r--r--src/boost/libs/multiprecision/config/has_float128.cpp23
-rw-r--r--src/boost/libs/multiprecision/config/has_gmp.cpp33
-rw-r--r--src/boost/libs/multiprecision/config/has_intel_quad.cpp14
-rw-r--r--src/boost/libs/multiprecision/config/has_is_constant_evaluated.cpp47
-rw-r--r--src/boost/libs/multiprecision/config/has_mpc.cpp59
-rw-r--r--src/boost/libs/multiprecision/config/has_mpfi.cpp60
-rw-r--r--src/boost/libs/multiprecision/config/has_mpfr.cpp47
-rw-r--r--src/boost/libs/multiprecision/config/has_tommath.cpp15
12 files changed, 429 insertions, 0 deletions
diff --git a/src/boost/libs/multiprecision/config/Jamfile.v2 b/src/boost/libs/multiprecision/config/Jamfile.v2
new file mode 100644
index 000000000..d5d2fee58
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/Jamfile.v2
@@ -0,0 +1,89 @@
+# copyright John Maddock 2008
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt.
+
+import modules ;
+import path ;
+
+local gmp_path = [ modules.peek : GMP_PATH ] ;
+local mpfr_path = [ modules.peek : MPFR_PATH ] ;
+local mpfi_path = [ modules.peek : MPFI_PATH ] ;
+local tommath_path = [ modules.peek : TOMMATH_PATH ] ;
+
+project : requirements
+ <include>$(gmp_path)
+ <include>$(gmp_path)/mpfr
+ <include>$(gmp_path)/gmpfrxx
+ <include>$(mpfr_path)
+ <include>$(mpfi_path)
+ <include>$(mpfi_path)/src
+ <include>$(tommath_path)
+ <include>../../..
+ <search>$(gmp_path)
+ <search>$(mpfr_path)
+ <search>$(mpfr_path)/build.vc10/lib/Win32/Debug
+ <search>$(tommath_path)
+ <search>$(mpfi_path)
+ <search>$(mpfi_path)/src
+ # We set these to make it easier to set up and test GMP and MPFR under Win32:
+ <toolset>msvc:<runtime-link>static
+ <toolset>msvc:<link>static
+ <toolset>intel-win:<runtime-link>static
+ <toolset>intel-win:<link>static
+ <toolset>msvc:<warnings>all
+ <toolset>gcc:<cxxflags>-Wall
+ <toolset>gcc:<cxxflags>-Wextra
+ ;
+
+lib gmp ;
+lib mpfr ;
+lib mpfi ;
+lib mpc ;
+lib quadmath ;
+lib tommath ;
+lib f2c ;
+
+actions mp_simple_run_action
+{
+ $(>) > $(<)
+}
+
+rule mp-run-simple ( sources + : args * : input-files * : requirements * : target-name )
+{
+ exe $(target-name)_exe : $(sources) : $(requirements) ;
+ explicit $(target-name)_exe ;
+ make $(target-name).output : $(target-name)_exe : @mp_simple_run_action ;
+ explicit $(target-name).output ;
+ alias $(target-name) : $(target-name).output ;
+}
+
+mp-run-simple has_gmp.cpp gmp : : :
+ <include>$(gmp_path) <include>$(gmp_path)/mpfr <include>$(gmp_path)/gmpfrxx : has_gmp ;
+mp-run-simple has_mpfr.cpp mpfr gmp : : :
+ <include>$(mpfr_path) <include>$(gmp_path)/mpfr <include>$(gmp_path)/gmpfrxx <include>$(gmp_path) : has_mpfr ;
+mp-run-simple has_mpfi.cpp mpfi mpfr gmp : : :
+ <include>$(mpfr_path) <include>$(gmp_path)/mpfr <include>$(gmp_path)/gmpfrxx <include>$(gmp_path) : has_mpfi ;
+mp-run-simple has_mpc.cpp mpc mpfr gmp : : :
+ <include>$(mpfr_path) <include>$(gmp_path)/mpfr <include>$(gmp_path)/gmpfrxx <include>$(gmp_path) : has_mpc ;
+mp-run-simple has_tommath.cpp tommath : : :
+ <include>$(tommath_path) : has_tommath ;
+mp-run-simple has_float128.cpp quadmath : : : : has_float128 ;
+exe has_intel_quad : has_intel_quad.cpp : <cxxflags>-Qoption,cpp,--extended_float_type ;
+exe has_eigen : has_eigen.cpp ;
+exe has_f2c : has_f2c.cpp f2c ;
+obj has_is_constant_evaluated : has_is_constant_evaluated.cpp ;
+obj has_constexpr_limits : has_constexpr_limits_cmd.cpp : <cxxflags>-fconstexpr-ops-limit=268435456 ;
+
+explicit has_gmp ;
+explicit has_mpfr ;
+explicit has_mpfi ;
+explicit has_tommath ;
+explicit has_float128 ;
+explicit has_intel_quad ;
+explicit has_mpc ;
+explicit has_eigen ;
+explicit has_is_constant_evaluated ;
+explicit has_constexpr_limits ;
+explicit has_f2c ;
+
diff --git a/src/boost/libs/multiprecision/config/has_constexpr_limits_cmd.cpp b/src/boost/libs/multiprecision/config/has_constexpr_limits_cmd.cpp
new file mode 100644
index 000000000..8c96958ea
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/has_constexpr_limits_cmd.cpp
@@ -0,0 +1,16 @@
+// Copyright John Maddock 2019.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef __GNUC__
+#error "Compiler is not GCC"
+#endif
+#if __GNUC__ < 9
+#error "Older GCC versions don't support -fconstexpr-ops-limit"
+#endif
+
+int main()
+{
+ return 0;
+}
diff --git a/src/boost/libs/multiprecision/config/has_eigen.cpp b/src/boost/libs/multiprecision/config/has_eigen.cpp
new file mode 100644
index 000000000..57d84baea
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/has_eigen.cpp
@@ -0,0 +1,15 @@
+// Copyright John Maddock 2011.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <Eigen/Dense>
+
+int main()
+{
+#if EIGEN_VERSION_AT_LEAST(3, 3, 0)
+#else
+#error "Obsolete Eigen"
+#endif
+ return 0;
+}
diff --git a/src/boost/libs/multiprecision/config/has_f2c.cpp b/src/boost/libs/multiprecision/config/has_f2c.cpp
new file mode 100644
index 000000000..923902b0d
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/has_f2c.cpp
@@ -0,0 +1,11 @@
+// Copyright John Maddock 2019.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <f2c.h>
+
+int main()
+{
+ return 0;
+}
diff --git a/src/boost/libs/multiprecision/config/has_float128.cpp b/src/boost/libs/multiprecision/config/has_float128.cpp
new file mode 100644
index 000000000..f46dbdcc6
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/has_float128.cpp
@@ -0,0 +1,23 @@
+// Copyright John Maddock 2013.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <boost/config.hpp>
+
+#ifndef BOOST_HAS_FLOAT128
+#error "This doesn't work unless Boost.Config enables __float128 support"
+#endif
+
+extern "C" {
+#include <quadmath.h>
+}
+
+int main()
+{
+ __float128 f = -2.0Q;
+ f = fabsq(f);
+ f = expq(f);
+
+ return 0;
+}
diff --git a/src/boost/libs/multiprecision/config/has_gmp.cpp b/src/boost/libs/multiprecision/config/has_gmp.cpp
new file mode 100644
index 000000000..196b6e2f3
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/has_gmp.cpp
@@ -0,0 +1,33 @@
+// Copyright John Maddock 2008.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <cstddef> // See https://gcc.gnu.org/gcc-4.9/porting_to.html
+#include <gmp.h>
+#include <boost/config.hpp>
+
+#ifdef __GNUC__
+#pragma message "__GNU_MP_VERSION=" BOOST_STRINGIZE(__GNU_MP_VERSION)
+#pragma message "__GNU_MP_VERSION_MINOR=" BOOST_STRINGIZE(__GNU_MP_VERSION_MINOR)
+#endif
+
+#if (__GNU_MP_VERSION < 4) || ((__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR < 2))
+#error "Incompatible GMP version"
+#endif
+
+int main()
+{
+ void* (*alloc_func_ptr)(size_t);
+ void* (*realloc_func_ptr)(void*, size_t, size_t);
+ void (*free_func_ptr)(void*, size_t);
+
+ mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr);
+
+ mpz_t integ;
+ mpz_init(integ);
+ if (integ[0]._mp_d)
+ mpz_clear(integ);
+
+ return 0;
+}
diff --git a/src/boost/libs/multiprecision/config/has_intel_quad.cpp b/src/boost/libs/multiprecision/config/has_intel_quad.cpp
new file mode 100644
index 000000000..e0b23eb0c
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/has_intel_quad.cpp
@@ -0,0 +1,14 @@
+// Copyright John Maddock 2013.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+extern "C" _Quad __fabs(_Quad);
+
+int main()
+{
+ _Quad f = -2.0Q;
+ f = __fabsq(f);
+
+ return 0;
+}
diff --git a/src/boost/libs/multiprecision/config/has_is_constant_evaluated.cpp b/src/boost/libs/multiprecision/config/has_is_constant_evaluated.cpp
new file mode 100644
index 000000000..4dac95b29
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/has_is_constant_evaluated.cpp
@@ -0,0 +1,47 @@
+// Copyright John Maddock 2013.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// This program determines if std::is_constant_evaluated is available to switch within a function to use compile-time constexp calculations.
+// See https://en.cppreference.com/w/cpp/types/is_constant_evaluated
+// and https://en.cppreference.com/w/cpp/compiler_support
+// Currently only GCC 9 and Clang 9 and <cxxflags>-std=c++2a or b2 cxxstd=2a
+
+// https://clang.llvm.org/docs/LanguageExtensions.html#builtin-macros
+
+// From Clang 10 onwards, __has_builtin(__X) can be used. but also works for Clang 9
+
+// boost\libs\multiprecision\config>b2 has_is_constant_evaluated toolset=clang-win-9.0.0 cxxstd=2a address-model=64 release > mp_is_const_eval_30Sep2019.log
+
+#include <boost/config.hpp>
+#include <boost/config/pragma_message.hpp>
+
+#include <boost/multiprecision/number.hpp>
+
+#ifdef __has_builtin
+BOOST_PRAGMA_MESSAGE (" __has_builtin is defined.")
+
+# if __has_builtin(__builtin_is_constant_evaluated)
+BOOST_PRAGMA_MESSAGE (" __has_builtin(__builtin_is_constant_evaluated), so BOOST_MP_NO_CONSTEXPR_DETECTION should NOT be defined.")
+# endif // __has_builtin(__builtin_is_constant_evaluated)
+
+#endif // __has_builtin
+
+#ifdef BOOST_MP_HAS_IS_CONSTANT_EVALUATED
+BOOST_PRAGMA_MESSAGE ("BOOST_MP_HAS_IS_CONSTANT_EVALUATED defined.")
+#else
+BOOST_PRAGMA_MESSAGE ("BOOST_MP_HAS_IS_CONSTANT_EVALUATED is NOT defined, so no std::is_constant_evaluated() from std library.")
+#endif
+
+#ifdef BOOST_NO_CXX14_CONSTEXPR
+BOOST_PRAGMA_MESSAGE ("BOOST_NO_CXX14_CONSTEXPR is defined.")
+#endif
+
+#ifdef BOOST_NO_CXX17_CONSTEXPR
+BOOST_PRAGMA_MESSAGE ("BOOST_NO_CXX17_CONSTEXPR is defined.")
+#endif
+
+#ifdef BOOST_MP_NO_CONSTEXPR_DETECTION
+# error 1 "std::is_constant_evaluated is NOT available to determine if a calculation can use constexpr."
+#endif
diff --git a/src/boost/libs/multiprecision/config/has_mpc.cpp b/src/boost/libs/multiprecision/config/has_mpc.cpp
new file mode 100644
index 000000000..256a70a9a
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/has_mpc.cpp
@@ -0,0 +1,59 @@
+// Copyright John Maddock 2018.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <cstddef> // See https://gcc.gnu.org/gcc-4.9/porting_to.html
+#include <mpc.h>
+#include <boost/config.hpp>
+
+#ifdef __GNUC__
+#pragma message "MPFR_VERSION_STRING=" MPFR_VERSION_STRING
+#endif
+
+#if (__GNU_MP_VERSION < 4) || ((__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR < 2))
+#error "Incompatible GMP version"
+#endif
+
+#if (MPFR_VERSION < 3)
+#error "Incompatible MPFR version"
+#endif
+
+#ifdef __GNUC__
+#pragma message "__GNU_MP_VERSION=" BOOST_STRINGIZE(__GNU_MP_VERSION)
+#pragma message "__GNU_MP_VERSION_MINOR=" BOOST_STRINGIZE(__GNU_MP_VERSION_MINOR)
+#endif
+
+#if (__GNU_MP_VERSION < 4) || ((__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR < 2))
+#error "Incompatible GMP version"
+#endif
+
+/*
+#ifdef __GNUC__
+#pragma message "MPFI_VERSION_MAJOR=" BOOST_STRINGIZE(MPFI_VERSION_MAJOR)
+#pragma message "MPFI_VERSION_MAJOR=" BOOST_STRINGIZE(MPFI_VERSION_MAJOR)
+#endif
+
+#if MPFI_VERSION_MAJOR < 1
+#error "Incompatible MPFI version"
+#endif
+#if (MPFI_VERSION_MAJOR == 1) && (MPFI_VERSION_MINOR < 5)
+#error "Incompatible MPFI version"
+#endif
+*/
+int main()
+{
+ void* (*alloc_func_ptr)(size_t);
+ void* (*realloc_func_ptr)(void*, size_t, size_t);
+ void (*free_func_ptr)(void*, size_t);
+
+ mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr);
+
+ mpfr_buildopt_tls_p();
+
+ mpc_t t;
+ mpc_init2(t, 128);
+ mpc_clear(t);
+
+ return 0;
+}
diff --git a/src/boost/libs/multiprecision/config/has_mpfi.cpp b/src/boost/libs/multiprecision/config/has_mpfi.cpp
new file mode 100644
index 000000000..bc2e9c681
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/has_mpfi.cpp
@@ -0,0 +1,60 @@
+// Copyright John Maddock 2012.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <cstddef> // See https://gcc.gnu.org/gcc-4.9/porting_to.html
+#include <mpfi.h>
+#include <boost/config.hpp>
+
+#ifdef __GNUC__
+#pragma message "MPFR_VERSION_STRING=" MPFR_VERSION_STRING
+#endif
+
+#if (__GNU_MP_VERSION < 4) || ((__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR < 2))
+#error "Incompatible GMP version"
+#endif
+
+#if (MPFR_VERSION < 3)
+#error "Incompatible MPFR version"
+#endif
+
+#ifdef __GNUC__
+#pragma message "__GNU_MP_VERSION=" BOOST_STRINGIZE(__GNU_MP_VERSION)
+#pragma message "__GNU_MP_VERSION_MINOR=" BOOST_STRINGIZE(__GNU_MP_VERSION_MINOR)
+#endif
+
+#if (__GNU_MP_VERSION < 4) || ((__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR < 2))
+#error "Incompatible GMP version"
+#endif
+
+/*
+#ifdef __GNUC__
+#pragma message "MPFI_VERSION_MAJOR=" BOOST_STRINGIZE(MPFI_VERSION_MAJOR)
+#pragma message "MPFI_VERSION_MAJOR=" BOOST_STRINGIZE(MPFI_VERSION_MAJOR)
+#endif
+
+#if MPFI_VERSION_MAJOR < 1
+#error "Incompatible MPFI version"
+#endif
+#if (MPFI_VERSION_MAJOR == 1) && (MPFI_VERSION_MINOR < 5)
+#error "Incompatible MPFI version"
+#endif
+*/
+int main()
+{
+ void* (*alloc_func_ptr)(size_t);
+ void* (*realloc_func_ptr)(void*, size_t, size_t);
+ void (*free_func_ptr)(void*, size_t);
+
+ mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr);
+
+ mpfr_buildopt_tls_p();
+
+ mpfi_t t;
+ mpfi_init2(t, 128);
+ if (t[0].left._mpfr_d)
+ mpfi_clear(t);
+
+ return 0;
+}
diff --git a/src/boost/libs/multiprecision/config/has_mpfr.cpp b/src/boost/libs/multiprecision/config/has_mpfr.cpp
new file mode 100644
index 000000000..c82f28d7d
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/has_mpfr.cpp
@@ -0,0 +1,47 @@
+// Copyright John Maddock 2012.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <cstddef> // See https://gcc.gnu.org/gcc-4.9/porting_to.html
+#include <mpfr.h>
+#include <boost/config.hpp>
+
+#ifdef __GNUC__
+#pragma message "MPFR_VERSION_STRING=" MPFR_VERSION_STRING
+#endif
+
+#if (__GNU_MP_VERSION < 4) || ((__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR < 2))
+#error "Incompatible GMP version"
+#endif
+
+#if (MPFR_VERSION < 3)
+#error "Incompatible MPFR version"
+#endif
+
+#ifdef __GNUC__
+#pragma message "__GNU_MP_VERSION=" BOOST_STRINGIZE(__GNU_MP_VERSION)
+#pragma message "__GNU_MP_VERSION_MINOR=" BOOST_STRINGIZE(__GNU_MP_VERSION_MINOR)
+#endif
+
+#if (__GNU_MP_VERSION < 4) || ((__GNU_MP_VERSION == 4) && (__GNU_MP_VERSION_MINOR < 2))
+#error "Incompatible GMP version"
+#endif
+
+int main()
+{
+ void* (*alloc_func_ptr)(size_t);
+ void* (*realloc_func_ptr)(void*, size_t, size_t);
+ void (*free_func_ptr)(void*, size_t);
+
+ mp_get_memory_functions(&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr);
+
+ mpfr_buildopt_tls_p();
+
+ mpfr_t t;
+ mpfr_init2(t, 128);
+ if (t[0]._mpfr_d)
+ mpfr_clear(t);
+
+ return 0;
+}
diff --git a/src/boost/libs/multiprecision/config/has_tommath.cpp b/src/boost/libs/multiprecision/config/has_tommath.cpp
new file mode 100644
index 000000000..e5d0a6682
--- /dev/null
+++ b/src/boost/libs/multiprecision/config/has_tommath.cpp
@@ -0,0 +1,15 @@
+// Copyright John Maddock 2011.
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+#include <tommath.h>
+
+int main()
+{
+ mp_int v;
+ mp_init(&v);
+ if (v.dp)
+ mp_clear(&v);
+ return 0;
+}