Commit | Line | Data |
---|---|---|
aeb29222 | 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 | 63 | echo " --incdir=DIR install includes in DIR [PREFIX/include/ffmpeg]" |
4ca5ece5 | 64 | echo " --mandir=DIR install man page in DIR [PREFIX/share/man]" |
74c53c2d MR |
65 | echo " --enable-static build static libraries [default=yes]" |
66 | echo " --disable-static do not build static libraries [default=no]" | |
67 | echo " --enable-shared build shared libraries [default=no]" | |
68 | echo " --disable-shared do not build shared libraries [default=yes]" | |
0a622b98 MR |
69 | echo " --enable-gpl allow use of GPL code, the resulting libav*" |
70 | echo " and ffmpeg will be under GPL [default=no]" | |
dc922953 DB |
71 | echo " --enable-pp enable GPLed postprocessing support [default=no]" |
72 | echo " --enable-swscaler software scaler support [default=no]" | |
e5f94c2b | 73 | echo " --enable-beosthreads use BeOS threads [default=no]" |
74c53c2d | 74 | echo " --enable-pthreads use pthreads [default=no]" |
eb113804 | 75 | echo " --enable-w32threads use Win32 threads [default=no]" |
56a059ac | 76 | echo " --enable-x11grab enable X11 grabbing [default=no]" |
0a622b98 MR |
77 | echo |
78 | echo "External library support:" | |
79 | echo " --enable-sunmlib use Sun medialib [default=no]" | |
e2745046 MR |
80 | echo " --enable-liba52 enable GPLed liba52 support [default=no]" |
81 | echo " --enable-liba52bin open liba52.so.0 at runtime [default=no]" | |
8ac17293 | 82 | echo " --enable-avisynth allow reading AVISynth script files [default=no]" |
f5a756ef DB |
83 | echo " --enable-libamr-nb enable libamr-nb floating point audio codec" |
84 | echo " --enable-libamr-wb enable libamr-wb floating point audio codec" | |
f7b8bffe RP |
85 | echo " --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394" |
86 | echo " and libraw1394 [default=no]" | |
e2745046 MR |
87 | echo " --enable-libfaac enable FAAC support via libfaac [default=no]" |
88 | echo " --enable-libfaad enable FAAD support via libfaad [default=no]" | |
06f32b26 | 89 | echo " --enable-libfaadbin open libfaad.so.0 at runtime [default=no]" |
dc922953 | 90 | echo " --enable-libgsm enable GSM support via libgsm [default=no]" |
e2745046 | 91 | echo " --enable-libmp3lame enable MP3 encoding via libmp3lame [default=no]" |
31235134 DB |
92 | echo " --enable-libnut enable NUT (de)muxing via libnut," |
93 | echo " native demuxer exists [default=no]" | |
ba5fd8c5 | 94 | echo " --enable-libogg enable Ogg muxing via libogg [default=no]" |
71757822 | 95 | echo " --enable-libtheora enable Theora encoding via libtheora [default=no]" |
e2745046 | 96 | echo " --enable-libvorbis enable Vorbis en/decoding via libvorbis," |
31235134 | 97 | echo " native implementations exist [default=no]" |
1cc60c47 DB |
98 | echo " --enable-libx264 enable H.264 encoding via x264 [default=no]" |
99 | echo " --enable-libxvid enable Xvid encoding via xvidcore," | |
31235134 | 100 | echo " native MPEG-4/Xvid encoder exists [default=no]" |
74c53c2d MR |
101 | echo "" |
102 | echo "Advanced options (experts only):" | |
103 | echo " --source-path=PATH path to source code [$source_path]" | |
104 | echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]" | |
fac252f9 | 105 | echo " --cross-compile assume a cross-compiler is used" |
abcd6d60 | 106 | echo " --target-os=OS compiler targets OS [$targetos]" |
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]" |
7c758d33 DB |
114 | echo " --cpu=CPU selects the minimum cpu required (affects" |
115 | echo " instruction selection, may crash on older CPUs)" | |
2b4c3615 | 116 | echo " --enable-powerpc-perf enable performance report on PPC" |
74c53c2d MR |
117 | echo " (requires enabling PMC)" |
118 | echo " --disable-mmx disable MMX usage" | |
1839e854 | 119 | echo " --disable-armv5te disable armv5te usage" |
edab3048 | 120 | echo " --disable-armv6 disable armv6 usage" |
74c53c2d MR |
121 | echo " --disable-iwmmxt disable iwmmxt usage" |
122 | echo " --disable-altivec disable AltiVec usage" | |
74c53c2d | 123 | echo " --disable-network disable network support [default=no]" |
0c7bb0e5 | 124 | echo " --disable-ipv6 disable ipv6 support [default=no]" |
74c53c2d | 125 | echo " --disable-zlib disable zlib [default=no]" |
74c53c2d | 126 | echo " --disable-vhook disable video hooking support" |
74c53c2d | 127 | echo " --disable-debug disable debugging symbols" |
74c53c2d MR |
128 | echo " --disable-mpegaudio-hp faster (but less accurate)" |
129 | echo " MPEG audio decoding [default=no]" | |
cde9e780 | 130 | echo " --enable-gray enable full grayscale support (slower color)" |
786b30af | 131 | echo " --disable-ffmpeg disable ffmpeg build" |
74c53c2d MR |
132 | echo " --disable-ffserver disable ffserver build" |
133 | echo " --disable-ffplay disable ffplay build" | |
134 | echo " --enable-small optimize for size instead of speed" | |
135 | echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers" | |
74c53c2d MR |
136 | echo " --disable-encoder=NAME disables encoder NAME" |
137 | echo " --enable-encoder=NAME enables encoder NAME" | |
138 | echo " --disable-decoder=NAME disables decoder NAME" | |
139 | echo " --enable-decoder=NAME enables decoder NAME" | |
140 | echo " --disable-encoders disables all encoders" | |
141 | echo " --disable-decoders disables all decoders" | |
ff70e601 MR |
142 | echo " --disable-muxer=NAME disables muxer NAME" |
143 | echo " --enable-muxer=NAME enables muxer NAME" | |
74c53c2d | 144 | echo " --disable-muxers disables all muxers" |
ff70e601 MR |
145 | echo " --disable-demuxer=NAME disables demuxer NAME" |
146 | echo " --enable-demuxer=NAME enables demuxer NAME" | |
74c53c2d | 147 | echo " --disable-demuxers disables all demuxers" |
af9e7d18 MR |
148 | echo " --enable-parser=NAME enables parser NAME" |
149 | echo " --disable-parser=NAME disables parser NAME" | |
150 | echo " --disable-parsers disables all parsers" | |
cd61e407 JM |
151 | echo " --enable-bsf=NAME enables bitstream filter NAME" |
152 | echo " --disable-bsf=NAME disables bitstream filter NAME" | |
153 | echo " --disable-bsfs disables all bitstream filters" | |
c08fb000 AB |
154 | echo " --enable-protocol=NAME enables protocol NAME" |
155 | echo " --disable-protocol=NAME disables protocol NAME" | |
156 | echo " --disable-protocols disables all protocols" | |
794f8e97 PI |
157 | echo " --list-decoders show all available decoders" |
158 | echo " --list-encoders show all available encoders" | |
159 | echo " --list-muxers show all available muxers" | |
160 | echo " --list-demuxers show all available demuxers" | |
161 | echo " --list-parsers show all available parsers" | |
162 | echo " --list-protocols show all available protocols" | |
163 | echo " --list-bsfs show all available bitstream filters" | |
0a622b98 MR |
164 | echo |
165 | echo "Developer options (useful when working on FFmpeg itself):" | |
166 | echo " --enable-gprof enable profiling with gprof [$gprof]" | |
167 | echo " --disable-opts disable compiler optimizations" | |
168 | echo " --enable-extra-warnings enable more compiler warnings" | |
169 | echo " --disable-strip disable stripping of executables and shared libraries" | |
74c53c2d MR |
170 | echo "" |
171 | echo "NOTE: Object files are built at the place where configure is launched." | |
172 | exit 1 | |
173 | } | |
cf9d24ad | 174 | |
57bd82d4 MR |
175 | log(){ |
176 | echo "$@" >>$logfile | |
177 | } | |
178 | ||
720c69da | 179 | log_file(){ |
c8e9f801 MR |
180 | log BEGIN $1 |
181 | cat -n $1 >>$logfile | |
182 | log END $1 | |
183 | } | |
184 | ||
2ba042a7 | 185 | echolog(){ |
c8e9f801 | 186 | log "$@" |
57bd82d4 | 187 | echo "$@" |
2ba042a7 MR |
188 | } |
189 | ||
190 | die(){ | |
191 | echolog "$@" | |
192 | cat <<EOF | |
193 | If you think configure made a mistake, make sure you are using the latest | |
194 | version from SVN. If the latest version fails, report the problem to the | |
195 | ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net. | |
196 | EOF | |
720c69da | 197 | if enabled logging; then |
2ba042a7 MR |
198 | cat <<EOF |
199 | Include the log file "$logfile" produced by configure as this will help | |
200 | solving the problem. | |
201 | EOF | |
202 | else | |
203 | cat <<EOF | |
204 | Rerun configure with logging enabled (do not use --log=no), and include the | |
205 | log this produces with your report. | |
206 | EOF | |
207 | fi | |
57bd82d4 MR |
208 | rm -f $TMPC $TMPO $TMPE $TMPS $TMPH |
209 | exit 1 | |
210 | } | |
211 | ||
904e48f1 | 212 | # "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z" |
44161118 MR |
213 | toupper(){ |
214 | echo "$@" | tr '[a-z]' '[A-Z]' | |
215 | } | |
216 | ||
4a5444db MR |
217 | tolower(){ |
218 | echo "$@" | tr '[A-Z]' '[a-z]' | |
219 | } | |
220 | ||
a8d04fba MR |
221 | set_all(){ |
222 | value=$1 | |
223 | shift | |
224 | for var in $*; do | |
225 | eval $var=$value | |
226 | done | |
227 | } | |
228 | ||
799c9e9b MR |
229 | pushvar(){ |
230 | for var in $*; do | |
231 | eval level=\${${var}_level:=0} | |
232 | eval ${var}_${level}="\$$var" | |
233 | eval ${var}_level=$(($level+1)) | |
234 | done | |
235 | } | |
236 | ||
237 | popvar(){ | |
238 | for var in $*; do | |
239 | eval level=\${${var}_level:-0} | |
240 | test $level = 0 && continue | |
241 | eval level=$(($level-1)) | |
242 | eval $var="\${${var}_${level}}" | |
243 | eval ${var}_level=$level | |
244 | eval unset ${var}_${level} | |
245 | done | |
246 | } | |
247 | ||
a8d04fba MR |
248 | enable(){ |
249 | set_all yes $* | |
250 | } | |
251 | ||
252 | disable(){ | |
253 | set_all no $* | |
254 | } | |
255 | ||
57bd82d4 | 256 | enabled(){ |
44161118 MR |
257 | eval test "x\$$1" = "xyes" |
258 | } | |
259 | ||
37970ebf RP |
260 | disabled(){ |
261 | eval test "x\$$1" = "xno" | |
262 | } | |
263 | ||
44161118 MR |
264 | enabled_all(){ |
265 | for opt; do | |
266 | enabled $opt || return 1 | |
267 | done | |
268 | } | |
269 | ||
85bca2c5 DB |
270 | disabled_all(){ |
271 | for opt; do | |
272 | disabled $opt || return 1 | |
273 | done | |
274 | } | |
275 | ||
44161118 MR |
276 | enabled_any(){ |
277 | for opt; do | |
278 | enabled $opt && return 0 | |
279 | done | |
280 | } | |
281 | ||
85bca2c5 DB |
282 | disabled_any(){ |
283 | for opt; do | |
284 | disabled $opt && return 0 | |
285 | done | |
286 | } | |
287 | ||
4a0d6686 AJ |
288 | is_in(){ |
289 | value=$1 | |
290 | shift | |
291 | for var in $*; do | |
292 | [ $var = $value ] && return 0 | |
293 | done | |
294 | return 1 | |
295 | } | |
296 | ||
30fd06be MR |
297 | check_deps(){ |
298 | for cfg; do | |
799c9e9b MR |
299 | enabled ${cfg}_checking && die "Circular dependency for $cfg." |
300 | disabled ${cfg}_checking && continue | |
301 | enable ${cfg}_checking | |
302 | ||
30fd06be MR |
303 | eval dep_all="\$${cfg}_deps" |
304 | eval dep_any="\$${cfg}_deps_any" | |
799c9e9b MR |
305 | |
306 | pushvar cfg dep_all dep_any | |
307 | check_deps $dep_all $dep_any | |
308 | popvar cfg dep_all dep_any | |
309 | ||
30fd06be MR |
310 | enabled_all $dep_all || disable $cfg |
311 | enabled_any $dep_any || disable $cfg | |
799c9e9b | 312 | |
4ec45764 RP |
313 | if enabled $cfg; then |
314 | eval dep_extralibs="\$${cfg}_extralibs" | |
315 | test -n "$dep_extralibs" && add_extralibs $dep_extralibs | |
316 | fi | |
317 | ||
799c9e9b | 318 | disable ${cfg}_checking |
30fd06be MR |
319 | done |
320 | } | |
321 | ||
44161118 MR |
322 | print_config(){ |
323 | pfx=$1 | |
324 | header=$2 | |
325 | makefile=$3 | |
326 | shift 3 | |
327 | for cfg; do | |
3d907e22 | 328 | ucname="`toupper $cfg`" |
44161118 | 329 | if enabled $cfg; then |
3d907e22 MR |
330 | echo "#define ${pfx}${ucname} 1" >> $header |
331 | echo "#define ENABLE_${ucname} 1" >> $header | |
332 | echo "${pfx}${ucname}=yes" >> $makefile | |
333 | else | |
334 | echo "#define ENABLE_${ucname} 0" >> $header | |
44161118 MR |
335 | fi |
336 | done | |
57bd82d4 MR |
337 | } |
338 | ||
339 | flags_saved(){ | |
340 | (: ${SAVE_CFLAGS?}) 2>/dev/null | |
341 | } | |
342 | ||
dcd479c0 | 343 | save_flags(){ |
57bd82d4 | 344 | flags_saved && return |
dcd479c0 MR |
345 | SAVE_CFLAGS="$CFLAGS" |
346 | SAVE_LDFLAGS="$LDFLAGS" | |
347 | SAVE_extralibs="$extralibs" | |
348 | } | |
349 | ||
350 | restore_flags(){ | |
f5d28d10 | 351 | flags_saved || return |
dcd479c0 MR |
352 | CFLAGS="$SAVE_CFLAGS" |
353 | LDFLAGS="$SAVE_LDFLAGS" | |
354 | extralibs="$SAVE_extralibs" | |
355 | unset SAVE_CFLAGS | |
356 | unset SAVE_LDFLAGS | |
357 | unset SAVE_extralibs | |
358 | } | |
359 | ||
360 | temp_cflags(){ | |
361 | save_flags | |
362 | CFLAGS="$CFLAGS $*" | |
363 | } | |
364 | ||
365 | temp_ldflags(){ | |
366 | save_flags | |
367 | LDFLAGS="$LDFLAGS $*" | |
368 | } | |
369 | ||
370 | temp_extralibs(){ | |
371 | save_flags | |
372 | extralibs="$extralibs $*" | |
373 | } | |
374 | ||
57bd82d4 MR |
375 | append(){ |
376 | var=$1 | |
377 | shift | |
378 | flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\"" | |
379 | eval "$var=\"\$$var $*\"" | |
380 | } | |
381 | ||
382 | add_cflags(){ | |
383 | append CFLAGS "$@" | |
384 | } | |
385 | ||
386 | add_ldflags(){ | |
387 | append LDFLAGS "$@" | |
388 | } | |
389 | ||
390 | add_extralibs(){ | |
391 | append extralibs "$@" | |
392 | } | |
393 | ||
b0cfb663 | 394 | check_cmd(){ |
b3cb5d51 | 395 | log "$@" |
9b4f605c | 396 | "$@" >>$logfile 2>&1 |
b0cfb663 MR |
397 | } |
398 | ||
dcd479c0 | 399 | check_cc(){ |
57bd82d4 MR |
400 | log check_cc "$@" |
401 | cat >$TMPC | |
720c69da | 402 | log_file $TMPC |
b0cfb663 | 403 | check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC |
57bd82d4 MR |
404 | } |
405 | ||
406 | check_cpp(){ | |
407 | log check_cpp "$@" | |
dcd479c0 | 408 | cat >$TMPC |
720c69da | 409 | log_file $TMPC |
b0cfb663 | 410 | check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC |
dcd479c0 MR |
411 | } |
412 | ||
940f335a MR |
413 | check_asm(){ |
414 | log check_asm "$@" | |
415 | name="$1" | |
416 | asm="$2" | |
417 | shift 2 | |
418 | check_cc "$@" <<EOF && enable $name || disable $name | |
419 | int foo(void){ | |
420 | asm volatile($asm); | |
421 | } | |
422 | EOF | |
423 | } | |
424 | ||
dcd479c0 | 425 | check_ld(){ |
57bd82d4 | 426 | log check_ld "$@" |
0607887f | 427 | check_cc || return |
3155a644 MR |
428 | flags='' |
429 | libs='' | |
430 | for f; do | |
431 | test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f" | |
432 | done | |
433 | check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs | |
dcd479c0 MR |
434 | } |
435 | ||
436 | check_cflags(){ | |
57bd82d4 MR |
437 | log check_cflags "$@" |
438 | check_cc "$@" <<EOF && add_cflags "$@" | |
dcd479c0 MR |
439 | int x; |
440 | EOF | |
441 | } | |
442 | ||
443 | check_ldflags(){ | |
57bd82d4 MR |
444 | log check_ldflags "$@" |
445 | check_ld "$@" <<EOF && add_ldflags "$@" | |
446 | int main(){ | |
447 | return 0; | |
448 | } | |
dcd479c0 MR |
449 | EOF |
450 | } | |
451 | ||
452 | check_header(){ | |
57bd82d4 | 453 | log check_header "$@" |
dcd479c0 MR |
454 | header=$1 |
455 | shift | |
d8bc5f06 MR |
456 | var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'` |
457 | disable $var | |
458 | check_cpp "$@" <<EOF && enable $var | |
dcd479c0 MR |
459 | #include <$header> |
460 | int x; | |
461 | EOF | |
462 | } | |
463 | ||
464 | check_func(){ | |
57bd82d4 | 465 | log check_func "$@" |
dcd479c0 MR |
466 | func=$1 |
467 | shift | |
d8bc5f06 MR |
468 | disable $func |
469 | check_ld "$@" <<EOF && enable $func | |
dcd479c0 MR |
470 | extern int $func(); |
471 | int main(){ | |
472 | $func(); | |
473 | } | |
474 | EOF | |
475 | } | |
476 | ||
f8d7b072 MR |
477 | check_func2(){ |
478 | log check_func2 "$@" | |
479 | headers=$1 | |
480 | func=$2 | |
481 | shift 2 | |
482 | disable $func | |
483 | incs="" | |
484 | for hdr in $headers; do | |
485 | incs="$incs | |
486 | #include <$hdr>" | |
487 | done | |
488 | check_ld "$@" <<EOF && enable $func | |
489 | $incs | |
490 | int main(){ | |
491 | (void) $func; | |
492 | return 0; | |
493 | } | |
494 | EOF | |
495 | } | |
496 | ||
57bd82d4 MR |
497 | check_lib(){ |
498 | log check_lib "$@" | |
499 | header="$1" | |
500 | func="$2" | |
501 | shift 2 | |
fcfcde17 MR |
502 | temp_extralibs "$@" |
503 | check_header $header && check_func $func && add_extralibs "$@" | |
504 | err=$? | |
505 | restore_flags | |
506 | return $err | |
57bd82d4 MR |
507 | } |
508 | ||
f8d7b072 MR |
509 | check_lib2(){ |
510 | log check_lib2 "$@" | |
511 | headers="$1" | |
512 | func="$2" | |
513 | shift 2 | |
514 | temp_extralibs "$@" | |
515 | check_func2 "$headers" $func && add_extralibs "$@" | |
516 | err=$? | |
517 | restore_flags | |
518 | return $err | |
519 | } | |
520 | ||
dcd479c0 | 521 | check_exec(){ |
90be59ef | 522 | check_ld "$@" && { enabled cross_compile || $TMPE >>$logfile 2>&1; } |
57bd82d4 MR |
523 | } |
524 | ||
7dfef245 MR |
525 | check_exec_crash(){ |
526 | code=`cat` | |
527 | ||
528 | # exit() is not async signal safe. _Exit (C99) and _exit (POSIX) | |
529 | # are safe but may not be available everywhere. Thus we use | |
530 | # raise(SIGTERM) instead. The check is run in a subshell so we | |
531 | # can redirect the "Terminated" message from the shell. SIGBUS | |
532 | # is not defined by standard C so it is used conditionally. | |
533 | ||
534 | (check_exec "$@") >>$logfile 2>&1 <<EOF | |
535 | #include <signal.h> | |
536 | static void sighandler(int sig){ | |
537 | raise(SIGTERM); | |
538 | } | |
539 | int main(){ | |
540 | signal(SIGILL, sighandler); | |
541 | signal(SIGFPE, sighandler); | |
542 | signal(SIGSEGV, sighandler); | |
543 | #ifdef SIGBUS | |
544 | signal(SIGBUS, sighandler); | |
545 | #endif | |
546 | { $code } | |
547 | } | |
548 | EOF | |
549 | } | |
550 | ||
57bd82d4 MR |
551 | require(){ |
552 | name="$1" | |
553 | header="$2" | |
554 | func="$3" | |
555 | shift 3 | |
556 | check_lib $header $func "$@" || die "ERROR: $name not found" | |
dcd479c0 MR |
557 | } |
558 | ||
f8d7b072 MR |
559 | require2(){ |
560 | name="$1" | |
561 | headers="$2" | |
562 | func="$3" | |
563 | shift 3 | |
564 | check_lib2 "$headers" $func "$@" || die "ERROR: $name not found" | |
565 | } | |
566 | ||
eea50282 MR |
567 | check_foo_config(){ |
568 | cfg=$1 | |
569 | pkg=$2 | |
570 | header=$3 | |
571 | func=$4 | |
572 | shift 4 | |
573 | disable $cfg | |
574 | check_cmd ${pkg}-config --version | |
575 | err=$? | |
576 | if test "$err" = 0; then | |
577 | temp_cflags `${pkg}-config --cflags` | |
578 | temp_extralibs `${pkg}-config --libs` | |
579 | check_lib "$@" $header $func && enable $cfg | |
580 | fi | |
581 | return $err | |
582 | } | |
583 | ||
c505dd31 MR |
584 | apply(){ |
585 | file=$1 | |
586 | shift | |
587 | "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp" | |
588 | } | |
589 | ||
4a0d6686 AJ |
590 | COMPONENT_LIST=" |
591 | bsfs | |
592 | decoders | |
593 | demuxers | |
594 | encoders | |
595 | muxers | |
596 | parsers | |
597 | protocols | |
598 | " | |
599 | ||
600 | CONFIG_LIST=" | |
601 | $COMPONENT_LIST | |
c88f5d72 MR |
602 | avisynth |
603 | beos_netserver | |
c88f5d72 MR |
604 | ffmpeg |
605 | ffplay | |
606 | ffserver | |
607 | gpl | |
ecfc4f44 | 608 | gprof |
d8d0d0b2 | 609 | gray |
c88f5d72 | 610 | ipv6 |
7bc5f2a8 | 611 | liba52 |
f8904fd9 | 612 | liba52bin |
f5a756ef DB |
613 | libamr |
614 | libamr_nb | |
615 | libamr_wb | |
f7b8bffe | 616 | libdc1394 |
2eed5a46 DB |
617 | libfaac |
618 | libfaad | |
619 | libfaadbin | |
c88f5d72 | 620 | libgsm |
6ebe07fb | 621 | libmp3lame |
c88f5d72 MR |
622 | libnut |
623 | libogg | |
150d2772 | 624 | libtheora |
c88f5d72 | 625 | libvorbis |
1cc60c47 DB |
626 | libx264 |
627 | libxvid | |
c88f5d72 | 628 | memalign_hack |
c88f5d72 MR |
629 | mpegaudio_hp |
630 | network | |
2b4c3615 | 631 | powerpc_perf |
c88f5d72 | 632 | pp |
bd2216e4 | 633 | small |
c88f5d72 MR |
634 | swscaler |
635 | vhook | |
56a059ac | 636 | x11grab |
c88f5d72 | 637 | zlib |
4a0d6686 | 638 | " |
c88f5d72 | 639 | |
8eee7025 DB |
640 | THREADS_LIST=' |
641 | beosthreads | |
8eee7025 DB |
642 | pthreads |
643 | w32threads | |
644 | ' | |
645 | ||
3f5b56e5 MR |
646 | ARCH_LIST=' |
647 | alpha | |
648 | armv4l | |
649 | bfin | |
650 | ia64 | |
651 | m68k | |
652 | mips | |
653 | parisc | |
654 | powerpc | |
655 | s390 | |
656 | sh4 | |
657 | sparc | |
658 | sparc64 | |
659 | x86 | |
660 | x86_32 | |
661 | x86_64 | |
662 | ' | |
663 | ||
664 | ARCH_EXT_LIST=' | |
1ac9331a | 665 | altivec |
1ac9331a | 666 | armv5te |
edab3048 | 667 | armv6 |
3f5b56e5 MR |
668 | iwmmxt |
669 | mmi | |
670 | mmx | |
9eeed841 | 671 | ssse3 |
bd9d34a0 | 672 | vis |
3f5b56e5 MR |
673 | ' |
674 | ||
675 | HAVE_LIST=" | |
676 | $ARCH_EXT_LIST | |
677 | $THREADS_LIST | |
678 | altivec_h | |
c9fdab0d | 679 | arpa_inet_h |
c88f5d72 | 680 | byteswap_h |
ecf97f22 | 681 | closesocket |
1ac9331a | 682 | cmov |
e16e49ac | 683 | conio_h |
c88f5d72 | 684 | dcbzl |
f8aa696f DB |
685 | dev_bktr_ioctl_bt848_h |
686 | dev_bktr_ioctl_meteor_h | |
687 | dev_ic_bt8xx_h | |
688 | dev_video_meteor_ioctl_meteor_h | |
689 | dev_video_bktr_ioctl_bt848_h | |
18b67ae5 | 690 | dlfcn_h |
c88f5d72 | 691 | dlopen |
245626d0 DB |
692 | ebp_available |
693 | ebx_available | |
c2a29455 | 694 | fast_64bit |
7073e9fc | 695 | fast_cmov |
7b829d2a | 696 | fast_unaligned |
9d99cc5a | 697 | fork |
c88f5d72 | 698 | freetype2 |
da9e86f8 | 699 | gethrtime |
4e68cb8a | 700 | GetProcessTimes |
66be5b45 | 701 | getrusage |
c88f5d72 | 702 | imlib2 |
2e1913b1 | 703 | inet_aton |
c88f5d72 | 704 | lrintf |
f8aa696f DB |
705 | machine_ioctl_bt848_h |
706 | machine_ioctl_meteor_h | |
c88f5d72 MR |
707 | malloc_h |
708 | memalign | |
6ffa87d3 | 709 | mkstemp |
c88f5d72 | 710 | mlib |
9cafbd6c | 711 | ppc64 |
c88f5d72 MR |
712 | sdl |
713 | sdl_video_size | |
deb29777 | 714 | soundcard_h |
b0c858d8 | 715 | sys_poll_h |
deb29777 | 716 | sys_soundcard_h |
e16e49ac | 717 | termios_h |
b265431e | 718 | threads |
6ff3f3e7 | 719 | winsock2_h |
0cb78cef | 720 | " |
44161118 | 721 | |
520cc7f1 | 722 | CMDLINE_SELECT=" |
3f5b56e5 | 723 | $ARCH_EXT_LIST |
520cc7f1 | 724 | $CONFIG_LIST |
8eee7025 | 725 | $THREADS_LIST |
520cc7f1 MR |
726 | debug |
727 | extra_warnings | |
520cc7f1 MR |
728 | shared |
729 | static | |
730 | " | |
731 | ||
912f3148 DB |
732 | # code dependency declarations |
733 | ||
9eeed841 MR |
734 | # architecture extensions |
735 | altivec_deps="powerpc" | |
736 | armv5te_deps="armv4l" | |
737 | armv6_deps="armv4l" | |
738 | iwmmxt_deps="armv4l" | |
e241ba14 | 739 | mmi_deps="mips" |
9eeed841 MR |
740 | mmx_deps="x86" |
741 | ssse3_deps="x86" | |
bd9d34a0 | 742 | vis_deps="sparc" |
9eeed841 | 743 | |
912f3148 | 744 | # decoders / encoders |
6ea67bbb | 745 | ac3_decoder_deps="gpl" |
33a0dd37 | 746 | dxa_decoder_deps="zlib" |
30fd06be | 747 | flashsv_decoder_deps="zlib" |
773be23a | 748 | flashsv_encoder_deps="zlib" |
4a815a7f | 749 | flv_decoder_deps="h263_decoder" |
df495dbd | 750 | h263_decoder_deps="h263_parser mpeg4video_parser" |
4a815a7f | 751 | h263i_decoder_deps="h263_decoder" |
26b4fe82 | 752 | h264_decoder_deps="h264_parser" |
30fd06be | 753 | mpeg_xvmc_decoder_deps="xvmc" |
4a815a7f DB |
754 | mpeg4_decoder_deps="h263_decoder" |
755 | msmpeg4v1_decoder_deps="h263_decoder" | |
756 | msmpeg4v2_decoder_deps="h263_decoder" | |
757 | msmpeg4v3_decoder_deps="h263_decoder" | |
30fd06be MR |
758 | png_decoder_deps="zlib" |
759 | png_encoder_deps="zlib" | |
e2525c6f | 760 | svq3_decoder_deps="h264_parser" |
4a815a7f DB |
761 | vc1_decoder_deps="h263_decoder" |
762 | wmv1_decoder_deps="h263_decoder" | |
763 | wmv2_decoder_deps="h263_decoder" | |
764 | wmv3_decoder_deps="h263_decoder" | |
30fd06be MR |
765 | zmbv_decoder_deps="zlib" |
766 | zmbv_encoder_deps="zlib" | |
767 | ||
912f3148 | 768 | # external libraries |
7bc5f2a8 | 769 | liba52_decoder_deps="liba52" |
4ec45764 | 770 | liba52bin_decoder_extralibs='$ldl' |
f5a756ef DB |
771 | libamr_nb_decoder_deps="libamr_nb" |
772 | libamr_nb_encoder_deps="libamr_nb" | |
773 | libamr_wb_decoder_deps="libamr_wb" | |
774 | libamr_wb_encoder_deps="libamr_wb" | |
c9171a83 | 775 | libfaac_encoder_deps="libfaac" |
69ddbd1d | 776 | libfaad_decoder_deps="libfaad" |
4ec45764 | 777 | libfaadbin_decoder_extralibs='$ldl' |
299c77d5 MR |
778 | libgsm_decoder_deps="libgsm" |
779 | libgsm_encoder_deps="libgsm" | |
8ffed8d8 MR |
780 | libgsm_ms_decoder_deps="libgsm" |
781 | libgsm_ms_encoder_deps="libgsm" | |
1cc60c47 | 782 | libmp3lame_encoder_deps="libmp3lame" |
150d2772 | 783 | libtheora_encoder_deps="libtheora" |
b0caf888 DB |
784 | libvorbis_decoder_deps="libvorbis" |
785 | libvorbis_encoder_deps="libvorbis" | |
1cc60c47 DB |
786 | libx264_encoder_deps="libx264" |
787 | libxvid_encoder_deps="libxvid" | |
13566c31 | 788 | mpeg4aac_decoder_deps="libfaad" |
30fd06be | 789 | |
912f3148 | 790 | # demuxers / muxers |
03a76ba9 | 791 | ac3_demuxer_deps="ac3_parser" |
50383e88 | 792 | audio_beos_demuxer_deps="audio_beos" |
4ec45764 | 793 | audio_beos_demuxer_extralibs="-lmedia -lbe" |
50383e88 | 794 | audio_beos_muxer_deps="audio_beos" |
4ec45764 | 795 | audio_beos_muxer_extralibs="-lmedia -lbe" |
73483024 | 796 | bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h" |
30fd06be | 797 | dv1394_demuxer_deps="dv1394" |
f7b8bffe | 798 | libdc1394_demuxer_deps="libdc1394" |
d7c59247 DB |
799 | libnut_demuxer_deps="libnut" |
800 | libnut_muxer_deps="libnut" | |
4bd8e17c | 801 | mp3_demuxer_deps="mpegaudio_parser" |
30fd06be | 802 | ogg_muxer_deps="libogg" |
c7682de0 RP |
803 | oss_demuxer_deps_any="soundcard_h sys_soundcard_h" |
804 | oss_muxer_deps_any="soundcard_h sys_soundcard_h" | |
30fd06be | 805 | redir_demuxer_deps="network" |
47b515bf | 806 | rtp_muxer_deps="network mpegts_demuxer" |
c08fb000 AB |
807 | rtsp_demuxer_deps="rtp_protocol rtp_muxer" |
808 | sdp_demuxer_deps="rtsp_demuxer" | |
06e31011 RP |
809 | v4l2_demuxer_deps="linux_videodev2_h" |
810 | v4l_demuxer_deps="linux_videodev_h" | |
06eab4ba | 811 | x11_grab_device_demuxer_deps="x11grab XShmCreateImage" |
4ec45764 | 812 | x11_grab_device_demuxer_extralibs="-lX11 -lXext" |
30fd06be | 813 | |
912f3148 | 814 | # protocols |
c08fb000 AB |
815 | http_protocol_deps="network" |
816 | rtp_protocol_deps="udp_protocol" | |
817 | tcp_protocol_deps="network" | |
818 | udp_protocol_deps="network" | |
819 | ||
912f3148 | 820 | # programs |
fa859b4d | 821 | ffplay_deps="sdl" |
c08fb000 | 822 | ffserver_deps="muxers rtp_protocol" |
4ec45764 RP |
823 | ffserver_extralibs='$ldl' |
824 | vhook_extralibs='$ldl' | |
a2830dca | 825 | |
912f3148 | 826 | |
0f3cb305 | 827 | # set temporary file name |
57514323 | 828 | if test ! -z "$TMPDIR" ; then |
0f3cb305 | 829 | TMPDIR1="${TMPDIR}" |
57514323 | 830 | elif test ! -z "$TEMPDIR" ; then |
0f3cb305 | 831 | TMPDIR1="${TEMPDIR}" |
3d204385 | 832 | else |
0f3cb305 | 833 | TMPDIR1="/tmp" |
3d204385 NK |
834 | fi |
835 | ||
0f3cb305 FB |
836 | TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c" |
837 | TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o" | |
f3ec2d46 | 838 | TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}" |
0f3cb305 FB |
839 | TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S" |
840 | TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h" | |
841 | ||
de6d9b64 | 842 | # default parameters |
8a608357 | 843 | |
497237c7 | 844 | enable logging |
2ba042a7 | 845 | logfile="config.err" |
8a608357 MR |
846 | |
847 | # installation paths | |
2266e085 | 848 | PREFIX="/usr/local" |
c75560ae | 849 | libdir='$(PREFIX)/lib' |
84c22efd | 850 | shlibdir="$libdir" |
c75560ae | 851 | incdir='$(PREFIX)/include/ffmpeg' |
4ca5ece5 | 852 | mandir='$(PREFIX)/share/man' |
c75560ae | 853 | bindir='$(PREFIX)/bin' |
8a608357 MR |
854 | |
855 | # toolchain | |
de6d9b64 FB |
856 | cc="gcc" |
857 | ar="ar" | |
be7109c1 | 858 | ranlib="ranlib" |
4a908fbc | 859 | make="make" |
0f3cb305 | 860 | strip="strip" |
8a608357 | 861 | asmalign_pot="unknown" |
20369773 | 862 | ln_s="ln -sf" |
8a608357 MR |
863 | |
864 | # machine | |
cc6a90dd | 865 | arch=`uname -m` |
38d0a8aa | 866 | cpu="generic" |
8a608357 | 867 | |
8a608357 | 868 | # OS |
b9663405 | 869 | targetos=$(tolower $(uname -s)) |
8a608357 | 870 | |
8a608357 | 871 | # libraries |
497237c7 | 872 | enable zlib |
8a608357 MR |
873 | |
874 | # configurable options | |
497237c7 RP |
875 | enable debug |
876 | enable dostrip | |
877 | enable ffmpeg | |
878 | enable ffplay | |
879 | enable ffserver | |
880 | enable ipv6 | |
881 | enable static | |
882 | enable mpegaudio_hp | |
883 | enable network | |
884 | enable optimize | |
885 | enable protocols | |
8a608357 MR |
886 | vhook="default" |
887 | ||
8a608357 | 888 | # build settings |
baa3a937 | 889 | SHFLAGS='-shared -Wl,-soname,$@' |
cab3ef82 | 890 | VHOOKSHFLAGS='$(SHFLAGS)' |
e240ee67 | 891 | LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil' |
c536cb09 | 892 | FFSERVERLDFLAGS=-Wl,-E |
f39e56a8 | 893 | LDCONFIG="ldconfig" |
f3ec2d46 SG |
894 | LIBPREF="lib" |
895 | LIBSUF=".a" | |
4bdd05e7 | 896 | LIB='$(LIBPREF)$(NAME)$(LIBSUF)' |
f3ec2d46 SG |
897 | SLIBPREF="lib" |
898 | SLIBSUF=".so" | |
4bdd05e7 | 899 | SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)' |
b29bddab DB |
900 | SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)' |
901 | SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)' | |
21d0a823 | 902 | LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIB)"' |
ef0bc4c9 | 903 | |
c597172e MR |
904 | # find source path |
905 | source_path="`dirname \"$0\"`" | |
497237c7 | 906 | enable source_path_used |
c597172e MR |
907 | if test -z "$source_path" -o "$source_path" = "." ; then |
908 | source_path="`pwd`" | |
497237c7 | 909 | disable source_path_used |
c597172e MR |
910 | else |
911 | source_path="`cd \"$source_path\"; pwd`" | |
912 | echo "$source_path" | grep -q '[[:blank:]]' && | |
913 | die "Out of tree builds are impossible with whitespace in source path." | |
914 | fi | |
915 | ||
c597172e MR |
916 | FFMPEG_CONFIGURATION="$@" |
917 | ||
facbea95 AJ |
918 | ENCODER_LIST=`sed -n 's/^[^#]*ENC.*(.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"` |
919 | DECODER_LIST=`sed -n 's/^[^#]*DEC.*(.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"` | |
920 | PARSER_LIST=`sed -n 's/^[^#]*PARSER.*(.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"` | |
921 | BSF_LIST=`sed -n 's/^[^#]*BSF.*(.*, *\(.*\)).*/\1_bsf/p' "$source_path/libavcodec/allcodecs.c"` | |
922 | MUXER_LIST=`sed -n 's/^[^#]*_MUX.*(.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"` | |
923 | DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*(.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"` | |
924 | PROTOCOL_LIST=`sed -n 's/^[^#]*PROTOCOL.*(.*, *\(.*\)).*/\1_protocol/p' "$source_path/libavformat/allformats.c"` | |
c597172e | 925 | |
cd61e407 | 926 | enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST $PROTOCOL_LIST $BSF_LIST |
d3ea5692 | 927 | enable $ARCH_EXT_LIST |
c597172e MR |
928 | |
929 | die_unknown(){ | |
930 | echo "Unknown option \"$1\"." | |
931 | echo "See $0 --help for available options." | |
932 | exit 1 | |
933 | } | |
934 | ||
794f8e97 PI |
935 | show_list() { |
936 | for part in $*; do | |
937 | echo $part | sed 's/_[^_]*$//' | |
938 | done | sort | |
939 | exit 0 | |
940 | } | |
941 | ||
c597172e MR |
942 | for opt do |
943 | optval="${opt#*=}" | |
944 | case "$opt" in | |
945 | --log) | |
946 | ;; | |
947 | --log=*) logging="$optval" | |
948 | ;; | |
949 | --prefix=*) PREFIX="$optval" | |
950 | ;; | |
951 | --libdir=*) libdir="$optval" | |
952 | ;; | |
953 | --shlibdir=*) shlibdir="$optval" | |
954 | ;; | |
955 | --incdir=*) incdir="$optval" | |
956 | ;; | |
957 | --mandir=*) mandir="$optval" | |
958 | ;; | |
959 | --source-path=*) source_path="$optval" | |
960 | ;; | |
961 | --cross-prefix=*) cross_prefix="$optval" | |
962 | ;; | |
497237c7 | 963 | --cross-compile) enable cross_compile |
c597172e MR |
964 | ;; |
965 | --target-os=*) targetos="$optval" | |
966 | ;; | |
967 | --cc=*) cc="$optval" | |
968 | ;; | |
969 | --make=*) make="$optval" | |
970 | ;; | |
971 | --extra-cflags=*) add_cflags "$optval" | |
972 | ;; | |
973 | --extra-ldflags=*) add_ldflags "$optval" | |
974 | ;; | |
975 | --extra-libs=*) add_extralibs "$optval" | |
976 | ;; | |
977 | --build-suffix=*) BUILDSUF="$optval" | |
978 | ;; | |
979 | --arch=*) arch="$optval" | |
980 | ;; | |
981 | --cpu=*) cpu="$optval" | |
982 | ;; | |
497237c7 | 983 | --disable-opts) disable optimize |
c597172e | 984 | ;; |
497237c7 | 985 | --enable-sunmlib) enable mlib |
c597172e | 986 | ;; |
497237c7 | 987 | --disable-strip) disable dostrip |
c597172e MR |
988 | ;; |
989 | --disable-encoders) disable $ENCODER_LIST | |
990 | ;; | |
991 | --disable-decoders) disable $DECODER_LIST | |
992 | ;; | |
993 | --disable-muxers) disable $MUXER_LIST | |
994 | ;; | |
995 | --disable-demuxers) disable $DEMUXER_LIST | |
996 | ;; | |
997 | --disable-parsers) disable $PARSER_LIST | |
998 | ;; | |
cd61e407 JM |
999 | --disable-bsfs) disable $BSF_LIST |
1000 | ;; | |
c08fb000 AB |
1001 | --disable-protocols) disable $PROTOCOL_LIST |
1002 | ;; | |
c597172e MR |
1003 | --enable-*=*|--disable-*=*) |
1004 | eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'` | |
1005 | case "$thing" in | |
cd61e407 | 1006 | encoder|decoder|muxer|demuxer|parser|bsf|protocol) $action ${optval}_${thing} ;; |
c597172e MR |
1007 | *) die_unknown "$opt" ;; |
1008 | esac | |
1009 | ;; | |
1010 | --enable-?*|--disable-?*) | |
1011 | eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'` | |
1012 | echo "$CMDLINE_SELECT" | grep -q "^ *$option\$" || die_unknown $opt | |
1013 | $action $option | |
1014 | ;; | |
794f8e97 PI |
1015 | --list-*) |
1016 | NAME="${opt#--list-}" | |
4a0d6686 | 1017 | is_in $NAME $COMPONENT_LIST || die_unknown $opt |
794f8e97 PI |
1018 | NAME=$(toupper ${NAME%s}) |
1019 | eval show_list \$${NAME}_LIST | |
1020 | ;; | |
c2675d4a | 1021 | --help|-h) show_help |
c597172e MR |
1022 | ;; |
1023 | *) | |
1024 | die_unknown $opt | |
1025 | ;; | |
1026 | esac | |
1027 | done | |
1028 | ||
270739bb MR |
1029 | case "$arch" in |
1030 | i386|i486|i586|i686|i86pc|BePC) | |
1031 | arch="x86_32" | |
7b829d2a | 1032 | enable fast_unaligned |
270739bb MR |
1033 | ;; |
1034 | x86_64|amd64) | |
1035 | arch="x86_32" | |
7b829d2a | 1036 | enable fast_unaligned |
270739bb MR |
1037 | canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`" |
1038 | if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then | |
1039 | if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then | |
1040 | arch="x86_64" | |
c2a29455 | 1041 | enable fast_64bit |
270739bb MR |
1042 | fi |
1043 | fi | |
1044 | ;; | |
1045 | # armv4l is a subset of armv[567]*l | |
1046 | arm|armv[4567]*l) | |
1047 | arch="armv4l" | |
1048 | ;; | |
1049 | alpha) | |
1050 | arch="alpha" | |
c2a29455 | 1051 | enable fast_64bit |
270739bb | 1052 | ;; |
c2a29455 | 1053 | "Power Macintosh"|ppc|powerpc) |
270739bb MR |
1054 | arch="powerpc" |
1055 | ;; | |
c2a29455 AJ |
1056 | ppc64) |
1057 | arch="powerpc" | |
1058 | enable fast_64bit | |
1059 | ;; | |
e241ba14 | 1060 | mips|mipsel|IP*) |
270739bb MR |
1061 | arch="mips" |
1062 | ;; | |
1063 | sun4u|sparc64) | |
1064 | arch="sparc64" | |
c2a29455 | 1065 | enable fast_64bit |
270739bb MR |
1066 | ;; |
1067 | sparc) | |
1068 | arch="sparc" | |
1069 | ;; | |
1070 | sh4) | |
1071 | arch="sh4" | |
1072 | ;; | |
c2a29455 AJ |
1073 | parisc) |
1074 | arch="parisc" | |
1075 | ;; | |
1076 | parisc64) | |
270739bb | 1077 | arch="parisc" |
c2a29455 | 1078 | enable fast_64bit |
270739bb MR |
1079 | ;; |
1080 | s390|s390x) | |
1081 | arch="s390" | |
1082 | ;; | |
1083 | m68k) | |
1084 | arch="m68k" | |
1085 | ;; | |
1086 | ia64) | |
1087 | arch="ia64" | |
c2a29455 | 1088 | enable fast_64bit |
270739bb MR |
1089 | ;; |
1090 | bfin) | |
1091 | arch="bfin" | |
1092 | ;; | |
1093 | *) | |
1094 | arch="unknown" | |
1095 | ;; | |
1096 | esac | |
1097 | ||
9eeed841 MR |
1098 | enable $arch |
1099 | enabled_any x86_32 x86_64 && enable x86 | |
1100 | enabled sparc64 && enable sparc | |
1101 | ||
ef0bc4c9 | 1102 | # OS specific |
ced75d92 | 1103 | case $targetos in |
4a5444db | 1104 | beos|haiku|zeta) |
74cec57d | 1105 | PREFIX="$HOME/config" |
d474299a MR |
1106 | # helps building libavcodec |
1107 | add_cflags "-DPIC -fomit-frame-pointer" | |
1108 | # 3 gcc releases known for BeOS, each with ugly bugs | |
1109 | gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`" | |
1110 | case "$gcc_version" in | |
1111 | 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc" | |
497237c7 | 1112 | disable mmx |
d474299a MR |
1113 | ;; |
1114 | *20010315*) echo "BeBits gcc" | |
1115 | add_cflags "-fno-expensive-optimizations" | |
1116 | ;; | |
1117 | esac | |
74cec57d | 1118 | LDCONFIG="echo ignoring ldconfig" |
d474299a | 1119 | SHFLAGS=-nostart |
d474299a | 1120 | # enable BeOS things |
497237c7 | 1121 | enable audio_beos |
d474299a MR |
1122 | # no need for libm, but the inet stuff |
1123 | # Check for BONE | |
74cec57d | 1124 | # XXX: actually should check for NOT net_server |
d474299a | 1125 | if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then |
4ec45764 | 1126 | network_extralibs="-lbind -lsocket" |
d474299a | 1127 | else |
497237c7 | 1128 | enable beos_netserver |
4ec45764 | 1129 | network_extralibs="-lnet" |
d474299a | 1130 | fi ;; |
4a5444db | 1131 | sunos) |
d474299a MR |
1132 | FFSERVERLDFLAGS="" |
1133 | SHFLAGS="-shared -Wl,-h,\$@" | |
4ec45764 | 1134 | network_extralibs="-lsocket -lnsl" |
d474299a | 1135 | ;; |
4a5444db | 1136 | netbsd) |
4ec45764 RP |
1137 | oss_demuxer_extralibs="-lossaudio" |
1138 | oss_muxer_extralibs="-lossaudio" | |
d474299a | 1139 | ;; |
4a5444db | 1140 | openbsd) |
497237c7 | 1141 | disable need_memalign |
d474299a | 1142 | LIBOBJFLAGS="\$(PIC)" |
21d0a823 | 1143 | LDCONFIG="ldconfig -m \$(SHLIBDIR)" |
d474299a MR |
1144 | SHFLAGS='-shared' |
1145 | SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF).$(LIBVERSION)' | |
1146 | SLIBNAME_WITH_VERSION='$(SLIBNAME)' | |
1147 | SLIBNAME_WITH_MAJOR='$(SLIBNAME)' | |
4ec45764 RP |
1148 | oss_demuxer_extralibs="-lossaudio" |
1149 | oss_muxer_extralibs="-lossaudio" | |
d474299a | 1150 | ;; |
4a5444db | 1151 | freebsd) |
497237c7 | 1152 | disable need_memalign |
d474299a | 1153 | ;; |
4a5444db | 1154 | bsd/os) |
13ef7825 | 1155 | osextralibs="-lpoll -lgnugetopt" |
d474299a MR |
1156 | strip="strip -d" |
1157 | ;; | |
4a5444db | 1158 | darwin) |
497237c7 | 1159 | disable need_memalign |
21d0a823 DB |
1160 | SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(SHLIBDIR)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION) -Wl,-read_only_relocs,suppress" |
1161 | VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$@' | |
d474299a MR |
1162 | strip="strip -x" |
1163 | FFLDFLAGS="-Wl,-dynamic,-search_paths_first" | |
1164 | SLIBSUF=".dylib" | |
1165 | SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)' | |
1166 | SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)' | |
1167 | FFSERVERLDFLAGS=-Wl,-bind_at_load | |
1168 | ;; | |
4a5444db | 1169 | mingw32*) |
91c5172d | 1170 | targetos=mingw32 |
5880d5b5 | 1171 | shlibdir="$bindir" |
70b4d492 RP |
1172 | VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil' |
1173 | VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)' | |
1174 | if enabled swscaler; then | |
1175 | VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale" | |
1176 | VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)" | |
1177 | fi | |
497237c7 | 1178 | disable ffserver |
4ec9ec81 MR |
1179 | SLIBPREF="" |
1180 | SLIBSUF=".dll" | |
1181 | EXESUF=".exe" | |
1182 | SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)' | |
1183 | SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)' | |
1184 | SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)" | |
21d0a823 | 1185 | SLIB_INSTALL_EXTRA_CMD="-install -m 644 \$(SLIBNAME_WITH_MAJOR:\$(SLIBSUF)=.lib) \"\$(SHLIBDIR)/\$(SLIBNAME_WITH_MAJOR:\$(SLIBSUF)=.lib)\"" |
d205abe9 | 1186 | SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base" |
d474299a | 1187 | ;; |
4a5444db | 1188 | cygwin*) |
ced75d92 | 1189 | targetos=cygwin |
d474299a | 1190 | shlibdir="$bindir" |
41d5a86a VP |
1191 | VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil' |
1192 | VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)' | |
1193 | if enabled swscaler; then | |
1194 | VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale" | |
1195 | VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)" | |
1196 | fi | |
d474299a MR |
1197 | EXESUF=".exe" |
1198 | SLIBPREF="cyg" | |
1199 | SLIBSUF=".dll" | |
1200 | SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)' | |
1201 | SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)' | |
d205abe9 | 1202 | SHFLAGS='-shared -Wl,--out-implib=lib$(NAME).dll.a -Wl,--enable-auto-image-base' |
d474299a | 1203 | ;; |
4a5444db | 1204 | linux) |
d474299a | 1205 | LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS" |
497237c7 | 1206 | enable dv1394 |
d474299a | 1207 | ;; |
4a5444db | 1208 | irix*) |
ced75d92 | 1209 | targetos=irix |
d474299a | 1210 | ranlib="echo ignoring ranlib" |
d474299a | 1211 | ;; |
d474299a MR |
1212 | *) |
1213 | targetos="${targetos}-UNKNOWN" | |
1214 | ;; | |
ef0bc4c9 | 1215 | esac |
de6d9b64 | 1216 | |
c597172e | 1217 | add_extralibs $osextralibs |
de6d9b64 | 1218 | |
13ef7825 RP |
1219 | check_ldflags -lm |
1220 | ||
e3c00e34 | 1221 | if ! disabled logging ; then |
90be59ef | 1222 | enabled logging || logfile="$logging" |
57bd82d4 MR |
1223 | echo "# $0 $@" >$logfile |
1224 | set >>$logfile | |
2ba042a7 MR |
1225 | else |
1226 | logfile=/dev/null | |
57bd82d4 | 1227 | fi |
e89b8b0a | 1228 | |
28d8e661 DB |
1229 | # Combine FFLDFLAGS and the LDFLAGS environment variable. |
1230 | LDFLAGS="$FFLDFLAGS $LDFLAGS" | |
e89b8b0a | 1231 | |
497237c7 | 1232 | test -n "$cross_prefix" && enable cross_compile |
1ea46bed MR |
1233 | cc="${cross_prefix}${cc}" |
1234 | ar="${cross_prefix}${ar}" | |
1235 | ranlib="${cross_prefix}${ranlib}" | |
1236 | strip="${cross_prefix}${strip}" | |
1237 | ||
320d060a | 1238 | # we need to build at least one lib type |
93b3c083 | 1239 | if ! enabled_any static shared; then |
320d060a DB |
1240 | cat <<EOF |
1241 | At least one library type must be built. | |
1242 | Specify --enable-static to build the static libraries or --enable-shared to | |
1243 | build the shared libraries as well. To only build the shared libraries specify | |
1244 | --disable-static in addition to --enable-shared. | |
1245 | EOF | |
1246 | exit 1; | |
1247 | fi | |
1248 | ||
2a320695 RP |
1249 | if disabled static; then |
1250 | LIB="" | |
1251 | fi | |
1252 | ||
93b3c083 | 1253 | if ! enabled libogg; then |
ddf50e4c RP |
1254 | enabled libtheora && die "libogg must be enabled to enable libtheora." |
1255 | enabled libvorbis && die "libogg must be enabled to enable libvorbis." | |
5c5dea3f NB |
1256 | fi |
1257 | ||
a2234ceb RP |
1258 | if enabled_any libfaad libfaadbin ; then |
1259 | if check_header faad.h; then | |
1260 | check_cc << EOF | |
1261 | #include <faad.h> | |
1262 | #ifndef FAAD2_VERSION | |
1263 | ok faad1 | |
1264 | #endif | |
1265 | int main( void ) { return 0; } | |
1266 | EOF | |
1267 | test $? = 0 && enable libfaad2 | |
1268 | else | |
ff3dac65 | 1269 | die "FAAD test failed." |
a2234ceb RP |
1270 | fi |
1271 | fi | |
1272 | ||
1273 | ||
93b3c083 | 1274 | if ! enabled gpl; then |
54118497 RP |
1275 | die_gpl_disabled(){ |
1276 | name=$1 | |
1277 | shift | |
1278 | enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified." | |
1279 | } | |
1280 | die_gpl_disabled "The Postprocessing code" pp | |
7bc5f2a8 | 1281 | die_gpl_disabled "liba52" liba52 |
1cc60c47 DB |
1282 | die_gpl_disabled "libx264" libx264 |
1283 | die_gpl_disabled "libxvidcore" libxvid | |
54118497 RP |
1284 | die_gpl_disabled "FAAD2" libfaad2 |
1285 | die_gpl_disabled "The X11 grabber" x11grab | |
1286 | die_gpl_disabled "The software scaler" swscaler | |
ebb810d9 | 1287 | fi |
b2e3c528 | 1288 | |
9eeed841 | 1289 | check_deps $ARCH_EXT_LIST |
0f3cb305 | 1290 | |
5d323602 MR |
1291 | test -z "$need_memalign" && need_memalign="$mmx" |
1292 | ||
cf9d24ad | 1293 | #Darwin CC versions |
ced75d92 | 1294 | if test $targetos = darwin; then |
b2924696 | 1295 | if test -n "`$cc -v 2>&1 | grep xlc`"; then |
30a3e5d4 | 1296 | add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto" |
cf9d24ad | 1297 | else |
26c1b3be DB |
1298 | add_cflags "-no-cpp-precomp -pipe" |
1299 | check_cflags "-force_cpusubtype_ALL" | |
1300 | check_cflags "-Wno-sign-compare" | |
7799eeec | 1301 | disabled shared && add_cflags -mdynamic-no-pic |
cf9d24ad | 1302 | fi |
2a1a6b64 MN |
1303 | fi |
1304 | ||
703afd07 | 1305 | disabled optimize || add_cflags -fomit-frame-pointer |
cf9d24ad | 1306 | |
a4adb608 | 1307 | # Add processor-specific flags |
38d0a8aa | 1308 | if test $cpu != "generic"; then |
bc8ec47b MR |
1309 | warn_altivec(){ |
1310 | $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1."; | |
1658bc4f | 1311 | } |
38d0a8aa | 1312 | case $cpu in |
bb270c08 | 1313 | 601|ppc601|PowerPC601) |
1c5d830c | 1314 | add_cflags "-mcpu=601" |
bc8ec47b | 1315 | warn_altivec enabled PPC601 |
bb270c08 DB |
1316 | ;; |
1317 | 603*|ppc603*|PowerPC603*) | |
1c5d830c | 1318 | add_cflags "-mcpu=603" |
bc8ec47b | 1319 | warn_altivec enabled PPC603 |
bb270c08 DB |
1320 | ;; |
1321 | 604*|ppc604*|PowerPC604*) | |
1c5d830c | 1322 | add_cflags "-mcpu=604" |
bc8ec47b | 1323 | warn_altivec enabled PPC604 |
bb270c08 DB |
1324 | ;; |
1325 | G3|g3|75*|ppc75*|PowerPC75*) | |
1c5d830c | 1326 | add_cflags "-mcpu=750 -mpowerpc-gfxopt" |
bc8ec47b | 1327 | warn_altivec enabled PPC75x |
bb270c08 DB |
1328 | ;; |
1329 | G4|g4|745*|ppc745*|PowerPC745*) | |
1c5d830c | 1330 | add_cflags "-mcpu=7450 -mpowerpc-gfxopt" |
bc8ec47b | 1331 | warn_altivec disabled PPC745x |
bb270c08 DB |
1332 | ;; |
1333 | 74*|ppc74*|PowerPC74*) | |
1c5d830c | 1334 | add_cflags "-mcpu=7400 -mpowerpc-gfxopt" |
bc8ec47b | 1335 | warn_altivec disabled PPC74xx |
bb270c08 DB |
1336 | ;; |
1337 | G5|g5|970|ppc970|PowerPC970|power4*|Power4*) | |
1c5d830c | 1338 | add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64" |
bc8ec47b | 1339 | warn_altivec disabled PPC970 |
9cafbd6c | 1340 | enable ppc64 |
bb270c08 | 1341 | ;; |
e07e357d LB |
1342 | Cell|CELL|cell) |
1343 | add_cflags "-mcpu=cell" | |
1344 | warn_altivec disabled Cell | |
9cafbd6c | 1345 | enable ppc64 |
e07e357d | 1346 | ;; |
e7768fc5 GP |
1347 | # targets that do NOT support conditional mov (cmov) |
1348 | i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3) | |
38d0a8aa | 1349 | add_cflags "-march=$cpu" |
497237c7 | 1350 | disable cmov |
e7768fc5 GP |
1351 | ;; |
1352 | # targets that do support conditional mov (cmov) | |
416519dd | 1353 | i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2) |
e7768fc5 | 1354 | add_cflags "-march=$cpu" |
497237c7 RP |
1355 | enable cmov |
1356 | enable fast_cmov | |
94e4c3a3 GP |
1357 | ;; |
1358 | # targets that do support conditional mov but on which it's slow | |
1359 | pentium4|prescott|nocona) | |
1360 | add_cflags "-march=$cpu" | |
497237c7 RP |
1361 | enable cmov |
1362 | disable fast_cmov | |
bb270c08 | 1363 | ;; |
d7b34d08 | 1364 | sparc64) |
1c5d830c | 1365 | add_cflags "-mcpu=v9" |
d7b34d08 | 1366 | ;; |
8684704b MH |
1367 | bf*) #bf531 bf532 bf533 bf561 bf5xx all get this config |
1368 | add_cflags "-mfdpic" | |
846dffeb | 1369 | add_ldflags "-mfdpic" |
8684704b | 1370 | ;; |
bb270c08 | 1371 | *) |
38d0a8aa | 1372 | echo "WARNING: Unknown CPU \"$cpu\", ignored." |
bb270c08 | 1373 | ;; |
a4adb608 MN |
1374 | esac |
1375 | fi | |
1376 | ||
412c1562 MR |
1377 | gnu_make(){ |
1378 | $1 --version 2>&1 | grep -q GNU | |
1379 | } | |
1380 | ||
1381 | if ! gnu_make $make; then | |
1382 | gnu_make gmake && make=gmake || die "GNU make not found." | |
1383 | fi | |
1384 | ||
be0d52ab MR |
1385 | # make sure we can execute files in $TMPDIR |
1386 | cat >$TMPE 2>>$logfile <<EOF | |
1387 | #! /bin/sh | |
1388 | EOF | |
1389 | chmod +x $TMPE >>$logfile 2>&1 | |
1390 | if ! $TMPE >>$logfile 2>&1; then | |
1391 | cat <<EOF | |
1392 | Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment | |
68300911 DB |
1393 | variable to another directory and make sure that $TMPDIR1 is not mounted |
1394 | noexec. | |
be0d52ab MR |
1395 | EOF |
1396 | die "Sanity test failed." | |
1397 | fi | |
0244f743 | 1398 | rm $TMPE |
be0d52ab | 1399 | |
1a268acc MR |
1400 | # compiler sanity check |
1401 | check_exec <<EOF | |
1402 | int main(){ | |
1403 | return 0; | |
1404 | } | |
1405 | EOF | |
1406 | if test "$?" != 0; then | |
1407 | echo "$cc is unable to create an executable file." | |
93b3c083 | 1408 | if test -z "$cross_prefix" && ! enabled cross_compile ; then |
1a268acc | 1409 | echo "If $cc is a cross-compiler, use the --cross-compile option." |
c7ae6345 | 1410 | echo "Only do this if you know what cross compiling means." |
1a268acc MR |
1411 | fi |
1412 | die "C compiler test failed." | |
1413 | fi | |
1414 | ||
9eeed841 | 1415 | if enabled x86; then |
44965991 PI |
1416 | # check whether EBP is available on x86 |
1417 | # As 'i' is stored on the stack, this program will crash | |
1418 | # if the base pointer is used to access it because the | |
1419 | # base pointer is cleared in the inline assembly code. | |
7dfef245 | 1420 | check_exec_crash <<EOF && enable ebp_available |
44965991 PI |
1421 | volatile int i=0; |
1422 | asm volatile ( | |
1423 | "xorl %%ebp, %%ebp" | |
1424 | ::: "%ebp"); | |
1425 | return i; | |
44965991 PI |
1426 | EOF |
1427 | ||
1428 | # check wether EBX is available on x86 | |
940f335a | 1429 | check_asm ebx_available '"":::"%ebx"' |
8e380710 LM |
1430 | |
1431 | # check whether binutils is new enough to compile SSSE3 | |
940f335a | 1432 | enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"' |
44965991 PI |
1433 | fi |
1434 | ||
87ea51e0 LB |
1435 | # check for assembler specific support |
1436 | ||
cc6a90dd | 1437 | if test $arch = "powerpc"; then |
497237c7 | 1438 | check_cc <<EOF && enable dcbzl |
87ea51e0 LB |
1439 | int main(void) { |
1440 | register long zero = 0; | |
1441 | char data[1024]; | |
1442 | asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero)); | |
1443 | return 0; | |
1444 | } | |
1445 | EOF | |
1446 | fi | |
1447 | ||
57bd82d4 MR |
1448 | # check for SIMD availability |
1449 | ||
115329f1 | 1450 | # AltiVec flags: The FSF version of GCC differs from the Apple version |
9eeed841 | 1451 | if enabled altivec; then |
3ae3b721 RP |
1452 | test -n "`$cc -v 2>&1 | grep version | grep Apple`" && |
1453 | add_cflags "-faltivec" || | |
0182fee8 | 1454 | add_cflags "-maltivec -mabi=altivec" |
b6e52719 | 1455 | |
0182fee8 | 1456 | check_header altivec.h |
a9a07762 | 1457 | |
0182fee8 | 1458 | # check if our compiler supports Motorola AltiVec C API |
3ae3b721 RP |
1459 | enabled altivec_h && |
1460 | inc_altivec_h="#include <altivec.h>" || | |
f25fc9b1 | 1461 | inc_altivec_h= |
497237c7 | 1462 | check_cc <<EOF || disable altivec |
dcd479c0 | 1463 | $inc_altivec_h |
a9a07762 MN |
1464 | int main(void) { |
1465 | vector signed int v1, v2, v3; | |
1466 | v1 = vec_add(v2,v3); | |
1467 | return 0; | |
1468 | } | |
1469 | EOF | |
1470 | fi | |
ab6c65f6 | 1471 | |
940f335a MR |
1472 | enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"' |
1473 | enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"' | |
1474 | enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"' | |
1475 | enabled mmi && check_asm mmi '"lq $2, 0($2)"' | |
1476 | enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc | |
bd9d34a0 | 1477 | |
8b03def6 DB |
1478 | enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc" |
1479 | ||
57bd82d4 MR |
1480 | # --- |
1481 | # big/little-endian test | |
9eebe687 MR |
1482 | check_cc <<EOF || die "endian test failed" |
1483 | unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E'; | |
a3999908 | 1484 | EOF |
e89d9fd8 | 1485 | grep -q BIGE $TMPO && enable bigendian |
487a54d7 | 1486 | |
a3999908 | 1487 | # --- |
3d204385 NK |
1488 | # check availability of some header files |
1489 | ||
0701ca7f MR |
1490 | check_header malloc.h |
1491 | check_func memalign | |
3d204385 | 1492 | |
93b3c083 | 1493 | if ! enabled_any memalign memalign_hack && enabled need_memalign ; then |
57bd82d4 | 1494 | die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack." |
8bf5d58f MN |
1495 | fi |
1496 | ||
0701ca7f | 1497 | check_header byteswap.h |
47d23bbf | 1498 | |
6ffa87d3 | 1499 | check_func mkstemp |
b6c748ed | 1500 | check_func gethrtime |
6ffa87d3 | 1501 | |
e16e49ac RP |
1502 | check_header termios.h |
1503 | check_header conio.h | |
1504 | ||
0701ca7f | 1505 | check_func inet_aton |
497237c7 | 1506 | enabled zlib && check_lib zlib.h zlibVersion -lz || disable zlib |
57bd82d4 | 1507 | |
b0c858d8 FR |
1508 | # ffserver uses poll(), |
1509 | # if it's not found we can emulate it using select(). | |
1510 | if enabled ffserver; then | |
1511 | check_header sys/poll.h | |
1512 | fi | |
1513 | ||
57bd82d4 MR |
1514 | # check for some common methods of building with pthread support |
1515 | # do this before the optional library checks as some of them require pthreads | |
1516 | if enabled pthreads; then | |
9e7fd101 MR |
1517 | if check_func pthread_create; then |
1518 | : | |
1519 | elif check_func pthread_create -pthread; then | |
1520 | add_cflags -pthread | |
1521 | add_ldflags -pthread | |
1522 | elif check_func pthread_create -pthreads; then | |
1523 | add_cflags -pthreads | |
1524 | add_ldflags -pthreads | |
1525 | elif ! check_lib pthread.h pthread_create -lpthread; then | |
1526 | die "ERROR: can't find pthreads library" | |
1527 | fi | |
57bd82d4 MR |
1528 | fi |
1529 | ||
8eee7025 | 1530 | for thread in $THREADS_LIST; do |
e5f94c2b | 1531 | if enabled $thread; then |
3ae3b721 RP |
1532 | test -n "$thread_type" && |
1533 | die "ERROR: Only one thread type must be selected." || | |
e5f94c2b | 1534 | thread_type="$thread" |
e5f94c2b RP |
1535 | fi |
1536 | done | |
1537 | ||
f32adb22 | 1538 | # test for lrintf in math.h |
497237c7 | 1539 | check_exec <<EOF && enable lrintf || disable lrintf |
f32adb22 MR |
1540 | #define _ISOC9X_SOURCE 1 |
1541 | #include <math.h> | |
1542 | int main( void ) { return (lrintf(3.999f) > 0)?0:1; } | |
1543 | EOF | |
1544 | ||
f5a756ef | 1545 | enabled_any libamr_nb libamr_wb && enable libamr |
12b61a74 | 1546 | |
57bd82d4 | 1547 | # these are off by default, so fail if requested and not available |
79fda097 | 1548 | enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32 |
7bc5f2a8 | 1549 | enabled liba52 && require liba52 a52dec/a52.h a52_init -la52 |
f5a756ef DB |
1550 | enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm |
1551 | enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm | |
f7b8bffe | 1552 | enabled libdc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 |
79fda097 DB |
1553 | enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac |
1554 | enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad | |
910c62e1 | 1555 | enabled libgsm && require libgsm gsm.h gsm_create -lgsm |
6ebe07fb | 1556 | enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm |
79fda097 DB |
1557 | enabled libnut && require libnut libnut.h nut_demuxer_init -lnut |
1558 | enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg | |
910c62e1 DB |
1559 | enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg |
1560 | enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg | |
1cc60c47 DB |
1561 | enabled libx264 && require x264 x264.h x264_encoder_open -lx264 |
1562 | enabled libxvid && require Xvid xvid.h xvid_global -lxvidcore | |
910c62e1 | 1563 | enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib |
8ac17293 | 1564 | |
6ea67bbb JR |
1565 | # disable the native AC-3 decoder if liba52 is enabled |
1566 | enabled liba52 && disable ac3_decoder | |
1567 | ||
c13e1abd FH |
1568 | _restrict= |
1569 | for restrict_keyword in restrict __restrict__ __restrict; do | |
57bd82d4 | 1570 | check_cc <<EOF && _restrict=$restrict_keyword && break |
dcd479c0 MR |
1571 | void foo(char * $restrict_keyword p); |
1572 | EOF | |
c13e1abd FH |
1573 | done |
1574 | ||
a8721c09 FB |
1575 | # dlopen/dlfcn.h probing |
1576 | ||
0701ca7f | 1577 | check_header dlfcn.h |
a8721c09 | 1578 | |
dcd479c0 | 1579 | if check_func dlopen; then |
dcd479c0 | 1580 | ldl= |
0701ca7f MR |
1581 | elif check_func dlopen -ldl; then |
1582 | ldl=-ldl | |
a8721c09 FB |
1583 | fi |
1584 | ||
66be5b45 | 1585 | check_func getrusage |
7495c306 | 1586 | check_func2 windows.h GetProcessTimes |
66be5b45 | 1587 | |
4f3da985 RP |
1588 | check_func fork |
1589 | ||
703afd07 | 1590 | test "$vhook" = "default" && vhook="$dlopen" |
a8721c09 | 1591 | |
b0268cc0 | 1592 | if test "$targetos" = cygwin -o "$targetos" = mingw32 && enabled_all static vhook ; then |
497237c7 | 1593 | disable vhook |
fbb9d104 | 1594 | echo |
b0268cc0 | 1595 | echo "At the moment vhooks don't work on Cygwin or MinGW static builds." |
fbb9d104 VP |
1596 | echo "Patches welcome." |
1597 | echo | |
1598 | fi | |
1599 | ||
8d923001 MR |
1600 | if enabled vhook; then |
1601 | check_ldflags -rdynamic | |
1602 | check_ldflags -export-dynamic | |
1603 | fi | |
bfd2edeb | 1604 | |
eea50282 MR |
1605 | check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font |
1606 | check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType | |
04511d53 | 1607 | |
a86b921c | 1608 | ########################################## |
29799f8b | 1609 | # SDL check |
a86b921c | 1610 | |
497237c7 RP |
1611 | disable sdl_too_old |
1612 | disable sdl | |
6a1a892f | 1613 | SDL_CONFIG="${cross_prefix}sdl-config" |
225e21ef MR |
1614 | if "${SDL_CONFIG}" --version >/dev/null 2>&1; then |
1615 | sdl_cflags=`"${SDL_CONFIG}" --cflags` | |
1616 | temp_cflags $sdl_cflags | |
dcd479c0 | 1617 | temp_extralibs `"${SDL_CONFIG}" --libs` |
225e21ef | 1618 | if check_lib SDL.h SDL_Init; then |
dcd479c0 | 1619 | _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'` |
29f3b38a | 1620 | if test "$_sdlversion" -lt 121 ; then |
497237c7 | 1621 | enable sdl_too_old |
dcd479c0 | 1622 | else |
497237c7 | 1623 | enable sdl |
225e21ef | 1624 | check_cc $sdl_cflags <<EOF && enable sdl_video_size |
29f3b38a MR |
1625 | #include <SDL.h> |
1626 | int main(void){ | |
1627 | const SDL_VideoInfo *vi = SDL_GetVideoInfo(); | |
1628 | int w = vi->current_w; | |
1629 | return 0; | |
1630 | } | |
1631 | EOF | |
dcd479c0 MR |
1632 | fi |
1633 | fi | |
29f3b38a | 1634 | restore_flags |
c3f6b472 | 1635 | fi |
57bd82d4 | 1636 | |
d5697779 | 1637 | texi2html -version >/dev/null 2>&1 && enable texi2html || disable texi2html |
146ea952 | 1638 | |
7a91333f | 1639 | ########################################## |
73b46a95 RP |
1640 | # Network check |
1641 | ||
1642 | if enabled network; then | |
1643 | # Prefer arpa/inet.h over winsock2 | |
1644 | if check_header arpa/inet.h ; then | |
1645 | check_func closesocket | |
1646 | elif check_header winsock2.h ; then | |
1647 | add_extralibs -lws2_32 | |
1648 | check_func2 winsock2.h closesocket | |
1649 | fi | |
1650 | fi | |
1651 | ||
1652 | ########################################## | |
29799f8b | 1653 | # IPv6 check |
7a91333f | 1654 | |
497237c7 | 1655 | enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6 |
7a91333f HZ |
1656 | #include <sys/types.h> |
1657 | #include <sys/socket.h> | |
1658 | #include <netinet/in.h> | |
1659 | #include <netdb.h> | |
1660 | int main( void ) { | |
1661 | struct sockaddr_storage saddr; | |
1662 | struct ipv6_mreq mreq6; | |
1663 | getaddrinfo(0,0,0,0); | |
1664 | getnameinfo(0,0,0,0,0,0,0); | |
12fe88b4 | 1665 | IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0); |
7a91333f HZ |
1666 | } |
1667 | EOF | |
1668 | ||
06e31011 RP |
1669 | check_header linux/videodev.h |
1670 | check_header linux/videodev2.h | |
47f38850 | 1671 | |
f8aa696f | 1672 | # check for ioctl_meteor.h, ioctl_bt848.h and alternatives |
1c915f83 RP |
1673 | { check_header dev/bktr/ioctl_meteor.h && |
1674 | check_header dev/bktr/ioctl_bt848.h; } || | |
1675 | { check_header machine/ioctl_meteor.h && | |
1676 | check_header machine/ioctl_bt848.h; } || | |
1677 | { check_header dev/video/meteor/ioctl_meteor.h && | |
1678 | check_header dev/video/bktr/ioctl_bt848.h; } || | |
1679 | check_header dev/ic/bt8xx.h | |
f8aa696f | 1680 | |
c7682de0 RP |
1681 | check_header sys/soundcard.h |
1682 | check_header soundcard.h | |
deb29777 | 1683 | |
f58f4ce1 | 1684 | # Deal with the x11 frame grabber |
56a059ac | 1685 | enabled x11grab && |
f58f4ce1 GP |
1686 | check_header X11/Xlib.h && |
1687 | check_header X11/extensions/XShm.h && | |
1688 | check_func XOpenDisplay -lX11 && | |
06eab4ba | 1689 | check_func XShmCreateImage -lX11 -lXext |
f58f4ce1 | 1690 | |
57bd82d4 MR |
1691 | enabled debug && add_cflags -g |
1692 | ||
1693 | # add some useful compiler flags if supported | |
1694 | check_cflags -Wdeclaration-after-statement | |
dcd479c0 MR |
1695 | check_cflags -Wall |
1696 | check_cflags -Wno-switch | |
c07bd6a9 MN |
1697 | check_cflags -Wdisabled-optimization |
1698 | check_cflags -Wpointer-arith | |
1699 | check_cflags -Wredundant-decls | |
cc1fb623 | 1700 | check_cflags -Wno-pointer-sign |
5af4e0cc | 1701 | enabled extra_warnings && check_cflags -Winline |
cf9d24ad | 1702 | |
57bd82d4 | 1703 | # add some linker flags |
5c0e9479 | 1704 | check_ldflags -Wl,--warn-common |
e240ee67 | 1705 | check_ldflags $LDLATEFLAGS |
94a3401e | 1706 | |
bd2216e4 MR |
1707 | if enabled small; then |
1708 | check_cflags -Os # not all compilers support -Os | |
1709 | optimize="small" | |
1710 | elif enabled optimize; then | |
b2924696 | 1711 | if test -n "`$cc -v 2>&1 | grep xlc`"; then |
30a3e5d4 NP |
1712 | add_cflags "-O5" |
1713 | add_ldflags "-O5" | |
cf9d24ad | 1714 | else |
30a3e5d4 | 1715 | add_cflags "-O3" |
cf9d24ad | 1716 | fi |
cddf3f45 GM |
1717 | fi |
1718 | ||
80581e98 | 1719 | # PIC flags for shared library objects where they are needed |
5af4e0cc | 1720 | if enabled shared; then |
f25fc9b1 MR |
1721 | # LIBOBJFLAGS may have already been set in the OS configuration |
1722 | if test -z "$LIBOBJFLAGS" ; then | |
cc6a90dd | 1723 | case "$arch" in |
f824ba7b | 1724 | x86_64|ia64|alpha|sparc*|power*) LIBOBJFLAGS="\$(PIC)" ;; |
813457e5 | 1725 | esac |
80581e98 | 1726 | fi |
80581e98 MN |
1727 | fi |
1728 | ||
90be59ef | 1729 | if enabled gprof; then |
30a3e5d4 NP |
1730 | add_cflags "-p" |
1731 | add_ldflags "-p" | |
1db54e20 DB |
1732 | fi |
1733 | ||
3b26ee47 | 1734 | VHOOKCFLAGS="-fPIC" |
18451f7d | 1735 | |
4454dc1b JD |
1736 | # find if .align arg is power-of-two or not |
1737 | if test $asmalign_pot = "unknown"; then | |
497237c7 RP |
1738 | disable asmalign_pot |
1739 | echo 'asm (".align 3");' | check_cc && enable asmalign_pot | |
4454dc1b JD |
1740 | fi |
1741 | ||
660db1d6 DB |
1742 | enabled_any $ENCODER_LIST && enable encoders |
1743 | enabled_any $DECODER_LIST && enable decoders | |
1744 | enabled_any $MUXER_LIST && enable muxers | |
1745 | enabled_any $DEMUXER_LIST && enable demuxers | |
c08fb000 | 1746 | enabled_any $PROTOCOL_LIST && enable protocols |
cd61e407 | 1747 | enabled_any $BSF_LIST && enable bsfs |
f70f03f6 | 1748 | |
660db1d6 | 1749 | enabled_any $THREADS_LIST && enable threads |
f70f03f6 MR |
1750 | |
1751 | check_deps $CONFIG_LIST $HAVE_LIST $DECODER_LIST $ENCODER_LIST $PARSER_LIST \ | |
cd61e407 | 1752 | $BSF_LIST $DEMUXER_LIST $MUXER_LIST $PROTOCOL_LIST |
f70f03f6 | 1753 | |
f7b8bffe | 1754 | enabled libdc1394 && append pkg_requires "libraw1394" |
fb2ce7d9 MR |
1755 | enabled libogg && append pkg_requires "ogg >= 1.1" |
1756 | enabled libtheora && append pkg_requires "theora" | |
1757 | enabled libvorbis && append pkg_requires "vorbis vorbisenc" | |
fb2ce7d9 | 1758 | |
f36958f8 DB |
1759 | echo "install prefix $PREFIX" |
1760 | echo "source path $source_path" | |
1761 | echo "C compiler $cc" | |
1762 | echo "make $make" | |
bfd5afd8 | 1763 | echo ".align is power-of-two $asmalign_pot" |
f36958f8 | 1764 | echo "ARCH $arch ($cpu)" |
eb94aca9 | 1765 | if test "$BUILDSUF" != ""; then |
f36958f8 | 1766 | echo "build suffix $BUILDSUF" |
eb94aca9 | 1767 | fi |
0db2ce77 | 1768 | echo "big-endian ${bigendian-no}" |
419b8784 | 1769 | if test $arch = "x86_32" -o $arch = "x86_64"; then |
0db2ce77 MR |
1770 | echo "MMX enabled ${mmx-no}" |
1771 | echo "CMOV enabled ${cmov-no}" | |
1772 | echo "CMOV is fast ${fast_cmov-no}" | |
971cc990 MN |
1773 | echo "EBX available ${ebx_available-no}" |
1774 | echo "EBP available ${ebp_available-no}" | |
e41e8342 | 1775 | fi |
cc6a90dd | 1776 | if test $arch = "armv4l"; then |
0db2ce77 MR |
1777 | echo "ARMv5TE enabled ${armv5te-no}" |
1778 | echo "ARMv6 enabled ${armv6-no}" | |
1779 | echo "IWMMXT enabled ${iwmmxt-no}" | |
eba9ae3c | 1780 | fi |
e241ba14 | 1781 | if test $arch = "mips"; then |
0db2ce77 | 1782 | echo "MMI enabled ${mmi-no}" |
e41e8342 | 1783 | fi |
cc6a90dd | 1784 | if test $arch = "powerpc"; then |
0db2ce77 MR |
1785 | echo "AltiVec enabled ${altivec-no}" |
1786 | echo "dcbzl available ${dcbzl-no}" | |
e41e8342 | 1787 | fi |
0db2ce77 MR |
1788 | echo "gprof enabled ${gprof-no}" |
1789 | echo "debug symbols ${debug-no}" | |
1790 | echo "strip symbols ${dostrip-no}" | |
1791 | echo "optimize ${optimize-no}" | |
1792 | echo "static ${static-no}" | |
1793 | echo "shared ${shared-no}" | |
1794 | echo "postprocessing support ${pp-no}" | |
1795 | echo "software scaler enabled ${swscaler-no}" | |
1796 | echo "video hooking ${vhook-no}" | |
90be59ef | 1797 | if enabled vhook; then |
0db2ce77 MR |
1798 | echo "Imlib2 support ${imlib2-no}" |
1799 | echo "FreeType support ${freetype2-no}" | |
68892110 | 1800 | fi |
0db2ce77 | 1801 | echo "network support ${network-no}" |
90be59ef | 1802 | if enabled network; then |
0db2ce77 | 1803 | echo "IPv6 support ${ipv6-no}" |
bfd5afd8 | 1804 | fi |
0db2ce77 MR |
1805 | echo "threading support ${thread_type-no}" |
1806 | echo "SDL support ${sdl-no}" | |
90be59ef | 1807 | if enabled sdl_too_old; then |
bfd5afd8 DB |
1808 | echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support." |
1809 | fi | |
0db2ce77 MR |
1810 | echo "Sun medialib support ${mlib-no}" |
1811 | echo "AVISynth enabled ${avisynth-no}" | |
1812 | echo "liba52 support ${liba52-no}" | |
1813 | echo "liba52 dlopened ${liba52bin-no}" | |
1814 | echo "libamr-nb support ${libamr_nb-no}" | |
1815 | echo "libamr-wb support ${libamr_wb-no}" | |
f7b8bffe | 1816 | echo "libdc1394 support ${libdc1394-no}" |
0db2ce77 MR |
1817 | echo "libfaac enabled ${libfaac-no}" |
1818 | echo "libfaad enabled ${libfaad-no}" | |
7e0871a7 | 1819 | echo "libfaad dlopened ${libfaadbin-no}" |
0db2ce77 MR |
1820 | echo "libgsm enabled ${libgsm-no}" |
1821 | echo "libmp3lame enabled ${libmp3lame-no}" | |
1822 | echo "libnut enabled ${libnut-no}" | |
1823 | echo "libogg enabled ${libogg-no}" | |
1824 | echo "libtheora enabled ${libtheora-no}" | |
1825 | echo "libvorbis enabled ${libvorbis-no}" | |
1826 | echo "x264 enabled ${libx264-no}" | |
1827 | echo "XviD enabled ${libxvid-no}" | |
1828 | echo "zlib enabled ${zlib-no}" | |
3ae3b721 RP |
1829 | enabled gpl && |
1830 | echo "License: GPL" || | |
f25fc9b1 | 1831 | echo "License: LGPL" |
de6d9b64 | 1832 | |
29799f8b | 1833 | echo "Creating config.mak and config.h..." |
de6d9b64 | 1834 | |
29799f8b DB |
1835 | echo "# Automatically generated by configure - do not modify!" > config.mak |
1836 | echo "/* Automatically generated by configure - do not modify! */" > $TMPH | |
0fd12426 | 1837 | echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH |
de6d9b64 | 1838 | |
2266e085 | 1839 | echo "PREFIX=$PREFIX" >> config.mak |
c75560ae | 1840 | echo "prefix=\$(DESTDIR)\$(PREFIX)" >> config.mak |
22a324da DB |
1841 | echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak |
1842 | echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak | |
1843 | echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak | |
1844 | echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak | |
1845 | echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak | |
4a908fbc | 1846 | echo "MAKE=$make" >> config.mak |
980fc7b8 FB |
1847 | echo "CC=$cc" >> config.mak |
1848 | echo "AR=$ar" >> config.mak | |
be7109c1 | 1849 | echo "RANLIB=$ranlib" >> config.mak |
78eb6531 | 1850 | echo "LDCONFIG=$LDCONFIG" >> config.mak |
20369773 | 1851 | echo "LN_S=$ln_s" >> config.mak |
3ae3b721 RP |
1852 | enabled dostrip && |
1853 | echo "STRIP=$strip" >> config.mak || | |
f25fc9b1 | 1854 | echo "STRIP=echo ignoring strip" >> config.mak |
75388c74 | 1855 | |
a9b3f630 | 1856 | echo "OPTFLAGS=$CFLAGS" >> config.mak |
408382a4 | 1857 | echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak |
0f3cb305 | 1858 | echo "LDFLAGS=$LDFLAGS" >> config.mak |
c536cb09 | 1859 | echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak |
e1707f52 | 1860 | echo "SHFLAGS=$SHFLAGS" >> config.mak |
408382a4 | 1861 | echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak |
fbb9d104 | 1862 | echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak |
80581e98 | 1863 | echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak |
5af4e0cc | 1864 | echo "BUILD_STATIC=$static" >> config.mak |
eb94aca9 | 1865 | echo "BUILDSUF=$BUILDSUF" >> config.mak |
f3ec2d46 | 1866 | echo "LIBPREF=$LIBPREF" >> config.mak |
eb94aca9 | 1867 | echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak |
60147de8 | 1868 | echo "LIB=$LIB" >> config.mak |
f3ec2d46 | 1869 | echo "SLIBPREF=$SLIBPREF" >> config.mak |
eb94aca9 CY |
1870 | echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak |
1871 | echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak | |
4dc62701 | 1872 | |
90be59ef | 1873 | if enabled bigendian; then |
0f3cb305 FB |
1874 | echo "WORDS_BIGENDIAN=yes" >> config.mak |
1875 | echo "#define WORDS_BIGENDIAN 1" >> $TMPH | |
91d1f1a4 | 1876 | fi |
90be59ef | 1877 | if enabled mmx; then |
e82c5a8c | 1878 | echo "#define __CPU__ 586" >> $TMPH |
de6d9b64 | 1879 | fi |
44161118 | 1880 | |
90be59ef | 1881 | if enabled sdl; then |
6a1a892f FD |
1882 | echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak |
1883 | echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak | |
a86b921c | 1884 | fi |
90be59ef | 1885 | if enabled texi2html; then |
146ea952 NB |
1886 | echo "BUILD_DOC=yes" >> config.mak |
1887 | fi | |
5a872801 | 1888 | |
790c9ca7 | 1889 | sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'` |
6d9a2421 | 1890 | pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'` |
5a872801 LB |
1891 | lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'` |
1892 | lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'` | |
1893 | lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'` | |
1894 | ||
1895 | ||
1896 | ||
5af4e0cc | 1897 | if enabled shared; then |
0319c531 | 1898 | echo "BUILD_SHARED=yes" >> config.mak |
97006039 | 1899 | echo "PIC=-fPIC -DPIC" >> config.mak |
7e303556 DB |
1900 | echo "SPPMAJOR=${pp_version%%.*}" >> config.mak |
1901 | echo "SPPVERSION=$pp_version" >> config.mak | |
39503a27 | 1902 | echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak |
5a872801 | 1903 | echo "LAVCVERSION=$lavc_version" >> config.mak |
39503a27 | 1904 | echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak |
5a872801 | 1905 | echo "LAVFVERSION=$lavf_version" >> config.mak |
39503a27 | 1906 | echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak |
5a872801 | 1907 | echo "LAVUVERSION=$lavu_version" >> config.mak |
790c9ca7 LA |
1908 | echo "SWSMAJOR=${sws_version%%.*}" >> config.mak |
1909 | echo "SWSVERSION=$sws_version" >> config.mak | |
4bdd05e7 | 1910 | echo "SLIBNAME=${SLIBNAME}" >> config.mak |
f3b60109 DB |
1911 | echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak |
1912 | echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak | |
5cb854e1 | 1913 | echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak |
8fbec4f4 | 1914 | echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak |
0319c531 | 1915 | fi |
d7e27559 | 1916 | echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak |
ef0bc4c9 | 1917 | echo "EXTRALIBS=$extralibs" >> config.mak |
d2845d68 | 1918 | |
3d907e22 MR |
1919 | print_config ARCH_ $TMPH config.mak $ARCH_LIST |
1920 | print_config HAVE_ $TMPH config.mak $HAVE_LIST | |
1921 | print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \ | |
1922 | $DECODER_LIST \ | |
1923 | $ENCODER_LIST \ | |
1924 | $PARSER_LIST \ | |
1925 | $BSF_LIST \ | |
1926 | $DEMUXER_LIST \ | |
1927 | $MUXER_LIST \ | |
1928 | $PROTOCOL_LIST \ | |
8ac17293 | 1929 | |
c13e1abd FH |
1930 | echo "#define restrict $_restrict" >> $TMPH |
1931 | ||
bd2216e4 | 1932 | if enabled small; then |
3bf98161 | 1933 | echo "#define av_always_inline" >> $TMPH |
bb801c97 MN |
1934 | fi |
1935 | ||
997baf01 MR |
1936 | echo "SRC_PATH=\"$source_path\"" >> config.mak |
1937 | echo "SRC_PATH_BARE=$source_path" >> config.mak | |
1938 | echo "BUILD_ROOT=\"$PWD\"" >> config.mak | |
0f3cb305 | 1939 | |
8156056e | 1940 | # Apparently it's not possible to portably echo a backslash. |
3ae3b721 RP |
1941 | enabled asmalign_pot && |
1942 | printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH || | |
8156056e | 1943 | printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH |
4454dc1b | 1944 | |
bc634f6f | 1945 | |
9cb2cf10 | 1946 | # Do not overwrite config.h if unchanged to avoid superfluous rebuilds. |
3ae3b721 RP |
1947 | cmp -s $TMPH config.h && |
1948 | echo "config.h is unchanged" || | |
1949 | mv -f $TMPH config.h | |
3d204385 | 1950 | |
f3ec2d46 | 1951 | rm -f $TMPO $TMPC $TMPE $TMPS $TMPH |
def4272a | 1952 | |
165af439 | 1953 | # build tree in object directory if source path is different from current one |
90be59ef | 1954 | if enabled source_path_used; then |
165af439 MR |
1955 | DIRS="\ |
1956 | doc \ | |
165af439 MR |
1957 | libavcodec \ |
1958 | libavcodec/alpha \ | |
1959 | libavcodec/armv4l \ | |
1960 | libavcodec/bfin \ | |
1961 | libavcodec/i386 \ | |
165af439 MR |
1962 | libavcodec/mlib \ |
1963 | libavcodec/ppc \ | |
7506d47a | 1964 | libavcodec/sh4 \ |
862a70f1 AJ |
1965 | libavcodec/sparc \ |
1966 | libavformat \ | |
165af439 | 1967 | libavutil \ |
862a70f1 | 1968 | libpostproc \ |
165af439 MR |
1969 | libswscale \ |
1970 | tests \ | |
c07ed8c8 | 1971 | tools \ |
165af439 MR |
1972 | vhook \ |
1973 | " | |
1974 | FILES="\ | |
1975 | Makefile \ | |
1976 | common.mak \ | |
862a70f1 | 1977 | doc/texi2pod.pl \ |
165af439 | 1978 | libavcodec/Makefile \ |
862a70f1 | 1979 | libavformat/Makefile \ |
165af439 | 1980 | libavutil/Makefile \ |
862a70f1 | 1981 | libpostproc/Makefile \ |
165af439 | 1982 | libswscale/Makefile \ |
165af439 MR |
1983 | " |
1984 | for dir in $DIRS ; do | |
1985 | mkdir -p $dir | |
1986 | done | |
1987 | for f in $FILES ; do | |
20369773 | 1988 | $ln_s "$source_path/$f" $f |
165af439 MR |
1989 | done |
1990 | fi | |
def4272a | 1991 | |
def4272a | 1992 | |
d0674868 | 1993 | # build pkg-config files |
77aee36c | 1994 | # FIXME: libdir and includedir are hardcoded and may differ from the real path. |
def4272a | 1995 | |
d0674868 DB |
1996 | pkgconfig_generate(){ |
1997 | name=$1 | |
1998 | comment=$2 | |
1999 | version=$3 | |
2000 | libs=$4 | |
2001 | requires=$5 | |
2002 | include=$6 | |
2003 | cat <<EOF >$name.pc | |
2266e085 | 2004 | prefix=$PREFIX |
a94e666c | 2005 | exec_prefix=\${prefix} |
def4272a | 2006 | libdir=\${exec_prefix}/lib |
a94e666c | 2007 | includedir=\${prefix}/include |
def4272a | 2008 | |
d0674868 DB |
2009 | Name: $name |
2010 | Description: $comment | |
2011 | Version: $version | |
2012 | Requires: $requires | |
def4272a | 2013 | Conflicts: |
d0674868 DB |
2014 | Libs: -L\${libdir} $libs |
2015 | Cflags: -I\${includedir} -I\${includedir}/$include | |
def4272a | 2016 | EOF |
d0674868 | 2017 | } |
def4272a | 2018 | |
d0674868 DB |
2019 | pkgconfig_generate_uninstalled(){ |
2020 | name=$1 | |
9c476fd6 | 2021 | shortname=${name#lib} |
d0674868 DB |
2022 | comment=$2 |
2023 | version=$3 | |
2024 | libs=$4 | |
2025 | requires=$5 | |
2026 | cat <<EOF >$name-uninstalled.pc | |
def4272a AJ |
2027 | prefix= |
2028 | exec_prefix= | |
d0674868 DB |
2029 | libdir=\${pcfiledir}/$name |
2030 | includedir=\${pcfiledir}/$name | |
def4272a | 2031 | |
d0674868 DB |
2032 | Name: $name |
2033 | Description: $comment | |
2034 | Version: $version | |
2035 | Requires: $requires | |
def4272a | 2036 | Conflicts: |
d0674868 | 2037 | Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs |
def4272a AJ |
2038 | Cflags: -I\${includedir} |
2039 | EOF | |
d0674868 | 2040 | } |
def4272a | 2041 | |
9d824ad1 | 2042 | pkgconfig_generate libavutil "FFmpeg utility library" "$lavu_version" -lavutil "" ffmpeg |
d0674868 | 2043 | pkgconfig_generate_uninstalled libavutil "FFmpeg utility library" "$lavu_version" |
def4272a | 2044 | |
d0674868 DB |
2045 | pkgconfig_generate libavcodec "FFmpeg codec library" "$lavc_version" "-lavcodec $extralibs" "$pkg_requires libavutil = $lavu_version" ffmpeg |
2046 | pkgconfig_generate_uninstalled libavcodec "FFmpeg codec library" "$lavc_version" "$extralibs" "$pkg_requires libavutil = $lavu_version" | |
def4272a | 2047 | |
d0674868 DB |
2048 | pkgconfig_generate libavformat "FFmpeg container format library" "$lavf_version" "-lavformat $extralibs" "$pkg_requires libavcodec = $lavc_version" ffmpeg |
2049 | pkgconfig_generate_uninstalled libavformat "FFmpeg container format library" "$lavf_version" "$extralibs" "$pkg_requires libavcodec = $lavc_version" | |
def4272a | 2050 | |
90be59ef | 2051 | if enabled pp; then |
2e3bcd38 DB |
2052 | pkgconfig_generate libpostproc "FFmpeg post processing library" "$pp_version" -lpostproc "" postproc |
2053 | pkgconfig_generate_uninstalled libpostproc "FFmpeg post processing library" "$pp_version" | |
2054 | fi | |
790c9ca7 | 2055 | |
c839db53 | 2056 | if enabled swscaler; then |
3d3361e5 | 2057 | pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" -lswscale "libavutil = $lavu_version" ffmpeg |
20c516c6 | 2058 | pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "libavutil = $lavu_version" |
6c0d0413 | 2059 | else |
3d3361e5 | 2060 | pkgconfig_generate libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version" ffmpeg |
d0674868 | 2061 | pkgconfig_generate_uninstalled libswscale "FFmpeg image rescaling library" "$sws_version" "" "$pkg_requires libavcodec = $lavc_version" |
c505dd31 MR |
2062 | apply libswscale.pc sed s/^Libs:.*$/Libs:/ |
2063 | apply libswscale-uninstalled.pc sed s/^Libs:.*$/Libs:/ | |
6c0d0413 | 2064 | fi |