From 3bd75cefd81c116eb4fce9115ce7593dfd0ce31f Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 5 Feb 2012 14:23:33 +0900 Subject: [PATCH] Autoconfiscate log2f. Android doesn't supply log2f for us (though it does have all the other float calls ruamoko wants). --- config.d/library_functions.m4 | 8 ++++++++ libs/ruamoko/rua_math.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/config.d/library_functions.m4 b/config.d/library_functions.m4 index ea41c22aa..f36de75bf 100644 --- a/config.d/library_functions.m4 +++ b/config.d/library_functions.m4 @@ -69,3 +69,11 @@ AC_TRY_LINK( AC_MSG_RESULT(no) ) AM_CONDITIONAL(BUILD_GETOPT, test "x$BUILD_GETOPT" = "xyes") + +AC_MSG_CHECKING(for log2f) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include ]], [float (*foo)(float) = log2f;])], + AC_DEFINE(HAVE_LOG2F, 1, [Define if you have log2f.]) + [HAVE_LOG2F=yes], + [HAVE_LOG2F=no]) +AC_MSG_RESULT($HAVE_LOG2F) diff --git a/libs/ruamoko/rua_math.c b/libs/ruamoko/rua_math.c index c5d7ca35e..15e233c46 100644 --- a/libs/ruamoko/rua_math.c +++ b/libs/ruamoko/rua_math.c @@ -95,7 +95,11 @@ bi_log (progs_t *pr) static void bi_log2 (progs_t *pr) { +#ifdef HAVE_LOG2F R_FLOAT (pr) = log2f (P_FLOAT (pr, 0)); +#else + R_FLOAT (pr) = logf (P_FLOAT (pr, 0)) / M_LOG2E; +#endif } static void