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