d56ed2
From 28f61b8a12da4a8dd10dccaefe8e50fc8605b87e Mon Sep 17 00:00:00 2001
d56ed2
From: Tomas Hozza <thozza@redhat.com>
d56ed2
Date: Mon, 22 Sep 2014 16:44:29 +0200
d56ed2
Subject: [PATCH] Distributing native PKCS#11 BIND and utils
d56ed2
d56ed2
Signed-off-by: Tomas Hozza <thozza@redhat.com>
d56ed2
---
d56ed2
 bin/Makefile.in                   |  2 +-
d56ed2
 bin/dnssec-pkcs11/Makefile.in     | 40 +++++++++++------------
d56ed2
 bin/dnssec/Makefile.in            |  2 +-
d56ed2
 bin/named-pkcs11/Makefile.in      | 40 +++++++++--------------
d56ed2
 bin/named/Makefile.in             |  2 +-
d56ed2
 bin/pkcs11/Makefile.in            |  6 ++--
d56ed2
 configure.in                      | 68 +++++++++++++++++++++++++++++++--------
d56ed2
 lib/Makefile.in                   |  2 +-
d56ed2
 lib/dns-pkcs11/Makefile.in        | 24 +++++++-------
d56ed2
 lib/export/Makefile.in            |  2 +-
d56ed2
 lib/export/dns-pkcs11/Makefile.in | 26 +++++++--------
d56ed2
 lib/export/isc-pkcs11/Makefile.in | 18 +++++------
d56ed2
 lib/isc-pkcs11/Makefile.in        | 24 +++++++-------
d56ed2
 make/includes.in                  | 10 ++++++
d56ed2
 14 files changed, 154 insertions(+), 112 deletions(-)
d56ed2
d56ed2
diff --git a/bin/Makefile.in b/bin/Makefile.in
d56ed2
index 87ca5b2..187ec23 100644
d56ed2
--- a/bin/Makefile.in
d56ed2
+++ b/bin/Makefile.in
d56ed2
@@ -19,7 +19,7 @@ srcdir =	@srcdir@
d56ed2
 VPATH =		@srcdir@
d56ed2
 top_srcdir =	@top_srcdir@
d56ed2
 
d56ed2
-SUBDIRS =	named rndc dig dnssec tools tests nsupdate \
d56ed2
+SUBDIRS =	named named-pkcs11 rndc dig dnssec dnssec-pkcs11 tools tests nsupdate \
d56ed2
 		check confgen @PYTHON_TOOLS@ @PKCS11_TOOLS@
d56ed2
 TARGETS =
d56ed2
 
d56ed2
diff --git a/bin/dnssec-pkcs11/Makefile.in b/bin/dnssec-pkcs11/Makefile.in
d56ed2
index 64e1846..7846662 100644
d56ed2
--- a/bin/dnssec-pkcs11/Makefile.in
d56ed2
+++ b/bin/dnssec-pkcs11/Makefile.in
d56ed2
@@ -23,18 +23,18 @@ top_srcdir =	@top_srcdir@
d56ed2
 
d56ed2
 @BIND9_MAKE_INCLUDES@
d56ed2
 
d56ed2
-CINCLUDES =	${DNS_INCLUDES} ${ISC_INCLUDES}
d56ed2
+CINCLUDES =	${DNS_PKCS11_INCLUDES} ${ISC_PKCS11_INCLUDES}
d56ed2
 
d56ed2
 CDEFINES =	-DVERSION=\"${VERSION}\" @USE_PKCS11@ @PKCS11_ENGINE@ \
d56ed2
-		@CRYPTO@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\"
d56ed2
+		@CRYPTO_PK11@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\"
d56ed2
 CWARNINGS =
d56ed2
 
d56ed2
-DNSLIBS =	../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
d56ed2
-ISCLIBS =	../../lib/isc/libisc.@A@
d56ed2
-ISCNOSYMLIBS =	../../lib/isc/libisc-nosymtbl.@A@
d56ed2
+DNSLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@ @DNS_CRYPTO_PK11_LIBS@
d56ed2
+ISCLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
d56ed2
+ISCNOSYMLIBS =	../../lib/isc-pkcs11/libisc-pkcs11-nosymtbl.@A@
d56ed2
 
d56ed2
-DNSDEPLIBS =	../../lib/dns/libdns.@A@
d56ed2
-ISCDEPLIBS =	../../lib/isc/libisc.@A@
d56ed2
+DNSDEPLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@
d56ed2
+ISCDEPLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
d56ed2
 
d56ed2
 DEPLIBS =	${DNSDEPLIBS} ${ISCDEPLIBS}
d56ed2
 
d56ed2
@@ -43,10 +43,10 @@ LIBS =		${DNSLIBS} ${ISCLIBS} @LIBS@
d56ed2
 NOSYMLIBS =	${DNSLIBS} ${ISCNOSYMLIBS} @LIBS@
d56ed2
 
d56ed2
 # Alphabetically
d56ed2
-TARGETS =	dnssec-keygen@EXEEXT@ dnssec-signzone@EXEEXT@ \
d56ed2
-		dnssec-keyfromlabel@EXEEXT@ dnssec-dsfromkey@EXEEXT@ \
d56ed2
-		dnssec-revoke@EXEEXT@ dnssec-settime@EXEEXT@ \
d56ed2
-		dnssec-verify@EXEEXT@ dnssec-importkey@EXEEXT@
d56ed2
+TARGETS =	dnssec-keygen-pkcs11@EXEEXT@ dnssec-signzone-pkcs11@EXEEXT@ \
d56ed2
+		dnssec-keyfromlabel-pkcs11@EXEEXT@ dnssec-dsfromkey-pkcs11@EXEEXT@ \
d56ed2
+		dnssec-revoke-pkcs11@EXEEXT@ dnssec-settime-pkcs11@EXEEXT@ \
d56ed2
+		dnssec-verify-pkcs11@EXEEXT@ dnssec-importkey-pkcs11@EXEEXT@
d56ed2
 
d56ed2
 OBJS =		dnssectool.@O@
d56ed2
 
d56ed2
@@ -67,15 +67,15 @@ MANOBJS =	${MANPAGES} ${HTMLPAGES}
d56ed2
 
d56ed2
 @BIND9_MAKE_RULES@
d56ed2
 
d56ed2
-dnssec-dsfromkey@EXEEXT@: dnssec-dsfromkey.@O@ ${OBJS} ${DEPLIBS}
d56ed2
+dnssec-dsfromkey-pkcs11@EXEEXT@: dnssec-dsfromkey.@O@ ${OBJS} ${DEPLIBS}
d56ed2
 	export BASEOBJS="dnssec-dsfromkey.@O@ ${OBJS}"; \
d56ed2
 	${FINALBUILDCMD}
d56ed2
 
d56ed2
-dnssec-keyfromlabel@EXEEXT@: dnssec-keyfromlabel.@O@ ${OBJS} ${DEPLIBS}
d56ed2
+dnssec-keyfromlabel-pkcs11@EXEEXT@: dnssec-keyfromlabel.@O@ ${OBJS} ${DEPLIBS}
d56ed2
 	export BASEOBJS="dnssec-keyfromlabel.@O@ ${OBJS}"; \
d56ed2
 	${FINALBUILDCMD}
d56ed2
 
d56ed2
-dnssec-keygen@EXEEXT@: dnssec-keygen.@O@ ${OBJS} ${DEPLIBS}
d56ed2
+dnssec-keygen-pkcs11@EXEEXT@: dnssec-keygen.@O@ ${OBJS} ${DEPLIBS}
d56ed2
 	export BASEOBJS="dnssec-keygen.@O@ ${OBJS}"; \
d56ed2
 	${FINALBUILDCMD}
d56ed2
 
d56ed2
@@ -83,7 +83,7 @@ dnssec-signzone.@O@: dnssec-signzone.c
d56ed2
 	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
d56ed2
 		-c ${srcdir}/dnssec-signzone.c
d56ed2
 
d56ed2
-dnssec-signzone@EXEEXT@: dnssec-signzone.@O@ ${OBJS} ${DEPLIBS}
d56ed2
+dnssec-signzone-pkcs11@EXEEXT@: dnssec-signzone.@O@ ${OBJS} ${DEPLIBS}
d56ed2
 	export BASEOBJS="dnssec-signzone.@O@ ${OBJS}"; \
d56ed2
 	${FINALBUILDCMD}
d56ed2
 
d56ed2
@@ -91,19 +91,19 @@ dnssec-verify.@O@: dnssec-verify.c
d56ed2
 	${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -DVERSION=\"${VERSION}\" \
d56ed2
 		-c ${srcdir}/dnssec-verify.c
d56ed2
 
d56ed2
-dnssec-verify@EXEEXT@: dnssec-verify.@O@ ${OBJS} ${DEPLIBS}
d56ed2
+dnssec-verify-pkcs11@EXEEXT@: dnssec-verify.@O@ ${OBJS} ${DEPLIBS}
d56ed2
 	export BASEOBJS="dnssec-verify.@O@ ${OBJS}"; \
d56ed2
 	${FINALBUILDCMD}
d56ed2
 
d56ed2
-dnssec-revoke@EXEEXT@: dnssec-revoke.@O@ ${OBJS} ${DEPLIBS}
d56ed2
+dnssec-revoke-pkcs11@EXEEXT@: dnssec-revoke.@O@ ${OBJS} ${DEPLIBS}
d56ed2
 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
d56ed2
 	dnssec-revoke.@O@ ${OBJS} ${LIBS}
d56ed2
 
d56ed2
-dnssec-settime@EXEEXT@: dnssec-settime.@O@ ${OBJS} ${DEPLIBS}
d56ed2
+dnssec-settime-pkcs11@EXEEXT@: dnssec-settime.@O@ ${OBJS} ${DEPLIBS}
d56ed2
 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
d56ed2
 	dnssec-settime.@O@ ${OBJS} ${LIBS}
d56ed2
 
d56ed2
-dnssec-importkey@EXEEXT@: dnssec-importkey.@O@ ${OBJS} ${DEPLIBS}
d56ed2
+dnssec-importkey-pkcs11@EXEEXT@: dnssec-importkey.@O@ ${OBJS} ${DEPLIBS}
d56ed2
 	${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \
d56ed2
 	dnssec-importkey.@O@ ${OBJS} ${LIBS}
d56ed2
 
d56ed2
@@ -114,11 +114,9 @@ docclean manclean maintainer-clean::
d56ed2
 
d56ed2
 installdirs:
d56ed2
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
d56ed2
-	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8
d56ed2
 
d56ed2
 install:: ${TARGETS} installdirs
d56ed2
 	for t in ${TARGETS}; do ${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} $$t ${DESTDIR}${sbindir}; done
d56ed2
-	for m in ${MANPAGES}; do ${INSTALL_DATA} ${srcdir}/$$m ${DESTDIR}${mandir}/man8; done
d56ed2
 
d56ed2
 clean distclean::
d56ed2
 	rm -f ${TARGETS}
d56ed2
diff --git a/bin/dnssec/Makefile.in b/bin/dnssec/Makefile.in
d56ed2
index 64e1846..cfb5628 100644
d56ed2
--- a/bin/dnssec/Makefile.in
d56ed2
+++ b/bin/dnssec/Makefile.in
d56ed2
@@ -25,7 +25,7 @@ top_srcdir =	@top_srcdir@
d56ed2
 
d56ed2
 CINCLUDES =	${DNS_INCLUDES} ${ISC_INCLUDES}
d56ed2
 
d56ed2
-CDEFINES =	-DVERSION=\"${VERSION}\" @USE_PKCS11@ @PKCS11_ENGINE@ \
d56ed2
+CDEFINES =	-DVERSION=\"${VERSION}\" \
d56ed2
 		@CRYPTO@ -DPK11_LIB_LOCATION=\"@PKCS11_PROVIDER@\"
d56ed2
 CWARNINGS =
d56ed2
 
d56ed2
diff --git a/bin/named-pkcs11/Makefile.in b/bin/named-pkcs11/Makefile.in
d56ed2
index cd65777..be791ca 100644
d56ed2
--- a/bin/named-pkcs11/Makefile.in
d56ed2
+++ b/bin/named-pkcs11/Makefile.in
d56ed2
@@ -47,26 +47,26 @@ DLZDRIVER_INCLUDES =	@DLZ_DRIVER_INCLUDES@
d56ed2
 DLZDRIVER_LIBS =	@DLZ_DRIVER_LIBS@
d56ed2
 
d56ed2
 CINCLUDES =	-I${srcdir}/include -I${srcdir}/unix/include -I. \
d56ed2
-		${LWRES_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES} \
d56ed2
-		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
d56ed2
+		${LWRES_INCLUDES} ${DNS_PKCS11_INCLUDES} ${BIND9_INCLUDES} \
d56ed2
+		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_PKCS11_INCLUDES} \
d56ed2
 		${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@
d56ed2
 
d56ed2
-CDEFINES =      @CONTRIB_DLZ@ @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO@
d56ed2
+CDEFINES =      @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO_PK11@
d56ed2
 
d56ed2
 CWARNINGS =
d56ed2
 
d56ed2
-DNSLIBS =	../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@
d56ed2
+DNSLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@ @DNS_CRYPTO_LIBS@
d56ed2
 ISCCFGLIBS =	../../lib/isccfg/libisccfg.@A@
d56ed2
 ISCCCLIBS =	../../lib/isccc/libisccc.@A@
d56ed2
-ISCLIBS =	../../lib/isc/libisc.@A@
d56ed2
+ISCLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
d56ed2
 ISCNOSYMLIBS =	../../lib/isc/libisc-nosymtbl.@A@
d56ed2
 LWRESLIBS =	../../lib/lwres/liblwres.@A@
d56ed2
 BIND9LIBS =	../../lib/bind9/libbind9.@A@
d56ed2
 
d56ed2
-DNSDEPLIBS =	../../lib/dns/libdns.@A@
d56ed2
+DNSDEPLIBS =	../../lib/dns-pkcs11/libdns-pkcs11.@A@
d56ed2
 ISCCFGDEPLIBS =	../../lib/isccfg/libisccfg.@A@
d56ed2
 ISCCCDEPLIBS =	../../lib/isccc/libisccc.@A@
d56ed2
-ISCDEPLIBS =	../../lib/isc/libisc.@A@
d56ed2
+ISCDEPLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
d56ed2
 LWRESDEPLIBS =	../../lib/lwres/liblwres.@A@
d56ed2
 BIND9DEPLIBS =	../../lib/bind9/libbind9.@A@
d56ed2
 
d56ed2
@@ -75,15 +75,15 @@ DEPLIBS =	${LWRESDEPLIBS} ${DNSDEPLIBS} ${BIND9DEPLIBS} \
d56ed2
 
d56ed2
 LIBS =		${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
d56ed2
 		${ISCCFGLIBS} ${ISCCCLIBS} ${ISCLIBS} \
d56ed2
-		${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@
d56ed2
+		@LIBS@
d56ed2
 
d56ed2
 NOSYMLIBS =	${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} \
d56ed2
 		${ISCCFGLIBS} ${ISCCCLIBS} ${ISCNOSYMLIBS} \
d56ed2
-		${DLZDRIVER_LIBS} ${DBDRIVER_LIBS} @LIBS@
d56ed2
+		@LIBS@
d56ed2
 
d56ed2
 SUBDIRS =	unix
d56ed2
 
d56ed2
-TARGETS =	named@EXEEXT@ lwresd@EXEEXT@
d56ed2
+TARGETS =	named-pkcs11@EXEEXT@
d56ed2
 
d56ed2
 OBJS =		builtin.@O@ client.@O@ config.@O@ control.@O@ \
d56ed2
 		controlconf.@O@ interfacemgr.@O@ \
d56ed2
@@ -92,8 +92,7 @@ OBJS =		builtin.@O@ client.@O@ config.@O@ control.@O@ \
d56ed2
 		tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \
d56ed2
 		zoneconf.@O@ \
d56ed2
 		lwaddr.@O@ lwresd.@O@ lwdclient.@O@ lwderror.@O@ lwdgabn.@O@ \
d56ed2
-		lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@ \
d56ed2
-		${DLZDRIVER_OBJS} ${DBDRIVER_OBJS}
d56ed2
+		lwdgnba.@O@ lwdgrbn.@O@ lwdnoop.@O@ lwsearch.@O@
d56ed2
 
d56ed2
 UOBJS =		unix/os.@O@ unix/dlz_dlopen_driver.@O@
d56ed2
 
d56ed2
@@ -106,8 +105,7 @@ SRCS =		builtin.c client.c config.c control.c \
d56ed2
 		tkeyconf.c tsigconf.c update.c xfrout.c \
d56ed2
 		zoneconf.c \
d56ed2
 		lwaddr.c lwresd.c lwdclient.c lwderror.c lwdgabn.c \
d56ed2
-		lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c \
d56ed2
-		${DLZDRIVER_SRCS} ${DBDRIVER_SRCS}
d56ed2
+		lwdgnba.c lwdgrbn.c lwdnoop.c lwsearch.c
d56ed2
 
d56ed2
 MANPAGES =	named.8 lwresd.8 named.conf.5
d56ed2
 
d56ed2
@@ -142,7 +140,7 @@ config.@O@: config.c bind.keys.h
d56ed2
 		-DNS_SYSCONFDIR=\"${sysconfdir}\" \
d56ed2
 		-c ${srcdir}/config.c
d56ed2
 
d56ed2
-named@EXEEXT@: ${OBJS} ${UOBJS} ${DEPLIBS}
d56ed2
+named-pkcs11@EXEEXT@: ${OBJS} ${UOBJS} ${DEPLIBS}
d56ed2
 	export MAKE_SYMTABLE="yes"; \
d56ed2
 	export BASEOBJS="${OBJS} ${UOBJS}"; \
d56ed2
 	${FINALBUILDCMD}
d56ed2
@@ -173,15 +171,9 @@ statschannel.@O@: bind9.xsl.h bind9.ver3.xsl.h
d56ed2
 
d56ed2
 installdirs:
d56ed2
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${sbindir}
d56ed2
-	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man5
d56ed2
-	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${mandir}/man8
d56ed2
-
d56ed2
-install:: named@EXEEXT@ lwresd@EXEEXT@ installdirs
d56ed2
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named@EXEEXT@ ${DESTDIR}${sbindir}
d56ed2
-	(cd ${DESTDIR}${sbindir}; rm -f lwresd@EXEEXT@; @LN@ named@EXEEXT@ lwresd@EXEEXT@)
d56ed2
-	${INSTALL_DATA} ${srcdir}/named.8 ${DESTDIR}${mandir}/man8
d56ed2
-	${INSTALL_DATA} ${srcdir}/lwresd.8 ${DESTDIR}${mandir}/man8
d56ed2
-	${INSTALL_DATA} ${srcdir}/named.conf.5 ${DESTDIR}${mandir}/man5
d56ed2
+
d56ed2
+install:: named-pkcs11@EXEEXT@ installdirs
d56ed2
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} named-pkcs11@EXEEXT@ ${DESTDIR}${sbindir}
d56ed2
 
d56ed2
 @DLZ_DRIVER_RULES@
d56ed2
 
d56ed2
diff --git a/bin/named/Makefile.in b/bin/named/Makefile.in
d56ed2
index cd65777..a5d46b6 100644
d56ed2
--- a/bin/named/Makefile.in
d56ed2
+++ b/bin/named/Makefile.in
d56ed2
@@ -51,7 +51,7 @@ CINCLUDES =	-I${srcdir}/include -I${srcdir}/unix/include -I. \
d56ed2
 		${ISCCFG_INCLUDES} ${ISCCC_INCLUDES} ${ISC_INCLUDES} \
d56ed2
 		${DLZDRIVER_INCLUDES} ${DBDRIVER_INCLUDES} @DST_OPENSSL_INC@
d56ed2
 
d56ed2
-CDEFINES =      @CONTRIB_DLZ@ @USE_PKCS11@ @PKCS11_ENGINE@ @CRYPTO@
d56ed2
+CDEFINES =      @CONTRIB_DLZ@ @CRYPTO@
d56ed2
 
d56ed2
 CWARNINGS =
d56ed2
 
d56ed2
diff --git a/bin/pkcs11/Makefile.in b/bin/pkcs11/Makefile.in
d56ed2
index 15d3fb5..32cc753 100644
d56ed2
--- a/bin/pkcs11/Makefile.in
d56ed2
+++ b/bin/pkcs11/Makefile.in
d56ed2
@@ -20,13 +20,13 @@ top_srcdir =	@top_srcdir@
d56ed2
 
d56ed2
 @BIND9_MAKE_INCLUDES@
d56ed2
 
d56ed2
-CINCLUDES =	${ISC_INCLUDES}
d56ed2
+CINCLUDES =	${ISC_PKCS11_INCLUDES}
d56ed2
 
d56ed2
 CDEFINES =
d56ed2
 
d56ed2
-ISCLIBS =	../../lib/isc/libisc.@A@
d56ed2
+ISCLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
d56ed2
 
d56ed2
-ISCDEPLIBS =	../../lib/isc/libisc.@A@
d56ed2
+ISCDEPLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
d56ed2
 
d56ed2
 DEPLIBS =	${ISCDEPLIBS}
d56ed2
 
d56ed2
diff --git a/configure.in b/configure.in
d56ed2
index d4dc6fd..2fbcfcb 100644
d56ed2
--- a/configure.in
d56ed2
+++ b/configure.in
d56ed2
@@ -656,10 +656,10 @@ AC_ARG_WITH(pkcs11,
d56ed2
 openssldirs="/usr /usr/local /usr/local/ssl /usr/pkg /usr/sfw"
d56ed2
 if test "$use_openssl" = "auto"
d56ed2
 then
d56ed2
-    if test "$want_native_pkcs11" = "yes"
d56ed2
-    then
d56ed2
-        use_openssl="native_pkcs11"
d56ed2
-    else
d56ed2
+#    if test "$want_native_pkcs11" = "yes"
d56ed2
+#    then
d56ed2
+#        use_openssl="native_pkcs11"
d56ed2
+#    else
d56ed2
 	    for d in $openssldirs
d56ed2
     	do
d56ed2
 	    	if test -f $d/include/openssl/opensslv.h
d56ed2
@@ -668,7 +668,7 @@ then
d56ed2
     			break
d56ed2
 		    fi
d56ed2
     	done
d56ed2
-    fi
d56ed2
+#    fi
d56ed2
 fi
d56ed2
 OPENSSL_ECDSA=""
d56ed2
 OPENSSL_GOST=""
d56ed2
@@ -727,11 +727,11 @@ case "$use_openssl" in
d56ed2
 If you don't want OpenSSL, use --without-openssl])
d56ed2
 		;;
d56ed2
 	*)
d56ed2
-		if test "$want_native_pkcs11" = "yes"
d56ed2
-		then
d56ed2
-                        AC_MSG_RESULT()
d56ed2
-			AC_MSG_ERROR([OpenSSL and native PKCS11 cannot be used together.])
d56ed2
-		fi
d56ed2
+#		if test "$want_native_pkcs11" = "yes"
d56ed2
+#		then
d56ed2
+#                        AC_MSG_RESULT()
d56ed2
+#			AC_MSG_ERROR([OpenSSL and native PKCS11 cannot be used together.])
d56ed2
+#		fi
d56ed2
 		if test "$use_openssl" = "yes"
d56ed2
 		then
d56ed2
 			# User did not specify a path - guess it
d56ed2
@@ -1011,6 +1011,7 @@ AC_SUBST(OPENSSL_ECDSA)
d56ed2
 AC_SUBST(OPENSSL_GOST)
d56ed2
 
d56ed2
 DNS_CRYPTO_LIBS="$DNS_CRYPTO_LIBS $DNS_OPENSSL_LIBS"
d56ed2
+DNS_CRYPTO_PK11_LIBS="$DNS_CRYPTO_LIBS"
d56ed2
 
d56ed2
 #
d56ed2
 # Use OpenSSL for hash functions
d56ed2
@@ -1192,7 +1193,7 @@ case "$use_pkcs11" in
d56ed2
 esac
d56ed2
 AC_SUBST(PKCS11_PROVIDER)
d56ed2
 
d56ed2
-
d56ed2
+CRYPTO_PK11=""
d56ed2
 PKCS11_ECDSA=""
d56ed2
 PKCS11_GOST=""
d56ed2
 AC_MSG_CHECKING(for native PKCS11)
d56ed2
@@ -1200,7 +1201,7 @@ AC_MSG_CHECKING(for native PKCS11)
d56ed2
 case "$want_native_pkcs11" in
d56ed2
 	yes)
d56ed2
 		AC_MSG_RESULT(using native PKCS11 crypto)
d56ed2
-		CRYPTO="-DPKCS11CRYPTO"
d56ed2
+		CRYPTO_PK11="-DPKCS11CRYPTO"
d56ed2
 		PKCS11LINKOBJS='${PKCS11LINKOBJS}'
d56ed2
 		PKCS11LINKSRCS='${PKCS11LINKSRCS}'
d56ed2
                 PKCS11_TEST=pkcs11
d56ed2
@@ -1237,6 +1238,7 @@ esac
d56ed2
 AC_SUBST(PKCS11LINKOBJS)
d56ed2
 AC_SUBST(PKCS11LINKSRCS)
d56ed2
 AC_SUBST(CRYPTO)
d56ed2
+AC_SUBST(CRYPTO_PK11)
d56ed2
 AC_SUBST(PKCS11_ECDSA)
d56ed2
 AC_SUBST(PKCS11_GOST)
d56ed2
 AC_SUBST(PKCS11_TEST)
d56ed2
@@ -1435,12 +1437,13 @@ AC_SUBST(USE_GSSAPI)
d56ed2
 AC_SUBST(DST_GSSAPI_INC)
d56ed2
 AC_SUBST(DNS_GSSAPI_LIBS)
d56ed2
 DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_LIBS"
d56ed2
-
d56ed2
+DNS_CRYPTO_PK11_LIBS="$DNS_GSSAPI_LIBS $DNS_CRYPTO_PK11_LIBS"
d56ed2
 #
d56ed2
 # Applications linking with libdns also need to link with these libraries.
d56ed2
 #
d56ed2
 
d56ed2
 AC_SUBST(DNS_CRYPTO_LIBS)
d56ed2
+AC_SUBST(DNS_CRYPTO_PK11_LIBS)
d56ed2
 
d56ed2
 #
d56ed2
 # was --with-randomdev specified?
d56ed2
@@ -3918,7 +3921,10 @@ AC_CONFIG_FILES([
d56ed2
 	bin/confgen/unix/Makefile
d56ed2
 	bin/dig/Makefile
d56ed2
 	bin/dnssec/Makefile
d56ed2
+	bin/dnssec-pkcs11/Makefile
d56ed2
 	bin/named/Makefile
d56ed2
+	bin/named-pkcs11/Makefile
d56ed2
+	bin/named-pkcs11/unix/Makefile
d56ed2
 	bin/named/unix/Makefile
d56ed2
 	bin/nsupdate/Makefile
d56ed2
 	bin/pkcs11/Makefile
d56ed2
@@ -3998,11 +4004,19 @@ AC_CONFIG_FILES([
d56ed2
 	lib/dns/include/dns/Makefile
d56ed2
 	lib/dns/include/dst/Makefile
d56ed2
 	lib/dns/tests/Makefile
d56ed2
+	lib/dns-pkcs11/Makefile
d56ed2
+	lib/dns-pkcs11/include/Makefile
d56ed2
+	lib/dns-pkcs11/include/dns/Makefile
d56ed2
+	lib/dns-pkcs11/include/dst/Makefile
d56ed2
 	lib/export/Makefile
d56ed2
 	lib/export/dns/Makefile
d56ed2
 	lib/export/dns/include/Makefile
d56ed2
 	lib/export/dns/include/dns/Makefile
d56ed2
 	lib/export/dns/include/dst/Makefile
d56ed2
+	lib/export/dns-pkcs11/Makefile
d56ed2
+	lib/export/dns-pkcs11/include/Makefile
d56ed2
+	lib/export/dns-pkcs11/include/dns/Makefile
d56ed2
+	lib/export/dns-pkcs11/include/dst/Makefile
d56ed2
 	lib/export/irs/Makefile
d56ed2
 	lib/export/irs/include/Makefile
d56ed2
 	lib/export/irs/include/irs/Makefile
d56ed2
@@ -4016,6 +4030,16 @@ AC_CONFIG_FILES([
d56ed2
 	lib/export/isc/unix/Makefile
d56ed2
 	lib/export/isc/unix/include/Makefile
d56ed2
 	lib/export/isc/unix/include/isc/Makefile
d56ed2
+	lib/export/isc-pkcs11/$thread_dir/Makefile
d56ed2
+	lib/export/isc-pkcs11/$thread_dir/include/Makefile
d56ed2
+	lib/export/isc-pkcs11/$thread_dir/include/isc/Makefile
d56ed2
+	lib/export/isc-pkcs11/Makefile
d56ed2
+	lib/export/isc-pkcs11/include/Makefile
d56ed2
+	lib/export/isc-pkcs11/include/isc/Makefile
d56ed2
+	lib/export/isc-pkcs11/nls/Makefile
d56ed2
+	lib/export/isc-pkcs11/unix/Makefile
d56ed2
+	lib/export/isc-pkcs11/unix/include/Makefile
d56ed2
+	lib/export/isc-pkcs11/unix/include/isc/Makefile
d56ed2
 	lib/export/isccfg/Makefile
d56ed2
 	lib/export/isccfg/include/Makefile
d56ed2
 	lib/export/isccfg/include/isccfg/Makefile
d56ed2
@@ -4044,6 +4068,24 @@ AC_CONFIG_FILES([
d56ed2
 	lib/isc/unix/include/Makefile
d56ed2
 	lib/isc/unix/include/isc/Makefile
d56ed2
 	lib/isc/unix/include/pkcs11/Makefile
d56ed2
+	lib/isc-pkcs11/$arch/Makefile
d56ed2
+	lib/isc-pkcs11/$arch/include/Makefile
d56ed2
+	lib/isc-pkcs11/$arch/include/isc/Makefile
d56ed2
+	lib/isc-pkcs11/$thread_dir/Makefile
d56ed2
+	lib/isc-pkcs11/$thread_dir/include/Makefile
d56ed2
+	lib/isc-pkcs11/$thread_dir/include/isc/Makefile
d56ed2
+	lib/isc-pkcs11/Makefile
d56ed2
+	lib/isc-pkcs11/include/Makefile
d56ed2
+	lib/isc-pkcs11/include/isc/Makefile
d56ed2
+	lib/isc-pkcs11/include/isc/platform.h
d56ed2
+	lib/isc-pkcs11/include/pk11/Makefile
d56ed2
+	lib/isc-pkcs11/include/pkcs11/Makefile
d56ed2
+	lib/isc-pkcs11/tests/Makefile
d56ed2
+	lib/isc-pkcs11/nls/Makefile
d56ed2
+	lib/isc-pkcs11/unix/Makefile
d56ed2
+	lib/isc-pkcs11/unix/include/Makefile
d56ed2
+	lib/isc-pkcs11/unix/include/isc/Makefile
d56ed2
+	lib/isc-pkcs11/unix/include/pkcs11/Makefile
d56ed2
 	lib/isccc/Makefile
d56ed2
 	lib/isccc/include/Makefile
d56ed2
 	lib/isccc/include/isccc/Makefile
d56ed2
diff --git a/lib/Makefile.in b/lib/Makefile.in
d56ed2
index 8dc1d38..8e48d5e 100644
d56ed2
--- a/lib/Makefile.in
d56ed2
+++ b/lib/Makefile.in
d56ed2
@@ -23,7 +23,7 @@ top_srcdir =	@top_srcdir@
d56ed2
 # Attempt to disable parallel processing.
d56ed2
 .NOTPARALLEL:
d56ed2
 .NO_PARALLEL:
d56ed2
-SUBDIRS =	isc isccc dns isccfg bind9 lwres tests
d56ed2
+SUBDIRS =	isc isccc dns isccfg bind9 lwres tests isc-pkcs11 dns-pkcs11
d56ed2
 TARGETS =
d56ed2
 
d56ed2
 @BIND9_MAKE_RULES@
d56ed2
diff --git a/lib/dns-pkcs11/Makefile.in b/lib/dns-pkcs11/Makefile.in
d56ed2
index 41fac95..7d88424 100644
d56ed2
--- a/lib/dns-pkcs11/Makefile.in
d56ed2
+++ b/lib/dns-pkcs11/Makefile.in
d56ed2
@@ -27,16 +27,16 @@ top_srcdir =	@top_srcdir@
d56ed2
 
d56ed2
 USE_ISC_SPNEGO = @USE_ISC_SPNEGO@
d56ed2
 
d56ed2
-CINCLUDES =	-I. -I${top_srcdir}/lib/dns -Iinclude ${DNS_INCLUDES} ${ISC_INCLUDES} \
d56ed2
+CINCLUDES =	-I. -I${top_srcdir}/lib/dns-pkcs11 -Iinclude ${DNS_PKCS11_INCLUDES} ${ISC_PKCS11_INCLUDES} \
d56ed2
 		@DST_OPENSSL_INC@ @DST_GSSAPI_INC@
d56ed2
 
d56ed2
-CDEFINES =	-DUSE_MD5 @CRYPTO@ @USE_GSSAPI@ ${USE_ISC_SPNEGO}
d56ed2
+CDEFINES =	-DUSE_MD5 @CRYPTO_PK11@ @USE_GSSAPI@ ${USE_ISC_SPNEGO}
d56ed2
 
d56ed2
 CWARNINGS =
d56ed2
 
d56ed2
-ISCLIBS =	../../lib/isc/libisc.@A@
d56ed2
+ISCLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
d56ed2
 
d56ed2
-ISCDEPLIBS =	../../lib/isc/libisc.@A@
d56ed2
+ISCDEPLIBS =	../../lib/isc-pkcs11/libisc-pkcs11.@A@
d56ed2
 
d56ed2
 LIBS =		@LIBS@
d56ed2
 
d56ed2
@@ -132,27 +132,27 @@ dynamic_db.@O@: dynamic_db.c
d56ed2
 	-DDYNDB_LIBDIR=\"@libdir@/bind/\" \
d56ed2
 	-c ${srcdir}/dynamic_db.c
d56ed2
 
d56ed2
-libdns.@SA@: ${OBJS}
d56ed2
+libdns-pkcs11.@SA@: ${OBJS}
d56ed2
 	${AR} ${ARFLAGS} $@ ${OBJS}
d56ed2
 	${RANLIB} $@
d56ed2
 
d56ed2
-libdns.la: ${OBJS}
d56ed2
+libdns-pkcs11.la: ${OBJS}
d56ed2
 	${LIBTOOL_MODE_LINK} \
d56ed2
-		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns.la -rpath ${libdir} \
d56ed2
+		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns-pkcs11.la -rpath ${libdir} \
d56ed2
 		-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
d56ed2
-		${OBJS} ${ISCLIBS} @DNS_CRYPTO_LIBS@ ${LIBS}
d56ed2
+		${OBJS} ${ISCLIBS} @DNS_CRYPTO_PK11_LIBS@ ${LIBS}
d56ed2
 
d56ed2
-timestamp: libdns.@A@
d56ed2
+timestamp: libdns-pkcs11.@A@
d56ed2
 	touch timestamp
d56ed2
 
d56ed2
 installdirs:
d56ed2
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
d56ed2
 
d56ed2
 install:: timestamp installdirs
d56ed2
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} libdns.@A@ ${DESTDIR}${libdir}
d56ed2
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} libdns-pkcs11.@A@ ${DESTDIR}${libdir}
d56ed2
 
d56ed2
 clean distclean::
d56ed2
-	rm -f libdns.@A@ timestamp
d56ed2
+	rm -f libdns-pkcs11.@A@ timestamp
d56ed2
 	rm -f gen code.h include/dns/enumtype.h include/dns/enumclass.h
d56ed2
 	rm -f include/dns/rdatastruct.h
d56ed2
 
d56ed2
@@ -182,7 +182,7 @@ code.h:	gen
d56ed2
 	./gen -s ${srcdir} > code.h
d56ed2
 
d56ed2
 gen: gen.c
d56ed2
-	${BUILD_CC} ${BUILD_CFLAGS} -I${top_srcdir}/lib/isc/include \
d56ed2
+	${BUILD_CC} ${BUILD_CFLAGS} -I${top_srcdir}/lib/isc-pkcs11/include \
d56ed2
 	${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} -o $@ ${srcdir}/gen.c ${BUILD_LIBS}
d56ed2
 
d56ed2
 rbtdb64.@O@: rbtdb.c
d56ed2
diff --git a/lib/export/Makefile.in b/lib/export/Makefile.in
d56ed2
index 1fd7216..a8a1342 100644
d56ed2
--- a/lib/export/Makefile.in
d56ed2
+++ b/lib/export/Makefile.in
d56ed2
@@ -21,7 +21,7 @@ top_srcdir =	@top_srcdir@
d56ed2
 # Attempt to disable parallel processing.
d56ed2
 .NOTPARALLEL:
d56ed2
 .NO_PARALLEL:
d56ed2
-SUBDIRS =	isc dns isccfg irs samples
d56ed2
+SUBDIRS =	isc dns isccfg irs samples isc-pkcs11 dns-pkcs11
d56ed2
 TARGETS =
d56ed2
 
d56ed2
 @BIND9_MAKE_RULES@
d56ed2
diff --git a/lib/export/dns-pkcs11/Makefile.in b/lib/export/dns-pkcs11/Makefile.in
d56ed2
index e10bf59..669509f 100644
d56ed2
--- a/lib/export/dns-pkcs11/Makefile.in
d56ed2
+++ b/lib/export/dns-pkcs11/Makefile.in
d56ed2
@@ -15,7 +15,7 @@
d56ed2
 # $Id$
d56ed2
 
d56ed2
 top_srcdir =	@top_srcdir@
d56ed2
-srcdir =	@top_srcdir@/lib/dns
d56ed2
+srcdir =	@top_srcdir@/lib/dns-pkcs11
d56ed2
 export_srcdir =	@top_srcdir@/lib/export
d56ed2
 
d56ed2
 # Attempt to disable parallel processing.
d56ed2
@@ -28,16 +28,16 @@ export_srcdir =	@top_srcdir@/lib/export
d56ed2
 
d56ed2
 @BIND9_MAKE_INCLUDES@
d56ed2
 
d56ed2
-CINCLUDES =	-I. -I${top_srcdir}/lib/dns -Iinclude ${DNS_INCLUDES} -I${export_srcdir}/isc/include \
d56ed2
-		${ISC_INCLUDES} @DST_OPENSSL_INC@ @DST_GSSAPI_INC@
d56ed2
+CINCLUDES =	-I. -I${top_srcdir}/lib/dns-pkcs11 -Iinclude ${DNS_PKCS11_INCLUDES} -I${export_srcdir}/isc-pkcs11/include \
d56ed2
+		${ISC_PKCS11_INCLUDES} @DST_OPENSSL_INC@ @DST_GSSAPI_INC@
d56ed2
 
d56ed2
-CDEFINES =	-DUSE_MD5 @CRYPTO@ @USE_GSSAPI@
d56ed2
+CDEFINES =	-DUSE_MD5 @CRYPTO_PK11@ @USE_GSSAPI@
d56ed2
 
d56ed2
 CWARNINGS =
d56ed2
 
d56ed2
-ISCLIBS =	../isc/libisc-export.@A@
d56ed2
+ISCLIBS =	../isc-pkcs11/libisc-pkcs11-export.@A@
d56ed2
 
d56ed2
-ISCDEPLIBS =	../isc/libisc-export.@A@
d56ed2
+ISCDEPLIBS =	../isc-pkcs11/libisc-pkcs11-export.@A@
d56ed2
 
d56ed2
 LIBS =		@LIBS@
d56ed2
 
d56ed2
@@ -116,29 +116,29 @@ version.@O@: ${srcdir}/version.c
d56ed2
 		-DLIBAGE=${LIBAGE} \
d56ed2
 		-c ${srcdir}/version.c
d56ed2
 
d56ed2
-libdns-export.@SA@: ${OBJS}
d56ed2
+libdns-pkcs11-export.@SA@: ${OBJS}
d56ed2
 	${AR} ${ARFLAGS} $@ ${OBJS}
d56ed2
 	${RANLIB} $@
d56ed2
 
d56ed2
-libdns-export.la: ${OBJS}
d56ed2
+libdns-pkcs11-export.la: ${OBJS}
d56ed2
 	${LIBTOOL_MODE_LINK} \
d56ed2
-		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns-export.la \
d56ed2
+		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns-pkcs11-export.la \
d56ed2
 		-rpath ${export_libdir} \
d56ed2
 		-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
d56ed2
-		${OBJS} ${ISCLIBS} @DNS_CRYPTO_LIBS@ ${LIBS}
d56ed2
+		${OBJS} ${ISCLIBS} @DNS_CRYPTO_PK11_LIBS@ ${LIBS}
d56ed2
 
d56ed2
-timestamp: libdns-export.@A@
d56ed2
+timestamp: libdns-pkcs11-export.@A@
d56ed2
 	touch timestamp
d56ed2
 
d56ed2
 installdirs:
d56ed2
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_libdir}
d56ed2
 
d56ed2
 install:: timestamp installdirs
d56ed2
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} libdns-export.@A@ \
d56ed2
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} libdns-pkcs11-export.@A@ \
d56ed2
 	${DESTDIR}${export_libdir}/
d56ed2
 
d56ed2
 clean distclean::
d56ed2
-	rm -f libdns-export.@A@ timestamp
d56ed2
+	rm -f libdns-pkcs11-export.@A@ timestamp
d56ed2
 	rm -f gen code.h include/dns/enumtype.h include/dns/enumclass.h
d56ed2
 	rm -f include/dns/rdatastruct.h
d56ed2
 
d56ed2
diff --git a/lib/export/isc-pkcs11/Makefile.in b/lib/export/isc-pkcs11/Makefile.in
d56ed2
index e12dffb..926e000 100644
d56ed2
--- a/lib/export/isc-pkcs11/Makefile.in
d56ed2
+++ b/lib/export/isc-pkcs11/Makefile.in
d56ed2
@@ -15,7 +15,7 @@
d56ed2
 # $Id: Makefile.in,v 1.8 2010/06/09 23:50:58 tbox Exp $
d56ed2
 
d56ed2
 top_srcdir =	@top_srcdir@
d56ed2
-srcdir =	@top_srcdir@/lib/isc
d56ed2
+srcdir =	@top_srcdir@/lib/isc-pkcs11
d56ed2
 export_srcdir =	@top_srcdir@/lib/export
d56ed2
 
d56ed2
 @BIND9_VERSION@
d56ed2
@@ -25,9 +25,9 @@ export_srcdir =	@top_srcdir@/lib/export
d56ed2
 CINCLUDES =	-I${srcdir}/unix/include \
d56ed2
 		-I${srcdir}/@ISC_THREAD_DIR@/include \
d56ed2
 		-I${srcdir}/@ISC_ARCH_DIR@/include \
d56ed2
-		-I${export_srcdir}/isc/include -I${srcdir}/include \
d56ed2
+		-I${export_srcdir}/isc-pkcs11/include -I${srcdir}/include \
d56ed2
 		@ISC_OPENSSL_INC@
d56ed2
-CDEFINES =	@CRYPTO@ -DUSE_APPIMPREGISTER -DUSE_MEMIMPREGISTER \
d56ed2
+CDEFINES =	@CRYPTO_PK11@ -DUSE_APPIMPREGISTER -DUSE_MEMIMPREGISTER \
d56ed2
 		-DUSE_SOCKETIMPREGISTER -DUSE_TASKIMPREGISTER \
d56ed2
 		-DUSE_TIMERIMPREGISTER
d56ed2
 CWARNINGS =
d56ed2
@@ -119,26 +119,26 @@ version.@O@: ${srcdir}/version.c
d56ed2
 		-DLIBAGE=${LIBAGE} \
d56ed2
 		-c ${srcdir}/version.c
d56ed2
 
d56ed2
-libisc-export.@SA@: ${OBJS}
d56ed2
+libisc-pkcs11-export.@SA@: ${OBJS}
d56ed2
 	${AR} ${ARFLAGS} $@ ${OBJS}
d56ed2
 	${RANLIB} $@
d56ed2
 
d56ed2
-libisc-export.la: ${OBJS}
d56ed2
+libisc-pkcs11-export.la: ${OBJS}
d56ed2
 	${LIBTOOL_MODE_LINK} \
d56ed2
-		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc-export.la \
d56ed2
+		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc-pkcs11-export.la \
d56ed2
 		-rpath ${export_libdir} \
d56ed2
 		-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
d56ed2
 		${OBJS} ${LIBS}
d56ed2
 
d56ed2
-timestamp: libisc-export.@A@
d56ed2
+timestamp: libisc-pkcs11-export.@A@
d56ed2
 	touch timestamp
d56ed2
 
d56ed2
 installdirs:
d56ed2
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_libdir}
d56ed2
 
d56ed2
 install:: timestamp installdirs
d56ed2
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} libisc-export.@A@ \
d56ed2
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} libisc-pkcs11-export.@A@ \
d56ed2
 	${DESTDIR}${export_libdir}
d56ed2
 
d56ed2
 clean distclean::
d56ed2
-	rm -f libisc-export.@A@ libisc-export.la timestamp
d56ed2
+	rm -f libisc-pkcs11-export.@A@ libisc-pkcs11-export.la timestamp
d56ed2
diff --git a/lib/isc-pkcs11/Makefile.in b/lib/isc-pkcs11/Makefile.in
d56ed2
index 801ab35..d326786 100644
d56ed2
--- a/lib/isc-pkcs11/Makefile.in
d56ed2
+++ b/lib/isc-pkcs11/Makefile.in
d56ed2
@@ -31,8 +31,8 @@ CINCLUDES =	-I${srcdir}/unix/include \
d56ed2
 		-I${srcdir}/@ISC_THREAD_DIR@/include \
d56ed2
 		-I${srcdir}/@ISC_ARCH_DIR@/include \
d56ed2
 		-I./include \
d56ed2
-		-I${srcdir}/include @ISC_OPENSSL_INC@ ${DNS_INCLUDES}
d56ed2
-CDEFINES =	@CRYPTO@ -DPK11_LIB_LOCATION=\"${PROVIDER}\"
d56ed2
+		-I${srcdir}/include ${DNS_PKCS11_INCLUDES}
d56ed2
+CDEFINES =	@CRYPTO_PK11@ -DPK11_LIB_LOCATION=\"${PROVIDER}\"
d56ed2
 CWARNINGS =
d56ed2
 
d56ed2
 # Alphabetically
d56ed2
@@ -110,35 +110,35 @@ version.@O@: version.c
d56ed2
 		-DLIBAGE=${LIBAGE} \
d56ed2
 		-c ${srcdir}/version.c
d56ed2
 
d56ed2
-libisc.@SA@: ${OBJS} ${SYMTBLOBJS}
d56ed2
+libisc-pkcs11.@SA@: ${OBJS} ${SYMTBLOBJS}
d56ed2
 	${AR} ${ARFLAGS} $@ ${OBJS} ${SYMTBLOBJS}
d56ed2
 	${RANLIB} $@
d56ed2
 
d56ed2
-libisc-nosymtbl.@SA@: ${OBJS}
d56ed2
+libisc-pkcs11-nosymtbl.@SA@: ${OBJS}
d56ed2
 	${AR} ${ARFLAGS} $@ ${OBJS}
d56ed2
 	${RANLIB} $@
d56ed2
 
d56ed2
-libisc.la: ${OBJS} ${SYMTBLOBJS}
d56ed2
+libisc-pkcs11.la: ${OBJS} ${SYMTBLOBJS}
d56ed2
 	${LIBTOOL_MODE_LINK} \
d56ed2
-		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc.la -rpath ${libdir} \
d56ed2
+		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc-pkcs11.la -rpath ${libdir} \
d56ed2
 		-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
d56ed2
 		${OBJS} ${SYMTBLOBJS} ${LIBS}
d56ed2
 
d56ed2
-libisc-nosymtbl.la: ${OBJS}
d56ed2
+libisc-pkcs11-nosymtbl.la: ${OBJS}
d56ed2
 	${LIBTOOL_MODE_LINK} \
d56ed2
-		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc-nosymtbl.la -rpath ${libdir} \
d56ed2
+		${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc-pkcs11-nosymtbl.la -rpath ${libdir} \
d56ed2
 		-version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \
d56ed2
 		${OBJS} ${LIBS}
d56ed2
 
d56ed2
-timestamp: libisc.@A@ libisc-nosymtbl.@A@
d56ed2
+timestamp: libisc-pkcs11.@A@ libisc-pkcs11-nosymtbl.@A@
d56ed2
 	touch timestamp
d56ed2
 
d56ed2
 installdirs:
d56ed2
 	$(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${libdir}
d56ed2
 
d56ed2
 install:: timestamp installdirs
d56ed2
-	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} libisc.@A@ ${DESTDIR}${libdir}
d56ed2
+	${LIBTOOL_MODE_INSTALL} ${INSTALL_PROGRAM} libisc-pkcs11.@A@ ${DESTDIR}${libdir}
d56ed2
 
d56ed2
 clean distclean::
d56ed2
-	rm -f libisc.@A@ libisc-nosymtbl.@A@ libisc.la \
d56ed2
-	libisc-nosymtbl.la timestamp
d56ed2
+	rm -f libisc-pkcs11.@A@ libisc-pkcs11-nosymtbl.@A@ libisc-pkcs11.la \
d56ed2
+	libisc-pkcs11-nosymtbl.la timestamp
d56ed2
diff --git a/make/includes.in b/make/includes.in
d56ed2
index f2f1b3f..639477c 100644
d56ed2
--- a/make/includes.in
d56ed2
+++ b/make/includes.in
d56ed2
@@ -46,3 +46,13 @@ BIND9_INCLUDES = @BIND9_BIND9_BUILDINCLUDE@ \
d56ed2
 
d56ed2
 TEST_INCLUDES = \
d56ed2
 	-I${top_srcdir}/lib/tests/include
d56ed2
+
d56ed2
+ISC_PKCS11_INCLUDES = @BIND9_ISC_BUILDINCLUDE@ \
d56ed2
+	-I${top_srcdir}/lib/isc-pkcs11 \
d56ed2
+	-I${top_srcdir}/lib/isc-pkcs11/include \
d56ed2
+	-I${top_srcdir}/lib/isc-pkcs11/unix/include \
d56ed2
+	-I${top_srcdir}/lib/isc-pkcs11/@ISC_THREAD_DIR@/include \
d56ed2
+	-I${top_srcdir}/lib/isc-pkcs11/@ISC_ARCH_DIR@/include
d56ed2
+
d56ed2
+DNS_PKCS11_INCLUDES = @BIND9_DNS_BUILDINCLUDE@ \
d56ed2
+	-I${top_srcdir}/lib/dns-pkcs11/include
d56ed2
-- 
d56ed2
1.9.3
d56ed2