improve OS detection, don't enforce inclusion of machine/endian.h
we mistakenly *always* included machine/endian.h when everything
else failed - rendering the portable fallback strategy useless,
as we'd run into a compile error before getting there when
machine/endian.h doesn't exist.
not all the BSDs actually provide machine/endian.h, most notably
NetBSD doesn't - and the others prefer usage of sys/endian.h as
it provides other necessary ingredients, such as cdefs.h.
the only BSD-derived platform not providing sys/endian.h is MacOS
/iOS, so we use machine/endian.h only there.
Not that it would matter a lot, since all of these systems use
GCC/clang based toolchains recent enough to catch already the
first detection mechanism. Only really old versions of these OSes
would fall through until the OS-detection logic.