diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-03-21 04:14:06 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-03-21 04:14:06 +0000 |
commit | b69f5f3e1bdfc07a6b3c78b54f4f16de7ba9e934 (patch) | |
tree | e17f2931ef15fc743af2bac981d2488f6f18b1cd /configure.in | |
parent | f608b85ddf25ab5c48473d9d922fdf420e8a2507 (diff) | |
download | tor-b69f5f3e1bdfc07a6b3c78b54f4f16de7ba9e934.tar.gz tor-b69f5f3e1bdfc07a6b3c78b54f4f16de7ba9e934.zip |
Add an autoconf test for whether unaligned int access is permitted.
It works on macos, and works correctly when I twiddle the test code to
generate a spurious segfault. Will it work anywhere else?
svn:r1329
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/configure.in b/configure.in index efccf2f7f3..79b30b3144 100644 --- a/configure.in +++ b/configure.in @@ -163,6 +163,19 @@ AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(__int64) +# Now, let's see about alignment requirements +AC_CACHE_CHECK([whether unaligned int access is allowed], tor_cv_unaligned_ok, +[AC_RUN_IFELSE([AC_LANG_SOURCE( +[[int main () { char s[] = "A\x00\x00\x00\x00\x00\x00\x00"; +return *(int*)(&s[1]); }]])], + [tor_cv_unaligned_ok=yes], + [tor_cv_unaligned_ok=no], + [tor_cv_unaligned_ok=cross])]) +if test tor_cv_unaligned_ok = yes; then + AC_DEFINE([UNALIGNED_INT_ACCESS_OK], 1, + [Define to 1 iff unaligned int access is allowed]) +fi + # $prefix stores the value of the --prefix command line option, or # NONE if the option wasn't set. In the case that it wasn't set, make # it be the default, so that we can use it to expand directories now. |