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