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
}
}
requested(){
- test "${1#!}" = "$1" && op='=' || op=!=
+ test "${1#!}" = "$1" && op="=" || op="!="
eval test "x\$${1#!}_requested" $op "xyes"
}
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"
}
test_ldflags(){
log test_ldflags "$@"
+ set -- $($ldflags_filter "$@")
check_ld "cc" "$@" <<EOF
int main(void){ return 0; }
EOF
check_header(){
log check_header "$@"
- header=$1
+ headers=$1
shift
- disable_sanitized $header
- check_cpp "$@" <<EOF && enable_sanitized $header
-#include <$header>
-int x;
-EOF
+ disable_sanitized $headers
+ {
+ for hdr in $headers; do
+ print_include $hdr
+ done
+ echo "int x;"
+ } | check_cpp "$@" && enable_sanitized $headers
}
check_header_objcc(){
enable $name && eval ${name}_extralibs="\$@"
}
-check_pkg_config(){
- log check_pkg_config "$@"
+test_pkg_config(){
+ log test_pkg_config "$@"
name="$1"
pkg_version="$2"
pkg="${2%% *}"
set_sanitized "${name}_extralibs" $pkg_libs
}
+check_pkg_config(){
+ log check_pkg_config "$@"
+ name="$1"
+ test_pkg_config "$@" &&
+ eval add_cflags \$${name}_cflags
+}
+
check_exec(){
check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
}
}
require_header(){
- log require "$@"
- header="$1"
+ log require_header "$@"
+ headers="$1"
shift
- check_header "$header" "$@" || die "ERROR: $header header not found"
+ check_header "$headers" "$@" || die "ERROR: $headers not found"
}
require_cpp_condition(){
- log require "$@"
+ log require_cpp_condition "$@"
header="$1"
condition="$2"
shift 2
check_cpp_condition "$header" "$condition" "$@" || die "ERROR: $condition not satisfied"
}
-use_pkg_config(){
- log use_pkg_config "$@"
- name="$1"
- check_pkg_config "$@" || return 1
- add_cflags $(get_sanitized "${name}_cflags")
-}
-
require_pkg_config(){
log require_pkg_config "$@"
pkg_version="$2"
- use_pkg_config "$@" || die "ERROR: $pkg_version not found using pkg-config$pkg_config_fail_message"
+ check_pkg_config "$@" || die "ERROR: $pkg_version not found using pkg-config$pkg_config_fail_message"
}
hostcc_e(){
protocols
"
-AVRESAMPLE_COMPONENTS=""
-
-AVUTIL_COMPONENTS=""
-
COMPONENT_LIST="
$AVCODEC_COMPONENTS
$AVDEVICE_COMPONENTS
$AVFILTER_COMPONENTS
$AVFORMAT_COMPONENTS
- $AVRESAMPLE_COMPONENTS
- $AVUTIL_COMPONENTS
"
EXAMPLE_LIST="
cdio_paranoia_h
cdio_paranoia_paranoia_h
cuda_h
- d3d11_h
dispatch_dispatch_h
dev_bktr_ioctl_bt848_h
dev_bktr_ioctl_meteor_h
dev_video_meteor_ioctl_meteor_h
direct_h
dirent_h
- dlfcn_h
dxgidebug_h
dxva_h
ES2_gl_h
gsm_h
io_h
- mach_mach_time_h
machine_ioctl_bt848_h
machine_ioctl_meteor_h
malloc_h
opencv2_core_core_c_h
OpenGL_gl3_h
poll_h
- soundcard_h
- stdatomic_h
- sys_mman_h
sys_param_h
sys_resource_h
sys_select_h
truncf
"
+SYSTEM_FEATURES="
+ atomics_native
+ dos_paths
+ libc_msvcrt
+ MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS
+ section_data_rel_ro
+ threads
+ uwp
+ winrt
+"
+
SYSTEM_FUNCS="
access
aligned_malloc
clock_gettime
closesocket
CommandLineToArgvW
- CoTaskMemFree
- CryptGenRandom
fcntl
- flt_lim
- fork
getaddrinfo
gethrtime
getopt
inet_aton
isatty
kbhit
- LoadLibrary
localtime_r
lstat
lzo1x_999_compress
posix_memalign
pthread_cancel
sched_getaffinity
+ SecItemImport
SetConsoleTextAttribute
SetConsoleCtrlHandler
setmode
wglGetProcAddress
"
+SYSTEM_LIBRARIES="
+ vaapi_drm
+ vaapi_x11
+ vdpau_x11
+ wincrypt
+"
+
TOOLCHAIN_FEATURES="
as_arch_directive
as_fpu_directive
as_func
as_object_arch
asm_mod_q
- attribute_may_alias
- attribute_packed
blocks_extension
ebp_available
ebx_available
$HEADERS_LIST
$INTRINSICS_LIST
$MATH_FUNCS
+ $SYSTEM_FEATURES
$SYSTEM_FUNCS
+ $SYSTEM_LIBRARIES
$THREADS_LIST
$TOOLCHAIN_FEATURES
$TYPES_LIST
- atomics_native
- dos_paths
- libc_msvcrt
makeinfo
makeinfo_html
- MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS
perl
pod2man
- section_data_rel_ro
texi2html
- threads
- uwp
- vaapi_drm
- vaapi_x11
- vdpau_x11
- winrt
"
# options emitted with CONFIG_ prefix but not available on the command line
crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
cuda_deps_any="libdl LoadLibrary"
cuvid_deps="cuda"
-d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder ID3D11VideoContext"
+d3d11va_deps="dxva_h ID3D11VideoDecoder ID3D11VideoContext"
dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode ole32 user32"
videotoolbox_hwaccel_deps="videotoolbox pthreads"
videotoolbox_hwaccel_extralibs="-framework QuartzCore"
vp9_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_VP9"
vp9_dxva2_hwaccel_select="vp9_decoder"
vp9_mediacodec_hwaccel_deps="mediacodec"
+vp9_nvdec_hwaccel_deps="cuda nvdec"
+vp9_nvdec_hwaccel_select="vp9_decoder"
vp9_vaapi_hwaccel_deps="vaapi VADecPictureParameterBufferVP9_bit_depth"
vp9_vaapi_hwaccel_select="vp9_decoder"
wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
libdc1394_indev_deps="libdc1394"
openal_indev_deps="openal"
opengl_outdev_deps="opengl"
-oss_indev_deps_any="soundcard_h sys_soundcard_h"
-oss_outdev_deps_any="soundcard_h sys_soundcard_h"
+oss_indev_deps_any="sys_soundcard_h"
+oss_outdev_deps_any="sys_soundcard_h"
pulse_indev_deps="libpulse"
pulse_outdev_deps="libpulse"
sdl2_outdev_deps="sdl2"
disabled logging && logfile=/dev/null
+# we need to build at least one lib type
+if ! enabled_any static shared; then
+ cat <<EOF
+At least one library type must be built.
+Specify --enable-static to build the static libraries or --enable-shared to
+build the shared libraries as well. To only build the shared libraries specify
+--disable-static in addition to --enable-shared.
+EOF
+ exit 1
+fi
+
die_license_disabled() {
enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
}
nm_default="dumpbin -symbols"
ar_default="lib"
case "$arch" in
+ aarch64|arm64)
+ as_default="armasm64"
+ ;;
arm*)
as_default="armasm"
;;
done
}
-ccc_flags(){
- for flag; do
- case $flag in
- -std=c99) echo -c99 ;;
- -mcpu=*) echo -arch ${flag#*=} ;;
- -mieee) echo -ieee ;;
- -O*|-fast) echo $flag ;;
- -fno-math-errno) echo -assume nomath_errno ;;
- -g) echo -g3 ;;
- -Wall) echo -msg_enable level2 ;;
- -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
- -Wl,*) echo $flag ;;
- -f*|-W*) ;;
- *) echo $flag ;;
- esac
- done
-}
-
cparser_flags(){
for flag; do
case $flag in
done
}
-pgi_flags(){
- for flag; do
- case $flag in
- -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
- -fomit-frame-pointer) echo -Mnoframe ;;
- -g) echo -gopt ;;
- *) echo $flag ;;
- esac
- done
-}
-
suncc_flags(){
for flag; do
case $flag in
done
}
-tms470_flags(){
- for flag; do
- case $flag in
- -march=*|-mcpu=*)
- case "${flag#*=}" in
- armv7-a|cortex-a*) echo -mv=7a8 ;;
- armv7-r|cortex-r*) echo -mv=7r4 ;;
- armv7-m|cortex-m*) echo -mv=7m3 ;;
- armv6*|arm11*) echo -mv=6 ;;
- armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
- echo -mv=5e ;;
- armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
- esac
- ;;
- -mfpu=neon) echo --float_support=vfpv3 --neon ;;
- -mfpu=vfp) echo --float_support=vfpv2 ;;
- -mfpu=vfpv3) echo --float_support=vfpv3 ;;
- -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
- -msoft-float) echo --float_support=vfplib ;;
- -O[0-3]|-mf=*) echo $flag ;;
- -g) echo -g -mn ;;
- -pds=*) echo $flag ;;
- -D*|-I*) echo $flag ;;
- --gcc|--abi=*) echo $flag ;;
- -me) echo $flag ;;
- esac
- done
-}
-
probe_cc(){
pfx=$1
_cc=$2
_ident=$($_cc -qversion 2>/dev/null | head -n1)
_cflags_speed='-O5'
_cflags_size='-O5 -qcompact'
- elif $_cc -V 2>/dev/null | grep -q Compaq; then
- _type=ccc
- _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
- _DEPFLAGS='-M'
- _cflags_speed='-fast'
- _cflags_size='-O1'
- _flags_filter=ccc_flags
elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
test -d "$sysroot" || die "No valid sysroot specified."
_type=armcc
_depflags='-MMD'
_cflags_speed='-O3'
_cflags_size='-Os'
- elif $_cc -version 2>/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)
_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="-O"
- _flags_filter=pgi_flags
elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
_type=armasm
_ident=$($_cc | head -n1)
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='$@'
elif $ar 2>&1 | grep -q "\[D\] "; then
arflags="rcD"
ar_o='$@'
add_cppflags --sysroot="$sysroot"
add_ldflags --sysroot="$sysroot"
;;
- tms470)
- add_cppflags -I"$sysinclude"
- add_ldflags --sysroot="$sysroot"
- ;;
esac
fi
SHFLAGS=-shared
add_cppflags '-I\$(SRC_PATH)/compat/aix'
enabled shared && add_ldflags -Wl,-brtl
+ arflags='-Xany -r -c'
;;
android)
disable symver
;;
mingw32*|mingw64*)
target_os=mingw32
- LIBTARGET=i386
- if enabled x86_64; then
- LIBTARGET="i386:x86-64"
- fi
if enabled shared; then
# Cannot build both shared and static libs when using dllexport.
disable static
SLIBSUF=".dll"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
- SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
+ SLIB_EXTRA_CMD='cp $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
SLIB_INSTALL_LINKS=
SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
SLIB_CREATE_DEF_CMD='ARCH="$(ARCH)" 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,--disable-auto-image-base $$(@:$(SLIBSUF)=.def)'
enabled x86_64 && objformat="win64" || objformat="win32"
- dlltool="${cross_prefix}dlltool"
ranlib=:
enable dos_paths
check_ldflags -Wl,--nxcompat,--dynamicbase
-l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
-l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
;;
- osf1)
- add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
- ;;
minix)
;;
none)
void *v = localtime_r;
EOF
+ 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
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
- elif enabled ccc; then
- add_ldflags -Wl,-z,now # calls to libots crash without this
- 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 $FFMPEG_CONFIGURATION)" > ffbuild/config.fate
-
check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
set_default libdir
set_default $PATHS_LIST
set_default nm
-# we need to build at least one lib type
-if ! enabled_any static shared; then
- cat <<EOF
-At least one library type must be built.
-Specify --enable-static to build the static libraries or --enable-shared to
-build the shared libraries as well. To only build the shared libraries specify
---disable-static in addition to --enable-shared.
-EOF
- exit 1
-fi
-
disabled optimizations || enabled ossfuzz || check_cflags -fomit-frame-pointer
enable_weak_pic() {
enable pic
add_cppflags -DPIC
case "$target_os" in
- mingw*|cygwin*)
+ mingw*|cygwin*|win*)
;;
*)
add_cflags -fPIC
+ add_asflags -fPIC
;;
esac
- add_asflags -fPIC
}
enabled pic && enable_weak_pic
void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
EOF
-check_cc <<EOF && enable attribute_packed
-struct { int x; } __attribute__((packed)) x;
-EOF
-
-check_cc <<EOF && enable attribute_may_alias
-union { int x; } __attribute__((may_alias)) x;
-EOF
-
check_cc <<EOF || die "endian test failed"
unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
EOF
.object_arch armv4
EOF
+ # MS armasm fails to assemble our PIC constructs
[ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
elif enabled mips; then
check_func getrusage
check_func gettimeofday
check_func isatty
-check_func mach_absolute_time
check_func mkstemp
check_func mmap
check_func mprotect
check_func_headers conio.h kbhit
check_func_headers io.h setmode
check_func_headers lzo/lzo1x.h lzo1x_999_compress
+check_func_headers mach/mach_time.h mach_absolute_time
check_func_headers stdlib.h getenv
check_func_headers sys/stat.h lstat
enabled xlib &&
check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
-check_header d3d11.h
check_header direct.h
check_header dirent.h
-check_header dlfcn.h
check_header dxgidebug.h
check_header dxva.h
check_header dxva2api.h -D_WIN32_WINNT=0x0600
check_header io.h
check_header libcrystalhd/libcrystalhd_if.h
-check_header mach/mach_time.h
check_header malloc.h
check_header net/udplite.h
check_header poll.h
-check_header sys/mman.h
check_header sys/param.h
check_header sys/resource.h
check_header sys/select.h
# 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, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0)"
+check_builtin stdatomic stdatomic.h "atomic_int foo, bar = ATOMIC_VAR_INIT(-1); atomic_store(&foo, 0)"
check_lib advapi32 "windows.h" RegCloseKey -ladvapi32
check_lib ole32 "windows.h" CoTaskMemFree -lole32
enabled libcaca && require_pkg_config libcaca caca caca.h caca_create_canvas
enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
enabled libdrm && require_pkg_config libdrm libdrm xf86drm.h drmGetVersion
-enabled libfdk_aac && { use_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen ||
+enabled libfdk_aac && { check_pkg_config libfdk_aac 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 libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
enabled libfribidi && require_pkg_config libfribidi fribidi fribidi.h fribidi_version_info
-enabled libgme && { use_pkg_config libgme libgme gme/gme.h gme_new_emu ||
+enabled libgme && { check_pkg_config libgme libgme gme/gme.h gme_new_emu ||
require libgme gme/gme.h gme_new_emu -lgme -lstdc++; }
enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
check_lib libgsm "${gsm_hdr}" gsm_create -lgsm && break;
# Media SDK or Intel Media Server Studio, these don't come with
# pkg-config support. Instead, users should make sure that the build
# can find the libraries and headers through other means.
-enabled libmfx && { use_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit ||
+enabled libmfx && { check_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit ||
{ require libmfx "mfx/mfxvideo.h" MFXInit "-llibmfx $advapi32_extralibs" && warn "using libmfx without pkg-config"; } }
enabled libmodplug && require_pkg_config libmodplug libmodplug libmodplug/modplug.h ModPlug_Load
enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
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 && { check_header opencv2/core/core_c.h &&
- { use_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
+ { check_pkg_config libopencv opencv opencv2/core/core_c.h cvCreateImageHeader ||
require libopencv opencv2/core/core_c.h cvCreateImageHeader -lopencv_core -lopencv_imgproc; } ||
require_pkg_config libopencv opencv opencv/cxcore.h cvCreateImageHeader; }
enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
-enabled libopenjpeg && { use_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
+enabled libopenjpeg && { check_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version ||
{ require_pkg_config libopenjpeg "libopenjp2 >= 2.1.0" openjpeg.h opj_version -DOPJ_STATIC && add_cppflags -DOPJ_STATIC; } }
enabled libopenmpt && require_pkg_config libopenmpt "libopenmpt >= 0.2.6557" libopenmpt/libopenmpt.h openmpt_module_create -lstdc++ && append libopenmpt_extralibs "-lstdc++"
enabled libopus && {
enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
enabled librubberband && require_pkg_config librubberband "rubberband >= 1.8.1" rubberband/rubberband-c.h rubberband_new -lstdc++ && append librubberband_extralibs "-lstdc++"
enabled libshine && require_pkg_config libshine shine shine/layer3.h shine_encode_buffer
-enabled libsmbclient && { use_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
+enabled libsmbclient && { check_pkg_config libsmbclient smbclient libsmbclient.h smbc_init ||
require libsmbclient libsmbclient.h smbc_init -lsmbclient; }
enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy -lstdc++
enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
enabled libssh && require_pkg_config libssh libssh libssh/sftp.h sftp_init
-enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init -lspeex
+enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
enabled libtesseract && require_pkg_config libtesseract 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 libvpx && {
enabled libvpx_vp8_decoder && {
- use_pkg_config libvpx_vp8_decoder "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
+ check_pkg_config libvpx_vp8_decoder "vpx >= 0.9.1" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx ||
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 libvpx_vp8_encoder "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
+ check_pkg_config libvpx_vp8_encoder "vpx >= 0.9.7" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx ||
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 libvpx_vp9_decoder "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
+ check_pkg_config libvpx_vp9_decoder "vpx >= 1.3.0" "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx ||
check_lib libvpx_vp9_decoder "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx
}
enabled libvpx_vp9_encoder && {
- use_pkg_config libvpx_vp9_encoder "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
+ check_pkg_config libvpx_vp9_encoder "vpx >= 1.3.0" "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx ||
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
enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
enabled libwebp && {
enabled libwebp_encoder && require_pkg_config libwebp "libwebp >= 0.2.0" webp/encode.h WebPGetEncoderVersion
- enabled libwebp_anim_encoder && use_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
-enabled libx264 && { use_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
+ enabled libwebp_anim_encoder && check_pkg_config libwebp_anim_encoder "libwebpmux >= 0.4.0" webp/mux.h WebPAnimEncoderOptionsInit; }
+enabled libx264 && { check_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode ||
{ require libx264 "stdint.h x264.h" x264_encoder_encode -lx264 &&
warn "using libx264 without pkg-config"; } } &&
require_cpp_condition x264.h "X264_BUILD >= 118" &&
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"; } && enable omx
-enabled openssl && { use_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
- use_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
+enabled openssl && { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
+ check_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
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 ||
if enabled sdl2; then
SDL2_CONFIG="${cross_prefix}sdl2-config"
- if check_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent; then
+ if test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent; then
check_func SDL_Init $sdl2_extralibs $sdl2_cflags ||
disable sdl2
elif "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
enabled securetransport &&
check_func SecIdentityCreate "-Wl,-framework,CoreFoundation -Wl,-framework,Security" &&
- check_lib securetransport "Security/SecureTransport.h Security/Security.h" "SSLCreateContext SecItemImport" "-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 &&
check_cpp_condition winerror.h "defined(SEC_I_CONTEXT_EXPIRED)" &&
check_type "dshow.h" IBaseFilter
# 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"
if check_struct sys/soundcard.h audio_buf_info bytes; then
enable_sanitized sys/soundcard.h
audio_buf_info abc;
EOF
fi
-check_header soundcard.h
-enabled alsa && use_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimestamp ||
+enabled alsa && check_pkg_config alsa alsa "alsa/asoundlib.h" snd_pcm_htimestamp ||
check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
enabled libjack &&
enabled sndio && check_lib sndio sndio.h sio_open -lsndio
if enabled libcdio; then
- use_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open ||
- use_pkg_config libcdio libcdio_paranoia "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open ||
+ check_pkg_config libcdio libcdio_paranoia "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open ||
+ check_pkg_config libcdio libcdio_paranoia "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open ||
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
-enabled libxcb && use_pkg_config libxcb "xcb >= 1.4" xcb/xcb.h xcb_connect ||
+enabled libxcb && check_pkg_config libxcb "xcb >= 1.4" xcb/xcb.h xcb_connect ||
disable libxcb_shm libxcb_shape libxcb_xfixes
if enabled libxcb; then
- enabled libxcb_shm && use_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach
- enabled libxcb_shape && use_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_get_rectangles
- enabled libxcb_xfixes && use_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
+ enabled libxcb_shm && check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach
+ enabled libxcb_shape && check_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_get_rectangles
+ enabled libxcb_xfixes && check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
fi
check_func_headers "windows.h" CreateDIBSection "$gdigrab_indev_extralibs"
check_cflags -falign-stack=maintain-16-byte ||
disable aligned_stack
fi
-elif enabled ccc; then
- # disable some annoying warnings
- add_cflags -msg_disable bitnotint
- add_cflags -msg_disable mixfuncvoid
- add_cflags -msg_disable nonstandcast
- add_cflags -msg_disable unsupieee
elif enabled gcc; then
check_optflags -fno-tree-vectorize
check_cflags -Werror=format-security
add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
-elif enabled tms470; then
- add_cflags -pds=824 -pds=837
- disable inline_asm
elif enabled pathscale; then
add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
disable inline_asm
;;
esac
-case $target_os in
- osf1)
- enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
- ;;
-esac
-
enable frame_thread_encoder
enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
fi
done
-if disabled stdatomic_h; then
+if disabled stdatomic; then
if enabled atomics_gcc; then
add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc'
elif enabled atomics_win32; then
echo "License: $license"
-echo "Creating configuration files ..."
-
fi # test "$quiet" != "yes"
+if test -n "$WARNINGS"; then
+ printf "\n%s%s$WARNINGS%s" "$warn_color" "$bold_color" "$reset_color"
+ enabled fatal_warnings && exit 1
+fi
+
test -e Makefile || echo "include $source_path/Makefile" > Makefile
+esc(){
+ echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
+}
+
+echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" > ffbuild/config.fate
+
enabled stripping || strip="echo skipping strip"
enabled stripping || striptype=""
X86ASM_O=$X86ASM_O
LD_LIB=$LD_LIB
LD_PATH=$LD_PATH
-DLLTOOL=$dlltool
WINDRES=$windres
DEPWINDRES=$dep_cc
DOXYGEN=$doxygen
EXTRALIBS=$extralibs
COMPAT_OBJS=$compat_objs
INSTALL=$install
-LIBTARGET=${LIBTARGET}
SLIBNAME=${SLIBNAME}
SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
if enabled x86asm; then
append config_files $TMPASM
- printf '' >$TMPASM
+ cat > $TMPASM <<EOF
+; Automatically generated by configure - do not modify!
+EOF
fi
enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
enabled x86asm && cp_if_changed $TMPASM config.asm
cat > $TMPH <<EOF
-/* Generated by ffconf */
+/* Generated by ffmpeg configure */
#ifndef AVUTIL_AVCONFIG_H
#define AVUTIL_AVCONFIG_H
EOF
print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
-if test -n "$WARNINGS"; then
- printf "\n%s%s$WARNINGS%s" "$warn_color" "$bold_color" "$reset_color"
- enabled fatal_warnings && exit 1
-fi
-
# Settings for pkg-config files
-cat > ffbuild/config.sh <<EOF
+cat > $TMPH <<EOF
# Automatically generated by configure - do not modify!
shared=$shared
build_suffix=$build_suffix
for lib in $LIBRARY_LIST; do
lib_deps="$(eval echo \$${lib}_deps)"
- echo ${lib}_deps=\"$lib_deps\" >> ffbuild/config.sh
+ echo ${lib}_deps=\"$lib_deps\" >> $TMPH
done
+
+cp_if_changed $TMPH ffbuild/config.sh