Add compatibility for Swift corelibs libdispatch release

This updates the libdispatch runloop integration to be compatible with the Swift corelibs libdispatch release:
https://github.com/apple/swift-corelibs-libdispatch

In that release, the main queue handle and drain functions have been renamed with a "_4CF" (for CoreFoundation) suffix and have moved to private.h, so we now check for the existance of this header and function names.

Note that libdispatch must be compiled with INSTALL_PRIVATE_HEADERS=YES.

Also fixes the checks for the HAVE_LIBDISPATCH_RUNLOOP define (was inverted) and ensures that both the handle and drain functions are available.
This commit is contained in:
Frederik Seiffert 2019-05-07 16:33:20 +02:00
parent 8ed7ccea9e
commit 43c5ccaef6
4 changed files with 64 additions and 5 deletions

32
configure vendored
View file

@ -12410,6 +12410,20 @@ else
have_dispatch=no
fi
done
# check for private header which includes runloop integration functions in
# the Swift corelibs libdispatch release
for ac_header in dispatch/private.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "dispatch/private.h" "ac_cv_header_dispatch_private_h" "$ac_includes_default"
if test "x$ac_cv_header_dispatch_private_h" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_DISPATCH_PRIVATE_H 1
_ACEOF
fi
done
fi
@ -12515,10 +12529,24 @@ _ACEOF
fi
done
if test "$ac_cv_func_dispatch_main_queue_drain_np" = "no"; then
if test "$ac_cv_func_dispatch_main_queue_drain_np" = "yes" && test "$ac_cv_func_dispatch_get_main_queue_handle_np" = "yes"; then
HAVE_LIBDISPATCH_RUNLOOP=1
fi
if test "$ac_cv_func_dispatch_get_main_queue_handle_np" = "no"; then
# Check for "_4CF" variants of runloop integration functions provided by the
# Swift corelibs libdispatch release
for ac_func in _dispatch_main_queue_callback_4CF _dispatch_get_main_queue_handle_4CF
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
if test "$ac_cv_func__dispatch_main_queue_callback_4CF" = "yes" && test "$ac_cv_func__dispatch_get_main_queue_handle_4CF" = "yes"; then
HAVE_LIBDISPATCH_RUNLOOP=1
fi
fi