debian: depend on liburing-dev for debian >= 11

Prepare for the io_uring backend, by conditionally depending on
liburing-dev on debian >= 11 based distributions. On debian 10 based
distributions, set --disable-uring as configure flag.

Closes: OS#6143
Related: https://askubuntu.com/a/761943
Change-Id: If7832baec0bddbe0bbbbfe07f77bba3deb328d5c
diff --git a/debian/rules b/debian/rules
index 91d5678..efa5adc 100755
--- a/debian/rules
+++ b/debian/rules
@@ -25,8 +25,19 @@
 override_dh_auto_test:
 	dh_auto_test || (find . -name testsuite.log -exec cat {} \; ; false)
 
+# Set --disable-uring for debian < 11 based distributions
 override_dh_auto_configure:
-	dh_auto_configure -- --enable-static --disable-sctp-tests --enable-systemd-logging
+	set -x && \
+	CONFIGURE_FLAGS=" \
+		--disable-sctp-tests \
+		--enable-static \
+		--enable-systemd-logging \
+	"; \
+	base_ver="$$(dpkg -l base-files | grep "^ii" | awk '{print $$3}')"; \
+	if dpkg --compare-versions "$$base_ver" lt 11; then \
+		CONFIGURE_FLAGS="$$CONFIGURE_FLAGS --disable-uring"; \
+	fi; \
+	dh_auto_configure -- $$CONFIGURE_FLAGS
 
 override_dh_clean:
 	dh_clean