Merge commit '7208e5b5d638d4b9c2784036b4fc5728f32233c7'
authorJames Almer <jamrial@gmail.com>
Thu, 28 Sep 2017 21:36:27 +0000 (18:36 -0300)
committerJames Almer <jamrial@gmail.com>
Thu, 28 Sep 2017 21:36:27 +0000 (18:36 -0300)
* commit '7208e5b5d638d4b9c2784036b4fc5728f32233c7':
  configure: Restructure the way check_pkg_config() operates

Merged-by: James Almer <jamrial@gmail.com>
1  2 
configure

diff --cc configure
+++ b/configure
@@@ -1258,27 -1018,22 +1258,30 @@@ check_lib()
          enable $name && add_extralibs "$@"
  }
  
 +check_lib_cpp(){
 +    log check_lib_cpp "$@"
 +    headers="$1"
 +    classes="$2"
 +    shift 2
 +    check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
 +}
 +
  check_pkg_config(){
      log check_pkg_config "$@"
-     pkg_version="$1"
-     pkg="${1%% *}"
-     headers="$2"
-     funcs="$3"
-     shift 3
+     name="$1"
+     pkg_version="$2"
+     pkg="${2%% *}"
+     headers="$3"
+     funcs="$4"
+     shift 4
+     disable $name
      check_cmd $pkg_config --exists --print-errors $pkg_version || return
      pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
      pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
      check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
 -        add_cflags    "$pkg_cflags" &&
 -        add_extralibs "$pkg_libs"
+         enable $name &&
 +        set_safe "${pkg}_cflags"    $pkg_cflags &&
 +        set_safe "${pkg}_extralibs" $pkg_libs
  }
  
  check_exec(){
@@@ -1389,19 -1136,10 +1392,18 @@@ require_cpp_condition()
      check_cpp_condition "$header" "$condition" "$@" || die "ERROR: $condition not satisfied"
  }
  
-     name="$1"
-     shift
-     pkg_version="$1"
-     pkg="${1%% *}"
 +use_pkg_config(){
 +    log use_pkg_config "$@"
++    pkg="${2%% *}"
 +    check_pkg_config "$@" || return 1
 +    add_cflags    $(get_safe "${pkg}_cflags")
 +    add_extralibs $(get_safe "${pkg}_extralibs")
 +}
 +
  require_pkg_config(){
 -    check_pkg_config "$@" || die "ERROR: $pkg_version not found"
+     log require_pkg_config "$@"
+     pkg_version="$2"
 +    use_pkg_config "$@" || die "ERROR: $pkg_version not found using pkg-config$pkg_config_fail_message"
  }
  
  hostcc_e(){
@@@ -5935,100 -4665,44 +5937,100 @@@ enabled libgme            && { use_pkg_
  enabled libgsm            && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
                                     check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break;
                                 done || die "ERROR: libgsm not found"; }
 -enabled libhdcd           && require_pkg_config libhdcd libhdcd "hdcd/hdcd_simple.h" hdcd_new
  enabled libilbc           && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
  enabled libkvazaar        && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
 -enabled libmfx            && require_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit
 +# 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
 +# installation route altogether.  If libmfx is installed via the Intel
 +# Media SDK or Intel Media Server Studio, these don't come with
 +# pkg-config support.  Instead, users should make sure that the build
 +# can find the libraries and headers through other means.
 +enabled libmfx            && { use_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit ||
 +                               { require libmfx "mfx/mfxvideo.h" MFXInit -llibmfx && warn "using libmfx without pkg-config"; } }
 +enabled libmodplug        && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load
  enabled libmp3lame        && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
 -enabled libnpp            && require libnpp npp.h nppGetLibVersion -lnppi -lnppc
 +enabled libmysofa         && require libmysofa "mysofa.h" mysofa_load -lmysofa
 +enabled libnpp            && { check_lib libnpp npp.h nppGetLibVersion -lnppig -lnppicc -lnppc ||
 +                               check_lib libnpp npp.h nppGetLibVersion -lnppi -lnppc ||
 +                               die "ERROR: libnpp not found"; }
  enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
 -enabled libopencv         && require_pkg_config libopencv opencv opencv/cv.h cvCreateImageHeader
 +enabled libopencv         && { check_header opencv2/core/core_c.h &&
 +                               { use_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
 +                                 require opencv 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_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
 -                               require_pkg_config libopenjpeg libopenjpeg1 openjpeg.h opj_version -DOPJ_STATIC; }
 -enabled libopus           && require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
 -enabled libpulse          && require_pkg_config libpulse libpulse-simple pulse/simple.h pa_simple_new
 +enabled libopenjpeg       && { { check_lib libopenjpeg openjpeg-2.2/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
 +                               check_lib libopenjpeg openjpeg-2.2/openjpeg.h opj_version -lopenjp2 ||
 +                               { check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
 +                               check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 ||
 +                               { check_lib libopenjpeg openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
 +                               { check_lib libopenjpeg openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
 +                               { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
 +                               die "ERROR: libopenjpeg not found"; }
 +enabled libopenmpt        && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
 +enabled libopus           && {
 +    enabled libopus_decoder && {
 +        require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
 +    }
 +    enabled libopus_encoder && {
 +        require_pkg_config libopus opus opus_multistream.h opus_multistream_surround_encoder_create
 +    }
 +}
 +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 libschroedinger   && require_pkg_config libschroedinger schroedinger-1.0 schroedinger/schro.h schro_init
 +enabled librubberband     && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new
 +enabled libshine          && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
 +enabled libsmbclient      && { use_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
 +                               require smbclient libsmbclient.h smbc_init -lsmbclient; }
  enabled libsnappy         && require libsnappy snappy-c.h snappy_compress -lsnappy
 +enabled libsoxr           && require libsoxr soxr.h soxr_create -lsoxr && LIBSOXR="-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 -lspeex
 +enabled libtesseract      && require_pkg_config libtesseract tesseract tesseract/capi.h TessBaseAPICreate
  enabled libtheora         && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
 -enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame
 -enabled libvo_aacenc      && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
 +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 libvmaf.h compute_vmaf
  enabled libvo_amrwbenc    && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
 -enabled libvorbis         && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
 -enabled libvpx            && require_pkg_config libvpx "vpx >= 1.3.0" vpx/vpx_codec.h vpx_codec_version &&
 -                             { enabled libvpx_vp8_decoder &&
 -                                   check_pkg_config libvpx_vp8_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx
 -                               enabled libvpx_vp8_encoder &&
 -                                   check_pkg_config libvpx_vp8_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx
 -                               enabled libvpx_vp9_decoder &&
 -                                   check_pkg_config libvpx_vp9_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx
 -                               enabled libvpx_vp9_encoder &&
 -                                   check_pkg_config libvpx_vp9_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx
 -                               disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder &&
 -                                   die "libvpx enabled but no supported decoders/encoders found"
 -                             }
 +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 && {
-         use_pkg_config libvpx "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
++        use_pkg_config libvpx_vp8_decoder "vpx >= 0.9.1" "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 -lvpx ||
 +                die "ERROR: libvpx decoder version must be >=0.9.1";
 +    }
 +    enabled libvpx_vp8_encoder && {
-         use_pkg_config libvpx "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
++        use_pkg_config libvpx_vp8_encoder "vpx >= 0.9.7" "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 VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
 +                die "ERROR: libvpx encoder version must be >=0.9.7";
 +    }
 +    enabled libvpx_vp9_decoder && {
-         use_pkg_config libvpx "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
++        use_pkg_config libvpx_vp9_decoder "vpx >= 1.3.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_vp9_dx" -lvpx
 +    }
 +    enabled libvpx_vp9_encoder && {
-         use_pkg_config libvpx "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
++        use_pkg_config libvpx_vp9_encoder "vpx >= 1.3.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_vp9_cx VP9E_SET_AQ_MODE" -lvpx
 +    }
 +    if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
 +        die "libvpx enabled but no supported decoders found"
 +    fi
 +}
 +
  enabled libwavpack        && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput  -lwavpack
 -enabled libwebp           && require_pkg_config libwebp libwebp webp/encode.h WebPGetEncoderVersion
 -enabled libx264           && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
 +enabled libwebp           && {
 +    enabled libwebp_encoder      && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
-     enabled libwebp_anim_encoder && { use_pkg_config libwebpmux "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit || disable libwebp_anim_encoder; } }
++    enabled libwebp_anim_encoder && use_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
 +enabled libx264           && { use_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
 +                               { require libx264 "stdint.h x264.h" x264_encoder_encode -lx264 &&
 +                                 warn "using libx264 without pkg-config"; } } &&
                               require_cpp_condition x264.h "X264_BUILD >= 118" &&
                               { check_cpp_condition x264.h "X264_MPEG2" &&
                                 enable libx262; }
@@@ -6077,94 -4727,26 +6079,92 @@@ enabled openssl           && { use_pkg_
                                 check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
                                 check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
                                 die "ERROR: openssl not found"; }
 +enabled rkmpp             && { { require_pkg_config rockchip_mpp rockchip_mpp rockchip/rk_mpi.h mpp_create ||
 +                                 die "ERROR : Rockchip MPP was not found."; } &&
 +                               { check_func_headers rockchip/rk_mpi_cmd.h "MPP_DEC_GET_FREE_PACKET_SLOT_COUNT" ||
 +                                 die "ERROR: Rockchip MPP is outdated, please get a more recent one."; } &&
 +                               { enabled libdrm ||
 +                                 die "ERROR: rkmpp requires --enable-libdrm"; }
 +                             }
  
 -enabled gnutls            && check_lib gmp gmp.h mpz_export -lgmp
 -
 -if enabled nvenc; then
 -    require_header nvEncodeAPI.h
 -    require_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6"
 +if enabled gcrypt; then
 +    GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
 +    if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
 +        gcrypt_cflags=$("${GCRYPT_CONFIG}" --cflags)
 +        gcrypt_extralibs=$("${GCRYPT_CONFIG}" --libs)
 +        check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_extralibs ||
 +            die "ERROR: gcrypt not found"
 +        add_cflags $gcrypt_cflags && add_extralibs $gcrypt_extralibs
 +    else
 +        require gcrypt gcrypt.h gcry_mpi_new -lgcrypt
 +    fi
  fi
  
 -check_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent
 +if enabled sdl2; then
 +    SDL2_CONFIG="${cross_prefix}sdl2-config"
-     if check_pkg_config "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent; then
++    if check_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent; then
 +        check_func SDL_Init $sdl2_extralibs $sdl2_cflags ||
 +            disable sdl2
 +    elif "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
 +        sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
 +        sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
 +        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
 +        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
 +        check_func SDL_Init $sdl2_extralibs $sdl2_cflags ||
 +            disable sdl2
-     else
-         disable sdl2
 +    fi
 +    if test $target_os = "mingw32"; then
 +        sdl2_extralibs="$sdl2_extralibs -mconsole"
 +    fi
 +fi
 +enabled sdl2 && add_cflags $sdl2_cflags && add_extralibs $sdl2_extralibs
  
 -! disabled pod2man   && check_cmd pod2man --help     && enable pod2man   || disable pod2man
 -! disabled texi2html && check_cmd texi2html -version && enable texi2html || disable texi2html
 +if enabled decklink; then
 +    case $target_os in
 +        mingw32*|mingw64*|win32|win64)
 +            decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32"
 +            decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32"
 +            ;;
 +    esac
 +fi
  
 +enabled securetransport &&
 +    check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
 +    check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" ||
 +        disable securetransport
 +
 +enabled schannel &&
 +    check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 &&
 +    check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" &&
 +    add_extralibs -lsecur32 ||
 +        disable schannel
 +
 +makeinfo --version > /dev/null 2>&1 && enable makeinfo  || disable makeinfo
 +enabled makeinfo \
 +    && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \
 +    && enable makeinfo_html || disable makeinfo_html
 +disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
 +perl -v            > /dev/null 2>&1 && enable perl      || disable perl
 +pod2man --help     > /dev/null 2>&1 && enable pod2man   || disable pod2man
 +rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
 +
 +# check V4L2 codecs available in the API
  check_header linux/fb.h
  check_header linux/videodev2.h
 -check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
 -
 -check_header AVFoundation/AVFoundation.h
 +check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
 +check_code cc linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" || disable v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;" && enable vc1_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;" && enable mpeg1_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;" && enable mpeg2_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;" && enable mpeg4_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;" && enable hevc_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H263;" && enable h263_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H264;" && enable h264_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" && enable vp8_v4l2_m2m
 +check_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" && enable vp9_v4l2_m2m
  
  check_header sys/videoio.h
 +check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  
  check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
  check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
@@@ -6206,37 -4780,19 +6206,36 @@@ if enabled libcdio; the
      die "ERROR: No usable libcdio/cdparanoia found"
  fi
  
- enabled libxcb && check_pkg_config "xcb >= 1.4" xcb/xcb.h xcb_connect || disable libxcb
++enabled libxcb && check_pkg_config libxcb "xcb >= 1.4" xcb/xcb.h xcb_connect
 +
  if enabled libxcb; then
-     enabled libxcb_shm    && check_pkg_config xcb-shm    xcb/shm.h    xcb_shm_attach              || disable libxcb_shm
-     enabled libxcb_shape  && check_pkg_config xcb-shape  xcb/shape.h  xcb_shape_get_rectangles    || disable libxcb_shape
-     enabled libxcb_xfixes && check_pkg_config xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image || disable libxcb_xfixes
 -    require_pkg_config libxcb xcb xcb/xcb.h xcb_connect
 -    require_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_rectangles
 -    disabled libxcb_shm ||
 -        check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach
 -    disabled libxcb_xfixes ||
 -        check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
++    enabled libxcb_shm    && check_pkg_config libxcb_shm    xcb-shm    xcb/shm.h    xcb_shm_attach
++    enabled libxcb_shape  && check_pkg_config libxcb_shape  xcb-shape  xcb/shape.h  xcb_shape_get_rectangles
++    enabled libxcb_xfixes && check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
 +
 +    add_cflags $xcb_cflags $xcb_shm_cflags $xcb_xfixes_cflags $xcb_shape_cflags
 +    add_extralibs $xcb_extralibs $xcb_shm_extralibs $xcb_xfixes_extralibs $xcb_shape_extralibs
  fi
  
 -enabled dxva2 &&
 -    check_lib dxva2_lib windows.h CoTaskMemFree -lole32
 +check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
  
 -enabled vaapi && require vaapi va/va.h vaInitialize -lva
 +# d3d11va requires linking directly to dxgi and d3d11 if not building for
 +# the desktop api partition
 +check_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
 +#ifdef WINAPI_FAMILY
 +#include <winapifamily.h>
 +#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
 +#error desktop, not uwp
 +#else
 +// WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP
 +#endif
 +#else
 +#error no family set
 +#endif
 +EOF
 +
 +enabled vaapi &&
 +    check_lib vaapi va/va.h vaInitialize -lva
  
  enabled vaapi &&
      check_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" ||