From 855872c6ba16151de3a663540646466110824758 Mon Sep 17 00:00:00 2001 From: David Grove Date: Mon, 14 Dec 2015 22:09:50 +0000 Subject: [PATCH] Propagate linker flags for kqueue and pthread_workqueue If libdispatch is using functions found in libkqueue or libpthread_workqueue, then we want libdispatch.so to depend on those libraries so we don't have to specify them explictly in the application linking command. This change does that by adding KQUEUE_LIBS and PTHREAD_WORKQUEUE_LIBS to the linking command for libdispatch.la and exposing HAVE_PTHREAD_WORKQUEUE as a variable to automake. --- configure.ac | 5 ++++- src/Makefile.am | 5 +++++ src/shims/.dirstamp | 0 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 src/shims/.dirstamp diff --git a/configure.ac b/configure.ac index 75a00ac56..3669c1d9e 100644 --- a/configure.ac +++ b/configure.ac @@ -157,8 +157,11 @@ AS_IF([test -n "$apple_libpthread_source_path" -a -n "$apple_xnu_source_osfmk_pa ]) AC_CHECK_HEADERS([pthread_machdep.h pthread/qos.h]) AC_CHECK_HEADERS([pthread/workqueue_private.h pthread_workqueue.h], - [AC_DEFINE(HAVE_PTHREAD_WORKQUEUES, 1, [Define if pthread work queues are present])] + [AC_DEFINE(HAVE_PTHREAD_WORKQUEUES, 1, [Define if pthread work queues are present]) + have_pthread_workqueues=true], + [have_pthread_workqueues=false] ) +AM_CONDITIONAL(HAVE_PTHREAD_WORKQUEUES, $have_pthread_workqueues) AC_CHECK_HEADERS([libproc_internal.h], [], [], [#include ]) AC_CHECK_FUNCS([pthread_workqueue_setdispatch_np _pthread_workqueue_init]) AS_IF([test -n "$apple_libpthread_source_path" -a -n "$apple_xnu_source_osfmk_path"], [ diff --git a/src/Makefile.am b/src/Makefile.am index bce643252..bf3b84181 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -57,6 +57,11 @@ AM_CXXFLAGS=$(DISPATCH_CFLAGS) $(CXXBLOCKS_FLAGS) AM_OBJCXXFLAGS=$(DISPATCH_CFLAGS) $(CXXBLOCKS_FLAGS) libdispatch_la_LDFLAGS=-avoid-version +libdispatch_la_LIBADD=$(KQUEUE_LIBS) $(PTHREAD_WORKQUEUE_LIBS) + +if HAVE_PTHREAD_WORKQUEUES +PTHREAD_WORKQUEUE_LIBS=-lpthread_workqueue +endif if HAVE_DARWIN_LD libdispatch_la_LDFLAGS+=-Wl,-compatibility_version,1 \ diff --git a/src/shims/.dirstamp b/src/shims/.dirstamp new file mode 100644 index 000000000..e69de29bb