6a048c
From 0427e970f0294cadf4dff04021f41e751c713e3c Mon Sep 17 00:00:00 2001
6a048c
From: Petr Mensik <pemensik@redhat.com>
6a048c
Date: Fri, 18 Oct 2019 21:30:52 +0200
6a048c
Subject: [PATCH] Move USE_PKCS11 and USE_OPENSSL out of config.h
6a048c
6a048c
Building two variants with the same common code requires to unset
6a048c
USE_PKCS11 on part of build. That is not possible with config.h value.
6a048c
Move it as normal define to CDEFINES.
6a048c
---
6a048c
 bin/confgen/Makefile.in | 2 +-
6a048c
 bin/dig/Makefile.in     | 2 +-
6a048c
 bin/dnssec/Makefile.in  | 2 +-
6a048c
 bin/named/Makefile.in   | 2 +-
6a048c
 configure.ac            | 8 ++++++--
6a048c
 lib/dns/Makefile.in     | 2 +-
6a048c
 lib/ns/Makefile.in      | 2 +-
6a048c
 7 files changed, 12 insertions(+), 8 deletions(-)
6a048c
6a048c
diff --git a/bin/confgen/Makefile.in b/bin/confgen/Makefile.in
6a048c
index dc3a7f6..1e0fe0e 100644
6a048c
--- a/bin/confgen/Makefile.in
6a048c
+++ b/bin/confgen/Makefile.in
6a048c
@@ -22,7 +22,7 @@ VERSION=@BIND9_VERSION@
6a048c
 CINCLUDES = -I${srcdir}/include ${ISC_INCLUDES} ${ISCCC_INCLUDES} \
6a048c
 	${ISCCFG_INCLUDES} ${DNS_INCLUDES} ${BIND9_INCLUDES}
6a048c
 
6a048c
-CDEFINES =
6a048c
+CDEFINES = @USE_PKCS11@
6a048c
 CWARNINGS =
6a048c
 
6a048c
 ISCCFGLIBS =	../../lib/isccfg/libisccfg.@A@
6a048c
diff --git a/bin/dig/Makefile.in b/bin/dig/Makefile.in
6a048c
index 0601939..2317ec0 100644
6a048c
--- a/bin/dig/Makefile.in
6a048c
+++ b/bin/dig/Makefile.in
6a048c
@@ -21,7 +21,7 @@ CINCLUDES =	-I${srcdir}/include ${DNS_INCLUDES} \
6a048c
 		${BIND9_INCLUDES} ${ISC_INCLUDES} \
6a048c
 		${IRS_INCLUDES} ${ISCCFG_INCLUDES} @LIBIDN2_CFLAGS@ @OPENSSL_INCLUDES@
6a048c
 
6a048c
-CDEFINES =	-DVERSION=\"${VERSION}\"
6a048c
+CDEFINES =	-DVERSION=\"${VERSION}\" @USE_PKCS11@
6a048c
 CWARNINGS =
6a048c
 
6a048c
 ISCCFGLIBS =	../../lib/isccfg/libisccfg.@A@
6a048c
diff --git a/bin/dnssec/Makefile.in b/bin/dnssec/Makefile.in
6a048c
index 321058b..1dad340 100644
6a048c
--- a/bin/dnssec/Makefile.in
6a048c
+++ b/bin/dnssec/Makefile.in
6a048c
@@ -17,7 +17,7 @@ VERSION=@BIND9_VERSION@
6a048c
 
6a048c
 CINCLUDES =	${DNS_INCLUDES} ${ISC_INCLUDES} @OPENSSL_INCLUDES@
6a048c
 
6a048c
-CDEFINES =	-DVERSION=\"${VERSION}\"
6a048c
+CDEFINES =	-DVERSION=\"${VERSION}\" @USE_PKCS11@
6a048c
 CWARNINGS =
6a048c
 
6a048c
 DNSLIBS =	../../lib/dns/libdns.@A@ ${MAXMINDDB_LIBS} @DNS_CRYPTO_LIBS@
6a048c
diff --git a/bin/named/Makefile.in b/bin/named/Makefile.in
6a048c
index eecfa76..e5b0d4b 100644
6a048c
--- a/bin/named/Makefile.in
6a048c
+++ b/bin/named/Makefile.in
6a048c
@@ -49,7 +49,7 @@ CINCLUDES =	-I${srcdir}/include -I${srcdir}/unix/include -I. \
6a048c
 		${DBDRIVER_INCLUDES} ${MAXMINDDB_CFLAGS} \
6a048c
 		@OPENSSL_INCLUDES@
6a048c
 
6a048c
-CDEFINES =      @CONTRIB_DLZ@
6a048c
+CDEFINES =      @CONTRIB_DLZ@ @USE_PKCS11@
6a048c
 
6a048c
 CWARNINGS =
6a048c
 
6a048c
diff --git a/configure.ac b/configure.ac
6a048c
index da6de97..6d4cdcc 100644
6a048c
--- a/configure.ac
6a048c
+++ b/configure.ac
6a048c
@@ -963,9 +963,13 @@ AS_CASE([$enable_native_pkcs11],
6a048c
 AC_SUBST([PKCS11_TEST])
6a048c
 AC_SUBST([PKCS11_TOOLS])
6a048c
 
6a048c
+USE_PKCS11=
6a048c
+USE_OPENSSL=
6a048c
 AS_CASE([$CRYPTO],
6a048c
-	[pkcs11],[AC_DEFINE([USE_PKCS11], [1], [define if PKCS11 is used for Public-Key Cryptography])],
6a048c
-	[AC_DEFINE([USE_OPENSSL], [1], [define if OpenSSL is used for Public-Key Cryptography])])
6a048c
+	[pkcs11],[USE_PKCS11='-DUSE_PKCS11'],
6a048c
+	[USE_OPENSSL='-DUSE_OPENSSL'])
6a048c
+AC_SUBST(USE_PKCS11)
6a048c
+AC_SUBST(USE_OPENSSL)
6a048c
 
6a048c
 # preparation for automake
6a048c
 # AM_CONDITIONAL([PKCS11_TOOLS], [test "$with_native_pkcs11" = "yes"])
6a048c
diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in
6a048c
index 60c87a8..9125b10 100644
6a048c
--- a/lib/dns/Makefile.in
6a048c
+++ b/lib/dns/Makefile.in
6a048c
@@ -30,7 +30,7 @@ CINCLUDES =	-I. -I${top_srcdir}/lib/dns -Iinclude ${DNS_INCLUDES} \
6a048c
 		${ISC_INCLUDES} ${MAXMINDDB_CFLAGS} \
6a048c
 		@OPENSSL_INCLUDES@ @DST_GSSAPI_INC@
6a048c
 
6a048c
-CDEFINES =	@USE_GSSAPI@ ${USE_ISC_SPNEGO}
6a048c
+CDEFINES =	@USE_GSSAPI@ ${USE_ISC_SPNEGO} @USE_OPENSSL@ @USE_PKCS11@
6a048c
 
6a048c
 CWARNINGS =
6a048c
 
6a048c
diff --git a/lib/ns/Makefile.in b/lib/ns/Makefile.in
6a048c
index a14728d..58d731a 100644
6a048c
--- a/lib/ns/Makefile.in
6a048c
+++ b/lib/ns/Makefile.in
6a048c
@@ -24,7 +24,7 @@ CINCLUDES =	-I. -I${top_srcdir}/lib/ns -Iinclude \
6a048c
 		${NS_INCLUDES} ${DNS_INCLUDES} ${ISC_INCLUDES} \
6a048c
 		@OPENSSL_INCLUDES@ @DST_GSSAPI_INC@
6a048c
 
6a048c
-CDEFINES =	-DNAMED_PLUGINDIR=\"${plugindir}\"
6a048c
+CDEFINES =	@USE_PKCS11@ -DNAMED_PLUGINDIR=\"${plugindir}\"
6a048c
 
6a048c
 CWARNINGS =
6a048c
 
6a048c
-- 
6a048c
2.20.1
6a048c