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