ffmpeg | branch: master | James Almer <jamr...@gmail.com> | Wed Mar 28 15:03:56 2018 -0300| [67e8f476b7d3c21686a2d453d052818ac92688b3] | committer: James Almer
Merge commit '9c37d765ef28b027414f86b0088b0c282a3c46d8' * commit '9c37d765ef28b027414f86b0088b0c282a3c46d8': configure: Add check_cc/require_cc helper functions to simplify some expressions Merged-by: James Almer <jamr...@gmail.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=67e8f476b7d3c21686a2d453d052818ac92688b3 --- configure | 72 +++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/configure b/configure index 5ccf3cee7f..b3c5a7dea4 100755 --- a/configure +++ b/configure @@ -1398,6 +1398,14 @@ check_compile_assert(){ test_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name" } +check_cc(){ + log check_cc "$@" + name=$1 + shift + disable "$name" + test_code cc "$@" && enable "$name" +} + require(){ log require "$@" name_version="$1" @@ -1406,6 +1414,13 @@ require(){ check_lib $name "$@" || die "ERROR: $name_version not found" } +require_cc(){ + log require_cc "$@" + name="$1" + shift + test_code cc "$@" || die "ERROR: $name failed" +} + require_cpp(){ name="$1" headers="$2" @@ -5360,24 +5375,17 @@ extern_prefix=${sym%%ff_extern*} ! disabled inline_asm && check_inline_asm inline_asm '"" ::' for restrict_keyword in restrict __restrict__ __restrict ""; do - test_cc <<EOF && break -void foo(char * $restrict_keyword p); -EOF + test_code cc "" "char * $restrict_keyword p" && break done -test_cc <<EOF && enable pragma_deprecated -void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") } -EOF +check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")' test_cc <<EOF || die "endian test failed" unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'; EOF od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian -test_cc <<EOF && enable const_nan -#include <math.h> -void foo(void) { struct { double d; } static const bar[] = { { NAN } }; } -EOF +check_cc const_nan math.h "struct { double d; } static const bar[] = { { NAN } }" if ! enabled ppc64 || enabled bigendian; then disable vsx @@ -5548,19 +5556,17 @@ elif enabled ppc; then check_cflags -maltivec -mabi=altivec # check if our compiler supports Motorola AltiVec C API - test_code cc altivec.h "vector signed int v1 = (vector signed int) { 0 }; - vector signed int v2 = (vector signed int) { 1 }; - v1 = vec_add(v1, v2);" || - disable altivec + check_cc altivec altivec.h "vector signed int v1 = (vector signed int) { 0 }; + vector signed int v2 = (vector signed int) { 1 }; + v1 = vec_add(v1, v2);" enabled altivec || warn "Altivec disabled, possibly missing --cpu flag" fi if enabled vsx; then check_cflags -mvsx && - test_code cc altivec.h "int v[4] = { 0 }; - vector signed int v1 = vec_vsx_ld(0, v);" || - disable vsx + check_cc vsx altivec.h "int v[4] = { 0 }; + vector signed int v1 = vec_vsx_ld(0, v);" fi if enabled power8; then @@ -5644,7 +5650,7 @@ EOF fi -test_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon +check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)" check_ldflags -Wl,--as-needed check_ldflags -Wl,-z,noexecstack @@ -5873,7 +5879,7 @@ if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then elif check_func pthread_join && check_func pthread_create; then enable pthreads fi - test_code cc "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER" || disable pthreads + check_cc pthreads "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER" if enabled pthreads; then check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs @@ -6148,16 +6154,16 @@ rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || d check_header linux/fb.h check_header linux/videodev2.h test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete -test_code cc linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" || disable v4l2_m2m -test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;" && enable vc1_v4l2_m2m -test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;" && enable mpeg1_v4l2_m2m -test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;" && enable mpeg2_v4l2_m2m -test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;" && enable mpeg4_v4l2_m2m -test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;" && enable hevc_v4l2_m2m -test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H263;" && enable h263_v4l2_m2m -test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H264;" && enable h264_v4l2_m2m -test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" && enable vp8_v4l2_m2m -test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" && enable vp9_v4l2_m2m +check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" +check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;" +check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;" +check_cc mpeg2_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;" +check_cc mpeg4_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;" +check_cc hevc_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;" +check_cc h263_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H263;" +check_cc h264_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H264;" +check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" +check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" check_header sys/videoio.h test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete @@ -6231,14 +6237,12 @@ enabled vaapi && check_lib vaapi va/va.h vaInitialize -lva enabled vaapi && - test_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" || - disable vaapi + check_cc vaapi "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" -enabled vaapi && +if enabled vaapi; then check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm - -enabled vaapi && check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11 +fi enabled vaapi && check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" ====================================================================== diff --cc configure index 5ccf3cee7f,499d98f1ba..b3c5a7dea4 --- a/configure +++ b/configure @@@ -1406,14 -1145,13 +1414,21 @@@ require() check_lib $name "$@" || die "ERROR: $name_version not found" } + require_cc(){ + log require_cc "$@" + name="$1" + shift + test_code cc "$@" || die "ERROR: $name failed" + } + +require_cpp(){ + name="$1" + headers="$2" + classes="$3" + shift 3 + check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found" +} + require_header(){ log require_header "$@" headers="$1" @@@ -5360,29 -4187,14 +5375,22 @@@ extern_prefix=${sym%%ff_extern* ! disabled inline_asm && check_inline_asm inline_asm '"" ::' for restrict_keyword in restrict __restrict__ __restrict ""; do - test_cc <<EOF && break - void foo(char * $restrict_keyword p); - EOF + test_code cc "" "char * $restrict_keyword p" && break done - test_cc <<EOF && enable pragma_deprecated - void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") } - EOF + check_cc pragma_deprecated "" '_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")' -require_cc "endian test" "" "unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'" +test_cc <<EOF || die "endian test failed" +unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'; +EOF od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian - test_cc <<EOF && enable const_nan - #include <math.h> - void foo(void) { struct { double d; } static const bar[] = { { NAN } }; } - EOF ++check_cc const_nan math.h "struct { double d; } static const bar[] = { { NAN } }" + +if ! enabled ppc64 || enabled bigendian; then + disable vsx +fi + check_gas() { log "check_gas using '$as' as AS" # :vararg is used on aarch64, arm and ppc altivec @@@ -5644,10 -4434,9 +5650,10 @@@ EO fi - test_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon + check_cc intrinsics_neon arm_neon.h "int16x8_t test = vdupq_n_s16(0)" check_ldflags -Wl,--as-needed +check_ldflags -Wl,-z,noexecstack if ! disabled network; then check_func getaddrinfo $network_extralibs @@@ -5854,39 -4590,27 +5860,39 @@@ 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 + if check_lib pthreads pthread.h pthread_join -pthread && + check_lib pthreads pthread.h pthread_create -pthread; then add_cflags -pthread - 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 - 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 + elif check_lib pthreads pthread.h pthread_join -lpthreadGC2 && + check_lib pthreads pthread.h pthread_create -lpthreadGC2; then : - 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 - test_code cc "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER" || disable pthreads - enabled pthreads && ++ check_cc pthreads "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER" + + if enabled pthreads; then check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs + check_func pthread_cancel $pthreads_extralibs + fi fi -disabled zlib || check_lib zlib zlib.h zlibVersion -lz -disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2 +enabled zlib && check_lib zlib zlib.h zlibVersion -lz +enabled bzlib && check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2 +enabled lzma && check_lib lzma lzma.h lzma_version_number -llzma # On some systems dynamic loading requires no extra linker flags -check_lib libdl dlfcn.h dlopen || check_lib libdl dlfcn.h dlopen -ldl +check_lib libdl dlfcn.h "dlopen dlsym" || check_lib libdl dlfcn.h "dlopen dlsym" -ldl check_lib libm math.h sin -lm @@@ -6077,90 -4701,18 +6083,90 @@@ enabled openssl && { check_pk check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 || check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } +enabled rkmpp && { require_pkg_config rkmpp rockchip_mpp rockchip/rk_mpi.h mpp_create && + require_pkg_config rockchip_mpp "rockchip_mpp >= 1.3.7" rockchip/rk_mpi.h mpp_create && + { enabled libdrm || + die "ERROR: rkmpp requires --enable-libdrm"; } + } -# SDL adds some CFLAGS that should not be part of the general CFLAGS. -enabled avplay && - test_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent +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 + else + require gcrypt gcrypt.h gcry_mpi_new -lgcrypt + fi +fi + +if enabled sdl2; then + SDL2_CONFIG="${cross_prefix}sdl2-config" + test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent + if disabled sdl2 && "${SDL2_CONFIG}" --version > /dev/null 2>&1; then + sdl2_cflags=$("${SDL2_CONFIG}" --cflags) + sdl2_extralibs=$("${SDL2_CONFIG}" --libs) + test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags && + test_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags && + check_func_headers SDL_events.h SDL_PollEvent $sdl2_extralibs $sdl2_cflags && + enable sdl2 + fi + if test $target_os = "mingw32"; then + sdl2_extralibs=$(filter_out '-mwindows' $sdl2_extralibs) + fi +fi +if enabled decklink; then + case $target_os in + mingw32*|mingw64*|win32|win64) + decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32" + decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32" + ;; + esac +fi + +enabled securetransport && + check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" && + check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext" "-Wl,-framework,CoreFoundation -Wl,-framework,Security" || + disable securetransport + +enabled securetransport && + check_func SecItemImport "-Wl,-framework,CoreFoundation -Wl,-framework,Security" + +enabled schannel && + check_func_headers "windows.h security.h" InitializeSecurityContext -DSECURITY_WIN32 -lsecur32 && + test_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" && + schannel_extralibs="-lsecur32" || + disable schannel + +makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo +enabled makeinfo \ + && [ 0$(makeinfo --version | grep "texinfo" | sed 's/.*texinfo[^0-9]*\([0-9]*\)\..*/\1/') -ge 5 ] \ + && enable makeinfo_html || disable makeinfo_html +disabled makeinfo_html && texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html +perl -v > /dev/null 2>&1 && enable perl || disable perl +pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man +rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout + +# check V4L2 codecs available in the API check_header linux/fb.h check_header linux/videodev2.h -check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete - -check_header AVFoundation/AVFoundation.h +test_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete - test_code cc linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" || disable v4l2_m2m - test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;" && enable vc1_v4l2_m2m - test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;" && enable mpeg1_v4l2_m2m - test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;" && enable mpeg2_v4l2_m2m - test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;" && enable mpeg4_v4l2_m2m - test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;" && enable hevc_v4l2_m2m - test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H263;" && enable h263_v4l2_m2m - test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_H264;" && enable h264_v4l2_m2m - test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" && enable vp8_v4l2_m2m - test_code cc linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" && enable vp9_v4l2_m2m ++check_cc v4l2_m2m linux/videodev2.h "int i = V4L2_CAP_VIDEO_M2M_MPLANE | V4L2_CAP_VIDEO_M2M | V4L2_BUF_FLAG_LAST;" ++check_cc vc1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VC1_ANNEX_G;" ++check_cc mpeg1_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG1;" ++check_cc mpeg2_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG2;" ++check_cc mpeg4_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_MPEG4;" ++check_cc hevc_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_HEVC;" ++check_cc h263_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H263;" ++check_cc h264_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_H264;" ++check_cc vp8_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP8;" ++check_cc vp9_v4l2_m2m linux/videodev2.h "int i = V4L2_PIX_FMT_VP9;" check_header sys/videoio.h +test_code cc sys/videoio.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_sanitized struct_v4l2_frmivalenum_discrete check_lib user32 "windows.h winuser.h" GetShellWindow -luser32 check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32 @@@ -6227,46 -4766,17 +6233,44 @@@ test_cpp <<EOF && enable uwp && d3d11va #endif EOF -enabled vaapi && require vaapi va/va.h vaInitialize -lva +enabled vaapi && + check_lib vaapi va/va.h vaInitialize -lva + +enabled vaapi && - test_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" || - disable vaapi ++ check_cc vaapi "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" - enabled vaapi && + if enabled vaapi; then - require_cc vaapi "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" - check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm - check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11 + check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm - - enabled vaapi && + check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11 + fi enabled vaapi && - test_cpp_condition "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" && - enable vaapi_1 + check_cpp_condition vaapi_1 "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" + +if enabled_all opencl libdrm ; then + check_type "CL/cl_intel.h" "clCreateImageFromFdINTEL_fn" && + enable opencl_drm_beignet + check_func_headers "CL/cl_ext.h" clImportMemoryARM && + enable opencl_drm_arm +fi + +if enabled_all opencl vaapi ; then + enabled opencl_drm_beignet && enable opencl_vaapi_beignet + if enabled libmfx ; then + check_type "CL/cl.h CL/va_ext.h" "clCreateFromVA_APIMediaSurfaceINTEL_fn" && + enable opencl_vaapi_intel_media + fi +fi + +if enabled_all opencl dxva2 ; then + check_type "CL/cl_dx9_media_sharing.h" cl_dx9_surface_info_khr && + enable opencl_dxva2 +fi + +if enabled_all opencl d3d11va ; then + check_type "CL/cl_d3d11.h" clGetDeviceIDsFromD3D11KHR_fn && + enable opencl_d3d11 +fi enabled vdpau && check_cpp_condition vdpau vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog