mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-20 14:05:23 +01:00
build: check if -lsocket is required with *ifaddrs
This commit is contained in:
parent
87deac66aa
commit
879215e665
2 changed files with 37 additions and 1 deletions
36
build-aux/m4/l_socket.m4
Normal file
36
build-aux/m4/l_socket.m4
Normal file
|
@ -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
|
||||
])
|
|
@ -936,7 +936,7 @@ fi
|
|||
|
||||
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])
|
||||
|
||||
AC_CHECK_DECLS([getifaddrs, freeifaddrs],,,
|
||||
AC_CHECK_DECLS([getifaddrs, freeifaddrs],[CHECK_SOCKET],,
|
||||
[#include <sys/types.h>
|
||||
#include <ifaddrs.h>]
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue