added rfx_realloc().
[swftools.git] / m4 / byteorder.m4
1 AC_DEFUN(RFX_CHECK_BYTEORDER,
2 [
3 AC_MSG_CHECKING([for byte order])
4 AC_TRY_RUN([
5 int main (int argc, char *argv[])
6 {
7     int i = 1;
8     return *(char*)&i;
9 }
10 ], BIGENDIAN=1, LITTLEENDIAN=1, CROSSCOMPILE=1)
11 export CROSSCOMPILE 
12
13 if test "x${CROSSCOMPILE}" = "x1"; then
14  AC_MSG_RESULT(we are cross compiling- trying to guess from system type)
15  AC_CANONICAL_SYSTEM
16  AC_MSG_CHECKING([for byte order, try 2])
17  case "${target}" in
18   *86* | *-pc-* )
19      LITTLEENDIAN=1
20      ;;
21   *sparc* | *68* | *88k* | *mac* | *Mac* | *sun* | *Sun* | *Amiga* | *amiga* )
22      BIGENDIAN=1
23      ;;
24  esac
25 fi
26
27 export LITTLEENDIAN
28 if test "x${LITTLEENDIAN}" = "x1"; then
29 AC_MSG_RESULT(little endian)
30 BYTEORDERCHECKOK=1
31 fi
32 export BIGENDIAN
33 if test "x${BIGENDIAN}" = "x1"; then
34 AC_MSG_RESULT(big endian)
35 BYTEORDERCHECKOK=1
36 WORDS_BIGENDIAN=1
37 export WORDS_BIGENDIAN
38 AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, 1)
39 fi
40 if test "x${BYTEORDERCHECKOK}" != "x1"; then
41 AC_MSG_RESULT(unknown)
42 echo Byte order could not determined.
43 exit 1
44 fi
45 ])
46
47