[glib] Fix build on Windows and possibly other non-Linux platforms
- From: Tor Lillqvist <tml src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Fix build on Windows and possibly other non-Linux platforms
- Date: Mon, 6 Sep 2010 13:03:59 +0000 (UTC)
commit 548ddd5fe92fd9e14e217e68930bd036bffadc5f
Author: Tor Lillqvist <tml iki fi>
Date: Mon Sep 6 15:56:16 2010 +0300
Fix build on Windows and possibly other non-Linux platforms
Include glibconfig.h in files that test G_OS_WIN32. Include headers
for GLib APIs used conditionally where needed.
glib/gbacktrace.c | 1 +
glib/gconvert.c | 6 ++++++
glib/gdate.c | 5 +++++
glib/gfileutils.c | 1 +
glib/gmain.c | 18 ++++++++++++++++++
glib/gpoll.c | 4 ++++
glib/gslice.c | 1 +
glib/gstdio.c | 1 +
glib/gtimer.c | 2 +-
glib/gutils.c | 6 ++++++
10 files changed, 44 insertions(+), 1 deletions(-)
---
diff --git a/glib/gbacktrace.c b/glib/gbacktrace.c
index 55457e2..ae16ef8 100644
--- a/glib/gbacktrace.c
+++ b/glib/gbacktrace.c
@@ -30,6 +30,7 @@
*/
#include "config.h"
+#include "glibconfig.h"
#include <signal.h>
#include <stdarg.h>
diff --git a/glib/gconvert.c b/glib/gconvert.c
index e44a772..52a3dd8 100644
--- a/glib/gconvert.c
+++ b/glib/gconvert.c
@@ -21,6 +21,7 @@
*/
#include "config.h"
+#include "glibconfig.h"
#ifndef G_OS_WIN32
#include <iconv.h>
@@ -50,6 +51,11 @@
#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)
diff --git a/glib/gdate.c b/glib/gdate.c
index 60066ee..2fab2f2 100644
--- a/glib/gdate.c
+++ b/glib/gdate.c
@@ -29,6 +29,7 @@
*/
#include "config.h"
+#include "glibconfig.h"
#define DEBUG_MSG(x) /* */
#ifdef G_ENABLE_DEBUG
@@ -53,6 +54,10 @@
#include "gthread.h"
#include "gunicode.h"
+#ifdef G_OS_WIN32
+#include "garray.h"
+#endif
+
GDate*
g_date_new (void)
{
diff --git a/glib/gfileutils.c b/glib/gfileutils.c
index 0bc4980..185a756 100644
--- a/glib/gfileutils.c
+++ b/glib/gfileutils.c
@@ -19,6 +19,7 @@
*/
#include "config.h"
+#include "glibconfig.h"
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H
diff --git a/glib/gmain.c b/glib/gmain.c
index 78de717..91e2a8e 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -31,10 +31,20 @@
* 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"
@@ -90,6 +100,14 @@
#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
diff --git a/glib/gpoll.c b/glib/gpoll.c
index 003b011..49bf723 100644
--- a/glib/gpoll.c
+++ b/glib/gpoll.c
@@ -79,6 +79,10 @@
#include "gpoll.h"
+#ifdef G_OS_WIN32
+#include "gprintf.h"
+#endif
+
#ifdef G_MAIN_POLL_DEBUG
extern gboolean _g_main_poll_debug;
#endif
diff --git a/glib/gslice.c b/glib/gslice.c
index 324169b..05de6b3 100644
--- a/glib/gslice.c
+++ b/glib/gslice.c
@@ -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
diff --git a/glib/gstdio.c b/glib/gstdio.c
index 786275a..fb5a9fb 100644
--- a/glib/gstdio.c
+++ b/glib/gstdio.c
@@ -19,6 +19,7 @@
*/
#include "config.h"
+#include "glibconfig.h"
#define G_STDIO_NO_WRAP_ON_UNIX
diff --git a/glib/gtimer.c b/glib/gtimer.c
index 0e2bcce..bc5b54c 100644
--- a/glib/gtimer.c
+++ b/glib/gtimer.c
@@ -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 */
diff --git a/glib/gutils.c b/glib/gutils.c
index e28f6f3..49bbadb 100644
--- a/glib/gutils.c
+++ b/glib/gutils.c
@@ -70,6 +70,12 @@
#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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]