autoconf macro package. Needed for SWF_CHECK_BYTEORDER.
[swftools.git] / aclocal.m4
1 AC_DEFUN(SWF_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_MSG_CHECKING(for system type)
16  systemguess=`./config.guess`
17  AC_MSG_RESULT(${systemguess})
18  AC_MSG_CHECKING([for byte order, try 2])
19  case "${systemguess}" in
20   *86* | *-pc-* )
21      LITTLEENDIAN=1
22      ;;
23   *sparc* | *68* | *88k* | *mac* | *Mac* | *sun* | *Sun* | *Amiga* | *amiga* )
24      BIGENDIAN=1
25      ;;
26  esac
27 fi
28
29 export LITTLEENDIAN
30 if test "x${LITTLEENDIAN}" = "x1"; then
31 AC_MSG_RESULT(little endian)
32 BYTEORDERCHECKOK=1
33 fi
34 export BIGENDIAN
35 if test "x${BIGENDIAN}" = "x1"; then
36 AC_MSG_RESULT(big endian)
37 BYTEORDERCHECKOK=1
38 WORDS_BIGENDIAN=1
39 export WORDS_BIGENDIAN
40 AC_DEFINE_UNQUOTED(WORDS_BIGENDIAN, 1)
41 fi
42 if test "x${BYTEORDERCHECKOK}" != "x1"; then
43 AC_MSG_RESULT(unknown)
44 echo Byte order could not determined. Try to insert your system type into aclocal.m4 about line 21
45 exit 1
46 fi
47 ])
48