diff -Nurd -x'*~' cairo-1.12.14.orig/Makefile.in cairo-1.12.14/Makefile.in
--- cairo-1.12.14.orig/Makefile.in	2013-02-10 08:39:17.000000000 -0500
+++ cairo-1.12.14/Makefile.in	2013-07-09 14:39:22.000000000 -0400
@@ -80,7 +80,7 @@
 TESTS =
 check_PROGRAMS =
 # libpng is required for our test programs
-@CAIRO_HAS_PNG_FUNCTIONS_TRUE@am__append_1 = boilerplate test perf
+@CAIRO_HAS_PNG_FUNCTIONS_TRUE@am__append_1 = boilerplate
 subdir = .
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/build/aclocal.cairo.m4 \
diff -Nurd -x'*~' cairo-1.12.14.orig/configure cairo-1.12.14/configure
--- cairo-1.12.14.orig/configure	2013-02-10 08:39:19.000000000 -0500
+++ cairo-1.12.14/configure	2016-03-06 23:31:19.000000000 -0500
@@ -21802,6 +21802,8 @@
 
       fi
 
+      old_CPPFLAGS=$CPPFLAGS
+      CPPFLAGS="$CPPFLAGS $xlib_CFLAGS $xlib_NONPKGCONFIG_CFLAGS"
       for ac_header in X11/extensions/XShm.h X11/extensions/shmproto.h X11/extensions/shmstr.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -21816,6 +21818,7 @@
 fi
 
 done
+CPPFLAGS=$old_CPPFLAGS
 
 
 
diff -Nurd -x'*~' cairo-1.12.14.orig/util/cairo-gobject/Makefile.in cairo-1.12.14/util/cairo-gobject/Makefile.in
--- cairo-1.12.14.orig/util/cairo-gobject/Makefile.in	2013-02-10 08:39:17.000000000 -0500
+++ cairo-1.12.14/util/cairo-gobject/Makefile.in	2013-07-09 14:39:22.000000000 -0400
@@ -113,7 +113,7 @@
 am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(cairoincludedir)"
 LTLIBRARIES = $(lib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
-libcairo_gobject_la_DEPENDENCIES = $(top_builddir)/src/libcairo.la \
+libcairo_gobject_la_DEPENDENCIES = \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am_libcairo_gobject_la_OBJECTS =  \
 	libcairo_gobject_la-cairo-gobject-enums.lo \
@@ -379,7 +379,7 @@
 xlib_xrender_CFLAGS = @xlib_xrender_CFLAGS@
 xlib_xrender_LIBS = @xlib_xrender_LIBS@
 lib_LTLIBRARIES = libcairo-gobject.la
-AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
+AM_CPPFLAGS = `$(PKG_CONFIG) --cflags cairo`
 cairoincludedir = $(includedir)/cairo
 cairoinclude_HEADERS = cairo-gobject.h
 libcairo_gobject_la_SOURCES = \
@@ -389,7 +389,7 @@
 
 libcairo_gobject_la_CFLAGS = $(CAIRO_CFLAGS) $(GOBJECT_CFLAGS)
 libcairo_gobject_la_LDFLAGS = -version-info $(CAIRO_LIBTOOL_VERSION_INFO) -no-undefined $(export_symbols)
-libcairo_gobject_la_LIBADD = $(top_builddir)/src/libcairo.la $(CAIRO_LIBS) $(GOBJECT_LIBS)
+libcairo_gobject_la_LIBADD = `$(PKG_CONFIG) --libs cairo` $(GOBJECT_LIBS)
 all: all-am
 
 .SUFFIXES:
diff -Nurd -x'*~' cairo-1.12.14.orig/util/cairo-script/Makefile.in cairo-1.12.14/util/cairo-script/Makefile.in
--- cairo-1.12.14.orig/util/cairo-script/Makefile.in	2013-02-10 08:39:17.000000000 -0500
+++ cairo-1.12.14/util/cairo-script/Makefile.in	2013-07-09 14:45:35.000000000 -0400
@@ -118,7 +118,7 @@
 LTLIBRARIES = $(lib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 libcairo_script_interpreter_la_DEPENDENCIES =  \
-	$(top_builddir)/src/libcairo.la $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_1)
 am__objects_1 = libcairo_script_interpreter_la-cairo-script-file.lo \
 	libcairo_script_interpreter_la-cairo-script-hash.lo \
@@ -146,11 +146,11 @@
 am_csi_exec_OBJECTS = csi-exec.$(OBJEXT)
 csi_exec_OBJECTS = $(am_csi_exec_OBJECTS)
 csi_exec_DEPENDENCIES = libcairo-script-interpreter.la \
-	$(top_builddir)/src/libcairo.la $(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_1)
 am_csi_replay_OBJECTS = csi_replay-csi-replay.$(OBJEXT)
 csi_replay_OBJECTS = $(am_csi_replay_OBJECTS)
 csi_replay_DEPENDENCIES = libcairo-script-interpreter.la \
-	$(top_builddir)/src/libcairo.la $(am__DEPENDENCIES_1)
+	$(am__DEPENDENCIES_1)
 csi_replay_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
 	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(csi_replay_CFLAGS) \
 	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
@@ -160,7 +160,7 @@
 csi_trace_OBJECTS = $(am_csi_trace_OBJECTS)
 @CAIRO_HAS_SCRIPT_SURFACE_TRUE@csi_trace_DEPENDENCIES =  \
 @CAIRO_HAS_SCRIPT_SURFACE_TRUE@	libcairo-script-interpreter.la \
-@CAIRO_HAS_SCRIPT_SURFACE_TRUE@	$(top_builddir)/src/libcairo.la \
+@CAIRO_HAS_SCRIPT_SURFACE_TRUE@	 \
 @CAIRO_HAS_SCRIPT_SURFACE_TRUE@	$(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
 depcomp = $(SHELL) $(top_srcdir)/build/depcomp
@@ -471,7 +471,7 @@
 
 SUBDIRS = examples
 lib_LTLIBRARIES = libcairo-script-interpreter.la
-AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_builddir)/src
+AM_CPPFLAGS = `$(PKG_CONFIG) --cflags cairo`
 cairoincludedir = $(includedir)/cairo
 cairoinclude_HEADERS = cairo-script-interpreter.h
 libcairo_script_interpreter_la_SOURCES = \
@@ -481,14 +481,14 @@
 
 libcairo_script_interpreter_la_CFLAGS = $(CAIRO_CFLAGS)
 libcairo_script_interpreter_la_LDFLAGS = -version-info $(CAIRO_LIBTOOL_VERSION_INFO) -no-undefined $(export_symbols)
-libcairo_script_interpreter_la_LIBADD = $(top_builddir)/src/libcairo.la $(CAIRO_LIBS) $(lzo_LIBS) -lz
+libcairo_script_interpreter_la_LIBADD = `$(PKG_CONFIG) --libs cairo` $(CAIRO_LIBS) $(lzo_LIBS) -lz
 csi_replay_SOURCES = csi-replay.c
 csi_replay_CFLAGS = $(CAIRO_CFLAGS)
-csi_replay_LDADD = libcairo-script-interpreter.la $(top_builddir)/src/libcairo.la $(CAIRO_LIBS)
+csi_replay_LDADD = libcairo-script-interpreter.la `$(PKG_CONFIG) --libs cairo` $(CAIRO_LIBS)
 csi_exec_SOURCES = csi-exec.c
-csi_exec_LDADD = libcairo-script-interpreter.la $(top_builddir)/src/libcairo.la $(CAIRO_LIBS)
+csi_exec_LDADD = libcairo-script-interpreter.la `$(PKG_CONFIG) --libs cairo` $(CAIRO_LIBS)
 @CAIRO_HAS_SCRIPT_SURFACE_TRUE@csi_trace_SOURCES = csi-trace.c
-@CAIRO_HAS_SCRIPT_SURFACE_TRUE@csi_trace_LDADD = libcairo-script-interpreter.la $(top_builddir)/src/libcairo.la $(CAIRO_LIBS)
+@CAIRO_HAS_SCRIPT_SURFACE_TRUE@csi_trace_LDADD = libcairo-script-interpreter.la `$(PKG_CONFIG) --libs cairo` $(CAIRO_LIBS)
 EXTRA_DIST = \
 	COPYING
 
