Hi, I have a patch getting shared LessTif lib to work, but also getting some warnings in some apps. I compiled Xpdf with that shared lib, now Xpdf works fine, but when quit, Xpdf throws:
Warning: XtRemoveGrab asked to remove a widget not on the list fortunately, no segmentation fault. Sounds like shared Xt, lesstif work in OS/2, so there is good OS/2 stuff in xc, lesstif source code, I think cygwin people can learn from that also. Hope useful. Regards, Zhangrong Huang
diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/aclocal.m4 lesstif-0.93.91/aclocal.m4 --- lesstif-0.93.91-orig/aclocal.m4 2003-09-16 03:35:14.000000000 +0800 +++ lesstif-0.93.91/aclocal.m4 2003-10-24 16:03:20.000000000 +0800 @@ -5356,7 +5356,7 @@ ;; esac AC_SUBST(confdir) -CONFDIR='${confdir}' +CONFDIR="${confdir}" AC_DEFINE_UNQUOTED(CONFDIR, "$CONFDIR") AC_SUBST(CONFDIR) diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/clients/Motif-1.2/mwm/mwm.c lesstif-0.93.91/clients/Motif-1.2/mwm/mwm.c --- lesstif-0.93.91-orig/clients/Motif-1.2/mwm/mwm.c 2002-03-30 22:48:06.000000000 +0800 +++ lesstif-0.93.91/clients/Motif-1.2/mwm/mwm.c 2003-10-24 15:00:14.000000000 +0800 @@ -466,6 +466,18 @@ # endif # endif #endif + +#ifdef __CYGWIN__ + /* + * Ugly hack because sys/types.h defines FD_SETSIZE as 64, + * when the comments there say it should be >= NOFILE in param.h, + * which happens to be 8192. + * + * This drops fd_width to 64 to match FD_SETSIZE; + */ + if (fd_width > FD_SETSIZE) fd_width = FD_SETSIZE; +#endif + x_fd = XConnectionNumber(dpy); /* diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/configure lesstif-0.93.91/configure --- lesstif-0.93.91-orig/configure 2003-09-16 03:35:16.000000000 +0800 +++ lesstif-0.93.91/configure 2003-10-24 15:52:28.000000000 +0800 @@ -15275,7 +15275,7 @@ ;; esac -CONFDIR='${confdir}' +CONFDIR="${confdir}" cat >>confdefs.h <<_ACEOF #define CONFDIR "$CONFDIR" _ACEOF diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Dt/Makefile.am lesstif-0.93.91/lib/Dt/Makefile.am --- lesstif-0.93.91-orig/lib/Dt/Makefile.am 2003-03-29 20:25:36.000000000 +0800 +++ lesstif-0.93.91/lib/Dt/Makefile.am 2003-10-24 20:02:52.000000000 +0800 @@ -4,14 +4,14 @@ MAINTAINERCLEANFILES=Makefile.in -libDtPrint_la_LDFLAGS= -version-info 1:0 +libDtPrint_la_LDFLAGS= -version-info 1:0 -no-undefined libdir = $(exec_prefix)/lib if BuildLibDtPrint lib_LTLIBRARIES= libDtPrint.la -libDtPrint_la_LIBADD = ../../lib/Xm-2.1/libXm.la +libDtPrint_la_LIBADD = ../../lib/Xm-2.1/libXm.la @X_LIBS@ -lXt $(X_PRE_LIBS) $(XPLIB) -lX11 $(X_EXTRA_LIBS) # libDtPrint_la_LIBADD = @X_LIBS@ -lXt $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS) diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Dt/Makefile.in lesstif-0.93.91/lib/Dt/Makefile.in --- lesstif-0.93.91-orig/lib/Dt/Makefile.in 2003-09-16 03:35:26.000000000 +0800 +++ lesstif-0.93.91/lib/Dt/Makefile.in 2003-10-24 20:02:44.000000000 +0800 @@ -150,11 +150,11 @@ MAINTAINERCLEANFILES = Makefile.in -libDtPrint_la_LDFLAGS = -version-info 1:0 +libDtPrint_la_LDFLAGS = -version-info 1:0 -no-undefined @[EMAIL PROTECTED] = libDtPrint.la [EMAIL PROTECTED]@libDtPrint_la_LIBADD = ../../lib/Xm-2.1/libXm.la [EMAIL PROTECTED]@libDtPrint_la_LIBADD = ../../lib/Xm-2.1/libXm.la @X_LIBS@ -lXt $(X_PRE_LIBS) $(XPLIB) -lX11 $(X_EXTRA_LIBS) # libDtPrint_la_LIBADD = @X_LIBS@ -lXt $(X_PRE_LIBS) -lX11 $(X_EXTRA_LIBS) diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Mrm/Makefile.am lesstif-0.93.91/lib/Mrm/Makefile.am --- lesstif-0.93.91-orig/lib/Mrm/Makefile.am 2001-09-06 21:42:58.000000000 +0800 +++ lesstif-0.93.91/lib/Mrm/Makefile.am 2003-10-24 16:24:44.000000000 +0800 @@ -3,7 +3,7 @@ # MAINTAINERCLEANFILES=Makefile.in -libMrm_la_LDFLAGS= -version-info 1:2 +libMrm_la_LDFLAGS= -version-info 1:2 -no-undefined libdir = $(exec_prefix)/lib libMrm_la_SOURCES= Mrm.c lookup.c misc.c \ diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Mrm/Makefile.in lesstif-0.93.91/lib/Mrm/Makefile.in --- lesstif-0.93.91-orig/lib/Mrm/Makefile.in 2003-09-16 03:35:26.000000000 +0800 +++ lesstif-0.93.91/lib/Mrm/Makefile.in 2003-10-24 15:04:00.000000000 +0800 @@ -149,7 +149,7 @@ # MAINTAINERCLEANFILES = Makefile.in -libMrm_la_LDFLAGS = -version-info 1:2 +libMrm_la_LDFLAGS = -version-info 1:2 -no-undefined libMrm_la_SOURCES = Mrm.c lookup.c misc.c \ Mrm.h lookup.h misc.h uil.h diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Mrm-2.0/Makefile.am lesstif-0.93.91/lib/Mrm-2.0/Makefile.am --- lesstif-0.93.91-orig/lib/Mrm-2.0/Makefile.am 2001-09-06 21:42:58.000000000 +0800 +++ lesstif-0.93.91/lib/Mrm-2.0/Makefile.am 2003-10-24 16:25:02.000000000 +0800 @@ -3,7 +3,7 @@ # MAINTAINERCLEANFILES=Makefile.in -libMrm_la_LDFLAGS= -version-info 2:0 +libMrm_la_LDFLAGS= -version-info 2:0 -no-undefined libdir = $(exec_prefix)/lib # diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Mrm-2.0/Makefile.in lesstif-0.93.91/lib/Mrm-2.0/Makefile.in --- lesstif-0.93.91-orig/lib/Mrm-2.0/Makefile.in 2003-09-16 03:35:26.000000000 +0800 +++ lesstif-0.93.91/lib/Mrm-2.0/Makefile.in 2003-10-24 15:03:38.000000000 +0800 @@ -149,7 +149,7 @@ # MAINTAINERCLEANFILES = Makefile.in -libMrm_la_LDFLAGS = -version-info 2:0 +libMrm_la_LDFLAGS = -version-info 2:0 -no-undefined # # Sources in this directory diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Mrm-2.1/Makefile.am lesstif-0.93.91/lib/Mrm-2.1/Makefile.am --- lesstif-0.93.91-orig/lib/Mrm-2.1/Makefile.am 2001-09-06 21:42:58.000000000 +0800 +++ lesstif-0.93.91/lib/Mrm-2.1/Makefile.am 2003-10-24 19:43:56.000000000 +0800 @@ -3,7 +3,7 @@ # MAINTAINERCLEANFILES=Makefile.in -libMrm_la_LDFLAGS= -version-info 2:1 +libMrm_la_LDFLAGS= -version-info 2:1 -no-undefined libdir = $(exec_prefix)/lib # @@ -45,7 +45,7 @@ lib_LTLIBRARIES= libMrm.la -libMrm_la_LIBADD = ../Xm-2.1/libXm.la +libMrm_la_LIBADD = ../Xm-2.1/libXm.la $(X_LIBS) -lXt -lX11 libMrm_la_SOURCES= $(SRCS_1_2:%=../Mrm/%) $(SRCS_2_0:%=../Mrm-2.0/%) $(SRCS_2_1) diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Mrm-2.1/Makefile.in lesstif-0.93.91/lib/Mrm-2.1/Makefile.in --- lesstif-0.93.91-orig/lib/Mrm-2.1/Makefile.in 2003-09-16 03:35:26.000000000 +0800 +++ lesstif-0.93.91/lib/Mrm-2.1/Makefile.in 2003-10-24 19:42:10.000000000 +0800 @@ -149,7 +149,7 @@ # MAINTAINERCLEANFILES = Makefile.in -libMrm_la_LDFLAGS = -version-info 2:1 +libMrm_la_LDFLAGS = -version-info 2:1 -no-undefined # # Sources in this directory @@ -189,7 +189,7 @@ @[EMAIL PROTECTED] = libMrm.la [EMAIL PROTECTED]@libMrm_la_LIBADD = ../Xm-2.1/libXm.la [EMAIL PROTECTED]@libMrm_la_LIBADD = ../Xm-2.1/libXm.la $(X_LIBS) -lXt -lX11 @[EMAIL PROTECTED] = $(SRCS_1_2:%=../Mrm/%) $(SRCS_2_0:%=../Mrm-2.0/%) $(SRCS_2_1) subdir = lib/Mrm-2.1 diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Uil/Makefile.am lesstif-0.93.91/lib/Uil/Makefile.am --- lesstif-0.93.91-orig/lib/Uil/Makefile.am 2001-09-06 21:42:58.000000000 +0800 +++ lesstif-0.93.91/lib/Uil/Makefile.am 2003-10-24 16:24:50.000000000 +0800 @@ -3,7 +3,7 @@ # MAINTAINERCLEANFILES=Makefile.in -libUil_la_LDFLAGS= -version-info 1:2 +libUil_la_LDFLAGS= -version-info 1:2 -no-undefined libdir = $(exec_prefix)/lib libUil_la_SOURCES= Uil.c UilData.c uillex.c uilparse.c uilsym.c diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Uil/Makefile.in lesstif-0.93.91/lib/Uil/Makefile.in --- lesstif-0.93.91-orig/lib/Uil/Makefile.in 2003-09-16 03:35:28.000000000 +0800 +++ lesstif-0.93.91/lib/Uil/Makefile.in 2003-10-24 15:03:52.000000000 +0800 @@ -149,7 +149,7 @@ # MAINTAINERCLEANFILES = Makefile.in -libUil_la_LDFLAGS = -version-info 1:2 +libUil_la_LDFLAGS = -version-info 1:2 -no-undefined libUil_la_SOURCES = Uil.c UilData.c uillex.c uilparse.c uilsym.c diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Uil-2.0/Makefile.am lesstif-0.93.91/lib/Uil-2.0/Makefile.am --- lesstif-0.93.91-orig/lib/Uil-2.0/Makefile.am 2001-09-06 21:42:58.000000000 +0800 +++ lesstif-0.93.91/lib/Uil-2.0/Makefile.am 2003-10-24 19:55:54.000000000 +0800 @@ -3,7 +3,7 @@ # MAINTAINERCLEANFILES=Makefile.in -libUil_la_LDFLAGS= -version-info 2:0 +libUil_la_LDFLAGS= -version-info 2:0 -no-undefined libdir = $(exec_prefix)/lib # diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Uil-2.0/Makefile.in lesstif-0.93.91/lib/Uil-2.0/Makefile.in --- lesstif-0.93.91-orig/lib/Uil-2.0/Makefile.in 2003-09-16 03:35:26.000000000 +0800 +++ lesstif-0.93.91/lib/Uil-2.0/Makefile.in 2003-10-24 19:57:10.000000000 +0800 @@ -149,7 +149,7 @@ # MAINTAINERCLEANFILES = Makefile.in -libUil_la_LDFLAGS = -version-info 2:0 +libUil_la_LDFLAGS = -version-info 2:0 -no-undefined # # Sources in this directory diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Uil-2.1/Makefile.am lesstif-0.93.91/lib/Uil-2.1/Makefile.am --- lesstif-0.93.91-orig/lib/Uil-2.1/Makefile.am 2001-09-06 21:42:58.000000000 +0800 +++ lesstif-0.93.91/lib/Uil-2.1/Makefile.am 2003-10-24 19:54:30.000000000 +0800 @@ -4,7 +4,7 @@ MAINTAINERCLEANFILES=Makefile.in -libUil_la_LDFLAGS= -version-info 2:1 +libUil_la_LDFLAGS= -version-info 2:1 -no-undefined libdir = $(exec_prefix)/lib # @@ -43,7 +43,7 @@ lib_LTLIBRARIES= libUil.la -#libUil_la_LIBADD = $(X_LIBS) -lXt +libUil_la_LIBADD = ../Xm-2.1/libXm.la $(X_LIBS) -lXt libUil_la_SOURCES= ${SRCS_1_2:%=../Uil/%} ${SRCS_2_0:%=../Uil-2.0/%} ${SRCS_2_1} diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Uil-2.1/Makefile.in lesstif-0.93.91/lib/Uil-2.1/Makefile.in --- lesstif-0.93.91-orig/lib/Uil-2.1/Makefile.in 2003-09-16 03:35:28.000000000 +0800 +++ lesstif-0.93.91/lib/Uil-2.1/Makefile.in 2003-10-24 19:54:24.000000000 +0800 @@ -150,7 +150,7 @@ MAINTAINERCLEANFILES = Makefile.in -libUil_la_LDFLAGS = -version-info 2:1 +libUil_la_LDFLAGS = -version-info 2:1 -no-undefined # # Sources in this directory @@ -187,7 +187,7 @@ @[EMAIL PROTECTED] = libUil.la -#libUil_la_LIBADD = $(X_LIBS) -lXt +libUil_la_LIBADD = ../Xm-2.1/libXm.la $(X_LIBS) -lXt @[EMAIL PROTECTED] = ${SRCS_1_2:%=../Uil/%} ${SRCS_2_0:%=../Uil-2.0/%} ${SRCS_2_1} subdir = lib/Uil-2.1 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -195,7 +195,6 @@ CONFIG_CLEAN_FILES = LTLIBRARIES = $(lib_LTLIBRARIES) -libUil_la_LIBADD = @[EMAIL PROTECTED] = Uil.lo UilData.lo uillex.lo \ @Version_2_1_TRUE@ uilparse.lo uilsym.lo @[EMAIL PROTECTED] = diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Xm/FontList.c lesstif-0.93.91/lib/Xm/FontList.c --- lesstif-0.93.91-orig/lib/Xm/FontList.c 2002-11-23 02:37:24.000000000 +0800 +++ lesstif-0.93.91/lib/Xm/FontList.c 2003-10-24 15:00:34.000000000 +0800 @@ -27,7 +27,7 @@ #include <LTconfig.h> #include <string.h> -#include <locale.h> +#include <X11/Xlocale.h> /* not #include <locale.h> */ #include <XmI/XmI.h> #include <Xm/XmP.h> #include <XmI/DebugUtil.h> diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Xm/Makefile.am lesstif-0.93.91/lib/Xm/Makefile.am --- lesstif-0.93.91-orig/lib/Xm/Makefile.am 2001-08-30 00:06:48.000000000 +0800 +++ lesstif-0.93.91/lib/Xm/Makefile.am 2003-10-24 16:24:34.000000000 +0800 @@ -29,7 +29,7 @@ XDND_SRCS = xdnd.c endif -libXm_la_LDFLAGS= -version-info 1:2 +libXm_la_LDFLAGS= -version-info 1:2 -no-undefined libdir = $(exec_prefix)/lib if Version_1_2 diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Xm/Makefile.in lesstif-0.93.91/lib/Xm/Makefile.in --- lesstif-0.93.91-orig/lib/Xm/Makefile.in 2003-09-16 03:35:28.000000000 +0800 +++ lesstif-0.93.91/lib/Xm/Makefile.in 2003-10-24 15:02:50.000000000 +0800 @@ -174,7 +174,7 @@ @[EMAIL PROTECTED] = xdnd.c -libXm_la_LDFLAGS = -version-info 1:2 +libXm_la_LDFLAGS = -version-info 1:2 -no-undefined #libXm_la_LIBADD = $(X_LIBS) -lXt $(X_PRE_LIBS) -lX11 \ diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Xm/Vendor.c lesstif-0.93.91/lib/Xm/Vendor.c --- lesstif-0.93.91-orig/lib/Xm/Vendor.c 2003-08-13 00:33:20.000000000 +0800 +++ lesstif-0.93.91/lib/Xm/Vendor.c 2003-10-25 17:08:24.000000000 +0800 @@ -72,10 +72,15 @@ #include <XmI/DebugUtil.h> -#ifdef __EMX__ +#if defined(__EMX__) || defined(__CYGWIN__) extern void _LtXmFixupVendorShell(void); +#ifdef __EMX__ unsigned long _DLL_InitTerm(unsigned long mod_handle, unsigned long flag); #endif +#ifdef __CYGWIN__ +int __stdcall DllMain(unsigned long mod_handle, unsigned long flag, void *routine); +#endif +#endif /* We use a 'private', i.e. non-declared, but actually exported call from the original Intrinsic sources (lib/Xt/Callback.c) here. @@ -3572,17 +3577,17 @@ /* - This corrects for the (shared) library loading mechanism in OS/2 + This corrects for the (shared) library loading mechanism in OS/2 and Windows which differs from those on many standard Unix systems. The routine should be called before any other function, - actually done by the _DLL_InitTerm-function. + actually done by the _DLL_InitTerm-function in OS/2 and DllMain in Windows. On un*x/ELF systems the problem addressed here seems to be avoided by specifying the libraries in correct, canonical order on the linker command line. amai (20010112): I once decided to make it static, but this was an error: to call it from a static libXm one may need this symbol. */ -#ifdef __EMX__ +#if defined(__EMX__) || defined(__CYGWIN__) extern void _LtXmFixupVendorShell(void) { @@ -3594,6 +3599,7 @@ } +#ifdef __EMX__ unsigned long _DLL_InitTerm(unsigned long mod_handle, unsigned long flag) { @@ -3607,4 +3613,22 @@ return 1; /* success */ } } -#endif /* __EMX__ */ +#endif + +#ifdef __CYGWIN__ +int __stdcall +DllMain(unsigned long mod_handle, unsigned long flag, void *routine) +{ + switch (flag) + { + case 1: /* DLL_PROCESS_ATTACH - process attach */ + _LtXmFixupVendorShell(); + break; + case 0: /* DLL_PROCESS_DETACH - process detach */ + break; + } + return 1; +} +#endif + +#endif /* __EMX__ || __CYGWIN__ */ diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Xm-2.0/Makefile.am lesstif-0.93.91/lib/Xm-2.0/Makefile.am --- lesstif-0.93.91-orig/lib/Xm-2.0/Makefile.am 2001-08-30 00:06:48.000000000 +0800 +++ lesstif-0.93.91/lib/Xm-2.0/Makefile.am 2003-10-24 16:24:56.000000000 +0800 @@ -3,7 +3,7 @@ # MAINTAINERCLEANFILES=Makefile.in -libXm_la_LDFLAGS= -version-info 2:0 +libXm_la_LDFLAGS= -version-info 2:0 -no-undefined libdir = $(exec_prefix)/lib # diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Xm-2.0/Makefile.in lesstif-0.93.91/lib/Xm-2.0/Makefile.in --- lesstif-0.93.91-orig/lib/Xm-2.0/Makefile.in 2003-09-16 03:35:28.000000000 +0800 +++ lesstif-0.93.91/lib/Xm-2.0/Makefile.in 2003-10-24 15:03:44.000000000 +0800 @@ -149,7 +149,7 @@ # MAINTAINERCLEANFILES = Makefile.in -libXm_la_LDFLAGS = -version-info 2:0 +libXm_la_LDFLAGS = -version-info 2:0 -no-undefined # # Sources in this directory diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Xm-2.1/Makefile.am lesstif-0.93.91/lib/Xm-2.1/Makefile.am --- lesstif-0.93.91-orig/lib/Xm-2.1/Makefile.am 2001-08-30 00:06:48.000000000 +0800 +++ lesstif-0.93.91/lib/Xm-2.1/Makefile.am 2003-10-24 16:25:14.000000000 +0800 @@ -4,7 +4,7 @@ MAINTAINERCLEANFILES=Makefile.in libdir = $(exec_prefix)/lib -libXm_la_LDFLAGS= -version-info 2:1 $(X_LIBS) +libXm_la_LDFLAGS= -version-info 2:1 -no-undefined $(X_LIBS) # # Sources in this directory diff -urN -x .build -x .inst -x .sinst lesstif-0.93.91-orig/lib/Xm-2.1/Makefile.in lesstif-0.93.91/lib/Xm-2.1/Makefile.in --- lesstif-0.93.91-orig/lib/Xm-2.1/Makefile.in 2003-09-16 03:35:28.000000000 +0800 +++ lesstif-0.93.91/lib/Xm-2.1/Makefile.in 2003-10-24 15:03:22.000000000 +0800 @@ -149,7 +149,7 @@ # $Header: /cvsroot/lesstif/lesstif/lib/Xm-2.1/Makefile.am,v 1.23 2001/08/29 16:06:48 dannybackx Exp $ # MAINTAINERCLEANFILES = Makefile.in -libXm_la_LDFLAGS = -version-info 2:1 $(X_LIBS) +libXm_la_LDFLAGS = -version-info 2:1 -no-undefined $(X_LIBS) # # Sources in this directory