3 # FFmpeg configure script
5 # Copyright (c) 2000-2002 Fabrice Bellard
6 # Copyright (c) 2005-2008 Diego Biurrun
7 # Copyright (c) 2005-2008 Mans Rullgard
10 # Prevent locale nonsense from breaking basic text processing.
13 # make sure we are running under a compatible shell
14 # try to make this part work with most shells
17 echo "Trying shell $1"
18 type "$1" > /dev/null 2>&1 && exec "$@"
22 (: ${foo%%bar}) 2> /dev/null
25 (: ${foo?}) 2> /dev/null
28 if test "$E1" != 0 || test "$E2" = 0; then
29 echo "Broken shell detected. Trying alternatives."
31 if test "0$FF_CONF_EXEC" -lt 1; then
33 try_exec bash "$0" "$@"
35 if test "0$FF_CONF_EXEC" -lt 2; then
37 try_exec ksh "$0" "$@"
39 if test "0$FF_CONF_EXEC" -lt 3; then
41 try_exec /usr/xpg4/bin/sh "$0" "$@"
43 echo "No compatible shell script interpreter found."
44 echo "This configure script requires a POSIX-compatible shell"
45 echo "such as bash or ksh."
46 echo "THIS IS NOT A BUG IN FFMPEG, DO NOT REPORT IT AS SUCH."
47 echo "Instead, install a working POSIX-compatible shell."
48 echo "Disabling this configure test will create a broken FFmpeg."
49 if test "$BASH_VERSION" = '2.04.0(1)-release'; then
50 echo "This bash version ($BASH_VERSION) is broken on your platform."
51 echo "Upgrade to a later version if available."
57 echo "Usage: configure [options]"
58 echo "Options: [defaults in brackets after descriptions]"
60 echo "Standard options:"
61 echo " --help print this message"
62 echo " --logfile=FILE log tests and output to FILE [config.err]"
63 echo " --disable-logging do not log configure debug information"
64 echo " --prefix=PREFIX install in PREFIX [$prefix]"
65 echo " --bindir=DIR install binaries in DIR [PREFIX/bin]"
66 echo " --libdir=DIR install libs in DIR [PREFIX/lib]"
67 echo " --shlibdir=DIR install shared libs in DIR [PREFIX/lib]"
68 echo " --incdir=DIR install includes in DIR [PREFIX/include]"
69 echo " --mandir=DIR install man page in DIR [PREFIX/share/man]"
70 echo " --enable-static build static libraries [default=yes]"
71 echo " --disable-static do not build static libraries [default=no]"
72 echo " --enable-shared build shared libraries [default=no]"
73 echo " --disable-shared do not build shared libraries [default=yes]"
74 echo " --enable-gpl allow use of GPL code, the resulting libav*"
75 echo " and ffmpeg will be under GPL [default=no]"
76 echo " --enable-nonfree allow use of nonfree code, the resulting libav*"
77 echo " and ffmpeg will be unredistributable [default=no]"
78 echo " --enable-postproc enable GPLed postprocessing support [default=no]"
79 echo " --enable-swscale software scaler support [default=no]"
80 echo " --enable-avfilter video filter support (replaces vhook) [default=no]"
81 echo " --enable-avfilter-lavf video filters dependant on avformat [default=no]"
82 echo " --enable-beosthreads use BeOS threads [default=no]"
83 echo " --enable-os2threads use OS/2 threads [default=no]"
84 echo " --enable-pthreads use pthreads [default=no]"
85 echo " --enable-w32threads use Win32 threads [default=no]"
86 echo " --enable-x11grab enable X11 grabbing [default=no]"
88 echo "External library support:"
89 echo " --enable-mlib use Sun medialib [default=no]"
90 echo " --enable-liba52 enable GPLed liba52 support [default=no]"
91 echo " --enable-liba52bin open liba52.so.0 at runtime [default=no]"
92 echo " --enable-avisynth allow reading AVISynth script files [default=no]"
93 echo " --enable-libamr-nb enable libamr-nb floating point audio codec"
94 echo " --enable-libamr-wb enable libamr-wb floating point audio codec"
95 echo " --enable-libdc1394 enable IIDC-1394 grabbing using libdc1394"
96 echo " and libraw1394 [default=no]"
97 echo " --enable-libdirac enable Dirac support via libdirac [default=no]"
98 echo " --enable-libfaac enable FAAC support via libfaac [default=no]"
99 echo " --enable-libfaad enable FAAD support via libfaad [default=no]"
100 echo " --enable-libfaadbin open libfaad.so.0 at runtime [default=no]"
101 echo " --enable-libgsm enable GSM support via libgsm [default=no]"
102 echo " --enable-libmp3lame enable MP3 encoding via libmp3lame [default=no]"
103 echo " --enable-libnut enable NUT (de)muxing via libnut,"
104 echo " native demuxer exists [default=no]"
105 echo " --enable-libschroedinger enable Dirac support via libschroedinger [default=no]"
106 echo " --enable-libtheora enable Theora encoding via libtheora [default=no]"
107 echo " --enable-libvorbis enable Vorbis encoding via libvorbis,"
108 echo " native implementation exists [default=no]"
109 echo " --enable-libx264 enable H.264 encoding via x264 [default=no]"
110 echo " --enable-libxvid enable Xvid encoding via xvidcore,"
111 echo " native MPEG-4/Xvid encoder exists [default=no]"
113 echo "Advanced options (experts only):"
114 echo " --source-path=PATH path to source code [$source_path]"
115 echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
116 echo " --enable-cross-compile assume a cross-compiler is used"
117 echo " --target-os=OS compiler targets OS [$target_os]"
118 echo " --cc=CC use C compiler CC [$cc]"
119 echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
120 echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
121 echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
122 echo " --extra-version=STRING version string suffix []"
123 echo " --build-suffix=SUFFIX suffix for application specific build []"
124 echo " --arch=ARCH select architecture [$arch]"
125 echo " --cpu=CPU selects the minimum cpu required (affects"
126 echo " instruction selection, may crash on older CPUs)"
127 echo " --enable-powerpc-perf enable performance report on PPC"
128 echo " (requires enabling PMC)"
129 echo " --disable-mmx disable MMX usage"
130 echo " --disable-mmx2 disable MMX2 usage"
131 echo " --disable-ssse3 disable SSSE3 usage"
132 echo " --disable-armv5te disable armv5te usage"
133 echo " --disable-armv6 disable armv6 usage"
134 echo " --disable-armvfp disable ARM VFP usage"
135 echo " --disable-iwmmxt disable iwmmxt usage"
136 echo " --disable-altivec disable AltiVec usage"
137 echo " --disable-network disable network support [default=no]"
138 echo " --disable-ipv6 disable ipv6 support [default=no]"
139 echo " --disable-zlib disable zlib [default=no]"
140 echo " --disable-bzlib disable bzlib [default=no]"
141 echo " --disable-vhook disable video hooking support"
142 echo " --disable-mpegaudio-hp faster (but less accurate)"
143 echo " MPEG audio decoding [default=no]"
144 echo " --enable-gray enable full grayscale support (slower color)"
145 echo " --disable-ffmpeg disable ffmpeg build"
146 echo " --disable-ffserver disable ffserver build"
147 echo " --disable-ffplay disable ffplay build"
148 echo " --enable-small optimize for size instead of speed"
149 echo " --enable-hardcoded-tables use hardcoded tables instead of runtime generation"
150 echo " --enable-memalign-hack emulate memalign, interferes with memory debuggers"
151 echo " --disable-encoder=NAME disables encoder NAME"
152 echo " --enable-encoder=NAME enables encoder NAME"
153 echo " --disable-decoder=NAME disables decoder NAME"
154 echo " --enable-decoder=NAME enables decoder NAME"
155 echo " --disable-encoders disables all encoders"
156 echo " --disable-decoders disables all decoders"
157 echo " --disable-muxer=NAME disables muxer NAME"
158 echo " --enable-muxer=NAME enables muxer NAME"
159 echo " --disable-muxers disables all muxers"
160 echo " --disable-demuxer=NAME disables demuxer NAME"
161 echo " --enable-demuxer=NAME enables demuxer NAME"
162 echo " --disable-demuxers disables all demuxers"
163 echo " --enable-parser=NAME enables parser NAME"
164 echo " --disable-parser=NAME disables parser NAME"
165 echo " --disable-parsers disables all parsers"
166 echo " --enable-bsf=NAME enables bitstream filter NAME"
167 echo " --disable-bsf=NAME disables bitstream filter NAME"
168 echo " --disable-bsfs disables all bitstream filters"
169 echo " --enable-protocol=NAME enables protocol NAME"
170 echo " --disable-protocol=NAME disables protocol NAME"
171 echo " --disable-protocols disables all protocols"
172 echo " --disable-devices disables all devices"
173 echo " --list-decoders show all available decoders"
174 echo " --list-encoders show all available encoders"
175 echo " --list-muxers show all available muxers"
176 echo " --list-demuxers show all available demuxers"
177 echo " --list-parsers show all available parsers"
178 echo " --list-protocols show all available protocols"
179 echo " --list-bsfs show all available bitstream filters"
180 echo " --list-indevs show all available input devices"
181 echo " --list-outdevs show all available output devices"
183 echo "Developer options (useful when working on FFmpeg itself):"
184 echo " --disable-debug disable debugging symbols"
185 echo " --enable-debug=LEVEL set the debug level [$debuglevel]"
186 echo " --enable-gprof enable profiling with gprof [$gprof]"
187 echo " --disable-optimizations disable compiler optimizations"
188 echo " --enable-extra-warnings enable more compiler warnings"
189 echo " --disable-stripping disable stripping of executables and shared libraries"
191 echo "NOTE: Object files are built at the place where configure is launched."
196 echo "$@" >> $logfile
201 pr -n -t $1 >> $logfile
213 If you think configure made a mistake, make sure you are using the latest
214 version from SVN. If the latest version fails, report the problem to the
215 ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
217 if disabled logging; then
219 Rerun configure with logging enabled (do not use --disable-logging), and
220 include the log this produces with your report.
224 Include the log file "$logfile" produced by configure as this will help
228 rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
232 # Avoid locale weirdness, besides we really just want to translate ASCII.
234 echo "$@" | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ
238 echo "$@" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz
251 eval level=\${${var}_level:=0}
252 eval ${var}_${level}="\$$var"
253 eval ${var}_level=$(($level+1))
259 eval level=\${${var}_level:-0}
260 test $level = 0 && continue
261 eval level=$(($level-1))
262 eval $var="\${${var}_${level}}"
263 eval ${var}_level=$level
264 eval unset ${var}_${level}
277 test "${1#!}" = "$1" && op== || op=!=
278 eval test "x\$${1#!}" $op "xyes"
282 test "${1#!}" = "$1" && op== || op=!=
283 eval test "x\$${1#!}" $op "xno"
288 enabled $opt || return 1
294 disabled $opt || return 1
300 enabled $opt && return 0
306 disabled $opt && return 0
312 eval test -z "\$$opt" && eval $opt=\$${opt}_default
320 [ $var = $value ] && return 0
328 enabled ${cfg}_checking && die "Circular dependency for $cfg."
329 disabled ${cfg}_checking && continue
330 enable ${cfg}_checking
332 eval dep_all="\$${cfg}_deps"
333 eval dep_any="\$${cfg}_deps_any"
335 pushvar cfg dep_all dep_any
336 check_deps $dep_all $dep_any
337 popvar cfg dep_all dep_any
339 enabled_all $dep_all || disable $cfg
340 enabled_any $dep_any || disable $cfg
342 if enabled $cfg; then
343 eval dep_extralibs="\$${cfg}_extralibs"
344 test -n "$dep_extralibs" && add_extralibs $dep_extralibs
347 disable ${cfg}_checking
357 ucname="`toupper $cfg`"
358 if enabled $cfg; then
359 echo "#define ${pfx}${ucname} 1" >> $header
360 echo "#define ENABLE_${ucname} 1" >> $header
361 echo "${pfx}${ucname}=yes" >> $makefile
363 echo "#define ENABLE_${ucname} 0" >> $header
369 (: ${SAVE_CFLAGS?}) 2> /dev/null
373 flags_saved && return
374 SAVE_CFLAGS="$CFLAGS"
375 SAVE_LDFLAGS="$LDFLAGS"
376 SAVE_extralibs="$extralibs"
380 flags_saved || return
381 CFLAGS="$SAVE_CFLAGS"
382 LDFLAGS="$SAVE_LDFLAGS"
383 extralibs="$SAVE_extralibs"
396 LDFLAGS="$LDFLAGS $*"
401 extralibs="$extralibs $*"
407 flags_saved && eval "SAVE_$var=\"\$SAVE_$var $*\""
408 eval "$var=\"\$$var $*\""
420 append extralibs "$@"
425 "$@" >> $logfile 2>&1
432 check_cmd $cc $CFLAGS "$@" -c -o $TMPO $TMPC
439 check_cmd $cc $CFLAGS "$@" -E -o $TMPO $TMPC
447 check_cc "$@" <<EOF && enable $name || disable $name
448 int foo(void){ asm volatile($asm); }
457 check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
466 test "${f}" = "${f#-l}" && flags="$flags $f" || libs="$libs $f"
468 check_cmd $cc $LDFLAGS $flags -o $TMPE $TMPO $extralibs $libs
472 log check_cflags "$@"
473 check_cc "$@" <<EOF && add_cflags "$@"
479 log check_ldflags "$@"
480 check_ld "$@" <<EOF && add_ldflags "$@"
481 int main(void){ return 0; }
486 log check_header "$@"
489 var=`echo $header | sed 's/[^A-Za-z0-9_]/_/g'`
491 check_cpp "$@" <<EOF && enable $var
502 check_ld "$@" <<EOF && enable $func
504 int main(void){ $func(); }
508 check_func_headers(){
509 log check_func_headers "$@"
515 for hdr in $headers; do
519 check_ld "$@" <<EOF && enable $func
521 int main(int argc, char **argv){
534 check_header $header && check_func $func && add_extralibs "$@"
546 check_func_headers "$headers" $func && add_extralibs "$@"
553 check_ld "$@" && { enabled cross_compile || $TMPE >> $logfile 2>&1; }
559 # exit() is not async signal safe. _Exit (C99) and _exit (POSIX)
560 # are safe but may not be available everywhere. Thus we use
561 # raise(SIGTERM) instead. The check is run in a subshell so we
562 # can redirect the "Terminated" message from the shell. SIGBUS
563 # is not defined by standard C so it is used conditionally.
565 (check_exec "$@") >> $logfile 2>&1 <<EOF
567 static void sighandler(int sig){
571 signal(SIGILL, sighandler);
572 signal(SIGFPE, sighandler);
573 signal(SIGSEGV, sighandler);
575 signal(SIGBUS, sighandler);
589 for hdr in $headers; do
593 check_cc "$@" <<EOF && enable $type
604 check_lib $header $func "$@" || die "ERROR: $name not found"
612 check_lib2 "$headers" $func "$@" || die "ERROR: $name not found"
622 check_cmd ${pkg}-config --version
624 if test "$err" = 0; then
625 temp_cflags `${pkg}-config --cflags`
626 temp_extralibs `${pkg}-config --libs`
627 check_lib "$@" $header $func && enable $cfg
635 "$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
638 # CONFIG_LIST contains configurable options, while HAVE_LIST is for
639 # system-dependent things.
750 dev_bktr_ioctl_bt848_h
751 dev_bktr_ioctl_meteor_h
753 dev_video_meteor_ioctl_meteor_h
754 dev_video_bktr_ioctl_bt848_h
775 machine_ioctl_bt848_h
776 machine_ioctl_meteor_h
836 # code dependency declarations
838 # architecture extensions
839 altivec_deps="powerpc"
840 armv5te_deps="armv4l"
851 # system headers and functions
852 byteswap_h_deps="!armv4l"
854 # decoders / encoders
855 ac3_decoder_deps="gpl !liba52"
856 dxa_decoder_deps="zlib"
857 eac3_decoder_deps="gpl"
858 flashsv_decoder_deps="zlib"
859 flashsv_encoder_deps="zlib"
860 mlp_decoder_deps="mlp_parser"
861 mpeg_xvmc_decoder_deps="xvmc"
862 png_decoder_deps="zlib"
863 png_encoder_deps="zlib"
864 zmbv_decoder_deps="zlib"
865 zmbv_encoder_deps="zlib"
868 liba52_decoder_deps="liba52"
869 liba52bin_decoder_extralibs='$ldl'
870 libamr_nb_decoder_deps="libamr_nb"
871 libamr_nb_encoder_deps="libamr_nb"
872 libamr_wb_decoder_deps="libamr_wb"
873 libamr_wb_encoder_deps="libamr_wb"
874 libdirac_decoder_deps="libdirac !libschroedinger"
875 libdirac_encoder_deps="libdirac"
876 libfaac_encoder_deps="libfaac"
877 libfaad_decoder_deps="libfaad"
878 libfaadbin_decoder_extralibs='$ldl'
879 libgsm_decoder_deps="libgsm"
880 libgsm_encoder_deps="libgsm"
881 libgsm_ms_decoder_deps="libgsm"
882 libgsm_ms_encoder_deps="libgsm"
883 libmp3lame_encoder_deps="libmp3lame"
884 libschroedinger_decoder_deps="libschroedinger"
885 libschroedinger_encoder_deps="libschroedinger"
886 libtheora_encoder_deps="libtheora"
887 libvorbis_encoder_deps="libvorbis"
888 libx264_encoder_deps="libx264"
889 libxvid_encoder_deps="libxvid"
890 mpeg4aac_decoder_deps="libfaad"
893 ac3_demuxer_deps="ac3_parser"
894 audio_beos_demuxer_deps="audio_beos"
895 audio_beos_demuxer_extralibs="-lmedia -lbe"
896 audio_beos_muxer_deps="audio_beos"
897 audio_beos_muxer_extralibs="-lmedia -lbe"
898 avisynth_demuxer_deps="avisynth"
899 bktr_demuxer_deps_any="dev_bktr_ioctl_bt848_h machine_ioctl_bt848_h dev_video_bktr_ioctl_bt848_h dev_ic_bt8xx_h"
900 dirac_demuxer_deps="dirac_parser"
901 dv1394_demuxer_deps="dv1394 dv_demuxer"
902 libdc1394_demuxer_deps="libdc1394"
903 libnut_demuxer_deps="libnut"
904 libnut_muxer_deps="libnut"
905 mp3_demuxer_deps="mpegaudio_parser"
906 oss_demuxer_deps_any="soundcard_h sys_soundcard_h"
907 oss_muxer_deps_any="soundcard_h sys_soundcard_h"
908 redir_demuxer_deps="network"
909 rtp_muxer_deps="network rtp_protocol"
910 rtsp_demuxer_deps="sdp_demuxer"
911 sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
912 v4l_demuxer_deps="linux_videodev_h"
913 v4l2_demuxer_deps_any="linux_videodev2_h sys_videoio_h"
914 vfwcap_demuxer_deps="capCreateCaptureWindow"
915 vfwcap_demuxer_extralibs="-lvfw32"
916 x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
917 x11_grab_device_demuxer_extralibs="-lX11 -lXext"
920 http_protocol_deps="network"
921 rtp_protocol_deps="udp_protocol"
922 tcp_protocol_deps="network"
923 udp_protocol_deps="network"
926 movie_filter_deps="avfilter_lavf"
930 ffserver_deps="ffm_muxer rtp_protocol rtsp_demuxer"
931 ffserver_extralibs='$ldl'
932 vhook_extralibs='$ldl'
940 prefix_default="/usr/local"
941 bindir_default='${prefix}/bin'
942 incdir_default='${prefix}/include'
943 libdir_default='${prefix}/lib'
944 mandir_default='${prefix}/share/man'
945 shlibdir_default="$libdir_default"
954 asmalign_pot="unknown"
963 target_os=$(tolower $(uname -s))
969 # configurable options
984 add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
985 SHFLAGS='-shared -Wl,-soname,$$(@F)'
986 VHOOKSHFLAGS='$(SHFLAGS)'
987 FFSERVERLDFLAGS=-Wl,-E
990 FULLNAME='$(NAME)$(BUILDSUF)'
991 LIBNAME='$(LIBPREF)$(FULLNAME)$(LIBSUF)'
994 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF)'
995 SLIBNAME_WITH_VERSION='$(SLIBNAME).$(LIBVERSION)'
996 SLIBNAME_WITH_MAJOR='$(SLIBNAME).$(LIBMAJOR)'
997 LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(LIBDIR)/$(LIBNAME)"'
999 # gcc stupidly only outputs the basename of targets with -MM
1000 DEPEND_CMD='$(CC) $(CFLAGS) -MM -MG $< | sed -e "/^\#.*/d" -e "1s,^,$(@D)/," -e "s,\\([[:space:]]\\)\\(version\\.h\\),\\1\$$(BUILD_ROOT_REL)/\\2,"'
1003 source_path="`dirname \"$0\"`"
1004 enable source_path_used
1005 if test -z "$source_path" -o "$source_path" = "." ; then
1007 disable source_path_used
1009 source_path="`cd \"$source_path\"; pwd`"
1010 echo "$source_path" | grep -q '[[:blank:]]' &&
1011 die "Out of tree builds are impossible with whitespace in source path."
1014 FFMPEG_CONFIGURATION="$@"
1019 file=$source_path/$3
1020 sed -n "s/^[^#]*$pattern.*([^,]*, *\([^,]*\)\(,.*\)*).*/\1_$thing/p" "$file"
1023 ENCODER_LIST=$(find_things encoder ENC libavcodec/allcodecs.c)
1024 DECODER_LIST=$(find_things decoder DEC libavcodec/allcodecs.c)
1025 PARSER_LIST=$(find_things parser PARSER libavcodec/allcodecs.c)
1026 BSF_LIST=$(find_things bsf BSF libavcodec/allcodecs.c)
1027 MUXER_LIST=$(find_things muxer _MUX libavformat/allformats.c)
1028 DEMUXER_LIST=$(find_things demuxer DEMUX libavformat/allformats.c)
1029 OUTDEV_LIST=$(find_things muxer _MUX libavdevice/alldevices.c)
1030 INDEV_LIST=$(find_things demuxer DEMUX libavdevice/alldevices.c)
1031 PROTOCOL_LIST=$(find_things protocol PROTOCOL libavformat/allformats.c)
1032 FILTER_LIST=$(find_things filter FILTER libavfilter/allfilters.c)
1034 enable $ARCH_EXT_LIST \
1047 echo "Unknown option \"$1\"."
1048 echo "See $0 --help for available options."
1055 echo $* | sed s/$suffix//g | tr ' ' '\n' | sort
1062 --extra-cflags=*) add_cflags "$optval"
1064 --extra-ldflags=*) add_ldflags "$optval"
1066 --extra-libs=*) add_extralibs "$optval"
1068 --disable-devices) disable $INDEV_LIST $OUTDEV_LIST
1070 --enable-debug=*) debuglevel="$optval"
1072 --enable-*=*|--disable-*=*)
1073 eval `echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/'`
1075 encoder|decoder|muxer|demuxer|parser|bsf|protocol|filter) $action ${optval}_${thing} ;;
1076 *) die_unknown "$opt" ;;
1079 --enable-?*|--disable-?*)
1080 eval `echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g'`
1081 if is_in $option $COMPONENT_LIST; then
1082 eval $action \$$(toupper ${option%s})_LIST
1083 elif is_in $option $CMDLINE_SELECT; then
1090 NAME="${opt#--list-}"
1091 is_in $NAME $COMPONENT_LIST || die_unknown $opt
1093 eval show_list $NAME \$$(toupper $NAME)_LIST
1095 --help|-h) show_help
1099 optname="${optname#--}"
1100 optname=$(echo "$optname" | sed 's/-/_/g')
1101 is_in $optname $CMDLINE_SET || die_unknown $opt
1102 eval $optname='$optval'
1107 disabled logging && logfile=/dev/null
1109 echo "# $0 $@" > $logfile
1112 cc="${cross_prefix}${cc}"
1113 yasmexe="${cross_prefix}${yasmexe}"
1114 ar="${cross_prefix}${ar}"
1115 nm="${cross_prefix}${nm}"
1116 ranlib="${cross_prefix}${ranlib}"
1117 strip="${cross_prefix}${strip}"
1119 # set temporary file name
1120 if test ! -z "$TMPDIR" ; then
1122 elif test ! -z "$TEMPDIR" ; then
1123 TMPDIR1="${TEMPDIR}"
1128 TMPC="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.c"
1129 TMPE="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}${EXESUF}"
1130 TMPH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.h"
1131 TMPO="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.o"
1132 TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
1133 TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
1136 check_cflags -std=c99
1139 i386|i486|i586|i686|i86pc|BePC)
1141 enable fast_unaligned
1145 enable fast_unaligned
1146 check_cc <<EOF && enable fast_64bit && arch="x86_64"
1147 int test[sizeof(char*) - 7];
1150 # armv4l is a subset of armv[567]*l
1158 "Power Macintosh"|ppc|powerpc)
1204 enabled_any x86_32 x86_64 && enable x86
1205 enabled sparc64 && enable sparc
1210 prefix_default="$HOME/config"
1211 # helps building libavcodec
1212 add_cflags "-DPIC -fomit-frame-pointer"
1213 # 3 gcc releases known for BeOS, each with ugly bugs
1214 gcc_version="`$cc -v 2>&1 | grep version | cut -d ' ' -f3-`"
1215 case "$gcc_version" in
1216 2.9-beos-991026*|2.9-beos-000224*) echo "R5/GG gcc"
1219 *20010315*) echo "BeBits gcc"
1220 add_cflags "-fno-expensive-optimizations"
1224 # enable BeOS things
1226 # no need for libm, but the inet stuff
1228 # XXX: actually should check for NOT net_server
1229 if echo $BEINCLUDES | grep -q 'headers/be/bone'; then
1230 network_extralibs="-lbind -lsocket"
1232 enable beos_netserver
1233 network_extralibs="-lnet"
1237 SHFLAGS='-shared -Wl,-h,$$(@F)'
1238 network_extralibs="-lsocket -lnsl"
1241 oss_demuxer_extralibs="-lossaudio"
1242 oss_muxer_extralibs="-lossaudio"
1245 disable need_memalign
1246 LIBOBJFLAGS='$(PIC)'
1248 SLIBNAME='$(SLIBPREF)$(FULLNAME)$(SLIBSUF).$(LIBVERSION)'
1249 SLIBNAME_WITH_VERSION='$(SLIBNAME)'
1250 SLIBNAME_WITH_MAJOR='$(SLIBNAME)'
1251 oss_demuxer_extralibs="-lossaudio"
1252 oss_muxer_extralibs="-lossaudio"
1255 disable need_memalign
1258 osextralibs="-lpoll -lgnugetopt"
1262 disable need_memalign
1263 SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
1264 VHOOKSHFLAGS='-dynamiclib -Wl,-single_module -flat_namespace -undefined suppress -Wl,-install_name,$(SHLIBDIR)/vhook/$$(@F)'
1266 FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
1268 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
1269 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
1270 FFSERVERLDFLAGS=-Wl,-bind_at_load
1272 enabled x86_64 && objformat="macho64"
1277 if test $arch = x86_64; then
1278 disable need_memalign
1281 shlibdir_default="$bindir_default"
1282 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
1283 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
1284 if enabled swscale; then
1285 VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
1286 VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
1292 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
1293 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
1294 SLIB_EXTRA_CMD='-lib /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
1295 SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
1296 install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
1297 SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
1298 SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
1303 shlibdir_default="$bindir_default"
1304 VHOOKSHFLAGS='-shared -L$(BUILD_ROOT)/libavformat -L$(BUILD_ROOT)/libavcodec -L$(BUILD_ROOT)/libavutil'
1305 VHOOKLIBS='-lavformat$(BUILDSUF) -lavcodec$(BUILDSUF) -lavutil$(BUILDSUF) $(EXTRALIBS)'
1306 if enabled swscale; then
1307 VHOOKSHFLAGS="$VHOOKSHFLAGS -L\$(BUILD_ROOT)/libswscale"
1308 VHOOKLIBS="$VHOOKLIBS -lswscale\$(BUILDSUF)"
1313 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
1314 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
1315 SHFLAGS='-shared -Wl,--enable-auto-image-base'
1318 *-dos|freedos|opendos)
1319 disable ffplay ffserver vhook
1320 disable $INDEV_LIST $OUTDEV_LIST
1321 network_extralibs="-lsocket"
1330 ranlib="echo ignoring ranlib"
1336 FFLDFLAGS="-Zomf -Zbin-files -Zargs-wild -Zmap"
1337 SHFLAGS='$(SUBDIR)$(NAME).def -Zdll -Zomf'
1342 SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
1343 SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
1344 SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
1345 echo PROTMODE >> $(SUBDIR)$(NAME).def; \
1346 echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
1347 echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
1348 echo EXPORTS >> $(SUBDIR)$(NAME).def; \
1349 emxexp -o $(OBJS) >> $(SUBDIR)$(NAME).def'
1350 SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
1351 emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
1352 SLIB_INSTALL_EXTRA_CMD='install -m 644 $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib "$(LIBDIR)"'
1353 SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.a "$(LIBDIR)"/$(LIBPREF)$(NAME)_dll.lib'
1361 target_os="${target_os}-UNKNOWN"
1365 set_default $PATHS_LIST
1367 add_extralibs $osextralibs
1369 # Combine FFLDFLAGS and the LDFLAGS environment variable.
1370 LDFLAGS="$FFLDFLAGS $LDFLAGS"
1372 test -n "$cross_prefix" && enable cross_compile
1374 # we need to build at least one lib type
1375 if ! enabled_any static shared; then
1377 At least one library type must be built.
1378 Specify --enable-static to build the static libraries or --enable-shared to
1379 build the shared libraries as well. To only build the shared libraries specify
1380 --disable-static in addition to --enable-shared.
1385 disabled static && LIBNAME=""
1387 if enabled_any libfaad libfaadbin ; then
1388 if check_header faad.h; then
1391 #ifndef FAAD2_VERSION
1394 int main(void) { return 0; }
1396 test $? = 0 && enable libfaad2
1398 die "FAAD test failed."
1403 if ! enabled gpl; then
1407 enabled_any $@ && die "$name is under GPL and --enable-gpl is not specified."
1409 die_gpl_disabled "The Postprocessing code" postproc
1410 die_gpl_disabled "liba52" liba52
1411 die_gpl_disabled "libx264" libx264
1412 die_gpl_disabled "libxvidcore" libxvid
1413 die_gpl_disabled "FAAD2" libfaad2
1414 die_gpl_disabled "The X11 grabber" x11grab
1415 die_gpl_disabled "The software scaler" swscale
1418 if ! enabled nonfree && enabled_any libamr_nb libamr_wb; then
1419 die "libamr is nonfree and --enable-nonfree is not specified."
1422 check_deps $ARCH_EXT_LIST
1424 test -z "$need_memalign" && need_memalign="$mmx"
1427 if test $target_os = darwin; then
1428 if $cc -v 2>&1 | grep -q xlc; then
1429 add_cflags "-qpdf2 -qlanglvl=extc99 -qmaxmem=-1 -qarch=auto -qtune=auto"
1432 check_cflags "-force_cpusubtype_ALL"
1433 check_cflags "-Wno-sign-compare"
1434 enabled shared || check_cflags -mdynamic-no-pic
1438 disabled optimizations || check_cflags -fomit-frame-pointer
1440 # Add processor-specific flags
1441 if test $cpu != "generic"; then
1443 $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
1446 601|ppc601|PowerPC601)
1447 add_cflags "-mcpu=601"
1448 warn_altivec enabled PPC601
1450 603*|ppc603*|PowerPC603*)
1451 add_cflags "-mcpu=603"
1452 warn_altivec enabled PPC603
1454 604*|ppc604*|PowerPC604*)
1455 add_cflags "-mcpu=604"
1456 warn_altivec enabled PPC604
1458 G3|g3|75*|ppc75*|PowerPC75*)
1459 add_cflags "-mcpu=750 -mpowerpc-gfxopt"
1460 warn_altivec enabled PPC75x
1462 G4|g4|745*|ppc745*|PowerPC745*)
1463 add_cflags "-mcpu=7450 -mpowerpc-gfxopt"
1464 warn_altivec disabled PPC745x
1466 74*|ppc74*|PowerPC74*)
1467 add_cflags "-mcpu=7400 -mpowerpc-gfxopt"
1468 warn_altivec disabled PPC74xx
1470 G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
1471 add_cflags "-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
1472 warn_altivec disabled PPC970
1476 add_cflags "-mcpu=cell"
1477 warn_altivec disabled Cell
1480 # targets that do NOT support conditional mov (cmov)
1481 i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
1482 add_cflags "-march=$cpu"
1485 # targets that do support conditional mov (cmov)
1486 i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
1487 add_cflags "-march=$cpu"
1491 # targets that do support conditional mov but on which it's slow
1492 pentium4|pentium4m|prescott|nocona)
1493 add_cflags "-march=$cpu"
1498 add_cflags "-mcpu=v9"
1501 add_cflags "-mcpu=$cpu"
1504 echo "WARNING: Unknown CPU \"$cpu\", ignored."
1509 # make sure we can execute files in $TMPDIR
1510 cat > $TMPSH 2>> $logfile <<EOF
1513 chmod +x $TMPSH >> $logfile 2>&1
1514 if ! $TMPSH >> $logfile 2>&1; then
1516 Unable to create and execute files in $TMPDIR1. Set the TMPDIR environment
1517 variable to another directory and make sure that $TMPDIR1 is not mounted
1520 die "Sanity test failed."
1524 # compiler sanity check
1526 int main(void){ return 0; }
1528 if test "$?" != 0; then
1529 echo "$cc is unable to create an executable file."
1530 if test -z "$cross_prefix" && ! enabled cross_compile ; then
1531 echo "If $cc is a cross-compiler, use the --enable-cross-compile option."
1532 echo "Only do this if you know what cross compiling means."
1534 die "C compiler test failed."
1537 check_cc <<EOF || die "Symbol mangling check failed."
1540 sym=$($nm -P -g $TMPO | grep ff_extern)
1541 extern_prefix=${sym%%ff_extern*}
1543 check_asm inline_asm '""'
1545 if enabled x86; then
1546 # check whether EBP is available on x86
1547 # As 'i' is stored on the stack, this program will crash
1548 # if the base pointer is used to access it because the
1549 # base pointer is cleared in the inline assembly code.
1550 check_exec_crash <<EOF && enable ebp_available
1558 # check wether EBX is available on x86
1559 check_asm ebx_available '"":::"%ebx"'
1561 # check whether binutils is new enough to compile SSSE3/MMX2
1562 enabled ssse3 && check_asm ssse3 '"pabsw %xmm0, %xmm0"'
1563 enabled mmx2 && check_asm mmx2 '"movss %xmm0, %xmm0"'
1565 check_asm bswap '"bswap %%eax" ::: "%eax"'
1567 YASMFLAGS="-f $objformat -DARCH_$(toupper $arch)"
1568 enabled x86_64 && append YASMFLAGS "-m amd64"
1569 enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
1570 case "$objformat" in
1571 elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
1572 macho64) append YASMFLAGS "-DPIC -DPREFIX" ;;
1573 *) append YASMFLAGS "-DPREFIX" ;;
1575 check_yasm "pabsw xmm0, xmm0" && enable yasm
1578 # check for assembler specific support
1580 if test $arch = "powerpc"; then
1581 check_cc <<EOF && enable dcbzl
1583 register long zero = 0;
1585 asm volatile("dcbzl %0, %1" : : "b" (data), "r" (zero));
1591 # check for SIMD availability
1593 # AltiVec flags: The FSF version of GCC differs from the Apple version
1594 if enabled altivec; then
1595 check_cflags -maltivec -mabi=altivec &&
1596 { check_header altivec.h && inc_altivec_h="#include <altivec.h>" ; } ||
1597 check_cflags -faltivec
1599 # check if our compiler supports Motorola AltiVec C API
1600 check_cc <<EOF || disable altivec
1603 vector signed int v1, v2, v3;
1604 v1 = vec_add(v2,v3);
1609 # check if our compiler supports braces for vector declarations
1610 check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
1612 int main (void) { (vector int) {1}; return 0; }
1616 # We have to check if pld is a nop and disable it.
1617 enabled armv4l && check_asm pld '"pld [r0]"'
1618 enabled armv5te && check_asm armv5te '"qadd r0, r0, r0"'
1619 enabled armv6 && check_asm armv6 '"sadd16 r0, r0, r0"'
1620 enabled armvfp && check_asm armvfp '"fadds s0, s0, s0"'
1621 enabled iwmmxt && check_asm iwmmxt '"wunpckelub wr6, wr4"'
1622 enabled mmi && check_asm mmi '"lq $2, 0($2)"'
1623 enabled neon && check_asm neon '"vadd.i16 q0, q0, q0"'
1624 enabled vis && check_asm vis '"pdist %f0, %f0, %f0"' -mcpu=ultrasparc
1626 enabled vis && add_cflags "-mcpu=ultrasparc -mtune=ultrasparc"
1629 # big/little-endian test
1630 check_cc <<EOF || die "endian test failed"
1631 unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
1633 od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
1636 # check availability of some header files
1638 if check_func dlopen; then
1640 elif check_func dlopen -ldl; then
1645 check_func gethrtime
1646 check_func getrusage
1647 check_func inet_aton $network_extralibs
1650 check_func_headers windows.h GetProcessTimes
1652 check_header byteswap.h
1653 check_header conio.h
1654 check_header dlfcn.h
1655 check_header malloc.h
1657 check_header sys/mman.h
1658 check_header sys/resource.h
1659 check_header sys/select.h
1660 check_header termios.h
1662 if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
1663 die "Error, no memalign() but SSE enabled, disable it or use --enable-memalign-hack."
1666 enabled zlib && check_lib zlib.h zlibVersion -lz || disable zlib
1667 enabled bzlib && check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
1669 # check for some common methods of building with pthread support
1670 # do this before the optional library checks as some of them require pthreads
1671 if enabled pthreads; then
1672 if check_func pthread_create; then
1674 elif check_func pthread_create -pthread; then
1676 add_extralibs -pthread
1677 elif check_func pthread_create -pthreads; then
1678 add_cflags -pthreads
1679 add_extralibs -pthreads
1680 elif check_func pthread_create -lpthreadGC2; then
1681 add_extralibs -lpthreadGC2
1682 elif ! check_lib pthread.h pthread_create -lpthread; then
1683 die "ERROR: can't find pthreads library"
1687 for thread in $THREADS_LIST; do
1688 if enabled $thread; then
1689 test -n "$thread_type" &&
1690 die "ERROR: Only one thread type must be selected." ||
1691 thread_type="$thread"
1695 check_lib math.h sin -lm
1697 # test for C99 functions in math.h
1698 for func in llrint lrint lrintf round roundf; do
1699 check_exec <<EOF && enable $func || disable $func
1701 int main(void) { return ($func(3.999f) > 0)?0:1; }
1705 # these are off by default, so fail if requested and not available
1706 enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
1707 enabled liba52 && require liba52 a52dec/a52.h a52_init -la52
1708 enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
1709 enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
1710 enabled libdirac && add_cflags "$(pkg-config --cflags dirac)" \
1711 && require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder \
1712 && require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
1713 enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
1714 enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
1715 enabled libgsm && require libgsm gsm.h gsm_create -lgsm
1716 enabled libmp3lame && require LAME lame/lame.h lame_init -lmp3lame -lm
1717 enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
1718 enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) \
1719 && require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
1720 enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
1721 enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
1722 enabled libx264 && require x264 x264.h x264_encoder_open -lx264 -lm
1723 enabled libxvid && require Xvid xvid.h xvid_global -lxvidcore
1724 enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
1727 if enabled libdc1394; then
1728 { check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
1729 enable libdc1394_2; } ||
1730 { check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
1731 enable libdc1394_1; } ||
1732 die "ERROR: No version of libdc1394 found "
1737 for restrict_keyword in restrict __restrict__ __restrict; do
1738 check_cc <<EOF && _restrict=$restrict_keyword && break
1739 void foo(char * $restrict_keyword p);
1743 test "$vhook" = "default" && vhook="$dlopen"
1745 if test "$target_os" = cygwin -o "$target_os" = mingw32 && enabled_all static vhook ; then
1748 echo "At the moment vhooks don't work on Cygwin or MinGW static builds."
1749 echo "Patches welcome."
1753 if enabled vhook; then
1754 check_ldflags -rdynamic
1755 check_ldflags -export-dynamic
1758 check_foo_config imlib2 imlib2 Imlib2.h imlib_load_font
1759 check_foo_config freetype2 freetype ft2build.h FT_Init_FreeType
1761 ##########################################
1766 SDL_CONFIG="${cross_prefix}sdl-config"
1767 if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
1768 sdl_cflags=`"${SDL_CONFIG}" --cflags`
1769 temp_cflags $sdl_cflags
1770 temp_extralibs `"${SDL_CONFIG}" --libs`
1771 if check_lib2 SDL.h SDL_Init; then
1772 _sdlversion=`"${SDL_CONFIG}" --version | sed 's/[^0-9]//g'`
1773 if test "$_sdlversion" -lt 121 ; then
1777 check_cc $sdl_cflags <<EOF && enable sdl_video_size
1779 int main(int argc, char **argv){
1780 const SDL_VideoInfo *vi = SDL_GetVideoInfo();
1781 int w = vi->current_w;
1790 texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
1792 ##########################################
1795 if enabled network; then
1796 check_type sys/socket.h socklen_t
1797 # Prefer arpa/inet.h over winsock2
1798 if check_header arpa/inet.h ; then
1799 check_func closesocket
1800 elif check_header winsock2.h ; then
1801 network_extralibs="-lws2_32"
1802 check_type ws2tcpip.h socklen_t
1803 check_func_headers winsock2.h closesocket
1807 ##########################################
1810 enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
1811 #include <sys/types.h>
1812 #include <sys/socket.h>
1813 #include <netinet/in.h>
1816 struct sockaddr_storage saddr;
1817 struct ipv6_mreq mreq6;
1818 getaddrinfo(0,0,0,0);
1819 getnameinfo(0,0,0,0,0,0,0);
1820 IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
1824 check_header linux/videodev.h
1825 check_header linux/videodev2.h
1826 check_header sys/videoio.h
1828 check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
1830 # check for ioctl_meteor.h, ioctl_bt848.h and alternatives
1831 { check_header dev/bktr/ioctl_meteor.h &&
1832 check_header dev/bktr/ioctl_bt848.h; } ||
1833 { check_header machine/ioctl_meteor.h &&
1834 check_header machine/ioctl_bt848.h; } ||
1835 { check_header dev/video/meteor/ioctl_meteor.h &&
1836 check_header dev/video/bktr/ioctl_bt848.h; } ||
1837 check_header dev/ic/bt8xx.h
1839 check_header sys/soundcard.h
1840 check_header soundcard.h
1842 # deal with the X11 frame grabber
1844 check_header X11/Xlib.h &&
1845 check_header X11/extensions/XShm.h &&
1846 check_func XOpenDisplay -lX11 &&
1847 check_func XShmCreateImage -lX11 -lXext
1849 enabled debug && add_cflags -g"$debuglevel"
1851 # add some useful compiler flags if supported
1852 check_cflags -Wdeclaration-after-statement
1854 check_cflags -Wno-switch
1855 check_cflags -Wdisabled-optimization
1856 check_cflags -Wpointer-arith
1857 check_cflags -Wredundant-decls
1858 check_cflags -Wno-pointer-sign
1859 check_cflags -Wcast-qual
1860 check_cflags -Wwrite-strings
1861 check_cflags -Wtype-limits
1862 enabled extra_warnings && check_cflags -Winline
1864 # add some linker flags
1865 check_ldflags -Wl,--warn-common
1866 check_ldflags -Wl,--as-needed
1867 check_ldflags '-Wl,-rpath-link,\$(BUILD_ROOT)/libpostproc -Wl,-rpath-link,\$(BUILD_ROOT)/libswscale -Wl,-rpath-link,\$(BUILD_ROOT)/libavfilter -Wl,-rpath-link,\$(BUILD_ROOT)/libavdevice -Wl,-rpath-link,\$(BUILD_ROOT)/libavformat -Wl,-rpath-link,\$(BUILD_ROOT)/libavcodec -Wl,-rpath-link,\$(BUILD_ROOT)/libavutil'
1868 check_ldflags -Wl,-Bsymbolic
1870 if enabled small; then
1871 check_cflags -Os # not all compilers support -Os
1872 optimizations="small"
1873 elif enabled optimizations; then
1874 if $cc -v 2>&1 | grep -q xlc; then
1881 check_cflags -fno-math-errno
1882 check_cflags -fno-signed-zeros
1884 # add some flags for Intel C Compiler
1885 if $cc --version 2> /dev/null | grep -q Intel; then
1886 # Just warnings, no remarks
1888 # -wd: Disable following warnings
1889 # 144, 167, 556: -Wno-pointer-sign
1890 # 10006: ignoring unknown option -fno-signed-zeros
1891 # 10156: ignoring option '-W'; no argument required
1892 check_cflags -wd144,167,556,10006,10156
1893 # 11030: Warning unknown option --as-needed
1894 # 10156: ignoring option '-export'; no argument required
1895 check_ldflags -wd10156,11030
1896 # Allow to compile with optimizations
1897 check_ldflags -march=$cpu
1900 # PIC flags for shared library objects where they are needed
1901 if enabled shared; then
1902 # LIBOBJFLAGS may have already been set in the OS configuration
1903 if test -z "$LIBOBJFLAGS" ; then
1905 x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
1910 if enabled gprof; then
1917 # Find out if the .align argument is a power of two or not.
1918 if test $asmalign_pot = "unknown"; then
1919 disable asmalign_pot
1920 echo 'asm (".align 3");' | check_cc && enable asmalign_pot
1923 enabled_any $DECODER_LIST && enable decoders
1924 enabled_any $ENCODER_LIST && enable encoders
1925 enabled_any $BSF_LIST && enable bsfs
1926 enabled_any $DEMUXER_LIST && enable demuxers
1927 enabled_any $MUXER_LIST && enable muxers
1928 enabled_any $FILTER_LIST && enable filters
1929 enabled_any $INDEV_LIST && enable demuxers
1930 enabled_any $OUTDEV_LIST && enable muxers
1931 enabled_any $PROTOCOL_LIST && enable protocols
1933 enabled_any $THREADS_LIST && enable threads
1935 check_deps $CONFIG_LIST \
1948 enabled libdc1394 && append pkg_requires "libraw1394"
1949 enabled libdirac && append pkg_requires "dirac"
1950 enabled libtheora && append pkg_requires "theora"
1951 enabled libvorbis && append pkg_requires "vorbisenc"
1953 echo "install prefix $prefix"
1954 echo "source path $source_path"
1955 echo "C compiler $cc"
1956 echo ".align is power-of-two $asmalign_pot"
1957 echo "ARCH $arch ($cpu)"
1958 if test "$build_suffix" != ""; then
1959 echo "build suffix $build_suffix"
1961 if test "$extra_version" != ""; then
1962 echo "version string suffix $extra_version"
1964 echo "big-endian ${bigendian-no}"
1965 if test $arch = "x86_32" -o $arch = "x86_64"; then
1966 echo "yasm ${yasm-no}"
1967 echo "MMX enabled ${mmx-no}"
1968 echo "CMOV enabled ${cmov-no}"
1969 echo "CMOV is fast ${fast_cmov-no}"
1970 echo "EBX available ${ebx_available-no}"
1971 echo "EBP available ${ebp_available-no}"
1973 if test $arch = "armv4l"; then
1974 echo "ARMv5TE enabled ${armv5te-no}"
1975 echo "ARMv6 enabled ${armv6-no}"
1976 echo "ARM VFP enabled ${armvfp-no}"
1977 echo "IWMMXT enabled ${iwmmxt-no}"
1978 echo "NEON enabled ${neon-no}"
1980 if test $arch = "mips"; then
1981 echo "MMI enabled ${mmi-no}"
1983 if test $arch = "powerpc"; then
1984 echo "AltiVec enabled ${altivec-no}"
1985 echo "dcbzl available ${dcbzl-no}"
1987 echo "gprof enabled ${gprof-no}"
1988 echo "debug symbols ${debug-no}"
1989 echo "strip symbols ${stripping-no}"
1990 echo "optimizations ${optimizations-no}"
1991 echo "static ${static-no}"
1992 echo "shared ${shared-no}"
1993 echo "postprocessing support ${postproc-no}"
1994 echo "software scaler enabled ${swscale-no}"
1995 echo "new filter support ${avfilter-no}"
1996 echo "filters using lavformat ${avfilter_lavf-no}"
1997 echo "video hooking ${vhook-no}"
1998 if enabled vhook; then
1999 echo "Imlib2 support ${imlib2-no}"
2000 echo "FreeType support ${freetype2-no}"
2002 echo "network support ${network-no}"
2003 if enabled network; then
2004 echo "IPv6 support ${ipv6-no}"
2006 echo "threading support ${thread_type-no}"
2007 echo "SDL support ${sdl-no}"
2008 if enabled sdl_too_old; then
2009 echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
2011 echo "Sun medialib support ${mlib-no}"
2012 echo "AVISynth enabled ${avisynth-no}"
2013 echo "liba52 support ${liba52-no}"
2014 echo "liba52 dlopened ${liba52bin-no}"
2015 echo "libamr-nb support ${libamr_nb-no}"
2016 echo "libamr-wb support ${libamr_wb-no}"
2017 echo "libdc1394 support ${libdc1394-no}"
2018 echo "libdirac enabled ${libdirac-no}"
2019 echo "libfaac enabled ${libfaac-no}"
2020 echo "libfaad enabled ${libfaad-no}"
2021 echo "libfaad dlopened ${libfaadbin-no}"
2022 echo "libgsm enabled ${libgsm-no}"
2023 echo "libmp3lame enabled ${libmp3lame-no}"
2024 echo "libnut enabled ${libnut-no}"
2025 echo "libschroedinger enabled ${libschroedinger-no}"
2026 echo "libtheora enabled ${libtheora-no}"
2027 echo "libvorbis enabled ${libvorbis-no}"
2028 echo "libx264 enabled ${libx264-no}"
2029 echo "libxvid enabled ${libxvid-no}"
2030 echo "zlib enabled ${zlib-no}"
2031 echo "bzlib enabled ${bzlib-no}"
2034 for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
2035 echo "Enabled ${type}s:"
2036 eval list=\$$(toupper $type)_LIST
2037 for part in $list; do
2038 enabled $part && echo ${part%_*}
2039 done | sort | pr -3 -t
2044 if enabled nonfree; then
2045 license="unredistributable"
2046 elif enabled gpl; then
2050 echo "License: $license"
2052 echo "Creating config.mak and config.h..."
2054 echo "# Automatically generated by configure - do not modify!" > config.mak
2055 echo "/* Automatically generated by configure - do not modify! */" > $TMPH
2056 echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
2057 echo "#define FFMPEG_CONFIG_H" >> $TMPH
2058 echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
2060 echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
2061 echo "prefix=$prefix" >> config.mak
2062 echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
2063 echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
2064 echo "INCDIR=\$(DESTDIR)$incdir" >> config.mak
2065 echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
2066 echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
2067 echo "CC=$cc" >> config.mak
2068 echo "YASM=$yasmexe" >> config.mak
2069 echo "AR=$ar" >> config.mak
2070 echo "RANLIB=$ranlib" >> config.mak
2071 echo "LN_S=$ln_s" >> config.mak
2072 enabled stripping &&
2073 echo "STRIP=$strip" >> config.mak ||
2074 echo "STRIP=echo ignoring strip" >> config.mak
2076 echo "OPTFLAGS=$CFLAGS" >> config.mak
2077 echo "VHOOKCFLAGS=$VHOOKCFLAGS" >> config.mak
2078 echo "LDFLAGS=$LDFLAGS" >> config.mak
2079 echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
2080 echo "SHFLAGS=$SHFLAGS" >> config.mak
2081 echo "YASMFLAGS=$YASMFLAGS" >> config.mak
2082 echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
2083 echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
2084 echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
2085 echo "BUILD_STATIC=$static" >> config.mak
2086 echo "BUILDSUF=$build_suffix" >> config.mak
2087 echo "FULLNAME=$FULLNAME" >> config.mak
2088 echo "LIBPREF=$LIBPREF" >> config.mak
2089 echo "LIBSUF=$LIBSUF" >> config.mak
2090 echo "LIBNAME=$LIBNAME" >> config.mak
2091 echo "SLIBPREF=$SLIBPREF" >> config.mak
2092 echo "SLIBSUF=$SLIBSUF" >> config.mak
2093 echo "EXESUF=$EXESUF" >> config.mak
2094 echo "EXTRA_VERSION=$extra_version" >> config.mak
2095 echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
2097 if enabled bigendian; then
2098 echo "WORDS_BIGENDIAN=yes" >> config.mak
2099 echo "#define WORDS_BIGENDIAN 1" >> $TMPH
2102 if enabled sdl; then
2103 echo "SDL_LIBS=`"${SDL_CONFIG}" --libs`" >> config.mak
2104 echo "SDL_CFLAGS=`"${SDL_CONFIG}" --cflags`" >> config.mak
2106 if enabled texi2html; then
2107 echo "BUILD_DOC=yes" >> config.mak
2112 file=$source_path/$2
2113 eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
2114 eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
2115 lcname=$(tolower $name)
2116 eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
2117 eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
2120 get_version LIBSWSCALE libswscale/swscale.h
2121 get_version LIBPOSTPROC libpostproc/postprocess.h
2122 get_version LIBAVCODEC libavcodec/avcodec.h
2123 get_version LIBAVDEVICE libavdevice/avdevice.h
2124 get_version LIBAVFORMAT libavformat/avformat.h
2125 get_version LIBAVUTIL libavutil/avutil.h
2126 get_version LIBAVFILTER libavfilter/avfilter.h
2128 if enabled shared; then
2129 echo "BUILD_SHARED=yes" >> config.mak
2130 echo "PIC=-fPIC -DPIC" >> config.mak
2131 echo "LIBTARGET=${LIBTARGET}" >> config.mak
2132 echo "SLIBNAME=${SLIBNAME}" >> config.mak
2133 echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
2134 echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
2135 echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
2136 echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
2137 echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
2138 echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
2140 echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
2141 echo "EXTRALIBS=$extralibs" >> config.mak
2143 print_config ARCH_ $TMPH config.mak $ARCH_LIST
2144 print_config HAVE_ $TMPH config.mak $HAVE_LIST
2145 print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
2157 echo "#define restrict $_restrict" >> $TMPH
2159 if enabled small; then
2160 echo "#define av_always_inline" >> $TMPH
2163 echo "SRC_PATH=\"$source_path\"" >> config.mak
2164 echo "SRC_PATH_BARE=$source_path" >> config.mak
2165 echo "BUILD_ROOT=\"$PWD\"" >> config.mak
2167 # Apparently it's not possible to portably echo a backslash.
2168 enabled asmalign_pot &&
2169 printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
2170 printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
2172 echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
2174 echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
2176 # Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
2177 cmp -s $TMPH config.h &&
2178 echo "config.h is unchanged" ||
2179 mv -f $TMPH config.h
2181 rm -f $TMPC $TMPE $TMPH $TMPO $TMPS $TMPSH
2183 # build tree in object directory if source path is different from current one
2184 if enabled source_path_used; then
2211 libavcodec/Makefile \
2212 libavdevice/Makefile \
2213 libavfilter/Makefile \
2214 libavformat/Makefile \
2215 libavutil/Makefile \
2216 libpostproc/Makefile \
2217 libswscale/Makefile \
2219 for dir in $DIRS ; do
2222 for f in $FILES ; do
2223 $ln_s "$source_path/$f" $f
2228 # build pkg-config files
2230 pkgconfig_generate(){
2232 shortname=${name#lib}
2237 cat <<EOF > $name/$name.pc
2239 exec_prefix=\${prefix}
2244 Description: $comment
2246 Requires: $(disabled shared && echo $requires)
2247 Requires.private: $(enabled shared && echo $requires)
2249 Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
2250 Libs.private: $(enabled shared && echo $libs)
2251 Cflags: -I\${includedir}
2253 cat <<EOF > $name/$name-uninstalled.pc
2256 libdir=\${pcfiledir}
2257 includedir=${source_path}
2260 Description: $comment
2264 Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
2265 Cflags: -I\${includedir}
2269 pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
2270 pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
2271 pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2272 pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "$pkg_requires libavformat = $LIBAVFORMAT_VERSION"
2274 pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "$pkg_requires libavutil = $LIBAVUTIL_VERSION"
2276 pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
2277 if enabled swscale; then
2278 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"
2280 pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "$pkg_requires libavcodec = $LIBAVCODEC_VERSION"
2281 apply libswscale/libswscale.pc sed s/^Libs:.*$/Libs:/