Distinguishing "true" MIPS box from DECstation at compile time

Win Treese treese at crltrx.crl.dec.com
Sat Dec 16 13:02:17 AEST 1989


In article <1300 at uakari.primate.wisc.edu> bin at primate.wisc.edu (Brain in Neutral) writes:
>How does one tell, when compiling a C program, whether the host is a
>true MIPS machine (e.g., M/120) from a DECstation that's running
>Ultrix.  I think I remember reading an article a while back that
>complained about "mips" being defined by the preprocessor even on
>Ultrix machines.  Is this true?  If so, is the test

According to the Ultrix/RISC manual page for cc, the following symbols
are defined (may change when ANSI C rolls around):

     unix           Any UNIX system
     bsd4_2         Berkeley UNIX Version 4.2
     ultrix         ULTRIX only
     mips           Any MIPS architecture
     MIPSEL         Little endian variant of MIPS architecture
     host_mips      Native compilation environment (as opposed to
                    cross-compiler)

If I'm being specific to Digital's RISC machines, I'd use

#if defined(mips) && defined(ultrix)
#endif

Actually, I'd probably stuff that kind of thing into machine/system-specific
configuration files and #ifdef based on feature.

Win Treese						Cambridge Research Lab
treese at crl.dec.com					Digital Equipment Corp.



More information about the Comp.unix.ultrix mailing list