Skip to content

Commit 9256f7d

Browse files
theuniLawrence Nahum
authored andcommitted
build: avoid getifaddrs when unavailable
1 parent 2070a54 commit 9256f7d

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
@@ -727,6 +727,10 @@ fi
727727

728728
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])
729729

730+
AC_CHECK_DECLS([getifaddrs, freeifaddrs],,,
731+
[#include <sys/types.h>
732+
#include <ifaddrs.h>]
733+
)
730734
AC_CHECK_DECLS([strnlen])
731735

732736
# 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)