No luck: this (NetBSD) system does not have any MT-safe call.
What I did:
During the configure I emit the warning if compiling under Darwin.
checking for getaddrinfo in -lsocket... no
checking for getnameinfo in -lsocket... no
checking for getaddrinfo... yes
checking for getnameinfo... yes
checking for gethostbyname_r... no
checking for gethostbyaddr_r... no
configure: WARNING: DNS queries will use non-threadsafe calls which
could result in server instability
In dns.c I added
#ifdef __APPLE__
Ns_Cs cs;
Ns_CsEnter(&cs);
...
Ns_CsLeave(&cs);
#endif
to cope with this *at least* within our own program. This does not
guarantee that this is MT-safe because any of the rest of the
system may call those calls anytime, hence we get problems anyways.
Zoran