A useful resource on how to detect compilation environment based on predefined macros :

Other ressource : https://sourceforge.net/p/predef/wiki/Compilers/.

To list predefined preprocessor macros, echo | g++ -dM -E - | more can be used (g++ can be replaced by other g(cc|++)-like compiler.
For emscripten (based on LLVM), the above command (echo | em++ …) displays macros which are stripped out. The __x86_64__ macro, for example.