forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge bitcoin#21486: build: link against -lsocket if required for *if…
…addrs 4783115 net: add ifaddrs.h include (fanquake) 879215e build: check if -lsocket is required with *ifaddrs (fanquake) 87deac6 rand: only try and use freeifaddrs if available (fanquake) Pull request description: Fixes bitcoin#21485 by linking against `-lsocket` when it's required for using `*ifaddrs` functions. ACKs for top commit: laanwj: Code review ACK 4783115 hebasto: ACK 4783115, I have reviewed the code and it looks OK, I agree it can be merged. Tree-SHA512: 4542e036e9b029de970eff8a9230fe45d9204bb22313d075f474295d49bdaf1f1cbb36c0c6e2fa8dbbcdba518d8d3a68a6116ce304b82414315f333baf9af0e4
- Loading branch information
1 parent
dfd5f68
commit 2966452
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Illumos/SmartOS requires linking with -lsocket if | ||
# using getifaddrs & freeifaddrs | ||
|
||
m4_define([_CHECK_SOCKET_testbody], [[ | ||
#include <sys/types.h> | ||
#include <ifaddrs.h> | ||
int main() { | ||
struct ifaddrs *ifaddr; | ||
getifaddrs(&ifaddr); | ||
freeifaddrs(ifaddr); | ||
} | ||
]]) | ||
|
||
AC_DEFUN([CHECK_SOCKET], [ | ||
AC_LANG_PUSH(C++) | ||
AC_MSG_CHECKING([whether ifaddrs funcs can be used without link library]) | ||
AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_SOCKET_testbody])],[ | ||
AC_MSG_RESULT([yes]) | ||
],[ | ||
AC_MSG_RESULT([no]) | ||
LIBS="$LIBS -lsocket" | ||
AC_MSG_CHECKING([whether getifaddrs needs -lsocket]) | ||
AC_LINK_IFELSE([AC_LANG_SOURCE([_CHECK_SOCKET_testbody])],[ | ||
AC_MSG_RESULT([yes]) | ||
],[ | ||
AC_MSG_RESULT([no]) | ||
AC_MSG_FAILURE([cannot figure out how to use getifaddrs]) | ||
]) | ||
]) | ||
AC_LANG_POP | ||
]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters