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