Merge pull request #38 from knocte/master

glib: do not call g_thread_ functions in GLib >= 2.31
This commit is contained in:
Mike Kestner 2012-05-04 19:11:07 -07:00
commit a446117715
2 changed files with 23 additions and 3 deletions

View file

@ -82,9 +82,6 @@ AC_ARG_ENABLE(debug, [ --enable-debug Build debugger (.mdb) files for
)
fi
CSFLAGS="$DEBUG_FLAGS $WIN64DEFINES"
AC_SUBST(CSFLAGS)
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
if test "x$PKG_CONFIG" = "xno"; then
AC_MSG_ERROR([You need to install pkg-config])
@ -176,6 +173,15 @@ PKG_CHECK_MODULES(GIO, gio-2.0 >= $GLIB_REQUIRED_VERSION)
AC_SUBST(GIO_CFLAGS)
AC_SUBST(GIO_LIBS)
CSFLAGS="$DEBUG_FLAGS $WIN64DEFINES"
PKG_CHECK_MODULES(GLIB_2_31,
glib-2.0 >= 2.31,
HAVE_GLIB_2_31_OR_HIGHER=yes, HAVE_GLIB_2_31_OR_HIGHER=no)
if test "x$HAVE_GLIB_2_31_OR_HIGHER" = "xyes" ; then
CSFLAGS="$CSFLAGS -define:DISABLE_GTHREAD_CHECK"
fi
AC_SUBST(CSFLAGS)
PKG_CHECK_MODULES(PANGO, pango)
AC_SUBST(PANGO_CFLAGS)
AC_SUBST(PANGO_LIBS)

View file

@ -28,6 +28,18 @@ namespace GLib
{
private Thread () {}
#if DISABLE_GTHREAD_CHECK
public static void Init ()
{
// GLib automatically inits threads in 2.31 and above
// http://developer.gnome.org/glib/unstable/glib-Deprecated-Thread-APIs.html#g-thread-init
}
public static bool Supported
{
get { return true; }
}
#else
[DllImport ("libgthread-2.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void g_thread_init (IntPtr i);
@ -45,5 +57,7 @@ namespace GLib
return g_thread_get_initialized ();
}
}
#endif
}
}