On 8/17/23 9:05 AM, Osipov, Michael (IN IT IN) wrote:
Folks,
while trying to configure and compile 8.2 on HP-UX I have a link error
with -lncurses although configure tells me:
checking which library has the termcap functions... using libcurses
checking for ncurses/termcap.h... no
I tracked the issue down to be caused by
f7a382fd09319b20ef4435b9b554183b605468c1. The proper
BASH_CHECK_LIB_TERMCAP in readline-8.2/examples/autoconf/
BASH_CHECK_LIB_TERMCAP has this fallback:
else
TERMCAP_LIB=-lcurses
TERMCAP_DEP=
fi
which perfectly works for HP-UX and likely others. Now aclocal.m4 has:
else
# we assume ncurses is installed somewhere the linker can find it
TERMCAP_LIB=-lncurses
TERMCAP_DEP=
fi
Yes, it defaults to ncurses and assumes that it can be found, even though
configure did not find it.
note that libncurses is handled explicitly a few lines up and does not
require to be the default. The trivial patch is like before in 8.1:
That's not the right fix.
The right fix is:
*** ../bash-5.2-patched/aclocal.m4 Fri Mar 25 10:14:23 2022
--- aclocal.m4 Thu Aug 17 09:47:59 2023
***************
*** 987,990 ****
--- 956,962 ----
TERMCAP_LIB=-lncurses
TERMCAP_DEP=
+ elif test $bash_cv_termcap_lib = libcurses; then
+ TERMCAP_LIB=-lcurses
+ TERMCAP_DEP=
elif test $bash_cv_termcap_lib = libc; then
TERMCAP_LIB=