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