zsh-workers
 help / color / mirror / code / Atom feed
From: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>
To: "Zsh hackers list" <zsh-workers@sunsite.dk>
Subject: PATCH: RE: termcap moodule problem on Cygwin
Date: Wed, 31 Jan 2001 13:37:34 +0300	[thread overview]
Message-ID: <002001c08b71$d23e08a0$21c9ca95@mow.siemens.ru> (raw)
In-Reply-To: <Tc0a8890c516bb0ccff@mailsweeper01.cambridgesiliconradio.com>

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

>
> You could force it to be statically linked by changing the `link' line to
> test for cygwin in termcap.mdd.  See existing `link=' in terminfo.mdd for
> how this works.  You can make this depend on a configure test for whether
> termcap is static.
>

This implements the latter. On two systems with static termcap/terminfo both
are now compiled into main executable.

I do not have any system with shared term library. I could try using ncurses
on Cygwin, but zsh unconditionally includes termcap.h and it is incompatible
with ncurses. Please, check with shared termcap if both modules are still
built as shared :)

I am fairly sure that check in current form does not work correctly on Cygwin
(due to stab libraries).

-andrej

[-- Attachment #2: zsh.termcap.diff --]
[-- Type: application/octet-stream, Size: 7711 bytes --]

Index: aczsh.m4
===================================================================
RCS file: /cvsroot/zsh/zsh/aczsh.m4,v
retrieving revision 1.6
diff -u -r1.6 aczsh.m4
--- aczsh.m4	2000/10/11 12:26:13	1.6
+++ aczsh.m4	2001/01/31 10:32:38
@@ -111,28 +111,30 @@
 
 
 dnl
-dnl zsh_SYS_DYNAMIC_BROKEN
-dnl   Check whether static/shared library linking is broken.
+dnl zsh_SHARED_SYMBOL
+dnl   Check whether symbol is available in static or shared library
 dnl
 dnl   On some systems, static modifiable library symbols (such as environ)
 dnl   may appear only in statically linked libraries.  If this is the case,
 dnl   then two shared libraries that reference the same symbol, each linked
 dnl   with the static library, could be given distinct copies of the symbol.
-dnl   If this is the case then dynamic linking is FUBAR.
 dnl
+dnl Usage: zsh_SHARED_SYMBOL(ident,type)
+dnl Sets zsh_cv_shared_$1 cache variable to yes/no
+dnl
 
-AC_DEFUN(zsh_SYS_DYNAMIC_BROKEN,
-[AC_CACHE_CHECK([if static/shared library linking is broken],
-zsh_cv_sys_dynamic_broken,
+AC_DEFUN(zsh_SHARED_SYMBOL,
+[AC_CACHE_CHECK([if $1 is available in shared libraries],
+zsh_cv_shared_$1,
 [if test "$zsh_cv_func_dlsym_needs_underscore" = yes; then
     us=_
 else
     us=
 fi
 echo '
-	extern char **environ;
+	extern $2 **$1;
 	void *symlist1[[]] = {
-		(void *)&environ,
+		(void *)&$1,
 		(void *)0
 	};
 ' > conftest1.c
@@ -185,12 +187,12 @@
 	    exit(1);
     exit(0);
 }
-], [zsh_cv_sys_dynamic_broken=no],
-[zsh_cv_sys_dynamic_broken=yes],
-[zsh_cv_sys_dynamic_broken=yes]
+], [zsh_cv_shared_$1=yes],
+[zsh_cv_shared_$1=no],
+[zsh_cv_shared_$1=no]
 )
 else
-    zsh_cv_sys_dynamic_broken=yes
+    zsh_cv_shared_$1=no
 fi
 ])
 ])
Index: configure.in
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.in,v
retrieving revision 1.39
diff -u -r1.39 configure.in
--- configure.in	2001/01/19 14:47:44	1.39
+++ configure.in	2001/01/31 10:32:39
@@ -557,37 +557,6 @@
   AC_DEFINE(MUST_DEFINE_OSPEED)
 fi
 
-dnl  Check if tgetent accepts NULL (and will allocate its own termcap buffer)
-dnl  Some termcaps reportedly accept a zero buffer, but then dump core
-dnl  in tgetstr().
-dnl  Under Cygwin test program crashes but exit code is still 0. So,
-dnl  we test for a file that porgram should create
-AC_CACHE_CHECK(if tgetent accepts NULL,
-zsh_cv_func_tgetent_accepts_null,
-[AC_TRY_RUN([
-main()
-{
-    int i = tgetent((char*)0,"vt100");
-    if (i > 0) {
-	char tbuf[1024], *u;
-    	u = tbuf;
-    	tgetstr("cl", &u);
-	creat("conftest.tgetent", 0640);
-    }
-    exit(!i || i == -1);
-}
-],
-  if test -f conftest.tgetent; then
-    zsh_cv_func_tgetent_accepts_null=yes
-  else
-    zsh_cv_func_tgetent_accepts_null=no
-  fi,
-  zsh_cv_func_tgetent_accepts_null=no,
-  zsh_cv_func_tgetent_accepts_null=no)])
-if test $zsh_cv_func_tgetent_accepts_null = yes; then
-  AC_DEFINE(TGETENT_ACCEPTS_NULL)
-fi
-
 dnl --------------
 dnl CHECK TYPEDEFS
 dnl --------------
@@ -845,9 +814,40 @@
 	       putenv getenv \
 	       brk sbrk \
 	       pathconf sysconf \
-	       tigetflag tigetnum tigetstr)
+	       tgetent tigetflag tigetnum tigetstr)
 AC_FUNC_STRCOLL
 
+dnl  Check if tgetent accepts NULL (and will allocate its own termcap buffer)
+dnl  Some termcaps reportedly accept a zero buffer, but then dump core
+dnl  in tgetstr().
+dnl  Under Cygwin test program crashes but exit code is still 0. So,
+dnl  we test for a file that porgram should create
+AC_CACHE_CHECK(if tgetent accepts NULL,
+zsh_cv_func_tgetent_accepts_null,
+[AC_TRY_RUN([
+main()
+{
+    int i = tgetent((char*)0,"vt100");
+    if (i > 0) {
+	char tbuf[1024], *u;
+    	u = tbuf;
+    	tgetstr("cl", &u);
+	creat("conftest.tgetent", 0640);
+    }
+    exit(!i || i == -1);
+}
+],
+  if test -f conftest.tgetent; then
+    zsh_cv_func_tgetent_accepts_null=yes
+  else
+    zsh_cv_func_tgetent_accepts_null=no
+  fi,
+  zsh_cv_func_tgetent_accepts_null=no,
+  zsh_cv_func_tgetent_accepts_null=no)])
+if test $zsh_cv_func_tgetent_accepts_null = yes; then
+  AC_DEFINE(TGETENT_ACCEPTS_NULL)
+fi
+
 AC_FUNC_MMAP
 if test x$ac_cv_func_mmap_fixed_mapped = xyes; then
   AC_CHECK_FUNCS(munmap msync)
@@ -1471,7 +1471,10 @@
   zsh_cv_sys_dynamic_execsyms="${zsh_cv_sys_dynamic_execsyms=no}"
   zsh_cv_sys_dynamic_strip_exe="${zsh_cv_sys_dynamic_strip_exe=yes}"
   zsh_cv_sys_dynamic_strip_lib="${zsh_cv_sys_dynamic_strip_lib=yes}"
-  zsh_cv_sys_dynamic_broken="${zsh_cv_sys_dynamic_broken=no}"
+  #
+  # THAT SUCKS! and must be changed
+  #
+  zsh_cv_shared_environ="${zsh_cv_shared_environ=yes}"
   LINKMODS=LINKMODS
   MOD_EXPORT="__attribute__((__dllexport__))"
   MOD_IMPORT_VARIABLE="__attribute__((__dllimport__))"
@@ -1616,8 +1619,15 @@
 fi
 
 if test "x$dynamic" = xyes; then
-  zsh_SYS_DYNAMIC_BROKEN
-  test "$zsh_cv_sys_dynamic_broken" = no || dynamic=no
+  zsh_SHARED_SYMBOL([environ], [char **])
+  test "$zsh_cv_shared_environ" = yes || dynamic=no
+dnl  test "$zsh_cv_sys_dynamic_broken" = no || dynamic=no
+  if test "$ac_cv_func_tgetent" = yes; then
+    zsh_SHARED_SYMBOL([tgetent], [(void (*)())])
+  fi
+  if test "$ac_cv_func_tigetstr" = yes; then
+    zsh_SHARED_SYMBOL([tigetstr], [(void (*)())])
+  fi
 fi
 
 if test "x$dynamic" = xyes; then
Index: Src/Modules/termcap.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/termcap.c,v
retrieving revision 1.1
diff -u -r1.1 termcap.c
--- Src/Modules/termcap.c	2000/12/03 20:53:25	1.1
+++ Src/Modules/termcap.c	2001/01/31 10:32:40
@@ -33,7 +33,7 @@
 /* echotc: output a termcap */
 
 /**/
-int
+static int
 bin_echotc(char *name, char **argv, char *ops, int func)
 {
     char *s, buf[2048], *t, *u;
Index: Src/Modules/termcap.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/termcap.mdd,v
retrieving revision 1.1
diff -u -r1.1 termcap.mdd
--- Src/Modules/termcap.mdd	2000/12/03 20:53:25	1.1
+++ Src/Modules/termcap.mdd	2001/01/31 10:32:40
@@ -1,5 +1,15 @@
 name=zsh/termcap
-link=either
+
+link='if test "x$ac_cv_func_tgetent" = xyes; then
+          if test "x$zsh_cv_shared_tgetent" = xyes; then
+	      echo either
+	  else
+	      echo static
+	  fi
+      else
+          echo no;
+      fi
+'
 load=yes
 
 autobins="echotc"
Index: Src/Modules/terminfo.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/terminfo.c,v
retrieving revision 1.4
diff -u -r1.4 terminfo.c
--- Src/Modules/terminfo.c	2000/12/06 01:16:15	1.4
+++ Src/Modules/terminfo.c	2001/01/31 10:32:40
@@ -36,7 +36,7 @@
 /* echoti: output a terminfo capability */
 
 /**/
-int
+static int
 bin_echoti(char *name, char **argv, char *ops, int func)
 {
     char *s, *t;
Index: Src/Modules/terminfo.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/terminfo.mdd,v
retrieving revision 1.3
diff -u -r1.3 terminfo.mdd
--- Src/Modules/terminfo.mdd	2000/12/05 11:00:09	1.3
+++ Src/Modules/terminfo.mdd	2001/01/31 10:32:40
@@ -1,5 +1,15 @@
 name=zsh/terminfo
-link='if test "x$ac_cv_func_tigetstr" = xyes; then echo either; else echo no; fi'
+
+link='if test "x$ac_cv_func_tigetstr" = xyes; then
+          if test "x$zsh_cv_shared_tigetstr" = xyes; then
+	      echo either
+	  else
+	      echo static
+	  fi
+      else
+          echo no;
+      fi
+'
 load=yes
 
 autobins="echoti"

  parent reply	other threads:[~2001-01-31 10:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-29 14:55 Andrej Borsenkow
2001-01-29 15:10 ` Peter Stephenson
2001-01-30  8:25   ` Andrej Borsenkow
2001-01-30 10:34     ` Peter Stephenson
2001-01-31  8:50       ` Somebody with gcc knowledge here? (Was: termcap moodule problem on Cygwin ) Andrej Borsenkow
2001-01-31 10:37       ` Andrej Borsenkow [this message]
2001-01-31 11:30         ` PATCH: RE: termcap moodule problem on Cygwin Peter Stephenson
2001-01-31 12:42           ` Andrej Borsenkow
2001-01-31 13:49             ` Peter Stephenson
2001-02-05 15:31               ` Andrej Borsenkow
2001-02-13 14:36                 ` Andrej Borsenkow
2001-01-29 16:48 ` Zefram

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='002001c08b71$d23e08a0$21c9ca95@mow.siemens.ru' \
    --to=andrej.borsenkow@mow.siemens.ru \
    --cc=zsh-workers@sunsite.dk \
    /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).