From 8f2eb70803099d4b533ecc10fc259041d8714210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 26 Jul 2017 20:03:35 +0200 Subject: [PATCH] build: check for libva-2.0 Check for libva-2.0 since libva's developers decided to increase the library's version number. https://bugzilla.gnome.org/show_bug.cgi?id=784398 --- configure.ac | 25 +++++++++++++++++++------ meson.build | 27 +++++++++++++++++++++++---- meson_options.txt | 1 + 3 files changed, 43 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index 230f352273..ce1e02348d 100644 --- a/configure.ac +++ b/configure.ac @@ -120,6 +120,11 @@ AG_GST_SET_PACKAGE_RELEASE_DATETIME_WITH_NANO([$PACKAGE_VERSION_NANO], ["${srcdir}/gstreamer-vaapi.doap"], [$PACKAGE_VERSION_MAJOR.$PACKAGE_VERSION_MINOR.$PACKAGE_VERSION_MICRO]) +AC_ARG_WITH([libva], + [AS_HELP_STRING([--with-libva[[=VERSION]]], + [which version of libva use (1 or 2) @<:@default=check@:>@])], + [], [with_libva="check"]) + AC_ARG_ENABLE([encoders], AS_HELP_STRING([--enable-encoders], [enable video encoders @<:@default=yes@:>@]), @@ -505,15 +510,23 @@ dnl -- VA-API -- dnl --------------------------------------------------------------------------- dnl Core API -PKG_CHECK_MODULES([LIBVA], [libva >= $VAAPI_REQ libva != 0.99.0]) -VA_VERSION_STR=`$PKG_CONFIG --modversion libva` -VA_DRIVERS_PATH=`$PKG_CONFIG --variable=driverdir libva` +LIBVA_VERSION= +AS_CASE([$with_libva], + [2], [PKG_CHECK_MODULES([LIBVA], [libva-2.0 >= 1.0.0], + [LIBVA_VERSION="-2.0"])], + [1], [PKG_CHECK_MODULES([LIBVA], [libva >= $VAAPI_REQ libva != 0.99.0])], + [PKG_CHECK_MODULES([LIBVA], [libva-2.0 >= 1.0.0], + [LIBVA_VERSION="-2.0"], + [PKG_CHECK_MODULES([LIBVA], [libva >= $VAAPI_REQ libva != 0.99.0])])]) + +VA_VERSION_STR=`$PKG_CONFIG --modversion libva$LIBVA_VERSION` +VA_DRIVERS_PATH=`$PKG_CONFIG --variable=driverdir libva$LIBVA_VERSION` AC_DEFINE_UNQUOTED([VA_DRIVERS_PATH], ["$VA_DRIVERS_PATH"], [VA drivers path]) dnl VA/DRM API if test $USE_DRM -eq 1; then - PKG_CHECK_MODULES([LIBVA_DRM], [libva-drm >= $VAAPI_DRM_REQ], + PKG_CHECK_MODULES([LIBVA_DRM], [libva-drm$LIBVA_VERSION >= $VAAPI_DRM_REQ], [ saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $LIBVA_DRM_CFLAGS" @@ -524,7 +537,7 @@ fi dnl VA/X11 API if test $USE_X11 -eq 1; then - PKG_CHECK_MODULES(LIBVA_X11, [libva-x11 >= $VAAPI_X11_REQ], + PKG_CHECK_MODULES(LIBVA_X11, [libva-x11$LIBVA_VERSION >= $VAAPI_X11_REQ], [], [USE_X11=0]) fi @@ -884,7 +897,7 @@ fi dnl VA/Wayland API if test $USE_WAYLAND -eq 1; then - PKG_CHECK_MODULES([LIBVA_WAYLAND], [libva-wayland >= $VAAPI_WLD_REQ], + PKG_CHECK_MODULES([LIBVA_WAYLAND], [libva-wayland$LIBVA_VERSION >= $VAAPI_WLD_REQ], [], [USE_WAYLAND=0]) fi diff --git a/meson.build b/meson.build index 10d2af0ce7..8e39584a17 100644 --- a/meson.build +++ b/meson.build @@ -38,11 +38,30 @@ gstcodecparsers_dep = dependency('gstreamer-codecparsers-1.0', version : gst_req gstgl_dep = dependency('gstreamer-gl-1.0', version : gst_req, fallback : ['gst-plugins-bad', 'gstgl_dep'], required: false) gmodule_dep = dependency('gmodule-2.0', required: false) -libva_dep = dependency('libva', version: libva_req) -libva_drm_dep = dependency('libva-drm', version: '>= 0.33.0', required: false) -libva_wayland_dep = dependency('libva-wayland', version: '>= 0.33.0', required: false) -libva_x11_dep = dependency('libva-x11', version: '>= 0.31.0', required: false) +libva_version = '' +if get_option('with_libva') == 'auto' + libva_dep = dependency('libva-2.0', required : false) + if not libva_dep.found() + libva_dep = dependency('libva', version: libva_req) + else + libva_version = '-2.0' + endif +else + if get_option('with_libva') == '2' + libva_dep = dependency('libva-2.0') + libva_version = '-2.0' + else + libva_dep = dependency('libva', version: libva_req) + endif +endif + +libva_drm_dep = dependency('libva-drm' + libva_version, version: '>= 0.33.0', + required: false) +libva_wayland_dep = dependency('libva-wayland' + libva_version, + version: '>= 0.33.0', required: false) +libva_x11_dep = dependency('libva-x11' + libva_version, version: '>= 0.31.0', + required: false) libdrm_dep = dependency('libdrm', required: false) libudev_dep = dependency('libudev', required: false) egl_dep = dependency('egl', required: false) diff --git a/meson_options.txt b/meson_options.txt index 018f8bc33d..b411067cbe 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,4 @@ +option('with_libva', type : 'combo', choices : ['1', '2', 'auto'], value : 'auto') option('with_encoders', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto') option('with_drm', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto') option('with_x11', type : 'combo', choices : ['yes', 'no', 'auto'], value : 'auto')