Do not install/register internal libraries when unnecessary.
This commit fails its tests, because dynamic executables linked against internal libraries aren't handled correctly yet. I had to do more refactoring to handle this correctly, so it's in a separate commit. Some refactoring in this one for identifying public libraries as opposed to internal ones. Signed-off-by: Edward Z. Yang <email@example.com>