Commit | Line | Data |
---|---|---|
aeb29222 | 1 | #!/bin/sh |
0f3cb305 | 2 | # |
f57620d5 MR |
3 | # FFmpeg configure script |
4 | # | |
949906ea DB |
5 | # Copyright (c) 2000-2002 Fabrice Bellard |
6 | # Copyright (c) 2005-2008 Diego Biurrun | |
7 | # Copyright (c) 2005-2008 Mans Rullgard | |
0f3cb305 | 8 | # |
cf9d24ad | 9 | |
31e647f8 | 10 | # Prevent locale nonsense from breaking basic text processing. |
79ab96ba DB |
11 | LC_ALL=C |
12 | export LC_ALL | |
31e647f8 | 13 | |
cde2d79a | 14 | # make sure we are running under a compatible shell |
c21d6325 MR |
15 | # try to make this part work with most shells |
16 | ||
17 | try_exec(){ | |
0dbe81bb | 18 | echo "Trying shell $1" |
2270b4b2 | 19 | type "$1" > /dev/null 2>&1 && exec "$@" |
c21d6325 MR |
20 | } |
21 | ||
5237ce67 | 22 | unset foo |
2270b4b2 | 23 | (: ${foo%%bar}) 2> /dev/null |
0dbe81bb MR |
24 | E1="$?" |
25 | ||
2270b4b2 | 26 | (: ${foo?}) 2> /dev/null |
0dbe81bb MR |
27 | E2="$?" |
28 | ||
29 | if test "$E1" != 0 || test "$E2" = 0; then | |
30 | echo "Broken shell detected. Trying alternatives." | |
c21d6325 MR |
31 | export FF_CONF_EXEC |
32 | if test "0$FF_CONF_EXEC" -lt 1; then | |
33 | FF_CONF_EXEC=1 | |
34 | try_exec bash "$0" "$@" | |
35 | fi | |
36 | if test "0$FF_CONF_EXEC" -lt 2; then | |
37 | FF_CONF_EXEC=2 | |
38 | try_exec ksh "$0" "$@" | |
39 | fi | |
40 | if test "0$FF_CONF_EXEC" -lt 3; then | |
41 | FF_CONF_EXEC=3 | |
42 | try_exec /usr/xpg4/bin/sh "$0" "$@" | |
cde2d79a MR |
43 | fi |
44 | echo "No compatible shell script interpreter found." | |
fc53da20 | 45 | echo "This configure script requires a POSIX-compatible shell" |
c21d6325 | 46 | echo "such as bash or ksh." |
505dfb09 DB |
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." | |
c21d6325 MR |
50 | if test "$BASH_VERSION" = '2.04.0(1)-release'; then |
51 | echo "This bash version ($BASH_VERSION) is broken on your platform." | |
52 | echo "Upgrade to a later version if available." | |
53 | fi | |
cde2d79a MR |
54 | exit 1 |
55 | fi | |
56 | ||
74c53c2d | 57 | show_help(){ |
06454877 MR |
58 | cat <<EOF |
59 | Usage: configure [options] | |
60 | Options: [defaults in brackets after descriptions] | |
61 | ||
62 | Standard options: | |
63 | --help print this message | |
19bd477d | 64 | --logfile=FILE log tests and output to FILE [config.log] |
06454877 MR |
65 | --disable-logging do not log configure debug information |
66 | --prefix=PREFIX install in PREFIX [$prefix] | |
67 | --bindir=DIR install binaries in DIR [PREFIX/bin] | |
68 | --datadir=DIR install data files in DIR [PREFIX/share/ffmpeg] | |
69 | --libdir=DIR install libs in DIR [PREFIX/lib] | |
70 | --shlibdir=DIR install shared libs in DIR [PREFIX/lib] | |
71 | --incdir=DIR install includes in DIR [PREFIX/include] | |
72 | --mandir=DIR install man page in DIR [PREFIX/share/man] | |
73 | ||
74 | Configuration options: | |
75 | --disable-static do not build static libraries [no] | |
76 | --enable-shared build shared libraries [no] | |
77 | --enable-gpl allow use of GPL code, the resulting libs | |
78 | and binaries will be under GPL [no] | |
79 | --enable-version3 upgrade (L)GPL to version 3 [no] | |
80 | --enable-nonfree allow use of nonfree code, the resulting libs | |
81 | and binaries will be unredistributable [no] | |
82 | --disable-doc do not build documentation | |
83 | --disable-ffmpeg disable ffmpeg build | |
84 | --disable-ffplay disable ffplay build | |
336ce917 | 85 | --disable-ffprobe disable ffprobe build |
06454877 | 86 | --disable-ffserver disable ffserver build |
5a0f7131 MR |
87 | --disable-avdevice disable libavdevice build |
88 | --disable-avcodec disable libavcodec build | |
aac6ca69 | 89 | --disable-avcore disable libavcore build |
5a0f7131 MR |
90 | --disable-avformat disable libavformat build |
91 | --disable-swscale disable libswscale build | |
06454877 | 92 | --enable-postproc enable GPLed postprocessing support [no] |
cccc039f | 93 | --disable-avfilter disable video filter support [no] |
0dbfc1db | 94 | --disable-pthreads disable pthreads [auto] |
06454877 MR |
95 | --enable-w32threads use Win32 threads [no] |
96 | --enable-x11grab enable X11 grabbing [no] | |
97 | --disable-network disable network support [no] | |
06454877 MR |
98 | --disable-mpegaudio-hp faster (but less accurate) MPEG audio decoding [no] |
99 | --enable-gray enable full grayscale support (slower color) | |
100 | --disable-swscale-alpha disable alpha channel support in swscale | |
101 | --disable-fastdiv disable table-based division | |
102 | --enable-small optimize for size instead of speed | |
103 | --disable-aandct disable AAN DCT code | |
7f3f5f46 | 104 | --disable-dct disable DCT code |
06454877 MR |
105 | --disable-fft disable FFT code |
106 | --disable-golomb disable Golomb code | |
3447f12d | 107 | --disable-huffman disable Huffman code |
06454877 MR |
108 | --disable-lpc disable LPC code |
109 | --disable-mdct disable MDCT code | |
110 | --disable-rdft disable RDFT code | |
111 | --disable-vaapi disable VAAPI code | |
112 | --disable-vdpau disable VDPAU code | |
92c6a099 | 113 | --disable-dxva2 disable DXVA2 code |
06454877 MR |
114 | --enable-runtime-cpudetect detect cpu capabilities at runtime (bigger binary) |
115 | --enable-hardcoded-tables use hardcoded tables instead of runtime generation | |
116 | --enable-memalign-hack emulate memalign, interferes with memory debuggers | |
bb55e3a3 | 117 | --disable-everything disable all components listed below |
06454877 MR |
118 | --disable-encoder=NAME disable encoder NAME |
119 | --enable-encoder=NAME enable encoder NAME | |
120 | --disable-encoders disable all encoders | |
121 | --disable-decoder=NAME disable decoder NAME | |
122 | --enable-decoder=NAME enable decoder NAME | |
123 | --disable-decoders disable all decoders | |
124 | --disable-hwaccel=NAME disable hwaccel NAME | |
125 | --enable-hwaccel=NAME enable hwaccel NAME | |
126 | --disable-hwaccels disable all hwaccels | |
127 | --disable-muxer=NAME disable muxer NAME | |
128 | --enable-muxer=NAME enable muxer NAME | |
129 | --disable-muxers disable all muxers | |
130 | --disable-demuxer=NAME disable demuxer NAME | |
131 | --enable-demuxer=NAME enable demuxer NAME | |
132 | --disable-demuxers disable all demuxers | |
133 | --enable-parser=NAME enable parser NAME | |
134 | --disable-parser=NAME disable parser NAME | |
135 | --disable-parsers disable all parsers | |
136 | --enable-bsf=NAME enable bitstream filter NAME | |
137 | --disable-bsf=NAME disable bitstream filter NAME | |
138 | --disable-bsfs disable all bitstream filters | |
139 | --enable-protocol=NAME enable protocol NAME | |
140 | --disable-protocol=NAME disable protocol NAME | |
141 | --disable-protocols disable all protocols | |
142 | --disable-indev=NAME disable input device NAME | |
143 | --disable-outdev=NAME disable output device NAME | |
144 | --disable-indevs disable input devices | |
145 | --disable-outdevs disable output devices | |
146 | --disable-devices disable all devices | |
147 | --enable-filter=NAME enable filter NAME | |
148 | --disable-filter=NAME disable filter NAME | |
149 | --disable-filters disable all filters | |
150 | --list-decoders show all available decoders | |
151 | --list-encoders show all available encoders | |
152 | --list-hwaccels show all available hardware accelerators | |
153 | --list-muxers show all available muxers | |
154 | --list-demuxers show all available demuxers | |
155 | --list-parsers show all available parsers | |
156 | --list-protocols show all available protocols | |
157 | --list-bsfs show all available bitstream filters | |
158 | --list-indevs show all available input devices | |
159 | --list-outdevs show all available output devices | |
160 | --list-filters show all available filters | |
161 | ||
162 | External library support: | |
163 | --enable-avisynth enable reading of AVISynth script files [no] | |
164 | --enable-bzlib enable bzlib [autodetect] | |
165 | --enable-libopencore-amrnb enable AMR-NB de/encoding via libopencore-amrnb [no] | |
166 | --enable-libopencore-amrwb enable AMR-WB decoding via libopencore-amrwb [no] | |
167 | --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394 | |
168 | and libraw1394 [no] | |
169 | --enable-libdirac enable Dirac support via libdirac [no] | |
170 | --enable-libfaac enable FAAC support via libfaac [no] | |
06454877 MR |
171 | --enable-libgsm enable GSM support via libgsm [no] |
172 | --enable-libmp3lame enable MP3 encoding via libmp3lame [no] | |
173 | --enable-libnut enable NUT (de)muxing via libnut, | |
174 | native (de)muxer exists [no] | |
175 | --enable-libopenjpeg enable JPEG 2000 decoding via OpenJPEG [no] | |
0f943ce6 | 176 | --enable-librtmp enable RTMP[E] support via librtmp [no] |
06454877 MR |
177 | --enable-libschroedinger enable Dirac support via libschroedinger [no] |
178 | --enable-libspeex enable Speex decoding via libspeex [no] | |
179 | --enable-libtheora enable Theora encoding via libtheora [no] | |
180 | --enable-libvorbis enable Vorbis encoding via libvorbis, | |
181 | native implementation exists [no] | |
8299a7f8 | 182 | --enable-libvpx enable VP8 support via libvpx [no] |
06454877 | 183 | --enable-libx264 enable H.264 encoding via x264 [no] |
de295976 | 184 | --enable-libxavs enable AVS encoding via xavs [no] |
06454877 MR |
185 | --enable-libxvid enable Xvid encoding via xvidcore, |
186 | native MPEG-4/Xvid encoder exists [no] | |
187 | --enable-mlib enable Sun medialib [no] | |
188 | --enable-zlib enable zlib [autodetect] | |
189 | ||
190 | Advanced options (experts only): | |
191 | --source-path=PATH path to source code [$source_path] | |
192 | --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix] | |
193 | --enable-cross-compile assume a cross-compiler is used | |
194 | --sysroot=PATH root of cross-build tree | |
195 | --sysinclude=PATH location of cross-build system headers | |
196 | --target-os=OS compiler targets OS [$target_os] | |
197 | --target-exec=CMD command to run executables on target | |
198 | --target-path=DIR path to view of build directory on target | |
199 | --nm=NM use nm tool | |
121d78d0 | 200 | --ar=AR use archive tool AR [$ar_default] |
06454877 MR |
201 | --as=AS use assembler AS [$as_default] |
202 | --cc=CC use C compiler CC [$cc_default] | |
203 | --ld=LD use linker LD | |
204 | --host-cc=HOSTCC use host C compiler HOSTCC | |
205 | --host-cflags=HCFLAGS use HCFLAGS when compiling for host | |
206 | --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host | |
207 | --host-libs=HLIBS use libs HLIBS when linking for host | |
208 | --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS] | |
209 | --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS] | |
210 | --extra-libs=ELIBS add ELIBS [$ELIBS] | |
211 | --extra-version=STRING version string suffix [] | |
212 | --build-suffix=SUFFIX library name suffix [] | |
213 | --arch=ARCH select architecture [$arch] | |
214 | --cpu=CPU select the minimum required CPU (affects | |
215 | instruction selection, may crash on older CPUs) | |
c8a4ae00 | 216 | --disable-asm disable all assembler optimizations |
06454877 MR |
217 | --disable-altivec disable AltiVec optimizations |
218 | --disable-amd3dnow disable 3DNow! optimizations | |
219 | --disable-amd3dnowext disable 3DNow! extended optimizations | |
220 | --disable-mmx disable MMX optimizations | |
221 | --disable-mmx2 disable MMX2 optimizations | |
222 | --disable-sse disable SSE optimizations | |
223 | --disable-ssse3 disable SSSE3 optimizations | |
224 | --disable-armv5te disable armv5te optimizations | |
225 | --disable-armv6 disable armv6 optimizations | |
226 | --disable-armv6t2 disable armv6t2 optimizations | |
227 | --disable-armvfp disable ARM VFP optimizations | |
228 | --disable-iwmmxt disable iwmmxt optimizations | |
229 | --disable-mmi disable MMI optimizations | |
230 | --disable-neon disable neon optimizations | |
231 | --disable-vis disable VIS optimizations | |
232 | --disable-yasm disable use of yasm assembler | |
233 | --enable-pic build position-independent code | |
4ae40685 | 234 | --malloc-prefix=PFX prefix malloc and related names with PFX |
6b35d421 | 235 | --enable-sram allow use of on-chip SRAM |
06454877 MR |
236 | |
237 | Developer options (useful when working on FFmpeg itself): | |
238 | --disable-debug disable debugging symbols | |
239 | --enable-debug=LEVEL set the debug level [$debuglevel] | |
06454877 MR |
240 | --disable-optimizations disable compiler optimizations |
241 | --enable-extra-warnings enable more compiler warnings | |
242 | --disable-stripping disable stripping of executables and shared libraries | |
2fad0977 | 243 | --samples=PATH location of test samples for FATE |
06454877 MR |
244 | |
245 | NOTE: Object files are built at the place where configure is launched. | |
246 | EOF | |
60e8bc13 | 247 | exit 0 |
74c53c2d | 248 | } |
cf9d24ad | 249 | |
0884fadf MR |
250 | quotes='""' |
251 | ||
57bd82d4 | 252 | log(){ |
2270b4b2 | 253 | echo "$@" >> $logfile |
57bd82d4 MR |
254 | } |
255 | ||
720c69da | 256 | log_file(){ |
c8e9f801 | 257 | log BEGIN $1 |
2270b4b2 | 258 | pr -n -t $1 >> $logfile |
c8e9f801 MR |
259 | log END $1 |
260 | } | |
261 | ||
2ba042a7 | 262 | echolog(){ |
c8e9f801 | 263 | log "$@" |
57bd82d4 | 264 | echo "$@" |
2ba042a7 MR |
265 | } |
266 | ||
7bfc8ae6 MR |
267 | warn(){ |
268 | log "WARNING: $*" | |
269 | WARNINGS="${WARNINGS}WARNING: $*\n" | |
270 | } | |
271 | ||
2ba042a7 MR |
272 | die(){ |
273 | echolog "$@" | |
274 | cat <<EOF | |
d326cf7f | 275 | |
2ba042a7 MR |
276 | If you think configure made a mistake, make sure you are using the latest |
277 | version from SVN. If the latest version fails, report the problem to the | |
e5d8ccd7 | 278 | ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net. |
2ba042a7 | 279 | EOF |
e155a21a | 280 | if disabled logging; then |
2ba042a7 | 281 | cat <<EOF |
e155a21a DB |
282 | Rerun configure with logging enabled (do not use --disable-logging), and |
283 | include the log this produces with your report. | |
2ba042a7 MR |
284 | EOF |
285 | else | |
286 | cat <<EOF | |
e155a21a DB |
287 | Include the log file "$logfile" produced by configure as this will help |
288 | solving the problem. | |
2ba042a7 MR |
289 | EOF |
290 | fi | |
57bd82d4 MR |
291 | exit 1 |
292 | } | |
293 | ||
6c6007d6 | 294 | # Avoid locale weirdness, besides we really just want to translate ASCII. |
44161118 | 295 | toupper(){ |
6c6007d6 | 296 | echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ |
44161118 MR |
297 | } |
298 | ||
4a5444db | 299 | tolower(){ |
6c6007d6 | 300 | echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz |
4a5444db MR |
301 | } |
302 | ||
14a8acf1 MR |
303 | c_escape(){ |
304 | echo "$*" | sed 's/["\\]/\\\0/g' | |
305 | } | |
306 | ||
b04251c5 MR |
307 | sh_quote(){ |
308 | v=$(echo "$1" | sed "s/'/'\\\\''/g") | |
d72c981c | 309 | test "x$v" = "x${v#*[!A-Za-z0-9_/.+-]}" || v="'$v'" |
b04251c5 MR |
310 | echo "$v" |
311 | } | |
312 | ||
be8f2501 MR |
313 | filter(){ |
314 | pat=$1 | |
315 | shift | |
316 | for v; do | |
98ef6079 | 317 | eval "case $v in $pat) echo $v ;; esac" |
be8f2501 MR |
318 | done |
319 | } | |
320 | ||
36e2dea0 MR |
321 | map(){ |
322 | m=$1 | |
323 | shift | |
e0e335a0 | 324 | for v; do eval $m; done |
36e2dea0 MR |
325 | } |
326 | ||
a8d04fba MR |
327 | set_all(){ |
328 | value=$1 | |
329 | shift | |
330 | for var in $*; do | |
331 | eval $var=$value | |
332 | done | |
333 | } | |
334 | ||
72a43668 MR |
335 | set_weak(){ |
336 | value=$1 | |
337 | shift | |
338 | for var; do | |
339 | eval : \${$var:=$value} | |
340 | done | |
341 | } | |
342 | ||
799c9e9b MR |
343 | pushvar(){ |
344 | for var in $*; do | |
345 | eval level=\${${var}_level:=0} | |
346 | eval ${var}_${level}="\$$var" | |
347 | eval ${var}_level=$(($level+1)) | |
348 | done | |
349 | } | |
350 | ||
351 | popvar(){ | |
352 | for var in $*; do | |
353 | eval level=\${${var}_level:-0} | |
354 | test $level = 0 && continue | |
355 | eval level=$(($level-1)) | |
356 | eval $var="\${${var}_${level}}" | |
357 | eval ${var}_level=$level | |
358 | eval unset ${var}_${level} | |
359 | done | |
360 | } | |
361 | ||
a8d04fba MR |
362 | enable(){ |
363 | set_all yes $* | |
364 | } | |
365 | ||
366 | disable(){ | |
367 | set_all no $* | |
368 | } | |
369 | ||
72a43668 MR |
370 | enable_weak(){ |
371 | set_weak yes $* | |
372 | } | |
373 | ||
374 | disable_weak(){ | |
375 | set_weak no $* | |
376 | } | |
377 | ||
72702705 | 378 | enable_safe(){ |
fd07f803 MR |
379 | for var; do |
380 | enable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g') | |
381 | done | |
72702705 MR |
382 | } |
383 | ||
384 | disable_safe(){ | |
fd07f803 MR |
385 | for var; do |
386 | disable $(echo "$var" | sed 's/[^A-Za-z0-9_]/_/g') | |
387 | done | |
72702705 MR |
388 | } |
389 | ||
f9d328da MR |
390 | do_enable_deep(){ |
391 | for var; do | |
392 | enabled $var && continue | |
393 | eval sel="\$${var}_select" | |
c510c7b5 MR |
394 | eval sgs="\$${var}_suggest" |
395 | pushvar var sgs | |
f9d328da | 396 | enable_deep $sel |
c510c7b5 MR |
397 | popvar sgs |
398 | enable_deep_weak $sgs | |
f9d328da MR |
399 | popvar var |
400 | done | |
401 | } | |
402 | ||
403 | enable_deep(){ | |
404 | do_enable_deep $* | |
405 | enable $* | |
406 | } | |
407 | ||
72a43668 MR |
408 | enable_deep_weak(){ |
409 | do_enable_deep $* | |
410 | enable_weak $* | |
411 | } | |
412 | ||
57bd82d4 | 413 | enabled(){ |
3250003c MR |
414 | test "${1#!}" = "$1" && op== || op=!= |
415 | eval test "x\$${1#!}" $op "xyes" | |
44161118 MR |
416 | } |
417 | ||
37970ebf | 418 | disabled(){ |
3250003c MR |
419 | test "${1#!}" = "$1" && op== || op=!= |
420 | eval test "x\$${1#!}" $op "xno" | |
37970ebf RP |
421 | } |
422 | ||
44161118 MR |
423 | enabled_all(){ |
424 | for opt; do | |
425 | enabled $opt || return 1 | |
426 | done | |
427 | } | |
428 | ||
85bca2c5 DB |
429 | disabled_all(){ |
430 | for opt; do | |
431 | disabled $opt || return 1 | |
432 | done | |
433 | } | |
434 | ||
44161118 MR |
435 | enabled_any(){ |
436 | for opt; do | |
437 | enabled $opt && return 0 | |
438 | done | |
439 | } | |
440 | ||
85bca2c5 DB |
441 | disabled_any(){ |
442 | for opt; do | |
443 | disabled $opt && return 0 | |
444 | done | |
f7b230a7 | 445 | return 1 |
85bca2c5 DB |
446 | } |
447 | ||
c9d19248 MR |
448 | set_default(){ |
449 | for opt; do | |
88268e94 | 450 | eval : \${$opt:=\$${opt}_default} |
c9d19248 MR |
451 | done |
452 | } | |
453 | ||
4a0d6686 AJ |
454 | is_in(){ |
455 | value=$1 | |
456 | shift | |
457 | for var in $*; do | |
458 | [ $var = $value ] && return 0 | |
459 | done | |
460 | return 1 | |
461 | } | |
462 | ||
30fd06be MR |
463 | check_deps(){ |
464 | for cfg; do | |
3250003c | 465 | cfg="${cfg#!}" |
799c9e9b MR |
466 | enabled ${cfg}_checking && die "Circular dependency for $cfg." |
467 | disabled ${cfg}_checking && continue | |
468 | enable ${cfg}_checking | |
469 | ||
30fd06be MR |
470 | eval dep_all="\$${cfg}_deps" |
471 | eval dep_any="\$${cfg}_deps_any" | |
7ef3425f | 472 | eval dep_sel="\$${cfg}_select" |
c510c7b5 | 473 | eval dep_sgs="\$${cfg}_suggest" |
3d7453e0 MR |
474 | eval dep_ifa="\$${cfg}_if" |
475 | eval dep_ifn="\$${cfg}_if_any" | |
799c9e9b | 476 | |
3d7453e0 MR |
477 | pushvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn |
478 | check_deps $dep_all $dep_any $dep_sel $dep_sgs $dep_ifa $dep_ifn | |
479 | popvar cfg dep_all dep_any dep_sel dep_sgs dep_ifa dep_ifn | |
799c9e9b | 480 | |
3d7453e0 MR |
481 | [ -n "$dep_ifa" ] && { enabled_all $dep_ifa && enable_weak $cfg; } |
482 | [ -n "$dep_ifn" ] && { enabled_any $dep_ifn && enable_weak $cfg; } | |
6a702d4c MR |
483 | enabled_all $dep_all || disable $cfg |
484 | enabled_any $dep_any || disable $cfg | |
7ef3425f | 485 | disabled_any $dep_sel && disable $cfg |
799c9e9b | 486 | |
4ec45764 RP |
487 | if enabled $cfg; then |
488 | eval dep_extralibs="\$${cfg}_extralibs" | |
489 | test -n "$dep_extralibs" && add_extralibs $dep_extralibs | |
f9d328da | 490 | enable_deep $dep_sel |
c510c7b5 | 491 | enable_deep_weak $dep_sgs |
4ec45764 RP |
492 | fi |
493 | ||
799c9e9b | 494 | disable ${cfg}_checking |
30fd06be MR |
495 | done |
496 | } | |
497 | ||
72cfcf41 MR |
498 | print_config_h(){ |
499 | enabled $1 && v=1 || v=0 | |
500 | echo "#define $2 $v" | |
501 | } | |
502 | ||
503 | print_config_mak(){ | |
504 | enabled $1 && v= || v=! | |
505 | echo "$v$2=yes" | |
506 | } | |
507 | ||
55127e7b MR |
508 | print_config_asm(){ |
509 | enabled $1 && echo "%define $2" | |
510 | } | |
511 | ||
44161118 MR |
512 | print_config(){ |
513 | pfx=$1 | |
72cfcf41 MR |
514 | files=$2 |
515 | shift 2 | |
44161118 | 516 | for cfg; do |
5e622c40 | 517 | ucname="$(toupper $cfg)" |
72cfcf41 MR |
518 | for f in $files; do |
519 | "print_config_${f##*.}" $cfg ${pfx}${ucname} >>$f | |
520 | done | |
44161118 | 521 | done |
57bd82d4 MR |
522 | } |
523 | ||
31c0121d MR |
524 | print_enabled(){ |
525 | test "$1" = -n && end=" " && shift || end="\n" | |
526 | suf=$1 | |
527 | shift | |
528 | for v; do | |
529 | enabled $v && printf "%s$end" ${v%$suf}; | |
530 | done | |
531 | } | |
532 | ||
57bd82d4 MR |
533 | append(){ |
534 | var=$1 | |
535 | shift | |
57bd82d4 MR |
536 | eval "$var=\"\$$var $*\"" |
537 | } | |
538 | ||
60361817 MR |
539 | prepend(){ |
540 | var=$1 | |
541 | shift | |
542 | eval "$var=\"$* \$$var\"" | |
543 | } | |
544 | ||
50a334e4 | 545 | add_cppflags(){ |
caf458dd | 546 | append CPPFLAGS $($filter_cppflags "$@") |
50a334e4 MR |
547 | } |
548 | ||
57bd82d4 | 549 | add_cflags(){ |
caf458dd | 550 | append CFLAGS $($filter_cflags "$@") |
57bd82d4 MR |
551 | } |
552 | ||
2f2e6c7c | 553 | add_asflags(){ |
caf458dd | 554 | append ASFLAGS $($filter_asflags "$@") |
2f2e6c7c MR |
555 | } |
556 | ||
57bd82d4 MR |
557 | add_ldflags(){ |
558 | append LDFLAGS "$@" | |
559 | } | |
560 | ||
561 | add_extralibs(){ | |
60361817 | 562 | prepend extralibs "$@" |
57bd82d4 MR |
563 | } |
564 | ||
b0cfb663 | 565 | check_cmd(){ |
b3cb5d51 | 566 | log "$@" |
2270b4b2 | 567 | "$@" >> $logfile 2>&1 |
b0cfb663 MR |
568 | } |
569 | ||
dcd479c0 | 570 | check_cc(){ |
57bd82d4 | 571 | log check_cc "$@" |
2270b4b2 | 572 | cat > $TMPC |
720c69da | 573 | log_file $TMPC |
50a334e4 | 574 | check_cmd $cc $CPPFLAGS $CFLAGS "$@" -c -o $TMPO $TMPC |
57bd82d4 MR |
575 | } |
576 | ||
577 | check_cpp(){ | |
578 | log check_cpp "$@" | |
2270b4b2 | 579 | cat > $TMPC |
720c69da | 580 | log_file $TMPC |
9e7f3277 | 581 | check_cmd $cc $CPPFLAGS $CFLAGS "$@" -E -o $TMPO $TMPC |
dcd479c0 MR |
582 | } |
583 | ||
f65883c8 MR |
584 | check_as(){ |
585 | log check_as "$@" | |
586 | cat > $TMPC | |
587 | log_file $TMPC | |
2f2e6c7c | 588 | check_cmd $as $CPPFLAGS $ASFLAGS "$@" -c -o $TMPO $TMPC |
f65883c8 MR |
589 | } |
590 | ||
940f335a MR |
591 | check_asm(){ |
592 | log check_asm "$@" | |
593 | name="$1" | |
3784e82e | 594 | code="$2" |
940f335a | 595 | shift 2 |
49214f61 MR |
596 | disable $name |
597 | check_as "$@" <<EOF && enable $name | |
3784e82e | 598 | void foo(void){ __asm__ volatile($code); } |
940f335a MR |
599 | EOF |
600 | } | |
601 | ||
304d586d LM |
602 | check_yasm(){ |
603 | log check_yasm "$@" | |
604 | echo "$1" > $TMPS | |
605 | log_file $TMPS | |
606 | shift 1 | |
607 | check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS | |
608 | } | |
609 | ||
dcd479c0 | 610 | check_ld(){ |
57bd82d4 | 611 | log check_ld "$@" |
3155a644 MR |
612 | flags='' |
613 | libs='' | |
614 | for f; do | |
615 | test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f" | |
616 | done | |
2a194acd | 617 | check_cc $($filter_cflags $flags) || return |
684b28e0 | 618 | check_cmd $ld $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs |
dcd479c0 MR |
619 | } |
620 | ||
50a334e4 MR |
621 | check_cppflags(){ |
622 | log check_cppflags "$@" | |
caf458dd MR |
623 | set -- $($filter_cppflags "$@") |
624 | check_cc "$@" <<EOF && append CPPFLAGS "$@" | |
50a334e4 MR |
625 | int x; |
626 | EOF | |
627 | } | |
628 | ||
dcd479c0 | 629 | check_cflags(){ |
57bd82d4 | 630 | log check_cflags "$@" |
caf458dd MR |
631 | set -- $($filter_cflags "$@") |
632 | check_cc "$@" <<EOF && append CFLAGS "$@" | |
dcd479c0 MR |
633 | int x; |
634 | EOF | |
635 | } | |
636 | ||
2ed46eea MR |
637 | test_ldflags(){ |
638 | log test_ldflags "$@" | |
639 | check_ld "$@" <<EOF | |
c23a0ac8 | 640 | int main(void){ return 0; } |
dcd479c0 MR |
641 | EOF |
642 | } | |
643 | ||
2ed46eea MR |
644 | check_ldflags(){ |
645 | log check_ldflags "$@" | |
646 | test_ldflags "$@" && add_ldflags "$@" | |
647 | } | |
648 | ||
dcd479c0 | 649 | check_header(){ |
57bd82d4 | 650 | log check_header "$@" |
dcd479c0 MR |
651 | header=$1 |
652 | shift | |
b77df637 MR |
653 | disable_safe $header |
654 | check_cpp "$@" <<EOF && enable_safe $header | |
dcd479c0 MR |
655 | #include <$header> |
656 | int x; | |
657 | EOF | |
658 | } | |
659 | ||
660 | check_func(){ | |
57bd82d4 | 661 | log check_func "$@" |
dcd479c0 MR |
662 | func=$1 |
663 | shift | |
d8bc5f06 MR |
664 | disable $func |
665 | check_ld "$@" <<EOF && enable $func | |
dcd479c0 | 666 | extern int $func(); |
c23a0ac8 | 667 | int main(void){ $func(); } |
dcd479c0 MR |
668 | EOF |
669 | } | |
670 | ||
645d2652 | 671 | check_mathfunc(){ |
6b73c0ae | 672 | log check_mathfunc "$@" |
645d2652 MR |
673 | func=$1 |
674 | shift | |
675 | disable $func | |
676 | check_ld "$@" <<EOF && enable $func | |
677 | #include <math.h> | |
33bd38db MR |
678 | float foo(float f) { return $func(f); } |
679 | int main(void){ return 0; } | |
645d2652 MR |
680 | EOF |
681 | } | |
682 | ||
2446d3d6 DB |
683 | check_func_headers(){ |
684 | log check_func_headers "$@" | |
f8d7b072 MR |
685 | headers=$1 |
686 | func=$2 | |
687 | shift 2 | |
688 | disable $func | |
689 | incs="" | |
690 | for hdr in $headers; do | |
691 | incs="$incs | |
692 | #include <$hdr>" | |
693 | done | |
cd0d9a9d | 694 | check_ld "$@" <<EOF && enable $func && enable_safe $headers |
f8d7b072 | 695 | $incs |
d6773f56 | 696 | int main(int argc, char **argv){ |
2b2c2a81 | 697 | return (long) $func; |
f8d7b072 MR |
698 | } |
699 | EOF | |
700 | } | |
701 | ||
a5344cf7 SS |
702 | check_cpp_condition(){ |
703 | log check_cpp_condition "$@" | |
704 | header=$1 | |
705 | condition=$2 | |
f855b7b9 MR |
706 | shift 2 |
707 | check_cpp $($filter_cppflags "$@") <<EOF | |
a5344cf7 SS |
708 | #include <$header> |
709 | #if !($condition) | |
710 | #error "unsatisfied condition: $condition" | |
711 | #endif | |
712 | EOF | |
713 | } | |
714 | ||
57bd82d4 MR |
715 | check_lib(){ |
716 | log check_lib "$@" | |
717 | header="$1" | |
718 | func="$2" | |
719 | shift 2 | |
84400e9d | 720 | check_header $header && check_func $func "$@" && add_extralibs "$@" |
57bd82d4 MR |
721 | } |
722 | ||
f8d7b072 MR |
723 | check_lib2(){ |
724 | log check_lib2 "$@" | |
725 | headers="$1" | |
726 | func="$2" | |
727 | shift 2 | |
300cde27 | 728 | check_func_headers "$headers" $func "$@" && add_extralibs "$@" |
f8d7b072 MR |
729 | } |
730 | ||
dcd479c0 | 731 | check_exec(){ |
2270b4b2 | 732 | check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; } |
57bd82d4 MR |
733 | } |
734 | ||
7dfef245 | 735 | check_exec_crash(){ |
5e622c40 | 736 | code=$(cat) |
7dfef245 MR |
737 | |
738 | # exit() is not async signal safe. _Exit (C99) and _exit (POSIX) | |
739 | # are safe but may not be available everywhere. Thus we use | |
740 | # raise(SIGTERM) instead. The check is run in a subshell so we | |
741 | # can redirect the "Terminated" message from the shell. SIGBUS | |
742 | # is not defined by standard C so it is used conditionally. | |
743 | ||
2270b4b2 | 744 | (check_exec "$@") >> $logfile 2>&1 <<EOF |
7dfef245 MR |
745 | #include <signal.h> |
746 | static void sighandler(int sig){ | |
747 | raise(SIGTERM); | |
748 | } | |
e5af4a11 | 749 | int main(void){ |
7dfef245 MR |
750 | signal(SIGILL, sighandler); |
751 | signal(SIGFPE, sighandler); | |
752 | signal(SIGSEGV, sighandler); | |
753 | #ifdef SIGBUS | |
754 | signal(SIGBUS, sighandler); | |
755 | #endif | |
756 | { $code } | |
757 | } | |
758 | EOF | |
759 | } | |
760 | ||
72be9e73 DY |
761 | check_type(){ |
762 | log check_type "$@" | |
763 | headers=$1 | |
764 | type=$2 | |
765 | shift 2 | |
ae550ce9 | 766 | disable_safe "$type" |
72be9e73 DY |
767 | incs="" |
768 | for hdr in $headers; do | |
769 | incs="$incs | |
770 | #include <$hdr>" | |
771 | done | |
ae550ce9 | 772 | check_cc "$@" <<EOF && enable_safe "$type" |
72be9e73 DY |
773 | $incs |
774 | $type v; | |
775 | EOF | |
776 | } | |
777 | ||
14d36751 MR |
778 | check_struct(){ |
779 | log check_type "$@" | |
780 | headers=$1 | |
781 | struct=$2 | |
782 | member=$3 | |
783 | shift 3 | |
784 | disable_safe "${struct}_${member}" | |
785 | incs="" | |
786 | for hdr in $headers; do | |
787 | incs="$incs | |
788 | #include <$hdr>" | |
789 | done | |
790 | check_cc "$@" <<EOF && enable_safe "${struct}_${member}" | |
791 | $incs | |
792 | const void *p = &(($struct *)0)->$member; | |
793 | EOF | |
794 | } | |
795 | ||
57bd82d4 MR |
796 | require(){ |
797 | name="$1" | |
798 | header="$2" | |
799 | func="$3" | |
800 | shift 3 | |
801 | check_lib $header $func "$@" || die "ERROR: $name not found" | |
dcd479c0 MR |
802 | } |
803 | ||
f8d7b072 MR |
804 | require2(){ |
805 | name="$1" | |
806 | headers="$2" | |
807 | func="$3" | |
808 | shift 3 | |
809 | check_lib2 "$headers" $func "$@" || die "ERROR: $name not found" | |
810 | } | |
811 | ||
f0125de9 MR |
812 | check_host_cc(){ |
813 | log check_host_cc "$@" | |
814 | cat > $TMPC | |
815 | log_file $TMPC | |
816 | check_cmd $host_cc $host_cflags "$@" -c -o $TMPO $TMPC | |
817 | } | |
818 | ||
819 | check_host_cflags(){ | |
820 | log check_host_cflags "$@" | |
821 | check_host_cc "$@" <<EOF && append host_cflags "$@" | |
822 | int x; | |
823 | EOF | |
824 | } | |
825 | ||
c505dd31 MR |
826 | apply(){ |
827 | file=$1 | |
828 | shift | |
829 | "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp" | |
830 | } | |
831 | ||
c34681df MR |
832 | cp_if_changed(){ |
833 | cmp -s "$1" "$2" && | |
834 | echo "$2 is unchanged" || | |
835 | cp -f "$1" "$2" | |
836 | } | |
837 | ||
dcd61286 DB |
838 | # CONFIG_LIST contains configurable options, while HAVE_LIST is for |
839 | # system-dependent things. | |
840 | ||
4a0d6686 AJ |
841 | COMPONENT_LIST=" |
842 | bsfs | |
843 | decoders | |
844 | demuxers | |
845 | encoders | |
3cde40aa | 846 | filters |
5666fd73 | 847 | hwaccels |
c552605c | 848 | indevs |
4a0d6686 | 849 | muxers |
c552605c | 850 | outdevs |
4a0d6686 AJ |
851 | parsers |
852 | protocols | |
853 | " | |
854 | ||
855 | CONFIG_LIST=" | |
856 | $COMPONENT_LIST | |
e8ed9b7a | 857 | aandct |
5a0f7131 | 858 | avcodec |
aac6ca69 | 859 | avcore |
5a0f7131 | 860 | avdevice |
f7679c54 | 861 | avfilter |
5a0f7131 | 862 | avformat |
c88f5d72 | 863 | avisynth |
f402916e | 864 | bzlib |
7f3f5f46 | 865 | dct |
c73f65d9 | 866 | doc |
05aec7bb | 867 | dwt |
92c6a099 | 868 | dxva2 |
27a9466b | 869 | fastdiv |
c88f5d72 MR |
870 | ffmpeg |
871 | ffplay | |
336ce917 | 872 | ffprobe |
c88f5d72 | 873 | ffserver |
1848f7d9 | 874 | fft |
4f034993 | 875 | golomb |
c88f5d72 | 876 | gpl |
d8d0d0b2 | 877 | gray |
4693b031 | 878 | h264dsp |
4a384de5 | 879 | h264pred |
3abe5fbd | 880 | hardcoded_tables |
3447f12d | 881 | huffman |
f7b8bffe | 882 | libdc1394 |
690bfceb | 883 | libdirac |
2eed5a46 | 884 | libfaac |
c88f5d72 | 885 | libgsm |
6ebe07fb | 886 | libmp3lame |
c88f5d72 | 887 | libnut |
0b175caa DB |
888 | libopencore_amrnb |
889 | libopencore_amrwb | |
9a77d59a | 890 | libopenjpeg |
0f943ce6 | 891 | librtmp |
f7cd9eed | 892 | libschroedinger |
ae14f311 | 893 | libspeex |
150d2772 | 894 | libtheora |
c88f5d72 | 895 | libvorbis |
8299a7f8 | 896 | libvpx |
1cc60c47 | 897 | libx264 |
de295976 | 898 | libxavs |
1cc60c47 | 899 | libxvid |
f4d608e3 | 900 | lpc |
b781cc12 | 901 | lsp |
47a158cb | 902 | mdct |
c88f5d72 | 903 | memalign_hack |
a8150374 | 904 | mlib |
c88f5d72 MR |
905 | mpegaudio_hp |
906 | network | |
3fe142e2 | 907 | nonfree |
8a3c8627 | 908 | pic |
4a24ab64 | 909 | postproc |
68602540 | 910 | rdft |
e90f5b5a | 911 | runtime_cpudetect |
2e35e684 | 912 | shared |
bd2216e4 | 913 | small |
6b35d421 | 914 | sram |
2e35e684 | 915 | static |
5a0f7131 | 916 | swscale |
a9ddb5b1 | 917 | swscale_alpha |
17492d5e DB |
918 | vaapi |
919 | vdpau | |
9cad0e4e | 920 | version3 |
56a059ac | 921 | x11grab |
c88f5d72 | 922 | zlib |
4a0d6686 | 923 | " |
c88f5d72 | 924 | |
8eee7025 | 925 | THREADS_LIST=' |
8eee7025 DB |
926 | pthreads |
927 | w32threads | |
928 | ' | |
929 | ||
3f5b56e5 MR |
930 | ARCH_LIST=' |
931 | alpha | |
a2fc0f6a | 932 | arm |
fdcd782d MR |
933 | avr32 |
934 | avr32_ap | |
935 | avr32_uc | |
3f5b56e5 MR |
936 | bfin |
937 | ia64 | |
938 | m68k | |
939 | mips | |
bae3abb0 | 940 | mips64 |
3f5b56e5 | 941 | parisc |
79cb09b2 | 942 | ppc |
34d11b87 | 943 | ppc64 |
3f5b56e5 MR |
944 | s390 |
945 | sh4 | |
946 | sparc | |
947 | sparc64 | |
0844bae1 | 948 | tomi |
3f5b56e5 MR |
949 | x86 |
950 | x86_32 | |
951 | x86_64 | |
952 | ' | |
953 | ||
954 | ARCH_EXT_LIST=' | |
1ac9331a | 955 | altivec |
3bf96eec | 956 | amd3dnow |
a1ef9f08 | 957 | amd3dnowext |
1ac9331a | 958 | armv5te |
edab3048 | 959 | armv6 |
ab5cb084 | 960 | armv6t2 |
f55b299a | 961 | armvfp |
3f5b56e5 MR |
962 | iwmmxt |
963 | mmi | |
964 | mmx | |
d7f0920b | 965 | mmx2 |
6b18d278 | 966 | neon |
799fde37 | 967 | ppc4xx |
1bb04d5a | 968 | sse |
9eeed841 | 969 | ssse3 |
bd9d34a0 | 970 | vis |
3f5b56e5 MR |
971 | ' |
972 | ||
a3e02a8c MR |
973 | HAVE_LIST_PUB=' |
974 | bigendian | |
d268eee9 | 975 | fast_unaligned |
a3e02a8c MR |
976 | ' |
977 | ||
3f5b56e5 MR |
978 | HAVE_LIST=" |
979 | $ARCH_EXT_LIST | |
a3e02a8c | 980 | $HAVE_LIST_PUB |
3f5b56e5 | 981 | $THREADS_LIST |
35fd8122 | 982 | alsa_asoundlib_h |
3f5b56e5 | 983 | altivec_h |
c9fdab0d | 984 | arpa_inet_h |
dffb41b9 | 985 | attribute_may_alias |
e7ea5e3d | 986 | attribute_packed |
6bd859d6 | 987 | bswap |
ecf97f22 | 988 | closesocket |
1ac9331a | 989 | cmov |
e16e49ac | 990 | conio_h |
c88f5d72 | 991 | dcbzl |
f8aa696f DB |
992 | dev_bktr_ioctl_bt848_h |
993 | dev_bktr_ioctl_meteor_h | |
994 | dev_ic_bt8xx_h | |
995 | dev_video_meteor_ioctl_meteor_h | |
996 | dev_video_bktr_ioctl_bt848_h | |
18b67ae5 | 997 | dlfcn_h |
c88f5d72 | 998 | dlopen |
bc574408 | 999 | dos_paths |
245626d0 DB |
1000 | ebp_available |
1001 | ebx_available | |
6b7c7703 VS |
1002 | exp2 |
1003 | exp2f | |
c2a29455 | 1004 | fast_64bit |
669b5583 | 1005 | fast_clz |
7073e9fc | 1006 | fast_cmov |
534a2231 | 1007 | fcntl |
9d99cc5a | 1008 | fork |
84882df6 | 1009 | getaddrinfo |
da9e86f8 | 1010 | gethrtime |
fc5607f8 | 1011 | GetProcessMemoryInfo |
4e68cb8a | 1012 | GetProcessTimes |
66be5b45 | 1013 | getrusage |
a49d3025 | 1014 | gnu_as |
fc5607f8 | 1015 | struct_rusage_ru_maxrss |
2f0c136e | 1016 | ibm_asm |
2e1913b1 | 1017 | inet_aton |
61d251db | 1018 | inline_asm |
abfc8d05 | 1019 | isatty |
9f5ff83f | 1020 | ldbrx |
0b4a1821 AS |
1021 | libdc1394_1 |
1022 | libdc1394_2 | |
a33cab3a | 1023 | llrint |
07876e25 | 1024 | llrintf |
d96cd429 MR |
1025 | local_aligned_16 |
1026 | local_aligned_8 | |
291fd18a | 1027 | log2 |
6b7c7703 | 1028 | log2f |
85dd97ad | 1029 | loongson |
a33cab3a | 1030 | lrint |
c88f5d72 | 1031 | lrintf |
e4673692 | 1032 | lzo1x_999_compress |
f8aa696f DB |
1033 | machine_ioctl_bt848_h |
1034 | machine_ioctl_meteor_h | |
c88f5d72 MR |
1035 | malloc_h |
1036 | memalign | |
6ffa87d3 | 1037 | mkstemp |
b4e806b2 | 1038 | pld |
1f91cdce | 1039 | posix_memalign |
a33cab3a MK |
1040 | round |
1041 | roundf | |
c88f5d72 MR |
1042 | sdl |
1043 | sdl_video_size | |
b507ebd1 | 1044 | setmode |
72be9e73 | 1045 | socklen_t |
deb29777 | 1046 | soundcard_h |
f8cda19e | 1047 | poll_h |
0104b608 | 1048 | setrlimit |
87958234 | 1049 | strerror_r |
c0018613 | 1050 | struct_addrinfo |
b4d68544 MS |
1051 | struct_ipv6_mreq |
1052 | struct_sockaddr_in6 | |
3b2372bf | 1053 | struct_sockaddr_sa_len |
33a4dbdd | 1054 | struct_sockaddr_storage |
b462d132 MR |
1055 | symver |
1056 | symver_gnu_asm | |
1057 | symver_asm_label | |
b58412f1 | 1058 | sys_mman_h |
b091aa44 | 1059 | sys_resource_h |
81644c2e | 1060 | sys_select_h |
deb29777 | 1061 | sys_soundcard_h |
1b6e8b73 | 1062 | sys_videoio_h |
d3a4b4e0 | 1063 | ten_operands |
e16e49ac | 1064 | termios_h |
b265431e | 1065 | threads |
7b04b8a0 | 1066 | truncf |
ce742de2 | 1067 | vfp_args |
7c5bfe7a | 1068 | VirtualAlloc |
6ff3f3e7 | 1069 | winsock2_h |
cc078b5d | 1070 | xform_asm |
304d586d | 1071 | yasm |
0cb78cef | 1072 | " |
44161118 | 1073 | |
b6bb00b0 MR |
1074 | # options emitted with CONFIG_ prefix but not available on command line |
1075 | CONFIG_EXTRA=" | |
dc4f5a1c | 1076 | avutil |
9cad0e4e DB |
1077 | gplv3 |
1078 | lgplv3 | |
b6bb00b0 MR |
1079 | " |
1080 | ||
520cc7f1 | 1081 | CMDLINE_SELECT=" |
3f5b56e5 | 1082 | $ARCH_EXT_LIST |
520cc7f1 | 1083 | $CONFIG_LIST |
8eee7025 | 1084 | $THREADS_LIST |
c8a4ae00 | 1085 | asm |
db6107b6 | 1086 | cross_compile |
520cc7f1 MR |
1087 | debug |
1088 | extra_warnings | |
8c6afa4d | 1089 | logging |
d2bbb2f7 | 1090 | optimizations |
87a0fb62 | 1091 | stripping |
7595a5e4 | 1092 | yasm |
520cc7f1 | 1093 | " |
426be5dc DB |
1094 | |
1095 | PATHS_LIST=' | |
d156bede | 1096 | bindir |
14a8acf1 | 1097 | datadir |
26759c44 MR |
1098 | incdir |
1099 | libdir | |
26759c44 MR |
1100 | mandir |
1101 | prefix | |
1102 | shlibdir | |
426be5dc DB |
1103 | ' |
1104 | ||
1105 | CMDLINE_SET=" | |
1106 | $PATHS_LIST | |
121d78d0 | 1107 | ar |
426be5dc | 1108 | arch |
313c46a6 | 1109 | as |
426be5dc DB |
1110 | build_suffix |
1111 | cc | |
1112 | cpu | |
1113 | cross_prefix | |
50567afa | 1114 | dep_cc |
ac63af34 | 1115 | extra_version |
9da6609f MR |
1116 | host_cc |
1117 | host_cflags | |
1118 | host_ldflags | |
1119 | host_libs | |
82bb3329 | 1120 | host_os |
684b28e0 | 1121 | ld |
426be5dc | 1122 | logfile |
4ae40685 | 1123 | malloc_prefix |
89641463 | 1124 | nm |
2fad0977 | 1125 | samples |
26759c44 | 1126 | source_path |
4f837398 | 1127 | strip |
c5200f17 MR |
1128 | sysinclude |
1129 | sysroot | |
a7ada2ba | 1130 | target_exec |
26759c44 | 1131 | target_os |
a7ada2ba | 1132 | target_path |
426be5dc | 1133 | " |
520cc7f1 | 1134 | |
89f2932b MR |
1135 | CMDLINE_APPEND=" |
1136 | extra_cflags | |
1137 | " | |
1138 | ||
912f3148 DB |
1139 | # code dependency declarations |
1140 | ||
9eeed841 | 1141 | # architecture extensions |
808fa33c | 1142 | |
a2fc0f6a MR |
1143 | armv5te_deps="arm" |
1144 | armv6_deps="arm" | |
ab5cb084 | 1145 | armv6t2_deps="arm" |
a2fc0f6a MR |
1146 | armvfp_deps="arm" |
1147 | iwmmxt_deps="arm" | |
808fa33c MR |
1148 | neon_deps="arm" |
1149 | ||
e241ba14 | 1150 | mmi_deps="mips" |
808fa33c MR |
1151 | |
1152 | altivec_deps="ppc" | |
1153 | ppc4xx_deps="ppc" | |
1154 | ||
1155 | vis_deps="sparc" | |
1156 | ||
7f8c3d1f | 1157 | x86_64_suggest="cmov fast_cmov" |
808fa33c MR |
1158 | amd3dnow_deps="mmx" |
1159 | amd3dnowext_deps="amd3dnow" | |
9eeed841 | 1160 | mmx_deps="x86" |
75aa95a6 | 1161 | mmx2_deps="mmx" |
75aa95a6 DB |
1162 | sse_deps="mmx" |
1163 | ssse3_deps="sse" | |
9eeed841 | 1164 | |
e939cedd | 1165 | fast_64bit_if_any="alpha ia64 mips64 parisc64 ppc64 sparc64 x86_64" |
669b5583 | 1166 | fast_clz_if_any="alpha armv5te avr32 mips ppc x86" |
e939cedd | 1167 | fast_unaligned_if_any="armv6 ppc x86" |
669b5583 | 1168 | |
89e053f8 | 1169 | need_memalign="altivec neon sse" |
6fec122a | 1170 | inline_asm_deps="!tms470" |
89e053f8 | 1171 | |
b462d132 MR |
1172 | symver_if_any="symver_asm_label symver_gnu_asm" |
1173 | ||
26fbcc85 | 1174 | # subsystems |
dc609252 | 1175 | dct_select="rdft" |
26fbcc85 MR |
1176 | mdct_select="fft" |
1177 | rdft_select="fft" | |
1178 | ||
5666fd73 | 1179 | # decoders / encoders / hardware accelerators |
3cac899a | 1180 | aac_decoder_select="mdct rdft" |
26fbcc85 MR |
1181 | aac_encoder_select="mdct" |
1182 | ac3_decoder_select="mdct ac3_parser" | |
f4d608e3 | 1183 | alac_encoder_select="lpc" |
b781cc12 | 1184 | amrnb_decoder_select="lsp" |
084cbbaa | 1185 | atrac1_decoder_select="mdct" |
26fbcc85 MR |
1186 | atrac3_decoder_select="mdct" |
1187 | binkaudio_dct_decoder_select="mdct rdft dct" | |
1188 | binkaudio_rdft_decoder_select="mdct rdft" | |
4f034993 | 1189 | cavs_decoder_select="golomb" |
26fbcc85 | 1190 | cook_decoder_select="mdct" |
2eef7c62 | 1191 | cscd_decoder_suggest="zlib" |
26fbcc85 | 1192 | dca_decoder_select="mdct" |
e8ed9b7a | 1193 | dnxhd_encoder_select="aandct" |
2eef7c62 | 1194 | dxa_decoder_select="zlib" |
baf91bb9 | 1195 | eac3_decoder_select="ac3_decoder" |
84c04e25 | 1196 | eamad_decoder_select="aandct" |
e8ed9b7a | 1197 | eatgq_decoder_select="aandct" |
d52b39c7 | 1198 | eatqi_decoder_select="aandct" |
4f034993 MR |
1199 | ffv1_decoder_select="golomb" |
1200 | flac_decoder_select="golomb" | |
f4d608e3 | 1201 | flac_encoder_select="golomb lpc" |
2eef7c62 AJ |
1202 | flashsv_decoder_select="zlib" |
1203 | flashsv_encoder_select="zlib" | |
4414137e | 1204 | flv_decoder_select="h263_decoder" |
4d4b4bd1 | 1205 | flv_encoder_select="h263_encoder" |
3447f12d | 1206 | fraps_decoder_select="huffman" |
e8ed9b7a | 1207 | h261_encoder_select="aandct" |
7f647ae0 | 1208 | h263_decoder_select="h263_parser" |
e8ed9b7a | 1209 | h263_encoder_select="aandct" |
95a61cfc | 1210 | h263_vaapi_hwaccel_select="vaapi h263_decoder" |
4414137e | 1211 | h263i_decoder_select="h263_decoder" |
fe629c2d | 1212 | h263p_encoder_select="h263_encoder" |
4a384de5 | 1213 | h264_decoder_select="golomb h264dsp h264pred" |
92c6a099 LA |
1214 | h264_dxva2_hwaccel_deps="dxva2api_h" |
1215 | h264_dxva2_hwaccel_select="dxva2 h264_decoder" | |
17492d5e | 1216 | h264_vaapi_hwaccel_select="vaapi" |
95a61cfc | 1217 | h264_vdpau_decoder_select="vdpau h264_decoder" |
47a158cb | 1218 | imc_decoder_select="fft mdct" |
4f034993 MR |
1219 | jpegls_decoder_select="golomb" |
1220 | jpegls_encoder_select="golomb" | |
e8ed9b7a | 1221 | ljpeg_encoder_select="aandct" |
4f034993 | 1222 | loco_decoder_select="golomb" |
e8ed9b7a | 1223 | mjpeg_encoder_select="aandct" |
2cca233b | 1224 | mlp_decoder_select="mlp_parser" |
d9da8f10 AJ |
1225 | mp1float_decoder_select="dct" |
1226 | mp2float_decoder_select="dct" | |
1227 | mp3adufloat_decoder_select="dct" | |
1228 | mp3float_decoder_select="dct" | |
1229 | mp3on4float_decoder_select="dct" | |
e8ed9b7a DB |
1230 | mpeg1video_encoder_select="aandct" |
1231 | mpeg2video_encoder_select="aandct" | |
4414137e | 1232 | mpeg4_decoder_select="h263_decoder mpeg4video_parser" |
c37de5e1 | 1233 | mpeg4_encoder_select="h263_encoder" |
95a61cfc | 1234 | mpeg_vdpau_decoder_select="vdpau mpegvideo_decoder" |
95a61cfc | 1235 | mpeg1_vdpau_decoder_select="vdpau mpeg1video_decoder" |
164aab02 LA |
1236 | mpeg2_dxva2_hwaccel_deps="dxva2api_h" |
1237 | mpeg2_dxva2_hwaccel_select="dxva2 mpeg2video_decoder" | |
95a61cfc | 1238 | mpeg2_vaapi_hwaccel_select="vaapi mpeg2video_decoder" |
95a61cfc | 1239 | mpeg4_vaapi_hwaccel_select="vaapi mpeg4_decoder" |
70e0c871 | 1240 | mpeg4_vdpau_decoder_select="vdpau mpeg4_decoder" |
8f6f050a | 1241 | mpeg_xvmc_decoder_deps="X11_extensions_XvMClib_h" |
4d8eecf4 | 1242 | mpeg_xvmc_decoder_select="mpegvideo_decoder" |
4414137e | 1243 | msmpeg4v1_decoder_select="h263_decoder" |
4e169d89 | 1244 | msmpeg4v1_encoder_select="h263_encoder" |
4414137e | 1245 | msmpeg4v2_decoder_select="h263_decoder" |
4e169d89 | 1246 | msmpeg4v2_encoder_select="h263_encoder" |
4414137e | 1247 | msmpeg4v3_decoder_select="h263_decoder" |
4e169d89 | 1248 | msmpeg4v3_encoder_select="h263_encoder" |
26fbcc85 MR |
1249 | nellymoser_decoder_select="mdct" |
1250 | nellymoser_encoder_select="mdct" | |
2eef7c62 AJ |
1251 | png_decoder_select="zlib" |
1252 | png_encoder_select="zlib" | |
b781cc12 | 1253 | qcelp_decoder_select="lsp" |
26fbcc85 | 1254 | qdm2_decoder_select="mdct rdft" |
31ed3f1f | 1255 | ra_144_encoder_select="lpc" |
a8beb22f | 1256 | rv10_decoder_select="h263_decoder" |
b2bf38b4 | 1257 | rv10_encoder_select="h263_encoder" |
a8beb22f | 1258 | rv20_decoder_select="h263_decoder" |
b2bf38b4 | 1259 | rv20_encoder_select="h263_encoder" |
4a384de5 JGG |
1260 | rv30_decoder_select="golomb h264pred" |
1261 | rv40_decoder_select="golomb h264pred" | |
4f034993 | 1262 | shorten_decoder_select="golomb" |
b781cc12 | 1263 | sipr_decoder_select="lsp" |
05aec7bb MR |
1264 | snow_decoder_select="dwt" |
1265 | snow_encoder_select="aandct dwt" | |
4f034993 MR |
1266 | sonic_decoder_select="golomb" |
1267 | sonic_encoder_select="golomb" | |
1268 | sonic_ls_encoder_select="golomb" | |
19ecfb8a | 1269 | svq1_encoder_select="aandct" |
4a384de5 | 1270 | svq3_decoder_select="golomb h264dsp h264pred" |
bee2eac5 | 1271 | svq3_decoder_suggest="zlib" |
4eef77c1 | 1272 | theora_decoder_select="vp3_decoder" |
2eef7c62 AJ |
1273 | tiff_decoder_suggest="zlib" |
1274 | tiff_encoder_suggest="zlib" | |
aec09a00 | 1275 | truehd_decoder_select="mlp_decoder" |
2eef7c62 | 1276 | tscc_decoder_select="zlib" |
b781cc12 | 1277 | twinvq_decoder_select="mdct lsp" |
f95bfab0 | 1278 | vc1_decoder_select="h263_decoder" |
9104cd51 | 1279 | vc1_dxva2_hwaccel_deps="dxva2api_h DXVA_PictureParameters_wDecodedPictureIndex" |
f0f86627 | 1280 | vc1_dxva2_hwaccel_select="dxva2 vc1_decoder" |
95a61cfc | 1281 | vc1_vaapi_hwaccel_select="vaapi vc1_decoder" |
95a61cfc | 1282 | vc1_vdpau_decoder_select="vdpau vc1_decoder" |
26fbcc85 MR |
1283 | vorbis_decoder_select="mdct" |
1284 | vorbis_encoder_select="mdct" | |
3447f12d | 1285 | vp6_decoder_select="huffman" |
e82dc4c9 DB |
1286 | vp6a_decoder_select="vp6_decoder" |
1287 | vp6f_decoder_select="vp6_decoder" | |
4a384de5 | 1288 | vp8_decoder_select="h264pred" |
084cbbaa | 1289 | wmapro_decoder_select="mdct" |
26fbcc85 MR |
1290 | wmav1_decoder_select="mdct" |
1291 | wmav1_encoder_select="mdct" | |
1292 | wmav2_decoder_select="mdct" | |
1293 | wmav2_encoder_select="mdct" | |
df0a6d0d | 1294 | wmavoice_decoder_select="lsp rdft dct mdct" |
f95bfab0 | 1295 | wmv1_decoder_select="h263_decoder" |
665507aa | 1296 | wmv1_encoder_select="h263_encoder" |
f95bfab0 | 1297 | wmv2_decoder_select="h263_decoder" |
1746e2a9 | 1298 | wmv2_encoder_select="h263_encoder" |
015f8ee0 | 1299 | wmv3_decoder_select="vc1_decoder" |
f0f86627 | 1300 | wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel" |
015f8ee0 DB |
1301 | wmv3_vaapi_hwaccel_select="vc1_vaapi_hwaccel" |
1302 | wmv3_vdpau_decoder_select="vc1_vdpau_decoder" | |
2eef7c62 AJ |
1303 | zlib_decoder_select="zlib" |
1304 | zlib_encoder_select="zlib" | |
1305 | zmbv_decoder_select="zlib" | |
1306 | zmbv_encoder_select="zlib" | |
30fd06be | 1307 | |
0afab17e | 1308 | vaapi_deps="va_va_h" |
c89c96e9 MR |
1309 | vdpau_deps="vdpau_vdpau_h vdpau_vdpau_x11_h" |
1310 | ||
28b80940 | 1311 | # parsers |
4a384de5 | 1312 | h264_parser_select="golomb h264dsp h264pred" |
28b80940 | 1313 | |
912f3148 | 1314 | # external libraries |
1b71f045 | 1315 | libdirac_decoder_deps="libdirac !libschroedinger" |
690bfceb | 1316 | libdirac_encoder_deps="libdirac" |
c9171a83 | 1317 | libfaac_encoder_deps="libfaac" |
299c77d5 MR |
1318 | libgsm_decoder_deps="libgsm" |
1319 | libgsm_encoder_deps="libgsm" | |
8ffed8d8 MR |
1320 | libgsm_ms_decoder_deps="libgsm" |
1321 | libgsm_ms_encoder_deps="libgsm" | |
1cc60c47 | 1322 | libmp3lame_encoder_deps="libmp3lame" |
0b175caa DB |
1323 | libopencore_amrnb_decoder_deps="libopencore_amrnb" |
1324 | libopencore_amrnb_encoder_deps="libopencore_amrnb" | |
1325 | libopencore_amrwb_decoder_deps="libopencore_amrwb" | |
9a77d59a | 1326 | libopenjpeg_decoder_deps="libopenjpeg" |
f7cd9eed AS |
1327 | libschroedinger_decoder_deps="libschroedinger" |
1328 | libschroedinger_encoder_deps="libschroedinger" | |
ae14f311 | 1329 | libspeex_decoder_deps="libspeex" |
150d2772 | 1330 | libtheora_encoder_deps="libtheora" |
b0caf888 | 1331 | libvorbis_encoder_deps="libvorbis" |
8299a7f8 | 1332 | libvpx_decoder_deps="libvpx" |
ee0e9146 | 1333 | libvpx_encoder_deps="libvpx" |
1cc60c47 | 1334 | libx264_encoder_deps="libx264" |
de295976 | 1335 | libxavs_encoder_deps="libxavs" |
1cc60c47 | 1336 | libxvid_encoder_deps="libxvid" |
30fd06be | 1337 | |
912f3148 | 1338 | # demuxers / muxers |
03a76ba9 | 1339 | ac3_demuxer_deps="ac3_parser" |
647c2356 | 1340 | asf_stream_muxer_select="asf_muxer" |
4e622dea SS |
1341 | avisynth_demuxer_deps="avisynth" |
1342 | dirac_demuxer_deps="dirac_parser" | |
5b423887 | 1343 | eac3_demuxer_select="ac3_parser" |
647c2356 | 1344 | ipod_muxer_select="mov_muxer" |
4e622dea SS |
1345 | libnut_demuxer_deps="libnut" |
1346 | libnut_muxer_deps="libnut" | |
647c2356 | 1347 | matroska_audio_muxer_select="matroska_muxer" |
4e622dea SS |
1348 | matroska_demuxer_suggest="zlib bzlib" |
1349 | mov_demuxer_suggest="zlib" | |
1350 | mp3_demuxer_deps="mpegaudio_parser" | |
647c2356 DB |
1351 | mp4_muxer_select="mov_muxer" |
1352 | mpegtsraw_demuxer_select="mpegts_demuxer" | |
1353 | mxf_d10_muxer_select="mxf_muxer" | |
24ca518b | 1354 | ogg_demuxer_select="golomb" |
647c2356 | 1355 | psp_muxer_select="mov_muxer" |
4e622dea | 1356 | rtsp_demuxer_deps="sdp_demuxer" |
6f5a3d0a MS |
1357 | rtsp_muxer_deps="sdp_demuxer" |
1358 | rtsp_muxer_select="rtp_muxer" | |
4e622dea | 1359 | sdp_demuxer_deps="rtp_protocol mpegts_demuxer" |
0298cc04 | 1360 | sdp_demuxer_select="asf_demuxer rm_demuxer" |
f1e94694 | 1361 | spdif_muxer_select="aac_parser" |
647c2356 DB |
1362 | tg2_muxer_select="mov_muxer" |
1363 | tgp_muxer_select="mov_muxer" | |
6bdaa5f4 | 1364 | w64_demuxer_deps="wav_demuxer" |
4e622dea SS |
1365 | |
1366 | # indevs / outdevs | |
38e54a75 | 1367 | alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp" |
38e54a75 | 1368 | alsa_outdev_deps="alsa_asoundlib_h" |
38e54a75 | 1369 | bktr_indev_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h" |
38e54a75 SS |
1370 | dv1394_indev_deps="dv1394 dv_demuxer" |
1371 | jack_indev_deps="jack_jack_h" | |
38e54a75 | 1372 | libdc1394_indev_deps="libdc1394" |
38e54a75 SS |
1373 | oss_indev_deps_any="soundcard_h sys_soundcard_h" |
1374 | oss_outdev_deps_any="soundcard_h sys_soundcard_h" | |
38e54a75 SS |
1375 | v4l_indev_deps="linux_videodev_h" |
1376 | v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h" | |
ec1ee802 | 1377 | vfwcap_indev_deps="capCreateCaptureWindow vfwcap_defines" |
a1b3c5a3 | 1378 | vfwcap_indev_extralibs="-lavicap32" |
38e54a75 | 1379 | x11_grab_device_indev_deps="x11grab XShmCreateImage" |
781c1aa6 | 1380 | x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes" |
30fd06be | 1381 | |
912f3148 | 1382 | # protocols |
3fff6382 | 1383 | gopher_protocol_deps="network" |
c08fb000 | 1384 | http_protocol_deps="network" |
279a0c97 | 1385 | http_protocol_select="tcp_protocol" |
c60a2d70 | 1386 | mmsh_protocol_select="http_protocol" |
b4cf3f6c | 1387 | mmst_protocol_deps="network" |
deeb7012 MS |
1388 | rtmp_protocol_select="tcp_protocol" |
1389 | rtp_protocol_select="udp_protocol" | |
c08fb000 AB |
1390 | tcp_protocol_deps="network" |
1391 | udp_protocol_deps="network" | |
1392 | ||
5a0f7131 MR |
1393 | # libraries |
1394 | avdevice_deps="avcodec avformat" | |
1395 | avformat_deps="avcodec" | |
f7679c54 | 1396 | |
912f3148 | 1397 | # programs |
5a0f7131 | 1398 | ffmpeg_deps="avcodec avformat swscale" |
21ae6790 | 1399 | ffmpeg_select="buffer_filter" |
5a0f7131 | 1400 | ffplay_deps="avcodec avformat swscale sdl" |
43689902 | 1401 | ffplay_select="rdft" |
336ce917 | 1402 | ffprobe_deps="avcodec avformat" |
5a0f7131 | 1403 | ffserver_deps="avformat ffm_muxer rtp_protocol rtsp_demuxer" |
4ec45764 | 1404 | ffserver_extralibs='$ldl' |
a2830dca | 1405 | |
c73f65d9 | 1406 | doc_deps="texi2html" |
912f3148 | 1407 | |
57442411 MR |
1408 | # tests |
1409 | ||
1410 | test_deps(){ | |
1411 | suf1=$1 | |
1412 | suf2=$2 | |
1413 | shift 2 | |
1414 | for v; do | |
1415 | dep=${v%=*} | |
1416 | tests=${v#*=} | |
1417 | for name in ${tests}; do | |
1418 | eval ${name}_test_deps="'${dep}$suf1 ${dep}$suf2'" | |
1419 | done | |
1420 | done | |
1421 | } | |
1422 | ||
9c261f83 SS |
1423 | set_ne_test_deps(){ |
1424 | eval ${1}_be_test_deps="bigendian" | |
1425 | eval ${1}_le_test_deps="!bigendian" | |
1426 | } | |
1427 | ||
57442411 MR |
1428 | test_deps _encoder _decoder \ |
1429 | ac3 \ | |
1430 | adpcm_g726=g726 \ | |
1431 | adpcm_ima_qt \ | |
1432 | adpcm_ima_wav \ | |
1433 | adpcm_ms \ | |
1434 | adpcm_swf \ | |
1435 | adpcm_yamaha=adpcm_yam \ | |
1436 | alac \ | |
1437 | asv1 \ | |
1438 | asv2 \ | |
1439 | bmp \ | |
a7638957 | 1440 | dnxhd="dnxhd_1080i dnxhd_720p dnxhd_720p_rd" \ |
57442411 MR |
1441 | dvvideo="dv dv50" \ |
1442 | ffv1 \ | |
1443 | flac \ | |
1444 | flashsv \ | |
1445 | flv \ | |
1446 | gif \ | |
1447 | h261 \ | |
1448 | h263="h263 h263p" \ | |
1449 | huffyuv \ | |
1450 | jpegls \ | |
1451 | mjpeg="jpg mjpeg ljpeg" \ | |
1452 | mp2 \ | |
1453 | mpeg1video="mpeg mpeg1b" \ | |
1454 | mpeg2video="mpeg2 mpeg2thread" \ | |
1455 | mpeg4="mpeg4 mpeg4adv mpeg4nr mpeg4thread error rc" \ | |
c0b16605 | 1456 | msmpeg4v3=msmpeg4 \ |
57442411 MR |
1457 | msmpeg4v2 \ |
1458 | pbm=pbmpipe \ | |
1459 | pcx \ | |
1460 | pgm="pgm pgmpipe" \ | |
1461 | ppm="ppm ppmpipe" \ | |
1462 | rawvideo="rgb yuv" \ | |
1463 | roq \ | |
1464 | rv10 \ | |
1465 | rv20 \ | |
1466 | sgi \ | |
1467 | snow="snow snowll" \ | |
1468 | svq1 \ | |
1469 | targa=tga \ | |
1470 | tiff \ | |
1471 | wmav1 \ | |
1472 | wmav2 \ | |
1473 | wmv1 \ | |
1474 | wmv2 \ | |
1475 | ||
1476 | test_deps _muxer _demuxer \ | |
1477 | aiff \ | |
1478 | pcm_alaw=alaw \ | |
1479 | asf \ | |
1480 | au \ | |
1481 | avi \ | |
1482 | dv=dv_fmt \ | |
1483 | ffm \ | |
1484 | flv=flv_fmt \ | |
1485 | gxf \ | |
1486 | matroska=mkv \ | |
1487 | mmf \ | |
1488 | mov \ | |
1489 | pcm_mulaw=mulaw \ | |
1490 | mxf \ | |
1491 | nut \ | |
1492 | ogg \ | |
1493 | rawvideo=pixfmt \ | |
1494 | rm \ | |
1495 | swf \ | |
1496 | mpegts=ts \ | |
1497 | voc \ | |
1498 | wav \ | |
1499 | yuv4mpegpipe=yuv4mpeg \ | |
1500 | ||
1501 | mpg_test_deps="mpeg1system_muxer mpegps_demuxer" | |
9c261f83 SS |
1502 | |
1503 | set_ne_test_deps pixdesc | |
213a4cbb | 1504 | set_ne_test_deps pixfmts_crop |
a1e171df | 1505 | set_ne_test_deps pixfmts_hflip |
213a4cbb SS |
1506 | set_ne_test_deps pixfmts_null |
1507 | set_ne_test_deps pixfmts_pad | |
1508 | set_ne_test_deps pixfmts_scale | |
1509 | set_ne_test_deps pixfmts_vflip | |
57442411 | 1510 | |
de6d9b64 | 1511 | # default parameters |
8a608357 | 1512 | |
19bd477d | 1513 | logfile="config.log" |
8a608357 MR |
1514 | |
1515 | # installation paths | |
c9d19248 MR |
1516 | prefix_default="/usr/local" |
1517 | bindir_default='${prefix}/bin' | |
14a8acf1 | 1518 | datadir_default='${prefix}/share/ffmpeg' |
c9d19248 MR |
1519 | incdir_default='${prefix}/include' |
1520 | libdir_default='${prefix}/lib' | |
1521 | mandir_default='${prefix}/share/man' | |
1522 | shlibdir_default="$libdir_default" | |
8a608357 MR |
1523 | |
1524 | # toolchain | |
121d78d0 | 1525 | ar_default="ar" |
13c7df3d | 1526 | cc_default="gcc" |
a3d7c197 | 1527 | cc_version=\"unknown\" |
9da6609f | 1528 | host_cc_default="gcc" |
11e6d03a | 1529 | ln_s="ln -sf" |
89641463 | 1530 | nm_default="nm" |
11e6d03a | 1531 | objformat="elf" |
be7109c1 | 1532 | ranlib="ranlib" |
4f837398 | 1533 | strip_default="strip" |
11e6d03a | 1534 | yasmexe="yasm" |
301ab19d | 1535 | nogas=":" |
8a608357 | 1536 | |
8182dc34 MR |
1537 | nm_opts='-g' |
1538 | ||
8a608357 | 1539 | # machine |
8d4c00ed | 1540 | arch_default=$(uname -m) |
38d0a8aa | 1541 | cpu="generic" |
8a608357 | 1542 | |
8a608357 | 1543 | # OS |
8d4c00ed MR |
1544 | target_os_default=$(tolower $(uname -s)) |
1545 | host_os=$target_os_default | |
8a608357 | 1546 | |
8a608357 | 1547 | # configurable options |
5a0f7131 | 1548 | enable avcodec |
aac6ca69 | 1549 | enable avcore |
5a0f7131 | 1550 | enable avdevice |
cccc039f | 1551 | enable avfilter |
5a0f7131 | 1552 | enable avformat |
dc4f5a1c | 1553 | enable avutil |
c8a4ae00 | 1554 | enable asm |
497237c7 | 1555 | enable debug |
c73f65d9 | 1556 | enable doc |
aa033b1e | 1557 | enable fastdiv |
497237c7 RP |
1558 | enable ffmpeg |
1559 | enable ffplay | |
336ce917 | 1560 | enable ffprobe |
497237c7 | 1561 | enable ffserver |
497237c7 RP |
1562 | enable mpegaudio_hp |
1563 | enable network | |
8400d6b8 | 1564 | enable optimizations |
497237c7 | 1565 | enable protocols |
530dc538 | 1566 | enable static |
87a0fb62 | 1567 | enable stripping |
5a0f7131 | 1568 | enable swscale |
a9ddb5b1 | 1569 | enable swscale_alpha |
8a608357 | 1570 | |
8a608357 | 1571 | # build settings |
9987769a | 1572 | SHFLAGS='-shared -Wl,-soname,$$(@F)' |
c536cb09 | 1573 | FFSERVERLDFLAGS=-Wl,-E |
f3ec2d46 SG |
1574 | LIBPREF="lib" |
1575 | LIBSUF=".a" | |
c5f14466 RP |
1576 | FULLNAME='$(NAME)$(BUILDSUF)' |
1577 | LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)' | |
f3ec2d46 SG |
1578 | SLIBPREF="lib" |
1579 | SLIBSUF=".so" | |
c5f14466 | 1580 | SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)' |
b29bddab DB |
1581 | SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)' |
1582 | SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)' | |
6cfac0e9 | 1583 | LIB_INSTALL_EXTRA_CMD='$$(RANLIB) "$(LIBDIR)/$(LIBNAME)"' |
ef0bc4c9 | 1584 | |
7e6c86e6 MR |
1585 | CC_O='-o $@' |
1586 | ||
f0125de9 | 1587 | host_cflags='-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -O3 -g -Wall' |
9da6609f MR |
1588 | host_libs='-lm' |
1589 | ||
9b861379 | 1590 | target_path='$(CURDIR)' |
a7ada2ba | 1591 | |
a158446b MR |
1592 | # since the object filename is not given with the -MM flag, the compiler |
1593 | # is only able to print the basename, and we must add the path ourselves | |
c1c3933a | 1594 | DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)' |
d8059267 | 1595 | DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM' |
315c741d | 1596 | |
c597172e | 1597 | # find source path |
5e622c40 | 1598 | source_path="$(dirname "$0")" |
497237c7 | 1599 | enable source_path_used |
24524f36 | 1600 | if test -f configure; then |
5e622c40 | 1601 | source_path="$(pwd)" |
497237c7 | 1602 | disable source_path_used |
c597172e | 1603 | else |
5e622c40 | 1604 | source_path="$(cd "$source_path"; pwd)" |
c597172e | 1605 | echo "$source_path" | grep -q '[[:blank:]]' && |
7483e694 | 1606 | die "Out of tree builds are impossible with whitespace in source path." |
337cee68 MC |
1607 | test -e "$source_path/config.h" && |
1608 | die "Out of tree builds are impossible with config.h in source dir." | |
c597172e MR |
1609 | fi |
1610 | ||
13cbe2c0 | 1611 | for v in "$@"; do |
b04251c5 MR |
1612 | r=${v#*=} |
1613 | l=${v%"$r"} | |
1614 | r=$(sh_quote "$r") | |
13cbe2c0 MR |
1615 | FFMPEG_CONFIGURATION="${FFMPEG_CONFIGURATION# } ${l}${r}" |
1616 | done | |
c597172e | 1617 | |
73ef8980 MR |
1618 | find_things(){ |
1619 | thing=$1 | |
1620 | pattern=$2 | |
1621 | file=$source_path/$3 | |
932ccf39 | 1622 | sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file" |
73ef8980 MR |
1623 | } |
1624 | ||
1625 | ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c) | |
1626 | DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c) | |
5666fd73 | 1627 | HWACCEL_LIST=$(find_things hwaccel HWACCEL libavcodec/allcodecs.c) |
73ef8980 MR |
1628 | PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c) |
1629 | BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c) | |
1630 | MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c) | |
1631 | DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c) | |
38e54a75 SS |
1632 | OUTDEV_LIST=$(find_things outdev OUTDEV libavdevice/alldevices.c) |
1633 | INDEV_LIST=$(find_things indev _IN libavdevice/alldevices.c) | |
73ef8980 | 1634 | PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c) |
81124ba0 | 1635 | FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c) |
c597172e | 1636 | |
57442411 | 1637 | find_tests(){ |
b9d5f1b7 | 1638 | map "echo ${2}\${v}_test" $(ls "$source_path"/tests/ref/$1 | grep -v '[^-a-z0-9_]') |
57442411 MR |
1639 | } |
1640 | ||
1641 | ACODEC_TESTS=$(find_tests acodec) | |
1642 | VCODEC_TESTS=$(find_tests vsynth1) | |
1643 | LAVF_TESTS=$(find_tests lavf) | |
48c28162 | 1644 | LAVFI_TESTS=$(find_tests lavfi) |
b9d5f1b7 | 1645 | SEEK_TESTS=$(find_tests seek seek_) |
57442411 | 1646 | |
40fe5019 MR |
1647 | pcm_test_deps=$(map 'echo ${v%_*}_decoder $v' $(filter pcm_* $ENCODER_LIST)) |
1648 | ||
8469ae22 MR |
1649 | for n in $COMPONENT_LIST; do |
1650 | v=$(toupper ${n%s})_LIST | |
1651 | eval enable \$$v | |
1652 | eval ${n}_if_any="\$$v" | |
1653 | done | |
1654 | ||
b9d5f1b7 | 1655 | enable $ARCH_EXT_LIST $ACODEC_TESTS $VCODEC_TESTS $LAVF_TESTS $LAVFI_TESTS $SEEK_TESTS |
c597172e MR |
1656 | |
1657 | die_unknown(){ | |
1658 | echo "Unknown option \"$1\"." | |
1659 | echo "See $0 --help for available options." | |
1660 | exit 1 | |
1661 | } | |
1662 | ||
794f8e97 | 1663 | show_list() { |
bf0c4afa RP |
1664 | suffix=_$1 |
1665 | shift | |
2b444ea7 | 1666 | echo $* | sed s/$suffix//g | tr ' ' '\n' | sort | pr -3 -t |
794f8e97 PI |
1667 | exit 0 |
1668 | } | |
1669 | ||
c597172e | 1670 | for opt do |
7483e694 DB |
1671 | optval="${opt#*=}" |
1672 | case "$opt" in | |
0f010b2f | 1673 | --extra-ldflags=*) add_ldflags $optval |
7483e694 | 1674 | ;; |
0f010b2f | 1675 | --extra-libs=*) add_extralibs $optval |
7483e694 | 1676 | ;; |
8fb1cb58 | 1677 | --disable-devices) disable $INDEV_LIST $OUTDEV_LIST |
9aa8ed9d | 1678 | ;; |
40bcf4c7 BL |
1679 | --enable-debug=*) debuglevel="$optval" |
1680 | ;; | |
36e2dea0 | 1681 | --disable-everything) |
1b15dc3c | 1682 | map 'eval unset \${$(toupper ${v%s})_LIST}' $COMPONENT_LIST |
36e2dea0 | 1683 | ;; |
7483e694 | 1684 | --enable-*=*|--disable-*=*) |
8b93ddc3 | 1685 | eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/') |
be8f2501 MR |
1686 | is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt" |
1687 | eval list=\$$(toupper $thing)_LIST | |
8b93ddc3 MR |
1688 | name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing} |
1689 | $action $(filter "$name" $list) | |
7483e694 DB |
1690 | ;; |
1691 | --enable-?*|--disable-?*) | |
5e622c40 | 1692 | eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g') |
e3773a55 | 1693 | if is_in $option $COMPONENT_LIST; then |
fed5d54b | 1694 | test $action = disable && action=unset |
e3773a55 MR |
1695 | eval $action \$$(toupper ${option%s})_LIST |
1696 | elif is_in $option $CMDLINE_SELECT; then | |
1697 | $action $option | |
1698 | else | |
1699 | die_unknown $opt | |
1700 | fi | |
7483e694 DB |
1701 | ;; |
1702 | --list-*) | |
1703 | NAME="${opt#--list-}" | |
1704 | is_in $NAME $COMPONENT_LIST || die_unknown $opt | |
1705 | NAME=${NAME%s} | |
1706 | eval show_list $NAME \$$(toupper $NAME)_LIST | |
1707 | ;; | |
1708 | --help|-h) show_help | |
1709 | ;; | |
1710 | *) | |
884a36a7 | 1711 | optname="${opt%%=*}" |
26759c44 MR |
1712 | optname="${optname#--}" |
1713 | optname=$(echo "$optname" | sed 's/-/_/g') | |
89f2932b MR |
1714 | if is_in $optname $CMDLINE_SET; then |
1715 | eval $optname='$optval' | |
1716 | elif is_in $optname $CMDLINE_APPEND; then | |
1717 | append $optname "$optval" | |
1718 | else | |
1719 | die_unknown $opt | |
1720 | fi | |
7483e694 DB |
1721 | ;; |
1722 | esac | |
c597172e MR |
1723 | done |
1724 | ||
bcea99bb MR |
1725 | disabled logging && logfile=/dev/null |
1726 | ||
13cbe2c0 | 1727 | echo "# $0 $FFMPEG_CONFIGURATION" > $logfile |
bcea99bb MR |
1728 | set >> $logfile |
1729 | ||
9da6609f MR |
1730 | test -n "$cross_prefix" && enable cross_compile |
1731 | ||
8d4c00ed MR |
1732 | if enabled cross_compile; then |
1733 | test -n "$arch" && test -n "$target_os" || | |
1734 | die "Must specify target arch and OS when cross-compiling" | |
1735 | fi | |
1736 | ||
1737 | set_default arch target_os | |
1738 | ||
121d78d0 | 1739 | ar_default="${cross_prefix}${ar_default}" |
11e6d03a | 1740 | cc_default="${cross_prefix}${cc_default}" |
20e0ed95 | 1741 | nm_default="${cross_prefix}${nm_default}" |
adb2b908 | 1742 | ranlib="${cross_prefix}${ranlib}" |
4f837398 | 1743 | strip_default="${cross_prefix}${strip_default}" |
adb2b908 | 1744 | |
c5200f17 MR |
1745 | sysinclude_default="${sysroot}/usr/include" |
1746 | ||
4f837398 | 1747 | set_default cc nm strip sysinclude |
9da6609f MR |
1748 | enabled cross_compile || host_cc_default=$cc |
1749 | set_default host_cc | |
13c7df3d | 1750 | |
82bb3329 MR |
1751 | exesuf() { |
1752 | case $1 in | |
1753 | mingw32*|cygwin*|*-dos|freedos|opendos|os/2*) echo .exe ;; | |
1754 | esac | |
1755 | } | |
1756 | ||
1757 | EXESUF=$(exesuf $target_os) | |
1758 | HOSTEXESUF=$(exesuf $host_os) | |
c0f5b7f1 | 1759 | |
e4e69e0b | 1760 | # set temporary file name |
a49d42c2 | 1761 | : ${TMPDIR:=$TEMPDIR} |
c51fafa1 | 1762 | : ${TMPDIR:=$TMP} |
a49d42c2 | 1763 | : ${TMPDIR:=/tmp} |
e4e69e0b | 1764 | |
54460a83 MR |
1765 | if ! check_cmd type mktemp; then |
1766 | # simple replacement for missing mktemp | |
1767 | # NOT SAFE FOR GENERAL USE | |
1768 | mktemp(){ | |
1769 | echo "${2%XXX*}.${HOSTNAME}.${UID}.$$" | |
1770 | } | |
1771 | fi | |
1772 | ||
1773 | tmpfile(){ | |
1774 | tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 && | |
1775 | (set -C; exec > $tmp) 2>/dev/null || | |
f7ba16a7 | 1776 | die "Unable to create temporary file in $TMPDIR." |
54460a83 MR |
1777 | append TMPFILES $tmp |
1778 | eval $1=$tmp | |
1779 | } | |
1780 | ||
1781 | trap 'rm -f -- $TMPFILES' EXIT | |
1782 | trap exit HUP INT TERM | |
1783 | ||
1784 | tmpfile TMPC .c | |
1785 | tmpfile TMPE $EXESUF | |
1786 | tmpfile TMPH .h | |
1787 | tmpfile TMPO .o | |
1788 | tmpfile TMPS .S | |
a482e61b | 1789 | tmpfile TMPV .ver |
54460a83 | 1790 | tmpfile TMPSH .sh |
55127e7b | 1791 | tmpfile TMPASM .asm |
54460a83 MR |
1792 | |
1793 | unset -f mktemp | |
e4e69e0b | 1794 | |
993f2d0f MR |
1795 | # make sure we can execute files in $TMPDIR |
1796 | cat > $TMPSH 2>> $logfile <<EOF | |
1797 | #! /bin/sh | |
1798 | EOF | |
1799 | chmod +x $TMPSH >> $logfile 2>&1 | |
1800 | if ! $TMPSH >> $logfile 2>&1; then | |
1801 | cat <<EOF | |
1802 | Unable to create and execute files in $TMPDIR. Set the TMPDIR environment | |
1803 | variable to another directory and make sure that it is not mounted noexec. | |
1804 | EOF | |
1805 | die "Sanity test failed." | |
1806 | fi | |
993f2d0f | 1807 | |
19b4c628 MR |
1808 | filter_cflags=echo |
1809 | filter_cppflags=echo | |
1810 | filter_asflags=echo | |
1811 | ||
613a4e3f MR |
1812 | if $cc -v 2>&1 | grep -q '^gcc.*LLVM'; then |
1813 | cc_type=llvm_gcc | |
1814 | cc_version=__VERSION__ | |
1815 | gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)') | |
1816 | cc_ident="llvm-gcc $($cc -dumpversion) $gcc_extra_ver" | |
1817 | CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' | |
1818 | AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' | |
1819 | speed_cflags='-O3' | |
1820 | size_cflags='-Os' | |
1821 | elif $cc -v 2>&1 | grep -qi ^gcc; then | |
629687f6 | 1822 | cc_type=gcc |
a3d7c197 | 1823 | cc_version=__VERSION__ |
bb5cecdc MR |
1824 | gcc_extra_ver=$(expr "$($cc --version | head -n1)" : '.*\((.*)\)') |
1825 | cc_ident="gcc $($cc -dumpversion) $gcc_extra_ver" | |
aef6bd1b MR |
1826 | if ! $cc -dumpversion | grep -q '^2\.'; then |
1827 | CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' | |
1828 | AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' | |
1829 | fi | |
14ca9cd0 MR |
1830 | speed_cflags='-O3' |
1831 | size_cflags='-Os' | |
629687f6 MR |
1832 | elif $cc --version 2>/dev/null | grep -q Intel; then |
1833 | cc_type=icc | |
6e3fa35d | 1834 | cc_version="AV_STRINGIFY(__INTEL_COMPILER)" |
bb5cecdc | 1835 | cc_ident=$($cc --version | head -n1) |
07dec06e MR |
1836 | CC_DEPFLAGS='-MMD' |
1837 | AS_DEPFLAGS='-MMD' | |
14ca9cd0 MR |
1838 | speed_cflags='-O3' |
1839 | size_cflags='-Os' | |
b05394a0 | 1840 | noopt_cflags='-O1' |
629687f6 MR |
1841 | elif $cc -v 2>&1 | grep -q xlc; then |
1842 | cc_type=xlc | |
6e3fa35d | 1843 | cc_version="AV_STRINGIFY(__IBMC__)" |
bb5cecdc | 1844 | cc_ident=$($cc -qversion 2>/dev/null | head -n1) |
14ca9cd0 MR |
1845 | speed_cflags='-O5' |
1846 | size_cflags='-O5 -qcompact' | |
df442a8d MR |
1847 | elif $cc -V 2>/dev/null | grep -q Compaq; then |
1848 | cc_type=ccc | |
6e3fa35d | 1849 | cc_version="AV_STRINGIFY(__DECC_VER)" |
bb5cecdc | 1850 | cc_ident=$($cc -V | head -n1 | cut -d' ' -f1-3) |
d8059267 | 1851 | DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M' |
03754fcd | 1852 | debuglevel=3 |
df442a8d | 1853 | add_ldflags -Wl,-z,now # calls to libots crash without this |
14ca9cd0 MR |
1854 | speed_cflags='-fast' |
1855 | size_cflags='-O1' | |
6a0d5493 | 1856 | elif $cc --vsn 2>/dev/null | grep -q "ARM C/C++ Compiler"; then |
03e37762 MR |
1857 | test -d "$sysroot" || die "No valid sysroot specified." |
1858 | cc_type=armcc | |
6e3fa35d | 1859 | cc_version="AV_STRINGIFY(__ARMCC_VERSION)" |
bb5cecdc | 1860 | cc_ident=$($cc --vsn | head -n1) |
03e37762 MR |
1861 | armcc_conf="$PWD/armcc.conf" |
1862 | $cc --arm_linux_configure \ | |
1863 | --arm_linux_config_file="$armcc_conf" \ | |
1864 | --configure_sysroot="$sysroot" \ | |
1865 | --configure_cpp_headers="$sysinclude" >>$logfile 2>&1 || | |
1866 | die "Error creating armcc configuration file." | |
bcafde61 | 1867 | $cc --vsn | grep -q RVCT && armcc_opt=rvct || armcc_opt=armcc |
03e37762 | 1868 | cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc" |
75800dce | 1869 | as_default="${cross_prefix}gcc" |
07dec06e MR |
1870 | CC_DEPFLAGS='-MMD' |
1871 | AS_DEPFLAGS='-MMD' | |
14ca9cd0 MR |
1872 | speed_cflags='-O3' |
1873 | size_cflags='-Os' | |
6fec122a MR |
1874 | elif $cc -version 2>/dev/null | grep -q TMS470; then |
1875 | cc_type=tms470 | |
6e3fa35d | 1876 | cc_version="AV_STRINGIFY(__TI_COMPILER_VERSION__)" |
bb5cecdc | 1877 | cc_ident=$($cc -version | head -n1 | tr -s ' ') |
6fec122a MR |
1878 | cc="$cc --gcc --abi=eabi -eo=.o -mc -me" |
1879 | CC_O='-fr=$(@D)' | |
1880 | as_default="${cross_prefix}gcc" | |
1881 | ld_default="${cross_prefix}gcc" | |
6fec122a MR |
1882 | TMPO=$(basename $TMPC .c).o |
1883 | append TMPFILES $TMPO | |
1884 | add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__= | |
07dec06e MR |
1885 | CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)' |
1886 | AS_DEPFLAGS='-MMD' | |
14ca9cd0 MR |
1887 | speed_cflags='-O3 -mf=5' |
1888 | size_cflags='-O3 -mf=2' | |
6fec122a MR |
1889 | filter_cflags=tms470_flags |
1890 | tms470_flags(){ | |
1891 | for flag; do | |
1892 | case $flag in | |
1893 | -march=*|-mcpu=*) | |
1894 | case "${flag#*=}" in | |
1895 | armv7-a|cortex-a*) echo -mv=7a8 ;; | |
1896 | armv7-r|cortex-r*) echo -mv=7r4 ;; | |
1897 | armv7-m|cortex-m*) echo -mv=7m3 ;; | |
1898 | armv6*|arm11*) echo -mv=6 ;; | |
1899 | armv5*e|arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) | |
1900 | echo -mv=5e ;; | |
1901 | armv4*|arm7*|arm9[24]*) echo -mv=4 ;; | |
1902 | esac | |
1903 | ;; | |
1904 | -mfpu=neon) echo --float_support=vfpv3 --neon ;; | |
1905 | -mfpu=vfp) echo --float_support=vfpv2 ;; | |
5fcb865b | 1906 | -mfpu=vfpv3) echo --float_support=vfpv3 ;; |
a2709020 | 1907 | -msoft-float) echo --float_support=vfplib ;; |
14ca9cd0 | 1908 | -O[0-3]|-mf=*) echo $flag ;; |
6fec122a | 1909 | -g) echo -g -mn ;; |
587d24ff | 1910 | -pds=*) echo $flag ;; |
6fec122a MR |
1911 | esac |
1912 | done | |
1913 | } | |
06da6943 DC |
1914 | elif $cc -v 2>&1 | grep -q clang; then |
1915 | cc_type=clang | |
b67a8f49 DC |
1916 | $cc -dM -E $TMPC | grep -q __clang_version__ && |
1917 | cc_version=__clang_version__ || cc_version=__VERSION__ | |
bb5cecdc | 1918 | cc_ident=$($cc --version | head -n1) |
06da6943 DC |
1919 | CC_DEPFLAGS='-MMD' |
1920 | AS_DEPFLAGS='-MMD' | |
14ca9cd0 MR |
1921 | speed_cflags='-O3' |
1922 | size_cflags='-Os' | |
2a472e9c MK |
1923 | elif $cc -V 2>&1 | grep -q Sun; then |
1924 | cc_type=suncc | |
1925 | cc_version="AV_STRINGIFY(__SUNPRO_C)" | |
448f5b83 | 1926 | cc_ident=$($cc -V 2>&1 | head -n1 | cut -d' ' -f 2-) |
faa374b7 | 1927 | DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "1s,^.*: ,$@: ," -e "\$$!s,\$$, \\\," -e "1!s,^.*: , ," > $(@:.o=.d)' |
2a472e9c | 1928 | DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -xM1' |
14ca9cd0 MR |
1929 | speed_cflags='-O5' |
1930 | size_cflags='-O5 -xspace' | |
03279bbe MK |
1931 | filter_cflags=suncc_flags |
1932 | suncc_flags(){ | |
1933 | for flag; do | |
1934 | case $flag in | |
1935 | -march=*|-mcpu=*) | |
1936 | case "${flag#*=}" in | |
1937 | native) echo -xtarget=native ;; | |
87ddc38b | 1938 | v9|niagara) echo -xarch=sparc ;; |
03279bbe | 1939 | ultrasparc) echo -xarch=sparcvis ;; |
87ddc38b | 1940 | ultrasparc3|niagara2) echo -xarch=sparcvis2 ;; |
03279bbe MK |
1941 | i586|pentium) echo -xchip=pentium ;; |
1942 | i686|pentiumpro|pentium2) echo -xtarget=pentium_pro ;; | |
1943 | pentium3*|c3-2) echo -xtarget=pentium3 ;; | |
1944 | pentium-m) echo -xarch=sse2 -xchip=pentium3 ;; | |
1945 | pentium4*) echo -xtarget=pentium4 ;; | |
1946 | prescott|nocona) echo -xarch=sse3 -xchip=pentium4 ;; | |
1947 | *-sse3) echo -xarch=sse3 ;; | |
1948 | core2) echo -xarch=ssse3 -xchip=core2 ;; | |
1949 | amdfam10|barcelona) echo -xarch=sse4_1 ;; | |
1950 | athlon-4|athlon-[mx]p) echo -xarch=ssea ;; | |
1951 | k8|opteron|athlon64|athlon-fx) | |
1952 | echo -xarch=sse2a ;; | |
1953 | athlon*) echo -xarch=pentium_proa ;; | |
1954 | esac | |
1955 | ;; | |
1956 | -std=c99) echo -xc99 ;; | |
1957 | -fomit-frame-pointer) echo -xregs=frameptr ;; | |
1958 | -fPIC) echo -KPIC -xcode=pic32 ;; | |
03279bbe MK |
1959 | -W*,*) echo $flag ;; |
1960 | -f*-*|-W*) ;; | |
1961 | *) echo $flag ;; | |
1962 | esac | |
1963 | done | |
1964 | } | |
349d78fe MR |
1965 | elif $cc -v 2>&1 | grep -q PathScale; then |
1966 | cc_type=pathscale | |
1967 | cc_version=__PATHSCALE__ | |
1968 | cc_ident=$($cc -v 2>&1 | head -n1 | tr -d :) | |
1969 | CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' | |
1970 | AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@' | |
1971 | speed_cflags='-O2' | |
1972 | size_cflags='-Os' | |
629687f6 MR |
1973 | fi |
1974 | ||
851ffa80 MR |
1975 | test -n "$cc_type" && enable $cc_type || |
1976 | warn "Unknown C compiler $cc, unable to select optimal CFLAGS" | |
629687f6 | 1977 | |
75bafbac | 1978 | : ${as_default:=$cc} |
50567afa | 1979 | : ${dep_cc_default:=$cc} |
684b28e0 | 1980 | : ${ld_default:=$cc} |
121d78d0 | 1981 | set_default ar as dep_cc ld |
75800dce | 1982 | |
07dec06e MR |
1983 | test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD |
1984 | test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD | |
1985 | ||
7f32f40c | 1986 | add_cflags $extra_cflags |
2f2e6c7c | 1987 | add_asflags $extra_cflags |
7f32f40c | 1988 | |
154d432c MR |
1989 | if test -n "$sysroot"; then |
1990 | case "$cc_type" in | |
613a4e3f | 1991 | gcc|llvm_gcc) |
467256f2 | 1992 | add_cppflags --sysroot="$sysroot" |
154d432c MR |
1993 | add_ldflags --sysroot="$sysroot" |
1994 | ;; | |
6fec122a MR |
1995 | tms470) |
1996 | add_cppflags -I"$sysinclude" | |
1997 | add_ldflags --sysroot="$sysroot" | |
1998 | ;; | |
06da6943 | 1999 | clang) |
4def700e DC |
2000 | add_cppflags -isysroot "$sysroot" |
2001 | add_ldflags -isysroot "$sysroot" | |
06da6943 | 2002 | ;; |
154d432c MR |
2003 | esac |
2004 | fi | |
2005 | ||
d22c13a8 MR |
2006 | if test "$cpu" = host; then |
2007 | enabled cross_compile && die "--cpu=host makes no sense when cross-compiling." | |
2008 | ||
2009 | case "$cc_type" in | |
613a4e3f | 2010 | gcc|llvm_gcc) |
d22c13a8 MR |
2011 | check_native(){ |
2012 | $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return | |
27ce1be8 MR |
2013 | sed -n "/$1=/{ |
2014 | s/.*$1=\\([^ ]*\\).*/\\1/ | |
2015 | p | |
2016 | q | |
2017 | }" $TMPE | |
d22c13a8 MR |
2018 | } |
2019 | cpu=$(check_native -march || check_native -mcpu) | |
2020 | ;; | |
2021 | esac | |
2022 | ||
2023 | test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc" | |
2024 | fi | |
2025 | ||
e939cedd MR |
2026 | # Deal with common $arch aliases |
2027 | case "$arch" in | |
2028 | arm*) | |
2029 | arch="arm" | |
2030 | ;; | |
2031 | mips|mipsel|IP*) | |
2032 | arch="mips" | |
2033 | ;; | |
47b1860e | 2034 | mips64*) |
e939cedd MR |
2035 | arch="mips" |
2036 | subarch="mips64" | |
2037 | ;; | |
2038 | parisc|hppa) | |
2039 | arch="parisc" | |
2040 | ;; | |
2041 | parisc64|hppa64) | |
2042 | arch="parisc" | |
2043 | subarch="parisc64" | |
2044 | ;; | |
2045 | "Power Macintosh"|ppc|powerpc) | |
2046 | arch="ppc" | |
2047 | ;; | |
47b1860e | 2048 | ppc64|powerpc64) |
e939cedd MR |
2049 | arch="ppc" |
2050 | subarch="ppc64" | |
2051 | ;; | |
2052 | s390|s390x) | |
2053 | arch="s390" | |
2054 | ;; | |
2055 | sh4|sh) | |
2056 | arch="sh4" | |
2057 | ;; | |
2058 | sun4u|sparc64) | |
2059 | arch="sparc" | |
2060 | subarch="sparc64" | |
2061 | ;; | |
2062 | i[3-6]86|i86pc|BePC|x86_64|amd64) | |
2063 | arch="x86" | |
2064 | ;; | |
2065 | esac | |
2066 | ||
851ffa80 | 2067 | is_in $arch $ARCH_LIST || warn "unknown architecture $arch" |
343aef9b | 2068 | enable $arch |
e939cedd | 2069 | |
df5cdc24 | 2070 | # Add processor-specific flags |
5d54c126 MR |
2071 | if test "$cpu" = generic; then |
2072 | : do nothing | |
2073 | elif enabled ppc; then | |
343aef9b | 2074 | |
56348891 MR |
2075 | case $(tolower $cpu) in |
2076 | 601|ppc601|powerpc601) | |
9dbd5c3d | 2077 | cpuflags="-mcpu=601" |
64ad53ff | 2078 | disable altivec |
9dbd5c3d | 2079 | ;; |
56348891 | 2080 | 603*|ppc603*|powerpc603*) |
9dbd5c3d | 2081 | cpuflags="-mcpu=603" |
64ad53ff | 2082 | disable altivec |
9dbd5c3d | 2083 | ;; |
56348891 | 2084 | 604*|ppc604*|powerpc604*) |
9dbd5c3d | 2085 | cpuflags="-mcpu=604" |
64ad53ff | 2086 | disable altivec |
9dbd5c3d | 2087 | ;; |
56348891 | 2088 | g3|75*|ppc75*|powerpc75*) |
9dbd5c3d | 2089 | cpuflags="-mcpu=750 -mpowerpc-gfxopt" |
64ad53ff | 2090 | disable altivec |
9dbd5c3d | 2091 | ;; |
56348891 | 2092 | g4|745*|ppc745*|powerpc745*) |
9dbd5c3d MR |
2093 | cpuflags="-mcpu=7450 -mpowerpc-gfxopt" |
2094 | ;; | |
56348891 | 2095 | 74*|ppc74*|powerpc74*) |
9dbd5c3d MR |
2096 | cpuflags="-mcpu=7400 -mpowerpc-gfxopt" |
2097 | ;; | |
56348891 | 2098 | g5|970|ppc970|powerpc970|power4*) |
9dbd5c3d MR |
2099 | cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64" |
2100 | ;; | |
56348891 | 2101 | cell) |
9dbd5c3d MR |
2102 | cpuflags="-mcpu=cell" |
2103 | enable ldbrx | |
2104 | ;; | |
7b0b81a1 AL |
2105 | e500v2) |
2106 | cpuflags="-mcpu=8548 -mhard-float -mfloat-gprs=double" | |
2107 | disable altivec | |
2108 | ;; | |
2109 | e500) | |
2110 | cpuflags="-mcpu=8540 -mhard-float" | |
2111 | disable altivec | |
2112 | ;; | |
9dbd5c3d | 2113 | esac |
343aef9b MR |
2114 | |
2115 | elif enabled x86; then | |
2116 | ||
9dbd5c3d MR |
2117 | case $cpu in |
2118 | i[345]86|pentium) | |
2119 | cpuflags="-march=$cpu" | |
2120 | disable mmx | |
2121 | ;; | |
2122 | # targets that do NOT support conditional mov (cmov) | |
2123 | pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3) | |
2124 | cpuflags="-march=$cpu" | |
2125 | disable cmov | |
2126 | ;; | |
2127 | # targets that do support conditional mov (cmov) | |
e90aa6ed | 2128 | i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2|amdfam10|barcelona|atom) |
9dbd5c3d MR |
2129 | cpuflags="-march=$cpu" |
2130 | enable cmov | |
2131 | enable fast_cmov | |
2132 | ;; | |
2133 | # targets that do support conditional mov but on which it's slow | |
2134 | pentium4|pentium4m|prescott|nocona) | |
2135 | cpuflags="-march=$cpu" | |
2136 | enable cmov | |
2137 | disable fast_cmov | |
2138 | ;; | |
2139 | esac | |
343aef9b MR |
2140 | |
2141 | elif enabled sparc; then | |
2142 | ||
9dbd5c3d | 2143 | case $cpu in |
26b7199e MK |
2144 | niagara) |
2145 | cpuflags="-mcpu=$cpu" | |
2146 | disable vis | |
2147 | ;; | |
9dbd5c3d MR |
2148 | sparc64) |
2149 | cpuflags="-mcpu=v9" | |
2150 | ;; | |
2151 | esac | |
343aef9b MR |
2152 | |
2153 | elif enabled arm; then | |
2154 | ||
34ba23c9 MR |
2155 | case $cpu in |
2156 | armv*) | |
2157 | cpuflags="-march=$cpu" | |
c2eae137 | 2158 | subarch=$(echo $cpu | sed 's/[^a-z0-9]//g') |
34ba23c9 MR |
2159 | ;; |
2160 | *) | |
2161 | cpuflags="-mcpu=$cpu" | |
c2eae137 MR |
2162 | case $cpu in |
2163 | cortex-a*) subarch=armv7a ;; | |
2164 | cortex-r*) subarch=armv7r ;; | |
2165 | cortex-m*) subarch=armv7m ;; | |
2166 | arm11*) subarch=armv6 ;; | |
2167 | arm[79]*e*|arm9[24]6*|arm96*|arm102[26]) subarch=armv5te ;; | |
2168 | armv4*|arm7*|arm9[24]*) subarch=armv4 ;; | |
2169 | esac | |
34ba23c9 MR |
2170 | ;; |
2171 | esac | |
343aef9b MR |
2172 | |
2173 | elif enabled alpha; then | |
2174 | ||
34ba23c9 | 2175 | enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu" |
343aef9b MR |
2176 | |
2177 | elif enabled bfin; then | |
2178 | ||
34ba23c9 | 2179 | cpuflags="-mcpu=$cpu" |
343aef9b MR |
2180 | |
2181 | elif enabled mips; then | |
2182 | ||
34ba23c9 | 2183 | cpuflags="-march=$cpu" |
343aef9b MR |
2184 | |
2185 | elif enabled avr32; then | |
2186 | ||
9dbd5c3d MR |
2187 | case $cpu in |
2188 | ap7[02]0[0-2]) | |
2189 | subarch="avr32_ap" | |
2190 | cpuflags="-mpart=$cpu" | |
2191 | ;; | |
2192 | ap) | |
2193 | subarch="avr32_ap" | |
2194 | cpuflags="-march=$cpu" | |
2195 | ;; | |
2196 | uc3[ab]*) | |
2197 | subarch="avr32_uc" | |
2198 | cpuflags="-mcpu=$cpu" | |
2199 | ;; | |
2200 | uc) | |
2201 | subarch="avr32_uc" | |
2202 | cpuflags="-march=$cpu" | |
2203 | ;; | |
2204 | esac | |
df5cdc24 | 2205 | |
343aef9b MR |
2206 | fi |
2207 | ||
df5cdc24 MR |
2208 | add_cflags $cpuflags |
2209 | add_asflags $cpuflags | |
2210 | ||
993f2d0f MR |
2211 | # compiler sanity check |
2212 | check_exec <<EOF | |
2213 | int main(void){ return 0; } | |
2214 | EOF | |
2215 | if test "$?" != 0; then | |
2216 | echo "$cc is unable to create an executable file." | |
2217 | if test -z "$cross_prefix" && ! enabled cross_compile ; then | |
2218 | echo "If $cc is a cross-compiler, use the --enable-cross-compile option." | |
2219 | echo "Only do this if you know what cross compiling means." | |
2220 | fi | |
2221 | die "C compiler test failed." | |
2222 | fi | |
2223 | ||
38a9c529 | 2224 | add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 |
e9b9a2f8 | 2225 | check_cflags -std=c99 |
50a334e4 | 2226 | check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64 |
9d821fc2 DB |
2227 | #include <stdlib.h> |
2228 | EOF | |
50a334e4 | 2229 | check_cc -D_LARGEFILE_SOURCE <<EOF && add_cppflags -D_LARGEFILE_SOURCE |
9d821fc2 DB |
2230 | #include <stdlib.h> |
2231 | EOF | |
e9b9a2f8 | 2232 | |
f0125de9 MR |
2233 | check_host_cflags -std=c99 |
2234 | ||
b24dbcbd | 2235 | case "$arch" in |
e939cedd | 2236 | alpha|ia64|mips|parisc|sparc) |
8a3c8627 | 2237 | spic=$shared |
b24dbcbd | 2238 | ;; |
e939cedd | 2239 | x86) |
cfdb6148 | 2240 | subarch="x86_32" |
e939cedd | 2241 | check_cc <<EOF && subarch="x86_64" |
58b3536d | 2242 | int test[(int)sizeof(char*) - 7]; |
cfdb6148 | 2243 | EOF |
de27f4d9 | 2244 | if test "$subarch" = "x86_64"; then |
e939cedd | 2245 | spic=$shared |
de27f4d9 | 2246 | fi |
b24dbcbd | 2247 | ;; |
b24dbcbd RP |
2248 | esac |
2249 | ||
343aef9b | 2250 | enable $subarch |
8a3c8627 | 2251 | enabled spic && enable pic |
b24dbcbd | 2252 | |
7483e694 | 2253 | # OS specific |
4f854758 | 2254 | case $target_os in |
a1629e28 | 2255 | haiku) |
63ae7e7c | 2256 | prefix_default="/boot/common" |
108caaaa | 2257 | network_extralibs="-lnetwork" |
a1629e28 | 2258 | ;; |
7483e694 DB |
2259 | sunos) |
2260 | FFSERVERLDFLAGS="" | |
9987769a | 2261 | SHFLAGS='-shared -Wl,-h,$$(@F)' |
0600d30a | 2262 | enabled x86 && SHFLAGS="-mimpure-text $SHFLAGS" |
7483e694 | 2263 | network_extralibs="-lsocket -lnsl" |
50a334e4 | 2264 | add_cppflags -D__EXTENSIONS__ |
8182dc34 | 2265 | nm_opts='-P -g' |
7483e694 DB |
2266 | ;; |
2267 | netbsd) | |
07a8eef6 MR |
2268 | oss_indev_extralibs="-lossaudio" |
2269 | oss_outdev_extralibs="-lossaudio" | |
2138dc99 | 2270 | add_cppflags -D_XOPEN_SOURCE=600 |
7483e694 DB |
2271 | ;; |
2272 | openbsd) | |
89e053f8 | 2273 | enable malloc_aligned |
7c4a001a MR |
2274 | # On OpenBSD 4.5. the compiler does not use PIC unless |
2275 | # explicitly using -fPIC. FFmpeg builds fine without PIC, | |
2276 | # however the generated executable will not do anything | |
2277 | # (simply quits with exit-code 1, no crash, no output). | |
a7b9c8ae | 2278 | # Thus explicitly enable PIC here. |
cd78208b | 2279 | enable pic |
7483e694 | 2280 | SHFLAGS='-shared' |
07a8eef6 MR |
2281 | oss_indev_extralibs="-lossaudio" |
2282 | oss_outdev_extralibs="-lossaudio" | |
7483e694 | 2283 | ;; |
90b4f091 | 2284 | freebsd|dragonfly) |
89e053f8 | 2285 | enable malloc_aligned |
7483e694 DB |
2286 | ;; |
2287 | bsd/os) | |
355d81df | 2288 | add_extralibs -lpoll -lgnugetopt |
7483e694 DB |
2289 | strip="strip -d" |
2290 | ;; | |
2291 | darwin) | |
89e053f8 | 2292 | enable malloc_aligned |
301ab19d | 2293 | gas="gas-preprocessor.pl $cc" |
e08b8239 | 2294 | enabled ppc && add_asflags -force_cpusubtype_ALL |
0138c54e | 2295 | SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress' |
be90cd27 | 2296 | strip="${strip} -x" |
355d81df | 2297 | add_ldflags -Wl,-dynamic,-search_paths_first |
7483e694 DB |
2298 | SLIBSUF=".dylib" |
2299 | SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)' | |
2300 | SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)' | |
2301 | FFSERVERLDFLAGS=-Wl,-bind_at_load | |
304d586d | 2302 | objformat="macho" |
1b0f6fb8 | 2303 | enabled x86_64 && objformat="macho64" |
8dfa86f7 | 2304 | enabled_any pic shared || |
2704bd1a | 2305 | { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; } |
7483e694 DB |
2306 | ;; |
2307 | mingw32*) | |
9d3f4f50 | 2308 | if test $target_os = "mingw32ce"; then |
1aa71e25 MS |
2309 | disable network |
2310 | else | |
2311 | target_os=mingw32 | |
2312 | fi | |
dcc01c06 | 2313 | LIBTARGET=i386 |
1fc9fb8a | 2314 | if enabled x86_64; then |
89e053f8 | 2315 | enable malloc_aligned |
dcc01c06 | 2316 | LIBTARGET=x64 |
336cc1b0 MS |
2317 | elif enabled arm; then |
2318 | LIBTARGET=arm | |
dcc01c06 | 2319 | fi |
fbd971a4 | 2320 | shlibdir_default="$bindir_default" |
7483e694 DB |
2321 | disable ffserver |
2322 | SLIBPREF="" | |
2323 | SLIBSUF=".dll" | |
7483e694 DB |
2324 | SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' |
2325 | SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' | |
06abe7f5 | 2326 | SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)' |
4c25d159 | 2327 | SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \ |
b9349ff4 MS |
2328 | install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \ |
2329 | install -d "$(LIBDIR)"; \ | |
2330 | install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"' | |
7483e694 | 2331 | SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"' |
4b51fb1c | 2332 | SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base' |
304d586d | 2333 | objformat="win32" |
bc574408 | 2334 | enable dos_paths |
1894e741 | 2335 | check_cflags -fno-common |
e26011d0 RP |
2336 | check_cpp_condition _mingw.h "defined (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION > 3) \ |
2337 | || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" || | |
f7ad5aa2 | 2338 | die "ERROR: MinGW runtime version must be >= 3.15." |
7483e694 DB |
2339 | ;; |
2340 | cygwin*) | |
4f854758 | 2341 | target_os=cygwin |
fbd971a4 | 2342 | shlibdir_default="$bindir_default" |
7483e694 DB |
2343 | SLIBPREF="cyg" |
2344 | SLIBSUF=".dll" | |
2345 | SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)' | |
2346 | SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)' | |
2347 | SHFLAGS='-shared -Wl,--enable-auto-image-base' | |
304d586d | 2348 | objformat="win32" |
bc574408 | 2349 | enable dos_paths |
1894e741 | 2350 | check_cflags -fno-common |
7483e694 | 2351 | ;; |
4f365f37 | 2352 | *-dos|freedos|opendos) |
fdf11906 | 2353 | disable ffplay ffserver |
4f365f37 MK |
2354 | disable $INDEV_LIST $OUTDEV_LIST |
2355 | network_extralibs="-lsocket" | |
ff1c015d | 2356 | objformat="coff" |
bc574408 | 2357 | enable dos_paths |
4f365f37 | 2358 | ;; |
7483e694 | 2359 | linux) |
7483e694 DB |
2360 | enable dv1394 |
2361 | ;; | |
2362 | irix*) | |
4f854758 | 2363 | target_os=irix |
7483e694 DB |
2364 | ranlib="echo ignoring ranlib" |
2365 | ;; | |
d22e8442 | 2366 | os/2*) |
d22e8442 DY |
2367 | strip="lxlite" |
2368 | ln_s="cp -f" | |
355d81df | 2369 | add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap |
71c61f62 | 2370 | SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf' |
d22e8442 | 2371 | FFSERVERLDFLAGS="" |
287d3b13 | 2372 | LIBSUF="_s.a" |
d22e8442 DY |
2373 | SLIBPREF="" |
2374 | SLIBSUF=".dll" | |
2375 | SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)' | |
2376 | SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)' | |
71c61f62 MR |
2377 | SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \ |
2378 | echo PROTMODE >> $(SUBDIR)$(NAME).def; \ | |
2379 | echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \ | |
2380 | echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \ | |
2381 | echo EXPORTS >> $(SUBDIR)$(NAME).def; \ | |
2382 | emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def' | |
2383 | SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \ | |
2384 | emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;' | |
2385 | SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"' | |
d22e8442 | 2386 | SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib' |
bc574408 | 2387 | enable dos_paths |
d22e8442 | 2388 | ;; |
83993c1c AM |
2389 | gnu/kfreebsd) |
2390 | ;; | |
34e82167 | 2391 | gnu) |
34e82167 | 2392 | ;; |
614d8911 MR |
2393 | none) |
2394 | ;; | |
7483e694 | 2395 | *) |
4f924f9a | 2396 | die "Unknown OS '$target_os'." |
7483e694 DB |
2397 | ;; |
2398 | esac | |
2399 | ||
db7515fd MR |
2400 | echo "config:$arch:$subarch:$cpu:$target_os:$cc_ident:$FFMPEG_CONFIGURATION" >config.fate |
2401 | ||
13cb2187 AS |
2402 | check_cpp_condition stdlib.h "defined(__PIC__) || defined(__pic__) || defined(PIC)" && enable pic |
2403 | ||
c9d19248 MR |
2404 | set_default $PATHS_LIST |
2405 | ||
320d060a | 2406 | # we need to build at least one lib type |
93b3c083 | 2407 | if ! enabled_any static shared; then |
320d060a DB |
2408 | cat <<EOF |
2409 | At least one library type must be built. | |
2410 | Specify --enable-static to build the static libraries or --enable-shared to | |
2411 | build the shared libraries as well. To only build the shared libraries specify | |
2412 | --disable-static in addition to --enable-shared. | |
2413 | EOF | |
2414 | exit 1; | |
2415 | fi | |
2416 | ||
abc4e572 | 2417 | disabled static && LIBNAME="" |
2a320695 | 2418 | |
2184c6f7 | 2419 | die_license_disabled() { |
4c27207c | 2420 | enabled $1 || { enabled $2 && die "$2 is $1 and --enable-$1 is not specified."; } |
2184c6f7 DB |
2421 | } |
2422 | ||
2184c6f7 | 2423 | die_license_disabled gpl libx264 |
de295976 | 2424 | die_license_disabled gpl libxavs |
2184c6f7 DB |
2425 | die_license_disabled gpl libxvid |
2426 | die_license_disabled gpl postproc | |
2427 | die_license_disabled gpl x11grab | |
2428 | ||
2f7ae63b | 2429 | die_license_disabled nonfree libfaac |
b2e3c528 | 2430 | |
0b175caa DB |
2431 | die_license_disabled version3 libopencore_amrnb |
2432 | die_license_disabled version3 libopencore_amrwb | |
2433 | ||
9cad0e4e | 2434 | enabled version3 && { enabled gpl && enable gplv3 || enable lgplv3; } |
3fe142e2 | 2435 | |
9eeed841 | 2436 | check_deps $ARCH_EXT_LIST |
0f3cb305 | 2437 | |
40617a6d | 2438 | disabled optimizations || check_cflags -fomit-frame-pointer |
cf9d24ad | 2439 | |
e276d9e8 MR |
2440 | enable_pic() { |
2441 | enable pic | |
bce7b696 MR |
2442 | add_cppflags -DPIC |
2443 | add_cflags -fPIC | |
2444 | add_asflags -fPIC | |
e276d9e8 MR |
2445 | } |
2446 | ||
2447 | enabled pic && enable_pic | |
bce7b696 | 2448 | |
b4d96ba2 MR |
2449 | check_cc <<EOF || die "Symbol mangling check failed." |
2450 | int ff_extern; | |
2451 | EOF | |
8182dc34 | 2452 | sym=$($nm $nm_opts $TMPO | awk '/ff_extern/{ print substr($0, match($0, /[^ \t]*ff_extern/)) }') |
b4d96ba2 MR |
2453 | extern_prefix=${sym%%ff_extern*} |
2454 | ||
f65883c8 MR |
2455 | check_cc <<EOF && enable inline_asm |
2456 | void foo(void) { __asm__ volatile ("" ::); } | |
2457 | EOF | |
61d251db | 2458 | |
df5e3978 MR |
2459 | _restrict= |
2460 | for restrict_keyword in restrict __restrict__ __restrict; do | |
2461 | check_cc <<EOF && _restrict=$restrict_keyword && break | |
2462 | void foo(char * $restrict_keyword p); | |
2463 | EOF | |
2464 | done | |
2465 | ||
2466 | check_cc <<EOF && enable attribute_packed | |
2467 | struct { int x; } __attribute__((packed)) x; | |
2468 | EOF | |
2469 | ||
dffb41b9 MR |
2470 | check_cc <<EOF && enable attribute_may_alias |
2471 | union { int x; } __attribute__((may_alias)) x; | |
2472 | EOF | |
2473 | ||
df5e3978 MR |
2474 | check_cc <<EOF || die "endian test failed" |
2475 | unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'; | |
2476 | EOF | |
48fc536a | 2477 | od -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian |
df5e3978 | 2478 | |
e939cedd MR |
2479 | if enabled alpha; then |
2480 | ||
2481 | check_cflags -mieee | |
2482 | ||
2483 | elif enabled arm; then | |
e45391bb | 2484 | |
50fa82e6 | 2485 | check_cflags -marm |
301ab19d | 2486 | nogas=die |
50fa82e6 | 2487 | |
fa0912fe MR |
2488 | check_ld <<EOF && enable vfp_args |
2489 | __asm__ (".eabi_attribute 28, 1"); | |
2490 | int main(void) { return 0; } | |
2491 | EOF | |
2492 | ||
2493 | # We have to check if pld is a nop and disable it. | |
2494 | check_asm pld '"pld [r0]"' | |
2495 | ||
2496 | enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"' | |
2497 | enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"' | |
2498 | enabled armv6t2 && check_asm armv6t2 '"movt r0, #0"' | |
2499 | enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"' | |
2500 | enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"' | |
2501 | enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"' | |
e45391bb | 2502 | |
e276d9e8 MR |
2503 | enabled_all armv6t2 shared !pic && enable_pic |
2504 | ||
fa0912fe | 2505 | elif enabled mips; then |
e45391bb | 2506 | |
fa0912fe MR |
2507 | check_asm loongson '"dmult.g $1, $2, $3"' |
2508 | enabled mmi && check_asm mmi '"lq $2, 0($2)"' | |
e45391bb | 2509 | |
fa0912fe | 2510 | elif enabled ppc; then |
e45391bb | 2511 | |
e6a0c354 MR |
2512 | enable local_aligned_8 local_aligned_16 |
2513 | ||
135448fa | 2514 | check_asm dcbzl '"dcbzl 0, %0" :: "r"(0)' |
2f0c136e | 2515 | check_asm ibm_asm '"add 0, 0, 0"' |
fa0912fe | 2516 | check_asm ppc4xx '"maclhw r10, r11, r12"' |
64de20d1 | 2517 | check_asm xform_asm '"lwzx %1, %y0" :: "Z"(*(int*)0), "r"(0)' |
fa0912fe MR |
2518 | |
2519 | # AltiVec flags: The FSF version of GCC differs from the Apple version | |
2520 | if enabled altivec; then | |
301ab19d | 2521 | nogas=warn |
fa0912fe MR |
2522 | check_cflags -maltivec -mabi=altivec && |
2523 | { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } || | |
2524 | check_cflags -faltivec | |
2525 | ||
2526 | # check if our compiler supports Motorola AltiVec C API | |
2527 | check_cc <<EOF || disable altivec | |
2528 | $inc_altivec_h | |
2529 | int main(void) { | |
2530 | vector signed int v1, v2, v3; | |
2531 | v1 = vec_add(v2,v3); | |
2532 | return 0; | |
2533 | } | |
2534 | EOF | |
2535 | ||
2536 | # check if our compiler supports braces for vector declarations | |
2537 | check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations." | |
2538 | $inc_altivec_h | |
2539 | int main (void) { (vector int) {1}; return 0; } | |
2540 | EOF | |
2541 | fi | |
e45391bb | 2542 | |
fa0912fe | 2543 | elif enabled sparc; then |
e45391bb | 2544 | |
fa0912fe MR |
2545 | enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc && |
2546 | add_cflags -mcpu=ultrasparc -mtune=ultrasparc | |
e45391bb | 2547 | |
fa0912fe | 2548 | elif enabled x86; then |
e45391bb | 2549 | |
e6a0c354 MR |
2550 | enable local_aligned_8 local_aligned_16 |
2551 | ||
44965991 PI |
2552 | # check whether EBP is available on x86 |
2553 | # As 'i' is stored on the stack, this program will crash | |
2554 | # if the base pointer is used to access it because the | |
2555 | # base pointer is cleared in the inline assembly code. | |
7dfef245 | 2556 | check_exec_crash <<EOF && enable ebp_available |
44965991 | 2557 | volatile int i=0; |
be449fca | 2558 | __asm__ volatile ( |
44965991 PI |
2559 | "xorl %%ebp, %%ebp" |
2560 | ::: "%ebp"); | |
2561 | return i; | |
44965991 PI |
2562 | EOF |
2563 | ||
f494213c | 2564 | # check whether EBX is available on x86 |
7cee5421 MR |
2565 | check_asm ebx_available '""::"b"(0)' && |
2566 | check_asm ebx_available '"":::"%ebx"' | |
8e380710 | 2567 | |
d3a4b4e0 DB |
2568 | # check whether more than 10 operands are supported |
2569 | check_cc <<EOF && enable ten_operands | |
2570 | int main(void) { | |
2571 | int x=0; | |
2572 | __asm__ volatile( | |
2573 | "" | |
2574 | :"+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x), "+&rm"(x) | |
2575 | ); | |
2576 | return 0; | |
2577 | } | |
2578 | EOF | |
2579 | ||
d7f0920b | 2580 | # check whether binutils is new enough to compile SSSE3/MMX2 |
940f335a | 2581 | enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"' |
5fd89ca0 | 2582 | enabled mmx2 && check_asm mmx2 '"pmaxub %mm0, %mm1"' |
6bd859d6 MR |
2583 | |
2584 | check_asm bswap '"bswap %%eax" ::: "%eax"' | |
304d586d | 2585 | |
55127e7b | 2586 | YASMFLAGS="-f $objformat" |
304d586d | 2587 | enabled x86_64 && append YASMFLAGS "-m amd64" |
a34ebe60 | 2588 | enabled pic && append YASMFLAGS "-DPIC" |
5f36d94d | 2589 | test -n "$extern_prefix" && append YASMFLAGS "-DPREFIX" |
304d586d LM |
2590 | case "$objformat" in |
2591 | elf) enabled debug && append YASMFLAGS "-g dwarf2" ;; | |
304d586d | 2592 | esac |
9cca1e40 | 2593 | if ! disabled_any asm mmx yasm; then |
31a0dcb2 | 2594 | check_yasm "pabsw xmm0, xmm0" && enable yasm || |
25432e85 | 2595 | die "yasm not found, use --disable-yasm for a crippled build" |
31a0dcb2 | 2596 | fi |
e45391bb | 2597 | |
669b5583 MR |
2598 | case "$cpu" in |
2599 | athlon*|opteron*|k8*|pentium|pentium-mmx|prescott|nocona|atom|geode) | |
2600 | disable fast_clz | |
2601 | ;; | |
2602 | esac | |
2603 | ||
44965991 PI |
2604 | fi |
2605 | ||
301ab19d MR |
2606 | if enabled asm; then |
2607 | as=${gas:=$as} | |
2608 | check_asm gnu_as '".macro m n\n\\n:.int 0\n.endm\nm x"' || | |
2609 | $nogas "GNU assembler not found, install gas-preprocessor" | |
2610 | fi | |
2611 | ||
a98bb16d RP |
2612 | if check_func dlopen; then |
2613 | ldl= | |
2614 | elif check_func dlopen -ldl; then | |
2615 | ldl=-ldl | |
8bf5d58f MN |
2616 | fi |
2617 | ||
75ecf149 DB |
2618 | # Solaris has nanosleep in -lrt, OpenSolaris no longer needs that |
2619 | check_func nanosleep || { check_func nanosleep -lrt && add_extralibs -lrt; } | |
2620 | ||
534a2231 | 2621 | check_func fcntl |
7483e694 | 2622 | check_func fork |
84882df6 | 2623 | check_func getaddrinfo $network_extralibs |
7483e694 DB |
2624 | check_func gethrtime |
2625 | check_func getrusage | |
fc5607f8 | 2626 | check_struct "sys/time.h sys/resource.h" "struct rusage" ru_maxrss |
094c09bb | 2627 | check_func inet_aton $network_extralibs |
abfc8d05 | 2628 | check_func isatty |
4ae40685 | 2629 | check_func ${malloc_prefix}memalign && enable memalign |
7483e694 | 2630 | check_func mkstemp |
4ae40685 | 2631 | check_func ${malloc_prefix}posix_memalign && enable posix_memalign |
0104b608 | 2632 | check_func setrlimit |
87958234 | 2633 | check_func strerror_r |
b507ebd1 | 2634 | check_func_headers io.h setmode |
e4673692 | 2635 | check_func_headers lzo/lzo1x.h lzo1x_999_compress |
fc5607f8 | 2636 | check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi |
2446d3d6 | 2637 | check_func_headers windows.h GetProcessTimes |
7c5bfe7a | 2638 | check_func_headers windows.h VirtualAlloc |
6ffa87d3 | 2639 | |
e16e49ac | 2640 | check_header conio.h |
a98bb16d | 2641 | check_header dlfcn.h |
92c6a099 | 2642 | check_header dxva2api.h |
a98bb16d | 2643 | check_header malloc.h |
bf6ce82d | 2644 | check_header poll.h |
b58412f1 | 2645 | check_header sys/mman.h |
b091aa44 | 2646 | check_header sys/resource.h |
bf6ce82d | 2647 | check_header sys/select.h |
a98bb16d | 2648 | check_header termios.h |
272081b0 CEH |
2649 | check_header vdpau/vdpau.h |
2650 | check_header vdpau/vdpau_x11.h | |
68178ca9 | 2651 | check_header X11/extensions/XvMClib.h |
a98bb16d | 2652 | |
9104cd51 RP |
2653 | check_struct dxva2api.h DXVA_PictureParameters wDecodedPictureIndex |
2654 | ||
89e053f8 MR |
2655 | if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned && |
2656 | enabled_any $need_memalign ; then | |
1f91cdce | 2657 | die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack." |
a98bb16d | 2658 | fi |
e16e49ac | 2659 | |
a4fa192c | 2660 | disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib |
632948bd | 2661 | disabled bzlib || check_lib2 bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib |
57bd82d4 MR |
2662 | |
2663 | # check for some common methods of building with pthread support | |
2664 | # do this before the optional library checks as some of them require pthreads | |
0dbfc1db MR |
2665 | if ! disabled pthreads && ! enabled w32threads; then |
2666 | enable pthreads | |
9e7fd101 MR |
2667 | if check_func pthread_create; then |
2668 | : | |
2669 | elif check_func pthread_create -pthread; then | |
2670 | add_cflags -pthread | |
afc9aee2 | 2671 | add_extralibs -pthread |
9e7fd101 MR |
2672 | elif check_func pthread_create -pthreads; then |
2673 | add_cflags -pthreads | |
afc9aee2 | 2674 | add_extralibs -pthreads |
8d94f606 GT |
2675 | elif check_func pthread_create -lpthreadGC2; then |
2676 | add_extralibs -lpthreadGC2 | |
9e7fd101 | 2677 | elif ! check_lib pthread.h pthread_create -lpthread; then |
0dbfc1db | 2678 | disable pthreads |
9e7fd101 | 2679 | fi |
57bd82d4 MR |
2680 | fi |
2681 | ||
8eee7025 | 2682 | for thread in $THREADS_LIST; do |
e5f94c2b | 2683 | if enabled $thread; then |
3ae3b721 RP |
2684 | test -n "$thread_type" && |
2685 | die "ERROR: Only one thread type must be selected." || | |
e5f94c2b | 2686 | thread_type="$thread" |
e5f94c2b RP |
2687 | fi |
2688 | done | |
2689 | ||
fdf88598 | 2690 | check_lib math.h sin -lm |
edd43c95 | 2691 | disabled vaapi || check_lib va/va.h vaInitialize -lva |
fdf88598 | 2692 | |
645d2652 MR |
2693 | check_mathfunc exp2 |
2694 | check_mathfunc exp2f | |
2695 | check_mathfunc llrint | |
07876e25 | 2696 | check_mathfunc llrintf |
645d2652 MR |
2697 | check_mathfunc log2 |
2698 | check_mathfunc log2f | |
2699 | check_mathfunc lrint | |
2700 | check_mathfunc lrintf | |
2701 | check_mathfunc round | |
2702 | check_mathfunc roundf | |
2703 | check_mathfunc truncf | |
f32adb22 | 2704 | |
57bd82d4 | 2705 | # these are off by default, so fail if requested and not available |
a1b3c5a3 | 2706 | enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lavifil32 |
e3cc7d6f | 2707 | enabled libdirac && add_cflags $(pkg-config --cflags dirac) && |
2513b2b4 DB |
2708 | require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) && |
2709 | require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac) | |
79fda097 | 2710 | enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac |
5af41508 | 2711 | enabled libgsm && require libgsm gsm/gsm.h gsm_create -lgsm |
eb7626a3 | 2712 | enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame |
7483e694 | 2713 | enabled libnut && require libnut libnut.h nut_demuxer_init -lnut |
eb7626a3 MR |
2714 | enabled libopencore_amrnb && require libopencore_amrnb opencore-amrnb/interf_dec.h Decoder_Interface_init -lopencore-amrnb |
2715 | enabled libopencore_amrwb && require libopencore_amrwb opencore-amrwb/dec_if.h D_IF_init -lopencore-amrwb | |
3d6fac8c | 2716 | enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg |
42ebfc54 RP |
2717 | enabled librtmp && { check_lib librtmp/rtmp.h RTMP_Socket $(pkg-config --libs librtmp) || |
2718 | die "ERROR: librtmp not found or RTMP_Socket() missing, librtmp version must be >= 2.2.f"; } | |
36718e51 DB |
2719 | enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) && |
2720 | require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0) | |
ae14f311 | 2721 | enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex |
c261a5d9 | 2722 | enabled libtheora && require libtheora theora/theoraenc.h th_info_init -ltheoraenc -ltheoradec -logg |
7483e694 | 2723 | enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg |
7d07d6f5 DB |
2724 | enabled libvpx && { |
2725 | enabled libvpx_decoder && { check_lib2 "vpx/vpx_decoder.h vpx/vp8dx.h" vpx_codec_dec_init_ver -lvpx || | |
2726 | die "ERROR: libvpx decoder version must be >=0.9.1"; } | |
2727 | enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" vpx_codec_enc_init_ver -lvpx || | |
2728 | die "ERROR: libvpx encoder version must be >=0.9.1"; } } | |
eb7626a3 | 2729 | enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 && |
652d9d24 JGG |
2730 | { check_cpp_condition x264.h "X264_BUILD >= 98" || |
2731 | die "ERROR: libx264 version must be >= 0.98."; } | |
de295976 | 2732 | enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs |
2bfecf73 | 2733 | enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore |
7483e694 | 2734 | enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib |
8ac17293 | 2735 | |
0b4a1821 AS |
2736 | # libdc1394 check |
2737 | if enabled libdc1394; then | |
2738 | { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 && | |
2739 | enable libdc1394_2; } || | |
2740 | { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 && | |
2741 | enable libdc1394_1; } || | |
2742 | die "ERROR: No version of libdc1394 found " | |
2743 | fi | |
2744 | ||
6a1a892f | 2745 | SDL_CONFIG="${cross_prefix}sdl-config" |
2270b4b2 | 2746 | if "${SDL_CONFIG}" --version > /dev/null 2>&1; then |
5e622c40 | 2747 | sdl_cflags=$("${SDL_CONFIG}" --cflags) |
b4f93564 | 2748 | sdl_libs=$("${SDL_CONFIG}" --libs) |
aa692d54 MR |
2749 | check_func_headers SDL.h SDL_Init $sdl_cflags $sdl_libs && |
2750 | check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags && | |
2751 | enable sdl && | |
2752 | check_struct SDL.h SDL_VideoInfo current_w $sdl_cflags && enable sdl_video_size | |
c3f6b472 | 2753 | fi |
57bd82d4 | 2754 | |
2270b4b2 | 2755 | texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html |
146ea952 | 2756 | |
73b46a95 | 2757 | if enabled network; then |
96000432 | 2758 | check_type "sys/types.h sys/socket.h" socklen_t |
c0018613 | 2759 | check_type netdb.h "struct addrinfo" |
b4d68544 MS |
2760 | check_type netinet/in.h "struct ipv6_mreq" |
2761 | check_type netinet/in.h "struct sockaddr_in6" | |
ff6e82a9 | 2762 | check_type "sys/types.h sys/socket.h" "struct sockaddr_storage" |
3b2372bf | 2763 | check_struct "sys/types.h sys/socket.h" "struct sockaddr" sa_len |
73b46a95 RP |
2764 | # Prefer arpa/inet.h over winsock2 |
2765 | if check_header arpa/inet.h ; then | |
2766 | check_func closesocket | |
2767 | elif check_header winsock2.h ; then | |
f4c13872 MS |
2768 | check_func_headers winsock2.h closesocket -lws2 && \ |
2769 | network_extralibs="-lws2" || \ | |
2770 | { check_func_headers winsock2.h closesocket -lws2_32 && \ | |
2771 | network_extralibs="-lws2_32"; } | |
72be9e73 | 2772 | check_type ws2tcpip.h socklen_t |
c0018613 | 2773 | check_type ws2tcpip.h "struct addrinfo" |
b4d68544 MS |
2774 | check_type ws2tcpip.h "struct ipv6_mreq" |
2775 | check_type ws2tcpip.h "struct sockaddr_in6" | |
33a4dbdd | 2776 | check_type ws2tcpip.h "struct sockaddr_storage" |
3b2372bf | 2777 | check_struct winsock2.h "struct sockaddr" sa_len |
28c9f069 MK |
2778 | else |
2779 | disable network | |
73b46a95 RP |
2780 | fi |
2781 | fi | |
2782 | ||
06e31011 RP |
2783 | check_header linux/videodev.h |
2784 | check_header linux/videodev2.h | |
1b6e8b73 | 2785 | check_header sys/videoio.h |
47f38850 | 2786 | |
27796dc3 | 2787 | check_func_headers "windows.h vfw.h" capCreateCaptureWindow "$vfwcap_indev_extralibs" |
ec1ee802 RP |
2788 | # check that WM_CAP_DRIVER_CONNECT is defined to the proper value |
2789 | # w32api 3.12 had it defined wrong | |
2790 | check_cpp_condition vfw.h "WM_CAP_DRIVER_CONNECT > WM_USER" && enable vfwcap_defines | |
c2345207 | 2791 | |
f8aa696f | 2792 | # check for ioctl_meteor.h, ioctl_bt848.h and alternatives |
1c915f83 RP |
2793 | { check_header dev/bktr/ioctl_meteor.h && |
2794 | check_header dev/bktr/ioctl_bt848.h; } || | |
2795 | { check_header machine/ioctl_meteor.h && | |
2796 | check_header machine/ioctl_bt848.h; } || | |
2797 | { check_header dev/video/meteor/ioctl_meteor.h && | |
2798 | check_header dev/video/bktr/ioctl_bt848.h; } || | |
2799 | check_header dev/ic/bt8xx.h | |
f8aa696f | 2800 | |
c7682de0 RP |
2801 | check_header sys/soundcard.h |
2802 | check_header soundcard.h | |
deb29777 | 2803 | |
b6f3d925 | 2804 | enabled_any alsa_indev alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound |
35fd8122 | 2805 | |
0e57fe17 | 2806 | enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack |
80ff8a16 | 2807 | |
56a059ac | 2808 | enabled x11grab && |
f58f4ce1 GP |
2809 | check_header X11/Xlib.h && |
2810 | check_header X11/extensions/XShm.h && | |
0a045661 | 2811 | check_header X11/extensions/Xfixes.h && |
f58f4ce1 | 2812 | check_func XOpenDisplay -lX11 && |
781c1aa6 R |
2813 | check_func XShmCreateImage -lX11 -lXext && |
2814 | check_func XFixesGetCursorImage -lX11 -lXext -lXfixes | |
f58f4ce1 | 2815 | |
598ef02b | 2816 | if ! disabled vdpau && enabled vdpau_vdpau_h; then |
deda2a4a AC |
2817 | check_cpp_condition \ |
2818 | vdpau/vdpau.h "defined VDP_DECODER_PROFILE_MPEG4_PART2_ASP" || | |
d1ebd4a9 AC |
2819 | { echolog "Please upgrade to libvdpau >= 0.2 if you would like vdpau support." && |
2820 | disable vdpau; } | |
abf649c7 | 2821 | fi |
deda2a4a | 2822 | |
95e561ec | 2823 | enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel" |
57bd82d4 MR |
2824 | |
2825 | # add some useful compiler flags if supported | |
2826 | check_cflags -Wdeclaration-after-statement | |
dcd479c0 | 2827 | check_cflags -Wall |
440e3b2f | 2828 | check_cflags -Wno-parentheses |
dcd479c0 | 2829 | check_cflags -Wno-switch |
c07bd6a9 MN |
2830 | check_cflags -Wdisabled-optimization |
2831 | check_cflags -Wpointer-arith | |
2832 | check_cflags -Wredundant-decls | |
cc1fb623 | 2833 | check_cflags -Wno-pointer-sign |
f4929996 | 2834 | check_cflags -Wcast-qual |
9aceb3cf | 2835 | check_cflags -Wwrite-strings |
652a5bf6 | 2836 | check_cflags -Wtype-limits |
764551c6 | 2837 | check_cflags -Wundef |
fc298fd9 | 2838 | check_cflags -Wmissing-prototypes |
5af4e0cc | 2839 | enabled extra_warnings && check_cflags -Winline |
cf9d24ad | 2840 | |
57bd82d4 | 2841 | # add some linker flags |
5c0e9479 | 2842 | check_ldflags -Wl,--warn-common |
8351d2ba | 2843 | check_ldflags -Wl,--as-needed |
aac6ca69 | 2844 | check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavcore -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil' |
c2fd6530 | 2845 | check_ldflags -Wl,-Bsymbolic |
94a3401e | 2846 | |
a482e61b | 2847 | echo "X{};" > $TMPV |
b462d132 | 2848 | if test_ldflags -Wl,--version-script,$TMPV; then |
a482e61b | 2849 | append SHFLAGS '-Wl,--version-script,\$(SUBDIR)lib\$(NAME).ver' |
b462d132 MR |
2850 | check_cc <<EOF && enable symver_asm_label |
2851 | void ff_foo(void) __asm__ ("av_foo@VERSION"); | |
0884fadf | 2852 | void ff_foo(void) { ${inline_asm+__asm__($quotes);} } |
b462d132 MR |
2853 | EOF |
2854 | check_cc <<EOF && enable symver_gnu_asm | |
2855 | __asm__(".symver ff_foo,av_foo@VERSION"); | |
2856 | void ff_foo(void) {} | |
2857 | EOF | |
2858 | fi | |
a482e61b | 2859 | |
bd2216e4 | 2860 | if enabled small; then |
14ca9cd0 | 2861 | add_cflags $size_cflags |
8400d6b8 DB |
2862 | optimizations="small" |
2863 | elif enabled optimizations; then | |
14ca9cd0 | 2864 | add_cflags $speed_cflags |
b05394a0 MR |
2865 | else |
2866 | add_cflags $noopt_cflags | |
cddf3f45 | 2867 | fi |
11fdbc44 | 2868 | check_cflags -fno-math-errno |
b2eb2ff0 | 2869 | check_cflags -fno-signed-zeros |
cddf3f45 | 2870 | |
629687f6 | 2871 | if enabled icc; then |
b1598b58 MR |
2872 | # Just warnings, no remarks |
2873 | check_cflags -w1 | |
2874 | # -wd: Disable following warnings | |
2875 | # 144, 167, 556: -Wno-pointer-sign | |
2876 | # 10006: ignoring unknown option -fno-signed-zeros | |
2877 | # 10156: ignoring option '-W'; no argument required | |
dd4a03f7 | 2878 | check_cflags -wd144,167,556,10006,10156 |
b1598b58 MR |
2879 | # 11030: Warning unknown option --as-needed |
2880 | # 10156: ignoring option '-export'; no argument required | |
2881 | check_ldflags -wd10156,11030 | |
2882 | # Allow to compile with optimizations | |
2883 | check_ldflags -march=$cpu | |
be2cf98a CEH |
2884 | # icc 11.0 and 11.1 work with ebp_available, but don't pass the test |
2885 | enable ebp_available | |
df442a8d MR |
2886 | elif enabled ccc; then |
2887 | # disable some annoying warnings | |
2888 | add_cflags -msg_disable cvtu32to64 | |
2889 | add_cflags -msg_disable embedcomment | |
2890 | add_cflags -msg_disable needconstext | |
2891 | add_cflags -msg_disable nomainieee | |
2892 | add_cflags -msg_disable ptrmismatch1 | |
2893 | add_cflags -msg_disable unreachcode | |
973859f5 MR |
2894 | elif enabled gcc; then |
2895 | check_cflags -fno-tree-vectorize | |
765e6134 | 2896 | check_cflags -Werror=implicit-function-declaration |
de63bfec | 2897 | check_cflags -Werror=missing-prototypes |
613a4e3f MR |
2898 | elif enabled llvm_gcc; then |
2899 | check_cflags -mllvm -stack-alignment=16 | |
06da6943 | 2900 | elif enabled clang; then |
5c8ef670 | 2901 | check_cflags -mllvm -stack-alignment=16 |
06da6943 | 2902 | check_cflags -Qunused-arguments |
138132be MR |
2903 | elif enabled armcc; then |
2904 | # 2523: use of inline assembler is deprecated | |
bcafde61 MR |
2905 | add_cflags -W${armcc_opt},--diag_suppress=2523 |
2906 | add_cflags -W${armcc_opt},--diag_suppress=1207 | |
587d24ff MR |
2907 | elif enabled tms470; then |
2908 | add_cflags -pds=824 -pds=837 | |
504a64b9 CEH |
2909 | fi |
2910 | ||
7483e694 DB |
2911 | enabled_any $THREADS_LIST && enable threads |
2912 | ||
2913 | check_deps $CONFIG_LIST \ | |
b6bb00b0 | 2914 | $CONFIG_EXTRA \ |
7483e694 DB |
2915 | $HAVE_LIST \ |
2916 | $DECODER_LIST \ | |
2917 | $ENCODER_LIST \ | |
5666fd73 | 2918 | $HWACCEL_LIST \ |
7483e694 DB |
2919 | $PARSER_LIST \ |
2920 | $BSF_LIST \ | |
2921 | $DEMUXER_LIST \ | |
2922 | $MUXER_LIST \ | |
f7679c54 | 2923 | $FILTER_LIST \ |
7483e694 DB |
2924 | $INDEV_LIST \ |
2925 | $OUTDEV_LIST \ | |
2926 | $PROTOCOL_LIST \ | |
57442411 MR |
2927 | $ACODEC_TESTS \ |
2928 | $VCODEC_TESTS \ | |
2929 | $LAVF_TESTS \ | |
48c28162 | 2930 | $LAVFI_TESTS \ |
b9d5f1b7 | 2931 | $SEEK_TESTS \ |
f70f03f6 | 2932 | |
3bfd582c | 2933 | enabled asm || { arch=c; disable $ARCH_LIST $ARCH_EXT_LIST; } |
c8a4ae00 | 2934 | |
3e89171a | 2935 | echo "install prefix $prefix" |
f36958f8 DB |
2936 | echo "source path $source_path" |
2937 | echo "C compiler $cc" | |
f36958f8 | 2938 | echo "ARCH $arch ($cpu)" |
ce8871c2 MR |
2939 | if test "$build_suffix" != ""; then |
2940 | echo "build suffix $build_suffix" | |
eb94aca9 | 2941 | fi |
ac63af34 DB |
2942 | if test "$extra_version" != ""; then |
2943 | echo "version string suffix $extra_version" | |
2944 | fi | |
0db2ce77 | 2945 | echo "big-endian ${bigendian-no}" |
e90f5b5a | 2946 | echo "runtime cpu detection ${runtime_cpudetect-no}" |
5b6c2cbd | 2947 | if enabled x86; then |
af44e8e4 | 2948 | echo "yasm ${yasm-no}" |
0db2ce77 | 2949 | echo "MMX enabled ${mmx-no}" |
30e98e62 | 2950 | echo "MMX2 enabled ${mmx2-no}" |
3bf96eec | 2951 | echo "3DNow! enabled ${amd3dnow-no}" |
a1ef9f08 | 2952 | echo "3DNow! extended enabled ${amd3dnowext-no}" |
1bb04d5a | 2953 | echo "SSE enabled ${sse-no}" |
30e98e62 | 2954 | echo "SSSE3 enabled ${ssse3-no}" |
0db2ce77 MR |
2955 | echo "CMOV enabled ${cmov-no}" |
2956 | echo "CMOV is fast ${fast_cmov-no}" | |
971cc990 MN |
2957 | echo "EBX available ${ebx_available-no}" |
2958 | echo "EBP available ${ebp_available-no}" | |
d3a4b4e0 | 2959 | echo "10 operands supported ${ten_operands-no}" |
e41e8342 | 2960 | fi |
5b6c2cbd | 2961 | if enabled arm; then |
0db2ce77 MR |
2962 | echo "ARMv5TE enabled ${armv5te-no}" |
2963 | echo "ARMv6 enabled ${armv6-no}" | |
ab5cb084 | 2964 | echo "ARMv6T2 enabled ${armv6t2-no}" |
f55b299a | 2965 | echo "ARM VFP enabled ${armvfp-no}" |
0db2ce77 | 2966 | echo "IWMMXT enabled ${iwmmxt-no}" |
6b18d278 | 2967 | echo "NEON enabled ${neon-no}" |
eba9ae3c | 2968 | fi |
5b6c2cbd | 2969 | if enabled mips; then |
0db2ce77 | 2970 | echo "MMI enabled ${mmi-no}" |
e41e8342 | 2971 | fi |
5b6c2cbd | 2972 | if enabled ppc; then |
0db2ce77 | 2973 | echo "AltiVec enabled ${altivec-no}" |
30e98e62 | 2974 | echo "PPC 4xx optimizations ${ppc4xx-no}" |
0db2ce77 | 2975 | echo "dcbzl available ${dcbzl-no}" |
30e98e62 DB |
2976 | fi |
2977 | if enabled sparc; then | |
2978 | echo "VIS enabled ${vis-no}" | |
e41e8342 | 2979 | fi |
0db2ce77 | 2980 | echo "debug symbols ${debug-no}" |
87a0fb62 | 2981 | echo "strip symbols ${stripping-no}" |
8400d6b8 | 2982 | echo "optimizations ${optimizations-no}" |
0db2ce77 MR |
2983 | echo "static ${static-no}" |
2984 | echo "shared ${shared-no}" | |
4a24ab64 | 2985 | echo "postprocessing support ${postproc-no}" |
f7679c54 | 2986 | echo "new filter support ${avfilter-no}" |
0db2ce77 | 2987 | echo "network support ${network-no}" |
0db2ce77 MR |
2988 | echo "threading support ${thread_type-no}" |
2989 | echo "SDL support ${sdl-no}" | |
0db2ce77 MR |
2990 | echo "Sun medialib support ${mlib-no}" |
2991 | echo "AVISynth enabled ${avisynth-no}" | |
f7b8bffe | 2992 | echo "libdc1394 support ${libdc1394-no}" |
690bfceb | 2993 | echo "libdirac enabled ${libdirac-no}" |
0db2ce77 | 2994 | echo "libfaac enabled ${libfaac-no}" |
0db2ce77 MR |
2995 | echo "libgsm enabled ${libgsm-no}" |
2996 | echo "libmp3lame enabled ${libmp3lame-no}" | |
2997 | echo "libnut enabled ${libnut-no}" | |
0b175caa DB |
2998 | echo "libopencore-amrnb support ${libopencore_amrnb-no}" |
2999 | echo "libopencore-amrwb support ${libopencore_amrwb-no}" | |
9a77d59a | 3000 | echo "libopenjpeg enabled ${libopenjpeg-no}" |
0f943ce6 | 3001 | echo "librtmp enabled ${librtmp-no}" |
f7cd9eed | 3002 | echo "libschroedinger enabled ${libschroedinger-no}" |
ae14f311 | 3003 | echo "libspeex enabled ${libspeex-no}" |
0db2ce77 MR |
3004 | echo "libtheora enabled ${libtheora-no}" |
3005 | echo "libvorbis enabled ${libvorbis-no}" | |
8299a7f8 | 3006 | echo "libvpx enabled ${libvpx-no}" |
d6bd62db | 3007 | echo "libx264 enabled ${libx264-no}" |
de295976 | 3008 | echo "libxavs enabled ${libxavs-no}" |
d6bd62db | 3009 | echo "libxvid enabled ${libxvid-no}" |
0db2ce77 | 3010 | echo "zlib enabled ${zlib-no}" |
f402916e | 3011 | echo "bzlib enabled ${bzlib-no}" |
2c62e737 | 3012 | echo |
de6d9b64 | 3013 | |
5666fd73 | 3014 | for type in decoder encoder hwaccel parser demuxer muxer protocol filter bsf indev outdev; do |
8138b9db | 3015 | echo "Enabled ${type}s:" |
f65c9da1 | 3016 | eval list=\$$(toupper $type)_LIST |
31c0121d | 3017 | print_enabled '_*' $list | sort | pr -3 -t |
f65c9da1 | 3018 | echo |
8138b9db RP |
3019 | done |
3020 | ||
ba7a7039 | 3021 | license="LGPL version 2.1 or later" |
ba321adb | 3022 | if enabled nonfree; then |
ba7a7039 | 3023 | license="nonfree and unredistributable" |
9cad0e4e DB |
3024 | elif enabled gplv3; then |
3025 | license="GPL version 3 or later" | |
3026 | elif enabled lgplv3; then | |
3027 | license="LGPL version 3 or later" | |
ba321adb | 3028 | elif enabled gpl; then |
ba7a7039 | 3029 | license="GPL version 2 or later" |
ba321adb JK |
3030 | fi |
3031 | ||
3032 | echo "License: $license" | |
ca5323af | 3033 | |
cf1392e9 DB |
3034 | echo "Creating config.mak and config.h..." |
3035 | ||
df642790 MR |
3036 | # build tree in object directory if source path is different from current one |
3037 | if enabled source_path_used; then | |
3038 | DIRS=" | |
3039 | doc | |
3040 | libavcodec | |
3041 | libavcodec/$arch | |
aac6ca69 | 3042 | libavcore |
df642790 MR |
3043 | libavdevice |
3044 | libavfilter | |
3045 | libavformat | |
3046 | libavutil | |
3047 | libavutil/$arch | |
3048 | libpostproc | |
3049 | libswscale | |
3050 | libswscale/$arch | |
3051 | tests | |
3052 | tools | |
3053 | " | |
3054 | FILES=" | |
3055 | Makefile | |
3056 | common.mak | |
3057 | subdir.mak | |
3058 | doc/texi2pod.pl | |
3059 | libavcodec/Makefile | |
43f60eba | 3060 | libavcodec/${arch}/Makefile |
aac6ca69 | 3061 | libavcore/Makefile |
df642790 MR |
3062 | libavdevice/Makefile |
3063 | libavfilter/Makefile | |
3064 | libavformat/Makefile | |
3065 | libavutil/Makefile | |
3066 | libpostproc/Makefile | |
3067 | libswscale/Makefile | |
3068 | " | |
e0e335a0 | 3069 | map 'mkdir -p $v' $DIRS; |
43f60eba | 3070 | map 'test -f "$source_path/$v" && $ln_s "$source_path/$v" $v' $FILES |
df642790 MR |
3071 | fi |
3072 | ||
ad212cc6 MR |
3073 | enabled stripping || strip="echo skipping strip" |
3074 | ||
72cfcf41 MR |
3075 | config_files="$TMPH config.mak" |
3076 | ||
173c983b MR |
3077 | cat > config.mak <<EOF |
3078 | # Automatically generated by configure - do not modify! | |
3079 | ifndef FFMPEG_CONFIG_MAK | |
3080 | FFMPEG_CONFIG_MAK=1 | |
3081 | FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION | |
3082 | prefix=$prefix | |
3083 | LIBDIR=\$(DESTDIR)$libdir | |
3084 | SHLIBDIR=\$(DESTDIR)$shlibdir | |
3085 | INCDIR=\$(DESTDIR)$incdir | |
3086 | BINDIR=\$(DESTDIR)$bindir | |
3087 | DATADIR=\$(DESTDIR)$datadir | |
3088 | MANDIR=\$(DESTDIR)$mandir | |
3089 | SRC_PATH="$source_path" | |
3090 | SRC_PATH_BARE=$source_path | |
3091 | BUILD_ROOT="$PWD" | |
bb5cecdc | 3092 | CC_IDENT=$cc_ident |
173c983b MR |
3093 | ARCH=$arch |
3094 | CC=$cc | |
3095 | AS=$as | |
3096 | LD=$ld | |
3097 | DEPCC=$dep_cc | |
3098 | YASM=$yasmexe | |
a4aea515 | 3099 | YASMDEP=$yasmexe |
173c983b MR |
3100 | AR=$ar |
3101 | RANLIB=$ranlib | |
4335125c | 3102 | CP=cp -p |
173c983b MR |
3103 | LN_S=$ln_s |
3104 | STRIP=$strip | |
3105 | CPPFLAGS=$CPPFLAGS | |
3106 | CFLAGS=$CFLAGS | |
3107 | ASFLAGS=$ASFLAGS | |
3108 | CC_O=$CC_O | |
3109 | LDFLAGS=$LDFLAGS | |
3110 | FFSERVERLDFLAGS=$FFSERVERLDFLAGS | |
3111 | SHFLAGS=$SHFLAGS | |
3112 | YASMFLAGS=$YASMFLAGS | |
3113 | BUILDSUF=$build_suffix | |
3114 | FULLNAME=$FULLNAME | |
3115 | LIBPREF=$LIBPREF | |
3116 | LIBSUF=$LIBSUF | |
3117 | LIBNAME=$LIBNAME | |
3118 | SLIBPREF=$SLIBPREF | |
3119 | SLIBSUF=$SLIBSUF | |
3120 | EXESUF=$EXESUF | |
3121 | EXTRA_VERSION=$extra_version | |
3122 | DEPFLAGS=$DEPFLAGS | |
3123 | CCDEP=$CCDEP | |
3124 | ASDEP=$ASDEP | |
3125 | CC_DEPFLAGS=$CC_DEPFLAGS | |
3126 | AS_DEPFLAGS=$AS_DEPFLAGS | |
3127 | HOSTCC=$host_cc | |
3128 | HOSTCFLAGS=$host_cflags | |
3129 | HOSTEXESUF=$HOSTEXESUF | |
3130 | HOSTLDFLAGS=$host_ldflags | |
3131 | HOSTLIBS=$host_libs | |
3132 | TARGET_EXEC=$target_exec | |
3133 | TARGET_PATH=$target_path | |
3134 | SDL_LIBS=$sdl_libs | |
3135 | SDL_CFLAGS=$sdl_cflags | |
3136 | LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD | |
3137 | EXTRALIBS=$extralibs | |
fd676deb | 3138 | INSTALL=install |
1afc4750 MR |
3139 | LIBTARGET=${LIBTARGET} |
3140 | SLIBNAME=${SLIBNAME} | |
3141 | SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION} | |
3142 | SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR} | |
3143 | SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD} | |
3144 | SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD} | |
3145 | SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD} | |
3146 | SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD} | |
2fad0977 | 3147 | SAMPLES=$samples |
173c983b | 3148 | EOF |
5a872801 | 3149 | |
719c8e00 MR |
3150 | get_version(){ |
3151 | name=$1 | |
3152 | file=$source_path/$2 | |
147e7692 MR |
3153 | eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }') |
3154 | eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO | |
0e32c8c6 MR |
3155 | lcname=$(tolower $name) |
3156 | eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak | |
3157 | eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak | |
719c8e00 MR |
3158 | } |
3159 | ||
147e7692 MR |
3160 | get_version LIBSWSCALE libswscale/swscale.h |
3161 | get_version LIBPOSTPROC libpostproc/postprocess.h | |
3162 | get_version LIBAVCODEC libavcodec/avcodec.h | |
aac6ca69 | 3163 | get_version LIBAVCORE libavcore/avcore.h |
147e7692 MR |
3164 | get_version LIBAVDEVICE libavdevice/avdevice.h |
3165 | get_version LIBAVFORMAT libavformat/avformat.h | |
3166 | get_version LIBAVUTIL libavutil/avutil.h | |
a6601d69 | 3167 | get_version LIBAVFILTER libavfilter/avfilter.h |
5a872801 | 3168 | |
173c983b MR |
3169 | cat > $TMPH <<EOF |
3170 | /* Automatically generated by configure - do not modify! */ | |
3171 | #ifndef FFMPEG_CONFIG_H | |
3172 | #define FFMPEG_CONFIG_H | |
3173 | #define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)" | |
c1736936 | 3174 | #define FFMPEG_LICENSE "$(c_escape $license)" |
173c983b MR |
3175 | #define FFMPEG_DATADIR "$(eval c_escape $datadir)" |
3176 | #define CC_TYPE "$cc_type" | |
3177 | #define CC_VERSION $cc_version | |
3178 | #define restrict $_restrict | |
42719e20 | 3179 | #define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\\n\\t" |
173c983b MR |
3180 | #define EXTERN_PREFIX "${extern_prefix}" |
3181 | #define EXTERN_ASM ${extern_prefix} | |
3182 | EOF | |
523ef551 | 3183 | |
4ae40685 MR |
3184 | test -n "$malloc_prefix" && |
3185 | echo "#define MALLOC_PREFIX $malloc_prefix" >>$TMPH | |
3186 | ||
523ef551 | 3187 | if enabled small || disabled optimizations; then |
9a894c48 | 3188 | echo "#undef av_always_inline" >> $TMPH |
523ef551 DB |
3189 | echo "#define av_always_inline" >> $TMPH |
3190 | fi | |
3191 | ||
55127e7b MR |
3192 | if enabled yasm; then |
3193 | append config_files $TMPASM | |
3194 | printf '' >$TMPASM | |
3195 | fi | |
3196 | ||
72cfcf41 MR |
3197 | print_config ARCH_ "$config_files" $ARCH_LIST |
3198 | print_config HAVE_ "$config_files" $HAVE_LIST | |
3199 | print_config CONFIG_ "$config_files" $CONFIG_LIST \ | |
0e5a7b91 MR |
3200 | $CONFIG_EXTRA \ |
3201 | $DECODER_LIST \ | |
3202 | $ENCODER_LIST \ | |
3203 | $HWACCEL_LIST \ | |
3204 | $PARSER_LIST \ | |
3205 | $BSF_LIST \ | |
3206 | $DEMUXER_LIST \ | |
3207 | $MUXER_LIST \ | |
3208 | $FILTER_LIST \ | |
3209 | $PROTOCOL_LIST \ | |
3210 | $INDEV_LIST \ | |
3211 | $OUTDEV_LIST \ | |
8ac17293 | 3212 | |
57442411 MR |
3213 | cat >>config.mak <<EOF |
3214 | ACODEC_TESTS=$(print_enabled -n _test $ACODEC_TESTS) | |
3215 | VCODEC_TESTS=$(print_enabled -n _test $VCODEC_TESTS) | |
3216 | LAVF_TESTS=$(print_enabled -n _test $LAVF_TESTS) | |
48c28162 | 3217 | LAVFI_TESTS=$(print_enabled -n _test $LAVFI_TESTS) |
b9d5f1b7 | 3218 | SEEK_TESTS=$(print_enabled -n _test $SEEK_TESTS) |
57442411 MR |
3219 | EOF |
3220 | ||
9c05103f | 3221 | echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH |
8c6d2da5 | 3222 | echo "endif # FFMPEG_CONFIG_MAK" >> config.mak |
9c05103f | 3223 | |
b7860763 | 3224 | # Do not overwrite an unchanged config.h to avoid superfluous rebuilds. |
c34681df | 3225 | cp_if_changed $TMPH config.h |
d0b8e40c | 3226 | touch .config |
3d204385 | 3227 | |
55127e7b MR |
3228 | enabled yasm && cp_if_changed $TMPASM config.asm |
3229 | ||
a3e02a8c MR |
3230 | cat > $TMPH <<EOF |
3231 | /* Generated by ffconf */ | |
3232 | #ifndef AVUTIL_AVCONFIG_H | |
3233 | #define AVUTIL_AVCONFIG_H | |
3234 | EOF | |
3235 | ||
72cfcf41 | 3236 | print_config AV_HAVE_ $TMPH $HAVE_LIST_PUB |
a3e02a8c MR |
3237 | |
3238 | echo "#endif /* AVUTIL_AVCONFIG_H */" >> $TMPH | |
3239 | ||
3240 | cp_if_changed $TMPH libavutil/avconfig.h | |
3241 | ||
7bfc8ae6 MR |
3242 | test -n "$WARNINGS" && printf "\n$WARNINGS" |
3243 | ||
d0674868 | 3244 | # build pkg-config files |
def4272a | 3245 | |
d0674868 DB |
3246 | pkgconfig_generate(){ |
3247 | name=$1 | |
b0dfd108 | 3248 | shortname=${name#lib}${build_suffix} |
d0674868 DB |
3249 | comment=$2 |
3250 | version=$3 | |
3251 | libs=$4 | |
3252 | requires=$5 | |
1bf75aec | 3253 | enabled ${name#lib} || return 0 |
25cd5cb3 | 3254 | cat <<EOF > $name/$name.pc |
3e89171a | 3255 | prefix=$prefix |
a94e666c | 3256 | exec_prefix=\${prefix} |
f2b7382c | 3257 | libdir=$libdir |
7622778e | 3258 | includedir=$incdir |
def4272a | 3259 | |
d0674868 DB |
3260 | Name: $name |
3261 | Description: $comment | |
3262 | Version: $version | |
8cd6b388 | 3263 | Requires: $(enabled shared || echo $requires) |
5dcfe9f8 | 3264 | Requires.private: $(enabled shared && echo $requires) |
def4272a | 3265 | Conflicts: |
8cd6b388 | 3266 | Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs) |
12701f6e | 3267 | Libs.private: $(enabled shared && echo $libs) |
76a448ed | 3268 | Cflags: -I\${includedir} |
def4272a | 3269 | EOF |
25cd5cb3 | 3270 | cat <<EOF > $name/$name-uninstalled.pc |