[PATCH] configure: exit with an error if no termcap lib is installed

Keith Seitz keiths@redhat.com
Fri Jul 22 20:35:23 GMT 2022


Hi,

On 7/21/22 01:51, Christophe Lyon via Gdb-patches wrote:
> The termcap detection code in aclocal.m4 (BASH_CHECK_LIB_TERMCAP)
> defaults to "gnutermcap" if none of the usual libraries is available
> (termcap, tinfo, curses, ncurses, ncursesw).
> 
> Then it sets TERMCAP_LIB to "./lib/termcap/libtermcap.a", so it
> expects that libtermcap.a is present under lib/termcap in the build
> directory.
> 
> In fact, this is generally not the case (we do not manually install
> libtermcap in the build tree), so it's better to stop with an error
> message.

Thanks for the patch! I've been bitten by this once or twice, so I
welcome this change. Kudos, too, for following  the documented procedure
and updating readline/README.

Just two quick questions.

Regarding the patch itself, my (admittedly hasty) reading of BASH_CHECK_LIB_TERMCAP
(in aclocal.m4) is that if "--with-curses" is supplied and is not available,
bash_cv_termcap_lib will (also) be set to "gnutermcap". [More pedantically, if *no*
satisfactory library was found.]

The following if .. elif .. blocks essentially ignore "gnutermcap" when "prefer_curses"
is set, and the code falls through to the final "else," setting "TERMCAP_LIB=-lcurses".

Back in configure.ac, we have

> @@ -6367,7 +6367,7 @@ if test "$TERMCAP_LIB" = "./lib/termcap/libtermcap.a"; then
>  	if test "$prefer_curses" = yes; then
>  		TERMCAP_LIB=-lcurses
>  	else
> -		TERMCAP_LIB=-ltermcap	#default
> +		as_fn_error $? "missing required termcap lib or equivalent" "$LINENO" 5
>  	fi
>  fi

I don't see how we can get TERMCAP_LIB set to "./lib/termcap/libtermcap.a"
and have prefer_curses. That appears to be dead code.

However, I think this still misses issuing the error when --with-curses is supplied.
Naively, one well-placed AC_MSG_ERROR should do it, but maybe readline
developers have a reason to do this?

Having said that, have you attempted to get this patch merged upstream? Above
questions aside, in the long run, it would be best to get this merged there. That
would greatly reduce the burden of maintaining/carrying/merging these local
patches.

Keith



More information about the Gdb-patches mailing list