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