Squeak on MacOS version identification?

Ian Piumarta ian.piumarta at inria.fr
Wed Aug 20 18:33:18 UTC 2003


On Tue, 19 Aug 2003, Tim Rowledge wrote:

> -1001 - basic OS type: "unix", "win32", "mac",...
> -1002 - specific OS type: "solaris2.5" on unix, "win95" on win32,...
> -1003 - processor architecture: "68k", "x86", "PowerPC",...

In addition to 1004 (interpreter version string) Unix also has 1005 which
returns the window system name ("X11", "Quartz" or "fbdev").  The only
thing (to my knowledge) that uses this information is my GLXUnix
changeset.

> Unix returns something derived from a scary looking bit
> of sed in the makefile/autoconf code and on my RH 7.1 machine it
> actually gives 'linux-gnu' which doesn't seem to quite match that spec.

The value returned (in Unix) is very precisely defined.  'configure' deals
in "canonical" host types that look like <cpu>-<vendor>-<os>.  These are
usually calculated automatically by script called "config.guess" (which is
part of autoconf).  These three values are available as the variables
host_cpu, host_vendor and host_os in the configure script, which exports
them to the C code by defining equivalent macros called VM_HOST_CPU and
VM_HOST_OS (we don't care about the vendor).  The VM then simply reports
whatever values these variables contain as attributes 1003 and 1002
respectively.

The reasoning behind this is that config.guess represents a de-facto
standard in the naming of processor architectures and operating systems,
and should be consistent between any pair of programs that extract this
information via autoconf.

FWIW, your Linux box is reporting exactly the right values.  Its canonical
host type is 'pc-unknown-linux-gnu' (where the <os> part happens to have
an extra hyphen, which we retain).  Anything more ambitious would mean
recourse to utsname (which is far less consistent in the values it
assigns to particular attributes than is the canonical host type).

Ian




More information about the Squeak-dev mailing list