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