Move doxygen comments for av_gettime from utils.c to avformat.h.
[FFMpeg-mirror/ffmpeg-vdpau.git] / configure
blobfa20647481b942c9fd16498c6855a99000fa3371
1 #!/bin/sh
3 # FFmpeg configure script
5 # Copyright (c) 2000, 2001, 2002 Fabrice Bellard
6 # Copyright (c) 2005-2006 Diego Biurrun
7 # Copyright (c) 2005-2006 Mans Rullgard
10 # make sure we are running under a compatible shell
11 # try to make this part work with most shells
13 try_exec(){
14 echo "Trying shell $1"
15 type "$1" > /dev/null 2>&1 && exec "$@"
18 unset foo
19 (: ${foo%%bar}) 2> /dev/null
20 E1="$?"
22 (: ${foo?}) 2> /dev/null
23 E2="$?"
25 if test "$E1" != 0 || test "$E2" = 0; then
26 echo "Broken shell detected. Trying alternatives."
27 export FF_CONF_EXEC
28 if test "0$FF_CONF_EXEC" -lt 1; then
29 FF_CONF_EXEC=1
30 try_exec bash "$0" "$@"
32 if test "0$FF_CONF_EXEC" -lt 2; then
33 FF_CONF_EXEC=2
34 try_exec ksh "$0" "$@"
36 if test "0$FF_CONF_EXEC" -lt 3; then
37 FF_CONF_EXEC=3
38 try_exec /usr/xpg4/bin/sh "$0" "$@"
40 echo "No compatible shell script interpreter found."
41 echo "This configure script requires a POSIX-compatible shell"
42 echo "such as bash or ksh."
43 echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
44 echo "Instead, install a working POSIX-compatible shell."
45 echo "Disabling this configure test will create a broken FFmpeg."
46 if test "$BASH_VERSION" = '2.04.0(1)-release'; then
47 echo "This bash version ($BASH_VERSION) is broken on your platform."
48 echo "Upgrade to a later version if available."
50 exit 1
53 show_help(){
54 echo "Usage: configure [options]"
55 echo "Options: [defaults in brackets after descriptions]"
56 echo
57 echo "Standard options:"
58 echo " --help print this message"
59 echo " --logfile=FILE log tests and output to FILE [config.err]"
60 echo " --disable-logging do not log configure debug information"
61 echo " --prefix=PREFIX install in PREFIX [$prefix]"
62 echo " --bindir=DIR install binaries in DIR [PREFIX/bin]"
63 echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
64 echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]"
65 echo " --incdir=DIR install includes in DIR [PREFIX/include]"
66 echo " --mandir=DIR install man page in DIR [PREFIX/share/man]"
67 echo " --enable-static build static libraries [default=yes]"
68 echo " --disable-static do not build static libraries [default=no]"
69 echo " --enable-shared build shared libraries [default=no]"
70 echo " --disable-shared do not build shared libraries [default=yes]"
71 echo " --enable-gpl allow use of GPL code, the resulting libav*"
72 echo " and ffmpeg will be under GPL [default=no]"
73 echo " --enable-nonfree allow use of nonfree code, the resulting libav*"
74 echo " and ffmpeg will be unredistributable [default=no]"
75 echo " --enable-postproc enable GPLed postprocessing support [default=no]"
76 echo " --enable-swscale software scaler support [default=no]"
77 echo " --enable-avfilter video filter support (replaces vhook) [default=no]"
78 echo " --enable-avfilter-lavf video filters dependant on avformat [default=no]"
79 echo " --enable-beosthreads use BeOS threads [default=no]"
80 echo " --enable-os2threads use OS/2 threads [default=no]"
81 echo " --enable-pthreads use pthreads [default=no]"
82 echo " --enable-w32threads use Win32 threads [default=no]"
83 echo " --enable-x11grab enable X11 grabbing [default=no]"
84 echo
85 echo "External library support:"
86 echo " --enable-mlib use Sun medialib [default=no]"
87 echo " --enable-liba52 enable GPLed liba52 support [default=no]"
88 echo " --enable-liba52bin open liba52.so.0 at runtime [default=no]"
89 echo " --enable-avisynth allow reading AVISynth script files [default=no]"
90 echo " --enable-libamr-nb enable libamr-nb floating point audio codec"
91 echo " --enable-libamr-wb enable libamr-wb floating point audio codec"
92 echo " --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394"
93 echo " and libraw1394 [default=no]"
94 echo " --enable-libdirac enable Dirac support via libdirac [default=no]"
95 echo " --enable-libfaac enable FAAC support via libfaac [default=no]"
96 echo " --enable-libfaad enable FAAD support via libfaad [default=no]"
97 echo " --enable-libfaadbin open libfaad.so.0 at runtime [default=no]"
98 echo " --enable-libgsm enable GSM support via libgsm [default=no]"
99 echo " --enable-libmp3lame enable MP3 encoding via libmp3lame [default=no]"
100 echo " --enable-libnut enable NUT (de)muxing via libnut,"
101 echo " native demuxer exists [default=no]"
102 echo " --enable-libschroedinger enable Dirac support via libschroedinger [default=no]"
103 echo " --enable-libtheora enable Theora encoding via libtheora [default=no]"
104 echo " --enable-libvorbis enable Vorbis encoding via libvorbis,"
105 echo " native implementation exists [default=no]"
106 echo " --enable-libx264 enable H.264 encoding via x264 [default=no]"
107 echo " --enable-libxvid enable Xvid encoding via xvidcore,"
108 echo " native MPEG-4/Xvid encoder exists [default=no]"
109 echo ""
110 echo "Advanced options (experts only):"
111 echo " --source-path=PATH path to source code [$source_path]"
112 echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
113 echo " --enable-cross-compile assume a cross-compiler is used"
114 echo " --target-os=OS compiler targets OS [$target_os]"
115 echo " --cc=CC use C compiler CC [$cc]"
116 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
117 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
118 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
119 echo " --extra-version=STRING version string suffix []"
120 echo " --build-suffix=SUFFIX suffix for application specific build []"
121 echo " --arch=ARCH select architecture [$arch]"
122 echo " --cpu=CPU selects the minimum cpu required (affects"
123 echo " instruction selection, may crash on older CPUs)"
124 echo " --enable-powerpc-perf enable performance report on PPC"
125 echo " (requires enabling PMC)"
126 echo " --disable-mmx disable MMX usage"
127 echo " --disable-mmx2 disable MMX2 usage"
128 echo " --disable-ssse3 disable SSSE3 usage"
129 echo " --disable-armv5te disable armv5te usage"
130 echo " --disable-armv6 disable armv6 usage"
131 echo " --disable-armvfp disable ARM VFP usage"
132 echo " --disable-iwmmxt disable iwmmxt usage"
133 echo " --disable-altivec disable AltiVec usage"
134 echo " --disable-network disable network support [default=no]"
135 echo " --disable-ipv6 disable ipv6 support [default=no]"
136 echo " --disable-zlib disable zlib [default=no]"
137 echo " --disable-bzlib disable bzlib [default=no]"
138 echo " --disable-vhook disable video hooking support"
139 echo " --disable-mpegaudio-hp faster (but less accurate)"
140 echo " MPEG audio decoding [default=no]"
141 echo " --enable-gray enable full grayscale support (slower color)"
142 echo " --disable-ffmpeg disable ffmpeg build"
143 echo " --disable-ffserver disable ffserver build"
144 echo " --disable-ffplay disable ffplay build"
145 echo " --enable-small optimize for size instead of speed"
146 echo " --enable-hardcoded-tables use hardcoded tables instead of runtime generation"
147 echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
148 echo " --disable-encoder=NAME disables encoder NAME"
149 echo " --enable-encoder=NAME enables encoder NAME"
150 echo " --disable-decoder=NAME disables decoder NAME"
151 echo " --enable-decoder=NAME enables decoder NAME"
152 echo " --disable-encoders disables all encoders"
153 echo " --disable-decoders disables all decoders"
154 echo " --disable-muxer=NAME disables muxer NAME"
155 echo " --enable-muxer=NAME enables muxer NAME"
156 echo " --disable-muxers disables all muxers"
157 echo " --disable-demuxer=NAME disables demuxer NAME"
158 echo " --enable-demuxer=NAME enables demuxer NAME"
159 echo " --disable-demuxers disables all demuxers"
160 echo " --enable-parser=NAME enables parser NAME"
161 echo " --disable-parser=NAME disables parser NAME"
162 echo " --disable-parsers disables all parsers"
163 echo " --enable-bsf=NAME enables bitstream filter NAME"
164 echo " --disable-bsf=NAME disables bitstream filter NAME"
165 echo " --disable-bsfs disables all bitstream filters"
166 echo " --enable-protocol=NAME enables protocol NAME"
167 echo " --disable-protocol=NAME disables protocol NAME"
168 echo " --disable-protocols disables all protocols"
169 echo " --disable-devices disables all devices"
170 echo " --list-decoders show all available decoders"
171 echo " --list-encoders show all available encoders"
172 echo " --list-muxers show all available muxers"
173 echo " --list-demuxers show all available demuxers"
174 echo " --list-parsers show all available parsers"
175 echo " --list-protocols show all available protocols"
176 echo " --list-bsfs show all available bitstream filters"
177 echo " --list-indevs show all available input devices"
178 echo " --list-outdevs show all available output devices"
179 echo
180 echo "Developer options (useful when working on FFmpeg itself):"
181 echo " --disable-debug disable debugging symbols"
182 echo " --enable-debug=LEVEL set the debug level [$debuglevel]"
183 echo " --enable-gprof enable profiling with gprof [$gprof]"
184 echo " --disable-optimizations disable compiler optimizations"
185 echo " --enable-extra-warnings enable more compiler warnings"
186 echo " --disable-stripping disable stripping of executables and shared libraries"
187 echo ""
188 echo "NOTE: Object files are built at the place where configure is launched."
189 exit 1
192 log(){
193 echo "$@" >> $logfile
196 log_file(){
197 log BEGIN $1
198 pr -n -t $1 >> $logfile
199 log END $1
202 echolog(){
203 log "$@"
204 echo "$@"
207 die(){
208 echolog "$@"
209 cat <<EOF
210 If you think configure made a mistake, make sure you are using the latest
211 version from SVN. If the latest version fails, report the problem to the
212 ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
214 if disabled logging; then
215 cat <<EOF
216 Rerun configure with logging enabled (do not use --disable-logging), and
217 include the log this produces with your report.
219 else
220 cat <<EOF
221 Include the log file "$logfile" produced by configure as this will help
222 solving the problem.
225 rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
226 exit 1
229 # Avoid locale weirdness, besides we really just want to translate ASCII.
230 toupper(){
231 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
234 tolower(){
235 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
238 set_all(){
239 value=$1
240 shift
241 for var in $*; do
242 eval $var=$value
243 done
246 pushvar(){
247 for var in $*; do
248 eval level=\${${var}_level:=0}
249 eval ${var}_${level}="\$$var"
250 eval ${var}_level=$(($level+1))
251 done
254 popvar(){
255 for var in $*; do
256 eval level=\${${var}_level:-0}
257 test $level = 0 && continue
258 eval level=$(($level-1))
259 eval $var="\${${var}_${level}}"
260 eval ${var}_level=$level
261 eval unset ${var}_${level}
262 done
265 enable(){
266 set_all yes $*
269 disable(){
270 set_all no $*
273 enabled(){
274 test "${1#!}" = "$1" && op== || op=!=
275 eval test "x\$${1#!}" $op "xyes"
278 disabled(){
279 test "${1#!}" = "$1" && op== || op=!=
280 eval test "x\$${1#!}" $op "xno"
283 enabled_all(){
284 for opt; do
285 enabled $opt || return 1
286 done
289 disabled_all(){
290 for opt; do
291 disabled $opt || return 1
292 done
295 enabled_any(){
296 for opt; do
297 enabled $opt && return 0
298 done
301 disabled_any(){
302 for opt; do
303 disabled $opt && return 0
304 done
307 set_default(){
308 for opt; do
309 eval test -z "\$$opt" && eval $opt=\$${opt}_default
310 done
313 is_in(){
314 value=$1
315 shift
316 for var in $*; do
317 [ $var = $value ] && return 0
318 done
319 return 1
322 check_deps(){
323 for cfg; do
324 cfg="${cfg#!}"
325 enabled ${cfg}_checking && die "Circular dependency for $cfg."
326 disabled ${cfg}_checking && continue
327 enable ${cfg}_checking
329 eval dep_all="\$${cfg}_deps"
330 eval dep_any="\$${cfg}_deps_any"
332 pushvar cfg dep_all dep_any
333 check_deps $dep_all $dep_any
334 popvar cfg dep_all dep_any
336 enabled_all $dep_all || disable $cfg
337 enabled_any $dep_any || disable $cfg
339 if enabled $cfg; then
340 eval dep_extralibs="\$${cfg}_extralibs"
341 test -n "$dep_extralibs" && add_extralibs $dep_extralibs
344 disable ${cfg}_checking
345 done
348 print_config(){
349 pfx=$1
350 header=$2
351 makefile=$3
352 shift 3
353 for cfg; do
354 ucname="`toupper $cfg`"
355 if enabled $cfg; then
356 echo "#define ${pfx}${ucname} 1" >> $header
357 echo "#define ENABLE_${ucname} 1" >> $header
358 echo "${pfx}${ucname}=yes" >> $makefile
359 else
360 echo "#define ENABLE_${ucname} 0" >> $header
362 done
365 flags_saved(){
366 (: ${SAVE_CFLAGS?}) 2> /dev/null
369 save_flags(){
370 flags_saved && return
371 SAVE_CFLAGS="$CFLAGS"
372 SAVE_LDFLAGS="$LDFLAGS"
373 SAVE_extralibs="$extralibs"
376 restore_flags(){
377 flags_saved || return
378 CFLAGS="$SAVE_CFLAGS"
379 LDFLAGS="$SAVE_LDFLAGS"
380 extralibs="$SAVE_extralibs"
381 unset SAVE_CFLAGS
382 unset SAVE_LDFLAGS
383 unset SAVE_extralibs
386 temp_cflags(){
387 save_flags
388 CFLAGS="$CFLAGS $*"
391 temp_ldflags(){
392 save_flags
393 LDFLAGS="$LDFLAGS $*"
396 temp_extralibs(){
397 save_flags
398 extralibs="$extralibs $*"
401 append(){
402 var=$1
403 shift
404 flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
405 eval "$var=\"\$$var $*\""
408 add_cflags(){
409 append CFLAGS "$@"
412 add_ldflags(){
413 append LDFLAGS "$@"
416 add_extralibs(){
417 append extralibs "$@"
420 check_cmd(){
421 log "$@"
422 "$@" >> $logfile 2>&1
425 check_cc(){
426 log check_cc "$@"
427 cat > $TMPC
428 log_file $TMPC
429 check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
432 check_cpp(){
433 log check_cpp "$@"
434 cat > $TMPC
435 log_file $TMPC
436 check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
439 check_asm(){
440 log check_asm "$@"
441 name="$1"
442 asm="$2"
443 shift 2
444 check_cc "$@" <<EOF && enable $name || disable $name
445 int foo(void){ asm volatile($asm); }
449 check_yasm(){
450 log check_yasm "$@"
451 echo "$1" > $TMPS
452 log_file $TMPS
453 shift 1
454 check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
457 check_ld(){
458 log check_ld "$@"
459 check_cc || return
460 flags=''
461 libs=''
462 for f; do
463 test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
464 done
465 check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
468 check_cflags(){
469 log check_cflags "$@"
470 check_cc "$@" <<EOF && add_cflags "$@"
471 int x;
475 check_ldflags(){
476 log check_ldflags "$@"
477 check_ld "$@" <<EOF && add_ldflags "$@"
478 int main(void){ return 0; }
482 check_header(){
483 log check_header "$@"
484 header=$1
485 shift
486 var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
487 disable $var
488 check_cpp "$@" <<EOF && enable $var
489 #include <$header>
490 int x;
494 check_func(){
495 log check_func "$@"
496 func=$1
497 shift
498 disable $func
499 check_ld "$@" <<EOF && enable $func
500 extern int $func();
501 int main(void){ $func(); }
505 check_func_headers(){
506 log check_func_headers "$@"
507 headers=$1
508 func=$2
509 shift 2
510 disable $func
511 incs=""
512 for hdr in $headers; do
513 incs="$incs
514 #include <$hdr>"
515 done
516 check_ld "$@" <<EOF && enable $func
517 $incs
518 int main(int argc, char **argv){
519 (void) $func;
520 return 0;
525 check_lib(){
526 log check_lib "$@"
527 header="$1"
528 func="$2"
529 shift 2
530 temp_extralibs "$@"
531 check_header $header && check_func $func && add_extralibs "$@"
532 err=$?
533 restore_flags
534 return $err
537 check_lib2(){
538 log check_lib2 "$@"
539 headers="$1"
540 func="$2"
541 shift 2
542 temp_extralibs "$@"
543 check_func_headers "$headers" $func && add_extralibs "$@"
544 err=$?
545 restore_flags
546 return $err
549 check_exec(){
550 check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
553 check_exec_crash(){
554 code=`cat`
556 # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
557 # are safe but may not be available everywhere. Thus we use
558 # raise(SIGTERM) instead. The check is run in a subshell so we
559 # can redirect the "Terminated" message from the shell. SIGBUS
560 # is not defined by standard C so it is used conditionally.
562 (check_exec "$@") >> $logfile 2>&1 <<EOF
563 #include <signal.h>
564 static void sighandler(int sig){
565 raise(SIGTERM);
567 int main(void){
568 signal(SIGILL, sighandler);
569 signal(SIGFPE, sighandler);
570 signal(SIGSEGV, sighandler);
571 #ifdef SIGBUS
572 signal(SIGBUS, sighandler);
573 #endif
574 { $code }
579 check_type(){
580 log check_type "$@"
581 headers=$1
582 type=$2
583 shift 2
584 disable $type
585 incs=""
586 for hdr in $headers; do
587 incs="$incs
588 #include <$hdr>"
589 done
590 check_cc "$@" <<EOF && enable $type
591 $incs
592 $type v;
596 require(){
597 name="$1"
598 header="$2"
599 func="$3"
600 shift 3
601 check_lib $header $func "$@" || die "ERROR: $name not found"
604 require2(){
605 name="$1"
606 headers="$2"
607 func="$3"
608 shift 3
609 check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
612 check_foo_config(){
613 cfg=$1
614 pkg=$2
615 header=$3
616 func=$4
617 shift 4
618 disable $cfg
619 check_cmd ${pkg}-config --version
620 err=$?
621 if test "$err" = 0; then
622 temp_cflags `${pkg}-config --cflags`
623 temp_extralibs `${pkg}-config --libs`
624 check_lib "$@" $header $func && enable $cfg
626 return $err
629 apply(){
630 file=$1
631 shift
632 "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
635 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
636 # system-dependent things.
638 COMPONENT_LIST="
639 bsfs
640 decoders
641 demuxers
642 encoders
643 filters
644 indevs
645 muxers
646 outdevs
647 parsers
648 protocols
651 CONFIG_LIST="
652 $COMPONENT_LIST
653 avfilter
654 avfilter_lavf
655 avisynth
656 beos_netserver
657 bzlib
658 ffmpeg
659 ffplay
660 ffserver
662 gprof
663 gray
664 hardcoded_tables
665 ipv6
666 liba52
667 liba52bin
668 libamr_nb
669 libamr_wb
670 libdc1394
671 libdirac
672 libfaac
673 libfaad
674 libfaadbin
675 libgsm
676 libmp3lame
677 libnut
678 libschroedinger
679 libtheora
680 libvorbis
681 libx264
682 libxvid
683 memalign_hack
684 mlib
685 mpegaudio_hp
686 network
687 nonfree
688 postproc
689 powerpc_perf
690 small
691 swscale
692 vhook
693 x11grab
694 zlib
697 THREADS_LIST='
698 beosthreads
699 os2threads
700 pthreads
701 w32threads
704 ARCH_LIST='
705 alpha
706 armv4l
707 bfin
708 ia64
709 m68k
710 mips
711 parisc
712 powerpc
713 s390
715 sparc
716 sparc64
718 x86_32
719 x86_64
722 ARCH_EXT_LIST='
723 altivec
724 armv5te
725 armv6
726 armvfp
727 iwmmxt
730 mmx2
731 neon
732 ssse3
736 HAVE_LIST="
737 $ARCH_EXT_LIST
738 $THREADS_LIST
739 altivec_h
740 arpa_inet_h
741 bswap
742 byteswap_h
743 closesocket
744 cmov
745 conio_h
746 dcbzl
747 dev_bktr_ioctl_bt848_h
748 dev_bktr_ioctl_meteor_h
749 dev_ic_bt8xx_h
750 dev_video_meteor_ioctl_meteor_h
751 dev_video_bktr_ioctl_bt848_h
752 dlfcn_h
753 dlopen
754 ebp_available
755 ebx_available
756 fast_64bit
757 fast_cmov
758 fast_unaligned
759 fork
760 freetype2
761 gethrtime
762 GetProcessTimes
763 getrusage
764 imlib2
765 inet_aton
766 inline_asm
767 libdc1394_1
768 libdc1394_2
769 llrint
770 lrint
771 lrintf
772 machine_ioctl_bt848_h
773 machine_ioctl_meteor_h
774 malloc_h
775 memalign
776 mkstemp
778 ppc64
779 round
780 roundf
782 sdl_video_size
783 socklen_t
784 soundcard_h
785 poll_h
786 sys_mman_h
787 sys_resource_h
788 sys_select_h
789 sys_soundcard_h
790 sys_videoio_h
791 termios_h
792 threads
793 winsock2_h
794 yasm
797 CMDLINE_SELECT="
798 $ARCH_EXT_LIST
799 $CONFIG_LIST
800 $THREADS_LIST
801 cross_compile
802 debug
803 extra_warnings
804 logging
805 optimizations
806 shared
807 static
808 stripping
811 PATHS_LIST='
812 bindir
813 incdir
814 libdir
815 mandir
816 prefix
817 shlibdir
820 CMDLINE_SET="
821 $PATHS_LIST
822 arch
823 build_suffix
826 cross_prefix
827 extra_version
828 logfile
829 source_path
830 target_os
833 # code dependency declarations
835 # architecture extensions
836 altivec_deps="powerpc"
837 armv5te_deps="armv4l"
838 armv6_deps="armv4l"
839 armvfp_deps="armv4l"
840 iwmmxt_deps="armv4l"
841 mmi_deps="mips"
842 mmx_deps="x86"
843 mmx2_deps="x86 mmx"
844 neon_deps="armv4l"
845 ssse3_deps="x86"
846 vis_deps="sparc"
848 # system headers and functions
849 byteswap_h_deps="!armv4l"
851 # decoders / encoders
852 ac3_decoder_deps="gpl !liba52"
853 dxa_decoder_deps="zlib"
854 eac3_decoder_deps="gpl"
855 flashsv_decoder_deps="zlib"
856 flashsv_encoder_deps="zlib"
857 mlp_decoder_deps="mlp_parser"
858 mpeg_xvmc_decoder_deps="xvmc"
859 png_decoder_deps="zlib"
860 png_encoder_deps="zlib"
861 zmbv_decoder_deps="zlib"
862 zmbv_encoder_deps="zlib"
864 # external libraries
865 liba52_decoder_deps="liba52"
866 liba52bin_decoder_extralibs='$ldl'
867 libamr_nb_decoder_deps="libamr_nb"
868 libamr_nb_encoder_deps="libamr_nb"
869 libamr_wb_decoder_deps="libamr_wb"
870 libamr_wb_encoder_deps="libamr_wb"
871 libdirac_decoder_deps="libdirac !libschroedinger"
872 libdirac_encoder_deps="libdirac"
873 libfaac_encoder_deps="libfaac"
874 libfaad_decoder_deps="libfaad"
875 libfaadbin_decoder_extralibs='$ldl'
876 libgsm_decoder_deps="libgsm"
877 libgsm_encoder_deps="libgsm"
878 libgsm_ms_decoder_deps="libgsm"
879 libgsm_ms_encoder_deps="libgsm"
880 libmp3lame_encoder_deps="libmp3lame"
881 libschroedinger_decoder_deps="libschroedinger"
882 libschroedinger_encoder_deps="libschroedinger"
883 libtheora_encoder_deps="libtheora"
884 libvorbis_encoder_deps="libvorbis"
885 libx264_encoder_deps="libx264"
886 libxvid_encoder_deps="libxvid"
887 mpeg4aac_decoder_deps="libfaad"
889 # demuxers / muxers
890 ac3_demuxer_deps="ac3_parser"
891 audio_beos_demuxer_deps="audio_beos"
892 audio_beos_demuxer_extralibs="-lmedia -lbe"
893 audio_beos_muxer_deps="audio_beos"
894 audio_beos_muxer_extralibs="-lmedia -lbe"
895 avisynth_demuxer_deps="avisynth"
896 bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
897 dirac_demuxer_deps="dirac_parser"
898 dv1394_demuxer_deps="dv1394 dv_demuxer"
899 libdc1394_demuxer_deps="libdc1394"
900 libnut_demuxer_deps="libnut"
901 libnut_muxer_deps="libnut"
902 mp3_demuxer_deps="mpegaudio_parser"
903 oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
904 oss_muxer_deps_any="soundcard_h sys_soundcard_h"
905 redir_demuxer_deps="network"
906 rtp_muxer_deps="network rtp_protocol"
907 rtsp_demuxer_deps="sdp_demuxer"
908 sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
909 v4l_demuxer_deps="linux_videodev_h"
910 v4l2_demuxer_deps_any="linux_videodev2_h sys_videoio_h"
911 vfwcap_demuxer_deps="capCreateCaptureWindow"
912 vfwcap_demuxer_extralibs="-lvfw32"
913 x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
914 x11_grab_device_demuxer_extralibs="-lX11 -lXext"
916 # protocols
917 http_protocol_deps="network"
918 rtp_protocol_deps="udp_protocol"
919 tcp_protocol_deps="network"
920 udp_protocol_deps="network"
922 # filters
923 movie_filter_deps="avfilter_lavf"
925 # programs
926 ffplay_deps="sdl"
927 ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
928 ffserver_extralibs='$ldl'
929 vhook_extralibs='$ldl'
932 # default parameters
934 logfile="config.err"
936 # installation paths
937 prefix_default="/usr/local"
938 bindir_default='${prefix}/bin'
939 incdir_default='${prefix}/include'
940 libdir_default='${prefix}/lib'
941 mandir_default='${prefix}/share/man'
942 shlibdir_default="$libdir_default"
944 # toolchain
945 cc="gcc"
946 yasmexe="yasm"
947 ar="ar"
948 nm="nm"
949 ranlib="ranlib"
950 strip="strip"
951 asmalign_pot="unknown"
952 ln_s="ln -sf"
953 objformat="elf"
955 # machine
956 arch=`uname -m`
957 cpu="generic"
959 # OS
960 target_os=$(tolower $(uname -s))
962 # libraries
963 enable bzlib
964 enable zlib
966 # configurable options
967 enable debug
968 enable ffmpeg
969 enable ffplay
970 enable ffserver
971 enable ipv6
972 enable mpegaudio_hp
973 enable network
974 enable optimizations
975 enable protocols
976 enable static
977 enable stripping
978 vhook="default"
980 # build settings
981 add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
982 SHFLAGS='-shared -Wl,-soname,$$(@F)'
983 VHOOKSHFLAGS='$(SHFLAGS)'
984 FFSERVERLDFLAGS=-Wl,-E
985 LIBPREF="lib"
986 LIBSUF=".a"
987 FULLNAME='$(NAME)$(BUILDSUF)'
988 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
989 SLIBPREF="lib"
990 SLIBSUF=".so"
991 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
992 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
993 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
994 LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
996 # gcc stupidly only outputs the basename of targets with -MM
997 DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed -e "/^\#.*/d" -e "1s,^,$(@D)/," -e "s,\\([[:space:]]\\)\\(version\\.h\\),\\1\$$(BUILD_ROOT_REL)/\\2,"'
999 # find source path
1000 source_path="`dirname \"$0\"`"
1001 enable source_path_used
1002 if test -z "$source_path" -o "$source_path" = "." ; then
1003 source_path="`pwd`"
1004 disable source_path_used
1005 else
1006 source_path="`cd \"$source_path\"; pwd`"
1007 echo "$source_path" | grep -q '[[:blank:]]' &&
1008 die "Out of tree builds are impossible with whitespace in source path."
1011 FFMPEG_CONFIGURATION="$@"
1013 find_things(){
1014 thing=$1
1015 pattern=$2
1016 file=$source_path/$3
1017 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
1020 ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
1021 DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
1022 PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
1023 BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
1024 MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
1025 DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
1026 OUTDEV_LIST=$(find_things muxer _MUX libavdevice/alldevices.c)
1027 INDEV_LIST=$(find_things demuxer DEMUX libavdevice/alldevices.c)
1028 PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
1029 FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
1031 enable $ARCH_EXT_LIST \
1032 $DECODER_LIST \
1033 $ENCODER_LIST \
1034 $PARSER_LIST \
1035 $BSF_LIST \
1036 $DEMUXER_LIST \
1037 $MUXER_LIST \
1038 $FILTER_LIST \
1039 $PROTOCOL_LIST \
1040 $INDEV_LIST \
1041 $OUTDEV_LIST \
1043 die_unknown(){
1044 echo "Unknown option \"$1\"."
1045 echo "See $0 --help for available options."
1046 exit 1
1049 show_list() {
1050 suffix=_$1
1051 shift
1052 echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
1053 exit 0
1056 for opt do
1057 optval="${opt#*=}"
1058 case "$opt" in
1059 --extra-cflags=*) add_cflags "$optval"
1061 --extra-ldflags=*) add_ldflags "$optval"
1063 --extra-libs=*) add_extralibs "$optval"
1065 --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
1067 --enable-debug=*) debuglevel="$optval"
1069 --enable-*=*|--disable-*=*)
1070 eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
1071 case "$thing" in
1072 encoder|decoder|muxer|demuxer|parser|bsf|protocol|filter) $action ${optval}_${thing} ;;
1073 *) die_unknown "$opt" ;;
1074 esac
1076 --enable-?*|--disable-?*)
1077 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
1078 if is_in $option $COMPONENT_LIST; then
1079 eval $action \$$(toupper ${option%s})_LIST
1080 elif is_in $option $CMDLINE_SELECT; then
1081 $action $option
1082 else
1083 die_unknown $opt
1086 --list-*)
1087 NAME="${opt#--list-}"
1088 is_in $NAME $COMPONENT_LIST || die_unknown $opt
1089 NAME=${NAME%s}
1090 eval show_list $NAME \$$(toupper $NAME)_LIST
1092 --help|-h) show_help
1095 optname="${opt%=*}"
1096 optname="${optname#--}"
1097 optname=$(echo "$optname" | sed 's/-/_/g')
1098 is_in $optname $CMDLINE_SET || die_unknown $opt
1099 eval $optname='$optval'
1101 esac
1102 done
1104 disabled logging && logfile=/dev/null
1106 echo "# $0 $@" > $logfile
1107 set >> $logfile
1109 cc="${cross_prefix}${cc}"
1110 yasmexe="${cross_prefix}${yasmexe}"
1111 ar="${cross_prefix}${ar}"
1112 nm="${cross_prefix}${nm}"
1113 ranlib="${cross_prefix}${ranlib}"
1114 strip="${cross_prefix}${strip}"
1116 # set temporary file name
1117 if test ! -z "$TMPDIR" ; then
1118 TMPDIR1="${TMPDIR}"
1119 elif test ! -z "$TEMPDIR" ; then
1120 TMPDIR1="${TEMPDIR}"
1121 else
1122 TMPDIR1="/tmp"
1125 TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
1126 TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
1127 TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
1128 TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
1129 TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
1130 TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
1132 check_cflags -fasm
1133 check_cflags -std=c99
1135 case "$arch" in
1136 i386|i486|i586|i686|i86pc|BePC)
1137 arch="x86_32"
1138 enable fast_unaligned
1140 x86_64|amd64)
1141 arch="x86_32"
1142 enable fast_unaligned
1143 check_cc <<EOF && enable fast_64bit && arch="x86_64"
1144 int test[sizeof(char*) - 7];
1147 # armv4l is a subset of armv[567]*l
1148 arm|armv[4567]*l)
1149 arch="armv4l"
1151 alpha)
1152 arch="alpha"
1153 enable fast_64bit
1155 "Power Macintosh"|ppc|powerpc)
1156 arch="powerpc"
1158 ppc64)
1159 arch="powerpc"
1160 enable fast_64bit
1162 mips|mipsel|IP*)
1163 arch="mips"
1165 sun4u|sparc64)
1166 arch="sparc64"
1167 enable fast_64bit
1169 sparc)
1170 arch="sparc"
1172 sh4)
1173 arch="sh4"
1175 parisc)
1176 arch="parisc"
1178 parisc64)
1179 arch="parisc"
1180 enable fast_64bit
1182 s390|s390x)
1183 arch="s390"
1185 m68k)
1186 arch="m68k"
1188 ia64)
1189 arch="ia64"
1190 enable fast_64bit
1192 bfin)
1193 arch="bfin"
1196 arch="unknown"
1198 esac
1200 enable $arch
1201 enabled_any x86_32 x86_64 && enable x86
1202 enabled sparc64 && enable sparc
1204 # OS specific
1205 case $target_os in
1206 beos|haiku|zeta)
1207 prefix_default="$HOME/config"
1208 # helps building libavcodec
1209 add_cflags "-DPIC -fomit-frame-pointer"
1210 # 3 gcc releases known for BeOS, each with ugly bugs
1211 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
1212 case "$gcc_version" in
1213 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
1214 disable mmx
1216 *20010315*) echo "BeBits gcc"
1217 add_cflags "-fno-expensive-optimizations"
1219 esac
1220 SHFLAGS=-nostart
1221 # enable BeOS things
1222 enable audio_beos
1223 # no need for libm, but the inet stuff
1224 # Check for BONE
1225 # XXX: actually should check for NOT net_server
1226 if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
1227 network_extralibs="-lbind -lsocket"
1228 else
1229 enable beos_netserver
1230 network_extralibs="-lnet"
1231 fi ;;
1232 sunos)
1233 FFSERVERLDFLAGS=""
1234 SHFLAGS='-shared -Wl,-h,$$(@F)'
1235 network_extralibs="-lsocket -lnsl"
1237 netbsd)
1238 oss_demuxer_extralibs="-lossaudio"
1239 oss_muxer_extralibs="-lossaudio"
1241 openbsd)
1242 disable need_memalign
1243 LIBOBJFLAGS='$(PIC)'
1244 SHFLAGS='-shared'
1245 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
1246 SLIBNAME_WITH_VERSION='$(SLIBNAME)'
1247 SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
1248 oss_demuxer_extralibs="-lossaudio"
1249 oss_muxer_extralibs="-lossaudio"
1251 freebsd)
1252 disable need_memalign
1254 bsd/os)
1255 osextralibs="-lpoll -lgnugetopt"
1256 strip="strip -d"
1258 darwin)
1259 disable need_memalign
1260 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
1261 VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$$(@F)'
1262 strip="strip -x"
1263 FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
1264 SLIBSUF=".dylib"
1265 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
1266 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
1267 FFSERVERLDFLAGS=-Wl,-bind_at_load
1268 objformat="macho"
1269 enabled x86_64 && objformat="macho64"
1271 mingw32*)
1272 target_os=mingw32
1273 LIBTARGET=i386
1274 if test $arch = x86_64; then
1275 disable need_memalign
1276 LIBTARGET=x64
1278 shlibdir_default="$bindir_default"
1279 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
1280 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
1281 if enabled swscale; then
1282 VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
1283 VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
1285 disable ffserver
1286 SLIBPREF=""
1287 SLIBSUF=".dll"
1288 EXESUF=".exe"
1289 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
1290 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
1291 SLIB_EXTRA_CMD='-lib /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
1292 SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
1293 install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
1294 SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
1295 SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
1296 objformat="win32"
1298 cygwin*)
1299 target_os=cygwin
1300 shlibdir_default="$bindir_default"
1301 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
1302 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
1303 if enabled swscale; then
1304 VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
1305 VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
1307 EXESUF=".exe"
1308 SLIBPREF="cyg"
1309 SLIBSUF=".dll"
1310 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
1311 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
1312 SHFLAGS='-shared -Wl,--enable-auto-image-base'
1313 objformat="win32"
1315 *-dos|freedos|opendos)
1316 disable ffplay ffserver vhook
1317 disable $INDEV_LIST $OUTDEV_LIST
1318 network_extralibs="-lsocket"
1319 EXESUF=".exe"
1320 objformat="win32"
1322 linux)
1323 enable dv1394
1325 irix*)
1326 target_os=irix
1327 ranlib="echo ignoring ranlib"
1329 os/2*)
1330 strip="lxlite"
1331 ln_s="cp -f"
1332 EXESUF=".exe"
1333 FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
1334 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
1335 FFSERVERLDFLAGS=""
1336 LIBSUF="_s.a"
1337 SLIBPREF=""
1338 SLIBSUF=".dll"
1339 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
1340 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
1341 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
1342 echo PROTMODE >> $(SUBDIR)$(NAME).def; \
1343 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
1344 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
1345 echo EXPORTS >> $(SUBDIR)$(NAME).def; \
1346 emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
1347 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
1348 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
1349 SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
1350 SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
1351 disable vhook
1353 interix)
1354 disable vhook
1358 target_os="${target_os}-UNKNOWN"
1360 esac
1362 set_default $PATHS_LIST
1364 add_extralibs $osextralibs
1366 # Combine FFLDFLAGS and the LDFLAGS environment variable.
1367 LDFLAGS="$FFLDFLAGS $LDFLAGS"
1369 test -n "$cross_prefix" && enable cross_compile
1371 # we need to build at least one lib type
1372 if ! enabled_any static shared; then
1373 cat <<EOF
1374 At least one library type must be built.
1375 Specify --enable-static to build the static libraries or --enable-shared to
1376 build the shared libraries as well. To only build the shared libraries specify
1377 --disable-static in addition to --enable-shared.
1379 exit 1;
1382 disabled static && LIBNAME=""
1384 if enabled_any libfaad libfaadbin ; then
1385 if check_header faad.h; then
1386 check_cc <<EOF
1387 #include <faad.h>
1388 #ifndef FAAD2_VERSION
1389 ok faad1
1390 #endif
1391 int main(void) { return 0; }
1393 test $? = 0 && enable libfaad2
1394 else
1395 die "FAAD test failed."
1400 if ! enabled gpl; then
1401 die_gpl_disabled(){
1402 name=$1
1403 shift
1404 enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
1406 die_gpl_disabled "The Postprocessing code" postproc
1407 die_gpl_disabled "liba52" liba52
1408 die_gpl_disabled "libx264" libx264
1409 die_gpl_disabled "libxvidcore" libxvid
1410 die_gpl_disabled "FAAD2" libfaad2
1411 die_gpl_disabled "The X11 grabber" x11grab
1412 die_gpl_disabled "The software scaler" swscale
1415 if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
1416 die "libamr is nonfree and --enable-nonfree is not specified."
1419 check_deps $ARCH_EXT_LIST
1421 test -z "$need_memalign" && need_memalign="$mmx"
1423 #Darwin CC versions
1424 if test $target_os = darwin; then
1425 if $cc -v 2>&1 | grep -q xlc; then
1426 add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
1427 else
1428 add_cflags "-pipe"
1429 check_cflags "-force_cpusubtype_ALL"
1430 check_cflags "-Wno-sign-compare"
1431 enabled shared || check_cflags -mdynamic-no-pic
1435 disabled optimizations || check_cflags -fomit-frame-pointer
1437 # Add processor-specific flags
1438 if test $cpu != "generic"; then
1439 warn_altivec(){
1440 $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
1442 case $cpu in
1443 601|ppc601|PowerPC601)
1444 add_cflags "-mcpu=601"
1445 warn_altivec enabled PPC601
1447 603*|ppc603*|PowerPC603*)
1448 add_cflags "-mcpu=603"
1449 warn_altivec enabled PPC603
1451 604*|ppc604*|PowerPC604*)
1452 add_cflags "-mcpu=604"
1453 warn_altivec enabled PPC604
1455 G3|g3|75*|ppc75*|PowerPC75*)
1456 add_cflags "-mcpu=750 -mpowerpc-gfxopt"
1457 warn_altivec enabled PPC75x
1459 G4|g4|745*|ppc745*|PowerPC745*)
1460 add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
1461 warn_altivec disabled PPC745x
1463 74*|ppc74*|PowerPC74*)
1464 add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
1465 warn_altivec disabled PPC74xx
1467 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
1468 add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
1469 warn_altivec disabled PPC970
1470 enable ppc64
1472 Cell|CELL|cell)
1473 add_cflags "-mcpu=cell"
1474 warn_altivec disabled Cell
1475 enable ppc64
1477 # targets that do NOT support conditional mov (cmov)
1478 i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
1479 add_cflags "-march=$cpu"
1480 disable cmov
1482 # targets that do support conditional mov (cmov)
1483 i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
1484 add_cflags "-march=$cpu"
1485 enable cmov
1486 enable fast_cmov
1488 # targets that do support conditional mov but on which it's slow
1489 pentium4|pentium4m|prescott|nocona)
1490 add_cflags "-march=$cpu"
1491 enable cmov
1492 disable fast_cmov
1494 sparc64)
1495 add_cflags "-mcpu=v9"
1497 arm*|cortex*)
1498 add_cflags "-mcpu=$cpu"
1501 echo "WARNING: Unknown CPU \"$cpu\", ignored."
1503 esac
1506 # make sure we can execute files in $TMPDIR
1507 cat > $TMPSH 2>> $logfile <<EOF
1508 #! /bin/sh
1510 chmod +x $TMPSH >> $logfile 2>&1
1511 if ! $TMPSH >> $logfile 2>&1; then
1512 cat <<EOF
1513 Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
1514 variable to another directory and make sure that $TMPDIR1 is not mounted
1515 noexec.
1517 die "Sanity test failed."
1519 rm $TMPSH
1521 # compiler sanity check
1522 check_exec <<EOF
1523 int main(void){ return 0; }
1525 if test "$?" != 0; then
1526 echo "$cc is unable to create an executable file."
1527 if test -z "$cross_prefix" && ! enabled cross_compile ; then
1528 echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
1529 echo "Only do this if you know what cross compiling means."
1531 die "C compiler test failed."
1534 check_cc <<EOF || die "Symbol mangling check failed."
1535 int ff_extern;
1537 sym=$($nm -P -g $TMPO | grep ff_extern)
1538 extern_prefix=${sym%%ff_extern*}
1540 check_asm inline_asm '""'
1542 if enabled x86; then
1543 # check whether EBP is available on x86
1544 # As 'i' is stored on the stack, this program will crash
1545 # if the base pointer is used to access it because the
1546 # base pointer is cleared in the inline assembly code.
1547 check_exec_crash <<EOF && enable ebp_available
1548 volatile int i=0;
1549 asm volatile (
1550 "xorl %%ebp, %%ebp"
1551 ::: "%ebp");
1552 return i;
1555 # check wether EBX is available on x86
1556 check_asm ebx_available '"":::"%ebx"'
1558 # check whether binutils is new enough to compile SSSE3/MMX2
1559 enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
1560 enabled mmx2 && check_asm mmx2 '"movss %xmm0, %xmm0"'
1562 check_asm bswap '"bswap %%eax" ::: "%eax"'
1564 YASMFLAGS="-f $objformat -DARCH_$(toupper $arch)"
1565 enabled x86_64 && append YASMFLAGS "-m amd64"
1566 enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
1567 case "$objformat" in
1568 elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
1569 macho64) append YASMFLAGS "-DPIC -DPREFIX" ;;
1570 *) append YASMFLAGS "-DPREFIX" ;;
1571 esac
1572 check_yasm "pabsw xmm0, xmm0" && enable yasm
1575 # check for assembler specific support
1577 if test $arch = "powerpc"; then
1578 check_cc <<EOF && enable dcbzl
1579 int main(void) {
1580 register long zero = 0;
1581 char data[1024];
1582 asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
1583 return 0;
1588 # check for SIMD availability
1590 # AltiVec flags: The FSF version of GCC differs from the Apple version
1591 if enabled altivec; then
1592 check_cflags -maltivec -mabi=altivec &&
1593 { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
1594 check_cflags -faltivec
1596 # check if our compiler supports Motorola AltiVec C API
1597 check_cc <<EOF || disable altivec
1598 $inc_altivec_h
1599 int main(void) {
1600 vector signed int v1, v2, v3;
1601 v1 = vec_add(v2,v3);
1602 return 0;
1606 # check if our compiler supports braces for vector declarations
1607 check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
1608 $inc_altivec_h
1609 int main (void) { (vector int) {1}; return 0; }
1613 # We have to check if pld is a nop and disable it.
1614 enabled armv4l && check_asm pld '"pld [r0]"'
1615 enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
1616 enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
1617 enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
1618 enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
1619 enabled mmi && check_asm mmi '"lq $2, 0($2)"'
1620 enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
1621 enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
1623 enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
1625 # ---
1626 # big/little-endian test
1627 check_cc <<EOF || die "endian test failed"
1628 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
1630 od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
1632 # ---
1633 # check availability of some header files
1635 if check_func dlopen; then
1636 ldl=
1637 elif check_func dlopen -ldl; then
1638 ldl=-ldl
1641 check_func fork
1642 check_func gethrtime
1643 check_func getrusage
1644 check_func inet_aton $network_extralibs
1645 check_func memalign
1646 check_func mkstemp
1647 check_func_headers windows.h GetProcessTimes
1649 check_header byteswap.h
1650 check_header conio.h
1651 check_header dlfcn.h
1652 check_header malloc.h
1653 check_header poll.h
1654 check_header sys/mman.h
1655 check_header sys/resource.h
1656 check_header sys/select.h
1657 check_header termios.h
1659 if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
1660 die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
1663 enabled zlib && check_lib zlib.h zlibVersion -lz || disable zlib
1664 enabled bzlib && check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
1666 # check for some common methods of building with pthread support
1667 # do this before the optional library checks as some of them require pthreads
1668 if enabled pthreads; then
1669 if check_func pthread_create; then
1671 elif check_func pthread_create -pthread; then
1672 add_cflags -pthread
1673 add_extralibs -pthread
1674 elif check_func pthread_create -pthreads; then
1675 add_cflags -pthreads
1676 add_extralibs -pthreads
1677 elif check_func pthread_create -lpthreadGC2; then
1678 add_extralibs -lpthreadGC2
1679 elif ! check_lib pthread.h pthread_create -lpthread; then
1680 die "ERROR: can't find pthreads library"
1684 for thread in $THREADS_LIST; do
1685 if enabled $thread; then
1686 test -n "$thread_type" &&
1687 die "ERROR: Only one thread type must be selected." ||
1688 thread_type="$thread"
1690 done
1692 check_lib math.h sin -lm
1694 # test for C99 functions in math.h
1695 for func in llrint lrint lrintf round roundf; do
1696 check_exec <<EOF && enable $func || disable $func
1697 #include <math.h>
1698 int main(void) { return ($func(3.999f) > 0)?0:1; }
1700 done
1702 # these are off by default, so fail if requested and not available
1703 enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
1704 enabled liba52 && require liba52 a52dec/a52.h a52_init -la52
1705 enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
1706 enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
1707 enabled libdirac && add_cflags "$(pkg-config --cflags dirac)" \
1708 && require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder \
1709 && require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
1710 enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
1711 enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
1712 enabled libgsm && require libgsm gsm.h gsm_create -lgsm
1713 enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
1714 enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
1715 enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) \
1716 && require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
1717 enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
1718 enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
1719 enabled libx264 && require x264 x264.h x264_encoder_open -lx264 -lm
1720 enabled libxvid && require Xvid xvid.h xvid_global -lxvidcore
1721 enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
1723 # libdc1394 check
1724 if enabled libdc1394; then
1725 { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
1726 enable libdc1394_2; } ||
1727 { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
1728 enable libdc1394_1; } ||
1729 die "ERROR: No version of libdc1394 found "
1733 _restrict=
1734 for restrict_keyword in restrict __restrict__ __restrict; do
1735 check_cc <<EOF && _restrict=$restrict_keyword && break
1736 void foo(char * $restrict_keyword p);
1738 done
1740 test "$vhook" = "default" && vhook="$dlopen"
1742 if test "$target_os" = cygwin -o "$target_os" = mingw32 && enabled_all static vhook ; then
1743 disable vhook
1744 echo
1745 echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
1746 echo "Patches welcome."
1747 echo
1750 if enabled vhook; then
1751 check_ldflags -rdynamic
1752 check_ldflags -export-dynamic
1755 check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
1756 check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
1758 ##########################################
1759 # SDL check
1761 disable sdl_too_old
1762 disable sdl
1763 SDL_CONFIG="${cross_prefix}sdl-config"
1764 if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
1765 sdl_cflags=`"${SDL_CONFIG}" --cflags`
1766 temp_cflags $sdl_cflags
1767 temp_extralibs `"${SDL_CONFIG}" --libs`
1768 if check_lib2 SDL.h SDL_Init; then
1769 _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
1770 if test "$_sdlversion" -lt 121 ; then
1771 enable sdl_too_old
1772 else
1773 enable sdl
1774 check_cc $sdl_cflags <<EOF && enable sdl_video_size
1775 #include <SDL.h>
1776 int main(int argc, char **argv){
1777 const SDL_VideoInfo *vi = SDL_GetVideoInfo();
1778 int w = vi->current_w;
1779 return 0;
1784 restore_flags
1787 texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
1789 ##########################################
1790 # Network check
1792 if enabled network; then
1793 check_type sys/socket.h socklen_t
1794 # Prefer arpa/inet.h over winsock2
1795 if check_header arpa/inet.h ; then
1796 check_func closesocket
1797 elif check_header winsock2.h ; then
1798 network_extralibs="-lws2_32"
1799 check_type ws2tcpip.h socklen_t
1800 check_func_headers winsock2.h closesocket
1804 ##########################################
1805 # IPv6 check
1807 enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
1808 #include <sys/types.h>
1809 #include <sys/socket.h>
1810 #include <netinet/in.h>
1811 #include <netdb.h>
1812 int main(void) {
1813 struct sockaddr_storage saddr;
1814 struct ipv6_mreq mreq6;
1815 getaddrinfo(0,0,0,0);
1816 getnameinfo(0,0,0,0,0,0,0);
1817 IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
1821 check_header linux/videodev.h
1822 check_header linux/videodev2.h
1823 check_header sys/videoio.h
1825 check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
1827 # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
1828 { check_header dev/bktr/ioctl_meteor.h &&
1829 check_header dev/bktr/ioctl_bt848.h; } ||
1830 { check_header machine/ioctl_meteor.h &&
1831 check_header machine/ioctl_bt848.h; } ||
1832 { check_header dev/video/meteor/ioctl_meteor.h &&
1833 check_header dev/video/bktr/ioctl_bt848.h; } ||
1834 check_header dev/ic/bt8xx.h
1836 check_header sys/soundcard.h
1837 check_header soundcard.h
1839 # deal with the X11 frame grabber
1840 enabled x11grab &&
1841 check_header X11/Xlib.h &&
1842 check_header X11/extensions/XShm.h &&
1843 check_func XOpenDisplay -lX11 &&
1844 check_func XShmCreateImage -lX11 -lXext
1846 enabled debug && add_cflags -g"$debuglevel"
1848 # add some useful compiler flags if supported
1849 check_cflags -Wdeclaration-after-statement
1850 check_cflags -Wall
1851 check_cflags -Wno-switch
1852 check_cflags -Wdisabled-optimization
1853 check_cflags -Wpointer-arith
1854 check_cflags -Wredundant-decls
1855 check_cflags -Wno-pointer-sign
1856 check_cflags -Wcast-qual
1857 check_cflags -Wwrite-strings
1858 check_cflags -Wtype-limits
1859 enabled extra_warnings && check_cflags -Winline
1861 # add some linker flags
1862 check_ldflags -Wl,--warn-common
1863 check_ldflags -Wl,--as-needed
1864 check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
1865 check_ldflags -Wl,-Bsymbolic
1867 if enabled small; then
1868 check_cflags -Os # not all compilers support -Os
1869 optimizations="small"
1870 elif enabled optimizations; then
1871 if $cc -v 2>&1 | grep -q xlc; then
1872 add_cflags "-O5"
1873 add_ldflags "-O5"
1874 else
1875 add_cflags "-O3"
1878 check_cflags -fno-math-errno
1879 check_cflags -fno-signed-zeros
1881 # add some flags for Intel C Compiler
1882 if $cc --version | grep -q Intel; then
1883 # Just warnings, no remarks
1884 check_cflags -w1
1885 # -wd: Disable following warnings
1886 # 144, 167, 556: -Wno-pointer-sign
1887 # 10006: ignoring unknown option -fno-signed-zeros
1888 # 10156: ignoring option '-W'; no argument required
1889 check_cflags -wd144,167,556,10006,10156
1890 # 11030: Warning unknown option --as-needed
1891 # 10156: ignoring option '-export'; no argument required
1892 check_ldflags -wd10156,11030
1893 # Allow to compile with optimizations
1894 check_ldflags -march=$cpu
1897 # PIC flags for shared library objects where they are needed
1898 if enabled shared; then
1899 # LIBOBJFLAGS may have already been set in the OS configuration
1900 if test -z "$LIBOBJFLAGS" ; then
1901 case "$arch" in
1902 x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
1903 esac
1907 if enabled gprof; then
1908 add_cflags "-p"
1909 add_ldflags "-p"
1912 VHOOKCFLAGS="-fPIC"
1914 # Find out if the .align argument is a power of two or not.
1915 if test $asmalign_pot = "unknown"; then
1916 disable asmalign_pot
1917 echo 'asm (".align 3");' | check_cc && enable asmalign_pot
1920 enabled_any $DECODER_LIST && enable decoders
1921 enabled_any $ENCODER_LIST && enable encoders
1922 enabled_any $BSF_LIST && enable bsfs
1923 enabled_any $DEMUXER_LIST && enable demuxers
1924 enabled_any $MUXER_LIST && enable muxers
1925 enabled_any $FILTER_LIST && enable filters
1926 enabled_any $INDEV_LIST && enable demuxers
1927 enabled_any $OUTDEV_LIST && enable muxers
1928 enabled_any $PROTOCOL_LIST && enable protocols
1930 enabled_any $THREADS_LIST && enable threads
1932 check_deps $CONFIG_LIST \
1933 $HAVE_LIST \
1934 $DECODER_LIST \
1935 $ENCODER_LIST \
1936 $PARSER_LIST \
1937 $BSF_LIST \
1938 $DEMUXER_LIST \
1939 $MUXER_LIST \
1940 $FILTER_LIST \
1941 $INDEV_LIST \
1942 $OUTDEV_LIST \
1943 $PROTOCOL_LIST \
1945 enabled libdc1394 && append pkg_requires "libraw1394"
1946 enabled libdirac && append pkg_requires "dirac"
1947 enabled libtheora && append pkg_requires "theora"
1948 enabled libvorbis && append pkg_requires "vorbisenc"
1950 echo "install prefix $prefix"
1951 echo "source path $source_path"
1952 echo "C compiler $cc"
1953 echo ".align is power-of-two $asmalign_pot"
1954 echo "ARCH $arch ($cpu)"
1955 if test "$build_suffix" != ""; then
1956 echo "build suffix $build_suffix"
1958 if test "$extra_version" != ""; then
1959 echo "version string suffix $extra_version"
1961 echo "big-endian ${bigendian-no}"
1962 if test $arch = "x86_32" -o $arch = "x86_64"; then
1963 echo "yasm ${yasm-no}"
1964 echo "MMX enabled ${mmx-no}"
1965 echo "CMOV enabled ${cmov-no}"
1966 echo "CMOV is fast ${fast_cmov-no}"
1967 echo "EBX available ${ebx_available-no}"
1968 echo "EBP available ${ebp_available-no}"
1970 if test $arch = "armv4l"; then
1971 echo "ARMv5TE enabled ${armv5te-no}"
1972 echo "ARMv6 enabled ${armv6-no}"
1973 echo "ARM VFP enabled ${armvfp-no}"
1974 echo "IWMMXT enabled ${iwmmxt-no}"
1975 echo "NEON enabled ${neon-no}"
1977 if test $arch = "mips"; then
1978 echo "MMI enabled ${mmi-no}"
1980 if test $arch = "powerpc"; then
1981 echo "AltiVec enabled ${altivec-no}"
1982 echo "dcbzl available ${dcbzl-no}"
1984 echo "gprof enabled ${gprof-no}"
1985 echo "debug symbols ${debug-no}"
1986 echo "strip symbols ${stripping-no}"
1987 echo "optimizations ${optimizations-no}"
1988 echo "static ${static-no}"
1989 echo "shared ${shared-no}"
1990 echo "postprocessing support ${postproc-no}"
1991 echo "software scaler enabled ${swscale-no}"
1992 echo "new filter support ${avfilter-no}"
1993 echo "filters using lavformat ${avfilter_lavf-no}"
1994 echo "video hooking ${vhook-no}"
1995 if enabled vhook; then
1996 echo "Imlib2 support ${imlib2-no}"
1997 echo "FreeType support ${freetype2-no}"
1999 echo "network support ${network-no}"
2000 if enabled network; then
2001 echo "IPv6 support ${ipv6-no}"
2003 echo "threading support ${thread_type-no}"
2004 echo "SDL support ${sdl-no}"
2005 if enabled sdl_too_old; then
2006 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
2008 echo "Sun medialib support ${mlib-no}"
2009 echo "AVISynth enabled ${avisynth-no}"
2010 echo "liba52 support ${liba52-no}"
2011 echo "liba52 dlopened ${liba52bin-no}"
2012 echo "libamr-nb support ${libamr_nb-no}"
2013 echo "libamr-wb support ${libamr_wb-no}"
2014 echo "libdc1394 support ${libdc1394-no}"
2015 echo "libdirac enabled ${libdirac-no}"
2016 echo "libfaac enabled ${libfaac-no}"
2017 echo "libfaad enabled ${libfaad-no}"
2018 echo "libfaad dlopened ${libfaadbin-no}"
2019 echo "libgsm enabled ${libgsm-no}"
2020 echo "libmp3lame enabled ${libmp3lame-no}"
2021 echo "libnut enabled ${libnut-no}"
2022 echo "libschroedinger enabled ${libschroedinger-no}"
2023 echo "libtheora enabled ${libtheora-no}"
2024 echo "libvorbis enabled ${libvorbis-no}"
2025 echo "libx264 enabled ${libx264-no}"
2026 echo "libxvid enabled ${libxvid-no}"
2027 echo "zlib enabled ${zlib-no}"
2028 echo "bzlib enabled ${bzlib-no}"
2029 echo
2031 for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
2032 echo "Enabled ${type}s:"
2033 eval list=\$$(toupper $type)_LIST
2034 for part in $list; do
2035 enabled $part && echo ${part%_*}
2036 done | sort | pr -3 -t
2037 echo
2038 done
2040 license="LGPL"
2041 if enabled nonfree; then
2042 license="unredistributable"
2043 elif enabled gpl; then
2044 license="GPL"
2047 echo "License: $license"
2049 echo "Creating config.mak and config.h..."
2051 echo "# Automatically generated by configure - do not modify!" > config.mak
2052 echo "/* Automatically generated by configure - do not modify! */" > $TMPH
2053 echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
2054 echo "#define FFMPEG_CONFIG_H" >> $TMPH
2055 echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
2057 echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
2058 echo "prefix=$prefix" >> config.mak
2059 echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
2060 echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
2061 echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
2062 echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
2063 echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
2064 echo "CC=$cc" >> config.mak
2065 echo "YASM=$yasmexe" >> config.mak
2066 echo "AR=$ar" >> config.mak
2067 echo "RANLIB=$ranlib" >> config.mak
2068 echo "LN_S=$ln_s" >> config.mak
2069 enabled stripping &&
2070 echo "STRIP=$strip" >> config.mak ||
2071 echo "STRIP=echo ignoring strip" >> config.mak
2073 echo "OPTFLAGS=$CFLAGS" >> config.mak
2074 echo "VHOOKCFLAGS=$VHOOKCFLAGS" >> config.mak
2075 echo "LDFLAGS=$LDFLAGS" >> config.mak
2076 echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
2077 echo "SHFLAGS=$SHFLAGS" >> config.mak
2078 echo "YASMFLAGS=$YASMFLAGS" >> config.mak
2079 echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
2080 echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
2081 echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
2082 echo "BUILD_STATIC=$static" >> config.mak
2083 echo "BUILDSUF=$build_suffix" >> config.mak
2084 echo "FULLNAME=$FULLNAME" >> config.mak
2085 echo "LIBPREF=$LIBPREF" >> config.mak
2086 echo "LIBSUF=$LIBSUF" >> config.mak
2087 echo "LIBNAME=$LIBNAME" >> config.mak
2088 echo "SLIBPREF=$SLIBPREF" >> config.mak
2089 echo "SLIBSUF=$SLIBSUF" >> config.mak
2090 echo "EXESUF=$EXESUF" >> config.mak
2091 echo "EXTRA_VERSION=$extra_version" >> config.mak
2092 echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
2094 if enabled bigendian; then
2095 echo "WORDS_BIGENDIAN=yes" >> config.mak
2096 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
2099 if enabled sdl; then
2100 echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
2101 echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
2103 if enabled texi2html; then
2104 echo "BUILD_DOC=yes" >> config.mak
2107 get_version(){
2108 name=$1
2109 file=$source_path/$2
2110 eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
2111 eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
2112 lcname=$(tolower $name)
2113 eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
2114 eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
2117 get_version LIBSWSCALE libswscale/swscale.h
2118 get_version LIBPOSTPROC libpostproc/postprocess.h
2119 get_version LIBAVCODEC libavcodec/avcodec.h
2120 get_version LIBAVDEVICE libavdevice/avdevice.h
2121 get_version LIBAVFORMAT libavformat/avformat.h
2122 get_version LIBAVUTIL libavutil/avutil.h
2123 get_version LIBAVFILTER libavfilter/avfilter.h
2125 if enabled shared; then
2126 echo "BUILD_SHARED=yes" >> config.mak
2127 echo "PIC=-fPIC -DPIC" >> config.mak
2128 echo "LIBTARGET=${LIBTARGET}" >> config.mak
2129 echo "SLIBNAME=${SLIBNAME}" >> config.mak
2130 echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
2131 echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
2132 echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
2133 echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
2134 echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
2135 echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
2137 echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
2138 echo "EXTRALIBS=$extralibs" >> config.mak
2140 print_config ARCH_ $TMPH config.mak $ARCH_LIST
2141 print_config HAVE_ $TMPH config.mak $HAVE_LIST
2142 print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
2143 $DECODER_LIST \
2144 $ENCODER_LIST \
2145 $PARSER_LIST \
2146 $BSF_LIST \
2147 $DEMUXER_LIST \
2148 $MUXER_LIST \
2149 $FILTER_LIST \
2150 $PROTOCOL_LIST \
2151 $INDEV_LIST \
2152 $OUTDEV_LIST \
2154 echo "#define restrict $_restrict" >> $TMPH
2156 if enabled small; then
2157 echo "#define av_always_inline" >> $TMPH
2160 echo "SRC_PATH=\"$source_path\"" >> config.mak
2161 echo "SRC_PATH_BARE=$source_path" >> config.mak
2162 echo "BUILD_ROOT=\"$PWD\"" >> config.mak
2164 # Apparently it's not possible to portably echo a backslash.
2165 enabled asmalign_pot &&
2166 printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
2167 printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
2169 echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
2171 echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
2173 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
2174 cmp -s $TMPH config.h &&
2175 echo "config.h is unchanged" ||
2176 mv -f $TMPH config.h
2178 rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
2180 # build tree in object directory if source path is different from current one
2181 if enabled source_path_used; then
2182 DIRS="\
2183 doc \
2184 libavcodec \
2185 libavcodec/alpha \
2186 libavcodec/armv4l \
2187 libavcodec/bfin \
2188 libavcodec/i386 \
2189 libavcodec/mlib \
2190 libavcodec/ppc \
2191 libavcodec/sh4 \
2192 libavcodec/sparc \
2193 libavdevice \
2194 libavfilter \
2195 libavformat \
2196 libavutil \
2197 libpostproc \
2198 libswscale \
2199 tests \
2200 tools \
2201 vhook \
2203 FILES="\
2204 Makefile \
2205 common.mak \
2206 subdir.mak \
2207 doc/texi2pod.pl \
2208 libavcodec/Makefile \
2209 libavdevice/Makefile \
2210 libavfilter/Makefile \
2211 libavformat/Makefile \
2212 libavutil/Makefile \
2213 libpostproc/Makefile \
2214 libswscale/Makefile \
2216 for dir in $DIRS ; do
2217 mkdir -p $dir
2218 done
2219 for f in $FILES ; do
2220 $ln_s "$source_path/$f" $f
2221 done
2225 # build pkg-config files
2227 pkgconfig_generate(){
2228 name=$1
2229 shortname=${name#lib}
2230 comment=$2
2231 version=$3
2232 libs=$4
2233 requires=$5
2234 cat <<EOF > $name/$name.pc
2235 prefix=$prefix
2236 exec_prefix=\${prefix}
2237 libdir=$libdir
2238 includedir=$incdir
2240 Name: $name
2241 Description: $comment
2242 Version: $version
2243 Requires: $(disabled shared && echo $requires)
2244 Requires.private: $(enabled shared && echo $requires)
2245 Conflicts:
2246 Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
2247 Libs.private: $(enabled shared && echo $libs)
2248 Cflags: -I\${includedir}
2250 cat <<EOF > $name/$name-uninstalled.pc
2251 prefix=
2252 exec_prefix=
2253 libdir=\${pcfiledir}
2254 includedir=\${pcfiledir}/..
2256 Name: $name
2257 Description: $comment
2258 Version: $version
2259 Requires: $requires
2260 Conflicts:
2261 Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
2262 Cflags: -I\${includedir}
2266 pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
2267 pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
2268 pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2269 pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
2270 enabled avfilter &&
2271 pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
2272 enabled postproc &&
2273 pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
2274 if enabled swscale; then
2275 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
2276 else
2277 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2278 apply libswscale/libswscale.pc sed s/^Libs:.*$/Libs:/