[FFmpeg-devel] use the correct option of pkg-config to check version

Submitted by Guo, Yejun on March 4, 2019, 3:56 p.m.

Details

Message ID 1551715006-3519-1-git-send-email-yejun.guo@intel.com
State New
Headers show

Commit Message

Guo, Yejun March 4, 2019, 3:56 p.m.
I tried pkg-config on my local ubuntu16.04 system, the option like
">=1.2" or "<3.2" does not work, we have to use option --atleast-version
and --max-version separately.

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
---
 configure | 57 ++++++++++++++++++++++++++++++---------------------------
 1 file changed, 30 insertions(+), 27 deletions(-)

Comments

Timo Rothenpieler March 4, 2019, 9:43 a.m.
This seems weird to me, why would there only be an issue on Ubuntu 16.04?
I'd assume that the code in question has been tested quite a bit.

Do you have an example of where and how it fails?
mypopy@gmail.com March 4, 2019, 11:49 a.m.
On Mon, Mar 4, 2019 at 4:06 PM Guo, Yejun <yejun.guo@intel.com> wrote:
>
> I tried pkg-config on my local ubuntu16.04 system, the option like
> ">=1.2" or "<3.2" does not work, we have to use option --atleast-version
> and --max-version separately.
>
> Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
> ---
>  configure | 57 ++++++++++++++++++++++++++++++---------------------------
>  1 file changed, 30 insertions(+), 27 deletions(-)
>
> diff --git a/configure b/configure
> index 3e2a487..e397d19 100755
> --- a/configure
> +++ b/configure
> @@ -6045,10 +6045,13 @@ fi
>
>  if ! disabled ffnvcodec; then
>      ffnv_hdr_list="ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h"
> -    check_pkg_config ffnvcodec "ffnvcodec >= 9.0.18.0" "$ffnv_hdr_list" "" || \
> -      check_pkg_config ffnvcodec "ffnvcodec >= 8.2.15.8 ffnvcodec < 8.3" "$ffnv_hdr_list" "" || \
> -      check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.9 ffnvcodec < 8.2" "$ffnv_hdr_list" "" || \
> -      check_pkg_config ffnvcodec "ffnvcodec >= 8.0.14.9 ffnvcodec < 8.1" "$ffnv_hdr_list" ""
> +    check_pkg_config ffnvcodec "ffnvcodec --atleast-version=9.0.18.0" "$ffnv_hdr_list" "" || \
> +      (check_pkg_config ffnvcodec "ffnvcodec --atleast-version=8.2.15.8" "$ffnv_hdr_list" ""  && \
> +       check_pkg_config ffnvcodec "ffnvcodec --max-version=8.2.99" "$ffnv_hdr_list" "") || \
> +      (check_pkg_config ffnvcodec "ffnvcodec --atleast-version=8.1.24.9" "$ffnv_hdr_list" ""  && \
> +       check_pkg_config ffnvcodec "ffnvcodec --max-version=8.1.99" "$ffnv_hdr_list" "") || \
> +      (check_pkg_config ffnvcodec "ffnvcodec --atleast-version=8.0.14.9" "$ffnv_hdr_list" ""  && \
> +       check_pkg_config ffnvcodec "ffnvcodec --max-version=8.0.99" "$ffnv_hdr_list" "")
>  fi
>
>  check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
> @@ -6128,8 +6131,8 @@ enabled gmp               && require gmp gmp.h mpz_export -lgmp
>  enabled gnutls            && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init
>  enabled jni               && { [ $target_os = "android" ] && check_headers jni.h && enabled pthreads || die "ERROR: jni not found"; }
>  enabled ladspa            && require_headers "ladspa.h dlfcn.h"
> -enabled libaom            && require_pkg_config libaom "aom >= 1.0.0" aom/aom_codec.h aom_codec_version
> -enabled libaribb24        && { check_pkg_config libaribb24 "aribb24 > 1.0.3" "aribb24/aribb24.h" arib_instance_new ||
> +enabled libaom            && require_pkg_config libaom "aom --atleast-version=1.0.0" aom/aom_codec.h aom_codec_version
> +enabled libaribb24        && { check_pkg_config libaribb24 "aribb24 --atleast-version=1.0.4" "aribb24/aribb24.h" arib_instance_new ||
>                                 { enabled gpl && require_pkg_config libaribb24 aribb24 "aribb24/aribb24.h" arib_instance_new; } ||
>                                 die "ERROR: libaribb24 requires version higher than 1.0.3 or --enable-gpl."; }
>  enabled lv2               && require_pkg_config lv2 lilv-0 "lilv/lilv.h" lilv_world_new
> @@ -6142,8 +6145,8 @@ enabled libcelt           && require libcelt celt/celt.h celt_decode -lcelt0 &&
>                                 die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
>  enabled libcaca           && require_pkg_config libcaca caca caca.h caca_create_canvas
>  enabled libcodec2         && require libcodec2 codec2/codec2.h codec2_create -lcodec2
> -enabled libdav1d          && require_pkg_config libdav1d "dav1d >= 0.1.0" "dav1d/dav1d.h" dav1d_version
> -enabled libdavs2          && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open
> +enabled libdav1d          && require_pkg_config libdav1d "dav1d --atleast-version=0.1.0" "dav1d/dav1d.h" dav1d_version
> +enabled libdavs2          && require_pkg_config libdavs2 "davs2 --atleast-version=1.6.0" davs2.h davs2_decoder_open
>  enabled libdc1394         && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
>  enabled libdrm            && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
>  enabled libfdk_aac        && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
> @@ -6162,7 +6165,7 @@ enabled libgsm            && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
>                                 done || die "ERROR: libgsm not found"; }
>  enabled libilbc           && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc $pthreads_extralibs
>  enabled libklvanc         && require libklvanc libklvanc/vanc.h klvanc_context_create -lklvanc
> -enabled libkvazaar        && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
> +enabled libkvazaar        && require_pkg_config libkvazaar "kvazaar --atleast-version=0.8.1" kvazaar.h kvz_api_get
>  enabled liblensfun        && require_pkg_config liblensfun lensfun lensfun.h lf_db_new
>  # While it may appear that require is being used as a pkg-config
>  # fallback for libmfx, it is actually being used to detect a different
> @@ -6186,9 +6189,9 @@ enabled libopencv         && { check_headers opencv2/core/core_c.h &&
>                                   require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
>                                 require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
>  enabled libopenh264       && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
> -enabled libopenjpeg       && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
> -                               { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
> -enabled libopenmpt        && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
> +enabled libopenjpeg       && { check_pkg_config libopenjpeg "libopenjp2 --atleast-version=2.1.0" openjpeg.h opj_version ||
> +                               { require_pkg_config libopenjpeg "libopenjp2 --atleast-version=2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
> +enabled libopenmpt        && require_pkg_config libopenmpt "libopenmpt --atleast-version=0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
>  enabled libopus           && {
>      enabled libopus_decoder && {
>          require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
> @@ -6200,7 +6203,7 @@ enabled libopus           && {
>  enabled libpulse          && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
>  enabled librsvg           && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
>  enabled librtmp           && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
> -enabled librubberband     && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
> +enabled librubberband     && require_pkg_config librubberband "rubberband --atleast-version=1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
>  enabled libshine          && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
>  enabled libsmbclient      && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
>                                 require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
> @@ -6208,7 +6211,7 @@ enabled libsnappy         && require libsnappy snappy-c.h snappy_compress -lsnap
>  enabled libsoxr           && require libsoxr soxr.h soxr_create -lsoxr
>  enabled libssh            && require_pkg_config libssh libssh libssh/sftp.h sftp_init
>  enabled libspeex          && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
> -enabled libsrt            && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
> +enabled libsrt            && require_pkg_config libsrt "srt --atleast-version=1.3.0" srt/srt.h srt_socket
>  enabled libtensorflow     && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
>  enabled libtesseract      && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
>  enabled libtheora         && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
> @@ -6217,29 +6220,29 @@ enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame
>                               { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
>                                 die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
>  enabled libv4l2           && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
> -enabled libvidstab        && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
> -enabled libvmaf           && require_pkg_config libvmaf "libvmaf >= 1.3.9" libvmaf.h compute_vmaf
> +enabled libvidstab        && require_pkg_config libvidstab "vidstab --atleast-version=0.98" vid.stab/libvidstab.h vsMotionDetectInit
> +enabled libvmaf           && require_pkg_config libvmaf "libvmaf --atleast-version=1.3.9" libvmaf.h compute_vmaf
>  enabled libvo_amrwbenc    && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
>  enabled libvorbis         && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
>                               require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
>
>  enabled libvpx            && {
>      enabled libvpx_vp8_decoder && {
> -        check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
> +        check_pkg_config libvpx_vp8_decoder "vpx --atleast-version=1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
>              check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
>                  die "ERROR: libvpx decoder version must be >=1.4.0";
>      }
>      enabled libvpx_vp8_encoder && {
> -        check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
> +        check_pkg_config libvpx_vp8_encoder "vpx --atleast-version=1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
>              check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
>                  die "ERROR: libvpx encoder version must be >=1.4.0";
>      }
>      enabled libvpx_vp9_decoder && {
> -        check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
> +        check_pkg_config libvpx_vp9_decoder "vpx --atleast-version=1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
>              check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
>      }
>      enabled libvpx_vp9_encoder && {
> -        check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
> +        check_pkg_config libvpx_vp9_encoder "vpx --atleast-version=1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
>              check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
>      }
>      if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
> @@ -6249,8 +6252,8 @@ enabled libvpx            && {
>
>  enabled libwavpack        && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput  -lwavpack
>  enabled libwebp           && {
> -    enabled libwebp_encoder      && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
> -    enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
> +    enabled libwebp_encoder      && require_pkg_config libwebp "libwebp --atleast-version=0.2.0" webp/encode.h WebPGetEncoderVersion
> +    enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux --atleast-version=0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
>  enabled libx264           && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
>                                 { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
>                                   warn "using libx264 without pkg-config"; } } &&
> @@ -6259,9 +6262,9 @@ enabled libx264           && { check_pkg_config libx264 x264 "stdint.h x264.h" x
>  enabled libx265           && require_pkg_config libx265 x265 x265.h x265_api_get &&
>                               require_cpp_condition libx265 x265.h "X265_BUILD >= 68"
>  enabled libxavs           && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
> -enabled libxavs2          && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get
> +enabled libxavs2          && require_pkg_config libxavs2 "xavs2 --atleast-version=1.3.0" "stdint.h xavs2.h" xavs2_api_get
>  enabled libxvid           && require libxvid xvid.h xvid_global -lxvidcore
> -enabled libzimg           && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version
> +enabled libzimg           && require_pkg_config libzimg "zimg --atleast-version=2.7.0" zimg.h zimg_get_api_version
>  enabled libzmq            && require_pkg_config libzmq libzmq zmq.h zmq_ctx_new
>  enabled libzvbi           && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new &&
>                               { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
> @@ -6308,11 +6311,11 @@ enabled openssl           && { check_pkg_config openssl openssl openssl/ssl.h OP
>                                 check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
>                                 die "ERROR: openssl not found"; }
>  enabled rkmpp             && { require_pkg_config rkmpp rockchip_mpp  rockchip/rk_mpi.h mpp_create &&
> -                               require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create &&
> +                               require_pkg_config rockchip_mpp "rockchip_mpp --atleast-version=1.3.7" rockchip/rk_mpi.h mpp_create &&
>                                 { enabled libdrm ||
>                                   die "ERROR: rkmpp requires --enable-libdrm"; }
>                               }
> -enabled vapoursynth       && require_pkg_config vapoursynth "vapoursynth-script >= 42" VSScript.h vsscript_init
> +enabled vapoursynth       && require_pkg_config vapoursynth "vapoursynth-script --atleast-version=42" VSScript.h vsscript_init
>
>
>  if enabled gcrypt; then
> @@ -6460,7 +6463,7 @@ test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
>  EOF
>
>  enabled vaapi &&
> -    check_pkg_config vaapi "libva >= 0.35.0" "va/va.h" vaInitialize
> +    check_pkg_config vaapi "libva --atleast-version=0.35.0" "va/va.h" vaInitialize
>
>  if enabled vaapi; then
>      check_pkg_config vaapi_drm "libva-drm" "va/va_drm.h" vaGetDisplayDRM
>

check_pkg_config used pkg-config --exists for version check (you can
check the man for pkg-config), and I can't reproduce this issue in
Ubuntu 16.04 LTS, can you check the pkg-config in you environment?
Guo, Yejun March 4, 2019, 11:57 a.m.
> -----Original Message-----

> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces@ffmpeg.org] On Behalf

> Of Timo Rothenpieler

> Sent: Monday, March 04, 2019 5:43 PM

> To: ffmpeg-devel@ffmpeg.org

> Subject: Re: [FFmpeg-devel] [PATCH] use the correct option of pkg-config to

> check version

> 

> This seems weird to me, why would there only be an issue on Ubuntu 16.04?


I guess it is a common issue, I'm at home and do not have other systems for a test.

> I'd assume that the code in question has been tested quite a bit.

> 

> Do you have an example of where and how it fails?


I've built and installed libvpx version 1.8 on my system with following vpx.pc:
$ cat /usr/local/lib/pkgconfig/vpx.pc 
# pkg-config file from libvpx v1.8.0-191-g503cb8e
prefix=/usr/local
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: vpx
Description: WebM Project VPx codec implementation
Version: 1.8.0
Requires:
Conflicts:
Libs: -L${libdir} -lvpx -lm
Libs.private: -lm -lpthread
Cflags: -I${includedir}


I did the following experiments to say it is an issue for the version check.

yguo18@yguo18-skl-u1604:/tmp$ pkg-config --exists  --print-errors  vpx >=1.2
yguo18@yguo18-skl-u1604:/tmp$ echo $?
0
yguo18@yguo18-skl-u1604:/tmp$ pkg-config --exists  --print-errors  vpx >=2.3
yguo18@yguo18-skl-u1604:/tmp$ echo $?
0

yguo18@yguo18-skl-u1604:/tmp$ pkg-config --exists  --print-errors  vpx --atleast-version=1.2
yguo18@yguo18-skl-u1604:/tmp$ echo $?
0
yguo18@yguo18-skl-u1604:/tmp$ pkg-config --exists  --print-errors  vpx --atleast-version=2.3
Requested 'vpx >= 2.3' but version of vpx is 1.8.0
yguo18@yguo18-skl-u1604:/tmp$ echo $?
1

yguo18@yguo18-skl-u1604:/tmp$ pkg-config --exists  --print-errors  vpx >= 1.2
Package 1.2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `1.2.pc'
to the PKG_CONFIG_PATH environment variable
No package '1.2' found
yguo18@yguo18-skl-u1604:/tmp$ echo $?
1
yguo18@yguo18-skl-u1604:/tmp$ pkg-config --exists  --print-errors  vpx >= 2.3
Package 2.3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `2.3.pc'
to the PKG_CONFIG_PATH environment variable
No package '2.3' found
yguo18@yguo18-skl-u1604:/tmp$ echo $?
1

Patch hide | download patch | download mbox

diff --git a/configure b/configure
index 3e2a487..e397d19 100755
--- a/configure
+++ b/configure
@@ -6045,10 +6045,13 @@  fi
 
 if ! disabled ffnvcodec; then
     ffnv_hdr_list="ffnvcodec/nvEncodeAPI.h ffnvcodec/dynlink_cuda.h ffnvcodec/dynlink_cuviddec.h ffnvcodec/dynlink_nvcuvid.h"
-    check_pkg_config ffnvcodec "ffnvcodec >= 9.0.18.0" "$ffnv_hdr_list" "" || \
-      check_pkg_config ffnvcodec "ffnvcodec >= 8.2.15.8 ffnvcodec < 8.3" "$ffnv_hdr_list" "" || \
-      check_pkg_config ffnvcodec "ffnvcodec >= 8.1.24.9 ffnvcodec < 8.2" "$ffnv_hdr_list" "" || \
-      check_pkg_config ffnvcodec "ffnvcodec >= 8.0.14.9 ffnvcodec < 8.1" "$ffnv_hdr_list" ""
+    check_pkg_config ffnvcodec "ffnvcodec --atleast-version=9.0.18.0" "$ffnv_hdr_list" "" || \
+      (check_pkg_config ffnvcodec "ffnvcodec --atleast-version=8.2.15.8" "$ffnv_hdr_list" ""  && \
+       check_pkg_config ffnvcodec "ffnvcodec --max-version=8.2.99" "$ffnv_hdr_list" "") || \
+      (check_pkg_config ffnvcodec "ffnvcodec --atleast-version=8.1.24.9" "$ffnv_hdr_list" ""  && \
+       check_pkg_config ffnvcodec "ffnvcodec --max-version=8.1.99" "$ffnv_hdr_list" "") || \
+      (check_pkg_config ffnvcodec "ffnvcodec --atleast-version=8.0.14.9" "$ffnv_hdr_list" ""  && \
+       check_pkg_config ffnvcodec "ffnvcodec --max-version=8.0.99" "$ffnv_hdr_list" "")
 fi
 
 check_cpp_condition winrt windows.h "!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)"
@@ -6128,8 +6131,8 @@  enabled gmp               && require gmp gmp.h mpz_export -lgmp
 enabled gnutls            && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init
 enabled jni               && { [ $target_os = "android" ] && check_headers jni.h && enabled pthreads || die "ERROR: jni not found"; }
 enabled ladspa            && require_headers "ladspa.h dlfcn.h"
-enabled libaom            && require_pkg_config libaom "aom >= 1.0.0" aom/aom_codec.h aom_codec_version
-enabled libaribb24        && { check_pkg_config libaribb24 "aribb24 > 1.0.3" "aribb24/aribb24.h" arib_instance_new ||
+enabled libaom            && require_pkg_config libaom "aom --atleast-version=1.0.0" aom/aom_codec.h aom_codec_version
+enabled libaribb24        && { check_pkg_config libaribb24 "aribb24 --atleast-version=1.0.4" "aribb24/aribb24.h" arib_instance_new ||
                                { enabled gpl && require_pkg_config libaribb24 aribb24 "aribb24/aribb24.h" arib_instance_new; } ||
                                die "ERROR: libaribb24 requires version higher than 1.0.3 or --enable-gpl."; }
 enabled lv2               && require_pkg_config lv2 lilv-0 "lilv/lilv.h" lilv_world_new
@@ -6142,8 +6145,8 @@  enabled libcelt           && require libcelt celt/celt.h celt_decode -lcelt0 &&
                                die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
 enabled libcaca           && require_pkg_config libcaca caca caca.h caca_create_canvas
 enabled libcodec2         && require libcodec2 codec2/codec2.h codec2_create -lcodec2
-enabled libdav1d          && require_pkg_config libdav1d "dav1d >= 0.1.0" "dav1d/dav1d.h" dav1d_version
-enabled libdavs2          && require_pkg_config libdavs2 "davs2 >= 1.6.0" davs2.h davs2_decoder_open
+enabled libdav1d          && require_pkg_config libdav1d "dav1d --atleast-version=0.1.0" "dav1d/dav1d.h" dav1d_version
+enabled libdavs2          && require_pkg_config libdavs2 "davs2 --atleast-version=1.6.0" davs2.h davs2_decoder_open
 enabled libdc1394         && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
 enabled libdrm            && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
 enabled libfdk_aac        && { check_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
@@ -6162,7 +6165,7 @@  enabled libgsm            && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
                                done || die "ERROR: libgsm not found"; }
 enabled libilbc           && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc $pthreads_extralibs
 enabled libklvanc         && require libklvanc libklvanc/vanc.h klvanc_context_create -lklvanc
-enabled libkvazaar        && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
+enabled libkvazaar        && require_pkg_config libkvazaar "kvazaar --atleast-version=0.8.1" kvazaar.h kvz_api_get
 enabled liblensfun        && require_pkg_config liblensfun lensfun lensfun.h lf_db_new
 # While it may appear that require is being used as a pkg-config
 # fallback for libmfx, it is actually being used to detect a different
@@ -6186,9 +6189,9 @@  enabled libopencv         && { check_headers opencv2/core/core_c.h &&
                                  require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
                                require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
 enabled libopenh264       && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
-enabled libopenjpeg       && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
-                               { require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
-enabled libopenmpt        && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
+enabled libopenjpeg       && { check_pkg_config libopenjpeg "libopenjp2 --atleast-version=2.1.0" openjpeg.h opj_version ||
+                               { require_pkg_config libopenjpeg "libopenjp2 --atleast-version=2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
+enabled libopenmpt        && require_pkg_config libopenmpt "libopenmpt --atleast-version=0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
 enabled libopus           && {
     enabled libopus_decoder && {
         require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
@@ -6200,7 +6203,7 @@  enabled libopus           && {
 enabled libpulse          && require_pkg_config libpulse libpulse pulse/pulseaudio.h pa_context_new
 enabled librsvg           && require_pkg_config librsvg librsvg-2.0 librsvg-2.0/librsvg/rsvg.h rsvg_handle_render_cairo
 enabled librtmp           && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
-enabled librubberband     && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
+enabled librubberband     && require_pkg_config librubberband "rubberband --atleast-version=1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
 enabled libshine          && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
 enabled libsmbclient      && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
                                require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
@@ -6208,7 +6211,7 @@  enabled libsnappy         && require libsnappy snappy-c.h snappy_compress -lsnap
 enabled libsoxr           && require libsoxr soxr.h soxr_create -lsoxr
 enabled libssh            && require_pkg_config libssh libssh libssh/sftp.h sftp_init
 enabled libspeex          && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
-enabled libsrt            && require_pkg_config libsrt "srt >= 1.3.0" srt/srt.h srt_socket
+enabled libsrt            && require_pkg_config libsrt "srt --atleast-version=1.3.0" srt/srt.h srt_socket
 enabled libtensorflow     && require libtensorflow tensorflow/c/c_api.h TF_Version -ltensorflow
 enabled libtesseract      && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
 enabled libtheora         && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
@@ -6217,29 +6220,29 @@  enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame
                              { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
                                die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
 enabled libv4l2           && require_pkg_config libv4l2 libv4l2 libv4l2.h v4l2_ioctl
-enabled libvidstab        && require_pkg_config libvidstab "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
-enabled libvmaf           && require_pkg_config libvmaf "libvmaf >= 1.3.9" libvmaf.h compute_vmaf
+enabled libvidstab        && require_pkg_config libvidstab "vidstab --atleast-version=0.98" vid.stab/libvidstab.h vsMotionDetectInit
+enabled libvmaf           && require_pkg_config libvmaf "libvmaf --atleast-version=1.3.9" libvmaf.h compute_vmaf
 enabled libvo_amrwbenc    && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
 enabled libvorbis         && require_pkg_config libvorbis vorbis vorbis/codec.h vorbis_info_init &&
                              require_pkg_config libvorbisenc vorbisenc vorbis/vorbisenc.h vorbis_encode_init
 
 enabled libvpx            && {
     enabled libvpx_vp8_decoder && {
-        check_pkg_config libvpx_vp8_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
+        check_pkg_config libvpx_vp8_decoder "vpx --atleast-version=1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
             check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
                 die "ERROR: libvpx decoder version must be >=1.4.0";
     }
     enabled libvpx_vp8_encoder && {
-        check_pkg_config libvpx_vp8_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
+        check_pkg_config libvpx_vp8_encoder "vpx --atleast-version=1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
             check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" -lvpx ||
                 die "ERROR: libvpx encoder version must be >=1.4.0";
     }
     enabled libvpx_vp9_decoder && {
-        check_pkg_config libvpx_vp9_decoder "vpx >= 1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
+        check_pkg_config libvpx_vp9_decoder "vpx --atleast-version=1.4.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
             check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_dec_init_ver VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
     }
     enabled libvpx_vp9_encoder && {
-        check_pkg_config libvpx_vp9_encoder "vpx >= 1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
+        check_pkg_config libvpx_vp9_encoder "vpx --atleast-version=1.4.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
             check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_IMG_FMT_HIGHBITDEPTH" "-lvpx $libm_extralibs"
     }
     if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
@@ -6249,8 +6252,8 @@  enabled libvpx            && {
 
 enabled libwavpack        && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput  -lwavpack
 enabled libwebp           && {
-    enabled libwebp_encoder      && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
-    enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
+    enabled libwebp_encoder      && require_pkg_config libwebp "libwebp --atleast-version=0.2.0" webp/encode.h WebPGetEncoderVersion
+    enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux --atleast-version=0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
 enabled libx264           && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
                                { require libx264 "stdint.h x264.h" x264_encoder_encode "-lx264 $pthreads_extralibs $libm_extralibs" &&
                                  warn "using libx264 without pkg-config"; } } &&
@@ -6259,9 +6262,9 @@  enabled libx264           && { check_pkg_config libx264 x264 "stdint.h x264.h" x
 enabled libx265           && require_pkg_config libx265 x265 x265.h x265_api_get &&
                              require_cpp_condition libx265 x265.h "X265_BUILD >= 68"
 enabled libxavs           && require libxavs "stdint.h xavs.h" xavs_encoder_encode "-lxavs $pthreads_extralibs $libm_extralibs"
-enabled libxavs2          && require_pkg_config libxavs2 "xavs2 >= 1.3.0" "stdint.h xavs2.h" xavs2_api_get
+enabled libxavs2          && require_pkg_config libxavs2 "xavs2 --atleast-version=1.3.0" "stdint.h xavs2.h" xavs2_api_get
 enabled libxvid           && require libxvid xvid.h xvid_global -lxvidcore
-enabled libzimg           && require_pkg_config libzimg "zimg >= 2.7.0" zimg.h zimg_get_api_version
+enabled libzimg           && require_pkg_config libzimg "zimg --atleast-version=2.7.0" zimg.h zimg_get_api_version
 enabled libzmq            && require_pkg_config libzmq libzmq zmq.h zmq_ctx_new
 enabled libzvbi           && require_pkg_config libzvbi zvbi-0.2 libzvbi.h vbi_decoder_new &&
                              { test_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
@@ -6308,11 +6311,11 @@  enabled openssl           && { check_pkg_config openssl openssl openssl/ssl.h OP
                                check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
                                die "ERROR: openssl not found"; }
 enabled rkmpp             && { require_pkg_config rkmpp rockchip_mpp  rockchip/rk_mpi.h mpp_create &&
-                               require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create &&
+                               require_pkg_config rockchip_mpp "rockchip_mpp --atleast-version=1.3.7" rockchip/rk_mpi.h mpp_create &&
                                { enabled libdrm ||
                                  die "ERROR: rkmpp requires --enable-libdrm"; }
                              }
-enabled vapoursynth       && require_pkg_config vapoursynth "vapoursynth-script >= 42" VSScript.h vsscript_init
+enabled vapoursynth       && require_pkg_config vapoursynth "vapoursynth-script --atleast-version=42" VSScript.h vsscript_init
 
 
 if enabled gcrypt; then
@@ -6460,7 +6463,7 @@  test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
 EOF
 
 enabled vaapi &&
-    check_pkg_config vaapi "libva >= 0.35.0" "va/va.h" vaInitialize
+    check_pkg_config vaapi "libva --atleast-version=0.35.0" "va/va.h" vaInitialize
 
 if enabled vaapi; then
     check_pkg_config vaapi_drm "libva-drm" "va/va_drm.h" vaGetDisplayDRM