diff -Naurp glib-1.2.10/Makefile.in glib-1.2.10-cygwin/Makefile.in --- glib-1.2.10/Makefile.in Thu Mar 15 15:48:50 2001 +++ glib-1.2.10-cygwin/Makefile.in Sat Apr 20 17:30:06 2002 @@ -170,7 +170,7 @@ testgdateparser_DEPENDENCIES = libglib. testgdateparser_LDFLAGS = SCRIPTS = $(bin_SCRIPTS) -CFLAGS = @CFLAGS@ +CFLAGS = @CFLAGS@ $(DLL_CFLAGS) COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -265,6 +265,9 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIE if test -f $$p; then \ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ + dll=$$(echo $$p | sed 's,^lib\(.*\).la$$,cyg\1.dll,'); \ + echo "install -D --mode=755 .libs/$$dll $(DESTDIR)$(bindir)/$$dll"; \ + install -D --mode=755 .libs/$$dll $(DESTDIR)$(bindir)/$$dll; \ else :; fi; \ done @@ -272,6 +275,8 @@ uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) list='$(lib_LTLIBRARIES)'; for p in $$list; do \ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + dll=$$(echo $$p | sed 's,^lib\(.*\).la$$,cyg\1.dll,'); \ + rm -f $(DESTDIR)$(bindir)/$$dll; \ done .c.o: @@ -312,8 +317,10 @@ distclean-libtool: maintainer-clean-libtool: +libglib.la: DLL_CFLAGS = -DGLIB_BUILD_DLL libglib.la: $(libglib_la_OBJECTS) $(libglib_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libglib_la_LDFLAGS) $(libglib_la_OBJECTS) $(libglib_la_LIBADD) $(LIBS) + cd .libs && PREFIX=$(prefix) sh ../mkdll.sh $@ mostlyclean-noinstPROGRAMS: diff -Naurp glib-1.2.10/configure glib-1.2.10-cygwin/configure --- glib-1.2.10/configure Thu Mar 15 15:44:01 2001 +++ glib-1.2.10-cygwin/configure Sat Apr 20 17:30:06 2002 @@ -7,6 +7,9 @@ # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. +# test for cygwin installation +cygwin=$(uname | grep -i cygwin) + # Defaults: ac_help= ac_default_prefix=/usr/local @@ -4750,6 +4753,8 @@ G_THREAD_CFLAGS= mutex_has_default=no case $have_threads in posix) + if test -z $cygwin ; then + # ignore this test on cygwin G_THREAD_LIBS=error echo $ac_n "checking for pthread_attr_init in -lpthread""... $ac_c" 1>&6 echo "configure:4756: checking for pthread_attr_init in -lpthread" >&5 @@ -4789,6 +4794,10 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_l G_THREAD_LIBS="-lpthread" else echo "$ac_t""no" 1>&6 +fi +else + # for cygwin, just set G_THREAD_LIBS to empty string + G_THREAD_LIBS= fi if test "x$G_THREAD_LIBS" = xerror; then diff -Naurp glib-1.2.10/glib.h glib-1.2.10-cygwin/glib.h --- glib-1.2.10/glib.h Tue Feb 27 03:44:38 2001 +++ glib-1.2.10-cygwin/glib.h Sat Apr 20 17:34:42 2002 @@ -659,19 +659,17 @@ typedef gint32 GTime; #define g_htons(val) (GUINT16_TO_BE (val)) -/* Glib version. - * we prefix variable declarations so they can - * properly get exported in windows dlls. + +/* CYGWIN auto-import fix for multiword data exports + * Note: auto-export is assumed (no __declspec(dllexport)) */ -#ifdef NATIVE_WIN32 -# ifdef GLIB_COMPILATION -# define GUTILS_C_VAR __declspec(dllexport) -# else /* !GLIB_COMPILATION */ -# define GUTILS_C_VAR extern __declspec(dllimport) -# endif /* !GLIB_COMPILATION */ -#else /* !NATIVE_WIN32 */ -# define GUTILS_C_VAR extern -#endif /* !NATIVE_WIN32 */ +#undef GLIB_IMPORT +#if (defined(_WIN32) || defined(__CYGWIN__)) && !(defined(GLIB_BUILD_DLL) || defined(GLIB_STATIC)) +#define GLIB_IMPORT __declspec(dllimport) +#else +#define GLIB_IMPORT +#endif +#define GUTILS_C_VAR extern GLIB_IMPORT GUTILS_C_VAR const guint glib_major_version; GUTILS_C_VAR const guint glib_minor_version; @@ -1266,7 +1264,7 @@ void g_on_error_stack_trace (const gchar /* Logging mechanism */ -extern const gchar *g_log_domain_glib; +GUTILS_C_VAR const gchar *g_log_domain_glib; guint g_log_set_handler (const gchar *log_domain, GLogLevelFlags log_levels, GLogFunc log_func, @@ -2818,6 +2816,8 @@ extern void glib_dummy_decl (void); # define G_UNLOCK(name) # define G_TRYLOCK(name) (FALSE) #endif /* !G_THREADS_ENABLED */ + + #ifdef __cplusplus } diff -Naurp glib-1.2.10/gmain.c glib-1.2.10-cygwin/gmain.c --- glib-1.2.10/gmain.c Tue Feb 27 06:00:21 2001 +++ glib-1.2.10-cygwin/gmain.c Sat Apr 20 17:30:06 2002 @@ -165,7 +165,7 @@ static GSourceFuncs idle_funcs = static GPollRec *poll_records = NULL; static GPollRec *poll_free_list = NULL; -static GMemChunk *poll_chunk; +static GMemChunk *poll_chunk = NULL; static guint n_poll_records = 0; #ifdef G_THREADS_ENABLED diff -Naurp glib-1.2.10/gmodule/Makefile.in glib-1.2.10-cygwin/gmodule/Makefile.in --- glib-1.2.10/gmodule/Makefile.in Thu Mar 15 15:48:51 2001 +++ glib-1.2.10-cygwin/gmodule/Makefile.in Sat Apr 20 17:30:06 2002 @@ -148,7 +148,7 @@ PROGRAMS = $(noinst_PROGRAMS) testgmodule_SOURCES = testgmodule.c testgmodule_OBJECTS = testgmodule.o testgmodule_DEPENDENCIES = libgmodule.la $(top_builddir)/libglib.la -CFLAGS = @CFLAGS@ +CFLAGS = @CFLAGS@ $(DLL_CFLAGS) COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -192,6 +192,8 @@ uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) list='$(lib_LTLIBRARIES)'; for p in $$list; do \ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + dll=$$(echo $$p | sed 's,^lib\(.*\).la$$,cyg\1.dll,'); \ + rm -f $(DESTDIR)$(bindir)/$$dll; \ done .c.o: @@ -232,14 +234,18 @@ distclean-libtool: maintainer-clean-libtool: +libgmodule.la: DLL_CFLAGS = -DGMODULE_BUILD_DLL libgmodule.la: $(libgmodule_la_OBJECTS) $(libgmodule_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libgmodule_la_LDFLAGS) $(libgmodule_la_OBJECTS) $(libgmodule_la_LIBADD) $(LIBS) + cd .libs && PREFIX=$(prefix) sh ../../mkdll.sh $@ -L../../.libs -lglib libgplugin_a.la: $(libgplugin_a_la_OBJECTS) $(libgplugin_a_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libgplugin_a_la_LDFLAGS) $(libgplugin_a_la_OBJECTS) $(libgplugin_a_la_LIBADD) $(LIBS) + cd .libs && PREFIX=$(prefix) sh ../../mkdll.sh $@ -L. -lgmodule -L../../.libs -lglib libgplugin_b.la: $(libgplugin_b_la_OBJECTS) $(libgplugin_b_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libgplugin_b_la_LDFLAGS) $(libgplugin_b_la_OBJECTS) $(libgplugin_b_la_LIBADD) $(LIBS) + cd .libs && PREFIX=$(prefix) sh ../../mkdll.sh $@ -L. -lgmodule -L../../.libs -lglib mostlyclean-noinstPROGRAMS: @@ -314,7 +320,7 @@ distdir: $(DISTFILES) fi; \ done gmodule.lo gmodule.o : gmodule.c gmodule.h ../glib.h ../glibconfig.h \ - gmoduleconf.h gmodule-dl.c + gmoduleconf.h gmodule-cygwin.c libgplugin_a.lo libgplugin_a.o : libgplugin_a.c gmodule.h ../glib.h \ ../glibconfig.h libgplugin_b.lo libgplugin_b.o : libgplugin_b.c gmodule.h ../glib.h \ @@ -419,6 +425,9 @@ install-libLTLIBRARIES: libgmodule.la if test -f $$p; then \ echo "$(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p"; \ $(LIBTOOL) --mode=install $(INSTALL_DATA) $$p $(DESTDIR)$(libdir)/$$p; \ + dll=$$(echo $$p | sed 's,^lib\(.*\).la$$,cyg\1.dll,'); \ + echo "install -D --mode=755 .libs/$$dll $(DESTDIR)$(bindir)/$$dll"; \ + install -D --mode=755 .libs/$$dll $(DESTDIR)$(bindir)/$$dll; \ else :; fi; \ done diff -Naurp glib-1.2.10/gmodule/gmodule-cygwin.c glib-1.2.10-cygwin/gmodule/gmodule-cygwin.c --- glib-1.2.10/gmodule/gmodule-cygwin.c Thu Jan 1 00:00:00 1970 +++ glib-1.2.10-cygwin/gmodule/gmodule-cygwin.c Thu May 23 20:30:06 2002 @@ -0,0 +1,271 @@ +/* GMODULE - GLIB wrapper code for dynamic module loading + * Copyright (C) 1998, 2000 Tim Janik + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * Modified by the GLib Team and others 1997-1999. See the AUTHORS + * file for a list of people on the GLib Team. See the ChangeLog + * files for a list of changes. These files are distributed with + * GLib at ftp://ftp.gtk.org/pub/gtk/. + */ + +/* + * MT safe + */ + +#include +#include + +#include + +/* some flags are missing on some systems, so we provide + * harmless defaults. + * The Perl sources say, RTLD_LAZY needs to be defined as (1), + * at least for Solaris 1. + * + * Mandatory: + * RTLD_LAZY - resolve undefined symbols as code from the dynamic library + * is executed. + * RTLD_NOW - resolve all undefined symbols before dlopen returns, and fail + * if this cannot be done. + * Optionally: + * RTLD_GLOBAL - the external symbols defined in the library will be made + * available to subsequently loaded libraries. + */ +#ifndef RTLD_LAZY +#define RTLD_LAZY 1 +#endif /* RTLD_LAZY */ +#ifndef RTLD_NOW +#define RTLD_NOW 0 +#endif /* RTLD_NOW */ +/* some systems (OSF1 V5.0) have broken RTLD_GLOBAL linkage */ +#ifdef G_MODULE_BROKEN_RTLD_GLOBAL +#undef RTLD_GLOBAL +#endif /* G_MODULE_BROKEN_RTLD_GLOBAL */ +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL 0 +#endif /* RTLD_GLOBAL */ + + +/* --- functions --- */ +static gchar* +fetch_dlerror (void) +{ + gchar *msg = dlerror (); + + /* make sure we always return an error message != NULL */ + + return msg ? msg : "unknown dl-error"; +} + +static gpointer +_g_module_open (const gchar *file_name, + gboolean bind_lazy) +{ + gpointer handle; + + handle = dlopen (file_name, RTLD_GLOBAL | (bind_lazy ? RTLD_LAZY : RTLD_NOW)); + if (!handle) + g_module_set_error (fetch_dlerror ()); + + return handle; +} + + +static gint dummy; +static gpointer null_module_handle = &dummy; + +static gpointer +_g_module_self (void) +{ + return null_module_handle; +} + + +static void +_g_module_close (gpointer handle, + gboolean is_unref) +{ + if (handle != null_module_handle) + if (!FreeLibrary (handle)) + g_module_set_error (fetch_dlerror ()); +} + +static gpointer +find_in_any_module_using_toolhelp (const gchar *symbol_name) +{ + typedef HANDLE (WINAPI *PFNCREATETOOLHELP32SNAPSHOT)(DWORD, DWORD); + static PFNCREATETOOLHELP32SNAPSHOT pfnCreateToolhelp32Snapshot = NULL; + + typedef BOOL (WINAPI *PFNMODULE32FIRST)(HANDLE, MODULEENTRY32*); + static PFNMODULE32FIRST pfnModule32First= NULL; + + typedef BOOL (WINAPI *PFNMODULE32NEXT)(HANDLE, MODULEENTRY32*); + static PFNMODULE32NEXT pfnModule32Next = NULL; + + static HMODULE kernel32; + + HANDLE snapshot; + MODULEENTRY32 me32; + + gpointer p; + + if (!pfnCreateToolhelp32Snapshot || !pfnModule32First || !pfnModule32Next) + { + if (!kernel32) + if (!(kernel32 = GetModuleHandle ("kernel32.dll"))) + return NULL; + + if (!(pfnCreateToolhelp32Snapshot = (PFNCREATETOOLHELP32SNAPSHOT) GetProcAddress (kernel32, "CreateToolhelp32Snapshot")) + || !(pfnModule32First = (PFNMODULE32FIRST) GetProcAddress (kernel32, "Module32First")) + || !(pfnModule32Next = (PFNMODULE32NEXT) GetProcAddress (kernel32, "Module32Next"))) + return NULL; + } + + if ((snapshot = (*pfnCreateToolhelp32Snapshot) (TH32CS_SNAPMODULE, 0)) == (HANDLE) -1) + return NULL; + + me32.dwSize = sizeof (me32); + p = NULL; + if ((*pfnModule32First) (snapshot, &me32)) + { + do { + if ((p = GetProcAddress (me32.hModule, symbol_name)) != NULL) + break; + } while ((*pfnModule32Next) (snapshot, &me32)); + } + + CloseHandle (snapshot); + + return p; +} + +static gpointer +find_in_any_module_using_psapi (const gchar *symbol_name) +{ + static HMODULE psapi = NULL; + + typedef BOOL (WINAPI *PFNENUMPROCESSMODULES) (HANDLE, HMODULE *, DWORD, LPDWORD) ; + static PFNENUMPROCESSMODULES pfnEnumProcessModules = NULL; + + HMODULE *modules; + HMODULE dummy; + gint i, size; + DWORD needed; + + gpointer p; + + if (!pfnEnumProcessModules) + { + if (!psapi) + if ((psapi = LoadLibrary ("psapi.dll")) == NULL) + return NULL; + + if (!(pfnEnumProcessModules = (PFNENUMPROCESSMODULES) GetProcAddress (psapi, "EnumProcessModules"))) + return NULL; + } + + if (!(*pfnEnumProcessModules) (GetCurrentProcess (), &dummy, + sizeof (HMODULE), &needed)) + return NULL; + + size = needed + 10 * sizeof (HMODULE); + modules = g_malloc (size); + + if (!(*pfnEnumProcessModules) (GetCurrentProcess (), modules, + size, &needed) + || needed > size) + { + g_free (modules); + return NULL; + } + + p = NULL; + for (i = 0; i < needed / sizeof (HMODULE); i++) + if ((p = GetProcAddress (modules[i], symbol_name)) != NULL) + break; + + g_free (modules); + + return p; +} + +static gpointer +find_in_any_module (const gchar *symbol_name) +{ + gpointer result; + + if ((result = find_in_any_module_using_toolhelp (symbol_name)) == NULL + && (result = find_in_any_module_using_psapi (symbol_name)) == NULL) + return NULL; + else + return result; +} + +static gpointer +_g_module_symbol (gpointer handle, + const gchar *symbol_name) +{ + gpointer p; + + if (handle == null_module_handle) + p = find_in_any_module (symbol_name); + else + p = dlsym (handle, symbol_name); + if (!p) + g_module_set_error (fetch_dlerror ()); + + return p; +} + + +/* + * cygwin may have either lib or cyg as prefix for dll name + * where we are forced to guess, we use cyg + */ +static gchar* +_g_module_build_path (const gchar *directory, + const gchar *module_name) +{ + int len = strlen(module_name); + gchar* dll_name = g_new0(gchar, len + 8); + gchar* path; + + if ((strncmp (module_name, "lib", 3) == 0) || (strncmp (module_name, "cyg", 3) == 0)) { + strcpy(dll_name, module_name); + } + else { + strcpy(dll_name, "cyg"); + strcat(dll_name, module_name); + } + if (strcmp(module_name + len - 4, ".dll") != 0) { + strcat(dll_name, ".dll"); + } + + if (directory && *directory) { + path = g_strconcat(directory, "/", dll_name, NULL); + } + else { + path = g_strdup(dll_name); + } + g_free(dll_name); + + return path; + +} + diff -Naurp glib-1.2.10/gmodule/gmodule.c glib-1.2.10-cygwin/gmodule/gmodule.c --- glib-1.2.10/gmodule/gmodule.c Thu Mar 15 15:33:10 2001 +++ glib-1.2.10-cygwin/gmodule/gmodule.c Sat Apr 20 17:30:06 2002 @@ -127,7 +127,9 @@ g_module_set_error (const gchar *error) /* --- include platform specifc code --- */ #define SUPPORT_OR_RETURN(rv) { g_module_set_error (NULL); } -#if (G_MODULE_IMPL == G_MODULE_IMPL_DL) +#ifdef __CYGWIN__ +#include "gmodule-cygwin.c" +#elif (G_MODULE_IMPL == G_MODULE_IMPL_DL) #include "gmodule-dl.c" #elif (G_MODULE_IMPL == G_MODULE_IMPL_DLD) #include "gmodule-dld.c" diff -Naurp glib-1.2.10/gmodule/gmodule.h glib-1.2.10-cygwin/gmodule/gmodule.h --- glib-1.2.10/gmodule/gmodule.h Thu Mar 15 15:33:10 2001 +++ glib-1.2.10-cygwin/gmodule/gmodule.h Sat Apr 20 17:30:06 2002 @@ -36,7 +36,16 @@ extern "C" { /* exporting and importing functions, this is special cased * to feature Windows dll stubs. */ -#define G_MODULE_IMPORT extern +/* CYGWIN auto-import fix for multiword data exports + * Note: auto-export is assumed (no __declspec(dllexport)) + */ +#undef GMODULE_IMPORT +#if (defined(_WIN32) || defined(__CYGWIN__)) && !(defined(GMODULE_BUILD_DLL) || defined(GMODULE_STATIC)) +#define GMODULE_IMPORT extern __declspec(dllimport) +#else +#define GMODULE_IMPORT extern +#endif + #ifdef NATIVE_WIN32 # define G_MODULE_EXPORT __declspec(dllexport) #else /* !NATIVE_WIN32 */ diff -Naurp glib-1.2.10/gmodule/testgmodule.c glib-1.2.10-cygwin/gmodule/testgmodule.c --- glib-1.2.10/gmodule/testgmodule.c Sat Feb 19 18:46:06 2000 +++ glib-1.2.10-cygwin/gmodule/testgmodule.c Sat Apr 20 17:30:06 2002 @@ -56,6 +56,9 @@ main (int arg, #ifdef NATIVE_WIN32 plugin_a = g_strconcat (string, "\\libgplugin_a.dll", NULL); plugin_b = g_strconcat (string, "\\libgplugin_b.dll", NULL); +#elif defined (__CYGWIN__) + plugin_a = g_strconcat (string, "/.libs/", "cyggplugin_a.dll", NULL); + plugin_b = g_strconcat (string, "/.libs/", "cyggplugin_b.dll", NULL); #elif (G_MODULE_IMPL == G_MODULE_IMPL_DLD) plugin_a = g_strconcat (string, "/.libs/", "libgplugin_a.sl", NULL); plugin_b = g_strconcat (string, "/.libs/", "libgplugin_b.sl", NULL); @@ -74,6 +77,7 @@ main (int arg, g_print ("error: %s\n", g_module_error ()); return 1; } +#ifndef __CYGWIN__ g_print ("check that not yet bound symbols in shared libraries of main module are retrievable:\n"); string = "g_module_close"; g_print ("retrive symbol `%s' from \"%s\":\n", string, g_basename (g_module_name (module_self))); @@ -83,6 +87,7 @@ main (int arg, return 1; } g_print ("retrived symbol `%s' as %p\n", string, f_self); +#endif /* !__CYGWIN__ */ g_print ("load plugin from \"%s\"\n", plugin_a); module_a = g_module_open (plugin_a, G_MODULE_BIND_LAZY); if (!module_a) @@ -122,12 +127,14 @@ main (int arg, /* get and call globally clashing functions */ string = "g_clash_func"; +#ifndef __CYGWIN__ g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_self))); if (!g_module_symbol (module_self, string, (gpointer) &f_self)) { g_print ("error: %s\n", g_module_error ()); return 1; } +#endif /* !__CYGWIN__ */ g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_a))); if (!g_module_symbol (module_a, string, (gpointer) &f_a)) { @@ -140,8 +147,10 @@ main (int arg, g_print ("error: %s\n", g_module_error ()); return 1; } +#ifndef __CYGWIN__ g_print ("call plugin function(%p) self: ", f_self); f_self (); +#endif /* !__CYGWIN__ */ g_print ("call plugin function(%p) A: ", f_a); f_a (); g_print ("call plugin function(%p) B: ", f_b); @@ -150,10 +159,12 @@ main (int arg, /* get and call clashing plugin functions */ string = "gplugin_clash_func"; +#ifndef __CYGWIN_ g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_self))); if (!g_module_symbol (module_self, string, (gpointer) &f_self)) f_self = NULL; g_print ("retrived function `%s' from self: %p\n", string, f_self); +#endif /* !__CYGWIN__ */ g_print ("retrive symbol `%s' from \"%s\"\n", string, g_basename (g_module_name (module_a))); if (!g_module_symbol (module_a, string, (gpointer) &f_a)) { diff -Naurp glib-1.2.10/gstrfuncs.c glib-1.2.10-cygwin/gstrfuncs.c --- glib-1.2.10/gstrfuncs.c Tue Feb 27 06:00:22 2001 +++ glib-1.2.10-cygwin/gstrfuncs.c Sat Apr 20 17:30:06 2002 @@ -702,8 +702,10 @@ g_strsignal (gint signum) char *msg; #ifdef HAVE_STRSIGNAL +#ifndef __CYGWIN__ extern char *strsignal (int sig); - return strsignal (signum); +#endif + return (gchar*) strsignal (signum); #elif NO_SYS_SIGLIST switch (signum) { diff -Naurp glib-1.2.10/gthread/Makefile.in glib-1.2.10-cygwin/gthread/Makefile.in --- glib-1.2.10/gthread/Makefile.in Thu Mar 15 15:48:51 2001 +++ glib-1.2.10-cygwin/gthread/Makefile.in Sat Apr 20 17:30:06 2002 @@ -127,7 +127,7 @@ testgthread_SOURCES = testgthread.c testgthread_OBJECTS = testgthread.o testgthread_DEPENDENCIES = ../libglib.la libgthread.la testgthread_LDFLAGS = -CFLAGS = @CFLAGS@ +CFLAGS = @CFLAGS@ $(DLL_CFLAGS) COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) @@ -169,6 +169,9 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIE if test -f $$p; then \ echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \ $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \ + dll=$$(echo $$p | sed 's,^lib\(.*\).la$$,cyg\1.dll,'); \ + echo "install -D --mode=755 .libs/$$dll $(DESTDIR)$(bindir)/$$dll"; \ + install -D --mode=755 .libs/$$dll $(DESTDIR)$(bindir)/$$dll; \ else :; fi; \ done @@ -176,6 +179,8 @@ uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) list='$(lib_LTLIBRARIES)'; for p in $$list; do \ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \ + dll=$$(echo $$p | sed 's,^lib\(.*\).la$$,cyg\1.dll,'); \ + rm -f $(DESTDIR)$(bindir)/$$dll; \ done .c.o: @@ -216,8 +221,10 @@ distclean-libtool: maintainer-clean-libtool: +libgthread.la: DLL_CFLAGS = -DGTHREAD_BUILD_DLL libgthread.la: $(libgthread_la_OBJECTS) $(libgthread_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libgthread_la_LDFLAGS) $(libgthread_la_OBJECTS) $(libgthread_la_LIBADD) $(LIBS) + cd .libs && PREFIX=$(prefix) sh ../../mkdll.sh $@ -L../../.libs -lglib mostlyclean-noinstPROGRAMS: diff -Naurp glib-1.2.10/gthread/gthread.c glib-1.2.10-cygwin/gthread/gthread.c --- glib-1.2.10/gthread/gthread.c Wed Feb 24 06:14:14 1999 +++ glib-1.2.10-cygwin/gthread/gthread.c Sat Apr 20 17:30:06 2002 @@ -37,6 +37,17 @@ #include +/* CYGWIN auto-import fix for multiword data exports + * Note: auto-export is assumed (no __declspec(dllexport)) + */ +#undef GTHREAD_IMPORT +#if (defined(_WIN32) || defined(__CYGWIN__)) && !(defined(GTHREAD_BUILD_DLL) || defined(GTHREAD_STATIC)) +#define GTHREAD_IMPORT __declspec(dllimport) +#else +#define GTHREAD_IMPORT +#endif + + static gboolean thread_system_already_initialized = FALSE; #include G_THREAD_SOURCE @@ -60,7 +71,7 @@ g_thread_init (GThreadFunctions* init) thread_system_already_initialized = TRUE; if (init == NULL) - init = &g_thread_functions_for_glib_use_default; + init = &g_thread_functions_for_glib_use_default; else g_thread_use_default_impl = FALSE; diff -Naurp glib-1.2.10/gutils.c glib-1.2.10-cygwin/gutils.c --- glib-1.2.10/gutils.c Wed Aug 9 19:12:31 2000 +++ glib-1.2.10-cygwin/gutils.c Sat Apr 20 17:30:06 2002 @@ -477,15 +477,19 @@ g_get_any_init (void) { struct passwd *pw = NULL; gpointer buffer = NULL; - + # ifdef HAVE_GETPWUID_R struct passwd pwd; +#ifdef __CYGWIN__ +guint bufsize = 1024; +#else # ifdef _SC_GETPW_R_SIZE_MAX /* This reurns the maximum length */ guint bufsize = sysconf (_SC_GETPW_R_SIZE_MAX); # else /* _SC_GETPW_R_SIZE_MAX */ guint bufsize = 64; # endif /* _SC_GETPW_R_SIZE_MAX */ +#endif /*!__CYGWIN__*/ gint error; do diff -Naurp glib-1.2.10/mkdll.sh glib-1.2.10-cygwin/mkdll.sh --- glib-1.2.10/mkdll.sh Thu Jan 1 00:00:00 1970 +++ glib-1.2.10-cygwin/mkdll.sh Sat Apr 20 17:30:06 2002 @@ -0,0 +1,59 @@ +#!/bin/sh + +# script to generate dll from libtool-generated static archive (.la file) +# invoke in .libs directory with: +# mkdll.sh +# eg: +# mkdll.sh libtest.la -L/usr/local/lib -llocal + +# defaults to using gcc for libraries written in C. +# set the CC env var to use a different compiler driver: eg +# export CC=g++ +# for C++ libraries + +# defaults to using /usr/local as the installation PREFIX +# override this by setting the PREFIX env var: eg +# export PREFIX=/opt/gnome + +archive=$1 +module=$(echo $(basename $archive) | sed -e 's,^lib\(.*\).la$,\1,') + +shift +dependency_libs="$@" + +test -n "$CC" || CC=gcc +test -n "$PREFIX" || prefix=/usr/local + +# get the static library name +old_lib=$(sed -ne '/^old_library=/ s,^old_library='\''\(.*\)'\''.*$,\1,p' $archive) + +# update the archive with the dll and import lib name. +if sed -e 's,^dlname='\'\'',dlname='\'cyg${module}.dll\'',;s,^library_names='\'\'',library_names='\'lib${module}.dll.a\'',' $archive > ${archive}.tmp +then cat ${archive}.tmp > ${archive} +fi +rm -f ${archive}.tmp + +# update the install archive if it exists +if [ -f ${archive}i ] ; then + if sed -e 's,^dlname='\'\'',dlname='\'../bin/cyg${module}.dll\'',;s,^library_names='\'\'',library_names='\'lib${module}.dll.a\'',' ${archive}i > ${archive}i.tmp + then cat ${archive}i.tmp > ${archive}i + fi + rm -f ${archive}i.tmp +fi + +# update the archive with the install dir if not already set +libdir=${prefix}/lib +if sed -e '/^libdir=/ s,='\'\'',='\'$libdir\'',' $archive > ${archive}.tmp +then cat ${archive}.tmp > $archive +fi +rm -f ${archive}.tmp + + +# report the link command to stdout +eval echo $CC -shared -o cyg${module}.dll -Wl,--out-implib=lib${module}.dll.a \ +-Wl,--export-all-symbols -Wl,--whole-archive $old_lib -Wl,--no-whole-archive ${dependency_libs} + +# do the link command +eval $CC -shared -o cyg${module}.dll -Wl,--out-implib=lib${module}.dll.a -Wl,--export-all-symbols \ +-Wl,--whole-archive $old_lib -Wl,--no-whole-archive ${dependency_libs} + diff -Naurp glib-1.2.10/testglib.c glib-1.2.10-cygwin/testglib.c --- glib-1.2.10/testglib.c Wed Feb 24 06:13:58 1999 +++ glib-1.2.10-cygwin/testglib.c Sat Apr 20 17:30:06 2002 @@ -699,7 +699,17 @@ main (int argc, for (i = 0; i < 10000; i++) g_string_append_c (string1, 'a'+(i%26)); -#if !(defined (_MSC_VER) || defined (__LCC__)) +#if defined (__CYGWIN__) + /* cygwin blows up if *printf needs too much memory + - sorry, I don't know what the limit is, just picked random (smaller) values here + */ + g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%100.20f", + "this pete guy sure is a wuss, like he's the number ", + 1, + " wuss. everyone agrees.\n", + string1->str, + 10, 666, 15, 15, 666.666666666, 666.666666666); +#elif !(defined (_MSC_VER) || defined (__LCC__)) /* MSVC and LCC use the same run-time C library, which doesn't like the %10000.10000f format... */ g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%10000.10000f", diff -Naurp glib-1.2.10/tests/Makefile.in glib-1.2.10-cygwin/tests/Makefile.in --- glib-1.2.10/tests/Makefile.in Thu Mar 15 15:48:53 2001 +++ glib-1.2.10-cygwin/tests/Makefile.in Sat Apr 20 17:30:06 2002 @@ -12,6 +12,7 @@ SHELL = @SHELL@ +TESTS_ENVIRONMENT = PATH=$$(pwd)/../.libs:$$(pwd)/../gmodule/.libs:$$(pwd)/../gthread/.libs:$$PATH srcdir = @srcdir@ top_srcdir = @top_srcdir@ diff -Naurp glib-1.2.10/tests/string-test.c glib-1.2.10-cygwin/tests/string-test.c --- glib-1.2.10/tests/string-test.c Wed Feb 24 06:14:25 1999 +++ glib-1.2.10-cygwin/tests/string-test.c Sat Apr 20 17:30:06 2002 @@ -103,7 +103,17 @@ main (int argc, g_assert((strlen("hi pete!") + 10000) == string1->len); g_assert((strlen("hi pete!") + 10000) == strlen(string1->str)); -#if !(defined (_MSC_VER) || defined (__LCC__)) +#if defined (__CYGWIN__) + /* cygwin blows up if *printf needs too much memory + - sorry, I don't know what the limit is, just picked random (smaller) values here + */ + g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%100.20f", + "this pete guy sure is a wuss, like he's the number ", + 1, + " wuss. everyone agrees.\n", + string1->str, + 10, 666, 15, 15, 666.666666666, 666.666666666); +#elif !(defined (_MSC_VER) || defined (__LCC__)) /* MSVC and LCC use the same run-time C library, which doesn't like the %10000.10000f format... */ g_string_sprintf (string2, "%s|%0100d|%s|%s|%0*d|%*.*f|%10000.10000f",