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