Newer
Older
fi
done
# test for C99 functions in math.h
for func in llrint lrint lrintf round roundf truncf; do
check_exec <<EOF && enable $func || disable $func
#include <math.h>
int main(void) { return ($func(3.999f) > 0)?0:1; }
done
# these are off by default, so fail if requested and not available
enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
Diego Biurrun
committed
enabled libamr_nb && require libamrnb amrnb/interf_dec.h Speech_Decode_Frame_init -lamrnb -lm
enabled libamr_wb && require libamrwb amrwb/dec_if.h D_IF_init -lamrwb -lm
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
enabled libfaac && require2 libfaac "stdint.h faac.h" faacEncGetVersion -lfaac
enabled libfaad && require2 libfaad faad.h faacDecOpen -lfaad
Diego Biurrun
committed
enabled libgsm && require libgsm gsm.h gsm_create -lgsm
enabled libmp3lame && require libmp3lame lame/lame.h lame_init -lmp3lame -lm
Diego Biurrun
committed
enabled libnut && require libnut libnut.h nut_demuxer_init -lnut
enabled libopenjpeg && require libopenjpeg openjpeg.h opj_version -lopenjpeg
enabled libschroedinger && add_cflags $(pkg-config --cflags schroedinger-1.0) &&
require libschroedinger schroedinger/schro.h schro_init $(pkg-config --libs schroedinger-1.0)
enabled libspeex && require libspeex speex/speex.h speex_decoder_init -lspeex
Diego Biurrun
committed
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 &&
{ 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
Diego Biurrun
committed
enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib
Alessandro Sappia
committed
# libdc1394 check
if enabled libdc1394; then
{ check_lib dc1394/dc1394.h dc1394_new -ldc1394 -lraw1394 &&
enable libdc1394_2; } ||
{ check_lib libdc1394/dc1394_control.h dc1394_create_handle -ldc1394_control -lraw1394 &&
enable libdc1394_1; } ||
die "ERROR: No version of libdc1394 found "
fi
_restrict=
for restrict_keyword in restrict __restrict__ __restrict; do
check_cc <<EOF && _restrict=$restrict_keyword && break
void foo(char * $restrict_keyword p);
EOF
##########################################
disable sdl_too_old
disable sdl
SDL_CONFIG="${cross_prefix}sdl-config"
if "${SDL_CONFIG}" --version > /dev/null 2>&1; then
sdl_cflags=$("${SDL_CONFIG}" --cflags)
temp_extralibs $("${SDL_CONFIG}" --libs)
if check_lib2 SDL.h SDL_Init; then
_sdlversion=$("${SDL_CONFIG}" --version | sed 's/[^0-9]//g')
if test "$_sdlversion" -lt 121 ; then
#include <SDL.h>
int main(int argc, char **argv){
const SDL_VideoInfo *vi = SDL_GetVideoInfo();
int w = vi->current_w;
return 0;
}
EOF
restore_flags
texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
Nicolas Boos
committed
##########################################
# Network check
if enabled network; then
check_type "sys/types.h 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_func_headers winsock2.h closesocket
##########################################
enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
Diego Biurrun
committed
struct sockaddr_storage saddr;
struct ipv6_mreq mreq6;
getaddrinfo(0,0,0,0);
getnameinfo(0,0,0,0,0,0,0);
IN6_IS_ADDR_MULTICAST((const struct in6_addr *)0);
}
EOF
check_header linux/videodev.h
check_header linux/videodev2.h
check_header sys/videoio.h
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 &&
check_header dev/bktr/ioctl_bt848.h; } ||
{ check_header machine/ioctl_meteor.h &&
check_header machine/ioctl_bt848.h; } ||
{ check_header dev/video/meteor/ioctl_meteor.h &&
check_header dev/video/bktr/ioctl_bt848.h; } ||
check_header dev/ic/bt8xx.h
check_header sys/soundcard.h
check_header soundcard.h
check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
Diego Biurrun
committed
# deal with the X11 frame grabber
check_header X11/Xlib.h &&
check_header X11/extensions/XShm.h &&
check_func XOpenDisplay -lX11 &&
check_func XShmCreateImage -lX11 -lXext
enabled debug && add_cflags -g"$debuglevel"
# add some useful compiler flags if supported
check_cflags -Wdeclaration-after-statement
check_cflags -Wall
check_cflags -Wno-switch
check_cflags -Wdisabled-optimization
check_cflags -Wpointer-arith
check_cflags -Wredundant-decls
check_cflags -Wwrite-strings
check_cflags -Wtype-limits
check_cflags -Wundef
enabled extra_warnings && check_cflags -Winline
# add some linker flags
check_ldflags -Wl,--warn-common
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'
if enabled small; then
check_cflags -Os # not all compilers support -Os
optimizations="small"
elif enabled optimizations; then
if enabled xlc; then
elif enabled ccc; then
add_cflags -fast
else
fi
Michael Niedermayer
committed
check_cflags -fno-signed-zeros
if enabled icc; then
# Just warnings, no remarks
check_cflags -w1
# -wd: Disable following warnings
# 144, 167, 556: -Wno-pointer-sign
# 10006: ignoring unknown option -fno-signed-zeros
# 10156: ignoring option '-W'; no argument required
check_cflags -wd144,167,556,10006,10156
# 11030: Warning unknown option --as-needed
# 10156: ignoring option '-export'; no argument required
check_ldflags -wd10156,11030
# Allow to compile with optimizations
check_ldflags -march=$cpu
# icc 11.0 and 11.1 work with ebp_available, but don't pass the test
enable ebp_available
elif enabled ccc; then
# disable some annoying warnings
add_cflags -msg_disable cvtu32to64
add_cflags -msg_disable embedcomment
add_cflags -msg_disable needconstext
add_cflags -msg_disable nomainieee
add_cflags -msg_disable ptrmismatch1
add_cflags -msg_disable unreachcode
# PIC flags for shared library objects where they are needed
if enabled shared; then
# LIBOBJFLAGS may have already been set in the OS configuration
if test -z "$LIBOBJFLAGS" ; then
case "${subarch-$arch}" in
x86_64|ia64|alpha|sparc*|power*|parisc*|mips*) LIBOBJFLAGS='$(PIC)' ;;
esac
fi
if enabled gprof; then
# Find out if the .align argument is a power of two or not.
check_asm asmalign_pot '".align 3"'
Diego Biurrun
committed
enabled_any $DECODER_LIST && enable decoders
enabled_any $ENCODER_LIST && enable encoders
enabled_any $BSF_LIST && enable bsfs
enabled_any $DEMUXER_LIST && enable demuxers
enabled_any $MUXER_LIST && enable muxers
Vitor Sessak
committed
enabled_any $FILTER_LIST && enable filters
Diego Biurrun
committed
enabled_any $INDEV_LIST && enable demuxers
enabled_any $OUTDEV_LIST && enable muxers
enabled_any $PROTOCOL_LIST && enable protocols
enabled_any $THREADS_LIST && enable threads
check_deps $CONFIG_LIST \
Diego Biurrun
committed
$HAVE_LIST \
$DECODER_LIST \
$ENCODER_LIST \
$PARSER_LIST \
$BSF_LIST \
$DEMUXER_LIST \
$MUXER_LIST \
Vitor Sessak
committed
$FILTER_LIST \
Diego Biurrun
committed
$INDEV_LIST \
$OUTDEV_LIST \
$PROTOCOL_LIST \
echo "install prefix $prefix"
echo "source path $source_path"
echo "C compiler $cc"
if test "$build_suffix" != ""; then
echo "build suffix $build_suffix"
if test "$extra_version" != ""; then
echo "version string suffix $extra_version"
fi
if enabled x86; then
echo "MMX2 enabled ${mmx2-no}"
echo "3DNow! enabled ${amd3dnow-no}"
echo "3DNow! extended enabled ${amd3dnowext-no}"
echo "SSSE3 enabled ${ssse3-no}"
echo "CMOV enabled ${cmov-no}"
echo "CMOV is fast ${fast_cmov-no}"
echo "EBX available ${ebx_available-no}"
echo "EBP available ${ebp_available-no}"
echo "10 operands supported ${ten_operands-no}"
if enabled arm; then
echo "ARMv5TE enabled ${armv5te-no}"
echo "ARMv6 enabled ${armv6-no}"
echo "ARMv6T2 enabled ${armv6t2-no}"
Gildas Bazin
committed
fi
if enabled mips; then
if enabled ppc; then
echo "PPC 4xx optimizations ${ppc4xx-no}"
echo "performance report ${powerpc_perf-no}"
fi
if enabled sparc; then
echo "VIS enabled ${vis-no}"
echo "gprof enabled ${gprof-no}"
echo "debug symbols ${debug-no}"
echo "strip symbols ${stripping-no}"
echo "optimizations ${optimizations-no}"
echo "static ${static-no}"
echo "shared ${shared-no}"
echo "postprocessing support ${postproc-no}"
Vitor Sessak
committed
echo "new filter support ${avfilter-no}"
echo "filters using lavformat ${avfilter_lavf-no}"
if enabled network; then
echo "threading support ${thread_type-no}"
echo "SDL support ${sdl-no}"
if enabled sdl_too_old; then
echo "-> Your SDL version is too old - please upgrade to have FFplay/SDL support."
fi
echo "Sun medialib support ${mlib-no}"
echo "AVISynth enabled ${avisynth-no}"
echo "libamr-nb support ${libamr_nb-no}"
echo "libamr-wb support ${libamr_wb-no}"
echo "libdirac enabled ${libdirac-no}"
echo "libfaac enabled ${libfaac-no}"
echo "libfaad enabled ${libfaad-no}"
echo "libfaad dlopened ${libfaadbin-no}"
echo "libgsm enabled ${libgsm-no}"
echo "libmp3lame enabled ${libmp3lame-no}"
echo "libnut enabled ${libnut-no}"
echo "libopenjpeg enabled ${libopenjpeg-no}"
echo "libschroedinger enabled ${libschroedinger-no}"
echo "libtheora enabled ${libtheora-no}"
echo "libvorbis enabled ${libvorbis-no}"
Diego Biurrun
committed
echo "libx264 enabled ${libx264-no}"
echo "libxvid enabled ${libxvid-no}"
echo "bzlib enabled ${bzlib-no}"
Vitor Sessak
committed
for type in decoder encoder parser demuxer muxer protocol filter bsf indev outdev; do
enabled $part && echo ${part%_*}
done | sort | pr -3 -t
echo
license="LGPL"
if enabled nonfree; then
license="unredistributable"
elif enabled gpl; then
license="GPL"
fi
echo "License: $license"
echo "Creating config.mak and config.h..."
echo "# Automatically generated by configure - do not modify!" > config.mak
echo "/* Automatically generated by configure - do not modify! */" > $TMPH
echo "#ifndef FFMPEG_CONFIG_H" >> $TMPH
echo "#define FFMPEG_CONFIG_H" >> $TMPH
echo "#define FFMPEG_CONFIGURATION \"$FFMPEG_CONFIGURATION\"" >> $TMPH
echo "#define FFMPEG_DATADIR \"$(eval c_escape $datadir)\"" >> $TMPH
Diego Biurrun
committed
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 "INCDIR=\$(DESTDIR)$incdir" >> config.mak
echo "BINDIR=\$(DESTDIR)$bindir" >> config.mak
echo "DATADIR=\$(DESTDIR)$datadir" >> config.mak
echo "MANDIR=\$(DESTDIR)$mandir" >> config.mak
echo "SRC_PATH=\"$source_path\"" >> config.mak
echo "SRC_PATH_BARE=$source_path" >> config.mak
echo "BUILD_ROOT=\"$PWD\"" >> config.mak
echo "CC=$cc" >> config.mak
echo "AS=$as" >> config.mak
echo "AR=$ar" >> config.mak
echo "LN_S=$ln_s" >> config.mak
enabled stripping &&
echo "STRIP=$strip" >> config.mak ||
Michael Niedermayer
committed
Fabrice Bellard
committed
echo "LDFLAGS=$LDFLAGS" >> config.mak
echo "FFSERVERLDFLAGS=$FFSERVERLDFLAGS" >> config.mak
echo "SHFLAGS=$SHFLAGS" >> config.mak
echo "LIBOBJFLAGS=$LIBOBJFLAGS" >> config.mak
echo "BUILD_STATIC=$static" >> config.mak
echo "BUILDSUF=$build_suffix" >> config.mak
echo "FULLNAME=$FULLNAME" >> config.mak
echo "LIBPREF=$LIBPREF" >> config.mak
echo "LIBSUF=$LIBSUF" >> config.mak
echo "LIBNAME=$LIBNAME" >> 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
echo "HOSTCC=$host_cc" >> config.mak
echo "HOSTCFLAGS=$host_cflags" >> config.mak
echo "HOSTEXESUF=$HOSTEXESUF" >> config.mak
echo "HOSTLDFLAGS=$host_ldflags" >> config.mak
echo "HOSTLIBS=$host_libs" >> config.mak
echo "TARGET_EXEC=$target_exec" >> config.mak
echo "TARGET_PATH=$target_path" >> config.mak
if enabled bigendian; then
Diego Biurrun
committed
echo "WORDS_BIGENDIAN=yes" >> config.mak
echo "#define WORDS_BIGENDIAN 1" >> $TMPH
Nick Kurshev
committed
fi
if enabled sdl; then
echo "SDL_LIBS=$("${SDL_CONFIG}" --libs)" >> config.mak
echo "SDL_CFLAGS=$("${SDL_CONFIG}" --cflags)" >> config.mak
if enabled texi2html; then
Diego Biurrun
committed
echo "BUILD_DOC=yes" >> config.mak
Nicolas Boos
committed
fi
get_version(){
name=$1
file=$source_path/$2
eval $(grep "#define ${name}_VERSION_M" "$file" | awk '{ print $2"="$3 }')
eval ${name}_VERSION=\$${name}_VERSION_MAJOR.\$${name}_VERSION_MINOR.\$${name}_VERSION_MICRO
lcname=$(tolower $name)
eval echo "${lcname}_VERSION=\$${name}_VERSION" >> config.mak
eval echo "${lcname}_VERSION_MAJOR=\$${name}_VERSION_MAJOR" >> config.mak
get_version LIBSWSCALE libswscale/swscale.h
get_version LIBPOSTPROC libpostproc/postprocess.h
get_version LIBAVCODEC libavcodec/avcodec.h
get_version LIBAVDEVICE libavdevice/avdevice.h
get_version LIBAVFORMAT libavformat/avformat.h
get_version LIBAVUTIL libavutil/avutil.h
get_version LIBAVFILTER libavfilter/avfilter.h
if enabled shared; then
Diego Biurrun
committed
echo "BUILD_SHARED=yes" >> config.mak
echo "PIC=-fPIC -DPIC" >> config.mak
Diego Biurrun
committed
echo "SLIBNAME=${SLIBNAME}" >> config.mak
echo "SLIBNAME_WITH_VERSION=${SLIBNAME_WITH_VERSION}" >> config.mak
echo "SLIBNAME_WITH_MAJOR=${SLIBNAME_WITH_MAJOR}" >> config.mak
echo "SLIB_CREATE_DEF_CMD=${SLIB_CREATE_DEF_CMD}" >> config.mak
Diego Biurrun
committed
echo "SLIB_EXTRA_CMD=${SLIB_EXTRA_CMD}" >> config.mak
echo "SLIB_INSTALL_EXTRA_CMD=${SLIB_INSTALL_EXTRA_CMD}" >> config.mak
echo "SLIB_UNINSTALL_EXTRA_CMD=${SLIB_UNINSTALL_EXTRA_CMD}" >> config.mak
echo "LIB_INSTALL_EXTRA_CMD=${LIB_INSTALL_EXTRA_CMD}" >> config.mak
echo "EXTRALIBS=$extralibs" >> config.mak
echo "ARCH=$arch" >> config.mak
print_config ARCH_ $TMPH config.mak $ARCH_LIST
print_config HAVE_ $TMPH config.mak $HAVE_LIST
Diego Biurrun
committed
print_config CONFIG_ $TMPH config.mak $CONFIG_LIST \
Diego Biurrun
committed
$DECODER_LIST \
$ENCODER_LIST \
$PARSER_LIST \
$BSF_LIST \
$DEMUXER_LIST \
$MUXER_LIST \
Vitor Sessak
committed
$FILTER_LIST \
Diego Biurrun
committed
$PROTOCOL_LIST \
$INDEV_LIST \
$OUTDEV_LIST \
echo "#define restrict $_restrict" >> $TMPH
if enabled small; then
Diego Biurrun
committed
echo "#define av_always_inline" >> $TMPH
Fabrice Bellard
committed
# Apparently it's not possible to portably echo a backslash.
Diego Biurrun
committed
printf '#define ASMALIGN(ZEROBITS) ".align " #ZEROBITS "\\n\\t"\n' >> $TMPH ||
printf '#define ASMALIGN(ZEROBITS) ".align 1 << " #ZEROBITS "\\n\\t"\n' >> $TMPH
echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
cmp -s $TMPH config.h &&
echo "config.h is unchanged" ||
mv -f $TMPH config.h
# build tree in object directory if source path is different from current one
if enabled source_path_used; then
Diego Biurrun
committed
doc \
libavcodec \
libavcodec/alpha \
Diego Biurrun
committed
libavcodec/bfin \
libavcodec/mlib \
libavcodec/ppc \
libavcodec/sh4 \
libavcodec/sparc \
libavdevice \
Vitor Sessak
committed
libavfilter \
Diego Biurrun
committed
libavformat \
libavutil \
libpostproc \
libswscale \
libswscale/bfin \
libswscale/mlib \
libswscale/ppc \
libswscale/sparc \
libswscale/x86 \
Diego Biurrun
committed
tests \
tools \
"
Diego Biurrun
committed
Makefile \
common.mak \
Diego Biurrun
committed
doc/texi2pod.pl \
libavcodec/Makefile \
libavdevice/Makefile \
Vitor Sessak
committed
libavfilter/Makefile \
Diego Biurrun
committed
libavformat/Makefile \
libavutil/Makefile \
libpostproc/Makefile \
libswscale/Makefile \
"
Diego Biurrun
committed
mkdir -p $dir
done
for f in $FILES ; do
$ln_s "$source_path/$f" $f
Aurelien Jacobs
committed
Aurelien Jacobs
committed
pkgconfig_generate(){
name=$1
shortname=${name#lib}${build_suffix}
comment=$2
version=$3
libs=$4
requires=$5
cat <<EOF > $name/$name.pc
exec_prefix=\${prefix}
Måns Rullgård
committed
includedir=$incdir
Aurelien Jacobs
committed
Name: $name
Description: $comment
Version: $version
Anssi Hannula
committed
Requires: $(disabled shared && echo $requires)
Requires.private: $(enabled shared && echo $requires)
Aurelien Jacobs
committed
Conflicts:
Libs: -L\${libdir} -l${shortname} $(disabled shared && echo $libs)
Libs.private: $(enabled shared && echo $libs)
Aurelien Jacobs
committed
EOF
cat <<EOF > $name/$name-uninstalled.pc
Aurelien Jacobs
committed
prefix=
exec_prefix=
includedir=${source_path}
Aurelien Jacobs
committed
Name: $name
Description: $comment
Version: $version
Requires: $requires
Aurelien Jacobs
committed
Conflicts:
Libs: \${libdir}/${LIBPREF}${shortname}${LIBSUF} $libs
Aurelien Jacobs
committed
Cflags: -I\${includedir}
EOF
Aurelien Jacobs
committed
pkgconfig_generate libavutil "FFmpeg utility library" "$LIBAVUTIL_VERSION"
pkgconfig_generate libavcodec "FFmpeg codec library" "$LIBAVCODEC_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
pkgconfig_generate libavformat "FFmpeg container format library" "$LIBAVFORMAT_VERSION" "$extralibs" "libavcodec = $LIBAVCODEC_VERSION"
pkgconfig_generate libavdevice "FFmpeg device handling library" "$LIBAVDEVICE_VERSION" "$extralibs" "libavformat = $LIBAVFORMAT_VERSION"
pkgconfig_generate libavfilter "FFmpeg video filtering library" "$LIBAVFILTER_VERSION" "$extralibs" "libavutil = $LIBAVUTIL_VERSION"
pkgconfig_generate libpostproc "FFmpeg post processing library" "$LIBPOSTPROC_VERSION"
pkgconfig_generate libswscale "FFmpeg image rescaling library" "$LIBSWSCALE_VERSION" "" "libavutil = $LIBAVUTIL_VERSION"