Skip to content

Commit 7c7bb6e

Browse files
committed
Merge #14127: build: avoid getifaddrs when unavailable
9256f7d 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
2 parents 6eeac2e + 9256f7d commit 7c7bb6e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

configure.ac

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,10 @@ fi
733733

734734
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])
735735

736+
AC_CHECK_DECLS([getifaddrs, freeifaddrs],,,
737+
[#include <sys/types.h>
738+
#include <ifaddrs.h>]
739+
)
736740
AC_CHECK_DECLS([strnlen])
737741

738742
# Check for daemon(3), unrelated to --with-daemon (although used by it)

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2167,7 +2167,7 @@ void Discover()
21672167
}
21682168
}
21692169
}
2170-
#else
2170+
#elif (HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS)
21712171
// Get local host ip
21722172
struct ifaddrs* myaddrs;
21732173
if (getifaddrs(&myaddrs) == 0)

0 commit comments

Comments
 (0)