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