changeset 22495:5c216e2c5405

Revert the dependency on gstreamer-0.10 >= 0.10.10, falling back to the SIGALRM hack on gstreamers which can't disable forking. This should keep both Alver and Stu happy in their respective stone-ages.
author Will Thompson <will.thompson@collabora.co.uk>
date Mon, 17 Mar 2008 13:38:34 +0000
parents 14c476bcdaee
children 43f28905e2fd
files configure.ac pidgin/gtkmain.c pidgin/gtksound.c
diffstat 3 files changed, 32 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Mon Mar 17 06:14:38 2008 +0000
+++ b/configure.ac	Mon Mar 17 13:38:34 2008 +0000
@@ -658,14 +658,21 @@
 dnl #######################################################################
 dnl # Check for GStreamer
 dnl #######################################################################
+dnl
+dnl TODO: Depend on gstreamer >= 0.10.10, and remove the conditional use of
+dnl       gst_registry_fork_set_enabled.
 AC_ARG_ENABLE(gstreamer,
 	[AC_HELP_STRING([--disable-gstreamer], [compile without GStreamer audio support])],
 	enable_gst="$enableval", enable_gst="yes")
 if test "x$enable_gst" != "xno"; then
-	PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10 >= 0.10.10], [
+	PKG_CHECK_MODULES(GSTREAMER, [gstreamer-0.10], [
 		AC_DEFINE(USE_GSTREAMER, 1, [Use GStreamer for playing sounds])
 		AC_SUBST(GSTREAMER_CFLAGS)
 		AC_SUBST(GSTREAMER_LIBS)
+		AC_CHECK_LIB(gstreamer-0.10, gst_registry_fork_set_enabled,
+			[ AC_DEFINE(GST_CAN_DISABLE_FORKING, [],
+			  [Define if gst_registry_fork_set_enabled exists])],
+			[], [$GSTREAMER_LIBS])
 	], [
 		AC_MSG_RESULT(no)
 		enable_gst="no"
--- a/pidgin/gtkmain.c	Mon Mar 17 06:14:38 2008 +0000
+++ b/pidgin/gtkmain.c	Mon Mar 17 13:38:34 2008 +0000
@@ -99,6 +99,9 @@
 	SIGTERM,
 	SIGQUIT,
 	SIGCHLD,
+#if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING)
+	SIGALRM,
+#endif
 	-1
 };
 
@@ -188,9 +191,27 @@
 		fprintf(stderr, "%s", segfault_message);
 		abort();
 		break;
+#if defined(USE_GSTREAMER) && !defined(GST_CAN_DISABLE_FORKING)
+/* By default, gstreamer forks when you initialize it, and waitpids for the
+ * child.  But if libpurple reaps the child rather than leaving it to
+ * gstreamer, gstreamer's initialization fails.  So, we wait a second before
+ * reaping child processes, to give gst a chance to reap it if it wants to.
+ *
+ * This is not needed in later gstreamers, which let us disable the forking.
+ * And, it breaks the world on some Real Unices.
+ */
 	case SIGCHLD:
+		/* Restore signal catching */
+		signal(SIGCHLD, sighandler);
+		alarm(1);
+		break;
+	case SIGALRM:
+#else
+	case SIGCHLD:
+#endif
 		clean_pid();
-		signal(SIGCHLD, sighandler);    /* restore signal catching on this one! */
+		/* Restore signal catching */
+		signal(SIGCHLD, sighandler);
 		break;
 	default:
 		purple_debug_warning("sighandler", "Caught signal %d\n", sig);
--- a/pidgin/gtksound.c	Mon Mar 17 06:14:38 2008 +0000
+++ b/pidgin/gtksound.c	Mon Mar 17 13:38:34 2008 +0000
@@ -302,7 +302,9 @@
 
 #ifdef USE_GSTREAMER
 	purple_debug_info("sound", "Initializing sound output drivers.\n");
+#ifdef GST_CAN_DISABLE_FORKING
 	gst_registry_fork_set_enabled (FALSE);
+#endif
 	if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) {
 		purple_notify_error(NULL, _("GStreamer Failure"),
 					_("GStreamer failed to initialize."),