[Spice-devel] [PATCH 1/4] Autodetect usbredir and PolicyKit by default

Marc-André Lureau mlureau at redhat.com
Tue Jan 24 09:12:59 PST 2012


ack all

----- Mensaje original -----
> Currently, usb redirection and policykit are enabled by default,
> and configure will error out if the required dependencies cannot
> be found. This commit changes the default behaviour, by default
> usb redirection/policykit support is automatically enabled/disabled
> depending on the availability of the needed dependencies. Passing
> --enable-usbredir will error out if the dependencies for usb
> redirection cannot be found, ditto for policykit. This should make
> things nicer for people running configure or autogen.sh with no
> argument.
> ---
>  configure.ac    |   73
>  ++++++++++++++++++++++++++++++++++---------------------
>  gtk/Makefile.am |    8 +----
>  2 files changed, 47 insertions(+), 34 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index d7dd1c0..202aa3c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -314,43 +314,60 @@ else
>  fi
>  
>  AC_ARG_ENABLE([usbredir],
> -  AS_HELP_STRING([--enable-usbredir=@<:@yes/no@:>@],
> -                 [Enable usbredir support @<:@default=yes@:>@]),
> +  AS_HELP_STRING([--enable-usbredir=@<:@auto/yes/no@:>@],
> +                 [Enable usbredir support @<:@default=auto@:>@]),
>    [],
> -  [enable_usbredir="yes"])
> -AC_ARG_ENABLE([polkit],
> -  AS_HELP_STRING([--enable-polkit=@<:@yes/no@:>@],
> -                 [Enable policykit support (for the usb acl
> helper)@<:@default=yes@:>@]),
> -  [],
> -  [enable_polkit="yes"])
> +  [enable_usbredir="auto"])
>  
>  if test "x$enable_usbredir" = "xno"; then
>    AM_CONDITIONAL(WITH_USBREDIR, false)
>    AM_CONDITIONAL(WITH_POLKIT, false)
>  else
> -  PKG_CHECK_MODULES(GUDEV, gudev-1.0)
> -  PKG_CHECK_MODULES(LIBUSB, libusb-1.0 >= 1.0.9)
> -  PKG_CHECK_MODULES(LIBUSBREDIRHOST, libusbredirhost >= 0.3.3)
> -  AC_DEFINE(USE_USBREDIR, [1], [Define if supporting usbredir
> proxying])
> -  AM_CONDITIONAL(WITH_USBREDIR, true)
> -  if test "x$enable_polkit" = "xno"; then
> -    AM_CONDITIONAL(WITH_POLKIT, false)
> -  else
> -    PKG_CHECK_MODULES(POLKIT, polkit-gobject-1 >= 0.96)
> -    AC_CHECK_HEADER([acl/libacl.h],,
> -                    AC_MSG_ERROR([cannot find headers for libacl]))
> -    AC_CHECK_LIB([acl], [acl_get_file], [ACL_LIBS=-lacl]
> [AC_SUBST(ACL_LIBS)],
> -                 AC_MSG_ERROR([cannot find libacl]))
> +  PKG_CHECK_MODULES([USBREDIR],
> +                    [gudev-1.0 libusb-1.0 >= 1.0.9 libusbredirhost
> >= 0.3.3],
> +                    [have_usbredir=yes],
> +                    [have_usbredir=no])
> +  if test x"$have_usbredir" = "xno" && test x"$enable_usbredir" =
> "xyes"; then
> +    AC_MSG_ERROR([usbredir support explicitly requested, but some
> required packages are not available])
> +  fi
> +  if test x"$have_usbredir" = "xyes"; then
> +    AC_DEFINE(USE_USBREDIR, [1], [Define if supporting usbredir
> proxying])
> +  fi
> +  AM_CONDITIONAL([WITH_USBREDIR], [test x"$have_usbredir" = "xyes"])
> +fi
> +
> +AC_ARG_ENABLE([polkit],
> +  AS_HELP_STRING([--enable-polkit=@<:@yes/no@:>@],
> +                 [Enable policykit support (for the usb acl
> helper)@<:@default=yes@:>@]),
> +  [],
> +  [enable_polkit="auto"])
> +
> +if test x"$have_usbredir" = "xyes" && test "x$enable_polkit" !=
> "xno"; then
> +  have_polkit=yes
> +  PKG_CHECK_MODULES([POLKIT], [polkit-gobject-1 >= 0.96],
> +                              [],
> +                              [have_polkit=no])
> +  AC_CHECK_HEADER([acl/libacl.h], [], [have_polkit=no])
> +  AC_CHECK_LIB([acl], [acl_get_file], [ACL_LIBS=-lacl],
> [have_polkit=no])
> +  if test x"$enable_polkit" = "xyes" && test x"$have_polkit" =
> "xno"; then
> +    AC_MSG_ERROR([PolicyKit support explicitly requested, but some
> required packages are not available])
> +  fi
> +
> +  if test x"$have_polkit" = "xyes"; then
> +    AC_SUBST(ACL_LIBS)
>      AC_DEFINE(USE_POLKIT, [1], [Define if supporting polkit])
> -    AM_CONDITIONAL(WITH_POLKIT, true)
> -    POLICYDIR=`${PKG_CONFIG} polkit-gobject-1 --variable=policydir`
> -    AC_SUBST(POLICYDIR)
> -    # Check for polkit_authority_get_sync()
> -    AC_CHECK_LIB([polkit-gobject-1], [polkit_authority_get_sync],
> ac_have_pk_auth_get_sync="1", ac_have_pk_auth_get_sync="0")
> -    AC_DEFINE_UNQUOTED(HAVE_POLKIT_AUTHORITY_GET_SYNC,
> $ac_have_pk_auth_get_sync, [Define if you have a polkit with
> polkit_authority_get_sync()])
>    fi
> +  AM_CONDITIONAL([WITH_POLKIT], [test x"$have_polkit" = "xyes"])
> +  POLICYDIR=`${PKG_CONFIG} polkit-gobject-1 --variable=policydir`
> +  AC_SUBST(POLICYDIR)
> +  # Check for polkit_authority_get_sync()
> +  AC_CHECK_LIB([polkit-gobject-1], [polkit_authority_get_sync],
> ac_have_pk_auth_get_sync="1", ac_have_pk_auth_get_sync="0")
> +  AC_DEFINE_UNQUOTED(HAVE_POLKIT_AUTHORITY_GET_SYNC,
> $ac_have_pk_auth_get_sync, [Define if you have a polkit with
> polkit_authority_get_sync()])
> +else
> +  AM_CONDITIONAL(WITH_POLKIT, false)
>  fi
>  
> +
>  AC_ARG_WITH([usb-acl-helper-dir],
>    AS_HELP_STRING([--with-usb-acl-helper-dir=DIR],
>                   [Directory where the USB ACL helper binary should
>                   be installed]),
> @@ -598,7 +615,7 @@ AC_MSG_NOTICE([
>          Target:                   ${red_target}
>          SASL support:             ${enable_sasl}
>          Smartcard support:        ${enable_smartcard}
> -        USB redirection support:  ${enable_usbredir}
> +        USB redirection support:  ${have_usbredir}
>          Gtk:                      $GTK_API_VERSION
>  
>          Now type 'make' to build $PACKAGE
> diff --git a/gtk/Makefile.am b/gtk/Makefile.am
> index 043e48f..6f39888 100644
> --- a/gtk/Makefile.am
> +++ b/gtk/Makefile.am
> @@ -78,9 +78,7 @@ SPICE_COMMON_CPPFLAGS = \
>  	$(SASL_CFLAGS)			\
>  	$(GST_CFLAGS)			\
>  	$(SMARTCARD_CFLAGS)		\
> -	$(GUDEV_CFLAGS)			\
> -	$(LIBUSB_CFLAGS)		\
> -	$(LIBUSBREDIRHOST_CFLAGS)	\
> +	$(USBREDIR_CFLAGS)		\
>  	$(NULL)
>  
>  AM_CPPFLAGS = \
> @@ -170,9 +168,7 @@ libspice_client_glib_2_0_la_LIBADD =	\
>  	$(GST_LIBS)			\
>  	$(SASL_LIBS)			\
>  	$(SMARTCARD_LIBS)		\
> -	$(GUDEV_LIBS)			\
> -	$(LIBUSB_LIBS)			\
> -	$(LIBUSBREDIRHOST_LIBS)		\
> +	$(USBREDIR_LIBS)		\
>  	$(NULL)
>  
>  if WITH_POLKIT
> --
> 1.7.7.6
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list