aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2013-06-09 15:47:34 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2013-06-09 15:47:34 +0100
commit48197c2ea1e4883a5b379c47fc3d50325f6269b8 (patch)
treeb68cd8ed52d6e84f689d31089019389c9bb6b505
parent7cc8754ad93be42cf7cd6f1cba68621c93accf89 (diff)
downloadrspamd-48197c2ea1e4883a5b379c47fc3d50325f6269b8.tar.gz
rspamd-48197c2ea1e4883a5b379c47fc3d50325f6269b8.zip
Test for expl function presence.
-rw-r--r--CMakeLists.txt1
-rw-r--r--config.h.in2
-rw-r--r--src/classifiers/bayes.c4
3 files changed, 7 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c65bfb9c..fe0c2cab8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -883,6 +883,7 @@ CHECK_FUNCTION_EXISTS(wait4 HAVE_WAIT4)
CHECK_FUNCTION_EXISTS(waitpid HAVE_WAITPID)
CHECK_FUNCTION_EXISTS(flock HAVE_FLOCK)
CHECK_FUNCTION_EXISTS(tanhl HAVE_TANHL)
+CHECK_FUNCTION_EXISTS(expl HAVE_EXPL)
CHECK_FUNCTION_EXISTS(sendfile HAVE_SENDFILE)
CHECK_FUNCTION_EXISTS(mkstemp HAVE_MKSTEMP)
CHECK_FUNCTION_EXISTS(setitimer HAVE_SETITIMER)
diff --git a/config.h.in b/config.h.in
index 0ecb53059..a39f2d17e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -144,6 +144,8 @@
#cmakedefine HAVE_TANHL 1
+#cmakedefine HAVE_EXPL 1
+
#cmakedefine HAVE_SA_SIGINFO 1
#cmakedefine DEBUG_MODE 1
diff --git a/src/classifiers/bayes.c b/src/classifiers/bayes.c
index 77e02ea6b..f8aed3ac7 100644
--- a/src/classifiers/bayes.c
+++ b/src/classifiers/bayes.c
@@ -121,7 +121,11 @@ inv_chi_square (gdouble value, gint freedom_deg)
value /= 2.;
errno = 0;
+#ifdef HAVE_EXPL
prob = expl (-value);
+#else
+ prob = exp (-value);
+#endif
if (errno == ERANGE) {
msg_err ("exp overflow");
return 0;