diff --git a/miniupnpc/Makefile b/miniupnpc/Makefile index ca57dfa..ea25fc1 100644 --- a/miniupnpc/Makefile +++ b/miniupnpc/Makefile @@ -35,8 +35,12 @@ CFLAGS += -W -Wstrict-prototypes CFLAGS += -fno-common CFLAGS += -DMINIUPNPC_SET_SOCKET_TIMEOUT CFLAGS += -DMINIUPNPC_GET_SRC_ADDR -CFLAGS += -D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112L -CFLAGS += -ansi +CFLAGS += -D_BSD_SOURCE -D_DEFAULT_SOURCE +ifneq ($(OS), FreeBSD) +#CFLAGS += -D_POSIX_C_SOURCE=200112L +CFLAGS += -D_XOPEN_SOURCE=600 +endif +#CFLAGS += -ansi # -DNO_GETADDRINFO INSTALL = install SH = /bin/sh diff --git a/miniupnpc/minissdpc.c b/miniupnpc/minissdpc.c index 3272e20..a966c2f 100644 --- a/miniupnpc/minissdpc.c +++ b/miniupnpc/minissdpc.c @@ -8,6 +8,7 @@ /*#include */ #include #include +#include #include #include #include @@ -18,21 +19,30 @@ #include #include #include -#endif +#ifndef strncasecmp +#if defined(_MSC_VER) && (_MSC_VER >= 1400) +#define strncasecmp _memicmp +#else /* defined(_MSC_VER) && (_MSC_VER >= 1400) */ +#define strncasecmp memicmp +#endif /* defined(_MSC_VER) && (_MSC_VER >= 1400) */ +#endif /* #ifndef strncasecmp */ +#endif /* _WIN32 */ #if defined(__amigaos__) || defined(__amigaos4__) #include -#endif +#endif /* defined(__amigaos__) || defined(__amigaos4__) */ #if defined(__amigaos__) #define uint16_t unsigned short -#endif +#endif /* defined(__amigaos__) */ /* Hack */ #define UNIX_PATH_LEN 108 struct sockaddr_un { uint16_t sun_family; char sun_path[UNIX_PATH_LEN]; }; -#else +#else /* defined(_WIN32) || defined(__amigaos__) || defined(__amigaos4__) */ #include +#include +#include #include #include #include diff --git a/miniupnpc/miniupnpc.c b/miniupnpc/miniupnpc.c index fbc6526..26ce593 100644 --- a/miniupnpc/miniupnpc.c +++ b/miniupnpc/miniupnpc.c @@ -5,18 +5,6 @@ * copyright (c) 2005-2015 Thomas Bernard * This software is subjet to the conditions detailed in the * provided LICENSE file. */ -#define __EXTENSIONS__ 1 -#if !defined(__APPLE__) && !defined(__sun) -#if !defined(_XOPEN_SOURCE) && !defined(__OpenBSD__) && !defined(__NetBSD__) -#ifndef __cplusplus -#define _XOPEN_SOURCE 600 -#endif -#endif -#ifndef __BSD_VISIBLE -#define __BSD_VISIBLE 1 -#endif -#endif - #include #include #include