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