grub2: bring back build of aros-side grub2 tools
[AROS.git] / tools / copytoafs / myconf.aros
blob6df166e21fe5117af655ba420018953493ec9a4a
1 #! /bin/sh
3 TOP=$1
5 cat >$TOP/myctest.c <<END
7 #include<stdio.h>
9 union u{
10 long l;
11 char c[4];
16 int main(int argc, char *argv[])
18 union u val;
20 printf("%d ", (int)sizeof(long));
21 printf("%d ", (int)sizeof(short));
22 printf("%d ", (int)sizeof(int));
24 val.l=1L;
25 if (val.c[3]==1)
26 puts("BIG");
27 else
28 puts("LITTLE");
31 END
33 gcc $TOP/myctest.c -o $TOP/myctest
35 if [ `$TOP/myctest |cut -d' ' -f 1` != 4 ]
36 then echo "#error sizeof(long)!=4"
38 if [ `$TOP/myctest |cut -d' ' -f 2` != 2 ]
39 then echo "#error sizeof(short)!=2"
41 if [ `$TOP/myctest |cut -d' ' -f 3` != 4 ]
42 then echo "#error sizeof(int)!=4"
45 if [ `$TOP/myctest |cut -d' ' -f 4` = LITTLE ]
46 then
47 echo "#ifndef LITT_ENDIAN"
48 echo "#define LITT_ENDIAN 1"
49 echo "#endif /* LITT_ENDIAN */"
50 else
51 echo "#ifndef LITT_ENDIAN"
52 echo "#endif /* LITT_ENDIAN */"
55 rm $TOP/myctest*