aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-05-31 12:22:06 +0100
committerJonathan Wakely <jwakely@redhat.com>2023-05-31 21:10:49 +0100
commit49f59826c66bcaa3531429381b4aed944c332e5b (patch)
tree2c37a171a0d7c3baba25939a0f350c1c4bd6c7cf /libstdc++-v3
parent1f378f6dd33ad5067a437d1c456979f8662020d6 (diff)
downloadgcc-49f59826c66bcaa3531429381b4aed944c332e5b.zip
gcc-49f59826c66bcaa3531429381b4aed944c332e5b.tar.gz
gcc-49f59826c66bcaa3531429381b4aed944c332e5b.tar.bz2
libstdc++: Add separate autoconf macro for std::float_t and std::double_t [PR109818]
This should make it possible to use openlibm with djgpp (and other targets with missing C99 <math.h> functions). The <math.h> from openlibm provides all the functions, but not the float_t and double_t typedefs. By separating the autoconf checks for the functionsand the typedefs, we don't disable support for all the functions just because those typedefs are not present. libstdc++-v3/ChangeLog: PR libstdc++/109818 * acinclude.m4 (GLIBCXX_ENABLE_C99): Add separate check for float_t and double_t and define HAVE_C99_FLT_EVAL_TYPES. * config.h.in: Regenerate. * configure: Regenerate. * include/c_global/cmath (float_t, double_t): Guard using new _GLIBCXX_HAVE_C99_FLT_EVAL_TYPES macro.
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/acinclude.m421
-rw-r--r--libstdc++-v3/config.h.in4
-rwxr-xr-xlibstdc++-v3/configure41
-rw-r--r--libstdc++-v3/include/c_global/cmath2
4 files changed, 62 insertions, 6 deletions
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 6619407..6ae141b 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1273,13 +1273,28 @@ AC_DEFUN([GLIBCXX_ENABLE_C99], [
in <cmath> in namespace std for C++11.])
fi
- # Check for the existence of <math.h> functions.
- AC_CACHE_CHECK([for ISO C99 function support for C++11 in <math.h>],
- glibcxx_cv_c99_math_funcs, [
+ # Check for the existence of <math.h> typedefs.
+ AC_CACHE_CHECK([for ISO C99 float types for C++11 in <math.h>],
+ glibcxx_cv_c99_flt_eval_types, [
AC_TRY_COMPILE([#include <math.h>],
[// Types
typedef double_t my_double_t;
typedef float_t my_float_t;
+ ],
+ [glibcxx_cv_c99_flt_eval_types=yes],
+ [glibcxx_cv_c99_flt_eval_types=no])
+ ])
+ if test x"$glibcxx_cv_c99_flt_eval_types" = x"yes"; then
+ AC_DEFINE(HAVE_C99_FLT_EVAL_TYPES, 1,
+ [Define if C99 float_t and double_t in <math.h> should be
+ imported in <cmath> in namespace std for C++11.])
+ fi
+
+ # Check for the existence of <math.h> functions.
+ AC_CACHE_CHECK([for ISO C99 function support for C++11 in <math.h>],
+ glibcxx_cv_c99_math_funcs, [
+ AC_TRY_COMPILE([#include <math.h>],
+ [
// Hyperbolic
acosh(0.0);
acoshf(0.0f);
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 4fbf5ef..5a95853 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -42,6 +42,10 @@
/* Define to 1 if you have the `at_quick_exit' function. */
#undef HAVE_AT_QUICK_EXIT
+/* Define if C99 float_t and double_t in <math.h> should be imported in
+ <cmath> in namespace std for C++11. */
+#undef HAVE_C99_FLT_EVAL_TYPES
+
/* Define to 1 if the target assembler supports thread-local storage. */
#undef HAVE_CC_TLS
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index ba328a6..70d169c 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -18275,6 +18275,43 @@ $as_echo "#define _GLIBCXX11_USE_C99_MATH 1" >>confdefs.h
fi
+ # Check for the existence of <math.h> typedefs.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 float types for C++11 in <math.h>" >&5
+$as_echo_n "checking for ISO C99 float types for C++11 in <math.h>... " >&6; }
+if ${glibcxx_cv_c99_flt_eval_types+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <math.h>
+int
+main ()
+{
+// Types
+ typedef double_t my_double_t;
+ typedef float_t my_float_t;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ glibcxx_cv_c99_flt_eval_types=yes
+else
+ glibcxx_cv_c99_flt_eval_types=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_c99_flt_eval_types" >&5
+$as_echo "$glibcxx_cv_c99_flt_eval_types" >&6; }
+ if test x"$glibcxx_cv_c99_flt_eval_types" = x"yes"; then
+
+$as_echo "#define HAVE_C99_FLT_EVAL_TYPES 1" >>confdefs.h
+
+ fi
+
# Check for the existence of <math.h> functions.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C99 function support for C++11 in <math.h>" >&5
$as_echo_n "checking for ISO C99 function support for C++11 in <math.h>... " >&6; }
@@ -18288,9 +18325,7 @@ else
int
main ()
{
-// Types
- typedef double_t my_double_t;
- typedef float_t my_float_t;
+
// Hyperbolic
acosh(0.0);
acoshf(0.0f);
diff --git a/libstdc++-v3/include/c_global/cmath b/libstdc++-v3/include/c_global/cmath
index c80ee7c..b0ba395e 100644
--- a/libstdc++-v3/include/c_global/cmath
+++ b/libstdc++-v3/include/c_global/cmath
@@ -1877,9 +1877,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#undef truncf
#undef truncl
+#ifdef _GLIBCXX_HAVE_C99_FLT_EVAL_TYPES
// types
using ::double_t;
using ::float_t;
+#endif
// functions
using ::acosh;