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