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