X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=m4%2Fbyteorder.m4;fp=m4%2Fbyteorder.m4;h=685da68a3a94edb3c6fae3ec4f6e87ef8b9ebafa;hb=5a8db3625a47f0697ac1b1f459775ae59fe714ca;hp=0000000000000000000000000000000000000000;hpb=d4758d17bfb91cd5542b2ef6c92f1752fd2155ac;p=swftools.git diff --git a/m4/byteorder.m4 b/m4/byteorder.m4 new file mode 100644 index 0000000..685da68 --- /dev/null +++ b/m4/byteorder.m4 @@ -0,0 +1,47 @@ +AC_DEFUN(RFX_CHECK_BYTEORDER, +[ +AC_MSG_CHECKING([for byte order]) +AC_TRY_RUN([ +int main (int argc, char *argv[]) +{ + int i = 1; + return *(char*)&i; +} +], BIGENDIAN=1, LITTLEENDIAN=1, CROSSCOMPILE=1) +export CROSSCOMPILE + +if test "x${CROSSCOMPILE}" = "x1"; then + AC_MSG_RESULT(we are cross compiling- trying to guess from system type) + AC_CANONICAL_SYSTEM + AC_MSG_CHECKING([for byte order, try 2]) + case "${target}" in + *86* | *-pc-* ) + LITTLEENDIAN=1 + ;; + *sparc* | *68* | *88k* | *mac* | *Mac* | *sun* | *Sun* | *Amiga* | *amiga* ) + BIGENDIAN=1 + ;; + esac +fi + +export LITTLEENDIAN +if test "x${LITTLEENDIAN}" = "x1"; then +AC_MSG_RESULT(little endian) +BYTEORDERCHECKOK=1 +fi +export BIGENDIAN +if test "x${BIGENDIAN}" = "x1"; then +AC_MSG_RESULT(big endian) +BYTEORDERCHECKOK=1 +WORDS_BIGENDIAN=1 +export WORDS_BIGENDIAN +AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, 1) +fi +if test "x${BYTEORDERCHECKOK}" != "x1"; then +AC_MSG_RESULT(unknown) +echo Byte order could not determined. Try to insert your system type into aclocal.m4 about line 21 +exit 1 +fi +]) + +