Return to BSD News archive
Xref: sserve comp.os.386bsd.questions:10791 comp.os.linux.help:37003 Newsgroups: comp.os.386bsd.questions,comp.os.linux.help Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!hippo.ru.ac.za!Braae!g89r4222 From: csgr@cs.ru.ac.za (Geoff Rehmet) Subject: Re: BSD vs Linux Message-ID: <Cr6s88.B3v@hippo.ru.ac.za> Sender: news@hippo.ru.ac.za (Usenet News Admin) Reply-To: csgr@cs.ru.ac.za Organization: Rhodes University, Grahamstown, South Africa References: <2t5r0f$24q@cleese.apana.org.au> <2t8fs5$e9p@redstone.interpath.net> <Cr5uCG.BMB@rex.uokhsc.edu> <1994Jun10.095736.5367@uk.ac.swan.pyr> Date: Fri, 10 Jun 1994 14:57:43 GMT Lines: 40 In <1994Jun10.095736.5367@uk.ac.swan.pyr> iiitac@uk.ac.swan.pyr (Alan Cox) writes: >In article <Cr5uCG.BMB@rex.uokhsc.edu> benjamin-goldsteen@uokhsc.edu writes: >>available. Another thing: "#ifdef linux". I can't remember the >>standard, but the rule is predefined defines should match >>"_[A-Z].*" or "__[A-z].*" (e.g. __sgi, _AIXV3, or __FreeBSD__) >#ifdef __linux__ you mean. Yes use that all the time. Well, here's what I found out: cshl2:~/tmp> uname -a Linux cshl2 0.99.15 #1 Thu Feb 3 19:55:32 CST 1994 i486 cshl2:~/tmp> cat foo.c void main(void) {} cshl2:~/tmp> gcc -E -dM foo.c #define __linux__ 1 #define linux 1 #define __i386__ 1 #define __i386 1 #define __GNUC_MINOR__ 5 #define __i486__ 1 #define i386 1 #define __unix 1 #define __unix__ 1 #define __GNUC__ 2 #define __linux 1 #define unix 1 So it defines __linux, __linux__ and linux, although, on another Linux system I was working on last night, I can't remember seeing __linux or __linux__ in the output of gcc -E -dM. (It was a more recent installation than the above.) Geoff. -- Geoff Rehmet, Computer Science Department, | ____ _ o /\ Rhodes University, South Africa |___ _-\_<, / /\/\ FreeBSD core team | (*)/'(*) /\/ / \ \ csgr@cs.ru.ac.za, csgr@freefall.cdrom.com, geoff@neptune.ru.ac.za