Mac, BSD: Centralize endian defines

- Put __BYTE_ORDER, __BIG_ENDIAN, __LITTLE_ENDIAN defines in
  oscompat.h, instead of scattered in various files
- Include the right headers for endian macros on Mac and BSD