[x264-devel] commit: Add configure check for log2 support (Diogo Franco )

git version control git at videolan.org
Sat Jan 30 13:58:01 CET 2010


x264 | branch: master | Diogo Franco <diogomfranco at gmail.com> | Wed Jan 27 13:11:08 2010 -0800| [d355878be5616dc871058cb931b281b1d5cfbfbc] | committer: Jason Garrett-Glaser 

Add configure check for log2 support
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.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=d355878be5616dc871058cb931b281b1d5cfbfbc
---

 common/osdep.h |    4 ++++
 configure      |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/common/osdep.h b/common/osdep.h
index abae9ac..9988803 100644
--- a/common/osdep.h
+++ b/common/osdep.h
@@ -34,6 +34,10 @@
 #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
diff --git a/configure b/configure
index 7cb14ba..04f357d 100755
--- 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



More information about the x264-devel mailing list