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