Subject: bug#64577: 29.0.92; configure on NetBSD forces unstable terminfo library

From: Eli Zaretskii <[email-masked]>
Date: Wed, 12 Jul 2023 16:32:39 +0300

> Date: Wed, 12 Jul 2023 15:57:29 +0300
> From: Valtteri Vuorikoski <[email-masked]>
> Cc: [email-masked]
> 
> >   netbsd)
> >     if test "x$LIBS_TERMCAP" != "x-lterminfo"; then
> >       TERMINFO=no
> >       LIBS_TERMCAP="-ltermcap"
> >     fi
> > 
> > should have set TERMINFO=no, which disables linking against terminfo.
> > 
> > So I don't think I understand what is going on there.
> 
> Finding ncurses is good, but unfortunately ncurses isn't what ends up
> getting used. configure says:
> 
> checking for library containing tputs... -lncurses
> 
> but this happens:
> 
> $ ldd src/emacs | egrep 'term|curses'
>      -lterminfo.1 => /usr/lib/libterminfo.so.1
> 
> Disabling the test above results in src/emacs being linked with
> ncurses. That is, when I remove the whole "netbsd" special case
> from configure this is the result:
> 
> $ ldd ~/emacs/bin/emacs | egrep 'term|curses'
>    -lncurses.6 => /usr/pkg/lib/libncurses.so.6

So does the patch below fix the issue?

diff --git a/configure.ac b/configure.ac
index 19575e8..21c396f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5212,7 +5212,7 @@ AC_DEFUN
     ;;
 
   netbsd)
-    if test "x$LIBS_TERMCAP" != "x-lterminfo"; then
+    if test "x$LIBS_TERMCAP" != "x-lncurses"; then
       TERMINFO=no
       LIBS_TERMCAP="-ltermcap"
     fi