use pkg-config to look up ncurses

Hardcoding -ltinfo breaks on distros that do not build the sep library
(which is the default ncurses behavior).  Use pkg-config to look up the
right libraries regardless of how the distro built things.

Note: I haven't fully tested this due to all the package dependencies.  I verified the configure parts look sane at least :).