Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F12944890
D3824.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D3824.diff
View Options
diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -704,6 +704,10 @@
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)
diff --git a/src/config/CMakeLists.txt b/src/config/CMakeLists.txt
--- a/src/config/CMakeLists.txt
+++ b/src/config/CMakeLists.txt
@@ -127,6 +127,10 @@
check_symbol_exists(getentropy "unistd.h" HAVE_GETENTROPY)
check_symbol_exists(getentropy "sys/random.h" HAVE_GETENTROPY_RAND)
+# getifaddrs and freeifaddrs may be unavailable with some Android versions
+check_symbol_exists(getifaddrs "sys/types.h;ifaddrs.h" HAVE_DECL_GETIFADDRS)
+check_symbol_exists(freeifaddrs "sys/types.h;ifaddrs.h" HAVE_DECL_FREEIFADDRS)
+
check_cxx_source_compiles("
#include <unistd.h> /* for syscall */
#include <sys/syscall.h> /* for SYS_getrandom */
diff --git a/src/config/bitcoin-config.h.cmake.in b/src/config/bitcoin-config.h.cmake.in
--- a/src/config/bitcoin-config.h.cmake.in
+++ b/src/config/bitcoin-config.h.cmake.in
@@ -45,6 +45,8 @@
#cmakedefine HAVE_DECL_STRNLEN 1
#cmakedefine HAVE_DECL_DAEMON 1
+#cmakedefine HAVE_DECL_GETIFADDRS 1
+#cmakedefine HAVE_DECL_FREEIFADDRS 1
#cmakedefine HAVE_GETENTROPY 1
#cmakedefine HAVE_GETENTROPY_RAND 1
#cmakedefine HAVE_SYS_GETRANDOM 1
diff --git a/src/net.cpp b/src/net.cpp
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -2301,7 +2301,7 @@
}
}
}
-#else
+#elif (HAVE_DECL_GETIFADDRS && HAVE_DECL_FREEIFADDRS)
// Get local host ip
struct ifaddrs *myaddrs;
if (getifaddrs(&myaddrs) == 0) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Feb 6, 15:54 (17 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5082646
Default Alt Text
D3824.diff (1 KB)
Attached To
D3824: build: avoid getifaddrs when unavailable
Event Timeline
Log In to Comment