unbound: fix getaddrinfo detection for 32-bit windows

On Windows, getaddrinfo is part of the Windows API and as such is
__stdcall, not __cdecl, so check_function_exists fails because the
declaration doesn't match the mangling __stdcall has. Instead, use a
header to include the symbol as declared on the system and use
check_symbol_exists instead.

Tested-By: greatwolf on IRC
This commit is contained in:
Ben Boeckel 2014-10-24 17:39:15 -04:00
parent e3776876af
commit c696492549
1 changed files with 11 additions and 1 deletions

View File

@ -59,7 +59,6 @@ check_function_exists(endservent HAVE_ENDSERVENT)
check_function_exists(fnctl HAVE_FNCTL)
check_function_exists(fork HAVE_FORK)
check_function_exists(fseeko HAVE_FSEEKO)
check_function_exists(getaddrinfo HAVE_GETADDRINFO)
check_function_exists(getentropy HAVE_GETENTROPY)
check_function_exists(getpwnam HAVE_GETPWNAM)
check_function_exists(getrlimit HAVE_GETRLIMIT)
@ -100,6 +99,17 @@ check_function_exists(usleep HAVE_USLEEP)
check_function_exists(writev HAVE_WRITEV)
check_function_exists(_beginthreadex HAVE__BEGINTHREADEX)
set(getaddrinfo_headers)
if (HAVE_NETDB_H)
list(APPEND getaddrinfo_headers "netdb.h")
endif ()
if (HAVE_WS2TCPIP_H)
list(APPEND getaddrinfo_headers "ws2tcpip.h")
endif ()
check_symbol_exists(getaddrinfo "${getaddrinfo_headers}" HAVE_GETADDRINFO)
check_function_exists(getaddrinfo HAVE_GETADDRINFO)
function (check_type_exists type variable header default)
set(CMAKE_EXTRA_INCLUDE_FILES "${header}")
check_type_size("${type}" "${variable}")