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