diff --git a/Makefile.shared b/Makefile.shared index 118e8b0..6901fb8 100644 --- a/Makefile.shared +++ b/Makefile.shared @@ -31,6 +31,9 @@ ifndef PLATFORM ifneq (,$(findstring -freebsd,$(TARGETMACHINE))) PLATFORM=BSD endif + ifneq (,$(findstring -netbsd,$(TARGETMACHINE))) + PLATFORM=BSD + endif ifneq (,$(findstring -mingw32,$(TARGETMACHINE))) PLATFORM=WINDOWS endif @@ -96,7 +99,10 @@ ifeq ($(RENDERTYPE),SDL) ifneq (,$(shell $(PKGCONFIG) --atleast-version=3.4 gtk+-3.0 && echo yes)) HAVE_GTK=1 GTKCONFIG_CFLAGS=-DHAVE_GTK $(shell $(PKGCONFIG) --cflags gtk+-3.0) - GTKCONFIG_LIBS=$(shell $(PKGCONFIG) --libs gtk+-3.0) -ldl + GTKCONFIG_LIBS=$(shell $(PKGCONFIG) --libs gtk+-3.0) + ifeq ($(PLATFORM),LINUX) + BUILDLDFLAGS+= -ldl + endif else HAVE_GTK=0 endif diff --git a/include/compat.h b/include/compat.h index 387f121..807e562 100644 --- a/include/compat.h +++ b/include/compat.h @@ -37,6 +37,9 @@ #ifndef _DARWIN_C_SOURCE # define _DARWIN_C_SOURCE 1 #endif +#ifdef __NetBSD__ +# define _NETBSD_SOURCE 1 // https://gnats.netbsd.org/60227 +#endif #if defined(_MSC_VER) #define _CRT_DECLARE_NONSTDC_NAMES 0 @@ -120,9 +123,9 @@ typedef unsigned __int64 uint64_t; # define B_LITTLE_ENDIAN 0 # define B_BIG_ENDIAN 1 # endif -# define B_SWAP64(x) __bswap64(x) -# define B_SWAP32(x) __bswap32(x) -# define B_SWAP16(x) __bswap16(x) +# define B_SWAP64(x) bswap64(x) +# define B_SWAP32(x) bswap32(x) +# define B_SWAP16(x) bswap16(x) #elif defined(__APPLE__) # if defined(__LITTLE_ENDIAN__) diff --git a/src/compat.c b/src/compat.c index a196218..621678f 100644 --- a/src/compat.c +++ b/src/compat.c @@ -44,7 +44,7 @@ char *strlwr(char *s) { char *t = s; if (!s) return s; - while (*t) { *t = tolower(*t); t++; } + while (*t) { *t = tolower((unsigned char)*t); t++; } return s; } diff --git a/src/mmulti.c b/src/mmulti.c index 9e0e1bb..93d1fa9 100644 --- a/src/mmulti.c +++ b/src/mmulti.c @@ -911,9 +911,11 @@ static int lookuphost(const char *name, struct sockaddr *host, int warnifmany) memset(&hints, 0, sizeof(hints)); hints.ai_flags = AI_ADDRCONFIG; hints.ai_family = domain; +#ifdef AI_V4MAPPED if (domain == PF_INET6) { hints.ai_flags |= AI_V4MAPPED; } +#endif hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP;