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.
This commit is contained in:
Tor Lillqvist 2010-09-06 15:56:16 +03:00
parent 2aa135ee3d
commit 548ddd5fe9
10 changed files with 44 additions and 1 deletions

View File

@ -30,6 +30,7 @@
*/
#include "config.h"
#include "glibconfig.h"
#include <signal.h>
#include <stdarg.h>

View File

@ -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)

View File

@ -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)
{

View File

@ -19,6 +19,7 @@
*/
#include "config.h"
#include "glibconfig.h"
#include <sys/stat.h>
#ifdef HAVE_UNISTD_H

View File

@ -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

View File

@ -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

View 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

View File

@ -19,6 +19,7 @@
*/
#include "config.h"
#include "glibconfig.h"
#define G_STDIO_NO_WRAP_ON_UNIX

View 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 */

View File

@ -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)