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"
