Newer
Older
check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
check_pkg_config(){
log check_pkg_config "$@"
pkg="$1"
headers="$2"
funcs="$3"
shift 3
check_cmd $pkg_config --exists --print-errors $pkg || return
pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
set_safe "${pkg}_cflags" $pkg_cflags &&
set_safe "${pkg}_libs" $pkg_libs
check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
}
code=$(cat)
# exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
# are safe but may not be available everywhere. Thus we use
# raise(SIGTERM) instead. The check is run in a subshell so we
# 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 <<EOF
#include <signal.h>
static void sighandler(int sig){
raise(SIGTERM);
}
int foo(void){
$code
}
signal(SIGILL, sighandler);
signal(SIGFPE, sighandler);
signal(SIGSEGV, sighandler);
#ifdef SIGBUS
signal(SIGBUS, sighandler);
#endif
check_type(){
log check_type "$@"
headers=$1
type=$2
shift 2
disable_safe "$type"
check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
log check_struct "$@"
headers=$1
struct=$2
member=$3
shift 3
disable_safe "${struct}_${member}"
check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
enable_safe "${struct}_${member}"
check_builtin(){
log check_builtin "$@"
name=$1
headers=$2
builtin=$3
shift 3
disable "$name"
check_code ld "$headers" "$builtin" "$@" && enable "$name"
}
check_compile_assert(){
log check_compile_assert "$@"
name=$1
headers=$2
condition=$3
shift 3
disable "$name"
check_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
}
require(){
name="$1"
header="$2"
func="$3"
shift 3
check_lib $header $func "$@" || die "ERROR: $name not found"
require2(){
name="$1"
headers="$2"
func="$3"
shift 3
check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
}
require_pkg_config(){
pkg="$1"
check_pkg_config "$@" || die "ERROR: $pkg not found"
add_cflags $(get_safe "${pkg}_cflags")
add_extralibs $(get_safe "${pkg}_libs")
hostcc_e(){
eval printf '%s\\n' $HOSTCC_E
}
hostcc_o(){
eval printf '%s\\n' $HOSTCC_O
}
check_host_cc(){
log check_host_cc "$@"
cat > $TMPC
log_file $TMPC
check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
check_host_cpp(){
log check_host_cpp "$@"
cat > $TMPC
log_file $TMPC
check_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC
check_host_cppflags(){
log check_host_cppflags "$@"
check_host_cc "$@" <<EOF && append host_cppflags "$@"
int x;
EOF
}
check_host_cflags(){
log check_host_cflags "$@"
set -- $($host_cflags_filter "$@")
check_host_cc "$@" <<EOF && append host_cflags "$@"
int x;
EOF
}
check_host_cpp_condition(){
log check_host_cpp_condition "$@"
header=$1
condition=$2
shift 2
check_host_cpp "$@" <<EOF
#include <$header>
#if !($condition)
#error "unsatisfied condition: $condition"
#endif
EOF
}
apply(){
file=$1
shift
"$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
}
cp_if_changed(){
cmp -s "$1" "$2" && echo "$2 is unchanged" && return
mkdir -p "$(dirname $2)"
Diego Biurrun
committed
# CONFIG_LIST contains configurable options, while HAVE_LIST is for
# system-dependent things.
AVCODEC_COMPONENTS="
bsfs
decoders
encoders
hwaccels
parsers
"
AVDEVICE_COMPONENTS="
indevs
outdevs
"
AVFILTER_COMPONENTS="
filters
"
AVFORMAT_COMPONENTS="
demuxers
muxers
protocols
"
AVRESAMPLE_COMPONENTS=""
AVUTIL_COMPONENTS=""
COMPONENT_LIST="
$AVCODEC_COMPONENTS
$AVDEVICE_COMPONENTS
$AVFILTER_COMPONENTS
$AVFORMAT_COMPONENTS
$AVRESAMPLE_COMPONENTS
$AVUTIL_COMPONENTS
"
EXAMPLE_LIST="
output_example
HWACCEL_LIBRARY_LIST="
cuda
d3d11va
dxva2
libmfx
libnpp
mmal
nvenc
omx
vaapi
vda
vdpau
"
EXTERNAL_LIBRARY_LIST="
avisynth
bzlib
frei0r
gnutls
libcdio
libdc1394
libfaac
libfdk_aac
libfreetype
libgsm
libilbc
libmp3lame
libopencore_amrnb
libopencore_amrwb
libopencv
libopenjpeg
libopus
libpulse
librtmp
libschroedinger
libspeex
libtheora
libvo_aacenc
libvo_amrwbenc
libvorbis
libvpx
libxcb
libxcb_shm
libxcb_xfixes
libxvid
openssl
x11grab
zlib
"
FEATURE_LIST="
gray
hardcoded_tables
runtime_cpudetect
safe_bitstream_reader
shared
small
sram
static
swscale_alpha
"
LIBRARY_LIST="
avcodec
avdevice
avfilter
avformat
avresample
avutil
swscale
"
LICENSE_LIST="
gpl
nonfree
version3
"
PROGRAM_LIST="
avconv
avplay
avprobe
"
SUBSYSTEM_LIST="
doc
error_resilience
lsp
network
rdft
"
CONFIG_LIST="
$COMPONENT_LIST
$EXAMPLE_LIST
$EXTERNAL_LIBRARY_LIST
$HWACCEL_LIBRARY_LIST
$FEATURE_LIST
$LICENSE_LIST
$LIBRARY_LIST
$PROGRAM_LIST
$SUBSYSTEM_LIST
neon_clobber_test
texi2html
valgrind_backtrace
pthreads
w32threads
alpha
avr32
avr32_ap
avr32_uc
bfin
ia64
m68k
mips
parisc
s390
sh4
sparc
sparc64
x86
x86_32
x86_64
armv5te
armv6
armv6t2
amd3dnow
amd3dnowext
fma4
mmx
mmxext
sse
sse2
sse3
sse4
sse42
ssse3
ARCH_EXT_LIST_PPC="
altivec
dcbzl
ldbrx
ARCH_EXT_LIST_X86="
$ARCH_EXT_LIST_X86_SIMD
cpunop
i686
"
ARCH_EXT_LIST_MIPS="
loongson
mips32r1
mips64r1
mips32r2
mips64r2
mips32r6
mips64r6
"
ARCH_EXT_LIST="
$ARCH_EXT_LIST_ARM
$ARCH_EXT_LIST_PPC
$ARCH_EXT_LIST_X86
ARCH_FEATURES="
aligned_stack
fast_64bit
fast_clz
fast_cmov
local_aligned_8
local_aligned_16
simd_align_16
"
BUILTIN_LIST="
atomic_cas_ptr
machine_rw_barrier
MemoryBarrier
mm_empty
rdtsc
sync_val_compare_and_swap
"
inline_asm
symver
yasm
alsa_asoundlib_h
altivec_h
arpa_inet_h
cdio_paranoia_h
cdio_paranoia_paranoia_h
dev_bktr_ioctl_bt848_h
dev_bktr_ioctl_meteor_h
dev_ic_bt8xx_h
dev_video_bktr_ioctl_bt848_h
dev_video_meteor_ioctl_meteor_h
direct_h
dlfcn_h
dxva_h
gsm_h
io_h
mach_mach_time_h
machine_ioctl_bt848_h
machine_ioctl_meteor_h
malloc_h
poll_h
sndio_h
soundcard_h
sys_mman_h
sys_param_h
sys_resource_h
sys_select_h
sys_soundcard_h
sys_time_h
sys_un_h
sys_videoio_h
unistd_h
valgrind_valgrind_h
windows_h
winsock2_h
"
INTRINSICS_LIST="
intrinsics_neon
"
atanf
atan2f
exp2
exp2f
isinf
isnan
llrint
llrintf
log2
log2f
lrint
lrintf
rint
round
roundf
trunc
truncf
"
aligned_malloc
clock_gettime
CommandLineToArgvW
Martin Storsjö
committed
getaddrinfo
getopt
GetProcessMemoryInfo
GetProcessTimes
jack_port_get_latency_range
localtime_r
mach_absolute_time
SetConsoleTextAttribute
setmode
sysconf
sysctl
usleep
VirtualAlloc
"
TOOLCHAIN_FEATURES="
asm_mod_q
attribute_may_alias
attribute_packed
ebp_available
ebx_available
gnu_as
ibm_asm
inline_asm_labels
pragma_deprecated
symver_asm_label
symver_gnu_asm
vfp_args
xform_asm
xmm_clobbers
"
TYPES_LIST="
CONDITION_VARIABLE_Ptr
struct_addrinfo
struct_group_source_req
struct_ip_mreq_source
struct_ipv6_mreq
struct_rusage_ru_maxrss
struct_sockaddr_in6
Ronald S. Bultje
committed
struct_sockaddr_sa_len
struct_sockaddr_storage
"
HAVE_LIST="
$ARCH_EXT_LIST
$(add_suffix _external $ARCH_EXT_LIST)
$(add_suffix _inline $ARCH_EXT_LIST)
$ARCH_FEATURES
$ATOMICS_LIST
$BUILTIN_LIST
$HAVE_LIST_CMDLINE
$HAVE_LIST_PUB
$HEADERS_LIST
$MATH_FUNCS
$SYSTEM_FUNCS
$THREADS_LIST
$TOOLCHAIN_FEATURES
$TYPES_LIST
atomics_native
dos_paths
libc_msvcrt
libdc1394_1
libdc1394_2
section_data_rel_ro
"
# options emitted with CONFIG_ prefix but not available on the command line
aandcttables
ac3dsp
blockdsp
dirac_parse
faandct
faanidct
gcrypt
golomb
h264chroma
h264dsp
h264pred
hpeldsp
huffman
huffyuvdsp
huffyuvencdsp
jpegtables
lpc
me_cmp
mpegaudiodsp
mpegvideo
mpegvideoenc
pixblockdsp
rangecoder
rtpdec
sinewin
startcode
$ARCH_EXT_LIST
$HAVE_LIST_CMDLINE
$THREADS_LIST
logging
optimizations
incdir
libdir
mandir
prefix
shlibdir
CMDLINE_SET="
$PATHS_LIST
build_suffix
cc
cpu
cross_prefix
extra_version
malloc_prefix
sysinclude
sysroot
CMDLINE_APPEND="
extra_cflags
host_cppflags
armv5te_deps="arm"
armv6_deps="arm"
neon_deps_any="aarch64 arm"
vfp_deps_any="aarch64 arm"
map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
altivec_deps="ppc"
ppc4xx_deps="ppc"
vsx_deps="altivec"
power8_deps="vsx"
cpunop_deps="i686"
x86_64_select="i686"
x86_64_suggest="fast_cmov"
amd3dnow_deps="mmx"
amd3dnowext_deps="amd3dnow"
sse_deps="mmxext"
sse2_deps="sse"
sse3_deps="sse2"
ssse3_deps="sse3"
sse4_deps="ssse3"
sse42_deps="sse4"
avx_deps="sse42"
fma4_deps="avx"
mmx_external_deps="yasm"
mmx_inline_deps="inline_asm"
mmx_suggest="mmx_external mmx_inline"
for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
eval dep=\$${ext}_deps
eval ${ext}_external_deps='"${dep}_external"'
eval ${ext}_inline_deps='"${dep}_inline"'
eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
done
aligned_stack_if_any="aarch64 ppc x86"
fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
fast_unaligned_if_any="aarch64 ppc x86"
simd_align_16_if_any="altivec neon sse"
# system capabilities
symver_if_any="symver_asm_label symver_gnu_asm"
valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
# threading support
atomics_gcc_if="sync_val_compare_and_swap"
atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
atomics_win32_if="MemoryBarrier"
atomics_native_if_any="$ATOMICS_LIST"
w32threads_deps="atomics_native"
threads_if_any="$THREADS_LIST"
# subsystems
dirac_parse_select="golomb"
error_resilience_select="me_cmp"
faandct_deps="faan fdctdsp"
faanidct_deps="faan idctdsp"
h264dsp_select="startcode"
intrax8_select="blockdsp idctdsp"
mdct_select="fft"
rdft_select="fft"
me_cmp_select="fdctdsp idctdsp pixblockdsp"
mpeg_er_select="error_resilience"
mpegaudio_select="mpegaudiodsp"
mpegaudiodsp_select="dct"
mpegvideo_select="blockdsp hpeldsp idctdsp me_cmp mpeg_er videodsp"
mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
vc1dsp_select="h264chroma qpeldsp startcode"
# decoders / encoders
aac_decoder_select="imdct15 mdct sinewin"
aac_encoder_select="audio_frame_queue iirfilter mdct sinewin"
aac_latm_decoder_select="aac_decoder aac_latm_parser"
ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
adpcm_g722_decoder_select="g722dsp"
adpcm_g722_encoder_select="g722dsp"
aic_decoder_select="golomb idctdsp"
alac_encoder_select="lpc"
als_decoder_select="bswapdsp"
amrnb_decoder_select="lsp"
amrwb_decoder_select="lsp"
amv_decoder_select="sp5x_decoder"
ape_decoder_select="bswapdsp"
asv1_decoder_select="blockdsp bswapdsp idctdsp"
asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
asv2_decoder_select="blockdsp bswapdsp idctdsp"
asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
atrac1_decoder_select="mdct sinewin"
atrac3_decoder_select="mdct"
bink_decoder_select="blockdsp hpeldsp"
binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
cllc_decoder_select="bswapdsp"
comfortnoise_encoder_select="lpc"
cook_decoder_select="audiodsp mdct sinewin"
cscd_decoder_select="lzo"
dca_decoder_select="fmtconvert mdct"
dnxhd_decoder_select="blockdsp idctdsp"
dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
dvvideo_decoder_select="dvprofile idctdsp"
dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
dxa_decoder_deps="zlib"
eac3_decoder_select="ac3_decoder"
eac3_encoder_select="ac3_encoder"
eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
eatgq_decoder_select="aandcttables idctdsp"
eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
ffv1_decoder_select="golomb rangecoder"
ffv1_encoder_select="rangecoder"
Diego Biurrun
committed
ffvhuff_decoder_select="huffyuv_decoder"
ffvhuff_encoder_select="huffyuv_encoder"
flac_decoder_select="flacdsp golomb"
flac_encoder_select="bswapdsp flacdsp golomb lpc"
flashsv_decoder_deps="zlib"
flashsv_encoder_deps="zlib"
flashsv2_decoder_deps="zlib"
flv_decoder_select="h263_decoder"
flv_encoder_select="h263_encoder"
fourxm_decoder_select="blockdsp bswapdsp"
fraps_decoder_select="bswapdsp huffman"
g2m_decoder_deps="zlib"
g2m_decoder_select="blockdsp idctdsp jpegtables"
h261_decoder_select="mpeg_er mpegvideo"
h261_encoder_select="aandcttables mpegvideoenc"
h263_decoder_select="error_resilience h263_parser h263dsp mpeg_er mpegvideo qpeldsp"
h263_encoder_select="aandcttables h263dsp mpegvideoenc"
h263i_decoder_select="h263_decoder"
h263p_encoder_select="h263_encoder"
h264_decoder_select="cabac golomb h264chroma h264dsp h264parse h264pred h264qpel videodsp"
h264_decoder_suggest="error_resilience"
hap_decoder_select="snappy texturedsp"
hap_encoder_deps="libsnappy"
hap_encoder_select="texturedspenc"
hevc_decoder_select="bswapdsp cabac golomb videodsp"
huffyuv_decoder_select="bswapdsp huffyuvdsp"
huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp"
iac_decoder_select="imc_decoder"
imc_decoder_select="bswapdsp fft mdct sinewin"
indeo3_decoder_select="hpeldsp"
indeo4_decoder_select="ividsp"
indeo5_decoder_select="ividsp"
interplay_video_decoder_select="hpeldsp"
jpegls_decoder_select="golomb mjpeg_decoder"
jpegls_encoder_select="golomb"
jv_decoder_select="blockdsp"
lagarith_decoder_select="huffyuvdsp"
ljpeg_encoder_select="aandcttables idctdsp jpegtables"
loco_decoder_select="golomb"
mdec_decoder_select="blockdsp idctdsp mpegvideo"
metasound_decoder_select="lsp mdct sinewin"
mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
mjpeg_decoder_select="blockdsp hpeldsp idctdsp jpegtables"
mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
mjpegb_decoder_select="mjpeg_decoder"
mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
mjpeg_vaapi_encoder_select="vaapi_encode jpegtables"
mlp_decoder_select="mlp_parser"
motionpixels_decoder_select="bswapdsp"
mp1_decoder_select="mpegaudio"