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