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