*) CFLAGS="$CFLAGS -Wall" ;;
esac fi changequote([,])dnl
+PKG_CHECK_MODULES(GTK, [gtk+-2.0], [HAVE_GTK=yes], [HAVE_GTK=no])
+AM_CONDITIONAL(HAVE_GTK, [test "x$HAVE_GTK" = xyes])
+AC_SUBST(GTK_CFLAGS)
+AC_SUBST(GTK_LIBS)
AC_SUBST(DEP_CFLAGS)
AC_SUBST(DEP_LIBS)
+if HAVE_GTK
TESTPROGRAMS = \
composite-test \
gradient-test
noinst_PROGRAMS = $(TESTPROGRAMS)
-INCLUDES = -I$(top_srcdir)/pixman `pkg-config --cflags gtk+-2.0`
-
-GTKLIBS = -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpng12 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
-
-composite_test_LDADD = $(top_builddir)/pixman/libpixman.la $(GTKLIBS)
-gradient_test_LDADD = $(top_builddir)/pixman/libpixman.la $(GTKLIBS)
+INCLUDES = -I$(top_srcdir)/pixman $(GTK_CFLAGS)
+composite_test_LDADD = $(top_builddir)/pixman/libpixman.la $(GTK_LIBS)
+gradient_test_LDADD = $(top_builddir)/pixman/libpixman.la $(GTK_LIBS)
+endif
\ No newline at end of file