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