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