3 # FFmpeg configure script
5 # Copyright (c) 2000, 2001, 2002 Fabrice Bellard
6 # Copyright (c) 2005-2006 Diego Biurrun
7 # Copyright (c) 2005-2006 Mans Rullgard
10 # make sure we are running under a compatible shell
11 # try to make this part work with most shells
14 echo "Trying shell $1"
15 type "$1" >/dev/null 2>&1 && exec "$@"
19 (: ${foo%%bar}) 2>/dev/null
22 (: ${foo?}) 2>/dev/null
25 if test "$E1" != 0 || test "$E2" = 0; then
26 echo "Broken shell detected. Trying alternatives."
28 if test "0$FF_CONF_EXEC" -lt 1; then
30 try_exec bash "$0" "$@"
32 if test "0$FF_CONF_EXEC" -lt 2; then
34 try_exec ksh "$0" "$@"
36 if test "0$FF_CONF_EXEC" -lt 3; then
38 try_exec /usr/xpg4/bin/sh "$0" "$@"
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."
51 echo "Usage: configure [options]"
52 echo "Options: [defaults in brackets after descriptions]"
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]"
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"
153 echo "NOTE: Object files are built at the place where configure is launched."
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.
179 if enabled logging; then
181 Include the log file "$logfile" produced by configure as this will help
186 Rerun configure with logging enabled (do not use --log=no), and include the
187 log this produces with your report.
190 rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
194 # "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z"
196 echo "$@" | tr '[a-z]' '[A-Z]'
216 eval test "x\$$1" = "xyes"
221 enabled $opt || return 1
227 enabled $opt && return 0
237 if enabled $cfg; then
238 ucname="${pfx}`toupper $cfg`"
239 echo "#define ${ucname} 1" >> $header
240 echo "${ucname}=yes" >> $makefile
246 (: ${SAVE_CFLAGS?}) 2>/dev/null
250 flags_saved && return
251 SAVE_CFLAGS="$CFLAGS"
252 SAVE_LDFLAGS="$LDFLAGS"
253 SAVE_extralibs="$extralibs"
257 CFLAGS="$SAVE_CFLAGS"
258 LDFLAGS="$SAVE_LDFLAGS"
259 extralibs="$SAVE_extralibs"
272 LDFLAGS="$LDFLAGS $*"
277 extralibs="$extralibs $*"
283 flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
284 eval "$var=\"\$$var $*\""
296 append extralibs "$@"
308 check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
315 check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
321 check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
325 log check_cflags "$@"
326 check_cc "$@" <<EOF && add_cflags "$@"
332 log check_ldflags "$@"
333 check_ld "$@" <<EOF && add_ldflags "$@"
341 log check_header "$@"
349 var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
350 test "$err" = 0 && enable $var || disable $var
365 test "$err" = 0 && enable $func || disable $func
375 check_header $header && check_func $func && add_extralibs "$@"
382 check_ld "$@" && { test "$cross_compile" = yes || $TMPE >>$logfile 2>&1; }
390 check_lib $header $func "$@" || die "ERROR: $name not found"
466 # set temporary file name
467 if test ! -z "$TMPDIR" ; then
469 elif test ! -z "$TEMPDIR" ; then
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"
485 libdir='${PREFIX}/lib'
487 incdir='${PREFIX}/include/ffmpeg'
488 mandir='${PREFIX}/man'
489 bindir='${PREFIX}/bin'
509 i386|i486|i586|i686|i86pc|BePC)
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
521 # armv4l is a subset of armv[567]*l
528 "Power Macintosh"|ppc|ppc64|powerpc)
604 SHFLAGS='-shared -Wl,-soname,$@'
605 VHOOKSHFLAGS='$(SHFLAGS)'
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
618 LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
621 SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
622 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
623 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
635 asmalign_pot="unknown"
636 LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
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"
651 *20010315*) echo "BeBits gcc"
652 add_cflags "-fno-expensive-optimizations"
656 # disable Linux things
664 # no need for libm, but the inet stuff
666 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
667 extralibs="-lbind -lsocket"
680 SHFLAGS="-shared -Wl,-h,\$@"
681 add_extralibs "-lsocket -lnsl"
690 add_extralibs "-lossaudio"
699 LIBOBJFLAGS="\$(PIC)"
700 LDCONFIG="ldconfig -m \$(shlibdir)"
701 add_extralibs "-lossaudio"
711 add_cflags "-pthread"
719 add_cflags "-pthread"
727 extralibs="-lpoll -lgnugetopt -lm"
739 SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(shlibdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
740 VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(shlibdir)/vhook/$@'
744 FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
746 SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
747 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
748 FFSERVERLDFLAGS=-Wl,-bind_at_load
749 LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
752 # Note: the rest of the mingw32 config is done afterwards as mingw32
753 # can be forced on the command line for Linux cross compilation.
763 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
764 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
769 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
770 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
771 SHFLAGS='-shared -Wl,--out-implib=lib$(NAME).dll.a'
774 LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
778 ranlib="echo ignoring ranlib"
787 ranlib="echo ignoring ranlib"
788 strip="echo ignoring strip"
790 FFLDFLAGS="-Zomf -Zstack 16384 -s"
791 SHFLAGS="-Zdll -Zomf"
810 targetos="${targetos}-UNKNOWN"
815 source_path="`dirname \"$0\"`"
816 source_path_used="yes"
817 if test -z "$source_path" -o "$source_path" = "." ; then
819 source_path_used="no"
821 source_path="`cd \"$source_path\"; pwd`"
822 echo "$source_path" | grep -q '[[:blank:]]' &&
823 die "Out of tree builds are impossible with whitespace in source path."
826 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
830 FFMPEG_CONFIGURATION=" "
832 FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
835 ENCODER_LIST=`sed -n 's/^[^#]*ENC.*, *\(.*\)).*/\1_encoder/p' "$source_path/libavcodec/allcodecs.c"`
836 DECODER_LIST=`sed -n 's/^[^#]*DEC.*, *\(.*\)).*/\1_decoder/p' "$source_path/libavcodec/allcodecs.c"`
837 PARSER_LIST=`sed -n 's/^[^#]*PARSER.*, *\(.*\)).*/\1_parser/p' "$source_path/libavcodec/allcodecs.c"`
838 MUXER_LIST=`sed -n 's/^[^#]*_MUX.*, *\(.*\)).*/\1_muxer/p' "$source_path/libavformat/allformats.c"`
839 DEMUXER_LIST=`sed -n 's/^[^#]*DEMUX.*, *\(.*\)).*/\1_demuxer/p' "$source_path/libavformat/allformats.c"`
841 enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST
848 --log=*) logging="$optval"
850 --prefix=*) PREFIX="$optval"
852 --libdir=*) libdir="$optval"
854 --shlibdir=*) shlibdir="$optval"
856 --incdir=*) incdir="$optval"
858 --mandir=*) mandir="$optval"
860 --source-path=*) source_path="$optval"
862 --cross-prefix=*) cross_prefix="$optval"
864 --cross-compile) cross_compile=yes
868 --make=*) make="$optval"
870 --extra-cflags=*) add_cflags "$optval"
872 --extra-ldflags=*) add_ldflags "$optval"
874 --extra-libs=*) add_extralibs "$optval"
876 --build-suffix=*) BUILDSUF="$optval"
878 --arch=*) arch="$optval"
880 --cpu=*) cpu="$optval"
882 --powerpc-perf-enable) powerpc_perf="yes"
884 --disable-mmx) mmx="no"
886 --disable-armv5te) armv5te="no"
888 --disable-iwmmxt) iwmmxt="no"
890 --disable-altivec) altivec="no"
892 --enable-gprof) gprof="yes"
894 --disable-v4l) video4linux="no"
896 --disable-v4l2) video4linux2="no"
898 --disable-bktr) bktr="no"
900 --disable-audio-oss) audio_oss="no"
902 --disable-audio-beos) audio_beos="no"
904 --disable-dv1394) dv1394="no"
906 --disable-network) network="no"; ffserver="no"
908 --disable-ipv6) ipv6="no";
910 --disable-zlib) zlib="no"
912 --enable-a52) a52="yes"
914 --enable-a52bin) a52bin="yes"
916 --enable-dts) dts="yes"
918 --enable-pp) pp="yes"
920 --enable-libgsm) libgsm="yes"
922 --enable-mp3lame) mp3lame="yes"
924 --enable-libnut) libnut="yes"
926 --enable-libogg) libogg="yes"
927 pkg_requires="$pkg_requires ogg >= 1.1"
929 --enable-vorbis) libvorbis="yes"
930 pkg_requires="$pkg_requires vorbis vorbisenc"
932 --enable-faad) faad="yes"
934 --enable-faadbin) faadbin="yes"
936 --enable-faac) faac="yes"
938 --enable-xvid) xvid="yes"
940 --enable-x264) x264="yes"
942 --enable-avisynth) avisynth="yes";
944 --enable-dc1394) dc1394="yes"
945 pkg_requires="$pkg_requires libraw1394"
947 --disable-vhook) vhook="no"
949 --enable-mingw32) mingw32="yes"
951 --enable-mingwce) wince="yes"
953 --enable-static) lstatic="yes"
955 --disable-static) lstatic="no"
957 --enable-shared) lshared="yes"
959 --disable-shared) lshared="no"
961 --disable-debug) debug="no"
963 --disable-opts) optimize="no"
965 --enable-extra-warnings) extrawarnings="yes"
967 --disable-mpegaudio-hp) mpegaudio_hp="no"
969 --disable-protocols) protocols="no"; network="no"; ffserver="no"
971 --disable-ffmpeg) ffmpeg="no"
973 --disable-ffserver) ffserver="no"
975 --disable-ffplay) ffplay="no"
977 --enable-small) optimize="small"
979 --enable-amr_nb) amr="yes"; amr_nb="yes"; amr_nb_fixed="no"
981 --enable-amr_nb-fixed) amr="yes"; amr_nb_fixed="yes"; amr_nb="no"
983 --enable-amr_wb) amr="yes"; amr_wb="yes"
985 --enable-amr_if2) amr="yes"; amr_if2="yes"
987 --enable-sunmlib) mlib="yes"
989 --enable-pthreads) pthreads="yes"
991 --enable-swscaler) swscaler="yes"
993 --enable-gpl) gpl="yes"
995 --enable-memalign-hack) memalign_hack="yes"
997 --disable-strip) dostrip="no"
999 --enable-encoder=*) enable ${optval}_encoder
1001 --enable-decoder=*) enable ${optval}_decoder
1003 --disable-encoder=*) disable ${optval}_encoder
1005 --disable-decoder=*) disable ${optval}_decoder
1007 --disable-encoders) disable $ENCODER_LIST
1009 --disable-decoders) disable $DECODER_LIST
1011 --enable-muxer=*) enable ${optval}_muxer
1013 --disable-muxer=*) disable ${optval}_muxer
1015 --disable-muxers) disable $MUXER_LIST; ffserver="no"
1017 --enable-demuxer=*) enable ${optval}_demuxer
1019 --disable-demuxer=*) disable ${optval}_demuxer
1021 --disable-demuxers) disable $DEMUXER_LIST
1023 --enable-parser=*) enable ${optval}_parser
1025 --disable-parser=*) disable ${optval}_parser
1027 --disable-parsers) disable $PARSER_LIST
1032 echo "Unknown option \"$opt\"."
1033 echo "See $0 --help for available options."
1039 if test "$logging" != no; then
1040 test "$logging" = yes || logfile="$logging"
1041 echo "# $0 $@" >$logfile
1047 if test "$mingw32" = "yes" -o "$wince" = "yes"; then
1048 if test "$lshared" = "yes" && test "$lstatic" = "yes" ; then
1050 You can only build one library type at once on MinGW.
1051 Specify --disable-static --enable-shared to only build
1052 the shared libraries. To build only the static libraries
1053 you do not need to pass additional options.
1065 if enabled mingw32; then
1068 if test "$wince" = "yes"; then
1074 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
1075 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
1076 SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)"
1077 SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc"
1080 # Combine FFLDFLAGS and the LDFLAGS environment variable.
1081 LDFLAGS="$FFLDFLAGS $LDFLAGS"
1083 test -n "$cross_prefix" && cross_compile=yes
1084 cc="${cross_prefix}${cc}"
1085 ar="${cross_prefix}${ar}"
1086 ranlib="${cross_prefix}${ranlib}"
1087 strip="${cross_prefix}${strip}"
1089 # we need to build at least one lib type
1090 if test "$lstatic" = "no" && test "$lshared" = "no" ; then
1092 At least one library type must be built.
1093 Specify --enable-static to build the static libraries or --enable-shared to
1094 build the shared libraries as well. To only build the shared libraries specify
1095 --disable-static in addition to --enable-shared.
1100 if test "$libvorbis" = "yes" ; then
1101 if test "$libogg" = "no"; then
1102 echo "libogg must be enabled to enable Vorbis."
1107 if test "$gpl" != "yes"; then
1108 if test "$pp" != "no"; then
1109 echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
1113 if test "$a52" != "no" -o "$a52bin" != "no"; then
1114 echo "liba52 is under GPL and --enable-gpl is not specified."
1118 if test "$xvid" != "no"; then
1119 echo "libxvidcore is under GPL and --enable-gpl is not specified."
1123 if test "$x264" != "no"; then
1124 echo "x264 is under GPL and --enable-gpl is not specified."
1128 if test "$dts" != "no"; then
1129 echo "libdts is under GPL and --enable-gpl is not specified."
1133 if test "$faad" != "no" -o "$faadbin" != "no"; then
1134 if check_header faad.h; then
1137 #ifndef FAAD2_VERSION
1140 int main( void ) { return 0; }
1142 if test $? = 0 ; then
1143 echo "FAAD2 is under GPL and --enable-gpl is not specified."
1149 echo "FAAD test failed."
1153 if test "$swscaler" != "no"; then
1154 echo "The software scaler is under GPL and --enable-gpl is not specified."
1159 if test "$fail" = "yes"; then
1164 if test $mmx = "default"; then
1165 if test $arch = "x86_32" -o $arch = "x86_64"; then
1172 test -z "$need_memalign" && need_memalign="$mmx"
1175 needmdynamicnopic="no"
1176 if test $targetos = Darwin; then
1177 if test -n "`$cc -v 2>&1 | grep xlc`"; then
1178 add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
1180 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
1181 case "$gcc_version" in
1183 add_cflags "-no-cpp-precomp -pipe"
1186 add_cflags "-no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare"
1187 if test "$lshared" = no; then
1188 needmdynamicnopic="yes"
1192 add_cflags "-no-cpp-precomp -pipe"
1193 if test "$lshared" = no; then
1194 needmdynamicnopic="yes"
1201 if test $optimize != "no"; then
1202 add_cflags "-fomit-frame-pointer"
1205 # Can only do AltiVec on PowerPC
1206 if test $altivec = "default"; then
1207 if test $arch = "powerpc"; then
1214 # Add processor-specific flags
1215 POWERPCMODE="32bits"
1216 if test $cpu != "generic"; then
1218 601|ppc601|PowerPC601)
1219 add_cflags "-mcpu=601"
1220 if test $altivec = "yes"; then
1221 echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
1224 603*|ppc603*|PowerPC603*)
1225 add_cflags "-mcpu=603"
1226 if test $altivec = "yes"; then
1227 echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
1230 604*|ppc604*|PowerPC604*)
1231 add_cflags "-mcpu=604"
1232 if test $altivec = "yes"; then
1233 echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
1236 G3|g3|75*|ppc75*|PowerPC75*)
1237 add_cflags "-mcpu=750 -mpowerpc-gfxopt"
1238 if test $altivec = "yes"; then
1239 echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
1242 G4|g4|745*|ppc745*|PowerPC745*)
1243 add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
1244 if test $altivec = "no"; then
1245 echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
1248 74*|ppc74*|PowerPC74*)
1249 add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
1250 if test $altivec = "no"; then
1251 echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
1254 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
1255 add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
1256 if test $altivec = "no"; then
1257 echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
1259 POWERPCMODE="64bits"
1261 # targets that do NOT support conditional mov (cmov)
1262 i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
1263 add_cflags "-march=$cpu"
1266 # targets that do support conditional mov (cmov)
1267 i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx)
1268 add_cflags "-march=$cpu"
1272 # targets that do support conditional mov but on which it's slow
1273 pentium4|prescott|nocona)
1274 add_cflags "-march=$cpu"
1279 add_cflags "-mcpu=v9"
1282 echo "WARNING: Unknown CPU \"$cpu\", ignored."
1287 # make sure we can execute files in $TMPDIR
1288 cat >$TMPE 2>>$logfile <<EOF
1291 chmod +x $TMPE >>$logfile 2>&1
1292 if ! $TMPE >>$logfile 2>&1; then
1294 Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
1295 variable to another directory and make sure that $TMPDIR1 is not mounted
1298 die "Sanity test failed."
1302 # compiler sanity check
1308 if test "$?" != 0; then
1309 echo "$cc is unable to create an executable file."
1310 if test -z "$cross_prefix" -a "$cross_compile" = no; then
1311 echo "If $cc is a cross-compiler, use the --cross-compile option."
1312 echo "Only do this if you know what cross compiling means."
1314 die "C compiler test failed."
1317 # check for assembler specific support
1319 if test $arch = "powerpc"; then
1320 check_cc <<EOF && dcbzl=yes
1322 register long zero = 0;
1324 asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
1330 # check for SIMD availability
1332 # AltiVec flags: The FSF version of GCC differs from the Apple version
1333 if test $arch = "powerpc"; then
1334 if test $altivec = "yes"; then
1335 if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
1336 add_cflags "-faltivec"
1338 add_cflags "-maltivec -mabi=altivec"
1343 check_header altivec.h
1345 # check if our compiler supports Motorola AltiVec C API
1346 if test $altivec = "yes"; then
1347 if test $altivec_h = "yes"; then
1348 inc_altivec_h="#include <altivec.h>"
1352 check_cc <<EOF || altivec=no
1355 vector signed int v1, v2, v3;
1356 v1 = vec_add(v2,v3);
1362 # check armv5te instructions support
1363 if test $armv5te = "default" -a $arch = "armv4l"; then
1365 check_cc <<EOF && armv5te=yes
1367 __asm__ __volatile__ ("qadd r0, r0, r0");
1372 # check iwmmxt support
1373 if test $iwmmxt = "default" -a $arch = "armv4l"; then
1375 check_cc <<EOF && iwmmxt=yes
1377 __asm__ __volatile__ ("wunpckelub wr6, wr4");
1382 # mmi only available on mips
1383 if test $mmi = "default"; then
1384 if test $arch = "mips"; then
1391 # check if our compiler supports mmi
1392 enabled mmi && check_cc <<EOF || mmi="no"
1394 __asm__ ("lq \$2, 0(\$2)");
1400 # big/little-endian test
1401 if test "$cross_compile" = "no"; then
1402 check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
1403 #include <inttypes.h>
1404 int main(int argc, char ** argv){
1405 volatile uint32_t i=0x01234567;
1406 return (*((uint8_t*)(&i))) == 0x67;
1410 # programs cannot be launched if cross compiling, so make a static guess
1411 if test "$arch" = "powerpc" -o "$arch" = "mips" ; then
1417 # check availability of some header files
1419 check_header malloc.h
1422 if test "$memalign" = "no" -a "$need_memalign" = "yes" -a \
1423 "$memalign_hack" != "yes"; then
1424 die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
1427 check_header byteswap.h
1429 check_func inet_aton
1430 check_func localtime_r
1431 enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
1433 # check for some common methods of building with pthread support
1434 # do this before the optional library checks as some of them require pthreads
1435 if enabled pthreads; then
1436 if check_func pthread_create; then
1438 elif check_func pthread_create -pthread; then
1440 add_ldflags -pthread
1441 elif check_func pthread_create -pthreads; then
1442 add_cflags -pthreads
1443 add_ldflags -pthreads
1444 elif ! check_lib pthread.h pthread_create -lpthread; then
1445 die "ERROR: can't find pthreads library"
1449 # these are off by default, so fail if requested and not available
1450 enabled dts && require libdts dts.h dts_init -ldts -lm
1451 enabled libgsm && require libgsm gsm.h gsm_create -lgsm
1452 enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
1453 enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
1454 enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg
1455 enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
1456 enabled xvid && require XviD xvid.h xvid_global -lxvidcore
1457 enabled x264 && require x264 x264.h x264_encoder_open -lx264
1458 enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
1459 enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
1461 # Ugh, faac uses stdcall calling convention on win32 so we can't use
1462 # the generic test functions
1463 if enabled faac; then
1465 temp_extralibs -lfaac
1466 check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
1471 faacEncGetVersion(&id, &cpr);
1478 # Ugh, recent faad2 versions have renamed all functions and #define the
1479 # old names in faad.h. Generic tests won't work.
1480 if enabled faad; then
1482 temp_extralibs -lfaad
1483 check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
1493 # Ugh, avisynth uses WINAPI calls. Generic tests won't work.
1494 if enabled avisynth; then
1496 temp_extralibs -lvfw32
1497 check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found"
1498 #include <windows.h>
1509 # test for lrintf in math.h
1510 check_exec <<EOF && lrintf=yes || lrintf=no
1511 #define _ISOC9X_SOURCE 1
1513 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
1517 for restrict_keyword in restrict __restrict__ __restrict; do
1518 check_cc <<EOF && _restrict=$restrict_keyword && break
1519 void foo(char * $restrict_keyword p);
1523 # dlopen/dlfcn.h probing
1525 check_header dlfcn.h
1527 if check_func dlopen; then
1529 elif check_func dlopen -ldl; then
1533 if test "$vhook" = "default"; then
1537 if enabled_any vhook a52bin faadbin; then
1541 if test "$targetos" = "CYGWIN" -a "$lstatic" = "yes" ; then
1544 echo "At the moment vhooks don't work on Cygwin static builds."
1545 echo "Patches welcome."
1549 if enabled vhook; then
1550 check_ldflags -rdynamic
1551 check_ldflags -export-dynamic
1554 if enabled audio_beos; then
1555 add_extralibs "-lmedia -lbe"
1558 ##########################################
1561 temp_extralibs -lImlib2
1562 check_ld <<EOF && imlib2=yes || imlib2=no
1563 #include <X11/Xlib.h>
1565 int main( void ) { return (int) imlib_load_font("foo"); }
1569 ##########################################
1573 if test "x$targetos" != "xBeOS"; then
1574 if (freetype-config --version) >/dev/null 2>&1 ; then
1575 temp_cflags `freetype-config --cflags`
1576 temp_extralibs `freetype-config --libs`
1577 check_ld <<EOF && freetype2=yes
1578 #include <ft2build.h>
1579 int main( void ) { return (int) FT_Init_FreeType(0); }
1585 ##########################################
1590 SDL_CONFIG="${cross_prefix}sdl-config"
1591 if ("${SDL_CONFIG}" --version) >/dev/null 2>&1 ; then
1592 temp_cflags `"${SDL_CONFIG}" --cflags`
1593 temp_extralibs `"${SDL_CONFIG}" --libs`
1596 #undef main /* We don't want SDL to override our main() */
1597 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1599 if test $? = 0; then
1600 _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
1601 if test "$_sdlversion" -lt 121 ; then
1605 check_cc <<EOF && sdl_video_size=yes || sdl_video_size=no
1608 const SDL_VideoInfo *vi = SDL_GetVideoInfo();
1609 int w = vi->current_w;
1618 enabled sdl || ffplay=no
1620 ##########################################
1624 if (texi2html -version) >/dev/null 2>&1; then
1628 ##########################################
1631 enabled network && enabled ipv6 && check_ld <<EOF && ipv6=yes || ipv6=no
1632 #include <sys/types.h>
1633 #include <sys/socket.h>
1634 #include <netinet/in.h>
1637 struct sockaddr_storage saddr;
1638 struct ipv6_mreq mreq6;
1639 getaddrinfo(0,0,0,0);
1640 getnameinfo(0,0,0,0,0,0,0);
1641 IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
1645 # check for video4linux2 --- V4L2_PIX_FMT_YUV420
1646 enabled video4linux2 && check_cc <<EOF || video4linux2="no"
1647 #include <sys/time.h>
1648 #include <asm/types.h>
1649 #include <linux/videodev2.h>
1650 int dummy = V4L2_PIX_FMT_YUV420;
1651 struct v4l2_buffer dummy1;
1654 enabled debug && add_cflags -g
1656 # add some useful compiler flags if supported
1657 check_cflags -Wdeclaration-after-statement
1659 check_cflags -Wno-switch
1660 check_cflags -Wdisabled-optimization
1661 check_cflags -Wpointer-arith
1662 check_cflags -Wredundant-decls
1663 enabled extrawarnings && check_cflags -Winline
1665 # add some linker flags
1666 check_ldflags $LDLATEFLAGS
1668 # not all compilers support -Os
1669 test "$optimize" = "small" && check_cflags -Os
1671 if enabled optimize; then
1672 if test -n "`$cc -v 2>&1 | grep xlc`"; then
1680 # PIC flags for shared library objects where they are needed
1681 if test "$lshared" = "yes" ; then
1682 # LIBOBJFLAGS may have already been set in the OS configuration
1683 if test -z "$LIBOBJFLAGS" ; then
1685 x86_64|ia64|alpha|sparc*) LIBOBJFLAGS="\$(PIC)" ;;
1690 if test "$gprof" = "yes" ; then
1695 VHOOKCFLAGS="-fPIC $CFLAGS"
1696 test "$needmdynamicnopic" = yes && add_cflags -mdynamic-no-pic
1698 # find if .align arg is power-of-two or not
1699 if test $asmalign_pot = "unknown"; then
1701 echo 'asm (".align 3");' | check_cc && asmalign_pot="yes"
1704 echo "install prefix $PREFIX"
1705 echo "source path $source_path"
1706 echo "C compiler $cc"
1708 echo "ARCH $arch ($cpu)"
1709 if test "$BUILDSUF" != ""; then
1710 echo "build suffix $BUILDSUF"
1712 echo "big-endian $bigendian"
1713 if test $arch = "x86_32" -o $arch = "x86_64"; then
1714 echo "MMX enabled $mmx"
1715 echo "CMOV enabled $cmov"
1716 echo "CMOV is fast $cmov_is_fast"
1718 if test $arch = "armv4l"; then
1719 echo "ARMv5TE enabled $armv5te"
1720 echo "IWMMXT enabled $iwmmxt"
1722 if test $arch = "mips"; then
1723 echo "MMI enabled $mmi"
1725 if test $arch = "powerpc"; then
1726 echo "AltiVec enabled $altivec"
1727 echo "dcbzl available $dcbzl"
1729 echo "gprof enabled $gprof"
1730 echo "zlib enabled $zlib"
1731 echo "libgsm enabled $libgsm"
1732 echo "mp3lame enabled $mp3lame"
1733 echo "libnut enabled $libnut"
1734 echo "libogg enabled $libogg"
1735 echo "Vorbis enabled $libvorbis"
1736 echo "FAAD enabled $faad"
1737 echo "faadbin enabled $faadbin"
1738 echo "FAAC enabled $faac"
1739 echo "XviD enabled $xvid"
1740 echo "x264 enabled $x264"
1741 echo "a52 support $a52"
1742 echo "a52 dlopened $a52bin"
1743 echo "DTS support $dts"
1744 echo "pp support $pp"
1745 echo "Software Scaler enabled $swscaler"
1746 echo "AVISynth enabled $avisynth"
1747 echo "debug symbols $debug"
1748 echo "strip symbols $dostrip"
1749 echo "optimize $optimize"
1750 echo "static $lstatic"
1751 echo "shared $lshared"
1752 echo "video hooking $vhook"
1753 echo "SDL support $sdl"
1754 if test $sdl_too_old = "yes"; then
1755 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
1758 if test "$vhook" = "yes"; then
1759 echo "Imlib2 support $imlib2"
1760 echo "FreeType support $freetype2"
1762 echo "Sun medialib support" $mlib
1763 echo "pthreads support" $pthreads
1764 echo "AMR-NB float support" $amr_nb
1765 echo "AMR-NB fixed support" $amr_nb_fixed
1766 echo "AMR-WB float support" $amr_wb
1767 echo "AMR-WB IF2 support" $amr_if2
1768 echo "network support $network"
1769 if test "$network" = "yes" ; then
1770 echo "IPv6 support $ipv6"
1772 echo ".align is power-of-two" $asmalign_pot
1773 if test "$gpl" = "no" ; then
1774 echo "License: LGPL"
1779 echo "Creating config.mak and config.h..."
1781 echo "# Automatically generated by configure - do not modify!" > config.mak
1782 echo "/* Automatically generated by configure - do not modify! */" > $TMPH
1783 echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
1785 echo "PREFIX=$PREFIX" >> config.mak
1786 echo "prefix=\$(DESTDIR)\${PREFIX}" >> config.mak
1787 echo "libdir=\$(DESTDIR)$libdir" >> config.mak
1788 echo "shlibdir=\$(DESTDIR)$shlibdir" >> config.mak
1789 echo "incdir=\$(DESTDIR)$incdir" >> config.mak
1790 echo "bindir=\$(DESTDIR)$bindir" >> config.mak
1791 echo "mandir=\$(DESTDIR)$mandir" >> config.mak
1792 echo "MAKE=$make" >> config.mak
1793 echo "CC=$cc" >> config.mak
1794 echo "AR=$ar" >> config.mak
1795 echo "RANLIB=$ranlib" >> config.mak
1796 if test "$dostrip" = "yes" ; then
1797 echo "STRIP=$strip" >> config.mak
1798 echo "INSTALLSTRIP=$installstrip" >> config.mak
1800 echo "STRIP=echo ignoring strip" >> config.mak
1801 echo "INSTALLSTRIP=" >> config.mak
1804 echo "OPTFLAGS=$CFLAGS" >> config.mak
1805 echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
1806 echo "LDFLAGS=$LDFLAGS" >> config.mak
1807 echo "LDCONFIG=$LDCONFIG" >> config.mak
1808 echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
1809 echo "SHFLAGS=$SHFLAGS" >> config.mak
1810 echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
1811 echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
1812 echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
1813 echo "BUILD_STATIC=$lstatic" >> config.mak
1814 echo "BUILDSUF=$BUILDSUF" >> config.mak
1815 echo "LIBPREF=$LIBPREF" >> config.mak
1816 echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
1817 if test "$lstatic" = "yes" ; then
1818 echo "LIB=$LIB" >> config.mak
1819 else # Some Make complain if this variable does not exist.
1820 echo "LIB=" >> config.mak
1822 echo "SLIBPREF=$SLIBPREF" >> config.mak
1823 echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
1824 echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
1825 echo "TARGET_OS=$targetos" >> config.mak
1827 ucarch=`toupper $arch`
1828 echo "TARGET_ARCH_${ucarch}=yes" >> config.mak
1829 echo "#define ARCH_${ucarch} 1" >> $TMPH
1834 echo "TARGET_ARCH_X86=yes" >> config.mak
1835 echo "#define ARCH_X86 1" >> $TMPH
1838 if test "$POWERPCMODE" = "64bits"; then
1839 echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1841 if test "$powerpc_perf" = "yes"; then
1842 echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1846 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1847 echo "#define ARCH_SPARC 1" >> $TMPH
1851 if test "$bigendian" = "yes" ; then
1852 echo "WORDS_BIGENDIAN=yes" >> config.mak
1853 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
1855 if test "$mmx" = "yes" ; then
1856 echo "TARGET_MMX=yes" >> config.mak
1857 echo "#define HAVE_MMX 1" >> $TMPH
1858 echo "#define __CPU__ 586" >> $TMPH
1860 if test "$cmov" = "yes" ; then
1861 echo "TARGET_CMOV=yes" >> config.mak
1862 echo "#define HAVE_CMOV 1" >> $TMPH
1864 if test "$cmov_is_fast" = "yes" ; then
1865 echo "TARGET_CMOV_IS_FAST=yes" >> config.mak
1866 echo "#define CMOV_IS_FAST 1" >> $TMPH
1868 if test "$armv5te" = "yes" ; then
1869 echo "TARGET_ARMV5TE=yes" >> config.mak
1870 echo "#define HAVE_ARMV5TE 1" >> $TMPH
1872 if test "$iwmmxt" = "yes" ; then
1873 echo "TARGET_IWMMXT=yes" >> config.mak
1874 echo "#define HAVE_IWMMXT 1" >> $TMPH
1876 if test "$mmi" = "yes" ; then
1877 echo "TARGET_MMI=yes" >> config.mak
1878 echo "#define HAVE_MMI 1" >> $TMPH
1881 if test "$altivec" = "yes" ; then
1882 echo "TARGET_ALTIVEC=yes" >> config.mak
1883 echo "#define HAVE_ALTIVEC 1" >> $TMPH
1886 if test "$sdl" = "yes" ; then
1887 echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
1888 echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
1890 if test "$texi2html" = "yes"; then
1891 echo "BUILD_DOC=yes" >> config.mak
1894 sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
1895 pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
1896 lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
1897 lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
1898 lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
1902 if test "$lshared" = "yes" ; then
1903 echo "BUILD_SHARED=yes" >> config.mak
1904 echo "PIC=-fPIC -DPIC" >> config.mak
1905 echo "SPPMAJOR=${lavc_version%%.*}" >> config.mak
1906 echo "SPPVERSION=$lavc_version" >> config.mak
1907 echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
1908 echo "LAVCVERSION=$lavc_version" >> config.mak
1909 echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
1910 echo "LAVFVERSION=$lavf_version" >> config.mak
1911 echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
1912 echo "LAVUVERSION=$lavu_version" >> config.mak
1913 echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
1914 echo "SWSVERSION=$sws_version" >> config.mak
1915 echo "SLIBNAME=${SLIBNAME}" >> config.mak
1916 echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
1917 echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
1918 echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
1920 echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
1921 echo "EXTRALIBS=$extralibs" >> config.mak
1923 enabled_any $ENCODER_LIST && enable encoders
1924 enabled_any $DECODER_LIST && enable decoders
1925 enabled_any $MUXER_LIST && enable muxers
1926 enabled_any $DEMUXER_LIST && enable demuxers
1928 enabled_any pthreads beosthreads os2threads w32threads && enable threads
1930 print_config HAVE_ $TMPH config.mak $HAVE_LIST
1931 print_config CONFIG_ $TMPH config.mak $CONFIG_LIST
1933 if test "$targetos" = "Darwin"; then
1934 echo "#define CONFIG_DARWIN 1" >> $TMPH
1937 echo "#define restrict $_restrict" >> $TMPH
1939 if test "$optimize" = "small"; then
1940 echo "#define always_inline" >> $TMPH
1941 echo "#define CONFIG_SMALL 1" >> $TMPH
1944 echo "SRC_PATH=\"$source_path\"" >> config.mak
1945 echo "SRC_PATH_BARE=$source_path" >> config.mak
1946 echo "BUILD_ROOT=\"$PWD\"" >> config.mak
1948 if test "$amr_if2" = "yes" ; then
1949 echo "AMR_CFLAGS=-DIF2=1" >> config.mak
1952 # Apparently it's not possible to portably echo a backslash.
1953 if test "$asmalign_pot" = "yes" ; then
1954 printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH
1956 printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
1960 for codec in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST; do
1961 ucname="`toupper $codec`"
1962 config_name="CONFIG_$ucname"
1963 enabled_name="ENABLE_$ucname"
1964 if enabled $codec; then
1965 echo "#define $config_name 1" >> $TMPH
1966 echo "#define $enabled_name 1" >> $TMPH
1967 echo "$config_name=yes" >> config.mak
1969 echo "#define $enabled_name 0" >> $TMPH
1973 # Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
1974 if ! cmp -s $TMPH config.h; then
1975 mv -f $TMPH config.h
1977 echo "config.h is unchanged"
1980 rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
1982 # build tree in object directory if source path is different from current one
1983 if test "$source_path_used" = "yes" ; then
2005 libavformat/Makefile \
2006 libavcodec/Makefile \
2007 libpostproc/Makefile \
2008 libavutil/Makefile \
2009 libswscale/Makefile \
2015 for dir in $DIRS ; do
2018 for f in $FILES ; do
2019 ln -sf "$source_path/$f" $f
2023 # build pkg-config files libav*.pc and libpostproc.pc
2025 cat <<EOF >libavutil.pc
2027 exec_prefix=\${prefix}
2028 libdir=\${exec_prefix}/lib
2029 includedir=\${prefix}/include
2032 Description: FFmpeg utility library
2033 Version: $lavu_version
2036 Libs: -L\${libdir} -lavutil
2037 Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2040 cat <<EOF >libavutil-uninstalled.pc
2043 libdir=\${pcfiledir}/libavutil
2044 includedir=\${pcfiledir}/libavutil
2047 Description: FFmpeg utility library
2048 Version: $lavu_version
2051 Libs: \${libdir}/${LIBPREF}avutil${LIBSUF}
2052 Cflags: -I\${includedir}
2056 cat <<EOF >libavcodec.pc
2058 exec_prefix=\${prefix}
2059 libdir=\${exec_prefix}/lib
2060 includedir=\${prefix}/include
2063 Description: FFmpeg codec library
2064 Version: $lavc_version
2065 Requires: $pkg_requires libavutil = $lavu_version
2067 Libs: -L\${libdir} -lavcodec $extralibs
2068 Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2071 cat <<EOF >libavcodec-uninstalled.pc
2074 libdir=\${pcfiledir}/libavcodec
2075 includedir=\${pcfiledir}/libavcodec
2078 Description: FFmpeg codec library
2079 Version: $lavc_version
2080 Requires: $pkg_requires libavutil = $lavu_version
2082 Libs: \${libdir}/${LIBPREF}avcodec${LIBSUF} $extralibs
2083 Cflags: -I\${includedir}
2087 cat <<EOF >libavformat.pc
2089 exec_prefix=\${prefix}
2090 libdir=\${exec_prefix}/lib
2091 includedir=\${prefix}/include
2094 Description: FFmpeg container format library
2095 Version: $lavf_version
2096 Requires: $pkg_requires libavcodec = $lavc_version
2098 Libs: -L\${libdir} -lavformat $extralibs
2099 Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2102 cat <<EOF >libavformat-uninstalled.pc
2105 libdir=\${pcfiledir}/libavformat
2106 includedir=\${pcfiledir}/libavformat
2109 Description: FFmpeg container format library
2110 Version: $lavf_version
2111 Requires: $pkg_requires libavcodec = $lavc_version
2113 Libs: \${libdir}/${LIBPREF}avformat${LIBSUF} $extralibs
2114 Cflags: -I\${includedir}
2119 cat <<EOF >libpostproc.pc
2121 exec_prefix=\${prefix}
2122 libdir=\${exec_prefix}/lib
2123 includedir=\${prefix}/include
2126 Description: FFmpeg post processing library
2127 Version: $lavc_version
2130 Libs: -L\${libdir} -lpostproc
2131 Cflags: -I\${includedir} -I\${includedir}/postproc
2134 cat <<EOF >libpostproc-uninstalled.pc
2137 libdir=\${pcfiledir}/libpostproc
2138 includedir=\${pcfiledir}/libpostproc
2141 Description: FFmpeg post processing library
2142 Version: $lavc_version
2145 Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
2146 Cflags: -I\${includedir}
2149 if test "$swscaler" != "no"; then
2150 sws_pc_libs="-L\${libdir} -lswscale"
2151 sws_pc_uninstalled_libs="\${libdir}/${LIBPREF}swscale${LIBSUF}"
2152 sws_pc_requires="$pkg_requires libavutil = $lavu_version"
2155 sws_pc_uninstalled_libs=""
2156 sws_pc_requires="$pkg_requires libavcodec = $lavc_version"
2159 cat <<EOF >libswscale.pc
2161 exec_prefix=\${prefix}
2162 libdir=\${exec_prefix}/lib
2163 includedir=\${prefix}/include
2166 Description: FFmpeg image rescaling library
2167 Version: $sws_version
2168 Requires: $sws_pc_requires
2171 Cflags: -I\${includedir} -I\${includedir}/swscale
2174 cat <<EOF >libswscale-uninstalled.pc
2177 libdir=\${pcfiledir}/libswscale
2178 includedir=\${pcfiledir}/libswscale
2181 Description: FFmpeg image rescaling library
2182 Version: $sws_version
2183 Requires: $sws_pc_requires
2185 Libs: $sws_pc_uninstalled_libs
2186 Cflags: -I\${includedir}