echo " --disable-neon disable neon optimizations"
echo " --disable-vis disable VIS optimizations"
echo " --disable-yasm disable use of yasm assembler"
+ echo " --enable-pic build position-independent code"
echo
echo "Developer options (useful when working on FFmpeg itself):"
echo " --disable-debug disable debugging symbols"
echo "$v"
}
+filter(){
+ pat=$1
+ shift
+ for v; do
+ eval "case $v in $pat) echo $v ;; esac"
+ done
+}
+
set_all(){
value=$1
shift
mpegaudio_hp
network
nonfree
+ pic
postproc
powerpc_perf
rdft
ARCH_LIST='
alpha
arm
+ avr32
+ avr32_ap
+ avr32_uc
bfin
ia64
m68k
# gcc stupidly only outputs the basename of targets with -MM, but we need the
# full relative path for objects in subdirectories for non-recursive Make.
-DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $@'
+DEPEND_CMD='$(DEPCC) $(DEPFLAGS) $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o," > $(@:.o=.d)'
DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
# find source path
--enable-debug=*) debuglevel="$optval"
;;
--enable-*=*|--disable-*=*)
- eval $(echo "$opt" | sed 's/=/-/;s/--/action=/;s/-/ thing=/;s/-/ name=/')
- case "$thing" in
- encoder|decoder|hwaccel|muxer|demuxer|indev|outdev|parser|bsf|protocol|filter) $action ${optval}_${thing} ;;
- *) die_unknown "$opt" ;;
- esac
+ eval $(echo "${opt%%=*}" | sed 's/--/action=/;s/-/ thing=/')
+ is_in "${thing}s" $COMPONENT_LIST || die_unknown "$opt"
+ eval list=\$$(toupper $thing)_LIST
+ name=$(echo "${optval}" | sed "s/,/_${thing}|/g")_${thing}
+ $action $(filter "$name" $list)
;;
--enable-?*|--disable-?*)
eval $(echo "$opt" | sed 's/--/action=/;s/-/ option=/;s/-/_/g')
tmpfile(){
tmp=$(mktemp -u "${TMPDIR}/ffconf.XXXXXXXX")$2 &&
(set -C; exec > $tmp) 2>/dev/null ||
- die "Unable to create temoporary file in $TMPDIR."
+ die "Unable to create temporary file in $TMPDIR."
append TMPFILES $tmp
eval $1=$tmp
}
filter_cppflags=echo
filter_asflags=echo
-if $cc --version 2>/dev/null | grep -qi gcc; then
+if $cc -v 2>&1 | grep -qi ^gcc; then
cc_type=gcc
+ if ! $cc -dumpversion | grep -q '^2\.'; then
+ CC_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
+ AS_DEPFLAGS='-MMD -MF $(@:.o=.d) -MT $@'
+ fi
elif $cc --version 2>/dev/null | grep -q Intel; then
cc_type=icc
+ CC_DEPFLAGS='-MMD'
+ AS_DEPFLAGS='-MMD'
elif $cc -v 2>&1 | grep -q xlc; then
cc_type=xlc
elif $cc -V 2>/dev/null | grep -q Compaq; then
die "Error creating armcc configuration file."
cc="$cc --arm_linux_config_file=$armcc_conf --translate_gcc"
as_default="${cross_prefix}gcc"
+ CC_DEPFLAGS='-MMD'
+ AS_DEPFLAGS='-MMD'
elif $cc -version 2>/dev/null | grep -q TMS470; then
cc_type=tms470
cc="$cc --gcc --abi=eabi -eo=.o -mc -me"
CC_O='-fr=$(@D)'
as_default="${cross_prefix}gcc"
ld_default="${cross_prefix}gcc"
- dep_cc_default="${cross_prefix}gcc"
TMPO=$(basename $TMPC .c).o
append TMPFILES $TMPO
add_cflags -D__gnuc_va_list=va_list -D__USER_LABEL_PREFIX__=
- DEPFLAGS='$(CPPFLAGS) -MM'
+ CC_DEPFLAGS='-ppa -ppd=$(@:.o=.d)'
+ AS_DEPFLAGS='-MMD'
filter_cflags=tms470_flags
tms470_flags(){
for flag; do
: ${ld_default:=$cc}
set_default as dep_cc ld
+test -n "$CC_DEPFLAGS" || CCDEP=$DEPEND_CMD
+test -n "$AS_DEPFLAGS" || ASDEP=$DEPEND_CMD
+
add_cflags $extra_cflags
add_asflags $extra_cflags
esac
fi
+if test "$cpu" = host; then
+ enabled cross_compile && die "--cpu=host makes no sense when cross-compiling."
+
+ case "$cc_type" in
+ gcc)
+ check_native(){
+ $cc $1=native -v -c -o $TMPO $TMPC >$TMPE 2>&1 || return
+ awk "/$1=/{ match(\$0, /$1=(\\w+)/, a);print a[1];exit }" $TMPE
+ }
+ cpu=$(check_native -march || check_native -mcpu)
+ ;;
+ esac
+
+ test "${cpu:-host}" = host && die "--cpu=host not supported with compiler $cc"
+fi
+
# Add processor-specific flags
case $cpu in
601|ppc601|PowerPC601)
mips*|[45]k*|[237]4k*|m4k|r*000|loongson2[ef])
cpuflags="-march=$cpu"
;;
+ ap7[02]0[0-2])
+ subarch="avr32_ap"
+ cpuflags="-mpart=$cpu"
+ ;;
+ ap)
+ subarch="avr32_ap"
+ cpuflags="-march=$cpu"
+ ;;
+ uc3[ab]*)
+ subarch="avr32_uc"
+ cpuflags="-mcpu=$cpu"
+ ;;
+ uc)
+ subarch="avr32_uc"
+ cpuflags="-march=$cpu"
+ ;;
generic)
;;
*)
arch="alpha"
enable fast_64bit
check_cflags -mieee
- pic=$shared
+ spic=$shared
;;
arm|armv[4567]*l)
arch="arm"
ia64)
arch="ia64"
enable fast_64bit
- pic=$shared
+ spic=$shared
;;
m68k)
arch="m68k"
;;
mips|mipsel|IP*)
arch="mips"
- pic=$shared
+ spic=$shared
;;
mips64)
arch="mips"
subarch="mips64"
enable fast_64bit
- pic=$shared
+ spic=$shared
;;
parisc|hppa)
arch="parisc"
- pic=$shared
+ spic=$shared
;;
parisc64|hppa64)
arch="parisc"
enable fast_64bit
- pic=$shared
+ spic=$shared
;;
"Power Macintosh"|ppc|powerpc)
arch="ppc"
;;
sparc)
arch="sparc"
- pic=$shared
+ spic=$shared
;;
sun4u|sparc64)
arch="sparc"
subarch="sparc64"
enable fast_64bit
- pic=$shared
+ spic=$shared
;;
i386|i486|i586|i686|i86pc|BePC)
arch="x86"
enable cmov
enable fast_cmov
enable fast_unaligned
- check_cc <<EOF && enable fast_64bit && subarch="x86_64" && pic=$shared
+ check_cc <<EOF && enable fast_64bit && subarch="x86_64" && spic=$shared
int test[sizeof(char*) - 7];
EOF
;;
esac
enable $arch $subarch
+enabled spic && enable pic
# OS specific
case $target_os in
FFSERVERLDFLAGS=-Wl,-bind_at_load
objformat="macho"
enabled x86_64 && objformat="macho64"
- enabled shared || check_cflags -mdynamic-no-pic
+ enabled shared ||
+ { check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
;;
mingw32*)
if test $target_os = "mingw32ce"; then
disabled optimizations || check_cflags -fomit-frame-pointer
+if enabled pic; then
+ add_cppflags -DPIC
+ add_cflags -fPIC
+ add_asflags -fPIC
+fi
+
check_cc <<EOF || die "Symbol mangling check failed."
int ff_extern;
EOF
# these are off by default, so fail if requested and not available
enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
enabled libdirac && add_cflags $(pkg-config --cflags dirac) &&
- require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init -ldirac_decoder &&
- require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init -ldirac_encoder
+ require libdirac libdirac_decoder/dirac_parser.h dirac_decoder_init $(pkg-config --libs dirac) &&
+ require libdirac libdirac_encoder/dirac_encoder.h dirac_encoder_init $(pkg-config --libs dirac)
enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
enabled libgsm && require libgsm gsm.h gsm_create -lgsm
enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
enabled libtheora && require libtheora theora/theora.h theora_info_init -ltheora -logg
enabled libvorbis && require libvorbis vorbis/vorbisenc.h vorbis_info_init -lvorbisenc -lvorbis -logg
-enabled libx264 && require libx264 x264.h x264_encoder_open -lx264 -lm &&
+enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 -lm &&
{ check_cpp_condition x264.h "X264_BUILD >= 65" ||
die "ERROR: libx264 version must be >= 0.65."; }
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore
check_func XOpenDisplay -lX11 &&
check_func XShmCreateImage -lX11 -lXext
-enabled debug && add_cflags -g"$debuglevel"
+enabled debug && add_cflags -g"$debuglevel" && add_asflags -g"$debuglevel"
# add some useful compiler flags if supported
check_cflags -Wdeclaration-after-statement
check_cflags -fno-tree-vectorize
fi
-enabled pic && LIBOBJFLAGS='$(PIC)'
-
if enabled gprof; then
add_cflags -p
add_ldflags -p
echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
echo "SHFLAGS=$SHFLAGS" >> config.mak
echo "YASMFLAGS=$YASMFLAGS" >> config.mak
-echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
-echo "PIC=-fPIC -DPIC" >> config.mak
echo "BUILDSUF=$build_suffix" >> config.mak
echo "FULLNAME=$FULLNAME" >> config.mak
echo "LIBPREF=$LIBPREF" >> config.mak
echo "SLIBSUF=$SLIBSUF" >> config.mak
echo "EXESUF=$EXESUF" >> config.mak
echo "EXTRA_VERSION=$extra_version" >> config.mak
-echo "DEPEND_CMD=$DEPEND_CMD" >> config.mak
echo "DEPFLAGS=$DEPFLAGS" >> config.mak
+echo "CCDEP=$CCDEP" >> config.mak
+echo "ASDEP=$ASDEP" >> config.mak
+echo "CC_DEPFLAGS=$CC_DEPFLAGS" >> config.mak
+echo "AS_DEPFLAGS=$AS_DEPFLAGS" >> config.mak
echo "HOSTCC=$host_cc" >> config.mak
echo "HOSTCFLAGS=$host_cflags" >> config.mak
echo "HOSTEXESUF=$HOSTEXESUF" >> config.mak
DIRS="\
doc \
libavcodec \
- libavcodec/alpha \
- libavcodec/arm \
- libavcodec/bfin \
- libavcodec/mlib \
- libavcodec/ppc \
- libavcodec/sh4 \
- libavcodec/sparc \
- libavcodec/x86 \
+ libavcodec/$arch \
libavdevice \
libavfilter \
libavformat \
libavutil \
+ libavutil/$arch \
libpostproc \
libswscale \
- libswscale/bfin \
- libswscale/mlib \
- libswscale/ppc \
- libswscale/sparc \
- libswscale/x86 \
+ libswscale/$arch \
tests \
tools \
"
Name: $name
Description: $comment
Version: $version
-Requires: $(disabled shared && echo $requires)
+Requires: $(enabled shared || echo $requires)
Requires.private: $(enabled shared && echo $requires)
Conflicts:
-Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
+Libs: -L\${libdir} -l${shortname} $(enabled shared || echo $libs)
Libs.private: $(enabled shared && echo $libs)
Cflags: -I\${includedir}
EOF