Emscripten: create static libraries with *.bc extension.

Inspired by official Emscripten platform file. Not sure how to handle
dynamic libraries, if at all, as there is no such thing with JS and this
might discourage using them.
Emscripten: fixed linking phase.

Previously the system-wide linker was used and it segfaulted. Now using
emar instead. Can't specify directly CMAKE_AR/CMAKE_RANLIB, as they are
overwritten later in CMakeFindBinUtils.cmake. Worked around that by
setting some internal prefix variables, after that the emar/emranlib is
found automagically.

Also not using Emscripten's official CMake toolchain, because this
allows us to do some specific modifications to it.