3 # FFmpeg 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 FFMPEG, 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 FFmpeg."
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 --list-decoders show all available decoders
67 --list-encoders show all available encoders
68 --list-hwaccels show all available hardware accelerators
69 --list-demuxers show all available demuxers
70 --list-muxers show all available muxers
71 --list-parsers show all available parsers
72 --list-protocols show all available protocols
73 --list-bsfs show all available bitstream filters
74 --list-indevs show all available input devices
75 --list-outdevs show all available output devices
76 --list-filters show all available filters
79 --logfile=FILE log tests and output to FILE [config.log]
80 --disable-logging do not log configure debug information
81 --fatal-warnings fail if any configure warning is generated
82 --prefix=PREFIX install in PREFIX [$prefix]
83 --bindir=DIR install binaries in DIR [PREFIX/bin]
84 --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg]
85 --docdir=DIR install documentation in DIR [PREFIX/share/doc/ffmpeg]
86 --libdir=DIR install libs in DIR [PREFIX/lib]
87 --shlibdir=DIR install shared libs in DIR [PREFIX/lib]
88 --incdir=DIR install includes in DIR [PREFIX/include]
89 --mandir=DIR install man page in DIR [PREFIX/share/man]
90 --enable-rpath use rpath to allow installing libraries in paths
91 not part of the dynamic linker search path
94 --enable-gpl allow use of GPL code, the resulting libs
95 and binaries will be under GPL [no]
96 --enable-version3 upgrade (L)GPL to version 3 [no]
97 --enable-nonfree allow use of nonfree code, the resulting libs
98 and binaries will be unredistributable [no]
100 Configuration options:
101 --disable-static do not build static libraries [no]
102 --enable-shared build shared libraries [no]
103 --enable-small optimize for size instead of speed
104 --disable-runtime-cpudetect disable detecting cpu capabilities at runtime (smaller binary)
105 --enable-gray enable full grayscale support (slower color)
106 --disable-swscale-alpha disable alpha channel support in swscale
107 --disable-all disable building components, libraries and programs
108 --enable-incompatible-libav-abi enable incompatible Libav fork ABI [no]
109 --enable-incompatible-fork-abi enable incompatible Libav fork ABI (deprecated) [no]
110 --enable-raise-major increase major version numbers in sonames [no]
113 --disable-programs do not build command line programs
114 --disable-ffmpeg disable ffmpeg build
115 --disable-ffplay disable ffplay build
116 --disable-ffprobe disable ffprobe build
117 --disable-ffserver disable ffserver build
119 Documentation options:
120 --disable-doc do not build documentation
121 --disable-htmlpages do not build HTML documentation pages
122 --disable-manpages do not build man documentation pages
123 --disable-podpages do not build POD documentation pages
124 --disable-txtpages do not build text documentation pages
127 --disable-avdevice disable libavdevice build
128 --disable-avcodec disable libavcodec build
129 --disable-avformat disable libavformat build
130 --disable-avutil disable libavutil build
131 --disable-swresample disable libswresample build
132 --disable-swscale disable libswscale build
133 --disable-postproc disable libpostproc build
134 --disable-avfilter disable libavfilter build
135 --enable-avresample enable libavresample build [no]
136 --disable-pthreads disable pthreads [auto]
137 --disable-w32threads disable Win32 threads [auto]
138 --disable-os2threads disable OS/2 threads [auto]
139 --disable-network disable network support [no]
140 --disable-dct disable DCT code
141 --disable-dwt disable DWT code
142 --disable-error-resilience disable error resilience code
143 --disable-lsp disable LSP code
144 --disable-lzo disable LZO decoder code
145 --disable-mdct disable MDCT code
146 --disable-rdft disable RDFT code
147 --disable-fft disable FFT code
149 Hardware accelerators:
150 --disable-dxva2 disable DXVA2 code [autodetect]
151 --disable-vaapi disable VAAPI code [autodetect]
152 --enable-vda enable VDA code
153 --disable-vdpau disable VDPAU code [autodetect]
155 Individual component options:
156 --disable-everything disable all components listed below
157 --disable-encoder=NAME disable encoder NAME
158 --enable-encoder=NAME enable encoder NAME
159 --disable-encoders disable all encoders
160 --disable-decoder=NAME disable decoder NAME
161 --enable-decoder=NAME enable decoder NAME
162 --disable-decoders disable all decoders
163 --disable-hwaccel=NAME disable hwaccel NAME
164 --enable-hwaccel=NAME enable hwaccel NAME
165 --disable-hwaccels disable all hwaccels
166 --disable-muxer=NAME disable muxer NAME
167 --enable-muxer=NAME enable muxer NAME
168 --disable-muxers disable all muxers
169 --disable-demuxer=NAME disable demuxer NAME
170 --enable-demuxer=NAME enable demuxer NAME
171 --disable-demuxers disable all demuxers
172 --enable-parser=NAME enable parser NAME
173 --disable-parser=NAME disable parser NAME
174 --disable-parsers disable all parsers
175 --enable-bsf=NAME enable bitstream filter NAME
176 --disable-bsf=NAME disable bitstream filter NAME
177 --disable-bsfs disable all bitstream filters
178 --enable-protocol=NAME enable protocol NAME
179 --disable-protocol=NAME disable protocol NAME
180 --disable-protocols disable all protocols
181 --enable-indev=NAME enable input device NAME
182 --disable-indev=NAME disable input device NAME
183 --disable-indevs disable input devices
184 --enable-outdev=NAME enable output device NAME
185 --disable-outdev=NAME disable output device NAME
186 --disable-outdevs disable output devices
187 --disable-devices disable all devices
188 --enable-filter=NAME enable filter NAME
189 --disable-filter=NAME disable filter NAME
190 --disable-filters disable all filters
192 External library support:
193 --enable-avisynth enable reading of AviSynth script files [no]
194 --disable-bzlib disable bzlib [autodetect]
195 --enable-fontconfig enable fontconfig
196 --enable-frei0r enable frei0r video filtering
197 --enable-gnutls enable gnutls [no]
198 --disable-iconv disable iconv [autodetect]
199 --enable-ladspa enable LADSPA audio filtering
200 --enable-libaacplus enable AAC+ encoding via libaacplus [no]
201 --enable-libass enable libass subtitles rendering [no]
202 --enable-libbluray enable BluRay reading using libbluray [no]
203 --enable-libcaca enable textual display using libcaca
204 --enable-libcelt enable CELT decoding via libcelt [no]
205 --enable-libcdio enable audio CD grabbing with libcdio
206 --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394
208 --enable-libfaac enable AAC encoding via libfaac [no]
209 --enable-libfdk-aac enable AAC de/encoding via libfdk-aac [no]
210 --enable-libflite enable flite (voice synthesis) support via libflite [no]
211 --enable-libfreetype enable libfreetype [no]
212 --enable-libgme enable Game Music Emu via libgme [no]
213 --enable-libgsm enable GSM de/encoding via libgsm [no]
214 --enable-libiec61883 enable iec61883 via libiec61883 [no]
215 --enable-libilbc enable iLBC de/encoding via libilbc [no]
216 --enable-libmodplug enable ModPlug via libmodplug [no]
217 --enable-libmp3lame enable MP3 encoding via libmp3lame [no]
218 --enable-libnut enable NUT (de)muxing via libnut,
219 native (de)muxer exists [no]
220 --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no]
221 --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no]
222 --enable-libopencv enable video filtering via libopencv [no]
223 --enable-libopenjpeg enable JPEG 2000 de/encoding via OpenJPEG [no]
224 --enable-libopus enable Opus decoding via libopus [no]
225 --enable-libpulse enable Pulseaudio input via libpulse [no]
226 --enable-libquvi enable quvi input via libquvi [no]
227 --enable-librtmp enable RTMP[E] support via librtmp [no]
228 --enable-libschroedinger enable Dirac de/encoding via libschroedinger [no]
229 --enable-libshine enable fixed-point MP3 encoding via libshine [no]
230 --enable-libsoxr enable Include libsoxr resampling [no]
231 --enable-libspeex enable Speex de/encoding via libspeex [no]
232 --enable-libssh enable SFTP protocol via libssh [no]
233 --enable-libstagefright-h264 enable H.264 decoding via libstagefright [no]
234 --enable-libtheora enable Theora encoding via libtheora [no]
235 --enable-libtwolame enable MP2 encoding via libtwolame [no]
236 --enable-libutvideo enable Ut Video encoding and decoding via libutvideo [no]
237 --enable-libv4l2 enable libv4l2/v4l-utils [no]
238 --enable-libvidstab enable video stabilization using vid.stab [no]
239 --enable-libvo-aacenc enable AAC encoding via libvo-aacenc [no]
240 --enable-libvo-amrwbenc enable AMR-WB encoding via libvo-amrwbenc [no]
241 --enable-libvorbis enable Vorbis en/decoding via libvorbis,
242 native implementation exists [no]
243 --enable-libvpx enable VP8 and VP9 de/encoding via libvpx [no]
244 --enable-libwavpack enable wavpack encoding via libwavpack [no]
245 --enable-libwebp enable WebP encoding via libwebp [no]
246 --enable-libx264 enable H.264 encoding via x264 [no]
247 --enable-libxavs enable AVS encoding via xavs [no]
248 --enable-libxvid enable Xvid encoding via xvidcore,
249 native MPEG-4/Xvid encoder exists [no]
250 --enable-libzmq enable message passing via libzmq [no]
251 --enable-libzvbi enable teletext support via libzvbi [no]
252 --enable-decklink enable Blackmagick DeckLink output [no]
253 --enable-openal enable OpenAL 1.1 capture support [no]
254 --enable-opencl enable OpenCL code
255 --enable-opengl enable OpenGL rendering [no]
256 --enable-openssl enable openssl [no]
257 --enable-x11grab enable X11 grabbing [no]
258 --disable-zlib disable zlib [autodetect]
260 Advanced options (experts only):
261 --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]
262 --enable-cross-compile assume a cross-compiler is used
263 --sysroot=PATH root of cross-build tree
264 --sysinclude=PATH location of cross-build system headers
265 --target-os=OS compiler targets OS [$target_os]
266 --target-exec=CMD command to run executables on target
267 --target-path=DIR path to view of build directory on target
268 --target-samples=DIR path to samples directory on target
269 --tempprefix=PATH force fixed dir/prefix instead of mktemp for checks
270 --toolchain=NAME set tool defaults according to NAME
271 --nm=NM use nm tool NM [$nm_default]
272 --ar=AR use archive tool AR [$ar_default]
273 --as=AS use assembler AS [$as_default]
274 --windres=WINDRES use windows resource compiler WINDRES [$windres_default]
275 --yasmexe=EXE use yasm-compatible assembler EXE [$yasmexe_default]
276 --cc=CC use C compiler CC [$cc_default]
277 --cxx=CXX use C compiler CXX [$cxx_default]
278 --dep-cc=DEPCC use dependency generator DEPCC [$cc_default]
279 --ld=LD use linker LD [$ld_default]
280 --host-cc=HOSTCC use host C compiler HOSTCC
281 --host-cflags=HCFLAGS use HCFLAGS when compiling for host
282 --host-cppflags=HCPPFLAGS use HCPPFLAGS when compiling for host
283 --host-ld=HOSTLD use host linker HOSTLD
284 --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host
285 --host-libs=HLIBS use libs HLIBS when linking for host
286 --host-os=OS compiler host OS [$target_os]
287 --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]
288 --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
289 --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
290 --extra-libs=ELIBS add ELIBS [$ELIBS]
291 --extra-version=STRING version string suffix []
292 --optflags=OPTFLAGS override optimization-related compiler flags
293 --build-suffix=SUFFIX library name suffix []
294 --malloc-prefix=PREFIX prefix malloc and related names with PREFIX
295 --progs-suffix=SUFFIX program name suffix []
296 --arch=ARCH select architecture [$arch]
297 --cpu=CPU select the minimum required CPU (affects
298 instruction selection, may crash on older CPUs)
299 --enable-pic build position-independent code
300 --enable-sram allow use of on-chip SRAM
301 --enable-thumb compile for Thumb instruction set
302 --disable-symver disable symbol versioning
303 --enable-hardcoded-tables use hardcoded tables instead of runtime generation
304 --disable-safe-bitstream-reader
305 disable buffer boundary checking in bitreaders
306 (faster, but may crash)
307 --enable-memalign-hack emulate memalign, interferes with memory debuggers
308 --enable-lto use link-time optimization
310 Optimization options (experts only):
311 --disable-asm disable all assembler optimizations
312 --disable-altivec disable AltiVec optimizations
313 --disable-amd3dnow disable 3DNow! optimizations
314 --disable-amd3dnowext disable 3DNow! extended optimizations
315 --disable-mmx disable MMX optimizations
316 --disable-mmxext disable MMXEXT optimizations
317 --disable-sse disable SSE optimizations
318 --disable-sse2 disable SSE2 optimizations
319 --disable-sse3 disable SSE3 optimizations
320 --disable-ssse3 disable SSSE3 optimizations
321 --disable-sse4 disable SSE4 optimizations
322 --disable-sse42 disable SSE4.2 optimizations
323 --disable-avx disable AVX optimizations
324 --disable-fma4 disable FMA4 optimizations
325 --disable-avx2 disable AVX2 optimizations
326 --disable-armv5te disable armv5te optimizations
327 --disable-armv6 disable armv6 optimizations
328 --disable-armv6t2 disable armv6t2 optimizations
329 --disable-vfp disable VFP optimizations
330 --disable-neon disable NEON optimizations
331 --disable-vis disable VIS optimizations
332 --disable-inline-asm disable use of inline assembler
333 --disable-yasm disable use of yasm assembler
334 --disable-mips32r2 disable MIPS32R2 optimizations
335 --disable-mipsdspr1 disable MIPS DSP ASE R1 optimizations
336 --disable-mipsdspr2 disable MIPS DSP ASE R2 optimizations
337 --disable-mipsfpu disable floating point MIPS optimizations
338 --disable-fast-unaligned consider unaligned accesses slow
340 Developer options (useful when working on FFmpeg itself):
341 --disable-debug disable debugging symbols
342 --enable-debug=LEVEL set the debug level [$debuglevel]
343 --disable-optimizations disable compiler optimizations
344 --enable-extra-warnings enable more compiler warnings
345 --disable-stripping disable stripping of executables and shared libraries
346 --assert-level=level 0(default), 1 or 2, amount of assertion testing,
347 2 causes a slowdown at runtime.
348 --enable-memory-poisoning fill heap uninitialized allocated space with arbitrary data
349 --valgrind=VALGRIND run "make fate" tests through valgrind to detect memory
350 leaks and errors, using the specified valgrind binary.
351 Cannot be combined with --target-exec
352 --enable-ftrapv Trap arithmetic overflows
353 --samples=PATH location of test samples for FATE, if not set use
354 \$FATE_SAMPLES at make invocation time.
355 --enable-neon-clobber-test check NEON registers for clobbering (should be
356 used only for debugging purposes)
357 --enable-xmm-clobber-test check XMM registers for clobbering (Win64-only;
358 should be used only for debugging purposes)
359 --enable-random randomly enable/disable components
361 --enable-random=LIST randomly enable/disable specific components or
362 --disable-random=LIST component groups. LIST is a comma-separated list
363 of NAME[:PROB] entries where NAME is a component
364 (group) and PROB the probability associated with
366 --random-seed=VALUE seed value for --enable/disable-random
368 NOTE: Object files are built at the place where configure is launched.
376 echo "$@" >> $logfile
381 pr -n -t $1 >> $logfile
392 WARNINGS="${WARNINGS}WARNING: $*\n"
399 If you think configure made a mistake, make sure you are using the latest
400 version from Git. If the latest version fails, report the problem to the
401 ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
403 if disabled logging; then
405 Rerun configure with logging enabled (do not use --disable-logging), and
406 include the log this produces with your report.
410 Include the log file "$logfile" produced by configure as this will help
417 # Avoid locale weirdness, besides we really just want to translate ASCII.
419 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
423 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
427 echo "$*" | sed 's/["\\]/\\\0/g'
431 v=$(echo "$1" | sed "s/'/'\\\\''/g")
432 test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'"
437 echo "$@" | sed 's/^ *//;s/ */ /g;s/ *$//;s/\r//g'
444 eval "case $v in $pat) echo $v ;; esac"
452 eval "case $v in $pat) ;; *) echo $v ;; esac"
459 for v; do eval $m; done
465 for v; do echo ${v}${suffix}; done
480 eval : \${$var:=$value}
485 echo $@ | sed 's/[^A-Za-z0-9_]/_/g'
491 eval $(sanitize_var_name "$var")='$*'
495 eval echo \$$(sanitize_var_name "$1")
500 eval level=\${${pvar}_level:=0}
501 eval ${pvar}_${level}="\$$pvar"
502 eval ${pvar}_level=$(($level+1))
508 eval level=\${${pvar}_level:-0}
509 test $level = 0 && continue
510 eval level=$(($level-1))
511 eval $pvar="\${${pvar}_${level}}"
512 eval ${pvar}_level=$level
513 eval unset ${pvar}_${level}
535 enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
541 disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g')
547 enabled $var && continue
548 eval sel="\$${var}_select"
549 eval sgs="\$${var}_suggest"
553 enable_deep_weak $sgs
565 disabled $var && continue
574 test "${1#!}" = "$1" && op== || op=!=
575 eval test "x\$${1#!}" $op "xyes"
579 test "${1#!}" = "$1" && op== || op=!=
580 eval test "x\$${1#!}" $op "xno"
585 enabled $opt || return 1
591 disabled $opt || return 1
597 enabled $opt && return 0
603 disabled $opt && return 0
610 eval : \${$opt:=\$${opt}_default}
618 [ $var = $value ] && return 0
626 enabled ${cfg}_checking && die "Circular dependency for $cfg."
627 disabled ${cfg}_checking && continue
628 enable ${cfg}_checking
631 eval dep_all="\$${cfg}_deps"
632 eval dep_any="\$${cfg}_deps_any"
633 eval dep_sel="\$${cfg}_select"
634 eval dep_sgs="\$${cfg}_suggest"
635 eval dep_ifa="\$${cfg}_if"
636 eval dep_ifn="\$${cfg}_if_any"
638 pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
639 do_check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn
640 popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn
642 [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; }
643 [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; }
644 enabled_all $dep_all || disable $cfg
645 enabled_any $dep_any || disable $cfg
646 disabled_any $dep_sel && disable $cfg
648 if enabled $cfg; then
650 enable_deep_weak $dep_sgs
653 disable ${cfg}_checking
662 for cfg in $allopts; do
663 enabled $cfg || continue
664 eval dep_extralibs="\$${cfg}_extralibs"
665 test -n "$dep_extralibs" && add_extralibs $dep_extralibs
673 map 'eval echo "$v \${$v:-no}"' "$@" |
674 awk "BEGIN { split(\"$files\", files) }
676 c = \"$pfx\" toupper(\$1);
682 if (file ~ /\\.h\$/) {
683 printf(\"#define %s %d\\n\", c, v) >>file;
684 } else if (file ~ /\\.asm\$/) {
685 printf(\"%%define %s %d\\n\", c, v) >>file;
686 } else if (file ~ /\\.mak\$/) {
687 n = -v ? \"\" : \"!\";
688 printf(\"%s%s=yes\\n\", n, c) >>file;
689 } else if (file ~ /\\.texi\$/) {
690 pre = -v ? \"\" : \"@c \";
693 gsub(/_/, \"-\", c2);
694 printf(\"%s@set %s %s\\n\", pre, c2, yesno) >>file;
704 enabled $v && printf "%s\n" ${v%$suf};
711 eval "$var=\"\$$var $*\""
717 eval "$var=\"$* \$$var\""
725 append CFLAGS $($cflags_filter "$@")
729 append CXXFLAGS $($cflags_filter "$@")
733 append ASFLAGS $($asflags_filter "$@")
737 append LDFLAGS $($ldflags_filter "$@")
741 append ASMSTRIPFLAGS "$@"
745 prepend extralibs $($ldflags_filter "$@")
749 append host_cppflags "$@"
753 append host_cflags $($host_cflags_filter "$@")
757 append host_ldflags $($host_ldflags_filter "$@")
761 append compat_objs $1
763 map 'add_cppflags -D$v' "$@"
768 "$@" >> $logfile 2>&1
772 eval printf '%s\\n' $CC_O
776 eval printf '%s\\n' $CC_E
783 check_cmd $cc $CPPFLAGS $CFLAGS "$@" $CC_C $(cc_o $TMPO) $TMPC
790 check_cmd $cxx $CPPFLAGS $CFLAGS $CXXFLAGS "$@" $CXX_C -o $TMPO $TMPCPP
797 check_cmd $cc $CPPFLAGS $CFLAGS "$@" $(cc_e $TMPO) $TMPC
801 eval printf '%s\\n' $AS_O
808 check_cmd $as $CPPFLAGS $ASFLAGS "$@" $AS_C $(as_o $TMPO) $TMPS
812 log check_inline_asm "$@"
817 check_cc "$@" <<EOF && enable $name
818 void foo(void){ __asm__ volatile($code); }
824 check_inline_asm ${1}_inline "\"$2\""
825 echo "$2" | check_as && enable ${1}_external || disable ${1}_external
833 check_cmd $yasmexe $YASMFLAGS -Werror "$@" -o $TMPO $TMPS
837 eval printf '%s\\n' $LD_O
844 flags=$(filter_out '-l*|*.so' $@)
845 libs=$(filter '-l*|*.so' $@)
846 check_$type $($cflags_filter $flags) || return
847 flags=$($ldflags_filter $flags)
848 libs=$($ldflags_filter $libs)
849 check_cmd $ld $LDFLAGS $flags $(ld_o $TMPE) $TMPO $libs $extralibs
854 test "${hdr%.h}" = "${hdr}" &&
855 echo "#include $hdr" ||
856 echo "#include <$hdr>"
866 for hdr in $headers; do
869 echo "int main(void) { $code; return 0; }"
870 } | check_$check "$@"
874 log check_cppflags "$@"
875 check_cc "$@" <<EOF && append CPPFLAGS "$@"
882 set -- $($cflags_filter "$@")
889 log check_cflags "$@"
890 test_cflags "$@" && add_cflags "$@"
894 log check_cxxflags "$@"
895 set -- $($cflags_filter "$@")
896 check_cxx "$@" <<EOF && append CXXFLAGS "$@"
902 log test_ldflags "$@"
903 check_ld "cc" "$@" <<EOF
904 int main(void){ return 0; }
909 log check_ldflags "$@"
910 test_ldflags "$@" && add_ldflags "$@"
914 log test_stripflags "$@"
915 # call check_cc to get a fresh TMPO
917 int main(void) { return 0; }
919 check_cmd $strip $ASMSTRIPFLAGS "$@" $TMPO
923 log check_stripflags "$@"
924 test_stripflags "$@" && add_stripflags "$@"
928 log check_header "$@"
932 check_cpp "$@" <<EOF && enable_safe $header
943 check_ld "cc" "$@" <<EOF && enable $func
945 int main(void){ $func(); }
950 log check_mathfunc "$@"
954 test $narg = 2 && args="f, g" || args="f"
956 check_ld "cc" "$@" <<EOF && enable $func
958 float foo(float f, float g) { return $func($args); }
959 int main(void){ return (int) foo; }
963 check_func_headers(){
964 log check_func_headers "$@"
969 for hdr in $headers; do
972 for func in $funcs; do
973 echo "long check_$func(void) { return (long) $func; }"
975 echo "int main(void) { return 0; }"
976 } | check_ld "cc" "$@" && enable $funcs && enable_safe $headers
979 check_class_headers_cpp(){
980 log check_class_headers_cpp "$@"
985 for hdr in $headers; do
986 echo "#include <$hdr>"
988 echo "int main(void) { "
990 for class in $classes; do
995 } | check_ld "cxx" "$@" && enable $funcs && enable_safe $headers
998 check_cpp_condition(){
999 log check_cpp_condition "$@"
1003 check_cpp "$@" <<EOF
1006 #error "unsatisfied condition: $condition"
1016 check_header $header && check_func $func "$@" && add_extralibs "$@"
1024 check_func_headers "$headers" "$funcs" "$@" && add_extralibs "$@"
1028 log check_lib_cpp "$@"
1032 check_class_headers_cpp "$headers" "$classes" "$@" && add_extralibs "$@"
1036 log check_pkg_config "$@"
1042 check_cmd $pkg_config --exists --print-errors $pkgandversion || return
1043 pkg_cflags=$($pkg_config --cflags $pkg)
1044 pkg_libs=$($pkg_config --libs $pkg)
1045 check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
1046 set_safe ${pkg}_cflags $pkg_cflags &&
1047 set_safe ${pkg}_libs $pkg_libs
1051 check_ld "cc" "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
1057 # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
1058 # are safe but may not be available everywhere. Thus we use
1059 # raise(SIGTERM) instead. The check is run in a subshell so we
1060 # can redirect the "Terminated" message from the shell. SIGBUS
1061 # is not defined by standard C so it is used conditionally.
1063 (check_exec "$@") >> $logfile 2>&1 <<EOF
1065 static void sighandler(int sig){
1071 int (*func_ptr)(void) = foo;
1073 signal(SIGILL, sighandler);
1074 signal(SIGFPE, sighandler);
1075 signal(SIGSEGV, sighandler);
1077 signal(SIGBUS, sighandler);
1089 disable_safe "$type"
1090 check_code cc "$headers" "$type v" "$@" && enable_safe "$type"
1094 log check_struct "$@"
1099 disable_safe "${struct}_${member}"
1100 check_code cc "$headers" "const void *p = &(($struct *)0)->$member" "$@" &&
1101 enable_safe "${struct}_${member}"
1105 log check_builtin "$@"
1111 check_code ld "$headers" "$builtin" "cc" "$@" && enable "$name"
1119 check_lib $header $func "$@" || die "ERROR: $name not found"
1127 check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
1135 check_lib_cpp "$headers" "$classes" "$@" || die "ERROR: $name not found"
1138 require_pkg_config(){
1140 check_pkg_config "$@" || die "ERROR: $pkg not found"
1141 add_cflags $(get_safe ${pkg}_cflags)
1142 add_extralibs $(get_safe ${pkg}_libs)
1145 require_libfreetype(){
1146 log require_libfreetype "$@"
1148 check_cmd $pkg_config --exists --print-errors $pkg \
1149 || die "ERROR: $pkg not found"
1150 pkg_cflags=$($pkg_config --cflags $pkg)
1151 pkg_libs=$($pkg_config --libs $pkg)
1153 echo "#include <ft2build.h>"
1154 echo "#include FT_FREETYPE_H"
1155 echo "long check_func(void) { return (long) FT_Init_FreeType; }"
1156 echo "int main(void) { return 0; }"
1157 } | check_ld "cc" $pkg_cflags $pkg_libs \
1158 && set_safe ${pkg}_cflags $pkg_cflags \
1159 && set_safe ${pkg}_libs $pkg_libs \
1160 || die "ERROR: $pkg not found"
1161 add_cflags $(get_safe ${pkg}_cflags)
1162 add_extralibs $(get_safe ${pkg}_libs)
1166 eval printf '%s\\n' $HOSTCC_E
1170 eval printf '%s\\n' $HOSTCC_O
1174 log check_host_cc "$@"
1177 check_cmd $host_cc $host_cflags "$@" $HOSTCC_C $(hostcc_o $TMPO) $TMPC
1181 log check_host_cpp "$@"
1184 check_cmd $host_cc $HOSTCPPFLAGS $HOSTCFLAGS "$@" $(hostcc_e $TMPO) $TMPC
1187 check_host_cppflags(){
1188 log check_host_cppflags "$@"
1189 check_host_cc "$@" <<EOF && append host_cppflags "$@"
1194 check_host_cflags(){
1195 log check_host_cflags "$@"
1196 set -- $($host_cflags_filter "$@")
1197 check_host_cc "$@" <<EOF && append host_cflags "$@"
1202 check_host_cpp_condition(){
1203 log check_host_cpp_condition "$@"
1207 check_host_cpp "$@" <<EOF
1210 #error "unsatisfied condition: $condition"
1218 "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
1222 cmp -s "$1" "$2" && echo "$2 is unchanged" && return
1223 mkdir -p "$(dirname $2)"
1227 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
1228 # system-dependent things.
1245 avio_reading_example
1246 decoding_encoding_example
1247 demuxing_decoding_example
1248 filtering_audio_example
1249 filtering_video_example
1253 resampling_audio_example
1254 scaling_video_example
1255 transcode_aac_example
1258 EXTERNAL_LIBRARY_LIST="
1363 $EXTERNAL_LIBRARY_LIST
1376 incompatible_libav_abi
1377 incompatible_fork_abi
1390 safe_bitstream_reader
1487 incompatible_libav_abi
1488 incompatible_fork_abi
1521 $(add_suffix _external $ARCH_EXT_LIST)
1522 $(add_suffix _inline $ARCH_EXT_LIST)
1542 cdio_paranoia_paranoia_h
1550 dev_bktr_ioctl_bt848_h
1551 dev_bktr_ioctl_meteor_h
1553 dev_video_bktr_ioctl_bt848_h
1554 dev_video_meteor_ioctl_meteor_h
1571 GetProcessAffinityMask
1572 GetProcessMemoryInfo
1574 GetSystemTimeAsFileTime
1588 jack_port_get_latency_range
1599 machine_ioctl_bt848_h
1600 machine_ioctl_meteor_h
1612 openjpeg_1_5_openjpeg_h
1626 SetConsoleTextAttribute
1635 struct_group_source_req
1636 struct_ip_mreq_source
1639 struct_rusage_ru_maxrss
1640 struct_sctp_event_subscribe
1642 struct_sockaddr_sa_len
1643 struct_sockaddr_storage
1644 struct_stat_st_mtim_tv_nsec
1645 struct_v4l2_frmivalenum_discrete
1648 sync_val_compare_and_swap
1675 # options emitted with CONFIG_ prefix but not available on the command line
1682 frame_thread_encoder
1787 # code dependency declarations
1789 # architecture extensions
1794 neon_deps_any="aarch64 arm"
1795 vfp_deps_any="aarch64 arm"
1798 map 'eval ${v}_inline_deps=inline_asm' $ARCH_EXT_LIST_ARM
1801 mips32r2_deps="mips"
1802 mipsdspr1_deps="mips"
1803 mipsdspr2_deps="mips"
1811 x86_64_select="i686"
1812 x86_64_suggest="fast_cmov"
1815 amd3dnowext_deps="amd3dnow"
1829 mmx_external_deps="yasm"
1830 mmx_inline_deps="inline_asm"
1831 mmx_suggest="mmx_external mmx_inline"
1833 for ext in $(filter_out mmx $ARCH_EXT_LIST_X86); do
1834 eval dep=\$${ext}_deps
1835 eval ${ext}_external_deps='"${dep}_external"'
1836 eval ${ext}_inline_deps='"${dep}_inline"'
1837 eval ${ext}_suggest='"${ext}_external ${ext}_inline"'
1840 aligned_stack_if_any="aarch64 ppc x86"
1841 fast_64bit_if_any="aarch64 alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64"
1842 fast_clz_if_any="aarch64 alpha avr32 mips ppc x86"
1843 fast_unaligned_if_any="aarch64 ppc x86"
1845 need_memalign="altivec neon sse"
1847 # system capabilities
1848 log2_deps="!libc_msvcrt"
1850 symver_if_any="symver_asm_label symver_gnu_asm"
1853 atomics_gcc_if="sync_val_compare_and_swap"
1854 atomics_suncc_if="atomic_cas_ptr machine_rw_barrier"
1855 atomics_win32_if="MemoryBarrier"
1856 atomics_native_if_any="$ATOMICS_LIST"
1857 threads_if_any="$THREADS_LIST"
1861 error_resilience_select="dsputil"
1862 frame_thread_encoder_deps="encoders threads"
1863 lpc_select="dsputil"
1866 mpegaudio_select="mpegaudiodsp"
1867 mpegaudiodsp_select="dct"
1868 mpegvideo_select="dsputil h264chroma hpeldsp videodsp"
1869 mpegvideoenc_select="mpegvideo"
1871 # decoders / encoders
1872 aac_decoder_select="mdct sinewin"
1873 aac_encoder_select="audio_frame_queue mdct sinewin"
1874 aac_latm_decoder_select="aac_decoder aac_latm_parser"
1875 ac3_decoder_select="mdct ac3dsp ac3_parser dsputil"
1876 ac3_encoder_select="mdct ac3dsp dsputil"
1877 ac3_fixed_encoder_select="mdct ac3dsp dsputil"
1878 aic_decoder_select="dsputil golomb"
1879 alac_encoder_select="lpc"
1880 als_decoder_select="dsputil"
1881 amrnb_decoder_select="lsp"
1882 amrwb_decoder_select="lsp"
1883 amv_decoder_select="dsputil hpeldsp exif"
1884 amv_encoder_select="aandcttables"
1885 ape_decoder_select="dsputil"
1886 asv1_decoder_select="dsputil"
1887 asv1_encoder_select="dsputil"
1888 asv2_decoder_select="dsputil"
1889 asv2_encoder_select="dsputil"
1890 atrac1_decoder_select="mdct sinewin"
1891 atrac3_decoder_select="mdct"
1892 atrac3p_decoder_select="mdct sinewin"
1893 avrn_decoder_select="exif"
1894 bink_decoder_select="dsputil hpeldsp"
1895 binkaudio_dct_decoder_select="mdct rdft dct sinewin"
1896 binkaudio_rdft_decoder_select="mdct rdft sinewin"
1897 cavs_decoder_select="dsputil golomb h264chroma videodsp"
1898 cllc_decoder_select="dsputil"
1899 comfortnoise_encoder_select="lpc"
1900 cook_decoder_select="dsputil mdct sinewin"
1901 cscd_decoder_select="lzo"
1902 cscd_decoder_suggest="zlib"
1903 dca_decoder_select="mdct"
1904 dirac_decoder_select="dsputil dwt golomb videodsp"
1905 dnxhd_decoder_select="dsputil"
1906 dnxhd_encoder_select="aandcttables dsputil mpegvideoenc"
1907 dvvideo_decoder_select="dsputil"
1908 dvvideo_encoder_select="dsputil"
1909 dxa_decoder_select="zlib"
1910 eac3_decoder_select="ac3_decoder"
1911 eac3_encoder_select="ac3_encoder"
1912 eamad_decoder_select="aandcttables dsputil mpegvideo"
1913 eatgq_decoder_select="aandcttables"
1914 eatqi_decoder_select="aandcttables error_resilience mpegvideo"
1915 exr_decoder_select="zlib"
1916 ffv1_decoder_select="dsputil golomb rangecoder"
1917 ffv1_encoder_select="dsputil rangecoder"
1918 ffvhuff_decoder_select="dsputil llviddsp"
1919 ffvhuff_encoder_select="dsputil huffman llviddsp"
1920 fic_decoder_select="dsputil golomb"
1921 flac_decoder_select="golomb"
1922 flac_encoder_select="dsputil golomb lpc"
1923 flashsv_decoder_select="zlib"
1924 flashsv_encoder_select="zlib"
1925 flashsv2_encoder_select="zlib"
1926 flashsv2_decoder_select="zlib"
1927 flv_decoder_select="h263_decoder"
1928 flv_encoder_select="h263_encoder"
1929 fourxm_decoder_select="dsputil"
1930 fraps_decoder_select="dsputil huffman"
1931 g2m_decoder_select="dsputil zlib"
1932 g729_decoder_select="dsputil"
1933 h261_decoder_select="error_resilience mpegvideo"
1934 h261_encoder_select="aandcttables mpegvideoenc"
1935 h263_decoder_select="error_resilience h263_parser h263dsp mpegvideo"
1936 h263_encoder_select="aandcttables h263dsp mpegvideoenc"
1937 h263i_decoder_select="h263_decoder"
1938 h263p_encoder_select="h263_encoder"
1939 h264_decoder_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
1940 h264_decoder_suggest="error_resilience"
1941 hevc_decoder_select="dsputil golomb videodsp"
1942 huffyuv_decoder_select="dsputil llviddsp"
1943 huffyuv_encoder_select="dsputil huffman llviddsp"
1944 iac_decoder_select="dsputil fft mdct sinewin"
1945 imc_decoder_select="dsputil fft mdct sinewin"
1946 indeo3_decoder_select="hpeldsp"
1947 interplay_video_decoder_select="hpeldsp"
1948 jpegls_decoder_select="dsputil golomb hpeldsp exif"
1949 jpegls_encoder_select="golomb"
1950 jv_decoder_select="dsputil"
1951 lagarith_decoder_select="dsputil"
1952 ljpeg_encoder_select="aandcttables mpegvideoenc"
1953 loco_decoder_select="golomb"
1954 mdec_decoder_select="dsputil error_resilience mpegvideo"
1955 metasound_decoder_select="lsp mdct sinewin"
1956 mimic_decoder_select="dsputil hpeldsp"
1957 mjpeg_decoder_select="dsputil hpeldsp exif"
1958 mjpegb_decoder_select="dsputil hpeldsp exif"
1959 mjpeg_encoder_select="aandcttables dsputil mpegvideoenc"
1960 mlp_decoder_select="dsputil mlp_parser"
1961 motionpixels_decoder_select="dsputil"
1962 mp1_decoder_select="mpegaudio"
1963 mp1float_decoder_select="mpegaudio"
1964 mp2_decoder_select="mpegaudio"
1965 mp2float_decoder_select="mpegaudio"
1966 mp3_decoder_select="mpegaudio"
1967 mp3adu_decoder_select="mpegaudio"
1968 mp3adufloat_decoder_select="mpegaudio"
1969 mp3float_decoder_select="mpegaudio"
1970 mp3on4_decoder_select="mpegaudio"
1971 mp3on4float_decoder_select="mpegaudio"
1972 mpc7_decoder_select="dsputil mpegaudiodsp"
1973 mpc8_decoder_select="dsputil mpegaudiodsp"
1974 mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h"
1975 mpeg_xvmc_decoder_select="mpeg2video_decoder"
1976 mpeg1video_decoder_select="error_resilience mpegvideo"
1977 mpeg1video_encoder_select="aandcttables mpegvideoenc h263dsp"
1978 mpeg2video_decoder_select="error_resilience mpegvideo"
1979 mpeg2video_encoder_select="aandcttables mpegvideoenc h263dsp"
1980 mpeg4_decoder_select="h263_decoder mpeg4video_parser"
1981 mpeg4_encoder_select="h263_encoder"
1982 msmpeg4v1_decoder_select="h263_decoder"
1983 msmpeg4v2_decoder_select="h263_decoder"
1984 msmpeg4v2_encoder_select="h263_encoder"
1985 msmpeg4v3_decoder_select="h263_decoder"
1986 msmpeg4v3_encoder_select="h263_encoder"
1987 mss2_decoder_select="error_resilience vc1_decoder"
1988 mxpeg_decoder_select="dsputil hpeldsp exif"
1989 nellymoser_decoder_select="mdct sinewin"
1990 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
1991 nuv_decoder_select="dsputil lzo"
1992 png_decoder_select="zlib"
1993 png_encoder_select="dsputil zlib"
1994 prores_decoder_select="dsputil"
1995 prores_encoder_select="dsputil"
1996 qcelp_decoder_select="lsp"
1997 qdm2_decoder_select="mdct rdft mpegaudiodsp"
1998 ra_144_encoder_select="audio_frame_queue lpc"
1999 ralf_decoder_select="golomb"
2000 rtjpeg_decoder_select="dsputil"
2001 rv10_decoder_select="error_resilience h263_decoder h263dsp"
2002 rv10_encoder_select="h263_encoder"
2003 rv20_decoder_select="error_resilience h263_decoder h263dsp"
2004 rv20_encoder_select="h263_encoder"
2005 rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
2006 rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
2007 shorten_decoder_select="golomb"
2008 sipr_decoder_select="lsp"
2009 snow_decoder_select="dsputil dwt h264qpel hpeldsp rangecoder"
2010 snow_encoder_select="aandcttables dsputil dwt h264qpel hpeldsp mpegvideoenc rangecoder"
2011 sonic_decoder_select="golomb rangecoder"
2012 sonic_encoder_select="golomb rangecoder"
2013 sonic_ls_encoder_select="golomb"
2014 sp5x_decoder_select="dsputil hpeldsp exif"
2015 svq1_decoder_select="hpeldsp"
2016 svq1_encoder_select="aandcttables dsputil hpeldsp mpegvideoenc"
2017 svq3_decoder_select="golomb h264chroma h264dsp h264pred h264qpel hpeldsp mpegvideo videodsp"
2018 svq3_decoder_suggest="error_resilience zlib"
2019 tak_decoder_select="dsputil"
2020 theora_decoder_select="vp3_decoder"
2021 tiff_decoder_suggest="zlib"
2022 tiff_encoder_suggest="zlib"
2023 thp_decoder_select="dsputil hpeldsp exif"
2024 truehd_decoder_select="mlp_parser"
2025 truemotion2_decoder_select="dsputil"
2026 truespeech_decoder_select="dsputil"
2027 tscc_decoder_select="zlib"
2028 twinvq_decoder_select="mdct lsp sinewin"
2029 utvideo_decoder_select="dsputil"
2030 utvideo_encoder_select="dsputil huffman"
2031 vble_decoder_select="dsputil"
2032 vc1_decoder_select="error_resilience h263_decoder h264chroma h264qpel intrax8"
2033 vc1image_decoder_select="vc1_decoder"
2034 vorbis_decoder_select="mdct"
2035 vorbis_encoder_select="mdct"
2036 vp3_decoder_select="hpeldsp vp3dsp videodsp"
2037 vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp"
2038 vp6_decoder_select="h264chroma hpeldsp huffman videodsp vp3dsp"
2039 vp6a_decoder_select="vp6_decoder"
2040 vp6f_decoder_select="vp6_decoder"
2041 vp8_decoder_select="h264pred videodsp"
2042 vp9_decoder_select="videodsp"
2043 webp_decoder_select="vp8_decoder"
2044 wmapro_decoder_select="mdct sinewin"
2045 wmav1_decoder_select="mdct sinewin"
2046 wmav1_encoder_select="mdct sinewin"
2047 wmav2_decoder_select="mdct sinewin"
2048 wmav2_encoder_select="mdct sinewin"
2049 wmavoice_decoder_select="lsp rdft dct mdct sinewin"
2050 wmv1_decoder_select="h263_decoder"
2051 wmv1_encoder_select="h263_encoder"
2052 wmv2_decoder_select="h263_decoder intrax8 videodsp"
2053 wmv2_encoder_select="h263_encoder"
2054 wmv3_decoder_select="vc1_decoder"
2055 wmv3image_decoder_select="wmv3_decoder"
2056 zerocodec_decoder_select="zlib"
2057 zlib_decoder_select="zlib"
2058 zlib_encoder_select="zlib"
2059 zmbv_decoder_select="zlib"
2060 zmbv_encoder_select="zlib"
2062 # hardware accelerators
2063 crystalhd_deps="libcrystalhd_libcrystalhd_if_h"
2064 dxva2_deps="dxva2api_h"
2065 vaapi_deps="va_va_h"
2066 vda_deps="VideoDecodeAcceleration_VDADecoder_h pthreads"
2067 vda_extralibs="-framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore"
2068 vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h"
2069 xvmc_deps="X11_extensions_XvMClib_h"
2071 h263_vaapi_hwaccel_deps="vaapi"
2072 h263_vaapi_hwaccel_select="h263_decoder"
2073 h263_vdpau_hwaccel_deps="vdpau"
2074 h263_vdpau_hwaccel_select="h263_decoder"
2075 h264_crystalhd_decoder_select="crystalhd h264_mp4toannexb_bsf h264_parser"
2076 h264_dxva2_hwaccel_deps="dxva2"
2077 h264_dxva2_hwaccel_select="h264_decoder"
2078 h264_vaapi_hwaccel_deps="vaapi"
2079 h264_vaapi_hwaccel_select="h264_decoder"
2080 h264_vda_decoder_deps="vda"
2081 h264_vda_decoder_select="h264_decoder"
2082 h264_vda_hwaccel_deps="vda"
2083 h264_vda_hwaccel_select="h264_decoder"
2084 h264_vdpau_decoder_deps="vdpau"
2085 h264_vdpau_decoder_select="h264_decoder"
2086 h264_vdpau_hwaccel_deps="vdpau"
2087 h264_vdpau_hwaccel_select="h264_decoder"
2088 mpeg_vdpau_decoder_deps="vdpau"
2089 mpeg_vdpau_decoder_select="mpeg2video_decoder"
2090 mpeg_xvmc_hwaccel_deps="xvmc"
2091 mpeg_xvmc_hwaccel_select="mpeg2video_decoder"
2092 mpeg1_vdpau_decoder_deps="vdpau"
2093 mpeg1_vdpau_decoder_select="mpeg1video_decoder"
2094 mpeg1_vdpau_hwaccel_deps="vdpau"
2095 mpeg1_vdpau_hwaccel_select="mpeg1video_decoder"
2096 mpeg1_xvmc_hwaccel_deps="xvmc"
2097 mpeg1_xvmc_hwaccel_select="mpeg1video_decoder"
2098 mpeg2_crystalhd_decoder_select="crystalhd"
2099 mpeg2_dxva2_hwaccel_deps="dxva2"
2100 mpeg2_dxva2_hwaccel_select="mpeg2video_decoder"
2101 mpeg2_vaapi_hwaccel_deps="vaapi"
2102 mpeg2_vaapi_hwaccel_select="mpeg2video_decoder"
2103 mpeg2_vdpau_hwaccel_deps="vdpau"
2104 mpeg2_vdpau_hwaccel_select="mpeg2video_decoder"
2105 mpeg2_xvmc_hwaccel_deps="xvmc"
2106 mpeg2_xvmc_hwaccel_select="mpeg2video_decoder"
2107 mpeg4_crystalhd_decoder_select="crystalhd"
2108 mpeg4_vaapi_hwaccel_deps="vaapi"
2109 mpeg4_vaapi_hwaccel_select="mpeg4_decoder"
2110 mpeg4_vdpau_decoder_deps="vdpau"
2111 mpeg4_vdpau_decoder_select="mpeg4_decoder"
2112 mpeg4_vdpau_hwaccel_deps="vdpau"
2113 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
2114 msmpeg4_crystalhd_decoder_select="crystalhd"
2115 vc1_crystalhd_decoder_select="crystalhd"
2116 vc1_dxva2_hwaccel_deps="dxva2"
2117 vc1_dxva2_hwaccel_select="vc1_decoder"
2118 vc1_vaapi_hwaccel_deps="vaapi"
2119 vc1_vaapi_hwaccel_select="vc1_decoder"
2120 vc1_vdpau_decoder_deps="vdpau"
2121 vc1_vdpau_decoder_select="vc1_decoder"
2122 vc1_vdpau_hwaccel_deps="vdpau"
2123 vc1_vdpau_hwaccel_select="vc1_decoder"
2124 wmv3_crystalhd_decoder_select="crystalhd"
2125 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
2126 wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel"
2127 wmv3_vdpau_decoder_select="vc1_vdpau_decoder"
2128 wmv3_vdpau_hwaccel_select="vc1_vdpau_hwaccel"
2131 h264_parser_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
2132 hevc_parser_select="hevc_decoder"
2133 mpeg4video_parser_select="error_resilience mpegvideo"
2134 mpegvideo_parser_select="error_resilience mpegvideo"
2135 vc1_parser_select="mpegvideo"
2137 # external libraries
2138 libaacplus_encoder_deps="libaacplus"
2139 libcelt_decoder_deps="libcelt"
2140 libfaac_encoder_deps="libfaac"
2141 libfaac_encoder_select="audio_frame_queue"
2142 libfdk_aac_decoder_deps="libfdk_aac"
2143 libfdk_aac_encoder_deps="libfdk_aac"
2144 libfdk_aac_encoder_select="audio_frame_queue"
2145 libgme_demuxer_deps="libgme"
2146 libgsm_decoder_deps="libgsm"
2147 libgsm_encoder_deps="libgsm"
2148 libgsm_ms_decoder_deps="libgsm"
2149 libgsm_ms_encoder_deps="libgsm"
2150 libilbc_decoder_deps="libilbc"
2151 libilbc_encoder_deps="libilbc"
2152 libmodplug_demuxer_deps="libmodplug"
2153 libmp3lame_encoder_deps="libmp3lame"
2154 libmp3lame_encoder_select="audio_frame_queue"
2155 libopencore_amrnb_decoder_deps="libopencore_amrnb"
2156 libopencore_amrnb_encoder_deps="libopencore_amrnb"
2157 libopencore_amrnb_encoder_select="audio_frame_queue"
2158 libopencore_amrwb_decoder_deps="libopencore_amrwb"
2159 libopenjpeg_decoder_deps="libopenjpeg"
2160 libopenjpeg_encoder_deps="libopenjpeg"
2161 libopus_decoder_deps="libopus"
2162 libopus_encoder_deps="libopus"
2163 libopus_encoder_select="audio_frame_queue"
2164 libquvi_demuxer_deps="libquvi"
2165 libschroedinger_decoder_deps="libschroedinger"
2166 libschroedinger_encoder_deps="libschroedinger"
2167 libshine_encoder_deps="libshine"
2168 libshine_encoder_select="audio_frame_queue"
2169 libspeex_decoder_deps="libspeex"
2170 libspeex_encoder_deps="libspeex"
2171 libspeex_encoder_select="audio_frame_queue"
2172 libstagefright_h264_decoder_deps="libstagefright_h264"
2173 libtheora_encoder_deps="libtheora"
2174 libtwolame_encoder_deps="libtwolame"
2175 libvo_aacenc_encoder_deps="libvo_aacenc"
2176 libvo_aacenc_encoder_select="audio_frame_queue"
2177 libvo_amrwbenc_encoder_deps="libvo_amrwbenc"
2178 libvorbis_decoder_deps="libvorbis"
2179 libvorbis_encoder_deps="libvorbis"
2180 libvorbis_encoder_select="audio_frame_queue"
2181 libvpx_vp8_decoder_deps="libvpx"
2182 libvpx_vp8_encoder_deps="libvpx"
2183 libvpx_vp9_decoder_deps="libvpx"
2184 libvpx_vp9_encoder_deps="libvpx"
2185 libwavpack_encoder_deps="libwavpack"
2186 libwebp_encoder_deps="libwebp"
2187 libx264_encoder_deps="libx264"
2188 libx264rgb_encoder_deps="libx264"
2189 libxavs_encoder_deps="libxavs"
2190 libxvid_encoder_deps="libxvid"
2191 libutvideo_decoder_deps="libutvideo"
2192 libutvideo_encoder_deps="libutvideo"
2193 libzvbi_teletext_decoder_deps="libzvbi"
2196 ac3_demuxer_select="ac3_parser"
2197 asf_demuxer_select="riffdec"
2198 asf_muxer_select="riffenc"
2199 asf_stream_muxer_select="asf_muxer"
2200 avi_demuxer_select="riffdec"
2201 avi_muxer_select="riffenc"
2202 avisynth_demuxer_deps="avisynth"
2203 avisynth_demuxer_select="riffdec"
2204 caf_demuxer_select="riffdec"
2205 dirac_demuxer_select="dirac_parser"
2206 dts_demuxer_select="dca_parser"
2207 dtshd_demuxer_select="dca_parser"
2208 dxa_demuxer_select="riffdec"
2209 eac3_demuxer_select="ac3_parser"
2210 f4v_muxer_select="mov_muxer"
2211 flac_demuxer_select="flac_parser"
2212 hds_muxer_select="flv_muxer"
2213 hls_muxer_select="mpegts_muxer"
2214 ipod_muxer_select="mov_muxer"
2215 ismv_muxer_select="mov_muxer"
2216 libnut_demuxer_deps="libnut"
2217 libnut_muxer_deps="libnut"
2218 matroska_audio_muxer_select="matroska_muxer"
2219 matroska_demuxer_select="riffdec"
2220 matroska_demuxer_suggest="bzlib lzo zlib"
2221 matroska_muxer_select="riffenc"
2222 mmf_muxer_select="riffenc"
2223 mov_demuxer_select="riffdec"
2224 mov_demuxer_suggest="zlib"
2225 mov_muxer_select="riffenc rtpenc_chain"
2226 mp3_demuxer_select="mpegaudio_parser"
2227 mp4_muxer_select="mov_muxer"
2228 mpegts_muxer_select="adts_muxer latm_muxer"
2229 mpegtsraw_demuxer_select="mpegts_demuxer"
2230 mxf_d10_muxer_select="mxf_muxer"
2231 nut_muxer_select="riffenc"
2232 nuv_demuxer_select="riffdec"
2233 ogg_demuxer_select="golomb"
2234 psp_muxer_select="mov_muxer"
2235 rtp_demuxer_select="sdp_demuxer"
2236 rtpdec_select="asf_demuxer rm_demuxer rtp_protocol mpegts_demuxer mov_demuxer"
2237 rtsp_demuxer_select="http_protocol rtpdec"
2238 rtsp_muxer_select="rtp_muxer http_protocol rtp_protocol rtpenc_chain"
2239 sap_demuxer_select="sdp_demuxer"
2240 sap_muxer_select="rtp_muxer rtp_protocol rtpenc_chain"
2241 sdp_demuxer_select="rtpdec"
2242 smoothstreaming_muxer_select="ismv_muxer"
2243 spdif_muxer_select="aac_parser"
2244 tak_demuxer_select="tak_parser"
2245 tg2_muxer_select="mov_muxer"
2246 tgp_muxer_select="mov_muxer"
2247 vobsub_demuxer_select="mpegps_demuxer"
2248 w64_demuxer_select="wav_demuxer"
2249 w64_muxer_select="wav_muxer"
2250 wav_demuxer_select="riffdec"
2251 wav_muxer_select="riffenc"
2252 webm_muxer_select="riffenc"
2253 wtv_demuxer_select="riffdec"
2254 wtv_muxer_select="riffenc"
2255 xmv_demuxer_select="riffdec"
2256 xwma_demuxer_select="riffdec"
2259 alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
2260 alsa_outdev_deps="alsa_asoundlib_h"
2261 bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
2262 caca_outdev_deps="libcaca"
2263 decklink_outdev_deps="decklink pthreads"
2264 decklink_outdev_extralibs="-lstdc++"
2265 dshow_indev_deps="IBaseFilter"
2266 dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid"
2267 dv1394_indev_deps="dv1394"
2268 dv1394_indev_select="dv_demuxer"
2269 fbdev_indev_deps="linux_fb_h"
2270 fbdev_outdev_deps="linux_fb_h"
2271 iec61883_indev_deps="libiec61883"
2272 jack_indev_deps="jack_jack_h sem_timedwait"
2273 lavfi_indev_deps="avfilter"
2274 libcdio_indev_deps="libcdio"
2275 libdc1394_indev_deps="libdc1394"
2276 libv4l2_indev_deps="libv4l2"
2277 openal_indev_deps="openal"
2278 opengl_outdev_deps="opengl"
2279 oss_indev_deps_any="soundcard_h sys_soundcard_h"
2280 oss_outdev_deps_any="soundcard_h sys_soundcard_h"
2281 pulse_indev_deps="libpulse"
2282 pulse_outdev_deps="libpulse"
2283 sdl_outdev_deps="sdl"
2284 sndio_indev_deps="sndio_h"
2285 sndio_outdev_deps="sndio_h"
2286 v4l_indev_deps="linux_videodev_h"
2287 v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
2288 v4l2_outdev_deps_any="linux_videodev2_h sys_videoio_h"
2289 vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines"
2290 vfwcap_indev_extralibs="-lavicap32"
2291 xv_outdev_deps="X11_extensions_Xvlib_h XvGetPortAttribute"
2292 xv_outdev_extralibs="-lXv -lX11 -lXext"
2293 x11grab_indev_deps="x11grab"
2296 bluray_protocol_deps="libbluray"
2297 ffrtmpcrypt_protocol_deps="!librtmp_protocol"
2298 ffrtmpcrypt_protocol_deps_any="gcrypt nettle openssl"
2299 ffrtmpcrypt_protocol_select="tcp_protocol"
2300 ffrtmphttp_protocol_deps="!librtmp_protocol"
2301 ffrtmphttp_protocol_select="http_protocol"
2302 ftp_protocol_select="tcp_protocol"
2303 gopher_protocol_select="network"
2304 httpproxy_protocol_select="tcp_protocol"
2305 http_protocol_select="tcp_protocol"
2306 https_protocol_select="tls_protocol"
2307 librtmp_protocol_deps="librtmp"
2308 librtmpe_protocol_deps="librtmp"
2309 librtmps_protocol_deps="librtmp"
2310 librtmpt_protocol_deps="librtmp"
2311 librtmpte_protocol_deps="librtmp"
2312 libssh_protocol_deps="libssh"
2313 mmsh_protocol_select="http_protocol"
2314 mmst_protocol_select="network"
2315 rtmp_protocol_deps="!librtmp_protocol"
2316 rtmp_protocol_select="tcp_protocol"
2317 rtmpe_protocol_select="ffrtmpcrypt_protocol"
2318 rtmps_protocol_deps="!librtmp_protocol"
2319 rtmps_protocol_select="tls_protocol"
2320 rtmpt_protocol_select="ffrtmphttp_protocol"
2321 rtmpte_protocol_select="ffrtmpcrypt_protocol ffrtmphttp_protocol"
2322 rtmpts_protocol_select="ffrtmphttp_protocol https_protocol"
2323 rtp_protocol_select="udp_protocol"
2324 sctp_protocol_deps="struct_sctp_event_subscribe"
2325 sctp_protocol_select="network"
2326 srtp_protocol_select="rtp_protocol"
2327 tcp_protocol_select="network"
2328 tls_protocol_deps_any="openssl gnutls"
2329 tls_protocol_select="tcp_protocol"
2330 udp_protocol_select="network"
2331 unix_protocol_deps="sys_un_h"
2332 unix_protocol_select="network"
2335 aconvert_filter_deps="swresample"
2336 amovie_filter_deps="avcodec avformat"
2337 aresample_filter_deps="swresample"
2338 ass_filter_deps="libass"
2339 asyncts_filter_deps="avresample"
2340 atempo_filter_deps="avcodec"
2341 atempo_filter_select="rdft"
2342 azmq_filter_deps="libzmq"
2343 blackframe_filter_deps="gpl"
2344 boxblur_filter_deps="gpl"
2345 colormatrix_filter_deps="gpl"
2346 cropdetect_filter_deps="gpl"
2347 dctdnoiz_filter_deps="avcodec"
2348 dctdnoiz_filter_select="fft"
2349 delogo_filter_deps="gpl"
2350 deshake_filter_deps="avcodec"
2351 deshake_filter_select="dsputil"
2352 drawtext_filter_deps="libfreetype"
2353 ebur128_filter_deps="gpl"
2354 flite_filter_deps="libflite"
2355 frei0r_filter_deps="frei0r dlopen"
2356 frei0r_filter_extralibs='$ldl'
2357 frei0r_src_filter_deps="frei0r dlopen"
2358 frei0r_src_filter_extralibs='$ldl'
2359 geq_filter_deps="gpl"
2360 histeq_filter_deps="gpl"
2361 hqdn3d_filter_deps="gpl"
2362 interlace_filter_deps="gpl"
2363 kerndeint_filter_deps="gpl"
2364 ladspa_filter_deps="ladspa dlopen"
2365 mcdeint_filter_deps="avcodec gpl"
2366 movie_filter_deps="avcodec avformat"
2367 mp_filter_deps="gpl avcodec swscale inline_asm"
2368 mpdecimate_filter_deps="gpl avcodec"
2369 mptestsrc_filter_deps="gpl"
2370 negate_filter_deps="lut_filter"
2371 perspective_filter_deps="gpl"
2372 resample_filter_deps="avresample"
2373 ocv_filter_deps="libopencv"
2374 owdenoise_filter_deps="gpl"
2375 pan_filter_deps="swresample"
2376 phase_filter_deps="gpl"
2377 pp_filter_deps="gpl postproc"
2378 pullup_filter_deps="gpl"
2379 removelogo_filter_deps="avcodec avformat swscale"
2380 sab_filter_deps="gpl swscale"
2381 scale_filter_deps="swscale"
2382 smartblur_filter_deps="gpl swscale"
2383 showspectrum_filter_deps="avcodec"
2384 showspectrum_filter_select="rdft"
2385 spp_filter_deps="gpl avcodec"
2386 spp_filter_select="fft"
2387 stereo3d_filter_deps="gpl"
2388 subtitles_filter_deps="avformat avcodec libass"
2389 super2xsai_filter_deps="gpl"
2390 tinterlace_filter_deps="gpl"
2391 vidstabdetect_filter_deps="libvidstab"
2392 vidstabtransform_filter_deps="libvidstab"
2393 pixfmts_super2xsai_test_deps="super2xsai_filter"
2394 tinterlace_merge_test_deps="tinterlace_filter"
2395 tinterlace_pad_test_deps="tinterlace_filter"
2396 zmq_filter_deps="libzmq"
2399 avio_reading="avformat avcodec avutil"
2400 decoding_encoding_example_deps="avcodec avutil"
2401 demuxing_decoding_example_deps="avcodec avformat avutil"
2402 filtering_audio_example_deps="avfilter avcodec avformat avutil"
2403 filtering_video_example_deps="avfilter avcodec avformat avutil"
2404 metadata_example_deps="avformat avutil"
2405 muxing_example_deps="avcodec avformat avutil swscale"
2406 remuxing_example_deps="avcodec avformat avutil"
2407 resampling_audio_example_deps="avutil swresample"
2408 scaling_video_example_deps="avutil swscale"
2409 transcode_aac_example_deps="avcodec avformat swresample"
2412 avcodec_deps="avutil"
2413 avdevice_deps="avutil avcodec avformat"
2414 avfilter_deps="avutil"
2415 avformat_deps="avutil avcodec"
2416 avresample_deps="avutil"
2417 postproc_deps="avutil gpl"
2418 swscale_deps="avutil"
2421 ffmpeg_deps="avcodec avfilter avformat swresample"
2422 ffmpeg_select="aformat_filter anull_filter atrim_filter format_filter
2424 setpts_filter trim_filter"
2425 ffplay_deps="avcodec avformat swscale swresample sdl"
2426 ffplay_select="rdft crop_filter"
2427 ffprobe_deps="avcodec avformat"
2428 ffserver_deps="avformat fork sarestart"
2429 ffserver_select="ffm_muxer rtp_protocol rtsp_demuxer"
2430 ffserver_extralibs='$ldl'
2433 podpages_deps="perl"
2434 manpages_deps="perl pod2man"
2435 htmlpages_deps="perl texi2html"
2436 txtpages_deps="perl makeinfo"
2437 doc_deps_any="manpages htmlpages podpages txtpages"
2439 # default parameters
2441 logfile="config.log"
2443 # installation paths
2444 prefix_default="/usr/local"
2445 bindir_default='${prefix}/bin'
2446 datadir_default='${prefix}/share/ffmpeg'
2447 docdir_default='${prefix}/share/doc/ffmpeg'
2448 incdir_default='${prefix}/include'
2449 libdir_default='${prefix}/lib'
2450 mandir_default='${prefix}/share/man'
2451 shlibdir_default="$libdir_default"
2457 host_cc_default="gcc"
2463 pkg_config_default=pkg-config
2465 strip_default="strip"
2466 yasmexe_default="yasm"
2467 windres_default="windres"
2472 arch_default=$(uname -m)
2476 target_os_default=$(tolower $(uname -s))
2477 host_os=$target_os_default
2479 # configurable options
2480 enable $PROGRAM_LIST
2481 enable $DOCUMENT_LIST
2482 enable $EXAMPLE_LIST
2483 enable $(filter_out avresample $LIBRARY_LIST)
2489 enable optimizations
2490 enable runtime_cpudetect
2491 enable safe_bitstream_reader
2493 enable swscale_alpha
2495 # Enable hwaccels by default.
2496 enable dxva2 vaapi vdpau xvmc
2499 SHFLAGS='-shared -Wl,-soname,$$(@F)'
2502 FULLNAME='$(NAME)$(BUILDSUF)'
2503 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
2506 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
2507 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
2508 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
2509 LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
2510 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_VERSION)'
2511 SLIB_INSTALL_LINKS='$(SLIBNAME_WITH_MAJOR) $(SLIBNAME)'
2533 host_cflags_filter=echo
2534 host_ldflags_filter=echo
2536 target_path='$(CURDIR)'
2538 # since the object filename is not given with the -MM flag, the compiler
2539 # is only able to print the basename, and we must add the path ourselves
2540 DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
2544 if test -f configure; then
2547 source_path=$(cd $(dirname "$0"); pwd)
2548 echo "$source_path" | grep -q '[[:blank:]]' &&
2549 die "Out of tree builds are impossible with whitespace in source path."
2550 test -e "$source_path/config.h" &&
2551 die "Out of tree builds are impossible with config.h in source dir."
2558 FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}"
2564 file=$source_path/$3
2565 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
2568 ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
2569 DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
2570 HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c)
2571 PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
2572 BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
2573 MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
2574 DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
2575 OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c)
2576 INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c)
2577 PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
2578 FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
2594 for n in $COMPONENT_LIST; do
2595 v=$(toupper ${n%s})_LIST
2597 eval ${n}_if_any="\$$v"
2600 enable $ARCH_EXT_LIST
2603 echo "Unknown option \"$1\"."
2604 echo "See $0 --help for available options."
2609 cat | tr ' ' '\n' | sort | pr -r -3 -t
2615 echo $* | sed s/$suffix//g | print_3_columns
2627 is_in ${comp} $COMPONENT_LIST && eval comp=\$$(toupper ${comp%s})_LIST
2628 echo "prob ${prob:-0.5}"
2636 random_seed=$(awk "BEGIN { srand($random_seed); print srand() }")
2637 $action $(rand_list "$@" | awk "BEGIN { srand($random_seed) } \$1 == \"prob\" { prob = \$2; next } rand() < prob { print }")
2647 add_extralibs $optval
2650 disable $INDEV_LIST $OUTDEV_LIST
2653 debuglevel="$optval"
2656 disable $PROGRAM_LIST
2658 --disable-everything)
2659 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
2662 map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST
2663 disable $LIBRARY_LIST $PROGRAM_LIST doc
2665 --enable-random|--disable-random)
2666 action=${opt%%-random}
2667 do_random ${action#--} $COMPONENT_LIST
2669 --enable-random=*|--disable-random=*)
2670 action=${opt%%-random=*}
2671 do_random ${action#--} $optval
2673 --enable-*=*|--disable-*=*)
2674 eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
2675 is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
2676 eval list=\$$(toupper $thing)_LIST
2677 name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
2678 list=$(filter "$name" $list)
2679 [ "$list" = "" ] && warn "Option $opt did not match anything"
2682 --enable-?*|--disable-?*)
2683 eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
2684 if is_in $option $COMPONENT_LIST; then
2685 test $action = disable && action=unset
2686 eval $action \$$(toupper ${option%s})_LIST
2687 elif is_in $option $CMDLINE_SELECT; then
2694 NAME="${opt#--list-}"
2695 is_in $NAME $COMPONENT_LIST || die_unknown $opt
2697 eval show_list $NAME \$$(toupper $NAME)_LIST
2699 --help|-h) show_help
2701 --fatal-warnings) enable fatal_warnings
2704 optname="${opt%%=*}"
2705 optname="${optname#--}"
2706 optname=$(echo "$optname" | sed 's/-/_/g')
2707 if is_in $optname $CMDLINE_SET; then
2708 eval $optname='$optval'
2709 elif is_in $optname $CMDLINE_APPEND; then
2710 append $optname "$optval"
2718 disabled logging && logfile=/dev/null
2720 echo "# $0 $FFMPEG_CONFIGURATION" > $logfile
2723 test -n "$cross_prefix" && enable cross_compile
2725 if enabled cross_compile; then
2726 test -n "$arch" && test -n "$target_os" ||
2727 die "Must specify target arch and OS when cross-compiling"
2730 ar_default="${cross_prefix}${ar_default}"
2731 cc_default="${cross_prefix}${cc_default}"
2732 cxx_default="${cross_prefix}${cxx_default}"
2733 nm_default="${cross_prefix}${nm_default}"
2734 pkg_config_default="${cross_prefix}${pkg_config_default}"
2735 ranlib="${cross_prefix}${ranlib}"
2736 strip_default="${cross_prefix}${strip_default}"
2737 windres_default="${cross_prefix}${windres_default}"
2739 sysinclude_default="${sysroot}/usr/include"
2741 test -n "$valgrind" && toolchain="valgrind-memcheck"
2743 case "$toolchain" in
2746 add_cflags -fsanitize=address
2747 add_ldflags -fsanitize=address
2751 add_cflags -fsanitize=thread -pie
2752 add_ldflags -fsanitize=thread -pie
2756 add_cflags -fsanitize=address
2757 add_ldflags -fsanitize=address
2761 add_cflags -fsanitize=thread -pie -fPIC
2762 add_ldflags -fsanitize=thread -pie -fPIC
2765 target_exec_default=${valgrind:-"valgrind"}
2766 target_exec_args="--tool=massif --alloc-fn=av_malloc --alloc-fn=av_mallocz --alloc-fn=av_calloc --alloc-fn=av_fast_padded_malloc --alloc-fn=av_fast_malloc --alloc-fn=av_realloc_f --alloc-fn=av_fast_realloc --alloc-fn=av_realloc"
2769 target_exec_default=${valgrind:-"valgrind"}
2770 target_exec_args="--error-exitcode=1 --malloc-fill=0x2a --track-origins=yes --leak-check=full --gen-suppressions=all --suppressions=$source_path/tests/fate-valgrind.supp"
2773 # Check whether the current MSVC version needs the C99 converter.
2774 # From MSVC 2013 (compiler major version 18) onwards, it does actually
2775 # support enough of C99 to build ffmpeg. Default to the new
2776 # behaviour if the regexp was unable to match anything, since this
2777 # successfully parses the version number of existing supported
2778 # versions that require the converter (MSVC 2010 and 2012).
2779 cl_major_ver=$(cl 2>&1 | sed -n 's/.*Version \([[:digit:]]\{1,\}\)\..*/\1/p')
2780 if [ -z "$cl_major_ver" ] || [ $cl_major_ver -ge 18 ]; then
2783 cc_default="c99wrap cl"
2786 nm_default="dumpbin -symbols"
2788 target_os_default="win32"
2789 # Use a relative path for TMPDIR. This makes sure all the
2790 # ffconf temp files are written with a relative path, avoiding
2791 # issues with msys/win32 path conversion for MSVC parameters
2792 # such as -Fo<file> or -out:<file>.
2798 nm_default="dumpbin -symbols"
2800 target_os_default="win32"
2804 add_cflags -fprofile-arcs -ftest-coverage
2805 add_ldflags -fprofile-arcs -ftest-coverage
2808 add_cflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all
2809 add_ldflags -Wl,-z,relro -Wl,-z,now
2812 die "Unknown toolchain $toolchain"
2816 set_default arch cc cxx pkg_config strip sysinclude target_exec target_os yasmexe
2817 enabled cross_compile || host_cc_default=$cc
2820 if ! $pkg_config --version >/dev/null 2>&1; then
2821 warn "$pkg_config not found, library detection may fail."
2827 mingw32*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;;
2831 EXESUF=$(exesuf $target_os)
2832 HOSTEXESUF=$(exesuf $host_os)
2834 # set temporary file name
2835 : ${TMPDIR:=$TEMPDIR}
2839 if [ -n "$tempprefix" ] ; then
2841 echo $tempprefix.${HOSTNAME}.${UID}
2843 elif ! check_cmd mktemp -u XXXXXX; then
2844 # simple replacement for missing mktemp
2845 # NOT SAFE FOR GENERAL USE
2847 echo "${2%%XXX*}.${HOSTNAME}.${UID}.$$"
2852 tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
2853 (set -C; exec > $tmp) 2>/dev/null ||
2854 die "Unable to create temporary file in $TMPDIR."
2855 append TMPFILES $tmp
2859 trap 'rm -f -- $TMPFILES' EXIT
2864 tmpfile TMPE $EXESUF
2875 # make sure we can execute files in $TMPDIR
2876 cat > $TMPSH 2>> $logfile <<EOF
2879 chmod +x $TMPSH >> $logfile 2>&1
2880 if ! $TMPSH >> $logfile 2>&1; then
2882 Unable to create and execute files in $TMPDIR. Set the TMPDIR environment
2883 variable to another directory and make sure that it is not mounted noexec.
2885 die "Sanity test failed."
2891 -std=c99) echo -c99 ;;
2892 -mcpu=*) echo -arch ${flag#*=} ;;
2893 -mieee) echo -ieee ;;
2894 -O*|-fast) echo $flag ;;
2895 -fno-math-errno) echo -assume nomath_errno ;;
2897 -Wall) echo -msg_enable level2 ;;
2898 -Wno-pointer-sign) echo -msg_disable ptrmismatch1 ;;
2899 -Wl,*) echo $flag ;;
2909 -Wno-switch) echo -Wno-switch-enum ;;
2910 -Wno-format-zero-length) ;;
2911 -Wdisabled-optimization) ;;
2912 -Wno-pointer-sign) echo -Wno-other ;;
2918 msvc_common_flags(){
2921 # In addition to specifying certain flags under the compiler
2922 # specific filters, they must be specified here as well or else the
2923 # generic catch all at the bottom will print the original flag.
2927 -fomit-frame-pointer) ;;
2931 -fno-signed-zeros) ;;
2935 -lz) echo zlib.lib ;;
2936 -lavifil32) echo vfw32.lib ;;
2937 -lavicap32) echo vfw32.lib user32.lib ;;
2938 -l*) echo ${flag#-l}.lib ;;
2945 msvc_common_flags "$@"
2948 -Wall) echo -W4 -wd4244 -wd4127 -wd4018 -wd4389 \
2949 -wd4146 -wd4057 -wd4204 -wd4706 -wd4305 \
2950 -wd4152 -wd4324 -we4013 -wd4100 -wd4214 \
2958 msvc_common_flags "$@"
2961 # Despite what Intel's documentation says -Wall, which is supported
2962 # on Windows, does enable remarks so disable them here.
2963 -Wall) echo $flag -Qdiag-disable:remark ;;
2964 -std=c99) echo -Qstd=c99 ;;
2972 -flto) echo -Mipa=fast,libopt,libinline,vestigial ;;
2973 -fomit-frame-pointer) echo -Mnoframe ;;
2984 case "${flag#*=}" in
2985 native) echo -xtarget=native ;;
2986 v9|niagara) echo -xarch=sparc ;;
2987 ultrasparc) echo -xarch=sparcvis ;;
2988 ultrasparc3|niagara2) echo -xarch=sparcvis2 ;;
2989 i586|pentium) echo -xchip=pentium ;;
2990 i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;;
2991 pentium3*|c3-2) echo -xtarget=pentium3 ;;
2992 pentium-m) echo -xarch=sse2 -xchip=pentium3 ;;
2993 pentium4*) echo -xtarget=pentium4 ;;
2994 prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;;
2995 *-sse3) echo -xarch=sse3 ;;
2996 core2) echo -xarch=ssse3 -xchip=core2 ;;
2997 corei7) echo -xarch=sse4_2 -xchip=nehalem ;;
2998 corei7-avx) echo -xarch=avx -xchip=sandybridge ;;
2999 amdfam10|barcelona) echo -xtarget=barcelona ;;
3000 bdver*) echo -xarch=avx ;;
3001 athlon-4|athlon-[mx]p) echo -xarch=ssea ;;
3002 k8|opteron|athlon64|athlon-fx)
3003 echo -xarch=sse2a ;;
3004 athlon*) echo -xarch=pentium_proa ;;
3007 -std=c99) echo -xc99 ;;
3008 -fomit-frame-pointer) echo -xregs=frameptr ;;
3009 -fPIC) echo -KPIC -xcode=pic32 ;;
3010 -W*,*) echo $flag ;;
3011 -f*-*|-W*|-mimpure-text) ;;
3022 case "${flag#*=}" in
3023 armv7-a|cortex-a*) echo -mv=7a8 ;;
3024 armv7-r|cortex-r*) echo -mv=7r4 ;;
3025 armv7-m|cortex-m*) echo -mv=7m3 ;;
3026 armv6*|arm11*) echo -mv=6 ;;
3027 armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26])
3029 armv4*|arm7*|arm9[24]*) echo -mv=4 ;;
3032 -mfpu=neon) echo --float_support=vfpv3 --neon ;;
3033 -mfpu=vfp) echo --float_support=vfpv2 ;;
3034 -mfpu=vfpv3) echo --float_support=vfpv3 ;;
3035 -mfpu=vfpv3-d16) echo --float_support=vfpv3d16 ;;
3036 -msoft-float) echo --float_support=vfplib ;;
3037 -O[0-3]|-mf=*) echo $flag ;;
3039 -pds=*) echo $flag ;;
3040 -D*|-I*) echo $flag ;;
3041 --gcc|--abi=*) echo $flag ;;
3051 unset _type _ident _cc_c _cc_e _cc_o _flags _cflags
3052 unset _ld_o _ldflags _ld_lib _ld_path
3053 unset _depflags _DEPCMD _DEPFLAGS
3056 if $_cc --version 2>&1 | grep -q '^GNU assembler'; then
3057 true # no-op to avoid reading stdin in following checks
3058 elif $_cc -v 2>&1 | grep -q '^gcc.*LLVM'; then
3060 gcc_extra_ver=$(expr "$($_cc --version | head -n1)" : '.*\((.*)\)')
3061 _ident="llvm-gcc $($_cc -dumpversion) $gcc_extra_ver"
3062 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3065 elif $_cc -v 2>&1 | grep -qi ^gcc; then
3067 gcc_version=$($_cc --version | head -n1)
3068 gcc_basever=$($_cc -dumpversion)
3069 gcc_pkg_ver=$(expr "$gcc_version" : '[^ ]* \(([^)]*)\)')
3070 gcc_ext_ver=$(expr "$gcc_version" : ".*$gcc_pkg_ver $gcc_basever \\(.*\\)")
3071 _ident=$(cleanws "gcc $gcc_basever $gcc_pkg_ver $gcc_ext_ver")
3072 if ! $_cc -dumpversion | grep -q '^2\.'; then
3073 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3077 elif $_cc --version 2>/dev/null | grep -q ^icc; then
3079 _ident=$($_cc --version | head -n1)
3084 elif $_cc -v 2>&1 | grep -q xlc; then
3086 _ident=$($_cc -qversion 2>/dev/null | head -n1)
3088 _cflags_size='-O5 -qcompact'
3089 elif $_cc -V 2>/dev/null | grep -q Compaq; then
3091 _ident=$($_cc -V | head -n1 | cut -d' ' -f1-3)
3093 _cflags_speed='-fast'
3095 _flags_filter=ccc_flags
3096 elif $_cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then
3097 test -d "$sysroot" || die "No valid sysroot specified."
3099 _ident=$($_cc --vsn | head -n1)
3100 armcc_conf="$PWD/armcc.conf"
3101 $_cc --arm_linux_configure \
3102 --arm_linux_config_file="$armcc_conf" \
3103 --configure_sysroot="$sysroot" \
3104 --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 ||
3105 die "Error creating armcc configuration file."
3106 $_cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc
3107 _flags="--arm_linux_config_file=$armcc_conf --translate_gcc"
3108 as_default="${cross_prefix}gcc"
3112 elif $_cc -version 2>/dev/null | grep -Eq 'TMS470|TI ARM'; then
3114 _ident=$($_cc -version | head -n1 | tr -s ' ')
3115 _flags='--gcc --abi=eabi -me'
3118 _depflags='-ppa -ppd=$(@:.o=.d)'
3119 _cflags_speed='-O3 -mf=5'
3120 _cflags_size='-O3 -mf=2'
3121 _flags_filter=tms470_flags
3122 elif $_cc -v 2>&1 | grep -q clang; then
3124 _ident=$($_cc --version | head -n1)
3125 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3128 elif $_cc -V 2>&1 | grep -q Sun; then
3130 _ident=$($_cc -V 2>&1 | head -n1 | cut -d' ' -f 2-)
3131 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)'
3132 _DEPFLAGS='-xM1 -xc99'
3135 _cflags_size='-O5 -xspace'
3136 _flags_filter=suncc_flags
3137 elif $_cc -v 2>&1 | grep -q 'PathScale\|Path64'; then
3139 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3140 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3143 _flags_filter='filter_out -Wdisabled-optimization'
3144 elif $_cc -v 2>&1 | grep -q Open64; then
3146 _ident=$($_cc -v 2>&1 | head -n1 | tr -d :)
3147 _depflags='-MMD -MF $(@:.o=.d) -MT $@'
3150 _flags_filter='filter_out -Wdisabled-optimization|-Wtype-limits|-fno-signed-zeros'
3151 elif $_cc -V 2>&1 | grep -q Portland; then
3153 _ident="PGI $($_cc -V 2>&1 | awk '/^pgcc/ { print $2; exit }')"
3154 opt_common='-alias=ansi -Mdse -Mlre -Mpre'
3155 _cflags_speed="-O3 -Mautoinline -Munroll=c:4 $opt_common"
3156 _cflags_size="-O2 -Munroll=c:1 $opt_common"
3158 _flags_filter=pgi_flags
3159 elif $_cc 2>&1 | grep -q Microsoft; then
3161 _ident=$($cc 2>&1 | head -n1)
3162 _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '\''/including/ { sub(/^.*file: */, ""); gsub(/\\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }'\'' > $(@:.o=.d)'
3163 _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'
3166 if $_cc 2>&1 | grep -q Linker; then
3173 _flags_filter=msvc_flags
3175 _ld_path='-libpath:'
3177 _cflags='-D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -Dinline=__inline -FIstdlib.h -Dstrtoll=_strtoi64'
3178 if [ $pfx = hostcc ]; then
3179 append _cflags -Dsnprintf=_snprintf
3182 elif $_cc 2>&1 | grep -q Intel; then
3184 _ident=$($cc 2>&1 | head -n1)
3185 _depflags='-QMMD -QMF$(@:.o=.d) -QMT$@'
3186 # Not only is O3 broken on 13.x+ but it is slower on all previous
3187 # versions (tested) as well.
3189 _cflags_size="-O1 -Oi" # -O1 without -Oi miscompiles stuff
3190 if $_cc 2>&1 | grep -q Linker; then
3197 _flags_filter=icl_flags
3199 _ld_path='-libpath:'
3200 # -Qdiag-error to make icl error when seeing certain unknown arguments
3201 _flags='-nologo -Qdiag-error:4044,10157'
3202 # -Qvec- -Qsimd- to prevent miscompilation, -GS for consistency
3203 # with MSVC which enables it by default.
3204 _cflags='-D_USE_MATH_DEFINES -FIstdlib.h -Dstrtoll=_strtoi64 -Qms0 -Qvec- -Qsimd- -GS'
3205 if [ $pfx = hostcc ]; then
3206 append _cflags -Dsnprintf=_snprintf
3208 elif $_cc --version 2>/dev/null | grep -q ^cparser; then
3210 _ident=$($_cc --version | head -n1)
3214 _flags_filter=cparser_flags
3217 eval ${pfx}_type=\$_type
3218 eval ${pfx}_ident=\$_ident
3222 eval ${1}_C=\${_cc_c-\${${1}_C}}
3223 eval ${1}_E=\${_cc_e-\${${1}_E}}
3224 eval ${1}_O=\${_cc_o-\${${1}_O}}
3226 if [ -n "$_depflags" ]; then
3227 eval ${1}_DEPFLAGS=\$_depflags
3229 eval ${1}DEP=\${_DEPCMD:-\$DEPCMD}
3230 eval ${1}DEP_FLAGS=\${_DEPFLAGS:-\$DEPFLAGS}
3231 eval DEP${1}FLAGS=\$_flags
3236 cflags_filter=$_flags_filter
3237 cflags_speed=$_cflags_speed
3238 cflags_size=$_cflags_size
3239 cflags_noopt=$_cflags_noopt
3240 add_cflags $_flags $_cflags
3241 cc_ldflags=$_ldflags
3244 probe_cc hostcc "$host_cc"
3245 host_cflags_filter=$_flags_filter
3246 add_host_cflags $_flags $_cflags
3249 test -n "$cc_type" && enable $cc_type ||
3250 warn "Unknown C compiler $cc, unable to select optimal CFLAGS"
3252 : ${as_default:=$cc}
3253 : ${dep_cc_default:=$cc}
3254 : ${ld_default:=$cc}
3255 : ${host_ld_default:=$host_cc}
3256 set_default ar as dep_cc ld host_ld windres
3259 asflags_filter=$_flags_filter
3260 add_asflags $_flags $_cflags
3264 ldflags_filter=$_flags_filter
3265 add_ldflags $_flags $_ldflags
3266 test "$cc_type" != "$ld_type" && add_ldflags $cc_ldflags
3268 LD_LIB=${_ld_lib-$LD_LIB}
3269 LD_PATH=${_ld_path-$LD_PATH}
3271 probe_cc hostld "$host_ld"
3272 host_ldflags_filter=$_flags_filter
3273 add_host_ldflags $_flags $_ldflags
3274 HOSTLD_O=${_ld_o-$HOSTLD_O}
3276 if [ -z "$CC_DEPFLAGS" ] && [ "$dep_cc" != "$cc" ]; then
3277 probe_cc depcc "$dep_cc"
3278 CCDEP=${_DEPCMD:-$DEPCMD}
3279 CCDEP_FLAGS=${_DEPFLAGS:=$DEPFLAGS}
3283 if $ar 2>&1 | grep -q Microsoft; then
3286 elif $ar 2>&1 | grep -q 'Texas Instruments'; then
3289 elif $ar 2>&1 | grep -q 'Usage: ar.*-X.*any'; then
3290 arflags='-Xany -r -c'
3297 add_cflags $extra_cflags
3298 add_cxxflags $extra_cxxflags
3299 add_asflags $extra_cflags
3301 if test -n "$sysroot"; then
3304 add_cppflags --sysroot="$sysroot"
3305 add_ldflags --sysroot="$sysroot"
3308 add_cppflags -I"$sysinclude"
3309 add_ldflags --sysroot="$sysroot"
3314 if test "$cpu" = host; then
3315 enabled cross_compile &&
3316 die "--cpu=host makes no sense when cross-compiling."
3321 $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
3323 s/.*$1=\\([^ ]*\\).*/\\1/
3328 cpu=$(check_native -march || check_native -mcpu)
3332 test "${cpu:-host}" = host &&
3333 die "--cpu=host not supported with compiler $cc"
3336 # Deal with common $arch aliases
3350 "Power Macintosh"|ppc*|powerpc*)
3365 i[3-6]86|i86pc|BePC|x86pc|x86_64|x86_32|amd64)
3370 is_in $arch $ARCH_LIST || warn "unknown architecture $arch"
3373 # Add processor-specific flags
3374 if enabled aarch64; then
3378 cpuflags="-march=$cpu"
3381 cpuflags="-mcpu=$cpu"
3385 elif enabled alpha; then
3387 cpuflags="-mcpu=$cpu"
3389 elif enabled arm; then
3392 check_cpp_condition stddef.h \
3393 "defined __ARM_ARCH_${1}__ || defined __TARGET_ARCH_${2:-$1}" \
3398 if check_arm_arch 4; then echo armv4;
3399 elif check_arm_arch 4T; then echo armv4t;
3400 elif check_arm_arch 5; then echo armv5;
3401 elif check_arm_arch 5E; then echo armv5e;
3402 elif check_arm_arch 5T; then echo armv5t;
3403 elif check_arm_arch 5TE; then echo armv5te;
3404 elif check_arm_arch 5TEJ; then echo armv5te;
3405 elif check_arm_arch 6; then echo armv6;
3406 elif check_arm_arch 6J; then echo armv6j;
3407 elif check_arm_arch 6K; then echo armv6k;
3408 elif check_arm_arch 6Z; then echo armv6z;
3409 elif check_arm_arch 6ZK; then echo armv6zk;
3410 elif check_arm_arch 6T2; then echo armv6t2;
3411 elif check_arm_arch 7; then echo armv7;
3412 elif check_arm_arch 7A 7_A; then echo armv7-a;
3413 elif check_arm_arch 7R 7_R; then echo armv7-r;
3414 elif check_arm_arch 7M 7_M; then echo armv7-m;
3415 elif check_arm_arch 7EM 7E_M; then echo armv7-m;
3416 elif check_arm_arch 8A 8_A; then echo armv8-a;
3420 [ "$cpu" = generic ] && cpu=$(probe_arm_arch)
3424 cpuflags="-march=$cpu"
3425 subarch=$(echo $cpu | sed 's/[^a-z0-9]//g')
3428 cpuflags="-mcpu=$cpu"
3430 cortex-a*) subarch=armv7a ;;
3431 cortex-r*) subarch=armv7r ;;
3432 cortex-m*) enable thumb; subarch=armv7m ;;
3433 arm11*) subarch=armv6 ;;
3434 arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;;
3435 armv4*|arm7*|arm9[24]*) subarch=armv4 ;;
3436 *) subarch=$(probe_arm_arch) ;;
3442 armv5t*) enable fast_clz ;;
3443 armv[6-8]*) enable fast_clz fast_unaligned ;;
3446 elif enabled avr32; then
3451 cpuflags="-mpart=$cpu"
3455 cpuflags="-march=$cpu"
3459 cpuflags="-mcpu=$cpu"
3463 cpuflags="-march=$cpu"
3467 elif enabled bfin; then
3469 cpuflags="-mcpu=$cpu"
3471 elif enabled mips; then
3473 cpuflags="-march=$cpu"
3489 24kef*|34kf*|1004kf*)
3497 elif enabled ppc; then
3499 case $(tolower $cpu) in
3500 601|ppc601|powerpc601)
3501 cpuflags="-mcpu=601"
3504 603*|ppc603*|powerpc603*)
3505 cpuflags="-mcpu=603"
3508 604*|ppc604*|powerpc604*)
3509 cpuflags="-mcpu=604"
3512 g3|75*|ppc75*|powerpc75*)
3513 cpuflags="-mcpu=750"
3516 g4|745*|ppc745*|powerpc745*)
3517 cpuflags="-mcpu=7450"
3519 74*|ppc74*|powerpc74*)
3520 cpuflags="-mcpu=7400"
3522 g5|970|ppc970|powerpc970)
3523 cpuflags="-mcpu=970"
3526 cpuflags="-mcpu=$cpu"
3529 cpuflags="-mcpu=cell"
3533 cpuflags="-mcpu=e500mc"
3537 cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double"
3541 cpuflags="-mcpu=8540 -mhard-float"
3546 elif enabled sparc; then
3549 cypress|f93[04]|tsc701|sparcl*|supersparc|hypersparc|niagara|v[789])
3550 cpuflags="-mcpu=$cpu"
3553 ultrasparc*|niagara[234])
3554 cpuflags="-mcpu=$cpu"
3558 elif enabled x86; then
3562 cpuflags="-march=$cpu"
3565 # targets that do NOT support nopl and conditional mov (cmov)
3566 pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
3567 cpuflags="-march=$cpu"
3570 # targets that do support nopl and conditional mov (cmov)
3571 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*)
3572 cpuflags="-march=$cpu"
3576 # targets that do support conditional mov but on which it's slow
3577 pentium4|pentium4m|prescott|nocona)
3578 cpuflags="-march=$cpu"
3586 if [ "$cpu" != generic ]; then
3587 add_cflags $cpuflags
3588 add_asflags $cpuflags
3591 # compiler sanity check
3593 int main(void){ return 0; }
3595 if test "$?" != 0; then
3596 echo "$cc is unable to create an executable file."
3597 if test -z "$cross_prefix" && ! enabled cross_compile ; then
3598 echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
3599 echo "Only do this if you know what cross compiling means."
3601 die "C compiler test failed."
3604 add_cppflags -D_ISOC99_SOURCE
3605 add_cxxflags -D__STDC_CONSTANT_MACROS
3606 check_cflags -std=c99
3607 check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
3610 check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE
3614 add_host_cppflags -D_ISOC99_SOURCE
3615 check_host_cflags -std=c99
3616 check_host_cflags -Wall
3617 check_host_cflags -O3
3623 check_code cc "" "int test[2*($expr) - 1]" &&
3624 subarch=$arch64 || subarch=$arch32
3632 check_64bit mips mips64 '_MIPS_SIM > 1'
3636 check_64bit parisc parisc64 'sizeof(void *) > 4'
3640 check_64bit ppc ppc64 'sizeof(void *) > 4'
3644 check_64bit sparc sparc64 'sizeof(void *) > 4'
3648 check_64bit x86_32 x86_64 'sizeof(void *) > 4'
3649 if test "$subarch" = "x86_64"; then
3654 check_cc <<EOF && subarch="ppc64"
3655 int test[(int)sizeof(char*) - 7];
3661 enabled spic && enable_weak pic
3667 add_cppflags '-I\$(SRC_PATH)/compat/aix'
3668 enabled shared && add_ldflags -Wl,-brtl
3671 prefix_default="/boot/common"
3672 network_extralibs="-lnetwork"
3676 SHFLAGS='-shared -Wl,-h,$$(@F)'
3677 enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS"
3678 network_extralibs="-lsocket -lnsl"
3679 # When using suncc to build, the Solaris linker will mark
3680 # an executable with each instruction set encountered by
3681 # the Solaris assembler. As our libraries contain their own
3682 # guards for processor-specific code, instead suppress
3683 # generation of the HWCAPS ELF section on Solaris x86 only.
3684 enabled_all suncc x86 &&
3685 echo "hwcap_1 = OVERRIDE;" > mapfile &&
3686 add_ldflags -Wl,-M,mapfile
3687 nm_default='nm -P -g'
3691 oss_indev_extralibs="-lossaudio"
3692 oss_outdev_extralibs="-lossaudio"
3693 enabled gcc || check_ldflags -Wl,-zmuldefs
3698 SLIB_INSTALL_NAME='$(SLIBNAME).$(LIBMAJOR).$(LIBMINOR)'
3700 oss_indev_extralibs="-lossaudio"
3701 oss_outdev_extralibs="-lossaudio"
3709 add_extralibs -lpoll -lgnugetopt
3713 gas="gas-preprocessor.pl $cc"
3714 enabled ppc && add_asflags -force_cpusubtype_ALL
3715 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR)'
3716 enabled x86_32 && append SHFLAGS -Wl,-read_only_relocs,suppress
3718 add_ldflags -Wl,-dynamic,-search_paths_first
3720 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
3721 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
3723 enabled x86_64 && objformat="macho64"
3724 enabled_any pic shared ||
3725 { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
3728 if test $target_os = "mingw32ce"; then
3734 if enabled x86_64; then
3735 LIBTARGET="i386:x86-64"
3736 elif enabled arm; then
3739 enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
3740 check_ldflags -Wl,--nxcompat
3741 check_ldflags -Wl,--dynamicbase
3742 shlibdir_default="$bindir_default"
3745 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
3746 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
3747 dlltool="${cross_prefix}dlltool"
3748 if check_cmd lib.exe -list; then
3749 SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
3750 if enabled x86_64; then
3753 elif check_cmd $dlltool --version; then
3754 SLIB_EXTRA_CMD=-'sed -e "s/ @[^ ]*//" $$(@:$(SLIBSUF)=.orig.def) > $$(@:$(SLIBSUF)=.def); $(DLLTOOL) -m $(LIBTARGET) -d $$(@:$(SLIBSUF)=.def) -l $(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib) -D $(SLIBNAME_WITH_MAJOR)'
3756 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3758 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
3759 SLIB_INSTALL_EXTRA_LIB='lib$(SLIBNAME:$(SLIBSUF)=.dll.a) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
3760 SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.orig.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
3767 if enabled shared; then
3768 # Link to the import library instead of the normal static library
3771 # Cannot build both shared and static libs with MSVC or icl.
3774 shlibdir_default="$bindir_default"
3777 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
3778 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
3779 SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
3780 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3782 SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
3783 SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
3784 SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
3791 shlibdir_default="$bindir_default"
3794 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
3795 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
3796 SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
3798 SLIB_INSTALL_EXTRA_LIB='lib$(FULLNAME).dll.a'
3799 SHFLAGS='-shared -Wl,--out-implib,$(SUBDIR)lib$(FULLNAME).dll.a'
3802 enabled shared && ! enabled small && check_cmd $windres --version && enable gnu_windres
3804 *-dos|freedos|opendos)
3805 network_extralibs="-lsocket"
3808 add_cppflags -U__STRICT_ANSI__
3815 ranlib="echo ignoring ranlib"
3821 add_cppflags -D_GNU_SOURCE
3822 add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
3823 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
3827 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
3828 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
3829 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
3830 echo PROTMODE >> $(SUBDIR)$(NAME).def; \
3831 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
3832 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
3833 echo EXPORTS >> $(SUBDIR)$(NAME).def; \
3834 emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
3835 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
3836 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
3837 SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
3839 enable_weak os2threads
3842 add_cppflags -D_BSD_SOURCE
3847 add_cppflags -D_QNX_SOURCE
3848 network_extralibs="-lsocket"
3853 add_cflags --include=$sysinclude/gcce/gcce.h -fvisibility=default
3854 add_cppflags -D__GCCE__ -D__SYMBIAN32__ -DSYMBIAN_OE_POSIX_SIGNALS
3855 add_ldflags -Wl,--target1-abs,--no-undefined \
3856 -Wl,-Ttext,0x80000,-Tdata,0x1000000 -shared \
3857 -Wl,--entry=_E32Startup -Wl,-u,_E32Startup
3858 add_extralibs -l:eexe.lib -l:usrt2_2.lib -l:dfpaeabi.dso \
3859 -l:drtaeabi.dso -l:scppnwdl.dso -lsupc++ -lgcc \
3860 -l:libc.dso -l:libm.dso -l:euser.dso -l:libcrt0.lib
3863 add_cppflags -D_OSF_SOURCE -D_POSIX_PII -D_REENTRANT
3868 add_cppflags -D_C99_SNPRINTF_EXTENSION \
3869 -D_REENTRANT_SOURCE \
3870 -D_RESEARCH_SOURCE \
3873 add_compat strtod.o strtod=avpriv_strtod
3874 network_extralibs='-lbsd'
3875 exeobjs=compat/plan9/main.o
3882 die "Unknown OS '$target_os'."
3886 # determine libc flavour
3891 # uclibc defines __GLIBC__, so it needs to be checked before glibc.
3892 if check_${pfx}cpp_condition features.h "defined __UCLIBC__"; then
3893 eval ${pfx}libc_type=uclibc
3894 add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
3895 elif check_${pfx}cpp_condition features.h "defined __GLIBC__"; then
3896 eval ${pfx}libc_type=glibc
3897 add_${pfx}cppflags -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600
3898 # MinGW headers can be installed on Cygwin, so check for newlib first.
3899 elif check_${pfx}cpp_condition newlib.h "defined _NEWLIB_VERSION"; then
3900 eval ${pfx}libc_type=newlib
3901 add_${pfx}cppflags -U__STRICT_ANSI__
3902 # MinGW64 is backwards compatible with MinGW32, so check for it first.
3903 elif check_${pfx}cpp_condition _mingw.h "defined __MINGW64_VERSION_MAJOR"; then
3904 eval ${pfx}libc_type=mingw64
3905 if check_${pfx}cpp_condition _mingw.h "__MINGW64_VERSION_MAJOR < 3"; then
3906 add_compat msvcrt/snprintf.o
3907 add_cflags "-include $source_path/compat/msvcrt/snprintf.h"
3909 add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
3910 eval test \$${pfx_no_}cc_type = "gcc" &&
3911 add_${pfx}cppflags -D__printf__=__gnu_printf__
3912 elif check_${pfx}cpp_condition _mingw.h "defined __MINGW_VERSION" ||
3913 check_${pfx}cpp_condition _mingw.h "defined __MINGW32_VERSION"; then
3914 eval ${pfx}libc_type=mingw32
3915 check_${pfx}cpp_condition _mingw.h "__MINGW32_MAJOR_VERSION > 3 || \
3916 (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
3917 die "ERROR: MinGW32 runtime version must be >= 3.15."
3918 add_${pfx}cppflags -U__STRICT_ANSI__ -D__USE_MINGW_ANSI_STDIO=1
3919 eval test \$${pfx_no_}cc_type = "gcc" &&
3920 add_${pfx}cppflags -D__printf__=__gnu_printf__
3921 elif check_${pfx}cpp_condition crtversion.h "defined _VC_CRT_MAJOR_VERSION"; then
3922 eval ${pfx}libc_type=msvcrt
3923 # The MSVC 2010 headers (Win 7.0 SDK) set _WIN32_WINNT to
3924 # 0x601 by default unless something else is set by the user.
3925 # This can easily lead to us detecting functions only present
3926 # in such new versions and producing binaries requiring windows 7.0.
3927 # Therefore explicitly set the default to XP unless the user has
3928 # set something else on the command line.
3929 check_${pfx}cpp_condition stdlib.h "defined(_WIN32_WINNT)" ||
3930 add_${pfx}cppflags -D_WIN32_WINNT=0x0502
3931 elif check_${pfx}cpp_condition stddef.h "defined __KLIBC__"; then
3932 eval ${pfx}libc_type=klibc
3933 elif check_${pfx}cpp_condition sys/cdefs.h "defined __BIONIC__"; then
3934 eval ${pfx}libc_type=bionic
3935 elif check_${pfx}cpp_condition sys/brand.h "defined LABELED_BRAND_NAME"; then
3936 eval ${pfx}libc_type=solaris
3937 add_${pfx}cppflags -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
3942 test -n "$libc_type" && enable libc_$libc_type
3944 test -n "$host_libc_type" && enable host_libc_$host_libc_type
3948 add_compat strtod.o strtod=avpriv_strtod
3951 add_compat strtod.o strtod=avpriv_strtod
3952 add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \
3953 _snprintf=avpriv_snprintf \
3954 vsnprintf=avpriv_vsnprintf
3958 # hacks for compiler/libc/os combinations
3960 if enabled_all tms470 libc_glibc; then
3961 CPPFLAGS="-I${source_path}/compat/tms470 ${CPPFLAGS}"
3962 add_cppflags -D__USER_LABEL_PREFIX__=
3963 add_cppflags -D__builtin_memset=memset
3964 add_cppflags -D__gnuc_va_list=va_list -D_VA_LIST_DEFINED
3965 add_cflags -pds=48 # incompatible redefinition of macro
3968 if enabled_all ccc libc_glibc; then
3969 add_ldflags -Wl,-z,now # calls to libots crash without this
3973 echo "$*" | sed 's/%/%25/g;s/:/%3a/g'
3976 echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $FFMPEG_CONFIGURATION)" >config.fate
3978 check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable_weak pic
3980 set_default $PATHS_LIST
3983 # we need to build at least one lib type
3984 if ! enabled_any static shared; then
3986 At least one library type must be built.
3987 Specify --enable-static to build the static libraries or --enable-shared to
3988 build the shared libraries as well. To only build the shared libraries specify
3989 --disable-static in addition to --enable-shared.
3994 # backward compatibility layer for incompatible_libav/fork_abi
3995 enabled incompatible_fork_abi && enable incompatible_libav_abi
3996 enabled incompatible_libav_abi && enable incompatible_fork_abi
3998 die_license_disabled() {
3999 enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; }
4002 die_license_disabled_gpl() {
4003 enabled $1 || { enabled $2 && die "$2 is incompatible with the gpl and --enable-$1 is not specified."; }
4006 die_license_disabled gpl frei0r
4007 die_license_disabled gpl libcdio
4008 die_license_disabled gpl libutvideo
4009 die_license_disabled gpl libvidstab
4010 die_license_disabled gpl libx264
4011 die_license_disabled gpl libxavs
4012 die_license_disabled gpl libxvid
4013 die_license_disabled gpl libzvbi
4014 die_license_disabled gpl x11grab
4016 die_license_disabled nonfree libaacplus
4017 die_license_disabled nonfree libfaac
4018 enabled gpl && die_license_disabled_gpl nonfree libfdk_aac
4019 enabled gpl && die_license_disabled_gpl nonfree openssl
4021 die_license_disabled version3 libopencore_amrnb
4022 die_license_disabled version3 libopencore_amrwb
4023 die_license_disabled version3 libvo_aacenc
4024 die_license_disabled version3 libvo_amrwbenc
4026 enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; }
4028 disabled optimizations || check_cflags -fomit-frame-pointer
4031 disabled pic && return
4034 case "$target_os" in
4044 enabled pic && enable_weak_pic
4046 check_cc <<EOF || die "Symbol mangling check failed."
4049 sym=$($nm $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }')
4050 extern_prefix=${sym%%ff_extern*}
4052 check_cc <<EOF && enable_weak inline_asm
4053 void foo(void) { __asm__ volatile ("" ::); }
4057 for restrict_keyword in restrict __restrict__ __restrict; do
4058 check_cc <<EOF && _restrict=$restrict_keyword && break
4059 void foo(char * $restrict_keyword p);
4063 check_cc <<EOF && enable pragma_deprecated
4064 void foo(void) { _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") }
4067 check_cc <<EOF && enable attribute_packed
4068 struct { int x; } __attribute__((packed)) x;
4071 check_cc <<EOF && enable attribute_may_alias
4072 union { int x; } __attribute__((may_alias)) x;
4075 check_cc <<EOF || die "endian test failed"
4076 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
4078 od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
4080 check_inline_asm inline_asm_labels '"1:\n"'
4082 if enabled aarch64; then
4083 # internal assembler in clang 3.3 does not support this instruction
4084 enabled neon && check_insn neon 'ext v0.8B, v0.8B, v1.8B, #1'
4085 enabled vfp && check_insn vfp 'fmadd d0, d0, d1, d2'
4087 map 'enabled_any ${v}_external ${v}_inline || disable $v' $ARCH_EXT_LIST_ARM
4089 elif enabled alpha; then
4093 elif enabled arm; then
4095 check_cpp_condition stddef.h "defined __thumb__" && check_cc <<EOF && enable_weak thumb
4096 float func(float a, float b){ return a+b; }
4099 enabled thumb && check_cflags -mthumb || check_cflags -marm
4102 if check_cpp_condition stddef.h "defined __ARM_PCS_VFP"; then
4104 elif ! check_cpp_condition stddef.h "defined __ARM_PCS || defined __SOFTFP__"; then
4105 case "${cross_prefix:-$cc}" in
4106 *hardfloat*) enable vfp_args; fpabi=vfp ;;
4107 *) check_ld "cc" <<EOF && enable vfp_args && fpabi=vfp || fpabi=soft ;;
4108 __asm__ (".eabi_attribute 28, 1");
4109 int main(void) { return 0; }
4112 warn "Compiler does not indicate floating-point ABI, guessing $fpabi."
4115 enabled armv5te && check_insn armv5te 'qadd r0, r0, r0'
4116 enabled armv6 && check_insn armv6 'sadd16 r0, r0, r0'
4117 enabled armv6t2 && check_insn armv6t2 'movt r0, #0'
4118 enabled neon && check_insn neon 'vadd.i16 q0, q0, q0'
4119 enabled vfp && check_insn vfp 'fadds s0, s0, s0'
4120 enabled vfpv3 && check_insn vfpv3 'vmov.f32 s0, #1.0'
4122 [ $target_os = linux ] ||
4123 map 'enabled_any ${v}_external ${v}_inline || disable $v' \
4126 check_inline_asm asm_mod_q '"add r0, %Q0, %R0" :: "r"((long long)0)'
4127 check_inline_asm asm_mod_y '"vmul.i32 d0, d0, %y0" :: "x"(0)'
4129 [ $target_os != win32 ] && enabled_all armv6t2 shared !pic && enable_weak_pic
4131 elif enabled mips; then
4133 check_inline_asm loongson '"dmult.g $1, $2, $3"'
4134 enabled mips32r2 && add_cflags "-mips32r2" && add_asflags "-mips32r2" &&
4135 check_inline_asm mips32r2 '"rotr $t0, $t1, 1"'
4136 enabled mipsdspr1 && add_cflags "-mdsp" && add_asflags "-mdsp" &&
4137 check_inline_asm mipsdspr1 '"addu.qb $t0, $t1, $t2"'
4138 enabled mipsdspr2 && add_cflags "-mdspr2" && add_asflags "-mdspr2" &&
4139 check_inline_asm mipsdspr2 '"absq_s.qb $t0, $t1"'
4140 enabled mipsfpu && add_cflags "-mhard-float" && add_asflags "-mhard-float" &&
4141 check_inline_asm mipsfpu '"madd.d $f0, $f2, $f4, $f6"'
4143 elif enabled parisc; then
4145 if enabled gcc; then
4146 case $($cc -dumpversion) in
4147 4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
4151 elif enabled ppc; then
4153 enable local_aligned_8 local_aligned_16
4155 [ $cpu != e500 -a $cpu != e500v2 ] &&
4156 check_inline_asm dcbzl '"dcbzl 0, %0" :: "r"(0)'
4157 check_inline_asm ibm_asm '"add 0, 0, 0"'
4158 check_inline_asm ppc4xx '"maclhw r10, r11, r12"'
4159 check_inline_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)'
4161 # AltiVec flags: The FSF version of GCC differs from the Apple version
4162 if enabled altivec; then
4163 if ! enabled_any pic ppc64; then
4166 check_cflags -maltivec -mabi=altivec &&
4167 { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
4168 check_cflags -faltivec
4170 # check if our compiler supports Motorola AltiVec C API
4171 check_cc <<EOF || disable altivec
4174 vector signed int v1 = (vector signed int) { 0 };
4175 vector signed int v2 = (vector signed int) { 1 };
4176 v1 = vec_add(v1, v2);
4181 enabled altivec || warn "Altivec disabled, possibly missing --cpu flag"
4184 elif enabled sparc; then
4186 enabled vis && check_inline_asm vis '"pdist %f0, %f0, %f0"'
4188 elif enabled x86; then
4190 check_builtin rdtsc intrin.h "__rdtsc()"
4191 check_builtin mm_empty mmintrin.h "_mm_empty()"
4193 enable local_aligned_8 local_aligned_16
4195 # check whether EBP is available on x86
4196 # As 'i' is stored on the stack, this program will crash
4197 # if the base pointer is used to access it because the
4198 # base pointer is cleared in the inline assembly code.
4199 check_exec_crash <<EOF && enable ebp_available
4201 __asm__ volatile ("xorl %%ebp, %%ebp" ::: "%ebp");
4205 # check whether EBX is available on x86
4206 check_inline_asm ebx_available '""::"b"(0)' &&
4207 check_inline_asm ebx_available '"":::"%ebx"'
4209 # check whether xmm clobbers are supported
4210 check_inline_asm xmm_clobbers '"":::"%xmm0"'
4212 # check whether binutils is new enough to compile SSSE3/MMXEXT
4213 enabled ssse3 && check_inline_asm ssse3_inline '"pabsw %xmm0, %xmm0"'
4214 enabled mmxext && check_inline_asm mmxext_inline '"pmaxub %mm0, %mm1"'
4216 if ! disabled_any asm mmx yasm; then
4217 if check_cmd $yasmexe --version; then
4218 enabled x86_64 && yasm_extra="-m amd64"
4219 yasm_debug="-g dwarf2"
4220 elif check_cmd nasm -v; then
4222 yasm_debug="-g -F dwarf"
4223 enabled x86_64 && test "$objformat" = elf && objformat=elf64
4226 YASMFLAGS="-f $objformat $yasm_extra"
4227 enabled pic && append YASMFLAGS "-DPIC"
4228 test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX"
4229 case "$objformat" in
4230 elf*) enabled debug && append YASMFLAGS $yasm_debug ;;
4233 check_yasm "movbe ecx, [5]" && enable yasm ||
4234 die "yasm/nasm not found or too old. Use --disable-yasm for a crippled build."
4235 check_yasm "vextractf128 xmm0, ymm0, 0" || disable avx_external avresample
4236 check_yasm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
4237 check_yasm "CPU amdnop" && enable cpunop
4241 athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode)
4248 if enabled asm; then
4250 check_as <<EOF && enable gnu_as || \
4251 $nogas "GNU assembler not found, install gas-preprocessor"
4259 check_ldflags -Wl,--as-needed
4261 if check_func dlopen; then
4263 elif check_func dlopen -ldl; then
4267 if ! disabled network; then
4268 check_type "sys/types.h sys/socket.h" socklen_t
4269 check_type netdb.h "struct addrinfo"
4270 check_type netinet/in.h "struct group_source_req" -D_BSD_SOURCE
4271 check_type netinet/in.h "struct ip_mreq_source" -D_BSD_SOURCE
4272 check_type netinet/in.h "struct ipv6_mreq" -D_DARWIN_C_SOURCE
4273 check_type netinet/in.h "struct sockaddr_in6"
4274 check_type poll.h "struct pollfd"
4275 check_type "sys/types.h sys/socket.h" "struct sockaddr_storage"
4276 check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len
4277 check_type netinet/sctp.h "struct sctp_event_subscribe"
4278 check_func getaddrinfo $network_extralibs
4279 check_func getservbyport $network_extralibs
4280 # Prefer arpa/inet.h over winsock2
4281 if check_header arpa/inet.h ; then
4282 check_func closesocket
4283 elif check_header winsock2.h ; then
4284 check_func_headers winsock2.h closesocket -lws2 &&
4285 network_extralibs="-lws2" ||
4286 { check_func_headers winsock2.h closesocket -lws2_32 &&
4287 network_extralibs="-lws2_32"; } || disable winsock2_h network
4288 check_func_headers ws2tcpip.h getaddrinfo $network_extralibs
4289 check_type ws2tcpip.h socklen_t
4290 check_type ws2tcpip.h "struct addrinfo"
4291 check_type ws2tcpip.h "struct group_source_req"
4292 check_type ws2tcpip.h "struct ip_mreq_source"
4293 check_type ws2tcpip.h "struct ipv6_mreq"
4294 check_type winsock2.h "struct pollfd"
4295 check_type ws2tcpip.h "struct sockaddr_in6"
4296 check_type ws2tcpip.h "struct sockaddr_storage"
4297 check_struct winsock2.h "struct sockaddr" sa_len
4303 # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that
4304 check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; }
4307 check_func clock_gettime || { check_func clock_gettime -lrt && add_extralibs -lrt; }
4310 check_func_headers stdlib.h getenv
4311 check_func gethrtime
4313 check_func getrusage
4314 check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss
4315 check_func gettimeofday
4316 check_func inet_aton $network_extralibs
4318 check_func localtime_r
4319 check_func ${malloc_prefix}memalign && enable memalign
4323 check_func ${malloc_prefix}posix_memalign && enable posix_memalign
4324 check_func_headers malloc.h _aligned_malloc && enable aligned_malloc
4325 check_func setrlimit
4326 check_struct "sys/stat.h" "struct stat" st_mtim.tv_nsec -D_BSD_SOURCE
4327 check_func strerror_r
4328 check_func sched_getaffinity
4329 check_builtin sync_val_compare_and_swap "" "int *ptr; int oldval, newval; __sync_val_compare_and_swap(ptr, oldval, newval)"
4330 check_builtin machine_rw_barrier mbarrier.h "__machine_rw_barrier()"
4331 check_builtin atomic_cas_ptr atomic.h "void **ptr; void *oldval, *newval; atomic_cas_ptr(ptr, oldval, newval)"
4332 check_builtin MemoryBarrier windows.h "MemoryBarrier()"
4333 check_builtin sarestart signal.h "SA_RESTART"
4337 check_func_headers conio.h kbhit
4338 check_func_headers windows.h PeekNamedPipe
4339 check_func_headers io.h setmode
4340 check_func_headers lzo/lzo1x.h lzo1x_999_compress
4341 check_lib2 "windows.h shellapi.h" CommandLineToArgvW -lshell32
4342 check_lib2 "windows.h wincrypt.h" CryptGenRandom -ladvapi32
4343 check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
4344 check_func_headers windows.h GetProcessAffinityMask
4345 check_func_headers windows.h GetProcessTimes
4346 check_func_headers windows.h GetSystemTimeAsFileTime
4347 check_func_headers windows.h MapViewOfFile
4348 check_func_headers windows.h SetConsoleTextAttribute
4349 check_func_headers windows.h Sleep
4350 check_func_headers windows.h VirtualAlloc
4351 check_func_headers glob.h glob
4352 check_func_headers "X11/Xlib.h X11/extensions/Xvlib.h" XvGetPortAttribute -lXv -lX11 -lXext
4354 check_header cl/cl.h
4355 check_header direct.h
4356 check_header dlfcn.h
4358 check_header dxva2api.h -D_WIN32_WINNT=0x0600
4360 check_header libcrystalhd/libcrystalhd_if.h
4361 check_header malloc.h
4363 check_header sys/mman.h
4364 check_header sys/param.h
4365 check_header sys/resource.h
4366 check_header sys/select.h
4367 check_header sys/time.h
4368 check_header sys/un.h
4369 check_header termios.h
4370 check_header unistd.h
4371 check_header vdpau/vdpau.h
4372 check_header vdpau/vdpau_x11.h
4373 check_header VideoDecodeAcceleration/VDADecoder.h
4374 check_header windows.h
4375 check_header X11/extensions/XvMClib.h
4376 check_header asm/types.h
4378 if ! disabled w32threads && ! enabled pthreads; then
4379 check_func_headers "windows.h process.h" _beginthreadex &&
4380 enable w32threads || disable w32threads
4383 # check for some common methods of building with pthread support
4384 # do this before the optional library checks as some of them require pthreads
4385 if ! disabled pthreads && ! enabled w32threads && ! enabled os2threads; then
4387 if check_func pthread_join -pthread && check_func pthread_create -pthread; then
4389 add_extralibs -pthread
4390 elif check_func pthread_join -pthreads && check_func pthread_create -pthreads; then
4391 add_cflags -pthreads
4392 add_extralibs -pthreads
4393 elif check_func pthread_join -lpthreadGC2 && check_func pthread_create -lpthreadGC2; then
4394 add_extralibs -lpthreadGC2
4395 elif check_lib pthread.h pthread_join -lpthread && check_lib pthread.h pthread_create -lpthread; then
4397 elif ! check_func pthread_join && ! check_func pthread_create; then
4400 check_code cc "pthread.h" "static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER" || disable pthreads
4403 for thread in $THREADS_LIST; do
4404 if enabled $thread; then
4405 test -n "$thread_type" &&
4406 die "ERROR: Only one thread type must be selected." ||
4407 thread_type="$thread"
4411 if enabled pthreads; then
4412 check_func pthread_cancel
4415 disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
4416 disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
4418 check_lib math.h sin -lm && LIBM="-lm"
4419 disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersion -lcrystalhd || disable crystalhd
4425 for func in $MATH_FUNCS; do
4426 eval check_mathfunc $func \${${func}_args:-1}
4429 # these are off by default, so fail if requested and not available
4430 enabled avisynth && { { check_lib2 "windows.h" LoadLibrary; } ||
4431 { check_lib2 "dlfcn.h" dlopen -ldl; } ||
4432 die "ERROR: LoadLibrary/dlopen not found for avisynth"; }
4433 enabled decklink && { check_header DeckLinkAPI.h || die "ERROR: DeckLinkAPI.h header not found"; }
4434 enabled fontconfig && require_pkg_config fontconfig "fontconfig/fontconfig.h" FcInit
4435 enabled frei0r && { check_header frei0r.h || die "ERROR: frei0r.h header not found"; }
4436 enabled gnutls && require_pkg_config gnutls gnutls/gnutls.h gnutls_global_init
4437 enabled ladspa && { check_header ladspa.h || die "ERROR: ladspa.h header not found"; }
4438 enabled libiec61883 && require libiec61883 libiec61883/iec61883.h iec61883_cmp_connect -lraw1394 -lavc1394 -lrom1394 -liec61883
4439 enabled libaacplus && require "libaacplus >= 2.0.0" aacplus.h aacplusEncOpen -laacplus
4440 enabled libass && require_pkg_config libass ass/ass.h ass_library_init
4441 enabled libbluray && require libbluray libbluray/bluray.h bd_open -lbluray
4442 enabled libcelt && require libcelt celt/celt.h celt_decode -lcelt0 &&
4443 { check_lib celt/celt.h celt_decoder_create_custom -lcelt0 ||
4444 die "ERROR: libcelt must be installed and version must be >= 0.11.0."; }
4445 enabled libcaca && require_pkg_config caca caca.h caca_create_canvas
4446 enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
4447 enabled libfdk_aac && require libfdk_aac fdk-aac/aacenc_lib.h aacEncOpen -lfdk-aac
4448 flite_libs="-lflite_cmu_time_awb -lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms -lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite"
4449 enabled libflite && require2 libflite "flite/flite.h" flite_init $flite_libs
4450 enabled libfreetype && require_libfreetype
4451 enabled libgme && require libgme gme/gme.h gme_new_emu -lgme -lstdc++
4452 enabled libgsm && { for gsm_hdr in "gsm.h" "gsm/gsm.h"; do
4453 check_lib "${gsm_hdr}" gsm_create -lgsm && break;
4454 done || die "ERROR: libgsm not found"; }
4455 enabled libilbc && require libilbc ilbc.h WebRtcIlbcfix_InitDecode -lilbc
4456 enabled libmodplug && require libmodplug libmodplug/modplug.h ModPlug_Load -lmodplug
4457 enabled libmp3lame && require "libmp3lame >= 3.98.3" lame/lame.h lame_set_VBR_quality -lmp3lame
4458 enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
4459 enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb
4460 enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb
4461 enabled libopencv && require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
4462 enabled libopenjpeg && { check_lib openjpeg-1.5/openjpeg.h opj_version -lopenjpeg ||
4463 check_lib openjpeg.h opj_version -lopenjpeg ||
4464 die "ERROR: libopenjpeg not found"; }
4465 enabled libopus && require_pkg_config opus opus_multistream.h opus_multistream_decoder_create
4466 enabled libpulse && require_pkg_config libpulse-simple pulse/simple.h pa_simple_new
4467 enabled libquvi && require_pkg_config libquvi quvi/quvi.h quvi_init
4468 enabled librtmp && require_pkg_config librtmp librtmp/rtmp.h RTMP_Socket
4469 enabled libschroedinger && require_pkg_config schroedinger-1.0 schroedinger/schro.h schro_init
4470 enabled libshine && require_pkg_config shine shine/layer3.h shine_encode_buffer
4471 enabled libsoxr && require libsoxr soxr.h soxr_create -lsoxr
4472 enabled libssh && require_pkg_config libssh libssh/sftp.h sftp_init
4473 enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
4474 enabled libstagefright_h264 && require_cpp libstagefright_h264 "binder/ProcessState.h media/stagefright/MetaData.h
4475 media/stagefright/MediaBufferGroup.h media/stagefright/MediaDebug.h media/stagefright/MediaDefs.h
4476 media/stagefright/OMXClient.h media/stagefright/OMXCodec.h" android::OMXClient -lstagefright -lmedia -lutils -lbinder -lgnustl_static
4477 enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg
4478 enabled libtwolame && require libtwolame twolame.h twolame_init -ltwolame &&
4479 { check_lib twolame.h twolame_encode_buffer_float32_interleaved -ltwolame ||
4480 die "ERROR: libtwolame must be installed and version must be >= 0.3.10"; }
4481 enabled libutvideo && require_cpp utvideo "stdint.h stdlib.h utvideo/utvideo.h utvideo/Codec.h" 'CCodec*' -lutvideo -lstdc++
4482 enabled libv4l2 && require_pkg_config libv4l2 libv4l2.h v4l2_ioctl
4483 enabled libvidstab && require_pkg_config "vidstab >= 0.98" vid.stab/libvidstab.h vsMotionDetectInit
4484 enabled libvo_aacenc && require libvo_aacenc vo-aacenc/voAAC.h voGetAACEncAPI -lvo-aacenc
4485 enabled libvo_amrwbenc && require libvo_amrwbenc vo-amrwbenc/enc_if.h E_IF_init -lvo-amrwbenc
4486 enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
4488 enabled libvpx_vp8_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx ||
4489 die "ERROR: libvpx decoder version must be >=0.9.1"; }
4490 enabled libvpx_vp8_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VP8E_SET_MAX_INTRA_BITRATE_PCT" -lvpx ||
4491 die "ERROR: libvpx encoder version must be >=0.9.7"; }
4492 enabled libvpx_vp9_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" "vpx_codec_vp9_dx" -lvpx || disable libvpx_vp9_decoder; }
4493 enabled libvpx_vp9_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_vp9_cx VP9E_SET_SVC" -lvpx || disable libvpx_vp9_encoder; } }
4494 enabled libwavpack && require libwavpack wavpack/wavpack.h WavpackOpenFileOutput -lwavpack
4495 enabled libwebp && require_pkg_config libwebp webp/encode.h WebPGetEncoderVersion
4496 enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 &&
4497 { check_cpp_condition x264.h "X264_BUILD >= 118" ||
4498 die "ERROR: libx264 must be installed and version must be >= 0.118."; }
4499 enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs
4500 enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
4501 enabled libzmq && require_pkg_config libzmq zmq.h zmq_ctx_new
4502 enabled libzvbi && require libzvbi libzvbi.h vbi_decoder_new -lzvbi
4503 enabled openal && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
4504 check_lib 'AL/al.h' alGetError "${al_libs}" && break; done } ||
4505 die "ERROR: openal not found"; } &&
4506 { check_cpp_condition "AL/al.h" "defined(AL_VERSION_1_1)" ||
4507 die "ERROR: openal must be installed and version must be 1.1 or compatible"; }
4508 enabled opencl && { check_lib2 OpenCL/cl.h clEnqueueNDRangeKernel -Wl,-framework,OpenCL ||
4509 check_lib2 CL/cl.h clEnqueueNDRangeKernel -lOpenCL ||
4510 die "ERROR: opencl not found"; } &&
4511 { ! enabled_any w32threads os2threads ||
4512 die "opencl currently needs --enable-pthreads or --disable-w32threads"; } &&
4513 { check_cpp_condition "OpenCL/cl.h" "defined(CL_VERSION_1_2)" ||
4514 check_cpp_condition "CL/cl.h" "defined(CL_VERSION_1_2)" ||
4515 die "ERROR: opencl must be installed and version must be 1.2 or compatible"; }
4516 enabled opengl && { check_lib GL/glx.h glXGetProcAddress "-lGL" ||
4517 check_lib2 windows.h wglGetProcAddress "-lopengl32 -lgdi32" ||
4518 check_lib2 OpenGL/gl3.h glGetError "-Wl,-framework,OpenGL" ||
4519 check_lib2 ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
4520 die "ERROR: opengl not found."
4522 enabled openssl && { check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto ||
4523 check_lib openssl/ssl.h SSL_library_init -lssl32 -leay32 ||
4524 check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 ||
4525 die "ERROR: openssl not found"; }
4527 if enabled gnutls; then
4528 { check_lib nettle/bignum.h nettle_mpz_get_str_256 -lnettle -lhogweed -lgmp && enable nettle; } ||
4529 { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; }
4533 if enabled libdc1394; then
4534 { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
4535 enable libdc1394_2; } ||
4536 { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
4537 enable libdc1394_1; } ||
4538 die "ERROR: No version of libdc1394 found "
4541 SDL_CONFIG="${cross_prefix}sdl-config"
4542 if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
4543 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
4544 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
4547 if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
4548 sdl_cflags=$("${SDL_CONFIG}" --cflags)
4549 sdl_libs=$("${SDL_CONFIG}" --libs)
4550 check_func_headers SDL_version.h SDL_Linked_Version $sdl_cflags $sdl_libs &&
4551 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
4552 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x010300" $sdl_cflags &&
4556 enabled sdl && add_cflags $sdl_cflags && add_extralibs $sdl_libs
4558 texi2html --help 2> /dev/null | grep -q 'init-file' && enable texi2html || disable texi2html
4559 makeinfo --version > /dev/null 2>&1 && enable makeinfo || disable makeinfo
4560 perl -v > /dev/null 2>&1 && enable perl || disable perl
4561 pod2man --help > /dev/null 2>&1 && enable pod2man || disable pod2man
4562 rsync --help 2> /dev/null | grep -q 'contimeout' && enable rsync_contimeout || disable rsync_contimeout
4564 check_header linux/fb.h
4565 check_header linux/videodev.h
4566 check_header linux/videodev2.h
4567 check_code cc linux/videodev2.h "struct v4l2_frmsizeenum vfse; vfse.discrete.width = 0;" && enable_safe struct_v4l2_frmivalenum_discrete
4569 check_header sys/videoio.h
4571 check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs"
4572 # check that WM_CAP_DRIVER_CONNECT is defined to the proper value
4573 # w32api 3.12 had it defined wrong
4574 check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines
4576 check_type "dshow.h" IBaseFilter
4578 # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
4579 { check_header dev/bktr/ioctl_meteor.h &&
4580 check_header dev/bktr/ioctl_bt848.h; } ||
4581 { check_header machine/ioctl_meteor.h &&
4582 check_header machine/ioctl_bt848.h; } ||
4583 { check_header dev/video/meteor/ioctl_meteor.h &&
4584 check_header dev/video/bktr/ioctl_bt848.h; } ||
4585 check_header dev/ic/bt8xx.h
4587 check_header sndio.h
4588 if check_struct sys/soundcard.h audio_buf_info bytes; then
4589 enable_safe sys/soundcard.h
4591 check_cc -D__BSD_VISIBLE -D__XSI_VISIBLE <<EOF && add_cppflags -D__BSD_VISIBLE -D__XSI_VISIBLE && enable_safe sys/soundcard.h
4592 #include <sys/soundcard.h>
4596 check_header soundcard.h
4598 enabled_any alsa_indev alsa_outdev &&
4599 check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
4601 enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack && check_func sem_timedwait &&
4602 check_func jack_port_get_latency_range -ljack
4604 enabled_any sndio_indev sndio_outdev && check_lib2 sndio.h sio_open -lsndio
4606 if enabled libcdio; then
4607 check_lib2 "cdio/cdda.h cdio/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
4608 check_lib2 "cdio/paranoia/cdda.h cdio/paranoia/paranoia.h" cdio_cddap_open -lcdio_paranoia -lcdio_cdda -lcdio ||
4609 die "ERROR: libcdio-paranoia not found"
4612 check_lib X11/Xlib.h XOpenDisplay -lX11 && enable xlib
4615 require Xext X11/extensions/XShm.h XShmCreateImage -lXext &&
4616 require Xfixes X11/extensions/Xfixes.h XFixesGetCursorImage -lXfixes &&
4617 { enabled xlib || die "ERROR: Xlib not found"; }
4620 check_lib va/va.h vaInitialize -lva ||
4624 check_cpp_condition vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" ||
4627 enabled vdpau && enabled xlib &&
4628 check_lib2 "vdpau/vdpau.h vdpau/vdpau_x11.h" vdp_device_create_x11 -lvdpau &&
4631 # Funny iconv installations are not unusual, so check it after all flags have been set
4632 disabled iconv || check_func_headers iconv.h iconv || check_lib2 iconv.h iconv -liconv || disable iconv
4634 enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
4636 # add some useful compiler flags if supported
4637 check_cflags -Wdeclaration-after-statement
4639 check_cflags -Wdisabled-optimization
4640 check_cflags -Wpointer-arith
4641 check_cflags -Wredundant-decls
4642 check_cflags -Wwrite-strings
4643 check_cflags -Wtype-limits
4644 check_cflags -Wundef
4645 check_cflags -Wmissing-prototypes
4646 check_cflags -Wno-pointer-to-int-cast
4647 check_cflags -Wstrict-prototypes
4648 enabled extra_warnings && check_cflags -Winline
4650 check_disable_warning(){
4651 warning_flag=-W${1#-Wno-}
4652 test_cflags $warning_flag && add_cflags $1
4655 check_disable_warning -Wno-parentheses
4656 check_disable_warning -Wno-switch
4657 check_disable_warning -Wno-format-zero-length
4658 check_disable_warning -Wno-pointer-sign
4660 # add some linker flags
4661 check_ldflags -Wl,--warn-common
4662 check_ldflags -Wl,-rpath-link=libpostproc:libswresample:libswscale:libavfilter:libavdevice:libavformat:libavcodec:libavutil:libavresample
4663 enabled rpath && add_ldflags -Wl,-rpath=$libdir
4664 test_ldflags -Wl,-Bsymbolic && append SHFLAGS -Wl,-Bsymbolic
4666 # add some strip flags
4667 # -wN '..@*' is more selective than -x, but not available everywhere.
4668 check_stripflags -wN \'..@*\' || check_stripflags -x
4670 enabled neon_clobber_test &&
4671 check_ldflags -Wl,--wrap,avcodec_open2 \
4672 -Wl,--wrap,avcodec_decode_audio4 \
4673 -Wl,--wrap,avcodec_decode_video2 \
4674 -Wl,--wrap,avcodec_decode_subtitle2 \
4675 -Wl,--wrap,avcodec_encode_audio2 \
4676 -Wl,--wrap,avcodec_encode_video2 \
4677 -Wl,--wrap,avcodec_encode_subtitle \
4678 -Wl,--wrap,swr_convert \
4679 -Wl,--wrap,avresample_convert ||
4680 disable neon_clobber_test
4682 enabled xmm_clobber_test &&
4683 check_ldflags -Wl,--wrap,avcodec_open2 \
4684 -Wl,--wrap,avcodec_decode_audio4 \
4685 -Wl,--wrap,avcodec_decode_video2 \
4686 -Wl,--wrap,avcodec_decode_subtitle2 \
4687 -Wl,--wrap,avcodec_encode_audio2 \
4688 -Wl,--wrap,avcodec_encode_video \
4689 -Wl,--wrap,avcodec_encode_video2 \
4690 -Wl,--wrap,avcodec_encode_subtitle \
4691 -Wl,--wrap,swr_convert \
4692 -Wl,--wrap,avresample_convert \
4693 -Wl,--wrap,sws_scale ||
4694 disable xmm_clobber_test
4697 if test_ldflags -Wl,--version-script,$TMPV; then
4698 append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver'
4699 check_cc <<EOF && enable symver_asm_label
4700 void ff_foo(void) __asm__ ("av_foo@VERSION");
4701 void ff_foo(void) { ${inline_asm+__asm__($quotes);} }
4703 check_cc <<EOF && enable symver_gnu_asm
4704 __asm__(".symver ff_foo,av_foo@VERSION");
4705 void ff_foo(void) {}
4709 if [ -z "$optflags" ]; then
4710 if enabled small; then
4711 optflags=$cflags_size
4712 elif enabled optimizations; then
4713 optflags=$cflags_speed
4715 optflags=$cflags_noopt
4721 enabled lto && check_ldflags "$@"
4725 if enabled lto; then
4726 test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
4728 check_ldflags -flto $cpuflags
4731 check_optflags $optflags
4732 check_optflags -fno-math-errno
4733 check_optflags -fno-signed-zeros
4735 enabled ftrapv && check_cflags -ftrapv
4737 check_cc -mno-red-zone <<EOF && noredzone_flags="-mno-red-zone"
4742 if enabled icc; then
4743 # Just warnings, no remarks
4745 # -wd: Disable following warnings
4746 # 144, 167, 556: -Wno-pointer-sign
4747 # 188: enumerated type mixed with another type
4748 # 1292: attribute "foo" ignored
4749 # 1419: external declaration in primary source file
4750 # 10006: ignoring unknown option -fno-signed-zeros
4751 # 10148: ignoring unknown option -Wno-parentheses
4752 # 10156: ignoring option '-W'; no argument required
4753 check_cflags -wd144,167,188,556,1292,1419,10006,10148,10156
4754 # 11030: Warning unknown option --as-needed
4755 # 10156: ignoring option '-export'; no argument required
4756 check_ldflags -wd10156,11030
4757 # icc 11.0 and 11.1 work with ebp_available, but don't pass the test
4758 enable ebp_available
4759 if enabled x86_32; then
4760 icc_version=$($cc -dumpversion)
4761 test ${icc_version%%.*} -ge 11 &&
4762 check_cflags -falign-stack=maintain-16-byte ||
4763 disable aligned_stack
4765 elif enabled ccc; then
4766 # disable some annoying warnings
4767 add_cflags -msg_disable bitnotint
4768 add_cflags -msg_disable mixfuncvoid
4769 add_cflags -msg_disable nonstandcast
4770 add_cflags -msg_disable unsupieee
4771 elif enabled gcc; then
4772 check_optflags -fno-tree-vectorize
4773 check_cflags -Werror=implicit-function-declaration
4774 check_cflags -Werror=missing-prototypes
4775 check_cflags -Werror=return-type
4776 check_cflags -Werror=vla
4777 enabled extra_warnings || check_disable_warning -Wno-maybe-uninitialized
4778 elif enabled llvm_gcc; then
4779 check_cflags -mllvm -stack-alignment=16
4780 elif enabled clang; then
4781 check_cflags -mllvm -stack-alignment=16
4782 check_cflags -Qunused-arguments
4783 check_cflags -Werror=implicit-function-declaration
4784 check_cflags -Werror=missing-prototypes
4785 check_cflags -Werror=return-type
4786 elif enabled cparser; then
4787 add_cflags -Wno-missing-variable-declarations
4788 add_cflags -Wno-empty-statement
4789 elif enabled armcc; then
4790 # 2523: use of inline assembler is deprecated
4791 add_cflags -W${armcc_opt},--diag_suppress=2523
4792 add_cflags -W${armcc_opt},--diag_suppress=1207
4793 add_cflags -W${armcc_opt},--diag_suppress=1293 # assignment in condition
4794 add_cflags -W${armcc_opt},--diag_suppress=3343 # hardfp compat
4795 add_cflags -W${armcc_opt},--diag_suppress=167 # pointer sign
4796 add_cflags -W${armcc_opt},--diag_suppress=513 # pointer sign
4797 elif enabled tms470; then
4798 add_cflags -pds=824 -pds=837
4800 elif enabled pathscale; then
4801 add_cflags -fstrict-overflow -OPT:wrap_around_unsafe_opt=OFF
4802 elif enabled_any msvc icl; then
4803 enabled x86_32 && disable aligned_stack
4804 enabled_all x86_32 debug && add_cflags -Oy-
4805 enabled debug && add_ldflags -debug
4806 enable pragma_deprecated
4807 if enabled icl; then
4808 # -Qansi-alias is basically -fstrict-aliasing, but does not work
4809 # (correctly) on icl 13.x.
4810 check_cpp_condition "windows.h" "__ICL < 1300 || __ICL >= 1400" &&
4811 add_cflags -Qansi-alias
4812 # icl will pass the inline asm tests but inline asm is currently
4813 # not supported (build will fail)
4814 disabled inline_asm || warn "inline asm disabled due to issues with it in ICL"
4821 add_asflags -Qunused-arguments
4827 check_ldflags -Qunused-arguments
4833 enabled ccc && add_ldflags '-Wl,-expect_unresolved,*'
4836 add_cppflags -Dmain=plan9_main
4840 enable frame_thread_encoder
4842 enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; }
4844 check_deps $CONFIG_LIST \
4849 enabled threads && ! enabled pthreads && ! enabled atomics_native && die "non pthread threading without atomics not supported, try adding --enable-pthreads or --cpu=i486 or higher if you are on x86"
4852 if test $target_os = "haiku"; then
4854 disable posix_memalign
4857 ! enabled_any memalign posix_memalign aligned_malloc &&
4858 enabled_any $need_memalign && enable memalign_hack
4861 # -> enable ${lib}_deps_${dep}
4862 # -> add $dep to ${lib}_deps only once
4866 enabled "${lib}_deps_${dep}" && return 0
4867 enable "${lib}_deps_${dep}"
4868 prepend "${lib}_deps" $dep
4871 # merge deps lib components
4872 # merge all ${component}_deps into ${lib}_deps and ${lib}_deps_*
4877 enabled $comp || continue
4878 eval "dep=\"\$${comp}_deps\""
4885 merge_deps libavfilter $FILTER_LIST
4887 echo "install prefix $prefix"
4888 echo "source path $source_path"
4889 echo "C compiler $cc"
4890 echo "C library $libc_type"
4891 if test "$host_cc" != "$cc"; then
4892 echo "host C compiler $host_cc"
4893 echo "host C library $host_libc_type"
4895 echo "ARCH $arch ($cpu)"
4896 if test "$build_suffix" != ""; then
4897 echo "build suffix $build_suffix"
4899 if test "$progs_suffix" != ""; then
4900 echo "progs suffix $progs_suffix"
4902 if test "$extra_version" != ""; then
4903 echo "version string suffix $extra_version"
4905 echo "big-endian ${bigendian-no}"
4906 echo "runtime cpu detection ${runtime_cpudetect-no}"
4907 if enabled x86; then
4908 echo "${yasmexe} ${yasm-no}"
4909 echo "MMX enabled ${mmx-no}"
4910 echo "MMXEXT enabled ${mmxext-no}"
4911 echo "3DNow! enabled ${amd3dnow-no}"
4912 echo "3DNow! extended enabled ${amd3dnowext-no}"
4913 echo "SSE enabled ${sse-no}"
4914 echo "SSSE3 enabled ${ssse3-no}"
4915 echo "AVX enabled ${avx-no}"
4916 echo "FMA4 enabled ${fma4-no}"
4917 echo "i686 features enabled ${i686-no}"
4918 echo "CMOV is fast ${fast_cmov-no}"
4919 echo "EBX available ${ebx_available-no}"
4920 echo "EBP available ${ebp_available-no}"
4922 if enabled aarch64; then
4923 echo "NEON enabled ${neon-no}"
4924 echo "VFP enabled ${vfp-no}"
4926 if enabled arm; then
4927 echo "ARMv5TE enabled ${armv5te-no}"
4928 echo "ARMv6 enabled ${armv6-no}"
4929 echo "ARMv6T2 enabled ${armv6t2-no}"
4930 echo "VFP enabled ${vfp-no}"
4931 echo "NEON enabled ${neon-no}"
4932 echo "THUMB enabled ${thumb-no}"
4934 if enabled mips; then
4935 echo "MIPS FPU enabled ${mipsfpu-no}"
4936 echo "MIPS32R2 enabled ${mips32r2-no}"
4937 echo "MIPS DSP R1 enabled ${mipsdspr1-no}"
4938 echo "MIPS DSP R2 enabled ${mipsdspr2-no}"
4940 if enabled ppc; then
4941 echo "AltiVec enabled ${altivec-no}"
4942 echo "PPC 4xx optimizations ${ppc4xx-no}"
4943 echo "dcbzl available ${dcbzl-no}"
4945 if enabled sparc; then
4946 echo "VIS enabled ${vis-no}"
4948 echo "debug symbols ${debug-no}"
4949 echo "strip symbols ${stripping-no}"
4950 echo "optimize for size ${small-no}"
4951 echo "optimizations ${optimizations-no}"
4952 echo "static ${static-no}"
4953 echo "shared ${shared-no}"
4954 echo "postprocessing support ${postproc-no}"
4955 echo "new filter support ${avfilter-no}"
4956 echo "network support ${network-no}"
4957 echo "threading support ${thread_type-no}"
4958 echo "safe bitstream reader ${safe_bitstream_reader-no}"
4959 echo "SDL support ${sdl-no}"
4960 echo "opencl enabled ${opencl-no}"
4961 echo "libzvbi enabled ${libzvbi-no}"
4962 echo "texi2html enabled ${texi2html-no}"
4963 echo "perl enabled ${perl-no}"
4964 echo "pod2man enabled ${pod2man-no}"
4965 echo "makeinfo enabled ${makeinfo-no}"
4966 test -n "$random_seed" &&
4967 echo "random seed ${random_seed}"
4970 echo "External libraries:"
4971 print_enabled '' $EXTERNAL_LIBRARY_LIST | print_3_columns
4974 for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do
4975 echo "Enabled ${type}s:"
4976 eval list=\$$(toupper $type)_LIST
4977 print_enabled '_*' $list | print_3_columns
4981 license="LGPL version 2.1 or later"
4982 if enabled nonfree; then
4983 license="nonfree and unredistributable"
4984 elif enabled gplv3; then
4985 license="GPL version 3 or later"
4986 elif enabled lgplv3; then
4987 license="LGPL version 3 or later"
4988 elif enabled gpl; then
4989 license="GPL version 2 or later"
4992 echo "License: $license"
4994 echo "Creating config.mak, config.h, and doc/config.texi..."
4996 test -e Makefile || echo "include $source_path/Makefile" > Makefile
4998 enabled stripping || strip="echo skipping strip"
5000 config_files="$TMPH config.mak doc/config.texi"
5002 cat > config.mak <<EOF
5003 # Automatically generated by configure - do not modify!
5004 ifndef FFMPEG_CONFIG_MAK
5006 FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION
5008 LIBDIR=\$(DESTDIR)$libdir
5009 SHLIBDIR=\$(DESTDIR)$shlibdir
5010 INCDIR=\$(DESTDIR)$incdir
5011 BINDIR=\$(DESTDIR)$bindir
5012 DATADIR=\$(DESTDIR)$datadir
5013 DOCDIR=\$(DESTDIR)$docdir
5014 MANDIR=\$(DESTDIR)$mandir
5015 SRC_PATH=$source_path
5016 ifndef MAIN_MAKEFILE
5017 SRC_PATH:=\$(SRC_PATH:.%=..%)
5026 DEPCCFLAGS=$DEPCCFLAGS \$(CPPFLAGS)
5028 DEPASFLAGS=$DEPASFLAGS \$(CPPFLAGS)
5056 SHFLAGS=$(echo $($ldflags_filter $SHFLAGS))
5057 ASMSTRIPFLAGS=$ASMSTRIPFLAGS
5058 YASMFLAGS=$YASMFLAGS
5059 BUILDSUF=$build_suffix
5060 PROGSSUF=$progs_suffix
5068 EXTRA_VERSION=$extra_version
5071 CCDEP_FLAGS=$CCDEP_FLAGS
5073 ASDEP_FLAGS=$ASDEP_FLAGS
5074 CC_DEPFLAGS=$CC_DEPFLAGS
5075 AS_DEPFLAGS=$AS_DEPFLAGS
5078 HOSTCFLAGS=$host_cflags
5079 HOSTCPPFLAGS=$host_cppflags
5080 HOSTEXESUF=$HOSTEXESUF
5081 HOSTLDFLAGS=$host_ldflags
5084 DEPHOSTCCFLAGS=$DEPHOSTCCFLAGS \$(HOSTCCFLAGS)
5085 HOSTCCDEP=$HOSTCCDEP
5086 HOSTCCDEP_FLAGS=$HOSTCCDEP_FLAGS
5087 HOSTCC_DEPFLAGS=$HOSTCC_DEPFLAGS
5091 TARGET_EXEC=$target_exec $target_exec_args
5092 TARGET_PATH=$target_path
5093 TARGET_SAMPLES=${target_samples:-\$(SAMPLES)}
5094 LIBS-ffplay=$sdl_libs
5095 CFLAGS-ffplay=$sdl_cflags
5096 ZLIB=$($ldflags_filter -lz)
5097 LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD
5098 EXTRALIBS=$extralibs
5099 COMPAT_OBJS=$compat_objs
5102 LIBTARGET=${LIBTARGET}
5103 SLIBNAME=${SLIBNAME}
5104 SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}
5105 SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}
5106 SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}
5107 SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}
5108 SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
5109 SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
5110 SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
5111 SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
5112 SAMPLES:=${samples:-\$(FATE_SAMPLES)}
5113 NOREDZONE_FLAGS=$noredzone_flags
5118 name=$(toupper $lcname)
5119 file=$source_path/$lcname/version.h
5120 eval $(awk "/#define ${name}_VERSION_M/ { print \$2 \"=\" \$3 }" "$file")
5121 enabled raise_major && eval ${name}_VERSION_MAJOR=$((${name}_VERSION_MAJOR+100))
5122 eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
5123 eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
5124 eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
5125 eval echo "${lcname}_VERSION_MINOR=\$${name}_VERSION_MINOR" >> config.mak
5128 map 'get_version $v' $LIBRARY_LIST
5131 /* Automatically generated by configure - do not modify! */
5132 #ifndef FFMPEG_CONFIG_H
5133 #define FFMPEG_CONFIG_H
5134 #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
5135 #define FFMPEG_LICENSE "$(c_escape $license)"
5136 #define CONFIG_THIS_YEAR 2014
5137 #define FFMPEG_DATADIR "$(eval c_escape $datadir)"
5138 #define AVCONV_DATADIR "$(eval c_escape $datadir)"
5139 #define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
5140 #define av_restrict $_restrict
5141 #define EXTERN_PREFIX "${extern_prefix}"
5142 #define EXTERN_ASM ${extern_prefix}
5143 #define BUILDSUF "$build_suffix"
5144 #define SLIBSUF "$SLIBSUF"
5145 #define HAVE_MMX2 HAVE_MMXEXT
5148 test -n "$assert_level" &&
5149 echo "#define ASSERT_LEVEL $assert_level" >>$TMPH
5151 test -n "$malloc_prefix" &&
5152 echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH
5154 if enabled yasm; then
5155 append config_files $TMPASM
5159 enabled getenv || echo "#define getenv(x) NULL" >> $TMPH
5163 echo "@c auto-generated by configure" > doc/config.texi
5165 print_config ARCH_ "$config_files" $ARCH_LIST
5166 print_config HAVE_ "$config_files" $HAVE_LIST
5167 print_config CONFIG_ "$config_files" $CONFIG_LIST \
5171 echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
5172 echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
5174 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
5175 cp_if_changed $TMPH config.h
5178 enabled yasm && cp_if_changed $TMPASM config.asm
5181 /* Generated by ffconf */
5182 #ifndef AVUTIL_AVCONFIG_H
5183 #define AVUTIL_AVCONFIG_H
5186 print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB
5188 echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH
5190 cp_if_changed $TMPH libavutil/avconfig.h
5192 if test -n "$WARNINGS"; then
5193 printf "\n$WARNINGS"
5194 enabled fatal_warnings && exit 1
5197 # build pkg-config files
5199 pkgconfig_generate(){
5201 shortname=${name#lib}${build_suffix}
5206 enabled ${name#lib} || return 0
5208 cat <<EOF > $name/$name${build_suffix}.pc
5210 exec_prefix=\${prefix}
5215 Description: $comment
5217 Requires: $(enabled shared || echo $requires)
5218 Requires.private: $(enabled shared && echo $requires)
5220 Libs: -L\${libdir} $(enabled rpath && echo "-Wl,-rpath,\${libdir}") -l${shortname} $(enabled shared || echo $libs)
5221 Libs.private: $(enabled shared && echo $libs)
5222 Cflags: -I\${includedir}
5225 mkdir -p doc/examples/pc-uninstalled
5226 includedir=${source_path}
5227 [ "$includedir" = . ] && includedir="\${pcfiledir}/../../.."
5228 cat <<EOF > doc/examples/pc-uninstalled/$name.pc
5231 libdir=\${pcfiledir}/../../../$name
5232 includedir=${includedir}
5235 Description: $comment
5239 Libs: -L\${libdir} -Wl,-rpath,\${libdir} -l${shortname} $(enabled shared || echo $libs)
5240 Cflags: -I\${includedir}
5244 lavfi_libs="libavutil${build_suffix} = $LIBAVUTIL_VERSION"
5245 enabled libavfilter_deps_avcodec && prepend lavfi_libs "libavcodec${build_suffix} = $LIBAVCODEC_VERSION,"
5246 enabled libavfilter_deps_avformat && prepend lavfi_libs "libavformat${build_suffix} = $LIBAVFORMAT_VERSION,"
5247 enabled libavfilter_deps_avresample && prepend lavfi_libs "libavresample${build_suffix} = $LIBAVRESAMPLE_VERSION,"
5248 enabled libavfilter_deps_swscale && prepend lavfi_libs "libswscale${build_suffix} = $LIBSWSCALE_VERSION,"
5249 enabled libavfilter_deps_swresample && prepend lavfi_libs "libswresample${build_suffix} = $LIBSWRESAMPLE_VERSION,"
5250 enabled libavfilter_deps_postproc && prepend lavfi_libs "libpostproc${build_suffix} = $LIBPOSTPROC_VERSION,"
5251 lavfi_libs=${lavfi_libs%, }
5253 lavd_libs="libavformat${build_suffix} = $LIBAVFORMAT_VERSION"
5254 enabled lavfi_indev && prepend lavd_libs "libavfilter${build_suffix} = $LIBAVFILTER_VERSION,"
5256 pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION" "$LIBM"
5257 pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
5258 pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec${build_suffix} = $LIBAVCODEC_VERSION"
5259 pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$lavd_libs"
5260 pkgconfig_generate libavfilter "FFmpeg audio/video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$lavfi_libs"
5261 pkgconfig_generate libpostproc "FFmpeg postprocessing library" "$LIBPOSTPROC_VERSION" "" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
5262 pkgconfig_generate libavresample "Libav audio resampling library" "$LIBAVRESAMPLE_VERSION" "$extralibs" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
5263 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"
5264 pkgconfig_generate libswresample "FFmpeg audio resampling library" "$LIBSWRESAMPLE_VERSION" "$LIBM" "libavutil${build_suffix} = $LIBAVUTIL_VERSION"