1 # oper-:arch-:syst-:chip-:kern-
2 # oper = operating system type; e.g., sunos-4.1.4
3 # arch = machine language; e.g., sparc
4 # syst = which binaries can run; e.g., sun4
5 # chip = chip model; e.g., micro-2-80
6 # kern = kernel version; e.g., sun4m
7 # dependence: arch --- chip
9 # oper --- syst --- kern
10 # so, for example, syst is interpreted in light of oper, but chip is not.
11 # anyway, no slashes, no extra colons, no uppercase letters.
12 # the point of the extra -'s is to ease parsing: can add hierarchies later.
13 # e.g., *:i386-*:*:pentium-*:* would handle pentium-100 as well as pentium,
14 # and i386-486 (486s do have more instructions, you know) as well as i386.
15 # the idea here is to include ALL useful available information.
19 sys
="`uname -s | tr '/:[A-Z]' '..[a-z]'`"
22 unamer
="`uname -r | tr /: ..`"
23 unamem
="`uname -m | tr /: ..`"
24 unamev
="`uname -v | tr /: ..`"
27 bsd.os|freebsd|netbsd|openbsd
)
28 # in bsd 4.4, uname -v does not have useful info.
29 # in bsd 4.4, uname -m is arch, not chip.
33 chip
="`sysctl -n hw.model`" # hopefully
37 # as in bsd 4.4, uname -v does not have useful info.
52 # naturally IBM has to get uname -r and uname -v backwards. dorks.
53 oper
="$sys-$unamev-$unamer"
54 arch
="`arch | tr /: ..`"
60 oper
="$sys-$unamer-$unamev"
61 arch
="`(uname -p || mach) | tr /: ..`"
62 syst
="`arch | tr /: ..`"
63 chip
="$unamem" # this is wrong; is there any way to get the real info?
64 kern
="`arch -k | tr /: ..`"
67 oper
="$sys-$unamer-$unamev"
74 oper
="$sys-$unamer-$unamev"
75 arch
="`arch | tr /: ..`"
83 gcc
-o trycpp trycpp.o
86 oper
="nextstep-`hostinfo | sed -n 's/^[ ]*NeXT Mach \([^:]*\):.*$/\1/p'`"
87 arch
="`hostinfo | sed -n 's/^Processor type: \(.*\) (.*)$/\1/p' | tr /: ..`"
89 chip
="`hostinfo | sed -n 's/^Processor type: .* (\(.*\))$/\1/p' | tr ' /:' '...'`"
100 rm -f trycpp.o trycpp
105 # let's try to be consistent here. (BSD/OS)
109 # respect the hyphen hierarchy. (FreeBSD)
113 # respect the hyphen hierarchy. (FreeBSD)
117 # no, you nitwits, there is no such chip. (NeXTStep)
121 # no, you nitwits, there is no such chip. (Linux)
125 # STOP SAYING THAT! (Linux)
131 if gcc
-o x86cpuid x86cpuid.o
133 x86cpuid
="`./x86cpuid | tr /: ..`"
141 rm -f x86cpuid x86cpuid.o
143 echo "$oper-:$arch-:$syst-:$chip-:$kern-" |
tr ' [A-Z]' '.[a-z]'