diff --git a/libs/common/osdef.h.in b/libs/common/osdef.h.in index f628b0e0..2645c431 100644 --- a/libs/common/osdef.h.in +++ b/libs/common/osdef.h.in @@ -38,6 +38,18 @@ # define OS_BSD #endif +#if defined(__FreeBSD__) +# define OS_FREEBSD +#endif + +#if defined(__NetBSD__) +# define OS_NETBSD +#endif + +#if defined(__OpenBSD__) +# define OS_OPENBSD +#endif + #if defined(__GNU__) # define OS_HURD #endif diff --git a/libs/common/socket.c b/libs/common/socket.c index 04468cfe..53497ba6 100644 --- a/libs/common/socket.c +++ b/libs/common/socket.c @@ -120,7 +120,8 @@ PHOST phost_resolve( const char *host ) { PHOST ip = inet_addr(host); if( ip == INADDR_NONE ) { struct hostent *h; -# if defined(OS_WINDOWS) || defined(OS_MAC) || defined(OS_CYGWIN) || defined(__NetBSD__) || defined(__OpenBSD__) +# if defined(OS_WINDOWS) || defined(OS_MAC) || defined(OS_CYGWIN) || \ + defined(OS_NETBSD) || defined(OS_OPENBSD) h = gethostbyname(host); # else struct hostent hbase; diff --git a/libs/std/socket.c b/libs/std/socket.c index 4eec9c9f..5cac1189 100644 --- a/libs/std/socket.c +++ b/libs/std/socket.c @@ -371,7 +371,8 @@ static value host_resolve( value host ) { ip = inet_addr(val_string(host)); if( ip == INADDR_NONE ) { struct hostent *h; -# if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(NEKO_CYGWIN) || defined(__NetBSD__) || defined(__OpenBSD__) +# if defined(NEKO_WINDOWS) || defined(NEKO_MAC) || defined(NEKO_CYGWIN) || \ + defined(NEKO_NETBSD) || defined(NEKO_OPENBSD) h = gethostbyname(val_string(host)); # else struct hostent hbase; diff --git a/vm/main.c b/vm/main.c index 5fe755b2..47c04282 100644 --- a/vm/main.c +++ b/vm/main.c @@ -92,7 +92,7 @@ static char *executable_path() { sysctl(mib, 4, path, &cb, NULL, 0); if (!cb) return NULL; return path; -#elif defined(__OpenBSD__) && defined(HAVE_GETEXECPATH) +#elif defined(NEKO_OPENBSD) && defined(HAVE_GETEXECPATH) static char path[PATH_MAX]; if (getexecpath(path, sizeof(path)) == -1) return NULL; diff --git a/vm/neko.h.in b/vm/neko.h.in index 438b40dc..6d181ca3 100644 --- a/vm/neko.h.in +++ b/vm/neko.h.in @@ -43,6 +43,18 @@ # define NEKO_BSD #endif +#if defined(__FreeBSD__) +# define NEKO_FREEBSD +#endif + +#if defined(__NetBSD__) +# define NEKO_NETBSD +#endif + +#if defined(__OpenBSD__) +# define NEKO_OPENBSD +#endif + #if defined(__GNU__) # define NEKO_HURD #endif