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