glue in working autoconf logic
This commit is contained in:
@@ -1,6 +1,20 @@
|
||||
|
||||
AC_DEFUN([rk_LIBDISPATCH],[
|
||||
|
||||
AM_CONDITIONAL(LIBDISPATCH, test foo = bar)
|
||||
AC_CHECK_HEADERS([dispatch/dispatch.h])
|
||||
|
||||
AC_FIND_FUNC_NO_LIBS(dispatch_async_f, dispatch,
|
||||
[#ifdef HAVE_DISPATCH_DISPATCH_H
|
||||
#include <dispatch/dispatch.h>
|
||||
#endif],[0,0,0])
|
||||
|
||||
if test "$ac_cv_func_dispatch_async_f" = yes ; then
|
||||
AC_DEFINE([HAVE_GCD], 1, [Define if os support gcd.])
|
||||
libdispatch=yes
|
||||
else
|
||||
libdispatch=no
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(have_gcd, test "$libdispatch" = yes)
|
||||
|
||||
])
|
@@ -29,7 +29,7 @@ noinst_PROGRAMS = tc ts
|
||||
ts_LDADD = libheim-ipcs.la
|
||||
tc_LDADD = libheim-ipcc.la
|
||||
|
||||
if LIBDISPATCH
|
||||
if have_gcd
|
||||
|
||||
heim_ipc.h heim_ipcUser.c heim_ipcServer.c heim_ipcServer.h: heim_ipc.defs
|
||||
mig -header heim_ipc.h -user heim_ipcUser.c -sheader heim_ipcServer.h -server heim_ipcServer.c -I$(srcdir) $(srcdir)/heim_ipc.defs
|
||||
@@ -40,7 +40,6 @@ heim_ipc_async.h heim_ipc_asyncUser.c heim_ipc_asyncServer.c heim_ipc_asyncServe
|
||||
heim_ipc_reply.h heim_ipc_replyUser.c: heim_ipc_reply.defs
|
||||
mig -header heim_ipc_reply.h -user heim_ipc_replyUser.c -sheader /dev/null -server /dev/null -I$(srcdir) $(srcdir)/heim_ipc_reply.defs
|
||||
|
||||
|
||||
built_ipcc = heim_ipc.h heim_ipcUser.c
|
||||
built_ipcc += heim_ipc_asyncServer.c heim_ipc_asyncServer.h
|
||||
|
||||
@@ -56,4 +55,8 @@ libheim_ipcs_la_LIBADD += -lbsm
|
||||
|
||||
CLEANFILES = $(built_ipcc) $(built_ipcs)
|
||||
|
||||
$(srcdir)/client.c: $(built_ipcc)
|
||||
$(srcdir)/server.c: $(built_ipcs)
|
||||
|
||||
|
||||
endif
|
@@ -35,7 +35,7 @@
|
||||
|
||||
#include "hi_locl.h"
|
||||
|
||||
#if defined(__APPLE__) && defined(HAVE_LIBDISPATCH)
|
||||
#if defined(__APPLE__) && defined(HAVE_GCD)
|
||||
|
||||
#include "heim_ipc.h"
|
||||
#include "heim_ipc_asyncServer.h"
|
||||
@@ -458,7 +458,7 @@ struct hipc_ops {
|
||||
};
|
||||
|
||||
struct hipc_ops ipcs[] = {
|
||||
#if defined(__APPLE__) && defined(HAVE_LIBDISPATCH)
|
||||
#if defined(__APPLE__) && defined(HAVE_GCD)
|
||||
{ "MACH", mach_init, mach_release, mach_ipc, mach_async },
|
||||
#endif
|
||||
#ifdef HAVE_DOOR
|
||||
|
@@ -35,8 +35,6 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define HAVE_LIBDISPATCH 1
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
@@ -50,7 +48,7 @@
|
||||
|
||||
#include <heim-ipc.h>
|
||||
|
||||
#if defined(__APPLE__) && defined(HAVE_LIBDISPATCH)
|
||||
#if defined(__APPLE__) && defined(HAVE_GCD)
|
||||
#include <mach/mach.h>
|
||||
#include <servers/bootstrap.h>
|
||||
#include <dispatch/dispatch.h>
|
||||
|
@@ -42,7 +42,7 @@ struct heim_sipc {
|
||||
void *mech;
|
||||
};
|
||||
|
||||
#if defined(__APPLE__) && defined(HAVE_LIBDISPATCH)
|
||||
#if defined(__APPLE__) && defined(HAVE_GCD)
|
||||
|
||||
#include "heim_ipcServer.h"
|
||||
#include "heim_ipc_reply.h"
|
||||
@@ -386,7 +386,7 @@ mach_checkin_or_register(const char *service)
|
||||
}
|
||||
|
||||
|
||||
#endif /* __APPLE__ && HAVE_LIBDISPATCH */
|
||||
#endif /* __APPLE__ && HAVE_GCD */
|
||||
|
||||
|
||||
int
|
||||
@@ -394,7 +394,7 @@ heim_sipc_launchd_mach_init(const char *service,
|
||||
heim_ipc_callback callback,
|
||||
void *user, heim_sipc *ctx)
|
||||
{
|
||||
#if defined(__APPLE__) && defined(HAVE_LIBDISPATCH)
|
||||
#if defined(__APPLE__) && defined(HAVE_GCD)
|
||||
mach_port_t sport = MACH_PORT_NULL;
|
||||
heim_sipc c = NULL;
|
||||
int ret;
|
||||
@@ -429,10 +429,10 @@ heim_sipc_launchd_mach_init(const char *service,
|
||||
mach_port_mod_refs(mach_task_self(), sport,
|
||||
MACH_PORT_RIGHT_RECEIVE, -1);
|
||||
return ret;
|
||||
#else /* !(__APPLE__ && HAVE_LIBDISPATCH) */
|
||||
#else /* !(__APPLE__ && HAVE_GCD) */
|
||||
*ctx = NULL;
|
||||
return EINVAL;
|
||||
#endif /* __APPLE__ && HAVE_LIBDISPATCH */
|
||||
#endif /* __APPLE__ && HAVE_GCD */
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -447,7 +447,7 @@ heim_sipc_launchd_mach_init(const char *service,
|
||||
void
|
||||
heim_sipc_timeout(time_t t)
|
||||
{
|
||||
#if defined(__APPLE__) && defined(HAVE_LIBDISPATCH)
|
||||
#if defined(__APPLE__) && defined(HAVE_GCD)
|
||||
static dispatch_once_t timeoutonce;
|
||||
init_globals();
|
||||
dispatch_sync(timerq, ^{
|
||||
@@ -469,7 +469,7 @@ heim_sipc_timeout(time_t t)
|
||||
void
|
||||
heim_sipc_set_timeout_handler(void (*func)(void))
|
||||
{
|
||||
#if defined(__APPLE__) && defined(HAVE_LIBDISPATCH)
|
||||
#if defined(__APPLE__) && defined(HAVE_GCD)
|
||||
init_globals();
|
||||
dispatch_sync(timerq, ^{ timer_ev = func; });
|
||||
#else
|
||||
|
Reference in New Issue
Block a user