diff options
author | Thomas Petazzoni <thomas.petazzoni@free-electrons.com> | 2015-09-17 15:43:27 +0200 |
---|---|---|
committer | Oded Gabbay <oded.gabbay@gmail.com> | 2015-09-20 15:50:04 +0300 |
commit | 4297e9058d252cac653723fe0b1bee559fbac3a4 (patch) | |
tree | ebcdc098b03bd72777fdcae0ce022d98992a9b6a | |
parent | 8189fad9610981d5b4dcd8f8980ff169110fb33c (diff) |
test: add a check for FE_DIVBYZERO
Some architectures, such as Microblaze and Nios2, currently do not
implement FE_DIVBYZERO, even though they have <fenv.h> and
feenableexcept(). This commit adds a configure.ac check to verify
whether FE_DIVBYZERO is defined or not, and if not, disables the
problematic code in test/utils.c.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | test/utils.c | 2 |
2 files changed, 7 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index f93cc30f..424bfd34 100644 --- a/configure.ac +++ b/configure.ac @@ -891,6 +891,11 @@ if test x$have_feenableexcept = xyes; then AC_DEFINE(HAVE_FEENABLEEXCEPT, 1, [Whether we have feenableexcept()]) fi +AC_CHECK_DECL([FE_DIVBYZERO], + [AC_DEFINE(HAVE_FEDIVBYZERO, 1, [Whether we have FE_DIVBYZERO])], + [], + [[#include <fenv.h>]]) + AC_CHECK_FUNC(gettimeofday, have_gettimeofday=yes, have_gettimeofday=no) AC_CHECK_HEADER(sys/time.h, have_sys_time_h=yes, have_sys_time_h=no) if test x$have_gettimeofday = xyes && test x$have_sys_time_h = xyes; then diff --git a/test/utils.c b/test/utils.c index 222d4d53..86579669 100644 --- a/test/utils.c +++ b/test/utils.c @@ -966,9 +966,11 @@ enable_divbyzero_exceptions (void) { #ifdef HAVE_FENV_H #ifdef HAVE_FEENABLEEXCEPT +#ifdef HAVE_FEDIVBYZERO feenableexcept (FE_DIVBYZERO); #endif #endif +#endif } void |