Re: BSD >= 199306
It depends on what you really want to test.
The kernel variant (FreeBSD) is signaled by __FreeBSD_kernel__
and libc variant (glibc) by __GLIBC__.
What about OpenBSD?
I have just looked into source of prayer,
the main difference between linux and bsd are
1) os_limit_vm(), os_prctl_set_dumpable()
they are no-op on BSD, so it is easy to guard them via __linux__
on linux, there are available two variants - bsd one and sysv one.
once again, it is easy to guard sysv one by __linux__
The difference between linux and solaris is also small,
on solaris is different locking and there is only one variant
for os_run_pty(), the sysv one.
The remaining differences are slightly different include files,
nonexistent socklen_t and ipv6 support on solaris.
IMHO, it would be much better to merge all three files
into one and use sensible defaults,
* IPV6 is supported
* socklen_t is supported
* os_limit_vm() and os_prctl_set_dumpable() are no-op by default
* use BSD PTY
* flock() does exist
and create exception for the above based on __linux__, __svr4__
and SOLARIS macros.