diff -ru iproute2-6.6.0.orig/configure iproute2-6.6.0/configure
--- iproute2-6.6.0.orig/configure	2023-12-08 12:17:55.387586321 +0100
+++ iproute2-6.6.0/configure	2023-12-08 12:18:23.310954338 +0100
@@ -265,6 +265,11 @@
 
 check_elf()
 {
+    if [ "$LIBELF_FORCE" = off ]; then
+	echo "no"
+	return
+    fi
+
     if ${PKG_CONFIG} libelf --exists; then
 	echo "HAVE_ELF:=y" >>$CONFIG
 	echo "yes"
@@ -384,6 +389,11 @@
 check_selinux()
 # SELinux is a compile time option in the ss utility
 {
+	if [ "$LIBSELINUX_FORCE" = off ]; then
+		echo "no"
+		return
+	fi
+
 	if ${PKG_CONFIG} libselinux --exists; then
 		echo "HAVE_SELINUX:=y" >>$CONFIG
 		echo "yes"
@@ -397,6 +407,11 @@
 
 check_tirpc()
 {
+	if [ "$LIBTIRPC_FORCE" = off ]; then
+		echo "no"
+		return
+	fi
+
 	if ${PKG_CONFIG} libtirpc --exists; then
 		echo "HAVE_RPC:=y" >>$CONFIG
 		echo "yes"
@@ -410,6 +425,11 @@
 
 check_mnl()
 {
+	if [ "$LIBMNL_FORCE" = off ]; then
+		echo "no"
+		return
+	fi
+
 	if ${PKG_CONFIG} libmnl --exists; then
 		echo "HAVE_MNL:=y" >>$CONFIG
 		echo "yes"
@@ -423,6 +443,11 @@
 
 check_berkeley_db()
 {
+    if [ "$LIBBERKELEYDB_FORCE" = off ]; then
+        echo "no"
+        return
+    fi
+
     cat >$TMPDIR/dbtest.c <<EOF
 #include <fcntl.h>
 #include <stdlib.h>
@@ -468,6 +493,11 @@
 
 check_cap()
 {
+	if [ "$LIBCAP_FORCE" = off ]; then
+		echo "no"
+		return
+	fi
+
 	if ${PKG_CONFIG} libcap --exists; then
 		echo "HAVE_CAP:=y" >>$CONFIG
 		echo "yes"
