Hello!
Please excuse me if this is not the proper way to submit a patch, but I must admit I am not familiar with the sourceforge ways...
Gnuplot fails to build on architectures that do not handle the underflow floating-point exception, such as MIPS soft-float. This is because complexfun.c carries the implicit (and incorrect) assumption that, if the header fenv.h is available, then it must define FE_UNDERFLOW
. In reality, the latter is only defined if the implementation can handle the exception.
The problem was uncovered by the autobuilders of the Buildroot project. The patch below fixes the following build failures (see the files build-end.log):
The patch was made against tag 6.0.1, and it applies cleanly on master.
Regards,
Edgar Bonet.
------------------------------------------------------------------ >8 --
From: Edgar Bonet <bonet@grenoble.cnrs.fr>
Subject: [PATCH] Only use FE_UNDERFLOW if it is defined
According to fenv(3), the macro FE_UNDERFLOW is defined by fenv.h only
if the implementation supports handling of the underflow exception. Do
not assume the presence of fenv.h implies FE_UNDERFLOW is defined.
Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
---
src/complexfun.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/complexfun.c b/src/complexfun.c
index a87d773c5..1d3c9aaf0 100644
--- a/src/complexfun.c
+++ b/src/complexfun.c
@@ -86,7 +86,7 @@
int_error(NO_CARET, "%s: error present on entry (errno %d %s)", who, errno, strerror(errno));
#endif
-#ifdef HAVE_FENV_H
+#ifdef FE_UNDERFLOW
#define handle_underflow( who, var ) \
if (errno) { \
if (fetestexcept(FE_UNDERFLOW)) { \
--
2.34.1
Applied. Thanks.