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