commit 541417a8ab273253821d28ba990814d1042d2e43 from: Omar Polo date: Wed Dec 21 15:09:16 2022 UTC configure.ac: expand the check for sys/tree.h do not just see if it's there, make sure it is usable. Currently, alpine sys/tree.h generates code that doesn't work with both gcc and clang (for different reasons!) so make sure we can actually use it, or fall back on the bundled version. commit - 5745ff217a0a853cbefd0f0b31b53cea3236fd0b commit + 541417a8ab273253821d28ba990814d1042d2e43 blob - ac19dd9afed5a2550dc9fa8c565ad3c7454dd86d blob + 3cbb1f8918ab7bc44d622d5e918fdf633e5d1940 --- configure.ac +++ configure.ac @@ -96,8 +96,37 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ AC_DEFINE([HAVE_QUEUE_H], 1, [QUEUE_H]) ], AC_MSG_RESULT(no)) -AC_CHECK_HEADERS([sys/tree.h]) +AC_MSG_CHECKING([for usable sys/tree.h]) +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ +#include +#include +struct client { + int id; + SPLAY_ENTRY(client) sp_entry; +}; +SPLAY_HEAD(clients_tree_id, client) clients; + +static inline int +clients_tree_cmp(struct client *a, struct client *b) +{ + if (a->id == b->id) + return 0; + else if (a->id < b->id) + return -1; + else + return +1; +} + +SPLAY_PROTOTYPE(clients_tree_id, client, sp_entry, clients_tree_cmp); +SPLAY_GENERATE(clients_tree_id, client, sp_entry, clients_tree_cmp); +], [ + return 0; +])], [ + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_SYS_TREE_H], 1, [TREE_H]) +], AC_MSG_RESULT(no)) + AC_CHECK_HEADER([endian.h], [AC_DEFINE(HAVE_ENDIAN_H, 1, [have endian.h])], [ AC_CHECK_HEADER([sys/endian.h], [AC_DEFINE(HAVE_SYS_ENDIAN_H, 1, [have sys/endian.h])], [