3 # ffmpeg configure script (c) 2000, 2001, 2002 Fabrice Bellard
6 # make sure we are running under a compatible shell
7 # try to make this part work with most shells
10 type "$1" >/dev/null 2>&1 && exec "$@"
14 (: ${foo%%bar}) 2>/dev/null && ! (: ${foo?}) 2>/dev/null
15 if test "$?" != 0; then
17 if test "0$FF_CONF_EXEC" -lt 1; then
19 try_exec bash "$0" "$@"
21 if test "0$FF_CONF_EXEC" -lt 2; then
23 try_exec ksh "$0" "$@"
25 if test "0$FF_CONF_EXEC" -lt 3; then
27 try_exec /usr/xpg4/bin/sh "$0" "$@"
29 echo "No compatible shell script interpreter found."
30 echo "This configure script requires a POSIX compatible shell"
31 echo "such as bash or ksh."
32 if test "$BASH_VERSION" = '2.04.0(1)-release'; then
33 echo "This bash version ($BASH_VERSION) is broken on your platform."
34 echo "Upgrade to a later version if available."
40 echo "Usage: configure [options]"
41 echo "Options: [defaults in brackets after descriptions]"
43 echo "Standard options:"
44 echo " --help print this message"
45 echo " --log[=FILE|yes|no] log tests and output to FILE [config.err]"
46 echo " --prefix=PREFIX install in PREFIX [$PREFIX]"
47 echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
48 echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]"
49 echo " --incdir=DIR install includes in DIR [PREFIX/include/ffmpeg]"
50 echo " --mandir=DIR install man page in DIR [PREFIX/man]"
51 echo " --enable-mp3lame enable MP3 encoding via libmp3lame [default=no]"
52 echo " --enable-libnut enable NUT support via libnut [default=no]"
53 echo " --enable-libogg enable Ogg support via libogg [default=no]"
54 echo " --enable-vorbis enable Vorbis support via libvorbis [default=no]"
55 echo " --enable-faad enable FAAD support via libfaad [default=no]"
56 echo " --enable-faadbin build FAAD support with runtime linking [default=no]"
57 echo " --enable-faac enable FAAC support via libfaac [default=no]"
58 echo " --enable-libgsm enable GSM support via libgsm [default=no]"
59 echo " --enable-xvid enable XviD support via xvidcore [default=no]"
60 echo " --enable-x264 enable H.264 encoding via x264 [default=no]"
61 echo " --enable-mingw32 enable MinGW native/cross Windows compile"
62 echo " --enable-mingwce enable MinGW native/cross WinCE compile"
63 echo " --enable-a52 enable GPLed A52 support [default=no]"
64 echo " --enable-a52bin open liba52.so.0 at runtime [default=no]"
65 echo " --enable-dts enable GPLed DTS support [default=no]"
66 echo " --enable-pp enable GPLed postprocessing support [default=no]"
67 echo " --enable-static build static libraries [default=yes]"
68 echo " --disable-static do not build static libraries [default=no]"
69 echo " --enable-shared build shared libraries [default=no]"
70 echo " --disable-shared do not build shared libraries [default=yes]"
71 echo " --enable-amr_nb enable amr_nb float audio codec"
72 echo " --enable-amr_nb-fixed use fixed point for amr-nb codec"
73 echo " --enable-amr_wb enable amr_wb float audio codec"
74 echo " --enable-amr_if2 enable amr_wb IF2 audio codec"
75 echo " --enable-sunmlib use Sun medialib [default=no]"
76 echo " --enable-pthreads use pthreads [default=no]"
77 echo " --enable-dc1394 enable IIDC-1394 grabbing using libdc1394"
78 echo " and libraw1394 [default=no]"
79 echo " --enable-swscaler software scaler support [default=no]"
80 echo " --enable-avisynth allow reading AVISynth script files [default=no]"
81 echo " --enable-gpl allow use of GPL code, the resulting libav*"
82 echo " and ffmpeg will be under GPL [default=no]"
84 echo "Advanced options (experts only):"
85 echo " --source-path=PATH path to source code [$source_path]"
86 echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
87 echo " --cross-compile assume a cross-compiler is used"
88 echo " --cc=CC use C compiler CC [$cc]"
89 echo " --make=MAKE use specified make [$make]"
90 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
91 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
92 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
93 echo " --build-suffix=SUFFIX suffix for application specific build []"
94 echo " --arch=ARCH select architecture [$arch]"
95 echo " --cpu=CPU selects the minimum cpu required (affects
96 instruction selection, may crash on older CPUs)"
97 echo " --powerpc-perf-enable enable performance report on PPC"
98 echo " (requires enabling PMC)"
99 echo " --disable-mmx disable MMX usage"
100 echo " --disable-armv5te disable armv5te usage"
101 echo " --disable-iwmmxt disable iwmmxt usage"
102 echo " --disable-altivec disable AltiVec usage"
103 echo " --disable-audio-oss disable OSS audio support [default=no]"
104 echo " --disable-audio-beos disable BeOS audio support [default=no]"
105 echo " --disable-v4l disable video4linux grabbing [default=no]"
106 echo " --disable-v4l2 disable video4linux2 grabbing [default=no]"
107 echo " --disable-bktr disable bktr video grabbing [default=no]"
108 echo " --disable-dv1394 disable DV1394 grabbing [default=no]"
109 echo " --disable-network disable network support [default=no]"
110 echo " --disable-ipv6 disable ipv6 support [default=no]"
111 echo " --disable-zlib disable zlib [default=no]"
112 echo " --disable-vhook disable video hooking support"
113 echo " --enable-gprof enable profiling with gprof [$gprof]"
114 echo " --disable-debug disable debugging symbols"
115 echo " --disable-opts disable compiler optimizations"
116 echo " --enable-extra-warnings enable more compiler warnings"
117 echo " --disable-mpegaudio-hp faster (but less accurate)"
118 echo " MPEG audio decoding [default=no]"
119 echo " --disable-protocols disable I/O protocols support [default=no]"
120 echo " --disable-ffmpeg disable ffmpeg build"
121 echo " --disable-ffserver disable ffserver build"
122 echo " --disable-ffplay disable ffplay build"
123 echo " --enable-small optimize for size instead of speed"
124 echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
125 echo " --disable-strip disable stripping of executables and shared libraries"
126 echo " --disable-encoder=NAME disables encoder NAME"
127 echo " --enable-encoder=NAME enables encoder NAME"
128 echo " --disable-decoder=NAME disables decoder NAME"
129 echo " --enable-decoder=NAME enables decoder NAME"
130 echo " --disable-encoders disables all encoders"
131 echo " --disable-decoders disables all decoders"
132 echo " --disable-muxer=NAME disables muxer NAME"
133 echo " --enable-muxer=NAME enables muxer NAME"
134 echo " --disable-muxers disables all muxers"
135 echo " --disable-demuxer=NAME disables demuxer NAME"
136 echo " --enable-demuxer=NAME enables demuxer NAME"
137 echo " --disable-demuxers disables all demuxers"
138 echo " --enable-parser=NAME enables parser NAME"
139 echo " --disable-parser=NAME disables parser NAME"
140 echo " --disable-parsers disables all parsers"
142 echo "NOTE: Object files are built at the place where configure is launched."
164 If you think configure made a mistake, make sure you are using the latest
165 version from SVN. If the latest version fails, report the problem to the
166 ffmpeg-devel@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
168 if enabled logging; then
170 Include the log file "$logfile" produced by configure as this will help
175 Rerun configure with logging enabled (do not use --log=no), and include the
176 log this produces with your report.
179 rm -f $TMPC $TMPO $TMPE $TMPS $TMPH
183 # "tr '[a-z]' '[A-Z]'" is a workaround for Solaris tr not grokking "tr a-z A-Z"
185 echo "$@" | tr '[a-z]' '[A-Z]'
205 eval test "x\$$1" = "xyes"
210 enabled $opt || return 1
216 enabled $opt && return 0
226 if enabled $cfg; then
227 ucname="${pfx}`toupper $cfg`"
228 echo "#define ${ucname} 1" >> $header
229 echo "${ucname}=yes" >> $makefile
235 (: ${SAVE_CFLAGS?}) 2>/dev/null
239 flags_saved && return
240 SAVE_CFLAGS="$CFLAGS"
241 SAVE_LDFLAGS="$LDFLAGS"
242 SAVE_extralibs="$extralibs"
246 CFLAGS="$SAVE_CFLAGS"
247 LDFLAGS="$SAVE_LDFLAGS"
248 extralibs="$SAVE_extralibs"
261 LDFLAGS="$LDFLAGS $*"
266 extralibs="$extralibs $*"
272 flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
273 eval "$var=\"\$$var $*\""
285 append extralibs "$@"
297 check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
304 check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
310 check_cmd $cc $LDFLAGS "$@" -o $TMPE $TMPO $extralibs
314 log check_cflags "$@"
315 check_cc "$@" <<EOF && add_cflags "$@"
321 log check_ldflags "$@"
322 check_ld "$@" <<EOF && add_ldflags "$@"
330 log check_header "$@"
338 var=`echo $header | sed 's/[^[:alnum:]]/_/g'`
339 test "$err" = 0 && enable $var || disable $var
354 test "$err" = 0 && enable $func || disable $func
364 check_header $header && check_func $func && add_extralibs "$@"
371 check_ld "$@" && { test "$cross_compile" = yes || $TMPE >>$logfile 2>&1; }
379 check_lib $header $func "$@" || die "ERROR: $name not found"
455 # set temporary file name
456 if test ! -z "$TMPDIR" ; then
458 elif test ! -z "$TEMPDIR" ; then
464 TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
465 TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
466 TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}"
467 TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
468 TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
474 libdir='${PREFIX}/lib'
476 incdir='${PREFIX}/include/ffmpeg'
477 mandir='${PREFIX}/man'
478 bindir='${PREFIX}/bin'
498 i386|i486|i586|i686|i86pc|BePC)
503 canon_arch="`$cc -dumpmachine | sed -e 's,\([^-]*\)-.*,\1,'`"
504 if [ x"$canon_arch" = x"x86_64" -o x"$canon_arch" = x"amd64" ]; then
505 if [ -z "`echo $CFLAGS | grep -- -m32`" ]; then
510 # armv4l is a subset of armv[567]*l
517 "Power Macintosh"|ppc|ppc64|powerpc)
593 SHFLAGS='-shared -Wl,-soname,$@'
594 VHOOKSHFLAGS='$(SHFLAGS)'
601 FFLDFLAGS=-Wl,--warn-common
602 LDLATEFLAGS='-Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
603 FFSERVERLDFLAGS=-Wl,-E
607 LIB='$(LIBPREF)$(NAME)$(LIBSUF)'
610 SLIBNAME='$(SLIBPREF)$(NAME)$(SLIBSUF)'
611 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
612 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
624 asmalign_pot="unknown"
625 LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
631 PREFIX="/boot/home/config"
632 # helps building libavcodec
633 add_cflags "-DPIC -fomit-frame-pointer"
634 # 3 gcc releases known for BeOS, each with ugly bugs
635 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
636 case "$gcc_version" in
637 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
640 *20010315*) echo "BeBits gcc"
641 add_cflags "-fno-expensive-optimizations"
645 # disable Linux things
653 # no need for libm, but the inet stuff
655 if (echo $BEINCLUDES|grep 'headers/be/bone' >/dev/null); then
656 extralibs="-lbind -lsocket"
669 SHFLAGS="-shared -Wl,-h,\$@"
670 add_extralibs "-lsocket -lnsl"
679 add_extralibs "-lossaudio"
688 LIBOBJFLAGS="\$(PIC)"
689 LDCONFIG="ldconfig -m \$(shlibdir)"
690 add_extralibs "-lossaudio"
699 add_cflags "-pthread"
707 add_cflags "-pthread"
715 extralibs="-lpoll -lgnugetopt -lm"
726 SHFLAGS="-dynamiclib -Wl,-single_module -Wl,-install_name,\$(shlibdir)/\$(SLIBNAME),-current_version,\$(SPPVERSION),-compatibility_version,\$(SPPVERSION)"
727 VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(shlibdir)/vhook/$@'
731 FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
733 SLIBNAME_WITH_FULLVERSION='$(SLIBPREF)$(NAME).$(LIBVERSION)$(SLIBSUF)'
734 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
735 FFSERVERLDFLAGS=-Wl,-bind_at_load
736 LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
739 # Note: the rest of the mingw32 config is done afterwards as mingw32
740 # can be forced on the command line for Linux cross compilation.
745 shlibdir='${PREFIX}/bin'
750 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
751 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
756 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
757 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
758 SHFLAGS='-shared -Wl,--out-implib=lib$(NAME).dll.a'
761 LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
765 ranlib="echo ignoring ranlib"
774 ranlib="echo ignoring ranlib"
775 strip="echo ignoring strip"
777 FFLDFLAGS="-Zomf -Zstack 16384 -s"
778 SHFLAGS="-Zdll -Zomf"
797 targetos="${targetos}-UNKNOWN"
802 source_path="`dirname \"$0\"`"
803 source_path_used="yes"
804 if test -z "$source_path" -o "$source_path" = "." ; then
806 source_path_used="no"
808 source_path="`cd \"$source_path\"; pwd`"
809 echo "$source_path" | grep -q '[[:blank:]]' &&
810 die "Out of tree builds are impossible with whitespace in source path."
813 if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
817 FFMPEG_CONFIGURATION=" "
819 FFMPEG_CONFIGURATION="$FFMPEG_CONFIGURATION""$opt "
822 ENCODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_encoder)' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
823 DECODER_LIST=`grep 'register_avcodec(&[a-z0-9_]*_decoder)' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
824 PARSER_LIST=`grep 'av_register_codec_parser(&[a-z]' "$source_path/libavcodec/allcodecs.c" | sed 's/.*&\(.*\)).*/\1/'`
825 MUXER_LIST=`grep 'av_register_output_format(&[a-z]' "$source_path/libavformat/allformats.c" | sed 's/.*&\(.*\)).*/\1/'`
826 DEMUXER_LIST=`grep 'av_register_input_format(&[a-z]' "$source_path/libavformat/allformats.c" | sed 's/.*&\(.*\)).*/\1/'`
828 enable $ENCODER_LIST $DECODER_LIST $PARSER_LIST $MUXER_LIST $DEMUXER_LIST
835 --log=*) logging="$optval"
837 --prefix=*) PREFIX="$optval"; force_prefix=yes
839 --libdir=*) libdir="$optval"; force_libdir=yes
841 --shlibdir=*) shlibdir="$optval"
843 --incdir=*) incdir="$optval"
845 --mandir=*) mandir="$optval"
847 --source-path=*) source_path="$optval"
849 --cross-prefix=*) cross_prefix="$optval"
851 --cross-compile) cross_compile=yes
855 --make=*) make="$optval"
857 --extra-cflags=*) add_cflags "$optval"
859 --extra-ldflags=*) add_ldflags "$optval"
861 --extra-libs=*) add_extralibs "$optval"
863 --build-suffix=*) BUILDSUF="$optval"
865 --arch=*) arch="$optval"
867 --cpu=*) cpu="$optval"
869 --powerpc-perf-enable) powerpc_perf="yes"
871 --disable-mmx) mmx="no"
873 --disable-armv5te) armv5te="no"
875 --disable-iwmmxt) iwmmxt="no"
877 --disable-altivec) altivec="no"
879 --enable-gprof) gprof="yes"
881 --disable-v4l) video4linux="no"
883 --disable-v4l2) video4linux2="no"
885 --disable-bktr) bktr="no"
887 --disable-audio-oss) audio_oss="no"
889 --disable-audio-beos) audio_beos="no"
891 --disable-dv1394) dv1394="no"
893 --disable-network) network="no"; ffserver="no"
895 --disable-ipv6) ipv6="no";
897 --disable-zlib) zlib="no"
899 --enable-a52) a52="yes"
901 --enable-a52bin) a52bin="yes"
903 --enable-dts) dts="yes"
905 --enable-pp) pp="yes"
907 --enable-libgsm) libgsm="yes"
909 --enable-mp3lame) mp3lame="yes"
911 --enable-libnut) libnut="yes"
913 --enable-libogg) libogg="yes"
914 pkg_requires="$pkg_requires ogg >= 1.1"
916 --enable-vorbis) libvorbis="yes"
917 pkg_requires="$pkg_requires vorbis vorbisenc"
919 --enable-faad) faad="yes"
921 --enable-faadbin) faadbin="yes"
923 --enable-faac) faac="yes"
925 --enable-xvid) xvid="yes"
927 --enable-x264) x264="yes"
929 --enable-avisynth) avisynth="yes";
931 --enable-dc1394) dc1394="yes"
932 pkg_requires="$pkg_requires libraw1394"
934 --disable-vhook) vhook="no"
936 --enable-mingw32) mingw32="yes"
938 --enable-mingwce) wince="yes"
940 --enable-static) lstatic="yes"
942 --disable-static) lstatic="no"
944 --enable-shared) lshared="yes"
946 --disable-shared) lshared="no"
948 --disable-debug) debug="no"
950 --disable-opts) optimize="no"
952 --enable-extra-warnings) extrawarnings="yes"
954 --disable-mpegaudio-hp) mpegaudio_hp="no"
956 --disable-protocols) protocols="no"; network="no"; ffserver="no"
958 --disable-ffmpeg) ffmpeg="no"
960 --disable-ffserver) ffserver="no"
962 --disable-ffplay) ffplay="no"
964 --enable-small) optimize="small"
966 --enable-amr_nb) amr="yes"; amr_nb="yes"; amr_nb_fixed="no"
968 --enable-amr_nb-fixed) amr="yes"; amr_nb_fixed="yes"; amr_nb="no"
970 --enable-amr_wb) amr="yes"; amr_wb="yes"
972 --enable-amr_if2) amr="yes"; amr_if2="yes"
974 --enable-sunmlib) mlib="yes"
976 --enable-pthreads) pthreads="yes"
978 --enable-swscaler) swscaler="yes"
980 --enable-gpl) gpl="yes"
982 --enable-memalign-hack) memalign_hack="yes"
984 --disable-strip) dostrip="no"
986 --enable-encoder=*) enable ${optval}_encoder
988 --enable-decoder=*) enable ${optval}_decoder
990 --disable-encoder=*) disable ${optval}_encoder
992 --disable-decoder=*) disable ${optval}_decoder
994 --disable-encoders) disable $ENCODER_LIST
996 --disable-decoders) disable $DECODER_LIST
998 --enable-muxer=*) enable ${optval}_muxer
1000 --disable-muxer=*) disable ${optval}_muxer
1002 --disable-muxers) disable $MUXER_LIST; ffserver="no"
1004 --enable-demuxer=*) enable ${optval}_demuxer
1006 --disable-demuxer=*) disable ${optval}_demuxer
1008 --disable-demuxers) disable $DEMUXER_LIST
1010 --enable-parser=*) enable ${optval}_parser
1012 --disable-parser=*) disable ${optval}_parser
1014 --disable-parsers) disable $PARSER_LIST
1019 echo "Unknown option \"$opt\"."
1020 echo "See $0 --help for available options."
1026 if test "$logging" != no; then
1027 test "$logging" = yes || logfile="$logging"
1028 echo "# $0 $@" >$logfile
1034 if test "$mingw32" = "yes" -o "$wince" = "yes"; then
1035 if test "$lshared" = "yes" && test "$lstatic" = "yes" ; then
1037 You can only build one library type at once on MinGW.
1038 Specify --disable-static --enable-shared to only build
1039 the shared libraries. To build only the static libraries
1040 you do not need to pass additional options.
1052 if enabled mingw32; then
1055 if test "$wince" = "yes"; then
1061 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
1062 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
1063 SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)"
1064 SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a)"
1065 if test "$force_prefix" != yes; then PREFIX="$PROGRAMFILES/FFmpeg"; fi
1066 if test "$force_libdir" != yes; then bindir='${PREFIX}'; fi
1067 shlibdir='${PREFIX}'
1070 # Combine FFLDFLAGS and the LDFLAGS environment variable.
1071 LDFLAGS="$FFLDFLAGS $LDFLAGS"
1073 test -n "$cross_prefix" && cross_compile=yes
1074 cc="${cross_prefix}${cc}"
1075 ar="${cross_prefix}${ar}"
1076 ranlib="${cross_prefix}${ranlib}"
1077 strip="${cross_prefix}${strip}"
1079 # we need to build at least one lib type
1080 if test "$lstatic" = "no" && test "$lshared" = "no" ; then
1082 At least one library type must be built.
1083 Specify --enable-static to build the static libraries or --enable-shared to
1084 build the shared libraries as well. To only build the shared libraries specify
1085 --disable-static in addition to --enable-shared.
1090 if test "$libvorbis" = "yes" ; then
1091 if test "$libogg" = "no"; then
1092 echo "libogg must be enabled to enable Vorbis."
1097 if test "$gpl" != "yes"; then
1098 if test "$pp" != "no"; then
1099 echo "The Postprocessing code is under GPL and --enable-gpl is not specified."
1103 if test "$a52" != "no" -o "$a52bin" != "no"; then
1104 echo "liba52 is under GPL and --enable-gpl is not specified."
1108 if test "$xvid" != "no"; then
1109 echo "libxvidcore is under GPL and --enable-gpl is not specified."
1113 if test "$x264" != "no"; then
1114 echo "x264 is under GPL and --enable-gpl is not specified."
1118 if test "$dts" != "no"; then
1119 echo "libdts is under GPL and --enable-gpl is not specified."
1123 if test "$faad" != "no" -o "$faadbin" != "no"; then
1124 if check_header faad.h; then
1127 #ifndef FAAD2_VERSION
1130 int main( void ) { return 0; }
1132 if test $? = 0 ; then
1133 echo "FAAD2 is under GPL and --enable-gpl is not specified."
1139 echo "FAAD test failed."
1143 if test "$swscaler" != "no"; then
1144 echo "The software scaler is under GPL and --enable-gpl is not specified."
1149 if test "$fail" = "yes"; then
1154 if test $mmx = "default"; then
1155 if test $arch = "x86_32" -o $arch = "x86_64"; then
1163 needmdynamicnopic="no"
1164 if test $targetos = Darwin; then
1165 if test -n "`$cc -v 2>&1 | grep xlc`"; then
1166 add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
1168 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
1169 case "$gcc_version" in
1171 add_cflags "-no-cpp-precomp -pipe"
1174 add_cflags "-no-cpp-precomp -pipe -force_cpusubtype_ALL -Wno-sign-compare"
1175 if test "$lshared" = no; then
1176 needmdynamicnopic="yes"
1180 add_cflags "-no-cpp-precomp -pipe"
1181 if test "$lshared" = no; then
1182 needmdynamicnopic="yes"
1189 if test $optimize != "no"; then
1190 add_cflags "-fomit-frame-pointer"
1193 # Can only do AltiVec on PowerPC
1194 if test $altivec = "default"; then
1195 if test $arch = "powerpc"; then
1202 # Add processor-specific flags
1204 POWERPCMODE="32bits"
1205 if test $cpu != "generic"; then
1207 601|ppc601|PowerPC601)
1208 add_cflags "-mcpu=601"
1209 if test $altivec = "yes"; then
1210 echo "WARNING: Tuning for PPC601 but AltiVec enabled!";
1214 603*|ppc603*|PowerPC603*)
1215 add_cflags "-mcpu=603"
1216 if test $altivec = "yes"; then
1217 echo "WARNING: Tuning for PPC603 but AltiVec enabled!";
1221 604*|ppc604*|PowerPC604*)
1222 add_cflags "-mcpu=604"
1223 if test $altivec = "yes"; then
1224 echo "WARNING: Tuning for PPC604 but AltiVec enabled!";
1228 G3|g3|75*|ppc75*|PowerPC75*)
1229 add_cflags "-mcpu=750 -mpowerpc-gfxopt"
1230 if test $altivec = "yes"; then
1231 echo "WARNING: Tuning for PPC75x but AltiVec enabled!";
1235 G4|g4|745*|ppc745*|PowerPC745*)
1236 add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
1237 if test $altivec = "no"; then
1238 echo "WARNING: Tuning for PPC745x but AltiVec disabled!";
1242 74*|ppc74*|PowerPC74*)
1243 add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
1244 if test $altivec = "no"; then
1245 echo "WARNING: Tuning for PPC74xx but AltiVec disabled!";
1249 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
1250 add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
1251 if test $altivec = "no"; then
1252 echo "WARNING: Tuning for PPC970 but AltiVec disabled!";
1255 POWERPCMODE="64bits"
1257 # targets that do NOT support conditional mov (cmov)
1258 i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
1259 add_cflags "-march=$cpu"
1262 # targets that do support conditional mov (cmov)
1263 i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx)
1264 add_cflags "-march=$cpu"
1268 # targets that do support conditional mov but on which it's slow
1269 pentium4|prescott|nocona)
1270 add_cflags "-march=$cpu"
1275 add_cflags "-mcpu=v9"
1278 echo "WARNING: Unknown CPU \"$cpu\", ignored."
1283 # make sure we can execute files in $TMPDIR
1284 cat >$TMPE 2>>$logfile <<EOF
1287 chmod +x $TMPE >>$logfile 2>&1
1288 if ! $TMPE >>$logfile 2>&1; then
1290 Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
1291 variable to another directory and make sure that $TMPDIR1 is not mounted
1294 die "Sanity test failed."
1298 # compiler sanity check
1304 if test "$?" != 0; then
1305 echo "$cc is unable to create an executable file."
1306 if test -z "$cross_prefix" -a "$cross_compile" = no; then
1307 echo "If $cc is a cross-compiler, use the --cross-compile option."
1308 echo "Only do this if you know what cross compiling means."
1310 die "C compiler test failed."
1313 # check for assembler specific support
1315 if test $arch = "powerpc"; then
1316 check_cc <<EOF && dcbzl=yes
1318 register long zero = 0;
1320 asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
1326 # check for SIMD availability
1328 # AltiVec flags: The FSF version of GCC differs from the Apple version
1329 if test $arch = "powerpc"; then
1330 if test $altivec = "yes"; then
1331 if test -n "`$cc -v 2>&1 | grep version | grep Apple`"; then
1332 add_cflags "-faltivec"
1334 add_cflags "-maltivec -mabi=altivec"
1339 check_header altivec.h
1341 # check if our compiler supports Motorola AltiVec C API
1342 if test $altivec = "yes"; then
1343 if test $altivec_h = "yes"; then
1344 inc_altivec_h="#include <altivec.h>"
1348 check_cc <<EOF || altivec=no
1351 vector signed int v1, v2, v3;
1352 v1 = vec_add(v2,v3);
1358 # check armv5te instructions support
1359 if test $armv5te = "default" -a $arch = "armv4l"; then
1361 check_cc <<EOF && armv5te=yes
1363 __asm__ __volatile__ ("qadd r0, r0, r0");
1368 # check iwmmxt support
1369 if test $iwmmxt = "default" -a $arch = "armv4l"; then
1371 check_cc <<EOF && iwmmxt=yes
1373 __asm__ __volatile__ ("wunpckelub wr6, wr4");
1378 # mmi only available on mips
1379 if test $mmi = "default"; then
1380 if test $arch = "mips"; then
1387 # check if our compiler supports mmi
1388 enabled mmi && check_cc <<EOF || mmi="no"
1390 __asm__ ("lq \$2, 0(\$2)");
1396 # big/little-endian test
1397 if test "$cross_compile" = "no"; then
1398 check_ld <<EOF || die "endian test failed" && $TMPE && bigendian="yes"
1399 #include <inttypes.h>
1400 int main(int argc, char ** argv){
1401 volatile uint32_t i=0x01234567;
1402 return (*((uint8_t*)(&i))) == 0x67;
1406 # programs cannot be launched if cross compiling, so make a static guess
1407 if test "$arch" = "powerpc" -o "$arch" = "mips" ; then
1413 # check availability of some header files
1415 check_header malloc.h
1418 if test "$memalign" = "no" -a "$mmx" = "yes" -a \
1419 "$memalign_hack" != "yes" -a "$targetos" != "Darwin" -a \
1420 "$targetos" != "FreeBSD" ; then
1421 die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
1424 check_header byteswap.h
1426 check_func inet_aton
1427 check_func localtime_r
1428 enabled zlib && check_lib zlib.h zlibVersion -lz || zlib="no"
1430 # check for some common methods of building with pthread support
1431 # do this before the optional library checks as some of them require pthreads
1432 if enabled pthreads; then
1433 { check_cflags -pthread && check_ldflags -pthread; } ||
1434 { check_cflags -pthreads && check_ldflags -pthreads; } ||
1435 check_lib pthread.h pthread_create -lpthread ||
1436 check_func pthread_create ||
1437 die "ERROR: can't find pthreads library"
1440 # these are off by default, so fail if requested and not available
1441 enabled dts && require libdts dts.h dts_init -ldts -lm
1442 enabled libgsm && require libgsm gsm.h gsm_create -lgsm
1443 enabled mp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
1444 enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbis -lvorbisenc -logg
1445 enabled libogg && require libogg ogg/ogg.h ogg_sync_init -logg
1446 enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
1447 enabled xvid && require XviD xvid.h xvid_global -lxvidcore
1448 enabled x264 && require x264 x264.h x264_encoder_open -lx264
1449 enabled dc1394 && require libdc1394 libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394
1450 enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
1452 # Ugh, faac uses stdcall calling convention on win32 so we can't use
1453 # the generic test functions
1454 if enabled faac; then
1456 temp_extralibs -lfaac
1457 check_ld <<EOF && add_extralibs -lfaac || die "ERROR: libfaac not found"
1462 faacEncGetVersion(&id, &cpr);
1469 # Ugh, recent faad2 versions have renamed all functions and #define the
1470 # old names in faad.h. Generic tests won't work.
1471 if enabled faad; then
1473 temp_extralibs -lfaad
1474 check_ld <<EOF && add_extralibs -lfaad || die "ERROR: libfaad not found"
1484 # Ugh, avisynth uses WINAPI calls. Generic tests won't work.
1485 if enabled avisynth; then
1487 temp_extralibs -lvfw32
1488 check_ld <<EOF && add_extralibs -lvfw32 || die "ERROR: vfw32 not found"
1489 #include <windows.h>
1500 # test for lrintf in math.h
1501 check_exec <<EOF && lrintf=yes || lrintf=no
1502 #define _ISOC9X_SOURCE 1
1504 int main( void ) { return (lrintf(3.999f) > 0)?0:1; }
1508 for restrict_keyword in restrict __restrict__ __restrict; do
1509 check_cc <<EOF && _restrict=$restrict_keyword && break
1510 void foo(char * $restrict_keyword p);
1514 # dlopen/dlfcn.h probing
1516 check_header dlfcn.h
1518 if check_func dlopen; then
1520 elif check_func dlopen -ldl; then
1524 if test "$vhook" = "default"; then
1528 if enabled_any vhook a52bin faadbin; then
1532 if test "$targetos" = "CYGWIN" -a "$lstatic" = "yes" ; then
1535 echo "At the moment vhooks don't work on Cygwin static builds."
1536 echo "Patches welcome."
1540 if enabled vhook; then
1541 check_ldflags -rdynamic
1542 check_ldflags -export-dynamic
1545 if enabled audio_beos; then
1546 add_extralibs "-lmedia -lbe"
1549 ##########################################
1552 temp_extralibs -lImlib2
1553 check_ld <<EOF && imlib2=yes || imlib2=no
1554 #include <X11/Xlib.h>
1556 int main( void ) { return (int) imlib_load_font("foo"); }
1560 ##########################################
1564 if test "x$targetos" != "xBeOS"; then
1565 if (freetype-config --version) >/dev/null 2>&1 ; then
1566 temp_cflags `freetype-config --cflags`
1567 temp_extralibs `freetype-config --libs`
1568 check_ld <<EOF && freetype2=yes
1569 #include <ft2build.h>
1570 int main( void ) { return (int) FT_Init_FreeType(0); }
1576 ##########################################
1581 SDL_CONFIG="${cross_prefix}sdl-config"
1582 if ("${SDL_CONFIG}" --version) >/dev/null 2>&1 ; then
1583 temp_cflags `"${SDL_CONFIG}" --cflags`
1584 temp_extralibs `"${SDL_CONFIG}" --libs`
1587 #undef main /* We don't want SDL to override our main() */
1588 int main( void ) { return SDL_Init (SDL_INIT_VIDEO); }
1590 if test $? = 0; then
1591 _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
1592 if test "$_sdlversion" -lt 121 ; then
1596 check_cc <<EOF && sdl_video_size=yes || sdl_video_size=no
1599 const SDL_VideoInfo *vi = SDL_GetVideoInfo();
1600 int w = vi->current_w;
1609 enabled sdl || ffplay=no
1611 ##########################################
1615 if (texi2html -version) >/dev/null 2>&1; then
1619 ##########################################
1622 enabled network && enabled ipv6 && check_ld <<EOF && ipv6=yes || ipv6=no
1623 #include <sys/types.h>
1624 #include <sys/socket.h>
1625 #include <netinet/in.h>
1628 struct sockaddr_storage saddr;
1629 struct ipv6_mreq mreq6;
1630 getaddrinfo(0,0,0,0);
1631 getnameinfo(0,0,0,0,0,0,0);
1632 IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
1636 # check for video4linux2 --- V4L2_PIX_FMT_YUV420
1637 enabled video4linux2 && check_cc <<EOF || video4linux2="no"
1638 #include <sys/time.h>
1639 #include <asm/types.h>
1640 #include <linux/videodev2.h>
1641 int dummy = V4L2_PIX_FMT_YUV420;
1642 struct v4l2_buffer dummy1;
1645 enabled debug && add_cflags -g
1647 # add some useful compiler flags if supported
1648 check_cflags -Wdeclaration-after-statement
1650 check_cflags -Wno-switch
1651 check_cflags -Wdisabled-optimization
1652 check_cflags -Wpointer-arith
1653 check_cflags -Wredundant-decls
1654 enabled extrawarnings && check_cflags -Winline
1656 # add some linker flags
1657 check_ldflags $LDLATEFLAGS
1659 # not all compilers support -Os
1660 test "$optimize" = "small" && check_cflags -Os
1662 if enabled optimize; then
1663 if test -n "`$cc -v 2>&1 | grep xlc`"; then
1671 # PIC flags for shared library objects where they are needed
1672 if test "$lshared" = "yes" ; then
1673 # LIBOBJFLAGS may have already been set in the OS configuration
1674 if test -z "$LIBOBJFLAGS" ; then
1676 x86_64|ia64|alpha|sparc*) LIBOBJFLAGS="\$(PIC)" ;;
1681 if test "$gprof" = "yes" ; then
1686 VHOOKCFLAGS="-fPIC $CFLAGS"
1687 test "$needmdynamicnopic" = yes && add_cflags -mdynamic-no-pic
1689 # find if .align arg is power-of-two or not
1690 if test $asmalign_pot = "unknown"; then
1692 echo 'asm (".align 3");' | check_cc && asmalign_pot="yes"
1695 echo "install prefix $PREFIX"
1696 echo "source path $source_path"
1697 echo "C compiler $cc"
1699 echo "ARCH $arch ($cpu)"
1700 if test "$BUILDSUF" != ""; then
1701 echo "build suffix $BUILDSUF"
1703 echo "big-endian $bigendian"
1704 if test $arch = "x86_32" -o $arch = "x86_64"; then
1705 echo "MMX enabled $mmx"
1706 echo "CMOV enabled $cmov"
1707 echo "CMOV is fast $cmov_is_fast"
1709 if test $arch = "armv4l"; then
1710 echo "ARMv5TE enabled $armv5te"
1711 echo "IWMMXT enabled $iwmmxt"
1713 if test $arch = "mips"; then
1714 echo "MMI enabled $mmi"
1716 if test $arch = "powerpc"; then
1717 echo "AltiVec enabled $altivec"
1718 echo "dcbzl available $dcbzl"
1720 echo "gprof enabled $gprof"
1721 echo "zlib enabled $zlib"
1722 echo "libgsm enabled $libgsm"
1723 echo "mp3lame enabled $mp3lame"
1724 echo "libnut enabled $libnut"
1725 echo "libogg enabled $libogg"
1726 echo "Vorbis enabled $libvorbis"
1727 echo "FAAD enabled $faad"
1728 echo "faadbin enabled $faadbin"
1729 echo "FAAC enabled $faac"
1730 echo "XviD enabled $xvid"
1731 echo "x264 enabled $x264"
1732 echo "a52 support $a52"
1733 echo "a52 dlopened $a52bin"
1734 echo "DTS support $dts"
1735 echo "pp support $pp"
1736 echo "Software Scaler enabled $swscaler"
1737 echo "AVISynth enabled $avisynth"
1738 echo "debug symbols $debug"
1739 echo "strip symbols $dostrip"
1740 echo "optimize $optimize"
1741 echo "static $lstatic"
1742 echo "shared $lshared"
1743 echo "video hooking $vhook"
1744 echo "SDL support $sdl"
1745 if test $sdl_too_old = "yes"; then
1746 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
1749 if test "$vhook" = "yes"; then
1750 echo "Imlib2 support $imlib2"
1751 echo "FreeType support $freetype2"
1753 echo "Sun medialib support" $mlib
1754 echo "pthreads support" $pthreads
1755 echo "AMR-NB float support" $amr_nb
1756 echo "AMR-NB fixed support" $amr_nb_fixed
1757 echo "AMR-WB float support" $amr_wb
1758 echo "AMR-WB IF2 support" $amr_if2
1759 echo "network support $network"
1760 if test "$network" = "yes" ; then
1761 echo "IPv6 support $ipv6"
1763 echo ".align is power-of-two" $asmalign_pot
1764 if test "$gpl" = "no" ; then
1765 echo "License: LGPL"
1770 echo "Creating config.mak and config.h..."
1773 echo " $0 $FFMPEG_CONFIGURATION" >> config.log
1774 echo "# Automatically generated by configure - do not modify!" > config.mak
1775 echo "/* Automatically generated by configure - do not modify! */" > $TMPH
1776 echo "#define FFMPEG_CONFIGURATION "'"'"$FFMPEG_CONFIGURATION"'"' >> $TMPH
1778 echo "PREFIX=$PREFIX" >> config.mak
1779 echo "prefix=\$(DESTDIR)\${PREFIX}" >> config.mak
1780 echo "libdir=\$(DESTDIR)$libdir" >> config.mak
1781 echo "shlibdir=\$(DESTDIR)$shlibdir" >> config.mak
1782 echo "incdir=\$(DESTDIR)$incdir" >> config.mak
1783 echo "bindir=\$(DESTDIR)$bindir" >> config.mak
1784 echo "mandir=\$(DESTDIR)$mandir" >> config.mak
1785 echo "MAKE=$make" >> config.mak
1786 echo "CC=$cc" >> config.mak
1787 echo "AR=$ar" >> config.mak
1788 echo "RANLIB=$ranlib" >> config.mak
1789 if test "$dostrip" = "yes" ; then
1790 echo "STRIP=$strip" >> config.mak
1791 echo "INSTALLSTRIP=$installstrip" >> config.mak
1793 echo "STRIP=echo ignoring strip" >> config.mak
1794 echo "INSTALLSTRIP=" >> config.mak
1797 echo "OPTFLAGS=$CFLAGS" >> config.mak
1798 echo "VHOOKCFLAGS=$VHOOKCFLAGS">>config.mak
1799 echo "LDFLAGS=$LDFLAGS" >> config.mak
1800 echo "LDCONFIG=$LDCONFIG" >> config.mak
1801 echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
1802 echo "SHFLAGS=$SHFLAGS" >> config.mak
1803 echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
1804 echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
1805 echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
1806 echo "BUILD_STATIC=$lstatic" >> config.mak
1807 echo "BUILDSUF=$BUILDSUF" >> config.mak
1808 echo "LIBPREF=$LIBPREF" >> config.mak
1809 echo "LIBSUF=\${BUILDSUF}$LIBSUF" >> config.mak
1810 if test "$lstatic" = "yes" ; then
1811 echo "LIB=$LIB" >> config.mak
1812 else # Some Make complain if this variable does not exist.
1813 echo "LIB=" >> config.mak
1815 echo "SLIBPREF=$SLIBPREF" >> config.mak
1816 echo "SLIBSUF=\${BUILDSUF}$SLIBSUF" >> config.mak
1817 echo "EXESUF=\${BUILDSUF}$EXESUF" >> config.mak
1818 echo "TARGET_OS=$targetos" >> config.mak
1819 if test "$arch" = "x86_32" -o "$arch" = "x86_64" ; then
1820 echo "TARGET_ARCH_X86=yes" >> config.mak
1821 echo "#define ARCH_X86 1" >> $TMPH
1823 if test "$arch" = "x86_32" ; then
1824 echo "TARGET_ARCH_X86_32=yes" >> config.mak
1825 echo "#define ARCH_X86_32 1" >> $TMPH
1826 elif test "$arch" = "x86_64" ; then
1827 echo "TARGET_ARCH_X86_64=yes" >> config.mak
1828 echo "#define ARCH_X86_64 1" >> $TMPH
1829 elif test "$arch" = "armv4l" ; then
1830 echo "TARGET_ARCH_ARMV4L=yes" >> config.mak
1831 echo "#define ARCH_ARMV4L 1" >> $TMPH
1832 elif test "$arch" = "alpha" ; then
1833 echo "TARGET_ARCH_ALPHA=yes" >> config.mak
1834 echo "#define ARCH_ALPHA 1" >> $TMPH
1835 elif test "$arch" = "sparc64" ; then
1836 echo "TARGET_ARCH_SPARC64=yes" >> config.mak
1837 echo "#define ARCH_SPARC64 1" >> $TMPH
1838 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1839 echo "#define ARCH_SPARC 1" >> $TMPH
1840 elif test "$arch" = "sparc" ; then
1841 echo "TARGET_ARCH_SPARC=yes" >> config.mak
1842 echo "#define ARCH_SPARC 1" >> $TMPH
1843 elif test "$arch" = "powerpc" ; then
1844 echo "TARGET_ARCH_POWERPC=yes" >> config.mak
1845 echo "#define ARCH_POWERPC 1" >> $TMPH
1846 if test $POWERPCMODE = "32bits"; then
1847 echo "#define POWERPC_MODE_32BITS 1" >> $TMPH
1849 echo "#define POWERPC_MODE_64BITS 1" >> $TMPH
1851 if test "$powerpc_perf" = "yes"; then
1852 echo "#define POWERPC_PERFORMANCE_REPORT 1" >> $TMPH
1854 elif test "$arch" = "mips" ; then
1855 echo "TARGET_ARCH_MIPS=yes" >> config.mak
1856 echo "#define ARCH_MIPS 1" >> $TMPH
1857 elif test "$arch" = "sh4" ; then
1858 echo "TARGET_ARCH_SH4=yes" >> config.mak
1859 echo "#define ARCH_SH4 1" >> $TMPH
1860 elif test "$arch" = "parisc" ; then
1861 echo "TARGET_ARCH_PARISC=yes" >> config.mak
1862 echo "#define ARCH_PARISC 1" >> $TMPH
1863 elif test "$arch" = "s390" ; then
1864 echo "TARGET_ARCH_S390=yes" >> config.mak
1865 echo "#define ARCH_S390 1" >> $TMPH
1866 elif test "$arch" = "m68k" ; then
1867 echo "TARGET_ARCH_M68K=yes" >> config.mak
1868 echo "#define ARCH_M68K 1" >> $TMPH
1869 elif test "$arch" = "ia64" ; then
1870 echo "TARGET_ARCH_IA64=yes" >> config.mak
1871 echo "#define ARCH_IA64 1" >> $TMPH
1872 elif test "$arch" = "bfin" ; then
1873 echo "TARGET_ARCH_BFIN=yes" >> config.mak
1874 echo "#define ARCH_BFIN 1" >> $TMPH
1876 echo "#define TUNECPU $TUNECPU" >> $TMPH
1877 if test "$bigendian" = "yes" ; then
1878 echo "WORDS_BIGENDIAN=yes" >> config.mak
1879 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
1881 if test "$mmx" = "yes" ; then
1882 echo "TARGET_MMX=yes" >> config.mak
1883 echo "#define HAVE_MMX 1" >> $TMPH
1884 echo "#define __CPU__ 586" >> $TMPH
1886 if test "$cmov" = "yes" ; then
1887 echo "TARGET_CMOV=yes" >> config.mak
1888 echo "#define HAVE_CMOV 1" >> $TMPH
1890 if test "$cmov_is_fast" = "yes" ; then
1891 echo "TARGET_CMOV_IS_FAST=yes" >> config.mak
1892 echo "#define CMOV_IS_FAST 1" >> $TMPH
1894 if test "$armv5te" = "yes" ; then
1895 echo "TARGET_ARMV5TE=yes" >> config.mak
1896 echo "#define HAVE_ARMV5TE 1" >> $TMPH
1898 if test "$iwmmxt" = "yes" ; then
1899 echo "TARGET_IWMMXT=yes" >> config.mak
1900 echo "#define HAVE_IWMMXT 1" >> $TMPH
1902 if test "$mmi" = "yes" ; then
1903 echo "TARGET_MMI=yes" >> config.mak
1904 echo "#define HAVE_MMI 1" >> $TMPH
1907 if test "$altivec" = "yes" ; then
1908 echo "TARGET_ALTIVEC=yes" >> config.mak
1909 echo "#define HAVE_ALTIVEC 1" >> $TMPH
1912 if test "$sdl" = "yes" ; then
1913 echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
1914 echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
1916 if test "$texi2html" = "yes"; then
1917 echo "BUILD_DOC=yes" >> config.mak
1920 sws_version=`grep '#define LIBSWSCALE_VERSION ' "$source_path/libswscale/swscale.h" | sed 's/[^0-9\.]//g'`
1921 pp_version=`grep '#define LIBPOSTPROC_VERSION ' "$source_path/libpostproc/postprocess.h" | sed 's/[^0-9\.]//g'`
1922 lavc_version=`grep '#define LIBAVCODEC_VERSION ' "$source_path/libavcodec/avcodec.h" | sed 's/[^0-9\.]//g'`
1923 lavf_version=`grep '#define LIBAVFORMAT_VERSION ' "$source_path/libavformat/avformat.h" | sed 's/[^0-9\.]//g'`
1924 lavu_version=`grep '#define LIBAVUTIL_VERSION ' "$source_path/libavutil/avutil.h" | sed 's/[^0-9\.]//g'`
1928 if test "$lshared" = "yes" ; then
1929 echo "#define BUILD_SHARED_AV 1" >> $TMPH
1930 echo "BUILD_SHARED=yes" >> config.mak
1931 echo "PIC=-fPIC -DPIC" >> config.mak
1932 echo "SPPMAJOR=${lavc_version%%.*}" >> config.mak
1933 echo "SPPVERSION=$lavc_version" >> config.mak
1934 echo "LAVCMAJOR=${lavc_version%%.*}" >> config.mak
1935 echo "LAVCVERSION=$lavc_version" >> config.mak
1936 echo "LAVFMAJOR=${lavf_version%%.*}" >> config.mak
1937 echo "LAVFVERSION=$lavf_version" >> config.mak
1938 echo "LAVUMAJOR=${lavu_version%%.*}" >> config.mak
1939 echo "LAVUVERSION=$lavu_version" >> config.mak
1940 echo "SWSMAJOR=${sws_version%%.*}" >> config.mak
1941 echo "SWSVERSION=$sws_version" >> config.mak
1942 echo "SLIBNAME=${SLIBNAME}" >> config.mak
1943 echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
1944 echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
1945 echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
1947 echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
1948 echo "EXTRALIBS=$extralibs" >> config.mak
1950 enabled_any $ENCODER_LIST && enable encoders
1951 enabled_any $DECODER_LIST && enable decoders
1952 enabled_any $MUXER_LIST && enable muxers
1953 enabled_any $DEMUXER_LIST && enable demuxers
1955 enabled_any pthreads beosthreads os2threads w32threads && enable threads
1957 print_config HAVE_ $TMPH config.mak $HAVE_LIST
1958 print_config CONFIG_ $TMPH config.mak $CONFIG_LIST
1960 if test "$targetos" = "Darwin"; then
1961 echo "#define CONFIG_DARWIN 1" >> $TMPH
1964 echo "#define restrict $_restrict" >> $TMPH
1966 if test "$optimize" = "small"; then
1967 echo "#define always_inline" >> $TMPH
1968 echo "#define CONFIG_SMALL 1" >> $TMPH
1971 echo "SRC_PATH=\"$source_path\"" >> config.mak
1972 echo "SRC_PATH_BARE=$source_path" >> config.mak
1973 echo "BUILD_ROOT=\"$PWD\"" >> config.mak
1975 if test "$amr_if2" = "yes" ; then
1976 echo "AMR_CFLAGS=-DIF2=1" >> config.mak
1979 # Apparently it's not possible to portably echo a backslash.
1980 if test "$asmalign_pot" = "yes" ; then
1981 printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH
1983 printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
1987 for codec in $DECODER_LIST $ENCODER_LIST $PARSER_LIST $DEMUXER_LIST $MUXER_LIST; do
1988 ucname="`toupper $codec`"
1989 config_name="CONFIG_$ucname"
1990 enabled_name="ENABLE_$ucname"
1991 if enabled $codec; then
1992 echo "#define $config_name 1" >> $TMPH
1993 echo "#define $enabled_name 1" >> $TMPH
1994 echo "$config_name=yes" >> config.mak
1996 echo "#define $enabled_name 0" >> $TMPH
2000 # Do not overwrite config.h if unchanged to avoid superfluous rebuilds.
2001 if ! cmp -s $TMPH config.h; then
2002 mv -f $TMPH config.h
2004 echo "config.h is unchanged"
2007 rm -f $TMPO $TMPC $TMPE $TMPS $TMPH
2009 # build tree in object directory if source path is different from current one
2010 if test "$source_path_used" = "yes" ; then
2032 libavformat/Makefile \
2033 libavcodec/Makefile \
2034 libpostproc/Makefile \
2035 libavutil/Makefile \
2036 libswscale/Makefile \
2042 for dir in $DIRS ; do
2045 for f in $FILES ; do
2046 ln -sf "$source_path/$f" $f
2050 # build pkg-config files libav*.pc and libpostproc.pc
2052 cat <<EOF >libavutil.pc
2054 exec_prefix=\${prefix}
2055 libdir=\${exec_prefix}/lib
2056 includedir=\${prefix}/include
2059 Description: FFmpeg utility library
2060 Version: $lavu_version
2063 Libs: -L\${libdir} -lavutil
2064 Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2067 cat <<EOF >libavutil-uninstalled.pc
2070 libdir=\${pcfiledir}/libavutil
2071 includedir=\${pcfiledir}/libavutil
2074 Description: FFmpeg utility library
2075 Version: $lavu_version
2078 Libs: \${libdir}/${LIBPREF}avutil${LIBSUF}
2079 Cflags: -I\${includedir}
2083 cat <<EOF >libavcodec.pc
2085 exec_prefix=\${prefix}
2086 libdir=\${exec_prefix}/lib
2087 includedir=\${prefix}/include
2090 Description: FFmpeg codec library
2091 Version: $lavc_version
2092 Requires: $pkg_requires libavutil = $lavu_version
2094 Libs: -L\${libdir} -lavcodec $extralibs
2095 Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2098 cat <<EOF >libavcodec-uninstalled.pc
2101 libdir=\${pcfiledir}/libavcodec
2102 includedir=\${pcfiledir}/libavcodec
2105 Description: FFmpeg codec library
2106 Version: $lavc_version
2107 Requires: $pkg_requires libavutil = $lavu_version
2109 Libs: \${libdir}/${LIBPREF}avcodec${LIBSUF} $extralibs
2110 Cflags: -I\${includedir}
2114 cat <<EOF >libavformat.pc
2116 exec_prefix=\${prefix}
2117 libdir=\${exec_prefix}/lib
2118 includedir=\${prefix}/include
2121 Description: FFmpeg container format library
2122 Version: $lavf_version
2123 Requires: $pkg_requires libavcodec = $lavc_version
2125 Libs: -L\${libdir} -lavformat $extralibs
2126 Cflags: -I\${includedir} -I\${includedir}/ffmpeg
2129 cat <<EOF >libavformat-uninstalled.pc
2132 libdir=\${pcfiledir}/libavformat
2133 includedir=\${pcfiledir}/libavformat
2136 Description: FFmpeg container format library
2137 Version: $lavf_version
2138 Requires: $pkg_requires libavcodec = $lavc_version
2140 Libs: \${libdir}/${LIBPREF}avformat${LIBSUF} $extralibs
2141 Cflags: -I\${includedir}
2146 cat <<EOF >libpostproc.pc
2148 exec_prefix=\${prefix}
2149 libdir=\${exec_prefix}/lib
2150 includedir=\${prefix}/include
2153 Description: FFmpeg post processing library
2154 Version: $lavc_version
2157 Libs: -L\${libdir} -lpostproc
2158 Cflags: -I\${includedir} -I\${includedir}/postproc
2161 cat <<EOF >libpostproc-uninstalled.pc
2164 libdir=\${pcfiledir}/libpostproc
2165 includedir=\${pcfiledir}/libpostproc
2168 Description: FFmpeg post processing library
2169 Version: $lavc_version
2172 Libs: \${libdir}/${LIBPREF}postproc${LIBSUF}
2173 Cflags: -I\${includedir}
2176 if test "$swscaler" != "no"; then
2177 sws_pc_libs="-L\${libdir} -lswscale"
2178 sws_pc_uninstalled_libs="\${libdir}/${LIBPREF}swscale${LIBSUF}"
2179 sws_pc_requires="$pkg_requires libavutil = $lavu_version"
2182 sws_pc_uninstalled_libs=""
2183 sws_pc_requires="$pkg_requires libavcodec = $lavc_version"
2186 cat <<EOF >libswscale.pc
2188 exec_prefix=\${prefix}
2189 libdir=\${exec_prefix}/lib
2190 includedir=\${prefix}/include
2193 Description: FFmpeg image rescaling library
2194 Version: $sws_version
2195 Requires: $sws_pc_requires
2198 Cflags: -I\${includedir} -I\${includedir}/swscale
2201 cat <<EOF >libswscale-uninstalled.pc
2204 libdir=\${pcfiledir}/libswscale
2205 includedir=\${pcfiledir}/libswscale
2208 Description: FFmpeg image rescaling library
2209 Version: $sws_version
2210 Requires: $sws_pc_requires
2212 Libs: $sws_pc_uninstalled_libs
2213 Cflags: -I\${includedir}