2e4a03
From 48df32cadb5071f5b186b00da3f4406a13320b44 Mon Sep 17 00:00:00 2001
2e4a03
From: Petr Mensik <pemensik@redhat.com>
2e4a03
Date: Fri, 26 Mar 2021 11:01:59 +0100
2e4a03
Subject: [PATCH] Do not require config.h to use isc/util.h
2e4a03
2e4a03
util.h requires ISC_CONSTRUCTOR definition, which depends on config.h
2e4a03
inclusion. It does not include it from isc/util.h (or any other header).
2e4a03
Using isc/util.h fails hard when isc/util.h is used without including
2e4a03
bind's config.h.
2e4a03
2e4a03
Move the check to c file, where ISC_CONSTRUCTOR is used. Ensure config.h
2e4a03
is included there.
2e4a03
---
2e4a03
 lib/isc/include/isc/util.h | 2 --
2e4a03
 lib/isc/lib.c              | 5 +++++
2e4a03
 2 files changed, 5 insertions(+), 2 deletions(-)
2e4a03
2e4a03
diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h
2e4a03
index 3c8c40b..3144557 100644
2e4a03
--- a/lib/isc/include/isc/util.h
2e4a03
+++ b/lib/isc/include/isc/util.h
2e4a03
@@ -54,8 +54,6 @@
2e4a03
 #elif WIN32
2e4a03
 #define ISC_CONSTRUCTOR(priority)
2e4a03
 #define ISC_DESTRUCTOR(priority)
2e4a03
-#else
2e4a03
-#error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9.
2e4a03
 #endif
2e4a03
 
2e4a03
 /*%
2e4a03
diff --git a/lib/isc/lib.c b/lib/isc/lib.c
2e4a03
index 27d7be1..08a1b91 100644
2e4a03
--- a/lib/isc/lib.c
2e4a03
+++ b/lib/isc/lib.c
2e4a03
@@ -17,10 +17,15 @@
2e4a03
 #include <isc/tls.h>
2e4a03
 #include <isc/util.h>
2e4a03
 
2e4a03
+#include "config.h"
2e4a03
 #include "mem_p.h"
2e4a03
 #include "tls_p.h"
2e4a03
 #include "trampoline_p.h"
2e4a03
 
2e4a03
+#ifndef ISC_CONSTRUCTOR
2e4a03
+#error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9.
2e4a03
+#endif
2e4a03
+
2e4a03
 /***
2e4a03
  *** Functions
2e4a03
  ***/
2e4a03
-- 
2e4a03
2.26.2
2e4a03