Skip to content

Commit 3a039d6

Browse files
theuniFuzzbawls
authored andcommitted
build: avoid getifaddrs when unavailable
1 parent 77bddd7 commit 3a039d6

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
@@ -751,6 +751,10 @@ fi
751751

752752
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 sys/sysctl.h vm/vm_param.h sys/vmmeter.h sys/resources.h])
753753

754+
AC_CHECK_DECLS([getifaddrs, freeifaddrs],,,
755+
[#include <sys/types.h>
756+
#include <ifaddrs.h>]
757+
)
754758
AC_CHECK_DECLS([strnlen])
755759

756760
# 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
@@ -2007,7 +2007,7 @@ void Discover()
20072007
}
20082008
}
20092009
}
2010-
#else
2010+
#elif (HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS)
20112011
// Get local host ip
20122012
struct ifaddrs* myaddrs;
20132013
if (getifaddrs(&myaddrs) == 0) {

0 commit comments

Comments
 (0)