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