Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* How do I find machine & OS names in /lib/cpp?!
@ 1995-07-04  4:00 Silas K.W. Denyer
  1995-07-04  4:00 ` Dan Pop
  0 siblings, 1 reply; 4+ messages in thread
From: Silas K.W. Denyer @ 1995-07-04  4:00 UTC (permalink / raw)


I am trying to compile some multi-platform software, using SDSC's sdscconfig.h,
which is a machine characteristics file. I believe that the C preprocessor,
/lib/cpp, will define a unique name for the machine & OS, allowing one to
#ifdef in special code for it when needed.

I am trying to compile this on a DEC 2100/A500MP Alpha AXP machine, running
OSF/1, and _really_ need to know either what /lib/cpp wants to call it, or how
do I find out! It seems that I have to be spot on with this or my code won't
compile at all! Can anyone help....?!

-- 
SILAS K.W. DENYER, B.Eng  ------>  Email: Silas.Denyer@eng.ox.ac.uk
Department of Engineering Science, University of Oxford, Oxford, UK
Tel: +44-1865-273813 (day),  249889 (eve),     Fax: +44-1865-273906
Email-to-fax: remote-printer.S_Denyer/UTC@441865273906.iddd.tpc.int




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I find machine & OS names in /lib/cpp?!
  1995-07-04  4:00 How do I find machine & OS names in /lib/cpp?! Silas K.W. Denyer
@ 1995-07-04  4:00 ` Dan Pop
  1995-07-06  4:00   ` Mark Charette
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Pop @ 1995-07-04  4:00 UTC (permalink / raw)


In <3tb6f2$m4a@news.ox.ac.uk> "Silas K.W. Denyer" <silas.denyer@eng.ox.ac.uk> writes:

>I am trying to compile some multi-platform software, using SDSC's sdscconfig.h,
>which is a machine characteristics file. I believe that the C preprocessor,
>/lib/cpp, will define a unique name for the machine & OS, allowing one to
>#ifdef in special code for it when needed.
>
>I am trying to compile this on a DEC 2100/A500MP Alpha AXP machine, running
>OSF/1, and _really_ need to know either what /lib/cpp wants to call it, or how
>do I find out! It seems that I have to be spot on with this or my code won't
>compile at all! Can anyone help....?!

The trick is to invoke cc with the -v option.  It will display the cpp
command and you'll be able to get the information you need.

    ues5:~/tmp 12> cc -v -E test.c >/dev/null
    /usr/lib/cmplrs/cc/cfe -E -Xv test.c -DLANGUAGE_C -D__LANGUAGE_C__ -D_CFE -Dunix -D__unix__ -D__osf__ -D_LONGLONG -D__alpha -D__DSO__ -DSYSTYPE_BSD -D_SYSTYPE_BSD -I/usr/include3.11 

It seems that __alpha is what you need, or __alpha and __osf__

You can use this trick on any Unix system to find out which system
specific macros are defined when the preprocessor is invoked.

Dan
--
Dan Pop
CERN, CN Division
Email: Dan.Pop@mail.cern.ch 
Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I find machine & OS names in /lib/cpp?!
  1995-07-04  4:00 ` Dan Pop
@ 1995-07-06  4:00   ` Mark Charette
  1995-07-06  4:00     ` Dan Pop
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Charette @ 1995-07-06  4:00 UTC (permalink / raw)


Dan Pop (Dan.Pop@mail.cern.ch) wrote:
: In <3tb6f2$m4a@news.ox.ac.uk> "Silas K.W. Denyer" <silas.denyer@eng.ox.ac.uk> writes:

: >I am trying to compile some multi-platform software, using SDSC's sdscconfig.h,
: >which is a machine characteristics file. I believe that the C preprocessor,
: >/lib/cpp, will define a unique name for the machine & OS, allowing one to
: >#ifdef in special code for it when needed.
: >
: >I am trying to compile this on a DEC 2100/A500MP Alpha AXP machine, running
: >OSF/1, and _really_ need to know either what /lib/cpp wants to call it, or how
: >do I find out! It seems that I have to be spot on with this or my code won't
: >compile at all! Can anyone help....?!

: The trick is to invoke cc with the -v option.  It will display the cpp
: command and you'll be able to get the information you need.

To use the "trick", you probably needed to read the man page, which also
states:
  ______________________________________________
  Macro                  std0       std   std1
                       (default)
  ____________________________________________
  LANGUAGE_C             yes        no    no
  __LANGUAGE_C__         yes        yes   yes
  unix                   yes        no    no
  __unix__               yes        yes   yes
  __osf__                yes        yes   yes
  __alpha                yes        yes   yes
  SYSTYPE_BSD            yes        no    no
  _SYSTYPE_BSD           yes        yes   yes
  LANGUAGE_ASSEMBLY      yes        yes   yes
  __LANGUAGE_ASSEMBLY__  yes        yes   yes
  ______________________________________________

: It seems that __alpha is what you need, or __alpha and __osf__

I'd use both. __alpha is defined on Alpha VMS C compilers.

: You can use this trick on any Unix system to find out which system
                            ^^^ ?
: specific macros are defined when the preprocessor is invoked.

Assuming that -v is supported on every Unix system, something I'm not
really sure is a fact. I don't remember any ANSI/ISO committee (or
even any de-facto industry committee) defining what should be supported
as switches on C compilers, never mind whether or not they're even
called cc. Surprising comment from you, Dan ;^)
--
Mark Charette                     charette@mika.com
MIKA Systems, Inc
17197 N. Laurel Park Dr Suite 115
Livonia, MI 48152



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How do I find machine & OS names in /lib/cpp?!
  1995-07-06  4:00   ` Mark Charette
@ 1995-07-06  4:00     ` Dan Pop
  0 siblings, 0 replies; 4+ messages in thread
From: Dan Pop @ 1995-07-06  4:00 UTC (permalink / raw)


In <3th62b$oqn@eccdb1.pms.ford.com> charette@ultoe.det.dec.com (Mark Charette) writes:

>Dan Pop (Dan.Pop@mail.cern.ch) wrote:
>
>: You can use this trick on any Unix system to find out which system
>                            ^^^ ?
>: specific macros are defined when the preprocessor is invoked.
>
>Assuming that -v is supported on every Unix system, something I'm not
>really sure is a fact. I don't remember any ANSI/ISO committee (or
>even any de-facto industry committee) defining what should be supported
>as switches on C compilers, never mind whether or not they're even
>called cc. Surprising comment from you, Dan ;^)

This is not comp.lang.c and we're talking about Unix compilers (actually
compiler drivers) not about the C language, so the ANSI/ISO committee
has little to do with our subject.

I've used about a dozen of Unix C compilers and, for some of them, -v
was the only way to obtain the complete list of macros defined when
the preprocessor is invoked (neither the cc nor the cpp man page did
help).

But if you have a better and more portable method, please share it with
us.

BTW, there are a number of Unix standards requiring the C compiler to be
called cc.  So, you'll have a hard time finding a Unix C compiler without
a cc driver, even if the vendor will recommend using a different driver.

Dan
--
Dan Pop
CERN, CN Division
Email: Dan.Pop@mail.cern.ch 
Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1995-07-06  4:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1995-07-04  4:00 How do I find machine & OS names in /lib/cpp?! Silas K.W. Denyer
1995-07-04  4:00 ` Dan Pop
1995-07-06  4:00   ` Mark Charette
1995-07-06  4:00     ` Dan Pop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox