Skip to content

Commit f946ec9

Browse files
committed
issue trusteddomainproject#257: configure.ac: Properly include headers required by resolv.h
before use it
1 parent c1770ec commit f946ec9

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

configure.ac

+26-2
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,38 @@ AC_CHECK_LIB(resolv, inet_aton, , , [-lnsl -lsocket])
158158
# only thing for it is to include resolv.h, don't redeclare res_ninit(),
159159
# and use the proper type signature when calling it.
160160
m4_rename([AC_LANG_CALL], [saved_AC_LANG_CALL])
161-
m4_define([AC_LANG_CALL], [AC_LANG_PROGRAM([#include <resolv.h>],
161+
m4_define([AC_LANG_CALL], [AC_LANG_PROGRAM([#ifdef HAVE_SYS_TYPES_H
162+
# include <sys/types.h>
163+
#endif
164+
#ifdef HAVE_NETINET_IN_H
165+
# include <netinet/in.h> /* inet_ functions / structs */
166+
#endif
167+
#ifdef HAVE_ARPA_NAMESER_H
168+
# include <arpa/nameser.h> /* DNS HEADER struct */
169+
#endif
170+
#ifdef HAVE_NETDB_H
171+
# include <netdb.h>
172+
#endif
173+
#include <resolv.h>],
162174
[return res_ninit(NULL);])])
163175
AC_SEARCH_LIBS(res_ninit, resolv,
164176
AC_DEFINE(HAVE_RES_NINIT, 1,
165177
[Define to 1 if you have the `res_ninit()' function.]))
166178

167179
# Same as above, but for res_ndestroy.
168-
m4_define([AC_LANG_CALL], [AC_LANG_PROGRAM([#include <resolv.h>],
180+
m4_define([AC_LANG_CALL], [AC_LANG_PROGRAM([#ifdef HAVE_SYS_TYPES_H
181+
# include <sys/types.h>
182+
#endif
183+
#ifdef HAVE_NETINET_IN_H
184+
# include <netinet/in.h> /* inet_ functions / structs */
185+
#endif
186+
#ifdef HAVE_ARPA_NAMESER_H
187+
# include <arpa/nameser.h> /* DNS HEADER struct */
188+
#endif
189+
#ifdef HAVE_NETDB_H
190+
# include <netdb.h>
191+
#endif
192+
#include <resolv.h>],
169193
[res_ndestroy(NULL);])])
170194
AC_SEARCH_LIBS(res_ndestroy, resolv,
171195
AC_DEFINE(HAVE_RES_NDESTROY, 1,

0 commit comments

Comments
 (0)