Hello,
this patch fixes the detection for the need of alignment:
* handle big- vs little-endian
* fix initialization of buffer
* correctly read the buffer.
I'm well aware the NEED_ALIGN macro isn't used (yet?).
HTH,
Laurent
diff --git a/configure.ac b/configure.ac
index f9094a2..d1a0ea0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -402,9 +402,13 @@ AC_DEFUN([AC_C_ALIGNMENT],
*ptr = 0x1;
// catch unaligned word access (ARM cpus)
- *buf = 1; *(buf +1) = 2; *(buf + 2) = 2; *(buf + 3) = 3; *(buf + 4) = 4;
- int* i = (int*)(buf+1);
- return (84148994 == i) ? 0 : 1;
+ *buf = 1; *(buf +1) = 2; *(buf + 2) = 3; *(buf + 3) = 4; *(buf + 4) = 5;
+ int i = *(int*)(buf+1);
+#ifdef ENDIAN_LITTLE
+ return (0x5040302 == i) ? 0 : 1;
+#else
+ return (0x2030405 == i) ? 0 : 1;
+#endif
])
],[
ac_cv_c_alignment=none