aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2019-06-01 18:46:54 +0300
committerLasse Collin <lasse.collin@tukaani.org>2019-06-01 18:46:54 +0300
commite5f13a66567b1987e0aae42c6fdcd277bb5810ba (patch)
tree5bb062a4be1fb44578c26142d700b61490f15c0f /m4
parenttuklib_integer: Improve unaligned memory access. (diff)
downloadxz-e5f13a66567b1987e0aae42c6fdcd277bb5810ba.tar.xz
tuklib_integer: Autodetect support for unaligned access on ARM.
The result is used as the default for --enable-unaligned-access. The test should work with GCC and Clang.
Diffstat (limited to 'm4')
-rw-r--r--m4/tuklib_integer.m411
1 files changed, 11 insertions, 0 deletions
diff --git a/m4/tuklib_integer.m4 b/m4/tuklib_integer.m4
index 2ab72a2f..c3c59fe3 100644
--- a/m4/tuklib_integer.m4
+++ b/m4/tuklib_integer.m4
@@ -58,6 +58,17 @@ if test "x$enable_unaligned_access" = xauto ; then
i?86|x86_64|powerpc|powerpc64)
enable_unaligned_access=yes
;;
+ arm*|aarch64*)
+ # On 32-bit and 64-bit ARM, GCC and Clang
+ # #define __ARM_FEATURE_UNALIGNED if
+ # unaligned access is supported.
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+#ifndef __ARM_FEATURE_UNALIGNED
+compile error
+#endif
+int main(void) { return 0; }
+])], [enable_unaligned_access=yes], [enable_unaligned_access=no])
+ ;;
*)
enable_unaligned_access=no
;;