*BSD News Article 41599


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!spool.mu.edu!bloom-beacon.mit.edu!panix!news.mathworks.com!newshost.marcam.com!zip.eecs.umich.edu!newsxfer.itd.umich.edu!gumby!andrews-cc!gillham
From: gillham@andrews.edu (Andrew Gillham)
Newsgroups: comp.os.386bsd.bugs
Subject: Re: FreeBSD porting questions.
Date: 26 Jan 1995 06:32:59 GMT
Organization: Andrews University
Lines: 36
Message-ID: <3g7fmr$p9k@orion.cc.andrews.edu>
References: <3fh7id$an3@mars.mcs.com> <3g64ds$bak@grapevine.lcs.mit.edu>
NNTP-Posting-Host: edmund.cs.andrews.edu

In article <3g64ds$bak@grapevine.lcs.mit.edu> wollman@ginger.lcs.mit.edu (Garrett A. Wollman) writes:
>
>In article <3fh7id$an3@mars.mcs.com>,
>Christopher Hilton <chilton@MCS.COM> wrote:
>>     What's the #define symbol that the FreeBSD c compiler includes for 
>>environment detections and what is it defined to? Is it __FreeBSD__ and is 
>>defined to the version of the operating system?
>
>The example program in /usr/share/examples/FreeBSD_version should tell
>you everything you need to know.

Also, you can always create a file "foo.c" (like: main(){} )
and then do the following: (here's what I get on NetBSD 1.0)

% gcc -E -dM foo.c

#define __i386__ 1 
#define __NetBSD__ 1 
#define __i386 1 
#define i386 1 
#define __unix 1 
#define __unix__ 1 
#define __GNUC__ 2 
#define unix 1 

This shows you the compiler's defines... So you can do this on
any platform to figure out what's defined automatically.

-Andrew


-- 
==========================================================
Andrew Gillham                       gillham@andrews.edu
LAN/WAN/Netware/Unix Analyst         gillham@whirlpool.com
==========================================================