43f0ac
diff --git a/configure.in b/configure.in
43f0ac
index 0bde24d..3272e8e 100644
43f0ac
--- a/configure.in
43f0ac
+++ b/configure.in
43f0ac
@@ -4813,6 +4813,8 @@ DLZ_DRIVER_LIBS=""
43f0ac
 DLZ_DRIVER_SRCS=""
43f0ac
 DLZ_DRIVER_OBJS=""
43f0ac
 DLZ_SYSTEM_TEST=""
43f0ac
+DLZ_DRIVER_MYSQL_INCLUDES=""
43f0ac
+DLZ_DRIVER_MYSQL_LIBS=""
43f0ac
 
43f0ac
 # 
43f0ac
 # Configure support for building a shared library object
43f0ac
@@ -4935,7 +4937,9 @@ if test -n "$CONTRIB_DLZ"
43f0ac
 then
43f0ac
 	AC_MSG_RESULT(yes)
43f0ac
 	DLZ_DRIVER_RULES=contrib/dlz/drivers/rules
43f0ac
-	AC_CONFIG_FILES([$DLZ_DRIVER_RULES])
43f0ac
+	AC_CONFIG_FILES([$DLZ_DRIVER_RULES
43f0ac
+		contrib/dlz/modules/mysql/Makefile
43f0ac
+		contrib/dlz/modules/mysqldyn/Makefile])
43f0ac
 else
43f0ac
 	AC_MSG_RESULT(no)
43f0ac
 	DLZ_DRIVER_RULES=/dev/null
43f0ac
@@ -4947,6 +4951,8 @@ AC_SUBST(DLZ_DRIVER_LIBS)
43f0ac
 AC_SUBST(DLZ_DRIVER_SRCS)
43f0ac
 AC_SUBST(DLZ_DRIVER_OBJS)
43f0ac
 AC_SUBST(DLZ_SYSTEM_TEST)
43f0ac
+AC_SUBST(DLZ_DRIVER_MYSQL_INCLUDES)
43f0ac
+AC_SUBST(DLZ_DRIVER_MYSQL_LIBS)
43f0ac
 AC_SUBST_FILE(DLZ_DRIVER_RULES)
43f0ac
 
43f0ac
 if test "yes" = "$cross_compiling"; then
43f0ac
diff --git a/contrib/dlz/config.dlz.in b/contrib/dlz/config.dlz.in
43f0ac
index db8af01..8a13306 100644
43f0ac
--- a/contrib/dlz/config.dlz.in
43f0ac
+++ b/contrib/dlz/config.dlz.in
43f0ac
@@ -45,10 +45,12 @@ AC_DEFUN(DLZ_ADD_DRIVER, [
43f0ac
 	if test -n "$3"
43f0ac
 	then
43f0ac
 		DLZ_DRIVER_INCLUDES="$DLZ_DRIVER_INCLUDES $3"
43f0ac
+		DLZ_DRIVER_$1_INCLUDES="$3"
43f0ac
 	fi
43f0ac
 	if test -n "$4"
43f0ac
 	then
43f0ac
 		DLZ_DRIVER_LIBS="$DLZ_DRIVER_LIBS $4"
43f0ac
+		DLZ_DRIVER_$1_LIBS="$4"
43f0ac
 	fi
43f0ac
 ])
43f0ac
 
43f0ac
diff --git a/contrib/dlz/modules/mysql/Makefile b/contrib/dlz/modules/mysql/Makefile.in
43f0ac
similarity index 81%
43f0ac
rename from contrib/dlz/modules/mysql/Makefile
43f0ac
rename to contrib/dlz/modules/mysql/Makefile.in
43f0ac
index ad3876c..5ab31be 100644
43f0ac
--- a/contrib/dlz/modules/mysql/Makefile
43f0ac
+++ b/contrib/dlz/modules/mysql/Makefile.in
43f0ac
@@ -1,8 +1,8 @@
43f0ac
 prefix = /usr
43f0ac
 libdir = $(prefix)/lib/bind9
43f0ac
 
43f0ac
-CFLAGS=-fPIC -g -I../include
43f0ac
-MYSQL_LIBS=-lmysqlclient
43f0ac
+CFLAGS=-fPIC -Wall -g -I../include @DLZ_DRIVER_MYSQL_INCLUDES@
43f0ac
+MYSQL_LIBS=@DLZ_DRIVER_MYSQL_LIBS@
43f0ac
 
43f0ac
 all: dlz_mysql_dynamic.so
43f0ac
 
43f0ac
diff --git a/contrib/dlz/modules/mysqldyn/Makefile b/contrib/dlz/modules/mysqldyn/Makefile.in
43f0ac
similarity index 81%
43f0ac
rename from contrib/dlz/modules/mysqldyn/Makefile
43f0ac
rename to contrib/dlz/modules/mysqldyn/Makefile.in
43f0ac
index bba91af..248e3da 100644
43f0ac
--- a/contrib/dlz/modules/mysqldyn/Makefile
43f0ac
+++ b/contrib/dlz/modules/mysqldyn/Makefile.in
43f0ac
@@ -1,8 +1,8 @@
43f0ac
 prefix = /usr
43f0ac
 libdir = $(prefix)/lib/bind9
43f0ac
 
43f0ac
-CFLAGS=-fPIC -Wall -g -I../include
43f0ac
-MYSQL_LIBS=-lmysqlclient
43f0ac
+CFLAGS=-fPIC -Wall -g -I../include @DLZ_DRIVER_MYSQL_INCLUDES@
43f0ac
+MYSQL_LIBS=@DLZ_DRIVER_MYSQL_LIBS@
43f0ac
 
43f0ac
 all: dlz_mysqldyn_mod.so
43f0ac