Fix build on Windows and possibly other non-Linux platforms
authorTor Lillqvist <tml@iki.fi>
Mon, 6 Sep 2010 12:56:16 +0000 (15:56 +0300)
committerTor Lillqvist <tml@iki.fi>
Mon, 6 Sep 2010 12:57:32 +0000 (15:57 +0300)
Include glibconfig.h in files that test G_OS_WIN32. Include headers
for GLib APIs used conditionally where needed.

glib/gbacktrace.c
glib/gconvert.c
glib/gdate.c
glib/gfileutils.c
glib/gmain.c
glib/gpoll.c
glib/gslice.c
glib/gstdio.c
glib/gtimer.c
glib/gutils.c

index 55457e2..ae16ef8 100644 (file)
@@ -30,6 +30,7 @@
  */
 
 #include "config.h"
+#include "glibconfig.h"
 
 #include <signal.h>
 #include <stdarg.h>
index e44a772..52a3dd8 100644 (file)
@@ -21,6 +21,7 @@
  */
 
 #include "config.h"
+#include "glibconfig.h"
 
 #ifndef G_OS_WIN32
 #include <iconv.h>
 #include "gthreadprivate.h"
 #include "gunicode.h"
 
+#ifdef NEED_ICONV_CACHE
+#include "glist.h"
+#include "ghash.h"
+#endif
+
 #include "glibintl.h"
 
 #if defined(USE_LIBICONV_GNU) && !defined (_LIBICONV_H)
index 60066ee..2fab2f2 100644 (file)
@@ -29,6 +29,7 @@
  */
 
 #include "config.h"
+#include "glibconfig.h"
 
 #define DEBUG_MSG(x)   /* */
 #ifdef G_ENABLE_DEBUG
 #include "gthread.h"
 #include "gunicode.h"
 
+#ifdef G_OS_WIN32
+#include "garray.h"
+#endif
+
 GDate*
 g_date_new (void)
 {
index 0bc4980..185a756 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "config.h"
+#include "glibconfig.h"
 
 #include <sys/stat.h>
 #ifdef HAVE_UNISTD_H
index 78de717..91e2a8e 100644 (file)
  * MT safe
  */
 
+#ifndef _WIN32
 /* for pipe2; need to define it first to avoid
  * other headers pulling in unistd.h
  */
+/* The meaning of_GNU_SOURCE that is intended here is present only on
+ * Linux; avoid the possibility that some misguided header in MinGW
+ * looks at it. Ideally we should define _GNU_SOURCE only on platforms
+ * where we know what it means and that is what we want here
+ * (i.e. Linux with glibc). After all, there might be some other POSIX
+ * platform even where _GNU_SOURCE is used for some unrelated change
+ * in semantics that isn't wanted. Sigh.
+ */
 #define _GNU_SOURCE
+#endif
 
 #include "config.h"
 #include "glibconfig.h"
 #include "gtestutils.h"
 #include "gthreadprivate.h"
 
+#ifdef G_OS_WIN32
+#include "gwin32.h"
+#endif
+
+#ifdef  G_MAIN_POLL_DEBUG
+#include "gtimer.h"
+#endif
+
 /**
  * SECTION:main
  * @title: The Main Event Loop
index 003b011..49bf723 100644 (file)
 
 #include "gpoll.h"
 
+#ifdef G_OS_WIN32
+#include "gprintf.h"
+#endif
+
 #ifdef G_MAIN_POLL_DEBUG
 extern gboolean _g_main_poll_debug;
 #endif
index 324169b..05de6b3 100644 (file)
@@ -19,6 +19,7 @@
 /* MT safe */
 
 #include "config.h"
+#include "glibconfig.h"
 
 #if     defined HAVE_POSIX_MEMALIGN && defined POSIX_MEMALIGN_WITH_COMPLIANT_ALLOCS
 #  define HAVE_COMPLIANT_POSIX_MEMALIGN 1
index 786275a..fb5a9fb 100644 (file)
@@ -19,6 +19,7 @@
  */
 
 #include "config.h"
+#include "glibconfig.h"
 
 #define G_STDIO_NO_WRAP_ON_UNIX
 
index 0e2bcce..bc5b54c 100644 (file)
@@ -37,9 +37,9 @@
 #include <unistd.h>
 #endif /* HAVE_UNISTD_H */
 
-#ifndef G_OS_WIN32
 #include <sys/time.h>
 #include <time.h>
+#ifndef G_OS_WIN32
 #include <errno.h>
 #endif /* G_OS_WIN32 */
 
index e28f6f3..49bbadb 100644 (file)
 #include "gstrfuncs.h"
 #include "glibintl.h"
 
+#ifdef G_PLATFORM_WIN32
+#include "garray.h"
+#include "gconvert.h"
+#include "gwin32.h"
+#endif
+
 #ifdef MAXPATHLEN
 #define        G_PATH_LENGTH   MAXPATHLEN
 #elif  defined (PATH_MAX)