---

This works as advertised.

Issues:

- Maybe keeping _extralibs as suffix is better than _lbs, dunno.
- Possibly I should investigate Janne's idea of using the function
  name as variable name instead of adding a library name parameter
  to things like check_lib().
- The case statement in check_deps that adds the flags to the right
  component is ugly. I don't have a better idea yet, but I was also
  busy getting the rest of the patch to work at all.
  Janne?

 configure | 305 ++++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 file changed, 237 insertions(+), 68 deletions(-)

diff --git a/configure b/configure
index 27fb6ea..233bad4 100755
--- a/configure
+++ b/configure
@@ -650,8 +650,31 @@ check_deps(){
 
     for cfg in $allopts; do
         enabled $cfg || continue
-        eval dep_extralibs="\$${cfg}_extralibs"
-        test -n "$dep_extralibs" && add_extralibs $dep_extralibs
+        eval dep_lbs="\$${cfg}_lbs"
+        for lib in $dep_lbs; do
+            eval append dep_libs "\$${lib}"
+        done
+        if test -n "$dep_libs"; then
+            case $cfg in
+                *coder|*parser|*bsf|*hwaccel)
+                    add_extralibs_lib avcodec  $dep_libs ;;
+                *muxer|*protocol)
+                    add_extralibs_lib avformat $dep_libs ;;
+                *filter)
+                    add_extralibs_lib avfilter $dep_libs ;;
+                *indev|*outdev)
+                    add_extralibs_lib avdevice $dep_libs ;;
+                avutil)
+                    add_extralibs_lib avutil   $dep_libs ;;
+                avconv)
+                    add_extralibs_lib avconv   $dep_libs ;;
+                avplay)
+                    add_extralibs_lib avplay   $dep_libs ;;
+                avprobe)
+                    add_extralibs_lib avprobe  $dep_libs ;;
+            esac
+            unset dep_libs
+        fi
     done
 }
 
@@ -741,6 +764,13 @@ add_extralibs(){
     prepend extralibs $($ldflags_filter "$@")
 }
 
+add_extralibs_lib(){
+    lib=$1
+    shift
+    prepend extralibs_${lib} $($ldflags_filter "$@")
+    unique  extralibs_${lib}
+}
+
 add_host_cppflags(){
     append host_cppflags "$@"
 }
@@ -1003,10 +1033,11 @@ EOF
 
 check_lib(){
     log check_lib "$@"
-    headers="$1"
-    funcs="$2"
-    shift 2
-    check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
+    name="$1"
+    headers="$2"
+    func="$3"
+    shift 3
+    check_func_headers "$headers" "$func" "$@" && eval ${name}_lbs="\$@"
 }
 
 check_pkg_config(){
@@ -1102,10 +1133,11 @@ check_compile_assert(){
 require(){
     log require "$@"
     name_version="$1"
+    name="${1%% *}"
     headers="$2"
     func="$3"
     shift 3
-    check_lib "$headers" $func "$@" || die "ERROR: $name_version not found"
+    check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not 
found"
 }
 
 require_pkg_config(){
@@ -1955,6 +1987,7 @@ comfortnoise_encoder_select="lpc"
 cook_decoder_select="audiodsp mdct sinewin"
 cscd_decoder_select="lzo"
 cscd_decoder_suggest="zlib"
+cscd_decoder_lbs="zlib_lbs"
 dca_decoder_select="fmtconvert mdct"
 dds_decoder_select="texturedsp"
 dnxhd_decoder_select="blockdsp idctdsp"
@@ -1962,6 +1995,7 @@ dnxhd_encoder_select="aandcttables blockdsp fdctdsp 
idctdsp mpegvideoenc pixbloc
 dvvideo_decoder_select="dvprofile idctdsp"
 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
 dxa_decoder_deps="zlib"
+dxa_decoder_lbs="zlib_lbs"
 dxv_decoder_select="lzf texturedsp"
 eac3_decoder_select="ac3_decoder"
 eac3_encoder_select="ac3_encoder"
@@ -1969,6 +2003,7 @@ eamad_decoder_select="aandcttables blockdsp bswapdsp 
idctdsp mpegvideo"
 eatgq_decoder_select="aandcttables idctdsp"
 eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
 exr_decoder_deps="zlib"
+exr_decoder_lbs="zlib_lbs"
 ffv1_decoder_select="golomb rangecoder"
 ffv1_encoder_select="rangecoder"
 ffvhuff_decoder_select="huffyuv_decoder"
@@ -1977,13 +2012,17 @@ fic_decoder_select="golomb"
 flac_decoder_select="flacdsp golomb"
 flac_encoder_select="bswapdsp flacdsp golomb lpc"
 flashsv_decoder_deps="zlib"
+flashsv_decoder_lbs="zlib_lbs"
 flashsv_encoder_deps="zlib"
+flashsv_encoder_lbs="zlib_lbs"
 flashsv2_decoder_deps="zlib"
+flashsv2_decoder_lbs="zlib_lbs"
 flv_decoder_select="h263_decoder"
 flv_encoder_select="h263_encoder"
 fourxm_decoder_select="blockdsp bswapdsp"
 fraps_decoder_select="bswapdsp huffman"
 g2m_decoder_deps="zlib"
+g2m_decoder_lbs="zlib_lbs"
 g2m_decoder_select="blockdsp idctdsp jpegtables"
 h261_decoder_select="mpeg_er mpegvideo"
 h261_encoder_select="aandcttables mpegvideoenc"
@@ -1995,6 +2034,7 @@ h264_decoder_select="cabac golomb h264chroma h264dsp 
h264parse h264pred h264qpel
 h264_decoder_suggest="error_resilience"
 hap_decoder_select="snappy texturedsp"
 hap_encoder_deps="libsnappy"
+hap_encoder_lbs="libsnappy_lbs"
 hap_encoder_select="texturedspenc"
 hevc_decoder_select="bswapdsp cabac golomb videodsp"
 huffyuv_decoder_select="bswapdsp huffyuvdsp"
@@ -2056,7 +2096,9 @@ on2avc_decoder_select="mdct"
 opus_decoder_deps="avresample"
 opus_decoder_select="imdct15"
 png_decoder_deps="zlib"
+png_decoder_lbs="zlib_lbs"
 png_encoder_deps="zlib"
+png_encoder_lbs="zlib_lbs"
 png_encoder_select="huffyuvencdsp"
 prores_decoder_select="idctdsp"
 prores_encoder_select="fdctdsp"
@@ -2065,6 +2107,7 @@ qdm2_decoder_select="mdct rdft mpegaudiodsp"
 ra_144_encoder_select="audio_frame_queue lpc"
 ralf_decoder_select="golomb"
 rscc_decoder_deps="zlib"
+rscc_decoder_lbs="zlib_lbs"
 rv10_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
 rv10_encoder_select="h263_encoder"
 rv20_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
@@ -2072,6 +2115,7 @@ rv20_encoder_select="h263_encoder"
 rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel 
mpeg_er mpegvideo rv34dsp videodsp"
 rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel 
mpeg_er mpegvideo rv34dsp videodsp"
 screenpresso_decoder_deps="zlib"
+screenpresso_decoder_lbs="zlib_lbs"
 shorten_decoder_select="golomb"
 sipr_decoder_select="lsp"
 sp5x_decoder_select="mjpeg_decoder"
@@ -2079,17 +2123,22 @@ svq1_decoder_select="hpeldsp"
 svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
 svq3_decoder_select="golomb h264dsp h264parse h264pred hpeldsp tpeldsp 
videodsp"
 svq3_decoder_suggest="zlib"
+svq3_decoder_lbs="zlib_lbs"
 tak_decoder_select="audiodsp"
 tdsc_decoder_deps="zlib"
+tdsc_decoder_lbs="zlib_lbs"
 tdsc_decoder_select="mjpeg_decoder"
 theora_decoder_select="vp3_decoder"
 thp_decoder_select="mjpeg_decoder"
 tiff_decoder_suggest="zlib"
+tiff_decoder_lbs="zlib_lbs"
 tiff_encoder_suggest="zlib"
+tiff_encoder_lbs="zlib_lbs"
 truehd_decoder_select="mlp_decoder"
 truemotion2_decoder_select="bswapdsp"
 truespeech_decoder_select="bswapdsp"
 tscc_decoder_deps="zlib"
+tscc_decoder_lbs="zlib_lbs"
 txd_decoder_select="texturedsp"
 twinvq_decoder_select="mdct lsp sinewin"
 utvideo_decoder_select="bswapdsp"
@@ -2121,70 +2170,106 @@ wmv2_encoder_select="h263_encoder wmv2dsp"
 wmv3_decoder_select="vc1_decoder"
 wmv3image_decoder_select="wmv3_decoder"
 zerocodec_decoder_deps="zlib"
+zerocodec_decoder_lbs="zlib_lbs"
 zlib_decoder_deps="zlib"
+zlib_decoder_lbs="zlib_lbs"
 zlib_encoder_deps="zlib"
+zlib_encoder_lbs="zlib_lbs"
 zmbv_decoder_deps="zlib"
+zmbv_decoder_lbs="zlib_lbs"
 zmbv_encoder_deps="zlib"
+zmbv_encoder_lbs="zlib_lbs"
 
 # hardware accelerators
 d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder"
 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
 vaapi_deps="va_va_h"
+vaapi_lbs='$vaapi_lbs $vaapi_drm_lbs $vaapi_x11_lbs'
 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
-vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration 
-framework QuartzCore"
+vda_lbs="-framework CoreFoundation -framework VideoDecodeAcceleration 
-framework QuartzCore"
 vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
 
 h263_vaapi_hwaccel_deps="vaapi"
+h263_vaapi_hwaccel_lbs="vaapi_lbs"
 h263_vaapi_hwaccel_select="h263_decoder"
 h264_d3d11va_hwaccel_deps="d3d11va"
+h264_d3d11va_hwaccel_lbs="d3d11va_lbs"
 h264_d3d11va_hwaccel_select="h264_decoder"
 h264_dxva2_hwaccel_deps="dxva2"
+h264_dxva2_hwaccel_lbs="dxva2_lbs"
 h264_dxva2_hwaccel_select="h264_decoder"
 h264_mmal_hwaccel_deps="mmal"
+h264_mmal_hwaccel_lbs="mmal_lbs"
 h264_qsv_hwaccel_deps="libmfx"
+h264_qsv_hwaccel_lbs="libmfx_lbs"
 h264_vaapi_hwaccel_deps="vaapi"
+h264_vaapi_hwaccel_lbs="vaapi_lbs"
 h264_vaapi_hwaccel_select="h264_decoder"
 h264_vda_hwaccel_deps="vda"
+h264_vda_hwaccel_lbs="vda_lbs"
 h264_vda_hwaccel_select="h264_decoder"
 h264_vda_old_hwaccel_deps="vda"
+h264_vda_old_hwaccel_lbs="vda_lbs"
 h264_vda_old_hwaccel_select="h264_decoder"
 h264_vdpau_hwaccel_deps="vdpau"
+h264_vdpau_hwaccel_lbs="vdpau_lbs"
 h264_vdpau_hwaccel_select="h264_decoder"
 hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
+hevc_d3d11va_hwaccel_lbs="d3d11va_lbs"
 hevc_d3d11va_hwaccel_select="hevc_decoder"
 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
+hevc_dxva2_hwaccel_lbs="dxva2_lbs"
 hevc_dxva2_hwaccel_select="hevc_decoder"
 hevc_qsv_hwaccel_deps="libmfx"
+hevc_qsv_hwaccel_lbs="libmfx_lbs"
 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
+hevc_vdpau_hwaccel_lbs="vdpau_lbs"
 hevc_vdpau_hwaccel_select="hevc_decoder"
 mpeg1_vdpau_hwaccel_deps="vdpau"
+mpeg1_vdpau_hwaccel_lbs="vdpau_lbs"
 mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
 mpeg2_d3d11va_hwaccel_deps="d3d11va"
+mpeg2_d3d11va_hwaccel_lbs="d3d11va_lbs"
 mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
 mpeg2_dxva2_hwaccel_deps="dxva2"
+mpeg2_dxva2_hwaccel_lbs="dxva2_lbs"
 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
 mpeg2_mmal_hwaccel_deps="mmal"
+mpeg2_mmal_hwaccel_lbs="mmal_lbs"
 mpeg2_qsv_hwaccel_deps="libmfx"
+mpeg2_qsv_hwaccel_lbs="libmfx_lbs"
 mpeg2_vaapi_hwaccel_deps="vaapi"
+mpeg2_vaapi_hwaccel_lbs="vaapi_lbs"
 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
 mpeg2_vdpau_hwaccel_deps="vdpau"
+mpeg2_vdpau_hwaccel_lbs="vdpau_lbs"
 mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
 mpeg4_vaapi_hwaccel_deps="vaapi"
+mpeg4_vaapi_hwaccel_lbs="vaapi_lbs"
 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
 mpeg4_vdpau_hwaccel_deps="vdpau"
+mpeg4_vdpau_hwaccel_lbs="vdpau_lbs"
 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
 vc1_d3d11va_hwaccel_deps="d3d11va"
+vc1_d3d11va_hwaccel_lbs="d3d11va_lbs"
 vc1_d3d11va_hwaccel_select="vc1_decoder"
 vc1_dxva2_hwaccel_deps="dxva2"
+vc1_dxva2_hwaccel_lbs="dxva2_lbs"
 vc1_dxva2_hwaccel_select="vc1_decoder"
 vc1_mmal_hwaccel_deps="mmal"
+vc1_mmal_hwaccel_lbs="mmal_lbs"
 vc1_qsv_hwaccel_deps="libmfx"
+vc1_qsv_hwaccel_lbs="libmfx_lbs"
 vc1_vaapi_hwaccel_deps="vaapi"
+vc1_vaapi_hwaccel_lbs="vaapi_lbs"
 vc1_vaapi_hwaccel_select="vc1_decoder"
 vc1_vdpau_hwaccel_deps="vdpau"
+vc1_vdpau_hwaccel_lbs="vdpau_lbs"
 vc1_vdpau_hwaccel_select="vc1_decoder"
 vp8_qsv_hwaccel_deps="libmfx"
+vp8_qsv_hwaccel_lbs="libmfx_lbs"
 vp8_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVP8"
+vp8_vaapi_hwaccel_lbs="vaapi_lbs"
 vp8_vaapi_hwaccel_select="vp8_decoder"
 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
@@ -2193,15 +2278,17 @@ wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
 
 # hardware-accelerated codecs
 nvenc_deps_any="dlopen LoadLibrary"
-nvenc_extralibs='$ldl'
+nvenc_lbs="dlopen_lbs"
 omx_deps="dlopen pthreads"
-omx_extralibs='$ldl'
+omx_lbs="dlopen_lbs"
 qsvdec_select="qsv"
 qsvenc_select="qsv"
 vaapi_encode_deps="vaapi"
 
 hwupload_cuda_filter_deps="cuda"
+hwupload_cuda_filter_lbs="cuda_lbs"
 scale_npp_filter_deps="cuda libnpp"
+scale_npp_filter_lbs="cuda_lbs libnpp_lbs"
 
 h264_mmal_decoder_deps="mmal"
 h264_nvenc_encoder_deps="nvenc"
@@ -2248,55 +2335,96 @@ mjpeg2jpeg_bsf_select="jpegtables"
 
 # external libraries
 libdcadec_decoder_deps="libdcadec"
+libdcadec_decoder_lbs="libdcadec_lbs"
 libfaac_encoder_deps="libfaac"
+libfaac_encoder_lbs="libfaac_lbs"
 libfaac_encoder_select="audio_frame_queue"
 libfdk_aac_decoder_deps="libfdk_aac"
+libfdk_aac_decoder_lbs="libfdk_aac_lbs"
 libfdk_aac_encoder_deps="libfdk_aac"
+libfdk_aac_encoder_lbs="libfdk_aac_lbs"
 libfdk_aac_encoder_select="audio_frame_queue"
 libgsm_decoder_deps="libgsm"
+libgsm_decoder_lbs="libgsm_lbs"
 libgsm_encoder_deps="libgsm"
+libgsm_encoder_lbs="libgsm_lbs"
 libgsm_ms_decoder_deps="libgsm"
+libgsm_ms_decoder_lbs="libgsm_lbs"
 libgsm_ms_encoder_deps="libgsm"
+libgsm_ms_encoder_lbs="libgsm_lbs"
 libilbc_decoder_deps="libilbc"
+libilbc_decoder_lbs="libilbc_lbs"
 libilbc_encoder_deps="libilbc"
+libilbc_encoder_lbs="libilbc_lbs"
 libkvazaar_encoder_deps="libkvazaar"
+libkvazaar_encoder_lbs="libkvazaar_lbs"
 libmp3lame_encoder_deps="libmp3lame"
+libmp3lame_encoder_lbs="libmp3lame_lbs"
 libmp3lame_encoder_select="audio_frame_queue"
 libopencore_amrnb_decoder_deps="libopencore_amrnb"
+libopencore_amrnb_decoder_lbs="libopencore_amrnb_lbs"
 libopencore_amrnb_encoder_deps="libopencore_amrnb"
+libopencore_amrnb_encoder_lbs="libopencore_amrnb_lbs"
 libopencore_amrnb_encoder_select="audio_frame_queue"
 libopencore_amrwb_decoder_deps="libopencore_amrwb"
+libopencore_amrwb_decoder_lbs="libopencore_amrwb_lbs"
 libopenh264_decoder_deps="libopenh264"
+libopenh264_decoder_lbs="libopenh264_lbs"
 libopenh264_decoder_select="h264_mp4toannexb_bsf"
 libopenh264_encoder_deps="libopenh264"
+libopenh264_encoder_lbs="libopenh264_lbs"
 libopenjpeg_decoder_deps="libopenjpeg"
+libopenjpeg_decoder_lbs="libopenjpeg_lbs"
 libopenjpeg_encoder_deps="libopenjpeg"
+libopenjpeg_encoder_lbs="libopenjpeg_lbs"
 libopus_decoder_deps="libopus"
+libopus_decoder_lbs="libopus_lbs"
 libopus_encoder_deps="libopus"
+libopus_encoder_lbs="libopus_lbs"
 libopus_encoder_select="audio_frame_queue"
 libschroedinger_decoder_deps="libschroedinger"
+libschroedinger_decoder_lbs="libschroedinger_lbs"
 libschroedinger_encoder_deps="libschroedinger"
+libschroedinger_encoder_lbs="libschroedinger_lbs"
 libspeex_decoder_deps="libspeex"
+libspeex_decoder_lbs="libspeex_lbs"
 libspeex_encoder_deps="libspeex"
+libspeex_encoder_lbs="libspeex_lbs"
 libspeex_encoder_select="audio_frame_queue"
 libtheora_encoder_deps="libtheora"
+libtheora_encoder_lbs="libtheora_lbs"
 libtwolame_encoder_deps="libtwolame"
+libtwolame_encoder_lbs="libtwolame_lbs"
 libvo_aacenc_encoder_deps="libvo_aacenc"
+libvo_aacenc_encoder_lbs="libvo_aacenc_lbs"
 libvo_aacenc_encoder_select="audio_frame_queue"
 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
+libvo_amrwbenc_encoder_lbs="libvo_amrwbenc_lbs"
 libvorbis_encoder_deps="libvorbis"
+libvorbis_encoder_lbs="libvorbis_lbs"
 libvorbis_encoder_select="audio_frame_queue"
 libvpx_vp8_decoder_deps="libvpx"
+libvpx_vp8_decoder_lbs="libvpx_lbs"
 libvpx_vp8_encoder_deps="libvpx"
+libvpx_vp8_encoder_lbs="libvpx_lbs"
 libvpx_vp9_decoder_deps="libvpx"
+libvpx_vp9_decoder_lbs="libvpx_lbs"
 libvpx_vp9_encoder_deps="libvpx"
+libvpx_vp9_encoder_lbs="libvpx_lbs"
 libwavpack_encoder_deps="libwavpack"
+libwavpack_encoder_lbs="libwavpack_lbs"
 libwebp_encoder_deps="libwebp"
+libwebp_encoder_lbs="libwebp_lbs"
 libx262_encoder_deps="libx262"
+libx262_encoder_lbs="libx262_lbs"
 libx264_encoder_deps="libx264"
+libx264_encoder_lbs="libx264_lbs"
 libx265_encoder_deps="libx265"
+libx265_encoder_lbs="libx265_lbs"
 libxavs_encoder_deps="libxavs"
+libxavs_encoder_lbs="libxavs_lbs"
 libxvid_encoder_deps="libxvid mkstemp"
+libxvid_encoder_lbs="libxvid_lbs"
 
 # demuxers / muxers
 ac3_demuxer_select="ac3_parser"
@@ -2307,6 +2435,7 @@ avi_demuxer_select="iso_media riffdec"
 avi_muxer_select="riffenc"
 avisynth_demux_deps="avisynth LoadLibrary"
 avxsynth_demux_deps="avxsynth dlopen"
+avxsynth_demux_lbs="dlopen_lbs"
 avisynth_demuxer_deps_any="avisynth_demux avxsynth_demux"
 avisynth_demuxer_select="riffdec"
 caf_demuxer_select="iso_media riffdec"
@@ -2325,10 +2454,12 @@ ismv_muxer_select="mov_muxer"
 matroska_audio_muxer_select="matroska_muxer"
 matroska_demuxer_select="iso_media riffdec"
 matroska_demuxer_suggest="bzlib lzo zlib"
+matroska_demuxer_lbs="bzlib_lbs zlib_lbs"
 matroska_muxer_select="iso_media riffenc"
 mmf_muxer_select="riffenc"
 mov_demuxer_select="iso_media riffdec"
 mov_demuxer_suggest="zlib"
+mov_demuxer_lbs="zlib_lbs"
 mov_muxer_select="iso_media riffenc rtpenc_chain"
 mp3_demuxer_select="mpegaudio_parser"
 mp4_muxer_select="mov_muxer"
@@ -2353,6 +2484,7 @@ smoothstreaming_muxer_select="ismv_muxer"
 spdif_muxer_select="aac_parser"
 spx_muxer_select="ogg_muxer"
 swf_demuxer_suggest="zlib"
+swf_demuxer_lbs="zlib_lbs"
 tak_demuxer_select="tak_parser"
 tg2_muxer_select="mov_muxer"
 tgp_muxer_select="mov_muxer"
@@ -2367,7 +2499,9 @@ xwma_demuxer_select="riffdec"
 
 # indevs / outdevs
 alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
+alsa_indev_lbs="alsa_lbs"
 alsa_outdev_deps="alsa_asoundlib_h"
+alsa_outdev_lbs="alsa_lbs"
 avfoundation_indev_deps="AVFoundation_AVFoundation_h"
 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h 
dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
 dv1394_indev_deps="dv1394"
@@ -2375,16 +2509,22 @@ dv1394_indev_select="dv_demuxer"
 fbdev_indev_deps="linux_fb_h"
 jack_indev_deps="jack_jack_h"
 jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
+jack_indev_lbs="jack_lbs"
 libcdio_indev_deps="libcdio"
+libcdio_indev_lbs="libcdio_lbs"
 libdc1394_indev_deps="libdc1394"
+libdc1394_indev_lbs="libdc1394_lbs"
 oss_indev_deps_any="soundcard_h sys_soundcard_h"
 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
 pulse_indev_deps="libpulse"
+pulse_indev_lbs="libpulse_lbs"
 sndio_indev_deps="sndio_h"
 sndio_outdev_deps="sndio_h"
 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
-vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
+vfwcap_indev_deps="vfw32 vfwcap_defines"
+vfwcap_indev_lbs="vfw32_lbs"
 xcbgrab_indev_deps="libxcb"
+xcbgrab_indev_lbs="libxcb_lbs"
 
 # protocols
 ffrtmpcrypt_protocol_deps="!librtmp_protocol"
@@ -2392,17 +2532,24 @@ ffrtmpcrypt_protocol_deps_any="gmp openssl"
 ffrtmpcrypt_protocol_select="tcp_protocol"
 ffrtmphttp_protocol_deps="!librtmp_protocol"
 ffrtmphttp_protocol_select="http_protocol"
+gopher_protocol_lbs="network_lbs"
 gopher_protocol_select="network"
 http_protocol_select="tcp_protocol"
 httpproxy_protocol_select="tcp_protocol"
 https_protocol_select="tls_protocol"
 icecast_protocol_select="http_protocol"
 librtmp_protocol_deps="librtmp"
+librtmp_protocol_lbs="librtmp_lbs"
 librtmpe_protocol_deps="librtmp"
+librtmpe_protocol_lbs="librtmp_lbs"
 librtmps_protocol_deps="librtmp"
+librtmps_protocol_lbs="librtmp_lbs"
 librtmpt_protocol_deps="librtmp"
+librtmpt_protocol_lbs="librtmp_lbs"
 librtmpte_protocol_deps="librtmp"
+librtmpte_protocol_lbs="librtmp_lbs"
 mmsh_protocol_select="http_protocol"
+mmst_protocol_lbs="network_lbs"
 mmst_protocol_select="network"
 rtmp_protocol_deps="!librtmp_protocol"
 rtmp_protocol_select="tcp_protocol"
@@ -2414,16 +2561,21 @@ rtmpte_protocol_select="ffrtmpcrypt_protocol 
ffrtmphttp_protocol"
 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
 rtp_protocol_select="udp_protocol"
 sctp_protocol_deps="struct_sctp_event_subscribe"
+sctp_protocol_lbs="network_lbs"
 sctp_protocol_select="network"
 srtp_protocol_select="rtp_protocol srtp"
+tcp_protocol_lbs="network_lbs"
 tcp_protocol_select="network"
 tls_gnutls_protocol_deps="gnutls"
+tls_gnutls_protocol_lbs="gmp_lbs gcrypt_lbs"
 tls_gnutls_protocol_select="tcp_protocol"
 tls_openssl_protocol_deps="openssl !tls_gnutls_protocol"
 tls_openssl_protocol_select="tcp_protocol"
 tls_protocol_deps_any="tls_gnutls_protocol tls_openssl_protocol"
+udp_protocol_lbs="network_lbs"
 udp_protocol_select="network"
 unix_protocol_deps="sys_un_h"
+unix_protocol_lbs="network_lbs"
 unix_protocol_select="network"
 
 # filters
@@ -2433,21 +2585,27 @@ boxblur_filter_deps="gpl"
 bs2b_filter_deps="libbs2b"
 cropdetect_filter_deps="gpl"
 deinterlace_qsv_filter_deps="libmfx"
+deinterlace_qsv_filter_lbs="libmfx_lbs"
 delogo_filter_deps="gpl"
 drawtext_filter_deps="libfreetype"
+drawtext_filter_lbs="libfreetype_lbs"
 frei0r_filter_deps="frei0r dlopen"
-frei0r_filter_extralibs='$ldl'
+frei0r_filter_lbs="frei0r_lbs dlopen_lbs"
 frei0r_src_filter_deps="frei0r dlopen"
-frei0r_src_filter_extralibs='$ldl'
+frei0r_src_filter_lbs="frei0r_lbs dlopen_lbs"
 hdcd_filter_deps="libhdcd"
+hdcd_filter_lbs="libhdcd_lbs"
 hqdn3d_filter_deps="gpl"
 interlace_filter_deps="gpl"
 movie_filter_deps="avcodec avformat"
 ocv_filter_deps="libopencv"
+ocv_filter_lbs="libopencv_lbs"
 resample_filter_deps="avresample"
 scale_filter_deps="swscale"
 scale_qsv_filter_deps="libmfx"
+scale_qsv_filter_lbs="libmfx_lbs"
 scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
+scale_vaapi_filter_lbs="vaapi_lbs"
 
 # examples
 decode_audio_example_deps="avcodec avutil"
@@ -2469,15 +2627,19 @@ avformat_deps="avcodec avutil"
 avresample_deps="avutil"
 swscale_deps="avutil"
 
+avutil_lbs="clock_gettime_lbs user32_lbs vaapi_drm_lbs vaapi_x11_lbs 
vdpau_x11_lbs wincrypt_lbs"
+
 # programs
 avconv_deps="avcodec avfilter avformat avresample swscale"
+avconv_lbs="ole32_lbs psapi_lbs shell32_lbs"
 avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter 
format_filter
                fps_filter null_filter resample_filter scale_filter
                trim_filter"
 avplay_deps="avcodec avfilter avformat avresample sdl"
-avplay_libs='$sdl_libs'
+avplay_lbs="sdl_libs shell32_lbs"
 avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter"
 avprobe_deps="avcodec avformat"
+avprobe_lbs="shell32_lbs"
 
 # documentation
 pod2man_deps="doc"
@@ -3807,13 +3969,13 @@ case $target_os in
         ;;
     haiku)
         prefix_default="/boot/common"
-        network_extralibs="-lnetwork"
+        network_lbs="-lnetwork"
         host_libs=
         ;;
     sunos)
         SHFLAGS='-shared -Wl,-h,$$(@F)'
         enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
-        network_extralibs="-lsocket -lnsl"
+        network_lbs="-lsocket -lnsl"
         # When using suncc to build, the Solaris linker will mark
         # an executable with each instruction set encountered by
         # the Solaris assembler.  As our libraries contain their own
@@ -3828,16 +3990,16 @@ case $target_os in
         ;;
     netbsd)
         disable symver
-        oss_indev_extralibs="-lossaudio"
-        oss_outdev_extralibs="-lossaudio"
+        oss_indev_lbs="-lossaudio"
+        oss_outdev_lbs="-lossaudio"
         ;;
     openbsd|bitrig)
         disable symver
         SHFLAGS='-shared'
         SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
         SLIB_INSTALL_LINKS=
-        oss_indev_extralibs="-lossaudio"
-        oss_outdev_extralibs="-lossaudio"
+        oss_indev_lbs="-lossaudio"
+        oss_outdev_lbs="-lossaudio"
         ;;
     dragonfly)
         disable symver
@@ -3934,7 +4096,7 @@ case $target_os in
         enable dos_paths
         ;;
     *-dos|freedos|opendos)
-        network_extralibs="-lsocket"
+        network_lbs="-lsocket"
         objformat="coff"
         enable dos_paths
         add_cppflags -U__STRICT_ANSI__
@@ -3975,7 +4137,7 @@ case $target_os in
         ;;
     qnx)
         add_cppflags -D_QNX_SOURCE
-        network_extralibs="-lsocket"
+        network_lbs="-lsocket"
         ;;
     symbian)
         SLIBSUF=".dll"
@@ -4001,7 +4163,7 @@ case $target_os in
                      -DFD_SETSIZE=96            \
                      -DHAVE_SOCK_OPTS
         add_compat strtod.o strtod=avpriv_strtod
-        network_extralibs='-lbsd'
+        network_lbs='-lbsd'
         exeobjs=compat/plan9/main.o
         cp_f='cp'
         ;;
@@ -4434,14 +4596,14 @@ check_code cc arm_neon.h "int16x8_t test = 
vdupq_n_s16(0)" && enable intrinsics_
 check_ldflags -Wl,--as-needed
 
 if check_func dlopen; then
-    ldl=
+    dlopen_lbs=
 elif check_func dlopen -ldl; then
-    ldl=-ldl
+    dlopen_lbs=-ldl
 fi
 
 if ! disabled network; then
-    check_func getaddrinfo $network_extralibs
-    check_func inet_aton $network_extralibs
+    check_func getaddrinfo $network_lbs
+    check_func inet_aton $network_lbs
 
     check_type netdb.h "struct addrinfo"
     check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
@@ -4459,10 +4621,10 @@ if ! disabled network; then
         check_func closesocket
     elif check_header winsock2.h ; then
         check_func_headers winsock2.h closesocket -lws2 &&
-            network_extralibs="-lws2" ||
+            network_lbs="-lws2" ||
         { check_func_headers winsock2.h closesocket -lws2_32 &&
-            network_extralibs="-lws2_32"; } || disable winsock2_h network
-        check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
+            network_lbs="-lws2_32"; } || disable winsock2_h network
+        check_func_headers ws2tcpip.h getaddrinfo $network_lbs
 
         check_type ws2tcpip.h socklen_t
         check_type ws2tcpip.h "struct addrinfo"
@@ -4500,7 +4662,7 @@ check_func  ${malloc_prefix}posix_memalign      && enable 
posix_memalign
 
 check_cpp_condition unistd.h "defined(_POSIX_MONOTONIC_CLOCK)" &&
     check_func_headers time.h clock_gettime ||
-        { check_lib time.h clock_gettime -lrt && LIBRT="-lrt"; }
+        check_lib clock_gettime time.h clock_gettime -lrt
 
 check_func  fcntl
 check_func  fork
@@ -4565,9 +4727,9 @@ check_header X11/extensions/XvMClib.h
 # so we also check that atomics actually work here
 check_builtin stdatomic_h stdatomic.h "atomic_int foo; atomic_store(&foo, 0)"
 
-check_lib "windows.h shellapi.h" CommandLineToArgvW   -lshell32
-check_lib "windows.h wincrypt.h" CryptGenRandom       -ladvapi32
-check_lib "windows.h psapi.h"    GetProcessMemoryInfo -lpsapi
+check_lib shell32  "windows.h shellapi.h" CommandLineToArgvW   -lshell32
+check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom       -ladvapi32
+check_lib psapi    "windows.h psapi.h"    GetProcessMemoryInfo -lpsapi
 
 check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
 
@@ -4600,7 +4762,7 @@ if ! disabled pthreads && ! enabled w32threads; then
         add_extralibs -pthreads
     elif check_func pthread_join -lpthreadGC2; then
         add_extralibs -lpthreadGC2
-    elif check_lib pthread.h pthread_join -lpthread; then
+    elif check_lib pthread pthread.h pthread_join -lpthread; then
         :
     elif ! check_func pthread_join; then
         disable pthreads
@@ -4610,10 +4772,10 @@ fi
 enabled pthreads &&
     check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); 
sem_timedwait(s,0); sem_destroy(s)"
 
-disabled  zlib || check_lib  zlib.h      zlibVersion -lz   || disable  zlib
-disabled bzlib || check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
+disabled  zlib || check_lib  zlib  zlib.h      zlibVersion -lz   || disable  
zlib
+disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2 || disable 
bzlib
 
-check_lib math.h sin -lm && LIBM="-lm"
+check_lib libm math.h sin -lm && LIBM="-lm"
 
 atan2f_args=2
 ldexpf_args=2
@@ -4626,7 +4788,7 @@ done
 # these are off by default, so fail if requested and not available
 enabled avisynth          && { check_header avisynth/avisynth_c.h || die 
"ERROR: avisynth/avisynth_c.h header not found"; }
 enabled avxsynth          && { check_header avxsynth/avxsynth_c.h || die 
"ERROR: avxsynth/avxsynth_c.h header not found"; }
-enabled cuda              && check_lib cuda.h cuInit -lcuda
+enabled cuda              && check_lib cuda cuda.h cuInit -lcuda
 enabled frei0r            && { check_header frei0r.h || die "ERROR: frei0r.h 
header not found"; }
 enabled gnutls            && require_pkg_config gnutls gnutls/gnutls.h 
gnutls_global_init
 enabled libbs2b           && require_pkg_config libbs2b bs2b.h bs2b_open
@@ -4636,7 +4798,7 @@ enabled libfdk_aac        && require_pkg_config fdk-aac 
"fdk-aac/aacenc_lib.h" a
 enabled libfontconfig     && require_pkg_config fontconfig 
"fontconfig/fontconfig.h" FcInit
 enabled libfreetype       && require_pkg_config freetype2 "ft2build.h 
FT_FREETYPE_H" FT_Init_FreeType
 enabled libgsm            && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
-                                   check_lib "${gsm_hdr}" gsm_create -lgsm && 
break;
+                                   check_lib libgsm "${gsm_hdr}" gsm_create 
-lgsm && break;
                                done || die "ERROR: libgsm not found"; }
 enabled libhdcd           && require_pkg_config libhdcd "hdcd/hdcd_simple.h" 
hdcd_new
 enabled libilbc           && require libilbc ilbc.h WebRtcIlbcfix_InitDecode 
-lilbc
@@ -4648,7 +4810,7 @@ enabled libopencore_amrnb && require libopencore_amrnb 
opencore-amrnb/interf_dec
 enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h 
D_IF_init -lopencore-amrwb
 enabled libopencv         && require_pkg_config opencv opencv/cv.h 
cvCreateImageHeader
 enabled libopenh264       && require_pkg_config openh264 wels/codec_api.h 
WelsGetCodecVersion
-enabled libopenjpeg       && { check_lib openjpeg.h opj_version -lopenjpeg 
-DOPJ_STATIC ||
+enabled libopenjpeg       && { check_lib libopenjpeg openjpeg.h opj_version 
-lopenjpeg -DOPJ_STATIC ||
                                require_pkg_config libopenjpeg1 openjpeg.h 
opj_version -DOPJ_STATIC; }
 enabled libopus           && require_pkg_config opus opus_multistream.h 
opus_multistream_decoder_create
 enabled libpulse          && require_pkg_config libpulse-simple pulse/simple.h 
pa_simple_new
@@ -4694,12 +4856,12 @@ enabled libx265           && require_pkg_config x265 
x265.h x265_api_get &&
                                die "ERROR: libx265 version must be >= 57."; }
 enabled libxavs           && require libxavs "stdint.h xavs.h" 
xavs_encoder_encode -lxavs
 enabled libxvid           && require libxvid xvid.h xvid_global -lxvidcore
-enabled mmal              && { check_lib interface/mmal/mmal.h 
mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
+enabled mmal              && { check_lib mmal interface/mmal/mmal.h 
mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
                                 { ! enabled cross_compile && {
                                     add_cflags -isystem/opt/vc/include/ 
-isystem/opt/vc/include/interface/vmcs_host/linux 
-isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline ;
                                     add_extralibs -L/opt/vc/lib/ -lmmal_core 
-lmmal_util -lmmal_vc_client -lbcm_host ;
-                                    check_lib interface/mmal/mmal.h 
mmal_port_connect ; }
-                                check_lib interface/mmal/mmal.h 
mmal_port_connect ; } ||
+                                    check_lib mmal interface/mmal/mmal.h 
mmal_port_connect ; }
+                                check_lib mmal interface/mmal/mmal.h 
mmal_port_connect ; } ||
                                die "ERROR: mmal not found"; }
 enabled mmal && check_func_headers interface/mmal/mmal.h 
"MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"
 enabled omx_rpi && enable omx
@@ -4711,18 +4873,18 @@ enabled omx               && { check_header OMX_Core.h 
||
 enabled openssl           && { { check_pkg_config openssl openssl/ssl.h 
OPENSSL_init_ssl ||
                                  check_pkg_config openssl openssl/ssl.h 
SSL_library_init; } && {
                                add_cflags $openssl_cflags && add_extralibs 
$openssl_libs; }||
-                               check_lib openssl/ssl.h SSL_library_init -lssl 
-lcrypto ||
-                               check_lib openssl/ssl.h SSL_library_init 
-lssl32 -leay32 ||
-                               check_lib openssl/ssl.h SSL_library_init -lssl 
-lcrypto -lws2_32 -lgdi32 ||
+                               check_lib openssl openssl/ssl.h 
SSL_library_init -lssl -lcrypto ||
+                               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 gnutls            && check_lib gmp.h mpz_export -lgmp && enable gmp
+enabled gnutls            && check_lib gmp gmp.h mpz_export -lgmp && enable gmp
 
 # libdc1394 check
 if enabled libdc1394; then
     { require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new &&
         enable libdc1394_2; } ||
-    { check_lib libdc1394/dc1394_control.h dc1394_create_handle 
-ldc1394_control -lraw1394 &&
+    { check_lib libdc1394 libdc1394/dc1394_control.h dc1394_create_handle 
-ldc1394_control -lraw1394 &&
         enable libdc1394_1; } ||
     die "ERROR: No version of libdc1394 found "
 fi
@@ -4753,7 +4915,7 @@ check_header AVFoundation/AVFoundation.h &&
 
 check_header sys/videoio.h
 
-check_lib "windows.h vfw.h" capCreateCaptureWindow -lvfw32
+check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
 # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
 # w32api 3.12 had it defined wrong
 check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable 
vfwcap_defines
@@ -4772,16 +4934,16 @@ check_header sys/soundcard.h
 check_header soundcard.h
 
 enabled_any alsa_indev alsa_outdev &&
-    check_lib alsa/asoundlib.h snd_pcm_htimestamp -lasound
+    check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
 
-enabled jack_indev && check_lib jack/jack.h jack_client_open -ljack &&
+enabled jack_indev && check_lib jack jack/jack.h jack_client_open -ljack &&
     check_func jack_port_get_latency_range -ljack
 
-enabled_any sndio_indev sndio_outdev && check_lib sndio.h sio_open -lsndio
+enabled_any sndio_indev sndio_outdev && check_lib sndio sndio.h sio_open 
-lsndio
 
 if enabled libcdio; then
-    check_lib "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia 
-lcdio_cdda -lcdio ||
-    check_lib "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open 
-lcdio_paranoia -lcdio_cdda -lcdio ||
+    check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open 
-lcdio_paranoia -lcdio_cdda -lcdio ||
+    check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" 
cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
     die "ERROR: No usable libcdio/cdparanoia found"
 fi
 
@@ -4805,11 +4967,11 @@ if enabled libxcb; then
 fi
 
 enabled dxva2 &&
-    check_lib "windows.h winuser.h" GetShellWindow -luser32 ||
+    check_lib user32 "windows.h winuser.h" GetShellWindow -luser32 ||
     disable dxva2
 
 enabled dxva2 &&
-    check_lib windows.h CoTaskMemFree -lole32 &&
+    check_lib ole32 windows.h CoTaskMemFree -lole32 &&
     enable dxva2_lib
 
 enabled vaapi && require vaapi va/va.h vaInitialize -lva
@@ -4819,11 +4981,11 @@ enabled vaapi &&
     disable vaapi
 
 enabled vaapi &&
-    check_lib "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm &&
+    check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm &&
     enable vaapi_drm
 
 enabled vaapi &&
-    check_lib "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11 &&
+    check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11 
&&
     enable vaapi_x11
 
 enabled vdpau &&
@@ -4831,7 +4993,7 @@ enabled vdpau &&
     disable vdpau
 
 enabled vdpau &&
-    check_lib "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau 
-lX11 &&
+    check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" 
vdp_device_create_x11 -lvdpau -lX11 &&
     enable vdpau_x11
 
 enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
@@ -5078,6 +5240,7 @@ check_deps $CONFIG_LIST       \
            $CONFIG_EXTRA      \
            $HAVE_LIST         \
            $ALL_COMPONENTS    \
+           $PROGRAM_LIST      \
 
 map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
 
@@ -5322,7 +5485,13 @@ TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
 CFLAGS-avplay=$sdl_cflags
 ZLIB=$($ldflags_filter -lz)
 LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
-EXTRALIBS=$extralibs
+EXTRALIBS=$extralibs_avfilter $extralibs_avdevice $extralibs_avformat 
$extralibs_avcodec $extralibs_avresample $extralibs_avutil $extralibs $LIBM
+EXTRALIBS-avcodec=$extralibs_avcodec $LIBM
+EXTRALIBS-avdevice=$extralibs_avdevice $LIBM
+EXTRALIBS-avfilter=$extralibs_avfilter $LIBM
+EXTRALIBS-avformat=$extralibs_avformat $LIBM
+EXTRALIBS-avresample=$extralibs_avresample $LIBM
+EXTRALIBS-avutil=$extralibs_avutil $LIBM
 COMPAT_OBJS=$compat_objs
 EXEOBJS=$exeobjs
 INSTALL=install
@@ -5356,8 +5525,8 @@ map 'get_version $v' $LIBRARY_LIST
 map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> config.mak' $LIBRARY_LIST
 
 print_program_libs(){
-    eval "program_libs=\$${1}_libs"
-    eval echo "LIBS-${1}=${program_libs}" >> config.mak
+    eval "program_libs=\$extralibs_${1}"
+    eval echo "LIBS-${1}=${program_libs} $LIBM" >> config.mak
 }
 
 map 'print_program_libs $v' $PROGRAM_LIST
@@ -5479,10 +5648,10 @@ Cflags: -I\${includedir}
 EOF
 }
 
-pkgconfig_generate libavutil     "Libav utility library"          
"$LIBAVUTIL_VERSION"     "$LIBRT $LIBM"
-pkgconfig_generate libavcodec    "Libav codec library"            
"$LIBAVCODEC_VERSION"    "$extralibs"
-pkgconfig_generate libavformat   "Libav container format library" 
"$LIBAVFORMAT_VERSION"   "$extralibs"
-pkgconfig_generate libavdevice   "Libav device handling library"  
"$LIBAVDEVICE_VERSION"   "$extralibs"
-pkgconfig_generate libavfilter   "Libav video filtering library"  
"$LIBAVFILTER_VERSION"   "$extralibs"
+pkgconfig_generate libavutil     "Libav utility library"          
"$LIBAVUTIL_VERSION"     "$extralibs_avutil $LIBM"
+pkgconfig_generate libavcodec    "Libav codec library"            
"$LIBAVCODEC_VERSION"    "$extralibs_avcodec $LIBM"
+pkgconfig_generate libavformat   "Libav container format library" 
"$LIBAVFORMAT_VERSION"   "$extralibs_avformat $LIBM"
+pkgconfig_generate libavdevice   "Libav device handling library"  
"$LIBAVDEVICE_VERSION"   "$extralibs_avdevice $LIBM"
+pkgconfig_generate libavfilter   "Libav video filtering library"  
"$LIBAVFILTER_VERSION"   "$extralibs_avfilter $LIBM"
 pkgconfig_generate libavresample "Libav audio resampling library" 
"$LIBAVRESAMPLE_VERSION" "$LIBM"
 pkgconfig_generate libswscale    "Libav image rescaling library"  
"$LIBSWSCALE_VERSION"    "$LIBM"
-- 
2.1.4


_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to