[Spice-commits] 4 commits - configure.ac gtk/Makefile.am python_modules/spice_parser.py

Christophe Fergau teuf at kemper.freedesktop.org
Tue Jan 24 09:40:20 PST 2012


 configure.ac                   |   96 ++++++++++++++++++++++++++++-------------
 gtk/Makefile.am                |    8 ---
 python_modules/spice_parser.py |   10 ++--
 3 files changed, 76 insertions(+), 38 deletions(-)

New commits:
commit 9e21078064d3ddc5faf9f3b91663215ab8b693c2
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu May 19 15:59:07 2011 +0200

    Add check for Perl::Text::CSV
    
    This check is only added to configure.ac contrary to the pyparsing
    patch.

diff --git a/configure.ac b/configure.ac
index 3df1298..2cb4075 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,6 +78,16 @@ if test ! -e "$srcdir/gtk/generated_marshallers.c"; then
   AC_MSG_RESULT([found])
 fi
 
+if test ! -e "$srcdir/gtk/vncdisplaykeymap_osx2xtkbd.c"; then
+  AC_MSG_CHECKING([for Text::CSV Perl module])
+  perl -MText::CSV -e "" >/dev/null 2>&1
+  if test $? -ne 0 ; then
+    AC_MSG_RESULT([not found])
+    AC_MSG_ERROR([Text::CSV Perl module is required to compile this package])
+  fi
+  AC_MSG_RESULT([found])
+fi
+
 SPICE_GLIB_REQUIRES=""
 SPICE_GTK_REQUIRES=""
 
commit 8e3b1d144a8eba5995a450136286ac5750489622
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Thu May 19 15:59:07 2011 +0200

    Add check for pyparsing
    
    Check both in configure.ac (after checking if we need to rebuild
    the marshalling files) and in the python script using pyparsing
    (for people modifying .proto files in tarballs)

diff --git a/configure.ac b/configure.ac
index 1288091..3df1298 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,6 +67,17 @@ AC_SUBST(PROTOCOL_CFLAGS)
 AC_CHECK_LIBM
 AC_SUBST(LIBM)
 
+srcdir="$(dirname $0)"
+if test ! -e "$srcdir/gtk/generated_marshallers.c"; then
+  AC_MSG_CHECKING([for pyparsing python module])
+  echo "import pyparsing" | ${PYTHON} - >/dev/null 2>&1
+  if test $? -ne 0 ; then
+    AC_MSG_RESULT([not found])
+    AC_MSG_ERROR([pyparsing python module is required to compile this package])
+  fi
+  AC_MSG_RESULT([found])
+fi
+
 SPICE_GLIB_REQUIRES=""
 SPICE_GTK_REQUIRES=""
 
diff --git a/python_modules/spice_parser.py b/python_modules/spice_parser.py
index a71b2c2..f634800 100644
--- a/python_modules/spice_parser.py
+++ b/python_modules/spice_parser.py
@@ -1,6 +1,10 @@
-from pyparsing import Literal, CaselessLiteral, Word, OneOrMore, ZeroOrMore, \
-        Forward, delimitedList, Group, Optional, Combine, alphas, nums, restOfLine, cStyleComment, \
-        alphanums, ParseException, ParseResults, Keyword, StringEnd, replaceWith
+try:
+    from pyparsing import Literal, CaselessLiteral, Word, OneOrMore, ZeroOrMore, \
+            Forward, delimitedList, Group, Optional, Combine, alphas, nums, restOfLine, cStyleComment, \
+            alphanums, ParseException, ParseResults, Keyword, StringEnd, replaceWith
+except ImportError:
+    print "Module pyparsing not found."
+    exit(1)
 
 import ptypes
 import sys
commit 75d14e283562fdf9823ed3460436400eb8aa43c2
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Jan 24 14:49:44 2012 +0100

    Use PKG_CHECK_EXISTS for g-i has_symbol_prefix check
    
    GOBJECT_INTROSPECTION_CHECK will alread test for the presence of
    gobject-introspection. The PKG_CHECK_MODULES(GOBJECT_INTROSPECTION)
    call only needs to set the has_symbol_prefix variable, so we can
    use PKG_CHECK_EXISTS here, and let GOBJECT_INTROSPECTION_CHECK do
    the rest of the work.

diff --git a/configure.ac b/configure.ac
index 202aa3c..1288091 100644
--- a/configure.ac
+++ b/configure.ac
@@ -421,7 +421,7 @@ AC_DEFINE_UNQUOTED(WITH_GTHREAD,[$WITH_GTHREAD], [Whether to use gthread corouti
 AM_CONDITIONAL(WITH_GTHREAD, [test "x$WITH_GTHREAD" = "x1"])
 
 AM_CONDITIONAL([HAVE_INTROSPECTION], [test "0" != "1"])
-PKG_CHECK_MODULES([GOBJECT_INTROSPECTION],
+PKG_CHECK_EXISTS([GOBJECT_INTROSPECTION],
         [gobject-introspection-1.0 >= 0.9.4],
         [has_symbol_prefix=yes], [:])
 GOBJECT_INTROSPECTION_CHECK([0.6.7])
commit a0022c4442eb4e5e6cff1e268d444a24a76ecc1d
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Tue Jan 24 14:43:16 2012 +0100

    Autodetect usbredir and PolicyKit by default
    
    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.

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


More information about the Spice-commits mailing list