--- freeradius-2.0.4+dfsg.orig/src/modules/rlm_sql_log/Makefile
+++ freeradius-2.0.4+dfsg/src/modules/rlm_sql_log/Makefile
@@ -6,5 +6,6 @@
 
 TARGET      = rlm_sql_log
 SRCS        = rlm_sql_log.c
+RLM_LIBS    += $(top_builddir)/src/modules/rlm_sql/.libs/rlm_sql.la
 
 include ../rules.mak
--- freeradius-2.0.4+dfsg.orig/src/modules/rlm_sqlcounter/Makefile.in
+++ freeradius-2.0.4+dfsg/src/modules/rlm_sqlcounter/Makefile.in
@@ -6,7 +6,7 @@
 SRCS        = rlm_sqlcounter.c
 HEADERS     =
 RLM_CFLAGS  = @sqlcounter_cflags@
-RLM_LIBS    = @sqlcounter_ldflags@
+RLM_LIBS    = @sqlcounter_ldflags@ $(top_builddir)/src/modules/rlm_sql/.libs/rlm_sql.la
 RLM_INSTALL =
 
 include ../rules.mak
--- freeradius-2.0.4+dfsg.orig/src/modules/rlm_sqlippool/Makefile.in
+++ freeradius-2.0.4+dfsg/src/modules/rlm_sqlippool/Makefile.in
@@ -8,7 +8,7 @@
 SRCS        = rlm_sqlippool.c
 HEADERS     = $(top_builddir)/src/modules/rlm_sql/rlm_sql.h
 RLM_CFLAGS  = -I$(top_builddir)/src/modules/rlm_sql $(INCLTDL)
-RLM_LIBS    =
+RLM_LIBS    += $(top_builddir)/src/modules/rlm_sql/.libs/rlm_sql.la
 RLM_INSTALL =
 
 include ../rules.mak
--- freeradius-2.0.4+dfsg.orig/src/modules/rlm_sql/drivers/rlm_sql_postgresql/Makefile.in
+++ freeradius-2.0.4+dfsg/src/modules/rlm_sql/drivers/rlm_sql_postgresql/Makefile.in
@@ -4,5 +4,6 @@
 SRCS		= sql_postgresql.c
 RLM_SQL_CFLAGS	= @postgresql_cflags@ $(INCLTDL)
 RLM_SQL_LIBS	= @postgresql_ldflags@
+RLM_LIBS       += $(top_builddir)/src/modules/rlm_sql/.libs/rlm_sql.la
 
 include ../rules.mak
--- freeradius-2.0.4+dfsg.orig/src/modules/rlm_sql/drivers/rlm_sql_iodbc/Makefile.in
+++ freeradius-2.0.4+dfsg/src/modules/rlm_sql/drivers/rlm_sql_iodbc/Makefile.in
@@ -4,5 +4,6 @@
 SRCS           = sql_iodbc.c
 RLM_SQL_CFLAGS = @sql_iodbc_cflags@ $(INCLTDL)
 RLM_SQL_LIBS   = @sql_iodbc_ldflags@
+RLM_LIBS      += $(top_builddir)/src/modules/rlm_sql/.libs/rlm_sql.la
 
 include ../rules.mak
--- freeradius-2.0.4+dfsg.orig/src/modules/rlm_sql/drivers/rlm_sql_mysql/Makefile.in
+++ freeradius-2.0.4+dfsg/src/modules/rlm_sql/drivers/rlm_sql_mysql/Makefile.in
@@ -4,5 +4,6 @@
 SRCS           = sql_mysql.c
 RLM_SQL_CFLAGS = @sql_mysql_cflags@ $(INCLTDL)
 RLM_SQL_LIBS   = @sql_mysql_ldflags@
+RLM_LIBS       += $(top_builddir)/src/modules/rlm_sql/.libs/rlm_sql.la
 
 include ../rules.mak
