do not link in dynamic libraries when compiling to bitcode in intermediate stages, only link them in when building to js or html. closes #1886