2
0

ax_misaligned_access_fails.m4 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. # AX_MISALIGNED_ACCESS_FAILS(MACHINE, [ACTION-IF-MISALIGNED-FAILS], [ACTION-IF-MISALIGNED-OK])
  2. # -------------------------------------------------------------------------------------
  3. #
  4. # Check if a specified machine type cannot handle misaligned data. That is, multi-byte data
  5. # types which are not properly aligned in memory fail. Many machines are happy to work with
  6. # misaligned data, but slowing down a bit. Other machines just won't tolerate such data.
  7. #
  8. # This is a simple lookup amongst machines known to the current autotools. So far we only deal
  9. # with the ARM and sparc.
  10. # A lookup is used, as many of the devices which cannot handled misaligned access are embedded
  11. # processors, for which the code normally be cross-compiled.
  12. #
  13. AC_DEFUN([AX_MISALIGNED_ACCESS_FAILS],
  14. [AS_VAR_PUSHDEF([ac_MisalignedAccessFails], [ac_cv_misaligned_access_fails_$1])dnl
  15. AC_CACHE_CHECK([if $1 fails on misaligned memory access], ac_MisalignedAccessFails,
  16. [case $1 in
  17. arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] \
  18. | bfin \
  19. | sparc \
  20. | xscale | xscalee[bl] \
  21. | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
  22. | bfin-* \
  23. | sparc-* \
  24. | xscale-* | xscalee[bl]-* )
  25. AS_VAR_SET(ac_MisalignedAccessFails, yes)
  26. ;;
  27. *)
  28. AS_VAR_SET(ac_MisalignedAccessFails, no)
  29. ;;
  30. esac])
  31. AS_IF([test AS_VAR_GET(ac_MisalignedAccessFails) = yes], [$2], [$3])[]dnl
  32. AS_VAR_POPDEF([ac_MisalignedAccessFails])dnl
  33. ])# MISALIGNED_ACCESS_FAILS