From 3fbff5f11db7400b63db0a96416559e29bf3495c Mon Sep 17 00:00:00 2001 From: FUTATSUKI Yasuhito Date: Fri, 8 Mar 2024 21:30:18 +0900 Subject: [PATCH] Issue #203: configure.ac: Properly include headers needed by resolve.h before use it --- configure.ac | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 1eaa95d8..07e988eb 100644 --- a/configure.ac +++ b/configure.ac @@ -116,8 +116,24 @@ AC_SEARCH_LIBS(getaddrinfo, resolv, # it, it conflicts with AC_LANG_CALL's redeclaration. Hmm. I guess the # only thing for it is to include resolv.h, don't redeclare res_ninit(), # and use the proper type signature when calling it. + +# Before using resolv.h, we need to check headers required for it. +AC_HEADER_RESOLV + m4_rename([AC_LANG_CALL], [saved_AC_LANG_CALL]) -m4_define([AC_LANG_CALL], [AC_LANG_PROGRAM([#include ], +m4_define([AC_LANG_CALL], [AC_LANG_PROGRAM([#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include /* inet_ functions / structs */ +#endif +#ifdef HAVE_ARPA_NAMESER_H +# include /* DNS HEADER struct */ +#endif +#ifdef HAVE_NETDB_H +# include +#endif +#include ], [return res_ninit(NULL);])]) AC_SEARCH_LIBS(res_ninit, resolv, AC_DEFINE(HAVE_RES_NINIT, 1, @@ -130,8 +146,6 @@ AC_SEARCH_LIBS(getopt_long, iberty, AC_DEFINE(HAVE_GETOPT_LONG, 1, [Define to 1 if you have the `getopt_long()' function.])) -AC_HEADER_RESOLV - # # Check for types #