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