[pygobject] Make Cairo an optional dependency



commit 65a06a7216163c7e65b32c5b5f3388faa7fda5d6
Author: Simon van der Linden <svdlinden gnome org>
Date:   Thu Aug 12 16:18:58 2010 +0200

    Make Cairo an optional dependency
    
    Add the --enable-cairo configure argument.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=616732

 configure.ac   |   15 ++++++++++++---
 gi/Makefile.am |   20 ++++++++++++--------
 2 files changed, 24 insertions(+), 11 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index dcf73a9..f963ee2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -204,6 +204,11 @@ if test -n "$export_dynamic"; then
   GIOUNIX_LIBS=`echo $GIOUNIX_LIBS | sed -e "s/$export_dynamic//"`
 fi
 
+AC_ARG_ENABLE(cairo,
+    AC_HELP_STRING([--enable-cairo], [Enable Cairo bindings using introspection information]),
+    enable_cairo=$enableval,
+    enable_cairo=yes)
+
 AC_ARG_ENABLE(introspection,
   AC_HELP_STRING([--enable-introspection], [Use introspection information]),
   enable_introspection=$enableval,
@@ -214,11 +219,15 @@ if test "$enable_introspection" != no; then
         glib-2.0 >= glib_required_version
         gobject-introspection-1.0 >= introspection_required_version
     )
-    PKG_CHECK_MODULES(PYCAIRO,
-        pycairo >= pycairo_required_version
-    )
+
+    if test "$enable_cairo" != no; then
+        PKG_CHECK_MODULES(PYCAIRO,
+            pycairo >= pycairo_required_version
+        )
+    fi
 fi
 AM_CONDITIONAL(ENABLE_INTROSPECTION, test "$enable_introspection" = "yes")
+AM_CONDITIONAL(ENABLE_CAIRO, test "$enable_cairo" = "yes")
 
 INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
 INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
diff --git a/gi/Makefile.am b/gi/Makefile.am
index d0541bb..1606a95 100644
--- a/gi/Makefile.am
+++ b/gi/Makefile.am
@@ -68,18 +68,22 @@ _gi_cairo_la_LIBADD = \
 	$(PYCAIRO_LIBS)
 _gi_cairo_la_SOURCES = pygi-foreign-cairo.c
 
-pygi_LTLIBRARIES = _gi.la _gi_cairo.la
+
+pygi_LTLIBRARIES = _gi.la
+
+if ENABLE_CAIRO
+pygi_LTLIBRARIES += _gi_cairo.la
+endif
+
 
 # This is to ensure we have a symlink to the .so in the
 # build directory, which the Python interpreter can load
 # directly without having to know how to parse .la files.
-_gi.so: _gi.la
-	rm -f $@ && $(LN_S) .libs/$@ $@
-_gi_cairo.so: _gi_cairo.la
-	rm -f $@ && $(LN_S) .libs/$@ $@
+.la.so:
+	test -L $@ || $(LN_S) .libs/$@ $@
 
-all-local: _gi.so _gi_cairo.so
-check-local: _gi.so _gi_cairo.so
+all-local: $(LTLIBRARIES:.la=.so)
+check-local: $(LTLIBRARIES:.la=.so)
 clean-local:
-	rm -f _gi.so _gi_cairo.so
+	rm -f $(LTLIBRARIES:.la=.so)
 



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