zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: PATCH: Link with curses if (and even) if it doesn't provide tgetent
Date: Thu, 3 Oct 2019 14:39:25 +0000	[thread overview]
Message-ID: <CAKc7PVDN0WSyyOQdBnOVtgSppTrOTzeGoPYyJTHyNg9qMCsbAA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1186 bytes --]

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

[-- Attachment #2: 0001-configure-Link-with-ncurses-if-and-even-it-doesn-t-p.patch.txt --]
[-- Type: text/plain, Size: 1897 bytes --]

From e56bf700acaf4a50143daec16208ab86c8586f9c Mon Sep 17 00:00:00 2001
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
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


             reply	other threads:[~2019-10-03 14:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-03 14:39 Sebastian Gniazdowski [this message]
2019-10-23 17:18 ` Sebastian Gniazdowski
2019-10-24 13:01   ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKc7PVDN0WSyyOQdBnOVtgSppTrOTzeGoPYyJTHyNg9qMCsbAA@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).