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

RE: PATCH: RE: termcap moodule problem on Cygwin



>
> This turns the linking on SunOS 5.6 from dynamic to static for the two
> modules.  It was working OK before with dynamic.  However, the curses
> library which is linked in does appear to be static.  On the other hand,
> our new server with SunOS 5.8 appears to have a dynamic curses library, but
> the test still fails, although:
>   % nm /lib/libcurses.so | grep tgetent
>   [1176]  |     95876|      52|FUNC |GLOB |0    |9      |tgetent
> The libraries used are `-lsocket -ldl -lnsl -lcurses -lm -lc'.
>

Yes, test was broken, sorry. Try this patch (on top of previous).

The situation looks a bit more complicated. On my system name resolution in
shared modules happens at runtime (unless you override it) so all modules pick
up just one copy of curses library linked into main executable. Cool.

-andrej

--- aczsh.m4.old        Wed Jan 31 13:31:38 2001
+++ aczsh.m4    Wed Jan 31 15:31:46 2001
@@ -111,6 +111,38 @@


 dnl
+dnl zsh_SHARED_FUNCTION
+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
+dnl Usage: zsh_SHARED_FUNCTION(name)
+dnl Sets zsh_cv_shared_$1 cache variable to yes/no
+dnl
+
+AC_DEFUN(zsh_SHARED_FUNCTION,
+[zsh_SHARED_SYMBOL($1, [char *$1()], [$1])])
+
+dnl
+dnl zsh_SHARED_VARIABLE
+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
+dnl Usage: zsh_SHARED_VARIABLE(name,type)
+dnl Sets zsh_cv_shared_$1 cache variable to yes/no
+dnl
+
+AC_DEFUN(zsh_SHARED_VARIABLE,
+[zsh_SHARED_SYMBOL($1, [ $2 $1], [&$1])])
+
+dnl
 dnl zsh_SHARED_SYMBOL
 dnl   Check whether symbol is available in static or shared library
 dnl
@@ -119,7 +151,7 @@
 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
-dnl Usage: zsh_SHARED_SYMBOL(ident,type)
+dnl Usage: zsh_SHARED_SYMBOL(name,declaration)
 dnl Sets zsh_cv_shared_$1 cache variable to yes/no
 dnl

@@ -132,9 +164,12 @@
     us=
 fi
 echo '
-       extern $2 **$1;
-       void *symlist1[[]] = {
-               (void *)&$1,
+#ifdef __CYGWIN__
+       __attribute__((__dllimport__))
+#endif
+       extern $2;
+       void *symlist[[]] = {
+               (void *)$3,
                (void *)0
        };
 ' > conftest1.c
@@ -179,8 +214,8 @@
     if(!handle1) exit(1);
     handle2 = dlopen("./conftest2.$DL_EXT", RTLD_LAZY | RTLD_GLOBAL);
     if(!handle2) exit(1);
-    symlist1 = (void **) dlsym(handle1, "${us}symlist1");
-    symlist2 = (void **) dlsym(handle2, "${us}symlist2");
+    symlist1 = (void **) dlsym(handle1, "${us}symlist");
+    symlist2 = (void **) dlsym(handle2, "${us}symlist");
     if(!symlist1 || !symlist2) exit(1);
     for(; *symlist1; symlist1++, symlist2++)
        if(*symlist1 != *symlist2)
bor@itsrm2% gdiff -u configure.in.old configure.in
--- configure.in.old    Wed Jan 31 14:45:05 2001
+++ configure.in        Wed Jan 31 15:32:05 2001
@@ -1619,17 +1619,16 @@
 fi

 if test "x$dynamic" = xyes; then
-  zsh_SHARED_SYMBOL([environ], [char **])
+  zsh_SHARED_VARIABLE([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 (*)())])
+    zsh_SHARED_FUNCTION([tgetent])
   fi
   if test "$ac_cv_func_tigetstr" = yes; then
-    zsh_SHARED_SYMBOL([tigetstr], [(void (*)())])
+    zsh_SHARED_FUNCTION([tigetstr])
   fi
 fi
-    zsh_SHARED_SYMBOL([socket], [(void (*)())])

 if test "x$dynamic" = xyes; then
   zsh_SYS_DYNAMIC_CLASH



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