Use wait_tty.  Remove stray ifdef.

Signed-off-by: Paul Brook <paul@nowt.org>
Handle dependent libraries.

Signed-off-by: Paul Brook <paul@nowt.org>