diff options
author | David Schleef <ds@schleef.org> | 2004-04-16 03:26:43 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2004-04-16 03:26:43 +0000 |
commit | d03e4388098656fa65df4d3a29e40fc556173d2d (patch) | |
tree | 43bf6848652140900ca2b41feed6ba1bd64a5b5a | |
parent | c4fb9e5b7bc69f9420a0f008230e3028fdc2b097 (diff) |
common/m4/gst-arch.m4: Add GST_UNALIGNED_ACCESS() macro that checks if we can access unaligned memory.
Original commit message from CVS:
* common/m4/gst-arch.m4: Add GST_UNALIGNED_ACCESS() macro that
checks if we can access unaligned memory.
* configure.ac: Use it.
-rw-r--r-- | m4/gst-arch.m4 | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/m4/gst-arch.m4 b/m4/gst-arch.m4 index 33ea993..13b18e4 100644 --- a/m4/gst-arch.m4 +++ b/m4/gst-arch.m4 @@ -81,3 +81,29 @@ AM_CONDITIONAL(HAVE_CPU_X86_64, test "x$HAVE_CPU_X86_64" = "xyes") AM_CONDITIONAL(HAVE_LIBMMX, test "x$USE_LIBMMX" = "xyes") ]) + +AC_DEFUN([GST_UNALIGNED_ACCESS], [ + AC_MSG_CHECKING([if unaligned memory access works correctly]) + if test x"$as_cv_unaligned_access" = x ; then + AC_TRY_RUN([ +int main(int argc, char **argv) +{ + char array[] = "ABCDEFGH"; + unsigned int iarray[2]; + memcpy(iarray,array,8); +#define GET(x) (*(unsigned int *)((char *)iarray + (x))) + if(GET(0) != 0x41424344 && GET(0) != 0x44434241) return 1; + if(GET(1) != 0x42434445 && GET(1) != 0x45444342) return 1; + if(GET(2) != 0x43444546 && GET(2) != 0x46454443) return 1; + if(GET(3) != 0x44454647 && GET(3) != 0x47464544) return 1; + return 0; +} + ], as_cv_unaligned_access="yes", as_cv_unaligned_access="no") + fi + AC_MSG_RESULT($as_cv_unaligned_access) + if test "$gst_unaligned_access" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_UNALIGNED_ACCESS, 1, + [defined if unaligned memory access works correctly]) + fi +]) + |