Skip to content

Commit

Permalink
Issue trusteddomainproject#203: configure.ac: Properly include header…
Browse files Browse the repository at this point in the history
…s needed by resolve.h

before use it
  • Loading branch information
futatuki committed Mar 8, 2024
1 parent 551ab38 commit 3fbff5f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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 <resolv.h>],
m4_define([AC_LANG_CALL], [AC_LANG_PROGRAM([#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#ifdef HAVE_NETINET_IN_H
# include <netinet/in.h> /* inet_ functions / structs */
#endif
#ifdef HAVE_ARPA_NAMESER_H
# include <arpa/nameser.h> /* DNS HEADER struct */
#endif
#ifdef HAVE_NETDB_H
# include <netdb.h>
#endif
#include <resolv.h>],
[return res_ninit(NULL);])])
AC_SEARCH_LIBS(res_ninit, resolv,
AC_DEFINE(HAVE_RES_NINIT, 1,
Expand All @@ -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
#
Expand Down

0 comments on commit 3fbff5f

Please sign in to comment.