public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Christophe Lyon <christophe.lyon@arm.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] configure: exit with an error if no termcap lib is installed
Date: Fri, 22 Jul 2022 13:35:23 -0700	[thread overview]
Message-ID: <197286b6-4529-181a-13e4-a6a9a88db204@redhat.com> (raw)
In-Reply-To: <20220721085124.76878-1-christophe.lyon@arm.com>

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


      reply	other threads:[~2022-07-22 20:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-21  8:51 Christophe Lyon
2022-07-22 20:35 ` Keith Seitz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=197286b6-4529-181a-13e4-a6a9a88db204@redhat.com \
    --to=keiths@redhat.com \
    --cc=christophe.lyon@arm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).