]> git.sesse.net Git - x264/commitdiff
Implement ffms2 version check
authorDiogo Franco <diogomfranco@gmail.com>
Thu, 28 Jan 2010 04:29:50 +0000 (20:29 -0800)
committerFiona Glaser <fiona@x264.com>
Sat, 30 Jan 2010 12:31:50 +0000 (04:31 -0800)
Depends on ffms2 version 2.13.1 (r272).
Tries pkg-config's built-in version checking first.
Uses only the preprocessor to avoid cross-compilation issues.

configure

index 04f357d0a5823fdd88a15c3e5c713fa9eab9e31a..7a534dc6279281086f7317a58173c18e8834d122 100755 (executable)
--- a/configure
+++ b/configure
@@ -507,10 +507,17 @@ if [ "$lavf_input" = "auto" ] ; then
 fi
 
 if [ "$ffms_input" = "auto" ] ; then
+    ffms_major="2"; ffms_minor="13"; ffms_micro="1"; ffms_bump="0"
+
     ffms_input="no"
-    if ${cross_prefix}pkg-config --exists ffms2 2>$DEVNULL; then
+    [ $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_LIBS $(${cross_prefix}pkg-config --cflags ffms2)"
+        api_check="no"
+    else
+        api_check="yes"
     fi
     [ -z "$FFMS2_LIBS" ] && FFMS2_LIBS="-lffms2"
 
@@ -520,6 +527,17 @@ if [ "$ffms_input" = "auto" ] ; 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