f6bc622c1cc88fd89042a14aec7aa54f75c49eab
[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 [LIBDIR]
88   --incdir=DIR             install includes in DIR [PREFIX/include]
89   --mandir=DIR             install man page in DIR [PREFIX/share/man]
90   --pkgconfigdir=DIR       install pkg-config files in DIR [LIBDIR/pkgconfig]
91   --enable-rpath           use rpath to allow installing libraries in paths
92                            not part of the dynamic linker search path
93                            use rpath when linking programs [USE WITH CARE]
94
95 Licensing options:
96   --enable-gpl             allow use of GPL code, the resulting libs
97                            and binaries will be under GPL [no]
98   --enable-version3        upgrade (L)GPL to version 3 [no]
99   --enable-nonfree         allow use of nonfree code, the resulting libs
100                            and binaries will be unredistributable [no]
101
102 Configuration options:
103   --disable-static         do not build static libraries [no]
104   --enable-shared          build shared libraries [no]
105   --enable-small           optimize for size instead of speed
106   --disable-runtime-cpudetect disable detecting cpu capabilities at runtime (smaller binary)
107   --enable-gray            enable full grayscale support (slower color)
108   --disable-swscale-alpha  disable alpha channel support in swscale
109   --disable-all            disable building components, libraries and programs
110   --enable-incompatible-libav-abi enable incompatible Libav fork ABI [no]
111   --enable-raise-major     increase major version numbers in sonames [no]
112
113 Program options:
114   --disable-programs       do not build command line programs
115   --disable-ffmpeg         disable ffmpeg build
116   --disable-ffplay         disable ffplay build
117   --disable-ffprobe        disable ffprobe build
118   --disable-ffserver       disable ffserver build
119
120 Documentation options:
121   --disable-doc            do not build documentation
122   --disable-htmlpages      do not build HTML documentation pages
123   --disable-manpages       do not build man documentation pages
124   --disable-podpages       do not build POD documentation pages
125   --disable-txtpages       do not build text documentation pages
126
127 Component options:
128   --disable-avdevice       disable libavdevice build
129   --disable-avcodec        disable libavcodec build
130   --disable-avformat       disable libavformat build
131   --disable-avutil         disable libavutil build
132   --disable-swresample     disable libswresample build
133   --disable-swscale        disable libswscale build
134   --disable-postproc       disable libpostproc build
135   --disable-avfilter       disable libavfilter build
136   --enable-avresample      enable libavresample build [no]
137   --disable-pthreads       disable pthreads [autodetect]
138   --disable-w32threads     disable Win32 threads [autodetect]
139   --disable-os2threads     disable OS/2 threads [autodetect]
140   --disable-network        disable network support [no]
141   --disable-dct            disable DCT code
142   --disable-dwt            disable DWT code
143   --disable-error-resilience disable error resilience code
144   --disable-lsp            disable LSP code
145   --disable-lzo            disable LZO decoder code
146   --disable-mdct           disable MDCT code
147   --disable-rdft           disable RDFT code
148   --disable-fft            disable FFT code
149   --disable-faan           disable floating point AAN (I)DCT code
150   --disable-pixelutils     disable pixel utils in libavutil
151
152 Hardware accelerators:
153   --disable-d3d11va        disable D3D11VA code [autodetect]
154   --disable-dxva2          disable DXVA2 code [autodetect]
155   --disable-vaapi          disable VAAPI code [autodetect]
156   --disable-vda            disable VDA code [autodetect]
157   --disable-vdpau          disable VDPAU code [autodetect]
158   --enable-videotoolbox    enable VideoToolbox code [autodetect]
159
160 Individual component options:
161   --disable-everything     disable all components listed below
162   --disable-encoder=NAME   disable encoder NAME
163   --enable-encoder=NAME    enable encoder NAME
164   --disable-encoders       disable all encoders
165   --disable-decoder=NAME   disable decoder NAME
166   --enable-decoder=NAME    enable decoder NAME
167   --disable-decoders       disable all decoders
168   --disable-hwaccel=NAME   disable hwaccel NAME
169   --enable-hwaccel=NAME    enable hwaccel NAME
170   --disable-hwaccels       disable all hwaccels
171   --disable-muxer=NAME     disable muxer NAME
172   --enable-muxer=NAME      enable muxer NAME
173   --disable-muxers         disable all muxers
174   --disable-demuxer=NAME   disable demuxer NAME
175   --enable-demuxer=NAME    enable demuxer NAME
176   --disable-demuxers       disable all demuxers
177   --enable-parser=NAME     enable parser NAME
178   --disable-parser=NAME    disable parser NAME
179   --disable-parsers        disable all parsers
180   --enable-bsf=NAME        enable bitstream filter NAME
181   --disable-bsf=NAME       disable bitstream filter NAME
182   --disable-bsfs           disable all bitstream filters
183   --enable-protocol=NAME   enable protocol NAME
184   --disable-protocol=NAME  disable protocol NAME
185   --disable-protocols      disable all protocols
186   --enable-indev=NAME      enable input device NAME
187   --disable-indev=NAME     disable input device NAME
188   --disable-indevs         disable input devices
189   --enable-outdev=NAME     enable output device NAME
190   --disable-outdev=NAME    disable output device NAME
191   --disable-outdevs        disable output devices
192   --disable-devices        disable all devices
193   --enable-filter=NAME     enable filter NAME
194   --disable-filter=NAME    disable filter NAME
195   --disable-filters        disable all filters
196
197 External library support:
198   --enable-avisynth        enable reading of AviSynth script files [no]
199   --disable-bzlib          disable bzlib [autodetect]
200   --enable-fontconfig      enable fontconfig, useful for drawtext filter [no]
201   --enable-frei0r          enable frei0r video filtering [no]
202   --enable-gnutls          enable gnutls, needed for https support
203                            if openssl is not used [no]
204   --disable-iconv          disable iconv [autodetect]
205   --enable-ladspa          enable LADSPA audio filtering [no]
206   --enable-libaacplus      enable AAC+ encoding via libaacplus [no]
207   --enable-libass          enable libass subtitles rendering,
208                            needed for subtitles and ass filter [no]
209   --enable-libbluray       enable BluRay reading using libbluray [no]
210   --enable-libbs2b         enable bs2b DSP library [no]
211   --enable-libcaca         enable textual display using libcaca [no]
212   --enable-libcelt         enable CELT decoding via libcelt [no]
213   --enable-libcdio         enable audio CD grabbing with libcdio [no]
214   --enable-libdc1394       enable IIDC-1394 grabbing using libdc1394
215                            and libraw1394 [no]
216   --enable-libdcadec       enable DCA decoding via libdcadec [no]
217   --enable-libfaac         enable AAC encoding via libfaac [no]
218   --enable-libfdk-aac      enable AAC de/encoding via libfdk-aac [no]
219   --enable-libflite        enable flite (voice synthesis) support via libflite [no]
220   --enable-libfreetype     enable libfreetype, needed for drawtext filter [no]
221   --enable-libfribidi      enable libfribidi, improves drawtext filter [no]
222   --enable-libgme          enable Game Music Emu via libgme [no]
223   --enable-libgsm          enable GSM de/encoding via libgsm [no]
224   --enable-libiec61883     enable iec61883 via libiec61883 [no]
225   --enable-libilbc         enable iLBC de/encoding via libilbc [no]
226   --enable-libkvazaar      enable HEVC encoding via libkvazaar [no]
227   --enable-libmfx          enable HW acceleration through libmfx
228   --enable-libmodplug      enable ModPlug via libmodplug [no]
229   --enable-libmp3lame      enable MP3 encoding via libmp3lame [no]
230   --enable-libnut          enable NUT (de)muxing via libnut,
231                            native (de)muxer exists [no]
232   --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
233   --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
234   --enable-libopencv       enable video filtering via libopencv [no]
235   --enable-libopenh264     enable H.264 encoding via OpenH264 [no]
236   --enable-libopenjpeg     enable JPEG 2000 de/encoding via OpenJPEG [no]
237   --enable-libopus         enable Opus de/encoding via libopus [no]
238   --enable-libpulse        enable Pulseaudio input via libpulse [no]
239   --enable-librubberband   enable rubberband needed for rubberband filter [no]
240   --enable-libquvi         enable quvi input via libquvi [no]
241   --enable-librtmp         enable RTMP[E] support via librtmp [no]
242   --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
243   --enable-libshine        enable fixed-point MP3 encoding via libshine [no]
244   --enable-libsmbclient    enable Samba protocol via libsmbclient [no]
245   --enable-libsnappy       enable Snappy compression, needed for hap encoding [no]
246   --enable-libsoxr         enable Include libsoxr resampling [no]
247   --enable-libspeex        enable Speex de/encoding via libspeex [no]
248   --enable-libssh          enable SFTP protocol via libssh [no]
249   --enable-libstagefright-h264  enable H.264 decoding via libstagefright [no]
250   --enable-libtesseract    enable Tesseract, needed for ocr filter [no]
251   --enable-libtheora       enable Theora encoding via libtheora [no]
252   --enable-libtwolame      enable MP2 encoding via libtwolame [no]
253   --enable-libutvideo      enable Ut Video encoding and decoding via libutvideo [no]
254   --enable-libv4l2         enable libv4l2/v4l-utils [no]
255   --enable-libvidstab      enable video stabilization using vid.stab [no]
256   --enable-libvo-aacenc    enable AAC encoding via libvo-aacenc [no]
257   --enable-libvo-amrwbenc  enable AMR-WB encoding via libvo-amrwbenc [no]
258   --enable-libvorbis       enable Vorbis en/decoding via libvorbis,
259                            native implementation exists [no]
260   --enable-libvpx          enable VP8 and VP9 de/encoding via libvpx [no]
261   --enable-libwavpack      enable wavpack encoding via libwavpack [no]
262   --enable-libwebp         enable WebP encoding via libwebp [no]
263   --enable-libx264         enable H.264 encoding via x264 [no]
264   --enable-libx265         enable HEVC encoding via x265 [no]
265   --enable-libxavs         enable AVS encoding via xavs [no]
266   --enable-libxcb          enable X11 grabbing using XCB [autodetect]
267   --enable-libxcb-shm      enable X11 grabbing shm communication [autodetect]
268   --enable-libxcb-xfixes   enable X11 grabbing mouse rendering [autodetect]
269   --enable-libxcb-shape    enable X11 grabbing shape rendering [autodetect]
270   --enable-libxvid         enable Xvid encoding via xvidcore,
271                            native MPEG-4/Xvid encoder exists [no]
272   --enable-libzmq          enable message passing via libzmq [no]
273   --enable-libzvbi         enable teletext support via libzvbi [no]
274   --disable-lzma           disable lzma [autodetect]
275   --enable-decklink        enable Blackmagick DeckLink I/O support [no]
276   --enable-mmal            enable decoding via MMAL [no]
277   --enable-nvenc           enable NVIDIA NVENC support [no]
278   --enable-openal          enable OpenAL 1.1 capture support [no]
279   --enable-opencl          enable OpenCL code
280   --enable-opengl          enable OpenGL rendering [no]
281   --enable-openssl         enable openssl, needed for https support
282                            if gnutls is not used [no]
283   --disable-sdl            disable sdl [autodetect]
284   --disable-securetransport disable Secure Transport, needed for TLS support
285                            on OSX if openssl and gnutls are not used [autodetect]
286   --enable-x11grab         enable X11 grabbing (legacy) [no]
287   --disable-xlib           disable xlib [autodetect]
288   --disable-zlib           disable zlib [autodetect]
289
290 Toolchain options:
291   --arch=ARCH              select architecture [$arch]
292   --cpu=CPU                select the minimum required CPU (affects
293                            instruction selection, may crash on older CPUs)
294   --cross-prefix=PREFIX    use PREFIX for compilation tools [$cross_prefix]
295   --progs-suffix=SUFFIX    program name suffix []
296   --enable-cross-compile   assume a cross-compiler is used
297   --sysroot=PATH           root of cross-build tree
298   --sysinclude=PATH        location of cross-build system headers
299   --target-os=OS           compiler targets OS [$target_os]
300   --target-exec=CMD        command to run executables on target
301   --target-path=DIR        path to view of build directory on target
302   --target-samples=DIR     path to samples directory on target
303   --tempprefix=PATH        force fixed dir/prefix instead of mktemp for checks
304   --toolchain=NAME         set tool defaults according to NAME
305   --nm=NM                  use nm tool NM [$nm_default]
306   --ar=AR                  use archive tool AR [$ar_default]
307   --as=AS                  use assembler AS [$as_default]
308   --windres=WINDRES        use windows resource compiler WINDRES [$windres_default]
309   --yasmexe=EXE            use yasm-compatible assembler EXE [$yasmexe_default]
310   --cc=CC                  use C compiler CC [$cc_default]
311   --cxx=CXX                use C compiler CXX [$cxx_default]
312   --dep-cc=DEPCC           use dependency generator DEPCC [$cc_default]
313   --ld=LD                  use linker LD [$ld_default]
314   --pkg-config=PKGCONFIG   use pkg-config tool PKGCONFIG [$pkg_config_default]
315   --pkg-config-flags=FLAGS pass additional flags to pkgconf []
316   --ranlib=RANLIB          use ranlib RANLIB [$ranlib_default]
317   --doxygen=DOXYGEN        use DOXYGEN to generate API doc [$doxygen_default]
318   --host-cc=HOSTCC         use host C compiler HOSTCC
319   --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
320   --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
321   --host-ld=HOSTLD         use host linker HOSTLD
322   --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
323   --host-libs=HLIBS        use libs HLIBS when linking for host
324   --host-os=OS             compiler host OS [$target_os]
325   --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]
326   --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
327   --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
328   --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
329   --extra-ldlibflags=ELDFLAGS add ELDFLAGS to LDLIBFLAGS [$LDLIBFLAGS]
330   --extra-libs=ELIBS       add ELIBS [$ELIBS]
331   --extra-version=STRING   version string suffix []
332   --optflags=OPTFLAGS      override optimization-related compiler flags
333   --build-suffix=SUFFIX    library name suffix []
334   --enable-pic             build position-independent code
335   --enable-thumb           compile for Thumb instruction set
336   --enable-lto             use link-time optimization
337   --env="ENV=override"     override the environment variables
338
339 Advanced options (experts only):
340   --malloc-prefix=PREFIX   prefix malloc and related names with PREFIX
341   --disable-symver         disable symbol versioning
342   --enable-hardcoded-tables use hardcoded tables instead of runtime generation
343   --disable-safe-bitstream-reader
344                            disable buffer boundary checking in bitreaders
345                            (faster, but may crash)
346   --enable-memalign-hack   emulate memalign, interferes with memory debuggers
347   --sws-max-filter-size=N  the max filter size swscale uses [$sws_max_filter_size_default]
348
349 Optimization options (experts only):
350   --disable-asm            disable all assembly optimizations
351   --disable-altivec        disable AltiVec optimizations
352   --disable-vsx            disable VSX optimizations
353   --disable-power8         disable POWER8 optimizations
354   --disable-amd3dnow       disable 3DNow! optimizations
355   --disable-amd3dnowext    disable 3DNow! extended optimizations
356   --disable-mmx            disable MMX optimizations
357   --disable-mmxext         disable MMXEXT optimizations
358   --disable-sse            disable SSE optimizations
359   --disable-sse2           disable SSE2 optimizations
360   --disable-sse3           disable SSE3 optimizations
361   --disable-ssse3          disable SSSE3 optimizations
362   --disable-sse4           disable SSE4 optimizations
363   --disable-sse42          disable SSE4.2 optimizations
364   --disable-avx            disable AVX optimizations
365   --disable-xop            disable XOP optimizations
366   --disable-fma3           disable FMA3 optimizations
367   --disable-fma4           disable FMA4 optimizations
368   --disable-avx2           disable AVX2 optimizations
369   --disable-armv5te        disable armv5te optimizations
370   --disable-armv6          disable armv6 optimizations
371   --disable-armv6t2        disable armv6t2 optimizations
372   --disable-vfp            disable VFP optimizations
373   --disable-neon           disable NEON optimizations
374   --disable-inline-asm     disable use of inline assembly
375   --disable-yasm           disable use of nasm/yasm assembly
376   --disable-mips32r5       disable MIPS32R5 optimizations
377   --disable-mips64r6       disable MIPS64R6 optimizations
378   --disable-mipsdspr1      disable MIPS DSP ASE R1 optimizations
379   --disable-mipsdspr2      disable MIPS DSP ASE R2 optimizations
380   --disable-msa            disable MSA optimizations
381   --disable-mipsfpu        disable floating point MIPS optimizations
382   --disable-mmi            disable Loongson SIMD optimizations
383   --disable-fast-unaligned consider unaligned accesses slow
384
385 Developer options (useful when working on FFmpeg itself):
386   --disable-debug          disable debugging symbols
387   --enable-debug=LEVEL     set the debug level [$debuglevel]
388   --disable-optimizations  disable compiler optimizations
389   --enable-extra-warnings  enable more compiler warnings
390   --disable-stripping      disable stripping of executables and shared libraries
391   --assert-level=level     0(default), 1 or 2, amount of assertion testing,
392                            2 causes a slowdown at runtime.
393   --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
394   --valgrind=VALGRIND      run "make fate" tests through valgrind to detect memory
395                            leaks and errors, using the specified valgrind binary.
396                            Cannot be combined with --target-exec
397   --enable-ftrapv          Trap arithmetic overflows
398   --samples=PATH           location of test samples for FATE, if not set use
399                            \$FATE_SAMPLES at make invocation time.
400   --enable-neon-clobber-test check NEON registers for clobbering (should be
401                            used only for debugging purposes)
402   --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
403                            should be used only for debugging purposes)
404   --enable-random          randomly enable/disable components
405   --disable-random
406   --enable-random=LIST     randomly enable/disable specific components or
407   --disable-random=LIST    component groups. LIST is a comma-separated list
408                            of NAME[:PROB] entries where NAME is a component
409                            (group) and PROB the probability associated with
410                            NAME (default 0.5).
411   --random-seed=VALUE      seed value for --enable/disable-random
412   --disable-valgrind-backtrace do not print a backtrace under Valgrind
413                            (only applies to --disable-optimizations builds)
414
415 NOTE: Object files are built at the place where configure is launched.
416 EOF
417   exit 0
418 }
419
420 quotes='""'
421 if test -t 1 && which tput >/dev/null 2>&1; then
422     ncolors=$(tput colors)
423     if test -n "$ncolors" && test $ncolors -ge 8; then
424         bold_color=$(tput bold)
425         warn_color=$(tput setaf 3)
426         error_color=$(tput setaf 1)
427         reset_color=$(tput sgr0)
428     fi
429     # 72 used instead of 80 since that's the default of pr
430     ncols=$(tput cols)
431 fi
432 : ${ncols:=72}
433
434 log(){
435     echo "$@" >> $logfile
436 }
437
438 log_file(){
439     log BEGIN $1
440     pr -n -t $1 >> $logfile
441     log END $1
442 }
443
444 warn(){
445     log "WARNING: $*"
446     WARNINGS="${WARNINGS}WARNING: $*\n"
447 }
448
449 die(){
450     log "$@"
451     echo "$error_color$bold_color$@$reset_color"
452     cat <<EOF
453
454 If you think configure made a mistake, make sure you are using the latest
455 version from Git.  If the latest version fails, report the problem to the
456 ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
457 EOF
458     if disabled logging; then
459         cat <<EOF
460 Rerun configure with logging enabled (do not use --disable-logging), and
461 include the log this produces with your report.
462 EOF
463     else
464         cat <<EOF
465 Include the log file "$logfile" produced by configure as this will help
466 solve the problem.
467 EOF
468     fi
469     exit 1
470 }
471
472 # Avoid locale weirdness, besides we really just want to translate ASCII.
473 toupper(){
474     echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
475 }
476
477 tolower(){
478     echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
479 }
480
481 c_escape(){
482     echo "$*" | sed 's/["\\]/\\\0/g'
483 }
484
485 sh_quote(){
486     v=$(echo "$1" | sed "s/'/'\\\\''/g")
487     test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
488     echo "$v"
489 }
490
491 cleanws(){
492     echo "$@" | sed 's/^ *//;s/[[:space:]][[:space:]]*/ /g;s/ *$//'
493 }
494
495 filter(){
496     pat=$1
497     shift
498     for v; do
499         eval "case $v in $pat) echo $v ;; esac"
500     done
501 }
502
503 filter_out(){
504     pat=$1
505     shift
506     for v; do
507         eval "case $v in $pat) ;; *) echo $v ;; esac"
508     done
509 }
510
511 map(){
512     m=$1
513     shift
514     for v; do eval $m; done
515 }
516
517 add_suffix(){
518     suffix=$1
519     shift
520     for v; do echo ${v}${suffix}; done
521 }
522
523 set_all(){
524     value=$1
525     shift
526     for var in $*; do
527         eval $var=$value
528     done
529 }
530
531 set_weak(){
532     value=$1
533     shift
534     for var; do
535         eval : \${$var:=$value}
536     done
537 }
538
539 sanitize_var_name(){
540     echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
541 }
542
543 set_safe(){
544     var=$1
545     shift
546     eval $(sanitize_var_name "$var")='$*'
547 }
548
549 get_safe(){
550     eval echo \$$(sanitize_var_name "$1")
551 }
552
553 pushvar(){
554     for pvar in $*; do
555         eval level=\${${pvar}_level:=0}
556         eval ${pvar}_${level}="\$$pvar"
557         eval ${pvar}_level=$(($level+1))
558     done
559 }
560
561 popvar(){
562     for pvar in $*; do
563         eval level=\${${pvar}_level:-0}
564         test $level = 0 && continue
565         eval level=$(($level-1))
566         eval $pvar="\${${pvar}_${level}}"
567         eval ${pvar}_level=$level
568         eval unset ${pvar}_${level}
569     done
570 }
571
572 enable(){
573     set_all yes $*
574 }
575
576 disable(){
577     set_all no $*
578 }
579
580 enable_weak(){
581     set_weak yes $*
582 }
583
584 disable_weak(){
585     set_weak no $*
586 }
587
588 enable_safe(){
589     for var; do
590         enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
591     done
592 }
593
594 disable_safe(){
595     for var; do
596         disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
597     done
598 }
599
600 do_enable_deep(){
601     for var; do
602         enabled $var && continue
603         eval sel="\$${var}_select"
604         eval sgs="\$${var}_suggest"
605         pushvar var sgs
606         enable_deep $sel
607         popvar sgs
608         enable_deep_weak $sgs
609         popvar var
610     done
611 }
612
613 enable_deep(){
614     do_enable_deep $*
615     enable $*
616 }
617
618 enable_deep_weak(){
619     for var; do
620         disabled $var && continue
621         pushvar var
622         do_enable_deep $var
623         popvar var
624         enable_weak $var
625     done
626 }
627
628 enabled(){
629     test "${1#!}" = "$1" && op='=' || op=!=
630     eval test "x\$${1#!}" $op "xyes"
631 }
632
633 disabled(){
634     test "${1#!}" = "$1" && op='=' || op=!=
635     eval test "x\$${1#!}" $op "xno"
636 }
637
638 enabled_all(){
639     for opt; do
640         enabled $opt || return 1
641     done
642 }
643
644 disabled_all(){
645     for opt; do
646         disabled $opt || return 1
647     done
648 }
649
650 enabled_any(){
651     for opt; do
652         enabled $opt && return 0
653     done
654 }
655
656 disabled_any(){
657     for opt; do
658         disabled $opt && return 0
659     done
660     return 1
661 }
662
663 set_default(){
664     for opt; do
665         eval : \${$opt:=\$${opt}_default}
666     done
667 }
668
669 is_in(){
670     value=$1
671     shift
672     for var in $*; do
673         [ $var = $value ] && return 0
674     done
675     return 1
676 }
677
678 do_check_deps(){
679     for cfg; do
680         cfg="${cfg#!}"
681         enabled ${cfg}_checking && die "Circular dependency for $cfg."
682         disabled ${cfg}_checking && continue
683         enable ${cfg}_checking
684         append allopts $cfg
685
686         eval dep_all="\$${cfg}_deps"
687         eval dep_any="\$${cfg}_deps_any"
688         eval dep_sel="\$${cfg}_select"
689         eval dep_sgs="\$${cfg}_suggest"
690         eval dep_ifa="\$${cfg}_if"
691         eval dep_ifn="\$${cfg}_if_any"
692
693         pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
694         do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
695         popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
696
697         [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
698         [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
699         enabled_all  $dep_all || disable $cfg
700         enabled_any  $dep_any || disable $cfg
701         disabled_any $dep_sel && disable $cfg
702
703         if enabled $cfg; then
704             enable_deep $dep_sel
705             enable_deep_weak $dep_sgs
706         fi
707
708         disable ${cfg}_checking
709     done
710 }
711
712 check_deps(){
713     unset allopts
714
715     do_check_deps "$@"
716
717     for cfg in $allopts; do
718         enabled $cfg || continue
719         eval dep_extralibs="\$${cfg}_extralibs"
720         test -n "$dep_extralibs" && add_extralibs $dep_extralibs
721     done
722 }
723
724 print_config(){
725     pfx=$1
726     files=$2
727     shift 2
728     map 'eval echo "$v \${$v:-no}"' "$@" |
729     awk "BEGIN { split(\"$files\", files) }
730         {
731             c = \"$pfx\" toupper(\$1);
732             v = \$2;
733             sub(/yes/, 1, v);
734             sub(/no/,  0, v);
735             for (f in files) {
736                 file = files[f];
737                 if (file ~ /\\.h\$/) {
738                     printf(\"#define %s %d\\n\", c, v) >>file;
739                 } else if (file ~ /\\.asm\$/) {
740                     printf(\"%%define %s %d\\n\", c, v) >>file;
741                 } else if (file ~ /\\.mak\$/) {
742                     n = -v ? \"\" : \"!\";
743                     printf(\"%s%s=yes\\n\", n, c) >>file;
744                 } else if (file ~ /\\.texi\$/) {
745                     pre = -v ? \"\" : \"@c \";
746                     yesno = \$2;
747                     c2 = tolower(c);
748                     gsub(/_/, \"-\", c2);
749                     printf(\"%s@set %s %s\\n\", pre, c2, yesno) >>file;
750                 }
751             }
752         }"
753 }
754
755 print_enabled(){
756     suf=$1
757     shift
758     for v; do
759         enabled $v && printf "%s\n" ${v%$suf};
760     done
761 }
762
763 append(){
764     var=$1
765     shift
766     eval "$var=\"\$$var $*\""
767 }
768
769 prepend(){
770     var=$1
771     shift
772     eval "$var=\"$* \$$var\""
773 }
774
775 unique(){
776     var=$1
777     uniq_list=""
778     for tok in $(eval echo \$$var); do
779         uniq_list="$(filter_out $tok $uniq_list) $tok"
780     done
781     eval "$var=\"${uniq_list}\""
782 }
783
784 add_cppflags(){
785     append CPPFLAGS "$@"
786 }
787
788 add_cflags(){
789     append CFLAGS $($cflags_filter "$@")
790 }
791
792 add_cxxflags(){
793     append CXXFLAGS $($cflags_filter "$@")
794 }
795
796 add_asflags(){
797     append ASFLAGS $($asflags_filter "$@")
798 }
799
800 add_ldflags(){
801     append LDFLAGS $($ldflags_filter "$@")
802 }
803
804 add_ldexeflags(){
805     append LDEXEFLAGS $($ldflags_filter "$@")
806 }
807
808 add_ldlibflags(){
809     append LDLIBFLAGS $($ldflags_filter "$@")
810 }
811
812 add_stripflags(){
813     append ASMSTRIPFLAGS "$@"
814 }
815
816 add_extralibs(){
817     prepend extralibs $($ldflags_filter "$@")
818 }
819
820 add_host_cppflags(){
821     append host_cppflags "$@"
822 }
823
824 add_host_cflags(){
825     append host_cflags $($host_cflags_filter "$@")
826 }
827
828 add_host_ldflags(){
829     append host_ldflags $($host_ldflags_filter "$@")
830 }
831
832 add_compat(){
833     append compat_objs $1
834     shift
835     map 'add_cppflags -D$v' "$@"
836 }
837
838 check_cmd(){
839     log "$@"
840     "$@" >> $logfile 2>&1
841 }
842
843 check_stat(){
844     log check_stat "$@"
845     stat "$1" >> $logfile 2>&1
846 }
847
848 cc_o(){
849     eval printf '%s\\n' $CC_O
850 }
851
852 cc_e(){
853     eval printf '%s\\n' $CC_E
854 }
855
856 check_cc(){
857     log check_cc "$@"
858     cat > $TMPC
859     log_file $TMPC
860     check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
861 }
862
863 check_cxx(){
864     log check_cxx "$@"
865     cat > $TMPCPP
866     log_file $TMPCPP
867     check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" $CXX_C -o $TMPO $TMPCPP
868 }
869
870 check_oc(){
871     log check_oc "$@"
872     cat > $TMPM
873     log_file $TMPM
874     check_cmd $cc -Werror=missing-prototypes $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPM
875 }
876
877 check_cpp(){
878     log check_cpp "$@"
879     cat > $TMPC
880     log_file $TMPC
881     check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
882 }
883
884 as_o(){
885     eval printf '%s\\n' $AS_O
886 }
887
888 check_as(){
889     log check_as "$@"
890     cat > $TMPS
891     log_file $TMPS
892     check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
893 }
894
895 check_inline_asm(){
896     log check_inline_asm "$@"
897     name="$1"
898     code="$2"
899     shift 2
900     disable $name
901     check_cc "$@" <<EOF && enable $name
902 void foo(void){ __asm__ volatile($code); }
903 EOF
904 }
905
906 check_insn(){
907     log check_insn "$@"
908     check_inline_asm ${1}_inline "\"$2\""
909     echo "$2" | check_as && enable ${1}_external || disable ${1}_external
910 }
911
912 check_yasm(){
913     log check_yasm "$@"
914     echo "$1" > $TMPS
915     log_file $TMPS
916     shift 1
917     check_cmd $yasmexe $YASMFLAGS -Werror "$@" -o $TMPO $TMPS
918 }
919
920 ld_o(){
921     eval printf '%s\\n' $LD_O
922 }
923
924 check_ld(){
925     log check_ld "$@"
926     type=$1
927     shift 1
928     flags=$(filter_out '-l*|*.so' $@)
929     libs=$(filter '-l*|*.so' $@)
930     check_$type $($cflags_filter $flags) || return
931     flags=$($ldflags_filter $flags)
932     libs=$($ldflags_filter $libs)
933     check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
934 }
935
936 print_include(){
937     hdr=$1
938     test "${hdr%.h}" = "${hdr}" &&
939         echo "#include $hdr"    ||
940         echo "#include <$hdr>"
941 }
942
943 check_code(){
944     log check_code "$@"
945     check=$1
946     headers=$2
947     code=$3
948     shift 3
949     {
950         for hdr in $headers; do
951             print_include $hdr
952         done
953         echo "int main(void) { $code; return 0; }"
954     } | check_$check "$@"
955 }
956
957 check_cppflags(){
958     log check_cppflags "$@"
959     check_cc "$@" <<EOF && append CPPFLAGS "$@"
960 int x;
961 EOF
962 }
963
964 test_cflags(){
965     log test_cflags "$@"
966     set -- $($cflags_filter "$@")
967     check_cc "$@" <<EOF
968 int x;
969 EOF
970 }
971
972 check_cflags(){
973     log check_cflags "$@"
974     test_cflags "$@" && add_cflags "$@"
975 }
976
977 check_cxxflags(){
978     log check_cxxflags "$@"
979     set -- $($cflags_filter "$@")
980     check_cxx "$@" <<EOF && append CXXFLAGS "$@"
981 int x;
982 EOF
983 }
984
985 test_ldflags(){
986     log test_ldflags "$@"
987     check_ld "cc" "$@" <<EOF
988 int main(void){ return 0; }
989 EOF
990 }
991
992 check_ldflags(){
993     log check_ldflags "$@"
994     test_ldflags "$@" && add_ldflags "$@"
995 }
996
997 test_stripflags(){
998     log test_stripflags "$@"
999     # call check_cc to get a fresh TMPO
1000     check_cc <<EOF
1001 int main(void) { return 0; }
1002 EOF
1003     check_cmd $strip $ASMSTRIPFLAGS "$@" $TMPO
1004 }
1005
1006 check_stripflags(){
1007     log check_stripflags "$@"
1008     test_stripflags "$@" && add_stripflags "$@"
1009 }
1010
1011 check_header(){
1012     log check_header "$@"
1013     header=$1
1014     shift
1015     disable_safe $header
1016     check_cpp "$@" <<EOF && enable_safe $header
1017 #include <$header>
1018 int x;
1019 EOF
1020 }
1021
1022 check_header_oc(){
1023     log check_header_oc "$@"
1024     rm -f -- "$TMPO"
1025     header=$1
1026     shift
1027     disable_safe $header
1028     {
1029        echo "#include <$header>"
1030        echo "int main(void) { return 0; }"
1031     } | check_oc && check_stat "$TMPO" && enable_safe $headers
1032 }
1033
1034 check_func(){
1035     log check_func "$@"
1036     func=$1
1037     shift
1038     disable $func
1039     check_ld "cc" "$@" <<EOF && enable $func
1040 extern int $func();
1041 int main(void){ $func(); }
1042 EOF
1043 }
1044
1045 check_mathfunc(){
1046     log check_mathfunc "$@"
1047     func=$1
1048     narg=$2
1049     shift 2
1050     test $narg = 2 && args="f, g" || args="f"
1051     disable $func
1052     check_ld "cc" "$@" <<EOF && enable $func
1053 #include <math.h>
1054 float foo(float f, float g) { return $func($args); }
1055 int main(void){ return (int) foo; }
1056 EOF
1057 }
1058
1059 check_func_headers(){
1060     log check_func_headers "$@"
1061     headers=$1
1062     funcs=$2
1063     shift 2
1064     {
1065         for hdr in $headers; do
1066             print_include $hdr
1067         done
1068         for func in $funcs; do
1069             echo "long check_$func(void) { return (long) $func; }"
1070         done
1071         echo "int main(void) { return 0; }"
1072     } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
1073 }
1074
1075 check_class_headers_cpp(){
1076     log check_class_headers_cpp "$@"
1077     headers=$1
1078     classes=$2
1079     shift 2
1080     {
1081         for hdr in $headers; do
1082             echo "#include <$hdr>"
1083         done
1084         echo "int main(void) { "
1085         i=1
1086         for class in $classes; do
1087             echo "$class obj$i;"
1088             i=$(expr $i + 1)
1089         done
1090         echo "return 0; }"
1091     } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
1092 }
1093
1094 check_cpp_condition(){
1095     log check_cpp_condition "$@"
1096     header=$1
1097     condition=$2
1098     shift 2
1099     check_cpp "$@" <<EOF
1100 #include <$header>
1101 #if !($condition)
1102 #error "unsatisfied condition: $condition"
1103 #endif
1104 EOF
1105 }
1106
1107 check_lib(){
1108     log check_lib "$@"
1109     header="$1"
1110     func="$2"
1111     shift 2
1112     check_header $header && check_func $func "$@" && add_extralibs "$@"
1113 }
1114
1115 check_lib2(){
1116     log check_lib2 "$@"
1117     headers="$1"
1118     funcs="$2"
1119     shift 2
1120     check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
1121 }
1122
1123 check_lib_cpp(){
1124     log check_lib_cpp "$@"
1125     headers="$1"
1126     classes="$2"
1127     shift 2
1128     check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
1129 }
1130
1131 check_pkg_config(){
1132     log check_pkg_config "$@"
1133     pkgandversion="$1"
1134     pkg="${1%% *}"
1135     headers="$2"
1136     funcs="$3"
1137     shift 3
1138     check_cmd $pkg_config --exists --print-errors $pkgandversion || return
1139     pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
1140     pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
1141     check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
1142         set_safe "${pkg}_cflags" $pkg_cflags   &&
1143         set_safe "${pkg}_libs"   $pkg_libs
1144 }
1145
1146 check_exec(){
1147     check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
1148 }
1149
1150 check_exec_crash(){
1151     code=$(cat)
1152
1153     # exit() is not async signal safe.  _Exit (C99) and _exit (POSIX)
1154     # are safe but may not be available everywhere.  Thus we use
1155     # raise(SIGTERM) instead.  The check is run in a subshell so we
1156     # can redirect the "Terminated" message from the shell.  SIGBUS
1157     # is not defined by standard C so it is used conditionally.
1158
1159     (check_exec "$@") >> $logfile 2>&1 <<EOF
1160 #include <signal.h>
1161 static void sighandler(int sig){
1162     raise(SIGTERM);
1163 }
1164 int foo(void){
1165     $code
1166 }
1167 int (*func_ptr)(void) = foo;
1168 int main(void){
1169     signal(SIGILL, sighandler);
1170     signal(SIGFPE, sighandler);
1171     signal(SIGSEGV, sighandler);
1172 #ifdef SIGBUS
1173     signal(SIGBUS, sighandler);
1174 #endif
1175     return func_ptr();
1176 }
1177 EOF
1178 }
1179
1180 check_type(){
1181     log check_type "$@"
1182     headers=$1
1183     type=$2
1184     shift 2
1185     disable_safe "$type"
1186     check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
1187 }
1188
1189 check_struct(){
1190     log check_struct "$@"
1191     headers=$1
1192     struct=$2
1193     member=$3
1194     shift 3
1195     disable_safe "${struct}_${member}"
1196     check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
1197         enable_safe "${struct}_${member}"
1198 }
1199
1200 check_builtin(){
1201     log check_builtin "$@"
1202     name=$1
1203     headers=$2
1204     builtin=$3
1205     shift 3
1206     disable "$name"
1207     check_code ld "$headers" "$builtin" "cc" "$@" && enable "$name"
1208 }
1209
1210 check_compile_assert(){
1211     log check_compile_assert "$@"
1212     name=$1
1213     headers=$2
1214     condition=$3
1215     shift 3
1216     disable "$name"
1217     check_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
1218 }
1219
1220 require(){
1221     name="$1"
1222     header="$2"
1223     func="$3"
1224     shift 3
1225     check_lib $header $func "$@" || die "ERROR: $name not found"
1226 }
1227
1228 require2(){
1229     name="$1"
1230     headers="$2"
1231     func="$3"
1232     shift 3
1233     check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
1234 }
1235
1236 require_cpp(){
1237     name="$1"
1238     headers="$2"
1239     classes="$3"
1240     shift 3
1241     check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
1242 }
1243
1244 use_pkg_config(){
1245     pkg="$1"
1246     check_pkg_config "$@" || return 1
1247     add_cflags    $(get_safe "${pkg}_cflags")
1248     add_extralibs $(get_safe "${pkg}_libs")
1249 }
1250
1251 require_pkg_config(){
1252     use_pkg_config "$@" || die "ERROR: $pkg not found using pkg-config$pkg_config_fail_message"
1253 }
1254
1255 require_libfreetype(){
1256     log require_libfreetype "$@"
1257     pkg="freetype2"
1258     check_cmd $pkg_config --exists --print-errors $pkg \
1259       || die "ERROR: $pkg not found"
1260     pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
1261     pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
1262     {
1263         echo "#include <ft2build.h>"
1264         echo "#include FT_FREETYPE_H"
1265         echo "long check_func(void) { return (long) FT_Init_FreeType; }"
1266         echo "int main(void) { return 0; }"
1267     } | check_ld "cc" $pkg_cflags $pkg_libs \
1268       && set_safe "${pkg}_cflags" $pkg_cflags \
1269       && set_safe "${pkg}_libs"   $pkg_libs \
1270       || die "ERROR: $pkg not found"
1271     add_cflags    $(get_safe "${pkg}_cflags")
1272     add_extralibs $(get_safe "${pkg}_libs")
1273 }
1274
1275 hostcc_e(){
1276     eval printf '%s\\n' $HOSTCC_E
1277 }
1278
1279 hostcc_o(){
1280     eval printf '%s\\n' $HOSTCC_O
1281 }
1282
1283 check_host_cc(){
1284     log check_host_cc "$@"
1285     cat > $TMPC
1286     log_file $TMPC
1287     check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
1288 }
1289
1290 check_host_cpp(){
1291     log check_host_cpp "$@"
1292     cat > $TMPC
1293     log_file $TMPC
1294     check_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC
1295 }
1296
1297 check_host_cppflags(){
1298     log check_host_cppflags "$@"
1299     check_host_cc "$@" <<EOF && append host_cppflags "$@"
1300 int x;
1301 EOF
1302 }
1303
1304 check_host_cflags(){
1305     log check_host_cflags "$@"
1306     set -- $($host_cflags_filter "$@")
1307     check_host_cc "$@" <<EOF && append host_cflags "$@"
1308 int x;
1309 EOF
1310 }
1311
1312 check_host_cpp_condition(){
1313     log check_host_cpp_condition "$@"
1314     header=$1
1315     condition=$2
1316     shift 2
1317     check_host_cpp "$@" <<EOF
1318 #include <$header>
1319 #if !($condition)
1320 #error "unsatisfied condition: $condition"
1321 #endif
1322 EOF
1323 }
1324
1325 cp_if_changed(){
1326     cmp -s "$1" "$2" && echo "$2 is unchanged" && return
1327     mkdir -p "$(dirname $2)"
1328     $cp_f "$1" "$2"
1329 }
1330
1331 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
1332 # system-dependent things.
1333
1334 COMPONENT_LIST="
1335     bsfs
1336     decoders
1337     demuxers
1338     encoders
1339     filters
1340     hwaccels
1341     indevs
1342     muxers
1343     outdevs
1344     parsers
1345     protocols
1346 "
1347
1348 EXAMPLE_LIST="
1349     avio_reading_example
1350     avio_dir_cmd_example
1351     decoding_encoding_example
1352     demuxing_decoding_example
1353     extract_mvs_example
1354     filter_audio_example
1355     filtering_audio_example
1356     filtering_video_example
1357     metadata_example
1358     muxing_example
1359     qsvdec_example
1360     remuxing_example
1361     resampling_audio_example
1362     scaling_video_example
1363     transcode_aac_example
1364     transcoding_example
1365 "
1366
1367 EXTERNAL_LIBRARY_LIST="
1368     avisynth
1369     bzlib
1370     crystalhd
1371     decklink
1372     frei0r
1373     gnutls
1374     iconv
1375     ladspa
1376     libaacplus
1377     libass
1378     libbluray
1379     libbs2b
1380     libcaca
1381     libcdio
1382     libcelt
1383     libdc1394
1384     libdcadec
1385     libfaac
1386     libfdk_aac
1387     libflite
1388     libfontconfig
1389     libfreetype
1390     libfribidi
1391     libgme
1392     libgsm
1393     libiec61883
1394     libilbc
1395     libkvazaar
1396     libmfx
1397     libmodplug
1398     libmp3lame
1399     libnut
1400     libopencore_amrnb
1401     libopencore_amrwb
1402     libopencv
1403     libopenh264
1404     libopenjpeg
1405     libopus
1406     libpulse
1407     libquvi
1408     librtmp
1409     librubberband
1410     libschroedinger
1411     libshine
1412     libsmbclient
1413     libsnappy
1414     libsoxr
1415     libspeex
1416     libssh
1417     libstagefright_h264
1418     libtesseract
1419     libtheora
1420     libtwolame
1421     libutvideo
1422     libv4l2
1423     libvidstab
1424     libvo_aacenc
1425     libvo_amrwbenc
1426     libvorbis
1427     libvpx
1428     libwavpack
1429     libwebp
1430     libx264
1431     libx265
1432     libxavs
1433     libxcb
1434     libxcb_shm
1435     libxcb_shape
1436     libxcb_xfixes
1437     libxvid
1438     libzmq
1439     libzvbi
1440     lzma
1441     mmal
1442     nvenc
1443     openal
1444     opencl
1445     opengl
1446     openssl
1447     sdl
1448     securetransport
1449     x11grab
1450     xlib
1451     zlib
1452 "
1453
1454 DOCUMENT_LIST="
1455     doc
1456     htmlpages
1457     manpages
1458     podpages
1459     txtpages
1460 "
1461
1462 FEATURE_LIST="
1463     ftrapv
1464     gray
1465     hardcoded_tables
1466     runtime_cpudetect
1467     safe_bitstream_reader
1468     shared
1469     small
1470     static
1471     swscale_alpha
1472 "
1473
1474 HWACCEL_LIST="
1475     d3d11va
1476     dxva2
1477     vaapi
1478     vda
1479     vdpau
1480     videotoolbox
1481     xvmc
1482 "
1483
1484 LIBRARY_LIST="
1485     avcodec
1486     avdevice
1487     avfilter
1488     avformat
1489     avresample
1490     avutil
1491     postproc
1492     swresample
1493     swscale
1494 "
1495
1496 LICENSE_LIST="
1497     gpl
1498     nonfree
1499     version3
1500 "
1501
1502 PROGRAM_LIST="
1503     ffplay
1504     ffprobe
1505     ffserver
1506     ffmpeg
1507 "
1508
1509 SUBSYSTEM_LIST="
1510     dct
1511     dwt
1512     error_resilience
1513     faan
1514     fast_unaligned
1515     fft
1516     lsp
1517     lzo
1518     mdct
1519     pixelutils
1520     network
1521     rdft
1522 "
1523
1524 CONFIG_LIST="
1525     $COMPONENT_LIST
1526     $DOCUMENT_LIST
1527     $EXAMPLE_LIST
1528     $EXTERNAL_LIBRARY_LIST
1529     $FEATURE_LIST
1530     $HWACCEL_LIST
1531     $LICENSE_LIST
1532     $LIBRARY_LIST
1533     $PROGRAM_LIST
1534     $SUBSYSTEM_LIST
1535     fontconfig
1536     incompatible_libav_abi
1537     memalign_hack
1538     memory_poisoning
1539     neon_clobber_test
1540     pic
1541     pod2man
1542     raise_major
1543     thumb
1544     valgrind_backtrace
1545     xmm_clobber_test
1546 "
1547
1548 THREADS_LIST="
1549     pthreads
1550     os2threads
1551     w32threads
1552 "
1553
1554 ATOMICS_LIST="
1555     atomics_gcc
1556     atomics_suncc
1557     atomics_win32
1558 "
1559
1560 ARCH_LIST="
1561     aarch64
1562     alpha
1563     arm
1564     avr32
1565     avr32_ap
1566     avr32_uc
1567     bfin
1568     ia64
1569     m68k
1570     mips
1571     mips64
1572     parisc
1573     ppc
1574     ppc64
1575     s390
1576     sh4
1577     sparc
1578     sparc64
1579     tilegx
1580     tilepro
1581     tomi
1582     x86
1583     x86_32
1584     x86_64
1585 "
1586
1587 ARCH_EXT_LIST_ARM="
1588     armv5te
1589     armv6
1590     armv6t2
1591     armv8
1592     neon
1593     vfp
1594     vfpv3
1595     setend
1596 "
1597
1598 ARCH_EXT_LIST_MIPS="
1599     mipsfpu
1600     mips32r2
1601     mips32r5
1602     mips64r6
1603     mipsdspr1
1604     mipsdspr2
1605     msa
1606 "
1607
1608 ARCH_EXT_LIST_LOONGSON="
1609     loongson2
1610     loongson3
1611     mmi
1612 "
1613
1614 ARCH_EXT_LIST_X86_SIMD="
1615     amd3dnow
1616     amd3dnowext
1617     avx
1618     avx2
1619     fma3
1620     fma4
1621     mmx
1622     mmxext
1623     sse
1624     sse2
1625     sse3
1626     sse4
1627     sse42
1628     ssse3
1629     xop
1630 "
1631
1632 ARCH_EXT_LIST_PPC="
1633     altivec
1634     dcbzl
1635     ldbrx
1636     power8
1637     ppc4xx
1638     vsx
1639 "
1640
1641 ARCH_EXT_LIST_X86="
1642     $ARCH_EXT_LIST_X86_SIMD
1643     cpunop
1644     i686
1645 "
1646
1647 ARCH_EXT_LIST="
1648     $ARCH_EXT_LIST_ARM
1649     $ARCH_EXT_LIST_PPC
1650     $ARCH_EXT_LIST_X86
1651     $ARCH_EXT_LIST_MIPS
1652     $ARCH_EXT_LIST_LOONGSON
1653 "
1654
1655 ARCH_FEATURES="
1656     aligned_stack
1657     fast_64bit
1658     fast_clz
1659     fast_cmov
1660     local_aligned_8
1661     local_aligned_16
1662     local_aligned_32
1663     simd_align_16
1664 "
1665
1666 BUILTIN_LIST="
1667     atomic_cas_ptr
1668     atomic_compare_exchange
1669     machine_rw_barrier
1670     MemoryBarrier
1671     mm_empty
1672     rdtsc
1673     sarestart
1674     sync_val_compare_and_swap
1675 "
1676 HAVE_LIST_CMDLINE="
1677     inline_asm
1678     symver
1679     yasm
1680 "
1681
1682 HAVE_LIST_PUB="
1683     bigendian
1684     fast_unaligned
1685     incompatible_libav_abi
1686 "
1687
1688 HEADERS_LIST="
1689     alsa_asoundlib_h
1690     altivec_h
1691     arpa_inet_h
1692     asm_types_h
1693     cdio_paranoia_h
1694     cdio_paranoia_paranoia_h
1695     dev_bktr_ioctl_bt848_h
1696     dev_bktr_ioctl_meteor_h
1697     dev_ic_bt8xx_h
1698     dev_video_bktr_ioctl_bt848_h
1699     dev_video_meteor_ioctl_meteor_h
1700     direct_h
1701     dirent_h
1702     dlfcn_h
1703     d3d11_h
1704     dxva_h
1705     ES2_gl_h
1706     gsm_h
1707     io_h
1708     mach_mach_time_h
1709     machine_ioctl_bt848_h
1710     machine_ioctl_meteor_h
1711     malloc_h
1712     openjpeg_1_5_openjpeg_h
1713     OpenGL_gl3_h
1714     poll_h
1715     sndio_h
1716     soundcard_h
1717     sys_mman_h
1718     sys_param_h
1719     sys_resource_h
1720     sys_select_h
1721     sys_soundcard_h
1722     sys_time_h
1723     sys_un_h
1724     sys_videoio_h
1725     termios_h
1726     udplite_h
1727     unistd_h
1728     valgrind_valgrind_h
1729     windows_h
1730     winsock2_h
1731 "
1732
1733 INTRINSICS_LIST="
1734     intrinsics_neon
1735 "
1736
1737 MATH_FUNCS="
1738     atanf
1739     atan2f
1740     cbrt
1741     cbrtf
1742     copysign
1743     cosf
1744     erf
1745     exp2
1746     exp2f
1747     expf
1748     isinf
1749     isnan
1750     ldexpf
1751     llrint
1752     llrintf
1753     log2
1754     log2f
1755     log10f
1756     lrint
1757     lrintf
1758     powf
1759     rint
1760     round
1761     roundf
1762     sinf
1763     trunc
1764     truncf
1765 "
1766
1767 SYSTEM_FUNCS="
1768     access
1769     aligned_malloc
1770     clock_gettime
1771     closesocket
1772     CommandLineToArgvW
1773     CoTaskMemFree
1774     CryptGenRandom
1775     dlopen
1776     fcntl
1777     flt_lim
1778     fork
1779     getaddrinfo
1780     gethrtime
1781     getopt
1782     GetProcessAffinityMask
1783     GetProcessMemoryInfo
1784     GetProcessTimes
1785     getrusage
1786     getservbyport
1787     GetSystemTimeAsFileTime
1788     gettimeofday
1789     glob
1790     glXGetProcAddress
1791     gmtime_r
1792     inet_aton
1793     isatty
1794     jack_port_get_latency_range
1795     kbhit
1796     localtime_r
1797     lstat
1798     lzo1x_999_compress
1799     mach_absolute_time
1800     MapViewOfFile
1801     memalign
1802     mkstemp
1803     mmap
1804     mprotect
1805     nanosleep
1806     PeekNamedPipe
1807     posix_memalign
1808     pthread_cancel
1809     sched_getaffinity
1810     SetConsoleTextAttribute
1811     SetConsoleCtrlHandler
1812     setmode
1813     setrlimit
1814     Sleep
1815     strerror_r
1816     sysconf
1817     sysctl
1818     usleep
1819     VirtualAlloc
1820     wglGetProcAddress
1821 "
1822
1823 TOOLCHAIN_FEATURES="
1824     as_dn_directive
1825     as_func
1826     as_object_arch
1827     asm_mod_q
1828     attribute_may_alias
1829     attribute_packed
1830     ebp_available
1831     ebx_available
1832     gnu_as
1833     gnu_windres
1834     ibm_asm
1835     inline_asm_labels
1836     inline_asm_nonlocal_labels
1837     inline_asm_direct_symbol_refs
1838     pragma_deprecated
1839     rsync_contimeout
1840     symver_asm_label
1841     symver_gnu_asm
1842     vfp_args
1843     xform_asm
1844     xmm_clobbers
1845 "
1846
1847 TYPES_LIST="
1848     CONDITION_VARIABLE_Ptr
1849     socklen_t
1850     struct_addrinfo
1851     struct_dcadec_exss_info_matrix_encoding
1852     struct_group_source_req
1853     struct_ip_mreq_source
1854     struct_ipv6_mreq
1855     struct_pollfd
1856     struct_rusage_ru_maxrss
1857     struct_sctp_event_subscribe
1858     struct_sockaddr_in6
1859     struct_sockaddr_sa_len
1860     struct_sockaddr_storage
1861     struct_stat_st_mtim_tv_nsec
1862     struct_v4l2_frmivalenum_discrete
1863 "
1864
1865 HAVE_LIST="
1866     $ARCH_EXT_LIST
1867     $(add_suffix _external $ARCH_EXT_LIST)
1868     $(add_suffix _inline   $ARCH_EXT_LIST)
1869     $ARCH_FEATURES
1870     $ATOMICS_LIST
1871     $BUILTIN_LIST
1872     $HAVE_LIST_CMDLINE
1873     $HAVE_LIST_PUB
1874     $HEADERS_LIST
1875     $INTRINSICS_LIST
1876     $MATH_FUNCS
1877     $SYSTEM_FUNCS
1878     $THREADS_LIST
1879     $TOOLCHAIN_FEATURES
1880     $TYPES_LIST
1881     atomics_native
1882     dos_paths
1883     dxva2api_cobj
1884     dxva2_lib
1885     libc_msvcrt
1886     libdc1394_1
1887     libdc1394_2
1888     makeinfo
1889     makeinfo_html
1890     perl
1891     pod2man
1892     sdl
1893     section_data_rel_ro
1894     texi2html
1895     threads
1896     vaapi_x11
1897     vdpau_x11
1898     xlib
1899 "
1900
1901 # options emitted with CONFIG_ prefix but not available on the command line
1902 CONFIG_EXTRA="
1903     aandcttables
1904     ac3dsp
1905     audio_frame_queue
1906     audiodsp
1907     blockdsp
1908     bswapdsp
1909     cabac
1910     dvprofile
1911     exif
1912     faandct
1913     faanidct
1914     fdctdsp
1915     flacdsp
1916     fmtconvert
1917     frame_thread_encoder
1918     g722dsp
1919     gcrypt
1920     gmp
1921     golomb
1922     gplv3
1923     h263dsp
1924     h264chroma
1925     h264dsp
1926     h264pred
1927     h264qpel
1928     hpeldsp
1929     huffman
1930     huffyuvdsp
1931     huffyuvencdsp
1932     idctdsp
1933     iirfilter
1934     imdct15
1935     intrax8
1936     ividsp
1937     jpegtables
1938     libx262
1939     lgplv3
1940     llauddsp
1941     llviddsp
1942     lpc
1943     lzf
1944     me_cmp
1945     mpeg_er
1946     mpegaudio
1947     mpegaudiodsp
1948     mpegvideo
1949     mpegvideoenc
1950     mss34dsp
1951     pixblockdsp
1952     qpeldsp
1953     qsv
1954     qsvdec
1955     qsvenc
1956     rangecoder
1957     riffdec
1958     riffenc
1959     rtpdec
1960     rtpenc_chain
1961     rv34dsp
1962     sinewin
1963     snappy
1964     startcode
1965     texturedsp
1966     texturedspenc
1967     tpeldsp
1968     videodsp
1969     vp3dsp
1970     vp56dsp
1971     vp8dsp
1972     wma_freqs
1973     wmv2dsp
1974 "
1975
1976 CMDLINE_SELECT="
1977     $ARCH_EXT_LIST
1978     $CONFIG_LIST
1979     $HAVE_LIST_CMDLINE
1980     $THREADS_LIST
1981     asm
1982     cross_compile
1983     debug
1984     extra_warnings
1985     logging
1986     lto
1987     optimizations
1988     rpath
1989     stripping
1990 "
1991
1992 PATHS_LIST="
1993     bindir
1994     datadir
1995     docdir
1996     incdir
1997     libdir
1998     mandir
1999     pkgconfigdir
2000     prefix
2001     shlibdir
2002 "
2003
2004 CMDLINE_SET="
2005     $PATHS_LIST
2006     ar
2007     arch
2008     as
2009     assert_level
2010     build_suffix
2011     cc
2012     cpu
2013     cross_prefix
2014     cxx
2015     dep_cc
2016     doxygen
2017     env
2018     extra_version
2019     gas
2020     host_cc
2021     host_cflags
2022     host_ld
2023     host_ldflags
2024     host_libs
2025     host_os
2026     install
2027     ld
2028     logfile
2029     malloc_prefix
2030     nm
2031     optflags
2032     pkg_config
2033     pkg_config_flags
2034     progs_suffix
2035     random_seed
2036     ranlib
2037     samples
2038     strip
2039     sws_max_filter_size
2040     sysinclude
2041     sysroot
2042     target_exec
2043     target_os
2044     target_path
2045     target_samples
2046     tempprefix
2047     toolchain
2048     valgrind
2049     yasmexe
2050 "
2051
2052 CMDLINE_APPEND="
2053     extra_cflags
2054     extra_cxxflags
2055     host_cppflags
2056 "
2057
2058 # code dependency declarations
2059
2060 # architecture extensions
2061
2062 armv5te_deps="arm"
2063 armv6_deps="arm"
2064 armv6t2_deps="arm"
2065 armv8_deps="aarch64"
2066 neon_deps_any="aarch64 arm"
2067 intrinsics_neon_deps="neon"
2068 vfp_deps_any="aarch64 arm"
2069 vfpv3_deps="vfp"
2070 setend_deps="arm"
2071
2072 map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
2073
2074 mipsfpu_deps="mips"
2075 mipsdspr1_deps="mips"
2076 mipsdspr2_deps="mips"
2077 mips32r2_deps="mips"
2078 mips32r5_deps="mips"
2079 mips64r6_deps="mips"
2080 msa_deps="mips"
2081 mmi_deps="mips"
2082
2083 altivec_deps="ppc"
2084 dcbzl_deps="ppc"
2085 ldbrx_deps="ppc"
2086 ppc4xx_deps="ppc"
2087 vsx_deps="altivec"
2088 power8_deps="vsx"
2089
2090 cpunop_deps="i686"
2091 x86_64_select="i686"
2092 x86_64_suggest="fast_cmov"
2093
2094 amd3dnow_deps="mmx"
2095 amd3dnowext_deps="amd3dnow"
2096 i686_deps="x86"
2097 mmx_deps="x86"
2098 mmxext_deps="mmx"
2099 sse_deps="mmxext"
2100 sse2_deps="sse"
2101 sse3_deps="sse2"
2102 ssse3_deps="sse3"
2103 sse4_deps="ssse3"
2104 sse42_deps="sse4"
2105 avx_deps="sse42"
2106 xop_deps="avx"
2107 fma3_deps="avx"
2108 fma4_deps="avx"
2109 avx2_deps="avx"
2110
2111 mmx_external_deps="yasm"
2112 mmx_inline_deps="inline_asm"
2113 mmx_suggest="mmx_external mmx_inline"
2114
2115 for ext in $(filter_out mmx $ARCH_EXT_LIST_X86_SIMD); do
2116     eval dep=\$${ext}_deps
2117     eval ${ext}_external_deps='"${dep}_external"'
2118     eval ${ext}_inline_deps='"${dep}_inline"'
2119     eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
2120 done
2121
2122 aligned_stack_if_any="aarch64 ppc x86"
2123 fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
2124 fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
2125 fast_unaligned_if_any="aarch64 ppc x86"
2126 simd_align_16_if_any="altivec neon sse"
2127
2128 # system capabilities
2129 symver_if_any="symver_asm_label symver_gnu_asm"
2130 valgrind_backtrace_deps="!optimizations valgrind_valgrind_h"
2131
2132 # threading support
2133 atomics_gcc_if_any="sync_val_compare_and_swap atomic_compare_exchange"
2134 atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
2135 atomics_win32_if="MemoryBarrier"
2136 atomics_native_if_any="$ATOMICS_LIST"
2137 w32threads_deps="atomics_native"
2138 threads_if_any="$THREADS_LIST"
2139
2140 # subsystems
2141 dct_select="rdft"
2142 error_resilience_select="me_cmp"
2143 faandct_deps="faan fdctdsp"
2144 faanidct_deps="faan idctdsp"
2145 frame_thread_encoder_deps="encoders threads"
2146 intrax8_select="error_resilience"
2147 mdct_select="fft"
2148 rdft_select="fft"
2149 me_cmp_select="fdctdsp idctdsp pixblockdsp"
2150 mpeg_er_select="error_resilience"
2151 mpegaudio_select="mpegaudiodsp"
2152 mpegaudiodsp_select="dct"
2153 mpegvideo_select="blockdsp h264chroma hpeldsp idctdsp me_cmp mpeg_er videodsp"
2154 mpegvideoenc_select="me_cmp mpegvideo pixblockdsp qpeldsp"
2155 qsvdec_select="qsv"
2156 qsvenc_select="qsv"
2157
2158 # decoders / encoders
2159 aac_decoder_select="imdct15 mdct sinewin"
2160 aac_fixed_decoder_select="mdct sinewin"
2161 aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin"
2162 aac_latm_decoder_select="aac_decoder aac_latm_parser"
2163 ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert mdct"
2164 ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp mdct"
2165 ac3_encoder_select="ac3dsp audiodsp mdct me_cmp"
2166 ac3_fixed_encoder_select="ac3dsp audiodsp mdct me_cmp"
2167 adpcm_g722_decoder_select="g722dsp"
2168 adpcm_g722_encoder_select="g722dsp"
2169 aic_decoder_select="golomb idctdsp"
2170 alac_encoder_select="lpc"
2171 als_decoder_select="bswapdsp"
2172 amrnb_decoder_select="lsp"
2173 amrwb_decoder_select="lsp"
2174 amv_decoder_select="sp5x_decoder exif"
2175 amv_encoder_select="aandcttables jpegtables mpegvideoenc"
2176 ape_decoder_select="bswapdsp llauddsp"
2177 apng_decoder_select="zlib"
2178 apng_encoder_select="huffyuvencdsp zlib"
2179 asv1_decoder_select="blockdsp bswapdsp idctdsp"
2180 asv1_encoder_select="bswapdsp fdctdsp pixblockdsp"
2181 asv2_decoder_select="blockdsp bswapdsp idctdsp"
2182 asv2_encoder_select="bswapdsp fdctdsp pixblockdsp"
2183 atrac1_decoder_select="mdct sinewin"
2184 atrac3_decoder_select="mdct"
2185 atrac3p_decoder_select="mdct sinewin"
2186 avrn_decoder_select="exif jpegtables"
2187 bink_decoder_select="blockdsp hpeldsp"
2188 binkaudio_dct_decoder_select="mdct rdft dct sinewin wma_freqs"
2189 binkaudio_rdft_decoder_select="mdct rdft sinewin wma_freqs"
2190 cavs_decoder_select="blockdsp golomb h264chroma idctdsp qpeldsp videodsp"
2191 cllc_decoder_select="bswapdsp"
2192 comfortnoise_encoder_select="lpc"
2193 cook_decoder_select="audiodsp mdct sinewin"
2194 cscd_decoder_select="lzo"
2195 cscd_decoder_suggest="zlib"
2196 dca_decoder_select="fmtconvert mdct"
2197 dds_decoder_select="texturedsp"
2198 dirac_decoder_select="dwt golomb videodsp mpegvideoenc"
2199 dnxhd_decoder_select="blockdsp idctdsp"
2200 dnxhd_encoder_select="aandcttables blockdsp fdctdsp idctdsp mpegvideoenc pixblockdsp"
2201 dvvideo_decoder_select="dvprofile idctdsp"
2202 dvvideo_encoder_select="dvprofile fdctdsp me_cmp pixblockdsp"
2203 dxa_decoder_select="zlib"
2204 dxv_decoder_select="lzf texturedsp"
2205 eac3_decoder_select="ac3_decoder"
2206 eac3_encoder_select="ac3_encoder"
2207 eamad_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpegvideo"
2208 eatgq_decoder_select="aandcttables"
2209 eatqi_decoder_select="aandcttables blockdsp bswapdsp idctdsp mpeg1video_decoder"
2210 exr_decoder_select="zlib"
2211 ffv1_decoder_select="golomb rangecoder"
2212 ffv1_encoder_select="rangecoder"
2213 ffvhuff_decoder_select="huffyuv_decoder"
2214 ffvhuff_encoder_select="huffyuv_encoder"
2215 fic_decoder_select="golomb"
2216 flac_decoder_select="flacdsp golomb"
2217 flac_encoder_select="bswapdsp flacdsp golomb lpc"
2218 flashsv_decoder_select="zlib"
2219 flashsv_encoder_select="zlib"
2220 flashsv2_encoder_select="zlib"
2221 flashsv2_decoder_select="zlib"
2222 flv_decoder_select="h263_decoder"
2223 flv_encoder_select="h263_encoder"
2224 fourxm_decoder_select="blockdsp bswapdsp"
2225 fraps_decoder_select="bswapdsp huffman"
2226 g2m_decoder_select="blockdsp idctdsp jpegtables zlib"
2227 g729_decoder_select="audiodsp"
2228 h261_decoder_select="mpegvideo"
2229 h261_encoder_select="aandcttables mpegvideoenc"
2230 h263_decoder_select="h263_parser h263dsp mpegvideo qpeldsp"
2231 h263_encoder_select="aandcttables h263dsp mpegvideoenc"
2232 h263i_decoder_select="h263_decoder"
2233 h263p_decoder_select="h263_decoder"
2234 h263p_encoder_select="h263_encoder"
2235 h264_decoder_select="cabac golomb h264chroma h264dsp h264pred h264qpel startcode videodsp"
2236 h264_decoder_suggest="error_resilience"
2237 h264_qsv_decoder_deps="libmfx"
2238 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec h264_qsv_hwaccel"
2239 h264_qsv_encoder_deps="libmfx"
2240 h264_qsv_encoder_select="qsvenc"
2241 hap_decoder_select="snappy texturedsp"
2242 hap_encoder_deps="libsnappy"
2243 hap_encoder_select="texturedspenc"
2244 hevc_decoder_select="bswapdsp cabac golomb videodsp"
2245 hevc_qsv_encoder_deps="libmfx"
2246 hevc_qsv_decoder_deps="libmfx"
2247 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec hevc_qsv_hwaccel"
2248 hevc_qsv_encoder_select="qsvenc"
2249 huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
2250 huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llviddsp"
2251 iac_decoder_select="imc_decoder"
2252 imc_decoder_select="bswapdsp fft mdct sinewin"
2253 indeo3_decoder_select="hpeldsp"
2254 indeo4_decoder_select="ividsp"
2255 indeo5_decoder_select="ividsp"
2256 interplay_video_decoder_select="hpeldsp"
2257 jpegls_decoder_select="golomb mjpeg_decoder"
2258 jpegls_encoder_select="golomb"
2259 jv_decoder_select="blockdsp"
2260 lagarith_decoder_select="huffyuvdsp"
2261 ljpeg_encoder_select="aandcttables idctdsp jpegtables"
2262 loco_decoder_select="golomb"
2263 mdec_decoder_select="blockdsp idctdsp mpegvideo"
2264 metasound_decoder_select="lsp mdct sinewin"
2265 mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
2266 mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables"
2267 mjpeg_encoder_select="aandcttables jpegtables mpegvideoenc"
2268 mjpegb_decoder_select="mjpeg_decoder"
2269 mlp_decoder_select="mlp_parser"
2270 motionpixels_decoder_select="bswapdsp"
2271 mp1_decoder_select="mpegaudio"
2272 mp1float_decoder_select="mpegaudio"
2273 mp2_decoder_select="mpegaudio"
2274 mp2float_decoder_select="mpegaudio"
2275 mp3_decoder_select="mpegaudio"
2276 mp3adu_decoder_select="mpegaudio"
2277 mp3adufloat_decoder_select="mpegaudio"
2278 mp3float_decoder_select="mpegaudio"
2279 mp3on4_decoder_select="mpegaudio"
2280 mp3on4float_decoder_select="mpegaudio"
2281 mpc7_decoder_select="bswapdsp mpegaudiodsp"
2282 mpc8_decoder_select="mpegaudiodsp"
2283 mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
2284 mpeg_xvmc_decoder_select="mpeg2video_decoder"
2285 mpegvideo_decoder_select="mpegvideo"
2286 mpeg1video_decoder_select="mpegvideo"
2287 mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp"
2288 mpeg2video_decoder_select="mpegvideo"
2289 mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp"
2290 mpeg2_qsv_decoder_deps="libmfx"
2291 mpeg2_qsv_decoder_select="qsvdec mpeg2_qsv_hwaccel"
2292 mpeg2_qsv_encoder_deps="libmfx"
2293 mpeg2_qsv_encoder_select="qsvenc"
2294 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
2295 mpeg4_encoder_select="h263_encoder"
2296 msa1_decoder_select="mss34dsp"
2297 msmpeg4v1_decoder_select="h263_decoder"
2298 msmpeg4v2_decoder_select="h263_decoder"
2299 msmpeg4v2_encoder_select="h263_encoder"
2300 msmpeg4v3_decoder_select="h263_decoder"
2301 msmpeg4v3_encoder_select="h263_encoder"
2302 mss2_decoder_select="vc1_decoder"
2303 mts2_decoder_select="mss34dsp"
2304 mxpeg_decoder_select="mjpeg_decoder"
2305 nellymoser_decoder_select="mdct sinewin"
2306 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
2307 nuv_decoder_select="idctdsp lzo"
2308 on2avc_decoder_select="mdct"
2309 opus_decoder_deps="swresample"
2310 opus_decoder_select="imdct15"
2311 png_decoder_select="zlib"
2312 png_encoder_select="huffyuvencdsp zlib"
2313 prores_decoder_select="blockdsp idctdsp"
2314 prores_encoder_select="fdctdsp"
2315 qcelp_decoder_select="lsp"
2316 qdm2_decoder_select="mdct rdft mpegaudiodsp"
2317 ra_144_encoder_select="audio_frame_queue lpc audiodsp"
2318 ra_144_decoder_select="audiodsp"
2319 ralf_decoder_select="golomb"
2320 rawvideo_decoder_select="bswapdsp"
2321 rtjpeg_decoder_select="me_cmp"
2322 rv10_decoder_select="h263_decoder"
2323 rv10_encoder_select="h263_encoder"
2324 rv20_decoder_select="h263_decoder"
2325 rv20_encoder_select="h263_encoder"
2326 rv30_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
2327 rv40_decoder_select="golomb h264pred h264qpel mpegvideo rv34dsp"
2328 shorten_decoder_select="golomb"
2329 sipr_decoder_select="lsp"
2330 snow_decoder_select="dwt h264qpel hpeldsp me_cmp rangecoder videodsp"
2331 snow_encoder_select="aandcttables dwt h264qpel hpeldsp me_cmp mpegvideoenc rangecoder"
2332 sonic_decoder_select="golomb rangecoder"
2333 sonic_encoder_select="golomb rangecoder"
2334 sonic_ls_encoder_select="golomb rangecoder"
2335 sp5x_decoder_select="mjpeg_decoder"
2336 svq1_decoder_select="hpeldsp"
2337 svq1_encoder_select="aandcttables hpeldsp me_cmp mpegvideoenc"
2338 svq3_decoder_select="h264_decoder hpeldsp tpeldsp"
2339 svq3_decoder_suggest="zlib"
2340 tak_decoder_select="audiodsp"
2341 tdsc_decoder_select="zlib mjpeg_decoder"
2342 theora_decoder_select="vp3_decoder"
2343 thp_decoder_select="mjpeg_decoder"
2344 tiff_decoder_suggest="zlib lzma"
2345 tiff_encoder_suggest="zlib"
2346 truehd_decoder_select="mlp_parser"
2347 truemotion2_decoder_select="bswapdsp"
2348 truespeech_decoder_select="bswapdsp"
2349 tscc_decoder_select="zlib"
2350 twinvq_decoder_select="mdct lsp sinewin"
2351 txd_decoder_select="texturedsp"
2352 utvideo_decoder_select="bswapdsp"
2353 utvideo_encoder_select="bswapdsp huffman huffyuvencdsp"
2354 vble_decoder_select="huffyuvdsp"
2355 vc1_decoder_select="blockdsp h263_decoder h264qpel intrax8 qpeldsp startcode"
2356 vc1image_decoder_select="vc1_decoder"
2357 vc1_qsv_decoder_deps="libmfx"
2358 vc1_qsv_decoder_select="qsvdec vc1_qsv_hwaccel"
2359 vorbis_decoder_select="mdct"
2360 vorbis_encoder_select="mdct"
2361 vp3_decoder_select="hpeldsp vp3dsp videodsp"
2362 vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
2363 vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp vp56dsp"
2364 vp6a_decoder_select="vp6_decoder"
2365 vp6f_decoder_select="vp6_decoder"
2366 vp7_decoder_select="h264pred videodsp vp8dsp"
2367 vp8_decoder_select="h264pred videodsp vp8dsp"
2368 vp9_decoder_select="videodsp vp9_parser"
2369 webp_decoder_select="vp8_decoder"
2370 wmalossless_decoder_select="llauddsp"
2371 wmapro_decoder_select="mdct sinewin wma_freqs"
2372 wmav1_decoder_select="mdct sinewin wma_freqs"
2373 wmav1_encoder_select="mdct sinewin wma_freqs"
2374 wmav2_decoder_select="mdct sinewin wma_freqs"
2375 wmav2_encoder_select="mdct sinewin wma_freqs"
2376 wmavoice_decoder_select="lsp rdft dct mdct sinewin"
2377 wmv1_decoder_select="h263_decoder"
2378 wmv1_encoder_select="h263_encoder"
2379 wmv2_decoder_select="blockdsp h263_decoder idctdsp intrax8 videodsp wmv2dsp"
2380 wmv2_encoder_select="h263_encoder wmv2dsp"
2381 wmv3_decoder_select="vc1_decoder"
2382 wmv3image_decoder_select="wmv3_decoder"
2383 zerocodec_decoder_select="zlib"
2384 zlib_decoder_select="zlib"
2385 zlib_encoder_select="zlib"
2386 zmbv_decoder_select="zlib"
2387 zmbv_encoder_select="zlib"
2388
2389 # hardware accelerators
2390 crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
2391 d3d11va_deps="d3d11_h dxva_h ID3D11VideoDecoder ID3D11VideoContext"
2392 dxva2_deps="dxva2api_h DXVA2_ConfigPictureDecode"
2393 vaapi_deps="va_va_h"
2394 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads CoreServices_CoreServices_h"
2395 vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore -framework CoreServices"
2396 vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
2397 videotoolbox_deps="VideoToolbox_VideoToolbox_h pthreads CoreServices_CoreServices_h"
2398 videotoolbox_extralibs="-framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework QuartzCore -framework CoreServices"
2399 xvmc_deps="X11_extensions_XvMClib_h"
2400
2401 h263_vaapi_hwaccel_deps="vaapi"
2402 h263_vaapi_hwaccel_select="h263_decoder"
2403 h263_vdpau_hwaccel_deps="vdpau"
2404 h263_vdpau_hwaccel_select="h263_decoder"
2405 h263_videotoolbox_hwaccel_deps="videotoolbox"
2406 h263_videotoolbox_hwaccel_select="h263_decoder"
2407 h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
2408 h264_d3d11va_hwaccel_deps="d3d11va"
2409 h264_d3d11va_hwaccel_select="h264_decoder"
2410 h264_dxva2_hwaccel_deps="dxva2"
2411 h264_dxva2_hwaccel_select="h264_decoder"
2412 h264_mmal_decoder_deps="mmal"
2413 h264_mmal_hwaccel_deps="mmal"
2414 h264_mmal_decoder_select="h264_decoder"
2415 h264_mmal_encoder_deps="mmal"
2416 h264_qsv_hwaccel_deps="libmfx"
2417 h264_vaapi_hwaccel_deps="vaapi"
2418 h264_vaapi_hwaccel_select="h264_decoder"
2419 h264_vda_decoder_deps="vda"
2420 h264_vda_decoder_select="h264_decoder"
2421 h264_vda_hwaccel_deps="vda"
2422 h264_vda_hwaccel_select="h264_decoder"
2423 h264_vda_old_hwaccel_deps="vda"
2424 h264_vda_old_hwaccel_select="h264_decoder"
2425 h264_vdpau_decoder_deps="vdpau"
2426 h264_vdpau_decoder_select="h264_decoder"
2427 h264_vdpau_hwaccel_deps="vdpau"
2428 h264_vdpau_hwaccel_select="h264_decoder"
2429 h264_videotoolbox_hwaccel_deps="videotoolbox"
2430 h264_videotoolbox_hwaccel_select="h264_decoder"
2431 hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2432 hevc_d3d11va_hwaccel_select="hevc_decoder"
2433 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
2434 hevc_dxva2_hwaccel_select="hevc_decoder"
2435 hevc_qsv_hwaccel_deps="libmfx"
2436 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
2437 hevc_vaapi_hwaccel_select="hevc_decoder"
2438 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
2439 hevc_vdpau_hwaccel_select="hevc_decoder"
2440 mpeg_vdpau_decoder_deps="vdpau"
2441 mpeg_vdpau_decoder_select="mpeg2video_decoder"
2442 mpeg_xvmc_hwaccel_deps="xvmc"
2443 mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
2444 mpeg1_vdpau_decoder_deps="vdpau"
2445 mpeg1_vdpau_decoder_select="mpeg1video_decoder"
2446 mpeg1_vdpau_hwaccel_deps="vdpau"
2447 mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
2448 mpeg1_videotoolbox_hwaccel_deps="videotoolbox"
2449 mpeg1_videotoolbox_hwaccel_select="mpeg1video_decoder"
2450 mpeg1_xvmc_hwaccel_deps="xvmc"
2451 mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
2452 mpeg2_crystalhd_decoder_select="crystalhd"
2453 mpeg2_d3d11va_hwaccel_deps="d3d11va"
2454 mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
2455 mpeg2_dxva2_hwaccel_deps="dxva2"
2456 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
2457 mpeg2_qsv_hwaccel_deps="libmfx"
2458 mpeg2_qsv_hwaccel_select="qsvdec_mpeg2"
2459 mpeg2_vaapi_hwaccel_deps="vaapi"
2460 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
2461 mpeg2_vdpau_hwaccel_deps="vdpau"
2462 mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
2463 mpeg2_videotoolbox_hwaccel_deps="videotoolbox"
2464 mpeg2_videotoolbox_hwaccel_select="mpeg2video_decoder"
2465 mpeg2_xvmc_hwaccel_deps="xvmc"
2466 mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
2467 mpeg4_crystalhd_decoder_select="crystalhd"
2468 mpeg4_vaapi_hwaccel_deps="vaapi"
2469 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
2470 mpeg4_vdpau_decoder_deps="vdpau"
2471 mpeg4_vdpau_decoder_select="mpeg4_decoder"
2472 mpeg4_vdpau_hwaccel_deps="vdpau"
2473 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
2474 mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
2475 mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
2476 msmpeg4_crystalhd_decoder_select="crystalhd"
2477 vc1_crystalhd_decoder_select="crystalhd"
2478 vc1_d3d11va_hwaccel_deps="d3d11va"
2479 vc1_d3d11va_hwaccel_select="vc1_decoder"
2480 vc1_dxva2_hwaccel_deps="dxva2"
2481 vc1_dxva2_hwaccel_select="vc1_decoder"
2482 vc1_vaapi_hwaccel_deps="vaapi"
2483 vc1_vaapi_hwaccel_select="vc1_decoder"
2484 vc1_vdpau_decoder_deps="vdpau"
2485 vc1_vdpau_decoder_select="vc1_decoder"
2486 vc1_vdpau_hwaccel_deps="vdpau"
2487 vc1_vdpau_hwaccel_select="vc1_decoder"
2488 vc1_qsv_hwaccel_deps="libmfx"
2489 vc1_qsv_hwaccel_select="qsvdec_vc1"
2490 wmv3_crystalhd_decoder_select="crystalhd"
2491 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
2492 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
2493 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
2494 wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
2495 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
2496
2497 # parsers
2498 h264_parser_select="h264_decoder"
2499 hevc_parser_select="golomb"
2500 mpegvideo_parser_select="mpegvideo"
2501 mpeg4video_parser_select="h263dsp mpegvideo qpeldsp"
2502 vc1_parser_select="mpegvideo startcode vc1_decoder"
2503
2504 # bitstream_filters
2505 mjpeg2jpeg_bsf_select="jpegtables"
2506
2507 # external libraries
2508 libaacplus_encoder_deps="libaacplus"
2509 libcelt_decoder_deps="libcelt"
2510 libdcadec_decoder_deps="libdcadec"
2511 libfaac_encoder_deps="libfaac"
2512 libfaac_encoder_select="audio_frame_queue"
2513 libfdk_aac_decoder_deps="libfdk_aac"
2514 libfdk_aac_encoder_deps="libfdk_aac"
2515 libfdk_aac_encoder_select="audio_frame_queue"
2516 libgme_demuxer_deps="libgme"
2517 libgsm_decoder_deps="libgsm"
2518 libgsm_encoder_deps="libgsm"
2519 libgsm_ms_decoder_deps="libgsm"
2520 libgsm_ms_encoder_deps="libgsm"
2521 libilbc_decoder_deps="libilbc"
2522 libilbc_encoder_deps="libilbc"
2523 libkvazaar_encoder_deps="libkvazaar"
2524 libmodplug_demuxer_deps="libmodplug"
2525 libmp3lame_encoder_deps="libmp3lame"
2526 libmp3lame_encoder_select="audio_frame_queue"
2527 libopencore_amrnb_decoder_deps="libopencore_amrnb"
2528 libopencore_amrnb_encoder_deps="libopencore_amrnb"
2529 libopencore_amrnb_encoder_select="audio_frame_queue"
2530 libopencore_amrwb_decoder_deps="libopencore_amrwb"
2531 libopenh264_encoder_deps="libopenh264"
2532 libopenjpeg_decoder_deps="libopenjpeg"
2533 libopenjpeg_encoder_deps="libopenjpeg"
2534 libopus_decoder_deps="libopus"
2535 libopus_encoder_deps="libopus"
2536 libopus_encoder_select="audio_frame_queue"
2537 libquvi_demuxer_deps="libquvi"
2538 libschroedinger_decoder_deps="libschroedinger"
2539 libschroedinger_encoder_deps="libschroedinger"
2540 libshine_encoder_deps="libshine"
2541 libshine_encoder_select="audio_frame_queue"
2542 libspeex_decoder_deps="libspeex"
2543 libspeex_encoder_deps="libspeex"
2544 libspeex_encoder_select="audio_frame_queue"
2545 libstagefright_h264_decoder_deps="libstagefright_h264"
2546 libtheora_encoder_deps="libtheora"
2547 libtwolame_encoder_deps="libtwolame"
2548 libvo_aacenc_encoder_deps="libvo_aacenc"
2549 libvo_aacenc_encoder_select="audio_frame_queue"
2550 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
2551 libvorbis_decoder_deps="libvorbis"
2552 libvorbis_encoder_deps="libvorbis"
2553 libvorbis_encoder_select="audio_frame_queue"
2554 libvpx_vp8_decoder_deps="libvpx"
2555 libvpx_vp8_encoder_deps="libvpx"
2556 libvpx_vp9_decoder_deps="libvpx"
2557 libvpx_vp9_encoder_deps="libvpx"
2558 libwavpack_encoder_deps="libwavpack"
2559 libwebp_encoder_deps="libwebp"
2560 libwebp_anim_encoder_deps="libwebp"
2561 libx262_encoder_deps="libx262"
2562 libx264_encoder_deps="libx264"
2563 libx264rgb_encoder_deps="libx264"
2564 libx264rgb_encoder_select="libx264_encoder"
2565 libx265_encoder_deps="libx265"
2566 libxavs_encoder_deps="libxavs"
2567 libxvid_encoder_deps="libxvid"
2568 libutvideo_decoder_deps="libutvideo"
2569 libutvideo_encoder_deps="libutvideo"
2570 libzvbi_teletext_decoder_deps="libzvbi"
2571 nvenc_encoder_deps="nvenc"
2572 nvenc_h264_encoder_deps="nvenc"
2573 nvenc_hevc_encoder_deps="nvenc"
2574
2575 # demuxers / muxers
2576 ac3_demuxer_select="ac3_parser"
2577 asf_demuxer_select="riffdec"
2578 asf_o_demuxer_select="riffdec"
2579 asf_muxer_select="riffenc"
2580 asf_stream_muxer_select="asf_muxer"
2581 avi_demuxer_select="riffdec exif"
2582 avi_muxer_select="riffenc"
2583 avisynth_demuxer_deps="avisynth"
2584 avisynth_demuxer_select="riffdec"
2585 caf_demuxer_select="riffdec"
2586 dash_muxer_select="mp4_muxer"
2587 dirac_demuxer_select="dirac_parser"
2588 dts_demuxer_select="dca_parser"
2589 dtshd_demuxer_select="dca_parser"
2590 dv_demuxer_select="dvprofile"
2591 dv_muxer_select="dvprofile"
2592 dxa_demuxer_select="riffdec"
2593 eac3_demuxer_select="ac3_parser"
2594 f4v_muxer_select="mov_muxer"
2595 flac_demuxer_select="flac_parser"
2596 hds_muxer_select="flv_muxer"
2597 hls_muxer_select="mpegts_muxer"
2598 image2_alias_pix_demuxer_select="image2_demuxer"
2599 image2_brender_pix_demuxer_select="image2_demuxer"
2600 ipod_muxer_select="mov_muxer"
2601 ismv_muxer_select="mov_muxer"
2602 libnut_demuxer_deps="libnut"
2603 libnut_muxer_deps="libnut"
2604 matroska_audio_muxer_select="matroska_muxer"
2605 matroska_demuxer_select="riffdec"
2606 matroska_demuxer_suggest="bzlib lzo zlib"
2607 matroska_muxer_select="riffenc"
2608 mmf_muxer_select="riffenc"
2609 mov_demuxer_select="riffdec"
2610 mov_demuxer_suggest="zlib"
2611 mov_muxer_select="riffenc rtpenc_chain"
2612 mp3_demuxer_select="mpegaudio_parser"
2613 mp4_muxer_select="mov_muxer"
2614 mpegts_muxer_select="adts_muxer latm_muxer"
2615 mpegtsraw_demuxer_select="mpegts_demuxer"
2616 mxf_d10_muxer_select="mxf_muxer"
2617 mxf_opatom_muxer_select="mxf_muxer"
2618 nut_muxer_select="riffenc"
2619 nuv_demuxer_select="riffdec"
2620 oga_muxer_select="ogg_muxer"
2621 ogg_demuxer_select="golomb"
2622 opus_muxer_select="ogg_muxer"
2623 psp_muxer_select="mov_muxer"
2624 rtp_demuxer_select="sdp_demuxer"
2625 rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol"
2626 rtsp_demuxer_select="http_protocol rtpdec"
2627 rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
2628 sap_demuxer_select="sdp_demuxer"
2629 sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
2630 sdp_demuxer_select="rtpdec"
2631 smoothstreaming_muxer_select="ismv_muxer"
2632 spdif_muxer_select="aac_parser"
2633 spx_muxer_select="ogg_muxer"
2634 tak_demuxer_select="tak_parser"
2635 tg2_muxer_select="mov_muxer"
2636 tgp_muxer_select="mov_muxer"
2637 vobsub_demuxer_select="mpegps_demuxer"
2638 w64_demuxer_select="wav_demuxer"
2639 w64_muxer_select="wav_muxer"
2640 wav_demuxer_select="riffdec"
2641 wav_muxer_select="riffenc"
2642 webm_muxer_select="riffenc"
2643 wtv_demuxer_select="riffdec"
2644 wtv_muxer_select="riffenc"
2645 xmv_demuxer_select="riffdec"
2646 xwma_demuxer_select="riffdec"
2647
2648 # indevs / outdevs
2649 alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
2650 alsa_outdev_deps="alsa_asoundlib_h"
2651 avfoundation_indev_extralibs="-framework CoreVideo -framework Foundation -framework AVFoundation -framework CoreMedia"
2652 avfoundation_indev_select="avfoundation"
2653 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
2654 caca_outdev_deps="libcaca"
2655 decklink_outdev_deps="decklink pthreads"
2656 decklink_outdev_extralibs="-lstdc++"
2657 decklink_indev_deps="decklink pthreads"
2658 decklink_indev_extralibs="-lstdc++"
2659 dshow_indev_deps="IBaseFilter"
2660 dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi"
2661 dv1394_indev_deps="dv1394"
2662 dv1394_indev_select="dv_demuxer"
2663 fbdev_indev_deps="linux_fb_h"
2664 fbdev_outdev_deps="linux_fb_h"
2665 gdigrab_indev_deps="CreateDIBSection"
2666 gdigrab_indev_extralibs="-lgdi32"
2667 gdigrab_indev_select="bmp_decoder"
2668 iec61883_indev_deps="libiec61883"
2669 jack_indev_deps="jack_jack_h sem_timedwait"
2670 lavfi_indev_deps="avfilter"
2671 libcdio_indev_deps="libcdio"
2672 libdc1394_indev_deps="libdc1394"
2673 libv4l2_indev_deps="libv4l2"
2674 openal_indev_deps="openal"
2675 opengl_outdev_deps="opengl"
2676 oss_indev_deps_any="soundcard_h sys_soundcard_h"
2677 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
2678 pulse_indev_deps="libpulse"
2679 pulse_outdev_deps="libpulse"
2680 qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework QuartzCore"
2681 qtkit_indev_select="qtkit"
2682 sdl_outdev_deps="sdl"
2683 sndio_indev_deps="sndio_h"
2684 sndio_outdev_deps="sndio_h"
2685 v4l_indev_deps="linux_videodev_h"
2686 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
2687 v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
2688 vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
2689 vfwcap_indev_extralibs="-lavicap32"
2690 xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
2691 xv_outdev_extralibs="-lXv -lX11 -lXext"
2692 x11grab_indev_deps="x11grab"
2693 x11grab_xcb_indev_deps="libxcb"
2694
2695 # protocols
2696 async_protocol_deps="pthreads"
2697 bluray_protocol_deps="libbluray"
2698 ffrtmpcrypt_protocol_deps="!librtmp_protocol"
2699 ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl"
2700 ffrtmpcrypt_protocol_select="tcp_protocol"
2701 ffrtmphttp_protocol_deps="!librtmp_protocol"
2702 ffrtmphttp_protocol_select="http_protocol"
2703 ftp_protocol_select="tcp_protocol"
2704 gopher_protocol_select="network"
2705 http_protocol_select="tcp_protocol"
2706 httpproxy_protocol_select="tcp_protocol"
2707 https_protocol_select="tls_protocol"
2708 icecast_protocol_select="http_protocol"
2709 librtmp_protocol_deps="librtmp"
2710 librtmpe_protocol_deps="librtmp"
2711 librtmps_protocol_deps="librtmp"
2712 librtmpt_protocol_deps="librtmp"
2713 librtmpte_protocol_deps="librtmp"
2714 libsmbclient_protocol_deps="libsmbclient gplv3"
2715 libssh_protocol_deps="libssh"
2716 mmsh_protocol_select="http_protocol"
2717 mmst_protocol_select="network"
2718 rtmp_protocol_deps="!librtmp_protocol"
2719 rtmp_protocol_select="tcp_protocol"
2720 rtmpe_protocol_select="ffrtmpcrypt_protocol"
2721 rtmps_protocol_deps="!librtmp_protocol"
2722 rtmps_protocol_select="tls_protocol"
2723 rtmpt_protocol_select="ffrtmphttp_protocol"
2724 rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
2725 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
2726 rtp_protocol_select="udp_protocol"
2727 sctp_protocol_deps="struct_sctp_event_subscribe"
2728 sctp_protocol_select="network"
2729 srtp_protocol_select="rtp_protocol"
2730 tcp_protocol_select="network"
2731 tls_gnutls_protocol_deps="gnutls !tls_securetransport_protocol"
2732 tls_gnutls_protocol_select="tcp_protocol"
2733 tls_openssl_protocol_deps="openssl !tls_securetransport_protocol !tls_gnutls_protocol"
2734 tls_openssl_protocol_select="tcp_protocol"
2735 tls_securetransport_protocol_deps="securetransport"
2736 tls_securetransport_protocol_select="tcp_protocol"
2737 tls_protocol_deps_any="tls_securetransport_protocol tls_gnutls_protocol tls_openssl_protocol"
2738 udp_protocol_select="network"
2739 udplite_protocol_select="network"
2740 unix_protocol_deps="sys_un_h"
2741 unix_protocol_select="network"
2742
2743 # filters
2744 amovie_filter_deps="avcodec avformat"
2745 aresample_filter_deps="swresample"
2746 ass_filter_deps="libass"
2747 asyncts_filter_deps="avresample"
2748 atempo_filter_deps="avcodec"
2749 atempo_filter_select="rdft"
2750 azmq_filter_deps="libzmq"
2751 blackframe_filter_deps="gpl"
2752 boxblur_filter_deps="gpl"
2753 bs2b_filter_deps="libbs2b"
2754 colormatrix_filter_deps="gpl"
2755 cover_rect_filter_deps="avcodec avformat gpl"
2756 cropdetect_filter_deps="gpl"
2757 delogo_filter_deps="gpl"
2758 deshake_filter_select="pixelutils"
2759 drawtext_filter_deps="libfreetype"
2760 dynaudnorm_filter_deps="copysign erf"
2761 ebur128_filter_deps="gpl"
2762 eq_filter_deps="gpl"
2763 fftfilt_filter_deps="avcodec"
2764 fftfilt_filter_select="rdft"
2765 flite_filter_deps="libflite"
2766 find_rect_filter_deps="avcodec avformat gpl"
2767 frei0r_filter_deps="frei0r dlopen"
2768 frei0r_src_filter_deps="frei0r dlopen"
2769 fspp_filter_deps="gpl"
2770 geq_filter_deps="gpl"
2771 histeq_filter_deps="gpl"
2772 hqdn3d_filter_deps="gpl"
2773 interlace_filter_deps="gpl"
2774 kerndeint_filter_deps="gpl"
2775 ladspa_filter_deps="ladspa dlopen"
2776 mcdeint_filter_deps="avcodec gpl"
2777 movie_filter_deps="avcodec avformat"
2778 mpdecimate_filter_deps="gpl"
2779 mpdecimate_filter_select="pixelutils"
2780 mptestsrc_filter_deps="gpl"
2781 negate_filter_deps="lut_filter"
2782 perspective_filter_deps="gpl"
2783 pp7_filter_deps="gpl"
2784 ocr_filter_deps="libtesseract"
2785 ocv_filter_deps="libopencv"
2786 owdenoise_filter_deps="gpl"
2787 pan_filter_deps="swresample"
2788 phase_filter_deps="gpl"
2789 pp_filter_deps="gpl postproc"
2790 pullup_filter_deps="gpl"
2791 removelogo_filter_deps="avcodec avformat swscale"
2792 repeatfields_filter_deps="gpl"
2793 resample_filter_deps="avresample"
2794 rubberband_filter_deps="librubberband"
2795 sab_filter_deps="gpl swscale"
2796 scale_filter_deps="swscale"
2797 scale2ref_filter_deps="swscale"
2798 select_filter_select="pixelutils"
2799 smartblur_filter_deps="gpl swscale"
2800 showcqt_filter_deps="avcodec"
2801 showcqt_filter_select="fft"
2802 showfreqs_filter_deps="avcodec"
2803 showfreqs_filter_select="fft"
2804 showspectrum_filter_deps="avcodec"
2805 showspectrum_filter_select="rdft"
2806 spp_filter_deps="gpl avcodec"
2807 spp_filter_select="fft idctdsp fdctdsp me_cmp pixblockdsp"
2808 stereo3d_filter_deps="gpl"
2809 subtitles_filter_deps="avformat avcodec libass"
2810 super2xsai_filter_deps="gpl"
2811 tinterlace_filter_deps="gpl"
2812 vidstabdetect_filter_deps="libvidstab"
2813 vidstabtransform_filter_deps="libvidstab"
2814 pixfmts_super2xsai_test_deps="super2xsai_filter"
2815 tinterlace_merge_test_deps="tinterlace_filter"
2816 tinterlace_pad_test_deps="tinterlace_filter"
2817 uspp_filter_deps="gpl avcodec"
2818 zmq_filter_deps="libzmq"
2819 zoompan_filter_deps="swscale"
2820
2821 # examples
2822 avio_reading="avformat avcodec avutil"
2823 avio_dir_cmd="avformat avutil"
2824 avcodec_example_deps="avcodec avutil"
2825 decoding_encoding_example_deps="avcodec avformat avutil"
2826 demuxing_decoding_example_deps="avcodec avformat avutil"
2827 extract_mvs_example_deps="avcodec avformat avutil"
2828 filter_audio_example_deps="avfilter avutil"
2829 filtering_audio_example_deps="avfilter avcodec avformat avutil"
2830 filtering_video_example_deps="avfilter avcodec avformat avutil"
2831 metadata_example_deps="avformat avutil"
2832 muxing_example_deps="avcodec avformat avutil swscale"
2833 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
2834 remuxing_example_deps="avcodec avformat avutil"
2835 resampling_audio_example_deps="avutil swresample"
2836 scaling_video_example_deps="avutil swscale"
2837 transcode_aac_example_deps="avcodec avformat swresample"
2838 transcoding_example_deps="avfilter avcodec avformat avutil"
2839
2840 # libraries, in linking order
2841 avcodec_deps="avutil"
2842 avdevice_deps="avformat avcodec avutil"
2843 avfilter_deps="avutil"
2844 avformat_deps="avcodec avutil"
2845 avresample_deps="avutil"
2846 postproc_deps="avutil gpl"
2847 swresample_deps="avutil"
2848 swscale_deps="avutil"
2849
2850 # programs
2851 ffmpeg_deps="avcodec avfilter avformat swresample"
2852 ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
2853                null_filter
2854                setpts_filter trim_filter"
2855 ffplay_deps="avcodec avformat swscale swresample sdl"
2856 ffplay_libs='$sdl_libs'
2857 ffplay_select="rdft crop_filter transpose_filter hflip_filter vflip_filter rotate_filter"
2858 ffprobe_deps="avcodec avformat"
2859 ffserver_deps="avformat fork sarestart"
2860 ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
2861
2862 # documentation
2863 podpages_deps="perl"
2864 manpages_deps="perl pod2man"
2865 htmlpages_deps="perl"
2866 htmlpages_deps_any="makeinfo_html texi2html"
2867 txtpages_deps="perl makeinfo"
2868 doc_deps_any="manpages htmlpages podpages txtpages"
2869
2870 # default parameters
2871
2872 logfile="config.log"
2873
2874 # installation paths
2875 prefix_default="/usr/local"
2876 bindir_default='${prefix}/bin'
2877 datadir_default='${prefix}/share/ffmpeg'
2878 docdir_default='${prefix}/share/doc/ffmpeg'
2879 incdir_default='${prefix}/include'
2880 libdir_default='${prefix}/lib'
2881 mandir_default='${prefix}/share/man'
2882
2883 # toolchain
2884 ar_default="ar"
2885 cc_default="gcc"
2886 cxx_default="g++"
2887 host_cc_default="gcc"
2888 cp_f="cp -f"
2889 doxygen_default="doxygen"
2890 install="install"
2891 ln_s="ln -s -f"
2892 nm_default="nm -g"
2893 objformat="elf"
2894 pkg_config_default=pkg-config
2895 ranlib_default="ranlib"
2896 strip_default="strip"
2897 yasmexe_default="yasm"
2898 windres_default="windres"
2899
2900 # OS
2901 target_os_default=$(tolower $(uname -s))
2902 host_os=$target_os_default
2903
2904 # machine
2905 if test "$target_os_default" = aix; then
2906     arch_default=$(uname -p)
2907     strip_default="strip -X32_64"
2908 else
2909     arch_default=$(uname -m)
2910 fi
2911 cpu="generic"
2912 intrinsics="none"
2913
2914 # configurable options
2915 enable $PROGRAM_LIST
2916 enable $DOCUMENT_LIST
2917 enable $EXAMPLE_LIST
2918 enable $(filter_out avresample $LIBRARY_LIST)
2919 enable stripping
2920
2921 enable asm
2922 enable debug
2923 enable doc
2924 enable faan faandct faanidct
2925 enable optimizations
2926 enable runtime_cpudetect
2927 enable safe_bitstream_reader
2928 enable static
2929 enable swscale_alpha
2930 enable valgrind_backtrace
2931
2932 sws_max_filter_size_default=256
2933 set_default sws_max_filter_size
2934
2935 # Enable hwaccels by default.
2936 enable d3d11va dxva2 vaapi vda vdpau videotoolbox xvmc
2937 enable xlib
2938
2939 # build settings
2940 SHFLAGS='-shared -Wl,-soname,$$(@F)'
2941 LIBPREF="lib"
2942 LIBSUF=".a"
2943 FULLNAME='$(NAME)$(BUILDSUF)'
2944 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
2945 SLIBPREF="lib"
2946 SLIBSUF=".so"
2947 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
2948 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
2949 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
2950 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
2951 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
2952 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
2953
2954 asflags_filter=echo
2955 cflags_filter=echo
2956 ldflags_filter=echo
2957
2958 AS_C='-c'
2959 AS_O='-o $@'
2960 CC_C='-c'
2961 CC_E='-E -o $@'
2962 CC_O='-o $@'
2963 CXX_C='-c'
2964 CXX_O='-o $@'
2965 LD_O='-o $@'
2966 LD_LIB='-l%'
2967 LD_PATH='-L'
2968 HOSTCC_C='-c'
2969 HOSTCC_E='-E -o $@'
2970 HOSTCC_O='-o $@'
2971 HOSTLD_O='-o $@'
2972
2973 host_libs='-lm'
2974 host_cflags_filter=echo
2975 host_ldflags_filter=echo
2976
2977 target_path='$(CURDIR)'
2978
2979 # since the object filename is not given with the -MM flag, the compiler
2980 # is only able to print the basename, and we must add the path ourselves
2981 DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
2982 DEPFLAGS='-MM'
2983
2984 # find source path
2985 if test -f configure; then
2986     source_path=.
2987 else
2988     source_path=$(cd $(dirname "$0"); pwd)
2989     case "$source_path" in
2990         *[[:blank:]]*) die "Out of tree builds are impossible with whitespace in source path." ;;
2991     esac
2992     test -e "$source_path/config.h" &&
2993         die "Out of tree builds are impossible with config.h in source dir."
2994 fi
2995
2996 for v in "$@"; do
2997     r=${v#*=}
2998     l=${v%"$r"}
2999     r=$(sh_quote "$r")
3000     FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
3001 done
3002
3003 find_things(){
3004     thing=$1
3005     pattern=$2
3006     file=$source_path/$3
3007     sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
3008 }
3009
3010 ENCODER_LIST=$(find_things  encoder  ENC      libavcodec/allcodecs.c)
3011 DECODER_LIST=$(find_things  decoder  DEC      libavcodec/allcodecs.c)
3012 HWACCEL_LIST=$(find_things  hwaccel  HWACCEL  libavcodec/allcodecs.c)
3013 PARSER_LIST=$(find_things   parser   PARSER   libavcodec/allcodecs.c)
3014 BSF_LIST=$(find_things      bsf      BSF      libavcodec/allcodecs.c)
3015 MUXER_LIST=$(find_things    muxer    _MUX     libavformat/allformats.c)
3016 DEMUXER_LIST=$(find_things  demuxer  DEMUX    libavformat/allformats.c)
3017 OUTDEV_LIST=$(find_things   outdev   OUTDEV   libavdevice/alldevices.c)
3018 INDEV_LIST=$(find_things    indev    _IN      libavdevice/alldevices.c)
3019 PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
3020 FILTER_LIST=$(find_things   filter   FILTER   libavfilter/allfilters.c)
3021
3022 ALL_COMPONENTS="
3023     $BSF_LIST
3024     $DECODER_LIST
3025     $DEMUXER_LIST
3026     $ENCODER_LIST
3027     $FILTER_LIST
3028     $HWACCEL_LIST
3029     $INDEV_LIST
3030     $MUXER_LIST
3031     $OUTDEV_LIST
3032     $PARSER_LIST
3033     $PROTOCOL_LIST
3034 "
3035
3036 for n in $COMPONENT_LIST; do
3037     v=$(toupper ${n%s})_LIST
3038     eval enable \$$v
3039     eval ${n}_if_any="\$$v"
3040 done
3041
3042 enable $ARCH_EXT_LIST
3043
3044 die_unknown(){
3045     echo "Unknown option \"$1\"."
3046     echo "See $0 --help for available options."
3047     exit 1
3048 }
3049
3050 print_in_columns() {
3051     cols=$(expr $ncols / 24)
3052     cat | tr ' ' '\n' | sort | pr -r "-$cols" -w $ncols -t
3053 }
3054
3055 show_list() {
3056     suffix=_$1
3057     shift
3058     echo $* | sed s/$suffix//g | print_in_columns
3059     exit 0
3060 }
3061
3062 rand_list(){
3063     IFS=', '
3064     set -- $*
3065     unset IFS
3066     for thing; do
3067         comp=${thing%:*}
3068         prob=${thing#$comp}
3069         prob=${prob#:}
3070         is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
3071         echo "prob ${prob:-0.5}"
3072         printf '%s\n' $comp
3073     done
3074 }
3075
3076 do_random(){
3077     action=$1
3078     shift
3079     random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
3080     $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
3081 }
3082
3083 for opt do
3084     optval="${opt#*=}"
3085     case "$opt" in
3086         --extra-ldflags=*)
3087             add_ldflags $optval
3088         ;;
3089         --extra-ldexeflags=*)
3090             add_ldexeflags $optval
3091         ;;
3092         --extra-ldlibflags=*)
3093             add_ldlibflags $optval
3094         ;;
3095         --extra-libs=*)
3096             add_extralibs $optval
3097         ;;
3098         --disable-devices)
3099             disable $INDEV_LIST $OUTDEV_LIST
3100         ;;
3101         --enable-debug=*)
3102             debuglevel="$optval"
3103         ;;
3104         --disable-programs)
3105             disable $PROGRAM_LIST
3106         ;;
3107         --disable-everything)
3108             map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
3109         ;;
3110         --disable-all)
3111             map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
3112             disable $LIBRARY_LIST $PROGRAM_LIST doc
3113         ;;
3114         --enable-random|--disable-random)
3115             action=${opt%%-random}
3116             do_random ${action#--} $COMPONENT_LIST
3117         ;;
3118         --enable-random=*|--disable-random=*)
3119             action=${opt%%-random=*}
3120             do_random ${action#--} $optval
3121         ;;
3122         --enable-*=*|--disable-*=*)
3123             eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
3124             is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
3125             eval list=\$$(toupper $thing)_LIST
3126             name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
3127             list=$(filter "$name" $list)
3128             [ "$list" = "" ] && warn "Option $opt did not match anything"
3129             $action $list
3130         ;;
3131         --enable-?*|--disable-?*)
3132             eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
3133             if is_in $option $COMPONENT_LIST; then
3134                 test $action = disable && action=unset
3135                 eval $action \$$(toupper ${option%s})_LIST
3136             elif is_in $option $CMDLINE_SELECT; then
3137                 $action $option
3138             else
3139                 die_unknown $opt
3140             fi
3141         ;;
3142         --list-*)
3143             NAME="${opt#--list-}"
3144             is_in $NAME $COMPONENT_LIST || die_unknown $opt
3145             NAME=${NAME%s}
3146             eval show_list $NAME \$$(toupper $NAME)_LIST
3147         ;;
3148         --help|-h) show_help
3149         ;;
3150         --fatal-warnings) enable fatal_warnings
3151         ;;
3152         *)
3153             optname="${opt%%=*}"
3154             optname="${optname#--}"
3155             optname=$(echo "$optname" | sed 's/-/_/g')
3156             if is_in $optname $CMDLINE_SET; then
3157                 eval $optname='$optval'
3158             elif is_in $optname $CMDLINE_APPEND; then
3159                 append $optname "$optval"
3160             else
3161                 die_unknown $opt
3162             fi
3163         ;;
3164     esac
3165 done
3166
3167 for e in $env; do
3168     eval "export $e"
3169 done
3170
3171 disabled logging && logfile=/dev/null
3172
3173 echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
3174 set >> $logfile
3175
3176 test -n "$valgrind" && toolchain="valgrind-memcheck"
3177
3178 case "$toolchain" in
3179     clang-asan)
3180         cc_default="clang"
3181         add_cflags  -fsanitize=address
3182         add_ldflags -fsanitize=address
3183     ;;
3184     clang-tsan)
3185         cc_default="clang"
3186         add_cflags  -fsanitize=thread -pie
3187         add_ldflags -fsanitize=thread -pie
3188     ;;
3189     clang-usan)
3190         cc_default="clang"
3191         add_cflags  -fsanitize=undefined
3192         add_ldflags -fsanitize=undefined
3193     ;;
3194     gcc-asan)
3195         cc_default="gcc"
3196         add_cflags  -fsanitize=address
3197         add_ldflags -fsanitize=address
3198     ;;
3199     gcc-tsan)
3200         cc_default="gcc"
3201         add_cflags  -fsanitize=thread -pie -fPIC
3202         add_ldflags -fsanitize=thread -pie -fPIC
3203     ;;
3204     gcc-usan)
3205         cc_default="gcc"
3206         add_cflags  -fsanitize=undefined
3207         add_ldflags -fsanitize=undefined
3208     ;;
3209     valgrind-massif)
3210         target_exec_default=${valgrind:-"valgrind"}
3211         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"
3212     ;;
3213     valgrind-memcheck)
3214         target_exec_default=${valgrind:-"valgrind"}
3215         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"
3216     ;;
3217     msvc)
3218         # Check whether the current MSVC version needs the C99 converter.
3219         # From MSVC 2013 (compiler major version 18) onwards, it does actually
3220         # support enough of C99 to build ffmpeg. Default to the new
3221         # behaviour if the regexp was unable to match anything, since this
3222         # successfully parses the version number of existing supported
3223         # versions that require the converter (MSVC 2010 and 2012).
3224         cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
3225         if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
3226             cc_default="cl"
3227         else
3228             cc_default="c99wrap cl"
3229         fi
3230         ld_default="$source_path/compat/windows/mslink"
3231         nm_default="dumpbin -symbols"
3232         ar_default="lib"
3233         case "$arch" in
3234         arm*)
3235             as_default="armasm"
3236             ;;
3237         esac
3238         target_os_default="win32"
3239         # Use a relative path for TMPDIR. This makes sure all the
3240         # ffconf temp files are written with a relative path, avoiding
3241         # issues with msys/win32 path conversion for MSVC parameters
3242         # such as -Fo<file> or -out:<file>.
3243         TMPDIR=.
3244     ;;
3245     icl)
3246         cc_default="icl"
3247         ld_default="xilink"
3248         nm_default="dumpbin -symbols"
3249         ar_default="xilib"
3250         target_os_default="win32"
3251         TMPDIR=.
3252     ;;
3253     gcov)
3254         add_cflags  -fprofile-arcs -ftest-coverage
3255         add_ldflags -fprofile-arcs -ftest-coverage
3256     ;;
3257     hardened)
3258         add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
3259         add_cflags   -fno-strict-overflow -fstack-protector-all
3260         add_ldflags  -Wl,-z,relro -Wl,-z,now
3261     ;;
3262     ?*)
3263         die "Unknown toolchain $toolchain"
3264     ;;
3265 esac
3266
3267 test -n "$cross_prefix" && enable cross_compile
3268
3269 if enabled cross_compile; then
3270     test -n "$arch" && test -n "$target_os" ||
3271         die "Must specify target arch and OS when cross-compiling"
3272 fi
3273
3274 ar_default="${cross_prefix}${ar_default}"
3275 cc_default="${cross_prefix}${cc_default}"
3276 cxx_default="${cross_prefix}${cxx_default}"
3277 nm_default="${cross_prefix}${nm_default}"
3278 pkg_config_default="${cross_prefix}${pkg_config_default}"
3279 if ${cross_prefix}${ranlib_default} 2>&1 | grep -q "\-D "; then
3280     ranlib_default="${cross_prefix}${ranlib_default} -D"
3281 else
3282     ranlib_default="${cross_prefix}${ranlib_default}"
3283 fi
3284 strip_default="${cross_prefix}${strip_default}"
3285 windres_default="${cross_prefix}${windres_default}"
3286
3287 sysinclude_default="${sysroot}/usr/include"
3288
3289 set_default arch cc cxx doxygen pkg_config ranlib strip sysinclude \
3290     target_exec target_os yasmexe
3291 enabled cross_compile || host_cc_default=$cc
3292 set_default host_cc
3293
3294 pkg_config_fail_message=""
3295 if ! $pkg_config --version >/dev/null 2>&1; then
3296     warn "$pkg_config not found, library detection may fail."
3297     pkg_config=false
3298 elif is_in -static $cc $LDFLAGS && ! is_in --static $pkg_config $pkg_config_flags; then
3299     pkg_config_fail_message="
3300 Note: When building a static binary, add --pkg-config-flags=\"--static\"."
3301 fi
3302
3303 if test $doxygen != $doxygen_default && \
3304   ! $doxygen --version >/dev/null 2>&1; then
3305     warn "Specified doxygen \"$doxygen\" not found, API documentation will fail to build."
3306 fi
3307
3308 exesuf() {
3309     case $1 in
3310         mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
3311     esac
3312 }
3313
3314 EXESUF=$(exesuf $target_os)
3315 HOSTEXESUF=$(exesuf $host_os)
3316
3317 # set temporary file name
3318 : ${TMPDIR:=$TEMPDIR}
3319 : ${TMPDIR:=$TMP}
3320 : ${TMPDIR:=/tmp}
3321
3322 if [ -n "$tempprefix" ] ; then
3323     mktemp(){
3324         echo $tempprefix.${HOSTNAME}.${UID}
3325     }
3326 elif ! check_cmd mktemp -u XXXXXX; then
3327     # simple replacement for missing mktemp
3328     # NOT SAFE FOR GENERAL USE
3329     mktemp(){
3330         echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
3331     }
3332 fi
3333
3334 tmpfile(){
3335     tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
3336         (set -C; exec > $tmp) 2>/dev/null ||
3337         die "Unable to create temporary file in $TMPDIR."
3338     append TMPFILES $tmp
3339     eval $1=$tmp
3340 }
3341
3342 trap 'rm -f -- $TMPFILES' EXIT
3343
3344 tmpfile TMPASM .asm
3345 tmpfile TMPC   .c
3346 tmpfile TMPCPP .cpp
3347 tmpfile TMPE   $EXESUF
3348 tmpfile TMPH   .h
3349 tmpfile TMPM   .m
3350 tmpfile TMPO   .o
3351 tmpfile TMPS   .S
3352 tmpfile TMPSH  .sh
3353 tmpfile TMPV   .ver
3354
3355 unset -f mktemp
3356
3357 chmod +x $TMPE
3358
3359 # make sure we can execute files in $TMPDIR
3360 cat > $TMPSH 2>> $logfile <<EOF
3361 #! /bin/sh
3362 EOF
3363 chmod +x $TMPSH >> $logfile 2>&1
3364 if ! $TMPSH >> $logfile 2>&1; then
3365     cat <<EOF
3366 Unable to create and execute files in $TMPDIR.  Set the TMPDIR environment
3367 variable to another directory and make sure that it is not mounted noexec.
3368 EOF
3369     die "Sanity test failed."
3370 fi
3371
3372 armasm_flags(){
3373     for flag; do
3374         case $flag in
3375             # Filter out MSVC cl.exe options from cflags that shouldn't
3376             # be passed to gas-preprocessor
3377             -M[TD]*)                                            ;;
3378             *)                  echo $flag                      ;;
3379         esac
3380    done
3381 }
3382
3383 ccc_flags(){
3384     for flag; do
3385         case $flag in
3386             -std=c99)           echo -c99                       ;;
3387             -mcpu=*)            echo -arch ${flag#*=}           ;;
3388             -mieee)             echo -ieee                      ;;
3389             -O*|-fast)          echo $flag                      ;;
3390             -fno-math-errno)    echo -assume nomath_errno       ;;
3391             -g)                 echo -g3                        ;;
3392             -Wall)              echo -msg_enable level2         ;;
3393             -Wno-pointer-sign)  echo -msg_disable ptrmismatch1  ;;
3394             -Wl,*)              echo $flag                      ;;
3395             -f*|-W*)                                            ;;
3396             *)                  echo $flag                      ;;
3397         esac
3398    done
3399 }
3400
3401 cparser_flags(){
3402     for flag; do
3403         case $flag in
3404             -Wno-switch)             echo -Wno-switch-enum ;;
3405             -Wno-format-zero-length) ;;
3406             -Wdisabled-optimization) ;;
3407             -Wno-pointer-sign)       echo -Wno-other ;;
3408             *)                       echo $flag ;;
3409         esac
3410     done
3411 }
3412
3413 msvc_common_flags(){
3414     for flag; do
3415         case $flag in
3416             # In addition to specifying certain flags under the compiler
3417             # specific filters, they must be specified here as well or else the
3418             # generic catch all at the bottom will print the original flag.
3419             -Wall)                ;;
3420             -std=c99)             ;;
3421             # Common flags
3422             -fomit-frame-pointer) ;;
3423             -g)                   echo -Z7 ;;
3424             -fno-math-errno)      ;;
3425             -fno-common)          ;;
3426             -fno-signed-zeros)    ;;
3427             -fPIC)                ;;
3428             -mthumb)              ;;
3429             -march=*)             ;;
3430             -lz)                  echo zlib.lib ;;
3431             -lavifil32)           echo vfw32.lib ;;
3432             -lavicap32)           echo vfw32.lib user32.lib ;;
3433             -l*)                  echo ${flag#-l}.lib ;;
3434             -LARGEADDRESSAWARE)   echo $flag ;;
3435             -L*)                  echo -libpath:${flag#-L} ;;
3436             *)                    echo $flag ;;
3437         esac
3438     done
3439 }
3440
3441 msvc_flags(){
3442     msvc_common_flags "$@"
3443     for flag; do
3444         case $flag in
3445             -Wall)                echo -W4 -wd4244 -wd4127 -wd4018 -wd4389     \
3446                                        -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
3447                                        -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
3448                                        -wd4307 \
3449                                        -wd4273 -wd4554 -wd4701 ;;
3450         esac
3451     done
3452 }
3453
3454 icl_flags(){
3455     msvc_common_flags "$@"
3456     for flag; do
3457         case $flag in
3458             # Despite what Intel's documentation says -Wall, which is supported
3459             # on Windows, does enable remarks so disable them here.
3460             -Wall)                echo $flag -Qdiag-disable:remark ;;
3461             -std=c99)             echo -Qstd=c99 ;;
3462             -flto)                echo -ipo ;;
3463         esac
3464     done
3465 }
3466
3467 icc_flags(){
3468     for flag; do
3469         case $flag in
3470             -flto)                echo -ipo ;;
3471             *)                    echo $flag ;;
3472         esac
3473     done
3474 }
3475
3476 pgi_flags(){
3477     for flag; do
3478         case $flag in
3479             -flto)                echo -Mipa=fast,libopt,libinline,vestigial ;;
3480             -fomit-frame-pointer) echo -Mnoframe ;;
3481             -g)                   echo -gopt ;;
3482             *)                    echo $flag ;;
3483         esac
3484     done
3485 }
3486
3487 suncc_flags(){
3488     for flag; do
3489         case $flag in
3490             -march=*|-mcpu=*)
3491                 case "${flag#*=}" in
3492                     native)                   echo -xtarget=native       ;;
3493                     v9|niagara)               echo -xarch=sparc          ;;
3494                     ultrasparc)               echo -xarch=sparcvis       ;;
3495                     ultrasparc3|niagara2)     echo -xarch=sparcvis2      ;;
3496                     i586|pentium)             echo -xchip=pentium        ;;
3497                     i686|pentiumpro|pentium2) echo -xtarget=pentium_pro  ;;
3498                     pentium3*|c3-2)           echo -xtarget=pentium3     ;;
3499                     pentium-m)          echo -xarch=sse2 -xchip=pentium3 ;;
3500                     pentium4*)          echo -xtarget=pentium4           ;;
3501                     prescott|nocona)    echo -xarch=sse3 -xchip=pentium4 ;;
3502                     *-sse3)             echo -xarch=sse3                 ;;
3503                     core2)              echo -xarch=ssse3 -xchip=core2   ;;
3504                     bonnell)                   echo -xarch=ssse3         ;;
3505                     corei7|nehalem)            echo -xtarget=nehalem     ;;
3506                     westmere)                  echo -xtarget=westmere    ;;
3507                     silvermont)                echo -xarch=sse4_2        ;;
3508                     corei7-avx|sandybridge)    echo -xtarget=sandybridge ;;
3509                     core-avx*|ivybridge|haswell|broadwell)
3510                                                echo -xarch=avx           ;;
3511                     amdfam10|barcelona)        echo -xtarget=barcelona   ;;
3512                     btver1)                    echo -xarch=amdsse4a      ;;
3513                     btver2|bdver*)             echo -xarch=avx           ;;
3514                     athlon-4|athlon-[mx]p)     echo -xarch=ssea          ;;
3515                     k8|opteron|athlon64|athlon-fx)
3516                                                echo -xarch=sse2a         ;;
3517                     athlon*)                   echo -xarch=pentium_proa  ;;
3518                 esac
3519                 ;;
3520             -std=c99)             echo -xc99              ;;
3521             -fomit-frame-pointer) echo -xregs=frameptr    ;;
3522             -fPIC)                echo -KPIC -xcode=pic32 ;;
3523             -W*,*)                echo $flag              ;;
3524             -f*-*|-W*|-mimpure-text)                      ;;
3525             -shared)              echo -G                 ;;
3526             *)                    echo $flag              ;;
3527         esac
3528     done
3529 }
3530
3531 tms470_flags(){
3532     for flag; do
3533         case $flag in
3534             -march=*|-mcpu=*)
3535                 case "${flag#*=}" in
3536                     armv7-a|cortex-a*)      echo -mv=7a8 ;;
3537                     armv7-r|cortex-r*)      echo -mv=7r4 ;;
3538                     armv7-m|cortex-m*)      echo -mv=7m3 ;;
3539                     armv6*|arm11*)          echo -mv=6   ;;
3540                     armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
3541                                             echo -mv=5e  ;;
3542                     armv4*|arm7*|arm9[24]*) echo -mv=4   ;;
3543                 esac
3544                 ;;
3545             -mfpu=neon)     echo --float_support=vfpv3 --neon ;;
3546             -mfpu=vfp)      echo --float_support=vfpv2        ;;
3547             -mfpu=vfpv3)    echo --float_support=vfpv3        ;;
3548             -mfpu=vfpv3-d16) echo --float_support=vfpv3d16    ;;
3549             -msoft-float)   echo --float_support=vfplib       ;;
3550             -O[0-3]|-mf=*)  echo $flag                        ;;
3551             -g)             echo -g -mn                       ;;
3552             -pds=*)         echo $flag                        ;;
3553             -D*|-I*)        echo $flag                        ;;
3554             --gcc|--abi=*)  echo $flag                        ;;
3555             -me)            echo $flag                        ;;
3556         esac
3557     done
3558 }
3559
3560 probe_cc(){
3561     pfx=$1
3562     _cc=$2
3563     first=$3
3564
3565     unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
3566     unset _ld_o _ldflags _ld_lib _ld_path
3567     unset _depflags _DEPCMD _DEPFLAGS
3568     _flags_filter=echo
3569
3570     if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
3571         true # no-op to avoid reading stdin in following checks
3572     elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
3573         _type=llvm_gcc
3574         gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
3575         _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
3576         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3577         _cflags_speed='-O3'
3578         _cflags_size='-Os'
3579     elif $_cc -v 2>&1 | grep -qi ^gcc; then
3580         _type=gcc
3581         gcc_version=$($_cc --version | head -n1)
3582         gcc_basever=$($_cc -dumpversion)
3583         gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
3584         gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
3585         _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
3586         case $gcc_basever in
3587             2*) _depflags='-MMD -MF $(@:.o=.d) -MT $@' ;;
3588         esac
3589         if [ "$first" = true ]; then
3590             case $gcc_basever in
3591                 4.2*)
3592                 warn "gcc 4.2 is outdated and may miscompile FFmpeg. Please use a newer compiler." ;;
3593             esac
3594         fi
3595         _cflags_speed='-O3'
3596         _cflags_size='-Os'
3597     elif $_cc --version 2>/dev/null | grep -q ^icc; then
3598         _type=icc
3599         _ident=$($_cc --version | head -n1)
3600         _depflags='-MMD'
3601         _cflags_speed='-O3'
3602         _cflags_size='-Os'
3603         _cflags_noopt='-O1'
3604         _flags_filter=icc_flags
3605     elif $_cc -v 2>&1 | grep -q xlc; then
3606         _type=xlc
3607         _ident=$($_cc -qversion 2>/dev/null | head -n1)
3608         _cflags_speed='-O5'
3609         _cflags_size='-O5 -qcompact'
3610     elif $_cc -V 2>/dev/null | grep -q Compaq; then
3611         _type=ccc
3612         _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
3613         _DEPFLAGS='-M'
3614         _cflags_speed='-fast'
3615         _cflags_size='-O1'
3616         _flags_filter=ccc_flags
3617     elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
3618         test -d "$sysroot" || die "No valid sysroot specified."
3619         _type=armcc
3620         _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
3621         armcc_conf="$PWD/armcc.conf"
3622         $_cc --arm_linux_configure                 \
3623              --arm_linux_config_file="$armcc_conf" \
3624              --configure_sysroot="$sysroot"        \
3625              --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
3626              die "Error creating armcc configuration file."
3627         $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
3628         _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
3629         as_default="${cross_prefix}gcc"
3630         _depflags='-MMD'
3631         _cflags_speed='-O3'
3632         _cflags_size='-Os'
3633     elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
3634         _type=tms470
3635         _ident=$($_cc -version | head -n1 | tr -s ' ')
3636         _flags='--gcc --abi=eabi -me'
3637         _cc_e='-ppl -fe=$@'
3638         _cc_o='-fe=$@'
3639         _depflags='-ppa -ppd=$(@:.o=.d)'
3640         _cflags_speed='-O3 -mf=5'
3641         _cflags_size='-O3 -mf=2'
3642         _flags_filter=tms470_flags
3643     elif $_cc -v 2>&1 | grep -q clang; then
3644         _type=clang
3645         _ident=$($_cc --version 2>/dev/null | head -n1)
3646         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3647         _cflags_speed='-O3'
3648         _cflags_size='-Os'
3649     elif $_cc -V 2>&1 | grep -q Sun; then
3650         _type=suncc
3651         _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
3652         _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
3653         _DEPFLAGS='-xM1 -xc99'
3654         _ldflags='-std=c99'
3655         _cflags_speed='-O5'
3656         _cflags_size='-O5 -xspace'
3657         _flags_filter=suncc_flags
3658     elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
3659         _type=pathscale
3660         _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3661         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3662         _cflags_speed='-O2'
3663         _cflags_size='-Os'
3664         _flags_filter='filter_out -Wdisabled-optimization'
3665     elif $_cc -v 2>&1 | grep -q Open64; then
3666         _type=open64
3667         _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3668         _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3669         _cflags_speed='-O2'
3670         _cflags_size='-Os'
3671         _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
3672     elif $_cc -V 2>&1 | grep -q Portland; then
3673         _type=pgi
3674         _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
3675         opt_common='-alias=ansi -Mdse -Mlre -Mpre'
3676         _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
3677         _cflags_size="-O2 -Munroll=c:1 $opt_common"
3678         _cflags_noopt="-O"
3679         _flags_filter=pgi_flags
3680     elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
3681         _type=armasm
3682         _ident=$($_cc | head -n1)
3683         # 4509: "This form of conditional instruction is deprecated"
3684         _flags="-nologo -ignore 4509"
3685         _flags_filter=armasm_flags
3686     elif $_cc 2>&1 | grep -q Intel; then
3687         _type=icl
3688         _ident=$($_cc 2>&1 | head -n1)
3689         _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
3690         # Not only is O3 broken on 13.x+ but it is slower on all previous
3691         # versions (tested) as well.
3692         _cflags_speed="-O2"
3693         _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
3694         if $_cc 2>&1 | grep -q Linker; then
3695             _ld_o='-out:$@'
3696         else
3697             _ld_o='-Fe$@'
3698         fi
3699         _cc_o='-Fo$@'
3700         _cc_e='-P'
3701         _flags_filter=icl_flags
3702         _ld_lib='lib%.a'
3703         _ld_path='-libpath:'
3704         # -Qdiag-error to make icl error when seeing certain unknown arguments
3705         _flags='-nologo -Qdiag-error:4044,10157'
3706         # -Qvec- -Qsimd- to prevent miscompilation, -GS, fp:precise for consistency
3707         # with MSVC which enables it by default.
3708         _cflags='-D_USE_MATH_DEFINES -Qms0 -Qvec- -Qsimd- -GS -fp:precise'
3709         disable stripping
3710     elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
3711         _type=msvc
3712         _ident=$($_cc 2>&1 | head -n1)
3713         _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
3714         _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
3715         _cflags_speed="-O2"
3716         _cflags_size="-O1"
3717         if $_cc -nologo- 2>&1 | grep -q Linker; then
3718             _ld_o='-out:$@'
3719         else
3720             _ld_o='-Fe$@'
3721         fi
3722         _cc_o='-Fo$@'
3723         _cc_e='-P -Fi$@'
3724         _flags_filter=msvc_flags
3725         _ld_lib='lib%.a'
3726         _ld_path='-libpath:'
3727         _flags='-nologo'
3728         _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS'
3729         disable stripping
3730     elif $_cc --version 2>/dev/null | grep -q ^cparser; then
3731         _type=cparser
3732         _ident=$($_cc --version | head -n1)
3733         _depflags='-MMD'
3734         _cflags_speed='-O4'
3735         _cflags_size='-O2'
3736         _flags_filter=cparser_flags
3737     fi
3738
3739     eval ${pfx}_type=\$_type
3740     eval ${pfx}_ident=\$_ident
3741 }
3742
3743 set_ccvars(){
3744     eval ${1}_C=\${_cc_c-\${${1}_C}}
3745     eval ${1}_E=\${_cc_e-\${${1}_E}}
3746     eval ${1}_O=\${_cc_o-\${${1}_O}}
3747
3748     if [ -n "$_depflags" ]; then
3749         eval ${1}_DEPFLAGS=\$_depflags
3750     else
3751         eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
3752         eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
3753         eval DEP${1}FLAGS=\$_flags
3754     fi
3755 }
3756
3757 probe_cc cc "$cc" "true"
3758 cflags_filter=$_flags_filter
3759 cflags_speed=$_cflags_speed
3760 cflags_size=$_cflags_size
3761 cflags_noopt=$_cflags_noopt
3762 add_cflags $_flags $_cflags
3763 cc_ldflags=$_ldflags
3764 set_ccvars CC
3765
3766 probe_cc hostcc "$host_cc"
3767 host_cflags_filter=$_flags_filter
3768 add_host_cflags  $_flags $_cflags
3769 set_ccvars HOSTCC
3770
3771 test -n "$cc_type" && enable $cc_type ||
3772     warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
3773
3774 : ${as_default:=$cc}
3775 : ${dep_cc_default:=$cc}
3776 : ${ld_default:=$cc}
3777 : ${host_ld_default:=$host_cc}
3778 set_default ar as dep_cc ld host_ld windres
3779
3780 probe_cc as "$as"
3781 asflags_filter=$_flags_filter
3782 add_asflags $_flags $_cflags
3783 set_ccvars AS
3784
3785 probe_cc ld "$ld"
3786 ldflags_filter=$_flags_filter
3787 add_ldflags $_flags $_ldflags
3788 test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
3789 LD_O=${_ld_o-$LD_O}
3790 LD_LIB=${_ld_lib-$LD_LIB}
3791 LD_PATH=${_ld_path-$LD_PATH}
3792
3793 probe_cc hostld "$host_ld"
3794 host_ldflags_filter=$_flags_filter
3795 add_host_ldflags $_flags $_ldflags
3796 HOSTLD_O=${_ld_o-$HOSTLD_O}
3797
3798 if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
3799     probe_cc depcc "$dep_cc"
3800     CCDEP=${_DEPCMD:-$DEPCMD}
3801     CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
3802     DEPCCFLAGS=$_flags
3803 fi
3804
3805 if $ar 2>&1 | grep -q Microsoft; then
3806     arflags="-nologo"
3807     ar_o='-out:$@'
3808 elif $ar 2>&1 | grep -q 'Texas Instruments'; then
3809     arflags="rq"
3810     ar_o='$@'
3811 elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
3812     arflags='-Xany -r -c'
3813     ar_o='$@'
3814 elif $ar 2>&1 | grep -q "\[D\] "; then
3815     arflags="rcD"
3816     ar_o='$@'
3817 else
3818     arflags="rc"
3819     ar_o='$@'
3820 fi
3821
3822 add_cflags $extra_cflags
3823 add_cxxflags $extra_cxxflags
3824 add_asflags $extra_cflags
3825
3826 if test -n "$sysroot"; then
3827     case "$cc_type" in
3828         gcc|llvm_gcc|clang)
3829             add_cppflags --sysroot="$sysroot"
3830             add_ldflags --sysroot="$sysroot"
3831 # On Darwin --sysroot may be ignored, -isysroot always affects headers and linking
3832             add_cppflags -isysroot "$sysroot"
3833             add_ldflags -isysroot "$sysroot"
3834         ;;
3835         tms470)
3836             add_cppflags -I"$sysinclude"
3837             add_ldflags  --sysroot="$sysroot"
3838         ;;
3839     esac
3840 fi
3841
3842 if test "$cpu" = host; then
3843     enabled cross_compile &&
3844         die "--cpu=host makes no sense when cross-compiling."
3845
3846     case "$cc_type" in
3847         gcc|llvm_gcc)
3848             check_native(){
3849                 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
3850                 sed -n "/cc1.*$1=/{
3851                             s/.*$1=\\([^ ]*\\).*/\\1/
3852                             p
3853                             q
3854                         }" $TMPE
3855             }
3856             cpu=$(check_native -march || check_native -mcpu)
3857         ;;
3858     esac
3859
3860     test "${cpu:-host}" = host &&
3861         die "--cpu=host not supported with compiler $cc"
3862 fi
3863
3864 # Deal with common $arch aliases
3865 case "$arch" in
3866     aarch64|arm64)
3867         arch="aarch64"
3868     ;;
3869     arm*|iPad*|iPhone*)
3870         arch="arm"
3871     ;;
3872     mips*|IP*)
3873         arch="mips"
3874     ;;
3875     parisc*|hppa*)
3876         arch="parisc"
3877     ;;
3878     "Power Macintosh"|ppc*|powerpc*)
3879         arch="ppc"
3880     ;;
3881     s390|s390x)
3882         arch="s390"
3883     ;;
3884     sh4|sh)
3885         arch="sh4"
3886     ;;
3887     sun4u|sparc*)
3888         arch="sparc"
3889     ;;
3890     tilegx|tile-gx)
3891         arch="tilegx"
3892     ;;
3893     i[3-6]86*|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
3894         arch="x86"
3895     ;;
3896 esac
3897
3898 is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
3899 enable $arch
3900
3901 # Add processor-specific flags
3902 if enabled aarch64; then
3903
3904     case $cpu in
3905         armv*)
3906             cpuflags="-march=$cpu"
3907         ;;
3908         *)
3909             cpuflags="-mcpu=$cpu"
3910         ;;
3911     esac
3912
3913 elif enabled alpha; then
3914
3915     cpuflags="-mcpu=$cpu"
3916
3917 elif enabled arm; then
3918
3919     check_arm_arch() {
3920         check_cpp_condition stddef.h \
3921             "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
3922             $cpuflags
3923     }
3924
3925     probe_arm_arch() {
3926         if   check_arm_arch 4;        then echo armv4;
3927         elif check_arm_arch 4T;       then echo armv4t;
3928         elif check_arm_arch 5;        then echo armv5;
3929         elif check_arm_arch 5E;       then echo armv5e;
3930         elif check_arm_arch 5T;       then echo armv5t;
3931         elif check_arm_arch 5TE;      then echo armv5te;
3932         elif check_arm_arch 5TEJ;     then echo armv5te;
3933         elif check_arm_arch 6;        then echo armv6;
3934         elif check_arm_arch 6J;       then echo armv6j;
3935         elif check_arm_arch 6K;       then echo armv6k;
3936         elif check_arm_arch 6Z;       then echo armv6z;
3937         elif check_arm_arch 6ZK;      then echo armv6zk;
3938         elif check_arm_arch 6T2;      then echo armv6t2;
3939         elif check_arm_arch 7;        then echo armv7;
3940         elif check_arm_arch 7A  7_A;  then echo armv7-a;
3941         elif check_arm_arch 7S;       then echo armv7-a;
3942         elif check_arm_arch 7R  7_R;  then echo armv7-r;
3943         elif check_arm_arch 7M  7_M;  then echo armv7-m;
3944         elif check_arm_arch 7EM 7E_M; then echo armv7-m;
3945         elif check_arm_arch 8A  8_A;  then echo armv8-a;
3946         fi
3947     }
3948
3949     [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
3950
3951     case $cpu in
3952         armv*)
3953             cpuflags="-march=$cpu"
3954             subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
3955         ;;
3956         *)
3957             cpuflags="-mcpu=$cpu"
3958             case $cpu in
3959                 cortex-a*)                               subarch=armv7a  ;;
3960                 cortex-r*)                               subarch=armv7r  ;;
3961                 cortex-m*)                 enable thumb; subarch=armv7m  ;;
3962                 arm11*)                                  subarch=armv6   ;;
3963                 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
3964                 armv4*|arm7*|arm9[24]*)                  subarch=armv4   ;;
3965                 *)                             subarch=$(probe_arm_arch) ;;
3966             esac
3967         ;;
3968     esac
3969
3970     case "$subarch" in
3971         armv5t*)    enable fast_clz                ;;
3972         armv[6-8]*)
3973             enable fast_clz
3974             disabled fast_unaligned || enable fast_unaligned
3975             ;;
3976     esac
3977
3978 elif enabled avr32; then
3979
3980     case $cpu in
3981         ap7[02]0[0-2])
3982             subarch="avr32_ap"
3983             cpuflags="-mpart=$cpu"
3984         ;;
3985         ap)
3986             subarch="avr32_ap"
3987             cpuflags="-march=$cpu"
3988         ;;
3989         uc3[ab]*)
3990             subarch="avr32_uc"
3991             cpuflags="-mcpu=$cpu"
3992         ;;
3993         uc)
3994             subarch="avr32_uc"
3995             cpuflags="-march=$cpu"
3996         ;;
3997     esac
3998
3999 elif enabled bfin; then
4000
4001     cpuflags="-mcpu=$cpu"
4002
4003 elif enabled mips; then
4004
4005     cpuflags="-march=$cpu"
4006
4007     case $cpu in
4008         24kc)
4009             disable mips32r5
4010             disable mips64r6
4011             disable mipsfpu
4012             disable mipsdspr1
4013             disable mipsdspr2
4014             disable msa
4015         ;;
4016         24kf*)
4017             disable mips32r5
4018             disable mips64r6
4019             disable mipsdspr1
4020             disable mipsdspr2
4021             disable msa
4022         ;;
4023         24kec|34kc|1004kc)
4024             disable mips32r5
4025             disable mips64r6
4026             disable mipsfpu
4027             disable mipsdspr2
4028             disable msa
4029         ;;
4030         24kef*|34kf*|1004kf*)
4031             disable mips32r5
4032             disable mips64r6
4033             disable mipsdspr2
4034             disable msa
4035         ;;
4036         74kc)
4037             disable mips32r5
4038             disable mips64r6
4039             disable mipsfpu
4040             disable msa
4041         ;;
4042         74kf)
4043             disable mips32r5
4044             disable mips64r6
4045             disable msa
4046         ;;
4047         p5600)
4048             disable mips64r6
4049             disable mipsdspr1
4050             disable mipsdspr2
4051
4052             check_cflags "-mtune=p5600"
4053         ;;
4054         i6400)
4055             disable mips32r5
4056             disable mipsdspr1
4057             disable mipsdspr2
4058             disable mipsfpu
4059
4060             check_cflags "-mtune=i6400 -mabi=64"
4061             check_ldflags "-mabi=64"
4062         ;;
4063         loongson*)
4064             disable mipsfpu
4065             disable mips32r2
4066             disable mips32r5
4067             disable mips64r6
4068             disable mipsdspr1
4069             disable mipsdspr2
4070             disable msa
4071             enable local_aligned_8 local_aligned_16 local_aligned_32
4072             enable simd_align_16
4073             enable fast_64bit
4074             enable fast_clz
4075             enable fast_cmov
4076             enable fast_unaligned
4077             disable aligned_stack
4078             case $cpu in
4079                 loongson3*)
4080                     cpuflags="-march=loongson3a -mhard-float -fno-expensive-optimizations"
4081                 ;;
4082                 loongson2e)
4083                     cpuflags="-march=loongson2e -mhard-float -fno-expensive-optimizations"
4084                 ;;
4085                 loongson2f)
4086                     cpuflags="-march=loongson2f -mhard-float -fno-expensive-optimizations"
4087                 ;;
4088             esac
4089         ;;
4090         generic)
4091             disable mips32r5
4092             disable mips64r6
4093             disable msa
4094         ;;
4095     esac
4096
4097 elif enabled ppc; then
4098
4099     disable ldbrx
4100
4101     case $(tolower $cpu) in
4102         601|ppc601|powerpc601)
4103             cpuflags="-mcpu=601"
4104             disable altivec
4105         ;;
4106         603*|ppc603*|powerpc603*)
4107             cpuflags="-mcpu=603"
4108             disable altivec
4109         ;;
4110         604*|ppc604*|powerpc604*)
4111             cpuflags="-mcpu=604"
4112             disable altivec
4113         ;;
4114         g3|75*|ppc75*|powerpc75*)
4115             cpuflags="-mcpu=750"
4116             disable altivec
4117         ;;
4118         g4|745*|ppc745*|powerpc745*)
4119             cpuflags="-mcpu=7450"
4120             disable vsx
4121         ;;
4122         74*|ppc74*|powerpc74*)
4123             cpuflags="-mcpu=7400"
4124             disable vsx
4125         ;;
4126         g5|970|ppc970|powerpc970)
4127             cpuflags="-mcpu=970"
4128             disable vsx
4129         ;;
4130         power[3-6]*)
4131             cpuflags="-mcpu=$cpu"
4132             disable vsx
4133         ;;
4134         power[7-8]*)
4135             cpuflags="-mcpu=$cpu"
4136         ;;
4137         cell)
4138             cpuflags="-mcpu=cell"
4139             enable ldbrx
4140             disable vsx
4141         ;;
4142         e500mc)
4143             cpuflags="-mcpu=e500mc"
4144             disable altivec
4145         ;;
4146         e500v2)
4147             cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
4148             disable altivec
4149             disable dcbzl
4150         ;;
4151         e500)
4152             cpuflags="-mcpu=8540 -mhard-float"
4153             disable altivec
4154             disable dcbzl
4155         ;;
4156     esac
4157
4158 elif enabled sparc; then
4159
4160     case $cpu in
4161         cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
4162             cpuflags="-mcpu=$cpu"
4163         ;;
4164         ultrasparc*|niagara[234])
4165             cpuflags="-mcpu=$cpu"
4166         ;;
4167     esac
4168
4169 elif enabled x86; then
4170
4171     case $cpu in
4172         i[345]86|pentium)
4173             cpuflags="-march=$cpu"
4174             disable i686
4175             disable mmx
4176         ;;
4177         # targets that do NOT support nopl and conditional mov (cmov)
4178         pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
4179             cpuflags="-march=$cpu"
4180             disable i686
4181         ;;
4182         # targets that do support nopl and conditional mov (cmov)
4183         i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64*|k8*|opteron*|athlon-fx\
4184         |core*|atom|bonnell|nehalem|westmere|silvermont|sandybridge|ivybridge|haswell|broadwell|amdfam10|barcelona|b[dt]ver*)
4185             cpuflags="-march=$cpu"
4186             enable i686
4187             enable fast_cmov
4188         ;;
4189         # targets that do support conditional mov but on which it's slow
4190         pentium4|pentium4m|prescott|nocona)
4191             cpuflags="-march=$cpu"
4192             enable i686
4193             disable fast_cmov
4194         ;;
4195     esac
4196
4197 fi
4198
4199 if [ "$cpu" != generic ]; then
4200     add_cflags  $cpuflags
4201     add_asflags $cpuflags
4202 fi
4203
4204 # compiler sanity check
4205 check_exec <<EOF
4206 int main(void){ return 0; }
4207 EOF
4208 if test "$?" != 0; then
4209     echo "$cc is unable to create an executable file."
4210     if test -z "$cross_prefix" && ! enabled cross_compile ; then
4211         echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
4212         echo "Only do this if you know what cross compiling means."
4213     fi
4214     die "C compiler test failed."
4215 fi
4216
4217 add_cppflags -D_ISOC99_SOURCE
4218 add_cxxflags -D__STDC_CONSTANT_MACROS
4219 check_cflags -std=c99
4220 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
4221 #include <stdlib.h>
4222 EOF
4223 check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
4224 #include <stdlib.h>
4225 EOF
4226
4227 add_host_cppflags -D_ISOC99_SOURCE
4228 check_host_cflags -std=c99
4229 check_host_cflags -Wall
4230 check_host_cflags -O3
4231
4232 check_64bit(){
4233     arch32=$1
4234     arch64=$2
4235     expr=$3
4236     check_code cc "" "int test[2*($expr) - 1]" &&
4237         subarch=$arch64 || subarch=$arch32
4238 }
4239
4240 case "$arch" in
4241     aarch64|alpha|ia64)
4242         spic=$shared
4243     ;;
4244     mips)
4245         check_64bit mips mips64 '_MIPS_SIM > 1'
4246         spic=$shared
4247     ;;
4248     parisc)
4249         check_64bit parisc parisc64 'sizeof(void *) > 4'
4250         spic=$shared
4251     ;;
4252     ppc)
4253         check_64bit ppc ppc64 'sizeof(void *) > 4'
4254         spic=$shared
4255     ;;
4256     s390)
4257         check_64bit s390 s390x 'sizeof(void *) > 4'
4258         spic=$shared
4259     ;;
4260     sparc)
4261         check_64bit sparc sparc64 'sizeof(void *) > 4'
4262         spic=$shared
4263     ;;
4264     x86)
4265         check_64bit x86_32 x86_64 'sizeof(void *) > 4'
4266         # Treat x32 as x64 for now. Note it also needs spic=$shared
4267         test "$subarch" = "x86_32" && check_cpp_condition stddef.h 'defined(__x86_64__)' &&
4268             subarch=x86_64
4269         if test "$subarch" = "x86_64"; then
4270             spic=$shared
4271         fi
4272     ;;
4273     ppc)
4274         check_cc <<EOF && subarch="ppc64"
4275         int test[(int)sizeof(char*) - 7];
4276 EOF
4277     ;;
4278 esac
4279
4280 enable $subarch
4281 enabled spic && enable_weak pic
4282
4283 # OS specific
4284 case $target_os in
4285     aix)
4286         SHFLAGS=-shared
4287         add_cppflags '-I\$(SRC_PATH)/compat/aix'
4288         enabled shared && add_ldflags -Wl,-brtl
4289         ;;
4290     android)
4291         disable symver
4292         enable section_data_rel_ro
4293         SLIB_INSTALL_NAME='$(SLIBNAME)'
4294         SLIB_INSTALL_LINKS=
4295         # soname not set on purpose
4296         SHFLAGS=-shared
4297         ;;
4298     haiku)
4299         prefix_default="/boot/common"
4300         network_extralibs="-lnetwork"
4301         host_libs=
4302         ;;
4303     sunos)
4304         SHFLAGS='-shared -Wl,-h,$$(@F)'
4305         enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
4306         network_extralibs="-lsocket -lnsl"
4307         add_cppflags -D__EXTENSIONS__
4308         # When using suncc to build, the Solaris linker will mark
4309         # an executable with each instruction set encountered by
4310         # the Solaris assembler.  As our libraries contain their own
4311         # guards for processor-specific code, instead suppress
4312         # generation of the HWCAPS ELF section on Solaris x86 only.
4313         enabled_all suncc x86 &&
4314             echo "hwcap_1 = OVERRIDE;" > mapfile &&
4315             add_ldflags -Wl,-M,mapfile
4316         nm_default='nm -P -g'
4317         ;;
4318     netbsd)
4319         disable symver
4320         oss_indev_extralibs="-lossaudio"
4321         oss_outdev_extralibs="-lossaudio"
4322         enabled gcc || check_ldflags -Wl,-zmuldefs
4323         ;;
4324     openbsd|bitrig)
4325         disable symver
4326         SHFLAGS='-shared'
4327         SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
4328         SLIB_INSTALL_LINKS=
4329         oss_indev_extralibs="-lossaudio"
4330         oss_outdev_extralibs="-lossaudio"
4331         ;;
4332     dragonfly)
4333         disable symver
4334         ;;
4335     freebsd)
4336         ;;
4337     bsd/os)
4338         add_extralibs -lpoll -lgnugetopt
4339         strip="strip -d"
4340         ;;
4341     darwin)
4342         enabled ppc && add_asflags -force_cpusubtype_ALL
4343         SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
4344         enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
4345         strip="${strip} -x"
4346         add_ldflags -Wl,-dynamic,-search_paths_first
4347         SLIBSUF=".dylib"
4348         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
4349         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
4350         objformat="macho"
4351         enabled x86_64 && objformat="macho64"
4352         enabled_any pic shared x86_64 ||
4353             { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
4354         ;;
4355     mingw32*|mingw64*)
4356         if test $target_os = "mingw32ce"; then
4357             disable network
4358         else
4359             target_os=mingw32
4360         fi
4361         decklink_outdev_extralibs="$decklink_outdev_extralibs -lole32 -loleaut32"
4362         decklink_indev_extralibs="$decklink_indev_extralibs -lole32 -loleaut32"
4363         LIBTARGET=i386
4364         if enabled x86_64; then
4365             LIBTARGET="i386:x86-64"
4366         elif enabled arm; then
4367             LIBTARGET=arm-wince
4368         fi
4369         enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
4370         check_ldflags -Wl,--nxcompat
4371         check_ldflags -Wl,--dynamicbase
4372         enabled x86_32 && check_ldflags -Wl,--large-address-aware
4373         shlibdir_default="$bindir_default"
4374         SLIBPREF=""
4375         SLIBSUF=".dll"
4376         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
4377         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
4378         dlltool="${cross_prefix}dlltool"
4379         if check_cmd lib.exe -list; then
4380             SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
4381             if enabled x86_64; then
4382                 LIBTARGET=x64
4383             fi
4384         elif check_cmd $dlltool --version; then
4385             SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
4386         fi
4387         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
4388         SLIB_INSTALL_LINKS=
4389         SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
4390         SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
4391         SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
4392         objformat="win32"
4393         ranlib=:
4394         enable dos_paths
4395         # Lets work around some stupidity in binutils.
4396         # ld will strip relocations from executables even though we need them
4397         # for dynamicbase (ASLR).  Using -pie does retain the reloc section
4398         # however ld then forgets what the entry point should be (oops) so we
4399         # have to manually (re)set it.
4400         if enabled x86_32; then
4401             add_ldexeflags -Wl,--pic-executable,-e,_mainCRTStartup
4402         elif enabled x86_64; then
4403             add_ldexeflags -Wl,--pic-executable,-e,mainCRTStartup
4404         fi
4405         ;;
4406     win32|win64)
4407         disable symver
4408         if enabled shared; then
4409             # Link to the import library instead of the normal static library
4410             # for shared libs.
4411             LD_LIB='%.lib'
4412             # Cannot build both shared and static libs with MSVC or icl.
4413             disable static
4414         fi
4415         enabled x86_32 && check_ldflags -LARGEADDRESSAWARE
4416         shlibdir_default="$bindir_default"
4417         SLIBPREF=""
4418         SLIBSUF=".dll"
4419         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
4420         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
4421         SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
4422         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
4423         SLIB_INSTALL_LINKS=
4424         SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
4425         SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
4426         SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
4427         objformat="win32"
4428         ranlib=:
4429         enable dos_paths
4430         ;;
4431     cygwin*)
4432         target_os=cygwin
4433         shlibdir_default="$bindir_default"
4434         SLIBPREF="cyg"
4435         SLIBSUF=".dll"
4436         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
4437         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
4438         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
4439         SLIB_INSTALL_LINKS=
4440         SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
4441         SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
4442         objformat="win32"
4443         enable dos_paths
4444         enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
4445         ;;
4446     *-dos|freedos|opendos)
4447         network_extralibs="-lsocket"
4448         objformat="coff"
4449         enable dos_paths
4450         add_cppflags -U__STRICT_ANSI__
4451         ;;
4452     linux)
4453         enable dv1394
4454         enable section_data_rel_ro
4455         ;;
4456     irix*)
4457         target_os=irix
4458         ranlib="echo ignoring ranlib"
4459         ;;
4460     os/2*)
4461         strip="lxlite -CS"
4462         ln_s="cp -f"
4463         objformat="aout"
4464         add_cppflags -D_GNU_SOURCE
4465         add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
4466         SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
4467         LIBSUF="_s.a"
4468         SLIBPREF=""
4469         SLIBSUF=".dll"
4470         SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
4471         SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
4472         SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
4473             echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
4474             echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
4475             echo EXPORTS >> $(SUBDIR)$(NAME).def; \
4476             emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
4477         SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
4478             emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
4479         SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
4480         enable dos_paths
4481         enable_weak os2threads
4482         ;;
4483     gnu/kfreebsd)
4484         add_cppflags -D_BSD_SOURCE
4485         ;;
4486     gnu)
4487         ;;
4488     qnx)
4489         add_cppflags -D_QNX_SOURCE
4490         network_extralibs="-lsocket"
4491         ;;
4492     symbian)
4493         SLIBSUF=".dll"
4494         enable dos_paths
4495         add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
4496         add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
4497         add_ldflags -Wl,--target1-abs,--no-undefined \
4498                     -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
4499                     -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
4500         add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
4501                       -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
4502                       -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
4503         ;;
4504     osf1)
4505         add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
4506         ;;
4507     minix)
4508         ;;
4509     plan9)
4510         add_cppflags -D_C99_SNPRINTF_EXTENSION  \
4511                      -D_REENTRANT_SOURCE        \
4512                      -D_RESEARCH_SOURCE         \
4513                      -DFD_SETSIZE=96            \
4514                      -DHAVE_SOCK_OPTS
4515         add_compat strtod.o strtod=avpriv_strtod
4516         network_extralibs='-lbsd'
4517         exeobjs=compat/plan9/main.o
4518         disable ffserver
4519         cp_f='cp'
4520         ;;
4521     none)
4522         ;;
4523     *)
4524         die "Unknown OS '$target_os'."
4525         ;;
4526 esac
4527
4528 # determine libc flavour
4529
4530 probe_libc(){
4531     pfx=$1
4532     pfx_no_=${pfx%_}
4533     # uclibc defines __GLIBC__, so it needs to be checked before glibc.
4534     if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
4535         eval ${pfx}libc_type=uclibc
4536         add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
4537     elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
4538         eval ${pfx}libc_type=glibc
4539         add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
4540     # MinGW headers can be installed on Cygwin, so check for newlib first.
4541     elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
4542         eval ${pfx}libc_type=newlib
4543         add_${pfx}cppflags -U__STRICT_ANSI__
4544     # MinGW64 is backwards compatible with MinGW32, so check for it first.
4545     elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
4546         eval ${pfx}libc_type=mingw64
4547         if check_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
4548             add_compat msvcrt/snprintf.o
4549             add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
4550         fi
4551         add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
4552         eval test \$${pfx_no_}cc_type = "gcc" &&
4553             add_${pfx}cppflags -D__printf__=__gnu_printf__
4554     elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION"  ||
4555          check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
4556         eval ${pfx}libc_type=mingw32
4557         check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
4558             (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
4559             die "ERROR: MinGW32 runtime version must be >= 3.15."
4560         add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
4561         eval test \$${pfx_no_}cc_type = "gcc" &&
4562             add_${pfx}cppflags -D__printf__=__gnu_printf__
4563     elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
4564         eval ${pfx}libc_type=msvcrt
4565         if check_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
4566             if [ "$pfx" = host_ ]; then
4567                 add_host_cppflags -Dsnprintf=_snprintf
4568             else
4569                 add_compat strtod.o strtod=avpriv_strtod
4570                 add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf   \
4571                                              _snprintf=avpriv_snprintf  \
4572                                              vsnprintf=avpriv_vsnprintf
4573             fi
4574         fi
4575         # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
4576         # 0x601 by default unless something else is set by the user.
4577         # This can easily lead to us detecting functions only present
4578         # in such new versions and producing binaries requiring windows 7.0.
4579         # Therefore explicitly set the default to XP unless the user has
4580         # set something else on the command line.
4581         # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
4582         # family. For these cases, configure is free to use any functions
4583         # found in the SDK headers by default. (Alternatively, we could force
4584         # _WIN32_WINNT to 0x0602 in that case.)
4585         check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
4586             { check_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0502; }
4587 #ifdef WINAPI_FAMILY
4588 #include <winapifamily.h>
4589 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
4590 #error not desktop
4591 #endif
4592 #endif
4593 EOF
4594     elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
4595         eval ${pfx}libc_type=klibc
4596     elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
4597         eval ${pfx}libc_type=bionic
4598     elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
4599         eval ${pfx}libc_type=solaris
4600         add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
4601     fi
4602     check_${pfx}cc <<EOF
4603 #include <time.h>
4604 void *v = localtime_r;
4605 EOF
4606 test "$?" != 0 && check_${pfx}cc -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 <<EOF && add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
4607 #include <time.h>
4608 void *v = localtime_r;
4609 EOF
4610
4611 }
4612
4613 probe_libc
4614 test -n "$libc_type" && enable libc_$libc_type
4615 probe_libc host_
4616 test -n "$host_libc_type" && enable host_libc_$host_libc_type
4617
4618 case $libc_type in
4619     bionic)
4620         add_compat strtod.o strtod=avpriv_strtod
4621         ;;
4622 esac
4623
4624 # hacks for compiler/libc/os combinations
4625
4626 if enabled_all tms470 libc_glibc; then
4627     CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
4628     add_cppflags -D__USER_LABEL_PREFIX__=
4629     add_cppflags -D__builtin_memset=memset
4630     add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
4631     add_cflags   -pds=48    # incompatible redefinition of macro
4632 fi
4633
4634 if enabled_all ccc libc_glibc; then
4635     add_ldflags -Wl,-z,now  # calls to libots crash without this
4636 fi
4637
4638 check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
4639     add_cppflags '-I\$(SRC_PATH)/compat/float'
4640
4641 esc(){
4642     echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
4643 }
4644
4645 echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
4646
4647 check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
4648
4649 set_default libdir
4650 : ${shlibdir_default:="$libdir"}
4651 : ${pkgconfigdir_default:="$libdir/pkgconfig"}
4652
4653 set_default $PATHS_LIST
4654 set_default nm
4655
4656 # we need to build at least one lib type
4657 if ! enabled_any static shared; then
4658     cat <<EOF
4659 At least one library type must be built.
4660 Specify --enable-static to build the static libraries or --enable-shared to
4661 build the shared libraries as well. To only build the shared libraries specify
4662 --disable-static in addition to --enable-shared.
4663 EOF
4664     exit 1;
4665 fi
4666
4667 die_license_disabled() {
4668     enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
4669 }
4670
4671 die_license_disabled_gpl() {
4672     enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; }
4673 }
4674
4675 die_license_disabled gpl frei0r
4676 die_license_disabled gpl libcdio
4677 die_license_disabled gpl librubberband
4678 die_license_disabled gpl libsmbclient
4679 die_license_disabled gpl libutvideo
4680 die_license_disabled gpl libvidstab
4681 die_license_disabled gpl libx264
4682 die_license_disabled gpl libx265
4683 die_license_disabled gpl libxavs
4684 die_license_disabled gpl libxvid
4685 die_license_disabled gpl libzvbi
4686 die_license_disabled gpl x11grab
4687
4688 die_license_disabled nonfree libaacplus
4689 die_license_disabled nonfree libfaac
4690 die_license_disabled nonfree nvenc
4691 enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
4692 enabled gpl && die_license_disabled_gpl nonfree openssl
4693
4694 die_license_disabled version3 libopencore_amrnb
4695 die_license_disabled version3 libopencore_amrwb
4696 die_license_disabled version3 libsmbclient
4697 die_license_disabled version3 libvo_aacenc
4698 die_license_disabled version3 libvo_amrwbenc
4699
4700 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
4701
4702 disabled optimizations || check_cflags -fomit-frame-pointer
4703
4704 enable_weak_pic() {
4705     disabled pic && return
4706     enable pic
4707     add_cppflags -DPIC
4708     case "$target_os" in
4709     mingw*|cygwin*)
4710         ;;
4711     *)
4712         add_cflags -fPIC
4713         ;;
4714     esac
4715     add_asflags  -fPIC
4716 }
4717
4718 enabled pic && enable_weak_pic
4719
4720 check_cc <<EOF || die "Symbol mangling check failed."
4721 int ff_extern;
4722 EOF
4723 sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
4724 extern_prefix=${sym%%ff_extern*}
4725
4726 check_cc <<EOF && enable_weak inline_asm
4727 void foo(void) { __asm__ volatile ("" ::); }
4728 EOF
4729
4730 _restrict=
4731 for restrict_keyword in restrict __restrict__ __restrict; do
4732     check_cc <<EOF && _restrict=$restrict_keyword && break
4733 void foo(char * $restrict_keyword p);
4734 EOF
4735 done
4736
4737 check_cc <<EOF && enable pragma_deprecated
4738 void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
4739 EOF
4740
4741 check_cc <<EOF && enable attribute_packed
4742 struct { int x; } __attribute__((packed)) x;
4743 EOF
4744
4745 check_cc <<EOF && enable attribute_may_alias
4746 union { int x; } __attribute__((may_alias)) x;
4747 EOF
4748
4749 check_cc <<EOF || die "endian test failed"
4750 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
4751 EOF
4752 od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
4753
4754 if ! enabled ppc64 || enabled bigendian; then
4755     disable vsx
4756 fi
4757
4758 check_gas() {
4759     log "check_gas using '$as' as AS"
4760     # :vararg is used on aarch64, arm and ppc altivec
4761     check_as <<EOF || return 1
4762 .macro m n, y:vararg=0
4763 \n: .int \y
4764 .endm
4765 m x
4766 EOF
4767     # .altmacro is only used in arm asm
4768     ! enabled arm || check_as <<EOF || return 1
4769 .altmacro
4770 EOF
4771     enable gnu_as
4772     return 0
4773 }
4774
4775 if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
4776     nogas=:
4777     enabled_any arm aarch64 && nogas=die
4778     enabled_all ppc altivec && [ $target_os_default != aix ] && nogas=warn
4779     as_noop=-v
4780
4781     case $as_type in
4782         arm*) gaspp_as_type=armasm; as_noop=-h ;;
4783         gcc)  gaspp_as_type=gas ;;
4784         *)    gaspp_as_type=$as_type ;;
4785     esac
4786
4787     [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
4788
4789     test "${as#*gas-preprocessor.pl}" != "$as" ||
4790     check_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- ${as:=$cc} $as_noop &&
4791         gas="${gas:=gas-preprocessor.pl} -arch $arch -as-type $gaspp_as_type -- ${as:=$cc}"
4792
4793     if ! check_gas ; then
4794         as=${gas:=$as}
4795         check_gas || \
4796             $nogas "GNU assembler not found, install/update gas-preprocessor"
4797     fi
4798
4799     check_as <<EOF && enable as_func
4800 .func test
4801 .endfunc
4802 EOF
4803 fi
4804
4805 check_inline_asm inline_asm_labels '"1:\n"'
4806
4807 check_inline_asm inline_asm_nonlocal_labels '"Label:\n"'
4808
4809 if enabled aarch64; then
4810     enabled armv8 && check_insn armv8 'prfm   pldl1strm, [x0]'
4811     # internal assembler in clang 3.3 does not support this instruction
4812     enabled neon && check_insn neon 'ext   v0.8B, v0.8B, v1.8B, #1'
4813     enabled vfp  && check_insn vfp  'fmadd d0,    d0,    d1,    d2'
4814
4815     map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
4816
4817 elif enabled alpha; then
4818
4819     check_cflags -mieee
4820
4821 elif enabled arm; then
4822
4823     enabled msvc && check_cpp_condition stddef.h "defined _M_ARMT" && enable thumb
4824
4825     check_cpp_condition stddef.h "defined __thumb__" && check_cc <<EOF && enable_weak thumb
4826 float func(float a, float b){ return a+b; }
4827 EOF
4828
4829     enabled thumb && check_cflags -mthumb || check_cflags -marm
4830
4831     if     check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
4832         enable vfp_args
4833     elif check_cpp_condition stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
4834         enable vfp_args
4835     elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
4836         case "${cross_prefix:-$cc}" in
4837             *hardfloat*)         enable vfp_args;   fpabi=vfp ;;
4838             *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
4839 __asm__ (".eabi_attribute 28, 1");
4840 int main(void) { return 0; }
4841 EOF
4842         esac
4843         warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
4844     fi
4845
4846     enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
4847     enabled armv6   && check_insn armv6   'sadd16 r0, r0, r0'
4848     enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
4849     enabled neon    && check_insn neon    'vadd.i16 q0, q0, q0'
4850     enabled vfp     && check_insn vfp     'fadds s0, s0, s0'
4851     enabled vfpv3   && check_insn vfpv3   'vmov.f32 s0, #1.0'
4852     enabled setend  && check_insn setend  'setend be'
4853
4854     [ $target_os = linux ] || [ $target_os = android ] ||
4855         map 'enabled_any ${v}_external ${v}_inline || disable $v' \
4856             $ARCH_EXT_LIST_ARM
4857
4858     check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'