aboutsummaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-05-29 00:46:26 +0000
committerChristian Grothoff <christian@grothoff.org>2009-05-29 00:46:26 +0000
commit0a217a8df1657b4334b55b0e4a6c7837a8dbcfd9 (patch)
tree6b552f40eb089db96409a312a98d9b12bd669102 /m4
ng
Diffstat (limited to 'm4')
-rw-r--r--m4/Makefile.am1
-rw-r--r--m4/align.m428
2 files changed, 29 insertions, 0 deletions
diff --git a/m4/Makefile.am b/m4/Makefile.am
new file mode 100644
index 0000000000..128870999e
--- /dev/null
+++ b/m4/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = .
diff --git a/m4/align.m4 b/m4/align.m4
new file mode 100644
index 0000000000..256300e377
--- /dev/null
+++ b/m4/align.m4
@@ -0,0 +1,28 @@
+# align.m4
+dnl Copyright (C) 2008 Christian Grothoff
+dnl This file is free software, distributed under the terms of the GNU
+dnl General Public License. As a special exception to the GNU General
+dnl Public License, this file may be distributed as part of a program
+dnl that contains a configuration script generated by Autoconf, under
+dnl the same distribution terms as the rest of that program.
+
+# Define HAVE_UNALIGNED_64_ACCESS if reading a 64-bit value at a 32-bit aligned offset works
+# Note that the program intentionally causes a SIGBUS (so you may
+# see some message along those lines on the console).
+AC_DEFUN([AC_UNALIGNED_64_ACCESS],
+[AC_CACHE_CHECK([whether unaligned 64-bit access works],
+ ac_cv_unaligned_64_access,
+ [
+ AC_RUN_IFELSE(AC_LANG_PROGRAM([[struct S { int a,b,c;};]],
+ [[struct S s = {0,0,0}; long long * p = &s.b;
+ long long x = *p; return (int) x*x;]]),
+ ac_cv_unaligned_64_access=yes,
+ ac_cv_unaligned_64_access=no,
+ ac_cv_unaligned_64_access=no)
+ ])
+ case "$ac_cv_unaligned_64_access" in
+ *yes) value=1;;
+ *) value=0;;
+ esac
+ AC_DEFINE_UNQUOTED([HAVE_UNALIGNED_64_ACCESS], $value, [We can access-64 bit values that are only 32-bit aligned])
+])