build: avoid getifaddrs when unavailable

This commit is contained in:
Cory Fields 2018-07-19 14:21:05 -04:00 committed by Lawrence Nahum
parent 2070a545e2
commit 9256f7d13f
No known key found for this signature in database
GPG key ID: 17AB8BC320B151D8
2 changed files with 5 additions and 1 deletions

View file

@ -727,6 +727,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)