1
0
forked from rpms/bind
bind/bind-9.16-isc-constructor.h
Petr Menšík 348d01cc21 Allow use of isc/util.h without "config.h"
It prevents compilation of bind-dyndb-ldap. Because config.h is never
used by bind-dyndb-ldap, stop exporting it in devel package. It should
be only implementation detail.

(cherry picked from commit 2e4a03677c85aae0659ec29432362548ce722747)

Resolves: rhbz#1956777
2021-05-04 14:09:44 +02:00

54 lines
1.5 KiB
C

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