Add compilation support for GNU/kFreeBSD

Message ID 1239273959-7911-1-git-send-email-sven.eckelmann@gmx.de (mailing list archive)
State Accepted, archived
Headers

Commit Message

Sven Eckelmann April 9, 2009, 10:45 a.m. UTC
  Debian recently announced that it added GNU/kFreeBSD as supported
distribution. It consists of an FreeBSD kernel and the usual debian
userspace tools and libraries. It uses the glibc with some extra
(free)bsd libraries to support bsd-only functions like devname and
strlcpy.
batmand should instantly work on this platform if a BSD developer would
port the bsd compatibility layer again to (Open|Free)BSD.

Signed-off-by: Sven Eckelmann <sven.eckelmann@gmx.de>
---
 batman/Makefile  |    5 +++++
 batman/bsd/tun.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)
  

Patch

diff --git a/batman/Makefile b/batman/Makefile
index 509217d..0f6e61f 100644
--- a/batman/Makefile
+++ b/batman/Makefile
@@ -44,6 +44,11 @@  ifeq ($(UNAME),Darwin)
 OS_C=		$(BSD_C) $(POSIX_C)
 endif
 
+ifeq ($(UNAME),GNU/kFreeBSD)
+OS_C=		$(BSD_C) $(POSIX_C)
+LDFLAGS+=	-lfreebsd -lbsd
+endif
+
 ifeq ($(UNAME),FreeBSD)
 OS_C=		$(BSD_C) $(POSIX_C)
 endif
diff --git a/batman/bsd/tun.c b/batman/bsd/tun.c
index 2629bcd..2c571c0 100644
--- a/batman/bsd/tun.c
+++ b/batman/bsd/tun.c
@@ -71,7 +71,7 @@  static int open_tun_any(char *dev_name, size_t dev_name_size)
 	}
 	return -1;
 }
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 static int open_tun_any(char *dev_name, size_t dev_name_size)
 {
 	int fd;