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