}
add_cppflags(){
- append CPPFLAGS "$@"
+ append CPPFLAGS $($filter_cppflags "$@")
}
add_cflags(){
- append CFLAGS "$@"
+ append CFLAGS $($filter_cflags "$@")
}
add_asflags(){
- append ASFLAGS "$@"
+ append ASFLAGS $($filter_asflags "$@")
}
add_ldflags(){
check_cppflags(){
log check_cppflags "$@"
- check_cc "$@" <<EOF && add_cppflags "$@"
+ set -- $($filter_cppflags "$@")
+ check_cc "$@" <<EOF && append CPPFLAGS "$@"
int x;
EOF
}
check_cflags(){
log check_cflags "$@"
- check_cc "$@" <<EOF && add_cflags "$@"
+ set -- $($filter_cflags "$@")
+ check_cc "$@" <<EOF && append CFLAGS "$@"
int x;
EOF
}
check_ld "$@" <<EOF && enable $func && enable_safe $headers
$incs
int main(int argc, char **argv){
- (void) $func;
- return 0;
+ return (long) $func;
}
EOF
}
alsa_asoundlib_h
altivec_h
arpa_inet_h
+ attribute_packed
bigendian
bswap
closesocket
ssse3_deps="sse"
vis_deps="sparc"
+need_memalign="altivec neon sse"
+
# decoders / encoders / hardware accelerators
aac_decoder_select="fft mdct"
ac3_decoder_select="fft mdct"
# demuxers / muxers
ac3_demuxer_deps="ac3_parser"
+asf_stream_muxer_select="asf_muxer"
avisynth_demuxer_deps="avisynth"
dirac_demuxer_deps="dirac_parser"
+ipod_muxer_select="mov_muxer"
libnut_demuxer_deps="libnut"
libnut_muxer_deps="libnut"
+matroska_audio_muxer_select="matroska_muxer"
matroska_demuxer_suggest="zlib bzlib"
mov_demuxer_suggest="zlib"
mp3_demuxer_deps="mpegaudio_parser"
+mp4_muxer_select="mov_muxer"
+mpegtsraw_demuxer_select="mpegts_demuxer"
+mxf_d10_muxer_select="mxf_muxer"
+psp_muxer_select="mov_muxer"
redir_demuxer_deps="network"
rtp_muxer_deps="network rtp_protocol"
rtsp_demuxer_deps="sdp_demuxer"
sdp_demuxer_deps="rtp_protocol mpegts_demuxer"
+tg2_muxer_select="mov_muxer"
+tgp_muxer_select="mov_muxer"
# indevs / outdevs
alsa_indev_deps="alsa_asoundlib_h snd_pcm_htimestamp"
enable swscale_alpha
# build settings
-add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
SHFLAGS='-shared -Wl,-soname,$$(@F)'
FFSERVERLDFLAGS=-Wl,-E
LIBPREF="lib"
# 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) $(CPPFLAGS) -MM $< | 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,"'
+DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -MM'
# find source path
source_path="$(dirname "$0")"
enable source_path_used
-if test -z "$source_path" -o "$source_path" = "." ; then
+if test -f configure; then
source_path="$(pwd)"
disable source_path_used
else
die "Sanity test failed."
fi
+filter_cflags=echo
+filter_cppflags=echo
+filter_asflags=echo
+
if $cc --version 2>/dev/null | grep -qi gcc; then
cc_type=gcc
elif $cc --version 2>/dev/null | grep -q Intel; then
cc_type=xlc
elif $cc -V 2>/dev/null | grep -q Compaq; then
cc_type=ccc
- DEPEND_CMD='$(CC) $(CPPFLAGS) -M $< | sed -e "/^\#.*/d" -e "s,^[[:space:]]*$(*F)\\.o,$(@D)/$(*F).o,"'
+ DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -M'
debuglevel=3
add_ldflags -Wl,-z,now # calls to libots crash without this
elif $cc --vsn 2>/dev/null | grep -q RVCT; then
esac
fi
+# Add processor-specific flags
+case $cpu in
+ 601|ppc601|PowerPC601)
+ cpuflags="-mcpu=601"
+ ;;
+ 603*|ppc603*|PowerPC603*)
+ cpuflags="-mcpu=603"
+ ;;
+ 604*|ppc604*|PowerPC604*)
+ cpuflags="-mcpu=604"
+ ;;
+ G3|g3|75*|ppc75*|PowerPC75*)
+ cpuflags="-mcpu=750 -mpowerpc-gfxopt"
+ ;;
+ G4|g4|745*|ppc745*|PowerPC745*)
+ cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
+ ;;
+ 74*|ppc74*|PowerPC74*)
+ cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
+ ;;
+ G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
+ cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
+ ;;
+ Cell|CELL|cell)
+ cpuflags="-mcpu=cell"
+ enable ldbrx
+ ;;
+ # targets that do NOT support conditional mov (cmov)
+ i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
+ cpuflags="-march=$cpu"
+ disable cmov
+ ;;
+ # targets that do support conditional mov (cmov)
+ i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
+ cpuflags="-march=$cpu"
+ enable cmov
+ enable fast_cmov
+ ;;
+ # targets that do support conditional mov but on which it's slow
+ pentium4|pentium4m|prescott|nocona)
+ cpuflags="-march=$cpu"
+ enable cmov
+ disable fast_cmov
+ ;;
+ sparc64)
+ cpuflags="-mcpu=v9"
+ ;;
+ arm11*|cortex*)
+ cpuflags="-mcpu=$cpu"
+ enable fast_unaligned
+ ;;
+ armv[67]*)
+ cpuflags="-march=$cpu"
+ enable fast_unaligned
+ ;;
+ armv*)
+ cpuflags="-march=$cpu"
+ ;;
+ arm*)
+ cpuflags="-mcpu=$cpu"
+ ;;
+ ev4|ev45|ev5|ev56|pca56|ev6|ev67)
+ enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
+ ;;
+ bf*)
+ cpuflags="-mcpu=$cpu"
+ ;;
+ mips*|[45]k*|[237]4k*|m4k|r*000|loongson2[ef])
+ cpuflags="-march=$cpu"
+ ;;
+ generic)
+ ;;
+ *)
+ echo "WARNING: Unknown CPU \"$cpu\", ignored."
+ ;;
+esac
+
+add_cflags $cpuflags
+add_asflags $cpuflags
+
# compiler sanity check
check_exec <<EOF
int main(void){ return 0; }
die "C compiler test failed."
fi
+add_cppflags -D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112
check_cflags -std=c99
check_cc -D_FILE_OFFSET_BITS=64 <<EOF && add_cppflags -D_FILE_OFFSET_BITS=64
#include <stdlib.h>
oss_outdev_extralibs="-lossaudio"
;;
openbsd)
- disable need_memalign
+ enable malloc_aligned
LIBOBJFLAGS='$(PIC)'
SHFLAGS='-shared'
oss_indev_extralibs="-lossaudio"
oss_outdev_extralibs="-lossaudio"
;;
freebsd|dragonfly)
- disable need_memalign
+ enable malloc_aligned
;;
bsd/os)
osextralibs="-lpoll -lgnugetopt"
strip="strip -d"
;;
darwin)
- disable need_memalign
+ enable malloc_aligned
SHFLAGS='-dynamiclib -Wl,-single_module -Wl,-install_name,$(SHLIBDIR)/$(SLIBNAME),-current_version,$(LIBVERSION),-compatibility_version,$(LIBMAJOR) -Wl,-read_only_relocs,suppress'
strip="strip -x"
FFLDFLAGS="-Wl,-dynamic,-search_paths_first"
target_os=mingw32
LIBTARGET=i386
if enabled x86_64; then
- disable need_memalign
+ enable malloc_aligned
LIBTARGET=x64
+ elif enabled arm; then
+ LIBTARGET=arm
fi
shlibdir_default="$bindir_default"
disable ffserver
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(FULLNAME)-$(LIBMAJOR)$(SLIBSUF)'
SLIB_EXTRA_CMD='-lib.exe /machine:$(LIBTARGET) /def:$$(@:$(SLIBSUF)=.def) /out:$(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)'
SLIB_INSTALL_EXTRA_CMD='-install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"; \
- install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"'
+ install -m 644 $(SUBDIR)$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib) "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.lib)"; \
+ install -d "$(LIBDIR)"; \
+ install -m 644 $(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) "$(LIBDIR)/lib$(SLIBNAME:$(SLIBSUF)=.dll.a)"'
SLIB_UNINSTALL_EXTRA_CMD='rm -f "$(SHLIBDIR)/$(SLIBNAME:$(SLIBSUF)=.lib)"'
SHFLAGS='-shared -Wl,--output-def,$$(@:$(SLIBSUF)=.def) -Wl,--out-implib,$(SUBDIR)lib$(SLIBNAME:$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc -Wl,--enable-auto-image-base'
objformat="win32"
if ! enabled x86_64; then
check_cpp_condition _mingw.h "(__MINGW32_MAJOR_VERSION > 3) || (__MINGW32_MAJOR_VERSION == 3 && __MINGW32_MINOR_VERSION >= 15)" ||
die "ERROR: MinGW runtime version must be >= 3.15."
- enabled_any avisynth vfwcap_demuxer &&
+ enabled_any avisynth vfwcap_indev &&
{ check_cpp_condition w32api.h "(__W32API_MAJOR_VERSION > 3) || (__W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION >= 13)" ||
- die "ERROR: avisynth and vfwcap_demuxer require w32api version 3.13 or later."; }
+ die "ERROR: avisynth and vfwcap_indev require w32api version 3.13 or later."; }
fi
;;
cygwin*)
check_deps $ARCH_EXT_LIST
-test -z "$need_memalign" && need_memalign="$mmx"
-
#Darwin CC versions
if test $target_os = darwin; then
if enabled xlc; then
disabled optimizations || check_cflags -fomit-frame-pointer
-# Add processor-specific flags
-if test $cpu != "generic"; then
- warn_altivec(){
- $1 altivec && echo "WARNING: Tuning for $2 but AltiVec $1.";
- }
- case $cpu in
- 601|ppc601|PowerPC601)
- cpuflags="-mcpu=601"
- warn_altivec enabled PPC601
- ;;
- 603*|ppc603*|PowerPC603*)
- cpuflags="-mcpu=603"
- warn_altivec enabled PPC603
- ;;
- 604*|ppc604*|PowerPC604*)
- cpuflags="-mcpu=604"
- warn_altivec enabled PPC604
- ;;
- G3|g3|75*|ppc75*|PowerPC75*)
- cpuflags="-mcpu=750 -mpowerpc-gfxopt"
- warn_altivec enabled PPC75x
- ;;
- G4|g4|745*|ppc745*|PowerPC745*)
- cpuflags="-mcpu=7450 -mpowerpc-gfxopt"
- warn_altivec disabled PPC745x
- ;;
- 74*|ppc74*|PowerPC74*)
- cpuflags="-mcpu=7400 -mpowerpc-gfxopt"
- warn_altivec disabled PPC74xx
- ;;
- G5|g5|970|ppc970|PowerPC970|power4*|Power4*)
- cpuflags="-mcpu=970 -mpowerpc-gfxopt -mpowerpc64"
- warn_altivec disabled PPC970
- ;;
- Cell|CELL|cell)
- cpuflags="-mcpu=cell"
- warn_altivec disabled Cell
- enable ldbrx
- ;;
- # targets that do NOT support conditional mov (cmov)
- i[345]86|pentium|pentium-mmx|k6|k6-[23]|winchip-c6|winchip2|c3)
- cpuflags="-march=$cpu"
- disable cmov
- ;;
- # targets that do support conditional mov (cmov)
- i686|pentiumpro|pentium[23]|pentium-m|athlon|athlon-tbird|athlon-4|athlon-[mx]p|athlon64|k8|opteron|athlon-fx|core2)
- cpuflags="-march=$cpu"
- enable cmov
- enable fast_cmov
- ;;
- # targets that do support conditional mov but on which it's slow
- pentium4|pentium4m|prescott|nocona)
- cpuflags="-march=$cpu"
- enable cmov
- disable fast_cmov
- ;;
- sparc64)
- cpuflags="-mcpu=v9"
- ;;
- arm11*|cortex*)
- cpuflags="-mcpu=$cpu"
- enable fast_unaligned
- ;;
- armv[67]*)
- cpuflags="-march=$cpu"
- enable fast_unaligned
- ;;
- armv*)
- cpuflags="-march=$cpu"
- ;;
- arm*)
- cpuflags="-mcpu=$cpu"
- ;;
- ev4|ev45|ev5|ev56|pca56|ev6|ev67)
- enabled ccc && cpuflags="-arch $cpu" || cpuflags="-mcpu=$cpu"
- ;;
- bf*)
- cpuflags="-mcpu=$cpu"
- ;;
- mips*|[45]k*|[237]4k*|m4k|r*000|loongson2[ef])
- cpuflags="-march=$cpu"
- ;;
- *)
- echo "WARNING: Unknown CPU \"$cpu\", ignored."
- ;;
- esac
-fi
-
-add_cflags $cpuflags
-add_asflags $cpuflags
-
check_cc <<EOF || die "Symbol mangling check failed."
int ff_extern;
EOF
enabled vis && add_cflags -mcpu=ultrasparc -mtune=ultrasparc
-# ---
-# big/little-endian test
check_cc <<EOF || die "endian test failed"
unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
EOF
od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && enable bigendian
-# ---
-# check availability of some header files
-
if check_func dlopen; then
ldl=
elif check_func dlopen -ldl; then
check_header vdpau/vdpau_x11.h
check_header X11/extensions/XvMClib.h
-if ! enabled_any memalign memalign_hack posix_memalign && enabled need_memalign ; then
+if ! enabled_any memalign memalign_hack posix_memalign malloc_aligned &&
+ enabled_any $need_memalign ; then
die "Error, no aligned memory allocator but SSE enabled, disable it or use --enable-memalign-hack."
fi
check_lib math.h sin -lm
check_lib va/va.h vaInitialize -lva
-# test for C99 functions in math.h
-for func in llrint log2 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; }
-EOF
-done
+check_func llrint
+check_func log2
+check_func lrint
+check_func lrintf
+check_func round
+check_func roundf
+check_func truncf
# these are off by default, so fail if requested and not available
enabled avisynth && require2 vfw32 "windows.h vfw.h" AVIFileInit -lvfw32
EOF
done
-##########################################
-# SDL check
+check_cc <<EOF && enable attribute_packed
+struct { int x; } __attribute__((packed)) x;
+EOF
disable sdl_too_old
disable sdl
texi2html -version > /dev/null 2>&1 && enable texi2html || disable texi2html
-##########################################
-# 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_func_headers winsock2.h closesocket -lws2 && \
+ network_extralibs="-lws2" || \
+ { check_func_headers winsock2.h closesocket -lws2_32 && \
+ network_extralibs="-lws2_32"; }
check_type ws2tcpip.h socklen_t
- check_func_headers winsock2.h closesocket
else
disable network
fi
fi
-##########################################
-# IPv6 check
-
enabled network && enabled ipv6 && check_ld <<EOF && enable ipv6 || disable ipv6
#include <sys/types.h>
#include <sys/socket.h>
check_header sys/soundcard.h
check_header soundcard.h
-enabled alsa_demuxer || enabled alsa_muxer && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
+enabled alsa_indev || enabled alsa_outdev && check_lib2 alsa/asoundlib.h snd_pcm_htimestamp -lasound
-enabled jack_demuxer && check_lib2 jack/jack.h jack_client_open -ljack
+enabled jack_indev && check_lib2 jack/jack.h jack_client_open -ljack
-# deal with the X11 frame grabber
enabled x11grab &&
check_header X11/Xlib.h &&
check_header X11/extensions/XShm.h &&
check_cflags -fno-math-errno
check_cflags -fno-signed-zeros
-# add some flags for Intel C Compiler
if enabled icc; then
# Just warnings, no remarks
check_cflags -w1
add_cflags -msg_disable nomainieee
add_cflags -msg_disable ptrmismatch1
add_cflags -msg_disable unreachcode
+elif enabled gcc; then
+ check_cflags -fno-tree-vectorize
fi
# PIC flags for shared library objects where they are needed
echo "#define FFMPEG_CONFIGURATION \"$(c_escape $FFMPEG_CONFIGURATION)\"" >> $TMPH
echo "#define FFMPEG_DATADIR \"$(eval c_escape $datadir)\"" >> $TMPH
+echo "ifndef FFMPEG_CONFIG_MAK" >> config.mak
+echo "FFMPEG_CONFIG_MAK=1" >> config.mak
+
echo "FFMPEG_CONFIGURATION=$FFMPEG_CONFIGURATION" >> config.mak
echo "prefix=$prefix" >> config.mak
echo "LIBDIR=\$(DESTDIR)$libdir" >> config.mak
echo "STRIP=$strip" >> config.mak ||
echo "STRIP=echo ignoring strip" >> config.mak
-echo "CPPFLAGS?=$CPPFLAGS" >> config.mak
+echo "CPPFLAGS=$CPPFLAGS" >> config.mak
echo "CFLAGS=$CFLAGS" >> config.mak
echo "ASFLAGS=$ASFLAGS" >> config.mak
echo "CC_O=$CC_O" >> 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 "HOSTCC=$host_cc" >> config.mak
echo "HOSTCFLAGS=$host_cflags" >> config.mak
echo "HOSTEXESUF=$HOSTEXESUF" >> config.mak
echo "#define EXTERN_PREFIX \"${extern_prefix}\"" >> $TMPH
echo "#endif /* FFMPEG_CONFIG_H */" >> $TMPH
+echo "endif # FFMPEG_CONFIG_MAK" >> config.mak
# Do not overwrite an unchanged config.h to avoid superfluous rebuilds.
cmp -s $TMPH config.h &&