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