From bffb6a828fb0b7fbc393114b31c59fbf50b0bb94 Mon Sep 17 00:00:00 2001 From: CodeforEvolution Date: Sun, 16 Feb 2020 22:19:29 -0600 Subject: [PATCH] Add Haiku Support --- miniupnpc/CMakeLists.txt | 6 ++++++ miniupnpc/minissdpc.c | 4 ++-- miniupnpc/portlistingparse.c | 4 ++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/miniupnpc/CMakeLists.txt b/miniupnpc/CMakeLists.txt index 94fa628..1f0d779 100644 --- a/miniupnpc/CMakeLists.txt +++ b/miniupnpc/CMakeLists.txt @@ -96,6 +96,12 @@ if (WIN32) # find_library (NSL_LIBRARY NAMES nsl) # find_library (RESOLV_LIBRARY NAMES resolv) # set (LDLIBS ${SOCKET_LIBRARY} ${NSL_LIBRARY} ${RESOLV_LIBRARY} ${LDLIBS}) +elseif (HAIKU) + target_link_libraries(miniupnpc-private INTERFACE network) + find_library (SOCKET_LIBRARY NAMES network) + find_library (NSL_LIBRARY NAMES network) + find_library (RESOLV_LIBRARY NAMES network) + set (LDLIBS ${SOCKET_LIBRARY} ${NSL_LIBRARY} ${RESOLV_LIBRARY} ${LDLIBS}) endif () diff --git a/miniupnpc/minissdpc.c b/miniupnpc/minissdpc.c index 29f8110..a3b1283 100644 --- a/miniupnpc/minissdpc.c +++ b/miniupnpc/minissdpc.c @@ -62,13 +62,13 @@ struct sockaddr_un { #include "miniupnpc_socketdef.h" -#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__GNU__) && !defined(__FreeBSD_kernel__) +#if !defined(__DragonFly__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(__sun) && !defined(__GNU__) && !defined(__FreeBSD_kernel__) && !defined(__HAIKU__) #define HAS_IP_MREQN #endif #if !defined(HAS_IP_MREQN) && !defined(_WIN32) #include -#if defined(__sun) +#if defined(__sun) || defined(__HAIKU__) #include #endif #endif diff --git a/miniupnpc/portlistingparse.c b/miniupnpc/portlistingparse.c index 55859f2..ff9fadd 100644 --- a/miniupnpc/portlistingparse.c +++ b/miniupnpc/portlistingparse.c @@ -12,6 +12,10 @@ #include "portlistingparse.h" #include "minixml.h" +#if defined(__HAIKU__) +#define atoui atoui2 +#endif + /* list of the elements */ static const struct { const portMappingElt code;