]> git.videolan.org Git - x264.git/commitdiff
Add configure check for log2 support
authorDiogo Franco <diogomfranco@gmail.com>
Wed, 27 Jan 2010 21:11:08 +0000 (13:11 -0800)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Sat, 30 Jan 2010 12:31:43 +0000 (04:31 -0800)
Some incredibly braindamaged operating systems, such as FreeBSD, blatantly ignore the C specification and omit certain functions that are required by ISO C.
log2f is one of these functions that periodically goes missing in such operating systems.

common/osdep.h
configure

index abae9ac28c9d89920f58a9a8ed414b3c027124ce..998880398d8d960fdae14cd3825167d2dd09f71d 100644 (file)
 #include <inttypes.h>
 #endif
 
+#ifndef HAVE_LOG2F
+#define log2f(x) (logf((x))/0.693147180559945f)
+#endif
+
 #ifdef _WIN32
 #include <io.h>    // _setmode()
 #include <fcntl.h> // _O_BINARY
index 7cb14ba8fe2d4c58f9ef24af34019820ba4e918d..04f357d0a5823fdd88a15c3e5c713fa9eab9e31a 100755 (executable)
--- a/configure
+++ b/configure
@@ -477,6 +477,10 @@ if test "$pthread" = "yes" ; then
     LDFLAGS="$LDFLAGS $libpthread"
 fi
 
+if cc_check "math.h" "-Werror" "return log2f(2);" ; then
+    CFLAGS="$CFLAGS -DHAVE_LOG2F"
+fi
+
 if [ "$lavf_input" = "auto" ] ; then
     lavf_input="no"
     if ${cross_prefix}pkg-config --exists libavformat libavcodec libswscale 2>$DEVNULL; then