You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

33 lines
1.3 KiB

  1. # align.m4
  2. dnl Copyright (C) 2008 Christian Grothoff
  3. dnl This file is free software, distributed under the terms of the GNU
  4. dnl General Public License. As a special exception to the GNU General
  5. dnl Public License, this file may be distributed as part of a program
  6. dnl that contains a configuration script generated by Autoconf, under
  7. dnl the same distribution terms as the rest of that program.
  8. # Define HAVE_UNALIGNED_64_ACCESS if reading a 64-bit value at a 32-bit aligned offset works
  9. # Note that the program intentionally causes a SIGBUS (so you may
  10. # see some message along those lines on the console).
  11. AC_DEFUN([AC_UNALIGNED_64_ACCESS],
  12. [AC_CACHE_CHECK([whether unaligned 64-bit access works],
  13. ac_cv_unaligned_64_access,
  14. [
  15. AC_RUN_IFELSE([AC_LANG_PROGRAM([[struct S { int a,b,c;};]],
  16. [[struct S s = {0,0,0}; long long * p = (long long *) &s.b;
  17. void *bp = malloc (50);
  18. long long x = *p;
  19. long long *be = (long long*) &bp[1];
  20. long long y = *be;
  21. return (int) x*y;]])],
  22. ac_cv_unaligned_64_access=yes,
  23. ac_cv_unaligned_64_access=no,
  24. ac_cv_unaligned_64_access=no)
  25. ])
  26. case "$ac_cv_unaligned_64_access" in
  27. *yes) value=1;;
  28. *) value=0;;
  29. esac
  30. AC_DEFINE_UNQUOTED([HAVE_UNALIGNED_64_ACCESS], $value, [We can access-64 bit values that are only 32-bit aligned])
  31. ])