-
Notifications
You must be signed in to change notification settings - Fork 3
/
hostinfo
43 lines (36 loc) · 987 Bytes
/
hostinfo
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
#!/bin/sh
# $Source: /home/CVSROOT/c2ada/hostinfo,v $
# $Revision: 1.2 $ $Date: 1999/02/03 19:45:04 $
# Generate host type info
echo '/* This file is automatically generated */' > $1
echo '#ifndef _H_HOSTINFO_' >> $1
echo '#define _H_HOSTINFO_' >> $1
./htype >> $1
cat > llchk.c << _STOP
main()
{
struct s {
char c;
long long x;
};
printf("\n#define SIZEOF_LONG_LONG\t\t%d\n", sizeof(long long));
printf("#define ALIGNOF_LONG_LONG\t\t%d\n\n",
sizeof(char) ((sizeof(struct s) - (sizeof(char) sizeof(long long)))));
}
_STOP
if cc -w llchk.c > /dev/null; then
./a.exe >> $1
rm -f a.exe
rm -f llchk.c
fi
echo '#define HOST_OS '`uname` >> $1
if [[ -e /usr/include/varargs.h ]]; then
echo '#define HAS_VARARGS' >> $1
fi
if [[ -e /usr/include/stdarg.h ]]; then
echo '#define HAS_STDARG' >> $1
fi
if [[ -e /usr/include/sys/mman.h ]]; then
echo '#define HAS_MMAP' >> $1
fi
echo '#endif /* _H_HOSTINFO_ */' >> $1