]> granicus.if.org Git - libjpeg-turbo/commitdiff
Fix build on PowerPC SPE systems
authorDRC <information@libjpeg-turbo.org>
Fri, 1 Sep 2017 01:10:08 +0000 (01:10 +0000)
committerDRC <information@libjpeg-turbo.org>
Fri, 1 Sep 2017 01:32:48 +0000 (20:32 -0500)
SPE systems don't support AltiVec instructions.

Fixes #172

acinclude.m4
configure.ac

index 2c907620fee080a78730d1999b70dcc822548a4f..eb440076a02e7993fb4957273a070f0a4d8506d0 100644 (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
+])
index a0ec58847137a505d1ac59b797eabb8c5e493389..494845a48f9a924fe137c7aa7b004ddc32b51ac6 100644 (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