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