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