X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=configure;h=499d98f1bad610a06481ab07f055126adf3f436b;hb=9c37d765ef28b027414f86b0088b0c282a3c46d8;hp=240410bf1976814996172bcef60243ccee28c484;hpb=3613063e87307e5421707aa2ffb22054ad5d62b8;p=ffmpeg diff --git a/configure b/configure index 240410bf197..499d98f1bad 100755 --- a/configure +++ b/configure @@ -73,7 +73,6 @@ Help options: --list-protocols show all available protocols --list-bsfs show all available bitstream filters --list-indevs show all available input devices - --list-outdevs show all available output devices --list-filters show all available filters Standard options: @@ -163,9 +162,6 @@ Individual component options: --enable-indev=NAME enable input device NAME --disable-indev=NAME disable input device NAME --disable-indevs disable input devices - --enable-outdev=NAME enable output device NAME - --disable-outdev=NAME disable output device NAME - --disable-outdevs disable output devices --disable-devices disable all devices --enable-filter=NAME enable filter NAME --disable-filter=NAME disable filter NAME @@ -235,6 +231,7 @@ External library support: --enable-zlib compression [autodetect] The following libraries provide various hardware acceleration features: + --enable-amf AMF video encoding code [auto] --enable-cuda Nvidia CUDA (dynamically linked) --enable-cuvid Nvidia CUVID video decode acceleration --enable-d3d11va Microsoft Direct3D 11 video acceleration [auto] @@ -351,8 +348,6 @@ EOF exit 0 } -quotes='""' - log(){ echo "$@" >> $logfile } @@ -517,13 +512,13 @@ disable_weak(){ enable_sanitized(){ for var; do - enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g') + enable $(sanitize_var_name $var) done } disable_sanitized(){ for var; do - disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g') + disable $(sanitize_var_name $var) done } @@ -556,12 +551,12 @@ enable_deep_weak(){ } enabled(){ - test "${1#!}" = "$1" && op== || op=!= + test "${1#!}" = "$1" && op="=" || op="!=" eval test "x\$${1#!}" $op "xyes" } disabled(){ - test "${1#!}" = "$1" && op== || op=!= + test "${1#!}" = "$1" && op="=" || op="!=" eval test "x\$${1#!}" $op "xno" } @@ -763,7 +758,7 @@ add_compat(){ map 'add_cppflags -D$v' "$@" } -check_cmd(){ +test_cmd(){ log "$@" "$@" >> $logfile 2>&1 } @@ -776,36 +771,44 @@ cc_e(){ eval printf '%s\\n' $CC_E } -check_cc(){ - log check_cc "$@" +test_cc(){ + log test_cc "$@" cat > $TMPC log_file $TMPC - check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC + test_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC } -check_objcc(){ - log check_objcc "$@" +test_objcc(){ + log test_objcc "$@" cat > $TMPC log_file $TMPC - check_cmd $objcc $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPC + test_cmd $objcc $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPC } -check_cpp(){ - log check_cpp "$@" +test_cpp(){ + log test_cpp "$@" cat > $TMPC log_file $TMPC - check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC + test_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC } as_o(){ eval printf '%s\\n' $AS_O } -check_as(){ - log check_as "$@" +test_as(){ + log test_as "$@" cat > $TMPS log_file $TMPS - check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS + test_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS +} + +check_cmd(){ + log check_cmd "$@" + cmd=$1 + disabled $cmd && return + disable $cmd + test_cmd $@ && enable $cmd } check_inline_asm(){ @@ -814,37 +817,37 @@ check_inline_asm(){ code="$2" shift 2 disable $name - check_cc "$@" < $TMPS log_file $TMPS shift 1 - check_cmd $x86asmexe $X86ASMFLAGS "$@" -o $TMPO $TMPS + test_cmd $x86asmexe $X86ASMFLAGS "$@" -o $TMPO $TMPS } ld_o(){ eval printf '%s\\n' $LD_O } -check_ld(){ - log check_ld "$@" +test_ld(){ + log test_ld "$@" flags=$(filter_out '-l*' "$@") libs=$(filter '-l*' "$@") - check_cc $($cflags_filter $flags) || return + test_cc $($cflags_filter $flags) || return flags=$($ldflags_filter $flags) libs=$($ldflags_filter $libs) - check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs + test_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs } print_include(){ @@ -854,8 +857,8 @@ print_include(){ echo "#include <$hdr>" } -check_code(){ - log check_code "$@" +test_code(){ + log test_code "$@" check=$1 headers=$2 code=$3 @@ -865,12 +868,12 @@ check_code(){ print_include $hdr done echo "int main(void) { $code; return 0; }" - } | check_$check "$@" + } | test_$check "$@" } check_cppflags(){ log check_cppflags "$@" - check_cpp "$@" <; EOF } @@ -878,7 +881,7 @@ EOF test_cflags(){ log test_cflags "$@" set -- $($cflags_filter "$@") - check_cc "$@" < -int x; -EOF + disable_sanitized $headers + { + for hdr in $headers; do + print_include $hdr + done + echo "int x;" + } | test_cpp "$@" && enable_sanitized $headers } check_func(){ @@ -943,7 +949,7 @@ check_func(){ func=$1 shift disable $func - check_ld "$@" < float foo(float f, float g) { return $func($args); } int main(void){ return 0; } @@ -976,15 +982,15 @@ check_func_headers(){ echo "long check_$func(void) { return (long) $func; }" done echo "int main(void) { return 0; }" - } | check_ld "$@" && enable $funcs && enable_sanitized $headers + } | test_ld "$@" && enable $funcs && enable_sanitized $headers } -check_cpp_condition(){ - log check_cpp_condition "$@" +test_cpp_condition(){ + log test_cpp_condition "$@" header=$1 condition=$2 shift 2 - check_cpp "$@" < #if !($condition) #error "unsatisfied condition: $condition" @@ -992,13 +998,21 @@ check_cpp_condition(){ EOF } +check_cpp_condition(){ + log check_cpp_condition "$@" + name=$1 + shift 1 + disable $name + test_cpp_condition "$@" && enable $name +} + test_cflags_cpp(){ log test_cflags_cpp "$@" flags=$1 condition=$2 shift 2 set -- $($cflags_filter "$flags") - check_cpp "$@" <> $logfile 2>&1; } +test_exec(){ + log test_exec "$@" + test_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; } } check_exec_crash(){ @@ -1055,7 +1070,7 @@ check_exec_crash(){ # can redirect the "Terminated" message from the shell. SIGBUS # is not defined by standard C so it is used conditionally. - (check_exec "$@") >> $logfile 2>&1 <> $logfile 2>&1 < static void sighandler(int sig){ raise(SIGTERM); @@ -1082,7 +1097,7 @@ check_type(){ type=$2 shift 2 disable_sanitized "$type" - check_code cc "$headers" "$type v" "$@" && enable_sanitized "$type" + test_code cc "$headers" "$type v" "$@" && enable_sanitized "$type" } check_struct(){ @@ -1092,18 +1107,16 @@ check_struct(){ member=$3 shift 3 disable_sanitized "${struct}_${member}" - check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" && + test_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" && enable_sanitized "${struct}_${member}" } check_builtin(){ log check_builtin "$@" name=$1 - headers=$2 - builtin=$3 - shift 3 + shift disable "$name" - check_code ld "$headers" "$builtin" "$@" && enable "$name" + test_code ld "$@" && enable "$name" } check_compile_assert(){ @@ -1113,32 +1126,42 @@ check_compile_assert(){ condition=$3 shift 3 disable "$name" - check_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name" + 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" name="${1%% *}" - headers="$2" - func="$3" - shift 3 - check_lib $name "$headers" $func "$@" || die "ERROR: $name_version not found" + shift + check_lib $name "$@" || die "ERROR: $name_version not found" } -require_header(){ - log require "$@" - header="$1" +require_cc(){ + log require_cc "$@" + name="$1" shift - check_header "$header" "$@" || die "ERROR: $header not found" + test_code cc "$@" || die "ERROR: $name failed" +} + +require_header(){ + log require_header "$@" + headers="$1" + check_header "$@" || die "ERROR: $headers not found" } require_cpp_condition(){ - log require "$@" - header="$1" + log require_cpp_condition "$@" condition="$2" - shift 2 - check_cpp_condition "$header" "$condition" "$@" || die "ERROR: $condition not satisfied" + test_cpp_condition "$@" || die "ERROR: $condition not satisfied" } require_pkg_config(){ @@ -1155,23 +1178,23 @@ hostcc_o(){ eval printf '%s\\n' $HOSTCC_O } -check_host_cc(){ - log check_host_cc "$@" +test_host_cc(){ + log test_host_cc "$@" cat > $TMPC log_file $TMPC - check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC + test_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC } -check_host_cpp(){ - log check_host_cpp "$@" +test_host_cpp(){ + log test_host_cpp "$@" cat > $TMPC log_file $TMPC - check_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC + test_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC } check_host_cppflags(){ log check_host_cppflags "$@" - check_host_cpp "$@" <; EOF } @@ -1179,17 +1202,17 @@ EOF check_host_cflags(){ log check_host_cflags "$@" set -- $($host_cflags_filter "$@") - check_host_cc "$@" < #if !($condition) #error "unsatisfied condition: $condition" @@ -1197,10 +1220,12 @@ check_host_cpp_condition(){ EOF } -apply(){ - file=$1 - shift - "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp" +check_host_cpp_condition(){ + log check_host_cpp_condition "$@" + name=$1 + shift 1 + disable $name + test_host_cpp_condition "$@" && enable $name } cp_if_changed(){ @@ -1222,7 +1247,6 @@ AVCODEC_COMPONENTS=" AVDEVICE_COMPONENTS=" indevs - outdevs " AVFILTER_COMPONENTS=" filters @@ -1265,6 +1289,7 @@ HWACCEL_LIBRARY_NONFREE_LIST=" " HWACCEL_LIBRARY_LIST=" $HWACCEL_LIBRARY_NONFREE_LIST + amf d3d11va dxva2 libmfx @@ -1556,12 +1581,10 @@ HEADERS_LIST=" dxgidebug_h dxva_h io_h - mach_mach_time_h machine_ioctl_bt848_h machine_ioctl_meteor_h malloc_h poll_h - stdatomic_h sys_param_h sys_resource_h sys_select_h @@ -1606,12 +1629,20 @@ MATH_FUNCS=" truncf " +SYSTEM_FEATURES=" + dos_paths + libc_msvcrt + MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS + section_data_rel_ro + threads + uwp +" + SYSTEM_FUNCS=" aligned_malloc clock_gettime closesocket CommandLineToArgvW - CryptGenRandom fcntl getaddrinfo gethrtime @@ -1645,6 +1676,15 @@ SYSTEM_FUNCS=" VirtualAlloc " +SYSTEM_LIBRARIES=" + sdl + vaapi_1 + vaapi_drm + vaapi_x11 + vdpau_x11 + wincrypt +" + TOOLCHAIN_FEATURES=" as_arch_directive as_fpu_directive @@ -1692,20 +1732,12 @@ HAVE_LIST=" $HEADERS_LIST $INTRINSICS_LIST $MATH_FUNCS + $SYSTEM_FEATURES $SYSTEM_FUNCS + $SYSTEM_LIBRARIES $THREADS_LIST $TOOLCHAIN_FEATURES $TYPES_LIST - dos_paths - libc_msvcrt - MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS - sdl - section_data_rel_ro - threads - uwp - vaapi_drm - vaapi_x11 - vdpau_x11 " # options emitted with CONFIG_ prefix but not available on the command line @@ -2186,8 +2218,6 @@ h264_d3d11va2_hwaccel_deps="d3d11va" h264_d3d11va2_hwaccel_select="h264_decoder" h264_dxva2_hwaccel_deps="dxva2" h264_dxva2_hwaccel_select="h264_decoder" -h264_mmal_hwaccel_deps="mmal" -h264_qsv_hwaccel_deps="libmfx" h264_vaapi_hwaccel_deps="vaapi" h264_vaapi_hwaccel_select="h264_decoder" h264_vda_hwaccel_deps="vda" @@ -2204,7 +2234,6 @@ hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC" hevc_d3d11va2_hwaccel_select="hevc_decoder" hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC" hevc_dxva2_hwaccel_select="hevc_decoder" -hevc_qsv_hwaccel_deps="libmfx" hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC" hevc_vaapi_hwaccel_select="hevc_decoder" hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC" @@ -2217,8 +2246,6 @@ mpeg2_d3d11va2_hwaccel_deps="d3d11va" mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder" mpeg2_dxva2_hwaccel_deps="dxva2" mpeg2_dxva2_hwaccel_select="mpeg2video_decoder" -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" @@ -2233,13 +2260,10 @@ vc1_d3d11va2_hwaccel_deps="d3d11va" vc1_d3d11va2_hwaccel_select="vc1_decoder" vc1_dxva2_hwaccel_deps="dxva2" vc1_dxva2_hwaccel_select="vc1_decoder" -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" @@ -2249,6 +2273,7 @@ wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel" # hardware-accelerated codecs +amf_deps_any="libdl LoadLibrary" nvenc_deps_any="libdl LoadLibrary" omx_deps="libdl pthreads" omx_rpi_select="omx" @@ -2261,15 +2286,17 @@ vaapi_encode_deps="vaapi" hwupload_cuda_filter_deps="cuda" scale_npp_filter_deps="cuda libnpp" +h264_amf_encoder_deps="amf" h264_mmal_decoder_deps="mmal" h264_nvenc_encoder_deps="nvenc" h264_omx_encoder_deps="omx" -h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel" +h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec" h264_qsv_encoder_select="qsvenc" h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264" h264_vaapi_encoder_select="cbs_h264 vaapi_encode" +hevc_amf_encoder_deps="amf" hevc_nvenc_encoder_deps="nvenc" -hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser hevc_qsv_hwaccel qsvdec" +hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec" hevc_qsv_encoder_select="hevcparse qsvenc" hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC" hevc_vaapi_encoder_select="cbs_h265 vaapi_encode" @@ -2278,14 +2305,14 @@ mjpeg_qsv_encoder_select="qsvenc" mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG" mjpeg_vaapi_encoder_select="vaapi_encode jpegtables" mpeg2_mmal_decoder_deps="mmal" -mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel mpegvideo_parser" +mpeg2_qsv_decoder_select="qsvdec mpegvideo_parser" mpeg2_qsv_encoder_select="qsvenc" mpeg2_vaapi_encoder_deps="VAEncPictureParameterBufferMPEG2" mpeg2_vaapi_encoder_select="cbs_mpeg2 vaapi_encode" mpeg4_omx_encoder_deps="omx" vc1_mmal_decoder_deps="mmal" -vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel vc1_parser" -vp8_qsv_decoder_select="qsvdec vp8_qsv_hwaccel vp8_parser" +vc1_qsv_decoder_select="qsvdec vc1_parser" +vp8_qsv_decoder_select="qsvdec vp8_parser" vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8" vp8_vaapi_encoder_select="vaapi_encode" vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9" @@ -2433,24 +2460,19 @@ wtv_demuxer_select="mpegts_demuxer riffdec" xmv_demuxer_select="riffdec" xwma_demuxer_select="riffdec" -# indevs / outdevs +# indevs 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="libjack" jack_indev_deps_any="sem_timedwait dispatch_dispatch_h" libcdio_indev_deps="libcdio" libdc1394_indev_deps="libdc1394" oss_indev_deps_any="sys_soundcard_h" -oss_outdev_deps_any="sys_soundcard_h" pulse_indev_deps="libpulse" sndio_indev_deps="sndio" -sndio_outdev_deps="sndio" v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" vfwcap_indev_deps="vfw32 vfwcap_defines" xcbgrab_indev_deps="libxcb libxcb_shape" @@ -2603,6 +2625,7 @@ pkg_config_default=pkg-config ranlib="ranlib" strip="strip" version_script='--version-script' +objformat="elf32" # machine arch_default=$(uname -m) @@ -2711,11 +2734,9 @@ find_things(){ ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c) DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c) -HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c) PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c) MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c) DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c) -OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c) INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c) FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c) @@ -2727,6 +2748,7 @@ find_things_extern(){ } BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c) +HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h) PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c) AVCODEC_COMPONENTS_LIST=" @@ -2739,7 +2761,6 @@ AVCODEC_COMPONENTS_LIST=" AVDEVICE_COMPONENTS_LIST=" $INDEV_LIST - $OUTDEV_LIST " AVFILTER_COMPONENTS_LIST=" @@ -2800,7 +2821,7 @@ for opt do add_extralibs $optval ;; --disable-devices) - disable $INDEV_LIST $OUTDEV_LIST + disable $INDEV_LIST ;; --enable-debug=*) debuglevel="$optval" @@ -2869,6 +2890,19 @@ done disabled logging && logfile=/dev/null +# command line configuration sanity checks + +# we need to build at least one lib type +if ! enabled_any static shared; then + cat </dev/null | grep -Eq 'TMS470|TI ARM'; then - _type=tms470 - _ident=$($_cc -version | head -n1 | tr -s ' ') - _flags='--gcc --abi=eabi -me' - _cc_e='-ppl -fe=$@' - _cc_o='-fe=$@' - _depflags='-ppa -ppd=$(@:.o=.d)' - _cflags_speed='-O3 -mf=5' - _cflags_size='-O3 -mf=2' - _flags_filter=tms470_flags elif $_cc -v 2>&1 | grep -q clang; then _type=clang _ident=$($_cc --version 2>/dev/null | head -n1) @@ -3333,14 +3331,6 @@ probe_cc(){ _cflags_speed='-O2' _cflags_size='-Os' _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros' - elif $_cc -V 2>&1 | grep -q Portland; then - _type=pgi - _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')" - opt_common='-alias=ansi -Mdse -Mlre -Mpre' - _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common" - _cflags_size="-O2 -Munroll=c:1 $opt_common" - _cflags_noopt="-O1" - _flags_filter=pgi_flags elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then _type=armasm _ident=$($_cc | head -n1) @@ -3486,12 +3476,6 @@ fi if $ar 2>&1 | grep -q Microsoft; then arflags="-nologo" ar_o='-out:$@' -elif $ar 2>&1 | grep -q 'Texas Instruments'; then - arflags="rq" - ar_o='$@' -elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then - arflags='-Xany -r -c' - ar_o='$@' else arflags="rc" ar_o='$@' @@ -3507,10 +3491,6 @@ if test -n "$sysroot"; then add_cppflags --sysroot="$sysroot" add_ldflags --sysroot="$sysroot" ;; - tms470) - add_cppflags -I"$sysinclude" - add_ldflags --sysroot="$sysroot" - ;; esac fi @@ -3602,7 +3582,7 @@ elif enabled alpha; then elif enabled arm; then check_arm_arch() { - check_cpp_condition stddef.h \ + test_cpp_condition stddef.h \ "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \ $cpuflags } @@ -3795,7 +3775,7 @@ if [ "$cpu" != generic ]; then fi # compiler sanity check -check_exec <= 201112L" -std=c11 && +test_cpp_condition stdlib.h "__STDC_VERSION__ >= 201112L" -std=c11 && add_cflags -std=c11 || check_cflags -std=c99 @@ -3826,54 +3806,52 @@ check_host_cflags $host_cflags_speed check_64bit(){ arch32=$1 arch64=$2 - expr=$3 - check_code cc "" "int test[2*($expr) - 1]" && + expr=${3:-'sizeof(void *) > 4'} + test_code cc "" "int test[2*($expr) - 1]" && subarch=$arch64 || subarch=$arch32 + enable $subarch } case "$arch" in aarch64|alpha|ia64) - spic=$shared + enabled shared && enable_weak pic ;; mips) check_64bit mips mips64 '_MIPS_SIM > 1' - spic=$shared + enabled shared && enable_weak pic ;; parisc) - check_64bit parisc parisc64 'sizeof(void *) > 4' - spic=$shared + check_64bit parisc parisc64 + enabled shared && enable_weak pic ;; ppc) - check_64bit ppc ppc64 'sizeof(void *) > 4' - spic=$shared + check_64bit ppc ppc64 + enabled shared && enable_weak pic ;; s390) - check_64bit s390 s390x 'sizeof(void *) > 4' - spic=$shared + check_64bit s390 s390x + enabled shared && enable_weak pic ;; sparc) - check_64bit sparc sparc64 'sizeof(void *) > 4' - spic=$shared + check_64bit sparc sparc64 + enabled shared && enable_weak pic ;; x86) - check_64bit x86_32 x86_64 'sizeof(void *) > 4' - if test "$subarch" = "x86_64"; then - spic=$shared + check_64bit x86_32 x86_64 + if enabled x86_64; then + enabled shared && enable_weak pic + objformat=elf64 fi ;; esac -enable $subarch -enabled spic && enable_weak pic - -enabled x86_64 && objformat=elf64 || objformat="elf32" - # OS specific case $target_os in aix) SHFLAGS=-shared add_cppflags '-I\$(SRC_PATH)/compat/aix' enabled shared && add_ldflags -Wl,-brtl + arflags='-Xany -r -c' ;; android) disable symver @@ -3889,7 +3867,7 @@ case $target_os in ;; sunos) SHFLAGS='-shared -Wl,-h,$$(@F)' - enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS" + enabled x86 && append SHFLAGS -mimpure-text network_extralibs="-lsocket -lnsl" # When using suncc to build, the Solaris linker will mark # an executable with each instruction set encountered by @@ -3906,7 +3884,6 @@ case $target_os in netbsd) disable symver oss_indev_extralibs="-lossaudio" - oss_outdev_extralibs="-lossaudio" ;; openbsd|bitrig) disable symver @@ -3914,7 +3891,6 @@ case $target_os in SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)' SLIB_INSTALL_LINKS= oss_indev_extralibs="-lossaudio" - oss_outdev_extralibs="-lossaudio" ;; dragonfly) disable symver @@ -3951,9 +3927,13 @@ case $target_os in LIBTARGET=i386 if enabled x86_64; then LIBTARGET="i386:x86-64" + elif enabled arm; then + LIBTARGET="arm" + elif enabled aarch64; then + LIBTARGET="arm64" fi if enabled shared; then - # Cannot build both shared and static libs when using dllexport. + # Cannot build both shared and static libs when using dllimport. disable static fi check_ldflags -Wl,--nxcompat @@ -3968,7 +3948,7 @@ case $target_os in SLIB_INSTALL_LINKS= SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)' - SLIB_CREATE_DEF_CMD='ARCH="$(ARCH)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' + SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-auto-image-base $$(@:$(SLIBSUF)=.def)' enabled x86_64 && objformat="win64" || objformat="win32" dlltool="${cross_prefix}dlltool" @@ -3989,7 +3969,7 @@ case $target_os in SLIBSUF=".dll" 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_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)' SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)' SLIB_INSTALL_LINKS= SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)' @@ -4020,7 +4000,6 @@ case $target_os in add_cppflags -U__STRICT_ANSI__ ;; linux) - enable dv1394 enable section_data_rel_ro ;; irix*) @@ -4084,38 +4063,38 @@ probe_libc(){ pfx=$1 pfx_no_=${pfx%_} # uclibc defines __GLIBC__, so it needs to be checked before glibc. - if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then + if test_${pfx}cpp_condition features.h "defined __UCLIBC__"; then eval ${pfx}libc_type=uclibc add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 - elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then + elif test_${pfx}cpp_condition features.h "defined __GLIBC__"; then eval ${pfx}libc_type=glibc add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 # MinGW headers can be installed on Cygwin, so check for newlib first. - elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then + elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then eval ${pfx}libc_type=newlib 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 + elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then eval ${pfx}libc_type=mingw64 add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1 eval test \$${pfx_no_}cc_type = "gcc" && add_${pfx}cppflags -D__printf__=__gnu_printf__ - elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" || - check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then + elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" || + test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then eval ${pfx}libc_type=mingw32 - check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \ + test_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \ (__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" && + test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" && add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700 - check_${pfx}cpp_condition windows.h "defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0502" && + test_${pfx}cpp_condition windows.h "defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0502" && add_${pfx}cppflags -D_WIN32_WINNT=0x0502 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 + elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then eval ${pfx}libc_type=msvcrt - if check_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then + if test_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then if [ "$pfx" = host_ ]; then add_host_cppflags -Dsnprintf=_snprintf else @@ -4136,8 +4115,8 @@ probe_libc(){ # family. For these cases, configure is free to use any functions # found in the SDK headers by default. (Alternatively, we could force # _WIN32_WINNT to 0x0602 in that case.) - check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" || - { check_${pfx}cpp < #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) @@ -4148,23 +4127,22 @@ EOF if [ "$pfx" = "" ]; then check_func strtoll || add_cflags -Dstrtoll=_strtoi64 fi - elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then + elif test_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then eval ${pfx}libc_type=klibc - elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then + elif test_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then eval ${pfx}libc_type=bionic - elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then + elif test_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then eval ${pfx}libc_type=solaris add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600 else eval ${pfx}libc_type=default add_${pfx}cppflags -D_DEFAULT_SOURCE fi + eval test -n "\${${pfx}libc_type}" && enable ${pfx}libc_${libc_type} } probe_libc -test -n "$libc_type" && enable libc_$libc_type probe_libc host_ -test -n "$host_libc_type" && enable host_libc_$host_libc_type # hacks for compiler/libc/os combinations @@ -4172,42 +4150,16 @@ case $libc_type in bionic) add_compat strtod.o strtod=avpriv_strtod ;; - glibc) - if enabled tms470; then - CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}" - add_cppflags -D__USER_LABEL_PREFIX__= - add_cppflags -D__builtin_memset=memset - add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED - add_cflags -pds=48 # incompatible redefinition of macro - fi - ;; esac check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" || add_cppflags '-I\$(SRC_PATH)/compat/float' -esc(){ - echo "$*" | sed 's/%/%25/g;s/:/%3a/g' -} - -echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" > avbuild/config.fate - -check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic +test_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic set_default $PATHS_LIST set_default nm -# we need to build at least one lib type -if ! enabled_any static shared; then - cat <= 30"; then - enable vfp_args - elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then + if check_cpp_condition vfp_args stddef.h "defined __ARM_PCS_VFP"; then + : + elif check_cpp_condition vfp_args stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then + : + elif ! test_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then case "${cross_prefix:-$cc}" in *hardfloat*) enable vfp_args; fpabi=vfp ;; - *) check_ld <= 0x0001000400040001" enabled avisynth && require_header avisynth/avisynth_c.h enabled avxsynth && require_header avxsynth/avxsynth_c.h enabled cuda && require cuda cuda.h cuInit -lcuda enabled cuvid && require cuvid cuviddec.h cuvidCreateDecoder -lnvcuvid enabled frei0r && require_header frei0r.h -enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init +enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init && + check_lib gmp gmp.h mpz_export -lgmp enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec @@ -4734,8 +4678,7 @@ enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFil enabled libwebp && require_pkg_config libwebp libwebp webp/encode.h WebPGetEncoderVersion enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode && require_cpp_condition x264.h "X264_BUILD >= 118" && - { check_cpp_condition x264.h "X264_MPEG2" && - enable libx262; } + check_cpp_condition libx262 x264.h "X264_MPEG2" enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get && require_cpp_condition x265.h "X265_BUILD >= 57" enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs @@ -4759,15 +4702,10 @@ enabled openssl && { { check_pkg_config openssl openssl openssl/ssl.h 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 - # 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 -! 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 @@ -4780,26 +4718,23 @@ 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 +check_cpp_condition vfwcap_defines vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" # check for ioctl_meteor.h, ioctl_bt848.h and alternatives -{ check_header dev/bktr/ioctl_meteor.h && - check_header dev/bktr/ioctl_bt848.h; } || -{ check_header machine/ioctl_meteor.h && - check_header machine/ioctl_bt848.h; } || -{ check_header dev/video/meteor/ioctl_meteor.h && - check_header dev/video/bktr/ioctl_bt848.h; } || -check_header dev/ic/bt8xx.h +check_header "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h" || + check_header "machine/ioctl_meteor.h machine/ioctl_bt848.h" || + check_header "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" || + check_header "dev/ic/bt8xx.h" check_header sys/soundcard.h -enabled_any alsa_indev alsa_outdev && +enabled alsa_indev && check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound enabled libjack && require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range -enabled_any sndio_indev sndio_outdev && check_lib sndio sndio.h sio_open -lsndio +enabled sndio_indev && check_lib sndio sndio.h sio_open -lsndio if enabled libcdio; then check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio || @@ -4818,7 +4753,7 @@ fi # d3d11va requires linking directly to dxgi and d3d11 if not building for # the desktop api partition -check_cpp < #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) @@ -4833,19 +4768,18 @@ EOF 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 - -enabled vaapi && - check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm +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 +fi enabled vaapi && - check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11 + test_cpp_condition "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" && + enable vaapi_1 enabled vdpau && - check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" || - disable vdpau + check_cpp_condition vdpau vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" enabled vdpau && check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11 @@ -4890,9 +4824,7 @@ check_disable_warning_headers -Wno-unused-variable check_objcflags -fobjc-arc && enable objc_arc -check_cc < $TMPV if test_ldflags -Wl,${version_script},$TMPV; then append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver' - check_cc <= 1400" && + test_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" && add_cflags -Qansi-alias # icl will pass the inline asm tests but inline asm is currently # not supported (build will fail) disable inline_asm fi # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2. - check_cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION >= 12" || disable log2 + check_cpp_condition log2 crtversion.h "_VC_CRT_MAJOR_VERSION >= 12" # The CRT headers contain __declspec(restrict) in a few places, but if redefining # restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict) # (as it ends up if the restrict redefine is done before including stdlib.h), while # MSVC 2013 and newer can handle it fine. # If this declspec fails, force including stdlib.h before the restrict redefinition # happens in config.h. - if [ $_restrict != restrict ]; then - check_cc < Makefile +esc(){ + echo "$*" | sed 's/%/%25/g;s/:/%3a/g' +} + +echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" > avbuild/config.fate + config_files="$TMPH avbuild/config.mak" cat > avbuild/config.mak < $TMPH <> $TMPH + test -n "$malloc_prefix" && echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH if enabled x86asm; then append config_files $TMPASM - printf '' >$TMPASM + cat > $TMPASM <> $TMPH @@ -5448,7 +5377,7 @@ touch avbuild/.config enabled x86asm && cp_if_changed $TMPASM config.asm cat > $TMPH < avbuild/config.sh < $TMPH <> avbuild/config.sh + echo ${lib}_deps=\"$lib_deps\" >> $TMPH done + +cp_if_changed $TMPH avbuild/config.sh