# https://savannah.nongnu.org/bugs/?25362
# https://bugs.gentoo.org/show_bug.cgi?id=226837
diff -Nura a/configure.ac b/configure.ac
--- a/configure.ac	2009-01-19 22:15:30.000000000 +0100
+++ b/configure.ac	2009-01-19 22:18:10.000000000 +0100
@@ -43,6 +43,9 @@
 PKG_CHECK_MODULES(LIBGKSU, [gtk+-2.0 >= 2.4.0, gconf-2.0, libstartup-notification-1.0, gnome-keyring-1, libgtop-2.0])
 PKG_CHECK_MODULES(GKSU_PROPERTIES, [gtk+-2.0 >= 2.4.0, gconf-2.0, libglade-2.0])
 
+PKG_CHECK_MODULES(GLIB, [glib-2.0 gthread-2.0])
+PKG_CHECK_MODULES(GTK, [gtk+-2.0 gconf-2.0])
+
 # Checks for library functions.
 ALL_LINGUAS="ca cs da de es eu fr hu it ko lt pl pt_BR ro ru sk sv nb nl zh_CN"
 
diff -Nura a/gksu-properties/Makefile.am b/gksu-properties/Makefile.am
--- a/gksu-properties/Makefile.am	2009-01-19 22:15:59.000000000 +0100
+++ b/gksu-properties/Makefile.am	2009-01-19 22:19:13.000000000 +0100
@@ -3,7 +3,7 @@
 AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" -DDATA_DIR=\"$(datadir)\" -DPREFIX=\"$(prefix)\"
 
 bin_PROGRAMS = gksu-properties
-gksu_properties_LDFLAGS = ${GKSU_PROPERTIES_LIBS}
+gksu_properties_LDADD = ${GKSU_PROPERTIES_LIBS}
 gksu_properties_SOURCES = gksu-properties.c
 
 gladedir = ${prefix}/share/${PACKAGE}
diff -Nura a/libgksu/Makefile.am b/libgksu/Makefile.am
--- a/libgksu/Makefile.am	2009-01-19 22:15:59.000000000 +0100
+++ b/libgksu/Makefile.am	2009-01-19 22:18:25.000000000 +0100
@@ -8,8 +8,8 @@
 # major -> breaks backward compatibility (changes to existing ABI)
 # minor -> keeps compatibility (additions to the API)
 # micro -> no change to the API/ABI
-libgksu2_la_LIBADD = ../libgksuui/libgksuui1.0.la
-libgksu2_la_LDFLAGS = -version-info 0:2:0 -Wl,-O1 -lutil ${LIBGKSU_LIBS}
+libgksu2_la_LIBADD = ../libgksuui/libgksuui1.0.la -lutil ${LIBGKSU_LIBS}
+libgksu2_la_LDFLAGS = -version-info 0:2:0 -Wl,-O1
 if USE_VERSION_SCRIPT
 libgksu2_la_LDFLAGS += -Wl,--version-script=libgksu.ver
 endif
@@ -24,12 +24,11 @@
 
 pkglibdir = ${libdir}/${PACKAGE}
 pkglib_PROGRAMS = gksu-run-helper
-gksu_run_helper_LDFLAGS = `pkg-config --libs glib-2.0`
+gksu_run_helper_LDADD = ${GLIB_LIBS} 
 gksu_run_helper_SOURCES = gksu-run-helper.c
 
 noinst_PROGRAMS = test-gksu
 test_gksu_SOURCES = test-gksu.c
-test_gksu_LDADD = libgksu2.la
-test_gksu_LDFLAGS = `pkg-config --libs glib-2.0 gthread-2.0`
+test_gksu_LDADD = libgksu2.la ${GLIB_LIBS}
 
 EXTRA_DIST = libgksu.ver
diff -Nura a/libgksuui/Makefile.am b/libgksuui/Makefile.am
--- a/libgksuui/Makefile.am	2009-01-19 22:15:59.000000000 +0100
+++ b/libgksuui/Makefile.am	2009-01-19 22:18:54.000000000 +0100
@@ -4,12 +4,13 @@
 
 noinst_LTLIBRARIES = libgksuui1.0.la
 libgksuui1_0_la_SOURCES = gksuui-dialog.c
-libgksuui1_0_la_LDFLAGS = -Wl,-O1 `pkg-config --libs gtk+-2.0 gconf-2.0`
+libgksuui1_0_la_LDFLAGS = -Wl,-O1
+libgksuui1_0_la_LIBADD = ${GTK_LIBS}
 
 noinst_HEADERS = defines.h gksuui.h gksuui-dialog.h
 includedir = ${prefix}/include/$(PACKAGE)
 
 noinst_PROGRAMS = test-gksuui
 test_gksuui_SOURCES = test-gksuui.c
-test_gksuui_LDADD = libgksuui1.0.la
-test_gksuui_LDFLAGS = `pkg-config --libs glib-2.0 gthread-2.0`
+test_gksuui_LDADD = libgksuui1.0.la ${GLIB_LIBS}
+
