[sr-dev] git:4.4:615b2525: Makefile.defs: detect kfreebsd OS and set its default compile flags

Daniel-Constantin Mierla miconda at gmail.com
Mon Apr 25 09:22:35 CEST 2016


Module: kamailio
Branch: 4.4
Commit: 615b252510cee01dc6f24ac7d12f07dcb6b50366
URL: https://github.com/kamailio/kamailio/commit/615b252510cee01dc6f24ac7d12f07dcb6b50366

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-04-25T09:18:42+02:00

Makefile.defs: detect kfreebsd OS and set its default compile flags

- combine the options of Linux with FreeBSD to use kqueue if available
- reported by Victor Seva, GH #576

(cherry picked from commit 4c6f879563adbbdee7c730549533a0d852e6cbef)

---

Modified: Makefile.defs

---

Diff:  https://github.com/kamailio/kamailio/commit/615b252510cee01dc6f24ac7d12f07dcb6b50366.diff
Patch: https://github.com/kamailio/kamailio/commit/615b252510cee01dc6f24ac7d12f07dcb6b50366.patch

---

diff --git a/Makefile.defs b/Makefile.defs
index 245f9b4..1814caf 100644
--- a/Makefile.defs
+++ b/Makefile.defs
@@ -113,7 +113,7 @@ SER_VER = $(shell expr $(VERSION) \* 1000000 + $(PATCHLEVEL) \* 1000 + \
 			$(SUBLEVEL) )
 RELEASE:=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS := $(shell uname -s | sed -e s/SunOS/solaris/ -e s/CYGWIN.*/cygwin/ \
-		 | tr "[A-Z]" "[a-z]")
+		 | tr "[A-Z]" "[a-z]" | tr "/" "_")
 
 ifeq ($(OS),solaris)
 	GETARCH=isainfo -n
@@ -392,6 +392,13 @@ ifeq ($(OS), linux)
 	LOCALBASE ?= /usr/local
 endif
 
+ifeq ($(OS), gnu_kfreebsd)
+	doc_dir = share/doc/$(MAIN_NAME)/
+	man_dir = share/man/
+	data_dir = share/$(MAIN_NAME)/
+	LOCALBASE ?= /usr/local
+endif
+
 ifeq ($(OS), freebsd)
 	doc_dir = share/doc/$(MAIN_NAME)/
 	man_dir = man/
@@ -1745,6 +1752,38 @@ ifeq ($(OS), linux)
 	endif
 endif
 
+ifeq ($(OS), gnu_kfreebsd)
+# by default use futexes if available
+	use_futex= yes
+	C_DEFS+=-DHAVE_GETHOSTBYNAME2 -DHAVE_UNION_SEMUN -DHAVE_SCHED_YIELD \
+			-DHAVE_MSG_NOSIGNAL -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_ALLOCA_H \
+			-DHAVE_TIMEGM -DHAVE_SCHED_SETSCHEDULER -DUSE_RAW_SOCKS
+	ifneq ($(found_lock_method), yes)
+		#C_DEFS+= -DUSE_POSIX_SEM
+		C_DEFS+=-DUSE_PTHREAD_MUTEX
+		LIBS+= -lpthread
+		#C_DEFS+= -DUSE_SYSV_SEM  # try posix sems
+		found_lock_method=yes
+	else
+		ifneq (,$(findstring -DUSE_POSIX_SEM, $(C_DEFS)))
+			LIBS+=-lpthread
+		endif
+		ifneq (,$(findstring -DUSE_PTHREAD_MUTEX, $(C_DEFS)))
+			LIBS+=-lpthread
+		endif
+	endif
+
+	# check for ver >= 4.1
+	ifeq ($(shell [ $(OSREL_N) -gt 4001 ] && echo has_kqueue), has_kqueue)
+		ifeq ($(NO_KQUEUE),)
+			C_DEFS+=-DHAVE_KQUEUE
+		endif
+	endif
+	ifeq ($(NO_SELECT),)
+		C_DEFS+=-DHAVE_SELECT
+	endif
+endif
+
 ifeq  ($(OS), solaris)
 	C_DEFS+= -DHAVE_GETIPNODEBYNAME -DHAVE_SYS_SOCKIO_H -DHAVE_SCHED_YIELD \
 			-DHAVE_ALLOCA_H -DUSE_SIGACTION




More information about the sr-dev mailing list