# HG changeset patch # User rosfran # Date 1168535928 0 # Node ID 2c550e80c4190c46142e5525c8730d514d8a1060 # Parent 9bab67afb6c25aa4fca5d76239cc9ef1fb5ce4fd [svn r262] Search for the gmyth-upnp library dependency. diff -r 9bab67afb6c2 -r 2c550e80c419 gmyth/autogen.sh --- a/gmyth/autogen.sh Wed Jan 10 23:23:54 2007 +0000 +++ b/gmyth/autogen.sh Thu Jan 11 17:18:48 2007 +0000 @@ -24,7 +24,7 @@ CONFIGURE_DEF_OPT='--enable-maintainer-mode' # uncomment below to disable the UPnP features -#CONFIGURE_DEF_OPT+=' --disable-upnp' +CONFIGURE_DEF_OPT+=' --disable-upnp' CONFIGURE_EXT_OPT="$@" autogen_options diff -r 9bab67afb6c2 -r 2c550e80c419 gmyth/configure.ac --- a/gmyth/configure.ac Wed Jan 10 23:23:54 2007 +0000 +++ b/gmyth/configure.ac Thu Jan 11 17:18:48 2007 +0000 @@ -61,6 +61,16 @@ AC_FUNC_VPRINTF AC_CHECK_FUNCS([memset socket stime strstr strtoul gethostname inet_ntoa localtime_r select strrchr localtime strptime]) +############################## +# Checks for Network functions +############################## + +AC_CHECK_FUNCS([socket]) +AC_CHECK_FUNCS([inet_ntoa]) +AC_CHECK_HEADERS([ifaddrs.h]) +AC_CHECK_FUNCS([getifaddrs]) +AC_CHECK_FUNCS([time]) + AM_INIT_AUTOMAKE($PACKAGE, $VERSION) CFLAGS="$CFLAGS -I/usr/include" @@ -77,6 +87,16 @@ CFLAGS="$CFLAGS -O2 -DG_DISABLE_CHECKS" fi +dnl Test if --disable-upnp / --enable-upnp given +AC_ARG_ENABLE(upnp, + AC_HELP_STRING([--disable-upnp], [disable/enable UPnP discovery/search functions])) + +if test x"$enable_upnp" != xno; then + AC_DEFINE(WITH_GMYTH_UPNP, 1, [Enable UPnP discovery/search functions.]) +fi + +AM_CONDITIONAL(WITH_GMYTH_UPNP, test x"$enable_upnp" != xno ) + # Check for pkgconfig AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no) # Give error and exit if we don't have pkgconfig @@ -183,16 +203,6 @@ AC_MSG_ERROR(you need gstreamer base development packages installed !) fi -############################## -# Checks for Network functions -############################## - -AC_CHECK_FUNCS([socket]) -AC_CHECK_FUNCS([inet_ntoa]) -AC_CHECK_HEADERS([ifaddrs.h]) -AC_CHECK_FUNCS([getifaddrs]) -AC_CHECK_FUNCS([time]) - # # mysql libraries # @@ -209,6 +219,22 @@ fi AC_SUBST(MYSQL_LIBS) +if test x"$enable_upnp" != xno; then + PKG_CHECK_MODULES(GMYTH_UPNP, gmyth-upnp, HAVE_GMYTH_UPNP=yes, HAVE_GMYTH_UPNP=no) + + # Shows a warning message if we don't have gmyth-upnp libraries + if test x"$HAVE_GMYTH_UPNP" != xno; then + AC_MSG_WARN([GMyth UPnP development packages found!]) + + AC_SUBST(GMYTH_UPNP_CFLAGS) + AC_SUBST(GMYTH_UPNP_LIBS) + else + AC_MSG_WARN([Couldn't find the GMyth UPnP development packages installed. UPnP discovery functions cannot run.]) + fi + +fi + +AM_CONDITIONAL(WITH_GMYTH_UPNP, test x"$HAVE_GMYTH_UPNP" != xno ) #dnl Enable gtk-doc #GTK_DOC_CHECK(1.4) @@ -222,7 +248,7 @@ tests/Makefile gmyth.pc]) -if test x"$enable_debug" != xno; then +if test "x$enable_debug" != "xno"; then AC_MSG_NOTICE([Debug: Enabled]) else AC_MSG_NOTICE([Debug: Disabled]) diff -r 9bab67afb6c2 -r 2c550e80c419 gmyth/src/Makefile.am --- a/gmyth/src/Makefile.am Wed Jan 10 23:23:54 2007 +0000 +++ b/gmyth/src/Makefile.am Thu Jan 11 17:18:48 2007 +0000 @@ -48,6 +48,11 @@ $(GSTPLUGINSBASE_CFLAGS) \ $(MYSQL_CFLAGS) +if WITH_GMYTH_UPNP +libgmyth_la_CFLAGS += \ + $(GMYTH_UPNP_CFLAGS) +endif + libgmyth_la_LDFLAGS = \ -export-dynamic \ $(MYSQL_LIBS) \ @@ -55,6 +60,11 @@ $(GSTBASE_LIBS) \ $(GSTPLUGINS_LIBS) +if WITH_GMYTH_UPNP +libgmyth_la_LIBS = \ + $(GMYTH_UPNP_LIBS) +endif + libgmyth_includedir = \ $(pkgincludedir) diff -r 9bab67afb6c2 -r 2c550e80c419 gmyth/src/gmyth_backendinfo.c --- a/gmyth/src/gmyth_backendinfo.c Wed Jan 10 23:23:54 2007 +0000 +++ b/gmyth/src/gmyth_backendinfo.c Thu Jan 11 17:18:48 2007 +0000 @@ -32,6 +32,10 @@ #include "gmyth_uri.h" #include "gmyth_debug.h" +#ifdef WITH_GMYTH_UPNP +#include +#endif + static void gmyth_backend_info_class_init (GMythBackendInfoClass *klass); static void gmyth_backend_info_init (GMythBackendInfo *object); @@ -142,7 +146,15 @@ if ( NULL == hostname || strlen(hostname) <= 0 ) { - gmyth_debug ( "Error trying to set a hostname equals to NULL (it doesn't using UPnP)." ); + #ifdef WITH_GMYTH_UPNP + GMythUPnP *gmyth_upnp = gmyth_upnp_new( backend_info ); + /* backend_info = gmyth_upnp_get_backend_info( gmyth_upnp ); */ + backend_info->hostname = g_strdup ( gmyth_upnp_get_host( gmyth_upnp ) ); + g_object_unref( gmyth_upnp ); + #else + gmyth_debug ( "Error trying to set a hostname equals to NULL (it doesn't using UPnP)." ); + return NULL; + #endif } else { backend_info->hostname = g_strdup (hostname); } @@ -179,7 +191,15 @@ if ( port <= 0 ) { - gmyth_debug ( "Error trying to set a hostname equals to NULL (it doesn't using UPnP)." ); + #ifdef WITH_GMYTH_UPNP + GMythUPnP *gmyth_upnp = gmyth_upnp_new( backend_info ); + backend_info = gmyth_upnp_get_backend_info( gmyth_upnp ); + backend_info->port = gmyth_upnp_get_port( gmyth_upnp ); + g_object_unref( gmyth_upnp ); + #else + gmyth_debug ( "Error trying to set a hostname equals to NULL (it doesn't using UPnP)." ); + return NULL; + #endif } else { backend_info->port = port; }