Improving OpenJDK portability - platform specific C conditionals

Steve Poole spoole at linux.vnet.ibm.com
Mon Jul 18 16:00:40 PDT 2011



Hi all,

I want to start a discussion about the "right" way to deal with a 
particular aspect of C code portability - namely platform specific 
conditionals.

In porting to AIX  we've frequently had to deal with  extending  lines like:

*#ifdef LINUX *

to become

*#if defined(LINUX) || defined(AIX)
*

But that seems wrong - it doesn't aid OpenJDK portability except for one 
specific new platform.   It seems to me a better choice is not to  
extend the ifdefs as above but  to move towards a capability based 
definition process.

So have something like *#ifdef HAS_SPECIFIC_FUNCTION*   and then 
somewhere else have a build file the turns on *HAS_SPECIFIC_FUNCTION *if 
building on AIX or Linux.

Ultimately of course this path takes you down to  supporting a   
./configure  process...


I assume this topic has come up before - what's the perceived wisdom for 
dealing with this problem?



Cheers,

Steve



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/porters-dev/attachments/20110719/620bd7d4/attachment.html 


More information about the porters-dev mailing list