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