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