A useful resource on how to detect compilation environment based on predefined macros : http://nadeausoftware.com/articles/2011/12/c_c_tip_how_list_compiler_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.