+ define HAVE_PTHREAD
+ LDFLAGS="$LDFLAGS $libpthread"
+fi
+
+if cc_check "math.h" "-Werror" "return log2f(2);" ; then
+ define HAVE_LOG2F
+fi
+
+if [ "$vis" = "yes" ] && cc_check "X11/Xlib.h" "-L/usr/X11R6/lib -lX11" "XOpenDisplay( 0 );" ; then
+ LDFLAGS="-L/usr/X11R6/lib -lX11 $LDFLAGS"
+ define HAVE_VISUALIZE
+else
+ vis="no"
+fi
+
+if [ "$lavf_input" = "auto" ] ; then
+ lavf_input="no"
+ if ${cross_prefix}pkg-config --exists libavformat libavcodec libswscale 2>$DEVNULL; then
+ LAVF_LIBS="$LAVF_LIBS $(${cross_prefix}pkg-config --libs libavformat libavcodec libswscale)"
+ LAVF_CFLAGS="$LAVF_CFLAGS $(${cross_prefix}pkg-config --cflags libavformat libavcodec libswscale)"
+ fi
+ if [ -z "$LAVF_LIBS" -a -z "$LAVF_CFLAGS" ]; then
+ LAVF_LIBS="-lavformat -lswscale"
+ for lib in -lpostproc -lavcodec -lavutil -lm -lz -lbz2 $libpthread -lavifil32; do
+ cc_check "" $lib && LAVF_LIBS="$LAVF_LIBS $lib"
+ done
+ fi
+ LAVF_LIBS="-L. $LAVF_LIBS"
+ if cc_check libavformat/avformat.h "$LAVF_CFLAGS $LAVF_LIBS" && \
+ cc_check libswscale/swscale.h "$LAVF_CFLAGS $LAVF_LIBS" ; then
+ # avcodec_decode_video2 is currently the most recently added function that we use; it was added in r18351
+ if cc_check libavformat/avformat.h "$LAVF_CFLAGS $LAVF_LIBS" "avcodec_decode_video2( NULL, NULL, NULL, NULL );" ; then
+ lavf_input="yes"
+ define LAVF_INPUT
+ else
+ echo "Warning: libavformat is too old, update to ffmpeg r18351+"
+ fi
+ fi
+fi
+
+if [ "$ffms_input" = "auto" ] ; then
+ ffms_major="2"; ffms_minor="13"; ffms_micro="1"; ffms_bump="0"
+
+ ffms_input="no"
+ [ $ffms_micro -gt 0 -o $ffms_bump -gt 0 ] && vmicro=".$ffms_micro"
+ [ $ffms_bump -gt 0 ] && vbump=".$ffms_bump"
+ if ${cross_prefix}pkg-config --atleast-version="$ffms_major.$ffms_minor$vmicro$vbump" ffms2 2>$DEVNULL; then
+ FFMS2_LIBS="$FFMS2_LIBS $(${cross_prefix}pkg-config --libs ffms2)"
+ FFMS2_CFLAGS="$FFMS2_CFLAGS $(${cross_prefix}pkg-config --cflags ffms2)"
+ api_check="no"
+ else
+ api_check="yes"
+ fi
+ [ -z "$FFMS2_LIBS" ] && FFMS2_LIBS="-lffms2"
+
+ if cc_check ffms.h "$FFMS2_CFLAGS $FFMS2_LIBS" "FFMS_DestroyVideoSource(0);" ; then
+ ffms_input="yes"
+ elif cc_check ffms.h "$FFMS2_CFLAGS $FFMS2_LIBS -lstdc++ $LAVF_LIBS" "FFMS_DestroyVideoSource(0);" ; then
+ ffms_input="yes"
+ FFMS2_LIBS="$FFMS2_LIBS -lstdc++ $LAVF_LIBS"
+ fi
+
+ if [ $api_check = "yes" -a $ffms_input = "yes" ]; then
+ log_check "whether ffms2 version is at least $ffms_major.$ffms_minor$vmicro$vbump"
+ $CC $CFLAGS $FFMS2_CFLAGS -c -o conftest -x c - >$DEVNULL 2>&1 <<EOF
+#include <ffms.h>
+#if FFMS_VERSION < (($ffms_major << 24) | ($ffms_minor << 16) | ($ffms_micro << 8) | $ffms_bump)
+#error Requires ffms2 version 2.13.1
+#endif
+EOF
+ [ $? = 0 ] && log_ok || { ffms_input="no"; log_fail; }
+ fi
+fi
+
+if [ "$ffms_input" = "yes" ]; then
+ LDFLAGSCLI="$FFMS2_LIBS $LDFLAGSCLI"
+ [ -n "$FFMS2_CFLAGS" ] && CFLAGS="$CFLAGS $FFMS2_CFLAGS"
+ define FFMS_INPUT
+elif [ "$lavf_input" = "yes" ]; then
+ LDFLAGSCLI="$LAVF_LIBS $LDFLAGSCLI"
+ [ -n "$LAVF_CFLAGS" ] && CFLAGS="$CFLAGS $LAVF_CFLAGS"