[libdispatch-dev] [PATCH] use libkqueue if sys/event.h is missing

Robert Watson robert at fledge.watson.org
Sun Nov 1 04:21:30 PST 2009


On Sun, 18 Oct 2009, Mark Heily wrote:

> 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:

Hi Mark--

I've added AC_SEARCH_LIB() line for -lkqueue based on looking for the function 
kqueue().  Howeve,r I haven't yet added configure.ac bits to try to find 
event.h in its alternative location.  Given that package installation 
conventions vary by OS/distribution (/opt, /usr/local, /usr, ...), would it 
might make more sense to simply add a "--with-kqueue-includ-path" argument to 
configure?  This would avoid requiring systems that put package-specific 
headers elsewhere having to patch configure.ac further.

Are you able to get basic test programs running with libdispatch and libkqueue 
on Linux now?

Robert

>
> 	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
> _______________________________________________
> libdispatch-dev mailing list
> libdispatch-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/libdispatch-dev
>



More information about the libdispatch-dev mailing list