Rewrite of Prefix shebang check for bug #313731.
The shebang check was basically working too well, or just being overly
aggressive. This caused files from e.g. gnuconfig, automake, autoconf,
libtool to install template files with prefixed bin/sh in them. This
causes no problems for a user, but makes autotools useless for
distribution.
Hence the approach has now been changed to be less aggressive:
1) For each script that has a shebang starting with $EPREFIX, check if
the target exists, or will exist after installation of the package.
If this fails, die with an appropriate error message: the shebang was
generated someway, and hence explicitly set that way to a
non-existing target, which is wrong.
2) For scripts having a non-prefixed shebang, check if they reside in
$PATH. If they do, check if the shebang can be prefixed, and if so,
prefix the shebang. If the shebang doesn't exist in the offset, die
with an appropriate error message: the script would otherwise rely on
a host-provided tool which indicates a missing dependency (and will
cause random problems because of a non-Prefix-aware host-tool being
used).
3) Scripts that do not match 1) and 2), e.g. they don't have a shebang
starting with $EPREFIX and do not reside in $PATH, we ignore invalid
shebangs, unless FEATURES=stricter is set, in which case we warn.
This allows packages like autoconf, automake, etc. to install without
warning of their template files with /bin/sh as shebang.