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