Out-of-profile build support

Many packages rely on the presence of working binaries from other
builds.  This patch supercedes Issue #160 and
fixes https://github.com/hashdist/hashstack2/issues/79,
which prevented the multiline shebang script from correctly resolving an
out-of-profile interpreter.  The shebang script error messages have also
been improved.

Reported-by: Ondrej Certik <ondrej.certik@gmail.com>
Suggested-by: Johannes Ring <johannr@simula.no>