Subject: Re: bug#6190: 24.0.50; patch to configure emacs to use terminfo on recent NetBSD.

From: enami tsugutomo <[email-masked]>
Date: 21 May 2010 10:32:37 +0900

Glenn Morris <[email-masked]> writes:

> I've installed it in the trunk. emacs-23 will need a different patch,
> since there terminfo is not set by configure, but hard-coded in
> src/s/netbsd.h. I don't know how to write that patch (some check of
> the netbsd version number? Blech.)

The terminfo library is commited to netbsd trunk on 2010 feb. 03 and
that is between netbsd 5.99.24 (2010 jan 19) and 5.99.25 (2010 mar
29).  The version symbol __NetBSD_Version__ is defined in sys/param.h
like this:

#define __NetBSD_Version__      599002600       /* NetBSD 5.99.26 */

but the header file isn't handy as FreeBSD's osreldate.h (it includes
some other header files and not suitable to create Makefile.)

Instead, I've found that we can use HAVE_TERM_H.  /usr/include/term.h
is is header file for terminfo.

I built emacs-23.2 on following two systems with applied patch below.
The former has terminfo but the latter doesn't.

enami@rplaca% uname -a
NetBSD rplaca.sm.sony.co.jp 5.99.26 NetBSD 5.99.26 (GENERIC) #0: Thu Apr  8 15:59:25 JST 2010  [email-masked]:/home/enami/src/current/obj.amd64/sys/arch/amd64/compile/GENERIC amd64
enami@rplaca% ldd src/emacs
src/emacs:
        -lossaudio.1 => /usr/lib/libossaudio.so.1
        -lc.12 => /usr/lib/libc.so.12
        -lterminfo.1 => /usr/lib/libterminfo.so.1
        -lm.0 => /usr/lib/libm.so.0

enami@memory-leak% uname -a
NetBSD memory-leak.sm.sony.co.jp 5.0_STABLE NetBSD 5.0_STABLE (GENERIC) #1: Wed Oct 14 11:57:28 JST 2009  [email-masked]:/home/enami/src/netbsd-5/obj.i386/sys/arch/i386/compile/GENERIC i386
enami@memory-leak% ldd src/emacs
src/emacs:
        -lc.12 => /usr/lib/libc.so.12
        -lossaudio.0 => /usr/lib/libossaudio.so.0
        -lpthread.0 => /usr/lib/libpthread.so.0
        -ldbus-1.3 => /usr/pkg/lib/libdbus-1.so.3
        -ltermcap.0 => /usr/lib/libtermcap.so.0
        -lm.0 => /usr/lib/libm387.so.0
        -lm.0 => /usr/lib/libm.so.0

enami.

diff -ur ../org/emacs-23.2/src/s/netbsd.h ./src/s/netbsd.h
--- ../org/emacs-23.2/src/s/netbsd.h	2010-04-04 07:26:08.000000000 +0900
+++ ./src/s/netbsd.h	2010-05-21 10:08:39.000000000 +0900
@@ -45,7 +45,12 @@
 #define LIBS_DEBUG
 /* -lutil is not needed for NetBSD >0.9.  */
 /* #define LIBS_SYSTEM -lutil */
+#ifdef HAVE_TERM_H
+#define TERMINFO
+#define LIBS_TERMCAP -lterminfo
+#else
 #define LIBS_TERMCAP -ltermcap
+#endif
 
 #define NEED_ERRNO
 #define SYSV_SYSTEM_DIR