Improve detection of CPU affinity support (for FreeBSD and Linux).

As with several other recent commits, don't check explicitly for an
OS platform, but rather detect the various API bits that are used
to implement CPU affinity setting.