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