From e1f8a7d4dc9f0dd38e2ac6479c620d7e35ed78c7 Mon Sep 17 00:00:00 2001 From: Sami Vaarala Date: Sun, 8 Sep 2013 23:38:16 +0300 Subject: [PATCH] DUK_USE_MATH_xxx detection --- src/duk_features.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/duk_features.h b/src/duk_features.h index 805d6d68..3f5d180f 100644 --- a/src/duk_features.h +++ b/src/duk_features.h @@ -8,6 +8,7 @@ * * Useful resources: * + * http://sourceforge.net/p/predef/wiki/Home/ * http://sourceforge.net/p/predef/wiki/Architectures/ * * FIXME: at the moment there is no direct way of configuring @@ -274,6 +275,21 @@ #undef DUK_USE_GCC_PRAGMAS #endif +/* Some math functions are C99 only. This is also an issue with some + * embedded environments using uclibc where uclibc has been configured + * not to provide some functions. For now, use replacements whenever + * using uclibc. + */ +#if defined(_DUK_C99) && !defined(__UCLIBC__) +#define DUK_USE_MATH_FMIN +#define DUK_USE_MATH_FMAX +#define DUK_USE_MATH_ROUND +#else +#undef DUK_USE_MATH_FMIN +#undef DUK_USE_MATH_FMAX +#undef DUK_USE_MATH_ROUND +#endif + /* * Platform specific defines *