lavc: add libdcadec decoder
[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
6379900c 1490 strptime
7a650caf
DB
1491 sysconf
1492 sysctl
1493 usleep
1494 VirtualAlloc
1495"
1496
1497TOOLCHAIN_FEATURES="
896a5bff 1498 as_dn_directive
d5a55981 1499 as_func
dcae2e32 1500 as_object_arch
7a650caf
DB
1501 asm_mod_q
1502 attribute_may_alias
1503 attribute_packed
1504 ebp_available
1505 ebx_available
1506 gnu_as
1507 ibm_asm
1508 inline_asm_labels
1509 pragma_deprecated
1510 symver_asm_label
1511 symver_gnu_asm
1512 vfp_args
1513 xform_asm
1514 xmm_clobbers
1515"
1516
1517TYPES_LIST="
73ea3ffc 1518 CONDITION_VARIABLE_Ptr
7e850fa6 1519 DXVA_PicParams_HEVC
7a650caf 1520 socklen_t
c0018613 1521 struct_addrinfo
75d339e0
MS
1522 struct_group_source_req
1523 struct_ip_mreq_source
b4d68544 1524 struct_ipv6_mreq
cdee08e3 1525 struct_pollfd
3e0b1c9a 1526 struct_rusage_ru_maxrss
b4d68544 1527 struct_sockaddr_in6
3b2372bf 1528 struct_sockaddr_sa_len
33a4dbdd 1529 struct_sockaddr_storage
a6a4793d 1530 struct_v4l2_frmivalenum_discrete
7a650caf
DB
1531"
1532
1533HAVE_LIST="
1534 $ARCH_EXT_LIST
1535 $(add_suffix _external $ARCH_EXT_LIST)
1536 $(add_suffix _inline $ARCH_EXT_LIST)
1537 $ARCH_FEATURES
1538 $ATOMICS_LIST
1539 $BUILTIN_LIST
1540 $HAVE_LIST_CMDLINE
1541 $HAVE_LIST_PUB
1542 $HEADERS_LIST
d45ebd48 1543 $INTRINSICS_LIST
7a650caf
DB
1544 $MATH_FUNCS
1545 $SYSTEM_FUNCS
1546 $THREADS_LIST
1547 $TOOLCHAIN_FEATURES
1548 $TYPES_LIST
1549 atomics_native
1550 dos_paths
a61c2115 1551 dxva2_lib
7a650caf
DB
1552 libc_msvcrt
1553 libdc1394_1
1554 libdc1394_2
1555 sdl
f963f803 1556 section_data_rel_ro
b265431e 1557 threads
990e4a66 1558 vaapi_x11
7671dd7c 1559 vdpau_x11
7671dd7c 1560 xlib
0cb78cef 1561"
44161118 1562
511cf612 1563# options emitted with CONFIG_ prefix but not available on the command line
b6bb00b0 1564CONFIG_EXTRA="
87849592 1565 aandcttables
bfe9f48a 1566 ac3dsp
aa11cb79 1567 audio_frame_queue
9a9e2f1c 1568 audiodsp
e74433a8 1569 blockdsp
c67b449b 1570 bswapdsp
8ef33497 1571 cabac
f6ee61fb 1572 dvprofile
1274ea8d
DB
1573 faandct
1574 faanidct
a9aee08d 1575 fdctdsp
71f1ad37 1576 fmtconvert
bfe9f48a 1577 gcrypt
478fd534 1578 golomb
9cad0e4e 1579 gplv3
0338c396 1580 h263dsp
478fd534
DB
1581 h264chroma
1582 h264dsp
1583 h264pred
915a2a0a 1584 h264qpel
68d8238c 1585 hpeldsp
478fd534 1586 huffman
0d439fbe 1587 huffyuvdsp
512f3ffe 1588 huffyuvencdsp
e3fcb143 1589 idctdsp
bd499d9a 1590 iirfilter
3d5d4623 1591 imdct15
dc4d726b 1592 intrax8
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"
e3fcb143 1829g2m_decoder_select="blockdsp idctdsp"
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"
e3fcb143 1853ljpeg_encoder_select="aandcttables idctdsp"
4f034993 1854loco_decoder_select="golomb"
e3fcb143 1855mdec_decoder_select="blockdsp idctdsp mpegvideo"
3e589878 1856metasound_decoder_select="lsp mdct sinewin"
e3fcb143
DB
1857mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
1858mjpeg_decoder_select="blockdsp hpeldsp idctdsp"
6cd76e54 1859mjpeg_encoder_select="aandcttables 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
912f3148 2020# external libraries
72025ac3 2021libdcadec_decoder_deps="libdcadec"
c9171a83 2022libfaac_encoder_deps="libfaac"
aa11cb79 2023libfaac_encoder_select="audio_frame_queue"
4f2b469d 2024libfdk_aac_decoder_deps="libfdk_aac"
37eeb5e2 2025libfdk_aac_encoder_deps="libfdk_aac"
aa11cb79 2026libfdk_aac_encoder_select="audio_frame_queue"
299c77d5
MR
2027libgsm_decoder_deps="libgsm"
2028libgsm_encoder_deps="libgsm"
8ffed8d8
MR
2029libgsm_ms_decoder_deps="libgsm"
2030libgsm_ms_encoder_deps="libgsm"
3641b048
MS
2031libilbc_decoder_deps="libilbc"
2032libilbc_encoder_deps="libilbc"
1cc60c47 2033libmp3lame_encoder_deps="libmp3lame"
aa11cb79 2034libmp3lame_encoder_select="audio_frame_queue"
0b175caa
DB
2035libopencore_amrnb_decoder_deps="libopencore_amrnb"
2036libopencore_amrnb_encoder_deps="libopencore_amrnb"
aa11cb79 2037libopencore_amrnb_encoder_select="audio_frame_queue"
0b175caa 2038libopencore_amrwb_decoder_deps="libopencore_amrwb"
8a3d9ca6 2039libopenh264_encoder_deps="libopenh264"
9a77d59a 2040libopenjpeg_decoder_deps="libopenjpeg"
453c02f9 2041libopenjpeg_encoder_deps="libopenjpeg"
44617d6e 2042libopus_decoder_deps="libopus"
6cb8c854 2043libopus_encoder_deps="libopus"
aa11cb79 2044libopus_encoder_select="audio_frame_queue"
f7cd9eed
AS
2045libschroedinger_decoder_deps="libschroedinger"
2046libschroedinger_encoder_deps="libschroedinger"
ae14f311 2047libspeex_decoder_deps="libspeex"
b606a017 2048libspeex_encoder_deps="libspeex"
aa11cb79 2049libspeex_encoder_select="audio_frame_queue"
150d2772 2050libtheora_encoder_deps="libtheora"
718907cd 2051libtwolame_encoder_deps="libtwolame"
d89e738a 2052libvo_aacenc_encoder_deps="libvo_aacenc"
aa11cb79 2053libvo_aacenc_encoder_select="audio_frame_queue"
f502ff3f 2054libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
b0caf888 2055libvorbis_encoder_deps="libvorbis"
aa11cb79 2056libvorbis_encoder_select="audio_frame_queue"
3f111804
LB
2057libvpx_vp8_decoder_deps="libvpx"
2058libvpx_vp8_encoder_deps="libvpx"
2059libvpx_vp9_decoder_deps="libvpx"
2060libvpx_vp9_encoder_deps="libvpx"
84d3ff50 2061libwavpack_encoder_deps="libwavpack"
be7c3231 2062libwebp_encoder_deps="libwebp"
1cc60c47 2063libx264_encoder_deps="libx264"
50ea9315 2064libx265_encoder_deps="libx265"
de295976 2065libxavs_encoder_deps="libxavs"
1cc60c47 2066libxvid_encoder_deps="libxvid"
30fd06be 2067
912f3148 2068# demuxers / muxers
c2dd0e9e 2069ac3_demuxer_select="ac3_parser"
255d9c57 2070asf_demuxer_select="riffdec"
3dd5c95d 2071asf_muxer_select="riffenc"
647c2356 2072asf_stream_muxer_select="asf_muxer"
255d9c57 2073avi_demuxer_select="riffdec"
3dd5c95d 2074avi_muxer_select="riffenc"
4e622dea 2075avisynth_demuxer_deps="avisynth"
255d9c57
DB
2076avisynth_demuxer_select="riffdec"
2077caf_demuxer_select="riffdec"
fe5e6e34 2078dash_muxer_select="mp4_muxer"
c2dd0e9e 2079dirac_demuxer_select="dirac_parser"
f6ee61fb
AK
2080dv_demuxer_select="dvprofile"
2081dv_muxer_select="dvprofile"
255d9c57 2082dxa_demuxer_select="riffdec"
5b423887 2083eac3_demuxer_select="ac3_parser"
e01fba55 2084f4v_muxer_select="mov_muxer"
c2dd0e9e 2085flac_demuxer_select="flac_parser"
435214a7 2086hds_muxer_select="flv_muxer"
c9031c7c 2087hls_muxer_select="mpegts_muxer"
647c2356 2088ipod_muxer_select="mov_muxer"
31f16dc1 2089ismv_muxer_select="mov_muxer"
647c2356 2090matroska_audio_muxer_select="matroska_muxer"
255d9c57 2091matroska_demuxer_select="riffdec"
2a91ada8 2092matroska_demuxer_suggest="bzlib lzo zlib"
3dd5c95d
DB
2093matroska_muxer_select="riffenc"
2094mmf_muxer_select="riffenc"
255d9c57 2095mov_demuxer_select="riffdec"
4e622dea 2096mov_demuxer_suggest="zlib"
3dd5c95d 2097mov_muxer_select="riffenc rtpenc_chain"
c2dd0e9e 2098mp3_demuxer_select="mpegaudio_parser"
647c2356 2099mp4_muxer_select="mov_muxer"
75644335 2100mpegts_muxer_select="adts_muxer latm_muxer"
647c2356
DB
2101mpegtsraw_demuxer_select="mpegts_demuxer"
2102mxf_d10_muxer_select="mxf_muxer"
3dd5c95d 2103nut_muxer_select="riffenc"
255d9c57 2104nuv_demuxer_select="riffdec"
051aadee 2105oga_muxer_select="ogg_muxer"
24ca518b 2106ogg_demuxer_select="golomb"
051aadee 2107opus_muxer_select="ogg_muxer"
647c2356 2108psp_muxer_select="mov_muxer"
44594cc7 2109rtp_demuxer_select="sdp_demuxer"
44b70ce5
MS
2110rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
2111rtsp_demuxer_select="http_protocol rtpdec"
5ad2f0bf 2112rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
01c8d258 2113sap_demuxer_select="sdp_demuxer"
5ad2f0bf 2114sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
44b70ce5 2115sdp_demuxer_select="rtpdec"
e772f9fa 2116smoothstreaming_muxer_select="ismv_muxer"
f1e94694 2117spdif_muxer_select="aac_parser"
051aadee 2118spx_muxer_select="ogg_muxer"
57231e4d 2119tak_demuxer_select="tak_parser"
647c2356
DB
2120tg2_muxer_select="mov_muxer"
2121tgp_muxer_select="mov_muxer"
a7d45e06 2122w64_demuxer_select="wav_demuxer"
255d9c57 2123wav_demuxer_select="riffdec"
3dd5c95d
DB
2124wav_muxer_select="riffenc"
2125webm_muxer_select="riffenc"
255d9c57
DB
2126wtv_demuxer_select="riffdec"
2127xmv_demuxer_select="riffdec"
2128xwma_demuxer_select="riffdec"
4e622dea
SS
2129
2130# indevs / outdevs
38e54a75 2131alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
38e54a75 2132alsa_outdev_deps="alsa_asoundlib_h"
38e54a75 2133bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
6fb65973
DB
2134dv1394_indev_deps="dv1394"
2135dv1394_indev_select="dv_demuxer"
c6f95144 2136fbdev_indev_deps="linux_fb_h"
a3fc62e8 2137jack_indev_deps="jack_jack_h pthreads"
e417d80d 2138libcdio_indev_deps="libcdio"
38e54a75 2139libdc1394_indev_deps="libdc1394"
38e54a75
SS
2140oss_indev_deps_any="soundcard_h sys_soundcard_h"
2141oss_outdev_deps_any="soundcard_h sys_soundcard_h"
0de9c41f 2142pulse_indev_deps="libpulse"
15d59d2c
B
2143sndio_indev_deps="sndio_h"
2144sndio_outdev_deps="sndio_h"
38e54a75 2145v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
ec1ee802 2146vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
a1b3c5a3 2147vfwcap_indev_extralibs="-lavicap32"
a6674d2e
LB
2148x11grab_indev_deps="x11grab"
2149x11grab_xcb_indev_deps="libxcb"
30fd06be 2150
912f3148 2151# protocols
acd554c1
SP
2152ffrtmpcrypt_protocol_deps="!librtmp_protocol"
2153ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
2154ffrtmpcrypt_protocol_select="tcp_protocol"
775c4d36
SP
2155ffrtmphttp_protocol_deps="!librtmp_protocol"
2156ffrtmphttp_protocol_select="http_protocol"
998c1ee1 2157gopher_protocol_select="network"
279a0c97 2158http_protocol_select="tcp_protocol"
7caf48e0 2159httpproxy_protocol_select="tcp_protocol"
183baead 2160https_protocol_select="tls_protocol"
eb9244f2 2161icecast_protocol_select="http_protocol"
c3b57d6e
DB
2162librtmp_protocol_deps="librtmp"
2163librtmpe_protocol_deps="librtmp"
2164librtmps_protocol_deps="librtmp"
2165librtmpt_protocol_deps="librtmp"
2166librtmpte_protocol_deps="librtmp"
c60a2d70 2167mmsh_protocol_select="http_protocol"
998c1ee1 2168mmst_protocol_select="network"
c3b57d6e 2169rtmp_protocol_deps="!librtmp_protocol"
deeb7012 2170rtmp_protocol_select="tcp_protocol"
acd554c1 2171rtmpe_protocol_select="ffrtmpcrypt_protocol"
6aedabc9
SP
2172rtmps_protocol_deps="!librtmp_protocol"
2173rtmps_protocol_select="tls_protocol"
775c4d36 2174rtmpt_protocol_select="ffrtmphttp_protocol"
08cd95e8 2175rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
6c1ed454 2176rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
deeb7012 2177rtp_protocol_select="udp_protocol"
998c1ee1
DB
2178sctp_protocol_deps="struct_sctp_event_subscribe"
2179sctp_protocol_select="network"
0eecafc9 2180srtp_protocol_select="rtp_protocol"
998c1ee1 2181tcp_protocol_select="network"
558d192d
MS
2182tls_protocol_deps_any="openssl gnutls"
2183tls_protocol_select="tcp_protocol"
998c1ee1 2184udp_protocol_select="network"
60538758
LB
2185unix_protocol_deps="sys_un_h"
2186unix_protocol_select="network"
c08fb000 2187
6ebf0bfc 2188# filters
13fabd7a 2189blackframe_filter_deps="gpl"
ce6b6ef6 2190boxblur_filter_deps="gpl"
1c0210c7 2191bs2b_filter_deps="libbs2b"
68b79bfc 2192cropdetect_filter_deps="gpl"
b157be1f 2193delogo_filter_deps="gpl"
a5b64584 2194drawtext_filter_deps="libfreetype"
61b323ce 2195frei0r_filter_deps="frei0r dlopen"
cfec77aa 2196frei0r_filter_extralibs='$ldl'
61b323ce 2197frei0r_src_filter_deps="frei0r dlopen"
cfec77aa 2198frei0r_src_filter_extralibs='$ldl'
a4dc7aa5 2199hqdn3d_filter_deps="gpl"
3fce1367 2200interlace_filter_deps="gpl"
cf69ad35 2201ocv_filter_deps="libopencv"
7caf48e0 2202resample_filter_deps="avresample"
2f296e39 2203scale_filter_deps="swscale"
6ebf0bfc 2204
ab81f24a 2205# examples
b339182e 2206avcodec_example_deps="avcodec avutil"
e7dfaf16 2207filter_audio_example_deps="avfilter avutil"
b339182e 2208metadata_example_deps="avformat avutil"
ab81f24a 2209output_example_deps="avcodec avformat avutil swscale"
990e4a66 2210qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
10421bcf 2211transcode_aac_example_deps="avcodec avformat avresample"
ab81f24a 2212
44951174 2213# libraries, in linking order
d89f2fa9 2214avcodec_deps="avutil"
44951174 2215avdevice_deps="avformat avcodec avutil"
d89f2fa9 2216avfilter_deps="avutil"
44951174 2217avformat_deps="avcodec avutil"
d89f2fa9
DB
2218avresample_deps="avutil"
2219swscale_deps="avutil"
f7679c54 2220
912f3148 2221# programs
54fd593a 2222avconv_deps="avcodec avfilter avformat avresample swscale"
bce70f81 2223avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
0a0e340f 2224 fps_filter null_filter resample_filter scale_filter
bce70f81 2225 setpts_filter trim_filter"
d173ede1 2226avplay_deps="avcodec avformat avresample swscale sdl"
d2617193 2227avplay_libs='$sdl_libs'
266463da 2228avplay_select="rdft"
9e12f0bf 2229avprobe_deps="avcodec avformat"
a2830dca 2230
4da3f410 2231# documentation
92f0abb2 2232pod2man_deps="doc"
4da3f410
DB
2233texi2html_deps="doc"
2234
de6d9b64 2235# default parameters
8a608357 2236
19bd477d 2237logfile="config.log"
8a608357
MR
2238
2239# installation paths
c9d19248
MR
2240prefix_default="/usr/local"
2241bindir_default='${prefix}/bin'
6291d7e4 2242datadir_default='${prefix}/share/avconv'
f4ca970d 2243docdir_default='${prefix}/share/doc/libav'
c9d19248
MR
2244incdir_default='${prefix}/include'
2245libdir_default='${prefix}/lib'
2246mandir_default='${prefix}/share/man'
2247shlibdir_default="$libdir_default"
8a608357
MR
2248
2249# toolchain
121d78d0 2250ar_default="ar"
13c7df3d 2251cc_default="gcc"
9da6609f 2252host_cc_default="gcc"
4ebc6a74 2253cp_f="cp -f"
b58b00ae 2254ln_s="ln -s -f"
2a8a860a 2255nm_default="nm -g"
11e6d03a 2256objformat="elf"
3f8040db 2257pkg_config_default=pkg-config
be7109c1 2258ranlib="ranlib"
e52567c2 2259strip="strip"
11e6d03a 2260yasmexe="yasm"
8a608357
MR
2261
2262# machine
8d4c00ed 2263arch_default=$(uname -m)
38d0a8aa 2264cpu="generic"
d45ebd48 2265intrinsics="none"
8a608357 2266
8a608357 2267# OS
8d4c00ed
MR
2268target_os_default=$(tolower $(uname -s))
2269host_os=$target_os_default
8a608357 2270
8a608357 2271# configurable options
ab81f24a 2272enable $EXAMPLE_LIST $LIBRARY_LIST $PROGRAM_LIST
3e0b1c9a 2273
3e0b1c9a
DB
2274enable asm
2275enable debug
2276enable doc
1274ea8d 2277enable faan faandct faanidct
8400d6b8 2278enable optimizations
8cfbbd92 2279enable safe_bitstream_reader
530dc538 2280enable static
a9ddb5b1 2281enable swscale_alpha
8a608357 2282
2e2ec667 2283# By default, enable only those hwaccels that have no external dependencies.
7834a54c 2284enable dxva2 vda vdpau
2e2ec667 2285
8a608357 2286# build settings
9987769a 2287SHFLAGS='-shared -Wl,-soname,$$(@F)'
f3ec2d46
SG
2288LIBPREF="lib"
2289LIBSUF=".a"
c5f14466
RP
2290FULLNAME='$(NAME)$(BUILDSUF)'
2291LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
f3ec2d46
SG
2292SLIBPREF="lib"
2293SLIBSUF=".so"
c5f14466 2294SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
b29bddab
DB
2295SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
2296SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
6cfac0e9 2297LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
2f138f0b
MR
2298SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
2299SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
ef0bc4c9 2300
68485d1f
MR
2301asflags_filter=echo
2302cflags_filter=echo
64933b6c
MR
2303ldflags_filter=echo
2304
23565c26 2305AS_C='-c'
bc877faf 2306AS_O='-o $@'
23565c26 2307CC_C='-c'
18031c49 2308CC_E='-E -o $@'
7e6c86e6 2309CC_O='-o $@'
a758c5e2 2310LD_O='-o $@'
8db73c61
MR
2311LD_LIB='-l%'
2312LD_PATH='-L'
23565c26 2313HOSTCC_C='-c'
27565164 2314HOSTCC_E='-E -o $@'
a758c5e2 2315HOSTCC_O='-o $@'
095792f2 2316HOSTLD_O='-o $@'
7e6c86e6 2317
9da6609f 2318host_libs='-lm'
6c3fa06a
MR
2319host_cflags_filter=echo
2320host_ldflags_filter=echo
9da6609f 2321
9b861379 2322target_path='$(CURDIR)'
a7ada2ba 2323
a158446b
MR
2324# since the object filename is not given with the -MM flag, the compiler
2325# is only able to print the basename, and we must add the path ourselves
a758c5e2
MR
2326DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
2327DEPFLAGS='-MM'
315c741d 2328
c597172e 2329# find source path
24524f36 2330if test -f configure; then
f038cf3c 2331 source_path=.
c597172e 2332else
8477f2de 2333 source_path=$(cd $(dirname "$0"); pwd)
c597172e 2334 echo "$source_path" | grep -q '[[:blank:]]' &&
7483e694 2335 die "Out of tree builds are impossible with whitespace in source path."
337cee68
MC
2336 test -e "$source_path/config.h" &&
2337 die "Out of tree builds are impossible with config.h in source dir."
c597172e
MR
2338fi
2339
13cbe2c0 2340for v in "$@"; do
b04251c5
MR
2341 r=${v#*=}
2342 l=${v%"$r"}
2343 r=$(sh_quote "$r")
29ba0911 2344 LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
13cbe2c0 2345done
c597172e 2346
73ef8980
MR
2347find_things(){
2348 thing=$1
2349 pattern=$2
2350 file=$source_path/$3
932ccf39 2351 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
73ef8980
MR
2352}
2353
2354ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
2355DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
5666fd73 2356HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
73ef8980
MR
2357PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
2358BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
2359MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
2360DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
38e54a75
SS
2361OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
2362INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
73ef8980 2363PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
81124ba0 2364FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
c597172e 2365
54e75be4
DB
2366ALL_COMPONENTS="
2367 $BSF_LIST
2368 $DECODER_LIST
2369 $DEMUXER_LIST
2370 $ENCODER_LIST
2371 $FILTER_LIST
2372 $HWACCEL_LIST
2373 $INDEV_LIST
2374 $MUXER_LIST
2375 $OUTDEV_LIST
2376 $PARSER_LIST
2377 $PROTOCOL_LIST
2378"
2379
8469ae22
MR
2380for n in $COMPONENT_LIST; do
2381 v=$(toupper ${n%s})_LIST
2382 eval enable \$$v
2383 eval ${n}_if_any="\$$v"
2384done
2385
206a070d 2386enable $ARCH_EXT_LIST
c597172e
MR
2387
2388die_unknown(){
2389 echo "Unknown option \"$1\"."
2390 echo "See $0 --help for available options."
2391 exit 1
2392}
2393
7432e872
DB
2394print_3_columns() {
2395 cat | tr ' ' '\n' | sort | pr -r -3 -t
2396}
2397
794f8e97 2398show_list() {
bf0c4afa
RP
2399 suffix=_$1
2400 shift
7432e872 2401 echo $* | sed s/$suffix//g | print_3_columns
794f8e97
PI
2402 exit 0
2403}
2404
154caa67
MR
2405rand_list(){
2406 IFS=', '
2407 set -- $*
2408 unset IFS
2409 for thing; do
2410 comp=${thing%:*}
2411 prob=${thing#$comp}
2412 prob=${prob#:}
2413 is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
2414 echo "prob ${prob:-0.5}"
2415 printf '%s\n' $comp
2416 done
2417}
2418
2419do_random(){
2420 action=$1
2421 shift
2422 random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
2423 $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
2424}
2425
c597172e 2426for opt do
7483e694
DB
2427 optval="${opt#*=}"
2428 case "$opt" in
ea061af1
DB
2429 --extra-ldflags=*)
2430 add_ldflags $optval
7e9e7cc2 2431 ;;
bb0babd7
LB
2432 --extra-ldexeflags=*)
2433 add_ldexeflags $optval
2434 ;;
ea061af1
DB
2435 --extra-libs=*)
2436 add_extralibs $optval
7e9e7cc2 2437 ;;
ea061af1
DB
2438 --disable-devices)
2439 disable $INDEV_LIST $OUTDEV_LIST
7e9e7cc2 2440 ;;
ea061af1
DB
2441 --enable-debug=*)
2442 debuglevel="$optval"
7e9e7cc2
MR
2443 ;;
2444 --disable-programs)
2445 disable $PROGRAM_LIST
2446 ;;
2447 --disable-everything)
2448 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
2449 ;;
844c6852
DB
2450 --disable-all)
2451 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
2452 disable $LIBRARY_LIST $PROGRAM_LIST doc
2453 ;;
7e9e7cc2
MR
2454 --enable-random|--disable-random)
2455 action=${opt%%-random}
2456 do_random ${action#--} $COMPONENT_LIST
2457 ;;
2458 --enable-random=*|--disable-random=*)
2459 action=${opt%%-random=*}
2460 do_random ${action#--} $optval
2461 ;;
2462 --enable-*=*|--disable-*=*)
2463 eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
2464 is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
2465 eval list=\$$(toupper $thing)_LIST
2466 name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
2467 $action $(filter "$name" $list)
2468 ;;
894682a9
AK
2469 --enable-avserver|--disable-avserver*)
2470 warn "avserver has been removed, the ${opt} option is only"\
2471 "provided for compatibility and will be removed in the future"
2472 ;;
7e9e7cc2
MR
2473 --enable-?*|--disable-?*)
2474 eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
2475 if is_in $option $COMPONENT_LIST; then
2476 test $action = disable && action=unset
2477 eval $action \$$(toupper ${option%s})_LIST
2478 elif is_in $option $CMDLINE_SELECT; then
2479 $action $option
2480 else
2481 die_unknown $opt
2482 fi
2483 ;;
2484 --list-*)
2485 NAME="${opt#--list-}"
2486 is_in $NAME $COMPONENT_LIST || die_unknown $opt
2487 NAME=${NAME%s}
2488 eval show_list $NAME \$$(toupper $NAME)_LIST
2489 ;;
2490 --help|-h) show_help
2491 ;;
2492 *)
2493 optname="${opt%%=*}"
2494 optname="${optname#--}"
2495 optname=$(echo "$optname" | sed 's/-/_/g')
2496 if is_in $optname $CMDLINE_SET; then
2497 eval $optname='$optval'
2498 elif is_in $optname $CMDLINE_APPEND; then
2499 append $optname "$optval"
2500 else
2501 die_unknown $opt
2502 fi
2503 ;;
7483e694 2504 esac
c597172e
MR
2505done
2506
bcea99bb
MR
2507disabled logging && logfile=/dev/null
2508
29ba0911 2509echo "# $0 $LIBAV_CONFIGURATION" > $logfile
bcea99bb
MR
2510set >> $logfile
2511
aeeb782c 2512case "$toolchain" in
0fbb62a8
LB
2513 clang-asan)
2514 cc_default="clang"
19f251a2
LB
2515 add_cflags -fsanitize=address
2516 add_ldflags -fsanitize=address
0fbb62a8
LB
2517 ;;
2518 clang-tsan)
2519 cc_default="clang"
19f251a2
LB
2520 add_cflags -fsanitize=thread -pie
2521 add_ldflags -fsanitize=thread -pie
0fbb62a8 2522 ;;
d6a27f88
LB
2523 clang-usan)
2524 cc_default="clang"
4d25c2bc 2525 add_cflags -fsanitize=undefined -O1
d6a27f88
LB
2526 add_ldflags -fsanitize=undefined
2527 ;;
0ba49d28
LB
2528 gcc-asan)
2529 cc_default="gcc"
2530 add_cflags -fsanitize=address
2531 add_ldflags -fsanitize=address
2532 ;;
2533 gcc-tsan)
2534 cc_default="gcc"
2535 add_cflags -fsanitize=thread -pie -fPIC
2536 add_ldflags -fsanitize=thread -pie -fPIC
2537 ;;
d6a27f88
LB
2538 gcc-usan)
2539 cc_default="gcc"
2540 add_cflags -fsanitize=undefined
2541 add_ldflags -fsanitize=undefined
2542 ;;
edfe609f
LB
2543 valgrind-massif)
2544 target_exec_default="valgrind"
2545 target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz"
2546 ;;
b1ee8eec
RT
2547 valgrind-memcheck)
2548 target_exec_default="valgrind"
2549 target_exec_args="--track-origins=yes --leak-check=full"
2550 ;;
aeeb782c 2551 msvc)
16381923
MS
2552 # Check whether the current MSVC version needs the C99 converter.
2553 # From MSVC 2013 (compiler major version 18) onwards, it does actually
ea9f7173 2554 # support enough of C99 to build libav. Default to the new
16381923
MS
2555 # behaviour if the regexp was unable to match anything, since this
2556 # successfully parses the version number of existing supported
2557 # versions that require the converter (MSVC 2010 and 2012).
2558 cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
2559 if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
ea9f7173 2560 cc_default="cl"
16381923
MS
2561 else
2562 cc_default="c99wrap cl"
2563 fi
ea9f7173 2564 ld_default="link"
aeeb782c 2565 nm_default="dumpbin -symbols"
ac3a9b51 2566 ar_default="lib"
53e8cd68 2567 target_os_default="win32"
ea9f7173
MS
2568 # Use a relative path for TMPDIR. This makes sure all the
2569 # ffconf temp files are written with a relative path, avoiding
2570 # issues with msys/win32 path conversion for MSVC parameters
2571 # such as -Fo<file> or -out:<file>.
2572 TMPDIR=.
aeeb782c 2573 ;;
322e4194 2574 icl)
ea9f7173
MS
2575 cc_default="icl"
2576 ld_default="xilink"
322e4194
AS
2577 nm_default="dumpbin -symbols"
2578 ar_default="xilib"
2579 target_os_default="win32"
ea9f7173 2580 TMPDIR=.
322e4194 2581 ;;
a862c7d3
RT
2582 gcov)
2583 add_cflags -fprofile-arcs -ftest-coverage
2584 add_ldflags -fprofile-arcs -ftest-coverage
2585 ;;
e7891305 2586 hardened)
2d589273
DB
2587 add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
2588 add_cflags -fno-strict-overflow -fstack-protector-all
2589 add_ldflags -Wl,-z,relro -Wl,-z,now
e7891305 2590 ;;
aeeb782c
MR
2591 ?*)
2592 die "Unknown toolchain $toolchain"
2593 ;;
2594esac
2595
faab8f9f
JG
2596test -n "$cross_prefix" && enable cross_compile
2597
2598if enabled cross_compile; then
2599 test -n "$arch" && test -n "$target_os" ||
2600 die "Must specify target arch and OS when cross-compiling"
2601fi
2602
82b6e451
LB
2603ar_default="${cross_prefix}${ar_default}"
2604cc_default="${cross_prefix}${cc_default}"
2605nm_default="${cross_prefix}${nm_default}"
2606pkg_config_default="${cross_prefix}${pkg_config_default}"
2607ranlib="${cross_prefix}${ranlib}"
2608strip="${cross_prefix}${strip}"
2609
2610sysinclude_default="${sysroot}/usr/include"
2611
b1ee8eec 2612set_default arch cc pkg_config sysinclude target_exec target_os
9da6609f
MR
2613enabled cross_compile || host_cc_default=$cc
2614set_default host_cc
13c7df3d 2615
762f95e4
MR
2616if ! $pkg_config --version >/dev/null 2>&1; then
2617 warn "$pkg_config not found, library detection may fail."
2618 pkg_config=false
2619fi
2620
82bb3329
MR
2621exesuf() {
2622 case $1 in
53e8cd68 2623 mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
82bb3329
MR
2624 esac
2625}
2626
2627EXESUF=$(exesuf $target_os)
2628HOSTEXESUF=$(exesuf $host_os)
c0f5b7f1 2629
e4e69e0b 2630# set temporary file name
a49d42c2 2631: ${TMPDIR:=$TEMPDIR}
c51fafa1 2632: ${TMPDIR:=$TMP}
a49d42c2 2633: ${TMPDIR:=/tmp}
e4e69e0b 2634
a210bce2 2635if ! check_cmd mktemp -u XXXXXX; then
54460a83
MR
2636 # simple replacement for missing mktemp
2637 # NOT SAFE FOR GENERAL USE
2638 mktemp(){
09a5c245 2639 echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
54460a83
MR
2640 }
2641fi
2642
2643tmpfile(){
2644 tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
2645 (set -C; exec > $tmp) 2>/dev/null ||
f7ba16a7 2646 die "Unable to create temporary file in $TMPDIR."
54460a83
MR
2647 append TMPFILES $tmp
2648 eval $1=$tmp
2649}
2650
2651trap 'rm -f -- $TMPFILES' EXIT
54460a83 2652
55127e7b 2653tmpfile TMPASM .asm
3e0b1c9a
DB
2654tmpfile TMPC .c
2655tmpfile TMPE $EXESUF
2656tmpfile TMPH .h
2657tmpfile TMPO .o
2658tmpfile TMPS .S
2659tmpfile TMPSH .sh
2660tmpfile TMPV .ver
54460a83
MR
2661
2662unset -f mktemp
e4e69e0b 2663
fb3c4ffc
MR
2664chmod +x $TMPE
2665
993f2d0f
MR
2666# make sure we can execute files in $TMPDIR
2667cat > $TMPSH 2>> $logfile <<EOF
2668#! /bin/sh
2669EOF
2670chmod +x $TMPSH >> $logfile 2>&1
2671if ! $TMPSH >> $logfile 2>&1; then
2672 cat <<EOF
2673Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
2674variable to another directory and make sure that it is not mounted noexec.
2675EOF
2676 die "Sanity test failed."
2677fi
993f2d0f 2678
08b94f16
MS
2679armasm_flags(){
2680 for flag; do
2681 case $flag in
2682 # Filter out MSVC cl.exe options from cflags that shouldn't
2683 # be passed to gas-preprocessor
2684 -M[TD]*) ;;
2685 *) echo $flag ;;
2686 esac
2687 done
2688}
2689
457cc333
MR
2690ccc_flags(){
2691 for flag; do
2692 case $flag in
2693 -std=c99) echo -c99 ;;
2694 -mcpu=*) echo -arch ${flag#*=} ;;
2695 -mieee) echo -ieee ;;
2696 -O*|-fast) echo $flag ;;
2697 -fno-math-errno) echo -assume nomath_errno ;;
2698 -g) echo -g3 ;;
2699 -Wall) echo -msg_enable level2 ;;
2700 -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
2701 -Wl,*) echo $flag ;;
2702 -f*|-W*) ;;
2703 *) echo $flag ;;
2704 esac
2705 done
2706}
2707
e5d45e02
LB
2708cparser_flags(){
2709 for flag; do
2710 case $flag in
2711 -Wno-switch) echo -Wno-switch-enum ;;
2712 -Wno-format-zero-length) ;;
2713 -Wdisabled-optimization) ;;
2714 -Wno-pointer-sign) echo -Wno-other ;;
2715 *) echo $flag ;;
2716 esac
2717 done
2718}
2719
14fb9d3d 2720msvc_common_flags(){
dfa559bc
RB
2721 for flag; do
2722 case $flag in
14fb9d3d
AS
2723 # In addition to specifying certain flags under the compiler
2724 # specific filters, they must be specified here as well or else the
2725 # generic catch all at the bottom will print the original flag.
2726 -Wall) ;;
2727 -std=c99) ;;
2728 # Common flags
9f4a16c5 2729 -fomit-frame-pointer) ;;
dfa559bc 2730 -g) echo -Z7 ;;
dfa559bc
RB
2731 -fno-math-errno) ;;
2732 -fno-common) ;;
2733 -fno-signed-zeros) ;;
50640977 2734 -fPIC) ;;
9f30fb5a
MS
2735 -mthumb) ;;
2736 -march=*) ;;
dfa559bc 2737 -lz) echo zlib.lib ;;
bd680c7b
DB
2738 -lavifil32) echo vfw32.lib ;;
2739 -lavicap32) echo vfw32.lib user32.lib ;;
dfa559bc 2740 -l*) echo ${flag#-l}.lib ;;
f4d4e66a 2741 -L*) echo -libpath:${flag#-L} ;;
dfa559bc
RB
2742 *) echo $flag ;;
2743 esac
2744 done
2745}
2746
14fb9d3d
AS
2747msvc_flags(){
2748 msvc_common_flags "$@"
2749 for flag; do
2750 case $flag in
ace87c19 2751 -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
14fb9d3d
AS
2752 -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
2753 -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
91894f27 2754 -wd4273 -wd4554 -wd4701 ;;
14fb9d3d
AS
2755 esac
2756 done
2757}
2758
2759icl_flags(){
2760 msvc_common_flags "$@"
2761 for flag; do
2762 case $flag in
2763 # Despite what Intel's documentation says -Wall, which is supported
2764 # on Windows, does enable remarks so disable them here.
2765 -Wall) echo $flag -Qdiag-disable:remark ;;
2766 -std=c99) echo -Qstd=c99 ;;
2767 esac
2768 done
2769}
2770
d0c6d424
MR
2771pgi_flags(){
2772 for flag; do
2773 case $flag in
643933f5 2774 -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
d0c6d424
MR
2775 -fomit-frame-pointer) echo -Mnoframe ;;
2776 -g) echo -gopt ;;
2777 *) echo $flag ;;
2778 esac
2779 done
2780}
2781
2782suncc_flags(){
2783 for flag; do
2784 case $flag in
2785 -march=*|-mcpu=*)
2786 case "${flag#*=}" in
2787 native) echo -xtarget=native ;;
2788 v9|niagara) echo -xarch=sparc ;;
2789 ultrasparc) echo -xarch=sparcvis ;;
2790 ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
2791 i586|pentium) echo -xchip=pentium ;;
2792 i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
2793 pentium3*|c3-2) echo -xtarget=pentium3 ;;
2794 pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
2795 pentium4*) echo -xtarget=pentium4 ;;
2796 prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
2797 *-sse3) echo -xarch=sse3 ;;
2798 core2) echo -xarch=ssse3 -xchip=core2 ;;
f2ce813e
SM
2799 corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
2800 corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
b36f87ff 2801 amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
ace87c19 2802 athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
d0c6d424 2803 k8|opteron|athlon64|athlon-fx)
ace87c19
DB
2804 echo -xarch=sse2a ;;
2805 athlon*) echo -xarch=pentium_proa ;;
d0c6d424
MR
2806 esac
2807 ;;
2808 -std=c99) echo -xc99 ;;
2809 -fomit-frame-pointer) echo -xregs=frameptr ;;
2810 -fPIC) echo -KPIC -xcode=pic32 ;;
2811 -W*,*) echo $flag ;;
5e753ed5
SM
2812 -f*-*|-W*|-mimpure-text) ;;
2813 -shared) echo -G ;;
d0c6d424
MR
2814 *) echo $flag ;;
2815 esac
2816 done
2817}
2818
2819tms470_flags(){
2820 for flag; do
2821 case $flag in
2822 -march=*|-mcpu=*)
2823 case "${flag#*=}" in
2824 armv7-a|cortex-a*) echo -mv=7a8 ;;
2825 armv7-r|cortex-r*) echo -mv=7r4 ;;
2826 armv7-m|cortex-m*) echo -mv=7m3 ;;
2827 armv6*|arm11*) echo -mv=6 ;;
2828 armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
2829 echo -mv=5e ;;
2830 armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
2831 esac
2832 ;;
2833 -mfpu=neon) echo --float_support=vfpv3 --neon ;;
2834 -mfpu=vfp) echo --float_support=vfpv2 ;;
2835 -mfpu=vfpv3) echo --float_support=vfpv3 ;;
b5198a26 2836 -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
d0c6d424
MR
2837 -msoft-float) echo --float_support=vfplib ;;
2838 -O[0-3]|-mf=*) echo $flag ;;
2839 -g) echo -g -mn ;;
2840 -pds=*) echo $flag ;;
ad93dccb
MR
2841 -D*|-I*) echo $flag ;;
2842 --gcc|--abi=*) echo $flag ;;
2843 -me) echo $flag ;;
d0c6d424
MR
2844 esac
2845 done
2846}
2847
a758c5e2
MR
2848probe_cc(){
2849 pfx=$1
2850 _cc=$2
2851
8db73c61
MR
2852 unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
2853 unset _ld_o _ldflags _ld_lib _ld_path
18031c49 2854 unset _depflags _DEPCMD _DEPFLAGS
a758c5e2
MR
2855 _flags_filter=echo
2856
2857 if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
2858 _type=llvm_gcc
2859 gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
2860 _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
2861 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
2862 _cflags_speed='-O3'
2863 _cflags_size='-Os'
2864 elif $_cc -v 2>&1 | grep -qi ^gcc; then
2865 _type=gcc
2866 gcc_version=$($_cc --version | head -n1)
2867 gcc_basever=$($_cc -dumpversion)
2868 gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
2869 gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
2870 _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
2871 if ! $_cc -dumpversion | grep -q '^2\.'; then
2872 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
2873 fi
2874 _cflags_speed='-O3'
2875 _cflags_size='-Os'
b2d688ea 2876 elif $_cc --version 2>/dev/null | grep -q ^icc; then
a758c5e2
MR
2877 _type=icc
2878 _ident=$($_cc --version | head -n1)
2879 _depflags='-MMD'
2880 _cflags_speed='-O3'
2881 _cflags_size='-Os'
2882 _cflags_noopt='-O1'
2883 elif $_cc -v 2>&1 | grep -q xlc; then
2884 _type=xlc
2885 _ident=$($_cc -qversion 2>/dev/null | head -n1)
2886 _cflags_speed='-O5'
2887 _cflags_size='-O5 -qcompact'
2888 elif $_cc -V 2>/dev/null | grep -q Compaq; then
2889 _type=ccc
2890 _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
2891 _DEPFLAGS='-M'
a758c5e2
MR
2892 _cflags_speed='-fast'
2893 _cflags_size='-O1'
457cc333 2894 _flags_filter=ccc_flags
4936ef64 2895 elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
a758c5e2
MR
2896 test -d "$sysroot" || die "No valid sysroot specified."
2897 _type=armcc
ed6d9ce9 2898 _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
a758c5e2
MR
2899 armcc_conf="$PWD/armcc.conf"
2900 $_cc --arm_linux_configure \
2901 --arm_linux_config_file="$armcc_conf" \
2902 --configure_sysroot="$sysroot" \
2903 --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
2904 die "Error creating armcc configuration file."
2905 $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
2906 _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
2907 as_default="${cross_prefix}gcc"
2908 _depflags='-MMD'
2909 _cflags_speed='-O3'
2910 _cflags_size='-Os'
0122118e 2911 elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
a758c5e2
MR
2912 _type=tms470
2913 _ident=$($_cc -version | head -n1 | tr -s ' ')
2914 _flags='--gcc --abi=eabi -me'
18031c49 2915 _cc_e='-ppl -fe=$@'
a758c5e2 2916 _cc_o='-fe=$@'
a758c5e2
MR
2917 _depflags='-ppa -ppd=$(@:.o=.d)'
2918 _cflags_speed='-O3 -mf=5'
2919 _cflags_size='-O3 -mf=2'
2920 _flags_filter=tms470_flags
2921 elif $_cc -v 2>&1 | grep -q clang; then
2922 _type=clang
2923 _ident=$($_cc --version | head -n1)
9e057f53 2924 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
a758c5e2
MR
2925 _cflags_speed='-O3'
2926 _cflags_size='-Os'
2927 elif $_cc -V 2>&1 | grep -q Sun; then
2928 _type=suncc
2929 _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
2930 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
c72f12cb 2931 _DEPFLAGS='-xM1 -xc99'
a758c5e2
MR
2932 _ldflags='-std=c99'
2933 _cflags_speed='-O5'
2934 _cflags_size='-O5 -xspace'
2935 _flags_filter=suncc_flags
2936 elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
2937 _type=pathscale
2938 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
2939 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
2940 _cflags_speed='-O2'
2941 _cflags_size='-Os'
2942 _flags_filter='filter_out -Wdisabled-optimization'
2943 elif $_cc -v 2>&1 | grep -q Open64; then
2944 _type=open64
2945 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
2946 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
2947 _cflags_speed='-O2'
2948 _cflags_size='-Os'
2949 _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
2950 elif $_cc -V 2>&1 | grep -q Portland; then
2951 _type=pgi
2952 _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
8f23907f 2953 opt_common='-alias=ansi -Mdse -Mlre -Mpre'
a758c5e2
MR
2954 _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
2955 _cflags_size="-O2 -Munroll=c:1 $opt_common"
2956 _cflags_noopt="-O1"
2957 _flags_filter=pgi_flags
f4312352
MS
2958 elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
2959 _type=armasm
2960 _ident=$($_cc | head -n1)
2961 # 4509: "This form of conditional instruction is deprecated"
2962 _flags="-nologo -ignore 4509"
08b94f16 2963 _flags_filter=armasm_flags
dfa559bc
RB
2964 elif $_cc 2>&1 | grep -q Microsoft; then
2965 _type=msvc
2966 _ident=$($cc 2>&1 | head -n1)
2967 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
2968 _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
2969 _cflags_speed="-O2"
2970 _cflags_size="-O1"
dfa559bc 2971 if $_cc 2>&1 | grep -q Linker; then
ea9f7173 2972 _ld_o='-out:$@'
dfa559bc
RB
2973 else
2974 _ld_o='-Fe$@'
2975 fi
ea9f7173
MS
2976 _cc_o='-Fo$@'
2977 _cc_e='-P -Fi$@'
dfa559bc
RB
2978 _flags_filter=msvc_flags
2979 _ld_lib='lib%.a'
2980 _ld_path='-libpath:'
2981 _flags='-nologo'
09f2581d 2982 _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
dfa559bc 2983 if [ $pfx = hostcc ]; then
6a0200f2 2984 append _cflags -Dsnprintf=_snprintf
dfa559bc 2985 fi
322e4194
AS
2986 elif $_cc 2>&1 | grep -q Intel; then
2987 _type=icl
2988 _ident=$($cc 2>&1 | head -n1)
2989 _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
ace87c19
DB
2990 # Not only is O3 broken on 13.x+ but it is slower on all previous
2991 # versions (tested) as well.
322e4194
AS
2992 _cflags_speed="-O2"
2993 _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
322e4194 2994 if $_cc 2>&1 | grep -q Linker; then
ea9f7173 2995 _ld_o='-out:$@'
322e4194
AS
2996 else
2997 _ld_o='-Fe$@'
2998 fi
ea9f7173 2999 _cc_o='-Fo$@'
322e4194 3000 _cc_e='-P'
14fb9d3d 3001 _flags_filter=icl_flags
322e4194
AS
3002 _ld_lib='lib%.a'
3003 _ld_path='-libpath:'
ace87c19 3004 # -Qdiag-error to make icl error when seeing certain unknown arguments
60f09c04 3005 _flags='-nologo -Qdiag-error:4044,10157'
ace87c19
DB
3006 # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
3007 # with MSVC which enables it by default.
e0d6e2fc 3008 _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
322e4194
AS
3009 if [ $pfx = hostcc ]; then
3010 append _cflags -Dsnprintf=_snprintf
3011 fi
e5d45e02
LB
3012 elif $_cc --version 2>/dev/null | grep -q ^cparser; then
3013 _type=cparser
3014 _ident=$($_cc --version | head -n1)
3015 _depflags='-MMD'
3016 _cflags_speed='-O4'
3017 _cflags_size='-O2'
3018 _flags_filter=cparser_flags
aef6bd1b 3019 fi
a758c5e2
MR
3020
3021 eval ${pfx}_type=\$_type
3022 eval ${pfx}_ident=\$_ident
3023}
3024
3025set_ccvars(){
23565c26 3026 eval ${1}_C=\${_cc_c-\${${1}_C}}
18031c49 3027 eval ${1}_E=\${_cc_e-\${${1}_E}}
a758c5e2
MR
3028 eval ${1}_O=\${_cc_o-\${${1}_O}}
3029
3030 if [ -n "$_depflags" ]; then
3031 eval ${1}_DEPFLAGS=\$_depflags
3032 else
3033 eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
3034 eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
3035 eval DEP${1}FLAGS=\$_flags
3036 fi
3037}
3038
3039probe_cc cc "$cc"
3040cflags_filter=$_flags_filter
3041cflags_speed=$_cflags_speed
3042cflags_size=$_cflags_size
3043cflags_noopt=$_cflags_noopt
3044add_cflags $_flags $_cflags
3045cc_ldflags=$_ldflags
3046set_ccvars CC
3047
3048probe_cc hostcc "$host_cc"
3049host_cflags_filter=$_flags_filter
a758c5e2 3050add_host_cflags $_flags $_cflags
a758c5e2 3051set_ccvars HOSTCC
629687f6 3052
851ffa80
MR
3053test -n "$cc_type" && enable $cc_type ||
3054 warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
629687f6 3055
75bafbac 3056: ${as_default:=$cc}
50567afa 3057: ${dep_cc_default:=$cc}
684b28e0 3058: ${ld_default:=$cc}
095792f2
MR
3059: ${host_ld_default:=$host_cc}
3060set_default ar as dep_cc ld host_ld
75800dce 3061
a758c5e2
MR
3062probe_cc as "$as"
3063asflags_filter=$_flags_filter
3064add_asflags $_flags $_cflags
3065set_ccvars AS
3066
3067probe_cc ld "$ld"
3068ldflags_filter=$_flags_filter
3069add_ldflags $_flags $_ldflags
3070test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
2763587c 3071LD_O=${_ld_o-$LD_O}
8db73c61
MR
3072LD_LIB=${_ld_lib-$LD_LIB}
3073LD_PATH=${_ld_path-$LD_PATH}
a758c5e2 3074
095792f2
MR
3075probe_cc hostld "$host_ld"
3076host_ldflags_filter=$_flags_filter
3077add_host_ldflags $_flags $_ldflags
3078HOSTLD_O=${_ld_o-$HOSTLD_O}
3079
a758c5e2
MR
3080if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
3081 probe_cc depcc "$dep_cc"
3082 CCDEP=${_DEPCMD:-$DEPCMD}
3083 CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
3084 DEPCCFLAGS=$_flags
3085fi
07dec06e 3086
3dbc777c
MR
3087if $ar 2>&1 | grep -q Microsoft; then
3088 arflags="-nologo"
3089 ar_o='-out:$@'
3090elif $ar 2>&1 | grep -q 'Texas Instruments'; then
3091 arflags="rq"
3092 ar_o='$@'
4822ee3c
DB
3093elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
3094 arflags='-Xany -r -c'
3095 ar_o='$@'
3dbc777c
MR
3096else
3097 arflags="rc"
3098 ar_o='$@'
3099fi
3100
7f32f40c 3101add_cflags $extra_cflags
2f2e6c7c 3102add_asflags $extra_cflags
7f32f40c 3103
154d432c
MR
3104if test -n "$sysroot"; then
3105 case "$cc_type" in
00ba041c 3106 gcc|llvm_gcc|clang)
467256f2 3107 add_cppflags --sysroot="$sysroot"
154d432c
MR
3108 add_ldflags --sysroot="$sysroot"
3109 ;;
6fec122a
MR
3110 tms470)
3111 add_cppflags -I"$sysinclude"
3112 add_ldflags --sysroot="$sysroot"
3113 ;;
154d432c
MR
3114 esac
3115fi
3116
d22c13a8 3117if test "$cpu" = host; then
ace87c19
DB
3118 enabled cross_compile &&
3119 die "--cpu=host makes no sense when cross-compiling."
d22c13a8
MR
3120
3121 case "$cc_type" in
613a4e3f 3122 gcc|llvm_gcc)
d22c13a8
MR
3123 check_native(){
3124 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
b695256e 3125 sed -n "/cc1.*$1=/{
27ce1be8
MR
3126 s/.*$1=\\([^ ]*\\).*/\\1/
3127 p
3128 q
3129 }" $TMPE
d22c13a8
MR
3130 }
3131 cpu=$(check_native -march || check_native -mcpu)
3132 ;;
3133 esac
3134
ace87c19
DB
3135 test "${cpu:-host}" = host &&
3136 die "--cpu=host not supported with compiler $cc"
d22c13a8
MR
3137fi
3138
e939cedd
MR
3139# Deal with common $arch aliases
3140case "$arch" in
5873b623
MR
3141 aarch64|arm64)
3142 arch="aarch64"
3143 ;;
e939cedd
MR
3144 arm*)
3145 arch="arm"
3146 ;;
2acda282 3147 mips*|IP*)
e939cedd
MR
3148 arch="mips"
3149 ;;
a6e9d649 3150 parisc*|hppa*)
e939cedd
MR
3151 arch="parisc"
3152 ;;
56203596 3153 "Power Macintosh"|ppc*|powerpc*)
e939cedd
MR
3154 arch="ppc"
3155 ;;
e939cedd
MR
3156 s390|s390x)
3157 arch="s390"
3158 ;;
3159 sh4|sh)
3160 arch="sh4"
3161 ;;
4cd217c0 3162 sun4u|sparc*)
e939cedd 3163 arch="sparc"
e939cedd 3164 ;;
c75848cd
DB
3165 tilegx|tile-gx)
3166 arch="tilegx"
3167 ;;
d33ed7b3 3168 i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
e939cedd
MR
3169 arch="x86"
3170 ;;
3171esac
3172
851ffa80 3173is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
343aef9b 3174enable $arch
e939cedd 3175
df5cdc24 3176# Add processor-specific flags
9ebd45c2 3177if enabled aarch64; then
33db40f8
MR
3178
3179 case $cpu in
3180 armv*)
3181 cpuflags="-march=$cpu"
3182 ;;
3183 *)
3184 cpuflags="-mcpu=$cpu"
3185 ;;
3186 esac
3187
3188elif enabled alpha; then
3189
3190 cpuflags="-mcpu=$cpu"
3191
3192elif enabled arm; then
3193
1234c66a
MR
3194 check_arm_arch() {
3195 check_cpp_condition stddef.h \
3196 "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
3197 $cpuflags
3198 }
3199
3200 probe_arm_arch() {
3201 if check_arm_arch 4; then echo armv4;
3202 elif check_arm_arch 4T; then echo armv4t;
3203 elif check_arm_arch 5; then echo armv5;
3204 elif check_arm_arch 5E; then echo armv5e;
3205 elif check_arm_arch 5T; then echo armv5t;
3206 elif check_arm_arch 5TE; then echo armv5te;
3207 elif check_arm_arch 5TEJ; then echo armv5te;
3208 elif check_arm_arch 6; then echo armv6;
3209 elif check_arm_arch 6J; then echo armv6j;
3210 elif check_arm_arch 6K; then echo armv6k;
3211 elif check_arm_arch 6Z; then echo armv6z;
3212 elif check_arm_arch 6ZK; then echo armv6zk;
3213 elif check_arm_arch 6T2; then echo armv6t2;
3214 elif check_arm_arch 7; then echo armv7;
3215 elif check_arm_arch 7A 7_A; then echo armv7-a;
3e1b5cbc 3216 elif check_arm_arch 7S; then echo armv7-a;
1234c66a
MR
3217 elif check_arm_arch 7R 7_R; then echo armv7-r;
3218 elif check_arm_arch 7M 7_M; then echo armv7-m;
3219 elif check_arm_arch 7EM 7E_M; then echo armv7-m;
3220 elif check_arm_arch 8A 8_A; then echo armv8-a;
3221 fi
3222 }
3223
3224 [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
3225
33db40f8
MR
3226 case $cpu in
3227 armv*)
3228 cpuflags="-march=$cpu"
3229 subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
3230 ;;
3231 *)
3232 cpuflags="-mcpu=$cpu"
3233 case $cpu in
3234 cortex-a*) subarch=armv7a ;;
3235 cortex-r*) subarch=armv7r ;;
3236 cortex-m*) enable thumb; subarch=armv7m ;;
3237 arm11*) subarch=armv6 ;;
3238 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
3239 armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
1234c66a 3240 *) subarch=$(probe_arm_arch) ;;
33db40f8
MR
3241 esac
3242 ;;
3243 esac
3244
f0fe245b
MR
3245 case "$subarch" in
3246 armv5t*) enable fast_clz ;;
3247 armv[6-8]*) enable fast_clz fast_unaligned ;;
3248 esac
3249
33db40f8
MR
3250elif enabled avr32; then
3251
3252 case $cpu in
3253 ap7[02]0[0-2])
3254 subarch="avr32_ap"
3255 cpuflags="-mpart=$cpu"
3256 ;;
3257 ap)
3258 subarch="avr32_ap"
3259 cpuflags="-march=$cpu"
3260 ;;
3261 uc3[ab]*)
3262 subarch="avr32_uc"
3263 cpuflags="-mcpu=$cpu"
3264 ;;
3265 uc)
3266 subarch="avr32_uc"
3267 cpuflags="-march=$cpu"
3268 ;;
3269 esac
3270
3271elif enabled bfin; then
3272
3273 cpuflags="-mcpu=$cpu"
3274
3275elif enabled mips; then
3276
3277 cpuflags="-march=$cpu"
3278
5d54c126 3279elif enabled ppc; then
343aef9b 3280
606cc8af
DB
3281 disable ldbrx
3282
56348891
MR
3283 case $(tolower $cpu) in
3284 601|ppc601|powerpc601)
9dbd5c3d 3285 cpuflags="-mcpu=601"
64ad53ff 3286 disable altivec
9dbd5c3d 3287 ;;
56348891 3288 603*|ppc603*|powerpc603*)
9dbd5c3d 3289 cpuflags="-mcpu=603"
64ad53ff 3290 disable altivec
9dbd5c3d 3291 ;;
56348891 3292 604*|ppc604*|powerpc604*)
9dbd5c3d 3293 cpuflags="-mcpu=604"
64ad53ff 3294 disable altivec
9dbd5c3d 3295 ;;
56348891 3296 g3|75*|ppc75*|powerpc75*)
7f1fcaf0 3297 cpuflags="-mcpu=750"
64ad53ff 3298 disable altivec
9dbd5c3d 3299 ;;
56348891 3300 g4|745*|ppc745*|powerpc745*)
7f1fcaf0 3301 cpuflags="-mcpu=7450"
9dbd5c3d 3302 ;;
56348891 3303 74*|ppc74*|powerpc74*)
7f1fcaf0 3304 cpuflags="-mcpu=7400"
9dbd5c3d 3305 ;;
313f9fbf 3306 g5|970|ppc970|powerpc970)
7f1fcaf0 3307 cpuflags="-mcpu=970"
9dbd5c3d 3308 ;;
313f9fbf 3309 power[3-7]*)
7f1fcaf0 3310 cpuflags="-mcpu=$cpu"
313f9fbf 3311 ;;
56348891 3312 cell)
9dbd5c3d
MR
3313 cpuflags="-mcpu=cell"
3314 enable ldbrx
3315 ;;
4ab26cb4
DB
3316 e500mc)
3317 cpuflags="-mcpu=e500mc"
3318 disable altivec
3319 ;;
7b0b81a1
AL
3320 e500v2)
3321 cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
3322 disable altivec
54f78816 3323 disable dcbzl
7b0b81a1
AL
3324 ;;
3325 e500)
3326 cpuflags="-mcpu=8540 -mhard-float"
3327 disable altivec
54f78816 3328 disable dcbzl
7b0b81a1 3329 ;;
9dbd5c3d 3330 esac
343aef9b