diff options
author | Jerome Duval | 2024-04-11 10:08:22 +0200 |
---|---|---|
committer | Nikias Bassen | 2024-05-04 13:41:45 +0200 |
commit | 1ee8d0ac233fb510260dbf3a647fbd02f1a92825 (patch) | |
tree | 7a671e6f5fca92955fe94280529a65aeb95a8d9b | |
parent | e61817ae57aac7252499268a9276692a32dc3e01 (diff) | |
download | libimobiledevice-glue-1ee8d0ac233fb510260dbf3a647fbd02f1a92825.tar.gz libimobiledevice-glue-1ee8d0ac233fb510260dbf3a647fbd02f1a92825.tar.bz2 |
socket: Haiku compilation fixes
- link against libnetwork
- get_primary_mac_address similar to FreeBSD
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/socket.c | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac index 4a3aca3..eae80e8 100644 --- a/configure.ac +++ b/configure.ac @@ -50,6 +50,8 @@ AC_TYPE_UINT8_T # Checks for library functions. AC_CHECK_FUNCS([asprintf strcasecmp strdup strerror strndup stpcpy vasprintf getifaddrs poll]) +# Checks for additional library requirements +AC_SEARCH_LIBS(socket, network) AC_CHECK_HEADER(endian.h, [ac_cv_have_endian_h="yes"], [ac_cv_have_endian_h="no"]) if test "x$ac_cv_have_endian_h" = "xno"; then diff --git a/src/socket.c b/src/socket.c index 5276b1e..d4dedd1 100644 --- a/src/socket.c +++ b/src/socket.c @@ -55,7 +55,7 @@ static int wsa_init = 0; #ifdef AF_INET6 #include <net/if.h> #include <ifaddrs.h> -#if defined (__APPLE__) || defined (__FreeBSD__) +#if defined (__APPLE__) || defined (__FreeBSD__) || defined (__HAIKU__) #include <net/if_dl.h> #endif #ifdef __linux__ @@ -894,13 +894,13 @@ int get_primary_mac_address(unsigned char mac_addr_buf[6]) if (ifa->ifa_flags & IFF_LOOPBACK) { continue; } -#if defined(__APPLE__) || defined (__FreeBSD__) +#if defined(__APPLE__) || defined (__FreeBSD__) || defined (__HAIKU__) if (ifa->ifa_addr->sa_family != AF_LINK) { continue; } #if defined (__APPLE__) if (!strcmp(ifa->ifa_name, "en0")) { -#elif defined (__FreeBSD__) +#elif defined (__FreeBSD__) || defined (__HAIKU__) { #endif memcpy(mac_addr_buf, (unsigned char *)LLADDR((struct sockaddr_dl *)(ifa)->ifa_addr), 6); @@ -973,10 +973,12 @@ static int32_t _sockaddr_in6_scope_id(struct sockaddr_in6* addr) continue; } +#ifndef __HAIKU__ /* skip if not running */ if ((ifa->ifa_flags & IFF_RUNNING) == 0) { continue; } +#endif struct sockaddr_in6* addr_in = (struct sockaddr_in6*)ifa->ifa_addr; |