diff --git a/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.Makefile.in b/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.Makefile.in
index ed01b2681..13028cd5b 100644
--- a/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.Makefile.in
+++ b/test/12-unit-tests-dnssec.tpkg/12-unit-tests-dnssec.Makefile.in
@@ -13,8 +13,8 @@ datarootdir = @datarootdir@
 CC = @CC@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@ @LIBSSL_CPPFLAGS@ -I../..
-LDFLAGS = @LDFLAGS@ @LIBSSL_LDFLAGS@ -L../../.libs
-LIBS = @LIBS@ @LIBSSL_SSL_LIBS@ -lldns
+LDFLAGS = @LDFLAGS@ @LIBSSL_LDFLAGS@
+LIBS = @LIBS@ @LIBSSL_SSL_LIBS@
 
 # Hmmm gcc 4.6.1 expects $(LIBS) as the last argument
 
@@ -31,7 +31,7 @@ TESTS		= 12-unit-tests-dnssec
 all:	$(TESTS)
 
 12-unit-tests-dnssec:	12-unit-tests-dnssec.o
-		$(LINK) -o $@ $+ $(LIBS)
+		$(LINK) -o $@ $+ ../../.libs/libldns.a $(LIBS)
 
 clean:
 	rm -f *.o
diff --git a/test/13-unit-tests-base.tpkg/13-unit-tests-base.Makefile.in b/test/13-unit-tests-base.tpkg/13-unit-tests-base.Makefile.in
index 6afccf984..e9f8e3717 100644
--- a/test/13-unit-tests-base.tpkg/13-unit-tests-base.Makefile.in
+++ b/test/13-unit-tests-base.tpkg/13-unit-tests-base.Makefile.in
@@ -13,8 +13,8 @@ datarootdir = @datarootdir@
 CC = @CC@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@ @LIBSSL_CPPFLAGS@ -I../..
-LDFLAGS = @LDFLAGS@ @LIBSSL_LDFLAGS@ -L../../.libs
-LIBS = @LIBS@ @LIBSSL_SSL_LIBS@ -lldns
+LDFLAGS = @LDFLAGS@ @LIBSSL_LDFLAGS@
+LIBS = @LIBS@ @LIBSSL_SSL_LIBS@
 
 COMPILE         = $(CC) $(CPPFLAGS) $(CFLAGS)
 LINK            = $(CC) $(CFLAGS) $(LDFLAGS)
@@ -29,7 +29,7 @@ TESTS		= 13-unit-tests-base
 all:	$(TESTS)
 
 13-unit-tests-base:	13-unit-tests-base.o
-		$(LINK) -o $@ $+ $(LIBS)
+		$(LINK) -o $@ $+ ../../.libs/libldns.a $(LIBS)
 
 clean:
 	rm -f *.o
diff --git a/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.Makefile.in b/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.Makefile.in
index 99b8aca94..0c997cb76 100644
--- a/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.Makefile.in
+++ b/test/15-unit-tests-rrtypes.tpkg/15-unit-tests-rrtypes.Makefile.in
@@ -13,8 +13,8 @@ datarootdir = @datarootdir@
 CC = @CC@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@ @LIBSSL_CPPFLAGS@ -I../..
-LDFLAGS = @LDFLAGS@ @LIBSSL_LDFLAGS@ -L../../.libs
-LIBS = @LIBS@ @LIBSSL_SSL_LIBS@ -lldns
+LDFLAGS = @LDFLAGS@ @LIBSSL_LDFLAGS@
+LIBS = @LIBS@ @LIBSSL_SSL_LIBS@
 
 COMPILE         = $(CC) $(CPPFLAGS) $(CFLAGS)
 LINK            = $(CC) $(CFLAGS) $(LDFLAGS)
@@ -29,7 +29,7 @@ TESTS		= 15-unit-tests-rrtypes
 all:	$(TESTS)
 
 15-unit-tests-rrtypes:	15-unit-tests-rrtypes.o
-		$(LINK) -o $@ $+ $(LIBS)
+		$(LINK) -o $@ $+ ../../.libs/libldns.a $(LIBS)
 
 clean:
 	rm -f *.o
diff --git a/test/16-unit-tests-edns.tpkg/16-unit-tests-edns.Makefile.in b/test/16-unit-tests-edns.tpkg/16-unit-tests-edns.Makefile.in
index 459e9e35c..9d4b5e63e 100644
--- a/test/16-unit-tests-edns.tpkg/16-unit-tests-edns.Makefile.in
+++ b/test/16-unit-tests-edns.tpkg/16-unit-tests-edns.Makefile.in
@@ -13,8 +13,8 @@ datarootdir = @datarootdir@
 CC = @CC@
 CFLAGS = @CFLAGS@
 CPPFLAGS = @CPPFLAGS@ @LIBSSL_CPPFLAGS@ -I../..
-LDFLAGS = @LDFLAGS@ @LIBSSL_LDFLAGS@ -L../../.libs
-LIBS = @LIBS@ @LIBSSL_SSL_LIBS@ -lldns
+LDFLAGS = @LDFLAGS@ @LIBSSL_LDFLAGS@
+LIBS = @LIBS@ @LIBSSL_SSL_LIBS@
 
 COMPILE         = $(CC) $(CPPFLAGS) $(CFLAGS)
 LINK            = $(CC) $(CFLAGS) $(LDFLAGS)
@@ -29,7 +29,7 @@ TESTS		= 16-unit-tests-edns
 all:	$(TESTS)
 
 16-unit-tests-edns:	16-unit-tests-edns.o
-		$(LINK) -o $@ $+ $(LIBS)
+		$(LINK) -o $@ $+ ../../.libs/libldns.a $(LIBS)
 
 clean:
 	rm -f *.o