Index: Makefile
===================================================================
RCS file: /cvsroot/softdevice/softdevice/Makefile,v
retrieving revision 1.42
diff -u -r1.42 Makefile
--- Makefile	14 Apr 2008 02:52:10 -0000	1.42
+++ Makefile	14 Apr 2010 20:12:50 -0000
@@ -27,9 +27,6 @@
 TMPDIR     = /tmp
 PLUGINLIBDIR = ./PLUGINS/lib
 
-# for older file-utils, option -f had the same effect
-CPOPTS = --remove-destination
-
 -include config.mak
 
 # uncomment to build the shared memory video server
@@ -130,6 +127,14 @@
 
 -include $(VDRDIR)/Make.config
 
+# leave this here as we only know if it is FreeBSD after Make.config inclusion
+# for older file-utils, option -f had the same effect
+ifdef FREEBSD
+CPOPTS = -f
+else
+CPOPTS = --remove-destination
+endif
+
 # #############################################################################
 # moved some defines to this section, as they are generated by
 # configure too.
@@ -211,7 +216,7 @@
 ### The version number of VDR (taken from VDR's "config.h"):
 
 VDRVERSION = $(shell grep 'define VDRVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
-APIVERSION = $(shell sed -ne '/define APIVERSION/ { s/^.*"\(.*\)".*$$/\1/; p }' $(VDRDIR)/config.h)
+APIVERSION = $(shell grep 'define APIVERSION ' $(VDRDIR)/config.h | awk '{ print $$3 }' | sed -e 's/"//g')
 
 ifeq ($(APIVERSION),)
 	APIVERSION = $(VDRVERSION)
Index: configure
===================================================================
RCS file: /cvsroot/softdevice/softdevice/configure,v
retrieving revision 1.50
diff -u -r1.50 configure
--- configure	21 Sep 2008 12:55:57 -0000	1.50
+++ configure	14 Apr 2010 20:12:50 -0000
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # simple configure script for softdevice
 #
@@ -50,7 +50,7 @@
 suspendkey="yes"
 cpu_bigendian="no"
 
-function help () {
+help () {
   echo "Usage: configure [options]"
   echo "available options are:"
   echo "  --disable-vidix"
@@ -118,6 +118,10 @@
 system=`uname -s`
 case "$system" in
   Linux) system="Linux";;
+  FreeBSD)
+	system="FreeBSD"
+	CFLAGS="${CFLAGS} -I/usr/local/include"
+	;;
   Darwin)
         system="Darwin"
         #with_subplugins="no"
Index: setup-softlog.c
===================================================================
RCS file: /cvsroot/softdevice/softdevice/setup-softlog.c,v
retrieving revision 1.9
diff -u -r1.9 setup-softlog.c
--- setup-softlog.c	14 Jun 2009 16:18:53 -0000	1.9
+++ setup-softlog.c	14 Apr 2010 20:12:50 -0000
@@ -216,6 +216,8 @@
 {
 #ifdef __APPLE__
   return getpid();
+#elif (defined __FreeBSD__)
+  return reinterpret_cast<long>(::pthread_self());
 #else
   return syscall(__NR_gettid);
 #endif
