Re: Combined cygwin & auto* for mingw patch...



On Wed, 21 Feb 2001, Tor Lillqvist wrote:

Hello Tor,

Sorry for replying so late. Finaly during weekend I was able to verify
this patch. I had to adjust it a bit to cleanly apply to current CVS glib
version (the attached file is gzipped diff against friday cvs checkout).
It compiled and worked for me without any problems on Linux and cygwin.
The compilation on mingw failed in DLL linking statage because libtool
have still problems with linking in nontibtool DLLs (I haven't checked
the patch you sent to Gary). 

I think it can be applied to cvs even without changing the libtool to
current CVS as the changes in makefiles and configure script does not
affect the old libtool and mention in readme that it is required to
replace the libtool stuff to compile DLLs on cygwin and mingw.

Best regards, 
Stevo.

P.S. Thanks Tor for adding my cursor code to gtk+.

> Here is a combination of Stefan Ondrejicka's cygwin patch and changes
> to configure and build glib using auto* and libtool for native Win32,
> too. Diffs to CVS as of a moment ago. I don't have the possibility to
> check how this affects building on Unix right now, could somebody
> please check?
> 
> For cygwin and mingw, the latest CVS libtool is needed, and even some
> patches to that, to make everything go smooth and easy.
[...]


-- 
Stefan Ondrejicka <ondrej idata sk>
Beethovenova 11, 917 08 Trnava, Slovakia
http://www.idata.sk/~ondrej/
diff -ruN glib-cvs/Makefile.am glib/Makefile.am
--- glib-cvs/Makefile.am	Thu Feb 22 16:28:28 2001
+++ glib/Makefile.am	Sun Mar  4 15:34:47 2001
@@ -18,11 +18,7 @@
 	glib.def		\
 	makefile.msc.in		\
 	makefile.mingw.in	\
-	giowin32.c		\
 	glibconfig.h.win32.in	\
-	gwin32.c		\
-	gspawn-win32.c		\
-	gspawn-win32-helper.c	\
 	config.h.win32.in	\
 	build-dll		\
 	glib.rc.in		\
@@ -32,6 +28,9 @@
 	gthread-2.0.pc.in	\
 	gen-unicode-tables.pl
 
+EXTRA_PROGRAMS = \
+	gspawn-win32-helper
+
 # These may be in the builddir too
 BUILT_EXTRA_DIST = \
 	makefile.msc		\
@@ -57,7 +56,6 @@
 	ghash.c			\
 	ghook.c			\
 	giochannel.c    	\
-	giounix.c       	\
 	glibintl.h		\
 	glist.c			\
 	gmain.c         	\
@@ -73,7 +71,6 @@
 	gscanner.c		\
 	gshell.c		\
 	gslist.c		\
-	gspawn.c		\
 	gstrfuncs.c		\
 	gstring.c		\
 	gthread.c       	\
@@ -92,6 +89,13 @@
 ## If we decide to link in 'alloca.c', this is how to do it
 #libglib_1_3_la_LIBADD = @ALLOCA@
 
++EXTRA_libglib_1_3_la_SOURCES = \
+	giounix.c	\
+	giowin32.c	\
+	gspawn.c	\
+	gspawn-win32.c	\
+	gwin32.c
+
 glibincludedir=$(includedir)/glib-2.0
 glibinclude_HEADERS =   \
 	galloca.h	\
@@ -158,17 +162,32 @@
 	CONFIG_FILES= CONFIG_HEADERS= CONFIG_OTHER=glibconfig.h ./config.status
 	echo timestamp > stamp-gc-h
 
-libglib_1_3_la_LIBADD = @ICONV_LIBS@
+libglib_1_3_la_LIBADD = @GIO@ @GSPAWN@ @PLATFORMDEP@ @ICONV_LIBS@ @G_LIBS_EXTRA@
+libglib_1_3_la_DEPENDENCIES = @GIO@ @GSPAWN@ @PLATFORMDEP@
+
+if OS_WIN32
+# This requires a very new libtool
+export_symbols = -export-symbols glib.def
+endif
 
 libglib_1_3_la_LDFLAGS = \
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-	-export-dynamic
+	-export-dynamic -no-undefined $(export_symbols)
 
-noinst_PROGRAMS = testglib testgdate testgdateparser timeloop
+if OS_WIN32
+bin_PROGRAMS = gspawn-win32-helper
+gspawn_win32_helper_LDADD = libglib-1.3.la
+endif
+if ENABLE_TIMELOOP
+timeloop = timeloop
+endif
+noinst_PROGRAMS = testglib testgdate testgdateparser $(timeloop)
 testglib_LDADD = libglib-1.3.la
 testgdate_LDADD = libglib-1.3.la
 testgdateparser_LDADD = libglib-1.3.la
+if ENABLE_TIMELOOP
 timeloop_LDADD = libglib-1.3.la
+endif
 
 m4datadir = $(datadir)/aclocal
 m4data_DATA = glib-2.0.m4
diff -ruN glib-cvs/configure.in glib/configure.in
--- glib-cvs/configure.in	Mon Feb 19 12:32:37 2001
+++ glib/configure.in	Sun Mar  4 15:34:47 2001
@@ -161,6 +161,9 @@
   fi
 fi
 
+AC_CYGWIN
+AC_EXEEXT
+
 # define a MAINT-like variable REBUILD which is set if Perl
 # and awk are found, so autogenerated sources can be rebuilt
 AC_PROG_AWK
@@ -196,6 +199,7 @@
 
 
 dnl Initialize libtool
+AC_LIBTOOL_WIN32_DLL
 AM_PROG_LIBTOOL
 
 if test "x$GCC" = "xyes"; then
@@ -270,7 +274,7 @@
 	# long long is a 64 bit integer.
 	AC_MSG_CHECKING(for format to printf and scanf a gint64)
 	AC_CACHE_VAL(glib_cv_long_long_format,[
-		for format in ll q; do
+		for format in ll q I64; do
 		  AC_TRY_RUN([#include <stdio.h>  
 			int main()
 			{
@@ -285,7 +289,7 @@
 			break)
 		done])
 	if test -n "$glib_cv_long_long_format"; then
-	  AC_MSG_RESULT(%${glib_cv_long_long_format}i)
+	  AC_MSG_RESULT(%${glib_cv_long_long_format}u)
         else
 	  AC_MSG_RESULT(none)
         fi
@@ -620,6 +624,12 @@
 G_MODULE_NEED_USCORE=0
 G_MODULE_BROKEN_RTLD_GLOBAL=0
 G_MODULE_HAVE_DLERROR=0
+dnl *** force native WIN32 shared lib loader
+if test -z "$G_MODULE_IMPL"; then
+  case "$host" in
+  *-*-mingw*|*-*-cygwin*) G_MODULE_IMPL=G_MODULE_IMPL_WIN32 ;;
+  esac
+fi
 dnl *** dlopen() and dlsym() in system libraries
 if test -z "$G_MODULE_IMPL"; then
 	AC_CHECK_FUNC(dlopen,
@@ -700,7 +710,7 @@
 			[glib_cv_rtldglobal_broken=no],
 			[glib_cv_rtldglobal_broken=yes],
 			[])
-		rm -f plugin.c plugin.o plugin.lo
+		rm -f plugin.c plugin.$ac_objext plugin.lo
 	])
 	if test "x$glib_cv_rtldglobal_broken" = "xyes"; then
   		G_MODULE_BROKEN_RTLD_GLOBAL=1
@@ -768,6 +778,77 @@
 AC_SUBST(G_MODULE_NEED_USCORE)
 AC_SUBST(GLIB_DEBUG_FLAGS)
 
+dnl **********************
+dnl *** g_spawn checks ***
+dnl **********************
+
+AC_MSG_CHECKING(for gspawn implementation)
+case "$host" in
+  *-*-mingw*)
+    GSPAWN=gspawn-win32.lo
+    ;;
+  *)
+    GSPAWN=gspawn.lo
+    ;;
+esac
+AC_MSG_RESULT($GSPAWN)
+AC_SUBST(GSPAWN)
+
+dnl *************************
+dnl *** GIOChannel checks ***
+dnl *************************
+
+AC_MSG_CHECKING(for GIOChannel implementation)
+case "$host" in
+  *-*-mingw*)
+    GIO=giowin32.lo
+    ;;
+  *)
+    GIO=giounix.lo
+    ;;
+esac
+AC_MSG_RESULT($GIO)
+AC_SUBST(GIO)
+
+dnl ****************************************
+dnl *** platform dependent source checks ***
+dnl ****************************************
+
+AC_MSG_CHECKING(for platform-dependent source)
+case "$host" in
+  *-*-cygwin*|*-*-mingw*)
+    PLATFORMDEP=gwin32.lo
+    ;;
+  *)
+    PLATFORMDEP=
+    ;;
+esac
+AC_MSG_RESULT($PLATFORMDEP)
+AC_SUBST(PLATFORMDEP)
+
+AC_MSG_CHECKING([whether to compile timeloop])
+case "$host" in
+  *-*-cygwin*|*-*-mingw*)
+    enable_timeloop=no
+    ;;
+  *)
+    enable_timeloop=yes
+    ;;
+esac
+AC_MSG_RESULT($enable_timeloop)
+AM_CONDITIONAL(ENABLE_TIMELOOP, test x$enable_timeloop = xyes)
+
+AC_MSG_CHECKING([if building for Win32])
+case "$host" in
+  *-*-mingw*)
+    os_win32=yes
+    ;;
+  *)
+    os_win32=no
+    ;;
+esac
+AC_MSG_RESULT($os_win32)
+AM_CONDITIONAL(OS_WIN32, test x$os_win32 = xyes)
 
 dnl ***********************
 dnl *** g_thread checks ***
@@ -938,7 +1019,7 @@
            	fi	
 		;;
              *)
-		for thread_lib in "" pthread pthreads c_r thread dce; do
+		for thread_lib in "" pthread pthread32 pthreads c_r thread dce; do
 			if test x"$thread_lib" = x; then
 				add_thread_lib=""
 				IN=""
@@ -1233,6 +1314,23 @@
 	glibconfig-sysdefs.h,
 	=)
 
+dnl **********************
+dnl *** Win32 API libs ***
+dnl **********************
+
+case $host in
+  *-*-cygwin*)
+       G_LIBS_EXTRA="-luser32 -lwsock32 -lkernel32"
+    ;;
+  *-*-mingw*)
+       G_LIBS_EXTRA="-lwsock32"
+    ;;
+  *)
+       G_LIBS_EXTRA=""
+    ;;
+esac
+AC_SUBST(G_LIBS_EXTRA)
+
 dnl ***********************
 dnl *** Tests for iconv ***
 dnl ***********************
@@ -1813,10 +1911,12 @@
     ;;
   *-*-cygwin*)
     glib_os="#define G_OS_UNIX
+#define G_PLATFORM_WIN32
 #define G_WITH_CYGWIN"
     ;;
   *-*-mingw*)
-    glib_os="#define G_OS_WIN32"
+    glib_os="#define G_OS_WIN32
+#define G_PLATFORM_WIN32"
     ;;
   *)
     glib_os="#define G_OS_UNIX"
diff -ruN glib-cvs/gbacktrace.c glib/gbacktrace.c
--- glib-cvs/gbacktrace.c	Thu Jan 25 18:41:52 2001
+++ glib/gbacktrace.c	Sun Mar  4 15:34:47 2001
@@ -62,6 +62,7 @@
 #ifdef G_OS_WIN32
 #  define STRICT		/* Strict typing, please */
 #  include <windows.h>
+#  undef STRICT
 #endif
 
 #ifndef NO_FD_SET
@@ -74,8 +75,9 @@
 #  endif
 #endif
 
-
+#ifndef G_OS_WIN32
 static void stack_trace (char **args);
+#endif
 
 extern volatile gboolean glib_on_error_halt;
 volatile gboolean glib_on_error_halt = TRUE;
@@ -185,6 +187,7 @@
 #endif
 }
 
+#ifndef G_OS_WIN32
 static gboolean stack_trace_done = FALSE;
 
 static void
@@ -196,7 +199,6 @@
 static void
 stack_trace (char **args)
 {
-#ifdef G_OS_UNIX
   pid_t pid;
   int in_fd[2];
   int out_fd[2];
@@ -291,7 +293,7 @@
   close (out_fd[0]);
   close (out_fd[1]);
   _exit (0);
-#else
   abort ();
-#endif
 }
+#endif /* !G_OS_WIN32 */
+
diff -ruN glib-cvs/gconvert.c glib/gconvert.c
--- glib-cvs/gconvert.c	Wed Feb 14 13:08:56 2001
+++ glib/gconvert.c	Sun Mar  4 15:34:47 2001
@@ -28,7 +28,7 @@
 #include "glib.h"
 #include "config.h"
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 #include <windows.h>
 #endif
 
@@ -521,7 +521,7 @@
 		  gint         *bytes_written,
 		  GError      **error)
 {
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 
   gint i, clen, total_len, wclen, first;
   wchar_t *wcs, wc;
@@ -617,7 +617,7 @@
   
   return result;
 
-#else
+#else  /* !G_PLATFORM_WIN32 */
 
   char *charset, *str;
 
@@ -628,7 +628,7 @@
 		   "UTF-8", charset, bytes_read, bytes_written, error);
   
   return str;
-#endif
+#endif  /* !G_PLATFORM_WIN32 */
 }
 
 /**
@@ -662,7 +662,7 @@
 		    gint        *bytes_written,
 		    GError     **error)
 {
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 
   gint i, mask, clen, mblen;
   wchar_t *wcs, *wcp;
@@ -764,7 +764,7 @@
   
   return result;
 
-#else
+#else  /* !G_PLATFORM_WIN32 */
 
   gchar *charset, *str;
 
@@ -776,7 +776,7 @@
 
   return str;
   
-#endif
+#endif  /* !G_PLATFORM_WIN32 */
 }
 
 /**
@@ -809,11 +809,11 @@
 		    gint        *bytes_written,
 		    GError     **error)
 {
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
   return g_locale_to_utf8 (opsysstring, len,
 			   bytes_read, bytes_written,
 			   error);
-#else
+#else  /* !G_PLATFORM_WIN32 */
   if (getenv ("G_BROKEN_FILENAMES"))
     return g_locale_to_utf8 (opsysstring, len,
 			     bytes_read, bytes_written,
@@ -833,7 +833,7 @@
     return g_strdup (opsysstring);
   else
     return g_strndup (opsysstring, len);
-#endif
+#endif  /* !G_PLATFORM_WIN32 */
 }
 
 /**
@@ -865,11 +865,11 @@
 		      gint        *bytes_written,
 		      GError     **error)
 {
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
   return g_locale_from_utf8 (utf8string, len,
 			     bytes_read, bytes_written,
 			     error);
-#else
+#else  /* !G_PLATFORM_WIN32 */
   if (getenv ("G_BROKEN_FILENAMES"))
     return g_locale_from_utf8 (utf8string, len,
 			       bytes_read, bytes_written,
@@ -889,7 +889,7 @@
     return g_strdup (utf8string);
   else
     return g_strndup (utf8string, len);
-#endif
+#endif  /* !G_PLATFORM_WIN32 */
 }
 
 
diff -ruN glib-cvs/gfileutils.c glib/gfileutils.c
--- glib-cvs/gfileutils.c	Mon Feb 19 11:36:02 2001
+++ glib/gfileutils.c	Sun Mar  4 15:34:47 2001
@@ -378,7 +378,8 @@
   struct stat stat_buf;
   gint fd;
   
-  fd = open (filename, O_RDONLY);
+  /* O_BINARY useful on Cygwin */
+  fd = open (filename, O_RDONLY | O_BINARY);
 
   if (fd < 0)
     {
diff -ruN glib-cvs/glib.def glib/glib.def
--- glib-cvs/glib.def	Thu Mar  1 14:23:18 2001
+++ glib/glib.def	Sun Mar  4 15:34:47 2001
@@ -233,6 +233,7 @@
 	g_locale_to_utf8
 	g_log
 	g_log_default_handler
+	g_log_domain_glib
 	g_log_remove_handler
 	g_log_set_always_fatal
 	g_log_set_fatal_mask
diff -ruN glib-cvs/glib.h glib/glib.h
--- glib-cvs/glib.h	Thu Jan 25 18:42:11 2001
+++ glib/glib.h	Sun Mar  4 15:34:47 2001
@@ -68,7 +68,7 @@
 #include <gtypes.h>
 #include <gunicode.h>
 #include <gutils.h>
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 #include <gwin32.h>
 #endif
 
diff -ruN glib-cvs/gmarkup.h glib/gmarkup.h
--- glib-cvs/gmarkup.h	Thu Jan 25 18:42:19 2001
+++ glib/gmarkup.h	Sun Mar  4 15:34:47 2001
@@ -23,10 +23,7 @@
 
 #include <gerror.h>
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
+G_BEGIN_DECLS
 
 typedef enum
 {
@@ -121,9 +118,7 @@
                              gint         length);
 
 
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
 
 #endif /* __G_MARKUP_H__ */
 
diff -ruN glib-cvs/gmessages.c glib/gmessages.c
--- glib-cvs/gmessages.c	Thu Feb 22 16:28:32 2001
+++ glib/gmessages.c	Sun Mar  4 15:34:47 2001
@@ -91,6 +91,7 @@
 #ifdef G_OS_WIN32
 #  define STRICT
 #  include <windows.h>
+#  undef STRICT
 #  include <process.h>          /* For _getpid() */
 
 static gboolean alloc_console_called = FALSE;
diff -ruN glib-cvs/gmessages.h glib/gmessages.h
--- glib-cvs/gmessages.h	Thu Jan 25 18:42:21 2001
+++ glib/gmessages.h	Sun Mar  4 15:34:47 2001
@@ -71,7 +71,7 @@
 
 /* Logging mechanism
  */
-extern          const gchar             *g_log_domain_glib;
+GLIB_VAR        const gchar             *g_log_domain_glib;
 guint           g_log_set_handler       (const gchar    *log_domain,
                                          GLogLevelFlags  log_levels,
                                          GLogFunc        log_func,
diff -ruN glib-cvs/gmodule/Makefile.am glib/gmodule/Makefile.am
--- glib-cvs/gmodule/Makefile.am	Thu Jan 25 19:37:02 2001
+++ glib/gmodule/Makefile.am	Sun Mar  4 15:38:11 2001
@@ -28,29 +28,33 @@
 glibinclude_HEADERS = \
 		gmodule.h
 
-libglib = $(top_builddir)/libglib-1.3.la # -lglib
+libglib = $(top_builddir)/libglib-1.3.la
 
 top_builddir_full=`cd \$(top_builddir); pwd`
 
 lib_LTLIBRARIES = libgmodule-1.3.la libgplugin_a.la libgplugin_b.la
 
+if OS_WIN32
+export_symbols = -export-symbols gmodule.def
+endif
+
 libgmodule_1_3_la_SOURCES = gmodule.c
 libgmodule_1_3_la_LDFLAGS = \
 	@G_MODULE_LDFLAGS@ \
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-	-export-dynamic
+	-export-dynamic -no-undefined $(export_symbols)
 
-libgmodule_1_3_la_LIBADD = @G_MODULE_LIBS_EXTRA@ @G_MODULE_LIBS@ # $(libglib)
+libgmodule_1_3_la_LIBADD = @G_MODULE_LIBS_EXTRA@ @G_MODULE_LIBS@ $(libglib)
 # we should really depend on $(libglib) for libgmodule.la, but libtool has a
-# problem with this ;(
+# problem with this ;( Ummm? Does it?
 
 libgplugin_a_la_SOURCES = libgplugin_a.c
-libgplugin_a_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module
-libgplugin_a_la_LIBADD = @G_MODULE_LIBS@ @G_MODULE_LIBS_EXTRA@ @G_MODULE_PLUGIN_LIBS@ # $(libglib)
+libgplugin_a_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module -no-undefined
+libgplugin_a_la_LIBADD = @G_MODULE_LIBS@ @G_MODULE_LIBS_EXTRA@ @G_MODULE_PLUGIN_LIBS@ $(libglib) libgmodule-1.3.la
 
 libgplugin_b_la_SOURCES = libgplugin_b.c
-libgplugin_b_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module
-libgplugin_b_la_LIBADD = @G_MODULE_LIBS@ @G_MODULE_LIBS_EXTRA@ @G_MODULE_PLUGIN_LIBS@ # $(libglib)
+libgplugin_b_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module -no-undefined
+libgplugin_b_la_LIBADD = @G_MODULE_LIBS@ @G_MODULE_LIBS_EXTRA@ @G_MODULE_PLUGIN_LIBS@ $(libglib) libgmodule-1.3.la
 
 noinst_PROGRAMS = testgmodule
 testgmodule_LDFLAGS += @G_MODULE_LDFLAGS@
diff -ruN glib-cvs/gmodule/gmodule-win32.c glib/gmodule/gmodule-win32.c
--- glib-cvs/gmodule/gmodule-win32.c	Thu Jan 25 19:37:03 2001
+++ glib/gmodule/gmodule-win32.c	Sun Mar  4 15:34:47 2001
@@ -38,6 +38,11 @@
 #include <tlhelp32.h>
 #else
 
+#ifdef G_WITH_CYGWIN
+#include <sys/cygwin.h>
+#endif
+
+
 /* The w32api headers supplied with the mingw gcc don't have
  * tlhelp32.h. We really only need the MODULEENTRY32 struct and the
  * TH32CS_SNAPMODULE value, so provide them here.
@@ -77,7 +82,13 @@
 		gboolean     bind_lazy)
 {
   HINSTANCE handle;
-  
+#ifdef G_WITH_CYGWIN
+  gchar tmp[MAX_PATH];
+
+  cygwin_conv_to_win32_path(file_name, tmp);
+  file_name = tmp;
+#endif
+
   handle = LoadLibrary (file_name);
   if (!handle)
     set_error ();
diff -ruN glib-cvs/gmodule/gmodule.h glib/gmodule/gmodule.h
--- glib-cvs/gmodule/gmodule.h	Mon Feb 19 11:36:17 2001
+++ glib/gmodule/gmodule.h	Sun Mar  4 15:34:47 2001
@@ -30,19 +30,17 @@
 extern const char      *g_log_domain_gmodule;
 #include <glib.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
+G_BEGIN_DECLS
 
 /* exporting and importing functions, this is special cased
  * to feature Windows dll stubs.
  */
 #define	G_MODULE_IMPORT		extern
-#if defined (G_OS_WIN32)
+#if defined (G_PLATFORM_WIN32)
 #  define	G_MODULE_EXPORT		__declspec(dllexport)
-#else /* !G_OS_WIN32 */
+#else /* !G_PLATFORM_WIN32 */
 #  define	G_MODULE_EXPORT
-#endif /* !G_OS_WIN32 */
+#endif /* !G_PLATFORM_WIN32 */
 
 typedef enum
 {
@@ -92,10 +90,6 @@
 gchar*                g_module_build_path    (const gchar  *directory,
 					      const gchar  *module_name);
 
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
+G_END_DECLS
 
 #endif /* __GMODULE_H__ */
diff -ruN glib-cvs/gmodule/makefile.mingw.in glib/gmodule/makefile.mingw.in
--- glib-cvs/gmodule/makefile.mingw.in	Mon Jan 29 11:25:31 2001
+++ glib/gmodule/makefile.mingw.in	Sun Mar  4 15:34:47 2001
@@ -15,7 +15,7 @@
 # Nothing much configurable below
 
 INCLUDES = -I .. -I .
-DEFINES = -DHAVE_CONFIG_H -DG_LOG_DOMAIN=g_log_domain_gmodule -DG_ENABLE_DEBUG
+DEFINES = -DHAVE_CONFIG_H -DG_LOG_DOMAIN=g_log_domain_gmodule -DG_ENABLE_DEBUG -DDLL_EXPORT
 
 BUILD_DLL = ../build-dll
 
diff -ruN glib-cvs/gmodule/makefile.msc.in glib/gmodule/makefile.msc.in
--- glib-cvs/gmodule/makefile.msc.in	Thu Jan 25 19:37:05 2001
+++ glib/gmodule/makefile.msc.in	Sun Mar  4 15:34:47 2001
@@ -13,7 +13,7 @@
 # Nothing much configurable below
 
 INCLUDES = -I .. -I .
-DEFINES = -DHAVE_CONFIG_H -DG_LOG_DOMAIN=g_log_domain_gmodule -DG_ENABLE_DEBUG
+DEFINES = -DHAVE_CONFIG_H -DG_LOG_DOMAIN=g_log_domain_gmodule -DG_ENABLE_DEBUG -DDLL_EXPORT
 
 all : \
 	gmoduleconf.h \
diff -ruN glib-cvs/gobject/Makefile.am glib/gobject/Makefile.am
--- glib-cvs/gobject/Makefile.am	Mon Feb  5 10:06:36 2001
+++ glib/gobject/Makefile.am	Sun Mar  4 15:34:47 2001
@@ -10,6 +10,12 @@
 	@GLIB_DEBUG_FLAGS@			\
 @STRIP_END@
 
+libglib = $(top_builddir)/libglib-1.3.la
+
+if OS_WIN32
+export_symbols = -export-symbols gobject.def
+endif
+
 # libraries to compile and install
 lib_LTLIBRARIES = libgobject-1.3.la
 
@@ -19,7 +25,7 @@
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)	\
 	-export-dynamic						\
 @STRIP_END@
-libgobject_1_3_la_LIBADD = # $(libglib)
+libgobject_1_3_la_LIBADD = $(libglib)
 
 #
 # setup source file variables
@@ -114,7 +120,7 @@
 # versions in the build dir. thus a development setup requires
 # srcdir to be writable, passing --disable-rebuilds to
 # ../configure will supress all autogeneration rules.
-$(srcdir)/stamp-gmarshal.h: @REBUILD@ gmarshal.list gmarshal.h glib-genmarshal
+$(srcdir)/stamp-gmarshal.h: @REBUILD@ gmarshal.list gmarshal.h glib-genmarshal$(EXEEXT)
 	echo "#ifndef __G_MARSHAL_H__" > xgen-gmh \
 	&& echo "#define __G_MARSHAL_H__" >> xgen-gmh \
 	&& ./glib-genmarshal --nostdinc --prefix=g_cclosure_marshal $(srcdir)/gmarshal.list --header >> xgen-gmh \
@@ -146,8 +152,8 @@
 gobject_query_SOURCES = gobject-query.c
 glib_genmarshal_SOURCES = glib-genmarshal.c
 # link programs against libgobject
-progs_LDADD = libgobject-1.3.la ../libglib-1.3.la
-glib_genmarshal_LDADD = ../libglib-1.3.la # can't have libgobject here
+progs_LDADD = libgobject-1.3.la $(libglib)
+glib_genmarshal_LDADD = $(libglib) # can't have libgobject here
 gobject_query_LDADD = $(progs_LDADD)
 
 #
diff -ruN glib-cvs/gobject/gboxed.h glib/gobject/gboxed.h
--- glib-cvs/gobject/gboxed.h	Thu Jan 25 19:37:07 2001
+++ glib/gobject/gboxed.h	Sun Mar  4 15:34:47 2001
@@ -21,11 +21,7 @@
 
 #include        <gobject/gtype.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
 
 /* --- type macros --- */
 #define G_TYPE_IS_BOXED(type)	(G_TYPE_FUNDAMENTAL (type) == G_TYPE_BOXED)
@@ -56,11 +52,6 @@
 					 GBoxedCopyFunc	boxed_copy,
 					 GBoxedFreeFunc	boxed_free);
 
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif	/* __G_BOXED_H__ */
diff -ruN glib-cvs/gobject/gbsearcharray.h glib/gobject/gbsearcharray.h
--- glib-cvs/gobject/gbsearcharray.h	Thu Jan 25 19:37:08 2001
+++ glib/gobject/gbsearcharray.h	Sun Mar  4 15:34:47 2001
@@ -23,11 +23,7 @@
 
 #include        <gobject/gtype.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
 
 /* helper macro to avoid signed overflow for value comparisions */
 #define	G_BSEARCH_ARRAY_CMP(v1,v2) ((v1) < (v2) ? -1 : (v1) > (v2) ? 1 : 0)
@@ -124,11 +120,6 @@
 }
 #endif  /* G_CAN_INLINE && __G_BSEARCHARRAY_C__ */
 
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_BSEARCH_ARRAY_H__ */
diff -ruN glib-cvs/gobject/gclosure.h glib/gobject/gclosure.h
--- glib-cvs/gobject/gclosure.h	Fri Feb 16 15:10:55 2001
+++ glib/gobject/gclosure.h	Sun Mar  4 15:34:47 2001
@@ -22,12 +22,7 @@
 
 #include        <gobject/gtype.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
+G_BEGIN_DECLS
 
 /* --- defines --- */
 #define	G_CLOSURE_NEEDS_MARSHAL(closure) (((GClosure*) (closure))->marshal == NULL)
@@ -158,9 +153,6 @@
    - provide marshaller collection, virtually covering anything out there
 */
 
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_CLOSURE_H__ */
diff -ruN glib-cvs/gobject/genums.h glib/gobject/genums.h
--- glib-cvs/gobject/genums.h	Mon Feb 19 11:36:19 2001
+++ glib/gobject/genums.h	Sun Mar  4 15:34:47 2001
@@ -21,11 +21,7 @@
 
 #include <gobject/gtype.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
 
 /* --- type macros --- */
 #define G_TYPE_IS_ENUM(type)	       (G_TYPE_FUNDAMENTAL (type) == G_TYPE_ENUM)
@@ -118,10 +114,6 @@
 				    GTypeInfo	      *info,
 				    const GFlagsValue *const_values);
 
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_ENUMS_H__ */
diff -ruN glib-cvs/gobject/gobject.h glib/gobject/gobject.h
--- glib-cvs/gobject/gobject.h	Thu Jan 25 19:37:14 2001
+++ glib/gobject/gobject.h	Sun Mar  4 15:34:47 2001
@@ -24,11 +24,7 @@
 #include        <gobject/gparam.h>
 #include        <gobject/gclosure.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
 
 /* --- type macros --- */
 #define G_TYPE_IS_OBJECT(type)     (G_TYPE_FUNDAMENTAL (type) == G_TYPE_OBJECT)
@@ -205,10 +201,6 @@
              G_OBJECT_TYPE_NAME (_object)); \
 } G_STMT_END
 
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_OBJECT_H__ */
diff -ruN glib-cvs/gobject/gparam.h glib/gobject/gparam.h
--- glib-cvs/gobject/gparam.h	Fri Feb  2 15:24:55 2001
+++ glib/gobject/gparam.h	Sun Mar  4 15:34:47 2001
@@ -24,11 +24,7 @@
 
 #include	<gobject/gvalue.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
 
 /* --- type macros --- */
 #define G_TYPE_IS_PARAM(type)		(G_TYPE_FUNDAMENTAL (type) == G_TYPE_PARAM)
@@ -183,8 +179,6 @@
  *	>0 if value1 > value2, and 0 otherwise (they are equal)
  */
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_PARAM_H__ */
diff -ruN glib-cvs/gobject/gparamspecs.h glib/gobject/gparamspecs.h
--- glib-cvs/gobject/gparamspecs.h	Thu Jan 25 19:37:16 2001
+++ glib/gobject/gparamspecs.h	Sun Mar  4 15:34:47 2001
@@ -27,11 +27,7 @@
 #include        <gobject/gboxed.h>
 #include        <gobject/gobject.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
 
 /* --- type macros --- */
 #define G_IS_PARAM_SPEC_CHAR(pspec)      (G_TYPE_CHECK_INSTANCE_TYPE ((pspec), G_TYPE_PARAM_CHAR))
@@ -315,9 +311,6 @@
                                          GType           object_type,
                                          GParamFlags     flags);
 
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_PARAMSPECS_H__ */
diff -ruN glib-cvs/gobject/gsignal.h glib/gobject/gsignal.h
--- glib-cvs/gobject/gsignal.h	Fri Feb 23 14:03:31 2001
+++ glib/gobject/gsignal.h	Sun Mar  4 15:34:47 2001
@@ -25,11 +25,7 @@
 #include	<gobject/gparam.h>
 #include	<gobject/gmarshal.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
 
 /* --- typedefs --- */
 typedef struct _GSignalQuery		 GSignalQuery;
@@ -217,9 +213,6 @@
 void	 g_signal_handlers_destroy	      (gpointer		  instance);
 void	 _g_signals_destroy		      (GType		  itype);
 
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_SIGNAL_H__ */
diff -ruN glib-cvs/gobject/gtype.h glib/gobject/gtype.h
--- glib-cvs/gobject/gtype.h	Mon Feb 19 11:36:27 2001
+++ glib/gobject/gtype.h	Sun Mar  4 15:34:47 2001
@@ -22,11 +22,7 @@
 extern const char *g_log_domain_gruntime;
 #include        <glib.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
 
 /* Basic Type Macros
  */
@@ -360,9 +356,6 @@
 #define	G_TYPE_FLAG_RESERVED_ID_BIT	(1 << 30)
 extern GTypeDebugFlags			_g_type_debug_flags;
 
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_TYPE_H__ */
diff -ruN glib-cvs/gobject/gtypeplugin.h glib/gobject/gtypeplugin.h
--- glib-cvs/gobject/gtypeplugin.h	Thu Jan 25 19:37:22 2001
+++ glib/gobject/gtypeplugin.h	Sun Mar  4 15:34:47 2001
@@ -22,12 +22,7 @@
 
 #include	<gobject/gtype.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
+G_BEGIN_DECLS
 
 /* --- type macros --- */
 #define G_TYPE_TYPE_PLUGIN		(g_type_plugin_get_type ())
@@ -74,12 +69,6 @@
 						 GType            instance_type,
 						 GInterfaceInfo  *info);
 
-
-
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_TYPE_PLUGIN_H__ */
diff -ruN glib-cvs/gobject/gvalue.h glib/gobject/gvalue.h
--- glib-cvs/gobject/gvalue.h	Mon Feb 19 11:36:28 2001
+++ glib/gobject/gvalue.h	Sun Mar  4 15:34:47 2001
@@ -24,10 +24,7 @@
 
 #include	<gobject/gtype.h>
 
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
 
 /* --- type macros --- */
 #define	G_TYPE_IS_VALUE(type)		(g_type_value_table_peek (type) != NULL)
@@ -84,8 +81,6 @@
 #define G_VALUE_NOCOPY_CONTENTS		(1 << 27)
 
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_VALUE_H__ */
diff -ruN glib-cvs/gobject/gvaluecollector.h glib/gobject/gvaluecollector.h
--- glib-cvs/gobject/gvaluecollector.h	Mon Feb 19 11:36:28 2001
+++ glib/gobject/gvaluecollector.h	Sun Mar  4 15:34:47 2001
@@ -21,11 +21,7 @@
 #ifndef __G_VALUE_COLLECTOR_H__
 #define __G_VALUE_COLLECTOR_H__
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
 
 /* we may want to add aggregate types here some day, if requested
  * by users. the basic C types are covered already, everything
@@ -144,10 +140,6 @@
 
 #define	G_VALUE_COLLECT_FORMAT_MAX_LENGTH	(8)
 
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_VALUE_COLLECTOR_H__ */
diff -ruN glib-cvs/gobject/gvaluetypes.h glib/gobject/gvaluetypes.h
--- glib-cvs/gobject/gvaluetypes.h	Mon Feb 19 11:36:28 2001
+++ glib/gobject/gvaluetypes.h	Sun Mar  4 15:34:47 2001
@@ -24,11 +24,7 @@
 
 #include	<gobject/gvalue.h>
 
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
+G_BEGIN_DECLS
 
 /* --- type macros --- */
 #define G_IS_VALUE_CHAR(value)		(G_TYPE_CHECK_VALUE_TYPE ((value), G_TYPE_CHAR))
@@ -89,8 +85,6 @@
 						 gpointer     *callback_func,
 						 gpointer     *callback_data);
 
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+G_END_DECLS
 
 #endif /* __G_VALUETYPES_H__ */
diff -ruN glib-cvs/gobject/makefile.mingw.in glib/gobject/makefile.mingw.in
--- glib-cvs/gobject/makefile.mingw.in	Mon Jan 29 11:25:38 2001
+++ glib/gobject/makefile.mingw.in	Sun Mar  4 15:34:47 2001
@@ -15,7 +15,7 @@
 # Nothing much configurable below
 
 INCLUDES = -I .. -I .
-DEFINES = -DHAVE_CONFIG_H -DGOBJECT_COMPILATION -DG_LOG_DOMAIN=g_log_domain_gruntime -DG_ENABLE_DEBUG
+DEFINES = -DHAVE_CONFIG_H -DGOBJECT_COMPILATION -DG_LOG_DOMAIN=g_log_domain_gruntime -DG_ENABLE_DEBUG -DDLL_EXPORT
 
 srcdir=.
 
diff -ruN glib-cvs/gobject/makefile.msc.in glib/gobject/makefile.msc.in
--- glib-cvs/gobject/makefile.msc.in	Thu Feb 22 16:28:55 2001
+++ glib/gobject/makefile.msc.in	Sun Mar  4 15:34:47 2001
@@ -13,7 +13,7 @@
 # Nothing much configurable below
 
 INCLUDES = -I .. -I .
-DEFINES = -DHAVE_CONFIG_H -DGOBJECT_COMPILATION -DG_LOG_DOMAIN=g_log_domain_gruntime -DG_ENABLE_DEBUG
+DEFINES = -DHAVE_CONFIG_H -DGOBJECT_COMPILATION -DG_LOG_DOMAIN=g_log_domain_gruntime -DG_ENABLE_DEBUG -DDLL_EXPORT
 
 all :				\
 	gobject-$(GLIB_VER).dll	\
diff -ruN glib-cvs/gshell.c glib/gshell.c
--- glib-cvs/gshell.c	Thu Jan 25 18:42:27 2001
+++ glib/gshell.c	Sun Mar  4 15:34:47 2001
@@ -46,7 +46,7 @@
  * Otherwise double quotes preserve things literally.
  */
 
-gboolean 
+static gboolean 
 unquote_string_inplace (gchar* str, gchar** end, GError** err)
 {
   gchar* dest;
diff -ruN glib-cvs/gspawn-win32-helper.c glib/gspawn-win32-helper.c
--- glib-cvs/gspawn-win32-helper.c	Thu Jan 25 18:42:28 2001
+++ glib/gspawn-win32-helper.c	Sun Mar  4 15:34:47 2001
@@ -19,6 +19,8 @@
  * Boston, MA 02111-1307, USA.
  */
 
+#undef G_LOG_DOMAIN
+#include "glib.h"
 #define GSPAWN_HELPER
 #include "gspawn-win32.c"	/* For shared definitions */
 
diff -ruN glib-cvs/gstrfuncs.c glib/gstrfuncs.c
--- glib-cvs/gstrfuncs.c	Mon Feb 19 11:36:09 2001
+++ glib/gstrfuncs.c	Sun Mar  4 15:34:47 2001
@@ -678,10 +678,10 @@
 #ifdef HAVE_STRSIGNAL
 #if defined(G_OS_BEOS) || defined(G_WITH_CYGWIN)
 extern const char * strsignal(int);
-#else /* !G_OS_BEOS */
+#else /* !G_OS_BEOS && !G_WITH_CYGWIN */
   /* this is declared differently (const) in string.h on BeOS */
   extern char *strsignal (int sig);
-#endif /* !G_OS_BEOS */
+#endif /* !G_OS_BEOS && !G_WITH_CYGWIN */
   return strsignal (signum);
 #elif NO_SYS_SIGLIST
   switch (signum)
diff -ruN glib-cvs/gthread/Makefile.am glib/gthread/Makefile.am
--- glib-cvs/gthread/Makefile.am	Thu Jan 25 19:37:24 2001
+++ glib/gthread/Makefile.am	Sun Mar  4 15:34:47 2001
@@ -18,18 +18,22 @@
 		makefile.msc		\
 		gthread.rc
 
-libglib = $(top_builddir)/libglib.la # -lglib
+libglib = $(top_builddir)/libglib-1.3.la
 
 top_builddir_full=`cd \$(top_builddir); pwd`
 
 lib_LTLIBRARIES = libgthread-1.3.la
 
+if OS_WIN32
+export_symbols = -export-symbols gthread.def
+endif
+
 libgthread_1_3_la_SOURCES = gthread-impl.c
 libgthread_1_3_la_LDFLAGS = \
 	-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
-	-export-dynamic
+	-export-dynamic -no-undefined $(export_symbols)
 
-libgthread_1_3_la_LIBADD = @G_THREAD_LIBS_EXTRA@ @G_THREAD_LIBS@
+libgthread_1_3_la_LIBADD = @G_THREAD_LIBS_EXTRA@ @G_THREAD_LIBS@ $(libglib)
 
 gthread.rc: $(top_builddir)/config.status $(top_srcdir)/gthread/gthread.rc.in
 	cd $(top_builddir) && CONFIG_FILES=gthread/$@ CONFIG_HEADERS= $(SHELL) ./config.status
diff -ruN glib-cvs/gthread/gthread-impl.c glib/gthread/gthread-impl.c
--- glib-cvs/gthread/gthread-impl.c	Fri Feb  2 15:25:02 2001
+++ glib/gthread/gthread-impl.c	Sun Mar  4 15:34:47 2001
@@ -318,7 +318,7 @@
   else
     g_thread_use_default_impl = FALSE;
 
-#if defined (G_OS_WIN32) && defined (__GNUC__)
+#if defined (G_PLATFORM_WIN32) && defined (__GNUC__)
   memcpy(&g_thread_functions_for_glib_use, init, sizeof (*init));
 #else
   g_thread_functions_for_glib_use = *init;
diff -ruN glib-cvs/gthread/makefile.mingw.in glib/gthread/makefile.mingw.in
--- glib-cvs/gthread/makefile.mingw.in	Mon Jan 29 11:25:39 2001
+++ glib/gthread/makefile.mingw.in	Sun Mar  4 15:34:47 2001
@@ -15,7 +15,7 @@
 # Nothing much configurable below
 
 INCLUDES = -I .. -I .
-DEFINES = -DHAVE_CONFIG_H -DG_LOG_DOMAIN=\"GThread\" -DG_ENABLE_DEBUG
+DEFINES = -DHAVE_CONFIG_H -DG_LOG_DOMAIN=\"GThread\" -DG_ENABLE_DEBUG -DDLL_EXPORT
 DEPCFLAGS = $(PTHREAD_CFLAGS)
 
 BUILD_DLL = ../build-dll
diff -ruN glib-cvs/gthread/makefile.msc.in glib/gthread/makefile.msc.in
--- glib-cvs/gthread/makefile.msc.in	Thu Jan 25 19:37:26 2001
+++ glib/gthread/makefile.msc.in	Sun Mar  4 15:34:47 2001
@@ -15,7 +15,7 @@
 # Nothing much configurable below
 
 INCLUDES = -I .. -I .
-DEFINES = -DHAVE_CONFIG_H -DG_LOG_DOMAIN=\"GThread\" -DG_ENABLE_DEBUG
+DEFINES = -DHAVE_CONFIG_H -DG_LOG_DOMAIN=\"GThread\" -DG_ENABLE_DEBUG -DDLL_EXPORT
 DEPCFLAGS = $(PTHREAD_CFLAGS)
 
 all : \
diff -ruN glib-cvs/gthread.c glib/gthread.c
--- glib-cvs/gthread.c	Mon Feb 26 10:55:42 2001
+++ glib/gthread.c	Sun Mar  4 15:34:47 2001
@@ -111,7 +111,7 @@
 gboolean g_thread_use_default_impl = TRUE;
 gboolean g_threads_got_initialized = FALSE;
 
-#if defined(G_OS_WIN32) && defined(__GNUC__)
+#if defined(G_PLATFORM_WIN32) && defined(__GNUC__) && defined(DLL_EXPORT)
 __declspec(dllexport)
 #endif
 GThreadFunctions g_thread_functions_for_glib_use = {
diff -ruN glib-cvs/gtimer.c glib/gtimer.c
--- glib-cvs/gtimer.c	Thu Jan 25 19:36:13 2001
+++ glib/gtimer.c	Sun Mar  4 15:34:47 2001
@@ -59,6 +59,14 @@
   guint active : 1;
 };
 
+#ifdef G_OS_WIN32
+#  define GETTIME(v) \
+     v = GetTickCount ()
+#else /* !G_OS_WIN32 */
+#  define GETTIME(v) \
+     gettimeofday (&v, NULL)
+#endif /* !G_OS_WIN32 */
+
 GTimer*
 g_timer_new (void)
 {
@@ -67,11 +75,7 @@
   timer = g_new (GRealTimer, 1);
   timer->active = TRUE;
 
-#ifdef G_OS_WIN32
-  timer->start = GetTickCount ();
-#else /* !G_OS_WIN32 */
-  gettimeofday (&timer->start, NULL);
-#endif /* !G_OS_WIN32 */
+  GETTIME (timer->start);
 
   return ((GTimer*) timer);
 }
@@ -94,11 +98,7 @@
   rtimer = (GRealTimer*) timer;
   rtimer->active = TRUE;
 
-#ifdef G_OS_WIN32
-  rtimer->start = GetTickCount ();
-#else /* !G_OS_WIN32 */
-  gettimeofday (&rtimer->start, NULL);
-#endif /* !G_OS_WIN32 */
+  GETTIME (rtimer->start);
 }
 
 void
@@ -111,11 +111,7 @@
   rtimer = (GRealTimer*) timer;
   rtimer->active = FALSE;
 
-#ifdef G_OS_WIN32
-  rtimer->end = GetTickCount ();
-#else /* !G_OS_WIN32 */
-  gettimeofday (&rtimer->end, NULL);
-#endif /* !G_OS_WIN32 */
+  GETTIME(rtimer->end);
 }
 
 void
@@ -152,10 +148,7 @@
   if (rtimer->active)
     rtimer->end = GetTickCount ();
 
-  /* Check for wraparound, which happens every 49.7 days.
-   * No, Win95 machines probably are never running for that long,
-   * but NT machines are.
-   */
+  /* Check for wraparound, which happens every 49.7 days. */
   if (rtimer->end < rtimer->start)
     total = (UINT_MAX - (rtimer->start - rtimer->end)) / 1000.0;
   else
diff -ruN glib-cvs/gtypes.h glib/gtypes.h
--- glib-cvs/gtypes.h	Mon Feb 12 11:47:07 2001
+++ glib/gtypes.h	Sun Mar  4 15:34:47 2001
@@ -327,15 +327,25 @@
 /* We prefix variable declarations so they can
  * properly get exported in windows dlls.
  */
-#ifdef G_OS_WIN32
-#  ifdef GLIB_COMPILATION
-#    define GLIB_VAR __declspec(dllexport)
-#  else /* !GLIB_COMPILATION */
-#    define GLIB_VAR extern __declspec(dllimport)
-#  endif /* !GLIB_COMPILATION */
-#else /* !G_OS_WIN32 */
-#  define GLIB_VAR extern
-#endif /* !G_OS_WIN32 */
+#ifndef GLIB_VAR
+#  ifdef G_PLATFORM_WIN32
+#    ifdef GLIB_STATIC_COMPILATION
+#      define GLIB_VAR extern
+#    else /* !GLIB_STATIC_COMPILATION */
+#      ifdef GLIB_COMPILATION
+#        ifdef DLL_EXPORT
+#          define GLIB_VAR __declspec(dllexport)
+#        else /* !DLL_EXPORT */
+#          define GLIB_VAR extern
+#        endif /* !DLL_EXPORT */
+#      else /* !GLIB_COMPILATION */
+#        define GLIB_VAR extern __declspec(dllimport)
+#      endif /* !GLIB_COMPILATION */
+#    endif /* !GLIB_STATIC_COMPILATION */
+#  else /* !G_PLATFORM_WIN32 */
+#    define GLIB_VAR extern
+#  endif /* !G_PLATFORM_WIN32 */
+#endif /* GLIB_VAR */
 
 #endif /* __G_TYPES_H__ */
 
diff -ruN glib-cvs/gutf8.c glib/gutf8.c
--- glib-cvs/gutf8.c	Mon Jan 29 11:25:09 2001
+++ glib/gutf8.c	Sun Mar  4 15:34:47 2001
@@ -29,10 +29,11 @@
 
 #include "glib.h"
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 #include <stdio.h>
 #define STRICT
 #include <windows.h>
+#undef STRICT
 #endif
 
 #include "glibintl.h"
@@ -341,7 +342,7 @@
     }
 #endif
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
   if (a && ! *a)
     {
       static char codepage[10];
diff -ruN glib-cvs/gutils.c glib/gutils.c
--- glib-cvs/gutils.c	Fri Mar  2 12:31:40 2001
+++ glib/gutils.c	Sun Mar  4 15:34:47 2001
@@ -64,11 +64,14 @@
 #define G_PATH_LENGTH   2048
 #endif
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 #  define STRICT			/* Strict typing, please */
 #  include <windows.h>
 #  undef STRICT
 #  include <ctype.h>
+#endif /* G_PLATFORM_WIN32 */
+
+#ifdef G_OS_WIN32
 #  include <direct.h>
 #endif /* G_OS_WIN32 */
 
@@ -267,7 +270,9 @@
       
       path = "/bin:/usr/bin:.";
     }
-#else
+#endif /* G_OS_UNIX */
+
+#ifdef G_PLATFORM_WIN32
   {
     gchar *tmp;
     gchar moddir[MAXPATHLEN], sysdir[MAXPATHLEN], windir[MAXPATHLEN];
@@ -276,14 +281,16 @@
     tmp = g_path_get_dirname (moddir);
     GetSystemDirectory (sysdir, sizeof (sysdir));
     GetWindowsDirectory (windir, sizeof (windir));
-    path_tmp = g_strconcat (tmp, ";.;", sysdir, ";", windir,
-			    (path != NULL ? ";" : NULL),
+    path_tmp = g_strconcat (tmp,
+			    G_SEARCHPATH_SEPARATOR_S "." G_SEARCHPATH_SEPARATOR_S,
+			    sysdir, G_SEARCHPATH_SEPARATOR_S, windir,
+			    (path != NULL ? G_SEARCHPATH_SEPARATOR_S : NULL),
 			    (path != NULL ? path : NULL),
 			    NULL);
     g_free (tmp);
     path = path_tmp;
   }
-#endif
+#endif /* G_PLATFORM_WIN32 */
   
   len = strlen (program) + 1;
   pathlen = strlen (path);
@@ -560,8 +567,8 @@
 {
   g_return_val_if_fail (file_name != NULL, NULL);
   
-#ifdef G_OS_WIN32
-  /* Skip \\server\share */
+#ifdef G_PLATFORM_WIN32
+  /* Skip \\server\share (Win32) or //server/share (Cygwin) */
   if (file_name[0] == G_DIR_SEPARATOR &&
       file_name[1] == G_DIR_SEPARATOR &&
       file_name[2])
@@ -583,7 +590,7 @@
 	  return (gchar *)file_name;
 	}
     }
-#endif
+#endif /* G_PLATFORM_WIN32 */
   
   /* Skip initial slashes */
   if (file_name[0] == G_DIR_SEPARATOR)
@@ -1087,7 +1094,7 @@
   char *result = nl_langinfo (CODESET);
   return g_strdup (result);
 #else
-#ifndef G_OS_WIN32
+#ifndef G_PLATFORM_WIN32
   /* FIXME: Do something more intelligent based on setlocale (LC_CTYPE, NULL)
    */
   return g_strdup ("ISO-8859-1");
@@ -1101,8 +1108,8 @@
 
 #include <libintl.h>
 
-
-#ifdef G_OS_WIN32
+#ifndef GLIB_LOCALE_DIR
+#ifdef G_PLATFORM_WIN32
 
 #define GLIB_LOCALE_DIR					       	\
   g_win32_get_package_installation_subdirectory			\
@@ -1111,7 +1118,8 @@
 				     GLIB_MINOR_VERSION),	\
    "locale")
 
-#endif /* G_OS_WIN32 */
+#endif /* G_PLATFORM_WIN32 */
+#endif /* !GLIB_LOCALE_DIR */
 
 G_CONST_RETURN gchar *
 _glib_gettext (const gchar *str)
diff -ruN glib-cvs/gwin32.c glib/gwin32.c
--- glib-cvs/gwin32.c	Mon Feb 12 11:47:09 2001
+++ glib/gwin32.c	Sun Mar  4 15:34:47 2001
@@ -42,16 +42,25 @@
 
 #define STRICT			/* Strict typing, please */
 #include <windows.h>
+#undef STRICT
+#ifndef G_WITH_CYGWIN
 #include <direct.h>
+#endif
 #include <errno.h>
 #include <ctype.h>
 #ifdef _MSC_VER
 #  include <io.h>
 #endif /* _MSC_VER */
 
+#ifdef G_WITH_CYGWIN
+#include <sys/cygwin.h>
+#endif
+
 #include "glib.h"
 
-int
+#ifndef G_WITH_CYGWIN
+
+gint
 g_win32_ftruncate (gint  fd,
 		   guint size)
 {
@@ -215,7 +224,9 @@
   return 0;
 }
 
-/* Mingw32 headers don't have latest language and sublanguage codes */
+#endif /* !G_WITH_CYGWIN */
+
+/* Mingw headers don't have latest language and sublanguage codes */
 #ifndef LANG_AFRIKAANS
 #define LANG_AFRIKAANS 0x36
 #endif
@@ -873,12 +884,23 @@
   if (!GetModuleFileName (hmodule, fn, MAX_PATH))
     return NULL;
 
-  if ((p = strrchr (fn, '\\')) != NULL)
+#ifdef G_WITH_CYGWIN
+  /* In Cygwin we need to have POSIX paths */
+  {
+    gchar tmp[MAX_PATH];
+
+    cygwin_conv_to_posix_path(fn, tmp);
+    g_free(fn);
+    fn = g_strdup(tmp);
+  }
+#endif
+
+  if ((p = strrchr (fn, G_DIR_SEPARATOR)) != NULL)
     *p = '\0';
 
   if (module_name)
     {
-      p = strrchr (fn, '\\');
+      p = strrchr (fn, G_DIR_SEPARATOR);
       if (p && (g_strcasecmp (p + 1, "bin") == 0 ||
 		g_strcasecmp (p + 1, "lib") == 0))
 	*p = '\0';
@@ -927,7 +949,6 @@
   static GHashTable *package_dirs = NULL;
   gchar *result = NULL;
   gchar *key;
-  char win_dir[MAX_PATH];
   HKEY reg_key = NULL;
   DWORD type;
   DWORD nbytes;
@@ -961,7 +982,16 @@
 	RegCloseKey (reg_key);
       
       g_free (key);
-      
+#ifdef G_WITH_CYGWIN
+      /* In Cygwin we need to have POSIX paths */
+      {
+        gchar tmp[MAX_PATH];
+
+        cygwin_conv_to_posix_path(result, tmp);
+        g_free(result);
+        result = g_strdup(tmp);
+      }
+#endif /* G_WITH_CYGWIN */
     }
   if (result)
     {
@@ -1001,7 +1031,8 @@
 
   prefix = g_win32_get_package_installation_directory (package, dll_name);
 
-  sep = (prefix[strlen (prefix) - 1] == '\\' ? "" : "\\");
+  sep = (prefix[strlen (prefix) - 1] == G_DIR_SEPARATOR ?
+	 "" : G_DIR_SEPARATOR_S);
 
   return g_strconcat (prefix, sep, subdir, NULL);
 }
diff -ruN glib-cvs/gwin32.h glib/gwin32.h
--- glib-cvs/gwin32.h	Mon Feb 19 11:36:11 2001
+++ glib/gwin32.h	Sun Mar  4 15:34:47 2001
@@ -29,19 +29,23 @@
 
 #include <gtypes.h>
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
 
 /* Windows emulation stubs for common Unix functions
  */
 
 G_BEGIN_DECLS
 
+#ifndef MAXPATHLEN
 #define MAXPATHLEN 1024
+#endif
 
 #ifdef _MSC_VER
 typedef int pid_t;
 #endif
 
+#ifdef G_OS_WIN32
+
 /*
  * To get prototypes for the following POSIXish functions, you have to
  * include the indicated non-POSIX headers. The functions are defined
@@ -89,13 +93,15 @@
 typedef struct DIR DIR;
 
 /* emulation functions */
-extern int	g_win32_ftruncate	(gint		 f,
+gint		g_win32_ftruncate	(gint		 f,
 					 guint		 size);
 DIR*		g_win32_opendir		(const gchar	*dirname);
 struct dirent*	g_win32_readdir  	(DIR		*dir);
 void		g_win32_rewinddir 	(DIR		*dir);
 gint		g_win32_closedir  	(DIR		*dir);
 
+#endif /* G_OS_WIN32 */
+
 /* The MS setlocale uses locale names of the form "English_United
  * States.1252" etc. We want the Unixish standard form "en", "zh_TW"
  * etc. This function gets the current thread locale from Windows and
@@ -119,6 +125,6 @@
 
 G_END_DECLS
 
-#endif	 /* G_OS_WIN32 */
+#endif	 /* G_PLATFORM_WIN32 */
 
 #endif /* __G_WIN32_H__ */
diff -ruN glib-cvs/makefile.mingw.in glib/makefile.mingw.in
--- glib-cvs/makefile.mingw.in	Thu Feb 22 16:28:42 2001
+++ glib/makefile.mingw.in	Sun Mar  4 15:34:47 2001
@@ -15,7 +15,7 @@
 # Nothing much configurable below
 
 INCLUDES = -I .
-DEFINES = -DHAVE_CONFIG_H -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib -DG_ENABLE_DEBUG
+DEFINES = -DHAVE_CONFIG_H -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib -DG_ENABLE_DEBUG -DDLL_EXPORT
 DEPCFLAGS = $(INTL_CFLAGS) $(LIBICONV_CFLAGS)
 
 DLLS_TO_BUILD =				\
diff -ruN glib-cvs/makefile.msc.in glib/makefile.msc.in
--- glib-cvs/makefile.msc.in	Thu Mar  1 14:23:20 2001
+++ glib/makefile.msc.in	Sun Mar  4 15:34:47 2001
@@ -13,7 +13,7 @@
 # Nothing much configurable below
 
 INCLUDES = -I .
-DEFINES = -DHAVE_CONFIG_H -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib -DG_ENABLE_DEBUG
+DEFINES = -DHAVE_CONFIG_H -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib -DG_ENABLE_DEBUG -DDLL_EXPORT
 DEPCFLAGS = $(INTL_CFLAGS) $(LIBICONV_CFLAGS)
 
 DLLS_TO_BUILD =			\
diff -ruN glib-cvs/testglib.c glib/testglib.c
--- glib-cvs/testglib.c	Fri Mar  2 12:31:40 2001
+++ glib/testglib.c	Sun Mar  4 15:34:47 2001
@@ -46,8 +46,8 @@
 #include <io.h>			/* For read(), write() etc */
 #endif
 
-int array[10000];
-gboolean failed = FALSE;
+static int array[10000];
+static gboolean failed = FALSE;
 
 #define	TEST(m,cond)	G_STMT_START { failed = !(cond); \
 if (failed) \
@@ -351,6 +351,9 @@
     { "a\\b\\", "a\\b" },
     { "c\\\\\\", "c" },
 #endif
+#ifdef G_WITH_CYGWIN
+    { "//server/share///x", "//server/share" },
+#endif
     { ".", "." },
     { "..", "." },
     { "", "." },
@@ -374,6 +377,9 @@
     { "\\\\server\\foo\\bar", "bar" },
     { "a\\b", NULL },
 #endif
+#ifdef G_WITH_CYGWIN
+    { "//server/share///x", "//x" },
+#endif
     { ".", NULL },
     { "", NULL },
   };
@@ -393,9 +399,16 @@
   char *name_used;
   gchar *p;
 #ifdef G_OS_WIN32
-  gchar *glib_dll = g_strdup_printf ("glib-%d.%d.dll",
+  gchar *glib_dll = g_strdup_printf ("glib-%d.%d-%d.dll",
+				     GLIB_MAJOR_VERSION,
+				     GLIB_MINOR_VERSION,
+				     GLIB_MICRO_VERSION);
+#endif
+#ifdef G_WITH_CYGWIN
+  gchar *glib_dll = g_strdup_printf ("cygglib-%d.%d-%d.dll",
 				     GLIB_MAJOR_VERSION,
-				     GLIB_MINOR_VERSION);
+				     GLIB_MINOR_VERSION,
+				     GLIB_MICRO_VERSION);
 #endif
 
   g_print ("TestGLib v%u.%u.%u (i:%u b:%u)\n",
@@ -781,7 +794,7 @@
   for (i = 0; i < 10000; i++)
     g_string_append_c (string1, 'a'+(i%26));
 
-#ifndef G_OS_WIN32
+#ifndef G_PLATFORM_WIN32
   /* MSVC, mingw32 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",
@@ -1151,7 +1164,7 @@
 
   g_print ("ok\n");
 
-#ifdef G_OS_WIN32
+#ifdef G_PLATFORM_WIN32
   g_print ("current locale: %s\n", g_win32_getlocale ());
 
   g_print ("GLib installation directory, from Registry entry for %s if available: %s\n",
diff -ruN glib-cvs/tests/Makefile.am glib/tests/Makefile.am
--- glib-cvs/tests/Makefile.am	Mon Feb  5 10:06:54 2001
+++ glib/tests/Makefile.am	Sun Mar  4 15:36:20 2001
@@ -3,6 +3,11 @@
 
 EFENCE=
 
+libglib = $(top_builddir)/libglib-1.3.la
+libgthread = $(top_builddir)/gthread/libgthread-1.3.la
+libgmodule = $(top_builddir)/gmodule/libgmodule-1.3.la
+libgobject = $(top_builddir)/gobject/libgobject-1.3.la
+
 EXTRA_DIST = \
 	$(test_scripts)		\
 	makefile.msc.in		\
@@ -45,9 +50,9 @@
 TESTS = $(test_programs) $(test_scripts)
 TESTS_ENVIRONMENT = srcdir=$(srcdir)
 
-progs_LDADD = $(EFENCE) $(top_builddir)/libglib-1.3.la $(EFENCE)
-thread_LDADD = $(top_builddir)/gthread/libgthread-1.3.la @G_THREAD_LIBS@ $(progs_LDADD)
-module_LDADD = $(top_builddir)/gmodule/libgmodule-1.3.la @G_MODULE_LIBS@ $(progs_LDADD)
+progs_LDADD = $(EFENCE) $(libglib) $(EFENCE)
+thread_LDADD = $(libgthread) @G_THREAD_LIBS@ $(progs_LDADD)
+module_LDADD = $(libgmodule) @G_MODULE_LIBS@ $(progs_LDADD)
 
 array_test_LDADD = $(progs_LDADD)
 date_test_LDADD = $(progs_LDADD)
@@ -81,12 +86,12 @@
 	:
 
 libmoduletestplugin_a_la_SOURCES = libmoduletestplugin_a.c
-libmoduletestplugin_a_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module
-libmoduletestplugin_a_la_LIBADD = @G_MODULE_LIBS@ 
+libmoduletestplugin_a_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module -no-undefined
+libmoduletestplugin_a_la_LIBADD = @G_MODULE_LIBS@ $(libgmodule) $(libglib)
 
 libmoduletestplugin_b_la_SOURCES = libmoduletestplugin_b.c
-libmoduletestplugin_b_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module
-libmoduletestplugin_b_la_LIBADD = @G_MODULE_LIBS@  
+libmoduletestplugin_b_la_LDFLAGS = @G_MODULE_LDFLAGS@ -avoid-version -module -no-undefined
+libmoduletestplugin_b_la_LIBADD = @G_MODULE_LIBS@ $(libgmodule) $(libglib)
 
 makefile.msc: $(top_builddir)/config.status $(top_srcdir)/tests/makefile.msc.in
 	cd $(top_builddir) && CONFIG_FILES=tests/$@ CONFIG_HEADERS= $(SHELL) ./config.status


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]