[svn r262] Search for the gmyth-upnp library dependency. trunk
authorrosfran
Thu Jan 11 17:18:48 2007 +0000 (2007-01-11)
branchtrunk
changeset 2612c550e80c419
parent 260 9bab67afb6c2
child 262 91a24122e3ae
[svn r262] Search for the gmyth-upnp library dependency.
gmyth/autogen.sh
gmyth/configure.ac
gmyth/src/Makefile.am
gmyth/src/gmyth_backendinfo.c
     1.1 --- a/gmyth/autogen.sh	Wed Jan 10 23:23:54 2007 +0000
     1.2 +++ b/gmyth/autogen.sh	Thu Jan 11 17:18:48 2007 +0000
     1.3 @@ -24,7 +24,7 @@
     1.4  
     1.5  CONFIGURE_DEF_OPT='--enable-maintainer-mode'
     1.6  # uncomment below to disable the UPnP features
     1.7 -#CONFIGURE_DEF_OPT+=' --disable-upnp'
     1.8 +CONFIGURE_DEF_OPT+=' --disable-upnp'
     1.9  CONFIGURE_EXT_OPT="$@"
    1.10  
    1.11  autogen_options 
     2.1 --- a/gmyth/configure.ac	Wed Jan 10 23:23:54 2007 +0000
     2.2 +++ b/gmyth/configure.ac	Thu Jan 11 17:18:48 2007 +0000
     2.3 @@ -61,6 +61,16 @@
     2.4  AC_FUNC_VPRINTF
     2.5  AC_CHECK_FUNCS([memset socket stime strstr strtoul gethostname inet_ntoa localtime_r select strrchr localtime strptime])
     2.6  
     2.7 +##############################
     2.8 +# Checks for Network functions
     2.9 +##############################
    2.10 +
    2.11 +AC_CHECK_FUNCS([socket])
    2.12 +AC_CHECK_FUNCS([inet_ntoa])
    2.13 +AC_CHECK_HEADERS([ifaddrs.h])
    2.14 +AC_CHECK_FUNCS([getifaddrs])
    2.15 +AC_CHECK_FUNCS([time])
    2.16 +
    2.17  AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
    2.18  
    2.19  CFLAGS="$CFLAGS -I/usr/include"
    2.20 @@ -77,6 +87,16 @@
    2.21      CFLAGS="$CFLAGS -O2 -DG_DISABLE_CHECKS"
    2.22  fi          
    2.23  
    2.24 +dnl Test if --disable-upnp / --enable-upnp given
    2.25 +AC_ARG_ENABLE(upnp,
    2.26 +        AC_HELP_STRING([--disable-upnp], [disable/enable UPnP discovery/search functions]))
    2.27 +
    2.28 +if test x"$enable_upnp" != xno; then
    2.29 +  AC_DEFINE(WITH_GMYTH_UPNP, 1, [Enable UPnP discovery/search functions.])
    2.30 +fi
    2.31 +
    2.32 +AM_CONDITIONAL(WITH_GMYTH_UPNP, test x"$enable_upnp" != xno )
    2.33 +
    2.34  # Check for pkgconfig
    2.35  AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, yes, no)
    2.36  # Give error and exit if we don't have pkgconfig
    2.37 @@ -183,16 +203,6 @@
    2.38    AC_MSG_ERROR(you need gstreamer base development packages installed !)
    2.39  fi
    2.40  
    2.41 -##############################
    2.42 -# Checks for Network functions
    2.43 -##############################
    2.44 -
    2.45 -AC_CHECK_FUNCS([socket])
    2.46 -AC_CHECK_FUNCS([inet_ntoa])
    2.47 -AC_CHECK_HEADERS([ifaddrs.h])
    2.48 -AC_CHECK_FUNCS([getifaddrs])
    2.49 -AC_CHECK_FUNCS([time])
    2.50 -
    2.51  #
    2.52  # mysql libraries
    2.53  #
    2.54 @@ -209,6 +219,22 @@
    2.55  fi
    2.56  AC_SUBST(MYSQL_LIBS)
    2.57  
    2.58 +if test x"$enable_upnp" != xno; then
    2.59 +	PKG_CHECK_MODULES(GMYTH_UPNP, gmyth-upnp, HAVE_GMYTH_UPNP=yes, HAVE_GMYTH_UPNP=no)
    2.60 +
    2.61 +	# Shows a warning message if we don't have gmyth-upnp libraries
    2.62 +	if test x"$HAVE_GMYTH_UPNP" != xno; then
    2.63 +	  AC_MSG_WARN([GMyth UPnP development packages found!])
    2.64 +
    2.65 +	  AC_SUBST(GMYTH_UPNP_CFLAGS)
    2.66 +	  AC_SUBST(GMYTH_UPNP_LIBS)
    2.67 +	else
    2.68 +	  AC_MSG_WARN([Couldn't find the GMyth UPnP development packages installed. UPnP discovery functions cannot run.])
    2.69 +	fi
    2.70 +
    2.71 +fi
    2.72 +
    2.73 +AM_CONDITIONAL(WITH_GMYTH_UPNP, test x"$HAVE_GMYTH_UPNP" != xno )
    2.74  #dnl Enable gtk-doc
    2.75  #GTK_DOC_CHECK(1.4)
    2.76  
    2.77 @@ -222,7 +248,7 @@
    2.78  tests/Makefile
    2.79  gmyth.pc])
    2.80  
    2.81 -if test x"$enable_debug" != xno; then
    2.82 +if test "x$enable_debug" != "xno"; then
    2.83      AC_MSG_NOTICE([Debug: Enabled])
    2.84  else
    2.85      AC_MSG_NOTICE([Debug: Disabled])
     3.1 --- a/gmyth/src/Makefile.am	Wed Jan 10 23:23:54 2007 +0000
     3.2 +++ b/gmyth/src/Makefile.am	Thu Jan 11 17:18:48 2007 +0000
     3.3 @@ -48,6 +48,11 @@
     3.4  	$(GSTPLUGINSBASE_CFLAGS)	\
     3.5  	$(MYSQL_CFLAGS)
     3.6  
     3.7 +if WITH_GMYTH_UPNP
     3.8 +libgmyth_la_CFLAGS += 			\
     3.9 +	$(GMYTH_UPNP_CFLAGS)
    3.10 +endif
    3.11 +
    3.12  libgmyth_la_LDFLAGS = 			\
    3.13  	-export-dynamic 			\
    3.14  	$(MYSQL_LIBS) 				\
    3.15 @@ -55,6 +60,11 @@
    3.16  	$(GSTBASE_LIBS)				\
    3.17  	$(GSTPLUGINS_LIBS)
    3.18  
    3.19 +if WITH_GMYTH_UPNP
    3.20 +libgmyth_la_LIBS = 			\
    3.21 +	$(GMYTH_UPNP_LIBS)
    3.22 +endif
    3.23 +
    3.24  libgmyth_includedir = 			\
    3.25  	$(pkgincludedir)
    3.26  
     4.1 --- a/gmyth/src/gmyth_backendinfo.c	Wed Jan 10 23:23:54 2007 +0000
     4.2 +++ b/gmyth/src/gmyth_backendinfo.c	Thu Jan 11 17:18:48 2007 +0000
     4.3 @@ -32,6 +32,10 @@
     4.4  #include "gmyth_uri.h"
     4.5  #include "gmyth_debug.h"
     4.6  
     4.7 +#ifdef WITH_GMYTH_UPNP
     4.8 +#include <gmyth-upnp/gmyth_upnp.h>
     4.9 +#endif
    4.10 +
    4.11  static void gmyth_backend_info_class_init  (GMythBackendInfoClass *klass);
    4.12  static void gmyth_backend_info_init        (GMythBackendInfo *object);
    4.13  
    4.14 @@ -142,7 +146,15 @@
    4.15      
    4.16      if ( NULL == hostname || strlen(hostname) <= 0 )
    4.17      { 
    4.18 -	gmyth_debug ( "Error trying to set a hostname equals to NULL (it doesn't using UPnP)." );
    4.19 +    #ifdef WITH_GMYTH_UPNP
    4.20 +	    GMythUPnP *gmyth_upnp = gmyth_upnp_new( backend_info );
    4.21 +	    /* backend_info = gmyth_upnp_get_backend_info( gmyth_upnp ); */
    4.22 +	    backend_info->hostname = g_strdup ( gmyth_upnp_get_host( gmyth_upnp ) );
    4.23 +	    g_object_unref( gmyth_upnp );
    4.24 +    #else
    4.25 +	  	gmyth_debug ( "Error trying to set a hostname equals to NULL (it doesn't using UPnP)." );
    4.26 +  		return NULL;
    4.27 +    #endif
    4.28      } else {    	
    4.29      	backend_info->hostname = g_strdup (hostname);
    4.30      }
    4.31 @@ -179,7 +191,15 @@
    4.32  
    4.33      if ( port <= 0 )
    4.34      { 
    4.35 -        gmyth_debug ( "Error trying to set a hostname equals to NULL (it doesn't using UPnP)." );
    4.36 +    #ifdef WITH_GMYTH_UPNP
    4.37 +	    GMythUPnP *gmyth_upnp = gmyth_upnp_new( backend_info );
    4.38 +	    backend_info = gmyth_upnp_get_backend_info( gmyth_upnp );
    4.39 +	    backend_info->port = gmyth_upnp_get_port( gmyth_upnp );
    4.40 +	    g_object_unref( gmyth_upnp );
    4.41 +    #else
    4.42 +	  	gmyth_debug ( "Error trying to set a hostname equals to NULL (it doesn't using UPnP)." );
    4.43 +  		return NULL;
    4.44 +    #endif
    4.45      } else {    	
    4.46      	backend_info->port = port;
    4.47      }