classilla / cryanc

TLS for the Internet of Old Things

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HP-UX 10.20 support

larb0b opened this issue · comments

Cryanc does not work out of the box with HP-UX 10.20 as it has no stdint.h. This can be worked around by adding something like

#define NOT_POSIX 1
#include <stdarg.h>
#include <sys/_inttypes.h>
#include <unistd.h>

under the #if defined(__ia64) || defined (__hppa) section, and then expanding #if !defined(_INTTYPES_H_) && !defined(_INTTYPES_H) to #if !defined(_INTTYPES_H_) && !defined(_INTTYPES_H) && !defined(__INTTYPES_INCLUDED), but then this breaks compilation on 11.x. I'm not sure of a good way of determining whether we're on HP-UX 11.x or 10.20, so I'm at a loss here. The only thing coming to mind is doing something with uname/utsname.h, which seems ugly.

I don't have any 10.20 systems right now, only 11i and 8.0. Are there other distinguishing macros we can look at between versions?

Some things such as hp9k8 are defined by the compiler I'm testing with on this 10.20 machine, and they're not on my 11.23 PA-RISC box. I'm not sure when that was added/removed from being defined though.

EDIT: This appears to be added by earlier versions of gcc on HP-UX/PA and isn't defined by HP C.

I'm not sure if there's an equivalent to -dM for HP C to get a list of macros.

It seems that PWB is defined on HP-UX 10.20 (at least), whereas it's not in 11.23. From cpp's man page on 10.20:

All HP-UX systems have the symbols PWB, hpux, unix, _PWB, __hpux, and __unix defined.

Strangely, the man page in 11.23 also claims this is defined but it's not, whether using aCC or cc.

It really doesn't seem like there's a reliable difference in preprocessor defined macros between 10.x and 11.x. I'm having trouble coming up with something less ugly than having people add a -Doldhpux or something similar at compile time (which maybe wouldn't be that bad since depending on platform people already have to add -lm/-misalign/etc.) or using uname and checking that release[] doesn't start with B.11.

I did some thinking about this and I agree that something like -Doldhpux or whatever is the least bad option. My only other thought is that I don't know if 11.23 has other, better TLS options. If it does, and I imagine that's the case, maybe we "disadvantage" 11.23 and require -Dnewhpux. Not sure what's best; you have the largest range of running HP systems of the two of us right now.

The only thing is that -Dnewhpux could be sort of confusing since it wouldn't be necessary on IA64, which inherently uses what we're considering "new" HP-UX and can't run 10.x. In my opinion -Doldhpux seems the most straightforward.