Don't manually define MACOS and LINUX, use built-in defines instead

If necessary, the built-in defines __APPLE__ and __linux__ can be
used instead of these manually added defines. This is similar to how
we use _WIN32 instead of manually defining WIN32.