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