xref: /OK3568_Linux_fs/buildroot/package/libmpeg2/0003-fix-arm-detection.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1Improve the ARM detection to work on Thumb-only architecture
2
3The ARM-specific assembly code doesn't build on Thumb-only
4architectures such as ARMv7-M, but the configure script assumes that
5if the host tuple is arm*, then it can build and use the ARM optimized
6code.
7
8This patch improves the configure.ac detection logic, by building one
9of the instruction of the optimized assembly code, and using this to
10decide whether or not the optimizations should be enabled.
11
12Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
13
14Index: b/configure.ac
15===================================================================
16--- a/configure.ac
17+++ b/configure.ac
18@@ -101,8 +101,10 @@
19     alpha*)
20 	AC_DEFINE([ARCH_ALPHA],,[alpha architecture]);;
21     arm*)
22-	arm_conditional=:
23-	AC_DEFINE([ARCH_ARM],,[ARM architecture]);;
24+	AC_TRY_LINK([], [asm(".syntax divided\nstmfd sp!,{r4-r11,lr}")],
25+	     [AC_DEFINE([ARCH_ARM],,[ARM architecture])
26+	      use_arm_optimization=yes],
27+	     [use_arm_optimization=no])
28     esac
29 elif test x"$CC" = x"tendracc"; then
30     dnl TenDRA portability checking compiler
31@@ -122,7 +124,7 @@
32     esac
33 fi
34
35-AM_CONDITIONAL(ARCH_ARM, ${arm_conditional})
36+AM_CONDITIONAL(ARCH_ARM, test "${use_arm_optimization}" = "yes")
37
38 dnl Checks for libtool - this must be done after we set cflags
39 AC_LIBTOOL_WIN32_DLL
40