From f946ec946e25f7d9f2fc090d72602fb8366d87cb Mon Sep 17 00:00:00 2001 From: FUTATSUKI Yasuhito Date: Sun, 10 Mar 2024 00:09:52 +0900 Subject: [PATCH] issue #257: configure.ac: Properly include headers required by resolv.h before use it --- configure.ac | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index fa1bc2b..492a57f 100644 --- a/configure.ac +++ b/configure.ac @@ -158,14 +158,38 @@ AC_CHECK_LIB(resolv, inet_aton, , , [-lnsl -lsocket]) # only thing for it is to include resolv.h, don't redeclare res_ninit(), # and use the proper type signature when calling it. 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, [Define to 1 if you have the `res_ninit()' function.])) # Same as above, but for res_ndestroy. -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 ], [res_ndestroy(NULL);])]) AC_SEARCH_LIBS(res_ndestroy, resolv, AC_DEFINE(HAVE_RES_NDESTROY, 1,