From d355878be5616dc871058cb931b281b1d5cfbfbc Mon Sep 17 00:00:00 2001 From: Diogo Franco Date: Wed, 27 Jan 2010 13:11:08 -0800 Subject: [PATCH] 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. --- common/osdep.h | 4 ++++ configure | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/common/osdep.h b/common/osdep.h index abae9ac2..99888039 100644 --- a/common/osdep.h +++ b/common/osdep.h @@ -34,6 +34,10 @@ #include #endif +#ifndef HAVE_LOG2F +#define log2f(x) (logf((x))/0.693147180559945f) +#endif + #ifdef _WIN32 #include // _setmode() #include // _O_BINARY diff --git a/configure b/configure index 7cb14ba8..04f357d0 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 -- 2.47.3