[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: where is #define __linux__



D-Man wrote:
> 
> On Mon, Jan 08, 2001 at 11:05:54PM -0800, Aaron Brashears wrote:
> | I'm doing some code which is intended to work on linux and sunos. I
> | was poking through the header files in /usr/include on my debian box
> | and found a line in g++-3/stl_config.h which specified:
> |
> | #if defined(__linux__)
> |
> | after a quick test, I found out this is true on linux, and not true on
> | solaris when using gcc. However, grep -r '__linux__' * doesn't reveal
> | the location where it is in fact #defined.
> |
> Not sure, but it could be defined in the compiler itself.
> 
> | Anyone have a clue what's going on? While on the topic, is there a
> | magic preprocessor definition that lets me know if I'm on
> | sunos/solaris?

This may help (on a linux i386 machine):

kleptog/~>touch /tmp/x.c
kleptog/~>gcc -E -dM -c /tmp/x.c
#define __linux__ 1 
#define linux 1 
#define __i386__ 1 
#define __i386 1 
#define __GNUC_MINOR__ 95 
#define i386 1 
#define __unix 1 
#define __unix__ 1 
#define __GNUC__ 2 
#define __linux 1 
#define __ELF__ 1 
#define unix 1 

-- 
Martijn van Oosterhout <kleptog@cupid.suninternet.com>
http://cupid.suninternet.com/~kleptog/



Reply to: