gnome-mud r676 - in trunk: . src



Author: lharris
Date: Mon Jun 30 11:10:07 2008
New Revision: 676
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=676&view=rev

Log:
Made gstreamer/MSP support optional


Modified:
   trunk/ChangeLog
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/gnome-mud.c
   trunk/src/mud-connection-view.c
   trunk/src/mud-telnet-handlers.c
   trunk/src/mud-telnet-handlers.h
   trunk/src/mud-telnet-msp.c
   trunk/src/mud-telnet-msp.h
   trunk/src/mud-telnet.c
   trunk/src/mud-telnet.h

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Mon Jun 30 11:10:07 2008
@@ -25,6 +25,8 @@
 AM_INIT_AUTOMAKE
 AC_CONFIG_HEADERS([config.h])
 
+PKG_PROG_PKG_CONFIG(0.9.0)
+
 dnl Release date on LSM format (date +%d%b%y).
 LSMDATE="12Feb2004"
 AC_SUBST(LSMDATE)
@@ -59,19 +61,21 @@
 GCONF_REQUIRED=0.20
 GSTREAMER_REQUIRED=0.10
 
-PKG_CHECK_MODULES(GMUD, gtk+-2.0 >= $GTK_REQUIRED vte >= $VTE_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED libpcre >= $PCRE_REQUIRED gmodule-2.0 >= $GMODULE_REQUIRED gnet-2.0 >= $LIBGNET_REQUIRED gconf-2.0 >= $GCONF_REQUIRED gstreamer-0.10 >= $GSTREAMER_REQUIRED)
+PKG_CHECK_MODULES(GMUD, gtk+-2.0 >= $GTK_REQUIRED vte >= $VTE_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED libpcre >= $PCRE_REQUIRED gmodule-2.0 >= $GMODULE_REQUIRED gnet-2.0 >= $LIBGNET_REQUIRED gconf-2.0 >= $GCONF_REQUIRED)
 AC_SUBST(GMUD_CFLAGS)
 AC_SUBST(GMUD_LIBS)
 
-
 dnl Checks for programs.
 AC_PROG_CC
 AC_ISC_POSIX
-dnl AC_SYS_LARGEFILE
 
 dnl Checks for header files.
 AC_HEADER_STDC
+AC_HEADER_DIRENT
+AC_HEADER_TIME
 AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h regex.h)
+AC_CHECK_HEADERS(fcntl.h strings.h unistd.h)
+AC_CHECK_HEADERS(sys/time.h)
 
 AC_DEFINE(HAVE_LIBSM, 1, [Define this to have session management.])
 
@@ -102,98 +106,34 @@
 	fi
 fi
 AM_CONDITIONAL(USE_MCCP, test "x$enable_mccp" = xyes)
-
 AC_SUBST(Z_LIBS)
 
-dnl Check whether to include Python support
-dnl AC_ARG_WITH(python,
-dnl [  --without-python        disable use of python scripting],
-dnl         python=$withval, python=python)
+dnl Check whether to include GStreamer code or not
+AC_ARG_ENABLE(gstreamer,
+	AC_HELP_STRING([--enable-gstreamer],
+		       [Enable GStreamer Used for MSP (Mud Sound Protocol)]),,
+		enable_gstreamer=auto)
+if test "x$enable_gstreamer" != "xno"; then
+	PKG_CHECK_EXISTS(gstreamer-0.10, have_gst=yes, have_gst=no)	
+	if test "x$have_gst" = "xno" -a "x$enable_gstreamer" = "xyes"; then
+	  AC_MSG_ERROR([Gstreamer support explicitly requested but libgstreamer was not found])
+	fi
+	if test "x$have_gst" = "xyes"; then
+	  AC_DEFINE(ENABLE_GST, 1, [Define if GStreamer should be enabled])
+	  enable_gstreamer=yes
+	  PKG_CHECK_MODULES(MSP, gstreamer-0.10 >= $GSTREAMER_REQUIRED)
+	fi
+fi
+AM_CONDITIONAL(USE_GSTREAMER, test "x$enable_gstreamer" = xyes)
+AC_SUBST(MSP_CFLAGS)
+AC_SUBST(MSP_LIBS)
 
 dnl Checks for programs.
 AC_ISC_POSIX
-dnl AC_PROG_CC
 AM_PROG_CC_STDC
 AC_PROG_LN_S
 AC_PROG_INSTALL
 
-AC_CHECK_LIB(socket,socket)
-AC_CHECK_LIB(nsl,connect)
-
-AC_CHECK_HEADERS(dlfcn.h dl.h)
-AC_CHECK_LIB(dl, dlopen, DL_LIB="-ldl",[
-	AC_CHECK_LIB(dld, shl_load, DL_LIB="-ldld",[
-	AC_CHECK_FUNCS(dlopen, DL_LIB="",
-	AC_MSG_ERROR(Dynamic linking is not available on this platform.))])])
-AC_SUBST(DL_LIB)
-
-dnl Checks for header files.
-AC_HEADER_STDC
-AC_HEADER_DIRENT
-AC_CHECK_HEADERS(fcntl.h strings.h unistd.h)
-AC_CHECK_HEADERS(telnet.h arpa/telnet.h sys/time.h)
-
-AC_HEADER_TIME
-
-dnl Checks for Python
-dnl if test "$python" != no; then
-dnl 	AC_PATH_PROG(pythonpath, $python)
-dnl 	if test "_$pythonpath" = _ ; then
-dnl 		python=no
-dnl 	else
-dnl 		AC_MSG_CHECKING([for Python version >= 2.x])
-dnl 		PY_PREFIX=`$pythonpath -c 'import sys ; print sys.prefix'`
-dnl 		PY_EXEC_PREFIX=`$pythonpath -c 'import sys ; print sys.exec_prefix'`
-dnl 		changequote(<<, >>)dnl
-dnl 		PY_VERSION=`$pythonpath -c 'import sys ; print sys.version[0:3]'`
-dnl 		PY_MAJOR=`$pythonpath -c 'import sys ; print sys.version[0:2]'`
-dnl 		changequote([, ])dnl
-dnl 		if test "$PY_MAJOR" = "1."; then
-dnl 			python=no
-dnl 			AC_MSG_RESULT([no, atlest Python 2.x is needed])
-dnl 		else
-dnl 			AC_MSG_RESULT([yes, Python $PY_VERSION])
-dnl 			AC_MSG_CHECKING(for Python compile flags)
-dnl
-dnl 			if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h; then
-dnl 				PY_LIBS="-lpython$PY_VERSION"
-dnl 				PY_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PY_VERSION/config"
-dnl 				PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION"
-dnl 				AC_DEFINE(USE_PYTHON, 1, [Define this to enable python scripting support.])
-dnl 				AC_MSG_RESULT([ok])
-dnl 				AC_CHECK_LIB(pthread, pthread_create, )
-dnl 				dnl needed for freebsd
-dnl 				AC_CHECK_LIB(c_r, pthread_create, )
-dnl 				dnl needed for python 2.x
-dnl 				AC_CHECK_LIB(util, openpty, )
-dnl 				AC_CHECK_LIB(db, dbopen, )
-dnl 				CFLAGS="$CFLAGS $PY_CFLAGS"
-dnl 				CPPFLAGS="$CPPFLAGS $PY_CFLAGS"
-dnl 				LIBS="$LIBS $PY_LIB_LOC $PY_LIBS"
-dnl
-dnl 				dnl PyGTK
-dnl 				PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 1.99.13, [
-dnl 					AC_DEFINE(USE_PYGTK, 1, [Define this if you want PyGtk support in Python scripts.])
-dnl 					CFLAGS="$CFLAGS $PYGTK_CFLAGS"
-dnl 					LIBS="$LIBS $PYGTK_LIBS"
-dnl 				])
-dnl 			else
-dnl 				python=no
-dnl 				AC_MSG_RESULT([Can't find Python.h])
-dnl 			fi
-dnl 		fi
-dnl 	fi
-dnl fi
-
-dnl python is usually linked against -lm on solaris
-dnl if test "$system" = "SunOS"; then
-dnl 	if test "$python" != "no"; then
-dnl 		if test -z "`echo "$LIBS" | grep '\-lm ' 2>/dev/null`" ; then
-dnl 			LIBS="$LIBS -lm"
-dnl 		fi
-dnl 	fi
-dnl fi
-
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_C_INLINE
@@ -244,6 +184,16 @@
 	AC_MSG_NOTICE([    * Mapper support is disabled])
 fi
 
+if test "x$enable_gstreamer" = xyes; then
+	AC_MSG_NOTICE([    * GStreamer support is enabled])
+else
+	AC_MSG_NOTICE([    * GStreamer support is disabled])
+fi
+
 if test -d $srcdir/.svn; then
 	AC_MSG_WARN([You're using a svn version. Expect problems.])
 fi
+
+if test -d $srcdir/.git; then
+	AC_MSG_WARN([You're using a git version. Expect problems.])
+fi

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Mon Jun 30 11:10:07 2008
@@ -12,8 +12,8 @@
 	-DDATADIR=\""$(datadir)"\"							\
 	-DLIBDIR=\""$(libdir)"\"							\
 	-DGLADEDIR=\""$(pkgdatadir)"\"						\
-	$(GMUD_CFLAGS) $(GMUD_DEBUG)
-LDADD   = $(GMUD_LIBS) $(Z_LIBS)
+	$(GMUD_CFLAGS) $(GMUD_DEBUG) $(MSP_CFLAGS)
+LDADD   = $(GMUD_LIBS) $(Z_LIBS) $(MSP_LIBS)
 AM_CPPFLAGS = -DPKGDATADIR=\"$(pkgdatadir)\"
 
 gamesdir = $(prefix)/games

Modified: trunk/src/gnome-mud.c
==============================================================================
--- trunk/src/gnome-mud.c	(original)
+++ trunk/src/gnome-mud.c	Mon Jun 30 11:10:07 2008
@@ -28,7 +28,10 @@
 #include <stdio.h>
 #include <sys/stat.h>
 #include <gnet.h>
+
+#ifdef ENABLE_GST
 #include <gst/gst.h>
+#endif
 
 #ifdef USE_PYTHON
 //#include <Python.h>
@@ -100,11 +103,13 @@
 		return 1;
 	}
 
-    /* Initialize the Gnet library */
-    gnet_init();
+	/* Initialize the Gnet library */
+	gnet_init();
 
+#ifdef ENABLE_GST
 	/* Initialize GStreamer */
 	gst_init(&argc, &argv);
+#endif
 
 	gtk_init(&argc, &argv);
 

Modified: trunk/src/mud-connection-view.c
==============================================================================
--- trunk/src/mud-connection-view.c	(original)
+++ trunk/src/mud-connection-view.c	Mon Jun 30 11:10:07 2008
@@ -80,9 +80,11 @@
 
 	gchar *mud_name;
 
+#ifdef ENABLE_GST
 	GQueue *download_queue;
 	GConnHttp *dl_conn;
 	gboolean downloading;
+#endif
 
 	GString *processed;
 };
@@ -100,8 +102,11 @@
 static void mud_connection_view_popup                    (MudConnectionView *view, GdkEventButton *event);
 static void mud_connection_view_reread_profile           (MudConnectionView *view);
 static void mud_connection_view_network_event_cb(GConn *conn, GConnEvent *event, gpointer data);
+
+#ifdef ENABLE_GST
 static void mud_connection_view_http_cb(GConnHttp *conn, GConnHttpEvent *event, gpointer data);
 static void mud_connection_view_cancel_dl_cb(GtkWidget *widget, MudConnectionView *view);
+#endif
 
 GType
 mud_connection_view_get_type (void)
@@ -325,12 +330,15 @@
 
   	connection_view->priv = g_new0(MudConnectionViewPrivate, 1);
 
-    connection_view->priv->history = g_queue_new();
-    connection_view->priv->current_history_index = 0;
+	connection_view->priv->history = g_queue_new();
+	connection_view->priv->current_history_index = 0;
+
+#ifdef ENABLE_GST
+	connection_view->priv->download_queue = g_queue_new();
+	connection_view->priv->dl_conn = NULL;
+#endif
 
-    connection_view->priv->download_queue = g_queue_new();
-    connection_view->priv->dl_conn = NULL;
-    connection_view->priv->processed = NULL;
+	connection_view->priv->processed = NULL;
 
 	connection_view->priv->parse = mud_parse_base_new(connection_view);
 
@@ -345,7 +353,10 @@
 	connection_view->priv->progressbar = gtk_progress_bar_new();
 	gtk_progress_bar_set_pulse_step (GTK_PROGRESS_BAR(connection_view->priv->progressbar), 0.1);
 	connection_view->priv->dl_button = gtk_button_new_from_stock("gtk-cancel");
+
+#ifdef ENABLE_GST
 	connection_view->priv->downloading = FALSE;
+#endif
 
 	gtk_box_pack_start(GTK_BOX(dl_vbox), connection_view->priv->dl_label, FALSE, FALSE, 0);
 
@@ -366,8 +377,10 @@
 	g_object_set_data(G_OBJECT(connection_view->priv->terminal),
 					  "connection-view", connection_view);
 
+#ifdef ENABLE_GST
 	g_signal_connect(connection_view->priv->dl_button, "clicked",
 		G_CALLBACK(mud_connection_view_cancel_dl_cb), connection_view);
+#endif
 
 	connection_view->priv->scrollbar = gtk_vscrollbar_new(NULL);
 	gtk_range_set_adjustment(GTK_RANGE(connection_view->priv->scrollbar), VTE_TERMINAL(connection_view->priv->terminal)->adjustment);
@@ -413,26 +426,31 @@
 	MudConnectionView *connection_view;
 	GObjectClass *parent_class;
 	gchar *history_item;
+
+#ifdef ENABLE_GST
 	MudMSPDownloadItem *item;
+#endif
 
 	connection_view = MUD_CONNECTION_VIEW(object);
 
     while((history_item = (gchar *)g_queue_pop_head(connection_view->priv->history)) != NULL)
 		g_free(history_item);
 
-    if(connection_view->priv->history)
-        g_queue_free(connection_view->priv->history);
+	if(connection_view->priv->history)
+		g_queue_free(connection_view->priv->history);
 
+#ifdef ENABLE_GST
 	while((item = (MudMSPDownloadItem *)g_queue_pop_head(connection_view->priv->download_queue)) != NULL)
 		mud_telnet_msp_download_item_free(item);
 
 	if(connection_view->priv->download_queue)
         g_queue_free(connection_view->priv->download_queue);
+#endif
 
-    mud_zmp_finalize(connection_view->priv->telnet);
+    	mud_zmp_finalize(connection_view->priv->telnet);
 
-    gnet_conn_disconnect(connection_view->connection);
-    gnet_conn_unref(connection_view->connection);
+    	gnet_conn_disconnect(connection_view->connection);
+    	gnet_conn_unref(connection_view->connection);
 
 	g_free(connection_view->priv);
 
@@ -451,24 +469,28 @@
 void
 mud_connection_view_disconnect(MudConnectionView *view)
 {
+#ifdef ENABLE_GST
 	MudMSPDownloadItem *item;
+#endif
 
 	g_assert(view != NULL);
 
+#ifdef ENABLE_GST
 	while((item = (MudMSPDownloadItem *)g_queue_pop_head(view->priv->download_queue)) != NULL)
 		mud_telnet_msp_download_item_free(item);
 
 	if(view->priv->download_queue)
-        g_queue_free(view->priv->download_queue);
+        	g_queue_free(view->priv->download_queue);
 
 	view->priv->download_queue = NULL;
+#endif
 
 	if(view->priv->processed)
 		g_string_free(view->priv->processed, TRUE);
 
 	view->priv->processed = NULL;
 
-    mud_zmp_finalize(view->priv->telnet);
+	mud_zmp_finalize(view->priv->telnet);
 
 	gnet_conn_disconnect(view->connection);
 
@@ -480,14 +502,19 @@
 void
 mud_connection_view_reconnect(MudConnectionView *view)
 {
-    gchar *buf;
-    MudMSPDownloadItem *item;
+	gchar *buf;
+
+#ifdef ENABLE_GST
+	MudMSPDownloadItem *item;
+#endif
 
 	g_assert(view != NULL);
 
 
 	if(gnet_conn_is_connected(view->connection))
 	{
+
+#ifdef ENABLE_GST
 		while((item = (MudMSPDownloadItem *)g_queue_pop_head(view->priv->download_queue)) != NULL)
 			mud_telnet_msp_download_item_free(item);
 
@@ -495,13 +522,14 @@
 	        g_queue_free(view->priv->download_queue);
 
 		view->priv->download_queue = NULL;
+#endif
 
 		if(view->priv->processed)
 			g_string_free(view->priv->processed, TRUE);
 
 		view->priv->processed = NULL;
 
-	    mud_zmp_finalize(view->priv->telnet);
+		mud_zmp_finalize(view->priv->telnet);
 
 		gnet_conn_disconnect(view->connection);
 
@@ -509,7 +537,9 @@
 
 		mud_connection_view_add_text(view, _("*** Connection closed.\n"), System);
 
+#ifdef ENABLE_GST
 		view->priv->download_queue = g_queue_new();
+#endif
 
 		view->naws_enabled = FALSE;
 
@@ -971,15 +1001,18 @@
 
 	       if(view->priv->processed != NULL)
 	       {
+#ifdef ENABLE_GST
 	       	   if(view->priv->telnet->msp_parser.enabled)
 	       	   {
 					view->priv->processed = mud_telnet_msp_parse(
 						view->priv->telnet, view->priv->processed, &length);
 			   }
-
+#endif
 			   if(view->priv->processed != NULL)
 			   {
+#ifdef ENABLE_GST
 			   	   mud_telnet_msp_parser_clear(view->priv->telnet);
+#endif
 		           buf = view->priv->processed->str;
 
 		           temp = view->local_echo;
@@ -1049,6 +1082,7 @@
     }
 }
 
+#ifdef ENABLE_GST
 static void
 mud_connection_view_start_download(MudConnectionView *view)
 {
@@ -1246,3 +1280,4 @@
 	if(!g_queue_is_empty(view->priv->download_queue))
 		mud_connection_view_start_download(view);
 }
+#endif

Modified: trunk/src/mud-telnet-handlers.c
==============================================================================
--- trunk/src/mud-telnet-handlers.c	(original)
+++ trunk/src/mud-telnet-handlers.c	Mon Jun 30 11:10:07 2008
@@ -34,6 +34,10 @@
 #include "mud-telnet-handlers.h"
 #include "mud-telnet-zmp.h"
 
+#ifdef ENABLE_GST
+	#include "mud-telnet-msp.h"
+#endif
+
 /* TTYPE */
 
 void
@@ -297,6 +301,7 @@
 
 }
 
+#ifdef ENABLE_GST
 /* MSP */
 void
 MudHandler_MSP_Enable(MudTelnet *telnet, MudTelnetHandler *handler)
@@ -318,3 +323,4 @@
 {
     return;
 }
+#endif

Modified: trunk/src/mud-telnet-handlers.h
==============================================================================
--- trunk/src/mud-telnet-handlers.h	(original)
+++ trunk/src/mud-telnet-handlers.h	Mon Jun 30 11:10:07 2008
@@ -62,10 +62,12 @@
 void MudHandler_ZMP_HandleSubNeg(MudTelnet *telnet, guchar *buf,
     guint len, MudTelnetHandler *handler);
 
+#ifdef ENABLE_GST
 /* MSP */
 void MudHandler_MSP_Enable(MudTelnet *telnet, MudTelnetHandler *handler);
 void MudHandler_MSP_Disable(MudTelnet *telnet, MudTelnetHandler *handler);
 void MudHandler_MSP_HandleSubNeg(MudTelnet *telnet, guchar *buf,
     guint len, MudTelnetHandler *handler);
+#endif
 
 #endif // MUD_TELNET_HANDLERS_H

Modified: trunk/src/mud-telnet-msp.c
==============================================================================
--- trunk/src/mud-telnet-msp.c	(original)
+++ trunk/src/mud-telnet-msp.c	Mon Jun 30 11:10:07 2008
@@ -20,6 +20,8 @@
 #  include "config.h"
 #endif
 
+#ifdef ENABLE_GST
+
 #include <glib.h>
 #include <gnet.h>
 #include <string.h>
@@ -889,3 +891,4 @@
 
 	return TRUE;
 }
+#endif

Modified: trunk/src/mud-telnet-msp.h
==============================================================================
--- trunk/src/mud-telnet-msp.h	(original)
+++ trunk/src/mud-telnet-msp.h	Mon Jun 30 11:10:07 2008
@@ -19,6 +19,8 @@
 #ifndef MUD_TELNET_MSP_H
 #define MUD_TELNET_MSP_H
 
+#ifdef ENABLE_GST
+
 #include <glib.h>
 #include "mud-telnet.h"
 
@@ -99,4 +101,6 @@
 void mud_telnet_msp_download_item_free(MudMSPDownloadItem *item);
 GString *mud_telnet_msp_parse(MudTelnet *telnet, GString *buf, gint *len);
 
+#endif
+
 #endif // MUD_TELNET_MSP_H

Modified: trunk/src/mud-telnet.c
==============================================================================
--- trunk/src/mud-telnet.c	(original)
+++ trunk/src/mud-telnet.c	Mon Jun 30 11:10:07 2008
@@ -105,7 +105,11 @@
 mud_telnet_init (MudTelnet *telnet)
 {
 	telnet->priv = g_new0(MudTelnetPrivate, 1);
+
+#ifdef ENABLE_GST
 	telnet->msp_parser.enabled = FALSE;
+#endif
+
 	telnet->priv->processed = g_string_new(NULL);
 	telnet->prev_buffer = NULL;
 }
@@ -156,6 +160,7 @@
 
 	telnet->mud_name = g_strdup(mud_name);
 
+#ifdef ENABLE_GST
 	telnet->sound[0].files = NULL;
 	telnet->sound[0].current_command = NULL;
 	telnet->sound[0].playing = FALSE;
@@ -167,6 +172,7 @@
 	telnet->sound[1].files_len = 0;
 
 	telnet->base_url = NULL;
+#endif
 
 	return telnet;
 }
@@ -234,6 +240,7 @@
     telnet->handlers[5].disable = MudHandler_ZMP_Disable;
     telnet->handlers[5].handle_sub_neg = MudHandler_ZMP_HandleSubNeg;
 
+#ifdef ENABLE_GST
     /* MSP */
     telnet->handlers[6].type = HANDLER_MSP;
     telnet->handlers[6].option_number = (guchar)TELOPT_MSP;
@@ -241,6 +248,8 @@
     telnet->handlers[6].enable = MudHandler_MSP_Enable;
     telnet->handlers[6].disable = MudHandler_MSP_Disable;
     telnet->handlers[6].handle_sub_neg = MudHandler_MSP_HandleSubNeg;
+#endif
+
 }
 
 gint

Modified: trunk/src/mud-telnet.h
==============================================================================
--- trunk/src/mud-telnet.h	(original)
+++ trunk/src/mud-telnet.h	Mon Jun 30 11:10:07 2008
@@ -138,7 +138,10 @@
 #include <gnet.h>
 #include "mud-connection-view.h"
 #include "mud-telnet-zmp.h"
-#include "mud-telnet-msp.h"
+
+#ifdef ENABLE_GST
+	#include "mud-telnet-msp.h"
+#endif
 
 struct _MudTelnet
 {
@@ -162,10 +165,12 @@
 	GHashTable *zmp_commands;
 	MudZMPCommand commands[2048];
 
+#ifdef ENABLE_GST
 	MudMSPParser msp_parser;
 	MudMSPTypes msp_type;
 	MudMSPSound sound[2];
 	gchar *base_url;
+#endif
 
 	GString *prev_buffer;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]