MacOS: Enable libresolv support for retrieving DNS servers like iOS does.

pull/325/head
Brad House 5 years ago
parent dbdde3a424
commit baf6f4eb42
  1. 2
      CMakeLists.txt
  2. 25
      configure.ac

@ -137,7 +137,7 @@ return 0;
MACOS_V1012)
ENDIF ()
IF (IOS AND HAVE_LIBRESOLV)
IF ((IOS OR APPLE) AND HAVE_LIBRESOLV)
SET (CARES_USE_LIBRESOLV 1)
ENDIF()

@ -354,27 +354,12 @@ if test "$HAVE_GETHOSTBYNAME" != "1"; then
AC_MSG_ERROR([couldn't find libraries for gethostbyname()])
fi
dnl resolv lib for iPhone
dnl resolv lib for Apple (MacOS and iOS)
AS_IF([test "x$host_vendor" = "xapple"], [
AC_MSG_CHECKING([for iPhone target])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([[
#include "TargetConditionals.h"
]], [[
#if TARGET_OS_IPHONE == 0
#error Not an iPhone target
#endif
return 0;
]])
],[
AC_MSG_RESULT([yes])
AC_SEARCH_LIBS([res_servicename], [resolv], [
AC_DEFINE([CARES_USE_LIBRESOLV], [1], [Use resolver library to configure cares])
], [
AC_MSG_ERROR([Unable to find libresolv which is required for iPhone targets])
])
],[
AC_MSG_RESULT([no])
AC_SEARCH_LIBS([res_servicename], [resolv], [
AC_DEFINE([CARES_USE_LIBRESOLV], [1], [Use resolver library to configure cares])
], [
AC_MSG_ERROR([Unable to find libresolv which is required for iPhone targets])
])
])

Loading…
Cancel
Save