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