Add compilation support for GNU/kFreeBSD

Message ID
State Accepted, archived

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
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 <>
 batman/Makefile  |    5 +++++
 batman/bsd/tun.c |    2 +-
 2 files changed, 6 insertions(+), 1 deletions(-)


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)
+ifeq ($(UNAME),GNU/kFreeBSD)
+OS_C=		$(BSD_C) $(POSIX_C)
+LDFLAGS+=	-lfreebsd -lbsd
 ifeq ($(UNAME),FreeBSD)
 OS_C=		$(BSD_C) $(POSIX_C)
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;