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