Previously, all link-time dependencies were added for all libraries, resulting in bogus link-time dependencies since not all dependencies are shared across libraries. Also, in some cases like libavutil, not all dependencies were taken into account, resulting in some cases of underlinking.
To address all this mess a machinery is added for tracking which dependency belongs to which library component and then leveraged to determine correct dependencies for all individual libraries. --- Changes since last time: - Correct link deps for all tools and testprogs, even with MSVC. Still open for discussion: - Janne had the idea of using the function name as variable name instead of adding a library name parameter to things like check_lib(). I prefer adding the parameter now, it helped drop some related hacks, see the patch that adds the parameter. - Vittorio mentioned that I have to add a lot of boilerplate for all those zlib and whatnot dependencies. He has a point. There's probably a way to write this more succinctly with a smarter resolver. However, I need to finish this in the not-too-distant future. I'll try to find a moment to test an idea I had. Makefile | 4 +- common.mak | 2 +- configure | 264 ++++++++++++++++++++++++++++++++++++++++-------- library.mak | 2 +- tests/checkasm/Makefile | 2 +- 5 files changed, 227 insertions(+), 47 deletions(-) diff --git a/Makefile b/Makefile index d4c2b8e..5f2006f 100644 --- a/Makefile +++ b/Makefile @@ -119,9 +119,7 @@ FF_STATIC_DEP_LIBS := $(STATIC_DEP_LIBS) all: $(AVPROGS) $(TOOLS): %$(EXESUF): %.o - $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS) $(ELIBS) - -tools/cws2fws$(EXESUF): ELIBS = $(ZLIB) + $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $^ $(EXTRALIBS-$(*F)) $(EXTRALIBS) $(ELIBS) CONFIGURABLE_COMPONENTS = \ $(wildcard $(FFLIBS:%=$(SRC_PATH)/lib%/all*.c)) \ diff --git a/common.mak b/common.mak index 70ebd4b..730b561 100644 --- a/common.mak +++ b/common.mak @@ -8,7 +8,7 @@ OBJS += $(OBJS-yes) FFLIBS := $($(NAME)_FFLIBS) $(FFLIBS-yes) $(FFLIBS) TESTPROGS += $(TESTPROGS-yes) -FFEXTRALIBS := $(FFLIBS:%=$(LD_LIB)) $(EXTRALIBS) +FFEXTRALIBS := $(FFLIBS:%=$(LD_LIB)) $(foreach lib,EXTRALIBS-$(NAME) $(FFLIBS:%=EXTRALIBS-%),$($(lib))) $(EXTRALIBS) OBJS := $(sort $(OBJS:%=$(SUBDIR)%)) TESTOBJS := $(TESTOBJS:%=$(SUBDIR)tests/%) $(TESTPROGS:%=$(SUBDIR)tests/%.o) diff --git a/configure b/configure index 9cd9471..4584dec 100755 --- a/configure +++ b/configure @@ -608,7 +608,7 @@ is_in(){ return 1 } -do_check_deps(){ +check_deps(){ for cfg; do cfg="${cfg#!}" enabled ${cfg}_checking && die "Circular dependency for $cfg." @@ -624,7 +624,7 @@ do_check_deps(){ eval dep_ifn="\$${cfg}_if_any" pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn - do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn + check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; } @@ -642,15 +642,13 @@ do_check_deps(){ done } -check_deps(){ - unset allopts - - do_check_deps "$@" - - for cfg in $allopts; do +set_component_extralibs(){ + linkunit=$1 + shift 1 + for cfg in $@; do enabled $cfg || continue - eval dep_extralibs="\$${cfg}_extralibs" - test -n "$dep_extralibs" && add_extralibs $dep_extralibs + eval dep_libs="\$${cfg}_extralibs" + test -n "$dep_libs" && add_extralibs_component $linkunit $dep_libs done } @@ -744,6 +742,12 @@ add_extralibs(){ prepend extralibs $($ldflags_filter "$@") } +add_extralibs_component(){ + component=$1 + shift + prepend extralibs_${component} $($ldflags_filter "$@") +} + add_host_cppflags(){ append host_cppflags "$@" } @@ -1012,7 +1016,7 @@ check_lib(){ shift 3 disable $name check_func_headers "$headers" "$funcs" "$@" && - enable $name && add_extralibs "$@" + enable $name && eval ${name}_extralibs="\$@" } check_pkg_config(){ @@ -1121,7 +1125,7 @@ require_pkg_config(){ pkg="${1%% *}" check_pkg_config "$@" || die "ERROR: $pkg_version not found" add_cflags $(get_safe "${pkg}_cflags") - add_extralibs $(get_safe "${pkg}_extralibs") + eval $(sanitize_var_name ${pkg}_extralibs)="\$(get_safe ${pkg}_extralibs)" } hostcc_e(){ @@ -1234,6 +1238,12 @@ EXAMPLE_LIST=" transcode_aac_example " +# catchall list of things that require external libs to link +EXTRALIBS_LIST=" + cpu_init + cws2fws +" + HWACCEL_LIBRARY_NONFREE_LIST=" cuda libnpp @@ -1959,6 +1969,7 @@ cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp" cllc_decoder_select="bswapdsp" comfortnoise_encoder_select="lpc" cook_decoder_select="audiodsp mdct sinewin" +cscd_decoder_extralibs="zlib_extralibs" cscd_decoder_select="lzo" cscd_decoder_suggest="zlib" dca_decoder_select="fmtconvert mdct" @@ -1968,6 +1979,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_extralibs="zlib_extralibs" dxv_decoder_select="lzf texturedsp" eac3_decoder_select="ac3_decoder" eac3_encoder_select="ac3_encoder" @@ -1975,6 +1987,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_extralibs="zlib_extralibs" ffv1_decoder_select="rangecoder" ffv1_encoder_select="rangecoder" ffvhuff_decoder_select="huffyuv_decoder" @@ -1983,13 +1996,17 @@ fic_decoder_select="golomb" flac_decoder_select="flacdsp" flac_encoder_select="bswapdsp flacdsp lpc" flashsv_decoder_deps="zlib" +flashsv_decoder_extralibs="zlib_extralibs" flashsv_encoder_deps="zlib" +flashsv_encoder_extralibs="zlib_extralibs" flashsv2_decoder_deps="zlib" +flashsv2_decoder_extralibs="zlib_extralibs" 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_extralibs="zlib_extralibs" g2m_decoder_select="blockdsp idctdsp jpegtables" h261_decoder_select="mpeg_er mpegvideo" h261_encoder_select="aandcttables mpegvideoenc" @@ -2001,6 +2018,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_extralibs="libsnappy_extralibs" hap_encoder_select="texturedspenc" hevc_decoder_select="bswapdsp cabac hevc_ps videodsp" huffyuv_decoder_select="bswapdsp huffyuvdsp" @@ -2060,7 +2078,9 @@ on2avc_decoder_select="mdct" opus_decoder_deps="avresample" opus_decoder_select="imdct15" png_decoder_deps="zlib" +png_decoder_extralibs="zlib_extralibs" png_encoder_deps="zlib" +png_encoder_extralibs="zlib_extralibs" png_encoder_select="huffyuvencdsp" prores_decoder_select="idctdsp" prores_encoder_select="fdctdsp" @@ -2069,6 +2089,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_extralibs="zlib_extralibs" 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" @@ -2076,23 +2097,29 @@ 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_extralibs="zlib_extralibs" sipr_decoder_select="lsp" sp5x_decoder_select="mjpeg_decoder" 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_extralibs="zlib_extralibs" tak_decoder_select="audiodsp" tdsc_decoder_deps="zlib" +tdsc_decoder_extralibs="zlib_extralibs" tdsc_decoder_select="mjpeg_decoder" theora_decoder_select="vp3_decoder" thp_decoder_select="mjpeg_decoder" +tiff_decoder_extralibs="zlib_extralibs" tiff_decoder_suggest="zlib" +tiff_encoder_extralibs="zlib_extralibs" tiff_encoder_suggest="zlib" truehd_decoder_select="mlp_decoder" truemotion2_decoder_select="bswapdsp" truespeech_decoder_select="bswapdsp" tscc_decoder_deps="zlib" +tscc_decoder_extralibs="zlib_extralibs" txd_decoder_select="texturedsp" twinvq_decoder_select="mdct lsp sinewin" utvideo_decoder_select="bswapdsp" @@ -2124,10 +2151,15 @@ wmv2_encoder_select="h263_encoder wmv2dsp" wmv3_decoder_select="vc1_decoder" wmv3image_decoder_select="wmv3_decoder" zerocodec_decoder_deps="zlib" +zerocodec_decoder_extralibs="zlib_extralibs" zlib_decoder_deps="zlib" +zlib_decoder_extralibs="zlib_extralibs" zlib_encoder_deps="zlib" +zlib_encoder_extralibs="zlib_extralibs" zmbv_decoder_deps="zlib" +zmbv_decoder_extralibs="zlib_extralibs" zmbv_encoder_deps="zlib" +zmbv_encoder_extralibs="zlib_extralibs" # hardware accelerators d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder" @@ -2137,56 +2169,86 @@ vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads" vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore" h263_vaapi_hwaccel_deps="vaapi" +h263_vaapi_hwaccel_extralibs="vaapi_extralibs" h263_vaapi_hwaccel_select="h263_decoder" h264_d3d11va_hwaccel_deps="d3d11va" +h264_d3d11va_hwaccel_extralibs="d3d11va_extralibs" h264_d3d11va_hwaccel_select="h264_decoder" h264_dxva2_hwaccel_deps="dxva2" +h264_dxva2_hwaccel_extralibs="dxva2_extralibs" h264_dxva2_hwaccel_select="h264_decoder" h264_mmal_hwaccel_deps="mmal" +h264_mmal_hwaccel_extralibs="mmal_extralibs" h264_qsv_hwaccel_deps="libmfx" +h264_qsv_hwaccel_extralibs="libmfx_extralibs" h264_vaapi_hwaccel_deps="vaapi" +h264_vaapi_hwaccel_extralibs="vaapi_extralibs" h264_vaapi_hwaccel_select="h264_decoder" h264_vda_hwaccel_deps="vda" +h264_vda_hwaccel_extralibs="vda_extralibs" h264_vda_hwaccel_select="h264_decoder" h264_vda_old_hwaccel_deps="vda" +h264_vda_old_hwaccel_extralibs="vda_extralibs" h264_vda_old_hwaccel_select="h264_decoder" h264_vdpau_hwaccel_deps="vdpau" +h264_vdpau_hwaccel_extralibs="vdpau_extralibs" h264_vdpau_hwaccel_select="h264_decoder" hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC" +hevc_d3d11va_hwaccel_extralibs="d3d11va_extralibs" hevc_d3d11va_hwaccel_select="hevc_decoder" hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" +hevc_dxva2_hwaccel_extralibs="dxva2_extralibs" hevc_dxva2_hwaccel_select="hevc_decoder" hevc_qsv_hwaccel_deps="libmfx" +hevc_qsv_hwaccel_extralibs="libmfx_extralibs" hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" +hevc_vdpau_hwaccel_extralibs="vdpau_extralibs" hevc_vdpau_hwaccel_select="hevc_decoder" mpeg1_vdpau_hwaccel_deps="vdpau" +mpeg1_vdpau_hwaccel_extralibs="vdpau_extralibs" mpeg1_vdpau_hwaccel_select="mpeg1video_decoder" mpeg2_d3d11va_hwaccel_deps="d3d11va" +mpeg2_d3d11va_hwaccel_extralibs="d3d11va_extralibs" mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder" mpeg2_dxva2_hwaccel_deps="dxva2" +mpeg2_dxva2_hwaccel_extralibs="dxva2_extralibs" mpeg2_dxva2_hwaccel_select="mpeg2video_decoder" mpeg2_mmal_hwaccel_deps="mmal" +mpeg2_mmal_hwaccel_extralibs="mmal_extralibs" mpeg2_qsv_hwaccel_deps="libmfx" +mpeg2_qsv_hwaccel_extralibs="libmfx_extralibs" mpeg2_vaapi_hwaccel_deps="vaapi" +mpeg2_vaapi_hwaccel_extralibs="vaapi_extralibs" mpeg2_vaapi_hwaccel_select="mpeg2video_decoder" mpeg2_vdpau_hwaccel_deps="vdpau" +mpeg2_vdpau_hwaccel_extralibs="vdpau_extralibs" mpeg2_vdpau_hwaccel_select="mpeg2video_decoder" mpeg4_vaapi_hwaccel_deps="vaapi" +mpeg4_vaapi_hwaccel_extralibs="vaapi_extralibs" mpeg4_vaapi_hwaccel_select="mpeg4_decoder" mpeg4_vdpau_hwaccel_deps="vdpau" +mpeg4_vdpau_hwaccel_extralibs="vdpau_extralibs" mpeg4_vdpau_hwaccel_select="mpeg4_decoder" vc1_d3d11va_hwaccel_deps="d3d11va" +vc1_d3d11va_hwaccel_extralibs="d3d11va_extralibs" vc1_d3d11va_hwaccel_select="vc1_decoder" vc1_dxva2_hwaccel_deps="dxva2" +vc1_dxva2_hwaccel_extralibs="dxva2_extralibs" vc1_dxva2_hwaccel_select="vc1_decoder" vc1_mmal_hwaccel_deps="mmal" +vc1_mmal_hwaccel_extralibs="mmal_extralibs" vc1_qsv_hwaccel_deps="libmfx" +vc1_qsv_hwaccel_extralibs="libmfx_extralibs" vc1_vaapi_hwaccel_deps="vaapi" +vc1_vaapi_hwaccel_extralibs="vaapi_extralibs" vc1_vaapi_hwaccel_select="vc1_decoder" vc1_vdpau_hwaccel_deps="vdpau" +vc1_vdpau_hwaccel_extralibs="vdpau_extralibs" vc1_vdpau_hwaccel_select="vc1_decoder" vp8_qsv_hwaccel_deps="libmfx" +vp8_qsv_hwaccel_extralibs="libmfx_extralibs" vp8_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVP8" +vp8_vaapi_hwaccel_extralibs="vaapi_extralibs" vp8_vaapi_hwaccel_select="vp8_decoder" wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel" wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" @@ -2195,45 +2257,65 @@ wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel" # hardware-accelerated codecs nvenc_deps_any="dlopen LoadLibrary" -nvenc_extralibs='$ldl' +nvenc_extralibs='$dlopen_extralibs' omx_deps="dlopen pthreads" -omx_extralibs='$ldl' +omx_extralibs='$dlopen_extralibs $pthreads_extralibs' omx_rpi_select="omx" qsvdec_select="qsv" qsvenc_select="qsv" vaapi_encode_deps="vaapi" hwupload_cuda_filter_deps="cuda" +hwupload_cuda_filter_extralibs="cuda_extralibs" scale_npp_filter_deps="cuda libnpp" +scale_npp_filter_extralibs="cuda_extralibs libnpp_extralibs" h264_mmal_decoder_deps="mmal" +h264_mmal_decoder_extralibs="mmal_extralibs" h264_nvenc_encoder_deps="nvenc" +h264_nvenc_encoder_extralibs="nvenc_extralibs" h264_omx_encoder_deps="omx" +h264_omx_encoder_extralibs="omx_extralibs" h264_qsv_decoder_deps="libmfx" +h264_qsv_decoder_extralibs="libmfx_extralibs" h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel" h264_qsv_encoder_deps="libmfx" +h264_qsv_encoder_extralibs="libmfx_extralibs" h264_qsv_encoder_select="qsvenc" h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264" +h264_vaapi_encoder_extralibs="vaapi_extralibs" h264_vaapi_encoder_select="vaapi_encode golomb" hevc_nvenc_encoder_deps="nvenc" +hevc_nvenc_encoder_extralibs="nvenc_extralibs" hevc_qsv_decoder_deps="libmfx" +hevc_qsv_decoder_extralibs="libmfx_extralibs" hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser hevc_qsv_hwaccel qsvdec" hevc_qsv_encoder_deps="libmfx" +hevc_qsv_encoder_extralibs="libmfx_extralibs" hevc_qsv_encoder_select="hevc_ps qsvenc" hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC" +hevc_vaapi_encoder_extralibs="vaapi_extralibs" hevc_vaapi_encoder_select="vaapi_encode golomb" mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG" +mjpeg_vaapi_encoder_extralibs="vaapi_extralibs" mjpeg_vaapi_encoder_select="vaapi_encode jpegtables" mpeg2_mmal_decoder_deps="mmal" +mpeg2_mmal_decoder_extralibs="mmal_extralibs" mpeg2_qsv_decoder_deps="libmfx" +mpeg2_qsv_decoder_extralibs="libmfx_extralibs" mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel mpegvideo_parser" mpeg2_qsv_encoder_deps="libmfx" +mpeg2_qsv_encoder_extralibs="libmfx_extralibs" mpeg2_qsv_encoder_select="qsvenc" mpeg4_omx_encoder_deps="omx" +mpeg4_omx_encoder_extralibs="omx_extralibs" vc1_mmal_decoder_deps="mmal" +vc1_mmal_decoder_extralibs="mmal_extralibs" vc1_qsv_decoder_deps="libmfx" +vc1_qsv_decoder_extralibs="libmfx_extralibs" vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel vc1_parser" vp8_qsv_decoder_deps="libmfx" +vp8_qsv_decoder_extralibs="libmfx_extralibs" vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser" nvenc_h264_encoder_select="h264_nvenc_encoder" @@ -2254,58 +2336,99 @@ mjpeg2jpeg_bsf_select="jpegtables" avisynth_deps="LoadLibrary" avxsynth_deps="dlopen" avisynth_demuxer_deps_any="avisynth avxsynth" +avisynth_demuxer_extralibs="dlopen_extralibs" avisynth_demuxer_select="riffdec" libdcadec_decoder_deps="libdcadec" +libdcadec_decoder_extralibs="libdcadec_extralibs" libfaac_encoder_deps="libfaac" +libfaac_encoder_extralibs="libfaac_extralibs" libfaac_encoder_select="audio_frame_queue" libfdk_aac_decoder_deps="libfdk_aac" +libfdk_aac_decoder_extralibs="fdk_aac_extralibs" libfdk_aac_encoder_deps="libfdk_aac" +libfdk_aac_encoder_extralibs="fdk_aac_extralibs" libfdk_aac_encoder_select="audio_frame_queue" libgsm_decoder_deps="libgsm" +libgsm_decoder_extralibs="libgsm_extralibs" libgsm_encoder_deps="libgsm" +libgsm_encoder_extralibs="libgsm_extralibs" libgsm_ms_decoder_deps="libgsm" +libgsm_ms_decoder_extralibs="libgsm_extralibs" libgsm_ms_encoder_deps="libgsm" +libgsm_ms_encoder_extralibs="libgsm_extralibs" libilbc_decoder_deps="libilbc" +libilbc_decoder_extralibs="libilbc_extralibs" libilbc_encoder_deps="libilbc" +libilbc_encoder_extralibs="libilbc_extralibs" libkvazaar_encoder_deps="libkvazaar" +libkvazaar_encoder_extralibs="kvazaar_extralibs" libmp3lame_encoder_deps="libmp3lame" +libmp3lame_encoder_extralibs="libmp3lame_extralibs" libmp3lame_encoder_select="audio_frame_queue mpegaudioheader" libopencore_amrnb_decoder_deps="libopencore_amrnb" +libopencore_amrnb_decoder_extralibs="libopencore_amrnb_extralibs" libopencore_amrnb_encoder_deps="libopencore_amrnb" +libopencore_amrnb_encoder_extralibs="libopencore_amrnb_extralibs" libopencore_amrnb_encoder_select="audio_frame_queue" libopencore_amrwb_decoder_deps="libopencore_amrwb" +libopencore_amrwb_decoder_extralibs="libopencore_amrwb_extralibs" libopenh264_decoder_deps="libopenh264" +libopenh264_decoder_extralibs="openh264_extralibs" libopenh264_decoder_select="h264_mp4toannexb_bsf" libopenh264_encoder_deps="libopenh264" +libopenh264_encoder_extralibs="openh264_extralibs" libopenjpeg_decoder_deps="libopenjpeg" +libopenjpeg_decoder_extralibs="libopenjpeg_extralibs libopenjpeg1_extralibs" libopenjpeg_encoder_deps="libopenjpeg" +libopenjpeg_encoder_extralibs="libopenjpeg_extralibs libopenjpeg1_extralibs" libopus_decoder_deps="libopus" +libopus_decoder_extralibs="opus_extralibs" libopus_encoder_deps="libopus" +libopus_encoder_extralibs="opus_extralibs" libopus_encoder_select="audio_frame_queue" libschroedinger_decoder_deps="libschroedinger" +libschroedinger_decoder_extralibs="schroedinger_1_0_extralibs" libschroedinger_encoder_deps="libschroedinger" +libschroedinger_encoder_extralibs="schroedinger_1_0_extralibs" libspeex_decoder_deps="libspeex" +libspeex_decoder_extralibs="speex_extralibs" libspeex_encoder_deps="libspeex" +libspeex_encoder_extralibs="speex_extralibs" libspeex_encoder_select="audio_frame_queue" libtheora_encoder_deps="libtheora" +libtheora_encoder_extralibs="libtheora_extralibs" libtwolame_encoder_deps="libtwolame" +libtwolame_encoder_extralibs="libtwolame_extralibs" libvo_aacenc_encoder_deps="libvo_aacenc" +libvo_aacenc_encoder_extralibs="libvo_aacenc_extralibs" libvo_aacenc_encoder_select="audio_frame_queue" libvo_amrwbenc_encoder_deps="libvo_amrwbenc" +libvo_amrwbenc_encoder_extralibs="libvo_amrwbenc_extralibs" libvorbis_encoder_deps="libvorbis" +libvorbis_encoder_extralibs="libvorbis_extralibs" libvorbis_encoder_select="audio_frame_queue" libvpx_vp8_decoder_deps="libvpx" +libvpx_vp8_decoder_extralibs="vpx_extralibs" libvpx_vp8_encoder_deps="libvpx" +libvpx_vp8_encoder_extralibs="vpx_extralibs" libvpx_vp9_decoder_deps="libvpx" +libvpx_vp9_decoder_extralibs="vpx_extralibs" libvpx_vp9_encoder_deps="libvpx" +libvpx_vp9_encoder_extralibs="vpx_extralibs" libwavpack_encoder_deps="libwavpack" +libwavpack_encoder_extralibs="libwavpack_extralibs" libwavpack_encoder_select="audio_frame_queue" libwebp_encoder_deps="libwebp" +libwebp_encoder_extralibs="libwebp_extralibs" libx262_encoder_deps="libx262" libx264_encoder_deps="libx264" +libx264_encoder_extralibs="x264_extralibs" libx265_encoder_deps="libx265" +libx265_encoder_extralibs="x265_extralibs" libxavs_encoder_deps="libxavs" +libxavs_encoder_extralibs="libxavs_extralibs" libxvid_encoder_deps="libxvid mkstemp" +libxvid_encoder_extralibs="libxvid_extralibs" # demuxers / muxers ac3_demuxer_select="ac3_parser" @@ -2328,10 +2451,12 @@ hls_muxer_select="mpegts_muxer" ipod_muxer_select="mov_muxer" ismv_muxer_select="mov_muxer" matroska_audio_muxer_select="matroska_muxer" +matroska_demuxer_extralibs="bzlib_extralibs zlib_extralibs" matroska_demuxer_select="iso_media riffdec" matroska_demuxer_suggest="bzlib lzo zlib" matroska_muxer_select="iso_media riffenc" mmf_muxer_select="riffenc" +mov_demuxer_extralibs="zlib_extralibs" mov_demuxer_select="iso_media riffdec" mov_demuxer_suggest="zlib" mov_muxer_select="iso_media riffenc rtpenc_chain" @@ -2358,6 +2483,7 @@ sdp_demuxer_select="rtpdec" smoothstreaming_muxer_select="ismv_muxer" spdif_muxer_select="aac_parser" spx_muxer_select="ogg_muxer" +swf_demuxer_extralibs="zlib_extralibs" swf_demuxer_suggest="zlib" tak_demuxer_select="tak_parser" tg2_muxer_select="mov_muxer" @@ -2373,43 +2499,62 @@ xwma_demuxer_select="riffdec" # indevs / outdevs alsa_indev_deps="alsa" +alsa_indev_extralibs="alsa_extralibs" alsa_outdev_deps="alsa" +alsa_outdev_extralibs="alsa_extralibs" avfoundation_indev_deps="AVFoundation_AVFoundation_h objc_arc pthreads" -avfoundation_indev_extralibs="-framework Foundation -framework AVFoundation -framework CoreVideo -framework CoreMedia" +avfoundation_indev_extralibs="avfoundation_extralibs pthreads_extralibs" 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" dv1394_indev_select="dv_demuxer" fbdev_indev_deps="linux_fb_h" +fbdev_indev_extralibs="nanosleep_extralibs" jack_indev_deps="jack" jack_indev_deps_any="sem_timedwait dispatch_dispatch_h" +jack_indev_extralibs="jack_extralibs" libcdio_indev_deps="libcdio" +libcdio_indev_extralibs="libcdio_extralibs" libdc1394_indev_deps="libdc1394" +libdc1394_indev_extralibs="libdc1394_2_extralibs" oss_indev_deps_any="soundcard_h sys_soundcard_h" oss_outdev_deps_any="soundcard_h sys_soundcard_h" pulse_indev_deps="libpulse" +pulse_indev_extralibs="libpulse_simple_extralibs" sndio_indev_deps="sndio" +sndio_indev_extralibs="sndio_extralibs" sndio_outdev_deps="sndio" +sndio_outdev_extralibs="sndio_extralibs" v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" vfwcap_indev_deps="vfw32 vfwcap_defines" +vfwcap_indev_extralibs="vfw32_extralibs" xcbgrab_indev_deps="libxcb" +xcbgrab_indev_extralibs="xcb_shape_extrlibs xcb_shm_extralibs xcb_xfixes_extralibs" # protocols ffrtmpcrypt_protocol_deps="!librtmp_protocol" ffrtmpcrypt_protocol_deps_any="gmp openssl" +ffrtmpcrypt_protocol_extralibs="openssl_extralibs" ffrtmpcrypt_protocol_select="tcp_protocol" ffrtmphttp_protocol_deps="!librtmp_protocol" ffrtmphttp_protocol_select="http_protocol" +gopher_protocol_extralibs="network_extralibs" 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_extralibs="librtmp_extralibs" librtmpe_protocol_deps="librtmp" +librtmpe_protocol_extralibs="librtmp_extralibs" librtmps_protocol_deps="librtmp" +librtmps_protocol_extralibs="librtmp_extralibs" librtmpt_protocol_deps="librtmp" +librtmpt_protocol_extralibs="librtmp_extralibs" librtmpte_protocol_deps="librtmp" +librtmpte_protocol_extralibs="librtmp_extralibs" mmsh_protocol_select="http_protocol" +mmst_protocol_extralibs="network_extralibs" mmst_protocol_select="network" rtmp_protocol_deps="!librtmp_protocol" rtmp_protocol_select="tcp_protocol" @@ -2421,16 +2566,22 @@ 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_extralibs="network_extralibs" sctp_protocol_select="network" srtp_protocol_select="rtp_protocol srtp" +tcp_protocol_extralibs="network_extralibs" tcp_protocol_select="network" tls_gnutls_protocol_deps="gnutls" +tls_gnutls_protocol_extralibs="gmp_extralibs gnutls_extralibs" tls_gnutls_protocol_select="tcp_protocol" tls_openssl_protocol_deps="openssl !tls_gnutls_protocol" +tls_openssl_protocol_extralibs="openssl_extralibs pthreads_extralibs" tls_openssl_protocol_select="tcp_protocol" tls_protocol_deps_any="tls_gnutls_protocol tls_openssl_protocol" +udp_protocol_extralibs="network_extralibs" udp_protocol_select="network" unix_protocol_deps="sys_un_h" +unix_protocol_extralibs="network_extralibs" unix_protocol_select="network" # filters @@ -2438,24 +2589,32 @@ asyncts_filter_deps="avresample" blackframe_filter_deps="gpl" boxblur_filter_deps="gpl" bs2b_filter_deps="libbs2b" +bs2b_filter_extralibs="libbs2b_extralibs" cropdetect_filter_deps="gpl" deinterlace_qsv_filter_deps="libmfx" +deinterlace_qsv_filter_extralibs="libmfx_extralibs" deinterlace_vaapi_filter_deps="vaapi" +deinterlace_vaapi_filter_extralibs="vaapi_extralibs" delogo_filter_deps="gpl" drawtext_filter_deps="libfreetype" +drawtext_filter_extralibs="freetype2_extralibs fontconfig_extralibs" frei0r_filter_deps="frei0r dlopen" -frei0r_filter_extralibs='$ldl' +frei0r_filter_extralibs="frei0r_extralibs dlopen_extralibs" frei0r_src_filter_deps="frei0r dlopen" -frei0r_src_filter_extralibs='$ldl' +frei0r_src_filter_extralibs="frei0r_extralibs dlopen_extralibs" hdcd_filter_deps="libhdcd" +hdcd_filter_extralibs="libhdcd_extralibs" hqdn3d_filter_deps="gpl" interlace_filter_deps="gpl" movie_filter_deps="avcodec avformat" ocv_filter_deps="libopencv" +ocv_filter_extralibs="opencv_extralibs" resample_filter_deps="avresample" scale_filter_deps="swscale" scale_qsv_filter_deps="libmfx" +scale_qsv_filter_extralibs="libmfx_extralibs" scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer" +scale_vaapi_filter_extralibs="vaapi_extralibs" # examples decode_audio_example_deps="avcodec avutil" @@ -2468,6 +2627,10 @@ output_example_deps="avcodec avformat avresample avutil swscale" qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder" transcode_aac_example_deps="avcodec avformat avresample" +# EXTRALIBS_LIST +cpu_init_extralibs="pthreads_extralibs" +cws2fws_extralibs="zlib_extralibs" + # libraries, in linking order avcodec_deps="avutil" avdevice_deps="avformat avcodec avutil" @@ -2476,15 +2639,21 @@ avformat_deps="avcodec avutil" avresample_deps="avutil" swscale_deps="avutil" +avcodec_extralibs="pthreads_extralibs" +avfilter_extralibs="pthreads_extralibs" +avutil_extralibs="clock_gettime_extralibs cuda_extralibs libm_extralibs libmfx_extralibs nanosleep_extralibs user32_extralibs vaapi_extralibs vaapi_drm_extralibs vaapi_x11_extralibs vdpau_x11_extralibs wincrypt_extralibs" + # programs avconv_deps="avcodec avfilter avformat avresample swscale" +avconv_extralibs="dxva2_lib_extralibs ole32_extralibs psapi_extralibs shell32_extralibs" 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_extralibs='$sdl_extralibs' +avplay_extralibs="sdl_extralibs shell32_extralibs" avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter" avprobe_deps="avcodec avformat" +avprobe_extralibs="shell32_extralibs" # documentation pod2man_deps="doc" @@ -2542,6 +2711,9 @@ enable valgrind_backtrace # By default, enable only those hwaccels that have no external dependencies. enable d3d11va dxva2 vda vdpau +# internal components are enabled by default +enable $EXTRALIBS_LIST + # build settings SHFLAGS='-shared -Wl,-soname,$$(@F)' LIBPREF="lib" @@ -4429,9 +4601,9 @@ 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_extralibs= elif check_func dlopen -ldl; then - ldl=-ldl + dlopen_extralibs=-ldl fi if ! disabled network; then @@ -4495,7 +4667,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 clock_gettime time.h clock_gettime -lrt && LIBRT="-lrt"; } + check_lib clock_gettime time.h clock_gettime -lrt check_func fcntl check_func fork @@ -4603,19 +4775,19 @@ enabled pthreads && disabled zlib || check_lib zlib zlib.h zlibVersion -lz disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2 -check_lib libm math.h sin -lm && LIBM="-lm" +check_lib libm math.h sin -lm atan2f_args=2 ldexpf_args=2 powf_args=2 for func in $MATH_FUNCS; do - eval check_mathfunc $func \${${func}_args:-1} $LIBM + eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs 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 && require avxsynth "avxsynth/avxsynth_c.h dlfcn.h" dlopen -ldl +enabled avxsynth && { check_header avxsynth/avxsynth_c.h || die "ERROR: avxsynth/avxsynth_c.h header not found"; } enabled cuda && require 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 @@ -4697,8 +4869,8 @@ enabled omx_rpi && { check_header OMX_Core.h || die "ERROR: OpenMAX IL headers not found"; } enabled omx && { check_header OMX_Core.h || die "ERROR: OpenMAX IL headers not found"; } 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_extralibs; } || + check_pkg_config openssl openssl/ssl.h SSL_library_init; } && + add_cflags $openssl_cflags || 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 || @@ -4776,7 +4948,6 @@ if enabled libxcb; then } && enable libxcb_xfixes add_cflags "$xcb_shape_cflags $xcb_shm_cflags $xcb_xfixes_cflags" - add_extralibs "$xcb_shape_extralibs $xcb_shm_extralibs $xcb_xfixes_extralibs" fi enabled dxva2 && @@ -5057,6 +5228,21 @@ check_deps $CONFIG_LIST \ $HAVE_LIST \ $ALL_COMPONENTS \ +for linkunit in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do + unset dep_lbs + set_component_extralibs $linkunit $linkunit + eval components=\$$(toupper ${linkunit})_COMPONENTS} + for comp in ${components}; do + eval set_component_extralibs \$linkunit \$$(toupper ${comp%s})_LIST + done + unique extralibs_${linkunit} + eval extralibs_content=\${extralibs_${linkunit}} + for entry in $extralibs_content; do + eval append dep_lbs \$\(\$ldflags_filter \$${entry}\) + done + eval extralibs_${linkunit}=\$dep_lbs +done + map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST for thread in $THREADS_LIST; do @@ -5294,7 +5480,6 @@ TARGET_PATH=$target_path TARGET_SAMPLES=${target_samples:-\$(SAMPLES)} CFLAGS-avplay=$sdl_cflags CFLAGS_HEADERS=$CFLAGS_HEADERS -ZLIB=$($ldflags_filter -lz) LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD EXTRALIBS=$extralibs COMPAT_OBJS=$compat_objs @@ -5328,12 +5513,9 @@ map 'get_version $v' $LIBRARY_LIST map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> config.mak' $LIBRARY_LIST -print_program_extralibs(){ - eval "program_extralibs=\$${1}_extralibs" - eval echo "EXTRALIBS-${1}=${program_extralibs}" >> config.mak -} - -map 'print_program_extralibs $v' $PROGRAM_LIST +for entry in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do + eval echo "EXTRALIBS-${entry}=\$extralibs_${entry}" >> config.mak +done cat > $TMPH <<EOF /* Automatically generated by configure - do not modify! */ @@ -5452,10 +5634,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 libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$LIBM" -pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" +pkgconfig_generate libavutil "Libav utility library" "$LIBAVUTIL_VERSION" "$extralibs_avutil" +pkgconfig_generate libavcodec "Libav codec library" "$LIBAVCODEC_VERSION" "$extralibs_avcodec" +pkgconfig_generate libavformat "Libav container format library" "$LIBAVFORMAT_VERSION" "$extralibs_avformat" +pkgconfig_generate libavdevice "Libav device handling library" "$LIBAVDEVICE_VERSION" "$extralibs_avdevice" +pkgconfig_generate libavfilter "Libav video filtering library" "$LIBAVFILTER_VERSION" "$extralibs_avfilter" +pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs_avresample" +pkgconfig_generate libswscale "Libav image rescaling library" "$LIBSWSCALE_VERSION" "$extralibs_swscale" diff --git a/library.mak b/library.mak index bf1853f..fdb8a5d 100644 --- a/library.mak +++ b/library.mak @@ -28,7 +28,7 @@ $(TOOLS): THISLIB = $(NAME:%=$(LD_LIB)) $(TESTPROGS): THISLIB = $(SUBDIR)$(LIBNAME) $(TESTPROGS) $(TOOLS): %$(EXESUF): %.o - $$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(ELIBS) + $$(LD) $(LDFLAGS) $(LDEXEFLAGS) $$(LD_O) $$(filter %.o,$$^) $$(THISLIB) $(FFEXTRALIBS) $$(EXTRALIBS-$$(*F)) $$(ELIBS) $(SUBDIR)lib$(NAME).ver: $(SUBDIR)lib$(NAME).v $(OBJS) $$(M)sed 's/MAJOR/$(lib$(NAME)_VERSION_MAJOR)/' $$< | $(VERSION_SCRIPT_POSTPROCESS_CMD) > $$@ diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index 639a08e..87f92f4 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -35,7 +35,7 @@ OBJDIRS += $(CHECKASMDIRS) CHECKASM := tests/checkasm/checkasm$(EXESUF) $(CHECKASM): $(CHECKASMOBJS) $(FF_STATIC_DEP_LIBS) - $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(CHECKASMOBJS) $(FF_STATIC_DEP_LIBS) $(EXTRALIBS) + $(LD) $(LDFLAGS) $(LDEXEFLAGS) $(LD_O) $(CHECKASMOBJS) $(FF_STATIC_DEP_LIBS) $(EXTRALIBS-avcodec) $(EXTRALIBS-avutil) $(EXTRALIBS) checkasm: $(CHECKASM) -- 2.1.4 _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel