Improving OpenJDK portability - platform specific C conditionals
Kelly O'Hair
kelly.ohair at oracle.com
Mon Jul 18 16:20:17 PDT 2011
On Jul 18, 2011, at 4:00 PM, Steve Poole wrote:
>
>
> 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.
I always try and steer people this way, but it is hard to police the entire code base.
>
> Ultimately of course this path takes you down to supporting a ./configure process...
Or having some key setup.h file where these are defined, or defining it in the makefiles. :^(
We are heading toward a ./configure process in jdk8, just no specifics yet.
-kto
>
>
> 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/20110718/bd5395d2/attachment.html
More information about the porters-dev
mailing list