On Thu, Mar 06, 2008 at 12:27:52PM -0800, Dan McDonald wrote:

> I'm porting a large BSD and Linux app to OpenSolaris, and it would be optimal 
> if I could wrap
> my changes with:
> 
> #ifdef <well-known-symbol>
> /* OpenSolaris-specific code goes here...  */
> #endif /* well-known-symbol */
> 
> My first guess would've been simply "sun", but that may be more *Solaris* and 
> less
> *OpenSolaris*.

You can see a list of definitions by doing gcc -dD -E - </dev/null.
The first chunk is gcc-specific but the second one should be universal
(and in any case if gcc doesn't define the symbol but cc does it's not
very useful for this purpose anyway).  If you are going to do this,
I'd use the __ versions of these symbols.

Normally I'd suggest it's better not to put in "OpenSolaris-specific
code" but rather use feature tests; the features in question might
well exist on other systems in the future.  The trouble there of
course is that you don't always know what header to include to get the
definitions you'd be using as feature tests, a major problem autoconf
was intended to solve.  I don't believe it's the right solution, but
if it's the solution this software already uses, I don't see the harm
in adding a test in it for whatever feature you're relying on, then
conditionally compiling your code based on that test's result.

-- 
Keith M Wesolowski              "Sir, we're surrounded!" 
Fishworks                       "Excellent; we can attack in any direction!" 
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to