mmaldec: send only a single EOS packet on flushing
[libav.git] / configure
CommitLineData
aeb29222 1#!/bin/sh
0f3cb305 2#
070c5d0f 3# Libav configure script
f57620d5 4#
949906ea
DB
5# Copyright (c) 2000-2002 Fabrice Bellard
6# Copyright (c) 2005-2008 Diego Biurrun
7# Copyright (c) 2005-2008 Mans Rullgard
0f3cb305 8#
cf9d24ad 9
31e647f8 10# Prevent locale nonsense from breaking basic text processing.
79ab96ba
DB
11LC_ALL=C
12export LC_ALL
31e647f8 13
cde2d79a 14# make sure we are running under a compatible shell
c21d6325
MR
15# try to make this part work with most shells
16
17try_exec(){
0dbe81bb 18 echo "Trying shell $1"
2270b4b2 19 type "$1" > /dev/null 2>&1 && exec "$@"
c21d6325
MR
20}
21
5237ce67 22unset foo
2270b4b2 23(: ${foo%%bar}) 2> /dev/null
0dbe81bb
MR
24E1="$?"
25
2270b4b2 26(: ${foo?}) 2> /dev/null
0dbe81bb
MR
27E2="$?"
28
29if test "$E1" != 0 || test "$E2" = 0; then
30 echo "Broken shell detected. Trying alternatives."
c21d6325
MR
31 export FF_CONF_EXEC
32 if test "0$FF_CONF_EXEC" -lt 1; then
33 FF_CONF_EXEC=1
34 try_exec bash "$0" "$@"
35 fi
36 if test "0$FF_CONF_EXEC" -lt 2; then
37 FF_CONF_EXEC=2
38 try_exec ksh "$0" "$@"
39 fi
40 if test "0$FF_CONF_EXEC" -lt 3; then
41 FF_CONF_EXEC=3
42 try_exec /usr/xpg4/bin/sh "$0" "$@"
cde2d79a
MR
43 fi
44 echo "No compatible shell script interpreter found."
fc53da20 45 echo "This configure script requires a POSIX-compatible shell"
c21d6325 46 echo "such as bash or ksh."
070c5d0f 47 echo "THIS IS NOT A BUG IN LIBAV, DO NOT REPORT IT AS SUCH."
505dfb09 48 echo "Instead, install a working POSIX-compatible shell."
070c5d0f 49 echo "Disabling this configure test will create a broken Libav."
c21d6325
MR
50 if test "$BASH_VERSION" = '2.04.0(1)-release'; then
51 echo "This bash version ($BASH_VERSION) is broken on your platform."
52 echo "Upgrade to a later version if available."
53 fi
cde2d79a
MR
54 exit 1
55fi
56
a77f01c7
MR
57test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
58
74c53c2d 59show_help(){
f69f51b3 60 cat <<EOF
06454877
MR
61Usage: configure [options]
62Options: [defaults in brackets after descriptions]
63
3b327a4b 64Help options:
06454877 65 --help print this message
3b327a4b
DB
66 --list-decoders show all available decoders
67 --list-encoders show all available encoders
68 --list-hwaccels show all available hardware accelerators
69 --list-demuxers show all available demuxers
70 --list-muxers show all available muxers
71 --list-parsers show all available parsers
72 --list-protocols show all available protocols
73 --list-bsfs show all available bitstream filters
74 --list-indevs show all available input devices
75 --list-outdevs show all available output devices
76 --list-filters show all available filters
77
78Standard options:
19bd477d 79 --logfile=FILE log tests and output to FILE [config.log]
06454877
MR
80 --disable-logging do not log configure debug information
81 --prefix=PREFIX install in PREFIX [$prefix]
82 --bindir=DIR install binaries in DIR [PREFIX/bin]
6291d7e4 83 --datadir=DIR install data files in DIR [PREFIX/share/avconv]
f4ca970d 84 --docdir=DIR install documentation in DIR [PREFIX/share/doc/libav]
06454877
MR
85 --libdir=DIR install libs in DIR [PREFIX/lib]
86 --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
87 --incdir=DIR install includes in DIR [PREFIX/include]
88 --mandir=DIR install man page in DIR [PREFIX/share/man]
749b1f13 89 --enable-rpath use rpath when linking programs [USE WITH CARE]
06454877 90
3b327a4b 91Licensing options:
06454877
MR
92 --enable-gpl allow use of GPL code, the resulting libs
93 and binaries will be under GPL [no]
94 --enable-version3 upgrade (L)GPL to version 3 [no]
95 --enable-nonfree allow use of nonfree code, the resulting libs
96 and binaries will be unredistributable [no]
3b327a4b
DB
97
98Configuration options:
99 --disable-static do not build static libraries [no]
100 --enable-shared build shared libraries [no]
101 --enable-small optimize for size instead of speed
102 --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary)
103 --enable-gray enable full grayscale support (slower color)
104 --disable-swscale-alpha disable alpha channel support in swscale
844c6852 105 --disable-all disable building components, libraries and programs
3b327a4b 106
e28b7553
DB
107Program options:
108 --disable-programs do not build command line programs
6291d7e4 109 --disable-avconv disable avconv build
266463da 110 --disable-avplay disable avplay build
9e12f0bf 111 --disable-avprobe disable avprobe build
894682a9 112 --disable-avserver deprecated, does nothing
e28b7553
DB
113
114Component options:
115 --disable-doc do not build documentation
5a0f7131
MR
116 --disable-avdevice disable libavdevice build
117 --disable-avcodec disable libavcodec build
118 --disable-avformat disable libavformat build
d89f2fa9 119 --disable-avutil disable libavutil build
5a0f7131 120 --disable-swscale disable libswscale build
cccc039f 121 --disable-avfilter disable video filter support [no]
c8af852b 122 --disable-avresample disable libavresample build [no]
0dbfc1db 123 --disable-pthreads disable pthreads [auto]
7b7b220c 124 --disable-w32threads disable Win32 threads [auto]
06454877 125 --disable-network disable network support [no]
7f3f5f46 126 --disable-dct disable DCT code
0b499c9b 127 --disable-error-resilience disable error resilience code
193cdd9a 128 --disable-lsp disable LSP code
2a91ada8 129 --disable-lzo disable LZO decoder code
06454877
MR
130 --disable-mdct disable MDCT code
131 --disable-rdft disable RDFT code
3b327a4b 132 --disable-fft disable FFT code
1274ea8d 133 --disable-faan disable floating point AAN (I)DCT code
70b348ec
DB
134
135Hardware accelerators:
d8039ef8 136 --enable-d3d11va enable D3D11VA code
3b327a4b 137 --enable-dxva2 enable DXVA2 code
dcb73592 138 --enable-vaapi enable VAAPI code
ac3dbb4d 139 --enable-vda enable VDA code
e8f6bd4b 140 --enable-vdpau enable VDPAU code
3b327a4b 141
330177b5
DB
142Hardware-accelerated decoding/encoding:
143 --enable-cuda enable dynamically linked CUDA [no]
144 --enable-libmfx enable HW acceleration through libmfx
145 --enable-mmal enable decoding via MMAL [no]
146 --enable-nvenc enable encoding via NVENC [no]
e8919ec4 147 --enable-omx enable encoding via OpenMAX IL [no]
f1cd9b03 148 --enable-omx-rpi enable encoding via OpenMAX IL for Raspberry Pi [no]
330177b5 149
3b327a4b 150Individual component options:
bb55e3a3 151 --disable-everything disable all components listed below
06454877
MR
152 --disable-encoder=NAME disable encoder NAME
153 --enable-encoder=NAME enable encoder NAME
154 --disable-encoders disable all encoders
155 --disable-decoder=NAME disable decoder NAME
156 --enable-decoder=NAME enable decoder NAME
157 --disable-decoders disable all decoders
158 --disable-hwaccel=NAME disable hwaccel NAME
159 --enable-hwaccel=NAME enable hwaccel NAME
160 --disable-hwaccels disable all hwaccels
161 --disable-muxer=NAME disable muxer NAME
162 --enable-muxer=NAME enable muxer NAME
163 --disable-muxers disable all muxers
164 --disable-demuxer=NAME disable demuxer NAME
165 --enable-demuxer=NAME enable demuxer NAME
166 --disable-demuxers disable all demuxers
167 --enable-parser=NAME enable parser NAME
168 --disable-parser=NAME disable parser NAME
169 --disable-parsers disable all parsers
170 --enable-bsf=NAME enable bitstream filter NAME
171 --disable-bsf=NAME disable bitstream filter NAME
172 --disable-bsfs disable all bitstream filters
173 --enable-protocol=NAME enable protocol NAME
174 --disable-protocol=NAME disable protocol NAME
175 --disable-protocols disable all protocols
3b327a4b 176 --enable-indev=NAME enable input device NAME
06454877 177 --disable-indev=NAME disable input device NAME
06454877 178 --disable-indevs disable input devices
3b327a4b
DB
179 --enable-outdev=NAME enable output device NAME
180 --disable-outdev=NAME disable output device NAME
06454877
MR
181 --disable-outdevs disable output devices
182 --disable-devices disable all devices
183 --enable-filter=NAME enable filter NAME
184 --disable-filter=NAME disable filter NAME
185 --disable-filters disable all filters
06454877
MR
186
187External library support:
03039f4c 188 --enable-avisynth enable reading of AviSynth script files [no]
06454877 189 --enable-bzlib enable bzlib [autodetect]
47941088 190 --enable-frei0r enable frei0r video filtering
bc8c1395 191 --enable-gnutls enable gnutls [no]
1c0210c7 192 --enable-libbs2b enable bs2b DSP library [no]
e417d80d 193 --enable-libcdio enable audio CD grabbing with libcdio
06454877
MR
194 --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
195 and libraw1394 [no]
72025ac3 196 --enable-libdcadec enable DCA decoding via libdcadec [no]
c547e5ff 197 --enable-libfaac enable AAC encoding via libfaac [no]
4f2b469d 198 --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
a5b64584 199 --enable-libfreetype enable libfreetype [no]
c547e5ff 200 --enable-libgsm enable GSM de/encoding via libgsm [no]
3641b048 201 --enable-libilbc enable iLBC de/encoding via libilbc [no]
233d2fa0 202 --enable-libkvazaar enable HEVC encoding via libkvazaar [no]
06454877 203 --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
8a02a803 204 --enable-libnpp enable NVIDIA Performance Primitives-based code [no]
becc3c62
MS
205 --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
206 --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
207 --enable-libopencv enable video filtering via libopencv [no]
3852e2c9 208 --enable-libopenh264 enable H.264 encoding via OpenH264 [no]
453c02f9 209 --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
7c5ca546 210 --enable-libopus enable Opus de/encoding via libopus [no]
7c922411 211 --enable-libpulse enable Pulseaudio input via libpulse [no]
0f943ce6 212 --enable-librtmp enable RTMP[E] support via librtmp [no]
c547e5ff 213 --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
7ca3e520 214 --enable-libsnappy enable Snappy compression [no]
c547e5ff 215 --enable-libspeex enable Speex de/encoding via libspeex [no]
06454877 216 --enable-libtheora enable Theora encoding via libtheora [no]
718907cd 217 --enable-libtwolame enable MP2 encoding via libtwolame [no]
d89e738a 218 --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
f502ff3f 219 --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
c547e5ff 220 --enable-libvorbis enable Vorbis encoding via libvorbis [no]
3f111804 221 --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
84d3ff50 222 --enable-libwavpack enable wavpack encoding via libwavpack [no]
be7c3231 223 --enable-libwebp enable WebP encoding via libwebp [no]
06454877 224 --enable-libx264 enable H.264 encoding via x264 [no]
50ea9315 225 --enable-libx265 enable HEVC encoding via x265 [no]
de295976 226 --enable-libxavs enable AVS encoding via xavs [no]
a6674d2e
LB
227 --enable-libxcb enable X11 grabbing using XCB [no]
228 --enable-libxcb-shm enable X11 grabbing shm communication [auto]
229 --enable-libxcb-xfixes enable X11 grabbing mouse rendering [auto]
06454877
MR
230 --enable-libxvid enable Xvid encoding via xvidcore,
231 native MPEG-4/Xvid encoder exists [no]
a060866f 232 --enable-openssl enable openssl [no]
a6674d2e 233 --enable-x11grab enable X11 grabbing (legacy) [no]
06454877
MR
234 --enable-zlib enable zlib [autodetect]
235
b3c6ee19
DB
236Toolchain options:
237 --arch=ARCH select architecture [$arch]
238 --cpu=CPU select the minimum required CPU (affects
239 instruction selection, may crash on older CPUs)
06454877
MR
240 --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
241 --enable-cross-compile assume a cross-compiler is used
242 --sysroot=PATH root of cross-build tree
243 --sysinclude=PATH location of cross-build system headers
244 --target-os=OS compiler targets OS [$target_os]
245 --target-exec=CMD command to run executables on target
246 --target-path=DIR path to view of build directory on target
ba13606c 247 --target-samples=DIR path to samples directory on target
aeeb782c 248 --toolchain=NAME set tool defaults according to NAME
06454877 249 --nm=NM use nm tool
121d78d0 250 --ar=AR use archive tool AR [$ar_default]
06454877
MR
251 --as=AS use assembler AS [$as_default]
252 --cc=CC use C compiler CC [$cc_default]
9f57f134 253 --objcc=OCC use ObjC compiler OCC [$cc_default]
193cdd9a 254 --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
06454877 255 --ld=LD use linker LD
852c329a 256 --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
390acbea 257 --pkg-config-flags=FLAGS pass additional flags to pkgconf []
06454877
MR
258 --host-cc=HOSTCC use host C compiler HOSTCC
259 --host-cflags=HCFLAGS use HCFLAGS when compiling for host
4cc4b33f 260 --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
095792f2 261 --host-ld=HOSTLD use host linker HOSTLD
06454877
MR
262 --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
263 --host-libs=HLIBS use libs HLIBS when linking for host
193cdd9a 264 --host-os=OS compiler host OS [$target_os]
06454877 265 --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
9f57f134 266 --extra-objcflags=FLAGS add FLAGS to OBJCFLAGS [$CFLAGS]
06454877 267 --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
bb0babd7 268 --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
06454877
MR
269 --extra-libs=ELIBS add ELIBS [$ELIBS]
270 --extra-version=STRING version string suffix []
193cdd9a 271 --optflags=OPTFLAGS override optimization-related compiler flags
06454877 272 --build-suffix=SUFFIX library name suffix []
3b327a4b 273 --enable-pic build position-independent code
193cdd9a 274 --enable-thumb compile for Thumb instruction set
b3c6ee19 275 --enable-lto use link-time optimization
604abd02 276 --env="ENV=override" override the environment variables
b3c6ee19
DB
277
278Advanced options (experts only):
279 --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
8ae1d87a 280 --custom-allocator=NAME use a supported custom allocator
3b327a4b 281 --disable-symver disable symbol versioning
3b327a4b
DB
282 --enable-hardcoded-tables use hardcoded tables instead of runtime generation
283 --disable-safe-bitstream-reader
284 disable buffer boundary checking in bitreaders
285 (faster, but may crash)
286 --enable-memalign-hack emulate memalign, interferes with memory debuggers
b3c6ee19 287 --enable-sram allow use of on-chip SRAM
3b327a4b
DB
288
289Optimization options (experts only):
463a7cde 290 --disable-asm disable all assembly optimizations
06454877 291 --disable-altivec disable AltiVec optimizations
f22ebd25
LB
292 --disable-vsx disable VSX optimizations
293 --disable-power8 disable POWER8 optimizations
06454877
MR
294 --disable-amd3dnow disable 3DNow! optimizations
295 --disable-amd3dnowext disable 3DNow! extended optimizations
296 --disable-mmx disable MMX optimizations
239fdf1b 297 --disable-mmxext disable MMXEXT optimizations
06454877 298 --disable-sse disable SSE optimizations
50cd43f2
DB
299 --disable-sse2 disable SSE2 optimizations
300 --disable-sse3 disable SSE3 optimizations
06454877 301 --disable-ssse3 disable SSSE3 optimizations
50cd43f2
DB
302 --disable-sse4 disable SSE4 optimizations
303 --disable-sse42 disable SSE4.2 optimizations
87f1355f 304 --disable-avx disable AVX optimizations
10b0161d 305 --disable-xop disable XOP optimizations
1b932eb1 306 --disable-fma3 disable FMA3 optimizations
79687079 307 --disable-fma4 disable FMA4 optimizations
4d6ee072 308 --disable-avx2 disable AVX2 optimizations
06454877
MR
309 --disable-armv5te disable armv5te optimizations
310 --disable-armv6 disable armv6 optimizations
311 --disable-armv6t2 disable armv6t2 optimizations
b3267559 312 --disable-vfp disable VFP optimizations
5ea20630 313 --disable-neon disable NEON optimizations
463a7cde
DB
314 --disable-inline-asm disable use of inline assembly
315 --disable-yasm disable use of nasm/yasm assembly
06454877 316
070c5d0f 317Developer options (useful when working on Libav itself):
06454877
MR
318 --disable-debug disable debugging symbols
319 --enable-debug=LEVEL set the debug level [$debuglevel]
06454877
MR
320 --disable-optimizations disable compiler optimizations
321 --enable-extra-warnings enable more compiler warnings
52b3cc60 322 --samples=PATH location of test samples for FATE, if not set use
9309bdfe 323 \$LIBAV_SAMPLES at make invocation time.
44a0a98f
MS
324 --enable-neon-clobber-test check NEON registers for clobbering (should be
325 used only for debugging purposes)
7e4d9d5d
RB
326 --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
327 should be used only for debugging purposes)
154caa67
MR
328 --enable-random randomly enable/disable components
329 --disable-random
330 --enable-random=LIST randomly enable/disable specific components or
331 --disable-random=LIST component groups. LIST is a comma-separated list
332 of NAME[:PROB] entries where NAME is a component
333 (group) and PROB the probability associated with
334 NAME (default 0.5).
335 --random-seed=VALUE seed value for --enable/disable-random
eaa2d123
VG
336 --disable-valgrind-backtrace do not print a backtrace under Valgrind
337 (only applies to --disable-optimizations builds)
06454877
MR
338
339NOTE: Object files are built at the place where configure is launched.
340EOF
60e8bc13 341 exit 0
74c53c2d 342}
cf9d24ad 343
0884fadf
MR
344quotes='""'
345
57bd82d4 346log(){
2270b4b2 347 echo "$@" >> $logfile
57bd82d4
MR
348}
349
720c69da 350log_file(){
c8e9f801 351 log BEGIN $1
bf12a81c
KM
352 i=1
353 while read line; do
354 printf '%5s %s\n' "${i}" "${line}"
355 i=$(($i+1))
356 done < $1 >> $logfile
c8e9f801
MR
357 log END $1
358}
359
2ba042a7 360echolog(){
c8e9f801 361 log "$@"
57bd82d4 362 echo "$@"
2ba042a7
MR
363}
364
7bfc8ae6
MR
365warn(){
366 log "WARNING: $*"
367 WARNINGS="${WARNINGS}WARNING: $*\n"
368}
369
2ba042a7
MR
370die(){
371 echolog "$@"
372 cat <<EOF
d326cf7f 373
2ba042a7 374If you think configure made a mistake, make sure you are using the latest
4a6a21f5 375version from Git. If the latest version fails, report the problem to the
5045f6bd 376libav-tools@libav.org mailing list or IRC #libav on irc.freenode.net.
2ba042a7 377EOF
e155a21a 378 if disabled logging; then
2ba042a7 379 cat <<EOF
e155a21a
DB
380Rerun configure with logging enabled (do not use --disable-logging), and
381include the log this produces with your report.
2ba042a7
MR
382EOF
383 else
f69f51b3 384 cat <<EOF
e155a21a
DB
385Include the log file "$logfile" produced by configure as this will help
386solving the problem.
2ba042a7
MR
387EOF
388 fi
57bd82d4
MR
389 exit 1
390}
391
6c6007d6 392# Avoid locale weirdness, besides we really just want to translate ASCII.
44161118 393toupper(){
6c6007d6 394 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
44161118
MR
395}
396
4a5444db 397tolower(){
6c6007d6 398 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
4a5444db
MR
399}
400
14a8acf1
MR
401c_escape(){
402 echo "$*" | sed 's/["\\]/\\\0/g'
403}
404
b04251c5
MR
405sh_quote(){
406 v=$(echo "$1" | sed "s/'/'\\\\''/g")
d72c981c 407 test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
b04251c5
MR
408 echo "$v"
409}
410
bb7a22b5
MR
411cleanws(){
412 echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
413}
414
be8f2501
MR
415filter(){
416 pat=$1
417 shift
418 for v; do
98ef6079 419 eval "case $v in $pat) echo $v ;; esac"
be8f2501
MR
420 done
421}
422
9d201b26
MR
423filter_out(){
424 pat=$1
425 shift
426 for v; do
427 eval "case $v in $pat) ;; *) echo $v ;; esac"
428 done
429}
430
36e2dea0
MR
431map(){
432 m=$1
433 shift
e0e335a0 434 for v; do eval $m; done
36e2dea0
MR
435}
436
43b73d59
DB
437add_suffix(){
438 suffix=$1
439 shift
440 for v; do echo ${v}${suffix}; done
441}
442
a8d04fba
MR
443set_all(){
444 value=$1
445 shift
446 for var in $*; do
447 eval $var=$value
448 done
449}
450
72a43668
MR
451set_weak(){
452 value=$1
453 shift
454 for var; do
455 eval : \${$var:=$value}
456 done
457}
458
f868b24d
DB
459sanitize_var_name(){
460 echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
461}
462
3f8040db
MR
463set_safe(){
464 var=$1
465 shift
f868b24d 466 eval $(sanitize_var_name "$var")='$*'
3f8040db
MR
467}
468
469get_safe(){
f868b24d 470 eval echo \$$(sanitize_var_name "$1")
3f8040db
MR
471}
472
799c9e9b 473pushvar(){
4d810ad2
MS
474 for pvar in $*; do
475 eval level=\${${pvar}_level:=0}
476 eval ${pvar}_${level}="\$$pvar"
477 eval ${pvar}_level=$(($level+1))
799c9e9b
MR
478 done
479}
480
481popvar(){
4d810ad2
MS
482 for pvar in $*; do
483 eval level=\${${pvar}_level:-0}
799c9e9b
MR
484 test $level = 0 && continue
485 eval level=$(($level-1))
4d810ad2
MS
486 eval $pvar="\${${pvar}_${level}}"
487 eval ${pvar}_level=$level
488 eval unset ${pvar}_${level}
799c9e9b
MR
489 done
490}
491
a8d04fba
MR
492enable(){
493 set_all yes $*
494}
495
496disable(){
497 set_all no $*
498}
499
72a43668
MR
500enable_weak(){
501 set_weak yes $*
502}
503
504disable_weak(){
505 set_weak no $*
506}
507
72702705 508enable_safe(){
fd07f803
MR
509 for var; do
510 enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
511 done
72702705
MR
512}
513
514disable_safe(){
fd07f803
MR
515 for var; do
516 disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
517 done
72702705
MR
518}
519
f9d328da
MR
520do_enable_deep(){
521 for var; do
522 enabled $var && continue
e93aa2c9 523 eval sel="\$${var}_select"
c510c7b5
MR
524 eval sgs="\$${var}_suggest"
525 pushvar var sgs
f9d328da 526 enable_deep $sel
c510c7b5
MR
527 popvar sgs
528 enable_deep_weak $sgs
f9d328da
MR
529 popvar var
530 done
531}
532
533enable_deep(){
534 do_enable_deep $*
535 enable $*
536}
537
72a43668 538enable_deep_weak(){
ffb068ce
MS
539 for var; do
540 disabled $var && continue
541 pushvar var
542 do_enable_deep $var
543 popvar var
544 enable_weak $var
545 done
72a43668
MR
546}
547
57bd82d4 548enabled(){
3250003c
MR
549 test "${1#!}" = "$1" && op== || op=!=
550 eval test "x\$${1#!}" $op "xyes"
44161118
MR
551}
552
37970ebf 553disabled(){
3250003c
MR
554 test "${1#!}" = "$1" && op== || op=!=
555 eval test "x\$${1#!}" $op "xno"
37970ebf
RP
556}
557
44161118
MR
558enabled_all(){
559 for opt; do
560 enabled $opt || return 1
561 done
562}
563
85bca2c5
DB
564disabled_all(){
565 for opt; do
566 disabled $opt || return 1
567 done
568}
569
44161118
MR
570enabled_any(){
571 for opt; do
572 enabled $opt && return 0
573 done
574}
575
85bca2c5
DB
576disabled_any(){
577 for opt; do
578 disabled $opt && return 0
579 done
f7b230a7 580 return 1
85bca2c5
DB
581}
582
c9d19248
MR
583set_default(){
584 for opt; do
88268e94 585 eval : \${$opt:=\$${opt}_default}
c9d19248
MR
586 done
587}
588
4a0d6686
AJ
589is_in(){
590 value=$1
591 shift
592 for var in $*; do
593 [ $var = $value ] && return 0
594 done
595 return 1
596}
597
d4f8cecc 598do_check_deps(){
30fd06be 599 for cfg; do
3250003c 600 cfg="${cfg#!}"
799c9e9b
MR
601 enabled ${cfg}_checking && die "Circular dependency for $cfg."
602 disabled ${cfg}_checking && continue
603 enable ${cfg}_checking
d4f8cecc 604 append allopts $cfg
799c9e9b 605
30fd06be 606 eval dep_all="\$${cfg}_deps"
b4a0f172 607 eval dep_any="\$${cfg}_deps_any"
7ef3425f 608 eval dep_sel="\$${cfg}_select"
c510c7b5 609 eval dep_sgs="\$${cfg}_suggest"
3d7453e0
MR
610 eval dep_ifa="\$${cfg}_if"
611 eval dep_ifn="\$${cfg}_if_any"
799c9e9b 612
3d7453e0 613 pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
d4f8cecc 614 do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
3d7453e0 615 popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
799c9e9b 616
3d7453e0
MR
617 [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
618 [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
6a702d4c
MR
619 enabled_all $dep_all || disable $cfg
620 enabled_any $dep_any || disable $cfg
7ef3425f 621 disabled_any $dep_sel && disable $cfg
799c9e9b 622
4ec45764 623 if enabled $cfg; then
f9d328da 624 enable_deep $dep_sel
c510c7b5 625 enable_deep_weak $dep_sgs
4ec45764
RP
626 fi
627
799c9e9b 628 disable ${cfg}_checking
30fd06be
MR
629 done
630}
631
d4f8cecc
MR
632check_deps(){
633 unset allopts
634
635 do_check_deps "$@"
636
637 for cfg in $allopts; do
638 enabled $cfg || continue
639 eval dep_extralibs="\$${cfg}_extralibs"
640 test -n "$dep_extralibs" && add_extralibs $dep_extralibs
641 done
642}
643
44161118
MR
644print_config(){
645 pfx=$1
72cfcf41
MR
646 files=$2
647 shift 2
f454e879
MR
648 map 'eval echo "$v \${$v:-no}"' "$@" |
649 awk "BEGIN { split(\"$files\", files) }
650 {
651 c = \"$pfx\" toupper(\$1);
652 v = \$2;
653 sub(/yes/, 1, v);
654 sub(/no/, 0, v);
655 for (f in files) {
656 file = files[f];
657 if (file ~ /\\.h\$/) {
658 printf(\"#define %s %d\\n\", c, v) >>file;
659 } else if (file ~ /\\.asm\$/) {
660 printf(\"%%define %s %d\\n\", c, v) >>file;
661 } else if (file ~ /\\.mak\$/) {
d16c4aeb 662 n = -v ? \"\" : \"!\";
f454e879
MR
663 printf(\"%s%s=yes\\n\", n, c) >>file;
664 }
665 }
666 }"
57bd82d4
MR
667}
668
31c0121d 669print_enabled(){
31c0121d
MR
670 suf=$1
671 shift
672 for v; do
e656a6cc 673 enabled $v && printf "%s\n" ${v%$suf}
31c0121d
MR
674 done
675}
676
57bd82d4
MR
677append(){
678 var=$1
679 shift
57bd82d4
MR
680 eval "$var=\"\$$var $*\""
681}
682
60361817
MR
683prepend(){
684 var=$1
685 shift
686 eval "$var=\"$* \$$var\""
687}
688
44951174
JG
689unique(){
690 var=$1
691 uniq_list=""
692 for tok in $(eval echo \$$var); do
693 uniq_list="$(filter_out $tok $uniq_list) $tok"
694 done
695 eval "$var=\"${uniq_list}\""
696}
697
50a334e4 698add_cppflags(){
cd52ec95 699 append CPPFLAGS "$@"
50a334e4
MR
700}
701
57bd82d4 702add_cflags(){
01d31e16 703 append CFLAGS $($cflags_filter "$@")
57bd82d4
MR
704}
705
2f2e6c7c 706add_asflags(){
01d31e16 707 append ASFLAGS $($asflags_filter "$@")
2f2e6c7c
MR
708}
709
9f57f134
LB
710add_objcflags(){
711 append OBJCFLAGS $($objcflags_filter "$@")
712}
713
57bd82d4 714add_ldflags(){
64933b6c 715 append LDFLAGS $($ldflags_filter "$@")
57bd82d4
MR
716}
717
bb0babd7
LB
718add_ldexeflags(){
719 append LDEXEFLAGS $($ldflags_filter "$@")
720}
721
0673ede9
VG
722add_stripflags(){
723 append STRIPFLAGS "$@"
724}
725
57bd82d4 726add_extralibs(){
64933b6c 727 prepend extralibs $($ldflags_filter "$@")
57bd82d4
MR
728}
729
4cc4b33f
DB
730add_host_cppflags(){
731 append host_cppflags "$@"
732}
733
6c3fa06a
MR
734add_host_cflags(){
735 append host_cflags $($host_cflags_filter "$@")
736}
737
738add_host_ldflags(){
739 append host_ldflags $($host_ldflags_filter "$@")
740}
741
84e65c76
MR
742add_compat(){
743 append compat_objs $1
744 shift
745 map 'add_cppflags -D$v' "$@"
746}
747
b0cfb663 748check_cmd(){
b3cb5d51 749 log "$@"
2270b4b2 750 "$@" >> $logfile 2>&1
b0cfb663
MR
751}
752
b2704a65
MR
753cc_o(){
754 eval printf '%s\\n' $CC_O
755}
756
18031c49
MR
757cc_e(){
758 eval printf '%s\\n' $CC_E
759}
760
dcd479c0 761check_cc(){
57bd82d4 762 log check_cc "$@"
2270b4b2 763 cat > $TMPC
720c69da 764 log_file $TMPC
23565c26 765 check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
57bd82d4
MR
766}
767
9f57f134
LB
768check_objcc(){
769 log check_objcc "$@"
770 cat > $TMPC
771 log_file $TMPC
772 check_cmd $objcc $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPC
773}
774
57bd82d4
MR
775check_cpp(){
776 log check_cpp "$@"
2270b4b2 777 cat > $TMPC
720c69da 778 log_file $TMPC
18031c49 779 check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
dcd479c0
MR
780}
781
df0d6341
MR
782as_o(){
783 eval printf '%s\\n' $AS_O
784}
785
f65883c8
MR
786check_as(){
787 log check_as "$@"
7fd90119
MR
788 cat > $TMPS
789 log_file $TMPS
790 check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
f65883c8
MR
791}
792
575db883
DB
793check_inline_asm(){
794 log check_inline_asm "$@"
940f335a 795 name="$1"
3784e82e 796 code="$2"
940f335a 797 shift 2
49214f61 798 disable $name
7fd90119 799 check_cc "$@" <<EOF && enable $name
3784e82e 800void foo(void){ __asm__ volatile($code); }
940f335a
MR
801EOF
802}
803
c6ebc9fa
MR
804check_insn(){
805 log check_insn "$@"
806 check_inline_asm ${1}_inline "\"$2\""
807 echo "$2" | check_as && enable ${1}_external || disable ${1}_external
808}
809
304d586d
LM
810check_yasm(){
811 log check_yasm "$@"
812 echo "$1" > $TMPS
813 log_file $TMPS
814 shift 1
815 check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
816}
817
29b64b68
MR
818ld_o(){
819 eval printf '%s\\n' $LD_O
820}
821
dcd479c0 822check_ld(){
57bd82d4 823 log check_ld "$@"
66a1ccd7
MR
824 flags=$(filter_out '-l*' "$@")
825 libs=$(filter '-l*' "$@")
01d31e16 826 check_cc $($cflags_filter $flags) || return
64933b6c
MR
827 flags=$($ldflags_filter $flags)
828 libs=$($ldflags_filter $libs)
29b64b68 829 check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
dcd479c0
MR
830}
831
52ccc4a0
DB
832print_include(){
833 hdr=$1
834 test "${hdr%.h}" = "${hdr}" &&
835 echo "#include $hdr" ||
836 echo "#include <$hdr>"
837}
838
5adc829e
MR
839check_code(){
840 log check_code "$@"
841 check=$1
842 headers=$2
843 code=$3
844 shift 3
845 {
846 for hdr in $headers; do
52ccc4a0 847 print_include $hdr
5adc829e
MR
848 done
849 echo "int main(void) { $code; return 0; }"
850 } | check_$check "$@"
851}
852
50a334e4
MR
853check_cppflags(){
854 log check_cppflags "$@"
caf458dd 855 check_cc "$@" <<EOF && append CPPFLAGS "$@"
50a334e4
MR
856int x;
857EOF
858}
859
23157d72
DB
860test_cflags(){
861 log test_cflags "$@"
01d31e16 862 set -- $($cflags_filter "$@")
23157d72 863 check_cc "$@" <<EOF
dcd479c0
MR
864int x;
865EOF
866}
867
23157d72
DB
868check_cflags(){
869 log check_cflags "$@"
870 test_cflags "$@" && add_cflags "$@"
871}
872
9f57f134
LB
873test_objcflags(){
874 log test_cflags "$@"
875 set -- $($cflags_filter "$@")
876 check_objcc "$@" <<EOF
877int x;
878EOF
879}
880
881check_objcflags(){
882 log check_cflags "$@"
883 test_objcflags "$@" && add_objcflags "$@"
884}
885
2ed46eea
MR
886test_ldflags(){
887 log test_ldflags "$@"
888 check_ld "$@" <<EOF
c23a0ac8 889int main(void){ return 0; }
dcd479c0
MR
890EOF
891}
892
2ed46eea
MR
893check_ldflags(){
894 log check_ldflags "$@"
895 test_ldflags "$@" && add_ldflags "$@"
896}
897
0673ede9
VG
898test_stripflags(){
899 log test_stripflags "$@"
900 # call check_cc to get a fresh TMPO
901 check_cc <<EOF
902int main(void) { return 0; }
903EOF
904 check_cmd $strip $STRIPFLAGS "$@" $TMPO
905}
906
907check_stripflags(){
908 log check_stripflags "$@"
909 test_stripflags "$@" && add_stripflags "$@"
910}
911
dcd479c0 912check_header(){
57bd82d4 913 log check_header "$@"
dcd479c0
MR
914 header=$1
915 shift
b77df637
MR
916 disable_safe $header
917 check_cpp "$@" <<EOF && enable_safe $header
dcd479c0
MR
918#include <$header>
919int x;
920EOF
921}
922
923check_func(){
57bd82d4 924 log check_func "$@"
dcd479c0
MR
925 func=$1
926 shift
d8bc5f06
MR
927 disable $func
928 check_ld "$@" <<EOF && enable $func
dcd479c0 929extern int $func();
c23a0ac8 930int main(void){ $func(); }
dcd479c0
MR
931EOF
932}
933
645d2652 934check_mathfunc(){
6b73c0ae 935 log check_mathfunc "$@"
645d2652 936 func=$1
1aa07aa2
MR
937 narg=$2
938 shift 2
939 test $narg = 2 && args="f, g" || args="f"
645d2652
MR
940 disable $func
941 check_ld "$@" <<EOF && enable $func
942#include <math.h>
1aa07aa2 943float foo(float f, float g) { return $func($args); }
33bd38db 944int main(void){ return 0; }
645d2652
MR
945EOF
946}
947
2446d3d6
DB
948check_func_headers(){
949 log check_func_headers "$@"
f8d7b072 950 headers=$1
edaf1ae2 951 funcs=$2
f8d7b072 952 shift 2
edaf1ae2
MR
953 {
954 for hdr in $headers; do
52ccc4a0 955 print_include $hdr
edaf1ae2
MR
956 done
957 for func in $funcs; do
958 echo "long check_$func(void) { return (long) $func; }"
959 done
960 echo "int main(void) { return 0; }"
961 } | check_ld "$@" && enable $funcs && enable_safe $headers
f8d7b072
MR
962}
963
a5344cf7
SS
964check_cpp_condition(){
965 log check_cpp_condition "$@"
966 header=$1
967 condition=$2
f855b7b9 968 shift 2
cd52ec95 969 check_cpp "$@" <<EOF
a5344cf7
SS
970#include <$header>
971#if !($condition)
972#error "unsatisfied condition: $condition"
973#endif
974EOF
975}
976
57bd82d4
MR
977check_lib(){
978 log check_lib "$@"
979 header="$1"
980 func="$2"
981 shift 2
84400e9d 982 check_header $header && check_func $func "$@" && add_extralibs "$@"
57bd82d4
MR
983}
984
f8d7b072
MR
985check_lib2(){
986 log check_lib2 "$@"
987 headers="$1"
edaf1ae2 988 funcs="$2"
f8d7b072 989 shift 2
edaf1ae2 990 check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
f8d7b072
MR
991}
992
3f8040db
MR
993check_pkg_config(){
994 log check_pkg_config "$@"
995 pkg="$1"
996 headers="$2"
997 funcs="$3"
998 shift 3
7f9e893f 999 check_cmd $pkg_config --exists --print-errors $pkg || return
390acbea
LB
1000 pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
1001 pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
3f8040db 1002 check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
06db4552
LB
1003 set_safe "${pkg}_cflags" $pkg_cflags &&
1004 set_safe "${pkg}_libs" $pkg_libs
3f8040db
MR
1005}
1006
dcd479c0 1007check_exec(){
2270b4b2 1008 check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
57bd82d4
MR
1009}
1010
7dfef245 1011check_exec_crash(){
5e622c40 1012 code=$(cat)
7dfef245
MR
1013
1014 # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
1015 # are safe but may not be available everywhere. Thus we use
1016 # raise(SIGTERM) instead. The check is run in a subshell so we
1017 # can redirect the "Terminated" message from the shell. SIGBUS
1018 # is not defined by standard C so it is used conditionally.
1019
2270b4b2 1020 (check_exec "$@") >> $logfile 2>&1 <<EOF
7dfef245
MR
1021#include <signal.h>
1022static void sighandler(int sig){
1023 raise(SIGTERM);
1024}
692dd8ed
MR
1025int foo(void){
1026 $code
1027}
9495cd17 1028int (*func_ptr)(void) = foo;
e5af4a11 1029int main(void){
7dfef245
MR
1030 signal(SIGILL, sighandler);
1031 signal(SIGFPE, sighandler);
1032 signal(SIGSEGV, sighandler);
1033#ifdef SIGBUS
1034 signal(SIGBUS, sighandler);
1035#endif
9495cd17 1036 return func_ptr();
7dfef245
MR
1037}
1038EOF
1039}
1040
72be9e73
DY
1041check_type(){
1042 log check_type "$@"
1043 headers=$1
1044 type=$2
1045 shift 2
ae550ce9 1046 disable_safe "$type"
5adc829e 1047 check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
72be9e73
DY
1048}
1049
14d36751 1050check_struct(){
813b82b9 1051 log check_struct "$@"
14d36751
MR
1052 headers=$1
1053 struct=$2
1054 member=$3
1055 shift 3
1056 disable_safe "${struct}_${member}"
5adc829e
MR
1057 check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
1058 enable_safe "${struct}_${member}"
14d36751
MR
1059}
1060
9c7d85b3
DB
1061check_builtin(){
1062 log check_builtin "$@"
1063 name=$1
1064 headers=$2
1065 builtin=$3
1066 shift 3
1067 disable "$name"
1068 check_code ld "$headers" "$builtin" "$@" && enable "$name"
1069}
1070
e854b8f9
AK
1071check_compile_assert(){
1072 log check_compile_assert "$@"
1073 name=$1
1074 headers=$2
1075 condition=$3
1076 shift 3
1077 disable "$name"
1078 check_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
1079}
1080
57bd82d4
MR
1081require(){
1082 name="$1"
1083 header="$2"
1084 func="$3"
1085 shift 3
1086 check_lib $header $func "$@" || die "ERROR: $name not found"
dcd479c0
MR
1087}
1088
f8d7b072
MR
1089require2(){
1090 name="$1"
1091 headers="$2"
1092 func="$3"
1093 shift 3
1094 check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
1095}
1096
3f8040db
MR
1097require_pkg_config(){
1098 pkg="$1"
1099 check_pkg_config "$@" || die "ERROR: $pkg not found"
06db4552
LB
1100 add_cflags $(get_safe "${pkg}_cflags")
1101 add_extralibs $(get_safe "${pkg}_libs")
3f8040db
MR
1102}
1103
27565164
DB
1104hostcc_e(){
1105 eval printf '%s\\n' $HOSTCC_E
1106}
1107
ae43c4c0
MR
1108hostcc_o(){
1109 eval printf '%s\\n' $HOSTCC_O
1110}
1111
f0125de9
MR
1112check_host_cc(){
1113 log check_host_cc "$@"
1114 cat > $TMPC
1115 log_file $TMPC
ae43c4c0 1116 check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
f0125de9
MR
1117}
1118
27565164
DB
1119check_host_cpp(){
1120 log check_host_cpp "$@"
1121 cat > $TMPC
1122 log_file $TMPC
3f2c7035 1123 check_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC
27565164
DB
1124}
1125
4cc4b33f
DB
1126check_host_cppflags(){
1127 log check_host_cppflags "$@"
1128 check_host_cc "$@" <<EOF && append host_cppflags "$@"
1129int x;
1130EOF
1131}
1132
f0125de9
MR
1133check_host_cflags(){
1134 log check_host_cflags "$@"
6c3fa06a 1135 set -- $($host_cflags_filter "$@")
f0125de9
MR
1136 check_host_cc "$@" <<EOF && append host_cflags "$@"
1137int x;
1138EOF
1139}
1140
27565164
DB
1141check_host_cpp_condition(){
1142 log check_host_cpp_condition "$@"
1143 header=$1
1144 condition=$2
1145 shift 2
1146 check_host_cpp "$@" <<EOF
1147#include <$header>
1148#if !($condition)
1149#error "unsatisfied condition: $condition"
1150#endif
1151EOF
1152}
1153
c505dd31
MR
1154apply(){
1155 file=$1
1156 shift
1157 "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
1158}
1159
c34681df 1160cp_if_changed(){
5e27ec28
MR
1161 cmp -s "$1" "$2" && echo "$2 is unchanged" && return
1162 mkdir -p "$(dirname $2)"
4ebc6a74 1163 $cp_f "$1" "$2"
c34681df
MR
1164}
1165
dcd61286
DB
1166# CONFIG_LIST contains configurable options, while HAVE_LIST is for
1167# system-dependent things.
1168
d7a5a178 1169AVCODEC_COMPONENTS="
4a0d6686
AJ
1170 bsfs
1171 decoders
4a0d6686 1172 encoders
5666fd73 1173 hwaccels
d7a5a178
LB
1174 parsers
1175"
1176
1177AVDEVICE_COMPONENTS="
c552605c 1178 indevs
c552605c 1179 outdevs
d7a5a178
LB
1180"
1181AVFILTER_COMPONENTS="
1182 filters
1183"
1184AVFORMAT_COMPONENTS="
1185 demuxers
1186 muxers
4a0d6686
AJ
1187 protocols
1188"
1189
d7a5a178
LB
1190AVRESAMPLE_COMPONENTS=""
1191AVUTIL_COMPONENTS=""
1192
1193COMPONENT_LIST="
1194 $AVCODEC_COMPONENTS
1195 $AVDEVICE_COMPONENTS
1196 $AVFILTER_COMPONENTS
1197 $AVFORMAT_COMPONENTS
1198 $AVRESAMPLE_COMPONENTS
1199 $AVUTIL_COMPONENTS
1200"
1201
ab81f24a 1202EXAMPLE_LIST="
b339182e 1203 avcodec_example
e7dfaf16 1204 filter_audio_example
b339182e 1205 metadata_example
ab81f24a 1206 output_example
990e4a66 1207 qsvdec_example
10421bcf 1208 transcode_aac_example
ab81f24a
DB
1209"
1210
3fc09b00
MR
1211EXTERNAL_LIBRARY_LIST="
1212 avisynth
1213 bzlib
1214 frei0r
1215 gnutls
1c0210c7 1216 libbs2b
3fc09b00
MR
1217 libcdio
1218 libdc1394
72025ac3 1219 libdcadec
3fc09b00
MR
1220 libfaac
1221 libfdk_aac
f1b239ec 1222 libfontconfig
3fc09b00
MR
1223 libfreetype
1224 libgsm
1225 libilbc
233d2fa0 1226 libkvazaar
3fc09b00 1227 libmp3lame
8a02a803 1228 libnpp
3fc09b00
MR
1229 libopencore_amrnb
1230 libopencore_amrwb
1231 libopencv
8a3d9ca6 1232 libopenh264
3fc09b00
MR
1233 libopenjpeg
1234 libopus
1235 libpulse
1236 librtmp
1237 libschroedinger
7ca3e520 1238 libsnappy
3fc09b00
MR
1239 libspeex
1240 libtheora
718907cd 1241 libtwolame
3fc09b00
MR
1242 libvo_aacenc
1243 libvo_amrwbenc
1244 libvorbis
1245 libvpx
84d3ff50 1246 libwavpack
be7c3231 1247 libwebp
3fc09b00 1248 libx264
50ea9315 1249 libx265
3fc09b00 1250 libxavs
a6674d2e
LB
1251 libxcb
1252 libxcb_shm
1253 libxcb_xfixes
3fc09b00
MR
1254 libxvid
1255 openssl
1256 x11grab
1257 zlib
1258"
1259
d0adf55c
DB
1260FEATURE_LIST="
1261 gray
1262 hardcoded_tables
f1cd9b03 1263 omx_rpi
d0adf55c
DB
1264 runtime_cpudetect
1265 safe_bitstream_reader
1266 shared
1267 small
1268 sram
1269 static
1270 swscale_alpha
1271"
1272
330177b5
DB
1273HW_CODECS_LIST="
1274 cuda
1275 libmfx
1276 mmal
1277 nvenc
e8919ec4 1278 omx
330177b5
DB
1279"
1280
70b348ec 1281HWACCEL_LIST="
d8039ef8 1282 d3d11va
70b348ec
DB
1283 dxva2
1284 vaapi
1285 vda
1286 vdpau
1287"
7caf48e0 1288
d89f2fa9
DB
1289LIBRARY_LIST="
1290 avcodec
1291 avdevice
1292 avfilter
1293 avformat
1294 avresample
1295 avutil
1296 swscale
1297"
1298
d0adf55c
DB
1299LICENSE_LIST="
1300 gpl
1301 nonfree
1302 version3
1303"
1304
055c61b8
DB
1305PROGRAM_LIST="
1306 avconv
1307 avplay
1308 avprobe
055c61b8
DB
1309"
1310
d0adf55c 1311SUBSYSTEM_LIST="
7f3f5f46 1312 dct
4da3f410 1313 doc
0b499c9b 1314 error_resilience
1274ea8d 1315 faan
1848f7d9 1316 fft
b781cc12 1317 lsp
2a91ada8 1318 lzo
47a158cb 1319 mdct
d0adf55c
DB
1320 network
1321 rdft
1322"
1323
1324CONFIG_LIST="
1325 $COMPONENT_LIST
1326 $EXAMPLE_LIST
1327 $EXTERNAL_LIBRARY_LIST
1328 $FEATURE_LIST
330177b5 1329 $HW_CODECS_LIST
d0adf55c
DB
1330 $HWACCEL_LIST
1331 $LICENSE_LIST
1332 $LIBRARY_LIST
1333 $PROGRAM_LIST
1334 $SUBSYSTEM_LIST
c88f5d72 1335 memalign_hack
44a0a98f 1336 neon_clobber_test
8a3c8627 1337 pic
7caf48e0 1338 pod2man
f187557a 1339 texi2html
8986fddc 1340 thumb
eaa2d123 1341 valgrind_backtrace
7e4d9d5d 1342 xmm_clobber_test
4a0d6686 1343"
c88f5d72 1344
7caf48e0 1345THREADS_LIST="
8eee7025
DB
1346 pthreads
1347 w32threads
7caf48e0 1348"
8eee7025 1349
7caf48e0 1350ATOMICS_LIST="
f9f6402e 1351 atomics_gcc
f9f6402e 1352 atomics_suncc
93e65e9a 1353 atomics_win32
7caf48e0 1354"
f9f6402e 1355
7caf48e0 1356ARCH_LIST="
5873b623 1357 aarch64
3f5b56e5 1358 alpha
a2fc0f6a 1359 arm
fdcd782d
MR
1360 avr32
1361 avr32_ap
1362 avr32_uc
3f5b56e5
MR
1363 bfin
1364 ia64
1365 m68k
1366 mips
bae3abb0 1367 mips64
3f5b56e5 1368 parisc
79cb09b2 1369 ppc
34d11b87 1370 ppc64
3f5b56e5
MR
1371 s390
1372 sh4
1373 sparc
1374 sparc64
c75848cd
DB
1375 tilegx
1376 tilepro
0844bae1 1377 tomi
3f5b56e5
MR
1378 x86
1379 x86_32
1380 x86_64
7caf48e0 1381"
3f5b56e5 1382
7caf48e0 1383ARCH_EXT_LIST_ARM="
81dfa21e
MR
1384 armv5te
1385 armv6
1386 armv6t2
8675bcb0 1387 armv8
81dfa21e 1388 neon
b3267559 1389 vfp
81dfa21e 1390 vfpv3
7caf48e0 1391"
81dfa21e 1392
7caf48e0 1393ARCH_EXT_LIST_X86_SIMD="
3bf96eec 1394 amd3dnow
a1ef9f08 1395 amd3dnowext
50cd43f2 1396 avx
4d6ee072 1397 avx2
1b932eb1 1398 fma3
50cd43f2
DB
1399 fma4
1400 mmx
1401 mmxext
1402 sse
1403 sse2
1404 sse3
1405 sse4
1406 sse42
1407 ssse3
7caf48e0
DB
1408 xop
1409"
50cd43f2 1410
7a650caf
DB
1411ARCH_EXT_LIST_PPC="
1412 altivec
1413 dcbzl
1414 ldbrx
f22ebd25 1415 power8
7a650caf 1416 ppc4xx
f22ebd25 1417 vsx
7a650caf
DB
1418"
1419
84bf8817
DB
1420ARCH_EXT_LIST_X86="
1421 $ARCH_EXT_LIST_X86_SIMD
1422 cpunop
1423 i686
1424"
1425
1016a75c
LB
1426ARCH_EXT_LIST_MIPS="
1427 loongson
1428 mips32r1
1429 mips64r1
1430 mips32r2
1431 mips64r2
1432 mips32r6
1433 mips64r6
1434"
1435
50cd43f2 1436ARCH_EXT_LIST="
81dfa21e 1437 $ARCH_EXT_LIST_ARM
1016a75c 1438 $ARCH_EXT_LIST_MIPS
7a650caf 1439 $ARCH_EXT_LIST_PPC
50cd43f2 1440 $ARCH_EXT_LIST_X86
7a650caf 1441 vis
50cd43f2 1442"
3f5b56e5 1443
7a650caf
DB
1444ARCH_FEATURES="
1445 aligned_stack
1446 fast_64bit
1447 fast_clz
1448 fast_cmov
1449 local_aligned_8
1450 local_aligned_16
eba2233b 1451 simd_align_16
7a650caf
DB
1452"
1453
1454BUILTIN_LIST="
1455 atomic_cas_ptr
1456 machine_rw_barrier
1457 MemoryBarrier
1458 mm_empty
1459 rdtsc
6bb99757 1460 sem_timedwait
7a650caf
DB
1461 sync_val_compare_and_swap
1462"
7caf48e0 1463HAVE_LIST_CMDLINE="
fd712a55
DB
1464 inline_asm
1465 symver
1466 yasm
7caf48e0 1467"
fd712a55 1468
7caf48e0 1469HAVE_LIST_PUB="
a3e02a8c 1470 bigendian
d268eee9 1471 fast_unaligned
7caf48e0 1472"
a3e02a8c 1473
7a650caf 1474HEADERS_LIST="
4f979418 1475 AVFoundation_AVFoundation_h
7a650caf
DB
1476 alsa_asoundlib_h
1477 altivec_h
1478 arpa_inet_h
1479 cdio_paranoia_h
1480 cdio_paranoia_paranoia_h
6bb99757 1481 dispatch_dispatch_h
7a650caf
DB
1482 dev_bktr_ioctl_bt848_h
1483 dev_bktr_ioctl_meteor_h
1484 dev_ic_bt8xx_h
1485 dev_video_bktr_ioctl_bt848_h
1486 dev_video_meteor_ioctl_meteor_h
1487 direct_h
1488 dlfcn_h
d8039ef8 1489 d3d11_h
7a650caf
DB
1490 dxva_h
1491 gsm_h
1492 io_h
1493 mach_mach_time_h
1494 machine_ioctl_bt848_h
1495 machine_ioctl_meteor_h
1496 malloc_h
1497 poll_h
1498 sndio_h
1499 soundcard_h
1500 sys_mman_h
1501 sys_param_h
1502 sys_resource_h
1503 sys_select_h
1504 sys_soundcard_h
1505 sys_time_h
1506 sys_un_h
1507 sys_videoio_h
1508 unistd_h
eaa2d123 1509 valgrind_valgrind_h
7a650caf
DB
1510 windows_h
1511 winsock2_h
1512"
1513
d45ebd48
JG
1514INTRINSICS_LIST="
1515 intrinsics_neon
1516"
1517
79042ab3 1518MATH_FUNCS="
fab0a8b2
MR
1519 atanf
1520 atan2f
79042ab3 1521 cbrtf
fab0a8b2 1522 cosf
79042ab3
DB
1523 exp2
1524 exp2f
fab0a8b2 1525 expf
79042ab3
DB
1526 isinf
1527 isnan
fab0a8b2 1528 ldexpf
79042ab3
DB
1529 llrint
1530 llrintf
1531 log2
1532 log2f
fab0a8b2 1533 log10f
79042ab3
DB
1534 lrint
1535 lrintf
fab0a8b2 1536 powf
79042ab3
DB
1537 rint
1538 round
1539 roundf
fab0a8b2 1540 sinf
79042ab3
DB
1541 trunc
1542 truncf
1543"
1544
7a650caf 1545SYSTEM_FUNCS="
be1a839c 1546 aligned_malloc
ebef9f5a 1547 clock_gettime
ecf97f22 1548 closesocket
15caccb9 1549 CommandLineToArgvW
a61c2115 1550 CoTaskMemFree
1093383d 1551 CryptGenRandom
c88f5d72 1552 dlopen
534a2231 1553 fcntl
e854b8f9 1554 flt_lim
9d99cc5a 1555 fork
84882df6 1556 getaddrinfo
da9e86f8 1557 gethrtime
667fb97a 1558 getopt
02e8f427 1559 GetProcessAffinityMask
fc5607f8 1560 GetProcessMemoryInfo
4e68cb8a 1561 GetProcessTimes
66be5b45 1562 getrusage
7caf48e0 1563 GetSystemTimeAsFileTime
61183b5a 1564 gettimeofday
3f8f1c6f 1565 gmtime_r
2e1913b1 1566 inet_aton
abfc8d05 1567 isatty
8772997d 1568 jack_port_get_latency_range
b08caa87 1569 LoadLibrary
a5b64584 1570 localtime_r
c708b540 1571 mach_absolute_time
73f6d31e 1572 MapViewOfFile
c88f5d72 1573 memalign
6ffa87d3 1574 mkstemp
0328b9ea 1575 mmap
e98b02de 1576 mprotect
d3d3a32c 1577 nanosleep
1f91cdce 1578 posix_memalign
ea4d5f48 1579 sched_getaffinity
7e6a11bc 1580 SetConsoleTextAttribute
b507ebd1 1581 setmode
3e0b1c9a 1582 setrlimit
d3d3a32c 1583 Sleep
87958234 1584 strerror_r
7a650caf
DB
1585 sysconf
1586 sysctl
1587 usleep
1588 VirtualAlloc
1589"
1590
1591TOOLCHAIN_FEATURES="
896a5bff 1592 as_dn_directive
d5a55981 1593 as_func
dcae2e32 1594 as_object_arch
7a650caf
DB
1595 asm_mod_q
1596 attribute_may_alias
1597 attribute_packed
1598 ebp_available
1599 ebx_available
1600 gnu_as
1601 ibm_asm
1602 inline_asm_labels
1603 pragma_deprecated
1604 symver_asm_label
1605 symver_gnu_asm
1606 vfp_args
1607 xform_asm
1608 xmm_clobbers
1609"
1610
1611TYPES_LIST="
73ea3ffc 1612 CONDITION_VARIABLE_Ptr
7a650caf 1613 socklen_t
c0018613 1614 struct_addrinfo
75d339e0
MS
1615 struct_group_source_req
1616 struct_ip_mreq_source
b4d68544 1617 struct_ipv6_mreq
cdee08e3 1618 struct_pollfd
3e0b1c9a 1619 struct_rusage_ru_maxrss
b4d68544 1620 struct_sockaddr_in6
3b2372bf 1621 struct_sockaddr_sa_len
33a4dbdd 1622 struct_sockaddr_storage
a6a4793d 1623 struct_v4l2_frmivalenum_discrete
7a650caf
DB
1624"
1625
1626HAVE_LIST="
1627 $ARCH_EXT_LIST
1628 $(add_suffix _external $ARCH_EXT_LIST)
1629 $(add_suffix _inline $ARCH_EXT_LIST)
1630 $ARCH_FEATURES
1631 $ATOMICS_LIST
1632 $BUILTIN_LIST
1633 $HAVE_LIST_CMDLINE
1634 $HAVE_LIST_PUB
1635 $HEADERS_LIST
d45ebd48 1636 $INTRINSICS_LIST
7a650caf
DB
1637 $MATH_FUNCS
1638 $SYSTEM_FUNCS
1639 $THREADS_LIST
1640 $TOOLCHAIN_FEATURES
1641 $TYPES_LIST
1642 atomics_native
1643 dos_paths
a61c2115 1644 dxva2_lib
7a650caf
DB
1645 libc_msvcrt
1646 libdc1394_1
1647 libdc1394_2
1648 sdl
f963f803 1649 section_data_rel_ro
b265431e 1650 threads
5d273d3e 1651 vaapi_drm
990e4a66 1652 vaapi_x11
7671dd7c 1653 vdpau_x11
7671dd7c 1654 xlib
0cb78cef 1655"
44161118 1656
511cf612 1657# options emitted with CONFIG_ prefix but not available on the command line
b6bb00b0 1658CONFIG_EXTRA="
87849592 1659 aandcttables
bfe9f48a 1660 ac3dsp
aa11cb79 1661 audio_frame_queue
9a9e2f1c 1662 audiodsp
e74433a8 1663 blockdsp
c67b449b 1664 bswapdsp
8ef33497 1665 cabac
e02de9df 1666 dirac_parse
f6ee61fb 1667 dvprofile
1274ea8d
DB
1668 faandct
1669 faanidct
a9aee08d 1670 fdctdsp
b075869b 1671 flacdsp
71f1ad37 1672 fmtconvert
f5ee2300 1673 g722dsp
bfe9f48a 1674 gcrypt
63ce9fd2 1675 gmp
478fd534 1676 golomb
9cad0e4e 1677 gplv3
0338c396 1678 h263dsp
478fd534
DB
1679 h264chroma
1680 h264dsp
1681 h264pred
915a2a0a 1682 h264qpel
68d8238c 1683 hpeldsp
478fd534 1684 huffman
0d439fbe 1685 huffyuvdsp
512f3ffe 1686 huffyuvencdsp
e3fcb143 1687 idctdsp
bd499d9a 1688 iirfilter
3d5d4623 1689 imdct15
dc4d726b 1690 intrax8
624e2355 1691 iso_media
2edc77dc 1692 ividsp
4978850c 1693 jpegtables
e1319aa1 1694 libx262
9cad0e4e 1695 lgplv3
478fd534 1696 lpc
0c770761 1697 lzf
2d604443 1698 me_cmp
7b9ef8d7 1699 mpeg_er
1e164c0b 1700 mpegaudio
bfe9f48a 1701 mpegaudiodsp
18bbca1f 1702 mpegvideo
ad08dfd5 1703 mpegvideoenc
575ec60e 1704 mss34dsp
f46bb608 1705 pixblockdsp
368f5035 1706 qpeldsp
d0a63d8b 1707 qsv
b04d009b 1708 qsvdec
72b7441a 1709 qsvenc
f704a079 1710 rangecoder
255d9c57 1711 riffdec
3dd5c95d 1712 riffenc
bfe9f48a 1713 rtpdec
5ad2f0bf 1714 rtpenc_chain
5cb4bdb2 1715 rv34dsp
bfe9f48a 1716 sinewin
2ecfd451 1717 snappy
65a80240 1718 srtp
db7f1c7c 1719 startcode
8337e0c5
VG
1720 texturedsp
1721 texturedspenc
57f09608 1722 tpeldsp
104c804b 1723 vaapi_encode
15a24614 1724 vc1dsp
8c53d39e 1725 videodsp
ab9f9876 1726 vp3dsp
d4aea1aa 1727 vp56dsp
d42191c7 1728 vp8dsp
f2051856 1729 wma_freqs
a623aa00 1730 wmv2dsp
b6bb00b0
MR
1731"
1732
520cc7f1 1733CMDLINE_SELECT="
3f5b56e5 1734 $ARCH_EXT_LIST
520cc7f1 1735 $CONFIG_LIST
fd712a55 1736 $HAVE_LIST_CMDLINE
8eee7025 1737 $THREADS_LIST
c8a4ae00 1738 asm
db6107b6 1739 cross_compile
520cc7f1
MR
1740 debug
1741 extra_warnings
8c6afa4d 1742 logging
65d12900 1743 lto
d2bbb2f7 1744 optimizations
749b1f13 1745 rpath
520cc7f1 1746"
426be5dc 1747
7caf48e0 1748PATHS_LIST="
d156bede 1749 bindir
14a8acf1 1750 datadir
f4ca970d 1751 docdir
26759c44
MR
1752 incdir
1753 libdir
26759c44
MR
1754 mandir
1755 prefix
1756 shlibdir
7caf48e0 1757"
426be5dc
DB
1758
1759CMDLINE_SET="
1760 $PATHS_LIST
121d78d0 1761 ar
426be5dc 1762 arch
313c46a6 1763 as
426be5dc
DB
1764 build_suffix
1765 cc
9f57f134 1766 objcc
426be5dc
DB
1767 cpu
1768 cross_prefix
8ae1d87a 1769 custom_allocator
50567afa 1770 dep_cc
604abd02 1771 env
ac63af34 1772 extra_version
9da6609f
MR
1773 host_cc
1774 host_cflags
095792f2 1775 host_ld
9da6609f
MR
1776 host_ldflags
1777 host_libs
82bb3329 1778 host_os
684b28e0 1779 ld
426be5dc 1780 logfile
4ae40685 1781 malloc_prefix
89641463 1782 nm
9cd7b854 1783 optflags
3f8040db 1784 pkg_config
390acbea 1785 pkg_config_flags
154caa67 1786 random_seed
2fad0977 1787 samples
c5200f17
MR
1788 sysinclude
1789 sysroot
a7ada2ba 1790 target_exec
26759c44 1791 target_os
a7ada2ba 1792 target_path
ba13606c 1793 target_samples
aeeb782c 1794 toolchain
426be5dc 1795"
520cc7f1 1796
89f2932b
MR
1797CMDLINE_APPEND="
1798 extra_cflags
9f57f134 1799 extra_objcflags
4cc4b33f 1800 host_cppflags
89f2932b
MR
1801"
1802
912f3148
DB
1803# code dependency declarations
1804
9eeed841 1805# architecture extensions
808fa33c 1806
a2fc0f6a
MR
1807armv5te_deps="arm"
1808armv6_deps="arm"
ab5cb084 1809armv6t2_deps="arm"
8675bcb0 1810armv8_deps="aarch64"
b7b17ed6 1811neon_deps_any="aarch64 arm"
d45ebd48 1812intrinsics_neon_deps="neon"
b7b17ed6 1813vfp_deps_any="aarch64 arm"
b3267559 1814vfpv3_deps="vfp"
808fa33c 1815
637606de
MR
1816map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
1817
808fa33c
MR
1818altivec_deps="ppc"
1819ppc4xx_deps="ppc"
f22ebd25
LB
1820vsx_deps="altivec"
1821power8_deps="vsx"
808fa33c 1822
84146963
DB
1823cpunop_deps="i686"
1824x86_64_select="i686"
1825x86_64_suggest="fast_cmov"
50cd43f2 1826
808fa33c
MR
1827amd3dnow_deps="mmx"
1828amd3dnowext_deps="amd3dnow"
fb87e69f 1829i686_deps="x86"
9eeed841 1830mmx_deps="x86"
239fdf1b 1831mmxext_deps="mmx"
50cd43f2
DB
1832sse_deps="mmxext"
1833sse2_deps="sse"
1834sse3_deps="sse2"
1835ssse3_deps="sse3"
1836sse4_deps="ssse3"
1837sse42_deps="sse4"
1838avx_deps="sse42"
10b0161d 1839xop_deps="avx"
1b932eb1 1840fma3_deps="avx"
79687079 1841fma4_deps="avx"
4d6ee072 1842avx2_deps="avx"
9eeed841 1843
43b73d59
DB
1844mmx_external_deps="yasm"
1845mmx_inline_deps="inline_asm"
1846mmx_suggest="mmx_external mmx_inline"
1847
84bf8817 1848for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
43b73d59
DB
1849 eval dep=\$${ext}_deps
1850 eval ${ext}_external_deps='"${dep}_external"'
1851 eval ${ext}_inline_deps='"${dep}_inline"'
1852 eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
1853done
1854
032d4da8
JG
1855aligned_stack_if_any="aarch64 ppc x86"
1856fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
1857fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
1858fast_unaligned_if_any="aarch64 ppc x86"
eba2233b 1859simd_align_16_if_any="altivec neon sse"
89e053f8 1860
1a5fdf95 1861# system capabilities
b462d132 1862symver_if_any="symver_asm_label symver_gnu_asm"
eaa2d123 1863valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
b462d132 1864
8558595a
DB
1865# threading support
1866atomics_gcc_if="sync_val_compare_and_swap"
1867atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
1868atomics_win32_if="MemoryBarrier"
1869atomics_native_if_any="$ATOMICS_LIST"
874c751c 1870w32threads_deps="atomics_native"
8558595a
DB
1871threads_if_any="$THREADS_LIST"
1872
26fbcc85 1873# subsystems
dc609252 1874dct_select="rdft"
e02de9df 1875dirac_parse_select="golomb"
2d604443 1876error_resilience_select="me_cmp"
1274ea8d
DB
1877faandct_deps="faan fdctdsp"
1878faanidct_deps="faan idctdsp"
7d16d853 1879h264dsp_select="startcode"
15932389 1880intrax8_select="blockdsp idctdsp"
26fbcc85
MR
1881mdct_select="fft"
1882rdft_select="fft"
2d604443 1883me_cmp_select="fdctdsp idctdsp pixblockdsp"
7b9ef8d7 1884mpeg_er_select="error_resilience"
1e164c0b 1885mpegaudio_select="mpegaudiodsp"
c4f5c2d6 1886mpegaudiodsp_select="dct"
2870972e 1887mpegvideo_select="blockdsp hpeldsp idctdsp me_cmp mpeg_er videodsp"
2d604443 1888mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
15a24614 1889vc1dsp_select="h264chroma qpeldsp startcode"
26fbcc85 1890
ed40b6bf 1891# decoders / encoders
d615187f 1892aac_decoder_select="imdct15 mdct sinewin"
bd499d9a 1893aac_encoder_select="audio_frame_queue iirfilter mdct sinewin"
136e19e1 1894aac_latm_decoder_select="aac_decoder aac_latm_parser"
71f1ad37 1895ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
2d604443
DB
1896ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
1897ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
f5ee2300
VG
1898adpcm_g722_decoder_select="g722dsp"
1899adpcm_g722_encoder_select="g722dsp"
e3fcb143 1900aic_decoder_select="golomb idctdsp"
f4d608e3 1901alac_encoder_select="lpc"
c67b449b 1902als_decoder_select="bswapdsp"
b781cc12 1903amrnb_decoder_select="lsp"
2b2a597e 1904amrwb_decoder_select="lsp"
0a36988e 1905amv_decoder_select="sp5x_decoder"
c67b449b 1906ape_decoder_select="bswapdsp"
e3fcb143 1907asv1_decoder_select="blockdsp bswapdsp idctdsp"
f46bb608 1908asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
e3fcb143 1909asv2_decoder_select="blockdsp bswapdsp idctdsp"
f46bb608 1910asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
4538729a 1911atrac1_decoder_select="mdct sinewin"
26fbcc85 1912atrac3_decoder_select="mdct"
e6f0bb65 1913atrac3p_decoder_select="mdct sinewin"
e74433a8 1914bink_decoder_select="blockdsp hpeldsp"
f2051856
DB
1915binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
1916binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
e3fcb143 1917cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
c67b449b 1918cllc_decoder_select="bswapdsp"
9b500b8f 1919comfortnoise_encoder_select="lpc"
9a9e2f1c 1920cook_decoder_select="audiodsp mdct sinewin"
2a91ada8 1921cscd_decoder_select="lzo"
2eef7c62 1922cscd_decoder_suggest="zlib"
71f1ad37 1923dca_decoder_select="fmtconvert mdct"
5c018ee1 1924dds_decoder_select="texturedsp"
e3fcb143 1925dnxhd_decoder_select="blockdsp idctdsp"
f46bb608 1926dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
f6ee61fb 1927dvvideo_decoder_select="dvprofile idctdsp"
2d604443 1928dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
61c31e4e 1929dxa_decoder_deps="zlib"
c45fcf30 1930dxv_decoder_select="lzf texturedsp"
baf91bb9 1931eac3_decoder_select="ac3_decoder"
4264a0dd 1932eac3_encoder_select="ac3_encoder"
e3fcb143
DB
1933eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
1934eatgq_decoder_select="aandcttables idctdsp"
f7d77b9a 1935eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp"
38389058 1936exr_decoder_deps="zlib"
cd832f03
DB
1937ffv1_decoder_select="golomb rangecoder"
1938ffv1_encoder_select="rangecoder"
2f02bbcc
DB
1939ffvhuff_decoder_select="huffyuv_decoder"
1940ffvhuff_encoder_select="huffyuv_encoder"
93e15a32 1941fic_decoder_select="golomb"
b075869b
VG
1942flac_decoder_select="flacdsp golomb"
1943flac_encoder_select="bswapdsp flacdsp golomb lpc"
61c31e4e
DB
1944flashsv_decoder_deps="zlib"
1945flashsv_encoder_deps="zlib"
1946flashsv2_decoder_deps="zlib"
4414137e 1947flv_decoder_select="h263_decoder"
4d4b4bd1 1948flv_encoder_select="h263_encoder"
c67b449b
DB
1949fourxm_decoder_select="blockdsp bswapdsp"
1950fraps_decoder_select="bswapdsp huffman"
61c31e4e 1951g2m_decoder_deps="zlib"
4978850c 1952g2m_decoder_select="blockdsp idctdsp jpegtables"
7b9ef8d7 1953h261_decoder_select="mpeg_er mpegvideo"
ad08dfd5 1954h261_encoder_select="aandcttables mpegvideoenc"
7b9ef8d7 1955h263_decoder_select="error_resilience h263_parser h263dsp mpeg_er mpegvideo qpeldsp"
0338c396 1956h263_encoder_select="aandcttables h263dsp mpegvideoenc"
4414137e 1957h263i_decoder_select="h263_decoder"
fe629c2d 1958h263p_encoder_select="h263_encoder"
7d16d853 1959h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel videodsp"
0b499c9b 1960h264_decoder_suggest="error_resilience"
7ca3e520
VG
1961hap_decoder_select="snappy texturedsp"
1962hap_encoder_deps="libsnappy"
1963hap_encoder_select="texturedspenc"
c67b449b
DB
1964hevc_decoder_select="bswapdsp cabac golomb videodsp"
1965huffyuv_decoder_select="bswapdsp huffyuvdsp"
1966huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp"
34150be5 1967iac_decoder_select="imc_decoder"
c67b449b 1968imc_decoder_select="bswapdsp fft mdct sinewin"
8f992dc8 1969indeo3_decoder_select="hpeldsp"
2edc77dc
VG
1970indeo4_decoder_select="ividsp"
1971indeo5_decoder_select="ividsp"
8071264f 1972interplay_video_decoder_select="hpeldsp"
8e0cf39f 1973jpegls_decoder_select="golomb mjpeg_decoder"
4f034993 1974jpegls_encoder_select="golomb"
e74433a8 1975jv_decoder_select="blockdsp"
0d439fbe 1976lagarith_decoder_select="huffyuvdsp"
4978850c 1977ljpeg_encoder_select="aandcttables idctdsp jpegtables"
4f034993 1978loco_decoder_select="golomb"
e3fcb143 1979mdec_decoder_select="blockdsp idctdsp mpegvideo"
3e589878 1980metasound_decoder_select="lsp mdct sinewin"
e3fcb143 1981mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
4978850c
DB
1982mjpeg_decoder_select="blockdsp hpeldsp idctdsp jpegtables"
1983mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
7caf48e0 1984mjpegb_decoder_select="mjpeg_decoder"
83f230c2
MT
1985mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
1986mjpeg_vaapi_encoder_select="vaapi_encode jpegtables"
9ecf1b62 1987mlp_decoder_select="mlp_parser"
c67b449b 1988motionpixels_decoder_select="bswapdsp"
1e164c0b
DB
1989mp1_decoder_select="mpegaudio"
1990mp1float_decoder_select="mpegaudio"
1991mp2_decoder_select="mpegaudio"
1992mp2float_decoder_select="mpegaudio"
1993mp3_decoder_select="mpegaudio"
1994mp3adu_decoder_select="mpegaudio"
1995mp3adufloat_decoder_select="mpegaudio"
1996mp3float_decoder_select="mpegaudio"
1997mp3on4_decoder_select="mpegaudio"
1998mp3on4float_decoder_select="mpegaudio"
c67b449b 1999mpc7_decoder_select="bswapdsp mpegaudiodsp"
88b24064 2000mpc8_decoder_select="mpegaudiodsp"
3e0b1c9a 2001mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
d767e2f9 2002mpeg_xvmc_decoder_select="mpeg2video_decoder"
7b9ef8d7 2003mpeg1video_decoder_select="error_resilience mpeg_er mpegvideo"
06b54e84 2004mpeg1video_encoder_select="aandcttables mpegvideoenc"
7b9ef8d7 2005mpeg2video_decoder_select="error_resilience mpeg_er mpegvideo"
06b54e84 2006mpeg2video_encoder_select="aandcttables mpegvideoenc"
3e0b1c9a
DB
2007mpeg4_decoder_select="h263_decoder mpeg4video_parser"
2008mpeg4_encoder_select="h263_encoder"
575ec60e 2009msa1_decoder_select="mss34dsp"
4414137e 2010msmpeg4v1_decoder_select="h263_decoder"
4414137e 2011msmpeg4v2_decoder_select="h263_decoder"
4e169d89 2012msmpeg4v2_encoder_select="h263_encoder"
4414137e 2013msmpeg4v3_decoder_select="h263_decoder"
4e169d89 2014msmpeg4v3_encoder_select="h263_encoder"
b10c33c5 2015mss2_decoder_select="error_resilience mpeg_er mpegvideo vc1_decoder"
575ec60e 2016mts2_decoder_select="mss34dsp"
8e0cf39f 2017mxpeg_decoder_select="mjpeg_decoder"
4538729a 2018nellymoser_decoder_select="mdct sinewin"
aa11cb79 2019nellymoser_encoder_select="audio_frame_queue mdct sinewin"
e3fcb143 2020nuv_decoder_select="idctdsp lzo"
e2834567 2021on2avc_decoder_select="mdct"
b70d7a4a 2022opus_decoder_deps="avresample"
3d5d4623 2023opus_decoder_select="imdct15"
61c31e4e 2024png_decoder_deps="zlib"
61c31e4e 2025png_encoder_deps="zlib"
512f3ffe 2026png_encoder_select="huffyuvencdsp"
e3fcb143 2027prores_decoder_select="idctdsp"
a9aee08d 2028prores_encoder_select="fdctdsp"
b781cc12 2029qcelp_decoder_select="lsp"
c4f5c2d6 2030qdm2_decoder_select="mdct rdft mpegaudiodsp"
aa11cb79 2031ra_144_encoder_select="audio_frame_queue lpc"
9f43fdda 2032ralf_decoder_select="golomb"
533a6198 2033rscc_decoder_deps="zlib"
7b9ef8d7 2034rv10_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
b2bf38b4 2035rv10_encoder_select="h263_encoder"
7b9ef8d7 2036rv20_decoder_select="error_resilience h263_decoder h263dsp mpeg_er"
b2bf38b4 2037rv20_encoder_select="h263_encoder"
5cb4bdb2
VG
2038rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo rv34dsp videodsp"
2039rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpeg_er mpegvideo rv34dsp videodsp"
9a3202a9 2040screenpresso_decoder_deps="zlib"
4f034993 2041shorten_decoder_select="golomb"
b781cc12 2042sipr_decoder_select="lsp"
8e0cf39f 2043sp5x_decoder_select="mjpeg_decoder"
6caa44aa 2044svq1_decoder_select="hpeldsp"
2d604443 2045svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
add1467e 2046svq3_decoder_select="golomb h264dsp h264pred hpeldsp tpeldsp videodsp"
d48430c3 2047svq3_decoder_suggest="zlib"
9a9e2f1c 2048tak_decoder_select="audiodsp"
247e370e
VG
2049tdsc_decoder_deps="zlib"
2050tdsc_decoder_select="mjpeg_decoder"
4eef77c1 2051theora_decoder_select="vp3_decoder"
7caf48e0 2052thp_decoder_select="mjpeg_decoder"
2eef7c62
AJ
2053tiff_decoder_suggest="zlib"
2054tiff_encoder_suggest="zlib"
aec09a00 2055truehd_decoder_select="mlp_decoder"
c67b449b
DB
2056truemotion2_decoder_select="bswapdsp"
2057truespeech_decoder_select="bswapdsp"
61c31e4e 2058tscc_decoder_deps="zlib"
c0b10575 2059txd_decoder_select="texturedsp"
4538729a 2060twinvq_decoder_select="mdct lsp sinewin"
c67b449b
DB
2061utvideo_decoder_select="bswapdsp"
2062utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
0d439fbe 2063vble_decoder_select="huffyuvdsp"
15a24614 2064vc1_decoder_select="blockdsp error_resilience h263_decoder h264qpel intrax8 mpeg_er mpegvideo vc1dsp"
45ecda85 2065vc1image_decoder_select="vc1_decoder"
26fbcc85
MR
2066vorbis_decoder_select="mdct"
2067vorbis_encoder_select="mdct"
3bd062bf 2068vp3_decoder_select="hpeldsp vp3dsp videodsp"
d4aea1aa
VG
2069vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
2070vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
e82dc4c9
DB
2071vp6a_decoder_select="vp6_decoder"
2072vp6f_decoder_select="vp6_decoder"
d42191c7
VG
2073vp7_decoder_select="h264pred videodsp vp8dsp"
2074vp8_decoder_select="h264pred videodsp vp8dsp"
72ca830f 2075vp9_decoder_select="videodsp"
c4bfa098 2076webp_decoder_select="vp8_decoder"
f2051856
DB
2077wmapro_decoder_select="mdct sinewin wma_freqs"
2078wmav1_decoder_select="mdct sinewin wma_freqs"
2079wmav1_encoder_select="mdct sinewin wma_freqs"
2080wmav2_decoder_select="mdct sinewin wma_freqs"
2081wmav2_encoder_select="mdct sinewin wma_freqs"
4538729a 2082wmavoice_decoder_select="lsp rdft dct mdct sinewin"
f95bfab0 2083wmv1_decoder_select="h263_decoder"
665507aa 2084wmv1_encoder_select="h263_encoder"
0c6a7087 2085wmv2_decoder_select="blockdsp error_resilience h263_decoder idctdsp intrax8 videodsp wmv2dsp"
a623aa00 2086wmv2_encoder_select="h263_encoder wmv2dsp"
015f8ee0 2087wmv3_decoder_select="vc1_decoder"
45ecda85 2088wmv3image_decoder_select="wmv3_decoder"
61c31e4e
DB
2089zerocodec_decoder_deps="zlib"
2090zlib_decoder_deps="zlib"
2091zlib_encoder_deps="zlib"
2092zmbv_decoder_deps="zlib"
2093zmbv_encoder_deps="zlib"
30fd06be 2094
ed40b6bf 2095# hardware accelerators
31de41ba 2096d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder"
e97446e6 2097dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
0afab17e 2098vaapi_deps="va_va_h"
ac3dbb4d 2099vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
9840130e 2100vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
c89c96e9
MR
2101vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
2102
82ca17ac
DB
2103h263_vaapi_hwaccel_deps="vaapi"
2104h263_vaapi_hwaccel_select="h263_decoder"
d8039ef8
SL
2105h264_d3d11va_hwaccel_deps="d3d11va"
2106h264_d3d11va_hwaccel_select="h264_decoder"
215cdd35
DB
2107h264_dxva2_hwaccel_deps="dxva2"
2108h264_dxva2_hwaccel_select="h264_decoder"
c4845616 2109h264_mmal_decoder_deps="mmal"
2110h264_mmal_hwaccel_deps="mmal"
2111h264_mmal_decoder_select="h264_decoder"
2112h264_mmal_encoder_deps="mmal"
e8919ec4 2113h264_omx_encoder_deps="omx"
11c22dfd 2114h264_qsv_hwaccel_deps="libmfx"
82ca17ac
DB
2115h264_vaapi_hwaccel_deps="vaapi"
2116h264_vaapi_hwaccel_select="h264_decoder"
2117h264_vda_hwaccel_deps="vda"
2118h264_vda_hwaccel_select="h264_decoder"
67afcefb
AK
2119h264_vda_old_hwaccel_deps="vda"
2120h264_vda_old_hwaccel_select="h264_decoder"
82ca17ac
DB
2121h264_vdpau_hwaccel_deps="vdpau"
2122h264_vdpau_hwaccel_select="h264_decoder"
d8039ef8
SL
2123hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2124hevc_d3d11va_hwaccel_select="hevc_decoder"
7e850fa6
HL
2125hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
2126hevc_dxva2_hwaccel_select="hevc_decoder"
41d47ea8 2127hevc_qsv_hwaccel_deps="libmfx"
8d34a2f8 2128hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
ab9068cc 2129hevc_vdpau_hwaccel_select="hevc_decoder"
82ca17ac
DB
2130mpeg1_vdpau_hwaccel_deps="vdpau"
2131mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
d8039ef8
SL
2132mpeg2_d3d11va_hwaccel_deps="d3d11va"
2133mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
215cdd35
DB
2134mpeg2_dxva2_hwaccel_deps="dxva2"
2135mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
d52208e8
JS
2136mpeg2_mmal_decoder_deps="mmal"
2137mpeg2_mmal_hwaccel_deps="mmal"
2138mpeg2_mmal_decoder_select="mpeg2video_decoder"
bf52f773 2139mpeg2_qsv_hwaccel_deps="libmfx"
82ca17ac
DB
2140mpeg2_vaapi_hwaccel_deps="vaapi"
2141mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
2142mpeg2_vdpau_hwaccel_deps="vdpau"
2143mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
e8919ec4 2144mpeg4_omx_encoder_deps="omx"
82ca17ac
DB
2145mpeg4_vaapi_hwaccel_deps="vaapi"
2146mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
82ca17ac
DB
2147mpeg4_vdpau_hwaccel_deps="vdpau"
2148mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
d8039ef8
SL
2149vc1_d3d11va_hwaccel_deps="d3d11va"
2150vc1_d3d11va_hwaccel_select="vc1_decoder"
215cdd35
DB
2151vc1_dxva2_hwaccel_deps="dxva2"
2152vc1_dxva2_hwaccel_select="vc1_decoder"
82ca17ac
DB
2153vc1_vaapi_hwaccel_deps="vaapi"
2154vc1_vaapi_hwaccel_select="vc1_decoder"
82ca17ac
DB
2155vc1_vdpau_hwaccel_deps="vdpau"
2156vc1_vdpau_hwaccel_select="vc1_decoder"
9a382f36 2157vc1_mmal_decoder_deps="mmal"
2158vc1_mmal_hwaccel_deps="mmal"
2159vc1_mmal_decoder_select="vc1_decoder"
d8039ef8 2160wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
ed40b6bf
DB
2161wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
2162wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
77525327 2163wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
ed40b6bf 2164
330177b5
DB
2165# hardware-accelerated codecs
2166nvenc_deps_any="dlopen LoadLibrary"
2167nvenc_extralibs='$ldl'
e8919ec4
MS
2168omx_deps="dlopen pthreads"
2169omx_extralibs='$ldl'
330177b5
DB
2170qsvdec_select="qsv"
2171qsvenc_select="qsv"
2172vaapi_encode_deps="vaapi"
2173
2174hwupload_cuda_filter_deps="cuda"
2175scale_npp_filter_deps="cuda libnpp"
2176
2177h264_nvenc_encoder_deps="nvenc"
2178h264_qsv_decoder_deps="libmfx"
2179h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel"
2180h264_qsv_encoder_deps="libmfx"
2181h264_qsv_encoder_select="qsvenc"
2182h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
2183h264_vaapi_encoder_select="vaapi_encode golomb"
2184
2185hevc_nvenc_encoder_deps="nvenc"
2186hevc_qsv_decoder_deps="libmfx"
2187hevc_qsv_encoder_deps="libmfx"
2188hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser hevc_qsv_hwaccel qsvdec"
2189hevc_qsv_encoder_select="qsvenc"
2190hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
2191hevc_vaapi_encoder_select="vaapi_encode golomb"
2192mpeg2_qsv_decoder_deps="libmfx"
2193mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel mpegvideo_parser"
2194mpeg2_qsv_encoder_deps="libmfx"
2195mpeg2_qsv_encoder_select="qsvenc"
2196
2197nvenc_h264_encoder_deps="nvenc"
2198nvenc_hevc_encoder_deps="nvenc"
2199
28b80940 2200# parsers
72da8d9b 2201h264_parser_select="golomb h264dsp"
650060df 2202hevc_parser_select="golomb"
a6a675a7 2203mpegvideo_parser_select="mpegvideo"
de3b134b 2204mpeg4video_parser_select="error_resilience h263dsp mpegvideo qpeldsp"
d24bd96b 2205vc1_parser_select="vc1dsp"
28b80940 2206
4978850c
DB
2207# bitstream_filters
2208mjpeg2jpeg_bsf_select="jpegtables"
2209
912f3148 2210# external libraries
72025ac3 2211libdcadec_decoder_deps="libdcadec"
c9171a83 2212libfaac_encoder_deps="libfaac"
aa11cb79 2213libfaac_encoder_select="audio_frame_queue"
4f2b469d 2214libfdk_aac_decoder_deps="libfdk_aac"
37eeb5e2 2215libfdk_aac_encoder_deps="libfdk_aac"
aa11cb79 2216libfdk_aac_encoder_select="audio_frame_queue"
299c77d5
MR
2217libgsm_decoder_deps="libgsm"
2218libgsm_encoder_deps="libgsm"
8ffed8d8
MR
2219libgsm_ms_decoder_deps="libgsm"
2220libgsm_ms_encoder_deps="libgsm"
3641b048
MS
2221libilbc_decoder_deps="libilbc"
2222libilbc_encoder_deps="libilbc"
233d2fa0 2223libkvazaar_encoder_deps="libkvazaar"
1cc60c47 2224libmp3lame_encoder_deps="libmp3lame"
aa11cb79 2225libmp3lame_encoder_select="audio_frame_queue"
0b175caa
DB
2226libopencore_amrnb_decoder_deps="libopencore_amrnb"
2227libopencore_amrnb_encoder_deps="libopencore_amrnb"
aa11cb79 2228libopencore_amrnb_encoder_select="audio_frame_queue"
0b175caa 2229libopencore_amrwb_decoder_deps="libopencore_amrwb"
8a3d9ca6 2230libopenh264_encoder_deps="libopenh264"
9a77d59a 2231libopenjpeg_decoder_deps="libopenjpeg"
453c02f9 2232libopenjpeg_encoder_deps="libopenjpeg"
44617d6e 2233libopus_decoder_deps="libopus"
6cb8c854 2234libopus_encoder_deps="libopus"
aa11cb79 2235libopus_encoder_select="audio_frame_queue"
f7cd9eed
AS
2236libschroedinger_decoder_deps="libschroedinger"
2237libschroedinger_encoder_deps="libschroedinger"
ae14f311 2238libspeex_decoder_deps="libspeex"
b606a017 2239libspeex_encoder_deps="libspeex"
aa11cb79 2240libspeex_encoder_select="audio_frame_queue"
150d2772 2241libtheora_encoder_deps="libtheora"
718907cd 2242libtwolame_encoder_deps="libtwolame"
d89e738a 2243libvo_aacenc_encoder_deps="libvo_aacenc"
aa11cb79 2244libvo_aacenc_encoder_select="audio_frame_queue"
f502ff3f 2245libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
b0caf888 2246libvorbis_encoder_deps="libvorbis"
aa11cb79 2247libvorbis_encoder_select="audio_frame_queue"
3f111804
LB
2248libvpx_vp8_decoder_deps="libvpx"
2249libvpx_vp8_encoder_deps="libvpx"
2250libvpx_vp9_decoder_deps="libvpx"
2251libvpx_vp9_encoder_deps="libvpx"
84d3ff50 2252libwavpack_encoder_deps="libwavpack"
be7c3231 2253libwebp_encoder_deps="libwebp"
e1319aa1 2254libx262_encoder_deps="libx262"
1cc60c47 2255libx264_encoder_deps="libx264"
50ea9315 2256libx265_encoder_deps="libx265"
de295976 2257libxavs_encoder_deps="libxavs"
1cc60c47 2258libxvid_encoder_deps="libxvid"
30fd06be 2259
912f3148 2260# demuxers / muxers
c2dd0e9e 2261ac3_demuxer_select="ac3_parser"
255d9c57 2262asf_demuxer_select="riffdec"
3dd5c95d 2263asf_muxer_select="riffenc"
647c2356 2264asf_stream_muxer_select="asf_muxer"
624e2355 2265avi_demuxer_select="iso_media riffdec"
3dd5c95d 2266avi_muxer_select="riffenc"
4e622dea 2267avisynth_demuxer_deps="avisynth"
255d9c57 2268avisynth_demuxer_select="riffdec"
624e2355 2269caf_demuxer_select="iso_media riffdec"
fe5e6e34 2270dash_muxer_select="mp4_muxer"
c2dd0e9e 2271dirac_demuxer_select="dirac_parser"
f6ee61fb
AK
2272dv_demuxer_select="dvprofile"
2273dv_muxer_select="dvprofile"
255d9c57 2274dxa_demuxer_select="riffdec"
5b423887 2275eac3_demuxer_select="ac3_parser"
e01fba55 2276f4v_muxer_select="mov_muxer"
c2dd0e9e 2277flac_demuxer_select="flac_parser"
435214a7 2278hds_muxer_select="flv_muxer"
c9031c7c 2279hls_muxer_select="mpegts_muxer"
647c2356 2280ipod_muxer_select="mov_muxer"
31f16dc1 2281ismv_muxer_select="mov_muxer"
647c2356 2282matroska_audio_muxer_select="matroska_muxer"
624e2355 2283matroska_demuxer_select="iso_media riffdec"
2a91ada8 2284matroska_demuxer_suggest="bzlib lzo zlib"
624e2355 2285matroska_muxer_select="iso_media riffenc"
3dd5c95d 2286mmf_muxer_select="riffenc"
624e2355 2287mov_demuxer_select="iso_media riffdec"
4e622dea 2288mov_demuxer_suggest="zlib"
624e2355 2289mov_muxer_select="iso_media riffenc rtpenc_chain"
c2dd0e9e 2290mp3_demuxer_select="mpegaudio_parser"
647c2356 2291mp4_muxer_select="mov_muxer"
624e2355 2292mpegts_demuxer_select="iso_media"
75644335 2293mpegts_muxer_select="adts_muxer latm_muxer"
647c2356
DB
2294mpegtsraw_demuxer_select="mpegts_demuxer"
2295mxf_d10_muxer_select="mxf_muxer"
3dd5c95d 2296nut_muxer_select="riffenc"
255d9c57 2297nuv_demuxer_select="riffdec"
051aadee 2298oga_muxer_select="ogg_muxer"
e02de9df 2299ogg_demuxer_select="dirac_parse"
051aadee 2300opus_muxer_select="ogg_muxer"
647c2356 2301psp_muxer_select="mov_muxer"
44594cc7 2302rtp_demuxer_select="sdp_demuxer"
65a80240 2303rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
44b70ce5 2304rtsp_demuxer_select="http_protocol rtpdec"
5ad2f0bf 2305rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
01c8d258 2306sap_demuxer_select="sdp_demuxer"
5ad2f0bf 2307sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
44b70ce5 2308sdp_demuxer_select="rtpdec"
e772f9fa 2309smoothstreaming_muxer_select="ismv_muxer"
f1e94694 2310spdif_muxer_select="aac_parser"
051aadee 2311spx_muxer_select="ogg_muxer"
7570c9e0 2312swf_demuxer_suggest="zlib"
57231e4d 2313tak_demuxer_select="tak_parser"
647c2356
DB
2314tg2_muxer_select="mov_muxer"
2315tgp_muxer_select="mov_muxer"
a7d45e06 2316w64_demuxer_select="wav_demuxer"
255d9c57 2317wav_demuxer_select="riffdec"
3dd5c95d 2318wav_muxer_select="riffenc"
624e2355 2319webm_muxer_select="iso_media riffenc"
e176639b 2320webm_muxer_suggest="libopus_encoder libvorbis_encoder libvpx_vp8_encoder libvpx_vp9_encoder"
82454c3a 2321wtv_demuxer_select="mpegts_demuxer riffdec"
255d9c57
DB
2322xmv_demuxer_select="riffdec"
2323xwma_demuxer_select="riffdec"
4e622dea
SS
2324
2325# indevs / outdevs
38e54a75 2326alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
38e54a75 2327alsa_outdev_deps="alsa_asoundlib_h"
4f979418 2328avfoundation_indev_deps="AVFoundation_AVFoundation_h"
38e54a75 2329bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
6fb65973
DB
2330dv1394_indev_deps="dv1394"
2331dv1394_indev_select="dv_demuxer"
c6f95144 2332fbdev_indev_deps="linux_fb_h"
6bb99757
JK
2333jack_indev_deps="jack_jack_h"
2334jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
e417d80d 2335libcdio_indev_deps="libcdio"
38e54a75 2336libdc1394_indev_deps="libdc1394"
38e54a75
SS
2337oss_indev_deps_any="soundcard_h sys_soundcard_h"
2338oss_outdev_deps_any="soundcard_h sys_soundcard_h"
0de9c41f 2339pulse_indev_deps="libpulse"
15d59d2c
B
2340sndio_indev_deps="sndio_h"
2341sndio_outdev_deps="sndio_h"
38e54a75 2342v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
ec1ee802 2343vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
a1b3c5a3 2344vfwcap_indev_extralibs="-lavicap32"
a6674d2e
LB
2345x11grab_indev_deps="x11grab"
2346x11grab_xcb_indev_deps="libxcb"
30fd06be 2347
912f3148 2348# protocols
acd554c1 2349ffrtmpcrypt_protocol_deps="!librtmp_protocol"
63ce9fd2 2350ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
acd554c1 2351ffrtmpcrypt_protocol_select="tcp_protocol"
775c4d36
SP
2352ffrtmphttp_protocol_deps="!librtmp_protocol"
2353ffrtmphttp_protocol_select="http_protocol"
998c1ee1 2354gopher_protocol_select="network"
279a0c97 2355http_protocol_select="tcp_protocol"
7caf48e0 2356httpproxy_protocol_select="tcp_protocol"
183baead 2357https_protocol_select="tls_protocol"
eb9244f2 2358icecast_protocol_select="http_protocol"
c3b57d6e
DB
2359librtmp_protocol_deps="librtmp"
2360librtmpe_protocol_deps="librtmp"
2361librtmps_protocol_deps="librtmp"
2362librtmpt_protocol_deps="librtmp"
2363librtmpte_protocol_deps="librtmp"
c60a2d70 2364mmsh_protocol_select="http_protocol"
998c1ee1 2365mmst_protocol_select="network"
c3b57d6e 2366rtmp_protocol_deps="!librtmp_protocol"
deeb7012 2367rtmp_protocol_select="tcp_protocol"
acd554c1 2368rtmpe_protocol_select="ffrtmpcrypt_protocol"
6aedabc9
SP
2369rtmps_protocol_deps="!librtmp_protocol"
2370rtmps_protocol_select="tls_protocol"
775c4d36 2371rtmpt_protocol_select="ffrtmphttp_protocol"
08cd95e8 2372rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
6c1ed454 2373rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
deeb7012 2374rtp_protocol_select="udp_protocol"
998c1ee1
DB
2375sctp_protocol_deps="struct_sctp_event_subscribe"
2376sctp_protocol_select="network"
65a80240 2377srtp_protocol_select="rtp_protocol srtp"
998c1ee1 2378tcp_protocol_select="network"
d8ffb205 2379tls_gnutls_protocol_deps="gnutls"
876d441f 2380tls_gnutls_protocol_select="tcp_protocol"
d8ffb205 2381tls_openssl_protocol_deps="openssl !tls_gnutls_protocol"
876d441f 2382tls_openssl_protocol_select="tcp_protocol"
b4a0f172 2383tls_protocol_deps_any="tls_gnutls_protocol tls_openssl_protocol"
998c1ee1 2384udp_protocol_select="network"
60538758
LB
2385unix_protocol_deps="sys_un_h"
2386unix_protocol_select="network"
c08fb000 2387
6ebf0bfc 2388# filters
13fabd7a 2389blackframe_filter_deps="gpl"
ce6b6ef6 2390boxblur_filter_deps="gpl"
1c0210c7 2391bs2b_filter_deps="libbs2b"
68b79bfc 2392cropdetect_filter_deps="gpl"
b157be1f 2393delogo_filter_deps="gpl"
a5b64584 2394drawtext_filter_deps="libfreetype"
61b323ce 2395frei0r_filter_deps="frei0r dlopen"
cfec77aa 2396frei0r_filter_extralibs='$ldl'
61b323ce 2397frei0r_src_filter_deps="frei0r dlopen"
cfec77aa 2398frei0r_src_filter_extralibs='$ldl'
a4dc7aa5 2399hqdn3d_filter_deps="gpl"
3fce1367 2400interlace_filter_deps="gpl"
cf69ad35 2401ocv_filter_deps="libopencv"
7caf48e0 2402resample_filter_deps="avresample"
2f296e39 2403scale_filter_deps="swscale"
98114d70 2404scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
6ebf0bfc 2405
ab81f24a 2406# examples
b339182e 2407avcodec_example_deps="avcodec avutil"
e7dfaf16 2408filter_audio_example_deps="avfilter avutil"
b339182e 2409metadata_example_deps="avformat avutil"
ab81f24a 2410output_example_deps="avcodec avformat avutil swscale"
990e4a66 2411qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
10421bcf 2412transcode_aac_example_deps="avcodec avformat avresample"
ab81f24a 2413
44951174 2414# libraries, in linking order
d89f2fa9 2415avcodec_deps="avutil"
44951174 2416avdevice_deps="avformat avcodec avutil"
d89f2fa9 2417avfilter_deps="avutil"
44951174 2418avformat_deps="avcodec avutil"
d89f2fa9
DB
2419avresample_deps="avutil"
2420swscale_deps="avutil"
f7679c54 2421
912f3148 2422# programs
54fd593a 2423avconv_deps="avcodec avfilter avformat avresample swscale"
bce70f81 2424avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
0a0e340f 2425 fps_filter null_filter resample_filter scale_filter
bce70f81 2426 setpts_filter trim_filter"
dd53af4b 2427avplay_deps="avcodec avfilter avformat avresample sdl"
d2617193 2428avplay_libs='$sdl_libs'
dd53af4b 2429avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter"
9e12f0bf 2430avprobe_deps="avcodec avformat"
a2830dca 2431
4da3f410 2432# documentation
92f0abb2 2433pod2man_deps="doc"
4da3f410
DB
2434texi2html_deps="doc"
2435
de6d9b64 2436# default parameters
8a608357 2437
19bd477d 2438logfile="config.log"
8a608357
MR
2439
2440# installation paths
c9d19248
MR
2441prefix_default="/usr/local"
2442bindir_default='${prefix}/bin'
6291d7e4 2443datadir_default='${prefix}/share/avconv'
f4ca970d 2444docdir_default='${prefix}/share/doc/libav'
c9d19248
MR
2445incdir_default='${prefix}/include'
2446libdir_default='${prefix}/lib'
2447mandir_default='${prefix}/share/man'
2448shlibdir_default="$libdir_default"
8a608357
MR
2449
2450# toolchain
121d78d0 2451ar_default="ar"
13c7df3d 2452cc_default="gcc"
9da6609f 2453host_cc_default="gcc"
4ebc6a74 2454cp_f="cp -f"
b58b00ae 2455ln_s="ln -s -f"
2a8a860a 2456nm_default="nm -g"
11e6d03a 2457objformat="elf"
3f8040db 2458pkg_config_default=pkg-config
be7109c1 2459ranlib="ranlib"
e52567c2 2460strip="strip"
11e6d03a 2461yasmexe="yasm"
8a608357
MR
2462
2463# machine
8d4c00ed 2464arch_default=$(uname -m)
38d0a8aa 2465cpu="generic"
d45ebd48 2466intrinsics="none"
8a608357 2467
8a608357 2468# OS
8d4c00ed
MR
2469target_os_default=$(tolower $(uname -s))
2470host_os=$target_os_default
8a608357 2471
8a608357 2472# configurable options
b4a0f172
DB
2473enable $EXAMPLE_LIST $LIBRARY_LIST $PROGRAM_LIST
2474
3e0b1c9a
DB
2475enable asm
2476enable debug
2477enable doc
1274ea8d 2478enable faan faandct faanidct
8400d6b8 2479enable optimizations
8cfbbd92 2480enable safe_bitstream_reader
530dc538 2481enable static
a9ddb5b1 2482enable swscale_alpha
eaa2d123 2483enable valgrind_backtrace
8a608357 2484
2e2ec667 2485# By default, enable only those hwaccels that have no external dependencies.
d8039ef8 2486enable d3d11va dxva2 vda vdpau
2e2ec667 2487
8a608357 2488# build settings
9987769a 2489SHFLAGS='-shared -Wl,-soname,$$(@F)'
f3ec2d46
SG
2490LIBPREF="lib"
2491LIBSUF=".a"
c5f14466
RP
2492FULLNAME='$(NAME)$(BUILDSUF)'
2493LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
f3ec2d46
SG
2494SLIBPREF="lib"
2495SLIBSUF=".so"
c5f14466 2496SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
b29bddab
DB
2497SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
2498SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
6cfac0e9 2499LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
2f138f0b
MR
2500SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
2501SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
ef0bc4c9 2502
68485d1f
MR
2503asflags_filter=echo
2504cflags_filter=echo
64933b6c
MR
2505ldflags_filter=echo
2506
23565c26 2507AS_C='-c'
bc877faf 2508AS_O='-o $@'
23565c26 2509CC_C='-c'
18031c49 2510CC_E='-E -o $@'
7e6c86e6 2511CC_O='-o $@'
9f57f134
LB
2512OBJCC_C='-c'
2513OBJCC_E='-E -o $@'
2514OBJCC_O='-o $@'
a758c5e2 2515LD_O='-o $@'
8db73c61
MR
2516LD_LIB='-l%'
2517LD_PATH='-L'
23565c26 2518HOSTCC_C='-c'
27565164 2519HOSTCC_E='-E -o $@'
a758c5e2 2520HOSTCC_O='-o $@'
095792f2 2521HOSTLD_O='-o $@'
7e6c86e6 2522
9da6609f 2523host_libs='-lm'
6c3fa06a
MR
2524host_cflags_filter=echo
2525host_ldflags_filter=echo
9da6609f 2526
9b861379 2527target_path='$(CURDIR)'
a7ada2ba 2528
a158446b
MR
2529# since the object filename is not given with the -MM flag, the compiler
2530# is only able to print the basename, and we must add the path ourselves
a758c5e2
MR
2531DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
2532DEPFLAGS='-MM'
315c741d 2533
c597172e 2534# find source path
24524f36 2535if test -f configure; then
f038cf3c 2536 source_path=.
c597172e 2537else
8477f2de 2538 source_path=$(cd $(dirname "$0"); pwd)
c597172e 2539 echo "$source_path" | grep -q '[[:blank:]]' &&
7483e694 2540 die "Out of tree builds are impossible with whitespace in source path."
337cee68
MC
2541 test -e "$source_path/config.h" &&
2542 die "Out of tree builds are impossible with config.h in source dir."
c597172e
MR
2543fi
2544
13cbe2c0 2545for v in "$@"; do
b04251c5
MR
2546 r=${v#*=}
2547 l=${v%"$r"}
2548 r=$(sh_quote "$r")
29ba0911 2549 LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
13cbe2c0 2550done
c597172e 2551
73ef8980
MR
2552find_things(){
2553 thing=$1
2554 pattern=$2
2555 file=$source_path/$3
932ccf39 2556 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
73ef8980
MR
2557}
2558
2559ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
2560DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
5666fd73 2561HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
73ef8980 2562PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
73ef8980
MR
2563MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
2564DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
38e54a75
SS
2565OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
2566INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
81124ba0 2567FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
c597172e 2568
2758cded
AK
2569find_things_extern(){
2570 thing=$1
2571 pattern=$2
2572 file=$source_path/$3
2573 sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
2574}
2575
33d18982 2576BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
2758cded
AK
2577PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
2578
54e75be4
DB
2579ALL_COMPONENTS="
2580 $BSF_LIST
2581 $DECODER_LIST
2582 $DEMUXER_LIST
2583 $ENCODER_LIST
2584 $FILTER_LIST
2585 $HWACCEL_LIST
2586 $INDEV_LIST
2587 $MUXER_LIST
2588 $OUTDEV_LIST
2589 $PARSER_LIST
2590 $PROTOCOL_LIST
2591"
2592
b4a0f172
DB
2593for n in $COMPONENT_LIST; do
2594 v=$(toupper ${n%s})_LIST
2595 eval enable \$$v
2596 eval ${n}_if_any="\$$v"
2597done
2598
206a070d 2599enable $ARCH_EXT_LIST
c597172e
MR
2600
2601die_unknown(){
2602 echo "Unknown option \"$1\"."
2603 echo "See $0 --help for available options."
2604 exit 1
2605}
2606
7432e872 2607print_3_columns() {
bf12a81c 2608 printf "%-25s %-25s %-25s\n" $(cat | tr ' ' '\n' | sort)
7432e872
DB
2609}
2610
794f8e97 2611show_list() {
bf0c4afa
RP
2612 suffix=_$1
2613 shift
7432e872 2614 echo $* | sed s/$suffix//g | print_3_columns
794f8e97
PI
2615 exit 0
2616}
2617
154caa67
MR
2618rand_list(){
2619 IFS=', '
2620 set -- $*
2621 unset IFS
2622 for thing; do
2623 comp=${thing%:*}
2624 prob=${thing#$comp}
2625 prob=${prob#:}
2626 is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
2627 echo "prob ${prob:-0.5}"
2628 printf '%s\n' $comp
2629 done
2630}
2631
2632do_random(){
2633 action=$1
2634 shift
2635 random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
2636 $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
2637}
2638
c597172e 2639for opt do
7483e694
DB
2640 optval="${opt#*=}"
2641 case "$opt" in
ea061af1
DB
2642 --extra-ldflags=*)
2643 add_ldflags $optval
7e9e7cc2 2644 ;;
bb0babd7
LB
2645 --extra-ldexeflags=*)
2646 add_ldexeflags $optval
2647 ;;
ea061af1
DB
2648 --extra-libs=*)
2649 add_extralibs $optval
7e9e7cc2 2650 ;;
ea061af1
DB
2651 --disable-devices)
2652 disable $INDEV_LIST $OUTDEV_LIST
7e9e7cc2 2653 ;;
ea061af1
DB
2654 --enable-debug=*)
2655 debuglevel="$optval"
7e9e7cc2
MR
2656 ;;
2657 --disable-programs)
2658 disable $PROGRAM_LIST
2659 ;;
2660 --disable-everything)
b4a0f172 2661 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
7e9e7cc2 2662 ;;
844c6852 2663 --disable-all)
b4a0f172 2664 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
844c6852
DB
2665 disable $LIBRARY_LIST $PROGRAM_LIST doc
2666 ;;
7e9e7cc2
MR
2667 --enable-random|--disable-random)
2668 action=${opt%%-random}
2669 do_random ${action#--} $COMPONENT_LIST
2670 ;;
2671 --enable-random=*|--disable-random=*)
2672 action=${opt%%-random=*}
2673 do_random ${action#--} $optval
2674 ;;
2675 --enable-*=*|--disable-*=*)
2676 eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
2677 is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
2678 eval list=\$$(toupper $thing)_LIST
2679 name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
2680 $action $(filter "$name" $list)
2681 ;;
894682a9
AK
2682 --enable-avserver|--disable-avserver*)
2683 warn "avserver has been removed, the ${opt} option is only"\
2684 "provided for compatibility and will be removed in the future"
2685 ;;
7e9e7cc2
MR
2686 --enable-?*|--disable-?*)
2687 eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
2688 if is_in $option $COMPONENT_LIST; then
b4a0f172 2689 test $action = disable && action=unset
7e9e7cc2
MR
2690 eval $action \$$(toupper ${option%s})_LIST
2691 elif is_in $option $CMDLINE_SELECT; then
2692 $action $option
2693 else
2694 die_unknown $opt
2695 fi
2696 ;;
2697 --list-*)
2698 NAME="${opt#--list-}"
2699 is_in $NAME $COMPONENT_LIST || die_unknown $opt
2700 NAME=${NAME%s}
2701 eval show_list $NAME \$$(toupper $NAME)_LIST
2702 ;;
2703 --help|-h) show_help
2704 ;;
2705 *)
2706 optname="${opt%%=*}"
2707 optname="${optname#--}"
2708 optname=$(echo "$optname" | sed 's/-/_/g')
2709 if is_in $optname $CMDLINE_SET; then
2710 eval $optname='$optval'
2711 elif is_in $optname $CMDLINE_APPEND; then
2712 append $optname "$optval"
2713 else
2714 die_unknown $opt
2715 fi
2716 ;;
7483e694 2717 esac
c597172e 2718done
604abd02 2719
76eb0950 2720for e in $env; do
604abd02
LB
2721 eval "export $e"
2722done
c597172e 2723
bcea99bb
MR
2724disabled logging && logfile=/dev/null
2725
d7a5a178
LB
2726# Disable all the library-specific components if the library itself
2727# is disabled, see AVCODEC_LIST and following _LIST variables.
2728
2729disable_components(){
b4a0f172 2730 disabled ${1} && disable $(
d7a5a178
LB
2731 eval components="\$$(toupper ${1})_COMPONENTS"
2732 map 'eval echo \${$(toupper ${v%s})_LIST}' $components
2733 )
2734}
2735
2736map 'disable_components $v' $LIBRARY_LIST
2737
29ba0911 2738echo "# $0 $LIBAV_CONFIGURATION" > $logfile
bcea99bb
MR
2739set >> $logfile
2740
aeeb782c 2741case "$toolchain" in
34c9eba9
DB
2742 *-asan)
2743 cc_default="${toolchain%-asan}"
19f251a2
LB
2744 add_cflags -fsanitize=address
2745 add_ldflags -fsanitize=address
0fbb62a8 2746 ;;
c11a8586
LB
2747 *-msan)
2748 cc_default="${toolchain%-msan}"
2749 add_cflags -fsanitize=memory -fsanitize-memory-track-origins
2750 add_ldflags -fsanitize=memory
2751 ;;
34c9eba9
DB
2752 *-tsan)
2753 cc_default="${toolchain%-tsan}"
19f251a2
LB
2754 add_cflags -fsanitize=thread -pie
2755 add_ldflags -fsanitize=thread -pie
34c9eba9
DB
2756 case "$toolchain" in
2757 gcc-tsan)
2758 add_cflags -fPIC
2759 add_ldflags -fPIC
2760 ;;
2761 esac
0fbb62a8 2762 ;;
34c9eba9
DB
2763 *-usan)
2764 cc_default="${toolchain%-usan}"
d6a27f88
LB
2765 add_cflags -fsanitize=undefined
2766 add_ldflags -fsanitize=undefined
34c9eba9
DB
2767 case "$toolchain" in
2768 clang-usan)
2769 add_cflags -O1
2770 ;;
2771 esac
d6a27f88 2772 ;;
34c9eba9 2773 valgrind-*)
b1ee8eec 2774 target_exec_default="valgrind"
34c9eba9
DB
2775 case "$toolchain" in
2776 valgrind-massif)
2777 target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz"
2778 ;;
2779 valgrind-memcheck)
2780 target_exec_args="--track-origins=yes --leak-check=full"
2781 ;;
2782 esac
b1ee8eec 2783 ;;
aeeb782c 2784 msvc)
16381923
MS
2785 # Check whether the current MSVC version needs the C99 converter.
2786 # From MSVC 2013 (compiler major version 18) onwards, it does actually
ea9f7173 2787 # support enough of C99 to build libav. Default to the new
16381923
MS
2788 # behaviour if the regexp was unable to match anything, since this
2789 # successfully parses the version number of existing supported
2790 # versions that require the converter (MSVC 2010 and 2012).
2791 cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
2792 if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
ea9f7173 2793 cc_default="cl"
16381923
MS
2794 else
2795 cc_default="c99wrap cl"
2796 fi
c9edbe4a 2797 ld_default="$source_path/compat/windows/mslink"
aeeb782c 2798 nm_default="dumpbin -symbols"
ac3a9b51 2799 ar_default="lib"
2192ff84
MS
2800 case "$arch" in
2801 arm*)
2802 as_default="armasm"
2803 ;;
2804 esac
53e8cd68 2805 target_os_default="win32"
ea9f7173
MS
2806 # Use a relative path for TMPDIR. This makes sure all the
2807 # ffconf temp files are written with a relative path, avoiding
2808 # issues with msys/win32 path conversion for MSVC parameters
2809 # such as -Fo<file> or -out:<file>.
2810 TMPDIR=.
aeeb782c 2811 ;;
322e4194 2812 icl)
ea9f7173
MS
2813 cc_default="icl"
2814 ld_default="xilink"
322e4194
AS
2815 nm_default="dumpbin -symbols"
2816 ar_default="xilib"
2817 target_os_default="win32"
ea9f7173 2818 TMPDIR=.
322e4194 2819 ;;
a862c7d3
RT
2820 gcov)
2821 add_cflags -fprofile-arcs -ftest-coverage
2822 add_ldflags -fprofile-arcs -ftest-coverage
2823 ;;
59b9d2f6
LB
2824 llvm-cov)
2825 add_cflags -fprofile-arcs -ftest-coverage
2826 add_ldflags --coverage
2827 ;;
e7891305 2828 hardened)
2d589273
DB
2829 add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
2830 add_cflags -fno-strict-overflow -fstack-protector-all
2831 add_ldflags -Wl,-z,relro -Wl,-z,now
e7891305 2832 ;;
aeeb782c
MR
2833 ?*)
2834 die "Unknown toolchain $toolchain"
2835 ;;
2836esac
2837
faab8f9f
JG
2838test -n "$cross_prefix" && enable cross_compile
2839
2840if enabled cross_compile; then
2841 test -n "$arch" && test -n "$target_os" ||
2842 die "Must specify target arch and OS when cross-compiling"
2843fi
2844
82b6e451
LB
2845ar_default="${cross_prefix}${ar_default}"
2846cc_default="${cross_prefix}${cc_default}"
9f57f134 2847occ_default="${cross_prefix}${occ_default}"
82b6e451
LB
2848nm_default="${cross_prefix}${nm_default}"
2849pkg_config_default="${cross_prefix}${pkg_config_default}"
2850ranlib="${cross_prefix}${ranlib}"
2851strip="${cross_prefix}${strip}"
2852
2853sysinclude_default="${sysroot}/usr/include"
2854
b1ee8eec 2855set_default arch cc pkg_config sysinclude target_exec target_os
9da6609f
MR
2856enabled cross_compile || host_cc_default=$cc
2857set_default host_cc
13c7df3d 2858
762f95e4
MR
2859if ! $pkg_config --version >/dev/null 2>&1; then
2860 warn "$pkg_config not found, library detection may fail."
2861 pkg_config=false
2862fi
2863
82bb3329
MR
2864exesuf() {
2865 case $1 in
a38a4f44 2866 mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
82bb3329
MR
2867 esac
2868}
2869
2870EXESUF=$(exesuf $target_os)
2871HOSTEXESUF=$(exesuf $host_os)
c0f5b7f1 2872
e4e69e0b 2873# set temporary file name
a49d42c2 2874: ${TMPDIR:=$TEMPDIR}
c51fafa1 2875: ${TMPDIR:=$TMP}
a49d42c2 2876: ${TMPDIR:=/tmp}
e4e69e0b 2877
a210bce2 2878if ! check_cmd mktemp -u XXXXXX; then
54460a83
MR
2879 # simple replacement for missing mktemp
2880 # NOT SAFE FOR GENERAL USE
2881 mktemp(){
09a5c245 2882 echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
54460a83
MR
2883 }
2884fi
2885
2886tmpfile(){
2887 tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
2888 (set -C; exec > $tmp) 2>/dev/null ||
f7ba16a7 2889 die "Unable to create temporary file in $TMPDIR."
54460a83
MR
2890 append TMPFILES $tmp
2891 eval $1=$tmp
2892}
2893
2894trap 'rm -f -- $TMPFILES' EXIT
54460a83 2895
55127e7b 2896tmpfile TMPASM .asm
3e0b1c9a
DB
2897tmpfile TMPC .c
2898tmpfile TMPE $EXESUF
2899tmpfile TMPH .h
2900tmpfile TMPO .o
2901tmpfile TMPS .S
2902tmpfile TMPSH .sh
2903tmpfile TMPV .ver
54460a83
MR
2904
2905unset -f mktemp
e4e69e0b 2906
fb3c4ffc
MR
2907chmod +x $TMPE
2908
993f2d0f
MR
2909# make sure we can execute files in $TMPDIR
2910cat > $TMPSH 2>> $logfile <<EOF
2911#! /bin/sh
2912EOF
2913chmod +x $TMPSH >> $logfile 2>&1
2914if ! $TMPSH >> $logfile 2>&1; then
2915 cat <<EOF
2916Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
2917variable to another directory and make sure that it is not mounted noexec.
2918EOF
2919 die "Sanity test failed."
2920fi
993f2d0f 2921
08b94f16
MS
2922armasm_flags(){
2923 for flag; do
2924 case $flag in
2925 # Filter out MSVC cl.exe options from cflags that shouldn't
2926 # be passed to gas-preprocessor
2927 -M[TD]*) ;;
2928 *) echo $flag ;;
2929 esac
2930 done
2931}
2932
457cc333
MR
2933ccc_flags(){
2934 for flag; do
2935 case $flag in
2936 -std=c99) echo -c99 ;;
2937 -mcpu=*) echo -arch ${flag#*=} ;;
2938 -mieee) echo -ieee ;;
2939 -O*|-fast) echo $flag ;;
2940 -fno-math-errno) echo -assume nomath_errno ;;
2941 -g) echo -g3 ;;
2942 -Wall) echo -msg_enable level2 ;;
2943 -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
2944 -Wl,*) echo $flag ;;
2945 -f*|-W*) ;;
2946 *) echo $flag ;;
2947 esac
2948 done
2949}
2950
e5d45e02
LB
2951cparser_flags(){
2952 for flag; do
2953 case $flag in
2954 -Wno-switch) echo -Wno-switch-enum ;;
2955 -Wno-format-zero-length) ;;
2956 -Wdisabled-optimization) ;;
2957 -Wno-pointer-sign) echo -Wno-other ;;
2958 *) echo $flag ;;
2959 esac
2960 done
2961}
2962
14fb9d3d 2963msvc_common_flags(){
dfa559bc
RB
2964 for flag; do
2965 case $flag in
14fb9d3d
AS
2966 # In addition to specifying certain flags under the compiler
2967 # specific filters, they must be specified here as well or else the
2968 # generic catch all at the bottom will print the original flag.
2969 -Wall) ;;
2970 -std=c99) ;;
2971 # Common flags
9f4a16c5 2972 -fomit-frame-pointer) ;;
dfa559bc 2973 -g) echo -Z7 ;;
dfa559bc
RB
2974 -fno-math-errno) ;;
2975 -fno-common) ;;
2976 -fno-signed-zeros) ;;
50640977 2977 -fPIC) ;;
9f30fb5a
MS
2978 -mthumb) ;;
2979 -march=*) ;;
dfa559bc 2980 -lz) echo zlib.lib ;;
bd680c7b
DB
2981 -lavifil32) echo vfw32.lib ;;
2982 -lavicap32) echo vfw32.lib user32.lib ;;
389b7984 2983 -lx264) echo libx264.lib ;;
dfa559bc 2984 -l*) echo ${flag#-l}.lib ;;
f4d4e66a 2985 -L*) echo -libpath:${flag#-L} ;;
dfa559bc
RB
2986 *) echo $flag ;;
2987 esac
2988 done
2989}
2990
14fb9d3d
AS
2991msvc_flags(){
2992 msvc_common_flags "$@"
2993 for flag; do
2994 case $flag in
ace87c19 2995 -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
14fb9d3d
AS
2996 -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
2997 -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
91894f27 2998 -wd4273 -wd4554 -wd4701 ;;
14fb9d3d
AS
2999 esac
3000 done
3001}
3002
3003icl_flags(){
3004 msvc_common_flags "$@"
3005 for flag; do
3006 case $flag in
3007 # Despite what Intel's documentation says -Wall, which is supported
3008 # on Windows, does enable remarks so disable them here.
3009 -Wall) echo $flag -Qdiag-disable:remark ;;
3010 -std=c99) echo -Qstd=c99 ;;
3011 esac
3012 done
3013}
3014
d0c6d424
MR
3015pgi_flags(){
3016 for flag; do
3017 case $flag in
643933f5 3018 -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
d0c6d424
MR
3019 -fomit-frame-pointer) echo -Mnoframe ;;
3020 -g) echo -gopt ;;
3021 *) echo $flag ;;
3022 esac
3023 done
3024}
3025
3026suncc_flags(){
3027 for flag; do
3028 case $flag in
3029 -march=*|-mcpu=*)
3030 case "${flag#*=}" in
3031 native) echo -xtarget=native ;;
3032 v9|niagara) echo -xarch=sparc ;;
3033 ultrasparc) echo -xarch=sparcvis ;;
3034 ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
3035 i586|pentium) echo -xchip=pentium ;;
3036 i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
3037 pentium3*|c3-2) echo -xtarget=pentium3 ;;
3038 pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
3039 pentium4*) echo -xtarget=pentium4 ;;
3040 prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
3041 *-sse3) echo -xarch=sse3 ;;
3042 core2) echo -xarch=ssse3 -xchip=core2 ;;
f2ce813e
SM
3043 corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
3044 corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
b36f87ff 3045 amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
ace87c19 3046 athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
d0c6d424 3047 k8|opteron|athlon64|athlon-fx)
ace87c19
DB
3048 echo -xarch=sse2a ;;
3049 athlon*) echo -xarch=pentium_proa ;;
d0c6d424
MR
3050 esac
3051 ;;
3052 -std=c99) echo -xc99 ;;
3053 -fomit-frame-pointer) echo -xregs=frameptr ;;
3054 -fPIC) echo -KPIC -xcode=pic32 ;;
3055 -W*,*) echo $flag ;;
5e753ed5
SM
3056 -f*-*|-W*|-mimpure-text) ;;
3057 -shared) echo -G ;;
d0c6d424
MR
3058 *) echo $flag ;;
3059 esac
3060 done
3061}
3062
3063tms470_flags(){
3064 for flag; do
3065 case $flag in
3066 -march=*|-mcpu=*)
3067 case "${flag#*=}" in
3068 armv7-a|cortex-a*) echo -mv=7a8 ;;
3069 armv7-r|cortex-r*) echo -mv=7r4 ;;
3070 armv7-m|cortex-m*) echo -mv=7m3 ;;
3071 armv6*|arm11*) echo -mv=6 ;;
3072 armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
3073 echo -mv=5e ;;
3074 armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
3075 esac
3076 ;;
3077 -mfpu=neon) echo --float_support=vfpv3 --neon ;;
3078 -mfpu=vfp) echo --float_support=vfpv2 ;;
3079 -mfpu=vfpv3) echo --float_support=vfpv3 ;;
b5198a26 3080 -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
d0c6d424
MR
3081 -msoft-float) echo --float_support=vfplib ;;
3082 -O[0-3]|-mf=*) echo $flag ;;
3083 -g) echo -g -mn ;;
3084 -pds=*) echo $flag ;;
ad93dccb
MR
3085 -D*|-I*) echo $flag ;;
3086 --gcc|--abi=*) echo $flag ;;
3087 -me) echo $flag ;;
d0c6d424
MR
3088 esac
3089 done
3090}
3091
a758c5e2
MR
3092probe_cc(){
3093 pfx=$1
3094 _cc=$2
3095
8db73c61
MR
3096 unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
3097 unset _ld_o _ldflags _ld_lib _ld_path
18031c49 3098 unset _depflags _DEPCMD _DEPFLAGS
a758c5e2
MR
3099 _flags_filter=echo
3100
3101 if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
3102 _type=llvm_gcc
b197f783
S
3103 gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
3104 _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
a758c5e2
MR
3105 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3106 _cflags_speed='-O3'
3107 _cflags_size='-Os'
3108 elif $_cc -v 2>&1 | grep -qi ^gcc; then
3109 _type=gcc
3110 gcc_version=$($_cc --version | head -n1)
3111 gcc_basever=$($_cc -dumpversion)
3112 gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
3113 gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
3114 _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
3115 if ! $_cc -dumpversion | grep -q '^2\.'; then
3116 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3117 fi
3118 _cflags_speed='-O3'
3119 _cflags_size='-Os'
b2d688ea 3120 elif $_cc --version 2>/dev/null | grep -q ^icc; then
a758c5e2
MR
3121 _type=icc
3122 _ident=$($_cc --version | head -n1)
3123 _depflags='-MMD'
3124 _cflags_speed='-O3'
3125 _cflags_size='-Os'
3126 _cflags_noopt='-O1'
3127 elif $_cc -v 2>&1 | grep -q xlc; then
3128 _type=xlc
3129 _ident=$($_cc -qversion 2>/dev/null | head -n1)
3130 _cflags_speed='-O5'
3131 _cflags_size='-O5 -qcompact'
3132 elif $_cc -V 2>/dev/null | grep -q Compaq; then
3133 _type=ccc
3134 _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
3135 _DEPFLAGS='-M'
a758c5e2
MR
3136 _cflags_speed='-fast'
3137 _cflags_size='-O1'
457cc333 3138 _flags_filter=ccc_flags
4936ef64 3139 elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
a758c5e2
MR
3140 test -d "$sysroot" || die "No valid sysroot specified."
3141 _type=armcc
ed6d9ce9 3142 _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
a758c5e2
MR
3143 armcc_conf="$PWD/armcc.conf"
3144 $_cc --arm_linux_configure \
3145 --arm_linux_config_file="$armcc_conf" \
3146 --configure_sysroot="$sysroot" \
3147 --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
3148 die "Error creating armcc configuration file."
3149 $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
3150 _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
3151 as_default="${cross_prefix}gcc"
3152 _depflags='-MMD'
3153 _cflags_speed='-O3'
3154 _cflags_size='-Os'
0122118e 3155 elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
a758c5e2
MR
3156 _type=tms470
3157 _ident=$($_cc -version | head -n1 | tr -s ' ')
3158 _flags='--gcc --abi=eabi -me'
18031c49 3159 _cc_e='-ppl -fe=$@'
a758c5e2 3160 _cc_o='-fe=$@'
a758c5e2
MR
3161 _depflags='-ppa -ppd=$(@:.o=.d)'
3162 _cflags_speed='-O3 -mf=5'
3163 _cflags_size='-O3 -mf=2'
3164 _flags_filter=tms470_flags
3165 elif $_cc -v 2>&1 | grep -q clang; then
3166 _type=clang
b197f783 3167 _ident=$($_cc --version 2>/dev/null | head -n1)
9e057f53 3168 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
a758c5e2
MR
3169 _cflags_speed='-O3'
3170 _cflags_size='-Os'
3171 elif $_cc -V 2>&1 | grep -q Sun; then
3172 _type=suncc
3173 _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
3174 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
c72f12cb 3175 _DEPFLAGS='-xM1 -xc99'
a758c5e2
MR
3176 _ldflags='-std=c99'
3177 _cflags_speed='-O5'
3178 _cflags_size='-O5 -xspace'
3179 _flags_filter=suncc_flags
3180 elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
3181 _type=pathscale
3182 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3183 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3184 _cflags_speed='-O2'
3185 _cflags_size='-Os'
3186 _flags_filter='filter_out -Wdisabled-optimization'
3187 elif $_cc -v 2>&1 | grep -q Open64; then
3188 _type=open64
3189 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3190 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3191 _cflags_speed='-O2'
3192 _cflags_size='-Os'
3193 _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
3194 elif $_cc -V 2>&1 | grep -q Portland; then
3195 _type=pgi
3196 _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
8f23907f 3197 opt_common='-alias=ansi -Mdse -Mlre -Mpre'
a758c5e2
MR
3198 _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
3199 _cflags_size="-O2 -Munroll=c:1 $opt_common"
3200 _cflags_noopt="-O1"
3201 _flags_filter=pgi_flags
f4312352
MS
3202 elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
3203 _type=armasm
3204 _ident=$($_cc | head -n1)
3205 # 4509: "This form of conditional instruction is deprecated"
3206 _flags="-nologo -ignore 4509"
08b94f16 3207 _flags_filter=armasm_flags
a54e720e 3208 elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
dfa559bc 3209 _type=msvc
863ee068 3210 _ident=$($_cc 2>&1 | head -n1)
dfa559bc
RB
3211 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
3212 _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
3213 _cflags_speed="-O2"
3214 _cflags_size="-O1"
a54e720e 3215 if $_cc -nologo- 2>&1 | grep -q Linker; then
ea9f7173 3216 _ld_o='-out:$@'
dfa559bc
RB
3217 else
3218 _ld_o='-Fe$@'
3219 fi
ea9f7173
MS
3220 _cc_o='-Fo$@'
3221 _cc_e='-P -Fi$@'
dfa559bc
RB
3222 _flags_filter=msvc_flags
3223 _ld_lib='lib%.a'
3224 _ld_path='-libpath:'
3225 _flags='-nologo'
567ca142 3226 _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS'
322e4194
AS
3227 elif $_cc 2>&1 | grep -q Intel; then
3228 _type=icl
863ee068 3229 _ident=$($_cc 2>&1 | head -n1)
322e4194 3230 _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
ace87c19
DB
3231 # Not only is O3 broken on 13.x+ but it is slower on all previous
3232 # versions (tested) as well.
322e4194
AS
3233 _cflags_speed="-O2"
3234 _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
322e4194 3235 if $_cc 2>&1 | grep -q Linker; then
ea9f7173 3236 _ld_o='-out:$@'
322e4194
AS
3237 else
3238 _ld_o='-Fe$@'
3239 fi
ea9f7173 3240 _cc_o='-Fo$@'
322e4194 3241 _cc_e='-P'
14fb9d3d 3242 _flags_filter=icl_flags
322e4194
AS
3243 _ld_lib='lib%.a'
3244 _ld_path='-libpath:'
ace87c19 3245 # -Qdiag-error to make icl error when seeing certain unknown arguments
60f09c04 3246 _flags='-nologo -Qdiag-error:4044,10157'
ace87c19
DB
3247 # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
3248 # with MSVC which enables it by default.
342b0ba5 3249 _cflags='-D_USE_MATH_DEFINES -Qms0 -Qvec- -Qsimd- -GS'
e5d45e02
LB
3250 elif $_cc --version 2>/dev/null | grep -q ^cparser; then
3251 _type=cparser
3252 _ident=$($_cc --version | head -n1)
3253 _depflags='-MMD'
3254 _cflags_speed='-O4'
3255 _cflags_size='-O2'
3256 _flags_filter=cparser_flags
aef6bd1b 3257 fi
a758c5e2
MR
3258
3259 eval ${pfx}_type=\$_type
3260 eval ${pfx}_ident=\$_ident
3261}
3262
3263set_ccvars(){
23565c26 3264 eval ${1}_C=\${_cc_c-\${${1}_C}}
18031c49 3265 eval ${1}_E=\${_cc_e-\${${1}_E}}
a758c5e2
MR
3266 eval ${1}_O=\${_cc_o-\${${1}_O}}
3267
3268 if [ -n "$_depflags" ]; then
3269 eval ${1}_DEPFLAGS=\$_depflags
3270 else
3271 eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
3272 eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
3273 eval DEP${1}FLAGS=\$_flags
3274 fi
3275}
3276
3277probe_cc cc "$cc"
3278cflags_filter=$_flags_filter
3279cflags_speed=$_cflags_speed
3280cflags_size=$_cflags_size
3281cflags_noopt=$_cflags_noopt
3282add_cflags $_flags $_cflags
3283cc_ldflags=$_ldflags
3284set_ccvars CC
3285