Commit | Line | Data |
---|---|---|
de6d9b64 | 1 | #!/bin/sh |
0f3cb305 | 2 | # |
f57620d5 MR |
3 | # FFmpeg configure script |
4 | # | |
5 | # Copyright (c) 2000, 2001, 2002 Fabrice Bellard | |
6 | # Copyright (c) 2005-2006 Diego Biurrun | |
7 | # Copyright (c) 2005-2006 Mans Rullgard | |
0f3cb305 | 8 | # |
cf9d24ad | 9 | |
cde2d79a | 10 | # make sure we are running under a compatible shell |
c21d6325 MR |
11 | # try to make this part work with most shells |
12 | ||
13 | try_exec(){ | |
0dbe81bb | 14 | echo "Trying shell $1" |
c21d6325 MR |
15 | type "$1" >/dev/null 2>&1 && exec "$@" |
16 | } | |
17 | ||
5237ce67 | 18 | unset foo |
0dbe81bb MR |
19 | (: ${foo%%bar}) 2>/dev/null |
20 | E1="$?" | |
21 | ||
22 | (: ${foo?}) 2>/dev/null | |
23 | E2="$?" | |
24 | ||
25 | if test "$E1" != 0 || test "$E2" = 0; then | |
26 | echo "Broken shell detected. Trying alternatives." | |
c21d6325 MR |
27 | export FF_CONF_EXEC |
28 | if test "0$FF_CONF_EXEC" -lt 1; then | |
29 | FF_CONF_EXEC=1 | |
30 | try_exec bash "$0" "$@" | |
31 | fi | |
32 | if test "0$FF_CONF_EXEC" -lt 2; then | |
33 | FF_CONF_EXEC=2 | |
34 | try_exec ksh "$0" "$@" | |
35 | fi | |
36 | if test "0$FF_CONF_EXEC" -lt 3; then | |
37 | FF_CONF_EXEC=3 | |
38 | try_exec /usr/xpg4/bin/sh "$0" "$@" | |
cde2d79a MR |
39 | fi |
40 | echo "No compatible shell script interpreter found." | |
fc53da20 | 41 | echo "This configure script requires a POSIX-compatible shell" |
c21d6325 | 42 | echo "such as bash or ksh." |
505dfb09 DB |
43 | echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH." |
44 | echo "Instead, install a working POSIX-compatible shell." | |
45 | echo "Disabling this configure test will create a broken FFmpeg." | |
c21d6325 MR |
46 | if test "$BASH_VERSION" = '2.04.0(1)-release'; then |
47 | echo "This bash version ($BASH_VERSION) is broken on your platform." | |
48 | echo "Upgrade to a later version if available." | |
49 | fi | |
cde2d79a MR |
50 | exit 1 |
51 | fi | |
52 | ||
74c53c2d MR |
53 | show_help(){ |
54 | echo "Usage: configure [options]" | |
55 | echo "Options: [defaults in brackets after descriptions]" | |
56 | echo | |
57 | echo "Standard options:" | |
58 | echo " --help print this message" | |
2ba042a7 | 59 | echo " --log[=FILE|yes|no] log tests and output to FILE [config.err]" |
2266e085 | 60 | echo " --prefix=PREFIX install in PREFIX [$PREFIX]" |
74c53c2d | 61 | echo " --libdir=DIR install libs in DIR [PREFIX/lib]" |
84c22efd | 62 | echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]" |
74c53c2d MR |
63 | echo " --incdir=DIR install includes in DIR [PREFIX/include/ffmpeg]" |
64 | echo " --mandir=DIR install man page in DIR [PREFIX/man]" | |
74c53c2d MR |
65 | echo " --enable-mingw32 enable MinGW native/cross Windows compile" |
66 | echo " --enable-mingwce enable MinGW native/cross WinCE compile" | |
74c53c2d MR |
67 | echo " --enable-static build static libraries [default=yes]" |
68 | echo " --disable-static do not build static libraries [default=no]" | |
69 | echo " --enable-shared build shared libraries [default=no]" | |
70 | echo " --disable-shared do not build shared libraries [default=yes]" | |
dc922953 DB |
71 | echo " --enable-pp enable GPLed postprocessing support [default=no]" |
72 | echo " --enable-swscaler software scaler support [default=no]" | |
74c53c2d | 73 | echo " --enable-sunmlib use Sun medialib [default=no]" |
e5f94c2b RP |
74 | echo " --enable-beosthreads use BeOS threads [default=no]" |
75 | echo " --enable-os2threads use OS/2 threads [default=no]" | |
74c53c2d | 76 | echo " --enable-pthreads use pthreads [default=no]" |
eb113804 | 77 | echo " --enable-w32threads use Win32 threads [default=no]" |
56a059ac | 78 | echo " --enable-x11grab enable X11 grabbing [default=no]" |
74c53c2d MR |
79 | echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394" |
80 | echo " and libraw1394 [default=no]" | |
dc922953 | 81 | echo " --enable-a52bin open liba52.so.0 at runtime [default=no]" |
8ac17293 | 82 | echo " --enable-avisynth allow reading AVISynth script files [default=no]" |
dc922953 DB |
83 | echo " --enable-dts enable GPLed libdts support [default=no]" |
84 | echo " --enable-faac enable FAAC support via libfaac [default=no]" | |
85 | echo " --enable-faad enable FAAD support via libfaad [default=no]" | |
86 | echo " --enable-faadbin build FAAD support with runtime linking [default=no]" | |
87 | echo " --enable-libgsm enable GSM support via libgsm [default=no]" | |
88 | echo " --enable-mp3lame enable MP3 encoding via libmp3lame [default=no]" | |
31235134 DB |
89 | echo " --enable-libnut enable NUT (de)muxing via libnut," |
90 | echo " native demuxer exists [default=no]" | |
ba5fd8c5 | 91 | echo " --enable-libogg enable Ogg muxing via libogg [default=no]" |
71757822 | 92 | echo " --enable-libtheora enable Theora encoding via libtheora [default=no]" |
31235134 DB |
93 | echo " --enable-vorbis enable Vorbis en/decoding via libvorbis," |
94 | echo " native implementations exist [default=no]" | |
dc922953 | 95 | echo " --enable-x264 enable H.264 encoding via x264 [default=no]" |
31235134 DB |
96 | echo " --enable-xvid enable Xvid encoding via xvidcore," |
97 | echo " native MPEG-4/Xvid encoder exists [default=no]" | |
dc922953 DB |
98 | echo " --enable-amr_nb enable amr_nb float audio codec" |
99 | echo " --enable-amr_nb-fixed use fixed point for amr-nb codec" | |
100 | echo " --enable-amr_wb enable amr_wb float audio codec" | |
101 | echo " --enable-amr_if2 enable amr_wb IF2 audio codec" | |
74c53c2d MR |
102 | echo " --enable-gpl allow use of GPL code, the resulting libav*" |
103 | echo " and ffmpeg will be under GPL [default=no]" | |
104 | echo "" | |
105 | echo "Advanced options (experts only):" | |
106 | echo " --source-path=PATH path to source code [$source_path]" | |
107 | echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]" | |
fac252f9 | 108 | echo " --cross-compile assume a cross-compiler is used" |
74c53c2d MR |
109 | echo " --cc=CC use C compiler CC [$cc]" |
110 | echo " --make=MAKE use specified make [$make]" | |
111 | echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]" | |
112 | echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]" | |
113 | echo " --extra-libs=ELIBS add ELIBS [$ELIBS]" | |
114 | echo " --build-suffix=SUFFIX suffix for application specific build []" | |
cc6a90dd | 115 | echo " --arch=ARCH select architecture [$arch]" |
38d0a8aa GP |
116 | echo " --cpu=CPU selects the minimum cpu required (affects |
117 | instruction selection, may crash on older CPUs)" | |
74c53c2d MR |
118 | echo " --powerpc-perf-enable enable performance report on PPC" |
119 | echo " (requires enabling PMC)" | |
120 | echo " --disable-mmx disable MMX usage" | |
1839e854 | 121 | echo " --disable-armv5te disable armv5te usage" |
edab3048 | 122 | echo " --disable-armv6 disable armv6 usage" |
74c53c2d MR |
123 | echo " --disable-iwmmxt disable iwmmxt usage" |
124 | echo " --disable-altivec disable AltiVec usage" | |
125 | echo " --disable-audio-oss disable OSS audio support [default=no]" | |
126 | echo " --disable-audio-beos disable BeOS audio support [default=no]" | |
127 | echo " --disable-v4l disable video4linux grabbing [default=no]" | |
128 | echo " --disable-v4l2 disable video4linux2 grabbing [default=no]" | |
129 | echo " --disable-bktr disable bktr video grabbing [default=no]" | |
130 | echo " --disable-dv1394 disable DV1394 grabbing [default=no]" | |
131 | echo " --disable-network disable network support [default=no]" | |
0c7bb0e5 | 132 | echo " --disable-ipv6 disable ipv6 support [default=no]" |
74c53c2d | 133 | echo " --disable-zlib disable zlib [default=no]" |
74c53c2d MR |
134 | echo " --disable-vhook disable video hooking support" |
135 | echo " --enable-gprof enable profiling with gprof [$gprof]" | |
136 | echo " --disable-debug disable debugging symbols" | |
137 | echo " --disable-opts disable compiler optimizations" | |
78fcba8f | 138 | echo " --enable-extra-warnings enable more compiler warnings" |
74c53c2d MR |
139 | echo " --disable-mpegaudio-hp faster (but less accurate)" |
140 | echo " MPEG audio decoding [default=no]" | |
141 | echo " --disable-protocols disable I/O protocols support [default=no]" | |
786b30af | 142 | echo " --disable-ffmpeg disable ffmpeg build" |
74c53c2d MR |
143 | echo " --disable-ffserver disable ffserver build" |
144 | echo " --disable-ffplay disable ffplay build" | |
145 | echo " --enable-small optimize for size instead of speed" | |
146 | echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers" | |
147 | echo " --disable-strip disable stripping of executables and shared libraries" | |
148 | echo " --disable-encoder=NAME disables encoder NAME" | |
149 | echo " --enable-encoder=NAME enables encoder NAME" | |
150 | echo " --disable-decoder=NAME disables decoder NAME" | |
151 | echo " --enable-decoder=NAME enables decoder NAME" | |
152 | echo " --disable-encoders disables all encoders" | |
153 | echo " --disable-decoders disables all decoders" | |
ff70e601 MR |
154 | echo " --disable-muxer=NAME disables muxer NAME" |
155 | echo " --enable-muxer=NAME enables muxer NAME" | |
74c53c2d | 156 | echo " --disable-muxers disables all muxers" |
ff70e601 MR |
157 | echo " --disable-demuxer=NAME disables demuxer NAME" |
158 | echo " --enable-demuxer=NAME enables demuxer NAME" | |
74c53c2d | 159 | echo " --disable-demuxers disables all demuxers" |
af9e7d18 MR |
160 | echo " --enable-parser=NAME enables parser NAME" |
161 | echo " --disable-parser=NAME disables parser NAME" | |
162 | echo " --disable-parsers disables all parsers" | |
74c53c2d MR |
163 | echo "" |
164 | echo "NOTE: Object files are built at the place where configure is launched." | |
165 | exit 1 | |
166 | } | |
cf9d24ad | 167 | |
57bd82d4 MR |
168 | log(){ |
169 | echo "$@" >>$logfile | |
170 | } | |
171 | ||
720c69da | 172 | log_file(){ |
c8e9f801 MR |
173 | log BEGIN $1 |
174 | cat -n $1 >>$logfile | |
175 | log END $1 | |
176 | } | |
177 | ||
2ba042a7 | 178 | echolog(){ |
c8e9f801 | 179 | log "$@" |
57bd82d4 | 180 | echo "$@" |
2ba042a7 MR |
181 | } |
182 | ||
183 | die(){ | |
184 | echolog "$@" | |
185 | cat <<EOF | |
186 | If you think configure made a mistake, make sure you are using the latest | |
187 | version from SVN. If the latest version fails, report the problem to the | |
188 | ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net. | |
189 | EOF | |
720c69da | 190 | if enabled logging; then |
2ba042a7 MR |
191 | cat <<EOF |
192 | Include the log file "$logfile" produced by configure as this will help | |
193 | solving the problem. | |
194 | EOF | |
195 | else | |
196 | cat <<EOF | |
197 | Rerun configure with logging enabled (do not use --log=no), and include the | |
198 | log this produces with your report. | |
199 | EOF | |
200 | fi | |
57bd82d4 MR |
201 | rm -f $TMPC $TMPO $TMPE $TMPS $TMPH |
202 | exit 1 | |
203 | } | |
204 | ||
904e48f1 | 205 | # "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z" |
44161118 MR |
206 | toupper(){ |
207 | echo "$@" | tr '[a-z]' '[A-Z]' | |
208 | } | |
209 | ||
a8d04fba MR |
210 | set_all(){ |
211 | value=$1 | |
212 | shift | |
213 | for var in $*; do | |
214 | eval $var=$value | |
215 | done | |
216 | } | |
217 | ||
799c9e9b MR |
218 | pushvar(){ |
219 | for var in $*; do | |
220 | eval level=\${${var}_level:=0} | |
221 | eval ${var}_${level}="\$$var" | |
222 | eval ${var}_level=$(($level+1)) | |
223 | done | |
224 | } | |
225 | ||
226 | popvar(){ | |
227 | for var in $*; do | |
228 | eval level=\${${var}_level:-0} | |
229 | test $level = 0 && continue | |
230 | eval level=$(($level-1)) | |
231 | eval $var="\${${var}_${level}}" | |
232 | eval ${var}_level=$level | |
233 | eval unset ${var}_${level} | |
234 | done | |
235 | } | |
236 | ||
a8d04fba MR |
237 | enable(){ |
238 | set_all yes $* | |
239 | } | |
240 | ||
241 | disable(){ | |
242 | set_all no $* | |
243 | } | |
244 | ||
57bd82d4 | 245 | enabled(){ |
44161118 MR |
246 | eval test "x\$$1" = "xyes" |
247 | } | |
248 | ||
37970ebf RP |
249 | disabled(){ |
250 | eval test "x\$$1" = "xno" | |
251 | } | |
252 | ||
44161118 MR |
253 | enabled_all(){ |
254 | for opt; do | |
255 | enabled $opt || return 1 | |
256 | done | |
257 | } | |
258 | ||
85bca2c5 DB |
259 | disabled_all(){ |
260 | for opt; do | |
261 | disabled $opt || return 1 | |
262 | done | |
263 | } | |
264 | ||
44161118 MR |
265 | enabled_any(){ |
266 | for opt; do | |
267 | enabled $opt && return 0 | |
268 | done | |
269 | } | |
270 | ||
85bca2c5 DB |
271 | disabled_any(){ |
272 | for opt; do | |
273 | disabled $opt && return 0 | |
274 | done | |
275 | } | |
276 | ||
30fd06be MR |
277 | check_deps(){ |
278 | for cfg; do | |
799c9e9b MR |
279 | enabled ${cfg}_checking && die "Circular dependency for $cfg." |
280 | disabled ${cfg}_checking && continue | |
281 | enable ${cfg}_checking | |
282 | ||
30fd06be MR |
283 | eval dep_all="\$${cfg}_deps" |
284 | eval dep_any="\$${cfg}_deps_any" | |
799c9e9b MR |
285 | |
286 | pushvar cfg dep_all dep_any | |
287 | check_deps $dep_all $dep_any | |
288 | popvar cfg dep_all dep_any | |
289 | ||
30fd06be MR |
290 | enabled_all $dep_all || disable $cfg |
291 | enabled_any $dep_any || disable $cfg | |
799c9e9b MR |
292 | |
293 | disable ${cfg}_checking | |
30fd06be MR |
294 | done |
295 | } | |
296 | ||
44161118 MR |
297 | print_config(){ |
298 | pfx=$1 | |
299 | header=$2 | |
300 | makefile=$3 | |
301 | shift 3 | |
302 | for cfg; do | |
303 | if enabled $cfg; then | |
304 | ucname="${pfx}`toupper $cfg`" | |
305 | echo "#define ${ucname} 1" >> $header | |
306 | echo "${ucname}=yes" >> $makefile | |
307 | fi | |
308 | done | |
57bd82d4 MR |
309 | } |
310 | ||
311 | flags_saved(){ | |
312 | (: ${SAVE_CFLAGS?}) 2>/dev/null | |
313 | } | |
314 | ||
dcd479c0 | 315 | save_flags(){ |
57bd82d4 | 316 | flags_saved && return |
dcd479c0 MR |
317 | SAVE_CFLAGS="$CFLAGS" |
318 | SAVE_LDFLAGS="$LDFLAGS" | |
319 | SAVE_extralibs="$extralibs" | |
320 | } | |
321 | ||
322 | restore_flags(){ | |
f5d28d10 | 323 | flags_saved || return |
dcd479c0 MR |
324 | CFLAGS="$SAVE_CFLAGS" |
325 | LDFLAGS="$SAVE_LDFLAGS" | |
326 | extralibs="$SAVE_extralibs" | |
327 | unset SAVE_CFLAGS | |
328 | unset SAVE_LDFLAGS | |
329 | unset SAVE_extralibs | |
330 | } | |
331 | ||
332 | temp_cflags(){ | |
333 | save_flags | |
334 | CFLAGS="$CFLAGS $*" | |
335 | } | |
336 | ||
337 | temp_ldflags(){ | |
338 | save_flags | |
339 | LDFLAGS="$LDFLAGS $*" | |
340 | } | |
341 | ||
342 | temp_extralibs(){ | |
343 | save_flags | |
344 | extralibs="$extralibs $*" | |
345 | } | |
346 | ||
57bd82d4 MR |
347 | append(){ |
348 | var=$1 | |
349 | shift | |
350 | flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\"" | |
351 | eval "$var=\"\$$var $*\"" | |
352 | } | |
353 | ||
354 | add_cflags(){ | |
355 | append CFLAGS "$@" | |
356 | } | |
357 | ||
358 | add_ldflags(){ | |
359 | append LDFLAGS "$@" | |
360 | } | |
361 | ||
362 | add_extralibs(){ | |
363 | append extralibs "$@" | |
364 | } | |
365 | ||
b0cfb663 | 366 | check_cmd(){ |
b3cb5d51 | 367 | log "$@" |
9b4f605c | 368 | "$@" >>$logfile 2>&1 |
b0cfb663 MR |
369 | } |
370 | ||
dcd479c0 | 371 | check_cc(){ |
57bd82d4 MR |
372 | log check_cc "$@" |
373 | cat >$TMPC | |
720c69da | 374 | log_file $TMPC |
b0cfb663 | 375 | check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC |
57bd82d4 MR |
376 | } |
377 | ||
378 | check_cpp(){ | |
379 | log check_cpp "$@" | |
dcd479c0 | 380 | cat >$TMPC |
720c69da | 381 | log_file $TMPC |
b0cfb663 | 382 | check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC |
dcd479c0 MR |
383 | } |
384 | ||
385 | check_ld(){ | |
57bd82d4 | 386 | log check_ld "$@" |
0607887f | 387 | check_cc || return |
b0cfb663 | 388 | check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs |
dcd479c0 MR |
389 | } |
390 | ||
391 | check_cflags(){ | |
57bd82d4 MR |
392 | log check_cflags "$@" |
393 | check_cc "$@" <<EOF && add_cflags "$@" | |
dcd479c0 MR |
394 | int x; |
395 | EOF | |
396 | } | |
397 | ||
398 | check_ldflags(){ | |
57bd82d4 MR |
399 | log check_ldflags "$@" |
400 | check_ld "$@" <<EOF && add_ldflags "$@" | |
401 | int main(){ | |
402 | return 0; | |
403 | } | |
dcd479c0 MR |
404 | EOF |
405 | } | |
406 | ||
407 | check_header(){ | |
57bd82d4 | 408 | log check_header "$@" |
dcd479c0 MR |
409 | header=$1 |
410 | shift | |
57bd82d4 | 411 | check_cpp "$@" <<EOF |
dcd479c0 MR |
412 | #include <$header> |
413 | int x; | |
414 | EOF | |
0701ca7f | 415 | err=$? |
0dbe81bb | 416 | var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` |
0701ca7f MR |
417 | test "$err" = 0 && enable $var || disable $var |
418 | return $err | |
dcd479c0 MR |
419 | } |
420 | ||
421 | check_func(){ | |
57bd82d4 | 422 | log check_func "$@" |
dcd479c0 MR |
423 | func=$1 |
424 | shift | |
425 | check_ld "$@" <<EOF | |
426 | extern int $func(); | |
427 | int main(){ | |
428 | $func(); | |
429 | } | |
430 | EOF | |
0701ca7f MR |
431 | err=$? |
432 | test "$err" = 0 && enable $func || disable $func | |
433 | return $err | |
dcd479c0 MR |
434 | } |
435 | ||
57bd82d4 MR |
436 | check_lib(){ |
437 | log check_lib "$@" | |
438 | header="$1" | |
439 | func="$2" | |
440 | shift 2 | |
441 | temp_extralibs "$@" | |
442 | check_header $header && check_func $func && add_extralibs "$@" | |
443 | err=$? | |
444 | restore_flags | |
445 | return $err | |
446 | } | |
447 | ||
dcd479c0 | 448 | check_exec(){ |
90be59ef | 449 | check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; } |
57bd82d4 MR |
450 | } |
451 | ||
452 | require(){ | |
453 | name="$1" | |
454 | header="$2" | |
455 | func="$3" | |
456 | shift 3 | |
457 | check_lib $header $func "$@" || die "ERROR: $name not found" | |
dcd479c0 MR |
458 | } |
459 | ||
c505dd31 MR |
460 | apply(){ |
461 | file=$1 | |
462 | shift | |
463 | "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp" | |
464 | } | |
465 | ||
c88f5d72 MR |
466 | CONFIG_LIST=' |
467 | encoders | |
468 | decoders | |
469 | parsers | |
470 | muxers | |
471 | demuxers | |
c88f5d72 MR |
472 | amr |
473 | amr_nb | |
474 | amr_nb_fixed | |
475 | amr_wb | |
476 | audio_beos | |
477 | audio_oss | |
478 | avisynth | |
479 | beos_netserver | |
480 | bktr | |
481 | dc1394 | |
c88f5d72 | 482 | dv1394 |
c88f5d72 MR |
483 | ffmpeg |
484 | ffplay | |
485 | ffserver | |
486 | gpl | |
ecfc4f44 | 487 | gprof |
c88f5d72 | 488 | ipv6 |
f8904fd9 | 489 | liba52bin |
3ffab361 | 490 | libdts |
2eed5a46 DB |
491 | libfaac |
492 | libfaad | |
493 | libfaadbin | |
c88f5d72 | 494 | libgsm |
6ebe07fb | 495 | libmp3lame |
c88f5d72 MR |
496 | libnut |
497 | libogg | |
150d2772 | 498 | libtheora |
c88f5d72 MR |
499 | libvorbis |
500 | memalign_hack | |
c88f5d72 MR |
501 | mpegaudio_hp |
502 | network | |
503 | pp | |
504 | protocols | |
505 | swscaler | |
506 | vhook | |
507 | video4linux | |
508 | video4linux2 | |
860391a5 | 509 | wince |
56a059ac | 510 | x11grab |
c88f5d72 MR |
511 | x264 |
512 | xvid | |
513 | zlib | |
514 | ' | |
515 | ||
516 | HAVE_LIST=' | |
1ac9331a | 517 | altivec |
c88f5d72 | 518 | altivec_h |
1ac9331a | 519 | armv5te |
edab3048 | 520 | armv6 |
b265431e | 521 | beosthreads |
c88f5d72 | 522 | byteswap_h |
1ac9331a | 523 | cmov |
c88f5d72 | 524 | dcbzl |
f8aa696f DB |
525 | dev_bktr_ioctl_bt848_h |
526 | dev_bktr_ioctl_meteor_h | |
527 | dev_ic_bt8xx_h | |
528 | dev_video_meteor_ioctl_meteor_h | |
529 | dev_video_bktr_ioctl_bt848_h | |
18b67ae5 | 530 | dlfcn_h |
c88f5d72 | 531 | dlopen |
7073e9fc | 532 | fast_cmov |
c88f5d72 | 533 | freetype2 |
c88f5d72 | 534 | imlib2 |
2e1913b1 | 535 | inet_aton |
1ac9331a | 536 | iwmmxt |
c88f5d72 MR |
537 | localtime_r |
538 | lrintf | |
f8aa696f DB |
539 | machine_ioctl_bt848_h |
540 | machine_ioctl_meteor_h | |
c88f5d72 MR |
541 | malloc_h |
542 | memalign | |
543 | mlib | |
1ac9331a MR |
544 | mmi |
545 | mmx | |
9c914398 | 546 | os2 |
b265431e MR |
547 | os2threads |
548 | pthreads | |
c88f5d72 MR |
549 | sdl |
550 | sdl_video_size | |
deb29777 MR |
551 | soundcard_h |
552 | sys_soundcard_h | |
b265431e MR |
553 | threads |
554 | w32threads | |
c88f5d72 | 555 | ' |
44161118 | 556 | |
1ac9331a MR |
557 | TARGET_LIST=' |
558 | altivec | |
559 | armv5te | |
51e8750a | 560 | armv6 |
1ac9331a MR |
561 | iwmmxt |
562 | mmi | |
563 | mmx | |
564 | ' | |
565 | ||
30fd06be | 566 | flashsv_decoder_deps="zlib" |
773be23a | 567 | flashsv_encoder_deps="zlib" |
30fd06be MR |
568 | mpeg_xvmc_decoder_deps="xvmc" |
569 | png_decoder_deps="zlib" | |
570 | png_encoder_deps="zlib" | |
571 | x264_encoder_deps="x264" | |
572 | xvid_encoder_deps="xvid" | |
573 | zmbv_decoder_deps="zlib" | |
574 | zmbv_encoder_deps="zlib" | |
575 | ||
576 | aac_decoder_deps="libfaad" | |
577 | mpeg4aac_decoder_deps="libfaad" | |
30fd06be MR |
578 | amr_nb_decoder_deps_any="amr_nb amr_nb_fixed" |
579 | amr_nb_encoder_deps_any="amr_nb amr_nb_fixed" | |
580 | amr_wb_decoder_deps="amr_wb" | |
581 | amr_wb_encoder_deps="amr_wb" | |
582 | dts_decoder_deps="libdts" | |
583 | faac_encoder_deps="libfaac" | |
f4ca5079 | 584 | liba52bin_decoder_deps="liba52" |
299c77d5 MR |
585 | libgsm_decoder_deps="libgsm" |
586 | libgsm_encoder_deps="libgsm" | |
150d2772 | 587 | libtheora_encoder_deps="libtheora" |
30fd06be MR |
588 | mp3lame_encoder_deps="libmp3lame" |
589 | oggvorbis_decoder_deps="libvorbis" | |
590 | oggvorbis_encoder_deps="libvorbis" | |
591 | ||
592 | audio_demuxer_deps_any="audio_oss audio_beos" | |
593 | audio_muxer_deps_any="audio_oss audio_beos" | |
594 | dc1394_demuxer_deps="dc1394" | |
595 | dv1394_demuxer_deps="dv1394" | |
596 | gxf_muxer_deps="gpl" | |
d7c59247 DB |
597 | libnut_demuxer_deps="libnut" |
598 | libnut_muxer_deps="libnut" | |
30fd06be MR |
599 | ogg_muxer_deps="libogg" |
600 | redir_demuxer_deps="network" | |
601 | rtp_muxer_deps="network" | |
602 | rtsp_demuxer_deps="network" | |
603 | sdp_demuxer_deps="network" | |
604 | v4l2_demuxer_deps="video4linux2" | |
3fb2ff0b | 605 | video_grab_device_demuxer_deps_any="video4linux bktr" |
30fd06be MR |
606 | x11_grab_device_demuxer_deps="x11grab" |
607 | ||
fa859b4d | 608 | ffplay_deps="sdl" |
a2830dca | 609 | ffserver_deps="network protocols muxers" |
f6f69c30 | 610 | network_deps="protocols" |
a2830dca | 611 | |
0f3cb305 | 612 | # set temporary file name |
57514323 | 613 | if test ! -z "$TMPDIR" ; then |
0f3cb305 | 614 | TMPDIR1="${TMPDIR}" |
57514323 | 615 | elif test ! -z "$TEMPDIR" ; then |
0f3cb305 | 616 | TMPDIR1="${TEMPDIR}" |
3d204385 | 617 | else |
0f3cb305 | 618 | TMPDIR1="/tmp" |
3d204385 NK |
619 | fi |
620 | ||
0f3cb305 FB |
621 | TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c" |
622 | TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o" | |
f3ec2d46 | 623 | TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}" |
0f3cb305 FB |
624 | TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S" |
625 | TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h" | |
626 | ||
de6d9b64 | 627 | # default parameters |
8a608357 | 628 | |
720c69da | 629 | logging="yes" |
2ba042a7 | 630 | logfile="config.err" |
8a608357 MR |
631 | |
632 | # installation paths | |
2266e085 DB |
633 | PREFIX="/usr/local" |
634 | libdir='${PREFIX}/lib' | |
84c22efd | 635 | shlibdir="$libdir" |
2266e085 DB |
636 | incdir='${PREFIX}/include/ffmpeg' |
637 | mandir='${PREFIX}/man' | |
638 | bindir='${PREFIX}/bin' | |
8a608357 MR |
639 | |
640 | # toolchain | |
0f3cb305 | 641 | cross_prefix="" |
fac252f9 | 642 | cross_compile="no" |
de6d9b64 FB |
643 | cc="gcc" |
644 | ar="ar" | |
be7109c1 | 645 | ranlib="ranlib" |
4a908fbc | 646 | make="make" |
0f3cb305 | 647 | strip="strip" |
8a608357 MR |
648 | asmalign_pot="unknown" |
649 | ||
650 | # machine | |
cc6a90dd | 651 | arch=`uname -m` |
38d0a8aa | 652 | cpu="generic" |
e45a2872 | 653 | powerpc_perf="no" |
0f3cb305 | 654 | mmx="default" |
e7768fc5 | 655 | cmov="no" |
7073e9fc | 656 | fast_cmov="no" |
1839e854 | 657 | armv5te="default" |
edab3048 | 658 | armv6="default" |
eba9ae3c | 659 | iwmmxt="default" |
ab6c65f6 | 660 | altivec="default" |
87ea51e0 | 661 | dcbzl="no" |
d46aba26 | 662 | mmi="default" |
8a608357 MR |
663 | bigendian="no" |
664 | ||
cc6a90dd | 665 | case "$arch" in |
ef0bc4c9 | 666 | i386|i486|i586|i686|i86pc|BePC) |
419b8784 | 667 | arch="x86_32" |
de6d9b64 | 668 | ;; |
7bf9648e | 669 | x86_64|amd64) |
a63e5f1c | 670 | arch="x86_32" |
32255f6c | 671 | canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`" |
7bf9648e JM |
672 | if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then |
673 | if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then | |
cc6a90dd | 674 | arch="x86_64" |
7bf9648e | 675 | fi |
053dea12 AJ |
676 | fi |
677 | ;; | |
6dc7b6b3 DB |
678 | # armv4l is a subset of armv[567]*l |
679 | arm|armv[4567]*l) | |
cc6a90dd | 680 | arch="armv4l" |
6ed7422a | 681 | ;; |
91d1f1a4 | 682 | alpha) |
cc6a90dd | 683 | arch="alpha" |
91d1f1a4 | 684 | ;; |
2645e80f | 685 | "Power Macintosh"|ppc|ppc64|powerpc) |
cc6a90dd | 686 | arch="powerpc" |
90cee0c3 | 687 | ;; |
b028a866 | 688 | mips|mipsel|IP*) |
cc6a90dd | 689 | arch="mips" |
d46aba26 | 690 | ;; |
bb476ff3 | 691 | sun4u|sparc64) |
cc6a90dd | 692 | arch="sparc64" |
a7beab73 | 693 | ;; |
bb476ff3 | 694 | sparc) |
cc6a90dd | 695 | arch="sparc" |
bb476ff3 | 696 | ;; |
bdb2e37c | 697 | sh4) |
cc6a90dd | 698 | arch="sh4" |
bdb2e37c | 699 | ;; |
67860b26 | 700 | parisc|parisc64) |
cc6a90dd | 701 | arch="parisc" |
67860b26 SH |
702 | ;; |
703 | s390|s390x) | |
cc6a90dd | 704 | arch="s390" |
67860b26 SH |
705 | ;; |
706 | m68k) | |
cc6a90dd | 707 | arch="m68k" |
67860b26 SH |
708 | ;; |
709 | ia64) | |
cc6a90dd | 710 | arch="ia64" |
67860b26 | 711 | ;; |
81a9b052 | 712 | bfin) |
cc6a90dd | 713 | arch="bfin" |
81a9b052 | 714 | ;; |
de6d9b64 | 715 | *) |
cc6a90dd | 716 | arch="unknown" |
de6d9b64 FB |
717 | ;; |
718 | esac | |
8a608357 MR |
719 | |
720 | # OS | |
721 | beos_netserver="no" | |
722 | mingw32="no" | |
723 | os2="no" | |
724 | wince="no" | |
725 | ||
726 | # non-library system interfaces | |
dfdfa47c | 727 | audio_beos="no" |
8a608357 | 728 | audio_oss="yes" |
3eac5c63 | 729 | bktr="yes" |
8aa3ee32 | 730 | dv1394="yes" |
8a608357 MR |
731 | video4linux2="yes" |
732 | video4linux="yes" | |
733 | ||
734 | # libraries | |
735 | amr_if2="no" | |
736 | amr_nb="no" | |
737 | amr_nb_fixed="no" | |
738 | amr_wb="no" | |
739 | avisynth="no" | |
f02be79d | 740 | dc1394="no" |
8a608357 MR |
741 | dlfcn_h="no" |
742 | dlopen="no" | |
f8904fd9 | 743 | liba52bin="no" |
dc922953 | 744 | libdts="no" |
2eed5a46 | 745 | libfaac="no" |
a2234ceb | 746 | libfaad2="no" |
8a608357 | 747 | libfaad="no" |
2eed5a46 | 748 | libfaadbin="no" |
bb4c2140 | 749 | libgsm="no" |
6ebe07fb | 750 | libmp3lame="no" |
f956e129 | 751 | libnut="no" |
9146ca37 | 752 | libogg="no" |
150d2772 | 753 | libtheora="no" |
be74741c | 754 | libvorbis="no" |
8a608357 MR |
755 | mlib="no" |
756 | x11grab="no" | |
6662ec29 | 757 | x264="no" |
8a608357 MR |
758 | xvid="no" |
759 | zlib="yes" | |
760 | ||
761 | # configurable options | |
cddf3f45 | 762 | debug="yes" |
65d1bea2 | 763 | dostrip="yes" |
5af4e0cc | 764 | extra_warnings="no" |
8a608357 MR |
765 | ffmpeg="yes" |
766 | ffplay="yes" | |
767 | ffserver="yes" | |
768 | gpl="no" | |
769 | gprof="no" | |
770 | ipv6="yes" | |
5af4e0cc MR |
771 | shared="no" |
772 | static="yes" | |
8a608357 | 773 | memalign_hack="no" |
1eb2212e | 774 | mpegaudio_hp="yes" |
8a608357 MR |
775 | network="yes" |
776 | optimize="yes" | |
777 | pp="no" | |
778 | protocols="yes" | |
779 | swscaler="no" | |
780 | vhook="default" | |
781 | ||
782 | # threading | |
783 | beosthreads="no" | |
784 | os2threads="no" | |
785 | pthreads="no" | |
786 | w32threads="no" | |
787 | thread_type="no" | |
788 | ||
789 | # build settings | |
790 | extralibs="-lm" | |
baa3a937 | 791 | SHFLAGS='-shared -Wl,-soname,$@' |
cab3ef82 | 792 | VHOOKSHFLAGS='$(SHFLAGS)' |
80581e98 | 793 | LIBOBJFLAGS="" |
e89b8b0a | 794 | FFLDFLAGS=-Wl,--warn-common |
e240ee67 | 795 | LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil' |
c536cb09 | 796 | FFSERVERLDFLAGS=-Wl,-E |
f39e56a8 | 797 | LDCONFIG="ldconfig" |
f3ec2d46 SG |
798 | LIBPREF="lib" |
799 | LIBSUF=".a" | |
4bdd05e7 | 800 | LIB='$(LIBPREF)$(NAME)$(LIBSUF)' |
f3ec2d46 SG |
801 | SLIBPREF="lib" |
802 | SLIBSUF=".so" | |
4bdd05e7 | 803 | SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)' |
b29bddab DB |
804 | SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)' |
805 | SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)' | |
951bf3e6 | 806 | EXESUF="" |
eb94aca9 | 807 | BUILDSUF="" |
d4596ae3 | 808 | LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"' |
ef0bc4c9 FR |
809 | |
810 | # OS specific | |
811 | targetos=`uname -s` | |
812 | case $targetos in | |
74cec57d FR |
813 | BeOS|Haiku|Zeta) |
814 | PREFIX="$HOME/config" | |
d474299a MR |
815 | # helps building libavcodec |
816 | add_cflags "-DPIC -fomit-frame-pointer" | |
817 | # 3 gcc releases known for BeOS, each with ugly bugs | |
818 | gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`" | |
819 | case "$gcc_version" in | |
820 | 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc" | |
821 | mmx="no" | |
822 | ;; | |
823 | *20010315*) echo "BeBits gcc" | |
824 | add_cflags "-fno-expensive-optimizations" | |
825 | ;; | |
826 | esac | |
74cec57d | 827 | LDCONFIG="echo ignoring ldconfig" |
d474299a MR |
828 | SHFLAGS=-nostart |
829 | # disable Linux things | |
d474299a MR |
830 | dv1394="no" |
831 | # enable BeOS things | |
832 | audio_beos="yes" | |
833 | # no need for libm, but the inet stuff | |
834 | # Check for BONE | |
74cec57d | 835 | # XXX: actually should check for NOT net_server |
d474299a MR |
836 | if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then |
837 | extralibs="-lbind -lsocket" | |
838 | else | |
839 | beos_netserver="yes" | |
840 | extralibs="-lnet" | |
841 | fi ;; | |
842 | SunOS) | |
d474299a | 843 | dv1394="no" |
d474299a MR |
844 | FFLDFLAGS="" |
845 | FFSERVERLDFLAGS="" | |
846 | SHFLAGS="-shared -Wl,-h,\$@" | |
847 | add_extralibs "-lsocket -lnsl" | |
848 | ;; | |
849 | NetBSD) | |
d474299a | 850 | dv1394="no" |
d474299a MR |
851 | add_extralibs "-lossaudio" |
852 | ;; | |
853 | OpenBSD) | |
d474299a MR |
854 | dv1394="no" |
855 | need_memalign="no" | |
d474299a MR |
856 | LIBOBJFLAGS="\$(PIC)" |
857 | LDCONFIG="ldconfig -m \$(shlibdir)" | |
858 | SHFLAGS='-shared' | |
859 | SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF).$(LIBVERSION)' | |
860 | SLIBNAME_WITH_VERSION='$(SLIBNAME)' | |
861 | SLIBNAME_WITH_MAJOR='$(SLIBNAME)' | |
862 | add_extralibs "-lossaudio" | |
863 | ;; | |
864 | FreeBSD) | |
d474299a | 865 | dv1394="no" |
d474299a MR |
866 | need_memalign="no" |
867 | add_cflags "-pthread" | |
868 | ;; | |
869 | GNU/kFreeBSD) | |
d474299a MR |
870 | dv1394="no" |
871 | add_cflags "-pthread" | |
872 | ;; | |
873 | BSD/OS) | |
d474299a MR |
874 | dv1394="no" |
875 | extralibs="-lpoll -lgnugetopt -lm" | |
d474299a MR |
876 | strip="strip -d" |
877 | ;; | |
878 | Darwin) | |
879 | cc="cc" | |
d474299a MR |
880 | dv1394="no" |
881 | need_memalign="no" | |
882 | SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(shlibdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION) -Wl,-read_only_relocs,suppress" | |
883 | VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(shlibdir)/vhook/$@' | |
884 | extralibs="" | |
885 | strip="strip -x" | |
886 | FFLDFLAGS="-Wl,-dynamic,-search_paths_first" | |
887 | SLIBSUF=".dylib" | |
888 | SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)' | |
889 | SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)' | |
890 | FFSERVERLDFLAGS=-Wl,-bind_at_load | |
891 | ;; | |
892 | MINGW32*) | |
893 | # Note: the rest of the mingw32 config is done afterwards as mingw32 | |
894 | # can be forced on the command line for Linux cross compilation. | |
895 | mingw32="yes" | |
896 | ;; | |
897 | CYGWIN*) | |
898 | targetos=CYGWIN | |
899 | shlibdir="$bindir" | |
d474299a MR |
900 | dv1394="no" |
901 | VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil' | |
902 | VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)' | |
903 | extralibs="" | |
904 | EXESUF=".exe" | |
905 | SLIBPREF="cyg" | |
906 | SLIBSUF=".dll" | |
907 | SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)' | |
908 | SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)' | |
909 | SHFLAGS='-shared -Wl,--out-implib=lib$(NAME).dll.a' | |
910 | ;; | |
911 | Linux) | |
912 | LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS" | |
913 | ;; | |
914 | IRIX*) | |
915 | targetos=IRIX | |
916 | ranlib="echo ignoring ranlib" | |
d474299a MR |
917 | ;; |
918 | OS/2) | |
919 | TMPE=$TMPE".exe" | |
920 | ar="emxomfar -p128" | |
921 | ranlib="echo ignoring ranlib" | |
922 | strip="echo ignoring strip" | |
923 | add_cflags "-Zomf" | |
924 | FFLDFLAGS="-Zomf -Zstack 16384 -s" | |
925 | SHFLAGS="-Zdll -Zomf" | |
926 | FFSERVERLDFLAGS="" | |
927 | LIBPREF="" | |
928 | LIBSUF=".lib" | |
929 | SLIBPREF="" | |
930 | SLIBSUF=".dll" | |
931 | EXESUF=".exe" | |
932 | extralibs="" | |
933 | pkg_requires="" | |
d474299a MR |
934 | dv1394="no" |
935 | ffserver="no" | |
936 | vhook="no" | |
937 | os2="yes" | |
938 | ;; | |
939 | *) | |
940 | targetos="${targetos}-UNKNOWN" | |
941 | ;; | |
ef0bc4c9 | 942 | esac |
de6d9b64 | 943 | |
0f3cb305 | 944 | # find source path |
997baf01 | 945 | source_path="`dirname \"$0\"`" |
0f3cb305 FB |
946 | source_path_used="yes" |
947 | if test -z "$source_path" -o "$source_path" = "." ; then | |
997baf01 | 948 | source_path="`pwd`" |
0f3cb305 | 949 | source_path_used="no" |
e7a4dafb MR |
950 | else |
951 | source_path="`cd \"$source_path\"; pwd`" | |
997baf01 MR |
952 | echo "$source_path" | grep -q '[[:blank:]]' && |
953 | die "Out of tree builds are impossible with whitespace in source path." | |
de6d9b64 FB |
954 | fi |
955 | ||
7d6ed4aa MR |
956 | if test x"$1" = x"-h" -o x"$1" = x"--help" ; then |
957 | show_help | |
958 | fi | |
959 | ||
e6819061 | 960 | FFMPEG_CONFIGURATION="$@" |
f255e0ab | 961 | |
f3902026 AJ |
962 | ENCODER_LIST=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"` |
963 | DECODER_LIST=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"` | |
964 | PARSER_LIST=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"` | |
5b9b3b68 AJ |
965 | MUXER_LIST=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"` |
966 | DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"` | |
009cf97d | 967 | |
a8d04fba MR |
968 | enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST |
969 | ||
de6d9b64 | 970 | for opt do |
fce53524 | 971 | optval="${opt#*=}" |
de6d9b64 | 972 | case "$opt" in |
2ba042a7 MR |
973 | --log) |
974 | ;; | |
fce53524 | 975 | --log=*) logging="$optval" |
57bd82d4 | 976 | ;; |
e48dc873 | 977 | --prefix=*) PREFIX="$optval" |
de6d9b64 | 978 | ;; |
e48dc873 | 979 | --libdir=*) libdir="$optval" |
cc973ecb | 980 | ;; |
84c22efd DB |
981 | --shlibdir=*) shlibdir="$optval" |
982 | ;; | |
fce53524 | 983 | --incdir=*) incdir="$optval" |
1d67a1d4 | 984 | ;; |
fce53524 | 985 | --mandir=*) mandir="$optval" |
23a65308 | 986 | ;; |
fce53524 | 987 | --source-path=*) source_path="$optval" |
0f3cb305 | 988 | ;; |
fce53524 | 989 | --cross-prefix=*) cross_prefix="$optval" |
0f3cb305 | 990 | ;; |
4b62f9f9 | 991 | --cross-compile) cross_compile="yes" |
fac252f9 | 992 | ;; |
fce53524 | 993 | --cc=*) cc="$optval" |
de6d9b64 | 994 | ;; |
fce53524 | 995 | --make=*) make="$optval" |
4a908fbc | 996 | ;; |
30a3e5d4 | 997 | --extra-cflags=*) add_cflags "$optval" |
0f3cb305 | 998 | ;; |
28d8e661 | 999 | --extra-ldflags=*) add_ldflags "$optval" |
0f3cb305 | 1000 | ;; |
28d8e661 | 1001 | --extra-libs=*) add_extralibs "$optval" |
0f3cb305 | 1002 | ;; |
fce53524 | 1003 | --build-suffix=*) BUILDSUF="$optval" |
eb94aca9 | 1004 | ;; |
cc6a90dd | 1005 | --arch=*) arch="$optval" |
de6d9b64 | 1006 | ;; |
38d0a8aa | 1007 | --cpu=*) cpu="$optval" |
a4adb608 | 1008 | ;; |
e45a2872 RD |
1009 | --powerpc-perf-enable) powerpc_perf="yes" |
1010 | ;; | |
de6d9b64 FB |
1011 | --disable-mmx) mmx="no" |
1012 | ;; | |
1839e854 SS |
1013 | --disable-armv5te) armv5te="no" |
1014 | ;; | |
edab3048 MR |
1015 | --disable-armv6) armv6="no" |
1016 | ;; | |
eba9ae3c GB |
1017 | --disable-iwmmxt) iwmmxt="no" |
1018 | ;; | |
ab6c65f6 BF |
1019 | --disable-altivec) altivec="no" |
1020 | ;; | |
de6d9b64 FB |
1021 | --enable-gprof) gprof="yes" |
1022 | ;; | |
9d2a0f1c | 1023 | --disable-v4l) video4linux="no" |
5cbcf02c | 1024 | ;; |
9d2a0f1c | 1025 | --disable-v4l2) video4linux2="no" |
0a7b514f | 1026 | ;; |
6beefa40 MN |
1027 | --disable-bktr) bktr="no" |
1028 | ;; | |
5cbcf02c FB |
1029 | --disable-audio-oss) audio_oss="no" |
1030 | ;; | |
dfdfa47c FR |
1031 | --disable-audio-beos) audio_beos="no" |
1032 | ;; | |
8aa3ee32 MK |
1033 | --disable-dv1394) dv1394="no" |
1034 | ;; | |
a2830dca | 1035 | --disable-network) network="no" |
5cbcf02c | 1036 | ;; |
4b62f9f9 | 1037 | --disable-ipv6) ipv6="no" |
0c7bb0e5 | 1038 | ;; |
0147f198 FR |
1039 | --disable-zlib) zlib="no" |
1040 | ;; | |
0900a85f | 1041 | --enable-a52bin) liba52bin="yes" |
57514323 | 1042 | ;; |
3ffab361 | 1043 | --enable-dts) libdts="yes" |
23c99253 | 1044 | ;; |
ba9261e5 | 1045 | --enable-pp) pp="yes" |
bba9b16c | 1046 | ;; |
bb4c2140 MN |
1047 | --enable-libgsm) libgsm="yes" |
1048 | ;; | |
6ebe07fb | 1049 | --enable-mp3lame) libmp3lame="yes" |
a6741398 | 1050 | ;; |
f956e129 OS |
1051 | --enable-libnut) libnut="yes" |
1052 | ;; | |
9146ca37 | 1053 | --enable-libogg) libogg="yes" |
5c5dea3f | 1054 | ;; |
150d2772 | 1055 | --enable-libtheora) libtheora="yes" |
150d2772 | 1056 | ;; |
be74741c | 1057 | --enable-vorbis) libvorbis="yes" |
81e0d0b4 | 1058 | ;; |
2eed5a46 | 1059 | --enable-faad) libfaad="yes" |
445ad18d | 1060 | ;; |
2eed5a46 | 1061 | --enable-faadbin) libfaadbin="yes" |
445ad18d | 1062 | ;; |
2eed5a46 | 1063 | --enable-faac) libfaac="yes" |
29d48296 | 1064 | ;; |
1ddadfa9 AT |
1065 | --enable-xvid) xvid="yes" |
1066 | ;; | |
c99dd233 | 1067 | --enable-x264) x264="yes" |
6662ec29 | 1068 | ;; |
4b62f9f9 | 1069 | --enable-avisynth) avisynth="yes" |
8ac17293 | 1070 | ;; |
4b62f9f9 | 1071 | --enable-x11grab) x11grab="yes" |
56a059ac | 1072 | ;; |
f02be79d RS |
1073 | --enable-dc1394) dc1394="yes" |
1074 | ;; | |
68892110 PG |
1075 | --disable-vhook) vhook="no" |
1076 | ;; | |
732d9245 BE |
1077 | --enable-mingw32) mingw32="yes" |
1078 | ;; | |
860391a5 | 1079 | --enable-mingwce) wince="yes" |
ac44871c | 1080 | ;; |
5af4e0cc | 1081 | --enable-static) static="yes" |
320d060a | 1082 | ;; |
5af4e0cc | 1083 | --disable-static) static="no" |
320d060a | 1084 | ;; |
5af4e0cc | 1085 | --enable-shared) shared="yes" |
0319c531 | 1086 | ;; |
5af4e0cc | 1087 | --disable-shared) shared="no" |
320d060a | 1088 | ;; |
cddf3f45 GM |
1089 | --disable-debug) debug="no" |
1090 | ;; | |
1091 | --disable-opts) optimize="no" | |
1092 | ;; | |
5af4e0cc | 1093 | --enable-extra-warnings) extra_warnings="yes" |
78fcba8f | 1094 | ;; |
1eb2212e FB |
1095 | --disable-mpegaudio-hp) mpegaudio_hp="no" |
1096 | ;; | |
f6f69c30 | 1097 | --disable-protocols) protocols="no" |
04f46ced | 1098 | ;; |
786b30af DB |
1099 | --disable-ffmpeg) ffmpeg="no" |
1100 | ;; | |
8154d2e0 FB |
1101 | --disable-ffserver) ffserver="no" |
1102 | ;; | |
a86b921c FB |
1103 | --disable-ffplay) ffplay="no" |
1104 | ;; | |
cddf3f45 | 1105 | --enable-small) optimize="small" |
553a6284 | 1106 | ;; |
12b61a74 | 1107 | --enable-amr_nb) amr_nb="yes" |
891f64b3 | 1108 | ;; |
12b61a74 | 1109 | --enable-amr_nb-fixed) amr_nb_fixed="yes" |
bc634f6f | 1110 | ;; |
12b61a74 | 1111 | --enable-amr_wb) amr_wb="yes" |
115329f1 | 1112 | ;; |
12b61a74 | 1113 | --enable-amr_if2) amr_if2="yes" |
2a515c08 | 1114 | ;; |
bde24d6e | 1115 | --enable-sunmlib) mlib="yes" |
f80f7964 | 1116 | ;; |
9c3d33d6 MN |
1117 | --enable-pthreads) pthreads="yes" |
1118 | ;; | |
eb113804 DB |
1119 | --enable-w32threads) w32threads="yes" |
1120 | ;; | |
e5f94c2b RP |
1121 | --enable-beosthreads) beosthreads="yes" |
1122 | ;; | |
1123 | --enable-os2threads) os2threads="yes" | |
1124 | ;; | |
790c9ca7 LA |
1125 | --enable-swscaler) swscaler="yes" |
1126 | ;; | |
b2e3c528 MN |
1127 | --enable-gpl) gpl="yes" |
1128 | ;; | |
9ddbcae6 | 1129 | --enable-memalign-hack) memalign_hack="yes" |
da9b170c | 1130 | ;; |
65d1bea2 MB |
1131 | --disable-strip) dostrip="no" |
1132 | ;; | |
a8d04fba | 1133 | --enable-encoder=*) enable ${optval}_encoder |
009cf97d | 1134 | ;; |
a8d04fba | 1135 | --enable-decoder=*) enable ${optval}_decoder |
f593b273 | 1136 | ;; |
a8d04fba | 1137 | --disable-encoder=*) disable ${optval}_encoder |
f593b273 | 1138 | ;; |
a8d04fba | 1139 | --disable-decoder=*) disable ${optval}_decoder |
009cf97d | 1140 | ;; |
a8d04fba | 1141 | --disable-encoders) disable $ENCODER_LIST |
009cf97d | 1142 | ;; |
a8d04fba | 1143 | --disable-decoders) disable $DECODER_LIST |
b4cad537 | 1144 | ;; |
a8d04fba | 1145 | --enable-muxer=*) enable ${optval}_muxer |
a9e35095 | 1146 | ;; |
a8d04fba | 1147 | --disable-muxer=*) disable ${optval}_muxer |
ff70e601 | 1148 | ;; |
a2830dca | 1149 | --disable-muxers) disable $MUXER_LIST |
ff70e601 | 1150 | ;; |
a8d04fba | 1151 | --enable-demuxer=*) enable ${optval}_demuxer |
ff70e601 | 1152 | ;; |
a8d04fba | 1153 | --disable-demuxer=*) disable ${optval}_demuxer |
ff70e601 | 1154 | ;; |
a8d04fba | 1155 | --disable-demuxers) disable $DEMUXER_LIST |
a9e35095 | 1156 | ;; |
a8d04fba | 1157 | --enable-parser=*) enable ${optval}_parser |
af9e7d18 | 1158 | ;; |
a8d04fba | 1159 | --disable-parser=*) disable ${optval}_parser |
af9e7d18 | 1160 | ;; |
a8d04fba | 1161 | --disable-parsers) disable $PARSER_LIST |
af9e7d18 | 1162 | ;; |
74c53c2d MR |
1163 | --help) show_help |
1164 | ;; | |
b34c63f7 DB |
1165 | *) |
1166 | echo "Unknown option \"$opt\"." | |
1167 | echo "See $0 --help for available options." | |
1168 | exit 1 | |
1169 | ;; | |
de6d9b64 FB |
1170 | esac |
1171 | done | |
1172 | ||
e3c00e34 | 1173 | if ! disabled logging ; then |
90be59ef | 1174 | enabled logging || logfile="$logging" |
57bd82d4 MR |
1175 | echo "# $0 $@" >$logfile |
1176 | set >>$logfile | |
2ba042a7 MR |
1177 | else |
1178 | logfile=/dev/null | |
57bd82d4 | 1179 | fi |
e89b8b0a | 1180 | |
9a46fe75 | 1181 | if enabled_any mingw32 wince; then |
5af4e0cc | 1182 | if enabled_all shared static; then |
e67bcdd9 DB |
1183 | cat <<EOF |
1184 | You can only build one library type at once on MinGW. | |
1185 | Specify --disable-static --enable-shared to only build | |
1186 | the shared libraries. To build only the static libraries | |
1187 | you do not need to pass additional options. | |
1188 | EOF | |
1189 | exit 1 | |
1190 | fi | |
e67bcdd9 DB |
1191 | dv1394="no" |
1192 | dc1394="no" | |
1193 | ffserver="no" | |
1194 | network="no" | |
90be59ef | 1195 | if enabled wince; then |
e67bcdd9 DB |
1196 | protocols="no" |
1197 | fi | |
e67bcdd9 DB |
1198 | SLIBPREF="" |
1199 | SLIBSUF=".dll" | |
1200 | EXESUF=".exe" | |
d6a07a13 DB |
1201 | SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)' |
1202 | SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)' | |
dfeb80a5 | 1203 | SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)" |
b6f9a421 | 1204 | SLIB_INSTALL_EXTRA_CMD="-install -m 644 \$(SLIBNAME_WITH_MAJOR:\$(SLIBSUF)=.lib) \"\$(shlibdir)/\$(SLIBNAME_WITH_MAJOR:\$(SLIBSUF)=.lib)\"" |
a77caa4d | 1205 | SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc" |
e67bcdd9 DB |
1206 | fi |
1207 | ||
28d8e661 DB |
1208 | # Combine FFLDFLAGS and the LDFLAGS environment variable. |
1209 | LDFLAGS="$FFLDFLAGS $LDFLAGS" | |
e89b8b0a | 1210 | |
fac252f9 | 1211 | test -n "$cross_prefix" && cross_compile=yes |
1ea46bed MR |
1212 | cc="${cross_prefix}${cc}" |
1213 | ar="${cross_prefix}${ar}" | |
1214 | ranlib="${cross_prefix}${ranlib}" | |
1215 | strip="${cross_prefix}${strip}" | |
1216 | ||
320d060a | 1217 | # we need to build at least one lib type |
5af4e0cc | 1218 | if disabled_all static shared; then |
320d060a DB |
1219 | cat <<EOF |
1220 | At least one library type must be built. | |
1221 | Specify --enable-static to build the static libraries or --enable-shared to | |
1222 | build the shared libraries as well. To only build the shared libraries specify | |
1223 | --disable-static in addition to --enable-shared. | |
1224 | EOF | |
1225 | exit 1; | |
1226 | fi | |
1227 | ||
ddf50e4c RP |
1228 | if disabled libogg; then |
1229 | enabled libtheora && die "libogg must be enabled to enable libtheora." | |
1230 | enabled libvorbis && die "libogg must be enabled to enable libvorbis." | |
5c5dea3f NB |
1231 | fi |
1232 | ||
a2234ceb RP |
1233 | if enabled_any libfaad libfaadbin ; then |
1234 | if check_header faad.h; then | |
1235 | check_cc << EOF | |
1236 | #include <faad.h> | |
1237 | #ifndef FAAD2_VERSION | |
1238 | ok faad1 | |
1239 | #endif | |
1240 | int main( void ) { return 0; } | |
1241 | EOF | |
1242 | test $? = 0 && enable libfaad2 | |
1243 | else | |
ff3dac65 | 1244 | die "FAAD test failed." |
a2234ceb RP |
1245 | fi |
1246 | fi | |
1247 | ||
1248 | ||
47f9cc15 | 1249 | if disabled gpl ; then |
54118497 RP |
1250 | die_gpl_disabled(){ |
1251 | name=$1 | |
1252 | shift | |
1253 | enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified." | |
1254 | } | |
1255 | die_gpl_disabled "The Postprocessing code" pp | |
0900a85f | 1256 | die_gpl_disabled "liba52" liba52bin |
54118497 RP |
1257 | die_gpl_disabled "libxvidcore" xvid |
1258 | die_gpl_disabled "x264" x264 | |
1259 | die_gpl_disabled "libdts" libdts | |
1260 | die_gpl_disabled "FAAD2" libfaad2 | |
1261 | die_gpl_disabled "The X11 grabber" x11grab | |
1262 | die_gpl_disabled "The software scaler" swscaler | |
ebb810d9 | 1263 | fi |
b2e3c528 | 1264 | |
29799f8b | 1265 | # compute MMX state |
0f3cb305 | 1266 | if test $mmx = "default"; then |
419b8784 | 1267 | if test $arch = "x86_32" -o $arch = "x86_64"; then |
0f3cb305 FB |
1268 | mmx="yes" |
1269 | else | |
1270 | mmx="no" | |
1271 | fi | |
1272 | fi | |
1273 | ||
5d323602 MR |
1274 | test -z "$need_memalign" && need_memalign="$mmx" |
1275 | ||
cf9d24ad | 1276 | #Darwin CC versions |
75388c74 | 1277 | needmdynamicnopic="no" |
cf9d24ad | 1278 | if test $targetos = Darwin; then |
b2924696 | 1279 | if test -n "`$cc -v 2>&1 | grep xlc`"; then |
30a3e5d4 | 1280 | add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto" |
cf9d24ad | 1281 | else |
bb270c08 DB |
1282 | gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`" |
1283 | case "$gcc_version" in | |
1284 | *2.95*) | |
30a3e5d4 | 1285 | add_cflags "-no-cpp-precomp -pipe" |
bb270c08 DB |
1286 | ;; |
1287 | *[34].*) | |
30a3e5d4 | 1288 | add_cflags "-no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare" |
5af4e0cc | 1289 | if disabled shared; then |
bb270c08 DB |
1290 | needmdynamicnopic="yes" |
1291 | fi | |
1292 | ;; | |
1293 | *) | |
30a3e5d4 | 1294 | add_cflags "-no-cpp-precomp -pipe" |
5af4e0cc | 1295 | if disabled shared; then |
bb270c08 DB |
1296 | needmdynamicnopic="yes" |
1297 | fi | |
1298 | ;; | |
1299 | esac | |
cf9d24ad | 1300 | fi |
2a1a6b64 MN |
1301 | fi |
1302 | ||
703afd07 | 1303 | disabled optimize || add_cflags -fomit-frame-pointer |
cf9d24ad | 1304 | |
ab6c65f6 BF |
1305 | # Can only do AltiVec on PowerPC |
1306 | if test $altivec = "default"; then | |
cc6a90dd | 1307 | if test $arch = "powerpc"; then |
ab6c65f6 BF |
1308 | altivec="yes" |
1309 | else | |
1310 | altivec="no" | |
1311 | fi | |
1312 | fi | |
1313 | ||
a4adb608 | 1314 | # Add processor-specific flags |
9007f514 | 1315 | POWERPCMODE="32bits" |
38d0a8aa | 1316 | if test $cpu != "generic"; then |
bc8ec47b MR |
1317 | warn_altivec(){ |
1318 | $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1."; | |
1658bc4f | 1319 | } |
38d0a8aa | 1320 | case $cpu in |
bb270c08 | 1321 | 601|ppc601|PowerPC601) |
1c5d830c | 1322 | add_cflags "-mcpu=601" |
bc8ec47b | 1323 | warn_altivec enabled PPC601 |
bb270c08 DB |
1324 | ;; |
1325 | 603*|ppc603*|PowerPC603*) | |
1c5d830c | 1326 | add_cflags "-mcpu=603" |
bc8ec47b | 1327 | warn_altivec enabled PPC603 |
bb270c08 DB |
1328 | ;; |
1329 | 604*|ppc604*|PowerPC604*) | |
1c5d830c | 1330 | add_cflags "-mcpu=604" |
bc8ec47b | 1331 | warn_altivec enabled PPC604 |
bb270c08 DB |
1332 | ;; |
1333 | G3|g3|75*|ppc75*|PowerPC75*) | |
1c5d830c | 1334 | add_cflags "-mcpu=750 -mpowerpc-gfxopt" |
bc8ec47b | 1335 | warn_altivec enabled PPC75x |
bb270c08 DB |
1336 | ;; |
1337 | G4|g4|745*|ppc745*|PowerPC745*) | |
1c5d830c | 1338 | add_cflags "-mcpu=7450 -mpowerpc-gfxopt" |
bc8ec47b | 1339 | warn_altivec disabled PPC745x |
bb270c08 DB |
1340 | ;; |
1341 | 74*|ppc74*|PowerPC74*) | |
1c5d830c | 1342 | add_cflags "-mcpu=7400 -mpowerpc-gfxopt" |
bc8ec47b | 1343 | warn_altivec disabled PPC74xx |
bb270c08 DB |
1344 | ;; |
1345 | G5|g5|970|ppc970|PowerPC970|power4*|Power4*) | |
1c5d830c | 1346 | add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64" |
bc8ec47b | 1347 | warn_altivec disabled PPC970 |
9007f514 | 1348 | POWERPCMODE="64bits" |
bb270c08 | 1349 | ;; |
e7768fc5 GP |
1350 | # targets that do NOT support conditional mov (cmov) |
1351 | i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3) | |
38d0a8aa | 1352 | add_cflags "-march=$cpu" |
e7768fc5 GP |
1353 | cmov="no" |
1354 | ;; | |
1355 | # targets that do support conditional mov (cmov) | |
416519dd | 1356 | i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2) |
e7768fc5 | 1357 | add_cflags "-march=$cpu" |
4c8d81fa | 1358 | cmov="yes" |
7073e9fc | 1359 | fast_cmov="yes" |
94e4c3a3 GP |
1360 | ;; |
1361 | # targets that do support conditional mov but on which it's slow | |
1362 | pentium4|prescott|nocona) | |
1363 | add_cflags "-march=$cpu" | |
1364 | cmov="yes" | |
7073e9fc | 1365 | fast_cmov="no" |
bb270c08 | 1366 | ;; |
d7b34d08 | 1367 | sparc64) |
1c5d830c | 1368 | add_cflags "-mcpu=v9" |
d7b34d08 | 1369 | ;; |
bb270c08 | 1370 | *) |
38d0a8aa | 1371 | echo "WARNING: Unknown CPU \"$cpu\", ignored." |
bb270c08 | 1372 | ;; |
a4adb608 MN |
1373 | esac |
1374 | fi | |
1375 | ||
412c1562 MR |
1376 | gnu_make(){ |
1377 | $1 --version 2>&1 | grep -q GNU | |
1378 | } | |
1379 | ||
1380 | if ! gnu_make $make; then | |
1381 | gnu_make gmake && make=gmake || die "GNU make not found." | |
1382 | fi | |
1383 | ||
be0d52ab MR |
1384 | # make sure we can execute files in $TMPDIR |
1385 | cat >$TMPE 2>>$logfile <<EOF | |
1386 | #! /bin/sh | |
1387 | EOF | |
1388 | chmod +x $TMPE >>$logfile 2>&1 | |
1389 | if ! $TMPE >>$logfile 2>&1; then | |
1390 | cat <<EOF | |
1391 | Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment | |
68300911 DB |
1392 | variable to another directory and make sure that $TMPDIR1 is not mounted |
1393 | noexec. | |
be0d52ab MR |
1394 | EOF |
1395 | die "Sanity test failed." | |
1396 | fi | |
0244f743 | 1397 | rm $TMPE |
be0d52ab | 1398 | |
1a268acc MR |
1399 | # compiler sanity check |
1400 | check_exec <<EOF | |
1401 | int main(){ | |
1402 | return 0; | |
1403 | } | |
1404 | EOF | |
1405 | if test "$?" != 0; then | |
1406 | echo "$cc is unable to create an executable file." | |
d6ceace3 | 1407 | if test -z "$cross_prefix" && disabled cross_compile ; then |
1a268acc | 1408 | echo "If $cc is a cross-compiler, use the --cross-compile option." |
c7ae6345 | 1409 | echo "Only do this if you know what cross compiling means." |
1a268acc MR |
1410 | fi |
1411 | die "C compiler test failed." | |
1412 | fi | |
1413 | ||
87ea51e0 LB |
1414 | # check for assembler specific support |
1415 | ||
cc6a90dd | 1416 | if test $arch = "powerpc"; then |
87ea51e0 LB |
1417 | check_cc <<EOF && dcbzl=yes |
1418 | int main(void) { | |
1419 | register long zero = 0; | |
1420 | char data[1024]; | |
1421 | asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero)); | |
1422 | return 0; | |
1423 | } | |
1424 | EOF | |
1425 | fi | |
1426 | ||
57bd82d4 MR |
1427 | # check for SIMD availability |
1428 | ||
115329f1 | 1429 | # AltiVec flags: The FSF version of GCC differs from the Apple version |
cc6a90dd | 1430 | if test $arch = "powerpc"; then |
90be59ef | 1431 | if enabled altivec; then |
b2924696 | 1432 | if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then |
30a3e5d4 | 1433 | add_cflags "-faltivec" |
b6e52719 | 1434 | else |
30a3e5d4 | 1435 | add_cflags "-maltivec -mabi=altivec" |
b6e52719 MD |
1436 | fi |
1437 | fi | |
1438 | fi | |
1439 | ||
0701ca7f | 1440 | check_header altivec.h |
a9a07762 | 1441 | |
29799f8b | 1442 | # check if our compiler supports Motorola AltiVec C API |
90be59ef RP |
1443 | if enabled altivec; then |
1444 | if enabled altivec_h; then | |
f25fc9b1 MR |
1445 | inc_altivec_h="#include <altivec.h>" |
1446 | else | |
1447 | inc_altivec_h= | |
1448 | fi | |
1449 | check_cc <<EOF || altivec=no | |
dcd479c0 | 1450 | $inc_altivec_h |
a9a07762 MN |
1451 | int main(void) { |
1452 | vector signed int v1, v2, v3; | |
1453 | v1 = vec_add(v2,v3); | |
1454 | return 0; | |
1455 | } | |
1456 | EOF | |
1457 | fi | |
ab6c65f6 | 1458 | |
854fdb51 | 1459 | # check armv5te instructions support |
cc6a90dd | 1460 | if test $armv5te = "default" -a $arch = "armv4l"; then |
854fdb51 MR |
1461 | armv5te=no |
1462 | check_cc <<EOF && armv5te=yes | |
1463 | int main(void) { | |
1464 | __asm__ __volatile__ ("qadd r0, r0, r0"); | |
1465 | } | |
1466 | EOF | |
1467 | fi | |
1468 | ||
edab3048 MR |
1469 | if test $armv6 = "default" -a $arch = "armv4l"; then |
1470 | check_cc <<EOF && armv6=yes || armv6=no | |
1471 | int main(void) { | |
1472 | __asm__ __volatile__ ("sadd16 r0, r0, r0"); | |
1473 | } | |
1474 | EOF | |
1475 | fi | |
1476 | ||
854fdb51 | 1477 | # check iwmmxt support |
cc6a90dd | 1478 | if test $iwmmxt = "default" -a $arch = "armv4l"; then |
854fdb51 MR |
1479 | iwmmxt=no |
1480 | check_cc <<EOF && iwmmxt=yes | |
1481 | int main(void) { | |
1482 | __asm__ __volatile__ ("wunpckelub wr6, wr4"); | |
1483 | } | |
1484 | EOF | |
1485 | fi | |
1486 | ||
29799f8b | 1487 | # mmi only available on mips |
d46aba26 | 1488 | if test $mmi = "default"; then |
cc6a90dd | 1489 | if test $arch = "mips"; then |
d46aba26 LS |
1490 | mmi="yes" |
1491 | else | |
1492 | mmi="no" | |
1493 | fi | |
1494 | fi | |
1495 | ||
29799f8b | 1496 | # check if our compiler supports mmi |
57bd82d4 | 1497 | enabled mmi && check_cc <<EOF || mmi="no" |
d46aba26 LS |
1498 | int main(void) { |
1499 | __asm__ ("lq \$2, 0(\$2)"); | |
1500 | return 0; | |
1501 | } | |
1502 | EOF | |
57bd82d4 | 1503 | |
57bd82d4 MR |
1504 | # --- |
1505 | # big/little-endian test | |
37970ebf | 1506 | if disabled cross_compile; then |
57bd82d4 | 1507 | check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes" |
a3999908 MN |
1508 | #include <inttypes.h> |
1509 | int main(int argc, char ** argv){ | |
bb270c08 DB |
1510 | volatile uint32_t i=0x01234567; |
1511 | return (*((uint8_t*)(&i))) == 0x67; | |
a3999908 MN |
1512 | } |
1513 | EOF | |
487a54d7 | 1514 | else |
f25fc9b1 | 1515 | # programs cannot be launched if cross compiling, so make a static guess |
cc6a90dd | 1516 | if test "$arch" = "powerpc" -o "$arch" = "mips" ; then |
f25fc9b1 MR |
1517 | bigendian="yes" |
1518 | fi | |
487a54d7 FB |
1519 | fi |
1520 | ||
a3999908 | 1521 | # --- |
3d204385 NK |
1522 | # check availability of some header files |
1523 | ||
0701ca7f MR |
1524 | check_header malloc.h |
1525 | check_func memalign | |
3d204385 | 1526 | |
797ee6a6 | 1527 | if disabled_all memalign memalign_hack && enabled need_memalign ; then |
57bd82d4 | 1528 | die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack." |
8bf5d58f MN |
1529 | fi |
1530 | ||
0701ca7f | 1531 | check_header byteswap.h |
47d23bbf | 1532 | |
0701ca7f MR |
1533 | check_func inet_aton |
1534 | check_func localtime_r | |
57bd82d4 | 1535 | enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no" |
57bd82d4 MR |
1536 | |
1537 | # check for some common methods of building with pthread support | |
1538 | # do this before the optional library checks as some of them require pthreads | |
1539 | if enabled pthreads; then | |
9e7fd101 MR |
1540 | if check_func pthread_create; then |
1541 | : | |
1542 | elif check_func pthread_create -pthread; then | |
1543 | add_cflags -pthread | |
1544 | add_ldflags -pthread | |
1545 | elif check_func pthread_create -pthreads; then | |
1546 | add_cflags -pthreads | |
1547 | add_ldflags -pthreads | |
1548 | elif ! check_lib pthread.h pthread_create -lpthread; then | |
1549 | die "ERROR: can't find pthreads library" | |
1550 | fi | |
57bd82d4 MR |
1551 | fi |
1552 | ||
e5f94c2b RP |
1553 | for thread in pthreads beosthreads os2threads w32threads; do |
1554 | if enabled $thread; then | |
e3c00e34 | 1555 | if ! disabled thread_type ; then |
e5f94c2b RP |
1556 | die "ERROR: Only one thread type must be selected." |
1557 | else | |
1558 | thread_type="$thread" | |
1559 | fi | |
1560 | fi | |
1561 | done | |
1562 | ||
12b61a74 MR |
1563 | enabled_any amr_nb amr_nb_fixed amr_wb amr_if2 && enable amr |
1564 | enabled_all amr_nb amr_nb_fixed && | |
1565 | die "Only one of amr_nb and amr_nb_fixed may be enabled." | |
1566 | ||
57bd82d4 | 1567 | # these are off by default, so fail if requested and not available |
910c62e1 DB |
1568 | enabled libdts && require libdts dts.h dts_init -ldts -lm |
1569 | enabled libgsm && require libgsm gsm.h gsm_create -lgsm | |
6ebe07fb | 1570 | enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm |
910c62e1 DB |
1571 | enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg |
1572 | enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg | |
1573 | enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg | |
1574 | enabled libnut && require libnut libnut.h nut_demuxer_init -lnut | |
1575 | enabled xvid && require XviD xvid.h xvid_global -lxvidcore | |
1576 | enabled x264 && require x264 x264.h x264_encoder_open -lx264 | |
1577 | enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 | |
1578 | enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib | |
e0f80bd7 | 1579 | |
2eed5a46 | 1580 | # Ugh, libfaac uses stdcall calling convention on win32 so we can't use |
3b9bee88 | 1581 | # the generic test functions |
2eed5a46 | 1582 | if enabled libfaac; then |
3b9bee88 MR |
1583 | save_flags |
1584 | temp_extralibs -lfaac | |
1585 | check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found" | |
1586 | #include <stdint.h> | |
1587 | #include <faac.h> | |
1588 | int main(){ | |
1589 | char *id, *cpr; | |
1590 | faacEncGetVersion(&id, &cpr); | |
1591 | return 0; | |
1592 | } | |
1593 | EOF | |
1594 | restore_flags | |
1595 | fi | |
1596 | ||
87f1c97e MR |
1597 | # Ugh, recent faad2 versions have renamed all functions and #define the |
1598 | # old names in faad.h. Generic tests won't work. | |
2eed5a46 | 1599 | if enabled libfaad; then |
87f1c97e MR |
1600 | save_flags |
1601 | temp_extralibs -lfaad | |
1602 | check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found" | |
1603 | #include <faad.h> | |
1604 | int main(){ | |
1605 | faacDecOpen(); | |
1606 | return 0; | |
1607 | } | |
1608 | EOF | |
1609 | restore_flags | |
1610 | fi | |
1611 | ||
8ac17293 SH |
1612 | # Ugh, avisynth uses WINAPI calls. Generic tests won't work. |
1613 | if enabled avisynth; then | |
1614 | save_flags | |
1615 | temp_extralibs -lvfw32 | |
1616 | check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found" | |
1617 | #include <windows.h> | |
1618 | #include <vfw.h> | |
1619 | int main(){ | |
1620 | AVIFileInit(); | |
1621 | return 0; | |
1622 | } | |
1623 | EOF | |
1624 | restore_flags | |
1625 | fi | |
1626 | ||
1627 | ||
95e2ce4a | 1628 | # test for lrintf in math.h |
fc2b267f | 1629 | check_exec <<EOF && lrintf=yes || lrintf=no |
95e2ce4a MN |
1630 | #define _ISOC9X_SOURCE 1 |
1631 | #include <math.h> | |
1632 | int main( void ) { return (lrintf(3.999f) > 0)?0:1; } | |
1633 | EOF | |
1634 | ||
c13e1abd FH |
1635 | _restrict= |
1636 | for restrict_keyword in restrict __restrict__ __restrict; do | |
57bd82d4 | 1637 | check_cc <<EOF && _restrict=$restrict_keyword && break |
dcd479c0 MR |
1638 | void foo(char * $restrict_keyword p); |
1639 | EOF | |
c13e1abd FH |
1640 | done |
1641 | ||
a8721c09 FB |
1642 | # dlopen/dlfcn.h probing |
1643 | ||
0701ca7f | 1644 | check_header dlfcn.h |
a8721c09 | 1645 | |
dcd479c0 | 1646 | if check_func dlopen; then |
dcd479c0 | 1647 | ldl= |
0701ca7f MR |
1648 | elif check_func dlopen -ldl; then |
1649 | ldl=-ldl | |
a8721c09 FB |
1650 | fi |
1651 | ||
703afd07 | 1652 | test "$vhook" = "default" && vhook="$dlopen" |
a8721c09 | 1653 | |
703afd07 | 1654 | enabled_any vhook liba52bin libfaadbin && add_extralibs $ldl |
bfd2edeb | 1655 | |
5af4e0cc | 1656 | if test "$targetos" = "CYGWIN" && enabled static ; then |
fbb9d104 VP |
1657 | vhook="no" |
1658 | echo | |
1659 | echo "At the moment vhooks don't work on Cygwin static builds." | |
1660 | echo "Patches welcome." | |
1661 | echo | |
1662 | fi | |
1663 | ||
8d923001 MR |
1664 | if enabled vhook; then |
1665 | check_ldflags -rdynamic | |
1666 | check_ldflags -export-dynamic | |
1667 | fi | |
bfd2edeb | 1668 | |
703afd07 | 1669 | enabled audio_beos && add_extralibs "-lmedia -lbe" |
9464f2b8 | 1670 | |
a86b921c | 1671 | ########################################## |
29799f8b | 1672 | # imlib check |
a86b921c | 1673 | |
079dd4ba | 1674 | imlib2=no |
ec1e9c44 | 1675 | if imlib2-config --version >/dev/null 2>&1; then |
1b45e304 VP |
1676 | temp_cflags `imlib2-config --cflags` |
1677 | temp_extralibs `imlib2-config --libs` | |
ec1e9c44 | 1678 | check_lib Imlib2.h imlib_load_font && enable imlib2 |
929f0347 | 1679 | restore_flags |
1b45e304 | 1680 | fi |
52b41d7f | 1681 | |
a86b921c | 1682 | ########################################## |
29799f8b | 1683 | # FreeType check |
a86b921c | 1684 | |
04511d53 | 1685 | freetype2=no |
30f35ab0 MR |
1686 | if freetype-config --version >/dev/null 2>&1; then |
1687 | temp_cflags `freetype-config --cflags` | |
1688 | temp_extralibs `freetype-config --libs` | |
1689 | check_lib ft2build.h FT_Init_FreeType && enable freetype2 | |
1690 | restore_flags | |
04511d53 PG |
1691 | fi |
1692 | ||
a86b921c | 1693 | ########################################## |
29799f8b | 1694 | # SDL check |
a86b921c | 1695 | |
a86b921c FB |
1696 | sdl_too_old=no |
1697 | sdl=no | |
6a1a892f | 1698 | SDL_CONFIG="${cross_prefix}sdl-config" |
225e21ef MR |
1699 | if "${SDL_CONFIG}" --version >/dev/null 2>&1; then |
1700 | sdl_cflags=`"${SDL_CONFIG}" --cflags` | |
1701 | temp_cflags $sdl_cflags | |
dcd479c0 | 1702 | temp_extralibs `"${SDL_CONFIG}" --libs` |
225e21ef | 1703 | if check_lib SDL.h SDL_Init; then |
dcd479c0 | 1704 | _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'` |
29f3b38a | 1705 | if test "$_sdlversion" -lt 121 ; then |
dcd479c0 MR |
1706 | sdl_too_old=yes |
1707 | else | |
1708 | sdl=yes | |
225e21ef | 1709 | check_cc $sdl_cflags <<EOF && enable sdl_video_size |
29f3b38a MR |
1710 | #include <SDL.h> |
1711 | int main(void){ | |
1712 | const SDL_VideoInfo *vi = SDL_GetVideoInfo(); | |
1713 | int w = vi->current_w; | |
1714 | return 0; | |
1715 | } | |
1716 | EOF | |
dcd479c0 MR |
1717 | fi |
1718 | fi | |
29f3b38a | 1719 | restore_flags |
c3f6b472 | 1720 | fi |
57bd82d4 | 1721 | |
d5697779 | 1722 | texi2html -version >/dev/null 2>&1 && enable texi2html || disable texi2html |
146ea952 | 1723 | |
7a91333f | 1724 | ########################################## |
29799f8b | 1725 | # IPv6 check |
7a91333f | 1726 | |
0c7bb0e5 | 1727 | enabled network && enabled ipv6 && check_ld <<EOF && ipv6=yes || ipv6=no |
7a91333f HZ |
1728 | #include <sys/types.h> |
1729 | #include <sys/socket.h> | |
1730 | #include <netinet/in.h> | |
1731 | #include <netdb.h> | |
1732 | int main( void ) { | |
1733 | struct sockaddr_storage saddr; | |
1734 | struct ipv6_mreq mreq6; | |
1735 | getaddrinfo(0,0,0,0); | |
1736 | getnameinfo(0,0,0,0,0,0,0); | |
12fe88b4 | 1737 | IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0); |
7a91333f HZ |
1738 | } |
1739 | EOF | |
1740 | ||
f6f14752 | 1741 | enabled video4linux && check_header linux/videodev.h || disable video4linux |
6c7aaa48 | 1742 | enabled video4linux2 && check_header linux/videodev2.h || disable video4linux2 |
47f38850 | 1743 | |
f8aa696f DB |
1744 | # check for ioctl_meteor.h, ioctl_bt848.h and alternatives |
1745 | if enabled bktr; then | |
3eac5c63 MR |
1746 | { check_header dev/bktr/ioctl_meteor.h && |
1747 | check_header dev/bktr/ioctl_bt848.h; } || | |
1748 | { check_header machine/ioctl_meteor.h && | |
1749 | check_header machine/ioctl_bt848.h; } || | |
1750 | { check_header dev/video/meteor/ioctl_meteor.h && | |
1751 | check_header dev/video/bktr/ioctl_bt848.h; } || | |
1752 | check_header dev/ic/bt8xx.h || | |
1753 | disable bktr | |
f8aa696f DB |
1754 | fi |
1755 | ||
deb29777 MR |
1756 | enabled audio_oss && |
1757 | check_header sys/soundcard.h || | |
1758 | check_header soundcard.h || | |
1759 | disable audio_oss | |
1760 | ||
f58f4ce1 | 1761 | # Deal with the x11 frame grabber |
56a059ac | 1762 | enabled x11grab && |
f58f4ce1 GP |
1763 | enabled gpl && |
1764 | enabled x11_grab_device_demuxer && | |
1765 | check_header X11/Xlib.h && | |
1766 | check_header X11/extensions/XShm.h && | |
1767 | check_func XOpenDisplay -lX11 && | |
1768 | check_func XShmCreateImage -lX11 -lXext && | |
1769 | add_extralibs -lX11 -lXext || | |
1770 | disable x11_grab_device_demuxer | |
1771 | ||
57bd82d4 MR |
1772 | enabled debug && add_cflags -g |
1773 | ||
1774 | # add some useful compiler flags if supported | |
1775 | check_cflags -Wdeclaration-after-statement | |
dcd479c0 MR |
1776 | check_cflags -Wall |
1777 | check_cflags -Wno-switch | |
c07bd6a9 MN |
1778 | check_cflags -Wdisabled-optimization |
1779 | check_cflags -Wpointer-arith | |
1780 | check_cflags -Wredundant-decls | |
cc1fb623 | 1781 | check_cflags -Wno-pointer-sign |
5af4e0cc | 1782 | enabled extra_warnings && check_cflags -Winline |
cf9d24ad | 1783 | |
57bd82d4 | 1784 | # add some linker flags |
e240ee67 | 1785 | check_ldflags $LDLATEFLAGS |
94a3401e | 1786 | |
57bd82d4 MR |
1787 | # not all compilers support -Os |
1788 | test "$optimize" = "small" && check_cflags -Os | |
cddf3f45 | 1789 | |
57bd82d4 | 1790 | if enabled optimize; then |
b2924696 | 1791 | if test -n "`$cc -v 2>&1 | grep xlc`"; then |
30a3e5d4 NP |
1792 | add_cflags "-O5" |
1793 | add_ldflags "-O5" | |
cf9d24ad | 1794 | else |
30a3e5d4 | 1795 | add_cflags "-O3" |
cf9d24ad | 1796 | fi |
cddf3f45 GM |
1797 | fi |
1798 | ||
80581e98 | 1799 | # PIC flags for shared library objects where they are needed |
5af4e0cc | 1800 | if enabled shared; then |
f25fc9b1 MR |
1801 | # LIBOBJFLAGS may have already been set in the OS configuration |
1802 | if test -z "$LIBOBJFLAGS" ; then | |
cc6a90dd | 1803 | case "$arch" in |
f824ba7b | 1804 | x86_64|ia64|alpha|sparc*|power*) LIBOBJFLAGS="\$(PIC)" ;; |
813457e5 | 1805 | esac |
80581e98 | 1806 | fi |
80581e98 MN |
1807 | fi |
1808 | ||
90be59ef | 1809 | if enabled gprof; then |
30a3e5d4 NP |
1810 | add_cflags "-p" |
1811 | add_ldflags "-p" | |
1db54e20 DB |
1812 | fi |
1813 | ||
18451f7d | 1814 | VHOOKCFLAGS="-fPIC $CFLAGS" |
90be59ef | 1815 | enabled needmdynamicnopic && add_cflags -mdynamic-no-pic |
18451f7d | 1816 | |
4454dc1b JD |
1817 | # find if .align arg is power-of-two or not |
1818 | if test $asmalign_pot = "unknown"; then | |
1819 | asmalign_pot="no" | |
1820 | echo 'asm (".align 3");' | check_cc && asmalign_pot="yes" | |
1821 | fi | |
1822 | ||
f70f03f6 MR |
1823 | enabled_any $ENCODER_LIST && enable encoders |
1824 | enabled_any $DECODER_LIST && enable decoders | |
1825 | enabled_any $MUXER_LIST && enable muxers | |
1826 | enabled_any $DEMUXER_LIST && enable demuxers | |
1827 | ||
1828 | enabled_any pthreads beosthreads os2threads w32threads && enable threads | |
1829 | ||
1830 | check_deps $CONFIG_LIST $HAVE_LIST $DECODER_LIST $ENCODER_LIST $PARSER_LIST \ | |
1831 | $DEMUXER_LIST $MUXER_LIST | |
1832 | ||
fb2ce7d9 MR |
1833 | enabled libogg && append pkg_requires "ogg >= 1.1" |
1834 | enabled libtheora && append pkg_requires "theora" | |
1835 | enabled libvorbis && append pkg_requires "vorbis vorbisenc" | |
1836 | enabled dc1394 && append pkg_requires "libraw1394" | |
1837 | ||
f36958f8 DB |
1838 | echo "install prefix $PREFIX" |
1839 | echo "source path $source_path" | |
1840 | echo "C compiler $cc" | |
1841 | echo "make $make" | |
bfd5afd8 | 1842 | echo ".align is power-of-two $asmalign_pot" |
f36958f8 | 1843 | echo "ARCH $arch ($cpu)" |
eb94aca9 | 1844 | if test "$BUILDSUF" != ""; then |
f36958f8 | 1845 | echo "build suffix $BUILDSUF" |
eb94aca9 | 1846 | fi |
f36958f8 | 1847 | echo "big-endian $bigendian" |
419b8784 | 1848 | if test $arch = "x86_32" -o $arch = "x86_64"; then |
f36958f8 DB |
1849 | echo "MMX enabled $mmx" |
1850 | echo "CMOV enabled $cmov" | |
7073e9fc | 1851 | echo "CMOV is fast $fast_cmov" |
e41e8342 | 1852 | fi |
cc6a90dd | 1853 | if test $arch = "armv4l"; then |
f36958f8 | 1854 | echo "ARMv5TE enabled $armv5te" |
edab3048 | 1855 | echo "ARMv6 enabled $armv6" |
f36958f8 | 1856 | echo "IWMMXT enabled $iwmmxt" |
eba9ae3c | 1857 | fi |
cc6a90dd | 1858 | if test $arch = "mips"; then |
f36958f8 | 1859 | echo "MMI enabled $mmi" |
e41e8342 | 1860 | fi |
cc6a90dd | 1861 | if test $arch = "powerpc"; then |
f36958f8 DB |
1862 | echo "AltiVec enabled $altivec" |
1863 | echo "dcbzl available $dcbzl" | |
e41e8342 | 1864 | fi |
f36958f8 | 1865 | echo "gprof enabled $gprof" |
f36958f8 DB |
1866 | echo "debug symbols $debug" |
1867 | echo "strip symbols $dostrip" | |
1868 | echo "optimize $optimize" | |
5af4e0cc MR |
1869 | echo "static $static" |
1870 | echo "shared $shared" | |
bfd5afd8 DB |
1871 | echo "postprocessing support $pp" |
1872 | echo "software scaler enabled $swscaler" | |
f36958f8 | 1873 | echo "video hooking $vhook" |
90be59ef | 1874 | if enabled vhook; then |
f36958f8 DB |
1875 | echo "Imlib2 support $imlib2" |
1876 | echo "FreeType support $freetype2" | |
68892110 | 1877 | fi |
bfd5afd8 | 1878 | echo "network support $network" |
90be59ef | 1879 | if enabled network; then |
bfd5afd8 DB |
1880 | echo "IPv6 support $ipv6" |
1881 | fi | |
e5f94c2b | 1882 | echo "threading support $thread_type" |
bfd5afd8 | 1883 | echo "SDL support $sdl" |
90be59ef | 1884 | if enabled sdl_too_old; then |
bfd5afd8 DB |
1885 | echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support." |
1886 | fi | |
1887 | echo "Sun medialib support $mlib" | |
1888 | echo "AVISynth enabled $avisynth" | |
f8904fd9 | 1889 | echo "liba52 dlopened $liba52bin" |
3ffab361 | 1890 | echo "libdts support $libdts" |
2eed5a46 DB |
1891 | echo "libfaac enabled $libfaac" |
1892 | echo "libfaad enabled $libfaad" | |
1893 | echo "faadbin enabled $libfaadbin" | |
bfd5afd8 | 1894 | echo "libgsm enabled $libgsm" |
6ebe07fb | 1895 | echo "libmp3lame enabled $libmp3lame" |
bfd5afd8 DB |
1896 | echo "libnut enabled $libnut" |
1897 | echo "libogg enabled $libogg" | |
150d2772 | 1898 | echo "libtheora enabled $libtheora" |
bfd5afd8 | 1899 | echo "libvorbis enabled $libvorbis" |
bfd5afd8 | 1900 | echo "x264 enabled $x264" |
dc922953 | 1901 | echo "XviD enabled $xvid" |
bfd5afd8 | 1902 | echo "zlib enabled $zlib" |
f36958f8 DB |
1903 | echo "AMR-NB float support $amr_nb" |
1904 | echo "AMR-NB fixed support $amr_nb_fixed" | |
1905 | echo "AMR-WB float support $amr_wb" | |
1906 | echo "AMR-WB IF2 support $amr_if2" | |
37970ebf | 1907 | if disabled gpl; then |
f25fc9b1 | 1908 | echo "License: LGPL" |
b2e3c528 | 1909 | else |
f25fc9b1 | 1910 | echo "License: GPL" |
b2e3c528 | 1911 | fi |
de6d9b64 | 1912 | |
29799f8b | 1913 | echo "Creating config.mak and config.h..." |
de6d9b64 | 1914 | |
29799f8b DB |
1915 | echo "# Automatically generated by configure - do not modify!" > config.mak |
1916 | echo "/* Automatically generated by configure - do not modify! */" > $TMPH | |
0fd12426 | 1917 | echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH |
de6d9b64 | 1918 | |
2266e085 DB |
1919 | echo "PREFIX=$PREFIX" >> config.mak |
1920 | echo "prefix=\$(DESTDIR)\${PREFIX}" >> config.mak | |
9a695e98 | 1921 | echo "libdir=\$(DESTDIR)$libdir" >> config.mak |
84c22efd | 1922 | echo "shlibdir=\$(DESTDIR)$shlibdir" >> config.mak |
1d67a1d4 | 1923 | echo "incdir=\$(DESTDIR)$incdir" >> config.mak |
9a695e98 DB |
1924 | echo "bindir=\$(DESTDIR)$bindir" >> config.mak |
1925 | echo "mandir=\$(DESTDIR)$mandir" >> config.mak | |
4a908fbc | 1926 | echo "MAKE=$make" >> config.mak |
980fc7b8 FB |
1927 | echo "CC=$cc" >> config.mak |
1928 | echo "AR=$ar" >> config.mak | |
be7109c1 | 1929 | echo "RANLIB=$ranlib" >> config.mak |
90be59ef | 1930 | if enabled dostrip; then |
f25fc9b1 | 1931 | echo "STRIP=$strip" >> config.mak |
65d1bea2 | 1932 | else |
f25fc9b1 | 1933 | echo "STRIP=echo ignoring strip" >> config.mak |
65d1bea2 | 1934 | fi |
75388c74 | 1935 | |
a9b3f630 | 1936 | echo "OPTFLAGS=$CFLAGS" >> config.mak |
408382a4 | 1937 | echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak |
0f3cb305 | 1938 | echo "LDFLAGS=$LDFLAGS" >> config.mak |
f39e56a8 | 1939 | echo "LDCONFIG=$LDCONFIG" >> config.mak |
c536cb09 | 1940 | echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak |
e1707f52 | 1941 | echo "SHFLAGS=$SHFLAGS" >> config.mak |
408382a4 | 1942 | echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak |
fbb9d104 | 1943 | echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak |
80581e98 | 1944 | echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak |
5af4e0cc | 1945 | echo "BUILD_STATIC=$static" >> config.mak |
eb94aca9 | 1946 | echo "BUILDSUF=$BUILDSUF" >> config.mak |
f3ec2d46 | 1947 | echo "LIBPREF=$LIBPREF" >> config.mak |
eb94aca9 | 1948 | echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak |
5af4e0cc | 1949 | if enabled static; then |
320d060a | 1950 | echo "LIB=$LIB" >> config.mak |
1a44a8b6 AS |
1951 | else # Some Make complain if this variable does not exist. |
1952 | echo "LIB=" >> config.mak | |
320d060a | 1953 | fi |
f3ec2d46 | 1954 | echo "SLIBPREF=$SLIBPREF" >> config.mak |
eb94aca9 CY |
1955 | echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak |
1956 | echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak | |
b2828252 | 1957 | echo "TARGET_OS=$targetos" >> config.mak |
4dc62701 MR |
1958 | |
1959 | ucarch=`toupper $arch` | |
1960 | echo "TARGET_ARCH_${ucarch}=yes" >> config.mak | |
1961 | echo "#define ARCH_${ucarch} 1" >> $TMPH | |
1962 | ||
1963 | # special cases | |
1964 | case "$arch" in | |
1965 | x86_32|x86_64) | |
1966 | echo "TARGET_ARCH_X86=yes" >> config.mak | |
1967 | echo "#define ARCH_X86 1" >> $TMPH | |
1968 | ;; | |
1969 | powerpc) | |
1970 | if test "$POWERPCMODE" = "64bits"; then | |
1971 | echo "#define POWERPC_MODE_64BITS 1" >> $TMPH | |
1972 | fi | |
90be59ef | 1973 | if enabled powerpc_perf; then |
4dc62701 MR |
1974 | echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH |
1975 | fi | |
1976 | ;; | |
1977 | sparc64) | |
1978 | echo "TARGET_ARCH_SPARC=yes" >> config.mak | |
1979 | echo "#define ARCH_SPARC 1" >> $TMPH | |
1980 | ;; | |
1981 | esac | |
1982 | ||
90be59ef | 1983 | if enabled bigendian; then |
0f3cb305 FB |
1984 | echo "WORDS_BIGENDIAN=yes" >> config.mak |
1985 | echo "#define WORDS_BIGENDIAN 1" >> $TMPH | |
91d1f1a4 | 1986 | fi |
90be59ef | 1987 | if enabled mmx; then |
e82c5a8c | 1988 | echo "#define __CPU__ 586" >> $TMPH |
de6d9b64 | 1989 | fi |
44161118 | 1990 | |
90be59ef | 1991 | if enabled sdl; then |
6a1a892f FD |
1992 | echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak |
1993 | echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak | |
a86b921c | 1994 | fi |
90be59ef | 1995 | if enabled texi2html; then |
146ea952 NB |
1996 | echo "BUILD_DOC=yes" >> config.mak |
1997 | fi | |
5a872801 | 1998 | |
790c9ca7 | 1999 | sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'` |
6d9a2421 | 2000 | pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'` |
5a872801 LB |
2001 | lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'` |
2002 | lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'` | |
2003 | lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'` | |
2004 | ||
2005 | ||
2006 | ||
5af4e0cc | 2007 | if enabled shared; then |
0319c531 | 2008 | echo "BUILD_SHARED=yes" >> config.mak |
97006039 | 2009 | echo "PIC=-fPIC -DPIC" >> config.mak |
7e303556 DB |
2010 | echo "SPPMAJOR=${pp_version%%.*}" >> config.mak |
2011 | echo "SPPVERSION=$pp_version" >> config.mak | |
39503a27 | 2012 | echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak |
5a872801 | 2013 | echo "LAVCVERSION=$lavc_version" >> config.mak |
39503a27 | 2014 | echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak |
5a872801 | 2015 | echo "LAVFVERSION=$lavf_version" >> config.mak |
39503a27 | 2016 | echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak |
5a872801 | 2017 | echo "LAVUVERSION=$lavu_version" >> config.mak |
790c9ca7 LA |
2018 | echo "SWSMAJOR=${sws_version%%.*}" >> config.mak |
2019 | echo "SWSVERSION=$sws_version" >> config.mak | |
4bdd05e7 | 2020 | echo "SLIBNAME=${SLIBNAME}" >> config.mak |
f3b60109 DB |
2021 | echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak |
2022 | echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak | |
5cb854e1 | 2023 | echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak |
8fbec4f4 | 2024 | echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak |
0319c531 | 2025 | fi |
d7e27559 | 2026 | echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak |
ef0bc4c9 | 2027 | echo "EXTRALIBS=$extralibs" >> config.mak |
d2845d68 | 2028 | |
44161118 MR |
2029 | print_config HAVE_ $TMPH config.mak $HAVE_LIST |
2030 | print_config CONFIG_ $TMPH config.mak $CONFIG_LIST | |
1ac9331a | 2031 | print_config TARGET_ $TMPH config.mak $TARGET_LIST |
8ac17293 | 2032 | |
b2828252 | 2033 | if test "$targetos" = "Darwin"; then |
90cee0c3 | 2034 | echo "#define CONFIG_DARWIN 1" >> $TMPH |
90cee0c3 MN |
2035 | fi |
2036 | ||
c13e1abd FH |
2037 | echo "#define restrict $_restrict" >> $TMPH |
2038 | ||
bb801c97 MN |
2039 | if test "$optimize" = "small"; then |
2040 | echo "#define always_inline" >> $TMPH | |
e5f28e8f | 2041 | echo "#define CONFIG_SMALL 1" >> $TMPH |
bb801c97 MN |
2042 | fi |
2043 | ||
997baf01 MR |
2044 | echo "SRC_PATH=\"$source_path\"" >> config.mak |
2045 | echo "SRC_PATH_BARE=$source_path" >> config.mak | |
2046 | echo "BUILD_ROOT=\"$PWD\"" >> config.mak | |
0f3cb305 | 2047 | |
90be59ef | 2048 | if enabled amr_if2; then |
2a515c08 TM |
2049 | echo "AMR_CFLAGS=-DIF2=1" >> config.mak |
2050 | fi | |
2051 | ||
8156056e | 2052 | # Apparently it's not possible to portably echo a backslash. |
90be59ef | 2053 | if enabled asmalign_pot; then |
8156056e | 2054 | printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH |
4454dc1b | 2055 | else |
8156056e | 2056 | printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH |
4454dc1b JD |
2057 | fi |
2058 | ||
bc634f6f | 2059 | |
55006fc0 | 2060 | for codec in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST; do |
44161118 | 2061 | ucname="`toupper $codec`" |
a8d04fba MR |
2062 | config_name="CONFIG_$ucname" |
2063 | enabled_name="ENABLE_$ucname" | |
2064 | if enabled $codec; then | |
2065 | echo "#define $config_name 1" >> $TMPH | |
2066 | echo "#define $enabled_name 1" >> $TMPH | |
2067 | echo "$config_name=yes" >> config.mak | |
2068 | else | |
2069 | echo "#define $enabled_name 0" >> $TMPH | |
2070 | fi | |
009cf97d MN |
2071 | done |
2072 | ||
9cb2cf10 | 2073 | # Do not overwrite config.h if unchanged to avoid superfluous rebuilds. |
c683a5d1 | 2074 | if ! cmp -s $TMPH config.h; then |
9cb2cf10 DB |
2075 | mv -f $TMPH config.h |
2076 | else | |
2077 | echo "config.h is unchanged" | |
2078 | fi | |
3d204385 | 2079 | |
f3ec2d46 | 2080 | rm -f $TMPO $TMPC $TMPE $TMPS $TMPH |
def4272a | 2081 | |
165af439 | 2082 | # build tree in object directory if source path is different from current one |
90be59ef | 2083 | if enabled source_path_used; then |
165af439 MR |
2084 | DIRS="\ |
2085 | doc \ | |
2086 | libavformat \ | |
2087 | libavcodec \ | |
2088 | libavcodec/alpha \ | |
2089 | libavcodec/armv4l \ | |
2090 | libavcodec/bfin \ | |
2091 | libavcodec/i386 \ | |
2092 | libavcodec/sparc \ | |
2093 | libavcodec/mlib \ | |
2094 | libavcodec/ppc \ | |
3918dc4f DB |
2095 | libavcodec/amr \ |
2096 | libavcodec/amr_float \ | |
2097 | libavcodec/amrwb_float \ | |
165af439 MR |
2098 | libpostproc \ |
2099 | libavutil \ | |
2100 | libswscale \ | |
2101 | tests \ | |
2102 | vhook \ | |
2103 | " | |
2104 | FILES="\ | |
2105 | Makefile \ | |
2106 | common.mak \ | |
2107 | libavformat/Makefile \ | |
2108 | libavcodec/Makefile \ | |
2109 | libpostproc/Makefile \ | |
2110 | libavutil/Makefile \ | |
2111 | libswscale/Makefile \ | |
2112 | tests/Makefile \ | |
2113 | vhook/Makefile \ | |
2114 | doc/Makefile \ | |
2115 | doc/texi2pod.pl \ | |
2116 | " | |
2117 | for dir in $DIRS ; do | |
2118 | mkdir -p $dir | |
2119 | done | |
2120 | for f in $FILES ; do | |
2121 | ln -sf "$source_path/$f" $f | |
2122 | done | |
2123 | fi | |
def4272a | 2124 | |
def4272a | 2125 | |
d0674868 | 2126 | # build pkg-config files |
77aee36c | 2127 | # FIXME: libdir and includedir are hardcoded and may differ from the real path. |
def4272a | 2128 | |
d0674868 DB |
2129 | pkgconfig_generate(){ |
2130 | name=$1 | |
2131 | comment=$2 | |
2132 | version=$3 | |
2133 | libs=$4 | |
2134 | requires=$5 | |
2135 | include=$6 | |
2136 | cat <<EOF >$name.pc | |
2266e085 | 2137 | prefix=$PREFIX |
a94e666c | 2138 | exec_prefix=\${prefix} |
def4272a | 2139 | libdir=\${exec_prefix}/lib |
a94e666c | 2140 | includedir=\${prefix}/include |
def4272a | 2141 | |
d0674868 DB |
2142 | Name: $name |
2143 | Description: $comment | |
2144 | Version: $version | |
2145 | Requires: $requires | |
def4272a | 2146 | Conflicts: |
d0674868 DB |
2147 | Libs: -L\${libdir} $libs |
2148 | Cflags: -I\${includedir} -I\${includedir}/$include | |
def4272a | 2149 | EOF |
d0674868 | 2150 | } |
def4272a | 2151 | |
d0674868 DB |
2152 | pkgconfig_generate_uninstalled(){ |
2153 | name=$1 | |
9c476fd6 | 2154 | shortname=${name#lib} |
d0674868 DB |
2155 | comment=$2 |
2156 | version=$3 | |
2157 | libs=$4 | |
2158 | requires=$5 | |
2159 | cat <<EOF >$name-uninstalled.pc | |
def4272a AJ |
2160 | prefix= |
2161 | exec_prefix= | |
d0674868 DB |
2162 | libdir=\${pcfiledir}/$name |
2163 | includedir=\${pcfiledir}/$name | |
def4272a | 2164 | |
d0674868 DB |
2165 | Name: $name |
2166 | Description: $comment | |
2167 | Version: $version | |
2168 | Requires: $requires | |
def4272a | 2169 | Conflicts: |
d0674868 | 2170 | Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs |
def4272a AJ |
2171 | Cflags: -I\${includedir} |
2172 | EOF | |
d0674868 | 2173 | } |
def4272a | 2174 | |
9d824ad1 | 2175 | pkgconfig_generate libavutil "FFmpeg utility library" "$lavu_version" -lavutil "" ffmpeg |
d0674868 | 2176 | pkgconfig_generate_uninstalled libavutil "FFmpeg utility library" "$lavu_version" |
def4272a | 2177 | |
d0674868 DB |
2178 | pkgconfig_generate libavcodec "FFmpeg codec library" "$lavc_version" "-lavcodec $extralibs" "$pkg_requires libavutil = $lavu_version" ffmpeg |
2179 | pkgconfig_generate_uninstalled libavcodec "FFmpeg codec library" "$lavc_version" "$extralibs" "$pkg_requires libavutil = $lavu_version" | |
def4272a | 2180 | |
d0674868 DB |
2181 | pkgconfig_generate libavformat "FFmpeg container format library" "$lavf_version" "-lavformat $extralibs" "$pkg_requires libavcodec = $lavc_version" ffmpeg |
2182 | pkgconfig_generate_uninstalled libavformat "FFmpeg container format library" "$lavf_version" "$extralibs" "$pkg_requires libavcodec = $lavc_version" | |
def4272a | 2183 | |
90be59ef | 2184 | if enabled pp; then |
2e3bcd38 DB |
2185 | pkgconfig_generate libpostproc "FFmpeg post processing library" "$pp_version" -lpostproc "" postproc |
2186 | pkgconfig_generate_uninstalled libpostproc "FFmpeg post processing library" "$pp_version" | |
2187 | fi | |
790c9ca7 | 2188 | |
c839db53 | 2189 | if enabled swscaler; then |
20c516c6 DM |
2190 | pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "-lswscale" "libavutil = $lavu_version" swscale |
2191 | pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "libavutil = $lavu_version" | |
6c0d0413 | 2192 | else |
d0674868 DB |
2193 | pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version" swscale |
2194 | pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version" | |
c505dd31 MR |
2195 | apply libswscale.pc sed s/^Libs:.*$/Libs:/ |
2196 | apply libswscale-uninstalled.pc sed s/^Libs:.*$/Libs:/ | |
6c0d0413 | 2197 | fi |