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