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