echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
echo " --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]"
echo " --extra-libs=ELIBS add ELIBS [$ELIBS]"
+ echo " --extra-version=STRING version string suffix []"
echo " --build-suffix=SUFFIX suffix for application specific build []"
echo " --arch=ARCH select architecture [$arch]"
echo " --cpu=CPU selects the minimum cpu required (affects"
echo " --disable-zlib disable zlib [default=no]"
echo " --disable-bzlib disable bzlib [default=no]"
echo " --disable-vhook disable video hooking support"
- echo " --disable-debug disable debugging symbols"
echo " --disable-mpegaudio-hp faster (but less accurate)"
echo " MPEG audio decoding [default=no]"
echo " --enable-gray enable full grayscale support (slower color)"
echo " --list-outdevs show all available output devices"
echo
echo "Developer options (useful when working on FFmpeg itself):"
+ echo " --disable-debug disable debugging symbols"
+ echo " --enable-debug=LEVEL set the debug level [$debuglevel]"
echo " --enable-gprof enable profiling with gprof [$gprof]"
echo " --disable-optimizations disable compiler optimizations"
echo " --enable-extra-warnings enable more compiler warnings"
}
enabled(){
- eval test "x\$$1" = "xyes"
+ test "${1#!}" = "$1" && op== || op=!=
+ eval test "x\$${1#!}" $op "xyes"
}
disabled(){
- eval test "x\$$1" = "xno"
+ test "${1#!}" = "$1" && op== || op=!=
+ eval test "x\$${1#!}" $op "xno"
}
enabled_all(){
check_deps(){
for cfg; do
+ cfg="${cfg#!}"
enabled ${cfg}_checking && die "Circular dependency for $cfg."
disabled ${cfg}_checking && continue
enable ${cfg}_checking
EOF
}
+check_yasm(){
+ log check_yasm "$@"
+ echo "$1" > $TMPS
+ log_file $TMPS
+ shift 1
+ check_cmd $yasmexe $YASMFLAGS "$@" -o $TMPO $TMPS
+}
+
check_ld(){
log check_ld "$@"
check_cc || return
EOF
}
-check_func2(){
- log check_func2 "$@"
+check_func_headers(){
+ log check_func_headers "$@"
headers=$1
func=$2
shift 2
func="$2"
shift 2
temp_extralibs "$@"
- check_func2 "$headers" $func && add_extralibs "$@"
+ check_func_headers "$headers" $func && add_extralibs "$@"
err=$?
restore_flags
return $err
"$@" < "$file" > "$file.tmp" && mv "$file.tmp" "$file" || rm "$file.tmp"
}
+# CONFIG_LIST contains configurable options, while HAVE_LIST is for
+# system-dependent things.
+
COMPONENT_LIST="
bsfs
decoders
$ARCH_EXT_LIST
$THREADS_LIST
altivec_h
- altivec_vector_braces
arpa_inet_h
bswap
byteswap_h
sys_resource_h
sys_select_h
sys_soundcard_h
+ sys_videoio_h
termios_h
threads
winsock2_h
+ yasm
"
CMDLINE_SELECT="
cc
cpu
cross_prefix
+ extra_version
logfile
source_path
target_os
ssse3_deps="x86"
vis_deps="sparc"
+# system headers and functions
+byteswap_h_deps="!armv4l"
+
# decoders / encoders
-ac3_decoder_deps="gpl"
+ac3_decoder_deps="gpl !liba52"
dxa_decoder_deps="zlib"
+eac3_decoder_deps="gpl"
flashsv_decoder_deps="zlib"
flashsv_encoder_deps="zlib"
+mlp_decoder_deps="mlp_parser"
mpeg_xvmc_decoder_deps="xvmc"
png_decoder_deps="zlib"
png_encoder_deps="zlib"
libamr_nb_encoder_deps="libamr_nb"
libamr_wb_decoder_deps="libamr_wb"
libamr_wb_encoder_deps="libamr_wb"
-libdirac_decoder_deps="libdirac"
+libdirac_decoder_deps="libdirac !libschroedinger"
libdirac_encoder_deps="libdirac"
libfaac_encoder_deps="libfaac"
libfaad_decoder_deps="libfaad"
rtsp_demuxer_deps="sdp_demuxer"
sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
v4l_demuxer_deps="linux_videodev_h"
-v4l2_demuxer_deps="linux_videodev2_h"
+v4l2_demuxer_deps_any="linux_videodev2_h sys_videoio_h"
vfwcap_demuxer_deps="capCreateCaptureWindow"
vfwcap_demuxer_extralibs="-lvfw32"
x11_grab_device_demuxer_deps="x11grab XShmCreateImage"
# toolchain
cc="gcc"
+yasmexe="yasm"
ar="ar"
nm="nm"
ranlib="ranlib"
strip="strip"
asmalign_pot="unknown"
ln_s="ln -sf"
+objformat="elf"
# machine
arch=`uname -m`
vhook="default"
# build settings
+add_cflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
SHFLAGS='-shared -Wl,-soname,$$(@F)'
VHOOKSHFLAGS='$(SHFLAGS)'
-LDLATEFLAGS='-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'
FFSERVERLDFLAGS=-Wl,-E
LIBPREF="lib"
LIBSUF=".a"
set >> $logfile
cc="${cross_prefix}${cc}"
+yasmexe="${cross_prefix}${yasmexe}"
ar="${cross_prefix}${ar}"
nm="${cross_prefix}${nm}"
ranlib="${cross_prefix}${ranlib}"
TMPS="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.S"
TMPSH="${TMPDIR1}/ffmpeg-conf-${RANDOM}-$$-${RANDOM}.sh"
+check_cflags -fasm
+check_cflags -std=c99
+
case "$arch" in
i386|i486|i586|i686|i86pc|BePC)
arch="x86_32"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME).$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME).$(LIBMAJOR)$(SLIBSUF)'
FFSERVERLDFLAGS=-Wl,-bind_at_load
+ objformat="macho"
+ enabled x86_64 && objformat="macho64"
;;
mingw32*)
target_os=mingw32
install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
+ objformat="win32"
;;
cygwin*)
target_os=cygwin
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
SHFLAGS='-shared -Wl,--enable-auto-image-base'
+ objformat="win32"
;;
*-dos|freedos|opendos)
disable ffplay ffserver vhook
disable $INDEV_LIST $OUTDEV_LIST
network_extralibs="-lsocket"
EXESUF=".exe"
+ objformat="win32"
;;
linux)
- LDLATEFLAGS="-Wl,--as-needed $LDLATEFLAGS"
enable dv1394
;;
irix*)
if enabled_any libfaad libfaadbin ; then
if check_header faad.h; then
- check_cc << EOF
+ check_cc <<EOF
#include <faad.h>
#ifndef FAAD2_VERSION
ok faad1
fi
fi
-disabled optimizations || add_cflags -fomit-frame-pointer
+disabled optimizations || check_cflags -fomit-frame-pointer
# Add processor-specific flags
if test $cpu != "generic"; then
enabled mmx2 && check_asm mmx2 '"movss %xmm0, %xmm0"'
check_asm bswap '"bswap %%eax" ::: "%eax"'
+
+ YASMFLAGS="-f $objformat -DARCH_$(toupper $arch)"
+ enabled x86_64 && append YASMFLAGS "-m amd64"
+ enabled_all x86_64 shared && append YASMFLAGS "-DPIC"
+ case "$objformat" in
+ elf) enabled debug && append YASMFLAGS "-g dwarf2" ;;
+ macho64) append YASMFLAGS "-DPIC -DPREFIX" ;;
+ *) append YASMFLAGS "-DPREFIX" ;;
+ esac
+ check_yasm "pabsw xmm0, xmm0" && enable yasm
fi
# check for assembler specific support
EOF
# check if our compiler supports braces for vector declarations
- check_cc <<EOF && enable altivec_vector_braces
+ check_cc <<EOF || die "You need a compiler that supports {} in AltiVec vector declarations."
$inc_altivec_h
-#define AVV(x...) {x}
-int main (void) { (vector int) AVV(1); return 0; }
+int main (void) { (vector int) {1}; return 0; }
EOF
fi
check_func inet_aton $network_extralibs
check_func memalign
check_func mkstemp
-check_func2 windows.h GetProcessTimes
+check_func_headers windows.h GetProcessTimes
check_header byteswap.h
check_header conio.h
check_header dlfcn.h
check_header malloc.h
+check_header poll.h
check_header sys/mman.h
check_header sys/resource.h
+check_header sys/select.h
check_header termios.h
if ! enabled_any memalign memalign_hack && enabled need_memalign ; then
enabled zlib && check_lib zlib.h zlibVersion -lz || disable zlib
enabled bzlib && check_lib bzlib.h BZ2_bzlibVersion -lbz2 || disable bzlib
-# ffserver uses poll(),
-# if it's not found we can emulate it using select().
-if enabled ffserver; then
- check_header poll.h
- check_header sys/select.h
-fi
-
# check for some common methods of building with pthread support
# do this before the optional library checks as some of them require pthreads
if enabled pthreads; then
# test for C99 functions in math.h
for func in llrint lrint lrintf round roundf; do
check_exec <<EOF && enable $func || disable $func
-#define _ISOC9X_SOURCE 1
#include <math.h>
int main(void) { return ($func(3.999f) > 0)?0:1; }
EOF
enabled libxvid && require Xvid xvid.h xvid_global -lxvidcore
enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
-# disable the native AC-3 decoder if liba52 is enabled
-enabled liba52 && disable ac3_decoder
-
-# disable the slower libdirac decoder if libschroedinger is enabled
-enabled libschroedinger && enabled libdirac && disable libdirac_decoder
-
# libdc1394 check
if enabled libdc1394; then
{ check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
-check_type sys/socket.h socklen_t
-
##########################################
# Network check
if enabled network; then
+ check_type sys/socket.h socklen_t
# Prefer arpa/inet.h over winsock2
if check_header arpa/inet.h ; then
check_func closesocket
elif check_header winsock2.h ; then
network_extralibs="-lws2_32"
check_type ws2tcpip.h socklen_t
- check_func2 winsock2.h closesocket
+ check_func_headers winsock2.h closesocket
fi
fi
check_header linux/videodev.h
check_header linux/videodev2.h
+check_header sys/videoio.h
-check_func2 "windows.h vfw.h" capCreateCaptureWindow -lvfw32
+check_func_headers "windows.h vfw.h" capCreateCaptureWindow -lvfw32
# check for ioctl_meteor.h, ioctl_bt848.h and alternatives
{ check_header dev/bktr/ioctl_meteor.h &&
# add some linker flags
check_ldflags -Wl,--warn-common
-check_ldflags $LDLATEFLAGS
+check_ldflags -Wl,--as-needed
+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'
check_ldflags -Wl,-Bsymbolic
if enabled small; then
# LIBOBJFLAGS may have already been set in the OS configuration
if test -z "$LIBOBJFLAGS" ; then
case "$arch" in
- x86_64|ia64|alpha|sparc*|power*) LIBOBJFLAGS='$(PIC)' ;;
+ x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
esac
fi
fi
if test "$build_suffix" != ""; then
echo "build suffix $build_suffix"
fi
+if test "$extra_version" != ""; then
+ echo "version string suffix $extra_version"
+fi
echo "big-endian ${bigendian-no}"
if test $arch = "x86_32" -o $arch = "x86_64"; then
+ echo "yasm ${yasm-no}"
echo "MMX enabled ${mmx-no}"
echo "CMOV enabled ${cmov-no}"
echo "CMOV is fast ${fast_cmov-no}"
echo "#define FFMPEG_CONFIG_H" >> $TMPH
echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
+echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
echo "prefix=$prefix" >> config.mak
echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
echo "SHLIBDIR=\$(DESTDIR)$shlibdir" >> config.mak
echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
echo "CC=$cc" >> config.mak
+echo "YASM=$yasmexe" >> config.mak
echo "AR=$ar" >> config.mak
echo "RANLIB=$ranlib" >> config.mak
echo "LN_S=$ln_s" >> config.mak
echo "LDFLAGS=$LDFLAGS" >> config.mak
echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
echo "SHFLAGS=$SHFLAGS" >> config.mak
+echo "YASMFLAGS=$YASMFLAGS" >> config.mak
echo "VHOOKSHFLAGS=$VHOOKSHFLAGS" >> config.mak
echo "VHOOKLIBS=$VHOOKLIBS" >> config.mak
echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
echo "SLIBPREF=$SLIBPREF" >> 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
if enabled bigendian; then
# Apparently it's not possible to portably echo a backslash.
enabled asmalign_pot &&
printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
- printf '#define ASMALIGN(ZEROBITS) ".align 1<<" #ZEROBITS "\\n\\t"\n' >> $TMPH
+ printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
cat <<EOF > $name/$name-uninstalled.pc
prefix=
exec_prefix=
-libdir=\${pcfiledir}/$name
-includedir=\${pcfiledir}
+libdir=\${pcfiledir}
+includedir=${source_path}
Name: $name
Description: $comment