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