build: Define G_THREADS_MANDATORY everywhere

We require threads to be supported in any case and defining this
will simplify the mutex, condition variable, etc. macros from gthread
to not always check if threads are really supported.

Fixes bug #607481.
This commit is contained in:
Sebastian Dröge 2010-01-20 06:58:28 +01:00
parent 9909d3312f
commit f137d188cb
4 changed files with 17 additions and 5 deletions

View file

@ -619,7 +619,7 @@ dnl - src and build dirs need to be added because every piece that gets built
dnl will need the GStreamer source and generated headers dnl will need the GStreamer source and generated headers
dnl LIBS: XML doesn't need to be added because we don't explicitly use symbols dnl LIBS: XML doesn't need to be added because we don't explicitly use symbols
dnl from LibXML except for in the core library dnl from LibXML except for in the core library
GST_ALL_CFLAGS="-I\$(top_srcdir)/libs -I\$(top_srcdir) -I\$(top_builddir)/libs -I\$(top_builddir) $GLIB_CFLAGS $XML_CFLAGS \$(GST_OPTION_CFLAGS)" GST_ALL_CFLAGS="-I\$(top_srcdir)/libs -I\$(top_srcdir) -I\$(top_builddir)/libs -I\$(top_builddir) $GLIB_CFLAGS $XML_CFLAGS \$(GST_OPTION_CFLAGS) -DG_THREADS_MANDATORY"
dnl FIXME: check if LTLIBINTL is needed everywhere dnl FIXME: check if LTLIBINTL is needed everywhere
dnl I presume it is given that it contains the symbols that _() stuff maps to dnl I presume it is given that it contains the symbols that _() stuff maps to

View file

@ -364,7 +364,11 @@ gst_init_get_option_group (void)
* called gst_init() yet or initialised the threading system otherwise, we * called gst_init() yet or initialised the threading system otherwise, we
* better issue a warning here (since chances are high that the application * better issue a warning here (since chances are high that the application
* has already called other GLib functions such as g_option_context_new() */ * has already called other GLib functions such as g_option_context_new() */
#if GLIB_CHECK_VERSION (2,20,0)
if (!g_thread_get_initialized ()) {
#else
if (!g_thread_supported ()) { if (!g_thread_supported ()) {
#endif
g_warning ("The GStreamer function gst_init_get_option_group() was\n" g_warning ("The GStreamer function gst_init_get_option_group() was\n"
"\tcalled, but the GLib threading system has not been initialised\n" "\tcalled, but the GLib threading system has not been initialised\n"
"\tyet, something that must happen before any other GLib function\n" "\tyet, something that must happen before any other GLib function\n"
@ -417,7 +421,11 @@ gst_init_check (int *argc, char **argv[], GError ** err)
#endif #endif
gboolean res; gboolean res;
#if GLIB_CHECK_VERSION (2,20,0)
if (!g_thread_get_initialized ())
#else
if (!g_thread_supported ()) if (!g_thread_supported ())
#endif
g_thread_init (NULL); g_thread_init (NULL);
if (gst_initialized) { if (gst_initialized) {
@ -514,8 +522,8 @@ prepare_for_load_plugin_func (gpointer data, gpointer user_data)
#ifndef GST_DISABLE_OPTION_PARSING #ifndef GST_DISABLE_OPTION_PARSING
static void static void
split_and_iterate (const gchar * stringlist, gchar * separator, GFunc iterator, split_and_iterate (const gchar * stringlist, gchar * separator,
gpointer user_data) GFunc iterator, gpointer user_data)
{ {
gchar **strings; gchar **strings;
gint j = 0; gint j = 0;
@ -562,7 +570,11 @@ init_pre (GOptionContext * context, GOptionGroup * group, gpointer data,
g_type_init (); g_type_init ();
/* we need threading to be enabled right here */ /* we need threading to be enabled right here */
#if GLIB_CHECK_VERSION (2,20,0)
g_assert (g_thread_get_initialized ());
#else
g_assert (g_thread_supported ()); g_assert (g_thread_supported ());
#endif
_gst_debug_init (); _gst_debug_init ();
#ifdef ENABLE_NLS #ifdef ENABLE_NLS

View file

@ -11,4 +11,4 @@ Description: Streaming media framework, Not Installed
Version: @VERSION@ Version: @VERSION@
Requires: @GST_PKG_DEPS@@LIBXML_PKG@ Requires: @GST_PKG_DEPS@@LIBXML_PKG@
Libs: ${libdir}/gst/libgstreamer-@GST_MAJORMINOR@.la Libs: ${libdir}/gst/libgstreamer-@GST_MAJORMINOR@.la
Cflags: -I${includedir} -I@srcdir@/.. -I${includedir}/libs -I@srcdir@/../libs Cflags: -I${includedir} -I@srcdir@/.. -I${includedir}/libs -I@srcdir@/../libs -DG_THREADS_MANDATORY

View file

@ -10,4 +10,4 @@ Description: Streaming media framework
Requires: @GST_PKG_DEPS@@LIBXML_PKG@ Requires: @GST_PKG_DEPS@@LIBXML_PKG@
Version: @VERSION@ Version: @VERSION@
Libs: -L${libdir} -lgstreamer-@GST_MAJORMINOR@ Libs: -L${libdir} -lgstreamer-@GST_MAJORMINOR@
Cflags: -I${includedir} Cflags: -I${includedir} -DG_THREADS_MANDATORY