From 68d81080b3cbf1c53c3a2f2174d813da5629fab7 Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Mon, 23 Jun 2014 18:52:33 +0000 Subject: Check for aligned access requirements explicitly. --- configure | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) (limited to 'configure') diff --git a/configure b/configure index 82eec3b..3c78a5f 100755 --- a/configure +++ b/configure @@ -12456,6 +12456,57 @@ $as_echo "#define sa_family_t uint16_t" >>confdefs.h fi +# check wether misaligned access is possible or not +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if pointers to integers require aligned access" >&5 +$as_echo_n "checking if pointers to integers require aligned access... " >&6; } +if ${ax_cv_have_aligned_access_required+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_have_aligned_access_required=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include + +int main() +{ + char* string = malloc(40); + int i; + for (i=0; i < 40; i++) string[[i]] = i; + { + void* s = string; + int* p = s+1; + int* q = s+2; + + if (*p == *q) { return 1; } + } + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_have_aligned_access_required=yes +else + ax_cv_have_aligned_access_required=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_have_aligned_access_required" >&5 +$as_echo "$ax_cv_have_aligned_access_required" >&6; } +if test "$ax_cv_have_aligned_access_required" = yes ; then + +$as_echo "#define HAVE_ALIGNED_ACCESS_REQUIRED 1" >>confdefs.h + +fi + + ### zlib # # Handle user hints -- cgit v1.2.3