diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2016-01-13 16:25:56 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2016-01-13 16:25:56 +0000 |
commit | 1b572bc0a692357d2cdf9ddb9554d8b18309cf72 (patch) | |
tree | 2670abc20fc46d91ae71b56219618a8ba707940b /libstdc++-v3/configure | |
parent | fbade3eebddfb465d965715b7901c07adb846bb3 (diff) |
Use ::isinf and ::isnan if libc defines them
PR libstdc++/48891
* acinclude.m4 (GLIBCXX_CHECK_MATH11_PROTO): Check for obsolete isinf
and isnan functions.
* config.h.in: Regenerate.
* configure: Regenerate.
* include/c_global/cmath (isinf(double), isnan(double))
[_GLIBCXX_HAVE_OBSOLETE_ISINF_ISNAN]: Import via using-directive.
* testsuite/26_numerics/headers/cmath/48891.cc: New.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@232327 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/configure')
-rwxr-xr-x | libstdc++-v3/configure | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 94120ec4dd5..38f14f6729e 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -18174,6 +18174,54 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_math11_overload" >&5 $as_echo "$glibcxx_cv_math11_overload" >&6; } ;; + *-*-*gnu*) + # If <math.h> defines the obsolete isinf(double) and isnan(double) + # functions (instead of or as well as the C99 generic macros) then we + # can't define std::isinf(double) and std::isnan(double) in <cmath> + # and must use the ones from <math.h> instead. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for obsolete isinf and isnan functions in <math.h>" >&5 +$as_echo_n "checking for obsolete isinf and isnan functions in <math.h>... " >&6; } + if test "${glibcxx_cv_obsolete_isinf_isnan+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <math.h> + #undef isinf + #undef isnan + namespace std { + using ::isinf; + bool isinf(float); + bool isinf(long double); + using ::isnan; + bool isnan(float); + bool isnan(long double); + } + using std::isinf; + using std::isnan; + bool b = isinf(0.0) || isnan(0.0); + +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + glibcxx_cv_obsolete_isinf_isnan=yes +else + glibcxx_cv_obsolete_isinf_isnan=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + + + + if test $glibcxx_cv_obsolete_isinf_isnan = yes; then + +$as_echo "#define HAVE_OBSOLETE_ISINF_ISNAN 1" >>confdefs.h + + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_obsolete_isinf_isnan" >&5 +$as_echo "$glibcxx_cv_obsolete_isinf_isnan" >&6; } + ;; esac CXXFLAGS="$ac_save_CXXFLAGS" |