Enable building GDB without installed libtermcap

Message ID DUB118-W469E26146CD54CFEE749FCE4160@phx.gbl
State New, archived
Headers

Commit Message

Bernd Edlinger Feb. 24, 2015, 6:13 p.m. UTC
  Hi,

On Mon, 23 Feb 2015 16:11:38, Pedro Alves wrote:
>
> On 02/23/2015 04:05 PM, Pedro Alves wrote:
>
>>> The idea for this patch is to include a simple version of libtermcap as a fall-back
>>> for the case that the host compiler does not have any cursor library. This enables
>>> at least a non tui-enabled gdb. It works even if there is no termcap configuration
>>> file on the target. If a termcap or curses library can be found when configuring gdb,
>>> we will use the installed library instead of the included libtermcap.
>
> ...
>
>> I don't see any change to libtermcap that makes this a "simple version of libtermcap".
>> AFAICS, this is really libtermcap, minus the manual and the definitions. Parts of
>> the libtermcap patch you show look like something that really should be sent
>> to libtermcap's list, even.
>
> ...
>
>> Sorry, without a better rationale, I don't see how this makes sense. We
>> like to have _fewer_ copies of upstream projects in the repo (such as
>> e.g., readline), not more.
>
> I should have added that GDB _already_ has a very minimal termcap in
> the tree -- see gdb/windows-termcap.c. We could consider making that
> the fallback on all hosts.
>

Ok, thanks for this hint!

That is probably exactly what I need.

This makes the patch much smaller.

Maybe the name windows-termcap.c is a bit misleading,
because my target is mostly some embedded linux.


How about this:




Thanks
Bernd.
  

Comments

Mike Frysinger Feb. 24, 2015, 7:34 p.m. UTC | #1
On 24 Feb 2015 19:13, Bernd Edlinger wrote:
> Maybe the name windows-termcap.c is a bit misleading,
> because my target is mostly some embedded linux.

yes, i think you should rename it to "stub-termcap.c" or something similar.
-mike
  
Doug Evans Feb. 24, 2015, 8:29 p.m. UTC | #2
On Tue, Feb 24, 2015 at 11:34 AM, Mike Frysinger <vapier@gentoo.org> wrote:
> On 24 Feb 2015 19:13, Bernd Edlinger wrote:
>> Maybe the name windows-termcap.c is a bit misleading,
>> because my target is mostly some embedded linux.
>
> yes, i think you should rename it to "stub-termcap.c" or something similar.
> -mike

Agreed.
  
Pedro Alves Feb. 26, 2015, 5:29 p.m. UTC | #3
On 02/24/2015 08:29 PM, Doug Evans wrote:
> On Tue, Feb 24, 2015 at 11:34 AM, Mike Frysinger <vapier@gentoo.org> wrote:
>> On 24 Feb 2015 19:13, Bernd Edlinger wrote:
>>> Maybe the name windows-termcap.c is a bit misleading,
>>> because my target is mostly some embedded linux.
>>
>> yes, i think you should rename it to "stub-termcap.c" or something similar.
>> -mike
> 
> Agreed.

Alright, that much is noncontroversial, I think.

Done:
 https://sourceware.org/ml/gdb-patches/2015-02/msg00772.html
  

Patch

diff --git a/gdb/configure b/gdb/configure
index 9632f9a..d44ac41 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -7253,7 +7253,7 @@  fi
 
 
 if test "$ac_cv_search_tgetent" = no; then
-  as_fn_error "no termcap library found" "$LINENO" 5
+  CONFIG_OBS="$CONFIG_OBS windows-termcap.o"
 fi
 
 
diff --git a/gdb/configure.ac b/gdb/configure.ac
index dfc6947..87ca668 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -621,7 +621,7 @@  esac
 AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses])
 
 if test "$ac_cv_search_tgetent" = no; then
-  AC_MSG_ERROR([no termcap library found])
+  CONFIG_OBS="$CONFIG_OBS windows-termcap.o"
 fi
 
 AC_ARG_WITH([system-readline],
diff --git a/gdb/windows-termcap.c b/gdb/windows-termcap.c
index caafc47..b6e0d08 100644
--- a/gdb/windows-termcap.c
+++ b/gdb/windows-termcap.c
@@ -32,6 +32,8 @@  extern char* tgetstr (char *name, char **area);
 extern int tputs (char *string, int nlines, int (*outfun) ());
 extern char *tgoto (const char *cap, int col, int row);
 
+char PC, *BC, *UP;
+
 /* Each of the files below is a minimal implementation of the standard
    termcap function with the same name, suitable for use in a Windows
    console window.  */