Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2020-02-27 14:46:37 +0300
committerBrecht Van Lommel <brecht@blender.org>2020-02-27 14:52:19 +0300
commitabc040f26cb13b17ac52ea8579dc0d0d894f8bfc (patch)
tree570bdbd961ba9407f515db2a9b0895d0ee2a42cb /intern
parentcb2f5d498e450da0b2f26702ed4d2691d9ee3750 (diff)
Build: change libc compatibility code to only be used for new glibc
This way we can still use fast math functions.
Diffstat (limited to 'intern')
-rw-r--r--intern/libc_compat/CMakeLists.txt2
-rw-r--r--intern/libc_compat/libc_compat.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/intern/libc_compat/CMakeLists.txt b/intern/libc_compat/CMakeLists.txt
index 21d252806d4..f8fede5673b 100644
--- a/intern/libc_compat/CMakeLists.txt
+++ b/intern/libc_compat/CMakeLists.txt
@@ -32,4 +32,6 @@ set(SRC
set(LIB
)
+add_c_flag(-ffast-math)
+
blender_add_lib(bf_intern_libc_compat "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/intern/libc_compat/libc_compat.c b/intern/libc_compat/libc_compat.c
index bc1a43c6fb1..8da3ca218af 100644
--- a/intern/libc_compat/libc_compat.c
+++ b/intern/libc_compat/libc_compat.c
@@ -21,7 +21,11 @@
* incompatible with the system libraries that Blender is built on. To solve
* this we add a few -ffast-math symbols that can be missing. */
-#include <math.h>
+#ifdef __linux__
+# include <features.h>
+# include <math.h>
+
+# if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 31)
double __exp_finite(double x);
double __acos_finite(double x);
@@ -107,3 +111,6 @@ float __powf_finite(float x, float y)
{
return powf(x, y);
}
+
+# endif /* __GLIBC_PREREQ */
+#endif /* __linux__ */