build: avoid getifaddrs when unavailable
This commit is contained in:
parent
2070a545e2
commit
9256f7d13f
2 changed files with 5 additions and 1 deletions
|
@ -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_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])
|
AC_CHECK_DECLS([strnlen])
|
||||||
|
|
||||||
# Check for daemon(3), unrelated to --with-daemon (although used by it)
|
# Check for daemon(3), unrelated to --with-daemon (although used by it)
|
||||||
|
|
|
@ -2167,7 +2167,7 @@ void Discover()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#elif (HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS)
|
||||||
// Get local host ip
|
// Get local host ip
|
||||||
struct ifaddrs* myaddrs;
|
struct ifaddrs* myaddrs;
|
||||||
if (getifaddrs(&myaddrs) == 0)
|
if (getifaddrs(&myaddrs) == 0)
|
||||||
|
|
Loading…
Reference in a new issue