+
+dnl AC_MSG_CHECKING([that the compiler works])
+dnl AC_TRY_RUN([ main(int ac, char **av) { return 0; } ], AC_MSG_RESULT(yes), AC_MSG_RESULT(no) AC_MSG_ERROR(Could not compile and run even a trivial ANSI C program - check CC.), AC_MSG_ERROR(Could not compile and run even a trivial ANSI C program - check CC.))
+
+dnl Check for C operation
+AC_CANONICAL_HOST
+AC_C_BIGENDIAN
+AC_C_INLINE
+AC_CHECK_SIZEOF(short, 2)
+AC_CHECK_SIZEOF(int, 4)
+AC_CHECK_SIZEOF(long, 4)
+AC_CHECK_SIZEOF(float, 4)
+AC_CHECK_SIZEOF(double, 8)
+
+AC_MSG_CHECKING(endian)
+
+case "$host_cpu" in
+i386* | i486* | i586* | i686* | vax*)
+ endian=low
+ CFLAGS="$CFLAGS -DENDIAN_LOW=1 -DENDIAN_HIGH=0"
+ AC_MSG_RESULT(low)
+ ;;
+sparc* | mot* | ia64*)
+ endian=high
+ CFLAGS="$CFLAGS -DENDIAN_LOW=0 -DENDIAN_HIGH=1"
+ AC_MSG_RESULT(high)
+ ;;
+*)
+ AC_MSG_WARN([Unknown host cpu $host_cpu. Can't set endian])
+ ;;
+esac
+