[FFmpeg-cvslog] Merge commit 'ee480790c7eeb03c9cebd8971c46e0cb7db65277'

Clément Bœsch git at videolan.org
Wed Apr 26 18:16:23 EEST 2017


ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Wed Apr 26 16:57:11 2017 +0200| [7e503828b03804f90733c306154c293cbd15102e] | committer: Clément Bœsch

Merge commit 'ee480790c7eeb03c9cebd8971c46e0cb7db65277'

* commit 'ee480790c7eeb03c9cebd8971c46e0cb7db65277':
  build: Add name parameter to check_lib() helper function

Merged-by: Clément Bœsch <u at pkh.me>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e503828b03804f90733c306154c293cbd15102e
---

 configure | 153 ++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 75 insertions(+), 78 deletions(-)

diff --git a/configure b/configure
index fe97712375..b3cb5b0c1e 100755
--- a/configure
+++ b/configure
@@ -1223,10 +1223,13 @@ EOF
 
 check_lib(){
     log check_lib "$@"
-    headers="$1"
-    funcs="$2"
-    shift 2
-    check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
+    name="$1"
+    headers="$2"
+    funcs="$3"
+    shift 3
+    disable $name
+    check_func_headers "$headers" "$funcs" "$@" &&
+        enable $name && add_extralibs "$@"
 }
 
 check_lib_cpp(){
@@ -1330,10 +1333,11 @@ check_compile_assert(){
 require(){
     log require "$@"
     name_version="$1"
+    name="${1%% *}"
     headers="$2"
     func="$3"
     shift 3
-    check_lib "$headers" $func "$@" || die "ERROR: $name_version not found"
+    check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not found"
 }
 
 require_cpp(){
@@ -3016,7 +3020,7 @@ sndio_outdev_deps="sndio"
 v4l_indev_deps="linux_videodev_h"
 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
 v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
-vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
+vfwcap_indev_deps="vfw32 vfwcap_defines"
 xcbgrab_indev_deps="libxcb"
 xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
 xv_outdev_extralibs="-lXv -lX11 -lXext"
@@ -5572,7 +5576,7 @@ check_func  ${malloc_prefix}posix_memalign      && enable posix_memalign
 check_func  access
 check_func_headers stdlib.h arc4random
 check_func_headers time.h clock_gettime ||
-    { check_lib time.h clock_gettime -lrt && LIBRT="-lrt"; }
+    { check_lib clock_gettime time.h clock_gettime -lrt && LIBRT="-lrt"; }
 check_func  fcntl
 check_func  fork
 check_func  gethrtime
@@ -5586,7 +5590,7 @@ check_func  mmap
 check_func  mprotect
 # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
 check_func_headers time.h nanosleep ||
-    { check_lib time.h nanosleep -lrt && LIBRT="-lrt"; }
+    { check_lib nanosleep time.h nanosleep -lrt && LIBRT="-lrt"; }
 check_func  sched_getaffinity
 check_func  setrlimit
 check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
@@ -5651,11 +5655,11 @@ check_header asm/types.h
 # so we also check that atomics actually work here
 check_builtin stdatomic_h stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0)"
 
-check_lib "windows.h shellapi.h" CommandLineToArgvW   -lshell32
-check_lib "windows.h wincrypt.h" CryptGenRandom       -ladvapi32
-check_lib "windows.h psapi.h"    GetProcessMemoryInfo -lpsapi
+check_lib shell32  "windows.h shellapi.h" CommandLineToArgvW   -lshell32
+check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom       -ladvapi32
+check_lib psapi    "windows.h psapi.h"    GetProcessMemoryInfo -lpsapi
 
-check_lib "CoreServices/CoreServices.h" UTGetOSTypeFromString "-framework CoreServices"
+check_lib coreservices "CoreServices/CoreServices.h" UTGetOSTypeFromString "-framework CoreServices"
 
 check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
 
@@ -5690,22 +5694,23 @@ 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 && ! enabled os2threads; then
-    enable pthreads
-    if check_func pthread_join -pthread && check_func pthread_create -pthread; then
+    if check_lib pthreads pthread.h pthread_join   -pthread &&
+       check_lib pthreads pthread.h pthread_create -pthread; then
         add_cflags -pthread
-        add_extralibs -pthread
-    elif check_func pthread_join -pthreads && check_func pthread_create -pthreads; then
+    elif check_lib pthreads pthread.h pthread_join   -pthreads &&
+         check_lib pthreads pthread.h pthread_create -pthreads; then
         add_cflags -pthreads
-        add_extralibs -pthreads
-    elif check_func pthread_join -ldl -pthread && check_func pthread_create -ldl -pthread; then
+    elif check_lib pthreads pthread.h pthread_join   -ldl -pthread &&
+         check_lib pthreads pthread.h pthread_create -ldl -pthread; then
         add_cflags -ldl -pthread
-        add_extralibs -ldl -pthread
-    elif check_func pthread_join -lpthreadGC2 && check_func pthread_create -lpthreadGC2; then
-        add_extralibs -lpthreadGC2
-    elif check_lib pthread.h pthread_join -lpthread && check_lib pthread.h pthread_create -lpthread; then
+    elif check_lib pthreads pthread.h pthread_join   -lpthreadGC2 &&
+         check_lib pthreads pthread.h pthread_create -lpthreadGC2; then
         :
-    elif ! check_func pthread_join && ! check_func pthread_create; then
-        disable pthreads
+    elif check_lib pthreads pthread.h pthread_join   -lpthread &&
+         check_lib pthreads pthread.h pthread_create -lpthread; then
+        :
+    elif check_func pthread_join && check_func pthread_create; then
+        enable pthreads
     fi
     check_code cc "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER" || disable pthreads
 fi
@@ -5718,12 +5723,12 @@ fi
 enabled pthreads &&
     check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)"
 
-disabled  zlib || check_lib  zlib.h      zlibVersion    -lz    || disable  zlib
-disabled bzlib || check_lib bzlib.h BZ2_bzlibVersion    -lbz2  || disable bzlib
-disabled  lzma || check_lib  lzma.h lzma_version_number -llzma || disable lzma
+disabled  zlib || check_lib zlib   zlib.h      zlibVersion    -lz
+disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion    -lbz2
+disabled  lzma || check_lib lzma   lzma.h lzma_version_number -llzma
 
-check_lib math.h sin -lm && LIBM="-lm"
-disabled crystalhd || check_lib "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd || disable crystalhd
+check_lib libm math.h sin -lm && LIBM="-lm"
+disabled crystalhd || check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd
 
 atan2f_args=2
 copysign_args=2
@@ -5741,8 +5746,8 @@ done
 
 # these are off by default, so fail if requested and not available
 enabled avfoundation_indev && { check_header_objcc AVFoundation/AVFoundation.h || disable avfoundation_indev; }
-enabled avfoundation_indev && { check_lib CoreGraphics/CoreGraphics.h CGGetActiveDisplayList -framework CoreGraphics ||
-                                check_lib ApplicationServices/ApplicationServices.h CGGetActiveDisplayList -framework ApplicationServices; }
+enabled avfoundation_indev && { check_lib avfoundation_indev CoreGraphics/CoreGraphics.h CGGetActiveDisplayList -framework CoreGraphics ||
+                                check_lib avfoundation_indev ApplicationServices/ApplicationServices.h CGGetActiveDisplayList -framework ApplicationServices; }
 enabled cuda              && check_header cuda.h # this is not a dependency
 enabled cuvid             && { enabled cuda ||
                                die "ERROR: CUVID requires CUDA"; }
@@ -5755,14 +5760,14 @@ enabled frei0r            && { check_header frei0r.h || die "ERROR: frei0r.h hea
 enabled gmp               && require gmp gmp.h mpz_export -lgmp
 enabled gnutls            && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
 enabled jni               && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads &&
-                               check_lib "dlfcn.h" dlopen -ldl || die "ERROR: jni not found"; }
+                               check_lib jni "dlfcn.h" dlopen -ldl || die "ERROR: jni not found"; }
 enabled ladspa            && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; }
 enabled libiec61883       && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
 enabled libass            && require_pkg_config libass ass/ass.h ass_library_init
 enabled libbluray         && require_pkg_config libbluray libbluray/bluray.h bd_open
 enabled libbs2b           && require_pkg_config libbs2b bs2b.h bs2b_open
 enabled libcelt           && require libcelt celt/celt.h celt_decode -lcelt0 &&
-                             { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
+                             { check_lib libcelt celt/celt.h celt_decoder_create_custom -lcelt0 ||
                                die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
 enabled libcaca           && require_pkg_config caca caca.h caca_create_canvas
 enabled libdc1394         && require_pkg_config libdc1394-2 dc1394/dc1394.h dc1394_new
@@ -5777,7 +5782,7 @@ enabled libfreetype       && require_pkg_config freetype2 "ft2build.h FT_FREETYP
 enabled libfribidi        && require_pkg_config fribidi fribidi.h fribidi_version_info
 enabled libgme            && require  libgme gme/gme.h gme_new_emu -lgme -lstdc++
 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 libilbc           && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
 enabled libkvazaar        && require_pkg_config "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
@@ -5793,11 +5798,11 @@ enabled libopencv         && { check_header opencv2/core/core_c.h &&
                                  require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
                                require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; }
 enabled libopenh264       && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion
-enabled libopenjpeg       && { { check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
-                               check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 ||
-                               { check_lib openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
-                               { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
-                               { check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
+enabled libopenjpeg       && { { check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
+                               check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 ||
+                               { check_lib libopenjpeg openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
+                               { check_lib libopenjpeg openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
+                               { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
                                die "ERROR: libopenjpeg not found"; }
 enabled libopenmpt        && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
 enabled libopus           && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
@@ -5815,7 +5820,7 @@ enabled libspeex          && require_pkg_config speex speex/speex.h speex_decode
 enabled libtesseract      && require_pkg_config tesseract tesseract/capi.h TessBaseAPICreate
 enabled libtheora         && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
 enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame &&
-                             { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
+                             { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
                                die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
 enabled libv4l2           && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
 enabled libvidstab        && require_pkg_config "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
@@ -5825,23 +5830,21 @@ enabled libvorbis         && require libvorbis vorbis/vorbisenc.h vorbis_info_in
 enabled libvpx            && {
     enabled libvpx_vp8_decoder && {
         use_pkg_config "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
-            check_lib "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
+            check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
                 die "ERROR: libvpx decoder version must be >=0.9.1";
     }
     enabled libvpx_vp8_encoder && {
         use_pkg_config "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
-            check_lib "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
+            check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
                 die "ERROR: libvpx encoder version must be >=0.9.7";
     }
     enabled libvpx_vp9_decoder && {
         use_pkg_config "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
-            check_lib "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx ||
-                disable libvpx_vp9_decoder;
+            check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx
     }
     enabled libvpx_vp9_encoder && {
         use_pkg_config "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
-            check_lib "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx ||
-                disable libvpx_vp9_encoder;
+            check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx
     }
     if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
         die "libvpx enabled but no supported decoders found"
@@ -5870,29 +5873,29 @@ enabled libzvbi           && require libzvbi libzvbi.h vbi_decoder_new -lzvbi &&
                              { check_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
                                enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; }
 enabled mediacodec        && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
-enabled mmal              && { check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
+enabled mmal              && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
                                { ! enabled cross_compile &&
                                  add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline &&
                                  add_ldflags -L/opt/vc/lib/ &&
-                                 check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
+                                 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 netcdf            && require_pkg_config netcdf netcdf.h nc_inq_libvers
 enabled openal            && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
-                               check_lib 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
+                               check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
                                die "ERROR: openal not found"; } &&
                              { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
                                die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
-enabled opencl            && { check_lib OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
-                               check_lib CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
+enabled opencl            && { check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
+                               check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
                                die "ERROR: opencl not found"; } &&
                              { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
                                check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
                                die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
-enabled opengl            && { check_lib GL/glx.h glXGetProcAddress "-lGL" ||
-                               check_lib windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
-                               check_lib OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
-                               check_lib ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
+enabled opengl            && { check_lib opengl GL/glx.h glXGetProcAddress "-lGL" ||
+                               check_lib opengl windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
+                               check_lib opengl OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
+                               check_lib opengl ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
                                die "ERROR: opengl not found."
                              }
 enabled omx_rpi           && { check_header OMX_Core.h ||
@@ -5901,9 +5904,9 @@ enabled omx_rpi           && { check_header OMX_Core.h ||
 enabled omx               && { check_header OMX_Core.h || die "ERROR: OpenMAX IL headers not found"; }
 enabled openssl           && { use_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl ||
                                use_pkg_config openssl openssl/ssl.h SSL_library_init ||
-                               check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
-                               check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
-                               check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
+                               check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
+                               check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
+                               check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
                                die "ERROR: openssl not found"; }
 enabled qtkit_indev      && { check_header_objcc QTKit/QTKit.h || disable qtkit_indev; }
 
@@ -5943,8 +5946,7 @@ fi
 enabled sdl2 && enable sdl && add_cflags $sdl2_cflags && add_extralibs $sdl2_extralibs
 
 disabled securetransport || { check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
-    check_lib "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
-    enable securetransport; }
+    check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security"; }
 
 disabled schannel || { check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 &&
                        check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" && enable schannel && add_extralibs -lsecur32; }
@@ -5966,8 +5968,8 @@ check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.wid
 check_header sys/videoio.h
 check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
 
-check_lib "windows.h winuser.h" GetShellWindow -luser32
-check_lib "windows.h vfw.h" capCreateCaptureWindow -lvfw32
+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
@@ -5994,16 +5996,16 @@ fi
 check_header soundcard.h
 
 enabled_any alsa_indev alsa_outdev &&
-    check_lib alsa/asoundlib.h snd_pcm_htimestamp -lasound && enable alsa
+    check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
 
-enabled jack_indev && check_lib jack/jack.h jack_client_open -ljack && enable jack &&
+enabled jack_indev && check_lib jack jack/jack.h jack_client_open -ljack &&
     check_func jack_port_get_latency_range -ljack
 
-enabled_any sndio_indev sndio_outdev && check_lib sndio.h sio_open -lsndio && enable sndio
+enabled_any sndio_indev sndio_outdev && check_lib sndio sndio.h sio_open -lsndio
 
 if enabled libcdio; then
-    check_lib "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
-    check_lib "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
+    check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
+    check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
     die "ERROR: No usable libcdio/cdparanoia found"
 fi
 
@@ -6046,32 +6048,27 @@ int main(void) { IDirectXVideoDecoder *o = NULL; IDirectXVideoDecoder_Release(o)
 EOF
 
 enabled dxva2 &&
-    check_lib windows.h CoTaskMemFree -lole32 &&
-    enable dxva2_lib
+    check_lib dxva2_lib windows.h CoTaskMemFree -lole32
 
 enabled vaapi &&
-    check_lib va/va.h vaInitialize -lva ||
-    disable vaapi
+    check_lib vaapi va/va.h vaInitialize -lva
 
 enabled vaapi &&
     check_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" ||
     disable vaapi
 
 enabled vaapi &&
-    check_lib "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm &&
-    enable vaapi_drm
+    check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm
 
 enabled vaapi &&
-    check_lib "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11 &&
-    enable vaapi_x11
+    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 &&
-    check_lib "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11 &&
-    enable vdpau_x11
+    check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
 
 if enabled x86; then
     case $target_os in
@@ -6094,7 +6091,7 @@ int main(void) { return 0; }
 EOF
 
 # Funny iconv installations are not unusual, so check it after all flags have been set
-disabled iconv || check_func_headers iconv.h iconv || check_lib iconv.h iconv -liconv || disable iconv
+disabled iconv || check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv
 
 enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
 


======================================================================

diff --cc configure
index fe97712375,365bbb2bf2..b3cb5b0c1e
--- a/configure
+++ b/configure
@@@ -1223,20 -1006,15 +1223,23 @@@ EO
  
  check_lib(){
      log check_lib "$@"
-     headers="$1"
-     funcs="$2"
-     shift 2
-     check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
+     name="$1"
+     headers="$2"
+     funcs="$3"
+     shift 3
+     disable $name
+     check_func_headers "$headers" "$funcs" "$@" &&
+         enable $name && add_extralibs "$@"
  }
  
 +check_lib_cpp(){
 +    log check_lib_cpp "$@"
 +    headers="$1"
 +    classes="$2"
 +    shift 2
 +    check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
 +}
 +
  check_pkg_config(){
      log check_pkg_config "$@"
      pkg_version="$1"
@@@ -1333,21 -1112,14 +1337,21 @@@ require()
      headers="$2"
      func="$3"
      shift 3
-     check_lib "$headers" $func "$@" || die "ERROR: $name_version not found"
+     check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not found"
  }
  
 -require_pkg_config(){
 -    log require_pkg_config "$@"
 -    pkg_version="$1"
 -    pkg="${1%% *}"
 -    check_pkg_config "$@" || die "ERROR: $pkg_version not found"
 +require_cpp(){
 +    name="$1"
 +    headers="$2"
 +    classes="$3"
 +    shift 3
 +    check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
 +}
 +
 +use_pkg_config(){
 +    log use_pkg_config "$@"
 +    pkg="$1"
 +    check_pkg_config "$@" || return 1
      add_cflags    $(get_safe "${pkg}_cflags")
      add_extralibs $(get_safe "${pkg}_extralibs")
  }
@@@ -3007,25 -2387,15 +3011,25 @@@ opengl_outdev_deps="opengl
  oss_indev_deps_any="soundcard_h sys_soundcard_h"
  oss_outdev_deps_any="soundcard_h sys_soundcard_h"
  pulse_indev_deps="libpulse"
 +pulse_outdev_deps="libpulse"
 +qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework QuartzCore"
 +qtkit_indev_select="qtkit"
 +sdl2_outdev_deps="sdl2"
  sndio_indev_deps="sndio"
  sndio_outdev_deps="sndio"
 +v4l_indev_deps="linux_videodev_h"
  v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
 +v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
- vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
+ vfwcap_indev_deps="vfw32 vfwcap_defines"
  xcbgrab_indev_deps="libxcb"
 +xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
 +xv_outdev_extralibs="-lXv -lX11 -lXext"
  
  # protocols
 +async_protocol_deps="threads"
 +bluray_protocol_deps="libbluray"
  ffrtmpcrypt_protocol_deps="!librtmp_protocol"
 -ffrtmpcrypt_protocol_deps_any="gmp openssl"
 +ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
  ffrtmpcrypt_protocol_select="tcp_protocol"
  ffrtmphttp_protocol_deps="!librtmp_protocol"
  ffrtmphttp_protocol_select="http_protocol"
@@@ -5569,10 -4494,10 +5573,10 @@@ check_func_headers malloc.h _aligned_ma
  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_lib clock_gettime time.h clock_gettime -lrt && LIBRT="-lrt"; }
 -
 +check_func  access
 +check_func_headers stdlib.h arc4random
 +check_func_headers time.h clock_gettime ||
-     { check_lib time.h clock_gettime -lrt && LIBRT="-lrt"; }
++    { check_lib clock_gettime time.h clock_gettime -lrt && LIBRT="-lrt"; }
  check_func  fcntl
  check_func  fork
  check_func  gethrtime
@@@ -5585,11 -4512,9 +5589,11 @@@ check_func  mkstem
  check_func  mmap
  check_func  mprotect
  # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
 -check_func_headers time.h nanosleep || check_lib nanosleep time.h nanosleep -lrt
 +check_func_headers time.h nanosleep ||
-     { check_lib time.h nanosleep -lrt && LIBRT="-lrt"; }
++    { check_lib nanosleep time.h nanosleep -lrt && LIBRT="-lrt"; }
  check_func  sched_getaffinity
  check_func  setrlimit
 +check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
  check_func  strerror_r
  check_func  sysconf
  check_func  sysctl
@@@ -5649,14 -4557,12 +5653,14 @@@ check_header asm/types.
  # 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_builtin stdatomic_h stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0)"
  
- check_lib "windows.h shellapi.h" CommandLineToArgvW   -lshell32
- check_lib "windows.h wincrypt.h" CryptGenRandom       -ladvapi32
- check_lib "windows.h psapi.h"    GetProcessMemoryInfo -lpsapi
+ check_lib shell32  "windows.h shellapi.h" CommandLineToArgvW   -lshell32
+ check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom       -ladvapi32
+ check_lib psapi    "windows.h psapi.h"    GetProcessMemoryInfo -lpsapi
  
- check_lib "CoreServices/CoreServices.h" UTGetOSTypeFromString "-framework CoreServices"
++check_lib coreservices "CoreServices/CoreServices.h" UTGetOSTypeFromString "-framework CoreServices"
 +
  check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
  
  check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
@@@ -5689,45 -4583,29 +5693,46 @@@ f
  
  # 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
 -    if check_lib pthreads pthread.h pthread_join -pthread; then
 +if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
-     enable pthreads
-     if check_func pthread_join -pthread && check_func pthread_create -pthread; then
++    if check_lib pthreads pthread.h pthread_join   -pthread &&
++       check_lib pthreads pthread.h pthread_create -pthread; then
          add_cflags -pthread
-         add_extralibs -pthread
-     elif check_func pthread_join -pthreads && check_func pthread_create -pthreads; then
 -    elif check_lib pthreads pthread.h pthread_join -pthreads; then
++    elif check_lib pthreads pthread.h pthread_join   -pthreads &&
++         check_lib pthreads pthread.h pthread_create -pthreads; then
          add_cflags -pthreads
-         add_extralibs -pthreads
-     elif check_func pthread_join -ldl -pthread && check_func pthread_create -ldl -pthread; then
 -    elif check_lib pthreads pthread.h pthread_join -lpthreadGC2; then
++    elif check_lib pthreads pthread.h pthread_join   -ldl -pthread &&
++         check_lib pthreads pthread.h pthread_create -ldl -pthread; then
 +        add_cflags -ldl -pthread
-         add_extralibs -ldl -pthread
-     elif check_func pthread_join -lpthreadGC2 && check_func pthread_create -lpthreadGC2; then
-         add_extralibs -lpthreadGC2
-     elif check_lib pthread.h pthread_join -lpthread && check_lib pthread.h pthread_create -lpthread; then
++    elif check_lib pthreads pthread.h pthread_join   -lpthreadGC2 &&
++         check_lib pthreads pthread.h pthread_create -lpthreadGC2; then
          :
-     elif ! check_func pthread_join && ! check_func pthread_create; then
-         disable pthreads
 -    elif check_lib pthreads pthread.h pthread_join -lpthread; then
++    elif check_lib pthreads pthread.h pthread_join   -lpthread &&
++         check_lib pthreads pthread.h pthread_create -lpthread; then
+         :
 -    elif check_func pthread_join; then
++    elif check_func pthread_join && check_func pthread_create; then
+         enable pthreads
      fi
 +    check_code cc "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER" || disable pthreads
 +fi
 +
 +
 +if enabled pthreads; then
 +  check_func pthread_cancel
  fi
  
  enabled pthreads &&
      check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)"
  
- disabled  zlib || check_lib  zlib.h      zlibVersion    -lz    || disable  zlib
- disabled bzlib || check_lib bzlib.h BZ2_bzlibVersion    -lbz2  || disable bzlib
- disabled  lzma || check_lib  lzma.h lzma_version_number -llzma || disable lzma
 -disabled  zlib || check_lib  zlib  zlib.h      zlibVersion -lz
 -disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
++disabled  zlib || check_lib zlib   zlib.h      zlibVersion    -lz
++disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion    -lbz2
++disabled  lzma || check_lib lzma   lzma.h lzma_version_number -llzma
  
- check_lib math.h sin -lm && LIBM="-lm"
- disabled crystalhd || check_lib "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd || disable crystalhd
+ check_lib libm math.h sin -lm && LIBM="-lm"
++disabled crystalhd || check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.h" DtsCrystalHDVersion -lcrystalhd
  
  atan2f_args=2
 +copysign_args=2
 +hypot_args=2
  ldexpf_args=2
  powf_args=2
  
@@@ -5735,50 -4613,23 +5740,50 @@@ for func in $MATH_FUNCS; d
      eval check_mathfunc $func \${${func}_args:-1} $LIBM
  done
  
 +for func in $COMPLEX_FUNCS; do
 +    eval check_complexfunc $func \${${func}_args:-1}
 +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 cuda              && require cuda cuda.h cuInit -lcuda
 +enabled avfoundation_indev && { check_header_objcc AVFoundation/AVFoundation.h || disable avfoundation_indev; }
- enabled avfoundation_indev && { check_lib CoreGraphics/CoreGraphics.h CGGetActiveDisplayList -framework CoreGraphics ||
-                                 check_lib ApplicationServices/ApplicationServices.h CGGetActiveDisplayList -framework ApplicationServices; }
++enabled avfoundation_indev && { check_lib avfoundation_indev CoreGraphics/CoreGraphics.h CGGetActiveDisplayList -framework CoreGraphics ||
++                                check_lib avfoundation_indev ApplicationServices/ApplicationServices.h CGGetActiveDisplayList -framework ApplicationServices; }
 +enabled cuda              && check_header cuda.h # this is not a dependency
 +enabled cuvid             && { enabled cuda ||
 +                               die "ERROR: CUVID requires CUDA"; }
 +enabled chromaprint       && require chromaprint chromaprint.h chromaprint_get_version -lchromaprint
 +enabled coreimage_filter  && { check_header_objcc QuartzCore/CoreImage.h || disable coreimage_filter; }
 +enabled coreimagesrc_filter && { check_header_objcc QuartzCore/CoreImage.h || disable coreimagesrc_filter; }
 +enabled decklink          && { { check_header DeckLinkAPI.h || die "ERROR: DeckLinkAPI.h header not found"; } &&
 +                               { check_cpp_condition DeckLinkAPIVersion.h "BLACKMAGIC_DECKLINK_API_VERSION >= 0x0a060100" || die "ERROR: Decklink API version must be >= 10.6.1."; } }
  enabled frei0r            && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
 +enabled gmp               && require gmp gmp.h mpz_export -lgmp
  enabled gnutls            && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
 +enabled jni               && { [ $target_os = "android" ] && check_header jni.h && enabled pthreads &&
-                                check_lib "dlfcn.h" dlopen -ldl || die "ERROR: jni not found"; }
++                               check_lib jni "dlfcn.h" dlopen -ldl || die "ERROR: jni not found"; }
 +enabled ladspa            && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; }
 +enabled libiec61883       && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
 +enabled libass            && require_pkg_config libass ass/ass.h ass_library_init
 +enabled libbluray         && require_pkg_config libbluray libbluray/bluray.h bd_open
  enabled libbs2b           && require_pkg_config libbs2b bs2b.h bs2b_open
 +enabled libcelt           && require libcelt celt/celt.h celt_decode -lcelt0 &&
-                              { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
++                             { check_lib libcelt celt/celt.h celt_decoder_create_custom -lcelt0 ||
 +                               die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
 +enabled libcaca           && require_pkg_config caca caca.h caca_create_canvas
  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           && require libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
 -enabled libfdk_aac        && require_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen
 +enabled libfdk_aac        && { use_pkg_config fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
 +                               { require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac &&
 +                                 warn "using libfdk without pkg-config"; } }
 +flite_extralibs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
 +enabled libflite          && require libflite "flite/flite.h" flite_init $flite_extralibs
 +enabled fontconfig        && enable libfontconfig
  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 libfribidi        && require_pkg_config fribidi fribidi.h fribidi_version_info
 +enabled libgme            && require  libgme gme/gme.h gme_new_emu -lgme -lstdc++
  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
@@@ -5788,60 -4637,37 +5793,58 @@@ enabled libnut            && require li
  enabled libnpp            && require libnpp npp.h nppGetLibVersion -lnppi -lnppc
  enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
  enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
 -enabled libopencv         && require_pkg_config opencv opencv/cv.h cvCreateImageHeader
 +enabled libopencv         && { check_header opencv2/core/core_c.h &&
 +                               { use_pkg_config opencv opencv2/core/core_c.h cvCreateImageHeader ||
 +                                 require opencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
 +                               require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader; }
  enabled libopenh264       && require_pkg_config openh264 wels/codec_api.h WelsGetCodecVersion
- enabled libopenjpeg       && { { check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
-                                check_lib openjpeg-2.1/openjpeg.h opj_version -lopenjp2 ||
-                                { check_lib openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
-                                { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
-                                { check_lib openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -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 libopenjpeg       && { { check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
++                               check_lib libopenjpeg openjpeg-2.1/openjpeg.h opj_version -lopenjp2 ||
++                               { check_lib libopenjpeg openjpeg-2.0/openjpeg.h opj_version -lopenjp2 -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
++                               { check_lib libopenjpeg openjpeg-1.5/openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
++                               { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } ||
 +                               die "ERROR: libopenjpeg not found"; }
 +enabled libopenmpt        && require_pkg_config "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create
  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 libpulse          && require_pkg_config libpulse pulse/pulseaudio.h pa_context_new
  enabled librtmp           && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
 +enabled librubberband     && require_pkg_config "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new
  enabled libschroedinger   && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
 +enabled libshine          && require_pkg_config shine shine/layer3.h shine_encode_buffer
 +enabled libsmbclient      && { use_pkg_config smbclient libsmbclient.h smbc_init ||
 +                               require smbclient libsmbclient.h smbc_init -lsmbclient; }
  enabled libsnappy         && require libsnappy snappy-c.h snappy_compress -lsnappy
 +enabled libsoxr           && require libsoxr soxr.h soxr_create -lsoxr && LIBSOXR="-lsoxr"
 +enabled libssh            && require_pkg_config libssh libssh/sftp.h sftp_init
  enabled libspeex          && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex
 +enabled libtesseract      && require_pkg_config tesseract tesseract/capi.h TessBaseAPICreate
  enabled libtheora         && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
 -enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame
 -enabled libvo_aacenc      && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
 +enabled libtwolame        && require libtwolame twolame.h twolame_init -ltwolame &&
-                              { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
++                             { check_lib libtwolame twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
 +                               die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
 +enabled libv4l2           && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
 +enabled libvidstab        && require_pkg_config "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
  enabled libvo_amrwbenc    && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
  enabled libvorbis         && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
 -enabled libvpx            && require_pkg_config "vpx >= 1.3.0" vpx/vpx_codec.h vpx_codec_version && {
 +
 +enabled libvpx            && {
      enabled libvpx_vp8_decoder && {
 -        check_pkg_config vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
 -            disable libvpx_vp8_decoder;
 +        use_pkg_config "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
-             check_lib "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
++            check_lib libvpx_vp8_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
 +                die "ERROR: libvpx decoder version must be >=0.9.1";
      }
      enabled libvpx_vp8_encoder && {
 -        check_pkg_config vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
 -            disable libvpx_vp8_encoder;
 +        use_pkg_config "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
-             check_lib "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
++            check_lib libvpx_vp8_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
 +                die "ERROR: libvpx encoder version must be >=0.9.7";
      }
      enabled libvpx_vp9_decoder && {
 -        check_pkg_config vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
 -            disable libvpx_vp9_decoder;
 +        use_pkg_config "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
-             check_lib "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx ||
-                 disable libvpx_vp9_decoder;
++            check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx
      }
      enabled libvpx_vp9_encoder && {
 -        check_pkg_config vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
 -            disable libvpx_vp9_encoder;
 +        use_pkg_config "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
-             check_lib "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx ||
-                 disable libvpx_vp9_encoder;
++            check_lib libvpx_vp9_encoder "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_AQ_MODE" -lvpx
      }
      if disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder; then
          die "libvpx enabled but no supported decoders found"
@@@ -5860,114 -4681,56 +5863,113 @@@ enabled libx264           && { use_pkg_
                               { check_cpp_condition x264.h "X264_MPEG2" &&
                                 enable libx262; }
  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."; }
 +                             { check_cpp_condition x265.h "X265_BUILD >= 68" ||
 +                               die "ERROR: libx265 version must be >= 68."; }
  enabled libxavs           && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs
  enabled libxvid           && require libxvid xvid.h xvid_global -lxvidcore
 +enabled libzimg           && require_pkg_config "zimg >= 2.3.0" zimg.h zimg_get_api_version
 +enabled libzmq            && require_pkg_config libzmq zmq.h zmq_ctx_new
 +enabled libzvbi           && require libzvbi libzvbi.h vbi_decoder_new -lzvbi &&
 +                             { check_cpp_condition libzvbi.h "VBI_VERSION_MAJOR > 0 || VBI_VERSION_MINOR > 2 || VBI_VERSION_MINOR == 2 && VBI_VERSION_MICRO >= 28" ||
 +                               enabled gpl || die "ERROR: libzvbi requires version 0.2.28 or --enable-gpl."; }
 +enabled mediacodec        && { enabled jni || die "ERROR: mediacodec requires --enable-jni"; }
- enabled mmal              && { check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
+ enabled mmal              && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
                                 { ! enabled cross_compile &&
                                   add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline &&
                                   add_ldflags -L/opt/vc/lib/ &&
-                                  check_lib interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
+                                  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 netcdf            && require_pkg_config netcdf netcdf.h nc_inq_libvers
 +enabled openal            && { { for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
-                                check_lib 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
++                               check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
 +                               die "ERROR: openal not found"; } &&
 +                             { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
 +                               die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
- enabled opencl            && { check_lib OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
-                                check_lib CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
++enabled opencl            && { check_lib opencl OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
++                               check_lib opencl CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
 +                               die "ERROR: opencl not found"; } &&
 +                             { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
 +                               check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
 +                               die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
- enabled opengl            && { check_lib GL/glx.h glXGetProcAddress "-lGL" ||
-                                check_lib windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
-                                check_lib OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
-                                check_lib ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
++enabled opengl            && { check_lib opengl GL/glx.h glXGetProcAddress "-lGL" ||
++                               check_lib opengl windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
++                               check_lib opengl OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
++                               check_lib opengl ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
 +                               die "ERROR: opengl not found."
 +                             }
  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 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; } ||
 +enabled openssl           && { use_pkg_config openssl openssl/ssl.h OPENSSL_init_ssl ||
 +                               use_pkg_config openssl openssl/ssl.h SSL_library_init ||
-                                check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
-                                check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
-                                check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
+                                check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
+                                check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
+                                check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
                                 die "ERROR: openssl not found"; }
 -
 -enabled gnutls            && check_lib gmp gmp.h mpz_export -lgmp
 -
 -if enabled nvenc; then
 -    check_header nvEncodeAPI.h || die "ERROR: nvEncodeAPI.h not found."
 -    check_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6" ||
 -        die "ERROR: NVENC API version 5 or older is not supported"
 +enabled qtkit_indev      && { check_header_objcc QTKit/QTKit.h || disable qtkit_indev; }
 +
 +if enabled gcrypt; then
 +    GCRYPT_CONFIG="${cross_prefix}libgcrypt-config"
 +    if "${GCRYPT_CONFIG}" --version > /dev/null 2>&1; then
 +        gcrypt_cflags=$("${GCRYPT_CONFIG}" --cflags)
 +        gcrypt_extralibs=$("${GCRYPT_CONFIG}" --libs)
 +        check_func_headers gcrypt.h gcry_mpi_new $gcrypt_cflags $gcrypt_extralibs ||
 +            die "ERROR: gcrypt not found"
 +        add_cflags $gcrypt_cflags && add_extralibs $gcrypt_extralibs
 +    else
 +        require gcrypt gcrypt.h gcry_mpi_new -lgcrypt
 +    fi
  fi
  
 -if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
 -    check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
 -    check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
 -    enable sdl
 +disabled sdl && disable sdl2
 +if ! disabled sdl2; then
 +    SDL2_CONFIG="${cross_prefix}sdl2-config"
 +    if check_pkg_config sdl2 SDL_events.h SDL_PollEvent; then
 +        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
 +        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
 +        check_func SDL_Init $sdl2_extralibs $sdl2_cflags && enable sdl2
 +    else
 +      if "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
 +        sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
 +        sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
 +        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
 +        check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
 +        check_func SDL_Init $sdl2_extralibs $sdl2_cflags && enable sdl2
 +      fi
 +    fi
 +    if test $target_os = "mingw32"; then
 +        sdl2_extralibs="$sdl2_extralibs -mconsole"
 +    fi
  fi
 +enabled sdl2 && enable sdl && add_cflags $sdl2_cflags && add_extralibs $sdl2_extralibs
 +
 +disabled securetransport || { check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
-     check_lib "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
-     enable securetransport; }
++    check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-Wl,-framework,CoreFoundation -Wl,-framework,Security"; }
  
 -! disabled pod2man   && check_cmd pod2man --help     && enable pod2man   || disable pod2man
 -! disabled texi2html && check_cmd texi2html -version && enable texi2html || disable texi2html
 +disabled schannel || { check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 &&
 +                       check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" && enable schannel && add_extralibs -lsecur32; }
 +
 +makeinfo --version > /dev/null 2>&1 && enable makeinfo  || disable makeinfo
 +enabled makeinfo \
 +    && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \
 +    && enable makeinfo_html || disable makeinfo_html
 +disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
 +perl -v            > /dev/null 2>&1 && enable perl      || disable perl
 +pod2man --help     > /dev/null 2>&1 && enable pod2man   || disable pod2man
 +rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
  
  check_header linux/fb.h
 +check_header linux/videodev.h
  check_header linux/videodev2.h
 -check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
 -
 -check_header AVFoundation/AVFoundation.h
 +check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  
  check_header sys/videoio.h
 +check_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
  
- check_lib "windows.h winuser.h" GetShellWindow -luser32
- check_lib "windows.h vfw.h" capCreateCaptureWindow -lvfw32
+ 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
@@@ -6007,51 -4761,29 +6009,49 @@@ if enabled libcdio; the
      die "ERROR: No usable libcdio/cdparanoia found"
  fi
  
 -if enabled libxcb; then
 -    check_pkg_config xcb-shape xcb/shape.h xcb_shape_rectangles || {
 -        enabled libxcb && die "ERROR: libxcb not found";
 +if ! disabled libxcb; then
 +    check_pkg_config "xcb >= 1.4" xcb/xcb.h xcb_connect || {
 +        enabled libxcb && die "ERROR: libxcb >= 1.4 not found";
      } && enable libxcb
  
 -    disabled libxcb_shm ||
 +if enabled libxcb; then
 +    disabled libxcb_shm || {
          check_pkg_config xcb-shm xcb/shm.h xcb_shm_attach || {
              enabled libxcb_shm && die "ERROR: libxcb_shm not found";
 -        } && check_header sys/shm.h && enable libxcb_shm
 +        } && check_header sys/shm.h && enable libxcb_shm; }
  
 -    disabled libxcb_xfixes ||
 +    disabled libxcb_xfixes || {
          check_pkg_config xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image || {
              enabled libxcb_xfixes && die "ERROR: libxcb_xfixes not found";
 -        } && enable libxcb_xfixes
 +        } && enable libxcb_xfixes; }
 +
 +    disabled libxcb_shape || {
 +        check_pkg_config xcb-shape xcb/shape.h xcb_shape_get_rectangles || {
 +            enabled libxcb_shape && die "ERROR: libxcb_shape not found";
 +        } && enable libxcb_shape; }
  
 -    add_cflags "$xcb_shape_cflags $xcb_shm_cflags $xcb_xfixes_cflags"
 -    add_extralibs "$xcb_shape_extralibs $xcb_shm_extralibs $xcb_xfixes_extralibs"
 +    add_cflags $xcb_cflags $xcb_shm_cflags $xcb_xfixes_cflags $xcb_shape_cflags
 +    add_extralibs $xcb_extralibs $xcb_shm_extralibs $xcb_xfixes_extralibs $xcb_shape_extralibs
  fi
 +fi
 +
 +check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
 +
 +enabled dxva2api_h &&
 +    check_cc <<EOF && enable dxva2api_cobj
 +#define _WIN32_WINNT 0x0600
 +#define COBJMACROS
 +#include <windows.h>
 +#include <d3d9.h>
 +#include <dxva2api.h>
 +int main(void) { IDirectXVideoDecoder *o = NULL; IDirectXVideoDecoder_Release(o); return 0; }
 +EOF
  
  enabled dxva2 &&
-     check_lib windows.h CoTaskMemFree -lole32 &&
-     enable dxva2_lib
+     check_lib dxva2_lib windows.h CoTaskMemFree -lole32
  
 -enabled vaapi && require vaapi va/va.h vaInitialize -lva
 +enabled vaapi &&
-     check_lib va/va.h vaInitialize -lva ||
-     disable vaapi
++    check_lib vaapi va/va.h vaInitialize -lva
  
  enabled vaapi &&
      check_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" ||
@@@ -6070,32 -4800,8 +6068,31 @@@ enabled vdpau &
      disable vdpau
  
  enabled vdpau &&
-     check_lib "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11 &&
-     enable vdpau_x11
+     check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
  
 +if enabled x86; then
 +    case $target_os in
 +        mingw32*|mingw64*|win32|win64|linux|cygwin*)
 +            ;;
 +        *)
 +            disable cuda cuvid nvenc
 +            ;;
 +    esac
 +else
 +    disable cuda cuvid nvenc
 +fi
 +
 +enabled nvenc &&
 +    check_cc -I$source_path <<EOF || disable nvenc
 +#include "compat/nvenc/nvEncodeAPI.h"
 +NV_ENCODE_API_FUNCTION_LIST flist;
 +void f(void) { struct { const GUID guid; } s[] = { { NV_ENC_PRESET_HQ_GUID } }; }
 +int main(void) { return 0; }
 +EOF
 +
 +# Funny iconv installations are not unusual, so check it after all flags have been set
- disabled iconv || check_func_headers iconv.h iconv || check_lib iconv.h iconv -liconv || disable iconv
++disabled iconv || check_func_headers iconv.h iconv || check_lib iconv iconv.h iconv -liconv
 +
  enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
  
  # add some useful compiler flags if supported



More information about the ffmpeg-cvslog mailing list