From d5536a344fab6d4d82ad3ac6f4cd2fe1f460dc5c Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Thu, 30 Oct 2025 19:08:32 +0000 Subject: [PATCH] Fix some fallout from prior --- configure | 2 +- src/Makefile | 3 +++ src/control.h | 1 + src/queue.h | 17 +++++++++++++++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/queue.h diff --git a/configure b/configure index a0243dac..47371e1f 100755 --- a/configure +++ b/configure @@ -1218,7 +1218,7 @@ EOF rm -f _rbtree.c _rbtree fi if [ "$RBTREE" = no ]; then - echo "#define RBLOCAL" >>$CONFIG_H + echo "RBTREE_CPPFLAGS= -DRBLOCAL" >>$CONFIG_MK echo "VENDOR_SRCS+= vendor/rbtree.c" >>$CONFIG_MK else echo "#define HAVE_SYS_RBTREE_H" >>$CONFIG_H diff --git a/src/Makefile b/src/Makefile index f308ae1a..65a73971 100644 --- a/src/Makefile +++ b/src/Makefile @@ -55,6 +55,9 @@ all: ${TOP}/config.h ${PROG} ${SCRIPTS} ${MAN5} ${MAN8} dev: cd dev && ${MAKE} +../vendor/rbtree.o: + ${CC} ${CFLAGS} ${CPPFLAGS} ${RBTREE_CFLAGS} ${RBTREE_CPPFLAGS} -c $< -o $@ + .c.o: ${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ diff --git a/src/control.h b/src/control.h index 8a3d3d59..ef592268 100644 --- a/src/control.h +++ b/src/control.h @@ -32,6 +32,7 @@ #include #include "dhcpcd.h" +#include "queue.h" #if !defined(CTL_FREE_LIST) #define CTL_FREE_LIST 1 diff --git a/src/queue.h b/src/queue.h new file mode 100644 index 00000000..efc69ab6 --- /dev/null +++ b/src/queue.h @@ -0,0 +1,17 @@ +/* + * This stub exists becuase we know a modern BSD supports all TAILQ + * and glibc, musl et all, don't. + */ +#if (defined(__unix__) || defined(unix)) && !defined(USG) +#include +#endif +#ifdef BSD +#include +/* Dragonfly BSD needs this :( */ +#if !defined(TAILQ_FOREACH_SAFE) && defined(TAILQ_FOREACH_MUTABLE) +#define TAILQ_FOREACH_SAFE TAILQ_FOREACH_MUTABLE +#endif +#else +#error +#include "../vendor/queue.h" +#endif -- 2.47.3