Blob Blame History Raw
From 48df32cadb5071f5b186b00da3f4406a13320b44 Mon Sep 17 00:00:00 2001
From: Petr Mensik <pemensik@redhat.com>
Date: Fri, 26 Mar 2021 11:01:59 +0100
Subject: [PATCH] Do not require config.h to use isc/util.h

util.h requires ISC_CONSTRUCTOR definition, which depends on config.h
inclusion. It does not include it from isc/util.h (or any other header).
Using isc/util.h fails hard when isc/util.h is used without including
bind's config.h.

Move the check to c file, where ISC_CONSTRUCTOR is used. Ensure config.h
is included there.
---
 lib/isc/include/isc/util.h | 2 --
 lib/isc/lib.c              | 5 +++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/isc/include/isc/util.h b/lib/isc/include/isc/util.h
index 3c8c40b..3144557 100644
--- a/lib/isc/include/isc/util.h
+++ b/lib/isc/include/isc/util.h
@@ -54,8 +54,6 @@
 #elif WIN32
 #define ISC_CONSTRUCTOR(priority)
 #define ISC_DESTRUCTOR(priority)
-#else
-#error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9.
 #endif
 
 /*%
diff --git a/lib/isc/lib.c b/lib/isc/lib.c
index 27d7be1..08a1b91 100644
--- a/lib/isc/lib.c
+++ b/lib/isc/lib.c
@@ -17,10 +17,15 @@
 #include <isc/tls.h>
 #include <isc/util.h>
 
+#include "config.h"
 #include "mem_p.h"
 #include "tls_p.h"
 #include "trampoline_p.h"
 
+#ifndef ISC_CONSTRUCTOR
+#error Either __attribute__((constructor|destructor))__ or DllMain support needed to compile BIND 9.
+#endif
+
 /***
  *** Functions
  ***/
-- 
2.26.2