]> git.sesse.net Git - x264/blobdiff - configure
SSSE3 version of zigzag_8x8_field
[x264] / configure
index a4af82ad88822c50a56b04caf532c3abf17604f6..0cc246dc444901655e2792eedc87c90682597aee 100755 (executable)
--- a/configure
+++ b/configure
@@ -7,7 +7,7 @@ echo ""
 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"
@@ -51,7 +51,7 @@ libdir='${exec_prefix}/lib'
 includedir='${prefix}/include'
 DEVNULL='/dev/null'
 
-avis_input="auto"
+avs_input="auto"
 mp4_output="auto"
 pthread="auto"
 asm="yes"
@@ -95,11 +95,16 @@ for opt do
         --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"
@@ -180,7 +185,7 @@ case $host_os in
     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*)
@@ -239,6 +244,9 @@ case $host_cpu in
     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
@@ -252,8 +260,10 @@ case $host_cpu in
     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
@@ -264,9 +274,9 @@ case $host_cpu in
     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)
@@ -302,15 +312,15 @@ esac
 
 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
@@ -326,12 +336,17 @@ if [ $asm = yes -a \( $ARCH = X86 -o $ARCH = X86_64 \) ] ; then
 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
 
@@ -340,9 +355,13 @@ 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
 
@@ -396,22 +415,29 @@ if [ "$mp4_output" = "yes" ] ; then
     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
 
@@ -429,6 +455,10 @@ 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
@@ -455,7 +485,6 @@ ARCH=$ARCH
 SYS=$SYS
 CC=$CC
 CFLAGS=$CFLAGS
-ALTIVECFLAGS=$ALTIVECFLAGS
 LDFLAGS=$LDFLAGS
 AR=$AR
 RANLIB=$RANLIB
@@ -511,7 +540,7 @@ EOF
 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"