[comp.unix.aix] #defines for AIX versions & h/w architectures

J.Crowcroft@ucl-cs.UUCP (10/09/90)

From: Jon Crowcroft <J.Crowcroft@uk.ac.ucl.cs>


what predefineds (e.g. is cpp called with any by cc)
exist for writing sensible 
#ifdef
to make code conditionally portable over AIX 
on PS/2, RS6000 and aix370 on a 3090?
(or does some sensible standard system header have a #define...?)

thanks
jon 

abe@mace.cc.purdue.edu (Vic Abell) (10/10/90)

In article <1204@ucl-cs.UUCP> J.Crowcroft@ucl-cs.UUCP writes:
>From: Jon Crowcroft <J.Crowcroft@uk.ac.ucl.cs>
>
>what predefineds (e.g. is cpp called with any by cc)

The porting guide, "Porting 4.3 BSD Programs to AIX Version 3.1" says:

	"In all cases, the AIXv3.1 C compiler defines the
	 following two tokens: _AIX, _IBMR2."

(You can find the porting guide in /usr/lpp/bos/bsdport.)

I don't believe that these predefines are established in the classical
cpp fashion.  Instead they are created by that part of XL C that handles
the stanzas of /etc/xlc.cfg.  There are several other reasons for doing
it this way:  1) more flexible; 2) there are two C preprocessors; and
3) no source code (yet) for cpp.

jsalter@slo (10/10/90)

>From: Jon Crowcroft <J.Crowcroft@uk.ac.ucl.cs>
>what predefineds (e.g. is cpp called with any by cc)
>exist for writing sensible 
>#ifdef
>to make code conditionally portable over AIX 
>on PS/2, RS6000 and aix370 on a 3090?

For AIX PS/2 (/etc/cc.cfg), AIX/370 (man cc.cfg) and AIX v3.1 6000
(/etc/xlc.cfg), the following define exists across all platforms:

	_AIX


To indicate differences between them, AIX PS/2 defines (/etc/cc.cfg):

	_I386

AIX/370 defines (according to: man cc.cfg):

	u370

and the 6000 defines (/etc/xlc.cfg):

	_IBMR2

Thus, you can tell the different AIX versions apart by the defines.

>(or does some sensible standard system header have a #define...?)

Well, on the 6000 the attempt at satisfying lots of standards has
occured making the header files full of #ifdefs as this has the least
impact on the system.  The common standards required are in the header
file: /usr/include/standards.h

In AIX/PS2, /etc/cc.cfg contains a line for the posix standard which
should help with compilation to that standard.  There are also flags
for ANSI compliance for both the 6000 XL C compiler and AIX/370 (man cc).

(Yes, I know this isn't the answer you were looking for, I just thought
I'd clarify a few things.)

>jon 

jim/jsalter  IBM AWD, Palo Alto  T465/(415)855-4427   VNET: JSALTER at AUSVMQ
Internet: ibmsupt!jsalter@uunet.uu.net         UUCP: ..!uunet!ibmsupt!jsalter 
	"Waco is a state of mind.  Once you've gone there,
		you never come back" - Leo

bengsig@oracle.nl (Bjorn Engsig) (10/10/90)

Article <1204@ucl-cs.UUCP> by J.Crowcroft@ucl-cs.UUCP says:
|what predefineds (e.g. is cpp called with any by cc)
|exist for writing sensible 
|#ifdef
That can be found in the ascii file /etc/xlc.cfg.
-- 
Bjorn Engsig,	       E-mail: bengsig@oracle.com, bengsig@oracle.nl
ORACLE Corporation   From IBM: auschs!ibmaus!cs.utexas.edu!uunet!oracle!bengsig

	"Stepping in others footsteps, doesn't bring you ahead"