Add Emscripten support.

This required a little refactoring, and it only supports the js output mode. Since Emscripten no longer generates an executable, I hacked detection in by sniffing the output of $CXX -dM -E.