Subject: 29.0.92; configure on NetBSD forces unstable terminfo library

From: [email-masked]
Date: Tue, 11 Jul 2023 20:37:19 +0000

configure on NetBSD forces using the native libterminfo library, even
when ncurses is available. When started with a TERM such xterm-256color,
this results in abort() in tputs1 (TERM=xterm works).

Hacking configure to use ncurses when available provides stable
operation on xterm-256color.

The current special configure logic originates from this issue:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=6190 . This check is
probably not a good idea today. Either NetBSD should do a) what the
other BSDs do (= force ncurses) or b) what gnu* does (use what
configure found, otherwise force ncurses).

My vote goes to b (possibly with a warning from configure if libterminfo
is picked): keep it possible to build emacs without installing ncurses,
but use ncurses for terminfo when available.

To reproduce:

1. Compile Emacs 29 on NetBSD 9.3 (same logic is present on master, so I
assume that won't work any better).

2. Note that configure prints "-lncurses" if ncurses is installed, but
actually emacs is linked with libterminfo.

3. Run TERM=xterm-256color emacs -nw. You should get an abort in tputs1.

In GNU Emacs 29.0.92 (build 4, x86_64-unknown-netbsd9.3, X toolkit,
 cairo version 1.16.0) of 2023-07-10 built on netbsd
Repository revision: 419b4d44914701cedf308df58c3e5789715c87e7
Repository branch: emacs-29
System Description: NetBSD netbsd 9.3_STABLE NetBSD 9.3_STABLE (VUORI) #4: Sat Jun  3 09:32:53 UTC 2023  vuori@netbsd:/usr/src/sys/arch/amd64/compile/VUORI amd64

Configured using:
 'configure --prefix=/home/vuori/emacs --with-x-toolkit=athena
 --without-sound --with-modules --with-json
 --without-toolkit-scroll-bars CFLAGS=-I/usr/pkg/include
 'LDFLAGS=-L/usr/pkg/lib -R/usr/pkg/lib -R/usr/X11R7/lib''

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBXML2 MODULES NOTIFY KQUEUE PDUMPER PNG SQLITE3 THREADS TIFF
WEBP X11 XAW3D XDBE XIM XINPUT2 XPM LUCID ZLIB

Important settings:
  value of $LC_COLLATE: C.UTF-8
  value of $LC_TIME: C.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date subr-x mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util
mail-prsvr mail-utils term/xterm xterm byte-opt gv bytecomp byte-compile
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind kqueue lcms2 dynamic-setting system-font-setting
font-render-setting cairo x-toolkit xinput2 x multi-tty
make-network-process emacs)

Memory information:
((conses 16 46279 8331)
 (symbols 48 5824 0)
 (strings 32 14914 1175)
 (string-bytes 1 424404)
 (vectors 16 8323)
 (vector-slots 8 105495 7095)
 (floats 8 24 247)
 (intervals 56 217 0)
 (buffers 976 10))