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