1#! /bin/sh
2set -e
3FILE=conftest$$
4cat >$FILE.c <<EOF
5#include "conftest$$.h"
6int main()
7{
8	TYPE t;
9	return sizeof(t);
10}
11EOF
12for i in "short" "int" "long " "unsigned short" "unsigned int" "unsigned long" \
13	"long long" "unsigned long long" ; do
14  rm -f $FILE.o
15  echo "typedef $i TYPE;" >$FILE.h
16  if ./auto-compile.sh -c $FILE.c >/dev/null 2>/dev/null ;
17  then
18    if ./auto-link.sh $FILE $FILE.o ; then
19      # cannot fail anyway.
20      if ./$FILE ; then
21	:
22      else
23	x=$?
24	p=`echo $i | sed 's/ /_/g' | tr "[:lower:]" "[:upper:]"`
25	echo "#define SIZEOF_$p $x /* systype-info */"
26      fi
27    fi
28  fi
29done
30rm -f $FILE.c $FILE.o $FILE $FILE.h
31exit 0
32