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