-LDLIBS += -lfirm -liberty -L/usr/public/libxml2 -lxml2
-# @@@ TODO replace hand crafted stuff (xml2) for configure
+LDLIBS += -lfirm @LIBS@
+
+ifeq ($(enable_libcore),yes)
+LDLIBS += -lcore
+endif
+
+ifeq ($(enable_external_effects),yes)
+LDLIBS += -lxml2
+endif
+
+ifeq ($(disable_libiberty),yes)
+LDLIBS += -liberty
+endif
+