From 174c87d52b8a0fb13b4926ef1d06fae69fb87074 Mon Sep 17 00:00:00 2001 From: Explorer09 Date: Tue, 29 Oct 2024 07:59:30 +0800 Subject: [PATCH] build: Improve "tinfo" library detection in configure Now it can guess the terminfo library name based on the ncurses library file name. E.g. "-ltinfow" for the corresponding"-lncursesw". If the guessed library name doesn't link, try the "-ltinfo" name then. Signed-off-by: Kang-Che Sung --- configure.ac | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index b20ff18fa..42bb8a4e4 100644 --- a/configure.ac +++ b/configure.ac @@ -642,12 +642,20 @@ none-*|nonwide-yes) if htop_check_curses_capability "" "-l$curses_name"; then break fi - # For ncurses implementation, an extra "-ltinfo" or "-ltinfow" - # flag might be needed to link. - if test "x$enable_unicode" = xyes && - htop_check_curses_capability "" "-l$curses_name -ltinfow"; then - break - fi + # For ncurses implementation, an extra terminfo library might be + # needed. Guess the terminfo library name based on the ncurses + # library file name (e.g. "-ltinfow" for "-lncursesw"), before + # trying the "-ltinfo" name. + tinfo_name=`echo x$curses_name | sed 's/^xncurses/tinfo/p; d'` + case x$tinfo_name in + x|xtinfo) + ;; + *) + if htop_check_curses_capability "" "-l$curses_name -l$tinfo_name"; then + break + fi + ;; + esac if htop_check_curses_capability "" "-l$curses_name -ltinfo"; then break fi