]> git.sesse.net Git - x264/blobdiff - configure
x86: Minor pixel_ssim_end4 improvements
[x264] / configure
index 7d56fd8a28dfcff1f21b6e40f38762a318f93e44..8f54a342d91f006cf332109ccb32a8b1919d064d 100755 (executable)
--- a/configure
+++ b/configure
@@ -114,6 +114,7 @@ cl_ldflags() {
         [ "$arg" = -Werror ] && arg=
         [ "$arg" = -Wshadow ] && arg=
         [ "$arg" = -Wmaybe-uninitialized ] && arg=
+        [[ "$arg" = -Qdiag-error* ]] && arg=
 
         arg=${arg/pthreadGC/pthreadVC}
         [ "$arg" = avifil32.lib ] && arg=vfw32.lib
@@ -145,9 +146,9 @@ cc_check() {
     [ -n "$1" ] && echo "#include <$1>" > conftest.c
     echo "int main (void) { $3 return 0; }" >> conftest.c
     if [ $compiler_style = MS ]; then
-        cc_cmd="$CC conftest.c $(cc_cflags $CFLAGS $2) -link $(cl_ldflags $2 $LDFLAGSCLI $LDFLAGS)"
+        cc_cmd="$CC conftest.c $(cc_cflags $CFLAGS $CHECK_CFLAGS $2) -link $(cl_ldflags $2 $LDFLAGSCLI $LDFLAGS)"
     else
-        cc_cmd="$CC conftest.c $CFLAGS $2 $LDFLAGSCLI $LDFLAGS -o conftest"
+        cc_cmd="$CC conftest.c $CFLAGS $CHECK_CFLAGS $2 $LDFLAGSCLI $LDFLAGS -o conftest"
     fi
     if $cc_cmd >conftest.log 2>&1; then
         res=$?
@@ -197,8 +198,9 @@ cpp_check() {
 
 as_check() {
     log_check "whether $AS supports $1"
-    echo "$1" > conftest.asm
-    if $AS conftest.asm $ASFLAGS $2 -o conftest.o >conftest.log 2>&1; then
+    echo "$1" > conftest$AS_EXT
+    as_cmd="$AS conftest$AS_EXT $ASFLAGS $2 -o conftest.o"
+    if $as_cmd >conftest.log 2>&1; then
         res=$?
         log_ok
     else
@@ -206,12 +208,12 @@ as_check() {
         log_fail
         log_msg "Failed commandline was:"
         log_msg "--------------------------------------------------"
-        log_msg "$AS conftest.asm $ASFLAGS $2 -o conftest.o"
+        log_msg "$as_cmd"
         cat conftest.log >> config.log
         log_msg "--------------------------------------------------"
         log_msg "Failed program was:"
         log_msg "--------------------------------------------------"
-        cat conftest.asm >> config.log
+        cat conftest$AS_EXT >> config.log
         log_msg "--------------------------------------------------"
     fi
     return $res
@@ -298,14 +300,18 @@ LDFLAGS="$LDFLAGS"
 LDFLAGSCLI="$LDFLAGSCLI"
 ASFLAGS="$ASFLAGS -I. -I\$(SRCPATH)"
 RCFLAGS="$RCFLAGS"
+CHECK_CFLAGS=""
 HAVE_GETOPT_LONG=1
 cross_prefix=""
 
 EXE=""
+AS_EXT=".S"
+NL="
+"
 
 # list of all preprocessor HAVE values we can define
 CONFIG_HAVE="MALLOC_H ALTIVEC ALTIVEC_H MMX ARMV6 ARMV6T2 NEON BEOSTHREAD POSIXTHREAD WIN32THREAD THREAD LOG2F SWSCALE \
-             LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM"
+             LAVF FFMS GPAC AVS GPL VECTOREXT INTERLACED CPU_COUNT OPENCL THP LSMASH X86_INLINE_ASM AS_FUNC"
 
 # parse options
 
@@ -456,7 +462,7 @@ host_os="${host#*-}"
 cc_base=`basename "$CC"`
 QPRE="-"
 if [[ $host_os = mingw* || $host_os = cygwin* ]]; then
-    if [[ "$cc_base" = icl || "$cc_base" = icl.* ]]; then
+    if [[ "$cc_base" = icl || "$cc_base" = icl[\ .]* ]]; then
         # Windows Intel Compiler creates dependency generation with absolute Windows paths, Cygwin's make does not support Windows paths.
         [[ $host_os = cygwin* ]] && die "Windows Intel Compiler support requires MSYS"
         compiler=ICL
@@ -466,7 +472,10 @@ if [[ $host_os = mingw* || $host_os = cygwin* ]]; then
         `$CC 2>&1 | grep -q IA-32` && host_cpu=i486
         `$CC 2>&1 | grep -q "Intel(R) 64"` && host_cpu=x86_64
         cpp_check "" "" "_MSC_VER >= 1400" || die "Windows Intel Compiler support requires Visual Studio 2005 or newer"
-    elif [[ "$cc_base" = cl || "$cc_base" = cl.* ]]; then
+        if cc_check '' -Qdiag-error:10006,10157 ; then
+            CHECK_CFLAGS="$CHECK_CFLAGS -Qdiag-error:10006,10157"
+        fi
+    elif [[ "$cc_base" = cl || "$cc_base" = cl[\ .]* ]]; then
         # Standard Microsoft Visual Studio
         # Dependency creation includes absolute windows paths, Cygwin's make does not support Windows paths.
         [[ $host_os = cygwin* ]] && die "Microsoft Visual Studio support requires MSYS"
@@ -478,12 +487,18 @@ if [[ $host_os = mingw* || $host_os = cygwin* ]]; then
         cpp_check '' '' '_MSC_VER > 1800 || (_MSC_VER == 1800 && _MSC_FULL_VER >= 180030324)' || die "Microsoft Visual Studio support requires Visual Studio 2013 Update 2 or newer"
     fi
 else
-    if [[ "$cc_base" = icc || "$cc_base" = icc.* ]]; then
+    if [[ "$cc_base" = icc || "$cc_base" = icc[\ .]* ]]; then
         AR="xiar"
         compiler=ICC
     fi
 fi
 
+if [[ "$cc_base" = clang || "$cc_base" = clang[\ .]* ]]; then
+    if cc_check '' -Werror=unknown-warning-option ; then
+        CHECK_CFLAGS="$CHECK_CFLAGS -Werror=unknown-warning-option"
+    fi
+fi
+
 libm=""
 case $host_os in
     beos*)
@@ -586,6 +601,7 @@ case $host_cpu in
     i*86)
         ARCH="X86"
         AS="yasm"
+        AS_EXT=".asm"
         ASFLAGS="$ASFLAGS -O2 -DARCH_X86_64=0 -I\$(SRCPATH)/common/x86/"
         if [ $compiler = GNU ]; then
             if [[ "$asm" == auto && "$CFLAGS" != *-march* ]]; then
@@ -626,6 +642,7 @@ case $host_cpu in
     x86_64)
         ARCH="X86_64"
         AS="yasm"
+        AS_EXT=".asm"
         ASFLAGS="$ASFLAGS -DARCH_X86_64=1 -I\$(SRCPATH)/common/x86/"
         [ $compiler = GNU ] && CFLAGS="-m64 $CFLAGS" && LDFLAGS="-m64 $LDFLAGS"
         if [ "$SYS" = MACOSX ]; then
@@ -649,6 +666,7 @@ case $host_cpu in
         if [ $asm = auto ] ; then
             define HAVE_ALTIVEC
             AS="${AS-${CC}}"
+            AS_EXT=".c"
             if [ $SYS = MACOSX ] ; then
                 CFLAGS="$CFLAGS -faltivec -fastf -mcpu=G4"
             else
@@ -677,6 +695,15 @@ case $host_cpu in
             AS="${AS-${CC}}"
         fi
         ;;
+    aarch64)
+        ARCH="AARCH64"
+        if [ "$SYS" = MACOSX ] ; then
+            AS="${AS-extras/gas-preprocessor.pl $CC}"
+            ASFLAGS="$ASFLAGS -DPREFIX"
+        else
+            AS="${AS-${CC}}"
+        fi
+        ;;
     s390|s390x)
         ARCH="S390"
         ;;
@@ -760,6 +787,24 @@ if [ $asm = auto -a $ARCH = ARM ] ; then
     fi
 fi
 
+if [ $asm = auto -a $ARCH = AARCH64 ] ; then
+    # set flags so neon is built by default
+    echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu|-arch)' || CFLAGS="$CFLAGS -arch arm64 -mfpu=neon"
+
+    if  cc_check '' '' '__asm__("cmeq v0.8h, v0.8h, #0");' ; then define HAVE_NEON
+        ASFLAGS="$ASFLAGS -c"
+    else
+        echo "no NEON support, try adding -mfpu=neon to CFLAGS"
+        echo "If you really want to run on such a CPU, configure with --disable-asm."
+        exit 1
+    fi
+fi
+
+if [ $asm = auto -a \( $ARCH = ARM -o $ARCH = AARCH64 \) ] ; then
+    # check if the assembler supports '.func' (clang 3.5 does not)
+    as_check ".func test${NL}.endfunc" && define HAVE_AS_FUNC 1
+fi
+
 [ $asm = no ] && AS=""
 [ "x$AS" = x ] && asm="no" || asm="yes"
 
@@ -1306,7 +1351,7 @@ cat conftest.log
 rm conftest.log
 
 [ "$SRCPATH" != "." ] && ln -sf ${SRCPATH}/Makefile ./Makefile
-mkdir -p common/{arm,ppc,x86} encoder extras filters/video input output tools
+mkdir -p common/{aarch64,arm,ppc,x86} encoder extras filters/video input output tools
 
 echo
 echo "You can run 'make' or 'make fprofiled' now."