Re: ldap and solaris 2.xt

Paul (Paul.Wain@brunel.ac.uk)
Fri, 9 Dec 1994 09:55:38 +0000 (GMT)

Hi,

@ I have been massaging ldap 3.1b7 to work with Solaris without using the
@ evil and broken /usr/ucblib/libucb.a (you guys are nuts if you think it's
@ going to work well with that kludge).

As a rule, to anyone considering any Solaris 2.x work, NEVER EVER use
the ucblib libraries! They may work in the short term (and for most
things they do although the network code is broken for connecting to
outside of your local domain), BUT they are not always going to be
there. It is much better to sit down with the manual pages and work out
how to change the "BSDism" Sun4.1.x code into "SysV-ish" Sun5.X code.
It may take more time, but its worth it, and from what I have seen, most
of the time its trivial...(I say, MOST!)

@ I am curious as to which define I should use to key the Solaris changes.
@ Should I use #ifdef sunos5, or should I try to be clever and use
@ pre-processor defines? __svr4__ && __sun__ would do it and should also be
@ true for Solaris 2.x on x86 with gcc (ie, we should avoid using
@ __sparc__), but I am not sure if those are true for the many Sun compilers
@ for this platform...

I would suggest a bit of a mixture. Something that tries to use the
pre-processor defines but that can be over-ridden if needed. This is
from a lot of problems that I get using Sun Pro C (v 2.0.1 and v 3.0.1)
when compiling under Solaris 2.3 especially half-ported things - "tin"
springs to mind back in the days before the Solaris 2.3 port :).

My choice would be to do something like (Not sure of the exact names
here but you get the idea):

#if defined(__SVR4__) && defined(__SUN__)
#define SUNOS5
#endif

in the main/general include file and then throughout the rest of the
code use the SUNOS5 define. Looking at the Sun PRO headers you can also
look for __SYS5__ which will pick up Solaris on a 2.3 machine so a better
method to define solaris2.3 might just be:

#ifdef __SYS5__
#define SUNOS5
#endif

but I cant see what GCC would do with this :)

This would at least allow people to override the checks if need be.

Hope that helps.

Paul