added checking whether system() can handle calls like
[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_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. Try to insert your system type into aclocal.m4 about line 21
43 exit 1
44 fi
45 ])
46
47 AC_DEFUN(SWF_CHECK_SYSTEM_BACKTICKS,
48 [
49 AC_MSG_CHECKING([whether system() can handle command substitution])
50 AC_TRY_RUN([
51 #include "stdlib.h"
52 int main (int argc, char*argv[])
53 {
54     return system("echo `echo 0` > config.tmp2");
55 }
56 ], OK=OK,,CROSSCOMPILE=1)
57
58 if test "x${OK}" = "xOK";then
59     test -s config.tmp2 || OK=
60 fi
61
62 if test "x${CROSSCOMPILE}" = "x1";then
63     OK=OK;
64 fi
65 if test "x${OK}" = "xOK";then
66 rm -f config.tmp2
67 AC_MSG_RESULT(yes)
68 export SYSTEM_BACKTICKS=1
69 AC_DEFINE_UNQUOTED(SYSTEM_BACKTICKS, 1)
70 else
71 AC_MSG_RESULT(no)
72 fi
73 ])
74