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