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