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