Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Link with curses if (and even) if it doesn't provide tgetent



Hello,
I've noticed that on Gentoo the zsh built doesn't include the curses
module. Closer look revealed the cause: the ncurses libraries
(ncursesw and ncurses) don't provide the call tgetent (nor tigetflag),
only tinfo does provide it. I guess this is the next step in splitting
libtinfo out of ncurses.

But this means that the binary can be linked to both ncurses and
tinfo. I've also checked that linking against such tgetent-lacking
ncurses and termcap works with no problems.

The patch does:
- it allows the normal flow of the checks with no changes,
- in the "if we need to ignore ncurses" check it adds, in case of
positive resolution of the test, an additional check that verifies for
initscr() in any of ncursesw, ncurses, curses and if this check is
positive, it then allows to link against that found curses library,
- it also adds libtinfow (side to libtinfo) to the terminal libraries
searched, as such library exists on the Gentoo system.

This way the zsh/curses module builds OK.

I attach the git-format-patch file.
-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
From e56bf700acaf4a50143daec16208ab86c8586f9c Mon Sep 17 00:00:00 2001
From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
Date: Thu, 3 Oct 2019 15:54:17 +0200
Subject: [PATCH] configure: Link with ncurses if (and even) it doesn't provide
 tgetent, to build the module. Also link with tinfow (not only tinfo)

---
 configure.ac | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index b31b1d958..c33188561 100644
--- a/configure.ac
+++ b/configure.ac
@@ -774,7 +774,7 @@ AS_HELP_STRING([--with-term-lib=LIBS],[search space-separated LIBS for terminal
   termcap_curses_order="$withval"
   AC_SEARCH_LIBS(tigetstr, [$termcap_curses_order])
 else
-  termcap_curses_order="$ncursesw_test $ncurses_test tinfo termcap curses"
+  termcap_curses_order="$ncursesw_test $ncurses_test tinfow tinfo termcap curses"
 fi],
 [case "$host_os" in
   solaris*)
@@ -783,7 +783,7 @@ fi],
    DL_EXT="${DL_EXT=sl}"
    termcap_curses_order="Hcurses $ncursesw_test $ncurses_test curses termcap" ;;
   *)
-   termcap_curses_order="$ncursesw_test $ncurses_test tinfo termcap curses" ;;
+   termcap_curses_order="$ncursesw_test $ncurses_test tinfow tinfo termcap curses" ;;
 esac])dnl
 
 AH_TEMPLATE([ZSH_NO_XOPEN],
@@ -831,7 +831,18 @@ AC_CACHE_CHECK(if we need to ignore ncurses, zsh_cv_ignore_ncurses,
   zsh_cv_ignore_ncurses=no
   ;;
   *)
-  zsh_cv_ignore_ncurses=yes
+    dnl If the tgetent nor tigetflag weren't found in the libncurses*.so, then
+    dnl there will be no conflict with the other terminal library selected (e.g.
+    dnl libtinfo) and it's possible to link ncurses provided that it is working
+    AC_SEARCH_LIBS(initscr, [ncursesw ncurses curses])
+    case $LIBS in
+      *-lncurses*|*-lcurses*)
+      zsh_cv_ignore_ncurses=no
+      ;;
+      *)
+      zsh_cv_ignore_ncurses=yes
+      ;;
+    esac
   ;;
 esac])
 
-- 
2.21.0



Messages sorted by: Reverse Date, Date, Thread, Author