Cygwin support contributed by Stefan Ondrejicka <ondrej@idata.sk>.
authorTor Lillqvist <tml@iki.fi>
Fri, 9 Mar 2001 21:23:33 +0000 (21:23 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Fri, 9 Mar 2001 21:23:33 +0000 (21:23 +0000)
2001-02-21  Tor Lillqvist  <tml@iki.fi>

Cygwin support contributed by Stefan Ondrejicka
<ondrej@idata.sk>. Hopefully I got it all in while simultaneously
adding support for auto*/libtool for mingw.

* Makefile.am: Changes for auto* support on Cygwin and Win32. Do
still distribute the hand-written makefiles and *.win32.in files,
though. Use GIO, GSPAWN and PLATFORMDEP macros set by configure.
Use -no-undefined. Pass -export-symbols glib.def to libtool.

* configure.in: Define G_PLATFORM_WIN32 on both pure Win32 (mingw)
and Cygwin. Add AC_CYGWIN, AC_EXEEXT and AC_LIBTOOL_WIN32_DLL
calls for Cygwin and mingw support.  Check for %I64u guint64
format (in MS C library). Set G_MODULE_IMPL on mingw and
Cygwin. Use ac_object and ac_exeext.  Set GIO, GSPAWN, PLATFORMDEP
and G_LIBS_EXTRA. Compile timeloop only on Unix. Define OS_WIN32
automake conditional on Win32.

* glib.h: Include gwin32.h also on Cygwin.

* gfileutils.c (get_contents_posix): Use O_BINARY (defined as 0 on
Unix) for Cygwin's sake.

* gtimer.c (GETTIME): Reduce #ifdefs, use a macro GETTIME().

* gconvert.c
* gthread.c
* gutf8.c
* gutils.c: For code needed both on Cygwin and native Win32,
test for G_PLATFORM_WIN32.

* gmarkup.h: Use G_BEGIN_DECLS and G_END_DECLS.

* gtypes.h: Refine GLIB_VAR definition. Also check for DLL_EXPORT
in case compiling a static library on Win32 or Cygwin.

* gwin32.c: No <direct.h> on Cygwin. No need for ftruncate() or
dirent emulation on Cygwin.
(get_package_directory_from_module) Convert return value from
GetModuleFileName() to POSIX path on Cygwin.

* tests/Makefile.am (progs_LDADD): Link with libglib, libgthread
and libgmodule as appropriate. Use -no-undefined.

* gbacktrace.c: Move #ifdefs around a bit on Win32.

* gshell.c (unquote_string_inplace): Make static.

18 files changed:
glib.def
glib.h
glib/glib.def
glib/glib.h
glib/gmarkup.h
glib/gmessages.c
glib/gmessages.h
glib/gshell.c
glib/gspawn-win32-helper.c
glib/gstrfuncs.c
glib/gthread.c
gmarkup.h
gmessages.c
gmessages.h
gshell.c
gspawn-win32-helper.c
gstrfuncs.c
gthread.c

index a184f3c..62012cd 100644 (file)
--- a/glib.def
+++ b/glib.def
@@ -233,6 +233,7 @@ EXPORTS
        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 --git a/glib.h b/glib.h
index 689f2e8..937e319 100644 (file)
--- a/glib.h
+++ b/glib.h
@@ -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
 
index a184f3c..62012cd 100644 (file)
@@ -233,6 +233,7 @@ EXPORTS
        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
index 689f2e8..937e319 100644 (file)
@@ -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
 
index 57a7c1e..396e158 100644 (file)
 
 #include <gerror.h>
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
+G_BEGIN_DECLS
 
 typedef enum
 {
@@ -120,10 +117,7 @@ void                 g_markup_parse_context_get_position (GMarkupParseContext *c
 gchar* g_markup_escape_text (const gchar *text,
                              gint         length);
 
-
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
 
 #endif /* __G_MARKUP_H__ */
 
index 93122e5..c8ec37b 100644 (file)
@@ -91,6 +91,7 @@ static GPrivate* g_log_depth = NULL;
 #ifdef G_OS_WIN32
 #  define STRICT
 #  include <windows.h>
+#  undef STRICT
 #  include <process.h>          /* For _getpid() */
 
 static gboolean alloc_console_called = FALSE;
index a33657f..aa10eaf 100644 (file)
@@ -71,7 +71,7 @@ typedef void            (*GLogFunc)             (const gchar   *log_domain,
 
 /* 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,
index 0fe2fcd..79db9d3 100644 (file)
@@ -46,7 +46,7 @@ g_shell_error_quark (void)
  * Otherwise double quotes preserve things literally.
  */
 
-gboolean 
+static gboolean 
 unquote_string_inplace (gchar* str, gchar** end, GError** err)
 {
   gchar* dest;
index 08aeb44..6eebba5 100644 (file)
@@ -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 */
 
index cf9defb..0efc262 100644 (file)
@@ -677,11 +677,11 @@ g_strsignal (gint signum)
 
 #ifdef HAVE_STRSIGNAL
 #if defined(G_OS_BEOS) || defined(G_WITH_CYGWIN)
-extern const char * strsignal(int);
-#else /* !G_OS_BEOS */
+extern const char *strsignal(int);
+#else
   /* 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)
index 4393e8d..ef0f3c8 100644 (file)
@@ -111,7 +111,7 @@ static GSystemThread zero_thread; /* This is initialized to all zero */
 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__)
 __declspec(dllexport)
 #endif
 GThreadFunctions g_thread_functions_for_glib_use = {
index 57a7c1e..396e158 100644 (file)
--- a/gmarkup.h
+++ b/gmarkup.h
 
 #include <gerror.h>
 
-#ifdef __cplusplus
-extern "C"
-{
-#endif
+G_BEGIN_DECLS
 
 typedef enum
 {
@@ -120,10 +117,7 @@ void                 g_markup_parse_context_get_position (GMarkupParseContext *c
 gchar* g_markup_escape_text (const gchar *text,
                              gint         length);
 
-
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
 
 #endif /* __G_MARKUP_H__ */
 
index 93122e5..c8ec37b 100644 (file)
@@ -91,6 +91,7 @@ static GPrivate* g_log_depth = NULL;
 #ifdef G_OS_WIN32
 #  define STRICT
 #  include <windows.h>
+#  undef STRICT
 #  include <process.h>          /* For _getpid() */
 
 static gboolean alloc_console_called = FALSE;
index a33657f..aa10eaf 100644 (file)
@@ -71,7 +71,7 @@ typedef void            (*GLogFunc)             (const gchar   *log_domain,
 
 /* 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,
index 0fe2fcd..79db9d3 100644 (file)
--- a/gshell.c
+++ b/gshell.c
@@ -46,7 +46,7 @@ g_shell_error_quark (void)
  * Otherwise double quotes preserve things literally.
  */
 
-gboolean 
+static gboolean 
 unquote_string_inplace (gchar* str, gchar** end, GError** err)
 {
   gchar* dest;
index 08aeb44..6eebba5 100644 (file)
@@ -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 */
 
index cf9defb..0efc262 100644 (file)
@@ -677,11 +677,11 @@ g_strsignal (gint signum)
 
 #ifdef HAVE_STRSIGNAL
 #if defined(G_OS_BEOS) || defined(G_WITH_CYGWIN)
-extern const char * strsignal(int);
-#else /* !G_OS_BEOS */
+extern const char *strsignal(int);
+#else
   /* 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)
index 4393e8d..ef0f3c8 100644 (file)
--- a/gthread.c
+++ b/gthread.c
@@ -111,7 +111,7 @@ static GSystemThread zero_thread; /* This is initialized to all zero */
 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__)
 __declspec(dllexport)
 #endif
 GThreadFunctions g_thread_functions_for_glib_use = {