])
AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np])
+needsync=true
+
+AS_IF([$needsync], [
+ dnl Linux
+ AC_MSG_CHECKING([for Linux futex() support])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <unistd.h>
+#include <limits.h>
+#include <sys/time.h>
+#include <sys/syscall.h>
+#include <linux/futex.h>
+
+int main(void);
+],
+[
+{
+ return syscall(SYS_futex, NULL, FUTEX_WAIT, 0, NULL, NULL, 0);
+}
+])], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_SYNC_LINUX_FUTEX,,Have Linux futex support)
+ needsync=false
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+])
+
+AS_IF([$needsync], [
+ dnl FreeBSD
+ AC_MSG_CHECKING([for FreeBSD _umtx_op() support])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#include <errno.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/umtx.h>
+int main(void);
+],
+[
+{
+ return _umtx_op(NULL, UMTX_OP_WAIT_UINT, 0, NULL, NULL);
+}
+])], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_SYNC_UMTX_OP,,Have FreeBSD _umtx_op() support)
+ needsync=false
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+])
+
+AS_IF([$needsync], [
+ dnl OpenBSD patch (not upstream at the time of writing this)
+ dnl https://marc.info/?l=openbsd-tech&m=147299508409549&w=2
+ AC_MSG_CHECKING([for OpenBSD futex() support])
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([
+#include <sys/futex.h>
+int main(void);
+],
+[
+{
+ return futex(NULL, FUTEX_WAIT, 0, NULL, NULL, 0);
+}
+])], [
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_SYNC_OPENBSD_FUTEX,,Have OpenBSD futex support)
+ needsync=false
+ ], [
+ AC_MSG_RESULT([no])
+ ])
+])
+
dnl Utility macro to avoid retyping includes all the time
m4_define([FRR_INCLUDES],
[#ifdef SUNOS_5
], [[#include <libyang/libyang.h>]])
CFLAGS="$ac_cflags_save"
-ac_libs_save="$LIBS"
-LIBS="$LIBS $LIBYANG_LIBS"
-AC_CHECK_FUNC([ly_register_types], [
- libyang_ext_builtin=true
- AC_DEFINE([LIBYANG_EXT_BUILTIN], [1], [have ly_register_types()])
-], [
- libyang_ext_builtin=false
- AC_MSG_WARN([===== old libyang (before 0.16.74) detected =====])
- AC_MSG_WARN([The available version of libyang does not seem to support])
- AC_MSG_WARN([built-in YANG extension modules. This will cause "make check"])
- AC_MSG_WARN([to fail and may create installation and version mismatch issues.])
- AC_MSG_WARN([Support for the old mechanism will be removed at some point.])
- AC_MSG_WARN([Please update libyang to version 0.16.74 or newer.])
- AC_MSG_WARN([===== old libyang (before 0.16.74) detected =====])
-])
-AM_CONDITIONAL([LIBYANG_EXT_BUILTIN], [$libyang_ext_builtin])
-LIBS="$ac_libs_save"
-
dnl ---------------
dnl configuration rollbacks
dnl ---------------