Improving OpenJDK portability - platform specific C conditionals
Steve Poole
spoole at linux.vnet.ibm.com
Mon Jul 18 23:05:47 PDT 2011
On 19/07/11 00:20, Kelly O'Hair wrote:
>
> 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.
That's good news - this is important to me to get sorted out. When
you say "heading towards" does that mean
there is a discussion thread somewhere in OpenJDK where this is being
discussed? (There are so many mailing lists :-) )
>
> -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/20110719/ef59c996/attachment.html
More information about the porters-dev
mailing list