kumquat-buildroot/package/c-ares/0001-Provide-ares_nameser-h-as-a-public-interface.patch

171 lines
5.4 KiB
Diff
Raw Normal View History

From 7712fcd17847998cf1ee3071284ec50c5b3c1978 Mon Sep 17 00:00:00 2001
From: Felix Yan <felixonmars@archlinux.org>
Date: Wed, 18 Aug 2021 01:32:44 +0800
Subject: [PATCH] Provide ares_nameser.h as a public interface (#417)
NodeJS needs ares_nameser.h as a pubic header.
Fixes: #415
Fix By: Felix Yan (@felixonmars)
[Retrieved from:
https://github.com/c-ares/c-ares/commit/7712fcd17847998cf1ee3071284ec50c5b3c1978]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
CMakeLists.txt | 6 ++++++
configure.ac | 14 ++++++++++++++
include/CMakeLists.txt | 2 +-
include/Makefile.am | 2 +-
include/ares_build.h.cmake | 2 ++
include/ares_build.h.in | 3 +++
{src/lib => include}/ares_nameser.h | 10 ++++++----
src/lib/Makefile.inc | 1 -
8 files changed, 33 insertions(+), 7 deletions(-)
rename {src/lib => include}/ares_nameser.h (98%)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3f42d145..28f8e01a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -557,6 +557,12 @@ ENDIF()
IF (HAVE_WINDOWS_H)
SET (CARES_HAVE_WINDOWS_H 1)
ENDIF()
+IF (HAVE_ARPA_NAMESER_H)
+ SET (CARES_HAVE_ARPA_NAMESER_H 1)
+ENDIF()
+IF (HAVE_ARPA_NAMESER_COMPAT_H)
+ SET (CARES_HAVE_ARPA_NAMESER_COMPAT_H 1)
+ENDIF()
# Record toplevel CMakeLists.txt path
set(CARES_TOPLEVEL_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
diff --git a/configure.ac b/configure.ac
index c21b8ff3..1ba8a8ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -547,6 +547,20 @@ dnl *Sigh* these are needed in order for net/if.h to get properly detected.
]
)
+dnl Test and set CARES_HAVE_ARPA_NAMESER_H / CARES_HAVE_ARPA_NAMESER_COMPAT_H
+AC_CHECK_DECL([HAVE_ARPA_NAMESER_H],
+[
+CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_H])
+],
+[]
+)
+AC_CHECK_DECL([HAVE_ARPA_NAMESER_COMPAT_H],
+[
+CARES_DEFINE_UNQUOTED([CARES_HAVE_ARPA_NAMESER_COMPAT_H])
+],
+[]
+)
+
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 439e7bb2..3321956d 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -3,6 +3,6 @@ CONFIGURE_FILE (ares_build.h.cmake ${PROJECT_BINARY_DIR}/ares_build.h)
# Headers installation target
IF (CARES_INSTALL)
- SET (CARES_HEADERS ares.h ares_version.h "${PROJECT_BINARY_DIR}/ares_build.h" ares_rules.h ares_dns.h)
+ SET (CARES_HEADERS ares.h ares_version.h "${PROJECT_BINARY_DIR}/ares_build.h" ares_rules.h ares_dns.h ares_nameser.h)
INSTALL (FILES ${CARES_HEADERS} COMPONENT Devel DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
ENDIF ()
diff --git a/include/Makefile.am b/include/Makefile.am
index 125a686a..d208bece 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -2,6 +2,6 @@ AUTOMAKE_OPTIONS = foreign nostdinc 1.9.6
ACLOCAL_AMFLAGS = -I m4 --install
# what headers to install on 'make install':
-include_HEADERS = ares.h ares_version.h ares_build.h ares_rules.h ares_dns.h
+include_HEADERS = ares.h ares_version.h ares_build.h ares_rules.h ares_dns.h ares_nameser.h
EXTRA_DIST = ares_build.h.cmake ares_build.h.in ares_build.h.dist CMakeLists.txt
diff --git a/include/ares_build.h.cmake b/include/ares_build.h.cmake
index ac32d47f..e847f17e 100644
--- a/include/ares_build.h.cmake
+++ b/include/ares_build.h.cmake
@@ -13,6 +13,8 @@
#cmakedefine CARES_HAVE_WS2TCPIP_H
#cmakedefine CARES_HAVE_WINSOCK2_H
#cmakedefine CARES_HAVE_WINDOWS_H
+#cmakedefine CARES_HAVE_ARPA_NAMESER_H
+#cmakedefine CARES_HAVE_ARPA_NAMESER_COMPAT_H
#ifdef CARES_HAVE_SYS_TYPES_H
# include <sys/types.h>
diff --git a/include/ares_build.h.in b/include/ares_build.h.in
index 24e3a989..20fd28a0 100644
--- a/include/ares_build.h.in
+++ b/include/ares_build.h.in
@@ -55,6 +55,9 @@
Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_already_defined
#endif
+#undef CARES_HAVE_ARPA_NAMESER_H
+#undef CARES_HAVE_ARPA_NAMESER_COMPAT_H
+
/* ================================================================ */
/* EXTERNAL INTERFACE SETTINGS FOR CONFIGURE CAPABLE SYSTEMS ONLY */
/* ================================================================ */
diff --git a/src/lib/ares_nameser.h b/include/ares_nameser.h
similarity index 98%
rename from src/lib/ares_nameser.h
rename to include/ares_nameser.h
index 65aebcc1..18a9e5ac 100644
--- a/src/lib/ares_nameser.h
+++ b/include/ares_nameser.h
@@ -2,10 +2,12 @@
#ifndef ARES_NAMESER_H
#define ARES_NAMESER_H
-#ifdef HAVE_ARPA_NAMESER_H
+#include "ares_build.h"
+
+#ifdef CARES_HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h>
#endif
-#ifdef HAVE_ARPA_NAMESER_COMPAT_H
+#ifdef CARES_HAVE_ARPA_NAMESER_COMPAT_H
# include <arpa/nameser_compat.h>
#endif
@@ -68,7 +70,7 @@
* provide them
* ============================================================================
*/
-#ifndef HAVE_ARPA_NAMESER_H
+#ifndef CARES_HAVE_ARPA_NAMESER_H
typedef enum __ns_class {
ns_c_invalid = 0, /* Cookie. */
@@ -173,7 +175,7 @@ typedef enum __ns_rcode {
ns_r_badtime = 18
} ns_rcode;
-#endif /* HAVE_ARPA_NAMESER_H */
+#endif /* CARES_HAVE_ARPA_NAMESER_H */
/* ============================================================================
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 7426c3de..47bc8cdd 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -73,7 +73,6 @@ HHEADERS = ares_android.h \
ares_strsplit.h \
ares_writev.h \
bitncmp.h \
- ares_nameser.h \
ares_setup.h \
setup_once.h