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