Browse code

core: DragonFly kqueue support enabled

- fixed kqueue support check for DragonFly (seems to be always
supported since it was forked from FreeBSD 4.8).
- in dragonfly case define both __OS_freebsd and __OS_dragonfly so
that we can make some exceptions for dragonfly (e.g. no >= 4.1
version check at runtime before enabling kqueue).
- assume SCTP in 2.6 is at least on par with SCTP in FreeBSD 7.1.

Andrei Pelinescu-Onciul authored on 13/08/2010 09:45:39
Showing 2 changed files
... ...
@@ -626,18 +626,20 @@ $(info target architecture <$(ARCH)>, host architecture <$(HOST_ARCH)>)
626 626
 #		adds support for Application Server interface
627 627
 # Sometimes is needes correct non-quoted $OS. HACK: gcc translates known OS to number ('linux'), so there is added underscore
628 628
 
629
-# Tell it that dragonflybsd is equivalent to compiling for freebsd.
630
-# This will cause __OS_freebsd to be defined below.
631 629
 ifeq ($(OS), dragonfly)
632
-	EQUIV_OS := freebsd
630
+	# Tell it that dragonflybsd is equivalent to compiling for freebsd, but
631
+	# define also __OS_dragonfly (for fine-tunning like kqueue support).
632
+	os_defs := -D__OS_freebsd -D__OS_dragonfly
633
+	EQUIV_OS = freebsd
633 634
 else
634
-	EQUIV_OS := $(OS)
635
+	os_defs := -D__OS_$(OS)
636
+	EQUIV_OS = $(OS)
635 637
 endif
636 638
 
637 639
 C_DEFS= $(extra_defs) \
638 640
 	 -DNAME='"$(MAIN_NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
639 641
 	 -DOS='$(OS)_' -DOS_QUOTED='"$(OS)"' -DCOMPILER='"$(CC_VER)"'\
640
-	 -D__CPU_$(ARCH) -D__OS_$(EQUIV_OS) \
642
+	 -D__CPU_$(ARCH) $(os_defs) \
641 643
 	 -DSER_VER=$(SER_VER) \
642 644
 	 -DCFG_DIR='"$(cfg_target)"'\
643 645
 	 -DPKG_MALLOC \
... ...
@@ -1820,11 +1822,9 @@ ifeq ($(OS), dragonfly)
1820 1820
 	else
1821 1821
 		LIBS=   #dlopen is in libc
1822 1822
 	endif
1823
-	# check for ver >= 4.1
1824
-	ifeq ($(shell [ $(OSREL_N) -gt 4001 ] && echo has_kqueue), has_kqueue)
1825
-		ifeq ($(NO_KQUEUE),)
1826
-			C_DEFS+=-DHAVE_KQUEUE
1827
-		endif
1823
+	# dragonfly was forked from freebsd 4.8 => all version have kqueue
1824
+	ifeq ($(NO_KQUEUE),)
1825
+		C_DEFS+=-DHAVE_KQUEUE
1828 1826
 	endif
1829 1827
 	ifeq ($(NO_SELECT),)
1830 1828
 		C_DEFS+=-DHAVE_SELECT
... ...
@@ -1840,8 +1840,11 @@ ifeq ($(OS), dragonfly)
1840 1840
 $(info "sctp development files not installed -- sctp disabled")
1841 1841
 			override SCTP :=
1842 1842
 		endif
1843
-		ifeq ($(shell [ $(OSREL_N) -lt 7000 ] && echo sctp), sctp)
1844
-$(info "old freebsd version (>= 7.0 needed) -- sctp disabled")
1843
+		# FIXME: don't know what's the status of SCTP on dragonfly
1844
+		#        (we suppose the 2.6 version is >= the version in
1845
+		#         in freebsd 7.0)
1846
+		ifeq ($(shell [ $(OSREL_N) -lt 2006 ] && echo sctp), sctp)
1847
+$(info "old dragonfly version (>= 2.6 needed) -- sctp disabled")
1845 1848
 			override SCTP :=
1846 1849
 		endif
1847 1850
 		
... ...
@@ -340,10 +340,13 @@ char* check_poll_method(enum poll_types poll_method)
340 340
 #ifndef HAVE_KQUEUE
341 341
 			ret="kqueue not supported, try re-compiling with -DHAVE_KQUEUE";
342 342
 #else
343
-		/* only in FreeBSD 4.1, NETBSD 2.0, OpenBSD 2.9, Darwin */
343
+		/* only in FreeBSD 4.1, NETBSD 2.0, OpenBSD 2.9, Darwin, DragonFly */
344 344
 	#ifdef __OS_freebsd
345
+		/* all DragonFly versions have kqueque */
346
+		#ifndef __OS_dragonfly
345 347
 			if (_os_ver<0x0401) /* if ver < 4.1 */
346 348
 				ret="kqueue not supported on FreeBSD < 4.1";
349
+		#endif /* __OS_dragonfly */
347 350
 	#elif defined (__OS_netbsd)
348 351
 			if (_os_ver<0x020000) /* if ver < 2.0 */
349 352
 				ret="kqueue not supported on NetBSD < 2.0";
... ...
@@ -388,9 +391,12 @@ enum poll_types choose_poll_method()
388 388
 #endif
389 389
 #ifdef HAVE_KQUEUE
390 390
 	if (poll_method==0)
391
-		/* only in FreeBSD 4.1, NETBSD 2.0, OpenBSD 2.9, Darwin */
391
+		/* only in FreeBSD 4.1, NETBSD 2.0, OpenBSD 2.9, Darwin, DragonFly */
392 392
 	#ifdef __OS_freebsd
393
+		/* all DragonFly versions have kqueque */
394
+		#ifndef __OS_dragonfly
393 395
 		if (_os_ver>=0x0401) /* if ver >= 4.1 */
396
+		#endif /**__OS_dragonfly
394 397
 	#elif defined (__OS_netbsd)
395 398
 		if (_os_ver>=0x020000) /* if ver >= 2.0 */
396 399
 	#elif defined (__OS_openbsd)