If we are using libncurses, also try to link with libtinfo.