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