[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Distinguish between platforms with defs
From: |
Adam Fedor |
Subject: |
Re: Distinguish between platforms with defs |
Date: |
Sun, 30 Oct 2005 15:25:23 -0700 |
On Oct 29, 2005, at 3:04 PM, Andreas Höschler wrote:
Hello all,
I know about __APPLE__ and WIN32, but how can I say that I am on a
Solaris machine?
You can run this script to see what gcc defines on various platforms.
In general, though, it's better to select code based on functionality
not based on a specific platform (i.e. big-endian or not, does the os
implement a particular function, etc...)
#!/bin/sh
for def in `gcc -E -v - </dev/null 2>&1 | grep [-]$`; do
case $def in -D*) echo $def;; esac
done