ARM: move dct_unquantize_h263_*_armv5te asm to separate file
[FFMpeg-mirror/ffmpeg-vdpau.git] / configure
blob90e4f8b473a0b9ed51f72879a06011a3dcc05684
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
817 HAVE_LIST="
818 $ARCH_EXT_LIST
819 $THREADS_LIST
820 altivec_h
821 arpa_inet_h
822 bswap
823 closesocket
824 cmov
825 conio_h
826 dcbzl
827 dev_bktr_ioctl_bt848_h
828 dev_bktr_ioctl_meteor_h
829 dev_ic_bt8xx_h
830 dev_video_meteor_ioctl_meteor_h
831 dev_video_bktr_ioctl_bt848_h
832 dlfcn_h
833 dlopen
834 dos_paths
835 ebp_available
836 ebx_available
837 fast_64bit
838 fast_cmov
839 fast_unaligned
840 fork
841 freetype2
842 gethrtime
843 GetProcessTimes
844 getrusage
845 imlib2
846 inet_aton
847 inline_asm
848 libdc1394_1
849 libdc1394_2
850 llrint
851 lrint
852 lrintf
853 machine_ioctl_bt848_h
854 machine_ioctl_meteor_h
855 malloc_h
856 memalign
857 mkstemp
859 ppc64
860 round
861 roundf
863 sdl_video_size
864 socklen_t
865 soundcard_h
866 poll_h
867 sys_mman_h
868 sys_resource_h
869 sys_select_h
870 sys_soundcard_h
871 sys_videoio_h
872 termios_h
873 threads
874 winsock2_h
875 yasm
878 # options emitted with CONFIG_ prefix but not available on command line
879 CONFIG_EXTRA="
880 fft_mmx
881 oldscaler
884 CMDLINE_SELECT="
885 $ARCH_EXT_LIST
886 $CONFIG_LIST
887 $THREADS_LIST
888 cross_compile
889 debug
890 extra_warnings
891 logging
892 optimizations
893 shared
894 static
895 stripping
898 PATHS_LIST='
899 bindir
900 incdir
901 libdir
902 mandir
903 prefix
904 shlibdir
907 CMDLINE_SET="
908 $PATHS_LIST
909 arch
910 build_suffix
913 cross_prefix
914 extra_version
915 host_cc
916 host_cflags
917 host_ldflags
918 host_libs
919 logfile
920 source_path
921 target_exec
922 target_os
923 target_path
926 # code dependency declarations
928 # architecture extensions
929 altivec_deps="powerpc"
930 armv5te_deps="armv4l"
931 armv6_deps="armv4l"
932 armvfp_deps="armv4l"
933 iwmmxt_deps="armv4l"
934 mmi_deps="mips"
935 mmx_deps="x86"
936 mmx2_deps="x86 mmx"
937 neon_deps="armv4l"
938 ssse3_deps="x86"
939 vis_deps="sparc"
941 # common features
942 fft_suggest="fft_mmx"
943 fft_mmx_deps="mmx yasm"
944 oldscaler_deps="!swscale"
946 # decoders / encoders
947 aac_decoder_select="fft mdct"
948 ac3_decoder_deps="gpl"
949 ac3_decoder_select="fft mdct"
950 atrac3_decoder_select="fft mdct"
951 cavs_decoder_select="golomb"
952 cook_decoder_select="fft mdct"
953 cscd_decoder_suggest="zlib"
954 dca_decoder_select="fft mdct"
955 dxa_decoder_select="zlib"
956 eac3_decoder_deps="gpl"
957 eac3_decoder_select="fft mdct"
958 ffv1_decoder_select="golomb"
959 flac_decoder_select="golomb"
960 flac_encoder_select="golomb"
961 flashsv_decoder_select="zlib"
962 flashsv_encoder_select="zlib"
963 h264_decoder_select="golomb"
964 imc_decoder_select="fft mdct"
965 jpegls_decoder_select="golomb"
966 jpegls_encoder_select="golomb"
967 loco_decoder_select="golomb"
968 mpeg_xvmc_decoder_deps="xvmc"
969 nellymoser_decoder_select="fft mdct"
970 nellymoser_encoder_select="fft mdct"
971 png_decoder_select="zlib"
972 png_encoder_select="zlib"
973 qdm2_decoder_select="fft mdct"
974 shorten_decoder_select="golomb"
975 sonic_decoder_select="golomb"
976 sonic_encoder_select="golomb"
977 sonic_ls_encoder_select="golomb"
978 svq3_decoder_select="golomb"
979 svq3_decoder_suggest="zlib"
980 tiff_decoder_suggest="zlib"
981 tiff_encoder_suggest="zlib"
982 tscc_decoder_select="zlib"
983 vorbis_decoder_select="fft mdct"
984 vorbis_encoder_select="fft mdct"
985 wmav1_decoder_select="fft mdct"
986 wmav1_encoder_select="fft mdct"
987 wmav2_decoder_select="fft mdct"
988 wmav2_encoder_select="fft mdct"
989 zlib_decoder_select="zlib"
990 zlib_encoder_select="zlib"
991 zmbv_decoder_select="zlib"
992 zmbv_encoder_select="zlib"
994 # external libraries
995 libamr_nb_decoder_deps="libamr_nb"
996 libamr_nb_encoder_deps="libamr_nb"
997 libamr_wb_decoder_deps="libamr_wb"
998 libamr_wb_encoder_deps="libamr_wb"
999 libdirac_decoder_deps="libdirac !libschroedinger"
1000 libdirac_encoder_deps="libdirac"
1001 libfaac_encoder_deps="libfaac"
1002 libfaad_decoder_deps="libfaad"
1003 libfaadbin_decoder_extralibs='$ldl'
1004 libgsm_decoder_deps="libgsm"
1005 libgsm_encoder_deps="libgsm"
1006 libgsm_ms_decoder_deps="libgsm"
1007 libgsm_ms_encoder_deps="libgsm"
1008 libmp3lame_encoder_deps="libmp3lame"
1009 libschroedinger_decoder_deps="libschroedinger"
1010 libschroedinger_encoder_deps="libschroedinger"
1011 libspeex_decoder_deps="libspeex"
1012 libtheora_encoder_deps="libtheora"
1013 libvorbis_encoder_deps="libvorbis"
1014 libx264_encoder_deps="libx264"
1015 libxvid_encoder_deps="libxvid"
1016 mpeg4aac_decoder_deps="libfaad"
1018 # demuxers / muxers
1019 ac3_demuxer_deps="ac3_parser"
1020 audio_beos_demuxer_deps="audio_beos"
1021 audio_beos_demuxer_extralibs="-lmedia -lbe"
1022 audio_beos_muxer_deps="audio_beos"
1023 audio_beos_muxer_extralibs="-lmedia -lbe"
1024 avisynth_demuxer_deps="avisynth"
1025 bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
1026 dirac_demuxer_deps="dirac_parser"
1027 dv1394_demuxer_deps="dv1394 dv_demuxer"
1028 libdc1394_demuxer_deps="libdc1394"
1029 libnut_demuxer_deps="libnut"
1030 libnut_muxer_deps="libnut"
1031 matroska_demuxer_suggest="zlib bzlib"
1032 mov_demuxer_suggest="zlib"
1033 mp3_demuxer_deps="mpegaudio_parser"
1034 oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
1035 oss_muxer_deps_any="soundcard_h sys_soundcard_h"
1036 redir_demuxer_deps="network"
1037 rtp_muxer_deps="network rtp_protocol"
1038 rtsp_demuxer_deps="sdp_demuxer"
1039 sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
1040 v4l_demuxer_deps="linux_videodev_h"
1041 v4l2_demuxer_deps_any="linux_videodev2_h sys_videoio_h"
1042 vfwcap_demuxer_deps="capCreateCaptureWindow"
1043 vfwcap_demuxer_extralibs="-lvfw32"
1044 x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
1045 x11_grab_device_demuxer_extralibs="-lX11 -lXext"
1047 # protocols
1048 http_protocol_deps="network"
1049 rtp_protocol_deps="udp_protocol"
1050 tcp_protocol_deps="network"
1051 udp_protocol_deps="network"
1053 # filters
1054 movie_filter_deps="avfilter_lavf"
1056 # programs
1057 ffplay_deps="sdl"
1058 ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
1059 ffserver_extralibs='$ldl'
1060 vhook_extralibs='$ldl'
1063 # default parameters
1065 logfile="config.err"
1067 # installation paths
1068 prefix_default="/usr/local"
1069 bindir_default='${prefix}/bin'
1070 incdir_default='${prefix}/include'
1071 libdir_default='${prefix}/lib'
1072 mandir_default='${prefix}/share/man'
1073 shlibdir_default="$libdir_default"
1075 # toolchain
1076 cc_default="gcc"
1077 host_cc_default="gcc"
1078 yasmexe="yasm"
1079 ar="ar"
1080 nm="nm"
1081 ranlib="ranlib"
1082 strip="strip"
1083 asmalign_pot="unknown"
1084 ln_s="ln -sf"
1085 objformat="elf"
1087 # machine
1088 arch=`uname -m`
1089 cpu="generic"
1091 # OS
1092 target_os=$(tolower $(uname -s))
1094 # configurable options
1095 enable debug
1096 enable ffmpeg
1097 enable ffplay
1098 enable ffserver
1099 enable ipv6
1100 enable mpegaudio_hp
1101 enable network
1102 enable oldscaler
1103 enable optimizations
1104 enable protocols
1105 enable static
1106 enable stripping
1107 vhook="default"
1109 # build settings
1110 add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
1111 SHFLAGS='-shared -Wl,-soname,$$(@F)'
1112 VHOOKSHFLAGS='$(SHFLAGS)'
1113 FFSERVERLDFLAGS=-Wl,-E
1114 LIBPREF="lib"
1115 LIBSUF=".a"
1116 FULLNAME='$(NAME)$(BUILDSUF)'
1117 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
1118 SLIBPREF="lib"
1119 SLIBSUF=".so"
1120 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
1121 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
1122 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
1123 LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
1125 host_cflags='-O3 -g -Wall'
1126 host_libs='-lm'
1128 target_path='.'
1130 # gcc stupidly only outputs the basename of targets with -MM, but we need the
1131 # full relative path for objects in subdirectories for non-recursive Make.
1132 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,"'
1134 # find source path
1135 source_path="`dirname \"$0\"`"
1136 enable source_path_used
1137 if test -z "$source_path" -o "$source_path" = "." ; then
1138 source_path="`pwd`"
1139 disable source_path_used
1140 else
1141 source_path="`cd \"$source_path\"; pwd`"
1142 echo "$source_path" | grep -q '[[:blank:]]' &&
1143 die "Out of tree builds are impossible with whitespace in source path."
1146 FFMPEG_CONFIGURATION="$@"
1148 find_things(){
1149 thing=$1
1150 pattern=$2
1151 file=$source_path/$3
1152 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
1155 ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
1156 DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
1157 PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
1158 BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
1159 MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
1160 DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
1161 OUTDEV_LIST=$(find_things muxer _MUX libavdevice/alldevices.c)
1162 INDEV_LIST=$(find_things demuxer DEMUX libavdevice/alldevices.c)
1163 PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
1164 FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
1166 enable $ARCH_EXT_LIST \
1167 $DECODER_LIST \
1168 $ENCODER_LIST \
1169 $PARSER_LIST \
1170 $BSF_LIST \
1171 $DEMUXER_LIST \
1172 $MUXER_LIST \
1173 $FILTER_LIST \
1174 $PROTOCOL_LIST \
1175 $INDEV_LIST \
1176 $OUTDEV_LIST \
1178 die_unknown(){
1179 echo "Unknown option \"$1\"."
1180 echo "See $0 --help for available options."
1181 exit 1
1184 show_list() {
1185 suffix=_$1
1186 shift
1187 echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
1188 exit 0
1191 for opt do
1192 optval="${opt#*=}"
1193 case "$opt" in
1194 --extra-cflags=*) add_cflags "$optval"
1196 --extra-ldflags=*) add_ldflags "$optval"
1198 --extra-libs=*) add_extralibs "$optval"
1200 --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
1202 --enable-debug=*) debuglevel="$optval"
1204 --enable-*=*|--disable-*=*)
1205 eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
1206 case "$thing" in
1207 encoder|decoder|muxer|demuxer|parser|bsf|protocol|filter) $action ${optval}_${thing} ;;
1208 *) die_unknown "$opt" ;;
1209 esac
1211 --enable-?*|--disable-?*)
1212 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
1213 if is_in $option $COMPONENT_LIST; then
1214 eval $action \$$(toupper ${option%s})_LIST
1215 elif is_in $option $CMDLINE_SELECT; then
1216 $action $option
1217 else
1218 die_unknown $opt
1221 --list-*)
1222 NAME="${opt#--list-}"
1223 is_in $NAME $COMPONENT_LIST || die_unknown $opt
1224 NAME=${NAME%s}
1225 eval show_list $NAME \$$(toupper $NAME)_LIST
1227 --help|-h) show_help
1230 optname="${opt%%=*}"
1231 optname="${optname#--}"
1232 optname=$(echo "$optname" | sed 's/-/_/g')
1233 is_in $optname $CMDLINE_SET || die_unknown $opt
1234 eval $optname='$optval'
1236 esac
1237 done
1239 disabled logging && logfile=/dev/null
1241 echo "# $0 $@" > $logfile
1242 set >> $logfile
1244 test -n "$cross_prefix" && enable cross_compile
1246 cc_default="${cross_prefix}${cc_default}"
1247 yasmexe="${cross_prefix}${yasmexe}"
1248 ar="${cross_prefix}${ar}"
1249 nm="${cross_prefix}${nm}"
1250 ranlib="${cross_prefix}${ranlib}"
1251 strip="${cross_prefix}${strip}"
1253 set_default cc
1254 enabled cross_compile || host_cc_default=$cc
1255 set_default host_cc
1257 # set temporary file name
1258 if test ! -z "$TMPDIR" ; then
1259 TMPDIR1="${TMPDIR}"
1260 elif test ! -z "$TEMPDIR" ; then
1261 TMPDIR1="${TEMPDIR}"
1262 else
1263 TMPDIR1="/tmp"
1266 TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
1267 TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
1268 TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
1269 TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
1270 TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
1271 TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
1273 check_cflags -std=c99
1275 case "$arch" in
1276 i386|i486|i586|i686|i86pc|BePC)
1277 arch="x86_32"
1278 enable fast_unaligned
1280 x86_64|amd64)
1281 arch="x86_32"
1282 enable cmov
1283 enable fast_cmov
1284 enable fast_unaligned
1285 check_cc <<EOF && enable fast_64bit && arch="x86_64"
1286 int test[sizeof(char*) - 7];
1289 # armv4l is a subset of armv[567]*l
1290 arm|armv[4567]*l)
1291 arch="armv4l"
1293 alpha)
1294 arch="alpha"
1295 enable fast_64bit
1297 "Power Macintosh"|ppc|powerpc)
1298 arch="powerpc"
1299 enable fast_unaligned
1301 ppc64)
1302 arch="powerpc"
1303 enable fast_64bit
1304 enable fast_unaligned
1306 mips|mipsel|IP*)
1307 arch="mips"
1309 sun4u|sparc64)
1310 arch="sparc64"
1311 enable fast_64bit
1313 sparc)
1314 arch="sparc"
1316 sh4)
1317 arch="sh4"
1319 parisc)
1320 arch="parisc"
1322 parisc64)
1323 arch="parisc"
1324 enable fast_64bit
1326 s390|s390x)
1327 arch="s390"
1329 m68k)
1330 arch="m68k"
1332 ia64)
1333 arch="ia64"
1334 enable fast_64bit
1336 bfin)
1337 arch="bfin"
1340 arch="unknown"
1342 esac
1344 enable $arch
1345 enabled_any x86_32 x86_64 && enable x86
1346 enabled sparc64 && enable sparc
1348 # OS specific
1349 case $target_os in
1350 beos|haiku|zeta)
1351 prefix_default="$HOME/config"
1352 # helps building libavcodec
1353 add_cflags "-DPIC -fomit-frame-pointer"
1354 # 3 gcc releases known for BeOS, each with ugly bugs
1355 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
1356 case "$gcc_version" in
1357 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
1358 disable mmx
1360 *20010315*) echo "BeBits gcc"
1361 add_cflags "-fno-expensive-optimizations"
1363 esac
1364 SHFLAGS=-nostart
1365 # enable BeOS things
1366 enable audio_beos
1367 # no need for libm, but the inet stuff
1368 # Check for BONE
1369 # XXX: actually should check for NOT net_server
1370 if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
1371 network_extralibs="-lbind -lsocket"
1372 else
1373 enable beos_netserver
1374 network_extralibs="-lnet"
1375 fi ;;
1376 sunos)
1377 FFSERVERLDFLAGS=""
1378 SHFLAGS='-shared -Wl,-h,$$(@F)'
1379 network_extralibs="-lsocket -lnsl"
1381 netbsd)
1382 oss_demuxer_extralibs="-lossaudio"
1383 oss_muxer_extralibs="-lossaudio"
1385 openbsd)
1386 disable need_memalign
1387 LIBOBJFLAGS='$(PIC)'
1388 SHFLAGS='-shared'
1389 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
1390 SLIBNAME_WITH_VERSION='$(SLIBNAME)'
1391 SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
1392 oss_demuxer_extralibs="-lossaudio"
1393 oss_muxer_extralibs="-lossaudio"
1395 freebsd)
1396 disable need_memalign
1398 bsd/os)
1399 osextralibs="-lpoll -lgnugetopt"
1400 strip="strip -d"
1402 darwin)
1403 disable need_memalign
1404 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
1405 VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$$(@F)'
1406 strip="strip -x"
1407 FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
1408 SLIBSUF=".dylib"
1409 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
1410 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
1411 FFSERVERLDFLAGS=-Wl,-bind_at_load
1412 objformat="macho"
1413 enabled x86_64 && objformat="macho64"
1415 mingw32*)
1416 target_os=mingw32
1417 LIBTARGET=i386
1418 if test $arch = x86_64; then
1419 disable need_memalign
1420 LIBTARGET=x64
1422 shlibdir_default="$bindir_default"
1423 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
1424 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
1425 if enabled swscale; then
1426 VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
1427 VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
1429 disable ffserver
1430 SLIBPREF=""
1431 SLIBSUF=".dll"
1432 EXESUF=".exe"
1433 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
1434 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
1435 SLIB_EXTRA_CMD='-lib /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
1436 SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
1437 install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
1438 SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
1439 SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
1440 objformat="win32"
1441 enable dos_paths
1442 check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
1443 die "ERROR: MinGW runtime version must be >= 3.15."
1444 enabled_any avisynth vfwcap_demuxer &&
1445 { check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 12)" ||
1446 die "ERROR: avisynth and vfwcap_demuxer require w32api version 3.12 or later."; }
1448 cygwin*)
1449 target_os=cygwin
1450 shlibdir_default="$bindir_default"
1451 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
1452 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
1453 if enabled swscale; then
1454 VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
1455 VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
1457 EXESUF=".exe"
1458 SLIBPREF="cyg"
1459 SLIBSUF=".dll"
1460 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
1461 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
1462 SHFLAGS='-shared -Wl,--enable-auto-image-base'
1463 objformat="win32"
1464 enable dos_paths
1466 *-dos|freedos|opendos)
1467 disable ffplay ffserver vhook
1468 disable $INDEV_LIST $OUTDEV_LIST
1469 network_extralibs="-lsocket"
1470 EXESUF=".exe"
1471 objformat="win32"
1472 enable dos_paths
1474 linux)
1475 enable dv1394
1477 irix*)
1478 target_os=irix
1479 ranlib="echo ignoring ranlib"
1481 os/2*)
1482 strip="lxlite"
1483 ln_s="cp -f"
1484 EXESUF=".exe"
1485 FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
1486 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
1487 FFSERVERLDFLAGS=""
1488 LIBSUF="_s.a"
1489 SLIBPREF=""
1490 SLIBSUF=".dll"
1491 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
1492 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
1493 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
1494 echo PROTMODE >> $(SUBDIR)$(NAME).def; \
1495 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
1496 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
1497 echo EXPORTS >> $(SUBDIR)$(NAME).def; \
1498 emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
1499 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
1500 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
1501 SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
1502 SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
1503 disable vhook
1504 enable dos_paths
1506 interix)
1507 disable vhook
1511 target_os="${target_os}-UNKNOWN"
1513 esac
1515 set_default $PATHS_LIST
1517 add_extralibs $osextralibs
1519 # Combine FFLDFLAGS and the LDFLAGS environment variable.
1520 LDFLAGS="$FFLDFLAGS $LDFLAGS"
1522 # we need to build at least one lib type
1523 if ! enabled_any static shared; then
1524 cat <<EOF
1525 At least one library type must be built.
1526 Specify --enable-static to build the static libraries or --enable-shared to
1527 build the shared libraries as well. To only build the shared libraries specify
1528 --disable-static in addition to --enable-shared.
1530 exit 1;
1533 disabled static && LIBNAME=""
1535 if enabled_any libfaad libfaadbin ; then
1536 if check_header faad.h; then
1537 check_cc <<EOF
1538 #include <faad.h>
1539 #ifndef FAAD2_VERSION
1540 ok faad1
1541 #endif
1542 int main(void) { return 0; }
1544 test $? = 0 && enable libfaad2
1545 else
1546 die "FAAD test failed."
1551 if ! enabled gpl; then
1552 die_gpl_disabled(){
1553 name=$1
1554 shift
1555 enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
1557 die_gpl_disabled "The Postprocessing code" postproc
1558 die_gpl_disabled "libx264" libx264
1559 die_gpl_disabled "libxvidcore" libxvid
1560 die_gpl_disabled "FAAD2" libfaad2
1561 die_gpl_disabled "The X11 grabber" x11grab
1562 die_gpl_disabled "The software scaler" swscale
1565 if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
1566 die "libamr is nonfree and --enable-nonfree is not specified."
1569 check_deps $ARCH_EXT_LIST
1571 test -z "$need_memalign" && need_memalign="$mmx"
1573 #Darwin CC versions
1574 if test $target_os = darwin; then
1575 if $cc -v 2>&1 | grep -q xlc; then
1576 add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
1577 else
1578 add_cflags "-pipe"
1579 check_cflags "-force_cpusubtype_ALL"
1580 check_cflags "-Wno-sign-compare"
1581 enabled shared || check_cflags -mdynamic-no-pic
1585 disabled optimizations || check_cflags -fomit-frame-pointer
1587 # Add processor-specific flags
1588 if test $cpu != "generic"; then
1589 warn_altivec(){
1590 $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
1592 case $cpu in
1593 601|ppc601|PowerPC601)
1594 add_cflags "-mcpu=601"
1595 warn_altivec enabled PPC601
1597 603*|ppc603*|PowerPC603*)
1598 add_cflags "-mcpu=603"
1599 warn_altivec enabled PPC603
1601 604*|ppc604*|PowerPC604*)
1602 add_cflags "-mcpu=604"
1603 warn_altivec enabled PPC604
1605 G3|g3|75*|ppc75*|PowerPC75*)
1606 add_cflags "-mcpu=750 -mpowerpc-gfxopt"
1607 warn_altivec enabled PPC75x
1609 G4|g4|745*|ppc745*|PowerPC745*)
1610 add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
1611 warn_altivec disabled PPC745x
1613 74*|ppc74*|PowerPC74*)
1614 add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
1615 warn_altivec disabled PPC74xx
1617 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
1618 add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
1619 warn_altivec disabled PPC970
1620 enable ppc64
1622 Cell|CELL|cell)
1623 add_cflags "-mcpu=cell"
1624 warn_altivec disabled Cell
1625 enable ppc64
1627 # targets that do NOT support conditional mov (cmov)
1628 i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
1629 add_cflags "-march=$cpu"
1630 disable cmov
1632 # targets that do support conditional mov (cmov)
1633 i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
1634 add_cflags "-march=$cpu"
1635 enable cmov
1636 enable fast_cmov
1638 # targets that do support conditional mov but on which it's slow
1639 pentium4|pentium4m|prescott|nocona)
1640 add_cflags "-march=$cpu"
1641 enable cmov
1642 disable fast_cmov
1644 sparc64)
1645 add_cflags "-mcpu=v9"
1647 arm11*|cortex*)
1648 add_cflags "-mcpu=$cpu"
1649 enable fast_unaligned
1651 armv*)
1652 add_cflags "-march=$cpu"
1654 arm*)
1655 add_cflags "-mcpu=$cpu"
1658 echo "WARNING: Unknown CPU \"$cpu\", ignored."
1660 esac
1663 # make sure we can execute files in $TMPDIR
1664 cat > $TMPSH 2>> $logfile <<EOF
1665 #! /bin/sh
1667 chmod +x $TMPSH >> $logfile 2>&1
1668 if ! $TMPSH >> $logfile 2>&1; then
1669 cat <<EOF
1670 Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
1671 variable to another directory and make sure that $TMPDIR1 is not mounted
1672 noexec.
1674 die "Sanity test failed."
1676 rm $TMPSH
1678 # compiler sanity check
1679 check_exec <<EOF
1680 int main(void){ return 0; }
1682 if test "$?" != 0; then
1683 echo "$cc is unable to create an executable file."
1684 if test -z "$cross_prefix" && ! enabled cross_compile ; then
1685 echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
1686 echo "Only do this if you know what cross compiling means."
1688 die "C compiler test failed."
1691 check_cc <<EOF || die "Symbol mangling check failed."
1692 int ff_extern;
1694 sym=$($nm -P -g $TMPO | grep ff_extern)
1695 extern_prefix=${sym%%ff_extern*}
1697 check_asm inline_asm '""'
1699 if enabled x86; then
1700 # check whether EBP is available on x86
1701 # As 'i' is stored on the stack, this program will crash
1702 # if the base pointer is used to access it because the
1703 # base pointer is cleared in the inline assembly code.
1704 check_exec_crash <<EOF && enable ebp_available
1705 volatile int i=0;
1706 __asm__ volatile (
1707 "xorl %%ebp, %%ebp"
1708 ::: "%ebp");
1709 return i;
1712 # check wether EBX is available on x86
1713 check_asm ebx_available '"":::"%ebx"'
1715 # check whether binutils is new enough to compile SSSE3/MMX2
1716 enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
1717 enabled mmx2 && check_asm mmx2 '"movss %xmm0, %xmm0"'
1719 check_asm bswap '"bswap %%eax" ::: "%eax"'
1721 YASMFLAGS="-f $objformat -DARCH_$(toupper $arch)"
1722 enabled x86_64 && append YASMFLAGS "-m amd64"
1723 enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
1724 case "$objformat" in
1725 elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
1726 macho64) append YASMFLAGS "-DPIC -DPREFIX" ;;
1727 *) append YASMFLAGS "-DPREFIX" ;;
1728 esac
1729 check_yasm "pabsw xmm0, xmm0" && enable yasm
1732 # check for assembler specific support
1734 if test $arch = "powerpc"; then
1735 check_asm dcbzl '"dcbzl 0, 1"'
1738 # check for SIMD availability
1740 # AltiVec flags: The FSF version of GCC differs from the Apple version
1741 if enabled altivec; then
1742 check_cflags -maltivec -mabi=altivec &&
1743 { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
1744 check_cflags -faltivec
1746 # check if our compiler supports Motorola AltiVec C API
1747 check_cc <<EOF || disable altivec
1748 $inc_altivec_h
1749 int main(void) {
1750 vector signed int v1, v2, v3;
1751 v1 = vec_add(v2,v3);
1752 return 0;
1756 # check if our compiler supports braces for vector declarations
1757 check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
1758 $inc_altivec_h
1759 int main (void) { (vector int) {1}; return 0; }
1763 # We have to check if pld is a nop and disable it.
1764 enabled armv4l && check_asm pld '"pld [r0]"'
1765 enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
1766 enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
1767 enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
1768 enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
1769 enabled mmi && check_asm mmi '"lq $2, 0($2)"'
1770 enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
1771 enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
1773 enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
1775 # ---
1776 # big/little-endian test
1777 check_cc <<EOF || die "endian test failed"
1778 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
1780 od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
1782 # ---
1783 # check availability of some header files
1785 if check_func dlopen; then
1786 ldl=
1787 elif check_func dlopen -ldl; then
1788 ldl=-ldl
1791 check_func fork
1792 check_func gethrtime
1793 check_func getrusage
1794 check_func inet_aton $network_extralibs
1795 check_func memalign
1796 check_func mkstemp
1797 check_func_headers windows.h GetProcessTimes
1799 check_header conio.h
1800 check_header dlfcn.h
1801 check_header malloc.h
1802 check_header poll.h
1803 check_header sys/mman.h
1804 check_header sys/resource.h
1805 check_header sys/select.h
1806 check_header termios.h
1808 if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
1809 die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
1812 disabled zlib || check_lib zlib.h zlibVersion -lz || disable zlib
1813 disabled bzlib || check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
1815 # check for some common methods of building with pthread support
1816 # do this before the optional library checks as some of them require pthreads
1817 if enabled pthreads; then
1818 if check_func pthread_create; then
1820 elif check_func pthread_create -pthread; then
1821 add_cflags -pthread
1822 add_extralibs -pthread
1823 elif check_func pthread_create -pthreads; then
1824 add_cflags -pthreads
1825 add_extralibs -pthreads
1826 elif check_func pthread_create -lpthreadGC2; then
1827 add_extralibs -lpthreadGC2
1828 elif ! check_lib pthread.h pthread_create -lpthread; then
1829 die "ERROR: can't find pthreads library"
1833 for thread in $THREADS_LIST; do
1834 if enabled $thread; then
1835 test -n "$thread_type" &&
1836 die "ERROR: Only one thread type must be selected." ||
1837 thread_type="$thread"
1839 done
1841 check_lib math.h sin -lm
1843 # test for C99 functions in math.h
1844 for func in llrint lrint lrintf round roundf; do
1845 check_exec <<EOF && enable $func || disable $func
1846 #include <math.h>
1847 int main(void) { return ($func(3.999f) > 0)?0:1; }
1849 done
1851 # these are off by default, so fail if requested and not available
1852 enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
1853 enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
1854 enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
1855 enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
1856 require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder &&
1857 require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
1858 enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
1859 enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
1860 enabled libgsm && require libgsm gsm.h gsm_create -lgsm
1861 enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
1862 enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
1863 enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
1864 require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
1865 enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
1866 enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
1867 enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
1868 enabled libx264 && require libx264 x264.h x264_encoder_open -lx264 -lm &&
1869 { check_cpp_condition x264.h "X264_BUILD >= 65" ||
1870 die "ERROR: libx264 version must be >= 0.65."; }
1871 enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
1872 enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
1874 # libdc1394 check
1875 if enabled libdc1394; then
1876 { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
1877 enable libdc1394_2; } ||
1878 { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
1879 enable libdc1394_1; } ||
1880 die "ERROR: No version of libdc1394 found "
1884 _restrict=
1885 for restrict_keyword in restrict __restrict__ __restrict; do
1886 check_cc <<EOF && _restrict=$restrict_keyword && break
1887 void foo(char * $restrict_keyword p);
1889 done
1891 test "$vhook" = "default" && vhook="$dlopen"
1893 if test "$target_os" = cygwin -o "$target_os" = mingw32 && enabled_all static vhook ; then
1894 disable vhook
1895 echo
1896 echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
1897 echo "Patches welcome."
1898 echo
1901 if enabled vhook; then
1902 check_ldflags -rdynamic
1903 check_ldflags -export-dynamic
1906 check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
1907 check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
1909 ##########################################
1910 # SDL check
1912 disable sdl_too_old
1913 disable sdl
1914 SDL_CONFIG="${cross_prefix}sdl-config"
1915 if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
1916 sdl_cflags=`"${SDL_CONFIG}" --cflags`
1917 temp_cflags $sdl_cflags
1918 temp_extralibs `"${SDL_CONFIG}" --libs`
1919 if check_lib2 SDL.h SDL_Init; then
1920 _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
1921 if test "$_sdlversion" -lt 121 ; then
1922 enable sdl_too_old
1923 else
1924 enable sdl
1925 check_cc $sdl_cflags <<EOF && enable sdl_video_size
1926 #include <SDL.h>
1927 int main(int argc, char **argv){
1928 const SDL_VideoInfo *vi = SDL_GetVideoInfo();
1929 int w = vi->current_w;
1930 return 0;
1935 restore_flags
1938 texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
1940 ##########################################
1941 # Network check
1943 if enabled network; then
1944 check_type sys/socket.h socklen_t
1945 # Prefer arpa/inet.h over winsock2
1946 if check_header arpa/inet.h ; then
1947 check_func closesocket
1948 elif check_header winsock2.h ; then
1949 network_extralibs="-lws2_32"
1950 check_type ws2tcpip.h socklen_t
1951 check_func_headers winsock2.h closesocket
1955 ##########################################
1956 # IPv6 check
1958 enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
1959 #include <sys/types.h>
1960 #include <sys/socket.h>
1961 #include <netinet/in.h>
1962 #include <netdb.h>
1963 int main(void) {
1964 struct sockaddr_storage saddr;
1965 struct ipv6_mreq mreq6;
1966 getaddrinfo(0,0,0,0);
1967 getnameinfo(0,0,0,0,0,0,0);
1968 IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
1972 check_header linux/videodev.h
1973 check_header linux/videodev2.h
1974 check_header sys/videoio.h
1976 check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
1978 # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
1979 { check_header dev/bktr/ioctl_meteor.h &&
1980 check_header dev/bktr/ioctl_bt848.h; } ||
1981 { check_header machine/ioctl_meteor.h &&
1982 check_header machine/ioctl_bt848.h; } ||
1983 { check_header dev/video/meteor/ioctl_meteor.h &&
1984 check_header dev/video/bktr/ioctl_bt848.h; } ||
1985 check_header dev/ic/bt8xx.h
1987 check_header sys/soundcard.h
1988 check_header soundcard.h
1990 # deal with the X11 frame grabber
1991 enabled x11grab &&
1992 check_header X11/Xlib.h &&
1993 check_header X11/extensions/XShm.h &&
1994 check_func XOpenDisplay -lX11 &&
1995 check_func XShmCreateImage -lX11 -lXext
1997 enabled debug && add_cflags -g"$debuglevel"
1999 # add some useful compiler flags if supported
2000 check_cflags -Wdeclaration-after-statement
2001 check_cflags -Wall
2002 check_cflags -Wno-switch
2003 check_cflags -Wdisabled-optimization
2004 check_cflags -Wpointer-arith
2005 check_cflags -Wredundant-decls
2006 check_cflags -Wno-pointer-sign
2007 check_cflags -Wcast-qual
2008 check_cflags -Wwrite-strings
2009 check_cflags -Wtype-limits
2010 enabled extra_warnings && check_cflags -Winline
2012 # add some linker flags
2013 check_ldflags -Wl,--warn-common
2014 check_ldflags -Wl,--as-needed
2015 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'
2016 check_ldflags -Wl,-Bsymbolic
2018 if enabled small; then
2019 check_cflags -Os # not all compilers support -Os
2020 optimizations="small"
2021 elif enabled optimizations; then
2022 if $cc -v 2>&1 | grep -q xlc; then
2023 add_cflags "-O5"
2024 add_ldflags "-O5"
2025 else
2026 add_cflags "-O3"
2029 check_cflags -fno-math-errno
2030 check_cflags -fno-signed-zeros
2032 # add some flags for Intel C Compiler
2033 if $cc --version 2> /dev/null | grep -q Intel; then
2034 # Just warnings, no remarks
2035 check_cflags -w1
2036 # -wd: Disable following warnings
2037 # 144, 167, 556: -Wno-pointer-sign
2038 # 10006: ignoring unknown option -fno-signed-zeros
2039 # 10156: ignoring option '-W'; no argument required
2040 check_cflags -wd144,167,556,10006,10156
2041 # 11030: Warning unknown option --as-needed
2042 # 10156: ignoring option '-export'; no argument required
2043 check_ldflags -wd10156,11030
2044 # Allow to compile with optimizations
2045 check_ldflags -march=$cpu
2048 # PIC flags for shared library objects where they are needed
2049 if enabled shared; then
2050 # LIBOBJFLAGS may have already been set in the OS configuration
2051 if test -z "$LIBOBJFLAGS" ; then
2052 case "$arch" in
2053 x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
2054 esac
2058 if enabled gprof; then
2059 add_cflags "-p"
2060 add_ldflags "-p"
2063 VHOOKCFLAGS="-fPIC"
2065 # Find out if the .align argument is a power of two or not.
2066 if test $asmalign_pot = "unknown"; then
2067 disable asmalign_pot
2068 echo '__asm__ (".align 3");' | check_cc && enable asmalign_pot
2071 enabled_any $DECODER_LIST && enable decoders
2072 enabled_any $ENCODER_LIST && enable encoders
2073 enabled_any $BSF_LIST && enable bsfs
2074 enabled_any $DEMUXER_LIST && enable demuxers
2075 enabled_any $MUXER_LIST && enable muxers
2076 enabled_any $FILTER_LIST && enable filters
2077 enabled_any $INDEV_LIST && enable demuxers
2078 enabled_any $OUTDEV_LIST && enable muxers
2079 enabled_any $PROTOCOL_LIST && enable protocols
2081 enabled_any $THREADS_LIST && enable threads
2083 check_deps $CONFIG_LIST \
2084 $CONFIG_EXTRA \
2085 $HAVE_LIST \
2086 $DECODER_LIST \
2087 $ENCODER_LIST \
2088 $PARSER_LIST \
2089 $BSF_LIST \
2090 $DEMUXER_LIST \
2091 $MUXER_LIST \
2092 $FILTER_LIST \
2093 $INDEV_LIST \
2094 $OUTDEV_LIST \
2095 $PROTOCOL_LIST \
2097 enabled libdc1394 && append pkg_requires "libraw1394"
2098 enabled libdirac && append pkg_requires "dirac"
2099 enabled libtheora && append pkg_requires "theora"
2100 enabled libvorbis && append pkg_requires "vorbisenc"
2102 echo "install prefix $prefix"
2103 echo "source path $source_path"
2104 echo "C compiler $cc"
2105 echo ".align is power-of-two $asmalign_pot"
2106 echo "ARCH $arch ($cpu)"
2107 if test "$build_suffix" != ""; then
2108 echo "build suffix $build_suffix"
2110 if test "$extra_version" != ""; then
2111 echo "version string suffix $extra_version"
2113 echo "big-endian ${bigendian-no}"
2114 if test $arch = "x86_32" -o $arch = "x86_64"; then
2115 echo "yasm ${yasm-no}"
2116 echo "MMX enabled ${mmx-no}"
2117 echo "CMOV enabled ${cmov-no}"
2118 echo "CMOV is fast ${fast_cmov-no}"
2119 echo "EBX available ${ebx_available-no}"
2120 echo "EBP available ${ebp_available-no}"
2122 if test $arch = "armv4l"; then
2123 echo "ARMv5TE enabled ${armv5te-no}"
2124 echo "ARMv6 enabled ${armv6-no}"
2125 echo "ARM VFP enabled ${armvfp-no}"
2126 echo "IWMMXT enabled ${iwmmxt-no}"
2127 echo "NEON enabled ${neon-no}"
2129 if test $arch = "mips"; then
2130 echo "MMI enabled ${mmi-no}"
2132 if test $arch = "powerpc"; then
2133 echo "AltiVec enabled ${altivec-no}"
2134 echo "dcbzl available ${dcbzl-no}"
2136 echo "gprof enabled ${gprof-no}"
2137 echo "debug symbols ${debug-no}"
2138 echo "strip symbols ${stripping-no}"
2139 echo "optimizations ${optimizations-no}"
2140 echo "static ${static-no}"
2141 echo "shared ${shared-no}"
2142 echo "postprocessing support ${postproc-no}"
2143 echo "software scaler enabled ${swscale-no}"
2144 echo "new filter support ${avfilter-no}"
2145 echo "filters using lavformat ${avfilter_lavf-no}"
2146 echo "video hooking ${vhook-no}"
2147 if enabled vhook; then
2148 echo "Imlib2 support ${imlib2-no}"
2149 echo "FreeType support ${freetype2-no}"
2151 echo "network support ${network-no}"
2152 if enabled network; then
2153 echo "IPv6 support ${ipv6-no}"
2155 echo "threading support ${thread_type-no}"
2156 echo "SDL support ${sdl-no}"
2157 if enabled sdl_too_old; then
2158 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
2160 echo "Sun medialib support ${mlib-no}"
2161 echo "AVISynth enabled ${avisynth-no}"
2162 echo "libamr-nb support ${libamr_nb-no}"
2163 echo "libamr-wb support ${libamr_wb-no}"
2164 echo "libdc1394 support ${libdc1394-no}"
2165 echo "libdirac enabled ${libdirac-no}"
2166 echo "libfaac enabled ${libfaac-no}"
2167 echo "libfaad enabled ${libfaad-no}"
2168 echo "libfaad dlopened ${libfaadbin-no}"
2169 echo "libgsm enabled ${libgsm-no}"
2170 echo "libmp3lame enabled ${libmp3lame-no}"
2171 echo "libnut enabled ${libnut-no}"
2172 echo "libschroedinger enabled ${libschroedinger-no}"
2173 echo "libspeex enabled ${libspeex-no}"
2174 echo "libtheora enabled ${libtheora-no}"
2175 echo "libvorbis enabled ${libvorbis-no}"
2176 echo "libx264 enabled ${libx264-no}"
2177 echo "libxvid enabled ${libxvid-no}"
2178 echo "zlib enabled ${zlib-no}"
2179 echo "bzlib enabled ${bzlib-no}"
2180 echo
2182 for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
2183 echo "Enabled ${type}s:"
2184 eval list=\$$(toupper $type)_LIST
2185 for part in $list; do
2186 enabled $part && echo ${part%_*}
2187 done | sort | pr -3 -t
2188 echo
2189 done
2191 license="LGPL"
2192 if enabled nonfree; then
2193 license="unredistributable"
2194 elif enabled gpl; then
2195 license="GPL"
2198 echo "License: $license"
2200 echo "Creating config.mak and config.h..."
2202 echo "# Automatically generated by configure - do not modify!" > config.mak
2203 echo "/* Automatically generated by configure - do not modify! */" > $TMPH
2204 echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
2205 echo "#define FFMPEG_CONFIG_H" >> $TMPH
2206 echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
2208 echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
2209 echo "prefix=$prefix" >> config.mak
2210 echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
2211 echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
2212 echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
2213 echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
2214 echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
2215 echo "CC=$cc" >> config.mak
2216 echo "YASM=$yasmexe" >> config.mak
2217 echo "AR=$ar" >> config.mak
2218 echo "RANLIB=$ranlib" >> config.mak
2219 echo "LN_S=$ln_s" >> config.mak
2220 enabled stripping &&
2221 echo "STRIP=$strip" >> config.mak ||
2222 echo "STRIP=echo ignoring strip" >> config.mak
2224 echo "OPTFLAGS=$CFLAGS" >> config.mak
2225 echo "VHOOKCFLAGS=$VHOOKCFLAGS" >> config.mak
2226 echo "LDFLAGS=$LDFLAGS" >> config.mak
2227 echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
2228 echo "SHFLAGS=$SHFLAGS" >> config.mak
2229 echo "YASMFLAGS=$YASMFLAGS" >> config.mak
2230 echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
2231 echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
2232 echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
2233 echo "BUILD_STATIC=$static" >> config.mak
2234 echo "BUILDSUF=$build_suffix" >> config.mak
2235 echo "FULLNAME=$FULLNAME" >> config.mak
2236 echo "LIBPREF=$LIBPREF" >> config.mak
2237 echo "LIBSUF=$LIBSUF" >> config.mak
2238 echo "LIBNAME=$LIBNAME" >> config.mak
2239 echo "SLIBPREF=$SLIBPREF" >> config.mak
2240 echo "SLIBSUF=$SLIBSUF" >> config.mak
2241 echo "EXESUF=$EXESUF" >> config.mak
2242 echo "EXTRA_VERSION=$extra_version" >> config.mak
2243 echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
2244 echo "HOSTCC=$host_cc" >> config.mak
2245 echo "HOSTCFLAGS=$host_cflags" >> config.mak
2246 echo "HOSTLDFLAGS=$host_ldflags" >> config.mak
2247 echo "HOSTLIBS=$host_libs" >> config.mak
2248 echo "TARGET_EXEC=$target_exec" >> config.mak
2249 echo "TARGET_PATH=$target_path" >> config.mak
2251 if enabled bigendian; then
2252 echo "WORDS_BIGENDIAN=yes" >> config.mak
2253 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
2256 if enabled sdl; then
2257 echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
2258 echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
2260 if enabled texi2html; then
2261 echo "BUILD_DOC=yes" >> config.mak
2264 get_version(){
2265 name=$1
2266 file=$source_path/$2
2267 eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
2268 eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
2269 lcname=$(tolower $name)
2270 eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
2271 eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
2274 get_version LIBSWSCALE libswscale/swscale.h
2275 get_version LIBPOSTPROC libpostproc/postprocess.h
2276 get_version LIBAVCODEC libavcodec/avcodec.h
2277 get_version LIBAVDEVICE libavdevice/avdevice.h
2278 get_version LIBAVFORMAT libavformat/avformat.h
2279 get_version LIBAVUTIL libavutil/avutil.h
2280 get_version LIBAVFILTER libavfilter/avfilter.h
2282 if enabled shared; then
2283 echo "BUILD_SHARED=yes" >> config.mak
2284 echo "PIC=-fPIC -DPIC" >> config.mak
2285 echo "LIBTARGET=${LIBTARGET}" >> config.mak
2286 echo "SLIBNAME=${SLIBNAME}" >> config.mak
2287 echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
2288 echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
2289 echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
2290 echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
2291 echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
2292 echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
2294 echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
2295 echo "EXTRALIBS=$extralibs" >> config.mak
2297 print_config ARCH_ $TMPH config.mak $ARCH_LIST
2298 print_config HAVE_ $TMPH config.mak $HAVE_LIST
2299 print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
2300 $CONFIG_EXTRA \
2301 $DECODER_LIST \
2302 $ENCODER_LIST \
2303 $PARSER_LIST \
2304 $BSF_LIST \
2305 $DEMUXER_LIST \
2306 $MUXER_LIST \
2307 $FILTER_LIST \
2308 $PROTOCOL_LIST \
2309 $INDEV_LIST \
2310 $OUTDEV_LIST \
2312 echo "#define restrict $_restrict" >> $TMPH
2314 if enabled small; then
2315 echo "#define av_always_inline" >> $TMPH
2318 echo "SRC_PATH=\"$source_path\"" >> config.mak
2319 echo "SRC_PATH_BARE=$source_path" >> config.mak
2320 echo "BUILD_ROOT=\"$PWD\"" >> config.mak
2322 # Apparently it's not possible to portably echo a backslash.
2323 enabled asmalign_pot &&
2324 printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
2325 printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
2327 echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
2329 echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
2331 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
2332 cmp -s $TMPH config.h &&
2333 echo "config.h is unchanged" ||
2334 mv -f $TMPH config.h
2336 rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
2338 # build tree in object directory if source path is different from current one
2339 if enabled source_path_used; then
2340 DIRS="\
2341 doc \
2342 libavcodec \
2343 libavcodec/alpha \
2344 libavcodec/armv4l \
2345 libavcodec/bfin \
2346 libavcodec/i386 \
2347 libavcodec/mlib \
2348 libavcodec/ppc \
2349 libavcodec/sh4 \
2350 libavcodec/sparc \
2351 libavdevice \
2352 libavfilter \
2353 libavformat \
2354 libavutil \
2355 libpostproc \
2356 libswscale \
2357 tests \
2358 tools \
2359 vhook \
2361 FILES="\
2362 Makefile \
2363 common.mak \
2364 subdir.mak \
2365 doc/texi2pod.pl \
2366 libavcodec/Makefile \
2367 libavdevice/Makefile \
2368 libavfilter/Makefile \
2369 libavformat/Makefile \
2370 libavutil/Makefile \
2371 libpostproc/Makefile \
2372 libswscale/Makefile \
2374 for dir in $DIRS ; do
2375 mkdir -p $dir
2376 done
2377 for f in $FILES ; do
2378 $ln_s "$source_path/$f" $f
2379 done
2383 # build pkg-config files
2385 pkgconfig_generate(){
2386 name=$1
2387 shortname=${name#lib}${build_suffix}
2388 comment=$2
2389 version=$3
2390 libs=$4
2391 requires=$5
2392 cat <<EOF > $name/$name.pc
2393 prefix=$prefix
2394 exec_prefix=\${prefix}
2395 libdir=$libdir
2396 includedir=$incdir
2398 Name: $name
2399 Description: $comment
2400 Version: $version
2401 Requires: $(disabled shared && echo $requires)
2402 Requires.private: $(enabled shared && echo $requires)
2403 Conflicts:
2404 Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
2405 Libs.private: $(enabled shared && echo $libs)
2406 Cflags: -I\${includedir}
2408 cat <<EOF > $name/$name-uninstalled.pc
2409 prefix=
2410 exec_prefix=
2411 libdir=\${pcfiledir}
2412 includedir=${source_path}
2414 Name: $name
2415 Description: $comment
2416 Version: $version
2417 Requires: $requires
2418 Conflicts:
2419 Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
2420 Cflags: -I\${includedir}
2424 pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
2425 pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
2426 pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2427 pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
2428 enabled avfilter &&
2429 pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
2430 enabled postproc &&
2431 pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
2432 if enabled swscale; then
2433 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
2434 else
2435 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2436 apply libswscale/libswscale.pc sed s/^Libs:.*$/Libs:/