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/.
echo | g++ -dM -E - | more
can be used (g++
can be replaced by other g(cc|++)-like compiler.
echo | em++ …
) displays macros which are stripped out. The __x86_64__
macro, for example.