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