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