From cbcff58ed670c8edc0be1004384cbe0fd07d8d26 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Wed, 5 Jul 2017 18:49:21 -0700
Subject: [PATCH 1/2] check for available arm optimizations

Taken From
http://sources.debian.net/src/mpeg2dec/0.5.1-7/debian/patches/65_arm-test-with-compiler.patch/

Upstream-Status: Pending

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 configure.ac | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/configure.ac b/configure.ac
index acdcb1e..2c0a721 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,7 +59,7 @@ elif test x"$GCC" = x"yes"; then
     AC_TRY_CFLAGS([$TRY_CFLAGS $CFLAGS],[OPT_CFLAGS="$TRY_CFLAGS"])
 
     dnl arch-specific flags
-    arm_conditional=false
+    build_arm_opt=false
     case "$host" in
     i?86-* | k?-* | x86_64-* | amd64-*)
 	AC_DEFINE([ARCH_X86],,[x86 architecture])
@@ -102,8 +102,12 @@ elif test x"$GCC" = x"yes"; then
     alpha*)
 	AC_DEFINE([ARCH_ALPHA],,[alpha architecture]);;
     arm*)
-	arm_conditional=:
-	AC_DEFINE([ARCH_ARM],,[ARM architecture]);;
+	AC_LANG(C)
+	AC_COMPILE_IFELSE(
+		[AC_LANG_SOURCE([[
+			void foo(void) { __asm__ volatile("pld [r1]"); }]])],
+		build_arm_opt=true; AC_DEFINE([ARCH_ARM],,[ARM architecture]),
+		build_arm_opt=false);;
     esac
 elif test x"$CC" = x"tendracc"; then
     dnl TenDRA portability checking compiler
@@ -123,7 +127,7 @@ else
     esac
 fi
 
-AM_CONDITIONAL(ARCH_ARM, ${arm_conditional})
+AM_CONDITIONAL(ARCH_ARM, test x$build_arm_opt = xtrue)
 
 dnl Checks for libtool - this must be done after we set cflags
 AC_LIBTOOL_WIN32_DLL
-- 
2.13.2

