Merge branch 'mirror' into vdpau
[FFMpeg-mirror/ffmpeg-vdpau.git] / configure
blob4cd2efb74dc87dc6e58bb1f2a49fb193f2ffe356
1 #!/bin/sh
3 # FFmpeg configure script
5 # Copyright (c) 2000-2002 Fabrice Bellard
6 # Copyright (c) 2005-2008 Diego Biurrun
7 # Copyright (c) 2005-2008 Mans Rullgard
10 # Prevent locale nonsense from breaking basic text processing.
11 LC_ALL=C
12 export LC_ALL
14 # make sure we are running under a compatible shell
15 # try to make this part work with most shells
17 try_exec(){
18 echo "Trying shell $1"
19 type "$1" > /dev/null 2>&1 && exec "$@"
22 unset foo
23 (: ${foo%%bar}) 2> /dev/null
24 E1="$?"
26 (: ${foo?}) 2> /dev/null
27 E2="$?"
29 if test "$E1" != 0 || test "$E2" = 0; then
30 echo "Broken shell detected. Trying alternatives."
31 export FF_CONF_EXEC
32 if test "0$FF_CONF_EXEC" -lt 1; then
33 FF_CONF_EXEC=1
34 try_exec bash "$0" "$@"
36 if test "0$FF_CONF_EXEC" -lt 2; then
37 FF_CONF_EXEC=2
38 try_exec ksh "$0" "$@"
40 if test "0$FF_CONF_EXEC" -lt 3; then
41 FF_CONF_EXEC=3
42 try_exec /usr/xpg4/bin/sh "$0" "$@"
44 echo "No compatible shell script interpreter found."
45 echo "This configure script requires a POSIX-compatible shell"
46 echo "such as bash or ksh."
47 echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
48 echo "Instead, install a working POSIX-compatible shell."
49 echo "Disabling this configure test will create a broken FFmpeg."
50 if test "$BASH_VERSION" = '2.04.0(1)-release'; then
51 echo "This bash version ($BASH_VERSION) is broken on your platform."
52 echo "Upgrade to a later version if available."
54 exit 1
57 show_help(){
58 echo "Usage: configure [options]"
59 echo "Options: [defaults in brackets after descriptions]"
60 echo
61 echo "Standard options:"
62 echo " --help print this message"
63 echo " --logfile=FILE log tests and output to FILE [config.err]"
64 echo " --disable-logging do not log configure debug information"
65 echo " --prefix=PREFIX install in PREFIX [$prefix]"
66 echo " --bindir=DIR install binaries in DIR [PREFIX/bin]"
67 echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
68 echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]"
69 echo " --incdir=DIR install includes in DIR [PREFIX/include]"
70 echo " --mandir=DIR install man page in DIR [PREFIX/share/man]"
71 echo " --enable-static build static libraries [yes]"
72 echo " --disable-static do not build static libraries [no]"
73 echo " --enable-shared build shared libraries [no]"
74 echo " --disable-shared do not build shared libraries [yes]"
75 echo " --enable-gpl allow use of GPL code, the resulting libs"
76 echo " and binaries will be under GPL [no]"
77 echo " --enable-nonfree allow use of nonfree code, the resulting libs"
78 echo " and binaries will be unredistributable [no]"
79 echo " --enable-postproc enable GPLed postprocessing support [no]"
80 echo " --enable-swscale enable GPLed software scaler support [no]"
81 echo " --enable-avfilter video filter support (replaces vhook) [no]"
82 echo " --enable-avfilter-lavf video filters dependent on avformat [no]"
83 echo " --disable-vhook disable video hooking support"
84 echo " --enable-beosthreads use BeOS threads [no]"
85 echo " --enable-os2threads use OS/2 threads [no]"
86 echo " --enable-pthreads use pthreads [no]"
87 echo " --enable-w32threads use Win32 threads [no]"
88 echo " --enable-x11grab enable X11 grabbing [no]"
89 echo
90 echo "External library support:"
91 echo " --enable-mlib enable Sun medialib [no]"
92 echo " --enable-avisynth enable reading of AVISynth script files [no]"
93 echo " --enable-bzlib enable bzlib [no]"
94 echo " --enable-libamr-nb enable libamr-nb floating point audio codec"
95 echo " --enable-libamr-wb enable libamr-wb floating point audio codec"
96 echo " --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394"
97 echo " and libraw1394 [no]"
98 echo " --enable-libdirac enable Dirac support via libdirac [no]"
99 echo " --enable-libfaac enable FAAC support via libfaac [no]"
100 echo " --enable-libfaad enable FAAD support via libfaad [no]"
101 echo " --enable-libfaadbin open libfaad.so.0 at runtime [no]"
102 echo " --enable-libgsm enable GSM support via libgsm [no]"
103 echo " --enable-libmp3lame enable MP3 encoding via libmp3lame [no]"
104 echo " --enable-libnut enable NUT (de)muxing via libnut,"
105 echo " native (de)muxer exists [no]"
106 echo " --enable-libschroedinger enable Dirac support via libschroedinger [no]"
107 echo " --enable-libspeex enable Speex decoding via libspeex [no]"
108 echo " --enable-libtheora enable Theora encoding via libtheora [no]"
109 echo " --enable-libvorbis enable Vorbis encoding via libvorbis,"
110 echo " native implementation exists [no]"
111 echo " --enable-libx264 enable H.264 encoding via x264 [no]"
112 echo " --enable-libxvid enable Xvid encoding via xvidcore,"
113 echo " native MPEG-4/Xvid encoder exists [no]"
114 echo " --enable-zlib enable zlib [no]"
115 echo ""
116 echo "Advanced options (experts only):"
117 echo " --source-path=PATH path to source code [$source_path]"
118 echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
119 echo " --enable-cross-compile assume a cross-compiler is used"
120 echo " --target-os=OS compiler targets OS [$target_os]"
121 echo " --target-exec=CMD command to run executables on target"
122 echo " --target-path=DIR path to view of build directory on target"
123 echo " --cc=CC use C compiler CC [$cc]"
124 echo " --host-cc=HOSTCC use host C compiler HOSTCC"
125 echo " --host-cflags=HCFLAGS use HCFLAGS when compiling for host"
126 echo " --host-ldflags=HLDFLAGS use HLDFLAGS when linking for host"
127 echo " --host-libs=HLIBS use libs HLIBS when linking for host"
128 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
129 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
130 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
131 echo " --extra-version=STRING version string suffix []"
132 echo " --build-suffix=SUFFIX library name suffix []"
133 echo " --arch=ARCH select architecture [$arch]"
134 echo " --cpu=CPU select the minimum required CPU (affects"
135 echo " instruction selection, may crash on older CPUs)"
136 echo " --enable-powerpc-perf enable performance report on PPC"
137 echo " (requires enabling PMC)"
138 echo " --disable-altivec disable AltiVec optimizations"
139 echo " --disable-mmx disable MMX optimizations"
140 echo " --disable-mmx2 disable MMX2 optimizations"
141 echo " --disable-ssse3 disable SSSE3 optimizations"
142 echo " --disable-armv5te disable armv5te optimizations"
143 echo " --disable-armv6 disable armv6 optimizations"
144 echo " --disable-armvfp disable ARM VFP optimizations"
145 echo " --disable-iwmmxt disable iwmmxt optimizations"
146 echo " --disable-mmi disable MMI optimizations"
147 echo " --disable-neon disable neon optimizations"
148 echo " --disable-vis disable VIS optimizations"
149 echo " --disable-network disable network support [no]"
150 echo " --disable-ipv6 disable IPv6 support [no]"
151 echo " --disable-mpegaudio-hp faster (but less accurate)"
152 echo " MPEG audio decoding [no]"
153 echo " --disable-fft disable FFT code"
154 echo " --disable-golomb disable Golomb code"
155 echo " --disable-mdct disable MDCT code"
156 echo " --enable-gray enable full grayscale support (slower color)"
157 echo " --disable-ffmpeg disable ffmpeg build"
158 echo " --disable-ffplay disable ffplay build"
159 echo " --disable-ffserver disable ffserver build"
160 echo " --enable-small optimize for size instead of speed"
161 echo " --enable-hardcoded-tables use hardcoded tables instead of runtime generation"
162 echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
163 echo " --enable-beos-netserver enable BeOS netserver"
164 echo " --disable-encoder=NAME disable encoder NAME"
165 echo " --enable-encoder=NAME enable encoder NAME"
166 echo " --disable-encoders disable all encoders"
167 echo " --disable-decoder=NAME disable decoder NAME"
168 echo " --enable-decoder=NAME enable decoder NAME"
169 echo " --disable-decoders disable all decoders"
170 echo " --disable-muxer=NAME disable muxer NAME"
171 echo " --enable-muxer=NAME enable muxer NAME"
172 echo " --disable-muxers disable all muxers"
173 echo " --disable-demuxer=NAME disable demuxer NAME"
174 echo " --enable-demuxer=NAME enable demuxer NAME"
175 echo " --disable-demuxers disable all demuxers"
176 echo " --enable-parser=NAME enable parser NAME"
177 echo " --disable-parser=NAME disable parser NAME"
178 echo " --disable-parsers disable all parsers"
179 echo " --enable-bsf=NAME enable bitstream filter NAME"
180 echo " --disable-bsf=NAME disable bitstream filter NAME"
181 echo " --disable-bsfs disable all bitstream filters"
182 echo " --enable-protocol=NAME enable protocol NAME"
183 echo " --disable-protocol=NAME disable protocol NAME"
184 echo " --disable-protocols disable all protocols"
185 echo " --disable-indevs disable input devices"
186 echo " --disable-outdevs disable output devices"
187 echo " --disable-devices disable all devices"
188 echo " --enable-filter=NAME enable filter NAME"
189 echo " --disable-filter=NAME disable filter NAME"
190 echo " --disable-filters disable all filters"
191 echo " --list-decoders show all available decoders"
192 echo " --list-encoders show all available encoders"
193 echo " --list-muxers show all available muxers"
194 echo " --list-demuxers show all available demuxers"
195 echo " --list-parsers show all available parsers"
196 echo " --list-protocols show all available protocols"
197 echo " --list-bsfs show all available bitstream filters"
198 echo " --list-indevs show all available input devices"
199 echo " --list-outdevs show all available output devices"
200 echo " --list-filters show all available filters"
201 echo
202 echo "Developer options (useful when working on FFmpeg itself):"
203 echo " --disable-debug disable debugging symbols"
204 echo " --enable-debug=LEVEL set the debug level [$debuglevel]"
205 echo " --enable-gprof enable profiling with gprof [$gprof]"
206 echo " --disable-optimizations disable compiler optimizations"
207 echo " --enable-extra-warnings enable more compiler warnings"
208 echo " --disable-stripping disable stripping of executables and shared libraries"
209 echo ""
210 echo "NOTE: Object files are built at the place where configure is launched."
211 exit 0
214 log(){
215 echo "$@" >> $logfile
218 log_file(){
219 log BEGIN $1
220 pr -n -t $1 >> $logfile
221 log END $1
224 echolog(){
225 log "$@"
226 echo "$@"
229 die(){
230 echolog "$@"
231 cat <<EOF
232 If you think configure made a mistake, make sure you are using the latest
233 version from SVN. If the latest version fails, report the problem to the
234 ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
236 if disabled logging; then
237 cat <<EOF
238 Rerun configure with logging enabled (do not use --disable-logging), and
239 include the log this produces with your report.
241 else
242 cat <<EOF
243 Include the log file "$logfile" produced by configure as this will help
244 solving the problem.
247 rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
248 exit 1
251 # Avoid locale weirdness, besides we really just want to translate ASCII.
252 toupper(){
253 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
256 tolower(){
257 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
260 set_all(){
261 value=$1
262 shift
263 for var in $*; do
264 eval $var=$value
265 done
268 set_weak(){
269 value=$1
270 shift
271 for var; do
272 eval : \${$var:=$value}
273 done
276 pushvar(){
277 for var in $*; do
278 eval level=\${${var}_level:=0}
279 eval ${var}_${level}="\$$var"
280 eval ${var}_level=$(($level+1))
281 done
284 popvar(){
285 for var in $*; do
286 eval level=\${${var}_level:-0}
287 test $level = 0 && continue
288 eval level=$(($level-1))
289 eval $var="\${${var}_${level}}"
290 eval ${var}_level=$level
291 eval unset ${var}_${level}
292 done
295 enable(){
296 set_all yes $*
299 disable(){
300 set_all no $*
303 enable_weak(){
304 set_weak yes $*
307 disable_weak(){
308 set_weak no $*
311 do_enable_deep(){
312 for var; do
313 enabled $var && continue
314 eval sel="\$${var}_select"
315 eval sgs="\$${var}_suggest"
316 pushvar var sgs
317 enable_deep $sel
318 popvar sgs
319 enable_deep_weak $sgs
320 popvar var
321 done
324 enable_deep(){
325 do_enable_deep $*
326 enable $*
329 enable_deep_weak(){
330 do_enable_deep $*
331 enable_weak $*
334 enabled(){
335 test "${1#!}" = "$1" && op== || op=!=
336 eval test "x\$${1#!}" $op "xyes"
339 disabled(){
340 test "${1#!}" = "$1" && op== || op=!=
341 eval test "x\$${1#!}" $op "xno"
344 enabled_all(){
345 for opt; do
346 enabled $opt || return 1
347 done
350 disabled_all(){
351 for opt; do
352 disabled $opt || return 1
353 done
356 enabled_any(){
357 for opt; do
358 enabled $opt && return 0
359 done
362 disabled_any(){
363 for opt; do
364 disabled $opt && return 0
365 done
366 return 1
369 set_default(){
370 for opt; do
371 eval : \${$opt:=\$${opt}_default}
372 done
375 is_in(){
376 value=$1
377 shift
378 for var in $*; do
379 [ $var = $value ] && return 0
380 done
381 return 1
384 check_deps(){
385 for cfg; do
386 cfg="${cfg#!}"
387 enabled ${cfg}_checking && die "Circular dependency for $cfg."
388 disabled ${cfg}_checking && continue
389 enable ${cfg}_checking
391 eval dep_all="\$${cfg}_deps"
392 eval dep_any="\$${cfg}_deps_any"
393 eval dep_sel="\$${cfg}_select"
394 eval dep_sgs="\$${cfg}_suggest"
396 pushvar cfg dep_all dep_any dep_sel dep_sgs
397 check_deps $dep_all $dep_any $dep_sel $dep_sgs
398 popvar cfg dep_all dep_any dep_sel dep_sgs
400 enabled_all $dep_all || disable $cfg
401 enabled_any $dep_any || disable $cfg
402 disabled_any $dep_sel && disable $cfg
404 if enabled $cfg; then
405 eval dep_extralibs="\$${cfg}_extralibs"
406 test -n "$dep_extralibs" && add_extralibs $dep_extralibs
407 enable_deep $dep_sel
408 enable_deep_weak $dep_sgs
411 disable ${cfg}_checking
412 done
415 print_config(){
416 pfx=$1
417 header=$2
418 makefile=$3
419 shift 3
420 for cfg; do
421 ucname="`toupper $cfg`"
422 if enabled $cfg; then
423 echo "#define ${pfx}${ucname} 1" >> $header
424 echo "#define ENABLE_${ucname} 1" >> $header
425 echo "${pfx}${ucname}=yes" >> $makefile
426 else
427 echo "#define ENABLE_${ucname} 0" >> $header
429 done
432 flags_saved(){
433 (: ${SAVE_CFLAGS?}) 2> /dev/null
436 save_flags(){
437 flags_saved && return
438 SAVE_CFLAGS="$CFLAGS"
439 SAVE_LDFLAGS="$LDFLAGS"
440 SAVE_extralibs="$extralibs"
443 restore_flags(){
444 flags_saved || return
445 CFLAGS="$SAVE_CFLAGS"
446 LDFLAGS="$SAVE_LDFLAGS"
447 extralibs="$SAVE_extralibs"
448 unset SAVE_CFLAGS
449 unset SAVE_LDFLAGS
450 unset SAVE_extralibs
453 temp_cflags(){
454 save_flags
455 CFLAGS="$CFLAGS $*"
458 temp_ldflags(){
459 save_flags
460 LDFLAGS="$LDFLAGS $*"
463 temp_extralibs(){
464 save_flags
465 extralibs="$extralibs $*"
468 append(){
469 var=$1
470 shift
471 flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
472 eval "$var=\"\$$var $*\""
475 add_cflags(){
476 append CFLAGS "$@"
479 add_ldflags(){
480 append LDFLAGS "$@"
483 add_extralibs(){
484 append extralibs "$@"
487 check_cmd(){
488 log "$@"
489 "$@" >> $logfile 2>&1
492 check_cc(){
493 log check_cc "$@"
494 cat > $TMPC
495 log_file $TMPC
496 check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
499 check_cpp(){
500 log check_cpp "$@"
501 cat > $TMPC
502 log_file $TMPC
503 check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
506 check_asm(){
507 log check_asm "$@"
508 name="$1"
509 asm="$2"
510 shift 2
511 check_cc "$@" <<EOF && enable $name || disable $name
512 int foo(void){ __asm__ volatile($asm); }
516 check_yasm(){
517 log check_yasm "$@"
518 echo "$1" > $TMPS
519 log_file $TMPS
520 shift 1
521 check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
524 check_ld(){
525 log check_ld "$@"
526 check_cc || return
527 flags=''
528 libs=''
529 for f; do
530 test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
531 done
532 check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
535 check_cflags(){
536 log check_cflags "$@"
537 check_cc "$@" <<EOF && add_cflags "$@"
538 int x;
542 check_ldflags(){
543 log check_ldflags "$@"
544 check_ld "$@" <<EOF && add_ldflags "$@"
545 int main(void){ return 0; }
549 check_header(){
550 log check_header "$@"
551 header=$1
552 shift
553 var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
554 disable $var
555 check_cpp "$@" <<EOF && enable $var
556 #include <$header>
557 int x;
561 check_func(){
562 log check_func "$@"
563 func=$1
564 shift
565 disable $func
566 check_ld "$@" <<EOF && enable $func
567 extern int $func();
568 int main(void){ $func(); }
572 check_func_headers(){
573 log check_func_headers "$@"
574 headers=$1
575 func=$2
576 shift 2
577 disable $func
578 incs=""
579 for hdr in $headers; do
580 incs="$incs
581 #include <$hdr>"
582 done
583 check_ld "$@" <<EOF && enable $func
584 $incs
585 int main(int argc, char **argv){
586 (void) $func;
587 return 0;
592 check_cpp_condition(){
593 log check_cpp_condition "$@"
594 header=$1
595 condition=$2
596 check_cpp <<EOF
597 #include <$header>
598 #if !($condition)
599 #error "unsatisfied condition: $condition"
600 #endif
604 check_lib(){
605 log check_lib "$@"
606 header="$1"
607 func="$2"
608 shift 2
609 temp_extralibs "$@"
610 check_header $header && check_func $func && add_extralibs "$@"
611 err=$?
612 restore_flags
613 return $err
616 check_lib2(){
617 log check_lib2 "$@"
618 headers="$1"
619 func="$2"
620 shift 2
621 temp_extralibs "$@"
622 check_func_headers "$headers" $func && add_extralibs "$@"
623 err=$?
624 restore_flags
625 return $err
628 check_exec(){
629 check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
632 check_exec_crash(){
633 code=`cat`
635 # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
636 # are safe but may not be available everywhere. Thus we use
637 # raise(SIGTERM) instead. The check is run in a subshell so we
638 # can redirect the "Terminated" message from the shell. SIGBUS
639 # is not defined by standard C so it is used conditionally.
641 (check_exec "$@") >> $logfile 2>&1 <<EOF
642 #include <signal.h>
643 static void sighandler(int sig){
644 raise(SIGTERM);
646 int main(void){
647 signal(SIGILL, sighandler);
648 signal(SIGFPE, sighandler);
649 signal(SIGSEGV, sighandler);
650 #ifdef SIGBUS
651 signal(SIGBUS, sighandler);
652 #endif
653 { $code }
658 check_type(){
659 log check_type "$@"
660 headers=$1
661 type=$2
662 shift 2
663 disable $type
664 incs=""
665 for hdr in $headers; do
666 incs="$incs
667 #include <$hdr>"
668 done
669 check_cc "$@" <<EOF && enable $type
670 $incs
671 $type v;
675 require(){
676 name="$1"
677 header="$2"
678 func="$3"
679 shift 3
680 check_lib $header $func "$@" || die "ERROR: $name not found"
683 require2(){
684 name="$1"
685 headers="$2"
686 func="$3"
687 shift 3
688 check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
691 check_foo_config(){
692 cfg=$1
693 pkg=$2
694 header=$3
695 func=$4
696 shift 4
697 disable $cfg
698 check_cmd ${pkg}-config --version
699 err=$?
700 if test "$err" = 0; then
701 temp_cflags `${pkg}-config --cflags`
702 temp_extralibs `${pkg}-config --libs`
703 check_lib "$@" $header $func && enable $cfg
705 return $err
708 apply(){
709 file=$1
710 shift
711 "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
714 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
715 # system-dependent things.
717 COMPONENT_LIST="
718 bsfs
719 decoders
720 demuxers
721 encoders
722 filters
723 indevs
724 muxers
725 outdevs
726 parsers
727 protocols
730 CONFIG_LIST="
731 $COMPONENT_LIST
732 avfilter
733 avfilter_lavf
734 avisynth
735 beos_netserver
736 bzlib
737 ffmpeg
738 ffplay
739 ffserver
741 golomb
743 gprof
744 gray
745 hardcoded_tables
746 ipv6
747 libamr_nb
748 libamr_wb
749 libdc1394
750 libdirac
751 libfaac
752 libfaad
753 libfaadbin
754 libgsm
755 libmp3lame
756 libnut
757 libschroedinger
758 libspeex
759 libtheora
760 libvorbis
761 libx264
762 libxvid
763 mdct
764 memalign_hack
765 mlib
766 mpegaudio_hp
767 network
768 nonfree
769 postproc
770 powerpc_perf
771 small
772 swscale
773 vhook
774 x11grab
775 zlib
778 THREADS_LIST='
779 beosthreads
780 os2threads
781 pthreads
782 w32threads
785 ARCH_LIST='
786 alpha
787 armv4l
788 bfin
789 ia64
790 m68k
791 mips
792 parisc
793 powerpc
794 s390
796 sparc
797 sparc64
799 x86_32
800 x86_64
803 ARCH_EXT_LIST='
804 altivec
805 armv5te
806 armv6
807 armvfp
808 iwmmxt
811 mmx2
812 neon
813 ssse3
814 vdpau
818 HAVE_LIST="
819 $ARCH_EXT_LIST
820 $THREADS_LIST
821 altivec_h
822 arpa_inet_h
823 bswap
824 closesocket
825 cmov
826 conio_h
827 dcbzl
828 dev_bktr_ioctl_bt848_h
829 dev_bktr_ioctl_meteor_h
830 dev_ic_bt8xx_h
831 dev_video_meteor_ioctl_meteor_h
832 dev_video_bktr_ioctl_bt848_h
833 dlfcn_h
834 dlopen
835 dos_paths
836 ebp_available
837 ebx_available
838 fast_64bit
839 fast_cmov
840 fast_unaligned
841 fork
842 freetype2
843 gethrtime
844 GetProcessTimes
845 getrusage
846 imlib2
847 inet_aton
848 inline_asm
849 libdc1394_1
850 libdc1394_2
851 llrint
852 lrint
853 lrintf
854 machine_ioctl_bt848_h
855 machine_ioctl_meteor_h
856 malloc_h
857 memalign
858 mkstemp
860 ppc64
861 round
862 roundf
864 sdl_video_size
865 socklen_t
866 soundcard_h
867 poll_h
868 sys_mman_h
869 sys_resource_h
870 sys_select_h
871 sys_soundcard_h
872 sys_videoio_h
873 termios_h
874 threads
875 winsock2_h
876 yasm
879 # options emitted with CONFIG_ prefix but not available on command line
880 CONFIG_EXTRA="
881 fft_mmx
882 oldscaler
885 CMDLINE_SELECT="
886 $ARCH_EXT_LIST
887 $CONFIG_LIST
888 $THREADS_LIST
889 cross_compile
890 debug
891 extra_warnings
892 logging
893 optimizations
894 shared
895 static
896 stripping
899 PATHS_LIST='
900 bindir
901 incdir
902 libdir
903 mandir
904 prefix
905 shlibdir
908 CMDLINE_SET="
909 $PATHS_LIST
910 arch
911 build_suffix
914 cross_prefix
915 extra_version
916 host_cc
917 host_cflags
918 host_ldflags
919 host_libs
920 logfile
921 source_path
922 target_exec
923 target_os
924 target_path
927 # code dependency declarations
929 # architecture extensions
930 altivec_deps="powerpc"
931 armv5te_deps="armv4l"
932 armv6_deps="armv4l"
933 armvfp_deps="armv4l"
934 iwmmxt_deps="armv4l"
935 mmi_deps="mips"
936 mmx_deps="x86"
937 mmx2_deps="x86 mmx"
938 neon_deps="armv4l"
939 ssse3_deps="x86"
940 vis_deps="sparc"
942 # common features
943 fft_suggest="fft_mmx"
944 fft_mmx_deps="mmx yasm"
945 oldscaler_deps="!swscale"
947 # decoders / encoders
948 aac_decoder_select="fft mdct"
949 ac3_decoder_deps="gpl"
950 ac3_decoder_select="fft mdct"
951 atrac3_decoder_select="fft mdct"
952 cavs_decoder_select="golomb"
953 cook_decoder_select="fft mdct"
954 cscd_decoder_suggest="zlib"
955 dca_decoder_select="fft mdct"
956 dxa_decoder_select="zlib"
957 eac3_decoder_deps="gpl"
958 eac3_decoder_select="fft mdct"
959 ffv1_decoder_select="golomb"
960 flac_decoder_select="golomb"
961 flac_encoder_select="golomb"
962 flashsv_decoder_select="zlib"
963 flashsv_encoder_select="zlib"
964 h264_decoder_select="golomb"
965 imc_decoder_select="fft mdct"
966 jpegls_decoder_select="golomb"
967 jpegls_encoder_select="golomb"
968 loco_decoder_select="golomb"
969 mpeg_xvmc_decoder_deps="xvmc"
970 nellymoser_decoder_select="fft mdct"
971 nellymoser_encoder_select="fft mdct"
972 png_decoder_select="zlib"
973 png_encoder_select="zlib"
974 qdm2_decoder_select="fft mdct"
975 shorten_decoder_select="golomb"
976 sonic_decoder_select="golomb"
977 sonic_encoder_select="golomb"
978 sonic_ls_encoder_select="golomb"
979 svq3_decoder_select="golomb"
980 svq3_decoder_suggest="zlib"
981 tiff_decoder_suggest="zlib"
982 tiff_encoder_suggest="zlib"
983 tscc_decoder_select="zlib"
984 vorbis_decoder_select="fft mdct"
985 vorbis_encoder_select="fft mdct"
986 wmav1_decoder_select="fft mdct"
987 wmav1_encoder_select="fft mdct"
988 wmav2_decoder_select="fft mdct"
989 wmav2_encoder_select="fft mdct"
990 zlib_decoder_select="zlib"
991 zlib_encoder_select="zlib"
992 zmbv_decoder_select="zlib"
993 zmbv_encoder_select="zlib"
995 # external libraries
996 h264_vdpau_decoder_deps="vdapu"
997 libamr_nb_decoder_deps="libamr_nb"
998 libamr_nb_encoder_deps="libamr_nb"
999 libamr_wb_decoder_deps="libamr_wb"
1000 libamr_wb_encoder_deps="libamr_wb"
1001 libdirac_decoder_deps="libdirac !libschroedinger"
1002 libdirac_encoder_deps="libdirac"
1003 libfaac_encoder_deps="libfaac"
1004 libfaad_decoder_deps="libfaad"
1005 libfaadbin_decoder_extralibs='$ldl'
1006 libgsm_decoder_deps="libgsm"
1007 libgsm_encoder_deps="libgsm"
1008 libgsm_ms_decoder_deps="libgsm"
1009 libgsm_ms_encoder_deps="libgsm"
1010 libmp3lame_encoder_deps="libmp3lame"
1011 libschroedinger_decoder_deps="libschroedinger"
1012 libschroedinger_encoder_deps="libschroedinger"
1013 libspeex_decoder_deps="libspeex"
1014 libtheora_encoder_deps="libtheora"
1015 libvorbis_encoder_deps="libvorbis"
1016 libx264_encoder_deps="libx264"
1017 libxvid_encoder_deps="libxvid"
1018 mpeg4aac_decoder_deps="libfaad"
1019 mpeg_vdpau_decoder_deps="vdapu"
1020 wmv3_vdpau_decoder_deps="vdapu"
1021 vc1_vdpau_decoder_deps="vdapu"
1023 # demuxers / muxers
1024 ac3_demuxer_deps="ac3_parser"
1025 audio_beos_demuxer_deps="audio_beos"
1026 audio_beos_demuxer_extralibs="-lmedia -lbe"
1027 audio_beos_muxer_deps="audio_beos"
1028 audio_beos_muxer_extralibs="-lmedia -lbe"
1029 avisynth_demuxer_deps="avisynth"
1030 bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
1031 dirac_demuxer_deps="dirac_parser"
1032 dv1394_demuxer_deps="dv1394 dv_demuxer"
1033 libdc1394_demuxer_deps="libdc1394"
1034 libnut_demuxer_deps="libnut"
1035 libnut_muxer_deps="libnut"
1036 matroska_demuxer_suggest="zlib bzlib"
1037 mov_demuxer_suggest="zlib"
1038 mp3_demuxer_deps="mpegaudio_parser"
1039 oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
1040 oss_muxer_deps_any="soundcard_h sys_soundcard_h"
1041 redir_demuxer_deps="network"
1042 rtp_muxer_deps="network rtp_protocol"
1043 rtsp_demuxer_deps="sdp_demuxer"
1044 sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
1045 v4l_demuxer_deps="linux_videodev_h"
1046 v4l2_demuxer_deps_any="linux_videodev2_h sys_videoio_h"
1047 vfwcap_demuxer_deps="capCreateCaptureWindow"
1048 vfwcap_demuxer_extralibs="-lvfw32"
1049 x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
1050 x11_grab_device_demuxer_extralibs="-lX11 -lXext"
1052 # protocols
1053 http_protocol_deps="network"
1054 rtp_protocol_deps="udp_protocol"
1055 tcp_protocol_deps="network"
1056 udp_protocol_deps="network"
1058 # filters
1059 movie_filter_deps="avfilter_lavf"
1061 # programs
1062 ffplay_deps="sdl"
1063 ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
1064 ffserver_extralibs='$ldl'
1065 vhook_extralibs='$ldl'
1068 # default parameters
1070 logfile="config.err"
1072 # installation paths
1073 prefix_default="/usr/local"
1074 bindir_default='${prefix}/bin'
1075 incdir_default='${prefix}/include'
1076 libdir_default='${prefix}/lib'
1077 mandir_default='${prefix}/share/man'
1078 shlibdir_default="$libdir_default"
1080 # toolchain
1081 cc_default="gcc"
1082 host_cc_default="gcc"
1083 yasmexe="yasm"
1084 ar="ar"
1085 nm="nm"
1086 ranlib="ranlib"
1087 strip="strip"
1088 asmalign_pot="unknown"
1089 ln_s="ln -sf"
1090 objformat="elf"
1092 # machine
1093 arch=`uname -m`
1094 cpu="generic"
1096 # OS
1097 target_os=$(tolower $(uname -s))
1099 # configurable options
1100 enable debug
1101 enable ffmpeg
1102 enable ffplay
1103 enable ffserver
1104 enable ipv6
1105 enable mpegaudio_hp
1106 enable network
1107 enable oldscaler
1108 enable optimizations
1109 enable protocols
1110 enable static
1111 enable stripping
1112 vhook="default"
1114 # build settings
1115 add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
1116 SHFLAGS='-shared -Wl,-soname,$$(@F)'
1117 VHOOKSHFLAGS='$(SHFLAGS)'
1118 FFSERVERLDFLAGS=-Wl,-E
1119 LIBPREF="lib"
1120 LIBSUF=".a"
1121 FULLNAME='$(NAME)$(BUILDSUF)'
1122 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
1123 SLIBPREF="lib"
1124 SLIBSUF=".so"
1125 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
1126 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
1127 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
1128 LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
1130 host_cflags='-O3 -g -Wall'
1131 host_libs='-lm'
1133 target_path='.'
1135 # gcc stupidly only outputs the basename of targets with -MM, but we need the
1136 # full relative path for objects in subdirectories for non-recursive Make.
1137 DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," -e "s,\\([[:space:]]\\)\\(version\\.h\\),\\1\$$(BUILD_ROOT_REL)/\\2,"'
1139 # find source path
1140 source_path="`dirname \"$0\"`"
1141 enable source_path_used
1142 if test -z "$source_path" -o "$source_path" = "." ; then
1143 source_path="`pwd`"
1144 disable source_path_used
1145 else
1146 source_path="`cd \"$source_path\"; pwd`"
1147 echo "$source_path" | grep -q '[[:blank:]]' &&
1148 die "Out of tree builds are impossible with whitespace in source path."
1151 FFMPEG_CONFIGURATION="$@"
1153 find_things(){
1154 thing=$1
1155 pattern=$2
1156 file=$source_path/$3
1157 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
1160 ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
1161 DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
1162 PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
1163 BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
1164 MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
1165 DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
1166 OUTDEV_LIST=$(find_things muxer _MUX libavdevice/alldevices.c)
1167 INDEV_LIST=$(find_things demuxer DEMUX libavdevice/alldevices.c)
1168 PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
1169 FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
1171 enable $ARCH_EXT_LIST \
1172 $DECODER_LIST \
1173 $ENCODER_LIST \
1174 $PARSER_LIST \
1175 $BSF_LIST \
1176 $DEMUXER_LIST \
1177 $MUXER_LIST \
1178 $FILTER_LIST \
1179 $PROTOCOL_LIST \
1180 $INDEV_LIST \
1181 $OUTDEV_LIST \
1183 die_unknown(){
1184 echo "Unknown option \"$1\"."
1185 echo "See $0 --help for available options."
1186 exit 1
1189 show_list() {
1190 suffix=_$1
1191 shift
1192 echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
1193 exit 0
1196 for opt do
1197 optval="${opt#*=}"
1198 case "$opt" in
1199 --extra-cflags=*) add_cflags "$optval"
1201 --extra-ldflags=*) add_ldflags "$optval"
1203 --extra-libs=*) add_extralibs "$optval"
1205 --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
1207 --enable-debug=*) debuglevel="$optval"
1209 --enable-*=*|--disable-*=*)
1210 eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
1211 case "$thing" in
1212 encoder|decoder|muxer|demuxer|parser|bsf|protocol|filter) $action ${optval}_${thing} ;;
1213 *) die_unknown "$opt" ;;
1214 esac
1216 --enable-?*|--disable-?*)
1217 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
1218 if is_in $option $COMPONENT_LIST; then
1219 eval $action \$$(toupper ${option%s})_LIST
1220 elif is_in $option $CMDLINE_SELECT; then
1221 $action $option
1222 else
1223 die_unknown $opt
1226 --list-*)
1227 NAME="${opt#--list-}"
1228 is_in $NAME $COMPONENT_LIST || die_unknown $opt
1229 NAME=${NAME%s}
1230 eval show_list $NAME \$$(toupper $NAME)_LIST
1232 --help|-h) show_help
1235 optname="${opt%%=*}"
1236 optname="${optname#--}"
1237 optname=$(echo "$optname" | sed 's/-/_/g')
1238 is_in $optname $CMDLINE_SET || die_unknown $opt
1239 eval $optname='$optval'
1241 esac
1242 done
1244 disabled logging && logfile=/dev/null
1246 echo "# $0 $@" > $logfile
1247 set >> $logfile
1249 test -n "$cross_prefix" && enable cross_compile
1251 cc_default="${cross_prefix}${cc_default}"
1252 yasmexe="${cross_prefix}${yasmexe}"
1253 ar="${cross_prefix}${ar}"
1254 nm="${cross_prefix}${nm}"
1255 ranlib="${cross_prefix}${ranlib}"
1256 strip="${cross_prefix}${strip}"
1258 set_default cc
1259 enabled cross_compile || host_cc_default=$cc
1260 set_default host_cc
1262 # set temporary file name
1263 if test ! -z "$TMPDIR" ; then
1264 TMPDIR1="${TMPDIR}"
1265 elif test ! -z "$TEMPDIR" ; then
1266 TMPDIR1="${TEMPDIR}"
1267 else
1268 TMPDIR1="/tmp"
1271 TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
1272 TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
1273 TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
1274 TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
1275 TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
1276 TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
1278 check_cflags -std=c99
1280 case "$arch" in
1281 i386|i486|i586|i686|i86pc|BePC)
1282 arch="x86_32"
1283 enable fast_unaligned
1285 x86_64|amd64)
1286 arch="x86_32"
1287 enable cmov
1288 enable fast_cmov
1289 enable fast_unaligned
1290 check_cc <<EOF && enable fast_64bit && arch="x86_64"
1291 int test[sizeof(char*) - 7];
1294 # armv4l is a subset of armv[567]*l
1295 arm|armv[4567]*l)
1296 arch="armv4l"
1298 alpha)
1299 arch="alpha"
1300 enable fast_64bit
1302 "Power Macintosh"|ppc|powerpc)
1303 arch="powerpc"
1304 enable fast_unaligned
1306 ppc64)
1307 arch="powerpc"
1308 enable fast_64bit
1309 enable fast_unaligned
1311 mips|mipsel|IP*)
1312 arch="mips"
1314 sun4u|sparc64)
1315 arch="sparc64"
1316 enable fast_64bit
1318 sparc)
1319 arch="sparc"
1321 sh4)
1322 arch="sh4"
1324 parisc)
1325 arch="parisc"
1327 parisc64)
1328 arch="parisc"
1329 enable fast_64bit
1331 s390|s390x)
1332 arch="s390"
1334 m68k)
1335 arch="m68k"
1337 ia64)
1338 arch="ia64"
1339 enable fast_64bit
1341 bfin)
1342 arch="bfin"
1345 arch="unknown"
1347 esac
1349 enable $arch
1350 enabled_any x86_32 x86_64 && enable x86
1351 enabled sparc64 && enable sparc
1353 # OS specific
1354 case $target_os in
1355 beos|haiku|zeta)
1356 prefix_default="$HOME/config"
1357 # helps building libavcodec
1358 add_cflags "-DPIC -fomit-frame-pointer"
1359 # 3 gcc releases known for BeOS, each with ugly bugs
1360 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
1361 case "$gcc_version" in
1362 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
1363 disable mmx
1365 *20010315*) echo "BeBits gcc"
1366 add_cflags "-fno-expensive-optimizations"
1368 esac
1369 SHFLAGS=-nostart
1370 # enable BeOS things
1371 enable audio_beos
1372 # no need for libm, but the inet stuff
1373 # Check for BONE
1374 # XXX: actually should check for NOT net_server
1375 if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
1376 network_extralibs="-lbind -lsocket"
1377 else
1378 enable beos_netserver
1379 network_extralibs="-lnet"
1380 fi ;;
1381 sunos)
1382 FFSERVERLDFLAGS=""
1383 SHFLAGS='-shared -Wl,-h,$$(@F)'
1384 network_extralibs="-lsocket -lnsl"
1386 netbsd)
1387 oss_demuxer_extralibs="-lossaudio"
1388 oss_muxer_extralibs="-lossaudio"
1390 openbsd)
1391 disable need_memalign
1392 LIBOBJFLAGS='$(PIC)'
1393 SHFLAGS='-shared'
1394 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
1395 SLIBNAME_WITH_VERSION='$(SLIBNAME)'
1396 SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
1397 oss_demuxer_extralibs="-lossaudio"
1398 oss_muxer_extralibs="-lossaudio"
1400 freebsd)
1401 disable need_memalign
1403 bsd/os)
1404 osextralibs="-lpoll -lgnugetopt"
1405 strip="strip -d"
1407 darwin)
1408 disable need_memalign
1409 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
1410 VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$$(@F)'
1411 strip="strip -x"
1412 FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
1413 SLIBSUF=".dylib"
1414 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
1415 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
1416 FFSERVERLDFLAGS=-Wl,-bind_at_load
1417 objformat="macho"
1418 enabled x86_64 && objformat="macho64"
1420 mingw32*)
1421 target_os=mingw32
1422 LIBTARGET=i386
1423 if test $arch = x86_64; then
1424 disable need_memalign
1425 LIBTARGET=x64
1427 shlibdir_default="$bindir_default"
1428 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
1429 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
1430 if enabled swscale; then
1431 VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
1432 VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
1434 disable ffserver
1435 SLIBPREF=""
1436 SLIBSUF=".dll"
1437 EXESUF=".exe"
1438 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
1439 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
1440 SLIB_EXTRA_CMD='-lib /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
1441 SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
1442 install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
1443 SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
1444 SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
1445 objformat="win32"
1446 enable dos_paths
1447 check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
1448 die "ERROR: MinGW runtime version must be >= 3.15."
1449 enabled_any avisynth vfwcap_demuxer &&
1450 { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 12)" ||
1451 die "ERROR: avisynth and vfwcap_demuxer require w32api version 3.12 or later."; }
1453 cygwin*)
1454 target_os=cygwin
1455 shlibdir_default="$bindir_default"
1456 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
1457 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
1458 if enabled swscale; then
1459 VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
1460 VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
1462 EXESUF=".exe"
1463 SLIBPREF="cyg"
1464 SLIBSUF=".dll"
1465 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
1466 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
1467 SHFLAGS='-shared -Wl,--enable-auto-image-base'
1468 objformat="win32"
1469 enable dos_paths
1471 *-dos|freedos|opendos)
1472 disable ffplay ffserver vhook
1473 disable $INDEV_LIST $OUTDEV_LIST
1474 network_extralibs="-lsocket"
1475 EXESUF=".exe"
1476 objformat="win32"
1477 enable dos_paths
1479 linux)
1480 enable dv1394
1482 irix*)
1483 target_os=irix
1484 ranlib="echo ignoring ranlib"
1486 os/2*)
1487 strip="lxlite"
1488 ln_s="cp -f"
1489 EXESUF=".exe"
1490 FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
1491 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
1492 FFSERVERLDFLAGS=""
1493 LIBSUF="_s.a"
1494 SLIBPREF=""
1495 SLIBSUF=".dll"
1496 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
1497 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
1498 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
1499 echo PROTMODE >> $(SUBDIR)$(NAME).def; \
1500 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
1501 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
1502 echo EXPORTS >> $(SUBDIR)$(NAME).def; \
1503 emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
1504 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
1505 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
1506 SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
1507 SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
1508 disable vhook
1509 enable dos_paths
1511 interix)
1512 disable vhook
1516 target_os="${target_os}-UNKNOWN"
1518 esac
1520 set_default $PATHS_LIST
1522 add_extralibs $osextralibs
1524 # Combine FFLDFLAGS and the LDFLAGS environment variable.
1525 LDFLAGS="$FFLDFLAGS $LDFLAGS"
1527 # we need to build at least one lib type
1528 if ! enabled_any static shared; then
1529 cat <<EOF
1530 At least one library type must be built.
1531 Specify --enable-static to build the static libraries or --enable-shared to
1532 build the shared libraries as well. To only build the shared libraries specify
1533 --disable-static in addition to --enable-shared.
1535 exit 1;
1538 disabled static && LIBNAME=""
1540 if enabled_any libfaad libfaadbin ; then
1541 if check_header faad.h; then
1542 check_cc <<EOF
1543 #include <faad.h>
1544 #ifndef FAAD2_VERSION
1545 ok faad1
1546 #endif
1547 int main(void) { return 0; }
1549 test $? = 0 && enable libfaad2
1550 else
1551 die "FAAD test failed."
1556 if ! enabled gpl; then
1557 die_gpl_disabled(){
1558 name=$1
1559 shift
1560 enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
1562 die_gpl_disabled "The Postprocessing code" postproc
1563 die_gpl_disabled "libx264" libx264
1564 die_gpl_disabled "libxvidcore" libxvid
1565 die_gpl_disabled "FAAD2" libfaad2
1566 die_gpl_disabled "The X11 grabber" x11grab
1567 die_gpl_disabled "The software scaler" swscale
1570 if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
1571 die "libamr is nonfree and --enable-nonfree is not specified."
1574 check_deps $ARCH_EXT_LIST
1576 test -z "$need_memalign" && need_memalign="$mmx"
1578 #Darwin CC versions
1579 if test $target_os = darwin; then
1580 if $cc -v 2>&1 | grep -q xlc; then
1581 add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
1582 else
1583 add_cflags "-pipe"
1584 check_cflags "-force_cpusubtype_ALL"
1585 check_cflags "-Wno-sign-compare"
1586 enabled shared || check_cflags -mdynamic-no-pic
1590 disabled optimizations || check_cflags -fomit-frame-pointer
1592 # Add processor-specific flags
1593 if test $cpu != "generic"; then
1594 warn_altivec(){
1595 $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
1597 case $cpu in
1598 601|ppc601|PowerPC601)
1599 add_cflags "-mcpu=601"
1600 warn_altivec enabled PPC601
1602 603*|ppc603*|PowerPC603*)
1603 add_cflags "-mcpu=603"
1604 warn_altivec enabled PPC603
1606 604*|ppc604*|PowerPC604*)
1607 add_cflags "-mcpu=604"
1608 warn_altivec enabled PPC604
1610 G3|g3|75*|ppc75*|PowerPC75*)
1611 add_cflags "-mcpu=750 -mpowerpc-gfxopt"
1612 warn_altivec enabled PPC75x
1614 G4|g4|745*|ppc745*|PowerPC745*)
1615 add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
1616 warn_altivec disabled PPC745x
1618 74*|ppc74*|PowerPC74*)
1619 add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
1620 warn_altivec disabled PPC74xx
1622 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
1623 add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
1624 warn_altivec disabled PPC970
1625 enable ppc64
1627 Cell|CELL|cell)
1628 add_cflags "-mcpu=cell"
1629 warn_altivec disabled Cell
1630 enable ppc64
1632 # targets that do NOT support conditional mov (cmov)
1633 i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
1634 add_cflags "-march=$cpu"
1635 disable cmov
1637 # targets that do support conditional mov (cmov)
1638 i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
1639 add_cflags "-march=$cpu"
1640 enable cmov
1641 enable fast_cmov
1643 # targets that do support conditional mov but on which it's slow
1644 pentium4|pentium4m|prescott|nocona)
1645 add_cflags "-march=$cpu"
1646 enable cmov
1647 disable fast_cmov
1649 sparc64)
1650 add_cflags "-mcpu=v9"
1652 arm11*|cortex*)
1653 add_cflags "-mcpu=$cpu"
1654 enable fast_unaligned
1656 armv*)
1657 add_cflags "-march=$cpu"
1659 arm*)
1660 add_cflags "-mcpu=$cpu"
1663 echo "WARNING: Unknown CPU \"$cpu\", ignored."
1665 esac
1668 # make sure we can execute files in $TMPDIR
1669 cat > $TMPSH 2>> $logfile <<EOF
1670 #! /bin/sh
1672 chmod +x $TMPSH >> $logfile 2>&1
1673 if ! $TMPSH >> $logfile 2>&1; then
1674 cat <<EOF
1675 Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
1676 variable to another directory and make sure that $TMPDIR1 is not mounted
1677 noexec.
1679 die "Sanity test failed."
1681 rm $TMPSH
1683 # compiler sanity check
1684 check_exec <<EOF
1685 int main(void){ return 0; }
1687 if test "$?" != 0; then
1688 echo "$cc is unable to create an executable file."
1689 if test -z "$cross_prefix" && ! enabled cross_compile ; then
1690 echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
1691 echo "Only do this if you know what cross compiling means."
1693 die "C compiler test failed."
1696 check_cc <<EOF || die "Symbol mangling check failed."
1697 int ff_extern;
1699 sym=$($nm -P -g $TMPO | grep ff_extern)
1700 extern_prefix=${sym%%ff_extern*}
1702 check_asm inline_asm '""'
1704 if enabled x86; then
1705 # check whether EBP is available on x86
1706 # As 'i' is stored on the stack, this program will crash
1707 # if the base pointer is used to access it because the
1708 # base pointer is cleared in the inline assembly code.
1709 check_exec_crash <<EOF && enable ebp_available
1710 volatile int i=0;
1711 __asm__ volatile (
1712 "xorl %%ebp, %%ebp"
1713 ::: "%ebp");
1714 return i;
1717 # check wether EBX is available on x86
1718 check_asm ebx_available '"":::"%ebx"'
1720 # check whether binutils is new enough to compile SSSE3/MMX2
1721 enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
1722 enabled mmx2 && check_asm mmx2 '"movss %xmm0, %xmm0"'
1724 check_asm bswap '"bswap %%eax" ::: "%eax"'
1726 YASMFLAGS="-f $objformat -DARCH_$(toupper $arch)"
1727 enabled x86_64 && append YASMFLAGS "-m amd64"
1728 enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
1729 case "$objformat" in
1730 elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
1731 macho64) append YASMFLAGS "-DPIC -DPREFIX" ;;
1732 *) append YASMFLAGS "-DPREFIX" ;;
1733 esac
1734 check_yasm "pabsw xmm0, xmm0" && enable yasm
1737 # check for assembler specific support
1739 if test $arch = "powerpc"; then
1740 check_asm dcbzl '"dcbzl 0, 1"'
1743 # check for SIMD availability
1745 # AltiVec flags: The FSF version of GCC differs from the Apple version
1746 if enabled altivec; then
1747 check_cflags -maltivec -mabi=altivec &&
1748 { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
1749 check_cflags -faltivec
1751 # check if our compiler supports Motorola AltiVec C API
1752 check_cc <<EOF || disable altivec
1753 $inc_altivec_h
1754 int main(void) {
1755 vector signed int v1, v2, v3;
1756 v1 = vec_add(v2,v3);
1757 return 0;
1761 # check if our compiler supports braces for vector declarations
1762 check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
1763 $inc_altivec_h
1764 int main (void) { (vector int) {1}; return 0; }
1768 # We have to check if pld is a nop and disable it.
1769 enabled armv4l && check_asm pld '"pld [r0]"'
1770 enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
1771 enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
1772 enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
1773 enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
1774 enabled mmi && check_asm mmi '"lq $2, 0($2)"'
1775 enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
1776 enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
1778 enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
1780 # ---
1781 # big/little-endian test
1782 check_cc <<EOF || die "endian test failed"
1783 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
1785 od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
1787 # ---
1788 # check availability of some header files
1790 if check_func dlopen; then
1791 ldl=
1792 elif check_func dlopen -ldl; then
1793 ldl=-ldl
1796 check_func fork
1797 check_func gethrtime
1798 check_func getrusage
1799 check_func inet_aton $network_extralibs
1800 check_func memalign
1801 check_func mkstemp
1802 check_func_headers windows.h GetProcessTimes
1804 check_header conio.h
1805 check_header dlfcn.h
1806 check_header malloc.h
1807 check_header poll.h
1808 check_header sys/mman.h
1809 check_header sys/resource.h
1810 check_header sys/select.h
1811 check_header termios.h
1813 if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
1814 die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
1817 disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
1818 disabled bzlib || check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
1820 # check for some common methods of building with pthread support
1821 # do this before the optional library checks as some of them require pthreads
1822 if enabled pthreads; then
1823 if check_func pthread_create; then
1825 elif check_func pthread_create -pthread; then
1826 add_cflags -pthread
1827 add_extralibs -pthread
1828 elif check_func pthread_create -pthreads; then
1829 add_cflags -pthreads
1830 add_extralibs -pthreads
1831 elif check_func pthread_create -lpthreadGC2; then
1832 add_extralibs -lpthreadGC2
1833 elif ! check_lib pthread.h pthread_create -lpthread; then
1834 die "ERROR: can't find pthreads library"
1838 for thread in $THREADS_LIST; do
1839 if enabled $thread; then
1840 test -n "$thread_type" &&
1841 die "ERROR: Only one thread type must be selected." ||
1842 thread_type="$thread"
1844 done
1846 check_lib math.h sin -lm
1848 # test for C99 functions in math.h
1849 for func in llrint lrint lrintf round roundf; do
1850 check_exec <<EOF && enable $func || disable $func
1851 #include <math.h>
1852 int main(void) { return ($func(3.999f) > 0)?0:1; }
1854 done
1856 # these are off by default, so fail if requested and not available
1857 enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
1858 enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
1859 enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
1860 enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
1861 require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder &&
1862 require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
1863 enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
1864 enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
1865 enabled libgsm && require libgsm gsm.h gsm_create -lgsm
1866 enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
1867 enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
1868 enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
1869 require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
1870 enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
1871 enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
1872 enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
1873 enabled libx264 && require libx264 x264.h x264_encoder_open -lx264 -lm &&
1874 { check_cpp_condition x264.h "X264_BUILD >= 65" ||
1875 die "ERROR: libx264 version must be >= 0.65."; }
1876 enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
1877 enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
1878 enabled vdpau && require libvdpau vdpau/vdpau_x11.h vdp_device_create_x11 -lvdpau
1880 # libdc1394 check
1881 if enabled libdc1394; then
1882 { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
1883 enable libdc1394_2; } ||
1884 { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
1885 enable libdc1394_1; } ||
1886 die "ERROR: No version of libdc1394 found "
1890 _restrict=
1891 for restrict_keyword in restrict __restrict__ __restrict; do
1892 check_cc <<EOF && _restrict=$restrict_keyword && break
1893 void foo(char * $restrict_keyword p);
1895 done
1897 test "$vhook" = "default" && vhook="$dlopen"
1899 if test "$target_os" = cygwin -o "$target_os" = mingw32 && enabled_all static vhook ; then
1900 disable vhook
1901 echo
1902 echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
1903 echo "Patches welcome."
1904 echo
1907 if enabled vhook; then
1908 check_ldflags -rdynamic
1909 check_ldflags -export-dynamic
1912 check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
1913 check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
1915 ##########################################
1916 # SDL check
1918 disable sdl_too_old
1919 disable sdl
1920 SDL_CONFIG="${cross_prefix}sdl-config"
1921 if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
1922 sdl_cflags=`"${SDL_CONFIG}" --cflags`
1923 temp_cflags $sdl_cflags
1924 temp_extralibs `"${SDL_CONFIG}" --libs`
1925 if check_lib2 SDL.h SDL_Init; then
1926 _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
1927 if test "$_sdlversion" -lt 121 ; then
1928 enable sdl_too_old
1929 else
1930 enable sdl
1931 check_cc $sdl_cflags <<EOF && enable sdl_video_size
1932 #include <SDL.h>
1933 int main(int argc, char **argv){
1934 const SDL_VideoInfo *vi = SDL_GetVideoInfo();
1935 int w = vi->current_w;
1936 return 0;
1941 restore_flags
1944 texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
1946 ##########################################
1947 # Network check
1949 if enabled network; then
1950 check_type sys/socket.h socklen_t
1951 # Prefer arpa/inet.h over winsock2
1952 if check_header arpa/inet.h ; then
1953 check_func closesocket
1954 elif check_header winsock2.h ; then
1955 network_extralibs="-lws2_32"
1956 check_type ws2tcpip.h socklen_t
1957 check_func_headers winsock2.h closesocket
1961 ##########################################
1962 # IPv6 check
1964 enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
1965 #include <sys/types.h>
1966 #include <sys/socket.h>
1967 #include <netinet/in.h>
1968 #include <netdb.h>
1969 int main(void) {
1970 struct sockaddr_storage saddr;
1971 struct ipv6_mreq mreq6;
1972 getaddrinfo(0,0,0,0);
1973 getnameinfo(0,0,0,0,0,0,0);
1974 IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
1978 check_header linux/videodev.h
1979 check_header linux/videodev2.h
1980 check_header sys/videoio.h
1982 check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
1984 # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
1985 { check_header dev/bktr/ioctl_meteor.h &&
1986 check_header dev/bktr/ioctl_bt848.h; } ||
1987 { check_header machine/ioctl_meteor.h &&
1988 check_header machine/ioctl_bt848.h; } ||
1989 { check_header dev/video/meteor/ioctl_meteor.h &&
1990 check_header dev/video/bktr/ioctl_bt848.h; } ||
1991 check_header dev/ic/bt8xx.h
1993 check_header sys/soundcard.h
1994 check_header soundcard.h
1996 # deal with the X11 frame grabber
1997 enabled x11grab &&
1998 check_header X11/Xlib.h &&
1999 check_header X11/extensions/XShm.h &&
2000 check_func XOpenDisplay -lX11 &&
2001 check_func XShmCreateImage -lX11 -lXext
2003 enabled debug && add_cflags -g"$debuglevel"
2005 # add some useful compiler flags if supported
2006 check_cflags -Wdeclaration-after-statement
2007 check_cflags -Wall
2008 check_cflags -Wno-switch
2009 check_cflags -Wdisabled-optimization
2010 check_cflags -Wpointer-arith
2011 check_cflags -Wredundant-decls
2012 check_cflags -Wno-pointer-sign
2013 check_cflags -Wcast-qual
2014 check_cflags -Wwrite-strings
2015 check_cflags -Wtype-limits
2016 enabled extra_warnings && check_cflags -Winline
2018 # add some linker flags
2019 check_ldflags -Wl,--warn-common
2020 check_ldflags -Wl,--as-needed
2021 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'
2022 check_ldflags -Wl,-Bsymbolic
2024 if enabled small; then
2025 check_cflags -Os # not all compilers support -Os
2026 optimizations="small"
2027 elif enabled optimizations; then
2028 if $cc -v 2>&1 | grep -q xlc; then
2029 add_cflags "-O5"
2030 add_ldflags "-O5"
2031 else
2032 add_cflags "-O3"
2035 check_cflags -fno-math-errno
2036 check_cflags -fno-signed-zeros
2038 # add some flags for Intel C Compiler
2039 if $cc --version 2> /dev/null | grep -q Intel; then
2040 # Just warnings, no remarks
2041 check_cflags -w1
2042 # -wd: Disable following warnings
2043 # 144, 167, 556: -Wno-pointer-sign
2044 # 10006: ignoring unknown option -fno-signed-zeros
2045 # 10156: ignoring option '-W'; no argument required
2046 check_cflags -wd144,167,556,10006,10156
2047 # 11030: Warning unknown option --as-needed
2048 # 10156: ignoring option '-export'; no argument required
2049 check_ldflags -wd10156,11030
2050 # Allow to compile with optimizations
2051 check_ldflags -march=$cpu
2054 # PIC flags for shared library objects where they are needed
2055 if enabled shared; then
2056 # LIBOBJFLAGS may have already been set in the OS configuration
2057 if test -z "$LIBOBJFLAGS" ; then
2058 case "$arch" in
2059 x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
2060 esac
2064 if enabled gprof; then
2065 add_cflags "-p"
2066 add_ldflags "-p"
2069 VHOOKCFLAGS="-fPIC"
2071 # Find out if the .align argument is a power of two or not.
2072 if test $asmalign_pot = "unknown"; then
2073 disable asmalign_pot
2074 echo '__asm__ (".align 3");' | check_cc && enable asmalign_pot
2077 enabled_any $DECODER_LIST && enable decoders
2078 enabled_any $ENCODER_LIST && enable encoders
2079 enabled_any $BSF_LIST && enable bsfs
2080 enabled_any $DEMUXER_LIST && enable demuxers
2081 enabled_any $MUXER_LIST && enable muxers
2082 enabled_any $FILTER_LIST && enable filters
2083 enabled_any $INDEV_LIST && enable demuxers
2084 enabled_any $OUTDEV_LIST && enable muxers
2085 enabled_any $PROTOCOL_LIST && enable protocols
2087 enabled_any $THREADS_LIST && enable threads
2089 check_deps $CONFIG_LIST \
2090 $CONFIG_EXTRA \
2091 $HAVE_LIST \
2092 $DECODER_LIST \
2093 $ENCODER_LIST \
2094 $PARSER_LIST \
2095 $BSF_LIST \
2096 $DEMUXER_LIST \
2097 $MUXER_LIST \
2098 $FILTER_LIST \
2099 $INDEV_LIST \
2100 $OUTDEV_LIST \
2101 $PROTOCOL_LIST \
2103 enabled libdc1394 && append pkg_requires "libraw1394"
2104 enabled libdirac && append pkg_requires "dirac"
2105 enabled libtheora && append pkg_requires "theora"
2106 enabled libvorbis && append pkg_requires "vorbisenc"
2108 echo "install prefix $prefix"
2109 echo "source path $source_path"
2110 echo "C compiler $cc"
2111 echo ".align is power-of-two $asmalign_pot"
2112 echo "ARCH $arch ($cpu)"
2113 if test "$build_suffix" != ""; then
2114 echo "build suffix $build_suffix"
2116 if test "$extra_version" != ""; then
2117 echo "version string suffix $extra_version"
2119 echo "big-endian ${bigendian-no}"
2120 if test $arch = "x86_32" -o $arch = "x86_64"; then
2121 echo "yasm ${yasm-no}"
2122 echo "MMX enabled ${mmx-no}"
2123 echo "CMOV enabled ${cmov-no}"
2124 echo "CMOV is fast ${fast_cmov-no}"
2125 echo "EBX available ${ebx_available-no}"
2126 echo "EBP available ${ebp_available-no}"
2128 if test $arch = "armv4l"; then
2129 echo "ARMv5TE enabled ${armv5te-no}"
2130 echo "ARMv6 enabled ${armv6-no}"
2131 echo "ARM VFP enabled ${armvfp-no}"
2132 echo "IWMMXT enabled ${iwmmxt-no}"
2133 echo "NEON enabled ${neon-no}"
2135 if test $arch = "mips"; then
2136 echo "MMI enabled ${mmi-no}"
2138 if test $arch = "powerpc"; then
2139 echo "AltiVec enabled ${altivec-no}"
2140 echo "dcbzl available ${dcbzl-no}"
2142 echo "gprof enabled ${gprof-no}"
2143 echo "debug symbols ${debug-no}"
2144 echo "strip symbols ${stripping-no}"
2145 echo "optimizations ${optimizations-no}"
2146 echo "static ${static-no}"
2147 echo "shared ${shared-no}"
2148 echo "postprocessing support ${postproc-no}"
2149 echo "software scaler enabled ${swscale-no}"
2150 echo "new filter support ${avfilter-no}"
2151 echo "filters using lavformat ${avfilter_lavf-no}"
2152 echo "video hooking ${vhook-no}"
2153 if enabled vhook; then
2154 echo "Imlib2 support ${imlib2-no}"
2155 echo "FreeType support ${freetype2-no}"
2157 echo "network support ${network-no}"
2158 if enabled network; then
2159 echo "IPv6 support ${ipv6-no}"
2161 echo "threading support ${thread_type-no}"
2162 echo "SDL support ${sdl-no}"
2163 if enabled sdl_too_old; then
2164 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
2166 echo "Sun medialib support ${mlib-no}"
2167 echo "AVISynth enabled ${avisynth-no}"
2168 echo "libamr-nb support ${libamr_nb-no}"
2169 echo "libamr-wb support ${libamr_wb-no}"
2170 echo "libdc1394 support ${libdc1394-no}"
2171 echo "libdirac enabled ${libdirac-no}"
2172 echo "libfaac enabled ${libfaac-no}"
2173 echo "libfaad enabled ${libfaad-no}"
2174 echo "libfaad dlopened ${libfaadbin-no}"
2175 echo "libgsm enabled ${libgsm-no}"
2176 echo "libmp3lame enabled ${libmp3lame-no}"
2177 echo "libnut enabled ${libnut-no}"
2178 echo "libschroedinger enabled ${libschroedinger-no}"
2179 echo "libspeex enabled ${libspeex-no}"
2180 echo "libtheora enabled ${libtheora-no}"
2181 echo "libvorbis enabled ${libvorbis-no}"
2182 echo "libx264 enabled ${libx264-no}"
2183 echo "libxvid enabled ${libxvid-no}"
2184 echo "zlib enabled ${zlib-no}"
2185 echo "bzlib enabled ${bzlib-no}"
2186 echo
2188 for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
2189 echo "Enabled ${type}s:"
2190 eval list=\$$(toupper $type)_LIST
2191 for part in $list; do
2192 enabled $part && echo ${part%_*}
2193 done | sort | pr -3 -t
2194 echo
2195 done
2197 license="LGPL"
2198 if enabled nonfree; then
2199 license="unredistributable"
2200 elif enabled gpl; then
2201 license="GPL"
2204 echo "License: $license"
2206 echo "Creating config.mak and config.h..."
2208 echo "# Automatically generated by configure - do not modify!" > config.mak
2209 echo "/* Automatically generated by configure - do not modify! */" > $TMPH
2210 echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
2211 echo "#define FFMPEG_CONFIG_H" >> $TMPH
2212 echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
2214 echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
2215 echo "prefix=$prefix" >> config.mak
2216 echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
2217 echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
2218 echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
2219 echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
2220 echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
2221 echo "CC=$cc" >> config.mak
2222 echo "YASM=$yasmexe" >> config.mak
2223 echo "AR=$ar" >> config.mak
2224 echo "RANLIB=$ranlib" >> config.mak
2225 echo "LN_S=$ln_s" >> config.mak
2226 enabled stripping &&
2227 echo "STRIP=$strip" >> config.mak ||
2228 echo "STRIP=echo ignoring strip" >> config.mak
2230 echo "OPTFLAGS=$CFLAGS" >> config.mak
2231 echo "VHOOKCFLAGS=$VHOOKCFLAGS" >> config.mak
2232 echo "LDFLAGS=$LDFLAGS" >> config.mak
2233 echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
2234 echo "SHFLAGS=$SHFLAGS" >> config.mak
2235 echo "YASMFLAGS=$YASMFLAGS" >> config.mak
2236 echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
2237 echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
2238 echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
2239 echo "BUILD_STATIC=$static" >> config.mak
2240 echo "BUILDSUF=$build_suffix" >> config.mak
2241 echo "FULLNAME=$FULLNAME" >> config.mak
2242 echo "LIBPREF=$LIBPREF" >> config.mak
2243 echo "LIBSUF=$LIBSUF" >> config.mak
2244 echo "LIBNAME=$LIBNAME" >> config.mak
2245 echo "SLIBPREF=$SLIBPREF" >> config.mak
2246 echo "SLIBSUF=$SLIBSUF" >> config.mak
2247 echo "EXESUF=$EXESUF" >> config.mak
2248 echo "EXTRA_VERSION=$extra_version" >> config.mak
2249 echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
2250 echo "HOSTCC=$host_cc" >> config.mak
2251 echo "HOSTCFLAGS=$host_cflags" >> config.mak
2252 echo "HOSTLDFLAGS=$host_ldflags" >> config.mak
2253 echo "HOSTLIBS=$host_libs" >> config.mak
2254 echo "TARGET_EXEC=$target_exec" >> config.mak
2255 echo "TARGET_PATH=$target_path" >> config.mak
2257 if enabled bigendian; then
2258 echo "WORDS_BIGENDIAN=yes" >> config.mak
2259 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
2262 if enabled sdl; then
2263 echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
2264 echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
2266 if enabled texi2html; then
2267 echo "BUILD_DOC=yes" >> config.mak
2270 get_version(){
2271 name=$1
2272 file=$source_path/$2
2273 eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
2274 eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
2275 lcname=$(tolower $name)
2276 eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
2277 eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
2280 get_version LIBSWSCALE libswscale/swscale.h
2281 get_version LIBPOSTPROC libpostproc/postprocess.h
2282 get_version LIBAVCODEC libavcodec/avcodec.h
2283 get_version LIBAVDEVICE libavdevice/avdevice.h
2284 get_version LIBAVFORMAT libavformat/avformat.h
2285 get_version LIBAVUTIL libavutil/avutil.h
2286 get_version LIBAVFILTER libavfilter/avfilter.h
2288 if enabled shared; then
2289 echo "BUILD_SHARED=yes" >> config.mak
2290 echo "PIC=-fPIC -DPIC" >> config.mak
2291 echo "LIBTARGET=${LIBTARGET}" >> config.mak
2292 echo "SLIBNAME=${SLIBNAME}" >> config.mak
2293 echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
2294 echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
2295 echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
2296 echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
2297 echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
2298 echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
2300 echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
2301 echo "EXTRALIBS=$extralibs" >> config.mak
2303 print_config ARCH_ $TMPH config.mak $ARCH_LIST
2304 print_config HAVE_ $TMPH config.mak $HAVE_LIST
2305 print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
2306 $CONFIG_EXTRA \
2307 $DECODER_LIST \
2308 $ENCODER_LIST \
2309 $PARSER_LIST \
2310 $BSF_LIST \
2311 $DEMUXER_LIST \
2312 $MUXER_LIST \
2313 $FILTER_LIST \
2314 $PROTOCOL_LIST \
2315 $INDEV_LIST \
2316 $OUTDEV_LIST \
2318 echo "#define restrict $_restrict" >> $TMPH
2320 if enabled small; then
2321 echo "#define av_always_inline" >> $TMPH
2324 echo "SRC_PATH=\"$source_path\"" >> config.mak
2325 echo "SRC_PATH_BARE=$source_path" >> config.mak
2326 echo "BUILD_ROOT=\"$PWD\"" >> config.mak
2328 # Apparently it's not possible to portably echo a backslash.
2329 enabled asmalign_pot &&
2330 printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
2331 printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
2333 echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
2335 echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
2337 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
2338 cmp -s $TMPH config.h &&
2339 echo "config.h is unchanged" ||
2340 mv -f $TMPH config.h
2342 rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
2344 # build tree in object directory if source path is different from current one
2345 if enabled source_path_used; then
2346 DIRS="\
2347 doc \
2348 libavcodec \
2349 libavcodec/alpha \
2350 libavcodec/armv4l \
2351 libavcodec/bfin \
2352 libavcodec/i386 \
2353 libavcodec/mlib \
2354 libavcodec/ppc \
2355 libavcodec/sh4 \
2356 libavcodec/sparc \
2357 libavdevice \
2358 libavfilter \
2359 libavformat \
2360 libavutil \
2361 libpostproc \
2362 libswscale \
2363 tests \
2364 tools \
2365 vhook \
2367 FILES="\
2368 Makefile \
2369 common.mak \
2370 subdir.mak \
2371 doc/texi2pod.pl \
2372 libavcodec/Makefile \
2373 libavdevice/Makefile \
2374 libavfilter/Makefile \
2375 libavformat/Makefile \
2376 libavutil/Makefile \
2377 libpostproc/Makefile \
2378 libswscale/Makefile \
2380 for dir in $DIRS ; do
2381 mkdir -p $dir
2382 done
2383 for f in $FILES ; do
2384 $ln_s "$source_path/$f" $f
2385 done
2389 # build pkg-config files
2391 pkgconfig_generate(){
2392 name=$1
2393 shortname=${name#lib}${build_suffix}
2394 comment=$2
2395 version=$3
2396 libs=$4
2397 requires=$5
2398 cat <<EOF > $name/$name.pc
2399 prefix=$prefix
2400 exec_prefix=\${prefix}
2401 libdir=$libdir
2402 includedir=$incdir
2404 Name: $name
2405 Description: $comment
2406 Version: $version
2407 Requires: $(disabled shared && echo $requires)
2408 Requires.private: $(enabled shared && echo $requires)
2409 Conflicts:
2410 Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
2411 Libs.private: $(enabled shared && echo $libs)
2412 Cflags: -I\${includedir}
2414 cat <<EOF > $name/$name-uninstalled.pc
2415 prefix=
2416 exec_prefix=
2417 libdir=\${pcfiledir}
2418 includedir=${source_path}
2420 Name: $name
2421 Description: $comment
2422 Version: $version
2423 Requires: $requires
2424 Conflicts:
2425 Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
2426 Cflags: -I\${includedir}
2430 pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
2431 pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
2432 pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2433 pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
2434 enabled avfilter &&
2435 pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
2436 enabled postproc &&
2437 pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
2438 if enabled swscale; then
2439 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
2440 else
2441 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2442 apply libswscale/libswscale.pc sed s/^Libs:.*$/Libs:/