Skip to content

Commit 5389e02

Browse files
dgrove-ossdas
authored andcommitted
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. Signed-off-by: Daniel A. Steffen <dsteffen@apple.com>
1 parent 73c1f6a commit 5389e02

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

configure.ac

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,11 @@ AS_IF([test -n "$apple_libpthread_source_path" -a -n "$apple_xnu_source_osfmk_pa
157157
])
158158
AC_CHECK_HEADERS([pthread_machdep.h pthread/qos.h])
159159
AC_CHECK_HEADERS([pthread/workqueue_private.h pthread_workqueue.h],
160-
[AC_DEFINE(HAVE_PTHREAD_WORKQUEUES, 1, [Define if pthread work queues are present])]
160+
[AC_DEFINE(HAVE_PTHREAD_WORKQUEUES, 1, [Define if pthread work queues are present])
161+
have_pthread_workqueues=true],
162+
[have_pthread_workqueues=false]
161163
)
164+
AM_CONDITIONAL(HAVE_PTHREAD_WORKQUEUES, $have_pthread_workqueues)
162165
AC_CHECK_HEADERS([libproc_internal.h], [], [], [#include <mach/mach.h>])
163166
AC_CHECK_FUNCS([pthread_workqueue_setdispatch_np _pthread_workqueue_init])
164167
AS_IF([test -n "$apple_libpthread_source_path" -a -n "$apple_xnu_source_osfmk_path"], [

src/Makefile.am

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ AM_CXXFLAGS=$(DISPATCH_CFLAGS) $(CXXBLOCKS_FLAGS)
5757
AM_OBJCXXFLAGS=$(DISPATCH_CFLAGS) $(CXXBLOCKS_FLAGS)
5858

5959
libdispatch_la_LDFLAGS=-avoid-version
60+
libdispatch_la_LIBADD=$(KQUEUE_LIBS) $(PTHREAD_WORKQUEUE_LIBS)
61+
62+
if HAVE_PTHREAD_WORKQUEUES
63+
PTHREAD_WORKQUEUE_LIBS=-lpthread_workqueue
64+
endif
6065

6166
if HAVE_DARWIN_LD
6267
libdispatch_la_LDFLAGS+=-Wl,-compatibility_version,1 \

0 commit comments

Comments
 (0)