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