Merge #14127: build: avoid getifaddrs when unavailable

9256f7d13f build: avoid getifaddrs when unavailable (Cory Fields)

Pull request description:

  These changes from @theuni help building when targeting platforms that don't always have getifaddrs available like Android < 24

Tree-SHA512: dbfeb83297bd6f00b7991f53eef8a04948d2d739bf47c0524d9ae5335b843b8a5c06ff98c109fe5e6192665e6d0cf58700b8aa7e2a0b410281d3c052881973ff
This commit is contained in:
Wladimir J. van der Laan 2018-09-10 18:07:53 +02:00
commit 7c7bb6e772
No known key found for this signature in database
GPG Key ID: 1E4AED62986CD25D
2 changed files with 5 additions and 1 deletions

View File

@ -733,6 +733,10 @@ fi
AC_CHECK_HEADERS([endian.h sys/endian.h byteswap.h stdio.h stdlib.h unistd.h strings.h sys/types.h sys/stat.h sys/select.h sys/prctl.h])
AC_CHECK_DECLS([getifaddrs, freeifaddrs],,,
[#include <sys/types.h>
#include <ifaddrs.h>]
)
AC_CHECK_DECLS([strnlen])
# Check for daemon(3), unrelated to --with-daemon (although used by it)

View File

@ -2167,7 +2167,7 @@ void Discover()
}
}
}
#else
#elif (HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS)
// Get local host ip
struct ifaddrs* myaddrs;
if (getifaddrs(&myaddrs) == 0)