Created attachment 502576 [details, diff]
In the present htop-2.0.2-tinfo.patch, pkg-config is used to confirm whether ncurses/w exists, and if so, ncurses/w?-config is called to figure out the LIBS. In addtion the libraries are tested explicitly should the output of ncurses/w?-config fails the tests.
This is problematic for Prefix. Consider a situation of RHEL7 where the system ncurses5-config outputs '-lncurses -ltinfo' and Gentoo ncurses6-config outputs '-LEPREFIX/usr/lib64 -lncurses'.
0. Gentoo Prefix should be self-contained, but when ncurses6-config goes wrong, the host ncurses5-config gets leaked into the configuration.
1. If the Gentoo ncurses tinfo is not compiled, the configure script calls the system ncurses5-config and the test fails.
2. -LEPREFIX/usr/lib64 is the system library path for Gentoo Prefix and should not be specified explicitly. pkg-config does this correctly.
Therefore I propose the attached patch to let htop only query pkg-config for ncurses/w when compiled on Gentoo.
Is this still an issue?