Fix build on PowerPC SPE systems

SPE systems don't support AltiVec instructions.

Fixes #172
This commit is contained in:
DRC
2017-09-01 01:10:08 +00:00
parent 32120054c2
commit 02fa8f244e
2 changed files with 36 additions and 9 deletions

View File

@@ -252,3 +252,34 @@ AC_DEFUN([AC_CHECK_COMPATIBLE_ARM64_ASSEMBLER_IFELSE],[
$2
fi
])
# AC_CHECK_ALTIVEC
# ----------------
# Test whether AltiVec intrinsics are supported
AC_DEFUN([AC_CHECK_ALTIVEC],[
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -maltivec"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include <altivec.h>
int main(void) {
__vector int vi = { 0, 0, 0, 0 };
return vi[0];
}]])], ac_has_altivec=yes)
CFLAGS="$ac_save_CFLAGS"
if test "x$ac_has_altivec" = "xyes" ; then
$1
else
$2
fi
])
AC_DEFUN([AC_NO_SIMD],[
AC_MSG_RESULT([no ("$1")])
with_simd=no;
if test "x${require_simd}" = "xyes"; then
AC_MSG_ERROR([SIMD support not available for this CPU.])
else
AC_MSG_WARN([SIMD support not available for this CPU. Performance will\
suffer.])
fi
])

View File

@@ -517,17 +517,13 @@ if test "x${with_simd}" != "xno"; then
fi
;;
powerpc*)
AC_MSG_RESULT([yes (powerpc)])
simd_arch=powerpc
AC_CHECK_ALTIVEC(
[AC_MSG_RESULT([yes (powerpc)])
simd_arch=powerpc],
[AC_NO_SIMD(PowerPC SPE)])
;;
*)
AC_MSG_RESULT([no ("$host_cpu")])
with_simd=no;
if test "x${require_simd}" = "xyes"; then
AC_MSG_ERROR([SIMD support not available for this CPU.])
else
AC_MSG_WARN([SIMD support not available for this CPU. Performance will suffer.])
fi
AC_NO_SIMD($host_cpu)
;;
esac