mirror of https://github.com/getdnsapi/getdns.git
Fix builds in mingw32.
On mingw64, configure does not find declarations for inet_ntop() and inet_pton(), but does find implementations, and so does not try to compile the compat versions. On mingw32, configure find neither declarations or implementations, and so tries to compile the compat versions. However, there are declarations in ws2tcpip.h, and these do not have the same prototype as compat. The build fails, complaining about conflicting types for inet_ntop(). The declarations in ws2tcpip.h are #defines to Windows functions InetNtopA() and InetPtonA(). Which is not good, but we're stuck with it. Try to work around this by including ws2tcpip.h in the headers while checking for declarations. Unfortunately it looks like you can't do that when checking for implementations and substituting compat versions when not found. So only do that if we don't find declarations; we're already making sure that ws2tcpip.h is included via config.h in source modules.
This commit is contained in:
parent
acc9b1cbd5
commit
a7a17f3725
17
configure.ac
17
configure.ac
|
@ -1514,9 +1514,20 @@ CFLAGS="$CFLAGS $LIBBSD_CFLAGS"
|
|||
],[
|
||||
AC_MSG_WARN([libbsd not found or usable; using embedded code instead])
|
||||
])
|
||||
AC_CHECK_DECLS([inet_pton,inet_ntop,strlcpy,arc4random,arc4random_uniform])
|
||||
AC_REPLACE_FUNCS(inet_pton)
|
||||
AC_REPLACE_FUNCS(inet_ntop)
|
||||
AC_CHECK_DECLS([inet_pton,inet_ntop,strlcpy,arc4random,arc4random_uniform], [], [], [
|
||||
AC_INCLUDES_DEFAULT
|
||||
#ifdef HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
])
|
||||
AS_IF([test "x$ac_cv_have_decl_inet_pton" = xyes],
|
||||
[],
|
||||
[AC_REPLACE_FUNCS(inet_pton)]
|
||||
)
|
||||
AS_IF([test "x$ac_cv_have_decl_inet_ntop" = xyes],
|
||||
[],
|
||||
[AC_REPLACE_FUNCS(inet_ntop)]
|
||||
)
|
||||
AC_REPLACE_FUNCS(strlcpy)
|
||||
AC_REPLACE_FUNCS(arc4random)
|
||||
AC_REPLACE_FUNCS(arc4random_uniform)
|
||||
|
|
Loading…
Reference in New Issue