summaryrefslogtreecommitdiffstats
path: root/gen_art_config.sh.in
blob: 8c525bdbb63a30cbcb4602808cca623304efd486 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh

# A little utility function to generate header info.
#
# The output of this program is generally written to art_config.h,
# which is installed in libart's include dir.


echo "/* Automatically generated by gen_art_config */"
echo
echo "#ifndef _ART_CONFIG_H_"
echo "#define _ART_CONFIG_H_"
echo
echo "#define ART_SIZEOF_CHAR @ART_SIZEOF_CHAR@"
echo "#define ART_SIZEOF_SHORT @ART_SIZEOF_SHORT@"
echo "#define ART_SIZEOF_INT @ART_SIZEOF_INT@"
echo "#define ART_SIZEOF_LONG @ART_SIZEOF_LONG@"
echo

if test @ART_SIZEOF_CHAR@ -eq 1; then
  echo "typedef unsigned char art_u8;"
else
  echo 1>&2 "sizeof(char) != 1"
  exit 1
fi

if test @ART_SIZEOF_SHORT@ -eq 2; then
  echo "typedef unsigned short art_u16;"
else
  echo 1>&2 "sizeof(short) != 2"
  exit 2
fi

if test @ART_SIZEOF_INT@ -eq 4; then
  echo "typedef unsigned int art_u32;"
else
  if test @ART_SIZEOF_LONG@ -eq 4; then
    echo "typedef unsigned long art_u32;"
  else
    echo 1>&2 "sizeof(int) != 4 and sizeof(long) != 4"
	exit 3
  fi
fi

echo
echo "#endif /* _ART_CONFIG_H_ */"

exit 0
}