zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Cygwin - second go.
@ 2000-08-14 17:54 Andrej Borsenkow
  2000-08-15  5:08 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 2000-08-14 17:54 UTC (permalink / raw)
  To: ZSH workers mailing list

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

This patch hopefully makes both dynamic and static compilation under Cygwin
possible again (at least, I tried both under Unix and under Cygwin). The main
changes are:

- almost all dependencies are now in configure.in; it defines MOD_EXPORT,
MOD_IMPORT_VARIABLE and MOD_IMPORT_FUNCTION that are put by mkmakemod.sh into
*.mdh files

- dllwrap is now using --export-all-symbols. Else the problem with setup_, etc
became just way too messy and I did not have enough guts :-) It means, that
missing mod_export's won't be noticed anymore.

- I removed --dllname. It does not appear to do what I expected and I wait
some clarification (hopefully) from Cygwin list. (I was afraid, that if we
have two modules foo1/bar.dll and foo2/bar.dll system may not like it. But
dllname does not appear to be used for imported name resolution - or I do not
know how to do it).

Question - should I remove --export-all-symbols? With this option cygwin
becomes so much like a Unix, that I was even tempted to remove special case
from configure.in :>-)

-andrej

Have a nice DOS!
B >>

P.S. Post-1.1.4 cygwin appears to be broken to the extent, that multios hangs
and CPU load goes high. Just to warn you :-)

P.P.S. I compiled in the Peter's icon. Wow! At least, now I really see where
is my Zsh shortcut :-)) Probably, we could post the question to zsh-users or
even c.u.s. But icon is pretty usable as is already!


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

Index: configure.in
===================================================================
RCS file: /cvsroot/zsh/zsh/configure.in,v
retrieving revision 1.24
diff -u -r1.24 configure.in
--- configure.in	2000/08/14 16:46:18	1.24
+++ configure.in	2000/08/14 16:58:01
@@ -1431,6 +1431,10 @@
 dnl dynamic loading
 dnl ---------------
 L=N
+LINKMODS=NOLINKMODS
+MOD_EXPORT=
+MOD_IMPORT_VARIABLE=
+MOD_IMPORT_FUNCTION=
 aixdynamic=no
 hpuxdynamic=no
 if test "$ac_cv_func_dlopen"  != yes ||
@@ -1477,6 +1481,7 @@
 elif test "x$ac_cv_cygwin" = xyes; then
   DL_EXT="${DL_EXT=dll}"
   DLLD="${DLLD=dllwrap}"
+  DLLDFLAGS="${DLLDFLAGS=--export-all-symbols}"
   zsh_cv_func_dlsym_needs_underscore=no
   DLLDFLAGS=${DLLDFLAGS=}
   EXTRA_LDFLAGS=${EXTRA_LDFLAGS=}
@@ -1486,6 +1491,10 @@
   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}"
+  LINKMODS=LINKMODS
+  MOD_EXPORT="__attribute__((__dllexport__))"
+  MOD_IMPORT_VARIABLE="__attribute__((__dllimport__))"
+  MOD_IMPORT_FUNCTION=
 elif test "x$dynamic" = xyes; then
   AC_CACHE_CHECK(if your system use ELF binaries,
    zsh_cv_sys_elf,
@@ -1694,7 +1703,10 @@
 AC_SUBST(EXPOPT)dnl
 AC_SUBST(IMPOPT)dnl
 AC_SUBST(L)dnl
-AC_SUBST(RTLD_GLOBAL_OK)dnl
+AC_SUBST(LINKMODS)dnl
+AC_SUBST(MOD_EXPORT)dnl
+AC_SUBST(MOD_IMPORT_VARIABLE)dnl
+AC_SUBST(MOD_IMPORT_FUNCTION)dnl
 
 CLEAN_MK="${srcdir}/Config/clean.mk"
 CONFIG_MK="${srcdir}/Config/config.mk"
Index: Src/mkmakemod.sh
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/mkmakemod.sh,v
retrieving revision 1.3
diff -u -r1.3 mkmakemod.sh
--- Src/mkmakemod.sh	2000/08/07 17:17:05	1.3
+++ Src/mkmakemod.sh	2000/08/14 16:58:02
@@ -73,15 +73,6 @@
     s,\(.\)/$,\1,
 '
 
-CYGWIN=no
-if uname -s > /dev/null 2>&1; then
-    case `uname -s` in
-	CYGWIN* )
-	    CYGWIN=yes
-	;;
-    esac
-fi
-
 # decide which stages to process
 first_stage=true
 second_stage=true
@@ -202,7 +193,6 @@
 	exportdeps=
 	imports=
 	q_moddeps=
-	dllname=
 	for dep in $moddeps; do
 	    q_dep=`echo $dep | sed 's,Q,Qq,g;s,_,Qu,g;s,/,Qs,g'`
 	    q_moddeps="$q_moddeps $q_dep"
@@ -222,9 +212,6 @@
 			zsh/main )
 			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
 			;;
-			zsh/$mddname )
-			    mdll=
-			;;
 			* )
 			    mdll="${depbase}.\$(DL_EXT) "
 			;;
@@ -245,9 +232,6 @@
 			zsh/main )
 			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
 			;;
-			zsh/$mddname )
-			    mdll=
-			;;
 			* )
 			    mdll="\$(dir_top)/$loc/${depbase}.\$(DL_EXT) "
 			;;
@@ -272,9 +256,6 @@
 			zsh/main )
 			    mdll="\$(dir_top)/Src/libzsh-\$(VERSION).\$(DL_EXT) "
 			;;
-			zsh/$mddname )
-			    mdll=
-			;;
 			* )
 			    mdll="\$(dir_top)/$loc/${depbase}.\$(DL_EXT) "
 			;;
@@ -288,20 +269,15 @@
 	    modhdeps="$modhdeps $mdh"
 	    exportdeps="$exportdeps $export"
 	    imports="$imports \$(IMPOPT)$export"
-	    if test $CYGWIN = yes -a -n "$mdll"; then
-		case "$mododeps" in
-		    *" $mdll "* )
-			:
-		    ;;
-		    * )
-			mododeps="$mododeps $mdll"
-		    ;;
-		esac
-	    fi
+	    case "$mododeps " in
+		*" $mdll "* )
+		    :
+		;;
+		* )
+		    mododeps="$mododeps $mdll"
+		;;
+	    esac
 	done
-	if test $CYGWIN = yes; then
-		dllname="--dllname $q_name"
-	fi
 
 	echo "##### ===== DEPENDENCIES GENERATED FROM ${mddname}.mdd ===== #####"
 	echo
@@ -312,8 +288,8 @@
 	echo "INCS_${mddname} = \$(EPRO_${mddname}) $otherincs"
 	echo "EXPIMP_${mddname} = $imports \$(EXPOPT)$mddname.export"
 	echo "NXPIMP_${mddname} ="
-	echo "DEPMODS_${mddname} = $mododeps"
-	echo "DLLNAME_${mddname} = $dllname"
+	echo "LINKMODS_${mddname} = $mododeps"
+	echo "NOLINKMODS_${mddname} = "
 	echo
 	echo "proto.${mddname}: \$(EPRO_${mddname})"
 	echo "\$(SYMS_${mddname}): \$(PROTODEPS)"
@@ -338,9 +314,9 @@
 	    echo "uninstall.modules.${mddname}:"
 	    echo "	rm -f \$(DESTDIR)\$(MODDIR)/${name}.\$(DL_EXT)"
 	    echo
-	    echo "${mddname}.\$(DL_EXT): \$(MODDOBJS_${mddname}) ${mddname}.export $exportdeps \$(DEPMODS_${mddname})"
+	    echo "${mddname}.\$(DL_EXT): \$(MODDOBJS_${mddname}) ${mddname}.export $exportdeps \$(@LINKMODS@_${mddname})"
 	    echo '	rm -f $@'
-	    echo "	\$(DLLINK) \$(@E@XPIMP_$mddname) \$(@E@NTRYOPT) \$(DLLNAME_${mddname}) \$(MODDOBJS_${mddname}) \$(DEPMODS_${mddname}) \$(LIBS) "
+	    echo "	\$(DLLINK) \$(@E@XPIMP_$mddname) \$(@E@NTRYOPT) \$(MODDOBJS_${mddname}) \$(@LINKMODS@_${mddname}) \$(LIBS) "
 	    echo
 	fi
 	echo "${mddname}.mdhi: ${mddname}.mdhs \$(INCS_${mddname})"
@@ -368,30 +344,16 @@
 	echo "	    echo '#define have_${q_name}_module'; \\"
 	echo "	    echo; \\"
 	echo "	    echo '# ifndef IMPORTING_MODULE_${q_name}'; \\"
-	if test $CYGWIN = yes; then
-	    echo "	    echo '#  ifdef MODULE'; \\"
-	    echo "	    echo '#   define boot_ __attribute__((__dllexport__)) boot_${q_name}'; \\"
-	    echo "	    echo '#   define cleanup_ __attribute__((__dllexport__)) cleanup_${q_name}'; \\"
-	    echo "	    echo '#   define setup_ __attribute__((__dllexport__)) setup_${q_name}'; \\"
-	    echo "	    echo '#   define finish_ __attribute__((__dllexport__)) finish_${q_name}'; \\"
-	    echo "	    echo '#  else /* MODULE */'; \\"
-	    echo "	    echo '#   define boot_ boot_${q_name}'; \\"
-	    echo "	    echo '#   define cleanup_ cleanup_${q_name}'; \\"
-	    echo "	    echo '#   define setup_ setup_${q_name}'; \\"
-	    echo "	    echo '#   define finish_ finish_${q_name}'; \\"
-	    echo "	    echo '#  endif /* MODULE */'; \\"
-	else
-	    echo "	    if test @SHORTBOOTNAMES@ = yes; then \\"
-	    echo "		echo '#  ifndef MODULE'; \\"
-	    echo "	    fi; \\"
-	    echo "	    echo '#   define boot_ boot_${q_name}'; \\"
-	    echo "	    echo '#   define cleanup_ cleanup_${q_name}'; \\"
-	    echo "	    echo '#   define setup_ setup_${q_name}'; \\"
-	    echo "	    echo '#   define finish_ finish_${q_name}'; \\"
-	    echo "	    if test @SHORTBOOTNAMES@ = yes; then \\"
-	    echo "		echo '#  endif /* !MODULE */'; \\"
-	    echo "	    fi; \\"
-	fi
+	echo "	    if test @SHORTBOOTNAMES@ = yes; then \\"
+	echo "		echo '#  ifndef MODULE'; \\"
+	echo "	    fi; \\"
+	echo "	    echo '#   define boot_ boot_${q_name}'; \\"
+	echo "	    echo '#   define cleanup_ cleanup_${q_name}'; \\"
+	echo "	    echo '#   define setup_ setup_${q_name}'; \\"
+	echo "	    echo '#   define finish_ finish_${q_name}'; \\"
+	echo "	    if test @SHORTBOOTNAMES@ = yes; then \\"
+	echo "		echo '#  endif /* !MODULE */'; \\"
+	echo "	    fi; \\"
 	echo "	    echo '# endif /* !IMPORTING_MODULE_${q_name} */'; \\"
 	echo "	    echo; \\"
 	if test -n "$moddeps"; then (
@@ -416,26 +378,25 @@
 	    echo "	    echo; \\"
 	fi
 	if test -n "$proto"; then
-	    if test "$CYGWIN" = yes; then
-		echo "	    echo '# ifndef IMPORTING_MODULE_${q_name} '; \\"
-		echo "	    echo '#  undef mod_import_variable'; \\"
-		echo "	    echo '#  define mod_import_variable'; \\"
-		echo "	    echo '# endif /* IMPORTING_MODULE_${q_name} */'; \\"
-	    fi
+	    echo "	    echo '# undef mod_import_variable'; \\"
+	    echo "	    echo '# undef mod_import_function'; \\"
+	    echo "	    echo '# if defined(IMPORTING_MODULE_${q_name}) &&  defined(MODULE)'; \\"
+	    echo "	    echo '#  define mod_import_variable @MOD_IMPORT_VARIABLE@'; \\"
+	    echo "	    echo '#  define mod_import_function @MOD_IMPORT_FUNCTION@'; \\"
+	    echo "	    echo '# else'; \\"
+	    echo "	    echo '#  define mod_import_function'; \\"
+	    echo "	    echo '#  define mod_import_variable'; \\"
+	    echo "	    echo '# endif /* IMPORTING_MODULE_${q_name} && MODULE */'; \\"
 	    echo "	    for epro in \$(EPRO_${mddname}); do \\"
 	    echo "		echo '# include \"'\$\$epro'\"'; \\"
 	    echo "	    done; \\"
-	    if test "$CYGWIN" = yes; then
-		echo "	    echo '# ifndef IMPORTING_MODULE_${q_name} '; \\"
-		echo "      echo '#  ifdef MODULE'; \\"
-		echo "	    echo '#   undef mod_import_variable'; \\"
-		echo "	    echo '#   define mod_import_variable __attribute__((__dllimport__))'; \\"
-		echo "      echo '#  else /* MODULE */'; \\"
-		echo "      echo '#   undef mod_import_variable'; \\"
-		echo "      echo '#   define mod_import_variable'; \\"
-		echo "      echo '#  endif /* MODULE */'; \\"
-		echo "	    echo '# endif /* IMPORTING_MODULE_${q_name} */'; \\"
-	    fi
+	    echo "	    echo '# undef mod_import_variable'; \\"
+	    echo "	    echo '# define mod_import_variable'; \\"
+	    echo "	    echo '# undef mod_import_variable'; \\"
+	    echo "	    echo '# define mod_import_variable'; \\"
+	    echo "	    echo '# ifndef mod_export'; \\"
+	    echo "	    echo '#  define mod_export @MOD_EXPORT@'; \\"
+	    echo "	    echo '# endif /* mod_export */'; \\"
 	    echo "	    echo; \\"
 	fi
 	echo "	    echo '#endif /* !have_${q_name}_module */'; \\"
@@ -472,17 +433,15 @@
 	    echo "	false # should only happen with make -n"
 	    echo
 	fi
-	if test "$CYGWIN" = yes; then
-	    for mdll in $remote_modules; do
-		echo "$mdll: FORCE"
-		echo "	@cd @%@ && \$(MAKE) \$(MAKEDEFS) @%@$mdll"
-		echo
-	    done | sed 's,^\(.*\)@%@\(.*\)@%@\(.*\)/\([^/]*\)$,\1\3\2\4,'
-	    if test -n "$other_modules"; then
-		echo "${other_modules}:" | sed 's,^ ,,'
-		echo "	false # should only happen with make -n"
-		echo
-	    fi
+	for mdll in $remote_modules; do
+	    echo "$mdll: FORCE"
+	    echo "	@cd @%@ && \$(MAKE) \$(MAKEDEFS) @%@$mdll"
+	    echo
+	done | sed 's,^\(.*\)@%@\(.*\)@%@\(.*\)/\([^/]*\)$,\1\3\2\4,'
+	if test -n "$other_modules"; then
+	    echo "${other_modules}:" | sed 's,^ ,,'
+	    echo "	false # should only happen with make -n"
+	    echo
 	fi
     fi
 
Index: Src/zsh.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v
retrieving revision 1.21
diff -u -r1.21 zsh.h
--- Src/zsh.h	2000/08/10 16:19:12	1.21
+++ Src/zsh.h	2000/08/14 16:58:08
@@ -1681,20 +1681,6 @@
 typedef unsigned char * (*ZleReadFn) _((char *, char *, int));
 
 /***************************************/
-/* Pseudo-keyword to mark exportedness */
-/***************************************/
-
-#if defined(__CYGWIN__) && defined(MODULE)
-#define mod_export __attribute__((__dllexport__))
-#define mod_import_variable __attribute__((__dllimport__))
-#define mod_import_function
-#else
-#define mod_export
-#define mod_import_variable
-#define mod_import_function
-#endif
-
-/***************************************/
 /* Hooks in core.                      */
 /***************************************/
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: Cygwin - second go.
  2000-08-14 17:54 PATCH: Cygwin - second go Andrej Borsenkow
@ 2000-08-15  5:08 ` Bart Schaefer
  2000-08-15  6:15   ` Andrej Borsenkow
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2000-08-15  5:08 UTC (permalink / raw)
  To: Andrej Borsenkow, ZSH workers mailing list

On Aug 14,  9:54pm, Andrej Borsenkow wrote:
} Subject: PATCH: Cygwin - second go.
}
} This patch hopefully makes both dynamic and static compilation under Cygwin
} possible again (at least, I tried both under Unix and under Cygwin).

Seems to compile OK on linux, I'll commit the patch.

I just noticed, however that under autoconf 2.13 the definion of AC_CYGWIN
doesn't work right if you follow it with a `dnl' directive.  It ends up
merging with the expansion of AC_EXEEXT that follows it, so a configure
script generated from autoconf 2.13 won't ever set CYGWIN=yes properly.

The solution is either to remove the `dnl' comment from the line with
the AC_CYGWIN call, or simply to put a blank line after it, which is
what I did.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: PATCH: Cygwin - second go.
  2000-08-15  5:08 ` Bart Schaefer
@ 2000-08-15  6:15   ` Andrej Borsenkow
  2000-08-15 10:48     ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 2000-08-15  6:15 UTC (permalink / raw)
  To: Bart Schaefer, ZSH workers mailing list


>
> Seems to compile OK on linux, I'll commit the patch.
>
> I just noticed, however that under autoconf 2.13 the definion of AC_CYGWIN
> doesn't work right if you follow it with a `dnl' directive.  It ends up
> merging with the expansion of AC_EXEEXT that follows it, so a configure
> script generated from autoconf 2.13 won't ever set CYGWIN=yes properly.
>
> The solution is either to remove the `dnl' comment from the line with
> the AC_CYGWIN call, or simply to put a blank line after it, which is
> what I did.
>


Yes, I knew it; that why I used ac_cv_cygwin and not CYGWIN.

Are you sure, it is a problem of missing empty line? Look, what is generated:

CYGWIN=
test "$ac_cv_cygwin" = yes && CYGWIN=yes                   echo $ac_n
"checking for mingw32 environment""... $ac_c" 1>&6

that is, CYGWIN is set in environment of `echo' command and lost after this.
This expansion is part of AC_CYGWIN and has nothing to do with AC_EXEEXT.
There is no way to change it. I even believe to have seen a bug report once,
but currently querying autoconf bug database yields no result.

-andrej


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: PATCH: Cygwin - second go.
  2000-08-15  6:15   ` Andrej Borsenkow
@ 2000-08-15 10:48     ` Bart Schaefer
  0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2000-08-15 10:48 UTC (permalink / raw)
  To: Andrej Borsenkow, ZSH workers mailing list

On Aug 15, 10:15am, Andrej Borsenkow wrote:
} Subject: RE: PATCH: Cygwin - second go.
}
} > I just noticed, however that under autoconf 2.13 the definion of AC_CYGWIN
} > doesn't work right if you follow it with a `dnl' directive.  It ends up
} > merging with the expansion of AC_EXEEXT that follows it, so a configure
} > script generated from autoconf 2.13 won't ever set CYGWIN=yes properly.
} >
} > The solution is either to remove the `dnl' comment from the line with
} > the AC_CYGWIN call, or simply to put a blank line after it, which is
} > what I did.
} 
} Are you sure, it is a problem of missing empty line?

Yes.

} Look, what is generated:
} 
} CYGWIN=
} test "$ac_cv_cygwin" = yes && CYGWIN=yes                   echo $ac_n
} "checking for mingw32 environment""... $ac_c" 1>&6
} 
} that is, CYGWIN is set in environment of `echo' command and lost after this.

Right.

} This expansion is part of AC_CYGWIN and has nothing to do with AC_EXEEXT.

Wrong.  In /usr/lib/autoconf/acspecific.m4 we have:

AC_DEFUN(AC_EXEEXT,
[AC_REQUIRE([AC_CYGWIN])
AC_REQUIRE([AC_MINGW32])
AC_MSG_CHECKING([for executable suffix])
....

The `test "$ac_cv_cygwin" = yes && CYGWIN=yes' comes from AC_CYGWIN and
the `echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6' is
from AC_MINGW32.  The problem is that if you *explicitly* use AC_CYGWIN,
then the first AC_REQUIRE in AC_EXEEXT doesn't expand and the beginning
of AC_MINGW32 gets pasted onto the end of the explicit AC_CYGWIN output.

So maybe the bug you're thinking of is that AC_EXEEXT gets it wrong if
you *don't* explicitly use AC_CYGWIN followed by a blank line; I didn't
try that, but I *did* check the output the way I committed the patch.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-08-15 10:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-14 17:54 PATCH: Cygwin - second go Andrej Borsenkow
2000-08-15  5:08 ` Bart Schaefer
2000-08-15  6:15   ` Andrej Borsenkow
2000-08-15 10:48     ` Bart Schaefer

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).