echo "available options:"
echo ""
echo " --help print this message"
-echo " --disable-avis-input disables avisynth input (win32 only)"
+echo " --disable-avs-input disables avisynth input (win32 only)"
echo " --disable-mp4-output disables mp4 output (using gpac)"
echo " --disable-pthread disables multithreaded encoding"
echo " --disable-asm disables assembly optimizations on x86 and arm"
includedir='${prefix}/include'
DEVNULL='/dev/null'
-avis_input="auto"
+avs_input="auto"
mp4_output="auto"
pthread="auto"
asm="yes"
--disable-asm)
asm="no"
;;
- --enable-avis-input)
- avis_input="yes"
+ --enable-avs-input=*)
+ avs_input="$optarg"
+ if [ "$avs_input" != "auto" -a "$avs_input" != "vfw" -a "$avs_input" != "avs" ] ; then
+ echo "unrecognized enable-avis-input option '$avs_input'"
+ echo "available options are 'auto', 'avs', or 'vfw'"
+ avs_input="auto"
+ fi
;;
- --disable-avis-input)
- avis_input="no"
+ --disable-avs-input)
+ avs_input="no"
;;
--enable-mp4-output)
mp4_output="yes"
CFLAGS="$CFLAGS -falign-loops=16"
LDFLAGS="$LDFLAGS -lm"
if [ "$pic" = "no" ]; then
- CFLAGS="$CFLAGS -mdynamic-no-pic"
+ cc_check "" -mdynamic-no-pic && CFLAGS="$CFLAGS -mdynamic-no-pic"
fi
;;
freebsd*)
if [[ "$asm" == yes && "$CFLAGS" != *-march* ]]; then
CFLAGS="$CFLAGS -march=i686"
fi
+ if [[ "$asm" == yes && "$CFLAGS" != *-mfpmath* ]]; then
+ CFLAGS="$CFLAGS -mfpmath=sse -msse"
+ fi
if [ "$SYS" = MACOSX ]; then
ASFLAGS="$ASFLAGS -f macho -DPREFIX"
elif [ "$SYS" = MINGW ]; then
AS="yasm"
if [ "$SYS" = MACOSX ];then
ASFLAGS="$ASFLAGS -f macho64 -m amd64 -DPIC -DPREFIX"
- CFLAGS="$CFLAGS -arch x86_64"
- LDFLAGS="$LDFLAGS -arch x86_64"
+ if cc_check '' "-arch x86_64"; then
+ CFLAGS="$CFLAGS -arch x86_64"
+ LDFLAGS="$LDFLAGS -arch x86_64"
+ fi
elif [ "$SYS" = MINGW ]; then
ASFLAGS="$ASFLAGS -f win32 -m amd64 -DPREFIX"
else
ARCH="PPC"
if [ $SYS = MACOSX ]
then
- ALTIVECFLAGS="$ALTIVECFLAGS -faltivec -fastf -mcpu=G4"
+ CFLAGS="$CFLAGS -faltivec -fastf -mcpu=G4"
else
- ALTIVECFLAGS="$ALTIVECFLAGS -maltivec -mabi=altivec -DHAVE_ALTIVEC_H"
+ CFLAGS="$CFLAGS -maltivec -mabi=altivec -DHAVE_ALTIVEC_H"
fi
;;
sparc)
cc_check || die "No working C compiler found."
-if [ $shared = yes -a \( $ARCH = "X86_64" -o $ARCH = "PPC" -o $ARCH = "ALPHA" \) ] ; then
+if [ $shared = yes -a \( $ARCH = "X86_64" -o $ARCH = "PPC" -o $ARCH = "ALPHA" -o $ARCH = "ARM" \) ] ; then
pic="yes"
fi
if [ $asm = yes -a \( $ARCH = X86 -o $ARCH = X86_64 \) ] ; then
- if ! as_check "pinsrd xmm0, [esp], 0" ; then
+ if ! as_check "lzcnt eax, eax" ; then
VER=`($AS --version || echo no assembler) 2>$DEVNULL | head -n 1`
echo "Found $VER"
- echo "Minimum version is yasm-0.6.1"
+ echo "Minimum version is yasm-0.6.2"
echo "If you really want to compile without asm, configure with --disable-asm."
exit 1
fi
fi
if [ $asm = yes -a $ARCH = ARM ] ; then
- if cc_check '' '' 'asm("rev r0, r0");' ; then CFLAGS="$CFLAGS -DHAVE_ARMV6"
+ # set flags so neon is built by default
+ echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu|-mfloat-abi)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp"
+
+ if cc_check '' '' 'asm("rev ip, ip");' ; then CFLAGS="$CFLAGS -DHAVE_ARMV6"
cc_check '' '' 'asm("movt r0, #0");' && CFLAGS="$CFLAGS -DHAVE_ARMV6T2"
cc_check '' '' 'asm("vadd.i16 q0, q0, q0");' && CFLAGS="$CFLAGS -DHAVE_NEON"
ASFLAGS="$ASFLAGS $CFLAGS -c"
else
- asm="no"
+ echo "You specified a pre-ARMv6 or Thumb-1 CPU in your CFLAGS."
+ echo "If you really want to run on such a CPU, configure with --disable-asm."
+ exit 1
fi
fi
CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS"
-echo "unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';" > conftest.c
+echo "int i = 0x42494745; double f = 0x1.0656e6469616ep+102;" > conftest.c
$CC $CFLAGS conftest.c -c -o conftest.o 2>$DEVNULL || die "endian test failed"
-grep -q BIGE conftest.o && CFLAGS="$CFLAGS -DWORDS_BIGENDIAN"
+if grep -q BIGE conftest.o && grep -q FPendian conftest.o ; then
+ CFLAGS="$CFLAGS -DWORDS_BIGENDIAN"
+elif !(grep -q EGIB conftest.o && grep -q naidnePF conftest.o) ; then
+ die "endian test failed"
+fi
# autodetect options that weren't forced nor disabled
LDFLAGS="$LDFLAGS $MP4_LDFLAGS"
fi
-if [ "$avis_input" = "auto" ] ; then
- if [ $SYS = MINGW ]; then
- avis_input="yes"
+if [ "$avs_input" = "auto" -o "$avs_input" = "avs" ] ; then
+ if [ $SYS = MINGW ] && cc_check avisynth_c.h ; then
+ avs_input="avs"
+ echo "#define AVS_INPUT" >> config.h
+ echo "#define HAVE_AVISYNTH_C_H" >> config.h
+ elif [ $SYS = MINGW ] && cc_check extras/avisynth_c.h ; then
+ avs_input="avs"
+ echo "#define AVS_INPUT" >> config.h
else
- avis_input="no";
+ avs_input="auto"
fi
fi
-if [ "$avis_input" = "yes" ] ; then
- if cc_check "stdlib.h" -lvfw32 ; then
- echo "#define AVIS_INPUT" >> config.h
+if [ "$avs_input" = "auto" -o "$avs_input" = "vfw" ] ; then
+ if [ $SYS = MINGW ] && cc_check "stdlib.h" -lvfw32 ; then
+ echo "#define VFW_INPUT" >> config.h
LDFLAGS="$LDFLAGS -lvfw32"
- elif cc_check "stdlib.h" -lavifil32 ; then
- echo "#define AVIS_INPUT" >> config.h
+ avs_input="vfw"
+ elif [ $SYS = MINGW ] && cc_check "stdlib.h" -lavifil32 ; then
+ echo "#define VFW_INPUT" >> config.h
LDFLAGS="$LDFLAGS -lavifil32"
+ avs_input="vfw"
else
- avis_input="no";
+ avs_input="no";
fi
fi
if [ "$debug" = "yes" ]; then
CFLAGS="-O1 -g $CFLAGS"
+elif [ $ARCH = ARM ]; then
+ # arm-gcc-4.2 produces incorrect output with -ffast-math
+ # and it doesn't save any speed anyway on 4.4, so disable it
+ CFLAGS="-O4 -fno-fast-math $CFLAGS"
else
CFLAGS="-O4 -ffast-math $CFLAGS"
fi
SYS=$SYS
CC=$CC
CFLAGS=$CFLAGS
-ALTIVECFLAGS=$ALTIVECFLAGS
LDFLAGS=$LDFLAGS
AR=$AR
RANLIB=$RANLIB
echo "Platform: $ARCH"
echo "System: $SYS"
echo "asm: $asm"
-echo "avis input: $avis_input"
+echo "avs input: $avs_input"
echo "mp4 output: $mp4_output"
echo "pthread: $pthread"
echo "debug: $debug"