aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac13
-rw-r--r--include/compat/machine/endian.h10
2 files changed, 10 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac
index 888ca19..acfe307 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,18 +75,6 @@ AC_ARG_ENABLE([tests],
75 [enable_tests="yes"]) 75 [enable_tests="yes"])
76AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = xyes]) 76AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = xyes])
77 77
78# Add CPU-specific alignment flags
79old_cflags=$CFLAGS
80CFLAGS="$CFLAGS -I$srcdir/include"
81AC_MSG_CHECKING([if BSWAP4 builds without __STRICT_ALIGNMENT])
82AC_TRY_COMPILE([#include "$srcdir/crypto/modes/modes_lcl.h"],
83 [int a = 0; BSWAP4(a);],
84 AC_MSG_RESULT([yes])
85 BSWAP4=yes,
86 AC_MSG_RESULT([no])
87 BSWAP4=no)
88CFLAGS="$old_cflags"
89
90AS_CASE([$host_cpu], 78AS_CASE([$host_cpu],
91 [*sparc*], [CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT"], 79 [*sparc*], [CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT"],
92 [*arm*], [host_cpu=arm], 80 [*arm*], [host_cpu=arm],
@@ -94,7 +82,6 @@ AS_CASE([$host_cpu],
94 [i?86], [HOSTARCH=intel], 82 [i?86], [HOSTARCH=intel],
95 [x86_64], [HOSTARCH=intel] 83 [x86_64], [HOSTARCH=intel]
96) 84)
97AS_IF([test "x$BSWAP4" = "xyes" -a "$host_cpu" = "arm" ],,CPPFLAGS="$CPPFLAGS -D__STRICT_ALIGNMENT")
98AM_CONDITIONAL([HOST_CPU_IS_INTEL], [test "x$HOSTARCH" = "xintel"]) 85AM_CONDITIONAL([HOST_CPU_IS_INTEL], [test "x$HOSTARCH" = "xintel"])
99 86
100AC_MSG_CHECKING([if .gnu.warning accepts long strings]) 87AC_MSG_CHECKING([if .gnu.warning accepts long strings])
diff --git a/include/compat/machine/endian.h b/include/compat/machine/endian.h
index 43dac8f..54267a8 100644
--- a/include/compat/machine/endian.h
+++ b/include/compat/machine/endian.h
@@ -37,4 +37,14 @@
37 37
38#endif 38#endif
39 39
40#ifndef __STRICT_ALIGNMENT
41#define __STRICT_ALIGNMENT
42#if defined(__i386) || defined(__i386__) || \
43 defined(__x86_64) || defined(__x86_64__) || \
44 defined(__aarch64__) || \
45 ((defined(__arm__) || defined(__arm)) && __ARM_ARCH >= 6)
46#undef __STRICT_ALIGNMENT
47#endif
48#endif
49
40#endif 50#endif