3 # Libav configure script
5 # Copyright (c) 2000-2002 Fabrice Bellard
6 # Copyright (c) 2005-2008 Diego Biurrun
7 # Copyright (c) 2005-2008 Mans Rullgard
10 # Prevent locale nonsense from breaking basic text processing.
14 # make sure we are running under a compatible shell
15 # try to make this part work with most shells
18 echo "Trying shell $1"
19 type "$1" > /dev/null 2>&1 && exec "$@"
23 (: ${foo%%bar}) 2> /dev/null
26 (: ${foo?}) 2> /dev/null
29 if test "$E1" != 0 || test "$E2" = 0; then
30 echo "Broken shell detected. Trying alternatives."
32 if test "0$FF_CONF_EXEC" -lt 1; then
34 try_exec bash "$0" "$@"
36 if test "0$FF_CONF_EXEC" -lt 2; then
38 try_exec ksh "$0" "$@"
40 if test "0$FF_CONF_EXEC" -lt 3; then
42 try_exec /usr/xpg4/bin/sh "$0" "$@"
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."
57 test -d /usr/xpg4/bin && PATH=/usr/xpg4/bin:$PATH
61 Usage: configure [options]
62 Options: [defaults in brackets after descriptions]
65 --help print this message
66 --quiet Suppress showing informative output
67 --list-decoders show all available decoders
68 --list-encoders show all available encoders
69 --list-hwaccels show all available hardware accelerators
70 --list-demuxers show all available demuxers
71 --list-muxers show all available muxers
72 --list-parsers show all available parsers
73 --list-protocols show all available protocols
74 --list-bsfs show all available bitstream filters
75 --list-indevs show all available input devices
76 --list-filters show all available filters
79 --logfile=FILE log tests and output to FILE [avbuild/config.log]
80 --disable-logging do not log configure debug information
81 --prefix=PREFIX install in PREFIX [$prefix_default]
82 --bindir=DIR install binaries in DIR [PREFIX/bin]
83 --datadir=DIR install data files in DIR [PREFIX/share/avconv]
84 --docdir=DIR install documentation in DIR [PREFIX/share/doc/libav]
85 --libdir=DIR install libs in DIR [PREFIX/lib]
86 --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
87 --incdir=DIR install includes in DIR [PREFIX/include]
88 --mandir=DIR install man page in DIR [PREFIX/share/man]
89 --enable-rpath use rpath when linking programs (USE WITH CARE)
92 --enable-gpl allow use of GPL code, the resulting libs
93 and binaries will be under GPL [no]
94 --enable-version3 upgrade (L)GPL to version 3 [no]
95 --enable-nonfree allow use of nonfree code, the resulting libs
96 and binaries will be unredistributable [no]
98 Configuration options:
99 --disable-static do not build static libraries [no]
100 --enable-shared build shared libraries [no]
101 --enable-small optimize for size instead of speed
102 --enable-runtime-cpudetect detect CPU capabilities at runtime (bigger binary)
103 --enable-gray enable full grayscale support (slower color)
104 --disable-swscale-alpha disable alpha channel support in swscale
105 --disable-all disable building components, libraries and programs
108 --disable-programs do not build command line programs
109 --disable-avconv disable avconv build
110 --disable-avplay disable avplay build
111 --disable-avprobe disable avprobe build
114 --disable-doc do not build documentation
115 --disable-pod2man do not build manual pages
116 --disable-texi2html do not build HTML documentation
117 --disable-avdevice disable libavdevice build
118 --disable-avcodec disable libavcodec build
119 --disable-avformat disable libavformat build
120 --disable-avutil disable libavutil build
121 --disable-swscale disable libswscale build
122 --disable-avfilter disable video filter support [no]
123 --disable-avresample disable libavresample build [no]
124 --disable-pthreads disable pthreads [auto]
125 --disable-w32threads disable Win32 threads [auto]
126 --disable-network disable network support [no]
127 --disable-dct disable DCT code
128 --disable-error-resilience disable error resilience code
129 --disable-lsp disable LSP code
130 --disable-lzo disable LZO decoder code
131 --disable-mdct disable MDCT code
132 --disable-rdft disable RDFT code
133 --disable-fft disable FFT code
134 --disable-faan disable floating point AAN (I)DCT code
136 Individual component options:
137 --disable-everything disable all components listed below
138 --disable-encoder=NAME disable encoder NAME
139 --enable-encoder=NAME enable encoder NAME
140 --disable-encoders disable all encoders
141 --disable-decoder=NAME disable decoder NAME
142 --enable-decoder=NAME enable decoder NAME
143 --disable-decoders disable all decoders
144 --disable-hwaccel=NAME disable hwaccel NAME
145 --enable-hwaccel=NAME enable hwaccel NAME
146 --disable-hwaccels disable all hwaccels
147 --disable-muxer=NAME disable muxer NAME
148 --enable-muxer=NAME enable muxer NAME
149 --disable-muxers disable all muxers
150 --disable-demuxer=NAME disable demuxer NAME
151 --enable-demuxer=NAME enable demuxer NAME
152 --disable-demuxers disable all demuxers
153 --enable-parser=NAME enable parser NAME
154 --disable-parser=NAME disable parser NAME
155 --disable-parsers disable all parsers
156 --enable-bsf=NAME enable bitstream filter NAME
157 --disable-bsf=NAME disable bitstream filter NAME
158 --disable-bsfs disable all bitstream filters
159 --enable-protocol=NAME enable protocol NAME
160 --disable-protocol=NAME disable protocol NAME
161 --disable-protocols disable all protocols
162 --enable-indev=NAME enable input device NAME
163 --disable-indev=NAME disable input device NAME
164 --disable-indevs disable input devices
165 --disable-devices disable all devices
166 --enable-filter=NAME enable filter NAME
167 --disable-filter=NAME disable filter NAME
168 --disable-filters disable all filters
170 External library support:
172 Using any of the following switches will allow Libav to link to the
173 corresponding external library. All the components depending on that library
174 will become enabled, if all their other dependencies are met and they are not
175 explicitly disabled. E.g. --enable-libwavpack will enable linking to
176 libwavpack and allow the libwavpack encoder to be built, unless it is
177 specifically disabled with --disable-encoder=libwavpack.
179 Note that only the system libraries are auto-detected. All the other external
180 libraries must be explicitly enabled.
182 Also note that the following help text describes the purpose of the libraries
183 themselves, not all their features will necessarily be usable by Libav.
185 --enable-avisynth video frameserver
186 --enable-avxsynth Linux version of AviSynth
187 --enable-bzlib bzip2 compression [autodetect]
188 --enable-frei0r video filtering plugins
189 --enable-gnutls crypto
190 --enable-libbs2b Bauer stereophonic-to-binaural DSP
191 --enable-libcdio audio CD input
192 --enable-libdc1394 IEEE 1394/Firewire camera input
193 --enable-libdcadec DCA audio decoding
194 --enable-libfaac AAC audio encoding
195 --enable-libfdk-aac AAC audio encoding/decoding
196 --enable-libfontconfig font configuration and management
197 --enable-libfreetype font rendering
198 --enable-libgsm GSM audio encoding/decoding
199 --enable-libhdcd HDCD decoding filter
200 --enable-libilbc ILBC audio encoding/decoding
201 --enable-libjack JACK audio sound server
202 --enable-libkvazaar HEVC video encoding
203 --enable-libmp3lame MP3 audio encoding
204 --enable-libopencore-amrnb AMR-NB audio encoding/decoding
205 --enable-libopencore-amrwb AMR-WB audio decoding
206 --enable-libopencv computer vision
207 --enable-libopenh264 H.264 video encoding/decoding
208 --enable-libopenjpeg JPEG 2000 image encoding/decoding
209 --enable-libopus Opus audio encoding/decoding
210 --enable-libpulse Pulseaudio sound server
211 --enable-librtmp RTMP streaming
212 --enable-libschroedinger Dirac video encoding/decoding
213 --enable-libsnappy snappy compression
214 --enable-libspeex Speex audio encoding/decoding
215 --enable-libtheora Theora video encoding/decoding
216 --enable-libtwolame MP2 audio encoding
217 --enable-libvo-aacenc AAC audio encoding
218 --enable-libvo-amrwbenc AMR-WB audio encoding
219 --enable-libvorbis Vorbis audio encoding/decoding
220 --enable-libvpx VP* video encoding/decoding
221 --enable-libwavpack Wavpack audio encoding/decoding
222 --enable-libwebp WebP image encoding/decoding
223 --enable-libx264 H.264 video encoding
224 --enable-libx265 HEVC video encoding
225 --enable-libxavs Chinese AVS video encoding
226 --enable-libxcb X window system protocol communication
227 --enable-libxcb-shm X11 shm communication [auto]
228 --enable-libxcb-xfixes X11 mouse rendering [auto]
229 --enable-libxvid MPEG-4 ASP video encoding
230 --enable-openssl crypto
231 --enable-zlib compression [autodetect]
233 The following libraries provide various hardware acceleration features:
234 --enable-amf AMF video encoding code [auto]
235 --enable-cuda Nvidia CUDA (dynamically linked)
236 --enable-cuvid Nvidia CUVID video decode acceleration
237 --enable-d3d11va Microsoft Direct3D 11 video acceleration [auto]
238 --enable-dxva2 Microsoft DirectX 9 video acceleration [auto]
239 --enable-libmfx Intel MediaSDK (AKA Quick Sync Video)
240 --enable-libnpp Nvidia CUDA processing
241 --enable-mmal Broadcom Multi-Media Abstraction Layer (Raspberry Pi)
242 --enable-nvenc Nvidia video encoding
243 --enable-omx OpenMAX IL
244 --enable-omx-rpi OpenMAX IL for Raspberry Pi
245 --enable-vaapi Video Acceleration API (mainly Unix/Intel)
246 --enable-vda Apple Video Decode Acceleration [auto]
247 --enable-vdpau Nvidia Video Decode and Presentation API for Unix [auto]
250 --arch=ARCH select architecture [$arch]
251 --cpu=CPU select the minimum required CPU (affects
252 instruction selection, may crash on older CPUs)
253 --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
254 --enable-cross-compile assume a cross-compiler is used
255 --sysroot=PATH root of cross-build tree
256 --sysinclude=PATH location of cross-build system headers
257 --target-os=OS compiler targets OS [$target_os]
258 --target-exec=CMD command to run executables on target
259 --target-path=DIR path to view of build directory on target
260 --target-samples=DIR path to samples directory on target
261 --toolchain=NAME set tool defaults according to NAME
263 --ar=AR use archive tool AR [$ar_default]
264 --as=AS use assembler AS [$as_default]
265 --cc=CC use C compiler CC [$cc_default]
266 --objcc=OCC use ObjC compiler OCC [$cc_default]
267 --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
268 --ld=LD use linker LD
269 --x86asmexe=X86ASM use x86 assembler X86ASM
270 --pkg-config=PKGCONFIG use pkg-config tool PKGCONFIG [$pkg_config_default]
271 --pkg-config-flags=FLAGS pass additional flags to pkgconf []
272 --host-cc=HOSTCC use host C compiler HOSTCC
273 --host-cflags=HCFLAGS use HCFLAGS when compiling for host
274 --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
275 --host-ld=HOSTLD use host linker HOSTLD
276 --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
277 --host-libs=HLIBS use libs HLIBS when linking for host
278 --host-os=OS compiler host OS [$target_os]
279 --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
280 --extra-objcflags=FLAGS add FLAGS to OBJCFLAGS [$CFLAGS]
281 --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
282 --extra-ldexeflags=ELDFLAGS add ELDFLAGS to LDEXEFLAGS [$LDEXEFLAGS]
283 --extra-ldsoflags=ELDFLAGS add ELDFLAGS to LDSOFLAGS [$LDSOFLAGS]
284 --extra-libs=ELIBS add ELIBS [$ELIBS]
285 --extra-version=STRING version string suffix []
286 --optflags=OPTFLAGS override optimization-related compiler flags
287 --enable-pic build position-independent code
288 --enable-thumb compile for Thumb instruction set
289 --enable-lto use link-time optimization
290 --env="ENV=override" override the environment variables
292 Advanced options (experts only):
293 --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
294 --custom-allocator=NAME use a supported custom allocator
295 --disable-symver disable symbol versioning
296 --enable-hardcoded-tables use hardcoded tables instead of runtime generation
297 --disable-safe-bitstream-reader
298 disable buffer boundary checking in bitreaders
299 (faster, but may crash)
300 --enable-sram allow use of on-chip SRAM
302 Optimization options (experts only):
303 --disable-asm disable all assembly optimizations
304 --disable-altivec disable AltiVec optimizations
305 --disable-vsx disable VSX optimizations
306 --disable-power8 disable POWER8 optimizations
307 --disable-amd3dnow disable 3DNow! optimizations
308 --disable-amd3dnowext disable 3DNow! extended optimizations
309 --disable-mmx disable MMX optimizations
310 --disable-mmxext disable MMXEXT optimizations
311 --disable-sse disable SSE optimizations
312 --disable-sse2 disable SSE2 optimizations
313 --disable-sse3 disable SSE3 optimizations
314 --disable-ssse3 disable SSSE3 optimizations
315 --disable-sse4 disable SSE4 optimizations
316 --disable-sse42 disable SSE4.2 optimizations
317 --disable-avx disable AVX optimizations
318 --disable-xop disable XOP optimizations
319 --disable-fma3 disable FMA3 optimizations
320 --disable-fma4 disable FMA4 optimizations
321 --disable-avx2 disable AVX2 optimizations
322 --disable-armv5te disable armv5te optimizations
323 --disable-armv6 disable armv6 optimizations
324 --disable-armv6t2 disable armv6t2 optimizations
325 --disable-vfp disable VFP optimizations
326 --disable-neon disable NEON optimizations
327 --disable-inline-asm disable use of inline assembly
328 --disable-x86asm disable use of standalone x86 assembly
330 Developer options (useful when working on Libav itself):
331 --disable-debug disable debugging symbols
332 --enable-debug=LEVEL set the debug level [$debuglevel]
333 --disable-optimizations disable compiler optimizations
334 --enable-extra-warnings enable more compiler warnings
335 --samples=PATH location of test samples for FATE, if not set use
336 \$LIBAV_SAMPLES at make invocation time.
337 --enable-neon-clobber-test check NEON registers for clobbering (should be
338 used only for debugging purposes)
339 --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
340 should be used only for debugging purposes)
341 --disable-valgrind-backtrace do not print a backtrace under Valgrind
342 (only applies to --disable-optimizations builds)
343 --ignore-tests=TESTS comma-separated list (without "fate-" prefix
344 in the name) of tests whose result is ignored
346 NOTE: Object files are built at the place where configure is launched.
352 echo "$@" >> $logfile
359 printf '%5s %s\n' "${i}" "${line}"
361 done < $1 >> $logfile
372 WARNINGS="${WARNINGS}WARNING: $*\n"
379 If you think configure made a mistake, make sure you are using the latest
380 version from Git. If the latest version fails, report the problem to the
381 libav-tools@libav.org mailing list or IRC #libav on irc.freenode.net.
383 if disabled logging; then
385 Rerun configure with logging enabled (do not use --disable-logging), and
386 include the log this produces with your report.
390 Include the log file "$logfile" produced by configure as this will help
397 # Avoid locale weirdness, besides we really just want to translate ASCII.
399 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
403 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
407 echo "$*" | sed 's/["\\]/\\\0/g'
411 v=$(echo "$1" | sed "s/'/'\\\\''/g")
412 test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
417 echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//'
424 eval "case '$v' in $pat) printf '%s ' '$v' ;; esac"
432 eval "case '$v' in $pat) ;; *) printf '%s ' '$v' ;; esac"
439 for v; do eval $m; done
445 for v; do echo ${v}${suffix}; done
460 eval : \${$var:=$value}
465 echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
471 eval $(sanitize_var_name "$var")='$*'
475 eval echo \$$(sanitize_var_name "$1")
480 eval level=\${${pvar}_level:=0}
481 eval ${pvar}_${level}="\$$pvar"
482 eval ${pvar}_level=$(($level+1))
488 eval level=\${${pvar}_level:-0}
489 test $level = 0 && continue
490 eval level=$(($level-1))
491 eval $pvar="\${${pvar}_${level}}"
492 eval ${pvar}_level=$level
493 eval unset ${pvar}_${level}
515 enable $(sanitize_var_name $var)
521 disable $(sanitize_var_name $var)
527 enabled $var && continue
528 eval sel="\$${var}_select"
529 eval sgs="\$${var}_suggest"
533 enable_deep_weak $sgs
545 disabled $var && continue
554 test "${1#!}" = "$1" && op="=" || op="!="
555 eval test "x\$${1#!}" $op "xyes"
559 test "${1#!}" = "$1" && op="=" || op="!="
560 eval test "x\$${1#!}" $op "xno"
565 enabled $opt || return 1
571 disabled $opt || return 1
577 enabled $opt && return 0
583 disabled $opt && return 0
590 eval : \${$opt:=\$${opt}_default}
598 [ $var = $value ] && return 0
605 enabled ${cfg}_checking && die "Circular dependency for $cfg."
606 disabled ${cfg}_checking && continue
607 enable ${cfg}_checking
609 eval dep_all="\$${cfg}_deps"
610 eval dep_any="\$${cfg}_deps_any"
611 eval dep_con="\$${cfg}_conflict"
612 eval dep_sel="\$${cfg}_select"
613 eval dep_sgs="\$${cfg}_suggest"
614 eval dep_ifa="\$${cfg}_if"
615 eval dep_ifn="\$${cfg}_if_any"
617 pushvar cfg dep_all dep_any dep_con dep_sel dep_sgs dep_ifa dep_ifn
618 check_deps $dep_all $dep_any $dep_con $dep_sel $dep_sgs $dep_ifa $dep_ifn
619 popvar cfg dep_all dep_any dep_con dep_sel dep_sgs dep_ifa dep_ifn
621 [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
622 [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
623 enabled_all $dep_all || disable $cfg
624 enabled_any $dep_any || disable $cfg
625 disabled_all $dep_con || disable $cfg
626 disabled_any $dep_sel && disable $cfg
628 enabled $cfg && enable_deep_weak $dep_sel $dep_sgs
630 for dep in $dep_all $dep_any $dep_sel $dep_sgs; do
631 # filter out library deps, these do not belong in extralibs
632 is_in $dep $LIBRARY_LIST && continue
633 enabled $dep && eval append ${cfg}_extralibs ${dep}_extralibs
636 disable ${cfg}_checking
644 map 'eval echo "$v \${$v:-no}"' "$@" |
645 awk "BEGIN { split(\"$files\", files) }
647 c = \"$pfx\" toupper(\$1);
653 if (file ~ /\\.h\$/) {
654 printf(\"#define %s %d\\n\", c, v) >>file;
655 } else if (file ~ /\\.asm\$/) {
656 printf(\"%%define %s %d\\n\", c, v) >>file;
657 } else if (file ~ /\\.mak\$/) {
658 n = -v ? \"\" : \"!\";
659 printf(\"%s%s=yes\\n\", n, c) >>file;
669 enabled $v && printf "%s\n" ${v%$suf}
676 eval "$var=\"\$$var $*\""
682 eval "$var=\"$* \$$var\""
688 for tok in $(eval echo \$$var); do
689 uniq_list="$(filter_out $tok $uniq_list) $tok"
691 eval "$var=\"${uniq_list}\""
697 for entry in $(eval echo \$$var); do
698 tmpvar="$tmpvar $(eval echo \$${entry})"
700 eval "$var=\"${tmpvar}\""
708 append CFLAGS $($cflags_filter "$@")
711 add_cflags_headers(){
712 append CFLAGS_HEADERS $($cflags_filter "$@")
716 append ASFLAGS $($asflags_filter "$@")
720 append OBJCFLAGS $($objcflags_filter "$@")
724 append LDFLAGS $($ldflags_filter "$@")
728 append LDEXEFLAGS $($ldflags_filter "$@")
732 append LDSOFLAGS $($ldflags_filter "$@")
736 append STRIPFLAGS "$@"
740 prepend extralibs $($ldflags_filter "$@")
744 append host_cppflags "$@"
748 append host_cflags $($host_cflags_filter "$@")
752 append host_ldflags $($host_ldflags_filter "$@")
756 append compat_objs $1
758 map 'add_cppflags -D$v' "$@"
763 "$@" >> $logfile 2>&1
767 eval printf '%s\\n' $CC_O
771 eval printf '%s\\n' $CC_E
778 test_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
785 test_cmd $objcc $CPPFLAGS $CFLAGS $OBJCFLAGS "$@" $OBJCC_C $(cc_o $TMPO) $TMPC
792 test_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
796 eval printf '%s\\n' $AS_O
803 test_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
809 disabled $cmd && return
811 test_cmd $@ && enable $cmd
815 log check_inline_asm "$@"
820 test_cc "$@" <<EOF && enable $name
821 void foo(void){ __asm__ volatile($code); }
827 check_inline_asm ${1}_inline "$2"
828 echo "$2" | test_as && enable ${1}_external || disable ${1}_external
836 test_cmd $x86asmexe $X86ASMFLAGS "$@" -o $TMPO $TMPS
840 eval printf '%s\\n' $LD_O
845 flags=$(filter_out '-l*' "$@")
846 libs=$(filter '-l*' "$@")
847 test_cc $($cflags_filter $flags) || return
848 flags=$($ldflags_filter $flags)
849 libs=$($ldflags_filter $libs)
850 test_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
855 test "${hdr%.h}" = "${hdr}" &&
856 echo "#include $hdr" ||
857 echo "#include <$hdr>"
867 for hdr in $headers; do
870 echo "int main(void) { $code; return 0; }"
875 log check_cppflags "$@"
876 test_cpp "$@" <<EOF && add_cppflags "$@"
883 set -- $($cflags_filter "$@")
890 log check_cflags "$@"
891 test_cflags "$@" && add_cflags "$@"
895 log test_objcflags "$@"
896 set -- $($objcflags_filter "$@")
897 test_objcc "$@" <<EOF
903 log check_objcflags "$@"
904 test_objcflags "$@" && add_objcflags "$@"
908 log test_ldflags "$@"
909 set -- $($ldflags_filter "$@")
911 int main(void){ return 0; }
916 log check_ldflags "$@"
917 test_ldflags "$@" && add_ldflags "$@"
921 log test_stripflags "$@"
922 # call test_cc to get a fresh TMPO
924 int main(void) { return 0; }
926 test_cmd $strip $STRIPFLAGS "$@" $TMPO
930 log check_stripflags "$@"
931 test_stripflags "$@" && add_stripflags "$@"
935 log check_header "$@"
938 disable_sanitized $headers
940 for hdr in $headers; do
944 } | test_cpp "$@" && enable_sanitized $headers
952 test_ld "$@" <<EOF && enable $func
954 int main(void){ $func(); }
959 log check_mathfunc "$@"
963 test $narg = 2 && args="f, g" || args="f"
965 test_ld "$@" <<EOF && enable $func
967 float foo(float f, float g) { return $func($args); }
968 int main(void){ return 0; }
972 check_func_headers(){
973 log check_func_headers "$@"
978 for hdr in $headers; do
981 for func in $funcs; do
982 echo "long check_$func(void) { return (long) $func; }"
984 echo "int main(void) { return 0; }"
985 } | test_ld "$@" && enable $funcs && enable_sanitized $headers
988 test_cpp_condition(){
989 log test_cpp_condition "$@"
996 #error "unsatisfied condition: $condition"
1001 check_cpp_condition(){
1002 log check_cpp_condition "$@"
1006 test_cpp_condition "$@" && enable $name
1010 log test_cflags_cpp "$@"
1014 set -- $($cflags_filter "$flags")
1017 #error "unsatisfied condition: $condition"
1029 check_func_headers "$headers" "$funcs" "$@" &&
1030 enable $name && eval ${name}_extralibs="\$@"
1034 log test_pkg_config "$@"
1042 test_cmd $pkg_config --exists --print-errors $pkg_version || return
1043 pkg_cflags=$($pkg_config --cflags $pkg_config_flags $pkg)
1044 pkg_libs=$($pkg_config --libs $pkg_config_flags $pkg)
1045 check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
1047 set_sanitized "${name}_cflags" $pkg_cflags &&
1048 set_sanitized "${name}_extralibs" $pkg_libs
1052 log check_pkg_config "$@"
1054 test_pkg_config "$@" &&
1055 eval add_cflags \$${name}_cflags
1060 test_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
1064 log check_exec_crash "$@"
1067 # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
1068 # are safe but may not be available everywhere. Thus we use
1069 # raise(SIGTERM) instead. The check is run in a subshell so we
1070 # can redirect the "Terminated" message from the shell. SIGBUS
1071 # is not defined by standard C so it is used conditionally.
1073 (test_exec "$@") >> $logfile 2>&1 <<EOF
1075 static void sighandler(int sig){
1081 int (*func_ptr)(void) = foo;
1083 signal(SIGILL, sighandler);
1084 signal(SIGFPE, sighandler);
1085 signal(SIGSEGV, sighandler);
1087 signal(SIGBUS, sighandler);
1099 disable_sanitized "$type"
1100 test_code cc "$headers" "$type v" "$@" && enable_sanitized "$type"
1104 log check_struct "$@"
1109 disable_sanitized "${struct}_${member}"
1110 test_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
1111 enable_sanitized "${struct}_${member}"
1115 log check_builtin "$@"
1119 test_code ld "$@" && enable "$name"
1122 check_compile_assert(){
1123 log check_compile_assert "$@"
1129 test_code cc "$headers" "char c[2 * !!($condition) - 1]" "$@" && enable "$name"
1137 check_lib $name "$@" || die "ERROR: $name_version not found"
1141 log require_header "$@"
1143 check_header "$@" || die "ERROR: $headers not found"
1146 require_cpp_condition(){
1147 log require_cpp_condition "$@"
1149 test_cpp_condition "$@" || die "ERROR: $condition not satisfied"
1152 require_pkg_config(){
1153 log require_pkg_config "$@"
1155 check_pkg_config "$@" || die "ERROR: $pkg_version not found"
1159 eval printf '%s\\n' $HOSTCC_E
1163 eval printf '%s\\n' $HOSTCC_O
1167 log test_host_cc "$@"
1170 test_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
1174 log test_host_cpp "$@"
1177 test_cmd $host_cc $host_cppflags $host_cflags "$@" $(hostcc_e $TMPO) $TMPC
1180 check_host_cppflags(){
1181 log check_host_cppflags "$@"
1182 test_host_cpp "$@" <<EOF && append host_cppflags "$@"
1183 #include <stdlib.h>;
1187 check_host_cflags(){
1188 log check_host_cflags "$@"
1189 set -- $($host_cflags_filter "$@")
1190 test_host_cc "$@" <<EOF && append host_cflags "$@"
1195 test_host_cpp_condition(){
1196 log test_host_cpp_condition "$@"
1200 test_host_cpp "$@" <<EOF
1203 #error "unsatisfied condition: $condition"
1208 check_host_cpp_condition(){
1209 log check_host_cpp_condition "$@"
1213 test_host_cpp_condition "$@" && enable $name
1217 cmp -s "$1" "$2" && { test "$quiet" != "yes" && echo "$2 is unchanged"; } && return
1218 mkdir -p "$(dirname $2)"
1222 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
1223 # system-dependent things.
1225 AVCODEC_COMPONENTS="
1233 AVDEVICE_COMPONENTS="
1236 AVFILTER_COMPONENTS="
1239 AVFORMAT_COMPONENTS="
1247 $AVDEVICE_COMPONENTS
1248 $AVFILTER_COMPONENTS
1249 $AVFORMAT_COMPONENTS
1253 decode_audio_example
1254 decode_video_example
1255 encode_audio_example
1256 encode_video_example
1257 filter_audio_example
1261 transcode_aac_example
1264 # catchall list of things that require external libs to link
1270 HWACCEL_LIBRARY_NONFREE_LIST="
1275 HWACCEL_LIBRARY_LIST="
1276 $HWACCEL_LIBRARY_NONFREE_LIST
1289 EXTERNAL_LIBRARY_GPL_LIST="
1297 EXTERNAL_LIBRARY_NONFREE_LIST="
1303 EXTERNAL_LIBRARY_VERSION3_LIST="
1310 EXTERNAL_LIBRARY_LIST="
1311 $EXTERNAL_LIBRARY_GPL_LIST
1312 $EXTERNAL_LIBRARY_NONFREE_LIST
1313 $EXTERNAL_LIBRARY_VERSION3_LIST
1349 SYSTEM_LIBRARY_LIST="
1359 safe_bitstream_reader
1402 # COMPONENT_LIST needs to come last to ensure correct dependency checking
1405 $EXTERNAL_LIBRARY_LIST
1406 $HWACCEL_LIBRARY_LIST
1412 $SYSTEM_LIBRARY_LIST
1471 ARCH_EXT_LIST_X86_SIMD="
1499 $ARCH_EXT_LIST_X86_SIMD
1504 ARCH_EXT_LIST_MIPS="
1541 sync_val_compare_and_swap
1555 AVFoundation_AVFoundation_h
1558 cdio_paranoia_paranoia_h
1560 dev_bktr_ioctl_bt848_h
1561 dev_bktr_ioctl_meteor_h
1563 dev_video_bktr_ioctl_bt848_h
1564 dev_video_meteor_ioctl_meteor_h
1569 machine_ioctl_bt848_h
1570 machine_ioctl_meteor_h
1620 MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS
1635 GetProcessAffinityMask
1636 GetProcessMemoryInfo
1639 GetSystemTimeAsFileTime
1653 SetConsoleTextAttribute
1673 TOOLCHAIN_FEATURES="
1694 CONDITION_VARIABLE_Ptr
1695 CUVIDDECODECREATEINFO_bitDepthMinus8
1698 struct_group_source_req
1699 struct_ip_mreq_source
1702 struct_rusage_ru_maxrss
1704 struct_sockaddr_sa_len
1705 struct_sockaddr_storage
1706 struct_v4l2_frmivalenum_discrete
1711 $(add_suffix _external $ARCH_EXT_LIST)
1712 $(add_suffix _inline $ARCH_EXT_LIST)
1728 # options emitted with CONFIG_ prefix but not available on the command line
1883 # code dependency declarations
1885 # architecture extensions
1890 armv8_deps="aarch64"
1891 neon_deps_any="aarch64 arm"
1892 intrinsics_neon_deps="neon"
1893 vfp_deps_any="aarch64 arm"
1896 map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
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"
1916 x86_64_select="i686"
1917 x86_64_suggest="fast_cmov"
1920 amd3dnowext_deps="amd3dnow"
1936 mmx_external_deps="x86asm"
1937 mmx_inline_deps="inline_asm x86"
1938 mmx_suggest="mmx_external mmx_inline"
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"'
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"
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"
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"
1968 cbs_h264_select="cbs golomb"
1969 cbs_h265_select="cbs golomb"
1970 cbs_mpeg2_select="cbs"
1972 dirac_parse_select="golomb"
1973 error_resilience_select="me_cmp"
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"
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"
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"
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"
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_vaapi_hwaccel_deps="vaapi"
2207 h264_vaapi_hwaccel_select="h264_decoder"
2208 h264_vda_hwaccel_deps="vda"
2209 h264_vda_hwaccel_select="h264_decoder"
2210 h264_vda_old_hwaccel_deps="vda"
2211 h264_vda_old_hwaccel_select="h264_decoder"
2212 h264_vdpau_hwaccel_deps="vdpau"
2213 h264_vdpau_hwaccel_select="h264_decoder"
2214 hevc_cuvid_hwaccel_deps="cuvid CUVIDHEVCPICPARAMS"
2215 hevc_cuvid_hwaccel_select="hevc_decoder"
2216 hevc_d3d11va_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2217 hevc_d3d11va_hwaccel_select="hevc_decoder"
2218 hevc_d3d11va2_hwaccel_deps="d3d11va DXVA_PicParams_HEVC"
2219 hevc_d3d11va2_hwaccel_select="hevc_decoder"
2220 hevc_dxva2_hwaccel_deps="dxva2 DXVA_PicParams_HEVC"
2221 hevc_dxva2_hwaccel_select="hevc_decoder"
2222 hevc_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferHEVC"
2223 hevc_vaapi_hwaccel_select="hevc_decoder"
2224 hevc_vdpau_hwaccel_deps="vdpau VdpPictureInfoHEVC"
2225 hevc_vdpau_hwaccel_select="hevc_decoder"
2226 mpeg1_vdpau_hwaccel_deps="vdpau"
2227 mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
2228 mpeg2_d3d11va_hwaccel_deps="d3d11va"
2229 mpeg2_d3d11va_hwaccel_select="mpeg2video_decoder"
2230 mpeg2_d3d11va2_hwaccel_deps="d3d11va"
2231 mpeg2_d3d11va2_hwaccel_select="mpeg2video_decoder"
2232 mpeg2_dxva2_hwaccel_deps="dxva2"
2233 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
2234 mpeg2_vaapi_hwaccel_deps="vaapi"
2235 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
2236 mpeg2_vdpau_hwaccel_deps="vdpau"
2237 mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
2238 mpeg4_vaapi_hwaccel_deps="vaapi"
2239 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
2240 mpeg4_vdpau_hwaccel_deps="vdpau"
2241 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
2242 vc1_d3d11va_hwaccel_deps="d3d11va"
2243 vc1_d3d11va_hwaccel_select="vc1_decoder"
2244 vc1_d3d11va2_hwaccel_deps="d3d11va"
2245 vc1_d3d11va2_hwaccel_select="vc1_decoder"
2246 vc1_dxva2_hwaccel_deps="dxva2"
2247 vc1_dxva2_hwaccel_select="vc1_decoder"
2248 vc1_vaapi_hwaccel_deps="vaapi"
2249 vc1_vaapi_hwaccel_select="vc1_decoder"
2250 vc1_vdpau_hwaccel_deps="vdpau"
2251 vc1_vdpau_hwaccel_select="vc1_decoder"
2252 vp8_vaapi_hwaccel_deps="vaapi VAPictureParameterBufferVP8"
2253 vp8_vaapi_hwaccel_select="vp8_decoder"
2254 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
2255 wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
2256 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
2257 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
2258 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
2260 # hardware-accelerated codecs
2261 amf_deps_any="libdl LoadLibrary"
2262 nvenc_deps_any="libdl LoadLibrary"
2263 omx_deps="libdl pthreads"
2264 omx_rpi_select="omx"
2269 vaapi_encode_deps="vaapi"
2271 hwupload_cuda_filter_deps="cuda"
2272 scale_npp_filter_deps="cuda libnpp"
2274 h264_amf_encoder_deps="amf"
2275 h264_mmal_decoder_deps="mmal"
2276 h264_nvenc_encoder_deps="nvenc"
2277 h264_omx_encoder_deps="omx"
2278 h264_qsv_decoder_select="h264_mp4toannexb_bsf h264_parser qsvdec"
2279 h264_qsv_encoder_select="qsvenc"
2280 h264_vaapi_encoder_deps="VAEncPictureParameterBufferH264"
2281 h264_vaapi_encoder_select="cbs_h264 vaapi_encode"
2282 hevc_amf_encoder_deps="amf"
2283 hevc_nvenc_encoder_deps="nvenc"
2284 hevc_qsv_decoder_select="hevc_mp4toannexb_bsf hevc_parser qsvdec"
2285 hevc_qsv_encoder_select="hevcparse qsvenc"
2286 hevc_vaapi_encoder_deps="VAEncPictureParameterBufferHEVC"
2287 hevc_vaapi_encoder_select="cbs_h265 vaapi_encode"
2288 mjpeg_qsv_encoder_deps="libmfx"
2289 mjpeg_qsv_encoder_select="qsvenc"
2290 mjpeg_vaapi_encoder_deps="VAEncPictureParameterBufferJPEG"
2291 mjpeg_vaapi_encoder_select="vaapi_encode jpegtables"
2292 mpeg2_mmal_decoder_deps="mmal"
2293 mpeg2_qsv_decoder_select="qsvdec mpegvideo_parser"
2294 mpeg2_qsv_encoder_select="qsvenc"
2295 mpeg2_vaapi_encoder_deps="VAEncPictureParameterBufferMPEG2"
2296 mpeg2_vaapi_encoder_select="cbs_mpeg2 vaapi_encode"
2297 mpeg4_omx_encoder_deps="omx"
2298 vc1_mmal_decoder_deps="mmal"
2299 vc1_qsv_decoder_select="qsvdec vc1_parser"
2300 vp8_qsv_decoder_select="qsvdec vp8_parser"
2301 vp8_vaapi_encoder_deps="VAEncPictureParameterBufferVP8"
2302 vp8_vaapi_encoder_select="vaapi_encode"
2303 vp9_vaapi_encoder_deps="VAEncPictureParameterBufferVP9"
2304 vp9_vaapi_encoder_select="vaapi_encode"
2306 nvenc_h264_encoder_select="h264_nvenc_encoder"
2307 nvenc_hevc_encoder_select="hevc_nvenc_encoder"
2310 aac_parser_select="adts_header"
2311 h264_parser_select="golomb h264dsp h264parse"
2312 hevc_parser_select="hevcparse"
2313 mpegaudio_parser_select="mpegaudioheader"
2314 mpegvideo_parser_select="mpegvideo"
2315 mpeg4video_parser_select="error_resilience h263dsp mpegvideo qpeldsp"
2316 vc1_parser_select="vc1dsp"
2319 aac_adtstoasc_bsf_select="adts_header"
2320 h264_metadata_bsf_select="cbs_h264"
2321 h264_redundant_pps_bsf_select="cbs_h264"
2322 hevc_metadata_bsf_select="cbs_h265"
2323 mjpeg2jpeg_bsf_select="jpegtables"
2324 mpeg2_metadata_bsf_select="cbs_mpeg2"
2325 trace_headers_bsf_select="cbs_h264 cbs_h265 cbs_mpeg2"
2327 # external libraries
2328 avisynth_deps="LoadLibrary"
2329 avxsynth_deps="libdl"
2330 avisynth_demuxer_deps_any="avisynth avxsynth"
2331 avisynth_demuxer_select="riffdec"
2332 libdcadec_decoder_deps="libdcadec"
2333 libfaac_encoder_deps="libfaac"
2334 libfaac_encoder_select="audio_frame_queue"
2335 libfdk_aac_decoder_deps="libfdk_aac"
2336 libfdk_aac_encoder_deps="libfdk_aac"
2337 libfdk_aac_encoder_select="audio_frame_queue"
2338 libgsm_decoder_deps="libgsm"
2339 libgsm_encoder_deps="libgsm"
2340 libgsm_ms_decoder_deps="libgsm"
2341 libgsm_ms_encoder_deps="libgsm"
2342 libilbc_decoder_deps="libilbc"
2343 libilbc_encoder_deps="libilbc"
2344 libkvazaar_encoder_deps="libkvazaar"
2345 libmp3lame_encoder_deps="libmp3lame"
2346 libmp3lame_encoder_select="audio_frame_queue mpegaudioheader"
2347 libopencore_amrnb_decoder_deps="libopencore_amrnb"
2348 libopencore_amrnb_encoder_deps="libopencore_amrnb"
2349 libopencore_amrnb_encoder_select="audio_frame_queue"
2350 libopencore_amrwb_decoder_deps="libopencore_amrwb"
2351 libopenh264_decoder_deps="libopenh264"
2352 libopenh264_decoder_select="h264_mp4toannexb_bsf"
2353 libopenh264_encoder_deps="libopenh264"
2354 libopenjpeg_decoder_deps="libopenjpeg"
2355 libopenjpeg_encoder_deps="libopenjpeg"
2356 libopus_decoder_deps="libopus"
2357 libopus_encoder_deps="libopus"
2358 libopus_encoder_select="audio_frame_queue"
2359 libschroedinger_decoder_deps="libschroedinger"
2360 libschroedinger_encoder_deps="libschroedinger"
2361 libspeex_decoder_deps="libspeex"
2362 libspeex_encoder_deps="libspeex"
2363 libspeex_encoder_select="audio_frame_queue"
2364 libtheora_encoder_deps="libtheora"
2365 libtwolame_encoder_deps="libtwolame"
2366 libvo_aacenc_encoder_deps="libvo_aacenc"
2367 libvo_aacenc_encoder_select="audio_frame_queue"
2368 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
2369 libvorbis_encoder_deps="libvorbis"
2370 libvorbis_encoder_select="audio_frame_queue"
2371 libvpx_vp8_decoder_deps="libvpx"
2372 libvpx_vp8_encoder_deps="libvpx"
2373 libvpx_vp9_decoder_deps="libvpx"
2374 libvpx_vp9_encoder_deps="libvpx"
2375 libwavpack_encoder_deps="libwavpack"
2376 libwavpack_encoder_select="audio_frame_queue"
2377 libwebp_encoder_deps="libwebp"
2378 libx262_encoder_deps="libx262"
2379 libx264_encoder_deps="libx264"
2380 libx265_encoder_deps="libx265"
2381 libxavs_encoder_deps="libxavs"
2382 libxvid_encoder_deps="libxvid mkstemp"
2385 ac3_demuxer_select="ac3_parser"
2386 asf_demuxer_select="riffdec"
2387 asf_muxer_select="riffenc"
2388 asf_stream_muxer_select="asf_muxer"
2389 avi_demuxer_select="iso_media riffdec"
2390 avi_muxer_select="riffenc"
2391 caf_demuxer_select="iso_media riffdec"
2392 dash_muxer_select="mp4_muxer"
2393 dirac_demuxer_select="dirac_parser"
2394 dv_demuxer_select="dvprofile"
2395 dv_muxer_select="dvprofile"
2396 dxa_demuxer_select="riffdec"
2397 eac3_demuxer_select="ac3_parser"
2398 f4v_muxer_select="mov_muxer"
2399 flac_demuxer_select="flac_parser"
2400 hds_muxer_select="flv_muxer"
2401 hls_muxer_select="mpegts_muxer"
2402 ipod_muxer_select="mov_muxer"
2403 ismv_muxer_select="mov_muxer"
2404 matroska_audio_muxer_select="matroska_muxer"
2405 matroska_demuxer_select="iso_media riffdec"
2406 matroska_demuxer_suggest="bzlib lzo zlib"
2407 matroska_muxer_select="iso_media riffenc"
2408 mmf_muxer_select="riffenc"
2409 mov_demuxer_select="iso_media riffdec"
2410 mov_demuxer_suggest="zlib"
2411 mov_muxer_select="iso_media riffenc rtpenc_chain"
2412 mp3_demuxer_select="mpegaudio_parser"
2413 mp3_muxer_select="mpegaudioheader"
2414 mp4_muxer_select="mov_muxer"
2415 mpegts_demuxer_select="iso_media"
2416 mpegts_muxer_select="adts_muxer latm_muxer"
2417 mpegtsraw_demuxer_select="mpegts_demuxer"
2418 mxf_d10_muxer_select="mxf_muxer"
2419 nut_muxer_select="riffenc"
2420 nuv_demuxer_select="riffdec"
2421 oga_muxer_select="ogg_muxer"
2422 ogg_demuxer_select="dirac_parse"
2423 opus_muxer_select="ogg_muxer"
2424 psp_muxer_select="mov_muxer"
2425 rtp_demuxer_select="sdp_demuxer"
2426 rtpdec_select="asf_demuxer jpegtables mov_demuxer mpegts_demuxer rm_demuxer rtp_protocol srtp"
2427 rtsp_demuxer_select="http_protocol rtpdec"
2428 rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
2429 sap_demuxer_select="sdp_demuxer"
2430 sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
2431 sdp_demuxer_select="rtpdec"
2432 smoothstreaming_muxer_select="ismv_muxer"
2433 spdif_demuxer_select="adts_header"
2434 spdif_muxer_select="adts_header"
2435 spx_muxer_select="ogg_muxer"
2436 swf_demuxer_suggest="zlib"
2437 tak_demuxer_select="tak_parser"
2438 tg2_muxer_select="mov_muxer"
2439 tgp_muxer_select="mov_muxer"
2440 w64_demuxer_select="wav_demuxer"
2441 wav_demuxer_select="riffdec"
2442 wav_muxer_select="riffenc"
2443 webm_muxer_select="iso_media riffenc"
2444 wtv_demuxer_select="mpegts_demuxer riffdec"
2445 xmv_demuxer_select="riffdec"
2446 xwma_demuxer_select="riffdec"
2449 alsa_indev_deps="alsa"
2450 avfoundation_indev_deps="AVFoundation_AVFoundation_h objc_arc pthreads"
2451 avfoundation_indev_extralibs="-framework Foundation -framework AVFoundation -framework CoreVideo -framework CoreMedia"
2452 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
2453 fbdev_indev_deps="linux_fb_h"
2454 jack_indev_deps="libjack"
2455 jack_indev_deps_any="sem_timedwait dispatch_dispatch_h"
2456 libcdio_indev_deps="libcdio"
2457 libdc1394_indev_deps="libdc1394"
2458 oss_indev_deps_any="sys_soundcard_h"
2459 pulse_indev_deps="libpulse"
2460 sndio_indev_deps="sndio"
2461 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
2462 vfwcap_indev_deps="vfw32 vfwcap_defines"
2463 xcbgrab_indev_deps="libxcb libxcb_shape"
2464 xcbgrab_indev_suggest="libxcb_shm libxcb_xfixes"
2467 ffrtmpcrypt_protocol_conflict="librtmp_protocol"
2468 ffrtmpcrypt_protocol_deps_any="gmp openssl"
2469 ffrtmpcrypt_protocol_select="tcp_protocol"
2470 ffrtmphttp_protocol_conflict="librtmp_protocol"
2471 ffrtmphttp_protocol_select="http_protocol"
2472 gopher_protocol_select="network"
2473 http_protocol_select="tcp_protocol"
2474 http_protocol_suggest="zlib"
2475 httpproxy_protocol_select="tcp_protocol"
2476 httpproxy_protocol_suggest="zlib"
2477 https_protocol_select="tls_protocol"
2478 https_protocol_suggest="zlib"
2479 icecast_protocol_select="http_protocol"
2480 librtmp_protocol_deps="librtmp"
2481 librtmpe_protocol_deps="librtmp"
2482 librtmps_protocol_deps="librtmp"
2483 librtmpt_protocol_deps="librtmp"
2484 librtmpte_protocol_deps="librtmp"
2485 mmsh_protocol_select="http_protocol"
2486 mmst_protocol_select="network"
2487 rtmp_protocol_conflict="librtmp_protocol"
2488 rtmp_protocol_select="tcp_protocol"
2489 rtmp_protocol_suggest="zlib"
2490 rtmpe_protocol_select="ffrtmpcrypt_protocol"
2491 rtmpe_protocol_suggest="zlib"
2492 rtmps_protocol_conflict="librtmp_protocol"
2493 rtmps_protocol_select="tls_protocol"
2494 rtmps_protocol_suggest="zlib"
2495 rtmpt_protocol_select="ffrtmphttp_protocol"
2496 rtmpt_protocol_suggest="zlib"
2497 rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
2498 rtmpte_protocol_suggest="zlib"
2499 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
2500 rtmpts_protocol_suggest="zlib"
2501 rtp_protocol_select="udp_protocol"
2502 sctp_protocol_deps="struct_sctp_event_subscribe"
2503 sctp_protocol_select="network"
2504 srtp_protocol_select="rtp_protocol srtp"
2505 tcp_protocol_select="network"
2506 tls_protocol_deps_any="gnutls openssl"
2507 tls_protocol_select="tcp_protocol"
2508 udp_protocol_select="network"
2509 unix_protocol_deps="sys_un_h"
2510 unix_protocol_select="network"
2513 asyncts_filter_deps="avresample"
2514 blackframe_filter_deps="gpl"
2515 boxblur_filter_deps="gpl"
2516 bs2b_filter_deps="libbs2b"
2517 cropdetect_filter_deps="gpl"
2518 deinterlace_qsv_filter_deps="libmfx"
2519 deinterlace_vaapi_filter_deps="vaapi"
2520 delogo_filter_deps="gpl"
2521 drawtext_filter_deps="libfreetype"
2522 drawtext_filter_suggest="libfontconfig"
2523 frei0r_filter_deps="frei0r libdl"
2524 frei0r_src_filter_deps="frei0r libdl"
2525 hdcd_filter_deps="libhdcd"
2526 hqdn3d_filter_deps="gpl"
2527 interlace_filter_deps="gpl"
2528 movie_filter_deps="avcodec avformat"
2529 ocv_filter_deps="libopencv"
2530 overlay_qsv_filter_deps="libmfx"
2531 overlay_qsv_filter_select="qsvvpp"
2532 resample_filter_deps="avresample"
2533 scale_filter_deps="swscale"
2534 scale_qsv_filter_deps="libmfx"
2535 scale_vaapi_filter_deps="vaapi VAProcPipelineParameterBuffer"
2536 vpp_qsv_filter_deps="libmfx"
2537 vpp_qsv_filter_select="qsvvpp"
2540 decode_audio_example_deps="avcodec avutil"
2541 decode_video_example_deps="avcodec avutil"
2542 encode_audio_example_deps="avcodec avutil"
2543 encode_video_example_deps="avcodec avutil"
2544 filter_audio_example_deps="avfilter avutil"
2545 metadata_example_deps="avformat avutil"
2546 output_example_deps="avcodec avformat avresample avutil swscale"
2547 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder"
2548 transcode_aac_example_deps="avcodec avformat avresample"
2551 cpu_init_extralibs="pthreads_extralibs"
2552 cws2fws_extralibs="zlib_extralibs"
2554 # libraries, in linking order
2555 avcodec_deps="avutil"
2556 avcodec_select="null_bsf"
2557 avdevice_deps="avformat avcodec avutil"
2558 avfilter_deps="avutil"
2559 avformat_deps="avcodec avutil"
2560 avformat_suggest="network"
2561 avresample_deps="avutil"
2562 swscale_deps="avutil"
2564 avcodec_extralibs="pthreads_extralibs libm_extralibs"
2565 avdevice_extralibs="libm_extralibs"
2566 avformat_extralibs="libm_extralibs"
2567 avfilter_extralibs="pthreads_extralibs libm_extralibs"
2568 avresample_extralibs="libm_extralibs"
2569 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"
2570 swscale_extralibs="libm_extralibs"
2573 avconv_deps="avcodec avfilter avformat avresample swscale"
2574 avconv_select="aformat_filter anull_filter asyncts_filter atrim_filter format_filter
2575 fps_filter null_filter resample_filter scale_filter
2577 avconv_suggest="psapi shell32"
2578 avplay_deps="avcodec avfilter avformat avresample sdl"
2579 avplay_select="rdft format_filter transpose_filter hflip_filter vflip_filter"
2580 avplay_suggest="shell32"
2581 avprobe_deps="avcodec avformat"
2582 avprobe_suggest="shell32"
2586 texi2html_deps="doc"
2588 # default parameters
2590 logfile="avbuild/config.log"
2592 # installation paths
2593 prefix_default="/usr/local"
2594 bindir_default='${prefix}/bin'
2595 datadir_default='${prefix}/share/avconv'
2596 docdir_default='${prefix}/share/doc/libav'
2597 incdir_default='${prefix}/include'
2598 libdir_default='${prefix}/lib'
2599 mandir_default='${prefix}/share/man'
2600 shlibdir_default="$libdir_default"
2605 host_cc_default="gcc"
2606 x86asmexe_default="nasm"
2609 pkg_config_default=pkg-config
2612 version_script='--version-script'
2616 arch_default=$(uname -m)
2621 target_os_default=$(tolower $(uname -s))
2622 host_os=$target_os_default
2624 # configurable options
2625 enable $EXAMPLE_LIST $LIBRARY_LIST $PROGRAM_LIST
2630 enable faan faandct faanidct
2631 enable optimizations
2632 enable safe_bitstream_reader
2634 enable swscale_alpha
2635 enable valgrind_backtrace
2637 # By default, enable only those hwaccels that have no external dependencies.
2638 enable d3d11va dxva2 vda vdpau
2640 # internal components are enabled by default
2641 enable $EXTRALIBS_LIST
2643 # Avoid external, non-system, libraries getting enabled by dependency resolution
2644 disable $EXTERNAL_LIBRARY_LIST
2647 SHFLAGS='-shared -Wl,-soname,$$(@F)'
2650 LIBNAME='$(LIBPREF)$(NAME)$(LIBSUF)'
2653 SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
2654 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
2655 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
2656 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
2657 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
2658 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
2659 VERSION_SCRIPT_POSTPROCESS_CMD="cat"
2682 host_extralibs='-lm'
2683 host_cflags_filter=echo
2684 host_ldflags_filter=echo
2686 target_path='$(CURDIR)'
2688 # since the object filename is not given with the -MM flag, the compiler
2689 # is only able to print the basename, and we must add the path ourselves
2690 DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
2696 if test -f configure; then
2699 source_path=$(cd $(dirname "$0"); pwd)
2700 echo "$source_path" | grep -q '[[:blank:]]' &&
2701 die "Out of tree builds are impossible with whitespace in source path."
2702 test -e "$source_path/config.h" &&
2703 die "Out of tree builds are impossible with config.h in source dir."
2710 LIBAV_CONFIGURATION="${LIBAV_CONFIGURATION# } ${l}${r}"
2716 file=$source_path/$3
2717 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
2720 ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
2721 DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
2722 PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
2723 MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
2724 DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
2725 INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
2726 FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
2728 find_things_extern(){
2731 file=$source_path/$3
2732 sed -n "s/^[^#]*extern.*$pattern *ff_\([^ ]*\)_$thing;/\1_$thing/p" "$file"
2735 BSF_LIST=$(find_things_extern bsf AVBitStreamFilter libavcodec/bitstream_filters.c)
2736 HWACCEL_LIST=$(find_things_extern hwaccel AVHWAccel libavcodec/hwaccels.h)
2737 PROTOCOL_LIST=$(find_things_extern protocol URLProtocol libavformat/protocols.c)
2739 AVCODEC_COMPONENTS_LIST="
2747 AVDEVICE_COMPONENTS_LIST="
2751 AVFILTER_COMPONENTS_LIST="
2755 AVFORMAT_COMPONENTS_LIST="
2762 $AVCODEC_COMPONENTS_LIST
2763 $AVDEVICE_COMPONENTS_LIST
2764 $AVFILTER_COMPONENTS_LIST
2765 $AVFORMAT_COMPONENTS_LIST
2768 for n in $COMPONENT_LIST; do
2769 v=$(toupper ${n%s})_LIST
2771 eval ${n}_if_any="\$$v"
2774 enable $ARCH_EXT_LIST
2777 echo "Unknown option \"$1\"."
2778 echo "See $0 --help for available options."
2783 printf "%-25s %-25s %-25s\n" $(cat | tr ' ' '\n' | sort)
2789 echo $* | sed s/$suffix//g | print_3_columns
2799 --extra-ldexeflags=*)
2800 add_ldexeflags $optval
2802 --extra-ldsoflags=*)
2803 add_ldsoflags $optval
2806 add_extralibs $optval
2812 debuglevel="$optval"
2815 disable $PROGRAM_LIST
2817 --disable-everything)
2818 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
2821 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
2822 disable $LIBRARY_LIST $PROGRAM_LIST doc
2824 --enable-*=*|--disable-*=*)
2825 eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
2826 is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
2827 eval list=\$$(toupper $thing)_LIST
2828 name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
2829 $action $(filter "$name" $list)
2831 --enable-yasm|--disable-yasm)
2832 warn "The ${opt} option is only provided for compatibility and will be\n"\
2833 "removed in the future. Use --enable-x86asm / --disable-x86asm instead."
2834 test $opt = --enable-yasm && x86asm=yes || x86asm=no
2836 --enable-?*|--disable-?*)
2837 eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
2838 if is_in $option $COMPONENT_LIST; then
2839 test $action = disable && action=unset
2840 eval $action \$$(toupper ${option%s})_LIST
2841 elif is_in $option $CMDLINE_SELECT; then
2848 NAME="${opt#--list-}"
2849 is_in $NAME $COMPONENT_LIST || die_unknown $opt
2851 eval show_list $NAME \$$(toupper $NAME)_LIST
2853 --help|-h) show_help
2855 --quiet|-q) quiet=yes
2858 optname="${opt%%=*}"
2859 optname="${optname#--}"
2860 optname=$(echo "$optname" | sed 's/-/_/g')
2861 if is_in $optname $CMDLINE_SET; then
2862 eval $optname='$optval'
2863 elif is_in $optname $CMDLINE_APPEND; then
2864 append $optname "$optval"
2876 disabled logging && logfile=/dev/null
2878 # command line configuration sanity checks
2880 # we need to build at least one lib type
2881 if ! enabled_any static shared; then
2883 At least one library type must be built.
2884 Specify --enable-static to build the static libraries or --enable-shared to
2885 build the shared libraries as well. To only build the shared libraries specify
2886 --disable-static in addition to --enable-shared.
2891 # Die early if licensing-related configure options are incompatible.
2892 die_license_disabled() {
2893 enabled $1 || { enabled $v && die "$v is $1 and --enable-$1 is not specified."; }
2896 map "die_license_disabled gpl" $EXTERNAL_LIBRARY_GPL_LIST
2897 map "die_license_disabled nonfree" $EXTERNAL_LIBRARY_NONFREE_LIST $HWACCEL_LIBRARY_NONFREE_LIST
2898 map "die_license_disabled version3" $EXTERNAL_LIBRARY_VERSION3_LIST
2900 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
2902 if enabled nonfree; then
2903 license="nonfree and unredistributable"
2904 elif enabled gplv3; then
2905 license="GPL version 3 or later"
2906 elif enabled lgplv3; then
2907 license="LGPL version 3 or later"
2908 elif enabled gpl; then
2909 license="GPL version 2 or later"
2911 license="LGPL version 2.1 or later"
2914 enabled_all gnutls openssl &&
2915 die "GnuTLS and OpenSSL must not be enabled at the same time."
2917 # Disable all the library-specific components if the library itself
2918 # is disabled, see AVCODEC_LIST and following _LIST variables.
2920 disable_components(){
2921 disabled ${1} && disable $(
2922 eval components="\$$(toupper ${1})_COMPONENTS"
2923 map 'eval echo \${$(toupper ${v%s})_LIST}' $components
2927 map 'disable_components $v' $LIBRARY_LIST
2929 echo "# $0 $LIBAV_CONFIGURATION" > $logfile
2932 case "$toolchain" in
2934 cc_default="${toolchain%-asan}"
2935 add_cflags -fsanitize=address
2936 add_ldflags -fsanitize=address
2939 cc_default="${toolchain%-msan}"
2940 add_cflags -fsanitize=memory -fsanitize-memory-track-origins
2941 add_ldflags -fsanitize=memory
2944 cc_default="${toolchain%-tsan}"
2945 add_cflags -fsanitize=thread -fPIE
2946 add_ldflags -fsanitize=thread -pie
2947 case "$toolchain" in
2955 cc_default="${toolchain%-usan}"
2956 add_cflags -fsanitize=undefined
2957 add_ldflags -fsanitize=undefined
2958 case "$toolchain" in
2965 target_exec_default="valgrind"
2966 case "$toolchain" in
2968 target_exec_args="--alloc-fn=av_malloc --alloc-fn=av_mallocz"
2971 target_exec_args="--track-origins=yes --leak-check=full"
2976 # Check whether the current MSVC version needs the C99 converter.
2977 # From MSVC 2013 (compiler major version 18) onwards, it does actually
2978 # support enough of C99 to build libav. Default to the new
2979 # behaviour if the regexp was unable to match anything, since this
2980 # successfully parses the version number of existing supported
2981 # versions that require the converter (MSVC 2010 and 2012).
2982 cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
2983 if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
2986 cc_default="c99wrap cl"
2988 ld_default="$source_path/compat/windows/mslink"
2989 nm_default="dumpbin -symbols"
2993 as_default="armasm64"
2999 target_os_default="win32"
3000 # Use a relative path for TMPDIR. This makes sure all the
3001 # ffconf temp files are written with a relative path, avoiding
3002 # issues with msys/win32 path conversion for MSVC parameters
3003 # such as -Fo<file> or -out:<file>.
3009 nm_default="dumpbin -symbols"
3011 target_os_default="win32"
3015 add_cflags -fprofile-arcs -ftest-coverage
3016 add_ldflags -fprofile-arcs -ftest-coverage
3019 add_cflags -fprofile-arcs -ftest-coverage
3020 add_ldflags --coverage
3023 add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
3024 add_cflags -fno-strict-overflow -fstack-protector-all
3025 add_ldflags -Wl,-z,relro -Wl,-z,now
3028 die "Unknown toolchain $toolchain"
3032 if test -n "$cross_prefix"; then
3033 test -n "$arch" && test -n "$target_os" ||
3034 die "Must specify target arch (--arch) and OS (--target-os) when cross-compiling"
3035 enable cross_compile
3038 ar_default="${cross_prefix}${ar_default}"
3039 cc_default="${cross_prefix}${cc_default}"
3040 objcc_default="${cross_prefix}${objcc_default}"
3041 x86asmexe_default="${cross_prefix}${x86asmexe_default}"
3042 nm_default="${cross_prefix}${nm_default}"
3043 pkg_config_default="${cross_prefix}${pkg_config_default}"
3044 ranlib="${cross_prefix}${ranlib}"
3045 strip="${cross_prefix}${strip}"
3047 sysinclude_default="${sysroot}/usr/include"
3049 set_default arch cc pkg_config sysinclude target_exec target_os x86asmexe
3050 enabled cross_compile || host_cc_default=$cc
3053 if ! $pkg_config --version >/dev/null 2>&1; then
3054 warn "$pkg_config not found, library detection may fail."
3060 mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
3064 EXESUF=$(exesuf $target_os)
3065 HOSTEXESUF=$(exesuf $host_os)
3067 # set temporary file name
3068 : ${TMPDIR:=$TEMPDIR}
3072 if ! test_cmd mktemp -u XXXXXX; then
3073 # simple replacement for missing mktemp
3074 # NOT SAFE FOR GENERAL USE
3076 tmpname="${2%%XXX*}.${HOSTNAME}.${UID}.$$"
3082 AVTMPDIR=$(mktemp -d "${TMPDIR}/avconf.XXXXXXXX" 2> /dev/null) ||
3083 die "Unable to create temporary directory in $TMPDIR."
3086 tmp="${AVTMPDIR}/test"$2
3087 (set -C; exec > $tmp) 2> /dev/null ||
3088 die "Unable to create temporary file in $AVTMPDIR."
3092 trap 'rm -rf -- "$AVTMPDIR"' EXIT
3097 tmpfile TMPE $EXESUF
3108 # make sure we can execute files in $TMPDIR
3109 cat > $TMPSH 2>> $logfile <<EOF
3112 chmod +x $TMPSH >> $logfile 2>&1
3113 if ! $TMPSH >> $logfile 2>&1; then
3115 Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
3116 variable to another directory and make sure that it is not mounted noexec.
3118 die "Sanity test failed."
3124 # Filter out MSVC cl.exe options from cflags that shouldn't
3125 # be passed to gas-preprocessor
3135 -Wno-switch) echo -Wno-switch-enum ;;
3136 -Wno-format-zero-length) ;;
3137 -Wdisabled-optimization) ;;
3138 -Wno-pointer-sign) echo -Wno-other ;;
3144 msvc_common_flags(){
3147 # In addition to specifying certain flags under the compiler
3148 # specific filters, they must be specified here as well or else the
3149 # generic catch all at the bottom will print the original flag.
3154 -fomit-frame-pointer) ;;
3158 -fno-signed-zeros) ;;
3162 -lz) echo zlib.lib ;;
3163 -lx264) echo libx264.lib ;;
3164 -l*) echo ${flag#-l}.lib ;;
3165 -L*) echo -libpath:${flag#-L} ;;
3172 msvc_common_flags "$@"
3175 -Wall) echo -W3 -wd4018 -wd4146 -wd4244 -wd4305 \
3177 -Wextra) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
3178 -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
3179 -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
3180 -wd4273 -wd4554 -wd4701 -wd4703 ;;
3186 msvc_common_flags "$@"
3189 # Despite what Intel's documentation says -Wall, which is supported
3190 # on Windows, does enable remarks so disable them here.
3191 -Wall) echo $flag -Qdiag-disable:remark ;;
3192 -std=c99) echo -Qstd=c99 ;;
3201 case "${flag#*=}" in
3202 native) echo -xtarget=native ;;
3203 v9|niagara) echo -xarch=sparc ;;
3204 ultrasparc) echo -xarch=sparcvis ;;
3205 ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
3206 i586|pentium) echo -xchip=pentium ;;
3207 i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
3208 pentium3*|c3-2) echo -xtarget=pentium3 ;;
3209 pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
3210 pentium4*) echo -xtarget=pentium4 ;;
3211 prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
3212 *-sse3) echo -xarch=sse3 ;;
3213 core2) echo -xarch=ssse3 -xchip=core2 ;;
3214 corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
3215 corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
3216 amdfam10|barcelona|bdver*) echo -xarch=sse4_1 ;;
3217 athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
3218 k8|opteron|athlon64|athlon-fx)
3219 echo -xarch=sse2a ;;
3220 athlon*) echo -xarch=pentium_proa ;;
3223 -std=c99) echo -xc99 ;;
3224 -fomit-frame-pointer) echo -xregs=frameptr ;;
3225 -fPIC) echo -KPIC -xcode=pic32 ;;
3226 -W*,*) echo $flag ;;
3227 -f*-*|-W*|-mimpure-text) ;;
3238 unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
3239 unset _ld_o _ldflags _ld_lib _ld_path
3240 unset _depflags _DEPCMD _DEPFLAGS
3243 if $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
3245 gcc_extra_ver=$(expr "$($_cc --version 2>/dev/null | head -n1)" : '.*\((.*)\)')
3246 _ident="llvm-gcc $($_cc -dumpversion 2>/dev/null) $gcc_extra_ver"
3247 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3250 elif $_cc -v 2>&1 | grep -qi ^gcc; then
3252 gcc_version=$($_cc --version | head -n1)
3253 gcc_basever=$($_cc -dumpversion)
3254 gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
3255 gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
3256 _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
3257 if ! $_cc -dumpversion | grep -q '^2\.'; then
3258 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3262 elif $_cc --version 2>/dev/null | grep -q ^icc; then
3264 _ident=$($_cc --version | head -n1)
3269 elif $_cc -v 2>&1 | grep -q xlc; then
3271 _ident=$($_cc -qversion 2>/dev/null | head -n1)
3273 _cflags_size='-O5 -qcompact'
3274 elif $_cc --vsn 2>/dev/null | grep -Eq "ARM (C/C\+\+ )?Compiler"; then
3275 test -d "$sysroot" || die "No valid sysroot specified."
3277 _ident=$($_cc --vsn | grep -i build | head -n1 | sed 's/.*: //')
3278 armcc_conf="$PWD/armcc.conf"
3279 $_cc --arm_linux_configure \
3280 --arm_linux_config_file="$armcc_conf" \
3281 --configure_sysroot="$sysroot" \
3282 --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
3283 die "Error creating armcc configuration file."
3284 $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
3285 _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
3286 as_default="${cross_prefix}gcc"
3290 elif $_cc -v 2>&1 | grep -q clang; then
3292 _ident=$($_cc --version 2>/dev/null | head -n1)
3293 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3296 elif $_cc -V 2>&1 | grep -q Sun; then
3298 _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
3299 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
3300 _DEPFLAGS='-xM1 -xc99'
3303 _cflags_size='-O5 -xspace'
3304 _flags_filter=suncc_flags
3305 elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
3307 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3308 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3311 _flags_filter='filter_out -Wdisabled-optimization'
3312 elif $_cc -v 2>&1 | grep -q Open64; then
3314 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3315 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3318 _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
3319 elif $_cc 2>&1 | grep -q 'Microsoft.*ARM.*Assembler'; then
3321 _ident=$($_cc | head -n1)
3322 # 4509: "This form of conditional instruction is deprecated"
3323 _flags="-nologo -ignore 4509"
3324 _flags_filter=armasm_flags
3325 elif $_cc -nologo- 2>&1 | grep -q Microsoft; then
3327 _ident=$($_cc 2>&1 | head -n1)
3328 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
3329 _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
3333 if $_cc -nologo- 2>&1 | grep -q Linker; then
3340 _flags_filter=msvc_flags
3342 _ld_path='-libpath:'
3344 elif $_cc 2>&1 | grep -q Intel; then
3346 _ident=$($_cc 2>&1 | head -n1)
3347 _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
3348 # Not only is O3 broken on 13.x+ but it is slower on all previous
3349 # versions (tested) as well.
3351 _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
3352 if $_cc 2>&1 | grep -q Linker; then
3359 _flags_filter=icl_flags
3361 _ld_path='-libpath:'
3362 # -Qdiag-error to make icl error when seeing certain unknown arguments
3363 _flags='-nologo -Qdiag-error:4044,10157'
3364 # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
3365 # with MSVC which enables it by default.
3366 _cflags='-Qms0 -Qvec- -Qsimd- -GS'
3367 elif $_cc -? 2>/dev/null | grep -q 'LLVM.*Linker'; then
3368 # lld can emulate multiple different linkers; in ms link.exe mode,
3369 # the -? parameter gives the help output which contains an identifyable
3370 # string, while it gives an error in other modes.
3372 # The link.exe mode doesn't have a switch for getting the version,
3373 # but we can force it back to gnu mode and get the version from there.
3374 _ident=$($_cc -flavor gnu --version 2>/dev/null)
3376 _flags_filter=msvc_flags
3378 _ld_path='-libpath:'
3379 elif $_cc --version 2>/dev/null | grep -q ^cparser; then
3381 _ident=$($_cc --version | head -n1)
3385 _flags_filter=cparser_flags
3388 eval ${pfx}_type=\$_type
3389 eval ${pfx}_ident=\$_ident
3393 eval ${1}_C=\${_cc_c-\${${1}_C}}
3394 eval ${1}_E=\${_cc_e-\${${1}_E}}
3395 eval ${1}_O=\${_cc_o-\${${1}_O}}
3397 if [ -n "$_depflags" ]; then
3398 eval ${1}_DEPFLAGS=\$_depflags
3400 eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
3401 eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
3402 eval DEP${1}FLAGS=\$_flags
3407 cflags_filter=$_flags_filter
3408 cflags_speed=$_cflags_speed
3409 cflags_size=$_cflags_size
3410 cflags_noopt=$_cflags_noopt
3411 add_cflags $_flags $_cflags
3412 cc_ldflags=$_ldflags
3415 probe_cc hostcc "$host_cc"
3416 host_cflags_filter=$_flags_filter
3417 host_cflags_speed=$_cflags_speed
3418 add_host_cflags $_flags $_cflags
3421 test -n "$cc_type" && enable $cc_type ||
3422 warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
3424 : ${as_default:=$cc}
3425 : ${objcc_default:=$cc}
3426 : ${dep_cc_default:=$cc}
3427 : ${ld_default:=$cc}
3428 : ${host_ld_default:=$host_cc}
3429 set_default ar as objcc dep_cc ld host_ld
3432 asflags_filter=$_flags_filter
3433 add_asflags $_flags $_cflags
3436 probe_cc objcc "$objcc"
3437 objcflags_filter=$_flags_filter
3438 add_objcflags $_flags $_cflags
3442 ldflags_filter=$_flags_filter
3443 add_ldflags $_flags $_ldflags
3444 test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
3446 LD_LIB=${_ld_lib-$LD_LIB}
3447 LD_PATH=${_ld_path-$LD_PATH}
3449 probe_cc hostld "$host_ld"
3450 host_ldflags_filter=$_flags_filter
3451 add_host_ldflags $_flags $_ldflags
3452 HOSTLD_O=${_ld_o-$HOSTLD_O}
3454 if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
3455 probe_cc depcc "$dep_cc"
3456 CCDEP=${_DEPCMD:-$DEPCMD}
3457 CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
3461 if $ar 2>&1 | grep -q Microsoft; then
3469 add_cflags $extra_cflags
3470 add_objcflags $extra_objcflags
3471 add_asflags $extra_cflags
3473 if test -n "$sysroot"; then
3476 add_cppflags --sysroot="$sysroot"
3477 add_ldflags --sysroot="$sysroot"
3482 if test "$cpu" = host; then
3483 enabled cross_compile &&
3484 die "--cpu=host makes no sense when cross-compiling."
3489 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
3491 s/.*$1=\\([^ ]*\\).*/\\1/
3496 cpu=$(check_native -march || check_native -mcpu)
3500 test "${cpu:-host}" = host &&
3501 die "--cpu=host not supported with compiler $cc"
3504 # Deal with common $arch aliases
3528 "Power Macintosh"|ppc*|powerpc*)
3543 i[3-6]86|i86pc|BePC|x86pc|x86_64|amd64)
3548 is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
3551 # Add processor-specific flags
3552 if enabled aarch64; then
3556 cpuflags="-march=$cpu"
3559 cpuflags="-mcpu=$cpu"
3563 elif enabled alpha; then
3565 cpuflags="-mcpu=$cpu"
3567 elif enabled arm; then
3570 test_cpp_condition stddef.h \
3571 "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
3576 if check_arm_arch 4; then echo armv4
3577 elif check_arm_arch 4T; then echo armv4t
3578 elif check_arm_arch 5; then echo armv5
3579 elif check_arm_arch 5E; then echo armv5e
3580 elif check_arm_arch 5T; then echo armv5t
3581 elif check_arm_arch 5TE; then echo armv5te
3582 elif check_arm_arch 5TEJ; then echo armv5te
3583 elif check_arm_arch 6; then echo armv6
3584 elif check_arm_arch 6J; then echo armv6j
3585 elif check_arm_arch 6K; then echo armv6k
3586 elif check_arm_arch 6Z; then echo armv6z
3587 elif check_arm_arch 6ZK; then echo armv6zk
3588 elif check_arm_arch 6T2; then echo armv6t2
3589 elif check_arm_arch 7; then echo armv7
3590 elif check_arm_arch 7A 7_A; then echo armv7-a
3591 elif check_arm_arch 7S; then echo armv7-a
3592 elif check_arm_arch 7R 7_R; then echo armv7-r
3593 elif check_arm_arch 7M 7_M; then echo armv7-m
3594 elif check_arm_arch 7EM 7E_M; then echo armv7-m
3595 elif check_arm_arch 8A 8_A; then echo armv8-a
3599 [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
3603 cpuflags="-march=$cpu"
3604 subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
3607 cpuflags="-mcpu=$cpu"
3609 cortex-a*) subarch=armv7a ;;
3610 cortex-r*) subarch=armv7r ;;
3611 cortex-m*) enable thumb; subarch=armv7m ;;
3612 arm11*) subarch=armv6 ;;
3613 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
3614 armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
3615 *) subarch=$(probe_arm_arch) ;;
3621 armv5t*) enable fast_clz ;;
3622 armv[6-8]*) enable fast_clz fast_unaligned ;;
3625 elif enabled avr32; then
3630 cpuflags="-mpart=$cpu"
3634 cpuflags="-march=$cpu"
3638 cpuflags="-mcpu=$cpu"
3642 cpuflags="-march=$cpu"
3646 elif enabled bfin; then
3648 cpuflags="-mcpu=$cpu"
3650 elif enabled mips; then
3652 cpuflags="-march=$cpu"
3654 elif enabled ppc; then
3658 case $(tolower $cpu) in
3659 601|ppc601|powerpc601)
3660 cpuflags="-mcpu=601"
3663 603*|ppc603*|powerpc603*)
3664 cpuflags="-mcpu=603"
3667 604*|ppc604*|powerpc604*)
3668 cpuflags="-mcpu=604"
3671 g3|75*|ppc75*|powerpc75*)
3672 cpuflags="-mcpu=750"
3675 g4|745*|ppc745*|powerpc745*)
3676 cpuflags="-mcpu=7450"
3679 74*|ppc74*|powerpc74*)
3680 cpuflags="-mcpu=7400"
3683 g5|970|ppc970|powerpc970)
3684 cpuflags="-mcpu=970"
3688 cpuflags="-mcpu=$cpu"
3692 cpuflags="-mcpu=$cpu"
3696 cpuflags="-mcpu=cell"
3701 cpuflags="-mcpu=e500mc"
3705 cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
3710 cpuflags="-mcpu=8540 -mhard-float"
3716 elif enabled sparc; then
3719 cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
3720 cpuflags="-mcpu=$cpu"
3722 ultrasparc*|niagara[234])
3723 cpuflags="-mcpu=$cpu"
3727 elif enabled x86; then
3731 cpuflags="-march=$cpu"
3735 # targets that do NOT support nopl and conditional mov (cmov)
3736 pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
3737 cpuflags="-march=$cpu"
3740 # targets that do support nopl and conditional mov (cmov)
3741 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*)
3742 cpuflags="-march=$cpu"
3746 # targets that do support conditional mov but on which it's slow
3747 pentium4|pentium4m|prescott|nocona)
3748 cpuflags="-march=$cpu"
3756 if [ "$cpu" != generic ]; then
3757 add_cflags $cpuflags
3758 add_asflags $cpuflags
3759 test "$cc_type" = "$ld_type" && add_ldflags $cpuflags
3762 # compiler sanity check
3764 int main(void){ return 0; }
3766 if test "$?" != 0; then
3767 echo "$cc is unable to create an executable file."
3768 if test -z "$cross_prefix" && ! enabled cross_compile ; then
3769 echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
3770 echo "Only do this if you know what cross compiling means."
3772 die "C compiler test failed."
3775 add_cppflags -D_ISOC99_SOURCE
3777 # some compilers silently accept -std=c11, so we also need to check that the
3778 # version macro is defined properly
3779 test_cpp_condition stdlib.h "__STDC_VERSION__ >= 201112L" -std=c11 &&
3780 add_cflags -std=c11 ||
3781 check_cflags -std=c99
3783 check_cppflags -D_FILE_OFFSET_BITS=64
3784 check_cppflags -D_LARGEFILE_SOURCE
3786 add_host_cppflags -D_ISOC99_SOURCE
3787 check_host_cflags -std=c99
3788 check_host_cflags -Wall
3789 check_host_cflags $host_cflags_speed
3794 expr=${3:-'sizeof(void *) > 4'}
3795 test_code cc "" "int test[2*($expr) - 1]" &&
3796 subarch=$arch64 || subarch=$arch32
3802 enabled shared && enable_weak pic
3805 check_64bit mips mips64 '_MIPS_SIM > 1'
3806 enabled shared && enable_weak pic
3809 check_64bit parisc parisc64
3810 enabled shared && enable_weak pic
3813 check_64bit ppc ppc64
3814 enabled shared && enable_weak pic
3817 check_64bit s390 s390x
3818 enabled shared && enable_weak pic
3821 check_64bit sparc sparc64
3822 enabled shared && enable_weak pic
3825 check_64bit x86_32 x86_64
3826 if enabled x86_64; then
3827 enabled shared && enable_weak pic
3837 add_cppflags '-I\$(SRC_PATH)/compat/aix'
3838 enabled shared && add_ldflags -Wl,-brtl
3839 arflags='-Xany -r -c'
3843 enable section_data_rel_ro
3844 SLIB_INSTALL_NAME='$(SLIBNAME)'
3846 SHFLAGS='-shared -Wl,-soname,$(SLIBNAME)'
3849 prefix_default="/boot/common"
3850 network_extralibs="-lnetwork"
3854 SHFLAGS='-shared -Wl,-h,$$(@F)'
3855 enabled x86 && append SHFLAGS -mimpure-text
3856 network_extralibs="-lsocket -lnsl"
3857 # When using suncc to build, the Solaris linker will mark
3858 # an executable with each instruction set encountered by
3859 # the Solaris assembler. As our libraries contain their own
3860 # guards for processor-specific code, instead suppress
3861 # generation of the HWCAPS ELF section on Solaris x86 only.
3862 enabled_all suncc x86 &&
3863 echo "hwcap_1 = OVERRIDE;" > mapfile &&
3864 add_ldflags -Wl,-M,mapfile
3865 nm_default='nm -P -g'
3867 VERSION_SCRIPT_POSTPROCESS_CMD='perl $(SRC_PATH)/compat/solaris/make_sunver.pl - $(OBJS)'
3871 oss_indev_extralibs="-lossaudio"
3876 SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
3878 oss_indev_extralibs="-lossaudio"
3886 add_extralibs -lpoll -lgnugetopt
3889 enabled ppc && add_asflags -force_cpusubtype_ALL
3890 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
3891 enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
3892 add_ldflags -Wl,-dynamic,-search_paths_first
3893 check_cflags -Werror=partial-availability
3895 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
3896 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
3897 enabled x86_64 && objformat="macho64" || objformat="macho32"
3898 enabled_any pic shared ||
3899 { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
3900 check_header dispatch/dispatch.h &&
3901 add_cppflags '-I\$(SRC_PATH)/compat/dispatch_semaphore'
3902 if test -n "$sysroot"; then
3903 is_in -isysroot $cc $CPPFLAGS $CFLAGS || check_cppflags -isysroot $sysroot
3904 is_in -isysroot $ld $LDFLAGS || check_ldflags -isysroot $sysroot
3908 die "Native MSYS builds are discouraged, please use the MINGW environment."
3913 if enabled x86_64; then
3914 LIBTARGET="i386:x86-64"
3915 elif enabled arm; then
3917 elif enabled aarch64; then
3920 if enabled shared; then
3921 # Cannot build both shared and static libs when using dllimport.
3924 check_ldflags -Wl,--nxcompat
3925 check_ldflags -Wl,--dynamicbase
3926 shlibdir_default="$bindir_default"
3929 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
3930 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
3931 SLIB_EXTRA_CMD=-'$(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
3932 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3934 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
3935 SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
3936 SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" AR="$(AR_CMD)" NM="$(NM_CMD)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
3937 SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-auto-image-base $$(@:$(SLIBSUF)=.def)'
3938 enabled x86_64 && objformat="win64" || objformat="win32"
3939 dlltool="${cross_prefix}dlltool"
3945 if enabled shared; then
3946 # Link to the import library instead of the normal static library
3949 # Cannot build both shared and static libs with MSVC or icl.
3952 shlibdir_default="$bindir_default"
3955 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
3956 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
3957 SLIB_CREATE_DEF_CMD='EXTERN_PREFIX="$(EXTERN_PREFIX)" $(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
3958 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3960 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
3961 SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
3962 SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
3963 enabled x86_64 && objformat="win64" || objformat="win32"
3969 shlibdir_default="$bindir_default"
3972 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
3973 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
3974 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3976 SLIB_INSTALL_EXTRA_LIB='lib$(NAME).dll.a'
3977 SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(NAME).dll.a'
3978 enabled x86_64 && objformat="win64" || objformat="win32"
3981 *-dos|freedos|opendos)
3982 network_extralibs="-lsocket"
3985 add_cppflags -U__STRICT_ANSI__
3988 enable section_data_rel_ro
3992 ranlib="echo ignoring ranlib"
3997 add_cppflags -D_GNU_SOURCE
3998 add_ldflags -Zomf -Zbin-files -Zargs-wild -Zhigh-mem -Zmap
3999 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
4003 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
4004 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
4005 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
4006 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
4007 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
4008 echo EXPORTS >> $(SUBDIR)$(NAME).def; \
4009 emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
4010 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
4011 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
4012 SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
4016 add_cppflags -D_BSD_SOURCE
4021 add_cppflags -D_QNX_SOURCE
4022 network_extralibs="-lsocket"
4027 add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
4028 add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
4029 add_ldflags -Wl,--target1-abs,--no-undefined \
4030 -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
4031 -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
4032 add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
4033 -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
4034 -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
4041 die "Unknown OS '$target_os'."
4045 # determine libc flavour
4050 # uclibc defines __GLIBC__, so it needs to be checked before glibc.
4051 if test_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
4052 eval ${pfx}libc_type=uclibc
4053 add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
4054 elif test_${pfx}cpp_condition features.h "defined __GLIBC__"; then
4055 eval ${pfx}libc_type=glibc
4056 add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
4057 # MinGW headers can be installed on Cygwin, so check for newlib first.
4058 elif test_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
4059 eval ${pfx}libc_type=newlib
4060 add_${pfx}cppflags -U__STRICT_ANSI__ -D_XOPEN_SOURCE=600
4061 # MinGW64 is backwards compatible with MinGW32, so check for it first.
4062 elif test_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
4063 eval ${pfx}libc_type=mingw64
4064 add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
4065 eval test \$${pfx_no_}cc_type = "gcc" &&
4066 add_${pfx}cppflags -D__printf__=__gnu_printf__
4067 elif test_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
4068 test_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
4069 eval ${pfx}libc_type=mingw32
4070 test_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
4071 (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
4072 die "ERROR: MinGW32 runtime version must be >= 3.15."
4073 add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
4074 test_${pfx}cpp_condition _mingw.h "__MSVCRT_VERSION__ < 0x0700" &&
4075 add_${pfx}cppflags -D__MSVCRT_VERSION__=0x0700
4076 test_${pfx}cpp_condition windows.h "defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0502" &&
4077 add_${pfx}cppflags -D_WIN32_WINNT=0x0502
4078 eval test \$${pfx_no_}cc_type = "gcc" &&
4079 add_${pfx}cppflags -D__printf__=__gnu_printf__
4080 elif test_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
4081 eval ${pfx}libc_type=msvcrt
4082 if test_${pfx}cpp_condition crtversion.h "_VC_CRT_MAJOR_VERSION < 14"; then
4083 if [ "$pfx" = host_ ]; then
4084 add_host_cppflags -Dsnprintf=_snprintf
4086 add_compat strtod.o strtod=avpriv_strtod
4087 add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
4088 _snprintf=avpriv_snprintf \
4089 vsnprintf=avpriv_vsnprintf
4092 add_${pfx}cppflags -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS
4093 # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
4094 # 0x601 by default unless something else is set by the user.
4095 # This can easily lead to us detecting functions only present
4096 # in such new versions and producing binaries requiring windows 7.0.
4097 # Therefore explicitly set the default to XP unless the user has
4098 # set something else on the command line.
4099 # Don't do this if WINAPI_FAMILY is set and is set to a non-desktop
4100 # family. For these cases, configure is free to use any functions
4101 # found in the SDK headers by default. (Alternatively, we could force
4102 # _WIN32_WINNT to 0x0602 in that case.)
4103 test_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
4104 { test_${pfx}cpp <<EOF && add_${pfx}cppflags -D_WIN32_WINNT=0x0502; }
4105 #ifdef WINAPI_FAMILY
4106 #include <winapifamily.h>
4107 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
4112 if [ "$pfx" = "" ]; then
4113 check_func strtoll || add_cflags -Dstrtoll=_strtoi64
4115 elif test_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
4116 eval ${pfx}libc_type=klibc
4117 elif test_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
4118 eval ${pfx}libc_type=bionic
4119 elif test_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
4120 eval ${pfx}libc_type=solaris
4121 add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
4123 eval ${pfx}libc_type=default
4124 add_${pfx}cppflags -D_DEFAULT_SOURCE
4126 eval test -n "\${${pfx}libc_type}" && enable ${pfx}libc_${libc_type}
4132 # hacks for compiler/libc/os combinations
4136 add_compat strtod.o strtod=avpriv_strtod
4140 check_compile_assert flt_lim "float.h limits.h" "DBL_MAX == (double)DBL_MAX" ||
4141 add_cppflags '-I\$(SRC_PATH)/compat/float'
4143 test_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
4145 set_default $PATHS_LIST
4148 disabled optimizations || check_cflags -fomit-frame-pointer
4151 disabled pic && return
4154 case "$target_os" in
4155 mingw*|cygwin*|win*)
4164 enabled pic && enable_weak_pic
4166 test_cc <<EOF || die "Symbol mangling check failed."
4169 sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
4170 extern_prefix=${sym%%ff_extern*}
4172 ! disabled inline_asm && check_inline_asm inline_asm '"" ::'
4174 for restrict_keyword in restrict __restrict__ __restrict ""; do
4175 test_cc <<EOF && break
4176 void foo(char * $restrict_keyword p);
4180 test_cc <<EOF && enable pragma_deprecated
4181 void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
4184 test_cc <<EOF || die "endian test failed"
4185 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
4187 od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
4190 log "check_gas using '$as' as AS"
4191 # :vararg is used on aarch64, arm and ppc altivec
4192 test_as <<EOF || return 1
4193 .macro m n, y:vararg=0
4198 # .altmacro is only used in arm asm
4199 ! enabled arm || test_as <<EOF || return 1
4206 if enabled_any arm aarch64 || enabled_all ppc altivec && enabled asm; then
4208 enabled_any arm aarch64 && nogas=die
4209 enabled_all ppc altivec && nogas=warn
4213 arm*) gaspp_as_type=armasm; as_noop=-h ;;
4214 gcc) gaspp_as_type=gas ;;
4215 *) gaspp_as_type=$as_type ;;
4218 [ $target_os = "darwin" ] && gaspp_as_type="apple-$gaspp_as_type"
4220 test_cmd gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as $as_noop &&
4221 gas="gas-preprocessor.pl -arch $arch -as-type $gaspp_as_type -- $as"
4223 if ! check_gas ; then
4226 $nogas "GNU assembler not found, install/update gas-preprocessor"
4229 test_as <<EOF && enable as_func
4235 check_inline_asm inline_asm_labels '"1:\n"'
4237 if enabled aarch64; then
4238 enabled armv8 && check_insn armv8 'prfm pldl1strm, [x0]'
4239 # internal assembler in clang 3.3 does not support this instruction
4240 enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
4241 enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
4243 map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
4245 elif enabled alpha; then
4249 elif enabled arm; then
4251 enabled msvc && check_cpp_condition thumb stddef.h "defined _M_ARMT"
4252 test_cpp_condition stddef.h "defined __thumb__" && enable_weak thumb
4253 enabled thumb && check_cflags -mthumb || check_cflags -marm
4255 if check_cpp_condition vfp_args stddef.h "defined __ARM_PCS_VFP"; then
4257 elif check_cpp_condition vfp_args stddef.h "defined _M_ARM_FP && _M_ARM_FP >= 30"; then
4259 elif ! test_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__" && [ $target_os != darwin ]; then
4260 case "${cross_prefix:-$cc}" in
4261 *hardfloat*) enable vfp_args; fpabi=vfp ;;
4262 *) test_ld <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
4263 __asm__ (".eabi_attribute 28, 1");
4264 int main(void) { return 0; }
4267 warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
4270 enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
4271 enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
4272 enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
4273 enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
4274 enabled vfp && check_insn vfp 'fadds s0, s0, s0'
4275 enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
4277 [ $target_os = linux ] || [ $target_os = android ] ||
4278 map 'enabled_any ${v}_external ${v}_inline || disable $v' \
4281 check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
4283 test_as <<EOF && enable as_arch_directive
4286 test_as <<EOF && enable as_fpu_directive
4290 # llvm's integrated assembler supports .object_arch from llvm 3.5
4291 [ "$objformat" = elf32 ] || [ "$objformat" = elf64 ] &&
4292 test_as <<EOF && enable as_object_arch
4296 # MS armasm fails to assemble our PIC constructs
4297 [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
4299 elif enabled mips; then
4301 # make sure that only one instruction set is enabled
4302 disable $ARCH_EXT_LIST_MIPS
4304 check_inline_asm loongson '"dmult.g $1, $2, $3"'
4306 if enabled mips64; then
4307 check_inline_asm mips64r6 '"dlsa $0, $0, $0, 1"' ||
4308 check_inline_asm mips64r2 '"dext $0, $0, 0, 1"' ||
4309 check_inline_asm mips64r1 '"daddi $0, $0, 0"'
4311 check_inline_asm mips32r6 '"aui $0, $0, 0"' ||
4312 check_inline_asm mips32r2 '"ext $0, $0, 0, 1"' ||
4313 check_inline_asm mips32r1 '"addi $0, $0, 0"'
4316 elif enabled parisc; then
4318 if enabled gcc; then
4319 case $($cc -dumpversion) in
4320 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
4324 elif enabled ppc; then
4326 enable local_aligned_8 local_aligned_16 local_aligned_32
4328 check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
4329 check_inline_asm ibm_asm '"add 0, 0, 0"'
4330 check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
4331 check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
4333 if enabled altivec; then
4334 check_cflags -maltivec -mabi=altivec
4336 # check if our compiler supports Motorola AltiVec C API
4337 test_code cc altivec.h "vector signed int v1 = (vector signed int) { 0 };
4338 vector signed int v2 = (vector signed int) { 1 };
4339 v1 = vec_add(v1, v2);" ||
4342 enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
4345 if enabled vsx; then
4346 check_cflags -mvsx &&
4347 test_code cc altivec.h "int v[4] = { 0 };
4348 vector signed int v1 = vec_vsx_ld(0, v);" ||
4352 if enabled power8; then
4353 check_cpp_condition power8 altivec.h "defined(_ARCH_PWR8)"
4356 elif enabled x86; then
4358 check_builtin rdtsc intrin.h "__rdtsc()"
4359 check_builtin mm_empty mmintrin.h "_mm_empty()"
4361 enable local_aligned_8 local_aligned_16 local_aligned_32
4363 # check whether EBP is available on x86
4364 # As 'i' is stored on the stack, this program will crash
4365 # if the base pointer is used to access it because the
4366 # base pointer is cleared in the inline assembly code.
4367 check_exec_crash <<EOF && enable ebp_available
4369 __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
4373 # check whether EBX is available on x86
4374 check_inline_asm ebx_available '""::"b"(0)' &&
4375 check_inline_asm ebx_available '"":::"%ebx"'
4377 # check whether xmm clobbers are supported
4378 check_inline_asm xmm_clobbers '"":::"%xmm0"'
4380 # check whether binutils is new enough to compile SSSE3/MMXEXT
4381 enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
4382 enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
4386 if test_cmd $x86asmexe_probe -v; then
4387 x86asmexe=$x86asmexe_probe
4389 x86asm_debug="-g -F dwarf"
4391 X86ASM_DEPFLAGS='-MD $(@:.o=.d)'
4392 elif test_cmd $x86asmexe_probe --version; then
4393 x86asmexe=$x86asmexe_probe
4395 x86asm_debug="-g dwarf2"
4396 X86ASMDEP='$(DEPX86ASM) $(X86ASMFLAGS) -M $(X86ASM_O) $< > $(@:.o=.d)'
4399 test_x86asm "movbe ecx, [5]" && enable x86asm
4402 if ! disabled_any asm mmx x86asm; then
4404 for program in $x86asmexe nasm yasm; do
4405 probe_x86asm $program && break
4407 disabled x86asm && die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build."
4408 X86ASMFLAGS="-f $objformat"
4409 enabled pic && append X86ASMFLAGS "-DPIC"
4410 test -n "$extern_prefix" && append X86ASMFLAGS "-DPREFIX"
4411 case "$objformat" in
4412 elf*) enabled debug && append X86ASMFLAGS $x86asm_debug ;;
4415 test_x86asm "vextracti128 xmm0, ymm0, 0" || disable avx2_external
4416 test_x86asm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
4417 test_x86asm "vfmadd132ps ymm0, ymm1, ymm2" || disable fma3_external
4418 test_x86asm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
4419 test_x86asm "CPU amdnop" || disable cpunop
4423 athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
4430 test_code cc arm_neon.h "int16x8_t test = vdupq_n_s16(0)" && enable intrinsics_neon
4432 check_ldflags -Wl,--as-needed
4434 if ! disabled network; then
4435 check_func getaddrinfo $network_extralibs
4436 check_func inet_aton $network_extralibs
4438 check_type netdb.h "struct addrinfo"
4439 check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
4440 check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
4441 check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
4442 check_type poll.h "struct pollfd"
4443 check_type netinet/sctp.h "struct sctp_event_subscribe"
4444 check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
4445 check_type netinet/in.h "struct sockaddr_in6"
4446 check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
4447 check_type "sys/types.h sys/socket.h" socklen_t
4449 # Prefer arpa/inet.h over winsock2
4450 if check_header arpa/inet.h ; then
4451 check_func closesocket
4452 elif check_header winsock2.h ; then
4453 check_func_headers winsock2.h closesocket -lws2 &&
4454 network_extralibs="-lws2" ||
4455 { check_func_headers winsock2.h closesocket -lws2_32 &&
4456 network_extralibs="-lws2_32"; } || disable winsock2_h network
4457 check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
4459 check_type ws2tcpip.h socklen_t
4460 check_type ws2tcpip.h "struct addrinfo"
4461 check_type ws2tcpip.h "struct group_source_req"
4462 check_type ws2tcpip.h "struct ip_mreq_source"
4463 check_type ws2tcpip.h "struct ipv6_mreq"
4464 check_type winsock2.h "struct pollfd"
4465 check_struct winsock2.h "struct sockaddr" sa_len
4466 check_type ws2tcpip.h "struct sockaddr_in6"
4467 check_type ws2tcpip.h "struct sockaddr_storage"
4473 check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
4474 check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
4475 check_builtin MemoryBarrier windows.h "MemoryBarrier()"
4476 check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
4478 case "$custom_allocator" in
4480 # jemalloc by default does not use a prefix
4481 require libjemalloc jemalloc/jemalloc.h malloc -ljemalloc
4484 require_pkg_config libtcmalloc libtcmalloc gperftools/tcmalloc.h tc_malloc
4489 check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
4490 check_func ${malloc_prefix}memalign && enable memalign
4491 check_func ${malloc_prefix}posix_memalign && enable posix_memalign
4493 test_cpp_condition unistd.h "defined(_POSIX_MONOTONIC_CLOCK)" &&
4494 { check_lib clock_gettime time.h clock_gettime ||
4495 check_lib clock_gettime time.h clock_gettime -lrt; }
4498 check_func gethrtime
4500 check_func getrusage
4501 check_func gettimeofday
4504 check_func localtime_r
4508 # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
4509 check_func_headers time.h nanosleep || check_lib nanosleep time.h nanosleep -lrt
4510 check_func sched_getaffinity
4511 check_func setrlimit
4512 check_func strerror_r
4517 check_func_headers io.h setmode
4518 check_func_headers mach/mach_time.h mach_absolute_time
4519 check_func_headers stdlib.h getenv
4521 check_func_headers windows.h GetProcessAffinityMask
4522 check_func_headers windows.h GetProcessTimes
4523 check_func_headers windows.h GetSystemTimeAsFileTime
4524 check_func_headers windows.h LoadLibrary
4525 check_func_headers windows.h MapViewOfFile
4526 check_func_headers windows.h SetConsoleTextAttribute
4527 check_func_headers windows.h Sleep
4528 check_func_headers windows.h VirtualAlloc
4529 check_struct windows.h "CONDITION_VARIABLE" Ptr
4531 check_header direct.h
4532 check_header dxgidebug.h
4534 check_header dxva2api.h
4536 check_header malloc.h
4538 check_header sys/param.h
4539 check_header sys/resource.h
4540 check_header sys/select.h
4541 check_header sys/time.h
4542 check_header sys/un.h
4543 check_header unistd.h
4544 check_header valgrind/valgrind.h
4545 check_header VideoDecodeAcceleration/VDADecoder.h
4546 check_header windows.h
4548 # it seems there are versions of clang in some distros that try to use the
4549 # gcc headers, which explodes for stdatomic
4550 # so we also check that atomics actually work here
4551 check_builtin stdatomic stdatomic.h "atomic_int foo; atomic_store(&foo, 0)"
4553 check_lib ole32 "windows.h" CoTaskMemFree -lole32
4554 check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32
4555 check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom -ladvapi32
4556 check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
4558 check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
4560 check_type "cuviddec.h" "CUVIDH264PICPARAMS"
4561 check_type "cuviddec.h" "CUVIDHEVCPICPARAMS"
4562 check_struct "cuviddec.h" "CUVIDDECODECREATEINFO" bitDepthMinus8
4564 check_type "windows.h dxva.h" "DXVA_PicParams_HEVC" -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP -D_CRT_BUILD_DESKTOP_APP=0
4565 check_type "windows.h d3d11.h" "ID3D11VideoDecoder"
4566 check_type "d3d9.h dxva2api.h" DXVA2_ConfigPictureDecode -D_WIN32_WINNT=0x0602
4568 check_type "va/va.h va/va_dec_hevc.h" "VAPictureParameterBufferHEVC"
4569 check_type "va/va.h va/va_dec_vp8.h" "VAPictureParameterBufferVP8"
4570 check_type "va/va.h va/va_vpp.h" "VAProcPipelineParameterBuffer"
4571 check_type "va/va.h va/va_enc_h264.h" "VAEncPictureParameterBufferH264"
4572 check_type "va/va.h va/va_enc_hevc.h" "VAEncPictureParameterBufferHEVC"
4573 check_type "va/va.h va/va_enc_jpeg.h" "VAEncPictureParameterBufferJPEG"
4574 check_type "va/va.h va/va_enc_mpeg2.h" "VAEncPictureParameterBufferMPEG2"
4575 check_type "va/va.h va/va_enc_vp8.h" "VAEncPictureParameterBufferVP8"
4576 check_type "va/va.h va/va_enc_vp9.h" "VAEncPictureParameterBufferVP9"
4578 check_type "vdpau/vdpau.h" "VdpPictureInfoHEVC"
4580 if ! disabled w32threads && ! enabled pthreads; then
4581 check_lib w32threads "windows.h process.h" _beginthreadex
4584 # check for some common methods of building with pthread support
4585 # do this before the optional library checks as some of them require pthreads
4586 if ! disabled pthreads && ! enabled w32threads; then
4587 if check_lib pthreads pthread.h pthread_join -pthread; then
4589 elif check_lib pthreads pthread.h pthread_join -pthreads; then
4590 add_cflags -pthreads
4591 elif check_lib pthreads pthread.h pthread_join -lpthreadGC2; then
4593 elif check_lib pthreads pthread.h pthread_join -lpthread; then
4595 elif check_func pthread_join; then
4599 check_builtin sem_timedwait semaphore.h "sem_t *s; sem_init(s,0,0); sem_timedwait(s,0); sem_destroy(s)" $pthreads_extralibs
4602 disabled zlib || check_lib zlib zlib.h zlibVersion -lz
4603 disabled bzlib || check_lib bzlib bzlib.h BZ2_bzlibVersion -lbz2
4605 # On some systems dynamic loading requires no extra linker flags
4606 check_lib libdl dlfcn.h dlopen || check_lib libdl dlfcn.h dlopen -ldl
4608 check_lib libm math.h sin -lm
4614 for func in $MATH_FUNCS; do
4615 eval check_mathfunc $func \${${func}_args:-1} $libm_extralibs
4618 # these are off by default, so fail if requested and not available
4619 enabled amf && require_cpp_condition AMF/core/Version.h "(AMF_VERSION_MAJOR << 48 | AMF_VERSION_MINOR << 32 | AMF_VERSION_RELEASE << 16 | AMF_VERSION_BUILD_NUM) >= 0x0001000400040001"
4620 enabled avisynth && require_header avisynth/avisynth_c.h
4621 enabled avxsynth && require_header avxsynth/avxsynth_c.h
4622 enabled cuda && require cuda cuda.h cuInit -lcuda
4623 enabled cuvid && require cuvid cuviddec.h cuvidCreateDecoder -lnvcuvid
4624 enabled frei0r && require_header frei0r.h
4625 enabled gnutls && require_pkg_config gnutls gnutls gnutls/gnutls.h gnutls_global_init &&
4626 check_lib gmp gmp.h mpz_export -lgmp
4627 enabled libbs2b && require_pkg_config libbs2b libbs2b bs2b.h bs2b_open
4628 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 dc1394/dc1394.h dc1394_new
4629 enabled libdcadec && require libdcadec libdcadec/dca_context.h dcadec_context_create -ldcadec
4630 enabled libfaac && require libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
4631 enabled libfdk_aac && require_pkg_config libfdk_aac fdk-aac "fdk-aac/aacenc_lib.h" aacEncOpen
4632 enabled libfontconfig && require_pkg_config libfontconfig fontconfig "fontconfig/fontconfig.h" FcInit
4633 enabled libfreetype && require_pkg_config libfreetype freetype2 "ft2build.h FT_FREETYPE_H" FT_Init_FreeType
4634 enabled libgsm && require libgsm gsm.h gsm_create -lgsm
4635 enabled libhdcd && require_pkg_config libhdcd libhdcd "hdcd/hdcd_simple.h" hdcd_new
4636 enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
4637 enabled libkvazaar && require_pkg_config libkvazaar "kvazaar >= 0.8.1" kvazaar.h kvz_api_get
4638 enabled libmfx && require_pkg_config libmfx libmfx "mfx/mfxvideo.h" MFXInit
4639 enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
4640 enabled libnpp && require libnpp npp.h nppGetLibVersion -lnppi -lnppc
4641 enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
4642 enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
4643 enabled libopencv && require_pkg_config libopencv opencv opencv/cv.h cvCreateImageHeader
4644 enabled libopenh264 && require_pkg_config libopenh264 openh264 wels/codec_api.h WelsGetCodecVersion
4645 enabled libopenjpeg && { check_lib libopenjpeg openjpeg.h opj_version -lopenjpeg -DOPJ_STATIC ||
4646 require_pkg_config libopenjpeg libopenjpeg1 openjpeg.h opj_version -DOPJ_STATIC; }
4647 enabled libopus && require_pkg_config libopus opus opus_multistream.h opus_multistream_decoder_create
4648 enabled libpulse && require_pkg_config libpulse libpulse-simple pulse/simple.h pa_simple_new
4649 enabled librtmp && require_pkg_config librtmp librtmp librtmp/rtmp.h RTMP_Socket
4650 enabled libschroedinger && require_pkg_config libschroedinger schroedinger-1.0 schroedinger/schro.h schro_init
4651 enabled libsnappy && require libsnappy snappy-c.h snappy_compress -lsnappy
4652 enabled libspeex && require_pkg_config libspeex speex speex/speex.h speex_decoder_init
4653 enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
4654 enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame
4655 enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
4656 enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
4657 enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
4658 enabled libvpx && require_pkg_config libvpx "vpx >= 1.3.0" vpx/vpx_codec.h vpx_codec_version &&
4659 { enabled libvpx_vp8_decoder &&
4660 check_pkg_config libvpx_vp8_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp8_dx
4661 enabled libvpx_vp8_encoder &&
4662 check_pkg_config libvpx_vp8_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp8_cx
4663 enabled libvpx_vp9_decoder &&
4664 check_pkg_config libvpx_vp9_decoder vpx "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_vp9_dx
4665 enabled libvpx_vp9_encoder &&
4666 check_pkg_config libvpx_vp9_encoder vpx "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_vp9_cx
4667 disabled_all libvpx_vp8_decoder libvpx_vp9_decoder libvpx_vp8_encoder libvpx_vp9_encoder &&
4668 die "libvpx enabled but no supported decoders/encoders found"
4670 enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
4671 enabled libwebp && require_pkg_config libwebp libwebp webp/encode.h WebPGetEncoderVersion
4672 enabled libx264 && require_pkg_config libx264 x264 "stdint.h x264.h" x264_encoder_encode &&
4673 require_cpp_condition x264.h "X264_BUILD >= 118" &&
4674 check_cpp_condition libx262 x264.h "X264_MPEG2"
4675 enabled libx265 && require_pkg_config libx265 x265 x265.h x265_api_get &&
4676 require_cpp_condition x265.h "X265_BUILD >= 57"
4677 enabled libxavs && require libxavs "stdint.h xavs.h" xavs_encoder_encode -lxavs
4678 enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
4679 enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host ||
4680 { ! enabled cross_compile &&
4681 add_cflags -isystem/opt/vc/include/ -isystem/opt/vc/include/interface/vmcs_host/linux -isystem/opt/vc/include/interface/vcos/pthreads -fgnu89-inline &&
4682 add_ldflags -L/opt/vc/lib/ &&
4683 check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
4684 die "ERROR: mmal not found" &&
4685 check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
4686 enabled nvenc && require_cpp_condition nvEncodeAPI.h "NVENCAPI_MAJOR_VERSION >= 6"
4687 enabled omx && require_header OMX_Core.h
4688 enabled omx_rpi && { check_header OMX_Core.h ||
4689 { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_header OMX_Core.h ; } ||
4690 die "ERROR: OpenMAX IL headers not found"; } && enable omx
4691 enabled openssl && { { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
4692 check_pkg_config openssl openssl openssl/ssl.h SSL_library_init; } ||
4693 check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
4694 check_lib openssl openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
4695 check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
4696 die "ERROR: openssl not found"; }
4698 # SDL adds some CFLAGS that should not be part of the general CFLAGS.
4700 test_pkg_config sdl "sdl >= 1.2.1 sdl < 1.3.0" SDL_events.h SDL_PollEvent
4702 check_header linux/fb.h
4703 check_header linux/videodev2.h
4704 check_struct linux/videodev2.h "struct v4l2_frmivalenum" discrete
4706 check_header AVFoundation/AVFoundation.h
4708 check_header sys/videoio.h
4710 check_lib user32 "windows.h winuser.h" GetShellWindow -luser32
4711 check_lib vfw32 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
4712 # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
4713 # w32api 3.12 had it defined wrong
4714 check_cpp_condition vfwcap_defines vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER"
4716 # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
4717 check_header "dev/bktr/ioctl_meteor.h dev/bktr/ioctl_bt848.h" ||
4718 check_header "machine/ioctl_meteor.h machine/ioctl_bt848.h" ||
4719 check_header "dev/video/meteor/ioctl_meteor.h dev/video/bktr/ioctl_bt848.h" ||
4720 check_header "dev/ic/bt8xx.h"
4722 check_header sys/soundcard.h
4724 enabled alsa_indev &&
4725 check_lib alsa alsa/asoundlib.h snd_pcm_htimestamp -lasound
4728 require_pkg_config libjack jack jack/jack.h jack_port_get_latency_range
4730 enabled sndio_indev && check_lib sndio sndio.h sio_open -lsndio
4732 if enabled libcdio; then
4733 check_lib libcdio "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
4734 check_lib libcdio "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
4735 die "ERROR: No usable libcdio/cdparanoia found"
4738 if enabled libxcb; then
4739 require_pkg_config libxcb xcb xcb/xcb.h xcb_connect
4740 require_pkg_config libxcb_shape xcb-shape xcb/shape.h xcb_shape_rectangles
4741 disabled libxcb_shm ||
4742 check_pkg_config libxcb_shm xcb-shm xcb/shm.h xcb_shm_attach
4743 disabled libxcb_xfixes ||
4744 check_pkg_config libxcb_xfixes xcb-xfixes xcb/xfixes.h xcb_xfixes_get_cursor_image
4747 # d3d11va requires linking directly to dxgi and d3d11 if not building for
4748 # the desktop api partition
4749 test_cpp <<EOF && enable uwp && d3d11va_extralibs="-ldxgi -ld3d11"
4750 #ifdef WINAPI_FAMILY
4751 #include <winapifamily.h>
4752 #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
4753 #error desktop, not uwp
4755 // WINAPI_FAMILY_APP, WINAPI_FAMILY_PHONE_APP => UWP
4758 #error no family set
4762 enabled vaapi && require vaapi va/va.h vaInitialize -lva
4765 test_code cc "va/va.h" "vaCreateSurfaces(0, 0, 0, 0, 0, 0, 0, 0)" ||
4769 check_lib vaapi_drm "va/va.h va/va_drm.h" vaGetDisplayDRM -lva -lva-drm
4772 check_lib vaapi_x11 "va/va.h va/va_x11.h" vaGetDisplay -lva -lva-x11 -lX11
4775 test_cpp_condition "va/va.h" "VA_CHECK_VERSION(1, 0, 0)" &&
4779 check_cpp_condition vdpau vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP"
4782 check_lib vdpau_x11 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau -lX11
4784 enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
4786 # add some useful compiler flags if supported
4787 check_cflags -Wdeclaration-after-statement
4789 check_cflags -Wdisabled-optimization
4790 check_cflags -Wpointer-arith
4791 check_cflags -Wredundant-decls
4792 check_cflags -Wwrite-strings
4793 check_cflags -Wtype-limits
4794 check_cflags -Wundef
4795 check_cflags -Wmissing-prototypes
4796 check_cflags -Wstrict-prototypes
4798 if enabled extra_warnings; then
4799 check_cflags -Wcast-qual
4800 check_cflags -Wextra
4801 check_cflags -Wpedantic
4804 check_disable_warning(){
4805 warning_flag=-W${1#-Wno-}
4806 test_cflags $warning_flag && add_cflags $1
4809 check_disable_warning -Wno-parentheses
4810 check_disable_warning -Wno-switch
4811 check_disable_warning -Wno-format-zero-length
4812 check_disable_warning -Wno-pointer-sign
4814 check_disable_warning_headers(){
4815 warning_flag=-W${1#-Wno-}
4816 test_cflags $warning_flag && add_cflags_headers $1
4819 check_disable_warning_headers -Wno-deprecated-declarations
4820 check_disable_warning_headers -Wno-unused-variable
4822 check_objcflags -fobjc-arc && enable objc_arc
4824 test_cc <<EOF && enable blocks_extension
4825 void (^block)(void);
4828 # add some linker flags
4829 check_ldflags -Wl,--warn-common
4830 check_ldflags -Wl,-rpath-link=libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
4831 enabled rpath && add_ldexeflags -Wl,-rpath,$libdir && add_ldsoflags -Wl,-rpath,$libdir
4832 test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
4834 # add some strip flags
4835 # -wN '..@*' is more selective than -x, but not available everywhere.
4836 check_stripflags -wN \'..@*\' || check_stripflags -x || strip='true'
4838 enabled neon_clobber_test &&
4839 check_ldflags -Wl,--wrap,avcodec_open2 \
4840 -Wl,--wrap,avcodec_decode_audio4 \
4841 -Wl,--wrap,avcodec_decode_video2 \
4842 -Wl,--wrap,avcodec_decode_subtitle2 \
4843 -Wl,--wrap,avcodec_encode_audio2 \
4844 -Wl,--wrap,avcodec_encode_video2 \
4845 -Wl,--wrap,avcodec_encode_subtitle \
4846 -Wl,--wrap,avcodec_send_packet \
4847 -Wl,--wrap,avcodec_receive_packet \
4848 -Wl,--wrap,avcodec_send_frame \
4849 -Wl,--wrap,avcodec_receive_frame \
4850 -Wl,--wrap,avresample_convert ||
4851 disable neon_clobber_test
4853 enabled xmm_clobber_test &&
4854 check_ldflags -Wl,--wrap,avcodec_open2 \
4855 -Wl,--wrap,avcodec_decode_audio4 \
4856 -Wl,--wrap,avcodec_decode_video2 \
4857 -Wl,--wrap,avcodec_decode_subtitle2 \
4858 -Wl,--wrap,avcodec_encode_audio2 \
4859 -Wl,--wrap,avcodec_encode_video2 \
4860 -Wl,--wrap,avcodec_encode_subtitle \
4861 -Wl,--wrap,avcodec_send_packet \
4862 -Wl,--wrap,avcodec_receive_packet \
4863 -Wl,--wrap,avcodec_send_frame \
4864 -Wl,--wrap,avcodec_receive_frame \
4865 -Wl,--wrap,avresample_convert \
4866 -Wl,--wrap,sws_scale ||
4867 disable xmm_clobber_test
4869 test_ld <<EOF && enable proper_dce
4870 extern const int array[512];
4871 static inline int func(void) { return array[0]; }
4872 int main(void) { return 0; }
4875 if enabled proper_dce; then
4876 echo "X { local: *; };" > $TMPV
4877 if test_ldflags -Wl,${version_script},$TMPV; then
4878 append SHFLAGS '-Wl,${version_script},\$(SUBDIR)lib\$(NAME).ver'
4880 test_cc <<EOF && enable symver_asm_label
4881 void ff_foo(void) __asm__ ("av_foo@VERSION");
4882 void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
4884 test_cc <<EOF && enable symver_gnu_asm
4885 __asm__(".symver ff_foo,av_foo@VERSION");
4886 void ff_foo(void) {}
4891 if [ -z "$optflags" ]; then
4892 if enabled small; then
4893 optflags=$cflags_size
4894 elif enabled optimizations; then
4895 optflags=$cflags_speed
4897 optflags=$cflags_noopt
4903 enabled lto && check_ldflags "$@"
4906 check_optflags $optflags
4907 check_optflags -fno-math-errno
4908 check_optflags -fno-signed-zeros
4910 if enabled lto; then
4911 test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
4913 check_ldflags -flto $cpuflags
4916 if enabled icc; then
4917 # Just warnings, no remarks
4919 # -wd: Disable following warnings
4920 # 144, 167, 556: -Wno-pointer-sign
4921 # 1292: attribute "foo" ignored
4922 # 1419: external declaration in primary source file
4923 # 10006: ignoring unknown option -fno-signed-zeros
4924 # 10148: ignoring unknown option -Wno-parentheses
4925 # 10156: ignoring option '-W'; no argument required
4926 check_cflags -wd144,167,556,1292,1419,10006,10148,10156
4927 # 11030: Warning unknown option --as-needed
4928 # 10156: ignoring option '-export'; no argument required
4929 check_ldflags -wd10156,11030
4930 # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
4931 enable ebp_available
4932 if enabled x86_32; then
4933 icc_version=$($cc -dumpversion)
4934 test ${icc_version%%.*} -ge 11 &&
4935 check_cflags -falign-stack=maintain-16-byte ||
4936 disable aligned_stack
4938 elif enabled gcc; then
4939 check_optflags -fno-tree-vectorize
4940 check_cflags -Werror=implicit-function-declaration
4941 check_cflags -Werror=missing-prototypes
4942 check_cflags -Werror=return-type
4943 check_cflags -Werror=declaration-after-statement
4944 check_cflags -Werror=vla
4945 check_cflags -Werror=format-security
4946 check_cflags -fdiagnostics-color=auto
4947 enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
4948 elif enabled llvm_gcc; then
4949 check_cflags -mllvm -stack-alignment=16
4950 elif enabled clang; then
4951 check_cflags -mllvm -stack-alignment=16
4952 check_cflags -Qunused-arguments
4953 check_cflags -Werror=implicit-function-declaration
4954 check_cflags -Werror=missing-prototypes
4955 check_cflags -Werror=return-type
4956 elif enabled cparser; then
4957 add_cflags -Wno-missing-variable-declarations
4958 add_cflags -Wno-empty-statement
4959 elif enabled armcc; then
4960 add_cflags -W${armcc_opt},--diag_suppress=4343 # hardfp compat
4961 add_cflags -W${armcc_opt},--diag_suppress=3036 # using . as system include dir
4962 # 2523: use of inline assembly is deprecated
4963 add_cflags -W${armcc_opt},--diag_suppress=2523
4964 add_cflags -W${armcc_opt},--diag_suppress=1207
4965 add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
4966 add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
4967 add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
4968 add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
4969 elif enabled pathscale; then
4970 add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
4972 elif enabled_any msvc icl; then
4973 enabled x86_32 && disable aligned_stack
4974 enabled_all x86_32 debug && add_cflags -Oy-
4975 enabled debug && add_ldflags -debug
4976 enable pragma_deprecated
4977 if enabled icl; then
4978 # -Qansi-alias is basically -fstrict-aliasing, but does not work
4979 # (correctly) on icl 13.x.
4980 test_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
4981 add_cflags -Qansi-alias
4982 # icl will pass the inline asm tests but inline asm is currently
4983 # not supported (build will fail)
4986 # msvcrt10 x64 incorrectly enables log2, only msvcrt12 (MSVC 2013) onwards actually has log2.
4987 check_cpp_condition log2 crtversion.h "_VC_CRT_MAJOR_VERSION >= 12"
4988 # The CRT headers contain __declspec(restrict) in a few places, but if redefining
4989 # restrict, this might break. MSVC 2010 and 2012 fail with __declspec(__restrict)
4990 # (as it ends up if the restrict redefine is done before including stdlib.h), while
4991 # MSVC 2013 and newer can handle it fine.
4992 # If this declspec fails, force including stdlib.h before the restrict redefinition
4993 # happens in config.h.
4994 if [ $restrict_keyword != restrict ]; then
4995 test_cc <<EOF || add_cflags -FIstdlib.h
4996 __declspec($restrict_keyword) void *foo(int);
5001 for pfx in "" host_; do
5002 varname=${pfx%_}cc_type
5003 eval "type=\$$varname"
5004 if [ "$type" = "msvc" ]; then
5005 test_${pfx}cc <<EOF || add_${pfx}cflags -Dinline=__inline
5006 static inline int foo(int a) { return a; }
5013 add_asflags -Qunused-arguments
5019 check_ldflags -Qunused-arguments
5023 enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
5025 check_cmd pod2man --help
5026 check_cmd texi2html -version
5028 check_deps $CONFIG_LIST \
5033 flatten_extralibs(){
5034 unset nested_entries
5037 for entry in $list; do
5040 append nested_entries $(filter '*_extralibs' $entry_copy)
5041 flat_entries=$(filter_out '*_extralibs' $entry_copy)
5042 eval $entry="\$flat_entries"
5044 append $list_name "$nested_entries"
5046 resolve nested_entries
5047 if test -n "$(filter '*_extralibs' $nested_entries)"; then
5048 flatten_extralibs $list_name
5052 for linkunit in $LIBRARY_LIST; do
5053 unset current_extralibs
5054 eval components=\$$(toupper ${linkunit})_COMPONENTS_LIST
5055 for comp in ${components}; do
5056 enabled $comp || continue
5057 comp_extralibs="${comp}_extralibs"
5058 append current_extralibs $comp_extralibs
5060 eval prepend ${linkunit}_extralibs $current_extralibs
5063 for linkunit in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
5064 flatten_extralibs ${linkunit}_extralibs
5065 unique ${linkunit}_extralibs
5066 resolve ${linkunit}_extralibs
5067 eval ${linkunit}_extralibs=\$\(\$ldflags_filter \$${linkunit}_extralibs\)
5070 map 'enabled $v && intrinsics=${v#intrinsics_}' $INTRINSICS_LIST
5072 for thread in $THREADS_LIST; do
5073 if enabled $thread; then
5074 test -n "$thread_type" &&
5075 die "ERROR: Only one thread type must be selected." ||
5076 thread_type="$thread"
5080 if disabled stdatomic; then
5081 if enabled atomics_gcc; then
5082 add_cppflags '-I\$(SRC_PATH)/compat/atomics/gcc'
5083 elif enabled atomics_win32; then
5084 add_cppflags '-I\$(SRC_PATH)/compat/atomics/win32'
5085 elif enabled atomics_suncc; then
5086 add_cppflags '-I\$(SRC_PATH)/compat/atomics/suncc'
5087 elif enabled pthreads; then
5088 add_compat atomics/pthread/stdatomic.o
5089 add_cppflags '-I\$(SRC_PATH)/compat/atomics/pthread'
5091 enabled threads && die "Threading is enabled, but no atomics are available"
5092 add_cppflags '-I\$(SRC_PATH)/compat/atomics/dummy'
5096 enabled zlib && add_cppflags -DZLIB_CONST
5098 # conditional library dependencies, in linking order
5099 enabled movie_filter && prepend avfilter_deps "avformat avcodec"
5100 enabled_any asyncts_filter resample_filter &&
5101 prepend avfilter_deps "avresample"
5102 enabled scale_filter && prepend avfilter_deps "swscale"
5104 enabled opus_decoder && prepend avcodec_deps "avresample"
5108 eval "deps=\$$lib_deps"
5109 append $lib_deps $(map 'eval echo \$${v}_deps' $deps)
5113 map 'expand_deps $v' $LIBRARY_LIST
5115 if test "$quiet" != "yes"; then
5117 echo "install prefix $prefix"
5118 echo "source path $source_path"
5119 echo "C compiler $cc"
5120 echo "C library $libc_type"
5121 if test "$host_cc" != "$cc"; then
5122 echo "host C compiler $host_cc"
5123 echo "host C library $host_libc_type"
5125 echo "ARCH $arch ($cpu)"
5126 if test "$extra_version" != ""; then
5127 echo "version string suffix $extra_version"
5129 echo "big-endian ${bigendian-no}"
5130 echo "runtime cpu detection ${runtime_cpudetect-no}"
5131 if enabled x86; then
5132 echo "standalone assembly ${x86asm-no}"
5133 echo "x86 assembler ${x86asmexe}"
5134 echo "MMX enabled ${mmx-no}"
5135 echo "MMXEXT enabled ${mmxext-no}"
5136 echo "3DNow! enabled ${amd3dnow-no}"
5137 echo "3DNow! extended enabled ${amd3dnowext-no}"
5138 echo "SSE enabled ${sse-no}"
5139 echo "SSSE3 enabled ${ssse3-no}"
5140 echo "AVX enabled ${avx-no}"
5141 echo "XOP enabled ${xop-no}"
5142 echo "FMA3 enabled ${fma3-no}"
5143 echo "FMA4 enabled ${fma4-no}"
5144 echo "i686 features enabled ${i686-no}"
5145 echo "CMOV is fast ${fast_cmov-no}"
5146 echo "EBX available ${ebx_available-no}"
5147 echo "EBP available ${ebp_available-no}"
5149 if enabled aarch64; then
5150 echo "NEON enabled ${neon-no}"
5151 echo "VFP enabled ${vfp-no}"
5153 if enabled arm; then
5154 echo "ARMv5TE enabled ${armv5te-no}"
5155 echo "ARMv6 enabled ${armv6-no}"
5156 echo "ARMv6T2 enabled ${armv6t2-no}"
5157 echo "VFP enabled ${vfp-no}"
5158 echo "NEON enabled ${neon-no}"
5160 if enabled ppc; then
5161 echo "AltiVec enabled ${altivec-no}"
5162 echo "VSX enabled ${vsx-no}"
5163 echo "POWER8 enabled ${power8-no}"
5164 echo "PPC 4xx optimizations ${ppc4xx-no}"
5165 echo "dcbzl available ${dcbzl-no}"
5167 echo "debug symbols ${debug-no}"
5168 echo "optimize for size ${small-no}"
5169 echo "optimizations ${optimizations-no}"
5170 echo "static ${static-no}"
5171 echo "shared ${shared-no}"
5172 echo "network support ${network-no}"
5173 echo "threading support ${thread_type-no}"
5174 echo "safe bitstream reader ${safe_bitstream_reader-no}"
5176 echo "External libraries:"
5177 print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
5179 echo "External libraries providing hardware acceleration:"
5180 print_enabled '' $HWACCEL_LIBRARY_LIST | print_3_columns
5184 print_enabled '' $LIBRARY_LIST | print_3_columns
5188 print_enabled '' $PROGRAM_LIST | print_3_columns
5191 for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev; do
5192 echo "Enabled ${type}s:"
5193 eval list=\$$(toupper $type)_LIST
5194 print_enabled '_*' $list | print_3_columns
5198 if test -n "$ignore_tests"; then
5199 ignore_tests=$(echo $ignore_tests | tr ',' ' ')
5200 echo "Ignored FATE tests:"
5201 echo $ignore_tests | print_3_columns
5205 echo "License: $license"
5207 fi # test "$quiet" != "yes"
5209 test -n "$WARNINGS" && printf "\n$WARNINGS"
5211 test -e Makefile || echo "include $source_path/Makefile" > Makefile
5214 echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
5217 echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" > avbuild/config.fate
5219 config_files="$TMPH avbuild/config.mak"
5221 cat > avbuild/config.mak <<EOF
5222 # Automatically generated by configure - do not modify!
5223 LIBAV_CONFIGURATION=$LIBAV_CONFIGURATION
5225 LIBDIR=\$(DESTDIR)$libdir
5226 SHLIBDIR=\$(DESTDIR)$shlibdir
5227 INCDIR=\$(DESTDIR)$incdir
5228 BINDIR=\$(DESTDIR)$bindir
5229 DATADIR=\$(DESTDIR)$datadir
5230 DOCDIR=\$(DESTDIR)$docdir
5231 MANDIR=\$(DESTDIR)$mandir
5232 SRC_PATH=$source_path
5235 INTRINSICS=$intrinsics
5236 EXTERN_PREFIX=$extern_prefix
5242 DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
5244 DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
5246 DEPX86ASM=$x86asmexe
5247 DEPX86ASMFLAGS=\$(X86ASMFLAGS)
5258 OBJCFLAGS=$OBJCFLAGS
5274 LDEXEFLAGS=$LDEXEFLAGS
5275 LDSOFLAGS=$LDSOFLAGS
5276 SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
5277 STRIPFLAGS=$STRIPFLAGS
5278 X86ASMFLAGS=$X86ASMFLAGS
5285 EXTRA_VERSION=$extra_version
5287 CCDEP_FLAGS=$CCDEP_FLAGS
5289 ASDEP_FLAGS=$ASDEP_FLAGS
5290 X86ASMDEP=$X86ASMDEP
5291 X86ASMDEP_FLAGS=$X86ASMDEP_FLAGS
5292 CC_DEPFLAGS=$CC_DEPFLAGS
5293 AS_DEPFLAGS=$AS_DEPFLAGS
5294 X86ASM_DEPFLAGS=$X86ASM_DEPFLAGS
5297 HOSTCFLAGS=$host_cflags
5298 HOSTCPPFLAGS=$host_cppflags
5299 HOSTEXESUF=$HOSTEXESUF
5300 HOSTLDFLAGS=$host_ldflags
5301 HOSTEXTRALIBS=$host_extralibs
5303 DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
5304 HOSTCCDEP=$HOSTCCDEP
5305 HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
5306 HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
5310 TARGET_EXEC=$target_exec $target_exec_args
5311 TARGET_PATH=$target_path
5312 TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
5313 CFLAGS-avplay=$sdl_cflags
5314 CFLAGS_HEADERS=$CFLAGS_HEADERS
5315 LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
5316 EXTRALIBS=$extralibs
5317 COMPAT_OBJS=$compat_objs
5319 LIBTARGET=${LIBTARGET}
5320 SLIBNAME=${SLIBNAME}
5321 SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
5322 SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
5323 SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
5324 SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
5325 SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
5326 SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
5327 SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
5328 SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
5329 VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
5330 SAMPLES:=${samples:-\$(LIBAV_SAMPLES)}
5331 IGNORE_TESTS=$ignore_tests
5334 map 'eval echo "${v}_FFLIBS=\$${v}_deps" >> avbuild/config.mak' $LIBRARY_LIST
5336 for entry in $LIBRARY_LIST $PROGRAM_LIST $EXTRALIBS_LIST; do
5337 eval echo "EXTRALIBS-${entry}=\$${entry}_extralibs" >> avbuild/config.mak
5341 /* Automatically generated by configure - do not modify! */
5342 #ifndef LIBAV_CONFIG_H
5343 #define LIBAV_CONFIG_H
5344 #define LIBAV_CONFIGURATION "$(c_escape $LIBAV_CONFIGURATION)"
5345 #define LIBAV_LICENSE "$(c_escape $license)"
5346 #define AVCONV_DATADIR "$(eval c_escape $datadir)"
5347 #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
5348 #define EXTERN_PREFIX "${extern_prefix}"
5349 #define EXTERN_ASM ${extern_prefix}
5350 #define SLIBSUF "$SLIBSUF"
5353 test $restrict_keyword != restrict &&
5354 echo "#define restrict $restrict_keyword" >> $TMPH
5356 test -n "$malloc_prefix" &&
5357 echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
5359 if enabled x86asm; then
5360 append config_files $TMPASM
5362 ; Automatically generated by configure - do not modify!
5366 enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
5368 print_config ARCH_ "$config_files" $ARCH_LIST
5369 print_config HAVE_ "$config_files" $HAVE_LIST
5370 print_config CONFIG_ "$config_files" $CONFIG_LIST \
5374 echo "#endif /* LIBAV_CONFIG_H */" >> $TMPH
5376 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
5377 cp_if_changed $TMPH config.h
5378 touch avbuild/.config
5380 enabled x86asm && cp_if_changed $TMPASM config.asm
5383 /* Generated by libav configure */
5384 #ifndef AVUTIL_AVCONFIG_H
5385 #define AVUTIL_AVCONFIG_H
5388 print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
5390 echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
5392 cp_if_changed $TMPH libavutil/avconfig.h
5394 # generate the lists of enabled components
5395 print_enabled_components(){
5400 echo "static const $struct_name * const $name[] = {" > $TMPH
5402 enabled $c && printf " &ff_%s,\n" $c >> $TMPH
5404 echo " NULL };" >> $TMPH
5405 cp_if_changed $TMPH $file
5408 print_enabled_components libavcodec/bsf_list.c AVBitStreamFilter bitstream_filters $BSF_LIST
5409 print_enabled_components libavformat/protocol_list.c URLProtocol url_protocols $PROTOCOL_LIST
5411 # Settings for pkg-config files
5414 # Automatically generated by configure - do not modify!
5419 source_path=${source_path}
5422 extralibs_avutil="$avutil_extralibs"
5423 extralibs_avcodec="$avcodec_extralibs"
5424 extralibs_avformat="$avformat_extralibs"
5425 extralibs_avdevice="$avdevice_extralibs"
5426 extralibs_avfilter="$avfilter_extralibs"
5427 extralibs_avresample="$avresample_extralibs"
5428 extralibs_swscale="$swscale_extralibs"
5431 for lib in $LIBRARY_LIST; do
5432 lib_deps="$(eval echo \$${lib}_deps)"
5433 echo ${lib}_deps=\"$lib_deps\" >> $TMPH
5436 cp_if_changed $TMPH avbuild/config.sh