diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-01-02 01:23:44 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-01-02 01:23:44 +0000 |
commit | c97b524b656511911853a6780cfdb3432793e4c8 (patch) | |
tree | 6b63a728499a3bc75f21b5099fc0528892cf3b06 | |
parent | aec2bdb65a1b8f64c86dce2df3aa271bda608d1b (diff) | |
download | master-187ad058-c97b524b656511911853a6780cfdb3432793e4c8.tar.gz master-187ad058-c97b524b656511911853a6780cfdb3432793e4c8.tar.bz2 master-187ad058-c97b524b656511911853a6780cfdb3432793e4c8.zip |
[tools] missing-macros: add as-unaligned-access.m4
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@24878 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r-- | tools/missing-macros/Makefile | 2 | ||||
-rw-r--r-- | tools/missing-macros/src/README | 6 | ||||
-rw-r--r-- | tools/missing-macros/src/m4/as-unaligned-access.m4 | 41 |
3 files changed, 48 insertions, 1 deletions
diff --git a/tools/missing-macros/Makefile b/tools/missing-macros/Makefile index 33417b1f5f..85f8fa1037 100644 --- a/tools/missing-macros/Makefile +++ b/tools/missing-macros/Makefile @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=missing-macros -PKG_VERSION:=8 +PKG_VERSION:=9 include $(INCLUDE_DIR)/host-build.mk diff --git a/tools/missing-macros/src/README b/tools/missing-macros/src/README index 8ee7f74248..d1202fb79c 100644 --- a/tools/missing-macros/src/README +++ b/tools/missing-macros/src/README @@ -79,6 +79,12 @@ Autostars m4 macro for versioning. as-version.m4 +From liboil: +Check if unaligned memory access works correctly. + + as-unaligned-access.m4 + + From OpenWrt: Always disable GTK docs. diff --git a/tools/missing-macros/src/m4/as-unaligned-access.m4 b/tools/missing-macros/src/m4/as-unaligned-access.m4 new file mode 100644 index 0000000000..ede8bd2a95 --- /dev/null +++ b/tools/missing-macros/src/m4/as-unaligned-access.m4 @@ -0,0 +1,41 @@ +dnl AS_UNALIGNED_ACCESS + +dnl check if unaligned memory access works correctly +AC_DEFUN([AS_UNALIGNED_ACCESS], [ + AC_MSG_CHECKING([if unaligned memory access works correctly]) + if test x"$as_cv_unaligned_access" = x ; then + case $host in + alpha*|arm*|hp*|mips*|sh*|sparc*|ia64*) + _AS_ECHO_N([(blacklisted) ]) + as_cv_unaligned_access=no + ;; + i?86*|x86_64|amd64|powerpc*|m68k*|cris*) + _AS_ECHO_N([(whitelisted) ]) + as_cv_unaligned_access=yes + ;; + esac + else + _AS_ECHO_N([(cached) ]) + fi + 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 "$as_cv_unaligned_access" = "yes"; then + AC_DEFINE_UNQUOTED(HAVE_UNALIGNED_ACCESS, 1, + [defined if unaligned memory access works correctly]) + fi +]) |