--- gtk+-1.2.10/gdk/Makefile.am	2009-04-17 17:02:02.000000000 +0100
+++ gtk+-1.2.10/gdk/Makefile.am	2009-04-17 17:05:49.000000000 +0100
@@ -22,10 +22,9 @@
 	-release $(LT_RELEASE) \
 	-export-dynamic \
 	-no-undefined -Wl,--no-undefined \
-	@GLIB_DEPLIBS@	\
+	$(filter-out -lgmodule -ldl, @GLIB_DEPLIBS@) \
 	@x_ldflags@	\
 	@x_libs@	\
-	-lm		\
 @STRIP_END@
 
 #
--- gtk+-1.2.10/gtk/Makefile.am	2009-04-17 20:46:56.000000000 +0100
+++ gtk+-1.2.10/gtk/Makefile.am	2009-04-17 20:52:24.000000000 +0100
@@ -32,9 +32,9 @@
 	-release $(LT_RELEASE) 					\
 	-export-dynamic						\
 	-no-undefined -Wl,--no-undefined			\
-	@GLIB_DEPLIBS@ 						\
+	$(filter-out -ldl, @GLIB_DEPLIBS@)			\
 	@x_ldflags@						\
-	@x_libs@ 						\
+	$(filter-out -lXi -lXext, @x_libs@)			\
 	-lm							\
 @STRIP_END@
 #	$(top_builddir)/gdk/libgdk.la
