[libdispatch-dev] [PATCH] use libkqueue if sys/event.h is missing
Mark Heily
mark at heily.com
Sun Oct 18 18:28:37 PDT 2009
Here is a patch that enables libdispatch to use libkqueue on platforms that
do not support kqueue(2). I have made pretty good progress with libkqueue
and the current sources are here:
http://mark.heily.com/src/libkqueue/
diff -ru -x .svn ./configure.ac ../trunk.NEW/configure.ac
--- ./configure.ac 2009-10-18 20:59:34.000000000 -0400
+++ ../trunk.NEW/configure.ac 2009-10-18 20:55:29.000000000 -0400
@@ -170,6 +170,17 @@
)
#
+# Use either libkqueue or the native kqueue(2) system calls
+#
+AC_CHECK_HEADER([sys/event.h],
+ [use_libkqueue=false],
+ [AC_CHECK_HEADER([kqueue/sys/event.h],
+ use_libkqueue=true,
+ AC_MSG_ERROR("sys/event.h not found"))]
+)
+AM_CONDITIONAL(USE_LIBKQUEUE, $use_libkqueue)
+
+#
# Find functions and declarations we care about.
#
AC_CHECK_DECLS([CLOCK_UPTIME, CLOCK_MONOTONIC], [], [],
diff -ru -x .svn ./src/Makefile.am ../trunk.NEW/src/Makefile.am
--- ./src/Makefile.am 2009-10-18 20:59:34.000000000 -0400
+++ ../trunk.NEW/src/Makefile.am 2009-10-18 21:03:54.000000000 -0400
@@ -16,6 +16,7 @@
time.c
libdispatch_la_CFLAGS=-Wall
+libdispatch_la_LIBADD=
INCLUDES=-I$(top_builddir) -I$(top_srcdir) \
@APPLE_LIBC_SOURCE_PATH@ @APPLE_XNU_SOURCE_PATH@
@@ -27,7 +28,12 @@
endif
if USE_LIBPTHREAD
-libdispatch_la_LIBADD=-lpthread
+libdispatch_la_LIBADD+= -lpthread
+endif
+
+if USE_LIBKQUEUE
+libdispatch_la_LIBADD+= -lkqueue
+libdispatch_la_CFLAGS+= -I/usr/include/kqueue
endif
if USE_MIG
More information about the libdispatch-dev
mailing list