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