]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Fix compile with rbtree and queue on Linux
authorRoy Marples <roy@marples.name>
Fri, 31 Oct 2025 07:28:53 +0000 (07:28 +0000)
committerRoy Marples <roy@marples.name>
Fri, 31 Oct 2025 07:28:53 +0000 (07:28 +0000)
configure
src/Makefile
src/auth.h
src/queue.h

index 47371e1fee31f9e74dd41e2952c3d88ab21da684..66024f16f665b6297460ad6f51e28185207a0846 100755 (executable)
--- a/configure
+++ b/configure
@@ -1220,6 +1220,12 @@ fi
 if [ "$RBTREE" = no ]; then
        echo "RBTREE_CPPFLAGS=          -DRBLOCAL" >>$CONFIG_MK
        echo "VENDOR_SRCS+=     vendor/rbtree.c" >>$CONFIG_MK
+       # Tell rbtree.c to #include "rbtree.h" rather than sys/rbtree.h
+       echo "RBTREE_CPPFLAGS+= -DRBLOCAL" >>$CONFIG_MK
+       # Remove unused warning from compile
+       echo "RBTREE_CPPFLAGS+= \"-D__unused=__attribute__((__unused__))\"" >>$CONFIG_MK
+       # Enjoy the same optimisation as NetBSD's libc
+       echo "RBTREE_CPPFLAGS+= \"-D__predict_false(exp)=__builtin_expect((exp) ? 1 : 0, 0)\"" >>$CONFIG_MK
 else
        echo "#define   HAVE_SYS_RBTREE_H" >>$CONFIG_H
 fi
index 65a7397175e1cb4b6771b912acf43f8e3dba8d0f..01ab319b2eade78be2d95ef6a575168076c2f4cd 100644 (file)
@@ -56,7 +56,7 @@ dev:
        cd dev && ${MAKE}
 
 ../vendor/rbtree.o:
-       ${CC} ${CFLAGS} ${CPPFLAGS} ${RBTREE_CFLAGS} ${RBTREE_CPPFLAGS} -c $< -o $@
+       ${CC} ${CFLAGS} ${CPPFLAGS} ${RBTREE_CFLAGS} ${RBTREE_CPPFLAGS} -c ../vendor/rbtree.c -o $@
 
 .c.o:
        ${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@
index 2c0676ff415258a2a29f867629aa4220ae59f47f..fbffd8ed95cee1c1ef9e72afde9defa321940013 100644 (file)
@@ -29,6 +29,8 @@
 #ifndef AUTH_H
 #define AUTH_H
 
+#include <stdint.h>
+
 #include "queue.h"
 
 #define DHCPCD_AUTH_SEND       (1 << 0)
index efc69ab6cf80606180be8cde09c5602cbfe7f568..d83fc62cba18ff071172777436fd9326ef2a33fe 100644 (file)
@@ -12,6 +12,5 @@
 #define        TAILQ_FOREACH_SAFE      TAILQ_FOREACH_MUTABLE
 #endif
 #else
-#error
 #include "../vendor/queue.h"
 #endif