]> git.sesse.net Git - ffmpeg/blobdiff - configure
build: Add name parameter to check_lib() helper function
[ffmpeg] / configure
index 45f52560fd4507c22da3be7e9aa942994eb36f14..365bbb2bf293dfcf04ef0d48719fce8f41f924fa 100755 (executable)
--- a/configure
+++ b/configure
@@ -63,6 +63,7 @@ Options: [defaults in brackets after descriptions]
 
 Help options:
   --help                   print this message
+  --quiet                  Suppress showing informative output
   --list-decoders          show all available decoders
   --list-encoders          show all available encoders
   --list-hwaccels          show all available hardware accelerators
@@ -78,7 +79,7 @@ Help options:
 Standard options:
   --logfile=FILE           log tests and output to FILE [config.log]
   --disable-logging        do not log configure debug information
-  --prefix=PREFIX          install in PREFIX [$prefix]
+  --prefix=PREFIX          install in PREFIX [$prefix_default]
   --bindir=DIR             install binaries in DIR [PREFIX/bin]
   --datadir=DIR            install data files in DIR [PREFIX/share/avconv]
   --docdir=DIR             install documentation in DIR [PREFIX/share/doc/libav]
@@ -86,7 +87,7 @@ Standard options:
   --shlibdir=DIR           install shared libs in DIR [PREFIX/lib]
   --incdir=DIR             install includes in DIR [PREFIX/include]
   --mandir=DIR             install man page in DIR [PREFIX/share/man]
-  --enable-rpath           use rpath when linking programs [USE WITH CARE]
+  --enable-rpath           use rpath when linking programs (USE WITH CARE)
 
 Licensing options:
   --enable-gpl             allow use of GPL code, the resulting libs
@@ -99,7 +100,7 @@ Configuration options:
   --disable-static         do not build static libraries [no]
   --enable-shared          build shared libraries [no]
   --enable-small           optimize for size instead of speed
-  --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
+  --enable-runtime-cpudetect detect CPU capabilities at runtime (bigger binary)
   --enable-gray            enable full grayscale support (slower color)
   --disable-swscale-alpha  disable alpha channel support in swscale
   --disable-all            disable building components, libraries and programs
@@ -113,6 +114,8 @@ Program options:
 
 Component options:
   --disable-doc            do not build documentation
+  --disable-pod2man        do not build manual pages
+  --disable-texi2html      do not build HTML documentation
   --disable-avdevice       disable libavdevice build
   --disable-avcodec        disable libavcodec build
   --disable-avformat       disable libavformat build
@@ -185,6 +188,7 @@ External library support:
   themselves, not all their features will necessarily be usable by Libav.
 
   --enable-avisynth          video frameserver
+  --enable-avxsynth          Linux version of AviSynth
   --enable-bzlib             bzip2 compression [autodetect]
   --enable-frei0r            video filtering plugins
   --enable-gnutls            crypto
@@ -197,6 +201,7 @@ External library support:
   --enable-libfontconfig     font configuration and management
   --enable-libfreetype       font rendering
   --enable-libgsm            GSM audio encoding/decoding
+  --enable-libhdcd           HDCD decoding filter
   --enable-libilbc           ILBC audio encoding/decoding
   --enable-libkvazaar        HEVC video encoding
   --enable-libmp3lame        MP3 audio encoding
@@ -279,7 +284,6 @@ Toolchain options:
   --extra-libs=ELIBS       add ELIBS [$ELIBS]
   --extra-version=STRING   version string suffix []
   --optflags=OPTFLAGS      override optimization-related compiler flags
-  --build-suffix=SUFFIX    library name suffix []
   --enable-pic             build position-independent code
   --enable-thumb           compile for Thumb instruction set
   --enable-lto             use link-time optimization
@@ -293,7 +297,6 @@ Advanced options (experts only):
   --disable-safe-bitstream-reader
                            disable buffer boundary checking in bitreaders
                            (faster, but may crash)
-  --enable-memalign-hack   emulate memalign, interferes with memory debuggers
   --enable-sram            allow use of on-chip SRAM
 
 Optimization options (experts only):
@@ -426,7 +429,7 @@ filter(){
     pat=$1
     shift
     for v; do
-        eval "case $v in $pat) echo $v ;; esac"
+        eval "case $v in $pat) printf '%s ' $v ;; esac"
     done
 }
 
@@ -434,7 +437,7 @@ filter_out(){
     pat=$1
     shift
     for v; do
-        eval "case $v in $pat) ;; *) echo $v ;; esac"
+        eval "case $v in $pat) ;; *) printf '%s ' $v ;; esac"
     done
 }
 
@@ -713,6 +716,10 @@ add_cflags(){
     append CFLAGS $($cflags_filter "$@")
 }
 
+add_cflags_headers(){
+    append CFLAGS_HEADERS $($cflags_filter "$@")
+}
+
 add_asflags(){
     append ASFLAGS $($asflags_filter "$@")
 }
@@ -862,7 +869,7 @@ check_code(){
 
 check_cppflags(){
     log check_cppflags "$@"
-    check_cc "$@" <<EOF && append CPPFLAGS "$@"
+    check_cpp "$@" <<EOF && append CPPFLAGS "$@"
 int x;
 EOF
 }
@@ -881,15 +888,15 @@ check_cflags(){
 }
 
 test_objcflags(){
-    log test_cflags "$@"
-    set -- $($cflags_filter "$@")
+    log test_objcflags "$@"
+    set -- $($objcflags_filter "$@")
     check_objcc "$@" <<EOF
 int x;
 EOF
 }
 
 check_objcflags(){
-    log check_cflags "$@"
+    log check_objcflags "$@"
     test_objcflags "$@" && add_objcflags "$@"
 }
 
@@ -984,34 +991,43 @@ check_cpp_condition(){
 EOF
 }
 
-check_lib(){
-    log check_lib "$@"
-    header="$1"
-    func="$2"
+test_cflags_cpp(){
+    log test_cflags_cpp "$@"
+    flags=$1
+    condition=$2
     shift 2
-    check_header $header && check_func $func "$@" && add_extralibs "$@"
+    set -- $($cflags_filter "$flags")
+    check_cpp "$@" <<EOF
+#if !($condition)
+#error "unsatisfied condition: $condition"
+#endif
+EOF
 }
 
-check_lib2(){
-    log check_lib2 "$@"
-    headers="$1"
-    funcs="$2"
-    shift 2
-    check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
+check_lib(){
+    log check_lib "$@"
+    name="$1"
+    headers="$2"
+    funcs="$3"
+    shift 3
+    disable $name
+    check_func_headers "$headers" "$funcs" "$@" &&
+        enable $name && add_extralibs "$@"
 }
 
 check_pkg_config(){
     log check_pkg_config "$@"
-    pkg="$1"
+    pkg_version="$1"
+    pkg="${1%% *}"
     headers="$2"
     funcs="$3"
     shift 3
-    check_cmd $pkg_config --exists --print-errors $pkg || return
+    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 "$@" &&
-        set_safe "${pkg}_cflags" $pkg_cflags   &&
-        set_safe "${pkg}_libs"   $pkg_libs
+        set_safe "${pkg}_cflags"    $pkg_cflags &&
+        set_safe "${pkg}_extralibs" $pkg_libs
 }
 
 check_exec(){
@@ -1019,6 +1035,7 @@ check_exec(){
 }
 
 check_exec_crash(){
+    log check_exec_crash "$@"
     code=$(cat)
 
     # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
@@ -1089,26 +1106,22 @@ check_compile_assert(){
 }
 
 require(){
-    name="$1"
-    header="$2"
-    func="$3"
-    shift 3
-    check_lib $header $func "$@" || die "ERROR: $name not found"
-}
-
-require2(){
-    name="$1"
+    log require "$@"
+    name_version="$1"
+    name="${1%% *}"
     headers="$2"
     func="$3"
     shift 3
-    check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
+    check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not found"
 }
 
 require_pkg_config(){
-    pkg="$1"
-    check_pkg_config "$@" || die "ERROR: $pkg not found"
+    log require_pkg_config "$@"
+    pkg_version="$1"
+    pkg="${1%% *}"
+    check_pkg_config "$@" || die "ERROR: $pkg_version not found"
     add_cflags    $(get_safe "${pkg}_cflags")
-    add_extralibs $(get_safe "${pkg}_libs")
+    add_extralibs $(get_safe "${pkg}_extralibs")
 }
 
 hostcc_e(){
@@ -1135,7 +1148,7 @@ check_host_cpp(){
 
 check_host_cppflags(){
     log check_host_cppflags "$@"
-    check_host_cc "$@" <<EOF && append host_cppflags "$@"
+    check_host_cpp "$@" <<EOF && append host_cppflags "$@"
 int x;
 EOF
 }
@@ -1168,9 +1181,9 @@ apply(){
 }
 
 cp_if_changed(){
-    cmp -s "$1" "$2" && echo "$2 is unchanged" && return
+    cmp -s "$1" "$2" && { test "$quiet" != "yes" && echo "$2 is unchanged"; } && return
     mkdir -p "$(dirname $2)"
-    $cp_f "$1" "$2"
+    cp -f "$1" "$2"
 }
 
 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
@@ -1210,7 +1223,10 @@ COMPONENT_LIST="
 "
 
 EXAMPLE_LIST="
-    avcodec_example
+    decode_audio_example
+    decode_video_example
+    encode_audio_example
+    encode_video_example
     filter_audio_example
     metadata_example
     output_example
@@ -1261,6 +1277,7 @@ EXTERNAL_LIBRARY_LIST="
     $EXTERNAL_LIBRARY_NONFREE_LIST
     $EXTERNAL_LIBRARY_VERSION3_LIST
     avisynth
+    avxsynth
     bzlib
     frei0r
     gnutls
@@ -1270,6 +1287,7 @@ EXTERNAL_LIBRARY_LIST="
     libfontconfig
     libfreetype
     libgsm
+    libhdcd
     libilbc
     libkvazaar
     libmp3lame
@@ -1342,8 +1360,8 @@ SUBSYSTEM_LIST="
     rdft
 "
 
+# COMPONENT_LIST needs to come last to ensure correct dependency checking
 CONFIG_LIST="
-    $COMPONENT_LIST
     $EXAMPLE_LIST
     $EXTERNAL_LIBRARY_LIST
     $HWACCEL_LIBRARY_LIST
@@ -1352,7 +1370,6 @@ CONFIG_LIST="
     $LIBRARY_LIST
     $PROGRAM_LIST
     $SUBSYSTEM_LIST
-    memalign_hack
     neon_clobber_test
     pic
     pod2man
@@ -1360,6 +1377,7 @@ CONFIG_LIST="
     thumb
     valgrind_backtrace
     xmm_clobber_test
+    $COMPONENT_LIST
 "
 
 THREADS_LIST="
@@ -1468,7 +1486,9 @@ ARCH_FEATURES="
     fast_cmov
     local_aligned_8
     local_aligned_16
+    local_aligned_32
     simd_align_16
+    simd_align_32
 "
 
 BUILTIN_LIST="
@@ -1498,6 +1518,7 @@ HEADERS_LIST="
     arpa_inet_h
     cdio_paranoia_h
     cdio_paranoia_paranoia_h
+    d3d11_h
     dispatch_dispatch_h
     dev_bktr_ioctl_bt848_h
     dev_bktr_ioctl_meteor_h
@@ -1506,7 +1527,6 @@ HEADERS_LIST="
     dev_video_meteor_ioctl_meteor_h
     direct_h
     dlfcn_h
-    d3d11_h
     dxva_h
     gsm_h
     io_h
@@ -1517,6 +1537,7 @@ HEADERS_LIST="
     poll_h
     sndio_h
     soundcard_h
+    stdatomic_h
     sys_mman_h
     sys_param_h
     sys_resource_h
@@ -1649,7 +1670,6 @@ HAVE_LIST="
     $(add_suffix _external $ARCH_EXT_LIST)
     $(add_suffix _inline   $ARCH_EXT_LIST)
     $ARCH_FEATURES
-    $ATOMICS_LIST
     $BUILTIN_LIST
     $HAVE_LIST_CMDLINE
     $HAVE_LIST_PUB
@@ -1660,12 +1680,9 @@ HAVE_LIST="
     $THREADS_LIST
     $TOOLCHAIN_FEATURES
     $TYPES_LIST
-    atomics_native
     dos_paths
     dxva2_lib
     libc_msvcrt
-    libdc1394_1
-    libdc1394_2
     MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS
     sdl
     section_data_rel_ro
@@ -1673,7 +1690,6 @@ HAVE_LIST="
     vaapi_drm
     vaapi_x11
     vdpau_x11
-    xlib
 "
 
 # options emitted with CONFIG_ prefix but not available on the command line
@@ -1693,7 +1709,6 @@ CONFIG_EXTRA="
     flacdsp
     fmtconvert
     g722dsp
-    gcrypt
     gmp
     golomb
     gplv3
@@ -1703,6 +1718,7 @@ CONFIG_EXTRA="
     h264parse
     h264pred
     h264qpel
+    hevc_ps
     hpeldsp
     huffman
     huffyuvdsp
@@ -1722,6 +1738,7 @@ CONFIG_EXTRA="
     mpeg_er
     mpegaudio
     mpegaudiodsp
+    mpegaudioheader
     mpegvideo
     mpegvideoenc
     mss34dsp
@@ -1784,7 +1801,6 @@ CMDLINE_SET="
     ar
     arch
     as
-    build_suffix
     cc
     objcc
     cpu
@@ -1795,9 +1811,9 @@ CMDLINE_SET="
     extra_version
     host_cc
     host_cflags
+    host_extralibs
     host_ld
     host_ldflags
-    host_libs
     host_os
     ld
     logfile
@@ -1880,6 +1896,7 @@ fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
 fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
 fast_unaligned_if_any="aarch64 ppc x86"
 simd_align_16_if_any="altivec neon sse"
+simd_align_32_if_any="avx"
 
 # system capabilities
 symver_if_any="symver_asm_label symver_gnu_asm"
@@ -1900,12 +1917,13 @@ error_resilience_select="me_cmp"
 faandct_deps="faan fdctdsp"
 faanidct_deps="faan idctdsp"
 h264dsp_select="startcode"
+hevc_ps_select="golomb"
 intrax8_select="blockdsp idctdsp"
 mdct_select="fft"
 rdft_select="fft"
 me_cmp_select="fdctdsp idctdsp pixblockdsp"
 mpeg_er_select="error_resilience"
-mpegaudio_select="mpegaudiodsp"
+mpegaudio_select="mpegaudiodsp mpegaudioheader"
 mpegaudiodsp_select="dct"
 mpegvideo_select="blockdsp hpeldsp idctdsp me_cmp mpeg_er videodsp"
 mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
@@ -1957,13 +1975,13 @@ eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
 eatgq_decoder_select="aandcttables idctdsp"
 eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
 exr_decoder_deps="zlib"
-ffv1_decoder_select="golomb rangecoder"
+ffv1_decoder_select="rangecoder"
 ffv1_encoder_select="rangecoder"
 ffvhuff_decoder_select="huffyuv_decoder"
 ffvhuff_encoder_select="huffyuv_encoder"
 fic_decoder_select="golomb"
-flac_decoder_select="flacdsp golomb"
-flac_encoder_select="bswapdsp flacdsp golomb lpc"
+flac_decoder_select="flacdsp"
+flac_encoder_select="bswapdsp flacdsp lpc"
 flashsv_decoder_deps="zlib"
 flashsv_encoder_deps="zlib"
 flashsv2_decoder_deps="zlib"
@@ -1984,7 +2002,7 @@ h264_decoder_suggest="error_resilience"
 hap_decoder_select="snappy texturedsp"
 hap_encoder_deps="libsnappy"
 hap_encoder_select="texturedspenc"
-hevc_decoder_select="bswapdsp cabac golomb videodsp"
+hevc_decoder_select="bswapdsp cabac hevc_ps videodsp"
 huffyuv_decoder_select="bswapdsp huffyuvdsp"
 huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp"
 iac_decoder_select="imc_decoder"
@@ -1993,12 +2011,10 @@ indeo3_decoder_select="hpeldsp"
 indeo4_decoder_select="ividsp"
 indeo5_decoder_select="ividsp"
 interplay_video_decoder_select="hpeldsp"
-jpegls_decoder_select="golomb mjpeg_decoder"
-jpegls_encoder_select="golomb"
+jpegls_decoder_select="mjpeg_decoder"
 jv_decoder_select="blockdsp"
 lagarith_decoder_select="huffyuvdsp"
 ljpeg_encoder_select="aandcttables idctdsp jpegtables"
-loco_decoder_select="golomb"
 magicyuv_decoder_select="huffyuvdsp"
 mdec_decoder_select="blockdsp idctdsp mpegvideo"
 metasound_decoder_select="lsp mdct sinewin"
@@ -2006,8 +2022,6 @@ mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
 mjpeg_decoder_select="blockdsp hpeldsp idctdsp jpegtables"
 mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
 mjpegb_decoder_select="mjpeg_decoder"
-mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
-mjpeg_vaapi_encoder_select="vaapi_encode jpegtables"
 mlp_decoder_select="mlp_parser"
 motionpixels_decoder_select="bswapdsp"
 mp1_decoder_select="mpegaudio"
@@ -2036,7 +2050,7 @@ msmpeg4v2_decoder_select="h263_decoder"
 msmpeg4v2_encoder_select="h263_encoder"
 msmpeg4v3_decoder_select="h263_decoder"
 msmpeg4v3_encoder_select="h263_encoder"
-mss2_decoder_select="error_resilience mpeg_er mpegvideo vc1_decoder"
+mss2_decoder_select="error_resilience mpeg_er mpegvideo qpeldsp vc1_decoder"
 mts2_decoder_select="mss34dsp"
 mxpeg_decoder_select="mjpeg_decoder"
 nellymoser_decoder_select="mdct sinewin"
@@ -2062,7 +2076,6 @@ 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"
-shorten_decoder_select="golomb"
 sipr_decoder_select="lsp"
 sp5x_decoder_select="mjpeg_decoder"
 svq1_decoder_select="hpeldsp"
@@ -2096,7 +2109,7 @@ vp6a_decoder_select="vp6_decoder"
 vp6f_decoder_select="vp6_decoder"
 vp7_decoder_select="h264pred videodsp vp8dsp"
 vp8_decoder_select="h264pred videodsp vp8dsp"
-vp9_decoder_select="videodsp"
+vp9_decoder_select="videodsp vp9_superframe_split_bsf"
 webp_decoder_select="vp8_decoder"
 wmapro_decoder_select="mdct sinewin wma_freqs"
 wmav1_decoder_select="mdct sinewin wma_freqs"
@@ -2119,10 +2132,9 @@ zmbv_encoder_deps="zlib"
 # hardware accelerators
 d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder"
 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
-vaapi_deps="va_va_h"
+dxva2_lib_deps="dxva2"
 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
 vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
-vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
 
 h263_vaapi_hwaccel_deps="vaapi"
 h263_vaapi_hwaccel_select="h263_decoder"
@@ -2130,10 +2142,7 @@ h264_d3d11va_hwaccel_deps="d3d11va"
 h264_d3d11va_hwaccel_select="h264_decoder"
 h264_dxva2_hwaccel_deps="dxva2"
 h264_dxva2_hwaccel_select="h264_decoder"
-h264_mmal_decoder_deps="mmal"
-h264_mmal_decoder_select="mmal"
 h264_mmal_hwaccel_deps="mmal"
-h264_omx_encoder_deps="omx"
 h264_qsv_hwaccel_deps="libmfx"
 h264_vaapi_hwaccel_deps="vaapi"
 h264_vaapi_hwaccel_select="h264_decoder"
@@ -2156,15 +2165,12 @@ mpeg2_d3d11va_hwaccel_deps="d3d11va"
 mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
 mpeg2_dxva2_hwaccel_deps="dxva2"
 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
-mpeg2_mmal_decoder_deps="mmal"
-mpeg2_mmal_decoder_select="mmal"
 mpeg2_mmal_hwaccel_deps="mmal"
 mpeg2_qsv_hwaccel_deps="libmfx"
 mpeg2_vaapi_hwaccel_deps="vaapi"
 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
 mpeg2_vdpau_hwaccel_deps="vdpau"
 mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
-mpeg4_omx_encoder_deps="omx"
 mpeg4_vaapi_hwaccel_deps="vaapi"
 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
 mpeg4_vdpau_hwaccel_deps="vdpau"
@@ -2173,13 +2179,15 @@ vc1_d3d11va_hwaccel_deps="d3d11va"
 vc1_d3d11va_hwaccel_select="vc1_decoder"
 vc1_dxva2_hwaccel_deps="dxva2"
 vc1_dxva2_hwaccel_select="vc1_decoder"
-vc1_mmal_decoder_deps="mmal"
-vc1_mmal_decoder_select="mmal"
 vc1_mmal_hwaccel_deps="mmal"
+vc1_qsv_hwaccel_deps="libmfx"
 vc1_vaapi_hwaccel_deps="vaapi"
 vc1_vaapi_hwaccel_select="vc1_decoder"
 vc1_vdpau_hwaccel_deps="vdpau"
 vc1_vdpau_hwaccel_select="vc1_decoder"
+vp8_qsv_hwaccel_deps="libmfx"
+vp8_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVP8"
+vp8_vaapi_hwaccel_select="vp8_decoder"
 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
@@ -2190,6 +2198,7 @@ nvenc_deps_any="dlopen LoadLibrary"
 nvenc_extralibs='$ldl'
 omx_deps="dlopen pthreads"
 omx_extralibs='$ldl'
+omx_rpi_select="omx"
 qsvdec_select="qsv"
 qsvenc_select="qsv"
 vaapi_encode_deps="vaapi"
@@ -2197,32 +2206,43 @@ vaapi_encode_deps="vaapi"
 hwupload_cuda_filter_deps="cuda"
 scale_npp_filter_deps="cuda libnpp"
 
+h264_mmal_decoder_deps="mmal"
 h264_nvenc_encoder_deps="nvenc"
+h264_omx_encoder_deps="omx"
 h264_qsv_decoder_deps="libmfx"
 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel"
 h264_qsv_encoder_deps="libmfx"
 h264_qsv_encoder_select="qsvenc"
 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
 h264_vaapi_encoder_select="vaapi_encode golomb"
-
 hevc_nvenc_encoder_deps="nvenc"
 hevc_qsv_decoder_deps="libmfx"
-hevc_qsv_encoder_deps="libmfx"
 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser hevc_qsv_hwaccel qsvdec"
-hevc_qsv_encoder_select="qsvenc"
+hevc_qsv_encoder_deps="libmfx"
+hevc_qsv_encoder_select="hevc_ps qsvenc"
 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
 hevc_vaapi_encoder_select="vaapi_encode golomb"
+mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
+mjpeg_vaapi_encoder_select="vaapi_encode jpegtables"
+mpeg2_mmal_decoder_deps="mmal"
 mpeg2_qsv_decoder_deps="libmfx"
 mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel mpegvideo_parser"
 mpeg2_qsv_encoder_deps="libmfx"
 mpeg2_qsv_encoder_select="qsvenc"
+mpeg4_omx_encoder_deps="omx"
+vc1_mmal_decoder_deps="mmal"
+vc1_qsv_decoder_deps="libmfx"
+vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel vc1_parser"
+vp8_qsv_decoder_deps="libmfx"
+vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser"
 
-nvenc_h264_encoder_deps="nvenc"
-nvenc_hevc_encoder_deps="nvenc"
+nvenc_h264_encoder_select="h264_nvenc_encoder"
+nvenc_hevc_encoder_select="hevc_nvenc_encoder"
 
 # parsers
 h264_parser_select="golomb h264dsp h264parse"
-hevc_parser_select="golomb"
+hevc_parser_select="hevc_ps"
+mpegaudio_parser_select="mpegaudioheader"
 mpegvideo_parser_select="mpegvideo"
 mpeg4video_parser_select="error_resilience h263dsp mpegvideo qpeldsp"
 vc1_parser_select="vc1dsp"
@@ -2231,6 +2251,10 @@ vc1_parser_select="vc1dsp"
 mjpeg2jpeg_bsf_select="jpegtables"
 
 # external libraries
+avisynth_deps="LoadLibrary"
+avxsynth_deps="dlopen"
+avisynth_demuxer_deps_any="avisynth avxsynth"
+avisynth_demuxer_select="riffdec"
 libdcadec_decoder_deps="libdcadec"
 libfaac_encoder_deps="libfaac"
 libfaac_encoder_select="audio_frame_queue"
@@ -2245,7 +2269,7 @@ libilbc_decoder_deps="libilbc"
 libilbc_encoder_deps="libilbc"
 libkvazaar_encoder_deps="libkvazaar"
 libmp3lame_encoder_deps="libmp3lame"
-libmp3lame_encoder_select="audio_frame_queue"
+libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
 libopencore_amrnb_decoder_deps="libopencore_amrnb"
 libopencore_amrnb_encoder_deps="libopencore_amrnb"
 libopencore_amrnb_encoder_select="audio_frame_queue"
@@ -2275,12 +2299,13 @@ libvpx_vp8_encoder_deps="libvpx"
 libvpx_vp9_decoder_deps="libvpx"
 libvpx_vp9_encoder_deps="libvpx"
 libwavpack_encoder_deps="libwavpack"
+libwavpack_encoder_select="audio_frame_queue"
 libwebp_encoder_deps="libwebp"
 libx262_encoder_deps="libx262"
 libx264_encoder_deps="libx264"
 libx265_encoder_deps="libx265"
 libxavs_encoder_deps="libxavs"
-libxvid_encoder_deps="libxvid"
+libxvid_encoder_deps="libxvid mkstemp"
 
 # demuxers / muxers
 ac3_demuxer_select="ac3_parser"
@@ -2289,8 +2314,6 @@ asf_muxer_select="riffenc"
 asf_stream_muxer_select="asf_muxer"
 avi_demuxer_select="iso_media riffdec"
 avi_muxer_select="riffenc"
-avisynth_demuxer_deps="avisynth"
-avisynth_demuxer_select="riffdec"
 caf_demuxer_select="iso_media riffdec"
 dash_muxer_select="mp4_muxer"
 dirac_demuxer_select="dirac_parser"
@@ -2313,6 +2336,7 @@ mov_demuxer_select="iso_media riffdec"
 mov_demuxer_suggest="zlib"
 mov_muxer_select="iso_media riffenc rtpenc_chain"
 mp3_demuxer_select="mpegaudio_parser"
+mp3_muxer_select="mpegaudioheader"
 mp4_muxer_select="mov_muxer"
 mpegts_demuxer_select="iso_media"
 mpegts_muxer_select="adts_muxer latm_muxer"
@@ -2348,30 +2372,30 @@ xmv_demuxer_select="riffdec"
 xwma_demuxer_select="riffdec"
 
 # indevs / outdevs
-alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
-alsa_outdev_deps="alsa_asoundlib_h"
-avfoundation_indev_deps="AVFoundation_AVFoundation_h"
+alsa_indev_deps="alsa"
+alsa_outdev_deps="alsa"
+avfoundation_indev_deps="AVFoundation_AVFoundation_h objc_arc pthreads"
+avfoundation_indev_extralibs="-framework Foundation -framework AVFoundation -framework CoreVideo -framework CoreMedia"
 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"
-jack_indev_deps="jack_jack_h"
+jack_indev_deps="jack"
 jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
 libcdio_indev_deps="libcdio"
 libdc1394_indev_deps="libdc1394"
 oss_indev_deps_any="soundcard_h sys_soundcard_h"
 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
 pulse_indev_deps="libpulse"
-sndio_indev_deps="sndio_h"
-sndio_outdev_deps="sndio_h"
+sndio_indev_deps="sndio"
+sndio_outdev_deps="sndio"
 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
-vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
-vfwcap_indev_extralibs="-lavicap32"
-x11grab_xcb_indev_deps="libxcb"
+vfwcap_indev_deps="vfw32 vfwcap_defines"
+xcbgrab_indev_deps="libxcb"
 
 # protocols
 ffrtmpcrypt_protocol_deps="!librtmp_protocol"
-ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
+ffrtmpcrypt_protocol_deps_any="gmp openssl"
 ffrtmpcrypt_protocol_select="tcp_protocol"
 ffrtmphttp_protocol_deps="!librtmp_protocol"
 ffrtmphttp_protocol_select="http_protocol"
@@ -2410,19 +2434,23 @@ unix_protocol_deps="sys_un_h"
 unix_protocol_select="network"
 
 # filters
+asyncts_filter_deps="avresample"
 blackframe_filter_deps="gpl"
 boxblur_filter_deps="gpl"
 bs2b_filter_deps="libbs2b"
 cropdetect_filter_deps="gpl"
 deinterlace_qsv_filter_deps="libmfx"
+deinterlace_vaapi_filter_deps="vaapi"
 delogo_filter_deps="gpl"
 drawtext_filter_deps="libfreetype"
 frei0r_filter_deps="frei0r dlopen"
 frei0r_filter_extralibs='$ldl'
 frei0r_src_filter_deps="frei0r dlopen"
 frei0r_src_filter_extralibs='$ldl'
+hdcd_filter_deps="libhdcd"
 hqdn3d_filter_deps="gpl"
 interlace_filter_deps="gpl"
+movie_filter_deps="avcodec avformat"
 ocv_filter_deps="libopencv"
 resample_filter_deps="avresample"
 scale_filter_deps="swscale"
@@ -2430,15 +2458,19 @@ scale_qsv_filter_deps="libmfx"
 scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
 
 # examples
-avcodec_example_deps="avcodec avutil"
+decode_audio_example_deps="avcodec avutil"
+decode_video_example_deps="avcodec avutil"
+encode_audio_example_deps="avcodec avutil"
+encode_video_example_deps="avcodec avutil"
 filter_audio_example_deps="avfilter avutil"
 metadata_example_deps="avformat avutil"
-output_example_deps="avcodec avformat avutil swscale"
-qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
+output_example_deps="avcodec avformat avresample avutil swscale"
+qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
 transcode_aac_example_deps="avcodec avformat avresample"
 
 # libraries, in linking order
 avcodec_deps="avutil"
+avcodec_select="null_bsf"
 avdevice_deps="avformat avcodec avutil"
 avfilter_deps="avutil"
 avformat_deps="avcodec avutil"
@@ -2451,7 +2483,7 @@ avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_fi
                fps_filter null_filter resample_filter scale_filter
                trim_filter"
 avplay_deps="avcodec avfilter avformat avresample sdl"
-avplay_libs='$sdl_libs'
+avplay_extralibs='$sdl_extralibs'
 avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter"
 avprobe_deps="avcodec avformat"
 
@@ -2477,7 +2509,6 @@ shlibdir_default="$libdir_default"
 ar_default="ar"
 cc_default="gcc"
 host_cc_default="gcc"
-cp_f="cp -f"
 ln_s="ln -s -f"
 nm_default="nm -g"
 objformat="elf"
@@ -2516,11 +2547,10 @@ enable d3d11va dxva2 vda vdpau
 SHFLAGS='-shared -Wl,-soname,$$(@F)'
 LIBPREF="lib"
 LIBSUF=".a"
-FULLNAME='$(NAME)$(BUILDSUF)'
-LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
+LIBNAME='$(LIBPREF)$(NAME)$(LIBSUF)'
 SLIBPREF="lib"
 SLIBSUF=".so"
-SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
+SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
@@ -2548,7 +2578,7 @@ HOSTCC_E='-E -o $@'
 HOSTCC_O='-o $@'
 HOSTLD_O='-o $@'
 
-host_libs='-lm'
+host_extralibs='-lm'
 host_cflags_filter=echo
 host_ldflags_filter=echo
 
@@ -2730,6 +2760,8 @@ for opt do
         ;;
         --help|-h) show_help
         ;;
+        --quiet|-q) quiet=yes
+        ;;
         *)
             optname="${opt%%=*}"
             optname="${optname#--}"
@@ -2751,6 +2783,17 @@ done
 
 disabled logging && logfile=/dev/null
 
+# Die early if licensing-related configure options are incompatible.
+die_license_disabled() {
+    enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
+}
+
+map "die_license_disabled gpl"      $EXTERNAL_LIBRARY_GPL_LIST
+map "die_license_disabled nonfree"  $EXTERNAL_LIBRARY_NONFREE_LIST $HWACCEL_LIBRARY_NONFREE_LIST
+map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST
+
+enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
+
 # Disable all the library-specific components if the library itself
 # is disabled, see AVCODEC_LIST and following _LIST variables.
 
@@ -2779,7 +2822,7 @@ case "$toolchain" in
     ;;
     *-tsan)
         cc_default="${toolchain%-tsan}"
-        add_cflags  -fsanitize=thread -pie
+        add_cflags  -fsanitize=thread -fPIE
         add_ldflags -fsanitize=thread -pie
         case "$toolchain" in
             gcc-tsan)
@@ -2867,7 +2910,7 @@ test -n "$cross_prefix" && enable cross_compile
 
 if enabled cross_compile; then
     test -n "$arch" && test -n "$target_os" ||
-        die "Must specify target arch and OS when cross-compiling"
+        die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
 fi
 
 ar_default="${cross_prefix}${ar_default}"
@@ -3006,8 +3049,6 @@ msvc_common_flags(){
             -mthumb)              ;;
             -march=*)             ;;
             -lz)                  echo zlib.lib ;;
-            -lavifil32)           echo vfw32.lib ;;
-            -lavicap32)           echo vfw32.lib user32.lib ;;
             -lx264)               echo libx264.lib ;;
             -l*)                  echo ${flag#-l}.lib ;;
             -L*)                  echo -libpath:${flag#-L} ;;
@@ -3023,7 +3064,7 @@ msvc_flags(){
             -Wall)                echo -W4 -wd4244 -wd4127 -wd4018 -wd4389     \
                                        -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
                                        -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
-                                       -wd4273 -wd4554 -wd4701 ;;
+                                       -wd4273 -wd4554 -wd4701 -wd4703 ;;
         esac
     done
 }
@@ -3240,6 +3281,7 @@ probe_cc(){
         _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
         _cflags_speed="-O2"
         _cflags_size="-O1"
+        _cflags_noopt="-O1"
         if $_cc -nologo- 2>&1 | grep -q Linker; then
             _ld_o='-out:$@'
         else
@@ -3281,7 +3323,7 @@ probe_cc(){
         _type=lld-link
         # The link.exe mode doesn't have a switch for getting the version,
         # but we can force it back to gnu mode and get the version from there.
-        _ident=$($_cc -flavor gnu --version)
+        _ident=$($_cc -flavor gnu --version 2>/dev/null)
         _ld_o='-out:$@'
         _flags_filter=msvc_flags
         _ld_lib='lib%.a'
@@ -3692,7 +3734,15 @@ if test "$?" != 0; then
 fi
 
 add_cppflags -D_ISOC99_SOURCE
-check_cflags -std=c99
+
+# some compilers silently accept -std=c11, so we also need to check that the
+# version macro is defined properly
+if test_cflags_cpp -std=c11 "__STDC_VERSION__ >= 201112L"; then
+    add_cflags -std=c11
+else
+    check_cflags -std=c99
+fi
+
 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
 #include <stdlib.h>
 EOF
@@ -3765,7 +3815,7 @@ case $target_os in
     haiku)
         prefix_default="/boot/common"
         network_extralibs="-lnetwork"
-        host_libs=
+        host_extralibs=
         ;;
     sunos)
         SHFLAGS='-shared -Wl,-h,$$(@F)'
@@ -3810,8 +3860,8 @@ case $target_os in
         enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
         add_ldflags -Wl,-dynamic,-search_paths_first
         SLIBSUF=".dylib"
-        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
-        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
+        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
+        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
         objformat="macho"
         enabled x86_64 && objformat="macho64"
         enabled_any pic shared ||
@@ -3839,8 +3889,8 @@ case $target_os in
         shlibdir_default="$bindir_default"
         SLIBPREF=""
         SLIBSUF=".dll"
-        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
-        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
+        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
+        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
         SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
         SLIB_INSTALL_LINKS=
@@ -3864,8 +3914,8 @@ case $target_os in
         shlibdir_default="$bindir_default"
         SLIBPREF=""
         SLIBSUF=".dll"
-        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
-        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
+        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
+        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
         SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
         SLIB_INSTALL_LINKS=
@@ -3881,12 +3931,12 @@ case $target_os in
         shlibdir_default="$bindir_default"
         SLIBPREF="cyg"
         SLIBSUF=".dll"
-        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
-        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
+        SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
+        SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
         SLIB_INSTALL_LINKS=
-        SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
-        SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
+        SLIB_INSTALL_EXTRA_LIB='lib$(NAME).dll.a'
+        SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(NAME).dll.a'
         objformat="win32"
         enable dos_paths
         ;;
@@ -3951,17 +4001,6 @@ case $target_os in
         ;;
     minix)
         ;;
-    plan9)
-        add_cppflags -D_C99_SNPRINTF_EXTENSION  \
-                     -D_REENTRANT_SOURCE        \
-                     -D_RESEARCH_SOURCE         \
-                     -DFD_SETSIZE=96            \
-                     -DHAVE_SOCK_OPTS
-        add_compat strtod.o strtod=avpriv_strtod
-        network_extralibs='-lbsd'
-        exeobjs=compat/plan9/main.o
-        cp_f='cp'
-        ;;
     none)
         ;;
     *)
@@ -3984,7 +4023,7 @@ probe_libc(){
     # MinGW headers can be installed on Cygwin, so check for newlib first.
     elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
         eval ${pfx}libc_type=newlib
-        add_${pfx}cppflags -U__STRICT_ANSI__
+        add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
     # MinGW64 is backwards compatible with MinGW32, so check for it first.
     elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
         eval ${pfx}libc_type=mingw64
@@ -3998,6 +4037,8 @@ probe_libc(){
             (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
             die "ERROR: MinGW32 runtime version must be >= 3.15."
         add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
+        check_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700__" &&
+            add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
         eval test \$${pfx_no_}cc_type = "gcc" &&
             add_${pfx}cppflags -D__printf__=__gnu_printf__
     elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
@@ -4098,16 +4139,6 @@ EOF
     exit 1
 fi
 
-die_license_disabled() {
-    enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
-}
-
-map "die_license_disabled gpl"      $EXTERNAL_LIBRARY_GPL_LIST
-map "die_license_disabled nonfree"  $EXTERNAL_LIBRARY_NONFREE_LIST $HWACCEL_LIBRARY_NONFREE_LIST
-map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST
-
-enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
-
 disabled optimizations || check_cflags -fomit-frame-pointer
 
 enable_weak_pic() {
@@ -4296,7 +4327,7 @@ elif enabled parisc; then
 
 elif enabled ppc; then
 
-    enable local_aligned_8 local_aligned_16
+    enable local_aligned_8 local_aligned_16 local_aligned_32
 
     check_inline_asm dcbzl     '"dcbzl 0, %0" :: "r"(0)'
     check_inline_asm ibm_asm   '"add 0, 0, 0"'
@@ -4337,7 +4368,7 @@ elif enabled x86; then
     check_builtin rdtsc    intrin.h   "__rdtsc()"
     check_builtin mm_empty mmintrin.h "_mm_empty()"
 
-    enable local_aligned_8 local_aligned_16
+    enable local_aligned_8 local_aligned_16 local_aligned_32
 
     # check whether EBP is available on x86
     # As 'i' is stored on the stack, this program will crash
@@ -4464,7 +4495,8 @@ check_func  ${malloc_prefix}memalign            && enable memalign
 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_func_headers time.h clock_gettime -lrt && add_extralibs -lrt && LIBRT="-lrt"; }
+    check_func_headers time.h clock_gettime ||
+        { check_lib clock_gettime time.h clock_gettime -lrt && LIBRT="-lrt"; }
 
 check_func  fcntl
 check_func  fork
@@ -4480,7 +4512,7 @@ check_func  mkstemp
 check_func  mmap
 check_func  mprotect
 # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
-check_func_headers time.h nanosleep || { check_func_headers time.h nanosleep -lrt && add_extralibs -lrt; }
+check_func_headers time.h nanosleep || check_lib nanosleep time.h nanosleep -lrt
 check_func  sched_getaffinity
 check_func  setrlimit
 check_func  strerror_r
@@ -4491,7 +4523,6 @@ check_func  usleep
 check_func_headers io.h setmode
 check_func_headers stdlib.h getenv
 
-check_func_headers windows.h CoTaskMemFree -lole32
 check_func_headers windows.h GetProcessAffinityMask
 check_func_headers windows.h GetProcessTimes
 check_func_headers windows.h GetSystemTimeAsFileTime
@@ -4502,9 +4533,9 @@ check_func_headers windows.h Sleep
 check_func_headers windows.h VirtualAlloc
 check_struct windows.h "CONDITION_VARIABLE" Ptr
 
+check_header d3d11.h
 check_header direct.h
 check_header dlfcn.h
-check_header d3d11.h
 check_header dxva.h
 check_header dxva2api.h
 check_header io.h
@@ -4519,15 +4550,18 @@ check_header sys/time.h
 check_header sys/un.h
 check_header unistd.h
 check_header valgrind/valgrind.h
-check_header vdpau/vdpau.h
-check_header vdpau/vdpau_x11.h
 check_header VideoDecodeAcceleration/VDADecoder.h
 check_header windows.h
 check_header X11/extensions/XvMClib.h
 
-check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
-check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
-check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
+# it seems there are versions of clang in some distros that try to use the
+# gcc headers, which explodes for stdatomic
+# so we also check that atomics actually work here
+check_builtin stdatomic_h stdatomic.h "atomic_int foo; atomic_store(&foo, 0)"
+
+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
 
@@ -4535,6 +4569,7 @@ check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMIL
 check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
 check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
 
+check_type "va/va.h va/va_dec_vp8.h" "VAPictureParameterBufferVP8"
 check_type "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer"
 check_type "va/va.h va/va_enc_h264.h" "VAEncPictureParameterBufferH264"
 check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
@@ -4543,62 +4578,58 @@ check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
 check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
 
 if ! disabled w32threads && ! enabled pthreads; then
-    check_func_headers "windows.h process.h" _beginthreadex &&
-        enable w32threads || disable w32threads
+    check_lib w32threads "windows.h process.h" _beginthreadex
 fi
 
 # check for some common methods of building with pthread support
 # do this before the optional library checks as some of them require pthreads
 if ! disabled pthreads && ! enabled w32threads; then
-    enable pthreads
-    if check_func pthread_join -pthread; then
+    if check_lib pthreads pthread.h pthread_join -pthread; then
         add_cflags -pthread
-        add_extralibs -pthread
-    elif check_func pthread_join -pthreads; then
+    elif check_lib pthreads pthread.h pthread_join -pthreads; then
         add_cflags -pthreads
-        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 pthreads pthread.h pthread_join -lpthreadGC2; then
+        :
+    elif check_lib pthreads pthread.h pthread_join -lpthread; then
         :
-    elif check_func pthread_join; then
-        disable pthreads
+    elif check_func pthread_join; then
+        enable pthreads
     fi
 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_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
+disabled  zlib || check_lib  zlib  zlib.h      zlibVersion -lz
+disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
 
-check_lib math.h sin -lm && LIBM="-lm"
-enabled vaapi && require vaapi va/va.h vaInitialize -lva
+check_lib libm math.h sin -lm && LIBM="-lm"
 
 atan2f_args=2
 ldexpf_args=2
 powf_args=2
 
 for func in $MATH_FUNCS; do
-    eval check_mathfunc $func \${${func}_args:-1}
+    eval check_mathfunc $func \${${func}_args:-1} $LIBM
 done
 
 # these are off by default, so fail if requested and not available
-enabled avisynth          && { check_lib2 "avisynth/avisynth_c.h windows.h" LoadLibrary ||
-                               check_lib2 "avxsynth/avxsynth_c.h dlfcn.h" dlopen -ldl   ||
-                               die "ERROR: LoadLibrary/dlopen not found, or avisynth header not found"; }
-enabled cuda              && check_lib cuda.h cuInit -lcuda
+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 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
 enabled libbs2b           && require_pkg_config libbs2b bs2b.h bs2b_open
+enabled libdc1394         && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new
 enabled libdcadec         && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec
-enabled libfaac           && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
+enabled libfaac           && require libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
 enabled libfdk_aac        && require_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen
 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
 enabled libkvazaar        && require_pkg_config "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
 enabled libmfx            && require_pkg_config libmfx "mfx/mfxvideo.h" MFXInit
@@ -4608,13 +4639,13 @@ 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_header openjpeg.h && check_lib2 openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC; } ||
-                               { require_pkg_config libopenjpeg1 openjpeg.h opj_version -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
 enabled librtmp           && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
 enabled libschroedinger   && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
-enabled libsnappy         && require snappy snappy-c.h snappy_compress -lsnappy
+enabled libsnappy         && require libsnappy snappy-c.h snappy_compress -lsnappy
 enabled libspeex          && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex
 enabled libtheora         && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
 enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame
@@ -4652,42 +4683,28 @@ enabled libx264           && require_pkg_config x264 "stdint.h x264.h" x264_enco
 enabled libx265           && require_pkg_config x265 x265.h x265_api_get &&
                              { check_cpp_condition x265.h "X265_BUILD >= 57" ||
                                die "ERROR: libx265 version must be >= 57."; }
-enabled libxavs           && require libxavs xavs.h xavs_encoder_encode -lxavs
+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 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 ; } ||
-                               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
-enabled omx               && { check_header OMX_Core.h ||
-                                { ! enabled cross_compile && enabled omx_rpi && {
-                                    add_cflags -isystem/opt/vc/include/IL ; }
-                                check_header OMX_Core.h ; } ||
+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_ldflags -L/opt/vc/lib/ &&
+                                 check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
+                               die "ERROR: mmal not found" &&
+                               check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
+enabled omx_rpi           && { check_header OMX_Core.h ||
+                               { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
                                die "ERROR: OpenMAX IL headers not found"; }
-enabled openssl           && { 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 ||
+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_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"; }
 
-if enabled gnutls; then
-    { check_lib2 gmp.h mpz_export -lgmp && enable gmp; } ||
-    { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
-fi
-
-# 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 &&
-        enable libdc1394_1; } ||
-    die "ERROR: No version of libdc1394 found "
-fi
+enabled gnutls            && check_lib gmp gmp.h mpz_export -lgmp
 
 if enabled nvenc; then
     check_header nvEncodeAPI.h || die "ERROR: nvEncodeAPI.h not found."
@@ -4701,21 +4718,19 @@ if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
     enable sdl
 fi
 
-pod2man --help     > /dev/null 2>&1 && enable pod2man   || disable pod2man
-texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
+! disabled pod2man   && check_cmd pod2man --help     && enable pod2man   || disable pod2man
+! disabled texi2html && check_cmd texi2html -version && enable texi2html || disable texi2html
 
 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_objcflags -fobjc-arc &&
-    add_extralibs -framework Foundation -framework AVFoundation -framework CoreVideo -framework CoreMedia ||
-    disable AVFoundation_AVFoundation_h
+check_header AVFoundation/AVFoundation.h
 
 check_header sys/videoio.h
 
-check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
+check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
+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
@@ -4729,26 +4744,23 @@ check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_def
   check_header dev/video/bktr/ioctl_bt848.h; } ||
 check_header dev/ic/bt8xx.h
 
-check_header sndio.h
 check_header sys/soundcard.h
 check_header soundcard.h
 
 enabled_any alsa_indev alsa_outdev &&
-    check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
+    check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
 
-enabled jack_indev && check_lib2 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_lib2 sndio.h sio_open -lsndio
+enabled_any sndio_indev sndio_outdev && check_lib sndio sndio.h sio_open -lsndio
 
 if enabled libcdio; then
-    check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
-    check_lib2 "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
 
-check_lib X11/Xlib.h XOpenDisplay -lX11 && enable xlib
-
 if enabled libxcb; then
     check_pkg_config xcb-shape xcb/shape.h xcb_shape_rectangles || {
         enabled libxcb && die "ERROR: libxcb not found";
@@ -4764,30 +4776,31 @@ if enabled libxcb; then
             enabled libxcb_xfixes && die "ERROR: libxcb_xfixes not found";
         } && enable libxcb_xfixes
 
-    add_cflags "$xcb_event_cflags $xcb_shm_cflags $xcb_xfixes_cflags"
-    add_extralibs "$xcb_event_libs $xcb_shm_libs $xcb_xfixes_libs"
+    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 &&
+    check_lib dxva2_lib windows.h CoTaskMemFree -lole32
+
+enabled vaapi && require vaapi va/va.h vaInitialize -lva
+
 enabled vaapi &&
     check_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" ||
     disable vaapi
 
-if enabled vaapi ; then
-    enabled xlib &&
-    check_lib2 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 &&
-    enable vaapi_x11
+enabled vaapi &&
+    check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm
 
-    check_lib2 "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm &&
-    enable vaapi_drm
-fi
+enabled vaapi &&
+    check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11
 
 enabled vdpau &&
     check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
     disable vdpau
 
-enabled vdpau && enabled xlib &&
-    check_lib2 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
-    enable vdpau_x11
+enabled vdpau &&
+    check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
 
 enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
 
@@ -4802,8 +4815,12 @@ check_cflags -Wtype-limits
 check_cflags -Wundef
 check_cflags -Wmissing-prototypes
 check_cflags -Wstrict-prototypes
-enabled extra_warnings && check_cflags -Winline
-enabled extra_warnings && check_cflags -Wcast-qual
+
+if enabled extra_warnings; then
+    check_cflags -Wcast-qual
+    check_cflags -Wextra
+    check_cflags -Wpedantic
+fi
 
 check_disable_warning(){
     warning_flag=-W${1#-Wno-}
@@ -4815,6 +4832,16 @@ check_disable_warning -Wno-switch
 check_disable_warning -Wno-format-zero-length
 check_disable_warning -Wno-pointer-sign
 
+check_disable_warning_headers(){
+    warning_flag=-W${1#-Wno-}
+    test_cflags $warning_flag && add_cflags_headers $1
+}
+
+check_disable_warning_headers -Wno-deprecated-declarations
+check_disable_warning_headers -Wno-unused-variable
+
+check_objcflags -fobjc-arc && enable objc_arc
+
 # add some linker flags
 check_ldflags -Wl,--warn-common
 check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
@@ -4833,6 +4860,10 @@ enabled neon_clobber_test &&
                   -Wl,--wrap,avcodec_encode_audio2      \
                   -Wl,--wrap,avcodec_encode_video2      \
                   -Wl,--wrap,avcodec_encode_subtitle    \
+                  -Wl,--wrap,avcodec_send_packet        \
+                  -Wl,--wrap,avcodec_receive_packet     \
+                  -Wl,--wrap,avcodec_send_frame         \
+                  -Wl,--wrap,avcodec_receive_frame      \
                   -Wl,--wrap,avresample_convert ||
     disable neon_clobber_test
 
@@ -4844,6 +4875,10 @@ enabled xmm_clobber_test &&
                   -Wl,--wrap,avcodec_encode_audio2      \
                   -Wl,--wrap,avcodec_encode_video2      \
                   -Wl,--wrap,avcodec_encode_subtitle    \
+                  -Wl,--wrap,avcodec_send_packet        \
+                  -Wl,--wrap,avcodec_receive_packet     \
+                  -Wl,--wrap,avcodec_send_frame         \
+                  -Wl,--wrap,avcodec_receive_frame      \
                   -Wl,--wrap,avresample_convert         \
                   -Wl,--wrap,sws_scale ||
     disable xmm_clobber_test
@@ -5014,9 +5049,6 @@ case $target_os in
     osf1)
         enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
     ;;
-    plan9)
-        add_cppflags -Dmain=plan9_main
-    ;;
 esac
 
 enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
@@ -5026,13 +5058,6 @@ check_deps $CONFIG_LIST       \
            $HAVE_LIST         \
            $ALL_COMPONENTS    \
 
-enabled_all dxva2 CoTaskMemFree &&
-    prepend avconv_libs $($ldflags_filter "-lole32") &&
-    enable dxva2_lib
-
-! enabled_any memalign posix_memalign aligned_malloc &&
-    enabled simd_align_16 && enable memalign_hack
-
 map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
 
 for thread in $THREADS_LIST; do
@@ -5043,11 +5068,28 @@ for thread in $THREADS_LIST; do
     fi
 done
 
+if disabled stdatomic_h; then
+    if enabled atomics_gcc; then
+        add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc'
+    elif enabled atomics_win32; then
+        add_cppflags '-I\$(SRC_PATH)/compat/atomics/win32'
+    elif enabled atomics_suncc; then
+        add_cppflags '-I\$(SRC_PATH)/compat/atomics/suncc'
+    elif enabled pthreads; then
+        add_compat atomics/pthread/stdatomic.o
+        add_cppflags '-I\$(SRC_PATH)/compat/atomics/pthread'
+    else
+        enabled threads && die "Threading is enabled, but no atomics are available"
+        add_cppflags '-I\$(SRC_PATH)/compat/atomics/dummy'
+    fi
+fi
+
 enabled zlib && add_cppflags -DZLIB_CONST
 
 # conditional library dependencies, in linking order
 enabled movie_filter    && prepend avfilter_deps "avformat avcodec"
-enabled resample_filter && prepend avfilter_deps "avresample"
+enabled_any asyncts_filter resample_filter &&
+                           prepend avfilter_deps "avresample"
 enabled scale_filter    && prepend avfilter_deps "swscale"
 
 enabled opus_decoder    && prepend avcodec_deps "avresample"
@@ -5061,6 +5103,8 @@ expand_deps(){
 
 map 'expand_deps $v' $LIBRARY_LIST
 
+if test "$quiet" != "yes"; then
+
 echo "install prefix            $prefix"
 echo "source path               $source_path"
 echo "C compiler                $cc"
@@ -5070,9 +5114,6 @@ if test "$host_cc" != "$cc"; then
     echo "host C library            $host_libc_type"
 fi
 echo "ARCH                      $arch ($cpu)"
-if test "$build_suffix" != ""; then
-    echo "build suffix              $build_suffix"
-fi
 if test "$extra_version" != ""; then
     echo "version string suffix     $extra_version"
 fi
@@ -5118,11 +5159,9 @@ echo "optimize for size         ${small-no}"
 echo "optimizations             ${optimizations-no}"
 echo "static                    ${static-no}"
 echo "shared                    ${shared-no}"
-echo "new filter support        ${avfilter-no}"
 echo "network support           ${network-no}"
 echo "threading support         ${thread_type-no}"
 echo "safe bitstream reader     ${safe_bitstream_reader-no}"
-echo "SDL support               ${sdl-no}"
 test -n "$random_seed" &&
     echo "random seed               ${random_seed}"
 echo
@@ -5138,6 +5177,10 @@ echo "Libraries:"
 print_enabled '' $LIBRARY_LIST | print_3_columns
 echo
 
+echo "Programs:"
+print_enabled '' $PROGRAM_LIST | print_3_columns
+echo
+
 for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
     echo "Enabled ${type}s:"
     eval list=\$$(toupper $type)_LIST
@@ -5158,7 +5201,9 @@ fi
 
 echo "License: $license"
 
-echo "Creating config.mak and config.h..."
+echo "Creating configuration files ..."
+
+fi # test "$quiet" != "yes"
 
 test -e Makefile || echo "include $source_path/Makefile" > Makefile
 
@@ -5217,8 +5262,6 @@ LDEXEFLAGS=$LDEXEFLAGS
 SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
 STRIPFLAGS=$STRIPFLAGS
 YASMFLAGS=$YASMFLAGS
-BUILDSUF=$build_suffix
-FULLNAME=$FULLNAME
 LIBPREF=$LIBPREF
 LIBSUF=$LIBSUF
 LIBNAME=$LIBNAME
@@ -5238,7 +5281,7 @@ HOSTCFLAGS=$host_cflags
 HOSTCPPFLAGS=$host_cppflags
 HOSTEXESUF=$HOSTEXESUF
 HOSTLDFLAGS=$host_ldflags
-HOSTLIBS=$host_libs
+HOSTEXTRALIBS=$host_extralibs
 DEPHOSTCC=$host_cc
 DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
 HOSTCCDEP=$HOSTCCDEP
@@ -5251,11 +5294,11 @@ TARGET_EXEC=$target_exec $target_exec_args
 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
-EXEOBJS=$exeobjs
 INSTALL=install
 LIBTARGET=${LIBTARGET}
 SLIBNAME=${SLIBNAME}
@@ -5286,12 +5329,12 @@ 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
+print_program_extralibs(){
+    eval "program_extralibs=\$${1}_extralibs"
+    eval echo "EXTRALIBS-${1}=${program_extralibs}" >> config.mak
 }
 
-map 'print_program_libs $v' $PROGRAM_LIST
+map 'print_program_extralibs $v' $PROGRAM_LIST
 
 cat > $TMPH <<EOF
 /* Automatically generated by configure - do not modify! */
@@ -5343,8 +5386,6 @@ echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
 
 cp_if_changed $TMPH libavutil/avconfig.h
 
-test -n "$WARNINGS" && printf "\n$WARNINGS"
-
 # generate the lists of enabled components
 print_enabled_components(){
     file=$1
@@ -5362,6 +5403,8 @@ print_enabled_components(){
 print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
 print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
 
+test -n "$WARNINGS" && printf "\n$WARNINGS"
+
 # build pkg-config files
 
 lib_version(){
@@ -5370,7 +5413,7 @@ lib_version(){
 
 pkgconfig_generate(){
     name=$1
-    shortname=${name#lib}${build_suffix}
+    shortname=${name#lib}
     comment=$2
     version=$3
     libs=$4