From: DRC Date: Fri, 1 Sep 2017 01:10:08 +0000 (+0000) Subject: Fix build on PowerPC SPE systems X-Git-Tag: 1.5.3~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=02fa8f244e549edd3f3acf174b97157590d1b71e;p=libjpeg-turbo Fix build on PowerPC SPE systems SPE systems don't support AltiVec instructions. Fixes #172 --- diff --git a/acinclude.m4 b/acinclude.m4 index 2c90762..eb44007 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -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 + 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 +]) diff --git a/configure.ac b/configure.ac index a0ec588..494845a 100644 --- a/configure.ac +++ b/configure.ac @@ -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